bitburner-src/tests/tests.bundle.js.map
2018-06-08 22:25:28 -05:00

1 line
6.4 MiB
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///./src/Player.js","webpack:///./utils/HelperFunctions.js","webpack:///./utils/StringHelperFunctions.js","webpack:///./src/Constants.js","webpack:///./src/Location.js","webpack:///./src/engine.js","webpack:///./src/NetscriptEvaluator.js","webpack:///./utils/DialogBox.js","webpack:///./utils/JSONReviver.js","webpack:///./src/Company.js","webpack:///./src/Server.js","webpack:///./src/Faction.js","webpack:///./utils/YesNoBox.js","webpack:///./node_modules/numeral/min/numeral.min.js","webpack:///./src/CreateProgram.js","webpack:///./src/BitNode.js","webpack:///./utils/IPAddress.js","webpack:///./src/SpecialServerIps.js","webpack:///./src/Terminal.js","webpack:///./src/Augmentations.js","webpack:///./src/NetscriptWorker.js","webpack:///./src/StockMarket.js","webpack:///./src/Settings.js","webpack:///./node_modules/decimal.js/decimal.es6.js","webpack:///./src/InteractiveTutorial.js","webpack:///./src/Script.js","webpack:///./src/Bladeburner.js","webpack:///./src/Crimes.js","webpack:///./src/Message.js","webpack:///./src/Alias.js","webpack:///./src/NetscriptFunctions.js","webpack:///./node_modules/jszip/lib/utils.js","webpack:///./src/Fconf.js","webpack:///./src/Missions.js","webpack:///./src/DarkWeb.js","webpack:///./utils/acorn.js","webpack:///./src/Gang.js","webpack:///./src/HacknetNode.js","webpack:///./node_modules/jszip/lib/stream/GenericWorker.js","webpack:///./node_modules/jquery/dist/jquery.js","webpack:///./src/ActiveScriptsUI.js","webpack:///./src/CompanyManagement.js","webpack:///./src/TextFile.js","webpack:///./src/SourceFile.js","webpack:///./src/RedPill.js","webpack:///./src/NetscriptPort.js","webpack:///./src/SaveObject.js","webpack:///(webpack)/buildin/global.js","webpack:///./node_modules/pako/lib/utils/common.js","webpack:///./node_modules/jszip/lib/support.js","webpack:///./utils/LogBox.js","webpack:///./node_modules/readable-stream/lib/_stream_duplex.js","webpack:///./src/Literature.js","webpack:///./utils/GameOptions.js","webpack:///./node_modules/inherits/inherits_browser.js","webpack:///./node_modules/jszip/lib/utf8.js","webpack:///./src/Prestige.js","webpack:///./node_modules/jszip/lib/external.js","webpack:///./node_modules/core-util-is/lib/util.js","webpack:///./node_modules/process/browser.js","webpack:///./node_modules/buffer/index.js","webpack:///./node_modules/chai/lib/chai/utils/flag.js","webpack:///./node_modules/jszip/node_modules/core-js/library/modules/_global.js","webpack:///./node_modules/jszip/lib/nodejsUtils.js","webpack:///./node_modules/safe-buffer/index.js","webpack:///./node_modules/process-nextick-args/index.js","webpack:///./node_modules/sprintf-js/src/sprintf.js","webpack:///./src/NetscriptEnvironment.js","webpack:///./src/CinematicText.js","webpack:///./src/HelpText.js","webpack:///./node_modules/chai/lib/chai/utils/transferFlags.js","webpack:///./node_modules/chai/lib/chai/config.js","webpack:///./node_modules/chai/lib/chai.js","webpack:///./node_modules/pako/lib/zlib/messages.js","webpack:///./node_modules/jszip/lib/crc32.js","webpack:///./node_modules/jszip/lib/compressedObject.js","webpack:///./node_modules/jszip/node_modules/core-js/library/modules/_descriptors.js","webpack:///./node_modules/jszip/node_modules/core-js/library/modules/_is-object.js","webpack:///./node_modules/readable-stream/lib/_stream_writable.js","webpack:///./node_modules/readable-stream/readable-browser.js","webpack:///./node_modules/events/events.js","webpack:///(webpack)/buildin/amd-define.js","webpack:///./src/NetscriptJSEvaluator.js","webpack:///./src/ServerPurchases.js","webpack:///./src/FactionInfo.js","webpack:///./node_modules/jszip/lib/reader/Uint8ArrayReader.js","webpack:///./node_modules/jszip/lib/reader/DataReader.js","webpack:///./node_modules/jszip/lib/reader/ArrayReader.js","webpack:///./node_modules/jszip/lib/reader/readerFor.js","webpack:///./node_modules/jszip/lib/signature.js","webpack:///./node_modules/pako/lib/zlib/constants.js","webpack:///./node_modules/pako/lib/zlib/zstream.js","webpack:///./node_modules/pako/lib/utils/strings.js","webpack:///./node_modules/pako/lib/zlib/crc32.js","webpack:///./node_modules/pako/lib/zlib/adler32.js","webpack:///./node_modules/jszip/lib/compressions.js","webpack:///./node_modules/jszip/lib/stream/Crc32Probe.js","webpack:///./node_modules/jszip/lib/stream/DataLengthProbe.js","webpack:///./node_modules/jszip/lib/stream/DataWorker.js","webpack:///./node_modules/jszip/lib/defaults.js","webpack:///./node_modules/jszip/lib/stream/StreamHelper.js","webpack:///./node_modules/jszip/node_modules/core-js/library/modules/_dom-create.js","webpack:///./node_modules/jszip/node_modules/core-js/library/modules/_fails.js","webpack:///./node_modules/jszip/node_modules/core-js/library/modules/_ctx.js","webpack:///./node_modules/jszip/node_modules/core-js/library/modules/_core.js","webpack:///./node_modules/jszip/lib/base64.js","webpack:///./node_modules/readable-stream/lib/_stream_transform.js","webpack:///./node_modules/string_decoder/lib/string_decoder.js","webpack:///./node_modules/timers-browserify/main.js","webpack:///./node_modules/readable-stream/lib/internal/streams/destroy.js","webpack:///./node_modules/readable-stream/lib/internal/streams/stream-browser.js","webpack:///./node_modules/readable-stream/lib/_stream_readable.js","webpack:///./node_modules/jszip/lib/readable-stream-browser.js","webpack:///./node_modules/isarray/index.js","webpack:///./node_modules/brace/worker/javascript.js","webpack:///./node_modules/uuid/v4.js","webpack:///./utils/FactionInvitationBox.js","webpack:///./utils/InfiltrationBox.js","webpack:///./src/Infiltration.js","webpack:///./node_modules/file-saver/FileSaver.js","webpack:///./node_modules/jszip/lib/index.js","webpack:///./node_modules/chai/lib/chai/utils/proxify.js","webpack:///./node_modules/chai/lib/chai/utils/addLengthGuard.js","webpack:///./node_modules/chai/lib/chai/utils/isProxyEnabled.js","webpack:///./node_modules/chai/lib/chai/utils/inspect.js","webpack:///./node_modules/type-detect/type-detect.js","webpack:///./node_modules/uuid/lib/bytesToUuid.js","webpack:///./node_modules/uuid/lib/rng-browser.js","webpack:///./src/NetscriptJSPreamble.js","webpack:///./node_modules/bluebird/js/browser/bluebird.js","webpack:///(webpack)/buildin/amd-options.js","webpack:///./node_modules/jszip/lib/zipEntry.js","webpack:///./node_modules/jszip/lib/reader/NodeBufferReader.js","webpack:///./node_modules/jszip/lib/reader/StringReader.js","webpack:///./node_modules/jszip/lib/zipEntries.js","webpack:///./node_modules/jszip/lib/load.js","webpack:///./node_modules/jszip/lib/nodejs/NodejsStreamInputAdapter.js","webpack:///./node_modules/jszip/lib/generate/ZipFileWorker.js","webpack:///./node_modules/pako/lib/zlib/gzheader.js","webpack:///./node_modules/pako/lib/zlib/inftrees.js","webpack:///./node_modules/pako/lib/zlib/inffast.js","webpack:///./node_modules/pako/lib/zlib/inflate.js","webpack:///./node_modules/pako/lib/inflate.js","webpack:///./node_modules/pako/lib/zlib/trees.js","webpack:///./node_modules/pako/lib/zlib/deflate.js","webpack:///./node_modules/pako/lib/deflate.js","webpack:///./node_modules/pako/index.js","webpack:///./node_modules/jszip/lib/flate.js","webpack:///./node_modules/jszip/lib/generate/index.js","webpack:///./node_modules/jszip/lib/zipObject.js","webpack:///./node_modules/jszip/lib/nodejs/NodejsStreamOutputAdapter.js","webpack:///./node_modules/jszip/lib/stream/ConvertWorker.js","webpack:///./node_modules/immediate/lib/browser.js","webpack:///./node_modules/lie/lib/browser.js","webpack:///./node_modules/jszip/node_modules/core-js/library/modules/_cof.js","webpack:///./node_modules/jszip/node_modules/core-js/library/modules/_html.js","webpack:///./node_modules/jszip/node_modules/core-js/library/modules/_invoke.js","webpack:///./node_modules/jszip/node_modules/core-js/library/modules/_task.js","webpack:///./node_modules/jszip/node_modules/core-js/library/modules/_property-desc.js","webpack:///./node_modules/jszip/node_modules/core-js/library/modules/_to-primitive.js","webpack:///./node_modules/jszip/node_modules/core-js/library/modules/_ie8-dom-define.js","webpack:///./node_modules/jszip/node_modules/core-js/library/modules/_an-object.js","webpack:///./node_modules/jszip/node_modules/core-js/library/modules/_object-dp.js","webpack:///./node_modules/jszip/node_modules/core-js/library/modules/_hide.js","webpack:///./node_modules/jszip/node_modules/core-js/library/modules/_a-function.js","webpack:///./node_modules/jszip/node_modules/core-js/library/modules/_export.js","webpack:///./node_modules/jszip/node_modules/core-js/library/modules/web.immediate.js","webpack:///./node_modules/jszip/node_modules/core-js/library/fn/set-immediate.js","webpack:///./node_modules/readable-stream/passthrough.js","webpack:///./node_modules/readable-stream/transform.js","webpack:///./node_modules/readable-stream/duplex-browser.js","webpack:///./node_modules/readable-stream/writable-browser.js","webpack:///./node_modules/readable-stream/lib/_stream_passthrough.js","webpack:///./node_modules/util-deprecate/browser.js","webpack:///./node_modules/setimmediate/setImmediate.js","webpack:///util (ignored)?9884","webpack:///./node_modules/readable-stream/lib/internal/streams/BufferList.js","webpack:///util (ignored)","webpack:///./node_modules/stream-browserify/index.js","webpack:///./node_modules/ieee754/index.js","webpack:///./node_modules/base64-js/index.js","webpack:///./node_modules/jszip/lib/object.js","webpack:///./node_modules/acorn/dist/walk.js","webpack:///./node_modules/brace/ext/language_tools.js","webpack:///./node_modules/brace/keybinding/emacs.js","webpack:///./node_modules/brace/keybinding/vim.js","webpack:///./node_modules/brace/theme/xcode.js","webpack:///./node_modules/brace/theme/twilight.js","webpack:///./node_modules/brace/theme/terminal.js","webpack:///./node_modules/brace/theme/solarized_light.js","webpack:///./node_modules/brace/theme/solarized_dark.js","webpack:///./node_modules/brace/theme/monokai.js","webpack:///./node_modules/brace/theme/chrome.js","webpack:///./node_modules/brace/theme/chaos.js","webpack:///./netscript.js","webpack:///./node_modules/brace/mode/javascript.js","webpack:///./node_modules/brace/index.js","webpack:///./node_modules/jsplumb/dist/js/jsplumb.js","webpack:///./node_modules/check-error/index.js","webpack:///./node_modules/chai/lib/chai/utils/getOwnEnumerablePropertySymbols.js","webpack:///./node_modules/chai/lib/chai/utils/objDisplay.js","webpack:///./node_modules/chai/lib/chai/utils/getProperties.js","webpack:///./node_modules/get-func-name/index.js","webpack:///./node_modules/chai/lib/chai/utils/getActual.js","webpack:///./node_modules/assertion-error/index.js","webpack:///./node_modules/chai-as-promised/lib/chai-as-promised.js","webpack:///./node_modules/chai/lib/chai/interface/assert.js","webpack:///./node_modules/chai/lib/chai/interface/should.js","webpack:///./node_modules/chai/lib/chai/interface/expect.js","webpack:///./node_modules/chai/lib/chai/core/assertions.js","webpack:///./node_modules/chai/lib/chai/assertion.js","webpack:///./node_modules/chai/lib/chai/utils/isNaN.js","webpack:///./node_modules/chai/lib/chai/utils/getOwnEnumerableProperties.js","webpack:///./node_modules/chai/lib/chai/utils/compareByInspect.js","webpack:///./node_modules/chai/lib/chai/utils/overwriteChainableMethod.js","webpack:///./node_modules/chai/lib/chai/utils/addChainableMethod.js","webpack:///./node_modules/chai/lib/chai/utils/overwriteMethod.js","webpack:///./node_modules/chai/lib/chai/utils/overwriteProperty.js","webpack:///./node_modules/chai/lib/chai/utils/addMethod.js","webpack:///./node_modules/chai/lib/chai/utils/addProperty.js","webpack:///./node_modules/deep-eql/index.js","webpack:///./node_modules/chai/lib/chai/utils/getEnumerableProperties.js","webpack:///./node_modules/chai/lib/chai/utils/getMessage.js","webpack:///./node_modules/chai/lib/chai/utils/expectTypes.js","webpack:///./node_modules/chai/lib/chai/utils/test.js","webpack:///./node_modules/pathval/index.js","webpack:///./node_modules/chai/lib/chai/utils/index.js","webpack:///./node_modules/chai/index.js","webpack:///./tests/NetscriptJSTest.js","webpack:///./tests/index.js"],"names":[],"mappings":";AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAK;AACL;AACA;;AAEA;AACA;AACA,yDAAiD,cAAc;AAC/D;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;;AAGA;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACjEgC;AACc;AAGrB;AACP;AACE;AACH;AACqB;AACvB;AAEe;AACL;AACP;AACyB;AACC;AACC;AACR;;AAErC;AACwB;AACI;AACL;AAEE;AACzB;AAEyC;;AAEzC;AACA;AACA;;AAEA;AACA;AACA;AACA,4BAA4B;AAC5B,4BAA4B;AAC5B,4BAA4B;AAC5B,4BAA4B;;AAE5B;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,sFAA0C;AAC1C,sFAA0C;;AAE1C;AACA;;AAEA;AACA;AACA;;AAEA;AACA,0BAA0B;AAC1B,8BAA8B;;AAE9B;AACA,qCAAqC;AACrC,qCAAqC;AACrC;AACA;AACA;;AAEA;AACA,uBAAuB;AACvB,iCAAiC;;AAEjC;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;;AAEA,wBAAwB;AACxB;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,wDAAwD;AACxD;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,8BAA8B;AAC9B;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB,qBAAqB;AACrB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iCAAiC;AACjC,iCAAiC;AACjC;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B;AAC5B;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,mBAAmB,0BAA0B;AAC7C,0EAA0E;AAC1E;AACA;AACA;;AAEA;AACA;AACA,8DAA8D;AAC9D;AACA;AACA;;AAEA;AACA;AACA,+DAA+D;AAC/D;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,+DAA+D;AAC/D;AACA;AACA;;AAEA;AACA;AACA,oEAAoE;AACpE;AACA;AACA;;AAEA;AACA;AACA,qEAAqE;AACrE;AACA;AACA;;AAEA;AACA;AACA,oEAAoE;AACpE;AACA;AACA;;AAEA;AACA;AACA,sEAAsE;AACtE;AACA;AACA;;AAEA;AACA;AACA,oEAAoE;AACpE;AACA;AACA;;AAEA;AACA;AACA,qEAAqE;AACrE;AACA;AACA;;AAEA;AACA;AACA,2EAA2E;AAC3E;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA,qCAAqC;AACrC,qCAAqC;AACrC,qCAAqC;AACrC,qCAAqC;AACrC,qCAAqC;AACrC,qCAAqC;AACrC,qCAAqC;AACrC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,gBAAgB;;AAEhB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB;;AAEhB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB;;AAEhB;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,2BAA2B;AAC3B;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,2BAA2B;AAC3B;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,2BAA2B;AAC3B;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,+BAA+B;AAC/B,kCAAkC;AAClC;;AAEA;AACA;AACA,mBAAmB,4CAA4C;AAC/D;AACA;AACA;AACA,kCAAkC;AAClC;AACA,iFAAiF;AACjF;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;;AAEA;AACA;AACA;AACA,kDAAkD;AAClD,0CAA0C;;AAE1C;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB;;AAEhB;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;;AAEA;AACA;;AAEA,2DAA2D,wBAAwB;;AAEnF;AACA;AACA,sBAAsB;AACtB,uBAAuB;AACvB;;AAEA;AACA;AACA;AACA,sDAAsD;AACtD;;AAEA;AACA;AACA;AACA,4BAA4B;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,0BAA0B;AAC1B,YAAY;AACZ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oFAAwC;AACxC;AACA;AACA;;AAEA;;AAEA;AACA;AACA,mBAAmB;AACnB;AACA;AACA;;AAEA;AACA,sEAA2B;AAC3B;AACA,6BAA6B;;AAE7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B;AAC3B;AACA,aAAa;AACb,2BAA2B;AAC3B;AACA;AACA,aAAa;AACb,2BAA2B;AAC3B;AACA;AACA,mBAAmB;AACnB;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+CAA+C;AAC/C;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,mBAAmB;AACnB;AACA;AACA;AACA,KAAK;AACL,mBAAmB;AACnB;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,uFAA2C;AAC3C;AACA;AACA,KAAK;AACL,mBAAmB;AACnB;AACA;AACA;;AAEA;AACA,oFAAwC;AACxC;AACA;AACA,KAAK;AACL,mBAAmB;AACnB;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,oFAAwC;AACxC;AACA;AACA,KAAK;AACL,mBAAmB;AACnB;AACA;AACA;;AAEA;AACA,oFAAwC;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB;AACnB;AACA;AACA,KAAK;AACL,mBAAmB;AACnB;AACA;AACA;;AAEA;AACA,oFAAwC;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB;AACnB;AACA;AACA,KAAK;AACL,mBAAmB;AACnB;AACA;AACA;;AAEA;AACA,oFAAwC;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB;AACnB;AACA;AACA,KAAK;AACL,mBAAmB;AACnB;AACA;AACA;;AAEA;AACA,oFAAwC;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB;AACnB;AACA;AACA,KAAK;AACL,mBAAmB;AACnB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,mBAAmB,+BAA+B;AAClD;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,eAAe;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,mBAAmB,6BAA6B;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,6BAA6B;;AAE7B;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,mBAAmB,8BAA8B;AACjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA,sDAAsD;AACtD;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,uBAAuB,yCAAyC;AAChE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AChzER;AAAA;AACiB;AACO;;AAExB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,6CAA6C;;AAE7C;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,uBAAuB,0DAA0D;AACjF;AACA;AACA;AACA;;AAEA;AACA;AACA,qBAAqB,sEAAsE;AAC3F;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,uBAAuB;AACvB,4BAA4B;AAC5B;AACA;;AAEA;AACA,qDAAqD;AACrD,4BAA4B;AAC5B;AACA;;AAEA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,WAAW,OAAO;AAClB,aAAa,YAAY;AACzB,YAAY,MAAM;AAClB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,sCAAsC;AACtC;AACA,6BAA6B;AAC7B,6BAA6B;AAC7B,6BAA6B;AAC7B,6BAA6B;AAC7B,6BAA6B;AAC7B,6BAA6B;AAC7B,6BAA6B;AAC7B,6BAA6B;AAC7B,6BAA6B;AAC7B,6BAA6B;AAC7B,6BAA6B;AAC7B,6BAA6B;AAC7B,6BAA6B;AAC7B,6BAA6B;AAC7B,6BAA6B;AAC7B,6BAA6B;AAC7B,6BAA6B;AAC7B,6BAA6B;AAC7B,6BAA6B;AAC7B;AACA;AACA;AACA,6BAA6B;AAC7B,6BAA6B;AAC7B,6BAA6B;AAC7B,6BAA6B;AAC7B,6BAA6B;AAC7B,6BAA6B;AAC7B,6BAA6B;AAC7B;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;AACL;AACA;AACA;AACA;AACA,SAAS;AACT;AACA,6BAA6B;AAC7B,6BAA6B;AAC7B,6BAA6B;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,SAAS;;AAET,mBAAmB,kBAAkB;AACrC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,iCAAiC;AACjC,iCAAiC;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,mBAAmB,OAAO;AAC1B;AACA;AACA;;AAEA;AACA,6CAA6C,QAAQ;AACrD;AACA;AACA;;AAEA;AACA,oBAAoB;AACpB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,mBAAmB,eAAe;AAClC,6BAA6B;AAC7B;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,mBAAmB;AACnB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,wCAAwC;AACxC;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAOA;;;;;;;;;;;;;;;;;;;;;;;ACrRwB;;AAExB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA,eAAe;AACf,gBAAgB;AAChB,kBAAkB;AAClB;AACA;AACA;;AAEA;AACA;AACA,uCAAuC;AACvC,8BAA8B;;AAE9B;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,4CAA4C,KAAK;AACjD;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,mBAAmB,OAAO;AAC1B;;AAEA;AACA;;AAIA;;;;;;;;;;;;ACrJA;AAAA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sDAAsD;AACtD,sEAAsE;AACtE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACxfY;AAEqB;AACrB;AACF;AACH;AACA;AACW;AACD;AACV;AAC6B;AAET;AACU;;AAErB;AACmB;AACpB;AACvB;AACqB;AAKO;;AAE5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA,KAAK;;AAEL;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kCAAkC;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA,SAAS;AACT;AACA,SAAS;AACT;AACA,SAAS;AACT;AACA,SAAS;AACT;AACA,SAAS;AACT;AACA,SAAS;AACT;AACA,SAAS;AACT;AACA,SAAS;AACT;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,mEAAwB;AACxB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uFAA4C;AAC5C;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,SAAS;AACT;AACA,SAAS;AACT;AACA,SAAS;AACT;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA,EAAE;;AAEF;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA,EAAE;;AAEF;AACA;AACA;AACA;AACA;AACA,EAAE;;AAEF;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA,EAAE;;AAEF;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA,EAAE;;AAEF;AACA;AACA;AACA;AACA;AACA,EAAE;;AAEF;AACA;AACA;AACA;AACA;AACA,EAAE;;AAEF;AACA;AACA;AACA;AACA;AACA,EAAE;;AAEF;AACA;AACA;AACA;AACA;AACA,EAAE;;AAEF;AACA;AACA;AACA;AACA;AACA,EAAE;;AAEF;AACA;AACA;AACA;AACA;AACA,EAAE;;AAEF;AACA;AACA;AACA;AACA;AACA,EAAE;;AAEF;AACA;AACA;AACA;AACA;AACA,EAAE;;AAEF;AACA;AACA;AACA;AACA;AACA,EAAE;;AAEF;AACA;AACA;AACA;AACA;AACA,EAAE;;AAEF;AACA;AACA;AACA;AACA;AACA,EAAE;;AAEF;AACA;AACA;AACA;AACA;AACA,EAAE;;AAEF;AACA;AACA;AACA;AACA;AACA,EAAE;;AAEF;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA,EAAE;;AAEF;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA,EAAE;;AAEF;AACA;AACA;AACA;AACA;AACA,EAAE;;AAEF;AACA;AACA;AACA;AACA;AACA,EAAE;;AAEF;AACA;AACA;AACA;AACA;AACA,EAAE;;AAEF;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA,EAAE;;AAEF;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA,EAAE;;AAEF;AACA;AACA;AACA;AACA;AACA,EAAE;;AAEF;AACA;AACA;AACA;AACA;AACA,EAAE;;AAEF;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA,EAAE;;AAEF;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA,EAAE;;AAEF;AACA;AACA;AACA;AACA;AACA,EAAE;;AAEF;AACA;AACA;AACA;AACA;AACA,EAAE;;AAEF;AACA;AACA;AACA;AACA;AACA,EAAE;;AAEF;AACA;AACA;AACA;AACA;AACA,EAAE;;AAEF;AACA;AACA;AACA;AACA;AACA,EAAE;;AAEF;AACA;AACA;AACA;AACA;AACA,EAAE;;AAEF;AACA;AACA;AACA;AACA;AACA,EAAE;;AAEF;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;;AAEA;AACA,sCAAsC;AACtC;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,gCAAgC,QAAQ;;AAExC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wCAAwC;AACxC;AACA;AACA,sCAAsC;AACtC;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,iJAAsD,SAAS;AAC/D;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,KAAK;;AAEL;AACA,uEAA4B;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA,0BAA0B;AAC1B;AACA,sBAAsB;AACtB,oCAAoC;AACpC;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;;AAEQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACnoEgB;AACwB;AAGzB;AACvB;AAEyC;AAEpB;;AAEY;AAGG;AAEL;AACX;AACM;AACc;AACpB;AACF;AAGe;AAGK;AAChB;AAEM;AAEf;AAEqB;AACX;AACA;AACsB;AACd;AAEY;AAEpB;AACR;AAEY;AACP;AACS;AAEK;AACa;AACX;AACC;AACU;AAKb;AACa;;AAE/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yFAA2C;AAC3C;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;;AAGA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA,4EAAgC;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0GAA0G;AAC1G,KAAK;;AAEL;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;;AAEA;AACA;AACA;AACA;AACA,aAAa;;AAEb;AACA;AACA;AACA,aAAa;AACb;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,kEAAkE;AAClE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,KAAK;;AAEL;AACA;;AAEA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA,uBAAuB,wEAA4B;AACnD;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA,aAAa,IAAI;AACjB;AACA;AACA;;AAEA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;;AAEA;AACA,uBAAuB,kFAAsC;AAC7D;AACA;;AAEA,kHAAgD,4BAA4B;AAC5E;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA,uCAAuC,kFAAsC;AAC7E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;;AAEjB;AACA,aAAa;AACb;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;AACA,uFAA2C;AAC3C,8FAAkD;AAClD;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA,aAAa;AACb;AACA,aAAa;AACb;AACA,aAAa;AACb;AACA,aAAa;AACb;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA,aAAa;AACb;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,gDAAgD;AAChD,aAAa;AACb;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;;AAEA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2DAA2D;AAC3D;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,iHAAiH;;AAEjH;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;;AAEL;AACA;AACA,sBAAsB;AACtB;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,uBAAuB,kBAAkB;AACzC;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,uBAAuB,kBAAkB;AACzC;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA,uBAAuB,kBAAkB;AACzC;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;;AAEA,uBAAuB,kBAAkB;AACzC;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,wCAAwC;AACxC,0BAA0B;AAC1B;AACA,0FAAgC;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,2HAAuE;AACvE;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA,iBAAiB;AACjB;AACA,iBAAiB;AACjB;AACA,iBAAiB;AACjB;AACA,iBAAiB;AACjB;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,2FAA+C;AAC/C,kGAAsD;AACtD;AACA;;AAEA;AACA,2BAA2B;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sFAA0C;AAC1C,kBAAkB;AAClB,uFAA2C;AAC3C,kBAAkB;AAClB,mFAAuC;AACvC,kBAAkB;AAClB,uFAA2C;AAC3C,kBAAkB;AAClB,2FAA+C;AAC/C,kBAAkB;;AAElB;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA,wCAAwC;AACxC,2BAA2B;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,aAAa;AACb;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA,SAAS;;;AAGT;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA,SAAS;;AAET;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA,iBAAiB;AACjB;AACA,iBAAiB;AACjB;AACA,iBAAiB;AACjB;AACA,iBAAiB;AACjB;AACA;AACA,aAAa;AACb;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;;AAEL;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,iCAAiC;AACjC;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,iCAAiC;AACjC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qCAAqC;AACrC;;AAEA;AACA,wCAAwC;AACxC;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AChvDmB;AACT;AACH;AACK;AACkB;AACZ;AACT;AAEK;;AAEF;AACD;AACM;AACR;;AAEjB;;AAEA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B;AAC3B;AACA;AACA;AACA,2BAA2B;AAC3B;AACA;AACA;AACA,6EAA6E;AAC7E;AACA;AACA,iBAAiB;AACjB;AACA;AACA,qBAAqB;AACrB;AACA;AACA,qBAAqB;AACrB;AACA,qBAAqB;AACrB;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB,mGAAmD;AACnD;AACA;AACA;;AAEA;AACA,2CAA2C,wBAAwB;AACnE;AACA;AACA;AACA,iCAAiC;AACjC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,6BAA6B;AAC7B;AACA;AACA;AACA;AACA,iCAAiC;AACjC;AACA,iCAAiC;AACjC;AACA;AACA;AACA;AACA;AACA;AACA,qCAAqC;AACrC;AACA;AACA,yCAAyC;AACzC;AACA;AACA;AACA,iCAAiC;AACjC;AACA;AACA,6BAA6B;AAC7B,yBAAyB;AACzB;AACA;AACA;AACA;AACA;AACA,yCAAyC;AACzC;AACA,yCAAyC;AACzC;AACA;AACA;AACA,iCAAiC;AACjC;AACA;AACA,6BAA6B;AAC7B,yBAAyB;AACzB;AACA;AACA;AACA;AACA;AACA,qCAAqC;AACrC;AACA;AACA;AACA;AACA;AACA;AACA,qCAAqC;AACrC,iCAAiC;AACjC;AACA;AACA,6BAA6B;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iCAAiC;AACjC;AACA;AACA;AACA;AACA,qBAAqB;AACrB,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB;AACzB;AACA;AACA,6BAA6B;AAC7B;AACA;AACA,yBAAyB;AACzB,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB;AACzB;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA,iBAAiB;AACjB;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;AACL;AACA,KAAK,EAAE;AACP;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;AACL;;AAEA;AACA;AACA,uBAAuB;AACvB;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,aAAa;AACb;AACA;AACA,SAAS;AACT;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA,iBAAiB;AACjB,aAAa;AACb;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA,uBAAuB;;AAEvB;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA,aAAa;AACb;AACA,aAAa;AACb,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,0CAA0C;AAC1C;AACA,mEAAmE;AACnE;AACA,mEAAmE;AACnE;AACA,mEAAmE;AACnE;AACA,mEAAmE;AACnE;AACA,mEAAmE;AACnE;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA,aAAa;AACb,SAAS;AACT;AACA;AACA,aAAa;AACb;AACA,aAAa;AACb,SAAS;AACT;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA,uBAAuB;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA,iCAAiC;AACjC;AACA,iCAAiC;AACjC;AACA,iCAAiC;AACjC,yBAAyB;AACzB;AACA;AACA,qBAAqB;AACrB;AACA,qBAAqB;AACrB,iBAAiB;AACjB;AACA;AACA,aAAa;AACb;AACA,aAAa;AACb;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA,qBAAqB;AACrB,iBAAiB;AACjB;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA,uBAAuB;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B;AAC7B;AACA,6BAA6B;AAC7B,yBAAyB;AACzB;AACA;AACA,qBAAqB;AACrB;AACA,qBAAqB;AACrB,iBAAiB;AACjB;AACA;AACA,aAAa;AACb;AACA,aAAa;AACb;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA,uBAAuB;AACvB;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,SAAS;AACT;AACA,SAAS;AACT;AACA,SAAS;AACT;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,0BAA0B;AAC1B;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL,uBAAuB,2BAA2B;AAClD;AACA;AACA;;AAEA;AACA;AACA;AACA,0BAA0B;AAC1B;AACA;AACA,mBAAmB,2BAA2B;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B;AAC1B;AACA;;AAEA;AACA;AACA,uFAA+B,oBAAoB;AACnD,KAAK;AACL;AACA,0BAA0B;AAC1B;AACA;AACA;;AAEA;AACA;AACA,6BAA6B;AAC7B;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B,sBAAsB;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB;AACzB;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA,6BAA6B;AAC7B;AACA;;AAEA;AACA;AACA,iBAAiB;AACjB,sCAAsC;AACtC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB;AACvB,sBAAsB;AACtB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA,IAAI;AACJ;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,mBAAmB,iBAAiB;AACpC;AACA;AACA;AACA;AACA;;AAEA;AACA,mBAAmB,2BAA2B;AAC9C;AACA;AACA;AACA;AACA,kDAAkD;AAClD;AACA;;AAEA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA,6DAA6D;AAC7D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA,kGAAyB;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB,qBAAqB;AACrB,UAAU;AACV;;AAEA;AACA;AACA;AACA;AACA,6GAAkE;AAClE;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,iCAAiC;AACjC,iCAAiC;AACjC;AACA;;AAEA;AACA;AACA;AACA;AACA,2GAAgE;AAChE;AACA;;AAEA;AACA;AACA;AACA;AACA,6GAAkE;AAClE;AACA;;AAMA;;;;;;;;;;;;;ACl6BA;AAAA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA,CAAC;;;AAGD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,CAAC;;AAED;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,oCAAoC;;AAEpC;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,KAAK;AACL;;AAEQ;;;;;;;;;;;;;;;ACvER;AAAA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,0BAA0B;;AAE1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,4BAA4B;AAC5B;;AAEA;AACA,iBAAiB,qBAAqB;AACtC;AACA;AACA;AACA,UAAU;AACV;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEQ;;;;;;;;;;;;;;;;;;;;;;;;;ACtEU;AACA;AACH;;AAGU;;AAEzB;AACA;AACA;AACA;AACA;AACA;AACA,iCAAiC;AACjC,iCAAiC;AACjC,yCAAyC;AACzC,sCAAsC;;AAEtC;AACA;AACA;AACA;;AAEA;AACA;AACA,iCAAiC;AACjC,gCAAgC;AAChC;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,iDAAiD;AACjD;;AAEA;AACA,mBAAmB,sBAAsB;AACzC;AACA;AACA;;AAEA;AACA,mBAAmB,kCAAkC;AACrD;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,wDAAwD;AACxD,oEAAoE;AACpE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,wDAAwD;AACxD,oEAAoE;AACpE;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0CAA0C;AAC1C;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,4DAA4D;AAC5D;AACA;;AAEA;AACA;AACA,4DAA4D;AAC5D;AACA;;AAEA;AACA;AACA;AACA;AACA,oDAAoD;AACpD;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,0BAA0B;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,iCAAiC;AACjC,iCAAiC;AACjC,iCAAiC;AACjC,iCAAiC;AACjC,iCAAiC;AACjC,iCAAiC;AACjC,iCAAiC;AACjC;AACA;AACA;AACA;AACA;;AAIA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AC7nC2B;AACT;AACD;AACF;AACe;AACe;AACxB;AAC8B;AAE1B;;AAEzB,wBAAwB,6FAAiC;AACzD;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,uCAAuC;;AAEvC;AACA,gEAAgE;AAChE;AACA,wBAAwB;;AAExB;AACA,6BAA6B;AAC7B;AACA;AACA;AACA,4BAA4B,oCAAoC;;AAEhE;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,0FAA0F;;AAE1F;AACA;AACA;;AAEA;AACA;AACA,sCAAsC;AACtC,sCAAsC;AACtC,sCAAsC;AACtC,sCAAsC;AACtC,sCAAsC;AACtC;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,mBAAmB,yBAAyB;AAC5C;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,wCAAwC;AACxC;;AAEA;AACA;AACA,mDAAmD;AACnD,kCAAkC;AAClC;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,mBAAmB,0BAA0B;AAC7C;AACA;AACA;AACA;;AAEA,mBAAmB,0BAA0B;AAC7C;AACA;AACA;AACA;;AAEA,mBAAmB,0BAA0B;AAC7C;AACA;AACA;AACA;;AAEA,mBAAmB,0BAA0B;AAC7C;AACA;AACA;AACA;;AAEA,mBAAmB,0BAA0B;AAC7C;AACA;AACA;AACA;;AAEA,mBAAmB,0BAA0B;AAC7C;AACA;AACA;AACA;;AAEA,mBAAmB,0BAA0B;AAC7C;AACA;AACA;AACA;;AAEA,mBAAmB,0BAA0B;AAC7C;AACA;AACA;AACA;;AAEA,mBAAmB,2BAA2B;AAC9C;AACA;AACA;AACA;;AAEA,mBAAmB,2BAA2B;AAC9C;AACA;AACA;AACA;;AAEA,mBAAmB,2BAA2B;AAC9C;AACA;AACA;AACA;;AAEA,mBAAmB,2BAA2B;AAC9C;AACA;AACA;AACA;;AAEA,mBAAmB,2BAA2B;AAC9C;AACA;AACA;AACA;;AAEA,mBAAmB,2BAA2B;AAC9C;AACA;AACA;AACA;;AAEA;AACA,mBAAmB,0BAA0B;AAC7C;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,sGAAwD;;AAExD;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,iCAAiC;AACjC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;;AAEL,iCAAiC;AACjC;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,oBAAoB;AACpB,oBAAoB;AACpB,gBAAgB;AAChB;AACA,0BAA0B;AAC1B,qBAAqB;AACrB;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACt5BgC;AACL;AACT;AACH;AACM;AACH;AACmB;AACtB;AACE;;AAEO;AACW;AAED;AAET;AACzB;AACqB;AAEsB;;AAE3C;AACA;AACA,8BAA8B;;AAE9B;AACA,6BAA6B;AAC7B,oCAAoC;AACpC,+BAA+B;AAC/B;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,wDAAwD;AACxD,oEAAoE;AACpE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,wDAAwD;AACxD,oEAAoE;AACpE;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,wC;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;;AAEL;AACA;AACA,gCAAgC;AAChC;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA,KAAK;AACL,yHAAsD,iCAAiC;AACvF;AACA;AACA;AACA;AACA;AACA;AACA,6FAAwC;AACxC;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA,KAAK;AACL,kHAA+C,iCAAiC;AAChF;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA,KAAK;AACL,uHAAoD,iCAAiC;AACrF;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA,KAAK;AACL,0HAAuD,iCAAiC;AACxF;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA,KAAK;AACL,oHAAiD,iCAAiC;AAClF;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,SAAS;AACT,sHAAmD,iCAAiC;AACpF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4FAA4F;AAC5F;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,uBAAuB,qBAAqB;AAC5C;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,mBAAmB,qBAAqB;AACxC;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA,0GAAuC,kCAAkC;AACzE;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,mBAAmB,qBAAqB;AACxC;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,mBAAmB,iBAAiB;AACpC;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,kFAAuC;AAClE;AACA;AACA;AACA;AACA;AACA,2BAA2B,4EAAiC;AAC5D;AACA;AACA;AACA;AACA;;AAEA;AACA,iHAA8C,uBAAuB;AACrE,gHAA6C,iBAAiB;AAC9D;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,aAAa;AACb;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,IAAI;AACb;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,uBAAuB,wBAAwB;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,+BAA+B,kFAAuC;AACtE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,YAAY,OAAO;AACtC,KAAK;AACL;AACA,mBAAmB;AACnB;AACA,KAAK;AACL;AACA,mBAAmB;AACnB;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,2BAA2B,oFAAyC;AACpE;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;;AAEA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,uBAAuB,4EAAiC;AACxD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,kFAAuC;AAC1D;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,mCAAmC;AACnC;AACA;AACA;;AAIA;;;;;;;;;;;;;;;;;;;;;;;AC5wB4B;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,iBAAiB;AACjB;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,uBAAuB,cAAc;AACrC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;;AAMA;;;;;;;;;;ACzFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe;AAAA;AAAA;AAAA;AAAA,+GAAyH,iBAAiB,gBAAgB,4BAA4B,sBAAsB,KAAK,IAAI,4FAA4F,IAAI,mJAAmJ,qBAAqB,YAAY,8BAA8B,yCAAyC,oCAAoC,iEAAiE,gFAAgF,KAAK,sHAAsH,gBAAgB,MAAM,+BAA+B,uBAAuB,kBAAkB,qCAAqC,sBAAsB,QAAQ,+BAA+B,qGAAqG,olCAAolC,wDAAwD,MAAM,uDAAuD,MAAM,wDAAwD,4EAA4E,IAAI,YAAY,iDAAiD,EAAE,8KAA8K,4BAA4B,sCAAsC,4CAA4C,sCAAsC,gFAAgF,KAAK,0FAA0F,sHAAsH,qBAAqB,MAAM,gIAAgI,SAAS,mBAAmB,mCAAmC,wBAAwB,wBAAwB,wBAAwB,iCAAiC,sBAAsB,yFAAyF,oEAAoE,qCAAqC,uCAAuC,KAAK,KAAK,eAAe,KAAK,2EAA2E,SAAS,KAAK,IAAI,8BAA8B,SAAS,wBAAwB,8BAA8B,6CAA6C,6BAA6B,4CAA4C,8BAA8B,sBAAsB,eAAe,IAAI,2BAA2B,iDAAiD,sIAAsI,gBAAgB,0BAA0B,0DAA0D,4DAA4D,0BAA0B,gCAAgC,kEAAkE,YAAY,oBAAoB,yBAAyB,0BAA0B,uCAAuC,0BAA0B,uCAAuC,6BAA6B,2CAA2C,4BAA4B,wFAAwF,0BAA0B,0BAA0B,oBAAoB,+JAA+J,mBAAmB,IAAI,kBAAkB,SAAS,2BAA2B,2UAA2U,EAAE,4PAA4P,mBAAmB,iBAAiB,eAAe,sBAAsB,6CAA6C,6DAA6D,qDAAqD,KAAK,4CAA4C,cAAc,MAAM,mCAAmC,SAAS,kBAAkB,mBAAmB,kBAAkB,mBAAmB,iBAAiB,kCAAkC,iBAAiB,oBAAoB,yBAAyB,kDAAkD,wDAAwD,sBAAsB,oBAAoB,yBAAyB,kDAAkD,oEAAoE,sBAAsB,oBAAoB,8BAA8B,uDAAuD,sDAAsD,oBAAoB,oBAAoB,8BAA8B,uCAAuC,oDAAoD,wBAAwB,qDAAqD,2BAA2B,YAAY,0BAA0B,gBAAgB,kDAAkD,qBAAqB,WAAW,mEAAmE,WAAW,YAAY,aAAa,2BAA2B,SAAS,gCAAgC,wBAAwB,sCAAsC,0JAA0J,sBAAsB,iDAAiD,EAAE,cAAc,OAAO,gEAAgE,IAAI,yEAAyE,mDAAmD,+BAA+B,iBAAiB,gEAAgE,SAAS,2CAA2C,wBAAwB,4FAA4F,iCAAiC,qBAAqB,+EAA+E,6BAA6B,MAAM,uCAAuC,sBAAsB,gCAAgC,MAAM,0BAA0B,KAAK,KAAK,kCAAkC,qBAAqB,MAAM,kCAAkC,qBAAqB,OAAO,QAAQ,UAAU,EAAE,cAAc,gCAAgC,SAAS,cAAc,wBAAwB,kDAAkD,oFAAoF,yOAAyO,kBAAkB,0BAA0B,4CAA4C,MAAM,yDAAyD,uBAAuB,KAAK,yBAAyB,2GAA2G,MAAM,0GAA0G,UAAU,EAAE,cAAc,mCAAmC,SAAS,sCAAsC,wBAAwB,iFAAiF,6BAA6B,EAAE,yDAAyD,sBAAsB,oBAAoB,kDAAkD,SAAS,qFAAqF,0EAA0E,EAAE,cAAc,+BAA+B,SAAS,aAAa,wBAAwB,yEAAyE,+EAA+E,EAAE,cAAc,kCAAkC,SAAS,4BAA4B,wBAAwB,oCAAoC,oLAAoL,sBAAsB,4BAA4B,4CAA4C,EAAE,cAAc,4BAA4B,SAAS,4BAA4B,wBAAwB,oFAAoF,+CAA+C,sBAAsB,uBAAuB,6IAA6I,EAAE,KAAK,E;;;;;;;;;;;;;;;;;;ACPvhW;AACH;AACO;;AAEtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;;AAGA;;;;;;;;;;;;;;;;;;ACpQe;;AAEf;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wEAAwE;AACxE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uEAAuE;AACvE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kEAAkE;AAClE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,0EAA+B;AAC1D;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAMA;;;;;;;;;;;;;;;;ACzWmB;AACnB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEQ;;;;;;;;;;;;;;;;;;;ACzCiB;;AAEzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAGA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AC9CgB;AACE;AACD;AAEiB;AACnB;AAEK;AACgB;AAGV;AACH;AACM;AAGK;AACQ;AAC3B;AACS;AAGC;AAEC;AACT;AAEU;AAEJ;;AAGQ;AACD;AACT;AAGsB;;AAE3C;AACA;;AAEA;AACA,0DAA0D;AAC1D;AACA,iHAAiH,8CAA8C,sBAAsB;AACrL;AACA;;AAEA;AACA;AACA,kHAAkH,8CAA8C;AAChK;AACA;;AAEA;AACA,8GAA8G,8CAA8C;AAC5J;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,yEAAyE;;AAEzE;AACA,mCAAmC;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,8CAA8C;AAC9C;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA,8CAA8C;AAC9C;AACA;;AAEA;AACA;AACA,6CAA6C;AAC7C;;AAEA;AACA;;AAEA;AACA;AACA,8FAAoD;AACpD;AACA,wCAAwC;AACxC;AACA;;AAEA,2BAA2B;AAC3B;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,kCAAkC,kEAAkE,EAAE;AACtG;;AAEA;AACA;AACA,8FAAoD;AACpD;AACA,wCAAwC;AACxC;AACA;;AAEA,2BAA2B;AAC3B;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,wCAAwC;AACxC;AACA,8BAA8B;AAC9B;AACA;;AAEA;AACA;AACA,6BAA6B;AAC7B;AACA,qCAAqC;;AAErC;AACA;AACA,2CAA2C;AAC3C,2CAA2C;AAC3C;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,aAAa;AACb;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;AACA,GAAG;AACH;AACA,SAAS;AACT;AACA,GAAG;AACH;AACA,uCAAuC;;AAEvC;AACA;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oDAAoD;AACpD,yHAAgD;;AAEhD;AACA;AACA;;AAEA;AACA;AACA;AACA,+CAA+C,QAAQ;AACvD;AACA;AACA;AACA;AACA,KAAK;AACL,+CAA+C,QAAQ;AACvD;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,uBAAuB,6BAA6B;AACpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,uBAAuB,6BAA6B;AACpD;AACA;;AAEA;AACA;AACA,sBAAsB,kCAAkC;AACxD;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,uBAAuB,6BAA6B;AACpD;AACA;AACA,uBAAuB,8BAA8B;AACrD;AACA;AACA;AACA;AACA,uBAAuB,+BAA+B;AACtD;AACA;AACA;;AAEA;AACA;AACA,uBAAuB,sCAAsC;AAC7D;AACA,+BAA+B;AAC/B,iCAAiC;AACjC,uCAAuC;AACvC;AACA;AACA;;AAEA;AACA;AACA;AACA,uBAAuB,6BAA6B;AACpD;AACA;AACA;AACA;;AAEA;AACA;AACA,uBAAuB,6BAA6B;AACpD;AACA;AACA,uBAAuB,+BAA+B;AACtD;AACA;AACA;AACA;AACA;;AAEA;AACA,uBAAuB,6BAA6B;AACpD;AACA;AACA,uBAAuB,8BAA8B;AACrD;AACA;AACA,uBAAuB,8BAA8B;AACrD;AACA;AACA;AACA;AACA;AACA,uBAAuB,+BAA+B;AACtD;AACA;AACA;AACA;;AAEA;AACA;AACA,uBAAuB,6BAA6B;AACpD;AACA;;AAEA;AACA;AACA,sBAAsB,kCAAkC;AACxD;AACA;AACA;AACA;;AAEA;AACA,uBAAuB,8BAA8B;AACrD;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,uBAAuB,+BAA+B;AACtD;AACA;AACA;AACA;;AAEA;AACA,uBAAuB,+BAA+B;AACtD;AACA;AACA,uBAAuB,6BAA6B;AACpD;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,wCAAwC;AACxC;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gDAAgD,cAAc;AAC9D;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gDAAgD,2BAA2B;AAC3E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,wCAAwC;AACxC;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oCAAoC;AACpC;AACA;AACA,yCAAyC,QAAQ;AACjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yCAAyC,kBAAkB;AAC3D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,2BAA2B,iBAAiB;;AAE5C;AACA;AACA;AACA;;AAEA;;AAEA;AACA,IAAI,OAAO;AACX;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,EAAE;;AAEF;AACA;AACA;AACA;AACA;AACA,uGAA2D;AAC3D,kBAAkB;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;;AAEA;AACA;AACA,IAAI;AACJ;AACA;;AAEA;AACA;AACA,IAAI;AACJ;AACA;;AAEA;AACA;AACA,IAAI;AACJ;AACA;;AAEA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,iCAAiC;;AAEjC;AACA;AACA;AACA,yCAAyC,mDAAmD;;AAE5F;AACA;AACA;AACA;AACA;AACA,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB,OAAO,kCAAkC;AAC9D,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA,mFAAmF;AACnF;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gEAAgE;AAChE;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA,8EAA8E;AAC9E;AACA;AACA;AACA,uHAAuH;AACvH;AACA,+BAA+B,uBAAuB;AACtD;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA,+BAA+B,wBAAwB;AACvD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA,mCAAmC,oBAAoB;AACvD;AACA;;AAEA;AACA;AACA,iHAAiH;AACjH;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oEAAoE;AACpE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,+BAA+B,mGAAuD;AACtF;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uCAAuC,sBAAsB;AAC7D,sEAAsE,kBAAkB;AACxF;AACA;AACA;AACA;AACA,uCAAuC,wBAAwB;AAC/D,wEAAwE,kBAAkB;AAC1F;AACA;AACA;;AAEA;AACA;AACA;AACA,8DAA8D;AAC9D;AACA,4DAA4D;AAC5D;AACA,4DAA4D;AAC5D;;AAEA,uCAAuC,YAAY;AACnD;AACA,qBAAqB;AACrB;AACA,iBAAiB;AACjB;AACA,mCAAmC,sBAAsB;AACzD;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0DAA0D;AAC1D;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0DAA0D;AAC1D;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yEAAyE;AACzE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kEAAkE;AAClE;AACA;AACA;AACA;AACA;AACA;AACA,kEAAkE;AAClE;AACA;AACA;AACA;AACA;AACA;AACA,wFAAwF;AACxF;AACA;AACA;AACA;AACA,+BAA+B,oBAAoB;AACnD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uDAAuD,QAAQ;AAC/D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0GAA0G;AAC1G;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,+BAA+B,6BAA6B;AAC5D;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uEAAuE;AACvE;;AAEA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB,mCAAmC,sBAAsB;AACzD;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB,mCAAmC,wBAAwB;AAC3D;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB,8HAA8H;AAC9H;AACA;AACA;AACA;AACA;AACA,sDAAsD;AACtD;AACA,mBAAmB,6BAA6B;AAChD;AACA;AACA,mCAAmC,uBAAuB;AAC1D;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sFAAsF;AACtF;;AAEA;AACA;;AAEA;AACA,mCAAmC,uBAAuB;AAC1D;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB,mCAAmC,sBAAsB;AACzD;AACA;AACA,2CAA2C,6BAA6B;AACxE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB,mCAAmC,uBAAuB;AAC1D;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB,mCAAmC,wBAAwB;AAC3D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,mCAAmC,8BAA8B;AACjE;AACA;AACA;AACA;AACA;;AAEA,iCAAiC;;AAEjC,mCAAmC,gCAAgC;AACnE;AACA;AACA,mCAAmC;AACnC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,mCAAmC,+BAA+B;AAClE;AACA;AACA;AACA;AACA;AACA;;AAEA,iCAAiC;;AAEjC,mCAAmC,iCAAiC;AACpE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,+BAA+B,6BAA6B;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,+BAA+B,+BAA+B;AAC9D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wEAAwE;AACxE;;AAEA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA,mCAAmC,oBAAoB;AACvD;AACA;;AAEA;AACA;AACA,iHAAiH;AACjH;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA,qCAAqC,EAAE,eAAe,EAAE;AACxD,oCAAoC,EAAE,eAAe,EAAE;AACvD,oCAAoC,EAAE,eAAe,EAAE;AACvD;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA,yDAAyD;AACzD;;AAEA;;AAEA;AACA;AACA,kBAAkB,+BAA+B;AACjD;;AAEA;AACA,uDAAuD;AACvD,8CAA8C;AAC9C;;AAEA;AACA,6DAA6D;AAC7D;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA,iBAAiB;AACjB;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE;;AAEF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4FAAwC;AACxC;AACA;AACA,KAAK;;AAEL;AACA;AACA,8EAA8E;AAC9E;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb,kFAAkF;AAClF;AACA;;AAEA;AACA;;AAEA;AACA;AACA,uBAAuB,uBAAuB;AAC9C;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,uBAAuB,sBAAsB;AAC7C;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;;AAEA;AACA,uBAAuB,uBAAuB;AAC9C;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA,aAAa;AACb;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA,uBAAuB,wBAAwB;AAC/C;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;;AAEA;AACA;;AAEA,uBAAuB,qBAAqB;AAC5C;AACA;AACA,KAAK;;AAEL;AACA;AACA,iFAAiF;AACjF;AACA;AACA;AACA,uBAAuB,mGAAuD;AAC9E;AACA;AACA,gCAAgC;AAChC;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB;AACzB,aAAa;AACb,yBAAyB;AACzB,aAAa;AACb;AACA;AACA,qDAAqD,QAAQ;AAC7D;AACA;AACA;AACA,yBAAyB,UAAU;AACnC;AACA;AACA;AACA,aAAa;AACb;AACA;;AAEA;AACA;AACA;AACA,mCAAmC;AACnC;AACA;AACA;AACA;AACA;;AAEA;AACA,uBAAuB,kBAAkB;AACzC;AACA;AACA;AACA,gEAAgE;AAChE;AACA;AACA,aAAa,IAAI;AACjB;;AAEA,KAAK;;AAEL;AACA;AACA,iEAAiE;AACjE;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE;;AAEF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA,iBAAiB;AACjB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,EAAE;;AAEF;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B,oBAAoB;AACnD;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb,+BAA+B,oBAAoB;AACnD;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;;AAEA;AACA,iBAAiB,2BAA2B;AAC5C;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AC7/DmB;AACT;AACH;AAEO;AACG;AACD;AACT;AACc;AACV;AACW;AACf;AACK;AACI;AAEuB;AAEtB;AACR;;AAEjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,mBAAmB,wBAAwB;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;;AAGA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,+BAA+B,4EAAiC;AAChE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,uBAAuB,4EAAiC;AACxD;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,kFAAuC;AAC1D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,uBAAuB,yBAAyB;AAChD;AACA;AACA;AACA;AACA;AACA,2BAA2B;AAC3B;AACA,gHAAqE;AACrE,6CAA6C;AAC7C;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,0BAA0B;AAC1B;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA,0HAAuD,2BAA2B;;AAElF,mBAAmB,kFAAuC;AAC1D;AACA;;AAEA;AACA;AACA;AACA;;AAEA,mHAAgD,wCAAwC;AACxF;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,KAAK;;AAEL,oHAAiD,2BAA2B;;AAE5E;AACA;AACA;AACA;AACA;AACA,2BAA2B,uBAAuB;AAClD,kEAAkE;AAClE;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,2BAA2B,uBAAuB;AAClD,iEAAiE;AACjE;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,mBAAmB,iBAAiB;AACpC;AACA;;AAEA;AACA;AACA;AACA;AACA,mHAAgD,wCAAwC;AACxF;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,mBAAmB,wBAAwB;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;;;AAKA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AC/iFiC;AACf;AACH;AACK;AAGO;AACH;AACF;AACH;AACF;;AAEH;AACU;AACU;;AAElC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B;AAC/B;AACA,6BAA6B;AAC7B,6BAA6B;;AAE7B;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,mBAAmB,2BAA2B;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,eAAe,+EAAiC;AAChD;AACA;;AAEA;AACA,mBAAmB,0BAA0B;AAC7C;AACA;AACA;AACA,+FAAmC;AACnC;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4CAA4C;;AAE5C,wDAAwD;;AAExD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB,aAAa;AACb;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,gBAAgB;AAChB,KAAK;AACL;;AAEA;AACA;AACA;;AAEA;AACA,0CAA0C,QAAQ;AAClD;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA,2BAA2B,qFAA0C;AACrE;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,wBAAwB,wFAA4B;;;AAGpD;AACA,gBAAgB,0BAA0B;AAC1C;AACA;AACA,yBAAyB;AACzB;AACA;AACA,aAAa;AACb;AACA,oHAA4D,oBAAoB;AAChF;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;;AAEA,KAAK;AACL;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA,IAAI;AACJ;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,gBAAgB,0BAA0B;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,8FAAmD;AACnD,gBAAgB,0BAA0B;AAC1C;AACA;AACA;;AAIA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACzUkB;AACH;AACG;AACuB;AACpB;AACN;;AAES;AAGM;AAEL;AACzB;AACqB;AAKqB;;AAE1C,wBAAwB;;AAExB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gDAAgD;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,wCAAwC;AACxC;AACA;AACA;AACA;AACA,uBAAuB,wBAAwB;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,uBAAuB,wBAAwB;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,wBAAwB;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA,oBAAoB;AACpB,qBAAqB;AACrB,0BAA0B;;AAE1B;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,4CAA4C;AAC5C;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,0BAA0B;AAC1B;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB;;AAEtB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,sBAAsB;AACtB;AACA;AACA;AACA;AACA;AACA,sCAAsC;AACtC,uBAAuB;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB;;AAEvB;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA,2CAA2C;AAC3C,uBAAuB;;AAEvB;AACA;AACA,wBAAwB;AACxB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,4CAA4C;AAC5C;AACA,4BAA4B;;AAE5B;AACA;AACA;AACA,iCAAiC;AACjC,aAAa;AACb;AACA,iCAAiC;AACjC;AACA;AACA,yBAAyB;AACzB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gDAAgD;AAChD;AACA;AACA;AACA;AACA,eAAe;AACf;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,wBAAwB;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,kFAAuC;AACvC,oFAAyC;;AAEzC;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA,4BAA4B;;AAE5B;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B,uBAAuB;AACtD;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA,+BAA+B,uBAAuB;AACtD;AACA;AACA;AACA;AACA,aAAa;AACb;;AAEA;AACA;AACA;AACA,gDAAgD,UAAU;AAC1D;AACA;AACA;AACA,sCAAsC;AACtC;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,4BAA4B;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA,iCAAiC;;AAEjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gDAAgD;AAChD;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,4CAA4C,UAAU;AACtD;AACA;AACA,2CAA2C;AAC3C;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,4BAA4B;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA,iCAAiC;AACjC;AACA;AACA;AACA,4CAA4C,UAAU;AACtD;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,uBAAuB;AAC1C;AACA;;AAEA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,+IAAyD;AACzD;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA,wCAAwC;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,+IAAyD;AACzD;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,iCAAiC;;AAEjC;AACA;AACA;AACA,sCAAsC;;AAEtC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA,+IAAyD;AACzD;AACA;AACA;AACA,wCAAwC;AACxC;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,mBAAmB,wBAAwB;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,6BAA6B,aAAa;AAC1C;AACA,aAAa;AACb;AACA;AACA,SAAS;;AAET;AACA;;AAMA;;;;;;;;;;;;;;;;;ACt0Ce;;AAEf;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,oBAAoB,EAAE,YAAY,EAAE;AACpC,oBAAoB,EAAE,YAAY,EAAE;AACpC,oBAAoB,EAAE,YAAY,EAAE;AACpC;AACA;AACA;AACA;AACA;;AAEQ;;;;;;;;;;;AC/GR;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;;AAGA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA,6BAA6B,gBAAgB,EAAE;AAC/C;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B;AAC7B,iDAAiD;AACjD;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,GAAG;;;AAGH;;;AAGA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;;AAGA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA,wCAAwC,OAAO;AAC/C;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA,GAAG;AACH;AACA;;AAEA;;AAEA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,OAAO;;AAEP,8CAA8C,IAAI,OAAO,IAAI;AAC7D;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,iBAAiB,aAAa;AAC9B;AACA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,QAAQ,KAAK;AACb;AACA;AACA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,GAAG;;AAEH;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA,UAAU,KAAK;AACf;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA,aAAa,GAAG;;AAEhB;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,QAAQ,UAAU;AAClB;AACA;;AAEA;AACA;;AAEA,sCAAsC,0BAA0B;AAChE;;AAEA;;AAEA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,sBAAsB;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL,oBAAoB,cAAc;AAClC;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,KAAK;AACL;;AAEA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,eAAe,KAAK;AACpB;;AAEA;AACA,GAAG;;AAEH;;AAEA;AACA;AACA;AACA;;AAEA,eAAe,SAAS;AACxB;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,2BAA2B,OAAO;;AAElC;AACA,qBAAqB,OAAO;;AAE5B;AACA,iBAAiB,oBAAoB;AACrC;AACA;AACA;;AAEA;AACA;;AAEA;AACA,QAAQ,iBAAiB;;AAEzB;AACA,QAAQ,aAAa;;AAErB;AACA;;AAEA;AACA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;;AAEA;;AAEA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,UAAU,KAAK;AACf;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,iBAAiB,GAAG;AACpB;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,uBAAuB,gBAAgB;;AAEvC;AACA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA,QAAQ,eAAe;AACvB;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA,GAAG;AACH;AACA;;AAEA;;AAEA;AACA,SAAS;AACT;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,OAAO;;AAEP,8CAA8C,IAAI,OAAO,IAAI;AAC7D;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,cAAc,KAAK;;AAEnB;AACA,eAAe,UAAU;AACzB;AACA,qBAAqB,OAAO;AAC5B;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,QAAQ,UAAU;;AAElB;AACA;;AAEA;AACA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,OAAO;AAChB,SAAS,OAAO;AAChB;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,OAAO;AAChB,SAAS,OAAO;AAChB;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA;AACA,SAAS,OAAO;AAChB,SAAS,OAAO;AAChB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,GAAG;AACH;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,OAAO;AAChB,SAAS,OAAO;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,GAAG;AACH;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,sBAAsB;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,OAAO;AAChB,SAAS,OAAO;AAChB;AACA;AACA;AACA;AACA;;;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,sBAAsB;AAC5B,SAAS,OAAO;AAChB;AACA,+CAA+C,GAAG;AAClD,6CAA6C,GAAG;AAChD;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA,GAAG;AACH;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,OAAO;AAChB,SAAS,OAAO;AAChB;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,GAAG,SAAS,GAAG;AAC1B;AACA;AACA;AACA;AACA,MAAM,sBAAsB;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,OAAO;AAChB,SAAS,OAAO;AAChB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,GAAG;AACH;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA,SAAS,OAAO;AAChB,SAAS,OAAO;AAChB;AACA,iCAAiC,GAAG;AACpC,mCAAmC,GAAG;AACtC,0CAA0C,GAAG;AAC7C,wCAAwC,GAAG;AAC3C;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,eAAe,qBAAqB;AACpC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;;AAEA;AACA,QAAQ,cAAc;;AAEtB;AACA;;;AAGA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,gBAAgB,SAAS;;AAEzB;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,QAAQ,UAAU;AAClB,2BAA2B,QAAQ;AACnC;AACA,eAAe,gBAAgB;AAC/B;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA,iBAAiB,KAAK;AACtB;AACA;AACA;;AAEA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,uBAAuB,KAAK;AAC5B;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,KAAK;AACL,qBAAqB,QAAQ;AAC7B;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA,UAAU,MAAM;AAChB;AACA;AACA;AACA;;AAEA;AACA,UAAU,uBAAuB;AACjC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,eAAe,uBAAuB;;AAEtC;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,cAAc,uBAAuB;AACrC;AACA;AACA;AACA;;AAEA;;AAEA;AACA,OAAO;;AAEP;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,cAAc,WAAW;;AAEzB;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,aAAa;;AAEb;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,WAAW;AACX;AACA;AACA,WAAW;;AAEX;AACA;;AAEA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;;AAEA,SAAS;;AAET;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA,4BAA4B,SAAS;AACrC;;AAEA;AACA;;AAEA;AACA;AACA,CAAC;;;AAGD;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,+BAA+B,SAAS;AACxC;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA,gBAAgB,YAAY;AAC5B;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,OAAO;AACP;;AAEA;AACA,wBAAwB,SAAS;;AAEjC;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,OAAO;;AAEP;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,aAAa;;AAEb;AACA;;AAEA;AACA,gCAAgC,SAAS;AACzC;AACA,qBAAqB,SAAS;;AAE9B;AACA;AACA;AACA;AACA;;AAEA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,uBAAuB,eAAe;AACtC;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;;AAGA;AACA;AACA;;AAEA;AACA,sBAAsB,SAAS;AAC/B;AACA;;;AAGA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;;;AAGA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA,UAAU,aAAa;;AAEvB;AACA,uBAAuB,SAAS;AAChC;;AAEA;AACA;;;AAGA;AACA;AACA,QAAQ,KAAK;AACb;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,mCAAmC;AACnC;;AAEA;;AAEA,SAAS;AACT;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;;AAGA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,QAAQ,mBAAmB;AAC3B;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAAS;AACT;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA;;AAEA;AACA,aAAa,0BAA0B;;AAEvC;AACA,wBAAwB,gCAAgC;AACxD;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,2BAA2B,SAAS;AACpC;AACA;AACA,KAAK;AACL;AACA;;AAEA,UAAU,KAAK;AACf;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,OAAO;;AAEP;AACA;AACA;AACA;AACA,OAAO;AACP;AACA,GAAG;;AAEH;AACA;AACA;AACA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,cAAc,aAAa;AAC3B;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,yCAAyC,kBAAkB;AAC3D;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,QAAQ,KAAK;AACb;AACA;AACA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,SAAS;AACT;AACA;AACA;AACA;;AAEA;AACA,iBAAiB,0BAA0B;AAC3C;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA,GAAG;AACH;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,UAAU,gBAAgB;;AAE1B;AACA;AACA,KAAK;AACL;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA,cAAc,uBAAuB;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,2BAA2B,cAAc;;AAEzC;AACA,2BAA2B,SAAS;;AAEpC;AACA;AACA;AACA;AACA;AACA,uBAAuB,SAAS;AAChC;AACA,iCAAiC,cAAc;;AAE/C;AACA,mCAAmC,SAAS;AAC5C,WAAW;AACX;AACA;AACA;;AAEA;AACA,OAAO;AACP,cAAc,KAAK;AACnB;AACA,OAAO;AACP,qCAAqC,MAAM;AAC3C;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA,MAAM,sBAAsB;AAC5B;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA,MAAM;AACN,MAAM;AACN;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA,MAAM,sBAAsB;AAC5B;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA,MAAM,sBAAsB;AAC5B;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,sBAAsB;AAC5B,MAAM,sBAAsB;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,GAAG;AACH;AACA;;AAEA;AACA,GAAG;AACH;AACA;;AAEA;AACA,GAAG;AACH;AACA;;AAEA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB,iBAAiB;AACjB,iBAAiB;AACjB,iBAAiB;AACjB,iBAAiB;AACjB,iBAAiB;AACjB,iBAAiB;AACjB,iBAAiB;AACjB;AACA,wBAAwB,6BAA6B;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,aAAa,eAAe;AAC5B;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,OAAO;AACP;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA;AACA,MAAM,sBAAsB;AAC5B;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA,MAAM,sBAAsB;AAC5B;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,QAAQ,sBAAsB;AAC9B;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,OAAO;AACP;AACA;;AAEA;AACA;AACA,0BAA0B,SAAS;AACnC;AACA;AACA;;AAEA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,wBAAwB;AACxB;AACA;AACA,wBAAwB;AACxB;AACA,wBAAwB;AACxB;AACA,sBAAsB;AACtB;AACA;AACA,sBAAsB;AACtB;AACA;AACA;AACA,wBAAwB;AACxB;AACA;AACA,wBAAwB;AACxB,sBAAsB;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB;AACtB;AACA,sBAAsB;AACtB;AACA;AACA;AACA,sBAAsB;AACtB,wBAAwB;;AAExB;AACA;AACA;AACA,eAAe,eAAe;AAC9B;;AAEA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA;AACA,MAAM;AACN,MAAM;AACN;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA,MAAM,sBAAsB;AAC5B;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,aAAa,sBAAsB;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,sBAAsB;AAC5B,MAAM,sBAAsB;AAC5B;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA,MAAM;AACN,MAAM;AACN;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA,MAAM;AACN,MAAM;AACN;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA,MAAM,sBAAsB;AAC5B,MAAM,sBAAsB;AAC5B;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA,SAAS,OAAO;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA,UAAU,OAAO;;AAEjB;AACA,GAAG;AACH;;AAEA,UAAU,OAAO;AACjB;;AAEA;AACA;AACA;AACA;AACA,OAAO;;AAEP;AACA;AACA;AACA;AACA;;AAEA;AACA,GAAG;;AAEH;AACA;;AAEA,UAAU,OAAO;;AAEjB;AACA;;AAEA;AACA;AACA;AACA,OAAO;;AAEP;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,GAAG;AACH;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,QAAQ,aAAa;;AAErB;AACA;AACA;AACA;AACA,GAAG;AACH;;AAEA;AACA,UAAU,aAAa;;AAEvB;AACA,0BAA0B,SAAS;;AAEnC;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA,MAAM,sBAAsB;AAC5B;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA,MAAM,sBAAsB;AAC5B;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA,MAAM;AACN,MAAM;AACN;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA,MAAM,sBAAsB;AAC5B;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA,MAAM,sBAAsB;AAC5B;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;AACA;;AAEA;;;;;;;;;;;;;;;;;;;;;;AC7qJe;AACA;AACS;AACI;;AAE5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA,8BAA8B,gDAAgD;AAC9E;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,gCAAgC;AAChC;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0EAA0E;AAC1E;AACA;AACA;AACA,uCAAuC;AACvC,gCAAgC,MAAM,mBAAmB;AACzD,2BAA2B;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;;AAEA;AACA;AACA,sFAAsF;AACtF;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,0BAA0B,2CAA2C;AACrE;AACA,wCAAwC;AACxC;;AAGA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACvpBA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEkB;AACH;AAC2B;AAEI;AACvB;AACI;AAEN;AACN;AAC+B;AAC7B;AACM;AACN;;AAEG;AACI;AAEC;AACY;AAEP;;AAE9B;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,uBAAuB,kCAAkC;AACzD;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,uBAAuB,uCAAuC;AAC9D;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,4DAA4D,oBAAoB;AAChF;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT,KAAK;;AAEL;AACA;AACA;AACA;AACA,sCAAsC,mBAAmB;AACzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gCAAgC;AAChC;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA,wFAA2C;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sCAAsC,oBAAoB;AAC1D;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,KAAK;AACL;AACA,uBAAuB,sBAAsB;AAC7C;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL,uBAAuB,wBAAwB;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,mBAAmB;AACnB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,2BAA2B,qCAAqC;AAChE;AACA;AACA;AACA;;AAEA;AACA,6BAA6B;AAC7B;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,mCAAmC;;AAEnC;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA,aAAa,gBAAgB,UAAU;;AAEvC;AACA;;AAEA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,sFAA6B,oCAAoC;;AAEjE;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB;AACpB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,aAAa;AACb;AACA;;AAEA,yBAAyB,eAAe;AACxC;AACA;AACA;;AAEA;AACA;AACA;;AAEA,2BAA2B,4BAA4B;AACvD;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,kCAAkC,SAAS;AAC3C,SAAS;AACT;AACA,KAAK;;AAEL,YAAY;AACZ;;AAEA;AACA;AACA;AACA;AACA;AACA,oBAAoB,QAAQ;AAC5B;AACA,KAAK;AACL,oCAAoC;AACpC;;AAEA;AACA;AACA,EAAE;AACF;AACA;;AAEA;;AAEA;AACA,4FAAmC,oBAAoB;AACvD,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B,gBAAgB;AAC/C;AACA;AACA;AACA;AACA;AACA,+BAA+B,qBAAqB;AACpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,sCAAsC,mBAAmB;AACzD,4CAA4C;AAC5C;AACA,KAAK,OAAO;AACZ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB;AACzB;AACA;AACA;;AAEA;AACA;;AAEA;AACA,2BAA2B,2BAA2B;AACtD;AACA;;AAEA;AACA;AACA;AACA,aAAa;AACb,+BAA+B,kCAAkC;AACjE;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,mDAAmD;AACnD;;AAEA;AACA;AACA;AACA;AACA,uBAAuB;;AAEvB;;AAEA;AACA;AACA;AACA,kGAAkG;AAClG;AACA,+BAA+B;AAC/B;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,kGAAkG;AAClG;AACA,+BAA+B;AAC/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0CAA0C;AAC1C,6CAA6C;AAC7C;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,kGAAkG;AAClG;AACA,+BAA+B;AAC/B;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,kGAAkG;AAClG;AACA,+BAA+B;AAC/B;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,mBAAmB,kCAAkC;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,gDAAgD;AAChD;AACA;AACA;AACA,oCAAoC;;AAEpC,yBAAyB;AACzB;;AAEA;AACA,kCAAkC;AAClC;AACA;AACA,iCAAiC;AACjC;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,mBAAmB,sBAAsB;AACzC;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;AACA;;AAEA;;AAGA;;;;;;;;;;;;;;;;;;;;;;;;;;;ACv8BkB;AACH;AAE4B;AACzB;AACH;AACS;AACZ;;AAEY;AAKM;AAEL;AACzB;AACqB;;;AAGrB;;AAEA,oCAAoC;;AAEpC;AACA,wCAAwC;AACxC,wCAAwC;;AAExC,qCAAqC;;AAErC;AACA;AACA;AACA;;AAEA,sCAAsC;;AAEtC,sCAAsC;AACtC,qCAAqC;;AAErC,oCAAoC;AACpC,wCAAwC;;AAExC,sCAAsC;;AAEtC,oCAAoC;AACpC;;AAEA,oCAAoC;AACpC,sCAAsC;;AAEtC,oCAAoC;;AAEpC,uCAAuC;;AAEvC;AACA;;AAEA;AACA,wBAAwB;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,sGAA2D;;AAE3D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,gDAAgD;AAChD;AACA;;AAEA,4BAA4B;AAC5B;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,kCAAkC,kFAAkF,EAAE;AACtH;;AAEA;AACA,gDAAgD;AAChD;AACA;;AAEA,2BAA2B;AAC3B;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED,uBAAuB;AACvB;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,4BAA4B;AAC5B;AACA;;AAEA;AACA,mBAAmB;AACnB;AACA;AACA,qCAAqC;AACrC,KAAK;AACL;AACA,qCAAqC;AACrC;AACA;;AAEA;AACA;AACA;AACA,mBAAmB;AACnB;AACA,sBAAsB;AACtB;AACA,qCAAqC;AACrC,KAAK;AACL;AACA,qCAAqC;AACrC;AACA;;AAEA;AACA,mBAAmB;AACnB;AACA;AACA,yCAAyC;AACzC,KAAK;AACL;AACA,yCAAyC;AACzC;AACA;;AAEA;AACA;AACA;AACA,8DAA8D;AAC9D,mBAAmB;AACnB;AACA,uDAAuD;AACvD;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,mEAAmE;AACnE,mBAAmB;AACnB,kBAAkB;AAClB;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,8BAA8B;AAC9B;AACA;AACA;;AAEA;AACA,mBAAmB;AACnB,kBAAkB;AAClB;AACA,yBAAyB;AACzB;;AAEA;AACA;AACA,mBAAmB;AACnB,kBAAkB;AAClB;AACA;AACA,yBAAyB;AACzB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,uBAAuB,uBAAuB;AAC9C;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,oEAAoE;AACpE,oEAAoE;;AAEpE,wBAAwB;;AAExB;AACA;AACA,6CAA6C;AAC7C,6CAA6C;AAC7C,6CAA6C;AAC7C,6CAA6C;AAC7C,6CAA6C;;AAE7C;AACA;AACA,6CAA6C;;AAE7C,6CAA6C;AAC7C,6CAA6C;AAC7C,6CAA6C;AAC7C,6CAA6C;AAC7C,6CAA6C;AAC7C,6CAA6C;AAC7C,6CAA6C;;AAE7C,6CAA6C;;AAE7C;AACA,qCAAqC;AACrC,qCAAqC;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,yBAAyB;AACzB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,0BAA0B;AAC1B;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,0BAA0B;AAC1B;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,yBAAyB;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,4BAA4B;AAC5B;AACA;;AAEA;AACA;AACA;AACA,4DAA4D;AAC5D,uBAAuB;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,kCAAkC;AAClC;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,4BAA4B;AAC5B;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,oDAAoD;;AAEpD;AACA;AACA,oFAAoF;;AAEpF;;AAEA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB;;AAExB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,mCAAmC;AACnC,sBAAsB;AACtB,sBAAsB;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,2BAA2B;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,4BAA4B;AAC5B;AACA;AACA,+DAA+D;AAC/D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,iCAAiC;AACjC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,8BAA8B;AAC9B,4BAA4B;AAC5B,4BAA4B;AAC5B;AACA,4BAA4B;;AAE5B;AACA;;AAEA,4BAA4B;AAC5B,4BAA4B;;AAE5B;;AAEA,uHAAqD;;AAErD;AACA,oCAAoC;AACpC;;AAEA;AACA;AACA,wCAAwC,oBAAoB;;AAE5D;AACA,mBAAmB,sBAAsB;AACzC,+CAA+C,kBAAkB;AACjE;AACA;;AAEA;AACA;AACA;AACA,kCAAkC;;AAElC;AACA,4BAA4B;AAC5B;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,gCAAgC;AAChC;AACA,+BAA+B;;AAE/B;AACA;AACA;AACA,qBAAqB;AACrB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,6DAA6D;AAC9E,gBAAgB,0DAA0D;AAC1E;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,4DAA4D;AAC7E,gBAAgB,4DAA4D;AAC5E;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,wDAAwD;AACzE,gBAAgB,4DAA4D;AAC5E;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,8DAA8D;AAC/E,gBAAgB,2DAA2D;AAC3E;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,4DAA4D;AAC7E,gBAAgB,0DAA0D;AAC1E;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,8DAA8D;AAC/E,gBAAgB,8DAA8D;AAC9E;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,wDAAwD;AACzE,gBAAgB,wDAAwD;AACxE;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,wDAAwD;AACzE,gBAAgB,wDAAwD;AACxE;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,wDAAwD;AACzE,gBAAgB,wDAAwD;AACxE;AACA,KAAK;AACL;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,uCAAuC;AACvC;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,uBAAuB,sBAAsB;AAC7C;AACA,0CAA0C;AAC1C;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,4BAA4B;AAC5B;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,wBAAwB;AACxB;AACA,wBAAwB;AACxB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8CAA8C,UAAU;;AAExD;AACA,2BAA2B,4BAA4B;AACvD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,wCAAwC,sBAAsB;AAC9D;;AAEA;AACA,2BAA2B;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uCAAuC;AACvC;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uCAAuC;AACvC;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,mDAAmD;AACnD;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,uCAAuC;;AAEvC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB;AACzB;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qCAAqC;AACrC,qCAAqC;AACrC;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA,uCAAuC,gCAAgC;AACvE,8CAA8C;AAC9C,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,uCAAuC;;AAEvC;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,mCAAmC;;AAEnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0CAA0C;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0CAA0C;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA,0CAA0C;AAC1C;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kDAAkD,aAAa;AAC/D;AACA;AACA;AACA,kDAAkD,aAAa;AAC/D;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA,yDAAyD,oCAAoC;AAC7F;AACA;AACA;AACA;AACA;AACA,uDAAuD,oCAAoC;AAC3F;AACA;AACA,aAAa;AACb;AACA,2DAA2D,aAAa;AACxE;AACA;AACA;AACA;AACA;AACA,yDAAyD,mCAAmC;AAC5F;AACA;AACA;AACA;AACA;AACA,kDAAkD,aAAa;AAC/D;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,qBAAqB;AACrB,iCAAiC;AACjC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,8CAA8C;AAC9C,2GAAyC;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,8BAA8B;AAC9B,8BAA8B;AAC9B,8BAA8B;AAC9B,8BAA8B;AAC9B,8BAA8B;AAC9B;AACA;;AAEA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,KAAK;;AAEL;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL,6HAA2D,kCAAkC;AAC7F,0HAAwD,0EAA0E;AAClI,0HAAwD,uCAAuC;AAC/F,2HAAyD,eAAe;AACxE;AACA;AACA,qBAAqB;AACrB,KAAK;;AAEL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL,yHAAuD,gBAAgB;;AAEvE,4HAA0D,gBAAgB;AAC1E,+HAA6D,gBAAgB;AAC7E,gIAA8D,gBAAgB;AAC9E,6HAA2D,gBAAgB;;;AAG3E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sHAAoD;AACpD;AACA;AACA,iHAA+C;AAC/C;AACA,aAAa;AACb,sHAAoD;AACpD;AACA;AACA;AACA;AACA,aAAa;AACb,2BAA2B,sBAAsB;AACjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB,aAAa;AACb;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA,sCAAsC;;AAEtC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,mBAAmB,oBAAoB;AACvC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb,SAAS;AACT;;AAEA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL,mBAAmB,qBAAqB;AACxC;AACA;AACA,SAAS;AACT;AACA,wDAAwD,OAAO;AAC/D;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,qBAAqB;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,+IAAyD;AACzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,sCAAsC;AACtC;AACA;AACA;AACA,2BAA2B,wBAAwB;AACnD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,0BAA0B;AACrD;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,2BAA2B;AACtD;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,0BAA0B;AACrD;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,uBAAuB;AAClD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,0GAAwC;AACxC;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL,mBAAmB;AACnB;AACA;AACA;AACA,+GAA6C,kBAAkB;AAC/D,SAAS;AACT,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;;AAEA;AACA,2GAAyC;AACzC;AACA,KAAK;;;AAGL;;AAEA;AACA;AACA;AACA,gEAAgE,SAAS;;AAEzE,0GAAwC;AACxC;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL,mBAAmB;AACnB;AACA;AACA;AACA,+GAA6C,kBAAkB;AAC/D,SAAS;AACT,KAAK,OAAO;AACZ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,uFAAuF;AACvF;AACA;AACA;AACA;AACA;AACA,2BAA2B,+BAA+B;AAC1D;AACA;AACA;AACA,KAAK;AACL;AACA,kGAAkG;AAClG;AACA;AACA;AACA;AACA;AACA,2BAA2B,+BAA+B;AAC1D;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,2GAAyC;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,gEAAgE,SAAS;AACzE,0GAAwC;AACxC;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL,mBAAmB;AACnB;AACA;AACA;AACA,+GAA6C,kBAAkB;AAC/D,SAAS;AACT,KAAK,OAAO;AACZ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,iBAAiB;AACjB;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB;AACzB;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA,SAAS;AACT;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,uFAAuF;AACvF;AACA;AACA;AACA;AACA;AACA,2BAA2B,+BAA+B;AAC1D;AACA;AACA;AACA,KAAK;AACL;AACA,kGAAkG;AAClG;AACA;AACA;AACA;AACA;AACA,2BAA2B,+BAA+B;AAC1D;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;AACA,gEAAgE,SAAS;AACzE;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA,0GAAwC;AACxC;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL,mBAAmB;AACnB;AACA;AACA;AACA,+GAA6C,kBAAkB;AAC/D,SAAS;AACT,KAAK;AACL,6GAA2C;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,6GAA2C;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,iBAAiB;AACjB;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB;AACzB;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA,SAAS;AACT;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,0GAAwC;AACxC;AACA,KAAK;;AAEL;AACA;AACA,yGAAuC;AACvC;AACA;AACA;AACA;AACA,+CAA+C;AAC/C;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;AACL;AACA;AACA;AACA,SAAS;AACT;AACA,yGAAuC;AACvC;AACA,KAAK;AACL;;AAEA;AACA;AACA,uDAAuD;AACvD,4HAA4H,sBAAsB;AAClJ;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,gDAAgD,OAAO,OAAO;AAC9D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,+CAA+C;AAC/C,uBAAuB,4BAA4B;AACnD;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA,6CAA6C;;AAE7C;AACA,2BAA2B,QAAQ;;AAEnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB,2CAA2C;AAC3C;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,sBAAsB;AACtB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,4BAA4B;AAC5B,mDAAmD;;AAEnD;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL,uBAAuB,iBAAiB;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,8CAA8C,cAAc;;AAE5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8BAA8B,uBAAuB;AACrD;AACA;AACA,0DAA0D;AAC1D;AACA;AACA;AACA;AACA;AACA,+BAA+B,qBAAqB;AACpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;;AAEA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,qCAAqC;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,mCAAmC;AACnC;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,wCAAwC;AACxC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,wDAAwD;AACzE,gBAAgB,yDAAyD;AACzE;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,0DAA0D;AAC3E,gBAAgB,yDAAyD;AACzE;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,wDAAwD;AACzE,gBAAgB,yDAAyD;AACzE;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,wDAAwD;AACzE,gBAAgB,yDAAyD;AACzE;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,wDAAwD;AACzE,gBAAgB,uDAAuD;AACvE;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,oDAAoD;AACrE,gBAAgB,uDAAuD;AACvE;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,wDAAwD;AACzE,gBAAgB,uDAAuD;AACvE;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,4DAA4D;AAC7E,gBAAgB,yDAAyD;AACzE;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,4DAA4D;AAC7E,gBAAgB,yDAAyD;AACzE;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,2DAA2D;AAC5E,gBAAgB,uDAAuD;AACvE;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB,wDAAwD;AAC1E,iBAAiB,yDAAyD;AAC1E;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB,2DAA2D;AAC7E,iBAAiB,yDAAyD;AAC1E;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,wDAAwD;AACzE,gBAAgB,yDAAyD;AACzE;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,wDAAwD;AACzE,gBAAgB,yDAAyD;AACzE;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,4DAA4D;AAC7E,gBAAgB,yDAAyD;AACzE;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,2DAA2D;AAC5E,gBAAgB,yDAAyD;AACzE;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,2DAA2D;AAC5E,gBAAgB,yDAAyD;AACzE;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,wDAAwD;AACzE,gBAAgB,yDAAyD;AACzE;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,wDAAwD;AACzE,gBAAgB,yDAAyD;AACzE,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,wDAAwD;AACzE,gBAAgB,yDAAyD;AACzE,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,wDAAwD;AACzE,gBAAgB,yDAAyD;AACzE,KAAK;AACL;;AAEQ;;;;;;;;;;;;;;;;;;;ACp7HU;AACH;AACS;;;AAGxB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,GAAG;;AAEH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,GAAG;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACjRkB;AACT;AACC;AACH;AACK;AACQ;AACX;AACwB;AAEhB;;AAEzB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,4BAA4B;AAC/C;AACA,mBAAmB;AACnB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAGA;;;;;;;;;;;;;;;;;;;;;ACjMa;;AAEb;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,iDAAiD;AACjD;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,uBAAuB,yBAAyB;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACjHA;AAAA;AACA;;AAEiC;AAGP;AACC;AACc;AACrB;AAEoB;AACtB;AACD;AAC2B;AAC7B;AAE6B;AACM;AAChC;AACQ;AACR;AACH;AAEU;AAGG;AACX;AACQ;AAMsB;AAClC;AACiC;;AAGL;AAIkB;AACvC;AACE;;AAEtB;AACwB;AACO;AACR;AACgB;AAGlB;;AAErB;AACA;AACA;AACA;AACA;AACA;AACA,wCAAwC;;AAExC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,mBAAmB,2EAA+B;AAClD,wFAA4C;AAC5C;AACA;AACA;AACA;AACA,wFAA4C;AAC5C,wFAA4C;AAC5C,wFAA4C;AAC5C;AACA;AACA;AACA;AACA,yFAA6C;AAC7C;AACA;;AAEA;AACA;AACA,oDAAoD;AACpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,oCAAoC;AAC/D;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gDAAgD;AAChD;AACA;AACA;AACA;AACA;;AAEA;AACA,iIAAiE;;AAEjE;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,gDAAgD;AAChD;AACA;AACA;AACA;AACA,wCAAwC;AACxC;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,8DAA8D;AAC9D;AACA,oDAAoD;;AAEpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb,SAAS;AACT;AACA,2CAA2C;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA,gDAAgD;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,gDAAgD;AAChD,uDAAuD;AACvD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA,gDAAgD;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,gDAAgD;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb,SAAS;AACT;AACA,2CAA2C;AAC3C;AACA;AACA;AACA;AACA,SAAS;AACT;AACA,2CAA2C;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA,2CAA2C;AAC3C;AACA,SAAS;AACT;AACA,2CAA2C;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA,2CAA2C;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,sBAAsB;AACjD;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,sBAAsB;AACjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,sBAAsB;AACjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wDAAwD,QAAQ;AAChE;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,yCAAyC;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,aAAa,mCAAmC;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,+BAA+B,8BAA8B;AAC7D;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,+BAA+B,gCAAgC;AAC/D;AACA;AACA;AACA;AACA,oCAAoC;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,+BAA+B,+BAA+B;AAC9D;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,+BAA+B,iCAAiC;AAChE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,2BAA2B,6BAA6B;AACxD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,2BAA2B,+BAA+B;AAC1D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,2BAA2B,4BAA4B;AACvD;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA,2BAA2B,2BAA2B;AACtD;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;;AAEA;AACA,2BAA2B,4BAA4B;AACvD;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA,iBAAiB;AACjB;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;;AAEA,2BAA2B,6BAA6B;AACxD;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;;AAEA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uCAAuC;AACvC;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,2BAA2B;AACtD;AACA;AACA;AACA;AACA,2BAA2B,4BAA4B;AACvD;AACA;AACA;AACA;AACA,2BAA2B,4BAA4B;AACvD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,sBAAsB;AACjD;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B;;AAE/B;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8CAA8C;AAC9C,+BAA+B;AAC/B;AACA;;AAEA;AACA;AACA,mCAAmC;AACnC;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA,aAAa;AACb;AACA,aAAa;AACb;AACA,aAAa;AACb;AACA;;AAEA;AACA;AACA;AACA,aAAa;AACb;AACA,aAAa;AACb;AACA;;AAEA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA,aAAa;AACb;AACA,aAAa;AACb;AACA,aAAa;AACb;AACA;;AAEA;AACA;AACA;AACA,aAAa;AACb;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,2BAA2B,gFAAoC;AAC/D;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,2BAA2B,0CAA0C;AACrE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA,aAAa;AACb;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,+BAA+B;AAC/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,oGAA2B;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,+BAA+B;AAC/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,oGAA2B;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA,aAAa;AACb;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,+BAA+B;AAC/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,oGAA2B;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,+BAA+B,uBAAuB;AACtD;AACA;AACA;AACA;AACA;AACA,aAAa;AACb,+BAA+B,sBAAsB;AACrD;AACA;AACA,uCAAuC,6BAA6B;AACpE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb,+BAA+B,uBAAuB;AACtD;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb,+BAA+B,wBAAwB;AACvD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,kCAAkC;AAC7D;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,kCAAkC;AAC7D;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA,2CAA2C;AAC3C;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,2BAA2B;AACtD;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sHAAsD;AACtD,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0HAA0D;AAC1D,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4HAA4D;AAC5D,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B,sBAAsB;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B,+EAA0B;AACzD;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B,sBAAsB;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA,2CAA2C;AAC3C;AACA;AACA;AACA;AACA,0GAAiC;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA,iBAAiB;AACjB;AACA,aAAa;AACb,SAAS;;AAET;AACA;AACA;AACA,oFAAwC;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA,oFAAwC;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA,oFAAwC;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA,oFAAwC;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,aAAa;AACb;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,oFAAwC;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,oFAAwC;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,oFAAwC;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,oFAAwC;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,oFAAwC;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,oFAAwC;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,oFAAwC;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,SAAS;AACT;AACA;AACA,oFAAwC;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,oFAAwC;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,oFAAwC;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,oFAAwC;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,oFAAwC;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,oFAAwC;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,oFAAwC;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,oFAAwC;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,SAAS;AACT;AACA;AACA,oFAAwC;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,SAAS;AACT;AACA;AACA,oFAAwC;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,oFAAwC;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,+BAA+B;AAC/B;AACA;AACA;AACA;AACA;AACA,6GAA+D,2BAA2B;AAC1F,SAAS;AACT;AACA;AACA,oFAAwC;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,SAAS;AACT;AACA;AACA,oFAAwC;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,6EAAiC;AAC5D;AACA;AACA;AACA,+BAA+B,mFAAuC;AACtE;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,oFAAwC;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,2BAA2B,8BAA8B;AACzD;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,oFAAwC;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,SAAS;AACT;AACA;AACA,oFAAwC;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,+BAA+B,mFAAuC;AACtE;AACA;AACA;AACA;AACA;AACA,+BAA+B,6EAAiC;AAChE;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,SAAS;AACT;AACA;AACA,oFAAwC;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL,CAAC;;AAGD;;;;;;;;;;;AC/8GA;;AAEA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,YAAY,iBAAiB;AAC7B;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;AACA,WAAW,mBAAmB;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,YAAY,KAAK;AACjB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA,WAAW,OAAO;AAClB,YAAY,OAAO;AACnB;AACA;AACA;AACA;;AAEA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,oCAAoC;AAC/C,YAAY,oCAAoC;AAChD;AACA;AACA,mBAAmB,gBAAgB;AACnC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,oCAAoC;AACnD,eAAe,OAAO;AACtB,eAAe,QAAQ;AACvB,gBAAgB,OAAO;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,eAAe,oCAAoC;AACnD,gBAAgB,OAAO;AACvB;AACA;AACA;AACA,sBAAsB,kBAAkB;AACxC;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;AACA,WAAW,oCAAoC;AAC/C,YAAY,OAAO;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+CAA+C;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;;AAGA;AACA;AACA,WAAW,oCAAoC;AAC/C,WAAW,oCAAoC;AAC/C,YAAY,oCAAoC;AAChD;AACA;AACA,mBAAmB,sBAAsB;AACzC;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,2CAA2C;AACtD,YAAY,MAAM;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB,YAAY,OAAO;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,WAAW,OAAO;AAClB,YAAY,MAAM;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,8BAA8B;;AAE9B;AACA;AACA,WAAW,OAAO;AAClB,YAAY,OAAO;AACnB;AACA;AACA;AACA;AACA,eAAe,wBAAwB;AACvC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,WAAW,SAAS;AACpB,WAAW,MAAM;AACjB;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA,WAAW,SAAS;AACpB,WAAW,SAAS;AACpB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,UAAU;AACrB,YAAY,OAAO;AACnB;AACA;AACA,mBAAmB;AACnB,eAAe,sBAAsB,OAAO;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,YAAY,QAAQ;AACpB;AACA;;AAEA;AACA;;;AAGA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb,SAAS;AACT;AACA;AACA,KAAK;;AAEL;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;;;;;;;;;;;;;;;;;AC3doB;;AAEpB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,qFAA6B,oBAAoB;AACjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B,qBAAqB;AACpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kCAAkC;AAClC;AACA,2BAA2B,oBAAoB;AAC/C;AACA;;AAEA;AACA;AACA;AACA,aAAa;AACb;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEQ;;;;;;;;;;;;;;;;;;;;;;;;;AC9HU;AACH;AACe;AACf;AACS;AAGI;AACG;AAC/B;;AAEA,sBAAsB;AACtB;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB;AACtB,mBAAmB;AACnB;AACA,2BAA2B;;AAE3B;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,wBAAwB;AACxB;;AAEA;AACA,mBAAmB,0BAA0B;AAC7C;AACA;AACA;;AAEA;AACA;AACA;AACA,2BAA2B,0BAA0B;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,mBAAmB,0BAA0B;AAC7C;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,uBAAuB;;AAEvB;AACA,0BAA0B;AAC1B;AACA;;AAEA;AACA;AACA,yBAAyB;AACzB;AACA;;AAEA;;AAEA,2BAA2B;;AAE3B,4BAA4B;;AAE5B;AACA,mBAAmB,OAAO;AAC1B,uBAAuB,OAAO;AAC9B;AACA;AACA;;AAEA;AACA,mBAAmB,OAAO;AAC1B;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,mBAAmB,mBAAmB;AACtC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,cAAc;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,kBAAkB;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,kBAAkB;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,mBAAmB,OAAO;AAC1B;AACA;AACA,sEAAsE;AACtE,uDAAuD;AACvD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,2DAA2D;AAC3D;AACA,wDAAwD;AACxD;AACA;AACA,SAAS;AACT,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA,iDAAiD;AACjD,6EAA6E;AAC7E;AACA,sDAAsD;AACtD;AACA;AACA,SAAS;AACT,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA,iDAAiD;AACjD,6EAA6E;AAC7E;AACA,wDAAwD;AACxD;AACA;AACA,SAAS;AACT,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA,yDAAyD;AACzD;AACA;AACA,SAAS;AACT,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA,6EAA6E;AAC7E;AACA,0DAA0D;AAC1D;AACA;AACA,SAAS;AACT,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,KAAK;;AAEL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,mBAAmB,+BAA+B;AAClD;AACA;AACA;AACA;;AAEA;AACA,mBAAmB,+BAA+B;AAClD;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;;AAEA;AACA;AACA,mBAAmB,6BAA6B;AAChD;AACA;AACA,mBAAmB,6BAA6B;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,4BAA4B;AAC/C;AACA;AACA,mBAAmB,gCAAgC;AACnD;AACA;AACA,mBAAmB,4BAA4B;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,mBAAmB,6BAA6B;AAChD;AACA;AACA,mBAAmB,6BAA6B;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,4BAA4B;AAC/C;AACA;AACA,mBAAmB,gCAAgC;AACnD;AACA;AACA,mBAAmB,4BAA4B;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,mBAAmB,oCAAoC;AACvD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,mBAAmB,OAAO;AAC1B,uBAAuB,OAAO;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,mBAAmB,OAAO;AAC1B,uBAAuB,OAAO;AAC9B;AACA;AACA;;AAEA;AACA,mBAAmB,6BAA6B;AAChD;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,0BAA0B;AAC1B,4BAA4B;;AAE5B;AACA;AACA;AACA;;AAEA;AACA;AACA,0BAA0B;AAC1B,4BAA4B;;AAE5B;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,0BAA0B;;AAE1B;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,mBAAmB,8BAA8B;AACjD;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,6CAA6C;AAC7C,6CAA6C;AAC7C,6CAA6C;AAC7C,6CAA6C;AAC7C;AACA;;AAEA;AACA,uBAAuB;AACvB;AACA,6CAA6C;AAC7C,6CAA6C;AAC7C,6CAA6C;AAC7C,6CAA6C;AAC7C;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,qBAAqB,8BAA8B;AACnD;AACA,uBAAuB;AACvB;AACA;AACA,eAAe;AACf;AACA;AACA,SAAS;AACT,KAAK;;AAEL;;AAEA;AACA,mBAAmB,6BAA6B;AAChD;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;;AAEA;AACA,mBAAmB,4BAA4B;AAC/C;AACA;AACA;AACA;AACA,SAAS;AACT;AACA,mBAAmB,gCAAgC;AACnD;AACA;AACA;AACA;AACA,SAAS;AACT;AACA,mBAAmB,4BAA4B;AAC/C;AACA;AACA;AACA;AACA,SAAS;AACT;AACA,mBAAmB,2BAA2B;AAC9C;AACA;AACA;AACA;AACA,SAAS;AACT;;AAEA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;;AAEA;AACA;AACA,gCAAgC;;AAEhC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;;AAEA;AACA;AACA;AACA,mCAAmC,QAAQ;AAC3C;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,mCAAmC,QAAQ;AAC3C;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,wBAAwB;AACxB;AACA,2BAA2B,QAAQ;;AAEnC;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,mCAAmC;AACnC;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS,OAAO;AAChB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,qCAAqC;AACrC,uCAAuC;AACvC;AACA;AACA;AACA;AACA,qCAAqC;AACrC,uCAAuC;AACvC;AACA;AACA;AACA;AACA;AACA,qCAAqC;AACrC,uCAAuC;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oCAAoC;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,0BAA0B;AAC1B,0BAA0B;AAC1B,2CAA2C;AAC3C,2CAA2C;;AAE3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb,SAAS;AACT;AACA,gCAAgC;AAChC;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;;AAEA;;AAEA;AACA;AACA,2BAA2B,iBAAiB;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA,iBAAiB;AACjB;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;;AAEA;AACA,yBAAyB;AACzB;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;;AAEA;AACA;AACA,qBAAqB;AACrB;AACA;;AAEA;AACA;AACA,0BAA0B;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB;AACzB;AACA,qBAAqB;AACrB;AACA;AACA;AACA,mCAAmC;AACnC,yBAAyB;AACzB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,6BAA6B;AAC7B;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB;AACzB;AACA;AACA;;AAEA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA,iBAAiB;AACjB;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,4BAA4B;AAC5B,6BAA6B;AAC7B,6BAA6B;;AAE7B;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEQ;;;;;;;;;;;;;;;;;;;;;;;;;AC//CS;AACF;AACU;AACZ;;AAEY;AACJ;;;AAGrB;AACA;AACA;AACA;AACA;AACA,uGAA2C;AAC3C;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,mCAAmC;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,uBAAuB;AACvB,UAAU;AACV;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,2BAA2B;AAC3B,cAAc;AACd,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA;;;;;;;;;;ACrMA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,WAC6C;AAC7C,CAAC,4BAA4B;;AAE7B;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,iBAAiB,gBAAgB;AACjC;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,8BAA8B,8BAA8B;AAC5D;AACA,kBAAkB;AAClB,kBAAkB;AAClB;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,gCAAgC,mCAAmC;AACnE;AACA,0BAA0B,IAAI,mCAAmC;AACjE,0BAA0B;AAC1B,8BAA8B,mCAAmC;AACjE;AACA;AACA,wBAAwB;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iCAAiC,IAAI,mCAAmC;;AAExE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,0BAA0B,iCAAiC;AAC3D,+BAA+B,iCAAiC;AAChE,kCAAkC,8CAA8C;AAChF,mCAAmC,iDAAiD;AACpF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iCAAiC,2DAA2D;AAC5F;AACA;AACA;AACA,iCAAiC,iBAAiB;;AAElD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,+BAA+B;AAChD;AACA;AACA,mBAAmB,aAAa;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,aAAa;AACpC;AACA,mBAAmB,mCAAmC;AACtD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,2BAA2B;AAC5C,iCAAiC,2BAA2B;AAC5D,yBAAyB,iDAAiD;AAC1E,qBAAqB,iDAAiD;AACtE,yBAAyB,iDAAiD;AAC1E;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA,gDAAgD;AAChD;AACA,EAAE,EAAE;;AAEJ;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,8BAA8B;AAC9B;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8CAA8C,aAAa;AAC3D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uCAAuC,aAAa;AACpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB,aAAa;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,wCAAwC,2BAA2B;AACnE;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,sCAAsC;AACtC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sCAAsC,aAAa;AACnD;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,wDAAwD;AACxD,kEAAkE;;AAElE;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA,sDAAsD;AACtD;AACA;;AAEA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,iBAAiB;AACjB,mBAAmB;AACnB;AACA;AACA;AACA;AACA;AACA,uDAAuD;AACvD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,QAAQ,wBAAwB;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,QAAQ,wCAAwC;AAChD;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,8BAA8B,wBAAwB;AACtD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,iBAAiB,wBAAwB;AACzC;AACA;AACA,wCAAwC,UAAU;AAClD;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,oBAAoB,wDAAwD;AAC5E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8BAA8B;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG,OAAO,YAAY,YAAY;AAClC;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,qBAAqB,4BAA4B;AACjD;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,mBAAmB,2BAA2B;AAC9C;AACA;AACA,qBAAqB,2BAA2B;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,iBAAiB,kBAAkB;AACnC;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA,aAAa,YAAY;AACzB;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA,2BAA2B,YAAY;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,qBAAqB,4BAA4B;AACjD;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,iBAAiB,SAAS;AAC1B;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,mBAAmB,4BAA4B;AAC/C;AACA;;AAEA;AACA,qBAAqB,4BAA4B;AACjD;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,qCAAqC;AACrC,2CAA2C;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,kBAAkB;AAClB;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,GAAG;AACH;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,iBAAiB,mBAAmB;AACpC;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA,iBAAiB,wBAAwB;AACzC;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,gBAAgB,eAAe;AAC/B;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA,iBAAiB,oBAAoB;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA,wBAAwB,OAAO,aAAa,cAAc,oBAAoB;AAC9E;;AAEA;AACA;AACA;;AAEA;AACA;AACA,oBAAoB,OAAO,aAAa,cAAc;;AAEtD;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,2BAA2B;AAC3B,2BAA2B;AAC3B,4BAA4B;AAC5B;AACA;AACA,wDAAwD,0BAA0B,EAAE;AACpF;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,uCAAuC,QAAQ;AAC/C;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,iCAAiC,KAAK;;AAEtC;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qEAAqE;AACrE;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA,mCAAmC;AACnC;AACA,yBAAyB,YAAY;AACrC;AACA;AACA;;AAEA,iDAAiD;AACjD;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,0CAA0C;AAC1C;AACA;AACA;AACA;AACA;;AAEA,mCAAmC;AACnC;AACA;AACA;AACA;;AAEA,0CAA0C;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,uCAAuC;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,yCAAyC;AACzC;AACA;AACA,oEAAoE;AACpE;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,sBAAsB;AACtB,sBAAsB;AACtB,sBAAsB;AACtB,sBAAsB;AACtB,sBAAsB;AACtB,sBAAsB;AACtB,uBAAuB;AACvB,uBAAuB;AACvB,sBAAsB;AACtB,sBAAsB;;AAEtB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA,8DAA8D,GAAG;AACjE;AACA;AACA,gCAAgC,gBAAgB;AAChD;AACA;AACA;AACA,SAAS;AACT,2CAA2C,EAAE;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sCAAsC,4CAA4C;AAClF;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,mDAAmD,OAAO;AAC1D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA,8BAA8B;AAC9B;AACA;AACA;AACA;AACA;AACA,gDAAgD;AAChD;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,iDAAiD;AACjD;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,SAAS;AACT;AACA;AACA;AACA,oBAAoB;AACpB;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA,SAAS;AACT;AACA;AACA,oFAAoF,YAAY;AAChG;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB;AACpB;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iCAAiC,2BAA2B;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK,sBAAsB;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,8CAA8C,cAAc;;AAE5D,CAAC,I;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AC9iHiB;AACH;AAEe;AACf;AACS;AAEC;AAIgB;AACzC;AACqB;AAKqB;;AAE1C;AACA;AACA;AACA;AACA,sFAAsF;AACtF;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,sEAA2B;AAC3B;AACA,sCAAsC;AACtC;AACA;AACA;AACA;AACA;AACA,aAAa;AACb,gDAAgD;AAChD;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,sEAA2B;AAC3B;AACA,uHAAyE;;AAEzE,mBAAmB,sBAAsB;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,yBAAyB;AACzB;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,iCAAiC,QAAQ;;AAEzC;AACA;AACA,mBAAmB,yBAAyB;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA,kCAAkC;AAClC;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;;AAEA;AACA,mBAAmB,yBAAyB;AAC5C;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,mBAAmB,yBAAyB;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,mBAAmB,yBAAyB;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,mBAAmB,yBAAyB;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,gDAAgD;AAChD;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,uBAAuB;AACvB;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,sFAAsF;AACtF;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B;AAC1B;AACA,6BAA6B;AAC7B;AACA;AACA;;AAEA;AACA;AACA,qFAAqF;AACrF;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B;AAC1B;AACA,6BAA6B;AAC7B;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA,oFAAoF;AACpF;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B;AAC1B;AACA,6BAA6B;AAC7B;AACA;AACA;;AAEA;AACA;AACA,4DAA4D;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,gCAAgC;AAChC;AACA;AACA,8CAA8C;AAC9C;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yCAAyC;AACzC,wEAAwE;AACxE;AACA;AACA;AACA;AACA,yCAAyC;AACzC,sFAAsF;AACtF;AACA;AACA;AACA;AACA,yCAAyC;AACzC,sFAAsF;AACtF;AACA;AACA;AACA;AACA,yCAAyC;AACzC,wEAAwE;AACxE;AACA;AACA;AACA;AACA,yCAAyC;AACzC,yEAAyE;AACzE;AACA;AACA;AACA;AACA,yCAAyC;AACzC,uFAAuF;AACvF;AACA;AACA;AACA;AACA,yCAAyC;AACzC,uFAAuF;AACvF;AACA;AACA;AACA;AACA,yCAAyC;AACzC,uFAAuF;AACvF;AACA;AACA;AACA;AACA,yCAAyC;AACzC,sFAAsF;AACtF;AACA;AACA;AACA;AACA,0CAA0C;AAC1C,mIAAmI;AACnI;AACA;AACA;AACA;AACA,yCAAyC;AACzC,oGAAoG;AACpG;AACA;AACA;AACA;AACA,yCAAyC;AACzC,iIAAiI;AACjI;AACA;AACA;AACA;AACA,yCAAyC;AACzC;AACA,wDAAwD;AACxD;AACA;AACA;AACA;AACA,yCAAyC;AACzC;AACA,wDAAwD;AACxD;AACA;AACA;AACA;AACA,yCAAyC;AACzC,qHAAqH;AACrH;AACA;AACA;AACA;AACA,yCAAyC;AACzC;AACA,wDAAwD;AACxD;AACA;AACA;AACA;AACA,yCAAyC;AACzC;AACA,uDAAuD;AACvD;AACA;AACA;AACA,yCAAyC,0EAA0E;AACnH;AACA;AACA;AACA,yCAAyC,+BAA+B;AACxE;AACA;AACA;AACA;AACA;AACA,yCAAyC;AACzC,qEAAqE;AACrE;;;AAGA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,uBAAuB,yCAAyC;AAChE;AACA;AACA;;AAEA;AACA,uBAAuB,2EAAgC;AACvD;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;;AAEA;AACA,uBAAuB,2EAAgC;AACvD;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,mBAAmB,+BAA+B;AAClD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,KAAK;AACL,mBAAmB,kCAAkC;AACrD;AACA;AACA;AACA;AACA,kHAAgD;;AAEhD;AACA;AACA;AACA;AACA;AACA,+HAAoF;AACpF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,8GAA4C,qCAAqC;AACjF,8GAA4C,qCAAqC;AACjF,8GAA4C,qCAAqC;AACjF,8GAA4C,qCAAqC;AACjF;AACA;;AAEA,mBAAmB,qBAAqB;AACxC;AACA;AACA,uBAAuB,yBAAyB;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mGAAwD;AACxD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB,aAAa;AACb;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,yGAAuC;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;;AAEA,yGAAuC,4BAA4B;AACnE;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB,uCAAuC,2EAAgC;AACvE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA,SAAS;AACT;;AAEA;AACA,2HAAyD,gDAAgD;AACzG;;AAEA;AACA,kIAAgE;AAChE;AACA;AACA;AACA;AACA;AACA,+BAA+B,uBAAuB;AACtD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,+BAA+B,uBAAuB;AACtD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;;AAEA;AACA,gHAA8C,sBAAsB;AACpE;AACA;;AAEA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;;AAEA,2HAAyD,oCAAoC;;AAE7F,sHAAoD,yBAAyB;;AAE7E;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,mBAAmB,oBAAoB;AACvC;AACA;AACA;AACA;AACA,mCAAmC;AACnC;;AAEA;AACA,6FAAkD;;AAElD;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA,iBAAiB;AACjB;AACA;;AAEA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,uHAAqD;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb,yHAAuD;;AAEvD,uHAAqD;AACrD;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb,yHAAuD;;AAEvD;AACA;AACA,uHAAqD;AACrD;AACA;AACA;AACA,aAAa;AACb,yHAAuD;;AAEvD,uHAAqD;AACrD;AACA;AACA;AACA,aAAa;AACb,yHAAuD;;AAEvD;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA,aAAa;AACb;AACA;AACA,uHAAqD;AACrD;AACA;AACA;AACA,aAAa;AACb,yHAAuD;;AAEvD,uHAAqD;AACrD;AACA;AACA,aAAa;AACb,yHAAuD;AACvD,SAAS;AACT;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;;AAEA;AACA,uBAAuB,2EAAgC;AACvD;AACA;AACA;AACA;;AAEA;AACA;AACA,6FAAkD;AAClD;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;;AAEL;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,mBAAmB,kBAAkB;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,uBAAuB,kBAAkB;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,yGAAuC,kCAAkC;AACzE;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;;AAEL,0GAAwC,4DAA4D;AACpG;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,sDAAsD;AACtD;AACA;;AAEA;AACA,6FAAkD;AAClD;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,2BAA2B;AAC3B;AACA;AACA;AACA;;AAEA;AACA,gCAAgC;;AAEhC;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAGA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AC57C2B;AACT;AACH;AAE+B;AAC/B;AACS;AAED;AAEE;AACJ;;AAErB;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;;AAEA;AACA,SAAS,0BAA0B;AACnC,SAAS,0BAA0B;AACnC,SAAS,4BAA4B;AACrC,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,wBAAwB;AACxB;;AAEA;;AAEA;AACA;;AAEA;AACA;;;AAGA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,4BAA4B;AAC5B;AACA,mBAAmB,YAAY;AAC/B;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,kBAAkB;AAClB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,mBAAmB,2EAAgC;AACnD;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA,SAAS;AACT;AACA,SAAS;AACT;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;;AAEL;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,mBAAmB,2EAAgC;AACnD;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;;AAEA;AACA,mBAAmB,2EAAgC;AACnD;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;;AAEA;AACA;AACA,mBAAmB,2EAAgC;AACnD;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,mBAAmB,kFAAuC;AAC1D;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,mBAAmB,2EAAgC;AACnD;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,mBAAmB,2EAAgC;AACnD;AACA;AACA;AACA;;AAEA;AACA;;AAeA;;;;;;;;;;;ACjoBA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,eAAe,OAAO;AACtB;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,gBAAgB,QAAQ;AACxB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,eAAe,MAAM;AACrB,gBAAgB,QAAQ;AACxB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,SAAS;AACT;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,eAAe,OAAO;AACtB,eAAe,SAAS;AACxB,gBAAgB,cAAc;AAC9B;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB;AACA;AACA;AACA,0BAA0B,kCAAkC;AAC5D;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,eAAe,OAAO;AACtB,gBAAgB,OAAO;AACvB;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,gBAAgB,OAAO;AACvB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA,KAAK;AACL;AACA;AACA,gBAAgB,QAAQ;AACxB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,gBAAgB,QAAQ;AACxB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,KAAK;AACL;AACA;AACA;AACA,0BAA0B;AAC1B;AACA;AACA,eAAe,OAAO;AACtB;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,gBAAgB,OAAO;AACvB;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;;AAEA;;;;;;;;;;ACtQA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE;AACF;AACA;;AAEA;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;;;;;AAKA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;AAIA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,EAAE;;AAEF;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA,EAAE;;AAEF;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,EAAE;;AAEF;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,EAAE;;AAEF;AACA;AACA;AACA,EAAE;;AAEF;AACA;AACA;AACA,GAAG;AACH,EAAE;;AAEF;AACA;AACA,EAAE;;AAEF;AACA;AACA,EAAE;;AAEF;AACA;AACA,EAAE;;AAEF;AACA;AACA;AACA;AACA,EAAE;;AAEF;AACA;AACA,EAAE;;AAEF;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,+BAA+B;AAC/B;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,QAAQ,YAAY;;AAEpB;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,MAAM;AACN;AACA;;AAEA;AACA;;AAEA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,EAAE;;AAEF,oBAAoB;;AAEpB;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,EAAE;;AAEF;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,EAAE;;AAEF;AACA;AACA;AACA,EAAE;;AAEF;AACA;;AAEA;AACA;AACA,UAAU,YAAY;AACtB;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,EAAE;;AAEF;AACA;AACA;AACA;AACA;AACA,EAAE;;AAEF;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;;AAEA;AACA,EAAE;;AAEF;AACA;AACA,EAAE;;AAEF;AACA;AACA;AACA;AACA;AACA;;AAEA,SAAS,SAAS;AAClB;AACA;;AAEA;;AAEA;AACA,EAAE;;AAEF;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,SAAS,YAAY;AACrB;AACA;AACA;AACA;AACA;;AAEA;AACA,EAAE;;AAEF;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,UAAU,YAAY;AACtB;;AAEA;AACA;AACA;AACA;;AAEA;AACA,GAAG;AACH;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,EAAE;;AAEF;AACA;;AAEA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,CAAC;;AAED;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE;;AAEF;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,SAAS;AAClB;AACA;AACA;AACA;AACA;AACA,EAAE;;AAEF;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,0BAA0B;AAC1B;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE;;AAEF;AACA;;AAEA,gBAAgB,IAAI;;AAEpB;AACA;;AAEA;;AAEA;AACA;AACA,wCAAwC,IAAI;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE;;AAEF;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,EAAE;;AAEF;AACA;AACA;AACA;AACA;AACA;AACA,EAAE;;AAEF;AACA;AACA;AACA,GAAG;AACH,GAAG;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,SAAS;;AAET;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;;AAEA;AACA,MAAM;;AAEN;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,KAAK;AACL;AACA;;AAEA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,MAAM;AACN;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,aAAa,yBAAyB;AACtC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,WAAW,SAAS;AACpB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,WAAW,SAAS;AACpB;AACA;AACA;;AAEA;AACA;AACA,EAAE;AACF;AACA,EAAE;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,SAAS;AACpB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,aAAa,OAAO;AACpB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,WAAW,QAAQ,6BAA6B;AAChD;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,WAAW,SAAS;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH,EAAE;AACF;;AAEA;AACA;AACA,WAAW,gBAAgB;AAC3B,aAAa,uBAAuB;AACpC;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,WAAW,eAAe;AAC1B,aAAa,QAAQ;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,WAAW,eAAe;AAC1B,aAAa,OAAO;AACpB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE;;AAEF;AACA;;AAEA;AACA;AACA;AACA;AACA,EAAE;;AAEF;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE;;AAEF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,IAAI;AACJ;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;AACH;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,EAAE;AACF;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,GAAG;AACH;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,WAAW,UAAU;AACrB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,WAAW,cAAc;AACzB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE;AACF;AACA;AACA;AACA;AACA,GAAG;AACH;AACA,gCAAgC,MAAM;AACtC;AACA;AACA;AACA,EAAE;AACF;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;;AAEA,eAAe;;AAEf,SAAS;;AAET;AACA,QAAQ,iCAAiC;AACzC,QAAQ,oBAAoB;AAC5B,QAAQ,sCAAsC;AAC9C,QAAQ;AACR,EAAE;;AAEF;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,IAAI;AACJ;AACA;;AAEA;AACA,GAAG;;AAEH;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,IAAI;AACJ;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,EAAE;;AAEF;;AAEA;AACA;AACA;AACA,gBAAgB,aAAa,EAAE;AAC/B;AACA;AACA;AACA,GAAG;;AAEH;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL,GAAG;;AAEH;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA,4DAA4D;;AAE5D;AACA;AACA;AACA,yCAAyC;;AAEzC;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAO;AACP;AACA;AACA;AACA;AACA,6DAA6D;;AAE7D;AACA;AACA;AACA,0CAA0C;;AAE1C;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,gEAAgE;;AAEhE;AACA;AACA;AACA,6CAA6C;;AAE7C;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;;AAEA;AACA;AACA,EAAE;;AAEF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA,GAAG;;AAEH;AACA;AACA,GAAG;;AAEH;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,GAAG;;AAEH;AACA;AACA;AACA,iEAAiE,UAAU;AAC3E,sCAAsC,2BAA2B;AACjE;AACA,gCAAgC,MAAM;AACtC;AACA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA,GAAG;;AAEH;AACA;AACA,GAAG;;AAEH;AACA;AACA,UAAU,YAAY;AACtB;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA,UAAU,YAAY;AACtB;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA,UAAU,UAAU;AACpB;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA,UAAU,cAAc;AACxB;AACA;AACA;AACA,GAAG;AACH;AACA;;AAEA;;AAEA;AACA,YAAY,uEAAuE;AACnF;AACA;AACA,YAAY,4BAA4B;AACxC;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,QAAQ,SAAS;AACjB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA,2DAA2D;;AAE3D;AACA;AACA,oFAAoF;;AAEpF;AACA;AACA,OAAO;AACP;;AAEA;AACA;AACA,OAAO;AACP;AACA;;AAEA,mCAAmC;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;;AAEA;AACA;AACA;AACA,QAAQ,SAAS;AACjB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,QAAQ,SAAS;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA,EAAE;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;;AAEH,QAAQ,SAAS;AACjB;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA;AACA;AACA,WAAW,SAAS;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uCAAuC,iDAAiD;AACxF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,iDAAiD;AACjD,UAAU,wCAAwC;AAClD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,gBAAgB;AAC3B;AACA,WAAW,QAAQ;AACnB,WAAW,MAAM;AACjB,WAAW,MAAM;AACjB;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,IAAI;AACJ;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;AACA,EAAE;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;AACA,EAAE;AACF;;AAEA;AACA;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE;AACF;;AAEA;;AAEA,CAAC;;;;AAID;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;AAKA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;;AAEA,QAAQ,GAAG;AACX;AACA;AACA;AACA;;AAEA;AACA;;;AAGA;;;;AAIA;;AAEA;;AAEA;AACA;;;;AAIA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,EAAE;AACF;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,gBAAgB,SAAS;AACzB;AACA;AACA;AACA;AACA,IAAI;AACJ;;AAEA;;AAEA,cAAc,SAAS;AACvB;AACA;;AAEA;AACA,EAAE;AACF;AACA;AACA,EAAE;AACF;AACA;AACA,EAAE;AACF;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;;AAGD;;;AAGA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,IAAI;AACJ;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,QAAQ;AACR;AACA;AACA;AACA;;AAEA;;AAEA;AACA,KAAK;AACL;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,IAAI;AACJ;;AAEA;AACA;AACA,IAAI;AACJ;AACA;;AAEA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA,GAAG;AACH;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;;AAGA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,UAAU,OAAO;AACjB;AACA;AACA;AACA;AACA,GAAG;AACH,EAAE;;AAEF;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,UAAU,OAAO;AACjB,0BAA0B,wBAAwB;;AAElD;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,EAAE;;AAEF;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,EAAE;;AAEF;AACA;AACA;AACA;AACA;AACA;AACA,EAAE;;AAEF;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,EAAE;AACF;AACA;AACA,EAAE;AACF;AACA;AACA,EAAE;AACF;AACA;AACA,EAAE;AACF;AACA;AACA,EAAE;AACF;AACA;AACA,EAAE;AACF;AACA;AACA,EAAE;AACF;AACA;AACA,EAAE;AACF;AACA;AACA,EAAE;AACF;AACA,0CAA0C;AAC1C,EAAE;AACF;AACA;AACA,EAAE;AACF;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,CAAC;AACD;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,CAAC;AACD;;;;AAIA;AACA;AACA;AACA;AACA;AACA,EAAE;AACF;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,mBAAmB;;AAEnB;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,UAAU,cAAc;AACxB;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,KAAK;AACL;AACA;AACA;AACA,GAAG;;AAEH;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;;AAER;AACA;AACA;AACA,OAAO;AACP,MAAM;;AAEN;AACA;AACA;AACA;AACA;AACA,IAAI;;AAEJ;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,IAAI;;AAEJ;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;;AAEJ;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;;AAEJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA,IAAI;;AAEJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA,IAAI;;AAEJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;;AAEJ;AACA;AACA;AACA;AACA,IAAI;;AAEJ;AACA;AACA;AACA;AACA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA,GAAG;AACH;;AAEA;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,EAAE;;AAEF;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;;AAEL;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA,wCAAwC,sCAAsC;AAC9E,oCAAoC,uCAAuC;AAC3E,oCAAoC,sCAAsC;AAC1E;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR,OAAO;AACP;AACA,MAAM;AACN,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,WAAW;;AAEX;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,UAAU;;AAEV;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;;AAEX;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;;AAER;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,MAAM;;AAEN;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,oCAAoC;AACpC,qCAAqC;AACrC,oCAAoC;AACpC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,EAAE;;AAEF;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,CAAC;;;AAGD;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;;;;AAKA;AACA;AACA;AACA,EAAE;AACF;;;;;AAKA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,CAAC;;AAED;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,CAAC;;AAED;AACA;;AAEA;AACA;AACA;;;;;AAKA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,EAAE;AACF;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,UAAU,SAAS;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;;AAGA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,+BAA+B;AAC/B;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;AAKA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;;AAEA;AACA,EAAE;AACF;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,uBAAuB,aAAa;AACpC,GAAG;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA,EAAE;AACF;AACA;AACA;;AAEA;AACA;AACA,EAAE;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,EAAE;AACF;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,IAAI;AACJ;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA,EAAE;AACF;AACA;AACA;AACA;AACA;AACA;;AAEA;;;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,oBAAoB,SAAS;AAC7B;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,IAAI;;AAEJ;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,EAAE;;AAEF;AACA;AACA,EAAE;;AAEF;AACA;AACA,EAAE;;AAEF;AACA;AACA;AACA;AACA,EAAE;;AAEF;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,IAAI;AACJ;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,IAAI;AACJ,GAAG;AACH,EAAE;;AAEF;AACA;AACA;AACA,GAAG;AACH;AACA,CAAC;;;AAGD;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,EAAE;;AAEF;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,EAAE;;AAEF;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ,GAAG;AACH;AACA,CAAC;;AAED;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,IAAI;AACJ,EAAE;AACF;AACA;AACA;AACA,GAAG;AACH,EAAE;AACF;AACA;AACA,EAAE;;AAEF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;;AAEA;;;AAGA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;;;;AAKA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA,IAAI;AACJ;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,QAAQ,gBAAgB;AACxB;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,iBAAiB,gBAAgB;AACjC;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,EAAE;AACF;AACA;AACA,EAAE;AACF;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA,GAAG;AACH;AACA,CAAC;AACD;;AAEA;;AAEA;;;;AAIA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;;AAGA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA,EAAE;AACF;;AAEA,EAAE;AACF;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA;;AAEA,QAAQ,OAAO;AACf;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA,sBAAsB;;AAEtB;AACA;AACA;AACA;AACA;AACA;;AAEA,QAAQ,OAAO;AACf;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,IAAI;AACJ;;AAEA;AACA,IAAI;AACJ;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,CAAC;AACD;;;;AAIA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,EAAE,gBAAgB;AAClB;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,EAAE;AACF;;AAEA;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE;AACF;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,EAAE;AACF;;AAEA;AACA;AACA;AACA;AACA;;AAEA,WAAW;;AAEX;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;;AAEJ;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,IAAI;AACJ;AACA;;AAEA;AACA;AACA;;AAEA,EAAE;;AAEF;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,2CAA2C;AAC3C;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,EAAE;;AAEF;;AAEA;AACA;;AAEA;AACA;AACA,oDAAoD;AACpD;;AAEA;AACA;;AAEA,cAAc,sBAAsB;AACpC;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,yBAAyB;AACzB;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA,+DAA+D;AAC/D;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,EAAE;;AAEF;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,UAAU,cAAc;;AAExB;AACA;AACA;AACA;AACA;AACA,iBAAiB,mBAAmB;AACpC;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B,uCAAuC;AACjE;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,uBAAuB,uDAAuD;AAC9E;;AAEA;AACA,EAAE;;AAEF;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,GAAG;AACH,EAAE;;AAEF;AACA;AACA;AACA;AACA,EAAE;;AAEF;AACA;;AAEA;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA,GAAG;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;;AAEJ;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,sCAAsC;AACtC;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,EAAE;AACF;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,EAAE;AACF;AACA;;AAEA;;AAEA;AACA;AACA;AACA,EAAE;AACF;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,qCAAqC,cAAc;AACnD;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA,qCAAqC;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED;;AAEA;AACA;AACA,EAAE;AACF;AACA;AACA,EAAE;AACF;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA,CAAC;;;AAGD;;AAEA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE;AACF;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,2CAA2C,OAAO;AAClD;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,8BAA8B;;AAE9B;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,EAAE;AACF;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,UAAU,OAAO;AACjB;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA,gBAAgB,gBAAgB;AAChC;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,QAAQ,+BAA+B;AACvC;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,EAAE;;AAEF;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,uCAAuC,OAAO;AAC9C;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,wCAAwC,OAAO;AAC/C;AACA;AACA,IAAI;AACJ;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,EAAE;;AAEF;AACA;AACA;AACA;;AAEA,SAAS,qCAAqC;AAC9C;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,QAAQ;AACR;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA,EAAE;;AAEF;AACA;AACA,EAAE;;AAEF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL,GAAG;AACH,EAAE;;AAEF;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH,EAAE;;AAEF;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH,EAAE;;AAEF;AACA;AACA;AACA;AACA;AACA,GAAG;AACH,EAAE;;AAEF;AACA;AACA;AACA;AACA;AACA,GAAG;AACH,EAAE;;AAEF;AACA;AACA;;AAEA,SAAS,8BAA8B;AACvC;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,EAAE;;AAEF;AACA;AACA;;AAEA;AACA;AACA,GAAG;AACH,EAAE;;AAEF;AACA;AACA,6BAA6B;AAC7B;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA,YAAY,OAAO;AACnB;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA,GAAG;AACH,EAAE;;AAEF;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,GAAG;AACH;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;;AAEA,SAAS,WAAW;AACpB;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,CAAC;AACD;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;;;;AAIA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,+CAA+C,cAAc,WAAW;AACxE,mBAAmB,UAAU;AAC7B;AACA,sBAAsB,cAAc,sBAAsB,gBAAgB;AAC1E,gBAAgB,WAAW,YAAY;AACvC,cAAc;AACd;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA,EAAE;AACF,CAAC;;;AAGD;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,kBAAkB;AAClB;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;AACA;AACA;AACA;AACA,YAAY,+DAA+D;AAC3E;AACA;AACA;AACA,EAAE;;AAEF;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,QAAQ,OAAO;;AAEf;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,IAAI;AACJ;AACA;;AAEA;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE;;AAEF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE;;AAEF;AACA;AACA,aAAa;;AAEb;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA,GAAG;;AAEH;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,EAAE;;AAEF;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA,kBAAkB,gBAAgB;AAClC;AACA,MAAM;AACN;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;AACA,iBAAiB;;AAEjB;AACA;;AAEA,UAAU,OAAO;AACjB;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA,YAAY;AACZ;;AAEA;AACA;AACA;;AAEA,WAAW,SAAS;AACpB;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA,CAAC;;;AAGD;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE;AACF;AACA;;AAEA;AACA;AACA;AACA,EAAE;AACF;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,EAAE;AACF;AACA;AACA,EAAE;AACF;AACA;;AAEA;;AAEA;AACA;;;;;AAKA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,EAAE;AACF;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW;;AAEX;AACA;AACA;AACA,QAAQ,OAAO;AACf;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,QAAQ,gBAAgB;AACxB;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ,GAAG;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;;AAEJ;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ,iDAAiD,0BAA0B;AAC3E;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,UAAU,gBAAgB;AAC1B;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA,2BAA2B;AAC3B;AACA,qBAAqB;AACrB;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,gBAAgB;AAC3B;AACA;;AAEA,6CAA6C;AAC7C;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,GAAG;AACH;;AAEA;;AAEA,QAAQ,gBAAgB;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH,EAAE;;AAEF;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;;AAEA;AACA;AACA;;AAEA,SAAS,gBAAgB;AACzB;AACA;AACA;AACA;AACA,EAAE;;AAEF;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA,CAAC;;AAED;AACA,iEAAiE;AACjE;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,EAAE;AACF;AACA;AACA;;AAEA,IAAI;AACJ;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA,oBAAoB,cAAc;AAClC,EAAE;AACF;AACA;AACA;AACA;;AAEA;AACA,iDAAiD;;AAEjD;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,EAAE;AACF;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;;AAEA,+BAA+B,SAAS;AACxC;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH,EAAE;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,+BAA+B,SAAS;AACxC;AACA;AACA;AACA;AACA;;AAEA;AACA,mBAAmB,gBAAgB;AACnC;AACA;AACA;AACA;;AAEA;AACA;AACA,GAAG;AACH;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA,UAAU,kBAAkB;AAC5B,WAAW,kBAAkB;AAC7B,cAAc;AACd,CAAC;AACD;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;;AAEA;;AAEA,QAAQ,mBAAmB;AAC3B;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,EAAE;AACF;;;AAGA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;;AAGD;AACA;;AAEA;AACA;AACA;AACA,EAAE;;AAEF;AACA;AACA;AACA,GAAG;AACH;AACA,CAAC;;AAED;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,EAAE;;AAEF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE;;AAEF;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;;AAEA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;;;;AAKD;AACA;;AAEA;AACA;AACA;AACA,EAAE;;AAEF;AACA;AACA;AACA,GAAG;AACH;AACA,CAAC;;AAED;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,EAAE;;AAEF;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,EAAE;;AAEF;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;;;;AAKD;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,IAAI;AACJ;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,EAAE;;AAEF;AACA;AACA;;AAEA;AACA;AACA;AACA,IAAI;AACJ;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,EAAE;;AAEF;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;;AAEA;AACA,IAAI;AACJ;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH,EAAE;;AAEF;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,CAAC;;;;;AAKD;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,IAAI;AACJ;AACA;;AAEA,iCAAiC;AACjC;AACA;;AAEA,IAAI;AACJ;;AAEA,IAAI;AACJ;AACA;AACA,KAAK;AACL;;AAEA;;AAEA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA,CAAC;;AAED;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,KAAK;AACL;AACA;;AAEA;AACA,WAAW,SAAS;AACpB;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,IAAI;;AAEJ;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;;;;AAKD;;;AAGA;;;AAGA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA,sCAAsC;AACtC;AACA;AACA;;AAEA;;AAEA,yBAAyB;AACzB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,8CAA8C;AAC9C;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,2CAA2C;AAC3C;;AAEA;AACA;AACA;AACA;AACA,UAAU,KAAK;AACf;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,iDAAiD;AACjD;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,EAAE;;AAEF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,CAAC;;AAED;;AAEA;AACA;AACA;AACA,GAAG;AACH,EAAE;AACF;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;;AAGD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,qCAAqC;;AAEpD;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;;AAEA;AACA;AACA;;AAEA,KAAK;AACL;AACA;AACA;AACA;AACA,EAAE;AACF;AACA;;AAEA;;AAEA;;;;AAIA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,EAAE;AACF;AACA;;AAEA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA,IAAI;;AAEJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;;AAEH,EAAE;;AAEF;AACA;AACA;AACA;;AAEA,EAAE;;AAEF;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,GAAG;;AAEH,EAAE;;AAEF;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,EAAE;AACF;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,aAAa;AACb,KAAK;AACL;;AAEA,WAAW;AACX,GAAG;AACH;AACA,CAAC;;;AAGD;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB;;AAEhB;AACA;AACA;AACA;AACA;AACA,gBAAgB;;AAEhB,gDAAgD;AAChD;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,mBAAmB;AACnB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA,GAAG;AACH;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,wDAAwD;AACxD;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,EAAE;;AAEF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,iBAAiB;;AAEjB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;AACA,IAAI;;AAEJ;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAAS;AACT;;AAEA;;AAEA;AACA;;AAEA;AACA,iBAAiB;AACjB,SAAS;;AAET;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kDAAkD;;AAElD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE;;AAEF;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,EAAE;;AAEF;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA,2BAA2B;;AAE3B;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,kCAAkC;;AAElC;AACA,sBAAsB;AACtB,2BAA2B;;AAE3B;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,OAAO;;AAEP;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,IAAI;;AAEJ;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,sDAAsD;AACtD;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA,IAAI;;AAEJ;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,KAAK;AACL;;AAEA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,IAAI;;AAEJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,IAAI;AACJ;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,EAAE;;AAEF;AACA;AACA,EAAE;;AAEF;AACA;AACA;AACA,CAAC;;AAED;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA,CAAC;;;AAGD;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE;AACF;;;AAGA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,IAAI;AACJ;;AAEA;AACA,EAAE;;AAEF;AACA;AACA;AACA;AACA,IAAI;AACJ;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA,IAAI;AACJ;AACA;AACA,GAAG;AACH,EAAE;;AAEF;AACA;;AAEA;AACA;AACA,GAAG;AACH,EAAE;;AAEF;AACA;AACA;AACA,GAAG;AACH;AACA;AACA,CAAC;;;AAGD;AACA;AACA;AACA;AACA;AACA;;;;;AAKA;AACA;AACA;AACA,EAAE;AACF;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,EAAE;AACF;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,QAAQ;;AAER;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;;AAEA,mDAAmD;AACnD;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,WAAW,uBAAuB;AAClC,WAAW,yBAAyB;AACpC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA,IAAI;;AAEJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;;;;AAKD;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA,EAAE;AACF;AACA;AACA,EAAE;AACF;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;;;;AAKD;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,IAAI;AACJ;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,GAAG;;AAEH;AACA;AACA;AACA,CAAC;;;;;AAKD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;;AAGD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,EAAE;AACF;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA,IAAI;AACJ,GAAG;AACH;;AAEA;AACA;;;;;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;;;;AAKD;AACA;AACA;AACA,EAAE;AACF;;;;;AAKA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,GAAG;AACH;AACA;AACA;;AAEA;;AAEA;AACA,qDAAqD;AACrD;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,GAAG;AACH;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE;;AAEF;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,mBAAmB;;AAEnB;AACA;;AAEA;AACA;;AAEA,GAAG;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,EAAE;;AAEF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,GAAG;AACH;AACA,CAAC;;AAED;AACA,cAAc,sDAAsD;AACpE;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,IAAI;AACJ;AACA;AACA,GAAG;AACH;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;;AAGD;AACA,cAAc,mCAAmC;AACjD,eAAe,6DAA6D;AAC5E;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA,IAAI;AACJ;AACA,EAAE;AACF,CAAC;;;AAGD;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA,CAAC;;;;;AAKD;;AAEA;AACA;AACA,EAAE;AACF;AACA;AACA,EAAE;;AAEF;AACA;AACA,EAAE;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,EAAE;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;;;;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,EAAE;AAAA;AACF;;;;;AAKA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;;;;AAKA;AACA,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;AC3nUc;AAGU;AACV;AACG;AACM;AAG0B;AAC7B;AACrB;AACqB;;AAErB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B;;AAE5B;AACA;;AAEA;;AAEA,4GAA0C,iBAAiB;AAC3D;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,mBAAmB;AACnB,sBAAsB;AACtB,uBAAuB;AACvB;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,uBAAuB,8BAA8B;AACrD;AACA;AACA;;AAEA,gHAA8C,0BAA0B;AACxE;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,uBAAuB,8BAA8B;AACrD;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA,mBAAmB,cAAc;AACjC;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;;AAEA,iJAA2D;AAC3D;AACA,mBAAmB,8EAA0B;AAC7C;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe;AACf;;AAEA;AACA,mBAAmB,8BAA8B;AACjD;AACA;AACA;;AAEA;AACA,eAAe;AACf;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA,kFAAkF;AAClF,gGAAgG;;AAEhG;;AAEA;AACA;AACA,8NAAsJ;;AAEtJ;AACA;AACA,iMAAyH;;AAEzH;AACA;AACA,gOAAwJ;;AAExJ;AACA;AACA;AACA,oMAA4H;;AAE5H;AACA;AACA;AACA;AACA;;AAEQ;;;;;;;;;;;;;;;;;;;;;;;;;;;AC1RmB;AACZ;AACE;AACM;AACL;AACH;;AAEf;AACwB;AAIF;AAEG;AACzB;AACqD;AAKX;;AAE1C;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA,sBAAsB;AACtB;AACA;AACA;AACA;AACA,sCAAsC;AACtC;AACA;;AAEA;AACA;AACA;;AAEA,yCAAyC;AACzC,sCAAsC;;AAEtC,oCAAoC;;AAEpC,2BAA2B;AAC3B;AACA,oBAAoB;AACpB,oBAAoB;AACpB,oBAAoB;AACpB,oBAAoB;AACpB,oBAAoB;AACpB,oBAAoB;AACpB,oBAAoB;;AAEpB;AACA;AACA;AACA;AACA;AACA;;AAEA,iBAAiB;AACjB,iBAAiB;AACjB,iBAAiB;AACjB,kBAAkB;AAClB,sBAAsB;AACtB;AACA,mBAAmB;AACnB,mBAAmB;;AAEnB;AACA,6BAA6B;AAC7B,6BAA6B;AAC7B;AACA;;AAEA,0CAA0C;AAC1C;AACA;AACA,0BAA0B;AAC1B,0BAA0B;AAC1B,8BAA8B;AAC9B;AACA;AACA;AACA,0BAA0B;AAC1B,0BAA0B;AAC1B,8BAA8B;AAC9B;AACA;AACA;AACA,0BAA0B;AAC1B,0BAA0B;AAC1B,8BAA8B;AAC9B;AACA;AACA;AACA,0BAA0B;AAC1B,0BAA0B;AAC1B,8BAA8B;AAC9B;AACA;AACA;AACA,0BAA0B;AAC1B,0BAA0B;AAC1B,8BAA8B;AAC9B;AACA;AACA;AACA,0BAA0B;AAC1B,0BAA0B;AAC1B,8BAA8B,eAAe;AAC7C;AACA;AACA;AACA,0BAA0B;AAC1B,0BAA0B;AAC1B,8BAA8B;AAC9B;AACA;AACA;AACA,0BAA0B;AAC1B,0BAA0B;AAC1B,8BAA8B,eAAe;AAC7C;AACA;AACA;AACA,0BAA0B;AAC1B,0BAA0B;AAC1B,6BAA6B;AAC7B;AACA;AACA;AACA,0BAA0B;AAC1B,0BAA0B;AAC1B,8BAA8B,eAAe;AAC7C;AACA;AACA;AACA,0BAA0B;AAC1B,0BAA0B;AAC1B,8BAA8B,eAAe;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sCAAsC;AACtC;AACA,KAAK;AACL;AACA,sCAAsC;AACtC;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,sCAAsC;AACtC;AACA,KAAK;AACL;AACA,sCAAsC;AACtC;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,0BAA0B;AAC1B;AACA;AACA;AACA;AACA,mBAAmB;AACnB,mBAAmB;;AAEnB;AACA,qBAAqB;AACrB,kBAAkB;AAClB,iEAAiE;AACjE;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,mBAAmB;AACnB;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL,kBAAkB;AAClB;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,2BAA2B;AAC3B,oBAAoB;AACpB;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;;AAEA,uBAAuB;AACvB;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;;AAEA;AACA;;AAEA,wCAAwC,4BAA4B;;AAEpE;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA,4BAA4B;AAC5B;;AAEA;AACA;AACA;AACA;AACA;AACA,wBAAwB;AACxB,wBAAwB;AACxB,wBAAwB;AACxB,wBAAwB;AACxB,wBAAwB;AACxB,wBAAwB;;AAExB,wBAAwB;;AAExB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,8BAA8B;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,mBAAmB,mBAAmB;AACtC;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,0CAA0C;;AAE1C;AACA;AACA;AACA;AACA;AACA,iFAAiF,mCAAmC;AACpH;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,mBAAmB,mBAAmB;AACtC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,6BAA6B,uBAAuB;AACpD;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,uBAAuB,mBAAmB;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,mBAAmB,mBAAmB;AACtC;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;;AAEA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA,aAAa;AACb;;AAEA;AACA,2CAA2C;;AAE3C;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA,4DAA4D;AAC5D;AACA;AACA;AACA,iCAAiC,4BAA4B;AAC7D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,+BAA+B;;AAE/B;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0CAA0C,mBAAmB;;AAE7D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mCAAmC,0BAA0B;AAC7D;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,kCAAkC,6BAA6B;AAC/D;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA,0CAA0C;AAC1C,yBAAyB;AACzB;AACA;AACA;AACA;AACA;AACA,wEAAwE;AACxE,4EAA4E;AAC5E,iEAAiE;AACjE;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB;AACzB;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA,qBAAqB;AACrB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA,aAAa;AACb;;AAEA;AACA;AACA;AACA;AACA,yCAAyC;AACzC,0CAA0C,uBAAuB;AACjE;AACA;AACA;AACA;AACA,6BAA6B;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,sCAAsC;AACtC;AACA,6CAA6C,gCAAgC;AAC7E;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,+CAA+C;AAC/C,qCAAqC;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;;AAEA,SAAS;;AAET;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,mBAAmB,mBAAmB;AACtC;AACA;AACA;;AAEA;AACA;AACA;AACA,8DAA8D,gBAAgB;AAC9E;;AAEA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,8BAA8B;AAC9B;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,gEAAgE;AAChE,oEAAoE;AACpE,6DAA6D;AAC7D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA,+DAA+D;AAC/D;AACA,iDAAiD;AACjD;AACA,sFAAsF;AACtF,aAAa;AACb,0CAA0C;AAC1C;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,0CAA0C;AAC1C;;AAEA;AACA;AACA,2BAA2B,6BAA6B;AACxD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,sCAAsC;AACtC;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,2BAA2B;AAC3B;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB;;AAEpB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,mCAAmC;AACnC,mCAAmC;AACnC;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA,+GAA6C;AAC7C;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;;AAEA;AACA;AACA,KAAK;;AAEL;AACA,mBAAmB,qBAAqB;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,8BAA8B;AAC9B;AACA;AACA;AACA;AACA;AACA;;AAEA,wBAAwB;AACxB,wBAAwB;;AAExB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,mBAAmB;AACnB;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA,mBAAmB,2BAA2B;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,mBAAmB,2BAA2B;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,2EAA2E;;AAE3E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,2BAA2B;AAClD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA,2EAA2E;;AAE3E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;;AAEA,mBAAmB,2BAA2B;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,mBAAmB,2BAA2B;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,mBAAmB,2BAA2B;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA,4BAA4B;AAC5B;AACA;AACA;AACA;AACA,oCAAoC;AACpC;;AAEA;AACA;AACA;AACA;;AAEA;AACA,kCAAkC,cAAc;AAChD,kCAAkC,eAAe;AACjD,kCAAkC,aAAa;AAC/C,kCAAkC,eAAe;AACjD,kCAAkC,cAAc;AAChD,kCAAkC,iBAAiB;AACnD,kCAAkC,kBAAkB;AACpD,kCAAkC,cAAc;AAChD,kCAAkC,eAAe;AACjD,kCAAkC,iBAAiB;AACnD,kCAAkC,oBAAoB;AACtD;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA,KAAK;;AAEL;AACA;AACA;;AAEA;AACA;AACA,8CAA8C;AAC9C;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA,2CAA2C;AAC3C;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA,6CAA6C;AAC7C;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,0CAA0C;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;;AAEb;AACA;AACA;AACA;AACA;AACA,qCAAqC,gCAAgC;AACrE;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qCAAqC;AACrC;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;;AAEb,2BAA2B,8BAA8B;AACzD;AACA;AACA,iBAAiB,GAAG;AACpB,aAAa;;AAEb;AACA,2BAA2B,8BAA8B;AACzD;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B;AAC7B;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,aAAa;;AAEb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,qCAAqC;AACrC;AACA;AACA;AACA;AACA,aAAa;;AAEb;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;;AAEb;AACA;AACA;AACA,aAAa;AACb;AACA,2BAA2B,oBAAoB;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6CAA6C;AAC7C;AACA;AACA;AACA,iBAAiB;AACjB,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B;AAC/B,SAAS;AACT;;AAEA,oHAAkD,GAAG;;AAErD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb,6GAA2C;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA,2CAA2C;AAC3C;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA,2CAA2C;AAC3C;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA,+DAA+D;AAC/D;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,yCAAyC;AACzC,qBAAqB;AACrB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB;AACzB;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,4CAA4C;AAC5C,qBAAqB;AACrB;AACA;AACA,qBAAqB;AACrB;AACA,yCAAyC;AACzC;AACA;AACA;AACA,yBAAyB;AACzB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,KAAK;;AAEL;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kEAAkE;AAClE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA,2CAA2C;AAC3C;AACA,aAAa;AACb;AACA;AACA;AACA;AACA,2CAA2C;AAC3C;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8CAA8C;AAC9C,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB;AACzB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,sDAAsD;AACtD,qBAAqB;AACrB;AACA;AACA,qBAAqB;AACrB;AACA,yCAAyC;AACzC;AACA;AACA,yBAAyB;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,KAAK;AACL,2GAAyC,GAAG;;AAE5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA,2CAA2C;AAC3C;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,8BAA8B;AAC9B;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,4BAA4B;AAC5B;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,SAAS;;;AAGT;;AAEA,mJAA6D;AAC7D;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL,4DAA4D;AAC5D;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,2BAA2B;AAC3B;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,mCAAmC;AACnC;AACA,KAAK;AACL,qGAAmC;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,kCAAkC;AAClC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,gCAAgC;AAChC,0CAA0C;AAC1C,oDAAoD;AACpD;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,uBAAuB,2BAA2B;AAClD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,kCAAkC,UAAU,OAAO;AACnD;;AAEA;AACA;AACA,kCAAkC,UAAU,OAAO;AACnD;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,kCAAkC,UAAU,OAAO;AACnD;;AAEA;AACA;AACA,kCAAkC,UAAU,OAAO;AACnD;;AAEA;AACA;AACA,kCAAkC,UAAU,OAAO;AACnD;;AAEA;AACA;AACA,kCAAkC,UAAU,OAAO;AACnD;;AAEA;AACA;AACA,kCAAkC,UAAU,OAAO;AACnD;;AAEA;AACA;AACA,kCAAkC,UAAU,OAAO;AACnD;;AAEA;AACA;AACA,kCAAkC,UAAU,OAAO;AACnD;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL,0HAAwD,2BAA2B;AACnF;;AAEA;AACA;;AAEA;AACA,qHAAmD,qBAAqB;AACxE;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA,mBAAmB,2BAA2B;AAC9C;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,qFAAqF;;AAErF;AACA;AACA;AACA,aAAa;AACb,kHAAgD,0BAA0B;AAC1E;AACA;AACA,aAAa;AACb;AACA;AACA,aAAa;AACb,6HAA2D;AAC3D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2CAA2C;AAC3C;AACA,aAAa;AACb;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;;AAEA,mCAAmC,2BAA2B;AAC9D;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA,yBAAyB;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;;AAEb;AACA;AACA,2BAA2B,2BAA2B;AACtD;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;;AAEA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,aAAa;;AAEb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;;AAEA;AACA;AACA,6BAA6B;AAC7B,mBAAmB,uBAAuB;AAC1C;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,uBAAuB;AAC1C;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA,mBAAmB,8BAA8B;AACjD;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B;AAC/B;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB,6HAA2D;AAC3D;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB;AACzB;AACA,yBAAyB;AACzB;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB;AACzB;AACA,yBAAyB;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iCAAiC;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB,2HAAyD;AACzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB;AACzB;AACA;AACA,yBAAyB;AACzB;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB;AACzB;AACA,yBAAyB;AACzB;AACA;AACA,yBAAyB;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iCAAiC;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA,SAAS;;AAET;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB,iIAA+D,aAAa;AAC5E,+BAA+B,uEAA4B;AAC3D;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB;AACzB;AACA,yBAAyB;AACzB;AACA,yBAAyB;;AAEzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB;AACzB;AACA,yBAAyB;AACzB;AACA,yBAAyB;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB;AACzB;AACA,yBAAyB;AACzB;AACA,yBAAyB;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;;AAEjB;AACA;AACA;AACA,SAAS;AACT;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,qCAAqC,OAAO;AAC5C;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA,+DAA+D;AAC/D;AACA;AACA;AACA,4DAA4D;AAC5D,gDAAgD;AAChD,mDAAmD;;AAEnD,mBAAmB,uBAAuB;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB;AACzB;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA,SAAS;AACT;;AAEA;AACA;AACA;AACA,KAAK;;AAEL,mBAAmB,iBAAiB;AACpC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA,aAAa;AACb,SAAS;AACT;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B;AAC7B,6BAA6B;AAC7B,6BAA6B;AAC7B,6BAA6B;AAC7B,6BAA6B;AAC7B,6BAA6B;AAC7B,6BAA6B;AAC7B,6BAA6B;AAC7B,6BAA6B;AAC7B;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb,0HAAwD,aAAa;AACrE;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB;AACzB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA,yBAAyB;AACzB;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,KAAK;AACL,+HAA6D,GAAG;;AAEhE;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,4GAA0C,sCAAsC;AAChF,6GAA2C,uCAAuC;AAClF;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA,KAAK;AACL;;AAEA;AACA,kHAAgD;AAChD;AACA,8HAA4D;;AAE5D;AACA;AACA,oDAAoD,2BAA2B;;AAE/E,4HAA0D;AAC1D;AACA;AACA;AACA,KAAK;AACL,iIAA+D;AAC/D,mBAAmB,iBAAiB;AACpC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA,yBAAyB;AACzB;AACA;AACA;AACA,aAAa;AACb,yIAAuE;;AAEvE,SAAS;AACT;;;AAGA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB,6HAA2D;AAC3D;AACA;AACA;AACA;AACA;AACA,yBAAyB;AACzB;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA,iBAAiB;AACjB,wHAAsD;AACtD;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA,8DAA8D;AAC9D,iEAAiE;AACjE;AACA;AACA;AACA;AACA,yBAAyB;AACzB;AACA,yBAAyB;AACzB;AACA,yBAAyB;AACzB;AACA,yBAAyB;AACzB;AACA;AACA;AACA;AACA;AACA,6BAA6B;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA,SAAS;AACT;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sCAAsC,oCAAoC;AAC1E;AACA;AACA,SAAS;AACT;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,sCAAsC,oCAAoC;AAC1E;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,uCAAuC,oCAAoC;AAC3E;AACA;AACA,KAAK;AACL;;AAEA;AACA,8HAA4D;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,2BAA2B,OAAO;AAClC;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,gCAAgC;AAChC,sCAAsC;AACtC;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,aAAa;AACb,8GAA4C,4BAA4B;;AAExE;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA,2CAA2C;AAC3C;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA,yBAAyB;AACzB;AACA;AACA,+CAA+C,iCAAiC;AAChF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,KAAK;;AAEL,4HAA0D;AAC1D,iHAA+C,4BAA4B;AAC3E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,yIAAuE;;AAEvE,iIAA+D,4BAA4B;AAC3F;AACA;AACA;AACA;AACA,+BAA+B,6BAA6B;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET,uBAAuB,6BAA6B;AACpD,oHAAkD,8BAA8B;AAChF;;AAEA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,yIAAuE;;AAEvE;AACA;AACA;AACA,uBAAuB,6BAA6B;AACpD;AACA;AACA,8BAA8B;AAC9B;AACA,+BAA+B;AAC/B;AACA,+BAA+B;AAC/B;AACA,gCAAgC;AAChC;AACA,+BAA+B;AAC/B;AACA,sCAAsC;AACtC;AACA,oCAAoC;AACpC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAS;AACT,yIAAuE;;AAEvE;AACA;AACA,yIAAuE;;AAEvE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,sBAAsB;AAC7C;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB,sHAAoD;AACpD;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;;AAEA;AACA;AACA;AACA,4BAA4B,iCAAiC;AAC7D,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,mBAAmB,6BAA6B;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB;AAClB,iIAA+D;AAC/D;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,iIAA+D;AAC/D;AACA,6KAAoG,gBAAgB;AACpH;AACA;AACA;AACA,SAAS;AACT,iIAA+D;AAC/D;AACA;AACA;AACA,SAAS;AACT;;AAEA;AACA;AACA;AACA,4BAA4B,gCAAgC;AAC5D;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,gCAAgC;AAChC;AACA,mBAAmB,qBAAqB;AACxC;AACA;AACA;AACA;;AAEA;AACA;AACA,uCAAuC;;AAEvC;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEQ;;;;;;;;;;;;;;;;;;ACvzJO;AACS;AAEC;;AAEzB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,sCAAsC,mBAAmB;AACzD,4CAA4C;AAC5C;AACA,KAAK,OAAO;AACZ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA,+BAA+B;AAC/B,mBAAmB,6BAA6B;AAChD;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,+BAA+B;AAC/B,mBAAmB,6BAA6B;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;;AAEQ;;;;;;;;;;;;;;;;;;ACzFO;AACW;;AAE1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,2BAA2B,iBAAiB;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,iBAAiB;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,iBAAiB;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,iBAAiB;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,iBAAiB;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,iBAAiB;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,iBAAiB;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEQ;;;;;;;;;;;;;;;;;;;;;;;ACnOkB;AACX;AACA;AACY;AAEG;AACb;;AAEO;AAEU;AAES;;AAE3C;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,SAAS;AACT;AACA,SAAS;AACT,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sFAAsF;AACtF;AACA;AACA;AACA,aAAa;AACb;AACA,aAAa;AACb,SAAS;AACT,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,mBAAmB,0EAA+B;AAClD;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,kCAAkC;AAClC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,mBAAmB,SAAS;AAC5B;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA,mBAAmB,SAAS;AAC5B;AACA;AACA;AACA,+BAA+B;AAC/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB,aAAa;AACb;AACA;AACA,iBAAiB;AACjB;AACA,SAAS,KAAK;AACd;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;;;AAGA;AACA;AACA;AACA;AACA,0BAA0B;AAC1B;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,KAAK;;AAEL;;AAEQ;;;;;;;;;;;;;;;ACxUS;;AAEjB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACjDuB;AAEN;AACP;AACH;AAEsB;AACJ;AACF;AAES;AACK;AAClB;AACG;AACK;AACU;AACE;AACV;AACb;AACI;AAEW;AAEd;AACJ;;AAErB;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,6BAA6B;AAC7B,uBAAuB,kCAAkC;AACzD;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA,2EAAgC;AAChC,6DAAkB;AAClB;;AAEA;AACA;AACA;AACA;;AAEA;AACA,mHAA+D;AAC/D;AACA;AACA;AACA;AACA,SAAS;AACT;AACA,SAAS;AACT;AACA,SAAS;AACT;AACA,SAAS;AACT;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,kFAAuC;AACvC,yFAA8C;AAC9C;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA,8DAAmB;AACnB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,uCAAuC,mBAAmB;AAC1D,4CAA4C;AAC5C;AACA,KAAK,OAAO;AACZ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEQ;;;;;;;;;;;AC5mBR;;AAEA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;;AAEA;AACA;AACA,4CAA4C;;AAE5C;;;;;;;;;;;ACnBA;;;AAGA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,kBAAkB,UAAU;;AAE5B;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;;AAGA;AACA;AACA,4BAA4B,YAAY;AACxC,qBAAqB,8BAA8B;AACnD;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,SAAS;AAC5B;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA,kCAAkC,OAAO;AACzC;AACA;;AAEA;AACA;AACA;AACA,kCAAkC,OAAO;AACzC;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,mBAAmB,SAAS;AAC5B;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;;AAEA;;;;;;;;;;;8CCxGA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,CAAC;AACD;AACA;;;;;;;;;;;;;;;;;;;ACrCyB;AACe;;AAExC;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,uBAAuB,qCAAqC;AAC5D;AACA;AACA;AACA;AACA;AACA;;AAEQ;;;;;;;;;;;;AClER;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA,eAAe,iBAAiB;AAChC;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;;AAEA;AACA;;AAEA;AACA,gCAAgC,OAAO;AACvC;AACA;AACA,C;;;;;;;;;;;;;;;AC3HwB;;AAExB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,yBAAyB;AACzB;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEQ;;;;;;;;;;;;;AC9aR;AAAA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;;AAEQ;;;;;;;;;;;AC5CR;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;ACtBA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,aAAa,OAAO;AACpB;AACA;AACA,8BAA8B;;AAE9B;AACA;AACA;;AAEA;AACA,mBAAmB,iBAAiB;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA,wBAAwB,aAAa;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,2BAA2B,kBAAkB;;AAE7C;AACA;AACA,oDAAoD,OAAO;;AAE3D;AACA;AACA,kBAAkB,YAAY;;AAE9B;AACA;AACA,oBAAoB,YAAY;;AAEhC;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,oBAAoB,OAAO;AAC3B;AACA;AACA,uBAAuB,qBAAqB,UAAU;;AAEtD;AACA;AACA,wBAAwB,0BAA0B,cAAc,UAAU;;AAE1E;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,wBAAwB,0BAA0B,UAAU;;AAE5D;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;;;AAGA;;;AAGA;AACA;AACA;AACA,WAAW,OAAO;AAClB,YAAY,wBAAwB;AACpC;AACA;AACA;AACA;AACA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA,WAAW,wBAAwB;AACnC,YAAY,OAAO;AACnB;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AClRgC;AAEa;AACd;AACX;AACO;AACe;AACzB;AACF;AAEK;AACa;AACf;AACsB;AACQ;AAElB;AACf;;AAKc;AAGF;AAGU;AACD;AACpC;AACwB;AAEkB;AAEC;;AAE3C;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,6FAA+B;;AAE/B;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,uEAAmB;AACnB,kFAAwB;AACxB;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,4EAAgC;AAChC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;;AAEA;AACA,yFAA4B;;AAE5B;;AAEA;AACA,6EAAyB;;AAEzB;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,mBAAmB,2EAA+B;AAClD;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,uEAAmB;AACnB,kFAAwB;AACxB;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA,SAAS;AACT;AACA,SAAS;;AAET;;AAEA;AACA,4EAAgC;AAChC;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEQ;;;;;;;;;;;;ACnUR;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;AClBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;;;;;;;;;;AC1GA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,KAAK;AACL;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;;;;AAIA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,uBAAuB,sBAAsB;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,qCAAqC;;AAErC;AACA;AACA;;AAEA,2BAA2B;AAC3B;AACA;AACA;AACA,4BAA4B,UAAU;;;;;;;;;;;ACvLtC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,qBAAqB,mDAAmD;AACxE;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,mBAAmB,UAAU;AAC7B;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,iBAAiB,YAAY;AAC7B;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,0BAA0B;AAC1B;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA,uCAAuC,SAAS;AAChD;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,eAAe,iBAAiB;AAChC;AACA;AACA;;AAEA;AACA;AACA,aAAa,iBAAiB;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,iBAAiB,SAAS;AAC1B;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,iBAAiB,SAAS;AAC1B;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,iBAAiB,SAAS;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,gDAAgD,EAAE;AAClD;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA,iBAAiB,SAAS;AAC1B;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,yCAAyC;AACzC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA,wBAAwB,eAAe;AACvC;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA,GAAG;AACH;AACA,wBAAwB,QAAQ;AAChC;AACA,qBAAqB,eAAe;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,iBAAiB,YAAY;AAC7B;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,qBAAqB,SAAS;AAC9B;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,qBAAqB,SAAS;AAC9B;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA,qBAAqB,SAAS;AAC9B;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,iBAAiB,kBAAkB;AACnC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA,mBAAmB,cAAc;AACjC;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,uDAAuD,OAAO;AAC9D;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA,uDAAuD,OAAO;AAC9D;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,kBAAkB;AAClB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,qBAAqB,QAAQ;AAC7B;AACA;AACA,GAAG;AACH;AACA,eAAe,SAAS;AACxB;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA,mBAAmB,SAAS;AAC5B;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA,eAAe,iBAAiB;AAChC;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,iBAAiB,YAAY;AAC7B;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,iBAAiB,gBAAgB;AACjC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,iBAAiB,gBAAgB;AACjC;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,iBAAiB,YAAY;AAC7B;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;;;;;;;;;;AC5vDA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sCAAsC;AACtC,+BAA+B;AAC/B;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,MAAM;AACjB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;;;;;;;;;AChCA;AACA;AACA;AACA,uCAAuC,gC;;;;;;;;;;8CCHvC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,gBAAgB,OAAO;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,eAAe,QAAQ;AACvB,gBAAgB,OAAO;AACvB;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,KAAK;AACL;AACA;AACA,eAAe,OAAO;AACtB,gBAAgB,QAAQ;AACxB;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;ACnDA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;+CC7DA;;AAEA;AACA;AACA;AACA,oBAAoB;AACpB,CAAC;AACD;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;;;;;;;;;;;AC1CA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,EAAE;AACzB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,mBAAmB,iBAAiB;AACpC;AACA;AACA;AACA;AACA;AACA,+BAA+B;AAC/B;AACA,+BAA+B,qBAAqB;AACpD;AACA;AACA;AACA;AACA;AACA;AACA,oCAAoC;AACpC;AACA;AACA,sBAAsB;AACtB;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AAAA;AACb;AACA;AACA;AACA,CAAC;;;;;;;;;;;;;;;;ACzNmB;AACO;AACL;;AAEtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oCAAoC;AACpC,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8BAA8B,yBAAyB;AACvD;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;;AAEQ;;;;;;;;;;;;;;;;;AC/FO;;AAGuB;AACrB;;AAEjB;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,4BAA4B;AAC5B;;AAEA,mBAAmB,kBAAkB;AACrC;AACA;AACA;AACA;;AAEA;AACA,kCAAkC;AAClC,KAAK;AACL;AACA,KAAK;AACL;;AAEA;AACA,qCAAqC;AACrC;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,SAAS;AACT;AACA,SAAS;AACT,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+EAA+E;AAC/E;AACA;AACA;AACA,aAAa;AACb;AACA,aAAa;AACb,SAAS;AACT,KAAK;AACL;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;AACL;;AAEQ;;;;;;;;;;;;;ACjGR;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEQ;;;;;;;;;;ACxNR;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,UAAU;AACrB,WAAW,OAAO,4CAA4C;AAC9D,WAAW,QAAQ;AACnB;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;AC5CA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yCAAyC;AACzC;AACA,aAAa;AACb;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA,qDAAqD;AACrD;AACA;AACA;AACA,aAAa;AACb;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,8BAA8B,wBAAwB;AACtD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2CAA2C;AAC3C;AACA,aAAa;AACb;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sCAAsC;AACtC;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;;AAEA;AACA;;;;;;;;;;AC7FA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX,aAAa,KAAK;AAClB;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;;;;;;;;;;AC3FA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6DAA6D;AAC7D;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;AC/BA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,iBAAiB,SAAS;AAC1B;AACA,qBAAqB,OAAO;AAC5B;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;;AAGA;AACA;;AAEA;;AAEA,qBAAqB,SAAS;AAC9B;AACA;;AAEA,wBAAwB;AACxB;;AAEA;;AAEA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,YAAY,OAAO;AACnB;AACA;AACA;;AAEA;;AAEA,qBAAqB,SAAS;AAC9B;AACA;;AAEA,wBAAwB;AACxB;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,KAAK;AACL;AACA;AACA;;;;;;;;;;;AC5EA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,qCAAqC;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,gBAAgB,cAAc;AAC9B;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA,KAAK;AACL;AACA;AACA,gBAAgB,cAAc;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,cAAc;AACzB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,YAAY,cAAc;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;;;;;;;;;AC1EA;AACA;AACA,iCAAiC,QAAQ,gBAAgB,UAAU,GAAG;AACtE,CAAC,E;;;;;;;;;ACHD;AACA;AACA,E;;;;;;;;;;ACFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,iDAAiD,0FAA0F;;AAE3I;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP,KAAK;AACL,GAAG;AACH,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,GAAG;AACH,CAAC;AACD;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,iCAAiC;;AAEjC;;AAEA,2CAA2C;AAC3C;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,GAAG;AACH;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,mDAAmD;AACnD;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA,oDAAoD;AACpD;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,4CAA4C;AAC5C;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA,E;;;;;;;;;;ACpqBA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;ACNA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA,eAAe,SAAS;AACxB;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,GAAG;AACH,oBAAoB,SAAS;AAC7B;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;;;;;;;;;AC7SA;AACA;AACA;;;;;;;;;;;;;;;;ACFkD;AACrB;;AAE7B;AACA;AACA,6BAA6B,wBAAwB;AACrD;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,IAAI;AACvB;AACA;AACA;AACA,mBAAmB,IAAI;AACvB;AACA;AACA,6FAA6F;AAC7F;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,aAAa;;;AAGb;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;;;;;;;;;;;;;;;;;;;AC5GkB;AACH;AAC6B;AACpB;AACD;AACQ;;;AAG/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEQ;;;;;;;;;;;;ACpER;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,wCAAwC;AACxC,yCAAyC;AACzC,iBAAiB;AACjB;AACA;AACA;AACA,+BAA+B,UAAU;AACzC,gCAAgC;AAChC;AACA;AACA,6BAA6B;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB,mBAAmB;AAC5C,6BAA6B;AAC7B,6BAA6B;AAC7B,6CAA6C;AAC7C;AACA,+BAA+B;AAC/B,+BAA+B,eAAe;AAC9C;AACA,8CAA8C;AAC9C;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEQ;;;;;;;;;;;AC3JR;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;ACrBA;AACA;;AAEA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,gBAAgB,MAAM;AACtB;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,eAAe,OAAO;AACtB,gBAAgB,MAAM;AACtB;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,eAAe,OAAO;AACtB,gBAAgB,MAAM;AACtB;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,eAAe,OAAO;AACtB,gBAAgB,MAAM;AACtB;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,eAAe,OAAO;AACtB,gBAAgB,OAAO;AACvB;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,eAAe,OAAO;AACtB,gBAAgB,OAAO;AACvB;AACA;AACA;AACA;AACA;AACA,uCAAuC,iBAAiB;AACxD;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,eAAe,OAAO;AACtB,gBAAgB,OAAO;AACvB;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,eAAe,OAAO;AACtB,gBAAgB,OAAO;AACvB;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,eAAe,OAAO;AACtB,gBAAgB,OAAO;AACvB;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,eAAe,OAAO;AACtB,gBAAgB,QAAQ;AACxB;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,gBAAgB,KAAK;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gCAAgC;AAChC;AACA;AACA;;;;;;;;;;;ACnHA;AACA;AACA;;AAEA;AACA;AACA,eAAe,sBAAsB;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iCAAiC,QAAQ;AACzC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;ACxDA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,WAAW,qCAAqC;AAChD,YAAY,WAAW;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;AC3BA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;ACNA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6DAA6D;AAC7D;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,0BAA0B;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;;;;;;;;;;ACnEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6DAA6D;AAC7D;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,oBAAoB;AACpB;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;;;;;;;;;;AC9CA;AACA;;;AAGA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,KAAK,wCAAwC,EAAE,aAAa,sBAAsB;AAClF,KAAK,oDAAoD,EAAE,aAAa,0BAA0B;;;AAGlG;AACA;AACA;AACA;AACA,eAAe,SAAS;AACxB;AACA;AACA,kCAAkC;;;AAGlC;AACA;AACA;;AAEA;AACA,iBAAiB,iBAAiB;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,wBAAwB,aAAa;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,iBAAiB,SAAS;AAC1B;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA,mCAAmC,SAAS;AAC5C;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,sBAAsB,SAAS;AAC/B;AACA;AACA,mBAAmB,qBAAqB,UAAU;;AAElD;AACA;AACA,oBAAoB,0BAA0B,gBAAgB,UAAU;;AAExE;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,oBAAoB,0BAA0B,UAAU;;AAExD;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,yBAAyB,kBAAkB;;AAE3C;AACA;AACA,kDAAkD,OAAO;;AAEzD;AACA;AACA,gBAAgB,YAAY;;AAE5B;AACA;AACA,kBAAkB,YAAY;;AAE9B;AACA;;;;;;;;;;;ACxLA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6DAA6D;AAC7D;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,iBAAiB,SAAS;AAC1B;AACA,mBAAmB,OAAO;AAC1B;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;;AAGA;AACA;AACA;;AAEA;;AAEA,mBAAmB,SAAS;AAC5B;AACA;;AAEA,sBAAsB;AACtB;;;AAGA;;;;;;;;;;;AC1DA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6DAA6D;AAC7D;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;;AAEA;AACA;;;AAGA;;;;;;;;;;;AClDA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;;;;;;;;;;ACbA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;ACvBA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;AC3BA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,QAAQ;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA;;;;;;;;;;;ACnHA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;8CCVA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,yBAAyB;AACpC,WAAW,OAAO;AAClB,YAAY,0CAA0C;AACtD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,MAAM;AACjB,YAAY,yBAAyB;AACrC;AACA;AACA;AACA;AACA,cAAc,sBAAsB;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB,sBAAsB;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,aAAa;AACxB,WAAW,SAAS;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,SAAS;AACT;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAe,SAAS;AACxB;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,eAAe,OAAO;AACtB,eAAe,SAAS;AACxB,gBAAgB,aAAa;AAC7B;AACA;AACA;;AAEA;AACA;AACA;AACA,aAAa;AACb,SAAS;AACT;AACA;AACA,aAAa;AACb;AACA;AACA,KAAK;AACL;AACA;AACA,gBAAgB,aAAa;AAC7B;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,gBAAgB,aAAa;AAC7B;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,eAAe,SAAS;AACxB,gBAAgB,0BAA0B;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,SAAS;AACT;AACA;;;AAGA;;;;;;;;;;;ACnNA;AACA;AACA;AACA;AACA;AACA;AACA,E;;;;;;;;;ACNA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA,E;;;;;;;;;ACNA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,E;;;;;;;;;ACnBA,6BAA6B;AAC7B,qCAAqC,gC;;;;;;;;;;ACDrC;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,2BAA2B,yBAAyB,aAAa;AACjE;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;;;;;;;;;;ACzGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0CAA0C,YAAY;AACtD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA,C;;;;;;;;;;ACrNA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B;AAC5B;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,6BAA6B,sCAAsC,sCAAsC;AACzG;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B;AAC3B;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,C;;;;;;;;;AC/QA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;AC3DA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,GAAG;;AAEH;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,E;;;;;;;;;ACzEA;;;;;;;;;;;ACAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,yEAAyE,6EAA6E;AACtJ;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,iDAAiD,0FAA0F;;AAE3I;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA,kGAAkG;AAClG,OAAO;AACP;AACA,OAAO;AACP;AACA;AACA;AACA,4FAA4F;AAC5F,SAAS;AACT;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA,gDAAgD;;AAEhD;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4EAA4E;AAC5E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA,6DAA6D;AAC7D;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,sCAAsC;;AAEtC;AACA;AACA;AACA,GAAG;AACH;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2DAA2D;AAC3D;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY;AACZ;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA,+CAA+C;;AAE/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,oBAAoB;;AAEpB;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,mBAAmB,SAAS;AAC5B;AACA,KAAK;AACL;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,GAAG;;AAEH;AACA;AACA;;AAEA;AACA,4EAA4E;;AAE5E;AACA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;;AAEA;AACA,iBAAiB,yBAAyB;AAC1C;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,mDAAmD;AACnD;AACA,mDAAmD,iEAAiE;AACpH;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sCAAsC;AACtC;AACA;AACA;AACA;AACA,uCAAuC;AACvC,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uCAAuC;AACvC,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,gCAAgC,OAAO;AACvC;AACA;AACA;;AAEA;AACA,gCAAgC,OAAO;AACvC;AACA;AACA;AACA,C;;;;;;;;;;ACt/BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;ACRA,iBAAiB;;AAEjB;AACA;AACA;;;;;;;;;;ACJA;AACA,wCAAwC,kBAAkB,mCAAmC,8BAA8B,SAAS,EAAE,0BAA0B,8CAA8C,qFAAqF,yBAAyB,kCAAkC,gBAAgB,0DAA0D,UAAU,+EAA+E,2CAA2C,iDAAiD,aAAa,uBAAuB,EAAE,4LAA4L,aAAa,qBAAqB,2EAA2E,EAAE,sDAAsD,mCAAmC,mCAAmC,mGAAmG,gCAAgC,uDAAuD,iDAAiD,qDAAqD,EAAE,wBAAwB,8GAA8G,kBAAkB,gDAAgD,6HAA6H,uCAAuC,uCAAuC,oHAAoH,oEAAoE,kDAAkD,mGAAmG,kDAAkD,2BAA2B,wBAAwB,yCAAyC,8NAA8N,+BAA+B,QAAQ,yDAAyD,0BAA0B,oCAAoC,6BAA6B,UAAU,oBAAoB,wEAAwE,YAAY,2BAA2B,sCAAsC,6BAA6B,yBAAyB,GAAG,8DAA8D,qBAAqB,iBAAiB,kDAAkD,uEAAuE,8BAA8B,kIAAkI,kBAAkB,yEAAyE,aAAa,sCAAsC,EAAE,+BAA+B,aAAa,mCAAmC,GAAG,oCAAoC,oDAAoD,6BAA6B,eAAe,wDAAwD,gFAAgF,KAAK,sEAAsE,2CAA2C,kBAAkB,sGAAsG,8CAA8C,sCAAsC,kGAAkG,eAAe,0CAA0C,wEAAwE,aAAa,sDAAsD,EAAE,mCAAmC,yCAAyC,WAAW,yCAAyC,4BAA4B,2FAA2F,eAAe,kCAAkC,0CAA0C,uDAAuD,YAAY,gCAAgC,WAAW,8BAA8B,YAAY,6BAA6B,kJAAkJ,0BAA0B,8GAA8G,oCAAoC,mCAAmC,mCAAmC,wCAAwC,+LAA+L,+BAA+B,oCAAoC,oCAAoC,0EAA0E,iCAAiC,iCAAiC,8BAA8B,iCAAiC,kDAAkD,mCAAmC,sDAAsD,oCAAoC,2HAA2H,kCAAkC,mHAAmH,kCAAkC,6FAA6F,uCAAuC,mEAAmE,qCAAqC,qEAAqE,mCAAmC,qPAAqP,wCAAwC,kFAAkF,sCAAsC,6EAA6E,yCAAyC,+HAA+H,0CAA0C,iCAAiC,wBAAwB,uCAAuC,uBAAuB,qCAAqC,wBAAwB,2CAA2C,uBAAuB,yDAAyD,kCAAkC,iCAAiC,sBAAsB,sBAAsB,uBAAuB,cAAc,uBAAuB,yDAAyD,yBAAyB,0EAA0E,6BAA6B,qCAAqC,uBAAuB,6CAA6C,8BAA8B,2IAA2I,sCAAsC,wHAAwH,gGAAgG,kCAAkC,yFAAyF,6DAA6D,4DAA4D,uEAAuE,0CAA0C,qBAAqB,iGAAiG,eAAe,4CAA4C,gFAAgF,qBAAqB,qCAAqC,2GAA2G,KAAK,qCAAqC,+JAA+J,MAAM,mEAAmE,2LAA2L,uGAAuG,eAAe,mBAAmB,4BAA4B,2BAA2B,2BAA2B,0BAA0B,qEAAqE,4CAA4C,kDAAkD,EAAE,iGAAiG,qCAAqC,8BAA8B,oKAAoK,YAAY,iEAAiE,KAAK,0EAA0E,4CAA4C,sCAAsC,aAAa,cAAc,4BAA4B,YAAY,mBAAmB,0BAA0B,gDAAgD,eAAe,iEAAiE,gFAAgF,EAAE,6DAA6D,mCAAmC,8CAA8C,cAAc,uBAAuB,oEAAoE,0EAA0E,iCAAiC,4BAA4B,6BAA6B,gEAAgE,mCAAmC,aAAa,4CAA4C,gHAAgH,kBAAkB,iCAAiC,8BAA8B,sFAAsF,4CAA4C,6CAA6C,8JAA8J,4GAA4G,4CAA4C,6CAA6C,cAAc,sCAAsC,uCAAuC,qDAAqD,yDAAyD,mCAAmC,sIAAsI,eAAe,2IAA2I,4IAA4I,YAAY,0DAA0D,4FAA4F,kEAAkE,uDAAuD,0PAA0P,qDAAqD,kCAAkC,8CAA8C,0FAA0F,EAAE,6CAA6C,6DAA6D,0DAA0D,6BAA6B,qBAAqB,oDAAoD,2FAA2F,sCAAsC,gCAAgC,oBAAoB,6CAA6C,8CAA8C,QAAQ,eAAe,sBAAsB,sFAAsF,SAAS,iCAAiC,iEAAiE,kBAAkB,GAAG,wBAAwB,6DAA6D,2BAA2B,6EAA6E,mDAAmD,WAAW,kSAAkS,yBAAyB,yLAAyL,eAAe,oPAAoP,gHAAgH,eAAe,2BAA2B,eAAe,eAAe,YAAY,8DAA8D,2BAA2B,sEAAsE,eAAe,OAAO,0BAA0B,2DAA2D,wCAAwC,mCAAmC,0DAA0D,0DAA0D,gBAAgB,oCAAoC,oCAAoC,8CAA8C,6EAA6E,qCAAqC,0BAA0B,iCAAiC,2BAA2B,2CAA2C,6FAA6F,qGAAqG,gCAAgC,yBAAyB,+BAA+B,qDAAqD,4BAA4B,8BAA8B,0CAA0C,6CAA6C,6BAA6B,yCAAyC,2BAA2B,0BAA0B,mCAAmC,qEAAqE,uCAAuC,UAAU,wHAAwH,KAAK,2GAA2G,qBAAqB,oFAAoF,aAAa,sCAAsC,4IAA4I,6CAA6C,mJAAmJ,uCAAuC,sKAAsK,qCAAqC,yGAAyG,2CAA2C,+GAA+G,wBAAwB,mDAAmD,wBAAwB,sCAAsC,4BAA4B,8EAA8E,2BAA2B,6FAA6F,uBAAuB,6BAA6B,OAAO,+BAA+B,+BAA+B,OAAO,uBAAuB,uCAAuC,4BAA4B,uPAAuP,0CAA0C,+CAA+C,aAAa,qJAAqJ,sBAAsB,QAAQ,iDAAiD,6DAA6D,mGAAmG,wBAAwB,kDAAkD,qBAAqB,6BAA6B,kHAAkH,wBAAwB,mEAAmE,oBAAoB,EAAE,uBAAuB,uDAAuD,8EAA8E,wBAAwB,mEAAmE,oBAAoB,EAAE,0BAA0B,iDAAiD,oHAAoH,8ZAA8Z,wBAAwB,qFAAqF,eAAe,kCAAkC,iDAAiD,uGAAuG,EAAE,mCAAmC,+HAA+H,mDAAmD,mBAAmB,QAAQ,0DAA0D,mCAAmC,YAAY,gBAAgB,+BAA+B,oCAAoC,0BAA0B,KAAK,gCAAgC,+CAA+C,sCAAsC,uPAAuP,mDAAmD,oGAAoG,EAAE,kBAAkB,+BAA+B,SAAS,qEAAqE,MAAM,kCAAkC,8FAA8F,MAAM,kCAAkC,iBAAiB,8IAA8I,EAAE,+CAA+C,2HAA2H,IAAI,2DAA2D,kDAAkD,OAAO,kCAAkC,6CAA6C,uJAAuJ,MAAM,yCAAyC,yBAAyB,qDAAqD,8FAA8F,eAAe,yBAAyB,qBAAqB,wCAAwC,+CAA+C,6CAA6C,oBAAoB,QAAQ,yDAAyD,eAAe,wDAAwD,wCAAwC,4CAA4C,0CAA0C,0CAA0C,kCAAkC,YAAY,sCAAsC,YAAY,mCAAmC,mCAAmC,IAAI,qFAAqF,YAAY,yCAAyC,2CAA2C,SAAS,uBAAuB,QAAQ,cAAc,eAAe,mCAAmC,YAAY,wEAAwE,QAAQ,gDAAgD,YAAY,kCAAkC,cAAc,KAAK,aAAa,kBAAkB,WAAW,mCAAmC,4BAA4B,mCAAmC,WAAW,2CAA2C,YAAY,gBAAgB,wCAAwC,oCAAoC,8BAA8B,+BAA+B,kCAAkC,+BAA+B,yBAAyB,wBAAwB,wBAAwB,IAAI,iDAAiD,eAAe,2CAA2C,cAAc,uDAAuD,EAAE,UAAU,oCAAoC,mCAAmC,iBAAiB,4BAA4B,yEAAyE,2DAA2D,oCAAoC,4BAA4B,+CAA+C,+BAA+B,aAAa,UAAU,kDAAkD,mCAAmC,iBAAiB,yBAAyB,mEAAmE,qCAAqC,8EAA8E,4CAA4C,oBAAoB,yBAAyB,sCAAsC,4BAA4B,aAAa,QAAQ,mJAAmJ,eAAe,6BAA6B,sHAAsH,mBAAmB,6HAA6H,iCAAiC,gBAAgB,uCAAuC,iBAAiB,cAAc,MAAM,mCAAmC,iDAAiD,YAAY,+CAA+C,qBAAqB,wFAAwF,GAAG,YAAY,oDAAoD,sBAAsB,+BAA+B,qEAAqE,oCAAoC,qDAAqD,2BAA2B,2BAA2B,wCAAwC,yBAAyB,mHAAmH,mDAAmD,iCAAiC,iBAAiB,mBAAmB,2DAA2D,0DAA0D,mDAAmD,mDAAmD,wCAAwC,mBAAmB,YAAY,4CAA4C,2BAA2B,2BAA2B,wCAAwC,2BAA2B,oEAAoE,eAAe,yBAAyB,4BAA4B,EAAE,qFAAqF,wBAAwB,6BAA6B,+CAA+C,yBAAyB,+BAA+B,uBAAuB,6BAA6B,uBAAuB,yCAAyC,0BAA0B,oBAAoB,4OAA4O,gFAAgF,iCAAiC,4CAA4C,oCAAoC,iCAAiC,qGAAqG,gDAAgD,0DAA0D,4DAA4D,gDAAgD,0BAA0B,MAAM,uCAAuC,MAAM,oDAAoD,MAAM,uDAAuD,MAAM,2BAA2B,yBAAyB,2BAA2B,+CAA+C,MAAM,2BAA2B,uDAAuD,MAAM,kCAAkC,SAAS,4DAA4D,MAAM,0EAA0E,iCAAiC,8UAA8U,MAAM,4XAA4X,YAAY,kHAAkH,aAAa,6EAA6E,0EAA0E,aAAa,gDAAgD,+DAA+D,2BAA2B,0EAA0E,kDAAkD,kOAAkO,wBAAwB,aAAa,MAAM,uEAAuE,WAAW,MAAM,0BAA0B,2JAA2J,YAAY,0DAA0D,kBAAkB,6BAA6B,2EAA2E,oDAAoD,yBAAyB,+EAA+E,kEAAkE,QAAQ,0FAA0F,UAAU,iBAAiB,yDAAyD,sCAAsC,iDAAiD,QAAQ,8HAA8H,mDAAmD,QAAQ,sHAAsH,GAAG,mFAAmF,oCAAoC,MAAM,wEAAwE,mCAAmC,MAAM,iEAAiE,gBAAgB,6FAA6F,GAAG,uEAAuE,kBAAkB,YAAY,kDAAkD,sDAAsD,iCAAiC,qDAAqD,SAAS,4CAA4C,oDAAoD,8CAA8C,eAAe,sCAAsC,SAAS,+BAA+B,qCAAqC,6BAA6B,iEAAiE,+CAA+C,6DAA6D,iCAAiC,EAAE,uBAAuB,8BAA8B,SAAS,6BAA6B,wCAAwC,mBAAmB,iCAAiC,kCAAkC,iCAAiC,eAAe,4BAA4B,aAAa,mCAAmC,qCAAqC,wDAAwD,EAAE,aAAa,sCAAsC,2DAA2D,eAAe,EAAE,uBAAuB,yDAAyD,cAAc,kCAAkC,0DAA0D,eAAe,kDAAkD,cAAc,yBAAyB,8DAA8D,eAAe,EAAE,uBAAuB,6BAA6B,cAAc,oCAAoC,qCAAqC,eAAe,iDAAiD,SAAS,8CAA8C,uBAAuB,qCAAqC,qCAAqC,eAAe,EAAE,8FAA8F,yGAAyG,cAAc,uCAAuC,kBAAkB,EAAE,qCAAqC,eAAe,EAAE,qBAAqB,wBAAwB,cAAc,6CAA6C,qBAAqB,kNAAkN,qEAAqE,WAAW,+GAA+G,iCAAiC,yBAAyB,UAAU,uEAAuE,KAAK,oDAAoD,8HAA8H,mCAAmC,gDAAgD,wCAAwC,6BAA6B,SAAS,gDAAgD,wGAAwG,0EAA0E,SAAS,0CAA0C,cAAc,4DAA4D,sDAAsD,SAAS,oCAAoC,uCAAuC,qCAAqC,qCAAqC,sCAAsC,iBAAiB,mEAAmE,oCAAoC,6BAA6B,uCAAuC,eAAe,mEAAmE,oDAAoD,8CAA8C,8NAA8N,kFAAkF,qFAAqF,8PAA8P,mFAAmF,0EAA0E,aAAa,qIAAqI,6IAA6I,uBAAuB,wCAAwC,6BAA6B,SAAS,wDAAwD,uCAAuC,wGAAwG,wCAAwC,wEAAwE,8DAA8D,eAAe,mHAAmH,aAAa,eAAe,EAAE,iEAAiE,0FAA0F,6IAA6I,oBAAoB,SAAS,6BAA6B,2CAA2C,+BAA+B,cAAc,mCAAmC,qDAAqD,0FAA0F,8DAA8D,SAAS,uGAAuG,wBAAwB,oFAAoF,yCAAyC,0FAA0F,0CAA0C,yBAAyB,gBAAgB,+DAA+D,2FAA2F,uCAAuC,oGAAoG,2DAA2D,mCAAmC,8EAA8E,cAAc,uBAAuB,qCAAqC,sDAAsD,iLAAiL,KAAK,2HAA2H,4IAA4I,SAAS,6EAA6E,kDAAkD,SAAS,yEAAyE,2HAA2H,8RAA8R,sMAAsM,2BAA2B,wBAAwB,2CAA2C,gCAAgC,sBAAsB,0CAA0C,qCAAqC,oCAAoC,iCAAiC,4LAA4L,6BAA6B,eAAe,kCAAkC,cAAc,wCAAwC,WAAW,4DAA4D,wDAAwD,WAAW,kCAAkC,0DAA0D,eAAe,oCAAoC,cAAc,6CAA6C,sCAAsC,yEAAyE,KAAK,SAAS,EAAE,yCAAyC,+DAA+D,YAAY,sDAAsD,wDAAwD,sBAAsB,4FAA4F,SAAS,EAAE,0FAA0F,+CAA+C,iHAAiH,0BAA0B,uCAAuC,6CAA6C,6CAA6C,mCAAmC,iBAAiB,8BAA8B,iCAAiC,+CAA+C,kDAAkD,2DAA2D,8DAA8D,sDAAsD,yDAAyD,kBAAkB,sCAAsC,6BAA6B,kCAAkC,kCAAkC,0CAA0C,wJAAwJ,+QAA+Q,eAAe,EAAE,0BAA0B,2CAA2C,cAAc,EAAE,4CAA4C,qCAAqC,8CAA8C,0DAA0D,gEAAgE,kFAAkF,EAAE,mBAAmB,kCAAkC,0CAA0C,uGAAuG,iCAAiC,EAAE,qBAAqB,mDAAmD,eAAe,oCAAoC,yCAAyC,qHAAqH,2CAA2C,6CAA6C,oKAAoK,6EAA6E,qEAAqE,kEAAkE,KAAK,0BAA0B,EAAE,gDAAgD,kLAAkL,8IAA8I,EAAE,yGAAyG,eAAe,sCAAsC,YAAY,gDAAgD,4EAA4E,+FAA+F,wDAAwD,SAAS,+EAA+E,mGAAmG,2CAA2C,kCAAkC,kBAAkB,EAAE,mFAAmF,WAAW,6CAA6C,4OAA4O,oBAAoB,0CAA0C,cAAc,yDAAyD,uMAAuM,SAAS,4CAA4C,qCAAqC,kGAAkG,iDAAiD,mCAAmC,wGAAwG,+BAA+B,6DAA6D,6IAA6I,iCAAiC,4BAA4B,8EAA8E,2CAA2C,4BAA4B,YAAY,+CAA+C,mDAAmD,mKAAmK,mFAAmF,sDAAsD,uEAAuE,kCAAkC,cAAc,+BAA+B,mGAAmG,4CAA4C,8BAA8B,sBAAsB,gGAAgG,8CAA8C,WAAW,wBAAwB,iDAAiD,SAAS,6BAA6B,sBAAsB,0EAA0E,2BAA2B,qCAAqC,uDAAuD,yBAAyB,8EAA8E,mCAAmC,6DAA6D,kCAAkC,SAAS,8MAA8M,WAAW,8CAA8C,WAAW,wDAAwD,0BAA0B,qOAAqO,oBAAoB,EAAE,qBAAqB,uFAAuF,cAAc,yBAAyB,2CAA2C,uBAAuB,+BAA+B,cAAc,kFAAkF,qEAAqE,SAAS,wCAAwC,gCAAgC,oBAAoB,8FAA8F,mBAAmB,sDAAsD,2DAA2D,6CAA6C,qBAAqB,gCAAgC,wCAAwC,gCAAgC,gCAAgC,iIAAiI,sBAAsB,4GAA4G,eAAe,mDAAmD,cAAc,qDAAqD,8CAA8C,4ZAA4Z,8CAA8C,oDAAoD,mGAAmG,yCAAyC,EAAE,4CAA4C,gDAAgD,8MAA8M,+BAA+B,kEAAkE,+EAA+E,yFAAyF,eAAe,+BAA+B,cAAc,mCAAmC,2CAA2C,mDAAmD,6BAA6B,aAAa,cAAc,8BAA8B,yDAAyD,gDAAgD,6RAA6R,4BAA4B,sDAAsD,0DAA0D,wBAAwB,wBAAwB,4BAA4B,0JAA0J,yBAAyB,sBAAsB,oDAAoD,yBAAyB,6IAA6I,yBAAyB,wFAAwF,yBAAyB,wFAAwF,6BAA6B,8FAA8F,8BAA8B,qCAAqC,0BAA0B,yBAAyB,4CAA4C,+LAA+L,wBAAwB,yBAAyB,0CAA0C,yBAAyB,wGAAwG,8IAA8I,eAAe,0BAA0B,4IAA4I,cAAc,wBAAwB,uCAAuC,8BAA8B,yHAAyH,sCAAsC,4FAA4F,yBAAyB,kBAAkB,cAAc,yBAAyB,aAAa,wBAAwB,6DAA6D,mgCAAmgC,2KAA2K,qlBAAqlB,qBAAqB,8jBAA8jB,iBAAiB,0BAA0B,s5CAAs5C,IAAI,+FAA+F,UAAU,cAAc,2BAA2B,YAAY,IAAI,4DAA4D,IAAI,uCAAuC,UAAU,uBAAuB,mcAAmc,aAAa,oBAAoB,SAAS,UAAU,gBAAgB,eAAe,wCAAwC,gDAAgD,YAAY,qDAAqD,IAAI,4DAA4D,SAAS,wBAAwB,OAAO,qDAAqD,oGAAoG,6DAA6D,mEAAmE,wLAAwL,gBAAgB,gDAAgD,iDAAiD,+GAA+G,iBAAiB,yFAAyF,+CAA+C,sJAAsJ,sFAAsF,yFAAyF,wCAAwC,6DAA6D,uDAAuD,mHAAmH,0FAA0F,4EAA4E,iFAAiF,mCAAmC,2DAA2D,gKAAgK,0CAA0C,0jCAA0jC,aAAa,sHAAsH,EAAE,GAAG,2EAA2E,uVAAuV,eAAe,6BAA6B,mCAAmC,EAAE,yIAAyI,uBAAuB,gEAAgE,iCAAiC,sDAAsD,2BAA2B,4BAA4B,oBAAoB,mDAAmD,sBAAsB,qEAAqE,6BAA6B,SAAS,4BAA4B,uBAAuB,KAAK,MAAM,iBAAiB,cAAc,qDAAqD,EAAE,2BAA2B,wCAAwC,qDAAqD,EAAE,6BAA6B,4BAA4B,gJAAgJ,wGAAwG,kBAAkB,m2DAAm2D,6BAA6B,4FAA4F,MAAM,sHAAsH,iCAAiC,+BAA+B,wEAAwE,yBAAyB,GAAG,iCAAiC,eAAe,UAAU,EAAE,eAAe,8BAA8B,4BAA4B,UAAU,EAAE,6CAA6C,EAAE,wCAAwC,iCAAiC,qEAAqE,iIAAiI,8IAA8I,mCAAmC,kBAAkB,eAAe,UAAU,4BAA4B,qBAAqB,iCAAiC,gBAAgB,eAAe,UAAU,kCAAkC,MAAM,UAAU,sCAAsC,4BAA4B,oBAAoB,8GAA8G,0BAA0B,6BAA6B,iBAAiB,oDAAoD,6BAA6B,qCAAqC,iCAAiC,4HAA4H,6BAA6B,4DAA4D,qDAAqD,cAAc,qCAAqC,iCAAiC,wCAAwC,qDAAqD,0BAA0B,6CAA6C,wGAAwG,GAAG,8GAA8G,wEAAwE,iBAAiB,oDAAoD,sEAAsE,+HAA+H,sBAAsB,6CAA6C,KAAK,oLAAoL,4HAA4H,6FAA6F,gBAAgB,sBAAsB,2BAA2B,wBAAwB,YAAY,6CAA6C,oEAAoE,MAAM,0DAA0D,MAAM,2BAA2B,0FAA0F,wBAAwB,EAAE,eAAe,gEAAgE,OAAO,8TAA8T,YAAY,wEAAwE,MAAM,2DAA2D,MAAM,4BAA4B,iBAAiB,oCAAoC,MAAM,qCAAqC,MAAM,oEAAoE,MAAM,2BAA2B,iBAAiB,oEAAoE,MAAM,2BAA2B,iBAAiB,qCAAqC,MAAM,sCAAsC,MAAM,+CAA+C,MAAM,2BAA2B,iBAAiB,oCAAoC,MAAM,qCAAqC,MAAM,oDAAoD,MAAM,2BAA2B,iBAAiB,oCAAoC,MAAM,4CAA4C,MAAM,0DAA0D,MAAM,2BAA2B,iBAAiB,gEAAgE,MAAM,wDAAwD,MAAM,6BAA6B,YAAY,iBAAiB,gCAAgC,2BAA2B,KAAK,KAAK,qDAAqD,+DAA+D,yBAAyB,UAAU,eAAe,4BAA4B,SAAS,uBAAuB,6BAA6B,mFAAmF,MAAM,2FAA2F,MAAM,2FAA2F,2XAA2X,EAAE,yLAAyL,8KAA8K,oDAAoD,wBAAwB,oEAAoE,uBAAuB,kDAAkD,SAAS,iBAAiB,kIAAkI,6BAA6B,yCAAyC,iCAAiC,6CAA6C,4VAA4V,wLAAwL,+OAA+O,mHAAmH,qFAAqF,+mBAA+mB,gFAAgF,0BAA0B,mCAAmC,wCAAwC,qJAAqJ,wBAAwB,0FAA0F,kCAAkC,4IAA4I,qBAAqB,gBAAgB,+NAA+N,sVAAsV,6EAA6E,OAAO,sDAAsD,8EAA8E,SAAS,qBAAqB,sBAAsB,oDAAoD,mBAAmB,IAAI,kBAAkB,kBAAkB,oBAAoB,mBAAmB,eAAe,4CAA4C,wBAAwB,gBAAgB,oBAAoB,wBAAwB,qBAAqB,+EAA+E,qBAAqB,oBAAoB,gEAAgE,sbAAsb,GAAG,mBAAmB,eAAe,0BAA0B,4BAA4B,sBAAsB,uCAAuC,uCAAuC,2CAA2C,YAAY,EAAE,oBAAoB,uFAAuF,yBAAyB,4BAA4B,2CAA2C,EAAE,wBAAwB,kBAAkB,sDAAsD,mOAAmO,GAAG,wBAAwB,mBAAmB,4BAA4B,qGAAqG,4BAA4B,OAAO,GAAG,uBAAuB,oBAAoB,4BAA4B,uEAAuE,qCAAqC,0QAA0Q,GAAG,8BAA8B,0NAA0N,wCAAwC,WAAW,4NAA4N,kCAAkC,gBAAgB,mQAAmQ,mCAAmC,4BAA4B,0FAA0F,yBAAyB,KAAK,6CAA6C,cAAc,sEAAsE,+fAA+f,8CAA8C,uDAAuD,2DAA2D,sDAAsD,2CAA2C,kDAAkD,sQAAsQ,mJAAmJ,0DAA0D,KAAK,sdAAsd,yBAAyB,2DAA2D,2DAA2D,sBAAsB,iEAAiE,IAAI,+BAA+B,wBAAwB,kBAAkB,oEAAoE,yGAAyG,GAAG,4BAA4B,sCAAsC,gKAAgK,KAAK,mBAAmB,oBAAoB,4BAA4B,oSAAoS,GAAG,mDAAmD,iCAAiC,oBAAoB,uDAAuD,qJAAqJ,kCAAkC,0CAA0C,cAAc,sCAAsC,4LAA4L,2CAA2C,WAAW,kHAAkH,6DAA6D,qCAAqC,iCAAiC,UAAU,MAAM,gEAAgE,EAAE,kBAAkB,8CAA8C,kBAAkB,yBAAyB,wBAAwB,+CAA+C,MAAM,+CAA+C,QAAQ,+BAA+B,MAAM,2BAA2B,iDAAiD,mJAAmJ,IAAI,kOAAkO,gBAAgB,IAAI,qBAAqB,kDAAkD,MAAM,4BAA4B,WAAW,sBAAsB,yQAAyQ,wBAAwB,iCAAiC,0JAA0J,WAAW,+EAA+E,wCAAwC,gdAAgd,sBAAsB,eAAe,2DAA2D,IAAI,mGAAmG,yBAAyB,SAAS,sBAAsB,eAAe,oCAAoC,EAAE,mCAAmC,IAAI,gBAAgB,6BAA6B,MAAM,gBAAgB,KAAK,4CAA4C,yEAAyE,KAAK,oCAAoC,GAAG,+BAA+B,UAAU,sCAAsC,4KAA4K,sBAAsB,IAAI,uGAAuG,uDAAuD,6CAA6C,qCAAqC,uCAAuC,iFAAiF,2BAA2B,cAAc,oEAAoE,2BAA2B,gCAAgC,yCAAyC,6BAA6B,WAAW,KAAK,6EAA6E,qIAAqI,4EAA4E,WAAW,sIAAsI,wLAAwL,wNAAwN,gBAAgB,wCAAwC,yLAAyL,0KAA0K,yCAAyC,4BAA4B,gCAAgC,4EAA4E,qCAAqC,sIAAsI,wBAAwB,6IAA6I,wCAAwC,WAAW,iDAAiD,gBAAgB,m5BAAm5B,oBAAoB,mKAAmK,+BAA+B,0EAA0E,uCAAuC,mBAAmB,2dAA2d,iCAAiC,gCAAgC,+EAA+E,4GAA4G,qGAAqG,gCAAgC,mIAAmI,MAAM,EAAE,QAAQ,qBAAqB,kBAAkB,iCAAiC,8BAA8B,4FAA4F,2JAA2J,UAAU,mDAAmD,WAAW,yUAAyU,8BAA8B,uDAAuD,wCAAwC,WAAW,gEAAgE,oBAAoB,+NAA+N,8BAA8B,yFAAyF,6KAA6K,0BAA0B,0BAA0B,8BAA8B,+CAA+C,iCAAiC,eAAe,gGAAgG,iGAAiG,kEAAkE,2DAA2D,iBAAiB,OAAO,oFAAoF,OAAO,gDAAgD,6BAA6B,+HAA+H,4WAA4W,oGAAoG,8IAA8I,oDAAoD,uMAAuM,uCAAuC,4gCAA4gC,2CAA2C,OAAO,yGAAyG,uIAAuI,2CAA2C,uHAAuH,iDAAiD,8IAA8I,2CAA2C,2DAA2D,uDAAuD,mCAAmC,8CAA8C,mCAAmC,aAAa,wIAAwI,+IAA+I,gCAAgC,iJAAiJ,8BAA8B,6CAA6C,8BAA8B,eAAe,oBAAoB,sHAAsH,uCAAuC,6CAA6C,2KAA2K,gDAAgD,4IAA4I,wBAAwB,0FAA0F,UAAU,gDAAgD,MAAM,oDAAoD,+CAA+C,wBAAwB,EAAE,mEAAmE,gCAAgC,EAAE,KAAK,8CAA8C,uDAAuD,iBAAiB,sDAAsD,oFAAoF,iCAAiC,sGAAsG,wBAAwB,gCAAgC,iCAAiC,UAAU,4CAA4C,SAAS,+BAA+B,OAAO,4YAA4Y,8BAA8B,KAAK,sCAAsC,4GAA4G,8BAA8B,0CAA0C,0aAA0a,eAAe,sCAAsC,KAAK,8BAA8B,yCAAyC,yCAAyC,sCAAsC,4OAA4O,2DAA2D,MAAM,EAAE,WAAW,IAAI,mBAAmB,iDAAiD,sBAAsB,8EAA8E,8BAA8B,2GAA2G,EAAE,wDAAwD,+IAA+I,6VAA6V,EAAE,aAAa,eAAe,qFAAqF,wCAAwC,uHAAuH,iPAAiP,wBAAwB,oGAAoG,scAAsc,QAAQ,+GAA+G,+BAA+B,2JAA2J,uCAAuC,yKAAyK,sBAAsB,qCAAqC,wHAAwH,mCAAmC,qCAAqC,sBAAsB,gHAAgH,GAAG,0BAA0B,wEAAwE,cAAc,mIAAmI,KAAK,0BAA0B,8FAA8F,SAAS,4mBAA4mB,8CAA8C,8DAA8D,GAAG,qEAAqE,WAAW,6CAA6C,YAAY,EAAE,mSAAmS,oFAAoF,8CAA8C,oFAAoF,+BAA+B,yFAAyF,EAAE,kCAAkC,IAAI,uBAAuB,uDAAuD,2DAA2D,oOAAoO,oEAAoE,6EAA6E,8UAA8U,gCAAgC,oGAAoG,yBAAyB,4BAA4B,wCAAwC,sEAAsE,sCAAsC,yDAAyD,0CAA0C,4BAA4B,iMAAiM,qBAAqB,sBAAsB,QAAQ,qBAAqB,cAAc,OAAO,gCAAgC,EAAE,6EAA6E,KAAK,MAAM,2BAA2B,oCAAoC,MAAM,gKAAgK,0YAA0Y,eAAe,WAAW,IAAI,qBAAqB,wBAAwB,qDAAqD,EAAE,6EAA6E,KAAK,iCAAiC,oCAAoC,MAAM,gEAAgE,kDAAkD,eAAe,eAAe,6BAA6B,OAAO,gBAAgB,MAAM,sBAAsB,MAAM,oFAAoF,MAAM,+CAA+C,MAAM,2CAA2C,uGAAuG,6HAA6H,6JAA6J,qRAAqR,YAAY,+BAA+B,YAAY,kCAAkC,yDAAyD,iBAAiB,+IAA+I,gBAAgB,4DAA4D,wBAAwB,iCAAiC,uCAAuC,2EAA2E,mEAAmE,gDAAgD,iEAAiE,4CAA4C,qEAAqE,mFAAmF,kDAAkD,YAAY,yGAAyG,2FAA2F,+LAA+L,iEAAiE,2HAA2H,gLAAgL,uOAAuO,gBAAgB,uNAAuN,SAAS,qEAAqE,QAAQ,cAAc,MAAM,EAAE,gCAAgC,yEAAyE,YAAY,wCAAwC,4HAA4H,KAAK,qBAAqB,iCAAiC,0FAA0F,oKAAoK,iGAAiG,WAAW,gGAAgG,MAAM,oEAAoE,MAAM,sEAAsE,MAAM,uEAAuE,MAAM,sEAAsE,YAAY,wCAAwC,gJAAgJ,uCAAuC,iGAAiG,6WAA6W,wCAAwC,gJAAgJ,uRAAuR,UAAU,2QAA2Q,sDAAsD,8EAA8E,+BAA+B,wEAAwE,+EAA+E,8EAA8E,+BAA+B,wEAAwE,2PAA2P,qBAAqB,qIAAqI,kCAAkC,+GAA+G,4BAA4B,qRAAqR,0BAA0B,2JAA2J,+BAA+B,sBAAsB,uHAAuH,4BAA4B,0CAA0C,0EAA0E,iCAAiC,gDAAgD,oBAAoB,+DAA+D,EAAE,gBAAgB,wBAAwB,wEAAwE,oHAAoH,MAAM,0EAA0E,MAAM,sDAAsD,MAAM,+CAA+C,mLAAmL,kFAAkF,mDAAmD,oJAAoJ,yFAAyF,wBAAwB,ufAAuf,yCAAyC,iFAAiF,aAAa,qTAAqT,6DAA6D,SAAS,62BAA62B,yCAAyC,sKAAsK,kFAAkF,0CAA0C,oCAAoC,wHAAwH,gCAAgC,EAAE,aAAa,qCAAqC,wDAAwD,iDAAiD,gdAAgd,gFAAgF,+DAA+D,mWAAmW,sDAAsD,uBAAuB,ubAAub,iCAAiC,gCAAgC,+JAA+J,2EAA2E,+BAA+B,OAAO,4DAA4D,sIAAsI,iCAAiC,EAAE,KAAK,6BAA6B,EAAE,0BAA0B,kBAAkB,kBAAkB,kBAAkB,oCAAoC,SAAS,kBAAkB,eAAe,sCAAsC,sEAAsE,UAAU,iBAAiB,gDAAgD,oCAAoC,OAAO,iEAAiE,cAAc,iBAAiB,qEAAqE,4KAA4K,gCAAgC,2EAA2E,+BAA+B,OAAO,KAAK,GAAG,0BAA0B,EAAE,iGAAiG,oFAAoF,uSAAuS,mIAAmI,0HAA0H,0CAA0C,mCAAmC,iUAAiU,kKAAkK,qDAAqD,OAAO,6BAA6B,sEAAsE,8EAA8E,mDAAmD,qCAAqC,kBAAkB,mCAAmC,UAAU,KAAK,oDAAoD,sDAAsD,EAAE,uBAAuB,gDAAgD,oDAAoD,EAAE,qBAAqB,gDAAgD,2JAA2J,mBAAmB,EAAE,aAAa,eAAe,qFAAqF,wCAAwC,uHAAuH,igBAAigB,2BAA2B,4FAA4F,2kBAA2kB,QAAQ,YAAY,EAAE,oDAAoD,8BAA8B,2CAA2C,oDAAoD,8DAA8D,UAAU,qHAAqH,2BAA2B,4CAA4C,0CAA0C,+GAA+G,+EAA+E,sGAAsG,iCAAiC,iBAAiB,sIAAsI,2BAA2B,mBAAmB,yCAAyC,OAAO,8BAA8B,wBAAwB,4DAA4D,uBAAuB,0BAA0B,sBAAsB,gRAAgR,mBAAmB,gUAAgU,+BAA+B,mBAAmB,kIAAkI,MAAM,kCAAkC,8BAA8B,0EAA0E,EAAE,0LAA0L,kMAAkM,MAAM,cAAc,iCAAiC,2HAA2H,+JAA+J,iCAAiC,wBAAwB,gPAAgP,4CAA4C,wBAAwB,qLAAqL,kCAAkC,yCAAyC,uIAAuI,0GAA0G,8BAA8B,6CAA6C,4GAA4G,yFAAyF,gIAAgI,MAAM,gDAAgD,gFAAgF,iHAAiH,yCAAyC,MAAM,OAAO,6DAA6D,2EAA2E,yDAAyD,WAAW,sEAAsE,wCAAwC,4BAA4B,MAAM,wDAAwD,KAAK,iHAAiH,oEAAoE,4BAA4B,YAAY,2CAA2C,uDAAuD,qBAAqB,6BAA6B,kIAAkI,wBAAwB,4IAA4I,EAAE,wBAAwB,gCAAgC,sDAAsD,8JAA8J,8DAA8D,uCAAuC,oBAAoB,GAAG,kDAAkD,+CAA+C,kCAAkC,kIAAkI,kDAAkD,4CAA4C,kCAAkC,gFAAgF,6BAA6B,+NAA+N,UAAU,uKAAuK,UAAU,oCAAoC,qCAAqC,iNAAiN,gBAAgB,0HAA0H,sDAAsD,oCAAoC,8JAA8J,4BAA4B,6DAA6D,KAAK,6CAA6C,qGAAqG,6HAA6H,UAAU,mDAAmD,SAAS,6CAA6C,qCAAqC,wGAAwG,OAAO,qEAAqE,sCAAsC,mDAAmD,SAAS,0HAA0H,yDAAyD,wCAAwC,8BAA8B,8CAA8C,+UAA+U,uCAAuC,8BAA8B,yMAAyM,gQAAgQ,qCAAqC,mDAAmD,6SAA6S,4FAA4F,sBAAsB,mBAAmB,6BAA6B,2BAA2B,2RAA2R,uBAAuB,6LAA6L,0dAA0d,6BAA6B,wEAAwE,qCAAqC,+IAA+I,iCAAiC,uEAAuE,uCAAuC,sFAAsF,eAAe,kKAAkK,uCAAuC,GAAG,oBAAoB,KAAK,EAAE,MAAM,8BAA8B,WAAW,IAAI,MAAM,eAAe,wOAAwO,uCAAuC,mCAAmC,MAAM,8BAA8B,WAAW,IAAI,MAAM,0DAA0D,MAAM,eAAe,oDAAoD,qCAAqC,2BAA2B,uQAAuQ,yCAAyC,4DAA4D,oCAAoC,yLAAyL,4BAA4B,+DAA+D,MAAM,8BAA8B,WAAW,IAAI,2BAA2B,EAAE,mUAAmU,MAAM,8BAA8B,WAAW,IAAI,MAAM,0DAA0D,MAAM,eAAe,8HAA8H,wDAAwD,OAAO,0EAA0E,YAAY,EAAE,+EAA+E,YAAY,EAAE,mFAAmF,YAAY,EAAE,gHAAgH,YAAY,EAAE,0CAA0C,iCAAiC,qCAAqC,wGAAwG,+DAA+D,YAAY,mKAAmK,oBAAoB,8DAA8D,OAAO,iCAAiC,OAAO,kCAAkC,OAAO,8HAA8H,qBAAqB,iCAAiC,OAAO,gEAAgE,qBAAqB,8FAA8F,qBAAqB,kCAAkC,qBAAqB,oCAAoC,qBAAqB,iCAAiC,qBAAqB,+DAA+D,qBAAqB,gCAAgC,OAAO,0GAA0G,+BAA+B,2CAA2C,6CAA6C,wBAAwB,GAAG,yHAAyH,mDAAmD,2GAA2G,kCAAkC,MAAM,6CAA6C,YAAY,sBAAsB,mCAAmC,MAAM,sBAAsB,eAAe,OAAO,sBAAsB,qCAAqC,yCAAyC,WAAW,+BAA+B,oBAAoB,8CAA8C,6CAA6C,SAAS,aAAa,gBAAgB,8CAA8C,4EAA4E,SAAS,aAAa,kCAAkC,oCAAoC,aAAa,OAAO,iBAAiB,+CAA+C,oBAAoB,sCAAsC,qHAAqH,6DAA6D,sBAAsB,8EAA8E,mBAAmB,oFAAoF,qEAAqE,iFAAiF,qEAAqE,gOAAgO,2BAA2B,4CAA4C,gBAAgB,wBAAwB,sBAAsB,0FAA0F,yDAAyD,kBAAkB,qIAAqI,mKAAmK,+BAA+B,iCAAiC,4CAA4C,eAAe,uLAAuL,uCAAuC,kBAAkB,kEAAkE,oBAAoB,eAAe,EAAE,iEAAiE,KAAK,4BAA4B,gOAAgO,sJAAsJ,sEAAsE,gDAAgD,uDAAuD,6CAA6C,qDAAqD,yCAAyC,iIAAiI,sDAAsD,wGAAwG,KAAK,aAAa,sBAAsB,0BAA0B,gCAAgC,yBAAyB,yBAAyB,+BAA+B,wBAAwB,0BAA0B,mEAAmE,6BAA6B,0CAA0C,0BAA0B,cAAc,wEAAwE,UAAU,0OAA0O,iNAAiN,iCAAiC,GAAG,oDAAoD,qEAAqE,gCAAgC,mEAAmE,gCAAgC,+BAA+B,qCAAqC,gCAAgC,iCAAiC,4BAA4B,iCAAiC,4BAA4B,cAAc,qEAAqE,iCAAiC,iBAAiB,IAAI,uCAAuC,OAAO,8CAA8C,MAAM,yIAAyI,2GAA2G,WAAW,8CAA8C,6BAA6B,oBAAoB,sHAAsH,OAAO,wCAAwC,KAAK,0BAA0B,8DAA8D,iCAAiC,uCAAuC,wBAAwB,yDAAyD,6BAA6B,mCAAmC,iFAAiF,gEAAgE,oMAAoM,mBAAmB,MAAM,wBAAwB,KAAK,uBAAuB,6BAA6B,QAAQ,uBAAuB,kEAAkE,+KAA+K,yHAAyH,yBAAyB,kDAAkD,wCAAwC,iDAAiD,mBAAmB,MAAM,YAAY,6BAA6B,GAAG,6DAA6D,EAAE,2iBAA2iB,wEAAwE,eAAe,wBAAwB,eAAe,OAAO,kBAAkB,iBAAiB,kBAAkB,gBAAgB,qBAAqB,yBAAyB,mCAAmC,uBAAuB,iBAAiB,oaAAoa,YAAY,sBAAsB,sBAAsB,2BAA2B,qTAAqT,4LAA4L,UAAU,oBAAoB,iBAAiB,sCAAsC,iFAAiF,+BAA+B,mBAAmB,aAAa,EAAE,uBAAuB,0BAA0B,6BAA6B,4EAA4E,2BAA2B,kEAAkE,qBAAqB,2CAA2C,wBAAwB,wCAAwC,kBAAkB,+BAA+B,kBAAkB,mDAAmD,6BAA6B,0CAA0C,+BAA+B,aAAa,oBAAoB,4EAA4E,4CAA4C,uBAAuB,8BAA8B,aAAa,2BAA2B,gCAAgC,YAAY,sDAAsD,qDAAqD,qCAAqC,2BAA2B,sEAAsE,iCAAiC,OAAO,2CAA2C,iCAAiC,OAAO,4DAA4D,iCAAiC,iBAAiB,iCAAiC,qBAAqB,8GAA8G,qCAAqC,wCAAwC,oCAAoC,wCAAwC,oCAAoC,wCAAwC,oCAAoC,wCAAwC,oCAAoC,wCAAwC,oCAAoC,2BAA2B,oCAAoC,wCAAwC,oCAAoC,8CAA8C,oCAAoC,EAAE,gCAAgC,0BAA0B,mCAAmC,EAAE,kCAAkC,MAAM,yBAAyB,sCAAsC,mJAAmJ,kBAAkB,0LAA0L,+WAA+W,uCAAuC,MAAM,uCAAuC,MAAM,sDAAsD,qDAAqD,EAAE,yCAAyC,kCAAkC,wDAAwD,MAAM,uDAAuD,iBAAiB,GAAG,sJAAsJ,iHAAiH,2DAA2D,iDAAiD,oBAAoB,qDAAqD,6EAA6E,cAAc,gBAAgB,mCAAmC,0CAA0C,wBAAwB,iEAAiE,iDAAiD,8CAA8C,8BAA8B,EAAE,mCAAmC,gEAAgE,eAAe,GAAG,wBAAwB,kaAAka,+CAA+C,mCAAmC,MAAM,2BAA2B,yCAAyC,gBAAgB,wCAAwC,gBAAgB,yBAAyB,gCAAgC,mCAAmC,qCAAqC,EAAE,2BAA2B,mDAAmD,EAAE,mEAAmE,iDAAiD,qGAAqG,4NAA4N,0CAA0C,gDAAgD,8JAA8J,yCAAyC,gDAAgD,4JAA4J,YAAY,qDAAqD,YAAY,qCAAqC,UAAU,WAAW,qDAAqD,MAAM,oCAAoC,MAAM,8BAA8B,OAAO,yEAAyE,+BAA+B,6BAA6B,0BAA0B,2BAA2B,0BAA0B,4BAA4B,yBAAyB,yBAAyB,gCAAgC,+BAA+B,wFAAwF,4HAA4H,mDAAmD,iBAAiB,8QAA8Q,wFAAwF,sIAAsI,yFAAyF,4LAA4L,aAAa,EAAE,+DAA+D,oCAAoC,qBAAqB,qEAAqE,qDAAqD,qEAAqE,kFAAkF,yCAAyC,2DAA2D,sBAAsB,+BAA+B,uKAAuK,yBAAyB,2DAA2D,sBAAsB,2EAA2E,8EAA8E,qCAAqC,2BAA2B,YAAY,qBAAqB,aAAa,yCAAyC,kEAAkE,mBAAmB,sBAAsB,EAAE,MAAM,yBAAyB,MAAM,yBAAyB,MAAM,yBAAyB,MAAM,yBAAyB,MAAM,yBAAyB,MAAM,yBAAyB,gCAAgC,+BAA+B,iDAAiD,mBAAmB,oCAAoC,EAAE,MAAM,uEAAuE,uCAAuC,sEAAsE,wCAAwC,MAAM,yCAAyC,kEAAkE,mBAAmB,sBAAsB,kBAAkB,MAAM,oDAAoD,+BAA+B,mEAAmE,mBAAmB,sBAAsB,qCAAqC,MAAM,+BAA+B,MAAM,uBAAuB,MAAM,gBAAgB,mCAAmC,OAAO,mDAAmD,sCAAsC,qGAAqG,gCAAgC,8EAA8E,kCAAkC,mFAAmF,KAAK,yCAAyC,6BAA6B,+BAA+B,KAAK,oBAAoB,EAAE,KAAK,wBAAwB,qCAAqC,uCAAuC,+BAA+B,yDAAyD,GAAG,wHAAwH,kBAAkB,oCAAoC,iBAAiB,4HAA4H,oBAAoB,2CAA2C,0CAA0C,yCAAyC,iIAAiI,wHAAwH,oCAAoC,sBAAsB,2CAA2C,+BAA+B,iDAAiD,mBAAmB,oCAAoC,EAAE,uEAAuE,gBAAgB,oBAAoB,wBAAwB,gEAAgE,iDAAiD,mBAAmB,6BAA6B,iCAAiC,iDAAiD,mBAAmB,6CAA6C,6BAA6B,iDAAiD,kDAAkD,iDAAiD,GAAG,wGAAwG,KAAK,gBAAgB,4BAA4B,yCAAyC,4EAA4E,mBAAmB,2CAA2C,mEAAmE,4BAA4B,oBAAoB,wGAAwG,uBAAuB,wJAAwJ,oDAAoD,iDAAiD,yDAAyD,6DAA6D,GAAG,YAAY,0CAA0C,2BAA2B,aAAa,gQAAgQ,KAAK,oBAAoB,6FAA6F,SAAS,SAAS,iBAAiB,SAAS,UAAU,iBAAiB,iBAAiB,yDAAyD,MAAM,SAAS,2BAA2B,8CAA8C,iDAAiD,+BAA+B,8BAA8B,EAAE,KAAK,yDAAyD,uCAAuC,IAAI,8BAA8B,WAAW,qCAAqC,oEAAoE,EAAE,OAAO,iEAAiE,kCAAkC,6DAA6D,4BAA4B,0CAA0C,uBAAuB,oBAAoB,UAAU,+CAA+C,wBAAwB,0BAA0B,gGAAgG,8MAA8M,qBAAqB,SAAS,8CAA8C,2EAA2E,yDAAyD,yCAAyC,wCAAwC,EAAE,qBAAqB,yCAAyC,0EAA0E,GAAG,yLAAyL,8CAA8C,iHAAiH,4CAA4C,0FAA0F,gLAAgL,8CAA8C,yDAAyD,EAAE,SAAS,kBAAkB,gBAAgB,kBAAkB,sCAAsC,4BAA4B,oBAAoB,mDAAmD,sBAAsB,qEAAqE,uBAAuB,SAAS,iFAAiF,QAAQ,qFAAqF,cAAc,uFAAuF,MAAM,uBAAuB,kEAAkE,s0BAAs0B,aAAa,EAAE,uIAAuI,8CAA8C,8DAA8D,yIAAyI,mBAAmB,SAAS,8CAA8C,8DAA8D,uHAAuH,gDAAgD,kEAAkE,uHAAuH,uDAAuD,8DAA8D,uHAAuH,qDAAqD,oEAAoE,uHAAuH,yDAAyD,wDAAwD,8HAA8H,mBAAmB,SAAS,EAAE,mJAAmJ,8EAA8E,oEAAoE,iCAAiC,gEAAgE,mBAAmB,uCAAuC,iCAAiC,iDAAiD,mBAAmB,wDAAwD,2BAA2B,+GAA+G,mCAAmC,0DAA0D,0EAA0E,uJAAuJ,MAAM,eAAe,oDAAoD,iDAAiD,oEAAoE,qBAAqB,6CAA6C,EAAE,qTAAqT,6EAA6E,eAAe,qCAAqC,qBAAqB,EAAE,wXAAwX,EAAE,8CAA8C,EAAE,mEAAmE,EAAE,6OAA6O,EAAE,uBAAuB,EAAE,aAAa,EAAE,aAAa,EAAE,mBAAmB,EAAE,uBAAuB,EAAE,oBAAoB,EAAE,kCAAkC,EAAE,sBAAsB,EAAE,yBAAyB,EAAE,6DAA6D,aAAa,aAAa,EAAE,+CAA+C,EAAE,sGAAsG,EAAE,2FAA2F,EAAE,mDAAmD,EAAE,uhBAAuhB,EAAE,oDAAoD,EAAE,mBAAmB,EAAE,0PAA0P,EAAE,kBAAkB,EAAE,6DAA6D,EAAE,0DAA0D,EAAE,+CAA+C,EAAE,EAAE,EAAE,iCAAiC,WAAW,kEAAkE,EAAE,qDAAqD,EAAE,6CAA6C,EAAE,qNAAqN,EAAE,gGAAgG,kFAAkF,EAAE,0CAA0C,EAAE,qDAAqD,EAAE,uGAAuG,EAAE,kBAAkB,EAAE,uPAAuP,EAAE,uKAAuK,EAAE,UAAU,EAAE,oBAAoB,EAAE,MAAM,EAAE,qOAAqO,EAAE,wDAAwD,EAAE,cAAc,EAAE,mCAAmC,EAAE,gCAAgC,EAAE,qEAAqE,EAAE,oBAAoB,EAAE,yJAAyJ,EAAE,4CAA4C,EAAE,mEAAmE,EAAE,wGAAwG,EAAE,kHAAkH,EAAE,wBAAwB,EAAE,8RAA8R,EAAE,8iBAA8iB,EAAE,+IAA+I,EAAE,oDAAoD,EAAE,2CAA2C,EAAE,gEAAgE,EAAE,sBAAsB,EAAE,GAAG,EAAE,mCAAmC,EAAE,UAAU,EAAE,wDAAwD,EAAE,iFAAiF,EAAE,+CAA+C,EAAE,kVAAkV,EAAE,0GAA0G,EAAE,uIAAuI,EAAE,qLAAqL,EAAE,iBAAiB,EAAE,iGAAiG,EAAE,qKAAqK,EAAE,qCAAqC,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,4DAA4D,EAAE,MAAM,EAAE,yBAAyB,EAAE,qOAAqO,EAAE,kBAAkB,EAAE,8EAA8E,EAAE,oBAAoB,EAAE,cAAc,EAAE,6BAA6B,EAAE,kFAAkF,EAAE,0BAA0B,EAAE,mBAAmB,EAAE,+CAA+C,EAAE,yDAAyD,EAAE,mCAAmC,EAAE,aAAa,EAAE,gVAAgV,EAAE,sSAAsS,EAAE,uBAAuB,EAAE,iBAAiB,EAAE,oDAAoD,EAAE,iBAAiB,EAAE,8DAA8D,EAAE,mIAAmI,OAAO,iHAAiH,iBAAiB,oBAAoB,gBAAgB,mCAAmC,sBAAsB,qBAAqB,sCAAsC,wBAAwB,qBAAqB,kCAAkC,oBAAoB,qBAAqB,EAAE,EAAE,iDAAiD,uEAAuE,eAAe,qBAAqB,eAAe,sDAAsD,eAAe,2BAA2B,sCAAsC,uBAAuB,oCAAoC,kBAAkB,yCAAyC,iCAAiC,sCAAsC,0DAA0D,+TAA+T,0BAA0B,GAAG,4EAA4E,eAAe,cAAc,WAAW,yPAAyP,WAAW,oPAAoP,eAAe,sNAAsN,WAAW,mCAAmC,cAAc,sNAAsN,mBAAmB,iFAAiF,+OAA+O,kDAAkD,kBAAkB,wEAAwE,uBAAuB,sBAAsB,GAAG,wEAAwE,eAAe,q1BAAq1B,GAAG,0EAA0E,eAAe,iEAAiE,2DAA2D,yBAAyB,UAAU,qNAAqN,4BAA4B,6BAA6B,0BAA0B,gDAAgD,EAAE,2BAA2B,0BAA0B,gDAAgD,EAAE,iCAAiC,uEAAuE,sDAAsD,EAAE,2BAA2B,0EAA0E,wCAAwC,2NAA2N,wBAAwB,kCAAkC,gDAAgD,MAAM,EAAE,wCAAwC,6FAA6F,uGAAuG,2CAA2C,oBAAoB,8BAA8B,+BAA+B,KAAK,KAAK,6CAA6C,8CAA8C,+CAA+C,+BAA+B,KAAK,KAAK,2BAA2B,4EAA4E,qCAAqC,SAAS,4CAA4C,4LAA4L,qBAAqB,KAAK,6BAA6B,2PAA2P,+CAA+C,+HAA+H,4BAA4B,4DAA4D,gMAAgM,qHAAqH,gDAAgD,2DAA2D,wCAAwC,oBAAoB,6FAA6F,yGAAyG,mBAAmB,uDAAuD,kCAAkC,EAAE,mBAAmB,4BAA4B,0CAA0C,0BAA0B,EAAE,kCAAkC,8EAA8E,sBAAsB,2BAA2B,2KAA2K,oBAAoB,kYAAkY,sHAAsH,2BAA2B,KAAK,iHAAiH,cAAc,wCAAwC,gEAAgE,mCAAmC,sBAAsB,oBAAoB,2GAA2G,mHAAmH,+BAA+B,2DAA2D,8FAA8F,iCAAiC,2EAA2E,0HAA0H,wDAAwD,0TAA0T,iJAAiJ,uEAAuE,iKAAiK,iCAAiC,iDAAiD,oCAAoC,6BAA6B,KAAK,0CAA0C,wPAAwP,8CAA8C,GAAG,kEAAkE,yDAAyD,gGAAgG,0CAA0C,QAAQ,oBAAoB,KAAK,+BAA+B,sIAAsI,kBAAkB,yNAAyN,yIAAyI,+DAA+D,sBAAsB,yCAAyC,8CAA8C,+DAA+D,2IAA2I,uKAAuK,kDAAkD,kFAAkF,4CAA4C,+GAA+G,2BAA2B,+CAA+C,qFAAqF,uGAAuG,0DAA0D,4JAA4J,GAAG,oCAAoC,+CAA+C,oHAAoH,8BAA8B,gDAAgD,uEAAuE,iCAAiC,0DAA0D,uBAAuB,eAAe,yBAAyB,qCAAqC,+BAA+B,qCAAqC,2DAA2D,iCAAiC,8CAA8C,wDAAwD,+EAA+E,KAAK,YAAY,qBAAqB,KAAK,yBAAyB,2BAA2B,0JAA0J,wBAAwB,uCAAuC,kCAAkC,mCAAmC,+MAA+M,0DAA0D,6DAA6D,4OAA4O,4CAA4C,8GAA8G,gOAAgO,KAAK,yEAAyE,oJAAoJ,mBAAmB,8VAA8V,QAAQ,sCAAsC,qMAAqM,KAAK,KAAK,2BAA2B,iKAAiK,sDAAsD,uEAAuE,YAAY,mCAAmC,+BAA+B,KAAK,KAAK,2BAA2B,kDAAkD,qDAAqD,SAAS,iCAAiC,kDAAkD,yCAAyC,mCAAmC,4GAA4G,QAAQ,oBAAoB,wCAAwC,+BAA+B,+CAA+C,qJAAqJ,oCAAoC,6QAA6Q,oCAAoC,6FAA6F,kCAAkC,sFAAsF,yCAAyC,mCAAmC,0EAA0E,wCAAwC,qBAAqB,gRAAgR,yBAAyB,4BAA4B,EAAE,mHAAmH,0EAA0E,eAAe,kDAAkD,SAAS,qBAAqB,8GAA8G,kBAAkB,uBAAuB,kBAAkB,iDAAiD,wBAAwB,qJAAqJ,kBAAkB,aAAa,8BAA8B,eAAe,gCAAgC,kBAAkB,gFAAgF,qBAAqB,+EAA+E,oBAAoB,EAAE,+DAA+D,0EAA0E,eAAe,kCAAkC,wCAAwC,8EAA8E,yDAAyD,EAAE,0CAA0C,oFAAoF,mDAAmD,EAAE,0CAA0C,+IAA+I,mDAAmD,EAAE,sCAAsC,iDAAiD,6SAA6S,kCAAkC,GAAG,sCAAsC,oDAAoD,oDAAoD,wEAAwE,oDAAoD,iDAAiD,oDAAoD,EAAE,sCAAsC,sEAAsE,4EAA4E,kCAAkC,EAAE,GAAG,GAAG,yEAAyE,eAAe,sBAAsB,oBAAoB,0BAA0B,GAAG,qUAAqU,IAAI,QAAQ,IAAI,8EAA8E,kBAAkB,ihMAAihM,gBAAgB,2DAA2D,iBAAiB,0DAA0D,sBAAsB,sBAAsB,gBAAgB,wGAAwG,eAAe,gNAAgN,qBAAqB,2FAA2F,kBAAkB,wDAAwD,gBAAgB,iNAAiN,gBAAgB,uOAAuO,kBAAkB,sMAAsM,gBAAgB,wLAAwL,cAAc,+LAA+L,eAAe,+CAA+C,iBAAiB,eAAe,mBAAmB,2cAA2c,sBAAsB,gaAAga,cAAc,0BAA0B,gBAAgB,yLAAyL,kBAAkB,4NAA4N,GAAG,EAAE,GAAG,2CAA2C,wLAAwL,eAAe,yBAAyB,4CAA4C,0SAA0S,MAAM,iVAAiV,EAAE,gDAAgD,EAAE,mFAAmF,iEAAiE,iDAAiD,kCAAkC,uBAAuB,uJAAuJ,wDAAwD,yCAAyC,0FAA0F,8BAA8B,IAAI,eAAe,QAAQ,SAAS,kBAAkB,SAAS,0BAA0B,8BAA8B,2FAA2F,wEAAwE,8CAA8C,8CAA8C,iBAAiB,KAAK,qBAAqB,UAAU,mCAAmC,gCAAgC,+CAA+C,0EAA0E,4CAA4C,mDAAmD,KAAK,yCAAyC,yFAAyF,EAAE,8CAA8C,EAAE,qDAAqD,aAAa,8EAA8E,GAAG,uCAAuC,kCAAkC,kFAAkF,kBAAkB,wCAAwC,IAAI,mDAAmD,wBAAwB,mBAAmB,sBAAsB,0FAA0F,iEAAiE,gBAAgB,+GAA+G,kDAAkD,0BAA0B,iEAAiE,2CAA2C,8DAA8D,iHAAiH,EAAE,ySAAyS,2VAA2V,sBAAsB,iBAAiB,qBAAqB,0BAA0B,+MAA+M,IAAI,wCAAwC,mDAAmD,iKAAiK,sDAAsD,uBAAuB,sIAAsI,6FAA6F,kDAAkD,KAAK,+JAA+J,qCAAqC,YAAY,0CAA0C,8CAA8C,IAAI,uCAAuC,2FAA2F,+CAA+C,MAAM,0BAA0B,gBAAgB,4CAA4C,yCAAyC,EAAE,qFAAqF,mEAAmE,wJAAwJ,6DAA6D,KAAK,WAAW,6CAA6C,0DAA0D,wKAAwK,yFAAyF,YAAY,SAAS,4DAA4D,cAAc,gEAAgE,mKAAmK,yFAAyF,YAAY,SAAS,kFAAkF,cAAc,8DAA8D,mJAAmJ,yFAAyF,YAAY,SAAS,6DAA6D,SAAS,4DAA4D,mJAAmJ,yFAAyF,YAAY,SAAS,4DAA4D,SAAS,gEAAgE,gIAAgI,yFAAyF,qGAAqG,eAAe,2CAA2C,WAAW,EAAE,cAAc,iBAAiB,MAAM,oFAAoF,KAAK,SAAS,iEAAiE,cAAc,0EAA0E,gIAAgI,yFAAyF,0GAA0G,sBAAsB,2CAA2C,WAAW,EAAE,cAAc,iBAAiB,MAAM,mFAAmF,gEAAgE,WAAW,cAAc,6FAA6F,kHAAkH,oBAAoB,QAAQ,kFAAkF,SAAS,4CAA4C,SAAS,0GAA0G,kHAAkH,oBAAoB,eAAe,4FAA4F,KAAK,4CAA4C,SAAS,iEAAiE,6FAA6F,oCAAoC,gFAAgF,0DAA0D,oHAAoH,0BAA0B,6BAA6B,eAAe,8BAA8B,oBAAoB,+BAA+B,mCAAmC,8EAA8E,+HAA+H,sDAAsD,4EAA4E,2BAA2B,kBAAkB,gBAAgB,yDAAyD,OAAO,gBAAgB,YAAY,aAAa,iCAAiC,0KAA0K,8CAA8C,WAAW,yCAAyC,KAAK,8GAA8G,sBAAsB,oEAAoE,+EAA+E,0BAA0B,yDAAyD,mHAAmH,4GAA4G,mDAAmD,iPAAiP,2DAA2D,2HAA2H,+IAA+I,8BAA8B,sEAAsE,kBAAkB,oHAAoH,+BAA+B,wHAAwH,uCAAuC,KAAK,uEAAuE,8IAA8I,eAAe,8EAA8E,sHAAsH,cAAc,6CAA6C,cAAc,iDAAiD,cAAc,EAAE,IAAI,0BAA0B,EAAE,iBAAiB,qCAAqC,wBAAwB,+DAA+D,gBAAgB,wEAAwE,cAAc,+CAA+C,SAAS,+CAA+C,SAAS,6DAA6D,+CAA+C,kBAAkB,kBAAkB,aAAa,gBAAgB,kCAAkC,uCAAuC,gBAAgB,6LAA6L,eAAe,cAAc,mBAAmB,6BAA6B,qIAAqI,YAAY,0DAA0D,iDAAiD,KAAK,KAAK,0BAA0B,2CAA2C,aAAa,+BAA+B,2BAA2B,EAAE,8DAA8D,sCAAsC,kBAAkB,iFAAiF,iCAAiC,6EAA6E,yBAAyB,oEAAoE,kBAAkB,EAAE,E;;;;;;;;;ACDpkjO;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,oBAAoB,SAAS;AAC7B;AACA;AACA;;AAEA;AACA;;AAEA;;;;;;;;;;;;;;;;;AC5B6B;AACd;AACA;AACa;;AAE5B;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,+GAAgE,gCAAgC;AAChG;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;;AAEQ;;;;;;;;;;;;;;;;;;;;AC9DmB;AACT;AACQ;AACX;AACS;AACI;AACP;;AAErB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,mBAAmB,+BAA+B;AAClD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,2EAA4B;AAC/C,mGAAoD;AACpD;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL,KAAK;AACL;AACA;;AAEQ;;;;;;;;;;;;;;;;;;;;;AChHmB;AACT;AACH;AACA;AACS;AACkB;AACZ;AACT;;AAErB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,mCAAmC;AACnC,kCAAkC;AAClC,iCAAiC;;AAEjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,qBAAqB;AACrB;AACA;;AAEA;AACA,qBAAqB;AACrB;AACA;;AAEA;AACA,qBAAqB;AACrB;AACA;;AAEA;AACA,qBAAqB;AACrB;AACA;;AAEA;AACA,qBAAqB;AACrB;AACA;;AAEA;AACA,qBAAqB;AACrB;AACA;;AAEA;AACA,qBAAqB;AACrB;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,kBAAkB;;AAElB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,oGAAkC;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,mBAAmB,+BAA+B;AAClD;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEQ;;;;;;;;;;ACxzBR;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA,mCAAmC;AACnC;AACA,KAAK,OAAO;AACZ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4DAA4D;AAC5D,0DAA0D,gBAAgB;AAC1E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iFAAiF,GAAG,yBAAyB;AAC7G;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,CAAC;AACD;AACA;AACA,GAAG;AAAA;AACH;;;;;;;;;;;AC3LA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,sBAAsB,IAAI;AAC1B,8BAA8B;AAC9B;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;;;;;;;;;ACnDA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,SAAS;AACT;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,YAAY,OAAO;AACnB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,kBAAkB;AACrC;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;;;;;;;;;AC5HA;;AAEA,iEAAiE;;AAEjE;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,SAAS;AACpB,WAAW,OAAO;AAClB,WAAW,QAAQ;AACnB;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,GAAG;;AAEH;AACA;;;;;;;;;;AC7DA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;;;;;;;;;ACvBA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,QAAQ;AACnB;AACA,WAAW,OAAO;AAClB,WAAW,QAAQ;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B,YAAY;AACzC;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,2CAA2C;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,kBAAkB,KAAK;;AAEvB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA;AACA,KAAK;AACL;;AAEA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;;;AAGA;AACA;AACA,mCAAmC,OAAO;AAC1C;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;;AAEA;AACA;;AAEA,iBAAiB,kBAAkB;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX,SAAS;AACT;AACA;AACA,WAAW;AACX;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;;;;;;;;;AC9XA;AACA;AACA,UACA;AACA,CAAC,qBAAqB;;AAEtB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,4DAA4D;;AAE5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,YAAY,OAAO;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,CAAC;;;;;;;;;;;ACnYD;AACA;AACA;AACA;AACA;AACA,eAAe,SAAS;AACxB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;;;;;;;;;ACtBA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,iCAAiC;;AAEjC;AACA;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;AACA;;AAEA;AACA,sBAAsB,QAAQ;AAC9B;AACA;AACA;;AAEA;AACA;AACA;;;;;;;;;;;;;;;;;AC/BA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACgB;;AAEhB;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,yEAAyE;AACzE;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,C;;;;;;;;;ACzCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,2BAA2E,eAAsE,CAA0H,YAAY,0BAA0B,0BAA0B,gBAAgB,UAAU,UAAU,0CAA0C,wBAAwB,oBAAoB,8CAA8C,kCAAkC,YAAY,YAAY,mCAAmC,iBAAiB,gBAAgB,sBAAsB,oBAAoB,0CAA0C,YAAY,WAAW,YAAY,SAAS,GAAG;AACjwB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA,CAAC,GAAG;AACJ;AACA;AACA,KAAK,kBAAkB,EAAE,YAAY;AACrC;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA,0BAA0B,WAAW;AACrC;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;AACL;AACA;AACA,SAAS;AACT,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,iBAAiB;AACjB,aAAa;AACb;AACA;;AAEA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,aAAa;AACb;AACA;;AAEA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,aAAa;AACb;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA,CAAC,EAAE,yCAAyC;AAC5C;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,CAAC,GAAG;AACJ;AACA;AACA;AACA;AACA,SAAS,yCAAyC;AAClD;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,eAAe;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,6DAmDA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mCAQA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,YAAY;AACf;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,uBAAuB,6BAA6B;AACpD;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA,CAAC,EAAE,YAAY;AACf;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,sCAAsC,sBAAsB;AAC5D;;AAEA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA,aAAa;AACb;AACA,+BAA+B,iBAAiB;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,CAAC,EAAE,uBAAuB;AAC1B;AACA;AACA;AACA;;AAEA;AACA;AACA,4CAA4C;AAC5C;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,GAAG;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA,SAAS;AACT;AACA,oEAAoE;AACpE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA,YAAY;AACZ;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB;AAChB,KAAK;AACL;AACA,gBAAgB;AAChB,KAAK;AACL;AACA,gBAAgB;AAChB,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;;AAEA,6BAA6B,cAAc;;AAE3C;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,qDAAqD,EAAE;AACvD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;AACL;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,0CAA0C,QAAQ;AAClD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,+BAA+B,uBAAuB;;AAEtD;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,mBAAmB,uBAAuB;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,mBAAmB,mBAAmB;AACtC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,mBAAmB,mBAAmB;AACtC;AACA;AACA;AACA;;AAEA,qCAAqC,QAAQ;AAC7C;AACA;AACA;AACA;AACA;;AAEA,yCAAyC,QAAQ;AACjD;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,mBAAmB,kBAAkB;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,mBAAmB,kBAAkB;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,+BAA+B,cAAc;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,4BAA4B;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,2BAA2B;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,gCAAgC,oBAAoB;AACpD;AACA;AACA;AACA;AACA,4BAA4B,QAAQ;AACpC;AACA;AACA;AACA;AACA;AACA,mBAAmB,YAAY;AAC/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA,+BAA+B,QAAQ;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,SAAS,mBAAmB;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,mBAAmB;AACpC,sBAAsB,mBAAmB;AACzC;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,0BAA0B;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,yCAAyC,aAAa;AACtD;;AAEA;AACA;AACA;AACA,wCAAwC,eAAe;AACvD;;AAEA;AACA;AACA;AACA,4CAA4C,eAAe;AAC3D,KAAK;AACL;AACA,kCAAkC;AAClC;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,6CAA6C,aAAa;AAC1D,KAAK;AACL;AACA;AACA,kCAAkC;AAClC;AACA;AACA;AACA;;AAEA,CAAC,GAAG;AACJ;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;;AAGA,CAAC,GAAG;AACJ;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;;AAEA;AACA;;AAEA,eAAe,oBAAoB;AACnC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,iBAAiB;AACpC;AACA;AACA,uBAAuB,kBAAkB;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,uBAAuB;AAC1B;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,gBAAgB;AAChB,gBAAgB;AAChB,kBAAkB;;AAElB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,gBAAgB;AAChB;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,GAAG;AACJ;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,CAAC,GAAG;AACJ;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,mBAAmB,aAAa;AAChC;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA,CAAC,EAAE,+BAA+B;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,mBAAmB,0BAA0B;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,0BAA0B;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,qHAkGA;;AAEA;AACA;AACA;AACA;AACA;AACA,kGA4CA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,CAAC,EAAE,YAAY;AACf;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA,aAAa;AACb;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,mBAAmB,SAAS;AAC5B;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;;AAGA;;AAEA,CAAC,EAAE,YAAY;AACf;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA,CAAC,EAAE,YAAY;AACf;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,iBAAiB;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,CAAC,EAAE,qCAAqC;AACxC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,YAAY;AACf;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,uCAAuC,aAAa;AACpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,mBAAmB,aAAa;AAChC;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;AACL;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,uBAAuB,SAAS;AAChC;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA,SAAS;AACT;AACA,SAAS;AACT;AACA,SAAS;AACT;AACA;AACA,KAAK;AACL;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA,mBAAmB,SAAS;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,mBAAmB,SAAS;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA,0BAA0B;AAC1B,yBAAyB;;AAEzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,mC;AACA,6C;AACA,+B;AACA,sC;AACA,uC;AACA,qC;AACA,4B;AACA,6B;AACA,K;AACA;AACA;AACA,eAAe,KAAK,E;AACpB,eAAe,KAAK,E;AACpB,eAAe,KAAK,E;AACpB,iB;AACA,0BAA0B,E;AAC1B,yB;AACA,qB;AACA,qC;AACA,8D;AACA,mB;;AAEA;;AAEA,CAAC,EAAE,0gBAA0gB;AAC7gB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA,SAAS;AACT;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,SAAS;AAC5B;;AAEA;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,aAAa;AACb;AACA,aAAa;AACb;AACA,aAAa;AACb;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL,uBAAuB,mBAAmB;AAC1C;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA,CAAC,EAAE,YAAY;AACf;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,gBAAgB;AACnC;AACA;AACA;AACA,2BAA2B,gBAAgB;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,mBAAmB,iBAAiB;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,mGAwHA;;AAEA;AACA,mCAAmC,aAAa;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,yCAAyC,SAAS;AAClD;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,mBAAmB,iBAAiB;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;;AAGA,CAAC,EAAE,0CAA0C;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA,mBAAmB,YAAY;AAC/B;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,uBAAuB,SAAS;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,gDAAgD,SAAS;AACzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,uBAAuB;AAC1B;AACA;AACA,mBAAmB,SAAS;AAC5B;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,CAAC,GAAG;AACJ;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,0CAA0C,SAAS;AACnD;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA,CAAC,EAAE,YAAY;AACf;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;;AAEA;AACA,cAAc,YAAY;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,YAAY;AACf;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gCAAgC,qCAAqC;AACrE,gCAAgC,mCAAmC;AACnE,CAAC;AACD;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;AACA;AACA,oBAAoB;AACpB;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,KAAK;AACL,CAAC;AACD;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;;AAEA,CAAC,EAAE,YAAY;AACf;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,YAAY;AACf;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,mCAAmC,yBAAyB;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA,CAAC,EAAE,0BAA0B;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,CAAC,GAAG;AACJ;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA,gBAAgB;AAChB;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,CAAC,EAAE,YAAY;AACf;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,kCAAkC,uCAAuC;AACzE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,wCAAwC,gBAAgB,EAAE;AAC1D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA,CAAC,EAAE,YAAY;AACf;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,8BAA8B,SAAS;AACvC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,uBAAuB,SAAS;AAChC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,uBAAuB,SAAS;AAChC;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;;AAEA;AACA,uBAAuB,+BAA+B;AACtD;AACA;;AAEA;AACA;AACA,+BAA+B,wBAAwB;AACvD;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;;AAEb;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,CAAC,EAAE,0BAA0B;AAC7B;AACA;AACA;;AAEA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,oBAAoB;;AAEpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAe,SAAS;AACxB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL,iBAAiB;AACjB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,uBAAuB,+BAA+B;AACtD;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA,+BAA+B,iBAAiB;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL,wBAAwB;AACxB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,iBAAiB;AACjB,mCAAmC,+BAA+B;AAClE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC;;AAED;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,kBAAkB,WAAW;AAC7B;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,iBAAiB;AACjB,wBAAwB;AACxB;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA,aAAa;AACb;;AAEA;AACA;AACA,mBAAmB,iBAAiB;AACpC;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,kDAAkD;AAClD,kBAAkB;AAClB;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED;;AAEA,KAAK,kBAAkB,EAAE,YAAY;AACrC;;AAEA,CAAC,EAAE,WAAW,EAAE,GAAG;AACnB,CAAC,EAAE,qBAAqB,uDAAuD,yDAAyD,sDAAsD,yDAAyD,mDAAmD,0D;;;;;;;;;;ACt/K1S;AACA;;;;;;;;;;;;ACDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,WAAW,OAAO;AAClB,YAAY,YAAY;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,QAAQ;AACxB;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,gBAAgB,QAAQ;AACxB;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,eAAe,WAAW;AAC1B;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mDAAmD;AACnD;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,mCAAmC;AACnC;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,WAAW;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,WAAW;AAC1B;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,eAAe,WAAW;AAC1B;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,OAAO;AACvB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,OAAO;AACvB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;ACnSA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;AClBA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;ACrCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,gBAAgB,MAAM;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,gBAAgB,QAAQ;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,mBAAmB,uBAAuB;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,aAAa;AACb;AACA;;AAEA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,gDAAgD;AAChD;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,eAAe,qCAAqC;AACpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;;;;;;;;;;;ACrQA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,WAAW,SAAS;AACpB,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,SAAS;AACT;AACA,KAAK;AACL;;AAEA;AACA;AACA,wCAAwC;AACxC;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,2BAA2B,kBAAkB;AAC7C;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,uBAAuB,kBAAkB;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;;AAEA;AACA,KAAK;AACL;;;;;;;;;;;ACjFA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,SAAS;AACpB;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;AACL;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;;AAEA;;;;;;;;;;;ACzEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,aAAa,OAAO;AACpB;AACA;AACA;AACA,eAAe,WAAW;AAC1B;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,QAAQ;AACnB,YAAY,OAAO;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,QAAQ;AACnB,YAAY,OAAO;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,SAAS;AACpB,YAAY,OAAO;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B;AAC/B;AACA,KAAK,OAAO;AACZ,+BAA+B;AAC/B;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,SAAS;AACpB,YAAY,OAAO;AACnB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,WAAW,OAAO;AAClB;AACA,YAAY,OAAO;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;;AAGA;AACA;AACA,WAAW,QAAQ;AACnB;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,SAAS;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;AAIA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA,oBAAoB;AACpB,SAAS;AACT,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,oBAAoB;AACpB,SAAS;AACT,KAAK;AACL;AACA;AACA;AACA;AACA,oBAAoB;AACpB,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,kBAAkB,4BAA4B;AAC9C;AACA;AACA,oBAAoB;AACpB,SAAS;AACT;AACA;;AAEA;;AAEA;AACA;AACA,gBAAgB;AAChB,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB,oBAAoB;AACtC;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB,oBAAoB;AACtC;AACA;AACA;;AAEA;;;;;;;;;;;AC3hBA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6DAA6D;AAC7D;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB;AACtB;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;;;;;;;;;;ACzDA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6DAA6D;AAC7D;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,yBAAyB;;AAEzB,cAAc;AACd,cAAc;AACd,uBAAuB;AACvB,eAAe;AACf,eAAe;AACf,eAAe;AACf,eAAe;AACf,eAAe;AACf,eAAe;AACf,WAAW;AACX,WAAW;AACX,UAAU;AACV,WAAW;AACX,WAAW;AACX,kBAAkB;AAClB;AACA,iBAAiB;AACjB,UAAU;AACV,2CAA2C,eAAe;AAC1D,0CAA0C,eAAe;AACzD;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,eAAe,gBAAgB;AAC/B;AACA;AACA,eAAe,aAAa;AAC5B;AACA;;AAEA;AACA;AACA,qBAAqB,UAAU;AAC/B,2BAA2B,OAAO;AAClC;AACA;AACA;AACA;AACA,kBAAkB;AAClB,sCAAsC,2BAA2B;AACjE,uCAAuC;AACvC,wCAAwC;AACxC;;;AAGA;AACA;AACA;AACA;;AAEA;AACA,aAAa;AACb;AACA,eAAe,WAAW;AAC1B,2BAA2B,OAAO;AAClC;AACA;AACA;AACA;;AAEA;AACA;AACA,eAAe,gBAAgB;AAC/B;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,cAAc;AACd;;AAEA;AACA;AACA,eAAe,eAAe;AAC9B;AACA;;AAEA;AACA,eAAe,aAAa;AAC5B;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,wBAAwB;AACxB;;AAEA,GAAG;AACH;AACA;AACA;AACA;AACA;;AAEA,GAAG,OAAO;AACV;AACA;AACA;AACA;;AAEA;AACA,WAAW;AACX,UAAU;AACV,YAAY;AACZ,qBAAqB;AACrB,cAAc;AACd,WAAW;AACX,WAAW;AACX,mBAAmB;AACnB,kBAAkB;;AAElB;AACA;AACA;AACA;AACA;;AAEA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB;AACxB;AACA;;AAEA;AACA;AACA;AACA,eAAe;AACf;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,wBAAwB,OAAO;AAC/B;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,kBAAkB;;AAElB;AACA;AACA;AACA;AACA;AACA,wBAAwB,OAAO;AAC/B;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,+CAA+C;AAC/C;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,iCAAiC;AACjC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;;;;;;;;;;ACtVA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6DAA6D;AAC7D;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,aAAa;AACb,cAAc;;AAEd;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU;AACV,WAAW;AACX,WAAW;AACX,UAAU;AACV,UAAU;AACV;AACA,WAAW;AACX;AACA,YAAY;AACZ,YAAY;AACZ,YAAY;AACZ;AACA,eAAe;AACf,WAAW;AACX,WAAW;AACX,YAAY;AACZ,YAAY;AACZ,YAAY;AACZ,YAAY;AACZ,WAAW;AACX,SAAS;AACT;AACA,UAAU;AACV,WAAW;AACX,WAAW;AACX;;;AAGA,oBAAoB;;AAEpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA,WAAW,GAAG;AACd;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA,yBAAyB;AACzB;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,eAAe,GAAG;AAClB;AACA;AACA;AACA;;AAEA,wBAAwB;AACxB;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B;AAC5B,4BAA4B;AAC5B,6BAA6B;AAC7B;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA,mBAAmB;AACnB;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA,uBAAuB;AACvB;AACA,gCAAgC;AAChC;AACA,+BAA+B;AAC/B;AACA;AACA;AACA,mBAAmB;AACnB,qCAAqC;AACrC;AACA;AACA;AACA,oCAAoC;AACpC;AACA;AACA,+BAA+B;AAC/B;AACA;AACA;AACA,mBAAmB;AACnB;AACA,oCAAoC;AACpC;AACA;AACA;AACA;AACA,qBAAqB;AACrB,uCAAuC;AACvC;AACA;AACA;AACA;AACA,oBAAoB;AACpB;AACA,+BAA+B;AAC/B;AACA;AACA;AACA,mBAAmB;AACnB,qCAAqC;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iCAAiC;AACjC,kBAAkB;AAClB;AACA;AACA;AACA;AACA,eAAe;AACf;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qCAAqC;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,gBAAgB;AAChB;AACA;AACA,iCAAiC;AACjC;AACA;AACA;AACA,yBAAyB;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,YAAY;AACZ;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;ACxVA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6DAA6D;AAC7D;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;;AAGA,wBAAwB;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;;AAGA;AACA;;;AAGA,gBAAgB;AAChB,iBAAiB;AACjB,gBAAgB;AAChB,cAAc;AACd,iBAAiB;AACjB,iBAAiB;AACjB,gBAAgB;AAChB,mBAAmB;AACnB,gBAAgB;AAChB,mBAAmB;AACnB,iBAAiB;AACjB,qBAAqB;AACrB,uBAAuB;AACvB,uBAAuB;AACvB,sBAAsB;AACtB,qBAAqB;AACrB,sBAAsB;AACtB,wBAAwB;AACxB,yBAAyB;AACzB,yBAAyB;AACzB,wBAAwB;AACxB,2BAA2B;AAC3B,yBAAyB;AACzB,4BAA4B;AAC5B,0BAA0B;AAC1B,wBAAwB;AACxB,kBAAkB;AAClB,mBAAmB;AACnB,iBAAiB;AACjB,gBAAgB;AAChB,gBAAgB;AAChB,iBAAiB;;AAEjB;;;;AAIA;AACA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA,gBAAgB;AAChB,oBAAoB;AACpB,gBAAgB;AAChB,wBAAwB;AACxB,iBAAiB;AACjB,gBAAgB;AAChB,iBAAiB;AACjB,iBAAiB;AACjB;AACA,mBAAmB;;AAEnB;AACA,iBAAiB;AACjB,iBAAiB;AACjB,iBAAiB;AACjB,iBAAiB;AACjB,qBAAqB;;AAErB;AACA,gBAAgB;AAChB,gBAAgB;;AAEhB;AACA,kBAAkB;AAClB,kBAAkB;;AAElB;AACA,iBAAiB;;AAEjB;AACA,sBAAsB;AACtB,uBAAuB;AACvB,mBAAmB;AACnB,oBAAoB;;AAEpB;AACA,iBAAiB;AACjB,gBAAgB;AAChB,iBAAiB;AACjB,gBAAgB;AAChB,mBAAmB;;AAEnB,mCAAmC;AACnC,mCAAmC;;AAEnC;AACA;AACA;AACA;AACA,yCAAyC;AACzC,qBAAqB;AACrB,sBAAsB;AACtB,gBAAgB;AAChB,gBAAgB;AAChB,eAAe;AACf;;AAEA;AACA;;AAEA,6BAA6B,uBAAuB;AACpD;AACA;AACA,gBAAgB;AAChB,mBAAmB;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,6BAA6B,uBAAuB;AACpD;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA,6BAA6B,uBAAuB;AACpD;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,cAAc,uBAAuB;AACrC,sBAAsB;;AAEtB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,oBAAoB;;AAEpB;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,uBAAuB,uBAAuB;AAC9C,uBAAuB,uBAAuB;AAC9C,uBAAuB,uBAAuB;AAC9C,uBAAuB,uBAAuB;;AAE9C,uEAAuE,UAAU;;AAEjF;AACA;AACA,sBAAsB,uBAAuB;;AAE7C,uEAAuE,UAAU;;AAEjF;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wCAAwC,iBAAiB;AACzD,sCAAsC,qBAAqB;AAC3D;AACA;AACA;AACA;;AAEA;AACA;AACA,oBAAoB;AACpB,WAAW;AACX,UAAU;AACV,iBAAiB;AACjB,WAAW;AACX,WAAW;AACX,gBAAgB;AAChB,WAAW;AACX,WAAW;AACX;AACA,eAAe;AACf,mCAAmC;AACnC,aAAa;AACb,mCAAmC;AACnC,UAAU;AACV,UAAU;AACV,+BAA+B;AAC/B;;AAEA,QAAQ;;AAER;AACA;;;AAGA;AACA;AACA;AACA;;AAEA;AACA,4BAA4B,qBAAqB,EAAE;;;AAGnD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,iBAAiB;AAC5C;AACA;AACA;AACA;AACA;AACA,kDAAkD;AAClD;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B;AAC3B;AACA,2BAA2B,iBAAiB;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B;AAC3B;AACA,2BAA2B,iBAAiB;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B;AAC3B;AACA,2BAA2B,iBAAiB;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B;AAC7B;AACA,6BAA6B,iBAAiB;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B,aAAa;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B,iBAAiB;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,iBAAiB;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;;AAEX;AACA;AACA;AACA;AACA;AACA,oBAAoB,iBAAiB;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,iBAAiB;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA,oBAAoB,iBAAiB;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B;AAC7B;AACA,6BAA6B,iBAAiB;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B;AAC3B;AACA,2BAA2B,iBAAiB;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qDAAqD,iBAAiB;AACtE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B;AAC1B;AACA,2BAA2B,iBAAiB;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8BAA8B;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B;AAC3B;AACA,2BAA2B,iBAAiB;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gCAAgC,iBAAiB;AACjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B,aAAa;AACzC,4BAA4B,aAAa;AACzC,2BAA2B,iBAAiB;AAC5C,yCAAyC;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B;AAC3B;AACA,2BAA2B,iBAAiB;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B,iBAAiB;AAC9C;AACA;AACA;AACA;AACA;AACA,0DAA0D;AAC1D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,gBAAgB;AAChB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB,oEAAoE;AACpE;AACA;AACA;;AAEA,sCAAsC,OAAO;AAC7C;AACA,6BAA6B,iBAAiB;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iCAAiC,iBAAiB;AAClD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uCAAuC;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iCAAiC,iBAAiB;AAClD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uCAAuC;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iCAAiC,iBAAiB;AAClD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wCAAwC;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,iCAAiC,OAAO;;AAExC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gCAAgC,iBAAiB;AACjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe;AACf,kEAAkE;AAClE;AACA;AACA;;AAEA,kCAAkC,OAAO;AACzC;AACA,2BAA2B,iBAAiB;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;;AAEA,kDAAkD,OAAO;AACzD;AACA,6BAA6B,iBAAiB;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B,iBAAiB;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe;AACf,oEAAoE;AACpE;AACA;AACA;;AAEA,oCAAoC,OAAO;AAC3C;AACA,2BAA2B,iBAAiB;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;;AAEA,kDAAkD,OAAO;AACzD;AACA,6BAA6B,iBAAiB;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B,iBAAiB;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB,iBAAiB;AAC1C;AACA,kCAAkC;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sCAAsC,qBAAqB;AAC3D,8BAA8B,aAAa;AAC3C;AACA;AACA;AACA;AACA,aAAa;AACb,qCAAqC,kBAAkB;AACvD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oCAAoC,qBAAqB;AACzD;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA,0BAA0B,aAAa;AACvC;AACA;AACA;AACA;AACA,SAAS;AACT,iCAAiC,kBAAkB;AACnD;AACA;AACA,yBAAyB,iBAAiB;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B,iBAAiB;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wDAAwD;AACxD;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B,iBAAiB;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iFAAiF;AACjF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,6BAA6B,uBAAuB;AACpD;AACA,+BAA+B,uBAAuB;;AAEtD;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,6DAA6D,uBAAuB;AACpF;;AAEA;AACA;AACA;;AAEA;AACA;AACA,eAAe;AACf,wDAAwD;AACxD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;ACnhDA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mCAAmC,UAAU;AAC7C;AACA;AACA,8BAA8B;AAC9B;AACA,qBAAqB,8BAA8B;AACnD;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG,eAAe;;AAElB;;AAEA;AACA;AACA;AACA;AACA,+BAA+B,sBAAsB;AACrD;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,kBAAkB;AAClB,mBAAmB;AACnB,sBAAsB;AACtB,mBAAmB;;AAEnB;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB;AACtB;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,mBAAmB,cAAc;AACjC;;AAEA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,sDAAsD;;AAEtD;AACA;AACA;AACA;AACA,OAAO;AACP;AACA,OAAO;AACP;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,qBAAqB,kEAAkE;;AAEvF;;AAEA,SAAS;AACT;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,GAAG;;AAEH;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA,qBAAqB,yCAAyC;;AAE9D;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;;;;;;;;;;;ACjaA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6DAA6D;AAC7D;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,8BAA8B;AAC9B;;AAEA;;;AAGA,oBAAoB,sBAAsB,qBAAqB,cAAc,EAAE;;AAE/E;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;;AAGA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA,wBAAwB;;AAExB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;;AAGA;;AAEA,kCAAkC;AAClC,iCAAiC;AACjC,iCAAiC;AACjC,4BAA4B;AAC5B,iCAAiC;;AAEjC;AACA;AACA;;;AAGA;AACA;AACA;;;AAGA;AACA,2BAA2B;AAC3B,oBAAoB;AACpB,6BAA6B;AAC7B;;;;AAIA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;;;AAGA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,GAAG;AACH;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qCAAqC;AACrC;AACA;AACA;AACA;AACA,sBAAsB;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR,WAAW;AACX,WAAW;AACX,YAAY;AACZ,QAAQ;AACR,mBAAmB;;AAEnB,gBAAgB,kBAAkB;AAClC;AACA;;AAEA;AACA;AACA;AACA,+CAA+C;;AAE/C,0BAA0B,eAAe;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,uBAAuB,UAAU,EAAE;;AAEnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,QAAQ;;AAE/B;AACA;;AAEA;AACA;AACA;AACA,oCAAoC,QAAQ;AAC5C,uBAAuB;AACvB,8BAA8B;AAC9B;AACA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA;AACA,yBAAyB,YAAY;AACrC;AACA;AACA;AACA,yBAAyB,UAAU;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB;AACpB,mBAAmB;AACnB,qBAAqB;AACrB;AACA,0CAA0C;AAC1C,eAAe;AACf,WAAW;AACX,QAAQ;;AAER;AACA;AACA;AACA,gBAAgB,kBAAkB;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,aAAa,gBAAgB;AAC7B;AACA,oBAAoB,UAAU;AAC9B;AACA;;AAEA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA,QAAQ;AACR,WAAW;AACX,aAAa;AACb,WAAW;AACX,WAAW;AACX;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,gBAAgB,yBAAyB;AACzC;AACA,eAAe,8BAA8B;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,gBAAgB,WAAW;AAC3B;AACA,eAAe,8BAA8B;AAC7C;AACA;AACA;AACA;AACA,aAAa;AACb,QAAQ,gBAAgB;AACxB;AACA,eAAe,oCAAoC;AACnD;AACA;AACA;AACA;;AAEA;AACA,gBAAgB,kBAAkB;AAClC;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,aAAa,aAAa;AAC1B;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA;AACA,QAAQ;;AAER;AACA,aAAa,aAAa,QAAQ,iCAAiC;AACnE,aAAa,aAAa,QAAQ,iCAAiC;AACnE,aAAa,cAAc,OAAO,+BAA+B;;AAEjE;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB;AAChB,eAAe;AACf,kBAAkB;AAClB;AACA,eAAe;;AAEf;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB;AACpB,YAAY;AACZ;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+CAA+C,OAAO;;AAEtD;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,2BAA2B;AAC3B,2BAA2B;AAC3B;AACA,WAAW;AACX,SAAS;AACT,aAAa;AACb,WAAW;AACX,YAAY;;AAEZ;AACA;AACA;AACA;AACA;;AAEA;AACA,gCAAgC;AAChC;AACA,OAAO;AACP;AACA;AACA,iDAAiD;AACjD;AACA;AACA;AACA,kCAAkC;AAClC;AACA,eAAe;AACf;AACA;;AAEA,kCAAkC;AAClC;AACA;AACA;AACA,oCAAoC;AACpC;AACA,OAAO;;AAEP;AACA;AACA;;AAEA,KAAK;AACL;;AAEA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA,6DAA6D;AAC7D;AACA;AACA;AACA;AACA,sBAAsB;AACtB;AACA;AACA;AACA;AACA;AACA,WAAW;AACX,oBAAoB;AACpB,WAAW;;AAEX;AACA;AACA;AACA;AACA;AACA;;AAEA,aAAa,WAAW;AACxB;AACA;AACA;;AAEA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,uCAAuC,QAAQ,OAAO,wBAAwB;;AAE9E;AACA;AACA;AACA,eAAe;AACf;AACA,2BAA2B;AAC3B;AACA;AACA;AACA;AACA;;AAEA,8BAA8B;;AAE9B,6BAA6B;AAC7B;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,GAAG;;AAEH;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB;AACpB,mBAAmB;AACnB;AACA,QAAQ;AACR,mBAAmB;AACnB,aAAa;;AAEb,wCAAwC;;AAExC,gBAAgB;AAChB,oBAAoB;AACpB,oBAAoB;;AAEpB;AACA;AACA;AACA;AACA,gDAAgD;;AAEhD,aAAa,eAAe;AAC5B;AACA;;AAEA;AACA;;AAEA,KAAK;AACL;;AAEA,KAAK;;AAEL,+BAA+B,kCAAkC;AACjE;;AAEA,KAAK;AACL;;AAEA,KAAK;AACL;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA,KAAK;AACL;AACA;;AAEA,KAAK;AACL;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB;AACpB,mBAAmB;AACnB;AACA,QAAQ;AACR,mBAAmB;AACnB,aAAa;;AAEb,wCAAwC;;AAExC,gBAAgB;AAChB,oBAAoB;AACpB,oBAAoB;;AAEpB,+BAA+B;AAC/B;AACA;AACA;AACA;;AAEA,aAAa,eAAe;AAC5B;AACA;;AAEA;AACA;;AAEA,KAAK;AACL,UAAU,iCAAiC,EAAE;;AAE7C,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,KAAK;AACL;AACA;;AAEA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,KAAK;AACL;AACA;;AAEA,KAAK;AACL;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA,kBAAkB;;AAElB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,kCAAkC,kBAAkB;AACpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kCAAkC;AAClC;AACA,WAAW;;AAEX;AACA;AACA;AACA;AACA,gCAAgC;AAChC;AACA,gCAAgC;AAChC,gBAAgB,gBAAgB;AAChC;AACA;AACA;AACA;;AAEA,wCAAwC;AACxC;;AAEA,wCAAwC;AACxC;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B,IAAI,MAAM,GAAG,MAAM,GAAG;AAChD;AACA;AACA;AACA,SAAS,IAAI,KAAK,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,IAAI,MAAM,IAAI;AAC3D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,aAAa,SAAS;AACtB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,cAAc,cAAc;AAC5B;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb,iBAAiB;AACjB,WAAW;AACX;AACA,wDAAwD;AACxD,uCAAuC;AACvC;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb,iBAAiB;AACjB,WAAW;AACX;AACA,4BAA4B;AAC5B,sBAAsB;;AAEtB;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,kCAAkC,wBAAwB;;AAE1D,GAAG;AACH;AACA,4CAA4C;AAC5C;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,GAAG;;AAEH;AACA;;AAEA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB;AACpB,kBAAkB;AAClB;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA,WAAW;AACX;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB,iBAAiB;AACtC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;;;;;;;;;;ACnsCA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6DAA6D;AAC7D;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;;AAGA,wBAAwB;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,gCAAgC;AAChC;;;AAGA;AACA;;AAEA;;;AAGA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,0BAA0B;AAC1B,0BAA0B;AAC1B,0BAA0B;AAC1B,0BAA0B;;AAE1B,mBAAmB;;AAEnB;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,oBAAoB,sBAAsB,qBAAqB,cAAc,EAAE;;;AAG/E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,kBAAkB,QAAQ;;AAE1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,mBAAmB,YAAY;AAC/B,kBAAkB,UAAU;;AAE5B;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wCAAwC;AACxC,wBAAwB;AACxB,YAAY;AACZ,UAAU;AACV,+BAA+B;AAC/B,gCAAgC;AAChC;AACA;;AAEA,sBAAsB;;AAEtB;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iCAAiC,0BAA0B;;AAE3D;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA,wDAAwD;AACxD;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO;;AAEP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;;AAEP;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,sDAAsD;AACtD;AACA;AACA;AACA;AACA;AACA,kEAAkE;AAClE;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,GAAG;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,SAAS;AACT;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,6BAA6B;AAC7B;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA,6BAA6B;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA,2BAA2B;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,2BAA2B;AAC3B;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB;AAChB,aAAa;;AAEb,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,mDAAmD;AACnD;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mEAAmE;;AAEnE;AACA,yDAAyD;AACzD;;AAEA;;AAEA;AACA;AACA;AACA;AACA,yBAAyB;AACzB;AACA;AACA,uDAAuD;AACvD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA,OAAO;AACP;AACA;AACA;AACA;AACA,2DAA2D;AAC3D;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,0DAA0D;AAC1D;;AAEA;AACA;AACA;AACA;AACA,6BAA6B;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB;AAChB,aAAa;;AAEb;;AAEA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8BAA8B,OAAO,EAAE;AACvC;;AAEA;AACA;AACA;AACA;AACA;AACA,mDAAmD;AACnD;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA,wDAAwD;AACxD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uDAAuD;AACvD;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;;AAEA;AACA,+BAA+B;AAC/B;AACA;AACA;AACA;AACA;AACA;;AAEA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,4DAA4D;AAC5D;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0DAA0D;AAC1D;;AAEA;AACA;AACA;AACA;AACA,2BAA2B;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B;AAC3B;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb,WAAW;AACX,mBAAmB;;AAEnB;;AAEA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8BAA8B,OAAO,EAAE;AACvC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,oEAAoE;AACpE;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,0DAA0D;AAC1D;;AAEA;AACA;AACA;AACA;AACA,6BAA6B;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,aAAa;;AAEb,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;;AAEA;AACA;AACA;AACA,wDAAwD;AACxD;AACA;AACA;AACA;AACA,6BAA6B;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;;AAEA,qBAAqB;AACrB,eAAe;;AAEf;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA,mBAAmB;AACnB,kBAAkB;AAClB,0BAA0B;AAC1B,4BAA4B;AAC5B,uBAAuB;AACvB,mBAAmB;AACnB,gBAAgB;AAChB,qBAAqB;AACrB,mBAAmB;AACnB,2BAA2B;AAC3B,uBAAuB;;AAEvB,kBAAkB;AAClB,kBAAkB;AAClB,kBAAkB;;AAElB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,mBAAmB;;AAEnB,iBAAiB;AACjB,qBAAqB;AACrB,qBAAqB;AACrB,qBAAqB;;AAErB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,wBAAwB;AACxB,sBAAsB;AACtB,2BAA2B;AAC3B,oBAAoB;AACpB,uBAAuB;AACvB,qBAAqB;;AAErB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,iBAAiB;AACjB,oBAAoB;;AAEpB;AACA;;AAEA,sBAAsB;;AAEtB;;AAEA;;AAEA,2CAA2C;AAC3C,6CAA6C;AAC7C,4CAA4C;;AAE5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,uBAAuB;AACvB,uBAAuB;AACvB,uBAAuB;;AAEvB;AACA;AACA;;AAEA,0BAA0B;AAC1B,+CAA+C;AAC/C;;AAEA,oBAAoB;AACpB,oBAAoB;AACpB;AACA;AACA;;AAEA,gDAAgD;AAChD;AACA;AACA;;AAEA,iBAAiB;;AAEjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,oBAAoB;;AAEpB;AACA;AACA;AACA;AACA;;AAEA,mBAAmB;AACnB,sBAAsB;AACtB,mBAAmB;AACnB,kBAAkB;;;AAGlB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,mDAAmD;AACnD;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA,6BAA6B,uBAAuB;AACpD,8BAA8B,uBAAuB;AACrD;AACA;AACA;;;AAGA;AACA,cAAc;AACd;AACA;AACA;;AAEA;AACA;AACA;;AAEA,uBAAuB;AACvB;AACA;AACA;;AAEA;AACA,aAAa;AACb;AACA;;;AAGA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,qBAAqB;;AAErB,sCAAsC;;AAEtC;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;AACA,eAAe;;AAEf;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,gBAAgB;AAChB;AACA;;AAEA;AACA;;AAEA,uBAAuB;AACvB,qBAAqB;AACrB;AACA;AACA;AACA,sBAAsB;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,OAAO;AACP;AACA,OAAO;AACP;AACA,OAAO;AACP;AACA;AACA;AACA,6BAA6B,uBAAuB;AACpD;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;;AAEA;AACA;AACA;AACA,sBAAsB;;AAEtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB;AACtB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,OAAO;;AAEP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB;AACtB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,OAAO;;AAEP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mCAAmC;;AAEnC;AACA;AACA;AACA;AACA;AACA,6BAA6B;AAC7B,uBAAuB;;AAEvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B;AAC1B;AACA;AACA;AACA;AACA;AACA,8BAA8B;;AAE9B,2BAA2B,aAAa;AACxC,oBAAoB,qBAAqB;;AAEzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,mBAAmB,kBAAkB;AACrC;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,oDAAoD;AACpD;AACA;;AAEA,aAAa;;AAEb;AACA;AACA,qBAAqB;AACrB,yBAAyB;AACzB,mBAAmB;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gEAAgE;AAChE;;AAEA;;AAEA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;ACj1DA;;;AAGA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mCAAmC,UAAU;AAC7C;AACA;AACA,8BAA8B;AAC9B;AACA,qBAAqB,8BAA8B;AACnD;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG,eAAe;;AAElB;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,kBAAkB;AAClB,mBAAmB;AACnB,sBAAsB;AACtB,mBAAmB;;AAEnB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB;AACtB;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;;AAEA,mBAAmB,cAAc;;AAEjC;;AAEA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,+CAA+C;;AAE/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA,qBAAqB,yCAAyC;;AAE9D;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;;;;;;;;;;;AC/YA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;;AAEA;;;;;;;;;;;ACbA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;AACA;AACA;AACA,wCAAwC;AACxC;;;;;;;;;;;ACpFA;;AAEA;AACA;;AAEA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,YAAY,OAAO;AACnB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA,SAAS;AACT;AACA,KAAK;AACL;AACA;;AAEA;AACA;;;;;;;;;;;ACxDA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,qCAAqC;AAChD,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,eAAe,OAAO;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,OAAO;AACtB,eAAe,SAAS;AACxB;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,OAAO;AACtB,eAAe,SAAS;AACxB;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA,SAAS;AACT;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,cAAc,2BAA2B;AACzC;AACA;AACA;;;;;;;;;;;ACpIA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,UAAU,aAAa;AACvB,UAAU,OAAO;AACjB,UAAU,SAAS;AACnB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;;;AAGA;AACA;AACA;;AAEA;;;;;;;;;;;ACzCA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;;;;;;;;;;8CCzBA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;;AAEA,mCAAmC;AACnC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;ACpEA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;;;;;;;;;AC5PA,iBAAiB;;AAEjB;AACA;AACA,E;;;;;;;;;ACJA,+F;;;;;;;;;ACAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH,E;;;;;;;;;ACfA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,E;;;;;;;;;AC1EA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,E;;;;;;;;;ACPA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,E;;;;;;;;;ACXA;AACA,2FAAsE,gBAAgB,UAAU,GAAG;AACnG,CAAC,E;;;;;;;;;ACFD;AACA;AACA;AACA;AACA,E;;;;;;;;;ACJA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG,UAAU;AACb;AACA;AACA;AACA,E;;;;;;;;;ACfA;AACA;AACA;AACA;AACA,CAAC;AACD;AACA;AACA,E;;;;;;;;;ACPA;AACA;AACA;AACA,E;;;;;;;;;ACHA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mEAAmE;AACnE;AACA,qFAAqF;AACrF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX,SAAS;AACT;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,+CAA+C;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,eAAe;AACf,eAAe;AACf,eAAe;AACf,gBAAgB;AAChB,yB;;;;;;;;;AC5DA;AACA;AACA;AACA;AACA;AACA,CAAC,E;;;;;;;;;ACLD;AACA,+E;;;;;;;;;ACDA;;;;;;;;;;ACAA;;;;;;;;;;ACAA;;;;;;;;;;ACAA;;;;;;;;;;;ACAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,E;;;;;;;;;;AC7CA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,SAAS;AACpB,WAAW,OAAO;AAClB,aAAa,SAAS;AACtB;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB,aAAa;AACb;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;AClEA;AACA;;AAEA;AACA;AACA;;AAEA,uBAAuB;AACvB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB,iBAAiB;AACtC;AACA;AACA;AACA,kBAAkB;AAClB;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,0CAA0C,sBAAsB,EAAE;AAClE;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,yCAAyC;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,UAAU;AACV;AACA;;AAEA,KAAK;AACL;AACA;;AAEA,KAAK;AACL;AACA;;AAEA,KAAK;AACL;AACA;;AAEA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA,CAAC;;;;;;;;;;;ACzLD,e;;;;;;;;;;ACAA;;AAEA,iDAAiD,0CAA0C,0DAA0D,EAAE;;AAEvJ;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,iBAAiB;AACjB,gDAAgD;AAChD;AACA;AACA;;AAEA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,wDAAwD;AACxD;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,CAAC;;AAED;AACA;AACA,4BAA4B,sBAAsB;AAClD;AACA;AACA,C;;;;;;;;;AC9EA,e;;;;;;;;;ACAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;;;AAIA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;;AAGA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAe;AACf;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;;;;;;;;;;AC9HA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,QAAQ,WAAW;;AAEnB;AACA;AACA;AACA,QAAQ,WAAW;;AAEnB;AACA;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA,QAAQ,WAAW;;AAEnB;AACA;AACA,QAAQ,UAAU;;AAElB;AACA;;;;;;;;;;;ACnFA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,kCAAkC,SAAS;AAC3C;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;;AAEA,aAAa,OAAO;AACpB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,qBAAqB,SAAS;AAC9B;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,0CAA0C,UAAU;AACpD;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;;;;;;;;;;ACnHA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,qCAAqC;AAChD,WAAW,OAAO;AAClB,YAAY,OAAO;AACnB;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;;AAEA,8CAA8C;AAC9C;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB,YAAY,OAAO;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB,YAAY,OAAO;AACnB;AACA;AACA;AACA;AACA,oBAAoB;AACpB;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,SAAS;AACpB;AACA,YAAY,OAAO;AACnB;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,QAAQ;AACnB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;;AAGL;AACA;AACA,eAAe,SAAS;AACxB,sCAAsC;AACtC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oFAAoF;AACpF,uCAAuC;AACvC;AACA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,SAAS;AACxB,sCAAsC;AACtC;AACA,gBAAgB,MAAM;AACtB;AACA;AACA;AACA;AACA,8CAA8C;AAC9C;AACA;;AAEA,SAAS;AACT;AACA,KAAK;;AAEL;AACA;AACA,iBAAiB,cAAc;AAC/B;AACA,iBAAiB,qCAAqC;AACtD,iBAAiB,OAAO;AACxB,iBAAiB,mBAAmB;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA,kBAAkB;AAClB;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,iBAAiB,cAAc;AAC/B,iBAAiB,MAAM;AACvB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,aAAa;AACb;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,OAAO;AACtB,gBAAgB,MAAM;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,aAAa;AACb,2BAA2B,iBAAiB;AAC5C;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,OAAO;AACtB;AACA;AACA,gBAAgB,0CAA0C;AAC1D;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,OAAO;AACtB;AACA;AACA,gBAAgB,aAAa;AAC7B;AACA;AACA;AACA;AACA,2CAA2C;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;;AAEX;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;ACpYA;AACA;AACA,UACoE;AACpE,CAAC,4BAA4B;;AAE7B;;AAEA;AACA;AACA;AACA;AACA;AACA,uCAAuC;AACvC,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,cAAc;AACd,GAAG,EAAE;AACL;AACA;AACA,gBAAgB,iBAAiB;AACjC,GAAG;AACH;;AAEA;AACA;AACA;AACA;AACA,cAAc,qBAAqB;AACnC,qBAAqB;AACrB;AACA;AACA,gBAAgB,sBAAsB;AACtC;AACA,gBAAgB,yCAAyC;AACzD,gBAAgB,iBAAiB;AACjC,GAAG;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,yDAAyD;AACzD;AACA,GAAG;AACH;;AAEA;AACA;AACA,KAAK,yBAAyB,qBAAqB,EAAE;AACrD;AACA,KAAK,qBAAqB,aAAa,EAAE;AACzC;AACA,KAAK;AACL;;AAEA,yCAAyC,kBAAkB,oBAAoB;;AAE/E;AACA;AACA,cAAc;AACd,GAAG,EAAE;AACL;AACA;AACA,oBAAoB,0BAA0B;AAC9C,GAAG;AACH;;AAEA;AACA;AACA;AACA,cAAc,qBAAqB;AACnC,qBAAqB;AACrB;AACA;AACA,gBAAgB,sBAAsB;AACtC;AACA,oBAAoB,kDAAkD;AACtE,gBAAgB,iBAAiB;AACjC,GAAG;AACH;;AAEA;AACA,6CAA6C,YAAY;AACzD;AACA;AACA;AACA,cAAc,qBAAqB;AACnC;AACA;AACA;AACA;AACA;AACA,SAAS,yBAAyB;AAClC;AACA;AACA;AACA,SAAS;AACT,KAAK;AACL,GAAG;AACH,6BAA6B;AAC7B;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,cAAc,qBAAqB;AACnC;AACA;AACA;AACA,+CAA+C;AAC/C;AACA,6BAA6B;AAC7B,KAAK;AACL,GAAG;AACH,6BAA6B;AAC7B;AACA;AACA;;AAEA;AACA;AACA;AACA,cAAc,qBAAqB;AACnC;AACA;AACA,2BAA2B;AAC3B;AACA,kDAAkD;AAClD;AACA,KAAK;AACL,GAAG;AACH,6BAA6B;AAC7B;AACA;AACA;;AAEA;AACA;AACA;AACA,cAAc,qBAAqB;AACnC,UAAU;AACV,2BAA2B;AAC3B;AACA;AACA,OAAO,2BAA2B;AAClC;AACA,GAAG;AACH;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,cAAc,qBAAqB;AACnC;AACA,2BAA2B,6BAA6B;AACxD;AACA;;AAEA,mCAAmC,aAAa;AAChD;;AAEA;;AAEA;;AAEA;AACA,mCAAmC,iBAAiB;AACpD;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B,6CAA6C;AACvE;AACA;AACA;AACA,uBAAuB,oCAAoC;AAC3D;AACA,gDAAgD,sCAAsC;AACtF;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oCAAoC,iBAAiB;AACrD;;AAEA,kBAAkB,8BAA8B;AAChD,6CAA6C,qBAAqB;AAClE;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,kBAAkB,gCAAgC;AAClD,yCAAyC,iBAAiB;AAC1D;AACA;;AAEA;AACA;AACA;AACA;AACA,sBAAsB,oCAAoC;AAC1D;AACA;AACA,0BAA0B,2CAA2C;AACrE;AACA;AACA,qBAAqB,qBAAqB;AAC1C,uBAAuB,oCAAoC;AAC3D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB,6BAA6B;AAC/C,kBAAkB,gCAAgC;AAClD,oBAAoB,kCAAkC;AACtD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2CAA2C,aAAa;AACxD,QAAQ,2BAA2B;AACnC;AACA;;AAEA,mDAAmD,gCAAgC;AACnF;AACA,2CAA2C,iBAAiB;AAC5D;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,kBAAkB,gCAAgC;AAClD;;AAEA;AACA,gBAAgB,2BAA2B;AAC3C,qCAAqC,iBAAiB;AACtD;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,yCAAyC,iCAAiC;AAC1E,+CAA+C,kCAAkC;;AAEjF;AACA;AACA,KAAK,gCAAgC;AACrC;AACA,KAAK,8BAA8B;AACnC;AACA,KAAK,aAAa;AAClB;AACA;AACA;AACA,2CAA2C,wCAAwC;AACnF;AACA,uCAAuC,iBAAiB;AACxD;;AAEA,cAAc,uBAAuB;AACrC;AACA;AACA;AACA,yCAAyC,iBAAiB;AAC1D;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,uCAAuC,iBAAiB;AACxD;;AAEA,cAAc,0BAA0B;AACxC;AACA;AACA;AACA,yCAAyC,iBAAiB;AAC1D;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,0CAA0C,iBAAiB;AAC3D;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK,uCAAuC,iBAAiB;AAC7D;AACA;;AAEA;AACA,OAAO;AACP;AACA;AACA;AACA,sBAAsB,oCAAoC;AAC1D;AACA;AACA;AACA,KAAK,oHAAoH;AACzH,oBAAoB,kCAAkC;AACtD;AACA;AACA;AACA;AACA;AACA,yCAAyC,iBAAiB;AAC1D;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,uEAAuE,6BAA6B;AACpG;AACA,gBAAgB,2BAA2B;AAC3C,wBAAwB,sCAAsC;AAC9D,wCAAwC,iBAAiB;AACzD;AACA;;AAEA;AACA;AACA;AACA;AACA,sBAAsB,+BAA+B;AACrD;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,8CAA8C,cAAc;;AAE5D,CAAC;;;;;;;;;;ACnbD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,yBAAyB,6BAA6B;AACtD,qBAAqB,UAAU;AAC/B;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB;AAClB,iBAAiB;AACjB;AACA,gCAAgC;AAChC;AACA,qBAAqB;AACrB;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA,mCAAmC;AACnC;AACA;;AAEA;AACA,kBAAkB;AAClB,iBAAiB,SAAS;AAC1B;AACA,kBAAkB;AAClB,iBAAiB,8CAA8C;AAC/D,iBAAiB,YAAY;AAC7B;AACA;AACA;AACA,iBAAiB,qBAAqB;AACtC,iBAAiB;AACjB;AACA;AACA,iBAAiB;AACjB;AACA,iBAAiB,gBAAgB;AACjC,iBAAiB;AACjB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,iBAAiB,gBAAgB;AACjC,iBAAiB;AACjB;AACA;AACA,iBAAiB,gBAAgB;AACjC,iBAAiB;AACjB;AACA;AACA,iBAAiB,gBAAgB;AACjC,iBAAiB,aAAa;AAC9B;AACA;AACA,iBAAiB,kDAAkD;AACnE,iBAAiB;AACjB;AACA,iBAAiB;AACjB;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,SAAS;AACT;;AAEA;AACA;AACA;AACA,wDAAwD;AACxD;AACA;AACA,2CAA2C;AAC3C;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B,qBAAqB;AACjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA,iBAAiB;AACjB;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA,uBAAuB,oBAAoB;AAC3C;AACA;AACA;AACA,aAAa;AACb;AACA,aAAa;AACb;AACA,aAAa;AACb;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA,qBAAqB;AACrB;AACA;AACA,aAAa;AACb;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,mDAAmD,8BAA8B;AACjF;AACA;AACA,aAAa;AACb;AACA;AACA,SAAS;AACT,uCAAuC,eAAe;AACtD;AACA;AACA;AACA,2BAA2B,gBAAgB;AAC3C;AACA;AACA;AACA;AACA;AACA,oCAAoC;AACpC;AACA;AACA;AACA;AACA;AACA,uBAAuB,mBAAmB;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA,aAAa;AACb;AACA,+BAA+B;AAC/B;AACA,6BAA6B;AAC7B;AACA,SAAS;AACT;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,SAAS,SAAS,gBAAgB;;AAElC;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAS,SAAS,gBAAgB;AAClC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,wCAAwC,KAAK;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,0CAA0C,aAAa;AACvD;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B,QAAQ;AAClC;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB,aAAa;AACb;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA,CAAC;;;AAGD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA,uBAAuB,mBAAmB;AAC1C;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B,KAAK;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wCAAwC,KAAK;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,kD;AACA;AACA;AACA,mCAAmC,KAAK;AACxC;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,mCAAmC,KAAK;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,KAAK;AACL,CAAC;;;;AAID;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;;AAGA;AACA,qBAAqB;AACrB,gCAAgC;AAChC,2BAA2B;AAC3B,0CAA0C;AAC1C,iDAAiD;AACjD,uBAAuB;AACvB,CAAC;;AAED;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED,CAAC;;AAED;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL,sCAAsC,oBAAoB;AAC1D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB;AACpB;AACA;;AAEA;AACA;AACA,uBAAuB,yBAAyB;AAChD;AACA;AACA;AACA,6BAA6B,6EAA6E;AAC1G;AACA,aAAa;AACb;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB,0CAA0C;AACnE;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA,iEAAiE;AACjE,8BAA8B;AAC9B,eAAe;AACf,CAAC;AACD,8CAA8C;AAC9C,8BAA8B;AAC9B,qBAAqB;AACrB,sCAAsC;AACtC,CAAC;AACD,8CAA8C;AAC9C,uBAAuB;AACvB,eAAe;AACf,CAAC;AACD,4CAA4C;AAC5C,oBAAoB;AACpB,gBAAgB;AAChB,oBAAoB;AACpB,CAAC;AACD,uBAAuB;AACvB,gBAAgB;AAChB,0BAA0B;AAC1B,uBAAuB;AACvB,eAAe;AACf,sBAAsB;AACtB,gBAAgB;AAChB,CAAC;AACD,uDAAuD;AACvD,gBAAgB;AAChB,4BAA4B;AAC5B,CAAC;AACD,8BAA8B;AAC9B,iBAAiB;AACjB,oBAAoB;AACpB,wBAAwB;AACxB,gBAAgB;AAChB,gCAAgC;AAChC,oBAAoB;AACpB,2CAA2C;AAC3C,qBAAqB;AACrB,CAAC;;AAED;;AAEA,CAAC;;AAED;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,mBAAmB,cAAc;AACjC;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA;;AAEA;AACA;AACA;AACA,uBAAuB,QAAQ;AAC/B;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,qBAAqB,iBAAiB;AACtC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA,KAAK;AACL;AACA;;AAEA,CAAC;;AAED;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,KAAK;;AAEL;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,sDAAsD;AACtD,yDAAyD;AACzD,kCAAkC;AAClC,kCAAkC;AAClC;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,SAAS;AACT;AACA;AACA,sCAAsC,mBAAmB;AACzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA,gCAAgC,6BAA6B,EAAE;AAC/D,kCAAkC,+BAA+B,EAAE;AACnE,+CAA+C,gCAAgC,EAAE;AACjF,gDAAgD,8BAA8B,EAAE;;AAEhF,iCAAiC,2BAA2B,EAAE;AAC9D,oCAAoC,uCAAuC,EAAE;AAC7E,0CAA0C,qCAAqC,mBAAmB,EAAE,EAAE;AACtG;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET,oCAAoC,qCAAqC,EAAE;AAC3E,sCAAsC,uCAAuC;AAC7E;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB,aAAa;AACb,SAAS;AACT;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,2DAA2D,2BAA2B;AACtF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;;AAEb;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,SAAS;AACT;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA,mBAAmB;AACnB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA;AACA;AACA,mCAAmC,iBAAiB;AACpD;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,aAAa;AACb,+BAA+B,mBAAmB;AAClD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA;;AAEA,CAAC;;AAED;AACA;;AAEA;;AAEA;AACA,4DAA4D,iBAAiB;AAC7E;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA,CAAC;;AAED;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,yCAAyC,KAAK;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA,SAAS;AACT;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,SAAS;AACT;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,SAAS;AACT;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,CAAC;AACD,CAAC;AACD;AACA,0EAA0E;AAC1E,iBAAiB;;;;;;;;;;ACl6DjB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,uCAAuC;AACvC;;AAEA;AACA;AACA;AACA,mDAAmD,0BAA0B,EAAE;AAC/E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB;AACvB;AACA,uBAAuB,kBAAkB;AACzC;AACA,wBAAwB;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB;AAChB;;AAEA;AACA,8BAA8B;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8BAA8B,wCAAwC;AACtE,SAAS;AACT;;AAEA,CAAC;;AAED;AACA,2CAA2C;AAC3C,uBAAuB;AACvB,6CAA6C;AAC7C,uBAAuB;AACvB,eAAe;AACf,gCAAgC;AAChC,mCAAmC;AACnC,2BAA2B;AAC3B,yCAAyC;AACzC,CAAC;AACD,gCAAgC;AAChC,uCAAuC;AACvC,yCAAyC;AACzC,CAAC;;AAED;;AAEA,CAAC;;AAED;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B;AAC7B;AACA,KAAK;AACL;AACA,CAAC;AACD;AACA;AACA;AACA;AACA;AACA,4BAA4B,wBAAwB;AACpD;AACA,KAAK;AACL;AACA,CAAC;;AAED;AACA;;;AAGA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,CAAC;;AAED;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,CAAC;;AAED;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc,gCAAgC;AAC9C;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;AACL;AACA,CAAC;AACD;AACA,wCAAwC,gCAAgC,gBAAgB,EAAE,EAAE;AAC5F;AACA,CAAC;AACD;AACA,cAAc,gCAAgC;AAC9C,wCAAwC,gCAAgC,qDAAqD,EAAE,EAAE;AACjI;AACA,CAAC;AACD;AACA,cAAc,4CAA4C;AAC1D,4BAA4B,gCAAgC,sEAAsE,EAAE,EAAE;AACtI;AACA,CAAC;AACD;AACA;AACA,cAAc,gCAAgC;AAC9C;AACA;AACA;AACA,CAAC;AACD;AACA,cAAc,8CAA8C;AAC5D;AACA;AACA;AACA;AACA,CAAC;AACD;AACA,cAAc,0DAA0D;AACxE;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;AACA,CAAC;AACD;AACA;AACA,6BAA6B,wBAAwB;AACrD,CAAC;AACD;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;AACA;AACA,6BAA6B,sBAAsB;AACnD,CAAC;AACD;AACA;AACA,6BAA6B,0BAA0B;AACvD,CAAC;AACD;AACA;AACA;AACA,kCAAkC;AAClC;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;AACA,oEAAoE,2BAA2B,EAAE;AACjG;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;AACA,oEAAoE,uBAAuB,EAAE;AAC7F;AACA;AACA;AACA,CAAC;AACD;AACA;AACA,6BAA6B,kDAAkD;AAC/E,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uDAAuD,EAAE;AACzD;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6DAA6D;AAC7D;AACA;AACA;AACA,SAAS;AACT;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,0BAA0B,YAAY;AACtC;AACA;AACA,4BAA4B,SAAS,+BAA+B;AACpE;AACA;AACA;;AAEA,CAAC;;;AAGD;;AAEA,CAAC;;AAED;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK,YAAY,eAAe;AAChC;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,iDAAiD;AACjD;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,uCAAuC;AACvC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,SAAS;AACT;;AAEA;AACA;AACA;AACA,SAAS;AACT;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA,CAAC;;;AAGD;;AAEA;AACA;AACA,uCAAuC;AACvC,qBAAqB;AACrB,aAAa;AACb,8BAA8B;AAC9B,iCAAiC;AACjC,yBAAyB;AACzB,CAAC;AACD,wBAAwB;AACxB,qBAAqB;AACrB,2CAA2C;AAC3C,uCAAuC;AACvC,CAAC;AACD,kCAAkC;AAClC,uCAAuC;AACvC,uCAAuC;AACvC,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb,2DAA2D,eAAe;AAC1E;AACA;AACA,CAAC;;AAED,CAAC;;AAED;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,oCAAoC;AACpC,gEAAgE;AAChE,sDAAsD;AACtD,yDAAyD;AACzD,iDAAiD;AACjD,oDAAoD;AACpD,6BAA6B;AAC7B,aAAa;AACb,wDAAwD;AACxD,2BAA2B;AAC3B,8CAA8C;AAC9C,aAAa;AACb,4DAA4D;AAC5D,2BAA2B;AAC3B,8CAA8C;AAC9C,qDAAqD;AACrD,aAAa;AACb,yCAAyC;AACzC;AACA,aAAa;AACb,2CAA2C;AAC3C;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;;AAEA,qCAAqC;AACrC;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,mBAAmB,yBAAyB,aAAa;AACzD;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA,SAAS;AACT,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB;AACpB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oCAAoC;;AAEpC;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uCAAuC,WAAW;AAClD;AACA,qBAAqB;AACrB;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;;AAEA,YAAY;AACZ;;AAEA;AACA,qBAAqB,qDAAqD;AAC1E,qBAAqB,yDAAyD;AAC9E,qBAAqB,uDAAuD;AAC5E,qBAAqB,yDAAyD;AAC9E,qBAAqB,+DAA+D;AACpF,qBAAqB,iEAAiE;AACtF,qBAAqB,mEAAmE;AACxF,qBAAqB,+DAA+D;AACpF,qBAAqB,2DAA2D;AAChF,qBAAqB,uDAAuD;AAC5E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAe,+DAA+D;AAC9E,aAAa,2DAA2D;AACxE,qBAAqB,+DAA+D;AACpF,mBAAmB,2DAA2D;AAC9E;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,mBAAmB,oCAAoC;AACvD;;AAEA,qBAAqB,mCAAmC;AACxD,yCAAyC,kCAAkC;AAC3E;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,QAAQ;;AAER;AACA;AACA;AACA,YAAY;AACZ;;;AAGA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA,SAAS;AACT;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,yDAAyD,SAAS,0CAA0C,EAAE;AAC9G;AACA,+DAA+D,wBAAwB,EAAE;AACzF;AACA,uEAAuE,yCAAyC;AAChH;AACA;AACA;AACA;;AAEA;AACA,sDAAsD,2BAA2B,EAAE;AACnF;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,SAAS;AACT;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,gDAAgD;AAChD;AACA;AACA;;AAEA,6BAA6B;AAC7B,2BAA2B;AAC3B;AACA;AACA,aAAa,OAAO;AACpB;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,SAAS;AACT;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,4CAA4C;AAC5C;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,0CAA0C,iCAAiC;AAC3E;AACA;AACA;AACA,uEAAuE,eAAe;AACtF;AACA;AACA,aAAa;AACb,SAAS;AACT;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,CAAC;;AAED;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA,CAAC;;;;;;;;;;AC5pCD;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,mBAAmB,sBAAsB;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA,wBAAwB,eAAe,EAAE;AACzC,wBAAwB,eAAe,EAAE;AACzC,oCAAoC,qBAAqB;AACzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,qBAAqB,4BAA4B;AACjD;AACA;AACA;AACA;AACA;;AAEA,4CAA4C;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB;AAClB;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB;AAClB,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB,sCAAsC;AAC5D,oCAAoC,yCAAyC;AAC7E;AACA;AACA;;AAEA;AACA;AACA,oCAAoC;AACpC;AACA;AACA;AACA,iBAAiB,oBAAoB;AACrC;AACA;AACA,+BAA+B,UAAU;AACzC,8BAA8B,yCAAyC;AACvE,+BAA+B,qCAAqC;AACpE;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B,sBAAsB;AACnD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,+DAA+D;AAC9E;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,mBAAmB,mBAAmB;AACtC,0DAA0D;AAC1D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY,oBAAoB;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uCAAuC;AACvC,sCAAsC;AACtC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,cAAc;AACd,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB;AAClB;AACA;AACA;AACA,4BAA4B,0BAA0B;AACtD,gCAAgC,wBAAwB;AACxD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP,wBAAwB,qCAAqC;AAC7D,sBAAsB,mCAAmC;AACzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gCAAgC,UAAU;AAC1C;AACA;AACA;AACA,wBAAwB;AACxB;AACA;AACA;AACA;AACA,gCAAgC;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B,KAAK;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL,sEAAsE,kCAAkC;AACxG;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA,YAAY;AACZ;AACA,CAAC;AACD;AACA,YAAY;AACZ;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,qBAAqB,uCAAuC;AAC5D,qBAAqB,mCAAmC;AACxD,sBAAsB,kDAAkD;AACxE;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,eAAe,WAAW;AAC1B,KAAK;AACL;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,KAAK;AACL,2BAA2B,+BAA+B;AAC1D;AACA;AACA,uBAAuB,iBAAiB;AACxC,KAAK;AACL,yBAAyB,eAAe;AACxC;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,mCAAmC;AACnC;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA,KAAK;AACL,wBAAwB,gDAAgD;AACxE;AACA;AACA,WAAW,gBAAgB;AAC3B,eAAe,qBAAqB;AACpC;AACA;AACA;AACA;AACA;AACA,8CAA8C;AAC9C,wBAAwB;AACxB,wBAAwB;AACxB,eAAe;AACf,CAAC;AACD,6CAA6C;AAC7C,gCAAgC;AAChC,CAAC;AACD,aAAa;AACb,qBAAqB;AACrB,UAAU,UAAU;AACpB,oBAAoB;AACpB,cAAc;AACd,qBAAqB;AACrB,mBAAmB;AACnB,cAAc;AACd,CAAC;AACD,iBAAiB;AACjB,gCAAgC;AAChC,SAAS;AACT,CAAC;AACD,oBAAoB;AACpB,6BAA6B;AAC7B,YAAY;AACZ,CAAC;AACD,mBAAmB;AACnB,eAAe;AACf,gBAAgB;AAChB,0BAA0B;AAC1B,cAAc;AACd,iBAAiB;AACjB,yBAAyB;AACzB,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,KAAK,OAAO;AACZ;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,iDAAiD,uCAAuC;AACxF;AACA,iDAAiD,sCAAsC;;AAEvF;AACA,qFAAqF,QAAQ;AAC7F;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;;AAEP;;AAEA;AACA,KAAK;AACL;AACA;AACA;AACA,OAAO;;AAEP;;AAEA;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;;AAEL;AACA;;AAEA;AACA,GAAG;AACH,CAAC;;;AAGD;AACA,KAAK,gDAAgD;AACrD,KAAK,iDAAiD;AACtD,KAAK,8CAA8C;AACnD,KAAK,gDAAgD;AACrD,KAAK,iDAAiD;AACtD,KAAK,gEAAgE;AACrE,KAAK,mDAAmD;AACxD,KAAK,mEAAmE;AACxE,KAAK,mDAAmD;AACxD,KAAK,mEAAmE;AACxE,KAAK,+CAA+C;AACpD,KAAK,+CAA+C;AACpD,KAAK,mDAAmD;AACxD,KAAK,mDAAmD;AACxD,KAAK,sEAAsE;AAC3E,KAAK,sEAAsE;AAC3E,KAAK,+DAA+D;AACpE,KAAK,6DAA6D;AAClE,KAAK,+DAA+D;AACpE,KAAK,gEAAgE;AACrE,KAAK,gDAAgD;AACrD,KAAK,+CAA+C;AACpD,KAAK,sDAAsD;AAC3D,KAAK,wDAAwD;AAC7D,KAAK,kEAAkE;AACvE,KAAK,kEAAkE,oCAAoC;AAC3G,KAAK,qEAAqE,oCAAoC;AAC9G,KAAK,qEAAqE,oCAAoC;AAC9G,KAAK,qEAAqE,kBAAkB;AAC5F,KAAK,qEAAqE,iBAAiB;AAC3F,KAAK,gEAAgE,iCAAiC;AACtG,KAAK,gEAAgE,kCAAkC;AACvG,KAAK,wEAAwE,iBAAiB;AAC9F,KAAK,wEAAwE,kBAAkB;AAC/F,KAAK,gEAAgE,iCAAiC;AACtG,KAAK,gEAAgE,gDAAgD;AACrH,KAAK,gEAAgE,iDAAiD;AACtH,KAAK,gEAAgE,gEAAgE;AACrI,KAAK,gEAAgE,kCAAkC;AACvG,KAAK,gEAAgE,iDAAiD;AACtH,KAAK,iEAAiE,kDAAkD;AACxH,KAAK,iEAAiE,iEAAiE;AACvI,KAAK,SAAS,2DAA2D,oCAAoC;AAC7G,KAAK,SAAS,2DAA2D,mCAAmC;AAC5G,KAAK,mEAAmE,iBAAiB;AACzF,KAAK,mEAAmE,kBAAkB;AAC1F,KAAK,qEAAqE,uCAAuC;AACjH,KAAK,qEAAqE,wCAAwC;AAClH,KAAK,gFAAgF,0EAA0E;AAC/J,KAAK,+EAA+E,yEAAyE;AAC7J,KAAK,yDAAyD;AAC9D,KAAK,yEAAyE;AAC9E,KAAK,gEAAgE,mCAAmC;AACxG,KAAK,gEAAgE,oCAAoC;AACzG,KAAK,gEAAgE,oDAAoD;AACzH,KAAK,8DAA8D,mBAAmB;AACtF,KAAK,wEAAwE,qCAAqC;AAClH,KAAK,+EAA+E,mCAAmC;AACvH,KAAK,+EAA+E,kBAAkB;AACtG,KAAK,iFAAiF,kCAAkC;AACxH,KAAK,iFAAiF,kBAAkB;AACxG,KAAK,SAAS,qEAAqE,iBAAiB;AACpG,KAAK,8EAA8E,kBAAkB;AACrG,KAAK,yEAAyE,kCAAkC;AAChH,KAAK,wEAAwE,kBAAkB;AAC/F,KAAK,gEAAgE,gBAAgB,EAAE;AACvF,KAAK,gEAAgE,iBAAiB,EAAE;AACxF,KAAK,iEAAiE,gCAAgC,EAAE;AACxG,KAAK,iEAAiE,iCAAiC,EAAE;AACzG,KAAK,yEAAyE,+CAA+C;AAC7H,KAAK,yEAAyE,gDAAgD;AAC9H,KAAK,4EAA4E,kCAAkC;AACnH,KAAK,4EAA4E,mCAAmC;AACpH,KAAK,mDAAmD;AACxD,KAAK,kFAAkF;AACvF,KAAK,8EAA8E,eAAe,mBAAmB;AACrH,KAAK,kDAAkD;AACvD,KAAK,gDAAgD;AACrD,KAAK,kDAAkD;AACvD,KAAK,iEAAiE,qBAAqB;AAC3F,KAAK,iEAAiE,sBAAsB;AAC5F,KAAK,uDAAuD;AAC5D,KAAK,sEAAsE,cAAc,gBAAgB;AACzG,KAAK,sEAAsE,eAAe,gBAAgB;AAC1G,KAAK,6DAA6D,mCAAmC;AACrG,KAAK,6DAA6D,oCAAoC;AACtG,KAAK,iGAAiG,gBAAgB,uBAAuB,qBAAqB;AAClK,KAAK,iGAAiG,iBAAiB,uBAAuB,oBAAoB;AAClK,KAAK,0FAA0F,kBAAkB,oBAAoB;AACrI,KAAK,iEAAiE,iBAAiB,oBAAoB;AAC3G,KAAK,wFAAwF,kBAAkB,oBAAoB;AACnI,KAAK,+DAA+D,iBAAiB,oBAAoB;AACzG,KAAK,0FAA0F,kBAAkB,oBAAoB;AACrI,KAAK,iEAAiE,iBAAiB,oBAAoB;AAC3G,KAAK,qGAAqG,gBAAgB,iBAAiB,yBAAyB,oBAAoB;AACxL,KAAK,wEAAwE;AAC7E,KAAK,gGAAgG,iCAAiC,qBAAqB;AAC3J,KAAK,qEAAqE,iBAAiB;AAC3F,KAAK,qEAAqE,kBAAkB;AAC5F,KAAK,+DAA+D,iCAAiC;AACrG,KAAK,+DAA+D,kCAAkC;AACtG,KAAK,kFAAkF,wBAAwB,qBAAqB;AACpI,KAAK,kFAAkF,kBAAkB,qBAAqB;AAC9H,KAAK,kFAAkF,gCAAgC,qBAAqB;AAC5I,KAAK,kFAAkF,sBAAsB,qBAAqB;AAClI,KAAK,kFAAkF,2BAA2B,qBAAqB;AACvI,KAAK,kFAAkF,kCAAkC,qBAAqB;AAC9I,KAAK,yHAAyH,cAAc,qBAAqB;AACjK,KAAK,yHAAyH,eAAe,qBAAqB;AAClK,KAAK,wDAAwD;AAC7D,KAAK,qEAAqE,kBAAkB;AAC5F,KAAK,yEAAyE,mBAAmB;AACjG,KAAK,yEAAyE,mBAAmB;AACjG,KAAK,8DAA8D;AACnE,KAAK,+DAA+D;AACpE,KAAK,wEAAwE,6BAA6B;AAC1G,KAAK,wEAAwE,8BAA8B;AAC3G,KAAK,wEAAwE;AAC7E,KAAK,8DAA8D;AACnE,KAAK,uEAAuE;AAC5E,KAAK,kFAAkF,iBAAiB;AACxG,KAAK,+DAA+D;AACpE,KAAK,qEAAqE,cAAc,mCAAmC;AAC3H,KAAK,qEAAqE,eAAe,mCAAmC;AAC5H,KAAK,gDAAgD;AACrD,KAAK,0DAA0D;AAC/D,KAAK,8DAA8D;AACnE,KAAK,oEAAoE,sBAAsB;AAC/F,KAAK,oEAAoE,qBAAqB,+CAA+C;AAC7I,KAAK,oEAAoE,mBAAmB;AAC5F,KAAK,uEAAuE,kBAAkB,+CAA+C;AAC7I,KAAK,oEAAoE,sBAAsB;AAC/F,KAAK,oEAAoE,qBAAqB,+CAA+C;AAC7I,KAAK,sDAAsD;AAC3D,KAAK,2FAA2F,kCAAkC;AAClI,KAAK,2FAA2F,mCAAmC;AACnI,KAAK,yEAAyE;AAC9E,KAAK,sFAAsF,yBAAyB;AACpH,KAAK,yCAAyC,uDAAuD;AACrG,KAAK,yCAAyC,wDAAwD;AACtG,KAAK,yCAAyC,qFAAqF;AACnI,KAAK,yCAAyC,sFAAsF;AACpI,KAAK,0CAA0C,gEAAgE;AAC/G,KAAK,0CAA0C,iEAAiE;AAChH,KAAK;AACL;AACA;AACA,KAAK,yCAAyC;AAC9C,KAAK,cAAc;AACnB,KAAK,gCAAgC;AACrC,KAAK,gCAAgC;AACrC,KAAK,gCAAgC;AACrC,KAAK,gBAAgB;AACrB,KAAK,gCAAgC;AACrC,KAAK,+BAA+B;AACpC,KAAK,iCAAiC;AACtC,KAAK,+BAA+B;AACpC,KAAK,+BAA+B;AACpC,KAAK,sCAAsC;AAC3C,KAAK,uCAAuC;AAC5C,KAAK,iCAAiC;AACtC,KAAK,0DAA0D;AAC/D,KAAK,uCAAuC;AAC5C,KAAK,sCAAsC;AAC3C,KAAK,uEAAuE;AAC5E,KAAK;AACL;;AAEA;;AAEA,wBAAwB,eAAe,EAAE;AACzC;AACA;AACA;AACA,gDAAgD,eAAe;AAC/D;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA,gBAAgB,kBAAkB;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,qBAAqB;AACrB,uBAAuB;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA,qBAAqB,mBAAmB;AACxC;AACA,iCAAiC,8BAA8B;AAC/D,cAAc,qBAAqB;AACnC,mCAAmC,gCAAgC;AACnE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,0CAA0C;AAC1C;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;AACA,yBAAyB,kBAAkB;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB,gBAAgB;AACrC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,kBAAkB,iBAAiB;AACnC;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,oBAAoB;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA,wCAAwC;AACxC;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA,4DAA4D;AAC5D;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2CAA2C;AAC3C;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wDAAwD,YAAY;AACpE;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gCAAgC,gDAAgD;AAChF,qDAAqD;AACrD,yDAAyD;AACzD,6DAA6D;AAC7D;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA,OAAO;AACP;AACA;AACA;AACA,OAAO;AACP;;AAEA;;AAEA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,iDAAiD;AACjD,OAAO;AACP;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,4BAA4B,aAAa;AACzC;AACA;AACA;AACA;AACA;AACA;AACA,2CAA2C,mBAAmB;AAC9D;AACA,qCAAqC,qBAAqB,cAAc;AACxE;AACA,yCAAyC,6CAA6C;AACtF;AACA,0BAA0B,kDAAkD,qBAAqB,EAAE,EAAE;AACrG;AACA;AACA;;AAEA,uCAAuC,6CAA6C;AACpF;AACA;AACA,2BAA2B,uBAAuB;AAClD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,sDAAsD,aAAa;;AAEnE;AACA,wCAAwC,aAAa;;AAErD;AACA,6BAA6B,qBAAqB,cAAc;AAChE;AACA;AACA;AACA,qCAAqC,qBAAqB,cAAc;AACxE,6CAA6C,aAAa;;AAE1D;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,6BAA6B,iCAAiC;AAC9D,cAAc,oCAAoC;AAClD;AACA;AACA,SAAS;AACT,6BAA6B,aAAa;AAC1C,SAAS;AACT;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA,eAAe;AACf;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,OAAO;AACP;AACA;AACA,OAAO;;AAEP;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,0BAA0B;AAC1B,+BAA+B;AAC/B;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA,OAAO;AACP;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe;AACf;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA,OAAO;AACP;AACA,uBAAuB,QAAQ;AAC/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yCAAyC,wCAAwC;AACjF;AACA,yBAAyB,qBAAqB;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB;AAClB,SAAS;AACT,kBAAkB;AAClB;;AAEA;AACA,uBAAuB,yBAAyB;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+CAA+C;AAC/C;AACA;AACA,gBAAgB;AAChB,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA,qCAAqC;AACrC;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB;AACzB,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA,eAAe;AACf;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA,4BAA4B;AAC5B,2CAA2C;AAC3C,WAAW;AACX,4BAA4B;AAC5B,2CAA2C;AAC3C;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qEAAqE;AACrE;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA,aAAa;AACb;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,+BAA+B,mBAAmB;AAClD;AACA;AACA,eAAe;AACf;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,uCAAuC;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA,uCAAuC,QAAQ;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA,wCAAwC,4EAA4E;AACpH;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,OAAO;AACP;AACA;AACA,uBAAuB,uBAAuB;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8BAA8B;AAC9B;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,OAAO;AACP;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA,6BAA6B;AAC7B,+BAA+B,KAAK,KAAK,KAAK;AAC9C;AACA,0BAA0B;;AAE1B;AACA;AACA;AACA,SAAS;AACT,wBAAwB;AACxB;AACA;;AAEA;AACA;AACA;AACA,SAAS;AACT;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,kCAAkC,uBAAuB;AACzD,WAAW;AACX;AACA,+BAA+B,8BAA8B;AAC7D;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;AACA,SAAS;AACT;AACA;AACA,OAAO;;AAEP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,qBAAqB,WAAW;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qCAAqC,gBAAgB;AACrD,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B,cAAc;AAC7C,yBAAyB,YAAY;AACrC;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA,uBAAuB,uBAAuB;AAC9C;AACA;AACA;AACA;AACA,WAAW;AACX;AACA,WAAW;AACX,2BAA2B,mBAAmB;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA,SAAS;AACT;AACA,SAAS;AACT;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,+DAA+D;AAC/D,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA,OAAO;AACP;AACA,uCAAuC,QAAQ;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA,SAAS;AACT;AACA,SAAS;AACT;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oDAAoD,gBAAgB;AACpE,SAAS;AACT;AACA,oDAAoD,eAAe;AACnE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oDAAoD,0FAA0F;AAC9I;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,oDAAoD,0FAA0F;AAC9I;AACA,SAAS;AACT;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wDAAwD;AACxD;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA,mCAAmC,iBAAiB;AACpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kCAAkC,4BAA4B;AAC9D,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA,WAAW;AACX;AACA;AACA,SAAS;AACT;AACA;AACA,2BAA2B,iBAAiB;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,2BAA2B,iBAAiB;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA,SAAS;AACT,OAAO;AACP;AACA;AACA,OAAO;AACP;AACA;AACA,OAAO;AACP;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,OAAO;AACP;AACA;AACA,kCAAkC,QAAQ;AAC1C;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,OAAO;AACP;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB,mBAAmB;AACxC;AACA;AACA;AACA;AACA,0DAA0D,UAAU;AACpE,iCAAiC,uBAAuB;AACxD,8BAA8B,oBAAoB;AAClD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,YAAY;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2CAA2C;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,yBAAyB,UAAU;AACnC,OAAO;AACP;AACA,0BAA0B,UAAU;AACpC,OAAO;AACP;AACA;AACA;AACA,gCAAgC,kBAAkB;AAClD,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB,YAAY;AACjC;AACA,kBAAkB,iCAAiC;AACnD;AACA;AACA;AACA;AACA,qBAAqB,mBAAmB;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2CAA2C,uBAAuB;AAClE;AACA;AACA,yBAAyB;AACzB;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,0BAA0B;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB,2BAA2B;AAC/C;AACA;AACA,OAAO;AACP;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,oBAAoB,2BAA2B;AAC/C;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,YAAY;AACnC;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gDAAgD,eAAe;AAC/D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oCAAoC,sDAAsD;AAC1F;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iCAAiC,aAAa;AAC9C;;AAEA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;;AAEA;AACA,2DAA2D,OAAO;AAClE,sDAAsD,SAAS;AAC/D;;AAEA;AACA;AACA,kEAAkE,OAAO;AACzE;AACA;AACA,kEAAkE,SAAS;AAC3E,uBAAuB,mBAAmB;AAC1C;AACA;AACA,cAAc;AACd;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,0CAA0C,gBAAgB;AAC1D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA,sEAAsE,MAAM;AAC5E,SAAS;AACT;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA,+CAA+C,MAAM;AACrD,+CAA+C,MAAM,MAAM;AAC3D,SAAS;AACT;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kCAAkC,aAAa,KAAK,GAAG,IAAI,aAAa,KAAK,GAAG;AAChF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,aAAa;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,kBAAkB;AAClB;AACA;AACA;AACA;AACA;AACA,yBAAyB,oCAAoC;AAC7D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe;AACf;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB,YAAY;AACjC;AACA;AACA;AACA;AACA,iBAAiB;AACjB,iBAAiB,wBAAwB;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA,OAAO;AACP;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,qBAAqB,YAAY;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,2BAA2B,kCAAkC,EAAE;AAC/D;AACA,kBAAkB,uCAAuC;AACzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mCAAmC,UAAU;AAC7C;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB,oBAAoB;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mCAAmC,mBAAmB;AACtD,YAAY,mBAAmB;AAC/B,oBAAoB,SAAS;AAC7B;AACA,wCAAwC,OAAO;AAC/C;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;;AAEA;AACA;AACA;AACA,UAAU,OAAO,MAAM,OAAO,GAAG;AACjC;AACA;AACA;AACA,UAAU,KAAK,KAAK,KAAK,EAAE;AAC3B;AACA;;AAEA,2EAA2E,8BAA8B;AACzG,wEAAwE,8BAA8B;;AAEtG;AACA,gBAAgB;AAChB;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,OAAO;AACP;AACA;;AAEA,cAAc;AACd;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB,iBAAiB;AACjB;AACA;AACA,2BAA2B;AAC3B,OAAO;AACP,wBAAwB,kBAAkB;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA,2CAA2C,iBAAiB;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA,gBAAgB;AAChB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA,OAAO;AACP;AACA;AACA,OAAO;AACP;AACA;AACA,OAAO;AACP;AACA;AACA,OAAO;AACP;AACA;AACA,OAAO;AACP;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0CAA0C;AAC1C;AACA,qCAAqC;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB,oBAAoB;AACzC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,qBAAqB,gBAAgB;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B;AAC1B,uBAAuB;AACvB;AACA;AACA,sBAAsB,gBAAgB;AACtC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB;AACzB;AACA;AACA;AACA,sBAAsB,gBAAgB;AACtC;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oCAAoC,cAAc;AAClD;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B,6BAA6B;AAC1D,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB,kBAAkB;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iCAAiC,YAAY;AAC7C;AACA;AACA;AACA,uBAAuB,YAAY;AACnC;AACA,mEAAmE,2BAA2B;AAC9F;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B,2BAA2B;AACxD;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA,wCAAwC,OAAO;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA,uBAAuB,gCAAgC;AACvD;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA,oBAAoB,mDAAmD;AACvE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,uBAAuB,0BAA0B;AACjD;AACA,sBAAsB,uBAAuB;AAC7C;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB,uBAAuB;AAC7C;AACA;AACA;AACA,OAAO;AACP;AACA;AACA,oBAAoB,mDAAmD;AACvE;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA,yBAAyB,0BAA0B;AACnD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP,kCAAkC,gCAAgC,EAAE;AACpE,kCAAkC,gCAAgC,EAAE;AACpE,kCAAkC,gCAAgC,EAAE;AACpE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA,yBAAyB;AACzB,8BAA8B;AAC9B,0CAA0C;AAC1C,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,sBAAsB,yDAAyD;AAC/E;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA,SAAS;AACT;AACA;AACA,OAAO;AACP;AACA,yBAAyB;AACzB;AACA,OAAO;AACP;AACA,yBAAyB;AACzB;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,yBAAyB,oBAAoB;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA,gCAAgC,gBAAgB;AAChD,6BAA6B,QAAQ;AACrC,mCAAmC,4BAA4B;AAC/D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8CAA8C,4BAA4B;AAC1E;AACA;AACA,uCAAuC,iCAAiC;AACxE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mCAAmC,QAAQ;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB,iBAAiB;AAC1C;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,wBAAwB,SAAS,SAAS,OAAO,SAAS;AAC1D,2BAA2B,qBAAqB,qBAAqB;AACrE;AACA;AACA,sBAAsB,uBAAuB;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA,yBAAyB,oBAAoB;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B,cAAc;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B;AAC5B,2BAA2B;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,OAAO;AACP;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B,qBAAqB;AAClD;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB,SAAS;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,YAAY;AACnC;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB,QAAQ;AAC9B;AACA,mBAAmB;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,aAAa;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,YAAY;AACnC;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,gCAAgC;AAChC;AACA,gDAAgD,eAAe;AAC/D;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB,sBAAsB;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,qCAAqC,QAAQ;AAC7C;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,qCAAqC,QAAQ;AAC7C;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,qCAAqC,QAAQ;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uCAAuC,QAAQ;AAC/C;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8CAA8C,mCAAmC;AACjF;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA,kDAAkD,eAAe;AACjE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB,QAAQ;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,YAAY;AACnC;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB,YAAY;AACjC;AACA;AACA;AACA,uBAAuB,oBAAoB;AAC3C;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA,oBAAoB;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB,cAAc;AAClC,mBAAmB,cAAc;AACjC,qBAAqB,cAAc;;AAEnC;AACA,0BAA0B,yBAAyB;AACnD;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,O;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA,sCAAsC;AACtC;AACA;AACA;AACA,WAAW;AACX,kBAAkB;AAClB;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,iDAAiD;AACjD;AACA;AACA;AACA,yBAAyB;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB;AAChB;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA,SAAS;AACT;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe;AACf,KAAK;AACL;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH;AACA,KAAK,0DAA0D,cAAc,EAAE;AAC/E,KAAK,0DAA0D,yBAAyB,EAAE;AAC1F,KAAK,0DAA0D,aAAa,EAAE;AAC9E,KAAK,0DAA0D,wBAAwB,EAAE;AACzF,KAAK,0DAA0D,eAAe,EAAE;AAChF,KAAK,0DAA0D,0BAA0B,EAAE;AAC3F,KAAK,0DAA0D,wBAAwB,EAAE;AACzF,KAAK,0DAA0D,wBAAwB,EAAE;;AAEzF,KAAK,qEAAqE,yBAAyB,EAAE;AACrG,KAAK,qEAAqE,yBAAyB,EAAE;AACrG,KAAK,uEAAuE,oCAAoC,EAAE;AAClH,KAAK,uEAAuE,oCAAoC,EAAE;AAClH,KAAK,qEAAqE,2BAA2B,EAAE;AACvG,KAAK,qEAAqE,0BAA0B,EAAE;AACtG,KAAK,uEAAuE,2BAA2B,EAAE;AACzG,KAAK,uEAAuE,0BAA0B;AACtG;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,CAAC;;;;;;;;;;AC79KD;;AAEA;AACA;AACA;AACA,wBAAwB;AACxB,oBAAoB;AACpB;AACA,CAAC;AACD,8BAA8B;AAC9B,WAAW;AACX;AACA,CAAC;AACD,YAAY;AACZ,0BAA0B;AAC1B;AACA,CAAC;AACD,wBAAwB;AACxB;AACA,CAAC;AACD,6CAA6C;AAC7C;AACA,CAAC;AACD,qDAAqD;AACrD,gCAAgC;AAChC,CAAC;AACD,wCAAwC;AACxC;AACA,CAAC;AACD,2CAA2C;AAC3C,sBAAsB;AACtB;AACA,CAAC;AACD,+CAA+C;AAC/C;AACA,CAAC;AACD,oCAAoC;AACpC;AACA,CAAC;AACD,iDAAiD;AACjD;AACA,CAAC;AACD;AACA;AACA;AACA,uCAAuC;AACvC;AACA,CAAC;AACD,2BAA2B;AAC3B;AACA,CAAC;AACD;AACA,oCAAoC;AACpC;AACA,CAAC;AACD,sCAAsC;AACtC;AACA,CAAC;AACD;AACA;AACA,sCAAsC;AACtC;AACA,CAAC;AACD,sBAAsB;AACtB,0BAA0B;AAC1B;AACA,CAAC;AACD;AACA;AACA,kCAAkC;AAClC;AACA,CAAC;AACD,yBAAyB;AACzB;AACA,CAAC;AACD,wBAAwB;AACxB;AACA,CAAC;AACD,yBAAyB;AACzB;AACA,CAAC;AACD,8BAA8B;AAC9B,+BAA+B;AAC/B,CAAC;;AAED;AACA;AACA,CAAC;;;;;;;;;;ACvFD;;AAEA;AACA;AACA,8CAA8C;AAC9C,oBAAoB;AACpB;AACA,CAAC;AACD,iCAAiC;AACjC,WAAW;AACX;AACA,CAAC;AACD,eAAe;AACf,0BAA0B;AAC1B;AACA,CAAC;AACD,2BAA2B;AAC3B;AACA,CAAC;AACD,gDAAgD;AAChD;AACA,CAAC;AACD,wDAAwD;AACxD,gCAAgC;AAChC,CAAC;AACD,2CAA2C;AAC3C;AACA,CAAC;AACD,8CAA8C;AAC9C,sBAAsB;AACtB;AACA,CAAC;AACD,kDAAkD;AAClD;AACA,CAAC;AACD,uCAAuC;AACvC;AACA,CAAC;AACD,oDAAoD;AACpD;AACA,CAAC;AACD,8BAA8B;AAC9B;AACA,CAAC;AACD;AACA,yBAAyB;AACzB;AACA,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA,yCAAyC;AACzC;AACA,CAAC;AACD,wCAAwC;AACxC,eAAe;AACf;AACA,CAAC;AACD,2CAA2C;AAC3C,2BAA2B;AAC3B,mBAAmB;AACnB;AACA,CAAC;AACD,4BAA4B;AAC5B;AACA,CAAC;AACD,yBAAyB;AACzB,0BAA0B;AAC1B;AACA,CAAC;AACD,yCAAyC;AACzC;AACA,CAAC;AACD;AACA;AACA,4BAA4B;AAC5B;AACA,CAAC;AACD;AACA;AACA,6BAA6B;AAC7B;AACA,CAAC;AACD,2BAA2B;AAC3B;AACA,CAAC;AACD,sCAAsC;AACtC;AACA,CAAC;AACD,4BAA4B;AAC5B,mBAAmB;AACnB;AACA,CAAC;AACD,6BAA6B;AAC7B;AACA,CAAC;AACD,2BAA2B;AAC3B;AACA,CAAC;AACD,iCAAiC;AACjC,+BAA+B;AAC/B,CAAC;;AAED;AACA;AACA,CAAC;;;;;;;;;;AC5GD;;AAEA;AACA;AACA,oDAAoD;AACpD,oBAAoB;AACpB;AACA,CAAC;AACD,uCAAuC;AACvC,WAAW;AACX;AACA,CAAC;AACD,qBAAqB;AACrB,wBAAwB;AACxB;AACA,CAAC;AACD,iCAAiC;AACjC;AACA,CAAC;AACD,sDAAsD;AACtD;AACA,CAAC;AACD,8DAA8D;AAC9D,8BAA8B;AAC9B,CAAC;AACD,iDAAiD;AACjD;AACA,CAAC;AACD,oDAAoD;AACpD,iBAAiB;AACjB,CAAC;AACD,0DAA0D;AAC1D,iBAAiB;AACjB,CAAC;AACD,8DAA8D;AAC9D,sBAAsB;AACtB;AACA,CAAC;AACD,wDAAwD;AACxD;AACA,CAAC;AACD,6CAA6C;AAC7C;AACA,CAAC;AACD,0DAA0D;AAC1D;AACA,CAAC;AACD,oCAAoC;AACpC;AACA,CAAC;AACD;AACA;AACA;AACA;AACA,2CAA2C;AAC3C;AACA,CAAC;AACD,+CAA+C;AAC/C;AACA,CAAC;AACD;AACA;AACA;AACA;AACA;AACA,iDAAiD;AACjD;AACA,CAAC;AACD,6CAA6C;AAC7C;AACA,CAAC;AACD,kCAAkC;AAClC,cAAc;AACd;AACA,CAAC;AACD,iDAAiD;AACjD,eAAe;AACf;AACA,CAAC;AACD,+BAA+B;AAC/B,0BAA0B;AAC1B;AACA,CAAC;AACD;AACA;AACA,mCAAmC;AACnC;AACA,CAAC;AACD;AACA,2CAA2C;AAC3C;AACA,CAAC;AACD;AACA,iCAAiC;AACjC;AACA,CAAC;AACD;AACA;AACA;AACA;AACA,mCAAmC;AACnC;AACA,CAAC;AACD,kCAAkC;AAClC;AACA,CAAC;AACD,uCAAuC;AACvC,+BAA+B,4HAA4H;AAC3J,CAAC;AACD;;AAEA;AACA;AACA,CAAC;;;;;;;;;;ACjHD;;AAEA;AACA;AACA,qDAAqD;AACrD,oBAAoB;AACpB;AACA,CAAC;AACD,wCAAwC;AACxC,WAAW;AACX;AACA,CAAC;AACD,sBAAsB;AACtB,0BAA0B;AAC1B;AACA,CAAC;AACD,kCAAkC;AAClC;AACA,CAAC;AACD,uDAAuD;AACvD;AACA,CAAC;AACD,+DAA+D;AAC/D,gCAAgC;AAChC,CAAC;AACD,kDAAkD;AAClD;AACA,CAAC;AACD,qDAAqD;AACrD,sBAAsB;AACtB;AACA,CAAC;AACD,yDAAyD;AACzD;AACA,CAAC;AACD,8CAA8C;AAC9C;AACA,CAAC;AACD,2DAA2D;AAC3D;AACA,CAAC;AACD,qCAAqC;AACrC;AACA,CAAC;AACD;AACA;AACA;AACA,4CAA4C;AAC5C;AACA,CAAC;AACD;AACA,8CAA8C;AAC9C;AACA,CAAC;AACD,iDAAiD;AACjD;AACA,CAAC;AACD,gDAAgD;AAChD;AACA,CAAC;AACD,gCAAgC;AAChC,0BAA0B;AAC1B;AACA,CAAC;AACD;AACA;AACA;AACA;AACA,iDAAiD;AACjD;AACA,CAAC;AACD,mCAAmC;AACnC;AACA,CAAC;AACD,kCAAkC;AAClC;AACA,CAAC;AACD,6CAA6C;AAC7C;AACA,CAAC;AACD;AACA,+DAA+D;AAC/D;AACA,CAAC;AACD,wCAAwC;AACxC,+BAA+B;AAC/B,CAAC;;AAED;AACA;AACA,CAAC;;;;;;;;;;AC1FD;;AAEA;AACA;AACA,oDAAoD;AACpD,oBAAoB;AACpB;AACA,CAAC;AACD,uCAAuC;AACvC,WAAW;AACX;AACA,CAAC;AACD,qBAAqB;AACrB,0BAA0B;AAC1B;AACA,CAAC;AACD;AACA,kCAAkC;AAClC;AACA,CAAC;AACD;AACA,4CAA4C;AAC5C;AACA,CAAC;AACD;AACA,sDAAsD;AACtD;AACA,CAAC;AACD,8DAA8D;AAC9D,gCAAgC;AAChC,CAAC;AACD,iDAAiD;AACjD;AACA,CAAC;AACD,oDAAoD;AACpD,sBAAsB;AACtB;AACA,CAAC;AACD,6CAA6C;AAC7C;AACA,CAAC;AACD,0DAA0D;AAC1D;AACA,CAAC;AACD,oCAAoC;AACpC;AACA,CAAC;AACD;AACA;AACA;AACA,2CAA2C;AAC3C;AACA,CAAC;AACD;AACA,6CAA6C;AAC7C;AACA,CAAC;AACD,gDAAgD;AAChD;AACA,CAAC;AACD,+CAA+C;AAC/C;AACA,CAAC;AACD,+BAA+B;AAC/B,0BAA0B;AAC1B;AACA,CAAC;AACD;AACA;AACA;AACA;AACA,gDAAgD;AAChD;AACA,CAAC;AACD,iCAAiC;AACjC;AACA,CAAC;AACD,kCAAkC;AAClC,mBAAmB;AACnB;AACA,CAAC;AACD,uCAAuC;AACvC,+BAA+B;AAC/B,CAAC;;AAED;AACA;AACA,CAAC;;;;;;;;;;ACvFD;;AAEA;AACA;AACA,6CAA6C;AAC7C,oBAAoB;AACpB;AACA,CAAC;AACD,gCAAgC;AAChC,WAAW;AACX;AACA,CAAC;AACD,cAAc;AACd,0BAA0B;AAC1B;AACA,CAAC;AACD,0BAA0B;AAC1B;AACA,CAAC;AACD,+CAA+C;AAC/C;AACA,CAAC;AACD,uDAAuD;AACvD,gCAAgC;AAChC,CAAC;AACD,0CAA0C;AAC1C;AACA,CAAC;AACD,6CAA6C;AAC7C,sBAAsB;AACtB;AACA,CAAC;AACD,iDAAiD;AACjD;AACA,CAAC;AACD,sCAAsC;AACtC;AACA,CAAC;AACD,mDAAmD;AACnD;AACA,CAAC;AACD,6BAA6B;AAC7B;AACA,CAAC;AACD;AACA;AACA;AACA,2BAA2B;AAC3B;AACA,CAAC;AACD;AACA,uCAAuC;AACvC;AACA,CAAC;AACD;AACA;AACA;AACA,sCAAsC;AACtC;AACA,CAAC;AACD,2BAA2B;AAC3B,eAAe;AACf;AACA,CAAC;AACD,0CAA0C;AAC1C,eAAe;AACf;AACA,CAAC;AACD;AACA,wCAAwC;AACxC;AACA,CAAC;AACD,wBAAwB;AACxB,0BAA0B;AAC1B;AACA,CAAC;AACD;AACA;AACA,oCAAoC;AACpC,mBAAmB;AACnB;AACA,CAAC;AACD;AACA;AACA;AACA,4BAA4B;AAC5B;AACA,CAAC;AACD,0CAA0C;AAC1C,mBAAmB;AACnB;AACA,CAAC;AACD,0BAA0B;AAC1B;AACA,CAAC;AACD,2BAA2B;AAC3B;AACA,CAAC;AACD,gCAAgC;AAChC,+BAA+B;AAC/B,CAAC;;AAED;AACA;AACA,CAAC;;;;;;;;;;ACxGD;;AAEA;AACA;AACA,4CAA4C;AAC5C,oBAAoB;AACpB,YAAY;AACZ,kBAAkB;AAClB,CAAC;AACD,+BAA+B;AAC/B,WAAW;AACX,oBAAoB;AACpB,CAAC;AACD,aAAa;AACb,0BAA0B;AAC1B,aAAa;AACb,CAAC;AACD,yBAAyB;AACzB,aAAa;AACb,CAAC;AACD,4BAA4B;AAC5B,0BAA0B;AAC1B,CAAC;AACD,uCAAuC;AACvC,wBAAwB;AACxB,CAAC;AACD,wCAAwC;AACxC,wBAAwB;AACxB,CAAC;AACD,uCAAuC;AACvC,uBAAuB;AACvB,CAAC;AACD,0BAA0B;AAC1B,iCAAiC;AACjC,aAAa;AACb,CAAC;AACD,uBAAuB;AACvB,CAAC;AACD,uCAAuC;AACvC,wBAAwB;AACxB,CAAC;AACD,uCAAuC;AACvC,uBAAuB;AACvB,CAAC;AACD;AACA;AACA,oCAAoC;AACpC,0BAA0B;AAC1B,CAAC;AACD,yCAAyC;AACzC,kBAAkB;AAClB,cAAc;AACd,CAAC;AACD,uCAAuC;AACvC,0BAA0B;AAC1B,CAAC;AACD,0BAA0B;AAC1B,eAAe;AACf,CAAC;AACD,kCAAkC;AAClC,eAAe;AACf,CAAC;AACD,0CAA0C;AAC1C,eAAe;AACf,CAAC;AACD,uCAAuC;AACvC,sBAAsB;AACtB,CAAC;AACD,2BAA2B;AAC3B,yBAAyB;AACzB,CAAC;AACD,yBAAyB;AACzB,yBAAyB;AACzB,CAAC;AACD,+CAA+C;AAC/C,eAAe;AACf,CAAC;AACD,0BAA0B;AAC1B,uBAAuB;AACvB,CAAC;AACD,uBAAuB;AACvB,uBAAuB;AACvB,CAAC;AACD,8CAA8C;AAC9C,+BAA+B;AAC/B,CAAC;AACD,yCAAyC;AACzC,6BAA6B;AAC7B,CAAC;AACD,0CAA0C;AAC1C,+BAA+B;AAC/B,CAAC;AACD,4CAA4C;AAC5C,sBAAsB;AACtB,qCAAqC;AACrC,CAAC;AACD,gDAAgD;AAChD,gCAAgC;AAChC,CAAC;AACD,qCAAqC;AACrC,2BAA2B;AAC3B,CAAC;AACD,kDAAkD;AAClD,+BAA+B;AAC/B,qCAAqC;AACrC,CAAC;AACD;AACA;AACA,+BAA+B;AAC/B,yBAAyB;AACzB,CAAC;AACD,mCAAmC;AACnC;AACA,CAAC;AACD,yBAAyB;AACzB,eAAe;AACf,CAAC;AACD,sDAAsD;AACtD,eAAe;AACf,CAAC;AACD,+BAA+B;AAC/B,iCAAiC,kIAAkI;AACnK,CAAC;AACD;;AAEA;AACA;AACA,CAAC;;;;;;;;;;AC/HD;;AAEA;AACA;AACA,2CAA2C;AAC3C,oBAAoB;AACpB,eAAe;AACf,gCAAgC;AAChC,CAAC;AACD,yCAAyC;AACzC,uBAAuB;AACvB,iBAAiB;AACjB,kBAAkB;AAClB,gBAAgB;AAChB,YAAY;AACZ,CAAC;AACD,uCAAuC;AACvC,iCAAiC;AACjC,uBAAuB;AACvB,iBAAiB;AACjB,kBAAkB;AAClB,gBAAgB;AAChB,YAAY;AACZ,CAAC;AACD,8BAA8B;AAC9B,4BAA4B;AAC5B,SAAS;AACT,oBAAoB;AACpB,CAAC;AACD,YAAY;AACZ,0BAA0B;AAC1B,eAAe;AACf,CAAC;AACD,wBAAwB;AACxB,+BAA+B;AAC/B,CAAC;AACD,sCAAsC;AACtC,iBAAiB;AACjB,iCAAiC;AACjC,CAAC;AACD,6CAA6C;AAC7C,oBAAoB;AACpB,CAAC;AACD,wCAAwC;AACxC,+BAA+B;AAC/B,CAAC;AACD,2CAA2C;AAC3C,sBAAsB;AACtB,0BAA0B;AAC1B,CAAC;AACD,+CAA+C;AAC/C,iBAAiB;AACjB,CAAC;AACD,oCAAoC;AACpC,uBAAuB;AACvB,CAAC;AACD,2BAA2B;AAC3B,eAAe;AACf,CAAC;AACD,yBAAyB;AACzB,cAAc;AACd,CAAC;AACD,sCAAsC;AACtC,cAAc;AACd,CAAC;AACD,0BAA0B;AAC1B,cAAc;AACd,CAAC;AACD,uCAAuC;AACvC,cAAc;AACd,CAAC;AACD,sCAAsC;AACtC,cAAc;AACd,CAAC;AACD,sCAAsC;AACtC,cAAc;AACd,CAAC;AACD,yBAAyB;AACzB,cAAc;AACd,yBAAyB;AACzB,CAAC;AACD,wCAAwC;AACxC,cAAc;AACd,yBAAyB;AACzB,CAAC;AACD,yBAAyB;AACzB,YAAY;AACZ,CAAC;AACD,sCAAsC;AACtC,cAAc;AACd,CAAC;AACD,0BAA0B;AAC1B,cAAc;AACd,CAAC;AACD,wBAAwB;AACxB,cAAc;AACd,CAAC;AACD,yBAAyB;AACzB,WAAW;AACX,kBAAkB;AAClB,oBAAoB;AACpB,CAAC;AACD,0BAA0B;AAC1B,cAAc;AACd,CAAC;AACD,8BAA8B;AAC9B,cAAc;AACd,CAAC;AACD,qDAAqD;AACrD,cAAc;AACd,CAAC;AACD,sCAAsC;AACtC,2BAA2B;AAC3B,CAAC;AACD,6BAA6B;AAC7B,mBAAmB;AACnB,CAAC;AACD,mCAAmC;AACnC,YAAY;AACZ,CAAC;AACD;AACA;AACA,uCAAuC;AACvC,iBAAiB;AACjB,aAAa;AACb,iBAAiB;AACjB,CAAC;AACD,6CAA6C;AAC7C;AACA,CAAC;AACD,2CAA2C;AAC3C;AACA,CAAC;AACD,8CAA8C;AAC9C;AACA,CAAC;AACD,8BAA8B;AAC9B,6BAA6B;AAC7B,kBAAkB;AAClB,CAAC;AACD,sBAAsB;AACtB,iBAAiB;AACjB,mBAAmB;AACnB,YAAY;AACZ,aAAa;AACb,CAAC;AACD,4BAA4B;AAC5B,iBAAiB;AACjB,YAAY;AACZ,CAAC;AACD;;AAEA;AACA;;AAEA,CAAC;;;;;;;;;;AC3JD;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA,CAAC;;AAED;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA,yCAAyC,EAAE;AAC3C,sBAAsB,EAAE;AACxB,WAAW,YAAY,KAAK;AAC5B,oBAAoB,IAAI;AACxB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,aAAa;AACb;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,aAAa;AACb;AACA;AACA,aAAa;AACb;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,aAAa;AACb;AACA,oCAAoC,EAAE;AACtC;AACA,aAAa;AACb;AACA,8BAA8B;AAC9B;AACA,aAAa;AACb;AACA,8BAA8B;AAC9B;AACA,aAAa;AACb;AACA,8BAA8B;AAC9B,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,aAAa;AACb;AACA;AACA,aAAa;AACb;AACA;AACA,aAAa;AACb;AACA;AACA,aAAa;AACb;AACA;AACA,aAAa;AACb;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4CAA4C,EAAE,cAAc,EAAE;AAC9D,aAAa;AACb;AACA;AACA;AACA,aAAa;AACb;AACA,0BAA0B,YAAY,4BAA4B,GAAG;AACrE,aAAa;AACb;AACA,uCAAuC,YAAY;AACnD,aAAa;AACb;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA,4CAA4C,EAAE,cAAc,EAAE;AAC9D,aAAa;AACb;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,aAAa;AACb;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;;;AAGA;AACA;AACA,uBAAuB;AACvB,qCAAqC;AACrC,6BAA6B;AAC7B;AACA;AACA,kCAAkC;AAClC;AACA;AACA;AACA;AACA;AACA,gCAAgC;AAChC,aAAa;AACb;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA,4BAA4B;AAC5B;AACA,aAAa;AACb;AACA;AACA;AACA,aAAa;AACb;AACA,aAAa;AACb,SAAS;;AAET;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,aAAa;AACb,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,sBAAsB;AAC/B,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB,+BAA+B;AACpD,SAAS;AACT;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,aAAa,8DAA8D;AAC3E,aAAa,sBAAsB;AACnC,aAAa;AACb;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,aAAa,8DAA8D;AAC3E,aAAa,sBAAsB;AACnC,aAAa;AACb;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,6BAA6B,qBAAqB,yBAAyB;AAC3E,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,0DAA0D;AAC3E,iBAAiB;AACjB;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,iBAAiB,uDAAuD;AACxE,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;;AAEA,sBAAsB;AACtB;;AAEA;AACA;AACA,uCAAuC;;AAEvC;;AAEA;AACA,oDAAoD,yBAAyB;;AAE7E;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,CAAC;;AAED;AACA,CAAC;;AAED;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,kCAAkC,QAAQ;AAC1C,qCAAqC,KAAK;AAC1C;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA,2BAA2B;;AAE3B;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,iBAAiB;AACjB;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,CAAC;;AAED,CAAC;;AAED;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA,yBAAyB;;AAEzB;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,yDAAyD;AACzD;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,SAAS;;AAET;AACA;AACA,SAAS;;AAET;AACA;;AAEA;AACA,CAAC;;AAED;AACA,CAAC;;;;;;;;;;ACjzBD;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA,CAAC;;AAED;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA,yCAAyC,EAAE;AAC3C,sBAAsB,EAAE;AACxB,WAAW,YAAY,KAAK;AAC5B,oBAAoB,IAAI;AACxB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,aAAa;AACb;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,aAAa;AACb;AACA;AACA,aAAa;AACb;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,aAAa;AACb;AACA,oCAAoC,EAAE;AACtC;AACA,aAAa;AACb;AACA,8BAA8B;AAC9B;AACA,aAAa;AACb;AACA,8BAA8B;AAC9B;AACA,aAAa;AACb;AACA,8BAA8B;AAC9B,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,aAAa;AACb;AACA;AACA,aAAa;AACb;AACA;AACA,aAAa;AACb;AACA;AACA,aAAa;AACb;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4CAA4C,EAAE,cAAc,EAAE;AAC9D,aAAa;AACb;AACA;AACA;AACA,aAAa;AACb;AACA,0BAA0B,YAAY,4BAA4B,GAAG;AACrE,aAAa;AACb;AACA,uCAAuC,YAAY;AACnD,aAAa;AACb;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA,4CAA4C,EAAE,cAAc,EAAE;AAC9D,aAAa;AACb;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,aAAa;AACb;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;;;AAGA;AACA;AACA,uBAAuB;AACvB,qCAAqC;AACrC,6BAA6B;AAC7B;AACA;AACA,kCAAkC;AAClC;AACA;AACA;AACA;AACA;AACA,gCAAgC;AAChC,aAAa;AACb;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA,4BAA4B;AAC5B;AACA,aAAa;AACb;AACA;AACA;AACA,aAAa;AACb;AACA,aAAa;AACb,SAAS;;AAET;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,aAAa;AACb,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,sBAAsB;AAC/B,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB,+BAA+B;AACpD,SAAS;AACT;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,aAAa,8DAA8D;AAC3E,aAAa,sBAAsB;AACnC,aAAa;AACb;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,aAAa,8DAA8D;AAC3E,aAAa,sBAAsB;AACnC,aAAa;AACb;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,6BAA6B,qBAAqB,yBAAyB;AAC3E,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,0DAA0D;AAC3E,iBAAiB;AACjB;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,iBAAiB,uDAAuD;AACxE,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;;AAEA,sBAAsB;AACtB;;AAEA;AACA;AACA,uCAAuC;;AAEvC;;AAEA;AACA,oDAAoD,yBAAyB;;AAE7E;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,CAAC;;AAED;AACA,CAAC;;AAED;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,mCAAmC,UAAU;AAC7C,qCAAqC,QAAQ;AAC7C;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA,2BAA2B;;AAE3B;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,iBAAiB;AACjB;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,CAAC;;AAED,CAAC;;AAED;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA,yBAAyB;AACzB,oBAAoB;;AAEpB;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,yDAAyD;AACzD;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,SAAS;;AAET;AACA;AACA,SAAS;;AAET;AACA;;AAEA;AACA,CAAC;;AAED;AACA,CAAC;;;;;;;;;;ACpxBD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iCAAiC;AACjC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA,0BAA0B,aAAa,EAAE;AACzC,6DAA6D;;;AAG7D;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,0CAA0C,OAAO;AACjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,CAAC;;AAED;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mCAAmC,0BAA0B;AAC7D;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA,+BAA+B,kBAAkB;AACjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,mEAAmE;AACnE;AACA;;AAEA;AACA;AACA;AACA,+BAA+B,kBAAkB;AACjD;AACA;AACA;AACA;AACA;;AAEA,CAAC;;AAED;;AAEA;;AAEA;AACA,mDAAmD;AACnD;AACA;AACA;AACA;AACA,4CAA4C;AAC5C;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,aAAa;AACb;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB;AACnB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,oCAAoC;AACpC,kCAAkC;;AAElC;;AAEA;AACA,wBAAwB;AACxB;AACA,KAAK,KAAK;AACV;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA,KAAK,OAAO;AACZ;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA,aAAa;AACb;AACA;;AAEA;AACA;;AAEA;AACA;AACA,oC;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;;AAEA,8CAA8C;AAC9C,mCAAmC,eAAe;AAClD;AACA;AACA,iBAAiB,oCAAoC;AACrD,uCAAuC,KAAK;AAC5C;AACA;AACA,iBAAiB;;AAEjB;AACA,oDAAoD;AACpD;AACA,iBAAiB;AACjB,0DAA0D;AAC1D,+BAA+B,SAAS;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kCAAkC;AAClC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,uBAAuB,YAAY;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,uBAAuB,YAAY;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,uBAAuB,YAAY;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,uBAAuB,YAAY;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;;AAEA,cAAc,YAAY;AAC1B;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;;AAEA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,cAAc,YAAY;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc,QAAQ;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,uBAAuB;AACvB;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB;AACpB;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,oDAAoD;AACpD;AACA,KAAK;AACL;AACA;AACA;AACA,+DAA+D;AAC/D;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gCAAgC;AAChC,CAAC;AACD;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kCAAkC;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,qBAAqB,iBAAiB;AACtC;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,iDAAiD,QAAQ;AACzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,kBAAkB;AAClB;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB;AACpB;AACA;AACA;AACA;;AAEA,CAAC;;AAED;AACA;;AAEA;AACA;;AAEA,CAAC;;AAED;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,8DAA8D;AAC9D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sCAAsC;AACtC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,CAAC;;AAED;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,CAAC;;AAED;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA,yDAAyD;AACzD;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,8CAA8C,KAAK,G;AACnD;AACA;AACA,aAAa;AACb;AACA,KAAK;;AAEL;AACA;;AAEA;AACA,CAAC;AACD;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6DAA6D;AAC7D,uDAAuD,kCAAkC;;AAEzF;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA,CAAC;;AAED;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,cAAc;AAC9B;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,SAAS;AACT,KAAK;AACL;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;AACA,8B;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2CAA2C,cAAc;;AAEzD;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uCAAuC,cAAc;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,iCAAiC,KAAK;AACtC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB,kBAAkB;AAC3C;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,iBAAiB,cAAc;AAC/B;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,mBAAmB;AACpC;AACA;AACA;AACA;AACA;;AAEA;AACA,kCAAkC;AAClC;;AAEA;AACA,mCAAmC,uBAAuB,uBAAuB,uBAAuB;AACxG;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,CAAC;;AAED;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,iDAAiD,EAAE;;AAE5D;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;;;AAGA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA,yCAAyC;AACzC,uCAAuC;AACvC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA,yCAAyC,cAAc;AACvD;AACA,+CAA+C,cAAc;AAC7D,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;;;AAIA;;AAEA;AACA;AACA,mDAAmD,4BAA4B;AAC/E,KAAK;AACL,oDAAoD,4BAA4B;AAChF,sDAAsD,4BAA4B;AAClF;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,yCAAyC,0BAA0B;AACnE;AACA;;AAEA;AACA;AACA;AACA,6DAA6D;AAC7D,gDAAgD;AAChD,6CAA6C;;AAE7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA,aAAa;AACb,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA,gEAAgE;AAChE,kEAAkE;AAClE,4EAA4E;AAC5E,kEAAkE;AAClE,mEAAmE;AACnE,6EAA6E;AAC7E,iEAAiE;AACjE,kEAAkE;AAClE;AACA,aAAa;AACb;AACA,4EAA4E;AAC5E,0FAA0F;AAC1F,0EAA0E;AAC1E,2EAA2E;AAC3E;AACA;AACA,yEAAyE;AACzE,2EAA2E;AAC3E,yFAAyF;AACzF,2EAA2E;AAC3E;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA,CAAC;;AAED;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS,iDAAiD,EAAE;;AAE5D;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;;;AAGA;AACA;AACA;;AAEA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA,yCAAyC;AACzC,uCAAuC;AACvC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA,yCAAyC,cAAc;AACvD;AACA,+CAA+C,cAAc;AAC7D,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;;;AAIA;;AAEA;AACA;AACA,mDAAmD,4BAA4B;AAC/E,KAAK;AACL,oDAAoD,4BAA4B;AAChF,sDAAsD,4BAA4B;AAClF;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,yCAAyC,0BAA0B;AACnE;AACA;;AAEA;AACA;AACA;AACA,6DAA6D;AAC7D,gDAAgD;AAChD,6CAA6C;;AAE7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,U;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA,CAAC;;AAED;AACA;;AAEA;AACA;AACA;;AAEA,oBAAoB;AACpB,4BAA4B;;AAE5B;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,KAAK;;AAEL;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa;AACb;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA,gCAAgC;;AAEhC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,CAAC;;AAED;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,gBAAgB;AAChB;AACA,gBAAgB;AAChB;;AAEA,CAAC;;AAED;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC;;AAED;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;;AAGL;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,SAAS;AACT,KAAK;;AAEL;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC;;;;AAID;;AAEA,CAAC;;AAED;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA,a;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,sBAAsB,8BAA8B;AACpD,sBAAsB,8BAA8B;;AAEpD,CAAC;;AAED,CAAC;;AAED;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA,qCAAqC;AACrC;AACA,8CAA8C,WAAW,eAAe,MAAM,OAAO,mBAAmB,UAAU;;AAElH;;AAEA;AACA;AACA,KAAK;AACL;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uCAAuC;AACvC,SAAS;AACT;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAS;AACT;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAS;AACT;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC;;;AAGD;AACA;AACA;;AAEA;;AAEA,CAAC;;AAED;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC;;AAED;AACA;;AAEA;AACA,kCAAkC,gCAAgC;AAClE,iCAAiC,8BAA8B;;AAE/D;AACA;AACA,oDAAoD;AACpD,wDAAwD;;AAExD;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,iBAAiB,oBAAoB;AACrC;AACA;AACA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA,8CAA8C;AAC9C;AACA;AACA;AACA,iBAAiB,oBAAoB;AACrC;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;;AAGA;AACA;AACA;AACA,4CAA4C;;AAE5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA,CAAC;;AAED;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;AACL;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,2BAA2B,SAAS,EAAE;AACtC;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,uBAAuB;;AAEvB;AACA;AACA;AACA;AACA,SAAS;AACT;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;;AAEA;AACA,iFAAiF;AACjF;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,SAAS;AACT;;AAEA;AACA;;AAEA,CAAC;;AAED;;AAEA,CAAC;;AAED;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA,0CAA0C,iCAAiC;AAC3E;AACA;AACA;AACA;AACA,aAAa;AACb,SAAS;AACT;;AAEA;AACA;AACA;AACA;AACA,WAAW;;AAEX;AACA;;AAEA;;AAEA;AACA;AACA,6EAA6E;AAC7E;;AAEA;AACA,iBAAiB,kBAAkB;AACnC;;AAEA;AACA;AACA;;AAEA;AACA,0CAA0C,OAAO;AACjD;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA,iDAAiD,yBAAyB,EAAE;AAC5E;;AAEA,CAAC;;AAED;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,SAAS;AACT;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,6BAA6B;AAC7B;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,0CAA0C,kBAAkB;AAC5D;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,CAAC;;AAED;AACA,kBAAkB,gBAAgB;AAClC,gBAAgB,0CAA0C;AAC1D,kBAAkB,mBAAmB;AACrC,kBAAkB,gBAAgB;AAClC,0BAA0B;AAC1B,CAAC;;;AAGD;AACA,CAAC;;AAED;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,KAAK;;AAEL;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,iBAAiB;AACjB;AACA,0DAA0D,gCAAgC;AAC1F;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;;AAEA,CAAC;;AAED;AACA;;AAEA;AACA;;AAEA;AACA;AACA,kBAAkB;AAClB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;;AAEA;AACA;AACA;AACA;;AAEA,2CAA2C,KAAK;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,yBAAyB;AACzB;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,CAAC;;AAED;AACA,CAAC;;AAED;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,6BAA6B,SAAS;AACtC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,UAAU;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB,QAAQ;AAC5B;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA,oBAAoB,QAAQ;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY,SAAS;AACrB;AACA;AACA,sBAAsB,QAAQ;AAC9B;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gCAAgC,SAAS;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,EAAE;AACF;AACA,EAAE;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE;AACF;AACA,EAAE;AACF;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;;AAEA,gBAAgB,8BAA8B;;AAE9C;AACA;;AAEA,gBAAgB,kCAAkC,OAAO;AACzD;AACA;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;;AAEA,gBAAgB,8BAA8B;AAC9C;AACA;;AAEA,SAAS;AACT;AACA;AACA;AACA,gBAAgB,iBAAiB;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,qCAAqC;AACrD;AACA;AACA;AACA;AACA;;AAEA,CAAC;;AAED;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,uBAAuB,eAAe;AACtC;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,oCAAoC,wBAAwB;AAC5D;AACA;AACA;AACA;AACA;AACA,aAAa;AACb,iCAAiC,qDAAqD;AACtF;AACA;AACA;AACA;;AAEA;AACA,6BAA6B,qDAAqD;AAClF;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,SAAS;AACT;AACA;;AAEA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;;AAEA;AACA;;AAEA,CAAC;;AAED;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA,aAAa;AACb;AACA;AACA,SAAS;AACT;AACA,SAAS;AACT;AACA;AACA;AACA,aAAa;AACb;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,uBAAuB;AACvB;AACA,uBAAuB;;AAEvB;AACA,yBAAyB;AACzB;AACA,yBAAyB;;AAEzB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,yBAAyB;AACzB;AACA,uBAAuB;;AAEvB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC;AACD;AACA;AACA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA,CAAC;;AAED;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,KAAK;AACL;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,aAAa;;AAEb;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,aAAa;;AAEb;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb,SAAS;AACT;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,yCAAyC,KAAK;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,wCAAwC,KAAK;AAC7C;AACA;AACA;AACA;AACA;;AAEA,CAAC;;AAED;AACA,CAAC;;AAED;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,iDAAiD;AACjD;;AAEA;AACA,uBAAuB,kBAAkB;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB,2F;AACA;AACA;AACA,qBAAqB;AACrB;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,qBAAqB;AACrB,iBAAiB;AACjB;AACA;AACA;AACA;AACA,8CAA8C;AAC9C;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,SAAS;;AAET;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,qBAAqB,wBAAwB;;AAE7C;AACA,yCAAyC,OAAO;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yCAAyC,OAAO;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,4BAA4B;AAC5B;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;;AAEb;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,qBAAqB;;AAErB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA,6BAA6B;AAC7B;AACA;;AAEA,2BAA2B,oBAAoB;AAC/C;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA,iCAAiC;AACjC;AACA,iBAAiB;AACjB;AACA;AACA,6BAA6B;AAC7B,mCAAmC,iBAAiB;AACpD;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,CAAC;;AAED;AACA,CAAC;;AAED;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA,SAAS;AACT;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,kBAAkB;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,2BAA2B,mBAAmB;AAC9C;AACA,SAAS;AACT;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,2BAA2B,mBAAmB;AAC9C;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,kBAAkB;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,yBAAyB;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gEAAgE,iBAAiB,EAAE;AACnF;AACA;AACA;;AAEA;AACA;AACA;AACA,wDAAwD,gBAAgB;AACxE;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qCAAqC,KAAK;AAC1C;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B,qDAAqD;AACpF,+BAA+B,uCAAuC;AACtE;;AAEA;AACA;AACA;;AAEA,CAAC;;AAED;AACA,CAAC;;AAED;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,SAAS;AACT;AACA,2BAA2B,mBAAmB;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC;;AAED;AACA,CAAC;;AAED;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,a;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,M;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,M;AACA;AACA;AACA,M;AACA;AACA;AACA,M;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,sB;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC;;AAED;AACA,CAAC;;AAED;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,qBAAqB;;AAErB;AACA;AACA;AACA;AACA;AACA,4BAA4B;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,sBAAsB;AACtB;AACA;AACA;AACA,kDAAkD;AAClD,yDAAyD,KAAK;AAC9D,aAAa;AACb,0BAA0B;AAC1B,wEAAwE;AACxE;AACA,iCAAiC;AACjC;AACA;AACA,iBAAiB;AACjB,yEAAyE;AACzE;AACA,gCAAgC;AAChC;AACA;AACA;AACA;AACA,SAAS,oBAAoB;AAC7B;AACA;AACA,+BAA+B;AAC/B,6DAA6D,IAAI,2CAA2C;AAC5G;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,8CAA8C;AAC9C;AACA;AACA;AACA,gCAAgC;AAChC,gEAAgE,yCAAyC,IAAI;AAC7G;AACA;AACA;AACA,aAAa;AACb;AACA,aAAa;AACb;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,KAAK;;AAEL;AACA;AACA,kDAAkD;AAClD;AACA;AACA;AACA,+BAA+B;AAC/B;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,iEAAiE,2CAA2C;AAC5G;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,iEAAiE,2CAA2C;AAC5G;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA,oCAAoC;AACpC;AACA,oCAAoC;AACpC;AACA;AACA;AACA;AACA;AACA;AACA,oCAAoC;AACpC,2CAA2C,GAAG;AAC9C,oCAAoC;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;;;AAIA;;AAEA;AACA,CAAC;;AAED;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA,wBAAwB,EAAE;AAC1B;AACA;AACA;;AAEA,CAAC;;AAED;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,sCAAsC,4BAA4B;AAClE,sCAAsC,0BAA0B;AAChE;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,+BAA+B,mBAAmB;AAClD;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0CAA0C,0BAA0B;AACpE;AACA,0CAA0C,0BAA0B;AACpE;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,kCAAkC,aAAa;AAC/C;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,uBAAuB,wBAAwB;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;;AAEA;AACA;AACA;AACA;AACA,uBAAuB,yBAAyB;AAChD;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,mDAAmD,OAAO;AAC1D;AACA;AACA;AACA;AACA;AACA,0EAA0E,aAAa,O;AACvF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;;AAEA;AACA,CAAC;;AAED;AACA,CAAC;;AAED;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,iDAAiD,mCAAmC;AACpF;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,8DAA8D;AAC9D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA,CAAC;;AAED,CAAC;;AAED;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL,gCAAgC,kBAAkB;AAClD,KAAK;AACL,qBAAqB,iBAAiB;AACtC;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,qBAAqB,kBAAkB;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB;AAChB;;AAEA;AACA,gBAAgB;AAChB;;AAEA;AACA,gBAAgB;AAChB;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,gCAAgC,yBAAyB;AACzD,M;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0CAA0C,uBAAuB;AACjE,SAAS;AACT;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,0CAA0C,uBAAuB;AACjE,SAAS;;AAET;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4G;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,qBAAqB,iBAAiB;AACtC;AACA;AACA;AACA;AACA,mCAAmC,MAAM;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,kC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,qDAAqD,OAAO;AAC5D;AACA;AACA,wBAAwB;AACxB;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA,mCAAmC,SAAS;AAC5C;;AAEA;AACA;;AAEA,CAAC;;AAED;AACA,CAAC;;AAED;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA,4BAA4B,QAAQ;;AAEpC;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA,gF;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gCAAgC,WAAW;AAC3C;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;;AAEA,CAAC;;AAED;AACA,CAAC;;AAED;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,2BAA2B,UAAU;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;;AAEA,uCAAuC,MAAM;AAC7C;AACA;AACA;AACA;AACA;;AAEA,CAAC;;AAED;AACA,CAAC;;AAED;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,uBAAuB,kBAAkB;AACzC;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,uBAAuB,uBAAuB;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA,uBAAuB,kBAAkB;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,uBAAuB,kBAAkB;AACzC;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;;AAEA,uBAAuB,uBAAuB;AAC9C;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA,CAAC;;AAED;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA,qCAAqC,iBAAiB;AACtD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,iCAAiC,KAAK;AACtC;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,SAAS;;AAET;AACA,uBAAuB,iBAAiB;AACxC;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA,gCAAgC,yBAAyB;AACzD;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;;AAEA,0CAA0C,yBAAyB;AACnE;AACA;AACA,wCAAwC,uBAAuB;AAC/D;AACA;;AAEA;AACA,gCAAgC,cAAc;AAC9C;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,0CAA0C,OAAO;AACjD;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,kBAAkB,OAAO;AACzB;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC;;AAED;AACA,CAAC;;AAED;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAS;AACT;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,iCAAiC,0BAA0B;AAC3D;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,iCAAiC,0BAA0B;AAC3D;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC;;AAED;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,uBAAuB,kBAAkB;AACzC;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,uBAAuB,sBAAsB;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,2BAA2B,kBAAkB;AAC7C;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,uBAAuB,sBAAsB;AAC7C,2BAA2B,+BAA+B;AAC1D;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,kBAAkB;AAClB;AACA;AACA,uBAAuB,2BAA2B;AAClD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,qBAAqB;AACpC;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,qBAAqB;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,uBAAuB,qBAAqB;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qCAAqC;AACrC;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;;AAEA,uBAAuB,qBAAqB;AAC5C;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,oCAAoC,4BAA4B;;AAEhE;AACA;;AAEA;AACA;AACA;AACA,SAAS;AACT;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oCAAoC,+BAA+B;AACnE;;AAEA;AACA;AACA,uBAAuB,kBAAkB;AACzC;AACA;;AAEA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,SAAS;AACT;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa;AACb;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA,SAAS;;AAET;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA,aAAa,iDAAiD,2CAA2C;AACzG;AACA;AACA;AACA;;AAEA;AACA,aAAa;AACb;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA,iBAAiB;AACjB;AACA,aAAa;AACb;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,2BAA2B;AAC3B;AACA;AACA,mBAAmB;AACnB;AACA;AACA,gCAAgC,cAAc;AAC9C;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;;AAEA;AACA;;;;AAIA;AACA;AACA;AACA,kDAAkD;;AAElD;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,SAAS;AACT;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,CAAC;;AAED;AACA;;AAEA;AACA;;;AAGA;;AAEA;AACA;;AAEA;AACA;;AAEA,oDAAoD,WAAW;AAC/D;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,8CAA8C,WAAW;AACzD;AACA;AACA,mBAAmB;AACnB,8CAA8C,WAAW;AACzD;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,UAAU,KAAK;AACf,UAAU,KAAK;AACf;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA,gCAAgC;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;;AAEb;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gCAAgC;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;;AAEb;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,CAAC;;AAED;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;;AAGA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,2BAA2B,mBAAmB;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;;AAEA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,2BAA2B;AAC3B,2BAA2B;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2CAA2C;AAC3C;AACA;AACA;AACA,2CAA2C;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB,eAAe;AACpC;AACA;AACA,2CAA2C;AAC3C;AACA;AACA;AACA,2CAA2C;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2CAA2C;AAC3C;AACA;AACA;AACA,2CAA2C;AAC3C;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,2CAA2C;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6CAA6C,wCAAwC;AACrF,oCAAoC,wBAAwB;AAC5D;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb,SAAS;AACT;AACA;;AAEA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,2BAA2B,SAAS;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,uCAAuC,SAAS;AAChD;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,uBAAuB,mBAAmB;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA,uBAAuB,mBAAmB;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;;AAEA;AACA;AACA;AACA;AACA,8BAA8B,aAAa;AAC3C,mCAAmC,oBAAoB;AACvD;AACA;AACA;AACA;AACA;;AAEA,wCAAwC,uBAAuB;AAC/D;;AAEA;AACA;AACA,2BAA2B,UAAU;AACrC;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oCAAoC;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,yBAAyB,wBAAwB;AACjD;AACA;AACA;AACA;AACA;;AAEA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;;AAEA,yBAAyB,wBAAwB;AACjD;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2CAA2C,uBAAuB;AAClE;AACA;AACA,yBAAyB;AACzB;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,+BAA+B,mBAAmB;AAClD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA,iBAAiB;;AAEjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,wBAAwB;AACnD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,uBAAuB;AAClD;AACA;AACA;AACA;AACA;AACA,0BAA0B;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,uBAAuB,gBAAgB;AACvC;AACA;AACA;AACA;AACA,+BAA+B,aAAa;AAC5C;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,wBAAwB,qBAAqB;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA,oBAAoB;;AAEpB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,qBAAqB;AAChD;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,4BAA4B,qBAAqB;AACjD;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC;;AAED;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA,KAAK;AACL,uBAAuB,qBAAqB;AAC5C;AACA,yBAAyB,kCAAkC;AAC3D;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA,SAAS;AACT;AACA,KAAK;AACL,kBAAkB,mBAAmB;AACrC;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,KAAK;AACL,6BAA6B,oBAAoB;AACjD;AACA,4BAA4B,iCAAiC;AAC7D;AACA,KAAK;AACL;AACA,4BAA4B,8BAA8B;AAC1D,yBAAyB,kCAAkC;AAC3D;AACA,KAAK;AACL;AACA,4BAA4B,mBAAmB,EAAE;AACjD,yBAAyB,qBAAqB;AAC9C;AACA,CAAC;;AAED;AACA,CAAC;;AAED;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,iDAAiD,eAAe;AAChE,+BAA+B,SAAS;AACxC;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,2BAA2B,kBAAkB;AAC7C;AACA,+BAA+B,oBAAoB;AACnD;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,0CAA0C,OAAO;AACjD;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,8DAA8D,KAAK;AACnE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,uBAAuB,kBAAkB;AACzC;AACA,SAAS;AACT;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,2BAA2B,iBAAiB;AAC5C;AACA;AACA;AACA;AACA,yDAAyD,iBAAiB;AAC1E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mCAAmC,gBAAgB;AACnD;AACA;AACA;AACA;AACA,yDAAyD,gBAAgB;AACzE;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B,SAAS;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gDAAgD,QAAQ;AACxD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB;AAChB;;AAEA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,CAAC;;AAED;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;;;AAGA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oCAAoC,uDAAuD;;AAE3F;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA,SAAS;AACT;AACA;AACA,aAAa;AACb;AACA;;AAEA;AACA;AACA;;AAEA;AACA,uBAAuB,qBAAqB;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,2BAA2B;;AAE3B;AACA;;AAEA;AACA;;AAEA;AACA,SAAS;AACT;;AAEA;AACA;AACA;AACA,SAAS;AACT;;AAEA;AACA;AACA;AACA,SAAS;AACT;;AAEA;AACA;AACA;AACA;AACA,mFAAmF,UAAU;AAC7F;;AAEA;AACA;AACA;AACA;AACA,oBAAoB;AACpB;AACA,oBAAoB;;AAEpB;AACA,kCAAkC,KAAK;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB;AAChB;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,wBAAwB;AACxB;AACA;;AAEA;AACA;AACA,0EAA0E;AAC1E;AACA,oCAAoC;AACpC;AACA,gBAAgB;AAChB;;AAEA;AACA;AACA;;AAEA,CAAC;;AAED;AACA;AACA,CAAC;;AAED;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,oDAAoD;AACpD,KAAK;AACL;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA,wCAAwC,KAAK;AAC7C;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA,iBAAiB;AACjB;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;;AAEA,CAAC;;AAED;;AAEA,CAAC;;AAED;AACA;;AAEA;AACA;AACA;;AAEA;AACA,YAAY;AACZ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;AACL;AACA,CAAC;AACD;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;AACL;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;AACL;AACA;AACA,CAAC;AACD;AACA;AACA,4BAA4B,oBAAoB,EAAE;AAClD;AACA,CAAC;AACD;AACA;AACA,4BAA4B,0BAA0B,EAAE;AACxD;AACA,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,CAAC;AACD;AACA;AACA,4BAA4B,kCAAkC,EAAE;AAChE;AACA;AACA;AACA,CAAC;AACD;AACA;AACA,4BAA4B,iCAAiC,EAAE;AAC/D;AACA;AACA;AACA,CAAC;AACD;AACA;AACA,4BAA4B,mCAAmC,EAAE;AACjE;AACA;AACA;AACA,CAAC;AACD;AACA;AACA,4BAA4B,uCAAuC,EAAE;AACrE;AACA;AACA;AACA,CAAC;AACD;AACA;AACA,4BAA4B,0BAA0B,EAAE;AACxD;AACA;AACA,CAAC;AACD;AACA;AACA,4B;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,CAAC;AACD;AACA;AACA,4BAA4B,yBAAyB,EAAE;AACvD;AACA;AACA,CAAC;AACD;AACA;AACA,4BAA4B,mBAAmB,EAAE;AACjD;AACA;AACA;AACA,CAAC;AACD;AACA;AACA,4BAA4B,uBAAuB,EAAE;AACrD;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA,8B;AACA,KAAK;AACL;AACA,CAAC;AACD;AACA;AACA,4B;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,CAAC;AACD;AACA;AACA;AACA,4DAA4D,kBAAkB;AAC9E,KAAK;AACL;AACA,CAAC;AACD;AACA;AACA,4BAA4B,0BAA0B,EAAE;AACxD;AACA,CAAC;AACD;AACA;AACA,4BAA4B,yCAAyC,EAAE;AACvE;AACA;AACA;AACA;AACA,CAAC;AACD;AACA;AACA,4BAA4B,4BAA4B,EAAE;AAC1D;AACA;AACA;AACA;AACA,CAAC;AACD;AACA;AACA,4BAA4B,kCAAkC,EAAE;AAChE;AACA;AACA;AACA,CAAC;AACD;AACA;AACA,kCAAkC,+BAA+B,EAAE;AACnE;AACA;AACA;AACA,CAAC;AACD;AACA;AACA,4BAA4B,uCAAuC,EAAE;AACrE;AACA;AACA;AACA;AACA,CAAC;AACD;AACA;AACA,4BAA4B,0BAA0B,EAAE;AACxD;AACA;AACA;AACA;AACA,CAAC;AACD;AACA;AACA,4BAA4B,oCAAoC,EAAE;AAClE;AACA;AACA;AACA,CAAC;AACD;AACA;AACA,kCAAkC,iCAAiC,EAAE;AACrE;AACA;AACA;AACA,CAAC;AACD;AACA;AACA,4BAA4B,wCAAwC,EAAE;AACtE;AACA;AACA;AACA,CAAC;AACD;AACA;AACA,4BAA4B,2BAA2B,EAAE;AACzD;AACA;AACA;AACA,CAAC;AACD;AACA;AACA,4BAA4B,yCAAyC,EAAE;AACvE;AACA;AACA;AACA,CAAC;AACD;AACA;AACA,4BAA4B,4BAA4B,EAAE;AAC1D;AACA;AACA;AACA,CAAC;AACD;AACA;AACA,4BAA4B,oCAAoC,EAAE;AAClE;AACA;AACA;AACA,CAAC;AACD;AACA;AACA,kCAAkC,iCAAiC,EAAE;AACrE;AACA;AACA;AACA,CAAC;AACD;AACA;AACA,4BAA4B,yCAAyC,EAAE;AACvE;AACA;AACA;AACA,CAAC;AACD;AACA;AACA,4BAA4B,4BAA4B,EAAE;AAC1D;AACA;AACA;AACA,CAAC;AACD;AACA;AACA,4BAA4B,uCAAuC,EAAE;AACrE;AACA;AACA;AACA,CAAC;AACD;AACA;AACA,4BAA4B,0BAA0B,EAAE;AACxD;AACA;AACA;AACA,CAAC;AACD;AACA;AACA,4BAA4B,qCAAqC,EAAE;AACnE;AACA;AACA;AACA,CAAC;AACD;AACA;AACA,kCAAkC,kCAAkC,EAAE;AACtE;AACA;AACA;AACA,CAAC;AACD;AACA;AACA,4BAA4B,yBAAyB,EAAE;AACvD;AACA,CAAC;AACD;AACA;AACA,4BAA4B,yBAAyB,EAAE;AACvD;AACA,CAAC;AACD;AACA;AACA,4BAA4B,uBAAuB,EAAE;AACrD;AACA,CAAC;AACD;AACA;AACA,4BAA4B,uBAAuB,EAAE;AACrD;AACA,CAAC;AACD;AACA;AACA,4BAA4B,uBAAuB,EAAE;AACrD;AACA,CAAC;AACD;AACA;AACA,4BAA4B,qBAAqB,EAAE;AACnD;AACA,CAAC;AACD;AACA;AACA,uBAAuB,gEAAgE,EAAE;AACzF;AACA,CAAC;AACD;AACA;AACA,uBAAuB,+DAA+D,EAAE;AACxF;AACA,CAAC;AACD;AACA;AACA,4BAA4B,yCAAyC,EAAE;AACvE;AACA;AACA;AACA,CAAC;AACD;AACA;AACA,4BAA4B,uCAAuC,EAAE;AACrE;AACA;AACA;AACA,CAAC;AACD;AACA;AACA,4BAA4B,yCAAyC,EAAE;AACvE;AACA,CAAC;AACD;AACA;AACA,4BAA4B,gCAAgC,EAAE;AAC9D;AACA,CAAC;AACD;AACA;AACA,4BAA4B,yBAAyB,EAAE;AACvD;AACA;AACA;AACA,CAAC;AACD;AACA;AACA,4BAA4B,6BAA6B,EAAE;AAC3D;AACA;AACA;AACA,CAAC;AACD;AACA;AACA,4BAA4B,mCAAmC,EAAE;AACjE;AACA;AACA;AACA,CAAC;AACD;AACA;AACA,uBAAuB;AACvB;AACA;AACA,CAAC;AACD;AACA;AACA,KAAK;AACL;AACA,CAAC;AACD;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,CAAC;AACD;AACA;AACA;AACA,KAAK;AACL;AACA,CAAC;AACD;AACA;AACA,4BAA4B,sBAAsB,EAAE;AACpD;AACA;AACA,CAAC;AACD;AACA;AACA,4BAA4B,6BAA6B,EAAE;AAC3D;AACA;AACA,CAAC;AACD;AACA;AACA,4BAA4B,oBAAoB,EAAE;AAClD;AACA;AACA,CAAC;AACD;AACA;AACA,4BAA4B,6BAA6B,EAAE;AAC3D;AACA;AACA,CAAC;AACD;AACA;AACA,4BAA4B,6BAA6B,EAAE;AAC3D;AACA;AACA,CAAC;AACD;AACA;AACA,4BAA4B,wBAAwB,EAAE;AACtD;AACA;AACA,CAAC;AACD;AACA;AACA,4BAA4B,yBAAyB,EAAE;AACvD;AACA;AACA,CAAC;AACD;AACA;AACA;AACA,4DAA4D,wBAAwB;AACpF;AACA,CAAC;AACD;AACA;AACA,4BAA4B,eAAe;AAC3C,CAAC;AACD;AACA;AACA,4BAA4B,eAAe;AAC3C,CAAC;AACD;AACA;AACA,4BAA4B,sBAAsB,EAAE;AACpD;AACA,CAAC;AACD;AACA;AACA,4BAA4B,sBAAsB,EAAE;AACpD;AACA,CAAC;AACD;AACA;AACA,4BAA4B,wBAAwB,EAAE;AACtD;AACA,CAAC;AACD;AACA;AACA,4BAA4B,wBAAwB,EAAE;AACtD;AACA,CAAC;AACD;AACA;AACA,4BAA4B,wBAAwB,EAAE;AACtD;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;AACA;AACA,4BAA4B,uBAAuB,EAAE;AACrD;AACA;AACA,CAAC;AACD;AACA;AACA,4B;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,KAAK;AACL;AACA;AACA,CAAC;AACD;AACA;AACA,4BAA4B,4BAA4B,EAAE;AAC1D;AACA;AACA,CAAC;AACD;AACA;AACA,4BAA4B,0BAA0B,EAAE;AACxD;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,CAAC;AACD;AACA;AACA,4BAA4B,yBAAyB,EAAE;AACvD;AACA;AACA,CAAC;AACD;AACA;AACA,4BAA4B,0BAA0B,EAAE;AACxD;AACA;AACA,CAAC;AACD;AACA;AACA,4BAA4B,uBAAuB,EAAE;AACrD;AACA;AACA,CAAC;AACD;AACA;AACA,4BAA4B,iBAAiB,EAAE;AAC/C;AACA;AACA,CAAC;AACD;AACA;AACA,4BAA4B,uBAAuB,EAAE;AACrD;AACA;AACA,CAAC;AACD;AACA;AACA,4BAA4B,sBAAsB,EAAE;AACpD;AACA;AACA,CAAC;AACD;AACA,iCAAiC,oBAAoB,EAAE;AACvD;AACA;AACA,CAAC;AACD;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,CAAC;AACD;AACA;AACA,4BAA4B,oBAAoB,EAAE;AAClD;AACA;AACA,CAAC;AACD;AACA;AACA,4BAA4B,2BAA2B,EAAE;AACzD,yCAAyC,8BAA8B,EAAE;AACzE;AACA,CAAC;AACD;AACA;AACA,4BAA4B,sBAAsB,EAAE;AACpD;AACA;AACA,CAAC;AACD;AACA;AACA,4BAA4B,sBAAsB,EAAE;AACpD;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,4CAA4C,2BAA2B;AACvE;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,uBAAuB,mBAAmB;AAC1C;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;;AAEA;AACA;;AAEA,sBAAsB,sBAAsB;AAC5C;AACA;AACA,KAAK;AACL;AACA;AACA,CAAC;;AAED,CAAC;;AAED;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,KAAK;;AAEL;AACA;;AAEA;;AAEA;AACA,gCAAgC;AAChC;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA,0BAA0B;;AAE1B;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA,SAAS;AACT;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,8CAA8C;AAC9C;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,8DAA8D;;AAE9D;AACA,SAAS;AACT;AACA,oEAAoE;AACpE;;AAEA;AACA;AACA;AACA;AACA,gCAAgC;AAChC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;AACA,SAAS;;AAET;;AAEA,0DAA0D,gBAAgB;AAC1E,oDAAoD,aAAa;;AAEjE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,yBAAyB;AACzB;AACA;AACA;;AAEA,iBAAiB;AACjB,aAAa;AACb;AACA;AACA;;AAEA;AACA;AACA;AACA,yBAAyB;AACzB;AACA;AACA;AACA,iBAAiB;AACjB;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;;AAGA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;;;AAGA;AACA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;AACA;AACA;;;AAGA;AACA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;;AAEA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;;AAEA,uCAAuC,KAAK;AAC5C;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,kDAAkD;AAClD;AACA;AACA;AACA,aAAa,OAAO;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,4BAA4B,6BAA6B;AACzD;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,gCAAgC,gBAAgB;AAChD;;AAEA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA,gCAAgC,gBAAgB;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;;AAGA;AACA;AACA,iBAAiB;AACjB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;AACA,2BAA2B,OAAO;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,aAAa;AACb,SAAS;AACT;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc,KAAK;AACnB,cAAc,KAAK;AACnB;;AAEA;AACA,sCAAsC;AACtC,sBAAsB,kCAAkC;AACxD;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,+BAA+B;AAC/B;AACA;AACA;AACA;AACA,+BAA+B;AAC/B;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA,iBAAiB;AACjB;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B,yCAAyC;;AAEtE;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA,uCAAuC,QAAQ;AAC/C;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8BAA8B,eAAe;AAC7C;;AAEA;AACA;AACA,8BAA8B,aAAa;;AAE3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,oCAAoC;AACvD;AACA;AACA,4BAA4B,mCAAmC;AAC/D;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC;;;;AAID;AACA;AACA;AACA;AACA,kDAAkD,YAAY;AAC9D,SAAS;AACT;AACA,KAAK;AACL;AACA,yBAAyB,mCAAmC;AAC5D;AACA,KAAK;AACL;AACA,wCAAwC,2BAA2B;AACnE;AACA,KAAK;AACL;AACA;AACA,qC;AACA,SAAS;AACT;AACA,KAAK;AACL;AACA,4BAA4B,0BAA0B,EAAE;AACxD;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL,wBAAwB,mBAAmB;AAC3C,4BAA4B,mBAAmB;AAC/C;AACA,4BAA4B;AAC5B,KAAK;AACL;AACA,4BAA4B,8BAA8B,EAAE;AAC5D,yBAAyB,0BAA0B,EAAE;AACrD;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,uBAAuB,0BAA0B;AACjD;AACA,gCAAgC;;AAEhC,2BAA2B,gCAAgC;AAC3D;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,CAAC;;AAED;AACA,CAAC;;AAED;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,uBAAuB,wBAAwB;AAC/C;AACA;AACA;AACA;AACA,oDAAoD;;AAEpD;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,wBAAwB;AACxB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,kCAAkC,WAAW;AAC7C,iCAAiC;AACjC;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,oBAAoB;AACpB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC;;AAED;;AAEA,CAAC;;AAED;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;;;AAGA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA,aAAa;AACb;AACA,aAAa;AACb;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qB;AACA;AACA;AACA;AACA;AACA,cAAc,YAAY;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,sCAAsC;AACtC,wBAAwB;AACxB,gCAAgC;AAChC,kCAAkC;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,sCAAsC;AACtC,oCAAoC;AACpC,gCAAgC;AAChC,qCAAqC;AACrC;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,mCAAmC;AACnC,qBAAqB;AACrB,6BAA6B;AAC7B,kCAAkC;AAClC;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,mCAAmC;AACnC,iCAAiC;AACjC,6BAA6B;AAC7B,+BAA+B;AAC/B;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,uCAAuC;AACvC,oEAAoE;AACpE,iCAAiC;AACjC,uDAAuD;AACvD;AACA,SAAS;AACT;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,mCAAmC;AACnC,6BAA6B;AAC7B,oBAAoB,QAAQ;AAC5B;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,mCAAmC;AACnC,6BAA6B;AAC7B,oBAAoB,QAAQ;AAC5B;AACA;;AAEA,CAAC;;AAED;;AAEA,CAAC;;AAED;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,6BAA6B;AAC7B;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,iBAAiB;AACxC;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA,uCAAuC,aAAa;AACpD;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,iGAAiG,OAAO;AACxG;;AAEA;AACA,+FAA+F,OAAO;AACtG;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,aAAa;AACb;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA,oCAAoC;;AAEpC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb,6BAA6B;AAC7B,aAAa;AACb,6BAA6B;AAC7B,aAAa;AACb,6BAA6B;AAC7B,aAAa;AACb;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,mGAAmG;AACnG;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,uBAAuB,mBAAmB;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,mBAAmB;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,iBAAiB;;AAEjB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB,iBAAiB;AACjB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB,aAAa;AACb;AACA;;AAEA;AACA;AACA;AACA,SAAS;;AAET;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC;;AAED;;AAEA,CAAC;;AAED;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,oCAAoC,KAAK;AACzC;AACA;AACA;AACA;AACA,oCAAoC,KAAK;AACzC;AACA;;;AAGA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,aAAa;AACb;;AAEA;AACA;AACA;AACA,aAAa;AACb,SAAS;;AAET;AACA;AACA;AACA,SAAS;;AAET;AACA;;AAEA;AACA;AACA,oBAAoB;;AAEpB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,gBAAgB;AAChB;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA,2BAA2B,aAAa;AACxC;;AAEA,8CAA8C,OAAO;AACrD;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,CAAC;;AAED;;AAEA,CAAC;;AAED;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kCAAkC,qBAAqB;AACvD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,kCAAkC,sBAAsB;AACxD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC;;;AAGD,+BAA+B;AAC/B,gCAAgC;AAChC,gCAAgC;;AAEhC;AACA;AACA,CAAC;;AAED;AACA;;AAEA;;;AAGA;AACA;AACA;AACA;AACA;AACA;;AAEA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;;AAEA,CAAC;;AAED;AACA,CAAC;;AAED;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;;AAGA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,2BAA2B;AAC3B;AACA;;AAEA;;AAEA;;AAEA,2BAA2B;;AAE3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+CAA+C,WAAW;AAC1D;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;;AAEA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,iB;AACA;AACA,aAAa;AACb,uBAAuB;AACvB;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,CAAC;;AAED,CAAC;;AAED;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8BAA8B;AAC9B,mBAAmB;AACnB,iBAAiB;AACjB,6FAA6F;AAC7F,eAAe;AACf,iBAAiB;AACjB,8CAA8C;AAC9C,CAAC;AACD,eAAe;AACf,mBAAmB;AACnB,iBAAiB;AACjB,OAAO;AACP,UAAU;AACV,0BAA0B;AAC1B,sBAAsB;AACtB,uBAAuB;AACvB,0BAA0B;AAC1B,kBAAkB;AAClB,aAAa;AACb,CAAC;AACD,cAAc;AACd,mBAAmB;AACnB,4BAA4B;AAC5B,+BAA+B;AAC/B,uBAAuB;AACvB,gBAAgB;AAChB,CAAC;AACD,mCAAmC;AACnC,mBAAmB;AACnB,OAAO;AACP,QAAQ;AACR,SAAS;AACT,UAAU;AACV,YAAY;AACZ,sCAAsC;AACtC,cAAc;AACd,CAAC;AACD,4CAA4C;AAC5C,gCAAgC;AAChC,CAAC;AACD,kCAAkC;AAClC,wBAAwB;AACxB,CAAC;AACD,aAAa;AACb,mBAAmB;AACnB,kBAAkB;AAClB,YAAY;AACZ,OAAO;AACP,UAAU;AACV,QAAQ;AACR,gBAAgB;AAChB,WAAW;AACX,sBAAsB;AACtB,uBAAuB;AACvB,0BAA0B;AAC1B,kBAAkB;AAClB,CAAC;AACD,yBAAyB;AACzB,mBAAmB;AACnB,QAAQ;AACR,SAAS;AACT,CAAC;AACD,+BAA+B;AAC/B,uDAAuD;AACvD,CAAC;AACD,kBAAkB;AAClB,mBAAmB;AACnB,mBAAmB;AACnB,6BAA6B;AAC7B,CAAC;AACD,4BAA4B;AAC5B,uCAAuC,26BAA26B;AACl9B,6BAA6B;AAC7B,gCAAgC;AAChC,CAAC;AACD,8BAA8B;AAC9B,uCAAuC,ukBAAukB;AAC9mB,gCAAgC;AAChC,CAAC;AACD,2BAA2B;AAC3B,uCAAuC,+OAA+O;AACtR,gCAAgC;AAChC,CAAC;AACD,qCAAqC;AACrC,uCAAuC,+NAA+N;AACtQ,CAAC;AACD,gBAAgB;AAChB,mBAAmB;AACnB,SAAS;AACT,UAAU;AACV,WAAW;AACX,CAAC;AACD,sBAAsB;AACtB,mBAAmB;AACnB,aAAa;AACb,QAAQ;AACR,OAAO;AACP,CAAC;AACD,iBAAiB;AACjB,mBAAmB;AACnB,mBAAmB;AACnB,OAAO;AACP,CAAC;AACD,kBAAkB;AAClB,mBAAmB;AACnB,mBAAmB;AACnB,QAAQ;AACR,CAAC;AACD,mBAAmB;AACnB,mBAAmB;AACnB,aAAa;AACb,CAAC;AACD,iBAAiB;AACjB,mBAAmB;AACnB,WAAW;AACX,aAAa;AACb,YAAY;AACZ,WAAW;AACX,wBAAwB;AACxB,sBAAsB;AACtB,iBAAiB;AACjB,aAAa;AACb,aAAa;AACb,cAAc;AACd,iBAAiB;AACjB,cAAc;AACd,eAAe;AACf,eAAe;AACf,kBAAkB;AAClB,sBAAsB;AACtB,uBAAuB;AACvB,0BAA0B;AAC1B,kBAAkB;AAClB,2BAA2B;AAC3B,CAAC;AACD,iCAAiC;AACjC,oBAAoB;AACpB,eAAe;AACf,cAAc;AACd,WAAW;AACX,eAAe;AACf,CAAC;AACD,YAAY;AACZ,WAAW;AACX,mBAAmB;AACnB,iBAAiB;AACjB,kBAAkB;AAClB,iBAAiB;AACjB,aAAa;AACb,YAAY;AACZ,4BAA4B;AAC5B,+BAA+B;AAC/B,uBAAuB;AACvB,qBAAqB;AACrB,CAAC;AACD,mBAAmB;AACnB,mBAAmB;AACnB,YAAY;AACZ,kBAAkB;AAClB,qBAAqB;AACrB,CAAC;AACD,iBAAiB;AACjB,yBAAyB;AACzB,CAAC;AACD,UAAU;AACV,sBAAsB;AACtB,mBAAmB;AACnB,CAAC;AACD,mBAAmB;AACnB,WAAW;AACX,CAAC;AACD,aAAa;AACb,WAAW;AACX,mBAAmB;AACnB,4BAA4B;AAC5B,+BAA+B;AAC/B,uBAAuB;AACvB,uBAAuB;AACvB,yBAAyB;AACzB,CAAC;AACD,8BAA8B;AAC9B,uBAAuB;AACvB,CAAC;AACD,+BAA+B;AAC/B,uBAAuB;AACvB,CAAC;AACD,oCAAoC;AACpC,qBAAqB;AACrB,yBAAyB;AACzB,CAAC;AACD,iCAAiC;AACjC,aAAa;AACb,CAAC;AACD,kCAAkC;AAClC,kCAAkC;AAClC,0BAA0B;AAC1B,CAAC;AACD,2DAA2D;AAC3D,mBAAmB;AACnB,WAAW;AACX,CAAC;AACD,kCAAkC;AAClC,mBAAmB;AACnB,WAAW;AACX,CAAC;AACD,gCAAgC;AAChC,mBAAmB;AACnB,WAAW;AACX,CAAC;AACD,oCAAoC;AACpC,mBAAmB;AACnB,WAAW;AACX,CAAC;AACD,sCAAsC;AACtC,mBAAmB;AACnB,WAAW;AACX,4BAA4B;AAC5B,+BAA+B;AAC/B,uBAAuB;AACvB,CAAC;AACD,qBAAqB;AACrB,4BAA4B;AAC5B,+BAA+B;AAC/B,uBAAuB;AACvB,sBAAsB;AACtB,aAAa;AACb,iBAAiB;AACjB,uBAAuB;AACvB;AACA,qBAAqB;AACrB,qBAAqB,uLAAuL;AAC5M,uCAAuC;AACvC,6CAA6C;AAC7C,mBAAmB;AACnB,wBAAwB;AACxB,mBAAmB;AACnB,gBAAgB;AAChB,qBAAqB;AACrB,CAAC;AACD,qBAAqB;AACrB,CAAC;AACD,gBAAgB;AAChB;AACA,qBAAqB;AACrB,qBAAqB,mLAAmL;AACxM,CAAC;AACD,cAAc;AACd,uBAAuB;AACvB,gFAAgF;AAChF,8EAA8E;AAC9E,uBAAuB;AACvB,mBAAmB;AACnB,yCAAyC;AACzC,aAAa;AACb,gBAAgB;AAChB,iBAAiB;AACjB,gBAAgB;AAChB,gBAAgB;AAChB,4BAA4B;AAC5B,+BAA+B;AAC/B,uBAAuB;AACvB,gBAAgB;AAChB,iBAAiB;AACjB,sBAAsB;AACtB,oBAAoB;AACpB,mBAAmB;AACnB,oBAAoB;AACpB,uBAAuB;AACvB,qBAAqB;AACrB,CAAC;AACD,yCAAyC;AACzC,oBAAoB;AACpB,CAAC;AACD,kBAAkB;AAClB,4BAA4B;AAC5B,+BAA+B;AAC/B,uBAAuB;AACvB,sBAAsB;AACtB,cAAc;AACd,YAAY;AACZ,oBAAoB;AACpB,uCAAuC,+JAA+J;AACtM,6BAA6B;AAC7B,4BAA4B;AAC5B,mBAAmB;AACnB,8BAA8B;AAC9B,gBAAgB;AAChB,CAAC;AACD,uCAAuC;AACvC,sBAAsB;AACtB,CAAC;AACD,0BAA0B;AAC1B,uCAAuC,+JAA+J;AACtM,CAAC;AACD,6BAA6B;AAC7B,uCAAuC,uKAAuK;AAC9M,CAAC;AACD,wBAAwB;AACxB,qCAAqC;AACrC,2CAA2C;AAC3C,+CAA+C;AAC/C,CAAC;AACD,yBAAyB;AACzB,qCAAqC;AACrC,sCAAsC;AACtC,+CAA+C;AAC/C,CAAC;AACD,4BAA4B;AAC5B,uCAAuC,+HAA+H;AACtK,CAAC;AACD,oCAAoC;AACpC,uCAAuC,mIAAmI;AAC1K,CAAC;AACD,uCAAuC;AACvC,uCAAuC,+HAA+H;AACtK,CAAC;AACD,kCAAkC;AAClC,+CAA+C;AAC/C,2CAA2C;AAC3C,CAAC;AACD,mCAAmC;AACnC,+CAA+C;AAC/C,CAAC;AACD,8BAA8B;AAC9B,0BAA0B;AAC1B,sBAAsB;AACtB,CAAC;AACD,yCAAyC;AACzC,4CAA4C;AAC5C,oCAAoC;AACpC,WAAW;AACX,CAAC;AACD,+CAA+C;AAC/C,6CAA6C;AAC7C,qCAAqC;AACrC,UAAU;AACV,CAAC;AACD,gBAAgB;AAChB,2BAA2B;AAC3B,CAAC;AACD,WAAW;AACX,kBAAkB;AAClB,CAAC;AACD,uBAAuB;AACvB,oBAAoB;AACpB,CAAC;AACD,aAAa;AACb,mBAAmB;AACnB,CAAC;AACD,mBAAmB;AACnB,sCAAsC;AACtC,mBAAmB;AACnB,WAAW;AACX,CAAC;AACD,uBAAuB;AACvB,wCAAwC;AACxC,mBAAmB;AACnB,WAAW;AACX,CAAC;AACD,UAAU,iCAAiC;AAC3C,UAAU,iCAAiC;AAC3C,UAAU,gCAAgC,kCAAkC;AAC5E,UAAU,iCAAiC;AAC3C,UAAU,gCAAgC,kCAAkC;AAC5E,UAAU,gCAAgC,kCAAkC;AAC5E,UAAU,gCAAgC,iCAAiC,kCAAkC;AAC7G,UAAU,iCAAiC;AAC3C,UAAU,gCAAgC,kCAAkC;AAC5E,UAAU,gCAAgC,kCAAkC;AAC5E,UAAU,gCAAgC,iCAAiC,kCAAkC;AAC7G,UAAU,gCAAgC,kCAAkC;AAC5E,UAAU,gCAAgC,iCAAiC,kCAAkC;AAC7G,UAAU,gCAAgC,iCAAiC,kCAAkC;AAC7G,UAAU,gCAAgC,iCAAiC,iCAAiC,iCAAiC;AAC7I,qBAAqB;AACrB,8BAA8B;AAC9B,0BAA0B;AAC1B,2BAA2B;AAC3B,CAAC;AACD;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;;AAEL;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA,+F;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,SAAS;AACT;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mB;AACA,S;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,0CAA0C;AAC1C;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,iDAAiD,QAAQ;AACzD,6CAA6C,QAAQ;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,sBAAsB;;AAEtB;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,mBAAmB,OAAO;AAC1B;;AAEA;AACA;AACA;AACA,sDAAsD,qBAAqB;AAC3E;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,iCAAiC;;AAEjC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,gBAAgB;AAChB;;AAEA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4CAA4C,YAAY;;AAExD;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,iDAAiD;AACjD;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,iDAAiD,aAAa;AAC9D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC;;;AAGD;AACA,qBAAqB,oBAAoB;AACzC;AACA;AACA;AACA;AACA,SAAS;AACT;AACA,KAAK;AACL;AACA,yBAAyB,2BAA2B,EAAE;AACtD;AACA,KAAK;AACL;AACA,yBAAyB,2BAA2B,EAAE;AACtD;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA,oE;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA,KAAK;AACL;AACA;AACA;AACA,SAAS;AACT;AACA,KAAK;AACL;AACA,6BAA6B,4CAA4C;AACzE;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,SAAS;AACT;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,SAAS;AACT;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,SAAS;AACT;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,SAAS;AACT;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,SAAS;AACT;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,4BAA4B,oBAAoB,EAAE;AAClD,yBAAyB,oCAAoC,EAAE;AAC/D;AACA;AACA;AACA,CAAC;;AAED;AACA,CAAC;;AAED;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,yBAAyB,oDAAoD;AAC7E;AACA,mCAAmC,iCAAiC;AACpE,KAAK,YAAY;AACjB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,SAAS;AACT;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,wCAAwC,eAAe;AACvD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,oCAAoC;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,kCAAkC,yBAAyB;AAC3D;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,sCAAsC,qBAAqB,iBAAiB;AAC5E;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,iCAAiC,QAAQ;AACzC;;AAEA,CAAC;;;AAGD;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sCAAsC,gBAAgB;;AAEtD;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,yBAAyB,UAAU;AACnC;AACA;AACA,0BAA0B,yCAAyC;AACnE;AACA;AACA,0BAA0B,sCAAsC;AAChE;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;;AAEA;AACA;AACA;;;AAGA,CAAC;;AAED;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,SAAS;AACT;;AAEA;AACA,mGAAmG;AACnG;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,uBAAuB,wBAAwB;AAC/C;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA,oDAAoD,QAAQ;AAC5D;AACA,kCAAkC;AAClC;AACA;AACA,aAAa;AACb,oDAAoD,QAAQ;AAC5D;AACA,kCAAkC;AAClC;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,wCAAwC,KAAK;AAC7C;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wCAAwC,KAAK;AAC7C;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,M;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,mBAAmB;AAC1C;AACA;AACA;AACA;AACA;AACA,CAAC;;;AAGD;AACA,CAAC;;AAED;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,mBAAmB;;AAEnB;AACA;AACA;AACA;;AAEA;;;AAGA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET,KAAK;AACL;AACA,6C;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA,4E;AACA;AACA;AACA;;AAEA,wBAAwB;;AAExB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,oBAAoB;AAC/C;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA,8CAA8C,uBAAuB;;AAErE;AACA;AACA;;;AAGA;;AAEA,CAAC;;AAED;AACA;AACA;AACA,4BAA4B,4BAA4B,EAAE;AAC1D,cAAc,uCAAuC;AACrD;AACA;AACA,CAAC;AACD;AACA,4BAA4B,2BAA2B,EAAE;AACzD,cAAc,2CAA2C;AACzD;AACA;AACA,CAAC;AACD;AACA,4BAA4B,kCAAkC,EAAE;AAChE,cAAc,mDAAmD;AACjE;AACA;AACA,CAAC;AACD;AACA,4BAA4B,iCAAiC,EAAE;AAC/D,cAAc,uDAAuD;AACrE;AACA;AACA,CAAC;AACD;AACA,4BAA4B,uBAAuB,EAAE;AACrD,cAAc,2CAA2C;AACzD;AACA;AACA,CAAC;AACD;AACA,4BAA4B,sBAAsB,EAAE;AACpD,cAAc,6CAA6C;AAC3D;AACA;AACA,CAAC;AACD;AACA,4BAA4B,6BAA6B,EAAE;AAC3D,cAAc,uDAAuD;AACrE;AACA;AACA,CAAC;AACD;AACA,4BAA4B,4BAA4B,EAAE;AAC1D,cAAc,yDAAyD;AACvE;AACA;AACA,CAAC;AACD;AACA,4BAA4B,qCAAqC,EAAE;AACnE,cAAc,qCAAqC;AACnD;AACA,CAAC;AACD;AACA,4BAA4B,uBAAuB,EAAE;AACrD,cAAc,qCAAqC;AACnD;AACA,CAAC;AACD;AACA,4BAA4B,kBAAkB,EAAE;AAChD,cAAc,qCAAqC;AACnD;AACA;AACA,CAAC;AACD;AACA;AACA;AACA,4BAA4B,8BAA8B,EAAE;AAC5D;AACA;AACA,mCAAmC;AACnC,CAAC;;AAED;AACA;;AAEA,CAAC;;AAED;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,kCAAkC,aAAa;AAC/C;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,oCAAoC,KAAK;AACzC;AACA;AACA;;AAEA,qCAAqC,gBAAgB;;AAErD;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,sCAAsC,YAAY;AAClD;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,gCAAgC,eAAe;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B,YAAY;AACzC;AACA;AACA;AACA;;AAEA;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,mCAAmC,KAAK;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,0DAA0D;AAC1D;AACA;AACA,SAAS;AACT;AACA,SAAS;AACT;AACA,SAAS;AACT;AACA,sDAAsD;AACtD,SAAS;AACT,mEAAmE;AACnE;AACA;AACA,M;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,uDAAuD,wBAAwB;;AAE/E;AACA;;AAEA;AACA;AACA,mCAAmC,KAAK;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gEAAgE,wBAAwB;AACxF;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,2BAA2B,mBAAmB;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,S;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA,mCAAmC,KAAK;AACxC;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,gCAAgC,KAAK;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,gCAAgC,KAAK;AACrC;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,gCAAgC,KAAK;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA,iBAAiB;;AAEjB;AACA;AACA;AACA;AACA;AACA,iCAAiC,mBAAmB;AACpD;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,aAAa;;AAEb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,SAAS;AACT;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;;AAGD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,SAAS;AACT;AACA,KAAK;AACL;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,CAAC;;;;AAID,CAAC;;AAED;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,qBAAqB;AACrB;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,mBAAmB;AACnB;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,CAAC;;AAED,CAAC;;AAED;AACA;;AAEA;AACA;AACA,wCAAwC;AACxC,oBAAoB;AACpB,YAAY;AACZ,CAAC;AACD,2BAA2B;AAC3B,WAAW;AACX,oBAAoB;AACpB,CAAC;AACD,mBAAmB;AACnB,0BAA0B;AAC1B,CAAC;AACD,SAAS;AACT,0BAA0B;AAC1B,aAAa;AACb,CAAC;AACD,qBAAqB;AACrB,aAAa;AACb,CAAC;AACD,wBAAwB;AACxB,0BAA0B;AAC1B,CAAC;AACD;AACA,sBAAsB;AACtB,YAAY;AACZ,CAAC;AACD,uBAAuB;AACvB,uBAAuB;AACvB,CAAC;AACD,mCAAmC;AACnC,wBAAwB;AACxB,CAAC;AACD,oCAAoC;AACpC,wBAAwB;AACxB,CAAC;AACD,mCAAmC;AACnC,uBAAuB;AACvB,CAAC;AACD,sBAAsB;AACtB,uCAAuC;AACvC,WAAW;AACX,CAAC;AACD,mCAAmC;AACnC,wBAAwB;AACxB,CAAC;AACD,mCAAmC;AACnC,uBAAuB;AACvB,CAAC;AACD;AACA,gCAAgC;AAChC,0BAA0B;AAC1B,CAAC;AACD,mCAAmC;AACnC,0BAA0B;AAC1B,CAAC;AACD,qBAAqB;AACrB,sBAAsB;AACtB,CAAC;AACD,sBAAsB;AACtB,yBAAyB;AACzB,CAAC;AACD,8BAA8B;AAC9B,wBAAwB;AACxB,CAAC;AACD,sCAAsC;AACtC,0BAA0B;AAC1B,CAAC;AACD,mCAAmC;AACnC,sBAAsB;AACtB,CAAC;AACD,uBAAuB;AACvB,yBAAyB;AACzB,CAAC;AACD,qBAAqB;AACrB,yBAAyB;AACzB,CAAC;AACD,2CAA2C;AAC3C,eAAe;AACf,CAAC;AACD,sBAAsB;AACtB,uBAAuB;AACvB,CAAC;AACD,mBAAmB;AACnB,uBAAuB;AACvB,CAAC;AACD,2BAA2B;AAC3B,sBAAsB;AACtB,CAAC;AACD,+BAA+B;AAC/B;AACA,CAAC;AACD,0CAA0C;AAC1C,+BAA+B;AAC/B,CAAC;AACD,kDAAkD;AAClD,8BAA8B;AAC9B,CAAC;AACD,qCAAqC;AACrC,6BAA6B;AAC7B,CAAC;AACD,sCAAsC;AACtC,+BAA+B;AAC/B,CAAC;AACD,wCAAwC;AACxC,sBAAsB;AACtB,qCAAqC;AACrC,CAAC;AACD,4CAA4C;AAC5C,gCAAgC;AAChC,CAAC;AACD,iCAAiC;AACjC,2BAA2B;AAC3B,CAAC;AACD,8CAA8C;AAC9C,+BAA+B;AAC/B,qCAAqC;AACrC,CAAC;AACD,2BAA2B;AAC3B,iCAAiC,kIAAkI;AACnK,CAAC;AACD;;AAEA;AACA;AACA,CAAC;;AAED;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA,M;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B,SAAS;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,SAAS;AACT;AACA;AACA;AACA,aAAa;AACb;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,0CAA0C,MAAM,OAAO,aAAa;;AAEpE;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0CAA0C,MAAM,OAAO,aAAa;AACpE;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,uBAAuB,2BAA2B;AAClD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8CAA8C,MAAM,OAAO,WAAW;AACtE;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA,2BAA2B,WAAW;AACtC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8DAA8D,iBAAiB;AAC/E;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;;AAEA,CAAC;;;AAGD;;AAEA,CAAC;;AAED;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,uCAAuC,qBAAqB;AAC5D;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,oBAAoB;AACpB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA,qDAAqD,0BAA0B;AAC/E;;;AAGA;AACA,2BAA2B;AAC3B,4BAA4B;AAC5B,uBAAuB;AACvB;AACA,KAAK;AACL,mBAAmB;AACnB,8BAA8B;AAC9B,iCAAiC;AACjC,sBAAsB;AACtB,2BAA2B;AAC3B,8BAA8B;AAC9B,KAAK;AACL,2DAA2D;AAC3D;AACA,KAAK;AACL,+DAA+D;AAC/D;AACA,KAAK;AACL,yDAAyD;AACzD;AACA,KAAK;AACL,qDAAqD;AACrD;AACA,KAAK;AACL,yBAAyB;AACzB,2BAA2B;AAC3B,0BAA0B;AAC1B,gDAAgD;AAChD,kDAAkD;AAClD,iDAAiD;AACjD,kBAAkB;AAClB,KAAK;AACL;;AAEA,CAAC;;AAED;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wCAAwC;AACxC,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB,aAAa;;AAEb,gD;;;;;;;;;AC/ynBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+CAA+C,WAAW;AAC1D;AACA,iDAAiD,WAAW,GAAG,WAAW,GAAG,WAAW,GAAG,WAAW;AACtG;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uFAAuF,QAAQ,YAAY,qBAAqB;AAChI;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uFAAuF,YAAY,GAAG,YAAY;AAClH;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA,gCAAgC,mCAAmC;AACnE;;AAEA;AACA,2CAA2C,SAAS,+BAA+B,EAAE;AACrF,4CAA4C,uCAAuC,EAAE;AACrF,mCAAmC,6CAA6C,EAAE;AAClF,qCAAqC,SAAS,uBAAuB;AACrE,SAAS;;AAET;AACA;;AAEA;AACA;AACA;AACA,yCAAyC;AACzC,iDAAiD,aAAa,GAAG,aAAa,GAAG,aAAa,GAAG,aAAa;AAC9G;AACA,mFAAmF,2BAA2B;AAC9G;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,uBAAuB,kBAAkB;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;;AAEA,uBAAuB,aAAa;AACpC,uBAAuB,iBAAiB;AACxC;AACA;AACA;AACA,yBAAyB,mBAAmB;AAC5C,gCAAgC,kBAAkB;AAClD;AACA;AACA;AACA;AACA,mBAAmB,mBAAmB;AACtC;AACA;AACA;AACA;AACA;AACA,uBAAuB,YAAY;AACnC;AACA;AACA,wBAAwB,SAAS;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,gBAAgB;AACvC,uBAAuB,iBAAiB;AACxC;AACA;AACA;AACA;AACA;AACA,uBAAuB,aAAa;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,uBAAuB,YAAY;AACnC;AACA;AACA;AACA;AACA;AACA;;AAEA,iBAAiB,UAAU,UAAU,QAAQ;AAC7C;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB,aAAa;AACnC,uBAAuB,aAAa;AACpC,2BAA2B,iBAAiB;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,aAAa;AACpC;AACA,uBAAuB,aAAa;;AAEpC;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,qCAAqC,qBAAqB,2BAA2B,GAAG,EAAE;AAC1F,qCAAqC,qBAAqB,+BAA+B,GAAG,EAAE;AAC9F,sCAAsC,qBAAqB,UAAU,GAAG,EAAE;AAC1E,qCAAqC,qBAAqB,UAAU,GAAG,EAAE;AACzE,+CAA+C,qBAAqB,YAAY,GAAG,EAAE;AACrF;AACA;AACA;AACA,uCAAuC,kBAAkB;AACzD;AACA;AACA;;AAEA,mCAAmC;AACnC,2BAA2B,WAAW;AACtC;AACA,gCAAgC,iBAAiB;AACjD,gCAAgC,OAAO;AACvC;AACA;AACA,mCAAmC;;AAEnC;AACA;;AAEA;AACA;;;AAGA;AACA;AACA,qDAAqD,UAAU,GAAG,UAAU,GAAG,YAAY,GAAG,YAAY;AAC1G;AACA;AACA;AACA;AACA;AACA,uBAAuB,mBAAmB;AAC1C;AACA;AACA;;AAEA,gBAAgB;AAChB;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,4DAA4D;AAC5D;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB;AAChB;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,iCAAiC,GAAG,iCAAiC;AACtF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,4BAA4B,+DAA+D,EAAE;AAC7F;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,mBAAmB,MAAM;AACzB,mBAAmB,MAAM;AACzB,oBAAoB,MAAM;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb,SAAS;AACT;AACA;AACA;AACA;AACA,mBAAmB,MAAM;AACzB,mBAAmB,MAAM;AACzB,oBAAoB,MAAM;AAC1B;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,mBAAmB,MAAM;AACzB,mBAAmB,MAAM;AACzB,oBAAoB,MAAM;AAC1B;AACA;AACA;AACA;AACA,aAAa;AACb,SAAS;AACT;AACA;AACA;AACA;AACA,mBAAmB,MAAM;AACzB,mBAAmB,MAAM;AACzB,oBAAoB,QAAQ;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb,SAAS;AACT;AACA;AACA;AACA;AACA,mBAAmB,MAAM;AACzB,mBAAmB,MAAM;AACzB,oBAAoB,MAAM;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,aAAa;AACb,SAAS;AACT;AACA;AACA;AACA;AACA,mBAAmB,UAAU,kDAAkD,uBAAuB;AACtG,mBAAmB,UAAU,mDAAmD,uBAAuB;AACvG,oBAAoB,QAAQ;AAC5B;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,mBAAmB,UAAU,kDAAkD,uBAAuB;AACtG,mBAAmB,UAAU,mDAAmD,uBAAuB;AACvG,mBAAmB,QAAQ;AAC3B,oBAAoB,QAAQ;AAC5B;AACA;AACA;AACA;AACA,8CAA8C,oEAAoE;;AAElH;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,MAAM;AACzB,mBAAmB,MAAM;AACzB,oBAAoB,MAAM,kCAAkC,eAAe;AAC3E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB;AACpB,SAAS;AACT;AACA;AACA;AACA;AACA,mBAAmB,MAAM;AACzB,mBAAmB,MAAM;AACzB,oBAAoB,KAAK,qCAAqC,eAAe,GAAG,eAAe;AAC/F;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB,iCAAiC,GAAG,iCAAiC;AAC1F;AACA,CAAC;AACD;AACA;;AAEA;;AAEA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,2BAA2B,sBAAsB;AACjD;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,oCAAoC;AACpC;AACA,wBAAwB;AACxB,aAAa;AACb,2BAA2B,kBAAkB;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA,yCAAyC,OAAO;AAChD;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,+BAA+B,yBAAyB;AACxD;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA,kDAAkD;AAClD;AACA;AACA;AACA,2CAA2C,kBAAkB;AAC7D;AACA,+CAA+C,cAAc;AAC7D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA,qBAAqB;AACrB;AACA;AACA,2CAA2C,gCAAgC;AAC3E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA,oBAAoB,oBAAoB;AACxC,uBAAuB,oBAAoB;AAC3C,4BAA4B;AAC5B,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+CAA+C,kBAAkB;AACjE;AACA;AACA,mDAAmD,6BAA6B;AAChF;AACA;AACA;AACA;AACA;AACA,kDAAkD;AAClD;AACA;AACA;AACA,6BAA6B;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+DAA+D,wBAAwB;AACvF;AACA,uEAAuE,sBAAsB;AAC7F;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B;AAC7B;AACA;AACA,6BAA6B;AAC7B;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA,mCAAmC;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB;AACzB;AACA;AACA;AACA;AACA,2CAA2C,2BAA2B;AACtE;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,oBAAoB,6EAA6E;AACjG;AACA;AACA;AACA;AACA;AACA,iDAAiD,GAAG,QAAQ,GAAG;AAC/D;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,aAAa;AACb,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,2BAA2B,gBAAgB;AAC3C;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,QAAQ;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;;AAEA;AACA;AACA;AACA;AACA,mBAAmB,eAAe;AAClC,oBAAoB,OAAO,6BAA6B;AACxD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,mBAAmB,yBAAyB;AAC5C,mBAAmB,OAAO;AAC1B,mBAAmB,OAAO;AAC1B,mBAAmB,SAAS;AAC5B,oBAAoB,OAAO,6BAA6B;AACxD;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,mBAAmB,yBAAyB;AAC5C,mBAAmB,OAAO;AAC1B,mBAAmB,SAAS;AAC5B,oBAAoB,OAAO,6BAA6B;AACxD;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,mBAAmB,QAAQ;AAC3B,mBAAmB,OAAO;AAC1B,mBAAmB,MAAM;AACzB;AACA,mBAAmB,OAAO,sEAAsE;AAChG,oBAAoB,OAAO,6BAA6B;AACxD;AACA;AACA,8CAA8C;AAC9C;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAe,MAAM;AACrB,eAAe,QAAQ;AACvB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,eAAe,MAAM;AACrB,gBAAgB,SAAS;AACzB;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA,CAAC;;AAED;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;AACA;;AAEA,CAAC;;AAED;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,uBAAuB,eAAe;AACtC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,gBAAgB;AAChB;;AAEA;AACA;AACA;AACA,uBAAuB,sBAAsB;AAC7C;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,iDAAiD,GAAG,QAAQ,GAAG;AAC/D;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,4CAA4C,wDAAwD,EAAE;AACtG;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,gCAAgC;AAChC,4BAA4B,aAAa,EAAE;AAC3C;AACA,2BAA2B,cAAc;AACzC;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,aAAa;AACb,SAAS;AACT;AACA;AACA;AACA,2BAA2B,gBAAgB;AAC3C;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,uCAAuC,aAAa;AACpD,qCAAqC,gBAAgB;AACrD,yCAAyC,oBAAoB;AAC7D;AACA;AACA;AACA;AACA;AACA,4CAA4C,cAAc;AAC1D,kEAAkE,cAAc;AAChF;AACA;AACA;AACA;AACA;AACA,4CAA4C,cAAc;AAC1D,kEAAkE,cAAc;AAChF;AACA;AACA;AACA;AACA;AACA,4CAA4C,cAAc;AAC1D;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,2BAA2B,aAAa;AACxC,4BAA4B,cAAc;;AAE1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uCAAuC,2BAA2B;;AAElE;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,6BAA6B,4BAA4B;AACtE,SAAS;;AAET;;;AAGA;AACA,2GAA2G;AAC3G;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA,aAAa;AACb,qBAAqB,4BAA4B;AACjD,yBAAyB;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB;AACzB;AACA;;AAEA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+DAA+D;AAC/D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8CAA8C,0CAA0C;AACxF;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA,wDAAwD,0CAA0C;AAClG;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET,sCAAsC,iBAAiB;;AAEvD;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,yBAAyB;AACzB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,+BAA+B,2BAA2B;AAC1D;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,+BAA+B,2BAA2B;AAC1D;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B;AAC/B;AACA;AACA;AACA;;AAEA;AACA,gCAAgC,gEAAgE;AAChG;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,mCAAmC,gBAAgB;AACnD;AACA,qDAAqD,wBAAwB;AAC7E;AACA;AACA;AACA,8CAA8C,0BAA0B;AACxE;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,6BAA6B;;AAE7B;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B,mCAAmC;AAClE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,wBAAwB,sDAAsD;AAC9E,4BAA4B,sEAAsE;AAClG;;;;AAIA;AACA,2BAA2B,+BAA+B;AAC1D,0BAA0B;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,+BAA+B,qCAAqC;;AAEpE;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,mCAAmC,cAAc;;AAEjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8DAA8D,sCAAsC;AACpG;AACA;AACA;;AAEA;AACA,+CAA+C,gCAAgC;AAC/E;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAS;AACT;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,kCAAkC,wBAAwB;AAC1D;AACA;AACA;AACA,iBAAiB;AACjB,aAAa;AACb;AACA;AACA;AACA,kCAAkC,wBAAwB;AAC1D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;;AAEjB;AACA,aAAa;AACb;AACA;AACA,+BAA+B,wBAAwB;AACvD;AACA;AACA,uCAAuC,gBAAgB;AACvD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;;AAEA,2BAA2B,oBAAoB;AAC/C;AACA;AACA;AACA;AACA,aAAa;AACb;AACA,+BAA+B,oBAAoB;AACnD;AACA;AACA;AACA;AACA,aAAa;AACb,qBAAqB;AACrB,mDAAmD;AACnD;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,oBAAoB,OAAO;AAC3B;AACA,kDAAkD,4BAA4B;;AAE9E;AACA;AACA;AACA,mBAAmB,OAAO;AAC1B,oBAAoB,UAAU,kBAAkB;AAChD;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;;AAEA;AACA;AACA;AACA;AACA,mBAAmB,eAAe;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;;AAEA;AACA;AACA;AACA;AACA,mBAAmB,eAAe;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uCAAuC,uBAAuB;AAC9D;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,8CAA8C,UAAU,EAAE;AAC1D;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB;AACzB;AACA,iBAAiB;AACjB;AACA;;AAEA;AACA,8CAA8C,iBAAiB,EAAE;AACjE;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB;AACzB;AACA,iBAAiB;AACjB;AACA;;AAEA,wCAAwC,4BAA4B;;AAEpE;AACA,8CAA8C,kBAAkB,EAAE;AAClE;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB;AACzB;AACA,iBAAiB;AACjB;AACA;;AAEA;AACA,sCAAsC,kBAAkB,EAAE;AAC1D;;AAEA;AACA,sCAAsC,mBAAmB,EAAE;AAC3D;;AAEA;AACA,8CAA8C,mBAAmB,EAAE;AACnE;;AAEA;AACA,8CAA8C,qBAAqB;AACnE;;AAEA,oCAAoC,WAAW;AAC/C,mCAAmC,cAAc;;AAEjD;AACA;AACA;AACA,mCAAmC;AACnC,kCAAkC;AAClC,iCAAiC;AACjC,aAAa;AACb;;AAEA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,aAAa;AACb;AACA;AACA,aAAa;AACb,SAAS;;AAET;AACA;AACA,6DAA6D,cAAc,EAAE;AAC7E;AACA;;AAEA,6CAA6C,8BAA8B;AAC3E,6CAA6C,8BAA8B;;AAE3E;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,oDAAoD,iBAAiB;AACrE;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,mBAAmB,OAAO;AAC1B,mBAAmB,SAAS;AAC5B;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,mBAAmB,OAAO;AAC1B,mBAAmB,SAAS;AAC5B;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,yBAAyB;AACzB;AACA;AACA,aAAa;AACb;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;;AAEA;AACA;AACA;AACA,mBAAmB,QAAQ;AAC3B,mBAAmB,oBAAoB;AACvC;AACA,aAAa,iCAAiC;AAC9C;AACA,qBAAqB,cAAc;AACnC;AACA;;AAEA;;AAEA,2BAA2B,sBAAsB;AACjD;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,mBAAmB,QAAQ;AAC3B,mBAAmB,oBAAoB;AACvC;AACA,aAAa,iCAAiC;AAC9C;AACA,qBAAqB,cAAc;AACnC;AACA;;AAEA;;AAEA,2BAA2B,sBAAsB;AACjD;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,mCAAmC,iBAAiB;AACpD;AACA;AACA;AACA,aAAa;;AAEb;AACA;;AAEA;AACA;AACA;AACA,mBAAmB,QAAQ;AAC3B,mBAAmB,UAAU;AAC7B;AACA;AACA;AACA,0BAA0B,sBAAsB;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB;AACzB;AACA,iBAAiB;AACjB;AACA;;AAEA;AACA;AACA;AACA,mBAAmB,kBAAkB;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA,aAAa;AACb;;AAEA;AACA;AACA,mBAAmB,kBAAkB;AACrC,mBAAmB,OAAO;AAC1B,mBAAmB,QAAQ;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;;AAEA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B,cAAc;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,yBAAyB;AACzB;AACA,uBAAuB,uBAAuB;AAC9C;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oCAAoC;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA,oDAAoD,EAAE;AACtD;AACA;AACA;AACA;AACA;AACA,yBAAyB;AACzB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB;AACzB;AACA;AACA;AACA;AACA;AACA,yBAAyB;AACzB;AACA;AACA,aAAa;;AAEb;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,2BAA2B,gBAAgB;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,4BAA4B;AAC5B;AACA;AACA;AACA,wDAAwD,IAAI;AAC5D;AACA,uCAAuC,oBAAoB;AAC3D;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2CAA2C,cAAc;AACzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,SAAS;AACT;AACA;AACA;AACA,+BAA+B,cAAc;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,uBAAuB,mBAAmB;AAC1C;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,+BAA+B,mBAAmB;AAClD;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,2BAA2B,sBAAsB;AACjD;AACA;AACA;;AAEA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,aAAa;AACb,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,SAAS,2CAA2C;AACvE,mBAAmB,SAAS;AAC5B,mBAAmB,OAAO;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,2BAA2B;AAC3B;AACA;AACA;AACA,6BAA6B,gBAAgB;AAC7C;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,+BAA+B,kBAAkB;AACjD;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iCAAiC;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE;;AAEF;;AAEA;;AAEA;AACA;AACA;AACA,sBAAsB,sBAAsB;AAC5C;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,EAAE;;AAEF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA,wBAAwB,sDAAsD;AAC9E;AACA;AACA;AACA,4DAA4D,OAAO;AACnE;AACA,6EAA6E;AAC7E;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,2BAA2B,gBAAgB;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,oCAAoC;AACpC;AACA,oEAAoE,OAAO;AAC3E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,mDAAmD;AACnD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;;AAGA;AACA;AACA,+BAA+B,oCAAoC;AACnE;AACA;;AAEA,2BAA2B,cAAc;AACzC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,mDAAmD;AACnD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;;AAEb;AACA,4BAA4B;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,+BAA+B,yBAAyB;AACxD;AACA;AACA;;;AAGA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,SAAS;;AAET;AACA;AACA,SAAS;;AAET;AACA;AACA,SAAS;;AAET;AACA;AACA,SAAS;;AAET;AACA;AACA,SAAS;;AAET;AACA;AACA,SAAS;;AAET;AACA;AACA,SAAS;;AAET;AACA;AACA,SAAS;;AAET;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA,SAAS;;AAET;AACA;AACA,SAAS;;AAET;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA,6CAA6C,OAAO;AACpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;;AAEb;AACA,6CAA6C,OAAO;AACpD;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,2BAA2B,OAAO;AAClC;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA,6CAA6C,OAAO;AACpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA,2DAA2D;AAC3D;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA,+DAA+D;AAC/D;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA,wCAAwC;AACxC;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sCAAsC,oCAAoC;AAC1E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,iCAAiC;AACjC;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B;AAC5B;AACA;AACA;AACA,4BAA4B;AAC5B;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,+BAA+B,kCAAkC;AACjE;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,aAAa;;AAEb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA,iBAAiB;AACjB;;AAEA,2BAA2B,mBAAmB;AAC9C;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,yDAAyD;AACzD;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mCAAmC;AACnC,gCAAgC;AAChC,gCAAgC;AAChC,wBAAwB;AACxB,iCAAiC;AACjC,gCAAgC;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;;AAEb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;;AAEb;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+CAA+C;AAC/C;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,2CAA2C,4DAA4D;;AAEvG;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iCAAiC;AACjC;AACA;AACA,6BAA6B;AAC7B;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;;AAEb;AACA;AACA;AACA;AACA;AACA,aAAa;;AAEb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uDAAuD,WAAW;AAClE;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,6DAA6D,gBAAgB;AAC7E,6DAA6D,gBAAgB;AAC7E;AACA;AACA;AACA;AACA,iCAAiC;;AAEjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iCAAiC;AACjC;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6CAA6C;AAC7C;AACA;AACA;AACA,iEAAiE,iBAAiB;AAClF,iEAAiE,iBAAiB;AAClF;AACA;;AAEA,mDAAmD,qBAAqB;AACxE;AACA;;AAEA;AACA;AACA;AACA,iCAAiC;AACjC,2DAA2D;AAC3D;AACA;AACA;AACA;AACA;AACA;AACA,+EAA+E,4BAA4B;AAC3G;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;;AAEb;AACA;AACA,+BAA+B,eAAe;AAC9C,mCAAmC,eAAe;AAClD;AACA;AACA;AACA;AACA;;AAEA;AACA,aAAa;;AAEb;AACA,yCAAyC;AACzC;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;;AAEb;AACA;AACA;AACA;AACA,yCAAyC,EAAE;AAC3C;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,wEAAwE;AACxE;AACA;;AAEA;AACA;AACA,wEAAwE;AACxE;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,mFAAmF,OAAO;AAC1F;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B;AAC7B;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,aAAa;;AAEb;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,aAAa;;AAEb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA,qCAAqC;AACrC;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa;;AAEb;AACA;AACA;AACA;AACA;AACA;AACA,0CAA0C;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,aAAa;;AAEb;AACA;AACA,oCAAoC;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0DAA0D,QAAQ;AAClE,6EAA6E,QAAQ;AACrF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;;AAEb;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B;AAC1B;AACA;AACA,iBAAiB;AACjB,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB,aAAa;;AAEb;AACA;AACA;AACA;AACA,0CAA0C,WAAW;AACrD;AACA;AACA,4BAA4B;AAC5B;AACA,aAAa;;AAEb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,qBAAqB,OAAO,eAAe,qCAAqC;AAChF;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4CAA4C;AAC5C,2DAA2D;AAC3D,wEAAwE;AACxE,wEAAwE;AACxE;AACA;AACA;AACA;;AAEA;AACA,2BAA2B,WAAW;AACtC,0BAA0B,UAAU;AACpC,yBAAyB,UAAU,EAAE;AACrC;AACA;;AAEA;;;AAGA;AACA;AACA,qCAAqC;AACrC;AACA;AACA;;AAEA;AACA;;AAEA,8CAA8C,OAAO;AACrD;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,qDAAqD,0FAA0F;AAC/I;AACA,qBAAqB;AACrB;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,iDAAiD,OAAO;AACxD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa;;AAEb;AACA;AACA;AACA,aAAa;;AAEb;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,iDAAiD,OAAO;AACxD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,aAAa,sEAAsE;AACnF,aAAa;AACb;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,8BAA8B;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,SAAS;;AAET;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,+CAA+C,oGAAoG;AACnJ;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,yDAAyD,OAAO;AAChE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;;AAEjB;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yDAAyD,OAAO;AAChE;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,mBAAmB,OAAO;AAC1B,mBAAmB,QAAQ;AAC3B,mBAAmB,QAAQ;AAC3B,qBAAqB,QAAQ;AAC7B;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,qBAAqB;;AAErB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,mBAAmB,OAAO;AAC1B,mBAAmB,QAAQ;AAC3B,mBAAmB,QAAQ;AAC3B,qBAAqB,OAAO;AAC5B;AACA;AACA;AACA;AACA;AACA,+BAA+B,WAAW;AAC1C;AACA;AACA,aAAa;AACb;AACA;;AAEA;AACA;AACA;AACA,mBAAmB,OAAO;AAC1B,mBAAmB,OAAO;AAC1B,mBAAmB,QAAQ;AAC3B,mBAAmB,QAAQ;AAC3B,oBAAoB,gBAAgB;AACpC;AACA;AACA;AACA;AACA;AACA;AACA,qDAAqD,OAAO;AAC5D;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,iCAAiC;AACjC,mCAAmC;AACnC;AACA;AACA,iBAAiB;AACjB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,uCAAuC,iCAAiC;AACxE;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;;AAErB;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;;AAEA;AACA;AACA,gDAAgD,OAAO;AACvD;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,gDAAgD,OAAO;AACvD;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iEAAiE,OAAO;AACxE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,aAAa;AACb,2BAA2B;AAC3B;AACA;AACA;AACA;AACA;AACA,2DAA2D;AAC3D;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;;AAEA,oDAAoD,QAAQ;AAC5D;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,qDAAqD,QAAQ;AAC7D;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,4CAA4C,QAAQ;AACpD;AACA;;AAEA,4CAA4C,QAAQ;AACpD;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qDAAqD,QAAQ;AAC7D;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA,aAAa;AACb;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qDAAqD,QAAQ;AAC7D;AACA;AACA,iBAAiB;AACjB;AACA,qDAAqD,QAAQ;AAC7D;AACA;AACA;AACA,aAAa;AACb;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,2EAA2E,QAAQ;AACnF;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,wBAAwB;AAC3C,oBAAoB,WAAW;AAC/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wDAAwD;AACxD;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,2CAA2C;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,0DAA0D,oCAAoC;AAC9F;AACA,4DAA4D,mDAAmD;AAC/G;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,2DAA2D;AAC3D;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B;AAC5B;AACA;AACA,+DAA+D;;AAE/D;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,oBAAoB;AACpB;;AAEA;AACA;AACA,+BAA+B;AAC/B;AACA;AACA;AACA;AACA,iFAAiF,kCAAkC;AACnH;AACA;AACA;AACA,SAAS;;AAET;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,8CAA8C,wDAAwD;AACtG;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sDAAsD,wDAAwD;AAC9G;AACA;AACA;AACA;AACA;AACA,sDAAsD,8EAA8E;AACpI;AACA;AACA;AACA;AACA,+DAA+D,2FAA2F;AAC1J;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,8CAA8C,QAAQ;AACtD;AACA,2DAA2D,uDAAuD;AAClH;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,gIAAgI;AAChI;AACA;AACA;AACA,mDAAmD,+FAA+F;AAClJ;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,2BAA2B,gBAAgB;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA,+DAA+D,kBAAkB;AACjF;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA,iBAAiB;AACjB;AACA;AACA,iBAAiB;AACjB;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB;AACzB;AACA;AACA;AACA,6BAA6B;AAC7B;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,iBAAiB;AACjB;AACA;AACA,uDAAuD,aAAa;AACpE;AACA;AACA;AACA;AACA;AACA,aAAa;;AAEb;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,yEAAyE,aAAa;AACtF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;AACA,yCAAyC,eAAe;AACxD;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA,4DAA4D,qBAAqB;AACjF;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,mDAAmD;AACnD;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,iBAAiB;;AAEjB;AACA;;AAEA;AACA,+CAA+C,QAAQ;AACvD;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,yCAAyC,eAAe;AACxD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,kDAAkD;AAClD;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,2DAA2D,EAAE,qBAAqB;AAClF;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,qBAAqB;;AAErB;;AAEA;AACA;AACA;AACA;AACA,kDAAkD;;AAElD;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,oDAAoD,qGAAqG;AACzJ;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;;AAErB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,sEAAsE;;AAEtE;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,uDAAuD,aAAa;AACpE;AACA;AACA;AACA;AACA;AACA,iCAAiC;AACjC;AACA;AACA;;AAEA,2FAA2F;AAC3F;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA,qBAAqB;;AAErB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,4DAA4D,qBAAqB;;AAEjF;;AAEA,iBAAiB;;AAEjB;AACA,+CAA+C,QAAQ;AACvD;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,2BAA2B,kBAAkB;AAC7C;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA,2BAA2B,kBAAkB;AAC7C;AACA;AACA;AACA;AACA;;AAEA,SAAS;;AAET;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,+CAA+C,QAAQ;AACvD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAAS;;AAET;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,+CAA+C,QAAQ;AACvD;AACA;AACA;AACA,kBAAkB;AAClB;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,aAAa;AACb;;AAEA;AACA;AACA;AACA,+CAA+C,gDAAgD;AAC/F;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,+CAA+C,iDAAiD;AAChG;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,gDAAgD,QAAQ;AACxD;AACA;AACA;AACA;;AAEA;AACA;AACA,mEAAmE,QAAQ;AAC3E;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,4BAA4B,8BAA8B;AAC1D;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa;;AAEb;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,2BAA2B,iBAAiB;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB;AACpB;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,8CAA8C,uBAAuB;AACrE,8CAA8C,uBAAuB;;AAErE;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,kEAAkE,QAAQ;AAC1E;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,iDAAiD,QAAQ;AACzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,qDAAqD;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA,gCAAgC,EAAE;AAClC;AACA;AACA;AACA,SAAS;AACT;AACA,8DAA8D;AAC9D;AACA;AACA,+BAA+B,0BAA0B;AACzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,SAAS;AACT;AACA,4DAA4D;AAC5D;AACA;AACA,+BAA+B,0BAA0B;AACzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,2BAA2B,kBAAkB;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,SAAS;AACT,+BAA+B;AAC/B;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB,EAAE;AACxB,sBAAsB,EAAE;AACxB;AACA;AACA;AACA,wBAAwB,eAAe;AACvC;AACA;AACA;AACA;AACA,qBAAqB,iBAAiB;AACtC;AACA;AACA;AACA,qBAAqB,oCAAoC;AACzD;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,iBAAiB;AAC5C;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA,4BAA4B,8BAA8B,6BAA6B;AACvF;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,mCAAmC,yBAAyB;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B,sBAAsB;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;;AAEA;AACA,+BAA+B,oBAAoB;AACnD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,SAAS;;AAET;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,SAAS;;AAET;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,aAAa;AACb,SAAS;AACT;AACA;AACA;AACA;AACA,aAAa;AACb,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;;AAEjB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,sGAAsG,uCAAuC;AAC7I;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,SAAS;;AAET;AACA;AACA;AACA,mBAAmB,QAAQ;AAC3B,oBAAoB,SAAS;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA,mBAAmB,QAAQ;AAC3B,mBAAmB,SAAS;AAC5B,mBAAmB,SAAS;AAC5B,mBAAmB,OAAO;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,SAAS;AACT,oCAAoC,cAAc;;AAElD,KAAK;AACL,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;;AAEA;AACA,SAAS;AACT;AACA;AACA,iCAAiC,yCAAyC,WAAW;AACrF;AACA,8BAA8B,WAAW,GAAG,aAAa;AACzD;AACA;AACA;AACA,oCAAoC,4DAA4D;AAChG;AACA;AACA;AACA;AACA,aAAa;AACb,gGAAgG,4DAA4D;AAC5J,aAAa;AACb;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,yBAAyB;;AAEzB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,qFAAqF;AACrF,6DAA6D;AAC7D;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA,iDAAiD,OAAO;AACxD;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,uFAAuF,WAAW;AAClG;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,KAAK;;AAEL;;AAEA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oCAAoC,gDAAgD,iBAAiB,EAAE;AACvG;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,+CAA+C,wBAAwB;AACvE;AACA;AACA;AACA;AACA;AACA,qCAAqC;AACrC;AACA;AACA;AACA;;AAEA;AACA;AACA,qDAAqD,0FAA0F;AAC/I;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,2BAA2B,2BAA2B;AACtD;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA,4CAA4C,sCAAsC;AAClF;AACA,aAAa;AACb;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,+BAA+B,6BAA6B;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;;AAET;AACA,iCAAiC;AACjC;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B;AAC3B;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,kDAAkD;AAClD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;;AAEb;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;;AAEA;AACA;AACA,2BAA2B,OAAO;AAClC;AACA;AACA;;AAEA;AACA;AACA,2BAA2B,6BAA6B;AACxD;AACA;AACA;AACA;AACA,6CAA6C,WAAW;AACxD;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,sDAAsD,cAAc;AACpE;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA,qBAAqB;AACrB;AACA;AACA,qBAAqB;AACrB;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;;AAEA;AACA,8CAA8C;AAC9C;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA,kDAAkD,6CAA6C;;AAE/F;AACA;AACA;AACA;AACA;AACA,4CAA4C;AAC5C;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,yBAAyB;AACzB;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,uCAAuC,0BAA0B;AACjE;AACA;AACA;AACA;AACA,0DAA0D;AAC1D,oCAAoC;AACpC;AACA;AACA;AACA;AACA;;AAEA,yDAAyD;AACzD;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA,4DAA4D;AAC5D;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA,mCAAmC,6BAA6B;AAChE;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,2CAA2C,uBAAuB;;AAElE;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,qBAAqB;;AAErB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB;AACzB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA,qBAAqB;AACrB;AACA;AACA;AACA;AACA,mEAAmE;;AAEnE;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,yBAAyB;AACzB;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,gEAAgE;AAChE;AACA;;;AAGA;AACA;AACA,iBAAiB;;AAEjB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iCAAiC;AACjC,2EAA2E;AAC3E;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,wEAAwE;AACxE;AACA;AACA;AACA;AACA;AACA,mIAAmI,6BAA6B;;AAEhK;AACA;AACA;AACA;AACA;;AAEA;AACA,mDAAmD;AACnD;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,2DAA2D,aAAa;AACxE;AACA;AACA;;AAEA;AACA;AACA,mDAAmD,eAAe;AAClE;AACA;AACA;AACA,6CAA6C,cAAc;AAC3D;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+CAA+C,sBAAsB;AACrE;;AAEA;AACA,8EAA8E;AAC9E;AACA;AACA;AACA;AACA;AACA;;AAEA,iBAAiB;;AAEjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,iBAAiB;;AAEjB;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,yFAAyF;AACzF;AACA;;AAEA;AACA;AACA,2CAA2C;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB;AACzB;AACA;AACA;AACA,yBAAyB;AACzB;AACA;AACA,yBAAyB;AACzB;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB;AACzB;AACA;AACA,yBAAyB;AACzB;AACA;AACA,yBAAyB;AACzB;AACA;AACA;AACA;AACA,qBAAqB;;AAErB;AACA;AACA;AACA;AACA,qEAAqE;;AAErE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B;AAC7B;AACA;AACA;AACA;AACA;AACA,iBAAiB;;AAEjB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;;AAEjB;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B,6BAA6B;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,+BAA+B,6BAA6B;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,KAAK;;AAEL;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,sBAAsB;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,kDAAkD;AAClD;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB;AACzB;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,iBAAiB;;AAEjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB;AACzB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,qHAAqH;;AAErH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,uBAAuB;AACvB;;AAEA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;AACA;AACA,SAAS;AACT;AACA;;;AAGA,kCAAkC;AAClC;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA,sCAAsC,6DAA6D;AACnG,qCAAqC,4DAA4D;;AAEjG;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;;AAEjB,qCAAqC,oDAAoD;;AAEzF;AACA;AACA;AACA;AACA;AACA,aAAa;AACb,qCAAqC,oDAAoD;AACzF;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,6CAA6C;AAC7C;AACA,8BAA8B;AAC9B;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,yEAAyE;AACzE,mCAAmC,aAAa;AAChD,oCAAoC,gBAAgB;AACpD,sCAAsC,4BAA4B;;AAElE;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;;AAEA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,mCAAmC,cAAc;AACjD;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,SAAS;AACT;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,0EAA0E,SAAS;AACnF,0EAA0E,SAAS;AACnF;;AAEA,iEAAiE,oHAAoH;AACrL,iEAAiE,oHAAoH;;AAErL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;;AAErB,0CAA0C;;AAE1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,wBAAwB,sFAAsF;AAC9G,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,KAAK,EAAE;AACP,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,6BAA6B;AAC7B,0CAA0C;AAC1C,qDAAqD;AACrD,6CAA6C;AAC7C,2BAA2B,6FAA6F;AACxH;AACA,uCAAuC;AACvC;AACA,4BAA4B;AAC5B;AACA,oCAAoC;AACpC;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,kDAAkD;AAClD;AACA,mCAAmC,kBAAkB;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;;AAEjB,gCAAgC,kBAAkB;AAClD,oCAAoC,kBAAkB;AACtD;AACA;AACA;AACA;AACA,yBAAyB;AACzB;AACA;;AAEA;AACA;AACA,iBAAiB;;AAEjB;AACA;AACA;AACA,+BAA+B,uBAAuB;;AAEtD;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;;AAEA,+BAA+B,wBAAwB;AACvD;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,2CAA2C,oBAAoB;AAC/D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA,+BAA+B,6BAA6B;AAC5D;AACA;AACA;AACA,yBAAyB;AACzB;AACA;AACA,yBAAyB;AACzB;AACA;AACA,yBAAyB;AACzB;AACA;AACA;;AAEA,uBAAuB,wBAAwB;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA,iBAAiB;AACjB;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA,kHAAkH;AAClH;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA,iBAAiB;;AAEjB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,2BAA2B,2BAA2B;AACtD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,4CAA4C;AAC5C;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,6DAA6D,mEAAmE;AAChI;;AAEA;AACA;AACA;;AAEA,+BAA+B,gCAAgC;AAC/D;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,qDAAqD;AACrD;AACA;AACA,qDAAqD;AACrD;;AAEA;AACA,0DAA0D,uCAAuC;AACjG;AACA;AACA,0DAA0D,uCAAuC;AACjG;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mCAAmC;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,6BAA6B;AAC7B;AACA;AACA;AACA;AACA,6BAA6B;AAC7B;AACA;AACA;AACA,yBAAyB;AACzB;AACA;AACA;AACA,6BAA6B;AAC7B;AACA;AACA;;AAEA;AACA,2BAA2B,eAAe;AAC1C;AACA;AACA,sDAAsD;AACtD;AACA,oFAAoF;AACpF,0BAA0B;AAC1B;AACA;AACA,yBAAyB;AACzB;AACA;;AAEA;AACA,2BAA2B,4BAA4B;AACvD;AACA;;AAEA;AACA;AACA;AACA,2BAA2B,eAAe;AAC1C,iCAAiC,uGAAuG;AACxI;;AAEA;AACA,2BAA2B,6BAA6B;AACxD;AACA,+CAA+C,qDAAqD;AACpG;;AAEA;AACA,mEAAmE;;AAEnE,qGAAqG;AACrG,2BAA2B,gCAAgC;AAC3D;AACA;AACA,6CAA6C,yDAAyD;AACtG;AACA;AACA,yBAAyB;AACzB;AACA,uCAAuC,sCAAsC;AAC7E;AACA;AACA;AACA,iCAAiC;AACjC;AACA;AACA,qBAAqB;AACrB;AACA;AACA,yBAAyB;AACzB;AACA;;AAEA;AACA;AACA;AACA,8BAA8B,qDAAqD;AACnF;;AAEA;AACA,2BAA2B,+BAA+B;AAC1D,iDAAiD,6EAA6E;AAC9H;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kCAAkC,EAAE;AACpC,6BAA6B,qEAAqE;AAClG,oCAAoC,qEAAqE;AACzG,wCAAwC,qEAAqE;AAC7G;AACA;AACA;AACA;AACA;;AAEA,2BAA2B,kBAAkB;AAC7C;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B;AAC5B;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA,8CAA8C,qBAAqB;;AAEnE;AACA;AACA;;AAEA,iDAAiD,oBAAoB;;AAErE;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,+BAA+B;AAC/B;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,0EAA0E;AAC1E;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,+BAA+B;AAC/B;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,+CAA+C;AAC/C;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,uBAAuB,2BAA2B;AAClD;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B,oBAAoB;AACnD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wCAAwC;AACxC;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,sEAAsE,eAAe;AACrF;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6CAA6C;AAC7C;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,+BAA+B,iBAAiB;AAChD;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA,uCAAuC,oBAAoB;AAC3D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,+BAA+B,qBAAqB;AACpD;AACA;;AAEA;AACA,aAAa;AACb;AACA;AACA,+BAA+B,kBAAkB;AACjD;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA,mCAAmC,uBAAuB;AAC1D;AACA;AACA;AACA;AACA,mCAAmC,cAAc;AACjD;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,+BAA+B,mBAAmB;AAClD;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,sCAAsC,aAAa,GAAG,aAAa;AACnE;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,wBAAwB;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iCAAiC,2DAA2D;;AAE5F;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B;AAC5B;AACA;AACA,4BAA4B;AAC5B;AACA;AACA;AACA,4CAA4C,aAAa,GAAG,aAAa;AACzE;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oDAAoD,aAAa,IAAI;;AAErE;AACA;AACA;AACA;AACA,kBAAkB;AAClB;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,6EAA6E;AAC7E,6EAA6E;AAC7E;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,iBAAiB;AACjB;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,4BAA4B;AAC5B;AACA;AACA,4BAA4B;AAC5B;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,wBAAwB;AACxB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,wBAAwB;AACxB;AACA,SAAS;;AAET;AACA;AACA,iBAAiB,4BAA4B;AAC7C,iBAAiB,iCAAiC;AAClD,iBAAiB,iCAAiC;AAClD,iBAAiB;AACjB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa;AACb;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B;AAC3B;AACA;AACA;;AAEA;AACA;AACA,qCAAqC;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,2BAA2B,qBAAqB;AAChD;AACA;AACA;AACA;AACA;;AAEA,yCAAyC,eAAe;AACxD,qCAAqC,sDAAsD;AAC3F;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA,sCAAsC,iBAAiB;;AAEvD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB;AACvB,2BAA2B,qBAAqB;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,+BAA+B,qBAAqB;AACpD;AACA;AACA;AACA;AACA,aAAa;;AAEb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B,+BAA+B;AAC9D;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB;AACxB,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;;AAEA;AACA;AACA;AACA,2BAA2B,kBAAkB;AAC7C;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,2BAA2B,qBAAqB;AAChD;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;;AAEA;AACA;AACA,kCAAkC;AAClC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,wCAAwC;AACxC;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,gDAAgD,EAAE;AAClD;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT,+BAA+B;AAC/B;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,OAAO,2FAA2F;AACjH;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,+CAA+C,oBAAoB;AACnE;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,yBAAyB,iCAAiC;AAC1D;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oCAAoC,YAAY;AAChD;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oCAAoC,2BAA2B;AAC/D;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,2BAA2B;;AAE3B;AACA;AACA,2BAA2B;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+DAA+D;AAC/D;AACA;AACA;AACA,2BAA2B;AAC3B;AACA;;AAEA;AACA;;AAEA;AACA;AACA,wBAAwB,2CAA2C;AACnE;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB;AACxB;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,sCAAsC,GAAG;AACzC;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;;AAEA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,uBAAuB,oCAAoC;AAC3D;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,KAAK;;;AAGL,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,+BAA+B,2BAA2B,2BAA2B;;AAErF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA,iCAAiC,yBAAyB;AAC1D;AACA;AACA;AACA;;AAEA;AACA;AACA,iCAAiC,yBAAyB;AAC1D;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA;AACA,4CAA4C,cAAc;AAC1D;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB;AACzB;;AAEA;AACA,kEAAkE,WAAW;AAC7E,kEAAkE,WAAW;AAC7E;;AAEA;AACA;;AAEA,uCAAuC;;AAEvC;;AAEA;;AAEA;;AAEA;;AAEA;AACA,wDAAwD,qBAAqB;AAC7E,qBAAqB;AACrB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,0CAA0C;AAC1C;AACA;AACA;AACA;AACA,8CAA8C,cAAc;AAC5D;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,2BAA2B,cAAc;AACzC;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;;AAEA;AACA,gCAAgC;;AAEhC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,mCAAmC,kBAAkB;AACrD;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,yCAAyC,eAAe;AACxD;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,mCAAmC,kBAAkB;AACrD;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,2CAA2C,cAAc;AACzD;AACA;;AAEA;AACA;AACA;AACA,2BAA2B,cAAc;AACzC;AACA;AACA;;AAEA;AACA;AACA;AACA,8CAA8C,0BAA0B;AACxE,8CAA8C,0BAA0B;AACxE;AACA;AACA;AACA;AACA,+BAA+B,cAAc;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB;AACvB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,eAAe,gBAAgB;AAC/B,eAAe,OAAO;AACtB,eAAe,QAAQ;AACvB,eAAe,OAAO;AACtB,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB;AACA;AACA;AACA;AACA;AACA,iCAAiC,WAAW;AAC5C;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B;;AAE5B;AACA;AACA;AACA;AACA;;AAEA;AACA,gDAAgD,YAAY;AAC5D;;AAEA;AACA;AACA;AACA;AACA,+EAA+E,WAAW;AAC1F,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,aAAa;AACb;AACA;AACA;AACA,2BAA2B,gBAAgB;AAC3C;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,oDAAoD,sBAAsB;AAC1E;AACA,aAAa;;AAEb;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,iBAAiB;;AAEjB;AACA,yBAAyB,sCAAsC;AAC/D;AACA;AACA;AACA;AACA;AACA;AACA,sDAAsD,sBAAsB;AAC5E;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA,gDAAgD,OAAO;AACvD;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,qBAAqB;AAChD;AACA;AACA;AACA;AACA,sCAAsC,iBAAiB;;AAEvD;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,eAAe,OAAO;AACtB,gBAAgB,MAAM;AACtB;AACA;AACA;AACA;AACA;AACA,yEAAyE;AACzE;AACA;AACA,yEAAyE;AACzE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,QAAQ;AACvB;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA,2BAA2B,eAAe;AAC1C;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,QAAQ;AACvB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,eAAe,aAAa;AAC5B,eAAe,QAAQ;AACvB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,eAAe,QAAQ;AACvB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,eAAe,OAAO;AACtB,gBAAgB,MAAM;AACtB;AACA;AACA;AACA;;AAEA;AACA;AACA,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,aAAa;AAC5B;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,aAAa;AAC5B;AACA;AACA;AACA;;;AAGA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAe,aAAa;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,eAAe,eAAe;AAC9B,iBAAiB,MAAM;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC;;;AAGD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,qEAAqE;AACrE;AACA;;AAEA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,+BAA+B,yBAAyB;;AAExD;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,yBAAyB;;AAEzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB;AACzB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,yBAAyB;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,iBAAiB;;AAEjB,aAAa;;AAEb;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,qCAAqC;AACrC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,iCAAiC;AACjC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;;AAEA,wCAAwC,qBAAqB;AAC7D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qCAAqC;AACrC;AACA;AACA;AACA,qCAAqC;AACrC;AACA;AACA;AACA,qCAAqC;AACrC;AACA;AACA;AACA,qCAAqC;AACrC;AACA;AACA;AACA,qCAAqC;AACrC;AACA;AACA;AACA,qCAAqC;AACrC;AACA;AACA;AACA,qCAAqC;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B;AAC7B;AACA;AACA;AACA;AACA;AACA,qCAAqC;;AAErC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iCAAiC;AACjC,6BAA6B;AAC7B;AACA;AACA,iDAAiD,mBAAmB;AACpE,2CAA2C,4BAA4B;AACvE;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qCAAqC;;AAErC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qCAAqC;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qCAAqC;AACrC;AACA;AACA;;AAEA;AACA;AACA;AACA,uCAAuC,cAAc;AACrD;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,+CAA+C,6BAA6B;;AAE5E;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,aAAa;;AAEb;AACA;AACA;AACA,aAAa;AACb;;;AAGA;;AAEA;AACA;;AAEA,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA,sDAAsD;AACtD,mIAAmI;AACnI;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sFAAsF;AACtF;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6HAA6H;AAC7H;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;;AAEA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;;AAEA;AACA;;AAEA,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,+CAA+C,uFAAuF;AACtI,+CAA+C,mGAAmG;AAClJ,+CAA+C,mFAAmF;AAClI;AACA;;AAEA;AACA;;AAEA,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA,sCAAsC,oBAAoB;AAC1D,SAAS;AACT;AACA;AACA,2BAA2B,gBAAgB;AAC3C;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iEAAiE;AACjE;AACA;AACA;AACA,4CAA4C,wCAAwC;AACpF;AACA;AACA,4CAA4C,SAAS;AACrD;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,2BAA2B,iCAAiC;AAC5D;AACA;AACA,qCAAqC,sFAAsF;;AAE3H;AACA;AACA;AACA;AACA,SAAS;AACT;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA,oDAAoD,wBAAwB;AAC5E;AACA;AACA;AACA;AACA,6BAA6B,iBAAiB;AAC9C;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;;AAEA;AACA;AACA;AACA;AACA,gDAAgD;AAChD;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;;AAGA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,iCAAiC;AACjC;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;;AAEA;;;AAGA;AACA;AACA;AACA;;AAEA;;;;AAIA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;;;AAGA;AACA;AACA;AACA;;AAEA;;;AAGA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;;AAEA,uDAAuD,iCAAiC;AACxF;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,aAAa;;AAEb;AACA;AACA;AACA;AACA;AACA,aAAa;;AAEb;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA,yCAAyC,qBAAqB,EAAE;AAChE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB,SAAS;AACT;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,qDAAqD;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb,SAAS;AACT;AACA;AACA,wCAAwC,6CAA6C,EAAE;AACvF,SAAS;AACT;AACA;AACA,wCAAwC,uDAAuD,EAAE;AACjG,SAAS;AACT;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,CAAC;;;;;;;;;;;AC91cD;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,uBAAuB;AAClC;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,uBAAuB;AAClC;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,cAAc;AACzB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;AACH,uDAAuD;AACvD;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,SAAS;AACpB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,uBAAuB;AAClC;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA,yCAAyC;AACzC;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,aAAa;AACxB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;AC3KA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,aAAa;AACb;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,GAAG;AACH;;;;;;;;;;AC1BA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,eAAe,wBAAwB;AACvC,KAAK;AACL;AACA;AACA,GAAG;AACH;AACA;AACA;;;;;;;;;;ACjDA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,aAAa;AACb;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;;;;;;;;;;ACnCA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,SAAS;AACpB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;;AAEA;;;;;;;;;;AC3CA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,UAAU;AACrB;AACA;AACA;;AAEA;AACA;AACA;;;;;;;;;;ACnBA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,kDAAkD;AAClD;AACA,WAAW,OAAO;AAClB,YAAY;AACZ;;AAEA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;;AAEA,UAAU,iBAAiB;AAC3B;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB;;AAEA;AACA;AACA,iCAAiC;;AAEjC;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,WAAW,QAAQ;AACnB,YAAY,OAAO;AACnB;;AAEA;AACA;AACA,sBAAsB,kBAAkB;;AAExC;AACA;AACA;AACA;;AAEA;AACA;;;;;;;;;;;ACnHA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAS;AACT;;AAEA;AACA;AACA;AACA;AACA,SAAS;AACT;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,kGAAkG,IAAI;AACtG,iCAAiC,gBAAgB;AACjD;AACA,aAAa;AACb;AACA;AACA,gGAAgG,IAAI;AACpG,oCAAoC,gCAAgC;AACpE;AACA;AACA;;AAEA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA,gGAAgG,IAAI;AACpG,oCAAoC,gBAAgB;AACpD;AACA,aAAa;AACb;AACA;AACA,gGAAgG,IAAI;AACpG,iCAAiC,gCAAgC;;AAEjE;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,KAAK;;AAEL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,SAAS;AACT;AACA,SAAS;AACT;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,+EAA+E,IAAI,6BAA6B,IAAI;AACpH;AACA,iBAAiB;AACjB,wFAAwF,gBAAgB,GAAG,IAAI;AAC/G,gEAAgE,IAAI;AACpE;AACA;;AAEA,4DAA4D,0BAA0B;AACtF;AACA,aAAa;AACb;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,gFAAgF,IAAI;AACpF,4CAA4C,IAAI;AAChD;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA,4EAA4E,IAAI,4BAA4B,IAAI;AAChH,gFAAgF,IAAI;AACpF,4CAA4C,IAAI;AAChD;AACA;AACA;;AAEA;AACA;AACA,qFAAqF,gBAAgB,GAAG,IAAI;AAC5G,uCAAuC,IAAI;AAC3C,yFAAyF,gBAAgB,GAAG,IAAI;AAChH;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;;AAEA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,SAAS;AACT,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,aAAa;AACb;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,SAAS;AACT;;AAEA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;;AAEL;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,qDAAqD,QAAQ,uBAAuB,sBAAsB;AAC1G;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;;AAEA;;;;;;;;;;ACxWA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,MAAM;AACnB,aAAa,OAAO;AACpB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,MAAM;AACnB,aAAa,MAAM;AACnB,aAAa,OAAO;AACpB,aAAa,OAAO;AACpB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,MAAM;AACnB,aAAa,OAAO;AACpB;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,MAAM;AACnB,aAAa,OAAO;AACpB;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,MAAM;AACnB,aAAa,MAAM;AACnB,aAAa,OAAO;AACpB;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,oBAAoB,KAAK,YAAY,IAAI;AACzC,oBAAoB,KAAK,gBAAgB,IAAI;AAC7C;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,MAAM;AACnB,aAAa,MAAM;AACnB,aAAa,OAAO;AACpB;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,oBAAoB,KAAK,gBAAgB,IAAI;AAC7C,oBAAoB,KAAK,YAAY,IAAI;AACzC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,MAAM;AACnB,aAAa,MAAM;AACnB,aAAa,OAAO;AACpB;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,MAAM;AACnB,aAAa,MAAM;AACnB,aAAa,OAAO;AACpB;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,2BAA2B,eAAe,GAAG,eAAe;AAC5D;AACA;AACA,aAAa,MAAM;AACnB,aAAa,MAAM;AACnB,aAAa,OAAO;AACpB;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,8BAA8B,eAAe,GAAG,iBAAiB;AACjE;AACA;AACA,aAAa,MAAM;AACnB,aAAa,MAAM;AACnB,aAAa,OAAO;AACpB;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,MAAM;AACnB,aAAa,MAAM;AACnB,aAAa,OAAO;AACpB;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,MAAM;AACnB,aAAa,MAAM;AACnB,aAAa,OAAO;AACpB;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,MAAM;AACnB,aAAa,MAAM;AACnB,aAAa,OAAO;AACpB;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,MAAM;AACnB,aAAa,MAAM;AACnB,aAAa,OAAO;AACpB;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,MAAM;AACnB,aAAa,OAAO;AACpB;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,MAAM;AACnB,aAAa,OAAO;AACpB;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,MAAM;AACnB,aAAa,OAAO;AACpB;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,MAAM;AACnB,aAAa,OAAO;AACpB;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,MAAM;AACnB,aAAa,OAAO;AACpB;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,MAAM;AACnB,aAAa,OAAO;AACpB;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,MAAM;AACnB,aAAa,OAAO;AACpB;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,MAAM;AACnB,aAAa,OAAO;AACpB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,MAAM;AACnB,aAAa,OAAO;AACpB;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,MAAM;AACnB,aAAa,OAAO;AACpB;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,MAAM;AACnB,aAAa,OAAO;AACpB;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,MAAM;AACnB,aAAa,OAAO;AACpB;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,8BAA8B,qBAAqB;AACnD;AACA;AACA;AACA,aAAa,MAAM;AACnB,aAAa,OAAO;AACpB;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,MAAM;AACnB,aAAa,OAAO;AACpB;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B;AAC1B;AACA;AACA;AACA,aAAa,MAAM;AACnB,aAAa,OAAO;AACpB;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,MAAM;AACnB,aAAa,OAAO;AACpB;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,MAAM;AACnB,aAAa,OAAO;AACpB;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,MAAM;AACnB,aAAa,OAAO;AACpB;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,MAAM;AACnB,aAAa,OAAO;AACpB;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,MAAM;AACnB,aAAa,OAAO;AACpB;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,OAAO;AACpB,aAAa,OAAO;AACpB;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,MAAM;AACnB,aAAa,OAAO;AACpB;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8BAA8B;AAC9B;AACA;AACA,aAAa,OAAO;AACpB,aAAa,OAAO;AACpB;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,MAAM;AACnB,aAAa,OAAO;AACpB;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,MAAM;AACnB,aAAa,OAAO;AACpB;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB,cAAc;AACtC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,MAAM;AACnB,aAAa,OAAO;AACpB,aAAa,OAAO;AACpB;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,MAAM;AACnB,aAAa,OAAO;AACpB,aAAa,OAAO;AACpB;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,oCAAoC,kBAAkB;AACtD;AACA;AACA;AACA;AACA;AACA,aAAa,OAAO;AACpB,aAAa,YAAY;AACzB,aAAa,OAAO;AACpB;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,oCAAoC,kBAAkB;AACtD;AACA;AACA;AACA;AACA;AACA,aAAa,OAAO;AACpB,aAAa,YAAY;AACzB,aAAa,OAAO;AACpB;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB,gCAAgC,GAAG,aAAa;AACzE;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB,qBAAqB;AACrB;AACA,yBAAyB,qBAAqB,GAAG,UAAU;AAC3D,yBAAyB,qBAAqB,GAAG,qBAAqB;AACtE;AACA;AACA,aAAa,aAAa;AAC1B,aAAa,MAAM;AACnB,aAAa,OAAO;AACpB;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B,gCAAgC,GAAG,aAAa;AAC5E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB,qBAAqB;AACrB,0CAA0C,KAAK;AAC/C,4BAA4B,qBAAqB,GAAG,MAAM,MAAM;AAChE,4BAA4B,qBAAqB,GAAG,iBAAiB,MAAM;AAC3E;AACA;AACA,aAAa,aAAa;AAC1B,aAAa,MAAM;AACnB,aAAa,OAAO;AACpB;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB,qBAAqB;AACrB,2CAA2C,KAAK;AAChD,6BAA6B,qBAAqB,GAAG,MAAM,MAAM;AACjE,6BAA6B,qBAAqB,GAAG,MAAM,KAAK,QAAQ,MAAM;AAC9E;AACA;AACA,aAAa,aAAa;AAC1B,aAAa,MAAM;AACnB,aAAa,OAAO;AACpB;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB,qBAAqB;AACrB,8CAA8C,KAAK;AACnD,gCAAgC,qBAAqB,GAAG,MAAM,MAAM;AACpE,gCAAgC,qBAAqB,GAAG,MAAM,KAAK,QAAQ,MAAM;AACjF;AACA;AACA,aAAa,aAAa;AAC1B,aAAa,MAAM;AACnB,aAAa,OAAO;AACpB;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B,OAAO,UAAU,GAAG,gBAAgB;AACnE,+BAA+B,MAAM,YAAY,GAAG,iBAAiB;AACrE;AACA;AACA,aAAa,OAAO;AACpB,aAAa,OAAO;AACpB,aAAa,OAAO;AACpB;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kCAAkC,OAAO,UAAU,GAAG,cAAc;AACpE,kCAAkC,MAAM,YAAY,GAAG,iBAAiB;AACxE;AACA;AACA,aAAa,OAAO;AACpB,aAAa,OAAO;AACpB,aAAa,OAAO;AACpB;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mCAAmC,IAAI,KAAK,KAAK,GAAG,GAAG,WAAW,MAAM;AACxE,mCAAmC,OAAO,QAAQ,OAAO,GAAG,iBAAiB,MAAM;AACnF;AACA;AACA,aAAa,OAAO;AACpB,aAAa,OAAO;AACpB,aAAa,OAAO;AACpB;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sCAAsC,IAAI,KAAK,KAAK,GAAG,GAAG,WAAW,MAAM;AAC3E,sCAAsC,OAAO,QAAQ,OAAO,GAAG,iBAAiB,MAAM;AACtF;AACA;AACA,aAAa,OAAO;AACpB,aAAa,OAAO;AACpB,aAAa,OAAO;AACpB;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B,OAAO,GAAG,OAAO;AAC7C;AACA;AACA,aAAa,OAAO;AACpB,aAAa,OAAO;AACpB,aAAa,OAAO;AACpB;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B,OAAO,GAAG,OAAO;AAChD;AACA;AACA,aAAa,OAAO;AACpB,aAAa,OAAO;AACpB,aAAa,OAAO;AACpB;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iCAAiC,IAAI,MAAM,GAAG,IAAI,MAAM;AACxD;AACA;AACA,aAAa,OAAO;AACpB,aAAa,OAAO;AACpB,aAAa,OAAO;AACpB;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oCAAoC,IAAI,MAAM,GAAG,IAAI,MAAM;AAC3D;AACA;AACA,aAAa,OAAO;AACpB,aAAa,OAAO;AACpB,aAAa,OAAO;AACpB;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,MAAM;AACnB,aAAa,OAAO;AACpB,aAAa,OAAO;AACpB;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,MAAM;AACnB,aAAa,OAAO;AACpB,aAAa,OAAO;AACpB;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B,OAAO,mBAAmB;AACpD,0BAA0B,OAAO,mBAAmB;AACpD;AACA;AACA,aAAa,OAAO;AACpB,aAAa,OAAO;AACpB,aAAa,OAAO;AACpB;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B,OAAO,mBAAmB;AACvD;AACA;AACA,aAAa,OAAO;AACpB,aAAa,OAAO;AACpB,aAAa,OAAO;AACpB;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B,iBAAiB;AAC9C;AACA;AACA,aAAa,OAAO;AACpB,aAAa,OAAO;AACpB,aAAa,MAAM;AACnB,aAAa,OAAO;AACpB;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gCAAgC,iBAAiB;AACjD,gCAAgC,iBAAiB;AACjD;AACA;AACA,aAAa,OAAO;AACpB,aAAa,OAAO;AACpB,aAAa,MAAM;AACnB,aAAa,OAAO;AACpB;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,iCAAiC,OAAO,kBAAkB,EAAE,UAAU,kBAAkB;AACxF;AACA;AACA,aAAa,OAAO;AACpB,aAAa,OAAO;AACpB,aAAa,MAAM;AACnB,aAAa,OAAO;AACpB;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,oCAAoC,OAAO,kBAAkB,EAAE,UAAU,kBAAkB;AAC3F,oCAAoC,OAAO,kBAAkB,EAAE,UAAU,kBAAkB;AAC3F,oCAAoC,OAAO,kBAAkB,EAAE,aAAa,kBAAkB;AAC9F;AACA;AACA,aAAa,OAAO;AACpB,aAAa,OAAO;AACpB,aAAa,MAAM;AACnB,aAAa,OAAO;AACpB;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B,OAAO,mBAAmB;AACvD;AACA;AACA,aAAa,OAAO;AACpB,aAAa,OAAO;AACpB,aAAa,OAAO;AACpB;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,gCAAgC,OAAO,mBAAmB;AAC1D,iCAAiC;AACjC;AACA;AACA,aAAa,OAAO;AACpB,aAAa,OAAO;AACpB,aAAa,OAAO;AACpB;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gCAAgC,mBAAmB;AACnD;AACA;AACA,aAAa,OAAO;AACpB,aAAa,OAAO;AACpB,aAAa,MAAM;AACnB,aAAa,OAAO;AACpB;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mCAAmC,kBAAkB;AACrD,oCAAoC;AACpC;AACA;AACA,aAAa,OAAO;AACpB,aAAa,OAAO;AACpB,aAAa,MAAM;AACnB,aAAa,OAAO;AACpB;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oCAAoC,OAAO,kBAAkB,EAAE,UAAU,kBAAkB;AAC3F;AACA;AACA,aAAa,OAAO;AACpB,aAAa,OAAO;AACpB,aAAa,MAAM;AACnB,aAAa,OAAO;AACpB;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uCAAuC,OAAO,kBAAkB,EAAE,UAAU,kBAAkB;AAC9F,uCAAuC,OAAO,kBAAkB,EAAE,UAAU,kBAAkB;AAC9F,uCAAuC,OAAO,kBAAkB,EAAE,aAAa,kBAAkB;AACjG,wCAAwC;AACxC;AACA;AACA,aAAa,OAAO;AACpB,aAAa,OAAO;AACpB,aAAa,MAAM;AACnB,aAAa,OAAO;AACpB;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gCAAgC,OAAO,mBAAmB;AAC1D;AACA;AACA,aAAa,OAAO;AACpB,aAAa,OAAO;AACpB,aAAa,OAAO;AACpB;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mCAAmC,OAAO,mBAAmB;AAC7D;AACA;AACA,aAAa,OAAO;AACpB,aAAa,OAAO;AACpB,aAAa,OAAO;AACpB;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mCAAmC,OAAO,mBAAmB;AAC7D;AACA;AACA,aAAa,OAAO;AACpB,aAAa,OAAO;AACpB,aAAa,MAAM;AACnB,aAAa,OAAO;AACpB;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sCAAsC,OAAO,mBAAmB;AAChE,sCAAsC,OAAO,mBAAmB;AAChE;AACA;AACA,aAAa,OAAO;AACpB,aAAa,OAAO;AACpB,aAAa,MAAM;AACnB,aAAa,OAAO;AACpB;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uCAAuC,OAAO,SAAS,gBAAgB,EAAE,EAAE,gBAAgB,gBAAgB;AAC3G;AACA;AACA,aAAa,OAAO;AACpB,aAAa,OAAO;AACpB,aAAa,MAAM;AACnB,aAAa,OAAO;AACpB;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0CAA0C,OAAO,SAAS,gBAAgB,EAAE,EAAE,gBAAgB,gBAAgB;AAC9G,0CAA0C,OAAO,SAAS,gBAAgB,EAAE,EAAE,gBAAgB,iBAAiB;AAC/G,0CAA0C,OAAO,SAAS,gBAAgB,EAAE,EAAE,gBAAgB,gBAAgB;AAC9G;AACA;AACA,aAAa,OAAO;AACpB,aAAa,OAAO;AACpB,aAAa,MAAM;AACnB,aAAa,OAAO;AACpB;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,MAAM;AACnB,aAAa,OAAO;AACpB,aAAa,OAAO;AACpB;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B,uBAAuB;AACnD,4BAA4B,uBAAuB,GAAG,mCAAmC;AACzF,sCAAsC,OAAO,gCAAgC,OAAO;AACpF,qCAAqC,WAAW,oBAAoB,WAAW;AAC/E;AACA;AACA,aAAa,MAAM;AACnB,aAAa,aAAa;AAC1B,aAAa,OAAO;AACpB;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B,uBAAuB;AACnD,4BAA4B,uBAAuB,GAAG;AACtD,sCAAsC,OAAO,gCAAgC,OAAO;AACpF,qCAAqC,WAAW,mBAAmB,WAAW;AAC9E;AACA;AACA,aAAa,MAAM;AACnB,aAAa,SAAS;AACtB,aAAa,OAAO;AACpB;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iCAAiC,uBAAuB;AACxD,iCAAiC,uBAAuB;AACxD,iCAAiC,uBAAuB,GAAG,mBAAmB;AAC9E,iCAAiC,uBAAuB,GAAG,4BAA4B;AACvF,2CAA2C,OAAO,gCAAgC,OAAO;AACzF,2CAA2C,OAAO,gCAAgC,OAAO;AACzF,0CAA0C,WAAW,mBAAmB,WAAW;AACnF,0CAA0C,WAAW,mBAAmB,WAAW;AACnF;AACA;AACA,aAAa,MAAM;AACnB,aAAa,SAAS;AACtB,aAAa,OAAO;AACpB;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oCAAoC,uBAAuB;AAC3D,oCAAoC,uBAAuB,GAAG,+BAA+B;AAC7F,8CAA8C,OAAO,gCAAgC,WAAW;AAChG,6CAA6C,WAAW,mBAAmB,WAAW;AACtF;AACA;AACA,aAAa,MAAM;AACnB,aAAa,SAAS;AACtB,aAAa,OAAO;AACpB;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oCAAoC,uBAAuB;AAC3D,oCAAoC,uBAAuB,GAAG,+BAA+B;AAC7F,8CAA8C,OAAO,gCAAgC,WAAW;AAChG,6CAA6C,WAAW,mBAAmB,WAAW;AACtF;AACA;AACA,aAAa,MAAM;AACnB,aAAa,SAAS;AACtB,aAAa,OAAO;AACpB;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0CAA0C,WAAW,0BAA0B,WAAW;AAC1F,0CAA0C,WAAW,2BAA2B,WAAW,GAAG,WAAW;AACzG,0CAA0C,WAAW,iBAAiB,WAAW,mBAAmB,WAAW,GAAG,WAAW;AAC7H,yCAAyC,WAAW,GAAG,WAAW,KAAK,WAAW;AAClF,yCAAyC,WAAW,GAAG,WAAW,MAAM,WAAW,GAAG,eAAe;AACrG,yCAAyC,WAAW,GAAG,WAAW,MAAM,WAAW,GAAG,WAAW;AACjG;AACA;AACA,aAAa,MAAM;AACnB,aAAa,aAAa;AAC1B,aAAa,OAAO;AACpB;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0CAA0C,WAAW,kBAAkB,WAAW;AAClF,0CAA0C,WAAW,iBAAiB,WAAW,mBAAmB,WAAW,GAAG,WAAW;AAC7H,yCAAyC,WAAW,KAAK,WAAW;AACpE,yCAAyC,WAAW,GAAG,WAAW,MAAM,WAAW,GAAG,WAAW;AACjG;AACA;AACA,aAAa,MAAM;AACnB,aAAa,aAAa;AAC1B,aAAa,OAAO;AACpB;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+CAA+C,WAAW,0BAA0B,WAAW;AAC/F,+CAA+C,WAAW,iBAAiB,WAAW,mBAAmB,WAAW,GAAG,WAAW;AAClI,8CAA8C,WAAW,GAAG,WAAW,KAAK,WAAW;AACvF,8CAA8C,WAAW,GAAG,WAAW,MAAM,WAAW,GAAG,WAAW;AACtG;AACA;AACA,aAAa,MAAM;AACnB,aAAa,aAAa;AAC1B,aAAa,OAAO;AACpB;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kDAAkD,WAAW,0BAA0B,qBAAqB;AAC5G,kDAAkD,WAAW,iBAAiB,WAAW,mBAAmB,iBAAiB,GAAG,eAAe;AAC/I,iDAAiD,WAAW,GAAG,WAAW,KAAK,iBAAiB;AAChG,iDAAiD,WAAW,GAAG,WAAW,MAAM,iBAAiB,GAAG,eAAe;AACnH;AACA;AACA,aAAa,MAAM;AACnB,aAAa,aAAa;AAC1B,aAAa,OAAO;AACpB;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kDAAkD,WAAW,0BAA0B,qBAAqB;AAC5G,kDAAkD,WAAW,iBAAiB,WAAW,mBAAmB,iBAAiB,GAAG,WAAW;AAC3I,iDAAiD,WAAW,GAAG,WAAW,KAAK,iBAAiB;AAChG,iDAAiD,WAAW,GAAG,WAAW,MAAM,WAAW,GAAG,eAAe;AAC7G;AACA;AACA,aAAa,MAAM;AACnB,aAAa,aAAa;AAC1B,aAAa,OAAO;AACpB;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,SAAS;AACtB,aAAa,uBAAuB;AACpC,aAAa,cAAc;AAC3B,aAAa,OAAO;AACpB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,SAAS;AACtB,aAAa,iBAAiB;AAC9B,aAAa,cAAc;AAC3B,aAAa,OAAO;AACpB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,MAAM;AACnB,aAAa,OAAO;AACpB,aAAa,MAAM;AACnB,aAAa,OAAO;AACpB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,OAAO;AACpB,aAAa,OAAO;AACpB,aAAa,OAAO;AACpB,aAAa,OAAO;AACpB;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,OAAO;AACpB,aAAa,OAAO;AACpB,aAAa,OAAO;AACpB,aAAa,OAAO;AACpB;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,MAAM;AACnB,aAAa,MAAM;AACnB,aAAa,OAAO;AACpB;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,MAAM;AACnB,aAAa,MAAM;AACnB,aAAa,OAAO;AACpB;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,mCAAmC,OAAO,GAAG,OAAO,GAAG,OAAO,MAAM,OAAO,GAAG,OAAO,GAAG,OAAO;AAC/F;AACA;AACA,aAAa,MAAM;AACnB,aAAa,MAAM;AACnB,aAAa,OAAO;AACpB;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,sCAAsC,OAAO,GAAG,OAAO,GAAG,OAAO,MAAM,OAAO,GAAG,OAAO,GAAG,OAAO;AAClG;AACA;AACA,aAAa,MAAM;AACnB,aAAa,MAAM;AACnB,aAAa,OAAO;AACpB;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,MAAM;AACnB,aAAa,MAAM;AACnB,aAAa,OAAO;AACpB;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,MAAM;AACnB,aAAa,MAAM;AACnB,aAAa,OAAO;AACpB;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,sCAAsC,OAAO,GAAG,OAAO,GAAG,OAAO,OAAO,OAAO,GAAG,OAAO,GAAG,OAAO;AACnG;AACA;AACA,aAAa,MAAM;AACnB,aAAa,MAAM;AACnB,aAAa,OAAO;AACpB;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,yCAAyC,OAAO,GAAG,OAAO,GAAG,OAAO,OAAO,OAAO,GAAG,OAAO,GAAG,OAAO;AACtG,yCAAyC,OAAO,GAAG,OAAO,GAAG,OAAO,OAAO,OAAO,GAAG,OAAO,GAAG,OAAO;AACtG;AACA;AACA,aAAa,MAAM;AACnB,aAAa,MAAM;AACnB,aAAa,OAAO;AACpB;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,MAAM;AACnB,aAAa,MAAM;AACnB,aAAa,OAAO;AACpB;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,MAAM;AACnB,aAAa,MAAM;AACnB,aAAa,OAAO;AACpB;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,sCAAsC,OAAO,GAAG,OAAO,GAAG,OAAO,OAAO,OAAO,GAAG,OAAO,GAAG,OAAO;AACnG;AACA;AACA,aAAa,MAAM;AACnB,aAAa,MAAM;AACnB,aAAa,OAAO;AACpB;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,yCAAyC,OAAO,GAAG,OAAO,GAAG,OAAO,OAAO,OAAO,GAAG,OAAO;AAC5F;AACA;AACA,aAAa,MAAM;AACnB,aAAa,MAAM;AACnB,aAAa,OAAO;AACpB;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,MAAM;AACnB,aAAa,MAAM;AACnB,aAAa,OAAO;AACpB;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,MAAM;AACnB,aAAa,MAAM;AACnB,aAAa,OAAO;AACpB;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6CAA6C,OAAO,GAAG,OAAO,GAAG,OAAO,OAAO,OAAO,GAAG,OAAO;AAChG;AACA;AACA,aAAa,MAAM;AACnB,aAAa,MAAM;AACnB,aAAa,OAAO;AACpB;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gDAAgD,OAAO,GAAG,OAAO,GAAG,OAAO,OAAO,OAAO,GAAG,OAAO;AACnG,gDAAgD,OAAO,GAAG,OAAO,GAAG,OAAO,OAAO,OAAO,GAAG,OAAO;AACnG,gDAAgD,OAAO,GAAG,OAAO,GAAG,OAAO,OAAO,OAAO,GAAG,OAAO;AACnG;AACA;AACA,aAAa,MAAM;AACnB,aAAa,MAAM;AACnB,aAAa,OAAO;AACpB;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,EAAE;AACf,aAAa,SAAS;AACtB,aAAa,OAAO;AACpB;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,oBAAoB;AACpB,8BAA8B;AAC9B;AACA;AACA;AACA,aAAa,SAAS;AACtB,aAAa,OAAO;AACpB,aAAa,OAAO;AACpB,aAAa,OAAO;AACpB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,oBAAoB;AACpB,8BAA8B;AAC9B;AACA;AACA;AACA,aAAa,SAAS;AACtB,aAAa,OAAO;AACpB,aAAa,OAAO;AACpB,aAAa,OAAO;AACpB,aAAa,OAAO;AACpB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,oBAAoB;AACpB,8BAA8B,oBAAoB;AAClD;AACA;AACA;AACA,aAAa,SAAS;AACtB,aAAa,OAAO;AACpB,aAAa,OAAO;AACpB,aAAa,OAAO;AACpB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,oBAAoB;AACpB,8BAA8B;AAC9B;AACA;AACA;AACA,aAAa,SAAS;AACtB,aAAa,OAAO;AACpB,aAAa,OAAO;AACpB,aAAa,OAAO;AACpB,aAAa,OAAO;AACpB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,oBAAoB;AACpB,8BAA8B;AAC9B;AACA;AACA;AACA,aAAa,SAAS;AACtB,aAAa,OAAO;AACpB,aAAa,OAAO;AACpB,aAAa,OAAO;AACpB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,oBAAoB;AACpB,8BAA8B;AAC9B;AACA;AACA;AACA,aAAa,SAAS;AACtB,aAAa,OAAO;AACpB,aAAa,OAAO;AACpB,aAAa,OAAO;AACpB,aAAa,OAAO;AACpB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,oBAAoB;AACpB,8BAA8B;AAC9B;AACA;AACA;AACA,aAAa,SAAS;AACtB,aAAa,OAAO;AACpB,aAAa,OAAO;AACpB,aAAa,OAAO;AACpB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,oBAAoB;AACpB,8BAA8B;AAC9B;AACA;AACA;AACA,aAAa,SAAS;AACtB,aAAa,OAAO;AACpB,aAAa,OAAO;AACpB,aAAa,OAAO;AACpB,aAAa,OAAO;AACpB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,oBAAoB;AACpB,8BAA8B;AAC9B;AACA;AACA;AACA,aAAa,SAAS;AACtB,aAAa,OAAO;AACpB,aAAa,OAAO;AACpB,aAAa,OAAO;AACpB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,oBAAoB;AACpB,8BAA8B;AAC9B;AACA;AACA;AACA,aAAa,SAAS;AACtB,aAAa,OAAO;AACpB,aAAa,OAAO;AACpB,aAAa,OAAO;AACpB,aAAa,OAAO;AACpB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,oBAAoB;AACpB,8BAA8B;AAC9B;AACA;AACA;AACA,aAAa,SAAS;AACtB,aAAa,OAAO;AACpB,aAAa,OAAO;AACpB,aAAa,OAAO;AACpB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,oBAAoB;AACpB,8BAA8B;AAC9B;AACA;AACA;AACA,aAAa,SAAS;AACtB,aAAa,OAAO;AACpB,aAAa,OAAO;AACpB,aAAa,OAAO;AACpB,aAAa,OAAO;AACpB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,oBAAoB;AACpB,8BAA8B;AAC9B;AACA;AACA;AACA,aAAa,SAAS;AACtB,aAAa,OAAO;AACpB,aAAa,OAAO;AACpB,aAAa,OAAO;AACpB,aAAa,OAAO;AACpB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B;AAC7B;AACA;AACA,aAAa,OAAO;AACpB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,+BAA+B;AAC/B;AACA;AACA;AACA,aAAa,OAAO;AACpB,aAAa,OAAO;AACpB;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,8DAA8D;AAC9D,0CAA0C;AAC1C,4CAA4C;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,OAAO;AACpB,aAAa,OAAO;AACpB;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,0CAA0C;AAC1C,0CAA0C;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,OAAO;AACpB,aAAa,OAAO;AACpB;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,8BAA8B;AAC9B;AACA;AACA;AACA,aAAa,OAAO;AACpB,aAAa,OAAO;AACpB;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,4CAA4C;AAC5C;AACA;AACA;AACA;AACA,aAAa,OAAO;AACpB,aAAa,OAAO;AACpB;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,8BAA8B;AAC9B;AACA;AACA;AACA,aAAa,OAAO;AACpB,aAAa,OAAO;AACpB;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B;AAC1B;AACA;AACA;AACA,aAAa,4BAA4B;AACzC,aAAa,OAAO;AACpB;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B,SAAS;AACrC;AACA;AACA;AACA,aAAa,4BAA4B;AACzC,aAAa,OAAO;AACpB;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;ACzhGA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,MAAM;AACrB,eAAe,MAAM;AACrB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,MAAM;AACrB,eAAe,MAAM;AACrB,eAAe,OAAO;AACtB;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAAS;AACxB,eAAe,iBAAiB;AAChC,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,MAAM;AACrB,eAAe,MAAM;AACrB,eAAe,OAAO;AACtB;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAAS;AACxB,eAAe,iBAAiB;AAChC,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;;;;;;;;AC3MA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,MAAM;AACnB,aAAa,MAAM;AACnB,aAAa,OAAO;AACpB,aAAa,OAAO;AACpB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;;;;;;;;;ACjCA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA;AACA,8BAA8B;AAC9B,iBAAiB,KAAK;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B;AAC/B,mCAAmC;AACnC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6DAA6D,KAAK;AAClE,iBAAiB,KAAK,iBAAiB,KAAK;AAC5C,iBAAiB,KAAK,gBAAgB,KAAK;AAC3C;AACA,8DAA8D,KAAK;AACnE,kBAAkB,KAAK,oBAAoB,KAAK;AAChD,kBAAkB,KAAK,mBAAmB,KAAK;AAC/C;AACA,kEAAkE,KAAK;AACvE,iBAAiB,IAAI,MAAM,mBAAmB,IAAI,MAAM;AACxD,iBAAiB,IAAI,MAAM,kBAAkB,IAAI,MAAM;AACvD;AACA,gEAAgE,KAAK;AACrE,kBAAkB,KAAK,0BAA0B,KAAK;AACtD,kBAAkB,KAAK,yBAAyB,KAAK;AACrD;AACA,2DAA2D,KAAK;AAChE,0BAA0B,KAAK,wBAAwB,KAAK;AAC5D,0BAA0B,KAAK,uBAAuB,KAAK;AAC3D;AACA,sEAAsE,KAAK;AAC3E,iBAAiB,IAAI,MAAM,8BAA8B,KAAK;AAC9D,iBAAiB,IAAI,MAAM,6BAA6B,KAAK;AAC7D;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,IAAI,eAAe;AACpC,iBAAiB,IAAI,eAAe,qBAAqB,cAAc;AACvE;AACA;AACA;AACA;AACA,iBAAiB,OAAO,YAAY;AACpC,iBAAiB,OAAO,YAAY,qBAAqB,oBAAoB;AAC7E;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,KAAK;AACtB,iBAAiB,KAAK,kD;AACtB;AACA,iBAAiB,KAAK,kBAAkB,KAAK;AAC7C,iBAAiB,KAAK,cAAc,KAAK,uBAAuB,KAAK;AACrE;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,WAAW;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,GAAG;;;AAGH;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,WAAW;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,KAAK;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yCAAyC;AACzC,6CAA6C;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,KAAK;AACtB;AACA;AACA;AACA;AACA;AACA,aAAa,OAAO;AACpB,aAAa,OAAO;AACpB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,oBAAoB,KAAK;AACzB,oBAAoB,KAAK;AACzB;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,iBAAiB,cAAc,WAAW;AAC3D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8DAA8D,KAAK;AACnE,kBAAkB,KAAK,oBAAoB,KAAK;AAChD,kBAAkB,KAAK,mBAAmB,KAAK;AAC/C;AACA,kEAAkE,KAAK;AACvE,iBAAiB,IAAI,MAAM,mBAAmB,IAAI,MAAM;AACxD,iBAAiB,IAAI,MAAM,kBAAkB,IAAI,MAAM;AACvD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,KAAK,kBAAkB,KAAK;AAC7C,iBAAiB,KAAK,cAAc,KAAK,uBAAuB,KAAK;AACrE;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,IAAI,MAAM,uBAAuB,IAAI,MAAM;AAC5D;AACA;AACA;AACA;AACA,iBAAiB,IAAI,eAAe,qBAAqB,cAAc;AACvE;AACA;AACA;AACA;AACA,iBAAiB,OAAO,UAAU,qBAAqB,kBAAkB;AACzE;AACA;AACA;AACA,iBAAiB,IAAI,KAAK,KAAK,GAAG,0BAA0B,WAAW,MAAM;AAC7E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,KAAK,iCAAiC;AACvD,iBAAiB,KAAK,kBAAkB,WAAW,EAAE;AACrD;AACA;AACA;AACA;AACA;AACA,iBAAiB,WAAW,cAAc,WAAW,EAAE;AACvD,iBAAiB,WAAW,kBAAkB,WAAW,EAAE;AAC3D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,iBAAiB;AAClC,iBAAiB,iBAAiB;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,KAAK;AACtB,iBAAiB,KAAK;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,MAAM;AACnB,aAAa,OAAO;AACpB;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAS;AACT;;AAEA;AACA;AACA;AACA;AACA,WAAW;AACX,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW;AACX,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,oBAAoB,KAAK;AACzB,oBAAoB,KAAK;AACzB;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B;AAC/B,4BAA4B;AAC5B;AACA,iCAAiC;AACjC,+BAA+B;AAC/B;AACA;AACA;AACA,+BAA+B;AAC/B,gCAAgC;AAChC;AACA,mCAAmC;AACnC,oCAAoC;AACpC;AACA,iCAAiC;AACjC,mCAAmC;AACnC;AACA,2CAA2C;AAC3C,wCAAwC;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,oBAAoB,KAAK;AACzB,oBAAoB,KAAK;AACzB,GAAG;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mCAAmC;AACnC,sCAAsC;AACtC;AACA,+BAA+B;AAC/B,kCAAkC;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,oBAAoB,KAAK;AACzB,oBAAoB,KAAK;AACzB;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iCAAiC;AACjC,sCAAsC;AACtC;AACA,+BAA+B;AAC/B,mCAAmC;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,oBAAoB,KAAK;AACzB,oBAAoB,KAAK;AACzB;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B;AAC/B,kCAAkC;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,oBAAoB,KAAK;AACzB,oBAAoB,KAAK;AACzB;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B;AAC/B,uCAAuC;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,oBAAoB,KAAK;AACzB,oBAAoB,KAAK;AACzB;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uCAAuC;AACvC,qCAAqC;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,sBAAsB,KAAK;AAC3B,sBAAsB,KAAK;AAC3B;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B;AAC/B,4BAA4B;AAC5B;AACA,+BAA+B;AAC/B,4BAA4B;AAC5B;AACA;AACA;AACA,iCAAiC;AACjC,mCAAmC;AACnC;AACA,2CAA2C;AAC3C,wCAAwC;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,oBAAoB,KAAK;AACzB,oBAAoB,KAAK;AACzB;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+CAA+C;AAC/C,2CAA2C;AAC3C;AACA,gEAAgE;AAChE,oDAAoD;AACpD;AACA,6BAA6B,KAAK,uBAAuB;AACzD,iBAAiB,KAAK,kBAAkB;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,oBAAoB,KAAK;AACzB,oBAAoB,KAAK;AACzB;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yCAAyC;AACzC,2CAA2C;AAC3C;AACA;AACA;AACA,kBAAkB;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,oBAAoB,KAAK;AACzB,oBAAoB,KAAK;AACzB;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6DAA6D,KAAK;AAClE,iBAAiB,KAAK,iBAAiB,KAAK;AAC5C,iBAAiB,KAAK,gBAAgB,KAAK;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B;AAC/B,mCAAmC;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,MAAM;AACnB,aAAa,OAAO;AACpB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,sBAAsB,KAAK,YAAY,IAAI;AAC3C,sBAAsB,KAAK,gBAAgB,IAAI;AAC/C;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iEAAiE;AACjE,iBAAiB,KAAK,UAAU,KAAK,iBAAiB,KAAK;AAC3D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,KAAK,UAAU,KAAK,EAAE;AACvC,iBAAiB,KAAK,cAAc,KAAK,EAAE;AAC3C;AACA;AACA;AACA;AACA;AACA,iBAAiB,KAAK,UAAU,KAAK;AACrC,iBAAiB,KAAK,6BAA6B,KAAK;AACxD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,MAAM;AACnB,aAAa,OAAO;AACpB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,oBAAoB,KAAK,mBAAmB,IAAI;AAChD,oBAAoB,KAAK,uBAAuB,IAAI;AACpD;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B;AAC/B,kCAAkC;AAClC;AACA;AACA;AACA;AACA,2CAA2C;AAC3C,iDAAiD;AACjD;AACA,+CAA+C;AAC/C,qDAAqD;AACrD;AACA;AACA;AACA,+BAA+B;AAC/B,sCAAsC;AACtC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,OAAO;AACpB,aAAa,OAAO;AACpB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,sBAAsB,KAAK,0BAA0B,IAAI,WAAW,IAAI;AACxE,sBAAsB,KAAK,8BAA8B,IAAI;AAC7D;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,sBAAsB,KAAK,eAAe,IAAI;AAC9C,sBAAsB,KAAK,iBAAiB,IAAI;AAChD;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B;AAC/B,qCAAqC;AACrC,qCAAqC;AACrC;AACA;AACA;AACA;AACA;AACA,2CAA2C;AAC3C,oDAAoD;AACpD;AACA,+CAA+C;AAC/C,wDAAwD;AACxD;AACA;AACA;AACA,+BAA+B;AAC/B,yCAAyC;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,OAAO;AACpB,aAAa,OAAO;AACpB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,sBAAsB,KAAK,6BAA6B,IAAI,WAAW,IAAI;AAC3E,sBAAsB,KAAK,0BAA0B,IAAI;AACzD;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,sBAAsB,KAAK,kBAAkB,IAAI;AACjD,sBAAsB,KAAK,eAAe,IAAI;AAC9C;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B;AAC/B,kCAAkC;AAClC;AACA;AACA;AACA;AACA,2CAA2C;AAC3C,iDAAiD;AACjD;AACA,6CAA6C;AAC7C,qDAAqD;AACrD;AACA;AACA;AACA,+BAA+B;AAC/B,sCAAsC;AACtC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,OAAO;AACpB,aAAa,OAAO;AACpB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,sBAAsB,KAAK,0BAA0B,IAAI,WAAW,IAAI;AACxE,sBAAsB,KAAK,8BAA8B,IAAI;AAC7D;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,sBAAsB,KAAK,eAAe,IAAI;AAC9C,sBAAsB,KAAK,kBAAkB,IAAI;AACjD;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B;AAC/B,oCAAoC;AACpC,oCAAoC;AACpC;AACA;AACA;AACA;AACA,2CAA2C;AAC3C,mDAAmD;AACnD;AACA,+CAA+C;AAC/C,uDAAuD;AACvD;AACA;AACA;AACA,+BAA+B;AAC/B,wCAAwC;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,OAAO;AACpB,aAAa,OAAO;AACpB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,sBAAsB,KAAK,4BAA4B,IAAI,WAAW,IAAI;AAC1E,sBAAsB,KAAK,0BAA0B,IAAI;AACzD;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,sBAAsB,KAAK,iBAAiB,IAAI;AAChD,sBAAsB,KAAK,eAAe,IAAI;AAC9C;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B;AAC/B,sCAAsC;AACtC,sCAAsC;AACtC,sCAAsC;AACtC;AACA;AACA;AACA;AACA;AACA,2CAA2C;AAC3C,qDAAqD;AACrD;AACA,+CAA+C;AAC/C,yDAAyD;AACzD;AACA;AACA;AACA,+BAA+B;AAC/B,0CAA0C;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,OAAO;AACpB,aAAa,OAAO;AACpB,aAAa,OAAO;AACpB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,sBAAsB,KAAK;AAC3B,sBAAsB,KAAK;AAC3B;AACA,KAAK;AACL;AACA;AACA,sBAAsB,KAAK;AAC3B,sBAAsB,KAAK;AAC3B;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA;AACA,0BAA0B;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,KAAK;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,YAAY;AACzB,aAAa,OAAO;AACpB;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,oBAAoB,KAAK;AACzB,oBAAoB,KAAK;AACzB;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,iBAAiB,KAAK;AACtB;AACA;AACA;AACA;AACA,iBAAiB,KAAK;AACtB;AACA;AACA;AACA;AACA;AACA,sEAAsE,KAAK;AAC3E,iBAAiB,IAAI,MAAM,8BAA8B,KAAK;AAC9D,iBAAiB,IAAI,MAAM,6BAA6B,KAAK;AAC7D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,KAAK;AACtB,iBAAiB,KAAK;AACtB,iBAAiB,KAAK,kD;AACtB;AACA;AACA;AACA,iBAAiB,IAAI,MAAM,kCAAkC,KAAK;AAClE;AACA;AACA;AACA;AACA,iBAAiB,IAAI,eAAe;AACpC,iBAAiB,IAAI,eAAe;AACpC;AACA;AACA;AACA;AACA,iBAAiB,OAAO,YAAY;AACpC;AACA;AACA;AACA,iBAAiB,IAAI,KAAK,KAAK,GAAG;AAClC,oDAAoD,KAAK;AACzD;AACA;AACA;AACA;AACA;AACA,iBAAiB,KAAK;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,KAAK,4BAA4B;AAClD,iBAAiB,KAAK,+BAA+B;AACrD;AACA;AACA;AACA;AACA;AACA,iBAAiB,KAAK,2BAA2B;AACjD,iBAAiB,KAAK,+BAA+B;AACrD;AACA;AACA;AACA;AACA,iBAAiB,KAAK;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,KAAK;AACtB,iBAAiB,KAAK;AACtB,iBAAiB,KAAK;AACtB;AACA;AACA,iBAAiB,KAAK;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,OAAO;AACpB,aAAa,MAAM;AACnB,aAAa,OAAO;AACpB;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB,KAAK;AAC3B,sBAAsB,KAAK;AAC3B;;AAEA;AACA;AACA;AACA,sBAAsB,KAAK,mDAAmD,IAAI,YAAY,IAAI;AAClG,sBAAsB,KAAK,uDAAuD,IAAI;AACtF;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,KAAK;AACtB;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,KAAK;AACtB;AACA;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA,iBAAiB,KAAK;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,KAAK;AACtB;AACA;AACA,iBAAiB,KAAK;AACtB;AACA;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,KAAK;AACtB;AACA;AACA;AACA;AACA,UAAU;AACV;AACA;AACA,iBAAiB,KAAK;AACtB;AACA;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA;AACA;AACA,iBAAiB,KAAK;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,KAAK;AACtB;AACA;AACA;AACA;AACA,UAAU;AACV;AACA;AACA,iBAAiB,KAAK;AACtB;AACA;AACA;AACA;AACA,UAAU;AACV;AACA;AACA,iBAAiB,KAAK;AACtB;AACA;AACA,iBAAiB,KAAK;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,OAAO;AACpB,aAAa,OAAO;AACpB,aAAa,OAAO;AACpB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iFAAiF,KAAK;AACtF,iFAAiF,KAAK;AACtF;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,sBAAsB,KAAK;AAC3B,sBAAsB,KAAK;AAC3B;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2CAA2C;AAC3C,+CAA+C;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+CAA+C,iBAAiB;AAChE,iDAAiD;AACjD;AACA;AACA;AACA,aAAa,OAAO;AACpB,aAAa,OAAO;AACpB;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,oBAAoB,KAAK,uBAAuB,IAAI,WAAW,IAAI;AACnE,oBAAoB,KAAK,2BAA2B,IAAI;AACxD;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,OAAO;AACpB,aAAa,OAAO;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB,KAAK;AACzB,oBAAoB,KAAK;AACzB;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,OAAO;AACpB,aAAa,OAAO;AACpB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,oBAAoB,KAAK;AACzB,oBAAoB,KAAK;AACzB;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+DAA+D;AAC/D;AACA;AACA,iBAAiB,WAAW;AAC5B;AACA;AACA,iBAAiB,WAAW;AAC5B;AACA;AACA,iBAAiB,WAAW,oBAAoB,WAAW,EAAE;AAC7D,8CAA8C,WAAW,EAAE;AAC3D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,WAAW;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA,2DAA2D,KAAK;AAChE,0BAA0B,KAAK,4BAA4B,KAAK;AAChE,0BAA0B,KAAK,2BAA2B,KAAK;AAC/D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB;AACxB,iBAAiB,WAAW;AAC5B;AACA,4BAA4B;AAC5B;AACA,iBAAiB,WAAW;AAC5B;AACA;AACA;AACA;AACA;AACA,wBAAwB;AACxB,iBAAiB,WAAW;AAC5B;AACA,4BAA4B;AAC5B;AACA,iBAAiB,WAAW;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,WAAW,6BAA6B;AACzD,iBAAiB,WAAW,yBAAyB;AACrD;AACA;AACA;AACA;AACA;AACA,iBAAiB,iBAAiB;AAClC,iBAAiB,iBAAiB;AAClC;AACA;AACA;AACA;AACA;AACA,iBAAiB,KAAK;AACtB,iBAAiB,KAAK;AACtB;AACA;AACA;AACA,iBAAiB,KAAK;AACtB;AACA;AACA;AACA;AACA;AACA,aAAa,uBAAuB;AACpC;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,uCAAuC,mBAAmB;;AAE1D;AACA;AACA;;AAEA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,OAAO;AACP;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA,SAAS;AACT,OAAO;AACP;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA,SAAS;AACT,OAAO;;AAEP;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,oBAAoB,KAAK;AACzB,oBAAoB,KAAK;AACzB;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,kCAAkC,wCAAwC;AAC1E;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kCAAkC,wCAAwC;AAC1E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kCAAkC,WAAW;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kCAAkC,wCAAwC;AAC1E;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kCAAkC,wCAAwC;AAC1E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kCAAkC,WAAW;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uCAAuC;AACvC,0DAA0D;AAC1D;AACA;AACA;AACA;AACA;AACA;AACA,kCAAkC,wCAAwC;AAC1E;AACA,qDAAqD;AACrD,yDAAyD;AACzD;AACA;AACA;AACA;AACA;AACA;AACA,kCAAkC,WAAW;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B;AAC/B,iCAAiC;AACjC;AACA;AACA;AACA;AACA,6BAA6B,QAAQ,EAAE,aAAa;AACpD,yCAAyC;AACzC;AACA;AACA;AACA;AACA,yBAAyB;AACzB;AACA;AACA;AACA;AACA,6BAA6B,YAAY,EAAE,aAAa;AACxD,6CAA6C;AAC7C,+CAA+C;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,uBAAuB;AACpC,aAAa,cAAc;AAC3B,aAAa,OAAO;AACpB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,6BAA6B,IAAI;AACjC,OAAO;AACP;AACA;;AAEA;AACA;AACA,sBAAsB,KAAK;AAC3B,sBAAsB,KAAK,6BAA6B,IAAI;AAC5D;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA,4BAA4B,KAAK,YAAY,IAAI,OAAO,IAAI;AAC5D,4BAA4B,KAAK,gBAAgB,IAAI,oCAAoC,IAAI;AAC7F;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,0BAA0B,KAAK,YAAY,IAAI,OAAO,IAAI;AAC1D,0BAA0B,KAAK,gBAAgB,IAAI,yBAAyB,IAAI;AAChF;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,0BAA0B,KAAK,sCAAsC,IAAI,WAAW,IAAI;AACxF,0BAA0B,KAAK,0CAA0C,IAAI;AAC7E;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,sBAAsB,KAAK,YAAY,IAAI,OAAO,IAAI;AACtD,sBAAsB,KAAK,gBAAgB,IAAI,yBAAyB,IAAI;AAC5E;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB;AAClB,kBAAkB;AAClB;AACA;AACA;AACA;AACA;AACA,aAAa,OAAO;AACpB,aAAa,OAAO;AACpB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,oBAAoB,KAAK;AACzB,oBAAoB,KAAK;AACzB;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0B;AACA,UAAU;AACV;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA;AACA;AACA,aAAa,SAAS;AACtB,aAAa,OAAO;AACpB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB,KAAK;AACzB,oBAAoB,KAAK;AACzB;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mCAAmC;AACnC,6CAA6C;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,OAAO;AACpB,aAAa,OAAO;AACpB,aAAa,OAAO;AACpB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,oBAAoB,KAAK;AACzB,oBAAoB,KAAK;AACzB;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,OAAO;AACP,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gEAAgE,KAAK;AACrE,kBAAkB,KAAK,0BAA0B,KAAK;AACtD,kBAAkB,KAAK,yBAAyB,KAAK;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB,KAAK,GAAG,KAAK,GAAG,KAAK;AACvC,8CAA8C,KAAK,GAAG,KAAK;AAC3D,mDAAmD,KAAK,GAAG,KAAK;AAChE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6DAA6D;AAC7D,oDAAoD;AACpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,MAAM;AACnB,aAAa,OAAO;AACpB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA,4BAA4B,KAAK,4BAA4B,IAAI;AACjE,kCAAkC,KAAK,gCAAgC,IAAI;AAC3E,KAAK;AACL;AACA,4BAA4B,KAAK,uCAAuC,IAAI;AAC5E,kCAAkC,KAAK,2CAA2C,IAAI;AACtF;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B;AAC/B,0CAA0C;AAC1C;AACA;AACA;AACA;AACA;AACA,+BAA+B;AAC/B,8CAA8C;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,SAAS;AACtB,aAAa,OAAO;AACpB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,oBAAoB,KAAK,gBAAgB,IAAI;AAC7C,oBAAoB,KAAK,oBAAoB,IAAI;AACjD;AACA;AACA;AACA;;AAEA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mCAAmC,aAAa;AAChD,oCAAoC,aAAa;AACjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB;AACtB,mCAAmC,mBAAmB;AACtD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oCAAoC,aAAa;AACjD;AACA;AACA;AACA,sBAAsB;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB;AACtB,mCAAmC,mBAAmB;AACtD;AACA;AACA;AACA;AACA,mCAAmC,aAAa;AAChD,oCAAoC,aAAa;AACjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB;AACtB,mCAAmC,gBAAgB;AACnD,wCAAwC,gBAAgB;AACxD;AACA,wDAAwD;AACxD,sDAAsD;AACtD;AACA,6DAA6D;AAC7D,2DAA2D;AAC3D;AACA;AACA;AACA;AACA;AACA,aAAa,OAAO;AACpB,aAAa,OAAO;AACpB,aAAa,OAAO;AACpB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mCAAmC,UAAU;AAC7C,mCAAmC,YAAY;AAC/C;AACA,kDAAkD;AAClD,4CAA4C;AAC5C;AACA;AACA;AACA;AACA;AACA,sBAAsB;AACtB,mCAAmC,gBAAgB;AACnD;AACA,wDAAwD;AACxD,kDAAkD;AAClD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB;AACtB,wCAAwC,gBAAgB;AACxD;AACA,6DAA6D;AAC7D,2DAA2D;AAC3D;AACA;AACA;AACA;AACA,sBAAsB;AACtB;AACA;AACA,kDAAkD;AAClD,oDAAoD;AACpD;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB;AACtB;AACA;AACA;AACA;AACA;AACA;AACA,mCAAmC,YAAY;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,gBAAgB;AAC7B,aAAa,OAAO;AACpB,aAAa,OAAO;AACpB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wCAAwC,UAAU;AAClD,mCAAmC,YAAY;AAC/C;AACA,uDAAuD;AACvD,iDAAiD;AACjD;AACA;AACA;AACA;AACA;AACA,sBAAsB;AACtB,wCAAwC,gBAAgB;AACxD;AACA,6DAA6D;AAC7D,uDAAuD;AACvD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB;AACtB,mCAAmC,gBAAgB;AACnD;AACA,wDAAwD;AACxD,sDAAsD;AACtD;AACA;AACA;AACA;AACA,sBAAsB;AACtB;AACA;AACA,kDAAkD;AAClD,oDAAoD;AACpD;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB;AACtB;AACA;AACA;AACA;AACA;AACA;AACA,mCAAmC,YAAY;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,gBAAgB;AAC7B,aAAa,OAAO;AACpB,aAAa,OAAO;AACpB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB;AACtB,mCAAmC,gBAAgB;AACnD;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB;AACtB,wCAAwC,gBAAgB;AACxD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB;AACtB,mCAAmC,gBAAgB;AACnD,wCAAwC,gBAAgB;AACxD;AACA,wDAAwD;AACxD,sDAAsD;AACtD;AACA,6DAA6D;AAC7D,2DAA2D;AAC3D;AACA;AACA;AACA;AACA;AACA,sBAAsB;AACtB,mCAAmC,gBAAgB;AACnD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB;AACtB,mCAAmC,gBAAgB;AACnD;AACA;AACA;AACA;AACA;AACA,aAAa,OAAO;AACpB,aAAa,OAAO;AACpB;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,KAAK;AACtB;AACA;AACA;AACA,8DAA8D;AAC9D,0CAA0C;AAC1C,4CAA4C;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,oBAAoB,KAAK;AACzB,oBAAoB,KAAK;AACzB;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0CAA0C;AAC1C,4CAA4C;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,KAAK;AACtB;AACA;AACA;AACA,iBAAiB,KAAK;AACtB;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,oBAAoB,KAAK;AACzB,oBAAoB,KAAK;AACzB;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4CAA4C;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,KAAK;AACtB;AACA;AACA;AACA,iBAAiB,KAAK;AACtB;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,oBAAoB,KAAK;AACzB,oBAAoB,KAAK;AACzB;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yCAAyC;AACzC,wCAAwC;AACxC;AACA;AACA;AACA;AACA,+BAA+B;AAC/B,sCAAsC;AACtC;AACA;AACA;AACA;AACA,6CAA6C;AAC7C,2CAA2C;AAC3C;AACA;AACA;AACA;AACA,+CAA+C;AAC/C,4CAA4C;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,oBAAoB,KAAK;AACzB,oBAAoB,KAAK;AACzB;AACA,GAAG;AACH;;;;;;;;;;AChpHA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qDAAqD;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,MAAM;AACnB,aAAa,OAAO;AACpB,aAAa,SAAS;AACtB,aAAa,QAAQ;AACrB;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,cAAc;AAC3B,aAAa,gBAAgB;AAC7B,aAAa,gBAAgB;AAC7B,aAAa,MAAM;AACnB,aAAa,MAAM;AACnB,aAAa,QAAQ;AACrB;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;;;;;;;;;;ACpKA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,wBAAwB;AACxB;AACA,WAAW,MAAM;AACjB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;;;;;;;;;ACzBA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,aAAa;AACb;AACA;AACA;AACA;;AAEA;AACA;AACA;;;;;;;;;;AC5BA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,MAAM;AACjB,aAAa,OAAO,kCAAkC;AACtD;AACA;AACA;AACA;;AAEA;AACA;AACA;;;;;;;;;;AC9BA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,SAAS;AACpB,WAAW,SAAS;AACpB;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;;;;;;;;;ACpEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,CAAC;;AAED;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,SAAS;AACpB,WAAW,SAAS;AACpB;AACA;AACA;AACA;;AAEA;AACA;AACA,oCAAoC;AACpC;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,WAAW;AACX;;AAEA;AACA;AACA;AACA;AACA,GAAG;AACH;;;;;;;;;;ACvJA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,SAAS;AACpB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;;;;;;;;;AC3FA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,SAAS;AACpB;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;;;;;;;;;;AC3FA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,SAAS;AACpB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;;;;;;;;;ACnEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,SAAS;AACpB;AACA;AACA;AACA;;AAEA;AACA,gDAAgD;;AAEhD;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;;;;;;;;;;;ACvEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA,GAAG;AACH;;AAEA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,MAAM;AACjB,WAAW,WAAW;AACtB,aAAa,aAAa;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,MAAM;AACjB,WAAW,WAAW;AACtB,WAAW,QAAQ;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,MAAM;AACjB,WAAW,OAAO;AAClB,WAAW,MAAM;AACjB,WAAW,MAAM;AACjB;AACA;AACA,YAAY,QAAQ;AACpB;AACA;AACA,uDAAuD;AACvD;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,MAAM;AACjB,YAAY,aAAa;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,MAAM;AACjB,WAAW,OAAO;AAClB,WAAW,MAAM;AACjB,WAAW,MAAM;AACjB;AACA;AACA,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,YAAY,QAAQ;AACpB;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,IAAI;AACf,WAAW,IAAI;AACf,WAAW,OAAO;AAClB,YAAY,QAAQ;AACpB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH;AACA;;AAEA;AACA;AACA;AACA,WAAW,SAAS;AACpB,WAAW,SAAS;AACpB,WAAW,OAAO;AAClB,YAAY,QAAQ;AACpB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,SAAS;AACpB,WAAW,SAAS;AACpB,WAAW,OAAO;AAClB,YAAY,QAAQ;AACpB;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,aAAa,MAAM;AACnB;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,UAAU;AACrB,aAAa,MAAM;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB,aAAa,MAAM;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,MAAM;AACjB,WAAW,MAAM;AACjB,WAAW,OAAO;AAClB,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,YAAY;AAC7B;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,MAAM;AACjB,WAAW,OAAO;AAClB,YAAY,QAAQ;AACpB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,YAAY,QAAQ;AACpB;AACA;AACA;AACA;;;;;;;;;;ACtcA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,aAAa;AACb;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;ACzBA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ,KAAK;AACb,QAAQ,IAAI;AACZ,QAAQ,IAAI;AACZ;AACA,WAAW,OAAO;AAClB,WAAW,UAAU;AACrB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,iBAAiB,MAAM,iBAAiB,wBAAwB,EAAE;AAClE,iBAAiB,KAAK,iBAAiB,2BAA2B,EAAE;AACpE,iBAAiB,KAAK,iBAAiB,6BAA6B,EAAE;;AAEtE;AACA;;;;;;;;;;AClDA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,MAAM;AACjB;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA,kCAAkC,wBAAwB,EAAE;AAC5D;;AAEA;AACA;AACA;AACA;AACA;AACA,GAAG;;AAEH;;AAEA,uCAAuC,6BAA6B,EAAE;AACtE;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;AClDA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,UAAU;AACrB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;;;;;;;;;;AC3BA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B;AAC/B,uCAAuC;AACvC,+BAA+B;AAC/B;AACA,sCAAsC;AACtC,+BAA+B;AAC/B,+BAA+B;AAC/B;AACA,sCAAsC;AACtC,+BAA+B;AAC/B,+BAA+B;AAC/B;AACA,WAAW,OAAO;AAClB,WAAW,cAAc;AACzB,aAAa,QAAQ;AACrB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,aAAa,OAAO;AACpB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB;AAChB,KAAK;AACL,gBAAgB;AAChB;;AAEA;AACA,GAAG;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,aAAa,iBAAiB;AAC9B;AACA;;AAEA;AACA;AACA;AACA;;AAEA,iBAAiB,eAAe;AAChC;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,EAAE;AACb,WAAW,OAAO;AAClB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,iBAAiB,eAAe;AAChC;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,aAAa,OAAO;AACpB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,qBAAqB;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA,sCAAsC;AACtC,yCAAyC;AACzC,gDAAgD;AAChD;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,aAAa,OAAO;AACpB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,qBAAqB;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qDAAqD,oBAAoB;AACzE;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,MAAM;AACjB;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;AClSA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;;;;;;;;;;AC3KA;;;;;;;;;;;;;;ACAwB;AACH;;AAErB;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,mBAAmB,8CAA8C,UAAU,EAAE;AAC7E;AACA;AACA,KAAK;;AAEL;AACA;AACA,oBAAoB,kEAAkE,cAAc,EAAE;AACtG,oBAAoB;AACpB,oBAAoB,mBAAmB;AACvC,oCAAoC;AACpC,SAAS;AACT;AACA,KAAK;;AAEL;AACA;AACA;AACA,sCAAsC,WAAW,EAAE;AACnD,sCAAsC,WAAW,EAAE;AACnD;AACA,oBAAoB,yDAAyD,YAAY,EAAE;AAC3F,oBAAoB;AACpB,oBAAoB,WAAW;AAC/B,oCAAoC,YAAY,eAAe;AAC/D;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA,oBAAoB;AACpB,oBAAoB;AACpB;AACA;AACA;AACA;AACA,KAAK,EAAE;AACP,CAAC;;;;;;;;;;ACnDD;AACA;AACA","file":"tests/tests.bundle.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 229);\n","import {Augmentations, applyAugmentation,\r\n AugmentationNames,\r\n PlayerOwnedAugmentation} from \"./Augmentations.js\";\r\nimport {BitNodes, BitNode, BitNodeMultipliers} from \"./BitNode.js\";\r\nimport {Company, Companies, getNextCompanyPosition,\r\n getJobRequirementText, CompanyPosition,\r\n CompanyPositions} from \"./Company.js\";\r\nimport {CONSTANTS} from \"./Constants.js\";\r\nimport {Corporation} from \"./CompanyManagement.js\";\r\nimport {Programs} from \"./CreateProgram.js\";\r\nimport {determineCrimeSuccess, Crimes} from \"./Crimes.js\";\r\nimport {Engine} from \"./engine.js\";\r\nimport {Factions, Faction,\r\n displayFactionContent} from \"./Faction.js\";\r\nimport {Gang, resetGangs} from \"./Gang.js\";\r\nimport {Locations} from \"./Location.js\";\r\nimport {hasBn11SF, hasWallStreetSF,hasAISF} from \"./NetscriptFunctions.js\";\r\nimport {AllServers, Server, AddToAllServers} from \"./Server.js\";\r\nimport {SpecialServerIps, SpecialServerNames} from \"./SpecialServerIps.js\";\r\nimport {SourceFiles, applySourceFile} from \"./SourceFile.js\";\r\n\r\nimport Decimal from \"decimal.js\";\r\nimport {dialogBoxCreate} from \"../utils/DialogBox.js\";\r\nimport {clearEventListeners} from \"../utils/HelperFunctions.js\";\r\nimport {createRandomIp} from \"../utils/IPAddress.js\";\r\nimport {Reviver, Generic_toJSON,\r\n Generic_fromJSON} from \"../utils/JSONReviver.js\";\r\nimport numeral from \"numeral/min/numeral.min\";\r\nimport {formatNumber,\r\n convertTimeMsToTimeElapsedString} from \"../utils/StringHelperFunctions.js\";\r\n\r\nfunction PlayerObject() {\r\n //Skills and stats\r\n this.hacking_skill = 1;\r\n\r\n //Combat stats\r\n this.hp = 10;\r\n this.max_hp = 10;\r\n this.strength = 1; //Damage dealt\r\n this.defense = 1; //Damage received\r\n this.dexterity = 1; //Accuracy\r\n this.agility = 1; //Dodge %\r\n\r\n //Labor stats\r\n this.charisma = 1;\r\n\r\n //Special stats\r\n this.intelligence = 0;\r\n\r\n //Hacking multipliers\r\n this.hacking_chance_mult = 1;\r\n this.hacking_speed_mult = 1;\r\n this.hacking_money_mult = 1;\r\n this.hacking_grow_mult = 1;\r\n\r\n //Experience and multipliers\r\n this.hacking_exp = 0;\r\n this.strength_exp = 0;\r\n this.defense_exp = 0;\r\n this.dexterity_exp = 0;\r\n this.agility_exp = 0;\r\n this.charisma_exp = 0;\r\n this.intelligence_exp= 0;\r\n\r\n this.hacking_mult = 1;\r\n this.strength_mult = 1;\r\n this.defense_mult = 1;\r\n this.dexterity_mult = 1;\r\n this.agility_mult = 1;\r\n this.charisma_mult = 1;\r\n\r\n this.hacking_exp_mult = 1;\r\n this.strength_exp_mult = 1;\r\n this.defense_exp_mult = 1;\r\n this.dexterity_exp_mult = 1;\r\n this.agility_exp_mult = 1;\r\n this.charisma_exp_mult = 1;\r\n\r\n this.company_rep_mult = 1;\r\n this.faction_rep_mult = 1;\r\n\r\n //Money\r\n this.money = new Decimal(1000);\r\n this.total_money = new Decimal(0); //Total money ever earned in this \"simulation\"\r\n this.lifetime_money = new Decimal(0); //Total money ever earned\r\n\r\n //IP Address of Starting (home) computer\r\n this.homeComputer = \"\";\r\n\r\n\t//Location information\r\n\tthis.city \t\t\t= Locations.Sector12;\r\n\tthis.location \t\t= \"\";\r\n\r\n //Company Information\r\n this.companyName = \"\"; //Name of Company, equivalent to an object from Locations\r\n this.companyPosition = \"\"; //CompanyPosition object\r\n\r\n //Servers\r\n this.currentServer = \"\"; //IP address of Server currently being accessed through terminal\r\n this.purchasedServers = []; //IP Addresses of purchased servers\r\n this.hacknetNodes = [];\r\n this.hacknetNodeWrappers = [];\r\n this.totalHacknetNodeProduction = 0;\r\n\r\n //Factions\r\n this.factions = []; //Names of all factions player has joined\r\n this.factionInvitations = []; //Outstanding faction invitations\r\n\r\n //Augmentations\r\n this.queuedAugmentations = [];\r\n this.augmentations = [];\r\n\r\n this.sourceFiles = [];\r\n\r\n //Crime statistics\r\n this.numPeopleKilled = 0;\r\n this.karma = 0;\r\n\r\n this.crime_money_mult = 1;\r\n this.crime_success_mult = 1;\r\n\r\n //Flag to let the engine know the player is starting an action\r\n // Current actions: hack, analyze\r\n this.startAction = false;\r\n this.actionTime = 0;\r\n\r\n //Flags/variables for working (Company, Faction, Creating Program, Taking Class)\r\n this.isWorking = false;\r\n this.workType = \"\";\r\n\r\n this.currentWorkFactionName = \"\";\r\n this.currentWorkFactionDescription = \"\";\r\n\r\n this.workHackExpGainRate = 0;\r\n this.workStrExpGainRate = 0;\r\n this.workDefExpGainRate = 0;\r\n this.workDexExpGainRate = 0;\r\n this.workAgiExpGainRate = 0;\r\n this.workChaExpGainRate = 0;\r\n this.workRepGainRate = 0;\r\n this.workMoneyGainRate = 0;\r\n this.workMoneyLossRate = 0;\r\n\r\n this.workHackExpGained = 0;\r\n this.workStrExpGained = 0;\r\n this.workDefExpGained = 0;\r\n this.workDexExpGained = 0;\r\n this.workAgiExpGained = 0;\r\n this.workChaExpGained = 0;\r\n this.workRepGained = 0;\r\n this.workMoneyGained = 0;\r\n\r\n this.createProgramName = \"\";\r\n this.createProgramReqLvl = 0;\r\n\r\n this.className = \"\";\r\n\r\n this.crimeType = \"\";\r\n\r\n this.timeWorked = 0; //in ms\r\n this.timeWorkedCreateProgram = 0;\r\n this.timeNeededToCompleteWork = 0;\r\n\r\n this.work_money_mult = 1;\r\n\r\n //Hacknet Node multipliers\r\n this.hacknet_node_money_mult = 1;\r\n this.hacknet_node_purchase_cost_mult = 1;\r\n this.hacknet_node_ram_cost_mult = 1;\r\n this.hacknet_node_core_cost_mult = 1;\r\n this.hacknet_node_level_cost_mult = 1;\r\n\r\n //Stock Market\r\n this.hasWseAccount = false;\r\n this.hasTixApiAccess = false;\r\n\r\n //Gang\r\n this.gang = 0;\r\n\r\n //Corporation\r\n this.corporation = 0;\r\n\r\n //Bladeburner\r\n this.bladeburner = 0;\r\n this.bladeburner_max_stamina_mult = 1;\r\n this.bladeburner_stamina_gain_mult = 1;\r\n this.bladeburner_analysis_mult = 1; //Field Analysis Only\r\n this.bladeburner_success_chance_mult = 1;\r\n\r\n //bitnode\r\n this.bitNodeN = 1;\r\n\r\n //Flags for determining whether certain \"thresholds\" have been achieved\r\n this.firstFacInvRecvd = false;\r\n this.firstAugPurchased = false;\r\n this.firstJobRecvd = false;\r\n this.firstTimeTraveled = false;\r\n this.firstProgramAvailable = false;\r\n\r\n\t//Used to store the last update time.\r\n\tthis.lastUpdate = 0;\r\n this.totalPlaytime = 0;\r\n this.playtimeSinceLastAug = 0;\r\n\r\n //Production since last Augmentation installation\r\n this.scriptProdSinceLastAug = 0;\r\n this.stockProdSinceLastAug = 0;\r\n this.crimeProdSinceLastAug = 0;\r\n this.jobProdSinceLastAug = 0;\r\n};\r\n\r\nPlayerObject.prototype.init = function() {\r\n /* Initialize Player's home computer */\r\n var t_homeComp = new Server({\r\n ip:createRandomIp(), hostname:\"home\", organizationName:\"Home PC\",\r\n isConnectedTo:true, adminRights:true, purchasedByPlayer:true, maxRam:8\r\n });\r\n this.homeComputer = t_homeComp.ip;\r\n this.currentServer = t_homeComp.ip;\r\n AddToAllServers(t_homeComp);\r\n\r\n this.getHomeComputer().programs.push(Programs.NukeProgram);\r\n}\r\n\r\nPlayerObject.prototype.prestigeAugmentation = function() {\r\n var homeComp = this.getHomeComputer();\r\n this.currentServer = homeComp.ip;\r\n this.homeComputer = homeComp.ip;\r\n\r\n this.numPeopleKilled = 0;\r\n this.karma = 0;\r\n\r\n //Reset stats\r\n this.hacking_skill = 1;\r\n\r\n this.strength = 1;\r\n this.defense = 1;\r\n this.dexterity = 1;\r\n this.agility = 1;\r\n\r\n this.charisma = 1;\r\n\r\n this.hacking_exp = 0;\r\n this.strength_exp = 0;\r\n this.defense_exp = 0;\r\n this.dexterity_exp = 0;\r\n this.agility_exp = 0;\r\n this.charisma_exp = 0;\r\n\r\n this.money = new Decimal(1000);\r\n\r\n this.city = Locations.Sector12;\r\n this.location = \"\";\r\n\r\n this.companyName = \"\";\r\n this.companyPosition = \"\";\r\n\r\n this.purchasedServers = [];\r\n\r\n this.factions = [];\r\n this.factionInvitations = [];\r\n\r\n this.queuedAugmentations = [];\r\n\r\n this.startAction = false;\r\n this.actionTime = 0;\r\n\r\n this.isWorking = false;\r\n this.currentWorkFactionName = \"\";\r\n this.currentWorkFactionDescription = \"\";\r\n this.createProgramName = \"\";\r\n this.className = \"\";\r\n this.crimeType = \"\";\r\n\r\n this.workHackExpGainRate = 0;\r\n this.workStrExpGainRate = 0;\r\n this.workDefExpGainRate = 0;\r\n this.workDexExpGainRate = 0;\r\n this.workAgiExpGainRate = 0;\r\n this.workChaExpGainRate = 0;\r\n this.workRepGainRate = 0;\r\n this.workMoneyGainRate = 0;\r\n\r\n this.workHackExpGained = 0;\r\n this.workStrExpGained = 0;\r\n this.workDefExpGained = 0;\r\n this.workDexExpGained = 0;\r\n this.workAgiExpGained = 0;\r\n this.workChaExpGained = 0;\r\n this.workRepGained = 0;\r\n this.workMoneyGained = 0;\r\n\r\n this.timeWorked = 0;\r\n\r\n this.lastUpdate = new Date().getTime();\r\n\r\n this.playtimeSinceLastAug = 0;\r\n this.scriptProdSinceLastAug = 0;\r\n\r\n this.hacknetNodes.length = 0;\r\n this.totalHacknetNodeProduction = 0;\r\n}\r\n\r\nPlayerObject.prototype.prestigeSourceFile = function() {\r\n var homeComp = this.getHomeComputer();\r\n this.currentServer = homeComp.ip;\r\n this.homeComputer = homeComp.ip;\r\n\r\n this.numPeopleKilled = 0;\r\n this.karma = 0;\r\n\r\n //Reset stats\r\n this.hacking_skill = 1;\r\n\r\n this.strength = 1;\r\n this.defense = 1;\r\n this.dexterity = 1;\r\n this.agility = 1;\r\n\r\n this.charisma = 1;\r\n\r\n this.hacking_exp = 0;\r\n this.strength_exp = 0;\r\n this.defense_exp = 0;\r\n this.dexterity_exp = 0;\r\n this.agility_exp = 0;\r\n this.charisma_exp = 0;\r\n\r\n this.money = new Decimal(1000);\r\n\r\n this.city = Locations.Sector12;\r\n this.location = \"\";\r\n\r\n this.companyName = \"\";\r\n this.companyPosition = \"\";\r\n\r\n this.purchasedServers = [];\r\n\r\n this.factions = [];\r\n this.factionInvitations = [];\r\n\r\n this.queuedAugmentations = [];\r\n this.augmentations = [];\r\n\r\n this.startAction = false;\r\n this.actionTime = 0;\r\n\r\n this.isWorking = false;\r\n this.currentWorkFactionName = \"\";\r\n this.currentWorkFactionDescription = \"\";\r\n this.createProgramName = \"\";\r\n this.className = \"\";\r\n this.crimeType = \"\";\r\n\r\n this.workHackExpGainRate = 0;\r\n this.workStrExpGainRate = 0;\r\n this.workDefExpGainRate = 0;\r\n this.workDexExpGainRate = 0;\r\n this.workAgiExpGainRate = 0;\r\n this.workChaExpGainRate = 0;\r\n this.workRepGainRate = 0;\r\n this.workMoneyGainRate = 0;\r\n\r\n this.workHackExpGained = 0;\r\n this.workStrExpGained = 0;\r\n this.workDefExpGained = 0;\r\n this.workDexExpGained = 0;\r\n this.workAgiExpGained = 0;\r\n this.workChaExpGained = 0;\r\n this.workRepGained = 0;\r\n this.workMoneyGained = 0;\r\n\r\n this.timeWorked = 0;\r\n\r\n this.lastUpdate = new Date().getTime();\r\n\r\n this.hacknetNodes.length = 0;\r\n this.totalHacknetNodeProduction = 0;\r\n\r\n //Gang\r\n this.gang = null;\r\n resetGangs();\r\n\r\n //Reset Stock market\r\n this.hasWseAccount = false;\r\n this.hasTixApiAccess = false;\r\n\r\n //BitNode 3: Corporatocracy\r\n if (this.bitNodeN === 3) {this.money = new Decimal(150e9);}\r\n this.corporation = 0;\r\n\r\n this.playtimeSinceLastAug = 0;\r\n this.scriptProdSinceLastAug = 0;\r\n}\r\n\r\nPlayerObject.prototype.getCurrentServer = function() {\r\n return AllServers[this.currentServer];\r\n}\r\n\r\nPlayerObject.prototype.getHomeComputer = function() {\r\n return AllServers[this.homeComputer];\r\n}\r\n\r\nPlayerObject.prototype.getUpgradeHomeRamCost = function() {\r\n //Calculate how many times ram has been upgraded (doubled)\r\n const currentRam = Player.getHomeComputer().maxRam;\r\n const numUpgrades = Math.log2(currentRam);\r\n\r\n //Calculate cost\r\n //Have cost increase by some percentage each time RAM has been upgraded\r\n const mult = Math.pow(1.58, numUpgrades);\r\n var cost = currentRam * CONSTANTS.BaseCostFor1GBOfRamHome * mult;\r\n return cost;\r\n}\r\n\r\n//Calculates skill level based on experience. The same formula will be used for every skill\r\nPlayerObject.prototype.calculateSkill = function(exp) {\r\n return Math.max(Math.floor(32 * Math.log(exp + 534.5) - 200), 1);\r\n}\r\n\r\nPlayerObject.prototype.updateSkillLevels = function() {\r\n\tthis.hacking_skill = Math.max(1, Math.floor(this.calculateSkill(this.hacking_exp) * this.hacking_mult * BitNodeMultipliers.HackingLevelMultiplier));\r\n\tthis.strength = Math.floor(this.calculateSkill(this.strength_exp) * this.strength_mult);\r\n this.defense = Math.floor(this.calculateSkill(this.defense_exp) * this.defense_mult);\r\n this.dexterity = Math.floor(this.calculateSkill(this.dexterity_exp) * this.dexterity_mult);\r\n this.agility = Math.floor(this.calculateSkill(this.agility_exp) * this.agility_mult);\r\n this.charisma = Math.floor(this.calculateSkill(this.charisma_exp) * this.charisma_mult);\r\n\r\n if (this.intelligence > 0) {\r\n this.intelligence = Math.floor(this.calculateSkill(this.intelligence_exp));\r\n } else {\r\n this.intelligence = 0;\r\n }\r\n\r\n var ratio = this.hp / this.max_hp;\r\n this.max_hp = Math.floor(10 + this.defense / 10);\r\n Player.hp = Math.round(this.max_hp * ratio);\r\n}\r\n\r\nPlayerObject.prototype.resetMultipliers = function() {\r\n this.hacking_chance_mult = 1;\r\n this.hacking_speed_mult = 1;\r\n this.hacking_money_mult = 1;\r\n this.hacking_grow_mult = 1;\r\n\r\n this.hacking_mult = 1;\r\n this.strength_mult = 1;\r\n this.defense_mult = 1;\r\n this.dexterity_mult = 1;\r\n this.agility_mult = 1;\r\n this.charisma_mult = 1;\r\n\r\n this.hacking_exp_mult = 1;\r\n this.strength_exp_mult = 1;\r\n this.defense_exp_mult = 1;\r\n this.dexterity_exp_mult = 1;\r\n this.agility_exp_mult = 1;\r\n this.charisma_exp_mult = 1;\r\n\r\n this.company_rep_mult = 1;\r\n this.faction_rep_mult = 1;\r\n\r\n this.crime_money_mult = 1;\r\n this.crime_success_mult = 1;\r\n\r\n this.hacknet_node_money_mult = 1;\r\n this.hacknet_node_purchase_cost_mult = 1;\r\n this.hacknet_node_ram_cost_mult = 1;\r\n this.hacknet_node_core_cost_mult = 1;\r\n this.hacknet_node_level_cost_mult = 1;\r\n\r\n this.work_money_mult = 1;\r\n\r\n this.bladeburner_max_stamina_mult = 1;\r\n this.bladeburner_stamina_gain_mult = 1;\r\n this.bladeburner_analysis_mult = 1;\r\n this.bladeburner_success_chance_mult = 1;\r\n}\r\n\r\n//Calculates the chance of hacking a server\r\n//The formula is:\r\n// (2 * hacking_chance_multiplier * hacking_skill - requiredLevel) 100 - difficulty\r\n// ----------------------------------------------------------- * -----------------\r\n// (2 * hacking_chance_multiplier * hacking_skill) 100\r\nPlayerObject.prototype.calculateHackingChance = function() {\r\n var difficultyMult = (100 - this.getCurrentServer().hackDifficulty) / 100;\r\n var skillMult = (1.75 * this.hacking_skill) + (0.2 * this.intelligence);\r\n var skillChance = (skillMult - this.getCurrentServer().requiredHackingSkill) / skillMult;\r\n var chance = skillChance * difficultyMult * this.hacking_chance_mult;\r\n if (chance > 1) {return 1;}\r\n if (chance < 0) {return 0;}\r\n return chance;\r\n}\r\n\r\n//Calculate the time it takes to hack a server in seconds. Returns the time\r\n//The formula is:\r\n// (2.5 * requiredLevel * difficulty + 200)\r\n// ----------------------------------- * hacking_speed_multiplier\r\n// hacking_skill + 100\r\nPlayerObject.prototype.calculateHackingTime = function() {\r\n var difficultyMult = this.getCurrentServer().requiredHackingSkill * this.getCurrentServer().hackDifficulty;\r\n var skillFactor = (2.5 * difficultyMult + 200) / (this.hacking_skill + 100 + (0.1 * this.intelligence));\r\n return 5 * skillFactor / this.hacking_speed_mult;\r\n}\r\n\r\n//Calculates the PERCENTAGE of a server's money that the player will hack from the server if successful\r\n//The formula is:\r\n// (hacking_skill - (requiredLevel-1)) 100 - difficulty\r\n// --------------------------------------* ----------------------- * hacking_money_multiplier\r\n// hacking_skill 100\r\nPlayerObject.prototype.calculatePercentMoneyHacked = function() {\r\n var difficultyMult = (100 - this.getCurrentServer().hackDifficulty) / 100;\r\n var skillMult = (this.hacking_skill - (this.getCurrentServer().requiredHackingSkill - 1)) / this.hacking_skill;\r\n var percentMoneyHacked = difficultyMult * skillMult * this.hacking_money_mult / 240;\r\n console.log(\"Percent money hacked calculated to be: \" + percentMoneyHacked);\r\n if (percentMoneyHacked < 0) {return 0;}\r\n if (percentMoneyHacked > 1) {return 1;}\r\n return percentMoneyHacked * BitNodeMultipliers.ManualHackMoney;\r\n}\r\n\r\n//Returns how much EXP the player gains on a successful hack\r\n//The formula is:\r\n// difficulty * requiredLevel * hacking_multiplier\r\nPlayerObject.prototype.calculateExpGain = function() {\r\n var s = this.getCurrentServer();\r\n if (s.baseDifficulty == null) {\r\n s.baseDifficulty = s.hackDifficulty;\r\n }\r\n return (s.baseDifficulty * this.hacking_exp_mult * 0.3 + 3) * BitNodeMultipliers.HackExpGain;\r\n}\r\n\r\n//Hack/Analyze a server. Return the amount of time the hack will take. This lets the Terminal object know how long to disable itself for\r\n//This assumes that the server being hacked is not purchased by the player, that the player's hacking skill is greater than the\r\n//required hacking skill and that the player has admin rights.\r\nPlayerObject.prototype.hack = function() {\r\n this.actionTime = this.calculateHackingTime();\r\n console.log(\"Hacking time: \" + this.actionTime);\r\n this.startAction = true; //Set the startAction flag so the engine starts the hacking process\r\n}\r\n\r\nPlayerObject.prototype.analyze = function() {\r\n this.actionTime = 1;\r\n this.startAction = true;\r\n}\r\n\r\nPlayerObject.prototype.hasProgram = function(programName) {\r\n var home = Player.getHomeComputer();\r\n for (var i = 0; i < home.programs.length; ++i) {\r\n if (programName.toLowerCase() == home.programs[i].toLowerCase()) {return true;}\r\n }\r\n return false;\r\n}\r\n\r\nPlayerObject.prototype.setMoney = function(money) {\r\n if (isNaN(money)) {\r\n console.log(\"ERR: NaN passed into Player.setMoney()\"); return;\r\n }\r\n this.money = money;\r\n}\r\n\r\nPlayerObject.prototype.gainMoney = function(money) {\r\n if (isNaN(money)) {\r\n console.log(\"ERR: NaN passed into Player.gainMoney()\"); return;\r\n }\r\n\tthis.money = this.money.plus(money);\r\n\tthis.total_money = this.total_money.plus(money);\r\n\tthis.lifetime_money = this.lifetime_money.plus(money);\r\n}\r\n\r\nPlayerObject.prototype.loseMoney = function(money) {\r\n if (isNaN(money)) {\r\n console.log(\"ERR: NaN passed into Player.loseMoney()\"); return;\r\n }\r\n this.money = this.money.minus(money);\r\n}\r\n\r\nPlayerObject.prototype.gainHackingExp = function(exp) {\r\n if (isNaN(exp)) {\r\n console.log(\"ERR: NaN passed into Player.gainHackingExp()\"); return;\r\n }\r\n this.hacking_exp += exp;\r\n}\r\n\r\nPlayerObject.prototype.gainStrengthExp = function(exp) {\r\n if (isNaN(exp)) {\r\n console.log(\"ERR: NaN passed into Player.gainStrengthExp()\"); return;\r\n }\r\n this.strength_exp += exp;\r\n}\r\n\r\nPlayerObject.prototype.gainDefenseExp = function(exp) {\r\n if (isNaN(exp)) {\r\n console.log(\"ERR: NaN passed into player.gainDefenseExp()\"); return;\r\n }\r\n this.defense_exp += exp;\r\n}\r\n\r\nPlayerObject.prototype.gainDexterityExp = function(exp) {\r\n if (isNaN(exp)) {\r\n console.log(\"ERR: NaN passed into Player.gainDexterityExp()\"); return;\r\n }\r\n this.dexterity_exp += exp;\r\n}\r\n\r\nPlayerObject.prototype.gainAgilityExp = function(exp) {\r\n if (isNaN(exp)) {\r\n console.log(\"ERR: NaN passed into Player.gainAgilityExp()\"); return;\r\n }\r\n this.agility_exp += exp;\r\n}\r\n\r\nPlayerObject.prototype.gainCharismaExp = function(exp) {\r\n if (isNaN(exp)) {\r\n console.log(\"ERR: NaN passed into Player.gainCharismaExp()\"); return;\r\n }\r\n this.charisma_exp += exp;\r\n}\r\n\r\nPlayerObject.prototype.gainIntelligenceExp = function(exp) {\r\n if (isNaN(exp)) {\r\n console.log(\"ERROR: NaN passed into Player.gainIntelligenceExp()\"); return;\r\n }\r\n if (hasAISF || this.intelligence > 0) {\r\n this.intelligence_exp += exp;\r\n } else {\r\n console.log(\"Not gaining intelligence experience bc it hasn't been unlocked yet\");\r\n }\r\n}\r\n\r\n//Given a string expression like \"str\" or \"strength\", returns the given stat\r\nPlayerObject.prototype.queryStatFromString = function(str) {\r\n var tempStr = str.toLowerCase();\r\n if (tempStr.includes(\"hack\")) {return Player.hacking_skill;}\r\n if (tempStr.includes(\"str\")) {return Player.strength;}\r\n if (tempStr.includes(\"def\")) {return Player.defense;}\r\n if (tempStr.includes(\"dex\")) {return Player.dexterity;}\r\n if (tempStr.includes(\"agi\")) {return Player.agility;}\r\n if (tempStr.includes(\"cha\")) {return Player.charisma;}\r\n if (tempStr.includes(\"int\")) {return Player.intelligence;}\r\n}\r\n\r\n/******* Working functions *******/\r\nPlayerObject.prototype.resetWorkStatus = function() {\r\n this.workHackExpGainRate = 0;\r\n this.workStrExpGainRate = 0;\r\n this.workDefExpGainRate = 0;\r\n this.workDexExpGainRate = 0;\r\n this.workAgiExpGainRate = 0;\r\n this.workChaExpGainRate = 0;\r\n this.workRepGainRate = 0;\r\n this.workMoneyGainRate = 0;\r\n\r\n this.workHackExpGained = 0;\r\n this.workStrExpGained = 0;\r\n this.workDefExpGained = 0;\r\n this.workDexExpGained = 0;\r\n this.workAgiExpGained = 0;\r\n this.workChaExpGained = 0;\r\n this.workRepGained = 0;\r\n this.workMoneyGained = 0;\r\n\r\n this.timeWorked = 0;\r\n this.timeWorkedCreateProgram = 0;\r\n\r\n this.currentWorkFactionName = \"\";\r\n this.currentWorkFactionDescription = \"\";\r\n this.createProgramName = \"\";\r\n this.className = \"\";\r\n\r\n document.getElementById(\"work-in-progress-text\").innerHTML = \"\";\r\n}\r\n\r\nPlayerObject.prototype.gainWorkExp = function() {\r\n this.gainHackingExp(this.workHackExpGained);\r\n this.gainStrengthExp(this.workStrExpGained);\r\n this.gainDefenseExp(this.workDefExpGained);\r\n this.gainDexterityExp(this.workDexExpGained);\r\n this.gainAgilityExp(this.workAgiExpGained);\r\n this.gainCharismaExp(this.workChaExpGained);\r\n}\r\n\r\n/* Working for Company */\r\nPlayerObject.prototype.finishWork = function(cancelled, sing=false) {\r\n //Since the work was cancelled early, player only gains half of what they've earned so far\r\n if (cancelled) {\r\n this.workRepGained /= 2;\r\n }\r\n\r\n this.gainWorkExp();\r\n\r\n var company = Companies[this.companyName];\r\n company.playerReputation += (this.workRepGained);\r\n\r\n this.gainMoney(this.workMoneyGained);\r\n\r\n this.updateSkillLevels();\r\n\r\n var txt = \"You earned a total of: <br>\" +\r\n \"$\" + formatNumber(this.workMoneyGained, 2) + \"<br>\" +\r\n formatNumber(this.workRepGained, 4) + \" reputation for the company <br>\" +\r\n formatNumber(this.workHackExpGained, 4) + \" hacking exp <br>\" +\r\n formatNumber(this.workStrExpGained, 4) + \" strength exp <br>\" +\r\n formatNumber(this.workDefExpGained, 4) + \" defense exp <br>\" +\r\n formatNumber(this.workDexExpGained, 4) + \" dexterity exp <br>\" +\r\n formatNumber(this.workAgiExpGained, 4) + \" agility exp <br>\" +\r\n formatNumber(this.workChaExpGained, 4) + \" charisma exp<br>\";\r\n\r\n if (cancelled) {\r\n txt = \"You worked a short shift of \" + convertTimeMsToTimeElapsedString(this.timeWorked) + \" <br><br> \" +\r\n \"Since you cancelled your work early, you only gained half of the reputation you earned. <br><br>\" + txt;\r\n } else {\r\n txt = \"You worked a full shift of 8 hours! <br><br> \" + txt;\r\n }\r\n if (!sing) {dialogBoxCreate(txt);}\r\n\r\n var mainMenu = document.getElementById(\"mainmenu-container\");\r\n mainMenu.style.visibility = \"visible\";\r\n this.isWorking = false;\r\n Engine.loadLocationContent();\r\n\r\n if (sing) {\r\n var res = \"You worked a short shift of \" + convertTimeMsToTimeElapsedString(this.timeWorked) + \" and \" +\r\n \"earned $\" + formatNumber(this.workMoneyGained, 2) + \", \" +\r\n formatNumber(this.workRepGained, 4) + \" reputation, \" +\r\n formatNumber(this.workHackExpGained, 4) + \" hacking exp, \" +\r\n formatNumber(this.workStrExpGained, 4) + \" strength exp, \" +\r\n formatNumber(this.workDefExpGained, 4) + \" defense exp, \" +\r\n formatNumber(this.workDexExpGained, 4) + \" dexterity exp, \" +\r\n formatNumber(this.workAgiExpGained, 4) + \" agility exp, and \" +\r\n formatNumber(this.workChaExpGained, 4) + \" charisma exp.\";\r\n this.resetWorkStatus();\r\n return res;\r\n }\r\n this.resetWorkStatus();\r\n}\r\n\r\nPlayerObject.prototype.startWork = function() {\r\n this.resetWorkStatus();\r\n this.isWorking = true;\r\n this.workType = CONSTANTS.WorkTypeCompany;\r\n\r\n this.workHackExpGainRate = this.getWorkHackExpGain();\r\n this.workStrExpGainRate = this.getWorkStrExpGain();\r\n this.workDefExpGainRate = this.getWorkDefExpGain();\r\n this.workDexExpGainRate = this.getWorkDexExpGain();\r\n this.workAgiExpGainRate = this.getWorkAgiExpGain();\r\n this.workChaExpGainRate = this.getWorkChaExpGain();\r\n this.workRepGainRate = this.getWorkRepGain();\r\n this.workMoneyGainRate = this.getWorkMoneyGain();\r\n\r\n this.timeNeededToCompleteWork = CONSTANTS.MillisecondsPer8Hours;\r\n\r\n //Remove all old event listeners from Cancel button\r\n var newCancelButton = clearEventListeners(\"work-in-progress-cancel-button\");\r\n newCancelButton.innerHTML = \"Cancel Work\";\r\n newCancelButton.addEventListener(\"click\", function() {\r\n Player.finishWork(true);\r\n return false;\r\n });\r\n\r\n //Display Work In Progress Screen\r\n Engine.loadWorkInProgressContent();\r\n}\r\n\r\nPlayerObject.prototype.work = function(numCycles) {\r\n this.workRepGainRate = this.getWorkRepGain();\r\n\r\n this.workHackExpGained += this.workHackExpGainRate * numCycles;\r\n this.workStrExpGained += this.workStrExpGainRate * numCycles;\r\n this.workDefExpGained += this.workDefExpGainRate * numCycles;\r\n this.workDexExpGained += this.workDexExpGainRate * numCycles;\r\n this.workAgiExpGained += this.workAgiExpGainRate * numCycles;\r\n this.workChaExpGained += this.workChaExpGainRate * numCycles;\r\n this.workRepGained += this.workRepGainRate * numCycles;\r\n this.workMoneyGained += this.workMoneyGainRate * numCycles;\r\n\r\n var cyclesPerSec = 1000 / Engine._idleSpeed;\r\n\r\n this.timeWorked += Engine._idleSpeed * numCycles;\r\n\r\n //If timeWorked == 8 hours, then finish. You can only gain 8 hours worth of exp and money\r\n if (this.timeWorked >= CONSTANTS.MillisecondsPer8Hours) {\r\n var maxCycles = CONSTANTS.GameCyclesPer8Hours;\r\n this.workHackExpGained = this.workHackExpGainRate * maxCycles;\r\n this.workStrExpGained = this.workStrExpGainRate * maxCycles;\r\n this.workDefExpGained = this.workDefExpGainRate * maxCycles;\r\n this.workDexExpGained = this.workDexExpGainRate * maxCycles;\r\n this.workAgiExpGained = this.workAgiExpGainRate * maxCycles;\r\n this.workChaExpGained = this.workChaExpGainRate * maxCycles;\r\n this.workRepGained = this.workRepGainRate * maxCycles;\r\n this.workMoneyGained = this.workMoneyGainRate * maxCycles;\r\n this.finishWork(false);\r\n return;\r\n }\r\n\r\n var comp = Companies[this.companyName], companyRep = \"0\";\r\n if (comp == null || !(comp instanceof Company)) {\r\n console.log(\"ERROR: Could not find Company: \" + this.companyName);\r\n } else {\r\n companyRep = comp.playerReputation;\r\n }\r\n\r\n var txt = document.getElementById(\"work-in-progress-text\");\r\n txt.innerHTML = \"You are currently working as a \" + this.companyPosition.positionName +\r\n \" at \" + this.companyName + \" (Current Company Reputation: \" +\r\n formatNumber(companyRep, 0) + \")<br><br>\" +\r\n \"You have been working for \" + convertTimeMsToTimeElapsedString(this.timeWorked) + \"<br><br>\" +\r\n \"You have earned: <br><br>\" +\r\n \"$\" + formatNumber(this.workMoneyGained, 2) + \" ($\" + formatNumber(this.workMoneyGainRate * cyclesPerSec, 2) + \" / sec) <br><br>\" +\r\n formatNumber(this.workRepGained, 4) + \" (\" + formatNumber(this.workRepGainRate * cyclesPerSec, 4) + \" / sec) reputation for this company <br><br>\" +\r\n formatNumber(this.workHackExpGained, 4) + \" (\" + formatNumber(this.workHackExpGainRate * cyclesPerSec, 4) + \" / sec) hacking exp <br><br>\" +\r\n formatNumber(this.workStrExpGained, 4) + \" (\" + formatNumber(this.workStrExpGainRate * cyclesPerSec, 4) + \" / sec) strength exp <br>\" +\r\n formatNumber(this.workDefExpGained, 4) + \" (\" + formatNumber(this.workDefExpGainRate * cyclesPerSec, 4) + \" / sec) defense exp <br>\" +\r\n formatNumber(this.workDexExpGained, 4) + \" (\" + formatNumber(this.workDexExpGainRate * cyclesPerSec, 4) + \" / sec) dexterity exp <br>\" +\r\n formatNumber(this.workAgiExpGained, 4) + \" (\" + formatNumber(this.workAgiExpGainRate * cyclesPerSec, 4) + \" / sec) agility exp <br><br> \" +\r\n formatNumber(this.workChaExpGained, 4) + \" (\" + formatNumber(this.workChaExpGainRate * cyclesPerSec, 4) + \" / sec) charisma exp <br><br>\" +\r\n \"You will automatically finish after working for 8 hours. You can cancel earlier if you wish, \" +\r\n \"but you will only gain half of the reputation you've earned so far.\"\r\n\r\n}\r\n\r\nPlayerObject.prototype.startWorkPartTime = function() {\r\n this.resetWorkStatus();\r\n this.isWorking = true;\r\n this.workType = CONSTANTS.WorkTypeCompanyPartTime;\r\n\r\n this.workHackExpGainRate = this.getWorkHackExpGain();\r\n this.workStrExpGainRate = this.getWorkStrExpGain();\r\n this.workDefExpGainRate = this.getWorkDefExpGain();\r\n this.workDexExpGainRate = this.getWorkDexExpGain();\r\n this.workAgiExpGainRate = this.getWorkAgiExpGain();\r\n this.workChaExpGainRate = this.getWorkChaExpGain();\r\n this.workRepGainRate = this.getWorkRepGain();\r\n this.workMoneyGainRate = this.getWorkMoneyGain();\r\n\r\n this.timeNeededToCompleteWork = CONSTANTS.MillisecondsPer8Hours;\r\n\r\n var newCancelButton = clearEventListeners(\"work-in-progress-cancel-button\");\r\n newCancelButton.innerHTML = \"Stop Working\";\r\n newCancelButton.addEventListener(\"click\", function() {\r\n Player.finishWorkPartTime();\r\n return false;\r\n });\r\n\r\n //Display Work In Progress Screen\r\n Engine.loadWorkInProgressContent();\r\n}\r\n\r\nPlayerObject.prototype.workPartTime = function(numCycles) {\r\n this.workRepGainRate = this.getWorkRepGain();\r\n\r\n this.workHackExpGained += this.workHackExpGainRate * numCycles;\r\n this.workStrExpGained += this.workStrExpGainRate * numCycles;\r\n this.workDefExpGained += this.workDefExpGainRate * numCycles;\r\n this.workDexExpGained += this.workDexExpGainRate * numCycles;\r\n this.workAgiExpGained += this.workAgiExpGainRate * numCycles;\r\n this.workChaExpGained += this.workChaExpGainRate * numCycles;\r\n this.workRepGained += this.workRepGainRate * numCycles;\r\n this.workMoneyGained += this.workMoneyGainRate * numCycles;\r\n\r\n var cyclesPerSec = 1000 / Engine._idleSpeed;\r\n\r\n this.timeWorked += Engine._idleSpeed * numCycles;\r\n\r\n //If timeWorked == 8 hours, then finish. You can only gain 8 hours worth of exp and money\r\n if (this.timeWorked >= CONSTANTS.MillisecondsPer8Hours) {\r\n var maxCycles = CONSTANTS.GameCyclesPer8Hours;\r\n this.workHackExpGained = this.workHackExpGainRate * maxCycles;\r\n this.workStrExpGained = this.workStrExpGainRate * maxCycles;\r\n this.workDefExpGained = this.workDefExpGainRate * maxCycles;\r\n this.workDexExpGained = this.workDexExpGainRate * maxCycles;\r\n this.workAgiExpGained = this.workAgiExpGainRate * maxCycles;\r\n this.workChaExpGained = this.workChaExpGainRate * maxCycles;\r\n this.workRepGained = this.workRepGainRate * maxCycles;\r\n this.workMoneyGained = this.workMoneyGainRate * maxCycles;\r\n this.finishWorkPartTime();\r\n return;\r\n }\r\n\r\n var txt = document.getElementById(\"work-in-progress-text\");\r\n txt.innerHTML = \"You are currently working as a \" + this.companyPosition.positionName +\r\n \" at \" + Player.companyName + \"<br><br>\" +\r\n \"You have been working for \" + convertTimeMsToTimeElapsedString(this.timeWorked) + \"<br><br>\" +\r\n \"You have earned: <br><br>\" +\r\n \"$\" + formatNumber(this.workMoneyGained, 2) + \" ($\" + formatNumber(this.workMoneyGainRate * cyclesPerSec, 2) + \" / sec) <br><br>\" +\r\n formatNumber(this.workRepGained, 4) + \" (\" + formatNumber(this.workRepGainRate * cyclesPerSec, 4) + \" / sec) reputation for this company <br><br>\" +\r\n formatNumber(this.workHackExpGained, 4) + \" (\" + formatNumber(this.workHackExpGainRate * cyclesPerSec, 4) + \" / sec) hacking exp <br><br>\" +\r\n formatNumber(this.workStrExpGained, 4) + \" (\" + formatNumber(this.workStrExpGainRate * cyclesPerSec, 4) + \" / sec) strength exp <br>\" +\r\n formatNumber(this.workDefExpGained, 4) + \" (\" + formatNumber(this.workDefExpGainRate * cyclesPerSec, 4) + \" / sec) defense exp <br>\" +\r\n formatNumber(this.workDexExpGained, 4) + \" (\" + formatNumber(this.workDexExpGainRate * cyclesPerSec, 4) + \" / sec) dexterity exp <br>\" +\r\n formatNumber(this.workAgiExpGained, 4) + \" (\" + formatNumber(this.workAgiExpGainRate * cyclesPerSec, 4) + \" / sec) agility exp <br><br> \" +\r\n formatNumber(this.workChaExpGained, 4) + \" (\" + formatNumber(this.workChaExpGainRate * cyclesPerSec, 4) + \" / sec) charisma exp <br><br>\" +\r\n \"You will automatically finish after working for 8 hours. You can cancel earlier if you wish, <br>\" +\r\n \"and there will be no penalty because this is a part-time job.\";\r\n\r\n}\r\n\r\nPlayerObject.prototype.finishWorkPartTime = function(sing=false) {\r\n this.gainWorkExp();\r\n\r\n var company = Companies[this.companyName];\r\n company.playerReputation += (this.workRepGained);\r\n\r\n this.gainMoney(this.workMoneyGained);\r\n\r\n this.updateSkillLevels();\r\n\r\n var txt = \"You earned a total of: <br>\" +\r\n \"$\" + formatNumber(this.workMoneyGained, 2) + \"<br>\" +\r\n formatNumber(this.workRepGained, 4) + \" reputation for the company <br>\" +\r\n formatNumber(this.workHackExpGained, 4) + \" hacking exp <br>\" +\r\n formatNumber(this.workStrExpGained, 4) + \" strength exp <br>\" +\r\n formatNumber(this.workDefExpGained, 4) + \" defense exp <br>\" +\r\n formatNumber(this.workDexExpGained, 4) + \" dexterity exp <br>\" +\r\n formatNumber(this.workAgiExpGained, 4) + \" agility exp <br>\" +\r\n formatNumber(this.workChaExpGained, 4) + \" charisma exp<br>\";\r\n txt = \"You worked for \" + convertTimeMsToTimeElapsedString(this.timeWorked) + \"<br><br> \" + txt;\r\n if (!sing) {dialogBoxCreate(txt);}\r\n\r\n var mainMenu = document.getElementById(\"mainmenu-container\");\r\n mainMenu.style.visibility = \"visible\";\r\n this.isWorking = false;\r\n Engine.loadLocationContent();\r\n if (sing) {\r\n var res = \"You worked for \" + convertTimeMsToTimeElapsedString(this.timeWorked) + \" and \" +\r\n \"earned a total of \" +\r\n \"$\" + formatNumber(this.workMoneyGained, 2) + \", \" +\r\n formatNumber(this.workRepGained, 4) + \" reputation, \" +\r\n formatNumber(this.workHackExpGained, 4) + \" hacking exp, \" +\r\n formatNumber(this.workStrExpGained, 4) + \" strength exp, \" +\r\n formatNumber(this.workDefExpGained, 4) + \" defense exp, \" +\r\n formatNumber(this.workDexExpGained, 4) + \" dexterity exp, \" +\r\n formatNumber(this.workAgiExpGained, 4) + \" agility exp, and \" +\r\n formatNumber(this.workChaExpGained, 4) + \" charisma exp\";\r\n this.resetWorkStatus();\r\n return res;\r\n }\r\n this.resetWorkStatus();\r\n}\r\n\r\n/* Working for Faction */\r\nPlayerObject.prototype.finishFactionWork = function(cancelled, sing=false) {\r\n this.gainWorkExp();\r\n\r\n var faction = Factions[this.currentWorkFactionName];\r\n faction.playerReputation += (this.workRepGained);\r\n\r\n this.gainMoney(this.workMoneyGained);\r\n\r\n this.updateSkillLevels();\r\n\r\n var txt = \"You worked for your faction \" + faction.name + \" for a total of \" + convertTimeMsToTimeElapsedString(this.timeWorked) + \" <br><br> \" +\r\n \"You earned a total of: <br>\" +\r\n \"$\" + formatNumber(this.workMoneyGained, 2) + \"<br>\" +\r\n formatNumber(this.workRepGained, 4) + \" reputation for the faction <br>\" +\r\n formatNumber(this.workHackExpGained, 4) + \" hacking exp <br>\" +\r\n formatNumber(this.workStrExpGained, 4) + \" strength exp <br>\" +\r\n formatNumber(this.workDefExpGained, 4) + \" defense exp <br>\" +\r\n formatNumber(this.workDexExpGained, 4) + \" dexterity exp <br>\" +\r\n formatNumber(this.workAgiExpGained, 4) + \" agility exp <br>\" +\r\n formatNumber(this.workChaExpGained, 4) + \" charisma exp<br>\";\r\n if (!sing) {dialogBoxCreate(txt);}\r\n\r\n var mainMenu = document.getElementById(\"mainmenu-container\");\r\n mainMenu.style.visibility = \"visible\";\r\n\r\n this.isWorking = false;\r\n\r\n Engine.loadFactionContent();\r\n displayFactionContent(faction.name);\r\n if (sing) {\r\n var res=\"You worked for your faction \" + faction.name + \" for a total of \" + convertTimeMsToTimeElapsedString(this.timeWorked) + \". \" +\r\n \"You earned \" +\r\n formatNumber(this.workRepGained, 4) + \" rep, \" +\r\n formatNumber(this.workHackExpGained, 4) + \" hacking exp, \" +\r\n formatNumber(this.workStrExpGained, 4) + \" str exp, \" +\r\n formatNumber(this.workDefExpGained, 4) + \" def exp, \" +\r\n formatNumber(this.workDexExpGained, 4) + \" dex exp, \" +\r\n formatNumber(this.workAgiExpGained, 4) + \" agi exp, and \" +\r\n formatNumber(this.workChaExpGained, 4) + \" cha exp.\";\r\n this.resetWorkStatus();\r\n return res;\r\n }\r\n this.resetWorkStatus();\r\n}\r\n\r\nPlayerObject.prototype.startFactionWork = function(faction) {\r\n //Update reputation gain rate to account for faction favor\r\n var favorMult = 1 + (faction.favor / 100);\r\n if (isNaN(favorMult)) {favorMult = 1;}\r\n this.workRepGainRate *= favorMult;\r\n this.workRepGainRate *= BitNodeMultipliers.FactionWorkRepGain;\r\n\r\n this.isWorking = true;\r\n this.workType = CONSTANTS.WorkTypeFaction;\r\n this.currentWorkFactionName = faction.name;\r\n\r\n this.timeNeededToCompleteWork = CONSTANTS.MillisecondsPer20Hours;\r\n\r\n var cancelButton = clearEventListeners(\"work-in-progress-cancel-button\");\r\n cancelButton.innerHTML = \"Stop Faction Work\";\r\n cancelButton.addEventListener(\"click\", function() {\r\n Player.finishFactionWork(true);\r\n return false;\r\n });\r\n\r\n //Display Work In Progress Screen\r\n Engine.loadWorkInProgressContent();\r\n}\r\n\r\nPlayerObject.prototype.startFactionHackWork = function(faction) {\r\n this.resetWorkStatus();\r\n\r\n this.workHackExpGainRate = .15 * this.hacking_exp_mult * BitNodeMultipliers.FactionWorkExpGain;\r\n this.workRepGainRate = this.workRepGainRate = (this.hacking_skill + this.intelligence) / CONSTANTS.MaxSkillLevel * this.faction_rep_mult;\r\n\r\n this.factionWorkType = CONSTANTS.FactionWorkHacking;\r\n this.currentWorkFactionDescription = \"carrying out hacking contracts\";\r\n\r\n this.startFactionWork(faction);\r\n}\r\n\r\nPlayerObject.prototype.startFactionFieldWork = function(faction) {\r\n this.resetWorkStatus();\r\n\r\n this.workHackExpGainRate = .1 * this.hacking_exp_mult * BitNodeMultipliers.FactionWorkExpGain;\r\n this.workStrExpGainRate = .1 * this.strength_exp_mult * BitNodeMultipliers.FactionWorkExpGain;\r\n this.workDefExpGainRate = .1 * this.defense_exp_mult * BitNodeMultipliers.FactionWorkExpGain;\r\n this.workDexExpGainRate = .1 * this.dexterity_exp_mult * BitNodeMultipliers.FactionWorkExpGain;\r\n this.workAgiExpGainRate = .1 * this.agility_exp_mult * BitNodeMultipliers.FactionWorkExpGain;\r\n this.workChaExpGainRate = .1 * this.charisma_exp_mult * BitNodeMultipliers.FactionWorkExpGain;\r\n this.workRepGainRate = this.getFactionFieldWorkRepGain();\r\n\r\n this.factionWorkType = CONSTANTS.FactionWorkField;\r\n this.currentWorkFactionDescription = \"carrying out field missions\"\r\n\r\n this.startFactionWork(faction);\r\n}\r\n\r\nPlayerObject.prototype.startFactionSecurityWork = function(faction) {\r\n this.resetWorkStatus();\r\n\r\n this.workHackExpGainRate = 0.05 * this.hacking_exp_mult * BitNodeMultipliers.FactionWorkExpGain;\r\n this.workStrExpGainRate = 0.15 * this.strength_exp_mult * BitNodeMultipliers.FactionWorkExpGain;\r\n this.workDefExpGainRate = 0.15 * this.defense_exp_mult * BitNodeMultipliers.FactionWorkExpGain;\r\n this.workDexExpGainRate = 0.15 * this.dexterity_exp_mult * BitNodeMultipliers.FactionWorkExpGain;\r\n this.workAgiExpGainRate = 0.15 * this.agility_exp_mult * BitNodeMultipliers.FactionWorkExpGain;\r\n this.workChaExpGainRate = 0.00 * this.charisma_exp_mult * BitNodeMultipliers.FactionWorkExpGain;\r\n this.workRepGainRate = this.getFactionSecurityWorkRepGain();\r\n\r\n this.factionWorkType = CONSTANTS.FactionWorkSecurity;\r\n this.currentWorkFactionDescription = \"performing security detail\"\r\n\r\n this.startFactionWork(faction);\r\n}\r\n\r\nPlayerObject.prototype.workForFaction = function(numCycles) {\r\n var faction = Factions[this.currentWorkFactionName];\r\n\r\n //Constantly update the rep gain rate\r\n switch (this.factionWorkType) {\r\n case CONSTANTS.FactionWorkHacking:\r\n this.workRepGainRate = (this.hacking_skill + this.intelligence) / CONSTANTS.MaxSkillLevel * this.faction_rep_mult;\r\n break;\r\n case CONSTANTS.FactionWorkField:\r\n this.workRepGainRate = this.getFactionFieldWorkRepGain();\r\n break;\r\n case CONSTANTS.FactionWorkSecurity:\r\n this.workRepGainRate = this.getFactionSecurityWorkRepGain();\r\n break;\r\n default:\r\n break;\r\n }\r\n\r\n //Update reputation gain rate to account for faction favor\r\n var favorMult = 1 + (faction.favor / 100);\r\n if (isNaN(favorMult)) {favorMult = 1;}\r\n this.workRepGainRate *= favorMult;\r\n this.workRepGainRate *= BitNodeMultipliers.FactionWorkRepGain;\r\n\r\n this.workHackExpGained += this.workHackExpGainRate * numCycles;\r\n this.workStrExpGained += this.workStrExpGainRate * numCycles;\r\n this.workDefExpGained += this.workDefExpGainRate * numCycles;\r\n this.workDexExpGained += this.workDexExpGainRate * numCycles;\r\n this.workAgiExpGained += this.workAgiExpGainRate * numCycles;\r\n this.workChaExpGained += this.workChaExpGainRate * numCycles;\r\n this.workRepGained += this.workRepGainRate * numCycles;\r\n this.workMoneyGained += this.workMoneyGainRate * numCycles;\r\n\r\n var cyclesPerSec = 1000 / Engine._idleSpeed;\r\n\r\n this.timeWorked += Engine._idleSpeed * numCycles;\r\n\r\n //If timeWorked == 20 hours, then finish. You can only work for the faction for 20 hours\r\n if (this.timeWorked >= CONSTANTS.MillisecondsPer20Hours) {\r\n var maxCycles = CONSTANTS.GameCyclesPer20Hours;\r\n this.timeWorked = CONSTANTS.MillisecondsPer20Hours;\r\n this.workHackExpGained = this.workHackExpGainRate * maxCycles;\r\n this.workStrExpGained = this.workStrExpGainRate * maxCycles;\r\n this.workDefExpGained = this.workDefExpGainRate * maxCycles;\r\n this.workDexExpGained = this.workDexExpGainRate * maxCycles;\r\n this.workAgiExpGained = this.workAgiExpGainRate * maxCycles;\r\n this.workChaExpGained = this.workChaExpGainRate * maxCycles;\r\n this.workRepGained = this.workRepGainRate * maxCycles;\r\n this.workMoneyGained = this.workMoneyGainRate * maxCycles;\r\n this.finishFactionWork(false);\r\n }\r\n\r\n var txt = document.getElementById(\"work-in-progress-text\");\r\n txt.innerHTML = \"You are currently \" + this.currentWorkFactionDescription + \" for your faction \" + faction.name +\r\n \" (Current Faction Reputation: \" + formatNumber(faction.playerReputation, 0) + \"). \" +\r\n \"You have been doing this for \" + convertTimeMsToTimeElapsedString(this.timeWorked) + \"<br><br>\" +\r\n \"You have earned: <br><br>\" +\r\n \"$\" + formatNumber(this.workMoneyGained, 2) + \" (\" + formatNumber(this.workMoneyGainRate * cyclesPerSec, 2) + \" / sec) <br><br>\" +\r\n formatNumber(this.workRepGained, 4) + \" (\" + formatNumber(this.workRepGainRate * cyclesPerSec, 4) + \" / sec) reputation for this faction <br><br>\" +\r\n formatNumber(this.workHackExpGained, 4) + \" (\" + formatNumber(this.workHackExpGainRate * cyclesPerSec, 4) + \" / sec) hacking exp <br><br>\" +\r\n formatNumber(this.workStrExpGained, 4) + \" (\" + formatNumber(this.workStrExpGainRate * cyclesPerSec, 4) + \" / sec) strength exp <br>\" +\r\n formatNumber(this.workDefExpGained, 4) + \" (\" + formatNumber(this.workDefExpGainRate * cyclesPerSec, 4) + \" / sec) defense exp <br>\" +\r\n formatNumber(this.workDexExpGained, 4) + \" (\" + formatNumber(this.workDexExpGainRate * cyclesPerSec, 4) + \" / sec) dexterity exp <br>\" +\r\n formatNumber(this.workAgiExpGained, 4) + \" (\" + formatNumber(this.workAgiExpGainRate * cyclesPerSec, 4) + \" / sec) agility exp <br><br> \" +\r\n formatNumber(this.workChaExpGained, 4) + \" (\" + formatNumber(this.workChaExpGainRate * cyclesPerSec, 4) + \" / sec) charisma exp <br><br>\" +\r\n\r\n \"You will automatically finish after working for 20 hours. You can cancel earlier if you wish.<br>\" +\r\n \"There is no penalty for cancelling earlier.\";\r\n}\r\n\r\n\r\n//Money gained per game cycle\r\nPlayerObject.prototype.getWorkMoneyGain = function() {\r\n var bn11Mult = 1;\r\n var company = Companies[this.companyName];\r\n if (hasBn11SF) {\r\n bn11Mult = 1 + (company.favor / 100);\r\n }\r\n return this.companyPosition.baseSalary * company.salaryMultiplier *\r\n this.work_money_mult * BitNodeMultipliers.CompanyWorkMoney * bn11Mult;\r\n}\r\n\r\n//Hack exp gained per game cycle\r\nPlayerObject.prototype.getWorkHackExpGain = function() {\r\n var company = Companies[this.companyName];\r\n return this.companyPosition.hackingExpGain * company.expMultiplier *\r\n this.hacking_exp_mult * BitNodeMultipliers.CompanyWorkExpGain;\r\n}\r\n\r\n//Str exp gained per game cycle\r\nPlayerObject.prototype.getWorkStrExpGain = function() {\r\n var company = Companies[this.companyName];\r\n return this.companyPosition.strengthExpGain * company.expMultiplier *\r\n this.strength_exp_mult * BitNodeMultipliers.CompanyWorkExpGain;\r\n}\r\n\r\n//Def exp gained per game cycle\r\nPlayerObject.prototype.getWorkDefExpGain = function() {\r\n var company = Companies[this.companyName];\r\n return this.companyPosition.defenseExpGain * company.expMultiplier *\r\n this.defense_exp_mult * BitNodeMultipliers.CompanyWorkExpGain;\r\n}\r\n\r\n//Dex exp gained per game cycle\r\nPlayerObject.prototype.getWorkDexExpGain = function() {\r\n var company = Companies[this.companyName];\r\n return this.companyPosition.dexterityExpGain * company.expMultiplier *\r\n this.dexterity_exp_mult * BitNodeMultipliers.CompanyWorkExpGain;\r\n}\r\n\r\n//Agi exp gained per game cycle\r\nPlayerObject.prototype.getWorkAgiExpGain = function() {\r\n var company = Companies[this.companyName];\r\n return this.companyPosition.agilityExpGain * company.expMultiplier *\r\n this.agility_exp_mult * BitNodeMultipliers.CompanyWorkExpGain;\r\n}\r\n\r\n//Charisma exp gained per game cycle\r\nPlayerObject.prototype.getWorkChaExpGain = function() {\r\n var company = Companies[this.companyName];\r\n return this.companyPosition.charismaExpGain * company.expMultiplier *\r\n this.charisma_exp_mult * BitNodeMultipliers.CompanyWorkExpGain;\r\n}\r\n\r\n//Reputation gained per game cycle\r\nPlayerObject.prototype.getWorkRepGain = function() {\r\n var company = Companies[this.companyName];\r\n var jobPerformance = this.companyPosition.calculateJobPerformance(this.hacking_skill, this.strength,\r\n this.defense, this.dexterity,\r\n this.agility, this.charisma);\r\n\r\n //Intelligence provides a flat bonus to job performance\r\n jobPerformance += (this.intelligence / CONSTANTS.MaxSkillLevel);\r\n\r\n //Update reputation gain rate to account for company favor\r\n var favorMult = 1 + (company.favor / 100);\r\n if (isNaN(favorMult)) {favorMult = 1;}\r\n return jobPerformance * this.company_rep_mult * favorMult;\r\n}\r\n\r\nPlayerObject.prototype.getFactionSecurityWorkRepGain = function() {\r\n var t = 0.9 * (this.hacking_skill / CONSTANTS.MaxSkillLevel +\r\n this.strength / CONSTANTS.MaxSkillLevel +\r\n this.defense / CONSTANTS.MaxSkillLevel +\r\n this.dexterity / CONSTANTS.MaxSkillLevel +\r\n this.agility / CONSTANTS.MaxSkillLevel) / 4.5;\r\n return t * this.faction_rep_mult;\r\n}\r\n\r\nPlayerObject.prototype.getFactionFieldWorkRepGain = function() {\r\n var t = 0.9 * (this.hacking_skill / CONSTANTS.MaxSkillLevel +\r\n this.strength / CONSTANTS.MaxSkillLevel +\r\n this.defense / CONSTANTS.MaxSkillLevel +\r\n this.dexterity / CONSTANTS.MaxSkillLevel +\r\n this.agility / CONSTANTS.MaxSkillLevel +\r\n this.charisma / CONSTANTS.MaxSkillLevel +\r\n this.intelligence / CONSTANTS.MaxSkillLevel) / 5.5;\r\n return t * this.faction_rep_mult;\r\n}\r\n\r\n/* Creating a Program */\r\nPlayerObject.prototype.startCreateProgramWork = function(programName, time, reqLevel) {\r\n this.resetWorkStatus();\r\n this.isWorking = true;\r\n this.workType = CONSTANTS.WorkTypeCreateProgram;\r\n\r\n //Time needed to complete work affected by hacking skill (linearly based on\r\n //ratio of (your skill - required level) to MAX skill)\r\n //var timeMultiplier = (CONSTANTS.MaxSkillLevel - (this.hacking_skill - reqLevel)) / CONSTANTS.MaxSkillLevel;\r\n //if (timeMultiplier > 1) {timeMultiplier = 1;}\r\n //if (timeMultiplier < 0.01) {timeMultiplier = 0.01;}\r\n this.createProgramReqLvl = reqLevel;\r\n\r\n this.timeNeededToCompleteWork = time;\r\n //Check for incomplete program\r\n for (var i = 0; i < this.getHomeComputer().programs.length; ++i) {\r\n var programFile = this.getHomeComputer().programs[i];\r\n if (programFile.startsWith(programName) && programFile.endsWith(\"%-INC\")) {\r\n var res = programFile.split(\"-\");\r\n if (res.length != 3) {break;}\r\n var percComplete = Number(res[1].slice(0, -1));\r\n if (isNaN(percComplete) || percComplete < 0 || percComplete >= 100) {break;}\r\n this.timeWorkedCreateProgram = percComplete / 100 * this.timeNeededToCompleteWork;\r\n this.getHomeComputer().programs.splice(i, 1);\r\n }\r\n }\r\n\r\n this.createProgramName = programName;\r\n\r\n var cancelButton = clearEventListeners(\"work-in-progress-cancel-button\");\r\n cancelButton.innerHTML = \"Cancel work on creating program\";\r\n cancelButton.addEventListener(\"click\", function() {\r\n Player.finishCreateProgramWork(true);\r\n return false;\r\n });\r\n\r\n //Display Work In Progress Screen\r\n Engine.loadWorkInProgressContent();\r\n}\r\n\r\nPlayerObject.prototype.createProgramWork = function(numCycles) {\r\n //Higher hacking skill will allow you to create programs faster\r\n var reqLvl = this.createProgramReqLvl;\r\n var skillMult = (this.hacking_skill / reqLvl); //This should always be greater than 1;\r\n skillMult = 1 + ((skillMult - 1) / 5); //The divider constant can be adjusted as necessary\r\n\r\n //Skill multiplier directly applied to \"time worked\"\r\n this.timeWorked += (Engine._idleSpeed * numCycles);\r\n this.timeWorkedCreateProgram += (Engine._idleSpeed * numCycles * skillMult);\r\n var programName = this.createProgramName;\r\n\r\n if (this.timeWorkedCreateProgram >= this.timeNeededToCompleteWork) {\r\n this.finishCreateProgramWork(false);\r\n }\r\n\r\n var txt = document.getElementById(\"work-in-progress-text\");\r\n txt.innerHTML = \"You are currently working on coding \" + programName + \".<br><br> \" +\r\n \"You have been working for \" + convertTimeMsToTimeElapsedString(this.timeWorked) + \"<br><br>\" +\r\n \"The program is \" + (this.timeWorkedCreateProgram / this.timeNeededToCompleteWork * 100).toFixed(2) + \"% complete. <br>\" +\r\n \"If you cancel, your work will be saved and you can come back to complete the program later.\";\r\n}\r\n\r\nPlayerObject.prototype.finishCreateProgramWork = function(cancelled, sing=false) {\r\n var programName = this.createProgramName;\r\n if (cancelled === false) {\r\n dialogBoxCreate(\"You've finished creating \" + programName + \"!<br>\" +\r\n \"The new program can be found on your home computer.\");\r\n\r\n this.getHomeComputer().programs.push(programName);\r\n } else {\r\n var perc = (Math.floor(this.timeWorkedCreateProgram / this.timeNeededToCompleteWork * 10000)/100).toString();\r\n var incompleteName = programName + \"-\" + perc + \"%-INC\";\r\n this.getHomeComputer().programs.push(incompleteName);\r\n }\r\n\r\n if (!cancelled) {\r\n this.gainIntelligenceExp(this.createProgramReqLvl / CONSTANTS.IntelligenceProgramBaseExpGain);\r\n }\r\n\r\n var mainMenu = document.getElementById(\"mainmenu-container\");\r\n mainMenu.style.visibility = \"visible\";\r\n\r\n this.isWorking = false;\r\n\r\n Engine.loadTerminalContent();\r\n this.resetWorkStatus();\r\n}\r\n\r\n/* Studying/Taking Classes */\r\nPlayerObject.prototype.startClass = function(costMult, expMult, className) {\r\n this.resetWorkStatus();\r\n this.isWorking = true;\r\n this.workType = CONSTANTS.WorkTypeStudyClass;\r\n\r\n this.className = className;\r\n\r\n var gameCPS = 1000 / Engine._idleSpeed;\r\n\r\n //Base exp gains per second\r\n var baseStudyComputerScienceExp = 0.5;\r\n var baseDataStructuresExp = 1;\r\n var baseNetworksExp = 2;\r\n var baseAlgorithmsExp = 4;\r\n var baseManagementExp = 2;\r\n var baseLeadershipExp = 4;\r\n var baseGymExp = 1;\r\n\r\n //Find cost and exp gain per game cycle\r\n var cost = 0;\r\n var hackExp = 0, strExp = 0, defExp = 0, dexExp = 0, agiExp = 0, chaExp = 0;\r\n switch (className) {\r\n case CONSTANTS.ClassStudyComputerScience:\r\n hackExp = baseStudyComputerScienceExp * expMult / gameCPS;\r\n break;\r\n case CONSTANTS.ClassDataStructures:\r\n cost = CONSTANTS.ClassDataStructuresBaseCost * costMult / gameCPS;\r\n hackExp = baseDataStructuresExp * expMult / gameCPS;\r\n break;\r\n case CONSTANTS.ClassNetworks:\r\n cost = CONSTANTS.ClassNetworksBaseCost * costMult / gameCPS;\r\n hackExp = baseNetworksExp * expMult / gameCPS;\r\n break;\r\n case CONSTANTS.ClassAlgorithms:\r\n cost = CONSTANTS.ClassAlgorithmsBaseCost * costMult / gameCPS;\r\n hackExp = baseAlgorithmsExp * expMult / gameCPS;\r\n break;\r\n case CONSTANTS.ClassManagement:\r\n cost = CONSTANTS.ClassManagementBaseCost * costMult / gameCPS;\r\n chaExp = baseManagementExp * expMult / gameCPS;\r\n break;\r\n case CONSTANTS.ClassLeadership:\r\n cost = CONSTANTS.ClassLeadershipBaseCost * costMult / gameCPS;\r\n chaExp = baseLeadershipExp * expMult / gameCPS;\r\n break;\r\n case CONSTANTS.ClassGymStrength:\r\n cost = CONSTANTS.ClassGymBaseCost * costMult / gameCPS;\r\n strExp = baseGymExp * expMult / gameCPS;\r\n break;\r\n case CONSTANTS.ClassGymDefense:\r\n cost = CONSTANTS.ClassGymBaseCost * costMult / gameCPS;\r\n defExp = baseGymExp * expMult / gameCPS;\r\n break;\r\n case CONSTANTS.ClassGymDexterity:\r\n cost = CONSTANTS.ClassGymBaseCost * costMult / gameCPS;\r\n dexExp = baseGymExp * expMult / gameCPS;\r\n break;\r\n case CONSTANTS.ClassGymAgility:\r\n cost = CONSTANTS.ClassGymBaseCost * costMult / gameCPS;\r\n agiExp = baseGymExp * expMult / gameCPS;\r\n break;\r\n default:\r\n throw new Error(\"ERR: Invalid/unrecognized class name\");\r\n return;\r\n }\r\n\r\n this.workMoneyLossRate = cost;\r\n this.workHackExpGainRate = hackExp * this.hacking_exp_mult * BitNodeMultipliers.ClassGymExpGain;\r\n this.workStrExpGainRate = strExp * this.strength_exp_mult * BitNodeMultipliers.ClassGymExpGain;;\r\n this.workDefExpGainRate = defExp * this.defense_exp_mult * BitNodeMultipliers.ClassGymExpGain;;\r\n this.workDexExpGainRate = dexExp * this.dexterity_exp_mult * BitNodeMultipliers.ClassGymExpGain;;\r\n this.workAgiExpGainRate = agiExp * this.agility_exp_mult * BitNodeMultipliers.ClassGymExpGain;;\r\n this.workChaExpGainRate = chaExp * this.charisma_exp_mult * BitNodeMultipliers.ClassGymExpGain;;\r\n\r\n var cancelButton = clearEventListeners(\"work-in-progress-cancel-button\");\r\n if (className == CONSTANTS.ClassGymStrength ||\r\n className == CONSTANTS.ClassGymDefense ||\r\n className == CONSTANTS.ClassGymDexterity ||\r\n className == CONSTANTS.ClassGymAgility) {\r\n cancelButton.innerHTML = \"Stop training at gym\";\r\n } else {\r\n cancelButton.innerHTML = \"Stop taking course\";\r\n }\r\n cancelButton.addEventListener(\"click\", function() {\r\n Player.finishClass();\r\n return false;\r\n });\r\n\r\n //Display Work In Progress Screen\r\n Engine.loadWorkInProgressContent();\r\n}\r\n\r\nPlayerObject.prototype.takeClass = function(numCycles) {\r\n this.timeWorked += Engine._idleSpeed * numCycles;\r\n var className = this.className;\r\n\r\n this.workHackExpGained += this.workHackExpGainRate * numCycles;\r\n this.workStrExpGained += this.workStrExpGainRate * numCycles;\r\n this.workDefExpGained += this.workDefExpGainRate * numCycles;\r\n this.workDexExpGained += this.workDexExpGainRate * numCycles;\r\n this.workAgiExpGained += this.workAgiExpGainRate * numCycles;\r\n this.workChaExpGained += this.workChaExpGainRate * numCycles;\r\n this.workRepGained += this.workRepGainRate * numCycles;\r\n this.workMoneyGained += this.workMoneyGainRate * numCycles;\r\n this.workMoneyGained -= this.workMoneyLossRate * numCycles;\r\n\r\n var cyclesPerSec = 1000 / Engine._idleSpeed;\r\n\r\n var txt = document.getElementById(\"work-in-progress-text\");\r\n txt.innerHTML = \"You have been \" + className + \" for \" + convertTimeMsToTimeElapsedString(this.timeWorked) + \"<br><br>\" +\r\n \"This has cost you: <br>\" +\r\n \"$\" + formatNumber(this.workMoneyGained, 2) + \" ($\" + formatNumber(this.workMoneyLossRate * cyclesPerSec, 2) + \" / sec) <br><br>\" +\r\n \"You have gained: <br>\" +\r\n formatNumber(this.workHackExpGained, 4) + \" (\" + formatNumber(this.workHackExpGainRate * cyclesPerSec, 4) + \" / sec) hacking exp <br>\" +\r\n formatNumber(this.workStrExpGained, 4) + \" (\" + formatNumber(this.workStrExpGainRate * cyclesPerSec, 4) + \" / sec) strength exp <br>\" +\r\n formatNumber(this.workDefExpGained, 4) + \" (\" + formatNumber(this.workDefExpGainRate * cyclesPerSec, 4) + \" / sec) defense exp <br>\" +\r\n formatNumber(this.workDexExpGained, 4) + \" (\" + formatNumber(this.workDexExpGainRate * cyclesPerSec, 4) + \" / sec) dexterity exp <br>\" +\r\n formatNumber(this.workAgiExpGained, 4) + \" (\" + formatNumber(this.workAgiExpGainRate * cyclesPerSec, 4) + \" / sec) agility exp <br>\" +\r\n formatNumber(this.workChaExpGained, 4) + \" (\" + formatNumber(this.workChaExpGainRate * cyclesPerSec, 4) + \" / sec) charisma exp <br>\" +\r\n \"You may cancel at any time\";\r\n}\r\n\r\n//The 'sing' argument defines whether or not this function was called\r\n//through a Singularity Netscript function\r\nPlayerObject.prototype.finishClass = function(sing=false) {\r\n this.gainWorkExp();\r\n this.gainIntelligenceExp(CONSTANTS.IntelligenceClassBaseExpGain * Math.round(this.timeWorked / 1000));\r\n\r\n if (this.workMoneyGained > 0) {\r\n throw new Error(\"ERR: Somehow gained money while taking class\");\r\n }\r\n this.loseMoney(this.workMoneyGained * -1);\r\n\r\n this.updateSkillLevels();\r\n var txt = \"After \" + this.className + \" for \" + convertTimeMsToTimeElapsedString(this.timeWorked) + \", <br>\" +\r\n \"you spent a total of $\" + formatNumber(this.workMoneyGained * -1, 2) + \". <br><br>\" +\r\n \"You earned a total of: <br>\" +\r\n formatNumber(this.workHackExpGained, 4) + \" hacking exp <br>\" +\r\n formatNumber(this.workStrExpGained, 4) + \" strength exp <br>\" +\r\n formatNumber(this.workDefExpGained, 4) + \" defense exp <br>\" +\r\n formatNumber(this.workDexExpGained, 4) + \" dexterity exp <br>\" +\r\n formatNumber(this.workAgiExpGained, 4) + \" agility exp <br>\" +\r\n formatNumber(this.workChaExpGained, 4) + \" charisma exp<br>\";\r\n if (!sing) {dialogBoxCreate(txt);}\r\n\r\n var mainMenu = document.getElementById(\"mainmenu-container\");\r\n mainMenu.style.visibility = \"visible\";\r\n\r\n this.isWorking = false;\r\n\r\n Engine.loadLocationContent();\r\n if (sing) {\r\n var res=\"After \" + this.className + \" for \" + convertTimeMsToTimeElapsedString(this.timeWorked) + \", \" +\r\n \"you spent a total of $\" + formatNumber(this.workMoneyGained * -1, 2) + \". \" +\r\n \"You earned a total of: \" +\r\n formatNumber(this.workHackExpGained, 3) + \" hacking exp, \" +\r\n formatNumber(this.workStrExpGained, 3) + \" strength exp, \" +\r\n formatNumber(this.workDefExpGained, 3) + \" defense exp, \" +\r\n formatNumber(this.workDexExpGained, 3) + \" dexterity exp, \" +\r\n formatNumber(this.workAgiExpGained, 3) + \" agility exp, and \" +\r\n formatNumber(this.workChaExpGained, 3) + \" charisma exp\";\r\n this.resetWorkStatus();\r\n return res;\r\n }\r\n this.resetWorkStatus();\r\n}\r\n\r\n//The EXP and $ gains are hardcoded. Time is in ms\r\nPlayerObject.prototype.startCrime = function(hackExp, strExp, defExp, dexExp, agiExp, chaExp, money, time, singParams=null) {\r\n this.resetWorkStatus();\r\n this.isWorking = true;\r\n this.workType = CONSTANTS.WorkTypeCrime;\r\n\r\n if (singParams && singParams.workerscript) {\r\n this.committingCrimeThruSingFn = true;\r\n this.singFnCrimeWorkerScript = singParams.workerscript;\r\n }\r\n\r\n this.workHackExpGained = hackExp * this.hacking_exp_mult * BitNodeMultipliers.CrimeExpGain;\r\n this.workStrExpGained = strExp * this.strength_exp_mult * BitNodeMultipliers.CrimeExpGain;\r\n this.workDefExpGained = defExp * this.defense_exp_mult * BitNodeMultipliers.CrimeExpGain;\r\n this.workDexExpGained = dexExp * this.dexterity_exp_mult * BitNodeMultipliers.CrimeExpGain;\r\n this.workAgiExpGained = agiExp * this.agility_exp_mult * BitNodeMultipliers.CrimeExpGain;\r\n this.workChaExpGained = chaExp * this.charisma_exp_mult * BitNodeMultipliers.CrimeExpGain;\r\n this.workMoneyGained = money * this.crime_money_mult * BitNodeMultipliers.CrimeMoney;\r\n\r\n this.timeNeededToCompleteWork = time;\r\n\r\n //Remove all old event listeners from Cancel button\r\n var newCancelButton = clearEventListeners(\"work-in-progress-cancel-button\")\r\n newCancelButton.innerHTML = \"Cancel crime\"\r\n newCancelButton.addEventListener(\"click\", function() {\r\n Player.finishCrime(true);\r\n return false;\r\n });\r\n\r\n //Display Work In Progress Screen\r\n Engine.loadWorkInProgressContent();\r\n}\r\n\r\nPlayerObject.prototype.commitCrime = function (numCycles) {\r\n this.timeWorked += Engine._idleSpeed * numCycles;\r\n\r\n if (this.timeWorked >= this.timeNeededToCompleteWork) {this.finishCrime(false); return;}\r\n\r\n var percent = Math.round(this.timeWorked / this.timeNeededToCompleteWork * 100);\r\n var numBars = Math.round(percent / 5);\r\n if (numBars < 0) {numBars = 0;}\r\n if (numBars > 20) {numBars = 20;}\r\n var progressBar = \"[\" + Array(numBars+1).join(\"|\") + Array(20 - numBars + 1).join(\" \") + \"]\";\r\n\r\n var txt = document.getElementById(\"work-in-progress-text\");\r\n txt.innerHTML = \"You are attempting to \" + this.crimeType + \".<br>\" +\r\n \"Time remaining: \" + convertTimeMsToTimeElapsedString(this.timeNeededToCompleteWork - this.timeWorked) + \"<br>\" +\r\n progressBar.replace( / /g, \"&nbsp;\" );\r\n}\r\n\r\nPlayerObject.prototype.finishCrime = function(cancelled) {\r\n //Determine crime success/failure\r\n if (!cancelled) {\r\n var statusText = \"\"; //TODO, unique message for each crime when you succeed\r\n if (determineCrimeSuccess(this.crimeType, this.workMoneyGained)) {\r\n //Handle Karma and crime statistics\r\n let crime = null;\r\n for(const i in Crimes) {\r\n if(Crimes[i].type == this.crimeType) {\r\n crime = Crimes[i];\r\n break;\r\n }\r\n }\r\n if(crime == null) {\r\n console.log(this.crimeType);\r\n dialogBoxCreate(\"ERR: Unrecognized crime type. This is probably a bug please contact the developer\");\r\n }\r\n this.karma -= crime.karma;\r\n this.numPeopleKilled += crime.kills;\r\n if(crime.intelligence_exp > 0) {\r\n this.gainIntelligenceExp(crime.intelligence_exp);\r\n }\r\n\r\n //On a crime success, gain 2x exp\r\n this.workHackExpGained *= 2;\r\n this.workStrExpGained *= 2;\r\n this.workDefExpGained *= 2;\r\n this.workDexExpGained *= 2;\r\n this.workAgiExpGained *= 2;\r\n this.workChaExpGained *= 2;\r\n if (this.committingCrimeThruSingFn) {\r\n if(this.singFnCrimeWorkerScript.disableLogs.ALL == null && this.singFnCrimeWorkerScript.disableLogs.commitCrime == null) {\r\n this.singFnCrimeWorkerScript.scriptRef.log(\"Crime successful! Gained \" +\r\n numeral(this.workMoneyGained).format(\"$0.000a\") + \", \" +\r\n formatNumber(this.workHackExpGained, 3) + \" hack exp, \" +\r\n formatNumber(this.workStrExpGained, 3) + \" str exp, \" +\r\n formatNumber(this.workDefExpGained, 3) + \" def exp, \" +\r\n formatNumber(this.workDexExpGained, 3) + \" dex exp, \" +\r\n formatNumber(this.workAgiExpGained, 3) + \" agi exp, \" +\r\n formatNumber(this.workChaExpGained, 3) + \" cha exp.\");\r\n }\r\n } else {\r\n dialogBoxCreate(\"Crime successful! <br><br>\" +\r\n \"You gained:<br>\"+\r\n \"$\" + formatNumber(this.workMoneyGained, 2) + \"<br>\" +\r\n formatNumber(this.workHackExpGained, 4) + \" hacking experience <br>\" +\r\n formatNumber(this.workStrExpGained, 4) + \" strength experience<br>\" +\r\n formatNumber(this.workDefExpGained, 4) + \" defense experience<br>\" +\r\n formatNumber(this.workDexExpGained, 4) + \" dexterity experience<br>\" +\r\n formatNumber(this.workAgiExpGained, 4) + \" agility experience<br>\" +\r\n formatNumber(this.workChaExpGained, 4) + \" charisma experience\");\r\n }\r\n\r\n } else {\r\n //Exp halved on failure\r\n this.workHackExpGained /= 2;\r\n this.workStrExpGained /= 2;\r\n this.workDefExpGained /= 2;\r\n this.workDexExpGained /= 2;\r\n this.workAgiExpGained /= 2;\r\n this.workChaExpGained /= 2;\r\n if (this.committingCrimeThruSingFn) {\r\n if(this.singFnCrimeWorkerScript.disableLogs.ALL == null && this.singFnCrimeWorkerScript.disableLogs.commitCrime == null) {\r\n this.singFnCrimeWorkerScript.scriptRef.log(\"Crime failed! Gained \" +\r\n formatNumber(this.workHackExpGained, 3) + \" hack exp, \" +\r\n formatNumber(this.workStrExpGained, 3) + \" str exp, \" +\r\n formatNumber(this.workDefExpGained, 3) + \" def exp, \" +\r\n formatNumber(this.workDexExpGained, 3) + \" dex exp, \" +\r\n formatNumber(this.workAgiExpGained, 3) + \" agi exp, \" +\r\n formatNumber(this.workChaExpGained, 3) + \" cha exp.\");\r\n }\r\n } else {\r\n dialogBoxCreate(\"Crime failed! <br><br>\" +\r\n \"You gained:<br>\"+\r\n formatNumber(this.workHackExpGained, 4) + \" hacking experience <br>\" +\r\n formatNumber(this.workStrExpGained, 4) + \" strength experience<br>\" +\r\n formatNumber(this.workDefExpGained, 4) + \" defense experience<br>\" +\r\n formatNumber(this.workDexExpGained, 4) + \" dexterity experience<br>\" +\r\n formatNumber(this.workAgiExpGained, 4) + \" agility experience<br>\" +\r\n formatNumber(this.workChaExpGained, 4) + \" charisma experience\");\r\n }\r\n }\r\n\r\n this.gainWorkExp();\r\n }\r\n this.committingCrimeThruSingFn = false;\r\n this.singFnCrimeWorkerScript = null;\r\n var mainMenu = document.getElementById(\"mainmenu-container\");\r\n mainMenu.style.visibility = \"visible\";\r\n this.isWorking = false;\r\n this.resetWorkStatus();\r\n Engine.loadLocationContent();\r\n}\r\n\r\n//Cancels the player's current \"work\" assignment and gives the proper rewards\r\n//Used only for Singularity functions, so no popups are created\r\nPlayerObject.prototype.singularityStopWork = function() {\r\n if (!this.isWorking) {return \"\";}\r\n var res; //Earnings text for work\r\n switch (this.workType) {\r\n case CONSTANTS.WorkTypeStudyClass:\r\n res = this.finishClass(true);\r\n break;\r\n case CONSTANTS.WorkTypeCompany:\r\n res = this.finishWork(true, true);\r\n break;\r\n case CONSTANTS.WorkTypeCompanyPartTime:\r\n res = this.finishWorkPartTime(true);\r\n break;\r\n case CONSTANTS.WorkTypeFaction:\r\n res = this.finishFactionWork(true, true);\r\n break;\r\n case CONSTANTS.WorkTypeCreateProgram:\r\n res = this.finishCreateProgramWork(true, true);\r\n break;\r\n case CONSTANTS.WorkTypeCrime:\r\n res = this.finishCrime(true);\r\n break;\r\n default:\r\n console.log(\"ERROR: Unrecognized work type\");\r\n return \"\";\r\n }\r\n return res;\r\n}\r\n\r\n\r\n//Returns true if hospitalized, false otherwise\r\nPlayerObject.prototype.takeDamage = function(amt) {\r\n this.hp -= amt;\r\n if (this.hp <= 0) {\r\n this.hospitalize();\r\n return true;\r\n } else {\r\n return false;\r\n }\r\n}\r\n\r\nPlayerObject.prototype.hospitalize = function() {\r\n dialogBoxCreate(\"You were in critical condition! You were taken to the hospital where \" +\r\n \"luckily they were able to save your life. You were charged $\" +\r\n formatNumber(this.max_hp * CONSTANTS.HospitalCostPerHp, 2));\r\n this.loseMoney(this.max_hp * CONSTANTS.HospitalCostPerHp);\r\n this.hp = this.max_hp;\r\n}\r\n\r\n/********* Company job application **********/\r\n//Determines the job that the Player should get (if any) at the current company\r\n//The 'sing' argument designates whether or not this is being called from\r\n//the applyToCompany() Netscript Singularity function\r\nPlayerObject.prototype.applyForJob = function(entryPosType, sing=false) {\r\n var currCompany = \"\";\r\n if (this.companyName != \"\") {\r\n currCompany = Companies[this.companyName];\r\n }\r\n var currPositionName = \"\";\r\n if (this.companyPosition != \"\") {\r\n currPositionName = this.companyPosition.positionName;\r\n }\r\n\tvar company = Companies[this.location]; //Company being applied to\r\n if (sing && !(company instanceof Company)) {\r\n return \"ERROR: Invalid company name: \" + this.location + \". applyToCompany() failed\";\r\n }\r\n\r\n var pos = entryPosType;\r\n\r\n if (!this.isQualified(company, pos)) {\r\n var reqText = getJobRequirementText(company, pos);\r\n if (sing) {return false;}\r\n dialogBoxCreate(\"Unforunately, you do not qualify for this position<br>\" + reqText);\r\n return;\r\n }\r\n\r\n while (true) {\r\n if (Engine.Debug) {console.log(\"Determining qualification for next Company Position\");}\r\n var newPos = getNextCompanyPosition(pos);\r\n if (newPos == null) {break;}\r\n\r\n //Check if this company has this position\r\n if (company.hasPosition(newPos)) {\r\n if (!this.isQualified(company, newPos)) {\r\n //If player not qualified for next job, break loop so player will be given current job\r\n break;\r\n }\r\n pos = newPos;\r\n } else {\r\n break;\r\n }\r\n }\r\n\r\n //Check if the determined job is the same as the player's current job\r\n if (currCompany != \"\") {\r\n if (currCompany.companyName == company.companyName &&\r\n pos.positionName == currPositionName) {\r\n var nextPos = getNextCompanyPosition(pos);\r\n if (nextPos == null) {\r\n if (sing) {return false;}\r\n dialogBoxCreate(\"You are already at the highest position for your field! No promotion available\");\r\n } else if (company.hasPosition(nextPos)) {\r\n if (sing) {return false;}\r\n var reqText = getJobRequirementText(company, nextPos);\r\n dialogBoxCreate(\"Unfortunately, you do not qualify for a promotion<br>\" + reqText);\r\n } else {\r\n if (sing) {return false;}\r\n dialogBoxCreate(\"You are already at the highest position for your field! No promotion available\");\r\n }\r\n return; //Same job, do nothing\r\n }\r\n }\r\n\r\n\r\n //Lose reputation from a Company if you are leaving it for another job\r\n var leaveCompany = false;\r\n var oldCompanyName = \"\";\r\n if (currCompany != \"\") {\r\n if (currCompany.companyName != company.companyName) {\r\n leaveCompany = true;\r\n oldCompanyName = currCompany.companyName;\r\n company.playerReputation -= 1000;\r\n if (company.playerReputation < 0) {company.playerReputation = 0;}\r\n }\r\n }\r\n\r\n this.companyName = company.companyName;\r\n this.companyPosition = pos;\r\n\r\n if (this.firstJobRecvd === false) {\r\n this.firstJobRecvd = true;\r\n document.getElementById(\"job-tab\").style.display = \"list-item\";\r\n document.getElementById(\"world-menu-header\").click();\r\n document.getElementById(\"world-menu-header\").click();\r\n }\r\n\r\n if (leaveCompany) {\r\n if (sing) {return true;}\r\n dialogBoxCreate(\"Congratulations! You were offered a new job at \" + this.companyName + \" as a \" +\r\n pos.positionName + \"!<br>\" +\r\n \"You lost 1000 reputation at your old company \" + oldCompanyName + \" because you left.\");\r\n } else {\r\n if (sing) {return true;}\r\n dialogBoxCreate(\"Congratulations! You were offered a new job at \" + this.companyName + \" as a \" + pos.positionName + \"!\");\r\n }\r\n\r\n Engine.loadLocationContent();\r\n}\r\n\r\n//Returns your next position at a company given the field (software, business, etc.)\r\nPlayerObject.prototype.getNextCompanyPosition = function(company, entryPosType) {\r\n var currCompany = null;\r\n if (this.companyName != \"\") {\r\n currCompany = Companies[this.companyName];\r\n }\r\n\r\n //Not employed at this company, so return the entry position\r\n if (currCompany == null || (currCompany.companyName != company.companyName)) {\r\n return entryPosType;\r\n }\r\n\r\n //If the entry pos type and the player's current position have the same type,\r\n //return the player's \"nextCompanyPosition\". Otherwise return the entryposType\r\n //Employed at this company, so just return the next position if it exists.\r\n if ((this.companyPosition.isSoftwareJob() && entryPosType.isSoftwareJob()) ||\r\n (this.companyPosition.isITJob() && entryPosType.isITJob()) ||\r\n (this.companyPosition.isBusinessJob() && entryPosType.isBusinessJob()) ||\r\n (this.companyPosition.isSecurityEngineerJob() && entryPosType.isSecurityEngineerJob()) ||\r\n (this.companyPosition.isNetworkEngineerJob() && entryPosType.isNetworkEngineerJob()) ||\r\n (this.companyPosition.isSecurityJob() && entryPosType.isSecurityJob()) ||\r\n (this.companyPosition.isAgentJob() && entryPosType.isAgentJob()) ||\r\n (this.companyPosition.isSoftwareConsultantJob() && entryPosType.isSoftwareConsultantJob()) ||\r\n (this.companyPosition.isBusinessConsultantJob() && entryPosType.isBusinessConsultantJob()) ||\r\n (this.companyPosition.isPartTimeJob() && entryPosType.isPartTimeJob())) {\r\n return getNextCompanyPosition(this.companyPosition);\r\n }\r\n\r\n\r\n return entryPosType;\r\n}\r\n\r\nPlayerObject.prototype.applyForSoftwareJob = function(sing=false) {\r\n return this.applyForJob(CompanyPositions.SoftwareIntern, sing);\r\n}\r\n\r\nPlayerObject.prototype.applyForSoftwareConsultantJob = function(sing=false) {\r\n return this.applyForJob(CompanyPositions.SoftwareConsultant, sing);\r\n}\r\n\r\nPlayerObject.prototype.applyForItJob = function(sing=false) {\r\n\treturn this.applyForJob(CompanyPositions.ITIntern, sing);\r\n}\r\n\r\nPlayerObject.prototype.applyForSecurityEngineerJob = function(sing=false) {\r\n var company = Companies[this.location]; //Company being applied to\r\n if (this.isQualified(company, CompanyPositions.SecurityEngineer)) {\r\n return this.applyForJob(CompanyPositions.SecurityEngineer, sing);\r\n } else {\r\n if (sing) {return false;}\r\n dialogBoxCreate(\"Unforunately, you do not qualify for this position\");\r\n }\r\n}\r\n\r\nPlayerObject.prototype.applyForNetworkEngineerJob = function(sing=false) {\r\n\tvar company = Companies[this.location]; //Company being applied to\r\n if (this.isQualified(company, CompanyPositions.NetworkEngineer)) {\r\n return this.applyForJob(CompanyPositions.NetworkEngineer, sing);\r\n } else {\r\n if (sing) {return false;}\r\n dialogBoxCreate(\"Unforunately, you do not qualify for this position\");\r\n }\r\n}\r\n\r\nPlayerObject.prototype.applyForBusinessJob = function(sing=false) {\r\n\treturn this.applyForJob(CompanyPositions.BusinessIntern, sing);\r\n}\r\n\r\nPlayerObject.prototype.applyForBusinessConsultantJob = function(sing=false) {\r\n return this.applyForJob(CompanyPositions.BusinessConsultant, sing);\r\n}\r\n\r\nPlayerObject.prototype.applyForSecurityJob = function(sing=false) {\r\n //TODO If case for POlice departments\r\n\treturn this.applyForJob(CompanyPositions.SecurityGuard, sing);\r\n}\r\n\r\nPlayerObject.prototype.applyForAgentJob = function(sing=false) {\r\n\tvar company = Companies[this.location]; //Company being applied to\r\n if (this.isQualified(company, CompanyPositions.FieldAgent)) {\r\n return this.applyForJob(CompanyPositions.FieldAgent, sing);\r\n } else {\r\n if (sing) {return false;}\r\n dialogBoxCreate(\"Unforunately, you do not qualify for this position\");\r\n }\r\n}\r\n\r\nPlayerObject.prototype.applyForEmployeeJob = function(sing=false) {\r\n\tvar company = Companies[this.location]; //Company being applied to\r\n if (this.isQualified(company, CompanyPositions.Employee)) {\r\n if (this.firstJobRecvd === false) {\r\n this.firstJobRecvd = true;\r\n document.getElementById(\"job-tab\").style.display = \"list-item\";\r\n document.getElementById(\"world-menu-header\").click();\r\n document.getElementById(\"world-menu-header\").click();\r\n }\r\n this.companyName = company.companyName;\r\n this.companyPosition = CompanyPositions.Employee;\r\n if (sing) {return true;}\r\n dialogBoxCreate(\"Congratulations, you are now employed at \" + this.companyName);\r\n Engine.loadLocationContent();\r\n } else {\r\n if (sing) {return false;}\r\n dialogBoxCreate(\"Unforunately, you do not qualify for this position\");\r\n }\r\n}\r\n\r\nPlayerObject.prototype.applyForPartTimeEmployeeJob = function(sing=false) {\r\n\tvar company = Companies[this.location]; //Company being applied to\r\n if (this.isQualified(company, CompanyPositions.PartTimeEmployee)) {\r\n if (this.firstJobRecvd === false) {\r\n this.firstJobRecvd = true;\r\n document.getElementById(\"job-tab\").style.display = \"list-item\";\r\n document.getElementById(\"world-menu-header\").click();\r\n document.getElementById(\"world-menu-header\").click();\r\n }\r\n this.companyName = company.companyName;\r\n this.companyPosition = CompanyPositions.PartTimeEmployee;\r\n if (sing) {return true;}\r\n dialogBoxCreate(\"Congratulations, you are now employed part-time at \" + this.companyName);\r\n Engine.loadLocationContent();\r\n } else {\r\n if (sing) {return false;}\r\n dialogBoxCreate(\"Unforunately, you do not qualify for this position\");\r\n }\r\n}\r\n\r\nPlayerObject.prototype.applyForWaiterJob = function(sing=false) {\r\n\tvar company = Companies[this.location]; //Company being applied to\r\n if (this.isQualified(company, CompanyPositions.Waiter)) {\r\n if (this.firstJobRecvd === false) {\r\n this.firstJobRecvd = true;\r\n document.getElementById(\"job-tab\").style.display = \"list-item\";\r\n document.getElementById(\"world-menu-header\").click();\r\n document.getElementById(\"world-menu-header\").click();\r\n }\r\n this.companyName = company.companyName;\r\n this.companyPosition = CompanyPositions.Waiter;\r\n if (sing) {return true;}\r\n dialogBoxCreate(\"Congratulations, you are now employed as a waiter at \" + this.companyName);\r\n Engine.loadLocationContent();\r\n } else {\r\n if (sing) {return false;}\r\n dialogBoxCreate(\"Unforunately, you do not qualify for this position\");\r\n }\r\n}\r\n\r\nPlayerObject.prototype.applyForPartTimeWaiterJob = function(sing=false) {\r\n\tvar company = Companies[this.location]; //Company being applied to\r\n if (this.isQualified(company, CompanyPositions.PartTimeWaiter)) {\r\n if (this.firstJobRecvd === false) {\r\n this.firstJobRecvd = true;\r\n document.getElementById(\"job-tab\").style.display = \"list-item\";\r\n document.getElementById(\"world-menu-header\").click();\r\n document.getElementById(\"world-menu-header\").click();\r\n }\r\n this.companyName = company.companyName;\r\n this.companyPosition = CompanyPositions.PartTimeWaiter;\r\n if (sing) {return true;}\r\n dialogBoxCreate(\"Congratulations, you are now employed as a part-time waiter at \" + this.companyName);\r\n Engine.loadLocationContent();\r\n } else {\r\n if (sing) {return false;}\r\n dialogBoxCreate(\"Unforunately, you do not qualify for this position\");\r\n }\r\n}\r\n\r\n//Checks if the Player is qualified for a certain position\r\nPlayerObject.prototype.isQualified = function(company, position) {\r\n\tvar offset = company.jobStatReqOffset;\r\n var reqHacking = position.requiredHacking > 0 ? position.requiredHacking+offset : 0;\r\n var reqStrength = position.requiredStrength > 0 ? position.requiredStrength+offset : 0;\r\n var reqDefense = position.requiredDefense > 0 ? position.requiredDefense+offset : 0;\r\n var reqDexterity = position.requiredDexterity > 0 ? position.requiredDexterity+offset : 0;\r\n var reqAgility = position.requiredDexterity > 0 ? position.requiredDexterity+offset : 0;\r\n var reqCharisma = position.requiredCharisma > 0 ? position.requiredCharisma+offset : 0;\r\n\r\n\tif (this.hacking_skill >= reqHacking &&\r\n\t\tthis.strength \t >= reqStrength &&\r\n this.defense >= reqDefense &&\r\n this.dexterity >= reqDexterity &&\r\n this.agility >= reqAgility &&\r\n this.charisma >= reqCharisma &&\r\n company.playerReputation >= position.requiredReputation) {\r\n return true;\r\n }\r\n return false;\r\n}\r\n\r\n/********** Reapplying Augmentations and Source File ***********/\r\nPlayerObject.prototype.reapplyAllAugmentations = function(resetMultipliers=true) {\r\n console.log(\"Re-applying augmentations\");\r\n if (resetMultipliers) {\r\n this.resetMultipliers();\r\n }\r\n\r\n for (let i = 0; i < this.augmentations.length; ++i) {\r\n //Compatibility with new version\r\n if (this.augmentations[i].name === \"HacknetNode NIC Architecture Neural-Upload\") {\r\n this.augmentations[i].name = \"Hacknet Node NIC Architecture Neural-Upload\";\r\n }\r\n\r\n var augName = this.augmentations[i].name;\r\n var aug = Augmentations[augName];\r\n if (aug == null) {\r\n console.log(\"WARNING: Invalid augmentation name\");\r\n continue;\r\n }\r\n aug.owned = true;\r\n if (aug.name == AugmentationNames.NeuroFluxGovernor) {\r\n for (let j = 0; j < aug.level; ++j) {\r\n applyAugmentation(this.augmentations[i], true);\r\n }\r\n continue;\r\n }\r\n applyAugmentation(this.augmentations[i], true);\r\n }\r\n}\r\n\r\nPlayerObject.prototype.reapplyAllSourceFiles = function() {\r\n console.log(\"Re-applying source files\");\r\n //Will always be called after reapplyAllAugmentations() so multipliers do not have to be reset\r\n //this.resetMultipliers();\r\n\r\n for (let i = 0; i < this.sourceFiles.length; ++i) {\r\n var srcFileKey = \"SourceFile\" + this.sourceFiles[i].n;\r\n var sourceFileObject = SourceFiles[srcFileKey];\r\n if (sourceFileObject == null) {\r\n console.log(\"ERROR: Invalid source file number: \" + this.sourceFiles[i].n);\r\n continue;\r\n }\r\n applySourceFile(this.sourceFiles[i]);\r\n }\r\n}\r\n\r\n/*************** Check for Faction Invitations *************/\r\n//This function sets the requirements to join a Faction. It checks whether the Player meets\r\n//those requirements and will return an array of all factions that the Player should\r\n//receive an invitation to\r\nPlayerObject.prototype.checkForFactionInvitations = function() {\r\n let invitedFactions = []; //Array which will hold all Factions th eplayer should be invited to\r\n\r\n var numAugmentations = this.augmentations.length;\r\n\r\n var company = Companies[this.companyName];\r\n var companyRep = 0;\r\n if (company != null) {\r\n companyRep = company.playerReputation;\r\n }\r\n\r\n //Illuminati\r\n var illuminatiFac = Factions[\"Illuminati\"];\r\n if (!illuminatiFac.isBanned && !illuminatiFac.isMember && !illuminatiFac.alreadyInvited &&\r\n numAugmentations >= 30 &&\r\n this.money.gte(150000000000) &&\r\n this.hacking_skill >= 1500 &&\r\n this.strength >= 1200 && this.defense >= 1200 &&\r\n this.dexterity >= 1200 && this.agility >= 1200) {\r\n invitedFactions.push(illuminatiFac);\r\n }\r\n\r\n //Daedalus\r\n var daedalusFac = Factions[\"Daedalus\"];\r\n if (!daedalusFac.isBanned && !daedalusFac.isMember && !daedalusFac.alreadyInvited &&\r\n numAugmentations >= 30 &&\r\n this.money.gte(100000000000) &&\r\n (this.hacking_skill >= 2500 ||\r\n (this.strength >= 1500 && this.defense >= 1500 &&\r\n this.dexterity >= 1500 && this.agility >= 1500))) {\r\n invitedFactions.push(daedalusFac);\r\n }\r\n\r\n //The Covenant\r\n var covenantFac = Factions[\"The Covenant\"];\r\n if (!covenantFac.isBanned && !covenantFac.isMember && !covenantFac.alreadyInvited &&\r\n numAugmentations >= 30 &&\r\n this.money.gte(75000000000) &&\r\n this.hacking_skill >= 850 &&\r\n this.strength >= 850 &&\r\n this.defense >= 850 &&\r\n this.dexterity >= 850 &&\r\n this.agility >= 850) {\r\n invitedFactions.push(covenantFac);\r\n }\r\n\r\n //ECorp\r\n var ecorpFac = Factions[\"ECorp\"];\r\n if (!ecorpFac.isBanned && !ecorpFac.isMember && !ecorpFac.alreadyInvited &&\r\n this.companyName == Locations.AevumECorp && companyRep >= CONSTANTS.CorpFactionRepRequirement) {\r\n invitedFactions.push(ecorpFac);\r\n }\r\n\r\n //MegaCorp\r\n var megacorpFac = Factions[\"MegaCorp\"];\r\n if (!megacorpFac.isBanned && !megacorpFac.isMember && !megacorpFac.alreadyInvited &&\r\n this.companyName == Locations.Sector12MegaCorp && companyRep >= CONSTANTS.CorpFactionRepRequirement) {\r\n invitedFactions.push(megacorpFac);\r\n }\r\n\r\n //Bachman & Associates\r\n var bachmanandassociatesFac = Factions[\"Bachman & Associates\"];\r\n if (!bachmanandassociatesFac.isBanned && !bachmanandassociatesFac.isMember &&\r\n !bachmanandassociatesFac.alreadyInvited &&\r\n this.companyName == Locations.AevumBachmanAndAssociates && companyRep >= CONSTANTS.CorpFactionRepRequirement) {\r\n invitedFactions.push(bachmanandassociatesFac);\r\n }\r\n\r\n //Blade Industries\r\n var bladeindustriesFac = Factions[\"Blade Industries\"];\r\n if (!bladeindustriesFac.isBanned && !bladeindustriesFac.isMember && !bladeindustriesFac.alreadyInvited &&\r\n this.companyName == Locations.Sector12BladeIndustries && companyRep >= CONSTANTS.CorpFactionRepRequirement) {\r\n invitedFactions.push(bladeindustriesFac);\r\n }\r\n\r\n //NWO\r\n var nwoFac = Factions[\"NWO\"];\r\n if (!nwoFac.isBanned && !nwoFac.isMember && !nwoFac.alreadyInvited &&\r\n this.companyName == Locations.VolhavenNWO && companyRep >= CONSTANTS.CorpFactionRepRequirement) {\r\n invitedFactions.push(nwoFac);\r\n }\r\n\r\n //Clarke Incorporated\r\n var clarkeincorporatedFac = Factions[\"Clarke Incorporated\"];\r\n if (!clarkeincorporatedFac.isBanned && !clarkeincorporatedFac.isMember && !clarkeincorporatedFac.alreadyInvited &&\r\n this.companyName == Locations.AevumClarkeIncorporated && companyRep >= CONSTANTS.CorpFactionRepRequirement) {\r\n invitedFactions.push(clarkeincorporatedFac);\r\n }\r\n\r\n //OmniTek Incorporated\r\n var omnitekincorporatedFac = Factions[\"OmniTek Incorporated\"];\r\n if (!omnitekincorporatedFac.isBanned && !omnitekincorporatedFac.isMember && !omnitekincorporatedFac.alreadyInvited &&\r\n this.companyName == Locations.VolhavenOmniTekIncorporated && companyRep >= CONSTANTS.CorpFactionRepRequirement) {\r\n invitedFactions.push(omnitekincorporatedFac);\r\n }\r\n\r\n //Four Sigma\r\n var foursigmaFac = Factions[\"Four Sigma\"];\r\n if (!foursigmaFac.isBanned && !foursigmaFac.isMember && !foursigmaFac.alreadyInvited &&\r\n this.companyName == Locations.Sector12FourSigma && companyRep >= CONSTANTS.CorpFactionRepRequirement) {\r\n invitedFactions.push(foursigmaFac);\r\n }\r\n\r\n //KuaiGong International\r\n var kuaigonginternationalFac = Factions[\"KuaiGong International\"];\r\n if (!kuaigonginternationalFac.isBanned && !kuaigonginternationalFac.isMember &&\r\n !kuaigonginternationalFac.alreadyInvited &&\r\n this.companyName == Locations.ChongqingKuaiGongInternational && companyRep >= CONSTANTS.CorpFactionRepRequirement) {\r\n invitedFactions.push(kuaigonginternationalFac);\r\n }\r\n\r\n //Fulcrum Secret Technologies - If u've unlocked fulcrum secret technolgoies server and have a high rep with the company\r\n var fulcrumsecrettechonologiesFac = Factions[\"Fulcrum Secret Technologies\"];\r\n var fulcrumSecretServer = AllServers[SpecialServerIps[SpecialServerNames.FulcrumSecretTechnologies]];\r\n if (fulcrumSecretServer == null) {\r\n console.log(\"ERROR: Could not find Fulcrum Secret Technologies Server\");\r\n } else {\r\n if (!fulcrumsecrettechonologiesFac.isBanned && !fulcrumsecrettechonologiesFac.isMember &&\r\n !fulcrumsecrettechonologiesFac.alreadyInvited &&\r\n fulcrumSecretServer.manuallyHacked &&\r\n this.companyName == Locations.AevumFulcrumTechnologies && companyRep >= 250000) {\r\n invitedFactions.push(fulcrumsecrettechonologiesFac);\r\n }\r\n }\r\n\r\n //BitRunners\r\n var bitrunnersFac = Factions[\"BitRunners\"];\r\n var homeComp = this.getHomeComputer();\r\n var bitrunnersServer = AllServers[SpecialServerIps[SpecialServerNames.BitRunnersServer]];\r\n if (bitrunnersServer == null) {\r\n console.log(\"ERROR: Could not find BitRunners Server\");\r\n } else if (!bitrunnersFac.isBanned && !bitrunnersFac.isMember && bitrunnersServer.manuallyHacked &&\r\n !bitrunnersFac.alreadyInvited && this.hacking_skill >= 500 && homeComp.maxRam >= 128) {\r\n invitedFactions.push(bitrunnersFac);\r\n }\r\n\r\n //The Black Hand\r\n var theblackhandFac = Factions[\"The Black Hand\"];\r\n var blackhandServer = AllServers[SpecialServerIps[SpecialServerNames.TheBlackHandServer]];\r\n if (blackhandServer == null) {\r\n console.log(\"ERROR: Could not find The Black Hand Server\");\r\n } else if (!theblackhandFac.isBanned && !theblackhandFac.isMember && blackhandServer.manuallyHacked &&\r\n !theblackhandFac.alreadyInvited && this.hacking_skill >= 350 && homeComp.maxRam >= 64) {\r\n invitedFactions.push(theblackhandFac);\r\n }\r\n\r\n //NiteSec\r\n var nitesecFac = Factions[\"NiteSec\"];\r\n var nitesecServer = AllServers[SpecialServerIps[SpecialServerNames.NiteSecServer]];\r\n if (nitesecServer == null) {\r\n console.log(\"ERROR: Could not find NiteSec Server\");\r\n } else if (!nitesecFac.isBanned && !nitesecFac.isMember && nitesecServer.manuallyHacked &&\r\n !nitesecFac.alreadyInvited && this.hacking_skill >= 200 && homeComp.maxRam >= 32) {\r\n invitedFactions.push(nitesecFac);\r\n }\r\n\r\n //Chongqing\r\n var chongqingFac = Factions[\"Chongqing\"];\r\n if (!chongqingFac.isBanned && !chongqingFac.isMember && !chongqingFac.alreadyInvited &&\r\n this.money.gte(20000000) && this.city == Locations.Chongqing) {\r\n invitedFactions.push(chongqingFac);\r\n }\r\n\r\n //Sector-12\r\n var sector12Fac = Factions[\"Sector-12\"];\r\n if (!sector12Fac.isBanned && !sector12Fac.isMember && !sector12Fac.alreadyInvited &&\r\n this.money.gte(15000000) && this.city == Locations.Sector12) {\r\n invitedFactions.push(sector12Fac);\r\n }\r\n\r\n //New Tokyo\r\n var newtokyoFac = Factions[\"New Tokyo\"];\r\n if (!newtokyoFac.isBanned && !newtokyoFac.isMember && !newtokyoFac.alreadyInvited &&\r\n this.money.gte(20000000) && this.city == Locations.NewTokyo) {\r\n invitedFactions.push(newtokyoFac);\r\n }\r\n\r\n //Aevum\r\n var aevumFac = Factions[\"Aevum\"];\r\n if (!aevumFac.isBanned && !aevumFac.isMember && !aevumFac.alreadyInvited &&\r\n this.money.gte(40000000) && this.city == Locations.Aevum) {\r\n invitedFactions.push(aevumFac);\r\n }\r\n\r\n //Ishima\r\n var ishimaFac = Factions[\"Ishima\"];\r\n if (!ishimaFac.isBanned && !ishimaFac.isMember && !ishimaFac.alreadyInvited &&\r\n this.money.gte(30000000) && this.city == Locations.Ishima) {\r\n invitedFactions.push(ishimaFac);\r\n }\r\n\r\n //Volhaven\r\n var volhavenFac = Factions[\"Volhaven\"];\r\n if (!volhavenFac.isBanned && !volhavenFac.isMember && !volhavenFac.alreadyInvited &&\r\n this.money.gte(50000000) && this.city == Locations.Volhaven) {\r\n invitedFactions.push(volhavenFac);\r\n }\r\n\r\n //Speakers for the Dead\r\n var speakersforthedeadFac = Factions[\"Speakers for the Dead\"];\r\n if (!speakersforthedeadFac.isBanned && !speakersforthedeadFac.isMember && !speakersforthedeadFac.alreadyInvited &&\r\n this.hacking_skill >= 100 && this.strength >= 300 && this.defense >= 300 &&\r\n this.dexterity >= 300 && this.agility >= 300 && this.numPeopleKilled >= 30 &&\r\n this.karma <= -45 && this.companyName != Locations.Sector12CIA &&\r\n this.companyName != Locations.Sector12NSA) {\r\n invitedFactions.push(speakersforthedeadFac);\r\n }\r\n\r\n //The Dark Army\r\n var thedarkarmyFac = Factions[\"The Dark Army\"];\r\n if (!thedarkarmyFac.isBanned && !thedarkarmyFac.isMember && !thedarkarmyFac.alreadyInvited &&\r\n this.hacking_skill >= 300 && this.strength >= 300 && this.defense >= 300 &&\r\n this.dexterity >= 300 && this.agility >= 300 && this.city == Locations.Chongqing &&\r\n this.numPeopleKilled >= 5 && this.karma <= -45 && this.companyName != Locations.Sector12CIA &&\r\n this.companyName != Locations.Sector12NSA) {\r\n invitedFactions.push(thedarkarmyFac);\r\n }\r\n\r\n //The Syndicate\r\n var thesyndicateFac = Factions[\"The Syndicate\"];\r\n if (!thesyndicateFac.isBanned && !thesyndicateFac.isMember && !thesyndicateFac.alreadyInvited &&\r\n this.hacking_skill >= 200 && this.strength >= 200 && this.defense >= 200 &&\r\n this.dexterity >= 200 && this.agility >= 200 &&\r\n (this.city == Locations.Aevum || this.city == Locations.Sector12) &&\r\n this.money.gte(10000000) && this.karma <= -90 &&\r\n this.companyName != Locations.Sector12CIA && this.companyName != Locations.Sector12NSA) {\r\n invitedFactions.push(thesyndicateFac);\r\n }\r\n\r\n //Silhouette\r\n var silhouetteFac = Factions[\"Silhouette\"];\r\n if (!silhouetteFac.isBanned && !silhouetteFac.isMember && !silhouetteFac.alreadyInvited &&\r\n (this.companyPosition.positionName == CompanyPositions.CTO.positionName ||\r\n this.companyPosition.positionName == CompanyPositions.CFO.positionName ||\r\n this.companyPosition.positionName == CompanyPositions.CEO.positionName) &&\r\n this.money.gte(15000000) && this.karma <= -22) {\r\n invitedFactions.push(silhouetteFac);\r\n }\r\n\r\n //Tetrads\r\n var tetradsFac = Factions[\"Tetrads\"];\r\n if (!tetradsFac.isBanned && !tetradsFac.isMember && !tetradsFac.alreadyInvited &&\r\n (this.city == Locations.Chongqing || this.city == Locations.NewTokyo ||\r\n this.city == Locations.Ishima) && this.strength >= 75 && this.defense >= 75 &&\r\n this.dexterity >= 75 && this.agility >= 75 && this.karma <= -18) {\r\n invitedFactions.push(tetradsFac);\r\n }\r\n\r\n //SlumSnakes\r\n var slumsnakesFac = Factions[\"Slum Snakes\"];\r\n if (!slumsnakesFac.isBanned && !slumsnakesFac.isMember && !slumsnakesFac.alreadyInvited &&\r\n this.strength >= 30 && this.defense >= 30 && this.dexterity >= 30 &&\r\n this.agility >= 30 && this.karma <= -9 && this.money.gte(1000000)) {\r\n invitedFactions.push(slumsnakesFac);\r\n }\r\n\r\n //Netburners\r\n var netburnersFac = Factions[\"Netburners\"];\r\n var totalHacknetRam = 0;\r\n var totalHacknetCores = 0;\r\n var totalHacknetLevels = 0;\r\n for (var i = 0; i < this.hacknetNodes.length; ++i) {\r\n totalHacknetLevels += this.hacknetNodes[i].level;\r\n totalHacknetRam += this.hacknetNodes[i].ram;\r\n totalHacknetCores += this.hacknetNodes[i].cores;\r\n }\r\n if (!netburnersFac.isBanned && !netburnersFac.isMember && !netburnersFac.alreadyInvited &&\r\n this.hacking_skill >= 80 && totalHacknetRam >= 8 &&\r\n totalHacknetCores >= 4 && totalHacknetLevels >= 100) {\r\n invitedFactions.push(netburnersFac);\r\n }\r\n\r\n //Tian Di Hui\r\n var tiandihuiFac = Factions[\"Tian Di Hui\"];\r\n if (!tiandihuiFac.isBanned && !tiandihuiFac.isMember && !tiandihuiFac.alreadyInvited &&\r\n this.money.gte(1000000) && this.hacking_skill >= 50 &&\r\n (this.city == Locations.Chongqing || this.city == Locations.NewTokyo ||\r\n this.city == Locations.Ishima)) {\r\n invitedFactions.push(tiandihuiFac);\r\n }\r\n\r\n //CyberSec\r\n var cybersecFac = Factions[\"CyberSec\"];\r\n var cybersecServer = AllServers[SpecialServerIps[SpecialServerNames.CyberSecServer]];\r\n if (cybersecServer == null) {\r\n console.log(\"ERROR: Could not find CyberSec Server\");\r\n } else if (!cybersecFac.isBanned && !cybersecFac.isMember && cybersecServer.manuallyHacked &&\r\n !cybersecFac.alreadyInvited && this.hacking_skill >= 50) {\r\n invitedFactions.push(cybersecFac);\r\n }\r\n\r\n return invitedFactions;\r\n}\r\n\r\n\r\n/*************** Gang ****************/\r\n//Returns true if Player is in a gang and false otherwise\r\nPlayerObject.prototype.inGang = function() {\r\n if (this.gang == null || this.gang == undefined) {return false;}\r\n return (this.gang instanceof Gang);\r\n}\r\n\r\nPlayerObject.prototype.startGang = function(factionName, hacking) {\r\n this.gang = new Gang(factionName, hacking);\r\n}\r\n\r\n/************* BitNodes **************/\r\nPlayerObject.prototype.setBitNodeNumber = function(n) {\r\n this.bitNodeN = n;\r\n}\r\n\r\n/* Functions for saving and loading the Player data */\r\nfunction loadPlayer(saveString) {\r\n Player = JSON.parse(saveString, Reviver);\r\n\r\n //Parse Decimal.js objects\r\n Player.money = new Decimal(Player.money);\r\n Player.total_money = new Decimal(Player.total_money);\r\n Player.lifetime_money = new Decimal(Player.lifetime_money);\r\n\r\n if (Player.corporation instanceof Corporation) {\r\n Player.corporation.funds = new Decimal(Player.corporation.funds);\r\n Player.corporation.revenue = new Decimal(Player.corporation.revenue);\r\n Player.corporation.expenses = new Decimal(Player.corporation.expenses);\r\n\r\n for (var i = 0; i < Player.corporation.divisions.length; ++i) {\r\n var ind = Player.corporation.divisions[i];\r\n ind.lastCycleRevenue = new Decimal(ind.lastCycleRevenue);\r\n ind.lastCycleExpenses = new Decimal(ind.lastCycleExpenses);\r\n ind.thisCycleRevenue = new Decimal(ind.thisCycleRevenue);\r\n ind.thisCycleExpenses = new Decimal(ind.thisCycleExpenses);\r\n }\r\n }\r\n}\r\n\r\nPlayerObject.prototype.toJSON = function() {\r\n return Generic_toJSON(\"PlayerObject\", this);\r\n}\r\n\r\nPlayerObject.fromJSON = function(value) {\r\n return Generic_fromJSON(PlayerObject, value.data);\r\n}\r\n\r\nReviver.constructors.PlayerObject = PlayerObject;\r\n\r\nlet Player = new PlayerObject();\r\nexport {Player, loadPlayer};\r\n","//General helper functions\r\nimport {isString} from \"./StringHelperFunctions.js\";\r\nimport {dialogBoxCreate} from \"./DialogBox.js\";\r\n\r\n//Returns the size (number of keys) of an object\r\nfunction sizeOfObject(obj) {\r\n\tvar size = 0, key;\r\n\tfor (key in obj) {\r\n\t\tif (obj.hasOwnProperty(key)) size++;\r\n\t}\r\n\treturn size;\r\n}\r\n\r\nfunction clearObject(obj) {\r\n for (var key in obj) {\r\n if (obj.hasOwnProperty(key)) {\r\n delete obj[key];\r\n }\r\n }\r\n}\r\n\r\n//Adds a random offset to a number within a certain percentage\r\n//e.g. addOffset(100, 5) will return anything from 95 to 105.\r\n//The percentage argument must be between 0 and 100;\r\nfunction addOffset(n, percentage) {\r\n if (percentage < 0 || percentage > 100) {return n;}\r\n\r\n var offset = n * (percentage / 100);\r\n\r\n return n + ((Math.random() * (2 * offset)) - offset);\r\n}\r\n\r\n//Given an element by its Id(usually an 'a' element), removes all event listeners\r\n//from that element by cloning and replacing. Then returns the new cloned element\r\nfunction clearEventListeners(elemId) {\r\n var elem = document.getElementById(elemId);\r\n if (elem == null) {console.log(\"ERR: Could not find element for: \" + elemId); return null;}\r\n var newElem = elem.cloneNode(true);\r\n elem.parentNode.replaceChild(newElem, elem);\r\n return newElem;\r\n}\r\n\r\n//Same as clearEventListeners except it takes a DOM element object rather than an ID\r\nfunction clearEventListenersEl(el) {\r\n if (el == null) {console.log(\"ERR: element passed into clearEventListenersEl is null\"); return null;}\r\n var newElem = el.cloneNode(true);\r\n el.parentNode.replaceChild(newElem, el);\r\n return newElem;\r\n}\r\n\r\n//Given its id, this function removes an element AND its children\r\nfunction removeElementById(id) {\r\n var elem = document.getElementById(id);\r\n if (elem == null) {return;}\r\n while(elem.firstChild) {elem.removeChild(elem.firstChild);}\r\n elem.parentNode.removeChild(elem);\r\n}\r\n\r\nfunction removeElement(elem) {\r\n if (elem == null || !(elem instanceof Element)) {return;}\r\n while(elem.firstChild) {elem.removeChild(elem.firstChild);}\r\n elem.parentNode.removeChild(elem);\r\n}\r\n\r\nfunction removeChildrenFromElement(el) {\r\n if (isString(el)) {\r\n el = document.getElementById(el);\r\n }\r\n if (el == null) {return;}\r\n if (el instanceof Element) {\r\n while(el.firstChild) {\r\n el.removeChild(el.firstChild);\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * Returns a reference to the first object with the specified value of the ID or NAME attribute, throwing an error if it is unable to find it.\r\n * @param {string} elementId The HTML ID to retrieve the element by.\r\n * @returns {HTMLElement} The single element.\r\n * @throws {Error} When the 'idString' cannot be found.\r\n */\r\nfunction getElementById(elementId) {\r\n var el = document.getElementById(elementId);\r\n if (el == null) {\r\n throw new Error(\"Unable to find element with id '\" + elementId + \"'\");\r\n }\r\n\r\n return el;\r\n}\r\n\r\nfunction createElement(type, params={}) {\r\n var el = document.createElement(type);\r\n if (params.id) {el.id = params.id;}\r\n if (params.class) {el.className = params.class;}\r\n if (params.name) {el.name = params.name;}\r\n if (params.innerHTML) {el.innerHTML = params.innerHTML;}\r\n if (params.innerText) {el.innerText = params.innerText;}\r\n if (params.value) {el.value = params.value;}\r\n if (params.text) {el.text = params.text;}\r\n if (params.display) {el.style.display = params.display;}\r\n if (params.visibility) {el.style.visibility = params.visibility;}\r\n if (params.margin) {el.style.margin = params.margin;}\r\n if (params.marginLeft) {el.style.marginLeft = params.marginLeft;}\r\n if (params.marginTop) {el.style.marginTop = params.marginTop;}\r\n if (params.padding) {el.style.padding = params.padding;}\r\n if (params.color) {el.style.color = params.color;}\r\n if (params.border) {el.style.border = params.border;}\r\n if (params.float) {el.style.cssFloat = params.float;}\r\n if (params.fontSize) {el.style.fontSize = params.fontSize;}\r\n if (params.whiteSpace) {el.style.whiteSpace = params.whiteSpace;}\r\n if (params.width) {el.style.width = params.width;}\r\n if (params.backgroundColor) {\r\n el.style.backgroundColor = params.backgroundColor\r\n }\r\n if (params.position) {el.style.position = params.position;}\r\n if (params.type) {el.type = params.type;}\r\n if (params.checked) {el.checked = params.checked;}\r\n if (params.for) {el.htmlFor = params.for;}\r\n if (params.pattern) {el.pattern = params.pattern;}\r\n if (params.maxLength) {el.maxLength = params.maxLength;}\r\n if (params.placeholder) {el.placeholder = params.placeholder;}\r\n if (params.tooltip && params.tooltip !== \"\") {\r\n el.className += \" tooltip\";\r\n el.appendChild(createElement(\"span\", {\r\n class:\"tooltiptext\",\r\n innerHTML:params.tooltip\r\n }));\r\n } else if (params.tooltipleft) {\r\n el.className += \" tooltip\";\r\n el.appendChild(createElement(\"span\", {\r\n class:\"tooltiptextleft\",\r\n innerHTML:params.tooltipleft\r\n }));\r\n }\r\n if (params.href) {el.href = params.href;}\r\n if (params.target) {el.target = params.target;}\r\n if (params.tabIndex) {el.tabIndex = params.tabIndex;}\r\n if (params.clickListener) {\r\n el.addEventListener(\"click\", params.clickListener);\r\n }\r\n if (params.inputListener) {\r\n el.addEventListener(\"input\", params.inputListener);\r\n }\r\n if (params.changeListener) {\r\n el.addEventListener(\"change\", params.changeListener);\r\n }\r\n if (params.onkeyup) {\r\n el.addEventListener(\"keyup\", params.onkeyup);\r\n }\r\n if (params.onfocus) {\r\n el.addEventListener(\"focus\", params.onfocus);\r\n }\r\n return el;\r\n}\r\n\r\nfunction createPopup(id, elems) {\r\n var container = createElement(\"div\", {\r\n class:\"popup-box-container\",\r\n id:id,\r\n display:\"block\"\r\n }),\r\n content = createElement(\"div\", {\r\n class:\"popup-box-content\",\r\n id:id + \"-content\",\r\n });\r\n\r\n for (var i = 0; i < elems.length; ++i) {\r\n content.appendChild(elems[i]);\r\n }\r\n container.appendChild(content);\r\n document.getElementById(\"entire-game-container\").appendChild(container);\r\n return container;\r\n}\r\n\r\n//Creates both the header and panel element of an accordion and sets the click handler\r\nfunction createAccordionElement(params) {\r\n var li = document.createElement(\"li\"),\r\n hdr = document.createElement(\"button\"),\r\n panel = document.createElement(\"div\");\r\n hdr.classList.add(\"accordion-header\");\r\n panel.classList.add(\"accordion-panel\");\r\n\r\n if (params.id) {\r\n hdr.id = params.id + \"-hdr\";\r\n panel.id = params.id + \"-panel\";\r\n }\r\n if (params.hdrText) {hdr.innerHTML = params.hdrText;}\r\n if (params.panelText) {panel.innerHTML = params.panelText;}\r\n li.appendChild(hdr);\r\n li.appendChild(panel);\r\n //Click handler\r\n hdr.onclick = function() {\r\n this.classList.toggle(\"active\");\r\n var tmpPanel = this.nextElementSibling;\r\n if (tmpPanel.style.display === \"block\") {\r\n tmpPanel.style.display = \"none\";\r\n } else {\r\n tmpPanel.style.display = \"block\";\r\n }\r\n }\r\n return [li, hdr, panel];\r\n}\r\n\r\n//Appends n line breaks (as children) to the Element el\r\nfunction appendLineBreaks(el, n) {\r\n for (var i = 0; i < n; ++i) {\r\n el.appendChild(createElement(\"br\"));\r\n }\r\n}\r\n\r\nfunction clearSelector(selector) {\r\n for (var i = selector.options.length - 1; i >= 0; --i) {\r\n selector.remove(i);\r\n }\r\n}\r\n\r\nfunction getRandomInt(min, max) {\r\n if (min > max) {return getRandomInt(max, min);}\r\n return Math.floor(Math.random() * (max - min + 1)) + min;\r\n}\r\n\r\n//Returns true if all elements are equal, and false otherwise\r\n//Assumes both arguments are arrays and that there are no nested arrays\r\nfunction compareArrays(a1, a2) {\r\n if (a1.length != a2.length) {\r\n return false;\r\n }\r\n\r\n for (var i = 0; i < a1.length; ++i) {\r\n if (a1[i] != a2[i]) {return false;}\r\n }\r\n return true;\r\n}\r\n\r\nfunction printArray(a) {\r\n return \"[\" + a.join(\", \") + \"]\";\r\n}\r\n\r\n//Returns bool indicating whether or not its a power of 2\r\nfunction powerOfTwo(n) {\r\n if (isNaN(n)) {return false;}\r\n return n && (n & (n-1)) === 0;\r\n}\r\n\r\nfunction exceptionAlert(e) {\r\n dialogBoxCreate(\"Caught an exception: \" + e + \"<br><br>\" +\r\n \"Filename: \" + e.fileName + \"<br><br>\" +\r\n \"Line Number: \" + e.lineNumber + \"<br><br>\" +\r\n \"This is a bug, please report to game developer with this \" +\r\n \"message as well as details about how to reproduce the bug.<br><br>\" +\r\n \"If you want to be safe, I suggest refreshing the game WITHOUT saving so that your \" +\r\n \"safe doesn't get corrupted\");\r\n}\r\n\r\n/*Creates a graphical \"progress bar\"\r\n * e.g.: [||||---------------]\r\n * params:\r\n * @totalTicks - Total number of ticks in progress bar. Preferably a factor of 100\r\n * @progress - Current progress, taken as a decimal (i.e. 0.6 to represent 60%)\r\n */\r\nfunction createProgressBarText(params={}) {\r\n //Default values\r\n var totalTicks = (params.totalTicks == null ? 20 : params.totalTicks);\r\n var progress = (params.progress == null ? 0 : params.progress);\r\n\r\n var percentPerTick = 1 / totalTicks;\r\n var numTicks = Math.floor(progress / percentPerTick);\r\n var numDashes = totalTicks - numTicks;\r\n return \"[\" + Array(numTicks+1).join(\"|\") + Array(numDashes+1).join(\"-\") + \"]\";\r\n}\r\n\r\nexport {sizeOfObject, clearObject, addOffset, clearEventListeners, getRandomInt,\r\n compareArrays, printArray, powerOfTwo, clearEventListenersEl,\r\n removeElementById, removeElement, createElement, createAccordionElement,\r\n appendLineBreaks,\r\n removeChildrenFromElement, createPopup, clearSelector, exceptionAlert,\r\n createProgressBarText, getElementById};\r\n","import {dialogBoxCreate} from \"./DialogBox.js\";\r\n\r\n//Netburner String helper functions\r\n\r\n//Searches for every occurence of searchStr within str and returns an array of the indices of\r\n//all these occurences\r\nfunction getIndicesOf(searchStr, str, caseSensitive) {\r\n var searchStrLen = searchStr.length;\r\n if (searchStrLen == 0) {\r\n return [];\r\n }\r\n var startIndex = 0, index, indices = [];\r\n if (!caseSensitive) {\r\n str = str.toLowerCase();\r\n searchStr = searchStr.toLowerCase();\r\n }\r\n while ((index = str.indexOf(searchStr, startIndex)) > -1) {\r\n indices.push(index);\r\n startIndex = index + searchStrLen;\r\n }\r\n return indices;\r\n}\r\n\r\n//Replaces the character at an index with a new character\r\nString.prototype.replaceAt=function(index, character) {\r\n return this.substr(0, index) + character + this.substr(index+character.length);\r\n}\r\n\r\n//Converts a date representing time in milliseconds to a string with the format\r\n// H hours M minutes and S seconds\r\n// e.g. 10000 -> \"0 hours 0 minutes and 10 seconds\"\r\n// 120000 -> \"0 0 hours 2 minutes and 0 seconds\"\r\nfunction convertTimeMsToTimeElapsedString(time) {\r\n //Convert ms to seconds, since we only have second-level precision\r\n time = Math.floor(time / 1000);\r\n\r\n var days = Math.floor(time / 86400);\r\n time %= 86400;\r\n\r\n var hours = Math.floor(time / 3600);\r\n time %= 3600;\r\n\r\n var minutes = Math.floor(time / 60);\r\n time %= 60;\r\n\r\n var seconds = time;\r\n\r\n var res = \"\";\r\n if (days) {res += days + \" days \";}\r\n if (hours) {res += hours + \" hours \";}\r\n if (minutes) {res += minutes + \" minutes \";}\r\n res += seconds + \" seconds \";\r\n return res;\r\n}\r\n\r\n//Finds the longest common starting substring in a set of strings\r\nfunction longestCommonStart(strings) {\r\n if (!containsAllStrings(strings)) {return;}\r\n if (strings.length == 0) {return;}\r\n\r\n var A = strings.concat().sort(),\r\n a1= A[0], a2= A[A.length-1], L= a1.length, i= 0;\r\n while(i<L && a1.charAt(i).toLowerCase() === a2.charAt(i).toLowerCase()) i++;\r\n return a1.substring(0, i);\r\n}\r\n\r\n\r\n//Returns whether a variable is a string\r\nfunction isString(str) {\r\n return (typeof str === 'string' || str instanceof String);\r\n}\r\n\r\n//Returns whether an array contains entirely of string objects\r\nfunction containsAllStrings(arr) {\r\n return arr.every(isString);\r\n}\r\n\r\n//Formats a number with commas and a specific number of decimal digits\r\nfunction formatNumber(num, numFractionDigits) {\r\n return num.toLocaleString(undefined, {\r\n minimumFractionDigits: numFractionDigits,\r\n maximumFractionDigits: numFractionDigits\r\n });\r\n}\r\n\r\n//Count the number of times a substring occurs in a string\r\nfunction numOccurrences(string, subString) {\r\n string += \"\";\r\n subString += \"\";\r\n if (subString.length <= 0) return (string.length + 1);\r\n\r\n var n = 0, pos = 0, step = subString.length;\r\n\r\n while (true) {\r\n pos = string.indexOf(subString, pos);\r\n if (pos >= 0) {\r\n ++n;\r\n pos += step;\r\n } else break;\r\n }\r\n return n;\r\n}\r\n\r\n//Counters the number of Netscript operators in a string\r\nfunction numNetscriptOperators(string) {\r\n var total = 0;\r\n total += numOccurrences(string, \"+\");\r\n total += numOccurrences(string, \"-\");\r\n total += numOccurrences(string, \"*\");\r\n total += numOccurrences(string, \"/\");\r\n total += numOccurrences(string, \"%\");\r\n total += numOccurrences(string, \"&&\");\r\n total += numOccurrences(string, \"||\");\r\n total += numOccurrences(string, \"<\");\r\n total += numOccurrences(string, \">\");\r\n total += numOccurrences(string, \"<=\");\r\n total += numOccurrences(string, \">=\");\r\n total += numOccurrences(string, \"==\");\r\n total += numOccurrences(string, \"!=\");\r\n if (isNaN(total)) {\r\n dialogBoxCreate(\"ERROR in counting number of operators in script. This is a bug, please report to game developer\");\r\n total = 0;\r\n }\r\n return total;\r\n}\r\n\r\n//Checks if a string contains HTML elements\r\nfunction isHTML(str) {\r\n var a = document.createElement('div');\r\n a.innerHTML = str;\r\n for (var c = a.childNodes, i = c.length; i--; ) {\r\n if (c[i].nodeType == 1) return true;\r\n }\r\n return false;\r\n}\r\n\r\n//Generates a random alphanumeric string with N characters\r\nfunction generateRandomString(n) {\r\n var str = \"\",\r\n chars = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789\";\r\n\r\n for (var i = 0; i < n; i++)\r\n str += chars.charAt(Math.floor(Math.random() * chars.length));\r\n\r\n return str;\r\n}\r\n\r\nexport {getIndicesOf, convertTimeMsToTimeElapsedString, longestCommonStart,\r\n isString, containsAllStrings, formatNumber,\r\n numOccurrences, numNetscriptOperators, isHTML, generateRandomString};\r\n","let CONSTANTS = {\r\n Version: \"0.37.2\",\r\n\r\n\t//Max level for any skill, assuming no multipliers. Determined by max numerical value in javascript for experience\r\n //and the skill level formula in Player.js. Note that all this means it that when experience hits MAX_INT, then\r\n //the player will have this level assuming no multipliers. Multipliers can cause skills to go above this.\r\n\tMaxSkillLevel: \t\t\t975,\r\n\r\n //How much reputation is needed to join a megacorporation's faction\r\n CorpFactionRepRequirement: 250000,\r\n\r\n /* Base costs */\r\n BaseCostFor1GBOfRamHome: 32000,\r\n BaseCostFor1GBOfRamServer: 55000, //1 GB of RAM\r\n BaseCostFor1GBOfRamHacknetNode: 30000,\r\n\r\n TravelCost: 200000,\r\n\r\n BaseCostForHacknetNode: 1000,\r\n BaseCostForHacknetNodeCore: 500000,\r\n\r\n /* Hacknet Node constants */\r\n HacknetNodeMoneyGainPerLevel: 1.6,\r\n HacknetNodePurchaseNextMult: 1.85, //Multiplier when purchasing an additional hacknet node\r\n HacknetNodeUpgradeLevelMult: 1.04, //Multiplier for cost when upgrading level\r\n HacknetNodeUpgradeRamMult: 1.28, //Multiplier for cost when upgrading RAM\r\n HacknetNodeUpgradeCoreMult: 1.48, //Multiplier for cost when buying another core\r\n\r\n HacknetNodeMaxLevel: 200,\r\n HacknetNodeMaxRam: 64,\r\n HacknetNodeMaxCores: 16,\r\n\r\n /* Faction and Company favor */\r\n FactionReputationToFavorBase: 500,\r\n FactionReputationToFavorMult: 1.02,\r\n CompanyReputationToFavorBase: 500,\r\n CompanyReputationToFavorMult: 1.02,\r\n\r\n /* Augmentation */\r\n //NeuroFlux Governor cost multiplier as you level up\r\n NeuroFluxGovernorLevelMult: 1.14,\r\n\r\n /* Netscript Constants */\r\n //RAM Costs for different commands\r\n ScriptBaseRamCost: 1.4,\r\n ScriptWhileRamCost: 0.2,\r\n ScriptForRamCost: 0.2,\r\n ScriptIfRamCost: 0.15,\r\n ScriptHackRamCost: 0.1,\r\n ScriptGrowRamCost: 0.15,\r\n ScriptWeakenRamCost: 0.15,\r\n ScriptScanRamCost: 0.2,\r\n ScriptPortProgramRamCost: 0.05,\r\n ScriptRunRamCost: 1.0,\r\n ScriptExecRamCost: 1.3,\r\n ScriptSpawnRamCost: 2.0,\r\n ScriptScpRamCost: 0.6,\r\n ScriptKillRamCost: 0.5, //Kill and killall\r\n ScriptHasRootAccessRamCost: 0.05,\r\n ScriptGetHostnameRamCost: 0.05, //getHostname() and getIp()\r\n ScriptGetHackingLevelRamCost: 0.05, //getHackingLevel()\r\n ScriptGetMultipliersRamCost: 4.0, //getHackingMultipliers() and getBitNodeMultipliers()\r\n ScriptGetServerRamCost: 0.1,\r\n ScriptFileExistsRamCost: 0.1,\r\n ScriptIsRunningRamCost: 0.1,\r\n ScriptPurchaseHacknetRamCost: 1.5,\r\n ScriptHacknetNodesRamCost: 4.0, //Base cost for accessing hacknet nodes array\r\n ScriptHNUpgLevelRamCost: 0.4,\r\n ScriptHNUpgRamRamCost: 0.6,\r\n ScriptHNUpgCoreRamCost: 0.8,\r\n ScriptGetStockRamCost: 2.0,\r\n ScriptBuySellStockRamCost: 2.5,\r\n ScriptPurchaseServerRamCost: 2.25,\r\n ScriptRoundRamCost: 0.05,\r\n ScriptReadWriteRamCost: 1.0,\r\n ScriptArbScriptRamCost: 1.0, //Functions that apply to all scripts regardless of args\r\n ScriptGetScriptRamCost: 0.1,\r\n ScriptGetHackTimeRamCost: 0.05,\r\n\r\n ScriptSingularityFn1RamCost: 1,\r\n ScriptSingularityFn2RamCost: 2,\r\n ScriptSingularityFn3RamCost: 3,\r\n\r\n ScriptBladeburnerApiBaseRamCost: 4,\r\n\r\n MultithreadingRAMCost: 1,\r\n\r\n NumNetscriptPorts: 20,\r\n\r\n //Server constants\r\n ServerBaseGrowthRate: 1.03, //Unadjusted Growth rate\r\n ServerMaxGrowthRate: 1.0035, //Maximum possible growth rate (max rate accounting for server security)\r\n ServerFortifyAmount: 0.002, //Amount by which server's security increases when its hacked/grown\r\n ServerWeakenAmount: 0.05, //Amount by which server's security decreases when weakened\r\n\r\n PurchasedServerLimit: 25,\r\n PurchasedServerMaxRam: 1048576, //2^20\r\n\r\n //Augmentation Constants\r\n AugmentationCostMultiplier: 5, //Used for balancing costs without having to readjust every Augmentation cost\r\n AugmentationRepMultiplier: 2.5, //Used for balancing rep cost without having to readjust every value\r\n MultipleAugMultiplier: 1.9,\r\n\r\n //How much a TOR router costs\r\n TorRouterCost: 200000,\r\n\r\n //Infiltration constants\r\n InfiltrationBribeBaseAmount: 100000, //Amount per clearance level\r\n InfiltrationMoneyValue: 2500, //Convert \"secret\" value to money\r\n InfiltrationRepValue: 1.4, //Convert \"secret\" value to faction reputation\r\n\r\n //Stock market constants\r\n WSEAccountCost: 200e6,\r\n TIXAPICost: 5e9,\r\n StockMarketCommission: 100e3,\r\n\r\n //Hospital/Health\r\n HospitalCostPerHp: 100e3,\r\n\r\n //Intelligence-related constants\r\n IntelligenceCrimeWeight: 0.05, //Weight for how much int affects crime success rates\r\n IntelligenceInfiltrationWeight: 0.1, //Weight for how much int affects infiltration success rates\r\n IntelligenceCrimeBaseExpGain: 0.001,\r\n IntelligenceProgramBaseExpGain: 500, //Program required hack level divided by this to determine int exp gain\r\n IntelligenceTerminalHackBaseExpGain: 200, //Hacking exp divided by this to determine int exp gain\r\n IntelligenceSingFnBaseExpGain: 0.002,\r\n IntelligenceClassBaseExpGain: 0.000001,\r\n IntelligenceHackingMissionBaseExpGain: 0.03, //Hacking Mission difficulty multiplied by this to get exp gain\r\n\r\n //Hacking Missions\r\n HackingMissionRepToDiffConversion: 10000, //Faction rep is divided by this to get mission difficulty\r\n HackingMissionRepToRewardConversion: 7, //Faction rep divided byt his to get mission rep reward\r\n HackingMissionSpamTimeIncrease: 25000, //How much time limit increase is gained when conquering a Spam Node (ms)\r\n HackingMissionTransferAttackIncrease: 1.05, //Multiplier by which the attack for all Core Nodes is increased when conquering a Transfer Node\r\n HackingMissionMiscDefenseIncrease: 1.05, //The amount by which every misc node's defense is multiplied when one is conquered\r\n HackingMissionDifficultyToHacking: 135, //Difficulty is multiplied by this to determine enemy's \"hacking\" level (to determine effects of scan/attack, etc)\r\n HackingMissionHowToPlay: \"Hacking missions are a minigame that, if won, will reward you with faction reputation.<br><br>\" +\r\n \"In this game you control a set of Nodes and use them to try and defeat an enemy. Your Nodes \" +\r\n \"are colored blue, while the enemy's are red. There are also other nodes on the map colored gray \" +\r\n \"that initially belong to neither you nor the enemy. The goal of the game is \" +\r\n \"to capture all of the enemy's Database nodes within the time limit. \" +\r\n \"If you fail to do this, you will lose.<br><br>\" +\r\n \"Each Node has three stats: Attack, Defense, and HP. There are five different actions that \" +\r\n \"a Node can take:<br><br> \" +\r\n \"Attack - Targets an enemy Node and lowers its HP. The effectiveness is determined by the owner's Attack, the Player's \" +\r\n \"hacking level, and the enemy's defense.<br><br>\" +\r\n \"Scan - Targets an enemy Node and lowers its Defense. The effectiveness is determined by the owner's Attack, the Player's hacking level, and the \" +\r\n \"enemy's defense.<br><br>\" +\r\n \"Weaken - Targets an enemy Node and lowers its Attack. The effectiveness is determined by the owner's Attack, the Player's hacking level, and the enemy's \" +\r\n \"defense.<br><br>\" +\r\n \"Fortify - Raises the Node's Defense. The effectiveness is determined by your hacking level.<br><br>\" +\r\n \"Overflow - Raises the Node's Attack but lowers its Defense. The effectiveness is determined by your hacking level.<br><br>\" +\r\n \"Note that when determining the effectiveness of the above actions, the TOTAL Attack or Defense of the team is used, not just the \" +\r\n \"Attack/Defense of the individual Node that is performing the action.<br><br>\" +\r\n \"To capture a Node, you must lower its HP down to 0.<br><br>\" +\r\n \"There are six different types of Nodes:<br><br>\" +\r\n \"CPU Core - These are your main Nodes that are used to perform actions. Capable of performing every action<br><br>\" +\r\n \"Firewall - Nodes with high defense. These Nodes can 'Fortify'<br><br>\" +\r\n \"Database - A special type of Node. The player's objective is to conquer all of the enemy's Database Nodes within \" +\r\n \"the time limit. These Nodes cannot perform any actions<br><br>\" +\r\n \"Spam - Conquering one of these Nodes will slow the enemy's trace, giving the player additional time to complete \" +\r\n \"the mission. These Nodes cannot perform any actions<br><br>\" +\r\n \"Transfer - Conquering one of these nodes will increase the Attack of all of your CPU Cores by a small fixed percentage. \" +\r\n \"These Nodes are capable of performing every action except the 'Attack' action<br><br>\" +\r\n \"Shield - Nodes with high defense. These Nodes can 'Fortify'<br><br>\" +\r\n \"To assign an action to a Node, you must first select one of your Nodes. This can be done by simply clicking on it. Double-clicking \" +\r\n \"a node will select all of your Nodes of the same type (e.g. select all CPU Core Nodes or all Transfer Nodes). Note that only Nodes \" +\r\n \"that can perform actions (CPU Core, Transfer, Shield, Firewall) can be selected. Selected Nodes will be denoted with a white highlight. After selecting a Node or multiple Nodes, \" +\r\n \"select its action using the Action Buttons near the top of the screen. Every action also has a corresponding keyboard \" +\r\n \"shortcut.<br><br>\" +\r\n \"For certain actions such as attacking, scanning, and weakening, the Node performing the action must have a target. To target \" +\r\n \"another node, simply click-and-drag from the 'source' Node to a target. A Node can only have one target, and you can target \" +\r\n \"any Node that is adjacent to one of your Nodes (immediately above, below, or to the side. NOT diagonal). Furthermore, only CPU Cores and Transfer Nodes \" +\r\n \"can target, since they are the only ones that can perform the related actions. To remove a target, you can simply click on the line that represents \" +\r\n \"the connection between one of your Nodes and its target. Alternatively, you can select the 'source' Node and click the 'Drop Connection' button, \" +\r\n \"or press 'd'.<br><br>\" +\r\n \"Other Notes:<br><br>\" +\r\n \"-Whenever a miscellenaous Node (not owned by the player or enemy) is conquered, the defense of all remaining miscellaneous Nodes that \" +\r\n \"are not actively being targeted will increase by a fixed percentage.<br><br>\" +\r\n \"-Whenever a Node is conquered, its stats are significantly reduced<br><br>\" +\r\n \"-Miscellaneous Nodes slowly raise their defense over time<br><br>\" +\r\n \"-Nodes slowly regenerate health over time.\",\r\n\r\n\r\n //Gang constants\r\n GangRespectToReputationRatio: 2, //Respect is divided by this to get rep gain\r\n MaximumGangMembers: 20,\r\n GangRecruitCostMultiplier: 2,\r\n GangTerritoryUpdateTimer: 150,\r\n\r\n MillisecondsPer20Hours: 72000000,\r\n GameCyclesPer20Hours: 72000000 / 200,\r\n\r\n MillisecondsPer10Hours: 36000000,\r\n GameCyclesPer10Hours: 36000000 / 200,\r\n\r\n MillisecondsPer8Hours: 28800000,\r\n GameCyclesPer8Hours: 28800000 / 200,\r\n\r\n MillisecondsPer4Hours: 14400000,\r\n GameCyclesPer4Hours: 14400000 / 200,\r\n\r\n MillisecondsPer2Hours: 7200000,\r\n GameCyclesPer2Hours: 7200000 / 200,\r\n\r\n MillisecondsPerHour: 3600000,\r\n GameCyclesPerHour: 3600000 / 200,\r\n\r\n MillisecondsPerHalfHour: 1800000,\r\n GameCyclesPerHalfHour: 1800000 / 200,\r\n\r\n MillisecondsPerQuarterHour: 900000,\r\n GameCyclesPerQuarterHour: 900000 / 200,\r\n\r\n MillisecondsPerFiveMinutes: 300000,\r\n GameCyclesPerFiveMinutes: 300000 / 200,\r\n\r\n FactionWorkHacking: \"Faction Hacking Work\",\r\n FactionWorkField: \"Faction Field Work\",\r\n FactionWorkSecurity: \"Faction Security Work\",\r\n\r\n WorkTypeCompany: \"Working for Company\",\r\n WorkTypeCompanyPartTime: \"Working for Company part-time\",\r\n WorkTypeFaction: \"Working for Faction\",\r\n WorkTypeCreateProgram: \"Working on Create a Program\",\r\n WorkTypeStudyClass: \"Studying or Taking a class at university\",\r\n WorkTypeCrime: \"Committing a crime\",\r\n\r\n ClassStudyComputerScience: \"studying Computer Science\",\r\n ClassDataStructures: \"taking a Data Structures course\",\r\n ClassNetworks: \"taking a Networks course\",\r\n ClassAlgorithms: \"taking an Algorithms course\",\r\n ClassManagement: \"taking a Management course\",\r\n ClassLeadership: \"taking a Leadership course\",\r\n ClassGymStrength: \"training your strength at a gym\",\r\n ClassGymDefense: \"training your defense at a gym\",\r\n ClassGymDexterity: \"training your dexterity at a gym\",\r\n ClassGymAgility: \"training your agility at a gym\",\r\n\r\n ClassDataStructuresBaseCost: 40,\r\n ClassNetworksBaseCost: 80,\r\n ClassAlgorithmsBaseCost: 320,\r\n ClassManagementBaseCost: 160,\r\n ClassLeadershipBaseCost: 320,\r\n ClassGymBaseCost: 120,\r\n\r\n CrimeSingFnDivider: 2, //Factor by which exp/profit is reduced when commiting crime through Sing Fn\r\n CrimeShoplift: \"shoplift\",\r\n CrimeRobStore: \"rob a store\",\r\n CrimeMug: \"mug someone\",\r\n CrimeLarceny: \"commit larceny\",\r\n CrimeDrugs: \"deal drugs\",\r\n CrimeBondForgery: \"forge corporate bonds\",\r\n CrimeTraffickArms: \"traffick illegal arms\",\r\n CrimeHomicide: \"commit homicide\",\r\n CrimeGrandTheftAuto: \"commit grand theft auto\",\r\n CrimeKidnap: \"kidnap someone for ransom\",\r\n CrimeAssassination: \"assassinate a high-profile target\",\r\n CrimeHeist: \"pull off the ultimate heist\",\r\n\r\n /* Tutorial related things */\r\n TutorialNetworkingText: \"Servers are a central part of the game. You start with a single personal server (your home computer) \" +\r\n \"and you can purchase additional servers as you progress through the game. Connecting to other servers \" +\r\n \"and hacking them can be a major source of income and experience. Servers can also be used to run \" +\r\n \"scripts which can automatically hack servers for you. <br><br>\" +\r\n \"In order to navigate between machines, use the 'scan' or 'scan-analyze' Terminal command to see all servers \" +\r\n \"that are reachable from your current server. Then, you can use the 'connect [hostname/ip]' \" +\r\n \"command to connect to one of the available machines. <br><br>\" +\r\n \"The 'hostname' and 'ifconfig' commands can be used to display the hostname/IP of the \" +\r\n \"server you are currently connected to.\",\r\n\r\n TutorialHackingText: \"In the year 2077, currency has become digital and decentralized. People and corporations \" +\r\n \"store their money on servers. By hacking these servers, you can steal their money and gain \" +\r\n \"experience. <br><br>\" +\r\n \"<h1>Gaining root access</h1> <br>\" +\r\n \"The key to hacking a server is to gain root access to that server. This can be done using \" +\r\n \"the NUKE virus (NUKE.exe). You start the game with a copy of the NUKE virus on your home \" +\r\n \"computer. The NUKE virus attacks the target server's open ports using buffer overflow \" +\r\n \"exploits. When successful, you are granted root administrative access to the machine. <br><br>\" +\r\n \"Typically, in order for the NUKE virus to succeed, the target server needs to have at least \" +\r\n \"one of its ports opened. Some servers have no security and will not need any ports opened. Some \" +\r\n \"will have very high security and will need many ports opened. In order to open ports on another \" +\r\n \"server, you will need to run programs that attack the server to open specific ports. These programs \" +\r\n \"can be coded once your hacking skill gets high enough, or they can be purchased if you can find \" +\r\n \"a seller. <br><br>\" +\r\n \"In order to determine how many ports need to be opened to successfully NUKE a server, connect to \" +\r\n \"that server and run the 'analyze' command. This will also show you which ports have already been \" +\r\n \"opened. <br><br>\" +\r\n \"Once you have enough ports opened and have ran the NUKE virus to gain root access, the server \" +\r\n \"can then be hacked by simply calling the 'hack' command through terminal, or by using a script.<br><br>\" +\r\n \"<h1>Hacking mechanics</h1><br>\" +\r\n \"When you execute the hack command, either manually through the terminal or automatically through \" +\r\n \"a script, you attempt to hack the server. This action takes time. The more advanced a server's \" +\r\n \"security is, the more time it will take. Your hacking skill level also affects the hacking time, \" +\r\n \"with a higher hacking skill leading to shorter hacking times. Also, running the hack command \" +\r\n \"manually through terminal is faster than hacking from a script. <br><br>\" +\r\n \"Your attempt to hack a server will not always succeed. The chance you have to successfully hack a \" +\r\n \"server is also determined by the server's security and your hacking skill level. Even if your \" +\r\n \"hacking attempt is unsuccessful, you will still gain experience points. <br><br>\" +\r\n \"When you successfully hack a server. You steal a certain percentage of that server's total money. This \" +\r\n \"percentage is determined by the server's security and your hacking skill level. The amount of money \" +\r\n \"on a server is not limitless. So, if you constantly hack a server and deplete its money, then you will \" +\r\n \"encounter diminishing returns in your hacking (since you are only hacking a certain percentage). You can \" +\r\n \"increase the amount of money on a server using a script and the grow() function in Netscript.<br><br>\" +\r\n \"<h1>Server Security</h1><br>\" +\r\n \"Each server has a security level, typically between 1 and 100. A higher number means the server has stronger security. \" +\r\n \"It is possible for a server to have a security level of 100 or higher, in which case hacking that server \" +\r\n \"will become impossible (0% chance to hack).<br><br>\" +\r\n \"As mentioned above, a server's security level is an important factor \" +\r\n \"to consider when hacking. You can check a server's security level using the 'analyze' command, although this \" +\r\n \"only gives an estimate (with 5% uncertainty). You can also check a server's security in a script, using the \" +\r\n \"<i>getServerSecurityLevel(server)</i> function in Netscript. See the Netscript documentation for more details. \" +\r\n \"This function will give you an exact value for a server's security. <br><br>\" +\r\n \"Whenever a server is hacked manually or through a script, its security level increases by a small amount. Calling \" +\r\n \"the grow() command in a script will also increase security level of the target server. These actions will \" +\r\n \"make it harder for you to hack the server, and decrease the amount of money you can steal. You can lower a \" +\r\n \"server's security level in a script using the <i>weaken(server)</i> function in Netscript. See the Netscript \" +\r\n \"documentation for more details.<br><br>\" +\r\n \"A server has a minimum security level that is equal to one third of its starting security, rounded to the \" +\r\n \"nearest integer. To be more precise:<br><br>\" +\r\n \"server.minSecurityLevel = Math.max(1, Math.round(server.startingSecurityLevel / 3))<br><br>\" +\r\n \"This means that a server's security will not fall below this value if you are trying to weaken it.\",\r\n\r\n TutorialScriptsText: \"Scripts can be used to automate the hacking process. Scripts must be written in the Netscript language. \" +\r\n \"Documentation about the Netscript language can be found in the 'Netscript Programming Language' \" +\r\n \"section of this 'Tutorial' page. <br><br> \" +\r\n \"<strong>It is highly recommended that you have a basic background in programming to start writing scripts. \" +\r\n \"You by no means need to be an expert. All you need is some familiarity with basic programming \" +\r\n \"constructs like for/while loops, if statements, \" +\r\n \"functions, variables, etc. The Netscript programming language most resembles the Javascript language. \" +\r\n \"Therefore, a good beginner's programming tutorial to read might be <a href='https://www.w3schools.com/js/default.asp' target='_blank'>\" +\r\n \"this one</a>. Note that while the Netscript language is similar to Javascript, it is not the exact same, so the \" +\r\n \"syntax will vary a little bit. </strong> <br><br>\" +\r\n \"Running a script requires RAM. The more complex a script is, the more RAM \" +\r\n \"it requires to run. Scripts can be run on any server you have root access to. <br><br>\" +\r\n \"Here are some Terminal commands that are useful when working with scripts: <br><br>\" +\r\n \"<i>check [script] [args...]</i><br>Prints the logs of the script specified by the name and arguments to Terminal. Arguments should be separated \" +\r\n \"by a space. Note that scripts are uniquely \" +\r\n \"identified by their arguments as well as their name. For example, if you ran a script 'foo.script' with the argument 'foodnstuff' then in order to 'check' it you must \" +\r\n \"also add the 'foodnstuff' argument to the check command as so: <br>check foo.script foodnstuff<br><br>\" +\r\n \"<i>free</i><br>Shows the current server's RAM usage and availability <br><br>\" +\r\n \"<i>kill [script] [args...]</i><br>Stops a script that is running with the specified script name and arguments. \" +\r\n \"Arguments should be separated by a space. Note that \" +\r\n \"scripts are uniquely identified by their arguments as well as their name. For example, if you ran a script 'foo.script' with the \" +\r\n \"argument 1 and 2, then just typing 'kill foo.script' will not work. You have to use 'kill foo.script 1 2'. <br><br>\" +\r\n \"<i>mem [script] [-t] [n]</i><br>Check how much RAM a script requires to run with n threads<br><br>\" +\r\n \"<i>nano [script]</i><br>Create/Edit a script. The name of the script must end with the '.script' extension <br><br>\" +\r\n \"<i>ps</i><br>Displays all scripts that are actively running on the current server<br><br>\" +\r\n \"<i>rm [script]</i><br>Delete a script<br><br>\" +\r\n \"<i>run [script] [-t] [n] [args...]</i><br>Run a script with n threads and the specified arguments. Each argument should be separated by a space. \" +\r\n \"Both the arguments and thread specification are optional. If neither are specified, then the script will be run single-threaded with no arguments.<br>\" +\r\n \"Examples:<br>run foo.script<br>The command above will run 'foo.script' single-threaded with no arguments.\" +\r\n \"<br>run foo.script -t 10<br>The command above will run 'foo.script' with 10 threads and no arguments.\" +\r\n \"<br>run foo.script foodnstuff sigma-cosmetics 10<br>The command above will run 'foo.script' single-threaded with three arguments: [foodnstuff, sigma-cosmetics, 10]\" +\r\n \"<br>run foo.script -t 50 foodnstuff<br>The command above will run 'foo.script' with 50 threads and a single argument: [foodnstuff]<br><br>\" +\r\n \"<i>tail [script] [args...]</i><br>Displays the logs of the script specified by the name and arguments. Note that scripts are uniquely \" +\r\n \"identified by their arguments as well as their name. For example, if you ran a script 'foo.script' with the argument 'foodnstuff' then in order to 'tail' it you must \" +\r\n \"also add the 'foodnstuff' argument to the tail command as so: <br>tail foo.script foodnstuff<br><br>\" +\r\n \"<i>top</i><br>Displays all active scripts and their RAM usage <br><br>\" +\r\n \"<u><h1> Multithreading scripts </h1></u><br>\" +\r\n \"Scripts can be multithreaded. A multithreaded script runs the script's code once in each thread. The result is that \" +\r\n \"every call to the hack(), grow(), and weaken() Netscript functions will have its effect multiplied by the number of threads. \" +\r\n \"For example, if a normal single-threaded script is able to hack $10,000, then running the same script with 5 threads would \" +\r\n \"yield $50,000. <br><br> \" +\r\n \"When multithreading a script, the total RAM cost can be calculated by simply multiplying the base RAM cost of the script \" +\r\n \"with the number of threads, where the base cost refers to the amount of RAM required to run the script single-threaded. \" +\r\n \"In the terminal, you can run the \" +\r\n \"'mem [scriptname] -t n' command to see how much RAM a script requires with n threads. <br><br>\" +\r\n \"Every method for running a script has an option for making it multihreaded. To run a script with \" +\r\n \"n threads from a Terminal: <br>\" +\r\n \"run [scriptname] -t n<br><br>\" +\r\n \"Using Netscript commands: <br>\" +\r\n \"run('scriptname.script', n);<br> \" +\r\n \"exec('scriptname.script, 'targetServer', n);<br><br>\" +\r\n \"<u><h1> Notes about how scripts work offline </h1> </u><br>\" +\r\n \"<strong> The scripts that you write and execute are interpreted in Javascript. For this \" +\r\n \"reason, it is not possible for these scripts to run while offline (when the game is closed). \" +\r\n \"It is important to note that for this reason, conditionals such as if/else statements and certain \" +\r\n \"commands such as purchaseHacknetNode() or nuke() will not work while the game is offline.<br><br>\" +\r\n \"However, Scripts WILL continue to generate money and hacking exp for you while the game is offline. This \" +\r\n \"offline production is based off of the scripts' production while the game is online. <br><br>\" +\r\n \"grow() and weaken() are two Netscript commands that will also be applied when the game is offline, although at a slower rate \" +\r\n \"compared to if the game was open. This is done by having each script keep track of the \" +\r\n \"rate at which the grow() and weaken() commands are called when the game is online. These calculated rates are used to determine how many times \" +\r\n \"these function calls would be made while the game is offline. <br><br> \" +\r\n \"Also, note that because of the way the Netscript interpreter is implemented, \" +\r\n \"whenever you reload or re-open the game all of the scripts that you are running will \" +\r\n \"start running from the BEGINNING of the code. The game does not keep track of where exactly \" +\r\n \"the execution of a script is when it saves/loads. </strong><br><br>\",\r\n TutorialNetscriptText: \"Netscript is a programming language implemented for this game. There are two versions of Netscript: \" +\r\n \"Netscript 1.0 and Netscript 2.0 (NetscriptJS).<br><br>\" +\r\n \"<a href='https://bitburner.readthedocs.io/en/latest/index.html' target='_blank'>Click here for Bitburner's official Netscript documentation</a>\",\r\n TutorialTravelingText:\"There are six major cities in the world that you are able to travel to: <br><br> \" +\r\n \" Aevum<br>\" +\r\n \" Chongqing<br>\" +\r\n \" Sector-12<br>\" +\r\n \" New Tokyo<br>\" +\r\n \" Ishima<br>\" +\r\n \" Volhaven<br><br>\" +\r\n \"To travel between cities, visit your current city's travel agency through the 'World' page. \" +\r\n \"From the travel agency you can travel to any other city. Doing so costs money. <br><br>\" +\r\n \"Each city has its own set of companies and unique locations. Also, certain content is only available to you \" +\r\n \"if you are in certain cities, so get exploring!\",\r\n TutorialCompaniesText: \"Hacking is not the only way to gain money and experience! Located around the world are many \" +\r\n \"different companies which you can work for. By working for a company you can earn money, \" +\r\n \"train your various labor skills, and unlock powerful passive perks. <br><br> \" +\r\n \"To apply for a job, visit the company you want to work for through the 'World' menu. The company \" +\r\n \"page will have options that let you apply to positions in the company. There might be several different \" +\r\n \"positions you can apply for, ranging from software engineer to business analyst to security officer. <br><br> \" +\r\n \"When you apply for a job, you will get the offer if your stats are high enough. Your first position at \" +\r\n \"a company will be an entry-level position such as 'intern'. Once you get the job, an button will appear on \" +\r\n \"the company page that allows you to work for the company. Click this button to start working. <br><br>\" +\r\n \"Working occurs in 8 hour shifts. Once you start working, you will begin earning money, experience, \" +\r\n \"and reputation. The rate at which you money and experience depends on the company and your position. \" +\r\n \"The amount of reputation you gain for your company is based on your job performance, which is affected by \" +\r\n \"your stats. Different positions value different stats. When you are working, you are unable to perform any \" +\r\n \"other actions such as using your terminal or visiting other locations (However, note that any scripts you have \" +\r\n \"running on servers will continue to run as you work!). It is possible to cancel your work shift before the \" +\r\n \"8 hours is up. However, if you have a full-time job, then cancelling a shift early will result in you gaining \" +\r\n \"only half of the reputation \" +\r\n \"that you had earned up to that point. There are also part-time/consultant jobs available where you will not \" +\r\n \" be penalized if you cancel a work shift early. However, these positions pay less than full-time positions.<br><br>\" +\r\n \"As you continue to work at a company, you will gain more and more reputation at that company. When your stats \" +\r\n \"and reputation are high enough, you can get a promotion. You can apply for a promotion on the company page, just like \" +\r\n \"you applied for the job originally. Higher positions at a company provide better salaries and stat gains.<br><br>\" +\r\n \"<h1>Infiltrating Companies</h1><br>\" +\r\n \"Many companies have facilities that you can attempt to infiltrate. By infiltrating, you can steal classified company secrets \" +\r\n \"and then sell these for money or for faction reputation. To try and infiltrate a company, visit a company through the \" +\r\n \"'World' menu. There will be an option that says 'Infiltrate Company'. <br><br>\" +\r\n \"When infiltrating a company, you must progress through clearance levels in the facility. Every clearance level \" +\r\n \"has some form of security that you must get past. There are several forms of security, ranging from high-tech security systems to \" +\r\n \"armed guards. For each form of security, there are a variety of options that you can choose to try and bypass the security. Examples \" +\r\n \"include hacking the security, engaging in combat, assassination, or sneaking past the security. The chance to succeed for each option \" +\r\n \"is determined in part by your stats. So, for example, trying to hack the security system relies on your hacking skill, whereas trying to \" +\r\n \"sneak past the security relies on your agility level.<br><br>\" +\r\n \"The facility has a 'security level' that affects your chance of success when trying to get past a clearance level. \" +\r\n \"Every time you advance to the next clearance level, the facility's security level will increase by a fixed amount. Furthermore \" +\r\n \"the options you choose and whether you succeed or fail will affect the security level as well. For example, \" +\r\n \"if you try to kill a security guard and fail, the security level will increase by a lot. If you choose to sneak past \" +\r\n \"security and succeed, the security level will not increase at all. <br><br>\" +\r\n \"Every 5 clearance levels, you will steal classified company secrets that can be sold for money or faction reputation. However, \" +\r\n \"in order to sell these secrets you must successfully escape the facility using the 'Escape' option. Furthermore, companies have \" +\r\n \"a max clearance level. If you reach the max clearance level you will automatically escape the facility with all of your \" +\r\n \"stolen secrets.<br><br>\",\r\n TutorialFactionsText: \"Throughout the game you may receive invitations from factions. There are many different factions, and each faction \" +\r\n \"has different criteria for determining its potential members. Joining a faction and furthering its cause is crucial \" +\r\n \"to progressing in the game and unlocking endgame content. <br><br> \" +\r\n \"It is possible to join multiple factions if you receive invitations from them. However, note that joining a faction \" +\r\n \"may prevent you from joining other rival factions. <br><br> \" +\r\n \"The 'Factions' link on the menu brings up a list of all factions that you have joined. \" +\r\n \"You can select a Faction on this list to go to that Faction page. This page displays general \" +\r\n \"information about the Faction and also lets you perform work for the faction. \" +\r\n \"Working for a Faction is similar to working for a company except that you don't get paid a salary. \" +\r\n \"You will only earn reputation in your Faction and train your stats. Also, cancelling work early \" +\r\n \"when working for a Faction does NOT result in reduced experience/reputation earnings. <br><br>\" +\r\n \"Earning reputation for a Faction unlocks powerful Augmentations. Purchasing and installing these Augmentations will \" +\r\n \"upgrade your abilities. The Augmentations that are available to unlock vary from faction to faction.\",\r\n TutorialAugmentationsText: \"Advances in science and medicine have lead to powerful new technologies that allow people to augment themselves \" +\r\n \"beyond normal human capabilities. There are many different types of Augmentations, ranging from cybernetic to \" +\r\n \"genetic to biological. Acquiring these Augmentations enhances the user's physical and mental faculties. <br><br>\" +\r\n \"Because of how powerful these Augmentations are, the technology behind them is kept private and secret by the \" +\r\n \"corporations and organizations that create them. Therefore, the only way for the player to obtain Augmentations is \" +\r\n \"through Factions. After joining a Faction and earning enough reputation in it, you will be able to purchase \" +\r\n \"its Augmentations. Different Factions offer different Augmentations. Augmentations must be purchased in order to be installed, \" +\r\n \"and they are fairly expensive. <br><br>\" +\r\n \"When you purchase an Augmentation, the price of purchasing another Augmentation increases by 90%. This multiplier stacks for \" +\r\n \"each Augmentation you purchase. You will not gain the benefits of your purchased Augmentations until you install them. You can \" +\r\n \"choose to install Augmentations through the 'Augmentations' menu tab. Once you install your purchased Augmentations, \" +\r\n \"their costs are reset back to the original price.<br><br>\" +\r\n \"Unfortunately, installing Augmentations has side effects. You will lose most of the progress you've made, including your \" +\r\n \"skills, stats, and money. You will have to start over, but you will have all of the Augmentations you have installed to \" +\r\n \"help you progress. <br><br> \" +\r\n \"To summarize, here is a list of everything you will LOSE when you install an Augmentation: <br><br>\" +\r\n \"Stats/Skills<br>\" +\r\n \"Money<br>\" +\r\n \"Scripts on all servers EXCEPT your home computer<br>\" +\r\n \"Purchased servers<br>\" +\r\n \"Hacknet Nodes<br>\" +\r\n \"Company/faction reputation<br>\" +\r\n \"Jobs and Faction memberships<br>\" +\r\n \"Programs<br>\" +\r\n \"Stocks<br>\" +\r\n \"TOR router<br><br>\" +\r\n \"Here is everything you will KEEP when you install an Augmentation: <br><br>\" +\r\n \"Every Augmentation you have installed<br>\" +\r\n \"Scripts on your home computer<br>\" +\r\n \"RAM and CPU Core Upgrades on your home computer<br>\" +\r\n \"World Stock Exchange account and TIX API Access<br>\",\r\n\r\n LatestUpdate:\r\n \"v0.37.3<br>\" +\r\n \"* New BitNode: BN-7 Bladeburner 2079<br>\" + \r\n \"* New BitNode: BN-12 The Recursion<br>\" +\r\n \"* Bladeburner Changes:<br>\" +\r\n \"*** Bladeburner progress is no longer reset when installing Augmentations<br>\" +\r\n \"*** The number of successess needed to increase a Contract/Operation's max level now scales with the current max level (gradually gets harder)<br>\" +\r\n \"*** All Bladeburner Augmentations are now slightly more expensive and require more reputation<br>\" +\r\n \"*** Black Operations now give higher rank rewards<br>\" +\r\n \"*** Doubled the base amount of money gained from Contracts<br>\" +\r\n \"* Hacking is not slightly less profitable in BitNode-3<br>\" +\r\n \"* Updated Hacknet Nodes UI - Implemented by Github user kopelli<br>\" +\r\n \"* Bug Fix: Fixed an exploit that allowed calling any Netscript function without incurring any RAM Cost in NetscriptJS<br>\"\r\n}\r\n\r\nexport {CONSTANTS};\r\n","import {Bladeburner} from \"./Bladeburner.js\";\r\nimport {CompanyPositions, initCompanies,\r\n Companies, getJobRequirementText} from \"./Company.js\";\r\nimport {Corporation} from \"./CompanyManagement.js\";\r\nimport {CONSTANTS} from \"./Constants.js\";\r\nimport {Crimes} from \"./Crimes.js\";\r\nimport {Engine} from \"./engine.js\";\r\nimport {beginInfiltration} from \"./Infiltration.js\";\r\nimport {hasBladeburnerSF} from \"./NetscriptFunctions.js\";\r\nimport {Player} from \"./Player.js\";\r\nimport {Server, AllServers, AddToAllServers} from \"./Server.js\";\r\nimport {purchaseServer,\r\n purchaseRamForHomeComputer} from \"./ServerPurchases.js\";\r\nimport {SpecialServerNames, SpecialServerIps} from \"./SpecialServerIps.js\";\r\n\r\nimport {dialogBoxCreate} from \"../utils/DialogBox.js\";\r\nimport {clearEventListeners, createElement} from \"../utils/HelperFunctions.js\";\r\nimport {createRandomIp} from \"../utils/IPAddress.js\";\r\nimport numeral from \"numeral/min/numeral.min\";\r\nimport {formatNumber} from \"../utils/StringHelperFunctions.js\";\r\nimport {yesNoBoxCreate, yesNoTxtInpBoxCreate,\r\n yesNoBoxGetYesButton, yesNoBoxGetNoButton,\r\n yesNoTxtInpBoxGetYesButton, yesNoTxtInpBoxGetNoButton,\r\n yesNoTxtInpBoxGetInput, yesNoBoxClose,\r\n yesNoTxtInpBoxClose} from \"../utils/YesNoBox.js\";\r\n\r\n/* Display Location Content when visiting somewhere in the World*/\r\nvar Locations = {\r\n //Cities\r\n\tAevum: \t\t\t\"Aevum\",\r\n //AevumDesc: \"\"\r\n\tChongqing: \t\t\"Chongqing\",\r\n\tSector12: \t\t\"Sector-12\",\r\n\tNewTokyo: \t\t\"New Tokyo\",\r\n\tIshima: \t\t\"Ishima\",\r\n\tVolhaven: \t\t\"Volhaven\",\r\n\r\n //Aevum Locations\r\n AevumTravelAgency: \"Aevum Travel Agency\",\r\n AevumSummitUniversity: \"Summit University\",\r\n AevumECorp: \"ECorp\",\r\n AevumBachmanAndAssociates: \"Bachman & Associates\",\r\n AevumClarkeIncorporated: \"Clarke Incorporated\",\r\n AevumFulcrumTechnologies: \"Fulcrum Technologies\",\r\n AevumAeroCorp: \"AeroCorp\",\r\n AevumGalacticCybersystems: \"Galactic Cybersystems\",\r\n AevumWatchdogSecurity: \"Watchdog Security\",\r\n AevumRhoConstruction: \"Rho Construction\",\r\n AevumPolice: \"Aevum Police Headquarters\",\r\n AevumNetLinkTechnologies: \"NetLink Technologies\",\r\n AevumCrushFitnessGym: \"Crush Fitness Gym\",\r\n AevumSnapFitnessGym: \"Snap Fitness Gym\",\r\n AevumSlums: \"Aevum Slums\",\r\n\r\n //Chongqing locations\r\n ChongqingTravelAgency: \"Chongqing Travel Agency\",\r\n ChongqingKuaiGongInternational: \"KuaiGong International\",\r\n ChongqingSolarisSpaceSystems: \"Solaris Space Systems\",\r\n ChongqingSlums: \"Chongqing Slums\",\r\n\r\n //Sector 12\r\n Sector12TravelAgency: \"Sector-12 Travel Agency\",\r\n Sector12RothmanUniversity: \"Rothman University\",\r\n Sector12MegaCorp: \"MegaCorp\",\r\n Sector12BladeIndustries: \"Blade Industries\",\r\n Sector12FourSigma: \"Four Sigma\",\r\n Sector12IcarusMicrosystems: \"Icarus Microsystems\",\r\n Sector12UniversalEnergy: \"Universal Energy\",\r\n Sector12DeltaOne: \"DeltaOne\",\r\n Sector12CIA: \"Central Intelligence Agency\",\r\n Sector12NSA: \"National Security Agency\",\r\n Sector12AlphaEnterprises: \"Alpha Enterprises\",\r\n Sector12CarmichaelSecurity: \"Carmichael Security\",\r\n Sector12FoodNStuff: \"FoodNStuff\",\r\n Sector12JoesGuns: \"Joe's Guns\",\r\n Sector12IronGym: \"Iron Gym\",\r\n Sector12PowerhouseGym: \"Powerhouse Gym\",\r\n Sector12Slums: \"Sector-12 Slums\",\r\n Sector12CityHall: \"Sector-12 City Hall\",\r\n\r\n //New Tokyo\r\n NewTokyoTravelAgency: \"New Tokyo Travel Agency\",\r\n NewTokyoDefComm: \"DefComm\",\r\n NewTokyoVitaLife: \"VitaLife\",\r\n NewTokyoGlobalPharmaceuticals: \"Global Pharmaceuticals\",\r\n NewTokyoNoodleBar: \"Noodle Bar\",\r\n NewTokyoSlums: \"New Tokyo Slums\",\r\n\r\n //Ishima\r\n IshimaTravelAgency: \"Ishima Travel Agency\",\r\n IshimaStormTechnologies: \"Storm Technologies\",\r\n IshimaNovaMedical: \"Nova Medical\",\r\n IshimaOmegaSoftware: \"Omega Software\",\r\n IshimaSlums: \"Ishima Slums\",\r\n\r\n //Volhaven\r\n VolhavenTravelAgency: \"Volhaven Travel Agency\",\r\n VolhavenZBInstituteOfTechnology: \"ZB Institute of Technology\",\r\n VolhavenOmniTekIncorporated: \"OmniTek Incorporated\",\r\n VolhavenNWO: \"NWO\",\r\n VolhavenHeliosLabs: \"Helios Labs\",\r\n VolhavenOmniaCybersystems: \"Omnia Cybersystems\",\r\n VolhavenLexoCorp: \"LexoCorp\",\r\n VolhavenSysCoreSecurities: \"SysCore Securities\",\r\n VolhavenCompuTek: \"CompuTek\",\r\n VolhavenMilleniumFitnessGym: \"Millenium Fitness Gym\",\r\n VolhavenSlums: \"Volhaven Slums\",\r\n\r\n //Generic locations\r\n Hospital: \"Hospital\",\r\n WorldStockExchange: \"World Stock Exchange\",\r\n}\r\n\r\nfunction displayLocationContent() {\r\n\tif (Engine.debug) {\r\n\t\tconsole.log(\"displayLocationContent() called with location \" + Player.location)\r\n\t}\r\n\r\n var returnToWorld = document.getElementById(\"location-return-to-world-button\");\r\n\r\n var locationName = document.getElementById(\"location-name\");\r\n\r\n var locationInfo = document.getElementById(\"location-info\");\r\n\r\n var softwareJob = document.getElementById(\"location-software-job\");\r\n var softwareConsultantJob = document.getElementById(\"location-software-consultant-job\")\r\n var itJob = document.getElementById(\"location-it-job\");\r\n var securityEngineerJob = document.getElementById(\"location-security-engineer-job\");\r\n var networkEngineerJob = document.getElementById(\"location-network-engineer-job\");\r\n var businessJob = document.getElementById(\"location-business-job\");\r\n var businessConsultantJob = document.getElementById(\"location-business-consultant-job\");\r\n var securityJob = document.getElementById(\"location-security-job\");\r\n var agentJob = document.getElementById(\"location-agent-job\");\r\n var employeeJob = document.getElementById(\"location-employee-job\");\r\n var employeePartTimeJob = document.getElementById(\"location-parttime-employee-job\");\r\n var waiterJob = document.getElementById(\"location-waiter-job\");\r\n var waiterPartTimeJob = document.getElementById(\"location-parttime-waiter-job\");\r\n\r\n var work = clearEventListeners(\"location-work\");\r\n\r\n\tvar jobTitle \t\t\t = document.getElementById(\"location-job-title\");\r\n\tvar jobReputation \t\t = document.getElementById(\"location-job-reputation\");\r\n var companyFavor = document.getElementById(\"location-company-favor\");\r\n var locationTxtDiv1 = document.getElementById(\"location-text-divider-1\");\r\n var locationTxtDiv2 = document.getElementById(\"location-text-divider-2\");\r\n var locationTxtDiv3 = document.getElementById(\"location-text-divider-3\");\r\n\r\n var gymTrainStr = document.getElementById(\"location-gym-train-str\");\r\n var gymTrainDef = document.getElementById(\"location-gym-train-def\");\r\n var gymTrainDex = document.getElementById(\"location-gym-train-dex\");\r\n var gymTrainAgi = document.getElementById(\"location-gym-train-agi\");\r\n\r\n var studyComputerScience = document.getElementById(\"location-study-computer-science\");\r\n var classDataStructures = document.getElementById(\"location-data-structures-class\");\r\n var classNetworks = document.getElementById(\"location-networks-class\");\r\n var classAlgorithms = document.getElementById(\"location-algorithms-class\");\r\n var classManagement = document.getElementById(\"location-management-class\");\r\n var classLeadership = document.getElementById(\"location-leadership-class\");\r\n\r\n var purchase2gb = document.getElementById(\"location-purchase-2gb\");\r\n var purchase4gb = document.getElementById(\"location-purchase-4gb\");\r\n var purchase8gb = document.getElementById(\"location-purchase-8gb\");\r\n var purchase16gb = document.getElementById(\"location-purchase-16gb\");\r\n var purchase32gb = document.getElementById(\"location-purchase-32gb\");\r\n var purchase64gb = document.getElementById(\"location-purchase-64gb\");\r\n var purchase128gb = document.getElementById(\"location-purchase-128gb\");\r\n var purchase256gb = document.getElementById(\"location-purchase-256gb\");\r\n var purchase512gb = document.getElementById(\"location-purchase-512gb\");\r\n var purchase1tb = document.getElementById(\"location-purchase-1tb\");\r\n var purchaseTor = document.getElementById(\"location-purchase-tor\");\r\n var purchaseHomeRam = document.getElementById(\"location-purchase-home-ram\");\r\n var purchaseHomeCores = document.getElementById(\"location-purchase-home-cores\");\r\n\r\n var travelAgencyText = document.getElementById(\"location-travel-agency-text\");\r\n var travelToAevum = document.getElementById(\"location-travel-to-aevum\");\r\n var travelToChongqing = document.getElementById(\"location-travel-to-chongqing\");\r\n var travelToSector12 = document.getElementById(\"location-travel-to-sector12\");\r\n var travelToNewTokyo = document.getElementById(\"location-travel-to-newtokyo\");\r\n var travelToIshima = document.getElementById(\"location-travel-to-ishima\");\r\n var travelToVolhaven = document.getElementById(\"location-travel-to-volhaven\");\r\n\r\n var infiltrate = clearEventListeners(\"location-infiltrate\");\r\n\r\n var hospitalTreatment = document.getElementById(\"location-hospital-treatment\");\r\n\r\n var slumsDescText = document.getElementById(\"location-slums-description\");\r\n var slumsShoplift = document.getElementById(\"location-slums-shoplift\");\r\n var slumsRobStore = document.getElementById(\"location-slums-rob-store\");\r\n var slumsMug = document.getElementById(\"location-slums-mug\");\r\n var slumsLarceny = document.getElementById(\"location-slums-larceny\");\r\n var slumsDealDrugs = document.getElementById(\"location-slums-deal-drugs\");\r\n var slumsBondForgery = document.getElementById(\"location-slums-bond-forgery\");\r\n var slumsTrafficArms = document.getElementById(\"location-slums-traffic-arms\");\r\n var slumsHomicide = document.getElementById(\"location-slums-homicide\");\r\n var slumsGta = document.getElementById(\"location-slums-gta\");\r\n var slumsKidnap = document.getElementById(\"location-slums-kidnap\");\r\n var slumsAssassinate = document.getElementById(\"location-slums-assassinate\");\r\n var slumsHeist = document.getElementById(\"location-slums-heist\");\r\n\r\n var cityHallCreateCorporation = document.getElementById(\"location-cityhall-create-corporation\");\r\n\r\n var nsaBladeburner = document.getElementById(\"location-nsa-bladeburner\");\r\n\r\n var loc = Player.location;\r\n\r\n returnToWorld.addEventListener(\"click\", function() {\r\n Engine.loadWorldContent();\r\n });\r\n\r\n locationName.innerHTML = loc;\r\n locationName.style.display = \"block\";\r\n\r\n locationInfo.style.display = \"block\";\r\n\r\n softwareJob.style.display = \"none\";\r\n softwareConsultantJob.style.display = \"none\";\r\n itJob.style.display = \"none\";\r\n securityEngineerJob.style.display = \"none\";\r\n networkEngineerJob.style.display = \"none\";\r\n businessJob.style.display = \"none\";\r\n businessConsultantJob.style.display = \"none\";\r\n securityJob.style.display = \"none\";\r\n agentJob.style.display = \"none\";\r\n employeeJob.style.display = \"none\";\r\n employeePartTimeJob.style.display = \"none\";\r\n waiterJob.style.display = \"none\";\r\n waiterPartTimeJob.style.display = \"none\";\r\n\r\n softwareJob.innerHTML = \"Apply for Software Job\";\r\n softwareConsultantJob.innerHTML = \"Apply for a Software Consultant job\";\r\n itJob.innerHTML = \"Apply for IT Job\";\r\n securityEngineerJob.innerHTML = \"Apply for Security Engineer Job\";\r\n networkEngineerJob.innerHTML = \"Apply for Network Engineer Job\";\r\n businessJob.innerHTML = \"Apply for Business Job\";\r\n businessConsultantJob.innerHTML = \"Apply for a Business Consultant Job\";\r\n securityJob.innerHTML = \"Apply for Security Job\";\r\n agentJob.innerHTML = \"Apply for Agent Job\";\r\n employeeJob.innerHTML = \"Apply to be an Employee\";\r\n employeePartTimeJob.innerHTML = \"Apply to be a Part-time Employee\";\r\n waiterJob.innerHTML = \"Apply to be a Waiter\";\r\n waiterPartTimeJob.innerHTML = \"Apply to be a Part-time Waiter\"\r\n\r\n work.style.display = \"none\";\r\n\r\n gymTrainStr.style.display = \"none\";\r\n gymTrainDef.style.display = \"none\";\r\n gymTrainDex.style.display = \"none\";\r\n gymTrainAgi.style.display = \"none\";\r\n\r\n studyComputerScience.style.display = \"none\";\r\n classDataStructures.style.display = \"none\";\r\n classNetworks.style.display = \"none\";\r\n classAlgorithms.style.display = \"none\";\r\n classManagement.style.display = \"none\";\r\n classLeadership.style.display = \"none\";\r\n\r\n purchase2gb.style.display = \"none\";\r\n purchase4gb.style.display = \"none\";\r\n purchase8gb.style.display = \"none\";\r\n purchase16gb.style.display = \"none\";\r\n purchase32gb.style.display = \"none\";\r\n purchase64gb.style.display = \"none\";\r\n purchase128gb.style.display = \"none\";\r\n purchase256gb.style.display = \"none\";\r\n purchase512gb.style.display = \"none\";\r\n purchase1tb.style.display = \"none\";\r\n purchaseTor.style.display = \"none\";\r\n purchaseHomeRam.style.display = \"none\";\r\n purchaseHomeCores.style.display = \"none\";\r\n\r\n purchase2gb.innerHTML = \"Purchase 2GB Server - $\" + formatNumber(2*CONSTANTS.BaseCostFor1GBOfRamServer, 2);\r\n purchase4gb.innerHTML = \"Purchase 4GB Server - $\" + formatNumber(4*CONSTANTS.BaseCostFor1GBOfRamServer, 2);\r\n purchase8gb.innerHTML = \"Purchase 8GB Server - $\" + formatNumber(8*CONSTANTS.BaseCostFor1GBOfRamServer, 2);\r\n purchase16gb.innerHTML = \"Purchase 16GB Server - $\" + formatNumber(16*CONSTANTS.BaseCostFor1GBOfRamServer, 2);\r\n purchase32gb.innerHTML = \"Purchase 32GB Server - $\" + formatNumber(32*CONSTANTS.BaseCostFor1GBOfRamServer, 2);\r\n purchase64gb.innerHTML = \"Purchase 64GB Server - $\" + formatNumber(64*CONSTANTS.BaseCostFor1GBOfRamServer, 2);\r\n purchase128gb.innerHTML = \"Purchase 128GB Server - $\" + formatNumber(128*CONSTANTS.BaseCostFor1GBOfRamServer, 2);\r\n purchase256gb.innerHTML = \"Purchase 256GB Server - $\" + formatNumber(256*CONSTANTS.BaseCostFor1GBOfRamServer, 2);\r\n purchase512gb.innerHTML = \"Purchase 512GB Server - $\" + formatNumber(512*CONSTANTS.BaseCostFor1GBOfRamServer, 2);\r\n purchase1tb.innerHTML = \"Purchase 1TB Server - $\" + formatNumber(1024*CONSTANTS.BaseCostFor1GBOfRamServer, 2);\r\n purchaseTor.innerHTML = \"Purchase TOR Router - $\" + formatNumber(CONSTANTS.TorRouterCost, 2);\r\n\r\n travelAgencyText.style.display = \"none\";\r\n travelToAevum.style.display = \"none\";\r\n travelToChongqing.style.display = \"none\";\r\n travelToSector12.style.display = \"none\";\r\n travelToNewTokyo.style.display = \"none\";\r\n travelToIshima.style.display = \"none\";\r\n travelToVolhaven.style.display = \"none\";\r\n\r\n infiltrate.style.display = \"none\";\r\n\r\n hospitalTreatment.style.display = \"none\";\r\n\r\n slumsDescText.style.display = \"none\";\r\n slumsShoplift.style.display = \"none\";\r\n slumsRobStore.style.display = \"none\";\r\n slumsMug.style.display = \"none\";\r\n slumsLarceny.style.display = \"none\";\r\n slumsDealDrugs.style.display = \"none\";\r\n slumsBondForgery.style.display = \"none\";\r\n slumsTrafficArms.style.display = \"none\";\r\n slumsHomicide.style.display = \"none\";\r\n slumsGta.style.display = \"none\";\r\n slumsKidnap.style.display = \"none\";\r\n slumsAssassinate.style.display = \"none\";\r\n slumsHeist.style.display = \"none\";\r\n\r\n cityHallCreateCorporation.style.display = \"none\";\r\n nsaBladeburner.style.display = \"none\";\r\n\r\n //Check if the player is employed at this Location. If he is, display the \"Work\" button,\r\n //update the job title, etc.\r\n if (loc != \"\" && loc === Player.companyName) {\r\n var company = Companies[loc];\r\n\r\n jobTitle.style.display = \"block\";\r\n jobReputation.style.display = \"inline\";\r\n companyFavor.style.display = \"inline\";\r\n locationTxtDiv1.style.display = \"block\";\r\n locationTxtDiv2.style.display = \"block\";\r\n locationTxtDiv3.style.display = \"block\";\r\n jobTitle.innerHTML = \"Job Title: \" + Player.companyPosition.positionName;\r\n var repGain = company.getFavorGain();\r\n if (repGain.length != 2) {repGain = 0;}\r\n repGain = repGain[0];\r\n jobReputation.innerHTML = \"Company reputation: \" + formatNumber(company.playerReputation, 4) +\r\n \"<span class='tooltiptext'>You will earn \" +\r\n formatNumber(repGain, 4) +\r\n \" faction favor upon resetting after installing an Augmentation</span>\";\r\n companyFavor.innerHTML = \"Company Favor: \" + formatNumber(company.favor, 4) +\r\n \"<span class='tooltiptext'>Company favor increases the rate at which \" +\r\n \"you earn reputation for this company by 1% per favor. Company favor \" +\r\n \"is gained whenever you reset after installing an Augmentation. The amount of \" +\r\n \"favor you gain depends on how much reputation you have with the company</span>\";\r\n work.style.display = \"block\";\r\n\r\n var currPos = Player.companyPosition;\r\n\r\n work.addEventListener(\"click\", function() {\r\n if (currPos.isPartTimeJob()) {\r\n Player.startWorkPartTime();\r\n } else {\r\n Player.startWork();\r\n }\r\n return false;\r\n });\r\n\r\n //Change the text for the corresponding position from \"Apply for X Job\" to \"Apply for promotion\"\r\n if (currPos.isSoftwareJob()) {\r\n softwareJob.innerHTML = \"Apply for a promotion (Software)\";\r\n } else if (currPos.isSoftwareConsultantJob()) {\r\n softwareConsultantJob.innerHTML = \"Apply for a promotion (Software Consultant)\";\r\n } else if (currPos.isITJob()) {\r\n itJob.innerHTML = \"Apply for a promotion (IT)\";\r\n } else if (currPos.isSecurityEngineerJob()) {\r\n securityEngineerJob.innerHTML = \"Apply for a promotion (Security Engineer)\";\r\n } else if (currPos.isNetworkEngineerJob()) {\r\n networkEngineerJob.innerHTML = \"Apply for a promotion (Network Engineer)\";\r\n } else if (currPos.isBusinessJob()) {\r\n businessJob.innerHTML = \"Apply for a promotion (Business)\";\r\n } else if (currPos.isBusinessConsultantJob()) {\r\n businessConsultantJob.innerHTML = \"Apply for a promotion (Business Consultant)\";\r\n } else if (currPos.isSecurityJob()) {\r\n securityJob.innerHTML = \"Apply for a promotion (Security)\";\r\n } else if (currPos.isAgentJob()) {\r\n agentJob.innerHTML = \"Apply for a promotion (Agent)\";\r\n }\r\n } else {\r\n\t\tjobTitle.style.display = \"none\";\r\n\t\tjobReputation.style.display = \"none\";\r\n companyFavor.style.display = \"none\";\r\n locationTxtDiv1.style.display = \"none\";\r\n locationTxtDiv2.style.display = \"none\";\r\n locationTxtDiv3.style.display = \"none\";\r\n\t}\r\n\r\n //Calculate hospital Cost\r\n if (Player.hp < 0) {Player.hp = 0;}\r\n var hospitalTreatmentCost = (Player.max_hp - Player.hp) * CONSTANTS.HospitalCostPerHp;\r\n\r\n //Set tooltip for job requirements\r\n setJobRequirementTooltip(loc, CompanyPositions.SoftwareIntern, softwareJob);\r\n setJobRequirementTooltip(loc, CompanyPositions.SoftwareConsultant, softwareConsultantJob);\r\n setJobRequirementTooltip(loc, CompanyPositions.ITIntern, itJob);\r\n setJobRequirementTooltip(loc, CompanyPositions.SecurityEngineer, securityEngineerJob);\r\n setJobRequirementTooltip(loc, CompanyPositions.NetworkEngineer, networkEngineerJob);\r\n setJobRequirementTooltip(loc, CompanyPositions.BusinessIntern, businessJob);\r\n setJobRequirementTooltip(loc, CompanyPositions.BusinessConsultant, businessConsultantJob);\r\n setJobRequirementTooltip(loc, CompanyPositions.SecurityGuard, securityJob);\r\n setJobRequirementTooltip(loc, CompanyPositions.FieldAgent, agentJob);\r\n setJobRequirementTooltip(loc, CompanyPositions.Employee, employeeJob);\r\n setJobRequirementTooltip(loc, CompanyPositions.PartTimeEmployee, employeePartTimeJob);\r\n setJobRequirementTooltip(loc, CompanyPositions.Waiter, waiterJob);\r\n setJobRequirementTooltip(loc, CompanyPositions.PartTimeWaiter, waiterPartTimeJob);\r\n\r\n switch (loc) {\r\n case Locations.AevumTravelAgency:\r\n travelAgencyText.style.display = \"block\";\r\n travelToChongqing.style.display = \"block\";\r\n travelToSector12.style.display = \"block\";\r\n travelToNewTokyo.style.display = \"block\";\r\n travelToIshima.style.display = \"block\";\r\n travelToVolhaven.style.display = \"block\";\r\n break;\r\n\r\n case Locations.AevumSummitUniversity:\r\n var costMult = 4, expMult = 3;\r\n displayUniversityLocationContent(costMult);\r\n setUniversityLocationButtons(costMult, expMult);\r\n break;\r\n\r\n case Locations.AevumECorp:\r\n\t\t\tlocationInfo.innerHTML = Companies[loc].info;\r\n\r\n softwareJob.style.display = \"block\";\r\n itJob.style.display = \"block\";\r\n securityEngineerJob.style.display = \"block\";\r\n networkEngineerJob.style.display = \"block\";\r\n businessJob.style.display = \"block\";\r\n securityJob.style.display = \"block\";\r\n\r\n purchase128gb.style.display = \"block\";\r\n purchase256gb.style.display = \"block\";\r\n purchase512gb.style.display = \"block\";\r\n purchase1tb.style.display = \"block\";\r\n purchaseTor.style.display = \"block\";\r\n purchaseHomeRam.style.display = \"block\";\r\n purchaseHomeCores.style.display = \"block\";\r\n setInfiltrateButton(infiltrate, Locations.AevumECorp,\r\n 6000, 116, 150, 8.5);\r\n break;\r\n\r\n case Locations.AevumBachmanAndAssociates:\r\n\t\t\tlocationInfo.innerHTML = Companies[loc].info;\r\n\r\n softwareJob.style.display = \"block\";\r\n itJob.style.display = \"block\";\r\n securityEngineerJob.style.display = \"block\";\r\n networkEngineerJob.style.display = \"block\";\r\n businessJob.style.display = \"block\";\r\n securityJob.style.display = \"block\";\r\n setInfiltrateButton(infiltrate, Locations.AevumBachmanAndAssociates,\r\n 1500, 42, 60, 5.75);\r\n break;\r\n\r\n case Locations.AevumClarkeIncorporated:\r\n\t\t\tlocationInfo.innerHTML = Companies[loc].info;\r\n\r\n softwareJob.style.display = \"block\";\r\n itJob.style.display = \"block\";\r\n securityEngineerJob.style.display = \"block\";\r\n networkEngineerJob.style.display = \"block\";\r\n businessJob.style.display = \"block\";\r\n securityJob.style.display = \"block\";\r\n setInfiltrateButton(infiltrate, Locations.AevumClarkeIncorporated,\r\n 2400, 34, 75, 5.4);\r\n break;\r\n\r\n case Locations.AevumFulcrumTechnologies:\r\n\t\t\tlocationInfo.innerHTML = Companies[loc].info;\r\n\r\n softwareJob.style.display = \"block\";\r\n itJob.style.display = \"block\";\r\n securityEngineerJob.style.display = \"block\";\r\n networkEngineerJob.style.display = \"block\";\r\n businessJob.style.display = \"block\";\r\n\r\n purchase128gb.style.display = \"block\";\r\n purchase256gb.style.display = \"block\";\r\n purchase512gb.style.display = \"block\";\r\n purchase1tb.style.display = \"block\";\r\n purchaseTor.style.display = \"block\";\r\n purchaseHomeRam.style.display = \"block\";\r\n purchaseHomeCores.style.display = \"block\";\r\n setInfiltrateButton(infiltrate, Locations.AevumFulcrumTechnologies,\r\n 6000, 96, 100, 9);\r\n break;\r\n\r\n case Locations.AevumAeroCorp:\r\n\t\t\tlocationInfo.innerHTML = Companies[loc].info;\r\n\r\n softwareJob.style.display = \"block\";\r\n itJob.style.display = \"block\";\r\n securityEngineerJob.style.display = \"block\";\r\n networkEngineerJob.style.display = \"block\";\r\n securityJob.style.display = \"block\";\r\n setInfiltrateButton(infiltrate, Locations.AevumAeroCorp,\r\n 2000, 32, 50, 6.3);\r\n break;\r\n\r\n case Locations.AevumGalacticCybersystems:\r\n\t\t\tlocationInfo.innerHTML = Companies[loc].info;\r\n\r\n softwareJob.style.display = \"block\";\r\n softwareConsultantJob.style.display = \"block\";\r\n itJob.style.display = \"block\";\r\n securityEngineerJob.style.display = \"block\";\r\n networkEngineerJob.style.display = \"block\";\r\n businessJob.style.display = \"block\";\r\n setInfiltrateButton(infiltrate, Locations.AevumGalacticCybersystems,\r\n 1400, 30, 50, 5.3);\r\n break;\r\n\r\n case Locations.AevumWatchdogSecurity:\r\n\t\t\tlocationInfo.innerHTML = Companies[loc].info;\r\n\r\n softwareJob.style.display = \"block\";\r\n softwareConsultantJob.style.display = \"block\";\r\n itJob.style.display = \"block\";\r\n securityEngineerJob.style.display = \"block\";\r\n networkEngineerJob.style.display = \"block\";\r\n securityJob.style.display = \"block\";\r\n agentJob.style.display = \"block\";\r\n setInfiltrateButton(infiltrate, Locations.AevumWatchdogSecurity,\r\n 850, 16, 30, 4.5);\r\n break;\r\n\r\n case Locations.AevumRhoConstruction:\r\n\t\t\tlocationInfo.innerHTML = Companies[loc].info;\r\n\r\n softwareJob.style.display = \"block\";\r\n businessJob.style.display = \"block\";\r\n setInfiltrateButton(infiltrate, Locations.AevumRhoConstruction,\r\n 600, 12, 20, 2.7);\r\n break;\r\n\r\n case Locations.AevumPolice:\r\n\t\t\tlocationInfo.innerHTML = Companies[loc].info;\r\n\r\n softwareJob.style.display = \"block\";\r\n securityJob.style.display = \"block\";\r\n setInfiltrateButton(infiltrate, Locations.AevumPolice,\r\n 700, 14, 25, 3.2);\r\n break;\r\n\r\n case Locations.AevumNetLinkTechnologies:\r\n\t\t\tlocationInfo.innerHTML = Companies[loc].info;\r\n\r\n softwareJob.style.display = \"block\";\r\n softwareConsultantJob.style.display = \"block\";\r\n itJob.style.display = \"block\";\r\n securityEngineerJob.style.display = \"block\";\r\n networkEngineerJob.style.display = \"block\";\r\n\r\n purchase2gb.style.display = \"block\";\r\n purchase4gb.style.display = \"block\";\r\n purchase8gb.style.display = \"block\";\r\n purchaseTor.style.display = \"block\";\r\n purchaseHomeRam.style.display = \"block\";\r\n purchaseHomeCores.style.display = \"block\";\r\n setInfiltrateButton(infiltrate, Locations.AevumNetLinkTechnologies,\r\n 160, 10, 15, 1.8);\r\n break;\r\n\r\n case Locations.AevumCrushFitnessGym:\r\n var costMult = 3, expMult = 2;\r\n displayGymLocationContent(costMult);\r\n setGymLocationButtons(costMult, expMult);\r\n break;\r\n\r\n case Locations.AevumSnapFitnessGym:\r\n var costMult = 10, expMult = 5;\r\n displayGymLocationContent(costMult);\r\n setGymLocationButtons(costMult, expMult);\r\n break;\r\n\r\n case Locations.ChongqingTravelAgency:\r\n travelAgencyText.style.display = \"block\";\r\n travelToAevum.style.display = \"block\";\r\n travelToSector12.style.display = \"block\";\r\n travelToNewTokyo.style.display = \"block\";\r\n travelToIshima.style.display = \"block\";\r\n travelToVolhaven.style.display = \"block\";\r\n break;\r\n\r\n case Locations.ChongqingKuaiGongInternational:\r\n\t\t\tlocationInfo.innerHTML = Companies[loc].info;\r\n\r\n softwareJob.style.display = \"block\";\r\n itJob.style.display = \"block\";\r\n securityEngineerJob.style.display = \"block\";\r\n networkEngineerJob.style.display = \"block\";\r\n businessJob.style.display = \"block\";\r\n securityJob.style.display = \"block\";\r\n setInfiltrateButton(infiltrate, Locations.ChongqingKuaiGongInternational,\r\n 5500, 48, 100, 9);\r\n break;\r\n\r\n case Locations.ChongqingSolarisSpaceSystems:\r\n\t\t\tlocationInfo.innerHTML = Companies[loc].info;\r\n\r\n softwareJob.style.display = \"block\";\r\n itJob.style.display = \"block\";\r\n securityEngineerJob.style.display = \"block\";\r\n networkEngineerJob.style.display = \"block\";\r\n securityJob.style.display = \"block\";\r\n setInfiltrateButton(infiltrate, Locations.ChongqingSolarisSpaceSystems,\r\n 3600, 26, 75, 8.6);\r\n break;\r\n\r\n\r\n case Locations.Sector12TravelAgency:\r\n travelAgencyText.style.display = \"block\";\r\n travelToAevum.style.display = \"block\";\r\n travelToChongqing.style.display = \"block\";\r\n travelToNewTokyo.style.display = \"block\";\r\n travelToIshima.style.display = \"block\";\r\n travelToVolhaven.style.display = \"block\";\r\n break;\r\n\r\n case Locations.Sector12RothmanUniversity:\r\n var costMult = 3, expMult = 2;\r\n displayUniversityLocationContent(costMult);\r\n setUniversityLocationButtons(costMult, expMult);\r\n break;\r\n\r\n case Locations.Sector12MegaCorp:\r\n\t\t\tlocationInfo.innerHTML = Companies[loc].info;\r\n\r\n softwareJob.style.display = \"block\";\r\n itJob.style.display = \"block\";\r\n securityEngineerJob.style.display = \"block\";\r\n networkEngineerJob.style.display = \"block\";\r\n businessJob.style.display = \"block\";\r\n securityJob.style.display = \"block\";\r\n setInfiltrateButton(infiltrate, Locations.Sector12MegaCorp,\r\n 6000, 114, 125, 9.8);\r\n break;\r\n\r\n case Locations.Sector12BladeIndustries:\r\n\t\t\tlocationInfo.innerHTML = Companies[loc].info;\r\n\r\n softwareJob.style.display = \"block\";\r\n itJob.style.display = \"block\";\r\n securityEngineerJob.style.display = \"block\";\r\n networkEngineerJob.style.display = \"block\";\r\n businessJob.style.display = \"block\";\r\n securityJob.style.display = \"block\";\r\n setInfiltrateButton(infiltrate, Locations.Sector12BladeIndustries,\r\n 3000, 46, 100, 6.7);\r\n break;\r\n\r\n case Locations.Sector12FourSigma:\r\n\t\t\tlocationInfo.innerHTML = Companies[loc].info;\r\n\r\n softwareJob.style.display = \"block\";\r\n itJob.style.display = \"block\";\r\n securityEngineerJob.style.display = \"block\";\r\n networkEngineerJob.style.display = \"block\";\r\n businessJob.style.display = \"block\";\r\n securityJob.style.display = \"block\";\r\n setInfiltrateButton(infiltrate, Locations.Sector12FourSigma,\r\n 1500, 58, 100, 10.2);\r\n break;\r\n\r\n case Locations.Sector12IcarusMicrosystems:\r\n\t\t\tlocationInfo.innerHTML = Companies[loc].info;\r\n\r\n softwareJob.style.display = \"block\";\r\n softwareConsultantJob.style.display = \"block\";\r\n itJob.style.display = \"block\";\r\n securityEngineerJob.style.display = \"block\";\r\n networkEngineerJob.style.display = \"block\";\r\n businessJob.style.display = \"block\";\r\n setInfiltrateButton(infiltrate, Locations.Sector12IcarusMicrosystems,\r\n 900, 32, 70, 7.8);\r\n break;\r\n\r\n case Locations.Sector12UniversalEnergy:\r\n\t\t\tlocationInfo.innerHTML = Companies[loc].info;\r\n\r\n softwareJob.style.display = \"block\";\r\n softwareConsultantJob.style.display = \"block\";\r\n itJob.style.display = \"block\";\r\n securityEngineerJob.style.display = \"block\";\r\n networkEngineerJob.style.display = \"block\";\r\n businessJob.style.display = \"block\";\r\n setInfiltrateButton(infiltrate, Locations.Sector12UniversalEnergy,\r\n 775, 24, 50, 6.3);\r\n break;\r\n\r\n case Locations.Sector12DeltaOne:\r\n\t\t\tlocationInfo.innerHTML = Companies[loc].info;\r\n\r\n softwareJob.style.display = \"block\";\r\n itJob.style.display = \"block\";\r\n securityEngineerJob.style.display = \"block\";\r\n networkEngineerJob.style.display = \"block\";\r\n securityJob.style.display = \"block\";\r\n setInfiltrateButton(infiltrate, Locations.Sector12DeltaOne,\r\n 1200, 38, 75, 6.3);\r\n break;\r\n\r\n case Locations.Sector12CIA:\r\n\t\t\tlocationInfo.innerHTML = Companies[loc].info;\r\n\r\n softwareJob.style.display = \"block\";\r\n itJob.style.display = \"block\";\r\n securityEngineerJob.style.display = \"block\";\r\n networkEngineerJob.style.display = \"block\";\r\n securityJob.style.display = \"block\";\r\n agentJob.style.display = \"block\";\r\n setInfiltrateButton(infiltrate, Locations.Sector12CIA,\r\n 1450, 44, 80, 7.6);\r\n break;\r\n\r\n case Locations.Sector12NSA:\r\n\t\t\tlocationInfo.innerHTML = Companies[loc].info;\r\n\r\n softwareJob.style.display = \"block\";\r\n itJob.style.display = \"block\";\r\n securityEngineerJob.style.display = \"block\";\r\n networkEngineerJob.style.display = \"block\";\r\n securityJob.style.display = \"block\";\r\n agentJob.style.display = \"block\";\r\n if (Player.bitNodeN === 6 || hasBladeburnerSF === true) {\r\n if (Player.bitNodeN === 8) {break;}\r\n if (Player.bladeburner instanceof Bladeburner) {\r\n //Note: Can't infiltrate NSA when part of bladeburner\r\n nsaBladeburner.innerText = \"Enter Bladeburner Headquarters\";\r\n } else {\r\n setInfiltrateButton(infiltrate, Locations.Sector12NSA,\r\n 1400, 40, 80, 7.2);\r\n nsaBladeburner.innerText = \"Apply to Bladeburner Division\";\r\n }\r\n nsaBladeburner.style.display = \"block\";\r\n } else {\r\n setInfiltrateButton(infiltrate, Locations.Sector12NSA,\r\n 1400, 40, 80, 7.2);\r\n }\r\n break;\r\n\r\n case Locations.Sector12AlphaEnterprises:\r\n\t\t\tlocationInfo.innerHTML = Companies[loc].info;\r\n\r\n softwareJob.style.display = \"block\";\r\n softwareConsultantJob.style.display = \"block\";\r\n businessJob.style.display = \"block\";\r\n purchase2gb.style.display = \"block\";\r\n purchase4gb.style.display = \"block\";\r\n purchaseTor.style.display = \"block\";\r\n purchaseHomeRam.style.display = \"block\";\r\n purchaseHomeCores.style.display = \"block\";\r\n setInfiltrateButton(infiltrate, Locations.Sector12AlphaEnterprises,\r\n 250, 14, 40, 2.7);\r\n break;\r\n\r\n case Locations.Sector12CarmichaelSecurity:\r\n\t\t\tlocationInfo.innerHTML = Companies[loc].info;\r\n\r\n softwareJob.style.display = \"block\";\r\n softwareConsultantJob.style.display = \"block\";\r\n itJob.style.display = \"block\";\r\n securityEngineerJob.style.display = \"block\";\r\n networkEngineerJob.style.display = \"block\";\r\n securityJob.style.display = \"block\";\r\n agentJob.style.display = \"block\";\r\n setInfiltrateButton(infiltrate, Locations.Sector12CarmichaelSecurity,\r\n 500, 18, 60, 2.7);\r\n break;\r\n\r\n case Locations.Sector12FoodNStuff:\r\n\t\t\tlocationInfo.innerHTML = Companies[loc].info;\r\n\r\n employeeJob.style.display = \"block\";\r\n employeePartTimeJob.style.display = \"block\";\r\n break;\r\n\r\n case Locations.Sector12JoesGuns:\r\n\t\t\tlocationInfo.innerHTML = Companies[loc].info;\r\n\r\n employeeJob.style.display = \"block\";\r\n employeePartTimeJob.style.display = \"block\";\r\n setInfiltrateButton(infiltrate, Locations.Sector12JoesGuns,\r\n 120, 8, 20, 2.2);\r\n break;\r\n\r\n case Locations.Sector12IronGym:\r\n var costMult = 1, expMult = 1;\r\n displayGymLocationContent(costMult);\r\n setGymLocationButtons(costMult, expMult);\r\n break;\r\n\r\n case Locations.Sector12PowerhouseGym:\r\n var costMult = 20, expMult = 10;\r\n displayGymLocationContent(costMult);\r\n setGymLocationButtons(costMult, expMult);\r\n break;\r\n\r\n case Locations.Sector12CityHall:\r\n cityHallCreateCorporation.style.display = \"block\";\r\n if (Player.corporation instanceof Corporation) {\r\n cityHallCreateCorporation.className = \"a-link-button-inactive\";\r\n } else {\r\n cityHallCreateCorporation.className = \"a-link-button\";\r\n }\r\n break;\r\n\r\n case Locations.NewTokyoTravelAgency:\r\n travelAgencyText.style.display = \"block\";\r\n travelToAevum.style.display = \"block\";\r\n travelToChongqing.style.display = \"block\";\r\n travelToSector12.style.display = \"block\";\r\n travelToIshima.style.display = \"block\";\r\n travelToVolhaven.style.display = \"block\";\r\n break;\r\n\r\n case Locations.NewTokyoDefComm:\r\n\t\t\tlocationInfo.innerHTML = Companies[loc].info;\r\n\r\n softwareJob.style.display = \"block\";\r\n softwareConsultantJob.style.display = \"block\";\r\n itJob.style.display = \"block\";\r\n securityEngineerJob.style.display = \"block\";\r\n networkEngineerJob.style.display = \"block\";\r\n setInfiltrateButton(infiltrate, Locations.NewTokyoDefComm,\r\n 1300, 28, 70, 5.4);\r\n break;\r\n\r\n case Locations.NewTokyoVitaLife:\r\n\t\t\tlocationInfo.innerHTML = Companies[loc].info;\r\n\r\n softwareJob.style.display = \"block\";\r\n softwareConsultantJob.style.display = \"block\";\r\n itJob.style.display = \"block\";\r\n securityEngineerJob.style.display = \"block\";\r\n networkEngineerJob.style.display = \"block\";\r\n businessJob.style.display = \"block\";\r\n setInfiltrateButton(infiltrate, Locations.NewTokyoVitaLife,\r\n 750, 22, 100, 5);\r\n break;\r\n\r\n case Locations.NewTokyoGlobalPharmaceuticals:\r\n\t\t\tlocationInfo.innerHTML = Companies[loc].info;\r\n\r\n softwareJob.style.display = \"block\";\r\n softwareConsultantJob.style.display = \"block\";\r\n itJob.style.display = \"block\";\r\n securityEngineerJob.style.display = \"block\";\r\n networkEngineerJob.style.display = \"block\";\r\n businessJob.style.display = \"block\";\r\n securityJob.style.display = \"block\";\r\n setInfiltrateButton(infiltrate, Locations.NewTokyoGlobalPharmaceuticals,\r\n 900, 24, 80, 5.4);\r\n break;\r\n\r\n case Locations.NewTokyoNoodleBar:\r\n\t\t\tlocationInfo.innerHTML = Companies[loc].info;\r\n\r\n waiterJob.style.display = \"block\";\r\n waiterPartTimeJob.style.display = \"block\";\r\n break;\r\n\r\n case Locations.IshimaTravelAgency:\r\n travelAgencyText.style.display = \"block\";\r\n travelToAevum.style.display = \"block\";\r\n travelToChongqing.style.display = \"block\";\r\n travelToSector12.style.display = \"block\";\r\n travelToNewTokyo.style.display = \"block\";\r\n travelToVolhaven.style.display = \"block\";\r\n break;\r\n\r\n case Locations.IshimaStormTechnologies:\r\n\t\t\tlocationInfo.innerHTML = Companies[loc].info;\r\n\r\n softwareJob.style.display = \"block\";\r\n softwareConsultantJob.style.display = \"block\";\r\n itJob.style.display = \"block\";\r\n securityEngineerJob.style.display = \"block\";\r\n networkEngineerJob.style.display = \"block\";\r\n businessJob.style.display = \"block\";\r\n securityJob.style.display = \"none\";\r\n agentJob.style.display = \"none\";\r\n employeeJob.style.display = \"none\";\r\n waiterJob.style.display = \"none\";\r\n\r\n purchase32gb.style.display = \"block\";\r\n purchase64gb.style.display = \"block\";\r\n purchase128gb.style.display = \"block\";\r\n purchase256gb.style.display = \"block\";\r\n purchaseHomeRam.style.display = \"block\";\r\n purchaseHomeCores.style.display = \"block\";\r\n setInfiltrateButton(infiltrate, Locations.IshimaStormTechnologies,\r\n 700, 24, 100, 5.9);\r\n break;\r\n\r\n case Locations.IshimaNovaMedical:\r\n\t\t\tlocationInfo.innerHTML = Companies[loc].info;\r\n\r\n softwareJob.style.display = \"block\";\r\n softwareConsultantJob.style.display = \"block\";\r\n itJob.style.display = \"block\";\r\n securityEngineerJob.style.display = \"block\";\r\n networkEngineerJob.style.display = \"block\";\r\n businessJob.style.display = \"block\";\r\n setInfiltrateButton(infiltrate, Locations.IshimaNovaMedical,\r\n 600, 20, 50, 4.5);\r\n break;\r\n\r\n case Locations.IshimaOmegaSoftware:\r\n\t\t\tlocationInfo.innerHTML = Companies[loc].info;\r\n\r\n softwareJob.style.display = \"block\";\r\n softwareConsultantJob.style.display = \"block\";\r\n itJob.style.display = \"block\";\r\n businessJob.style.display = \"block\";\r\n\r\n purchase4gb.style.display = \"block\";\r\n purchase8gb.style.display = \"block\";\r\n purchase16gb.style.display = \"block\";\r\n purchase32gb.style.display = \"block\";\r\n purchaseTor.style.display = \"block\";\r\n purchaseHomeRam.style.display = \"block\";\r\n purchaseHomeCores.style.display = \"block\";\r\n setInfiltrateButton(infiltrate, Locations.IshimaOmegaSoftware,\r\n 200, 10, 40, 2.3);\r\n break;\r\n\r\n case Locations.VolhavenTravelAgency:\r\n travelAgencyText.style.display = \"block\";\r\n travelToAevum.style.display = \"block\";\r\n travelToChongqing.style.display = \"block\";\r\n travelToSector12.style.display = \"block\";\r\n travelToNewTokyo.style.display = \"block\";\r\n travelToIshima.style.display = \"block\";\r\n break;\r\n\r\n case Locations.VolhavenZBInstituteOfTechnology:\r\n var costMult = 5, expMult = 4;\r\n displayUniversityLocationContent(costMult);\r\n setUniversityLocationButtons(costMult, expMult);\r\n break;\r\n\r\n case Locations.VolhavenOmniTekIncorporated:\r\n\t\t\tlocationInfo.innerHTML = Companies[loc].info;\r\n\r\n softwareJob.style.display = \"block\";\r\n itJob.style.display = \"block\";\r\n securityEngineerJob.style.display = \"block\";\r\n networkEngineerJob.style.display = \"block\";\r\n businessJob.style.display = \"block\";\r\n securityJob.style.display = \"block\";\r\n\r\n purchase128gb.style.display = \"block\";\r\n purchase256gb.style.display = \"block\";\r\n purchase512gb.style.display = \"block\";\r\n purchase1tb.style.display = \"block\";\r\n setInfiltrateButton(infiltrate, Locations.VolhavenOmniTekIncorporated,\r\n 1500, 44, 100, 6.3);\r\n break;\r\n\r\n case Locations.VolhavenNWO:\r\n\t\t\tlocationInfo.innerHTML = Companies[loc].info;\r\n\r\n softwareJob.style.display = \"block\";\r\n itJob.style.display = \"block\";\r\n securityEngineerJob.style.display = \"block\";\r\n networkEngineerJob.style.display = \"block\";\r\n businessJob.style.display = \"block\";\r\n securityJob.style.display = \"block\";\r\n setInfiltrateButton(infiltrate, Locations.VolhavenNWO,\r\n 1800, 56, 200, 7.2);\r\n break;\r\n\r\n case Locations.VolhavenHeliosLabs:\r\n\t\t\tlocationInfo.innerHTML = Companies[loc].info;\r\n\r\n softwareJob.style.display = \"block\";\r\n softwareConsultantJob.style.display = \"block\";\r\n itJob.style.display = \"block\";\r\n securityEngineerJob.style.display = \"block\";\r\n networkEngineerJob.style.display = \"block\";\r\n setInfiltrateButton(infiltrate, Locations.VolhavenHeliosLabs,\r\n 1200, 28, 75, 5.4);\r\n break;\r\n\r\n case Locations.VolhavenOmniaCybersystems:\r\n\t\t\tlocationInfo.innerHTML = Companies[loc].info;\r\n\r\n softwareJob.style.display = \"block\";\r\n itJob.style.display = \"block\";\r\n securityEngineerJob.style.display = \"block\";\r\n networkEngineerJob.style.display = \"block\";\r\n securityJob.style.display = \"block\";\r\n setInfiltrateButton(infiltrate, Locations.VolhavenOmniaCybersystems,\r\n 900, 28, 90, 5.8);\r\n break;\r\n\r\n case Locations.VolhavenLexoCorp:\r\n\t\t\tlocationInfo.innerHTML = Companies[loc].info;\r\n\r\n softwareJob.style.display = \"block\";\r\n softwareConsultantJob.style.display = \"block\";\r\n itJob.style.display = \"block\";\r\n securityEngineerJob.style.display = \"block\";\r\n networkEngineerJob.style.display = \"block\";\r\n businessJob.style.display = \"block\";\r\n securityJob.style.display = \"block\";\r\n setInfiltrateButton(infiltrate, Locations.VolhavenLexoCorp,\r\n 500, 14, 40, 3.1);\r\n break;\r\n\r\n case Locations.VolhavenSysCoreSecurities:\r\n\t\t\tlocationInfo.innerHTML = Companies[loc].info;\r\n\r\n softwareJob.style.display = \"block\";\r\n itJob.style.display = \"block\";\r\n securityEngineerJob.style.display = \"block\";\r\n networkEngineerJob.style.display = \"block\";\r\n setInfiltrateButton(infiltrate, Locations.VolhavenSysCoreSecurities,\r\n 600, 16, 50, 3.6);\r\n break;\r\n\r\n case Locations.VolhavenCompuTek:\r\n\t\t\tlocationInfo.innerHTML = Companies[loc].info;\r\n\r\n softwareJob.style.display = \"block\";\r\n softwareConsultantJob.style.display = \"block\";\r\n itJob.style.display = \"block\";\r\n securityEngineerJob.style.display = \"block\";\r\n networkEngineerJob.style.display = \"block\";\r\n\r\n purchase8gb.style.display = \"block\";\r\n purchase16gb.style.display = \"block\";\r\n purchase32gb.style.display = \"block\";\r\n purchase64gb.style.display = \"block\";\r\n purchase128gb.style.display = \"block\";\r\n purchase256gb.style.display = \"block\";\r\n purchaseTor.style.display = \"block\";\r\n purchaseHomeRam.style.display = \"block\";\r\n purchaseHomeCores.style.display = \"block\";\r\n setInfiltrateButton(infiltrate, Locations.VolhavenCompuTek,\r\n 300, 12, 35, 3.1);\r\n break;\r\n\r\n case Locations.VolhavenMilleniumFitnessGym:\r\n var costMult = 7, expMult = 4;\r\n displayGymLocationContent(costMult);\r\n setGymLocationButtons(costMult, expMult);\r\n break;\r\n\r\n //All Slums\r\n case Locations.AevumSlums:\r\n case Locations.ChongqingSlums:\r\n case Locations.Sector12Slums:\r\n case Locations.NewTokyoSlums:\r\n case Locations.IshimaSlums:\r\n case Locations.VolhavenSlums:\r\n var shopliftChance = Crimes.Shoplift.successRate();\r\n var robStoreChance = Crimes.RobStore.successRate();\r\n var mugChance = Crimes.Mug.successRate();\r\n var larcenyChance = Crimes.Larceny.successRate();\r\n var drugsChance = Crimes.DealDrugs.successRate();\r\n var bondChance = Crimes.BondForgery.successRate();\r\n var armsChance = Crimes.TraffickArms.successRate();\r\n var homicideChance = Crimes.Homicide.successRate();\r\n var gtaChance = Crimes.GrandTheftAuto.successRate();\r\n var kidnapChance = Crimes.Kidnap.successRate();\r\n var assassinateChance = Crimes.Assassination.successRate();\r\n var heistChance = Crimes.Heist.successRate();\r\n\r\n slumsDescText.style.display = \"block\";\r\n slumsShoplift.style.display = \"block\";\r\n slumsShoplift.innerHTML = \"Shoplift (\" + (shopliftChance*100).toFixed(3) + \"% chance of success)\";\r\n slumsShoplift.innerHTML += '<span class=\"tooltiptext\"> Attempt to shoplift from a low-end retailer </span>';\r\n slumsRobStore.style.display = \"block\";\r\n slumsRobStore.innerHTML = \"Rob store(\" + (robStoreChance*100).toFixed(3) + \"% chance of success)\";\r\n slumsRobStore.innerHTML += '<span class=\"tooltiptext\">Attempt to commit armed robbery on a high-end store </span>';\r\n slumsMug.style.display = \"block\";\r\n slumsMug.innerHTML = \"Mug someone (\" + (mugChance*100).toFixed(3) + \"% chance of success)\";\r\n slumsMug.innerHTML += '<span class=\"tooltiptext\"> Attempt to mug a random person on the street </span>';\r\n slumsLarceny.style.display = \"block\";\r\n slumsLarceny.innerHTML = \"Larceny (\" + (larcenyChance*100).toFixed(3) + \"% chance of success)\";\r\n slumsLarceny.innerHTML +=\"<span class='tooltiptext'> Attempt to rob property from someone's house </span>\";\r\n slumsDealDrugs.style.display = \"block\";\r\n slumsDealDrugs.innerHTML = \"Deal Drugs (\" + (drugsChance*100).toFixed(3) + \"% chance of success)\";\r\n slumsDealDrugs.innerHTML += '<span class=\"tooltiptext\"> Attempt to deal drugs </span>';\r\n slumsBondForgery.style.display = \"block\";\r\n slumsBondForgery.innerHTML = \"Bond Forgery(\" + (bondChance*100).toFixed(3) + \"% chance of success)\";\r\n slumsBondForgery.innerHTML += \"<span class='tooltiptext'> Attempt to forge corporate bonds</span>\";\r\n slumsTrafficArms.style.display = \"block\";\r\n slumsTrafficArms.innerHTML = \"Traffick Illegal Arms (\" + (armsChance*100).toFixed(3) + \"% chance of success)\";\r\n slumsTrafficArms.innerHTML += '<span class=\"tooltiptext\"> Attempt to smuggle illegal arms into the city and sell them to gangs and criminal organizations </span>';\r\n slumsHomicide.style.display = \"block\";\r\n slumsHomicide.innerHTML = \"Homicide (\" + (homicideChance*100).toFixed(3) + \"% chance of success)\";\r\n slumsHomicide.innerHTML += '<span class=\"tooltiptext\"> Attempt to murder a random person on the street</span>';\r\n slumsGta.style.display = \"block\";\r\n slumsGta.innerHTML = \"Grand Theft Auto (\" + (gtaChance*100).toFixed(3) + \"% chance of success)\";\r\n slumsGta.innerHTML += '<span class=\"tooltiptext\"> Attempt to commit grand theft auto </span>';\r\n slumsKidnap.style.display = \"block\";\r\n slumsKidnap.innerHTML = \"Kidnap and Ransom (\" + (kidnapChance*100).toFixed(3) + \"% chance of success)\";\r\n slumsKidnap.innerHTML += '<span class=\"tooltiptext\"> Attempt to kidnap and ransom a high-profile target </span>';\r\n slumsAssassinate.style.display = \"block\";\r\n slumsAssassinate.innerHTML = \"Assassinate (\" + (assassinateChance*100).toFixed(3) + \"% chance of success)\";\r\n slumsAssassinate.innerHTML += '<span class=\"tooltiptext\"> Attempt to assassinate a high-profile target </span>';\r\n slumsHeist.style.display = \"block\";\r\n slumsHeist.innerHTML = \"Heist (\" + (heistChance*100).toFixed(3) + \"% chance of success)\";\r\n slumsHeist.innerHTML += '<span class=\"tooltiptext\"> Attempt to pull off the ultimate heist </span>';\r\n break;\r\n\r\n //Hospital\r\n case Locations.Hospital:\r\n hospitalTreatment.innerText = \"Get treatment for wounds - $\" + formatNumber(hospitalTreatmentCost, 2).toString();\r\n hospitalTreatment.style.display = \"block\";\r\n break;\r\n\r\n default:\r\n console.log(\"ERROR: INVALID LOCATION\");\r\n }\r\n\r\n //Make the \"Apply to be Employee and Waiter\" texts disappear if you already hold the job\r\n //Includes part-time stuff\r\n if (loc == Player.companyName) {\r\n var currPos = Player.companyPosition;\r\n\r\n if (currPos.positionName == CompanyPositions.Employee.positionName) {\r\n employeeJob.style.display = \"none\";\r\n } else if (currPos.positionName == CompanyPositions.Waiter.positionName) {\r\n waiterJob.style.display = \"none\";\r\n } else if (currPos.positionName == CompanyPositions.PartTimeEmployee.positionName) {\r\n employeePartTimeJob.style.display = \"none\";\r\n } else if (currPos.positionName == CompanyPositions.PartTimeWaiter.positionName) {\r\n waiterPartTimeJob.style.display = \"none\";\r\n }\r\n }\r\n}\r\n\r\nfunction initLocationButtons() {\r\n //Buttons to travel to different locations in World\r\n let aevumTravelAgency = document.getElementById(\"aevum-travelagency\");\r\n aevumTravelAgency.addEventListener(\"click\", function() {\r\n Player.location = Locations.AevumTravelAgency;\r\n Engine.loadLocationContent();\r\n return false;\r\n });\r\n\r\n let aevumHospital = document.getElementById(\"aevum-hospital\");\r\n aevumHospital.addEventListener(\"click\", function() {\r\n Player.location = Locations.Hospital;\r\n Engine.loadLocationContent();\r\n return false;\r\n });\r\n\r\n let aevumSummitUniversity = document.getElementById(\"aevum-summituniversity\");\r\n aevumSummitUniversity.addEventListener(\"click\", function() {\r\n Player.location = Locations.AevumSummitUniversity;\r\n Engine.loadLocationContent();\r\n return false;\r\n });\r\n\r\n let aevumECorp = document.getElementById(\"aevum-ecorp\");\r\n aevumECorp.addEventListener(\"click\", function() {\r\n Player.location = Locations.AevumECorp;\r\n Engine.loadLocationContent();\r\n return false;\r\n });\r\n\r\n let aevumBachmanAndAssociates = document.getElementById(\"aevum-bachmanandassociates\");\r\n aevumBachmanAndAssociates.addEventListener(\"click\", function() {\r\n Player.location = Locations.AevumBachmanAndAssociates;\r\n Engine.loadLocationContent();\r\n return false;\r\n });\r\n\r\n let aevumClarkeIncorporated = document.getElementById(\"aevum-clarkeincorporated\");\r\n aevumClarkeIncorporated.addEventListener(\"click\", function() {\r\n Player.location = Locations.AevumClarkeIncorporated;\r\n Engine.loadLocationContent();\r\n return false;\r\n });\r\n\r\n let aevumFulcrumTechnologies = document.getElementById(\"aevum-fulcrumtechnologies\");\r\n aevumFulcrumTechnologies.addEventListener(\"click\", function() {\r\n Player.location = Locations.AevumFulcrumTechnologies;\r\n Engine.loadLocationContent();\r\n return false;\r\n });\r\n\r\n let aevumAeroCorp = document.getElementById(\"aevum-aerocorp\");\r\n aevumAeroCorp.addEventListener(\"click\", function() {\r\n Player.location = Locations.AevumAeroCorp;\r\n Engine.loadLocationContent();\r\n return false;\r\n });\r\n\r\n let aevumGalacticCybersystems = document.getElementById(\"aevum-galacticcybersystems\");\r\n aevumGalacticCybersystems.addEventListener(\"click\", function() {\r\n Player.location = Locations.AevumGalacticCybersystems;\r\n Engine.loadLocationContent();\r\n return false;\r\n });\r\n\r\n let aevumWatchdogSecurity = document.getElementById(\"aevum-watchdogsecurity\");\r\n aevumWatchdogSecurity.addEventListener(\"click\", function() {\r\n Player.location = Locations.AevumWatchdogSecurity;\r\n Engine.loadLocationContent();\r\n return false;\r\n });\r\n\r\n let aevumRhoConstruction = document.getElementById(\"aevum-rhoconstruction\");\r\n aevumRhoConstruction.addEventListener(\"click\", function() {\r\n Player.location = Locations.AevumRhoConstruction;\r\n Engine.loadLocationContent();\r\n return false;\r\n });\r\n\r\n let aevumPolice = document.getElementById(\"aevum-aevumpolice\");\r\n aevumPolice.addEventListener(\"click\", function() {\r\n Player.location = Locations.AevumPolice;\r\n Engine.loadLocationContent();\r\n return false;\r\n });\r\n\r\n let aevumNetLinkTechnologies = document.getElementById(\"aevum-netlinktechnologies\");\r\n aevumNetLinkTechnologies.addEventListener(\"click\", function() {\r\n Player.location = Locations.AevumNetLinkTechnologies;\r\n Engine.loadLocationContent();\r\n return false;\r\n });\r\n\r\n let aevumCrushFitnessGym = document.getElementById(\"aevum-crushfitnessgym\");\r\n aevumCrushFitnessGym.addEventListener(\"click\", function() {\r\n Player.location = Locations.AevumCrushFitnessGym;\r\n Engine.loadLocationContent();\r\n return false;\r\n });\r\n\r\n let aevumSnapFitnessGym = document.getElementById(\"aevum-snapfitnessgym\");\r\n aevumSnapFitnessGym.addEventListener(\"click\", function() {\r\n Player.location = Locations.AevumSnapFitnessGym;\r\n Engine.loadLocationContent();\r\n return false;\r\n });\r\n\r\n let aevumSlums = document.getElementById(\"aevum-slums\");\r\n aevumSlums.addEventListener(\"click\", function() {\r\n Player.location = Locations.AevumSlums;\r\n Engine.loadLocationContent();\r\n return false;\r\n });\r\n\r\n\tlet chongqingTravelAgency = document.getElementById(\"chongqing-travelagency\");\r\n\tchongqingTravelAgency.addEventListener(\"click\", function() {\r\n\t\tPlayer.location = Locations.ChongqingTravelAgency;\r\n\t\tEngine.loadLocationContent();\r\n return false;\r\n\t});\r\n\r\n let chongqingHospital = document.getElementById(\"chongqing-hospital\");\r\n chongqingHospital.addEventListener(\"click\", function() {\r\n Player.location = Locations.Hospital;\r\n Engine.loadLocationContent();\r\n return false;\r\n });\r\n\r\n\tlet chongqingKuaiGongInternational = document.getElementById(\"chongqing-kuaigonginternational\");\r\n\tchongqingKuaiGongInternational.addEventListener(\"click\", function() {\r\n\t\tPlayer.location = Locations.ChongqingKuaiGongInternational;\r\n\t\tEngine.loadLocationContent();\r\n return false;\r\n\t});\r\n\r\n\tlet chongqingSolarisSpaceSystems = document.getElementById(\"chongqing-solarisspacesystems\");\r\n\tchongqingSolarisSpaceSystems.addEventListener(\"click\", function() {\r\n\t\tPlayer.location = Locations.ChongqingSolarisSpaceSystems;\r\n\t\tEngine.loadLocationContent();\r\n return false;\r\n\t});\r\n\r\n let chongqingSlums = document.getElementById(\"chongqing-slums\");\r\n chongqingSlums.addEventListener(\"click\", function() {\r\n Player.location = Locations.ChongqingSlums;\r\n Engine.loadLocationContent();\r\n return false;\r\n });\r\n\r\n\tlet sector12TravelAgency = document.getElementById(\"sector12-travelagency\");\r\n\tsector12TravelAgency.addEventListener(\"click\", function() {\r\n\t\tPlayer.location = Locations.Sector12TravelAgency;\r\n\t\tEngine.loadLocationContent();\r\n return false;\r\n\t});\r\n\r\n let sector12Hospital = document.getElementById(\"sector12-hospital\");\r\n sector12Hospital.addEventListener(\"click\", function() {\r\n Player.location = Locations.Hospital;\r\n Engine.loadLocationContent();\r\n return false;\r\n });\r\n\r\n let sector12RothmanUniversity = document.getElementById(\"sector12-rothmanuniversity\");\r\n sector12RothmanUniversity.addEventListener(\"click\", function() {\r\n Player.location = Locations.Sector12RothmanUniversity;\r\n Engine.loadLocationContent();\r\n return false;\r\n });\r\n\r\n\tlet sector12MegaCorp = document.getElementById(\"sector12-megacorp\");\r\n\tsector12MegaCorp.addEventListener(\"click\", function() {\r\n\t\tPlayer.location = Locations.Sector12MegaCorp;\r\n\t\tEngine.loadLocationContent();\r\n return false;\r\n\t});\r\n\r\n\tlet sector12BladeIndustries = document.getElementById(\"sector12-bladeindustries\");\r\n\tsector12BladeIndustries.addEventListener(\"click\", function() {\r\n\t\tPlayer.location = Locations.Sector12BladeIndustries;\r\n\t\tEngine.loadLocationContent();\r\n return false;\r\n\t});\r\n\r\n\tlet sector12FourSigma = document.getElementById(\"sector12-foursigma\");\r\n\tsector12FourSigma.addEventListener(\"click\", function() {\r\n\t\tPlayer.location = Locations.Sector12FourSigma;\r\n\t\tEngine.loadLocationContent();\r\n return false;\r\n\t});\r\n\r\n\tlet sector12IcarusMicrosystems = document.getElementById(\"sector12-icarusmicrosystems\");\r\n\tsector12IcarusMicrosystems.addEventListener(\"click\", function() {\r\n\t\tPlayer.location = Locations.Sector12IcarusMicrosystems;\r\n\t\tEngine.loadLocationContent();\r\n return false;\r\n\t});\r\n\r\n\tlet sector12UniversalEnergy = document.getElementById(\"sector12-universalenergy\");\r\n\tsector12UniversalEnergy.addEventListener(\"click\", function() {\r\n\t\tPlayer.location = Locations.Sector12UniversalEnergy;\r\n\t\tEngine.loadLocationContent();\r\n return false;\r\n\t});\r\n\r\n\tlet sector12DeltaOne = document.getElementById(\"sector12-deltaone\");\r\n\tsector12DeltaOne.addEventListener(\"click\", function() {\r\n\t\tPlayer.location = Locations.Sector12DeltaOne;\r\n\t\tEngine.loadLocationContent();\r\n return false;\r\n\t});\r\n\r\n\tlet sector12CIA = document.getElementById(\"sector12-cia\");\r\n\tsector12CIA.addEventListener(\"click\", function() {\r\n\t\tPlayer.location = Locations.Sector12CIA;\r\n\t\tEngine.loadLocationContent();\r\n return false;\r\n\t});\r\n\r\n\tlet sector12NSA = document.getElementById(\"sector12-nsa\");\r\n\tsector12NSA.addEventListener(\"click\", function() {\r\n\t\tPlayer.location = Locations.Sector12NSA;\r\n\t\tEngine.loadLocationContent();\r\n return false;\r\n\t});\r\n\r\n\tlet sector12AlphaEnterprises = document.getElementById(\"sector12-alphaenterprises\");\r\n\tsector12AlphaEnterprises.addEventListener(\"click\", function() {\r\n\t\tPlayer.location = Locations.Sector12AlphaEnterprises;\r\n\t\tEngine.loadLocationContent();\r\n return false;\r\n\t});\r\n\r\n\tlet sector12CarmichaelSecurity = document.getElementById(\"sector12-carmichaelsecurity\");\r\n\tsector12CarmichaelSecurity.addEventListener(\"click\", function() {\r\n\t\tPlayer.location = Locations.Sector12CarmichaelSecurity;\r\n\t\tEngine.loadLocationContent();\r\n return false;\r\n\t});\r\n\r\n\tlet sector12FoodNStuff = document.getElementById(\"sector12-foodnstuff\");\r\n\tsector12FoodNStuff.addEventListener(\"click\", function() {\r\n\t\tPlayer.location = Locations.Sector12FoodNStuff;\r\n\t\tEngine.loadLocationContent();\r\n return false;\r\n\t});\r\n\r\n\tlet sector12JoesGuns = document.getElementById(\"sector12-joesguns\");\r\n\tsector12JoesGuns.addEventListener(\"click\", function() {\r\n\t\tPlayer.location = Locations.Sector12JoesGuns;\r\n\t\tEngine.loadLocationContent();\r\n return false;\r\n\t});\r\n\r\n\tlet sector12IronGym = document.getElementById(\"sector12-irongym\");\r\n\tsector12IronGym.addEventListener(\"click\", function() {\r\n\t\tPlayer.location = Locations.Sector12IronGym;\r\n\t\tEngine.loadLocationContent();\r\n return false;\r\n\t});\r\n\r\n\tlet sector12PowerhouseGym = document.getElementById(\"sector12-powerhousegym\");\r\n\tsector12PowerhouseGym.addEventListener(\"click\", function() {\r\n\t\tPlayer.location = Locations.Sector12PowerhouseGym;\r\n\t\tEngine.loadLocationContent();\r\n return false;\r\n\t});\r\n\r\n let sector12Slums = document.getElementById(\"sector12-slums\");\r\n sector12Slums.addEventListener(\"click\", function() {\r\n Player.location = Locations.Sector12Slums;\r\n Engine.loadLocationContent();\r\n return false;\r\n });\r\n\r\n let sector12CityHall = document.getElementById(\"sector12-cityhall\");\r\n sector12CityHall.addEventListener(\"click\", function() {\r\n Player.location = Locations.Sector12CityHall;\r\n Engine.loadLocationContent();\r\n return false;\r\n });\r\n\r\n\tlet newTokyoTravelAgency = document.getElementById(\"newtokyo-travelagency\");\r\n\tnewTokyoTravelAgency.addEventListener(\"click\", function() {\r\n\t\tPlayer.location = Locations.NewTokyoTravelAgency;\r\n\t\tEngine.loadLocationContent();\r\n return false;\r\n\t});\r\n\r\n let newTokyoHospital = document.getElementById(\"newtokyo-hospital\");\r\n newTokyoHospital.addEventListener(\"click\", function() {\r\n Player.location = Locations.Hospital;\r\n Engine.loadLocationContent();\r\n return false;\r\n });\r\n\r\n\tlet newTokyoDefComm = document.getElementById(\"newtokyo-defcomm\");\r\n\tnewTokyoDefComm.addEventListener(\"click\", function() {\r\n\t\tPlayer.location = Locations.NewTokyoDefComm;\r\n\t\tEngine.loadLocationContent();\r\n return false;\r\n\t});\r\n\r\n\tlet newTokyoVitaLife = document.getElementById(\"newtokyo-vitalife\");\r\n\tnewTokyoVitaLife.addEventListener(\"click\", function() {\r\n\t\tPlayer.location = Locations.NewTokyoVitaLife;\r\n\t\tEngine.loadLocationContent();\r\n return false;\r\n\t});\r\n\r\n\tlet newTokyoGlobalPharmaceuticals = document.getElementById(\"newtokyo-globalpharmaceuticals\");\r\n\tnewTokyoGlobalPharmaceuticals.addEventListener(\"click\", function() {\r\n\t\tPlayer.location = Locations.NewTokyoGlobalPharmaceuticals;\r\n\t\tEngine.loadLocationContent();\r\n return false;\r\n\t});\r\n\r\n\tlet newTokyoNoodleBar = document.getElementById(\"newtokyo-noodlebar\");\r\n\tnewTokyoNoodleBar.addEventListener(\"click\", function() {\r\n\t\tPlayer.location = Locations.NewTokyoNoodleBar;\r\n\t\tEngine.loadLocationContent();\r\n return false;\r\n\t});\r\n\r\n let newTokyoSlums = document.getElementById(\"newtokyo-slums\");\r\n newTokyoSlums.addEventListener(\"click\", function() {\r\n Player.location = Locations.NewTokyoSlums;\r\n Engine.loadLocationContent();\r\n return false;\r\n });\r\n\r\n\tlet ishimaTravelAgency = document.getElementById(\"ishima-travelagency\");\r\n\tishimaTravelAgency.addEventListener(\"click\", function() {\r\n\t\tPlayer.location = Locations.IshimaTravelAgency;\r\n\t\tEngine.loadLocationContent();\r\n return false;\r\n\t});\r\n\r\n let ishimaHospital = document.getElementById(\"ishima-hospital\");\r\n ishimaHospital.addEventListener(\"click\", function() {\r\n Player.location = Locations.Hospital;\r\n Engine.loadLocationContent();\r\n return false;\r\n });\r\n\r\n\tlet ishimaStormTechnologies = document.getElementById(\"ishima-stormtechnologies\");\r\n\tishimaStormTechnologies.addEventListener(\"click\", function() {\r\n\t\tPlayer.location = Locations.IshimaStormTechnologies;\r\n\t\tEngine.loadLocationContent();\r\n return false;\r\n\t});\r\n\r\n\tlet ishimaNovaMedical = document.getElementById(\"ishima-novamedical\");\r\n\tishimaNovaMedical.addEventListener(\"click\", function() {\r\n\t\tPlayer.location = Locations.IshimaNovaMedical;\r\n\t\tEngine.loadLocationContent();\r\n return false;\r\n\t});\r\n\r\n\tlet ishimaOmegaSoftware = document.getElementById(\"ishima-omegasoftware\");\r\n\tishimaOmegaSoftware.addEventListener(\"click\", function() {\r\n\t\tPlayer.location = Locations.IshimaOmegaSoftware;\r\n\t\tEngine.loadLocationContent();\r\n return false;\r\n\t});\r\n\r\n let ishimaSlums = document.getElementById(\"ishima-slums\");\r\n ishimaSlums.addEventListener(\"click\", function() {\r\n Player.location = Locations.IshimaSlums;\r\n Engine.loadLocationContent();\r\n return false;\r\n });\r\n\r\n\tlet volhavenTravelAgency = document.getElementById(\"volhaven-travelagency\");\r\n\tvolhavenTravelAgency.addEventListener(\"click\", function() {\r\n\t\tPlayer.location = Locations.VolhavenTravelAgency;\r\n\t\tEngine.loadLocationContent();\r\n return false;\r\n\t});\r\n\r\n let volhavenHospital = document.getElementById(\"volhaven-hospital\");\r\n volhavenHospital.addEventListener(\"click\", function() {\r\n Player.location = Locations.Hospital;\r\n Engine.loadLocationContent();\r\n return false;\r\n });\r\n\r\n let volhavenZBInstituteOfTechnology = document.getElementById(\"volhaven-zbinstituteoftechnology\");\r\n volhavenZBInstituteOfTechnology.addEventListener(\"click\", function() {\r\n Player.location = Locations.VolhavenZBInstituteOfTechnology;\r\n Engine.loadLocationContent();\r\n return false;\r\n });\r\n\r\n\tlet volhavenOmniTekIncorporated = document.getElementById(\"volhaven-omnitekincorporated\");\r\n\tvolhavenOmniTekIncorporated.addEventListener(\"click\", function() {\r\n\t\tPlayer.location = Locations.VolhavenOmniTekIncorporated;\r\n\t\tEngine.loadLocationContent();\r\n return false;\r\n\t});\r\n\r\n\tlet volhavenNWO = document.getElementById(\"volhaven-nwo\");\r\n\tvolhavenNWO.addEventListener(\"click\", function() {\r\n\t\tPlayer.location = Locations.VolhavenNWO;\r\n\t\tEngine.loadLocationContent();\r\n return false;\r\n\t});\r\n\r\n\tlet volhavenHeliosLabs = document.getElementById(\"volhaven-helioslabs\");\r\n\tvolhavenHeliosLabs.addEventListener(\"click\", function() {\r\n\t\tPlayer.location = Locations.VolhavenHeliosLabs;\r\n\t\tEngine.loadLocationContent();\r\n return false;\r\n\t});\r\n\r\n\tlet volhavenOmniaCybersystems = document.getElementById(\"volhaven-omniacybersystems\");\r\n\tvolhavenOmniaCybersystems.addEventListener(\"click\", function() {\r\n\t\tPlayer.location = Locations.VolhavenOmniaCybersystems;\r\n\t\tEngine.loadLocationContent();\r\n return false;\r\n\t});\r\n\r\n\tlet volhavenLexoCorp = document.getElementById(\"volhaven-lexocorp\");\r\n\tvolhavenLexoCorp.addEventListener(\"click\", function() {\r\n\t\tPlayer.location = Locations.VolhavenLexoCorp;\r\n\t\tEngine.loadLocationContent();\r\n return false;\r\n\t});\r\n\r\n\tlet volhavenSysCoreSecurities = document.getElementById(\"volhaven-syscoresecurities\");\r\n\tvolhavenSysCoreSecurities.addEventListener(\"click\", function() {\r\n\t\tPlayer.location = Locations.VolhavenSysCoreSecurities;\r\n\t\tEngine.loadLocationContent();\r\n return false;\r\n\t});\r\n\r\n\tlet volhavenCompuTek = document.getElementById(\"volhaven-computek\");\r\n\tvolhavenCompuTek.addEventListener(\"click\", function() {\r\n\t\tPlayer.location = Locations.VolhavenCompuTek;\r\n\t\tEngine.loadLocationContent();\r\n return false;\r\n\t});\r\n\r\n\tlet volhavenMilleniumFitnessGym = document.getElementById(\"volhaven-milleniumfitnessgym\");\r\n\tvolhavenMilleniumFitnessGym.addEventListener(\"click\", function() {\r\n\t\tPlayer.location = Locations.VolhavenMilleniumFitnessGym;\r\n\t\tEngine.loadLocationContent();\r\n return false;\r\n\t});\r\n\r\n let volhavenSlums = document.getElementById(\"volhaven-slums\");\r\n volhavenSlums.addEventListener(\"click\", function() {\r\n Player.location = Locations.VolhavenSlums;\r\n Engine.loadLocationContent();\r\n return false;\r\n });\r\n\r\n //Buttons to interact at a location (apply for job/promotion, train, purchase, etc.)\r\n var softwareJob = document.getElementById(\"location-software-job\");\r\n var softwareConsultantJob = document.getElementById(\"location-software-consultant-job\")\r\n var itJob = document.getElementById(\"location-it-job\");\r\n var securityEngineerJob = document.getElementById(\"location-security-engineer-job\");\r\n var networkEngineerJob = document.getElementById(\"location-network-engineer-job\");\r\n var businessJob = document.getElementById(\"location-business-job\");\r\n var businessConsultantJob = document.getElementById(\"location-business-consultant-job\");\r\n var securityJob = document.getElementById(\"location-security-job\");\r\n var agentJob = document.getElementById(\"location-agent-job\");\r\n var employeeJob = document.getElementById(\"location-employee-job\");\r\n var employeePartTimeJob = document.getElementById(\"location-parttime-employee-job\");\r\n var waiterJob = document.getElementById(\"location-waiter-job\");\r\n var waiterPartTimeJob = document.getElementById(\"location-parttime-waiter-job\");\r\n\r\n var work = document.getElementById(\"location-work\");\r\n\r\n var purchase2gb = document.getElementById(\"location-purchase-2gb\");\r\n var purchase4gb = document.getElementById(\"location-purchase-4gb\");\r\n var purchase8gb = document.getElementById(\"location-purchase-8gb\");\r\n var purchase16gb = document.getElementById(\"location-purchase-16gb\");\r\n var purchase32gb = document.getElementById(\"location-purchase-32gb\");\r\n var purchase64gb = document.getElementById(\"location-purchase-64gb\");\r\n var purchase128gb = document.getElementById(\"location-purchase-128gb\");\r\n var purchase256gb = document.getElementById(\"location-purchase-256gb\");\r\n var purchase512gb = document.getElementById(\"location-purchase-512gb\");\r\n var purchase1tb = document.getElementById(\"location-purchase-1tb\");\r\n var purchaseTor = document.getElementById(\"location-purchase-tor\");\r\n var purchaseHomeRam = document.getElementById(\"location-purchase-home-ram\");\r\n var purchaseHomeCores = document.getElementById(\"location-purchase-home-cores\");\r\n\r\n var travelToAevum = document.getElementById(\"location-travel-to-aevum\");\r\n var travelToChongqing = document.getElementById(\"location-travel-to-chongqing\");\r\n var travelToSector12 = document.getElementById(\"location-travel-to-sector12\");\r\n var travelToNewTokyo = document.getElementById(\"location-travel-to-newtokyo\");\r\n var travelToIshima = document.getElementById(\"location-travel-to-ishima\");\r\n var travelToVolhaven = document.getElementById(\"location-travel-to-volhaven\");\r\n\r\n var slumsShoplift = document.getElementById(\"location-slums-shoplift\");\r\n var slumsRobStore = document.getElementById(\"location-slums-rob-store\");\r\n var slumsMug = document.getElementById(\"location-slums-mug\");\r\n var slumsLarceny = document.getElementById(\"location-slums-larceny\");\r\n var slumsDealDrugs = document.getElementById(\"location-slums-deal-drugs\");\r\n var slumsBondForgery = document.getElementById(\"location-slums-bond-forgery\");\r\n var slumsTrafficArms = document.getElementById(\"location-slums-traffic-arms\");\r\n var slumsHomicide = document.getElementById(\"location-slums-homicide\");\r\n var slumsGta = document.getElementById(\"location-slums-gta\");\r\n var slumsKidnap = document.getElementById(\"location-slums-kidnap\");\r\n var slumsAssassinate = document.getElementById(\"location-slums-assassinate\");\r\n var slumsHeist = document.getElementById(\"location-slums-heist\");\r\n\r\n var cityHallCreateCorporation = document.getElementById(\"location-cityhall-create-corporation\");\r\n\r\n var nsaBladeburner = document.getElementById(\"location-nsa-bladeburner\");\r\n\r\n var hospitalTreatment = document.getElementById(\"location-hospital-treatment\");\r\n\r\n softwareJob.addEventListener(\"click\", function() {\r\n Player.applyForSoftwareJob();\r\n return false;\r\n });\r\n\r\n softwareConsultantJob.addEventListener(\"click\", function() {\r\n Player.applyForSoftwareConsultantJob();\r\n return false;\r\n });\r\n\r\n itJob.addEventListener(\"click\", function() {\r\n Player.applyForItJob();\r\n return false;\r\n });\r\n\r\n securityEngineerJob.addEventListener(\"click\", function() {\r\n Player.applyForSecurityEngineerJob();\r\n return false;\r\n });\r\n\r\n networkEngineerJob.addEventListener(\"click\", function() {\r\n Player.applyForNetworkEngineerJob();\r\n return false;\r\n });\r\n\r\n businessJob.addEventListener(\"click\", function() {\r\n Player.applyForBusinessJob();\r\n return false;\r\n });\r\n\r\n businessConsultantJob.addEventListener(\"click\", function() {\r\n Player.applyForBusinessConsultantJob();\r\n return false;\r\n });\r\n\r\n securityJob.addEventListener(\"click\", function() {\r\n Player.applyForSecurityJob();\r\n return false;\r\n });\r\n\r\n agentJob.addEventListener(\"click\", function() {\r\n Player.applyForAgentJob();\r\n return false;\r\n });\r\n\r\n employeeJob.addEventListener(\"click\", function() {\r\n Player.applyForEmployeeJob();\r\n return false;\r\n });\r\n\r\n employeePartTimeJob.addEventListener(\"click\", function() {\r\n Player.applyForPartTimeEmployeeJob();\r\n return false;\r\n });\r\n\r\n waiterJob.addEventListener(\"click\", function() {\r\n Player.applyForWaiterJob();\r\n return false;\r\n });\r\n\r\n waiterPartTimeJob.addEventListener(\"click\", function() {\r\n Player.applyForPartTimeWaiterJob();\r\n return false;\r\n });\r\n\r\n purchase2gb.addEventListener(\"click\", function() {\r\n purchaseServerBoxCreate(2, 2 * CONSTANTS.BaseCostFor1GBOfRamServer);\r\n return false;\r\n });\r\n\r\n purchase4gb.addEventListener(\"click\", function() {\r\n purchaseServerBoxCreate(4, 4 * CONSTANTS.BaseCostFor1GBOfRamServer);\r\n return false;\r\n });\r\n\r\n purchase8gb.addEventListener(\"click\", function() {\r\n purchaseServerBoxCreate(8, 8 * CONSTANTS.BaseCostFor1GBOfRamServer);\r\n return false;\r\n });\r\n\r\n purchase16gb.addEventListener(\"click\", function() {\r\n purchaseServerBoxCreate(16, 16 * CONSTANTS.BaseCostFor1GBOfRamServer);\r\n return false;\r\n });\r\n\r\n purchase32gb.addEventListener(\"click\", function() {\r\n purchaseServerBoxCreate(32, 32 * CONSTANTS.BaseCostFor1GBOfRamServer);\r\n return false;\r\n });\r\n\r\n purchase64gb.addEventListener(\"click\", function() {\r\n purchaseServerBoxCreate(64, 64 * CONSTANTS.BaseCostFor1GBOfRamServer);\r\n return false;\r\n });\r\n\r\n purchase128gb.addEventListener(\"click\", function() {\r\n purchaseServerBoxCreate(128, 128 * CONSTANTS.BaseCostFor1GBOfRamServer);\r\n return false;\r\n });\r\n\r\n purchase256gb.addEventListener(\"click\", function() {\r\n purchaseServerBoxCreate(256, 256 * CONSTANTS.BaseCostFor1GBOfRamServer);\r\n return false;\r\n });\r\n\r\n purchase512gb.addEventListener(\"click\", function() {\r\n purchaseServerBoxCreate(512, 512 * CONSTANTS.BaseCostFor1GBOfRamServer);\r\n return false;\r\n });\r\n\r\n purchase1tb.addEventListener(\"click\", function() {\r\n purchaseServerBoxCreate(1024, 1024 * CONSTANTS.BaseCostFor1GBOfRamServer);\r\n return false;\r\n });\r\n\r\n purchaseTor.addEventListener(\"click\", function() {\r\n purchaseTorRouter();\r\n return false;\r\n });\r\n\r\n purchaseHomeRam.addEventListener(\"click\", function() {\r\n const cost = Player.getUpgradeHomeRamCost();\r\n const ram = Player.getHomeComputer().maxRam;\r\n\r\n var yesBtn = yesNoBoxGetYesButton(), noBtn = yesNoBoxGetNoButton();\r\n yesBtn.innerHTML = \"Purchase\"; noBtn.innerHTML = \"Cancel\";\r\n yesBtn.addEventListener(\"click\", ()=>{\r\n purchaseRamForHomeComputer(cost);\r\n yesNoBoxClose();\r\n });\r\n noBtn.addEventListener(\"click\", ()=>{\r\n yesNoBoxClose();\r\n });\r\n yesNoBoxCreate(\"Would you like to purchase additional RAM for your home computer? <br><br>\" +\r\n \"This will upgrade your RAM from \" + ram + \"GB to \" + ram*2 + \"GB. <br><br>\" +\r\n \"This will cost \" + numeral(cost).format('$0.000a'));\r\n });\r\n\r\n purchaseHomeCores.addEventListener(\"click\", function() {\r\n var currentCores = Player.getHomeComputer().cpuCores;\r\n if (currentCores >= 8) {return;} //Max of 8 cores\r\n\r\n //Cost of purchasing another cost is found by indexing this array with number of current cores\r\n var cost = [0,\r\n 10000000000, //1->2 Cores - 10 bn\r\n 250000000000, //2->3 Cores - 250 bn\r\n 5000000000000, //3->4 Cores - 5 trillion\r\n 100000000000000, //4->5 Cores - 100 trillion\r\n 1000000000000000, //5->6 Cores - 1 quadrillion\r\n 20000000000000000, //6->7 Cores - 20 quadrillion\r\n 200000000000000000]; //7->8 Cores - 200 quadrillion\r\n cost = cost[currentCores];\r\n var yesBtn = yesNoBoxGetYesButton(), noBtn = yesNoBoxGetNoButton();\r\n yesBtn.innerHTML = \"Purchase\"; noBtn.innerHTML = \"Cancel\";\r\n yesBtn.addEventListener(\"click\", ()=>{\r\n if (Player.money.lt(cost)) {\r\n dialogBoxCreate(\"You do not have enough mone to purchase an additional CPU Core for your home computer!\");\r\n } else {\r\n Player.loseMoney(cost);\r\n Player.getHomeComputer().cpuCores++;\r\n dialogBoxCreate(\"You purchased an additional CPU Core for your home computer! It now has \" +\r\n Player.getHomeComputer().cpuCores + \" cores.\");\r\n }\r\n yesNoBoxClose();\r\n });\r\n noBtn.addEventListener(\"click\", ()=>{\r\n yesNoBoxClose();\r\n });\r\n yesNoBoxCreate(\"Would you like to purchase an additional CPU Core for your home computer? Each CPU Core \" +\r\n \"lets you start with an additional Core Node in Hacking Missions.<br><br>\" +\r\n \"Purchasing an additional core (for a total of \" + (Player.getHomeComputer().cpuCores + 1) + \") will \" +\r\n \"cost \" + numeral(cost).format('$0.000a'));\r\n });\r\n\r\n travelToAevum.addEventListener(\"click\", function() {\r\n travelBoxCreate(Locations.Aevum, CONSTANTS.TravelCost);\r\n return false;\r\n });\r\n\r\n travelToChongqing.addEventListener(\"click\", function() {\r\n travelBoxCreate(Locations.Chongqing, CONSTANTS.TravelCost);\r\n return false;\r\n });\r\n\r\n travelToSector12.addEventListener(\"click\", function() {\r\n travelBoxCreate(Locations.Sector12, CONSTANTS.TravelCost);\r\n return false;\r\n });\r\n\r\n travelToNewTokyo.addEventListener(\"click\", function() {\r\n travelBoxCreate(Locations.NewTokyo, CONSTANTS.TravelCost);\r\n return false;\r\n });\r\n\r\n travelToIshima.addEventListener(\"click\", function() {\r\n travelBoxCreate(Locations.Ishima, CONSTANTS.TravelCost);\r\n return false;\r\n });\r\n\r\n travelToVolhaven.addEventListener(\"click\", function() {\r\n travelBoxCreate(Locations.Volhaven, CONSTANTS.TravelCost);\r\n return false;\r\n });\r\n\r\n slumsShoplift.addEventListener(\"click\", function() {\r\n Crimes.Shoplift.commit();\r\n return false;\r\n });\r\n\r\n slumsRobStore.addEventListener(\"click\", function() {\r\n Crimes.RobStore.commit();\r\n return false;\r\n });\r\n\r\n slumsMug.addEventListener(\"click\", function() {\r\n Crimes.Mug.commit();\r\n return false;\r\n });\r\n\r\n slumsLarceny.addEventListener(\"click\", function() {\r\n Crimes.Larceny.commit();\r\n return false;\r\n });\r\n\r\n slumsDealDrugs.addEventListener(\"click\", function() {\r\n Crimes.DealDrugs.commit();\r\n return false;\r\n });\r\n\r\n slumsBondForgery.addEventListener(\"click\", function() {\r\n Crimes.BondForgery.commit();\r\n return false;\r\n });\r\n\r\n slumsTrafficArms.addEventListener(\"click\", function() {\r\n Crimes.TraffickArms.commit();\r\n return false;\r\n });\r\n\r\n slumsHomicide.addEventListener(\"click\", function() {\r\n Crimes.Homicide.commit();\r\n return false;\r\n });\r\n\r\n slumsGta.addEventListener(\"click\", function() {\r\n Crimes.GrandTheftAuto.commit();\r\n return false;\r\n });\r\n\r\n slumsKidnap.addEventListener(\"click\", function() {\r\n Crimes.Kidnap.commit();\r\n return false;\r\n });\r\n\r\n slumsAssassinate.addEventListener(\"click\", function() {\r\n Crimes.Assassination.commit();\r\n return false;\r\n });\r\n\r\n slumsHeist.addEventListener(\"click\", function() {\r\n Crimes.Heist.commit();\r\n return false;\r\n });\r\n\r\n cityHallCreateCorporation.addEventListener(\"click\", function() {\r\n var yesBtn = yesNoTxtInpBoxGetYesButton(),\r\n noBtn = yesNoTxtInpBoxGetNoButton();\r\n yesBtn.innerText = \"Create Corporation\";\r\n noBtn.innerText = \"Cancel\";\r\n yesBtn.addEventListener(\"click\", function() {\r\n if (Player.money.lt(150e9)) {\r\n dialogBoxCreate(\"You don't have enough money to create a corporation! You need $150b\");\r\n return yesNoTxtInpBoxClose();\r\n }\r\n Player.loseMoney(150e9);\r\n var companyName = yesNoTxtInpBoxGetInput();\r\n if (companyName == null || companyName == \"\") {\r\n dialogBoxCreate(\"Invalid company name!\");\r\n return false;\r\n }\r\n Player.corporation = new Corporation({\r\n name:companyName,\r\n });\r\n displayLocationContent();\r\n dialogBoxCreate(\"Congratulations! You just started your own corporation. You can visit \" +\r\n \"and manage your company in the City\");\r\n return yesNoTxtInpBoxClose();\r\n });\r\n noBtn.addEventListener(\"click\", function() {\r\n return yesNoTxtInpBoxClose();\r\n });\r\n if (Player.corporation instanceof Corporation) {\r\n return;\r\n } else {\r\n yesNoTxtInpBoxCreate(\"Would you like to start a corporation? This will require $150b \" +\r\n \"for registration and initial funding.<br><br>If so, please enter \" +\r\n \"a name for your corporation below:\");\r\n }\r\n });\r\n\r\n nsaBladeburner.addEventListener(\"click\", function() {\r\n if (Player.bladeburner && Player.bladeburner instanceof Bladeburner) {\r\n //Enter Bladeburner division\r\n Engine.loadBladeburnerContent();\r\n } else {\r\n //Apply for Bladeburner division\r\n if (Player.strength >= 100 && Player.defense >= 100 &&\r\n Player.dexterity >= 100 && Player.agility >= 100) {\r\n Player.bladeburner = new Bladeburner({new:true});\r\n dialogBoxCreate(\"You have been accepted into the Bladeburner division!\");\r\n displayLocationContent();\r\n } else {\r\n dialogBoxCreate(\"Rejected! Please apply again when you have 100 of each combat stat (str, def, dex, agi)\");\r\n }\r\n }\r\n });\r\n\r\n hospitalTreatment.addEventListener(\"click\", function() {\r\n if (Player.hp < 0) {Player.hp = 0;}\r\n var price = (Player.max_hp - Player.hp) * CONSTANTS.HospitalCostPerHp;\r\n Player.loseMoney(price);\r\n dialogBoxCreate(\"You were healed to full health! The hospital billed \" +\r\n \"you for $\" + formatNumber(price, 2).toString());\r\n Player.hp = Player.max_hp;\r\n displayLocationContent();\r\n return false;\r\n });\r\n}\r\n\r\nfunction travelToCity(destCityName, cost) {\r\n if (Player.firstTimeTraveled === false) {\r\n Player.firstTimeTraveled = true;\r\n document.getElementById(\"travel-tab\").style.display = \"list-item\";\r\n document.getElementById(\"world-menu-header\").click();\r\n document.getElementById(\"world-menu-header\").click();\r\n }\r\n\r\n if (Player.money.lt(cost)) {\r\n dialogBoxCreate(\"You cannot afford to travel to \" + destCityName);\r\n return;\r\n }\r\n Player.loseMoney(cost);\r\n\r\n Player.city = destCityName;\r\n dialogBoxCreate(\"You are now in \" + destCityName + \"!\");\r\n Engine.loadWorldContent();\r\n}\r\n\r\nfunction purchaseTorRouter() {\r\n if (Player.money.lt(CONSTANTS.TorRouterCost)) {\r\n dialogBoxCreate(\"You cannot afford to purchase the Tor router\");\r\n return;\r\n }\r\n Player.loseMoney(CONSTANTS.TorRouterCost);\r\n\r\n var darkweb = new Server({\r\n ip:createRandomIp(), hostname:\"darkweb\", organizationName:\"\",\r\n isConnectedTo:false, adminRights:false, purchasedByPlayer:false, maxRam:1\r\n });\r\n AddToAllServers(darkweb);\r\n SpecialServerIps.addIp(\"Darkweb Server\", darkweb.ip);\r\n\r\n document.getElementById(\"location-purchase-tor\").setAttribute(\"class\", \"a-link-button-inactive\");\r\n\r\n Player.getHomeComputer().serversOnNetwork.push(darkweb.ip);\r\n darkweb.serversOnNetwork.push(Player.getHomeComputer().ip);\r\n dialogBoxCreate(\"You have purchased a Tor router!<br>You now have access to the dark web from your home computer<br>Use the scan/netstat commands to search for the dark web connection.\");\r\n}\r\n\r\nfunction displayUniversityLocationContent(costMult) {\r\n var studyComputerScienceButton = document.getElementById(\"location-study-computer-science\");\r\n var classDataStructuresButton = document.getElementById(\"location-data-structures-class\");\r\n var classNetworksButton = document.getElementById(\"location-networks-class\");\r\n var classAlgorithmsButton = document.getElementById(\"location-algorithms-class\");\r\n var classManagementButton = document.getElementById(\"location-management-class\");\r\n var classLeadershipButton = document.getElementById(\"location-leadership-class\");\r\n studyComputerScienceButton.style.display = \"block\";\r\n classDataStructuresButton.style.display = \"block\";\r\n classNetworksButton.style.display = \"block\";\r\n classAlgorithmsButton.style.display = \"block\";\r\n classManagementButton.style.display = \"block\";\r\n classLeadershipButton.style.display = \"block\";\r\n\r\n //Costs (per second)\r\n var dataStructuresCost = CONSTANTS.ClassDataStructuresBaseCost * costMult;\r\n var networksCost = CONSTANTS.ClassNetworksBaseCost * costMult;\r\n var algorithmsCost = CONSTANTS.ClassAlgorithmsBaseCost * costMult;\r\n var managementCost = CONSTANTS.ClassManagementBaseCost * costMult;\r\n var leadershipCost = CONSTANTS.ClassLeadershipBaseCost * costMult;\r\n\r\n //Update button text to show cost\r\n classDataStructuresButton.innerHTML = \"Take Data Structures course ($\" + dataStructuresCost + \" / sec)\";\r\n classNetworksButton.innerHTML = \"Take Networks course ($\" + networksCost + \" / sec)\";\r\n classAlgorithmsButton.innerHTML = \"Take Algorithms course ($\" + algorithmsCost + \" / sec)\";\r\n classManagementButton.innerHTML = \"Take Management course ($\" + managementCost + \" / sec)\";\r\n classLeadershipButton.innerHTML = \"Take Leadership course ($\" + leadershipCost + \" / sec)\";\r\n}\r\n\r\nfunction setUniversityLocationButtons(costMult, expMult) {\r\n var newStudyCS = clearEventListeners(\"location-study-computer-science\");\r\n newStudyCS.addEventListener(\"click\", function() {\r\n Player.startClass(costMult, expMult, CONSTANTS.ClassStudyComputerScience);\r\n return false;\r\n });\r\n\r\n var newClassDataStructures = clearEventListeners(\"location-data-structures-class\");\r\n newClassDataStructures.addEventListener(\"click\", function() {\r\n Player.startClass(costMult, expMult, CONSTANTS.ClassDataStructures);\r\n return false;\r\n });\r\n\r\n var newClassNetworks = clearEventListeners(\"location-networks-class\");\r\n newClassNetworks.addEventListener(\"click\", function() {\r\n Player.startClass(costMult, expMult, CONSTANTS.ClassNetworks);\r\n return false;\r\n });\r\n\r\n var newClassAlgorithms = clearEventListeners(\"location-algorithms-class\");\r\n newClassAlgorithms.addEventListener(\"click\", function() {\r\n Player.startClass(costMult, expMult, CONSTANTS.ClassAlgorithms);\r\n return false;\r\n });\r\n\r\n var newClassManagement = clearEventListeners(\"location-management-class\");\r\n newClassManagement.addEventListener(\"click\", function() {\r\n Player.startClass(costMult, expMult, CONSTANTS.ClassManagement);\r\n return false;\r\n });\r\n\r\n var newClassLeadership = clearEventListeners(\"location-leadership-class\");\r\n newClassLeadership.addEventListener(\"click\", function() {\r\n Player.startClass(costMult, expMult, CONSTANTS.ClassLeadership);\r\n return false;\r\n });\r\n}\r\n\r\nfunction displayGymLocationContent(costMult) {\r\n var gymStrButton = document.getElementById(\"location-gym-train-str\");\r\n var gymDefButton = document.getElementById(\"location-gym-train-def\");\r\n var gymDexButton = document.getElementById(\"location-gym-train-dex\");\r\n var gymAgiButton = document.getElementById(\"location-gym-train-agi\");\r\n gymStrButton.style.display = \"block\";\r\n gymDefButton.style.display = \"block\";\r\n gymDexButton.style.display = \"block\";\r\n gymAgiButton.style.display = \"block\";\r\n\r\n //Costs (per second)\r\n var cost = CONSTANTS.ClassGymBaseCost * costMult;\r\n\r\n //Update button text to show cost\r\n gymStrButton.innerHTML = \"Train Strength ($\" + cost + \" / sec)\";\r\n gymDefButton.innerHTML = \"Train Defense ($\" + cost + \" / sec)\";\r\n gymDexButton.innerHTML = \"Train Dexterity ($\" + cost + \" / sec)\";\r\n gymAgiButton.innerHTML = \"Train Agility ($\" + cost + \" / sec)\";\r\n}\r\n\r\nfunction setGymLocationButtons(costMult, expMult) {\r\n var gymStr = clearEventListeners(\"location-gym-train-str\");\r\n gymStr.addEventListener(\"click\", function() {\r\n Player.startClass(costMult, expMult, CONSTANTS.ClassGymStrength);\r\n return false;\r\n });\r\n\r\n var gymDef = clearEventListeners(\"location-gym-train-def\");\r\n gymDef.addEventListener(\"click\", function() {\r\n Player.startClass(costMult, expMult, CONSTANTS.ClassGymDefense);\r\n return false;\r\n });\r\n\r\n var gymDex = clearEventListeners(\"location-gym-train-dex\");\r\n gymDex.addEventListener(\"click\", function() {\r\n Player.startClass(costMult, expMult, CONSTANTS.ClassGymDexterity);\r\n return false;\r\n });\r\n\r\n var gymAgi = clearEventListeners(\"location-gym-train-agi\");\r\n gymAgi.addEventListener(\"click\", function() {\r\n Player.startClass(costMult, expMult, CONSTANTS.ClassGymAgility);\r\n return false;\r\n });\r\n}\r\n\r\nfunction setInfiltrateButton(btn, companyName, startLevel, val, maxClearance, difficulty) {\r\n btn.style.display = \"block\";\r\n btn.addEventListener(\"click\", function() {\r\n Engine.loadInfiltrationContent();\r\n beginInfiltration(companyName, startLevel, val, maxClearance, difficulty)\r\n return false;\r\n });\r\n}\r\n\r\n//Finds the next target job for the player at the given company (loc) and\r\n//adds the tooltiptext to the Application button, given by 'button'\r\nfunction setJobRequirementTooltip(loc, entryPosType, btn) {\r\n var company = Companies[loc];\r\n if (company == null) {return;}\r\n var pos = Player.getNextCompanyPosition(company, entryPosType);\r\n if (pos == null) {return};\r\n if (!company.hasPosition(pos)) {return;}\r\n var reqText = getJobRequirementText(company, pos, true);\r\n btn.innerHTML += \"<span class='tooltiptext'>\" + reqText + \"</span>\";\r\n}\r\n\r\nfunction travelBoxCreate(destCityName, cost) {\r\n var yesBtn = yesNoBoxGetYesButton(), noBtn = yesNoBoxGetNoButton();\r\n yesBtn.innerHTML = \"Yes\";\r\n noBtn.innerHTML = \"No\";\r\n noBtn.addEventListener(\"click\", () => {\r\n yesNoBoxClose();\r\n return false;\r\n });\r\n yesBtn.addEventListener(\"click\", () => {\r\n yesNoBoxClose();\r\n travelToCity(destCityName, cost);\r\n return false;\r\n });\r\n yesNoBoxCreate(\"Would you like to travel to \" + destCityName + \"? The trip will cost $\" + formatNumber(cost, 2) + \".\");\r\n}\r\n\r\nfunction purchaseServerBoxCreate(ram, cost) {\r\n var yesBtn = yesNoTxtInpBoxGetYesButton();\r\n var noBtn = yesNoTxtInpBoxGetNoButton();\r\n yesBtn.innerHTML = \"Purchase Server\";\r\n noBtn.innerHTML = \"Cancel\";\r\n yesBtn.addEventListener(\"click\", function() {\r\n purchaseServer(ram, cost);\r\n yesNoTxtInpBoxClose();\r\n });\r\n noBtn.addEventListener(\"click\", function() {\r\n yesNoTxtInpBoxClose();\r\n });\r\n\r\n yesNoTxtInpBoxCreate(\"Would you like to purchase a new server with \" + ram +\r\n \"GB of RAM for $\" + formatNumber(cost, 2) + \"?<br><br>\" +\r\n \"Please enter the server hostname below:<br>\");\r\n}\r\n\r\nexport {Locations, displayLocationContent, initLocationButtons};\r\n","import {dialogBoxCreate} from \"../utils/DialogBox.js\";\r\nimport {gameOptionsBoxOpen, gameOptionsBoxClose}from \"../utils/GameOptions.js\";\r\nimport {clearEventListeners, createElement,\r\n removeChildrenFromElement,\r\n exceptionAlert} from \"../utils/HelperFunctions.js\";\r\nimport numeral from \"numeral/min/numeral.min\";\r\nimport {formatNumber,\r\n convertTimeMsToTimeElapsedString} from \"../utils/StringHelperFunctions.js\";\r\nimport {loxBoxCreate, logBoxUpdateText,\r\n logBoxOpened} from \"../utils/LogBox.js\";\r\n\r\nimport {updateActiveScriptsItems} from \"./ActiveScriptsUI.js\";\r\nimport {Augmentations, installAugmentations,\r\n initAugmentations, AugmentationNames,\r\n displayAugmentationsContent} from \"./Augmentations.js\";\r\nimport {BitNodes, initBitNodes,\r\n initBitNodeMultipliers} from \"./BitNode.js\";\r\nimport {Bladeburner} from \"./Bladeburner.js\";\r\nimport {cinematicTextFlag} from \"./CinematicText.js\";\r\nimport {CompanyPositions, initCompanies} from \"./Company.js\";\r\nimport {Corporation} from \"./CompanyManagement.js\";\r\nimport {CONSTANTS} from \"./Constants.js\";\r\nimport {Programs, displayCreateProgramContent,\r\n getNumAvailableCreateProgram,\r\n initCreateProgramButtons} from \"./CreateProgram.js\";\r\nimport {displayFactionContent, joinFaction,\r\n processPassiveFactionRepGain, Factions,\r\n inviteToFaction, initFactions} from \"./Faction.js\";\r\nimport {FconfSettings} from \"./Fconf.js\";\r\nimport {Locations, displayLocationContent,\r\n initLocationButtons} from \"./Location.js\";\r\nimport {displayGangContent, updateGangContent,\r\n Gang} from \"./Gang.js\";\r\nimport {displayHacknetNodesContent, processAllHacknetNodeEarnings,\r\n updateHacknetNodesContent} from \"./HacknetNode.js\";\r\nimport {iTutorialStart} from \"./InteractiveTutorial.js\";\r\nimport {initLiterature} from \"./Literature.js\";\r\nimport {checkForMessagesToSend, initMessages} from \"./Message.js\";\r\nimport {inMission, currMission} from \"./Missions.js\";\r\nimport {initSingularitySFFlags,\r\n hasSingularitySF, hasCorporationSF} from \"./NetscriptFunctions.js\";\r\nimport {updateOnlineScriptTimes,\r\n runScriptsLoop} from \"./NetscriptWorker.js\";\r\nimport {Player} from \"./Player.js\";\r\nimport {prestigeAugmentation,\r\n prestigeSourceFile} from \"./Prestige.js\";\r\nimport {redPillFlag} from \"./RedPill.js\";\r\nimport {saveObject, loadGame} from \"./SaveObject.js\";\r\nimport {loadAllRunningScripts, scriptEditorInit,\r\n updateScriptEditorContent} from \"./Script.js\";\r\nimport {AllServers, Server, initForeignServers} from \"./Server.js\";\r\nimport {Settings, setSettingsLabels} from \"./Settings.js\";\r\nimport {initSourceFiles, SourceFiles} from \"./SourceFile.js\";\r\nimport {SpecialServerIps, initSpecialServerIps} from \"./SpecialServerIps.js\";\r\nimport {StockMarket, StockSymbols,\r\n SymbolToStockMap, initStockSymbols,\r\n initSymbolToStockMap, stockMarketCycle,\r\n updateStockPrices,\r\n displayStockMarketContent} from \"./StockMarket.js\";\r\nimport {Terminal, postNetburnerText, post, KEY} from \"./Terminal.js\";\r\n\r\n/* Shortcuts to navigate through the game\r\n * Alt-t - Terminal\r\n * Alt-c - Character\r\n * Alt-e - Script editor\r\n * Alt-s - Active scripts\r\n * Alt-h - Hacknet Nodes\r\n * Alt-w - City\r\n * Alt-j - Job\r\n * Alt-r - Travel Agency of current city\r\n * Alt-p - Create program\r\n * Alt-f - Factions\r\n * Alt-a - Augmentations\r\n * Alt-u - Tutorial\r\n * Alt-o - Options\r\n */\r\n$(document).keydown(function(e) {\r\n if (Settings.DisableHotkeys === true) {return;}\r\n if (!Player.isWorking && !redPillFlag && !inMission && !cinematicTextFlag) {\r\n if (e.keyCode == 84 && e.altKey) {\r\n e.preventDefault();\r\n Engine.loadTerminalContent();\r\n } else if (e.keyCode === KEY.C && e.altKey) {\r\n e.preventDefault();\r\n Engine.loadCharacterContent();\r\n } else if (e.keyCode === KEY.E && e.altKey) {\r\n e.preventDefault();\r\n Engine.loadScriptEditorContent();\r\n } else if (e.keyCode === KEY.S && e.altKey) {\r\n e.preventDefault();\r\n Engine.loadActiveScriptsContent();\r\n } else if (e.keyCode === KEY.H && e.altKey) {\r\n e.preventDefault();\r\n Engine.loadHacknetNodesContent();\r\n } else if (e.keyCode === KEY.W && e.altKey) {\r\n e.preventDefault();\r\n Engine.loadWorldContent();\r\n } else if (e.keyCode === KEY.J && e.altKey) {\r\n e.preventDefault();\r\n Engine.loadJobContent();\r\n } else if (e.keyCode === KEY.R && e.altKey) {\r\n e.preventDefault();\r\n Engine.loadTravelContent();\r\n } else if (e.keyCode === KEY.P && e.altKey) {\r\n e.preventDefault();\r\n Engine.loadCreateProgramContent();\r\n } else if (e.keyCode === KEY.F && e.altKey) {\r\n //Overriden by Fconf\r\n if (Engine.currentPage === Engine.Page.Terminal && FconfSettings.ENABLE_BASH_HOTKEYS) {\r\n return;\r\n }\r\n e.preventDefault();\r\n Engine.loadFactionsContent();\r\n } else if (e.keyCode === KEY.A && e.altKey) {\r\n e.preventDefault();\r\n Engine.loadAugmentationsContent();\r\n } else if (e.keyCode === KEY.U && e.altKey) {\r\n e.preventDefault();\r\n Engine.loadTutorialContent();\r\n }\r\n }\r\n\r\n if (e.keyCode === KEY.O && e.altKey) {\r\n e.preventDefault();\r\n gameOptionsBoxOpen();\r\n }\r\n});\r\n\r\nlet Engine = {\r\n version: \"\",\r\n Debug: true,\r\n\r\n //Clickable objects\r\n Clickables: {\r\n //Main menu buttons\r\n terminalMainMenuButton: null,\r\n characterMainMenuButton: null,\r\n scriptEditorMainMenuButton: null,\r\n activeScriptsMainMenuButton: null,\r\n hacknetNodesMainMenuButton: null,\r\n worldMainMenuButton: null,\r\n travelMainMenuButton: null,\r\n jobMainMenuButton: null,\r\n createProgramMainMenuButton: null,\r\n factionsMainMenuButton: null,\r\n augmentationsMainMenuButton: null,\r\n tutorialMainMenuButton: null,\r\n saveMainMenuButton: null,\r\n deleteMainMenuButton: null,\r\n\r\n //Tutorial buttons\r\n tutorialNetworkingButton: null,\r\n tutorialHackingButton: null,\r\n tutorialScriptsButton: null,\r\n tutorialNetscriptButton: null,\r\n tutorialTravelingButton: null,\r\n tutorialCompaniesButton: null,\r\n tutorialFactionsButton: null,\r\n tutorialAugmentationsButton: null,\r\n tutorialBackButton: null,\r\n },\r\n\r\n //Display objects\r\n Display: {\r\n //Progress bar\r\n progress: null,\r\n\r\n //Display for status text (such as \"Saved\" or \"Loaded\")\r\n statusText: null,\r\n\r\n hacking_skill: null,\r\n\r\n //Main menu content\r\n terminalContent: null,\r\n characterContent: null,\r\n scriptEditorContent: null,\r\n activeScriptsContent: null,\r\n hacknetNodesContent: null,\r\n worldContent: null,\r\n createProgramContent: null,\r\n factionsContent: null,\r\n factionContent: null,\r\n factionAugmentationsContent: null,\r\n augmentationsContent: null,\r\n tutorialContent: null,\r\n infiltrationContent: null,\r\n stockMarketContent: null,\r\n locationContent: null,\r\n workInProgressContent: null,\r\n redPillContent: null,\r\n cinematicTextContent: null,\r\n missionContent: null,\r\n\r\n //Character info\r\n characterInfo: null,\r\n },\r\n\r\n //Current page status\r\n Page: {\r\n Terminal: \"Terminal\",\r\n CharacterInfo: \"CharacterInfo\",\r\n ScriptEditor: \"ScriptEditor\",\r\n ActiveScripts: \"ActiveScripts\",\r\n HacknetNodes: \"HacknetNodes\",\r\n World: \"World\",\r\n CreateProgram: \"CreateProgram\",\r\n Factions: \"Factions\",\r\n Faction: \"Faction\",\r\n Augmentations: \"Augmentations\",\r\n Tutorial: \"Tutorial\",\r\n Location: \"Location\",\r\n workInProgress: \"WorkInProgress\",\r\n RedPill: \"RedPill\",\r\n CinematicText: \"CinematicText\",\r\n Infiltration: \"Infiltration\",\r\n StockMarket: \"StockMarket\",\r\n Gang: \"Gang\",\r\n Mission: \"Mission\",\r\n Corporation: \"Corporation\",\r\n Bladeburner: \"Bladeburner\",\r\n },\r\n currentPage: null,\r\n\r\n\r\n //Time variables (milliseconds unix epoch time)\r\n _lastUpdate: new Date().getTime(),\r\n _idleSpeed: 200, //Speed (in ms) at which the main loop is updated\r\n\r\n\r\n /* Load content when a main menu button is clicked */\r\n loadTerminalContent: function() {\r\n Engine.hideAllContent();\r\n Engine.Display.terminalContent.style.display = \"block\";\r\n Engine.currentPage = Engine.Page.Terminal;\r\n document.getElementById(\"terminal-menu-link\").classList.add(\"active\");\r\n },\r\n\r\n loadCharacterContent: function() {\r\n Engine.hideAllContent();\r\n Engine.Display.characterContent.style.display = \"block\";\r\n Engine.displayCharacterInfo();\r\n Engine.currentPage = Engine.Page.CharacterInfo;\r\n document.getElementById(\"stats-menu-link\").classList.add(\"active\");\r\n },\r\n\r\n loadScriptEditorContent: function(filename = \"\", code = \"\") {\r\n Engine.hideAllContent();\r\n Engine.Display.scriptEditorContent.style.display = \"block\";\r\n var editor = ace.edit('javascript-editor');\r\n if (filename != \"\") {\r\n document.getElementById(\"script-editor-filename\").value = filename;\r\n editor.setValue(code);\r\n }\r\n editor.focus();\r\n updateScriptEditorContent();\r\n Engine.currentPage = Engine.Page.ScriptEditor;\r\n document.getElementById(\"create-script-menu-link\").classList.add(\"active\");\r\n },\r\n\r\n loadActiveScriptsContent: function() {\r\n Engine.hideAllContent();\r\n Engine.Display.activeScriptsContent.style.display = \"block\";\r\n updateActiveScriptsItems();\r\n Engine.currentPage = Engine.Page.ActiveScripts;\r\n document.getElementById(\"active-scripts-menu-link\").classList.add(\"active\");\r\n },\r\n\r\n loadHacknetNodesContent: function() {\r\n Engine.hideAllContent();\r\n Engine.Display.hacknetNodesContent.style.display = \"block\";\r\n displayHacknetNodesContent();\r\n Engine.currentPage = Engine.Page.HacknetNodes;\r\n document.getElementById(\"hacknet-nodes-menu-link\").classList.add(\"active\");\r\n },\r\n\r\n loadWorldContent: function() {\r\n Engine.hideAllContent();\r\n Engine.Display.worldContent.style.display = \"block\";\r\n Engine.displayWorldInfo();\r\n Engine.currentPage = Engine.Page.World;\r\n document.getElementById(\"city-menu-link\").classList.add(\"active\");\r\n },\r\n\r\n loadCreateProgramContent: function() {\r\n Engine.hideAllContent();\r\n Engine.Display.createProgramContent.style.display = \"block\";\r\n displayCreateProgramContent();\r\n Engine.currentPage = Engine.Page.CreateProgram;\r\n document.getElementById(\"create-program-menu-link\").classList.add(\"active\");\r\n },\r\n\r\n loadFactionsContent: function() {\r\n Engine.hideAllContent();\r\n Engine.Display.factionsContent.style.display = \"block\";\r\n Engine.displayFactionsInfo();\r\n Engine.currentPage = Engine.Page.Factions;\r\n document.getElementById(\"factions-menu-link\").classList.add(\"active\");\r\n },\r\n\r\n loadFactionContent: function() {\r\n Engine.hideAllContent();\r\n Engine.Display.factionContent.style.display = \"block\";\r\n Engine.currentPage = Engine.Page.Faction;\r\n },\r\n\r\n loadAugmentationsContent: function() {\r\n Engine.hideAllContent();\r\n Engine.Display.augmentationsContent.style.display = \"block\";\r\n displayAugmentationsContent();\r\n Engine.currentPage = Engine.Page.Augmentations;\r\n document.getElementById(\"augmentations-menu-link\").classList.add(\"active\");\r\n },\r\n\r\n loadTutorialContent: function() {\r\n Engine.hideAllContent();\r\n Engine.Display.tutorialContent.style.display = \"block\";\r\n Engine.displayTutorialContent();\r\n Engine.currentPage = Engine.Page.Tutorial;\r\n document.getElementById(\"tutorial-menu-link\").classList.add(\"active\");\r\n },\r\n\r\n loadLocationContent: function() {\r\n Engine.hideAllContent();\r\n Engine.Display.locationContent.style.display = \"block\";\r\n displayLocationContent();\r\n Engine.currentPage = Engine.Page.Location;\r\n },\r\n\r\n loadTravelContent: function() {\r\n switch(Player.city) {\r\n case Locations.Aevum:\r\n Player.location = Locations.AevumTravelAgency;\r\n break;\r\n case Locations.Chongqing:\r\n Player.location = Locations.ChongqingTravelAgency;\r\n break;\r\n case Locations.Sector12:\r\n Player.location = Locations.Sector12TravelAgency;\r\n break;\r\n case Locations.NewTokyo:\r\n Player.location = Locations.NewTokyoTravelAgency;\r\n break;\r\n case Locations.Ishima:\r\n Player.location = Locations.IshimaTravelAgency;\r\n break;\r\n case Locations.Volhaven:\r\n Player.location = Locations.VolhavenTravelAgency;\r\n break;\r\n default:\r\n dialogBoxCreate(\"ERROR: Invalid city. This is a bug please contact game dev\");\r\n break;\r\n }\r\n Engine.loadLocationContent();\r\n },\r\n\r\n loadJobContent: function() {\r\n if (Player.companyName == \"\") {\r\n dialogBoxCreate(\"You do not currently have a job! You can visit various companies \" +\r\n \"in the city and try to find a job.\");\r\n return;\r\n }\r\n Player.location = Player.companyName;\r\n Engine.loadLocationContent();\r\n },\r\n\r\n loadWorkInProgressContent: function() {\r\n Engine.hideAllContent();\r\n var mainMenu = document.getElementById(\"mainmenu-container\");\r\n //mainMenu.style.visibility = \"hidden\";\r\n mainMenu.style.visibility = \"hidden\";\r\n Engine.Display.workInProgressContent.style.display = \"block\";\r\n Engine.currentPage = Engine.Page.WorkInProgress;\r\n },\r\n\r\n loadRedPillContent: function() {\r\n Engine.hideAllContent();\r\n var mainMenu = document.getElementById(\"mainmenu-container\");\r\n mainMenu.style.visibility = \"hidden\";\r\n Engine.Display.redPillContent.style.display = \"block\";\r\n Engine.currentPage = Engine.Page.RedPill;\r\n },\r\n\r\n loadCinematicTextContent: function() {\r\n Engine.hideAllContent();\r\n var mainMenu = document.getElementById(\"mainmenu-container\");\r\n mainMenu.style.visibility = \"hidden\";\r\n Engine.Display.cinematicTextContent.style.display = \"block\";\r\n Engine.currentPage = Engine.Page.CinematicText;\r\n },\r\n\r\n loadInfiltrationContent: function() {\r\n Engine.hideAllContent();\r\n Engine.Display.infiltrationContent.style.display = \"block\";\r\n Engine.currentPage = Engine.Page.Infiltration;\r\n },\r\n\r\n loadStockMarketContent: function() {\r\n Engine.hideAllContent();\r\n Engine.Display.stockMarketContent.style.display = \"block\";\r\n Engine.currentPage = Engine.Page.StockMarket;\r\n displayStockMarketContent();\r\n },\r\n\r\n loadGangContent: function() {\r\n Engine.hideAllContent();\r\n if (document.getElementById(\"gang-container\") || Player.inGang()) {\r\n displayGangContent();\r\n Engine.currentPage = Engine.Page.Gang;\r\n } else {\r\n Engine.loadTerminalContent();\r\n Engine.currentPage = Engine.Page.Terminal;\r\n }\r\n },\r\n\r\n loadMissionContent: function() {\r\n Engine.hideAllContent();\r\n document.getElementById(\"mainmenu-container\").style.visibility = \"hidden\";\r\n document.getElementById(\"character-overview-wrapper\").style.visibility = \"hidden\";\r\n Engine.Display.missionContent.style.display = \"block\";\r\n Engine.currentPage = Engine.Page.Mission;\r\n },\r\n\r\n loadCorporationContent: function() {\r\n if (Player.corporation instanceof Corporation) {\r\n Engine.hideAllContent();\r\n document.getElementById(\"character-overview-wrapper\").style.visibility = \"hidden\";\r\n Player.corporation.createUI();\r\n Engine.currentPage = Engine.Page.Corporation;\r\n }\r\n },\r\n\r\n loadBladeburnerContent: function() {\r\n if (Player.bladeburner instanceof Bladeburner) {\r\n try {\r\n Engine.hideAllContent();\r\n Engine.currentPage = Engine.Page.Bladeburner;\r\n Player.bladeburner.createContent();\r\n } catch(e) {\r\n exceptionAlert(e);\r\n }\r\n }\r\n },\r\n\r\n //Helper function that hides all content\r\n hideAllContent: function() {\r\n Engine.Display.terminalContent.style.display = \"none\";\r\n Engine.Display.characterContent.style.display = \"none\";\r\n Engine.Display.scriptEditorContent.style.display = \"none\";\r\n Engine.Display.activeScriptsContent.style.display = \"none\";\r\n Engine.Display.hacknetNodesContent.style.display = \"none\";\r\n Engine.Display.worldContent.style.display = \"none\";\r\n Engine.Display.createProgramContent.style.display = \"none\";\r\n Engine.Display.factionsContent.style.display = \"none\";\r\n Engine.Display.factionContent.style.display = \"none\";\r\n Engine.Display.factionAugmentationsContent.style.display = \"none\";\r\n Engine.Display.augmentationsContent.style.display = \"none\";\r\n Engine.Display.tutorialContent.style.display = \"none\";\r\n Engine.Display.locationContent.style.display = \"none\";\r\n Engine.Display.workInProgressContent.style.display = \"none\";\r\n Engine.Display.redPillContent.style.display = \"none\";\r\n Engine.Display.cinematicTextContent.style.display = \"none\";\r\n Engine.Display.infiltrationContent.style.display = \"none\";\r\n Engine.Display.stockMarketContent.style.display = \"none\";\r\n Engine.Display.missionContent.style.display = \"none\";\r\n if (document.getElementById(\"gang-container\")) {\r\n document.getElementById(\"gang-container\").style.display = \"none\";\r\n }\r\n\r\n if (Player.corporation instanceof Corporation) {\r\n Player.corporation.clearUI();\r\n }\r\n\r\n if (Player.bladeburner instanceof Bladeburner) {\r\n Player.bladeburner.clearContent();\r\n }\r\n\r\n //Location lists\r\n Engine.aevumLocationsList.style.display = \"none\";\r\n Engine.chongqingLocationsList.style.display = \"none\";\r\n Engine.sector12LocationsList.style.display = \"none\";\r\n Engine.newTokyoLocationsList.style.display = \"none\";\r\n Engine.ishimaLocationsList.style.display = \"none\";\r\n Engine.volhavenLocationsList.style.display = \"none\";\r\n\r\n //Make nav menu tabs inactive\r\n document.getElementById(\"terminal-menu-link\").classList.remove(\"active\");\r\n document.getElementById(\"create-script-menu-link\").classList.remove(\"active\");\r\n document.getElementById(\"active-scripts-menu-link\").classList.remove(\"active\");\r\n document.getElementById(\"create-program-menu-link\").classList.remove(\"active\");\r\n document.getElementById(\"stats-menu-link\").classList.remove(\"active\");\r\n document.getElementById(\"factions-menu-link\").classList.remove(\"active\");\r\n document.getElementById(\"augmentations-menu-link\").classList.remove(\"active\");\r\n document.getElementById(\"hacknet-nodes-menu-link\").classList.remove(\"active\");\r\n document.getElementById(\"city-menu-link\").classList.remove(\"active\");\r\n document.getElementById(\"tutorial-menu-link\").classList.remove(\"active\");\r\n document.getElementById(\"options-menu-link\").classList.remove(\"active\");\r\n },\r\n\r\n displayCharacterOverviewInfo: function() {\r\n if (Player.hp == null) {Player.hp = Player.max_hp;}\r\n var overviewText = \"Hp: \" + Player.hp + \" / \" + Player.max_hp + \"<br>\" +\r\n \"Money: \" + numeral(Player.money.toNumber()).format('($0.000a)') + \"<br>\" +\r\n \"Hack: \" + (Player.hacking_skill).toLocaleString() + \"<br>\" +\r\n \"Str: \" + (Player.strength).toLocaleString() + \"<br>\" +\r\n \"Def: \" + (Player.defense).toLocaleString() + \"<br>\" +\r\n \"Dex: \" + (Player.dexterity).toLocaleString() + \"<br>\" +\r\n \"Agi: \" + (Player.agility).toLocaleString() + \"<br>\" +\r\n \"Cha: \" + (Player.charisma).toLocaleString();\r\n if (Player.intelligence >= 1) {\r\n overviewText += \"<br>Int: \" + (Player.intelligence).toLocaleString();\r\n }\r\n document.getElementById(\"character-overview-text\").innerHTML = overviewText.replace( / /g, \"&nbsp;\");\r\n },\r\n\r\n /* Display character info */\r\n displayCharacterInfo: function() {\r\n removeChildrenFromElement(Engine.Display.characterInfo);\r\n\r\n var companyPosition = \"\";\r\n if (Player.companyPosition != \"\") {\r\n companyPosition = Player.companyPosition.positionName;\r\n }\r\n\r\n var intText = \"\";\r\n if (Player.intelligence > 0) {\r\n intText = 'Intelligence: ' + (Player.intelligence).toLocaleString() + \"<br><br><br>\";\r\n }\r\n\r\n Engine.Display.characterInfo.appendChild(createElement(\"pre\", {\r\n innerHTML:\r\n '<b>General</b><br><br>' +\r\n 'Current City: ' + Player.city + '<br><br>' +\r\n 'Employer: ' + Player.companyName + '<br>' +\r\n 'Job Title: ' + companyPosition + '<br><br>' +\r\n 'Money: $' + formatNumber(Player.money.toNumber(), 2)+ '<br><br><br>' +\r\n '<b>Stats</b><br><br>' +\r\n 'Hacking Level: ' + (Player.hacking_skill).toLocaleString() +\r\n \" (\" + numeral(Player.hacking_exp).format('(0.000a)') + ' experience)<br>' +\r\n 'Strength: ' + (Player.strength).toLocaleString() +\r\n \" (\" + numeral(Player.strength_exp).format('(0.000a)') + ' experience)<br>' +\r\n 'Defense: ' + (Player.defense).toLocaleString() +\r\n \" (\" + numeral(Player.defense_exp).format('(0.000a)')+ ' experience)<br>' +\r\n 'Dexterity: ' + (Player.dexterity).toLocaleString() +\r\n \" (\" + numeral(Player.dexterity_exp).format('(0.000a)') + ' experience)<br>' +\r\n 'Agility: ' + (Player.agility).toLocaleString() +\r\n \" (\" + numeral(Player.agility_exp).format('(0.000a)') + ' experience)<br>' +\r\n 'Charisma: ' + (Player.charisma).toLocaleString() +\r\n \" (\" + numeral(Player.charisma_exp).format('(0.000a)') + ' experience)<br>' +\r\n intText +\r\n '<b>Multipliers</b><br><br>' +\r\n 'Hacking Chance multiplier: ' + formatNumber(Player.hacking_chance_mult * 100, 2) + '%<br>' +\r\n 'Hacking Speed multiplier: ' + formatNumber(Player.hacking_speed_mult * 100, 2) + '%<br>' +\r\n 'Hacking Money multiplier: ' + formatNumber(Player.hacking_money_mult * 100, 2) + '%<br>' +\r\n 'Hacking Growth multiplier: ' + formatNumber(Player.hacking_grow_mult * 100, 2) + '%<br><br>' +\r\n 'Hacking Level multiplier: ' + formatNumber(Player.hacking_mult * 100, 2) + '%<br>' +\r\n 'Hacking Experience multiplier: ' + formatNumber(Player.hacking_exp_mult * 100, 2) + '%<br><br>' +\r\n 'Strength Level multiplier: ' + formatNumber(Player.strength_mult * 100, 2) + '%<br>' +\r\n 'Strength Experience multiplier: ' + formatNumber(Player.strength_exp_mult * 100, 2) + '%<br><br>' +\r\n 'Defense Level multiplier: ' + formatNumber(Player.defense_mult * 100, 2) + '%<br>' +\r\n 'Defense Experience multiplier: ' + formatNumber(Player.defense_exp_mult * 100, 2) + '%<br><br>' +\r\n 'Dexterity Level multiplier: ' + formatNumber(Player.dexterity_mult * 100, 2) + '%<br>' +\r\n 'Dexterity Experience multiplier: ' + formatNumber(Player.dexterity_exp_mult * 100, 2) + '%<br><br>' +\r\n 'Agility Level multiplier: ' + formatNumber(Player.agility_mult * 100, 2) + '%<br>' +\r\n 'Agility Experience multiplier: ' + formatNumber(Player.agility_exp_mult * 100, 2) + '%<br><br>' +\r\n 'Charisma Level multiplier: ' + formatNumber(Player.charisma_mult * 100, 2) + '%<br>' +\r\n 'Charisma Experience multiplier: ' + formatNumber(Player.charisma_exp_mult * 100, 2) + '%<br><br>' +\r\n 'Hacknet Node production multiplier: ' + formatNumber(Player.hacknet_node_money_mult * 100, 2) + '%<br>' +\r\n 'Hacknet Node purchase cost multiplier: ' + formatNumber(Player.hacknet_node_purchase_cost_mult * 100, 2) + '%<br>' +\r\n 'Hacknet Node RAM upgrade cost multiplier: ' + formatNumber(Player.hacknet_node_ram_cost_mult * 100, 2) + '%<br>' +\r\n 'Hacknet Node Core purchase cost multiplier: ' + formatNumber(Player.hacknet_node_core_cost_mult * 100, 2) + '%<br>' +\r\n 'Hacknet Node level upgrade cost multiplier: ' + formatNumber(Player.hacknet_node_level_cost_mult * 100, 2) + '%<br><br>' +\r\n 'Company reputation gain multiplier: ' + formatNumber(Player.company_rep_mult * 100, 2) + '%<br>' +\r\n 'Faction reputation gain multiplier: ' + formatNumber(Player.faction_rep_mult * 100, 2) + '%<br>' +\r\n 'Salary multiplier: ' + formatNumber(Player.work_money_mult * 100, 2) + '%<br>' +\r\n 'Crime success multiplier: ' + formatNumber(Player.crime_success_mult * 100, 2) + '%<br>' +\r\n 'Crime money multiplier: ' + formatNumber(Player.crime_money_mult * 100, 2) + '%<br><br><br>' +\r\n '<b>Misc</b><br><br>' +\r\n 'Servers owned: ' + Player.purchasedServers.length + '<br>' +\r\n 'Hacknet Nodes owned: ' + Player.hacknetNodes.length + '<br>' +\r\n 'Augmentations installed: ' + Player.augmentations.length + '<br>' +\r\n 'Time played since last Augmentation: ' + convertTimeMsToTimeElapsedString(Player.playtimeSinceLastAug) + '<br>' +\r\n 'Time played: ' + convertTimeMsToTimeElapsedString(Player.totalPlaytime),\r\n }));\r\n\r\n if (Player.sourceFiles.length !== 0) {\r\n var index = \"BitNode\" + Player.bitNodeN;\r\n\r\n Engine.Display.characterInfo.appendChild(createElement(\"p\", {\r\n width:\"60%\",\r\n innerHTML:\r\n \"<br>Current BitNode: \" + Player.bitNodeN + \" (\" + BitNodes[index].name + \")<br><br>\",\r\n }));\r\n\r\n Engine.Display.characterInfo.appendChild(createElement(\"p\", {\r\n width:\"60%\", fontSize: \"13px\", marginLeft:\"4%\",\r\n innerHTML:BitNodes[index].info,\r\n }))\r\n }\r\n },\r\n\r\n /* Display locations in the world*/\r\n aevumLocationsList: null,\r\n chongqingLocationsList: null,\r\n sector12LocationsList: null,\r\n newTokyoLocationsList: null,\r\n ishimaLocationsList: null,\r\n volhavenLocationsList: null,\r\n\r\n displayWorldInfo: function() {\r\n Engine.aevumLocationsList.style.display = \"none\";\r\n Engine.chongqingLocationsList.style.display = \"none\";\r\n Engine.sector12LocationsList.style.display = \"none\";\r\n Engine.newTokyoLocationsList.style.display = \"none\";\r\n Engine.ishimaLocationsList.style.display = \"none\";\r\n Engine.volhavenLocationsList.style.display = \"none\";\r\n\r\n document.getElementById(\"world-city-name\").innerHTML = Player.city;\r\n var cityDesc = document.getElementById(\"world-city-desc\"); //TODO\r\n switch(Player.city) {\r\n case Locations.Aevum:\r\n Engine.aevumLocationsList.style.display = \"inline\";\r\n break;\r\n case Locations.Chongqing:\r\n Engine.chongqingLocationsList.style.display = \"inline\";\r\n break;\r\n case Locations.Sector12:\r\n Engine.sector12LocationsList.style.display = \"inline\";\r\n\r\n //City hall only in BitNode-3/with Source-File 3\r\n if ((Player.bitNodeN === 3 || hasCorporationSF) && Player.bitNodeN !== 8) {\r\n document.getElementById(\"sector12-cityhall-li\").style.display = \"block\";\r\n } else {\r\n document.getElementById(\"sector12-cityhall-li\").style.display = \"none\";\r\n }\r\n break;\r\n case Locations.NewTokyo:\r\n Engine.newTokyoLocationsList.style.display = \"inline\";\r\n break;\r\n case Locations.Ishima:\r\n Engine.ishimaLocationsList.style.display = \"inline\";\r\n break;\r\n case Locations.Volhaven:\r\n Engine.volhavenLocationsList.style.display = \"inline\";\r\n break;\r\n default:\r\n console.log(\"Invalid city value in Player object!\");\r\n break;\r\n }\r\n\r\n //Generic Locations (common to every city):\r\n // World Stock Exchange\r\n // Corporation (if applicable)\r\n // Bladeburner HQ (if applicable);\r\n var genericLocationsList = document.getElementById(\"generic-locations-list\");\r\n genericLocationsList.style.display = \"inline\";\r\n removeChildrenFromElement(genericLocationsList);\r\n var li = createElement(\"li\");\r\n li.appendChild(createElement(\"a\", {\r\n innerText:\"World Stock Exchange\", class:\"a-link-button\",\r\n clickListener:()=>{\r\n Player.location = Locations.WorldStockExchange;\r\n Engine.loadStockMarketContent();\r\n return false;\r\n }\r\n }));\r\n genericLocationsList.appendChild(li);\r\n\r\n if (Player.corporation instanceof Corporation && document.getElementById(\"location-corporation-button\") == null) {\r\n var li = createElement(\"li\");\r\n li.appendChild(createElement(\"a\", {\r\n innerText:Player.corporation.name, id:\"location-corporation-button\",\r\n class:\"a-link-button\",\r\n clickListener:()=>{\r\n Engine.loadCorporationContent();\r\n return false;\r\n }\r\n }));\r\n genericLocationsList.appendChild(li);\r\n }\r\n\r\n if (Player.bladeburner instanceof Bladeburner) {\r\n var li = createElement(\"li\");\r\n li.appendChild(createElement(\"a\", {\r\n innerText:\"Bladeburner Headquarters\", class:\"a-link-button\",\r\n clickListener:()=>{\r\n Engine.loadBladeburnerContent();\r\n return false;\r\n }\r\n }));\r\n genericLocationsList.appendChild(li);\r\n }\r\n },\r\n\r\n displayFactionsInfo: function() {\r\n removeChildrenFromElement(Engine.Display.factionsContent);\r\n\r\n //Factions\r\n Engine.Display.factionsContent.appendChild(createElement(\"h1\", {\r\n innerText:\"Factions\"\r\n }));\r\n Engine.Display.factionsContent.appendChild(createElement(\"p\", {\r\n innerText:\"Lists all factions you have joined\"\r\n }));\r\n var factionsList = createElement(\"ul\");\r\n Engine.Display.factionsContent.appendChild(createElement(\"br\"));\r\n\r\n //Add a button for each faction you are a member of\r\n for (var i = 0; i < Player.factions.length; ++i) {\r\n (function () {\r\n var factionName = Player.factions[i];\r\n\r\n factionsList.appendChild(createElement(\"a\", {\r\n class:\"a-link-button\", innerText:factionName, padding:\"4px\", margin:\"4px\",\r\n display:\"inline-block\",\r\n clickListener:()=>{\r\n Engine.loadFactionContent();\r\n displayFactionContent(factionName);\r\n return false;\r\n }\r\n }));\r\n factionsList.appendChild(createElement(\"br\"));\r\n }()); //Immediate invocation\r\n }\r\n Engine.Display.factionsContent.appendChild(factionsList);\r\n Engine.Display.factionsContent.appendChild(createElement(\"br\"));\r\n\r\n //Invited Factions\r\n Engine.Display.factionsContent.appendChild(createElement(\"h1\", {\r\n innerText:\"Outstanding Faction Invitations\"\r\n }));\r\n Engine.Display.factionsContent.appendChild(createElement(\"p\", {\r\n width:\"70%\",\r\n innerText:\"Lists factions you have been invited to, as well as \" +\r\n \"factions you have previously rejected. You can accept \" +\r\n \"these faction invitations at any time.\"\r\n }));\r\n var invitationsList = createElement(\"ul\");\r\n\r\n //Add a button to accept for each faction you have invitiations for\r\n for (var i = 0; i < Player.factionInvitations.length; ++i) {\r\n (function () {\r\n var factionName = Player.factionInvitations[i];\r\n\r\n var item = createElement(\"li\", {padding:\"6px\", margin:\"6px\"});\r\n item.appendChild(createElement(\"p\", {\r\n innerText:factionName, display:\"inline\", margin:\"4px\", padding:\"4px\"\r\n }));\r\n item.appendChild(createElement(\"a\", {\r\n innerText:\"Accept Faction Invitation\",\r\n class:\"a-link-button\", display:\"inline\", margin:\"4px\", padding:\"4px\",\r\n clickListener:()=>{\r\n joinFaction(Factions[factionName]);\r\n for (var i = 0; i < Player.factionInvitations.length; ++i) {\r\n if (Player.factionInvitations[i] == factionName || Factions[Player.factionInvitations[i]].isBanned) {\r\n Player.factionInvitations.splice(i, 1);\r\n i--;\r\n }\r\n }\r\n Engine.displayFactionsInfo();\r\n return false;\r\n }\r\n }));\r\n\r\n invitationsList.appendChild(item);\r\n }());\r\n }\r\n\r\n Engine.Display.factionsContent.appendChild(invitationsList);\r\n },\r\n\r\n displayTutorialContent: function() {\r\n document.getElementById(\"tutorial-getting-started-link\").style.display = \"block\";\r\n Engine.Clickables.tutorialNetworkingButton.style.display = \"block\";\r\n Engine.Clickables.tutorialHackingButton.style.display = \"block\";\r\n Engine.Clickables.tutorialScriptsButton.style.display = \"block\";\r\n Engine.Clickables.tutorialNetscriptButton.style.display = \"block\";\r\n Engine.Clickables.tutorialTravelingButton.style.display = \"block\";\r\n Engine.Clickables.tutorialCompaniesButton.style.display = \"block\";\r\n Engine.Clickables.tutorialFactionsButton.style.display = \"block\";\r\n Engine.Clickables.tutorialAugmentationsButton.style.display = \"block\";\r\n document.getElementById(\"tutorial-shortcuts-link\").style.display = \"block\";\r\n\r\n Engine.Clickables.tutorialBackButton.style.display = \"none\";\r\n document.getElementById(\"tutorial-text\").style.display = \"none\";\r\n },\r\n\r\n //Displays the text when a section of the Tutorial is opened\r\n displayTutorialPage: function(text) {\r\n document.getElementById(\"tutorial-getting-started-link\").style.display = \"none\";\r\n Engine.Clickables.tutorialNetworkingButton.style.display = \"none\";\r\n Engine.Clickables.tutorialHackingButton.style.display = \"none\";\r\n Engine.Clickables.tutorialScriptsButton.style.display = \"none\";\r\n Engine.Clickables.tutorialNetscriptButton.style.display = \"none\";\r\n Engine.Clickables.tutorialTravelingButton.style.display = \"none\";\r\n Engine.Clickables.tutorialCompaniesButton.style.display = \"none\";\r\n Engine.Clickables.tutorialFactionsButton.style.display = \"none\";\r\n Engine.Clickables.tutorialAugmentationsButton.style.display = \"none\";\r\n document.getElementById(\"tutorial-shortcuts-link\").style.display = \"none\";\r\n\r\n Engine.Clickables.tutorialBackButton.style.display = \"inline-block\";\r\n document.getElementById(\"tutorial-text\").style.display = \"block\";\r\n document.getElementById(\"tutorial-text\").innerHTML = text;\r\n },\r\n\r\n /* Main Event Loop */\r\n idleTimer: function() {\r\n //Get time difference\r\n var _thisUpdate = new Date().getTime();\r\n var diff = _thisUpdate - Engine._lastUpdate;\r\n var offset = diff % Engine._idleSpeed;\r\n\r\n //Divide this by cycle time to determine how many cycles have elapsed since last update\r\n diff = Math.floor(diff / Engine._idleSpeed);\r\n\r\n if (diff > 0) {\r\n //Update the game engine by the calculated number of cycles\r\n Engine._lastUpdate = _thisUpdate - offset;\r\n Player.lastUpdate = _thisUpdate - offset;\r\n Engine.updateGame(diff);\r\n }\r\n\r\n window.requestAnimationFrame(Engine.idleTimer);\r\n },\r\n\r\n updateGame: function(numCycles = 1) {\r\n //Update total playtime\r\n var time = numCycles * Engine._idleSpeed;\r\n if (Player.totalPlaytime == null) {Player.totalPlaytime = 0;}\r\n if (Player.playtimeSinceLastAug == null) {Player.playtimeSinceLastAug = 0;}\r\n Player.totalPlaytime += time;\r\n Player.playtimeSinceLastAug += time;\r\n\r\n //Start Manual hack\r\n if (Player.startAction == true) {\r\n Engine._totalActionTime = Player.actionTime;\r\n Engine._actionTimeLeft = Player.actionTime;\r\n Engine._actionInProgress = true;\r\n Engine._actionProgressBarCount = 1;\r\n Engine._actionProgressStr = \"[ ]\";\r\n Engine._actionTimeStr = \"Time left: \";\r\n Player.startAction = false;\r\n }\r\n\r\n //Working\r\n if (Player.isWorking) {\r\n if (Player.workType == CONSTANTS.WorkTypeFaction) {\r\n Player.workForFaction(numCycles);\r\n } else if (Player.workType == CONSTANTS.WorkTypeCreateProgram) {\r\n Player.createProgramWork(numCycles);\r\n } else if (Player.workType == CONSTANTS.WorkTypeStudyClass) {\r\n Player.takeClass(numCycles);\r\n } else if (Player.workType == CONSTANTS.WorkTypeCrime) {\r\n Player.commitCrime(numCycles);\r\n } else if (Player.workType == CONSTANTS.WorkTypeCompanyPartTime) {\r\n Player.workPartTime(numCycles);\r\n } else {\r\n Player.work(numCycles);\r\n }\r\n }\r\n\r\n //Gang, if applicable\r\n if (Player.bitNodeN == 2 && Player.inGang()) {\r\n Player.gang.process(numCycles);\r\n }\r\n\r\n //Mission\r\n if (inMission && currMission) {\r\n currMission.process(numCycles);\r\n }\r\n\r\n //Corporation\r\n if (Player.corporation instanceof Corporation) {\r\n //Stores cycles in a \"buffer\". Processed separately using Engine Counters\r\n //This is to avoid constant DOM redraws when Corporation is catching up\r\n Player.corporation.storeCycles(numCycles);\r\n }\r\n\r\n if (Player.bladeburner instanceof Bladeburner) {\r\n Player.bladeburner.storeCycles(numCycles);\r\n }\r\n\r\n //Counters\r\n Engine.decrementAllCounters(numCycles);\r\n Engine.checkCounters();\r\n\r\n //Manual hacks\r\n if (Engine._actionInProgress == true) {\r\n Engine.updateHackProgress(numCycles);\r\n }\r\n\r\n //Update the running time of all active scripts\r\n updateOnlineScriptTimes(numCycles);\r\n\r\n //Hacknet Nodes\r\n processAllHacknetNodeEarnings(numCycles);\r\n },\r\n\r\n //Counters for the main event loop. Represent the number of game cycles are required\r\n //for something to happen.\r\n Counters: {\r\n autoSaveCounter: 300, //Autosave every minute\r\n updateSkillLevelsCounter: 10, //Only update skill levels every 2 seconds. Might improve performance\r\n updateDisplays: 3,\r\n updateDisplaysMed: 9,\r\n updateDisplaysLong: 15,\r\n updateActiveScriptsDisplay: 5,\r\n createProgramNotifications: 10, //Checks whether any programs can be created and notifies\r\n checkFactionInvitations: 100, //Check whether you qualify for any faction invitations\r\n passiveFactionGrowth: 600,\r\n messages: 150,\r\n stockTick: 30, //Update stock prices\r\n sCr: 1500,\r\n mechanicProcess: 5, //Processes certain mechanics (Corporation, Bladeburner)\r\n },\r\n\r\n decrementAllCounters: function(numCycles = 1) {\r\n for (var counter in Engine.Counters) {\r\n if (Engine.Counters.hasOwnProperty(counter)) {\r\n Engine.Counters[counter] = Engine.Counters[counter] - numCycles;\r\n }\r\n }\r\n },\r\n\r\n //Checks if any counters are 0 and if they are, executes whatever\r\n //is necessary and then resets the counter\r\n checkCounters: function() {\r\n if (Engine.Counters.autoSaveCounter <= 0) {\r\n saveObject.saveGame(indexedDb);\r\n if (Settings.AutosaveInterval == null) {\r\n Settings.AutosaveInterval = 60;\r\n }\r\n if (Settings.AutosaveInterval === 0) {\r\n Engine.Counters.autoSaveCounter = Infinity;\r\n } else {\r\n Engine.Counters.autoSaveCounter = Settings.AutosaveInterval * 5;\r\n }\r\n }\r\n\r\n if (Engine.Counters.updateSkillLevelsCounter <= 0) {\r\n Player.updateSkillLevels();\r\n Engine.Counters.updateSkillLevelsCounter = 10;\r\n }\r\n\r\n if (Engine.Counters.updateActiveScriptsDisplay <= 0) {\r\n //Always update, but make the interval longer if the page isn't active\r\n updateActiveScriptsItems();\r\n if (Engine.currentPage === Engine.Page.ActiveScripts) {\r\n Engine.Counters.updateActiveScriptsDisplay = 5;\r\n } else {\r\n Engine.Counters.updateActiveScriptsDisplay = 15;\r\n }\r\n }\r\n\r\n if (Engine.Counters.updateDisplays <= 0) {\r\n Engine.displayCharacterOverviewInfo();\r\n if (Engine.currentPage == Engine.Page.CharacterInfo) {\r\n Engine.displayCharacterInfo();\r\n } else if (Engine.currentPage == Engine.Page.HacknetNodes) {\r\n updateHacknetNodesContent();\r\n } else if (Engine.currentPage == Engine.Page.CreateProgram) {\r\n displayCreateProgramContent();\r\n }\r\n\r\n if (logBoxOpened) {\r\n logBoxUpdateText();\r\n }\r\n\r\n Engine.Counters.updateDisplays = 3;\r\n }\r\n\r\n if (Engine.Counters.updateDisplaysMed <= 0) {\r\n if (Engine.currentPage === Engine.Page.Corporation) {\r\n Player.corporation.updateUIContent();\r\n }\r\n Engine.Counters.updateDisplaysMed = 9;\r\n }\r\n\r\n if (Engine.Counters.updateDisplaysLong <= 0) {\r\n if (Engine.currentPage === Engine.Page.Gang) {\r\n updateGangContent();\r\n } else if (Engine.currentPage === Engine.Page.ScriptEditor) {\r\n updateScriptEditorContent();\r\n }\r\n Engine.Counters.updateDisplaysLong = 15;\r\n }\r\n\r\n if (Engine.Counters.createProgramNotifications <= 0) {\r\n var num = getNumAvailableCreateProgram();\r\n var elem = document.getElementById(\"create-program-notification\");\r\n if (num > 0) {\r\n elem.innerHTML = num;\r\n elem.setAttribute(\"class\", \"notification-on\");\r\n } else {\r\n elem.innerHTML = \"\";\r\n elem.setAttribute(\"class\", \"notification-off\");\r\n }\r\n Engine.Counters.createProgramNotifications = 10;\r\n }\r\n\r\n if (Engine.Counters.checkFactionInvitations <= 0) {\r\n var invitedFactions = Player.checkForFactionInvitations();\r\n if (invitedFactions.length > 0) {\r\n if (Player.firstFacInvRecvd === false) {\r\n Player.firstFacInvRecvd = true;\r\n document.getElementById(\"factions-tab\").style.display = \"list-item\";\r\n document.getElementById(\"character-menu-header\").click();\r\n document.getElementById(\"character-menu-header\").click();\r\n }\r\n\r\n var randFaction = invitedFactions[Math.floor(Math.random() * invitedFactions.length)];\r\n inviteToFaction(randFaction);\r\n }\r\n Engine.Counters.checkFactionInvitations = 100;\r\n }\r\n\r\n if (Engine.Counters.passiveFactionGrowth <= 0) {\r\n var adjustedCycles = Math.floor((600 - Engine.Counters.passiveFactionGrowth));\r\n processPassiveFactionRepGain(adjustedCycles);\r\n Engine.Counters.passiveFactionGrowth = 600;\r\n }\r\n\r\n if (Engine.Counters.messages <= 0) {\r\n checkForMessagesToSend();\r\n if (Augmentations[AugmentationNames.TheRedPill].owned) {\r\n Engine.Counters.messages = 4500; //15 minutes for Red pill message\r\n } else {\r\n Engine.Counters.messages = 150;\r\n }\r\n }\r\n\r\n if (Engine.Counters.stockTick <= 0) {\r\n if (Player.hasWseAccount) {\r\n updateStockPrices();\r\n }\r\n Engine.Counters.stockTick = 30;\r\n }\r\n\r\n if (Engine.Counters.sCr <= 0) {\r\n if (Player.hasWseAccount) {\r\n stockMarketCycle();\r\n }\r\n Engine.Counters.sCr = 1500;\r\n }\r\n\r\n if (Engine.Counters.mechanicProcess <= 0) {\r\n if (Player.corporation instanceof Corporation) {\r\n Player.corporation.process();\r\n }\r\n if (Player.bladeburner instanceof Bladeburner) {\r\n try {\r\n Player.bladeburner.process();\r\n } catch(e) {\r\n exceptionAlert(\"Exception caught in Bladeburner.process(): \" + e);\r\n }\r\n\r\n }\r\n Engine.Counters.mechanicProcess = 5;\r\n }\r\n },\r\n\r\n /* Calculates the hack progress for a manual (non-scripted) hack and updates the progress bar/time accordingly */\r\n _totalActionTime: 0,\r\n _actionTimeLeft: 0,\r\n _actionTimeStr: \"Time left: \",\r\n _actionProgressStr: \"[ ]\",\r\n _actionProgressBarCount: 1,\r\n _actionInProgress: false,\r\n updateHackProgress: function(numCycles = 1) {\r\n var timeElapsedMilli = numCycles * Engine._idleSpeed;\r\n Engine._actionTimeLeft -= (timeElapsedMilli/ 1000); //Substract idle speed (ms)\r\n Engine._actionTimeLeft = Math.max(Engine._actionTimeLeft, 0);\r\n\r\n //Calculate percent filled\r\n var percent = Math.round((1 - Engine._actionTimeLeft / Engine._totalActionTime) * 100);\r\n\r\n //Update progress bar\r\n while (Engine._actionProgressBarCount * 2 <= percent) {\r\n Engine._actionProgressStr = Engine._actionProgressStr.replaceAt(Engine._actionProgressBarCount, \"|\");\r\n Engine._actionProgressBarCount += 1;\r\n }\r\n\r\n //Update hack time remaining\r\n Engine._actionTimeStr = \"Time left: \" + Math.max(0, Math.round(Engine._actionTimeLeft)).toString() + \"s\";\r\n document.getElementById(\"hack-progress\").innerHTML = Engine._actionTimeStr;\r\n\r\n //Dynamically update progress bar\r\n document.getElementById(\"hack-progress-bar\").innerHTML = Engine._actionProgressStr.replace( / /g, \"&nbsp;\" );\r\n\r\n //Once percent is 100, the hack is completed\r\n if (percent >= 100) {\r\n Engine._actionInProgress = false;\r\n Terminal.finishAction();\r\n }\r\n },\r\n\r\n _prevTimeout: null,\r\n createStatusText: function(txt) {\r\n if (Engine._prevTimeout != null) {\r\n clearTimeout(Engine._prevTimeout);\r\n Engine._prevTimeout = null;\r\n }\r\n var statusText = document.getElementById(\"status-text\")\r\n statusText.style.display = \"inline-block\";\r\n statusText.setAttribute(\"class\", \"status-text\");\r\n statusText.innerHTML = txt;\r\n Engine._prevTimeout = setTimeout(function() {\r\n statusText.style.display = \"none\";\r\n statusText.removeAttribute(\"class\");\r\n statusText.innerHTML = \"\";\r\n }, 3000);\r\n },\r\n\r\n removeLoadingScreen: function() {\r\n var loader = document.getElementById(\"loader\");\r\n if (!loader) {return;}\r\n while(loader.firstChild) {\r\n loader.removeChild(loader.firstChild);\r\n }\r\n loader.parentNode.removeChild(loader);\r\n document.getElementById(\"entire-game-container\").style.visibility = \"visible\";\r\n },\r\n\r\n //Used when initializing a game\r\n //elems should be an array of all DOM elements under the header\r\n closeMainMenuHeader: function(elems) {\r\n for (var i = 0; i < elems.length; ++i) {\r\n elems[i].style.maxHeight = null;\r\n elems[i].style.opacity = 0;\r\n elems[i].style.pointerEvents = \"none\";\r\n }\r\n },\r\n\r\n //Used when initializing the game\r\n //elems should be an array of all DOM elements under the header\r\n openMainMenuHeader: function(elems) {\r\n for (var i = 0; i < elems.length; ++i) {\r\n elems[i].style.maxHeight = elems[i].scrollHeight + \"px\";\r\n elems[i].style.display = \"block\";\r\n }\r\n },\r\n\r\n //Used in game when clicking on a main menu header (NOT FOR INITIALIZATION)\r\n //open is a boolean specifying whether its being opened or closed\r\n //elems is an array of DOM elements for main menu tabs (li)\r\n //links is an array of DOM elements for main menu links (a)\r\n toggleMainMenuHeader: function(open, elems, links) {\r\n for (var i = 0; i < elems.length; ++i) {\r\n if (open) {\r\n elems[i].style.opacity = 1;\r\n elems[i].style.maxHeight = elems[i].scrollHeight + \"px\";\r\n } else {\r\n elems[i].style.opacity = 0;\r\n elems[i].style.maxHeight = null;\r\n }\r\n }\r\n\r\n for (var i = 0; i < links.length; ++i) {\r\n if (open) {\r\n links[i].style.opacity = 1;\r\n links[i].style.maxHeight = links[i].scrollHeight + \"px\";\r\n links[i].style.pointerEvents = \"auto\";\r\n } else {\r\n links[i].style.opacity = 0;\r\n links[i].style.maxHeight = null;\r\n links[i].style.pointerEvents = \"none\";\r\n }\r\n }\r\n },\r\n\r\n load: function(saveString) {\r\n //Initialize main menu accordion panels to all start as \"open\"\r\n var terminal = document.getElementById(\"terminal-tab\");\r\n var createScript = document.getElementById(\"create-script-tab\");\r\n var activeScripts = document.getElementById(\"active-scripts-tab\");\r\n var createProgram = document.getElementById(\"create-program-tab\");\r\n var stats = document.getElementById(\"stats-tab\");\r\n var factions = document.getElementById(\"factions-tab\");\r\n var augmentations = document.getElementById(\"augmentations-tab\");\r\n var hacknetnodes = document.getElementById(\"hacknet-nodes-tab\");\r\n var city = document.getElementById(\"city-tab\");\r\n var travel = document.getElementById(\"travel-tab\");\r\n var job = document.getElementById(\"job-tab\");\r\n var tutorial = document.getElementById(\"tutorial-tab\");\r\n var options = document.getElementById(\"options-tab\");\r\n\r\n //Load game from save or create new game\r\n if (loadGame(saveString)) {\r\n console.log(\"Loaded game from save\");\r\n initBitNodes();\r\n initBitNodeMultipliers();\r\n initSourceFiles();\r\n Engine.setDisplayElements(); //Sets variables for important DOM elements\r\n Engine.init(); //Initialize buttons, work, etc.\r\n CompanyPositions.init();\r\n initAugmentations(); //Also calls Player.reapplyAllAugmentations()\r\n Player.reapplyAllSourceFiles();\r\n initStockSymbols();\r\n if (Player.hasWseAccount) {\r\n initSymbolToStockMap();\r\n }\r\n initLiterature();\r\n initSingularitySFFlags();\r\n\r\n console.log(Player.intelligence_exp);\r\n\r\n //Calculate the number of cycles have elapsed while offline\r\n Engine._lastUpdate = new Date().getTime();\r\n var lastUpdate = Player.lastUpdate;\r\n var numCyclesOffline = Math.floor((Engine._lastUpdate - lastUpdate) / Engine._idleSpeed);\r\n\r\n /* Process offline progress */\r\n var offlineProductionFromScripts = loadAllRunningScripts(); //This also takes care of offline production for those scripts\r\n if (Player.isWorking) {\r\n console.log(\"work() called in load() for \" + numCyclesOffline * Engine._idleSpeed + \" milliseconds\");\r\n if (Player.workType == CONSTANTS.WorkTypeFaction) {\r\n Player.workForFaction(numCyclesOffline);\r\n } else if (Player.workType == CONSTANTS.WorkTypeCreateProgram) {\r\n Player.createProgramWork(numCyclesOffline);\r\n } else if (Player.workType == CONSTANTS.WorkTypeStudyClass) {\r\n Player.takeClass(numCyclesOffline);\r\n } else if (Player.workType == CONSTANTS.WorkTypeCrime) {\r\n Player.commitCrime(numCyclesOffline);\r\n } else if (Player.workType == CONSTANTS.WorkTypeCompanyPartTime) {\r\n Player.workPartTime(numCyclesOffline);\r\n } else {\r\n Player.work(numCyclesOffline);\r\n }\r\n }\r\n\r\n //Hacknet Nodes offline progress\r\n var offlineProductionFromHacknetNodes = processAllHacknetNodeEarnings(numCyclesOffline);\r\n\r\n //Passive faction rep gain offline\r\n processPassiveFactionRepGain(numCyclesOffline);\r\n\r\n //Gang progress for BitNode 2\r\n if (Player.bitNodeN != null && Player.bitNodeN === 2 && Player.inGang()) {\r\n Player.gang.process(numCyclesOffline);\r\n }\r\n\r\n //Bladeburner offline progress\r\n if (Player.bladeburner instanceof Bladeburner) {\r\n Player.bladeburner.storeCycles(numCyclesOffline);\r\n }\r\n\r\n //Update total playtime\r\n var time = numCyclesOffline * Engine._idleSpeed;\r\n if (Player.totalPlaytime == null) {Player.totalPlaytime = 0;}\r\n if (Player.playtimeSinceLastAug == null) {Player.playtimeSinceLastAug = 0;}\r\n Player.totalPlaytime += time;\r\n Player.playtimeSinceLastAug += time;\r\n\r\n Player.lastUpdate = Engine._lastUpdate;\r\n Engine.start(); //Run main game loop and Scripts loop\r\n Engine.removeLoadingScreen();\r\n dialogBoxCreate(\"While you were offline, your scripts generated $\" +\r\n formatNumber(offlineProductionFromScripts, 2) + \" and your Hacknet Nodes generated $\" +\r\n formatNumber(offlineProductionFromHacknetNodes, 2));\r\n //Close main menu accordions for loaded game\r\n var visibleMenuTabs = [terminal, createScript, activeScripts, stats,\r\n hacknetnodes, city, tutorial, options];\r\n if (Player.firstFacInvRecvd) {visibleMenuTabs.push(factions);}\r\n else {factions.style.display = \"none\";}\r\n if (Player.firstAugPurchased) {visibleMenuTabs.push(augmentations);}\r\n else {augmentations.style.display = \"none\";}\r\n if (Player.firstJobRecvd) {visibleMenuTabs.push(job);}\r\n else {job.style.display = \"none\";}\r\n if (Player.firstTimeTraveled) {visibleMenuTabs.push(travel);}\r\n else {travel.style.display = \"none\";}\r\n if (Player.firstProgramAvailable) {visibleMenuTabs.push(createProgram);}\r\n else {createProgram.style.display = \"none\";}\r\n\r\n Engine.closeMainMenuHeader(visibleMenuTabs);\r\n } else {\r\n //No save found, start new game\r\n console.log(\"Initializing new game\");\r\n initBitNodes();\r\n initBitNodeMultipliers();\r\n initSourceFiles();\r\n initSpecialServerIps();\r\n Engine.setDisplayElements(); //Sets variables for important DOM elements\r\n Engine.start(); //Run main game loop and Scripts loop\r\n Player.init();\r\n initForeignServers();\r\n initCompanies();\r\n initFactions();\r\n CompanyPositions.init();\r\n initAugmentations();\r\n initMessages();\r\n initStockSymbols();\r\n initLiterature();\r\n initSingularitySFFlags();\r\n\r\n //Open main menu accordions for new game\r\n //Main menu accordions\r\n var hackingHdr = document.getElementById(\"hacking-menu-header\");\r\n hackingHdr.classList.toggle(\"opened\");\r\n var characterHdr = document.getElementById(\"character-menu-header\");\r\n characterHdr.classList.toggle(\"opened\");\r\n var worldHdr = document.getElementById(\"world-menu-header\");\r\n worldHdr.classList.toggle(\"opened\");\r\n var helpHdr = document.getElementById(\"help-menu-header\");\r\n helpHdr.classList.toggle(\"opened\");\r\n\r\n //Hide tabs that wont be revealed until later\r\n factions.style.display = \"none\";\r\n augmentations.style.display = \"none\";\r\n job.style.display = \"none\";\r\n travel.style.display = \"none\";\r\n createProgram.style.display = \"none\";\r\n\r\n Engine.openMainMenuHeader(\r\n [terminal, createScript, activeScripts, stats,\r\n hacknetnodes, city,\r\n tutorial, options]\r\n );\r\n\r\n //Start interactive tutorial\r\n iTutorialStart();\r\n Engine.removeLoadingScreen();\r\n }\r\n //Initialize labels on game settings\r\n setSettingsLabels();\r\n scriptEditorInit();\r\n Terminal.resetTerminalInput();\r\n },\r\n\r\n setDisplayElements: function() {\r\n //Content elements\r\n Engine.Display.terminalContent = document.getElementById(\"terminal-container\");\r\n Engine.currentPage = Engine.Page.Terminal;\r\n\r\n Engine.Display.characterContent = document.getElementById(\"character-container\");\r\n Engine.Display.characterContent.style.display = \"none\";\r\n\r\n Engine.Display.scriptEditorContent = document.getElementById(\"script-editor-container\");\r\n Engine.Display.scriptEditorContent.style.display = \"none\";\r\n\r\n Engine.Display.activeScriptsContent = document.getElementById(\"active-scripts-container\");\r\n Engine.Display.activeScriptsContent.style.display = \"none\";\r\n\r\n Engine.Display.hacknetNodesContent = document.getElementById(\"hacknet-nodes-container\");\r\n Engine.Display.hacknetNodesContent.style.display = \"none\";\r\n\r\n Engine.Display.worldContent = document.getElementById(\"world-container\");\r\n Engine.Display.worldContent.style.display = \"none\";\r\n\r\n Engine.Display.createProgramContent = document.getElementById(\"create-program-container\");\r\n Engine.Display.createProgramContent.style.display = \"none\";\r\n\r\n Engine.Display.factionsContent = document.getElementById(\"factions-container\");\r\n Engine.Display.factionsContent.style.display = \"none\";\r\n\r\n\r\n Engine.Display.factionContent = document.getElementById(\"faction-container\");\r\n Engine.Display.factionContent.style.display = \"none\";\r\n\r\n Engine.Display.factionAugmentationsContent = document.getElementById(\"faction-augmentations-container\");\r\n Engine.Display.factionAugmentationsContent.style.display = \"none\";\r\n\r\n Engine.Display.augmentationsContent = document.getElementById(\"augmentations-container\");\r\n Engine.Display.augmentationsContent.style.display = \"none\";\r\n\r\n\r\n Engine.Display.tutorialContent = document.getElementById(\"tutorial-container\");\r\n Engine.Display.tutorialContent.style.display = \"none\";\r\n\r\n Engine.Display.infiltrationContent = document.getElementById(\"infiltration-container\");\r\n Engine.Display.infiltrationContent.style.display = \"none\";\r\n\r\n Engine.Display.stockMarketContent = document.getElementById(\"stock-market-container\");\r\n Engine.Display.stockMarketContent.style.display = \"none\";\r\n\r\n Engine.Display.missionContent = document.getElementById(\"mission-container\");\r\n Engine.Display.missionContent.style.display = \"none\";\r\n\r\n //Character info\r\n Engine.Display.characterInfo = document.getElementById(\"character-content\");\r\n\r\n //Location lists\r\n Engine.aevumLocationsList = document.getElementById(\"aevum-locations-list\");\r\n Engine.chongqingLocationsList = document.getElementById(\"chongqing-locations-list\");\r\n Engine.sector12LocationsList = document.getElementById(\"sector12-locations-list\");\r\n Engine.newTokyoLocationsList = document.getElementById(\"newtokyo-locations-list\");\r\n Engine.ishimaLocationsList = document.getElementById(\"ishima-locations-list\");\r\n Engine.volhavenLocationsList = document.getElementById(\"volhaven-locations-list\");\r\n\r\n //Location page (page that shows up when you visit a specific location in World)\r\n Engine.Display.locationContent = document.getElementById(\"location-container\");\r\n //Engine.Display.locationContent.style.visibility = \"hidden\";\r\n Engine.Display.locationContent.style.display = \"none\";\r\n\r\n //Work In Progress\r\n Engine.Display.workInProgressContent = document.getElementById(\"work-in-progress-container\");\r\n //Engine.Display.workInProgressContent.style.visibility = \"hidden\";\r\n Engine.Display.workInProgressContent.style.display = \"none\";\r\n\r\n //Red Pill / Hack World Daemon\r\n Engine.Display.redPillContent = document.getElementById(\"red-pill-container\");\r\n Engine.Display.redPillContent.style.display = \"none\";\r\n\r\n //Cinematic Text\r\n Engine.Display.cinematicTextContent = document.getElementById(\"cinematic-text-container\");\r\n Engine.Display.cinematicTextContent.style.display = \"none\";\r\n\r\n\t\t//Init Location buttons\r\n\t\tinitLocationButtons();\r\n\r\n //Tutorial buttons\r\n Engine.Clickables.tutorialNetworkingButton = document.getElementById(\"tutorial-networking-link\");\r\n Engine.Clickables.tutorialNetworkingButton.addEventListener(\"click\", function() {\r\n Engine.displayTutorialPage(CONSTANTS.TutorialNetworkingText);\r\n });\r\n\r\n Engine.Clickables.tutorialHackingButton = document.getElementById(\"tutorial-hacking-link\");\r\n Engine.Clickables.tutorialHackingButton.addEventListener(\"click\", function() {\r\n Engine.displayTutorialPage(CONSTANTS.TutorialHackingText);\r\n });\r\n\r\n Engine.Clickables.tutorialScriptsButton = document.getElementById(\"tutorial-scripts-link\");\r\n Engine.Clickables.tutorialScriptsButton.addEventListener(\"click\", function() {\r\n Engine.displayTutorialPage(CONSTANTS.TutorialScriptsText);\r\n });\r\n\r\n Engine.Clickables.tutorialNetscriptButton = document.getElementById(\"tutorial-netscript-link\");\r\n Engine.Clickables.tutorialNetscriptButton.addEventListener(\"click\", function() {\r\n Engine.displayTutorialPage(CONSTANTS.TutorialNetscriptText);\r\n });\r\n\r\n Engine.Clickables.tutorialTravelingButton = document.getElementById(\"tutorial-traveling-link\");\r\n Engine.Clickables.tutorialTravelingButton.addEventListener(\"click\", function() {\r\n Engine.displayTutorialPage(CONSTANTS.TutorialTravelingText);\r\n });\r\n\r\n Engine.Clickables.tutorialCompaniesButton = document.getElementById(\"tutorial-jobs-link\");\r\n Engine.Clickables.tutorialCompaniesButton.addEventListener(\"click\", function() {\r\n Engine.displayTutorialPage(CONSTANTS.TutorialCompaniesText);\r\n });\r\n\r\n Engine.Clickables.tutorialFactionsButton = document.getElementById(\"tutorial-factions-link\");\r\n Engine.Clickables.tutorialFactionsButton.addEventListener(\"click\", function() {\r\n Engine.displayTutorialPage(CONSTANTS.TutorialFactionsText);\r\n });\r\n\r\n Engine.Clickables.tutorialAugmentationsButton = document.getElementById(\"tutorial-augmentations-link\");\r\n Engine.Clickables.tutorialAugmentationsButton.addEventListener(\"click\", function() {\r\n Engine.displayTutorialPage(CONSTANTS.TutorialAugmentationsText);\r\n });\r\n\r\n Engine.Clickables.tutorialBackButton = document.getElementById(\"tutorial-back-button\");\r\n Engine.Clickables.tutorialBackButton.addEventListener(\"click\", function() {\r\n Engine.displayTutorialContent();\r\n });\r\n\r\n //If DarkWeb already purchased, disable the button\r\n if (SpecialServerIps.hasOwnProperty(\"Darkweb Server\")) {\r\n document.getElementById(\"location-purchase-tor\").setAttribute(\"class\", \"a-link-button-inactive\");\r\n }\r\n },\r\n\r\n /* Initialization */\r\n init: function() {\r\n //Import game link\r\n document.getElementById(\"import-game-link\").onclick = function() {\r\n saveObject.importGame();\r\n };\r\n\r\n //Main menu accordions\r\n var hackingHdr = document.getElementById(\"hacking-menu-header\");\r\n var characterHdr = document.getElementById(\"character-menu-header\");\r\n var worldHdr = document.getElementById(\"world-menu-header\");\r\n var helpHdr = document.getElementById(\"help-menu-header\");\r\n\r\n hackingHdr.onclick = function() {\r\n var terminal = document.getElementById(\"terminal-tab\");\r\n var terminalLink = document.getElementById(\"terminal-menu-link\");\r\n var createScript = document.getElementById(\"create-script-tab\");\r\n var createScriptLink = document.getElementById(\"create-script-menu-link\");\r\n var activeScripts = document.getElementById(\"active-scripts-tab\");\r\n var activeScriptsLink = document.getElementById(\"active-scripts-menu-link\");\r\n var createProgram = document.getElementById(\"create-program-tab\");\r\n var createProgramLink = document.getElementById(\"create-program-menu-link\");\r\n var createProgramNot = document.getElementById(\"create-program-notification\");\r\n this.classList.toggle(\"opened\");\r\n if (terminal.style.maxHeight) {\r\n Engine.toggleMainMenuHeader(false,\r\n [terminal, createScript, activeScripts, createProgram],\r\n [terminalLink, createScriptLink, activeScriptsLink, createProgramLink]\r\n );\r\n\r\n createProgramNot.style.display = \"none\";\r\n } else {\r\n Engine.toggleMainMenuHeader(true,\r\n [terminal, createScript, activeScripts, createProgram],\r\n [terminalLink, createScriptLink, activeScriptsLink, createProgramLink]\r\n );\r\n\r\n createProgramNot.style.display = \"block\"\r\n }\r\n }\r\n\r\n characterHdr.onclick = function() {\r\n var stats = document.getElementById(\"stats-tab\");\r\n var statsLink = document.getElementById(\"stats-menu-link\");\r\n var factions = document.getElementById(\"factions-tab\");\r\n var factionsLink = document.getElementById(\"factions-menu-link\");\r\n var augmentations = document.getElementById(\"augmentations-tab\");\r\n var augmentationsLink = document.getElementById(\"augmentations-menu-link\");\r\n var hacknetnodes = document.getElementById(\"hacknet-nodes-tab\");\r\n var hacknetnodesLink = document.getElementById(\"hacknet-nodes-menu-link\");\r\n this.classList.toggle(\"opened\");\r\n if (stats.style.maxHeight) {\r\n Engine.toggleMainMenuHeader(false,\r\n [stats, factions, augmentations, hacknetnodes],\r\n [statsLink, factionsLink, augmentationsLink, hacknetnodesLink]\r\n );\r\n } else {\r\n Engine.toggleMainMenuHeader(true,\r\n [stats, factions, augmentations, hacknetnodes],\r\n [statsLink, factionsLink, augmentationsLink, hacknetnodesLink]\r\n );\r\n }\r\n }\r\n\r\n worldHdr.onclick = function() {\r\n var city = document.getElementById(\"city-tab\");\r\n var cityLink = document.getElementById(\"city-menu-link\");\r\n var travel = document.getElementById(\"travel-tab\");\r\n var travelLink = document.getElementById(\"travel-menu-link\");\r\n var job = document.getElementById(\"job-tab\");\r\n var jobLink = document.getElementById(\"job-menu-link\");\r\n this.classList.toggle(\"opened\");\r\n if (city.style.maxHeight) {\r\n Engine.toggleMainMenuHeader(false,\r\n [city, travel, job],\r\n [cityLink, travelLink, jobLink]\r\n );\r\n } else {\r\n Engine.toggleMainMenuHeader(true,\r\n [city, travel, job],\r\n [cityLink, travelLink, jobLink]\r\n );\r\n }\r\n }\r\n\r\n helpHdr.onclick = function() {\r\n var tutorial = document.getElementById(\"tutorial-tab\");\r\n var tutorialLink = document.getElementById(\"tutorial-menu-link\");\r\n var options = document.getElementById(\"options-tab\");\r\n var optionsLink = document.getElementById(\"options-menu-link\");\r\n this.classList.toggle(\"opened\");\r\n if (tutorial.style.maxHeight) {\r\n Engine.toggleMainMenuHeader(false,\r\n [tutorial, options],\r\n [tutorialLink, optionsLink]\r\n );\r\n } else {\r\n Engine.toggleMainMenuHeader(true,\r\n [tutorial, options],\r\n [tutorialLink, optionsLink]\r\n );\r\n }\r\n }\r\n\r\n //Main menu buttons and content\r\n Engine.Clickables.terminalMainMenuButton = clearEventListeners(\"terminal-menu-link\");\r\n Engine.Clickables.terminalMainMenuButton.addEventListener(\"click\", function() {\r\n Engine.loadTerminalContent();\r\n return false;\r\n });\r\n\r\n Engine.Clickables.characterMainMenuButton = clearEventListeners(\"stats-menu-link\");\r\n Engine.Clickables.characterMainMenuButton.addEventListener(\"click\", function() {\r\n Engine.loadCharacterContent();\r\n return false;\r\n });\r\n\r\n Engine.Clickables.scriptEditorMainMenuButton = clearEventListeners(\"create-script-menu-link\");\r\n Engine.Clickables.scriptEditorMainMenuButton.addEventListener(\"click\", function() {\r\n Engine.loadScriptEditorContent();\r\n return false;\r\n });\r\n\r\n Engine.Clickables.activeScriptsMainMenuButton = clearEventListeners(\"active-scripts-menu-link\");\r\n Engine.Clickables.activeScriptsMainMenuButton.addEventListener(\"click\", function() {\r\n Engine.loadActiveScriptsContent();\r\n return false;\r\n });\r\n\r\n Engine.Clickables.hacknetNodesMainMenuButton = clearEventListeners(\"hacknet-nodes-menu-link\");\r\n Engine.Clickables.hacknetNodesMainMenuButton.addEventListener(\"click\", function() {\r\n Engine.loadHacknetNodesContent();\r\n return false;\r\n });\r\n\r\n Engine.Clickables.worldMainMenuButton = clearEventListeners(\"city-menu-link\");\r\n Engine.Clickables.worldMainMenuButton.addEventListener(\"click\", function() {\r\n Engine.loadWorldContent();\r\n return false;\r\n });\r\n\r\n Engine.Clickables.travelMainMenuButton = clearEventListeners(\"travel-menu-link\");\r\n Engine.Clickables.travelMainMenuButton.addEventListener(\"click\", function() {\r\n Engine.loadTravelContent();\r\n return false;\r\n });\r\n\r\n Engine.Clickables.jobMainMenuButton = clearEventListeners(\"job-menu-link\");\r\n Engine.Clickables.jobMainMenuButton.addEventListener(\"click\", function() {\r\n Engine.loadJobContent();\r\n return false;\r\n });\r\n\r\n\r\n Engine.Clickables.createProgramMainMenuButton = clearEventListeners(\"create-program-menu-link\");\r\n Engine.Clickables.createProgramMainMenuButton.addEventListener(\"click\", function() {\r\n Engine.loadCreateProgramContent();\r\n return false;\r\n });\r\n\r\n Engine.Clickables.factionsMainMenuButton = clearEventListeners(\"factions-menu-link\");\r\n Engine.Clickables.factionsMainMenuButton.addEventListener(\"click\", function() {\r\n Engine.loadFactionsContent();\r\n return false;\r\n });\r\n\r\n Engine.Clickables.augmentationsMainMenuButton = clearEventListeners(\"augmentations-menu-link\");\r\n Engine.Clickables.augmentationsMainMenuButton.addEventListener(\"click\", function() {\r\n Engine.loadAugmentationsContent();\r\n return false;\r\n });\r\n\r\n Engine.Clickables.tutorialMainMenuButton = clearEventListeners(\"tutorial-menu-link\");\r\n Engine.Clickables.tutorialMainMenuButton.addEventListener(\"click\", function() {\r\n Engine.loadTutorialContent();\r\n return false;\r\n });\r\n\r\n //Active scripts list\r\n Engine.ActiveScriptsList = document.getElementById(\"active-scripts-list\");\r\n\r\n //Save, Delete, Import/Export buttons\r\n Engine.Clickables.saveMainMenuButton = document.getElementById(\"save-game-link\");\r\n Engine.Clickables.saveMainMenuButton.addEventListener(\"click\", function() {\r\n saveObject.saveGame(indexedDb);\r\n return false;\r\n });\r\n\r\n Engine.Clickables.deleteMainMenuButton = document.getElementById(\"delete-game-link\");\r\n Engine.Clickables.deleteMainMenuButton.addEventListener(\"click\", function() {\r\n saveObject.deleteGame(indexedDb);\r\n return false;\r\n });\r\n\r\n document.getElementById(\"export-game-link\").addEventListener(\"click\", function() {\r\n saveObject.exportGame();\r\n return false;\r\n });\r\n\r\n //Character Overview buttons\r\n document.getElementById(\"character-overview-save-button\").addEventListener(\"click\", function() {\r\n saveObject.saveGame(indexedDb);\r\n return false;\r\n });\r\n\r\n document.getElementById(\"character-overview-options-button\").addEventListener(\"click\", function() {\r\n gameOptionsBoxOpen();\r\n return false;\r\n });\r\n\r\n //Create Program buttons\r\n initCreateProgramButtons();\r\n\r\n //Message at the top of terminal\r\n postNetburnerText();\r\n\r\n //Player was working cancel button\r\n if (Player.isWorking) {\r\n var cancelButton = document.getElementById(\"work-in-progress-cancel-button\");\r\n cancelButton.addEventListener(\"click\", function() {\r\n if (Player.workType == CONSTANTS.WorkTypeFaction) {\r\n var fac = Factions[Player.currentWorkFactionName];\r\n Player.finishFactionWork(true);\r\n } else if (Player.workType == CONSTANTS.WorkTypeCreateProgram) {\r\n Player.finishCreateProgramWork(true);\r\n } else if (Player.workType == CONSTANTS.WorkTypeStudyClass) {\r\n Player.finishClass();\r\n } else if (Player.workType == CONSTANTS.WorkTypeCrime) {\r\n Player.finishCrime(true);\r\n } else if (Player.workType == CONSTANTS.WorkTypeCompanyPartTime) {\r\n Player.finishWorkPartTime();\r\n } else {\r\n Player.finishWork(true);\r\n }\r\n });\r\n Engine.loadWorkInProgressContent();\r\n }\r\n\r\n //character overview screen\r\n document.getElementById(\"character-overview-container\").style.display = \"block\";\r\n\r\n //Remove classes from links (they might be set from tutorial)\r\n document.getElementById(\"terminal-menu-link\").removeAttribute(\"class\");\r\n document.getElementById(\"stats-menu-link\").removeAttribute(\"class\");\r\n document.getElementById(\"create-script-menu-link\").removeAttribute(\"class\");\r\n document.getElementById(\"active-scripts-menu-link\").removeAttribute(\"class\");\r\n document.getElementById(\"hacknet-nodes-menu-link\").removeAttribute(\"class\");\r\n document.getElementById(\"city-menu-link\").removeAttribute(\"class\");\r\n document.getElementById(\"tutorial-menu-link\").removeAttribute(\"class\");\r\n\r\n //DEBUG Delete active Scripts on home\r\n document.getElementById(\"debug-delete-scripts-link\").addEventListener(\"click\", function() {\r\n console.log(\"Deleting running scripts on home computer\");\r\n Player.getHomeComputer().runningScripts = [];\r\n dialogBoxCreate(\"Forcefully deleted all running scripts on home computer. Please save and refresh page\");\r\n gameOptionsBoxClose();\r\n return false;\r\n });\r\n\r\n //DEBUG Soft Reset\r\n document.getElementById(\"debug-soft-reset\").addEventListener(\"click\", function() {\r\n dialogBoxCreate(\"Soft Reset!\");\r\n prestigeAugmentation();\r\n gameOptionsBoxClose();\r\n return false;\r\n });\r\n },\r\n\r\n start: function() {\r\n //Run main loop\r\n Engine.idleTimer();\r\n\r\n //Scripts\r\n runScriptsLoop();\r\n }\r\n};\r\n\r\nvar indexedDb, indexedDbRequest;\r\nwindow.onload = function() {\r\n if (!window.indexedDB) {\r\n return Engine.load(null); //Will try to load from localstorage\r\n }\r\n\r\n //DB is called bitburnerSave\r\n //Object store is called savestring\r\n //key for the Object store is called save\r\n indexedDbRequest = window.indexedDB.open(\"bitburnerSave\", 1);\r\n\r\n indexedDbRequest.onerror = function(e) {\r\n console.log(\"Error opening indexedDB: \");\r\n console.log(e);\r\n return Engine.load(null); //Try to load from localstorage\r\n };\r\n\r\n indexedDbRequest.onsuccess = function(e) {\r\n console.log(\"Opening bitburnerSave database successful!\");\r\n indexedDb = e.target.result;\r\n var transaction = indexedDb.transaction([\"savestring\"]);\r\n var objectStore = transaction.objectStore(\"savestring\");\r\n var request = objectStore.get(\"save\");\r\n request.onerror = function(e) {\r\n console.log(\"Error in Database request to get savestring: \" + e);\r\n return Engine.load(null); //Try to load from localstorage\r\n }\r\n\r\n request.onsuccess = function(e) {\r\n Engine.load(request.result); //Is this right?\r\n }\r\n };\r\n\r\n indexedDbRequest.onupgradeneeded = function(e) {\r\n var db = e.target.result;\r\n var objectStore = db.createObjectStore(\"savestring\");\r\n }\r\n};\r\n\r\nexport {Engine};\r\n","import {BitNodeMultipliers} from \"./BitNode.js\";\r\nimport {CONSTANTS} from \"./Constants.js\";\r\nimport {Player} from \"./Player.js\";\r\nimport {Environment} from \"./NetscriptEnvironment.js\";\r\nimport {WorkerScript, addWorkerScript} from \"./NetscriptWorker.js\";\r\nimport {Server, getServer} from \"./Server.js\";\r\nimport {Settings} from \"./Settings.js\";\r\nimport {Script, findRunningScript,\r\n RunningScript} from \"./Script.js\";\r\n\r\nimport {parse, Node} from \"../utils/acorn.js\";\r\nimport {printArray} from \"../utils/HelperFunctions.js\";\r\nimport {isValidIPAddress} from \"../utils/IPAddress.js\";\r\nimport {isString} from \"../utils/StringHelperFunctions.js\";\r\n\r\nvar Promise = require(\"bluebird\");\r\n\r\nPromise.config({\r\n warnings: false,\r\n longStackTraces: false,\r\n cancellation: true,\r\n monitoring: false\r\n});\r\n/* Evaluator\r\n * Evaluates/Interprets the Abstract Syntax Tree generated by Acorns parser\r\n *\r\n * Returns a promise\r\n */\r\nfunction evaluate(exp, workerScript) {\r\n return Promise.delay(Settings.CodeInstructionRunTime).then(function() {\r\n var env = workerScript.env;\r\n if (env.stopFlag) {return Promise.reject(workerScript);}\r\n if (exp == null) {\r\n return Promise.reject(makeRuntimeRejectMsg(workerScript, \"Error: NULL expression\", exp));\r\n }\r\n if (env.stopFlag) {return Promise.reject(workerScript);}\r\n switch (exp.type) {\r\n case \"BlockStatement\":\r\n case \"Program\":\r\n var evaluateProgPromise = evaluateProg(exp, workerScript, 0); //TODO: make every block/program use individual enviroment\r\n return evaluateProgPromise.then(function(w) {\r\n return Promise.resolve(workerScript);\r\n }).catch(function(e) {\r\n if (e.constructor === Array && e.length === 2 && e[0] === \"RETURNSTATEMENT\") {\r\n return Promise.reject(e);\r\n } else if (isString(e)) {\r\n workerScript.errorMessage = e;\r\n return Promise.reject(workerScript);\r\n } else if (e instanceof WorkerScript) {\r\n return Promise.reject(e);\r\n } else {\r\n return Promise.reject(workerScript);\r\n }\r\n });\r\n break;\r\n case \"Literal\":\r\n return Promise.resolve(exp.value);\r\n break;\r\n case \"Identifier\":\r\n //Javascript constructor() method can be used as an exploit to run arbitrary code\r\n if (exp.name == \"constructor\") {\r\n return Promise.reject(makeRuntimeRejectMsg(workerScript, \"Illegal usage of constructor() method. If you have your own function named 'constructor', you must re-name it.\", exp));\r\n }\r\n\r\n if (!(exp.name in env.vars)){\r\n return Promise.reject(makeRuntimeRejectMsg(workerScript, \"variable \" + exp.name + \" not defined\", exp));\r\n }\r\n return Promise.resolve(env.get(exp.name))\r\n break;\r\n case \"ExpressionStatement\":\r\n return evaluate(exp.expression, workerScript);\r\n break;\r\n case \"ArrayExpression\":\r\n var argPromises = exp.elements.map(function(arg) {\r\n return evaluate(arg, workerScript);\r\n });\r\n return Promise.all(argPromises).then(function(array) {\r\n return Promise.resolve(array)\r\n });\r\n break;\r\n case \"CallExpression\":\r\n return evaluate(exp.callee, workerScript).then(function(func) {\r\n return Promise.map(exp.arguments, function(arg) {\r\n return evaluate(arg, workerScript);\r\n }).then(function(args) {\r\n if (func instanceof Node) { //Player-defined function\r\n //Create new Environment for the function\r\n //Should be automatically garbage collected...\r\n var funcEnv = env.extend();\r\n\r\n //Define function arguments in this new environment\r\n for (var i = 0; i < func.params.length; ++i) {\r\n var arg;\r\n if (i >= args.length) {\r\n arg = null;\r\n } else {\r\n arg = args[i];\r\n }\r\n funcEnv.def(func.params[i].name, arg);\r\n }\r\n\r\n //Create a new WorkerScript for this function evaluation\r\n var funcWorkerScript = new WorkerScript(workerScript.scriptRef);\r\n funcWorkerScript.serverIp = workerScript.serverIp;\r\n funcWorkerScript.env = funcEnv;\r\n workerScript.fnWorker = funcWorkerScript;\r\n\r\n return evaluate(func.body, funcWorkerScript).then(function(res) {\r\n //If the function finished successfuly, that means there\r\n //was no return statement since a return statement rejects. So resolve to null\r\n workerScript.fnWorker = null;\r\n return Promise.resolve(null);\r\n }).catch(function(e) {\r\n if (e.constructor === Array && e.length === 2 && e[0] === \"RETURNSTATEMENT\") {\r\n //Return statement from function\r\n return Promise.resolve(e[1]);\r\n workerScript.fnWorker = null;\r\n } else if (isString(e)) {\r\n return Promise.reject(makeRuntimeRejectMsg(workerScript, e));\r\n } else if (e instanceof WorkerScript) {\r\n //Parse out the err message from the WorkerScript and re-reject\r\n var errorMsg = e.errorMessage;\r\n var errorTextArray = errorMsg.split(\"|\");\r\n if (errorTextArray.length === 4) {\r\n errorMsg = errorTextArray[3];\r\n return Promise.reject(makeRuntimeRejectMsg(workerScript, errorMsg));\r\n } else {\r\n if (env.stopFlag) {\r\n return Promise.reject(workerScript);\r\n } else {\r\n return Promise.reject(makeRuntimeRejectMsg(workerScript, \"Error in one of your functions. Could not identify which function\"));\r\n }\r\n }\r\n } else if (e instanceof Error) {\r\n return Promise.reject(makeRuntimeRejectMsg(workerScript, e.toString()));\r\n }\r\n });\r\n } else if (exp.callee.type === \"MemberExpression\"){\r\n return evaluate(exp.callee.object, workerScript).then(function(object) {\r\n try {\r\n if (func === \"NETSCRIPTFOREACH\") {\r\n return evaluateForeach(object, args, workerScript).then(function(res) {\r\n return Promise.resolve(res);\r\n }).catch(function(e) {\r\n return Promise.reject(e);\r\n });\r\n }\r\n var res = func.apply(object,args);\r\n return Promise.resolve(res);\r\n } catch (e) {\r\n return Promise.reject(makeRuntimeRejectMsg(workerScript, e, exp));\r\n }\r\n });\r\n } else {\r\n try {\r\n var out = func.apply(null,args);\r\n if (out instanceof Promise){\r\n return out.then(function(res) {\r\n return Promise.resolve(res)\r\n }).catch(function(e) {\r\n if (isScriptErrorMessage(e)) {\r\n //Functions don't have line number appended in error message, so add it\r\n var num = getErrorLineNumber(exp, workerScript);\r\n e += \" (Line \" + num + \")\";\r\n }\r\n return Promise.reject(e);\r\n });\r\n } else {\r\n return Promise.resolve(out);\r\n }\r\n } catch (e) {\r\n if (isScriptErrorMessage(e)) {\r\n if (isScriptErrorMessage(e)) {\r\n //Functions don't have line number appended in error message, so add it\r\n var num = getErrorLineNumber(exp, workerScript);\r\n e += \" (Line \" + num + \")\";\r\n }\r\n return Promise.reject(e);\r\n } else {\r\n return Promise.reject(makeRuntimeRejectMsg(workerScript, e, exp));\r\n }\r\n }\r\n }\r\n });\r\n });\r\n break;\r\n case \"MemberExpression\":\r\n return evaluate(exp.object, workerScript).then(function(object) {\r\n if (exp.computed){\r\n return evaluate(exp.property, workerScript).then(function(index) {\r\n if (index >= object.length) {\r\n return Promise.reject(makeRuntimeRejectMsg(workerScript, \"Invalid index for arrays\", exp));\r\n }\r\n return Promise.resolve(object[index]);\r\n }).catch(function(e) {\r\n if (e instanceof WorkerScript || isScriptErrorMessage(e)) {\r\n return Promise.reject(e);\r\n } else {\r\n return Promise.reject(makeRuntimeRejectMsg(workerScript, \"Invalid MemberExpression\", exp));\r\n }\r\n });\r\n } else {\r\n if (exp.property.name === \"constructor\") {\r\n return Promise.reject(makeRuntimeRejectMsg(workerScript, \"Illegal usage of constructor() method. If you have your own function named 'constructor', you must re-name it.\", exp));\r\n }\r\n if (object != null && object instanceof Array && exp.property.name === \"forEach\") {\r\n return \"NETSCRIPTFOREACH\";\r\n }\r\n try {\r\n return Promise.resolve(object[exp.property.name])\r\n } catch (e) {\r\n return Promise.reject(makeRuntimeRejectMsg(workerScript, \"Failed to get property: \" + e.toString(), exp));\r\n }\r\n }\r\n });\r\n break;\r\n case \"LogicalExpression\":\r\n case \"BinaryExpression\":\r\n return evalBinary(exp, workerScript);\r\n break;\r\n case \"UnaryExpression\":\r\n return evalUnary(exp, workerScript);\r\n break;\r\n case \"AssignmentExpression\":\r\n return evalAssignment(exp, workerScript);\r\n break;\r\n case \"UpdateExpression\":\r\n if (exp.argument.type===\"Identifier\"){\r\n if (exp.argument.name in env.vars){\r\n if (exp.operator === \"++\" || exp.operator === \"--\") {\r\n switch (exp.operator) {\r\n case \"++\":\r\n env.set(exp.argument.name,env.get(exp.argument.name)+1);\r\n break;\r\n case \"--\":\r\n env.set(exp.argument.name,env.get(exp.argument.name)-1);\r\n break;\r\n default: break;\r\n }\r\n return Promise.resolve(env.get(exp.argument.name));\r\n }\r\n //Not sure what prefix UpdateExpressions there would be besides ++/--\r\n if (exp.prefix){\r\n return Promise.resolve(env.get(exp.argument.name))\r\n }\r\n switch (exp.operator){\r\n default:\r\n return Promise.reject(makeRuntimeRejectMsg(workerScript, \"Unrecognized token: \" + exp.type + \". You are trying to use code that is currently unsupported\", exp));\r\n }\r\n return Promise.resolve(env.get(exp.argument.name))\r\n } else {\r\n return Promise.reject(makeRuntimeRejectMsg(workerScript, \"variable \" + exp.argument.name + \" not defined\", exp));\r\n }\r\n } else {\r\n return Promise.reject(makeRuntimeRejectMsg(workerScript, \"argument must be an identifier\", exp));\r\n }\r\n break;\r\n case \"EmptyStatement\":\r\n return Promise.resolve(false);\r\n break;\r\n case \"ReturnStatement\":\r\n return evaluate(exp.argument, workerScript).then(function(res) {\r\n return Promise.reject([\"RETURNSTATEMENT\", res]);\r\n });\r\n break;\r\n case \"BreakStatement\":\r\n return Promise.reject(\"BREAKSTATEMENT\");\r\n break;\r\n case \"ContinueStatement\":\r\n return Promise.reject(\"CONTINUESTATEMENT\");\r\n break;\r\n case \"IfStatement\":\r\n return evaluateIf(exp, workerScript);\r\n break;\r\n case \"SwitchStatement\":\r\n return Promise.reject(makeRuntimeRejectMsg(workerScript, \"Switch statements are not yet implemented in Netscript\", exp));\r\n break;\r\n case \"WhileStatement\":\r\n return evaluateWhile(exp, workerScript).then(function(res) {\r\n return Promise.resolve(res);\r\n }).catch(function(e) {\r\n if (e == \"BREAKSTATEMENT\" ||\r\n (e instanceof WorkerScript && e.errorMessage == \"BREAKSTATEMENT\")) {\r\n return Promise.resolve(\"whileLoopBroken\");\r\n } else {\r\n return Promise.reject(e);\r\n }\r\n });\r\n break;\r\n case \"ForStatement\":\r\n return evaluate(exp.init, workerScript).then(function(expInit) {\r\n return evaluateFor(exp, workerScript);\r\n }).then(function(forLoopRes) {\r\n return Promise.resolve(\"forLoopDone\");\r\n }).catch(function(e) {\r\n if (e == \"BREAKSTATEMENT\" ||\r\n (e instanceof WorkerScript && e.errorMessage == \"BREAKSTATEMENT\")) {\r\n return Promise.resolve(\"forLoopBroken\");\r\n } else {\r\n return Promise.reject(e);\r\n }\r\n });\r\n break;\r\n case \"FunctionDeclaration\":\r\n if (exp.id && exp.id.name) {\r\n env.set(exp.id.name, exp);\r\n return Promise.resolve(true);\r\n } else {\r\n return Promise.reject(makeRuntimeRejectMsg(workerScript, \"Invalid function declaration\", exp));\r\n }\r\n break;\r\n case \"ImportDeclaration\":\r\n return evaluateImport(exp, workerScript).then(function(res) {\r\n return Promise.resolve(res);\r\n }).catch(function(e) {\r\n return Promise.reject(e);\r\n });\r\n break;\r\n case \"ThrowStatement\":\r\n return evaluate(exp.argument, workerScript).then(function(res) {\r\n return Promise.reject(makeRuntimeRejectMsg(workerScript, res));\r\n });\r\n break;\r\n default:\r\n return Promise.reject(makeRuntimeRejectMsg(workerScript, \"Unrecognized token: \" + exp.type + \". This is currently unsupported in Netscript\", exp));\r\n break;\r\n } //End switch\r\n }).catch(function(e) {\r\n return Promise.reject(e);\r\n }); // End Promise\r\n}\r\n\r\nfunction evalBinary(exp, workerScript){\r\n return evaluate(exp.left, workerScript).then(function(expLeft) {\r\n //Short circuiting\r\n if (expLeft == true && exp.operator === \"||\") {\r\n return Promise.resolve(true);\r\n }\r\n if (expLeft == false && exp.operator === \"&&\") {\r\n return Promise.resolve(false);\r\n }\r\n return evaluate(exp.right, workerScript).then(function(expRight) {\r\n switch (exp.operator){\r\n case \"===\":\r\n case \"==\":\r\n return Promise.resolve(expLeft===expRight);\r\n break;\r\n case \"!==\":\r\n case \"!=\":\r\n return Promise.resolve(expLeft!==expRight);\r\n break;\r\n case \"<\":\r\n return Promise.resolve(expLeft<expRight);\r\n break;\r\n case \"<=\":\r\n return Promise.resolve(expLeft<=expRight);\r\n break;\r\n case \">\":\r\n return Promise.resolve(expLeft>expRight);\r\n break;\r\n case \">=\":\r\n return Promise.resolve(expLeft>=expRight);\r\n break;\r\n case \"+\":\r\n return Promise.resolve(expLeft+expRight);\r\n break;\r\n case \"-\":\r\n return Promise.resolve(expLeft-expRight);\r\n break;\r\n case \"*\":\r\n return Promise.resolve(expLeft*expRight);\r\n break;\r\n case \"/\":\r\n if (expRight === 0) {\r\n return Promise.reject(makeRuntimeRejectMsg(workerScript, \"ERROR: Divide by zero\"));\r\n } else {\r\n return Promise.resolve(expLeft/expRight);\r\n }\r\n break;\r\n case \"%\":\r\n return Promise.resolve(expLeft%expRight);\r\n break;\r\n case \"in\":\r\n return Promise.resolve(expLeft in expRight);\r\n break;\r\n case \"instanceof\":\r\n return Promise.resolve(expLeft instanceof expRight);\r\n break;\r\n case \"||\":\r\n return Promise.resolve(expLeft || expRight);\r\n break;\r\n case \"&&\":\r\n return Promise.resolve(expLeft && expRight);\r\n break;\r\n default:\r\n return Promise.reject(makeRuntimeRejectMsg(workerScript, \"Unsupported operator: \" + exp.operator));\r\n }\r\n });\r\n });\r\n}\r\n\r\nfunction evalUnary(exp, workerScript){\r\n var env = workerScript.env;\r\n if (env.stopFlag) {return Promise.reject(workerScript);}\r\n return evaluate(exp.argument, workerScript).then(function(res) {\r\n if (exp.operator == \"!\") {\r\n return Promise.resolve(!res);\r\n } else if (exp.operator == \"-\") {\r\n if (isNaN(res)) {\r\n return Promise.resolve(res);\r\n } else {\r\n return Promise.resolve(-1 * res);\r\n }\r\n } else {\r\n return Promise.reject(makeRuntimeRejectMsg(workerScript, \"Unimplemented unary operator: \" + exp.operator));\r\n }\r\n });\r\n}\r\n\r\n//Takes in a MemberExpression that should represent a Netscript array (possible multidimensional)\r\n//The return value is an array of the form:\r\n// [0th index (leftmost), array name, 1st index, 2nd index, ...]\r\nfunction getArrayElement(exp, workerScript) {\r\n var indices = [];\r\n return evaluate(exp.property, workerScript).then(function(idx) {\r\n if (isNaN(idx)) {\r\n return Promise.reject(makeRuntimeRejectMsg(workerScript, \"Invalid access to array. Index is not a number: \" + idx));\r\n } else {\r\n if (exp.object.name === undefined && exp.object.object) {\r\n return getArrayElement(exp.object, workerScript).then(function(res) {\r\n res.push(idx);\r\n indices = res;\r\n return Promise.resolve(indices);\r\n }).catch(function(e) {\r\n return Promise.reject(e);\r\n });\r\n } else {\r\n indices.push(idx);\r\n indices.push(exp.object.name);\r\n return Promise.resolve(indices);\r\n }\r\n }\r\n });\r\n}\r\n\r\nfunction evalAssignment(exp, workerScript) {\r\n var env = workerScript.env;\r\n if (env.stopFlag) {return Promise.reject(workerScript);}\r\n\r\n if (exp.left.type != \"Identifier\" && exp.left.type != \"MemberExpression\") {\r\n return Promise.reject(makeRuntimeRejectMsg(workerScript, \"Cannot assign to \" + JSON.stringify(exp.left)));\r\n }\r\n\r\n if (exp.operator !== \"=\" && !(exp.left.name in env.vars)){\r\n return Promise.reject(makeRuntimeRejectMsg(workerScript, \"variable \" + exp.left.name + \" not defined\"));\r\n }\r\n\r\n return evaluate(exp.right, workerScript).then(function(expRight) {\r\n if (exp.left.type == \"MemberExpression\") {\r\n if (!exp.left.computed) {\r\n return Promise.reject(makeRuntimeRejectMsg(workerScript, \"Cannot assign to an object's property. This is currently unsupported in Netscript\", exp));\r\n }\r\n //Assign to array element\r\n //Array object designed by exp.left.object.name\r\n //Index designated by exp.left.property\r\n return getArrayElement(exp.left, workerScript).then(function(res) {\r\n if (!(res instanceof Array) || res.length < 2) {\r\n return Promise.reject(makeRuntimeRejectMsg(workerScript, \"Error evaluating array assignment. This is (probably) a bug please report to game dev\"));\r\n }\r\n\r\n //The array name is the second value\r\n var arrName = res.splice(1, 1);\r\n arrName = arrName[0];\r\n\r\n var res;\r\n try {\r\n res = env.setArrayElement(arrName, res, expRight);\r\n } catch (e) {\r\n return Promise.reject(makeRuntimeRejectMsg(workerScript, e));\r\n }\r\n return Promise.resolve(res);\r\n }).catch(function(e) {\r\n return Promise.reject(e);\r\n });\r\n } else {\r\n //Other assignments\r\n try {\r\n var assign;\r\n switch (exp.operator) {\r\n case \"=\":\r\n assign = expRight; break;\r\n case \"+=\":\r\n assign = env.get(exp.left.name) + expRight; break;\r\n case \"-=\":\r\n assign = env.get(exp.left.name) - expRight; break;\r\n case \"*=\":\r\n assign = env.get(exp.left.name) * expRight; break;\r\n case \"/=\":\r\n assign = env.get(exp.left.name) / expRight; break;\r\n case \"%=\":\r\n assign = env.get(exp.left.name) % expRight; break;\r\n default:\r\n return Promise.reject(makeRuntimeRejectMsg(workerScript, \"Bitwise assignment is not implemented\"));\r\n }\r\n env.set(exp.left.name, assign);\r\n return Promise.resolve(assign);\r\n } catch (e) {\r\n return Promise.reject(makeRuntimeRejectMsg(workerScript, \"Failed to set environment variable: \" + e.toString()));\r\n }\r\n }\r\n });\r\n}\r\n\r\nfunction evaluateIf(exp, workerScript, i) {\r\n var env = workerScript.env;\r\n return evaluate(exp.test, workerScript).then(function(condRes) {\r\n if (condRes) {\r\n return evaluate(exp.consequent, workerScript).then(function(res) {\r\n return Promise.resolve(true);\r\n }, function(e) {\r\n return Promise.reject(e);\r\n });\r\n } else if (exp.alternate) {\r\n return evaluate(exp.alternate, workerScript).then(function(res) {\r\n return Promise.resolve(true);\r\n }, function(e) {\r\n return Promise.reject(e);\r\n });\r\n } else {\r\n return Promise.resolve(\"endIf\");\r\n }\r\n });\r\n}\r\n\r\n//Evaluate the looping part of a for loop (Initialization block is NOT done in here)\r\nfunction evaluateFor(exp, workerScript) {\r\n var env = workerScript.env;\r\n if (env.stopFlag) {return Promise.reject(workerScript);}\r\n return new Promise(function(resolve, reject) {\r\n function recurse() {\r\n //Don't return a promise so the promise chain is broken on each recursion (saving memory)\r\n evaluate(exp.test, workerScript).then(function(resCond) {\r\n if (resCond) {\r\n return evaluate(exp.body, workerScript).then(function(res) {\r\n return evaluate(exp.update, workerScript);\r\n }).catch(function(e) {\r\n if (e == \"CONTINUESTATEMENT\" ||\r\n (e instanceof WorkerScript && e.errorMessage == \"CONTINUESTATEMENT\")) {\r\n //Continue statement, recurse to next iteration\r\n return evaluate(exp.update, workerScript).then(function(resPostloop) {\r\n return evaluateFor(exp, workerScript);\r\n }).then(function(foo) {\r\n return Promise.resolve(\"endForLoop\");\r\n }).catch(function(e) {\r\n return Promise.reject(e);\r\n });\r\n } else {\r\n return Promise.reject(e);\r\n }\r\n }).then(recurse, reject).catch(function(e) {\r\n return Promise.reject(e);\r\n });\r\n } else {\r\n resolve();\r\n }\r\n }).catch(function(e) {\r\n reject(e);\r\n });\r\n }\r\n recurse();\r\n });\r\n}\r\n\r\nfunction evaluateForeach(arr, args, workerScript) {\r\n console.log(\"evaluateForeach called\");\r\n if (!(arr instanceof Array)) {\r\n return Promise.reject(\"Invalid array passed into forEach\");\r\n }\r\n if (!(args instanceof Array) && args.length != 1) {\r\n return Promise.reject(\"Invalid argument passed into forEach\");\r\n }\r\n var func = args[0];\r\n if (typeof func !== \"function\") {\r\n return Promise.reject(\"Invalid function passed into forEach\");\r\n }\r\n console.log(func);\r\n return new Promise(function(resolve, reject) {\r\n //Don't return a promise so the promise chain is broken on each recursion\r\n function recurse(i) {\r\n console.log(\"recurse() called with i: \" + i);\r\n if (i >= arr.length) {\r\n resolve();\r\n } else {\r\n return Promise.delay(Settings.CodeInstructionRunTime).then(function() {\r\n console.log(\"About to apply function\");\r\n var res = func.apply(null, [arr[i]]);\r\n console.log(\"Applied function\");\r\n ++i;\r\n Promise.resolve(res).then(function(val) {\r\n recurse(i);\r\n }, reject).catch(function(e) {\r\n return Promise.reject(e);\r\n });\r\n });\r\n }\r\n }\r\n recurse(0);\r\n });\r\n}\r\n\r\nfunction evaluateWhile(exp, workerScript) {\r\n var env = workerScript.env;\r\n if (env.stopFlag) {return Promise.reject(workerScript);}\r\n return new Promise(function (resolve, reject) {\r\n function recurse() {\r\n //Don't return a promise so the promise chain is broken on each recursion (saving memory)\r\n evaluate(exp.test, workerScript).then(function(resCond) {\r\n if (resCond) {\r\n return evaluate(exp.body, workerScript).catch(function(e) {\r\n if (e == \"CONTINUESTATEMENT\" ||\r\n (e instanceof WorkerScript && e.errorMessage == \"CONTINUESTATEMENT\")) {\r\n //Continue statement, recurse\r\n return evaluateWhile(exp, workerScript).then(function(foo) {\r\n return Promise.resolve(\"endWhileLoop\");\r\n }, function(e) {\r\n return Promise.reject(e);\r\n });\r\n } else {\r\n return Promise.reject(e);\r\n }\r\n }).then(recurse, reject).catch(function(e) {\r\n return Promise.reject(e);\r\n });\r\n } else {\r\n resolve();\r\n }\r\n }).catch(function(e) {\r\n reject(e);\r\n });\r\n }\r\n recurse();\r\n });\r\n}\r\n\r\nfunction evaluateProg(exp, workerScript, index) {\r\n var env = workerScript.env;\r\n if (env.stopFlag) {return Promise.reject(workerScript);}\r\n if (index >= exp.body.length) {\r\n return Promise.resolve(\"progFinished\");\r\n } else {\r\n //Evaluate this line of code in the prog\r\n //After the code finishes evaluating, evaluate the next line recursively\r\n return evaluate(exp.body[index], workerScript).then(function(res) {\r\n return evaluateProg(exp, workerScript, index + 1);\r\n }).then(function(res) {\r\n return Promise.resolve(workerScript);\r\n }).catch(function(e) {\r\n return Promise.reject(e);\r\n });\r\n }\r\n}\r\n\r\nfunction evaluateImport(exp, workerScript, checkingRam=false) {\r\n //When its checking RAM, it exports an array of nodes for each imported function\r\n var ramCheckRes = [];\r\n\r\n var env = workerScript.env;\r\n if (env.stopFlag) {\r\n if (checkingRam) {return ramCheckRes;}\r\n return Promise.reject(workerScript);\r\n }\r\n\r\n //Get source script and name of all functions to import\r\n var scriptName = exp.source.value;\r\n var namespace, namespaceObj, allFns = false, fnNames = [];\r\n if (exp.specifiers.length === 1 && exp.specifiers[0].type === \"ImportNamespaceSpecifier\") {\r\n allFns = true;\r\n namespace = exp.specifiers[0].local.name;\r\n } else {\r\n for (var i = 0; i < exp.specifiers.length; ++i) {\r\n fnNames.push(exp.specifiers[i].local.name);\r\n }\r\n }\r\n\r\n //Get the code\r\n var server = getServer(workerScript.serverIp), code = \"\";\r\n if (server == null) {\r\n if (checkingRam) {return ramCheckRes;}\r\n return Promise.reject(makeRuntimeRejectMsg(workerScript, \"Failed to identify server. This is a bug please report to dev\", exp));\r\n }\r\n for (var i = 0; i < server.scripts.length; ++i) {\r\n if (server.scripts[i].filename === scriptName) {\r\n code = server.scripts[i].code;\r\n break;\r\n }\r\n }\r\n if (code === \"\") {\r\n if (checkingRam) {return ramCheckRes;}\r\n return Promise.reject(makeRuntimeRejectMsg(workerScript, \"Could not find script \" + scriptName + \" to import\", exp));\r\n }\r\n\r\n //Create the AST\r\n try {\r\n var ast = parse(code, {sourceType:\"module\"});\r\n } catch(e) {\r\n console.log(\"Failed to parse import script\");\r\n if (checkingRam) {return ramCheckRes;}\r\n return Promise.reject(makeRuntimeRejectMsg(workerScript, \"Failed to import functions from \" + scriptName +\r\n \" This is most likely due to a syntax error in the imported script\", exp));\r\n }\r\n\r\n if (allFns) {\r\n //A namespace is implemented as a JS obj\r\n env.set(namespace, {});\r\n namespaceObj = env.get(namespace);\r\n }\r\n\r\n //Search through the AST for all imported functions\r\n var queue = [ast];\r\n while (queue.length != 0) {\r\n var node = queue.shift();\r\n switch (node.type) {\r\n case \"BlockStatement\":\r\n case \"Program\":\r\n for (var i = 0; i < node.body.length; ++i) {\r\n if (node.body[i] instanceof Node) {\r\n queue.push(node.body[i]);\r\n }\r\n }\r\n break;\r\n case \"FunctionDeclaration\":\r\n if (node.id && node.id.name) {\r\n if (allFns) {\r\n //Import all functions under this namespace\r\n if (checkingRam) {\r\n ramCheckRes.push(node);\r\n } else {\r\n namespaceObj[node.id.name] = node;\r\n }\r\n } else {\r\n //Only import specified functions\r\n if (fnNames.includes(node.id.name)) {\r\n if (checkingRam) {\r\n ramCheckRes.push(node);\r\n } else {\r\n env.set(node.id.name, node);\r\n }\r\n\r\n }\r\n }\r\n } else {\r\n if (checkingRam) {return ramCheckRes;}\r\n return Promise.reject(makeRuntimeRejectMsg(workerScript, \"Invalid function declaration in imported script \" + scriptName, exp));\r\n }\r\n break;\r\n default:\r\n break;\r\n }\r\n\r\n for (var prop in node) {\r\n if (node.hasOwnProperty(prop)) {\r\n if (node[prop] instanceof Node) {\r\n queue.push(node[prop]);\r\n }\r\n }\r\n }\r\n }\r\n if (!checkingRam) {workerScript.scriptRef.log(\"Imported functions from \" + scriptName);}\r\n if (checkingRam) {return ramCheckRes;}\r\n return Promise.resolve(true);\r\n}\r\n\r\nfunction killNetscriptDelay(workerScript) {\r\n if (workerScript instanceof WorkerScript) {\r\n if (workerScript.delay) {\r\n clearTimeout(workerScript.delay);\r\n workerScript.delayResolve();\r\n }\r\n }\r\n}\r\n\r\nfunction netscriptDelay(time, workerScript) {\r\n return new Promise(function(resolve, reject) {\r\n workerScript.delay = setTimeout(()=>{\r\n workerScript.delay = null;\r\n resolve();\r\n }, time);\r\n workerScript.delayResolve = resolve;\r\n });\r\n}\r\n\r\nfunction makeRuntimeRejectMsg(workerScript, msg, exp=null) {\r\n var lineNum = \"\";\r\n if (exp != null) {\r\n var num = getErrorLineNumber(exp, workerScript);\r\n lineNum = \" (Line \" + num + \")\"\r\n }\r\n return \"|\"+workerScript.serverIp+\"|\"+workerScript.name+\"|\" + msg + lineNum;\r\n}\r\n\r\n//Run a script from inside a script using run() command\r\nfunction runScriptFromScript(server, scriptname, args, workerScript, threads=1) {\r\n //Check if the script is already running\r\n var runningScriptObj = findRunningScript(scriptname, args, server);\r\n if (runningScriptObj != null) {\r\n workerScript.scriptRef.log(scriptname + \" is already running on \" + server.hostname);\r\n return Promise.resolve(false);\r\n }\r\n\r\n //'null/undefined' arguments are not allowed\r\n for (var i = 0; i < args.length; ++i) {\r\n if (args[i] == null) {\r\n workerScript.scriptRef.log(\"ERROR: Cannot execute a script with null/undefined as an argument\");\r\n return Promise.resolve(false);\r\n }\r\n }\r\n\r\n //Check if the script exists and if it does run it\r\n for (var i = 0; i < server.scripts.length; ++i) {\r\n if (server.scripts[i].filename == scriptname) {\r\n //Check for admin rights and that there is enough RAM availble to run\r\n var script = server.scripts[i];\r\n var ramUsage = script.ramUsage;\r\n threads = Math.round(Number(threads)); //Convert to number and round\r\n ramUsage = ramUsage * threads * Math.pow(CONSTANTS.MultithreadingRAMCost, threads-1);\r\n var ramAvailable = server.maxRam - server.ramUsed;\r\n\r\n if (server.hasAdminRights == false) {\r\n workerScript.scriptRef.log(\"Cannot run script \" + scriptname + \" on \" + server.hostname + \" because you do not have root access!\");\r\n return Promise.resolve(false);\r\n } else if (ramUsage > ramAvailable){\r\n workerScript.scriptRef.log(\"Cannot run script \" + scriptname + \"(t=\" + threads + \") on \" + server.hostname + \" because there is not enough available RAM!\");\r\n return Promise.resolve(false);\r\n } else {\r\n //Able to run script\r\n workerScript.scriptRef.log(\"Running script: \" + scriptname + \" on \" + server.hostname + \" with \" + threads + \" threads and args: \" + printArray(args) + \". May take a few seconds to start up...\");\r\n var runningScriptObj = new RunningScript(script, args);\r\n runningScriptObj.threads = threads;\r\n server.runningScripts.push(runningScriptObj); //Push onto runningScripts\r\n addWorkerScript(runningScriptObj, server);\r\n return Promise.resolve(true);\r\n }\r\n }\r\n }\r\n workerScript.scriptRef.log(\"Could not find script \" + scriptname + \" on \" + server.hostname);\r\n return Promise.resolve(false);\r\n}\r\n\r\nfunction getErrorLineNumber(exp, workerScript) {\r\n var code = workerScript.scriptRef.scriptRef.code;\r\n\r\n //Split code up to the start of the node\r\n try {\r\n code = code.substring(0, exp.start);\r\n return (code.match(/\\n/g) || []).length + 1;\r\n } catch(e) {\r\n return -1;\r\n }\r\n}\r\n\r\nfunction isScriptErrorMessage(msg) {\r\n if (!isString(msg)) {return false;}\r\n let splitMsg = msg.split(\"|\");\r\n if (splitMsg.length != 4){\r\n return false;\r\n }\r\n var ip = splitMsg[1];\r\n if (!isValidIPAddress(ip)) {\r\n return false;\r\n }\r\n return true;\r\n}\r\n\r\n//The same as Player's calculateHackingChance() function but takes in the server as an argument\r\nfunction scriptCalculateHackingChance(server) {\r\n var difficultyMult = (100 - server.hackDifficulty) / 100;\r\n var skillMult = (1.75 * Player.hacking_skill) + (0.2 * Player.intelligence);\r\n var skillChance = (skillMult - server.requiredHackingSkill) / skillMult;\r\n var chance = skillChance * difficultyMult * Player.hacking_chance_mult;\r\n if (chance > 1) {return 1;}\r\n if (chance < 0) {return 0;}\r\n else {return chance;}\r\n}\r\n\r\n//The same as Player's calculateHackingTime() function but takes in the server as an argument\r\nfunction scriptCalculateHackingTime(server) {\r\n var difficultyMult = server.requiredHackingSkill * server.hackDifficulty;\r\n var skillFactor = (2.5 * difficultyMult + 500) / (Player.hacking_skill + 50 + (0.1 * Player.intelligence));\r\n var hackingTime = 5 * skillFactor / Player.hacking_speed_mult; //This is in seconds\r\n return hackingTime;\r\n}\r\n\r\n//The same as Player's calculateExpGain() function but takes in the server as an argument\r\nfunction scriptCalculateExpGain(server) {\r\n if (server.baseDifficulty == null) {\r\n server.baseDifficulty = server.hackDifficulty;\r\n }\r\n return (server.baseDifficulty * Player.hacking_exp_mult * 0.3 + 3) * BitNodeMultipliers.HackExpGain;\r\n}\r\n\r\n//The same as Player's calculatePercentMoneyHacked() function but takes in the server as an argument\r\nfunction scriptCalculatePercentMoneyHacked(server) {\r\n var difficultyMult = (100 - server.hackDifficulty) / 100;\r\n var skillMult = (Player.hacking_skill - (server.requiredHackingSkill - 1)) / Player.hacking_skill;\r\n var percentMoneyHacked = difficultyMult * skillMult * Player.hacking_money_mult / 240;\r\n if (percentMoneyHacked < 0) {return 0;}\r\n if (percentMoneyHacked > 1) {return 1;}\r\n return percentMoneyHacked * BitNodeMultipliers.ScriptHackMoney;\r\n}\r\n\r\n//Amount of time to execute grow() in milliseconds\r\nfunction scriptCalculateGrowTime(server) {\r\n var difficultyMult = server.requiredHackingSkill * server.hackDifficulty;\r\n var skillFactor = (2.5 * difficultyMult + 500) / (Player.hacking_skill + 50 + (0.1 * Player.intelligence));\r\n var growTime = 16 * skillFactor / Player.hacking_speed_mult; //This is in seconds\r\n return growTime * 1000;\r\n}\r\n\r\n//Amount of time to execute weaken() in milliseconds\r\nfunction scriptCalculateWeakenTime(server) {\r\n var difficultyMult = server.requiredHackingSkill * server.hackDifficulty;\r\n var skillFactor = (2.5 * difficultyMult + 500) / (Player.hacking_skill + 50 + (0.1 * Player.intelligence));\r\n var weakenTime = 20 * skillFactor / Player.hacking_speed_mult; //This is in seconds\r\n return weakenTime * 1000;\r\n}\r\n\r\nexport {makeRuntimeRejectMsg, netscriptDelay, runScriptFromScript,\r\n scriptCalculateHackingChance, scriptCalculateHackingTime,\r\n scriptCalculateExpGain, scriptCalculatePercentMoneyHacked,\r\n scriptCalculateGrowTime, scriptCalculateWeakenTime, evaluate,\r\n isScriptErrorMessage, killNetscriptDelay, evaluateImport};\r\n","/* Pop up Dialog Box */\r\nlet dialogBoxes = [];\r\n\r\n//Close dialog box when clicking outside\r\n$(document).click(function(event) {\r\n if (dialogBoxOpened && dialogBoxes.length >= 1) {\r\n if (!$(event.target).closest(dialogBoxes[0]).length){\r\n dialogBoxes[0].remove();\r\n dialogBoxes.splice(0, 1);\r\n if (dialogBoxes.length == 0) {\r\n dialogBoxOpened = false;\r\n } else {\r\n dialogBoxes[0].style.visibility = \"visible\";\r\n }\r\n }\r\n }\r\n});\r\n\r\n\r\n//Dialog box close buttons\r\n$(document).on('click', '.dialog-box-close-button', function( event ) {\r\n if (dialogBoxOpened && dialogBoxes.length >= 1) {\r\n dialogBoxes[0].remove();\r\n dialogBoxes.splice(0, 1);\r\n if (dialogBoxes.length == 0) {\r\n dialogBoxOpened = false;\r\n } else {\r\n dialogBoxes[0].style.visibility = \"visible\";\r\n }\r\n }\r\n});\r\n\r\nvar dialogBoxOpened = false;\r\n\r\nfunction dialogBoxCreate(txt, preformatted=false) {\r\n var container = document.createElement(\"div\");\r\n container.setAttribute(\"class\", \"dialog-box-container\");\r\n\r\n var content = document.createElement(\"div\");\r\n content.setAttribute(\"class\", \"dialog-box-content\");\r\n\r\n var closeButton = document.createElement(\"span\");\r\n closeButton.setAttribute(\"class\", \"dialog-box-close-button\");\r\n closeButton.innerHTML = \"&times;\"\r\n\r\n var textE;\r\n if (preformatted) {\r\n // For text files as they are often computed data that\r\n // shouldn't be wrapped and should retain tabstops.\r\n textE = document.createElement(\"pre\");\r\n textE.innerHTML = txt;\r\n } else {\r\n textE = document.createElement(\"p\");\r\n textE.innerHTML = txt.replace(/(?:\\r\\n|\\r|\\n)/g, '<br>');\r\n }\r\n\r\n content.appendChild(closeButton);\r\n content.appendChild(textE);\r\n container.appendChild(content);\r\n\r\n document.body.appendChild(container);\r\n if (dialogBoxes.length >= 1) {\r\n container.style.visibility = \"hidden\";\r\n }\r\n dialogBoxes.push(container);\r\n\r\n setTimeout(function() {\r\n dialogBoxOpened = true;\r\n }, 400);\r\n}\r\n\r\nexport {dialogBoxCreate, dialogBoxOpened};\r\n","/* Generic Reviver, toJSON, and fromJSON functions used for saving and loading objects */\r\n\r\n// A generic \"smart reviver\" function.\r\n// Looks for object values with a `ctor` property and\r\n// a `data` property. If it finds them, and finds a matching\r\n// constructor that has a `fromJSON` property on it, it hands\r\n// off to that `fromJSON` fuunction, passing in the value.\r\nfunction Reviver(key, value) {\r\n\tvar ctor;\r\n if (value == null) {\r\n console.log(\"Reviver WRONGLY called with key: \" + key + \", and value: \" + value);\r\n return 0;\r\n }\r\n\tif (typeof value === \"object\" &&\r\n\t\ttypeof value.ctor === \"string\" &&\r\n\t\ttypeof value.data !== \"undefined\") {\r\n\t\t\tctor = Reviver.constructors[value.ctor] || window[value.ctor];\r\n\t\t\tif (typeof ctor === \"function\" &&\r\n\t\t\t\ttypeof ctor.fromJSON === \"function\") {\r\n\r\n\t\t\t\t\treturn ctor.fromJSON(value);\r\n\t\t\t}\r\n\t}\r\n\treturn value;\r\n}\r\nReviver.constructors = {}; // A list of constructors the smart reviver should know about\r\n\r\n// A generic \"toJSON\" function that creates the data expected\r\n// by Reviver.\r\n// `ctorName` The name of the constructor to use to revive it\r\n// `obj` The object being serialized\r\n// `keys` (Optional) Array of the properties to serialize,\r\n// if not given then all of the objects \"own\" properties\r\n// that don't have function values will be serialized.\r\n// (Note: If you list a property in `keys`, it will be serialized\r\n// regardless of whether it's an \"own\" property.)\r\n// Returns: The structure (which will then be turned into a string\r\n// as part of the JSON.stringify algorithm)\r\nfunction Generic_toJSON(ctorName, obj, keys) {\r\n var data, index, key;\r\n\r\n if (!keys) {\r\n keys = Object.keys(obj); // Only \"own\" properties are included\r\n }\r\n\r\n data = {};\r\n for (index = 0; index < keys.length; ++index) {\r\n key = keys[index];\r\n data[key] = obj[key];\r\n }\r\n return {ctor: ctorName, data: data};\r\n}\r\n\r\n// A generic \"fromJSON\" function for use with Reviver: Just calls the\r\n// constructor function with no arguments, then applies all of the\r\n// key/value pairs from the raw data to the instance. Only useful for\r\n// constructors that can be reasonably called without arguments!\r\n// `ctor` The constructor to call\r\n// `data` The data to apply\r\n// Returns: The object\r\nfunction Generic_fromJSON(ctor, data) {\r\n var obj, name;\r\n\r\n obj = new ctor();\r\n for (name in data) {\r\n obj[name] = data[name];\r\n }\r\n return obj;\r\n}\r\n\r\nexport {Reviver, Generic_toJSON, Generic_fromJSON};\r\n","import {CONSTANTS} from \"./Constants.js\";\r\nimport {Locations} from \"./Location.js\";\r\nimport {Player} from \"./Player.js\";\r\n\r\nimport {Reviver, Generic_toJSON,\r\n Generic_fromJSON} from \"../utils/JSONReviver.js\";\r\n\r\n//Netburner Company class\r\n// Note: Company Positions can be loaded every time with init() but Company class needs\r\n// to be saved/loaded from localStorage\r\nfunction Company(name=\"\", salaryMult=0, expMult=0, jobStatReqOffset=0) {\r\n this.companyName = name;\r\n this.info = \"\";\r\n this.companyPositions = []; //Names (only name, not object) of all company positions\r\n this.perks = []; //Available Perks\r\n this.salaryMultiplier = salaryMult; //Multiplier for base salary\r\n this.expMultiplier = expMult; //Multiplier for base exp gain\r\n\r\n //The additional levels you need in the relevant stat to qualify for a job.\r\n //E.g the offset for a megacorporation will be high, let's say 200, so the\r\n //stat level you'd need to get an intern job would be 200 instead of 1.\r\n this.jobStatReqOffset = jobStatReqOffset;\r\n\r\n //Player-related properties for company\r\n this.isPlayerEmployed = false;\r\n this.playerPosition = \"\"; //Name (only name, not object) of the current position player holds\r\n this.playerReputation = 1; //\"Reputation\" within company, gain reputation by working for company\r\n this.favor = 0;\r\n this.rolloverRep = 0;\r\n};\r\n\r\nCompany.prototype.setInfo = function(inf) {\r\n this.info = inf;\r\n}\r\n\r\nCompany.prototype.addPosition = function(pos) {\r\n this.companyPositions.push(pos.positionName); //Company object holds only name of positions\r\n}\r\n\r\nCompany.prototype.addPositions = function(positions) {\r\n for (var i = 0; i < positions.length; i++) {\r\n this.addPosition(positions[i]);\r\n }\r\n}\r\n\r\nCompany.prototype.hasPosition = function(pos) {\r\n for (var i = 0; i < this.companyPositions.length; ++i) {\r\n if (pos.positionName == this.companyPositions[i]) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n}\r\n\r\nCompany.prototype.gainFavor = function() {\r\n if (this.favor == null || this.favor == undefined) {this.favor = 0;}\r\n if (this.rolloverRep == null || this.rolloverRep == undefined) {this.rolloverRep = 0;}\r\n var res = this.getFavorGain();\r\n if (res.length != 2) {\r\n console.log(\"Error: invalid result from getFavorGain() function\");\r\n return;\r\n }\r\n this.favor += res[0];\r\n this.rolloverRep = res[1];\r\n}\r\n\r\nCompany.prototype.getFavorGain = function() {\r\n if (this.favor == null || this.favor == undefined) {this.favor = 0;}\r\n if (this.rolloverRep == null || this.rolloverRep == undefined) {this.rolloverRep = 0;}\r\n var favorGain = 0, rep = this.playerReputation + this.rolloverRep;\r\n var reqdRep = CONSTANTS.CompanyReputationToFavorBase *\r\n Math.pow(CONSTANTS.CompanyReputationToFavorMult, this.favor);\r\n while(rep > 0) {\r\n if (rep >= reqdRep) {\r\n ++favorGain;\r\n rep -= reqdRep;\r\n } else {\r\n break;\r\n }\r\n reqdRep *= CONSTANTS.FactionReputationToFavorMult;\r\n }\r\n return [favorGain, rep];\r\n}\r\n\r\nCompany.prototype.toJSON = function() {\r\n return Generic_toJSON(\"Company\", this);\r\n}\r\n\r\nCompany.fromJSON = function(value) {\r\n return Generic_fromJSON(Company, value.data);\r\n}\r\n\r\nReviver.constructors.Company = Company;\r\n\r\n//Object that defines a position within a Company and its requirements\r\nfunction CompanyPosition(name, reqHack, reqStr, reqDef, reqDex, reqAgi, reqCha, reqRep, salary) {\r\n this.positionName = name;\r\n this.requiredHacking = reqHack;\r\n this.requiredStrength = reqStr;\r\n this.requiredDefense = reqDef;\r\n this.requiredDexterity = reqDex;\r\n this.requiredAgility = reqAgi;\r\n this.requiredCharisma = reqCha;\r\n this.requiredReputation = reqRep;\r\n\r\n //Base salary for a position. This will be multiplied by a company-specific multiplier. Better companies will have\r\n //higher multipliers.\r\n //\r\n //NOTE: This salary denotes the $ gained every loop (200 ms)\r\n this.baseSalary = salary;\r\n};\r\n\r\n//Set the parameters that are used to determine how good/effective the Player is at a job.\r\n//The Player's \"effectiveness\" at a job determines how much reputation he gains when he works\r\n//\r\n//NOTE: These parameters should total to 100, such that each parameter represents a \"weighting\" of how\r\n// important that stat/skill is for the job\r\nCompanyPosition.prototype.setPerformanceParameters = function(hackEff, strEff, defEff, dexEff, agiEff, chaEff, posMult=1) {\r\n if (hackEff + strEff + defEff + dexEff + agiEff + chaEff != 100) {\r\n console.log(\"CompanyPosition.setPerformanceParameters() arguments do not total to 100\");\r\n return;\r\n }\r\n this.hackingEffectiveness = hackEff;\r\n this.strengthEffectiveness = strEff;\r\n this.defenseEffectiveness = defEff;\r\n this.dexterityEffectiveness = dexEff;\r\n this.agilityEffectiveness = agiEff;\r\n this.charismaEffectiveness = chaEff;\r\n this.positionMultiplier = posMult; //Reputation multiplier for this position\r\n}\r\n\r\n//Set the stat/skill experience a Player should gain for working at a CompanyPosition. The experience is per game loop (200 ms)\r\n//These will be constant for a single position, but is affected by a company-specific multiplier\r\nCompanyPosition.prototype.setExperienceGains = function(hack, str, def, dex, agi, cha) {\r\n this.hackingExpGain = hack;\r\n this.strengthExpGain = str;\r\n this.defenseExpGain = def;\r\n this.dexterityExpGain = dex;\r\n this.agilityExpGain = agi;\r\n this.charismaExpGain = cha;\r\n}\r\n\r\n//Calculate a player's effectiveness at a certain job. Returns the amount of job reputation\r\n//that should be gained every game loop (200 ms)\r\nCompanyPosition.prototype.calculateJobPerformance = function(hacking, str, def, dex, agi, cha) {\r\n var hackRatio = this.hackingEffectiveness * hacking / CONSTANTS.MaxSkillLevel;\r\n var strRatio = this.strengthEffectiveness * str / CONSTANTS.MaxSkillLevel;\r\n var defRatio = this.defenseEffectiveness * def / CONSTANTS.MaxSkillLevel;\r\n var dexRatio = this.dexterityEffectiveness * dex / CONSTANTS.MaxSkillLevel;\r\n var agiRatio = this.agilityEffectiveness * agi / CONSTANTS.MaxSkillLevel;\r\n var chaRatio = this.charismaEffectiveness * cha / CONSTANTS.MaxSkillLevel;\r\n\r\n var reputationGain = this.positionMultiplier * (hackRatio + strRatio + defRatio + dexRatio + agiRatio + chaRatio) / 100;\r\n if (isNaN(reputationGain)) {\r\n console.log(\"ERROR: Code should not reach here\");\r\n reputationGain = (hackRatio + strRatio + defRatio + dexRatio + agiRatio + chaRatio) / 100;\r\n }\r\n return reputationGain;\r\n}\r\n\r\nCompanyPosition.prototype.isSoftwareJob = function() {\r\n if (this.positionName == \"Software Engineering Intern\" ||\r\n this.positionName == \"Junior Software Engineer\" ||\r\n this.positionName == \"Senior Software Engineer\" ||\r\n this.positionName == \"Lead Software Developer\" ||\r\n this.positionName == \"Head of Software\" ||\r\n this.positionName == \"Head of Engineering\" ||\r\n this.positionName == \"Vice President of Technology\" ||\r\n this.positionName == \"Chief Technology Officer\") {\r\n return true;\r\n }\r\n return false;\r\n}\r\n\r\nCompanyPosition.prototype.isITJob = function() {\r\n if (this.positionName == \"IT Intern\" ||\r\n this.positionName == \"IT Analyst\" ||\r\n this.positionName == \"IT Manager\" ||\r\n this.positionName == \"Systems Administrator\") {\r\n return true;\r\n }\r\n return false;\r\n}\r\n\r\nCompanyPosition.prototype.isSecurityEngineerJob = function() {\r\n if (this.positionName == \"Security Engineer\") {\r\n return true;\r\n }\r\n return false;\r\n}\r\n\r\nCompanyPosition.prototype.isNetworkEngineerJob = function() {\r\n if (this.positionName == \"Network Engineer\" || this.positionName == \"Network Administrator\") {\r\n return true;\r\n }\r\n return false;\r\n}\r\n\r\nCompanyPosition.prototype.isBusinessJob = function() {\r\n if (this.positionName == \"Business Intern\" ||\r\n this.positionName == \"Business Analyst\" ||\r\n this.positionName == \"Business Manager\" ||\r\n this.positionName == \"Operations Manager\" ||\r\n this.positionName == \"Chief Financial Officer\" ||\r\n this.positionName == \"Chief Executive Officer\") {\r\n return true;\r\n }\r\n return false;\r\n}\r\n\r\nCompanyPosition.prototype.isSecurityJob = function() {\r\n if (this.positionName == \"Security Guard\" ||\r\n this.positionName == \"Police Officer\" ||\r\n this.positionName == \"Security Officer\" ||\r\n this.positionName == \"Security Supervisor\" ||\r\n this.positionName == \"Head of Security\") {\r\n return true;\r\n }\r\n return false;\r\n}\r\n\r\nCompanyPosition.prototype.isAgentJob = function() {\r\n if (this.positionName == \"Field Agent\" ||\r\n this.positionName == \"Secret Agent\" ||\r\n this.positionName == \"Special Operative\") {\r\n return true;\r\n }\r\n return false;\r\n}\r\n\r\nCompanyPosition.prototype.isSoftwareConsultantJob = function() {\r\n if (this.positionName == \"Software Consultant\" ||\r\n this.positionName == \"Senior Software Consultant\") {return true;}\r\n return false;\r\n}\r\n\r\nCompanyPosition.prototype.isBusinessConsultantJob = function() {\r\n if (this.positionName == \"Business Consultant\" ||\r\n this.positionName == \"Senior Business Consultant\") {return true;}\r\n return false;\r\n}\r\n\r\nCompanyPosition.prototype.isPartTimeJob = function() {\r\n if (this.isSoftwareConsultantJob() ||\r\n this.isBusinessConsultantJob() ||\r\n this.positionName == \"Part-time Waiter\" ||\r\n this.positionName == \"Part-time Employee\") {return true;}\r\n return false;\r\n}\r\n\r\nCompanyPosition.prototype.toJSON = function() {\r\n return Generic_toJSON(\"CompanyPosition\", this);\r\n}\r\n\r\nCompanyPosition.fromJSON = function(value) {\r\n return Generic_fromJSON(CompanyPosition, value.data);\r\n}\r\n\r\nReviver.constructors.CompanyPosition = CompanyPosition;\r\n\r\nlet CompanyPositions = {\r\n //Constructor: CompanyPosition(name, reqHack, reqStr, reqDef, reqDex, reqAgi, reqCha, reqRep, salary)\r\n\r\n //Software\r\n SoftwareIntern: new CompanyPosition(\"Software Engineering Intern\", 1, 0, 0, 0, 0, 0, 0, 33),\r\n JuniorDev: new CompanyPosition(\"Junior Software Engineer\", 51, 0, 0, 0, 0, 0, 8000, 80),\r\n SeniorDev: new CompanyPosition(\"Senior Software Engineer\", 251, 0, 0, 0, 0, 51, 40000, 165),\r\n LeadDev: new CompanyPosition(\"Lead Software Developer\", 401, 0, 0, 0, 0, 151, 200000, 500),\r\n\r\n //TODO Through darkweb, maybe?\r\n FreelanceDeveloper: new CompanyPosition(\"Freelance Developer\", 0, 0, 0, 0, 0, 0, 0, 0),\r\n\r\n SoftwareConsultant: new CompanyPosition(\"Software Consultant\", 51, 0, 0, 0, 0, 0, 0, 66),\r\n SeniorSoftwareConsultant: new CompanyPosition(\"Senior Software Consultant\", 251, 0, 0, 0, 0, 51, 0, 132),\r\n\r\n //IT\r\n ITIntern: new CompanyPosition(\"IT Intern\", 1, 0, 0, 0, 0, 0, 0, 26),\r\n ITAnalyst: new CompanyPosition(\"IT Analyst\", 26, 0, 0, 0, 0, 0, 7000, 66),\r\n ITManager: new CompanyPosition(\"IT Manager\", 151, 0, 0, 0, 0, 51, 35000, 132),\r\n SysAdmin: new CompanyPosition(\"Systems Administrator\", 251, 0, 0, 0, 0, 76, 175000, 410),\r\n SecurityEngineer: new CompanyPosition(\"Security Engineer\", 151, 0, 0, 0, 0, 26, 35000, 121),\r\n NetworkEngineer: new CompanyPosition(\"Network Engineer\", 151, 0, 0, 0, 0, 26, 35000, 121),\r\n NetworkAdministrator: new CompanyPosition(\"Network Administrator\", 251, 0, 0, 0, 0, 76, 175000, 410),\r\n\r\n //Technology management\r\n HeadOfSoftware: new CompanyPosition(\"Head of Software\", 501, 0, 0, 0, 0, 251, 400000, 800),\r\n HeadOfEngineering: new CompanyPosition(\"Head of Engineering\", 501, 0, 0, 0, 0, 251, 800000, 1650),\r\n VicePresident: new CompanyPosition(\"Vice President of Technology\", 601, 0, 0, 0, 0, 401, 1600000, 2310),\r\n CTO: new CompanyPosition(\"Chief Technology Officer\", 751, 0, 0, 0, 0, 501, 3200000, 2640),\r\n\r\n //Business\r\n BusinessIntern: new CompanyPosition(\"Business Intern\", 1, 0, 0, 0, 0, 1, 0, 46),\r\n BusinessAnalyst: new CompanyPosition(\"Business Analyst\", 6, 0, 0, 0, 0, 51, 8000, 100),\r\n BusinessManager: new CompanyPosition(\"Business Manager\", 51, 0, 0, 0, 0, 101, 40000, 200),\r\n OperationsManager: new CompanyPosition(\"Operations Manager\", 51, 0, 0, 0, 0, 226, 200000, 660),\r\n CFO: new CompanyPosition(\"Chief Financial Officer\", 76, 0, 0, 0, 0, 501, 800000, 1950),\r\n CEO: new CompanyPosition(\"Chief Executive Officer\", 101, 0, 0, 0, 0, 751, 3200000, 3900),\r\n\r\n BusinessConsultant: new CompanyPosition(\"Business Consultant\", 6, 0, 0, 0, 0, 51, 0, 88),\r\n SeniorBusinessConsultant: new CompanyPosition(\"Senior Business Consultant\", 51, 0, 0, 0, 0, 226, 0, 525),\r\n\r\n //Non-tech/management jobs\r\n PartTimeWaiter: new CompanyPosition(\"Part-time Waiter\", 0, 0, 0, 0, 0, 0, 0, 20),\r\n PartTimeEmployee: new CompanyPosition(\"Part-time Employee\", 0, 0, 0, 0, 0, 0, 0, 20),\r\n\r\n Waiter: new CompanyPosition(\"Waiter\", 0, 0, 0, 0, 0, 0, 0, 22),\r\n Employee: new CompanyPosition(\"Employee\", 0, 0, 0, 0, 0, 0, 0, 22),\r\n PoliceOfficer: new CompanyPosition(\"Police Officer\", 11, 101, 101, 101, 101, 51, 8000, 82),\r\n PoliceChief: new CompanyPosition(\"Police Chief\", 101, 301, 301, 301, 301, 151, 36000, 460),\r\n SecurityGuard: new CompanyPosition(\"Security Guard\", 0, 51, 51, 51, 51, 1, 0, 50),\r\n SecurityOfficer: new CompanyPosition(\"Security Officer\", 26, 151, 151, 151, 151, 51, 8000, 195),\r\n SecuritySupervisor: new CompanyPosition(\"Security Supervisor\", 26, 251, 251, 251, 251, 101, 36000, 660),\r\n HeadOfSecurity: new CompanyPosition(\"Head of Security\", 51, 501, 501, 501, 501, 151, 144000, 1320),\r\n FieldAgent: new CompanyPosition(\"Field Agent\", 101, 101, 101, 101, 101, 101, 8000, 330),\r\n SecretAgent: new CompanyPosition(\"Secret Agent\", 201, 251, 251, 251, 251, 201, 32000, 990),\r\n SpecialOperative: new CompanyPosition(\"Special Operative\", 251, 501, 501, 501, 501, 251, 162000, 2000),\r\n\r\n init: function() {\r\n //Argument order: hack, str, def, dex, agi, cha\r\n //Software\r\n CompanyPositions.SoftwareIntern.setPerformanceParameters(85, 0, 0, 0, 0, 15, 0.9);\r\n CompanyPositions.SoftwareIntern.setExperienceGains(.05, 0, 0, 0, 0, .02);\r\n CompanyPositions.JuniorDev.setPerformanceParameters(85, 0, 0, 0, 0, 15, 1.1);\r\n CompanyPositions.JuniorDev.setExperienceGains(.1, 0, 0, 0, 0, .05);\r\n CompanyPositions.SeniorDev.setPerformanceParameters(80, 0, 0, 0, 0, 20, 1.3);\r\n CompanyPositions.SeniorDev.setExperienceGains(.4, 0, 0, 0, 0, .08);\r\n CompanyPositions.LeadDev.setPerformanceParameters(75, 0, 0, 0, 0, 25, 1.5);\r\n CompanyPositions.LeadDev.setExperienceGains(.8, 0, 0, 0, 0, .1);\r\n\r\n CompanyPositions.SoftwareConsultant.setPerformanceParameters(80, 0, 0, 0, 0, 20, 1);\r\n CompanyPositions.SoftwareConsultant.setExperienceGains(.08, 0, 0, 0, 0, .03);\r\n CompanyPositions.SeniorSoftwareConsultant.setPerformanceParameters(75, 0, 0, 0, 0, 25, 1.2);\r\n CompanyPositions.SeniorSoftwareConsultant.setExperienceGains(.25, 0, 0, 0, 0, .06);\r\n\r\n //Security\r\n CompanyPositions.ITIntern.setPerformanceParameters(90, 0, 0, 0, 0, 10, 0.9);\r\n CompanyPositions.ITIntern.setExperienceGains(.04, 0, 0, 0, 0, .01);\r\n CompanyPositions.ITAnalyst.setPerformanceParameters(85, 0, 0, 0, 0, 15, 1.1);\r\n CompanyPositions.ITAnalyst.setExperienceGains(.08, 0, 0, 0, 0, .02);\r\n CompanyPositions.ITManager.setPerformanceParameters(80, 0, 0, 0, 0, 20, 1.3);\r\n CompanyPositions.ITManager.setExperienceGains(.3, 0, 0, 0, 0, .1);\r\n CompanyPositions.SysAdmin.setPerformanceParameters(80, 0, 0, 0, 0, 20, 1.4);\r\n CompanyPositions.SysAdmin.setExperienceGains(.5, 0, 0, 0, 0, .05);\r\n CompanyPositions.SecurityEngineer.setPerformanceParameters(85, 0, 0, 0, 0, 15, 1.2);\r\n CompanyPositions.SecurityEngineer.setExperienceGains(0.4, 0, 0, 0, 0, .05);\r\n CompanyPositions.NetworkEngineer.setPerformanceParameters(85, 0, 0, 0, 0, 15, 1.2);\r\n CompanyPositions.NetworkEngineer.setExperienceGains(0.4, 0, 0, 0, 0, .05);\r\n CompanyPositions.NetworkAdministrator.setPerformanceParameters(80, 0, 0, 0, 0, 20, 1.3);\r\n CompanyPositions.NetworkAdministrator.setExperienceGains(0.5, 0, 0, 0, 0, .1);\r\n\r\n //Technology management\r\n CompanyPositions.HeadOfSoftware.setPerformanceParameters(75, 0, 0, 0, 0, 25, 1.6);\r\n CompanyPositions.HeadOfSoftware.setExperienceGains(1, 0, 0, 0, 0, .5);\r\n CompanyPositions.HeadOfEngineering.setPerformanceParameters(75, 0, 0, 0, 0, 25, 1.6);\r\n CompanyPositions.HeadOfEngineering.setExperienceGains(1.1, 0, 0, 0, 0, .5);\r\n CompanyPositions.VicePresident.setPerformanceParameters(70, 0, 0, 0, 0, 30, 1.75);\r\n CompanyPositions.VicePresident.setExperienceGains(1.2, 0, 0, 0, 0, .6);\r\n CompanyPositions.CTO.setPerformanceParameters(65, 0, 0, 0, 0, 35, 2);\r\n CompanyPositions.CTO.setExperienceGains(1.5, 0, 0, 0, 0, 1);\r\n\r\n //Business\r\n CompanyPositions.BusinessIntern.setPerformanceParameters(10, 0, 0, 0, 0, 90, 0.9);\r\n CompanyPositions.BusinessIntern.setExperienceGains(.01, 0, 0, 0, 0, .08);\r\n CompanyPositions.BusinessAnalyst.setPerformanceParameters(15, 0, 0, 0, 0, 85, 1.1);\r\n CompanyPositions.BusinessAnalyst.setExperienceGains(.02, 0, 0, 0, 0, .15);\r\n CompanyPositions.BusinessManager.setPerformanceParameters(15, 0, 0, 0, 0, 85, 1.3);\r\n CompanyPositions.BusinessManager.setExperienceGains(.02, 0, 0, 0, 0, .3);\r\n CompanyPositions.OperationsManager.setPerformanceParameters(15, 0, 0, 0, 0, 85, 1.5);\r\n CompanyPositions.OperationsManager.setExperienceGains(.02, 0, 0, 0, 0, .4);\r\n CompanyPositions.CFO.setPerformanceParameters(10, 0, 0, 0, 0, 90, 1.6);\r\n CompanyPositions.CFO.setExperienceGains(.05, 0, 0, 0, 0, 1);\r\n CompanyPositions.CEO.setPerformanceParameters(10, 0, 0, 0, 0, 90, 1.75);\r\n CompanyPositions.CEO.setExperienceGains(.1, 0, 0, 0, 0, 1.5);\r\n\r\n CompanyPositions.BusinessConsultant.setPerformanceParameters(20, 0, 0, 0, 0, 80, 1);\r\n CompanyPositions.BusinessConsultant.setExperienceGains(.015, 0, 0, 0, 0, .15);\r\n CompanyPositions.SeniorBusinessConsultant.setPerformanceParameters(15, 0, 0, 0, 0, 85, 1.2);\r\n CompanyPositions.SeniorBusinessConsultant.setExperienceGains(.015, 0, 0, 0, 0, .3);\r\n\r\n //Non-tech/management jobs\r\n CompanyPositions.PartTimeWaiter.setPerformanceParameters(0, 10, 0, 10, 10, 70);\r\n CompanyPositions.PartTimeWaiter.setExperienceGains(0, .0075, .0075, .0075, .0075, .04);\r\n CompanyPositions.PartTimeEmployee.setPerformanceParameters(0, 10, 0, 10, 10, 70);\r\n CompanyPositions.PartTimeEmployee.setExperienceGains(0, .0075, .0075, .0075, .0075, .03);\r\n\r\n CompanyPositions.Waiter.setPerformanceParameters(0, 10, 0, 10, 10, 70);\r\n CompanyPositions.Waiter.setExperienceGains(0, .02, .02, .02, .02, .05);\r\n CompanyPositions.Employee.setPerformanceParameters(0, 10, 0, 10, 10, 70);\r\n CompanyPositions.Employee.setExperienceGains(0, .02, .02, .02, .02, .04);\r\n CompanyPositions.SecurityGuard.setPerformanceParameters(5, 20, 20, 20, 20, 15, 1);\r\n CompanyPositions.SecurityGuard.setExperienceGains(.01, .04, .04, .04, .04, .02);\r\n CompanyPositions.PoliceOfficer.setPerformanceParameters(5, 20, 20, 20, 20, 15, 1);\r\n CompanyPositions.PoliceOfficer.setExperienceGains(.02, .08, .08, .08, .08, .04);\r\n CompanyPositions.PoliceChief.setPerformanceParameters(5, 20, 20, 20, 20, 15, 1.25);\r\n CompanyPositions.PoliceChief.setExperienceGains(.02, .1, .1, .1, .1, .1);\r\n CompanyPositions.SecurityOfficer.setPerformanceParameters(10, 20, 20, 20, 20, 10, 1.1);\r\n CompanyPositions.SecurityOfficer.setExperienceGains(.02, .1, .1, .1, .1, .05);\r\n CompanyPositions.SecuritySupervisor.setPerformanceParameters(10, 15, 15, 15, 15, 30, 1.25);\r\n CompanyPositions.SecuritySupervisor.setExperienceGains(.02, .12, .12, .12, .12, .1);\r\n CompanyPositions.HeadOfSecurity.setPerformanceParameters(10, 15, 15, 15, 15, 30, 1.4);\r\n CompanyPositions.HeadOfSecurity.setExperienceGains(.05, .15, .15, .15, .15, .15);\r\n CompanyPositions.FieldAgent.setPerformanceParameters(10, 15, 15, 20, 20, 20, 1);\r\n CompanyPositions.FieldAgent.setExperienceGains(.04, .08, .08, .08, .08, .05);\r\n CompanyPositions.SecretAgent.setPerformanceParameters(15, 15, 15, 20, 20, 15, 1.25);\r\n CompanyPositions.SecretAgent.setExperienceGains(.1, .15, .15, .15, .15, .1);\r\n CompanyPositions.SpecialOperative.setPerformanceParameters(15, 15, 15, 20, 20, 15, 1.5);\r\n CompanyPositions.SpecialOperative.setExperienceGains(.15, .2, .2, .2, .2, .15);\r\n }\r\n}\r\n\r\n//Returns the next highest position in the company for the relevant career/field\r\n//I.E returns what your next job would be if you qualify for a promotion\r\nfunction getNextCompanyPosition(currPos) {\r\n if (currPos == null) {return null;}\r\n //Software\r\n if (currPos.positionName == CompanyPositions.SoftwareIntern.positionName) {\r\n return CompanyPositions.JuniorDev;\r\n }\r\n if (currPos.positionName == CompanyPositions.JuniorDev.positionName) {\r\n return CompanyPositions.SeniorDev;\r\n }\r\n if (currPos.positionName == CompanyPositions.SeniorDev.positionName) {\r\n return CompanyPositions.LeadDev;\r\n }\r\n if (currPos.positionName == CompanyPositions.LeadDev.positionName) {\r\n return CompanyPositions.HeadOfSoftware;\r\n }\r\n\r\n //Software Consultant\r\n if (currPos.positionName == CompanyPositions.SoftwareConsultant.positionName) {\r\n return CompanyPositions.SeniorSoftwareConsultant;\r\n }\r\n\r\n //IT\r\n if (currPos.positionName == CompanyPositions.ITIntern.positionName) {\r\n return CompanyPositions.ITAnalyst;\r\n }\r\n if (currPos.positionName == CompanyPositions.ITAnalyst.positionName) {\r\n return CompanyPositions.ITManager;\r\n }\r\n if (currPos.positionName == CompanyPositions.ITManager.positionName) {\r\n return CompanyPositions.SysAdmin;\r\n }\r\n if (currPos.positionName == CompanyPositions.SysAdmin.positionName) {\r\n return CompanyPositions.HeadOfEngineering;\r\n }\r\n\r\n //Security/Network Engineer\r\n if (currPos.positionName == CompanyPositions.SecurityEngineer.positionName) {\r\n return CompanyPositions.HeadOfEngineering;\r\n }\r\n if (currPos.positionName == CompanyPositions.NetworkEngineer.positionName) {\r\n return CompanyPositions.NetworkAdministrator;\r\n }\r\n if (currPos.positionName == CompanyPositions.NetworkAdministrator.positionName) {\r\n return CompanyPositions.HeadOfEngineering;\r\n }\r\n\r\n //Technology management\r\n if (currPos.positionName == CompanyPositions.HeadOfSoftware.positionName) {\r\n return CompanyPositions.HeadOfEngineering;\r\n }\r\n if (currPos.positionName == CompanyPositions.HeadOfEngineering.positionName) {\r\n return CompanyPositions.VicePresident;\r\n }\r\n if (currPos.positionName == CompanyPositions.VicePresident.positionName) {\r\n return CompanyPositions.CTO;\r\n }\r\n\r\n //Business\r\n if (currPos.positionName == CompanyPositions.BusinessIntern.positionName) {\r\n return CompanyPositions.BusinessAnalyst;\r\n }\r\n if (currPos.positionName == CompanyPositions.BusinessAnalyst.positionName) {\r\n return CompanyPositions.BusinessManager;\r\n }\r\n if (currPos.positionName == CompanyPositions.BusinessManager.positionName) {\r\n return CompanyPositions.OperationsManager;\r\n }\r\n if (currPos.positionName == CompanyPositions.OperationsManager.positionName) {\r\n return CompanyPositions.CFO;\r\n }\r\n if (currPos.positionName == CompanyPositions.CFO.positionName) {\r\n return CompanyPositions.CEO;\r\n }\r\n\r\n //Business consultant\r\n if (currPos.positionName == CompanyPositions.BusinessConsultant.positionName) {\r\n return CompanyPositions.SeniorBusinessConsultant;\r\n }\r\n\r\n //Police\r\n if (currPos.positionName == CompanyPositions.PoliceOfficer.positionName) {\r\n return CompanyPositions.PoliceChief;\r\n }\r\n\r\n //Security\r\n if (currPos.positionName == CompanyPositions.SecurityGuard.positionName) {\r\n return CompanyPositions.SecurityOfficer;\r\n }\r\n if (currPos.positionName == CompanyPositions.SecurityOfficer.positionName) {\r\n return CompanyPositions.SecuritySupervisor;\r\n }\r\n if (currPos.positionName == CompanyPositions.SecuritySupervisor.positionName) {\r\n return CompanyPositions.HeadOfSecurity;\r\n }\r\n\r\n //Agent\r\n if (currPos.positionName == CompanyPositions.FieldAgent.positionName) {\r\n return CompanyPositions.SecretAgent;\r\n }\r\n if (currPos.positionName == CompanyPositions.SecretAgent.positionName) {\r\n return CompanyPositions.SpecialOperative;\r\n }\r\n\r\n return null;\r\n}\r\n\r\n/* Initialize all companies. Only called when creating new game/prestiging. Otherwise companies are\r\n * usually loaded from localStorage */\r\nfunction initCompanies() {\r\n /* Companies that also have servers */\r\n //Megacorporations\r\n var ECorp = new Company(Locations.AevumECorp, 3.0, 3.0, 249);\r\n ECorp.addPositions([\r\n CompanyPositions.SoftwareIntern, CompanyPositions.ITIntern, CompanyPositions.BusinessIntern,\r\n CompanyPositions.JuniorDev, CompanyPositions.SeniorDev, CompanyPositions.LeadDev,\r\n CompanyPositions.ITAnalyst, CompanyPositions.ITManager, CompanyPositions.SysAdmin,\r\n CompanyPositions.SecurityEngineer, CompanyPositions.NetworkEngineer, CompanyPositions.NetworkAdministrator,\r\n CompanyPositions.HeadOfSoftware, CompanyPositions.HeadOfEngineering,\r\n CompanyPositions.VicePresident, CompanyPositions.CTO, CompanyPositions.BusinessAnalyst,\r\n CompanyPositions.BusinessManager, CompanyPositions.OperationsManager, CompanyPositions.CFO,\r\n CompanyPositions.CEO, CompanyPositions.SecurityGuard, CompanyPositions.SecurityOfficer,\r\n CompanyPositions.SecuritySupervisor, CompanyPositions.HeadOfSecurity]);\r\n if (companyExists(Locations.AevumECorp)) {\r\n ECorp.favor = Companies[Locations.AevumECorp].favor;\r\n delete Companies[Locations.AevumECorp];\r\n }\r\n AddToCompanies(ECorp);\r\n\r\n var MegaCorp = new Company(Locations.Sector12MegaCorp, 3.0, 3.0, 249);\r\n MegaCorp.addPositions([\r\n CompanyPositions.SoftwareIntern, CompanyPositions.ITIntern, CompanyPositions.BusinessIntern,\r\n CompanyPositions.JuniorDev, CompanyPositions.SeniorDev, CompanyPositions.LeadDev,\r\n CompanyPositions.ITAnalyst, CompanyPositions.ITManager, CompanyPositions.SysAdmin,\r\n CompanyPositions.SecurityEngineer, CompanyPositions.NetworkEngineer, CompanyPositions.NetworkAdministrator,\r\n CompanyPositions.HeadOfSoftware, CompanyPositions.HeadOfEngineering,\r\n CompanyPositions.VicePresident, CompanyPositions.CTO, CompanyPositions.BusinessAnalyst,\r\n CompanyPositions.BusinessManager, CompanyPositions.OperationsManager, CompanyPositions.CFO,\r\n CompanyPositions.CEO, CompanyPositions.SecurityGuard, CompanyPositions.SecurityOfficer,\r\n CompanyPositions.SecuritySupervisor, CompanyPositions.HeadOfSecurity]);\r\n if (companyExists(Locations.Sector12MegaCorp)) {\r\n MegaCorp.favor = Companies[Locations.Sector12MegaCorp].favor;\r\n delete Companies[Locations.Sector12MegaCorp];\r\n }\r\n AddToCompanies(MegaCorp);\r\n\r\n var BachmanAndAssociates = new Company(Locations.AevumBachmanAndAssociates, 2.6, 2.6, 224);\r\n BachmanAndAssociates.addPositions([\r\n CompanyPositions.SoftwareIntern, CompanyPositions.ITIntern, CompanyPositions.BusinessIntern,\r\n CompanyPositions.JuniorDev, CompanyPositions.SeniorDev, CompanyPositions.LeadDev,\r\n CompanyPositions.ITAnalyst, CompanyPositions.ITManager, CompanyPositions.SysAdmin,\r\n CompanyPositions.SecurityEngineer, CompanyPositions.NetworkEngineer, CompanyPositions.NetworkAdministrator,\r\n CompanyPositions.HeadOfSoftware, CompanyPositions.HeadOfEngineering,\r\n CompanyPositions.VicePresident, CompanyPositions.CTO, CompanyPositions.BusinessAnalyst,\r\n CompanyPositions.BusinessManager, CompanyPositions.OperationsManager, CompanyPositions.CFO,\r\n CompanyPositions.CEO, CompanyPositions.SecurityGuard, CompanyPositions.SecurityOfficer,\r\n CompanyPositions.SecuritySupervisor, CompanyPositions.HeadOfSecurity]);\r\n if (companyExists(Locations.AevumBachmanAndAssociates)) {\r\n BachmanAndAssociates.favor = Companies[Locations.AevumBachmanAndAssociates].favor;\r\n delete Companies[Locations.AevumBachmanAndAssociates];\r\n }\r\n AddToCompanies(BachmanAndAssociates);\r\n\r\n var BladeIndustries = new Company(Locations.Sector12BladeIndustries, 2.75, 2.75, 224);\r\n BladeIndustries.addPositions([\r\n CompanyPositions.SoftwareIntern, CompanyPositions.ITIntern, CompanyPositions.BusinessIntern,\r\n CompanyPositions.JuniorDev, CompanyPositions.SeniorDev, CompanyPositions.LeadDev,\r\n CompanyPositions.ITAnalyst, CompanyPositions.ITManager, CompanyPositions.SysAdmin,\r\n CompanyPositions.SecurityEngineer, CompanyPositions.NetworkEngineer, CompanyPositions.NetworkAdministrator,\r\n CompanyPositions.HeadOfSoftware, CompanyPositions.HeadOfEngineering,\r\n CompanyPositions.VicePresident, CompanyPositions.CTO, CompanyPositions.BusinessAnalyst,\r\n CompanyPositions.BusinessManager, CompanyPositions.OperationsManager, CompanyPositions.CFO,\r\n CompanyPositions.CEO, CompanyPositions.SecurityGuard, CompanyPositions.SecurityOfficer,\r\n CompanyPositions.SecuritySupervisor, CompanyPositions.HeadOfSecurity]);\r\n if (companyExists(Locations.Sector12BladeIndustries)) {\r\n BladeIndustries.favor = Companies[Locations.Sector12BladeIndustries].favor;\r\n delete Companies[Locations.Sector12BladeIndustries];\r\n }\r\n AddToCompanies(BladeIndustries);\r\n\r\n var NWO = new Company(Locations.VolhavenNWO, 2.75, 2.75, 249);\r\n NWO.addPositions([\r\n CompanyPositions.SoftwareIntern, CompanyPositions.ITIntern, CompanyPositions.BusinessIntern,\r\n CompanyPositions.JuniorDev, CompanyPositions.SeniorDev, CompanyPositions.LeadDev,\r\n CompanyPositions.ITAnalyst, CompanyPositions.ITManager, CompanyPositions.SysAdmin,\r\n CompanyPositions.SecurityEngineer, CompanyPositions.NetworkEngineer, CompanyPositions.NetworkAdministrator,\r\n CompanyPositions.HeadOfSoftware, CompanyPositions.HeadOfEngineering,\r\n CompanyPositions.VicePresident, CompanyPositions.CTO, CompanyPositions.BusinessAnalyst,\r\n CompanyPositions.BusinessManager, CompanyPositions.OperationsManager, CompanyPositions.CFO,\r\n CompanyPositions.CEO, CompanyPositions.SecurityGuard, CompanyPositions.SecurityOfficer,\r\n CompanyPositions.SecuritySupervisor, CompanyPositions.HeadOfSecurity]);\r\n if (companyExists(Locations.VolhavenNWO)) {\r\n NWO.favor = Companies[Locations.VolhavenNWO].favor;\r\n delete Companies[Locations.VolhavenNWO];\r\n }\r\n AddToCompanies(NWO);\r\n\r\n var ClarkeIncorporated = new Company(Locations.AevumClarkeIncorporated, 2.25, 2.25, 224);\r\n ClarkeIncorporated.addPositions([\r\n CompanyPositions.SoftwareIntern, CompanyPositions.ITIntern, CompanyPositions.BusinessIntern,\r\n CompanyPositions.JuniorDev, CompanyPositions.SeniorDev, CompanyPositions.LeadDev,\r\n CompanyPositions.ITAnalyst, CompanyPositions.ITManager, CompanyPositions.SysAdmin,\r\n CompanyPositions.SecurityEngineer, CompanyPositions.NetworkEngineer, CompanyPositions.NetworkAdministrator,\r\n CompanyPositions.HeadOfSoftware, CompanyPositions.HeadOfEngineering,\r\n CompanyPositions.VicePresident, CompanyPositions.CTO, CompanyPositions.BusinessAnalyst,\r\n CompanyPositions.BusinessManager, CompanyPositions.OperationsManager, CompanyPositions.CFO,\r\n CompanyPositions.CEO, CompanyPositions.SecurityGuard, CompanyPositions.SecurityOfficer,\r\n CompanyPositions.SecuritySupervisor, CompanyPositions.HeadOfSecurity]);\r\n if (companyExists(Locations.AevumClarkeIncorporated)) {\r\n ClarkeIncorporated.favor = Companies[Locations.AevumClarkeIncorporated].favor;\r\n delete Companies[Locations.AevumClarkeIncorporated];\r\n }\r\n AddToCompanies(ClarkeIncorporated);\r\n\r\n var OmniTekIncorporated = new Company(Locations.VolhavenOmniTekIncorporated, 2.25, 2.25, 224);\r\n OmniTekIncorporated.addPositions([\r\n CompanyPositions.SoftwareIntern, CompanyPositions.ITIntern, CompanyPositions.BusinessIntern,\r\n CompanyPositions.JuniorDev, CompanyPositions.SeniorDev, CompanyPositions.LeadDev,\r\n CompanyPositions.ITAnalyst, CompanyPositions.ITManager, CompanyPositions.SysAdmin,\r\n CompanyPositions.SecurityEngineer, CompanyPositions.NetworkEngineer, CompanyPositions.NetworkAdministrator,\r\n CompanyPositions.HeadOfSoftware, CompanyPositions.HeadOfEngineering,\r\n CompanyPositions.VicePresident, CompanyPositions.CTO, CompanyPositions.BusinessAnalyst,\r\n CompanyPositions.BusinessManager, CompanyPositions.OperationsManager, CompanyPositions.CFO,\r\n CompanyPositions.CEO, CompanyPositions.SecurityGuard, CompanyPositions.SecurityOfficer,\r\n CompanyPositions.SecuritySupervisor, CompanyPositions.HeadOfSecurity]);\r\n if (companyExists(Locations.VolhavenOmniTekIncorporated)) {\r\n OmniTekIncorporated.favor = Companies[Locations.VolhavenOmniTekIncorporated].favor;\r\n delete Companies[Locations.VolhavenOmniTekIncorporated];\r\n }\r\n AddToCompanies(OmniTekIncorporated);\r\n\r\n var FourSigma = new Company(Locations.Sector12FourSigma, 2.5, 2.5, 224);\r\n FourSigma.addPositions([\r\n CompanyPositions.SoftwareIntern, CompanyPositions.ITIntern, CompanyPositions.BusinessIntern,\r\n CompanyPositions.JuniorDev, CompanyPositions.SeniorDev, CompanyPositions.LeadDev,\r\n CompanyPositions.ITAnalyst, CompanyPositions.ITManager, CompanyPositions.SysAdmin,\r\n CompanyPositions.SecurityEngineer, CompanyPositions.NetworkEngineer, CompanyPositions.NetworkAdministrator,\r\n CompanyPositions.HeadOfSoftware, CompanyPositions.HeadOfEngineering,\r\n CompanyPositions.VicePresident, CompanyPositions.CTO, CompanyPositions.BusinessAnalyst,\r\n CompanyPositions.BusinessManager, CompanyPositions.OperationsManager, CompanyPositions.CFO,\r\n CompanyPositions.CEO, CompanyPositions.SecurityGuard, CompanyPositions.SecurityOfficer,\r\n CompanyPositions.SecuritySupervisor, CompanyPositions.HeadOfSecurity]);\r\n if (companyExists(Locations.Sector12FourSigma)) {\r\n FourSigma.favor = Companies[Locations.Sector12FourSigma].favor;\r\n delete Companies[Locations.Sector12FourSigma];\r\n }\r\n AddToCompanies(FourSigma);\r\n\r\n var KuaiGongInternational = new Company(Locations.ChongqingKuaiGongInternational, 2.2, 2.2, 224);\r\n KuaiGongInternational.addPositions([\r\n CompanyPositions.SoftwareIntern, CompanyPositions.ITIntern, CompanyPositions.BusinessIntern,\r\n CompanyPositions.JuniorDev, CompanyPositions.SeniorDev, CompanyPositions.LeadDev,\r\n CompanyPositions.ITAnalyst, CompanyPositions.ITManager, CompanyPositions.SysAdmin,\r\n CompanyPositions.SecurityEngineer, CompanyPositions.NetworkEngineer, CompanyPositions.NetworkAdministrator,\r\n CompanyPositions.HeadOfSoftware, CompanyPositions.HeadOfEngineering,\r\n CompanyPositions.VicePresident, CompanyPositions.CTO, CompanyPositions.BusinessAnalyst,\r\n CompanyPositions.BusinessManager, CompanyPositions.OperationsManager, CompanyPositions.CFO,\r\n CompanyPositions.CEO, CompanyPositions.SecurityGuard, CompanyPositions.SecurityOfficer,\r\n CompanyPositions.SecuritySupervisor, CompanyPositions.HeadOfSecurity]);\r\n if (companyExists(Locations.ChongqingKuaiGongInternational)) {\r\n KuaiGongInternational.favor = Companies[Locations.ChongqingKuaiGongInternational].favor;\r\n delete Companies[Locations.ChongqingKuaiGongInternational];\r\n }\r\n AddToCompanies(KuaiGongInternational);\r\n\r\n //Technology and communication companies (\"Large\" servers)\r\n var FulcrumTechnologies = new Company(Locations.AevumFulcrumTechnologies, 2.0, 2.0, 224);\r\n FulcrumTechnologies.addPositions([\r\n CompanyPositions.SoftwareIntern, CompanyPositions.ITIntern, CompanyPositions.BusinessIntern,\r\n CompanyPositions.JuniorDev, CompanyPositions.SeniorDev, CompanyPositions.LeadDev,\r\n CompanyPositions.ITAnalyst, CompanyPositions.ITManager, CompanyPositions.SysAdmin,\r\n CompanyPositions.SecurityEngineer, CompanyPositions.NetworkEngineer, CompanyPositions.NetworkAdministrator,\r\n CompanyPositions.HeadOfSoftware, CompanyPositions.HeadOfEngineering,\r\n CompanyPositions.VicePresident, CompanyPositions.CTO, CompanyPositions.BusinessAnalyst,\r\n CompanyPositions.BusinessManager, CompanyPositions.OperationsManager, CompanyPositions.CFO,\r\n CompanyPositions.CEO]);\r\n if (companyExists(Locations.AevumFulcrumTechnologies)) {\r\n FulcrumTechnologies.favor = Companies[Locations.AevumFulcrumTechnologies].favor;\r\n delete Companies[Locations.AevumFulcrumTechnologies];\r\n }\r\n AddToCompanies(FulcrumTechnologies);\r\n\r\n var StormTechnologies = new Company(Locations.IshimaStormTechnologies, 1.8, 1.8, 199);\r\n StormTechnologies.addPositions([\r\n CompanyPositions.SoftwareIntern,\r\n CompanyPositions.JuniorDev, CompanyPositions.SeniorDev, CompanyPositions.LeadDev,\r\n CompanyPositions.SoftwareConsultant, CompanyPositions.SeniorSoftwareConsultant,\r\n CompanyPositions.ITAnalyst, CompanyPositions.ITManager, CompanyPositions.SysAdmin,\r\n CompanyPositions.SecurityEngineer, CompanyPositions.NetworkEngineer, CompanyPositions.NetworkAdministrator,\r\n CompanyPositions.HeadOfSoftware, CompanyPositions.HeadOfEngineering,\r\n CompanyPositions.VicePresident, CompanyPositions.CTO,\r\n CompanyPositions.BusinessIntern, CompanyPositions.BusinessAnalyst,\r\n CompanyPositions.BusinessManager, CompanyPositions.OperationsManager, CompanyPositions.CFO,\r\n CompanyPositions.CEO]);\r\n if (companyExists(Locations.IshimaStormTechnologies)) {\r\n StormTechnologies.favor = Companies[Locations.IshimaStormTechnologies].favor;\r\n delete Companies[Locations.IshimaStormTechnologies];\r\n }\r\n AddToCompanies(StormTechnologies);\r\n\r\n var DefComm = new Company(Locations.NewTokyoDefComm, 1.75, 1.75, 199);\r\n DefComm.addPositions([\r\n CompanyPositions.SoftwareIntern, CompanyPositions.JuniorDev, CompanyPositions.SeniorDev,\r\n CompanyPositions.LeadDev, CompanyPositions.SoftwareConsultant, CompanyPositions.SeniorSoftwareConsultant,\r\n CompanyPositions.ITIntern, CompanyPositions.ITAnalyst,\r\n CompanyPositions.ITManager, CompanyPositions.SysAdmin, CompanyPositions.SecurityEngineer,\r\n CompanyPositions.NetworkEngineer, CompanyPositions.NetworkAdministrator, CompanyPositions.HeadOfSoftware,\r\n CompanyPositions.HeadOfEngineering, CompanyPositions.CTO, CompanyPositions.CEO]);\r\n if (companyExists(Locations.NewTokyoDefComm)) {\r\n DefComm.favor = Companies[Locations.NewTokyoDefComm].favor;\r\n delete Companies[Locations.NewTokyoDefComm];\r\n }\r\n AddToCompanies(DefComm);\r\n\r\n var HeliosLabs = new Company(Locations.VolhavenHeliosLabs, 1.8, 1.8, 199);\r\n HeliosLabs.addPositions([\r\n CompanyPositions.SoftwareIntern, CompanyPositions.JuniorDev, CompanyPositions.SeniorDev,\r\n CompanyPositions.LeadDev, CompanyPositions.SoftwareConsultant, CompanyPositions.SeniorSoftwareConsultant,\r\n CompanyPositions.ITIntern, CompanyPositions.ITAnalyst,\r\n CompanyPositions.ITManager, CompanyPositions.SysAdmin, CompanyPositions.SecurityEngineer,\r\n CompanyPositions.NetworkEngineer, CompanyPositions.NetworkAdministrator, CompanyPositions.HeadOfSoftware,\r\n CompanyPositions.HeadOfEngineering, CompanyPositions.CTO, CompanyPositions.CEO]);\r\n if (companyExists(Locations.VolhavenHeliosLabs)) {\r\n HeliosLabs.favor = Companies[Locations.VolhavenHeliosLabs].favor;\r\n delete Companies[Locations.VolhavenHeliosLabs];\r\n }\r\n AddToCompanies(HeliosLabs);\r\n\r\n var VitaLife = new Company(Locations.NewTokyoVitaLife, 1.8, 1.8, 199);\r\n VitaLife.addPositions([\r\n CompanyPositions.SoftwareIntern, CompanyPositions.JuniorDev, CompanyPositions.SeniorDev,\r\n CompanyPositions.LeadDev, CompanyPositions.SoftwareConsultant, CompanyPositions.SeniorSoftwareConsultant,\r\n CompanyPositions.ITIntern, CompanyPositions.ITAnalyst,\r\n CompanyPositions.ITManager, CompanyPositions.SysAdmin, CompanyPositions.SecurityEngineer,\r\n CompanyPositions.NetworkEngineer, CompanyPositions.NetworkAdministrator, CompanyPositions.HeadOfSoftware,\r\n CompanyPositions.HeadOfEngineering, CompanyPositions.CTO,\r\n CompanyPositions.BusinessIntern, CompanyPositions.BusinessAnalyst, CompanyPositions.BusinessManager,\r\n CompanyPositions.OperationsManager, CompanyPositions.CFO, CompanyPositions.CEO]);\r\n if (companyExists(Locations.NewTokyoVitaLife)) {\r\n VitaLife.favor = Companies[Locations.NewTokyoVitaLife].favor;\r\n delete Companies[Locations.NewTokyoVitaLife];\r\n }\r\n AddToCompanies(VitaLife);\r\n\r\n var IcarusMicrosystems = new Company(Locations.Sector12IcarusMicrosystems, 1.9, 1.9, 199);\r\n IcarusMicrosystems.addPositions([\r\n CompanyPositions.SoftwareIntern, CompanyPositions.JuniorDev, CompanyPositions.SeniorDev,\r\n CompanyPositions.LeadDev, CompanyPositions.SoftwareConsultant, CompanyPositions.SeniorSoftwareConsultant,\r\n CompanyPositions.ITIntern, CompanyPositions.ITAnalyst,\r\n CompanyPositions.ITManager, CompanyPositions.SysAdmin, CompanyPositions.SecurityEngineer,\r\n CompanyPositions.NetworkEngineer, CompanyPositions.NetworkAdministrator, CompanyPositions.HeadOfSoftware,\r\n CompanyPositions.HeadOfEngineering, CompanyPositions.CTO,\r\n CompanyPositions.BusinessIntern, CompanyPositions.BusinessAnalyst, CompanyPositions.BusinessManager,\r\n CompanyPositions.OperationsManager, CompanyPositions.CFO, CompanyPositions.CEO]);\r\n if (companyExists(Locations.Sector12IcarusMicrosystems)) {\r\n IcarusMicrosystems.favor = Companies[Locations.Sector12IcarusMicrosystems].favor;\r\n delete Companies[Locations.Sector12IcarusMicrosystems];\r\n }\r\n AddToCompanies(IcarusMicrosystems);\r\n\r\n var UniversalEnergy = new Company(Locations.Sector12UniversalEnergy, 2.0, 2.0, 199);\r\n UniversalEnergy.addPositions([\r\n CompanyPositions.SoftwareIntern, CompanyPositions.JuniorDev, CompanyPositions.SeniorDev,\r\n CompanyPositions.LeadDev, CompanyPositions.SoftwareConsultant, CompanyPositions.SeniorSoftwareConsultant,\r\n CompanyPositions.ITIntern, CompanyPositions.ITAnalyst,\r\n CompanyPositions.ITManager, CompanyPositions.SysAdmin, CompanyPositions.SecurityEngineer,\r\n CompanyPositions.NetworkEngineer, CompanyPositions.NetworkAdministrator, CompanyPositions.HeadOfSoftware,\r\n CompanyPositions.HeadOfEngineering, CompanyPositions.CTO,\r\n CompanyPositions.BusinessIntern, CompanyPositions.BusinessAnalyst, CompanyPositions.BusinessManager,\r\n CompanyPositions.OperationsManager, CompanyPositions.CFO, CompanyPositions.CEO]);\r\n if (companyExists(Locations.Sector12UniversalEnergy)) {\r\n UniversalEnergy.favor = Companies[Locations.Sector12UniversalEnergy].favor;\r\n delete Companies[Locations.Sector12UniversalEnergy];\r\n }\r\n AddToCompanies(UniversalEnergy);\r\n\r\n var GalacticCybersystems = new Company(Locations.AevumGalacticCybersystems, 1.9, 1.9, 199);\r\n GalacticCybersystems.addPositions([\r\n CompanyPositions.SoftwareIntern, CompanyPositions.JuniorDev, CompanyPositions.SeniorDev,\r\n CompanyPositions.LeadDev, CompanyPositions.SoftwareConsultant, CompanyPositions.SeniorSoftwareConsultant,\r\n CompanyPositions.ITIntern, CompanyPositions.ITAnalyst,\r\n CompanyPositions.ITManager, CompanyPositions.SysAdmin, CompanyPositions.SecurityEngineer,\r\n CompanyPositions.NetworkEngineer, CompanyPositions.NetworkAdministrator, CompanyPositions.HeadOfSoftware,\r\n CompanyPositions.HeadOfEngineering, CompanyPositions.CTO,\r\n CompanyPositions.BusinessIntern, CompanyPositions.BusinessAnalyst, CompanyPositions.BusinessManager,\r\n CompanyPositions.OperationsManager, CompanyPositions.CFO, CompanyPositions.CEO]);\r\n if (companyExists(Locations.AevumGalacticCybersystems)) {\r\n GalacticCybersystems.favor = Companies[Locations.AevumGalacticCybersystems].favor;\r\n delete Companies[Locations.AevumGalacticCybersystems];\r\n }\r\n AddToCompanies(GalacticCybersystems);\r\n\r\n //Defense Companies (\"Large\" Companies)\r\n var AeroCorp = new Company(Locations.AevumAeroCorp, 1.7, 1.7, 199);\r\n AeroCorp.addPositions([\r\n CompanyPositions.SoftwareIntern, CompanyPositions.JuniorDev, CompanyPositions.SeniorDev,\r\n CompanyPositions.LeadDev, CompanyPositions.ITIntern, CompanyPositions.ITAnalyst,\r\n CompanyPositions.ITManager, CompanyPositions.SysAdmin, CompanyPositions.SecurityEngineer,\r\n CompanyPositions.NetworkEngineer, CompanyPositions.NetworkAdministrator, CompanyPositions.HeadOfSoftware,\r\n CompanyPositions.HeadOfEngineering, CompanyPositions.CTO,\r\n CompanyPositions.OperationsManager, CompanyPositions.CEO,\r\n CompanyPositions.SecurityGuard, CompanyPositions.SecurityOfficer, CompanyPositions.SecuritySupervisor,\r\n CompanyPositions.HeadOfSecurity]);\r\n if (companyExists(Locations.AevumAeroCorp)) {\r\n AeroCorp.favor = Companies[Locations.AevumAeroCorp].favor;\r\n delete Companies[Locations.AevumAeroCorp];\r\n }\r\n AddToCompanies(AeroCorp);\r\n\r\n var OmniaCybersystems = new Company(Locations.VolhavenOmniaCybersystems, 1.7, 1.7, 199);\r\n OmniaCybersystems.addPositions([\r\n CompanyPositions.SoftwareIntern, CompanyPositions.JuniorDev, CompanyPositions.SeniorDev,\r\n CompanyPositions.LeadDev, CompanyPositions.ITIntern, CompanyPositions.ITAnalyst,\r\n CompanyPositions.ITManager, CompanyPositions.SysAdmin, CompanyPositions.SecurityEngineer,\r\n CompanyPositions.NetworkEngineer, CompanyPositions.NetworkAdministrator, CompanyPositions.HeadOfSoftware,\r\n CompanyPositions.HeadOfEngineering, CompanyPositions.CTO,\r\n CompanyPositions.OperationsManager, CompanyPositions.CEO,\r\n CompanyPositions.SecurityGuard, CompanyPositions.SecurityOfficer, CompanyPositions.SecuritySupervisor,\r\n CompanyPositions.HeadOfSecurity]);\r\n if (companyExists(Locations.VolhavenOmniaCybersystems)) {\r\n OmniaCybersystems.favor = Companies[Locations.VolhavenOmniaCybersystems].favor;\r\n delete Companies[Locations.VolhavenOmniaCybersystems];\r\n }\r\n AddToCompanies(OmniaCybersystems);\r\n\r\n var SolarisSpaceSystems = new Company(Locations.ChongqingSolarisSpaceSystems, 1.7, 1.7, 199);\r\n SolarisSpaceSystems.addPositions([\r\n CompanyPositions.SoftwareIntern, CompanyPositions.JuniorDev, CompanyPositions.SeniorDev,\r\n CompanyPositions.LeadDev, CompanyPositions.ITIntern, CompanyPositions.ITAnalyst,\r\n CompanyPositions.ITManager, CompanyPositions.SysAdmin, CompanyPositions.SecurityEngineer,\r\n CompanyPositions.NetworkEngineer, CompanyPositions.NetworkAdministrator, CompanyPositions.HeadOfSoftware,\r\n CompanyPositions.HeadOfEngineering, CompanyPositions.CTO,\r\n CompanyPositions.OperationsManager, CompanyPositions.CEO,\r\n CompanyPositions.SecurityGuard, CompanyPositions.SecurityOfficer, CompanyPositions.SecuritySupervisor,\r\n CompanyPositions.HeadOfSecurity]);\r\n if (companyExists(Locations.ChongqingSolarisSpaceSystems)) {\r\n SolarisSpaceSystems.favor = Companies[Locations.ChongqingSolarisSpaceSystems].favor;\r\n delete Companies[Locations.ChongqingSolarisSpaceSystems];\r\n }\r\n AddToCompanies(SolarisSpaceSystems);\r\n\r\n var DeltaOne = new Company(Locations.Sector12DeltaOne, 1.6, 1.6, 199);\r\n DeltaOne.addPositions([\r\n CompanyPositions.SoftwareIntern, CompanyPositions.JuniorDev, CompanyPositions.SeniorDev,\r\n CompanyPositions.LeadDev, CompanyPositions.ITIntern, CompanyPositions.ITAnalyst,\r\n CompanyPositions.ITManager, CompanyPositions.SysAdmin, CompanyPositions.SecurityEngineer,\r\n CompanyPositions.NetworkEngineer, CompanyPositions.NetworkAdministrator, CompanyPositions.HeadOfSoftware,\r\n CompanyPositions.HeadOfEngineering, CompanyPositions.CTO,\r\n CompanyPositions.OperationsManager, CompanyPositions.CEO,\r\n CompanyPositions.SecurityGuard, CompanyPositions.SecurityOfficer, CompanyPositions.SecuritySupervisor,\r\n CompanyPositions.HeadOfSecurity]);\r\n if (companyExists(Locations.Sector12DeltaOne)) {\r\n DeltaOne.favor = Companies[Locations.Sector12DeltaOne].favor;\r\n delete Companies[Locations.Sector12DeltaOne];\r\n }\r\n AddToCompanies(DeltaOne);\r\n\r\n //Health, medicine, pharmaceutical companies (\"Large\" servers)\r\n var GlobalPharmaceuticals = new Company(Locations.NewTokyoGlobalPharmaceuticals, 1.8, 1.8, 224);\r\n GlobalPharmaceuticals.addPositions([\r\n CompanyPositions.SoftwareIntern, CompanyPositions.ITIntern, CompanyPositions.BusinessIntern,\r\n CompanyPositions.JuniorDev, CompanyPositions.SeniorDev, CompanyPositions.LeadDev,\r\n CompanyPositions.SoftwareConsultant, CompanyPositions.SeniorSoftwareConsultant,\r\n CompanyPositions.ITAnalyst, CompanyPositions.ITManager, CompanyPositions.SecurityEngineer,\r\n CompanyPositions.NetworkEngineer, CompanyPositions.NetworkAdministrator,\r\n CompanyPositions.HeadOfSoftware, CompanyPositions.CTO, CompanyPositions.BusinessAnalyst,\r\n CompanyPositions.BusinessManager, CompanyPositions.OperationsManager,\r\n CompanyPositions.CFO, CompanyPositions.CEO, CompanyPositions.SecurityGuard,\r\n CompanyPositions.SecuritySupervisor, CompanyPositions.HeadOfSecurity]);\r\n if (companyExists(Locations.NewTokyoGlobalPharmaceuticals)) {\r\n GlobalPharmaceuticals.favor = Companies[Locations.NewTokyoGlobalPharmaceuticals].favor;\r\n delete Companies[Locations.NewTokyoGlobalPharmaceuticals];\r\n }\r\n AddToCompanies(GlobalPharmaceuticals);\r\n\r\n var NovaMedical = new Company(Locations.IshimaNovaMedical, 1.75, 1.75, 199);\r\n NovaMedical.addPositions([\r\n CompanyPositions.SoftwareIntern, CompanyPositions.ITIntern, CompanyPositions.BusinessIntern,\r\n CompanyPositions.JuniorDev, CompanyPositions.SeniorDev, CompanyPositions.LeadDev,\r\n CompanyPositions.SoftwareConsultant, CompanyPositions.SeniorSoftwareConsultant,\r\n CompanyPositions.ITAnalyst, CompanyPositions.ITManager, CompanyPositions.SecurityEngineer,\r\n CompanyPositions.NetworkEngineer, CompanyPositions.NetworkAdministrator,\r\n CompanyPositions.HeadOfSoftware, CompanyPositions.CTO, CompanyPositions.BusinessAnalyst,\r\n CompanyPositions.BusinessManager, CompanyPositions.OperationsManager,\r\n CompanyPositions.CFO, CompanyPositions.CEO, CompanyPositions.SecurityGuard,\r\n CompanyPositions.SecuritySupervisor, CompanyPositions.HeadOfSecurity]);\r\n if (companyExists(Locations.IshimaNovaMedical)) {\r\n NovaMedical.favor = Companies[Locations.IshimaNovaMedical].favor;\r\n delete Companies[Locations.IshimaNovaMedical];\r\n }\r\n AddToCompanies(NovaMedical);\r\n\r\n //Other large companies\r\n var CIA = new Company(Locations.Sector12CIA, 2.0, 2.0, 149);\r\n CIA.addPositions([\r\n CompanyPositions.SoftwareIntern, CompanyPositions.JuniorDev, CompanyPositions.SeniorDev,\r\n CompanyPositions.LeadDev, CompanyPositions.ITIntern, CompanyPositions.ITAnalyst,\r\n CompanyPositions.ITManager, CompanyPositions.SysAdmin, CompanyPositions.SecurityEngineer,\r\n CompanyPositions.NetworkEngineer, CompanyPositions.NetworkAdministrator, CompanyPositions.HeadOfSoftware,\r\n CompanyPositions.HeadOfEngineering, CompanyPositions.SecurityGuard, CompanyPositions.SecurityOfficer,\r\n CompanyPositions.SecuritySupervisor, CompanyPositions.HeadOfSecurity, CompanyPositions.FieldAgent,\r\n CompanyPositions.SecretAgent, CompanyPositions.SpecialOperative]);\r\n if (companyExists(Locations.Sector12CIA)) {\r\n CIA.favor = Companies[Locations.Sector12CIA].favor;\r\n delete Companies[Locations.Sector12CIA];\r\n }\r\n AddToCompanies(CIA);\r\n\r\n var NSA = new Company(Locations.Sector12NSA, 2.0, 2.0, 149);\r\n NSA.addPositions([\r\n CompanyPositions.SoftwareIntern, CompanyPositions.JuniorDev, CompanyPositions.SeniorDev,\r\n CompanyPositions.LeadDev, CompanyPositions.ITIntern, CompanyPositions.ITAnalyst,\r\n CompanyPositions.ITManager, CompanyPositions.SysAdmin, CompanyPositions.SecurityEngineer,\r\n CompanyPositions.NetworkEngineer, CompanyPositions.NetworkAdministrator, CompanyPositions.HeadOfSoftware,\r\n CompanyPositions.HeadOfEngineering, CompanyPositions.SecurityGuard, CompanyPositions.SecurityOfficer,\r\n CompanyPositions.SecuritySupervisor, CompanyPositions.HeadOfSecurity, CompanyPositions.FieldAgent,\r\n CompanyPositions.SecretAgent, CompanyPositions.SpecialOperative]);\r\n if (companyExists(Locations.Sector12NSA)) {\r\n NSA.favor = Companies[Locations.Sector12NSA].favor;\r\n delete Companies[Locations.Sector12NSA];\r\n }\r\n AddToCompanies(NSA);\r\n\r\n var WatchdogSecurity = new Company(Locations.AevumWatchdogSecurity, 1.5, 1.5, 124);\r\n WatchdogSecurity.addPositions([\r\n CompanyPositions.SoftwareIntern, CompanyPositions.JuniorDev, CompanyPositions.SeniorDev,\r\n CompanyPositions.LeadDev, CompanyPositions.SoftwareConsultant, CompanyPositions.SeniorSoftwareConsultant,\r\n CompanyPositions.ITIntern, CompanyPositions.ITAnalyst,\r\n CompanyPositions.ITManager, CompanyPositions.SysAdmin, CompanyPositions.SecurityEngineer,\r\n CompanyPositions.NetworkEngineer, CompanyPositions.NetworkAdministrator, CompanyPositions.HeadOfSoftware,\r\n CompanyPositions.HeadOfEngineering, CompanyPositions.SecurityGuard, CompanyPositions.SecurityOfficer,\r\n CompanyPositions.SecuritySupervisor, CompanyPositions.HeadOfSecurity, CompanyPositions.FieldAgent,\r\n CompanyPositions.SecretAgent, CompanyPositions.SpecialOperative]);\r\n if (companyExists(Locations.AevumWatchdogSecurity)) {\r\n WatchdogSecurity.favor = Companies[Locations.AevumWatchdogSecurity].favor;\r\n delete Companies[Locations.AevumWatchdogSecurity];\r\n }\r\n AddToCompanies(WatchdogSecurity);\r\n\r\n //\"Medium level\" companies\r\n var LexoCorp = new Company(Locations.VolhavenLexoCorp, 1.4, 1.4, 99);\r\n LexoCorp.addPositions([\r\n CompanyPositions.SoftwareIntern, CompanyPositions.JuniorDev, CompanyPositions.SeniorDev,\r\n CompanyPositions.LeadDev, CompanyPositions.SoftwareConsultant, CompanyPositions.SeniorSoftwareConsultant,\r\n CompanyPositions.ITIntern, CompanyPositions.ITAnalyst,\r\n CompanyPositions.ITManager, CompanyPositions.SysAdmin, CompanyPositions.SecurityEngineer,\r\n CompanyPositions.NetworkEngineer, CompanyPositions.HeadOfSoftware, CompanyPositions.CTO,\r\n CompanyPositions.BusinessIntern, CompanyPositions.BusinessAnalyst,\r\n CompanyPositions.OperationsManager, CompanyPositions.CFO, CompanyPositions.CEO,\r\n CompanyPositions.SecurityGuard, CompanyPositions.SecurityOfficer, CompanyPositions.HeadOfSecurity]);\r\n if (companyExists(Locations.VolhavenLexoCorp)) {\r\n LexoCorp.favor = Companies[Locations.VolhavenLexoCorp].favor;\r\n delete Companies[Locations.VolhavenLexoCorp];\r\n }\r\n AddToCompanies(LexoCorp);\r\n\r\n var RhoConstruction = new Company(Locations.AevumRhoConstruction, 1.3, 1.3, 49);\r\n RhoConstruction.addPositions([\r\n CompanyPositions.SoftwareIntern, CompanyPositions.JuniorDev, CompanyPositions.SeniorDev,\r\n CompanyPositions.LeadDev, CompanyPositions.BusinessIntern, CompanyPositions.BusinessAnalyst,\r\n CompanyPositions.BusinessManager, CompanyPositions.OperationsManager]);\r\n if (companyExists(Locations.AevumRhoConstruction)) {\r\n RhoConstruction.favor = Companies[Locations.AevumRhoConstruction].favor;\r\n delete Companies[Locations.AevumRhoConstruction];\r\n }\r\n AddToCompanies(RhoConstruction);\r\n\r\n var AlphaEnterprises = new Company(Locations.Sector12AlphaEnterprises, 1.5, 1.5, 99);\r\n AlphaEnterprises.addPositions([\r\n CompanyPositions.SoftwareIntern, CompanyPositions.JuniorDev, CompanyPositions.SeniorDev,\r\n CompanyPositions.LeadDev, CompanyPositions.SoftwareConsultant, CompanyPositions.SeniorSoftwareConsultant,\r\n CompanyPositions.BusinessIntern, CompanyPositions.BusinessAnalyst,\r\n CompanyPositions.BusinessManager, CompanyPositions.OperationsManager]);\r\n if (companyExists(Locations.Sector12AlphaEnterprises)) {\r\n AlphaEnterprises.favor = Companies[Locations.Sector12AlphaEnterprises].favor;\r\n delete Companies[Locations.Sector12AlphaEnterprises];\r\n }\r\n AddToCompanies(AlphaEnterprises);\r\n\r\n var AevumPolice = new Company(Locations.AevumPolice, 1.3, 1.3, 99);\r\n AevumPolice.addPositions([\r\n CompanyPositions.SoftwareIntern, CompanyPositions.JuniorDev, CompanyPositions.SeniorDev,\r\n CompanyPositions.LeadDev, CompanyPositions.SecurityGuard, CompanyPositions.PoliceOfficer]);\r\n if (companyExists(Locations.AevumPolice)) {\r\n AevumPolice.favor = Companies[Locations.AevumPolice].favor;\r\n delete Companies[Locations.AevumPolice];\r\n }\r\n AddToCompanies(AevumPolice);\r\n\r\n var SysCoreSecurities = new Company(Locations.VolhavenSysCoreSecurities, 1.3, 1.3, 124);\r\n SysCoreSecurities.addPositions([\r\n CompanyPositions.SoftwareIntern, CompanyPositions.JuniorDev, CompanyPositions.SeniorDev,\r\n CompanyPositions.LeadDev, CompanyPositions.ITIntern, CompanyPositions.ITAnalyst,\r\n CompanyPositions.ITManager, CompanyPositions.SysAdmin, CompanyPositions.SecurityEngineer,\r\n CompanyPositions.NetworkEngineer, CompanyPositions.NetworkAdministrator, CompanyPositions.HeadOfSoftware,\r\n CompanyPositions.CTO]);\r\n if (companyExists(Locations.VolhavenSysCoreSecurities)) {\r\n SysCoreSecurities.favor = Companies[Locations.VolhavenSysCoreSecurities].favor;\r\n delete Companies[Locations.VolhavenSysCoreSecurities];\r\n }\r\n AddToCompanies(SysCoreSecurities);\r\n\r\n var CompuTek = new Company(Locations.VolhavenCompuTek, 1.2, 1.2, 74);\r\n CompuTek.addPositions([\r\n CompanyPositions.SoftwareIntern, CompanyPositions.JuniorDev, CompanyPositions.SeniorDev,\r\n CompanyPositions.LeadDev, CompanyPositions.SoftwareConsultant, CompanyPositions.SeniorSoftwareConsultant,\r\n CompanyPositions.ITIntern, CompanyPositions.ITAnalyst,\r\n CompanyPositions.ITManager, CompanyPositions.SysAdmin, CompanyPositions.SecurityEngineer,\r\n CompanyPositions.NetworkEngineer, CompanyPositions.NetworkAdministrator, CompanyPositions.HeadOfSoftware,\r\n CompanyPositions.CTO]);\r\n if (companyExists(Locations.VolhavenCompuTek)) {\r\n CompuTek.favor = Companies[Locations.VolhavenCompuTek].favor;\r\n delete Companies[Locations.VolhavenCompuTek];\r\n }\r\n AddToCompanies(CompuTek);\r\n\r\n var NetLinkTechnologies = new Company(Locations.AevumNetLinkTechnologies, 1.2, 1.2, 99);\r\n NetLinkTechnologies.addPositions([\r\n CompanyPositions.SoftwareIntern, CompanyPositions.JuniorDev, CompanyPositions.SeniorDev,\r\n CompanyPositions.LeadDev, CompanyPositions.SoftwareConsultant, CompanyPositions.SeniorSoftwareConsultant,\r\n CompanyPositions.ITIntern, CompanyPositions.ITAnalyst,\r\n CompanyPositions.ITManager, CompanyPositions.SysAdmin, CompanyPositions.SecurityEngineer,\r\n CompanyPositions.NetworkEngineer, CompanyPositions.NetworkAdministrator, CompanyPositions.HeadOfSoftware,\r\n CompanyPositions.CTO]);\r\n if (companyExists(Locations.AevumNetLinkTechnologies)) {\r\n NetLinkTechnologies.favor = Companies[Locations.AevumNetLinkTechnologies].favor;\r\n delete Companies[Locations.AevumNetLinkTechnologies];\r\n }\r\n AddToCompanies(NetLinkTechnologies);\r\n\r\n var CarmichaelSecurity = new Company(Locations.Sector12CarmichaelSecurity, 1.2, 1.2, 74);\r\n CarmichaelSecurity.addPositions([\r\n CompanyPositions.SoftwareIntern, CompanyPositions.JuniorDev, CompanyPositions.SeniorDev,\r\n CompanyPositions.LeadDev, CompanyPositions.SoftwareConsultant, CompanyPositions.SeniorSoftwareConsultant,\r\n CompanyPositions.ITIntern, CompanyPositions.ITAnalyst,\r\n CompanyPositions.ITManager, CompanyPositions.SysAdmin, CompanyPositions.SecurityEngineer,\r\n CompanyPositions.NetworkEngineer, CompanyPositions.NetworkAdministrator, CompanyPositions.HeadOfSoftware,\r\n CompanyPositions.HeadOfEngineering, CompanyPositions.SecurityGuard, CompanyPositions.SecurityOfficer,\r\n CompanyPositions.SecuritySupervisor, CompanyPositions.HeadOfSecurity, CompanyPositions.FieldAgent,\r\n CompanyPositions.SecretAgent, CompanyPositions.SpecialOperative]);\r\n if (companyExists(Locations.Sector12CarmichaelSecurity)) {\r\n CarmichaelSecurity.favor = Companies[Locations.Sector12CarmichaelSecurity].favor;\r\n delete Companies[Locations.Sector12CarmichaelSecurity];\r\n }\r\n AddToCompanies(CarmichaelSecurity);\r\n\r\n //\"Low level\" companies\r\n var FoodNStuff = new Company(Locations.Sector12FoodNStuff, 1, 1, 0);\r\n FoodNStuff.addPositions([CompanyPositions.Employee, CompanyPositions.PartTimeEmployee]);\r\n if (companyExists(Locations.Sector12FoodNStuff)) {\r\n FoodNStuff.favor = Companies[Locations.Sector12FoodNStuff].favor;\r\n delete Companies[Locations.Sector12FoodNStuff];\r\n }\r\n AddToCompanies(FoodNStuff);\r\n\r\n var JoesGuns = new Company(Locations.Sector12JoesGuns, 1, 1, 0);\r\n JoesGuns.addPositions([CompanyPositions.Employee, CompanyPositions.PartTimeEmployee]);\r\n if (companyExists(Locations.Sector12JoesGuns)) {\r\n JoesGuns.favor = Companies[Locations.Sector12JoesGuns].favor;\r\n delete Companies[Locations.Sector12JoesGuns];\r\n }\r\n AddToCompanies(JoesGuns);\r\n\r\n var OmegaSoftware = new Company(Locations.IshimaOmegaSoftware, 1.1, 1.1, 49);\r\n OmegaSoftware.addPositions([\r\n CompanyPositions.SoftwareIntern, CompanyPositions.JuniorDev, CompanyPositions.SeniorDev,\r\n CompanyPositions.LeadDev, CompanyPositions.SoftwareConsultant, CompanyPositions.SeniorSoftwareConsultant,\r\n CompanyPositions.ITIntern, CompanyPositions.ITAnalyst,\r\n CompanyPositions.ITManager, CompanyPositions.CTO, CompanyPositions.CEO]);\r\n if (companyExists(Locations.IshimaOmegaSoftware)) {\r\n OmegaSoftware.favor = Companies[Locations.IshimaOmegaSoftware].favor;\r\n delete Companies[Locations.IshimaOmegaSoftware];\r\n }\r\n AddToCompanies(OmegaSoftware);\r\n\r\n /* Companies that do not have servers */\r\n var NoodleBar = new Company(Locations.NewTokyoNoodleBar, 1, 1, 0);\r\n NoodleBar.addPositions([CompanyPositions.Waiter, CompanyPositions.PartTimeWaiter]);\r\n if (companyExists(Locations.NewTokyoNoodleBar)) {\r\n NoodleBar.favor = Companies[Locations.NewTokyoNoodleBar].favor;\r\n delete Companies[Locations.NewTokyoNoodleBar];\r\n }\r\n AddToCompanies(NoodleBar);\r\n}\r\n\r\n//Map of all companies that exist in the game, indexed by their name\r\nlet Companies = {}\r\n\r\nfunction loadCompanies(saveString) {\r\n Companies = JSON.parse(saveString, Reviver);\r\n}\r\n\r\n//Add a Company object onto the map of all Companies in the game\r\nfunction AddToCompanies(company) {\r\n var name = company.companyName;\r\n Companies[name] = company;\r\n}\r\n\r\nfunction companyExists(name) {\r\n return Companies.hasOwnProperty(name);\r\n}\r\n\r\nfunction getJobRequirementText(company, pos, tooltiptext=false) {\r\n var reqText = \"\";\r\n var offset = company.jobStatReqOffset;\r\n var reqHacking = pos.requiredHacking > 0 ? pos.requiredHacking+offset : 0;\r\n var reqStrength = pos.requiredStrength > 0 ? pos.requiredStrength+offset : 0;\r\n var reqDefense = pos.requiredDefense > 0 ? pos.requiredDefense+offset : 0;\r\n var reqDexterity = pos.requiredDexterity > 0 ? pos.requiredDexterity+offset : 0;\r\n var reqAgility = pos.requiredDexterity > 0 ? pos.requiredDexterity+offset : 0;\r\n var reqCharisma = pos.requiredCharisma > 0 ? pos.requiredCharisma+offset : 0;\r\n var reqRep = pos.requiredReputation;\r\n if (tooltiptext) {\r\n reqText = \"Requires:<br>\";\r\n reqText += (reqHacking.toString() + \" hacking<br>\");\r\n reqText += (reqStrength.toString() + \" strength<br>\");\r\n reqText += (reqDefense.toString() + \" defense<br>\");\r\n reqText += (reqDexterity.toString() + \" dexterity<br>\");\r\n reqText += (reqAgility.toString() + \" agility<br>\");\r\n reqText += (reqCharisma.toString() + \" charisma<br>\");\r\n reqText += (reqRep.toString() + \" reputation\");\r\n } else {\r\n reqText = \"(Requires \";\r\n if (reqHacking > 0) {reqText += (reqHacking + \" hacking, \");}\r\n if (reqStrength > 0) {reqText += (reqStrength + \" strength, \");}\r\n if (reqDefense > 0) {reqText += (reqDefense + \" defense, \");}\r\n if (reqDexterity > 0) {reqText += (reqDexterity + \" dexterity, \");}\r\n if (reqAgility > 0) {reqText += (reqAgility + \" agility, \");}\r\n if (reqCharisma > 0) {reqText += (reqCharisma + \" charisma, \");}\r\n if (reqRep > 1) {reqText += (reqRep + \" reputation, \");}\r\n reqText = reqText.substring(0, reqText.length - 2);\r\n reqText += \")\";\r\n }\r\n return reqText;\r\n}\r\n\r\nexport {CompanyPositions, initCompanies, Companies, getJobRequirementText,\r\n getNextCompanyPosition, loadCompanies, Company, CompanyPosition,\r\n companyExists};\r\n","import {BitNodeMultipliers} from \"./BitNode.js\";\r\nimport {CONSTANTS} from \"./Constants.js\";\r\nimport {Programs} from \"./CreateProgram.js\";\r\nimport {Player} from \"./Player.js\";\r\nimport {RunningScript, Script} from \"./Script.js\";\r\nimport {SpecialServerNames, SpecialServerIps} from \"./SpecialServerIps.js\";\r\nimport {getRandomInt} from \"../utils/HelperFunctions.js\";\r\nimport {createRandomIp, isValidIPAddress, ipExists} from \"../utils/IPAddress.js\";\r\nimport {Reviver, Generic_toJSON,\r\n Generic_fromJSON} from \"../utils/JSONReviver.js\";\r\n\r\nfunction Server(params={ip:createRandomIp(), hostname:\"\"}) {\r\n /* Properties */\r\n //Connection information\r\n this.ip = params.ip ? params.ip : createRandomIp();\r\n\r\n var hostname = params.hostname;\r\n var i = 0;\r\n var suffix = \"\";\r\n while (GetServerByHostname(hostname+suffix) != null) {\r\n //Server already exists\r\n suffix = \"-\" + i;\r\n ++i;\r\n }\r\n this.hostname = hostname + suffix;\r\n this.organizationName = params.organizationName != null ? params.organizationName : \"\";\r\n this.isConnectedTo = params.isConnectedTo != null ? params.isConnectedTo : false;\r\n\r\n //Access information\r\n this.hasAdminRights = params.adminRights != null ? params.adminRights : false;\r\n this.purchasedByPlayer = params.purchasedByPlayer != null ? params.purchasedByPlayer : false;\r\n this.manuallyHacked = false; //Flag that tracks whether or not the server has been hacked at least once\r\n\r\n //RAM, CPU speed and Scripts\r\n this.maxRam = params.maxRam != null ? params.maxRam : 0; //GB\r\n this.ramUsed = 0;\r\n this.cpuCores = 1; //Max of 8, affects hacking times and Hacking Mission starting Cores\r\n\r\n this.scripts = [];\r\n this.runningScripts = []; //Stores RunningScript objects\r\n this.programs = [];\r\n this.messages = [];\r\n this.textFiles = [];\r\n this.dir = 0; //new Directory(this, null, \"\"); TODO\r\n\r\n /* Hacking information (only valid for \"foreign\" aka non-purchased servers) */\r\n this.requiredHackingSkill = params.requiredHackingSkill != null ? params.requiredHackingSkill : 1;\r\n this.moneyAvailable = params.moneyAvailable != null ? params.moneyAvailable * BitNodeMultipliers.ServerStartingMoney : 0;\r\n this.moneyMax = 25 * this.moneyAvailable * BitNodeMultipliers.ServerMaxMoney;\r\n\r\n //Hack Difficulty is synonymous with server security. Base Difficulty = Starting difficulty\r\n this.hackDifficulty = params.hackDifficulty != null ? params.hackDifficulty * BitNodeMultipliers.ServerStartingSecurity : 1;\r\n this.baseDifficulty = this.hackDifficulty;\r\n this.minDifficulty = Math.max(1, Math.round(this.hackDifficulty / 3));\r\n this.serverGrowth = params.serverGrowth != null ? params.serverGrowth : 1; //Integer from 0 to 100. Affects money increase from grow()\r\n\r\n //The IP's of all servers reachable from this one (what shows up if you run scan/netstat)\r\n // NOTE: Only contains IP and not the Server objects themselves\r\n this.serversOnNetwork = [];\r\n\r\n //Port information, required for porthacking servers to get admin rights\r\n this.numOpenPortsRequired = params.numOpenPortsRequired != null ? params.numOpenPortsRequired : 5;\r\n this.sshPortOpen = false; //Port 22\r\n this.ftpPortOpen = false; //Port 21\r\n this.smtpPortOpen = false; //Port 25\r\n this.httpPortOpen = false; //Port 80\r\n this.sqlPortOpen = false; //Port 1433\r\n this.openPortCount = 0;\r\n};\r\n\r\nServer.prototype.setMaxRam = function(ram) {\r\n this.maxRam = ram;\r\n}\r\n\r\n//The serverOnNetwork array holds the IP of all the servers. This function\r\n//returns the actual Server objects\r\nServer.prototype.getServerOnNetwork = function(i) {\r\n if (i > this.serversOnNetwork.length) {\r\n console.log(\"Tried to get server on network that was out of range\");\r\n return;\r\n }\r\n return AllServers[this.serversOnNetwork[i]];\r\n}\r\n\r\n//Given the name of the script, returns the corresponding\r\n//script object on the server (if it exists)\r\nServer.prototype.getScript = function(scriptName) {\r\n for (var i = 0; i < this.scripts.length; i++) {\r\n if (this.scripts[i].filename == scriptName) {\r\n return this.scripts[i];\r\n }\r\n }\r\n return null;\r\n}\r\n\r\n//Strengthens a server's security level (difficulty) by the specified amount\r\nServer.prototype.fortify = function(amt) {\r\n this.hackDifficulty += amt;\r\n //Place some arbitrarily limit that realistically should never happen unless someone is\r\n //screwing around with the game\r\n if (this.hackDifficulty > 1000000) {this.hackDifficulty = 1000000;}\r\n}\r\n\r\nServer.prototype.weaken = function(amt) {\r\n this.hackDifficulty -= (amt * BitNodeMultipliers.ServerWeakenRate);\r\n if (this.hackDifficulty < this.minDifficulty) {this.hackDifficulty = this.minDifficulty;}\r\n if (this.hackDifficulty < 1) {this.hackDifficulty = 1;}\r\n}\r\n\r\n//Functions for loading and saving a Server\r\nServer.prototype.toJSON = function() {\r\n return Generic_toJSON(\"Server\", this);\r\n}\r\n\r\nServer.fromJSON = function(value) {\r\n return Generic_fromJSON(Server, value.data);\r\n}\r\n\r\nReviver.constructors.Server = Server;\r\n\r\nfunction initForeignServers() {\r\n //MegaCorporations\r\n var ECorpServer = new Server({\r\n ip:createRandomIp(), hostname:\"ecorp\", organizationName:\"ECorp\",\r\n requiredHackingSkill:getRandomInt(1150, 1300), moneyAvailable:getRandomInt(30e9, 70e9),\r\n hackDifficulty:99,serverGrowth:99, numOpenPortsRequired: 5,\r\n });\r\n AddToAllServers(ECorpServer);\r\n\r\n var MegaCorpServer = new Server({\r\n ip:createRandomIp(), hostname:\"megacorp\", organizationName:\"MegaCorp\",\r\n requiredHackingSkill:getRandomInt(1150, 1300), moneyAvailable:getRandomInt(40e9, 60e9),\r\n hackDifficulty:99, serverGrowth:99, numOpenPortsRequired:5\r\n });\r\n AddToAllServers(MegaCorpServer);\r\n\r\n var BachmanAndAssociatesServer = new Server({\r\n ip:createRandomIp(), hostname:\"b-and-a\", organizationName:\"Bachman & Associates\",\r\n requiredHackingSkill:getRandomInt(1000, 1050), moneyAvailable:getRandomInt(20e9, 25e9),\r\n hackDifficulty:getRandomInt(75, 85), serverGrowth:getRandomInt(65, 75), numOpenPortsRequired:5\r\n });\r\n AddToAllServers(BachmanAndAssociatesServer);\r\n\r\n var BladeIndustriesServer = new Server({\r\n ip:createRandomIp(), hostname:\"blade\", organizationName:\"Blade Industries\", maxRam:128,\r\n requiredHackingSkill:getRandomInt(1000, 1100), moneyAvailable:getRandomInt(12e9, 20e9),\r\n hackDifficulty:getRandomInt(90, 95), serverGrowth:getRandomInt(60, 75), numOpenPortsRequired:5\r\n });\r\n BladeIndustriesServer.messages.push(\"beyond-man.lit\");\r\n AddToAllServers(BladeIndustriesServer);\r\n\r\n var NWOServer = new Server({\r\n ip:createRandomIp(), hostname:\"nwo\", organizationName:\"New World Order\",\r\n requiredHackingSkill:getRandomInt(1000, 1200), moneyAvailable:getRandomInt(25e9, 35e9),\r\n hackDifficulty:99, serverGrowth:getRandomInt(75, 85), numOpenPortsRequired:5\r\n });\r\n NWOServer.messages.push(\"the-hidden-world.lit\");\r\n AddToAllServers(NWOServer);\r\n\r\n var ClarkeIncorporatedServer = new Server({\r\n ip:createRandomIp(), hostname:\"clarkeinc\", organizationName:\"Clarke Incorporated\",\r\n requiredHackingSkill:getRandomInt(1000, 1200), moneyAvailable:getRandomInt(15e9, 25e9),\r\n hackDifficulty:getRandomInt(50, 60), serverGrowth:getRandomInt(50, 70), numOpenPortsRequired:5\r\n });\r\n ClarkeIncorporatedServer.messages.push(\"beyond-man.lit\");\r\n ClarkeIncorporatedServer.messages.push(\"cost-of-immortality.lit\");\r\n AddToAllServers(ClarkeIncorporatedServer);\r\n\r\n var OmniTekIncorporatedServer = new Server({\r\n ip:createRandomIp(), hostname:\"omnitek\", organizationName:\"OmniTek Incorporated\", maxRam:256,\r\n requiredHackingSkill:getRandomInt(900, 1100), moneyAvailable:getRandomInt(15e9, 20e9),\r\n hackDifficulty:getRandomInt(90, 99), serverGrowth:getRandomInt(95, 99), numOpenPortsRequired:5\r\n });\r\n OmniTekIncorporatedServer.messages.push(\"coded-intelligence.lit\");\r\n OmniTekIncorporatedServer.messages.push(\"history-of-synthoids.lit\");\r\n AddToAllServers(OmniTekIncorporatedServer);\r\n\r\n var FourSigmaServer = new Server({\r\n ip:createRandomIp(), hostname:\"4sigma\", organizationName:\"FourSigma\",\r\n requiredHackingSkill:getRandomInt(950, 1200), moneyAvailable:getRandomInt(15e9, 25e9),\r\n hackDifficulty:getRandomInt(60, 70), serverGrowth:getRandomInt(75, 99), numOpenPortsRequired:5\r\n });\r\n AddToAllServers(FourSigmaServer);\r\n\r\n var KuaiGongInternationalServer = new Server({\r\n ip:createRandomIp(), hostname:\"kuai-gong\", organizationName:\"KuaiGong International\",\r\n requiredHackingSkill:getRandomInt(1000, 1250), moneyAvailable:getRandomInt(20e9, 30e9),\r\n hackDifficulty:getRandomInt(95, 99), serverGrowth:getRandomInt(90, 99), numOpenPortsRequired:5,\r\n });\r\n AddToAllServers(KuaiGongInternationalServer);\r\n\r\n //Technology and communications companies (large targets)\r\n var FulcrumTechnologiesServer = new Server({\r\n ip:createRandomIp(), hostname:\"fulcrumtech\", organizationName:\"Fulcrum Technologies\", maxRam:512,\r\n requiredHackingSkill:getRandomInt(1000, 1200), moneyAvailable:getRandomInt(1.4e9, 1.8e9),\r\n hackDifficulty:getRandomInt(85, 95), serverGrowth:getRandomInt(80, 99), numOpenPortsRequired:5\r\n });\r\n FulcrumTechnologiesServer.messages.push(\"simulated-reality.lit\");\r\n AddToAllServers(FulcrumTechnologiesServer);\r\n\r\n var FulcrumSecretTechnologiesServer = new Server({\r\n ip:createRandomIp(), hostname:\"fulcrumassets\", organizationName:\"Fulcrum Technologies Assets\",\r\n requiredHackingSkill:getRandomInt(1200, 1500), moneyAvailable:1e6,\r\n hackDifficulty:99, serverGrowth:1, numOpenPortsRequired:5\r\n });\r\n AddToAllServers(FulcrumSecretTechnologiesServer);\r\n SpecialServerIps.addIp(SpecialServerNames.FulcrumSecretTechnologies, FulcrumSecretTechnologiesServer.ip);\r\n\r\n var StormTechnologiesServer = new Server({\r\n ip:createRandomIp(), hostname:\"stormtech\", organizationName:\"Storm Technologies\",\r\n requiredHackingSkill:getRandomInt(900, 1050), moneyAvailable:getRandomInt(1e9, 1.2e9),\r\n hackDifficulty:getRandomInt(80, 90), serverGrowth:getRandomInt(70, 90), numOpenPortsRequired:5\r\n });\r\n AddToAllServers(StormTechnologiesServer);\r\n\r\n var DefCommServer = new Server({\r\n ip:createRandomIp(), hostname:\"defcomm\", organizationName:\"DefComm\",\r\n requiredHackingSkill:getRandomInt(900, 1000), moneyAvailable:getRandomInt(800e6, 950e6),\r\n hackDifficulty:getRandomInt(85, 95), serverGrowth:getRandomInt(50, 70), numOpenPortsRequired:5\r\n });\r\n AddToAllServers(DefCommServer);\r\n\r\n var InfoCommServer = new Server({\r\n ip:createRandomIp(), hostname:\"infocomm\", organizationName:\"InfoComm\",\r\n requiredHackingSkill:getRandomInt(875, 950), moneyAvailable:getRandomInt(600e6, 900e6),\r\n hackDifficulty:getRandomInt(70, 90), serverGrowth:getRandomInt(35, 75), numOpenPortsRequired:5\r\n });\r\n AddToAllServers(InfoCommServer);\r\n\r\n var HeliosLabsServer = new Server({\r\n ip:createRandomIp(), hostname:\"helios\", organizationName:\"Helios Labs\", maxRam:128,\r\n requiredHackingSkill:getRandomInt(800, 900), moneyAvailable:getRandomInt(550e6, 750e6),\r\n hackDifficulty:getRandomInt(85, 95), serverGrowth:getRandomInt(70, 80), numOpenPortsRequired:5\r\n });\r\n HeliosLabsServer.messages.push(\"beyond-man.lit\");\r\n AddToAllServers(HeliosLabsServer);\r\n\r\n var VitaLifeServer = new Server({\r\n ip:createRandomIp(), hostname:\"vitalife\", organizationName:\"VitaLife\", maxRam:64,\r\n requiredHackingSkill:getRandomInt(775, 900), moneyAvailable:getRandomInt(700e6, 800e6),\r\n hackDifficulty:getRandomInt(80, 90), serverGrowth:getRandomInt(60, 80), numOpenPortsRequired:5\r\n });\r\n VitaLifeServer.messages.push(\"A-Green-Tomorrow.lit\");\r\n AddToAllServers(VitaLifeServer);\r\n\r\n var IcarusMicrosystemsServer = new Server({\r\n ip:createRandomIp(), hostname:\"icarus\", organizationName:\"Icarus Microsystems\",\r\n requiredHackingSkill:getRandomInt(850, 925), moneyAvailable:getRandomInt(900e6, 1000e6),\r\n hackDifficulty:getRandomInt(85, 95), serverGrowth:getRandomInt(85, 95), numOpenPortsRequired:5\r\n });\r\n AddToAllServers(IcarusMicrosystemsServer);\r\n\r\n var UniversalEnergyServer = new Server({\r\n ip:createRandomIp(), hostname:\"univ-energy\", organizationName:\"Universal Energy\", maxRam:64,\r\n requiredHackingSkill:getRandomInt(800, 900), moneyAvailable:getRandomInt(1.1e9, 1.2e9),\r\n hackDifficulty:getRandomInt(80, 90), serverGrowth:getRandomInt(80, 90), numOpenPortsRequired:4\r\n });\r\n AddToAllServers(UniversalEnergyServer);\r\n\r\n var TitanLabsServer = new Server({\r\n ip:createRandomIp(), hostname:\"titan-labs\", organizationName:\"Titan Laboratories\", maxRam:64,\r\n requiredHackingSkill:getRandomInt(800, 875), moneyAvailable:getRandomInt(750e6, 900e6),\r\n hackDifficulty:getRandomInt(70, 80), serverGrowth:getRandomInt(60, 80), numOpenPortsRequired:5\r\n });\r\n TitanLabsServer.messages.push(\"coded-intelligence.lit\");\r\n AddToAllServers(TitanLabsServer);\r\n\r\n var MicrodyneTechnologiesServer = new Server({\r\n ip:createRandomIp(), hostname:\"microdyne\", organizationName:\"Microdyne Technologies\", maxRam:32,\r\n requiredHackingSkill:getRandomInt(800, 875), moneyAvailable:getRandomInt(500e6, 700e6),\r\n hackDifficulty:getRandomInt(65, 75), serverGrowth:getRandomInt(70, 90), numOpenPortsRequired:5\r\n });\r\n MicrodyneTechnologiesServer.messages.push(\"synthetic-muscles.lit\");\r\n AddToAllServers(MicrodyneTechnologiesServer);\r\n\r\n var TaiYangDigitalServer = new Server({\r\n ip:createRandomIp(), hostname:\"taiyang-digital\", organizationName:\"Taiyang Digital\",\r\n requiredHackingSkill:getRandomInt(850, 950), moneyAvailable:getRandomInt(800e6, 900e6),\r\n hackDifficulty:getRandomInt(70, 80), serverGrowth:getRandomInt(70, 80), numOpenPortsRequired:5\r\n });\r\n TaiYangDigitalServer.messages.push(\"A-Green-Tomorrow.lit\");\r\n TaiYangDigitalServer.messages.push(\"brighter-than-the-sun.lit\");\r\n AddToAllServers(TaiYangDigitalServer);\r\n\r\n var GalacticCyberSystemsServer = new Server({\r\n ip:createRandomIp(), hostname:\"galactic-cyber\", organizationName:\"Galactic Cybersystems\",\r\n requiredHackingSkill:getRandomInt(825, 875), moneyAvailable:getRandomInt(750e6, 850e6),\r\n hackDifficulty:getRandomInt(55, 65), serverGrowth:getRandomInt(70, 90), numOpenPortsRequired:5\r\n });\r\n AddToAllServers(GalacticCyberSystemsServer);\r\n\r\n //Defense Companies (\"Large\" Companies)\r\n var AeroCorpServer = new Server({\r\n ip:createRandomIp(), hostname:\"aerocorp\", organizationName:\"AeroCorp\",\r\n requiredHackingSkill:getRandomInt(850, 925), moneyAvailable:getRandomInt(1e9, 1.2e9),\r\n hackDifficulty:getRandomInt(80, 90), serverGrowth:getRandomInt(55, 65), numOpenPortsRequired:5\r\n });\r\n AeroCorpServer.messages.push(\"man-and-machine.lit\");\r\n AddToAllServers(AeroCorpServer);\r\n\r\n var OmniaCybersystemsServer = new Server({\r\n ip:createRandomIp(), hostname:\"omnia\", organizationName:\"Omnia Cybersystems\", maxRam:64,\r\n requiredHackingSkill:getRandomInt(850, 950), moneyAvailable:getRandomInt(900e6, 1e9),\r\n hackDifficulty:getRandomInt(85, 95), serverGrowth:getRandomInt(60, 70), numOpenPortsRequired:5\r\n });\r\n OmniaCybersystemsServer.messages.push(\"history-of-synthoids.lit\");\r\n AddToAllServers(OmniaCybersystemsServer);\r\n\r\n var ZBDefenseServer = new Server({\r\n ip:createRandomIp(), hostname:\"zb-def\", organizationName:\"ZB Defense Industries\",\r\n requiredHackingSkill:getRandomInt(775, 825), moneyAvailable:getRandomInt(900e6, 1.1e9),\r\n hackDifficulty:getRandomInt(55, 65), serverGrowth:getRandomInt(65, 75), numOpenPortsRequired:4\r\n });\r\n ZBDefenseServer.messages.push(\"synthetic-muscles.lit\");\r\n AddToAllServers(ZBDefenseServer);\r\n\r\n var AppliedEnergeticsServer = new Server({\r\n ip:createRandomIp(), hostname:\"applied-energetics\", organizationName:\"Applied Energetics\",\r\n requiredHackingSkill:getRandomInt(775, 850), moneyAvailable:getRandomInt(700e6, 1e9),\r\n hackDifficulty:getRandomInt(60, 80), serverGrowth:getRandomInt(70, 75), numOpenPortsRequired:4\r\n });\r\n AddToAllServers(AppliedEnergeticsServer);\r\n\r\n var SolarisSpaceSystemsServer = new Server({\r\n ip:createRandomIp(), hostname:\"solaris\", organizationName:\"Solaris Space Systems\", maxRam:64,\r\n requiredHackingSkill:getRandomInt(750, 850), moneyAvailable:getRandomInt(700e6, 900e6),\r\n hackDifficulty:getRandomInt(70, 80), serverGrowth:getRandomInt(70, 80), numOpenPortsRequired:5\r\n });\r\n SolarisSpaceSystemsServer.messages.push(\"A-Green-Tomorrow.lit\");\r\n SolarisSpaceSystemsServer.messages.push(\"the-failed-frontier.lit\");\r\n AddToAllServers(SolarisSpaceSystemsServer);\r\n\r\n var DeltaOneServer = new Server({\r\n ip:createRandomIp(), hostname:\"deltaone\", organizationName:\"Delta One\",\r\n requiredHackingSkill:getRandomInt(800, 900), moneyAvailable:getRandomInt(1.3e9, 1.7e9),\r\n hackDifficulty:getRandomInt(75, 85), serverGrowth:getRandomInt(50, 70), numOpenPortsRequired:5\r\n });\r\n AddToAllServers(DeltaOneServer);\r\n\r\n //Health, medicine, pharmaceutical companies (\"Large\" targets)\r\n var GlobalPharmaceuticalsServer = new Server({\r\n ip:createRandomIp(), hostname:\"global-pharm\", organizationName:\"Global Pharmaceuticals\", maxRam:32,\r\n requiredHackingSkill:getRandomInt(750, 850), moneyAvailable:getRandomInt(1.5e9, 1.75e9),\r\n hackDifficulty:getRandomInt(75, 85), serverGrowth:getRandomInt(80, 90), numOpenPortsRequired:4\r\n });\r\n GlobalPharmaceuticalsServer.messages.push(\"A-Green-Tomorrow.lit\");\r\n AddToAllServers(GlobalPharmaceuticalsServer);\r\n\r\n var NovaMedicalServer = new Server({\r\n ip:createRandomIp(), hostname:\"nova-med\", organizationName:\"Nova Medical\",\r\n requiredHackingSkill:getRandomInt(775, 850), moneyAvailable:getRandomInt(1.1e9, 1.25e9),\r\n hackDifficulty:getRandomInt(60, 80), serverGrowth:getRandomInt(65, 85), numOpenPortsRequired:4\r\n });\r\n AddToAllServers(NovaMedicalServer);\r\n\r\n var ZeusMedicalServer = new Server({\r\n ip:createRandomIp(), hostname:\"zeus-med\", organizationName:\"Zeus Medical\",\r\n requiredHackingSkill:getRandomInt(800, 850), moneyAvailable:getRandomInt(1.3e9, 1.5e9),\r\n hackDifficulty:getRandomInt(70, 90), serverGrowth:getRandomInt(70, 80), numOpenPortsRequired:5\r\n });\r\n AddToAllServers(ZeusMedicalServer);\r\n\r\n var UnitaLifeGroupServer = new Server({\r\n ip:createRandomIp(), hostname:\"unitalife\", organizationName:\"UnitaLife Group\", maxRam:32,\r\n requiredHackingSkill:getRandomInt(775, 825), moneyAvailable:getRandomInt(1e9, 1.1e9),\r\n hackDifficulty:getRandomInt(70, 80), serverGrowth:getRandomInt(70, 80), numOpenPortsRequired:4\r\n });\r\n AddToAllServers(UnitaLifeGroupServer);\r\n\r\n //\"Medium level\" targets\r\n var LexoCorpServer = new Server({\r\n ip:createRandomIp(), hostname:\"lexo-corp\", organizationName:\"Lexo Corporation\", maxRam:32,\r\n requiredHackingSkill:getRandomInt(650, 750), moneyAvailable:getRandomInt(700e6, 800e6),\r\n hackDifficulty:getRandomInt(60, 80), serverGrowth:getRandomInt(55, 65), numOpenPortsRequired:4\r\n });\r\n AddToAllServers(LexoCorpServer);\r\n\r\n var RhoConstructionServer = new Server({\r\n ip:createRandomIp(), hostname:\"rho-construction\", organizationName:\"Rho Construction\",\r\n requiredHackingSkill:getRandomInt(475, 525), moneyAvailable:getRandomInt(500e6, 700e6),\r\n hackDifficulty:getRandomInt(40, 60), serverGrowth:getRandomInt(40, 60), numOpenPortsRequired:3\r\n });\r\n AddToAllServers(RhoConstructionServer);\r\n\r\n var AlphaEnterprisesServer = new Server({\r\n ip:createRandomIp(), hostname:\"alpha-ent\", organizationName:\"Alpha Enterprises\", maxRam:32,\r\n requiredHackingSkill:getRandomInt(500, 600), moneyAvailable:getRandomInt(600e6, 750e6),\r\n hackDifficulty:getRandomInt(50, 70), serverGrowth:getRandomInt(50, 60),numOpenPortsRequired:4\r\n });\r\n AlphaEnterprisesServer.messages.push(\"sector-12-crime.lit\");\r\n AddToAllServers(AlphaEnterprisesServer);\r\n\r\n var AevumPoliceServer = new Server({\r\n ip:createRandomIp(), hostname:\"aevum-police\", organizationName:\"Aevum Police Network\", maxRam:32,\r\n requiredHackingSkill:getRandomInt(400, 450), moneyAvailable:getRandomInt(200e6, 400e6),\r\n hackDifficulty:getRandomInt(70, 80), serverGrowth:getRandomInt(30, 50), numOpenPortsRequired:4\r\n });\r\n AddToAllServers(AevumPoliceServer);\r\n\r\n var RothmanUniversityServer = new Server({\r\n ip:createRandomIp(), hostname:\"rothman-uni\", organizationName:\"Rothman University Network\", maxRam:64,\r\n requiredHackingSkill:getRandomInt(370, 430), moneyAvailable:getRandomInt(175e6, 250e6),\r\n hackDifficulty:getRandomInt(45, 55), serverGrowth:getRandomInt(35, 45), numOpenPortsRequired:3\r\n });\r\n RothmanUniversityServer.messages.push(\"secret-societies.lit\");\r\n RothmanUniversityServer.messages.push(\"the-failed-frontier.lit\");\r\n RothmanUniversityServer.messages.push(\"tensions-in-tech-race.lit\");\r\n AddToAllServers(RothmanUniversityServer);\r\n\r\n var ZBInstituteOfTechnologyServer = new Server({\r\n ip:createRandomIp(), hostname:\"zb-institute\", organizationName:\"ZB Institute of Technology Network\", maxRam:64,\r\n requiredHackingSkill:getRandomInt(725, 775), moneyAvailable:getRandomInt(800e6, 1.1e9),\r\n hackDifficulty:getRandomInt(65, 85), serverGrowth:getRandomInt(75, 85), numOpenPortsRequired:5\r\n });\r\n AddToAllServers(ZBInstituteOfTechnologyServer);\r\n\r\n var SummitUniversityServer = new Server({\r\n ip:createRandomIp(), hostname:\"summit-uni\", organizationName:\"Summit University Network\", maxRam:32,\r\n requiredHackingSkill:getRandomInt(425, 475), moneyAvailable:getRandomInt(200e6, 350e6),\r\n hackDifficulty:getRandomInt(45, 65), serverGrowth:getRandomInt(40, 60), numOpenPortsRequired:3\r\n });\r\n SummitUniversityServer.messages.push(\"secret-societies.lit\");\r\n SummitUniversityServer.messages.push(\"the-failed-frontier.lit\");\r\n SummitUniversityServer.messages.push(\"synthetic-muscles.lit\");\r\n AddToAllServers(SummitUniversityServer);\r\n\r\n var SysCoreSecuritiesServer = new Server({\r\n ip:createRandomIp(), hostname:\"syscore\", organizationName:\"SysCore Securities\",\r\n requiredHackingSkill:getRandomInt(550, 650), moneyAvailable:getRandomInt(400e6, 600e6),\r\n hackDifficulty:getRandomInt(60, 80), serverGrowth:getRandomInt(60, 70), numOpenPortsRequired:4\r\n });\r\n AddToAllServers(SysCoreSecuritiesServer);\r\n\r\n var CatalystVenturesServer = new Server({\r\n ip:createRandomIp(), hostname:\"catalyst\", organizationName:\"Catalyst Ventures\",\r\n requiredHackingSkill:getRandomInt(400, 450), moneyAvailable:getRandomInt(300e6, 550e6),\r\n hackDifficulty:getRandomInt(60, 70), serverGrowth:getRandomInt(25, 55), numOpenPortsRequired:3,\r\n });\r\n CatalystVenturesServer.messages.push(\"tensions-in-tech-race.lit\");\r\n AddToAllServers(CatalystVenturesServer);\r\n\r\n var TheHubServer = new Server({\r\n ip:createRandomIp(), hostname:\"the-hub\", organizationName:\"The Hub\",\r\n requiredHackingSkill:getRandomInt(275, 325), moneyAvailable:getRandomInt(150e6, 200e6),\r\n hackDifficulty:getRandomInt(35, 45), serverGrowth:getRandomInt(45, 55), numOpenPortsRequired:2\r\n });\r\n AddToAllServers(TheHubServer);\r\n\r\n var CompuTekServer = new Server({\r\n ip:createRandomIp(), hostname:\"comptek\", organizationName:\"CompuTek\",\r\n requiredHackingSkill:getRandomInt(300, 400), moneyAvailable:getRandomInt(220e6, 250e6),\r\n hackDifficulty:getRandomInt(55, 65), serverGrowth:getRandomInt(45, 65), numOpenPortsRequired:3\r\n });\r\n CompuTekServer.messages.push(\"man-and-machine.lit\");\r\n AddToAllServers(CompuTekServer);\r\n\r\n var NetLinkTechnologiesServer = new Server({\r\n ip:createRandomIp(), hostname:\"netlink\", organizationName:\"NetLink Technologies\", maxRam:64,\r\n requiredHackingSkill:getRandomInt(375, 425), moneyAvailable:275e6,\r\n hackDifficulty:getRandomInt(60, 80), serverGrowth:getRandomInt(45, 75), numOpenPortsRequired:3\r\n });\r\n NetLinkTechnologiesServer.messages.push(\"simulated-reality.lit\");\r\n AddToAllServers(NetLinkTechnologiesServer);\r\n\r\n var JohnsonOrthopedicsServer = new Server({\r\n ip:createRandomIp(), hostname:\"johnson-ortho\", organizationName:\"Johnson Orthopedics\",\r\n requiredHackingSkill:getRandomInt(250, 300), moneyAvailable:getRandomInt(70e6, 85e6),\r\n hackDifficulty:getRandomInt(35, 65), serverGrowth:getRandomInt(35, 65), numOpenPortsRequired:2\r\n });\r\n AddToAllServers(JohnsonOrthopedicsServer);\r\n\r\n //\"Low level\" targets\r\n var FoodNStuffServer = new Server({\r\n ip:createRandomIp(), hostname:\"foodnstuff\", organizationName:\"Food N Stuff Supermarket\", maxRam:16,\r\n requiredHackingSkill:1, moneyAvailable:2e6,\r\n hackDifficulty:10, serverGrowth:5, numOpenPortsRequired:0\r\n });\r\n FoodNStuffServer.messages.push(\"sector-12-crime.lit\");\r\n AddToAllServers(FoodNStuffServer);\r\n\r\n var SigmaCosmeticsServer = new Server({\r\n ip:createRandomIp(), hostname:\"sigma-cosmetics\", organizationName:\"Sigma Cosmetics\", maxRam:16,\r\n requiredHackingSkill:5, moneyAvailable:2.3e6,\r\n hackDifficulty:10, serverGrowth:10, numOpenPortsRequired:0\r\n });\r\n AddToAllServers(SigmaCosmeticsServer);\r\n\r\n var JoesGunsServer = new Server({\r\n ip:createRandomIp(), hostname:\"joesguns\", organizationName:\"Joe's Guns\", maxRam:16,\r\n requiredHackingSkill:10, moneyAvailable:2.5e6,\r\n hackDifficulty:15, serverGrowth:20, numOpenPortsRequired:0\r\n });\r\n AddToAllServers(JoesGunsServer);\r\n\r\n var Zer0NightclubServer = new Server({\r\n ip:createRandomIp(), hostname:\"zer0\", organizationName:\"ZER0 Nightclub\", maxRam:32,\r\n requiredHackingSkill:75, moneyAvailable:7.5e6,\r\n hackDifficulty:25, serverGrowth:40, numOpenPortsRequired:1\r\n });\r\n AddToAllServers(Zer0NightclubServer);\r\n\r\n var NectarNightclubServer = new Server({\r\n ip:createRandomIp(), hostname:\"nectar-net\", organizationName:\"Nectar Nightclub Network\", maxRam:16,\r\n requiredHackingSkill:20, moneyAvailable:2.75e6,\r\n hackDifficulty:20, serverGrowth:25, numOpenPortsRequired:0\r\n });\r\n AddToAllServers(NectarNightclubServer);\r\n\r\n var NeoNightclubServer = new Server({\r\n ip:createRandomIp(), hostname:\"neo-net\", organizationName:\"Neo Nightclub Network\", maxRam:32,\r\n requiredHackingSkill:50, moneyAvailable:5e6,\r\n hackDifficulty:25, serverGrowth:25, numOpenPortsRequired:1\r\n });\r\n NeoNightclubServer.messages.push(\"the-hidden-world.lit\");\r\n AddToAllServers(NeoNightclubServer);\r\n\r\n var SilverHelixServer = new Server({\r\n ip:createRandomIp(), hostname:\"silver-helix\", organizationName:\"Silver Helix\", maxRam:64,\r\n requiredHackingSkill:150, moneyAvailable:45e6,\r\n hackDifficulty:30, serverGrowth:30, numOpenPortsRequired:2\r\n });\r\n SilverHelixServer.messages.push(\"new-triads.lit\");\r\n AddToAllServers(SilverHelixServer);\r\n\r\n var HongFangTeaHouseServer = new Server({\r\n ip:createRandomIp(), hostname:\"hong-fang-tea\", organizationName:\"HongFang Teahouse\", maxRam:16,\r\n requiredHackingSkill:30, moneyAvailable:3e6,\r\n hackDifficulty:15, serverGrowth:20, numOpenPortsRequired:0\r\n });\r\n HongFangTeaHouseServer.messages.push(\"brighter-than-the-sun.lit\");\r\n AddToAllServers(HongFangTeaHouseServer);\r\n\r\n var HaraKiriSushiBarServer = new Server({\r\n ip:createRandomIp(), hostname:\"harakiri-sushi\", organizationName:\"HaraKiri Sushi Bar Network\",maxRam:16,\r\n requiredHackingSkill:40, moneyAvailable:4e6,\r\n hackDifficulty:15, serverGrowth:40, numOpenPortsRequired:0\r\n });\r\n AddToAllServers(HaraKiriSushiBarServer);\r\n\r\n var PhantasyServer = new Server({\r\n ip:createRandomIp(), hostname:\"phantasy\", organizationName:\"Phantasy Club\", maxRam:32,\r\n requiredHackingSkill:100, moneyAvailable:24e6,\r\n hackDifficulty:20, serverGrowth:35, numOpenPortsRequired:2\r\n });\r\n AddToAllServers(PhantasyServer);\r\n\r\n var MaxHardwareServer = new Server({\r\n ip:createRandomIp(), hostname:\"max-hardware\", organizationName:\"Max Hardware Store\", maxRam:32,\r\n requiredHackingSkill:80, moneyAvailable:10e6,\r\n hackDifficulty:15, serverGrowth:30, numOpenPortsRequired:1,\r\n });\r\n AddToAllServers(MaxHardwareServer);\r\n\r\n var OmegaSoftwareServer = new Server({\r\n ip:createRandomIp(), hostname:\"omega-net\", organizationName:\"Omega Software\", maxRam:32,\r\n requiredHackingSkill:getRandomInt(180, 220), moneyAvailable:getRandomInt(60e6, 70e6),\r\n hackDifficulty:getRandomInt(25, 35), serverGrowth:getRandomInt(30, 40), numOpenPortsRequired:2\r\n });\r\n OmegaSoftwareServer.messages.push(\"the-new-god.lit\");\r\n AddToAllServers(OmegaSoftwareServer);\r\n\r\n //Gyms\r\n var CrushFitnessGymServer = new Server({\r\n ip:createRandomIp(), hostname:\"crush-fitness\", organizationName:\"Crush Fitness\",\r\n requiredHackingSkill:getRandomInt(225, 275), moneyAvailable:getRandomInt(40e6, 60e6),\r\n hackDifficulty:getRandomInt(35, 45), serverGrowth:getRandomInt(27, 33), numOpenPortsRequired:2\r\n });\r\n AddToAllServers(CrushFitnessGymServer);\r\n\r\n var IronGymServer = new Server({\r\n ip:createRandomIp(), hostname:\"iron-gym\", organizationName:\"Iron Gym Network\", maxRam:32,\r\n requiredHackingSkill:100, moneyAvailable:20e6,\r\n hackDifficulty:30, serverGrowth:20, numOpenPortsRequired:1\r\n });\r\n AddToAllServers(IronGymServer);\r\n\r\n var MilleniumFitnessGymServer = new Server({\r\n ip:createRandomIp(), hostname:\"millenium-fitness\", organizationName:\"Millenium Fitness Network\",\r\n requiredHackingSkill:getRandomInt(475, 525), moneyAvailable:250e6,\r\n hackDifficulty:getRandomInt(45, 55), serverGrowth:getRandomInt(25, 45), numOpenPortsRequired:3,\r\n });\r\n AddToAllServers(MilleniumFitnessGymServer);\r\n\r\n var PowerhouseGymServer = new Server({\r\n ip:createRandomIp(), hostname:\"powerhouse-fitness\", organizationName:\"Powerhouse Fitness\",\r\n requiredHackingSkill:getRandomInt(950, 1100), moneyAvailable:900e6,\r\n hackDifficulty:getRandomInt(55, 65), serverGrowth:getRandomInt(50, 60), numOpenPortsRequired:5,\r\n });\r\n AddToAllServers(PowerhouseGymServer);\r\n\r\n var SnapFitnessGymServer = new Server({\r\n ip:createRandomIp(), hostname:\"snap-fitness\", organizationName:\"Snap Fitness\",\r\n requiredHackingSkill:getRandomInt(675, 800), moneyAvailable:450e6,\r\n hackDifficulty:getRandomInt(40, 60), serverGrowth:getRandomInt(40, 60), numOpenPortsRequired:4\r\n });\r\n AddToAllServers(SnapFitnessGymServer);\r\n\r\n //Faction servers, cannot hack money from these\r\n var BitRunnersServer = new Server({\r\n ip:createRandomIp(), hostname:\"run4theh111z\", organizationName:\"The Runners\", maxRam:128,\r\n requiredHackingSkill:getRandomInt(505, 550), moneyAvailable:0,\r\n hackDifficulty:0, serverGrowth:0, numOpenPortsRequired:4\r\n });\r\n BitRunnersServer.messages.push(\"simulated-reality.lit\");\r\n BitRunnersServer.messages.push(\"the-new-god.lit\");\r\n AddToAllServers(BitRunnersServer);\r\n SpecialServerIps.addIp(SpecialServerNames.BitRunnersServer, BitRunnersServer.ip);\r\n\r\n var TheBlackHandServer = new Server({\r\n ip:createRandomIp(), hostname:\"I.I.I.I\", organizationName:\"I.I.I.I\", maxRam:64,\r\n requiredHackingSkill:getRandomInt(340, 365), moneyAvailable:0,\r\n hackDifficulty:0, serverGrowth:0, numOpenPortsRequired:3,\r\n });\r\n TheBlackHandServer.messages.push(\"democracy-is-dead.lit\");\r\n AddToAllServers(TheBlackHandServer);\r\n SpecialServerIps.addIp(SpecialServerNames.TheBlackHandServer, TheBlackHandServer.ip);\r\n\r\n var NiteSecServer = new Server({\r\n ip:createRandomIp(), hostname:\"avmnite-02h\", organizationName:\"NiteSec\", maxRam:32,\r\n requiredHackingSkill:getRandomInt(202, 220), moneyAvailable:0,\r\n hackDifficulty:0, serverGrowth:0, numOpenPortsRequired:2\r\n });\r\n NiteSecServer.messages.push(\"democracy-is-dead.lit\");\r\n AddToAllServers(NiteSecServer);\r\n SpecialServerIps.addIp(SpecialServerNames.NiteSecServer, NiteSecServer.ip);\r\n\r\n var DarkArmyServer = new Server({\r\n ip:createRandomIp(), hostname:\".\", organizationName:\".\", maxRam:16,\r\n requiredHackingSkill:getRandomInt(505, 550), moneyAvailable:0,\r\n hackDifficulty:0, serverGrowth:0, numOpenPortsRequired:4\r\n });\r\n AddToAllServers(DarkArmyServer);\r\n SpecialServerIps.addIp(SpecialServerNames.TheDarkArmyServer, DarkArmyServer.ip);\r\n\r\n var CyberSecServer = new Server({\r\n ip:createRandomIp(), hostname:\"CSEC\", organizationName:\"CyberSec\", maxRam:8,\r\n requiredHackingSkill:getRandomInt(51, 60), moneyAvailable:0,\r\n hackDifficulty:0, serverGrowth:0, numOpenPortsRequired:1\r\n });\r\n CyberSecServer.messages.push(\"democracy-is-dead.lit\");\r\n AddToAllServers(CyberSecServer);\r\n SpecialServerIps.addIp(SpecialServerNames.CyberSecServer, CyberSecServer.ip);\r\n\r\n var DaedalusServer = new Server({\r\n ip:createRandomIp(), hostname:\"The-Cave\", organizationName:\"Helios\",\r\n requiredHackingSkill:925, moneyAvailable:0,\r\n hackDifficulty:0, serverGrowth:0, numOpenPortsRequired:5\r\n });\r\n DaedalusServer.messages.push(\"alpha-omega.lit\");\r\n AddToAllServers(DaedalusServer);\r\n SpecialServerIps.addIp(SpecialServerNames.DaedalusServer, DaedalusServer.ip);\r\n\r\n //Super special Servers\r\n var WorldDaemon = new Server({\r\n ip:createRandomIp(), hostname:SpecialServerNames.WorldDaemon, organizationName:SpecialServerNames.WorldDaemon,\r\n requiredHackingSkill:3000, moneyAvailable:0,\r\n hackDifficulty:0, serverGrowth:0, numOpenPortsRequired:5\r\n });\r\n AddToAllServers(WorldDaemon);\r\n SpecialServerIps.addIp(SpecialServerNames.WorldDaemon, WorldDaemon.ip);\r\n\r\n /* Create a randomized network for all the foreign servers */\r\n //Groupings for creating a randomized network\r\n var NetworkGroup1 = [IronGymServer, FoodNStuffServer, SigmaCosmeticsServer, JoesGunsServer, HongFangTeaHouseServer, HaraKiriSushiBarServer];\r\n var NetworkGroup2 = [MaxHardwareServer, NectarNightclubServer, Zer0NightclubServer, CyberSecServer];\r\n var NetworkGroup3 = [OmegaSoftwareServer, PhantasyServer, SilverHelixServer, NeoNightclubServer];\r\n var NetworkGroup4 = [CrushFitnessGymServer, NetLinkTechnologiesServer, CompuTekServer, TheHubServer, JohnsonOrthopedicsServer, NiteSecServer];\r\n var NetworkGroup5 = [CatalystVenturesServer, SysCoreSecuritiesServer, SummitUniversityServer, ZBInstituteOfTechnologyServer, RothmanUniversityServer, TheBlackHandServer];\r\n var NetworkGroup6 = [LexoCorpServer, RhoConstructionServer, AlphaEnterprisesServer, AevumPoliceServer, MilleniumFitnessGymServer];\r\n var NetworkGroup7 = [GlobalPharmaceuticalsServer, AeroCorpServer, GalacticCyberSystemsServer, SnapFitnessGymServer];\r\n var NetworkGroup8 = [DeltaOneServer, UnitaLifeGroupServer, OmniaCybersystemsServer];\r\n var NetworkGroup9 = [ZeusMedicalServer, SolarisSpaceSystemsServer, UniversalEnergyServer, IcarusMicrosystemsServer, DefCommServer];\r\n var NetworkGroup10 = [NovaMedicalServer, ZBDefenseServer, TaiYangDigitalServer, InfoCommServer];\r\n var NetworkGroup11 = [AppliedEnergeticsServer, MicrodyneTechnologiesServer, TitanLabsServer, BitRunnersServer];\r\n var NetworkGroup12 = [VitaLifeServer, HeliosLabsServer, StormTechnologiesServer, FulcrumTechnologiesServer];\r\n var NetworkGroup13 = [KuaiGongInternationalServer, FourSigmaServer, OmniTekIncorporatedServer, DarkArmyServer];\r\n var NetworkGroup14 = [PowerhouseGymServer, ClarkeIncorporatedServer, NWOServer, BladeIndustriesServer, BachmanAndAssociatesServer];\r\n var NetworkGroup15 = [FulcrumSecretTechnologiesServer, MegaCorpServer, ECorpServer, DaedalusServer];\r\n\r\n for (var i = 0; i < NetworkGroup2.length; i++) {\r\n var randomServerFromPrevGroup = NetworkGroup1[Math.floor(Math.random() * NetworkGroup1.length)];\r\n NetworkGroup2[i].serversOnNetwork.push(randomServerFromPrevGroup.ip);\r\n randomServerFromPrevGroup.serversOnNetwork.push(NetworkGroup2[i].ip);\r\n }\r\n\r\n for (var i = 0; i < NetworkGroup3.length; i++) {\r\n var randomServerFromPrevGroup = NetworkGroup2[Math.floor(Math.random() * NetworkGroup2.length)];\r\n NetworkGroup3[i].serversOnNetwork.push(randomServerFromPrevGroup.ip);\r\n randomServerFromPrevGroup.serversOnNetwork.push(NetworkGroup3[i].ip);\r\n }\r\n\r\n for (var i = 0; i < NetworkGroup4.length; i++) {\r\n var randomServerFromPrevGroup = NetworkGroup3[Math.floor(Math.random() * NetworkGroup3.length)];\r\n NetworkGroup4[i].serversOnNetwork.push(randomServerFromPrevGroup.ip);\r\n randomServerFromPrevGroup.serversOnNetwork.push(NetworkGroup4[i].ip);\r\n }\r\n\r\n for (var i = 0; i < NetworkGroup5.length; i++) {\r\n var randomServerFromPrevGroup = NetworkGroup4[Math.floor(Math.random() * NetworkGroup4.length)];\r\n NetworkGroup5[i].serversOnNetwork.push(randomServerFromPrevGroup.ip);\r\n randomServerFromPrevGroup.serversOnNetwork.push(NetworkGroup5[i].ip);\r\n }\r\n\r\n for (var i = 0; i < NetworkGroup6.length; i++) {\r\n var randomServerFromPrevGroup = NetworkGroup5[Math.floor(Math.random() * NetworkGroup5.length)];\r\n NetworkGroup6[i].serversOnNetwork.push(randomServerFromPrevGroup.ip);\r\n randomServerFromPrevGroup.serversOnNetwork.push(NetworkGroup6[i].ip);\r\n }\r\n\r\n for (var i = 0; i < NetworkGroup7.length; i++) {\r\n var randomServerFromPrevGroup = NetworkGroup6[Math.floor(Math.random() * NetworkGroup6.length)];\r\n NetworkGroup7[i].serversOnNetwork.push(randomServerFromPrevGroup.ip);\r\n randomServerFromPrevGroup.serversOnNetwork.push(NetworkGroup7[i].ip);\r\n }\r\n\r\n for (var i = 0; i < NetworkGroup8.length; i++) {\r\n var randomServerFromPrevGroup = NetworkGroup7[Math.floor(Math.random() * NetworkGroup7.length)];\r\n NetworkGroup8[i].serversOnNetwork.push(randomServerFromPrevGroup.ip);\r\n randomServerFromPrevGroup.serversOnNetwork.push(NetworkGroup8[i].ip);\r\n }\r\n\r\n for (var i = 0; i < NetworkGroup9.length; i++) {\r\n var randomServerFromPrevGroup = NetworkGroup8[Math.floor(Math.random() * NetworkGroup8.length)];\r\n NetworkGroup9[i].serversOnNetwork.push(randomServerFromPrevGroup.ip);\r\n randomServerFromPrevGroup.serversOnNetwork.push(NetworkGroup9[i].ip);\r\n }\r\n\r\n for (var i = 0; i < NetworkGroup10.length; i++) {\r\n var randomServerFromPrevGroup = NetworkGroup9[Math.floor(Math.random() * NetworkGroup9.length)];\r\n NetworkGroup10[i].serversOnNetwork.push(randomServerFromPrevGroup.ip);\r\n randomServerFromPrevGroup.serversOnNetwork.push(NetworkGroup10[i].ip);\r\n }\r\n\r\n for (var i = 0; i < NetworkGroup11.length; i++) {\r\n var randomServerFromPrevGroup = NetworkGroup10[Math.floor(Math.random() * NetworkGroup10.length)];\r\n NetworkGroup11[i].serversOnNetwork.push(randomServerFromPrevGroup.ip);\r\n randomServerFromPrevGroup.serversOnNetwork.push(NetworkGroup11[i].ip);\r\n }\r\n\r\n for (var i = 0; i < NetworkGroup12.length; i++) {\r\n var randomServerFromPrevGroup = NetworkGroup11[Math.floor(Math.random() * NetworkGroup11.length)];\r\n NetworkGroup12[i].serversOnNetwork.push(randomServerFromPrevGroup.ip);\r\n randomServerFromPrevGroup.serversOnNetwork.push(NetworkGroup12[i].ip);\r\n }\r\n\r\n for (var i = 0; i < NetworkGroup13.length; i++) {\r\n var randomServerFromPrevGroup = NetworkGroup12[Math.floor(Math.random() * NetworkGroup12.length)];\r\n NetworkGroup13[i].serversOnNetwork.push(randomServerFromPrevGroup.ip);\r\n randomServerFromPrevGroup.serversOnNetwork.push(NetworkGroup13[i].ip);\r\n }\r\n\r\n for (var i = 0; i < NetworkGroup14.length; i++) {\r\n var randomServerFromPrevGroup = NetworkGroup13[Math.floor(Math.random() * NetworkGroup13.length)];\r\n NetworkGroup14[i].serversOnNetwork.push(randomServerFromPrevGroup.ip);\r\n randomServerFromPrevGroup.serversOnNetwork.push(NetworkGroup14[i].ip);\r\n }\r\n\r\n for (var i = 0; i < NetworkGroup15.length; i++) {\r\n var randomServerFromPrevGroup = NetworkGroup14[Math.floor(Math.random() * NetworkGroup14.length)];\r\n NetworkGroup15[i].serversOnNetwork.push(randomServerFromPrevGroup.ip);\r\n randomServerFromPrevGroup.serversOnNetwork.push(NetworkGroup15[i].ip);\r\n }\r\n\r\n //Connect the first tier of servers to the player's home computer\r\n for (var i = 0; i < NetworkGroup1.length; i++) {\r\n Player.getHomeComputer().serversOnNetwork.push(NetworkGroup1[i].ip);\r\n NetworkGroup1[i].serversOnNetwork.push(Player.homeComputer);\r\n }\r\n}\r\n\r\n//Applied server growth for a single server. Returns the percentage growth\r\nfunction processSingleServerGrowth(server, numCycles) {\r\n //Server growth processed once every 450 game cycles\r\n var numServerGrowthCycles = Math.max(Math.floor(numCycles / 450), 0);\r\n\r\n //Get adjusted growth rate, which accounts for server security\r\n var growthRate = CONSTANTS.ServerBaseGrowthRate;\r\n var adjGrowthRate = 1 + (growthRate - 1) / server.hackDifficulty;\r\n if (adjGrowthRate > CONSTANTS.ServerMaxGrowthRate) {adjGrowthRate = CONSTANTS.ServerMaxGrowthRate;}\r\n\r\n //Calculate adjusted server growth rate based on parameters\r\n var serverGrowthPercentage = server.serverGrowth / 100;\r\n var numServerGrowthCyclesAdjusted = numServerGrowthCycles * serverGrowthPercentage * BitNodeMultipliers.ServerGrowthRate;\r\n\r\n //Apply serverGrowth for the calculated number of growth cycles\r\n var serverGrowth = Math.pow(adjGrowthRate, numServerGrowthCyclesAdjusted * Player.hacking_grow_mult);\r\n if (serverGrowth < 1) {\r\n console.log(\"WARN: serverGrowth calculated to be less than 1\");\r\n serverGrowth = 1;\r\n }\r\n\r\n var oldMoneyAvailable = server.moneyAvailable;\r\n server.moneyAvailable *= serverGrowth;\r\n if (server.moneyMax && isNaN(server.moneyAvailable)) {\r\n server.moneyAvailable = server.moneyMax;\r\n }\r\n if (server.moneyMax && server.moneyAvailable > server.moneyMax) {\r\n server.moneyAvailable = server.moneyMax;\r\n return server.moneyAvailable / oldMoneyAvailable;\r\n }\r\n\r\n //Growing increases server security twice as much as hacking\r\n server.fortify(2 * CONSTANTS.ServerFortifyAmount * numServerGrowthCycles);\r\n return serverGrowth;\r\n}\r\n\r\nfunction prestigeHomeComputer(homeComp) {\r\n homeComp.programs.length = 0; //Remove programs\r\n homeComp.runningScripts = [];\r\n homeComp.serversOnNetwork = [];\r\n homeComp.isConnectedTo = true;\r\n homeComp.ramUsed = 0;\r\n homeComp.programs.push(Programs.NukeProgram);\r\n\r\n //Update RAM usage on all scripts\r\n homeComp.scripts.forEach(function(script) {\r\n script.updateRamUsage();\r\n });\r\n\r\n homeComp.messages.length = 0; //Remove .lit and .msg files\r\n homeComp.messages.push(\"hackers-starting-handbook.lit\");\r\n}\r\n\r\n//List of all servers that exist in the game, indexed by their ip\r\nlet AllServers = {};\r\n\r\nfunction prestigeAllServers() {\r\n for (var member in AllServers) {\r\n delete AllServers[member];\r\n }\r\n AllServers = {};\r\n}\r\n\r\nfunction loadAllServers(saveString) {\r\n AllServers = JSON.parse(saveString, Reviver);\r\n}\r\n\r\nfunction SizeOfAllServers() {\r\n var size = 0, key;\r\n for (key in AllServers) {\r\n if (AllServers.hasOwnProperty(key)) size++;\r\n }\r\n return size;\r\n}\r\n\r\n//Add a server onto the map of all servers in the game\r\nfunction AddToAllServers(server) {\r\n var serverIp = server.ip;\r\n if (ipExists(serverIp)) {\r\n console.log(\"IP of server that's being added: \" + serverIp);\r\n console.log(\"Hostname of the server thats being added: \" + server.hostname);\r\n console.log(\"The server that already has this IP is: \" + AllServers[serverIp].hostname);\r\n throw new Error(\"Error: Trying to add a server with an existing IP\");\r\n return;\r\n }\r\n AllServers[serverIp] = server;\r\n}\r\n\r\n//Returns server object with corresponding hostname\r\n// Relatively slow, would rather not use this a lot\r\nfunction GetServerByHostname(hostname) {\r\n for (var ip in AllServers) {\r\n if (AllServers.hasOwnProperty(ip)) {\r\n if (AllServers[ip].hostname == hostname) {\r\n return AllServers[ip];\r\n }\r\n }\r\n }\r\n return null;\r\n}\r\n\r\n//Get server by IP or hostname. Returns null if invalid\r\nfunction getServer(s) {\r\n if (!isValidIPAddress(s)) {\r\n return GetServerByHostname(s);\r\n } else {\r\n return AllServers[s];\r\n }\r\n}\r\n\r\n//Debugging tool\r\nfunction PrintAllServers() {\r\n for (var ip in AllServers) {\r\n if (AllServers.hasOwnProperty(ip)) {\r\n console.log(\"Ip: \" + ip + \", hostname: \" + AllServers[ip].hostname);\r\n }\r\n }\r\n}\r\n\r\n// Directory object (folders)\r\nfunction Directory(server, parent, name) {\r\n this.s = server; //Ref to server\r\n this.p = parent; //Ref to parent directory\r\n this.c = []; //Subdirs\r\n this.n = name;\r\n this.d = parent.d + 1; //We'll only have a maximum depth of 3 or something\r\n this.scrs = []; //Holds references to the scripts in server.scripts\r\n this.pgms = [];\r\n this.msgs = [];\r\n}\r\n\r\nDirectory.prototype.createSubdir = function(name) {\r\n var subdir = new Directory(this.s, this, name);\r\n\r\n}\r\n\r\nDirectory.prototype.getPath = function(name) {\r\n var res = [];\r\n var i = this;\r\n while (i !== null) {\r\n res.unshift(i.n, \"/\");\r\n i = i.parent;\r\n }\r\n res.unshift(\"/\");\r\n return res.join(\"\");\r\n}\r\n\r\nexport {Server, AllServers, getServer, GetServerByHostname, loadAllServers,\r\n AddToAllServers, processSingleServerGrowth, initForeignServers,\r\n prestigeAllServers, prestigeHomeComputer};\r\n","import {Augmentations, AugmentationNames,\r\n PlayerOwnedAugmentation} from \"./Augmentations.js\";\r\nimport {BitNodeMultipliers} from \"./BitNode.js\";\r\nimport {CONSTANTS} from \"./Constants.js\";\r\nimport {Engine} from \"./engine.js\";\r\nimport {FactionInfos} from \"./FactionInfo.js\";\r\nimport {Locations} from \"./Location.js\";\r\nimport {HackingMission, setInMission} from \"./Missions.js\";\r\nimport {Player} from \"./Player.js\";\r\nimport {Settings} from \"./Settings.js\";\r\n\r\nimport {dialogBoxCreate} from \"../utils/DialogBox.js\";\r\nimport {factionInvitationBoxCreate} from \"../utils/FactionInvitationBox.js\";\r\nimport {clearEventListeners, createElement,\r\n removeChildrenFromElement} from \"../utils/HelperFunctions.js\";\r\nimport {Reviver, Generic_toJSON,\r\n Generic_fromJSON} from \"../utils/JSONReviver.js\";\r\nimport numeral from \"numeral/min/numeral.min\";\r\nimport {formatNumber} from \"../utils/StringHelperFunctions.js\";\r\nimport {yesNoBoxCreate, yesNoBoxGetYesButton,\r\n yesNoBoxGetNoButton, yesNoBoxClose} from \"../utils/YesNoBox.js\";\r\n\r\nfunction Faction(name=\"\") {\r\n this.name \t\t\t\t= name;\r\n this.augmentations \t\t= []; //Name of augmentation only\r\n\r\n //Player-related properties for faction\r\n this.isMember \t\t\t= false; \t//Whether player is member\r\n this.isBanned = false; //Whether or not player is banned from joining this faction\r\n this.playerReputation \t= 0; \t\t//\"Reputation\" within faction\r\n this.alreadyInvited = false;\r\n\r\n //Faction favor\r\n this.favor = 0;\r\n this.rolloverRep = 0;\r\n};\r\n\r\nFaction.prototype.getInfo = function() {\r\n const info = FactionInfos[this.name];\r\n if(info == null) {\r\n throw new Error(\"Missing faction from FactionInfos: \" + this.name+\" this probably means the faction got corrupted somehow\");\r\n }\r\n return info;\r\n}\r\n\r\nFaction.prototype.gainFavor = function() {\r\n if (this.favor == null || this.favor == undefined) {this.favor = 0;}\r\n if (this.rolloverRep == null || this.rolloverRep == undefined) {this.rolloverRep = 0;}\r\n var res = this.getFavorGain();\r\n if (res.length != 2) {\r\n console.log(\"Error: invalid result from getFavorGain() function\");\r\n return;\r\n }\r\n this.favor += res[0];\r\n this.rolloverRep = res[1];\r\n}\r\n\r\n//Returns an array with [How much favor would be gained, how much favor would be left over]\r\nFaction.prototype.getFavorGain = function() {\r\n if (this.favor == null || this.favor == undefined) {this.favor = 0;}\r\n if (this.rolloverRep == null || this.rolloverRep == undefined) {this.rolloverRep = 0;}\r\n var favorGain = 0, rep = this.playerReputation + this.rolloverRep;\r\n var reqdRep = CONSTANTS.FactionReputationToFavorBase *\r\n Math.pow(CONSTANTS.FactionReputationToFavorMult, this.favor);\r\n while(rep > 0) {\r\n if (rep >= reqdRep) {\r\n ++favorGain;\r\n rep -= reqdRep;\r\n } else {\r\n break;\r\n }\r\n reqdRep *= CONSTANTS.FactionReputationToFavorMult;\r\n }\r\n return [favorGain, rep];\r\n}\r\n\r\n//Adds all Augmentations to this faction.\r\nFaction.prototype.addAllAugmentations = function() {\r\n this.augmentations.length = 0;\r\n for (var name in Augmentations) {\r\n if (Augmentations.hasOwnProperty(name)) {\r\n this.augmentations.push(name);\r\n }\r\n }\r\n}\r\n\r\nFaction.prototype.toJSON = function() {\r\n\treturn Generic_toJSON(\"Faction\", this);\r\n}\r\n\r\nFaction.fromJSON = function(value) {\r\n\treturn Generic_fromJSON(Faction, value.data);\r\n}\r\n\r\nReviver.constructors.Faction = Faction;\r\n\r\n//Map of factions indexed by faction name\r\nlet Factions = {}\r\n\r\nfunction loadFactions(saveString) {\r\n Factions = JSON.parse(saveString, Reviver);\r\n}\r\n\r\nfunction AddToFactions(faction) {\r\n\tvar name = faction.name;\r\n\tFactions[name] = faction;\r\n}\r\n\r\nfunction factionExists(name) {\r\n return Factions.hasOwnProperty(name);\r\n}\r\n\r\n//TODO Augmentation price and rep requirement mult are 1 for everything right now,\r\n// This might change in the future for balance\r\nfunction initFactions() {\r\n for(const name in FactionInfos) {\r\n resetFaction(new Faction(name)); \r\n }\r\n}\r\n\r\n//Resets a faction during (re-)initialization. Saves the favor in the new\r\n//Faction object and deletes the old Faction Object from \"Factions\". Then\r\n//reinserts the new Faction object\r\nfunction resetFaction(newFactionObject) {\r\n if (!(newFactionObject instanceof Faction)) {\r\n throw new Error(\"Invalid argument 'newFactionObject' passed into resetFaction()\");\r\n }\r\n var factionName = newFactionObject.name;\r\n if (factionExists(factionName)) {\r\n newFactionObject.favor = Factions[factionName].favor;\r\n delete Factions[factionName];\r\n }\r\n AddToFactions(newFactionObject);\r\n}\r\n\r\nfunction inviteToFaction(faction) {\r\n if (Settings.SuppressFactionInvites) {\r\n faction.alreadyInvited = true;\r\n Player.factionInvitations.push(faction.name);\r\n if (Engine.currentPage === Engine.Page.Factions) {\r\n Engine.loadFactionsContent();\r\n }\r\n } else {\r\n factionInvitationBoxCreate(faction);\r\n }\r\n}\r\n\r\nfunction joinFaction(faction) {\r\n\tfaction.isMember = true;\r\n Player.factions.push(faction.name);\r\n const factionInfo = faction.getInfo();\r\n\r\n //Determine what factions you are banned from now that you have joined this faction\r\n for(const i in factionInfo.enemies) {\r\n const enemy = factionInfo.enemies[i];\r\n Factions[enemy].isBanned = true;\r\n }\r\n}\r\n\r\n//Displays the HTML content for a specific faction\r\nfunction displayFactionContent(factionName) {\r\n\tvar faction = Factions[factionName];\r\n if (faction == null) {\r\n throw new Error(\"Invalid factionName passed into displayFactionContent: \" + factionName);\r\n }\r\n var factionInfo = faction.getInfo();\r\n\r\n removeChildrenFromElement(Engine.Display.factionContent);\r\n var elements = [];\r\n\r\n //Header and faction info\r\n elements.push(createElement(\"h1\", {\r\n innerText:factionName\r\n }));\r\n elements.push(createElement(\"pre\", {\r\n innerHTML:\"<i>\" + factionInfo.infoText + \"</i>\"\r\n }));\r\n elements.push(createElement(\"p\", {\r\n innerText:\"---------------\",\r\n }));\r\n\r\n //Faction reputation and favor\r\n var favorGain = faction.getFavorGain();\r\n if (favorGain.length != 2) {favorGain = 0;}\r\n favorGain = favorGain[0];\r\n elements.push(createElement(\"p\", {\r\n innerText: \"Reputation: \" + formatNumber(faction.playerReputation, 4),\r\n tooltip:\"You will earn \" + formatNumber(favorGain, 0) +\r\n \" faction favor upon resetting after installing an Augmentation\"\r\n }))\r\n elements.push(createElement(\"p\", {\r\n innerText:\"---------------\",\r\n }));\r\n elements.push(createElement(\"p\", {\r\n innerText:\"Faction Favor: \" + formatNumber(faction.favor, 0),\r\n tooltip:\"Faction favor increases the rate at which \" +\r\n \"you earn reputation for this faction by 1% per favor. Faction favor \" +\r\n \"is gained whenever you reset after installing an Augmentation. The amount of \" +\r\n \"favor you gain depends on how much reputation you have with the faction\"\r\n }));\r\n elements.push(createElement(\"p\", {\r\n innerText:\"---------------\",\r\n }));\r\n\r\n //Faction Work Description Text\r\n elements.push(createElement(\"pre\", {\r\n id:\"faction-work-description-text\",\r\n innerText:\"Perform work/carry out assignments for your faction to help further its cause! By doing so \" +\r\n \"you will earn reputation for your faction. You will also gain reputation passively over time, \" +\r\n \"although at a very slow rate. Earning reputation will allow you to purchase Augmentations \" +\r\n \"through this faction, which are powerful upgrades that enhance your abilities. Note that you cannot \" +\r\n\t\t \"use your terminal or create scripts when you are performing a task!\"\r\n }));\r\n elements.push(createElement(\"br\"));\r\n\r\n //Hacking Mission Option\r\n var hackMissionDiv = createElement(\"div\", {\r\n id:\"faction-hack-mission-div\", class:\"faction-work-div\",\r\n });\r\n var hackMissionDivWrapper = createElement(\"div\", {class:\"faction-work-div-wrapper\"});\r\n hackMissionDiv.appendChild(hackMissionDivWrapper);\r\n hackMissionDivWrapper.appendChild(createElement(\"a\", {\r\n class:\"a-link-button\", innerText:\"Hacking Mission\",\r\n clickListener:()=>{\r\n Engine.loadMissionContent();\r\n var mission = new HackingMission(faction.playerReputation, faction);\r\n setInMission(true, mission); //Sets inMission flag to true\r\n mission.init();\r\n return false;\r\n }\r\n }));\r\n hackMissionDivWrapper.appendChild(createElement(\"p\", {\r\n innerText:\"Attempt a hacking mission for your faction. \" +\r\n \"A mission is a mini game that, if won, earns you \" +\r\n \"significant reputation with this faction. (Recommended hacking level: 200+)\"\r\n }));\r\n elements.push(hackMissionDiv);\r\n\r\n //Hacking Contracts Option\r\n\tvar hackDiv = createElement(\"div\", {\r\n id:\"faction-hack-div\", class:\"faction-work-div\",\r\n });\r\n var hackDivWrapper = createElement(\"div\", {class:\"faction-work-div-wrapper\"});\r\n hackDiv.appendChild(hackDivWrapper);\r\n hackDivWrapper.appendChild(createElement(\"a\", {\r\n class:\"a-link-button\", innerText:\"Hacking Contracts\",\r\n clickListener:()=>{\r\n Player.startFactionHackWork(faction);\r\n return false;\r\n }\r\n }));\r\n hackDivWrapper.appendChild(createElement(\"p\", {\r\n innerText:\"Complete hacking contracts for your faction. \" +\r\n \"Your effectiveness, which determines how much \" +\r\n \"reputation you gain for this faction, is based on your hacking skill. \" +\r\n \"You will gain hacking exp.\"\r\n }));\r\n elements.push(hackDiv);\r\n\r\n //Field Work Option\r\n\tvar fieldWorkDiv = createElement(\"div\", {\r\n id:\"faction-fieldwork-div\", class:\"faction-work-div\"\r\n });\r\n var fieldWorkDivWrapper = createElement(\"div\", {class:\"faction-work-div-wrapper\"});\r\n fieldWorkDiv.appendChild(fieldWorkDivWrapper);\r\n fieldWorkDivWrapper.appendChild(createElement(\"a\", {\r\n class:\"a-link-button\", innerText:\"Field Work\",\r\n clickListener:()=>{\r\n Player.startFactionFieldWork(faction);\r\n return false;\r\n }\r\n }));\r\n fieldWorkDivWrapper.appendChild(createElement(\"p\", {\r\n innerText:\"Carry out field missions for your faction. \" +\r\n \"Your effectiveness, which determines how much \" +\r\n \"reputation you gain for this faction, is based on all of your stats. \" +\r\n \"You will gain exp for all stats.\"\r\n }));\r\n elements.push(fieldWorkDiv);\r\n\r\n //Security Work Option\r\n\tvar securityWorkDiv = createElement(\"div\", {\r\n id:\"faction-securitywork-div\", class:\"faction-work-div\"\r\n });\r\n var securityWorkDivWrapper = createElement(\"div\", {class:\"faction-work-div-wrapper\"});\r\n securityWorkDiv.appendChild(securityWorkDivWrapper);\r\n securityWorkDivWrapper.appendChild(createElement(\"a\", {\r\n class:\"a-link-button\", innerText:\"Security Work\",\r\n clickListener:()=>{\r\n Player.startFactionSecurityWork(faction);\r\n return false;\r\n }\r\n }));\r\n securityWorkDivWrapper.appendChild(createElement(\"p\", {\r\n innerText:\"Serve in a security detail for your faction. \" +\r\n \"Your effectiveness, which determines how much \" +\r\n \"reputation you gain for this faction, is based on your combat stats. \" +\r\n \"You will gain exp for all combat stats.\"\r\n }));\r\n elements.push(securityWorkDiv);\r\n\r\n //Donate for reputation\r\n var donateDiv = createElement(\"div\", {\r\n id:\"faction-donate-div\", class:\"faction-work-div\"\r\n });\r\n var donateDivWrapper = createElement(\"div\", {class:\"faction-work-div-wrapper\"});\r\n donateDiv.appendChild(donateDivWrapper);\r\n var donateRepGain = createElement(\"p\", {\r\n innerText:\"This donation will result in 0 reputation gain\"\r\n });\r\n var donateAmountInput = createElement(\"input\", {\r\n placeholder:\"Donation amount\",\r\n inputListener:()=>{\r\n var amt = parseFloat(donateAmountInput.value);\r\n if (isNaN(amt) || amt < 0) {\r\n donateRepGain.innerText = \"Invalid donate amount entered!\";\r\n } else {\r\n var repGain = amt / 1e6 * Player.faction_rep_mult;\r\n donateRepGain.innerText = \"This donation will result in \" +\r\n formatNumber(repGain, 3) + \" reputation gain\";\r\n }\r\n },\r\n });\r\n donateDivWrapper.appendChild(createElement(\"a\", {\r\n class:\"a-link-button\", innerText:\"Donate Money\",\r\n clickListener:()=>{\r\n var amt = parseFloat(donateAmountInput.value);\r\n if (isNaN(amt) || amt < 0) {\r\n dialogBoxCreate(\"Invalid amount entered!\");\r\n } else if (Player.money.lt(amt)) {\r\n dialogBoxCreate(\"You cannot afford to donate this much money!\");\r\n } else {\r\n Player.loseMoney(amt);\r\n var repGain = amt / 1e6 * Player.faction_rep_mult;\r\n faction.playerReputation += repGain;\r\n dialogBoxCreate(\"You just donated \" + numeral(amt).format(\"$0.000a\") + \" to \" +\r\n faction.name + \" to gain \" + formatNumber(repGain, 3) + \" reputation\");\r\n displayFactionContent(factionName);\r\n }\r\n }\r\n }));\r\n donateDivWrapper.appendChild(donateAmountInput);\r\n donateDivWrapper.appendChild(donateRepGain);\r\n elements.push(donateDiv);\r\n\r\n //Purchase Augmentations\r\n elements.push(createElement(\"pre\", {\r\n innerHTML: \"<br>As your reputation with this faction rises, you will \" +\r\n \"unlock Augmentations, which you can purchase to enhance \" +\r\n \"your abilities.<br><br>\"\r\n }));\r\n elements.push(createElement(\"a\", {\r\n class:\"a-link-button\", innerText:\"Purchase Augmentations\",\r\n clickListener:()=>{\r\n Engine.hideAllContent();\r\n Engine.Display.factionAugmentationsContent.style.display = \"block\";\r\n\r\n\r\n displayFactionAugmentations(factionName);\r\n return false;\r\n }\r\n }));\r\n\r\n //Gang (BitNode-2)\r\n if (Player.bitNodeN == 2 && (factionName == \"Slum Snakes\" || factionName == \"Tetrads\" ||\r\n factionName == \"The Syndicate\" || factionName == \"The Dark Army\" || factionName == \"Speakers for the Dead\" ||\r\n factionName == \"NiteSec\" || factionName == \"The Black Hand\")) {\r\n //Set everything else to invisible\r\n hackMissionDiv.style.display = \"none\";\r\n hackDiv.style.display = \"none\";\r\n fieldWorkDiv.style.display = \"none\";\r\n securityWorkDiv.style.display = \"none\";\r\n donateDiv.style.display = \"none\";\r\n\r\n //Create the 'Manage Gang' button\r\n var gangDiv = createElement(\"div\", {\r\n id:\"faction-gang-div\", class:\"faction-work-div\", display:\"inline\"\r\n });\r\n var gangDivWrapper = createElement(\"div\", {class:\"faction-work-div-wrapper\"});\r\n gangDiv.appendChild(gangDivWrapper);\r\n gangDivWrapper.appendChild(createElement(\"a\", {\r\n class:\"a-link-button\", innerText:\"Manage Gang\",\r\n clickListener:()=>{\r\n if (!Player.inGang()) {\r\n var yesBtn = yesNoBoxGetYesButton(), noBtn = yesNoBoxGetNoButton();\r\n yesBtn.innerHTML = \"Create Gang\";\r\n noBtn.innerHTML = \"Cancel\";\r\n yesBtn.addEventListener(\"click\", () => {\r\n var hacking = false;\r\n if (factionName === \"NiteSec\" || factionName === \"The Black Hand\") {hacking = true;}\r\n Player.startGang(factionName, hacking);\r\n Engine.loadGangContent();\r\n yesNoBoxClose();\r\n });\r\n noBtn.addEventListener(\"click\", () => {\r\n yesNoBoxClose();\r\n });\r\n yesNoBoxCreate(\"Would you like to create a new Gang with \" + factionName + \"?<br><br>\" +\r\n \"Note that this will prevent you from creating a Gang with any other Faction until \" +\r\n \"this BitNode is destroyed. There are NO differences between the Factions you can \" +\r\n \"create a Gang with and each of these Factions have all Augmentations available\");\r\n } else {\r\n Engine.loadGangContent();\r\n }\r\n }\r\n }));\r\n gangDivWrapper.appendChild(createElement(\"p\", {\r\n innerText:\"Create and manage a gang for this Faction. \" +\r\n \"Gangs will earn you money and faction reputation.\"\r\n }));\r\n //Manage Gang button goes before Faction work stuff\r\n elements.splice(7, 1, gangDiv);\r\n\r\n if (Player.inGang() && Player.gang.facName != factionName) {\r\n //If the player has a gang but its not for this faction\r\n gangDiv.style.display = \"none\";\r\n }\r\n //Display all elements\r\n for (var i = 0; i < elements.length; ++i) {\r\n Engine.Display.factionContent.appendChild(elements[i]);\r\n }\r\n return;\r\n }\r\n\r\n\tif (!faction.isMember) {\r\n\t\tthrow new Error(\"Not a member of this faction, cannot display faction information\");\r\n\t}\r\n\r\n donateDiv.style.display = faction.favor >= (150 * BitNodeMultipliers.RepToDonateToFaction) ? \"inline\" : \"none\";\r\n\r\n hackMissionDiv.style.display = factionInfo.offerHackingMission ? \"inline\": \"none\";\r\n hackDiv.style.display = factionInfo.offerHackingWork ? \"inline\" : \"none\";\r\n fieldWorkDiv.style.display = factionInfo.offerFieldWork ? \"inline\" : \"none\";\r\n securityWorkDiv.style.display = factionInfo.offerSecurityWork ? \"inline\" : \"none\";\r\n\r\n //Display all elements\r\n for (var i = 0; i < elements.length; ++i) {\r\n Engine.Display.factionContent.appendChild(elements[i]);\r\n }\r\n}\r\n\r\nvar confirmingPurchases = true;\r\nvar sortOption = null;\r\nfunction displayFactionAugmentations(factionName) {\r\n var faction = Factions[factionName];\r\n if (faction == null) {\r\n throw new Error(\"Could not find faction \" + factionName + \" in displayFactionAugmentations\");\r\n }\r\n\r\n removeChildrenFromElement(Engine.Display.factionAugmentationsContent);\r\n var elements = [];\r\n\r\n //Back button\r\n elements.push(createElement(\"a\", {\r\n innerText:\"Back\", class:\"a-link-button\",\r\n clickListener:()=>{\r\n Engine.loadFactionContent();\r\n displayFactionContent(factionName);\r\n return false;\r\n }\r\n }));\r\n\r\n //Header text\r\n elements.push(createElement(\"h1\", {innerText:\"Faction Augmentations\"}));\r\n elements.push(createElement(\"p\", {\r\n id:\"faction-augmentations-page-desc\",\r\n innerHTML:\"Lists all Augmentations that are available to purchase from \" + factionName + \"<br><br>\" +\r\n \"Augmentations are powerful upgrades that will enhance your abilities.\"\r\n }));\r\n\r\n //Confirming not confirming button\r\n elements.push(createElement(\"label\", {\r\n for:\"faction-augmentations-confirming-checkbox\",innerText:\"Confirm Purchases\",\r\n color:\"white\", margin:\"4px\", padding:\"4px\",\r\n }));\r\n var confirmingPurchasesCheckbox = createElement(\"input\", {\r\n type:\"checkbox\", id:\"faction-augmentations-confirming-checkbox\", checked:confirmingPurchases,\r\n margin:\"4px\", padding:\"4px\",\r\n clickListener:()=>{\r\n confirmingPurchases = confirmingPurchasesCheckbox.checked;\r\n }\r\n });\r\n elements.push(confirmingPurchasesCheckbox);\r\n elements.push(createElement(\"br\"));\r\n elements.push(createElement(\"br\"));\r\n\r\n //Augmentations List\r\n var augmentationsList = createElement(\"ul\");\r\n\r\n //Sort buttons\r\n var sortByCostBtn = createElement(\"a\", {\r\n innerText:\"Sort by Cost\", class:\"a-link-button\",\r\n clickListener:()=>{\r\n sortOption = \"cost\";\r\n var augs = faction.augmentations.slice();\r\n augs.sort((augName1, augName2)=>{\r\n var aug1 = Augmentations[augName1], aug2 = Augmentations[augName2];\r\n if (aug1 == null || aug2 == null) {\r\n throw new Error(\"Invalid Augmentation Names\");\r\n }\r\n return aug1.baseCost - aug2.baseCost;\r\n });\r\n removeChildrenFromElement(augmentationsList);\r\n createFactionAugmentationDisplayElements(augmentationsList, augs, faction);\r\n }\r\n });\r\n var sortByRepBtn = createElement(\"a\", {\r\n innerText:\"Sort by Reputation\", class:\"a-link-button\",\r\n clickListener:()=>{\r\n sortOption = \"reputation\";\r\n var augs = faction.augmentations.slice();\r\n augs.sort((augName1, augName2)=>{\r\n var aug1 = Augmentations[augName1], aug2 = Augmentations[augName2];\r\n if (aug1 == null || aug2 == null) {\r\n throw new Error(\"Invalid Augmentation Names\");\r\n }\r\n return aug1.baseRepRequirement - aug2.baseRepRequirement;\r\n });\r\n removeChildrenFromElement(augmentationsList);\r\n createFactionAugmentationDisplayElements(augmentationsList, augs, faction);\r\n }\r\n });\r\n var defaultSortBtn = createElement(\"a\", {\r\n innerText:\"Sort by Default Order\", class:\"a-link-button\",\r\n clickListener:()=>{\r\n sortOption = \"default\";\r\n removeChildrenFromElement(augmentationsList);\r\n createFactionAugmentationDisplayElements(augmentationsList, faction.augmentations, faction);\r\n }\r\n });\r\n elements.push(sortByCostBtn);\r\n elements.push(sortByRepBtn);\r\n elements.push(defaultSortBtn);\r\n switch(sortOption) {\r\n case \"cost\":\r\n sortByCostBtn.click();\r\n break;\r\n case \"reputation\":\r\n sortByRepBtn.click();\r\n break;\r\n default:\r\n defaultSortBtn.click();\r\n break;\r\n }\r\n\r\n elements.push(augmentationsList);\r\n\r\n for (var i = 0; i < elements.length; ++i) {\r\n Engine.Display.factionAugmentationsContent.appendChild(elements[i]);\r\n }\r\n}\r\n\r\n//Takes in an array of Augmentation Names, constructs DOM elements\r\n//to list them on the faction page, and appends them to the given\r\n//DOM element\r\n// @augmentationsList DOM List to append Aug DOM elements to\r\n// @augs Array of Aug names\r\n// @faction Faction for which to display Augmentations\r\nfunction createFactionAugmentationDisplayElements(augmentationsList, augs, faction) {\r\n const factionInfo = faction.getInfo();\r\n\r\n for (var i = 0; i < augs.length; ++i) {\r\n (function () {\r\n var aug = Augmentations[augs[i]];\r\n if (aug == null) {\r\n throw new Error(\"Invalid Augmentation when trying to create Augmentation display Elements\");\r\n }\r\n var owned = false;\r\n for (var j = 0; j < Player.queuedAugmentations.length; ++j) {\r\n if (Player.queuedAugmentations[j].name == aug.name) {\r\n owned = true;\r\n break;\r\n }\r\n }\r\n for (var j = 0; j < Player.augmentations.length; ++j) {\r\n if (Player.augmentations[j].name == aug.name) {\r\n owned = true;\r\n break;\r\n }\r\n }\r\n\r\n var item = createElement(\"li\");\r\n var span = createElement(\"span\", {display:\"inline-block\"});\r\n var aDiv = createElement(\"div\", {tooltip:aug.info});\r\n var aElem = createElement(\"a\", {\r\n innerText:aug.name, display:\"inline\",\r\n clickListener:()=>{\r\n if (confirmingPurchases) {\r\n purchaseAugmentationBoxCreate(aug, faction);\r\n } else {\r\n purchaseAugmentation(aug, faction);\r\n }\r\n return false;\r\n }\r\n });\r\n if (aug.name == AugmentationNames.NeuroFluxGovernor) {\r\n aElem.innerText += \" - Level \" + (getNextNeurofluxLevel());\r\n }\r\n var pElem = createElement(\"p\", {\r\n display:\"inline\",\r\n })\r\n var req = aug.baseRepRequirement * factionInfo.augmentationRepRequirementMult;\r\n var hasPrereqs = hasAugmentationPrereqs(aug);\r\n if (!hasPrereqs) {\r\n aElem.setAttribute(\"class\", \"a-link-button-inactive\");\r\n pElem.innerHTML = \"LOCKED (Requires \" + aug.prereqs.join(\",\") + \" as prerequisite(s))\";\r\n pElem.style.color = \"red\";\r\n } else if (aug.name != AugmentationNames.NeuroFluxGovernor && (aug.owned || owned)) {\r\n aElem.setAttribute(\"class\", \"a-link-button-inactive\");\r\n pElem.innerHTML = \"ALREADY OWNED\";\r\n } else if (faction.playerReputation >= req) {\r\n aElem.setAttribute(\"class\", \"a-link-button\");\r\n pElem.innerHTML = \"UNLOCKED - \" + numeral(aug.baseCost * factionInfo.augmentationPriceMult).format(\"$0.000a\");\r\n } else {\r\n aElem.setAttribute(\"class\", \"a-link-button-inactive\");\r\n pElem.innerHTML = \"LOCKED (Requires \" + formatNumber(req, 1) + \" faction reputation) - \" + numeral(aug.baseCost * factionInfo.augmentationPriceMult).format(\"$0.000a\");\r\n pElem.style.color = \"red\";\r\n }\r\n aDiv.appendChild(aElem);\r\n span.appendChild(aDiv);\r\n span.appendChild(pElem);\r\n item.appendChild(span);\r\n augmentationsList.appendChild(item);\r\n }()); //Immediate invocation closure\r\n }\r\n}\r\n\r\nfunction purchaseAugmentationBoxCreate(aug, fac) {\r\n const factionInfo = fac.getInfo();\r\n var yesBtn = yesNoBoxGetYesButton(), noBtn = yesNoBoxGetNoButton();\r\n yesBtn.innerHTML = \"Purchase\";\r\n noBtn.innerHTML = \"Cancel\";\r\n yesBtn.addEventListener(\"click\", function() {\r\n purchaseAugmentation(aug, fac);\r\n });\r\n noBtn.addEventListener(\"click\", function() {\r\n yesNoBoxClose();\r\n });\r\n\r\n yesNoBoxCreate(\"<h2>\" + aug.name + \"</h2><br>\" +\r\n aug.info + \"<br><br>\" +\r\n \"<br>Would you like to purchase the \" + aug.name + \" Augmentation for $\" +\r\n formatNumber(aug.baseCost * factionInfo.augmentationPriceMult, 2) + \"?\");\r\n}\r\n\r\n//Returns a boolean indicating whether the player has the prerequisites for the\r\n//specified Augmentation\r\nfunction hasAugmentationPrereqs(aug) {\r\n var hasPrereqs = true;\r\n if (aug.prereqs && aug.prereqs.length > 0) {\r\n for (var i = 0; i < aug.prereqs.length; ++i) {\r\n var prereqAug = Augmentations[aug.prereqs[i]];\r\n if (prereqAug == null) {\r\n console.log(\"ERROR: Invalid prereq Augmentation: \" + aug.prereqs[i]);\r\n continue;\r\n }\r\n if (prereqAug.owned === false) {\r\n hasPrereqs = false;\r\n\r\n //Check if the aug is purchased\r\n for (var j = 0; j < Player.queuedAugmentations.length; ++j) {\r\n if (Player.queuedAugmentations[j].name === prereqAug.name) {\r\n hasPrereqs = true;\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n return hasPrereqs;\r\n}\r\n\r\nfunction purchaseAugmentation(aug, fac, sing=false) {\r\n const factionInfo = fac.getInfo();\r\n var hasPrereqs = hasAugmentationPrereqs(aug);\r\n if (!hasPrereqs) {\r\n var txt = \"You must first purchase or install \" + aug.prereqs.join(\",\") + \" before you can \" +\r\n \"purchase this one.\";\r\n if (sing) {return txt;} else {dialogBoxCreate(txt);}\r\n } else if (Player.money.lt(aug.baseCost * factionInfo.augmentationPriceMult)) {\r\n let txt = \"You don't have enough money to purchase \" + aug.name;\r\n if (sing) {return txt;}\r\n dialogBoxCreate(txt);\r\n } else if (fac.playerReputation < aug.baseRepRequirement) {\r\n let txt = \"You don't have enough faction reputation to purchase \" + aug.name;\r\n if (sing) {return txt;}\r\n dialogBoxCreate(txt);\r\n } else if (Player.money.gte(aug.baseCost * factionInfo.augmentationPriceMult)) {\r\n if (Player.firstAugPurchased === false) {\r\n Player.firstAugPurchased = true;\r\n document.getElementById(\"augmentations-tab\").style.display = \"list-item\";\r\n document.getElementById(\"character-menu-header\").click();\r\n document.getElementById(\"character-menu-header\").click();\r\n }\r\n\r\n var queuedAugmentation = new PlayerOwnedAugmentation(aug.name);\r\n if (aug.name == AugmentationNames.NeuroFluxGovernor) {\r\n queuedAugmentation.level = getNextNeurofluxLevel();\r\n }\r\n Player.queuedAugmentations.push(queuedAugmentation);\r\n\r\n Player.loseMoney((aug.baseCost * factionInfo.augmentationPriceMult));\r\n\r\n //If you just purchased Neuroflux Governor, recalculate the cost\r\n if (aug.name == AugmentationNames.NeuroFluxGovernor) {\r\n var nextLevel = getNextNeurofluxLevel();\r\n --nextLevel;\r\n var mult = Math.pow(CONSTANTS.NeuroFluxGovernorLevelMult, nextLevel);\r\n aug.baseRepRequirement = 500 * mult * CONSTANTS.AugmentationRepMultiplier * BitNodeMultipliers.AugmentationRepCost;\r\n aug.baseCost = 750e3 * mult * CONSTANTS.AugmentationCostMultiplier * BitNodeMultipliers.AugmentationMoneyCost;\r\n\r\n for (var i = 0; i < Player.queuedAugmentations.length-1; ++i) {\r\n aug.baseCost *= CONSTANTS.MultipleAugMultiplier;\r\n }\r\n }\r\n\r\n for (var name in Augmentations) {\r\n if (Augmentations.hasOwnProperty(name)) {\r\n Augmentations[name].baseCost *= CONSTANTS.MultipleAugMultiplier;\r\n }\r\n }\r\n\r\n if (sing) {\r\n return \"You purchased \" + aug.name;\r\n } else {\r\n dialogBoxCreate(\"You purchased \" + aug.name + \". It's enhancements will not take \" +\r\n \"effect until they are installed. To install your augmentations, go to the \" +\r\n \"'Augmentations' tab on the left-hand navigation menu. Purchasing additional \" +\r\n \"augmentations will now be more expensive.\");\r\n }\r\n\r\n displayFactionAugmentations(fac.name);\r\n } else {\r\n dialogBoxCreate(\"Hmm, something went wrong when trying to purchase an Augmentation. \" +\r\n \"Please report this to the game developer with an explanation of how to \" +\r\n \"reproduce this.\");\r\n }\r\n yesNoBoxClose();\r\n}\r\n\r\nfunction getNextNeurofluxLevel() {\r\n var aug = Augmentations[AugmentationNames.NeuroFluxGovernor];\r\n if (aug == null) {\r\n for (var i = 0; i < Player.augmentations.length; ++i) {\r\n if (Player.augmentations[i].name == AugmentationNames.NeuroFluxGovernor) {\r\n aug = Player.augmentations[i];\r\n }\r\n }\r\n if (aug == null) {\r\n console.log(\"WARNING: Could not find NeuroFlux Governor aug. This is OK if \" +\r\n \"it happens during the loading/initialization of the game, but probably \" +\r\n \"indicates something seriously wrong at other times\");\r\n return 1;\r\n }\r\n }\r\n var nextLevel = aug.level + 1;\r\n for (var i = 0; i < Player.queuedAugmentations.length; ++i) {\r\n if (Player.queuedAugmentations[i].name == AugmentationNames.NeuroFluxGovernor) {\r\n ++nextLevel;\r\n }\r\n }\r\n return nextLevel;\r\n}\r\n\r\nfunction processPassiveFactionRepGain(numCycles) {\r\n var numTimesGain = (numCycles / 600) * Player.faction_rep_mult;\r\n for (var name in Factions) {\r\n\t\tif (Factions.hasOwnProperty(name)) {\r\n\t\t\tvar faction = Factions[name];\r\n\r\n\t\t\t//TODO Get hard value of 1 rep per \"rep gain cycle\"\" for now..\r\n //maybe later make this based on\r\n //a player's 'status' like how powerful they are and how much money they have\r\n if (faction.isMember) {faction.playerReputation += (numTimesGain * BitNodeMultipliers.FactionPassiveRepGain);}\r\n\t\t}\r\n\t}\r\n}\r\n\r\nexport {getNextNeurofluxLevel, Factions, initFactions, inviteToFaction,\r\n joinFaction, displayFactionContent, processPassiveFactionRepGain,\r\n loadFactions, Faction, purchaseAugmentation, factionExists};\r\n","import {clearEventListeners} from \"./HelperFunctions.js\";\r\n/* Generic Yes-No Pop-up box\r\n * Can be used to create pop-up boxes that require a yes/no response from player\r\n */\r\nvar yesNoBoxOpen = false;\r\nfunction yesNoBoxClose() {\r\n var container = document.getElementById(\"yes-no-box-container\");\r\n if (container) {\r\n container.style.display = \"none\";\r\n } else {\r\n console.log(\"ERROR: Container not found for YesNoBox\");\r\n }\r\n yesNoBoxOpen = false;\r\n return false; //So that 'return yesNoBoxClose()' is return false in event listeners\r\n}\r\n\r\nfunction yesNoBoxGetYesButton() {\r\n return clearEventListeners(\"yes-no-box-yes\");\r\n}\r\n\r\nfunction yesNoBoxGetNoButton() {\r\n return clearEventListeners(\"yes-no-box-no\");\r\n}\r\n\r\nfunction yesNoBoxCreate(txt) {\r\n if (yesNoBoxOpen) {return false;} //Already open\r\n yesNoBoxOpen = true;\r\n var textElement = document.getElementById(\"yes-no-box-text\");\r\n if (textElement) {\r\n textElement.innerHTML = txt;\r\n }\r\n\r\n var c = document.getElementById(\"yes-no-box-container\");\r\n if (c) {\r\n c.style.display = \"block\";\r\n } else {\r\n console.log(\"ERROR: Container not found for YesNoBox\");\r\n }\r\n return true;\r\n}\r\n\r\n/* Generic Yes-No POp-up Box with Text input */\r\nfunction yesNoTxtInpBoxClose() {\r\n var c = document.getElementById(\"yes-no-text-input-box-container\");\r\n if (c) {\r\n c.style.display = \"none\";\r\n } else {\r\n console.log(\"ERROR: Container not found for YesNoTextInputBox\");\r\n }\r\n yesNoBoxOpen = false;\r\n document.getElementById(\"yes-no-text-input-box-input\").value = \"\";\r\n return false;\r\n}\r\n\r\nfunction yesNoTxtInpBoxGetYesButton() {\r\n return clearEventListeners(\"yes-no-text-input-box-yes\");\r\n}\r\n\r\nfunction yesNoTxtInpBoxGetNoButton() {\r\n return clearEventListeners(\"yes-no-text-input-box-no\");\r\n}\r\n\r\nfunction yesNoTxtInpBoxGetInput() {\r\n var val = document.getElementById(\"yes-no-text-input-box-input\").value;\r\n val = val.replace(/\\s+/g, '');\r\n return val;\r\n}\r\n\r\nfunction yesNoTxtInpBoxCreate(txt) {\r\n yesNoBoxOpen = true;\r\n var txtE = document.getElementById(\"yes-no-text-input-box-text\");\r\n if (txtE) {\r\n txtE.innerHTML = txt;\r\n }\r\n\r\n var c = document.getElementById(\"yes-no-text-input-box-container\");\r\n if (c) {\r\n c.style.display = \"block\";\r\n } else {\r\n console.log(\"ERROR: Container not found for YesNoTextInputBox\");\r\n }\r\n\r\n document.getElementById(\"yes-no-text-input-box-input\").focus();\r\n}\r\n\r\nexport {yesNoBoxCreate, yesNoTxtInpBoxCreate,\r\n yesNoBoxGetYesButton, yesNoBoxGetNoButton,\r\n yesNoTxtInpBoxGetYesButton, yesNoTxtInpBoxGetNoButton,\r\n yesNoTxtInpBoxGetInput, yesNoBoxClose,\r\n yesNoTxtInpBoxClose, yesNoBoxOpen};\r\n","/*! @preserve\n * numeral.js\n * version : 2.0.6\n * author : Adam Draper\n * license : MIT\n * http://adamwdraper.github.com/Numeral-js/\n */\n!function(a,b){\"function\"==typeof define&&define.amd?define(b):\"object\"==typeof module&&module.exports?module.exports=b():a.numeral=b()}(this,function(){function a(a,b){this._input=a,this._value=b}var b,c,d=\"2.0.6\",e={},f={},g={currentLocale:\"en\",zeroFormat:null,nullFormat:null,defaultFormat:\"0,0\",scalePercentBy100:!0},h={currentLocale:g.currentLocale,zeroFormat:g.zeroFormat,nullFormat:g.nullFormat,defaultFormat:g.defaultFormat,scalePercentBy100:g.scalePercentBy100};return b=function(d){var f,g,i,j;if(b.isNumeral(d))f=d.value();else if(0===d||\"undefined\"==typeof d)f=0;else if(null===d||c.isNaN(d))f=null;else if(\"string\"==typeof d)if(h.zeroFormat&&d===h.zeroFormat)f=0;else if(h.nullFormat&&d===h.nullFormat||!d.replace(/[^0-9]+/g,\"\").length)f=null;else{for(g in e)if(j=\"function\"==typeof e[g].regexps.unformat?e[g].regexps.unformat():e[g].regexps.unformat,j&&d.match(j)){i=e[g].unformat;break}i=i||b._.stringToNumber,f=i(d)}else f=Number(d)||null;return new a(d,f)},b.version=d,b.isNumeral=function(b){return b instanceof a},b._=c={numberToFormat:function(a,c,d){var e,g,h,i,j,k,l,m=f[b.options.currentLocale],n=!1,o=!1,p=0,q=\"\",r=1e12,s=1e9,t=1e6,u=1e3,v=\"\",w=!1;if(a=a||0,g=Math.abs(a),b._.includes(c,\"(\")?(n=!0,c=c.replace(/[\\(|\\)]/g,\"\")):(b._.includes(c,\"+\")||b._.includes(c,\"-\"))&&(j=b._.includes(c,\"+\")?c.indexOf(\"+\"):0>a?c.indexOf(\"-\"):-1,c=c.replace(/[\\+|\\-]/g,\"\")),b._.includes(c,\"a\")&&(e=c.match(/a(k|m|b|t)?/),e=e?e[1]:!1,b._.includes(c,\" a\")&&(q=\" \"),c=c.replace(new RegExp(q+\"a[kmbt]?\"),\"\"),g>=r&&!e||\"t\"===e?(q+=m.abbreviations.trillion,a/=r):r>g&&g>=s&&!e||\"b\"===e?(q+=m.abbreviations.billion,a/=s):s>g&&g>=t&&!e||\"m\"===e?(q+=m.abbreviations.million,a/=t):(t>g&&g>=u&&!e||\"k\"===e)&&(q+=m.abbreviations.thousand,a/=u)),b._.includes(c,\"[.]\")&&(o=!0,c=c.replace(\"[.]\",\".\")),h=a.toString().split(\".\")[0],i=c.split(\".\")[1],k=c.indexOf(\",\"),p=(c.split(\".\")[0].split(\",\")[0].match(/0/g)||[]).length,i?(b._.includes(i,\"[\")?(i=i.replace(\"]\",\"\"),i=i.split(\"[\"),v=b._.toFixed(a,i[0].length+i[1].length,d,i[1].length)):v=b._.toFixed(a,i.length,d),h=v.split(\".\")[0],v=b._.includes(v,\".\")?m.delimiters.decimal+v.split(\".\")[1]:\"\",o&&0===Number(v.slice(1))&&(v=\"\")):h=b._.toFixed(a,0,d),q&&!e&&Number(h)>=1e3&&q!==m.abbreviations.trillion)switch(h=String(Number(h)/1e3),q){case m.abbreviations.thousand:q=m.abbreviations.million;break;case m.abbreviations.million:q=m.abbreviations.billion;break;case m.abbreviations.billion:q=m.abbreviations.trillion}if(b._.includes(h,\"-\")&&(h=h.slice(1),w=!0),h.length<p)for(var x=p-h.length;x>0;x--)h=\"0\"+h;return k>-1&&(h=h.toString().replace(/(\\d)(?=(\\d{3})+(?!\\d))/g,\"$1\"+m.delimiters.thousands)),0===c.indexOf(\".\")&&(h=\"\"),l=h+v+(q?q:\"\"),n?l=(n&&w?\"(\":\"\")+l+(n&&w?\")\":\"\"):j>=0?l=0===j?(w?\"-\":\"+\")+l:l+(w?\"-\":\"+\"):w&&(l=\"-\"+l),l},stringToNumber:function(a){var b,c,d,e=f[h.currentLocale],g=a,i={thousand:3,million:6,billion:9,trillion:12};if(h.zeroFormat&&a===h.zeroFormat)c=0;else if(h.nullFormat&&a===h.nullFormat||!a.replace(/[^0-9]+/g,\"\").length)c=null;else{c=1,\".\"!==e.delimiters.decimal&&(a=a.replace(/\\./g,\"\").replace(e.delimiters.decimal,\".\"));for(b in i)if(d=new RegExp(\"[^a-zA-Z]\"+e.abbreviations[b]+\"(?:\\\\)|(\\\\\"+e.currency.symbol+\")?(?:\\\\))?)?$\"),g.match(d)){c*=Math.pow(10,i[b]);break}c*=(a.split(\"-\").length+Math.min(a.split(\"(\").length-1,a.split(\")\").length-1))%2?1:-1,a=a.replace(/[^0-9\\.]+/g,\"\"),c*=Number(a)}return c},isNaN:function(a){return\"number\"==typeof a&&isNaN(a)},includes:function(a,b){return-1!==a.indexOf(b)},insert:function(a,b,c){return a.slice(0,c)+b+a.slice(c)},reduce:function(a,b){if(null===this)throw new TypeError(\"Array.prototype.reduce called on null or undefined\");if(\"function\"!=typeof b)throw new TypeError(b+\" is not a function\");var c,d=Object(a),e=d.length>>>0,f=0;if(3===arguments.length)c=arguments[2];else{for(;e>f&&!(f in d);)f++;if(f>=e)throw new TypeError(\"Reduce of empty array with no initial value\");c=d[f++]}for(;e>f;f++)f in d&&(c=b(c,d[f],f,d));return c},multiplier:function(a){var b=a.toString().split(\".\");return b.length<2?1:Math.pow(10,b[1].length)},correctionFactor:function(){var a=Array.prototype.slice.call(arguments);return a.reduce(function(a,b){var d=c.multiplier(b);return a>d?a:d},1)},toFixed:function(a,b,c,d){var e,f,g,h,i=a.toString().split(\".\"),j=b-(d||0);return e=2===i.length?Math.min(Math.max(i[1].length,j),b):j,g=Math.pow(10,e),h=(c(a+\"e+\"+e)/g).toFixed(e),d>b-e&&(f=new RegExp(\"\\\\.?0{1,\"+(d-(b-e))+\"}$\"),h=h.replace(f,\"\")),h}},b.options=h,b.formats=e,b.locales=f,b.locale=function(a){return a&&(h.currentLocale=a.toLowerCase()),h.currentLocale},b.localeData=function(a){if(!a)return f[h.currentLocale];if(a=a.toLowerCase(),!f[a])throw new Error(\"Unknown locale : \"+a);return f[a]},b.reset=function(){for(var a in g)h[a]=g[a]},b.zeroFormat=function(a){h.zeroFormat=\"string\"==typeof a?a:null},b.nullFormat=function(a){h.nullFormat=\"string\"==typeof a?a:null},b.defaultFormat=function(a){h.defaultFormat=\"string\"==typeof a?a:\"0.0\"},b.register=function(a,b,c){if(b=b.toLowerCase(),this[a+\"s\"][b])throw new TypeError(b+\" \"+a+\" already registered.\");return this[a+\"s\"][b]=c,c},b.validate=function(a,c){var d,e,f,g,h,i,j,k;if(\"string\"!=typeof a&&(a+=\"\",console.warn&&console.warn(\"Numeral.js: Value is not string. It has been co-erced to: \",a)),a=a.trim(),a.match(/^\\d+$/))return!0;if(\"\"===a)return!1;try{j=b.localeData(c)}catch(l){j=b.localeData(b.locale())}return f=j.currency.symbol,h=j.abbreviations,d=j.delimiters.decimal,e=\".\"===j.delimiters.thousands?\"\\\\.\":j.delimiters.thousands,k=a.match(/^[^\\d]+/),null!==k&&(a=a.substr(1),k[0]!==f)?!1:(k=a.match(/[^\\d]+$/),null!==k&&(a=a.slice(0,-1),k[0]!==h.thousand&&k[0]!==h.million&&k[0]!==h.billion&&k[0]!==h.trillion)?!1:(i=new RegExp(e+\"{2}\"),a.match(/[^\\d.,]/g)?!1:(g=a.split(d),g.length>2?!1:g.length<2?!!g[0].match(/^\\d+.*\\d$/)&&!g[0].match(i):1===g[0].length?!!g[0].match(/^\\d+$/)&&!g[0].match(i)&&!!g[1].match(/^\\d+$/):!!g[0].match(/^\\d+.*\\d$/)&&!g[0].match(i)&&!!g[1].match(/^\\d+$/))))},b.fn=a.prototype={clone:function(){return b(this)},format:function(a,c){var d,f,g,i=this._value,j=a||h.defaultFormat;if(c=c||Math.round,0===i&&null!==h.zeroFormat)f=h.zeroFormat;else if(null===i&&null!==h.nullFormat)f=h.nullFormat;else{for(d in e)if(j.match(e[d].regexps.format)){g=e[d].format;break}g=g||b._.numberToFormat,f=g(i,j,c)}return f},value:function(){return this._value},input:function(){return this._input},set:function(a){return this._value=Number(a),this},add:function(a){function b(a,b,c,e){return a+Math.round(d*b)}var d=c.correctionFactor.call(null,this._value,a);return this._value=c.reduce([this._value,a],b,0)/d,this},subtract:function(a){function b(a,b,c,e){return a-Math.round(d*b)}var d=c.correctionFactor.call(null,this._value,a);return this._value=c.reduce([a],b,Math.round(this._value*d))/d,this},multiply:function(a){function b(a,b,d,e){var f=c.correctionFactor(a,b);return Math.round(a*f)*Math.round(b*f)/Math.round(f*f)}return this._value=c.reduce([this._value,a],b,1),this},divide:function(a){function b(a,b,d,e){var f=c.correctionFactor(a,b);return Math.round(a*f)/Math.round(b*f)}return this._value=c.reduce([this._value,a],b),this},difference:function(a){return Math.abs(b(this._value).subtract(a).value())}},b.register(\"locale\",\"en\",{delimiters:{thousands:\",\",decimal:\".\"},abbreviations:{thousand:\"k\",million:\"m\",billion:\"b\",trillion:\"t\"},ordinal:function(a){var b=a%10;return 1===~~(a%100/10)?\"th\":1===b?\"st\":2===b?\"nd\":3===b?\"rd\":\"th\"},currency:{symbol:\"$\"}}),function(){b.register(\"format\",\"bps\",{regexps:{format:/(BPS)/,unformat:/(BPS)/},format:function(a,c,d){var e,f=b._.includes(c,\" BPS\")?\" \":\"\";return a=1e4*a,c=c.replace(/\\s?BPS/,\"\"),e=b._.numberToFormat(a,c,d),b._.includes(e,\")\")?(e=e.split(\"\"),e.splice(-1,0,f+\"BPS\"),e=e.join(\"\")):e=e+f+\"BPS\",e},unformat:function(a){return+(1e-4*b._.stringToNumber(a)).toFixed(15)}})}(),function(){var a={base:1e3,suffixes:[\"B\",\"KB\",\"MB\",\"GB\",\"TB\",\"PB\",\"EB\",\"ZB\",\"YB\"]},c={base:1024,suffixes:[\"B\",\"KiB\",\"MiB\",\"GiB\",\"TiB\",\"PiB\",\"EiB\",\"ZiB\",\"YiB\"]},d=a.suffixes.concat(c.suffixes.filter(function(b){return a.suffixes.indexOf(b)<0})),e=d.join(\"|\");e=\"(\"+e.replace(\"B\",\"B(?!PS)\")+\")\",b.register(\"format\",\"bytes\",{regexps:{format:/([0\\s]i?b)/,unformat:new RegExp(e)},format:function(d,e,f){var g,h,i,j,k=b._.includes(e,\"ib\")?c:a,l=b._.includes(e,\" b\")||b._.includes(e,\" ib\")?\" \":\"\";for(e=e.replace(/\\s?i?b/,\"\"),h=0;h<=k.suffixes.length;h++)if(i=Math.pow(k.base,h),j=Math.pow(k.base,h+1),null===d||0===d||d>=i&&j>d){l+=k.suffixes[h],i>0&&(d/=i);break}return g=b._.numberToFormat(d,e,f),g+l},unformat:function(d){var e,f,g=b._.stringToNumber(d);if(g){for(e=a.suffixes.length-1;e>=0;e--){if(b._.includes(d,a.suffixes[e])){f=Math.pow(a.base,e);break}if(b._.includes(d,c.suffixes[e])){f=Math.pow(c.base,e);break}}g*=f||1}return g}})}(),function(){b.register(\"format\",\"currency\",{regexps:{format:/(\\$)/},format:function(a,c,d){var e,f,g,h=b.locales[b.options.currentLocale],i={before:c.match(/^([\\+|\\-|\\(|\\s|\\$]*)/)[0],after:c.match(/([\\+|\\-|\\)|\\s|\\$]*)$/)[0]};for(c=c.replace(/\\s?\\$\\s?/,\"\"),e=b._.numberToFormat(a,c,d),a>=0?(i.before=i.before.replace(/[\\-\\(]/,\"\"),i.after=i.after.replace(/[\\-\\)]/,\"\")):0>a&&!b._.includes(i.before,\"-\")&&!b._.includes(i.before,\"(\")&&(i.before=\"-\"+i.before),g=0;g<i.before.length;g++)switch(f=i.before[g]){case\"$\":e=b._.insert(e,h.currency.symbol,g);break;case\" \":e=b._.insert(e,\" \",g+h.currency.symbol.length-1)}for(g=i.after.length-1;g>=0;g--)switch(f=i.after[g]){case\"$\":e=g===i.after.length-1?e+h.currency.symbol:b._.insert(e,h.currency.symbol,-(i.after.length-(1+g)));break;case\" \":e=g===i.after.length-1?e+\" \":b._.insert(e,\" \",-(i.after.length-(1+g)+h.currency.symbol.length-1))}return e}})}(),function(){b.register(\"format\",\"exponential\",{regexps:{format:/(e\\+|e-)/,unformat:/(e\\+|e-)/},format:function(a,c,d){var e,f=\"number\"!=typeof a||b._.isNaN(a)?\"0e+0\":a.toExponential(),g=f.split(\"e\");return c=c.replace(/e[\\+|\\-]{1}0/,\"\"),e=b._.numberToFormat(Number(g[0]),c,d),e+\"e\"+g[1]},unformat:function(a){function c(a,c,d,e){var f=b._.correctionFactor(a,c),g=a*f*(c*f)/(f*f);return g}var d=b._.includes(a,\"e+\")?a.split(\"e+\"):a.split(\"e-\"),e=Number(d[0]),f=Number(d[1]);return f=b._.includes(a,\"e-\")?f*=-1:f,b._.reduce([e,Math.pow(10,f)],c,1)}})}(),function(){b.register(\"format\",\"ordinal\",{regexps:{format:/(o)/},format:function(a,c,d){var e,f=b.locales[b.options.currentLocale],g=b._.includes(c,\" o\")?\" \":\"\";return c=c.replace(/\\s?o/,\"\"),g+=f.ordinal(a),e=b._.numberToFormat(a,c,d),e+g}})}(),function(){b.register(\"format\",\"percentage\",{regexps:{format:/(%)/,unformat:/(%)/},format:function(a,c,d){var e,f=b._.includes(c,\" %\")?\" \":\"\";return b.options.scalePercentBy100&&(a=100*a),c=c.replace(/\\s?\\%/,\"\"),e=b._.numberToFormat(a,c,d),b._.includes(e,\")\")?(e=e.split(\"\"),e.splice(-1,0,f+\"%\"),e=e.join(\"\")):e=e+f+\"%\",e},unformat:function(a){var c=b._.stringToNumber(a);return b.options.scalePercentBy100?.01*c:c}})}(),function(){b.register(\"format\",\"time\",{regexps:{format:/(:)/,unformat:/(:)/},format:function(a,b,c){var d=Math.floor(a/60/60),e=Math.floor((a-60*d*60)/60),f=Math.round(a-60*d*60-60*e);return d+\":\"+(10>e?\"0\"+e:e)+\":\"+(10>f?\"0\"+f:f)},unformat:function(a){var b=a.split(\":\"),c=0;return 3===b.length?(c+=60*Number(b[0])*60,c+=60*Number(b[1]),c+=Number(b[2])):2===b.length&&(c+=60*Number(b[0]),c+=Number(b[1])),Number(c)}})}(),b});","import {CONSTANTS} from \"./Constants.js\";\r\nimport {Player} from \"./Player.js\";\r\nimport {createElement} from \"../utils/HelperFunctions.js\";\r\n\r\n/* Create programs */\r\nlet Programs = {\r\n NukeProgram: \"NUKE.exe\",\r\n BruteSSHProgram: \"BruteSSH.exe\",\r\n FTPCrackProgram: \"FTPCrack.exe\",\r\n RelaySMTPProgram: \"relaySMTP.exe\",\r\n HTTPWormProgram: \"HTTPWorm.exe\",\r\n SQLInjectProgram: \"SQLInject.exe\",\r\n DeepscanV1: \"DeepscanV1.exe\",\r\n DeepscanV2: \"DeepscanV2.exe\",\r\n ServerProfiler: \"ServerProfiler.exe\",\r\n AutoLink: \"AutoLink.exe\",\r\n Flight: \"fl1ght.exe\",\r\n BitFlume: \"b1t_flum3.exe\"\r\n};\r\n\r\nvar nukeALink, bruteSshALink, ftpCrackALink, relaySmtpALink, httpWormALink, sqlInjectALink,\r\n deepscanv1ALink, deepscanv2ALink, servProfilerALink, autolinkALink, bitFlumeALink;\r\nfunction displayCreateProgramContent() {\r\n nukeALink.style.display = \"none\";\r\n bruteSshALink.style.display = \"none\";\r\n ftpCrackALink.style.display = \"none\";\r\n relaySmtpALink.style.display = \"none\";\r\n httpWormALink.style.display = \"none\";\r\n sqlInjectALink.style.display = \"none\";\r\n deepscanv1ALink.style.display = \"none\";\r\n deepscanv2ALink.style.display = \"none\";\r\n servProfilerALink.style.display = \"none\";\r\n autolinkALink.style.display = \"none\";\r\n bitFlumeALink.style.display = \"none\";\r\n\r\n //NUKE.exe (in case you delete it lol)\r\n if (Player.getHomeComputer().programs.indexOf(Programs.NukeProgram) == -1) {\r\n nukeALink.style.display = \"inline-block\";\r\n }\r\n //BruteSSH\r\n if (Player.getHomeComputer().programs.indexOf(Programs.BruteSSHProgram) == -1 &&\r\n Player.hacking_skill >= 50) {\r\n bruteSshALink.style.display = \"inline-block\";\r\n }\r\n //FTPCrack\r\n if (Player.getHomeComputer().programs.indexOf(Programs.FTPCrackProgram) == -1 &&\r\n Player.hacking_skill >= 100) {\r\n ftpCrackALink.style.display = \"inline-block\";\r\n }\r\n //relaySMTP\r\n if (Player.getHomeComputer().programs.indexOf(Programs.RelaySMTPProgram) == -1 &&\r\n Player.hacking_skill >= 250) {\r\n relaySmtpALink.style.display = \"inline-block\";\r\n }\r\n //HTTPWorm\r\n if (Player.getHomeComputer().programs.indexOf(Programs.HTTPWormProgram) == -1 &&\r\n Player.hacking_skill >= 500) {\r\n httpWormALink.style.display = \"inline-block\";\r\n }\r\n //SQLInject\r\n if (Player.getHomeComputer().programs.indexOf(Programs.SQLInjectProgram) == -1 &&\r\n Player.hacking_skill >= 750) {\r\n sqlInjectALink.style.display = \"inline-block\";\r\n }\r\n //Deepscan V1 and V2\r\n if (!Player.hasProgram(Programs.DeepscanV1) && Player.hacking_skill >= 75) {\r\n deepscanv1ALink.style.display = \"inline-block\";\r\n }\r\n if (!Player.hasProgram(Programs.DeepscanV2) && Player.hacking_skill >= 400) {\r\n deepscanv2ALink.style.display = \"inline-block\";\r\n }\r\n //Server profiler\r\n if (!Player.hasProgram(Programs.ServerProfiler) && Player.hacking_skill >= 75) {\r\n servProfilerALink.style.display = \"inline-block\";\r\n }\r\n //Auto Link\r\n if (!Player.hasProgram(Programs.AutoLink) && Player.hacking_skill >= 25) {\r\n autolinkALink.style.display = \"inline-block\";\r\n }\r\n //Bit Flume\r\n if (!Player.hasProgram(Programs.BitFlume) && Player.sourceFiles.length > 0 && Player.hacking_skill >= 5) {\r\n bitFlumeALink.style.display = \"inline-block\";\r\n }\r\n}\r\n\r\n//Returns the number of programs that are currently available to be created\r\nfunction getNumAvailableCreateProgram() {\r\n var count = 0;\r\n //PortHack.exe (in case you delete it lol)\r\n if (Player.getHomeComputer().programs.indexOf(Programs.NukeProgram) == -1) {\r\n ++count;\r\n }\r\n //BruteSSH\r\n if (Player.getHomeComputer().programs.indexOf(Programs.BruteSSHProgram) == -1 &&\r\n Player.hacking_skill >= 50) {\r\n ++count;\r\n }\r\n //FTPCrack\r\n if (Player.getHomeComputer().programs.indexOf(Programs.FTPCrackProgram) == -1 &&\r\n Player.hacking_skill >= 100) {\r\n ++count;\r\n }\r\n //relaySMTP\r\n if (Player.getHomeComputer().programs.indexOf(Programs.RelaySMTPProgram) == -1 &&\r\n Player.hacking_skill >= 250) {\r\n ++count;\r\n }\r\n //HTTPWorm\r\n if (Player.getHomeComputer().programs.indexOf(Programs.HTTPWormProgram) == -1 &&\r\n Player.hacking_skill >= 500) {\r\n ++count;\r\n }\r\n //SQLInject\r\n if (Player.getHomeComputer().programs.indexOf(Programs.SQLInjectProgram) == -1 &&\r\n Player.hacking_skill >= 750) {\r\n ++count;\r\n }\r\n //Deepscan V1 and V2\r\n if (!Player.hasProgram(Programs.DeepscanV1) && Player.hacking_skill >= 75) {\r\n ++count;\r\n }\r\n if (!Player.hasProgram(Programs.DeepscanV2) && Player.hacking_skill >= 400) {\r\n ++count;\r\n }\r\n //Server profiler\r\n if (!Player.hasProgram(Programs.ServerProfiler) && Player.hacking_skill >= 75) {\r\n ++count;\r\n }\r\n //Auto link\r\n if (!Player.hasProgram(Programs.AutoLink) && Player.hacking_skill >= 25) {\r\n ++count;\r\n }\r\n //Bit Flume\r\n if (!Player.hasProgram(Programs.BitFlume) && Player.sourceFiles.length > 0 && Player.hacking_skill >= 5) {\r\n ++count;\r\n }\r\n if (Player.firstProgramAvailable === false && count > 0) {\r\n Player.firstProgramAvailable = true;\r\n document.getElementById(\"create-program-tab\").style.display = \"list-item\";\r\n document.getElementById(\"hacking-menu-header\").click();\r\n document.getElementById(\"hacking-menu-header\").click();\r\n }\r\n return count;\r\n}\r\n\r\nfunction initCreateProgramButtons() {\r\n var createProgramList = document.getElementById(\"create-program-list\");\r\n nukeALink = createElement(\"a\", {\r\n class:\"a-link-button\", id:\"create-program-nuke\", innerText:Programs.NukeProgram,\r\n tooltip:\"This virus is used to gain root access to a machine if enough ports are opened.\",\r\n });\r\n createProgramList.appendChild(nukeALink);\r\n\r\n bruteSshALink = createElement(\"a\", {\r\n class:\"a-link-button\", id:\"create-program-brutessh\", innerText:Programs.BruteSSHProgram,\r\n tooltip:\"This program executes a brute force attack that opens SSH ports\"\r\n });\r\n createProgramList.appendChild(bruteSshALink);\r\n\r\n ftpCrackALink = createElement(\"a\", {\r\n class:\"a-link-button\", id:\"create-program-ftpcrack\", innerText:Programs.FTPCrackProgram,\r\n tooltip:\"This program cracks open FTP ports\"\r\n });\r\n createProgramList.appendChild(ftpCrackALink);\r\n\r\n relaySmtpALink = createElement(\"a\", {\r\n class:\"a-link-button\", id:\"create-program-relaysmtp\", innerText:Programs.RelaySMTPProgram,\r\n tooltip:\"This program opens SMTP ports by redirecting data\"\r\n }) ;\r\n createProgramList.appendChild(relaySmtpALink);\r\n\r\n httpWormALink = createElement(\"a\", {\r\n class:\"a-link-button\", id:\"create-program-httpworm\", innerText:Programs.HTTPWormProgram,\r\n tooltip:\"This virus opens up HTTP ports\"\r\n });\r\n createProgramList.appendChild(httpWormALink);\r\n\r\n sqlInjectALink = createElement(\"a\", {\r\n class:\"a-link-button\", id:\"create-program-sqlinject\", innerText:Programs.SQLInjectProgram,\r\n tooltip:\"This virus opens SQL ports\"\r\n });\r\n createProgramList.appendChild(sqlInjectALink);\r\n\r\n deepscanv1ALink = createElement(\"a\", {\r\n class:\"a-link-button\", id:\"create-program-deepscanv1\", innerText:Programs.DeepscanV1,\r\n tooltip:\"This program allows you to use the scan-analyze command with a depth up to 5\"\r\n });\r\n createProgramList.appendChild(deepscanv1ALink);\r\n\r\n deepscanv2ALink = createElement(\"a\", {\r\n class:\"a-link-button\", id:\"create-program-deepscanv2\", innerText:Programs.DeepscanV2,\r\n tooltip:\"This program allows you to use the scan-analyze command with a depth up to 10\"\r\n });\r\n createProgramList.appendChild(deepscanv2ALink);\r\n\r\n servProfilerALink = createElement(\"a\", {\r\n class:\"a-link-button\", id:\"create-program-serverprofiler\", innerText:Programs.ServerProfiler,\r\n tooltip:\"This program is used to display hacking and Netscript-related information about servers\"\r\n });\r\n createProgramList.appendChild(servProfilerALink);\r\n\r\n bitFlumeALink = createElement(\"a\", {\r\n class:\"a-link-button\", id:\"create-program-bitflume\", innerText:Programs.BitFlume,\r\n tooltip:\"This program creates a portal to the BitNode Nexus (allows you to restart and switch BitNodes)\"\r\n });\r\n createProgramList.appendChild(bitFlumeALink);\r\n\r\n autolinkALink = createElement(\"a\", {\r\n class:\"a-link-button\", id:\"create-program-autolink\", innerText:\"AutoLink.exe\",\r\n tooltip:\"This program allows you to directly connect to other servers through the 'scan-analyze' command\"\r\n });\r\n createProgramList.appendChild(autolinkALink);\r\n\r\n nukeALink.addEventListener(\"click\", function() {\r\n Player.startCreateProgramWork(Programs.NukeProgram, CONSTANTS.MillisecondsPerFiveMinutes, 1);\r\n return false;\r\n });\r\n bruteSshALink.addEventListener(\"click\", function() {\r\n Player.startCreateProgramWork(Programs.BruteSSHProgram, CONSTANTS.MillisecondsPerFiveMinutes * 2, 50);\r\n return false;\r\n });\r\n ftpCrackALink.addEventListener(\"click\", function() {\r\n Player.startCreateProgramWork(Programs.FTPCrackProgram, CONSTANTS.MillisecondsPerHalfHour, 100);\r\n return false;\r\n });\r\n relaySmtpALink.addEventListener(\"click\", function() {\r\n Player.startCreateProgramWork(Programs.RelaySMTPProgram, CONSTANTS.MillisecondsPer2Hours, 250);\r\n return false;\r\n });\r\n httpWormALink.addEventListener(\"click\", function() {\r\n Player.startCreateProgramWork(Programs.HTTPWormProgram, CONSTANTS.MillisecondsPer4Hours, 500);\r\n return false;\r\n });\r\n sqlInjectALink.addEventListener(\"click\", function() {\r\n Player.startCreateProgramWork(Programs.SQLInjectProgram, CONSTANTS.MillisecondsPer8Hours, 750);\r\n return false;\r\n });\r\n deepscanv1ALink.addEventListener(\"click\", function() {\r\n Player.startCreateProgramWork(Programs.DeepscanV1, CONSTANTS.MillisecondsPerQuarterHour, 75);\r\n return false;\r\n });\r\n deepscanv2ALink.addEventListener(\"click\", function() {\r\n Player.startCreateProgramWork(Programs.DeepscanV2, CONSTANTS.MillisecondsPer2Hours, 400);\r\n return false;\r\n });\r\n servProfilerALink.addEventListener(\"click\", function() {\r\n Player.startCreateProgramWork(Programs.ServerProfiler, CONSTANTS.MillisecondsPerHalfHour, 75);\r\n return false;\r\n });\r\n autolinkALink.addEventListener(\"click\", function() {\r\n Player.startCreateProgramWork(Programs.AutoLink, CONSTANTS.MillisecondsPerQuarterHour, 25);\r\n return false;\r\n });\r\n bitFlumeALink.addEventListener(\"click\", function() {\r\n Player.startCreateProgramWork(Programs.BitFlume, CONSTANTS.MillisecondsPerFiveMinutes / 5, 5);\r\n return false;\r\n });\r\n}\r\n\r\nexport {Programs, displayCreateProgramContent, getNumAvailableCreateProgram,\r\n initCreateProgramButtons};\r\n","import {Player} from \"./Player.js\";\r\n\r\nfunction BitNode(n, name, desc=\"\", info=\"\") {\r\n this.number = n;\r\n this.name = name;\r\n this.desc = desc;\r\n this.info = info;\r\n}\r\n\r\nlet BitNodes = {};\r\nfunction initBitNodes() {\r\n BitNodes = {};\r\n BitNodes[\"BitNode1\"] = new BitNode(1, \"Source Genesis\", \"The original BitNode\",\r\n \"The first BitNode created by the Enders to imprison the minds of humans. It became \" +\r\n \"the prototype and testing-grounds for all of the BitNodes that followed.<br><br>\" +\r\n \"This is the first BitNode that you play through. It has no special \" +\r\n \"modifications or mechanics.<br><br>\" +\r\n \"Destroying this BitNode will give you Source-File 1, or if you already have \" +\r\n \"this Source-File it will upgrade its level up to a maximum of 3. This Source-File \" +\r\n \"lets the player start with 32GB of RAM on his/her home computer when entering a \" +\r\n \"new BitNode, and also increases all of the player's multipliers by:<br><br>\" +\r\n \"Level 1: 16%<br>\" +\r\n \"Level 2: 24%<br>\" +\r\n \"Level 3: 28%\");\r\n BitNodes[\"BitNode2\"] = new BitNode(2, \"Rise of the Underworld\", \"From the shadows, they rose\", //Gangs\r\n \"From the shadows, they rose.<br><br>Organized crime groups quickly filled the void of power \" +\r\n \"left behind from the collapse of Western government in the 2050's. As society and civlization broke down, \" +\r\n \"people quickly succumbed to the innate human impulse of evil and savagery. The organized crime \" +\r\n \"factions quickly rose to the top of the modern world.<br><br>\" +\r\n \"In this BitNode:<br><br>The maximum amount of money available on a server is significantly decreased<br>\" +\r\n \"The amount of money gained from crimes and Infiltration is tripled<br>\" +\r\n \"Certain Factions (Slum Snakes, Tetrads, The Syndicate, The Dark Army, Speakers for the Dead, \" +\r\n \"NiteSec, The Black Hand) give the player the ability to form and manage their own gangs. These gangs \" +\r\n \"will earn the player money and reputation with the corresponding Faction<br>\" +\r\n \"Every Augmentation in the game will be available through the Factions listed above<br>\" +\r\n \"For every Faction NOT listed above, reputation gains are halved<br>\" +\r\n \"You will no longer gain passive reputation with Factions<br><br>\" +\r\n \"Destroying this BitNode will give you Source-File 2, or if you already have this Source-File it will \" +\r\n \"upgrade its level up to a maximum of 3. This Source-File increases the player's crime success rate, \" +\r\n \"crime money, and charisma multipliers by:<br><br>\" +\r\n \"Level 1: 20%<br>\" +\r\n \"Level 2: 30%<br>\" +\r\n \"Level 3: 35%\");\r\n BitNodes[\"BitNode3\"] = new BitNode(3, \"Corporatocracy\", \"The Price of Civilization\",\r\n \"Our greatest illusion is that a healthy society can revolve around a \" +\r\n \"single-minded pursuit of wealth.<br><br>\" +\r\n \"Sometime in the early 21st century economic and political globalization turned \" +\r\n \"the world into a corporatocracy, and it never looked back. Now, the privileged \" +\r\n \"elite will happily bankrupt their own countrymen, decimate their own community, \" +\r\n \"and evict their neighbors from houses in their desperate bid to increase their wealth.<br><br>\" +\r\n \"In this BitNode you can create and manage your own corporation. Running a successful corporation \" +\r\n \"has the potential of generating massive profits. All other forms of income are reduced by 75%. Furthermore: <br><br>\" +\r\n \"The price and reputation cost of all Augmentations is tripled<br>\" +\r\n \"The starting and maximum amount of money on servers is reduced by 75%<br>\" +\r\n \"Server growth rate is reduced by 80%<br>\" +\r\n \"You will start out with $150b so that you can start your corporation<br>\" +\r\n \"You now only need 75 reputation with a faction in order to donate to it, rather than 150<br><br>\" +\r\n \"Destroying this BitNode will give you Source-File 3, or if you already have this Source-File it will \" +\r\n \"upgrade its level up to a maximum of 3. This Source-File lets you create corporations on other BitNodes (although \" +\r\n \"some BitNodes will disable this mechanic). This Source-File also increases your charisma and company salary multipliers by:<br>\" +\r\n \"Level 1: 8%<br>\" +\r\n \"Level 2: 12%<br>\" +\r\n \"Level 3: 14%\");\r\n BitNodes[\"BitNode4\"] = new BitNode(4, \"The Singularity\", \"The Man and the Machine\", \"The Singularity has arrived. The human race is gone, replaced \" +\r\n \"by artificially superintelligent beings that are more machine than man. <br><br>\" +\r\n \"In this BitNode, progressing is significantly harder. Experience gain rates \" +\r\n \"for all stats are reduced. Most methods of earning money will now give significantly less.<br><br>\" +\r\n \"In this BitNode you will gain access to a new set of Netscript Functions known as Singularity Functions. \" +\r\n \"These functions allow you to control most aspects of the game through scripts, including working for factions/companies, \" +\r\n \"purchasing/installing Augmentations, and creating programs.<br><br>\" +\r\n \"Destroying this BitNode will give you Source-File 4, or if you already have this Source-File it will \" +\r\n \"upgrade its level up to a maximum of 3. This Source-File lets you access and use the Singularity \" +\r\n \"Functions in other BitNodes. Each level of this Source-File will open up more Singularity Functions \" +\r\n \"that you can use.\");\r\n BitNodes[\"BitNode5\"] = new BitNode(5, \"Artificial Intelligence\", \"Posthuman\", \"They said it couldn't be done. They said the human brain, \" +\r\n \"along with its consciousness and intelligence, couldn't be replicated. They said the complexity \" +\r\n \"of the brain results from unpredictable, nonlinear interactions that couldn't be modeled \" +\r\n \"by 1's and 0's. They were wrong.<br><br>\" +\r\n \"In this BitNode:<br><br>\" +\r\n \"The base security level of servers is doubled<br>\" +\r\n \"The starting money on servers is halved, but the maximum money remains the same<br>\" +\r\n \"Most methods of earning money now give significantly less<br>\" +\r\n \"Infiltration gives 50% more reputation and money<br>\" +\r\n \"Corporations have 50% lower valuations and are therefore less profitable<br>\" +\r\n \"Augmentations are more expensive<br>\" +\r\n \"Hacking experience gain rates are reduced<br><br>\" +\r\n \"Destroying this BitNode will give you Source-File 5, or if you already have this Source-File it will \" +\r\n \"upgrade its level up to a maximum of 3. This Source-File grants you a special new stat called Intelligence. \" +\r\n \"Intelligence is unique because it is permanent and persistent (it never gets reset back to 1). However \" +\r\n \"gaining Intelligence experience is much slower than other stats, and it is also hidden (you won't know \" +\r\n \"when you gain experience and how much). Higher Intelligence levels will boost your production for many actions \" +\r\n \"in the game. <br><br>\" +\r\n \"In addition, this Source-File will unlock the getBitNodeMultipliers() Netscript function, \" +\r\n \"and will also raise all of your hacking-related multipliers by:<br><br>\" +\r\n \"Level 1: 4%<br>\" +\r\n \"Level 2: 6%<br>\" +\r\n \"Level 3: 7%\");\r\n BitNodes[\"BitNode6\"] = new BitNode(6, \"Bladeburners\", \"Like Tears in Rain\",\r\n \"In the middle of the 21st century, OmniTek Incorporated began designing and manufacturing advanced synthetic \" +\r\n \"androids, or Synthoids for short. They achieved a major technological breakthrough in the sixth generation \" +\r\n \"of their Synthoid design, called MK-VI, by developing a hyperintelligent AI. Many argue that this was \" +\r\n \"the first sentient AI ever created. This resulted in Synthoid models that were stronger, faster, and more intelligent \" +\r\n \"than the humans that had created them.<br><br>\" +\r\n \"In this BitNode you will be able to access the Bladeburner Division at the NSA, which provides a new mechanic \" +\r\n \"for progression. Furthermore:<br><br>\" +\r\n \"Hacking and Hacknet Nodes will be significantly less profitable<br>\" +\r\n \"Your hacking level is reduced by 50%<br>\" +\r\n \"Hacking experience gain from scripts is reduced by 75%<br>\" +\r\n \"Corporations have 80% lower valuations and are therefore less profitable<br>\" +\r\n \"Working for companies is 50% less profitable<br>\" +\r\n \"Crimes and Infiltration are 50% less profitable<br><br>\" +\r\n \"Destroying this BitNode will give you Source-File 6, or if you already have this Source-File it will upgrade \" +\r\n \"its level up to a maximum of 3. This Source-File allows you to access the NSA's Bladeburner Division in other \" +\r\n \"BitNodes. In addition, this Source-File will raise the experience gain rate of all your combat stats by:<br><br>\" +\r\n \"Level 1: 8%<br>\" +\r\n \"Level 2: 12%<br>\" +\r\n \"Level 3: 14%\");\r\n BitNodes[\"BitNode7\"] = new BitNode(7, \"Hacktocracy\", \"COMING SOON\"); //Healthy Hacknet balancing mechanic\r\n BitNodes[\"BitNode8\"] = new BitNode(8, \"Ghost of Wall Street\", \"Money never sleeps\",\r\n \"You are trying to make a name for yourself as an up-and-coming hedge fund manager on Wall Street.<br><br>\" +\r\n \"In this BitNode:<br><br>\" +\r\n \"You start with $100 million<br>\" +\r\n \"The only way to earn money is by trading on the stock market<br>\" +\r\n \"You start with a WSE membership and access to the TIX API<br>\" +\r\n \"You are able to short stocks and place different types of orders (limit/stop)<br>\" +\r\n \"You can immediately donate to factions to gain reputation<br><br>\" +\r\n \"Destroying this BitNode will give you Source-File 8, or if you already have this Source-File it will \" +\r\n \"upgrade its level up to a maximum of 3. This Source-File grants the following benefits:<br><br>\" +\r\n \"Level 1: Permanent access to WSE and TIX API<br>\" +\r\n \"Level 2: Ability to short stocks in other BitNodes<br>\" +\r\n \"Level 3: Ability to use limit/stop orders in other BitNodes<br><br>\" +\r\n \"This Source-File also increases your hacking growth multipliers by: \" +\r\n \"<br>Level 1: 8%<br>Level 2: 12%<br>Level 3: 14%\");\r\n BitNodes[\"BitNode9\"] = new BitNode(9, \"Do Androids Dream?\", \"COMING SOON\");\r\n BitNodes[\"BitNode10\"] = new BitNode(10, \"MegaCorp\", \"COMING SOON\"); //Not sure yet\r\n BitNodes[\"BitNode11\"] = new BitNode(11, \"The Big Crash\", \"Okay. Sell it all.\",\r\n \"The 2050s was defined by the massive amounts of violent civil unrest and anarchic rebellion that rose all around the world. It was this period \" +\r\n \"of disorder that eventually lead to the governmental reformation of many global superpowers, most notably \" +\r\n \"the USA and China. But just as the world was slowly beginning to recover from these dark times, financial catastrophe hit.<br><br>\" +\r\n \"In many countries, the high cost of trying to deal with the civil disorder bankrupted the governments. In all of this chaos and confusion, hackers \" +\r\n \"were able to steal billions of dollars from the world's largest electronic banks, prompting an international banking crisis as \" +\r\n \"governments were unable to bail out insolvent banks. Now, the world is slowly crumbling in the middle of the biggest economic crisis of all time.<br><br>\" +\r\n \"In this BitNode:<br><br>\" +\r\n \"The starting and maximum amount of money available on servers is significantly decreased<br>\" +\r\n \"The growth rate of servers is halved<br>\" +\r\n \"Weakening a server is twice as effective<br>\" +\r\n \"Company wages are decreased by 50%<br>\" +\r\n \"Corporation valuations are 99% lower and are therefore significantly less profitable<br>\" +\r\n \"Hacknet Node production is significantly decreased<br>\" +\r\n \"Crime and Infiltration are more lucrative<br>\" +\r\n \"Augmentations are twice as expensive<br><br>\" +\r\n \"Destroying this BitNode will give you Source-File 11, or if you already have this Source-File it will \" +\r\n \"upgrade its level up to a maximum of 3. This Source-File makes it so that company favor increases BOTH \" +\r\n \"the player's salary and reputation gain rate at that company by 1% per favor (rather than just the reputation gain). \" +\r\n \"This Source-File also increases the player's company salary and reputation gain multipliers by:<br><br>\" +\r\n \"Level 1: 24%<br>\" +\r\n \"Level 2: 36%<br>\" +\r\n \"Level 3: 42%\");\r\n BitNodes[\"BitNode12\"] = new BitNode(12, \"The Recursion\", \"Repeat.\",\r\n \"To iterate is human, to recurse divine.<br><br>\" +\r\n \"Every time this BitNode is destroyed, it becomes slightly harder. Destroying this BitNode will give your Souce-File 12, or \" +\r\n \"if you already have this Source-File it will upgrade its level. There is no maximum level for Source-File 12. Each level \" +\r\n \"of Source-File 12 will increase all of your multipliers by 1%.\");\r\n //Books: Frontera, Shiner\r\n BitNodes[\"BitNode13\"] = new BitNode(13, \"fOS\", \"COMING SOON\"); //Unlocks the new game mode and the rest of the BitNodes\r\n BitNodes[\"BitNode14\"] = new BitNode(14, \"\", \"COMING SOON\");\r\n BitNodes[\"BitNode15\"] = new BitNode(15, \"\", \"COMING SOON\");\r\n BitNodes[\"BitNode16\"] = new BitNode(16, \"\", \"COMING SOON\");\r\n BitNodes[\"BitNode17\"] = new BitNode(17, \"\", \"COMING SOON\");\r\n BitNodes[\"BitNode18\"] = new BitNode(18, \"\", \"COMING SOON\");\r\n BitNodes[\"BitNode19\"] = new BitNode(19, \"\", \"COMING SOON\");\r\n BitNodes[\"BitNode20\"] = new BitNode(20, \"\", \"COMING SOON\");\r\n BitNodes[\"BitNode21\"] = new BitNode(21, \"\", \"COMING SOON\");\r\n BitNodes[\"BitNode22\"] = new BitNode(22, \"\", \"COMING SOON\");\r\n BitNodes[\"BitNode23\"] = new BitNode(23, \"\", \"COMING SOON\");\r\n BitNodes[\"BitNode24\"] = new BitNode(24, \"\", \"COMING SOON\");\r\n}\r\n\r\nlet BitNodeMultipliers = {\r\n HackingLevelMultiplier: 1,\r\n\r\n ServerMaxMoney: 1,\r\n ServerStartingMoney: 1,\r\n ServerGrowthRate: 1,\r\n ServerWeakenRate: 1,\r\n ServerStartingSecurity: 1,\r\n\r\n ManualHackMoney: 1,\r\n ScriptHackMoney: 1,\r\n CompanyWorkMoney: 1,\r\n CrimeMoney: 1,\r\n HacknetNodeMoney: 1,\r\n\r\n CompanyWorkExpGain: 1,\r\n ClassGymExpGain: 1,\r\n FactionWorkExpGain: 1,\r\n HackExpGain: 1,\r\n CrimeExpGain: 1,\r\n\r\n FactionWorkRepGain: 1,\r\n FactionPassiveRepGain: 1,\r\n RepToDonateToFaction: 1,\r\n\r\n AugmentationRepCost: 1,\r\n AugmentationMoneyCost: 1,\r\n\r\n InfiltrationMoney: 1,\r\n InfiltrationRep: 1,\r\n\r\n CorporationValuation: 1,\r\n}\r\n\r\nfunction initBitNodeMultipliers() {\r\n if (Player.bitNodeN == null) {\r\n Player.bitNodeN = 1;\r\n }\r\n for (var mult in BitNodeMultipliers) {\r\n if (BitNodeMultipliers.hasOwnProperty(mult)) {\r\n BitNodeMultipliers[mult] = 1;\r\n }\r\n }\r\n\r\n switch (Player.bitNodeN) {\r\n case 1: //Source Genesis (every multiplier is 1)\r\n break;\r\n case 2: //Rise of the Underworld\r\n BitNodeMultipliers.ServerMaxMoney = 0.2;\r\n BitNodeMultipliers.ServerStartingMoney = 0.4;\r\n BitNodeMultipliers.CrimeMoney = 3;\r\n BitNodeMultipliers.InfiltrationMoney = 3;\r\n BitNodeMultipliers.FactionWorkRepGain = 0.5;\r\n BitNodeMultipliers.FactionPassiveRepGain = 0;\r\n break;\r\n case 3: //Corporatocracy\r\n BitNodeMultipliers.RepToDonateToFaction = 0.5;\r\n BitNodeMultipliers.AugmentationRepCost = 3;\r\n BitNodeMultipliers.AugmentationMoneyCost = 3;\r\n BitNodeMultipliers.ServerMaxMoney = 0.2;\r\n BitNodeMultipliers.ServerStartingMoney = 0.2;\r\n BitNodeMultipliers.ServerGrowthRate = 0.2;\r\n BitNodeMultipliers.ScriptHackMoney = 0.2;\r\n BitNodeMultipliers.CompanyWorkMoney = 0.25;\r\n BitNodeMultipliers.CrimeMoney = 0.25;\r\n BitNodeMultipliers.HacknetNodeMoney = 0.25;\r\n break;\r\n case 4: //The Singularity\r\n BitNodeMultipliers.ServerMaxMoney = 0.15;\r\n BitNodeMultipliers.ServerStartingMoney = 0.75;\r\n BitNodeMultipliers.ScriptHackMoney = 0.2;\r\n BitNodeMultipliers.CompanyWorkMoney = 0.1;\r\n BitNodeMultipliers.CrimeMoney = 0.2;\r\n BitNodeMultipliers.HacknetNodeMoney = 0.05;\r\n BitNodeMultipliers.CompanyWorkExpGain = 0.5;\r\n BitNodeMultipliers.ClassGymExpGain = 0.5;\r\n BitNodeMultipliers.FactionWorkExpGain = 0.5;\r\n BitNodeMultipliers.HackExpGain = 0.4;\r\n BitNodeMultipliers.CrimeExpGain = 0.5;\r\n BitNodeMultipliers.FactionWorkRepGain = 0.75;\r\n break;\r\n case 5: //Artificial intelligence\r\n BitNodeMultipliers.ServerMaxMoney = 2;\r\n BitNodeMultipliers.ServerStartingSecurity = 2;\r\n BitNodeMultipliers.ServerStartingMoney = 0.5;\r\n BitNodeMultipliers.ScriptHackMoney = 0.15;\r\n BitNodeMultipliers.HacknetNodeMoney = 0.2;\r\n BitNodeMultipliers.CrimeMoney = 0.5;\r\n BitNodeMultipliers.InfiltrationRep = 1.5;\r\n BitNodeMultipliers.InfiltrationMoney = 1.5;\r\n BitNodeMultipliers.AugmentationMoneyCost = 2;\r\n BitNodeMultipliers.HackExpGain = 0.5;\r\n BitNodeMultipliers.CorporationValuation = 0.5;\r\n break;\r\n case 6: //Bladeburner\r\n BitNodeMultipliers.HackingLevelMultiplier = 0.5;\r\n BitNodeMultipliers.ServerMaxMoney = 0.5;\r\n BitNodeMultipliers.ServerStartingMoney = 0.5;\r\n BitNodeMultipliers.ServerStartingSecurity = 1.5;\r\n BitNodeMultipliers.ScriptHackMoney = 0.5;\r\n BitNodeMultipliers.CompanyWorkMoney = 0.5;\r\n BitNodeMultipliers.CrimeMoney = 0.5;\r\n BitNodeMultipliers.InfiltrationMoney = 0.5;\r\n BitNodeMultipliers.CorporationValuation = 0.2;\r\n BitNodeMultipliers.HacknetNodeMoney = 0.2;\r\n BitNodeMultipliers.FactionPassiveRepGain = 0;\r\n BitNodeMultipliers.HackExpGain = 0.25;\r\n break;\r\n case 8: //Ghost of Wall Street\r\n BitNodeMultipliers.ScriptHackMoney = 0;\r\n BitNodeMultipliers.ManualHackMoney = 0;\r\n BitNodeMultipliers.CompanyWorkMoney = 0;\r\n BitNodeMultipliers.CrimeMoney = 0;\r\n BitNodeMultipliers.HacknetNodeMoney = 0;\r\n BitNodeMultipliers.InfiltrationMoney = 0;\r\n BitNodeMultipliers.RepToDonateToFaction = 0;\r\n BitNodeMultipliers.CorporationValuation = 0;\r\n break;\r\n case 11: //The Big Crash\r\n BitNodeMultipliers.ServerMaxMoney = 0.1;\r\n BitNodeMultipliers.ServerStartingMoney = 0.1;\r\n BitNodeMultipliers.ServerGrowthRate = 0.5;\r\n BitNodeMultipliers.ServerWeakenRate = 2;\r\n BitNodeMultipliers.CrimeMoney = 3;\r\n BitNodeMultipliers.CompanyWorkMoney = 0.5;\r\n BitNodeMultipliers.HacknetNodeMoney = 0.1;\r\n BitNodeMultipliers.AugmentationMoneyCost = 2;\r\n BitNodeMultipliers.InfiltrationMoney = 2.5;\r\n BitNodeMultipliers.InfiltrationRep = 2.5;\r\n BitNodeMultipliers.CorporationValuation = 0.01;\r\n break;\r\n case 12: //The Recursion\r\n let sf12Lvl = 0;\r\n for (let i = 0; i < Player.sourceFiles.length; i++) {\r\n if (Player.sourceFiles[i].n === 12) {\r\n sf12Lvl = Player.sourceFiles[i].lvl;\r\n }\r\n }\r\n const inc = Math.pow(1.01, sf12Lvl);\r\n const dec = Math.pow(0.99, sf12Lvl);\r\n BitNodeMultipliers.HackingLevelMultiplier = dec;\r\n\r\n BitNodeMultipliers.ServerMaxMoney = dec;\r\n BitNodeMultipliers.ServerStartingMoney = dec;\r\n BitNodeMultipliers.ServerGrowthRate = dec;\r\n BitNodeMultipliers.ServerWeakenRate = dec;\r\n\r\n //Does not scale, otherwise security might start at 300+\r\n BitNodeMultipliers.ServerStartingSecurity = 1.5;\r\n\r\n BitNodeMultipliers.ManualHackMoney = dec;\r\n BitNodeMultipliers.ScriptHackMoney = dec;\r\n BitNodeMultipliers.CompanyWorkMoney = dec;\r\n BitNodeMultipliers.CrimeMoney = dec;\r\n BitNodeMultipliers.HacknetNodeMoney = dec;\r\n\r\n BitNodeMultipliers.CompanyWorkExpGain = dec;\r\n BitNodeMultipliers.ClassGymExpGain = dec;\r\n BitNodeMultipliers.FactionWorkExpGain = dec;\r\n BitNodeMultipliers.HackExpGain = dec;\r\n BitNodeMultipliers.CrimeExpGain = dec;\r\n\r\n BitNodeMultipliers.FactionWorkRepGain = dec;\r\n BitNodeMultipliers.FactionPassiveRepGain = dec;\r\n BitNodeMultipliers.RepToDonateToFaction = inc;\r\n\r\n BitNodeMultipliers.AugmentationRepCost = inc;\r\n BitNodeMultipliers.AugmentationMoneyCost = inc;\r\n\r\n BitNodeMultipliers.InfiltrationMoney = dec;\r\n BitNodeMultipliers.InfiltrationRep = dec;\r\n\r\n BitNodeMultipliers.CorporationValuation = dec;\r\n default:\r\n console.log(\"WARNING: Player.bitNodeN invalid\");\r\n break;\r\n }\r\n}\r\n\r\nexport {initBitNodes,\r\n BitNode,\r\n BitNodes,\r\n BitNodeMultipliers,\r\n initBitNodeMultipliers};\r\n","import {AllServers} from \"../src/Server.js\";\r\n/* Functions to deal with manipulating IP addresses*/\r\n\r\n//Generate a random IP address\r\n//Will not return an IP address that already exists in the AllServers array\r\nfunction createRandomIp() {\r\n\tvar ip = createRandomByte(99) +'.' +\r\n\t\t\t createRandomByte(9) +'.' +\r\n\t\t\t createRandomByte(9) +'.' +\r\n\t\t \t createRandomByte(9);\r\n\r\n //If the Ip already exists, recurse to create a new one\r\n if (ipExists(ip)) {\r\n return createRandomIp();\r\n }\r\n\treturn ip;\r\n}\r\n\r\n//Returns true if the IP already exists in one of the game's servers\r\nfunction ipExists(ip) {\r\n for (var property in AllServers) {\r\n if (AllServers.hasOwnProperty(property)) {\r\n if (property == ip) {\r\n return true;\r\n }\r\n }\r\n }\r\n return false;\r\n}\r\n\r\nfunction createRandomByte(n=9) {\r\n\treturn Math.round(Math.random()*n);\r\n}\r\n\r\nfunction isValidIPAddress(ipaddress) {\r\n\tif (/^(25[0-6]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-6]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-6]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-6]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/.test(ipaddress))\r\n\t{\r\n\t\treturn true;\r\n\t}\r\n\treturn false;\r\n}\r\n\r\nexport {createRandomIp, ipExists, isValidIPAddress};\r\n","import {Reviver, Generic_toJSON,\r\n Generic_fromJSON} from \"../utils/JSONReviver.js\";\r\n\r\n/* Holds IP of Special Servers */\r\nlet SpecialServerNames = {\r\n FulcrumSecretTechnologies: \"Fulcrum Secret Technologies Server\",\r\n CyberSecServer: \"CyberSec Server\",\r\n NiteSecServer: \"NiteSec Server\",\r\n TheBlackHandServer: \"The Black Hand Server\",\r\n BitRunnersServer: \"BitRunners Server\",\r\n TheDarkArmyServer: \"The Dark Army Server\",\r\n DaedalusServer: \"Daedalus Server\",\r\n WorldDaemon: \"w0r1d_d43m0n\",\r\n}\r\nfunction SpecialServerIpsMap() {}\r\n\r\nSpecialServerIpsMap.prototype.addIp = function(name, ip) {\r\n this[name] = ip;\r\n}\r\n\r\nSpecialServerIpsMap.prototype.toJSON = function() {\r\n return Generic_toJSON(\"SpecialServerIpsMap\", this);\r\n}\r\n\r\nSpecialServerIpsMap.fromJSON = function(value) {\r\n return Generic_fromJSON(SpecialServerIpsMap, value.data);\r\n}\r\n\r\nReviver.constructors.SpecialServerIpsMap = SpecialServerIpsMap;\r\n\r\nlet SpecialServerIps = new SpecialServerIpsMap();\r\n\r\nfunction prestigeSpecialServerIps() {\r\n for (var member in SpecialServerIps) {\r\n delete SpecialServerIps[member];\r\n }\r\n SpecialServerIps = null;\r\n SpecialServerIps = new SpecialServerIpsMap();\r\n}\r\n\r\nfunction loadSpecialServerIps(saveString) {\r\n SpecialServerIps = JSON.parse(saveString, Reviver);\r\n}\r\n\r\nfunction initSpecialServerIps() {\r\n SpecialServerIps = new SpecialServerIpsMap();\r\n}\r\n\r\nexport {SpecialServerNames, SpecialServerIps, SpecialServerIpsMap, loadSpecialServerIps,\r\n prestigeSpecialServerIps, initSpecialServerIps};\r\n","import {substituteAliases, printAliases,\r\n parseAliasDeclaration,\r\n removeAlias, GlobalAliases,\r\n Aliases} from \"./Alias.js\";\r\nimport {CONSTANTS} from \"./Constants.js\";\r\nimport {Programs} from \"./CreateProgram.js\";\r\nimport {executeDarkwebTerminalCommand,\r\n checkIfConnectedToDarkweb} from \"./DarkWeb.js\";\r\nimport {Engine} from \"./engine.js\";\r\nimport {FconfSettings, parseFconfSettings,\r\n createFconf} from \"./Fconf.js\";\r\nimport {TerminalHelpText, HelpTexts} from \"./HelpText.js\";\r\nimport {iTutorialNextStep, iTutorialSteps,\r\n iTutorialIsRunning,\r\n currITutorialStep} from \"./InteractiveTutorial.js\";\r\nimport {showLiterature} from \"./Literature.js\";\r\nimport {showMessage, Message} from \"./Message.js\";\r\nimport {scriptCalculateHackingTime,\r\n scriptCalculateGrowTime,\r\n scriptCalculateWeakenTime} from \"./NetscriptEvaluator.js\";\r\nimport {killWorkerScript, addWorkerScript} from \"./NetscriptWorker.js\";\r\nimport {Player} from \"./Player.js\";\r\nimport {hackWorldDaemon} from \"./RedPill.js\";\r\nimport {findRunningScript, RunningScript,\r\n AllServersMap, Script,\r\n isScriptFilename} from \"./Script.js\";\r\nimport {AllServers, GetServerByHostname,\r\n getServer, Server} from \"./Server.js\";\r\nimport {Settings} from \"./Settings.js\";\r\nimport {SpecialServerIps,\r\n SpecialServerNames} from \"./SpecialServerIps.js\";\r\nimport {TextFile, getTextFile,\r\n createTextFile} from \"./TextFile.js\";\r\n\r\nimport {containsAllStrings, longestCommonStart,\r\n formatNumber, isString} from \"../utils/StringHelperFunctions.js\";\r\nimport {addOffset, printArray} from \"../utils/HelperFunctions.js\";\r\nimport {logBoxCreate} from \"../utils/LogBox.js\";\r\nimport {yesNoBoxCreate,\r\n yesNoBoxGetYesButton,\r\n yesNoBoxGetNoButton, yesNoBoxClose} from \"../utils/YesNoBox.js\";\r\n\r\nimport * as JSZip from 'jszip';\r\nimport * as FileSaver from 'file-saver';\r\n\r\n/* Write text to terminal */\r\n//If replace is true then spaces are replaced with \"&nbsp;\"\r\nfunction post(input) {\r\n $(\"#terminal-input\").before('<tr class=\"posted\"><td class=\"terminal-line\" style=\"color: var(--my-font-color); background-color: var(--my-background-color); white-space:pre-wrap;\">' + input + '</td></tr>');\r\n\tupdateTerminalScroll();\r\n}\r\n\r\n//Same thing as post but the td cells have ids so they can be animated for the hack progress bar\r\nfunction hackProgressBarPost(input) {\r\n $(\"#terminal-input\").before('<tr class=\"posted\"><td id=\"hack-progress-bar\" style=\"color: var(--my-font-color); background-color: var(--my-background-color);\">' + input + '</td></tr>');\r\n\tupdateTerminalScroll();\r\n}\r\n\r\nfunction hackProgressPost(input) {\r\n $(\"#terminal-input\").before('<tr class=\"posted\"><td id=\"hack-progress\" style=\"color: var(--my-font-color); background-color: var(--my-background-color);\">' + input + '</td></tr>');\r\n\tupdateTerminalScroll();\r\n}\r\n\r\n//Scroll to the bottom of the terminal's 'text area'\r\nfunction updateTerminalScroll() {\r\n\tvar element = document.getElementById(\"terminal-container\");\r\n\telement.scrollTop = element.scrollHeight;\r\n}\r\n\r\nfunction postNetburnerText() {\r\n\tpost(\"Bitburner v\" + CONSTANTS.Version);\r\n}\r\n\r\n\r\n//Key Codes\r\nvar KEY = {\r\n TAB: 9,\r\n ENTER: 13,\r\n CTRL: 17,\r\n UPARROW: 38,\r\n DOWNARROW: 40,\r\n A: 65,\r\n B: 66,\r\n C: 67,\r\n D: 68,\r\n E: 69,\r\n F: 70,\r\n H: 72,\r\n J: 74,\r\n K: 75,\r\n L: 76,\r\n M: 77,\r\n N: 78,\r\n O: 79,\r\n P: 80,\r\n R: 82,\r\n S: 83,\r\n U: 85,\r\n W: 87,\r\n}\r\n\r\n//Defines key commands in terminal\r\n$(document).keydown(function(event) {\r\n\t//Terminal\r\n\tif (Engine.currentPage == Engine.Page.Terminal) {\r\n var terminalInput = document.getElementById(\"terminal-input-text-box\");\r\n if (terminalInput != null && !event.ctrlKey && !event.shiftKey) {terminalInput.focus();}\r\n\r\n\t\tif (event.keyCode === KEY.ENTER) {\r\n event.preventDefault(); //Prevent newline from being entered in Script Editor\r\n\t\t\tvar command = $('input[class=terminal-input]').val();\r\n\t\t\tif (command.length > 0) {\r\n post(\r\n \"[\" +\r\n (FconfSettings.ENABLE_TIMESTAMPS ? Terminal.getTimestamp() + \" \" : \"\") +\r\n Player.getCurrentServer().hostname +\r\n \" ~]> \" + command\r\n );\r\n\r\n Terminal.resetTerminalInput(); //Clear input first\r\n\t\t\t\tTerminal.executeCommand(command);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tif (event.keyCode === KEY.C && event.ctrlKey) {\r\n if (Engine._actionInProgress) {\r\n //Cancel action\r\n post(\"Cancelling...\");\r\n \t\t\tEngine._actionInProgress = false;\r\n \t\t\tTerminal.finishAction(true);\r\n } else if (FconfSettings.ENABLE_BASH_HOTKEYS) {\r\n //Dont prevent default so it still copies\r\n Terminal.resetTerminalInput(); //Clear Terminal\r\n }\r\n\t\t}\r\n\r\n if (event.keyCode === KEY.L && event.ctrlKey) {\r\n event.preventDefault();\r\n Terminal.executeCommand(\"clear\"); //Clear screen\r\n }\r\n\r\n //Ctrl p same as up arrow\r\n //Ctrl n same as down arrow\r\n\r\n if (event.keyCode === KEY.UPARROW ||\r\n (FconfSettings.ENABLE_BASH_HOTKEYS && event.keyCode === KEY.P && event.ctrlKey)) {\r\n if (FconfSettings.ENABLE_BASH_HOTKEYS) {event.preventDefault();}\r\n //Cycle through past commands\r\n if (terminalInput == null) {return;}\r\n var i = Terminal.commandHistoryIndex;\r\n var len = Terminal.commandHistory.length;\r\n\r\n if (len == 0) {return;}\r\n if (i < 0 || i > len) {\r\n Terminal.commandHistoryIndex = len;\r\n }\r\n\r\n if (i != 0) {\r\n --Terminal.commandHistoryIndex;\r\n }\r\n var prevCommand = Terminal.commandHistory[Terminal.commandHistoryIndex];\r\n terminalInput.value = prevCommand;\r\n setTimeout(function(){terminalInput.selectionStart = terminalInput.selectionEnd = 10000; }, 0);\r\n }\r\n\r\n if (event.keyCode === KEY.DOWNARROW ||\r\n (FconfSettings.ENABLE_BASH_HOTKEYS && event.keyCode === KEY.M && event.ctrlKey)) {\r\n if (FconfSettings.ENABLE_BASH_HOTKEYS) {event.preventDefault();}\r\n //Cycle through past commands\r\n if (terminalInput == null) {return;}\r\n var i = Terminal.commandHistoryIndex;\r\n var len = Terminal.commandHistory.length;\r\n\r\n if (len == 0) {return;}\r\n if (i < 0 || i > len) {\r\n Terminal.commandHistoryIndex = len;\r\n }\r\n\r\n //Latest command, put nothing\r\n if (i == len || i == len-1) {\r\n Terminal.commandHistoryIndex = len;\r\n terminalInput.value = \"\";\r\n } else {\r\n ++Terminal.commandHistoryIndex;\r\n var prevCommand = Terminal.commandHistory[Terminal.commandHistoryIndex];\r\n terminalInput.value = prevCommand;\r\n }\r\n }\r\n\r\n if (event.keyCode === KEY.TAB) {\r\n //Autocomplete\r\n if (terminalInput == null) {return;}\r\n var input = terminalInput.value;\r\n if (input == \"\") {return;}\r\n input = input.trim();\r\n input = input.replace(/\\s\\s+/g, ' ');\r\n\r\n var commandArray = input.split(\" \");\r\n var index = commandArray.length - 2;\r\n if (index < -1) {index = 0;}\r\n var allPos = determineAllPossibilitiesForTabCompletion(input, index);\r\n if (allPos.length == 0) {return;}\r\n\r\n var arg = \"\";\r\n var command = \"\";\r\n if (commandArray.length == 0) {return;}\r\n if (commandArray.length == 1) {command = commandArray[0];}\r\n else if (commandArray.length == 2) {\r\n command = commandArray[0];\r\n arg = commandArray[1];\r\n } else if (commandArray.length == 3) {\r\n command = commandArray[0] + \" \" + commandArray[1];\r\n arg = commandArray[2];\r\n } else {\r\n arg = commandArray.pop();\r\n command = commandArray.join(\" \");\r\n }\r\n\r\n tabCompletion(command, arg, allPos);\r\n }\r\n\r\n //Extra Bash Emulation Hotkeys, must be enabled through .fconf\r\n if (FconfSettings.ENABLE_BASH_HOTKEYS) {\r\n if (event.keyCode === KEY.A && event.ctrlKey) {\r\n event.preventDefault();\r\n Terminal.moveTextCursor(\"home\");\r\n }\r\n\r\n if (event.keyCode === KEY.E && event.ctrlKey) {\r\n event.preventDefault();\r\n Terminal.moveTextCursor(\"end\");\r\n }\r\n\r\n if (event.keyCode === KEY.B && event.ctrlKey) {\r\n event.preventDefault();\r\n Terminal.moveTextCursor(\"prevchar\");\r\n }\r\n\r\n if (event.keyCode === KEY.B && event.altKey) {\r\n event.preventDefault();\r\n Terminal.moveTextCursor(\"prevword\");\r\n }\r\n\r\n if (event.keyCode === KEY.F && event.ctrlKey) {\r\n event.preventDefault();\r\n Terminal.moveTextCursor(\"nextchar\");\r\n }\r\n\r\n if (event.keyCode === KEY.F && event.altKey) {\r\n event.preventDefault();\r\n Terminal.moveTextCursor(\"nextword\");\r\n }\r\n\r\n\r\n if ((event.keyCode === KEY.H || event.keyCode === KEY.D) && event.ctrlKey) {\r\n Terminal.modifyInput(\"backspace\");\r\n event.preventDefault();\r\n }\r\n\r\n //TODO AFTER THIS:\r\n\r\n //alt + d deletes word after cursor\r\n //^w deletes word before cursor\r\n //^k clears line after cursor\r\n //^u clears line before cursor\r\n }\r\n\t}\r\n});\r\n\r\n//Keep terminal in focus\r\nlet terminalCtrlPressed = false, shiftKeyPressed = false;\r\n$(document).ready(function() {\r\n\tif (Engine.currentPage === Engine.Page.Terminal) {\r\n\t\t$('.terminal-input').focus();\r\n\t}\r\n});\r\n$(document).keydown(function(e) {\r\n\tif (Engine.currentPage == Engine.Page.Terminal) {\r\n\t\tif (e.which == 17) {\r\n\t\t\tterminalCtrlPressed = true;\r\n\t\t} else if (e.shiftKey) {\r\n shiftKeyPressed = true;\r\n } else if (terminalCtrlPressed || shiftKeyPressed) {\r\n\t\t\t//Don't focus\r\n\t\t} else {\r\n var inputTextBox = document.getElementById(\"terminal-input-text-box\");\r\n if (inputTextBox != null) {inputTextBox.focus();}\r\n\r\n\t\t\tterminalCtrlPressed = false;\r\n shiftKeyPressed = false;\r\n\t\t}\r\n\t}\r\n})\r\n$(document).keyup(function(e) {\r\n\tif (Engine.currentPage == Engine.Page.Terminal) {\r\n\t\tif (e.which == 17) {\r\n\t\t\tterminalCtrlPressed = false;\r\n\t\t}\r\n if (e.shiftKey) {\r\n shiftKeyPressed = false;\r\n }\r\n\t}\r\n})\r\n\r\n//Implements a tab completion feature for terminal\r\n// command - Command (first arg only)\r\n// arg - Incomplete argument string that the function will try to complete, or will display\r\n// a series of possible options for\r\n// allPossibilities - Array of strings containing all possibilities that the\r\n// string can complete to\r\n// index - index of argument that is being \"tab completed\". By default is 0, the first argument\r\nfunction tabCompletion(command, arg, allPossibilities, index=0) {\r\n if (!(allPossibilities.constructor === Array)) {return;}\r\n if (!containsAllStrings(allPossibilities)) {return;}\r\n\r\n if (!command.startsWith(\"./\")) {\r\n command = command.toLowerCase();\r\n }\r\n\r\n //Remove all options in allPossibilities that do not match the current string\r\n //that we are attempting to autocomplete\r\n if (arg == \"\") {\r\n for (var i = allPossibilities.length-1; i >= 0; --i) {\r\n if (!allPossibilities[i].toLowerCase().startsWith(command.toLowerCase())) {\r\n allPossibilities.splice(i, 1);\r\n }\r\n }\r\n } else {\r\n for (var i = allPossibilities.length-1; i >= 0; --i) {\r\n if (!allPossibilities[i].toLowerCase().startsWith(arg.toLowerCase())) {\r\n allPossibilities.splice(i, 1);\r\n }\r\n }\r\n }\r\n\r\n var val = \"\";\r\n if (allPossibilities.length == 0) {\r\n return;\r\n } else if (allPossibilities.length == 1) {\r\n if (arg == \"\") {\r\n //Autocomplete command\r\n val = allPossibilities[0] + \" \";\r\n } else {\r\n val = command + \" \" + allPossibilities[0];\r\n }\r\n document.getElementById(\"terminal-input-text-box\").value = val;\r\n document.getElementById(\"terminal-input-text-box\").focus();\r\n } else {\r\n var longestStartSubstr = longestCommonStart(allPossibilities);\r\n //If the longest common starting substring of remaining possibilities is the same\r\n //as whatevers already in terminal, just list all possible options. Otherwise,\r\n //change the input in the terminal to the longest common starting substr\r\n var allOptionsStr = \"\";\r\n for (var i = 0; i < allPossibilities.length; ++i) {\r\n allOptionsStr += allPossibilities[i];\r\n allOptionsStr += \" \";\r\n }\r\n if (arg == \"\") {\r\n if (longestStartSubstr == command) {\r\n post(\"> \" + command);\r\n post(allOptionsStr);\r\n } else {\r\n document.getElementById(\"terminal-input-text-box\").value = longestStartSubstr;\r\n document.getElementById(\"terminal-input-text-box\").focus();\r\n }\r\n } else {\r\n if (longestStartSubstr == arg) {\r\n //List all possible options\r\n post(\"> \" + command + \" \" + arg);\r\n post(allOptionsStr);\r\n } else {\r\n document.getElementById(\"terminal-input-text-box\").value = command + \" \" + longestStartSubstr;\r\n document.getElementById(\"terminal-input-text-box\").focus();\r\n }\r\n }\r\n\r\n }\r\n}\r\n\r\nfunction determineAllPossibilitiesForTabCompletion(input, index=0) {\r\n var allPos = [];\r\n allPos = allPos.concat(Object.keys(GlobalAliases));\r\n var currServ = Player.getCurrentServer();\r\n input = input.toLowerCase();\r\n\r\n //If the command starts with './' and the index == -1, then the user\r\n //has input ./partialexecutablename so autocomplete the script or program\r\n //Put './' in front of each script/executable\r\n if (input.startsWith(\"./\") && index == -1) {\r\n //All programs and scripts\r\n for (var i = 0; i < currServ.scripts.length; ++i) {\r\n allPos.push(\"./\" + currServ.scripts[i].filename);\r\n }\r\n\r\n //Programs are on home computer\r\n var homeComputer = Player.getHomeComputer();\r\n for(var i = 0; i < homeComputer.programs.length; ++i) {\r\n allPos.push(\"./\" + homeComputer.programs[i]);\r\n }\r\n return allPos;\r\n }\r\n\r\n //Autocomplete the command\r\n if (index == -1) {\r\n return [\"alias\", \"analyze\", \"cat\", \"check\", \"clear\", \"cls\", \"connect\", \"download\", \"free\",\r\n \"hack\", \"help\", \"home\", \"hostname\", \"ifconfig\", \"kill\", \"killall\",\r\n \"ls\", \"lscpu\", \"mem\", \"nano\", \"ps\", \"rm\", \"run\", \"scan\", \"scan-analyze\",\r\n \"scp\", \"sudov\", \"tail\", \"theme\", \"top\"].concat(Object.keys(Aliases)).concat(Object.keys(GlobalAliases));\r\n }\r\n\r\n if (input.startsWith (\"buy \")) {\r\n return [Programs.BruteSSHProgram, Programs.FTPCrackProgram, Programs.RelaySMTPProgram,\r\n Programs.HTTPWormProgram, Programs.SQLInjectProgram, Programs.DeepscanV1,\r\n Programs.DeepscanV2].concat(Object.keys(GlobalAliases));\r\n }\r\n\r\n if (input.startsWith(\"scp \") && index == 1) {\r\n for (var iphostname in AllServers) {\r\n if (AllServers.hasOwnProperty(iphostname)) {\r\n allPos.push(AllServers[iphostname].ip);\r\n allPos.push(AllServers[iphostname].hostname);\r\n }\r\n }\r\n }\r\n\r\n if (input.startsWith(\"scp \") && index == 0) {\r\n //All Scripts and lit files\r\n for (var i = 0; i < currServ.scripts.length; ++i) {\r\n allPos.push(currServ.scripts[i].filename);\r\n }\r\n for (var i = 0; i < currServ.messages.length; ++i) {\r\n if (!(currServ.messages[i] instanceof Message)) {\r\n allPos.push(currServ.messages[i]);\r\n }\r\n }\r\n for (var i = 0; i < currServ.textFiles.length; ++i) {\r\n allPos.push(currServ.textFiles[i].fn);\r\n }\r\n }\r\n\r\n if (input.startsWith(\"connect \") || input.startsWith(\"telnet \")) {\r\n //All network connections\r\n for (var i = 0; i < currServ.serversOnNetwork.length; ++i) {\r\n var serv = AllServers[currServ.serversOnNetwork[i]];\r\n if (serv == null) {continue;}\r\n allPos.push(serv.ip); //IP\r\n allPos.push(serv.hostname); //Hostname\r\n }\r\n return allPos;\r\n }\r\n\r\n if (input.startsWith(\"kill \") || input.startsWith(\"tail \") ||\r\n input.startsWith(\"mem \") || input.startsWith(\"check \")) {\r\n //All Scripts\r\n for (var i = 0; i < currServ.scripts.length; ++i) {\r\n allPos.push(currServ.scripts[i].filename);\r\n }\r\n return allPos;\r\n }\r\n\r\n if (input.startsWith(\"nano \")) {\r\n //Scripts and text files and .fconf\r\n for (var i = 0; i < currServ.scripts.length; ++i) {\r\n allPos.push(currServ.scripts[i].filename);\r\n }\r\n for (var i = 0; i < currServ.textFiles.length; ++i) {\r\n allPos.push(currServ.textFiles[i].fn);\r\n }\r\n allPos.push(\".fconf\");\r\n return allPos;\r\n }\r\n\r\n if (input.startsWith(\"rm \")) {\r\n for (var i = 0; i < currServ.scripts.length; ++i) {\r\n allPos.push(currServ.scripts[i].filename);\r\n }\r\n for (var i = 0; i < currServ.programs.length; ++i) {\r\n allPos.push(currServ.programs[i]);\r\n }\r\n for (var i = 0; i < currServ.messages.length; ++i) {\r\n if (!(currServ.messages[i] instanceof Message) && isString(currServ.messages[i]) &&\r\n currServ.messages[i].endsWith(\".lit\")) {\r\n allPos.push(currServ.messages[i]);\r\n }\r\n }\r\n for (var i = 0; i < currServ.textFiles.length; ++i) {\r\n allPos.push(currServ.textFiles[i].fn);\r\n }\r\n return allPos;\r\n }\r\n\r\n if (input.startsWith(\"run \")) {\r\n //All programs and scripts\r\n for (var i = 0; i < currServ.scripts.length; ++i) {\r\n allPos.push(currServ.scripts[i].filename);\r\n }\r\n\r\n //Programs are on home computer\r\n var homeComputer = Player.getHomeComputer();\r\n for(var i = 0; i < homeComputer.programs.length; ++i) {\r\n allPos.push(homeComputer.programs[i]);\r\n }\r\n return allPos;\r\n }\r\n\r\n if (input.startsWith(\"cat \")) {\r\n for (var i = 0; i < currServ.messages.length; ++i) {\r\n if (currServ.messages[i] instanceof Message) {\r\n allPos.push(currServ.messages[i].filename);\r\n } else {\r\n allPos.push(currServ.messages[i]);\r\n }\r\n }\r\n for (var i = 0; i < currServ.textFiles.length; ++i) {\r\n allPos.push(currServ.textFiles[i].fn);\r\n }\r\n return allPos;\r\n }\r\n\r\n if (input.startsWith(\"download \")) {\r\n for (var i = 0; i < currServ.textFiles.length; ++i) {\r\n allPos.push(currServ.textFiles[i].fn);\r\n }\r\n for (var i = 0; i < currServ.scripts.length; ++i) {\r\n allPos.push(currServ.scripts[i].filename);\r\n }\r\n }\r\n return allPos;\r\n}\r\n\r\nlet Terminal = {\r\n //Flags to determine whether the player is currently running a hack or an analyze\r\n hackFlag: false,\r\n analyzeFlag: false,\r\n\r\n commandHistory: [],\r\n commandHistoryIndex: 0,\r\n\r\n resetTerminalInput: function() {\r\n document.getElementById(\"terminal-input-td\").innerHTML =\r\n \"<div id='terminal-input-header'>[\" + Player.getCurrentServer().hostname + \" ~]\" + \"$ </div>\" +\r\n '<input type=\"text\" id=\"terminal-input-text-box\" class=\"terminal-input\" tabindex=\"1\"/>';\r\n var hdr = document.getElementById(\"terminal-input-header\");\r\n hdr.style.display = \"inline\";\r\n },\r\n\r\n modifyInput: function(mod) {\r\n try {\r\n var terminalInput = document.getElementById(\"terminal-input-text-box\");\r\n if (terminalInput == null) {return;}\r\n terminalInput.focus();\r\n\r\n var inputLength = terminalInput.value.length;\r\n var start = terminalInput.selectionStart;\r\n var end = terminalInput.selectionEnd;\r\n var inputText = terminalInput.value;\r\n\r\n switch(mod.toLowerCase()) {\r\n case \"backspace\":\r\n if (start > 0 && start <= inputLength+1) {\r\n terminalInput.value = inputText.substr(0, start-1) + inputText.substr(start);\r\n }\r\n break;\r\n case \"deletewordbefore\": //Delete rest of word before the cursor\r\n for (var delStart = start-1; delStart > 0; --delStart) {\r\n if (inputText.charAt(delStart) === \" \") {\r\n terminalInput.value = inputText.substr(0, delStart) + inputText.substr(start);\r\n return;\r\n }\r\n }\r\n break;\r\n case \"deletewordafter\": //Delete rest of word after the cursor\r\n for (var delStart = start+1; delStart <= text.length+1; ++delStart) {\r\n if (inputText.charAt(delStart) === \" \") {\r\n terminalInput.value = inputText.substr(0, start) + inputText.substr(delStart);\r\n return;\r\n }\r\n }\r\n break;\r\n case \"clearafter\": //Deletes everything after cursor\r\n break;\r\n case \"clearbefore:\": //Deleetes everything before cursor\r\n break;\r\n }\r\n } catch(e) {\r\n console.log(\"Exception in Terminal.modifyInput: \" + e);\r\n }\r\n },\r\n\r\n moveTextCursor: function(loc) {\r\n try {\r\n var terminalInput = document.getElementById(\"terminal-input-text-box\");\r\n if (terminalInput == null) {return;}\r\n terminalInput.focus();\r\n\r\n var inputLength = terminalInput.value.length;\r\n var start = terminalInput.selectionStart;\r\n var end = terminalInput.selectionEnd;\r\n\r\n switch(loc.toLowerCase()) {\r\n case \"home\":\r\n terminalInput.setSelectionRange(0,0);\r\n break;\r\n case \"end\":\r\n terminalInput.setSelectionRange(inputLength, inputLength);\r\n break;\r\n case \"prevchar\":\r\n if (start > 0) {terminalInput.setSelectionRange(start-1, start-1);}\r\n break;\r\n case \"prevword\":\r\n for (var i = start-2; i >= 0; --i) {\r\n if (terminalInput.value.charAt(i) === \" \") {\r\n terminalInput.setSelectionRange(i+1, i+1);\r\n return;\r\n }\r\n }\r\n terminalInput.setSelectionRange(0, 0);\r\n break;\r\n case \"nextchar\":\r\n terminalInput.setSelectionRange(start+1, start+1);\r\n break;\r\n case \"nextword\":\r\n for (var i = start+1; i <= inputLength; ++i) {\r\n if (terminalInput.value.charAt(i) === \" \") {\r\n terminalInput.setSelectionRange(i, i);\r\n return;\r\n }\r\n }\r\n terminalInput.setSelectionRange(inputLength, inputLength);\r\n break;\r\n default:\r\n console.log(\"WARNING: Invalid loc argument in Terminal.moveTextCursor()\");\r\n break;\r\n }\r\n } catch(e) {\r\n console.log(\"Exception in Terminal.moveTextCursor: \" + e);\r\n }\r\n },\r\n\r\n getTimestamp: function() {\r\n let d = new Date();\r\n return (d.getMonth() + \"/\" + d.getDay() + \" \" + d.getHours() + \":\" + d.getMinutes());\r\n },\r\n\r\n finishAction: function(cancelled = false) {\r\n if (Terminal.hackFlag) {\r\n Terminal.finishHack(cancelled);\r\n } else if (Terminal.analyzeFlag) {\r\n Terminal.finishAnalyze(cancelled);\r\n }\r\n },\r\n\r\n //Complete the hack/analyze command\r\n\tfinishHack: function(cancelled = false) {\r\n\t\tif (cancelled == false) {\r\n var server = Player.getCurrentServer();\r\n\r\n\t\t\t//Calculate whether hack was successful\r\n\t\t\tvar hackChance = Player.calculateHackingChance();\r\n\t\t\tvar rand = Math.random();\r\n\t\t\tconsole.log(\"Hack success chance: \" + hackChance + \", rand: \" + rand);\r\n\t\t\tvar expGainedOnSuccess = Player.calculateExpGain();\r\n\t\t\tvar expGainedOnFailure = (expGainedOnSuccess / 4);\r\n\t\t\tif (rand < hackChance) {\t//Success!\r\n if (SpecialServerIps[SpecialServerNames.WorldDaemon] &&\r\n SpecialServerIps[SpecialServerNames.WorldDaemon] == server.ip) {\r\n if (Player.bitNodeN == null) {\r\n Player.bitNodeN = 1;\r\n }\r\n hackWorldDaemon(Player.bitNodeN);\r\n return;\r\n }\r\n server.manuallyHacked = true;\r\n\t\t\t\tvar moneyGained = Player.calculatePercentMoneyHacked();\r\n\t\t\t\tmoneyGained = Math.floor(server.moneyAvailable * moneyGained);\r\n\r\n\t\t\t\tif (moneyGained <= 0) {moneyGained = 0;} //Safety check\r\n\r\n\t\t\t\tserver.moneyAvailable -= moneyGained;\r\n\t\t\t\tPlayer.gainMoney(moneyGained);\r\n Player.gainHackingExp(expGainedOnSuccess)\r\n Player.gainIntelligenceExp(expGainedOnSuccess / CONSTANTS.IntelligenceTerminalHackBaseExpGain);\r\n\r\n server.fortify(CONSTANTS.ServerFortifyAmount);\r\n\r\n\t\t\t\tpost(\"Hack successful! Gained $\" + formatNumber(moneyGained, 2) + \" and \" + formatNumber(expGainedOnSuccess, 4) + \" hacking EXP\");\r\n\t\t\t} else {\t\t\t\t\t//Failure\r\n\t\t\t\t//Player only gains 25% exp for failure? TODO Can change this later to balance\r\n Player.gainHackingExp(expGainedOnFailure)\r\n\t\t\t\tpost(\"Failed to hack \" + server.hostname + \". Gained \" + formatNumber(expGainedOnFailure, 4) + \" hacking EXP\");\r\n\t\t\t}\r\n\t\t}\r\n\r\n //Rename the progress bar so that the next hacks dont trigger it. Re-enable terminal\r\n $(\"#hack-progress-bar\").attr('id', \"old-hack-progress-bar\");\r\n $(\"#hack-progress\").attr('id', \"old-hack-progress\");\r\n Terminal.resetTerminalInput();\r\n $('input[class=terminal-input]').prop('disabled', false);\r\n\r\n Terminal.hackFlag = false;\r\n\t},\r\n\r\n finishAnalyze: function(cancelled = false) {\r\n\t\tif (cancelled == false) {\r\n\t\t\tpost(Player.getCurrentServer().hostname + \": \");\r\n post(\"Organization name: \" + Player.getCurrentServer().organizationName);\r\n var rootAccess = \"\";\r\n if (Player.getCurrentServer().hasAdminRights) {rootAccess = \"YES\";}\r\n else {rootAccess = \"NO\";}\r\n post(\"Root Access: \" + rootAccess);\r\n\t\t\tpost(\"Required hacking skill: \" + Player.getCurrentServer().requiredHackingSkill);\r\n\t\t\tpost(\"Estimated server security level: \" + formatNumber(addOffset(Player.getCurrentServer().hackDifficulty, 5), 3));\r\n\t\t\tpost(\"Estimated chance to hack: \" + formatNumber(addOffset(Player.calculateHackingChance() * 100, 5), 2) + \"%\");\r\n\t\t\tpost(\"Estimated time to hack: \" + formatNumber(addOffset(Player.calculateHackingTime(), 5), 3) + \" seconds\");\r\n\t\t\tpost(\"Estimated total money available on server: $\" + formatNumber(addOffset(Player.getCurrentServer().moneyAvailable, 5), 2));\r\n\t\t\tpost(\"Required number of open ports for NUKE: \" + Player.getCurrentServer().numOpenPortsRequired);\r\n if (Player.getCurrentServer().sshPortOpen) {\r\n\t\t\t\tpost(\"SSH port: Open\")\r\n\t\t\t} else {\r\n\t\t\t\tpost(\"SSH port: Closed\")\r\n\t\t\t}\r\n\r\n\t\t\tif (Player.getCurrentServer().ftpPortOpen) {\r\n\t\t\t\tpost(\"FTP port: Open\")\r\n\t\t\t} else {\r\n\t\t\t\tpost(\"FTP port: Closed\")\r\n\t\t\t}\r\n\r\n\t\t\tif (Player.getCurrentServer().smtpPortOpen) {\r\n\t\t\t\tpost(\"SMTP port: Open\")\r\n\t\t\t} else {\r\n\t\t\t\tpost(\"SMTP port: Closed\")\r\n\t\t\t}\r\n\r\n\t\t\tif (Player.getCurrentServer().httpPortOpen) {\r\n\t\t\t\tpost(\"HTTP port: Open\")\r\n\t\t\t} else {\r\n\t\t\t\tpost(\"HTTP port: Closed\")\r\n\t\t\t}\r\n\r\n\t\t\tif (Player.getCurrentServer().sqlPortOpen) {\r\n\t\t\t\tpost(\"SQL port: Open\")\r\n\t\t\t} else {\r\n\t\t\t\tpost(\"SQL port: Closed\")\r\n\t\t\t}\r\n\t\t}\r\n Terminal.analyzeFlag = false;\r\n\r\n //Rename the progress bar so that the next hacks dont trigger it. Re-enable terminal\r\n $(\"#hack-progress-bar\").attr('id', \"old-hack-progress-bar\");\r\n $(\"#hack-progress\").attr('id', \"old-hack-progress\");\r\n Terminal.resetTerminalInput();\r\n $('input[class=terminal-input]').prop('disabled', false);\r\n },\r\n\r\n\texecuteCommand: function(command) {\r\n command = command.trim();\r\n //Replace all extra whitespace in command with a single space\r\n command = command.replace(/\\s\\s+/g, ' ');\r\n\r\n //Terminal history\r\n if (Terminal.commandHistory[Terminal.commandHistory.length-1] != command) {\r\n Terminal.commandHistory.push(command);\r\n if (Terminal.commandHistory.length > 50) {\r\n Terminal.commandHistory.splice(0, 1);\r\n }\r\n }\r\n Terminal.commandHistoryIndex = Terminal.commandHistory.length;\r\n\r\n //Process any aliases\r\n command = substituteAliases(command);\r\n\r\n //Allow usage of ./\r\n if (command.startsWith(\"./\")) {\r\n command = \"run \" + command.slice(2);\r\n }\r\n\r\n //Only split the first space\r\n\t\tvar commandArray = command.split(\" \");\r\n if (commandArray.length > 1) {\r\n commandArray = [commandArray.shift(), commandArray.join(\" \")];\r\n }\r\n\r\n\t\tif (commandArray.length == 0) {return;}\r\n\r\n /****************** Interactive Tutorial Terminal Commands ******************/\r\n if (iTutorialIsRunning) {\r\n var foodnstuffServ = GetServerByHostname(\"foodnstuff\");\r\n if (foodnstuffServ == null) {throw new Error(\"Could not get foodnstuff server\"); return;}\r\n\r\n switch(currITutorialStep) {\r\n case iTutorialSteps.TerminalHelp:\r\n if (commandArray[0] == \"help\") {\r\n post(TerminalHelpText);\r\n iTutorialNextStep();\r\n } else {post(\"Bad command. Please follow the tutorial\");}\r\n break;\r\n case iTutorialSteps.TerminalLs:\r\n if (commandArray[0] == \"ls\") {\r\n Terminal.executeListCommand(commandArray);\r\n iTutorialNextStep();\r\n } else {post(\"Bad command. Please follow the tutorial\");}\r\n break;\r\n case iTutorialSteps.TerminalScan:\r\n if (commandArray[0] == \"scan\") {\r\n Terminal.executeScanCommand(commandArray);\r\n iTutorialNextStep();\r\n } else {post(\"Bad command. Please follow the tutorial\");}\r\n break;\r\n case iTutorialSteps.TerminalScanAnalyze1:\r\n if (commandArray.length == 1 && commandArray[0] == \"scan-analyze\") {\r\n Terminal.executeScanAnalyzeCommand(1);\r\n iTutorialNextStep();\r\n } else {post(\"Bad command. Please follow the tutorial\");}\r\n break;\r\n case iTutorialSteps.TerminalScanAnalyze2:\r\n if (commandArray.length == 2 && commandArray[0] == \"scan-analyze\" &&\r\n commandArray[1] == \"2\") {\r\n Terminal.executeScanAnalyzeCommand(2);\r\n iTutorialNextStep();\r\n } else {post(\"Bad command. Please follow the tutorial\");}\r\n break;\r\n break;\r\n case iTutorialSteps.TerminalConnect:\r\n if (commandArray.length == 2) {\r\n if ((commandArray[0] == \"connect\") &&\r\n (commandArray[1] == \"foodnstuff\" || commandArray[1] == foodnstuffServ.ip)) {\r\n Player.getCurrentServer().isConnectedTo = false;\r\n Player.currentServer = foodnstuffServ.ip;\r\n Player.getCurrentServer().isConnectedTo = true;\r\n post(\"Connected to foodnstuff\");\r\n iTutorialNextStep();\r\n } else {post(\"Wrong command! Try again!\"); return;}\r\n } else {post(\"Bad command. Please follow the tutorial\");}\r\n break;\r\n case iTutorialSteps.TerminalAnalyze:\r\n if (commandArray[0] == \"analyze\") {\r\n if (commandArray.length != 1) {\r\n post(\"Incorrect usage of analyze command. Usage: analyze\"); return;\r\n }\r\n //Analyze the current server for information\r\n Terminal.analyzeFlag = true;\r\n post(\"Analyzing system...\");\r\n hackProgressPost(\"Time left:\");\r\n hackProgressBarPost(\"[\");\r\n Player.analyze();\r\n\r\n //Disable terminal\r\n //Terminal.resetTerminalInput();\r\n document.getElementById(\"terminal-input-td\").innerHTML = '<input type=\"text\" class=\"terminal-input\"/>';\r\n $('input[class=terminal-input]').prop('disabled', true);\r\n iTutorialNextStep();\r\n } else {\r\n post(\"Bad command. Please follow the tutorial\");\r\n }\r\n break;\r\n case iTutorialSteps.TerminalNuke:\r\n if (commandArray.length == 2 &&\r\n commandArray[0] == \"run\" && commandArray[1] == \"NUKE.exe\") {\r\n foodnstuffServ.hasAdminRights = true;\r\n post(\"NUKE successful! Gained root access to foodnstuff\");\r\n iTutorialNextStep();\r\n } else {post(\"Bad command. Please follow the tutorial\");}\r\n break;\r\n case iTutorialSteps.TerminalManualHack:\r\n if (commandArray.length == 1 && commandArray[0] == \"hack\") {\r\n Terminal.hackFlag = true;\r\n\t\t\t\t\thackProgressPost(\"Time left:\");\r\n\t\t\t\t\thackProgressBarPost(\"[\");\r\n\t\t\t\t\tPlayer.hack();\r\n\r\n\t\t\t\t\t//Disable terminal\r\n //Terminal.resetTerminalInput();\r\n\t\t\t\t\tdocument.getElementById(\"terminal-input-td\").innerHTML = '<input type=\"text\" class=\"terminal-input\"/>';\r\n\t\t\t\t\t$('input[class=terminal-input]').prop('disabled', true);\r\n iTutorialNextStep();\r\n } else {post(\"Bad command. Please follow the tutorial\");}\r\n\t\t\t\tbreak;\r\n case iTutorialSteps.TerminalCreateScript:\r\n if (commandArray.length == 2 &&\r\n commandArray[0] == \"nano\" && commandArray[1] == \"foodnstuff.script\") {\r\n Engine.loadScriptEditorContent(\"foodnstuff.script\", \"\");\r\n iTutorialNextStep();\r\n } else {post(\"Bad command. Please follow the tutorial\");}\r\n case iTutorialSteps.TerminalFree:\r\n if (commandArray.length == 1 && commandArray[0] == \"free\") {\r\n Terminal.executeFreeCommand(commandArray);\r\n iTutorialNextStep();\r\n }\r\n break;\r\n case iTutorialSteps.TerminalRunScript:\r\n if (commandArray.length == 2 &&\r\n commandArray[0] == \"run\" && commandArray[1] == \"foodnstuff.script\") {\r\n Terminal.runScript(\"foodnstuff.script\");\r\n iTutorialNextStep();\r\n } else {post(\"Bad command. Please follow the tutorial\");}\r\n break;\r\n case iTutorialSteps.ActiveScriptsToTerminal:\r\n if (commandArray.length == 2 &&\r\n commandArray[0] == \"tail\" && commandArray[1] == \"foodnstuff.script\") {\r\n //Check that the script exists on this machine\r\n var runningScript = findRunningScript(\"foodnstuff.script\", [], Player.getCurrentServer());\r\n if (runningScript == null) {\r\n post(\"Error: No such script exists\");\r\n return;\r\n }\r\n logBoxCreate(runningScript);\r\n iTutorialNextStep();\r\n } else {post(\"Bad command. Please follow the tutorial\");}\r\n break;\r\n default:\r\n post(\"Please follow the tutorial, or click 'Exit Tutorial' if you'd like to skip it\");\r\n return;\r\n }\r\n return;\r\n }\r\n\r\n /****************** END INTERACTIVE TUTORIAL ******************/\r\n\r\n /* Command parser */\r\n var s = Player.getCurrentServer();\r\n\t\tswitch (commandArray[0].toLowerCase()) {\r\n case \"alias\":\r\n if (commandArray.length == 1) {\r\n printAliases();\r\n return;\r\n }\r\n if (commandArray.length == 2) {\r\n if (commandArray[1].startsWith(\"-g \")) {\r\n var alias = commandArray[1].substring(3);\r\n if (parseAliasDeclaration(alias, true)) {\r\n return;\r\n }\r\n } else {\r\n if (parseAliasDeclaration(commandArray[1])) {\r\n return;\r\n }\r\n }\r\n }\r\n post('Incorrect usage of alias command. Usage: alias [-g] [aliasname=\"value\"]');\r\n break;\r\n\t\t\tcase \"analyze\":\r\n\t\t\t\tif (commandArray.length != 1) {\r\n\t\t\t\t\tpost(\"Incorrect usage of analyze command. Usage: analyze\"); return;\r\n\t\t\t\t}\r\n //Analyze the current server for information\r\n Terminal.analyzeFlag = true;\r\n post(\"Analyzing system...\");\r\n hackProgressPost(\"Time left:\");\r\n hackProgressBarPost(\"[\");\r\n Player.analyze();\r\n\r\n //Disable terminal\r\n //Terminal.resetTerminalInput();\r\n document.getElementById(\"terminal-input-td\").innerHTML = '<input type=\"text\" class=\"terminal-input\"/>';\r\n $('input[class=terminal-input]').prop('disabled', true);\r\n\t\t\t\tbreak;\r\n case \"buy\":\r\n if (SpecialServerIps.hasOwnProperty(\"Darkweb Server\")) {\r\n executeDarkwebTerminalCommand(commandArray);\r\n } else {\r\n post(\"You need to be able to connect to the Dark Web to use the buy command. (Maybe there's a TOR router you can buy somewhere)\");\r\n }\r\n break;\r\n case \"cat\":\r\n if (commandArray.length != 2) {\r\n post(\"Incorrect usage of cat command. Usage: cat [file]\"); return;\r\n }\r\n var filename = commandArray[1];\r\n\t\t\t\tif (!filename.endsWith(\".msg\") && !filename.endsWith(\".lit\") && !filename.endsWith(\".txt\")) {\r\n\t\t\t\t\tpost(\"Error: Only .msg, .txt, and .lit files are viewable with cat (filename must end with .msg, .txt, or .lit)\"); return;\r\n\t\t\t\t}\r\n for (var i = 0; i < s.messages.length; ++i) {\r\n if (filename.endsWith(\".lit\") && s.messages[i] == filename) {\r\n showLiterature(s.messages[i]);\r\n return;\r\n } else if (filename.endsWith(\".msg\") && s.messages[i].filename == filename) {\r\n showMessage(s.messages[i]);\r\n return;\r\n }\r\n }\r\n for (var i = 0; i < s.textFiles.length; ++i) {\r\n if (s.textFiles[i].fn === filename) {\r\n s.textFiles[i].show();\r\n return;\r\n }\r\n }\r\n post(\"Error: No such file \" + filename);\r\n break;\r\n case \"check\":\r\n if (commandArray.length < 2) {\r\n post(\"Incorrect number of arguments. Usage: check [script] [arg1] [arg2]...\");\r\n } else {\r\n var results = commandArray[1].split(\" \");\r\n var scriptName = results[0];\r\n var args = [];\r\n for (var i = 1; i < results.length; ++i) {\r\n args.push(results[i]);\r\n }\r\n\r\n //Can only tail script files\r\n if (isScriptFilename(scriptName) == false) {\r\n post(\"Error: tail can only be called on .script files (filename must end with .script)\"); return;\r\n }\r\n\r\n //Check that the script exists on this machine\r\n var runningScript = findRunningScript(scriptName, args, s);\r\n if (runningScript == null) {\r\n post(\"Error: No such script exists\");\r\n return;\r\n }\r\n runningScript.displayLog();\r\n }\r\n break;\r\n\t\t\tcase \"clear\":\r\n\t\t\tcase \"cls\":\r\n\t\t\t\tif (commandArray.length != 1) {\r\n\t\t\t\t\tpost(\"Incorrect usage of clear/cls command. Usage: clear/cls\"); return;\r\n\t\t\t\t}\r\n\t\t\t\t$(\"#terminal tr:not(:last)\").remove();\r\n\t\t\t\tpostNetburnerText();\r\n\t\t\t\tbreak;\r\n\t\t\tcase \"connect\":\r\n\t\t\t\t//Disconnect from current server in terminal and connect to new one\r\n if (commandArray.length != 2) {\r\n post(\"Incorrect usage of connect command. Usage: connect [ip/hostname]\");\r\n return;\r\n }\r\n\r\n var ip = commandArray[1];\r\n\r\n for (var i = 0; i < Player.getCurrentServer().serversOnNetwork.length; i++) {\r\n if (Player.getCurrentServer().getServerOnNetwork(i).ip == ip || Player.getCurrentServer().getServerOnNetwork(i).hostname == ip) {\r\n Terminal.connectToServer(ip);\r\n return;\r\n }\r\n }\r\n\r\n post(\"Host not found\");\r\n\t\t\t\tbreak;\r\n case \"download\":\r\n if (commandArray.length != 2) {\r\n post(\"Incorrect usage of download command. Usage: download [text file]\");\r\n return;\r\n }\r\n var fn = commandArray[1];\r\n if (fn === \"*\" || fn === \"*.script\" || fn === \"*.txt\") {\r\n //Download all scripts as a zip\r\n var zip = new JSZip();\r\n if (fn === \"*\" || fn === \"*.script\") {\r\n for (var i = 0; i < s.scripts.length; ++i) {\r\n var file = new Blob([s.scripts[i].code], {type:\"text/plain\"});\r\n zip.file(s.scripts[i].filename + \".js\", file);\r\n }\r\n }\r\n if (fn === \"*\" || fn === \"*.txt\") {\r\n for (var i = 0; i < s.textFiles.length; ++i) {\r\n var file = new Blob([s.textFiles[i].text], {type:\"text/plain\"});\r\n zip.file(s.textFiles[i].fn, file);\r\n }\r\n }\r\n\r\n var filename;\r\n switch (fn) {\r\n case \"*.script\":\r\n filename = \"bitburnerScripts.zip\"; break;\r\n case \"*.txt\":\r\n filename = \"bitburnerTexts.zip\"; break;\r\n default:\r\n filename = \"bitburnerFiles.zip\"; break;\r\n }\r\n\r\n zip.generateAsync({type:\"blob\"}).then(function(content) {\r\n FileSaver.saveAs(content, filename);\r\n });\r\n return;\r\n } else if (isScriptFilename(fn)) {\r\n //Download a single script\r\n for (var i = 0; i < s.scripts.length; ++i) {\r\n if (s.scripts[i].filename === fn) {\r\n return s.scripts[i].download();\r\n }\r\n }\r\n } else if (fn.endsWith(\".txt\")) {\r\n //Download a single text file\r\n var txtFile = getTextFile(fn, s);\r\n if (txtFile !== null) {\r\n return txtFile.download();\r\n }\r\n }\r\n post(\"Error: \" + fn + \" does not exist\");\r\n break;\r\n\t\t\tcase \"free\":\r\n\t\t\t\tTerminal.executeFreeCommand(commandArray);\r\n\t\t\t\tbreak;\r\n\t\t\tcase \"hack\":\r\n\t\t\t\tif (commandArray.length != 1) {\r\n\t\t\t\t\tpost(\"Incorrect usage of hack command. Usage: hack\"); return;\r\n\t\t\t\t}\r\n\t\t\t\t//Hack the current PC (usually for money)\r\n\t\t\t\t//You can't hack your home pc or servers you purchased\r\n\t\t\t\tif (Player.getCurrentServer().purchasedByPlayer) {\r\n\t\t\t\t\tpost(\"Cannot hack your own machines! You are currently connected to your home PC or one of your purchased servers\");\r\n\t\t\t\t} else if (Player.getCurrentServer().hasAdminRights == false ) {\r\n\t\t\t\t\tpost(\"You do not have admin rights for this machine! Cannot hack\");\r\n\t\t\t\t} else if (Player.getCurrentServer().requiredHackingSkill > Player.hacking_skill) {\r\n\t\t\t\t\tpost(\"Your hacking skill is not high enough to attempt hacking this machine. Try analyzing the machine to determine the required hacking skill\");\r\n\t\t\t\t} else {\r\n Terminal.hackFlag = true;\r\n\t\t\t\t\thackProgressPost(\"Time left:\");\r\n\t\t\t\t\thackProgressBarPost(\"[\");\r\n\t\t\t\t\tPlayer.hack();\r\n\r\n\t\t\t\t\t//Disable terminal\r\n //Terminal.resetTerminalInput();\r\n\t\t\t\t\tdocument.getElementById(\"terminal-input-td\").innerHTML = '<input type=\"text\" class=\"terminal-input\"/>';\r\n\t\t\t\t\t$('input[class=terminal-input]').prop('disabled', true);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase \"help\":\r\n\t\t\t\tif (commandArray.length != 1 && commandArray.length != 2) {\r\n\t\t\t\t\tpost(\"Incorrect usage of help command. Usage: help\"); return;\r\n\t\t\t\t}\r\n\t\t\t\tif (commandArray.length == 1) {\r\n post(TerminalHelpText);\r\n } else {\r\n var cmd = commandArray[1];\r\n var txt = HelpTexts[cmd];\r\n if (txt == null) {\r\n post(\"Error: No help topics match '\" + cmd + \"'\");\r\n return;\r\n }\r\n post(txt);\r\n }\r\n\t\t\t\tbreak;\r\n\t\t\tcase \"home\":\r\n\t\t\t\tif (commandArray.length != 1) {\r\n post(\"Incorrect usage of home command. Usage: home\"); return;\r\n }\r\n Player.getCurrentServer().isConnectedTo = false;\r\n Player.currentServer = Player.getHomeComputer().ip;\r\n Player.getCurrentServer().isConnectedTo = true;\r\n post(\"Connected to home\");\r\n Terminal.resetTerminalInput();\r\n\t\t\t\tbreak;\r\n\t\t\tcase \"hostname\":\r\n\t\t\t\tif (commandArray.length != 1) {\r\n\t\t\t\t\tpost(\"Incorrect usage of hostname command. Usage: hostname\"); return;\r\n\t\t\t\t}\r\n\t\t\t\t//Print the hostname of current system\r\n\t\t\t\tpost(Player.getCurrentServer().hostname);\r\n\t\t\t\tbreak;\r\n\t\t\tcase \"ifconfig\":\r\n\t\t\t\tif (commandArray.length != 1) {\r\n\t\t\t\t\tpost(\"Incorrect usage of ifconfig command. Usage: ifconfig\"); return;\r\n\t\t\t\t}\r\n\t\t\t\t//Print the IP address of the current system\r\n\t\t\t\tpost(Player.getCurrentServer().ip);\r\n\t\t\t\tbreak;\r\n\t\t\tcase \"kill\":\r\n\t\t\t\tif (commandArray.length < 2) {\r\n\t\t\t\t\tpost(\"Incorrect usage of kill command. Usage: kill [scriptname] [arg1] [arg2]...\"); return;\r\n\t\t\t\t}\r\n var results = commandArray[1].split(\" \");\r\n\t\t\t\tvar scriptName = results[0];\r\n var args = [];\r\n for (var i = 1; i < results.length; ++i) {\r\n args.push(results[i]);\r\n }\r\n var runningScript = findRunningScript(scriptName, args, s);\r\n if (runningScript == null) {\r\n post(\"No such script is running. Nothing to kill\");\r\n return;\r\n }\r\n killWorkerScript(runningScript, s.ip);\r\n post(\"Killing \" + scriptName + \". May take up to a few minutes for the scripts to die...\");\r\n\t\t\t\tbreak;\r\n case \"killall\":\r\n for (var i = s.runningScripts.length-1; i >= 0; --i) {\r\n killWorkerScript(s.runningScripts[i], s.ip);\r\n }\r\n post(\"Killing all running scripts. May take up to a few minutes for the scripts to die...\");\r\n break;\r\n\t\t\tcase \"ls\":\r\n Terminal.executeListCommand(commandArray);\r\n\t\t\t\tbreak;\r\n case \"lscpu\":\r\n post(Player.getCurrentServer().cpuCores + \" Core(s)\");\r\n break;\r\n case \"mem\":\r\n if (commandArray.length != 2) {\r\n post(\"Incorrect usage of mem command. usage: mem [scriptname] [-t] [number threads]\"); return;\r\n }\r\n var scriptName = commandArray[1];\r\n var numThreads = 1;\r\n if (scriptName.indexOf(\" -t \") != -1) {\r\n var results = scriptName.split(\" \");\r\n if (results.length != 3) {\r\n post(\"Invalid use of run command. Usage: mem [script] [-t] [number threads]\");\r\n return;\r\n }\r\n numThreads = Math.round(Number(results[2]));\r\n if (isNaN(numThreads) || numThreads < 1) {\r\n post(\"Invalid number of threads specified. Number of threads must be greater than 1\");\r\n return;\r\n }\r\n scriptName = results[0];\r\n }\r\n\r\n var currServ = Player.getCurrentServer();\r\n for (var i = 0; i < currServ.scripts.length; ++i) {\r\n if (scriptName == currServ.scripts[i].filename) {\r\n var scriptBaseRamUsage = currServ.scripts[i].ramUsage;\r\n var ramUsage = scriptBaseRamUsage * numThreads * Math.pow(CONSTANTS.MultithreadingRAMCost, numThreads-1);\r\n\r\n post(\"This script requires \" + formatNumber(ramUsage, 2) + \"GB of RAM to run for \" + numThreads + \" thread(s)\");\r\n return;\r\n }\r\n }\r\n post(\"ERR: No such script exists!\");\r\n break;\r\n\t\t\tcase \"nano\":\r\n\t\t\t\tif (commandArray.length != 2) {\r\n\t\t\t\t\tpost(\"Incorrect usage of nano command. Usage: nano [scriptname]\"); return;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tvar filename = commandArray[1];\r\n if (filename === \".fconf\") {\r\n var text = createFconf();\r\n Engine.loadScriptEditorContent(filename, text);\r\n return;\r\n } else if (isScriptFilename(filename)) {\r\n for (var i = 0; i < s.scripts.length; i++) {\r\n \t\t\t\t\tif (filename == s.scripts[i].filename) {\r\n \t\t\t\t\t\tEngine.loadScriptEditorContent(filename, s.scripts[i].code);\r\n \t\t\t\t\t\treturn;\r\n \t\t\t\t\t}\r\n \t\t\t\t}\r\n } else if (filename.endsWith(\".txt\")) {\r\n for (var i = 0; i < s.textFiles.length; ++i) {\r\n if (filename === s.textFiles[i].fn) {\r\n Engine.loadScriptEditorContent(filename, s.textFiles[i].text);\r\n return;\r\n }\r\n }\r\n } else {\r\n post(\"Error: Invalid file. Only scripts (.script), text files (.txt), or .fconf can be edited with nano\"); return;\r\n }\r\n Engine.loadScriptEditorContent(filename);\r\n\t\t\t\tbreak;\r\n\t\t\tcase \"ps\":\r\n\t\t\t\tif (commandArray.length != 1) {\r\n\t\t\t\t\tpost(\"Incorrect usage of ps command. Usage: ps\"); return;\r\n\t\t\t\t}\r\n\t\t\t\tfor (var i = 0; i < s.runningScripts.length; i++) {\r\n var rsObj = s.runningScripts[i];\r\n var res = rsObj.filename;\r\n for (var j = 0; j < rsObj.args.length; ++j) {\r\n res += (\" \" + rsObj.args[j].toString());\r\n }\r\n\t\t\t\t\tpost(res);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase \"rm\":\r\n\t\t\t\tif (commandArray.length != 2) {\r\n post(\"Incorrect number of arguments. Usage: rm [program/script]\"); return;\r\n }\r\n\r\n //Check programs\r\n var delTarget = commandArray[1];\r\n\r\n if (delTarget.includes(\".exe\")) {\r\n for (var i = 0; i < s.programs.length; ++i) {\r\n if (s.programs[i] == delTarget) {\r\n s.programs.splice(i, 1);\r\n return;\r\n }\r\n }\r\n } else if (isScriptFilename(delTarget)) {\r\n for (var i = 0; i < s.scripts.length; ++i) {\r\n if (s.scripts[i].filename == delTarget) {\r\n //Check that the script isnt currently running\r\n for (var j = 0; j < s.runningScripts.length; ++j) {\r\n if (s.runningScripts[j].filename == delTarget) {\r\n post(\"Cannot delete a script that is currently running!\");\r\n return;\r\n }\r\n }\r\n s.scripts.splice(i, 1);\r\n return;\r\n }\r\n }\r\n } else if (delTarget.endsWith(\".lit\")) {\r\n for (var i = 0; i < s.messages.length; ++i) {\r\n var f = s.messages[i];\r\n if (!(f instanceof Message) && isString(f) && f === delTarget) {\r\n s.messages.splice(i, 1);\r\n return;\r\n }\r\n }\r\n } else if (delTarget.endsWith(\".txt\")) {\r\n for (var i = 0; i < s.textFiles.length; ++i) {\r\n if (s.textFiles[i].fn === delTarget) {\r\n s.textFiles.splice(i, 1);\r\n return;\r\n }\r\n }\r\n }\r\n post(\"Error: No such file exists\");\r\n\t\t\t\tbreak;\r\n\t\t\tcase \"run\":\r\n\t\t\t\t//Run a program or a script\r\n\t\t\t\tif (commandArray.length != 2) {\r\n\t\t\t\t\tpost(\"Incorrect number of arguments. Usage: run [program/script] [-t] [num threads] [arg1] [arg2]...\");\r\n\t\t\t\t} else {\r\n\t\t\t\t\tvar executableName = commandArray[1];\r\n\r\n //Secret Music player!\r\n if (executableName === \"musicplayer\") {\r\n post('<iframe src=\"https://open.spotify.com/embed/user/danielyxie/playlist/1ORnnL6YNvXOracUaUV2kh\" width=\"300\" height=\"380\" frameborder=\"0\" allowtransparency=\"true\"></iframe>', false);\r\n return;\r\n }\r\n\r\n\t\t\t\t\t//Check if its a script or just a program/executable\r\n\t\t\t\t\t//if (isScriptFilename(executableName)) {\r\n if (executableName.includes(\".script\") || executableName.includes(\".js\") || executableName.includes(\".ns\")) {\r\n\t\t\t\t\t\tTerminal.runScript(executableName);\r\n\t\t\t\t\t} else {\r\n Terminal.runProgram(executableName);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n case \"scan\":\r\n Terminal.executeScanCommand(commandArray);\r\n\t\t\t\tbreak;\r\n case \"scan-analyze\":\r\n if (commandArray.length == 1) {\r\n Terminal.executeScanAnalyzeCommand(1);\r\n } else if (commandArray.length == 2) {\r\n var all = false;\r\n if (commandArray[1].endsWith(\"-a\")) {\r\n all = true;\r\n commandArray[1] = commandArray[1].replace(\"-a\", \"\");\r\n }\r\n var depth;\r\n if (commandArray[1].length === 0) {\r\n depth = 1;\r\n } else {\r\n depth = Number(commandArray[1]);\r\n }\r\n if (isNaN(depth) || depth < 0) {\r\n post(\"Incorrect usage of scan-analyze command. depth argument must be positive numeric\");\r\n return;\r\n }\r\n if (depth > 3 && !Player.hasProgram(Programs.DeepscanV1) &&\r\n !Player.hasProgram(Programs.DeepscanV2)) {\r\n post(\"You cannot scan-analyze with that high of a depth. Maximum depth is 3\");\r\n return;\r\n } else if (depth > 5 && !Player.hasProgram(Programs.DeepscanV2)) {\r\n post(\"You cannot scan-analyze with that high of a depth. Maximum depth is 5\");\r\n return;\r\n } else if (depth > 10) {\r\n post(\"You cannot scan-analyze with that high of a depth. Maximum depth is 10\");\r\n return;\r\n }\r\n Terminal.executeScanAnalyzeCommand(depth, all);\r\n } else {\r\n post(\"Incorrect usage of scan-analyze command. usage: scan-analyze [depth]\");\r\n }\r\n break;\r\n\t\t\tcase \"scp\":\r\n\t\t\t\tif (commandArray.length != 2) {\r\n post(\"Incorrect usage of scp command. Usage: scp [file] [destination hostname/ip]\");\r\n return;\r\n }\r\n var args = commandArray[1].split(\" \");\r\n if (args.length != 2) {\r\n post(\"Incorrect usage of scp command. Usage: scp [file] [destination hostname/ip]\");\r\n return;\r\n }\r\n var scriptname = args[0];\r\n if (!scriptname.endsWith(\".lit\") && !isScriptFilename(scriptname) &&\r\n !scriptname.endsWith(\".txt\")){\r\n post(\"Error: scp only works for .script, .txt, and .lit files\");\r\n return;\r\n }\r\n var destServer = getServer(args[1]);\r\n if (destServer == null) {\r\n post(\"Invalid destination. \" + args[1] + \" not found\");\r\n return;\r\n }\r\n var ip = destServer.ip;\r\n var currServ = Player.getCurrentServer();\r\n\r\n //Scp for lit files\r\n if (scriptname.endsWith(\".lit\")) {\r\n var found = false;\r\n for (var i = 0; i < currServ.messages.length; ++i) {\r\n if (!(currServ.messages[i] instanceof Message) && currServ.messages[i] == scriptname) {\r\n found = true;\r\n break;\r\n }\r\n }\r\n\r\n if (!found) {return post(\"Error: no such file exists!\");}\r\n\r\n for (var i = 0; i < destServer.messages.length; ++i) {\r\n if (destServer.messages[i] === scriptname) {\r\n post(scriptname + \" copied over to \" + destServer.hostname);\r\n return; //Already exists\r\n }\r\n }\r\n destServer.messages.push(scriptname);\r\n post(scriptname + \" copied over to \" + destServer.hostname);\r\n return;\r\n }\r\n\r\n //Scp for txt files\r\n if (scriptname.endsWith(\".txt\")) {\r\n var found = false, txtFile;\r\n for (var i = 0; i < currServ.textFiles.length; ++i) {\r\n if (currServ.textFiles[i].fn === scriptname) {\r\n found = true;\r\n txtFile = currServ.textFiles[i];\r\n break;\r\n }\r\n }\r\n\r\n if (!found) {return post(\"Error: no such file exists!\");}\r\n\r\n for (var i = 0; i < destServer.textFiles.length; ++i) {\r\n if (destServer.textFiles[i].fn === scriptname) {\r\n //Overwrite\r\n destServer.textFiles[i].text = txtFile.text;\r\n post(\"WARNING: \" + scriptname + \" already exists on \" + destServer.hostname +\r\n \"and will be overwriten\");\r\n return post(scriptname + \" copied over to \" + destServer.hostname);\r\n }\r\n }\r\n var newFile = new TextFile(txtFile.fn, txtFile.text);\r\n destServer.textFiles.push(newFile);\r\n return post(scriptname + \" copied over to \" + destServer.hostname);\r\n }\r\n\r\n //Get the current script\r\n var sourceScript = null;\r\n for (var i = 0; i < currServ.scripts.length; ++i) {\r\n if (scriptname == currServ.scripts[i].filename) {\r\n sourceScript = currServ.scripts[i];\r\n break;\r\n }\r\n }\r\n if (sourceScript == null) {\r\n post(\"ERROR: scp() failed. No such script exists\");\r\n return;\r\n }\r\n\r\n //Overwrite script if it exists\r\n for (var i = 0; i < destServer.scripts.length; ++i) {\r\n if (scriptname == destServer.scripts[i].filename) {\r\n post(\"WARNING: \" + scriptname + \" already exists on \" + destServer.hostname + \" and will be overwritten\");\r\n var oldScript = destServer.scripts[i];\r\n oldScript.code = sourceScript.code;\r\n oldScript.ramUsage = sourceScript.ramUsage;\r\n post(scriptname + \" overwriten on \" + destServer.hostname);\r\n return;\r\n }\r\n }\r\n\r\n var newScript = new Script();\r\n newScript.filename = scriptname;\r\n newScript.code = sourceScript.code;\r\n newScript.ramUsage = sourceScript.ramUsage;\r\n newScript.destServer = ip;\r\n destServer.scripts.push(newScript);\r\n post(scriptname + \" copied over to \" + destServer.hostname);\r\n\t\t\t\tbreak;\r\n case \"sudov\":\r\n if (commandArray.length != 1) {\r\n post(\"Incorrect number of arguments. Usage: sudov\"); return;\r\n }\r\n\r\n if (Player.getCurrentServer().hasAdminRights) {\r\n post(\"You have ROOT access to this machine\");\r\n } else {\r\n post(\"You do NOT have root access to this machine\");\r\n }\r\n break;\r\n\t\t\tcase \"tail\":\r\n\t\t\t\tif (commandArray.length < 2) {\r\n post(\"Incorrect number of arguments. Usage: tail [script] [arg1] [arg2]...\");\r\n } else {\r\n var results = commandArray[1].split(\" \");\r\n var scriptName = results[0];\r\n var args = [];\r\n for (var i = 1; i < results.length; ++i) {\r\n args.push(results[i]);\r\n }\r\n\r\n //Can only tail script files\r\n if (isScriptFilename(scriptName) == false) {\r\n post(\"Error: tail can only be called on .script files (filename must end with .script)\"); return;\r\n }\r\n\r\n //Check that the script exists on this machine\r\n var runningScript = findRunningScript(scriptName, args, s);\r\n if (runningScript == null) {\r\n post(\"Error: No such script exists\");\r\n return;\r\n }\r\n logBoxCreate(runningScript);\r\n }\r\n\t\t\t\tbreak;\r\n case \"theme\":\r\n //todo support theme saving\r\n var args = commandArray[1] ? commandArray[1].split(\" \") : [];\r\n if (args.length != 1 && args.length != 3) {\r\n post(\"Incorrect number of arguments.\");\r\n post(\"Usage: theme [default|muted|solarized] | #[background color hex] #[text color hex] #[highlight color hex]\");\r\n } else if(args.length == 1){\r\n var themeName = args[0];\r\n if (themeName == \"default\"){\r\n document.body.style.setProperty('--my-highlight-color',\"#ffffff\");\r\n document.body.style.setProperty('--my-font-color',\"#66ff33\");\r\n document.body.style.setProperty('--my-background-color',\"#000000\");\r\n } else if (themeName == \"muted\"){\r\n document.body.style.setProperty('--my-highlight-color',\"#ffffff\");\r\n document.body.style.setProperty('--my-font-color',\"#66ff33\");\r\n document.body.style.setProperty('--my-background-color',\"#252527\");\r\n } else if (themeName == \"solarized\"){\r\n document.body.style.setProperty('--my-highlight-color',\"#6c71c4\");\r\n document.body.style.setProperty('--my-font-color',\"#839496\");\r\n document.body.style.setProperty('--my-background-color',\"#002b36\");\r\n } else {\r\n return post(\"Theme not found\");\r\n }\r\n Settings.ThemeHighlightColor = document.body.style.getPropertyValue(\"--my-highlight-color\");\r\n Settings.ThemeFontColor = document.body.style.getPropertyValue(\"--my-font-color\");\r\n Settings.ThemeBackgroundColor = document.body.style.getPropertyValue(\"--my-background-color\");\r\n } else {\r\n var inputBackgroundHex = args[0];\r\n var inputTextHex = args[1];\r\n var inputHighlightHex = args[2];\r\n if (/(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(inputBackgroundHex) &&\r\n /(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(inputTextHex) &&\r\n /(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(inputHighlightHex)){\r\n document.body.style.setProperty('--my-highlight-color',inputHighlightHex);\r\n document.body.style.setProperty('--my-font-color',inputTextHex);\r\n document.body.style.setProperty('--my-background-color',inputBackgroundHex);\r\n Settings.ThemeHighlightColor = document.body.style.getPropertyValue(\"--my-highlight-color\");\r\n Settings.ThemeFontColor = document.body.style.getPropertyValue(\"--my-font-color\");\r\n Settings.ThemeBackgroundColor = document.body.style.getPropertyValue(\"--my-background-color\");\r\n } else {\r\n return post(\"Invalid Hex Input for theme\");\r\n }\r\n }\r\n break;\r\n\t\t\tcase \"top\":\r\n\t\t\t\tif(commandArray.length != 1) {\r\n\t\t\t\t post(\"Incorrect usage of top command. Usage: top\"); return;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tpost(\"Script Threads RAM Usage\");\r\n\r\n\t\t\t\tvar currRunningScripts = Player.getCurrentServer().runningScripts;\r\n\t\t\t\t//Iterate through scripts on current server\r\n\t\t\t\tfor(var i = 0; i < currRunningScripts.length; i++) {\r\n\t\t\t\t\tvar script = currRunningScripts[i];\r\n\r\n\t\t\t\t\t//Calculate name padding\r\n\t\t\t\t\tvar numSpacesScript = 32 - script.filename.length; //26 -> width of name column\r\n if (numSpacesScript < 0) {numSpacesScript = 0;}\r\n\t\t\t\t\tvar spacesScript = Array(numSpacesScript+1).join(\" \");\r\n\r\n\t\t\t\t\t//Calculate thread padding\r\n\t\t\t\t\tvar numSpacesThread = 16 - (script.threads + \"\").length; //16 -> width of thread column\r\n\t\t\t\t\tvar spacesThread = Array(numSpacesThread+1).join(\" \");\r\n\r\n\t\t\t\t\t//Calculate and transform RAM usage\r\n\t\t\t\t\tramUsage = formatNumber(script.scriptRef.ramUsage * script.threads, 2).toString() + \"GB\";\r\n\r\n\t\t\t\t\tvar entry = [script.filename, spacesScript, script.threads, spacesThread, ramUsage];\r\n\t\t\t\t\tpost(entry.join(\"\"));\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n case \"unalias\":\r\n if (commandArray.length != 2) {\r\n post('Incorrect usage of unalias name. Usage: unalias \"[alias]\"');\r\n return;\r\n } else if (!(commandArray[1].startsWith('\"') && commandArray[1].endsWith('\"'))) {\r\n post('Incorrect usage of unalias name. Usage: unalias \"[alias]\"');\r\n } else {\r\n var alias = commandArray[1].slice(1, -1);\r\n if (removeAlias(alias)) {\r\n post(\"Removed alias \" + alias);\r\n } else {\r\n post(\"No such alias exists\");\r\n }\r\n }\r\n break;\r\n\t\t\tdefault:\r\n\t\t\t\tpost(\"Command not found\");\r\n\t\t}\r\n\t},\r\n\r\n connectToServer: function(ip) {\r\n console.log(\"Connect to server called\");\r\n var serv = getServer(ip);\r\n if (serv == null) {\r\n post(\"Invalid server. Connection failed.\");\r\n return;\r\n }\r\n Player.getCurrentServer().isConnectedTo = false;\r\n Player.currentServer = serv.ip;\r\n Player.getCurrentServer().isConnectedTo = true;\r\n post(\"Connected to \" + serv.hostname);\r\n if (Player.getCurrentServer().hostname == \"darkweb\") {\r\n checkIfConnectedToDarkweb(); //Posts a 'help' message if connecting to dark web\r\n }\r\n Terminal.resetTerminalInput();\r\n },\r\n\r\n executeListCommand: function(commandArray) {\r\n if (commandArray.length != 1 && commandArray.length != 2) {\r\n post(\"Incorrect usage of ls command. Usage: ls [| grep pattern]\"); return;\r\n }\r\n\r\n //grep\r\n var filter = null;\r\n if (commandArray.length == 2) {\r\n if (commandArray[1].startsWith(\"| grep \")) {\r\n var pattern = commandArray[1].replace(\"| grep \", \"\");\r\n if (pattern != \" \") {\r\n filter = pattern;\r\n }\r\n } else {\r\n post(\"Incorrect usage of ls command. Usage: ls [| grep pattern]\"); return;\r\n }\r\n }\r\n\r\n //Display all programs and scripts\r\n var allFiles = [];\r\n\r\n //Get all of the programs and scripts on the machine into one temporary array\r\n var s = Player.getCurrentServer();\r\n for (var i = 0; i < s.programs.length; i++) {\r\n if (filter) {\r\n if (s.programs[i].includes(filter)) {\r\n allFiles.push(s.programs[i]);\r\n }\r\n } else {\r\n allFiles.push(s.programs[i]);\r\n }\r\n }\r\n for (var i = 0; i < s.scripts.length; i++) {\r\n if (filter) {\r\n if (s.scripts[i].filename.includes(filter)) {\r\n allFiles.push(s.scripts[i].filename);\r\n }\r\n } else {\r\n allFiles.push(s.scripts[i].filename);\r\n }\r\n\r\n }\r\n for (var i = 0; i < s.messages.length; i++) {\r\n if (filter) {\r\n if (s.messages[i] instanceof Message) {\r\n if (s.messages[i].filename.includes(filter)) {\r\n allFiles.push(s.messages[i].filename);\r\n }\r\n } else if (s.messages[i].includes(filter)) {\r\n allFiles.push(s.messages[i]);\r\n }\r\n } else {\r\n if (s.messages[i] instanceof Message) {\r\n allFiles.push(s.messages[i].filename);\r\n } else {\r\n allFiles.push(s.messages[i]);\r\n }\r\n }\r\n }\r\n for (var i = 0; i < s.textFiles.length; ++i) {\r\n if (filter) {\r\n if (s.textFiles[i].fn.includes(filter)) {\r\n allFiles.push(s.textFiles[i].fn);\r\n }\r\n } else {\r\n allFiles.push(s.textFiles[i].fn);\r\n }\r\n }\r\n\r\n //Sort the files alphabetically then print each\r\n allFiles.sort();\r\n\r\n for (var i = 0; i < allFiles.length; i++) {\r\n post(allFiles[i]);\r\n }\r\n },\r\n\r\n executeScanCommand: function(commandArray) {\r\n if (commandArray.length != 1) {\r\n post(\"Incorrect usage of netstat/scan command. Usage: netstat/scan\"); return;\r\n }\r\n //Displays available network connections using TCP\r\n post(\"Hostname IP Root Access\");\r\n for (var i = 0; i < Player.getCurrentServer().serversOnNetwork.length; i++) {\r\n //Add hostname\r\n var entry = Player.getCurrentServer().getServerOnNetwork(i);\r\n if (entry == null) {continue;}\r\n entry = entry.hostname;\r\n\r\n //Calculate padding and add IP\r\n var numSpaces = 21 - entry.length;\r\n var spaces = Array(numSpaces+1).join(\" \");\r\n entry += spaces;\r\n entry += Player.getCurrentServer().getServerOnNetwork(i).ip;\r\n\r\n //Calculate padding and add root access info\r\n var hasRoot;\r\n if (Player.getCurrentServer().getServerOnNetwork(i).hasAdminRights) {\r\n hasRoot = 'Y';\r\n } else {\r\n hasRoot = 'N';\r\n }\r\n numSpaces = 21 - Player.getCurrentServer().getServerOnNetwork(i).ip.length;\r\n spaces = Array(numSpaces+1).join(\" \");\r\n entry += spaces;\r\n entry += hasRoot;\r\n post(entry);\r\n }\r\n },\r\n\r\n executeScanAnalyzeCommand: function(depth=1, all=false) {\r\n //We'll use the AllServersMap as a visited() array\r\n //TODO Using array as stack for now, can make more efficient\r\n post(\"~~~~~~~~~~ Beginning scan-analyze ~~~~~~~~~~\");\r\n post(\" \");\r\n var visited = new AllServersMap();\r\n\r\n var stack = [];\r\n var depthQueue = [0];\r\n var currServ = Player.getCurrentServer();\r\n stack.push(currServ);\r\n while(stack.length != 0) {\r\n var s = stack.pop();\r\n var d = depthQueue.pop();\r\n if (!all && s.purchasedByPlayer && s.hostname != \"home\") {\r\n continue; //Purchased server\r\n } else if (visited[s.ip] || d > depth) {\r\n continue; //Already visited or out-of-depth\r\n } else {\r\n visited[s.ip] = 1;\r\n }\r\n for (var i = s.serversOnNetwork.length-1; i >= 0; --i) {\r\n stack.push(s.getServerOnNetwork(i));\r\n depthQueue.push(d+1);\r\n }\r\n if (d == 0) {continue;} //Don't print current server\r\n var titleDashes = Array((d-1) * 4 + 1).join(\"-\");\r\n if (Player.hasProgram(Programs.AutoLink)) {\r\n post(\"<strong>\" + titleDashes + \"> <a class='scan-analyze-link'>\" + s.hostname + \"</a></strong>\", false);\r\n } else {\r\n post(\"<strong>\" + titleDashes + \">\" + s.hostname + \"</strong>\");\r\n }\r\n\r\n var dashes = titleDashes + \"--\";\r\n //var dashes = Array(d * 2 + 1).join(\"-\");\r\n var c = \"NO\";\r\n if (s.hasAdminRights) {c = \"YES\";}\r\n post(dashes + \"Root Access: \" + c + \", Required hacking skill: \" + s.requiredHackingSkill);\r\n post(dashes + \"Number of open ports required to NUKE: \" + s.numOpenPortsRequired);\r\n post(dashes + \"RAM: \" + s.maxRam);\r\n post(\" \");\r\n }\r\n\r\n var links = document.getElementsByClassName(\"scan-analyze-link\");\r\n for (var i = 0; i < links.length; ++i) {\r\n (function() {\r\n var hostname = links[i].innerHTML.toString();\r\n links[i].onclick = function() {\r\n if (Terminal.analyzeFlag || Terminal.hackFlag) {return;}\r\n Terminal.connectToServer(hostname);\r\n }\r\n }());//Immediate invocation\r\n }\r\n\r\n },\r\n\r\n executeFreeCommand: function(commandArray) {\r\n if (commandArray.length != 1) {\r\n post(\"Incorrect usage of free command. Usage: free\"); return;\r\n }\r\n post(\"Total: \" + formatNumber(Player.getCurrentServer().maxRam, 2) + \" GB\");\r\n post(\"Used: \" + formatNumber(Player.getCurrentServer().ramUsed, 2) + \" GB\");\r\n post(\"Available: \" + formatNumber(Player.getCurrentServer().maxRam - Player.getCurrentServer().ramUsed, 2) + \" GB\");\r\n },\r\n\r\n\t//First called when the \"run [program]\" command is called. Checks to see if you\r\n\t//have the executable and, if you do, calls the executeProgram() function\r\n\trunProgram: function(programName) {\r\n\t\t//Check if you have the program on your computer. If you do, execute it, otherwise\r\n\t\t//display an error message\r\n var splitArgs = programName.split(\" \");\r\n var name = \" \";\r\n if (splitArgs.length > 1) {\r\n name = splitArgs[0];\r\n } else {\r\n name = programName;\r\n }\r\n if (Player.hasProgram(name)) {\r\n Terminal.executeProgram(programName);\r\n return;\r\n }\r\n\t\tpost(\"ERROR: No such executable on home computer (Only programs that exist on your home computer can be run)\");\r\n\t},\r\n\r\n\t//Contains the implementations of all possible programs\r\n\texecuteProgram: function(programName) {\r\n var s = Player.getCurrentServer();\r\n var splitArgs = programName.split(\" \");\r\n if (splitArgs.length > 1) {\r\n programName = splitArgs[0];\r\n }\r\n\t\tswitch (programName) {\r\n\t\t\tcase Programs.NukeProgram:\r\n\t\t\t\tif (s.hasAdminRights) {\r\n\t\t\t\t\tpost(\"You already have root access to this computer. There is no reason to run NUKE.exe\");\r\n\t\t\t\t} else {\r\n\t\t\t\t\tif (s.openPortCount >= Player.getCurrentServer().numOpenPortsRequired) {\r\n\t\t\t\t\t\ts.hasAdminRights = true;\r\n\t\t\t\t\t\tpost(\"NUKE successful! Gained root access to \" + Player.getCurrentServer().hostname);\r\n\t\t\t\t\t\t//TODO Make this take time rather than be instant\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tpost(\"NUKE unsuccessful. Not enough ports have been opened\");\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n case Programs.BruteSSHProgram:\r\n if (s.sshPortOpen) {\r\n post(\"SSH Port (22) is already open!\");\r\n } else {\r\n s.sshPortOpen = true;\r\n post(\"Opened SSH Port(22)!\")\r\n ++s.openPortCount;\r\n }\r\n break;\r\n case Programs.FTPCrackProgram:\r\n if (s.ftpPortOpen) {\r\n post(\"FTP Port (21) is already open!\");\r\n } else {\r\n s.ftpPortOpen = true;\r\n post(\"Opened FTP Port (21)!\");\r\n ++s.openPortCount;\r\n }\r\n break;\r\n case Programs.RelaySMTPProgram:\r\n if (s.smtpPortOpen) {\r\n post(\"SMTP Port (25) is already open!\");\r\n } else {\r\n s.smtpPortOpen = true;\r\n post(\"Opened SMTP Port (25)!\");\r\n ++s.openPortCount;\r\n }\r\n break;\r\n case Programs.HTTPWormProgram:\r\n if (s.httpPortOpen) {\r\n post(\"HTTP Port (80) is already open!\");\r\n } else {\r\n s.httpPortOpen = true;\r\n post(\"Opened HTTP Port (80)!\");\r\n ++s.openPortCount;\r\n }\r\n break;\r\n case Programs.SQLInjectProgram:\r\n if (s.sqlPortOpen) {\r\n post(\"SQL Port (1433) is already open!\");\r\n } else {\r\n s.sqlPortOpen = true;\r\n post(\"Opened SQL Port (1433)!\");\r\n ++s.openPortCount;\r\n }\r\n break;\r\n case Programs.ServerProfiler:\r\n if (splitArgs.length != 2) {\r\n post(\"Must pass a server hostname or IP as an argument for ServerProfiler.exe\");\r\n return;\r\n }\r\n var serv = getServer(splitArgs[1]);\r\n if (serv == null) {\r\n post(\"Invalid server IP/hostname\");\r\n return;\r\n }\r\n post(serv.hostname + \":\");\r\n post(\"Server base security level: \" + serv.baseDifficulty);\r\n post(\"Server current security level: \" + serv.hackDifficulty);\r\n post(\"Server growth rate: \" + serv.serverGrowth);\r\n post(\"Netscript hack() execution time: \" + formatNumber(scriptCalculateHackingTime(serv), 1) + \"s\");\r\n post(\"Netscript grow() execution time: \" + formatNumber(scriptCalculateGrowTime(serv)/1000, 1) + \"s\");\r\n post(\"Netscript weaken() execution time: \" + formatNumber(scriptCalculateWeakenTime(serv)/1000, 1) + \"s\");\r\n break;\r\n case Programs.AutoLink:\r\n post(\"This executable cannot be run.\");\r\n post(\"AutoLink.exe lets you automatically connect to other servers when using 'scan-analyze'.\");\r\n post(\"When using scan-analyze, click on a server's hostname to connect to it.\");\r\n break;\r\n case Programs.DeepscanV1:\r\n post(\"This executable cannot be run.\");\r\n post(\"DeepscanV1.exe lets you run 'scan-analyze' with a depth up to 5.\");\r\n break;\r\n case Programs.DeepscanV2:\r\n post(\"This executable cannot be run.\");\r\n post(\"DeepscanV2.exe lets you run 'scan-analyze' with a depth up to 10.\");\r\n break;\r\n case Programs.Flight:\r\n post(\"Augmentations: \" + Player.augmentations.length + \" / 30\");\r\n post(\"Money: $\" + formatNumber(Player.money.toNumber(), 2) + \" / $\" + formatNumber(100000000000, 2));\r\n post(\"One path below must be fulfilled...\");\r\n post(\"----------HACKING PATH----------\");\r\n post(\"Hacking skill: \" + Player.hacking_skill + \" / 2500\");\r\n post(\"----------COMBAT PATH----------\");\r\n post(\"Strength: \" + Player.strength + \" / 1500\");\r\n post(\"Defense: \" + Player.defense + \" / 1500\");\r\n post(\"Dexterity: \" + Player.dexterity + \" / 1500\");\r\n post(\"Agility: \" + Player.agility + \" / 1500\");\r\n break;\r\n case Programs.BitFlume:\r\n var yesBtn = yesNoBoxGetYesButton(),\r\n noBtn = yesNoBoxGetNoButton();\r\n yesBtn.innerHTML = \"Travel to BitNode Nexus\";\r\n noBtn.innerHTML = \"Cancel\";\r\n yesBtn.addEventListener(\"click\", function() {\r\n hackWorldDaemon(Player.bitNodeN, true);\r\n return yesNoBoxClose();\r\n });\r\n noBtn.addEventListener(\"click\", function() {\r\n return yesNoBoxClose();\r\n });\r\n yesNoBoxCreate(\"WARNING: USING THIS PROGRAM WILL CAUSE YOU TO LOSE ALL OF YOUR PROGRESS ON THE CURRENT BITNODE.<br><br>\" +\r\n \"Do you want to travel to the BitNode Nexus? This allows you to reset the current BitNode \" +\r\n \"and select a new one.\");\r\n\r\n break;\r\n\t\t\tdefault:\r\n\t\t\t\tpost(\"Invalid executable. Cannot be run\");\r\n\t\t\t\treturn;\r\n\t\t}\r\n\t},\r\n\r\n\trunScript: function(scriptName) {\r\n\t\tvar server = Player.getCurrentServer();\r\n\r\n var numThreads = 1;\r\n var args = [];\r\n var results = scriptName.split(\" \");\r\n if (results.length <= 0) {\r\n post(\"This is a bug. Please contact developer\");\r\n }\r\n scriptName = results[0];\r\n if (results.length > 1) {\r\n if (results.length >= 3 && results[1] == \"-t\") {\r\n numThreads = Math.round(Number(results[2]));\r\n if (isNaN(numThreads) || numThreads < 1) {\r\n post(\"Invalid number of threads specified. Number of threads must be greater than 0\");\r\n return;\r\n }\r\n for (var i = 3; i < results.length; ++i) {\r\n var arg = results[i];\r\n\r\n //Forced string\r\n if ((arg.startsWith(\"'\") && arg.endsWith(\"'\")) ||\r\n (arg.startsWith('\"') && arg.endsWith('\"'))) {\r\n args.push(arg.slice(1, -1));\r\n continue;\r\n }\r\n //Number\r\n var tempNum = Number(arg);\r\n if (!isNaN(tempNum)) {\r\n args.push(tempNum);\r\n continue;\r\n }\r\n //Otherwise string\r\n args.push(arg);\r\n }\r\n } else {\r\n for (var i = 1; i < results.length; ++i) {\r\n var arg = results[i];\r\n\r\n //Forced string\r\n if ((arg.startsWith(\"'\") && arg.endsWith(\"'\")) ||\r\n (arg.startsWith('\"') && arg.endsWith('\"'))) {\r\n args.push(arg.slice(1, -1));\r\n continue;\r\n }\r\n //Number\r\n var tempNum = Number(arg);\r\n if (!isNaN(tempNum)) {\r\n args.push(tempNum);\r\n continue;\r\n }\r\n //Otherwise string\r\n args.push(arg);\r\n }\r\n }\r\n }\r\n\r\n\r\n //Check if this script is already running\r\n if (findRunningScript(scriptName, args, server) != null) {\r\n post(\"ERROR: This script is already running. Cannot run multiple instances\");\r\n return;\r\n }\r\n\r\n\t\t//Check if the script exists and if it does run it\r\n\t\tfor (var i = 0; i < server.scripts.length; i++) {\r\n\t\t\tif (server.scripts[i].filename == scriptName) {\r\n\t\t\t\t//Check for admin rights and that there is enough RAM availble to run\r\n var script = server.scripts[i];\r\n\t\t\t\tvar ramUsage = script.ramUsage * numThreads * Math.pow(CONSTANTS.MultithreadingRAMCost, numThreads-1);\r\n\t\t\t\tvar ramAvailable = server.maxRam - server.ramUsed;\r\n\r\n\t\t\t\tif (server.hasAdminRights == false) {\r\n\t\t\t\t\tpost(\"Need root access to run script\");\r\n\t\t\t\t\treturn;\r\n\t\t\t\t} else if (ramUsage > ramAvailable){\r\n\t\t\t\t\tpost(\"This machine does not have enough RAM to run this script with \" +\r\n numThreads + \" threads. Script requires \" + ramUsage + \"GB of RAM\");\r\n\t\t\t\t\treturn;\r\n\t\t\t\t} else {\r\n\t\t\t\t\t//Able to run script\r\n\t\t\t\t\tpost(\"Running script with \" + numThreads + \" thread(s) and args: \" + printArray(args) + \".\");\r\n post(\"May take a few seconds to start up the process...\");\r\n var runningScriptObj = new RunningScript(script, args);\r\n runningScriptObj.threads = numThreads;\r\n\t\t\t\t\tserver.runningScripts.push(runningScriptObj);\r\n\r\n\t\t\t\t\taddWorkerScript(runningScriptObj, server);\r\n\t\t\t\t\treturn;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tpost(\"ERROR: No such script\");\r\n\t}\r\n};\r\n\r\nexport {postNetburnerText, post, Terminal, KEY};\r\n","import {BitNodeMultipliers} from \"./BitNode.js\";\r\nimport {CONSTANTS} from \"./Constants.js\";\r\nimport {Engine} from \"./engine.js\";\r\nimport {Factions, getNextNeurofluxLevel,\r\n factionExists} from \"./Faction.js\";\r\nimport {hasBladeburnerSF} from \"./NetscriptFunctions.js\";\r\nimport {addWorkerScript} from \"./NetscriptWorker.js\";\r\nimport {Player} from \"./Player.js\";\r\nimport {prestigeAugmentation} from \"./Prestige.js\";\r\nimport {saveObject} from \"./SaveObject.js\";\r\nimport {Script, RunningScript} from \"./Script.js\";\r\nimport {Server} from \"./Server.js\";\r\nimport {SourceFiles} from \"./SourceFile.js\";\r\nimport {dialogBoxCreate} from \"../utils/DialogBox.js\";\r\nimport {createElement, createAccordionElement,\r\n removeChildrenFromElement, clearObject} from \"../utils/HelperFunctions.js\";\r\nimport {Reviver, Generic_toJSON,\r\n Generic_fromJSON} from \"../utils/JSONReviver.js\";\r\nimport {isString} from \"../utils/StringHelperFunctions.js\";\r\n\r\n//Augmentations\r\nfunction Augmentation(params) {\r\n if (params.name == null || params.info == null || params.moneyCost == null || params.repCost == null) {\r\n dialogBoxCreate(\"ERROR Creating Augmentations. This is a bug please contact game dev\");\r\n return;\r\n }\r\n this.name = params.name;\r\n this.info = params.info;\r\n this.owned = false;\r\n this.prereqs = params.prereqs ? params.prereqs : [];\r\n\r\n //Price and reputation base requirements (can change based on faction multipliers)\r\n this.baseRepRequirement = params.repCost * CONSTANTS.AugmentationRepMultiplier * BitNodeMultipliers.AugmentationRepCost;\r\n this.baseCost = params.moneyCost * CONSTANTS.AugmentationCostMultiplier * BitNodeMultipliers.AugmentationMoneyCost;\r\n\r\n //Level - Only applicable for some augmentations\r\n // NeuroFlux Governor\r\n this.level = 0;\r\n}\r\n\r\n//Takes in an array of faction names and adds this augmentation to all of those factions\r\nAugmentation.prototype.addToFactions = function(factionList) {\r\n for (var i = 0; i < factionList.length; ++i) {\r\n var faction = Factions[factionList[i]];\r\n if (faction == null) {\r\n throw new Error(\"In Augmentation.addToFactions(), could not find faction with this name:\" + factionList[i]);\r\n continue;\r\n }\r\n faction.augmentations.push(this.name);\r\n }\r\n}\r\n\r\nAugmentation.prototype.addToAllFactions = function() {\r\n for (var fac in Factions) {\r\n if (Factions.hasOwnProperty(fac)) {\r\n var facObj = Factions[fac];\r\n if (facObj == null) {\r\n console.log(\"ERROR: Invalid faction object\");\r\n continue;\r\n }\r\n facObj.augmentations.push(this.name);\r\n }\r\n }\r\n}\r\n\r\nAugmentation.prototype.toJSON = function() {\r\n return Generic_toJSON(\"Augmentation\", this);\r\n}\r\n\r\nAugmentation.fromJSON = function(value) {\r\n return Generic_fromJSON(Augmentation, value.data);\r\n}\r\n\r\nReviver.constructors.Augmentation = Augmentation;\r\n\r\nlet Augmentations = {}\r\n\r\nfunction AddToAugmentations(aug) {\r\n var name = aug.name;\r\n Augmentations[name] = aug;\r\n}\r\n\r\nlet AugmentationNames = {\r\n Targeting1: \"Augmented Targeting I\",\r\n Targeting2: \"Augmented Targeting II\",\r\n Targeting3: \"Augmented Targeting III\",\r\n SyntheticHeart: \"Synthetic Heart\",\r\n SynfibrilMuscle: \"Synfibril Muscle\",\r\n CombatRib1: \"Combat Rib I\",\r\n CombatRib2: \"Combat Rib II\",\r\n CombatRib3: \"Combat Rib III\",\r\n NanofiberWeave: \"Nanofiber Weave\",\r\n SubdermalArmor: \"NEMEAN Subdermal Weave\",\r\n WiredReflexes: \"Wired Reflexes\",\r\n GrapheneBoneLacings: \"Graphene Bone Lacings\",\r\n BionicSpine: \"Bionic Spine\",\r\n GrapheneBionicSpine: \"Graphene Bionic Spine Upgrade\",\r\n BionicLegs: \"Bionic Legs\",\r\n GrapheneBionicLegs: \"Graphene Bionic Legs Upgrade\",\r\n SpeechProcessor: \"Speech Processor Implant\",\r\n TITN41Injection: \"TITN-41 Gene-Modification Injection\",\r\n EnhancedSocialInteractionImplant: \"Enhanced Social Interaction Implant\",\r\n BitWire: \"BitWire\",\r\n ArtificialBioNeuralNetwork: \"Artificial Bio-neural Network Implant\",\r\n ArtificialSynapticPotentiation: \"Artificial Synaptic Potentiation\",\r\n EnhancedMyelinSheathing: \"Enhanced Myelin Sheathing\",\r\n SynapticEnhancement: \"Synaptic Enhancement Implant\",\r\n NeuralRetentionEnhancement: \"Neural-Retention Enhancement\",\r\n DataJack: \"DataJack\",\r\n ENM: \"Embedded Netburner Module\",\r\n ENMCore: \"Embedded Netburner Module Core Implant\",\r\n ENMCoreV2: \"Embedded Netburner Module Core V2 Upgrade\",\r\n ENMCoreV3: \"Embedded Netburner Module Core V3 Upgrade\",\r\n ENMAnalyzeEngine: \"Embedded Netburner Module Analyze Engine\",\r\n ENMDMA: \"Embedded Netburner Module Direct Memory Access Upgrade\",\r\n Neuralstimulator: \"Neuralstimulator\",\r\n NeuralAccelerator: \"Neural Accelerator\",\r\n CranialSignalProcessorsG1: \"Cranial Signal Processors - Gen I\",\r\n CranialSignalProcessorsG2: \"Cranial Signal Processors - Gen II\",\r\n CranialSignalProcessorsG3: \"Cranial Signal Processors - Gen III\",\r\n CranialSignalProcessorsG4: \"Cranial Signal Processors - Gen IV\",\r\n CranialSignalProcessorsG5: \"Cranial Signal Processors - Gen V\",\r\n NeuronalDensification: \"Neuronal Densification\",\r\n NuoptimalInjectorImplant: \"Nuoptimal Nootropic Injector Implant\",\r\n SpeechEnhancement: \"Speech Enhancement\",\r\n FocusWire: \"FocusWire\",\r\n PCDNI: \"PC Direct-Neural Interface\",\r\n PCDNIOptimizer: \"PC Direct-Neural Interface Optimization Submodule\",\r\n PCDNINeuralNetwork: \"PC Direct-Neural Interface NeuroNet Injector\",\r\n ADRPheromone1: \"ADR-V1 Pheromone Gene\",\r\n ADRPheromone2: \"ADR-V2 Pheromone Gene\",\r\n HacknetNodeCPUUpload: \"Hacknet Node CPU Architecture Neural-Upload\",\r\n HacknetNodeCacheUpload: \"Hacknet Node Cache Architecture Neural-Upload\",\r\n HacknetNodeNICUpload: \"Hacknet Node NIC Architecture Neural-Upload\",\r\n HacknetNodeKernelDNI: \"Hacknet Node Kernel Direct-Neural Interface\",\r\n HacknetNodeCoreDNI: \"Hacknet Node Core Direct-Neural Interface\",\r\n NeuroFluxGovernor: \"NeuroFlux Governor\",\r\n Neurotrainer1: \"Neurotrainer I\",\r\n Neurotrainer2: \"Neurotrainer II\",\r\n Neurotrainer3: \"Neurotrainer III\",\r\n Hypersight: \"HyperSight Corneal Implant\",\r\n LuminCloaking1: \"LuminCloaking-V1 Skin Implant\",\r\n LuminCloaking2: \"LuminCloaking-V2 Skin Implant\",\r\n HemoRecirculator: \"HemoRecirculator\",\r\n SmartSonar: \"SmartSonar Implant\",\r\n PowerRecirculator: \"Power Recirculation Core\",\r\n QLink: \"QLink\",\r\n TheRedPill: \"The Red Pill\",\r\n SPTN97: \"SPTN-97 Gene Modification\",\r\n HiveMind: \"ECorp HVMind Implant\",\r\n CordiARCReactor: \"CordiARC Fusion Reactor\",\r\n SmartJaw: \"SmartJaw\",\r\n Neotra: \"Neotra\",\r\n Xanipher: \"Xanipher\",\r\n nextSENS: \"nextSENS Gene Modification\",\r\n OmniTekInfoLoad: \"OmniTek InfoLoad\",\r\n PhotosyntheticCells: \"Photosynthetic Cells\",\r\n Neurolink: \"BitRunners Neurolink\",\r\n TheBlackHand: \"The Black Hand\",\r\n CRTX42AA: \"CRTX42-AA Gene Modification\",\r\n Neuregen: \"Neuregen Gene Modification\",\r\n CashRoot: \"CashRoot Starter Kit\",\r\n NutriGen: \"NutriGen Implant\",\r\n INFRARet: \"INFRARET Enhancement\",\r\n DermaForce: \"DermaForce Particle Barrier\",\r\n GrapheneBrachiBlades: \"Graphene BranchiBlades Upgrade\",\r\n GrapheneBionicArms: \"Graphene Bionic Arms Upgrade\",\r\n BrachiBlades: \"BrachiBlades\",\r\n BionicArms: \"Bionic Arms\",\r\n SNA: \"Social Negotiation Assistant (S.N.A)\",\r\n EsperEyewear: \"EsperTech Bladeburner Eyewear\",\r\n EMS4Recombination: \"EMS-4 Recombination\",\r\n OrionShoulder: \"ORION-MKIV Shoulder\",\r\n HyperionV1: \"Hyperion Plasma Cannon V1\",\r\n HyperionV2: \"Hyperion Plasma Cannon V2\",\r\n GolemSerum: \"GOLEM Serum\",\r\n VangelisVirus: \"Vangelis Virus\",\r\n VangelisVirus3: \"Vangelis Virus 3.0\",\r\n INTERLINKED: \"I.N.T.E.R.L.I.N.K.E.D\",\r\n BladeRunner: \"Blade's Runners\",\r\n BladeArmor: \"BLADE-51b Tesla Armor\",\r\n BladeArmorPowerCells: \"BLADE-51b Tesla Armor: Power Cells Upgrade\",\r\n BladeArmorEnergyShielding: \"BLADE-51b Tesla Armor: Energy Shielding Upgrade\",\r\n BladeArmorUnibeam: \"BLADE-51b Tesla Armor: Unibeam Upgrade\",\r\n BladeArmorOmnibeam: \"BLADE-51b Tesla Armor: Omnibeam Upgrade\",\r\n BladeArmorIPU: \"BLADE-51b Tesla Armor: IPU Upgrade\",\r\n\r\n //Wasteland Augs\r\n //PepBoy: \"P.E.P-Boy\", Plasma Energy Projection System\r\n //PepBoyForceField Generates plasma force fields\r\n //PepBoyBlasts Generate high density plasma concussive blasts\r\n //PepBoyDataStorage STore more data on pep boy,\r\n}\r\n\r\nfunction initAugmentations() {\r\n for (var name in Factions) {\r\n if (Factions.hasOwnProperty(name)) {\r\n Factions[name].augmentations = [];\r\n }\r\n }\r\n\r\n //Reset Augmentations\r\n clearObject(Augmentations);\r\n\r\n //Combat stat augmentations\r\n var HemoRecirculator = new Augmentation({\r\n name:AugmentationNames.HemoRecirculator, moneyCost: 9e6, repCost:4e3,\r\n info:\"A heart implant that greatly increases the body's ability to effectively use and pump \" +\r\n \"blood. <br><br> This augmentation increases all of the player's combat stats by 8%.\"\r\n });\r\n HemoRecirculator.addToFactions([\"Tetrads\", \"The Dark Army\", \"The Syndicate\"]);\r\n if (augmentationExists(AugmentationNames.HemoRecirculator)) {\r\n delete Augmentations[AugmentationNames.HemoRecirculator];\r\n }\r\n AddToAugmentations(HemoRecirculator);\r\n\r\n var Targeting1 = new Augmentation({\r\n name:AugmentationNames.Targeting1, moneyCost:3e6, repCost:2e3,\r\n info:\"This cranial implant is embedded within the player's inner ear structure and optic nerves. It regulates and enhances the user's \" +\r\n \"balance and hand-eye coordination. It is also capable of augmenting reality by projecting digital information \" +\r\n \"directly onto the retina. These enhancements allow the player to better lock-on and keep track of enemies. <br><br>\" +\r\n \"This augmentation increases the player's dexterity by 10%.\"\r\n });\r\n Targeting1.addToFactions([\"Slum Snakes\", \"The Dark Army\", \"The Syndicate\", \"Sector-12\", \"Volhaven\", \"Ishima\",\r\n \"OmniTek Incorporated\", \"KuaiGong International\", \"Blade Industries\"]);\r\n if (augmentationExists(AugmentationNames.Targeting1)) {\r\n delete Augmentations[AugmentationNames.Targeting1];\r\n }\r\n AddToAugmentations(Targeting1);\r\n\r\n var Targeting2 = new Augmentation({\r\n name:AugmentationNames.Targeting2, moneyCost:8.5e6, repCost:3.5e3,\r\n info:\"This is an upgrade of the Augmented Targeting I cranial implant, which is capable of augmenting reality \" +\r\n \"and enhances the user's balance and hand-eye coordination. <br><br>This upgrade increases the player's dexterity \" +\r\n \"by an additional 20%.\",\r\n prereqs:[AugmentationNames.Targeting1]\r\n });\r\n Targeting2.addToFactions([\"The Dark Army\", \"The Syndicate\", \"Sector-12\", \"Volhaven\", \"Ishima\",\r\n \"OmniTek Incorporated\", \"KuaiGong International\", \"Blade Industries\"]);\r\n if (augmentationExists(AugmentationNames.Targeting2)) {\r\n delete Augmentations[AugmentationNames.Targeting2];\r\n }\r\n AddToAugmentations(Targeting2);\r\n\r\n var Targeting3 = new Augmentation({\r\n name:AugmentationNames.Targeting3, moneyCost:23e6, repCost:11e3,\r\n info:\"This is an upgrade of the Augmented Targeting II cranial implant, which is capable of augmenting reality \" +\r\n \"and enhances the user's balance and hand-eye coordination. <br><br>This upgrade increases the player's dexterity \" +\r\n \"by an additional 30%.\",\r\n prereqs:[AugmentationNames.Targeting2]\r\n });\r\n Targeting3.addToFactions([\"The Dark Army\", \"The Syndicate\", \"OmniTek Incorporated\",\r\n \"KuaiGong International\", \"Blade Industries\", \"The Covenant\"]);\r\n if (augmentationExists(AugmentationNames.Targeting3)) {\r\n delete Augmentations[AugmentationNames.Targeting3];\r\n }\r\n AddToAugmentations(Targeting3);\r\n\r\n var SyntheticHeart = new Augmentation({\r\n name:AugmentationNames.SyntheticHeart, moneyCost:575e6, repCost:300e3,\r\n info:\"This advanced artificial heart, created from plasteel and graphene, is capable of pumping more blood \" +\r\n \"at much higher efficiencies than a normal human heart.<br><br> This augmentation increases the player's agility \" +\r\n \"and strength by 50%\"\r\n });\r\n SyntheticHeart.addToFactions([\"KuaiGong International\", \"Fulcrum Secret Technologies\", \"Speakers for the Dead\",\r\n \"NWO\", \"The Covenant\", \"Daedalus\", \"Illuminati\"]);\r\n if (augmentationExists(AugmentationNames.SyntheticHeart)) {\r\n delete Augmentations[AugmentationNames.SyntheticHeart];\r\n }\r\n AddToAugmentations(SyntheticHeart);\r\n\r\n var SynfibrilMuscle = new Augmentation({\r\n name:AugmentationNames.SynfibrilMuscle, repCost:175e3, moneyCost:225e6,\r\n info:\"The myofibrils in human muscles are injected with special chemicals that react with the proteins inside \" +\r\n \"the myofibrils, altering their underlying structure. The end result is muscles that are stronger and more elastic. \" +\r\n \"Scientists have named these artificially enhanced units 'synfibrils'.<br><br> This augmentation increases the player's \" +\r\n \"strength and defense by 30%.\"\r\n });\r\n SynfibrilMuscle.addToFactions([\"KuaiGong International\", \"Fulcrum Secret Technologies\", \"Speakers for the Dead\",\r\n \"NWO\", \"The Covenant\", \"Daedalus\", \"Illuminati\", \"Blade Industries\"]);\r\n if (augmentationExists(AugmentationNames.SynfibrilMuscle)) {\r\n delete Augmentations[AugmentationNames.SynfibrilMuscle];\r\n }\r\n AddToAugmentations(SynfibrilMuscle)\r\n\r\n var CombatRib1 = new Augmentation({\r\n name:AugmentationNames.CombatRib1, repCost:3e3, moneyCost:4750000,\r\n info:\"The human body's ribs are replaced with artificial ribs that automatically and continuously release cognitive \" +\r\n \"and performance-enhancing drugs into the bloodstream, improving the user's abilities in combat.<br><br>\" +\r\n \"This augmentation increases the player's strength and defense by 10%.\"\r\n });\r\n CombatRib1.addToFactions([\"Slum Snakes\", \"The Dark Army\", \"The Syndicate\", \"Sector-12\", \"Volhaven\", \"Ishima\",\r\n \"OmniTek Incorporated\", \"KuaiGong International\", \"Blade Industries\"]);\r\n if (augmentationExists(AugmentationNames.CombatRib1)) {\r\n delete Augmentations[AugmentationNames.CombatRib1];\r\n }\r\n AddToAugmentations(CombatRib1);\r\n\r\n var CombatRib2 = new Augmentation({\r\n name:AugmentationNames.CombatRib2, repCost:7.5e3, moneyCost:13e6,\r\n info:\"This is an upgrade to the Combat Rib I augmentation, and is capable of releasing even more potent combat-enhancing \" +\r\n \"drugs into the bloodstream.<br><br>This upgrade increases the player's strength and defense by an additional 14%.\",\r\n prereqs:[AugmentationNames.CombatRib1]\r\n });\r\n CombatRib2.addToFactions([\"The Dark Army\", \"The Syndicate\", \"Sector-12\", \"Volhaven\", \"Ishima\",\r\n \"OmniTek Incorporated\", \"KuaiGong International\", \"Blade Industries\"]);\r\n if (augmentationExists(AugmentationNames.CombatRib2)) {\r\n delete Augmentations[AugmentationNames.CombatRib2];\r\n }\r\n AddToAugmentations(CombatRib2);\r\n\r\n var CombatRib3 = new Augmentation({\r\n name:AugmentationNames.CombatRib3, repCost:14e3, moneyCost:24e6,\r\n info:\"This is an upgrade to the Combat Rib II augmentation, and is capable of releasing even more potent combat-enhancing \" +\r\n \"drugs into the bloodstream<br><br>. This upgrade increases the player's strength and defense by an additional 18%.\",\r\n prereqs:[AugmentationNames.CombatRib2],\r\n });\r\n CombatRib3.addToFactions([\"The Dark Army\", \"The Syndicate\", \"OmniTek Incorporated\",\r\n \"KuaiGong International\", \"Blade Industries\", \"The Covenant\"]);\r\n if (augmentationExists(AugmentationNames.CombatRib3)) {\r\n delete Augmentations[AugmentationNames.CombatRib3];\r\n }\r\n AddToAugmentations(CombatRib3);\r\n\r\n var NanofiberWeave = new Augmentation({\r\n name:AugmentationNames.NanofiberWeave, repCost:15e3, moneyCost:25e6,\r\n info:\"Synthetic nanofibers are woven into the skin's extracellular matrix using electrospinning. \" +\r\n \"This improves the skin's ability to regenerate itself and protect the body from external stresses and forces.<br><br>\" +\r\n \"This augmentation increases the player's strength and defense by 20%.\"\r\n });\r\n NanofiberWeave.addToFactions([\"Tian Di Hui\", \"The Syndicate\", \"The Dark Army\", \"Speakers for the Dead\",\r\n \"Blade Industries\", \"Fulcrum Secret Technologies\", \"OmniTek Incorporated\"]);\r\n if (augmentationExists(AugmentationNames.NanofiberWeave)) {\r\n delete Augmentations[AugmentationNames.NanofiberWeave];\r\n }\r\n AddToAugmentations(NanofiberWeave);\r\n\r\n var SubdermalArmor = new Augmentation({\r\n name:AugmentationNames.SubdermalArmor, repCost:350e3, moneyCost:650e6,\r\n info:\"The NEMEAN Subdermal Weave is a thin, light-weight, graphene plating that houses a dilatant fluid. \" +\r\n \"The material is implanted underneath the skin, and is the most advanced form of defensive enhancement \" +\r\n \"that has ever been created. The dilatant fluid, despite being thin and light, is extremely effective \" +\r\n \"at stopping piercing blows and reducing blunt trauma. The properties of graphene allow the plating to \" +\r\n \"mitigate damage from any fire-related or electrical traumas.<br><br>\" +\r\n \"This augmentation increases the player's defense by 120%.\"\r\n });\r\n SubdermalArmor.addToFactions([\"The Syndicate\", \"Fulcrum Secret Technologies\", \"Illuminati\", \"Daedalus\",\r\n \"The Covenant\"]);\r\n if (augmentationExists(AugmentationNames.SubdermalArmor)) {\r\n delete Augmentations[AugmentationNames.SubdermalArmor];\r\n }\r\n AddToAugmentations(SubdermalArmor);\r\n\r\n var WiredReflexes = new Augmentation({\r\n name:AugmentationNames.WiredReflexes, repCost:500, moneyCost:500e3,\r\n info:\"Synthetic nerve-enhancements are injected into all major parts of the somatic nervous system, \" +\r\n \"supercharging the body's ability to send signals through neurons. This results in increased reflex speed.<br><br>\" +\r\n \"This augmentation increases the player's agility and dexterity by 5%.\"\r\n });\r\n WiredReflexes.addToFactions([\"Tian Di Hui\", \"Slum Snakes\", \"Sector-12\", \"Volhaven\", \"Aevum\", \"Ishima\",\r\n \"The Syndicate\", \"The Dark Army\", \"Speakers for the Dead\"]);\r\n if (augmentationExists(AugmentationNames.WiredReflexes)) {\r\n delete Augmentations[AugmentationNames.WiredReflexes];\r\n }\r\n AddToAugmentations(WiredReflexes);\r\n\r\n var GrapheneBoneLacings = new Augmentation({\r\n name:AugmentationNames.GrapheneBoneLacings, repCost:450e3, moneyCost:850e6,\r\n info:\"A graphene-based material is grafted and fused into the user's bones, significantly increasing \" +\r\n \"their density and tensile strength.<br><br>\" +\r\n \"This augmentation increases the player's strength and defense by 70%.\"\r\n });\r\n GrapheneBoneLacings.addToFactions([\"Fulcrum Secret Technologies\", \"The Covenant\"]);\r\n if (augmentationExists(AugmentationNames.GrapheneBoneLacings)) {\r\n delete Augmentations[AugmentationNames.GrapheneBoneLacings];\r\n }\r\n AddToAugmentations(GrapheneBoneLacings);\r\n\r\n var BionicSpine = new Augmentation({\r\n name:AugmentationNames.BionicSpine, repCost:18e3, moneyCost:25e6,\r\n info:\"An artificial spine created from plasteel and carbon fibers that completely replaces the organic spine. \" +\r\n \"Not only is the Bionic Spine physically stronger than a human spine, but it is also capable of digitally \" +\r\n \"stimulating and regulating the neural signals that are sent and received by the spinal cord. This results in \" +\r\n \"greatly improved senses and reaction speeds.<br><br>\" +\r\n \"This augmentation increases all of the player's combat stats by 15%.\"\r\n });\r\n BionicSpine.addToFactions([\"Speakers for the Dead\", \"The Syndicate\", \"KuaiGong International\",\r\n \"OmniTek Incorporated\", \"Blade Industries\"]);\r\n if (augmentationExists(AugmentationNames.BionicSpine)) {\r\n delete Augmentations[AugmentationNames.BionicSpine];\r\n }\r\n AddToAugmentations(BionicSpine);\r\n\r\n var GrapheneBionicSpine = new Augmentation({\r\n name:AugmentationNames.GrapheneBionicSpine, repCost:650e3, moneyCost:1200e6,\r\n info:\"An upgrade to the Bionic Spine augmentation. It fuses the implant with an advanced graphene \" +\r\n \"material to make it much stronger and lighter.<br><br>\" +\r\n \"This augmentation increases all of the player's combat stats by 60%.\",\r\n prereqs:[AugmentationNames.BionicSpine],\r\n });\r\n GrapheneBionicSpine.addToFactions([\"Fulcrum Secret Technologies\", \"ECorp\"]);\r\n if (augmentationExists(AugmentationNames.GrapheneBionicSpine)) {\r\n delete Augmentations[AugmentationNames.GrapheneBionicSpine];\r\n }\r\n AddToAugmentations(GrapheneBionicSpine);\r\n\r\n var BionicLegs = new Augmentation({\r\n name:AugmentationNames.BionicLegs, repCost:60e3, moneyCost:75e6,\r\n info:\"Cybernetic legs created from plasteel and carbon fibers that completely replace the user's organic legs. <br><br>\" +\r\n \"This augmentation increases the player's agility by 60%.\"\r\n });\r\n BionicLegs.addToFactions([\"Speakers for the Dead\", \"The Syndicate\", \"KuaiGong International\",\r\n \"OmniTek Incorporated\", \"Blade Industries\"]);\r\n if (augmentationExists(AugmentationNames.BionicLegs)) {\r\n delete Augmentations[AugmentationNames.BionicLegs];\r\n }\r\n AddToAugmentations(BionicLegs);\r\n\r\n var GrapheneBionicLegs = new Augmentation({\r\n name:AugmentationNames.GrapheneBionicLegs, repCost:300e3, moneyCost:900e6,\r\n info:\"An upgrade to the Bionic Legs augmentation. It fuses the implant with an advanced graphene \" +\r\n \"material to make it much stronger and lighter.<br><br>\" +\r\n \"This augmentation increases the player's agility by an additional 150%.\",\r\n prereqs:[AugmentationNames.BionicLegs],\r\n });\r\n GrapheneBionicLegs.addToFactions([\"MegaCorp\", \"ECorp\", \"Fulcrum Secret Technologies\"]);\r\n if (augmentationExists(AugmentationNames.GrapheneBionicLegs)) {\r\n delete Augmentations[AugmentationNames.GrapheneBionicLegs];\r\n }\r\n AddToAugmentations(GrapheneBionicLegs);\r\n\r\n //Labor stat augmentations\r\n var SpeechProcessor = new Augmentation({\r\n name:AugmentationNames.SpeechProcessor, repCost:3e3, moneyCost:10e6,\r\n info:\"A cochlear implant with an embedded computer that analyzes incoming speech. \" +\r\n \"The embedded computer processes characteristics of incoming speech, such as tone \" +\r\n \"and inflection, to pick up on subtle cues and aid in social interactions.<br><br>\" +\r\n \"This augmentation increases the player's charisma by 20%.\"\r\n });\r\n SpeechProcessor.addToFactions([\"Tian Di Hui\", \"Chongqing\", \"Sector-12\", \"New Tokyo\", \"Aevum\",\r\n \"Ishima\", \"Volhaven\", \"Silhouette\"]);\r\n if (augmentationExists(AugmentationNames.SpeechProcessor)) {\r\n delete Augmentations[AugmentationNames.SpeechProcessor];\r\n }\r\n AddToAugmentations(SpeechProcessor);\r\n\r\n let TITN41Injection = new Augmentation({\r\n name:AugmentationNames.TITN41Injection, repCost:10e3, moneyCost:38e6,\r\n info:\"TITN is a series of viruses that targets and alters the sequences of human DNA in genes that \" +\r\n \"control personality. The TITN-41 strain alters these genes so that the subject becomes more \" +\r\n \"outgoing and socialable. <br><br>\" +\r\n \"This augmentation increases the player's charisma and charisma experience gain rate by 15%\"\r\n });\r\n TITN41Injection.addToFactions([\"Silhouette\"]);\r\n if (augmentationExists(AugmentationNames.TITN41Injection)) {\r\n delete Augmentations[AugmentationNames.TITN41Injection];\r\n }\r\n AddToAugmentations(TITN41Injection);\r\n\r\n var EnhancedSocialInteractionImplant = new Augmentation({\r\n name:AugmentationNames.EnhancedSocialInteractionImplant, repCost:150e3, moneyCost:275e6,\r\n info:\"A cranial implant that greatly assists in the user's ability to analyze social situations \" +\r\n \"and interactions. The system uses a wide variety of factors such as facial expression, body \" +\r\n \"language, and the voice's tone/inflection to determine the best course of action during social\" +\r\n \"situations. The implant also uses deep learning software to continuously learn new behavior\" +\r\n \"patterns and how to best respond.<br><br>\" +\r\n \"This augmentation increases the player's charisma and charisma experience gain rate by 60%.\"\r\n });\r\n EnhancedSocialInteractionImplant.addToFactions([\"Bachman & Associates\", \"NWO\", \"Clarke Incorporated\",\r\n \"OmniTek Incorporated\", \"Four Sigma\"]);\r\n if (augmentationExists(AugmentationNames.EnhancedSocialInteractionImplant)) {\r\n delete Augmentations[AugmentationNames.EnhancedSocialInteractionImplant];\r\n }\r\n AddToAugmentations(EnhancedSocialInteractionImplant);\r\n\r\n //Hacking augmentations\r\n var BitWire = new Augmentation({\r\n name:AugmentationNames.BitWire, repCost:1500, moneyCost:2e6,\r\n info: \"A small brain implant embedded in the cerebrum. This regulates and improves the brain's computing \" +\r\n \"capabilities. <br><br> This augmentation increases the player's hacking skill by 5%\"\r\n });\r\n BitWire.addToFactions([\"CyberSec\", \"NiteSec\"]);\r\n if (augmentationExists(AugmentationNames.BitWire)) {\r\n delete Augmentations[AugmentationNames.BitWire];\r\n }\r\n AddToAugmentations(BitWire);\r\n\r\n var ArtificialBioNeuralNetwork = new Augmentation({\r\n name:AugmentationNames.ArtificialBioNeuralNetwork, repCost:110e3, moneyCost:600e6,\r\n info:\"A network consisting of millions of nanoprocessors is embedded into the brain. \" +\r\n \"The network is meant to mimick the way a biological brain solves a problem, which each \" +\r\n \"nanoprocessor acting similar to the way a neuron would in a neural network. However, these \" +\r\n \"nanoprocessors are programmed to perform computations much faster than organic neurons, \" +\r\n \"allowing its user to solve much more complex problems at a much faster rate.<br><br>\" +\r\n \"This augmentation:<br>\" +\r\n \"Increases the player's hacking speed by 3%<br>\" +\r\n \"Increases the amount of money the player's gains from hacking by 15%<br>\" +\r\n \"Increases the player's hacking skill by 12%\"\r\n });\r\n ArtificialBioNeuralNetwork.addToFactions([\"BitRunners\", \"Fulcrum Secret Technologies\"]);\r\n if (augmentationExists(AugmentationNames.ArtificialBioNeuralNetwork)) {\r\n delete Augmentations[AugmentationNames.ArtificialBioNeuralNetwork];\r\n }\r\n AddToAugmentations(ArtificialBioNeuralNetwork);\r\n\r\n var ArtificialSynapticPotentiation = new Augmentation({\r\n name:AugmentationNames.ArtificialSynapticPotentiation, repCost:2500, moneyCost:16e6,\r\n info:\"The body is injected with a chemical that artificially induces synaptic potentiation, \" +\r\n \"otherwise known as the strengthening of synapses. This results in a enhanced cognitive abilities.<br><br>\" +\r\n \"This augmentation: <br>\" +\r\n \"Increases the player's hacking speed by 2% <br> \" +\r\n \"Increases the player's hacking chance by 5%<br>\" +\r\n \"Increases the player's hacking experience gain rate by 5%\"\r\n });\r\n ArtificialSynapticPotentiation.addToFactions([\"The Black Hand\", \"NiteSec\"]);\r\n if (augmentationExists(AugmentationNames.ArtificialSynapticPotentiation)) {\r\n delete Augmentations[AugmentationNames.ArtificialSynapticPotentiation];\r\n }\r\n AddToAugmentations(ArtificialSynapticPotentiation);\r\n\r\n var EnhancedMyelinSheathing = new Augmentation({\r\n name:AugmentationNames.EnhancedMyelinSheathing, repCost:40e3, moneyCost:275e6,\r\n info:\"Electrical signals are used to induce a new, artificial form of myelinogensis in the human body. \" +\r\n \"This process results in the proliferation of new, synthetic myelin sheaths in the nervous \" +\r\n \"system. These myelin sheaths can propogate neuro-signals much faster than their organic \" +\r\n \"counterparts, leading to greater processing speeds and better brain function.<br><br>\" +\r\n \"This augmentation:<br>\" +\r\n \"Increases the player's hacking speed by 3%<br>\" +\r\n \"Increases the player's hacking skill by 8%<br>\" +\r\n \"Increases the player's hacking experience gain rate by 10%\"\r\n });\r\n EnhancedMyelinSheathing.addToFactions([\"Fulcrum Secret Technologies\", \"BitRunners\", \"The Black Hand\"]);\r\n if (augmentationExists(AugmentationNames.EnhancedMyelinSheathing)) {\r\n delete Augmentations[AugmentationNames.EnhancedMyelinSheathing];\r\n }\r\n AddToAugmentations(EnhancedMyelinSheathing);\r\n\r\n var SynapticEnhancement = new Augmentation({\r\n name:AugmentationNames.SynapticEnhancement, repCost:800, moneyCost:1.5e6,\r\n info:\"A small cranial implant that continuously uses weak electric signals to stimulate the brain and \" +\r\n \"induce stronger synaptic activity. This improves the user's cognitive abilities.<br><br>\" +\r\n \"This augmentation increases the player's hacking speed by 3%.\"\r\n });\r\n SynapticEnhancement.addToFactions([\"CyberSec\"]);\r\n if (augmentationExists(AugmentationNames.SynapticEnhancement)) {\r\n delete Augmentations[AugmentationNames.SynapticEnhancement];\r\n }\r\n AddToAugmentations(SynapticEnhancement);\r\n\r\n var NeuralRetentionEnhancement = new Augmentation({\r\n name:AugmentationNames.NeuralRetentionEnhancement, repCost:8e3, moneyCost:50e6,\r\n info:\"Chemical injections are used to permanently alter and strengthen the brain's neuronal \" +\r\n \"circuits, strengthening its ability to retain information.<br><br>\" +\r\n \"This augmentation increases the player's hacking experience gain rate by 25%.\"\r\n });\r\n NeuralRetentionEnhancement.addToFactions([\"NiteSec\"]);\r\n if (augmentationExists(AugmentationNames.NeuralRetentionEnhancement)) {\r\n delete Augmentations[AugmentationNames.NeuralRetentionEnhancement];\r\n }\r\n AddToAugmentations(NeuralRetentionEnhancement);\r\n\r\n var DataJack = new Augmentation({\r\n name:AugmentationNames.DataJack, repCost:45e3, moneyCost:90e6,\r\n info:\"A brain implant that provides an interface for direct, wireless communication between a computer's main \" +\r\n \"memory and the mind. This implant allows the user to not only access a computer's memory, but also alter \" +\r\n \"and delete it.<br><br>\" +\r\n \"This augmentation increases the amount of money the player gains from hacking by 25%\"\r\n });\r\n DataJack.addToFactions([\"BitRunners\", \"The Black Hand\", \"NiteSec\", \"Chongqing\", \"New Tokyo\"]);\r\n if (augmentationExists(AugmentationNames.DataJack)) {\r\n delete Augmentations[AugmentationNames.DataJack];\r\n }\r\n AddToAugmentations(DataJack);\r\n\r\n var ENM = new Augmentation({\r\n name:AugmentationNames.ENM, repCost:6e3, moneyCost:50e6,\r\n info:\"A thin device embedded inside the arm containing a wireless module capable of connecting \" +\r\n \"to nearby networks. Once connected, the Netburner Module is capable of capturing and \" +\r\n \"processing all of the traffic on that network. By itself, the Embedded Netburner Module does \" +\r\n \"not do much, but a variety of very powerful upgrades can be installed that allow you to fully \" +\r\n \"control the traffic on a network.<br><br>\" +\r\n \"This augmentation increases the player's hacking skill by 8%\"\r\n });\r\n ENM.addToFactions([\"BitRunners\", \"The Black Hand\", \"NiteSec\", \"ECorp\", \"MegaCorp\",\r\n \"Fulcrum Secret Technologies\", \"NWO\", \"Blade Industries\"]);\r\n if (augmentationExists(AugmentationNames.ENM)) {\r\n delete Augmentations[AugmentationNames.ENM];\r\n }\r\n AddToAugmentations(ENM);\r\n\r\n var ENMCore = new Augmentation({\r\n name:AugmentationNames.ENMCore, repCost:100e3, moneyCost:500e6,\r\n info:\"The Core library is an implant that upgrades the firmware of the Embedded Netburner Module. \" +\r\n \"This upgrade allows the Embedded Netburner Module to generate its own data on a network.<br><br>\" +\r\n \"This augmentation:<br>\" +\r\n \"Increases the player's hacking speed by 3%<br>\" +\r\n \"Increases the amount of money the player gains from hacking by 10%<br>\" +\r\n \"Increases the player's chance of successfully performing a hack by 3%<br>\" +\r\n \"Increases the player's hacking experience gain rate by 7%<br>\" +\r\n \"Increases the player's hacking skill by 7%\",\r\n prereqs:[AugmentationNames.ENM]\r\n });\r\n ENMCore.addToFactions([\"BitRunners\", \"The Black Hand\", \"ECorp\", \"MegaCorp\",\r\n \"Fulcrum Secret Technologies\", \"NWO\", \"Blade Industries\"]);\r\n if (augmentationExists(AugmentationNames.ENMCore)) {\r\n delete Augmentations[AugmentationNames.ENMCore];\r\n }\r\n AddToAugmentations(ENMCore);\r\n\r\n var ENMCoreV2 = new Augmentation({\r\n name:AugmentationNames.ENMCoreV2, repCost:400e3, moneyCost:900e6,\r\n info:\"The Core V2 library is an implant that upgrades the firmware of the Embedded Netburner Module. \" +\r\n \"This upgraded firmware allows the Embedded Netburner Module to control the information on \" +\r\n \"a network by re-routing traffic, spoofing IP addresses, or altering the data inside network \" +\r\n \"packets.<br><br>\" +\r\n \"This augmentation: <br>\" +\r\n \"Increases the player's hacking speed by 5%<br>\" +\r\n \"Increases the amount of money the player gains from hacking by 30%<br>\" +\r\n \"Increases the player's chance of successfully performing a hack by 5%<br>\" +\r\n \"Increases the player's hacking experience gain rate by 15%<br>\" +\r\n \"Increases the player's hacking skill by 8%\",\r\n prereqs:[AugmentationNames.ENMCore]\r\n });\r\n ENMCoreV2.addToFactions([\"BitRunners\", \"ECorp\", \"MegaCorp\", \"Fulcrum Secret Technologies\", \"NWO\",\r\n \"Blade Industries\", \"OmniTek Incorporated\", \"KuaiGong International\"]);\r\n if (augmentationExists(AugmentationNames.ENMCoreV2)) {\r\n delete Augmentations[AugmentationNames.ENMCoreV2];\r\n }\r\n AddToAugmentations(ENMCoreV2);\r\n\r\n var ENMCoreV3 = new Augmentation({\r\n name:AugmentationNames.ENMCoreV3, repCost:700e3, moneyCost:1500e6,\r\n info:\"The Core V3 library is an implant that upgrades the firmware of the Embedded Netburner Module. \" +\r\n \"This upgraded firmware allows the Embedded Netburner Module to seamlessly inject code into \" +\r\n \"any device on a network.<br><br>\" +\r\n \"This augmentation:<br>\" +\r\n \"Increases the player's hacking speed by 5%<br>\" +\r\n \"Increases the amount of money the player gains from hacking by 40%<br>\" +\r\n \"Increases the player's chance of successfully performing a hack by 10%<br>\" +\r\n \"Increases the player's hacking experience gain rate by 25%<br>\" +\r\n \"Increases the player's hacking skill by 10%\",\r\n prereqs:[AugmentationNames.ENMCoreV2],\r\n });\r\n ENMCoreV3.addToFactions([\"ECorp\", \"MegaCorp\", \"Fulcrum Secret Technologies\", \"NWO\",\r\n \"Daedalus\", \"The Covenant\", \"Illuminati\"]);\r\n if (augmentationExists(AugmentationNames.ENMCoreV3)) {\r\n delete Augmentations[AugmentationNames.ENMCoreV3];\r\n }\r\n AddToAugmentations(ENMCoreV3);\r\n\r\n var ENMAnalyzeEngine = new Augmentation({\r\n name:AugmentationNames.ENMAnalyzeEngine, repCost:250e3, moneyCost:1200e6,\r\n info:\"Installs the Analyze Engine for the Embedded Netburner Module, which is a CPU cluster \" +\r\n \"that vastly outperforms the Netburner Module's native single-core processor.<br><br>\" +\r\n \"This augmentation increases the player's hacking speed by 10%.\",\r\n prereqs:[AugmentationNames.ENM],\r\n });\r\n ENMAnalyzeEngine.addToFactions([\"ECorp\", \"MegaCorp\", \"Fulcrum Secret Technologies\", \"NWO\",\r\n \"Daedalus\", \"The Covenant\", \"Illuminati\"]);\r\n if (augmentationExists(AugmentationNames.ENMAnalyzeEngine)) {\r\n delete Augmentations[AugmentationNames.ENMAnalyzeEngine];\r\n }\r\n AddToAugmentations(ENMAnalyzeEngine);\r\n\r\n var ENMDMA = new Augmentation({\r\n name:AugmentationNames.ENMDMA, repCost:400e3, moneyCost:1400e6,\r\n info:\"This implant installs a Direct Memory Access (DMA) controller into the \" +\r\n \"Embedded Netburner Module. This allows the Module to send and receive data \" +\r\n \"directly to and from the main memory of devices on a network.<br><br>\" +\r\n \"This augmentation: <br>\" +\r\n \"Increases the amount of money the player gains from hacking by 40%<br>\" +\r\n \"Increases the player's chance of successfully performing a hack by 20%\",\r\n prereqs:[AugmentationNames.ENM],\r\n });\r\n ENMDMA.addToFactions([\"ECorp\", \"MegaCorp\", \"Fulcrum Secret Technologies\", \"NWO\",\r\n \"Daedalus\", \"The Covenant\", \"Illuminati\"]);\r\n if (augmentationExists(AugmentationNames.ENMDMA)) {\r\n delete Augmentations[AugmentationNames.ENMDMA];\r\n }\r\n AddToAugmentations(ENMDMA);\r\n\r\n var Neuralstimulator = new Augmentation({\r\n name:AugmentationNames.Neuralstimulator, repCost:20e3, moneyCost:600e6,\r\n info:\"A cranial implant that intelligently stimulates certain areas of the brain \" +\r\n \"in order to improve cognitive functions<br><br>\" +\r\n \"This augmentation:<br>\" +\r\n \"Increases the player's hacking speed by 2%<br>\" +\r\n \"Increases the player's chance of successfully performing a hack by 10%<br>\" +\r\n \"Increases the player's hacking experience gain rate by 12%\"\r\n });\r\n Neuralstimulator.addToFactions([\"The Black Hand\", \"Chongqing\", \"Sector-12\", \"New Tokyo\", \"Aevum\",\r\n \"Ishima\", \"Volhaven\", \"Bachman & Associates\", \"Clarke Incorporated\",\r\n \"Four Sigma\"]);\r\n if (augmentationExists(AugmentationNames.Neuralstimulator)) {\r\n delete Augmentations[AugmentationNames.Neuralstimulator];\r\n }\r\n AddToAugmentations(Neuralstimulator);\r\n\r\n var NeuralAccelerator = new Augmentation({\r\n name:AugmentationNames.NeuralAccelerator, repCost:80e3, moneyCost:350e6,\r\n info:\"A microprocessor that accelerates the processing \" +\r\n \"speed of biological neural networks. This is a cranial implant that is embedded inside the brain. <br><br>\" +\r\n \"This augmentation: <br>\" +\r\n \"Increases the player's hacking skill by 10%<br>\" +\r\n \"Increases the player's hacking experience gain rate by 15%<br>\" +\r\n \"Increases the amount of money the player gains from hacking by 20%\"\r\n });\r\n NeuralAccelerator.addToFactions([\"BitRunners\"]);\r\n if (augmentationExists(AugmentationNames.NeuralAccelerator)) {\r\n delete Augmentations[AugmentationNames.NeuralAccelerator];\r\n }\r\n AddToAugmentations(NeuralAccelerator);\r\n\r\n var CranialSignalProcessorsG1 = new Augmentation({\r\n name:AugmentationNames.CranialSignalProcessorsG1, repCost:4e3, moneyCost:14e6,\r\n info:\"The first generation of Cranial Signal Processors. Cranial Signal Processors \" +\r\n \"are a set of specialized microprocessors that are attached to \" +\r\n \"neurons in the brain. These chips process neural signals to quickly and automatically perform specific computations \" +\r\n \"so that the brain doesn't have to. <br><br>\" +\r\n \"This augmentation: <br>\" +\r\n \"Increases the player's hacking speed by 1%<br>\" +\r\n \"Increases the player's hacking skill by 5%\"\r\n });\r\n CranialSignalProcessorsG1.addToFactions([\"CyberSec\"]);\r\n if (augmentationExists(AugmentationNames.CranialSignalProcessorsG1)) {\r\n delete Augmentations[AugmentationNames.CranialSignalProcessorsG1];\r\n }\r\n AddToAugmentations(CranialSignalProcessorsG1);\r\n\r\n var CranialSignalProcessorsG2 = new Augmentation({\r\n name:AugmentationNames.CranialSignalProcessorsG2, repCost:7500, moneyCost:25e6,\r\n info:\"The second generation of Cranial Signal Processors. Cranial Signal Processors \" +\r\n \"are a set of specialized microprocessors that are attached to \" +\r\n \"neurons in the brain. These chips process neural signals to quickly and automatically perform specific computations \" +\r\n \"so that the brain doesn't have to. <br><br>\" +\r\n \"This augmentation: <br>\" +\r\n \"Increases the player's hacking speed by 2%<br>\" +\r\n \"Increases the player's chance of successfully performing a hack by 5%<br>\" +\r\n \"Increases the player's hacking skill by 7%\"\r\n });\r\n CranialSignalProcessorsG2.addToFactions([\"NiteSec\"]);\r\n if (augmentationExists(AugmentationNames.CranialSignalProcessorsG2)) {\r\n delete Augmentations[AugmentationNames.CranialSignalProcessorsG2];\r\n }\r\n AddToAugmentations(CranialSignalProcessorsG2);\r\n\r\n var CranialSignalProcessorsG3 = new Augmentation({\r\n name:AugmentationNames.CranialSignalProcessorsG3, repCost:20e3, moneyCost:110e6,\r\n info:\"The third generation of Cranial Signal Processors. Cranial Signal Processors \" +\r\n \"are a set of specialized microprocessors that are attached to \" +\r\n \"neurons in the brain. These chips process neural signals to quickly and automatically perform specific computations \" +\r\n \"so that the brain doesn't have to. <br><br>\" +\r\n \"This augmentation:<br>\" +\r\n \"Increases the player's hacking speed by 2%<br>\" +\r\n \"Increases the amount of money the player gains from hacking by 15%<br>\" +\r\n \"Increases the player's hacking skill by 9%\"\r\n });\r\n CranialSignalProcessorsG3.addToFactions([\"NiteSec\", \"The Black Hand\"]);\r\n if (augmentationExists(AugmentationNames.CranialSignalProcessorsG3)) {\r\n delete Augmentations[AugmentationNames.CranialSignalProcessorsG3];\r\n }\r\n AddToAugmentations(CranialSignalProcessorsG3);\r\n\r\n var CranialSignalProcessorsG4 = new Augmentation({\r\n name:AugmentationNames.CranialSignalProcessorsG4, repCost:50e3, moneyCost:220e6,\r\n info:\"The fourth generation of Cranial Signal Processors. Cranial Signal Processors \" +\r\n \"are a set of specialized microprocessors that are attached to \" +\r\n \"neurons in the brain. These chips process neural signals to quickly and automatically perform specific computations \" +\r\n \"so that the brain doesn't have to. <br><br>\" +\r\n \"This augmentation: <br>\" +\r\n \"Increases the player's hacking speed by 2%<br>\" +\r\n \"Increases the amount of money the player gains from hacking by 20%<br>\" +\r\n \"Increases the amount of money the player can inject into servers using grow() by 25%\"\r\n });\r\n CranialSignalProcessorsG4.addToFactions([\"The Black Hand\"]);\r\n if (augmentationExists(AugmentationNames.CranialSignalProcessorsG4)) {\r\n delete Augmentations[AugmentationNames.CranialSignalProcessorsG4];\r\n }\r\n AddToAugmentations(CranialSignalProcessorsG4);\r\n\r\n var CranialSignalProcessorsG5 = new Augmentation({\r\n name:AugmentationNames.CranialSignalProcessorsG5, repCost:100e3, moneyCost:450e6,\r\n info:\"The fifth generation of Cranial Signal Processors. Cranial Signal Processors \" +\r\n \"are a set of specialized microprocessors that are attached to \" +\r\n \"neurons in the brain. These chips process neural signals to quickly and automatically perform specific computations \" +\r\n \"so that the brain doesn't have to. <br><br>\" +\r\n \"This augmentation:<br>\" +\r\n \"Increases the player's hacking skill by 30%<br>\" +\r\n \"Increases the amount of money the player gains from hacking by 25%<br>\" +\r\n \"Increases the amount of money the player can inject into servers using grow() by 75%\"\r\n });\r\n CranialSignalProcessorsG5.addToFactions([\"BitRunners\"]);\r\n if (augmentationExists(AugmentationNames.CranialSignalProcessorsG5)) {\r\n delete Augmentations[AugmentationNames.CranialSignalProcessorsG5];\r\n }\r\n AddToAugmentations(CranialSignalProcessorsG5);\r\n\r\n var NeuronalDensification = new Augmentation({\r\n name:AugmentationNames.NeuronalDensification, repCost:75e3, moneyCost:275e6,\r\n info:\"The brain is surgically re-engineered to have increased neuronal density \" +\r\n \"by decreasing the neuron gap junction. Then, the body is genetically modified \" +\r\n \"to enhance the production and capabilities of its neural stem cells. <br><br>\" +\r\n \"This augmentation: <br>\" +\r\n \"Increases the player's hacking skill by 15%<br>\" +\r\n \"Increases the player's hacking experience gain rate by 10%<br>\"+\r\n \"Increases the player's hacking speed by 3%\"\r\n });\r\n NeuronalDensification.addToFactions([\"Clarke Incorporated\"]);\r\n if (augmentationExists(AugmentationNames.NeuronalDensification)) {\r\n delete Augmentations[AugmentationNames.NeuronalDensification];\r\n }\r\n AddToAugmentations(NeuronalDensification);\r\n\r\n //Work Augmentations\r\n var NuoptimalInjectorImplant = new Augmentation({\r\n name:AugmentationNames.NuoptimalInjectorImplant, repCost:2e3, moneyCost:4e6,\r\n info:\"This torso implant automatically injects nootropic supplements into \" +\r\n \"the bloodstream to improve memory, increase focus, and provide other \" +\r\n \"cognitive enhancements.<br><br>\" +\r\n \"This augmentation increases the amount of reputation the player gains \" +\r\n \"when working for a company by 20%.\"\r\n });\r\n NuoptimalInjectorImplant.addToFactions([\"Tian Di Hui\", \"Volhaven\", \"New Tokyo\", \"Chongqing\", \"Ishima\",\r\n \"Clarke Incorporated\", \"Four Sigma\", \"Bachman & Associates\"]);\r\n if (augmentationExists(AugmentationNames.NuoptimalInjectorImplant)) {\r\n delete Augmentations[AugmentationNames.NuoptimalInjectorImplant];\r\n }\r\n AddToAugmentations(NuoptimalInjectorImplant);\r\n\r\n var SpeechEnhancement = new Augmentation({\r\n name:AugmentationNames.SpeechEnhancement, repCost:1e3, moneyCost:2.5e6,\r\n info:\"An advanced neural implant that improves your speaking abilities, making \" +\r\n \"you more convincing and likable in conversations and overall improving your \" +\r\n \"social interactions.<br><br>\" +\r\n \"This augmentation:<br>\" +\r\n \"Increases the player's charisma by 10%<br>\" +\r\n \"Increases the amount of reputation the player gains when working for a company by 10%\"\r\n });\r\n SpeechEnhancement.addToFactions([\"Tian Di Hui\", \"Speakers for the Dead\", \"Four Sigma\", \"KuaiGong International\",\r\n \"Clarke Incorporated\", \"Four Sigma\", \"Bachman & Associates\"]);\r\n if (augmentationExists(AugmentationNames.SpeechEnhancement)) {\r\n delete Augmentations[AugmentationNames.SpeechEnhancement];\r\n }\r\n AddToAugmentations(SpeechEnhancement);\r\n\r\n var FocusWire = new Augmentation({\r\n name:AugmentationNames.FocusWire, repCost:30e3, moneyCost:180e6,\r\n info:\"A cranial implant that stops procrastination by blocking specific neural pathways \" +\r\n \"in the brain.<br><br>\" +\r\n \"This augmentation: <br>\" +\r\n \"Increases all experience gains by 5%<br>\" +\r\n \"Increases the amount of money the player gains from working by 20%<br>\" +\r\n \"Increases the amount of reputation the player gains when working for a company by 10%\"\r\n });\r\n FocusWire.addToFactions([\"Bachman & Associates\", \"Clarke Incorporated\", \"Four Sigma\", \"KuaiGong International\"]);\r\n if (augmentationExists(AugmentationNames.FocusWire)) {\r\n delete Augmentations[AugmentationNames.FocusWire];\r\n }\r\n AddToAugmentations(FocusWire)\r\n\r\n var PCDNI = new Augmentation({\r\n name:AugmentationNames.PCDNI, repCost:150e3, moneyCost:750e6,\r\n info:\"Installs a Direct-Neural Interface jack into your arm that is compatible with most \" +\r\n \"computers. Connecting to a computer through this jack allows you to interface with \" +\r\n \"it using the brain's electrochemical signals.<br><br>\" +\r\n \"This augmentation:<br>\" +\r\n \"Increases the amount of reputation the player gains when working for a company by 30%<br>\" +\r\n \"Increases the player's hacking skill by 8%\"\r\n });\r\n PCDNI.addToFactions([\"Four Sigma\", \"OmniTek Incorporated\", \"ECorp\", \"Blade Industries\"]);\r\n if (augmentationExists(AugmentationNames.PCDNI)) {\r\n delete Augmentations[AugmentationNames.PCDNI];\r\n }\r\n AddToAugmentations(PCDNI);\r\n\r\n var PCDNIOptimizer = new Augmentation({\r\n name:AugmentationNames.PCDNIOptimizer, repCost:200e3, moneyCost:900e6,\r\n info:\"This is a submodule upgrade to the PC Direct-Neural Interface augmentation. It \" +\r\n \"improves the performance of the interface and gives the user more control options \" +\r\n \"to the connected computer.<br><br>\" +\r\n \"This augmentation:<br>\" +\r\n \"Increases the amount of reputation the player gains when working for a company by 75%<br>\" +\r\n \"Increases the player's hacking skill by 10%\",\r\n prereqs:[AugmentationNames.PCDNI],\r\n });\r\n PCDNIOptimizer.addToFactions([\"Fulcrum Secret Technologies\", \"ECorp\", \"Blade Industries\"]);\r\n if (augmentationExists(AugmentationNames.PCDNIOptimizer)) {\r\n delete Augmentations[AugmentationNames.PCDNIOptimizer];\r\n }\r\n AddToAugmentations(PCDNIOptimizer);\r\n\r\n var PCDNINeuralNetwork = new Augmentation({\r\n name:AugmentationNames.PCDNINeuralNetwork, repCost:600e3, moneyCost:1500e6,\r\n info:\"This is an additional installation that upgrades the functionality of the \" +\r\n \"PC Direct-Neural Interface augmentation. When connected to a computer, \" +\r\n \"The NeuroNet Injector upgrade allows the user to use his/her own brain's \" +\r\n \"processing power to aid the computer in computational tasks.<br><br>\" +\r\n \"This augmentation:<br>\" +\r\n \"Increases the amount of reputation the player gains when working for a company by 100%<br>\" +\r\n \"Increases the player's hacking skill by 10%<br>\" +\r\n \"Increases the player's hacking speed by 5%\",\r\n prereqs:[AugmentationNames.PCDNI],\r\n });\r\n PCDNINeuralNetwork.addToFactions([\"Fulcrum Secret Technologies\"]);\r\n if (augmentationExists(AugmentationNames.PCDNINeuralNetwork)) {\r\n delete Augmentations[AugmentationNames.PCDNINeuralNetwork];\r\n }\r\n AddToAugmentations(PCDNINeuralNetwork);\r\n\r\n var ADRPheromone1 = new Augmentation({\r\n name:AugmentationNames.ADRPheromone1, repCost:1500, moneyCost:3.5e6,\r\n info:\"The body is genetically re-engineered so that it produces the ADR-V1 pheromone, \" +\r\n \"an artificial pheromone discovered by scientists. The ADR-V1 pheromone, when excreted, \" +\r\n \"triggers feelings of admiration and approval in other people.<br><br>\" +\r\n \"This augmentation:<br>\" +\r\n \"Increases the amount of reputation the player gains when working for a company by 10% <br>\" +\r\n \"Increases the amount of reputation the player gains for a faction by 10%\"\r\n });\r\n ADRPheromone1.addToFactions([\"Tian Di Hui\", \"The Syndicate\", \"NWO\", \"MegaCorp\", \"Four Sigma\"]);\r\n if (augmentationExists(AugmentationNames.ADRPheromone1)) {\r\n delete Augmentations[AugmentationNames.ADRPheromone1];\r\n }\r\n AddToAugmentations(ADRPheromone1);\r\n\r\n var ADRPheromone2 = new Augmentation({\r\n name:AugmentationNames.ADRPheromone2, repCost:25e3, moneyCost:110e6,\r\n info:\"The body is genetically re-engineered so that it produces the ADR-V2 pheromone, \" +\r\n \"which is similar to but more potent than ADR-V1. This pheromone, when excreted, \" +\r\n \"triggers feelings of admiration, approval, and respect in others.<br><br>\" +\r\n \"This augmentation:<br>\" +\r\n \"Increases the amount of reputation the player gains for a faction and company by 20%.\"\r\n });\r\n ADRPheromone2.addToFactions([\"Silhouette\", \"Four Sigma\", \"Bachman & Associates\", \"Clarke Incorporated\"]);\r\n if (augmentationExists(AugmentationNames.ADRPheromone2)) {\r\n delete Augmentations[AugmentationNames.ADRPheromone2];\r\n }\r\n AddToAugmentations(ADRPheromone2);\r\n\r\n //HacknetNode Augmentations\r\n var HacknetNodeCPUUpload = new Augmentation({\r\n name:AugmentationNames.HacknetNodeCPUUpload, repCost:1500, moneyCost:2.2e6,\r\n info:\"Uploads the architecture and design details of a Hacknet Node's CPU into \" +\r\n \"the brain. This allows the user to engineer custom hardware and software \" +\r\n \"for the Hacknet Node that provides better performance.<br><br>\" +\r\n \"This augmentation:<br>\" +\r\n \"Increases the amount of money produced by Hacknet Nodes by 15%<br>\" +\r\n \"Decreases the cost of purchasing a Hacknet Node by 15%\"\r\n });\r\n HacknetNodeCPUUpload.addToFactions([\"Netburners\"]);\r\n if (augmentationExists(AugmentationNames.HacknetNodeCPUUpload)) {\r\n delete Augmentations[AugmentationNames.HacknetNodeCPUUpload];\r\n }\r\n AddToAugmentations(HacknetNodeCPUUpload);\r\n\r\n var HacknetNodeCacheUpload = new Augmentation({\r\n name:AugmentationNames.HacknetNodeCacheUpload, repCost:1e3, moneyCost:1.1e6,\r\n info:\"Uploads the architecture and design details of a Hacknet Node's main-memory cache \" +\r\n \"into the brain. This allows the user to engineer custom cache hardware for the \" +\r\n \"Hacknet Node that offers better performance.<br><br>\" +\r\n \"This augmentation:<br> \" +\r\n \"Increases the amount of money produced by Hacknet Nodes by 10%<br>\" +\r\n \"Decreases the cost of leveling up a Hacknet Node by 15%\"\r\n });\r\n HacknetNodeCacheUpload.addToFactions([\"Netburners\"]);\r\n if (augmentationExists(AugmentationNames.HacknetNodeCacheUpload)) {\r\n delete Augmentations[AugmentationNames.HacknetNodeCacheUpload];\r\n }\r\n AddToAugmentations(HacknetNodeCacheUpload);\r\n\r\n var HacknetNodeNICUpload = new Augmentation({\r\n name:AugmentationNames.HacknetNodeNICUpload, repCost:750, moneyCost:900e3,\r\n info:\"Uploads the architecture and design details of a Hacknet Node's Network Interface Card (NIC) \" +\r\n \"into the brain. This allows the user to engineer a custom NIC for the Hacknet Node that \" +\r\n \"offers better performance.<br><br>\" +\r\n \"This augmentation:<br>\" +\r\n \"Increases the amount of money produced by Hacknet Nodes by 10%<br>\" +\r\n \"Decreases the cost of purchasing a Hacknet Node by 10%\"\r\n });\r\n HacknetNodeNICUpload.addToFactions([\"Netburners\"]);\r\n if (augmentationExists(AugmentationNames.HacknetNodeNICUpload)) {\r\n delete Augmentations[AugmentationNames.HacknetNodeNICUpload];\r\n }\r\n AddToAugmentations(HacknetNodeNICUpload);\r\n\r\n var HacknetNodeKernelDNI = new Augmentation({\r\n name:AugmentationNames.HacknetNodeKernelDNI, repCost:3e3, moneyCost:8e6,\r\n info:\"Installs a Direct-Neural Interface jack into the arm that is capable of connecting to a \" +\r\n \"Hacknet Node. This lets the user access and manipulate the Node's kernel using the mind's \" +\r\n \"electrochemical signals.<br><br>\" +\r\n \"This augmentation increases the amount of money produced by Hacknet Nodes by 25%.\"\r\n });\r\n HacknetNodeKernelDNI.addToFactions([\"Netburners\"]);\r\n if (augmentationExists(AugmentationNames.HacknetNodeKernelDNI)) {\r\n delete Augmentations[AugmentationNames.HacknetNodeKernelDNI];\r\n }\r\n AddToAugmentations(HacknetNodeKernelDNI);\r\n\r\n var HacknetNodeCoreDNI = new Augmentation({\r\n name:AugmentationNames.HacknetNodeCoreDNI, repCost:5e3, moneyCost:12e6,\r\n info:\"Installs a Direct-Neural Interface jack into the arm that is capable of connecting \" +\r\n \"to a Hacknet Node. This lets the user access and manipulate the Node's processing logic using \" +\r\n \"the mind's electrochemical signals.<br><br>\" +\r\n \"This augmentation increases the amount of money produced by Hacknet Nodes by 45%.\"\r\n });\r\n HacknetNodeCoreDNI.addToFactions([\"Netburners\"]);\r\n if (augmentationExists(AugmentationNames.HacknetNodeCoreDNI)) {\r\n delete Augmentations[AugmentationNames.HacknetNodeCoreDNI];\r\n }\r\n AddToAugmentations(HacknetNodeCoreDNI);\r\n\r\n //Misc/Hybrid augmentations\r\n var NeuroFluxGovernor = new Augmentation({\r\n name:AugmentationNames.NeuroFluxGovernor, repCost:500, moneyCost: 750e3,\r\n info:\"A device that is embedded in the back of the neck. The NeuroFlux Governor \" +\r\n \"monitors and regulates nervous impulses coming to and from the spinal column, \" +\r\n \"essentially 'governing' the body. By doing so, it improves the functionality of the \" +\r\n \"body's nervous system. <br><br> \" +\r\n \"This is a special augmentation because it can be leveled up infinitely. Each level of this augmentation \" +\r\n \"increases ALL of the player's multipliers by 1%\"\r\n });\r\n var nextLevel = getNextNeurofluxLevel();\r\n NeuroFluxGovernor.level = nextLevel - 1;\r\n mult = Math.pow(CONSTANTS.NeuroFluxGovernorLevelMult, NeuroFluxGovernor.level);\r\n NeuroFluxGovernor.baseRepRequirement = 500 * mult * CONSTANTS.AugmentationRepMultiplier * BitNodeMultipliers.AugmentationRepCost;\r\n NeuroFluxGovernor.baseCost = 750e3 * mult * CONSTANTS.AugmentationCostMultiplier * BitNodeMultipliers.AugmentationMoneyCost;\r\n if (augmentationExists(AugmentationNames.NeuroFluxGovernor)) {\r\n delete Augmentations[AugmentationNames.NeuroFluxGovernor];\r\n }\r\n NeuroFluxGovernor.addToAllFactions();\r\n AddToAugmentations(NeuroFluxGovernor);\r\n\r\n var Neurotrainer1 = new Augmentation({\r\n name:AugmentationNames.Neurotrainer1, repCost:400, moneyCost:800e3,\r\n info:\"A decentralized cranial implant that improves the brain's ability to learn. It is \" +\r\n \"installed by releasing millions of nanobots into the human brain, each of which \" +\r\n \"attaches to a different neural pathway to enhance the brain's ability to retain \" +\r\n \"and retrieve information.<br><br>\" +\r\n \"This augmentation increases the player's experience gain rate for all stats by 10%\"\r\n });\r\n Neurotrainer1.addToFactions([\"CyberSec\"]);\r\n if (augmentationExists(AugmentationNames.Neurotrainer1)) {\r\n delete Augmentations[AugmentationNames.Neurotrainer1];\r\n }\r\n AddToAugmentations(Neurotrainer1);\r\n\r\n var Neurotrainer2 = new Augmentation({\r\n name:AugmentationNames.Neurotrainer2, repCost:4e3, moneyCost:9e6,\r\n info:\"A decentralized cranial implant that improves the brain's ability to learn. This \" +\r\n \"is a more powerful version of the Neurotrainer I augmentation, but it does not \" +\r\n \"require Neurotrainer I to be installed as a prerequisite.<br><br>\" +\r\n \"This augmentation increases the player's experience gain rate for all stats by 15%\"\r\n });\r\n Neurotrainer2.addToFactions([\"BitRunners\", \"NiteSec\"]);\r\n if (augmentationExists(AugmentationNames.Neurotrainer2)) {\r\n delete Augmentations[AugmentationNames.Neurotrainer2];\r\n }\r\n AddToAugmentations(Neurotrainer2);\r\n\r\n var Neurotrainer3 = new Augmentation({\r\n name:AugmentationNames.Neurotrainer3, repCost:10e3, moneyCost:26e6,\r\n info:\"A decentralized cranial implant that improves the brain's ability to learn. This \" +\r\n \"is a more powerful version of the Neurotrainer I and Neurotrainer II augmentation, \" +\r\n \"but it does not require either of them to be installed as a prerequisite.<br><br>\" +\r\n \"This augmentation increases the player's experience gain rate for all stats by 20%\"\r\n });\r\n Neurotrainer3.addToFactions([\"NWO\", \"Four Sigma\"]);\r\n if (augmentationExists(AugmentationNames.Neurotrainer3)) {\r\n delete Augmentations[AugmentationNames.Neurotrainer3];\r\n }\r\n AddToAugmentations(Neurotrainer3);\r\n\r\n var Hypersight = new Augmentation({\r\n name:AugmentationNames.Hypersight, repCost:60e3, moneyCost:550e6,\r\n info:\"A bionic eye implant that grants sight capabilities far beyond those of a natural human. \" +\r\n \"Embedded circuitry within the implant provides the ability to detect heat and movement \" +\r\n \"through solid objects such as wells, thus providing 'x-ray vision'-like capabilities.<br><br>\" +\r\n \"This augmentation: <br>\" +\r\n \"Increases the player's dexterity by 40%<br>\" +\r\n \"Increases the player's hacking speed by 3%<br>\" +\r\n \"Increases the amount of money the player gains from hacking by 10%\"\r\n });\r\n Hypersight.addToFactions([\"Blade Industries\", \"KuaiGong International\"]);\r\n if (augmentationExists(AugmentationNames.Hypersight)) {\r\n delete Augmentations[AugmentationNames.Hypersight];\r\n }\r\n AddToAugmentations(Hypersight);\r\n\r\n var LuminCloaking1 = new Augmentation({\r\n name:AugmentationNames.LuminCloaking1, repCost:600, moneyCost:1e6,\r\n info:\"A skin implant that reinforces the skin with highly-advanced synthetic cells. These \" +\r\n \"cells, when powered, have a negative refractive index. As a result, they bend light \" +\r\n \"around the skin, making the user much harder to see from the naked eye. <br><br>\" +\r\n \"This augmentation: <br>\" +\r\n \"Increases the player's agility by 5% <br>\" +\r\n \"Increases the amount of money the player gains from crimes by 10%\"\r\n });\r\n LuminCloaking1.addToFactions([\"Slum Snakes\", \"Tetrads\"]);\r\n if (augmentationExists(AugmentationNames.LuminCloaking1)) {\r\n delete Augmentations[AugmentationNames.LuminCloaking1];\r\n }\r\n AddToAugmentations(LuminCloaking1);\r\n\r\n var LuminCloaking2 = new Augmentation({\r\n name:AugmentationNames.LuminCloaking2, repCost:2e3, moneyCost:6e6,\r\n info:\"This is a more advanced version of the LuminCloaking-V2 augmentation. This skin implant \" +\r\n \"reinforces the skin with highly-advanced synthetic cells. These \" +\r\n \"cells, when powered, are capable of not only bending light but also of bending heat, \" +\r\n \"making the user more resilient as well as stealthy. <br><br>\" +\r\n \"This augmentation: <br>\" +\r\n \"Increases the player's agility by 10% <br>\" +\r\n \"Increases the player's defense by 10% <br>\" +\r\n \"Increases the amount of money the player gains from crimes by 25%\"\r\n });\r\n LuminCloaking2.addToFactions([\"Slum Snakes\", \"Tetrads\"]);\r\n if (augmentationExists(AugmentationNames.LuminCloaking2)) {\r\n delete Augmentations[AugmentationNames.LuminCloaking2];\r\n }\r\n AddToAugmentations(LuminCloaking2);\r\n\r\n var SmartSonar = new Augmentation({\r\n name:AugmentationNames.SmartSonar, repCost:9e3, moneyCost:15e6,\r\n info:\"A cochlear implant that helps the player detect and locate enemies \" +\r\n \"using sound propagation. <br><br>\" +\r\n \"This augmentation: <br>\" +\r\n \"Increases the player's dexterity by 10%<br>\" +\r\n \"Increases the player's dexterity experience gain rate by 15%<br>\" +\r\n \"Increases the amount of money the player gains from crimes by 25%\"\r\n });\r\n SmartSonar.addToFactions([\"Slum Snakes\"]);\r\n if (augmentationExists(AugmentationNames.SmartSonar)) {\r\n delete Augmentations[AugmentationNames.SmartSonar];\r\n }\r\n AddToAugmentations(SmartSonar);\r\n\r\n var PowerRecirculator = new Augmentation({\r\n name:AugmentationNames.PowerRecirculator, repCost:10e3, moneyCost:36e6,\r\n info:\"The body's nerves are attached with polypyrrole nanocircuits that \" +\r\n \"are capable of capturing wasted energy (in the form of heat) \" +\r\n \"and converting it back into usable power. <br><br>\" +\r\n \"This augmentation: <br>\" +\r\n \"Increases all of the player's stats by 5%<br>\" +\r\n \"Increases the player's experience gain rate for all stats by 10%\"\r\n });\r\n PowerRecirculator.addToFactions([\"Tetrads\", \"The Dark Army\", \"The Syndicate\", \"NWO\"]);\r\n if (augmentationExists(AugmentationNames.PowerRecirculator)) {\r\n delete Augmentations[AugmentationNames.PowerRecirculator];\r\n }\r\n AddToAugmentations(PowerRecirculator);\r\n\r\n //Unique AUGS (Each Faction gets one unique augmentation)\r\n //Factions that already have unique augs up to this point:\r\n // Slum Snakes, CyberSec, Netburners, Fulcrum Secret Technologies,\r\n // Silhouette\r\n\r\n\t//Illuminati\r\n var QLink = new Augmentation({\r\n name:AugmentationNames.QLink, repCost:750e3, moneyCost:1300e6,\r\n info:\"A brain implant that wirelessly connects you to the Illuminati's \" +\r\n \"quantum supercomputer, allowing you to access and use its incredible \" +\r\n \"computing power. <br><br>\" +\r\n \"This augmentation: <br>\" +\r\n \"Increases the player's hacking speed by 10%<br>\" +\r\n \"Increases the player's chance of successfully performing a hack by 30%<br>\" +\r\n \"Increases the amount of money the player gains from hacking by 100%\"\r\n });\r\n QLink.addToFactions([\"Illuminati\"]);\r\n if (augmentationExists(AugmentationNames.QLink)) {\r\n delete Augmentations[AugmentationNames.QLink];\r\n }\r\n AddToAugmentations(QLink);\r\n\r\n\t//Daedalus\r\n var RedPill = new Augmentation({\r\n name:AugmentationNames.TheRedPill, repCost:1e6, moneyCost:0,\r\n info:\"It's time to leave the cave\"\r\n });\r\n RedPill.addToFactions([\"Daedalus\"]);\r\n if (augmentationExists(AugmentationNames.TheRedPill)) {\r\n delete Augmentations[AugmentationNames.TheRedPill];\r\n }\r\n AddToAugmentations(RedPill);\r\n\r\n\t//Covenant\r\n var SPTN97 = new Augmentation({\r\n name:AugmentationNames.SPTN97, repCost:500e3, moneyCost:975e6,\r\n info:\"The SPTN-97 gene is injected into the genome. The SPTN-97 gene is an \" +\r\n \"artificially-synthesized gene that was developed by DARPA to create \" +\r\n \"super-soldiers through genetic modification. The gene was outlawed in \" +\r\n \"2056.<br><br>\" +\r\n \"This augmentation: <br>\" +\r\n \"Increases all of the player's combat stats by 75%<br>\" +\r\n \"Increases the player's hacking skill by 15%\"\r\n });\r\n SPTN97.addToFactions([\"The Covenant\"]);\r\n if (augmentationExists(AugmentationNames.SPTN97)) {\r\n delete Augmentations[AugmentationNames.SPTN97];\r\n }\r\n AddToAugmentations(SPTN97);\r\n\r\n\t//ECorp\r\n var HiveMind = new Augmentation({\r\n name:AugmentationNames.HiveMind, repCost:600e3, moneyCost:1100e6,\r\n info:\"A brain implant developed by ECorp. They do not reveal what \" +\r\n \"exactly the implant does, but they promise that it will greatly \" +\r\n \"enhance your abilities.\"\r\n });\r\n HiveMind.addToFactions([\"ECorp\"]);\r\n if (augmentationExists(AugmentationNames.HiveMind)) {\r\n delete Augmentations[AugmentationNames.HiveMind];\r\n }\r\n AddToAugmentations(HiveMind);\r\n\r\n\t//MegaCorp\r\n var CordiARCReactor = new Augmentation({\r\n name:AugmentationNames.CordiARCReactor, repCost:450e3, moneyCost:1000e6,\r\n info:\"The thoracic cavity is equipped with a small chamber designed \" +\r\n \"to hold and sustain hydrogen plasma. The plasma is used to generate \" +\r\n \"fusion power through nuclear fusion, providing limitless amount of clean \" +\r\n \"energy for the body. <br><br>\" +\r\n \"This augmentation:<br>\" +\r\n \"Increases all of the player's combat stats by 35%<br>\" +\r\n \"Increases all of the player's combat stat experience gain rate by 35%\"\r\n });\r\n CordiARCReactor.addToFactions([\"MegaCorp\"]);\r\n if (augmentationExists(AugmentationNames.CordiARCReactor)) {\r\n delete Augmentations[AugmentationNames.CordiARCReactor];\r\n }\r\n AddToAugmentations(CordiARCReactor);\r\n\r\n\t//BachmanAndAssociates\r\n var SmartJaw = new Augmentation({\r\n name:AugmentationNames.SmartJaw, repCost:150e3, moneyCost:550e6,\r\n info:\"A bionic jaw that contains advanced hardware and software \" +\r\n \"capable of psychoanalyzing and profiling the personality of \" +\r\n \"others using optical imaging software. <br><br>\" +\r\n \"This augmentation: <br>\" +\r\n \"Increases the player's charisma by 50%. <br>\" +\r\n \"Increases the player's charisma experience gain rate by 50%<br>\" +\r\n \"Increases the amount of reputation the player gains for a company by 25%<br>\" +\r\n \"Increases the amount of reputation the player gains for a faction by 25%\"\r\n });\r\n SmartJaw.addToFactions([\"Bachman & Associates\"]);\r\n if (augmentationExists(AugmentationNames.SmartJaw)) {\r\n delete Augmentations[AugmentationNames.SmartJaw];\r\n }\r\n AddToAugmentations(SmartJaw);\r\n\r\n\t//BladeIndustries\r\n var Neotra = new Augmentation({\r\n name:AugmentationNames.Neotra, repCost:225e3, moneyCost:575e6,\r\n info:\"A highly-advanced techno-organic drug that is injected into the skeletal \" +\r\n \"and integumentary system. The drug permanently modifies the DNA of the \" +\r\n \"body's skin and bone cells, granting them the ability to repair \" +\r\n \"and restructure themselves. <br><br>\" +\r\n \"This augmentation increases the player's strength and defense by 55%\"\r\n });\r\n Neotra.addToFactions([\"Blade Industries\"]);\r\n if (augmentationExists(AugmentationNames.Neotra)) {\r\n delete Augmentations[AugmentationNames.Neotra];\r\n }\r\n AddToAugmentations(Neotra);\r\n\r\n\t//NWO\r\n var Xanipher = new Augmentation({\r\n name:AugmentationNames.Xanipher, repCost:350e3, moneyCost:850e6,\r\n info:\"A concoction of advanced nanobots that is orally ingested into the \" +\r\n \"body. These nanobots induce physiological change and significantly \" +\r\n \"improve the body's functionining in all aspects. <br><br>\" +\r\n \"This augmentation: <br>\" +\r\n \"Increases all of the player's stats by 20%<br>\" +\r\n \"Increases the player's experience gain rate for all stats by 15%\"\r\n });\r\n Xanipher.addToFactions([\"NWO\"]);\r\n if (augmentationExists(AugmentationNames.Xanipher)) {\r\n delete Augmentations[AugmentationNames.Xanipher];\r\n }\r\n AddToAugmentations(Xanipher);\r\n\r\n //ClarkeIncorporated\r\n var nextSENS = new Augmentation({\r\n name:AugmentationNames.nextSENS, repCost:175e3, moneyCost:385e6,\r\n info:\"The body is genetically re-engineered to maintain a state \" +\r\n \"of negligible senescence, preventing the body from \" +\r\n \"deteriorating with age. <br><br>\" +\r\n \"This augmentation increases all of the player's stats by 20%\"\r\n });\r\n nextSENS.addToFactions([\"Clarke Incorporated\"]);\r\n if (augmentationExists(AugmentationNames.nextSENS)) {\r\n delete Augmentations[AugmentationNames.nextSENS];\r\n }\r\n AddToAugmentations(nextSENS);\r\n\r\n\t//OmniTekIncorporated\r\n var OmniTekInfoLoad = new Augmentation({\r\n name:AugmentationNames.OmniTekInfoLoad, repCost:250e3, moneyCost:575e6,\r\n info:\"OmniTek's data and information repository is uploaded \" +\r\n \"into your brain, enhancing your programming and \" +\r\n \"hacking abilities. <br><br>\" +\r\n \"This augmentation:<br>\" +\r\n \"Increases the player's hacking skill by 20%<br>\" +\r\n \"Increases the player's hacking experience gain rate by 25%\"\r\n });\r\n OmniTekInfoLoad.addToFactions([\"OmniTek Incorporated\"]);\r\n if (augmentationExists(AugmentationNames.OmniTekInfoLoad)) {\r\n delete Augmentations[AugmentationNames.OmniTekInfoLoad];\r\n }\r\n AddToAugmentations(OmniTekInfoLoad);\r\n\r\n\t//FourSigma\r\n //TODO Later when Intelligence is added in . Some aug that greatly increases int\r\n\r\n\t//KuaiGongInternational\r\n var PhotosyntheticCells = new Augmentation({\r\n name:AugmentationNames.PhotosyntheticCells, repCost:225e3, moneyCost:550e6,\r\n info:\"Chloroplasts are added to epidermal stem cells and are applied \" +\r\n \"to the body using a skin graft. The result is photosynthetic \" +\r\n \"skin cells, allowing users to generate their own energy \" +\r\n \"and nutrition using solar power. <br><br>\" +\r\n \"This augmentation increases the player's strength, defense, and agility by 40%\"\r\n });\r\n PhotosyntheticCells.addToFactions([\"KuaiGong International\"]);\r\n if (augmentationExists(AugmentationNames.PhotosyntheticCells)) {\r\n delete Augmentations[AugmentationNames.PhotosyntheticCells];\r\n }\r\n AddToAugmentations(PhotosyntheticCells);\r\n\r\n\t//BitRunners\r\n var Neurolink = new Augmentation({\r\n name:AugmentationNames.Neurolink, repCost:350e3, moneyCost:875e6,\r\n info:\"A brain implant that provides a high-bandwidth, direct neural link between your \" +\r\n \"mind and BitRunners' data servers, which reportedly contain \" +\r\n \"the largest database of hacking tools and information in the world. <br><br>\" +\r\n \"This augmentation: <br>\" +\r\n \"Increases the player's hacking skill by 15%<br>\" +\r\n \"Increases the player's hacking experience gain rate by 20%<br>\" +\r\n \"Increases the player's chance of successfully performing a hack by 10%<br>\" +\r\n \"Increases the player's hacking speed by 5%<br>\" +\r\n \"Lets the player start with the FTPCrack.exe and relaySMTP.exe programs after a reset\"\r\n });\r\n Neurolink.addToFactions([\"BitRunners\"]);\r\n if (augmentationExists(AugmentationNames.Neurolink)) {\r\n delete Augmentations[AugmentationNames.Neurolink];\r\n }\r\n AddToAugmentations(Neurolink);\r\n\r\n\t//BlackHand\r\n var TheBlackHand = new Augmentation({\r\n name:AugmentationNames.TheBlackHand, repCost:40e3, moneyCost:110e6,\r\n info:\"A highly advanced bionic hand. This prosthetic not only \" +\r\n \"enhances strength and dexterity but it is also embedded \" +\r\n \"with hardware and firmware that lets the user connect to, access and hack \" +\r\n \"devices and machines just by touching them. <br><br>\" +\r\n \"This augmentation: <br>\" +\r\n \"Increases the player's strength and dexterity by 15%<br>\" +\r\n \"Increases the player's hacking skill by 10%<br>\" +\r\n \"Increases the player's hacking speed by 2%<br>\" +\r\n \"Increases the amount of money the player gains from hacking by 10%\"\r\n });\r\n TheBlackHand.addToFactions([\"The Black Hand\"]);\r\n if (augmentationExists(AugmentationNames.TheBlackHand)) {\r\n delete Augmentations[AugmentationNames.TheBlackHand];\r\n }\r\n AddToAugmentations(TheBlackHand);\r\n\r\n\t//NiteSec\r\n var CRTX42AA = new Augmentation({\r\n name:AugmentationNames.CRTX42AA, repCost:18e3, moneyCost:45e6,\r\n info:\"The CRTX42-AA gene is injected into the genome. \" +\r\n \"The CRTX42-AA is an artificially-synthesized gene that targets the visual and prefrontal \" +\r\n \"cortex and improves cognitive abilities. <br><br>\" +\r\n \"This augmentation: <br>\" +\r\n \"Improves the player's hacking skill by 8%<br>\" +\r\n \"Improves the player's hacking experience gain rate by 15%\"\r\n });\r\n CRTX42AA.addToFactions([\"NiteSec\"]);\r\n if (augmentationExists(AugmentationNames.CRTX42AA)) {\r\n delete Augmentations[AugmentationNames.CRTX42AA];\r\n }\r\n AddToAugmentations(CRTX42AA);\r\n\r\n\t//Chongqing\r\n var Neuregen = new Augmentation({\r\n name:AugmentationNames.Neuregen, repCost:15e3, moneyCost:75e6,\r\n info:\"A drug that genetically modifies the neurons in the brain. \" +\r\n \"The result is that these neurons never die and continuously \" +\r\n \"regenerate and strengthen themselves. <br><br>\" +\r\n \"This augmentation increases the player's hacking experience gain rate by 40%\"\r\n });\r\n Neuregen.addToFactions([\"Chongqing\"]);\r\n if (augmentationExists(AugmentationNames.Neuregen)) {\r\n delete Augmentations[AugmentationNames.Neuregen];\r\n }\r\n AddToAugmentations(Neuregen);\r\n\r\n\t//Sector12\r\n var CashRoot = new Augmentation({\r\n name:AugmentationNames.CashRoot, repCost:5e3, moneyCost:25e6,\r\n info:\"A collection of digital assets saved on a small chip. The chip is implanted \" +\r\n \"into your wrist. A small jack in the chip allows you to connect it to a computer \" +\r\n \"and upload the assets. <br><br>\" +\r\n \"This augmentation: <br>\" +\r\n \"Lets the player start with $1,000,000 after a reset<br>\" +\r\n \"Lets the player start with the BruteSSH.exe program after a reset\"\r\n });\r\n CashRoot.addToFactions([\"Sector-12\"]);\r\n if (augmentationExists(AugmentationNames.CashRoot)) {\r\n delete Augmentations[AugmentationNames.CashRoot];\r\n }\r\n AddToAugmentations(CashRoot);\r\n\r\n\t//NewTokyo\r\n var NutriGen = new Augmentation({\r\n name:AugmentationNames.NutriGen, repCost:2500, moneyCost:500e3,\r\n info:\"A thermo-powered artificial nutrition generator. Endogenously \" +\r\n \"synthesizes glucose, amino acids, and vitamins and redistributes them \" +\r\n \"across the body. The device is powered by the body's naturally wasted \" +\r\n \"energy in the form of heat.<br><br>\" +\r\n \"This augmentation: <br>\" +\r\n \"Increases the player's experience gain rate for all combat stats by 20%\"\r\n });\r\n NutriGen.addToFactions([\"New Tokyo\"]);\r\n if (augmentationExists(AugmentationNames.NutriGen)) {\r\n delete Augmentations[AugmentationNames.NutriGen];\r\n }\r\n AddToAugmentations(NutriGen);\r\n\r\n\t//Aevum\r\n //TODO Later Something that lets you learn advanced math...this increases int\r\n //and profits as a trader/from trading\r\n\r\n //Ishima\r\n var INFRARet = new Augmentation({\r\n name:AugmentationNames.INFRARet, repCost:3e3, moneyCost:6e6,\r\n info:\"A retina implant consisting of a tiny chip that sits behind the \" +\r\n \"retina. This implant lets people visually detect infrared radiation. <br><br>\" +\r\n \"This augmentation: <br>\" +\r\n \"Increases the player's crime success rate by 25%<br>\" +\r\n \"Increases the amount of money the player gains from crimes by 10%<br>\" +\r\n \"Increases the player's dexterity by 10%\"\r\n });\r\n INFRARet.addToFactions([\"Ishima\"]);\r\n if (augmentationExists(AugmentationNames.INFRARet)) {\r\n delete Augmentations[AugmentationNames.INFRARet];\r\n }\r\n AddToAugmentations(INFRARet);\r\n\r\n\t//Volhaven\r\n var DermaForce = new Augmentation({\r\n name:AugmentationNames.DermaForce, repCost:6e3, moneyCost:10e6,\r\n info:\"A synthetic skin is grafted onto the body. The skin consists of \" +\r\n \"millions of nanobots capable of projecting high-density muon beams, \" +\r\n \"creating an energy barrier around the user. <br><br>\" +\r\n \"This augmentation increases the player's defense by 40%\"\r\n });\r\n DermaForce.addToFactions([\"Volhaven\"]);\r\n if (augmentationExists(AugmentationNames.DermaForce)) {\r\n delete Augmentations[AugmentationNames.DermaForce];\r\n }\r\n AddToAugmentations(DermaForce);\r\n\r\n\t//SpeakersForTheDead\r\n var GrapheneBrachiBlades = new Augmentation({\r\n name:AugmentationNames.GrapheneBrachiBlades, repCost:90e3, moneyCost:500e6,\r\n info:\"An upgrade to the BrachiBlades augmentation. It infuses \" +\r\n \"the retractable blades with an advanced graphene material \" +\r\n \"to make them much stronger and lighter. <br><br>\" +\r\n \"This augmentation:<br>\" +\r\n \"Increases the player's strength and defense by 40%<br>\" +\r\n \"Increases the player's crime success rate by 10%<br>\" +\r\n \"Increases the amount of money the player gains from crimes by 30%\",\r\n prereqs:[AugmentationNames.BrachiBlades],\r\n });\r\n GrapheneBrachiBlades.addToFactions([\"Speakers for the Dead\"]);\r\n if (augmentationExists(AugmentationNames.GrapheneBrachiBlades)) {\r\n delete Augmentations[AugmentationNames.GrapheneBrachiBlades];\r\n }\r\n AddToAugmentations(GrapheneBrachiBlades);\r\n\r\n\t//DarkArmy\r\n var GrapheneBionicArms = new Augmentation({\r\n name:AugmentationNames.GrapheneBionicArms, repCost:200e3, moneyCost:750e6,\r\n info:\"An upgrade to the Bionic Arms augmentation. It infuses the \" +\r\n \"prosthetic arms with an advanced graphene material \" +\r\n \"to make them much stronger and lighter. <br><br>\" +\r\n \"This augmentation increases the player's strength and dexterity by 85%\",\r\n prereqs:[AugmentationNames.BionicArms],\r\n });\r\n GrapheneBionicArms.addToFactions([\"The Dark Army\"]);\r\n if (augmentationExists(AugmentationNames.GrapheneBionicArms)) {\r\n delete Augmentations[AugmentationNames.GrapheneBionicArms];\r\n }\r\n AddToAugmentations(GrapheneBionicArms);\r\n\r\n\t//TheSyndicate\r\n var BrachiBlades = new Augmentation({\r\n name:AugmentationNames.BrachiBlades, repCost:5e3, moneyCost:18e6,\r\n info:\"A set of retractable plasteel blades are implanted in the arm, underneath the skin. \" +\r\n \"<br><br>This augmentation: <br>\" +\r\n \"Increases the player's strength and defense by 15%<br>\" +\r\n \"Increases the player's crime success rate by 10%<br>\" +\r\n \"Increases the amount of money the player gains from crimes by 15%\"\r\n });\r\n BrachiBlades.addToFactions([\"The Syndicate\"]);\r\n if (augmentationExists(AugmentationNames.BrachiBlades)) {\r\n delete Augmentations[AugmentationNames.BrachiBlades];\r\n }\r\n AddToAugmentations(BrachiBlades);\r\n\r\n //Tetrads\r\n var BionicArms = new Augmentation({\r\n name:AugmentationNames.BionicArms, repCost:25e3, moneyCost:55e6,\r\n info:\"Cybernetic arms created from plasteel and carbon fibers that completely replace \" +\r\n \"the user's organic arms. <br><br>\" +\r\n \"This augmentation increases the user's strength and dexterity by 30%\"\r\n });\r\n BionicArms.addToFactions([\"Tetrads\"]);\r\n if (augmentationExists(AugmentationNames.BionicArms)) {\r\n delete Augmentations[AugmentationNames.BionicArms];\r\n }\r\n AddToAugmentations(BionicArms);\r\n\r\n\t//TianDiHui\r\n var SNA = new Augmentation({\r\n name:AugmentationNames.SNA, repCost:2500, moneyCost:6e6,\r\n info:\"A cranial implant that affects the user's personality, making them better \" +\r\n \"at negotiation in social situations. <br><br>\" +\r\n \"This augmentation: <br>\" +\r\n \"Increases the amount of money the player earns at a company by 10%<br>\" +\r\n \"Increases the amount of reputation the player gains when working for a \" +\r\n \"company or faction by 15%\"\r\n });\r\n SNA.addToFactions([\"Tian Di Hui\"]);\r\n if (augmentationExists(AugmentationNames.SNA)) {\r\n delete Augmentations[AugmentationNames.SNA];\r\n }\r\n AddToAugmentations(SNA);\r\n\r\n //For BitNode-2, add all Augmentations to crime/evil factions.\r\n //Do this before adding special Augmentations that become available in later BitNodes\r\n if (Player.bitNodeN === 2) {\r\n console.log(\"Adding all augmentations to crime factions for Bit node 2\");\r\n Factions[\"Slum Snakes\"].addAllAugmentations();\r\n Factions[\"Tetrads\"].addAllAugmentations();\r\n Factions[\"The Syndicate\"].addAllAugmentations();\r\n Factions[\"The Dark Army\"].addAllAugmentations();\r\n Factions[\"Speakers for the Dead\"].addAllAugmentations();\r\n Factions[\"NiteSec\"].addAllAugmentations();\r\n Factions[\"The Black Hand\"].addAllAugmentations();\r\n }\r\n\r\n //Special Bladeburner Augmentations\r\n var BladeburnersFactionName = \"Bladeburners\";\r\n if (factionExists(BladeburnersFactionName)) {\r\n var EsperEyewear = new Augmentation({\r\n name:AugmentationNames.EsperEyewear, repCost:500, moneyCost:33e6,\r\n info:\"Ballistic-grade protective and retractable eyewear that was designed specially \" +\r\n \"for Bladeburner units. This \" +\r\n \"is implanted by installing a mechanical frame in the skull's orbit. \" +\r\n \"This frame interfaces with the brain and allows the user to \" +\r\n \"automatically extrude and extract the eyewear. The eyewear protects \" +\r\n \"against debris, shrapnel, laser, flash, and gas. It is also \" +\r\n \"embedded with a data processing chip that can be programmed to display an \" +\r\n \"AR HUD and assist the user in field missions.<br><br>\" +\r\n \"This augmentation:<br>\" +\r\n \"Increases the player's success chance in Bladeburner contracts/operations by 3%<br>\" +\r\n \"Increases the player's dexterity by 3%\"\r\n });\r\n EsperEyewear.addToFactions([BladeburnersFactionName]);\r\n resetAugmentation(EsperEyewear);\r\n\r\n var EMS4Recombination = new Augmentation({\r\n name:AugmentationNames.EMS4Recombination, repCost: 1e3, moneyCost:55e6,\r\n info:\"A DNA recombination of the EMS-4 Gene. This genetic engineering \" +\r\n \"technique was originally used on Bladeburners during the Synthoid uprising \" +\r\n \"to induce wakefulness and concentration, suppress fear, reduce empathy, and \" +\r\n \"improve reflexes and memory-recall among other things.<br><br>\" +\r\n \"This augmentation:<br>\" +\r\n \"Increases the player's sucess chance in Bladeburner contracts/operations by 3%<br>\" +\r\n \"Increases the player's effectiveness in Bladeburner Field Analysis by 5%<br>\" +\r\n \"Increases the player's Bladeburner stamina gain rate by 1%\"\r\n });\r\n EMS4Recombination.addToFactions([BladeburnersFactionName]);\r\n resetAugmentation(EMS4Recombination);\r\n\r\n var OrionShoulder = new Augmentation({\r\n name:AugmentationNames.OrionShoulder, repCost:2.5e3, moneyCost:110e6,\r\n info:\"A bionic shoulder augmentation for the right shoulder. Using cybernetics, \" +\r\n \"the ORION-MKIV shoulder enhances the strength and dexterity \" +\r\n \"of the user's right arm. It also provides protection due to its \" +\r\n \"crystallized graphene plating.<br><br>\" +\r\n \"This augmentation:<br>\" +\r\n \"Increases the player's defense by 5%.<br>\" +\r\n \"Increases the player's strength and dexterity by 3%<br>\" +\r\n \"Increases the player's success chance in Bladeburner contracts/operations by 4%\"\r\n });\r\n OrionShoulder.addToFactions([BladeburnersFactionName]);\r\n resetAugmentation(OrionShoulder);\r\n\r\n var HyperionV1 = new Augmentation({\r\n name:AugmentationNames.HyperionV1, repCost: 5e3, moneyCost:550e6,\r\n info:\"A pair of mini plasma cannons embedded into the hands. The Hyperion is capable \" +\r\n \"of rapidly firing bolts of high-density plasma. The weapon is meant to \" +\r\n \"be used against augmented enemies as the ionized \" +\r\n \"nature of the plasma disrupts the electrical systems of Augmentations. However, \" +\r\n \"it can also be effective against non-augmented enemies due to its high temperature \" +\r\n \"and concussive force.<br><br>\" +\r\n \"This augmentation:<br>\" +\r\n \"Increases the player's success chance in Bladeburner contracts/operations by 5%\"\r\n });\r\n HyperionV1.addToFactions([BladeburnersFactionName]);\r\n resetAugmentation(HyperionV1);\r\n\r\n var HyperionV2 = new Augmentation({\r\n name:AugmentationNames.HyperionV2, repCost:10e3, moneyCost:1.1e9,\r\n info:\"A pair of mini plasma cannons embedded into the hands. This augmentation \" +\r\n \"is more advanced and powerful than the original V1 model. This V2 model is \" +\r\n \"more power-efficiency, more accurate, and can fire plasma bolts at a much \" +\r\n \"higher velocity than the V1 model.<br><br>\" +\r\n \"This augmentation:<br>\" +\r\n \"Increases the player's success chance in Bladeburner contracts/operations by 7%\",\r\n prereqs:[AugmentationNames.HyperionV1]\r\n });\r\n HyperionV2.addToFactions([BladeburnersFactionName]);\r\n resetAugmentation(HyperionV2);\r\n\r\n var GolemSerum = new Augmentation({\r\n name:AugmentationNames.GolemSerum, repCost:12.5e3, moneyCost:2.2e9,\r\n info:\"A serum that permanently enhances many aspects of a human's capabilities, \" +\r\n \"including strength, speed, immune system performance, and mitochondrial efficiency. The \" +\r\n \"serum was originally developed by the Chinese military in an attempt to \" +\r\n \"create super soldiers.<br><br>\" +\r\n \"This augmentation:<br>\" +\r\n \"Increases all of the player's combat stats by 5%<br>\" +\r\n \"Increases the player's Bladeburner stamina gain rate by 5%<br>\"\r\n });\r\n GolemSerum.addToFactions([BladeburnersFactionName]);\r\n resetAugmentation(GolemSerum);\r\n\r\n var VangelisVirus = new Augmentation({\r\n name:AugmentationNames.VangelisVirus, repCost:7.5e3, moneyCost:550e6,\r\n info:\"A synthetic symbiotic virus that is injected into the human brain tissue. The Vangelis virus \" +\r\n \"heightens the senses and focus of its host, and also enhances its intuition.<br><br>\" +\r\n \"This augmentation:<br>\" +\r\n \"Increases the player's effectiveness in Bladeburner Field Analysis by 10%<br>\" +\r\n \"Increases the player's success chance in Bladeburner contracts/operations by 4%<br>\" +\r\n \"Increases the player's dexterity experience gain rate by 5%\"\r\n });\r\n VangelisVirus.addToFactions([BladeburnersFactionName]);\r\n resetAugmentation(VangelisVirus);\r\n\r\n var VangelisVirus3 = new Augmentation({\r\n name:AugmentationNames.VangelisVirus3, repCost:15e3, moneyCost:2.2e9,\r\n info:\"An improved version of Vangelis, a synthetic symbiotic virus that is \" +\r\n \"injected into the human brain tissue. On top of the benefits of the original \" +\r\n \"virus, this also grants an accelerated healing factor and enhanced \" +\r\n \"agility/reflexes.<br><br>\" +\r\n \"This augmentation:<br>\" +\r\n \"Increases the player's effectiveness in Bladeburner Field Analysis by 15%<br>\" +\r\n \"Increases the player's defense and dexterity experience gain rate by 5%<br>\" +\r\n \"Increases the player's success chance in Bladeburner contracts/operations by 5%\",\r\n prereqs:[AugmentationNames.VangelisVirus]\r\n });\r\n VangelisVirus3.addToFactions([BladeburnersFactionName]);\r\n resetAugmentation(VangelisVirus3);\r\n\r\n var INTERLINKED = new Augmentation({\r\n name:AugmentationNames.INTERLINKED, repCost:10e3, moneyCost:1.1e9,\r\n info:\"The DNA is genetically modified to enhance the human's body \" +\r\n \"extracellular matrix (ECM). This improves the ECM's ability to \" +\r\n \"structurally support the body and grants heightened strength and \" +\r\n \"durability.<br><br>\" +\r\n \"This augmentation:<br>\" +\r\n \"Increases the player's experience gain rate for all combat stats by 4%<br>\" +\r\n \"Increases the player's Bladeburner max stamina by 10%\"\r\n });\r\n INTERLINKED.addToFactions([BladeburnersFactionName]);\r\n resetAugmentation(INTERLINKED);\r\n\r\n var BladeRunner = new Augmentation({\r\n name:AugmentationNames.BladeRunner, repCost:8e3, moneyCost:1.65e9,\r\n info:\"A cybernetic foot augmentation that was specially created for Bladeburners \" +\r\n \"during the Synthoid Uprising. The organic musculature of the human foot \" +\r\n \"is enhanced with flexible carbon nanotube matrices that are controlled by \" +\r\n \"intelligent servo-motors.<br><br>\" +\r\n \"This augmentation:<br>\" +\r\n \"Increases the player's agility by 5%<br>\" +\r\n \"Increases the player's Bladeburner max stamina by 5%<br>\" +\r\n \"Increases the player's Bladeburner stamina gain rate by 5%<br>\"\r\n });\r\n BladeRunner.addToFactions([BladeburnersFactionName]);\r\n resetAugmentation(BladeRunner);\r\n\r\n var BladeArmor = new Augmentation({\r\n name:AugmentationNames.BladeArmor, repCost:5e3, moneyCost:275e6,\r\n info:\"A powered exoskeleton suit (exosuit) designed as armor for Bladeburner units. This \" +\r\n \"exoskeleton is incredibly adaptable and can protect the wearer from blunt, piercing, \" +\r\n \"concussive, thermal, chemical, and electric trauma. It also enhances the user's \" +\r\n \"strength and agility.<br><br>\" +\r\n \"This augmentation:<br>\" +\r\n \"Increases all of the player's combat stats by 2%<br>\" +\r\n \"Increases the player's Bladeburner stamina gain rate by 2%<br>\" +\r\n \"Increases the player's success chance in Bladeburner contracts/operations by 3%\",\r\n });\r\n BladeArmor.addToFactions([BladeburnersFactionName]);\r\n resetAugmentation(BladeArmor);\r\n\r\n var BladeArmorPowerCells = new Augmentation({\r\n name:AugmentationNames.BladeArmorPowerCells, repCost:7.5e3, moneyCost:550e6,\r\n info:\"Upgrades the BLADE-51b Tesla Armor with Ion Power Cells, which are capable of \" +\r\n \"more efficiently storing and using power.<br><br>\" +\r\n \"This augmentation:<br>\" +\r\n \"Increases the player's success chance in Bladeburner contracts/operations by 5%\" +\r\n \"Increases the player's Bladeburner stamina gain rate by 2%<br>\" +\r\n \"Increases the player's Bladeburner max stamina by 5%<br>\",\r\n prereqs:[AugmentationNames.BladeArmor]\r\n });\r\n BladeArmorPowerCells.addToFactions([BladeburnersFactionName]);\r\n resetAugmentation(BladeArmorPowerCells);\r\n\r\n var BladeArmorEnergyShielding = new Augmentation({\r\n name:AugmentationNames.BladeArmorEnergyShielding, repCost:8.5e3, moneyCost:1.1e9,\r\n info:\"Upgrades the BLADE-51b Tesla Armor with a plasma energy propulsion system \" +\r\n \"that is capable of projecting an energy shielding force field.<br><br>\" +\r\n \"This augmentation:<br>\" +\r\n \"Increases the player's defense by 5%<br>\" +\r\n \"Increases the player's success chance in Bladeburner contracts/operations by 6%\",\r\n prereqs:[AugmentationNames.BladeArmor]\r\n });\r\n BladeArmorEnergyShielding.addToFactions([BladeburnersFactionName]);\r\n resetAugmentation(BladeArmorEnergyShielding);\r\n\r\n var BladeArmorUnibeam = new Augmentation({\r\n name:AugmentationNames.BladeArmorUnibeam, repCost:12.5e3, moneyCost:3.3e9,\r\n info:\"Upgrades the BLADE-51b Tesla Armor with a concentrated deuterium-fluoride laser \" +\r\n \"weapon. It's precision an accuracy makes it useful for quickly neutralizing \" +\r\n \"threats while keeping casualties to a minimum.<br><br>\" +\r\n \"This augmentation:<br>\" +\r\n \"Increases the player's success chance in Bladeburner contracts/operations by 8%\",\r\n prereqs:[AugmentationNames.BladeArmor]\r\n });\r\n BladeArmorUnibeam.addToFactions([BladeburnersFactionName]);\r\n resetAugmentation(BladeArmorUnibeam);\r\n\r\n var BladeArmorOmnibeam = new Augmentation({\r\n name:AugmentationNames.BladeArmorOmnibeam, repCost:25e3, moneyCost:5.5e9,\r\n info:\"Upgrades the BLADE-51b Tesla Armor Unibeam augmentation to use \" +\r\n \"multiple-fiber system. The upgraded weapon uses multiple fiber laser \" +\r\n \"modules that combine together to form a single, more powerful beam of up to \" +\r\n \"2000MW.<br><br>\" +\r\n \"This augmentation:<br>\" +\r\n \"Increases the player's success chance in Bladeburner contracts/operations by 10%\",\r\n prereqs:[AugmentationNames.BladeArmorUnibeam]\r\n });\r\n BladeArmorOmnibeam.addToFactions([BladeburnersFactionName]);\r\n resetAugmentation(BladeArmorOmnibeam);\r\n\r\n var BladeArmorIPU = new Augmentation({\r\n name:AugmentationNames.BladeArmorIPU, repCost: 6e3, moneyCost:220e6,\r\n info:\"Upgrades the BLADE-51b Tesla Armor with an AI Information Processing \" +\r\n \"Unit that was specially designed to analyze Synthoid related data and \" +\r\n \"information.<br><br>\" +\r\n \"This augmentation:<br>\" +\r\n \"Increases the player's effectiveness in Bladeburner Field Analysis by 15%<br>\" +\r\n \"Increases the player's success chance in Bladeburner contracts/operations by 2%\",\r\n prereqs:[AugmentationNames.BladeArmor]\r\n });\r\n BladeArmorIPU.addToFactions([BladeburnersFactionName]);\r\n resetAugmentation(BladeArmorIPU);\r\n }\r\n\r\n //Update costs based on how many have been purchased\r\n var mult = Math.pow(CONSTANTS.MultipleAugMultiplier, Player.queuedAugmentations.length);\r\n for (var name in Augmentations) {\r\n if (Augmentations.hasOwnProperty(name)) {\r\n Augmentations[name].baseCost *= mult;\r\n }\r\n }\r\n\r\n Player.reapplyAllAugmentations();\r\n\r\n\r\n}\r\n\r\n//Resets an Augmentation during (re-initizliation)\r\nfunction resetAugmentation(newAugObject) {\r\n if (!(newAugObject instanceof Augmentation)) {\r\n throw new Error(\"Invalid argument 'newAugObject' passed into resetAugmentation\");\r\n }\r\n var name = newAugObject.name;\r\n if (augmentationExists(name)) {\r\n delete Augmentations[name];\r\n }\r\n AddToAugmentations(newAugObject);\r\n}\r\n\r\nfunction applyAugmentation(aug, reapply=false) {\r\n Augmentations[aug.name].owned = true;\r\n switch(aug.name) {\r\n //Combat stat augmentations\r\n case AugmentationNames.Targeting1:\r\n Player.dexterity_mult *= 1.10;\r\n break;\r\n case AugmentationNames.Targeting2:\r\n Player.dexterity_mult *= 1.20;\r\n break;\r\n case AugmentationNames.Targeting3:\r\n Player.dexterity_mult *= 1.30;\r\n break;\r\n case AugmentationNames.SyntheticHeart: //High level\r\n Player.agility_mult *= 1.5;\r\n Player.strength_mult *= 1.5;\r\n break;\r\n case AugmentationNames.SynfibrilMuscle: //Medium-high level\r\n Player.strength_mult *= 1.3;\r\n Player.defense_mult *= 1.3;\r\n break;\r\n case AugmentationNames.CombatRib1:\r\n Player.strength_mult *= 1.1;\r\n Player.defense_mult *= 1.1;\r\n break;\r\n case AugmentationNames.CombatRib2:\r\n Player.strength_mult *= 1.14;\r\n Player.defense_mult *= 1.14;\r\n break;\r\n case AugmentationNames.CombatRib3:\r\n Player.strength_mult *= 1.18;\r\n Player.defense_mult *= 1.18;\r\n break;\r\n case AugmentationNames.NanofiberWeave: //Med level\r\n Player.strength_mult *= 1.2;\r\n Player.defense_mult *= 1.2;\r\n break;\r\n case AugmentationNames.SubdermalArmor: //High level\r\n Player.defense_mult *= 2.2;\r\n break;\r\n case AugmentationNames.WiredReflexes: //Low level\r\n Player.agility_mult *= 1.05;\r\n Player.dexterity_mult *= 1.05;\r\n break;\r\n case AugmentationNames.GrapheneBoneLacings: //High level\r\n Player.strength_mult *= 1.7;\r\n Player.defense_mult *= 1.7;\r\n break;\r\n case AugmentationNames.BionicSpine: //Med level\r\n Player.strength_mult *= 1.15;\r\n Player.defense_mult *= 1.15;\r\n Player.agility_mult *= 1.15;\r\n Player.dexterity_mult *= 1.15;\r\n break;\r\n case AugmentationNames.GrapheneBionicSpine: //High level\r\n Player.strength_mult *= 1.6;\r\n Player.defense_mult *= 1.6;\r\n Player.agility_mult *= 1.6;\r\n Player.dexterity_mult *= 1.6;\r\n break;\r\n case AugmentationNames.BionicLegs: //Med level\r\n Player.agility_mult *= 1.6;\r\n break;\r\n case AugmentationNames.GrapheneBionicLegs: //High level\r\n Player.agility_mult *= 2.5;\r\n break;\r\n\r\n //Labor stats augmentations\r\n case AugmentationNames.EnhancedSocialInteractionImplant: //Med-high level\r\n Player.charisma_mult *= 1.6;\r\n Player.charisma_exp_mult *= 1.6;\r\n break;\r\n case AugmentationNames.TITN41Injection:\r\n Player.charisma_mult *= 1.15;\r\n Player.charisma_exp_mult *= 1.15;\r\n break;\r\n case AugmentationNames.SpeechProcessor: //Med level\r\n Player.charisma_mult *= 1.2;\r\n break;\r\n\r\n //Hacking augmentations\r\n case AugmentationNames.BitWire:\r\n Player.hacking_mult *= 1.05;\r\n break;\r\n case AugmentationNames.ArtificialBioNeuralNetwork: //Med level\r\n Player.hacking_speed_mult *= 1.03;\r\n Player.hacking_money_mult *= 1.15;\r\n Player.hacking_mult *= 1.12;\r\n break;\r\n case AugmentationNames.ArtificialSynapticPotentiation: //Med level\r\n Player.hacking_speed_mult *= 1.02;\r\n Player.hacking_chance_mult *= 1.05;\r\n Player.hacking_exp_mult *= 1.05;\r\n break;\r\n case AugmentationNames.EnhancedMyelinSheathing: //Med level\r\n Player.hacking_speed_mult *= 1.03;\r\n Player.hacking_exp_mult *= 1.1;\r\n Player.hacking_mult *= 1.08;\r\n break;\r\n case AugmentationNames.SynapticEnhancement: //Low Level\r\n Player.hacking_speed_mult *= 1.03;\r\n break;\r\n case AugmentationNames.NeuralRetentionEnhancement: //Med level\r\n Player.hacking_exp_mult *= 1.25;\r\n break;\r\n case AugmentationNames.DataJack: //Med low level\r\n Player.hacking_money_mult *= 1.25;\r\n break;\r\n case AugmentationNames.ENM: //Medium level\r\n Player.hacking_mult *= 1.08;\r\n break;\r\n case AugmentationNames.ENMCore: //Medium level\r\n Player.hacking_speed_mult *= 1.03;\r\n Player.hacking_money_mult *= 1.1;\r\n Player.hacking_chance_mult *= 1.03;\r\n Player.hacking_exp_mult *= 1.07;\r\n Player.hacking_mult *= 1.07;\r\n break;\r\n case AugmentationNames.ENMCoreV2: //Medium high level\r\n Player.hacking_speed_mult *= 1.05;\r\n Player.hacking_money_mult *= 1.3;\r\n Player.hacking_chance_mult *= 1.05;\r\n Player.hacking_exp_mult *= 1.15;\r\n Player.hacking_mult *= 1.08;\r\n break;\r\n case AugmentationNames.ENMCoreV3: //High level\r\n Player.hacking_speed_mult *= 1.05;\r\n Player.hacking_money_mult *= 1.4;\r\n Player.hacking_chance_mult *= 1.1;\r\n Player.hacking_exp_mult *= 1.25;\r\n Player.hacking_mult *= 1.1;\r\n break;\r\n case AugmentationNames.ENMAnalyzeEngine: //High level\r\n Player.hacking_speed_mult *= 1.1;\r\n break;\r\n case AugmentationNames.ENMDMA: //High level\r\n Player.hacking_money_mult *= 1.4;\r\n Player.hacking_chance_mult *= 1.2;\r\n break;\r\n case AugmentationNames.Neuralstimulator: //Medium Level\r\n Player.hacking_speed_mult *= 1.02;\r\n Player.hacking_chance_mult *= 1.1;\r\n Player.hacking_exp_mult *= 1.12;\r\n break;\r\n case AugmentationNames.NeuralAccelerator:\r\n Player.hacking_mult *= 1.1;\r\n Player.hacking_exp_mult *= 1.15;\r\n Player.hacking_money_mult *= 1.2;\r\n break;\r\n case AugmentationNames.CranialSignalProcessorsG1:\r\n Player.hacking_speed_mult *= 1.01;\r\n Player.hacking_mult *= 1.05;\r\n break;\r\n case AugmentationNames.CranialSignalProcessorsG2:\r\n Player.hacking_speed_mult *= 1.02;\r\n Player.hacking_chance_mult *= 1.05;\r\n Player.hacking_mult *= 1.07;\r\n break;\r\n case AugmentationNames.CranialSignalProcessorsG3:\r\n Player.hacking_speed_mult *= 1.02;\r\n Player.hacking_money_mult *= 1.15;\r\n Player.hacking_mult *= 1.09;\r\n break;\r\n case AugmentationNames.CranialSignalProcessorsG4:\r\n Player.hacking_speed_mult *= 1.02;\r\n Player.hacking_money_mult *= 1.2;\r\n Player.hacking_grow_mult *= 1.25;\r\n break;\r\n case AugmentationNames.CranialSignalProcessorsG5:\r\n Player.hacking_mult *= 1.3;\r\n Player.hacking_money_mult *= 1.25;\r\n Player.hacking_grow_mult *= 1.75;\r\n break;\r\n case AugmentationNames.NeuronalDensification:\r\n Player.hacking_mult *= 1.15;\r\n Player.hacking_exp_mult *= 1.1;\r\n Player.hacking_speed_mult *= 1.03;\r\n break;\r\n\r\n //Work augmentations\r\n case AugmentationNames.NuoptimalInjectorImplant: //Low medium level\r\n Player.company_rep_mult *= 1.2;\r\n break;\r\n case AugmentationNames.SpeechEnhancement: //Low level\r\n Player.company_rep_mult *= 1.1;\r\n Player.charisma_mult *= 1.1;\r\n break;\r\n case AugmentationNames.FocusWire: //Med level\r\n Player.hacking_exp_mult *= 1.05;\r\n Player.strength_exp_mult *= 1.05;\r\n Player.defense_exp_mult *= 1.05;\r\n Player.dexterity_exp_mult *= 1.05;\r\n Player.agility_exp_mult *= 1.05;\r\n Player.charisma_exp_mult *= 1.05;\r\n Player.company_rep_mult *= 1.1;\r\n Player.work_money_mult *= 1.2;\r\n break;\r\n case AugmentationNames.PCDNI: //Med level\r\n Player.company_rep_mult *= 1.3;\r\n Player.hacking_mult *= 1.08;\r\n break;\r\n case AugmentationNames.PCDNIOptimizer: //High level\r\n Player.company_rep_mult *= 1.75;\r\n Player.hacking_mult *= 1.1;\r\n break;\r\n case AugmentationNames.PCDNINeuralNetwork: //High level\r\n Player.company_rep_mult *= 2;\r\n Player.hacking_mult *= 1.1;\r\n Player.hacking_speed_mult *= 1.05;\r\n break;\r\n case AugmentationNames.ADRPheromone1:\r\n Player.company_rep_mult *= 1.1;\r\n Player.faction_rep_mult *= 1.1;\r\n break;\r\n case AugmentationNames.ADRPheromone2:\r\n Player.company_rep_mult *= 1.2;\r\n Player.faction_rep_mult *= 1.2;\r\n break;\r\n\r\n //Hacknet Node Augmentations\r\n case AugmentationNames.HacknetNodeCPUUpload:\r\n Player.hacknet_node_money_mult *= 1.15;\r\n Player.hacknet_node_purchase_cost_mult *= 0.85;\r\n break;\r\n case AugmentationNames.HacknetNodeCacheUpload:\r\n Player.hacknet_node_money_mult *= 1.10;\r\n Player.hacknet_node_level_cost_mult *= 0.85;\r\n break;\r\n case AugmentationNames.HacknetNodeNICUpload:\r\n Player.hacknet_node_money_mult *= 1.1;\r\n Player.hacknet_node_purchase_cost_mult *= 0.9;\r\n break;\r\n case AugmentationNames.HacknetNodeKernelDNI:\r\n Player.hacknet_node_money_mult *= 1.25;\r\n break;\r\n case AugmentationNames.HacknetNodeCoreDNI:\r\n Player.hacknet_node_money_mult *= 1.45;\r\n break;\r\n\r\n //Misc augmentations\r\n case AugmentationNames.NeuroFluxGovernor:\r\n Player.hacking_chance_mult *= 1.01;\r\n Player.hacking_speed_mult *= 1.01;\r\n Player.hacking_money_mult *= 1.01;\r\n Player.hacking_grow_mult *= 1.01;\r\n Player.hacking_mult *= 1.01;\r\n\r\n Player.strength_mult *= 1.01;\r\n Player.defense_mult *= 1.01;\r\n Player.dexterity_mult *= 1.01;\r\n Player.agility_mult *= 1.01;\r\n Player.charisma_mult *= 1.01;\r\n\r\n Player.hacking_exp_mult *= 1.01;\r\n Player.strength_exp_mult *= 1.01;\r\n Player.defense_exp_mult *= 1.01;\r\n Player.dexterity_exp_mult *= 1.01;\r\n Player.agility_exp_mult *= 1.01;\r\n Player.charisma_exp_mult *= 1.01;\r\n\r\n Player.company_rep_mult *= 1.01;\r\n Player.faction_rep_mult *= 1.01;\r\n\r\n Player.crime_money_mult *= 1.01;\r\n Player.crime_success_mult *= 1.01;\r\n\r\n Player.hacknet_node_money_mult *= 1.01;\r\n Player.hacknet_node_purchase_cost_mult *= 0.99;\r\n Player.hacknet_node_ram_cost_mult *= 0.99;\r\n Player.hacknet_node_core_cost_mult *= 0.99;\r\n Player.hacknet_node_level_cost_mult *= 0.99;\r\n\r\n Player.work_money_mult *= 1.01;\r\n\r\n if (!reapply) {\r\n Augmentations[aug.name].level = aug.level;\r\n for (var i = 0; i < Player.augmentations.length; ++i) {\r\n if (Player.augmentations[i].name == AugmentationNames.NeuroFluxGovernor) {\r\n Player.augmentations[i].level = aug.level;\r\n break;\r\n }\r\n }\r\n }\r\n break;\r\n case AugmentationNames.Neurotrainer1: //Low Level\r\n Player.hacking_exp_mult *= 1.1;\r\n Player.strength_exp_mult *= 1.1;\r\n Player.defense_exp_mult *= 1.1;\r\n Player.dexterity_exp_mult *= 1.1;\r\n Player.agility_exp_mult *= 1.1;\r\n Player.charisma_exp_mult *= 1.1;\r\n break;\r\n case AugmentationNames.Neurotrainer2: //Medium level\r\n Player.hacking_exp_mult *= 1.15;\r\n Player.strength_exp_mult *= 1.15;\r\n Player.defense_exp_mult *= 1.15;\r\n Player.dexterity_exp_mult *= 1.15;\r\n Player.agility_exp_mult *= 1.15;\r\n Player.charisma_exp_mult *= 1.15;\r\n break;\r\n case AugmentationNames.Neurotrainer3: //High Level\r\n Player.hacking_exp_mult *= 1.2;\r\n Player.strength_exp_mult *= 1.2;\r\n Player.defense_exp_mult *= 1.2;\r\n Player.dexterity_exp_mult *= 1.2;\r\n Player.agility_exp_mult *= 1.2;\r\n Player.charisma_exp_mult *= 1.2;\r\n break;\r\n case AugmentationNames.Hypersight: //Medium high level\r\n Player.dexterity_mult *= 1.4;\r\n Player.hacking_speed_mult *= 1.03;\r\n Player.hacking_money_mult *= 1.1;\r\n break;\r\n case AugmentationNames.LuminCloaking1:\r\n Player.agility_mult *= 1.05;\r\n Player.crime_money_mult *= 1.1;\r\n break;\r\n case AugmentationNames.LuminCloaking2:\r\n Player.agility_mult *= 1.1;\r\n Player.defense_mult *= 1.1;\r\n Player.crime_money_mult *= 1.25;\r\n break;\r\n case AugmentationNames.HemoRecirculator:\r\n Player.strength_mult *= 1.08;\r\n Player.defense_mult *= 1.08;\r\n Player.agility_mult *= 1.08;\r\n Player.dexterity_mult *= 1.08;\r\n break;\r\n case AugmentationNames.SmartSonar:\r\n Player.dexterity_mult *= 1.1;\r\n Player.dexterity_exp_mult *= 1.15;\r\n Player.crime_money_mult *= 1.25;\r\n break;\r\n case AugmentationNames.PowerRecirculator:\r\n Player.hacking_mult *= 1.05;\r\n Player.strength_mult *= 1.05;\r\n Player.defense_mult *= 1.05;\r\n Player.dexterity_mult *= 1.05;\r\n Player.agility_mult *= 1.05;\r\n Player.charisma_mult *= 1.05;\r\n Player.hacking_exp_mult *= 1.1;\r\n Player.strength_exp_mult *= 1.1;\r\n Player.defense_exp_mult *= 1.1;\r\n Player.dexterity_exp_mult *= 1.1;\r\n Player.agility_exp_mult *= 1.1;\r\n Player.charisma_exp_mult *= 1.1;\r\n break;\r\n //Unique augmentations (for factions)\r\n case AugmentationNames.QLink:\r\n Player.hacking_speed_mult *= 1.1;\r\n Player.hacking_chance_mult *= 1.3;\r\n Player.hacking_money_mult *= 2;\r\n break;\r\n case AugmentationNames.TheRedPill:\r\n break;\r\n case AugmentationNames.SPTN97:\r\n Player.strength_mult *= 1.75;\r\n Player.defense_mult *= 1.75;\r\n Player.dexterity_mult *= 1.75;\r\n Player.agility_mult *= 1.75;\r\n Player.hacking_mult *= 1.15;\r\n break;\r\n case AugmentationNames.HiveMind:\r\n Player.hacking_grow_mult *= 3;\r\n break;\r\n case AugmentationNames.CordiARCReactor:\r\n Player.strength_mult *= 1.35;\r\n Player.defense_mult *= 1.35;\r\n Player.dexterity_mult *= 1.35;\r\n Player.agility_mult *= 1.35;\r\n Player.strength_exp_mult *= 1.35;\r\n Player.defense_exp_mult *= 1.35;\r\n Player.dexterity_exp_mult *= 1.35;\r\n Player.agility_exp_mult *= 1.35;\r\n break;\r\n case AugmentationNames.SmartJaw:\r\n Player.charisma_mult *= 1.5;\r\n Player.charisma_exp_mult *= 1.5;\r\n Player.company_rep_mult *= 1.25;\r\n Player.faction_rep_mult *= 1.25;\r\n break;\r\n case AugmentationNames.Neotra:\r\n Player.strength_mult *= 1.55;\r\n Player.defense_mult *= 1.55;\r\n break;\r\n case AugmentationNames.Xanipher:\r\n Player.hacking_mult *= 1.2;\r\n Player.strength_mult *= 1.2;\r\n Player.defense_mult *= 1.2;\r\n Player.dexterity_mult *= 1.2;\r\n Player.agility_mult *= 1.2;\r\n Player.charisma_mult *= 1.2;\r\n Player.hacking_exp_mult *= 1.15;\r\n Player.strength_exp_mult *= 1.15;\r\n Player.defense_exp_mult *= 1.15;\r\n Player.dexterity_exp_mult *= 1.15;\r\n Player.agility_exp_mult *= 1.15;\r\n Player.charisma_exp_mult *= 1.15;\r\n break;\r\n case AugmentationNames.nextSENS:\r\n Player.hacking_mult *= 1.2;\r\n Player.strength_mult *= 1.2;\r\n Player.defense_mult *= 1.2;\r\n Player.dexterity_mult *= 1.2;\r\n Player.agility_mult *= 1.2;\r\n Player.charisma_mult *= 1.2;\r\n break;\r\n case AugmentationNames.OmniTekInfoLoad:\r\n Player.hacking_mult *= 1.2;\r\n Player.hacking_exp_mult *= 1.25;\r\n break;\r\n case AugmentationNames.PhotosyntheticCells:\r\n Player.strength_mult *= 1.4;\r\n Player.defense_mult *= 1.4;\r\n Player.agility_mult *= 1.4;\r\n break;\r\n case AugmentationNames.Neurolink:\r\n Player.hacking_mult *= 1.15;\r\n Player.hacking_exp_mult *= 1.2;\r\n Player.hacking_chance_mult *= 1.1;\r\n Player.hacking_speed_mult *= 1.05;\r\n break;\r\n case AugmentationNames.TheBlackHand:\r\n Player.strength_mult *= 1.15;\r\n Player.dexterity_mult *= 1.15;\r\n Player.hacking_mult *= 1.1;\r\n Player.hacking_speed_mult *= 1.02;\r\n Player.hacking_money_mult *= 1.1;\r\n break;\r\n case AugmentationNames.CRTX42AA:\r\n Player.hacking_mult *= 1.08;\r\n Player.hacking_exp_mult *= 1.15;\r\n break;\r\n case AugmentationNames.Neuregen:\r\n Player.hacking_exp_mult *= 1.4;\r\n break;\r\n case AugmentationNames.CashRoot:\r\n break;\r\n case AugmentationNames.NutriGen:\r\n Player.strength_exp_mult *= 1.2;\r\n Player.defense_exp_mult *= 1.2;\r\n Player.dexterity_exp_mult *= 1.2;\r\n Player.agility_exp_mult *= 1.2;\r\n break;\r\n case AugmentationNames.INFRARet:\r\n Player.crime_success_mult *= 1.25;\r\n Player.crime_money_mult *= 1.1;\r\n Player.dexterity_mult *= 1.1;\r\n break;\r\n case AugmentationNames.DermaForce:\r\n Player.defense_mult *= 1.4;\r\n break;\r\n case AugmentationNames.GrapheneBrachiBlades:\r\n Player.strength_mult *= 1.4;\r\n Player.defense_mult *= 1.4;\r\n Player.crime_success_mult *= 1.1;\r\n Player.crime_money_mult *= 1.3;\r\n break;\r\n case AugmentationNames.GrapheneBionicArms:\r\n Player.strength_mult *= 1.85;\r\n Player.dexterity_mult *= 1.85;\r\n break;\r\n case AugmentationNames.BrachiBlades:\r\n Player.strength_mult *= 1.15;\r\n Player.defense_mult *= 1.15;\r\n Player.crime_success_mult *= 1.1;\r\n Player.crime_money_mult *= 1.15;\r\n break;\r\n case AugmentationNames.BionicArms:\r\n Player.strength_mult *= 1.3;\r\n Player.dexterity_mult *= 1.3;\r\n break;\r\n case AugmentationNames.SNA:\r\n Player.work_money_mult *= 1.1;\r\n Player.company_rep_mult *= 1.15;\r\n Player.faction_rep_mult *= 1.15;\r\n break;\r\n\r\n //Bladeburner augmentations\r\n case AugmentationNames.EsperEyewear:\r\n Player.bladeburner_success_chance_mult *= 1.03;\r\n Player.dexterity_mult *= 1.03;\r\n break;\r\n case AugmentationNames.EMS4Recombination:\r\n Player.bladeburner_success_chance_mult *= 1.03;\r\n Player.bladeburner_analysis_mult *= 1.05;\r\n Player.bladeburner_stamina_gain_mult *= 1.01;\r\n break;\r\n case AugmentationNames.OrionShoulder:\r\n Player.defense_mult *= 1.05;\r\n Player.strength_mult *= 1.03;\r\n Player.dexterity_mult *= 1.03;\r\n Player.bladeburner_success_chance_mult *= 1.04;\r\n break;\r\n case AugmentationNames.HyperionV1:\r\n Player.bladeburner_success_chance_mult *= 1.05;\r\n break;\r\n case AugmentationNames.HyperionV2:\r\n Player.bladeburner_success_chance_mult *= 1.07;\r\n break;\r\n case AugmentationNames.GolemSerum:\r\n Player.strength_mult *= 1.05;\r\n Player.defense_mult *= 1.05;\r\n Player.dexterity_mult *= 1.05;\r\n Player.agility_mult *= 1.05;\r\n Player.bladeburner_stamina_gain_mult *= 1.05;\r\n break;\r\n case AugmentationNames.VangelisVirus:\r\n Player.dexterity_exp_mult *= 1.05;\r\n Player.bladeburner_analysis_mult *= 1.1;\r\n Player.bladeburner_success_chance_mult *= 1.04;\r\n break;\r\n case AugmentationNames.VangelisVirus3:\r\n Player.defense_exp_mult *= 1.05;\r\n Player.dexterity_exp_mult *= 1.05;\r\n Player.bladeburner_analysis_mult *= 1.15;\r\n Player.bladeburner_success_chance_mult *= 1.05;\r\n break;\r\n case AugmentationNames.INTERLINKED:\r\n Player.strength_exp_mult *= 1.04;\r\n Player.defense_exp_mult *= 1.04;\r\n Player.dexterity_exp_mult *= 1.04;\r\n Player.agility_exp_mult *= 1.04;\r\n Player.bladeburner_max_stamina_mult *= 1.1;\r\n break;\r\n case AugmentationNames.BladeRunner:\r\n Player.agility_mult *= 1.05;\r\n Player.bladeburner_max_stamina_mult *= 1.05;\r\n Player.bladeburner_stamina_gain_mult *= 1.05;\r\n break;\r\n case AugmentationNames.BladeArmor:\r\n Player.strength_mult *= 1.02;\r\n Player.defense_mult *= 1.02;\r\n Player.dexterity_mult *= 1.02;\r\n Player.agility_mult *= 1.02;\r\n Player.bladeburner_stamina_gain_mult *= 1.02;\r\n Player.bladeburner_success_chance_mult *= 1.03;\r\n break;\r\n case AugmentationNames.BladeArmorPowerCells:\r\n Player.bladeburner_success_chance_mult *= 1.05;\r\n Player.bladeburner_stamina_gain_mult *= 1.02;\r\n Player.bladeburner_max_stamina_mult *= 1.05;\r\n break;\r\n case AugmentationNames.BladeArmorEnergyShielding:\r\n Player.defense_mult *= 1.05;\r\n Player.bladeburner_success_chance_mult *= 1.06;\r\n break;\r\n case AugmentationNames.BladeArmorUnibeam:\r\n Player.bladeburner_success_chance_mult *= 1.08;\r\n break;\r\n case AugmentationNames.BladeArmorOmnibeam:\r\n Player.bladeburner_success_chance_mult *= 1.1;\r\n break;\r\n case AugmentationNames.BladeArmorIPU:\r\n Player.bladeburner_analysis_mult *= 1.15;\r\n Player.bladeburner_success_chance_mult *= 1.02;\r\n break;\r\n default:\r\n throw new Error(\"ERROR: No such augmentation!\");\r\n return;\r\n }\r\n\r\n if (aug.name == AugmentationNames.NeuroFluxGovernor) {\r\n for (var i = 0; i < Player.augmentations.length; ++i) {\r\n if (Player.augmentations[i].name == AugmentationNames.NeuroFluxGovernor) {\r\n //Already have this aug, just upgrade the level\r\n return;\r\n }\r\n }\r\n }\r\n\r\n if (!reapply) {\r\n var ownedAug = new PlayerOwnedAugmentation(aug.name);\r\n Player.augmentations.push(ownedAug);\r\n }\r\n}\r\n\r\nfunction PlayerOwnedAugmentation(name) {\r\n this.name = name;\r\n this.level = 1;\r\n}\r\n\r\nfunction installAugmentations(cbScript=null) {\r\n if (Player.queuedAugmentations.length == 0) {\r\n dialogBoxCreate(\"You have not purchased any Augmentations to install!\");\r\n return false;\r\n }\r\n var augmentationList = \"\";\r\n for (var i = 0; i < Player.queuedAugmentations.length; ++i) {\r\n var aug = Augmentations[Player.queuedAugmentations[i].name];\r\n if (aug == null) {\r\n console.log(\"ERROR. Invalid augmentation\");\r\n continue;\r\n }\r\n applyAugmentation(Player.queuedAugmentations[i]);\r\n augmentationList += (aug.name + \"<br>\");\r\n }\r\n Player.queuedAugmentations = [];\r\n dialogBoxCreate(\"You slowly drift to sleep as scientists put you under in order \" +\r\n \"to install the following Augmentations:<br>\" + augmentationList +\r\n \"<br>You wake up in your home...you feel different...\");\r\n prestigeAugmentation();\r\n\r\n //Run a script after prestiging\r\n if (cbScript && isString(cbScript)) {\r\n var home = Player.getHomeComputer();\r\n for (var i = 0; i < home.scripts.length; ++i) {\r\n if (home.scripts[i].filename === cbScript) {\r\n var script = home.scripts[i];\r\n var ramUsage = script.ramUsage;\r\n var ramAvailable = home.maxRam - home.ramUsed;\r\n if (ramUsage > ramAvailable) {\r\n return; //Not enough RAM\r\n }\r\n var runningScriptObj = new RunningScript(script, []); //No args\r\n runningScriptObj.threads = 1; //Only 1 thread\r\n home.runningScripts.push(runningScriptObj);\r\n addWorkerScript(runningScriptObj, home);\r\n }\r\n }\r\n }\r\n}\r\n\r\nfunction augmentationExists(name) {\r\n return Augmentations.hasOwnProperty(name);\r\n}\r\n\r\n//Used for testing balance\r\nfunction giveAllAugmentations() {\r\n for (var name in Augmentations) {\r\n var aug = Augmentations[name];\r\n if (aug == null) {continue;}\r\n var ownedAug = new PlayerOwnedAugmentation(name);\r\n Player.augmentations.push(ownedAug);\r\n }\r\n Player.reapplyAllAugmentations();\r\n}\r\n\r\nfunction displayAugmentationsContent() {\r\n removeChildrenFromElement(Engine.Display.augmentationsContent);\r\n Engine.Display.augmentationsContent.appendChild(createElement(\"h1\", {\r\n innerText:\"Purchased Augmentations\",\r\n }));\r\n\r\n //Bladeburner text, once mechanic is unlocked\r\n var bladeburnerText = \"\\n\";\r\n if (Player.bitNodeN === 6 || hasBladeburnerSF) {\r\n bladeburnerText = \"Bladeburner Progress\\n\\n\";\r\n }\r\n\r\n Engine.Display.augmentationsContent.appendChild(createElement(\"pre\", {\r\n width:\"70%\", whiteSpace:\"pre-wrap\", display:\"block\",\r\n innerText:\"Below is a list of all Augmentations you have purchased but not yet installed. Click the button below to install them.\\n\" +\r\n \"WARNING: Installing your Augmentations resets most of your progress, including:\\n\\n\" +\r\n \"Stats/Skill levels and Experience\\n\" +\r\n \"Money\\n\" +\r\n \"Scripts on every computer but your home computer\\n\" +\r\n \"Purchased servers\\n\" +\r\n \"Hacknet Nodes\\n\" +\r\n \"Faction/Company reputation\\n\" +\r\n \"Stocks\\n\" +\r\n bladeburnerText +\r\n \"Installing Augmentations lets you start over with the perks and benefits granted by all \" +\r\n \"of the Augmentations you have ever installed. Also, you will keep any scripts and RAM/Core upgrades \" +\r\n \"on your home computer (but you will lose all programs besides NUKE.exe).\"\r\n }));\r\n\r\n //Install Augmentations button\r\n Engine.Display.augmentationsContent.appendChild(createElement(\"a\", {\r\n class:\"a-link-button\", innerText:\"Install Augmentations\",\r\n tooltip:\"'I never asked for this'\",\r\n clickListener:()=>{\r\n installAugmentations();\r\n return false;\r\n }\r\n }));\r\n\r\n //Backup button\r\n Engine.Display.augmentationsContent.appendChild(createElement(\"a\", {\r\n class:\"a-link-button flashing-button\", innerText:\"Backup Save (Export)\",\r\n tooltip:\"It's always a good idea to backup/export your save!\",\r\n clickListener:()=>{\r\n saveObject.exportGame();\r\n return false;\r\n }\r\n }));\r\n\r\n //Purchased/queued augmentations list\r\n var queuedAugmentationsList = createElement(\"ul\", {class:\"augmentations-list\"});\r\n\r\n for (var i = 0; i < Player.queuedAugmentations.length; ++i) {\r\n var augName = Player.queuedAugmentations[i].name;\r\n var aug = Augmentations[augName];\r\n\r\n var displayName = augName;\r\n if (augName === AugmentationNames.NeuroFluxGovernor) {\r\n displayName += \" - Level \" + (Player.queuedAugmentations[i].level);\r\n }\r\n\r\n var accordion = createAccordionElement({hdrText:displayName, panelText:aug.info});\r\n queuedAugmentationsList.appendChild(accordion[0]);\r\n }\r\n Engine.Display.augmentationsContent.appendChild(queuedAugmentationsList);\r\n\r\n //Installed augmentations list\r\n Engine.Display.augmentationsContent.appendChild(createElement(\"h1\", {\r\n innerText:\"Installed Augmentations\", marginTop:\"8px\",\r\n }));\r\n Engine.Display.augmentationsContent.appendChild(createElement(\"p\", {\r\n width:\"70%\", whiteSpace:\"pre-wrap\",\r\n innerText:\"List of all Augmentations (including Source Files) that have been \" +\r\n \"installed. You have gained the effects of these Augmentations.\"\r\n }));\r\n\r\n var augmentationsList = createElement(\"ul\", {class:\"augmentations-list\"});\r\n\r\n //Expand/Collapse All buttons\r\n Engine.Display.augmentationsContent.appendChild(createElement(\"a\", {\r\n class:\"a-link-button\", fontSize:\"14px\", innerText:\"Expand All\", display:\"inline-block\",\r\n clickListener:()=>{\r\n var allHeaders = augmentationsList.getElementsByClassName(\"accordion-header\");\r\n for (var i = 0; i < allHeaders.length; ++i) {\r\n if (!allHeaders[i].classList.contains(\"active\")) {allHeaders[i].click();}\r\n }\r\n }\r\n }));\r\n Engine.Display.augmentationsContent.appendChild(createElement(\"a\", {\r\n class:\"a-link-button\", fontSize:\"14px\", innerText:\"Collapse All\", display:\"inline-block\",\r\n clickListener:()=>{\r\n var allHeaders = augmentationsList.getElementsByClassName(\"accordion-header\");\r\n for (var i = 0; i < allHeaders.length; ++i) {\r\n if (allHeaders[i].classList.contains(\"active\")) {allHeaders[i].click();}\r\n }\r\n }\r\n }));\r\n\r\n //Sort Buttons\r\n Engine.Display.augmentationsContent.appendChild(createElement(\"a\", {\r\n class:\"a-link-button\", fontSize:\"14px\", innerText:\"Sort in Order\",\r\n tooltip:\"Sorts the Augmentations alphabetically and Source Files in numerical order (1, 2, 3,...)\",\r\n clickListener:()=>{\r\n removeChildrenFromElement(augmentationsList);\r\n\r\n //Create a copy of Player's Source Files and augs array and sort them\r\n var sourceFiles = Player.sourceFiles.slice();\r\n var augs = Player.augmentations.slice();\r\n sourceFiles.sort((sf1, sf2)=>{\r\n return sf1.n - sf2.n;\r\n });\r\n augs.sort((aug1, aug2)=>{\r\n return aug1.name <= aug2.name ? -1 : 1;\r\n });\r\n displaySourceFiles(augmentationsList, sourceFiles);\r\n displayAugmentations(augmentationsList, augs);\r\n }\r\n }));\r\n\r\n Engine.Display.augmentationsContent.appendChild(createElement(\"a\", {\r\n class:\"a-link-button\", fontSize:\"14px\", innerText:\"Sort by Acquirement Time\",\r\n tooltip:\"Sorts the Augmentations and Source Files based on when you acquired them (same as default)\",\r\n clickListener:()=>{\r\n removeChildrenFromElement(augmentationsList);\r\n displaySourceFiles(augmentationsList, Player.sourceFiles);\r\n displayAugmentations(augmentationsList, Player.augmentations);\r\n }\r\n }));\r\n\r\n //Source Files - Temporary...Will probably put in a separate pane Later\r\n displaySourceFiles(augmentationsList, Player.sourceFiles);\r\n displayAugmentations(augmentationsList, Player.augmentations);\r\n Engine.Display.augmentationsContent.appendChild(augmentationsList);\r\n}\r\n\r\n//Creates the accordion elements to display Augmentations\r\n// @listElement - List DOM element to append accordion elements to\r\n// @augs - Array of Augmentation objects\r\nfunction displayAugmentations(listElement, augs) {\r\n for (var i = 0; i < augs.length; ++i) {\r\n var augName = augs[i].name;\r\n var aug = Augmentations[augName];\r\n\r\n var displayName = augName;\r\n if (augName === AugmentationNames.NeuroFluxGovernor) {\r\n displayName += \" - Level \" + (augs[i].level);\r\n }\r\n var accordion = createAccordionElement({hdrText:displayName, panelText:aug.info});\r\n listElement.appendChild(accordion[0]);\r\n }\r\n}\r\n\r\n//Creates the accordion elements to display Source Files\r\n// @listElement - List DOM element to append accordion elements to\r\n// @sourceFiles - Array of Source File objects\r\nfunction displaySourceFiles(listElement, sourceFiles) {\r\n for (var i = 0; i < sourceFiles.length; ++i) {\r\n var srcFileKey = \"SourceFile\" + sourceFiles[i].n;\r\n var sourceFileObject = SourceFiles[srcFileKey];\r\n if (sourceFileObject == null) {\r\n console.log(\"ERROR: Invalid source file number: \" + sourceFiles[i].n);\r\n continue;\r\n }\r\n const maxLevel = sourceFiles[i].n == 12 ? \"∞\" : \"3\";\r\n var accordion = createAccordionElement({\r\n hdrText:sourceFileObject.name + \"<br>\" + \"Level \" + (sourceFiles[i].lvl) + \" / \"+maxLevel,\r\n panelText:sourceFileObject.info\r\n });\r\n\r\n listElement.appendChild(accordion[0]);\r\n }\r\n}\r\n\r\n\r\nexport {AugmentationNames, Augmentations, PlayerOwnedAugmentation, installAugmentations,\r\n initAugmentations, applyAugmentation, augmentationExists, Augmentation,\r\n displayAugmentationsContent};\r\n","import {addActiveScriptsItem,\r\n deleteActiveScriptsItem,\r\n updateActiveScriptsItems} from \"./ActiveScriptsUI.js\";\r\nimport {CONSTANTS} from \"./Constants.js\";\r\nimport {Engine} from \"./engine.js\";\r\nimport {Environment} from \"./NetscriptEnvironment.js\";\r\nimport {evaluate, isScriptErrorMessage,\r\n makeRuntimeRejectMsg,\r\n killNetscriptDelay} from \"./NetscriptEvaluator.js\";\r\nimport {executeJSScript} from \"./NetscriptJSEvaluator.js\";\r\nimport {NetscriptPort} from \"./NetscriptPort.js\";\r\nimport {AllServers} from \"./Server.js\";\r\nimport {Settings} from \"./Settings.js\";\r\n\r\nimport {parse} from \"../utils/acorn.js\";\r\nimport {dialogBoxCreate} from \"../utils/DialogBox.js\";\r\nimport {compareArrays, printArray} from \"../utils/HelperFunctions.js\";\r\n\r\nfunction WorkerScript(runningScriptObj) {\r\n\tthis.name \t\t\t= runningScriptObj.filename;\r\n\tthis.running \t\t= false;\r\n\tthis.serverIp \t\t= null;\r\n\tthis.code \t\t\t= runningScriptObj.scriptRef.code;\r\n\tthis.env \t\t\t= new Environment(this);\r\n this.env.set(\"args\", runningScriptObj.args.slice());\r\n\tthis.output\t\t\t= \"\";\r\n\tthis.ramUsage\t\t= 0;\r\n\tthis.scriptRef\t\t= runningScriptObj;\r\n this.errorMessage = \"\";\r\n this.args = runningScriptObj.args.slice();\r\n this.delay = null;\r\n this.fnWorker = null; //Workerscript for a function call\r\n this.checkingRam = false;\r\n this.loadedFns = {}; //Stores names of fns that are \"loaded\" by this script, thus using RAM. Used for static RAM evaluation\r\n this.disableLogs = {}; //Stores names of fns that should have logs disabled\r\n\r\n //Properties used for dynamic RAM evaluation\r\n this.dynamicRamUsage = 1.4;\r\n this.dynamicLoadedFns = {};\r\n}\r\n\r\n//Returns the server on which the workerScript is running\r\nWorkerScript.prototype.getServer = function() {\r\n\treturn AllServers[this.serverIp];\r\n}\r\n\r\n//Returns the Script object for the underlying script\r\nWorkerScript.prototype.getScript = function() {\r\n let server = this.getServer();\r\n for (var i = 0; i < server.scripts.length; ++i) {\r\n if (server.scripts[i].filename === this.name) {\r\n return server.scripts[i];\r\n }\r\n }\r\n console.log(\"ERROR: Failed to find underlying Script object in WorkerScript.getScript(). This probably means somethings wrong\");\r\n return null;\r\n}\r\n\r\nWorkerScript.prototype.shouldLog = function(fn) {\r\n return (this.disableLogs.ALL == null && this.disableLogs[fn] == null);\r\n}\r\n\r\nWorkerScript.prototype.log = function(txt) {\r\n this.scriptRef.log(txt);\r\n}\r\n\r\n//Array containing all scripts that are running across all servers, to easily run them all\r\nlet workerScripts \t\t\t= [];\r\n\r\nvar NetscriptPorts = [];\r\nfor (var i = 0; i < CONSTANTS.NumNetscriptPorts; ++i) {\r\n NetscriptPorts.push(new NetscriptPort());\r\n}\r\n\r\nfunction prestigeWorkerScripts() {\r\n for (var i = 0; i < workerScripts.length; ++i) {\r\n deleteActiveScriptsItem(workerScripts[i]);\r\n workerScripts[i].env.stopFlag = true;\r\n }\r\n updateActiveScriptsItems(5000); //Force UI to update\r\n workerScripts.length = 0;\r\n}\r\n\r\n// JS script promises need a little massaging to have the same guarantees as netscript\r\n// promises. This does said massaging and kicks the script off. It returns a promise\r\n// that resolves or rejects when the corresponding worker script is done.\r\nfunction startJsScript(workerScript) {\r\n workerScript.running = true;\r\n\r\n // The name of the currently running netscript function, to prevent concurrent\r\n // calls to hack, grow, etc.\r\n let runningFn = null;\r\n\r\n // We need to go through the environment and wrap each function in such a way that it\r\n // can be called at most once at a time. This will prevent situations where multiple\r\n // hack promises are outstanding, for example.\r\n function wrap(propName, f) {\r\n // This function unfortunately cannot be an async function, because we don't\r\n // know if the original one was, and there's no way to tell.\r\n return function (...args) {\r\n // Wrap every netscript function with a check for the stop flag.\r\n // This prevents cases where we never stop because we are only calling\r\n // netscript functions that don't check this.\r\n // This is not a problem for legacy Netscript because it also checks the\r\n // stop flag in the evaluator.\r\n if (workerScript.env.stopFlag) {throw workerScript;}\r\n\r\n if (propName === \"sleep\") return f(...args); // OK for multiple simultaneous calls to sleep.\r\n\r\n const msg = \"Concurrent calls to Netscript functions not allowed! \" +\r\n \"Did you forget to await hack(), grow(), or some other \" +\r\n \"promise-returning function? (Currently running: %s tried to run: %s)\"\r\n if (runningFn) {\r\n workerScript.errorMessage = makeRuntimeRejectMsg(workerScript, sprintf(msg, runningFn, propName), null)\r\n throw workerScript;\r\n }\r\n runningFn = propName;\r\n let result = f(...args);\r\n if (result && result.finally !== undefined) {\r\n return result.finally(function () {\r\n runningFn = null;\r\n });\r\n } else {\r\n runningFn = null;\r\n return result;\r\n }\r\n }\r\n };\r\n\r\n for (let prop in workerScript.env.vars) {\r\n if (typeof workerScript.env.vars[prop] !== \"function\") continue;\r\n workerScript.env.vars[prop] = wrap(prop, workerScript.env.vars[prop]);\r\n }\r\n\r\n // Note: the environment that we pass to the JS script only needs to contain the functions visible\r\n // to that script, which env.vars does at this point.\r\n return executeJSScript(workerScript.getServer().scripts,\r\n workerScript).then(function (mainReturnValue) {\r\n if (mainReturnValue === undefined) return workerScript;\r\n return [mainReturnValue, workerScript];\r\n }).catch(e => {\r\n if (e instanceof Error) {\r\n workerScript.errorMessage = makeRuntimeRejectMsg(\r\n workerScript, e.message + (e.stack && (\"\\nstack:\\n\" + e.stack.toString()) || \"\"));\r\n throw workerScript;\r\n } else if (isScriptErrorMessage(e)) {\r\n workerScript.errorMessage = e;\r\n throw workerScript;\r\n }\r\n throw e; // Don't know what to do with it, let's rethrow.\r\n });\r\n}\r\n\r\n//Loop through workerScripts and run every script that is not currently running\r\nfunction runScriptsLoop() {\r\n var scriptDeleted = false;\r\n\r\n //Delete any scripts that finished or have been killed. Loop backwards bc removing items screws up indexing\r\n for (var i = workerScripts.length - 1; i >= 0; i--) {\r\n if (workerScripts[i].running == false && workerScripts[i].env.stopFlag == true) {\r\n scriptDeleted = true;\r\n //Delete script from the runningScripts array on its host serverIp\r\n var ip = workerScripts[i].serverIp;\r\n var name = workerScripts[i].name;\r\n\r\n //Free RAM\r\n AllServers[ip].ramUsed -= workerScripts[i].ramUsage;\r\n\r\n //Delete script from Active Scripts\r\n deleteActiveScriptsItem(workerScripts[i]);\r\n\r\n for (var j = 0; j < AllServers[ip].runningScripts.length; j++) {\r\n if (AllServers[ip].runningScripts[j].filename == name &&\r\n compareArrays(AllServers[ip].runningScripts[j].args, workerScripts[i].args)) {\r\n AllServers[ip].runningScripts.splice(j, 1);\r\n break;\r\n }\r\n }\r\n\r\n //Delete script from workerScripts\r\n workerScripts.splice(i, 1);\r\n }\r\n }\r\n if (scriptDeleted) {updateActiveScriptsItems();} //Force Update\r\n\r\n\r\n\t//Run any scripts that haven't been started\r\n\tfor (var i = 0; i < workerScripts.length; i++) {\r\n\t\t//If it isn't running, start the script\r\n\t\tif (workerScripts[i].running == false && workerScripts[i].env.stopFlag == false) {\r\n let p = null; // p is the script's result promise.\r\n if (workerScripts[i].name.endsWith(\".js\") || workerScripts[i].name.endsWith(\".ns\")) {\r\n p = startJsScript(workerScripts[i]);\r\n } else {\r\n try {\r\n var ast = parse(workerScripts[i].code, {sourceType:\"module\"});\r\n //console.log(ast);\r\n } catch (e) {\r\n console.log(\"Error parsing script: \" + workerScripts[i].name);\r\n dialogBoxCreate(\"Syntax ERROR in \" + workerScripts[i].name + \":<br>\" + e);\r\n workerScripts[i].env.stopFlag = true;\r\n continue;\r\n }\r\n workerScripts[i].running = true;\r\n p = evaluate(ast, workerScripts[i]);\r\n }\r\n\r\n\t\t\t//Once the code finishes (either resolved or rejected, doesnt matter), set its\r\n\t\t\t//running status to false\r\n\t\t\tp.then(function(w) {\r\n\t\t\t\tconsole.log(\"Stopping script \" + w.name + \" because it finished running naturally\");\r\n\t\t\t\tw.running = false;\r\n\t\t\t\tw.env.stopFlag = true;\r\n w.scriptRef.log(\"Script finished running\");\r\n\t\t\t}).catch(function(w) {\r\n\t\t\t\tif (w instanceof Error) {\r\n dialogBoxCreate(\"Script runtime unknown error. This is a bug please contact game developer\");\r\n\t\t\t\t\tconsole.log(\"ERROR: Evaluating workerscript returns an Error. THIS SHOULDN'T HAPPEN: \" + w.toString());\r\n return;\r\n } else if (w.constructor === Array && w.length === 2 && w[0] === \"RETURNSTATEMENT\") {\r\n //Script ends with a return statement\r\n console.log(\"Script returning with value: \" + w[1]);\r\n //TODO maybe do something with this in the future\r\n return;\r\n } else if (w instanceof WorkerScript) {\r\n if (isScriptErrorMessage(w.errorMessage)) {\r\n var errorTextArray = w.errorMessage.split(\"|\");\r\n if (errorTextArray.length != 4) {\r\n console.log(\"ERROR: Something wrong with Error text in evaluator...\");\r\n console.log(\"Error text: \" + errorText);\r\n return;\r\n }\r\n var serverIp = errorTextArray[1];\r\n var scriptName = errorTextArray[2];\r\n var errorMsg = errorTextArray[3];\r\n\r\n dialogBoxCreate(\"Script runtime error: <br>Server Ip: \" + serverIp +\r\n \"<br>Script name: \" + scriptName +\r\n \"<br>Args:\" + printArray(w.args) + \"<br>\" + errorMsg);\r\n w.scriptRef.log(\"Script crashed with runtime error\");\r\n } else {\r\n w.scriptRef.log(\"Script killed\");\r\n }\r\n\t\t\t\t\tw.running = false;\r\n\t\t\t\t\tw.env.stopFlag = true;\r\n\r\n\t\t\t\t} else if (isScriptErrorMessage(w)) {\r\n dialogBoxCreate(\"Script runtime unknown error. This is a bug please contact game developer\");\r\n\t\t\t\t\tconsole.log(\"ERROR: Evaluating workerscript returns only error message rather than WorkerScript object. THIS SHOULDN'T HAPPEN: \" + w.toString());\r\n return;\r\n } else {\r\n dialogBoxCreate(\"An unknown script died for an unknown reason. This is a bug please contact game dev\");\r\n console.log(w);\r\n }\r\n\t\t\t});\r\n\t\t}\r\n\t}\r\n\r\n\tsetTimeout(runScriptsLoop, 6000);\r\n}\r\n\r\n//Queues a script to be killed by settings its stop flag to true. Then, the code will reject\r\n//all of its promises recursively, and when it does so it will no longer be running.\r\n//The runScriptsLoop() will then delete the script from worker scripts\r\nfunction killWorkerScript(runningScriptObj, serverIp) {\r\n\tfor (var i = 0; i < workerScripts.length; i++) {\r\n\t\tif (workerScripts[i].name == runningScriptObj.filename && workerScripts[i].serverIp == serverIp &&\r\n compareArrays(workerScripts[i].args, runningScriptObj.args)) {\r\n\t\t\tworkerScripts[i].env.stopFlag = true;\r\n killNetscriptDelay(workerScripts[i]);\r\n //Recursively kill all functions\r\n var curr = workerScripts[i];\r\n while (curr.fnWorker) {\r\n curr.fnWorker.env.stopFlag = true;\r\n killNetscriptDelay(curr.fnWorker);\r\n curr = curr.fnWorker;\r\n }\r\n return true;\r\n\t\t}\r\n\t}\r\n return false;\r\n}\r\n\r\n//Queues a script to be run\r\nfunction addWorkerScript(runningScriptObj, server) {\r\n\tvar filename = runningScriptObj.filename;\r\n\r\n\t//Update server's ram usage\r\n var threads = 1;\r\n if (runningScriptObj.threads && !isNaN(runningScriptObj.threads)) {\r\n threads = runningScriptObj.threads;\r\n } else {\r\n runningScriptObj.threads = 1;\r\n }\r\n var ramUsage = runningScriptObj.scriptRef.ramUsage * threads\r\n * Math.pow(CONSTANTS.MultithreadingRAMCost, threads-1);\r\n var ramAvailable = server.maxRam - server.ramUsed;\r\n if (ramUsage > ramAvailable) {\r\n dialogBoxCreate(\"Not enough RAM to run script \" + runningScriptObj.filename + \" with args \" +\r\n printArray(runningScriptObj.args) + \". This likely occurred because you re-loaded \" +\r\n \"the game and the script's RAM usage increased (either because of an update to the game or \" +\r\n \"your changes to the script.)\");\r\n return;\r\n }\r\n\tserver.ramUsed += ramUsage;\r\n\r\n\t//Create the WorkerScript\r\n\tvar s = new WorkerScript(runningScriptObj);\r\n\ts.serverIp \t= server.ip;\r\n\ts.ramUsage \t= ramUsage;\r\n\r\n\t//Add the WorkerScript to the Active Scripts list\r\n\taddActiveScriptsItem(s);\r\n\r\n\t//Add the WorkerScript\r\n\tworkerScripts.push(s);\r\n\treturn;\r\n}\r\n\r\n//Updates the online running time stat of all running scripts\r\nfunction updateOnlineScriptTimes(numCycles = 1) {\r\n\tvar time = (numCycles * Engine._idleSpeed) / 1000; //seconds\r\n\tfor (var i = 0; i < workerScripts.length; ++i) {\r\n\t\tworkerScripts[i].scriptRef.onlineRunningTime += time;\r\n\t}\r\n}\r\n\r\nexport {WorkerScript, workerScripts, NetscriptPorts, runScriptsLoop,\r\n killWorkerScript, addWorkerScript, updateOnlineScriptTimes,\r\n prestigeWorkerScripts};\r\n","import {CONSTANTS} from \"./Constants.js\";\r\nimport {Engine} from \"./engine.js\";\r\nimport {Locations} from \"./Location.js\";\r\nimport {hasWallStreetSF, wallStreetSFLvl} from \"./NetscriptFunctions.js\";\r\nimport {WorkerScript} from \"./NetscriptWorker.js\";\r\nimport {Player} from \"./Player.js\";\r\n\r\nimport {dialogBoxCreate} from \"../utils/DialogBox.js\";\r\nimport {clearEventListeners, getRandomInt,\r\n removeElementById,\r\n clearEventListenersEl} from \"../utils/HelperFunctions.js\";\r\nimport {Reviver, Generic_toJSON,\r\n Generic_fromJSON} from \"../utils/JSONReviver.js\";\r\nimport numeral from \"numeral/min/numeral.min\";\r\nimport {formatNumber} from \"../utils/StringHelperFunctions.js\";\r\nimport {yesNoBoxCreate, yesNoTxtInpBoxCreate,\r\n yesNoBoxGetYesButton, yesNoBoxGetNoButton,\r\n yesNoTxtInpBoxGetYesButton, yesNoTxtInpBoxGetNoButton,\r\n yesNoTxtInpBoxGetInput, yesNoBoxClose,\r\n yesNoTxtInpBoxClose, yesNoBoxOpen} from \"../utils/YesNoBox.js\";\r\n\r\nlet StockPriceCap = 1e9; //Put a limit on how high a price can go\r\n\r\nfunction Stock(name, symbol, mv, b, otlkMag, initPrice=10000) {\r\n this.symbol = symbol;\r\n this.name = name;\r\n this.price = initPrice;\r\n\r\n this.playerShares = 0;\r\n this.playerAvgPx = 0;\r\n this.playerShortShares = 0;\r\n this.playerAvgShortPx = 0;\r\n this.mv = mv;\r\n this.b = b;\r\n this.otlkMag = otlkMag;\r\n\r\n this.posTxtEl = null;\r\n}\r\n\r\nStock.prototype.toJSON = function() {\r\n\treturn Generic_toJSON(\"Stock\", this);\r\n}\r\n\r\nStock.fromJSON = function(value) {\r\n\treturn Generic_fromJSON(Stock, value.data);\r\n}\r\n\r\nReviver.constructors.Stock = Stock;\r\n\r\nvar OrderTypes = {\r\n LimitBuy: \"Limit Buy Order\",\r\n LimitSell: \"Limit Sell Order\",\r\n StopBuy: \"Stop Buy Order\",\r\n StopSell: \"Stop Sell Order\"\r\n}\r\n\r\nvar PositionTypes = {\r\n Long: \"L\",\r\n Short: \"S\"\r\n}\r\n\r\nfunction placeOrder(stock, shares, price, type, position, workerScript=null) {\r\n var tixApi = (workerScript instanceof WorkerScript);\r\n var order = new Order(stock, shares, price, type, position);\r\n if (isNaN(shares) || isNaN(price)) {\r\n if (tixApi) {\r\n workerScript.scriptRef.log(\"ERROR: Invalid numeric value provided for either 'shares' or 'price' argument\");\r\n } else {\r\n dialogBoxCreate(\"ERROR: Invalid numeric value provided for either 'shares' or 'price' argument\");\r\n }\r\n return false;\r\n }\r\n if (StockMarket[\"Orders\"] == null) {\r\n var orders = {};\r\n for (var name in StockMarket) {\r\n if (StockMarket.hasOwnProperty(name)) {\r\n var stock = StockMarket[name];\r\n if (!(stock instanceof Stock)) {continue;}\r\n orders[stock.symbol] = [];\r\n }\r\n }\r\n StockMarket[\"Orders\"] = orders;\r\n }\r\n StockMarket[\"Orders\"][stock.symbol].push(order);\r\n //Process to see if it should be executed immediately\r\n processOrders(order.stock, order.type, order.pos);\r\n updateStockOrderList(order.stock);\r\n return true;\r\n}\r\n\r\n//Returns true if successfully cancels an order, false otherwise\r\nfunction cancelOrder(params, workerScript=null) {\r\n var tixApi = (workerScript instanceof WorkerScript);\r\n if (StockMarket[\"Orders\"] == null) {return false;}\r\n if (params.order && params.order instanceof Order) {\r\n var order = params.order;\r\n //An 'Order' object is passed in\r\n var stockOrders = StockMarket[\"Orders\"][order.stock.symbol];\r\n for (var i = 0; i < stockOrders.length; ++i) {\r\n if (order == stockOrders[i]) {\r\n stockOrders.splice(i, 1);\r\n updateStockOrderList(order.stock);\r\n return true;\r\n }\r\n }\r\n return false;\r\n } else if (params.stock && params.shares && params.price && params.type &&\r\n params.pos && params.stock instanceof Stock) {\r\n //Order properties are passed in. Need to look for the order\r\n var stockOrders = StockMarket[\"Orders\"][params.stock.symbol];\r\n var orderTxt = params.stock.symbol + \" - \" + params.shares + \" @ \" +\r\n numeral(params.price).format('$0.000a');\r\n for (var i = 0; i < stockOrders.length; ++i) {\r\n var order = stockOrders[i];\r\n if (params.shares === order.shares &&\r\n params.price === order.price &&\r\n params.type === order.type &&\r\n params.pos === order.pos) {\r\n stockOrders.splice(i, 1);\r\n updateStockOrderList(order.stock);\r\n if (tixApi) {\r\n workerScript.scriptRef.log(\"Successfully cancelled order: \" + orderTxt);\r\n }\r\n return true;\r\n }\r\n }\r\n if (tixApi) {\r\n workerScript.scriptRef.log(\"Failed to cancel order: \" + orderTxt);\r\n }\r\n return false;\r\n }\r\n return false;\r\n}\r\n\r\nfunction executeOrder(order) {\r\n var stock = order.stock;\r\n var orderBook = StockMarket[\"Orders\"];\r\n var stockOrders = orderBook[stock.symbol];\r\n var res = true;\r\n console.log(\"Executing the following order:\");\r\n console.log(order);\r\n switch (order.type) {\r\n case OrderTypes.LimitBuy:\r\n case OrderTypes.StopBuy:\r\n if (order.pos === PositionTypes.Long) {\r\n res = buyStock(order.stock, order.shares) && res;\r\n } else if (order.pos === PositionTypes.Short) {\r\n res = shortStock(order.stock, order.shares) && res;\r\n }\r\n break;\r\n case OrderTypes.LimitSell:\r\n case OrderTypes.StopSell:\r\n if (order.pos === PositionTypes.Long) {\r\n res = sellStock(order.stock, order.shares) && res;\r\n } else if (order.pos === PositionTypes.Short) {\r\n res = sellShort(order.stock, order.shares) && res;\r\n }\r\n break;\r\n }\r\n if (res) {\r\n //Remove order from order book\r\n for (var i = 0; i < stockOrders.length; ++i) {\r\n if (order == stockOrders[i]) {\r\n stockOrders.splice(i, 1);\r\n updateStockOrderList(order.stock);\r\n return;\r\n }\r\n }\r\n console.log(\"ERROR: Could not find the following Order in Order Book: \");\r\n console.log(order);\r\n } else {\r\n console.log(\"Order failed to execute\");\r\n }\r\n}\r\n\r\nfunction Order(stock, shares, price, type, position) {\r\n this.stock = stock;\r\n this.shares = shares;\r\n this.price = price;\r\n this.type = type;\r\n this.pos = position;\r\n}\r\n\r\nOrder.prototype.toJSON = function() {\r\n\treturn Generic_toJSON(\"Order\", this);\r\n}\r\n\r\nOrder.fromJSON = function(value) {\r\n\treturn Generic_fromJSON(Order, value.data);\r\n}\r\n\r\nReviver.constructors.Order = Order;\r\n\r\nlet StockMarket = {} //Full name to stock object\r\nlet StockSymbols = {} //Full name to symbol\r\nlet SymbolToStockMap = {}; //Symbol to Stock object\r\n\r\nfunction loadStockMarket(saveString) {\r\n if (saveString === \"\") {\r\n StockMarket = {};\r\n } else {\r\n StockMarket = JSON.parse(saveString, Reviver);\r\n }\r\n}\r\n\r\nfunction initStockSymbols() {\r\n //Stocks for companies at which you can work\r\n StockSymbols[Locations.AevumECorp] = \"ECP\";\r\n StockSymbols[Locations.Sector12MegaCorp] = \"MGCP\";\r\n StockSymbols[Locations.Sector12BladeIndustries] = \"BLD\";\r\n StockSymbols[Locations.AevumClarkeIncorporated] = \"CLRK\";\r\n StockSymbols[Locations.VolhavenOmniTekIncorporated] = \"OMTK\";\r\n StockSymbols[Locations.Sector12FourSigma] = \"FSIG\";\r\n StockSymbols[Locations.ChongqingKuaiGongInternational] = \"KGI\";\r\n StockSymbols[Locations.AevumFulcrumTechnologies] = \"FLCM\";\r\n StockSymbols[Locations.IshimaStormTechnologies] = \"STM\";\r\n StockSymbols[Locations.NewTokyoDefComm] = \"DCOMM\";\r\n StockSymbols[Locations.VolhavenHeliosLabs] = \"HLS\";\r\n StockSymbols[Locations.NewTokyoVitaLife] = \"VITA\";\r\n StockSymbols[Locations.Sector12IcarusMicrosystems] = \"ICRS\";\r\n StockSymbols[Locations.Sector12UniversalEnergy] = \"UNV\";\r\n StockSymbols[Locations.AevumAeroCorp] = \"AERO\";\r\n StockSymbols[Locations.VolhavenOmniaCybersystems] = \"OMN\";\r\n StockSymbols[Locations.ChongqingSolarisSpaceSystems] = \"SLRS\";\r\n StockSymbols[Locations.NewTokyoGlobalPharmaceuticals] = \"GPH\";\r\n StockSymbols[Locations.IshimaNovaMedical] = \"NVMD\";\r\n StockSymbols[Locations.AevumWatchdogSecurity] = \"WDS\";\r\n StockSymbols[Locations.VolhavenLexoCorp] = \"LXO\";\r\n StockSymbols[Locations.AevumRhoConstruction] = \"RHOC\";\r\n StockSymbols[Locations.Sector12AlphaEnterprises] = \"APHE\";\r\n StockSymbols[Locations.VolhavenSysCoreSecurities] = \"SYSC\";\r\n StockSymbols[Locations.VolhavenCompuTek] = \"CTK\";\r\n StockSymbols[Locations.AevumNetLinkTechnologies] = \"NTLK\";\r\n StockSymbols[Locations.IshimaOmegaSoftware] = \"OMGA\";\r\n StockSymbols[Locations.Sector12FoodNStuff] = \"FNS\";\r\n\r\n //Stocks for other companies\r\n StockSymbols[\"Sigma Cosmetics\"] = \"SGC\";\r\n StockSymbols[\"Joes Guns\"] = \"JGN\";\r\n StockSymbols[\"Catalyst Ventures\"] = \"CTYS\";\r\n StockSymbols[\"Microdyne Technologies\"] = \"MDYN\";\r\n StockSymbols[\"Titan Laboratories\"] = \"TITN\";\r\n}\r\n\r\nfunction initStockMarket() {\r\n for (var stk in StockMarket) {\r\n if (StockMarket.hasOwnProperty(stk)) {\r\n delete StockMarket[stk];\r\n }\r\n }\r\n\r\n var ecorp = Locations.AevumECorp;\r\n var ecorpStk = new Stock(ecorp, StockSymbols[ecorp], 0.45, true, 19, getRandomInt(20000, 25000));\r\n StockMarket[ecorp] = ecorpStk;\r\n\r\n var megacorp = Locations.Sector12MegaCorp;\r\n var megacorpStk = new Stock(megacorp, StockSymbols[megacorp], 0.45, true, 19, getRandomInt(25000, 33000));\r\n StockMarket[megacorp] = megacorpStk;\r\n\r\n var blade = Locations.Sector12BladeIndustries;\r\n var bladeStk = new Stock(blade, StockSymbols[blade], 0.75, true, 13, getRandomInt(15000, 22000));\r\n StockMarket[blade] = bladeStk;\r\n\r\n var clarke = Locations.AevumClarkeIncorporated;\r\n var clarkeStk = new Stock(clarke, StockSymbols[clarke], 0.7, true, 12, getRandomInt(15000, 20000));\r\n StockMarket[clarke] = clarkeStk;\r\n\r\n var omnitek = Locations.VolhavenOmniTekIncorporated;\r\n var omnitekStk = new Stock(omnitek, StockSymbols[omnitek], 0.65, true, 12, getRandomInt(35000, 40000));\r\n StockMarket[omnitek] = omnitekStk;\r\n\r\n var foursigma = Locations.Sector12FourSigma;\r\n var foursigmaStk = new Stock(foursigma, StockSymbols[foursigma], 1.05, true, 17, getRandomInt(60000, 70000));\r\n StockMarket[foursigma] = foursigmaStk;\r\n\r\n var kuaigong = Locations.ChongqingKuaiGongInternational;\r\n var kuaigongStk = new Stock(kuaigong, StockSymbols[kuaigong], 0.8, true, 10, getRandomInt(20000, 24000));\r\n StockMarket[kuaigong] = kuaigongStk;\r\n\r\n var fulcrum = Locations.AevumFulcrumTechnologies;\r\n var fulcrumStk = new Stock(fulcrum, StockSymbols[fulcrum], 1.25, true, 16, getRandomInt(30000, 35000));\r\n StockMarket[fulcrum] = fulcrumStk;\r\n\r\n var storm = Locations.IshimaStormTechnologies;\r\n var stormStk = new Stock(storm, StockSymbols[storm], 0.85, true, 7, getRandomInt(21000, 24000));\r\n StockMarket[storm] = stormStk;\r\n\r\n var defcomm = Locations.NewTokyoDefComm;\r\n var defcommStk = new Stock(defcomm, StockSymbols[defcomm], 0.65, true, 10, getRandomInt(10000, 15000));\r\n StockMarket[defcomm] = defcommStk;\r\n\r\n var helios = Locations.VolhavenHeliosLabs;\r\n var heliosStk = new Stock(helios, StockSymbols[helios], 0.6, true, 9, getRandomInt(12000, 16000));\r\n StockMarket[helios] = heliosStk;\r\n\r\n var vitalife = Locations.NewTokyoVitaLife;\r\n var vitalifeStk = new Stock(vitalife, StockSymbols[vitalife], 0.75, true, 7, getRandomInt(10000, 12000));\r\n StockMarket[vitalife] = vitalifeStk;\r\n\r\n var icarus = Locations.Sector12IcarusMicrosystems;\r\n var icarusStk = new Stock(icarus, StockSymbols[icarus], 0.65, true, 7.5, getRandomInt(16000, 20000));\r\n StockMarket[icarus] = icarusStk;\r\n\r\n var universalenergy = Locations.Sector12UniversalEnergy;\r\n var universalenergyStk = new Stock(universalenergy, StockSymbols[universalenergy], 0.55, true, 10, getRandomInt(20000, 25000));\r\n StockMarket[universalenergy] = universalenergyStk;\r\n\r\n var aerocorp = Locations.AevumAeroCorp;\r\n var aerocorpStk = new Stock(aerocorp, StockSymbols[aerocorp], 0.6, true, 6, getRandomInt(10000, 15000));\r\n StockMarket[aerocorp] = aerocorpStk;\r\n\r\n var omnia = Locations.VolhavenOmniaCybersystems;\r\n var omniaStk = new Stock(omnia, StockSymbols[omnia], 0.7, true, 4.5, getRandomInt(9000, 12000));\r\n StockMarket[omnia] = omniaStk;\r\n\r\n var solaris = Locations.ChongqingSolarisSpaceSystems;\r\n var solarisStk = new Stock(solaris, StockSymbols[solaris], 0.75, true, 8.5, getRandomInt(18000, 24000));\r\n StockMarket[solaris] = solarisStk;\r\n\r\n var globalpharm = Locations.NewTokyoGlobalPharmaceuticals;\r\n var globalpharmStk = new Stock(globalpharm, StockSymbols[globalpharm], 0.6, true, 10.5, getRandomInt(18000, 24000));\r\n StockMarket[globalpharm] = globalpharmStk;\r\n\r\n var nova = Locations.IshimaNovaMedical;\r\n var novaStk = new Stock(nova, StockSymbols[nova], 0.75, true, 5, getRandomInt(18000, 24000));\r\n StockMarket[nova] = novaStk;\r\n\r\n var watchdog = Locations.AevumWatchdogSecurity;\r\n var watchdogStk = new Stock(watchdog, StockSymbols[watchdog], 2.5, true, 1.5, getRandomInt(5000, 7500));\r\n StockMarket[watchdog] = watchdogStk;\r\n\r\n var lexocorp = Locations.VolhavenLexoCorp;\r\n var lexocorpStk = new Stock(lexocorp, StockSymbols[lexocorp], 1.25, true, 6, getRandomInt(5000, 7500));\r\n StockMarket[lexocorp] = lexocorpStk;\r\n\r\n var rho = Locations.AevumRhoConstruction;\r\n var rhoStk = new Stock(rho, StockSymbols[rho], 0.6, true, 1, getRandomInt(3000, 6000));\r\n StockMarket[rho] = rhoStk;\r\n\r\n var alpha = Locations.Sector12AlphaEnterprises;\r\n var alphaStk = new Stock(alpha, StockSymbols[alpha], 1.9, true, 10, getRandomInt(5000, 7500));\r\n StockMarket[alpha] = alphaStk;\r\n\r\n var syscore = Locations.VolhavenSysCoreSecurities;\r\n var syscoreStk = new Stock(syscore, StockSymbols[syscore], 1.6, true, 3, getRandomInt(4000, 7000))\r\n StockMarket[syscore] = syscoreStk;\r\n\r\n var computek = Locations.VolhavenCompuTek;\r\n var computekStk = new Stock(computek, StockSymbols[computek], 0.9, true, 4, getRandomInt(2000, 5000));\r\n StockMarket[computek] = computekStk;\r\n\r\n var netlink = Locations.AevumNetLinkTechnologies;\r\n var netlinkStk = new Stock(netlink, StockSymbols[netlink], 4.2, true, 1, getRandomInt(2000, 4000));\r\n StockMarket[netlink] = netlinkStk;\r\n\r\n var omega = Locations.IshimaOmegaSoftware;\r\n var omegaStk = new Stock(omega, StockSymbols[omega], 1, true, 0.5, getRandomInt(3000, 6000));\r\n StockMarket[omega] = omegaStk;\r\n\r\n var fns = Locations.Sector12FoodNStuff;\r\n var fnsStk = new Stock(fns, StockSymbols[fns], 0.75, false, 1, getRandomInt(1000, 4000));\r\n StockMarket[fns] = fnsStk;\r\n\r\n var sigmacosm = \"Sigma Cosmetics\";\r\n var sigmacosmStk = new Stock(sigmacosm, StockSymbols[sigmacosm], 2.8, true, 0, getRandomInt(2000, 3000));\r\n StockMarket[sigmacosm] = sigmacosmStk;\r\n\r\n var joesguns = \"Joes Guns\";\r\n var joesgunsStk = new Stock(joesguns, StockSymbols[joesguns], 3.8, true, 1, getRandomInt(500, 1000));\r\n StockMarket[joesguns] = joesgunsStk;\r\n\r\n var catalyst = \"Catalyst Ventures\";\r\n var catalystStk = new Stock(catalyst, StockSymbols[catalyst], 1.45, true, 13.5, getRandomInt(500, 1000));\r\n StockMarket[catalyst] = catalystStk;\r\n\r\n var microdyne = \"Microdyne Technologies\";\r\n var microdyneStk = new Stock(microdyne, StockSymbols[microdyne], 0.75, true, 8, getRandomInt(20000, 25000));\r\n StockMarket[microdyne] = microdyneStk;\r\n\r\n var titanlabs = \"Titan Laboratories\";\r\n var titanlabsStk = new Stock(titanlabs, StockSymbols[titanlabs], 0.6, true, 11, getRandomInt(15000, 20000));\r\n StockMarket[titanlabs] = titanlabsStk;\r\n\r\n var orders = {};\r\n for (var name in StockMarket) {\r\n if (StockMarket.hasOwnProperty(name)) {\r\n var stock = StockMarket[name];\r\n if (!(stock instanceof Stock)) {continue;}\r\n orders[stock.symbol] = [];\r\n }\r\n }\r\n StockMarket[\"Orders\"] = orders;\r\n}\r\n\r\nfunction initSymbolToStockMap() {\r\n for (var name in StockSymbols) {\r\n if (StockSymbols.hasOwnProperty(name)) {\r\n var stock = StockMarket[name];\r\n if (stock == null) {\r\n console.log(\"ERROR finding stock\");\r\n continue;\r\n }\r\n var symbol = StockSymbols[name];\r\n SymbolToStockMap[symbol] = stock;\r\n }\r\n }\r\n}\r\n\r\nfunction stockMarketCycle() {\r\n for (var name in StockMarket) {\r\n if (StockMarket.hasOwnProperty(name)) {\r\n var stock = StockMarket[name];\r\n var thresh = 0.6;\r\n if (stock.b) {thresh = 0.4;}\r\n if (Math.random() < thresh) {\r\n stock.b = !stock.b;\r\n }\r\n }\r\n }\r\n}\r\n\r\n//Returns true if successful, false otherwise\r\nfunction buyStock(stock, shares) {\r\n if (stock == null || shares < 0 || isNaN(shares)) {\r\n dialogBoxCreate(\"Failed to buy stock. This may be a bug, contact developer\");\r\n return false;\r\n }\r\n shares = Math.round(shares);\r\n if (shares == 0) {return false;}\r\n\r\n var totalPrice = stock.price * shares;\r\n if (Player.money.lt(totalPrice + CONSTANTS.StockMarketCommission)) {\r\n dialogBoxCreate(\"You do not have enough money to purchase this. You need $\" +\r\n formatNumber(totalPrice + CONSTANTS.StockMarketCommission, 2).toString() + \".\");\r\n return false;\r\n }\r\n\r\n var origTotal = stock.playerShares * stock.playerAvgPx;\r\n Player.loseMoney(totalPrice + CONSTANTS.StockMarketCommission);\r\n var newTotal = origTotal + totalPrice;\r\n stock.playerShares += shares;\r\n stock.playerAvgPx = newTotal / stock.playerShares;\r\n updateStockPlayerPosition(stock);\r\n dialogBoxCreate(\"Bought \" + formatNumber(shares, 0) + \" shares of \" + stock.symbol + \" at $\" +\r\n formatNumber(stock.price, 2) + \" per share. You also paid $\" +\r\n formatNumber(CONSTANTS.StockMarketCommission, 2) + \" in commission fees.\");\r\n return true;\r\n}\r\n\r\n//Returns true if successful and false otherwise\r\nfunction sellStock(stock, shares) {\r\n if (shares == 0) {return false;}\r\n if (stock == null || shares < 0 || isNaN(shares)) {\r\n dialogBoxCreate(\"Failed to sell stock. This may be a bug, contact developer\");\r\n return false;\r\n }\r\n shares = Math.round(shares);\r\n if (shares > stock.playerShares) {shares = stock.playerShares;}\r\n if (shares === 0) {return false;}\r\n var gains = stock.price * shares - CONSTANTS.StockMarketCommission;\r\n Player.gainMoney(gains);\r\n stock.playerShares -= shares;\r\n if (stock.playerShares == 0) {\r\n stock.playerAvgPx = 0;\r\n }\r\n updateStockPlayerPosition(stock);\r\n dialogBoxCreate(\"Sold \" + formatNumber(shares, 0) + \" shares of \" + stock.symbol + \" at $\" +\r\n formatNumber(stock.price, 2) + \" per share. After commissions, you gained \" +\r\n \"a total of $\" + formatNumber(gains, 2));\r\n return true;\r\n}\r\n\r\n//Returns true if successful and false otherwise\r\nfunction shortStock(stock, shares, workerScript=null) {\r\n var tixApi = (workerScript instanceof WorkerScript);\r\n if (stock == null || isNaN(shares) || shares < 0) {\r\n if (tixApi) {\r\n workerScript.scriptRef.log(\"ERROR: shortStock() failed because of invalid arguments.\");\r\n } else {\r\n dialogBoxCreate(\"Failed to initiate a short position in a stock. This is probably \" +\r\n \"due to an invalid quantity. Otherwise, this may be a bug, so contact developer\");\r\n }\r\n return false;\r\n }\r\n shares = Math.round(shares);\r\n if (shares === 0) {return false;}\r\n\r\n var totalPrice = stock.price * shares;\r\n if (Player.money.lt(totalPrice + CONSTANTS.StockMarketCommission)) {\r\n if (tixApi) {\r\n workerScript.scriptRef.log(\"ERROR: shortStock() failed because you do not have \" +\r\n \"money to purchase this short position. You need \" +\r\n numeral(totalPrice + CONSTANTS.StockMarketCommission).format('($0.000a)'));\r\n } else {\r\n dialogBoxCreate(\"You do not have enough money to purchase this short position. You need $\" +\r\n formatNumber(totalPrice + CONSTANTS.StockMarketCommission, 2) + \".\");\r\n }\r\n\r\n return false;\r\n }\r\n\r\n var origTotal = stock.playerShortShares * stock.playerAvgShortPx;\r\n Player.loseMoney(totalPrice + CONSTANTS.StockMarketCommission);\r\n var newTotal = origTotal + totalPrice;\r\n stock.playerShortShares += shares;\r\n stock.playerAvgShortPx = newTotal / stock.playerShortShares;\r\n updateStockPlayerPosition(stock);\r\n if (tixApi) {\r\n if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.shortStock == null) {\r\n workerScript.scriptRef.log(\"Bought a short position of \" + formatNumber(shares, 0) + \" shares of \" + stock.symbol + \" at \" +\r\n numeral(stock.price).format('($0.000a)') + \" per share. Paid \" +\r\n numeral(CONSTANTS.StockMarketCommission).format('($0.000a)') + \" in commission fees.\");\r\n }\r\n } else {\r\n dialogBoxCreate(\"Bought a short position of \" + formatNumber(shares, 0) + \" shares of \" + stock.symbol + \" at $\" +\r\n formatNumber(stock.price, 2) + \" per share. You also paid $\" +\r\n formatNumber(CONSTANTS.StockMarketCommission, 2) + \" in commission fees.\");\r\n }\r\n return true;\r\n}\r\n\r\n//Returns true if successful and false otherwise\r\nfunction sellShort(stock, shares, workerScript=null) {\r\n var tixApi = (workerScript instanceof WorkerScript);\r\n if (stock == null || isNaN(shares) || shares < 0) {\r\n if (tixApi) {\r\n workerScript.scriptRef.log(\"ERROR: sellShort() failed because of invalid arguments.\");\r\n } else {\r\n dialogBoxCreate(\"Failed to sell a short position in a stock. This is probably \" +\r\n \"due to an invalid quantity. Otherwise, this may be a bug, so contact developer\");\r\n }\r\n return false;\r\n }\r\n shares = Math.round(shares);\r\n if (shares > stock.playerShortShares) {shares = stock.playerShortShares;}\r\n if (shares === 0) {return false;}\r\n\r\n var origCost = shares * stock.playerAvgShortPx;\r\n var profit = ((stock.playerAvgShortPx - stock.price) * shares) - CONSTANTS.StockMarketCommission;\r\n if (isNaN(profit)) {profit = 0;}\r\n Player.gainMoney(origCost + profit);\r\n if (tixApi) {\r\n workerScript.scriptRef.onlineMoneyMade += profit;\r\n Player.scriptProdSinceLastAug += profit;\r\n }\r\n\r\n stock.playerShortShares -= shares;\r\n if (stock.playerShortShares === 0) {\r\n stock.playerAvgShortPx = 0;\r\n }\r\n updateStockPlayerPosition(stock);\r\n if (tixApi) {\r\n if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.sellShort == null) {\r\n workerScript.scriptRef.log(\"Sold your short position of \" + shares + \" shares of \" + stock.symbol + \" at \" +\r\n numeral(stock.price).format('($0.000a)') + \" per share. After commissions, you gained \" +\r\n \"a total of \" + numeral(origCost + profit).format('($0.000a)'));\r\n }\r\n } else {\r\n dialogBoxCreate(\"Sold your short position of \" + formatNumber(shares, 0) + \" shares of \" + stock.symbol + \" at $\" +\r\n formatNumber(stock.price, 2) + \" per share. After commissions, you gained \" +\r\n \"a total of $\" + formatNumber(origCost + profit, 2));\r\n }\r\n\r\n return true;\r\n}\r\n\r\nfunction updateStockPrices() {\r\n var v = Math.random();\r\n for (var name in StockMarket) {\r\n if (StockMarket.hasOwnProperty(name)) {\r\n var stock = StockMarket[name];\r\n if (!(stock instanceof Stock)) {continue;}\r\n var av = (v * stock.mv) / 100;\r\n if (isNaN(av)) {av = .02;}\r\n\r\n var chc = 50;\r\n if (stock.b) {\r\n chc = (chc + stock.otlkMag)/100;\r\n if (isNaN(chc)) {chc = 0.5;}\r\n } else {\r\n chc = (chc - stock.otlkMag)/100;\r\n if (isNaN(chc)) {chc = 0.5;}\r\n }\r\n if (stock.price >= StockPriceCap) {\r\n chc = -1; //Limit on stock price\r\n stock.b = false;\r\n }\r\n\r\n var c = Math.random();\r\n if (c < chc) {\r\n stock.price *= (1 + av);\r\n processOrders(stock, OrderTypes.LimitBuy, PositionTypes.Short);\r\n processOrders(stock, OrderTypes.LimitSell, PositionTypes.Long);\r\n processOrders(stock, OrderTypes.StopBuy, PositionTypes.Long);\r\n processOrders(stock, OrderTypes.StopSell, PositionTypes.Short);\r\n if (Engine.currentPage == Engine.Page.StockMarket) {\r\n updateStockTicker(stock, true);\r\n }\r\n } else {\r\n stock.price /= (1 + av);\r\n processOrders(stock, OrderTypes.LimitBuy, PositionTypes.Long);\r\n processOrders(stock, OrderTypes.LimitSell, PositionTypes.Short);\r\n processOrders(stock, OrderTypes.StopBuy, PositionTypes.Short);\r\n processOrders(stock, OrderTypes.StopSell, PositionTypes.Long);\r\n if (Engine.currentPage == Engine.Page.StockMarket) {\r\n updateStockTicker(stock, false);\r\n }\r\n }\r\n\r\n var otlkMagChange = stock.otlkMag * av;\r\n if (stock.otlkMag <= 0.1) {\r\n otlkMagChange = 1;\r\n }\r\n if (c < 0.5) {\r\n stock.otlkMag += otlkMagChange;\r\n } else {\r\n stock.otlkMag -= otlkMagChange;\r\n }\r\n if (stock.otlkMag < 0) {\r\n stock.otlkMag *= -1;\r\n stock.b = !stock.b;\r\n }\r\n\r\n }\r\n }\r\n}\r\n\r\n//Checks and triggers any orders for the specified stock\r\nfunction processOrders(stock, orderType, posType) {\r\n var orderBook = StockMarket[\"Orders\"];\r\n if (orderBook == null) {\r\n var orders = {};\r\n for (var name in StockMarket) {\r\n if (StockMarket.hasOwnProperty(name)) {\r\n var stock = StockMarket[name];\r\n if (!(stock instanceof Stock)) {continue;}\r\n orders[stock.symbol] = [];\r\n }\r\n }\r\n StockMarket[\"Orders\"] = orders;\r\n return; //Newly created, so no orders to process\r\n }\r\n var stockOrders = orderBook[stock.symbol];\r\n if (stockOrders == null || !(stockOrders.constructor === Array)) {\r\n console.log(\"ERROR: Invalid Order book for \" + stock.symbol + \" in processOrders()\");\r\n stockOrders = [];\r\n return;\r\n }\r\n for (var i = 0; i < stockOrders.length; ++i) {\r\n var order = stockOrders[i];\r\n if (order.type === orderType && order.pos === posType) {\r\n switch(order.type) {\r\n case OrderTypes.LimitBuy:\r\n if (order.pos === PositionTypes.Long && stock.price <= order.price) {\r\n executeOrder/*66*/(order);\r\n } else if (order.pos === PositionTypes.Short && stock.price >= order.price) {\r\n executeOrder/*66*/(order);\r\n }\r\n break;\r\n case OrderTypes.LimitSell:\r\n if (order.pos === PositionTypes.Long && stock.price >= order.price) {\r\n executeOrder/*66*/(order);\r\n } else if (order.pos === PositionTypes.Short && stock.price <= order.price) {\r\n executeOrder/*66*/(order);\r\n }\r\n break;\r\n case OrderTypes.StopBuy:\r\n if (order.pos === PositionTypes.Long && stock.price >= order.price) {\r\n executeOrder/*66*/(order);\r\n } else if (order.pos === PositionTypes.Short && stock.price <= order.price) {\r\n executeOrder/*66*/(order);\r\n }\r\n break;\r\n case OrderTypes.StopSell:\r\n if (order.pos === PositionTypes.Long && stock.price <= order.price) {\r\n executeOrder/*66*/(order);\r\n } else if (order.pos === PositionTypes.Short && stock.price >= order.price) {\r\n executeOrder/*66*/(order);\r\n }\r\n break;\r\n default:\r\n console.log(\"Invalid order type: \" + order.type);\r\n return;\r\n }\r\n }\r\n }\r\n}\r\n\r\nfunction setStockMarketContentCreated(b) {\r\n stockMarketContentCreated = b;\r\n}\r\n\r\nvar stockMarketContentCreated = false;\r\nvar stockMarketPortfolioMode = false;\r\nvar COMM = CONSTANTS.StockMarketCommission;\r\nfunction displayStockMarketContent() {\r\n if (Player.hasWseAccount == null) {Player.hasWseAccount = false;}\r\n if (Player.hasTixApiAccess == null) {Player.hasTixApiAccess = false;}\r\n\r\n //Purchase WSE Account button\r\n var wseAccountButton = clearEventListeners(\"stock-market-buy-account\");\r\n wseAccountButton.innerText = \"Buy WSE Account - $\" + formatNumber(CONSTANTS.WSEAccountCost, 2).toString();\r\n if (!Player.hasWseAccount && Player.money.gte(CONSTANTS.WSEAccountCost)) {\r\n wseAccountButton.setAttribute(\"class\", \"a-link-button\");\r\n } else if (Player.hasWseAccount){\r\n wseAccountButton.innerText = \"WSE Account - Purchased\";\r\n wseAccountButton.setAttribute(\"class\", \"a-link-button-bought\");\r\n } else {\r\n wseAccountButton.setAttribute(\"class\", \"a-link-button-inactive\");\r\n }\r\n wseAccountButton.addEventListener(\"click\", function() {\r\n Player.hasWseAccount = true;\r\n initStockMarket();\r\n initSymbolToStockMap();\r\n Player.loseMoney(CONSTANTS.WSEAccountCost);\r\n displayStockMarketContent();\r\n return false;\r\n });\r\n\r\n //Purchase TIX API Access account\r\n var tixApiAccessButton = clearEventListeners(\"stock-market-buy-tix-api\");\r\n tixApiAccessButton.innerText = \"Buy Trade Information eXchange (TIX) API Access - $\" +\r\n formatNumber(CONSTANTS.TIXAPICost, 2).toString();\r\n if (!Player.hasTixApiAccess && Player.money.gte(CONSTANTS.TIXAPICost)) {\r\n tixApiAccessButton.setAttribute(\"class\", \"a-link-button\");\r\n } else if(Player.hasTixApiAccess) {\r\n tixApiAccessButton.innerText = \"Trade Information eXchange (TIX) API Access - Purchased\"\r\n tixApiAccessButton.setAttribute(\"class\", \"a-link-button-bought\");\r\n } else {\r\n tixApiAccessButton.setAttribute(\"class\", \"a-link-button-inactive\");\r\n }\r\n tixApiAccessButton.addEventListener(\"click\", function() {\r\n Player.hasTixApiAccess = true;\r\n Player.loseMoney(CONSTANTS.TIXAPICost);\r\n displayStockMarketContent();\r\n return false;\r\n });\r\n\r\n var stockList = document.getElementById(\"stock-market-list\");\r\n if (stockList == null) {return;}\r\n\r\n if (!Player.hasWseAccount) {\r\n stockMarketContentCreated = false;\r\n while (stockList.firstChild) {\r\n stockList.removeChild(stockList.firstChild);\r\n }\r\n return;\r\n }\r\n\r\n //Create stock market content if you have an account\r\n if (!stockMarketContentCreated && Player.hasWseAccount) {\r\n console.log(\"Creating Stock Market UI\");\r\n document.getElementById(\"stock-market-commission\").innerHTML =\r\n \"Commission Fees: Every transaction you make has a $\" +\r\n formatNumber(CONSTANTS.StockMarketCommission, 2) + \" commission fee.<br><br>\" +\r\n \"WARNING: When you reset after installing Augmentations, the Stock Market is reset. \" +\r\n \"This means all your positions are lost, so make sure to sell your stocks before installing \" +\r\n \"Augmentations!\";\r\n\r\n var investopediaButton = clearEventListeners(\"stock-market-investopedia\");\r\n investopediaButton.addEventListener(\"click\", function() {\r\n var txt = \"When making a transaction on the stock market, there are two \" +\r\n \"types of positions: Long and Short. A Long position is the typical \" +\r\n \"scenario where you buy a stock and earn a profit if the price of that \" +\r\n \"stock increases. Meanwhile, a Short position is the exact opposite. \" +\r\n \"In a Short position you purchase shares of a stock and earn a profit \" +\r\n \"if the price of that stock decreases. This is also called 'shorting' a stock.<br><br>\" +\r\n \"NOTE: Shorting stocks is not available immediately, and must be unlocked later on in the game.<br><br>\" +\r\n \"There are three different types of orders you can make to buy or sell \" +\r\n \"stocks on the exchange: Market Order, Limit Order, and Stop Order. \" +\r\n \"Note that Limit Orders and Stop Orders are not available immediately, and must be unlocked \" +\r\n \"later on in the game.<br><br>\" +\r\n \"When you place a Market Order to buy or sell a stock, the order executes \" +\r\n \"immediately at whatever the current price of the stock is. For example \" +\r\n \"if you choose to short a stock with 5000 shares using a Market Order, \" +\r\n \"you immediately purchase those 5000 shares in a Short position at whatever \" +\r\n \"the current market price is for that stock.<br><br>\" +\r\n \"A Limit Order is an order that only executes under certain conditions. \" +\r\n \"A Limit Order is used to buy or sell a stock at a specified price or better. \" +\r\n \"For example, lets say you purchased a Long position of 100 shares of some stock \" +\r\n \"at a price of $10 per share. You can place a Limit Order to sell those 100 shares \" +\r\n \"at $50 or better. The Limit Order will execute when the price of the stock reaches a \" +\r\n \"value of $50 or higher.<br><br>\" +\r\n \"A Stop Order is the opposite of a Limit Order. It is used to buy or sell a stock \" +\r\n \"at a specified price (before the price gets 'worse'). For example, lets say you purchased \" +\r\n \"a Short position of 100 shares of some stock at a price of $100 per share. \" +\r\n \"The current price of the stock is $80 (a profit of $20 per share). You can place a \" +\r\n \"Stop Order to sell the Short position if the stock's price reaches $90 or higher. \" +\r\n \"This can be used to lock in your profits and limit any losses.<br><br>\" +\r\n \"Here is a summary of how each order works and when they execute:<br><br>\" +\r\n \"In a LONG Position:<br><br>\" +\r\n \"A Limit Order to buy will execute if the stock's price <= order's price<br>\" +\r\n \"A Limit Order to sell will execute if the stock's price >= order's price<br>\" +\r\n \"A Stop Order to buy will execute if the stock's price >= order's price<br>\" +\r\n \"A Stop Order to sell will execute if the stock's price <= order's price<br><br>\" +\r\n \"In a SHORT Position:<br><br>\" +\r\n \"A Limit Order to buy will execute if the stock's price >= order's price<br>\" +\r\n \"A Limit Order to sell will execute if the stock's price <= order's price<br>\" +\r\n \"A Stop Order to buy will execute if the stock's price <= order's price<br>\" +\r\n \"A Stop Order to sell will execute if the stock's price >= order's price.\";\r\n dialogBoxCreate(txt);\r\n return false;\r\n });\r\n\r\n //Switch to Portfolio Mode Button\r\n var modeBtn = clearEventListeners(\"stock-market-mode\");\r\n if (modeBtn) {\r\n modeBtn.innerHTML = \"Switch to 'Portfolio' Mode\" +\r\n \"<span class='tooltiptext'>Displays only the stocks for which you have shares or orders</span>\";\r\n modeBtn.addEventListener(\"click\", switchToPortfolioMode);\r\n }\r\n\r\n //Expand/Collapse tickers buttons\r\n var expandBtn = clearEventListeners(\"stock-market-expand-tickers\"),\r\n collapseBtn = clearEventListeners(\"stock-market-collapse-tickers\"),\r\n stockList = document.getElementById(\"stock-market-list\");\r\n if (expandBtn) {\r\n expandBtn.addEventListener(\"click\", ()=>{\r\n var tickerHdrs = stockList.getElementsByClassName(\"accordion-header\");\r\n for (var i = 0; i < tickerHdrs.length; ++i) {\r\n if (!tickerHdrs[i].classList.contains(\"active\")) {\r\n tickerHdrs[i].click();\r\n }\r\n }\r\n });\r\n }\r\n if (collapseBtn) {\r\n collapseBtn.addEventListener(\"click\",()=>{\r\n var tickerHdrs = stockList.getElementsByClassName(\"accordion-header\");\r\n for (var i = 0; i < tickerHdrs.length; ++i) {\r\n if (tickerHdrs[i].classList.contains(\"active\")) {\r\n tickerHdrs[i].click();\r\n }\r\n }\r\n });\r\n }\r\n\r\n for (var name in StockMarket) {\r\n if (StockMarket.hasOwnProperty(name)) {\r\n var stock = StockMarket[name];\r\n if (!(stock instanceof Stock)) {continue;} //orders property is an array\r\n createStockTicker(stock);\r\n }\r\n }\r\n setStockTickerClickHandlers(); //Clicking headers opens/closes panels\r\n stockMarketContentCreated = true;\r\n }\r\n\r\n if (Player.hasWseAccount) {\r\n for (var name in StockMarket) {\r\n if (StockMarket.hasOwnProperty(name)) {\r\n var stock = StockMarket[name];\r\n updateStockTicker(stock, null);\r\n updateStockOrderList(stock);\r\n }\r\n }\r\n }\r\n}\r\n\r\n//Displays only stocks you have position/order in\r\nfunction switchToPortfolioMode() {\r\n stockMarketPortfolioMode = true;\r\n var stockList = document.getElementById(\"stock-market-list\");\r\n if (stockList == null) {return;}\r\n var modeBtn = clearEventListeners(\"stock-market-mode\");\r\n if (modeBtn) {\r\n modeBtn.innerHTML = \"Switch to 'All stocks' Mode\" +\r\n \"<span class='tooltiptext'>Displays all stocks on the WSE</span>\";\r\n modeBtn.addEventListener(\"click\", switchToDisplayAllMode);\r\n }\r\n while(stockList.firstChild) {stockList.removeChild(stockList.firstChild);}\r\n\r\n //Get Order book (create it if it hasn't been created)\r\n var orderBook = StockMarket[\"Orders\"];\r\n if (orderBook == null) {\r\n var orders = {};\r\n for (var name in StockMarket) {\r\n if (StockMarket.hasOwnProperty(name)) {\r\n var stock = StockMarket[name];\r\n if (!(stock instanceof Stock)) {continue;}\r\n orders[stock.symbol] = [];\r\n }\r\n }\r\n StockMarket[\"Orders\"] = orders;\r\n }\r\n\r\n for (var name in StockMarket) {\r\n if (StockMarket.hasOwnProperty(name)) {\r\n var stock = StockMarket[name];\r\n if (!(stock instanceof Stock)) {continue;} //orders property is an array\r\n var stockOrders = orderBook[stock.symbol];\r\n if (stock.playerShares === 0 && stock.playerShortShares === 0 &&\r\n stockOrders.length === 0) {continue;}\r\n createStockTicker(stock);\r\n }\r\n }\r\n setStockTickerClickHandlers();\r\n}\r\n\r\n//Displays all stocks\r\nfunction switchToDisplayAllMode() {\r\n stockMarketPortfolioMode = false;\r\n var stockList = document.getElementById(\"stock-market-list\");\r\n if (stockList == null) {return;}\r\n var modeBtn = clearEventListeners(\"stock-market-mode\");\r\n if (modeBtn) {\r\n modeBtn.innerHTML = \"Switch to 'Portfolio' Mode\" +\r\n \"<span class='tooltiptext'>Displays only the stocks for which you have shares or orders</span>\";\r\n modeBtn.addEventListener(\"click\", switchToPortfolioMode);\r\n }\r\n while(stockList.firstChild) {stockList.removeChild(stockList.firstChild);}\r\n for (var name in StockMarket) {\r\n if (StockMarket.hasOwnProperty(name)) {\r\n var stock = StockMarket[name];\r\n if (!(stock instanceof Stock)) {continue;} //orders property is an array\r\n createStockTicker(stock);\r\n }\r\n }\r\n setStockTickerClickHandlers();\r\n}\r\n\r\nfunction createStockTicker(stock) {\r\n if (!(stock instanceof Stock)) {\r\n console.log(\"Invalid stock in createStockSticker()\");\r\n return;\r\n }\r\n var tickerId = \"stock-market-ticker-\" + stock.symbol;\r\n var li = document.createElement(\"li\"), hdr = document.createElement(\"button\");\r\n hdr.classList.add(\"accordion-header\");\r\n hdr.setAttribute(\"id\", tickerId + \"-hdr\");\r\n hdr.innerHTML = stock.name + \" - \" + stock.symbol + \" - $\" + stock.price;\r\n\r\n //Div for entire panel\r\n var stockDiv = document.createElement(\"div\");\r\n stockDiv.classList.add(\"accordion-panel\");\r\n stockDiv.setAttribute(\"id\", tickerId + \"-panel\");\r\n\r\n /* Create panel DOM */\r\n var qtyInput = document.createElement(\"input\"),\r\n longShortSelect = document.createElement(\"select\"),\r\n orderTypeSelect = document.createElement(\"select\"),\r\n buyButton = document.createElement(\"span\"),\r\n sellButton = document.createElement(\"span\"),\r\n buyMaxButton = document.createElement(\"span\"),\r\n sellAllButton = document.createElement(\"span\"),\r\n positionTxt = document.createElement(\"p\"),\r\n orderList = document.createElement(\"ul\");\r\n\r\n qtyInput.classList.add(\"stock-market-input\");\r\n qtyInput.placeholder = \"Quantity (Shares)\";\r\n qtyInput.setAttribute(\"id\", tickerId + \"-qty-input\");\r\n qtyInput.setAttribute(\"onkeydown\", \"return ( event.ctrlKey || event.altKey \" +\r\n \" || (47<event.keyCode && event.keyCode<58 && event.shiftKey==false) \" +\r\n \" || (95<event.keyCode && event.keyCode<106) \" +\r\n \" || (event.keyCode==8) || (event.keyCode==9) \" +\r\n \" || (event.keyCode>34 && event.keyCode<40) \" +\r\n \" || (event.keyCode==46) )\");\r\n\r\n longShortSelect.classList.add(\"stock-market-input\");\r\n longShortSelect.setAttribute(\"id\", tickerId + \"-pos-selector\");\r\n var longOpt = document.createElement(\"option\");\r\n longOpt.text = \"Long\";\r\n longShortSelect.add(longOpt);\r\n if (Player.bitNodeN === 8 || (hasWallStreetSF && wallStreetSFLvl >= 2)) {\r\n var shortOpt = document.createElement(\"option\");\r\n shortOpt.text = \"Short\";\r\n longShortSelect.add(shortOpt);\r\n }\r\n\r\n orderTypeSelect.classList.add(\"stock-market-input\");\r\n orderTypeSelect.setAttribute(\"id\", tickerId + \"-order-selector\");\r\n var marketOpt = document.createElement(\"option\");\r\n marketOpt.text = \"Market Order\";\r\n orderTypeSelect.add(marketOpt);\r\n if (Player.bitNodeN === 8 || (hasWallStreetSF && wallStreetSFLvl >= 3)) {\r\n var limitOpt = document.createElement(\"option\");\r\n limitOpt.text = \"Limit Order\";\r\n orderTypeSelect.add(limitOpt);\r\n var stopOpt = document.createElement(\"option\");\r\n stopOpt.text = \"Stop Order\";\r\n orderTypeSelect.add(stopOpt);\r\n }\r\n\r\n buyButton.classList.add(\"stock-market-input\");\r\n buyButton.classList.add(\"a-link-button\");\r\n buyButton.innerHTML = \"Buy\";\r\n buyButton.addEventListener(\"click\", ()=>{\r\n var pos = longShortSelect.options[longShortSelect.selectedIndex].text;\r\n pos === \"Long\" ? pos = PositionTypes.Long : pos = PositionTypes.Short;\r\n var ordType = orderTypeSelect.options[orderTypeSelect.selectedIndex].text;\r\n var shares = Number(document.getElementById(tickerId + \"-qty-input\").value);\r\n if (isNaN(shares)) {return false;}\r\n switch (ordType) {\r\n case \"Market Order\":\r\n pos === PositionTypes.Long ? buyStock(stock, shares) : shortStock(stock, shares, null);\r\n break;\r\n case \"Limit Order\":\r\n case \"Stop Order\":\r\n var yesBtn = yesNoTxtInpBoxGetYesButton(),\r\n noBtn = yesNoTxtInpBoxGetNoButton();\r\n yesBtn.innerText = \"Place Buy \" + ordType;\r\n noBtn.innerText = \"Cancel Order\";\r\n yesBtn.addEventListener(\"click\", ()=>{\r\n var price = Number(yesNoTxtInpBoxGetInput()), type;\r\n if (ordType === \"Limit Order\") {\r\n type = OrderTypes.LimitBuy;\r\n } else {\r\n type = OrderTypes.StopBuy;\r\n }\r\n placeOrder(stock, shares, price, type, pos);\r\n yesNoTxtInpBoxClose();\r\n });\r\n noBtn.addEventListener(\"click\", ()=>{\r\n yesNoTxtInpBoxClose();\r\n });\r\n yesNoTxtInpBoxCreate(\"Enter the price for your \" + ordType);\r\n break;\r\n default:\r\n console.log(\"ERROR: Invalid order type\");\r\n break;\r\n }\r\n return false;\r\n });\r\n\r\n sellButton.classList.add(\"stock-market-input\");\r\n sellButton.classList.add(\"a-link-button\");\r\n sellButton.innerHTML = \"Sell\";\r\n sellButton.addEventListener(\"click\", ()=>{\r\n var pos = longShortSelect.options[longShortSelect.selectedIndex].text;\r\n pos === \"Long\" ? pos = PositionTypes.Long : pos = PositionTypes.Short;\r\n var ordType = orderTypeSelect.options[orderTypeSelect.selectedIndex].text;\r\n var shares = Number(document.getElementById(tickerId + \"-qty-input\").value);\r\n if (isNaN(shares)) {return false;}\r\n switch (ordType) {\r\n case \"Market Order\":\r\n pos === PositionTypes.Long ? sellStock(stock, shares) : sellShort(stock, shares, null);\r\n break;\r\n case \"Limit Order\":\r\n case \"Stop Order\":\r\n var yesBtn = yesNoTxtInpBoxGetYesButton(),\r\n noBtn = yesNoTxtInpBoxGetNoButton();\r\n yesBtn.innerText = \"Place Sell \" + ordType;\r\n noBtn.innerText = \"Cancel Order\";\r\n yesBtn.addEventListener(\"click\", ()=>{\r\n var price = Number(yesNoTxtInpBoxGetInput()), type;\r\n if (ordType === \"Limit Order\") {\r\n type = OrderTypes.LimitSell;\r\n } else {\r\n type = OrderTypes.StopSell;\r\n }\r\n yesNoTxtInpBoxClose();\r\n placeOrder(stock, shares, price, type, pos);\r\n });\r\n noBtn.addEventListener(\"click\", ()=>{\r\n yesNoTxtInpBoxClose();\r\n });\r\n yesNoTxtInpBoxCreate(\"Enter the price for your \" + ordType);\r\n break;\r\n default:\r\n console.log(\"ERROR: Invalid order type\");\r\n break;\r\n }\r\n return false;\r\n });\r\n\r\n buyMaxButton.classList.add(\"stock-market-input\");\r\n buyMaxButton.classList.add(\"a-link-button\");\r\n buyMaxButton.innerHTML = \"Buy MAX\";\r\n buyMaxButton.addEventListener(\"click\", ()=>{\r\n var pos = longShortSelect.options[longShortSelect.selectedIndex].text;\r\n pos === \"Long\" ? pos = PositionTypes.Long : pos = PositionTypes.Short;\r\n var ordType = orderTypeSelect.options[orderTypeSelect.selectedIndex].text;\r\n var money = Player.money.toNumber();\r\n switch (ordType) {\r\n case \"Market Order\":\r\n var shares = Math.floor((money - COMM) / stock.price);\r\n pos === PositionTypes.Long ? buyStock(stock, shares) : shortStock(stock, shares, null);\r\n break;\r\n case \"Limit Order\":\r\n case \"Stop Order\":\r\n var yesBtn = yesNoTxtInpBoxGetYesButton(),\r\n noBtn = yesNoTxtInpBoxGetNoButton();\r\n yesBtn.innerText = \"Place Buy \" + ordType;\r\n noBtn.innerText = \"Cancel Order\";\r\n yesBtn.addEventListener(\"click\", ()=>{\r\n var price = Number(yesNoTxtInpBoxGetInput()), type;\r\n if (ordType === \"Limit Order\") {\r\n type = OrderTypes.LimitBuy;\r\n } else {\r\n type = OrderTypes.StopBuy;\r\n }\r\n var shares = Math.floor((money-COMM) / price);\r\n placeOrder(stock, shares, price, type, pos);\r\n yesNoTxtInpBoxClose();\r\n });\r\n noBtn.addEventListener(\"click\", ()=>{\r\n yesNoTxtInpBoxClose();\r\n });\r\n yesNoTxtInpBoxCreate(\"Enter the price for your \" + ordType);\r\n break;\r\n default:\r\n console.log(\"ERROR: Invalid order type\");\r\n break;\r\n }\r\n return false;\r\n });\r\n\r\n sellAllButton.classList.add(\"stock-market-input\");\r\n sellAllButton.classList.add(\"a-link-button\");\r\n sellAllButton.innerHTML = \"Sell ALL\";\r\n sellAllButton.addEventListener(\"click\", ()=>{\r\n var pos = longShortSelect.options[longShortSelect.selectedIndex].text;\r\n pos === \"Long\" ? pos = PositionTypes.Long : pos = PositionTypes.Short;\r\n var ordType = orderTypeSelect.options[orderTypeSelect.selectedIndex].text;\r\n switch (ordType) {\r\n case \"Market Order\":\r\n if (pos === PositionTypes.Long) {\r\n var shares = stock.playerShares;\r\n sellStock(stock, shares);\r\n } else {\r\n var shares = stock.playerShortShares;\r\n sellShort(stock, shares, null);\r\n }\r\n break;\r\n case \"Limit Order\":\r\n case \"Stop Order\":\r\n dialogBoxCreate(\"ERROR: 'Sell All' only works for Market Orders\")\r\n break;\r\n default:\r\n console.log(\"ERROR: Invalid order type\");\r\n break;\r\n }\r\n return false;\r\n });\r\n\r\n positionTxt.setAttribute(\"id\", tickerId + \"-position-text\");\r\n positionTxt.classList.add(\"stock-market-position-text\");\r\n stock.posTxtEl = positionTxt;\r\n\r\n orderList.setAttribute(\"id\", tickerId + \"-order-list\");\r\n orderList.classList.add(\"stock-market-order-list\");\r\n\r\n stockDiv.appendChild(qtyInput);\r\n stockDiv.appendChild(longShortSelect);\r\n stockDiv.appendChild(orderTypeSelect);\r\n stockDiv.appendChild(buyButton);\r\n stockDiv.appendChild(sellButton);\r\n stockDiv.appendChild(buyMaxButton);\r\n stockDiv.appendChild(sellAllButton);\r\n stockDiv.appendChild(positionTxt);\r\n stockDiv.appendChild(orderList);\r\n\r\n li.appendChild(hdr);\r\n li.appendChild(stockDiv);\r\n document.getElementById(\"stock-market-list\").appendChild(li);\r\n\r\n updateStockTicker(stock, true);\r\n updateStockPlayerPosition(stock);\r\n updateStockOrderList(stock);\r\n}\r\n\r\nfunction setStockTickerClickHandlers() {\r\n var stockList = document.getElementById(\"stock-market-list\");\r\n var tickerHdrs = stockList.getElementsByClassName(\"accordion-header\");\r\n if (tickerHdrs == null) {\r\n console.log(\"ERROR: Could not find header elements for stock tickers\");\r\n return;\r\n }\r\n for (var i = 0; i < tickerHdrs.length; ++i) {\r\n tickerHdrs[i].onclick = function() {\r\n this.classList.toggle(\"active\");\r\n\r\n var panel = this.nextElementSibling;\r\n if (panel.style.display === \"block\") {\r\n panel.style.display = \"none\";\r\n } else {\r\n panel.style.display = \"block\";\r\n }\r\n }\r\n }\r\n}\r\n\r\n//'increase' argument is a boolean indicating whether the price increased or decreased\r\nfunction updateStockTicker(stock, increase) {\r\n if (Engine.currentPage !== Engine.Page.StockMarket) {return;}\r\n if (!(stock instanceof Stock)) {\r\n console.log(\"Invalid stock in updateStockTicker():\");\r\n console.log(stock);\r\n return;\r\n }\r\n var tickerId = \"stock-market-ticker-\" + stock.symbol;\r\n\r\n if (stock.playerShares > 0 || stock.playerShortShares > 0) {\r\n updateStockPlayerPosition(stock);\r\n }\r\n\r\n var hdr = document.getElementById(tickerId + \"-hdr\");\r\n\r\n if (hdr == null) {\r\n if (!stockMarketPortfolioMode) {console.log(\"ERROR: Couldn't find ticker element for stock: \" + stock.symbol);}\r\n return;\r\n }\r\n hdr.innerHTML = stock.name + \" - \" + stock.symbol + \" - $\" + formatNumber(stock.price, 2);\r\n if (increase != null) {\r\n increase ? hdr.style.color = \"#66ff33\" : hdr.style.color = \"red\";\r\n }\r\n}\r\n\r\nfunction updateStockPlayerPosition(stock) {\r\n if (Engine.currentPage !== Engine.Page.StockMarket) {return;}\r\n if (!(stock instanceof Stock)) {\r\n console.log(\"Invalid stock in updateStockPlayerPosition():\");\r\n console.log(stock);\r\n return;\r\n }\r\n var tickerId = \"stock-market-ticker-\" + stock.symbol;\r\n\r\n if (stockMarketPortfolioMode) {\r\n if (stock.playerShares === 0 && stock.playerShortShares === 0 &&\r\n StockMarket[\"Orders\"] && StockMarket[\"Orders\"][stock.symbol] &&\r\n StockMarket[\"Orders\"][stock.symbol].length === 0) {\r\n removeElementById(tickerId + \"-hdr\");\r\n removeElementById(tickerId + \"-panel\");\r\n return;\r\n } else {\r\n //If the ticker hasn't been created, create it (handles updating)\r\n //If it has been created, continue normally\r\n if (document.getElementById(tickerId + \"-hdr\") == null) {\r\n createStockTicker(stock);\r\n setStockTickerClickHandlers();\r\n return;\r\n }\r\n }\r\n }\r\n\r\n if (!(stock.posTxtEl instanceof Element)) {\r\n stock.posTxtEl = document.getElementById(tickerId + \"-position-text\");\r\n }\r\n if (stock.posTxtEl == null) {\r\n console.log(\"ERROR: Could not find stock position element for: \" + stock.symbol);\r\n return;\r\n }\r\n\r\n //Calculate returns\r\n var totalCost = stock.playerShares * stock.playerAvgPx,\r\n gains = (stock.price - stock.playerAvgPx) * stock.playerShares,\r\n percentageGains = gains / totalCost;\r\n if (isNaN(percentageGains)) {percentageGains = 0;}\r\n\r\n var shortTotalCost = stock.playerShortShares * stock.playerAvgShortPx,\r\n shortGains = (stock.playerAvgShortPx - stock.price) * stock.playerShortShares,\r\n shortPercentageGains = shortGains/ shortTotalCost;\r\n if (isNaN(shortPercentageGains)) {shortPercentageGains = 0;}\r\n\r\n stock.posTxtEl.innerHTML =\r\n \"<h1 class='tooltip stock-market-position-text'>Long Position: \" +\r\n \"<span class='tooltiptext'>Shares in the long position will increase \" +\r\n \"in value if the price of the corresponding stock increases</span></h1>\" +\r\n \"<br>Shares: \" + formatNumber(stock.playerShares, 0) +\r\n \"<br>Average Price: \" + numeral(stock.playerAvgPx).format('$0.000a') +\r\n \" (Total Cost: \" + numeral(totalCost).format('$0.000a') + \")\" +\r\n \"<br>Profit: \" + numeral(gains).format('$0.000a') +\r\n \" (\" + formatNumber(percentageGains*100, 2) + \"%)<br><br>\";\r\n if (Player.bitNodeN === 8 || (hasWallStreetSF && wallStreetSFLvl >= 2)) {\r\n stock.posTxtEl.innerHTML +=\r\n \"<h1 class='tooltip stock-market-position-text'>Short Position: \" +\r\n \"<span class='tooltiptext'>Shares in short position will increase \" +\r\n \"in value if the price of the corresponding stock decreases</span></h1>\" +\r\n \"<br>Shares: \" + formatNumber(stock.playerShortShares, 0) +\r\n \"<br>Average Price: \" + numeral(stock.playerAvgShortPx).format('$0.000a') +\r\n \" (Total Cost: \" + numeral(shortTotalCost).format('$0.000a') + \")\" +\r\n \"<br>Profit: \" + numeral(shortGains).format('$0.000a') +\r\n \" (\" + formatNumber(shortPercentageGains*100, 2) + \"%)\" +\r\n \"<br><br><h1 class='stock-market-position-text'>Orders: </h1>\";\r\n }\r\n\r\n}\r\n\r\nfunction updateStockOrderList(stock) {\r\n if (Engine.currentPage !== Engine.Page.StockMarket) {return;}\r\n var tickerId = \"stock-market-ticker-\" + stock.symbol;\r\n var orderList = document.getElementById(tickerId + \"-order-list\");\r\n if (orderList == null) {\r\n if (!stockMarketPortfolioMode) {console.log(\"ERROR: Could not find order list for \" + stock.symbol);}\r\n return;\r\n }\r\n\r\n var orderBook = StockMarket[\"Orders\"];\r\n if (orderBook == null) {\r\n console.log(\"ERROR: Could not find order book in stock market\");\r\n return;\r\n }\r\n var stockOrders = orderBook[stock.symbol];\r\n if (stockOrders == null) {\r\n console.log(\"ERROR: Could not find orders for: \" + stock.symbol);\r\n return;\r\n }\r\n\r\n if (stockMarketPortfolioMode) {\r\n if (stock.playerShares === 0 && stock.playerShortShares === 0 &&\r\n StockMarket[\"Orders\"] && StockMarket[\"Orders\"][stock.symbol] &&\r\n StockMarket[\"Orders\"][stock.symbol].length === 0) {\r\n removeElementById(tickerId + \"-hdr\");\r\n removeElementById(tickerId + \"-panel\");\r\n return;\r\n } else {\r\n //If the ticker hasn't been created, create it (handles updating)\r\n //If it has been created, continue normally\r\n if (document.getElementById(tickerId + \"-hdr\") == null) {\r\n createStockTicker(stock);\r\n setStockTickerClickHandlers();\r\n return;\r\n }\r\n }\r\n }\r\n\r\n //Remove everything from list\r\n while (orderList.firstChild) {\r\n orderList.removeChild(orderList.firstChild);\r\n }\r\n\r\n for (var i = 0; i < stockOrders.length; ++i) {\r\n (function() {\r\n var order = stockOrders[i];\r\n var li = document.createElement(\"li\");\r\n li.style.padding = \"4px\";\r\n var posText = (order.pos === PositionTypes.Long ? \"Long Position\" : \"Short Position\");\r\n li.style.color = \"white\";\r\n li.innerText = order.type + \" - \" + posText + \" - \" +\r\n order.shares + \" @ $\" + formatNumber(order.price, 2);\r\n\r\n var cancelButton = document.createElement(\"span\");\r\n cancelButton.classList.add(\"stock-market-order-cancel-btn\");\r\n cancelButton.classList.add(\"a-link-button\");\r\n cancelButton.innerHTML = \"Cancel Order\";\r\n cancelButton.addEventListener(\"click\", function() {\r\n cancelOrder({order: order}, null);\r\n return false;\r\n });\r\n li.appendChild(cancelButton);\r\n orderList.appendChild(li);\r\n }());\r\n\r\n }\r\n}\r\n\r\nexport {StockMarket, StockSymbols, SymbolToStockMap, initStockSymbols,\r\n initStockMarket, initSymbolToStockMap, stockMarketCycle, buyStock,\r\n sellStock, shortStock, sellShort, updateStockPrices, displayStockMarketContent,\r\n updateStockTicker, updateStockPlayerPosition, loadStockMarket,\r\n setStockMarketContentCreated, placeOrder, cancelOrder, Order, OrderTypes, PositionTypes};\r\n","import {Engine} from \"./engine.js\";\r\n\r\n/* Settings.js */\r\nlet Settings = {\r\n CodeInstructionRunTime: 50,\r\n MaxLogCapacity: 50,\r\n MaxPortCapacity: 50,\r\n SuppressMessages: false,\r\n SuppressFactionInvites: false,\r\n AutosaveInterval: 60,\r\n DisableHotkeys: false,\r\n ThemeHighlightColor: \"#ffffff\",\r\n ThemeFontColor: \"#66ff33\",\r\n ThemeBackgroundColor: \"#000000\",\r\n EditorTheme: \"Monokai\",\r\n EditorKeybinding: \"ace\",\r\n}\r\n\r\nfunction loadSettings(saveString) {\r\n Settings = JSON.parse(saveString);\r\n}\r\n\r\nfunction initSettings() {\r\n Settings.CodeInstructionRunTime = 50;\r\n Settings.MaxLogCapacity = 50;\r\n Settings.MaxPortCapacity = 50;\r\n Settings.SuppressMessages = false;\r\n Settings.SuppressFactionInvites = false;\r\n Settings.AutosaveInterval = 60;\r\n Settings.DisableHotkeys = false;\r\n}\r\n\r\nfunction setSettingsLabels() {\r\n var nsExecTime = document.getElementById(\"settingsNSExecTimeRangeValLabel\");\r\n var nsLogLimit = document.getElementById(\"settingsNSLogRangeValLabel\");\r\n var nsPortLimit = document.getElementById(\"settingsNSPortRangeValLabel\");\r\n var suppressMsgs = document.getElementById(\"settingsSuppressMessages\");\r\n var suppressFactionInv = document.getElementById(\"settingsSuppressFactionInvites\")\r\n var autosaveInterval = document.getElementById(\"settingsAutosaveIntervalValLabel\");\r\n var disableHotkeys = document.getElementById(\"settingsDisableHotkeys\");\r\n\r\n //Initialize values on labels\r\n nsExecTime.innerHTML = Settings.CodeInstructionRunTime + \"ms\";\r\n nsLogLimit.innerHTML = Settings.MaxLogCapacity;\r\n nsPortLimit.innerHTML = Settings.MaxPortCapacity;\r\n suppressMsgs.checked = Settings.SuppressMessages;\r\n suppressFactionInv.checked = Settings.SuppressFactionInvites;\r\n autosaveInterval.innerHTML = Settings.AutosaveInterval;\r\n disableHotkeys.checked = Settings.DisableHotkeys;\r\n\r\n //Set handlers for when input changes\r\n var nsExecTimeInput = document.getElementById(\"settingsNSExecTimeRangeVal\");\r\n var nsLogRangeInput = document.getElementById(\"settingsNSLogRangeVal\");\r\n var nsPortRangeInput = document.getElementById(\"settingsNSPortRangeVal\");\r\n var nsAutosaveIntervalInput = document.getElementById(\"settingsAutosaveIntervalVal\");\r\n nsExecTimeInput.value = Settings.CodeInstructionRunTime;\r\n nsLogRangeInput.value = Settings.MaxLogCapacity;\r\n nsPortRangeInput.value = Settings.MaxPortCapacity;\r\n nsAutosaveIntervalInput.value = Settings.AutosaveInterval;\r\n\r\n nsExecTimeInput.oninput = function() {\r\n nsExecTime.innerHTML = this.value + 'ms';\r\n Settings.CodeInstructionRunTime = this.value;\r\n };\r\n\r\n nsLogRangeInput.oninput = function() {\r\n nsLogLimit.innerHTML = this.value;\r\n Settings.MaxLogCapacity = this.value;\r\n };\r\n\r\n nsPortRangeInput.oninput = function() {\r\n nsPortLimit.innerHTML = this.value;\r\n Settings.MaxPortCapacity = this.value;\r\n };\r\n\r\n nsAutosaveIntervalInput.oninput = function() {\r\n autosaveInterval.innerHTML = this.value;\r\n Settings.AutosaveInterval = Number(this.value);\r\n if (Number(this.value) === 0) {\r\n Engine.Counters.autoSaveCounter = Infinity;\r\n } else {\r\n Engine.Counters.autoSaveCounter = Number(this.value) * 5;\r\n }\r\n };\r\n\r\n suppressMsgs.onclick = function() {\r\n Settings.SuppressMessages = this.checked;\r\n };\r\n\r\n suppressFactionInv.onclick = function() {\r\n Settings.SuppressFactionInvites = this.checked;\r\n };\r\n\r\n disableHotkeys.onclick = function() {\r\n Settings.DisableHotkeys = this.checked;\r\n }\r\n\r\n //Theme\r\n if (Settings.ThemeHighlightColor == null || Settings.ThemeFontColor == null || Settings.ThemeBackgroundColor == null) {\r\n console.log(\"ERROR: Cannot find Theme Settings\");\r\n return;\r\n }\r\n if (/^#[0-9a-f]{3}(?:[0-9a-f]{3})?$/i.test(Settings.ThemeHighlightColor) &&\r\n /^#[0-9a-f]{3}(?:[0-9a-f]{3})?$/i.test(Settings.ThemeFontColor) &&\r\n /^#[0-9a-f]{3}(?:[0-9a-f]{3})?$/i.test(Settings.ThemeBackgroundColor)) {\r\n document.body.style.setProperty('--my-highlight-color', Settings.ThemeHighlightColor);\r\n document.body.style.setProperty('--my-font-color', Settings.ThemeFontColor);\r\n document.body.style.setProperty('--my-background-color', Settings.ThemeBackgroundColor);\r\n }\r\n}\r\n\r\nexport {Settings, initSettings, setSettingsLabels, loadSettings};\r\n","/*\r\n *\r\n * decimal.js v7.2.3\r\n * An arbitrary-precision Decimal type for JavaScript.\r\n * https://github.com/MikeMcl/decimal.js\r\n * Copyright (c) 2017 Michael Mclaughlin <M8ch88l@gmail.com>\r\n * MIT Licence\r\n * https://github.com/MikeMcl/decimal.js/LICENCE\r\n *\r\n */\r\n\r\n\r\n// ----------------------------------- EDITABLE DEFAULTS ------------------------------------ //\r\n\r\n\r\n // The maximum exponent magnitude.\r\n // The limit on the value of `toExpNeg`, `toExpPos`, `minE` and `maxE`.\r\nvar EXP_LIMIT = 9e15, // 0 to 9e15\r\n\r\n // The limit on the value of `precision`, and on the value of the first argument to\r\n // `toDecimalPlaces`, `toExponential`, `toFixed`, `toPrecision` and `toSignificantDigits`.\r\n MAX_DIGITS = 1e9, // 0 to 1e9\r\n\r\n // Base conversion alphabet.\r\n NUMERALS = '0123456789abcdef',\r\n\r\n // The natural logarithm of 10 (1025 digits).\r\n ln10 = '2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058',\r\n\r\n // Pi (1025 digits).\r\n pi = '3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789',\r\n\r\n\r\n // The initial configuration properties of the Decimal constructor.\r\n defaults = {\r\n\r\n // These values must be integers within the stated ranges (inclusive).\r\n // Most of these values can be changed at run-time using the `Decimal.config` method.\r\n\r\n // The maximum number of significant digits of the result of a calculation or base conversion.\r\n // E.g. `Decimal.config({ precision: 20 });`\r\n precision: 20, // 1 to MAX_DIGITS\r\n\r\n // The rounding mode used when rounding to `precision`.\r\n //\r\n // ROUND_UP 0 Away from zero.\r\n // ROUND_DOWN 1 Towards zero.\r\n // ROUND_CEIL 2 Towards +Infinity.\r\n // ROUND_FLOOR 3 Towards -Infinity.\r\n // ROUND_HALF_UP 4 Towards nearest neighbour. If equidistant, up.\r\n // ROUND_HALF_DOWN 5 Towards nearest neighbour. If equidistant, down.\r\n // ROUND_HALF_EVEN 6 Towards nearest neighbour. If equidistant, towards even neighbour.\r\n // ROUND_HALF_CEIL 7 Towards nearest neighbour. If equidistant, towards +Infinity.\r\n // ROUND_HALF_FLOOR 8 Towards nearest neighbour. If equidistant, towards -Infinity.\r\n //\r\n // E.g.\r\n // `Decimal.rounding = 4;`\r\n // `Decimal.rounding = Decimal.ROUND_HALF_UP;`\r\n rounding: 4, // 0 to 8\r\n\r\n // The modulo mode used when calculating the modulus: a mod n.\r\n // The quotient (q = a / n) is calculated according to the corresponding rounding mode.\r\n // The remainder (r) is calculated as: r = a - n * q.\r\n //\r\n // UP 0 The remainder is positive if the dividend is negative, else is negative.\r\n // DOWN 1 The remainder has the same sign as the dividend (JavaScript %).\r\n // FLOOR 3 The remainder has the same sign as the divisor (Python %).\r\n // HALF_EVEN 6 The IEEE 754 remainder function.\r\n // EUCLID 9 Euclidian division. q = sign(n) * floor(a / abs(n)). Always positive.\r\n //\r\n // Truncated division (1), floored division (3), the IEEE 754 remainder (6), and Euclidian\r\n // division (9) are commonly used for the modulus operation. The other rounding modes can also\r\n // be used, but they may not give useful results.\r\n modulo: 1, // 0 to 9\r\n\r\n // The exponent value at and beneath which `toString` returns exponential notation.\r\n // JavaScript numbers: -7\r\n toExpNeg: -7, // 0 to -EXP_LIMIT\r\n\r\n // The exponent value at and above which `toString` returns exponential notation.\r\n // JavaScript numbers: 21\r\n toExpPos: 21, // 0 to EXP_LIMIT\r\n\r\n // The minimum exponent value, beneath which underflow to zero occurs.\r\n // JavaScript numbers: -324 (5e-324)\r\n minE: -EXP_LIMIT, // -1 to -EXP_LIMIT\r\n\r\n // The maximum exponent value, above which overflow to Infinity occurs.\r\n // JavaScript numbers: 308 (1.7976931348623157e+308)\r\n maxE: EXP_LIMIT, // 1 to EXP_LIMIT\r\n\r\n // Whether to use cryptographically-secure random number generation, if available.\r\n crypto: false // true/false\r\n },\r\n\r\n\r\n// ----------------------------------- END OF EDITABLE DEFAULTS ------------------------------- //\r\n\r\n\r\n Decimal, LN10, PI, inexact, quadrant,\r\n external = true,\r\n\r\n decimalError = '[DecimalError] ',\r\n invalidArgument = decimalError + 'Invalid argument: ',\r\n precisionLimitExceeded = decimalError + 'Precision limit exceeded',\r\n cryptoUnavailable = decimalError + 'crypto unavailable',\r\n\r\n mathfloor = Math.floor,\r\n mathpow = Math.pow,\r\n\r\n isBinary = /^0b([01]+(\\.[01]*)?|\\.[01]+)(p[+-]?\\d+)?$/i,\r\n isHex = /^0x([0-9a-f]+(\\.[0-9a-f]*)?|\\.[0-9a-f]+)(p[+-]?\\d+)?$/i,\r\n isOctal = /^0o([0-7]+(\\.[0-7]*)?|\\.[0-7]+)(p[+-]?\\d+)?$/i,\r\n isDecimal = /^(\\d+(\\.\\d*)?|\\.\\d+)(e[+-]?\\d+)?$/i,\r\n\r\n BASE = 1e7,\r\n LOG_BASE = 7,\r\n MAX_SAFE_INTEGER = 9007199254740991,\r\n\r\n LN10_PRECISION = ln10.length - 1,\r\n PI_PRECISION = pi.length - 1,\r\n\r\n // Decimal.prototype object\r\n P = {};\r\n\r\n\r\n// Decimal prototype methods\r\n\r\n\r\n/*\r\n * absoluteValue abs\r\n * ceil\r\n * comparedTo cmp\r\n * cosine cos\r\n * cubeRoot cbrt\r\n * decimalPlaces dp\r\n * dividedBy div\r\n * dividedToIntegerBy divToInt\r\n * equals eq\r\n * floor\r\n * greaterThan gt\r\n * greaterThanOrEqualTo gte\r\n * hyperbolicCosine cosh\r\n * hyperbolicSine sinh\r\n * hyperbolicTangent tanh\r\n * inverseCosine acos\r\n * inverseHyperbolicCosine acosh\r\n * inverseHyperbolicSine asinh\r\n * inverseHyperbolicTangent atanh\r\n * inverseSine asin\r\n * inverseTangent atan\r\n * isFinite\r\n * isInteger isInt\r\n * isNaN\r\n * isNegative isNeg\r\n * isPositive isPos\r\n * isZero\r\n * lessThan lt\r\n * lessThanOrEqualTo lte\r\n * logarithm log\r\n * [maximum] [max]\r\n * [minimum] [min]\r\n * minus sub\r\n * modulo mod\r\n * naturalExponential exp\r\n * naturalLogarithm ln\r\n * negated neg\r\n * plus add\r\n * precision sd\r\n * round\r\n * sine sin\r\n * squareRoot sqrt\r\n * tangent tan\r\n * times mul\r\n * toBinary\r\n * toDecimalPlaces toDP\r\n * toExponential\r\n * toFixed\r\n * toFraction\r\n * toHexadecimal toHex\r\n * toNearest\r\n * toNumber\r\n * toOctal\r\n * toPower pow\r\n * toPrecision\r\n * toSignificantDigits toSD\r\n * toString\r\n * truncated trunc\r\n * valueOf toJSON\r\n */\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the absolute value of this Decimal.\r\n *\r\n */\r\nP.absoluteValue = P.abs = function () {\r\n var x = new this.constructor(this);\r\n if (x.s < 0) x.s = 1;\r\n return finalise(x);\r\n};\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the value of this Decimal rounded to a whole number in the\r\n * direction of positive Infinity.\r\n *\r\n */\r\nP.ceil = function () {\r\n return finalise(new this.constructor(this), this.e + 1, 2);\r\n};\r\n\r\n\r\n/*\r\n * Return\r\n * 1 if the value of this Decimal is greater than the value of `y`,\r\n * -1 if the value of this Decimal is less than the value of `y`,\r\n * 0 if they have the same value,\r\n * NaN if the value of either Decimal is NaN.\r\n *\r\n */\r\nP.comparedTo = P.cmp = function (y) {\r\n var i, j, xdL, ydL,\r\n x = this,\r\n xd = x.d,\r\n yd = (y = new x.constructor(y)).d,\r\n xs = x.s,\r\n ys = y.s;\r\n\r\n // Either NaN or ±Infinity?\r\n if (!xd || !yd) {\r\n return !xs || !ys ? NaN : xs !== ys ? xs : xd === yd ? 0 : !xd ^ xs < 0 ? 1 : -1;\r\n }\r\n\r\n // Either zero?\r\n if (!xd[0] || !yd[0]) return xd[0] ? xs : yd[0] ? -ys : 0;\r\n\r\n // Signs differ?\r\n if (xs !== ys) return xs;\r\n\r\n // Compare exponents.\r\n if (x.e !== y.e) return x.e > y.e ^ xs < 0 ? 1 : -1;\r\n\r\n xdL = xd.length;\r\n ydL = yd.length;\r\n\r\n // Compare digit by digit.\r\n for (i = 0, j = xdL < ydL ? xdL : ydL; i < j; ++i) {\r\n if (xd[i] !== yd[i]) return xd[i] > yd[i] ^ xs < 0 ? 1 : -1;\r\n }\r\n\r\n // Compare lengths.\r\n return xdL === ydL ? 0 : xdL > ydL ^ xs < 0 ? 1 : -1;\r\n};\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the cosine of the value in radians of this Decimal.\r\n *\r\n * Domain: [-Infinity, Infinity]\r\n * Range: [-1, 1]\r\n *\r\n * cos(0) = 1\r\n * cos(-0) = 1\r\n * cos(Infinity) = NaN\r\n * cos(-Infinity) = NaN\r\n * cos(NaN) = NaN\r\n *\r\n */\r\nP.cosine = P.cos = function () {\r\n var pr, rm,\r\n x = this,\r\n Ctor = x.constructor;\r\n\r\n if (!x.d) return new Ctor(NaN);\r\n\r\n // cos(0) = cos(-0) = 1\r\n if (!x.d[0]) return new Ctor(1);\r\n\r\n pr = Ctor.precision;\r\n rm = Ctor.rounding;\r\n Ctor.precision = pr + Math.max(x.e, x.sd()) + LOG_BASE;\r\n Ctor.rounding = 1;\r\n\r\n x = cosine(Ctor, toLessThanHalfPi(Ctor, x));\r\n\r\n Ctor.precision = pr;\r\n Ctor.rounding = rm;\r\n\r\n return finalise(quadrant == 2 || quadrant == 3 ? x.neg() : x, pr, rm, true);\r\n};\r\n\r\n\r\n/*\r\n *\r\n * Return a new Decimal whose value is the cube root of the value of this Decimal, rounded to\r\n * `precision` significant digits using rounding mode `rounding`.\r\n *\r\n * cbrt(0) = 0\r\n * cbrt(-0) = -0\r\n * cbrt(1) = 1\r\n * cbrt(-1) = -1\r\n * cbrt(N) = N\r\n * cbrt(-I) = -I\r\n * cbrt(I) = I\r\n *\r\n * Math.cbrt(x) = (x < 0 ? -Math.pow(-x, 1/3) : Math.pow(x, 1/3))\r\n *\r\n */\r\nP.cubeRoot = P.cbrt = function () {\r\n var e, m, n, r, rep, s, sd, t, t3, t3plusx,\r\n x = this,\r\n Ctor = x.constructor;\r\n\r\n if (!x.isFinite() || x.isZero()) return new Ctor(x);\r\n external = false;\r\n\r\n // Initial estimate.\r\n s = x.s * Math.pow(x.s * x, 1 / 3);\r\n\r\n // Math.cbrt underflow/overflow?\r\n // Pass x to Math.pow as integer, then adjust the exponent of the result.\r\n if (!s || Math.abs(s) == 1 / 0) {\r\n n = digitsToString(x.d);\r\n e = x.e;\r\n\r\n // Adjust n exponent so it is a multiple of 3 away from x exponent.\r\n if (s = (e - n.length + 1) % 3) n += (s == 1 || s == -2 ? '0' : '00');\r\n s = Math.pow(n, 1 / 3);\r\n\r\n // Rarely, e may be one less than the result exponent value.\r\n e = mathfloor((e + 1) / 3) - (e % 3 == (e < 0 ? -1 : 2));\r\n\r\n if (s == 1 / 0) {\r\n n = '5e' + e;\r\n } else {\r\n n = s.toExponential();\r\n n = n.slice(0, n.indexOf('e') + 1) + e;\r\n }\r\n\r\n r = new Ctor(n);\r\n r.s = x.s;\r\n } else {\r\n r = new Ctor(s.toString());\r\n }\r\n\r\n sd = (e = Ctor.precision) + 3;\r\n\r\n // Halley's method.\r\n // TODO? Compare Newton's method.\r\n for (;;) {\r\n t = r;\r\n t3 = t.times(t).times(t);\r\n t3plusx = t3.plus(x);\r\n r = divide(t3plusx.plus(x).times(t), t3plusx.plus(t3), sd + 2, 1);\r\n\r\n // TODO? Replace with for-loop and checkRoundingDigits.\r\n if (digitsToString(t.d).slice(0, sd) === (n = digitsToString(r.d)).slice(0, sd)) {\r\n n = n.slice(sd - 3, sd + 1);\r\n\r\n // The 4th rounding digit may be in error by -1 so if the 4 rounding digits are 9999 or 4999\r\n // , i.e. approaching a rounding boundary, continue the iteration.\r\n if (n == '9999' || !rep && n == '4999') {\r\n\r\n // On the first iteration only, check to see if rounding up gives the exact result as the\r\n // nines may infinitely repeat.\r\n if (!rep) {\r\n finalise(t, e + 1, 0);\r\n\r\n if (t.times(t).times(t).eq(x)) {\r\n r = t;\r\n break;\r\n }\r\n }\r\n\r\n sd += 4;\r\n rep = 1;\r\n } else {\r\n\r\n // If the rounding digits are null, 0{0,4} or 50{0,3}, check for an exact result.\r\n // If not, then there are further digits and m will be truthy.\r\n if (!+n || !+n.slice(1) && n.charAt(0) == '5') {\r\n\r\n // Truncate to the first rounding digit.\r\n finalise(r, e + 1, 1);\r\n m = !r.times(r).times(r).eq(x);\r\n }\r\n\r\n break;\r\n }\r\n }\r\n }\r\n\r\n external = true;\r\n\r\n return finalise(r, e, Ctor.rounding, m);\r\n};\r\n\r\n\r\n/*\r\n * Return the number of decimal places of the value of this Decimal.\r\n *\r\n */\r\nP.decimalPlaces = P.dp = function () {\r\n var w,\r\n d = this.d,\r\n n = NaN;\r\n\r\n if (d) {\r\n w = d.length - 1;\r\n n = (w - mathfloor(this.e / LOG_BASE)) * LOG_BASE;\r\n\r\n // Subtract the number of trailing zeros of the last word.\r\n w = d[w];\r\n if (w) for (; w % 10 == 0; w /= 10) n--;\r\n if (n < 0) n = 0;\r\n }\r\n\r\n return n;\r\n};\r\n\r\n\r\n/*\r\n * n / 0 = I\r\n * n / N = N\r\n * n / I = 0\r\n * 0 / n = 0\r\n * 0 / 0 = N\r\n * 0 / N = N\r\n * 0 / I = 0\r\n * N / n = N\r\n * N / 0 = N\r\n * N / N = N\r\n * N / I = N\r\n * I / n = I\r\n * I / 0 = I\r\n * I / N = N\r\n * I / I = N\r\n *\r\n * Return a new Decimal whose value is the value of this Decimal divided by `y`, rounded to\r\n * `precision` significant digits using rounding mode `rounding`.\r\n *\r\n */\r\nP.dividedBy = P.div = function (y) {\r\n return divide(this, new this.constructor(y));\r\n};\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the integer part of dividing the value of this Decimal\r\n * by the value of `y`, rounded to `precision` significant digits using rounding mode `rounding`.\r\n *\r\n */\r\nP.dividedToIntegerBy = P.divToInt = function (y) {\r\n var x = this,\r\n Ctor = x.constructor;\r\n return finalise(divide(x, new Ctor(y), 0, 1, 1), Ctor.precision, Ctor.rounding);\r\n};\r\n\r\n\r\n/*\r\n * Return true if the value of this Decimal is equal to the value of `y`, otherwise return false.\r\n *\r\n */\r\nP.equals = P.eq = function (y) {\r\n return this.cmp(y) === 0;\r\n};\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the value of this Decimal rounded to a whole number in the\r\n * direction of negative Infinity.\r\n *\r\n */\r\nP.floor = function () {\r\n return finalise(new this.constructor(this), this.e + 1, 3);\r\n};\r\n\r\n\r\n/*\r\n * Return true if the value of this Decimal is greater than the value of `y`, otherwise return\r\n * false.\r\n *\r\n */\r\nP.greaterThan = P.gt = function (y) {\r\n return this.cmp(y) > 0;\r\n};\r\n\r\n\r\n/*\r\n * Return true if the value of this Decimal is greater than or equal to the value of `y`,\r\n * otherwise return false.\r\n *\r\n */\r\nP.greaterThanOrEqualTo = P.gte = function (y) {\r\n var k = this.cmp(y);\r\n return k == 1 || k === 0;\r\n};\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the hyperbolic cosine of the value in radians of this\r\n * Decimal.\r\n *\r\n * Domain: [-Infinity, Infinity]\r\n * Range: [1, Infinity]\r\n *\r\n * cosh(x) = 1 + x^2/2! + x^4/4! + x^6/6! + ...\r\n *\r\n * cosh(0) = 1\r\n * cosh(-0) = 1\r\n * cosh(Infinity) = Infinity\r\n * cosh(-Infinity) = Infinity\r\n * cosh(NaN) = NaN\r\n *\r\n * x time taken (ms) result\r\n * 1000 9 9.8503555700852349694e+433\r\n * 10000 25 4.4034091128314607936e+4342\r\n * 100000 171 1.4033316802130615897e+43429\r\n * 1000000 3817 1.5166076984010437725e+434294\r\n * 10000000 abandoned after 2 minute wait\r\n *\r\n * TODO? Compare performance of cosh(x) = 0.5 * (exp(x) + exp(-x))\r\n *\r\n */\r\nP.hyperbolicCosine = P.cosh = function () {\r\n var k, n, pr, rm, len,\r\n x = this,\r\n Ctor = x.constructor,\r\n one = new Ctor(1);\r\n\r\n if (!x.isFinite()) return new Ctor(x.s ? 1 / 0 : NaN);\r\n if (x.isZero()) return one;\r\n\r\n pr = Ctor.precision;\r\n rm = Ctor.rounding;\r\n Ctor.precision = pr + Math.max(x.e, x.sd()) + 4;\r\n Ctor.rounding = 1;\r\n len = x.d.length;\r\n\r\n // Argument reduction: cos(4x) = 1 - 8cos^2(x) + 8cos^4(x) + 1\r\n // i.e. cos(x) = 1 - cos^2(x/4)(8 - 8cos^2(x/4))\r\n\r\n // Estimate the optimum number of times to use the argument reduction.\r\n // TODO? Estimation reused from cosine() and may not be optimal here.\r\n if (len < 32) {\r\n k = Math.ceil(len / 3);\r\n n = Math.pow(4, -k).toString();\r\n } else {\r\n k = 16;\r\n n = '2.3283064365386962890625e-10';\r\n }\r\n\r\n x = taylorSeries(Ctor, 1, x.times(n), new Ctor(1), true);\r\n\r\n // Reverse argument reduction\r\n var cosh2_x,\r\n i = k,\r\n d8 = new Ctor(8);\r\n for (; i--;) {\r\n cosh2_x = x.times(x);\r\n x = one.minus(cosh2_x.times(d8.minus(cosh2_x.times(d8))));\r\n }\r\n\r\n return finalise(x, Ctor.precision = pr, Ctor.rounding = rm, true);\r\n};\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the hyperbolic sine of the value in radians of this\r\n * Decimal.\r\n *\r\n * Domain: [-Infinity, Infinity]\r\n * Range: [-Infinity, Infinity]\r\n *\r\n * sinh(x) = x + x^3/3! + x^5/5! + x^7/7! + ...\r\n *\r\n * sinh(0) = 0\r\n * sinh(-0) = -0\r\n * sinh(Infinity) = Infinity\r\n * sinh(-Infinity) = -Infinity\r\n * sinh(NaN) = NaN\r\n *\r\n * x time taken (ms)\r\n * 10 2 ms\r\n * 100 5 ms\r\n * 1000 14 ms\r\n * 10000 82 ms\r\n * 100000 886 ms 1.4033316802130615897e+43429\r\n * 200000 2613 ms\r\n * 300000 5407 ms\r\n * 400000 8824 ms\r\n * 500000 13026 ms 8.7080643612718084129e+217146\r\n * 1000000 48543 ms\r\n *\r\n * TODO? Compare performance of sinh(x) = 0.5 * (exp(x) - exp(-x))\r\n *\r\n */\r\nP.hyperbolicSine = P.sinh = function () {\r\n var k, pr, rm, len,\r\n x = this,\r\n Ctor = x.constructor;\r\n\r\n if (!x.isFinite() || x.isZero()) return new Ctor(x);\r\n\r\n pr = Ctor.precision;\r\n rm = Ctor.rounding;\r\n Ctor.precision = pr + Math.max(x.e, x.sd()) + 4;\r\n Ctor.rounding = 1;\r\n len = x.d.length;\r\n\r\n if (len < 3) {\r\n x = taylorSeries(Ctor, 2, x, x, true);\r\n } else {\r\n\r\n // Alternative argument reduction: sinh(3x) = sinh(x)(3 + 4sinh^2(x))\r\n // i.e. sinh(x) = sinh(x/3)(3 + 4sinh^2(x/3))\r\n // 3 multiplications and 1 addition\r\n\r\n // Argument reduction: sinh(5x) = sinh(x)(5 + sinh^2(x)(20 + 16sinh^2(x)))\r\n // i.e. sinh(x) = sinh(x/5)(5 + sinh^2(x/5)(20 + 16sinh^2(x/5)))\r\n // 4 multiplications and 2 additions\r\n\r\n // Estimate the optimum number of times to use the argument reduction.\r\n k = 1.4 * Math.sqrt(len);\r\n k = k > 16 ? 16 : k | 0;\r\n\r\n x = x.times(Math.pow(5, -k));\r\n\r\n x = taylorSeries(Ctor, 2, x, x, true);\r\n\r\n // Reverse argument reduction\r\n var sinh2_x,\r\n d5 = new Ctor(5),\r\n d16 = new Ctor(16),\r\n d20 = new Ctor(20);\r\n for (; k--;) {\r\n sinh2_x = x.times(x);\r\n x = x.times(d5.plus(sinh2_x.times(d16.times(sinh2_x).plus(d20))));\r\n }\r\n }\r\n\r\n Ctor.precision = pr;\r\n Ctor.rounding = rm;\r\n\r\n return finalise(x, pr, rm, true);\r\n};\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the hyperbolic tangent of the value in radians of this\r\n * Decimal.\r\n *\r\n * Domain: [-Infinity, Infinity]\r\n * Range: [-1, 1]\r\n *\r\n * tanh(x) = sinh(x) / cosh(x)\r\n *\r\n * tanh(0) = 0\r\n * tanh(-0) = -0\r\n * tanh(Infinity) = 1\r\n * tanh(-Infinity) = -1\r\n * tanh(NaN) = NaN\r\n *\r\n */\r\nP.hyperbolicTangent = P.tanh = function () {\r\n var pr, rm,\r\n x = this,\r\n Ctor = x.constructor;\r\n\r\n if (!x.isFinite()) return new Ctor(x.s);\r\n if (x.isZero()) return new Ctor(x);\r\n\r\n pr = Ctor.precision;\r\n rm = Ctor.rounding;\r\n Ctor.precision = pr + 7;\r\n Ctor.rounding = 1;\r\n\r\n return divide(x.sinh(), x.cosh(), Ctor.precision = pr, Ctor.rounding = rm);\r\n};\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the arccosine (inverse cosine) in radians of the value of\r\n * this Decimal.\r\n *\r\n * Domain: [-1, 1]\r\n * Range: [0, pi]\r\n *\r\n * acos(x) = pi/2 - asin(x)\r\n *\r\n * acos(0) = pi/2\r\n * acos(-0) = pi/2\r\n * acos(1) = 0\r\n * acos(-1) = pi\r\n * acos(1/2) = pi/3\r\n * acos(-1/2) = 2*pi/3\r\n * acos(|x| > 1) = NaN\r\n * acos(NaN) = NaN\r\n *\r\n */\r\nP.inverseCosine = P.acos = function () {\r\n var halfPi,\r\n x = this,\r\n Ctor = x.constructor,\r\n k = x.abs().cmp(1),\r\n pr = Ctor.precision,\r\n rm = Ctor.rounding;\r\n\r\n if (k !== -1) {\r\n return k === 0\r\n // |x| is 1\r\n ? x.isNeg() ? getPi(Ctor, pr, rm) : new Ctor(0)\r\n // |x| > 1 or x is NaN\r\n : new Ctor(NaN);\r\n }\r\n\r\n if (x.isZero()) return getPi(Ctor, pr + 4, rm).times(0.5);\r\n\r\n // TODO? Special case acos(0.5) = pi/3 and acos(-0.5) = 2*pi/3\r\n\r\n Ctor.precision = pr + 6;\r\n Ctor.rounding = 1;\r\n\r\n x = x.asin();\r\n halfPi = getPi(Ctor, pr + 4, rm).times(0.5);\r\n\r\n Ctor.precision = pr;\r\n Ctor.rounding = rm;\r\n\r\n return halfPi.minus(x);\r\n};\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the inverse of the hyperbolic cosine in radians of the\r\n * value of this Decimal.\r\n *\r\n * Domain: [1, Infinity]\r\n * Range: [0, Infinity]\r\n *\r\n * acosh(x) = ln(x + sqrt(x^2 - 1))\r\n *\r\n * acosh(x < 1) = NaN\r\n * acosh(NaN) = NaN\r\n * acosh(Infinity) = Infinity\r\n * acosh(-Infinity) = NaN\r\n * acosh(0) = NaN\r\n * acosh(-0) = NaN\r\n * acosh(1) = 0\r\n * acosh(-1) = NaN\r\n *\r\n */\r\nP.inverseHyperbolicCosine = P.acosh = function () {\r\n var pr, rm,\r\n x = this,\r\n Ctor = x.constructor;\r\n\r\n if (x.lte(1)) return new Ctor(x.eq(1) ? 0 : NaN);\r\n if (!x.isFinite()) return new Ctor(x);\r\n\r\n pr = Ctor.precision;\r\n rm = Ctor.rounding;\r\n Ctor.precision = pr + Math.max(Math.abs(x.e), x.sd()) + 4;\r\n Ctor.rounding = 1;\r\n external = false;\r\n\r\n x = x.times(x).minus(1).sqrt().plus(x);\r\n\r\n external = true;\r\n Ctor.precision = pr;\r\n Ctor.rounding = rm;\r\n\r\n return x.ln();\r\n};\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the inverse of the hyperbolic sine in radians of the value\r\n * of this Decimal.\r\n *\r\n * Domain: [-Infinity, Infinity]\r\n * Range: [-Infinity, Infinity]\r\n *\r\n * asinh(x) = ln(x + sqrt(x^2 + 1))\r\n *\r\n * asinh(NaN) = NaN\r\n * asinh(Infinity) = Infinity\r\n * asinh(-Infinity) = -Infinity\r\n * asinh(0) = 0\r\n * asinh(-0) = -0\r\n *\r\n */\r\nP.inverseHyperbolicSine = P.asinh = function () {\r\n var pr, rm,\r\n x = this,\r\n Ctor = x.constructor;\r\n\r\n if (!x.isFinite() || x.isZero()) return new Ctor(x);\r\n\r\n pr = Ctor.precision;\r\n rm = Ctor.rounding;\r\n Ctor.precision = pr + 2 * Math.max(Math.abs(x.e), x.sd()) + 6;\r\n Ctor.rounding = 1;\r\n external = false;\r\n\r\n x = x.times(x).plus(1).sqrt().plus(x);\r\n\r\n external = true;\r\n Ctor.precision = pr;\r\n Ctor.rounding = rm;\r\n\r\n return x.ln();\r\n};\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the inverse of the hyperbolic tangent in radians of the\r\n * value of this Decimal.\r\n *\r\n * Domain: [-1, 1]\r\n * Range: [-Infinity, Infinity]\r\n *\r\n * atanh(x) = 0.5 * ln((1 + x) / (1 - x))\r\n *\r\n * atanh(|x| > 1) = NaN\r\n * atanh(NaN) = NaN\r\n * atanh(Infinity) = NaN\r\n * atanh(-Infinity) = NaN\r\n * atanh(0) = 0\r\n * atanh(-0) = -0\r\n * atanh(1) = Infinity\r\n * atanh(-1) = -Infinity\r\n *\r\n */\r\nP.inverseHyperbolicTangent = P.atanh = function () {\r\n var pr, rm, wpr, xsd,\r\n x = this,\r\n Ctor = x.constructor;\r\n\r\n if (!x.isFinite()) return new Ctor(NaN);\r\n if (x.e >= 0) return new Ctor(x.abs().eq(1) ? x.s / 0 : x.isZero() ? x : NaN);\r\n\r\n pr = Ctor.precision;\r\n rm = Ctor.rounding;\r\n xsd = x.sd();\r\n\r\n if (Math.max(xsd, pr) < 2 * -x.e - 1) return finalise(new Ctor(x), pr, rm, true);\r\n\r\n Ctor.precision = wpr = xsd - x.e;\r\n\r\n x = divide(x.plus(1), new Ctor(1).minus(x), wpr + pr, 1);\r\n\r\n Ctor.precision = pr + 4;\r\n Ctor.rounding = 1;\r\n\r\n x = x.ln();\r\n\r\n Ctor.precision = pr;\r\n Ctor.rounding = rm;\r\n\r\n return x.times(0.5);\r\n};\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the arcsine (inverse sine) in radians of the value of this\r\n * Decimal.\r\n *\r\n * Domain: [-Infinity, Infinity]\r\n * Range: [-pi/2, pi/2]\r\n *\r\n * asin(x) = 2*atan(x/(1 + sqrt(1 - x^2)))\r\n *\r\n * asin(0) = 0\r\n * asin(-0) = -0\r\n * asin(1/2) = pi/6\r\n * asin(-1/2) = -pi/6\r\n * asin(1) = pi/2\r\n * asin(-1) = -pi/2\r\n * asin(|x| > 1) = NaN\r\n * asin(NaN) = NaN\r\n *\r\n * TODO? Compare performance of Taylor series.\r\n *\r\n */\r\nP.inverseSine = P.asin = function () {\r\n var halfPi, k,\r\n pr, rm,\r\n x = this,\r\n Ctor = x.constructor;\r\n\r\n if (x.isZero()) return new Ctor(x);\r\n\r\n k = x.abs().cmp(1);\r\n pr = Ctor.precision;\r\n rm = Ctor.rounding;\r\n\r\n if (k !== -1) {\r\n\r\n // |x| is 1\r\n if (k === 0) {\r\n halfPi = getPi(Ctor, pr + 4, rm).times(0.5);\r\n halfPi.s = x.s;\r\n return halfPi;\r\n }\r\n\r\n // |x| > 1 or x is NaN\r\n return new Ctor(NaN);\r\n }\r\n\r\n // TODO? Special case asin(1/2) = pi/6 and asin(-1/2) = -pi/6\r\n\r\n Ctor.precision = pr + 6;\r\n Ctor.rounding = 1;\r\n\r\n x = x.div(new Ctor(1).minus(x.times(x)).sqrt().plus(1)).atan();\r\n\r\n Ctor.precision = pr;\r\n Ctor.rounding = rm;\r\n\r\n return x.times(2);\r\n};\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the arctangent (inverse tangent) in radians of the value\r\n * of this Decimal.\r\n *\r\n * Domain: [-Infinity, Infinity]\r\n * Range: [-pi/2, pi/2]\r\n *\r\n * atan(x) = x - x^3/3 + x^5/5 - x^7/7 + ...\r\n *\r\n * atan(0) = 0\r\n * atan(-0) = -0\r\n * atan(1) = pi/4\r\n * atan(-1) = -pi/4\r\n * atan(Infinity) = pi/2\r\n * atan(-Infinity) = -pi/2\r\n * atan(NaN) = NaN\r\n *\r\n */\r\nP.inverseTangent = P.atan = function () {\r\n var i, j, k, n, px, t, r, wpr, x2,\r\n x = this,\r\n Ctor = x.constructor,\r\n pr = Ctor.precision,\r\n rm = Ctor.rounding;\r\n\r\n if (!x.isFinite()) {\r\n if (!x.s) return new Ctor(NaN);\r\n if (pr + 4 <= PI_PRECISION) {\r\n r = getPi(Ctor, pr + 4, rm).times(0.5);\r\n r.s = x.s;\r\n return r;\r\n }\r\n } else if (x.isZero()) {\r\n return new Ctor(x);\r\n } else if (x.abs().eq(1) && pr + 4 <= PI_PRECISION) {\r\n r = getPi(Ctor, pr + 4, rm).times(0.25);\r\n r.s = x.s;\r\n return r;\r\n }\r\n\r\n Ctor.precision = wpr = pr + 10;\r\n Ctor.rounding = 1;\r\n\r\n // TODO? if (x >= 1 && pr <= PI_PRECISION) atan(x) = halfPi * x.s - atan(1 / x);\r\n\r\n // Argument reduction\r\n // Ensure |x| < 0.42\r\n // atan(x) = 2 * atan(x / (1 + sqrt(1 + x^2)))\r\n\r\n k = Math.min(28, wpr / LOG_BASE + 2 | 0);\r\n\r\n for (i = k; i; --i) x = x.div(x.times(x).plus(1).sqrt().plus(1));\r\n\r\n external = false;\r\n\r\n j = Math.ceil(wpr / LOG_BASE);\r\n n = 1;\r\n x2 = x.times(x);\r\n r = new Ctor(x);\r\n px = x;\r\n\r\n // atan(x) = x - x^3/3 + x^5/5 - x^7/7 + ...\r\n for (; i !== -1;) {\r\n px = px.times(x2);\r\n t = r.minus(px.div(n += 2));\r\n\r\n px = px.times(x2);\r\n r = t.plus(px.div(n += 2));\r\n\r\n if (r.d[j] !== void 0) for (i = j; r.d[i] === t.d[i] && i--;);\r\n }\r\n\r\n if (k) r = r.times(2 << (k - 1));\r\n\r\n external = true;\r\n\r\n return finalise(r, Ctor.precision = pr, Ctor.rounding = rm, true);\r\n};\r\n\r\n\r\n/*\r\n * Return true if the value of this Decimal is a finite number, otherwise return false.\r\n *\r\n */\r\nP.isFinite = function () {\r\n return !!this.d;\r\n};\r\n\r\n\r\n/*\r\n * Return true if the value of this Decimal is an integer, otherwise return false.\r\n *\r\n */\r\nP.isInteger = P.isInt = function () {\r\n return !!this.d && mathfloor(this.e / LOG_BASE) > this.d.length - 2;\r\n};\r\n\r\n\r\n/*\r\n * Return true if the value of this Decimal is NaN, otherwise return false.\r\n *\r\n */\r\nP.isNaN = function () {\r\n return !this.s;\r\n};\r\n\r\n\r\n/*\r\n * Return true if the value of this Decimal is negative, otherwise return false.\r\n *\r\n */\r\nP.isNegative = P.isNeg = function () {\r\n return this.s < 0;\r\n};\r\n\r\n\r\n/*\r\n * Return true if the value of this Decimal is positive, otherwise return false.\r\n *\r\n */\r\nP.isPositive = P.isPos = function () {\r\n return this.s > 0;\r\n};\r\n\r\n\r\n/*\r\n * Return true if the value of this Decimal is 0 or -0, otherwise return false.\r\n *\r\n */\r\nP.isZero = function () {\r\n return !!this.d && this.d[0] === 0;\r\n};\r\n\r\n\r\n/*\r\n * Return true if the value of this Decimal is less than `y`, otherwise return false.\r\n *\r\n */\r\nP.lessThan = P.lt = function (y) {\r\n return this.cmp(y) < 0;\r\n};\r\n\r\n\r\n/*\r\n * Return true if the value of this Decimal is less than or equal to `y`, otherwise return false.\r\n *\r\n */\r\nP.lessThanOrEqualTo = P.lte = function (y) {\r\n return this.cmp(y) < 1;\r\n};\r\n\r\n\r\n/*\r\n * Return the logarithm of the value of this Decimal to the specified base, rounded to `precision`\r\n * significant digits using rounding mode `rounding`.\r\n *\r\n * If no base is specified, return log[10](arg).\r\n *\r\n * log[base](arg) = ln(arg) / ln(base)\r\n *\r\n * The result will always be correctly rounded if the base of the log is 10, and 'almost always'\r\n * otherwise:\r\n *\r\n * Depending on the rounding mode, the result may be incorrectly rounded if the first fifteen\r\n * rounding digits are [49]99999999999999 or [50]00000000000000. In that case, the maximum error\r\n * between the result and the correctly rounded result will be one ulp (unit in the last place).\r\n *\r\n * log[-b](a) = NaN\r\n * log[0](a) = NaN\r\n * log[1](a) = NaN\r\n * log[NaN](a) = NaN\r\n * log[Infinity](a) = NaN\r\n * log[b](0) = -Infinity\r\n * log[b](-0) = -Infinity\r\n * log[b](-a) = NaN\r\n * log[b](1) = 0\r\n * log[b](Infinity) = Infinity\r\n * log[b](NaN) = NaN\r\n *\r\n * [base] {number|string|Decimal} The base of the logarithm.\r\n *\r\n */\r\nP.logarithm = P.log = function (base) {\r\n var isBase10, d, denominator, k, inf, num, sd, r,\r\n arg = this,\r\n Ctor = arg.constructor,\r\n pr = Ctor.precision,\r\n rm = Ctor.rounding,\r\n guard = 5;\r\n\r\n // Default base is 10.\r\n if (base == null) {\r\n base = new Ctor(10);\r\n isBase10 = true;\r\n } else {\r\n base = new Ctor(base);\r\n d = base.d;\r\n\r\n // Return NaN if base is negative, or non-finite, or is 0 or 1.\r\n if (base.s < 0 || !d || !d[0] || base.eq(1)) return new Ctor(NaN);\r\n\r\n isBase10 = base.eq(10);\r\n }\r\n\r\n d = arg.d;\r\n\r\n // Is arg negative, non-finite, 0 or 1?\r\n if (arg.s < 0 || !d || !d[0] || arg.eq(1)) {\r\n return new Ctor(d && !d[0] ? -1 / 0 : arg.s != 1 ? NaN : d ? 0 : 1 / 0);\r\n }\r\n\r\n // The result will have a non-terminating decimal expansion if base is 10 and arg is not an\r\n // integer power of 10.\r\n if (isBase10) {\r\n if (d.length > 1) {\r\n inf = true;\r\n } else {\r\n for (k = d[0]; k % 10 === 0;) k /= 10;\r\n inf = k !== 1;\r\n }\r\n }\r\n\r\n external = false;\r\n sd = pr + guard;\r\n num = naturalLogarithm(arg, sd);\r\n denominator = isBase10 ? getLn10(Ctor, sd + 10) : naturalLogarithm(base, sd);\r\n\r\n // The result will have 5 rounding digits.\r\n r = divide(num, denominator, sd, 1);\r\n\r\n // If at a rounding boundary, i.e. the result's rounding digits are [49]9999 or [50]0000,\r\n // calculate 10 further digits.\r\n //\r\n // If the result is known to have an infinite decimal expansion, repeat this until it is clear\r\n // that the result is above or below the boundary. Otherwise, if after calculating the 10\r\n // further digits, the last 14 are nines, round up and assume the result is exact.\r\n // Also assume the result is exact if the last 14 are zero.\r\n //\r\n // Example of a result that will be incorrectly rounded:\r\n // log[1048576](4503599627370502) = 2.60000000000000009610279511444746...\r\n // The above result correctly rounded using ROUND_CEIL to 1 decimal place should be 2.7, but it\r\n // will be given as 2.6 as there are 15 zeros immediately after the requested decimal place, so\r\n // the exact result would be assumed to be 2.6, which rounded using ROUND_CEIL to 1 decimal\r\n // place is still 2.6.\r\n if (checkRoundingDigits(r.d, k = pr, rm)) {\r\n\r\n do {\r\n sd += 10;\r\n num = naturalLogarithm(arg, sd);\r\n denominator = isBase10 ? getLn10(Ctor, sd + 10) : naturalLogarithm(base, sd);\r\n r = divide(num, denominator, sd, 1);\r\n\r\n if (!inf) {\r\n\r\n // Check for 14 nines from the 2nd rounding digit, as the first may be 4.\r\n if (+digitsToString(r.d).slice(k + 1, k + 15) + 1 == 1e14) {\r\n r = finalise(r, pr + 1, 0);\r\n }\r\n\r\n break;\r\n }\r\n } while (checkRoundingDigits(r.d, k += 10, rm));\r\n }\r\n\r\n external = true;\r\n\r\n return finalise(r, pr, rm);\r\n};\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the maximum of the arguments and the value of this Decimal.\r\n *\r\n * arguments {number|string|Decimal}\r\n *\r\nP.max = function () {\r\n Array.prototype.push.call(arguments, this);\r\n return maxOrMin(this.constructor, arguments, 'lt');\r\n};\r\n */\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the minimum of the arguments and the value of this Decimal.\r\n *\r\n * arguments {number|string|Decimal}\r\n *\r\nP.min = function () {\r\n Array.prototype.push.call(arguments, this);\r\n return maxOrMin(this.constructor, arguments, 'gt');\r\n};\r\n */\r\n\r\n\r\n/*\r\n * n - 0 = n\r\n * n - N = N\r\n * n - I = -I\r\n * 0 - n = -n\r\n * 0 - 0 = 0\r\n * 0 - N = N\r\n * 0 - I = -I\r\n * N - n = N\r\n * N - 0 = N\r\n * N - N = N\r\n * N - I = N\r\n * I - n = I\r\n * I - 0 = I\r\n * I - N = N\r\n * I - I = N\r\n *\r\n * Return a new Decimal whose value is the value of this Decimal minus `y`, rounded to `precision`\r\n * significant digits using rounding mode `rounding`.\r\n *\r\n */\r\nP.minus = P.sub = function (y) {\r\n var d, e, i, j, k, len, pr, rm, xd, xe, xLTy, yd,\r\n x = this,\r\n Ctor = x.constructor;\r\n\r\n y = new Ctor(y);\r\n\r\n // If either is not finite...\r\n if (!x.d || !y.d) {\r\n\r\n // Return NaN if either is NaN.\r\n if (!x.s || !y.s) y = new Ctor(NaN);\r\n\r\n // Return y negated if x is finite and y is ±Infinity.\r\n else if (x.d) y.s = -y.s;\r\n\r\n // Return x if y is finite and x is ±Infinity.\r\n // Return x if both are ±Infinity with different signs.\r\n // Return NaN if both are ±Infinity with the same sign.\r\n else y = new Ctor(y.d || x.s !== y.s ? x : NaN);\r\n\r\n return y;\r\n }\r\n\r\n // If signs differ...\r\n if (x.s != y.s) {\r\n y.s = -y.s;\r\n return x.plus(y);\r\n }\r\n\r\n xd = x.d;\r\n yd = y.d;\r\n pr = Ctor.precision;\r\n rm = Ctor.rounding;\r\n\r\n // If either is zero...\r\n if (!xd[0] || !yd[0]) {\r\n\r\n // Return y negated if x is zero and y is non-zero.\r\n if (yd[0]) y.s = -y.s;\r\n\r\n // Return x if y is zero and x is non-zero.\r\n else if (xd[0]) y = new Ctor(x);\r\n\r\n // Return zero if both are zero.\r\n // From IEEE 754 (2008) 6.3: 0 - 0 = -0 - -0 = -0 when rounding to -Infinity.\r\n else return new Ctor(rm === 3 ? -0 : 0);\r\n\r\n return external ? finalise(y, pr, rm) : y;\r\n }\r\n\r\n // x and y are finite, non-zero numbers with the same sign.\r\n\r\n // Calculate base 1e7 exponents.\r\n e = mathfloor(y.e / LOG_BASE);\r\n xe = mathfloor(x.e / LOG_BASE);\r\n\r\n xd = xd.slice();\r\n k = xe - e;\r\n\r\n // If base 1e7 exponents differ...\r\n if (k) {\r\n xLTy = k < 0;\r\n\r\n if (xLTy) {\r\n d = xd;\r\n k = -k;\r\n len = yd.length;\r\n } else {\r\n d = yd;\r\n e = xe;\r\n len = xd.length;\r\n }\r\n\r\n // Numbers with massively different exponents would result in a very high number of\r\n // zeros needing to be prepended, but this can be avoided while still ensuring correct\r\n // rounding by limiting the number of zeros to `Math.ceil(pr / LOG_BASE) + 2`.\r\n i = Math.max(Math.ceil(pr / LOG_BASE), len) + 2;\r\n\r\n if (k > i) {\r\n k = i;\r\n d.length = 1;\r\n }\r\n\r\n // Prepend zeros to equalise exponents.\r\n d.reverse();\r\n for (i = k; i--;) d.push(0);\r\n d.reverse();\r\n\r\n // Base 1e7 exponents equal.\r\n } else {\r\n\r\n // Check digits to determine which is the bigger number.\r\n\r\n i = xd.length;\r\n len = yd.length;\r\n xLTy = i < len;\r\n if (xLTy) len = i;\r\n\r\n for (i = 0; i < len; i++) {\r\n if (xd[i] != yd[i]) {\r\n xLTy = xd[i] < yd[i];\r\n break;\r\n }\r\n }\r\n\r\n k = 0;\r\n }\r\n\r\n if (xLTy) {\r\n d = xd;\r\n xd = yd;\r\n yd = d;\r\n y.s = -y.s;\r\n }\r\n\r\n len = xd.length;\r\n\r\n // Append zeros to `xd` if shorter.\r\n // Don't add zeros to `yd` if shorter as subtraction only needs to start at `yd` length.\r\n for (i = yd.length - len; i > 0; --i) xd[len++] = 0;\r\n\r\n // Subtract yd from xd.\r\n for (i = yd.length; i > k;) {\r\n\r\n if (xd[--i] < yd[i]) {\r\n for (j = i; j && xd[--j] === 0;) xd[j] = BASE - 1;\r\n --xd[j];\r\n xd[i] += BASE;\r\n }\r\n\r\n xd[i] -= yd[i];\r\n }\r\n\r\n // Remove trailing zeros.\r\n for (; xd[--len] === 0;) xd.pop();\r\n\r\n // Remove leading zeros and adjust exponent accordingly.\r\n for (; xd[0] === 0; xd.shift()) --e;\r\n\r\n // Zero?\r\n if (!xd[0]) return new Ctor(rm === 3 ? -0 : 0);\r\n\r\n y.d = xd;\r\n y.e = getBase10Exponent(xd, e);\r\n\r\n return external ? finalise(y, pr, rm) : y;\r\n};\r\n\r\n\r\n/*\r\n * n % 0 = N\r\n * n % N = N\r\n * n % I = n\r\n * 0 % n = 0\r\n * -0 % n = -0\r\n * 0 % 0 = N\r\n * 0 % N = N\r\n * 0 % I = 0\r\n * N % n = N\r\n * N % 0 = N\r\n * N % N = N\r\n * N % I = N\r\n * I % n = N\r\n * I % 0 = N\r\n * I % N = N\r\n * I % I = N\r\n *\r\n * Return a new Decimal whose value is the value of this Decimal modulo `y`, rounded to\r\n * `precision` significant digits using rounding mode `rounding`.\r\n *\r\n * The result depends on the modulo mode.\r\n *\r\n */\r\nP.modulo = P.mod = function (y) {\r\n var q,\r\n x = this,\r\n Ctor = x.constructor;\r\n\r\n y = new Ctor(y);\r\n\r\n // Return NaN if x is ±Infinity or NaN, or y is NaN or ±0.\r\n if (!x.d || !y.s || y.d && !y.d[0]) return new Ctor(NaN);\r\n\r\n // Return x if y is ±Infinity or x is ±0.\r\n if (!y.d || x.d && !x.d[0]) {\r\n return finalise(new Ctor(x), Ctor.precision, Ctor.rounding);\r\n }\r\n\r\n // Prevent rounding of intermediate calculations.\r\n external = false;\r\n\r\n if (Ctor.modulo == 9) {\r\n\r\n // Euclidian division: q = sign(y) * floor(x / abs(y))\r\n // result = x - q * y where 0 <= result < abs(y)\r\n q = divide(x, y.abs(), 0, 3, 1);\r\n q.s *= y.s;\r\n } else {\r\n q = divide(x, y, 0, Ctor.modulo, 1);\r\n }\r\n\r\n q = q.times(y);\r\n\r\n external = true;\r\n\r\n return x.minus(q);\r\n};\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the natural exponential of the value of this Decimal,\r\n * i.e. the base e raised to the power the value of this Decimal, rounded to `precision`\r\n * significant digits using rounding mode `rounding`.\r\n *\r\n */\r\nP.naturalExponential = P.exp = function () {\r\n return naturalExponential(this);\r\n};\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the natural logarithm of the value of this Decimal,\r\n * rounded to `precision` significant digits using rounding mode `rounding`.\r\n *\r\n */\r\nP.naturalLogarithm = P.ln = function () {\r\n return naturalLogarithm(this);\r\n};\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the value of this Decimal negated, i.e. as if multiplied by\r\n * -1.\r\n *\r\n */\r\nP.negated = P.neg = function () {\r\n var x = new this.constructor(this);\r\n x.s = -x.s;\r\n return finalise(x);\r\n};\r\n\r\n\r\n/*\r\n * n + 0 = n\r\n * n + N = N\r\n * n + I = I\r\n * 0 + n = n\r\n * 0 + 0 = 0\r\n * 0 + N = N\r\n * 0 + I = I\r\n * N + n = N\r\n * N + 0 = N\r\n * N + N = N\r\n * N + I = N\r\n * I + n = I\r\n * I + 0 = I\r\n * I + N = N\r\n * I + I = I\r\n *\r\n * Return a new Decimal whose value is the value of this Decimal plus `y`, rounded to `precision`\r\n * significant digits using rounding mode `rounding`.\r\n *\r\n */\r\nP.plus = P.add = function (y) {\r\n var carry, d, e, i, k, len, pr, rm, xd, yd,\r\n x = this,\r\n Ctor = x.constructor;\r\n\r\n y = new Ctor(y);\r\n\r\n // If either is not finite...\r\n if (!x.d || !y.d) {\r\n\r\n // Return NaN if either is NaN.\r\n if (!x.s || !y.s) y = new Ctor(NaN);\r\n\r\n // Return x if y is finite and x is ±Infinity.\r\n // Return x if both are ±Infinity with the same sign.\r\n // Return NaN if both are ±Infinity with different signs.\r\n // Return y if x is finite and y is ±Infinity.\r\n else if (!x.d) y = new Ctor(y.d || x.s === y.s ? x : NaN);\r\n\r\n return y;\r\n }\r\n\r\n // If signs differ...\r\n if (x.s != y.s) {\r\n y.s = -y.s;\r\n return x.minus(y);\r\n }\r\n\r\n xd = x.d;\r\n yd = y.d;\r\n pr = Ctor.precision;\r\n rm = Ctor.rounding;\r\n\r\n // If either is zero...\r\n if (!xd[0] || !yd[0]) {\r\n\r\n // Return x if y is zero.\r\n // Return y if y is non-zero.\r\n if (!yd[0]) y = new Ctor(x);\r\n\r\n return external ? finalise(y, pr, rm) : y;\r\n }\r\n\r\n // x and y are finite, non-zero numbers with the same sign.\r\n\r\n // Calculate base 1e7 exponents.\r\n k = mathfloor(x.e / LOG_BASE);\r\n e = mathfloor(y.e / LOG_BASE);\r\n\r\n xd = xd.slice();\r\n i = k - e;\r\n\r\n // If base 1e7 exponents differ...\r\n if (i) {\r\n\r\n if (i < 0) {\r\n d = xd;\r\n i = -i;\r\n len = yd.length;\r\n } else {\r\n d = yd;\r\n e = k;\r\n len = xd.length;\r\n }\r\n\r\n // Limit number of zeros prepended to max(ceil(pr / LOG_BASE), len) + 1.\r\n k = Math.ceil(pr / LOG_BASE);\r\n len = k > len ? k + 1 : len + 1;\r\n\r\n if (i > len) {\r\n i = len;\r\n d.length = 1;\r\n }\r\n\r\n // Prepend zeros to equalise exponents. Note: Faster to use reverse then do unshifts.\r\n d.reverse();\r\n for (; i--;) d.push(0);\r\n d.reverse();\r\n }\r\n\r\n len = xd.length;\r\n i = yd.length;\r\n\r\n // If yd is longer than xd, swap xd and yd so xd points to the longer array.\r\n if (len - i < 0) {\r\n i = len;\r\n d = yd;\r\n yd = xd;\r\n xd = d;\r\n }\r\n\r\n // Only start adding at yd.length - 1 as the further digits of xd can be left as they are.\r\n for (carry = 0; i;) {\r\n carry = (xd[--i] = xd[i] + yd[i] + carry) / BASE | 0;\r\n xd[i] %= BASE;\r\n }\r\n\r\n if (carry) {\r\n xd.unshift(carry);\r\n ++e;\r\n }\r\n\r\n // Remove trailing zeros.\r\n // No need to check for zero, as +x + +y != 0 && -x + -y != 0\r\n for (len = xd.length; xd[--len] == 0;) xd.pop();\r\n\r\n y.d = xd;\r\n y.e = getBase10Exponent(xd, e);\r\n\r\n return external ? finalise(y, pr, rm) : y;\r\n};\r\n\r\n\r\n/*\r\n * Return the number of significant digits of the value of this Decimal.\r\n *\r\n * [z] {boolean|number} Whether to count integer-part trailing zeros: true, false, 1 or 0.\r\n *\r\n */\r\nP.precision = P.sd = function (z) {\r\n var k,\r\n x = this;\r\n\r\n if (z !== void 0 && z !== !!z && z !== 1 && z !== 0) throw Error(invalidArgument + z);\r\n\r\n if (x.d) {\r\n k = getPrecision(x.d);\r\n if (z && x.e + 1 > k) k = x.e + 1;\r\n } else {\r\n k = NaN;\r\n }\r\n\r\n return k;\r\n};\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the value of this Decimal rounded to a whole number using\r\n * rounding mode `rounding`.\r\n *\r\n */\r\nP.round = function () {\r\n var x = this,\r\n Ctor = x.constructor;\r\n\r\n return finalise(new Ctor(x), x.e + 1, Ctor.rounding);\r\n};\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the sine of the value in radians of this Decimal.\r\n *\r\n * Domain: [-Infinity, Infinity]\r\n * Range: [-1, 1]\r\n *\r\n * sin(x) = x - x^3/3! + x^5/5! - ...\r\n *\r\n * sin(0) = 0\r\n * sin(-0) = -0\r\n * sin(Infinity) = NaN\r\n * sin(-Infinity) = NaN\r\n * sin(NaN) = NaN\r\n *\r\n */\r\nP.sine = P.sin = function () {\r\n var pr, rm,\r\n x = this,\r\n Ctor = x.constructor;\r\n\r\n if (!x.isFinite()) return new Ctor(NaN);\r\n if (x.isZero()) return new Ctor(x);\r\n\r\n pr = Ctor.precision;\r\n rm = Ctor.rounding;\r\n Ctor.precision = pr + Math.max(x.e, x.sd()) + LOG_BASE;\r\n Ctor.rounding = 1;\r\n\r\n x = sine(Ctor, toLessThanHalfPi(Ctor, x));\r\n\r\n Ctor.precision = pr;\r\n Ctor.rounding = rm;\r\n\r\n return finalise(quadrant > 2 ? x.neg() : x, pr, rm, true);\r\n};\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the square root of this Decimal, rounded to `precision`\r\n * significant digits using rounding mode `rounding`.\r\n *\r\n * sqrt(-n) = N\r\n * sqrt(N) = N\r\n * sqrt(-I) = N\r\n * sqrt(I) = I\r\n * sqrt(0) = 0\r\n * sqrt(-0) = -0\r\n *\r\n */\r\nP.squareRoot = P.sqrt = function () {\r\n var m, n, sd, r, rep, t,\r\n x = this,\r\n d = x.d,\r\n e = x.e,\r\n s = x.s,\r\n Ctor = x.constructor;\r\n\r\n // Negative/NaN/Infinity/zero?\r\n if (s !== 1 || !d || !d[0]) {\r\n return new Ctor(!s || s < 0 && (!d || d[0]) ? NaN : d ? x : 1 / 0);\r\n }\r\n\r\n external = false;\r\n\r\n // Initial estimate.\r\n s = Math.sqrt(+x);\r\n\r\n // Math.sqrt underflow/overflow?\r\n // Pass x to Math.sqrt as integer, then adjust the exponent of the result.\r\n if (s == 0 || s == 1 / 0) {\r\n n = digitsToString(d);\r\n\r\n if ((n.length + e) % 2 == 0) n += '0';\r\n s = Math.sqrt(n);\r\n e = mathfloor((e + 1) / 2) - (e < 0 || e % 2);\r\n\r\n if (s == 1 / 0) {\r\n n = '1e' + e;\r\n } else {\r\n n = s.toExponential();\r\n n = n.slice(0, n.indexOf('e') + 1) + e;\r\n }\r\n\r\n r = new Ctor(n);\r\n } else {\r\n r = new Ctor(s.toString());\r\n }\r\n\r\n sd = (e = Ctor.precision) + 3;\r\n\r\n // Newton-Raphson iteration.\r\n for (;;) {\r\n t = r;\r\n r = t.plus(divide(x, t, sd + 2, 1)).times(0.5);\r\n\r\n // TODO? Replace with for-loop and checkRoundingDigits.\r\n if (digitsToString(t.d).slice(0, sd) === (n = digitsToString(r.d)).slice(0, sd)) {\r\n n = n.slice(sd - 3, sd + 1);\r\n\r\n // The 4th rounding digit may be in error by -1 so if the 4 rounding digits are 9999 or\r\n // 4999, i.e. approaching a rounding boundary, continue the iteration.\r\n if (n == '9999' || !rep && n == '4999') {\r\n\r\n // On the first iteration only, check to see if rounding up gives the exact result as the\r\n // nines may infinitely repeat.\r\n if (!rep) {\r\n finalise(t, e + 1, 0);\r\n\r\n if (t.times(t).eq(x)) {\r\n r = t;\r\n break;\r\n }\r\n }\r\n\r\n sd += 4;\r\n rep = 1;\r\n } else {\r\n\r\n // If the rounding digits are null, 0{0,4} or 50{0,3}, check for an exact result.\r\n // If not, then there are further digits and m will be truthy.\r\n if (!+n || !+n.slice(1) && n.charAt(0) == '5') {\r\n\r\n // Truncate to the first rounding digit.\r\n finalise(r, e + 1, 1);\r\n m = !r.times(r).eq(x);\r\n }\r\n\r\n break;\r\n }\r\n }\r\n }\r\n\r\n external = true;\r\n\r\n return finalise(r, e, Ctor.rounding, m);\r\n};\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the tangent of the value in radians of this Decimal.\r\n *\r\n * Domain: [-Infinity, Infinity]\r\n * Range: [-Infinity, Infinity]\r\n *\r\n * tan(0) = 0\r\n * tan(-0) = -0\r\n * tan(Infinity) = NaN\r\n * tan(-Infinity) = NaN\r\n * tan(NaN) = NaN\r\n *\r\n */\r\nP.tangent = P.tan = function () {\r\n var pr, rm,\r\n x = this,\r\n Ctor = x.constructor;\r\n\r\n if (!x.isFinite()) return new Ctor(NaN);\r\n if (x.isZero()) return new Ctor(x);\r\n\r\n pr = Ctor.precision;\r\n rm = Ctor.rounding;\r\n Ctor.precision = pr + 10;\r\n Ctor.rounding = 1;\r\n\r\n x = x.sin();\r\n x.s = 1;\r\n x = divide(x, new Ctor(1).minus(x.times(x)).sqrt(), pr + 10, 0);\r\n\r\n Ctor.precision = pr;\r\n Ctor.rounding = rm;\r\n\r\n return finalise(quadrant == 2 || quadrant == 4 ? x.neg() : x, pr, rm, true);\r\n};\r\n\r\n\r\n/*\r\n * n * 0 = 0\r\n * n * N = N\r\n * n * I = I\r\n * 0 * n = 0\r\n * 0 * 0 = 0\r\n * 0 * N = N\r\n * 0 * I = N\r\n * N * n = N\r\n * N * 0 = N\r\n * N * N = N\r\n * N * I = N\r\n * I * n = I\r\n * I * 0 = N\r\n * I * N = N\r\n * I * I = I\r\n *\r\n * Return a new Decimal whose value is this Decimal times `y`, rounded to `precision` significant\r\n * digits using rounding mode `rounding`.\r\n *\r\n */\r\nP.times = P.mul = function (y) {\r\n var carry, e, i, k, r, rL, t, xdL, ydL,\r\n x = this,\r\n Ctor = x.constructor,\r\n xd = x.d,\r\n yd = (y = new Ctor(y)).d;\r\n\r\n y.s *= x.s;\r\n\r\n // If either is NaN, ±Infinity or ±0...\r\n if (!xd || !xd[0] || !yd || !yd[0]) {\r\n\r\n return new Ctor(!y.s || xd && !xd[0] && !yd || yd && !yd[0] && !xd\r\n\r\n // Return NaN if either is NaN.\r\n // Return NaN if x is ±0 and y is ±Infinity, or y is ±0 and x is ±Infinity.\r\n ? NaN\r\n\r\n // Return ±Infinity if either is ±Infinity.\r\n // Return ±0 if either is ±0.\r\n : !xd || !yd ? y.s / 0 : y.s * 0);\r\n }\r\n\r\n e = mathfloor(x.e / LOG_BASE) + mathfloor(y.e / LOG_BASE);\r\n xdL = xd.length;\r\n ydL = yd.length;\r\n\r\n // Ensure xd points to the longer array.\r\n if (xdL < ydL) {\r\n r = xd;\r\n xd = yd;\r\n yd = r;\r\n rL = xdL;\r\n xdL = ydL;\r\n ydL = rL;\r\n }\r\n\r\n // Initialise the result array with zeros.\r\n r = [];\r\n rL = xdL + ydL;\r\n for (i = rL; i--;) r.push(0);\r\n\r\n // Multiply!\r\n for (i = ydL; --i >= 0;) {\r\n carry = 0;\r\n for (k = xdL + i; k > i;) {\r\n t = r[k] + yd[i] * xd[k - i - 1] + carry;\r\n r[k--] = t % BASE | 0;\r\n carry = t / BASE | 0;\r\n }\r\n\r\n r[k] = (r[k] + carry) % BASE | 0;\r\n }\r\n\r\n // Remove trailing zeros.\r\n for (; !r[--rL];) r.pop();\r\n\r\n if (carry) ++e;\r\n else r.shift();\r\n\r\n y.d = r;\r\n y.e = getBase10Exponent(r, e);\r\n\r\n return external ? finalise(y, Ctor.precision, Ctor.rounding) : y;\r\n};\r\n\r\n\r\n/*\r\n * Return a string representing the value of this Decimal in base 2, round to `sd` significant\r\n * digits using rounding mode `rm`.\r\n *\r\n * If the optional `sd` argument is present then return binary exponential notation.\r\n *\r\n * [sd] {number} Significant digits. Integer, 1 to MAX_DIGITS inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n */\r\nP.toBinary = function (sd, rm) {\r\n return toStringBinary(this, 2, sd, rm);\r\n};\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the value of this Decimal rounded to a maximum of `dp`\r\n * decimal places using rounding mode `rm` or `rounding` if `rm` is omitted.\r\n *\r\n * If `dp` is omitted, return a new Decimal whose value is the value of this Decimal.\r\n *\r\n * [dp] {number} Decimal places. Integer, 0 to MAX_DIGITS inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n */\r\nP.toDecimalPlaces = P.toDP = function (dp, rm) {\r\n var x = this,\r\n Ctor = x.constructor;\r\n\r\n x = new Ctor(x);\r\n if (dp === void 0) return x;\r\n\r\n checkInt32(dp, 0, MAX_DIGITS);\r\n\r\n if (rm === void 0) rm = Ctor.rounding;\r\n else checkInt32(rm, 0, 8);\r\n\r\n return finalise(x, dp + x.e + 1, rm);\r\n};\r\n\r\n\r\n/*\r\n * Return a string representing the value of this Decimal in exponential notation rounded to\r\n * `dp` fixed decimal places using rounding mode `rounding`.\r\n *\r\n * [dp] {number} Decimal places. Integer, 0 to MAX_DIGITS inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n */\r\nP.toExponential = function (dp, rm) {\r\n var str,\r\n x = this,\r\n Ctor = x.constructor;\r\n\r\n if (dp === void 0) {\r\n str = finiteToString(x, true);\r\n } else {\r\n checkInt32(dp, 0, MAX_DIGITS);\r\n\r\n if (rm === void 0) rm = Ctor.rounding;\r\n else checkInt32(rm, 0, 8);\r\n\r\n x = finalise(new Ctor(x), dp + 1, rm);\r\n str = finiteToString(x, true, dp + 1);\r\n }\r\n\r\n return x.isNeg() && !x.isZero() ? '-' + str : str;\r\n};\r\n\r\n\r\n/*\r\n * Return a string representing the value of this Decimal in normal (fixed-point) notation to\r\n * `dp` fixed decimal places and rounded using rounding mode `rm` or `rounding` if `rm` is\r\n * omitted.\r\n *\r\n * As with JavaScript numbers, (-0).toFixed(0) is '0', but e.g. (-0.00001).toFixed(0) is '-0'.\r\n *\r\n * [dp] {number} Decimal places. Integer, 0 to MAX_DIGITS inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * (-0).toFixed(0) is '0', but (-0.1).toFixed(0) is '-0'.\r\n * (-0).toFixed(1) is '0.0', but (-0.01).toFixed(1) is '-0.0'.\r\n * (-0).toFixed(3) is '0.000'.\r\n * (-0.5).toFixed(0) is '-0'.\r\n *\r\n */\r\nP.toFixed = function (dp, rm) {\r\n var str, y,\r\n x = this,\r\n Ctor = x.constructor;\r\n\r\n if (dp === void 0) {\r\n str = finiteToString(x);\r\n } else {\r\n checkInt32(dp, 0, MAX_DIGITS);\r\n\r\n if (rm === void 0) rm = Ctor.rounding;\r\n else checkInt32(rm, 0, 8);\r\n\r\n y = finalise(new Ctor(x), dp + x.e + 1, rm);\r\n str = finiteToString(y, false, dp + y.e + 1);\r\n }\r\n\r\n // To determine whether to add the minus sign look at the value before it was rounded,\r\n // i.e. look at `x` rather than `y`.\r\n return x.isNeg() && !x.isZero() ? '-' + str : str;\r\n};\r\n\r\n\r\n/*\r\n * Return an array representing the value of this Decimal as a simple fraction with an integer\r\n * numerator and an integer denominator.\r\n *\r\n * The denominator will be a positive non-zero value less than or equal to the specified maximum\r\n * denominator. If a maximum denominator is not specified, the denominator will be the lowest\r\n * value necessary to represent the number exactly.\r\n *\r\n * [maxD] {number|string|Decimal} Maximum denominator. Integer >= 1 and < Infinity.\r\n *\r\n */\r\nP.toFraction = function (maxD) {\r\n var d, d0, d1, d2, e, k, n, n0, n1, pr, q, r,\r\n x = this,\r\n xd = x.d,\r\n Ctor = x.constructor;\r\n\r\n if (!xd) return new Ctor(x);\r\n\r\n n1 = d0 = new Ctor(1);\r\n d1 = n0 = new Ctor(0);\r\n\r\n d = new Ctor(d1);\r\n e = d.e = getPrecision(xd) - x.e - 1;\r\n k = e % LOG_BASE;\r\n d.d[0] = mathpow(10, k < 0 ? LOG_BASE + k : k);\r\n\r\n if (maxD == null) {\r\n\r\n // d is 10**e, the minimum max-denominator needed.\r\n maxD = e > 0 ? d : n1;\r\n } else {\r\n n = new Ctor(maxD);\r\n if (!n.isInt() || n.lt(n1)) throw Error(invalidArgument + n);\r\n maxD = n.gt(d) ? (e > 0 ? d : n1) : n;\r\n }\r\n\r\n external = false;\r\n n = new Ctor(digitsToString(xd));\r\n pr = Ctor.precision;\r\n Ctor.precision = e = xd.length * LOG_BASE * 2;\r\n\r\n for (;;) {\r\n q = divide(n, d, 0, 1, 1);\r\n d2 = d0.plus(q.times(d1));\r\n if (d2.cmp(maxD) == 1) break;\r\n d0 = d1;\r\n d1 = d2;\r\n d2 = n1;\r\n n1 = n0.plus(q.times(d2));\r\n n0 = d2;\r\n d2 = d;\r\n d = n.minus(q.times(d2));\r\n n = d2;\r\n }\r\n\r\n d2 = divide(maxD.minus(d0), d1, 0, 1, 1);\r\n n0 = n0.plus(d2.times(n1));\r\n d0 = d0.plus(d2.times(d1));\r\n n0.s = n1.s = x.s;\r\n\r\n // Determine which fraction is closer to x, n0/d0 or n1/d1?\r\n r = divide(n1, d1, e, 1).minus(x).abs().cmp(divide(n0, d0, e, 1).minus(x).abs()) < 1\r\n ? [n1, d1] : [n0, d0];\r\n\r\n Ctor.precision = pr;\r\n external = true;\r\n\r\n return r;\r\n};\r\n\r\n\r\n/*\r\n * Return a string representing the value of this Decimal in base 16, round to `sd` significant\r\n * digits using rounding mode `rm`.\r\n *\r\n * If the optional `sd` argument is present then return binary exponential notation.\r\n *\r\n * [sd] {number} Significant digits. Integer, 1 to MAX_DIGITS inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n */\r\nP.toHexadecimal = P.toHex = function (sd, rm) {\r\n return toStringBinary(this, 16, sd, rm);\r\n};\r\n\r\n\r\n\r\n/*\r\n * Returns a new Decimal whose value is the nearest multiple of the magnitude of `y` to the value\r\n * of this Decimal.\r\n *\r\n * If the value of this Decimal is equidistant from two multiples of `y`, the rounding mode `rm`,\r\n * or `Decimal.rounding` if `rm` is omitted, determines the direction of the nearest multiple.\r\n *\r\n * In the context of this method, rounding mode 4 (ROUND_HALF_UP) is the same as rounding mode 0\r\n * (ROUND_UP), and so on.\r\n *\r\n * The return value will always have the same sign as this Decimal, unless either this Decimal\r\n * or `y` is NaN, in which case the return value will be also be NaN.\r\n *\r\n * The return value is not affected by the value of `precision`.\r\n *\r\n * y {number|string|Decimal} The magnitude to round to a multiple of.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * 'toNearest() rounding mode not an integer: {rm}'\r\n * 'toNearest() rounding mode out of range: {rm}'\r\n *\r\n */\r\nP.toNearest = function (y, rm) {\r\n var x = this,\r\n Ctor = x.constructor;\r\n\r\n x = new Ctor(x);\r\n\r\n if (y == null) {\r\n\r\n // If x is not finite, return x.\r\n if (!x.d) return x;\r\n\r\n y = new Ctor(1);\r\n rm = Ctor.rounding;\r\n } else {\r\n y = new Ctor(y);\r\n if (rm !== void 0) checkInt32(rm, 0, 8);\r\n\r\n // If x is not finite, return x if y is not NaN, else NaN.\r\n if (!x.d) return y.s ? x : y;\r\n\r\n // If y is not finite, return Infinity with the sign of x if y is Infinity, else NaN.\r\n if (!y.d) {\r\n if (y.s) y.s = x.s;\r\n return y;\r\n }\r\n }\r\n\r\n // If y is not zero, calculate the nearest multiple of y to x.\r\n if (y.d[0]) {\r\n external = false;\r\n if (rm < 4) rm = [4, 5, 7, 8][rm];\r\n x = divide(x, y, 0, rm, 1).times(y);\r\n external = true;\r\n finalise(x);\r\n\r\n // If y is zero, return zero with the sign of x.\r\n } else {\r\n y.s = x.s;\r\n x = y;\r\n }\r\n\r\n return x;\r\n};\r\n\r\n\r\n/*\r\n * Return the value of this Decimal converted to a number primitive.\r\n * Zero keeps its sign.\r\n *\r\n */\r\nP.toNumber = function () {\r\n return +this;\r\n};\r\n\r\n\r\n/*\r\n * Return a string representing the value of this Decimal in base 8, round to `sd` significant\r\n * digits using rounding mode `rm`.\r\n *\r\n * If the optional `sd` argument is present then return binary exponential notation.\r\n *\r\n * [sd] {number} Significant digits. Integer, 1 to MAX_DIGITS inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n */\r\nP.toOctal = function (sd, rm) {\r\n return toStringBinary(this, 8, sd, rm);\r\n};\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the value of this Decimal raised to the power `y`, rounded\r\n * to `precision` significant digits using rounding mode `rounding`.\r\n *\r\n * ECMAScript compliant.\r\n *\r\n * pow(x, NaN) = NaN\r\n * pow(x, ±0) = 1\r\n\r\n * pow(NaN, non-zero) = NaN\r\n * pow(abs(x) > 1, +Infinity) = +Infinity\r\n * pow(abs(x) > 1, -Infinity) = +0\r\n * pow(abs(x) == 1, ±Infinity) = NaN\r\n * pow(abs(x) < 1, +Infinity) = +0\r\n * pow(abs(x) < 1, -Infinity) = +Infinity\r\n * pow(+Infinity, y > 0) = +Infinity\r\n * pow(+Infinity, y < 0) = +0\r\n * pow(-Infinity, odd integer > 0) = -Infinity\r\n * pow(-Infinity, even integer > 0) = +Infinity\r\n * pow(-Infinity, odd integer < 0) = -0\r\n * pow(-Infinity, even integer < 0) = +0\r\n * pow(+0, y > 0) = +0\r\n * pow(+0, y < 0) = +Infinity\r\n * pow(-0, odd integer > 0) = -0\r\n * pow(-0, even integer > 0) = +0\r\n * pow(-0, odd integer < 0) = -Infinity\r\n * pow(-0, even integer < 0) = +Infinity\r\n * pow(finite x < 0, finite non-integer) = NaN\r\n *\r\n * For non-integer or very large exponents pow(x, y) is calculated using\r\n *\r\n * x^y = exp(y*ln(x))\r\n *\r\n * Assuming the first 15 rounding digits are each equally likely to be any digit 0-9, the\r\n * probability of an incorrectly rounded result\r\n * P([49]9{14} | [50]0{14}) = 2 * 0.2 * 10^-14 = 4e-15 = 1/2.5e+14\r\n * i.e. 1 in 250,000,000,000,000\r\n *\r\n * If a result is incorrectly rounded the maximum error will be 1 ulp (unit in last place).\r\n *\r\n * y {number|string|Decimal} The power to which to raise this Decimal.\r\n *\r\n */\r\nP.toPower = P.pow = function (y) {\r\n var e, k, pr, r, rm, s,\r\n x = this,\r\n Ctor = x.constructor,\r\n yn = +(y = new Ctor(y));\r\n\r\n // Either ±Infinity, NaN or ±0?\r\n if (!x.d || !y.d || !x.d[0] || !y.d[0]) return new Ctor(mathpow(+x, yn));\r\n\r\n x = new Ctor(x);\r\n\r\n if (x.eq(1)) return x;\r\n\r\n pr = Ctor.precision;\r\n rm = Ctor.rounding;\r\n\r\n if (y.eq(1)) return finalise(x, pr, rm);\r\n\r\n // y exponent\r\n e = mathfloor(y.e / LOG_BASE);\r\n\r\n // If y is a small integer use the 'exponentiation by squaring' algorithm.\r\n if (e >= y.d.length - 1 && (k = yn < 0 ? -yn : yn) <= MAX_SAFE_INTEGER) {\r\n r = intPow(Ctor, x, k, pr);\r\n return y.s < 0 ? new Ctor(1).div(r) : finalise(r, pr, rm);\r\n }\r\n\r\n s = x.s;\r\n\r\n // if x is negative\r\n if (s < 0) {\r\n\r\n // if y is not an integer\r\n if (e < y.d.length - 1) return new Ctor(NaN);\r\n\r\n // Result is positive if x is negative and the last digit of integer y is even.\r\n if ((y.d[e] & 1) == 0) s = 1;\r\n\r\n // if x.eq(-1)\r\n if (x.e == 0 && x.d[0] == 1 && x.d.length == 1) {\r\n x.s = s;\r\n return x;\r\n }\r\n }\r\n\r\n // Estimate result exponent.\r\n // x^y = 10^e, where e = y * log10(x)\r\n // log10(x) = log10(x_significand) + x_exponent\r\n // log10(x_significand) = ln(x_significand) / ln(10)\r\n k = mathpow(+x, yn);\r\n e = k == 0 || !isFinite(k)\r\n ? mathfloor(yn * (Math.log('0.' + digitsToString(x.d)) / Math.LN10 + x.e + 1))\r\n : new Ctor(k + '').e;\r\n\r\n // Exponent estimate may be incorrect e.g. x: 0.999999999999999999, y: 2.29, e: 0, r.e: -1.\r\n\r\n // Overflow/underflow?\r\n if (e > Ctor.maxE + 1 || e < Ctor.minE - 1) return new Ctor(e > 0 ? s / 0 : 0);\r\n\r\n external = false;\r\n Ctor.rounding = x.s = 1;\r\n\r\n // Estimate the extra guard digits needed to ensure five correct rounding digits from\r\n // naturalLogarithm(x). Example of failure without these extra digits (precision: 10):\r\n // new Decimal(2.32456).pow('2087987436534566.46411')\r\n // should be 1.162377823e+764914905173815, but is 1.162355823e+764914905173815\r\n k = Math.min(12, (e + '').length);\r\n\r\n // r = x^y = exp(y*ln(x))\r\n r = naturalExponential(y.times(naturalLogarithm(x, pr + k)), pr);\r\n\r\n // r may be Infinity, e.g. (0.9999999999999999).pow(-1e+40)\r\n if (r.d) {\r\n\r\n // Truncate to the required precision plus five rounding digits.\r\n r = finalise(r, pr + 5, 1);\r\n\r\n // If the rounding digits are [49]9999 or [50]0000 increase the precision by 10 and recalculate\r\n // the result.\r\n if (checkRoundingDigits(r.d, pr, rm)) {\r\n e = pr + 10;\r\n\r\n // Truncate to the increased precision plus five rounding digits.\r\n r = finalise(naturalExponential(y.times(naturalLogarithm(x, e + k)), e), e + 5, 1);\r\n\r\n // Check for 14 nines from the 2nd rounding digit (the first rounding digit may be 4 or 9).\r\n if (+digitsToString(r.d).slice(pr + 1, pr + 15) + 1 == 1e14) {\r\n r = finalise(r, pr + 1, 0);\r\n }\r\n }\r\n }\r\n\r\n r.s = s;\r\n external = true;\r\n Ctor.rounding = rm;\r\n\r\n return finalise(r, pr, rm);\r\n};\r\n\r\n\r\n/*\r\n * Return a string representing the value of this Decimal rounded to `sd` significant digits\r\n * using rounding mode `rounding`.\r\n *\r\n * Return exponential notation if `sd` is less than the number of digits necessary to represent\r\n * the integer part of the value in normal notation.\r\n *\r\n * [sd] {number} Significant digits. Integer, 1 to MAX_DIGITS inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n */\r\nP.toPrecision = function (sd, rm) {\r\n var str,\r\n x = this,\r\n Ctor = x.constructor;\r\n\r\n if (sd === void 0) {\r\n str = finiteToString(x, x.e <= Ctor.toExpNeg || x.e >= Ctor.toExpPos);\r\n } else {\r\n checkInt32(sd, 1, MAX_DIGITS);\r\n\r\n if (rm === void 0) rm = Ctor.rounding;\r\n else checkInt32(rm, 0, 8);\r\n\r\n x = finalise(new Ctor(x), sd, rm);\r\n str = finiteToString(x, sd <= x.e || x.e <= Ctor.toExpNeg, sd);\r\n }\r\n\r\n return x.isNeg() && !x.isZero() ? '-' + str : str;\r\n};\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the value of this Decimal rounded to a maximum of `sd`\r\n * significant digits using rounding mode `rm`, or to `precision` and `rounding` respectively if\r\n * omitted.\r\n *\r\n * [sd] {number} Significant digits. Integer, 1 to MAX_DIGITS inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * 'toSD() digits out of range: {sd}'\r\n * 'toSD() digits not an integer: {sd}'\r\n * 'toSD() rounding mode not an integer: {rm}'\r\n * 'toSD() rounding mode out of range: {rm}'\r\n *\r\n */\r\nP.toSignificantDigits = P.toSD = function (sd, rm) {\r\n var x = this,\r\n Ctor = x.constructor;\r\n\r\n if (sd === void 0) {\r\n sd = Ctor.precision;\r\n rm = Ctor.rounding;\r\n } else {\r\n checkInt32(sd, 1, MAX_DIGITS);\r\n\r\n if (rm === void 0) rm = Ctor.rounding;\r\n else checkInt32(rm, 0, 8);\r\n }\r\n\r\n return finalise(new Ctor(x), sd, rm);\r\n};\r\n\r\n\r\n/*\r\n * Return a string representing the value of this Decimal.\r\n *\r\n * Return exponential notation if this Decimal has a positive exponent equal to or greater than\r\n * `toExpPos`, or a negative exponent equal to or less than `toExpNeg`.\r\n *\r\n */\r\nP.toString = function () {\r\n var x = this,\r\n Ctor = x.constructor,\r\n str = finiteToString(x, x.e <= Ctor.toExpNeg || x.e >= Ctor.toExpPos);\r\n\r\n return x.isNeg() && !x.isZero() ? '-' + str : str;\r\n};\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the value of this Decimal truncated to a whole number.\r\n *\r\n */\r\nP.truncated = P.trunc = function () {\r\n return finalise(new this.constructor(this), this.e + 1, 1);\r\n};\r\n\r\n\r\n/*\r\n * Return a string representing the value of this Decimal.\r\n * Unlike `toString`, negative zero will include the minus sign.\r\n *\r\n */\r\nP.valueOf = P.toJSON = function () {\r\n var x = this,\r\n Ctor = x.constructor,\r\n str = finiteToString(x, x.e <= Ctor.toExpNeg || x.e >= Ctor.toExpPos);\r\n\r\n return x.isNeg() ? '-' + str : str;\r\n};\r\n\r\n\r\n/*\r\n// Add aliases to match BigDecimal method names.\r\n// P.add = P.plus;\r\nP.subtract = P.minus;\r\nP.multiply = P.times;\r\nP.divide = P.div;\r\nP.remainder = P.mod;\r\nP.compareTo = P.cmp;\r\nP.negate = P.neg;\r\n */\r\n\r\n\r\n// Helper functions for Decimal.prototype (P) and/or Decimal methods, and their callers.\r\n\r\n\r\n/*\r\n * digitsToString P.cubeRoot, P.logarithm, P.squareRoot, P.toFraction, P.toPower,\r\n * finiteToString, naturalExponential, naturalLogarithm\r\n * checkInt32 P.toDecimalPlaces, P.toExponential, P.toFixed, P.toNearest,\r\n * P.toPrecision, P.toSignificantDigits, toStringBinary, random\r\n * checkRoundingDigits P.logarithm, P.toPower, naturalExponential, naturalLogarithm\r\n * convertBase toStringBinary, parseOther\r\n * cos P.cos\r\n * divide P.atanh, P.cubeRoot, P.dividedBy, P.dividedToIntegerBy,\r\n * P.logarithm, P.modulo, P.squareRoot, P.tan, P.tanh, P.toFraction,\r\n * P.toNearest, toStringBinary, naturalExponential, naturalLogarithm,\r\n * taylorSeries, atan2, parseOther\r\n * finalise P.absoluteValue, P.atan, P.atanh, P.ceil, P.cos, P.cosh,\r\n * P.cubeRoot, P.dividedToIntegerBy, P.floor, P.logarithm, P.minus,\r\n * P.modulo, P.negated, P.plus, P.round, P.sin, P.sinh, P.squareRoot,\r\n * P.tan, P.times, P.toDecimalPlaces, P.toExponential, P.toFixed,\r\n * P.toNearest, P.toPower, P.toPrecision, P.toSignificantDigits,\r\n * P.truncated, divide, getLn10, getPi, naturalExponential,\r\n * naturalLogarithm, ceil, floor, round, trunc\r\n * finiteToString P.toExponential, P.toFixed, P.toPrecision, P.toString, P.valueOf,\r\n * toStringBinary\r\n * getBase10Exponent P.minus, P.plus, P.times, parseOther\r\n * getLn10 P.logarithm, naturalLogarithm\r\n * getPi P.acos, P.asin, P.atan, toLessThanHalfPi, atan2\r\n * getPrecision P.precision, P.toFraction\r\n * getZeroString digitsToString, finiteToString\r\n * intPow P.toPower, parseOther\r\n * isOdd toLessThanHalfPi\r\n * maxOrMin max, min\r\n * naturalExponential P.naturalExponential, P.toPower\r\n * naturalLogarithm P.acosh, P.asinh, P.atanh, P.logarithm, P.naturalLogarithm,\r\n * P.toPower, naturalExponential\r\n * nonFiniteToString finiteToString, toStringBinary\r\n * parseDecimal Decimal\r\n * parseOther Decimal\r\n * sin P.sin\r\n * taylorSeries P.cosh, P.sinh, cos, sin\r\n * toLessThanHalfPi P.cos, P.sin\r\n * toStringBinary P.toBinary, P.toHexadecimal, P.toOctal\r\n * truncate intPow\r\n *\r\n * Throws: P.logarithm, P.precision, P.toFraction, checkInt32, getLn10, getPi,\r\n * naturalLogarithm, config, parseOther, random, Decimal\r\n */\r\n\r\n\r\nfunction digitsToString(d) {\r\n var i, k, ws,\r\n indexOfLastWord = d.length - 1,\r\n str = '',\r\n w = d[0];\r\n\r\n if (indexOfLastWord > 0) {\r\n str += w;\r\n for (i = 1; i < indexOfLastWord; i++) {\r\n ws = d[i] + '';\r\n k = LOG_BASE - ws.length;\r\n if (k) str += getZeroString(k);\r\n str += ws;\r\n }\r\n\r\n w = d[i];\r\n ws = w + '';\r\n k = LOG_BASE - ws.length;\r\n if (k) str += getZeroString(k);\r\n } else if (w === 0) {\r\n return '0';\r\n }\r\n\r\n // Remove trailing zeros of last w.\r\n for (; w % 10 === 0;) w /= 10;\r\n\r\n return str + w;\r\n}\r\n\r\n\r\nfunction checkInt32(i, min, max) {\r\n if (i !== ~~i || i < min || i > max) {\r\n throw Error(invalidArgument + i);\r\n }\r\n}\r\n\r\n\r\n/*\r\n * Check 5 rounding digits if `repeating` is null, 4 otherwise.\r\n * `repeating == null` if caller is `log` or `pow`,\r\n * `repeating != null` if caller is `naturalLogarithm` or `naturalExponential`.\r\n */\r\nfunction checkRoundingDigits(d, i, rm, repeating) {\r\n var di, k, r, rd;\r\n\r\n // Get the length of the first word of the array d.\r\n for (k = d[0]; k >= 10; k /= 10) --i;\r\n\r\n // Is the rounding digit in the first word of d?\r\n if (--i < 0) {\r\n i += LOG_BASE;\r\n di = 0;\r\n } else {\r\n di = Math.ceil((i + 1) / LOG_BASE);\r\n i %= LOG_BASE;\r\n }\r\n\r\n // i is the index (0 - 6) of the rounding digit.\r\n // E.g. if within the word 3487563 the first rounding digit is 5,\r\n // then i = 4, k = 1000, rd = 3487563 % 1000 = 563\r\n k = mathpow(10, LOG_BASE - i);\r\n rd = d[di] % k | 0;\r\n\r\n if (repeating == null) {\r\n if (i < 3) {\r\n if (i == 0) rd = rd / 100 | 0;\r\n else if (i == 1) rd = rd / 10 | 0;\r\n r = rm < 4 && rd == 99999 || rm > 3 && rd == 49999 || rd == 50000 || rd == 0;\r\n } else {\r\n r = (rm < 4 && rd + 1 == k || rm > 3 && rd + 1 == k / 2) &&\r\n (d[di + 1] / k / 100 | 0) == mathpow(10, i - 2) - 1 ||\r\n (rd == k / 2 || rd == 0) && (d[di + 1] / k / 100 | 0) == 0;\r\n }\r\n } else {\r\n if (i < 4) {\r\n if (i == 0) rd = rd / 1000 | 0;\r\n else if (i == 1) rd = rd / 100 | 0;\r\n else if (i == 2) rd = rd / 10 | 0;\r\n r = (repeating || rm < 4) && rd == 9999 || !repeating && rm > 3 && rd == 4999;\r\n } else {\r\n r = ((repeating || rm < 4) && rd + 1 == k ||\r\n (!repeating && rm > 3) && rd + 1 == k / 2) &&\r\n (d[di + 1] / k / 1000 | 0) == mathpow(10, i - 3) - 1;\r\n }\r\n }\r\n\r\n return r;\r\n}\r\n\r\n\r\n// Convert string of `baseIn` to an array of numbers of `baseOut`.\r\n// Eg. convertBase('255', 10, 16) returns [15, 15].\r\n// Eg. convertBase('ff', 16, 10) returns [2, 5, 5].\r\nfunction convertBase(str, baseIn, baseOut) {\r\n var j,\r\n arr = [0],\r\n arrL,\r\n i = 0,\r\n strL = str.length;\r\n\r\n for (; i < strL;) {\r\n for (arrL = arr.length; arrL--;) arr[arrL] *= baseIn;\r\n arr[0] += NUMERALS.indexOf(str.charAt(i++));\r\n for (j = 0; j < arr.length; j++) {\r\n if (arr[j] > baseOut - 1) {\r\n if (arr[j + 1] === void 0) arr[j + 1] = 0;\r\n arr[j + 1] += arr[j] / baseOut | 0;\r\n arr[j] %= baseOut;\r\n }\r\n }\r\n }\r\n\r\n return arr.reverse();\r\n}\r\n\r\n\r\n/*\r\n * cos(x) = 1 - x^2/2! + x^4/4! - ...\r\n * |x| < pi/2\r\n *\r\n */\r\nfunction cosine(Ctor, x) {\r\n var k, y,\r\n len = x.d.length;\r\n\r\n // Argument reduction: cos(4x) = 8*(cos^4(x) - cos^2(x)) + 1\r\n // i.e. cos(x) = 8*(cos^4(x/4) - cos^2(x/4)) + 1\r\n\r\n // Estimate the optimum number of times to use the argument reduction.\r\n if (len < 32) {\r\n k = Math.ceil(len / 3);\r\n y = Math.pow(4, -k).toString();\r\n } else {\r\n k = 16;\r\n y = '2.3283064365386962890625e-10';\r\n }\r\n\r\n Ctor.precision += k;\r\n\r\n x = taylorSeries(Ctor, 1, x.times(y), new Ctor(1));\r\n\r\n // Reverse argument reduction\r\n for (var i = k; i--;) {\r\n var cos2x = x.times(x);\r\n x = cos2x.times(cos2x).minus(cos2x).times(8).plus(1);\r\n }\r\n\r\n Ctor.precision -= k;\r\n\r\n return x;\r\n}\r\n\r\n\r\n/*\r\n * Perform division in the specified base.\r\n */\r\nvar divide = (function () {\r\n\r\n // Assumes non-zero x and k, and hence non-zero result.\r\n function multiplyInteger(x, k, base) {\r\n var temp,\r\n carry = 0,\r\n i = x.length;\r\n\r\n for (x = x.slice(); i--;) {\r\n temp = x[i] * k + carry;\r\n x[i] = temp % base | 0;\r\n carry = temp / base | 0;\r\n }\r\n\r\n if (carry) x.unshift(carry);\r\n\r\n return x;\r\n }\r\n\r\n function compare(a, b, aL, bL) {\r\n var i, r;\r\n\r\n if (aL != bL) {\r\n r = aL > bL ? 1 : -1;\r\n } else {\r\n for (i = r = 0; i < aL; i++) {\r\n if (a[i] != b[i]) {\r\n r = a[i] > b[i] ? 1 : -1;\r\n break;\r\n }\r\n }\r\n }\r\n\r\n return r;\r\n }\r\n\r\n function subtract(a, b, aL, base) {\r\n var i = 0;\r\n\r\n // Subtract b from a.\r\n for (; aL--;) {\r\n a[aL] -= i;\r\n i = a[aL] < b[aL] ? 1 : 0;\r\n a[aL] = i * base + a[aL] - b[aL];\r\n }\r\n\r\n // Remove leading zeros.\r\n for (; !a[0] && a.length > 1;) a.shift();\r\n }\r\n\r\n return function (x, y, pr, rm, dp, base) {\r\n var cmp, e, i, k, logBase, more, prod, prodL, q, qd, rem, remL, rem0, sd, t, xi, xL, yd0,\r\n yL, yz,\r\n Ctor = x.constructor,\r\n sign = x.s == y.s ? 1 : -1,\r\n xd = x.d,\r\n yd = y.d;\r\n\r\n // Either NaN, Infinity or 0?\r\n if (!xd || !xd[0] || !yd || !yd[0]) {\r\n\r\n return new Ctor(// Return NaN if either NaN, or both Infinity or 0.\r\n !x.s || !y.s || (xd ? yd && xd[0] == yd[0] : !yd) ? NaN :\r\n\r\n // Return ±0 if x is 0 or y is ±Infinity, or return ±Infinity as y is 0.\r\n xd && xd[0] == 0 || !yd ? sign * 0 : sign / 0);\r\n }\r\n\r\n if (base) {\r\n logBase = 1;\r\n e = x.e - y.e;\r\n } else {\r\n base = BASE;\r\n logBase = LOG_BASE;\r\n e = mathfloor(x.e / logBase) - mathfloor(y.e / logBase);\r\n }\r\n\r\n yL = yd.length;\r\n xL = xd.length;\r\n q = new Ctor(sign);\r\n qd = q.d = [];\r\n\r\n // Result exponent may be one less than e.\r\n // The digit array of a Decimal from toStringBinary may have trailing zeros.\r\n for (i = 0; yd[i] == (xd[i] || 0); i++);\r\n\r\n if (yd[i] > (xd[i] || 0)) e--;\r\n\r\n if (pr == null) {\r\n sd = pr = Ctor.precision;\r\n rm = Ctor.rounding;\r\n } else if (dp) {\r\n sd = pr + (x.e - y.e) + 1;\r\n } else {\r\n sd = pr;\r\n }\r\n\r\n if (sd < 0) {\r\n qd.push(1);\r\n more = true;\r\n } else {\r\n\r\n // Convert precision in number of base 10 digits to base 1e7 digits.\r\n sd = sd / logBase + 2 | 0;\r\n i = 0;\r\n\r\n // divisor < 1e7\r\n if (yL == 1) {\r\n k = 0;\r\n yd = yd[0];\r\n sd++;\r\n\r\n // k is the carry.\r\n for (; (i < xL || k) && sd--; i++) {\r\n t = k * base + (xd[i] || 0);\r\n qd[i] = t / yd | 0;\r\n k = t % yd | 0;\r\n }\r\n\r\n more = k || i < xL;\r\n\r\n // divisor >= 1e7\r\n } else {\r\n\r\n // Normalise xd and yd so highest order digit of yd is >= base/2\r\n k = base / (yd[0] + 1) | 0;\r\n\r\n if (k > 1) {\r\n yd = multiplyInteger(yd, k, base);\r\n xd = multiplyInteger(xd, k, base);\r\n yL = yd.length;\r\n xL = xd.length;\r\n }\r\n\r\n xi = yL;\r\n rem = xd.slice(0, yL);\r\n remL = rem.length;\r\n\r\n // Add zeros to make remainder as long as divisor.\r\n for (; remL < yL;) rem[remL++] = 0;\r\n\r\n yz = yd.slice();\r\n yz.unshift(0);\r\n yd0 = yd[0];\r\n\r\n if (yd[1] >= base / 2) ++yd0;\r\n\r\n do {\r\n k = 0;\r\n\r\n // Compare divisor and remainder.\r\n cmp = compare(yd, rem, yL, remL);\r\n\r\n // If divisor < remainder.\r\n if (cmp < 0) {\r\n\r\n // Calculate trial digit, k.\r\n rem0 = rem[0];\r\n if (yL != remL) rem0 = rem0 * base + (rem[1] || 0);\r\n\r\n // k will be how many times the divisor goes into the current remainder.\r\n k = rem0 / yd0 | 0;\r\n\r\n // Algorithm:\r\n // 1. product = divisor * trial digit (k)\r\n // 2. if product > remainder: product -= divisor, k--\r\n // 3. remainder -= product\r\n // 4. if product was < remainder at 2:\r\n // 5. compare new remainder and divisor\r\n // 6. If remainder > divisor: remainder -= divisor, k++\r\n\r\n if (k > 1) {\r\n if (k >= base) k = base - 1;\r\n\r\n // product = divisor * trial digit.\r\n prod = multiplyInteger(yd, k, base);\r\n prodL = prod.length;\r\n remL = rem.length;\r\n\r\n // Compare product and remainder.\r\n cmp = compare(prod, rem, prodL, remL);\r\n\r\n // product > remainder.\r\n if (cmp == 1) {\r\n k--;\r\n\r\n // Subtract divisor from product.\r\n subtract(prod, yL < prodL ? yz : yd, prodL, base);\r\n }\r\n } else {\r\n\r\n // cmp is -1.\r\n // If k is 0, there is no need to compare yd and rem again below, so change cmp to 1\r\n // to avoid it. If k is 1 there is a need to compare yd and rem again below.\r\n if (k == 0) cmp = k = 1;\r\n prod = yd.slice();\r\n }\r\n\r\n prodL = prod.length;\r\n if (prodL < remL) prod.unshift(0);\r\n\r\n // Subtract product from remainder.\r\n subtract(rem, prod, remL, base);\r\n\r\n // If product was < previous remainder.\r\n if (cmp == -1) {\r\n remL = rem.length;\r\n\r\n // Compare divisor and new remainder.\r\n cmp = compare(yd, rem, yL, remL);\r\n\r\n // If divisor < new remainder, subtract divisor from remainder.\r\n if (cmp < 1) {\r\n k++;\r\n\r\n // Subtract divisor from remainder.\r\n subtract(rem, yL < remL ? yz : yd, remL, base);\r\n }\r\n }\r\n\r\n remL = rem.length;\r\n } else if (cmp === 0) {\r\n k++;\r\n rem = [0];\r\n } // if cmp === 1, k will be 0\r\n\r\n // Add the next digit, k, to the result array.\r\n qd[i++] = k;\r\n\r\n // Update the remainder.\r\n if (cmp && rem[0]) {\r\n rem[remL++] = xd[xi] || 0;\r\n } else {\r\n rem = [xd[xi]];\r\n remL = 1;\r\n }\r\n\r\n } while ((xi++ < xL || rem[0] !== void 0) && sd--);\r\n\r\n more = rem[0] !== void 0;\r\n }\r\n\r\n // Leading zero?\r\n if (!qd[0]) qd.shift();\r\n }\r\n\r\n // logBase is 1 when divide is being used for base conversion.\r\n if (logBase == 1) {\r\n q.e = e;\r\n inexact = more;\r\n } else {\r\n\r\n // To calculate q.e, first get the number of digits of qd[0].\r\n for (i = 1, k = qd[0]; k >= 10; k /= 10) i++;\r\n q.e = i + e * logBase - 1;\r\n\r\n finalise(q, dp ? pr + q.e + 1 : pr, rm, more);\r\n }\r\n\r\n return q;\r\n };\r\n})();\r\n\r\n\r\n/*\r\n * Round `x` to `sd` significant digits using rounding mode `rm`.\r\n * Check for over/under-flow.\r\n */\r\n function finalise(x, sd, rm, isTruncated) {\r\n var digits, i, j, k, rd, roundUp, w, xd, xdi,\r\n Ctor = x.constructor;\r\n\r\n // Don't round if sd is null or undefined.\r\n out: if (sd != null) {\r\n xd = x.d;\r\n\r\n // Infinity/NaN.\r\n if (!xd) return x;\r\n\r\n // rd: the rounding digit, i.e. the digit after the digit that may be rounded up.\r\n // w: the word of xd containing rd, a base 1e7 number.\r\n // xdi: the index of w within xd.\r\n // digits: the number of digits of w.\r\n // i: what would be the index of rd within w if all the numbers were 7 digits long (i.e. if\r\n // they had leading zeros)\r\n // j: if > 0, the actual index of rd within w (if < 0, rd is a leading zero).\r\n\r\n // Get the length of the first word of the digits array xd.\r\n for (digits = 1, k = xd[0]; k >= 10; k /= 10) digits++;\r\n i = sd - digits;\r\n\r\n // Is the rounding digit in the first word of xd?\r\n if (i < 0) {\r\n i += LOG_BASE;\r\n j = sd;\r\n w = xd[xdi = 0];\r\n\r\n // Get the rounding digit at index j of w.\r\n rd = w / mathpow(10, digits - j - 1) % 10 | 0;\r\n } else {\r\n xdi = Math.ceil((i + 1) / LOG_BASE);\r\n k = xd.length;\r\n if (xdi >= k) {\r\n if (isTruncated) {\r\n\r\n // Needed by `naturalExponential`, `naturalLogarithm` and `squareRoot`.\r\n for (; k++ <= xdi;) xd.push(0);\r\n w = rd = 0;\r\n digits = 1;\r\n i %= LOG_BASE;\r\n j = i - LOG_BASE + 1;\r\n } else {\r\n break out;\r\n }\r\n } else {\r\n w = k = xd[xdi];\r\n\r\n // Get the number of digits of w.\r\n for (digits = 1; k >= 10; k /= 10) digits++;\r\n\r\n // Get the index of rd within w.\r\n i %= LOG_BASE;\r\n\r\n // Get the index of rd within w, adjusted for leading zeros.\r\n // The number of leading zeros of w is given by LOG_BASE - digits.\r\n j = i - LOG_BASE + digits;\r\n\r\n // Get the rounding digit at index j of w.\r\n rd = j < 0 ? 0 : w / mathpow(10, digits - j - 1) % 10 | 0;\r\n }\r\n }\r\n\r\n // Are there any non-zero digits after the rounding digit?\r\n isTruncated = isTruncated || sd < 0 ||\r\n xd[xdi + 1] !== void 0 || (j < 0 ? w : w % mathpow(10, digits - j - 1));\r\n\r\n // The expression `w % mathpow(10, digits - j - 1)` returns all the digits of w to the right\r\n // of the digit at (left-to-right) index j, e.g. if w is 908714 and j is 2, the expression\r\n // will give 714.\r\n\r\n roundUp = rm < 4\r\n ? (rd || isTruncated) && (rm == 0 || rm == (x.s < 0 ? 3 : 2))\r\n : rd > 5 || rd == 5 && (rm == 4 || isTruncated || rm == 6 &&\r\n\r\n // Check whether the digit to the left of the rounding digit is odd.\r\n ((i > 0 ? j > 0 ? w / mathpow(10, digits - j) : 0 : xd[xdi - 1]) % 10) & 1 ||\r\n rm == (x.s < 0 ? 8 : 7));\r\n\r\n if (sd < 1 || !xd[0]) {\r\n xd.length = 0;\r\n if (roundUp) {\r\n\r\n // Convert sd to decimal places.\r\n sd -= x.e + 1;\r\n\r\n // 1, 0.1, 0.01, 0.001, 0.0001 etc.\r\n xd[0] = mathpow(10, (LOG_BASE - sd % LOG_BASE) % LOG_BASE);\r\n x.e = -sd || 0;\r\n } else {\r\n\r\n // Zero.\r\n xd[0] = x.e = 0;\r\n }\r\n\r\n return x;\r\n }\r\n\r\n // Remove excess digits.\r\n if (i == 0) {\r\n xd.length = xdi;\r\n k = 1;\r\n xdi--;\r\n } else {\r\n xd.length = xdi + 1;\r\n k = mathpow(10, LOG_BASE - i);\r\n\r\n // E.g. 56700 becomes 56000 if 7 is the rounding digit.\r\n // j > 0 means i > number of leading zeros of w.\r\n xd[xdi] = j > 0 ? (w / mathpow(10, digits - j) % mathpow(10, j) | 0) * k : 0;\r\n }\r\n\r\n if (roundUp) {\r\n for (;;) {\r\n\r\n // Is the digit to be rounded up in the first word of xd?\r\n if (xdi == 0) {\r\n\r\n // i will be the length of xd[0] before k is added.\r\n for (i = 1, j = xd[0]; j >= 10; j /= 10) i++;\r\n j = xd[0] += k;\r\n for (k = 1; j >= 10; j /= 10) k++;\r\n\r\n // if i != k the length has increased.\r\n if (i != k) {\r\n x.e++;\r\n if (xd[0] == BASE) xd[0] = 1;\r\n }\r\n\r\n break;\r\n } else {\r\n xd[xdi] += k;\r\n if (xd[xdi] != BASE) break;\r\n xd[xdi--] = 0;\r\n k = 1;\r\n }\r\n }\r\n }\r\n\r\n // Remove trailing zeros.\r\n for (i = xd.length; xd[--i] === 0;) xd.pop();\r\n }\r\n\r\n if (external) {\r\n\r\n // Overflow?\r\n if (x.e > Ctor.maxE) {\r\n\r\n // Infinity.\r\n x.d = null;\r\n x.e = NaN;\r\n\r\n // Underflow?\r\n } else if (x.e < Ctor.minE) {\r\n\r\n // Zero.\r\n x.e = 0;\r\n x.d = [0];\r\n // Ctor.underflow = true;\r\n } // else Ctor.underflow = false;\r\n }\r\n\r\n return x;\r\n}\r\n\r\n\r\nfunction finiteToString(x, isExp, sd) {\r\n if (!x.isFinite()) return nonFiniteToString(x);\r\n var k,\r\n e = x.e,\r\n str = digitsToString(x.d),\r\n len = str.length;\r\n\r\n if (isExp) {\r\n if (sd && (k = sd - len) > 0) {\r\n str = str.charAt(0) + '.' + str.slice(1) + getZeroString(k);\r\n } else if (len > 1) {\r\n str = str.charAt(0) + '.' + str.slice(1);\r\n }\r\n\r\n str = str + (x.e < 0 ? 'e' : 'e+') + x.e;\r\n } else if (e < 0) {\r\n str = '0.' + getZeroString(-e - 1) + str;\r\n if (sd && (k = sd - len) > 0) str += getZeroString(k);\r\n } else if (e >= len) {\r\n str += getZeroString(e + 1 - len);\r\n if (sd && (k = sd - e - 1) > 0) str = str + '.' + getZeroString(k);\r\n } else {\r\n if ((k = e + 1) < len) str = str.slice(0, k) + '.' + str.slice(k);\r\n if (sd && (k = sd - len) > 0) {\r\n if (e + 1 === len) str += '.';\r\n str += getZeroString(k);\r\n }\r\n }\r\n\r\n return str;\r\n}\r\n\r\n\r\n// Calculate the base 10 exponent from the base 1e7 exponent.\r\nfunction getBase10Exponent(digits, e) {\r\n var w = digits[0];\r\n\r\n // Add the number of digits of the first word of the digits array.\r\n for ( e *= LOG_BASE; w >= 10; w /= 10) e++;\r\n return e;\r\n}\r\n\r\n\r\nfunction getLn10(Ctor, sd, pr) {\r\n if (sd > LN10_PRECISION) {\r\n\r\n // Reset global state in case the exception is caught.\r\n external = true;\r\n if (pr) Ctor.precision = pr;\r\n throw Error(precisionLimitExceeded);\r\n }\r\n return finalise(new Ctor(LN10), sd, 1, true);\r\n}\r\n\r\n\r\nfunction getPi(Ctor, sd, rm) {\r\n if (sd > PI_PRECISION) throw Error(precisionLimitExceeded);\r\n return finalise(new Ctor(PI), sd, rm, true);\r\n}\r\n\r\n\r\nfunction getPrecision(digits) {\r\n var w = digits.length - 1,\r\n len = w * LOG_BASE + 1;\r\n\r\n w = digits[w];\r\n\r\n // If non-zero...\r\n if (w) {\r\n\r\n // Subtract the number of trailing zeros of the last word.\r\n for (; w % 10 == 0; w /= 10) len--;\r\n\r\n // Add the number of digits of the first word.\r\n for (w = digits[0]; w >= 10; w /= 10) len++;\r\n }\r\n\r\n return len;\r\n}\r\n\r\n\r\nfunction getZeroString(k) {\r\n var zs = '';\r\n for (; k--;) zs += '0';\r\n return zs;\r\n}\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the value of Decimal `x` to the power `n`, where `n` is an\r\n * integer of type number.\r\n *\r\n * Implements 'exponentiation by squaring'. Called by `pow` and `parseOther`.\r\n *\r\n */\r\nfunction intPow(Ctor, x, n, pr) {\r\n var isTruncated,\r\n r = new Ctor(1),\r\n\r\n // Max n of 9007199254740991 takes 53 loop iterations.\r\n // Maximum digits array length; leaves [28, 34] guard digits.\r\n k = Math.ceil(pr / LOG_BASE + 4);\r\n\r\n external = false;\r\n\r\n for (;;) {\r\n if (n % 2) {\r\n r = r.times(x);\r\n if (truncate(r.d, k)) isTruncated = true;\r\n }\r\n\r\n n = mathfloor(n / 2);\r\n if (n === 0) {\r\n\r\n // To ensure correct rounding when r.d is truncated, increment the last word if it is zero.\r\n n = r.d.length - 1;\r\n if (isTruncated && r.d[n] === 0) ++r.d[n];\r\n break;\r\n }\r\n\r\n x = x.times(x);\r\n truncate(x.d, k);\r\n }\r\n\r\n external = true;\r\n\r\n return r;\r\n}\r\n\r\n\r\nfunction isOdd(n) {\r\n return n.d[n.d.length - 1] & 1;\r\n}\r\n\r\n\r\n/*\r\n * Handle `max` and `min`. `ltgt` is 'lt' or 'gt'.\r\n */\r\nfunction maxOrMin(Ctor, args, ltgt) {\r\n var y,\r\n x = new Ctor(args[0]),\r\n i = 0;\r\n\r\n for (; ++i < args.length;) {\r\n y = new Ctor(args[i]);\r\n if (!y.s) {\r\n x = y;\r\n break;\r\n } else if (x[ltgt](y)) {\r\n x = y;\r\n }\r\n }\r\n\r\n return x;\r\n}\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the natural exponential of `x` rounded to `sd` significant\r\n * digits.\r\n *\r\n * Taylor/Maclaurin series.\r\n *\r\n * exp(x) = x^0/0! + x^1/1! + x^2/2! + x^3/3! + ...\r\n *\r\n * Argument reduction:\r\n * Repeat x = x / 32, k += 5, until |x| < 0.1\r\n * exp(x) = exp(x / 2^k)^(2^k)\r\n *\r\n * Previously, the argument was initially reduced by\r\n * exp(x) = exp(r) * 10^k where r = x - k * ln10, k = floor(x / ln10)\r\n * to first put r in the range [0, ln10], before dividing by 32 until |x| < 0.1, but this was\r\n * found to be slower than just dividing repeatedly by 32 as above.\r\n *\r\n * Max integer argument: exp('20723265836946413') = 6.3e+9000000000000000\r\n * Min integer argument: exp('-20723265836946411') = 1.2e-9000000000000000\r\n * (Math object integer min/max: Math.exp(709) = 8.2e+307, Math.exp(-745) = 5e-324)\r\n *\r\n * exp(Infinity) = Infinity\r\n * exp(-Infinity) = 0\r\n * exp(NaN) = NaN\r\n * exp(±0) = 1\r\n *\r\n * exp(x) is non-terminating for any finite, non-zero x.\r\n *\r\n * The result will always be correctly rounded.\r\n *\r\n */\r\nfunction naturalExponential(x, sd) {\r\n var denominator, guard, j, pow, sum, t, wpr,\r\n rep = 0,\r\n i = 0,\r\n k = 0,\r\n Ctor = x.constructor,\r\n rm = Ctor.rounding,\r\n pr = Ctor.precision;\r\n\r\n // 0/NaN/Infinity?\r\n if (!x.d || !x.d[0] || x.e > 17) {\r\n\r\n return new Ctor(x.d\r\n ? !x.d[0] ? 1 : x.s < 0 ? 0 : 1 / 0\r\n : x.s ? x.s < 0 ? 0 : x : 0 / 0);\r\n }\r\n\r\n if (sd == null) {\r\n external = false;\r\n wpr = pr;\r\n } else {\r\n wpr = sd;\r\n }\r\n\r\n t = new Ctor(0.03125);\r\n\r\n // while abs(x) >= 0.1\r\n while (x.e > -2) {\r\n\r\n // x = x / 2^5\r\n x = x.times(t);\r\n k += 5;\r\n }\r\n\r\n // Use 2 * log10(2^k) + 5 (empirically derived) to estimate the increase in precision\r\n // necessary to ensure the first 4 rounding digits are correct.\r\n guard = Math.log(mathpow(2, k)) / Math.LN10 * 2 + 5 | 0;\r\n wpr += guard;\r\n denominator = pow = sum = new Ctor(1);\r\n Ctor.precision = wpr;\r\n\r\n for (;;) {\r\n pow = finalise(pow.times(x), wpr, 1);\r\n denominator = denominator.times(++i);\r\n t = sum.plus(divide(pow, denominator, wpr, 1));\r\n\r\n if (digitsToString(t.d).slice(0, wpr) === digitsToString(sum.d).slice(0, wpr)) {\r\n j = k;\r\n while (j--) sum = finalise(sum.times(sum), wpr, 1);\r\n\r\n // Check to see if the first 4 rounding digits are [49]999.\r\n // If so, repeat the summation with a higher precision, otherwise\r\n // e.g. with precision: 18, rounding: 1\r\n // exp(18.404272462595034083567793919843761) = 98372560.1229999999 (should be 98372560.123)\r\n // `wpr - guard` is the index of first rounding digit.\r\n if (sd == null) {\r\n\r\n if (rep < 3 && checkRoundingDigits(sum.d, wpr - guard, rm, rep)) {\r\n Ctor.precision = wpr += 10;\r\n denominator = pow = t = new Ctor(1);\r\n i = 0;\r\n rep++;\r\n } else {\r\n return finalise(sum, Ctor.precision = pr, rm, external = true);\r\n }\r\n } else {\r\n Ctor.precision = pr;\r\n return sum;\r\n }\r\n }\r\n\r\n sum = t;\r\n }\r\n}\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the natural logarithm of `x` rounded to `sd` significant\r\n * digits.\r\n *\r\n * ln(-n) = NaN\r\n * ln(0) = -Infinity\r\n * ln(-0) = -Infinity\r\n * ln(1) = 0\r\n * ln(Infinity) = Infinity\r\n * ln(-Infinity) = NaN\r\n * ln(NaN) = NaN\r\n *\r\n * ln(n) (n != 1) is non-terminating.\r\n *\r\n */\r\nfunction naturalLogarithm(y, sd) {\r\n var c, c0, denominator, e, numerator, rep, sum, t, wpr, x1, x2,\r\n n = 1,\r\n guard = 10,\r\n x = y,\r\n xd = x.d,\r\n Ctor = x.constructor,\r\n rm = Ctor.rounding,\r\n pr = Ctor.precision;\r\n\r\n // Is x negative or Infinity, NaN, 0 or 1?\r\n if (x.s < 0 || !xd || !xd[0] || !x.e && xd[0] == 1 && xd.length == 1) {\r\n return new Ctor(xd && !xd[0] ? -1 / 0 : x.s != 1 ? NaN : xd ? 0 : x);\r\n }\r\n\r\n if (sd == null) {\r\n external = false;\r\n wpr = pr;\r\n } else {\r\n wpr = sd;\r\n }\r\n\r\n Ctor.precision = wpr += guard;\r\n c = digitsToString(xd);\r\n c0 = c.charAt(0);\r\n\r\n if (Math.abs(e = x.e) < 1.5e15) {\r\n\r\n // Argument reduction.\r\n // The series converges faster the closer the argument is to 1, so using\r\n // ln(a^b) = b * ln(a), ln(a) = ln(a^b) / b\r\n // multiply the argument by itself until the leading digits of the significand are 7, 8, 9,\r\n // 10, 11, 12 or 13, recording the number of multiplications so the sum of the series can\r\n // later be divided by this number, then separate out the power of 10 using\r\n // ln(a*10^b) = ln(a) + b*ln(10).\r\n\r\n // max n is 21 (gives 0.9, 1.0 or 1.1) (9e15 / 21 = 4.2e14).\r\n //while (c0 < 9 && c0 != 1 || c0 == 1 && c.charAt(1) > 1) {\r\n // max n is 6 (gives 0.7 - 1.3)\r\n while (c0 < 7 && c0 != 1 || c0 == 1 && c.charAt(1) > 3) {\r\n x = x.times(y);\r\n c = digitsToString(x.d);\r\n c0 = c.charAt(0);\r\n n++;\r\n }\r\n\r\n e = x.e;\r\n\r\n if (c0 > 1) {\r\n x = new Ctor('0.' + c);\r\n e++;\r\n } else {\r\n x = new Ctor(c0 + '.' + c.slice(1));\r\n }\r\n } else {\r\n\r\n // The argument reduction method above may result in overflow if the argument y is a massive\r\n // number with exponent >= 1500000000000000 (9e15 / 6 = 1.5e15), so instead recall this\r\n // function using ln(x*10^e) = ln(x) + e*ln(10).\r\n t = getLn10(Ctor, wpr + 2, pr).times(e + '');\r\n x = naturalLogarithm(new Ctor(c0 + '.' + c.slice(1)), wpr - guard).plus(t);\r\n Ctor.precision = pr;\r\n\r\n return sd == null ? finalise(x, pr, rm, external = true) : x;\r\n }\r\n\r\n // x1 is x reduced to a value near 1.\r\n x1 = x;\r\n\r\n // Taylor series.\r\n // ln(y) = ln((1 + x)/(1 - x)) = 2(x + x^3/3 + x^5/5 + x^7/7 + ...)\r\n // where x = (y - 1)/(y + 1) (|x| < 1)\r\n sum = numerator = x = divide(x.minus(1), x.plus(1), wpr, 1);\r\n x2 = finalise(x.times(x), wpr, 1);\r\n denominator = 3;\r\n\r\n for (;;) {\r\n numerator = finalise(numerator.times(x2), wpr, 1);\r\n t = sum.plus(divide(numerator, new Ctor(denominator), wpr, 1));\r\n\r\n if (digitsToString(t.d).slice(0, wpr) === digitsToString(sum.d).slice(0, wpr)) {\r\n sum = sum.times(2);\r\n\r\n // Reverse the argument reduction. Check that e is not 0 because, besides preventing an\r\n // unnecessary calculation, -0 + 0 = +0 and to ensure correct rounding -0 needs to stay -0.\r\n if (e !== 0) sum = sum.plus(getLn10(Ctor, wpr + 2, pr).times(e + ''));\r\n sum = divide(sum, new Ctor(n), wpr, 1);\r\n\r\n // Is rm > 3 and the first 4 rounding digits 4999, or rm < 4 (or the summation has\r\n // been repeated previously) and the first 4 rounding digits 9999?\r\n // If so, restart the summation with a higher precision, otherwise\r\n // e.g. with precision: 12, rounding: 1\r\n // ln(135520028.6126091714265381533) = 18.7246299999 when it should be 18.72463.\r\n // `wpr - guard` is the index of first rounding digit.\r\n if (sd == null) {\r\n if (checkRoundingDigits(sum.d, wpr - guard, rm, rep)) {\r\n Ctor.precision = wpr += guard;\r\n t = numerator = x = divide(x1.minus(1), x1.plus(1), wpr, 1);\r\n x2 = finalise(x.times(x), wpr, 1);\r\n denominator = rep = 1;\r\n } else {\r\n return finalise(sum, Ctor.precision = pr, rm, external = true);\r\n }\r\n } else {\r\n Ctor.precision = pr;\r\n return sum;\r\n }\r\n }\r\n\r\n sum = t;\r\n denominator += 2;\r\n }\r\n}\r\n\r\n\r\n// ±Infinity, NaN.\r\nfunction nonFiniteToString(x) {\r\n // Unsigned.\r\n return String(x.s * x.s / 0);\r\n}\r\n\r\n\r\n/*\r\n * Parse the value of a new Decimal `x` from string `str`.\r\n */\r\nfunction parseDecimal(x, str) {\r\n var e, i, len;\r\n\r\n // Decimal point?\r\n if ((e = str.indexOf('.')) > -1) str = str.replace('.', '');\r\n\r\n // Exponential form?\r\n if ((i = str.search(/e/i)) > 0) {\r\n\r\n // Determine exponent.\r\n if (e < 0) e = i;\r\n e += +str.slice(i + 1);\r\n str = str.substring(0, i);\r\n } else if (e < 0) {\r\n\r\n // Integer.\r\n e = str.length;\r\n }\r\n\r\n // Determine leading zeros.\r\n for (i = 0; str.charCodeAt(i) === 48; i++);\r\n\r\n // Determine trailing zeros.\r\n for (len = str.length; str.charCodeAt(len - 1) === 48; --len);\r\n str = str.slice(i, len);\r\n\r\n if (str) {\r\n len -= i;\r\n x.e = e = e - i - 1;\r\n x.d = [];\r\n\r\n // Transform base\r\n\r\n // e is the base 10 exponent.\r\n // i is where to slice str to get the first word of the digits array.\r\n i = (e + 1) % LOG_BASE;\r\n if (e < 0) i += LOG_BASE;\r\n\r\n if (i < len) {\r\n if (i) x.d.push(+str.slice(0, i));\r\n for (len -= LOG_BASE; i < len;) x.d.push(+str.slice(i, i += LOG_BASE));\r\n str = str.slice(i);\r\n i = LOG_BASE - str.length;\r\n } else {\r\n i -= len;\r\n }\r\n\r\n for (; i--;) str += '0';\r\n x.d.push(+str);\r\n\r\n if (external) {\r\n\r\n // Overflow?\r\n if (x.e > x.constructor.maxE) {\r\n\r\n // Infinity.\r\n x.d = null;\r\n x.e = NaN;\r\n\r\n // Underflow?\r\n } else if (x.e < x.constructor.minE) {\r\n\r\n // Zero.\r\n x.e = 0;\r\n x.d = [0];\r\n // x.constructor.underflow = true;\r\n } // else x.constructor.underflow = false;\r\n }\r\n } else {\r\n\r\n // Zero.\r\n x.e = 0;\r\n x.d = [0];\r\n }\r\n\r\n return x;\r\n}\r\n\r\n\r\n/*\r\n * Parse the value of a new Decimal `x` from a string `str`, which is not a decimal value.\r\n */\r\nfunction parseOther(x, str) {\r\n var base, Ctor, divisor, i, isFloat, len, p, xd, xe;\r\n\r\n if (str === 'Infinity' || str === 'NaN') {\r\n if (!+str) x.s = NaN;\r\n x.e = NaN;\r\n x.d = null;\r\n return x;\r\n }\r\n\r\n if (isHex.test(str)) {\r\n base = 16;\r\n str = str.toLowerCase();\r\n } else if (isBinary.test(str)) {\r\n base = 2;\r\n } else if (isOctal.test(str)) {\r\n base = 8;\r\n } else {\r\n throw Error(invalidArgument + str);\r\n }\r\n\r\n // Is there a binary exponent part?\r\n i = str.search(/p/i);\r\n\r\n if (i > 0) {\r\n p = +str.slice(i + 1);\r\n str = str.substring(2, i);\r\n } else {\r\n str = str.slice(2);\r\n }\r\n\r\n // Convert `str` as an integer then divide the result by `base` raised to a power such that the\r\n // fraction part will be restored.\r\n i = str.indexOf('.');\r\n isFloat = i >= 0;\r\n Ctor = x.constructor;\r\n\r\n if (isFloat) {\r\n str = str.replace('.', '');\r\n len = str.length;\r\n i = len - i;\r\n\r\n // log[10](16) = 1.2041... , log[10](88) = 1.9444....\r\n divisor = intPow(Ctor, new Ctor(base), i, i * 2);\r\n }\r\n\r\n xd = convertBase(str, base, BASE);\r\n xe = xd.length - 1;\r\n\r\n // Remove trailing zeros.\r\n for (i = xe; xd[i] === 0; --i) xd.pop();\r\n if (i < 0) return new Ctor(x.s * 0);\r\n x.e = getBase10Exponent(xd, xe);\r\n x.d = xd;\r\n external = false;\r\n\r\n // At what precision to perform the division to ensure exact conversion?\r\n // maxDecimalIntegerPartDigitCount = ceil(log[10](b) * otherBaseIntegerPartDigitCount)\r\n // log[10](2) = 0.30103, log[10](8) = 0.90309, log[10](16) = 1.20412\r\n // E.g. ceil(1.2 * 3) = 4, so up to 4 decimal digits are needed to represent 3 hex int digits.\r\n // maxDecimalFractionPartDigitCount = {Hex:4|Oct:3|Bin:1} * otherBaseFractionPartDigitCount\r\n // Therefore using 4 * the number of digits of str will always be enough.\r\n if (isFloat) x = divide(x, divisor, len * 4);\r\n\r\n // Multiply by the binary exponent part if present.\r\n if (p) x = x.times(Math.abs(p) < 54 ? Math.pow(2, p) : Decimal.pow(2, p));\r\n external = true;\r\n\r\n return x;\r\n}\r\n\r\n\r\n/*\r\n * sin(x) = x - x^3/3! + x^5/5! - ...\r\n * |x| < pi/2\r\n *\r\n */\r\nfunction sine(Ctor, x) {\r\n var k,\r\n len = x.d.length;\r\n\r\n if (len < 3) return taylorSeries(Ctor, 2, x, x);\r\n\r\n // Argument reduction: sin(5x) = 16*sin^5(x) - 20*sin^3(x) + 5*sin(x)\r\n // i.e. sin(x) = 16*sin^5(x/5) - 20*sin^3(x/5) + 5*sin(x/5)\r\n // and sin(x) = sin(x/5)(5 + sin^2(x/5)(16sin^2(x/5) - 20))\r\n\r\n // Estimate the optimum number of times to use the argument reduction.\r\n k = 1.4 * Math.sqrt(len);\r\n k = k > 16 ? 16 : k | 0;\r\n\r\n // Max k before Math.pow precision loss is 22\r\n x = x.times(Math.pow(5, -k));\r\n x = taylorSeries(Ctor, 2, x, x);\r\n\r\n // Reverse argument reduction\r\n var sin2_x,\r\n d5 = new Ctor(5),\r\n d16 = new Ctor(16),\r\n d20 = new Ctor(20);\r\n for (; k--;) {\r\n sin2_x = x.times(x);\r\n x = x.times(d5.plus(sin2_x.times(d16.times(sin2_x).minus(d20))));\r\n }\r\n\r\n return x;\r\n}\r\n\r\n\r\n// Calculate Taylor series for `cos`, `cosh`, `sin` and `sinh`.\r\nfunction taylorSeries(Ctor, n, x, y, isHyperbolic) {\r\n var j, t, u, x2,\r\n i = 1,\r\n pr = Ctor.precision,\r\n k = Math.ceil(pr / LOG_BASE);\r\n\r\n external = false;\r\n x2 = x.times(x);\r\n u = new Ctor(y);\r\n\r\n for (;;) {\r\n t = divide(u.times(x2), new Ctor(n++ * n++), pr, 1);\r\n u = isHyperbolic ? y.plus(t) : y.minus(t);\r\n y = divide(t.times(x2), new Ctor(n++ * n++), pr, 1);\r\n t = u.plus(y);\r\n\r\n if (t.d[k] !== void 0) {\r\n for (j = k; t.d[j] === u.d[j] && j--;);\r\n if (j == -1) break;\r\n }\r\n\r\n j = u;\r\n u = y;\r\n y = t;\r\n t = j;\r\n i++;\r\n }\r\n\r\n external = true;\r\n t.d.length = k + 1;\r\n\r\n return t;\r\n}\r\n\r\n\r\n// Return the absolute value of `x` reduced to less than or equal to half pi.\r\nfunction toLessThanHalfPi(Ctor, x) {\r\n var t,\r\n isNeg = x.s < 0,\r\n pi = getPi(Ctor, Ctor.precision, 1),\r\n halfPi = pi.times(0.5);\r\n\r\n x = x.abs();\r\n\r\n if (x.lte(halfPi)) {\r\n quadrant = isNeg ? 4 : 1;\r\n return x;\r\n }\r\n\r\n t = x.divToInt(pi);\r\n\r\n if (t.isZero()) {\r\n quadrant = isNeg ? 3 : 2;\r\n } else {\r\n x = x.minus(t.times(pi));\r\n\r\n // 0 <= x < pi\r\n if (x.lte(halfPi)) {\r\n quadrant = isOdd(t) ? (isNeg ? 2 : 3) : (isNeg ? 4 : 1);\r\n return x;\r\n }\r\n\r\n quadrant = isOdd(t) ? (isNeg ? 1 : 4) : (isNeg ? 3 : 2);\r\n }\r\n\r\n return x.minus(pi).abs();\r\n}\r\n\r\n\r\n/*\r\n * Return the value of Decimal `x` as a string in base `baseOut`.\r\n *\r\n * If the optional `sd` argument is present include a binary exponent suffix.\r\n */\r\nfunction toStringBinary(x, baseOut, sd, rm) {\r\n var base, e, i, k, len, roundUp, str, xd, y,\r\n Ctor = x.constructor,\r\n isExp = sd !== void 0;\r\n\r\n if (isExp) {\r\n checkInt32(sd, 1, MAX_DIGITS);\r\n if (rm === void 0) rm = Ctor.rounding;\r\n else checkInt32(rm, 0, 8);\r\n } else {\r\n sd = Ctor.precision;\r\n rm = Ctor.rounding;\r\n }\r\n\r\n if (!x.isFinite()) {\r\n str = nonFiniteToString(x);\r\n } else {\r\n str = finiteToString(x);\r\n i = str.indexOf('.');\r\n\r\n // Use exponential notation according to `toExpPos` and `toExpNeg`? No, but if required:\r\n // maxBinaryExponent = floor((decimalExponent + 1) * log[2](10))\r\n // minBinaryExponent = floor(decimalExponent * log[2](10))\r\n // log[2](10) = 3.321928094887362347870319429489390175864\r\n\r\n if (isExp) {\r\n base = 2;\r\n if (baseOut == 16) {\r\n sd = sd * 4 - 3;\r\n } else if (baseOut == 8) {\r\n sd = sd * 3 - 2;\r\n }\r\n } else {\r\n base = baseOut;\r\n }\r\n\r\n // Convert the number as an integer then divide the result by its base raised to a power such\r\n // that the fraction part will be restored.\r\n\r\n // Non-integer.\r\n if (i >= 0) {\r\n str = str.replace('.', '');\r\n y = new Ctor(1);\r\n y.e = str.length - i;\r\n y.d = convertBase(finiteToString(y), 10, base);\r\n y.e = y.d.length;\r\n }\r\n\r\n xd = convertBase(str, 10, base);\r\n e = len = xd.length;\r\n\r\n // Remove trailing zeros.\r\n for (; xd[--len] == 0;) xd.pop();\r\n\r\n if (!xd[0]) {\r\n str = isExp ? '0p+0' : '0';\r\n } else {\r\n if (i < 0) {\r\n e--;\r\n } else {\r\n x = new Ctor(x);\r\n x.d = xd;\r\n x.e = e;\r\n x = divide(x, y, sd, rm, 0, base);\r\n xd = x.d;\r\n e = x.e;\r\n roundUp = inexact;\r\n }\r\n\r\n // The rounding digit, i.e. the digit after the digit that may be rounded up.\r\n i = xd[sd];\r\n k = base / 2;\r\n roundUp = roundUp || xd[sd + 1] !== void 0;\r\n\r\n roundUp = rm < 4\r\n ? (i !== void 0 || roundUp) && (rm === 0 || rm === (x.s < 0 ? 3 : 2))\r\n : i > k || i === k && (rm === 4 || roundUp || rm === 6 && xd[sd - 1] & 1 ||\r\n rm === (x.s < 0 ? 8 : 7));\r\n\r\n xd.length = sd;\r\n\r\n if (roundUp) {\r\n\r\n // Rounding up may mean the previous digit has to be rounded up and so on.\r\n for (; ++xd[--sd] > base - 1;) {\r\n xd[sd] = 0;\r\n if (!sd) {\r\n ++e;\r\n xd.unshift(1);\r\n }\r\n }\r\n }\r\n\r\n // Determine trailing zeros.\r\n for (len = xd.length; !xd[len - 1]; --len);\r\n\r\n // E.g. [4, 11, 15] becomes 4bf.\r\n for (i = 0, str = ''; i < len; i++) str += NUMERALS.charAt(xd[i]);\r\n\r\n // Add binary exponent suffix?\r\n if (isExp) {\r\n if (len > 1) {\r\n if (baseOut == 16 || baseOut == 8) {\r\n i = baseOut == 16 ? 4 : 3;\r\n for (--len; len % i; len++) str += '0';\r\n xd = convertBase(str, base, baseOut);\r\n for (len = xd.length; !xd[len - 1]; --len);\r\n\r\n // xd[0] will always be be 1\r\n for (i = 1, str = '1.'; i < len; i++) str += NUMERALS.charAt(xd[i]);\r\n } else {\r\n str = str.charAt(0) + '.' + str.slice(1);\r\n }\r\n }\r\n\r\n str = str + (e < 0 ? 'p' : 'p+') + e;\r\n } else if (e < 0) {\r\n for (; ++e;) str = '0' + str;\r\n str = '0.' + str;\r\n } else {\r\n if (++e > len) for (e -= len; e-- ;) str += '0';\r\n else if (e < len) str = str.slice(0, e) + '.' + str.slice(e);\r\n }\r\n }\r\n\r\n str = (baseOut == 16 ? '0x' : baseOut == 2 ? '0b' : baseOut == 8 ? '0o' : '') + str;\r\n }\r\n\r\n return x.s < 0 ? '-' + str : str;\r\n}\r\n\r\n\r\n// Does not strip trailing zeros.\r\nfunction truncate(arr, len) {\r\n if (arr.length > len) {\r\n arr.length = len;\r\n return true;\r\n }\r\n}\r\n\r\n\r\n// Decimal methods\r\n\r\n\r\n/*\r\n * abs\r\n * acos\r\n * acosh\r\n * add\r\n * asin\r\n * asinh\r\n * atan\r\n * atanh\r\n * atan2\r\n * cbrt\r\n * ceil\r\n * clone\r\n * config\r\n * cos\r\n * cosh\r\n * div\r\n * exp\r\n * floor\r\n * hypot\r\n * ln\r\n * log\r\n * log2\r\n * log10\r\n * max\r\n * min\r\n * mod\r\n * mul\r\n * pow\r\n * random\r\n * round\r\n * set\r\n * sign\r\n * sin\r\n * sinh\r\n * sqrt\r\n * sub\r\n * tan\r\n * tanh\r\n * trunc\r\n */\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the absolute value of `x`.\r\n *\r\n * x {number|string|Decimal}\r\n *\r\n */\r\nfunction abs(x) {\r\n return new this(x).abs();\r\n}\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the arccosine in radians of `x`.\r\n *\r\n * x {number|string|Decimal}\r\n *\r\n */\r\nfunction acos(x) {\r\n return new this(x).acos();\r\n}\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the inverse of the hyperbolic cosine of `x`, rounded to\r\n * `precision` significant digits using rounding mode `rounding`.\r\n *\r\n * x {number|string|Decimal} A value in radians.\r\n *\r\n */\r\nfunction acosh(x) {\r\n return new this(x).acosh();\r\n}\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the sum of `x` and `y`, rounded to `precision` significant\r\n * digits using rounding mode `rounding`.\r\n *\r\n * x {number|string|Decimal}\r\n * y {number|string|Decimal}\r\n *\r\n */\r\nfunction add(x, y) {\r\n return new this(x).plus(y);\r\n}\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the arcsine in radians of `x`, rounded to `precision`\r\n * significant digits using rounding mode `rounding`.\r\n *\r\n * x {number|string|Decimal}\r\n *\r\n */\r\nfunction asin(x) {\r\n return new this(x).asin();\r\n}\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the inverse of the hyperbolic sine of `x`, rounded to\r\n * `precision` significant digits using rounding mode `rounding`.\r\n *\r\n * x {number|string|Decimal} A value in radians.\r\n *\r\n */\r\nfunction asinh(x) {\r\n return new this(x).asinh();\r\n}\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the arctangent in radians of `x`, rounded to `precision`\r\n * significant digits using rounding mode `rounding`.\r\n *\r\n * x {number|string|Decimal}\r\n *\r\n */\r\nfunction atan(x) {\r\n return new this(x).atan();\r\n}\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the inverse of the hyperbolic tangent of `x`, rounded to\r\n * `precision` significant digits using rounding mode `rounding`.\r\n *\r\n * x {number|string|Decimal} A value in radians.\r\n *\r\n */\r\nfunction atanh(x) {\r\n return new this(x).atanh();\r\n}\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the arctangent in radians of `y/x` in the range -pi to pi\r\n * (inclusive), rounded to `precision` significant digits using rounding mode `rounding`.\r\n *\r\n * Domain: [-Infinity, Infinity]\r\n * Range: [-pi, pi]\r\n *\r\n * y {number|string|Decimal} The y-coordinate.\r\n * x {number|string|Decimal} The x-coordinate.\r\n *\r\n * atan2(±0, -0) = ±pi\r\n * atan2(±0, +0) = ±0\r\n * atan2(±0, -x) = ±pi for x > 0\r\n * atan2(±0, x) = ±0 for x > 0\r\n * atan2(-y, ±0) = -pi/2 for y > 0\r\n * atan2(y, ±0) = pi/2 for y > 0\r\n * atan2(±y, -Infinity) = ±pi for finite y > 0\r\n * atan2(±y, +Infinity) = ±0 for finite y > 0\r\n * atan2(±Infinity, x) = ±pi/2 for finite x\r\n * atan2(±Infinity, -Infinity) = ±3*pi/4\r\n * atan2(±Infinity, +Infinity) = ±pi/4\r\n * atan2(NaN, x) = NaN\r\n * atan2(y, NaN) = NaN\r\n *\r\n */\r\nfunction atan2(y, x) {\r\n y = new this(y);\r\n x = new this(x);\r\n var r,\r\n pr = this.precision,\r\n rm = this.rounding,\r\n wpr = pr + 4;\r\n\r\n // Either NaN\r\n if (!y.s || !x.s) {\r\n r = new this(NaN);\r\n\r\n // Both ±Infinity\r\n } else if (!y.d && !x.d) {\r\n r = getPi(this, wpr, 1).times(x.s > 0 ? 0.25 : 0.75);\r\n r.s = y.s;\r\n\r\n // x is ±Infinity or y is ±0\r\n } else if (!x.d || y.isZero()) {\r\n r = x.s < 0 ? getPi(this, pr, rm) : new this(0);\r\n r.s = y.s;\r\n\r\n // y is ±Infinity or x is ±0\r\n } else if (!y.d || x.isZero()) {\r\n r = getPi(this, wpr, 1).times(0.5);\r\n r.s = y.s;\r\n\r\n // Both non-zero and finite\r\n } else if (x.s < 0) {\r\n this.precision = wpr;\r\n this.rounding = 1;\r\n r = this.atan(divide(y, x, wpr, 1));\r\n x = getPi(this, wpr, 1);\r\n this.precision = pr;\r\n this.rounding = rm;\r\n r = y.s < 0 ? r.minus(x) : r.plus(x);\r\n } else {\r\n r = this.atan(divide(y, x, wpr, 1));\r\n }\r\n\r\n return r;\r\n}\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the cube root of `x`, rounded to `precision` significant\r\n * digits using rounding mode `rounding`.\r\n *\r\n * x {number|string|Decimal}\r\n *\r\n */\r\nfunction cbrt(x) {\r\n return new this(x).cbrt();\r\n}\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is `x` rounded to an integer using `ROUND_CEIL`.\r\n *\r\n * x {number|string|Decimal}\r\n *\r\n */\r\nfunction ceil(x) {\r\n return finalise(x = new this(x), x.e + 1, 2);\r\n}\r\n\r\n\r\n/*\r\n * Configure global settings for a Decimal constructor.\r\n *\r\n * `obj` is an object with one or more of the following properties,\r\n *\r\n * precision {number}\r\n * rounding {number}\r\n * toExpNeg {number}\r\n * toExpPos {number}\r\n * maxE {number}\r\n * minE {number}\r\n * modulo {number}\r\n * crypto {boolean|number}\r\n *\r\n * E.g. Decimal.config({ precision: 20, rounding: 4 })\r\n *\r\n */\r\nfunction config(obj) {\r\n if (!obj || typeof obj !== 'object') throw Error(decimalError + 'Object expected');\r\n var i, p, v,\r\n ps = [\r\n 'precision', 1, MAX_DIGITS,\r\n 'rounding', 0, 8,\r\n 'toExpNeg', -EXP_LIMIT, 0,\r\n 'toExpPos', 0, EXP_LIMIT,\r\n 'maxE', 0, EXP_LIMIT,\r\n 'minE', -EXP_LIMIT, 0,\r\n 'modulo', 0, 9\r\n ];\r\n\r\n for (i = 0; i < ps.length; i += 3) {\r\n if ((v = obj[p = ps[i]]) !== void 0) {\r\n if (mathfloor(v) === v && v >= ps[i + 1] && v <= ps[i + 2]) this[p] = v;\r\n else throw Error(invalidArgument + p + ': ' + v);\r\n }\r\n }\r\n\r\n if ((v = obj[p = 'crypto']) !== void 0) {\r\n if (v === true || v === false || v === 0 || v === 1) {\r\n if (v) {\r\n if (typeof crypto != 'undefined' && crypto &&\r\n (crypto.getRandomValues || crypto.randomBytes)) {\r\n this[p] = true;\r\n } else {\r\n throw Error(cryptoUnavailable);\r\n }\r\n } else {\r\n this[p] = false;\r\n }\r\n } else {\r\n throw Error(invalidArgument + p + ': ' + v);\r\n }\r\n }\r\n\r\n return this;\r\n}\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the cosine of `x`, rounded to `precision` significant\r\n * digits using rounding mode `rounding`.\r\n *\r\n * x {number|string|Decimal} A value in radians.\r\n *\r\n */\r\nfunction cos(x) {\r\n return new this(x).cos();\r\n}\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the hyperbolic cosine of `x`, rounded to precision\r\n * significant digits using rounding mode `rounding`.\r\n *\r\n * x {number|string|Decimal} A value in radians.\r\n *\r\n */\r\nfunction cosh(x) {\r\n return new this(x).cosh();\r\n}\r\n\r\n\r\n/*\r\n * Create and return a Decimal constructor with the same configuration properties as this Decimal\r\n * constructor.\r\n *\r\n */\r\nfunction clone(obj) {\r\n var i, p, ps;\r\n\r\n /*\r\n * The Decimal constructor and exported function.\r\n * Return a new Decimal instance.\r\n *\r\n * v {number|string|Decimal} A numeric value.\r\n *\r\n */\r\n function Decimal(v) {\r\n var e, i, t,\r\n x = this;\r\n\r\n // Decimal called without new.\r\n if (!(x instanceof Decimal)) return new Decimal(v);\r\n\r\n // Retain a reference to this Decimal constructor, and shadow Decimal.prototype.constructor\r\n // which points to Object.\r\n x.constructor = Decimal;\r\n\r\n // Duplicate.\r\n if (v instanceof Decimal) {\r\n x.s = v.s;\r\n x.e = v.e;\r\n x.d = (v = v.d) ? v.slice() : v;\r\n return;\r\n }\r\n\r\n t = typeof v;\r\n\r\n if (t === 'number') {\r\n if (v === 0) {\r\n x.s = 1 / v < 0 ? -1 : 1;\r\n x.e = 0;\r\n x.d = [0];\r\n return;\r\n }\r\n\r\n if (v < 0) {\r\n v = -v;\r\n x.s = -1;\r\n } else {\r\n x.s = 1;\r\n }\r\n\r\n // Fast path for small integers.\r\n if (v === ~~v && v < 1e7) {\r\n for (e = 0, i = v; i >= 10; i /= 10) e++;\r\n x.e = e;\r\n x.d = [v];\r\n return;\r\n\r\n // Infinity, NaN.\r\n } else if (v * 0 !== 0) {\r\n if (!v) x.s = NaN;\r\n x.e = NaN;\r\n x.d = null;\r\n return;\r\n }\r\n\r\n return parseDecimal(x, v.toString());\r\n\r\n } else if (t !== 'string') {\r\n throw Error(invalidArgument + v);\r\n }\r\n\r\n // Minus sign?\r\n if (v.charCodeAt(0) === 45) {\r\n v = v.slice(1);\r\n x.s = -1;\r\n } else {\r\n x.s = 1;\r\n }\r\n\r\n return isDecimal.test(v) ? parseDecimal(x, v) : parseOther(x, v);\r\n }\r\n\r\n Decimal.prototype = P;\r\n\r\n Decimal.ROUND_UP = 0;\r\n Decimal.ROUND_DOWN = 1;\r\n Decimal.ROUND_CEIL = 2;\r\n Decimal.ROUND_FLOOR = 3;\r\n Decimal.ROUND_HALF_UP = 4;\r\n Decimal.ROUND_HALF_DOWN = 5;\r\n Decimal.ROUND_HALF_EVEN = 6;\r\n Decimal.ROUND_HALF_CEIL = 7;\r\n Decimal.ROUND_HALF_FLOOR = 8;\r\n Decimal.EUCLID = 9;\r\n\r\n Decimal.config = Decimal.set = config;\r\n Decimal.clone = clone;\r\n\r\n Decimal.abs = abs;\r\n Decimal.acos = acos;\r\n Decimal.acosh = acosh; // ES6\r\n Decimal.add = add;\r\n Decimal.asin = asin;\r\n Decimal.asinh = asinh; // ES6\r\n Decimal.atan = atan;\r\n Decimal.atanh = atanh; // ES6\r\n Decimal.atan2 = atan2;\r\n Decimal.cbrt = cbrt; // ES6\r\n Decimal.ceil = ceil;\r\n Decimal.cos = cos;\r\n Decimal.cosh = cosh; // ES6\r\n Decimal.div = div;\r\n Decimal.exp = exp;\r\n Decimal.floor = floor;\r\n Decimal.hypot = hypot; // ES6\r\n Decimal.ln = ln;\r\n Decimal.log = log;\r\n Decimal.log10 = log10; // ES6\r\n Decimal.log2 = log2; // ES6\r\n Decimal.max = max;\r\n Decimal.min = min;\r\n Decimal.mod = mod;\r\n Decimal.mul = mul;\r\n Decimal.pow = pow;\r\n Decimal.random = random;\r\n Decimal.round = round;\r\n Decimal.sign = sign; // ES6\r\n Decimal.sin = sin;\r\n Decimal.sinh = sinh; // ES6\r\n Decimal.sqrt = sqrt;\r\n Decimal.sub = sub;\r\n Decimal.tan = tan;\r\n Decimal.tanh = tanh; // ES6\r\n Decimal.trunc = trunc; // ES6\r\n\r\n if (obj === void 0) obj = {};\r\n if (obj) {\r\n ps = ['precision', 'rounding', 'toExpNeg', 'toExpPos', 'maxE', 'minE', 'modulo', 'crypto'];\r\n for (i = 0; i < ps.length;) if (!obj.hasOwnProperty(p = ps[i++])) obj[p] = this[p];\r\n }\r\n\r\n Decimal.config(obj);\r\n\r\n return Decimal;\r\n}\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is `x` divided by `y`, rounded to `precision` significant\r\n * digits using rounding mode `rounding`.\r\n *\r\n * x {number|string|Decimal}\r\n * y {number|string|Decimal}\r\n *\r\n */\r\nfunction div(x, y) {\r\n return new this(x).div(y);\r\n}\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the natural exponential of `x`, rounded to `precision`\r\n * significant digits using rounding mode `rounding`.\r\n *\r\n * x {number|string|Decimal} The power to which to raise the base of the natural log.\r\n *\r\n */\r\nfunction exp(x) {\r\n return new this(x).exp();\r\n}\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is `x` round to an integer using `ROUND_FLOOR`.\r\n *\r\n * x {number|string|Decimal}\r\n *\r\n */\r\nfunction floor(x) {\r\n return finalise(x = new this(x), x.e + 1, 3);\r\n}\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the square root of the sum of the squares of the arguments,\r\n * rounded to `precision` significant digits using rounding mode `rounding`.\r\n *\r\n * hypot(a, b, ...) = sqrt(a^2 + b^2 + ...)\r\n *\r\n */\r\nfunction hypot() {\r\n var i, n,\r\n t = new this(0);\r\n\r\n external = false;\r\n\r\n for (i = 0; i < arguments.length;) {\r\n n = new this(arguments[i++]);\r\n if (!n.d) {\r\n if (n.s) {\r\n external = true;\r\n return new this(1 / 0);\r\n }\r\n t = n;\r\n } else if (t.d) {\r\n t = t.plus(n.times(n));\r\n }\r\n }\r\n\r\n external = true;\r\n\r\n return t.sqrt();\r\n}\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the natural logarithm of `x`, rounded to `precision`\r\n * significant digits using rounding mode `rounding`.\r\n *\r\n * x {number|string|Decimal}\r\n *\r\n */\r\nfunction ln(x) {\r\n return new this(x).ln();\r\n}\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the log of `x` to the base `y`, or to base 10 if no base\r\n * is specified, rounded to `precision` significant digits using rounding mode `rounding`.\r\n *\r\n * log[y](x)\r\n *\r\n * x {number|string|Decimal} The argument of the logarithm.\r\n * y {number|string|Decimal} The base of the logarithm.\r\n *\r\n */\r\nfunction log(x, y) {\r\n return new this(x).log(y);\r\n}\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the base 2 logarithm of `x`, rounded to `precision`\r\n * significant digits using rounding mode `rounding`.\r\n *\r\n * x {number|string|Decimal}\r\n *\r\n */\r\nfunction log2(x) {\r\n return new this(x).log(2);\r\n}\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the base 10 logarithm of `x`, rounded to `precision`\r\n * significant digits using rounding mode `rounding`.\r\n *\r\n * x {number|string|Decimal}\r\n *\r\n */\r\nfunction log10(x) {\r\n return new this(x).log(10);\r\n}\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the maximum of the arguments.\r\n *\r\n * arguments {number|string|Decimal}\r\n *\r\n */\r\nfunction max() {\r\n return maxOrMin(this, arguments, 'lt');\r\n}\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the minimum of the arguments.\r\n *\r\n * arguments {number|string|Decimal}\r\n *\r\n */\r\nfunction min() {\r\n return maxOrMin(this, arguments, 'gt');\r\n}\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is `x` modulo `y`, rounded to `precision` significant digits\r\n * using rounding mode `rounding`.\r\n *\r\n * x {number|string|Decimal}\r\n * y {number|string|Decimal}\r\n *\r\n */\r\nfunction mod(x, y) {\r\n return new this(x).mod(y);\r\n}\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is `x` multiplied by `y`, rounded to `precision` significant\r\n * digits using rounding mode `rounding`.\r\n *\r\n * x {number|string|Decimal}\r\n * y {number|string|Decimal}\r\n *\r\n */\r\nfunction mul(x, y) {\r\n return new this(x).mul(y);\r\n}\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is `x` raised to the power `y`, rounded to precision\r\n * significant digits using rounding mode `rounding`.\r\n *\r\n * x {number|string|Decimal} The base.\r\n * y {number|string|Decimal} The exponent.\r\n *\r\n */\r\nfunction pow(x, y) {\r\n return new this(x).pow(y);\r\n}\r\n\r\n\r\n/*\r\n * Returns a new Decimal with a random value equal to or greater than 0 and less than 1, and with\r\n * `sd`, or `Decimal.precision` if `sd` is omitted, significant digits (or less if trailing zeros\r\n * are produced).\r\n *\r\n * [sd] {number} Significant digits. Integer, 0 to MAX_DIGITS inclusive.\r\n *\r\n */\r\nfunction random(sd) {\r\n var d, e, k, n,\r\n i = 0,\r\n r = new this(1),\r\n rd = [];\r\n\r\n if (sd === void 0) sd = this.precision;\r\n else checkInt32(sd, 1, MAX_DIGITS);\r\n\r\n k = Math.ceil(sd / LOG_BASE);\r\n\r\n if (!this.crypto) {\r\n for (; i < k;) rd[i++] = Math.random() * 1e7 | 0;\r\n\r\n // Browsers supporting crypto.getRandomValues.\r\n } else if (crypto.getRandomValues) {\r\n d = crypto.getRandomValues(new Uint32Array(k));\r\n\r\n for (; i < k;) {\r\n n = d[i];\r\n\r\n // 0 <= n < 4294967296\r\n // Probability n >= 4.29e9, is 4967296 / 4294967296 = 0.00116 (1 in 865).\r\n if (n >= 4.29e9) {\r\n d[i] = crypto.getRandomValues(new Uint32Array(1))[0];\r\n } else {\r\n\r\n // 0 <= n <= 4289999999\r\n // 0 <= (n % 1e7) <= 9999999\r\n rd[i++] = n % 1e7;\r\n }\r\n }\r\n\r\n // Node.js supporting crypto.randomBytes.\r\n } else if (crypto.randomBytes) {\r\n\r\n // buffer\r\n d = crypto.randomBytes(k *= 4);\r\n\r\n for (; i < k;) {\r\n\r\n // 0 <= n < 2147483648\r\n n = d[i] + (d[i + 1] << 8) + (d[i + 2] << 16) + ((d[i + 3] & 0x7f) << 24);\r\n\r\n // Probability n >= 2.14e9, is 7483648 / 2147483648 = 0.0035 (1 in 286).\r\n if (n >= 2.14e9) {\r\n crypto.randomBytes(4).copy(d, i);\r\n } else {\r\n\r\n // 0 <= n <= 2139999999\r\n // 0 <= (n % 1e7) <= 9999999\r\n rd.push(n % 1e7);\r\n i += 4;\r\n }\r\n }\r\n\r\n i = k / 4;\r\n } else {\r\n throw Error(cryptoUnavailable);\r\n }\r\n\r\n k = rd[--i];\r\n sd %= LOG_BASE;\r\n\r\n // Convert trailing digits to zeros according to sd.\r\n if (k && sd) {\r\n n = mathpow(10, LOG_BASE - sd);\r\n rd[i] = (k / n | 0) * n;\r\n }\r\n\r\n // Remove trailing words which are zero.\r\n for (; rd[i] === 0; i--) rd.pop();\r\n\r\n // Zero?\r\n if (i < 0) {\r\n e = 0;\r\n rd = [0];\r\n } else {\r\n e = -1;\r\n\r\n // Remove leading words which are zero and adjust exponent accordingly.\r\n for (; rd[0] === 0; e -= LOG_BASE) rd.shift();\r\n\r\n // Count the digits of the first word of rd to determine leading zeros.\r\n for (k = 1, n = rd[0]; n >= 10; n /= 10) k++;\r\n\r\n // Adjust the exponent for leading zeros of the first word of rd.\r\n if (k < LOG_BASE) e -= LOG_BASE - k;\r\n }\r\n\r\n r.e = e;\r\n r.d = rd;\r\n\r\n return r;\r\n}\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is `x` rounded to an integer using rounding mode `rounding`.\r\n *\r\n * To emulate `Math.round`, set rounding to 7 (ROUND_HALF_CEIL).\r\n *\r\n * x {number|string|Decimal}\r\n *\r\n */\r\nfunction round(x) {\r\n return finalise(x = new this(x), x.e + 1, this.rounding);\r\n}\r\n\r\n\r\n/*\r\n * Return\r\n * 1 if x > 0,\r\n * -1 if x < 0,\r\n * 0 if x is 0,\r\n * -0 if x is -0,\r\n * NaN otherwise\r\n *\r\n */\r\nfunction sign(x) {\r\n x = new this(x);\r\n return x.d ? (x.d[0] ? x.s : 0 * x.s) : x.s || NaN;\r\n}\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the sine of `x`, rounded to `precision` significant digits\r\n * using rounding mode `rounding`.\r\n *\r\n * x {number|string|Decimal} A value in radians.\r\n *\r\n */\r\nfunction sin(x) {\r\n return new this(x).sin();\r\n}\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the hyperbolic sine of `x`, rounded to `precision`\r\n * significant digits using rounding mode `rounding`.\r\n *\r\n * x {number|string|Decimal} A value in radians.\r\n *\r\n */\r\nfunction sinh(x) {\r\n return new this(x).sinh();\r\n}\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the square root of `x`, rounded to `precision` significant\r\n * digits using rounding mode `rounding`.\r\n *\r\n * x {number|string|Decimal}\r\n *\r\n */\r\nfunction sqrt(x) {\r\n return new this(x).sqrt();\r\n}\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is `x` minus `y`, rounded to `precision` significant digits\r\n * using rounding mode `rounding`.\r\n *\r\n * x {number|string|Decimal}\r\n * y {number|string|Decimal}\r\n *\r\n */\r\nfunction sub(x, y) {\r\n return new this(x).sub(y);\r\n}\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the tangent of `x`, rounded to `precision` significant\r\n * digits using rounding mode `rounding`.\r\n *\r\n * x {number|string|Decimal} A value in radians.\r\n *\r\n */\r\nfunction tan(x) {\r\n return new this(x).tan();\r\n}\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the hyperbolic tangent of `x`, rounded to `precision`\r\n * significant digits using rounding mode `rounding`.\r\n *\r\n * x {number|string|Decimal} A value in radians.\r\n *\r\n */\r\nfunction tanh(x) {\r\n return new this(x).tanh();\r\n}\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is `x` truncated to an integer.\r\n *\r\n * x {number|string|Decimal}\r\n *\r\n */\r\nfunction trunc(x) {\r\n return finalise(x = new this(x), x.e + 1, 1);\r\n}\r\n\r\n\r\n// Create and configure initial Decimal constructor.\r\nDecimal = clone(defaults);\r\n\r\n// Create the internal constants from their string values.\r\nLN10 = new Decimal(ln10);\r\nPI = new Decimal(pi);\r\n\r\nexport default Decimal;\r\n","import {Engine} from \"./engine.js\";\r\nimport {Player} from \"./Player.js\";\r\nimport {dialogBoxCreate} from \"../utils/DialogBox.js\";\r\nimport {clearEventListeners} from \"../utils/HelperFunctions.js\";\r\n\r\n/* InteractiveTutorial.js */\r\nlet iTutorialSteps = {\r\n Start: \"Start\",\r\n GoToCharacterPage: \"Click on the Character page menu link\",\r\n CharacterPage: \"Introduction to Character page\",\r\n CharacterGoToTerminalPage: \"Click on the Terminal link\",\r\n TerminalIntro: \"Introduction to terminal interface\",\r\n TerminalHelp: \"Using the help command to display all options in terminal\",\r\n TerminalLs: \"Use the ls command to show all programs/scripts. Right now we have NUKE.exe\",\r\n TerminalScan: \"Using the scan command to display all available connections\",\r\n TerminalScanAnalyze1: \"Use the scan-analyze command to show hacking related information\",\r\n TerminalScanAnalyze2: \"Use the scan-analyze command with a depth of 3\",\r\n TerminalConnect: \"Using the telnet/connect command to connect to another server\",\r\n TerminalAnalyze: \"Use the analyze command to display details about this server\",\r\n TerminalNuke: \"Use the NUKE Program to gain root access to a server\",\r\n TerminalManualHack: \"Use the hack command to manually hack a server\",\r\n TerminalHackingMechanics: \"Briefly explain hacking mechanics\",\r\n TerminalCreateScript: \"Create a script using nano\",\r\n TerminalTypeScript: \"This occurs in the Script Editor page...type the script then save and close\",\r\n TerminalFree: \"Use the free command to check RAM\",\r\n TerminalRunScript: \"Use the run command to run a script\",\r\n TerminalGoToActiveScriptsPage: \"Go to the ActiveScriptsPage\",\r\n ActiveScriptsPage: \"Introduction to the Active Scripts Page\",\r\n ActiveScriptsToTerminal: \"Go from Active Scripts Page Back to Terminal\",\r\n TerminalTailScript: \"Use the tail command to show a script's logs\",\r\n GoToHacknetNodesPage: \"Go to the Hacknet Nodes page\",\r\n HacknetNodesIntroduction: \"Introduction to Hacknet Nodesm and have user purchase one\",\r\n HacknetNodesGoToWorldPage: \"Go to the world page\",\r\n WorldDescription: \"Tell the user to explore..theres a lot of different stuff to do out there\",\r\n TutorialPageInfo: \"The tutorial page contains a lot of info on different subjects\",\r\n End: \"End\",\r\n}\r\n\r\nvar currITutorialStep = iTutorialSteps.Start;\r\nvar iTutorialIsRunning = false;\r\n\r\nfunction iTutorialStart() {\r\n //Don't autosave during this interactive tutorial\r\n Engine.Counters.autoSaveCounter = 999000000000;\r\n console.log(\"Interactive Tutorial started\");\r\n currITutorialStep = iTutorialSteps.Start;\r\n iTutorialIsRunning = true;\r\n\r\n document.getElementById(\"interactive-tutorial-container\").style.display = \"block\";\r\n\r\n iTutorialEvaluateStep();\r\n\r\n //Exit tutorial button\r\n var exitButton = clearEventListeners(\"interactive-tutorial-exit\");\r\n exitButton.addEventListener(\"click\", function() {\r\n iTutorialEnd();\r\n return false;\r\n });\r\n\r\n //Back button\r\n var backButton = clearEventListeners(\"interactive-tutorial-back\");\r\n backButton.style.display = \"none\";\r\n backButton.addEventListener(\"click\", function() {\r\n iTutorialPrevStep();\r\n return false;\r\n });\r\n}\r\n\r\nfunction iTutorialEvaluateStep() {\r\n if (!iTutorialIsRunning) {console.log(\"Interactive Tutorial not running\"); return;}\r\n switch(currITutorialStep) {\r\n case iTutorialSteps.Start:\r\n Engine.loadTerminalContent();\r\n\r\n iTutorialSetText(\"Welcome to Bitburner, a cyberpunk-themed incremental RPG! \" +\r\n \"The game takes place in a dark, dystopian future...The year is 2077...<br><br>\" +\r\n \"This tutorial will show you the basics of the game. \" +\r\n \"You may skip the tutorial at any time.\");\r\n var next = clearEventListeners(\"interactive-tutorial-next\");\r\n next.style.display = \"inline-block\";\r\n next.addEventListener(\"click\", function() {\r\n iTutorialNextStep();\r\n return false;\r\n });\r\n break;\r\n case iTutorialSteps.GoToCharacterPage:\r\n iTutorialSetText(\"Let's start by heading to the Stats page. Click the 'Stats' tab on \" +\r\n \"the main navigation menu (left-hand side of the screen)\");\r\n\r\n //No next button\r\n var next = clearEventListeners(\"interactive-tutorial-next\");\r\n next.style.display = \"none\";\r\n\r\n //Flash Character tab\r\n document.getElementById(\"stats-menu-link\").setAttribute(\"class\", \"flashing-button\");\r\n\r\n //Initialize everything necessary to open the \"Character\" page\r\n var charaterMainMenuButton = document.getElementById(\"stats-menu-link\");\r\n charaterMainMenuButton.addEventListener(\"click\", function() {\r\n Engine.loadCharacterContent();\r\n iTutorialNextStep(); //Opening the character page will go to the next step\r\n clearEventListeners(\"stats-menu-link\");\r\n return false;\r\n });\r\n break;\r\n case iTutorialSteps.CharacterPage:\r\n iTutorialSetText(\"The Stats page shows a lot of important information about your progress, \" +\r\n \"such as your skills, money, and bonuses/multipliers. \")\r\n var next = clearEventListeners(\"interactive-tutorial-next\");\r\n next.style.display = \"inline-block\";\r\n next.addEventListener(\"click\", function() {\r\n iTutorialNextStep();\r\n return false;\r\n });\r\n break;\r\n case iTutorialSteps.CharacterGoToTerminalPage:\r\n iTutorialSetText(\"Let's head to your computer's terminal by clicking the 'Terminal' tab on the \" +\r\n \"main navigation menu.\");\r\n //No next button\r\n var next = clearEventListeners(\"interactive-tutorial-next\");\r\n next.style.display = \"none\";\r\n\r\n document.getElementById(\"terminal-menu-link\").setAttribute(\"class\", \"flashing-button\");\r\n\r\n //Initialize everything necessary to open the 'Terminal' Page\r\n var terminalMainMenuButton = document.getElementById(\"terminal-menu-link\");\r\n terminalMainMenuButton.addEventListener(\"click\", function() {\r\n Engine.loadTerminalContent();\r\n iTutorialNextStep();\r\n clearEventListeners(\"terminal-menu-link\");\r\n return false;\r\n });\r\n break;\r\n case iTutorialSteps.TerminalIntro:\r\n iTutorialSetText(\"The Terminal is used to interface with your home computer as well as \" +\r\n \"all of the other machines around the world.\");\r\n var next = clearEventListeners(\"interactive-tutorial-next\");\r\n next.style.display = \"inline-block\";\r\n next.addEventListener(\"click\", function() {\r\n iTutorialNextStep();\r\n return false;\r\n });\r\n break;\r\n case iTutorialSteps.TerminalHelp:\r\n iTutorialSetText(\"Let's try it out. Start by entering the 'help' command into the Terminal \" +\r\n \"(Don't forget to press Enter after typing the command)\");\r\n var next = clearEventListeners(\"interactive-tutorial-next\");\r\n next.style.display = \"none\";\r\n //next step triggered by terminal command\r\n break;\r\n case iTutorialSteps.TerminalLs:\r\n iTutorialSetText(\"The 'help' command displays a list of all available Terminal commands, how to use them, \" +\r\n \"and a description of what they do. <br><br>Let's try another command. Enter the 'ls' command\");\r\n //next step triggered by terminal command\r\n break;\r\n case iTutorialSteps.TerminalScan:\r\n iTutorialSetText(\"'ls' is a basic command that shows all of the contents (programs/scripts) \" +\r\n \"on the computer. Right now, it shows that you have a program called 'NUKE.exe' on your computer. \" +\r\n \"We'll get to what this does later. <br><br>Using your home computer's terminal, you can connect \" +\r\n \"to other machines throughout the world. Let's do that now by first entering \" +\r\n \"the 'scan' command. \");\r\n //next step triggered by terminal command\r\n break;\r\n case iTutorialSteps.TerminalScanAnalyze1:\r\n iTutorialSetText(\"The 'scan' command shows all available network connections. In other words, \" +\r\n \"it displays a list of all servers that can be connected to from your \" +\r\n \"current machine. A server is identified by either its IP or its hostname. <br><br> \" +\r\n \"That's great and all, but there's so many servers. Which one should you go to? \" +\r\n \"The 'scan-analyze' command gives some more detailed information about servers on the \" +\r\n \"network. Try it now\");\r\n //next step triggered by terminal command\r\n break;\r\n case iTutorialSteps.TerminalScanAnalyze2:\r\n iTutorialSetText(\"You just ran 'scan-analyze' with a depth of one. This command shows more detailed \" +\r\n \"information about each server that you can connect to (servers that are a distance of \" +\r\n \"one node away). <br><br> It is also possible to run 'scan-analyze' with \" +\r\n \"a higher depth. Let's try a depth of two with the following command: 'scan-analyze 2'.\")\r\n //next step triggered by terminal command\r\n break;\r\n case iTutorialSteps.TerminalConnect:\r\n iTutorialSetText(\"Now you can see information about all servers that are up to two nodes away, as well \" +\r\n \"as figure out how to navigate to those servers through the network. You can only connect to \" +\r\n \"a server that is one node away. To connect to a machine, use the 'connect [ip/hostname]' command. You can type in \" +\r\n \"the ip or the hostname, but dont use both.<br><br>\" +\r\n \"From the results of the 'scan-analyze' command, we can see that the 'foodnstuff' server is \" +\r\n \"only one node away. Let's connect so it now using: 'connect foodnstuff'\");\r\n //next step triggered by terminal command\r\n break;\r\n case iTutorialSteps.TerminalAnalyze:\r\n iTutorialSetText(\"You are now connected to another machine! What can you do now? You can hack it!<br><br> In the year 2077, currency has \" +\r\n \"become digital and decentralized. People and corporations store their money \" +\r\n \"on servers and computers. Using your hacking abilities, you can hack servers \" +\r\n \"to steal money and gain experience. <br><br> \" +\r\n \"Before you try to hack a server, you should run diagnostics using the 'analyze' command\");\r\n //next step triggered by terminal command\r\n break;\r\n case iTutorialSteps.TerminalNuke:\r\n iTutorialSetText(\"When the 'analyze' command finishes running it will show useful information \" +\r\n \"about hacking the server. <br><br> For this server, the required hacking skill is only 1, \" +\r\n \"which means you can hack it right now. However, in order to hack a server \" +\r\n \"you must first gain root access. The 'NUKE.exe' program that we saw earlier on your \" +\r\n \"home computer is a virus that will grant you root access to a machine if there are enough \" +\r\n \"open ports.<br><br> The 'analyze' results shows that there do not need to be any open ports \" +\r\n \"on this machine for the NUKE virus to work, so go ahead and run the virus using the \" +\r\n \"'run NUKE.exe' command.\");\r\n //next step triggered by terminal command\r\n break;\r\n case iTutorialSteps.TerminalManualHack:\r\n iTutorialSetText(\"You now have root access! You can hack the server using the 'hack' command. \" +\r\n \"Try doing that now.\");\r\n //next step triggered by terminal command\r\n break;\r\n case iTutorialSteps.TerminalHackingMechanics:\r\n iTutorialSetText(\"You are now attempting to hack the server. Note that performing a hack takes time and \" +\r\n \"only has a certain percentage chance \" +\r\n \"of success. This time and success chance is determined by a variety of factors, including \" +\r\n \"your hacking skill and the server's security level.<br><br>\" +\r\n \"If your attempt to hack the server is successful, you will steal a certain percentage \" +\r\n \"of the server's total money. This percentage is affected by your hacking skill and \" +\r\n \"the server's security level.<br><br>The amount of money on a server is not limitless. So, if \" +\r\n \"you constantly hack a server and deplete its money, then you will encounter \" +\r\n \"diminishing returns in your hacking.\");\r\n var next = clearEventListeners(\"interactive-tutorial-next\");\r\n next.style.display = \"inline-block\";\r\n next.addEventListener(\"click\", function() {\r\n iTutorialNextStep();\r\n return false;\r\n });\r\n break;\r\n case iTutorialSteps.TerminalCreateScript:\r\n iTutorialSetText(\"Hacking is the core mechanic of the game and is necessary for progressing. However, \" +\r\n \"you don't want to be hacking manually the entire time. You can automate your hacking \" +\r\n \"by writing scripts!<br><br>To create a new script or edit an existing one, you can use the 'nano' \" +\r\n \"command. Scripts must end with the '.script' extension. Let's make a script now by \" +\r\n \"entering 'nano foodnstuff.script' after the hack command finishes running (Sidenote: Pressing ctrl + c\" +\r\n \" will end a command like hack early)\");\r\n var next = clearEventListeners(\"interactive-tutorial-next\");\r\n next.style.display = \"none\";\r\n //next step triggered by terminal command\r\n break;\r\n case iTutorialSteps.TerminalTypeScript:\r\n iTutorialSetText(\"This is the script editor. You can use it to program your scripts. Scripts are \" +\r\n \"written in the Netscript language, a programming language created for \" +\r\n \"this game. <strong style='background-color:#444;'>There are details about the Netscript language in the documentation, which \" +\r\n \"can be accessed in the 'Tutorial' tab on the main navigation menu. I highly suggest you check \" +\r\n \"it out after this tutorial. </strong> For now, just copy \" +\r\n \"and paste the following code into the script editor: <br><br>\" +\r\n \"while(true) { <br>\" +\r\n \"&nbsp;&nbsp;hack('foodnstuff'); <br>\" +\r\n \"}<br><br> \" +\r\n \"For anyone with basic programming experience, this code should be straightforward. \" +\r\n \"This script will continuously hack the 'foodnstuff' server.<br><br>\" +\r\n \"To save and close the script editor, press the button in the bottom left, or press ctrl + b.\");\r\n //next step triggered in saveAndCloseScriptEditor() (Script.js)\r\n break;\r\n case iTutorialSteps.TerminalFree:\r\n iTutorialSetText(\"Now we'll run the script. Scripts require a certain amount of RAM to run, and can be \" +\r\n \"run on any machine which you have root access to. Different servers have different \" +\r\n \"amounts of RAM. You can also purchase more RAM for your home server.<br><br>To check how much \" +\r\n \"RAM is available on this machine, enter the 'free' command.\");\r\n //next step triggered by terminal commmand\r\n break;\r\n case iTutorialSteps.TerminalRunScript:\r\n iTutorialSetText(\"We have 16GB of free RAM on this machine, which is enough to run our \" +\r\n \"script. Let's run our script using 'run foodnstuff.script'.\");\r\n //next step triggered by terminal commmand\r\n break;\r\n case iTutorialSteps.TerminalGoToActiveScriptsPage:\r\n iTutorialSetText(\"Your script is now running! The script might take a few seconds to 'fully start up'. \" +\r\n \"Your scripts will continuously run in the background and will automatically stop if \" +\r\n \"the code ever completes (the 'foodnstuff.script' will never complete because it \" +\r\n \"runs an infinite loop). <br><br>These scripts can passively earn you income and hacking experience. \" +\r\n \"Your scripts will also earn money and experience while you are offline, although at a \" +\r\n \"much slower rate. <br><br> \" +\r\n \"Let's check out some statistics for our running scripts by clicking the \" +\r\n \"'Active Scripts' link in the main navigation menu.\");\r\n document.getElementById(\"active-scripts-menu-link\").setAttribute(\"class\", \"flashing-button\");\r\n var activeScriptsMainMenuButton = document.getElementById(\"active-scripts-menu-link\");\r\n activeScriptsMainMenuButton.addEventListener(\"click\", function() {\r\n Engine.loadActiveScriptsContent();\r\n iTutorialNextStep();\r\n clearEventListeners(\"active-scripts-menu-link\");\r\n return false;\r\n });\r\n break;\r\n case iTutorialSteps.ActiveScriptsPage:\r\n iTutorialSetText(\"This page displays stats/information about all of your scripts that are \" +\r\n \"running across every existing server. You can use this to gauge how well \" +\r\n \"your scripts are doing. Let's go back to the Terminal now using the 'Terminal'\" +\r\n \"link.\");\r\n document.getElementById(\"terminal-menu-link\").setAttribute(\"class\", \"flashing-button\");\r\n //Initialize everything necessary to open the 'Terminal' Page\r\n var terminalMainMenuButton = clearEventListeners(\"terminal-menu-link\");\r\n terminalMainMenuButton.addEventListener(\"click\", function() {\r\n Engine.loadTerminalContent();\r\n iTutorialNextStep();\r\n clearEventListeners(\"terminal-menu-link\");\r\n return false;\r\n });\r\n break;\r\n case iTutorialSteps.ActiveScriptsToTerminal:\r\n iTutorialSetText(\"One last thing about scripts, each active script contains logs that detail \" +\r\n \"what it's doing. We can check these logs using the 'tail' command. Do that \" +\r\n \"now for the script we just ran by typing 'tail foodnstuff.script'\");\r\n //next step triggered by terminal command\r\n break;\r\n case iTutorialSteps.TerminalTailScript:\r\n iTutorialSetText(\"The log for this script won't show much right now (it might show nothing at all) because it \" +\r\n \"just started running...but check back again in a few minutes! <br><br>\" +\r\n \"This pretty much covers the basics of hacking. To learn more about writing \" +\r\n \"scripts using the Netscript language, select the 'Tutorial' link in the \" +\r\n \"main navigation menu to look at the documentation. For now, let's move on \" +\r\n \"to something else!\");\r\n var next = clearEventListeners(\"interactive-tutorial-next\");\r\n next.style.display = \"inline-block\";\r\n next.addEventListener(\"click\", function() {\r\n iTutorialNextStep();\r\n return false;\r\n });\r\n break;\r\n case iTutorialSteps.GoToHacknetNodesPage:\r\n iTutorialSetText(\"Hacking is not the only way to earn money. One other way to passively \" +\r\n \"earn money is by purchasing and upgrading Hacknet Nodes. Let's go to \" +\r\n \"the 'Hacknet Nodes' page through the main navigation menu now.\");\r\n document.getElementById(\"hacknet-nodes-menu-link\").setAttribute(\"class\", \"flashing-button\");\r\n var hacknetNodesButton = clearEventListeners(\"hacknet-nodes-menu-link\");\r\n var next = clearEventListeners(\"interactive-tutorial-next\");\r\n next.style.display = \"none\";\r\n hacknetNodesButton.addEventListener(\"click\", function() {\r\n Engine.loadHacknetNodesContent();\r\n iTutorialNextStep();\r\n clearEventListeners(\"hacknet-nodes-menu-link\");\r\n return false;\r\n });\r\n break;\r\n case iTutorialSteps.HacknetNodesIntroduction:\r\n iTutorialSetText(\"From this page you can purchase new Hacknet Nodes and upgrade your \" +\r\n \"existing ones. Let's purchase a new one now.\");\r\n //Next step triggered by purchaseHacknet() (HacknetNode.js)\r\n break;\r\n case iTutorialSteps.HacknetNodesGoToWorldPage:\r\n iTutorialSetText(\"You just purchased a Hacknet Node! This Hacknet Node will passively \" +\r\n \"earn you money over time, both online and offline. When you get enough \" +\r\n \" money, you can upgrade \" +\r\n \"your newly-purchased Hacknet Node below.<br><br>\" +\r\n \"Let's go to the 'City' page through the main navigation menu.\");\r\n document.getElementById(\"city-menu-link\").setAttribute(\"class\", \"flashing-button\");\r\n var worldButton = clearEventListeners(\"city-menu-link\");\r\n worldButton.addEventListener(\"click\", function() {\r\n Engine.loadWorldContent();\r\n iTutorialNextStep();\r\n clearEventListeners(\"city-menu-link\");\r\n return false;\r\n });\r\n break;\r\n case iTutorialSteps.WorldDescription:\r\n iTutorialSetText(\"This page lists all of the different locations you can currently \" +\r\n \"travel to. Each location has something that you can do. \" +\r\n \"There's a lot of content out in the world, make sure \" +\r\n \"you explore and discover!<br><br>\" +\r\n \"Lastly, click on the 'Tutorial' link in the main navigation menu.\");\r\n document.getElementById(\"tutorial-menu-link\").setAttribute(\"class\", \"flashing-button\");\r\n var tutorialButton = clearEventListeners(\"tutorial-menu-link\");\r\n tutorialButton.addEventListener(\"click\", function() {\r\n Engine.loadTutorialContent();\r\n iTutorialNextStep();\r\n clearEventListeners(\"tutorial-menu-link\");\r\n return false;\r\n });\r\n break;\r\n\r\n case iTutorialSteps.TutorialPageInfo:\r\n iTutorialSetText(\"This page contains a lot of different documentation about the game's \" +\r\n \"content and mechanics. <strong style='background-color:#444;'> I know it's a lot, but I highly suggest you read \" +\r\n \"(or at least skim) through this before you start playing</strong>. That's the end of the tutorial. \" +\r\n \"Hope you enjoy the game!\");\r\n var next = clearEventListeners(\"interactive-tutorial-next\");\r\n next.style.display = \"inline-block\";\r\n next.innerHTML = \"Finish Tutorial\";\r\n\r\n var backButton = clearEventListeners(\"interactive-tutorial-back\");\r\n backButton.style.display = \"none\";\r\n\r\n next.addEventListener(\"click\", function() {\r\n iTutorialNextStep();\r\n return false;\r\n });\r\n break;\r\n case iTutorialSteps.End:\r\n iTutorialEnd();\r\n break;\r\n default:\r\n throw new Error(\"Invalid tutorial step\");\r\n }\r\n}\r\n\r\n//Go to the next step and evaluate it\r\nfunction iTutorialNextStep() {\r\n switch(currITutorialStep) {\r\n case iTutorialSteps.Start:\r\n currITutorialStep = iTutorialSteps.GoToCharacterPage;\r\n iTutorialEvaluateStep();\r\n break;\r\n case iTutorialSteps.GoToCharacterPage:\r\n document.getElementById(\"stats-menu-link\").removeAttribute(\"class\");\r\n currITutorialStep = iTutorialSteps.CharacterPage;\r\n iTutorialEvaluateStep();\r\n break;\r\n case iTutorialSteps.CharacterPage:\r\n currITutorialStep = iTutorialSteps.CharacterGoToTerminalPage;\r\n iTutorialEvaluateStep();\r\n break;\r\n case iTutorialSteps.CharacterGoToTerminalPage:\r\n document.getElementById(\"terminal-menu-link\").removeAttribute(\"class\");\r\n currITutorialStep = iTutorialSteps.TerminalIntro;\r\n iTutorialEvaluateStep();\r\n break;\r\n case iTutorialSteps.TerminalIntro:\r\n currITutorialStep = iTutorialSteps.TerminalHelp;\r\n iTutorialEvaluateStep();\r\n break;\r\n case iTutorialSteps.TerminalHelp:\r\n currITutorialStep = iTutorialSteps.TerminalLs;\r\n iTutorialEvaluateStep();\r\n break;\r\n case iTutorialSteps.TerminalLs:\r\n currITutorialStep = iTutorialSteps.TerminalScan;\r\n iTutorialEvaluateStep();\r\n break;\r\n case iTutorialSteps.TerminalScan:\r\n currITutorialStep = iTutorialSteps.TerminalScanAnalyze1;\r\n iTutorialEvaluateStep();\r\n break;\r\n case iTutorialSteps.TerminalScanAnalyze1:\r\n currITutorialStep = iTutorialSteps.TerminalScanAnalyze2;\r\n iTutorialEvaluateStep();\r\n break;\r\n case iTutorialSteps.TerminalScanAnalyze2:\r\n currITutorialStep = iTutorialSteps.TerminalConnect;\r\n iTutorialEvaluateStep();\r\n break;\r\n case iTutorialSteps.TerminalConnect:\r\n currITutorialStep = iTutorialSteps.TerminalAnalyze;\r\n iTutorialEvaluateStep();\r\n break;\r\n case iTutorialSteps.TerminalAnalyze:\r\n currITutorialStep = iTutorialSteps.TerminalNuke;\r\n iTutorialEvaluateStep();\r\n break;\r\n case iTutorialSteps.TerminalNuke:\r\n currITutorialStep = iTutorialSteps.TerminalManualHack;\r\n iTutorialEvaluateStep();\r\n break;\r\n case iTutorialSteps.TerminalManualHack:\r\n currITutorialStep = iTutorialSteps.TerminalHackingMechanics;\r\n iTutorialEvaluateStep();\r\n break;\r\n case iTutorialSteps.TerminalHackingMechanics:\r\n currITutorialStep = iTutorialSteps.TerminalCreateScript;\r\n iTutorialEvaluateStep();\r\n break;\r\n case iTutorialSteps.TerminalCreateScript:\r\n currITutorialStep = iTutorialSteps.TerminalTypeScript;\r\n iTutorialEvaluateStep();\r\n break;\r\n case iTutorialSteps.TerminalTypeScript:\r\n currITutorialStep = iTutorialSteps.TerminalFree;\r\n iTutorialEvaluateStep();\r\n break;\r\n case iTutorialSteps.TerminalFree:\r\n currITutorialStep = iTutorialSteps.TerminalRunScript;\r\n iTutorialEvaluateStep();\r\n break;\r\n case iTutorialSteps.TerminalRunScript:\r\n currITutorialStep = iTutorialSteps.TerminalGoToActiveScriptsPage;\r\n iTutorialEvaluateStep();\r\n break;\r\n case iTutorialSteps.TerminalGoToActiveScriptsPage:\r\n document.getElementById(\"active-scripts-menu-link\").removeAttribute(\"class\");\r\n currITutorialStep = iTutorialSteps.ActiveScriptsPage;\r\n iTutorialEvaluateStep();\r\n break;\r\n case iTutorialSteps.ActiveScriptsPage:\r\n document.getElementById(\"terminal-menu-link\").removeAttribute(\"class\");\r\n currITutorialStep = iTutorialSteps.ActiveScriptsToTerminal;\r\n iTutorialEvaluateStep();\r\n break;\r\n case iTutorialSteps.ActiveScriptsToTerminal:\r\n currITutorialStep = iTutorialSteps.TerminalTailScript;\r\n iTutorialEvaluateStep();\r\n break;\r\n case iTutorialSteps.TerminalTailScript:\r\n currITutorialStep = iTutorialSteps.GoToHacknetNodesPage;\r\n iTutorialEvaluateStep();\r\n break;\r\n case iTutorialSteps.GoToHacknetNodesPage:\r\n document.getElementById(\"hacknet-nodes-menu-link\").removeAttribute(\"class\");\r\n currITutorialStep = iTutorialSteps.HacknetNodesIntroduction;\r\n iTutorialEvaluateStep();\r\n break;\r\n case iTutorialSteps.HacknetNodesIntroduction:\r\n currITutorialStep = iTutorialSteps.HacknetNodesGoToWorldPage;\r\n iTutorialEvaluateStep();\r\n break;\r\n case iTutorialSteps.HacknetNodesGoToWorldPage:\r\n document.getElementById(\"city-menu-link\").removeAttribute(\"class\");\r\n currITutorialStep = iTutorialSteps.WorldDescription;\r\n iTutorialEvaluateStep();\r\n break;\r\n case iTutorialSteps.WorldDescription:\r\n document.getElementById(\"tutorial-menu-link\").removeAttribute(\"class\");\r\n currITutorialStep = iTutorialSteps.TutorialPageInfo;\r\n iTutorialEvaluateStep();\r\n break;\r\n case iTutorialSteps.TutorialPageInfo:\r\n currITutorialStep = iTutorialSteps.End;\r\n iTutorialEvaluateStep();\r\n break;\r\n case iTutorialSteps.End:\r\n break;\r\n default:\r\n throw new Error(\"Invalid tutorial step\");\r\n }\r\n}\r\n\r\n//Go to previous step and evaluate\r\nfunction iTutorialPrevStep() {\r\n switch(currITutorialStep) {\r\n case iTutorialSteps.Start:\r\n currITutorialStep = iTutorialSteps.Start;\r\n iTutorialEvaluateStep();\r\n break;\r\n case iTutorialSteps.GoToCharacterPage:\r\n currITutorialStep = iTutorialSteps.Start;\r\n iTutorialEvaluateStep();\r\n break;\r\n case iTutorialSteps.CharacterPage:\r\n currITutorialStep = iTutorialSteps.GoToCharacterPage;\r\n iTutorialEvaluateStep();\r\n break;\r\n case iTutorialSteps.CharacterGoToTerminalPage:\r\n currITutorialStep = iTutorialSteps.CharacterPage;\r\n iTutorialEvaluateStep();\r\n break;\r\n case iTutorialSteps.TerminalIntro:\r\n currITutorialStep = iTutorialSteps.CharacterGoToTerminalPage;\r\n iTutorialEvaluateStep();\r\n break;\r\n case iTutorialSteps.TerminalHelp:\r\n currITutorialStep = iTutorialSteps.TerminalIntro;\r\n iTutorialEvaluateStep();\r\n break;\r\n case iTutorialSteps.TerminalLs:\r\n currITutorialStep = iTutorialSteps.TerminalHelp;\r\n iTutorialEvaluateStep();\r\n break;\r\n case iTutorialSteps.TerminalScan:\r\n currITutorialStep = iTutorialSteps.TerminalLs;\r\n iTutorialEvaluateStep();\r\n break;\r\n case iTutorialSteps.TerminalConnect:\r\n currITutorialStep = iTutorialSteps.TerminalScan;\r\n iTutorialEvaluateStep();\r\n break;\r\n case iTutorialSteps.TerminalAnalyze:\r\n currITutorialStep = iTutorialSteps.TerminalConnect;\r\n iTutorialEvaluateStep();\r\n break;\r\n case iTutorialSteps.TerminalNuke:\r\n currITutorialStep = iTutorialSteps.TerminalAnalyze;\r\n iTutorialEvaluateStep();\r\n break;\r\n case iTutorialSteps.TerminalManualHack:\r\n currITutorialStep = iTutorialSteps.TerminalNuke;\r\n iTutorialEvaluateStep();\r\n break;\r\n case iTutorialSteps.TerminalHackingMechanics:\r\n currITutorialStep = iTutorialSteps.TerminalManualHack;\r\n iTutorialEvaluateStep();\r\n break;\r\n case iTutorialSteps.TerminalCreateScript:\r\n currITutorialStep = iTutorialSteps.TerminalManualHack;\r\n iTutorialEvaluateStep();\r\n break;\r\n case iTutorialSteps.TerminalTypeScript:\r\n currITutorialStep = iTutorialSteps.TerminalCreateScript;\r\n iTutorialEvaluateStep();\r\n break;\r\n case iTutorialSteps.TerminalFree:\r\n currITutorialStep = iTutorialSteps.TerminalTypeScript;\r\n iTutorialEvaluateStep();\r\n break;\r\n case iTutorialSteps.TerminalRunScript:\r\n currITutorialStep = iTutorialSteps.TerminalFree;\r\n iTutorialEvaluateStep();\r\n break;\r\n case iTutorialSteps.TerminalGoToActiveScriptsPage:\r\n currITutorialStep = iTutorialSteps.TerminalRunScript;\r\n iTutorialEvaluateStep();\r\n break;\r\n case iTutorialSteps.ActiveScriptsPage:\r\n currITutorialStep = iTutorialSteps.TerminalGoToActiveScriptsPage;\r\n iTutorialEvaluateStep();\r\n break;\r\n case iTutorialSteps.ActiveScriptsToTerminal:\r\n currITutorialStep = iTutorialSteps.ActiveScriptsPage;\r\n iTutorialEvaluateStep();\r\n break;\r\n case iTutorialSteps.TerminalTailScript:\r\n currITutorialStep = iTutorialSteps.ActiveScriptsToTerminal;\r\n iTutorialEvaluateStep();\r\n break;\r\n case iTutorialSteps.GoToHacknetNodesPage:\r\n currITutorialStep = iTutorialSteps.TerminalTailScript;\r\n iTutorialEvaluateStep();\r\n break;\r\n case iTutorialSteps.HacknetNodesIntroduction:\r\n currITutorialStep = iTutorialSteps.GoToHacknetNodesPage;\r\n iTutorialEvaluateStep();\r\n break;\r\n case iTutorialSteps.HacknetNodesGoToWorldPage:\r\n currITutorialStep = iTutorialSteps.HacknetNodesIntroduction;\r\n iTutorialEvaluateStep();\r\n break;\r\n case iTutorialSteps.WorldDescription:\r\n currITutorialStep = iTutorialSteps.HacknetNodesGoToWorldPage;\r\n iTutorialEvaluateStep();\r\n break;\r\n case iTutorialSteps.TutorialPageInfo:\r\n currITutorialStep = iTutorialSteps.WorldDescription;\r\n iTutorialEvaluateStep();\r\n break;\r\n case iTutorialSteps.End:\r\n break;\r\n default:\r\n throw new Error(\"Invalid tutorial step\");\r\n }\r\n}\r\n\r\nfunction iTutorialEnd() {\r\n //Re-enable auto save\r\n Engine.Counters.autoSaveCounter = 300;\r\n console.log(\"Ending interactive tutorial\");\r\n Engine.init();\r\n currITutorialStep = iTutorialSteps.End;\r\n iTutorialIsRunning = false;\r\n document.getElementById(\"interactive-tutorial-container\").style.display = \"none\";\r\n dialogBoxCreate(\"If you are new to the game, the following links may be useful for you!<br><br>\" +\r\n \"<a class='a-link-button' href='http://bitburner.wikia.com/wiki/Chapt3rs_Guide_to_Getting_Started_with_Bitburner' target='_blank'>Getting Started Guide</a>\" +\r\n \"<a class='a-link-button' href='http://bitburner.wikia.com/wiki/Bitburner_Wiki' target='_blank'>Wiki</a><br><br>\" +\r\n \"The Beginner's Guide to Hacking was added to your home computer! It contains some tips/pointers for starting out with the game. \" +\r\n \"To read it, go to Terminal and enter<br><br>cat hackers-starting-handbook.lit\");\r\n Player.getHomeComputer().messages.push(\"hackers-starting-handbook.lit\");\r\n}\r\n\r\nfunction iTutorialSetText(txt) {\r\n var textBox = document.getElementById(\"interactive-tutorial-text\");\r\n if (textBox == null) {throw new Error(\"Could not find text box\"); return;}\r\n textBox.innerHTML = txt;\r\n textBox.parentElement.scrollTop = 0; // this resets scroll position\r\n}\r\n\r\nexport {iTutorialSteps, iTutorialEnd, iTutorialStart, iTutorialNextStep, currITutorialStep,\r\n iTutorialIsRunning};\r\n","var ace = require('brace');\r\nrequire('brace/mode/javascript');\r\nrequire('../netscript');\r\nrequire('brace/theme/chaos');\r\nrequire('brace/theme/chrome');\r\nrequire('brace/theme/monokai');\r\nrequire('brace/theme/solarized_dark');\r\nrequire('brace/theme/solarized_light');\r\nrequire('brace/theme/terminal');\r\nrequire('brace/theme/twilight');\r\nrequire('brace/theme/xcode');\r\nrequire(\"brace/keybinding/vim\");\r\nrequire(\"brace/keybinding/emacs\");\r\nrequire(\"brace/ext/language_tools\");\r\n\r\n// Importing this doesn't work for some reason.\r\nconst walk = require(\"acorn/dist/walk\");\r\n\r\nimport {CONSTANTS} from \"./Constants.js\";\r\nimport {Engine} from \"./engine.js\";\r\nimport {FconfSettings, parseFconfSettings} from \"./Fconf.js\";\r\nimport {iTutorialSteps, iTutorialNextStep,\r\n iTutorialIsRunning, currITutorialStep} from \"./InteractiveTutorial.js\";\r\nimport {evaluateImport} from \"./NetscriptEvaluator.js\";\r\nimport {NetscriptFunctions} from \"./NetscriptFunctions.js\";\r\nimport {addWorkerScript, killWorkerScript,\r\n WorkerScript} from \"./NetscriptWorker.js\";\r\nimport {Player} from \"./Player.js\";\r\nimport {AllServers, processSingleServerGrowth} from \"./Server.js\";\r\nimport {Settings} from \"./Settings.js\";\r\nimport {post, Terminal} from \"./Terminal.js\";\r\nimport {TextFile} from \"./TextFile.js\";\r\n\r\nimport {parse, Node} from \"../utils/acorn.js\";\r\nimport {dialogBoxCreate} from \"../utils/DialogBox.js\";\r\nimport {Reviver, Generic_toJSON,\r\n Generic_fromJSON} from \"../utils/JSONReviver.js\";\r\nimport {compareArrays, createElement} from \"../utils/HelperFunctions.js\";\r\nimport {formatNumber, numOccurrences,\r\n numNetscriptOperators} from \"../utils/StringHelperFunctions.js\";\r\n\r\nvar keybindings = {\r\n ace: null,\r\n vim: \"ace/keyboard/vim\",\r\n emacs: \"ace/keyboard/emacs\",\r\n};\r\n\r\nfunction isScriptFilename(f) {\r\n return f.endsWith(\".js\") || f.endsWith(\".script\") || f.endsWith(\".ns\");\r\n}\r\n\r\nvar scriptEditorRamCheck = null, scriptEditorRamText = null;\r\nfunction scriptEditorInit() {\r\n //Create buttons at the bottom of script editor\r\n var wrapper = document.getElementById(\"script-editor-buttons-wrapper\");\r\n if (wrapper == null) {\r\n console.log(\"Error finding 'script-editor-buttons-wrapper'\");\r\n return;\r\n }\r\n var closeButton = createElement(\"a\", {\r\n class:\"a-link-button\", display:\"inline-block\",\r\n innerText:\"Save & Close (Ctrl/Cmd + b)\",\r\n clickListener:()=>{\r\n saveAndCloseScriptEditor();\r\n return false;\r\n }\r\n });\r\n\r\n scriptEditorRamText = createElement(\"p\", {\r\n display:\"inline-block\", margin:\"10px\", id:\"script-editor-status-text\"\r\n });\r\n\r\n var checkboxLabel = createElement(\"label\", {\r\n for:\"script-editor-ram-check\", margin:\"4px\", marginTop: \"8px\",\r\n innerText:\"Dynamic RAM Usage Checker\", color:\"white\",\r\n tooltip:\"Enable/Disable the dynamic RAM Usage display. You may \" +\r\n \"want to disable it for very long scripts because there may be \" +\r\n \"performance issues\"\r\n });\r\n\r\n scriptEditorRamCheck = createElement(\"input\", {\r\n type:\"checkbox\", name:\"script-editor-ram-check\", id:\"script-editor-ram-check\",\r\n margin:\"4px\", marginTop: \"8px\",\r\n });\r\n scriptEditorRamCheck.checked = true;\r\n\r\n var documentationButton = createElement(\"a\", {\r\n display:\"inline-block\", class:\"a-link-button\", innerText:\"Netscript Documentation\",\r\n href:\"https://bitburner.readthedocs.io/en/latest/index.html\",\r\n target:\"_blank\"\r\n });\r\n\r\n wrapper.appendChild(closeButton);\r\n wrapper.appendChild(scriptEditorRamText);\r\n wrapper.appendChild(scriptEditorRamCheck);\r\n wrapper.appendChild(checkboxLabel);\r\n wrapper.appendChild(documentationButton);\r\n\r\n //Initialize ACE Script editor\r\n var editor = ace.edit('javascript-editor');\r\n editor.getSession().setMode('ace/mode/netscript');\r\n editor.setTheme('ace/theme/monokai');\r\n document.getElementById('javascript-editor').style.fontSize='16px';\r\n editor.setOption(\"showPrintMargin\", false);\r\n\r\n /* Script editor options */\r\n //Theme\r\n var themeDropdown = document.getElementById(\"script-editor-option-theme\");\r\n if (Settings.EditorTheme) {\r\n var initialIndex = 2;\r\n for (var i = 0; i < themeDropdown.options.length; ++i) {\r\n if (themeDropdown.options[i].value === Settings.EditorTheme) {\r\n initialIndex = i;\r\n break;\r\n }\r\n }\r\n themeDropdown.selectedIndex = initialIndex;\r\n } else {\r\n themeDropdown.selectedIndex = 2;\r\n }\r\n\r\n themeDropdown.onchange = function() {\r\n var val = themeDropdown.value;\r\n Settings.EditorTheme = val;\r\n var themePath = \"ace/theme/\" + val.toLowerCase();\r\n editor.setTheme(themePath);\r\n };\r\n themeDropdown.onchange();\r\n\r\n //Keybinding\r\n var keybindingDropdown = document.getElementById(\"script-editor-option-keybinding\");\r\n if (Settings.EditorKeybinding) {\r\n var initialIndex = 0;\r\n for (var i = 0; i < keybindingDropdown.options.length; ++i) {\r\n if (keybindingDropdown.options[i].value === Settings.EditorKeybinding) {\r\n initialIndex = i;\r\n break;\r\n }\r\n }\r\n keybindingDropdown.selectedIndex = initialIndex;\r\n } else {\r\n keybindingDropdown.selectedIndex = 0;\r\n }\r\n keybindingDropdown.onchange = function() {\r\n var val = keybindingDropdown.value;\r\n Settings.EditorKeybinding = val;\r\n editor.setKeyboardHandler(keybindings[val.toLowerCase()]);\r\n };\r\n keybindingDropdown.onchange();\r\n\r\n //Highlight Active line\r\n var highlightActiveChkBox = document.getElementById(\"script-editor-option-highlightactiveline\");\r\n highlightActiveChkBox.onchange = function() {\r\n editor.setHighlightActiveLine(highlightActiveChkBox.checked);\r\n };\r\n\r\n //Show Invisibles\r\n var showInvisiblesChkBox = document.getElementById(\"script-editor-option-showinvisibles\");\r\n showInvisiblesChkBox.onchange = function() {\r\n editor.setShowInvisibles(showInvisiblesChkBox.checked);\r\n };\r\n\r\n //Use Soft Tab\r\n var softTabChkBox = document.getElementById(\"script-editor-option-usesofttab\");\r\n softTabChkBox.onchange = function() {\r\n editor.getSession().setUseSoftTabs(softTabChkBox.checked);\r\n };\r\n\r\n //Jshint Maxerr\r\n var maxerr = document.getElementById(\"script-editor-option-maxerr\");\r\n var maxerrLabel = document.getElementById(\"script-editor-option-maxerror-value-label\");\r\n maxerrLabel.innerHTML = maxerr.value;\r\n maxerr.onchange = function() {\r\n editor.getSession().$worker.send(\"changeOptions\", [{maxerr:maxerr.value}]);\r\n maxerrLabel.innerHTML = maxerr.value;\r\n }\r\n\r\n //Configure some of the VIM keybindings\r\n ace.config.loadModule('ace/keyboard/vim', function(module) {\r\n var VimApi = module.CodeMirror.Vim;\r\n VimApi.defineEx('write', 'w', function(cm, input) {\r\n saveAndCloseScriptEditor();\r\n });\r\n VimApi.defineEx('quit', 'q', function(cm, input) {\r\n Engine.loadTerminalContent();\r\n });\r\n VimApi.defineEx('xwritequit', 'x', function(cm, input) {\r\n saveAndCloseScriptEditor();\r\n });\r\n VimApi.defineEx('wqwritequit', 'wq', function(cm, input) {\r\n saveAndCloseScriptEditor();\r\n });\r\n });\r\n\r\n //Function autocompleter\r\n editor.setOption(\"enableBasicAutocompletion\", true);\r\n var autocompleter = {\r\n getCompletions: function(editor, session, pos, prefix, callback) {\r\n if (prefix.length === 0) {callback(null, []); return;}\r\n var words = [];\r\n var fns = NetscriptFunctions(null);\r\n for (var name in fns) {\r\n if (fns.hasOwnProperty(name)) {\r\n words.push({\r\n name: name,\r\n value: name,\r\n });\r\n }\r\n }\r\n callback(null, words);\r\n },\r\n }\r\n editor.completers = [autocompleter];\r\n}\r\n\r\n//Updates RAM usage in script\r\nfunction updateScriptEditorContent() {\r\n var filename = document.getElementById(\"script-editor-filename\").value;\r\n if (scriptEditorRamCheck == null || !scriptEditorRamCheck.checked || !isScriptFilename(filename)) {\r\n scriptEditorRamText.innerText = \"N/A\";\r\n return;\r\n }\r\n var editor = ace.edit('javascript-editor');\r\n var code = editor.getValue();\r\n var codeCopy = code.repeat(1);\r\n var ramUsage = calculateRamUsage(codeCopy);\r\n if (ramUsage !== -1) {\r\n scriptEditorRamText.innerText = \"RAM: \" + formatNumber(ramUsage, 2).toString() + \"GB\";\r\n } else {\r\n scriptEditorRamText.innerText = \"RAM: Syntax Error\";\r\n }\r\n}\r\n\r\n//Define key commands in script editor (ctrl o to save + close, etc.)\r\n$(document).keydown(function(e) {\r\n if (Settings.DisableHotkeys === true) {return;}\r\n\tif (Engine.currentPage == Engine.Page.ScriptEditor) {\r\n\t\t//Ctrl + b\r\n if (e.keyCode == 66 && (e.ctrlKey || e.metaKey)) {\r\n e.preventDefault();\r\n\t\t\tsaveAndCloseScriptEditor();\r\n }\r\n\t}\r\n});\r\n\r\nfunction saveAndCloseScriptEditor() {\r\n var filename = document.getElementById(\"script-editor-filename\").value;\r\n var editor = ace.edit('javascript-editor');\r\n var code = editor.getValue();\r\n if (iTutorialIsRunning && currITutorialStep == iTutorialSteps.TerminalTypeScript) {\r\n if (filename != \"foodnstuff.script\") {\r\n dialogBoxCreate(\"Leave the script name as 'foodnstuff'!\");\r\n return;\r\n }\r\n code = code.replace(/\\s/g, \"\");\r\n if (code.indexOf(\"while(true){hack('foodnstuff');}\") == -1) {\r\n dialogBoxCreate(\"Please copy and paste the code from the tutorial!\");\r\n return;\r\n }\r\n iTutorialNextStep();\r\n }\r\n\r\n if (filename == \"\") {\r\n dialogBoxCreate(\"You must specify a filename!\");\r\n return;\r\n }\r\n\r\n if (checkValidFilename(filename) == false) {\r\n dialogBoxCreate(\"Script filename can contain only alphanumerics, hyphens, and underscores\");\r\n return;\r\n }\r\n\r\n var s = Player.getCurrentServer();\r\n if (filename === \".fconf\") {\r\n try {\r\n parseFconfSettings(code);\r\n } catch(e) {\r\n dialogBoxCreate(\"Invalid .fconf file\");\r\n return;\r\n }\r\n } else if (isScriptFilename(filename)) {\r\n //If the current script already exists on the server, overwrite it\r\n for (var i = 0; i < s.scripts.length; i++) {\r\n if (filename == s.scripts[i].filename) {\r\n s.scripts[i].saveScript();\r\n Engine.loadTerminalContent();\r\n return;\r\n }\r\n }\r\n\r\n //If the current script does NOT exist, create a new one\r\n var script = new Script();\r\n script.saveScript();\r\n s.scripts.push(script);\r\n } else if (filename.endsWith(\".txt\")) {\r\n for (var i = 0; i < s.textFiles.length; ++i) {\r\n if (s.textFiles[i].fn === filename) {\r\n s.textFiles[i].write(code);\r\n Engine.loadTerminalContent();\r\n return;\r\n }\r\n }\r\n var textFile = new TextFile(filename, code);\r\n s.textFiles.push(textFile);\r\n } else {\r\n dialogBoxCreate(\"Invalid filename. Must be either a script (.script) or \" +\r\n \" or text file (.txt)\")\r\n return;\r\n }\r\n Engine.loadTerminalContent();\r\n}\r\n\r\n//Checks that the string contains only valid characters for a filename, which are alphanumeric,\r\n// underscores, hyphens, and dots\r\nfunction checkValidFilename(filename) {\r\n\tvar regex = /^[.a-zA-Z0-9_-]+$/;\r\n\r\n\tif (filename.match(regex)) {\r\n\t\treturn true;\r\n\t}\r\n\treturn false;\r\n}\r\n\r\nfunction Script() {\r\n\tthis.filename \t= \"\";\r\n this.code = \"\";\r\n this.ramUsage = 0;\r\n\tthis.server \t= \"\";\t//IP of server this script is on\r\n this.module = \"\";\r\n};\r\n\r\n//Get the script data from the Script Editor and save it to the object\r\nScript.prototype.saveScript = function() {\r\n\tif (Engine.currentPage == Engine.Page.ScriptEditor) {\r\n\t\t//Update code and filename\r\n var editor = ace.edit('javascript-editor');\r\n var code = editor.getValue();\r\n\t\tthis.code = code.replace(/^\\s+|\\s+$/g, '');\r\n\r\n\t\tvar filename = document.getElementById(\"script-editor-filename\").value;\r\n\t\tthis.filename = filename;\r\n\r\n\t\t//Server\r\n\t\tthis.server = Player.currentServer;\r\n\r\n\t\t//Calculate/update ram usage, execution time, etc.\r\n\t\tthis.updateRamUsage();\r\n\r\n this.module = \"\";\r\n\t}\r\n}\r\n\r\n//Updates how much RAM the script uses when it is running.\r\nScript.prototype.updateRamUsage = function() {\r\n var codeCopy = this.code.repeat(1);\r\n var res = calculateRamUsage(codeCopy);\r\n if (res !== -1) {\r\n this.ramUsage = res;\r\n }\r\n}\r\n\r\n// These special strings are used to reference the presence of a given logical\r\n// construct within a user script.\r\nconst specialReferenceIF = \"__SPECIAL_referenceIf\";\r\nconst specialReferenceFOR = \"__SPECIAL_referenceFor\";\r\nconst specialReferenceWHILE = \"__SPECIAL_referenceWhile\";\r\n\r\n// The global scope of a script is registered under this key during parsing.\r\nconst memCheckGlobalKey = \".__GLOBAL__\";\r\n\r\n// Calcluates the amount of RAM a script uses. Uses parsing and AST walking only,\r\n// rather than NetscriptEvaluator. This is useful because NetscriptJS code does\r\n// not work under NetscriptEvaluator.\r\nfunction parseOnlyRamCalculate(server, code, workerScript) {\r\n try {\r\n // Maps dependent identifiers to their dependencies.\r\n //\r\n // The initial identifier is __SPECIAL_INITIAL_MODULE__.__GLOBAL__.\r\n // It depends on all the functions declared in the module, all the global scopes\r\n // of its imports, and any identifiers referenced in this global scope. Each\r\n // function depends on all the identifiers referenced internally.\r\n // We walk the dependency graph to calculate RAM usage, given that some identifiers\r\n // reference Netscript functions which have a RAM cost.\r\n let dependencyMap = {};\r\n\r\n // Scripts we've parsed.\r\n const completedParses = new Set();\r\n\r\n // Scripts we've discovered that need to be parsed.\r\n const parseQueue = [];\r\n\r\n // Parses a chunk of code with a given module name, and updates parseQueue and dependencyMap.\r\n function parseCode(code, moduleName) {\r\n const result = parseOnlyCalculateDeps(code, moduleName);\r\n completedParses.add(moduleName);\r\n\r\n // Add any additional modules to the parse queue;\r\n for (let i = 0; i < result.additionalModules.length; ++i) {\r\n if (!completedParses.has(result.additionalModules[i])) {\r\n parseQueue.push(result.additionalModules[i]);\r\n }\r\n }\r\n\r\n // Splice all the references in.\r\n dependencyMap = {...dependencyMap, ...result.dependencyMap};\r\n }\r\n\r\n const initialModule = \"__SPECIAL_INITIAL_MODULE__\";\r\n parseCode(code, initialModule);\r\n\r\n while (parseQueue.length > 0) {\r\n // Get the code from the server.\r\n const nextModule = parseQueue.shift();\r\n\r\n const script = server.getScript(nextModule);\r\n if (!script) return -1; // No such script on the server.\r\n\r\n // Not sure why we always take copies, but let's do that here too.\r\n parseCode(script.code.repeat(1), nextModule);\r\n }\r\n\r\n // Finally, walk the reference map and generate a ram cost. The initial set of keys to scan\r\n // are those that start with __SPECIAL_INITIAL_MODULE__.\r\n let ram = CONSTANTS.ScriptBaseRamCost;\r\n const unresolvedRefs = Object.keys(dependencyMap).filter(s => s.startsWith(initialModule));\r\n const resolvedRefs = new Set();\r\n while (unresolvedRefs.length > 0) {\r\n const ref = unresolvedRefs.shift();\r\n resolvedRefs.add(ref);\r\n\r\n if (ref.endsWith(\".*\")) {\r\n // A prefix reference. We need to find all matching identifiers.\r\n const prefix = ref.slice(0, ref.length - 2);\r\n for (let ident of Object.keys(dependencyMap).filter(k => k.startsWith(prefix))) {\r\n for (let dep of dependencyMap[ident] || []) {\r\n if (!resolvedRefs.has(dep)) unresolvedRefs.push(dep);\r\n }\r\n }\r\n } else {\r\n // An exact reference. Add all dependencies of this ref.\r\n for (let dep of dependencyMap[ref] || []) {\r\n if (!resolvedRefs.has(dep)) unresolvedRefs.push(dep);\r\n }\r\n }\r\n\r\n // Check if this is one of the special keys, and add the appropriate ram cost if so.\r\n if (ref == specialReferenceIF) ram += CONSTANTS.ScriptIfRamCost;\r\n if (ref == specialReferenceFOR) ram += CONSTANTS.ScriptForRamCost;\r\n if (ref == specialReferenceWHILE) ram += CONSTANTS.ScriptWhileRamCost;\r\n if (ref == \"hacknetnodes\") ram += CONSTANTS.ScriptHacknetNodesRamCost;\r\n\r\n // Check if this ident is a function in the workerscript env. If it is, then we need to\r\n // get its RAM cost. We do this by calling it, which works because the running script\r\n // is in checkingRam mode.\r\n //\r\n // TODO it would be simpler to just reference a dictionary.\r\n try {\r\n var func = workerScript.env.get(ref);\r\n if (typeof func === \"function\") {\r\n try {\r\n var res = func.apply(null, []);\r\n if (typeof res === \"number\") {\r\n ram += res;\r\n }\r\n } catch(e) {\r\n console.log(\"ERROR applying function: \" + e);\r\n }\r\n }\r\n } catch (error) { continue; }\r\n\r\n }\r\n return ram;\r\n\r\n } catch (error) {\r\n console.info(\"parse or eval error: \", error);\r\n // This is not unexpected. The user may be editing a script, and it may be in\r\n // a transitory invalid state.\r\n return -1;\r\n }\r\n}\r\n\r\n// Parses one script and calculates its ram usage, for the global scope and each function.\r\n// Returns a cost map and a dependencyMap for the module. Returns a reference map to be joined\r\n// onto the main reference map, and a list of modules that need to be parsed.\r\nfunction parseOnlyCalculateDeps(code, currentModule) {\r\n const ast = parse(code, {sourceType:\"module\", ecmaVersion: 8});\r\n\r\n // Everything from the global scope goes in \".\". Everything else goes in \".function\", where only\r\n // the outermost layer of functions counts.\r\n const globalKey = currentModule + memCheckGlobalKey;\r\n const dependencyMap = {};\r\n dependencyMap[globalKey] = new Set();\r\n\r\n // If we reference this internal name, we're really referencing that external name.\r\n // Filled when we import names from other modules.\r\n let internalToExternal = {};\r\n\r\n var additionalModules = [];\r\n\r\n // References get added pessimistically. They are added for thisModule.name, name, and for\r\n // any aliases.\r\n function addRef(key, name) {\r\n const s = dependencyMap[key] || (dependencyMap[key] = new Set());\r\n if (name in internalToExternal) {\r\n s.add(internalToExternal[name]);\r\n }\r\n s.add(currentModule + \".\" + name);\r\n s.add(name); // For builtins like hack.\r\n }\r\n\r\n // If we discover a dependency identifier, state.key is the dependent identifier.\r\n // walkDeeper is for doing recursive walks of expressions in composites that we handle.\r\n function commonVisitors() {\r\n return {\r\n Identifier: (node, st, walkDeeper) => {\r\n addRef(st.key, node.name);\r\n },\r\n WhileStatement: (node, st, walkDeeper) => {\r\n addRef(st.key, specialReferenceWHILE);\r\n node.test && walkDeeper(node.test, st);\r\n node.body && walkDeeper(node.body, st);\r\n },\r\n DoWhileStatement: (node, st, walkDeeper) => {\r\n addRef(st.key, specialReferenceWHILE);\r\n node.test && walkDeeper(node.test, st);\r\n node.body && walkDeeper(node.body, st);\r\n },\r\n ForStatement: (node, st, walkDeeper) => {\r\n addRef(st.key, specialReferenceFOR);\r\n node.init && walkDeeper(node.init, st);\r\n node.test && walkDeeper(node.test, st);\r\n node.update && walkDeeper(node.update, st);\r\n node.body && walkDeeper(node.body, st);\r\n },\r\n IfStatement: (node, st, walkDeeper) => {\r\n addRef(st.key, specialReferenceIF);\r\n node.test && walkDeeper(node.test, st);\r\n node.consequent && walkDeeper(node.consequent, st);\r\n node.alternate && walkDeeper(node.alternate, st);\r\n },\r\n MemberExpression: (node, st, walkDeeper) => {\r\n node.object && walkDeeper(node.object, st);\r\n node.property && walkDeeper(node.property, st);\r\n },\r\n }\r\n }\r\n\r\n walk.recursive(ast, {key: globalKey}, {\r\n ImportDeclaration: (node, st, walkDeeper) => {\r\n const importModuleName = node.source.value;\r\n additionalModules.push(importModuleName);\r\n\r\n // This module's global scope refers to that module's global scope, no matter how we\r\n // import it.\r\n dependencyMap[st.key].add(importModuleName + memCheckGlobalKey);\r\n\r\n for (let i = 0; i < node.specifiers.length; ++i) {\r\n const spec = node.specifiers[i];\r\n if (spec.imported !== undefined && spec.local !== undefined) {\r\n // We depend on specific things.\r\n internalToExternal[spec.local.name] = importModuleName + \".\" + spec.imported.name;\r\n } else {\r\n // We depend on everything.\r\n dependencyMap[st.key].add(importModuleName + \".*\");\r\n }\r\n }\r\n },\r\n FunctionDeclaration: (node, st, walkDeeper) => {\r\n // Don't use walkDeeper, because we are changing the visitor set.\r\n const key = currentModule + \".\" + node.id.name;\r\n walk.recursive(node, {key: key}, commonVisitors());\r\n },\r\n ...commonVisitors()\r\n });\r\n\r\n return {dependencyMap: dependencyMap, additionalModules: additionalModules};\r\n}\r\n\r\nfunction calculateRamUsage(codeCopy) {\r\n //Create a temporary/mock WorkerScript and an AST from the code\r\n var currServ = Player.getCurrentServer();\r\n var workerScript = new WorkerScript({\r\n filename:\"foo\",\r\n scriptRef: {code:\"\"},\r\n args:[]\r\n });\r\n workerScript.checkingRam = true; //Netscript functions will return RAM usage\r\n workerScript.serverIp = currServ.ip;\r\n\r\n try {\r\n return parseOnlyRamCalculate(currServ, codeCopy, workerScript);\r\n\t} catch (e) {\r\n console.log(\"Failed to parse ram using new method. Falling back.\", e);\r\n\t}\r\n\r\n // Try the old way.\r\n\r\n try {\r\n var ast = parse(codeCopy, {sourceType:\"module\"});\r\n } catch(e) {\r\n return -1;\r\n }\r\n\r\n //Search through AST, scanning for any 'Identifier' nodes for functions, or While/For/If nodes\r\n var queue = [], ramUsage = CONSTANTS.ScriptBaseRamCost;\r\n var whileUsed = false, forUsed = false, ifUsed = false;\r\n queue.push(ast);\r\n while (queue.length != 0) {\r\n var exp = queue.shift();\r\n switch (exp.type) {\r\n case \"ImportDeclaration\":\r\n //Gets an array of all imported functions as AST expressions\r\n //and pushes them on the queue.\r\n var res = evaluateImport(exp, workerScript, true);\r\n for (var i = 0; i < res.length; ++i) {\r\n queue.push(res[i]);\r\n }\r\n break;\r\n case \"BlockStatement\":\r\n case \"Program\":\r\n for (var i = 0; i < exp.body.length; ++i) {\r\n if (exp.body[i] instanceof Node) {\r\n queue.push(exp.body[i]);\r\n }\r\n }\r\n break;\r\n case \"WhileStatement\":\r\n if (!whileUsed) {\r\n ramUsage += CONSTANTS.ScriptWhileRamCost;\r\n whileUsed = true;\r\n }\r\n break;\r\n case \"ForStatement\":\r\n if (!forUsed) {\r\n ramUsage += CONSTANTS.ScriptForRamCost;\r\n forUsed = true;\r\n }\r\n break;\r\n case \"IfStatement\":\r\n if (!ifUsed) {\r\n ramUsage += CONSTANTS.ScriptIfRamCost;\r\n ifUsed = true;\r\n }\r\n break;\r\n case \"Identifier\":\r\n if (exp.name in workerScript.env.vars) {\r\n var func = workerScript.env.get(exp.name);\r\n if (typeof func === \"function\") {\r\n try {\r\n var res = func.apply(null, []);\r\n if (typeof res === \"number\") {\r\n ramUsage += res;\r\n }\r\n } catch(e) {\r\n console.log(\"ERROR applying function: \" + e);\r\n }\r\n }\r\n }\r\n break;\r\n default:\r\n break;\r\n }\r\n\r\n for (var prop in exp) {\r\n if (exp.hasOwnProperty(prop)) {\r\n if (exp[prop] instanceof Node) {\r\n queue.push(exp[prop]);\r\n }\r\n }\r\n }\r\n }\r\n\r\n //Special case: hacknetnodes array\r\n if (codeCopy.includes(\"hacknetnodes\")) {\r\n ramUsage += CONSTANTS.ScriptHacknetNodesRamCost;\r\n }\r\n return ramUsage;\r\n}\r\n\r\nScript.prototype.download = function() {\r\n var filename = this.filename + \".js\";\r\n var file = new Blob([this.code], {type: 'text/plain'});\r\n if (window.navigator.msSaveOrOpenBlob) {// IE10+\r\n window.navigator.msSaveOrOpenBlob(file, filename);\r\n } else { // Others\r\n var a = document.createElement(\"a\"),\r\n url = URL.createObjectURL(file);\r\n a.href = url;\r\n a.download = filename;\r\n document.body.appendChild(a);\r\n a.click();\r\n setTimeout(function() {\r\n document.body.removeChild(a);\r\n window.URL.revokeObjectURL(url);\r\n }, 0);\r\n }\r\n}\r\n\r\nScript.prototype.toJSON = function() {\r\n return Generic_toJSON(\"Script\", this);\r\n}\r\n\r\n\r\nScript.fromJSON = function(value) {\r\n return Generic_fromJSON(Script, value.data);\r\n}\r\n\r\nReviver.constructors.Script = Script;\r\n\r\n//Called when the game is loaded. Loads all running scripts (from all servers)\r\n//into worker scripts so that they will start running\r\nfunction loadAllRunningScripts() {\r\n\tvar count = 0;\r\n var total = 0;\r\n let skipScriptLoad = (window.location.href.toLowerCase().indexOf(\"?noscripts\") !== -1);\r\n if (skipScriptLoad) {console.log(\"Skipping the load of any scripts during startup\");}\r\n\tfor (var property in AllServers) {\r\n\t\tif (AllServers.hasOwnProperty(property)) {\r\n\t\t\tvar server = AllServers[property];\r\n\r\n\t\t\t//Reset each server's RAM usage to 0\r\n\t\t\tserver.ramUsed = 0;\r\n\r\n //Reset modules on all scripts\r\n for (var i = 0; i < server.scripts.length; ++i) {\r\n server.scripts[i].module = \"\";\r\n }\r\n\r\n if (skipScriptLoad) {\r\n //Start game with no scripts\r\n server.runningScripts.length = 0;\r\n } else {\r\n for (var j = 0; j < server.runningScripts.length; ++j) {\r\n \t\t\t\tcount++;\r\n server.runningScripts[j].scriptRef.module = \"\";\r\n \t\t\t\taddWorkerScript(server.runningScripts[j], server);\r\n\r\n \t\t\t\t//Offline production\r\n \t\t\t\ttotal += scriptCalculateOfflineProduction(server.runningScripts[j]);\r\n \t\t\t}\r\n }\r\n\t\t}\r\n\t}\r\n return total;\r\n\tconsole.log(\"Loaded \" + count.toString() + \" running scripts\");\r\n}\r\n\r\nfunction scriptCalculateOfflineProduction(runningScriptObj) {\r\n\t//The Player object stores the last update time from when we were online\r\n\tvar thisUpdate = new Date().getTime();\r\n\tvar lastUpdate = Player.lastUpdate;\r\n\tvar timePassed = (thisUpdate - lastUpdate) / 1000;\t//Seconds\r\n\tconsole.log(\"Offline for \" + timePassed + \" seconds\");\r\n\r\n\t//Calculate the \"confidence\" rating of the script's true production. This is based\r\n\t//entirely off of time. We will arbitrarily say that if a script has been running for\r\n\t//4 hours (14400 sec) then we are completely confident in its ability\r\n\tvar confidence = (runningScriptObj.onlineRunningTime) / 14400;\r\n\tif (confidence >= 1) {confidence = 1;}\r\n\r\n //Data map: [MoneyStolen, NumTimesHacked, NumTimesGrown, NumTimesWeaken]\r\n\r\n //Grow\r\n for (var ip in runningScriptObj.dataMap) {\r\n if (runningScriptObj.dataMap.hasOwnProperty(ip)) {\r\n if (runningScriptObj.dataMap[ip][2] == 0 || runningScriptObj.dataMap[ip][2] == null) {continue;}\r\n var serv = AllServers[ip];\r\n if (serv == null) {continue;}\r\n var timesGrown = Math.round(0.5 * runningScriptObj.dataMap[ip][2] / runningScriptObj.onlineRunningTime * timePassed);\r\n console.log(runningScriptObj.filename + \" called grow() on \" + serv.hostname + \" \" + timesGrown + \" times while offline\");\r\n runningScriptObj.log(\"Called grow() on \" + serv.hostname + \" \" + timesGrown + \" times while offline\");\r\n var growth = processSingleServerGrowth(serv, timesGrown * 450);\r\n runningScriptObj.log(serv.hostname + \" grown by \" + formatNumber(growth * 100 - 100, 6) + \"% from grow() calls made while offline\");\r\n }\r\n }\r\n\r\n var totalOfflineProduction = 0;\r\n for (var ip in runningScriptObj.dataMap) {\r\n if (runningScriptObj.dataMap.hasOwnProperty(ip)) {\r\n if (runningScriptObj.dataMap[ip][0] == 0 || runningScriptObj.dataMap[ip][0] == null) {continue;}\r\n var serv = AllServers[ip];\r\n if (serv == null) {continue;}\r\n var production = 0.5 * runningScriptObj.dataMap[ip][0] / runningScriptObj.onlineRunningTime * timePassed;\r\n production *= confidence;\r\n if (production > serv.moneyAvailable) {\r\n production = serv.moneyAvailable;\r\n }\r\n totalOfflineProduction += production;\r\n Player.gainMoney(production);\r\n console.log(runningScriptObj.filename + \" generated $\" + production + \" while offline by hacking \" + serv.hostname);\r\n runningScriptObj.log(runningScriptObj.filename + \" generated $\" + production + \" while offline by hacking \" + serv.hostname);\r\n serv.moneyAvailable -= production;\r\n if (serv.moneyAvailable < 0) {serv.moneyAvailable = 0;}\r\n if (isNaN(serv.moneyAvailable)) {serv.moneyAvailable = 0;}\r\n }\r\n }\r\n\r\n //Offline EXP gain\r\n\t//A script's offline production will always be at most half of its online production.\r\n\tvar expGain = 0.5 * (runningScriptObj.onlineExpGained / runningScriptObj.onlineRunningTime) * timePassed;\r\n\texpGain *= confidence;\r\n\r\n\tPlayer.gainHackingExp(expGain);\r\n\r\n\t//Update script stats\r\n\trunningScriptObj.offlineMoneyMade += totalOfflineProduction;\r\n\trunningScriptObj.offlineRunningTime += timePassed;\r\n\trunningScriptObj.offlineExpGained += expGain;\r\n\r\n //Fortify a server's security based on how many times it was hacked\r\n for (var ip in runningScriptObj.dataMap) {\r\n if (runningScriptObj.dataMap.hasOwnProperty(ip)) {\r\n if (runningScriptObj.dataMap[ip][1] == 0 || runningScriptObj.dataMap[ip][1] == null) {continue;}\r\n var serv = AllServers[ip];\r\n if (serv == null) {continue;}\r\n var timesHacked = Math.round(0.5 * runningScriptObj.dataMap[ip][1] / runningScriptObj.onlineRunningTime * timePassed);\r\n console.log(runningScriptObj.filename + \" hacked \" + serv.hostname + \" \" + timesHacked + \" times while offline\");\r\n runningScriptObj.log(\"Hacked \" + serv.hostname + \" \" + timesHacked + \" times while offline\");\r\n serv.fortify(CONSTANTS.ServerFortifyAmount * timesHacked);\r\n }\r\n }\r\n\r\n //Weaken\r\n for (var ip in runningScriptObj.dataMap) {\r\n if (runningScriptObj.dataMap.hasOwnProperty(ip)) {\r\n if (runningScriptObj.dataMap[ip][3] == 0 || runningScriptObj.dataMap[ip][3] == null) {continue;}\r\n var serv = AllServers[ip];\r\n if (serv == null) {continue;}\r\n var timesWeakened = Math.round(0.5 * runningScriptObj.dataMap[ip][3] / runningScriptObj.onlineRunningTime * timePassed);\r\n console.log(runningScriptObj.filename + \" called weaken() on \" + serv.hostname + \" \" + timesWeakened + \" times while offline\");\r\n runningScriptObj.log(\"Called weaken() on \" + serv.hostname + \" \" + timesWeakened + \" times while offline\");\r\n serv.weaken(CONSTANTS.ServerWeakenAmount * timesWeakened);\r\n }\r\n }\r\n\r\n return totalOfflineProduction;\r\n}\r\n\r\n//Returns a RunningScript object matching the filename and arguments on the\r\n//designated server, and false otherwise\r\nfunction findRunningScript(filename, args, server) {\r\n for (var i = 0; i < server.runningScripts.length; ++i) {\r\n if (server.runningScripts[i].filename == filename &&\r\n compareArrays(server.runningScripts[i].args, args)) {\r\n return server.runningScripts[i];\r\n }\r\n }\r\n return null;\r\n}\r\n\r\nfunction RunningScript(script, args) {\r\n if (script == null || script == undefined) {return;}\r\n this.filename = script.filename;\r\n this.args = args;\r\n this.scriptRef = script;\r\n this.server = script.server; //IP Address only\r\n\r\n this.logs = []; //Script logging. Array of strings, with each element being a log entry\r\n this.logUpd = false;\r\n\r\n\t//Stats to display on the Scripts menu, and used to determine offline progress\r\n\tthis.offlineRunningTime \t= 0.01;\t//Seconds\r\n\tthis.offlineMoneyMade \t\t= 0;\r\n\tthis.offlineExpGained \t\t= 0;\r\n\tthis.onlineRunningTime \t\t= 0.01;\t//Seconds\r\n\tthis.onlineMoneyMade \t\t= 0;\r\n\tthis.onlineExpGained \t\t= 0;\r\n\r\n this.threads = 1;\r\n\r\n //[MoneyStolen, NumTimesHacked, NumTimesGrown, NumTimesWeaken]\r\n this.dataMap = new AllServersMap([0, 0, 0, 0], true);\r\n}\r\n\r\nRunningScript.prototype.log = function(txt) {\r\n if (this.logs.length > Settings.MaxLogCapacity) {\r\n //Delete first element and add new log entry to the end.\r\n //TODO Eventually it might be better to replace this with circular array\r\n //to improve performance\r\n this.logs.shift();\r\n }\r\n let logEntry = txt;\r\n if (FconfSettings.ENABLE_TIMESTAMPS) {\r\n logEntry = \"[\" + Terminal.getTimestamp() + \"] \" + logEntry;\r\n }\r\n this.logs.push(logEntry);\r\n this.logUpd = true;\r\n}\r\n\r\nRunningScript.prototype.displayLog = function() {\r\n for (var i = 0; i < this.logs.length; ++i) {\r\n post(this.logs[i]);\r\n }\r\n}\r\n\r\nRunningScript.prototype.clearLog = function() {\r\n this.logs.length = 0;\r\n}\r\n\r\n//Update the moneyStolen and numTimesHack maps when hacking\r\nRunningScript.prototype.recordHack = function(serverIp, moneyGained, n=1) {\r\n if (this.dataMap == null) {\r\n //[MoneyStolen, NumTimesHacked, NumTimesGrown, NumTimesWeaken]\r\n this.dataMap = new AllServersMap([0, 0, 0, 0], true);\r\n }\r\n this.dataMap[serverIp][0] += moneyGained;\r\n this.dataMap[serverIp][1] += n;\r\n}\r\n\r\n//Update the grow map when calling grow()\r\nRunningScript.prototype.recordGrow = function(serverIp, n=1) {\r\n if (this.dataMap == null) {\r\n //[MoneyStolen, NumTimesHacked, NumTimesGrown, NumTimesWeaken]\r\n this.dataMap = new AllServersMap([0, 0, 0, 0], true);\r\n }\r\n this.dataMap[serverIp][2] += n;\r\n}\r\n\r\n//Update the weaken map when calling weaken() {\r\nRunningScript.prototype.recordWeaken = function(serverIp, n=1) {\r\n if (this.dataMap == null) {\r\n //[MoneyStolen, NumTimesHacked, NumTimesGrown, NumTimesWeaken]\r\n this.dataMap = new AllServersMap([0, 0, 0, 0], true);\r\n }\r\n this.dataMap[serverIp][3] += n;\r\n}\r\n\r\nRunningScript.prototype.toJSON = function() {\r\n return Generic_toJSON(\"RunningScript\", this);\r\n}\r\n\r\n\r\nRunningScript.fromJSON = function(value) {\r\n return Generic_fromJSON(RunningScript, value.data);\r\n}\r\n\r\nReviver.constructors.RunningScript = RunningScript;\r\n\r\n//Creates an object that creates a map/dictionary with the IP of each existing server as\r\n//a key. Initializes every key with a specified value that can either by a number or an array\r\nfunction AllServersMap(arr=false, filterOwned=false) {\r\n for (var ip in AllServers) {\r\n if (AllServers.hasOwnProperty(ip)) {\r\n if (filterOwned && (AllServers[ip].purchasedByPlayer || AllServers[ip].hostname === \"home\")) {\r\n continue;\r\n }\r\n if (arr) {\r\n this[ip] = [0, 0, 0, 0];\r\n } else {\r\n this[ip] = 0;\r\n }\r\n }\r\n }\r\n}\r\n\r\nAllServersMap.prototype.toJSON = function() {\r\n return Generic_toJSON(\"AllServersMap\", this);\r\n}\r\n\r\n\r\nAllServersMap.fromJSON = function(value) {\r\n return Generic_fromJSON(AllServersMap, value.data);\r\n}\r\n\r\nReviver.constructors.AllServersMap = AllServersMap;\r\n\r\nexport {updateScriptEditorContent, loadAllRunningScripts, findRunningScript,\r\n RunningScript, Script, AllServersMap, scriptEditorInit, isScriptFilename};\r\n","import {CONSTANTS} from \"./Constants.js\";\r\nimport {Engine} from \"./engine.js\";\r\nimport {Faction, Factions, factionExists,\r\n joinFaction, displayFactionContent} from \"./Faction.js\";\r\nimport {Locations} from \"./Location.js\";\r\nimport {Player} from \"./Player.js\";\r\nimport {hackWorldDaemon} from \"./RedPill.js\";\r\nimport {KEY} from \"./Terminal.js\";\r\n\r\nimport {dialogBoxCreate} from \"../utils/DialogBox.js\";\r\nimport {getRandomInt, addOffset, clearObject,\r\n createElement, removeChildrenFromElement,\r\n exceptionAlert, createPopup, appendLineBreaks,\r\n removeElementById, removeElement,\r\n createProgressBarText} from \"../utils/HelperFunctions.js\";\r\nimport {Reviver, Generic_toJSON,\r\n Generic_fromJSON} from \"../utils/JSONReviver.js\";\r\nimport numeral from \"numeral/min/numeral.min\";\r\nimport {formatNumber} from \"../utils/StringHelperFunctions.js\";\r\n\r\n\r\nvar CityNames = [\"Aevum\", \"Chongqing\", \"Sector-12\", \"New Tokyo\", \"Ishima\", \"Volhaven\"];\r\n\r\nvar CyclesPerSecond = 5; //Game cycle is 200 ms\r\n\r\nvar StaminaGainPerSecond = 0.0085;\r\nvar BaseStaminaLoss = 0.285; //Base stamina loss per action. Increased based on difficulty\r\nvar MaxStaminaToGainFactor = 70000; //Max Stamina is divided by this to get bonus stamina gain\r\n\r\nvar DifficultyToTimeFactor = 10; //Action Difficulty divided by this to get base action time\r\n\r\n//The difficulty multiplier affects stamina loss and hp loss of an action. Its formula is:\r\n//difficulty ^ exponentialFactor + difficulty / linearFactor\r\nvar DiffMultExponentialFactor = 0.28;\r\nvar DiffMultLinearFactor = 670;\r\n\r\nvar BaseRecruitmentTimeNeeded = 300; //Base time needed (s) to complete a Recruitment action\r\n\r\nvar PopulationThreshold = 1e9; //Population at which success rates start being affected\r\nvar ChaosThreshold = 50; //City chaos level after which it starts making tasks harder\r\n\r\nvar BaseStatGain = 1; //Base stat gain per second\r\nvar BaseIntGain = 0.001; //Base intelligence stat gain\r\n\r\nvar ActionCountGrowthPeriod = 300; //Time (s) it takes for action count to grow by its specified value\r\n\r\nvar RankToFactionRepFactor = 2; //Delta Faction Rep = this * Delta Rank\r\nvar RankNeededForFaction = 25;\r\n\r\nvar ContractSuccessesPerLevel = 3; //How many successes you need to level up a contract\r\nvar OperationSuccessesPerLevel = 2.5; //How many successes you need to level up an op\r\n\r\nvar RanksPerSkillPoint = 4; //How many ranks needed to get 1 Skill Point\r\n\r\nvar ContractBaseMoneyGain = 10e3; //Base Money Gained per contract\r\n\r\n//DOM related variables\r\nvar ActiveActionCssClass = \"bladeburner-active-action\";\r\n\r\n//Console related stuff\r\nvar consoleHistory = []; //Console command history\r\nvar consoleHistoryIndex = 0;\r\nvar consoleHelpText = {\r\n helpList:\"Use 'help [command]' to get more information about a particular Bladeburner console command.<br><br>\" +\r\n \"automate [var] [val] [hi/low] Configure simple automation for Bladeburner tasks<br>\" +\r\n \"clear/cls Clear the console<br>\" +\r\n \"help [cmd] Display this help text, or help text for a specific command<br>\" +\r\n \"log [en/dis] [type] Enable or disable logging for events and actions<br>\" +\r\n \"skill [action] [name] Level or display info about your Bladeburner skills<br>\" +\r\n \"start [type] [name] Start a Bladeburner action/task<br>\" +\r\n \"stop Stops your current Bladeburner action/task<br>\",\r\n automate:\"automate [var] [val] [hi/low]<br><br>\" +\r\n \"A simple way to automate your Bladeburner actions. This console command can be used \" +\r\n \"to automatically start an action when your stamina rises above a certain threshold, and \" +\r\n \"automatically switch to another action when your stamina drops below another threshold.<br><br>\" +\r\n \"automate status - Check the current status of your automation and get a brief description of what it'll do<br>\" +\r\n \"automate en - Enable the automation feature<br>\" +\r\n \"automate dis - Disable the automation feature<br><br>\" +\r\n \"There are four properties that must be set for this automation to work properly. Here is how to set them:<br><br>\" +\r\n \"automate stamina 100 high<br>\" +\r\n \"automate contract Tracking high<br>\" +\r\n \"automate stamina 50 low<br>\" +\r\n 'automate general \"Field Analysis\" low<br><br>' +\r\n \"Using the four console commands above will set the automation to perform Tracking contracts \" +\r\n \"if your stamina is 100 or higher, and then switch to Field Analysis if your stamina drops below \" +\r\n \"50. Note that when setting the action, the name of the action is CASE-SENSITIVE. It must \" +\r\n \"exactly match whatever the name is in the UI.\",\r\n clear:\"clear<br><br>Clears the console\",\r\n cls:\"cls<br><br>Clears the console\",\r\n help:\"help [command]<br><br>\" +\r\n \"Running 'help' with no arguments displays the general help text, which lists all console commands \" +\r\n \"and a brief description of what they do. A command can be specified to get more specific help text \" +\r\n \"about that particular command. For example:<br><br>\" +\r\n \"help automate<br><br>\" +\r\n \"will display specific information about using the automate console command\",\r\n log:\"log [en/dis] [type]<br><br>\" +\r\n \"Enable or disable logging. By default, the results of completing actions such as contracts/operations are logged \" +\r\n \"in the console. There are also random events that are logged in the console as well. The five categories of \" +\r\n \"things that get logged are:<br><br>\" +\r\n \"[general, contracts, ops, blackops, events]<br><br>\" +\r\n \"The logging for these categories can be enabled or disabled like so:<br><br>\" +\r\n \"log dis contracts - Disables logging that occurs when contracts are completed<br>\" +\r\n \"log en contracts - Enables logging that occurs when contracts are completed<br>\" +\r\n \"log dis events - Disables logging for Bladeburner random events<br><br>\" +\r\n \"Logging can be universally enabled/disabled using the 'all' keyword:<br><br>\" +\r\n \"log dis all<br>\" +\r\n \"log en all\",\r\n skill:\"skill [action] [name]<br><br>\" +\r\n \"Level or display information about your skills.<br><br>\" +\r\n \"To display information about all of your skills and your multipliers, use:<br><br>\" +\r\n \"skill list<br><br>\" +\r\n \"To display information about a specific skill, specify the name of the skill afterwards. \" +\r\n \"Note that the name of the skill is case-sensitive. Enter it exactly as seen in the UI. If \" +\r\n \"the name of the skill has whitespace, enclose the name of the skill in double quotation marks:<br><br>\" +\r\n \"skill list Reaper<br>\" +\r\n 'skill list \"Digital Observer\"<br><br>' +\r\n \"This console command can also be used to level up skills:<br><br>\" +\r\n \"skill level [skill name]\",\r\n start:\"start [type] [name]<br><br>\" +\r\n \"Start an action. An action is specified by its type and its name. The \" +\r\n \"name is case-sensitive. It must appear exactly as it does in the UI. If \" +\r\n \"the name of the action has whitespace, enclose it in double quotation marks. \" +\r\n \"Valid action types include:<br><br>\" +\r\n \"[general, contract, op, blackop]<br><br>\" +\r\n \"Examples:<br><br>\" +\r\n 'start contract Tracking<br>' +\r\n 'start op \"Undercover Operation\"<br>',\r\n stop:\"stop<br><br>\" +\r\n \"Stop your current action and go idle\",\r\n}\r\n\r\n//Keypresses for Console\r\n$(document).keydown(function(event) {\r\n if (Engine.currentPage === Engine.Page.Bladeburner) {\r\n //if (DomElems.consoleInput && !event.ctrlKey && !event.shiftKey && !event.altKey) {\r\n // DomElems.consoleInput.focus();\r\n //}\r\n\r\n if (!(Player.bladeburner instanceof Bladeburner)) {return;}\r\n\r\n //NOTE: Keycodes imported from Terminal.js\r\n if (event.keyCode === KEY.ENTER) {\r\n event.preventDefault();\r\n var command = DomElems.consoleInput.value;\r\n if (command.length > 0) {\r\n Player.bladeburner.postToConsole(\"> \" + command);\r\n Player.bladeburner.resetConsoleInput();\r\n Player.bladeburner.executeConsoleCommands(command);\r\n }\r\n }\r\n\r\n if (event.keyCode === KEY.UPARROW) {\r\n if (DomElems.consoleInput == null) {return;}\r\n var i = consoleHistoryIndex;\r\n var len = consoleHistory.length;\r\n\r\n if (len === 0) {return;}\r\n if (i < 0 || i > len) {\r\n consoleHistoryIndex = len;\r\n }\r\n\r\n if (i !== 0) {\r\n --consoleHistoryIndex;\r\n }\r\n\r\n var prevCommand = consoleHistory[consoleHistoryIndex];\r\n DomElems.consoleInput.value = prevCommand;\r\n setTimeout(function(){DomElems.consoleInput.selectionStart = DomElems.consoleInput.selectionEnd = 10000; }, 0);\r\n }\r\n\r\n if (event.keyCode === KEY.DOWNARROW) {\r\n if (DomElems.consoleInput == null) {return;}\r\n var i = consoleHistoryIndex;\r\n var len = consoleHistory.length;\r\n\r\n if (len == 0) {return;}\r\n if (i < 0 || i > len) {\r\n consoleHistoryIndex = len;\r\n }\r\n\r\n //Latest command, put nothing\r\n if (i == len || i == len-1) {\r\n consoleHistoryIndex = len;\r\n DomElems.consoleInput.value = \"\";\r\n } else {\r\n ++consoleHistoryIndex;\r\n var prevCommand = consoleHistory[consoleHistoryIndex];\r\n DomElems.consoleInput.value = prevCommand;\r\n }\r\n }\r\n }\r\n});\r\n\r\nfunction City(params={}) {\r\n this.name = params.name ? params.name : Locations.Sector12;\r\n\r\n //Synthoid population and estimate\r\n this.pop = params.pop ? params.pop : getRandomInt(800e6, 1.2*PopulationThreshold);\r\n this.popEst = this.pop * (Math.random() + 0.5);\r\n\r\n //Number of Synthoid communities population and estimate\r\n this.comms = params.comms ? params.comms : getRandomInt(1, 40);\r\n this.commsEst = this.comms + getRandomInt(-2, 2);\r\n if (this.commsEst < 0) {this.commsEst = 0;}\r\n this.chaos = 0;\r\n}\r\n\r\nCity.prototype.improvePopulationEstimateByCount = function(n) {\r\n if (isNaN(n)) {throw new Error(\"NaN passeed into City.improvePopulationEstimateByCount()\");}\r\n if (this.popEst < this.pop) {\r\n this.popEst += n;\r\n if (this.popEst > this.pop) {this.popEst = this.pop;}\r\n } else if (this.popEst > this.pop) {\r\n this.popEst -= n;\r\n if (this.popEst < this.pop) {this.popEst = this.pop;}\r\n }\r\n}\r\n\r\n//@p is the percentage, not the multiplier. e.g. pass in p = 5 for 5%\r\nCity.prototype.improvePopulationEstimateByPercentage = function(p, skillMult=1) {\r\n p = p*skillMult;\r\n if (isNaN(p)) {throw new Error(\"NaN passed into City.improvePopulationEstimateByPercentage()\");}\r\n if (this.popEst < this.pop) {\r\n ++this.popEst; //In case estimate is 0\r\n this.popEst *= (1 + (p/100));\r\n if (this.popEst > this.pop) {this.popEst = this.pop;}\r\n } else if (this.popEst > this.pop) {\r\n this.popEst *= (1 - (p/100));\r\n if (this.popEst < this.pop) {this.popEst = this.pop;}\r\n }\r\n}\r\n\r\nCity.prototype.improveCommunityEstimate = function(n=1) {\r\n if (isNaN(n)) {throw new Error(\"NaN passed into City.improveCommunityEstimate()\");}\r\n if (this.commsEst < this.comms) {\r\n this.commsEst += n;\r\n if (this.commsEst > this.comms) {this.commsEst = this.comms;}\r\n } else if (this.commsEst > this.comms) {\r\n this.commsEst -= n;\r\n if (this.commsEst < this.comms) {this.commsEst = this.comms;}\r\n }\r\n}\r\n\r\n//@params options:\r\n// estChange(int): How much the estimate should change by\r\n// estOffset(int): Add offset to estimate (offset by percentage)\r\nCity.prototype.changePopulationByCount = function(n, params={}) {\r\n if (isNaN(n)) {throw new Error(\"NaN passed into City.changePopulationByCount()\");}\r\n this.pop += n;\r\n if (params.estChange && !isNaN(params.estChange)) {this.popEst += params.estChange;}\r\n if (params.estOffset) {\r\n this.popEst = addOffset(this.popEst, params.estOffset);\r\n }\r\n this.popEst = Math.max(this.popEst, 0);\r\n}\r\n\r\n//@p is the percentage, not the multiplier. e.g. pass in p = 5 for 5%\r\n//@params options:\r\n// changeEstEqually(bool) - Change the population estimate by an equal amount\r\n// nonZero (bool) - Set to true to ensure that population always changes by at least 1\r\nCity.prototype.changePopulationByPercentage = function(p, params={}) {\r\n if (isNaN(p)) {throw new Error(\"NaN passed into City.changePopulationByPercentage()\");}\r\n if (p === 0) {return;}\r\n var change = Math.round(this.pop * (p/100));\r\n\r\n //Population always changes by at least 1\r\n if (params.nonZero && change === 0) {\r\n p > 0 ? change = 1 : change = -1;\r\n }\r\n\r\n this.pop += change;\r\n if (params.changeEstEqually) {\r\n this.popEst += change;\r\n if (this.popEst < 0) {this.popEst = 0;}\r\n }\r\n return change;\r\n}\r\n\r\nCity.prototype.changeChaosByCount = function(n) {\r\n if (isNaN(n)) {throw new Error(\"NaN passed into City.changeChaosByCount()\");}\r\n if (n === 0) {return;}\r\n this.chaos += n;\r\n if (this.chaos < 0) {this.chaos = 0;}\r\n}\r\n\r\n//@p is the percentage, not the multiplier (e.g. pass in p = 5 for 5%)\r\nCity.prototype.changeChaosByPercentage = function(p) {\r\n if (isNaN(p)) {throw new Error(\"NaN passed into City.chaosChaosByPercentage()\");}\r\n if (p === 0) {return;}\r\n var change = this.chaos * (p/100);\r\n this.chaos += change;\r\n if (this.chaos < 0) {this.chaos = 0;}\r\n}\r\n\r\nCity.prototype.toJSON = function() {\r\n return Generic_toJSON(\"City\", this);\r\n}\r\nCity.fromJSON = function(value) {\r\n return Generic_fromJSON(City, value.data);\r\n}\r\nReviver.constructors.City = City;\r\n\r\nfunction Skill(params={name:\"foo\", desc:\"foo\"}) {\r\n if (params.name) {\r\n this.name = params.name;\r\n } else {\r\n throw new Error(\"Failed to initialize Bladeburner Skill. No name was specified in ctor\");\r\n }\r\n if (params.desc) {\r\n this.desc = params.desc;\r\n } else {\r\n throw new Error(\"Failed to initialize Bladeburner Skills. No desc was specified in ctor\");\r\n }\r\n this.baseCost = params.baseCost ? params.baseCost : 1; //Cost is in Skill Points\r\n this.costInc = params.costInc ? params.costInc : 1; //Additive cost increase per level\r\n\r\n if (params.maxLvl) {this.maxLvl = params.maxLvl;}\r\n\r\n //These benefits are additive. So total multiplier will be level (handled externally) times the\r\n //effects below\r\n if (params.successChanceAll) {this.successChanceAll = params.successChanceAll;}\r\n if (params.successChanceStealth) {this.successChanceStealth = params.successChanceStealth;}\r\n if (params.successChanceKill) {this.successChanceKill = params.successChanceKill;}\r\n if (params.successChanceContract) {this.successChanceContract = params.successChanceContract;}\r\n if (params.successChanceOperation) {this.successChanceOperation = params.successChanceOperation;}\r\n\r\n //This multiplier affects everything that increases synthoid population/community estimate\r\n //e.g. Field analysis, Investigation Op, Undercover Op\r\n if (params.successChanceEstimate) {this.successChanceEstimate = params.successChanceEstimate;}\r\n\r\n if (params.actionTime) {this.actionTime = params.actionTime;}\r\n if (params.effHack) {this.effHack = params.effHack;}\r\n if (params.effStr) {this.effStr = params.effStr;}\r\n if (params.effDef) {this.effDef = params.effDef;}\r\n if (params.effDex) {this.effDex = params.effDex;}\r\n if (params.effAgi) {this.effAgi = params.effAgi;}\r\n if (params.effCha) {this.effCha = params.effCha;}\r\n\r\n if (params.stamina) {this.stamina = params.stamina;}\r\n\r\n //Equipment\r\n if (params.weaponAbility) {this.weaponAbility = params.weaponAbility;}\r\n if (params.gunAbility) {this.gunAbility = params.gunAbility;}\r\n}\r\nvar Skills = {};\r\nvar SkillNames = {\r\n BladesIntuition: \"Blade's Intuition\",\r\n Reaper: \"Reaper\",\r\n Cloak: \"Cloak\",\r\n Marksman: \"Marksman\",\r\n WeaponProficiency: \"Weapon Proficiency\",\r\n Overclock: \"Overclock\",\r\n EvasiveSystem: \"Evasive System\",\r\n ShortCircuit: \"Short-Circuit\",\r\n DigitalObserver: \"Digital Observer\",\r\n Datamancer: \"Datamancer\",\r\n Tracer: \"Tracer\",\r\n CybersEdge: \"Cyber's Edge\"\r\n}\r\n\r\n//Base Class for Contracts, Operations, and BlackOps\r\nfunction Action(params={}) {\r\n this.name = params.name ? params.name : \"\";\r\n this.desc = params.desc ? params.desc : \"\";\r\n\r\n //Difficulty scales with level\r\n //Exact formula is not set in stone\r\n //Initial design: baseDifficulty * (difficultyFac ^ level)?\r\n //difficulty Fac is slightly greater than 1\r\n this.level = 1;\r\n this.maxLevel = 1;\r\n this.autoLevel = true;\r\n this.baseDifficulty = params.baseDifficulty ? addOffset(params.baseDifficulty, 10) : 100;\r\n this.difficultyFac = params.difficultyFac ? params.difficultyFac : 1.01;\r\n\r\n //Rank increase/decrease is affected by this exponent\r\n this.rewardFac = params.rewardFac ? params.rewardFac : 1.02;\r\n\r\n this.successes = 0;\r\n this.failures = 0;\r\n\r\n //All of these scale with level/difficulty\r\n this.rankGain = params.rankGain ? params.rankGain : 0;\r\n if (params.rankLoss) {this.rankLoss = params.rankLoss;}\r\n if (params.hpLoss) {\r\n this.hpLoss = params.hpLoss;\r\n this.hpLost = 0;\r\n }\r\n\r\n //Action Category. Current categories are stealth and kill\r\n this.isStealth = params.isStealth ? true : false;\r\n this.isKill = params.isKill ? true : false;\r\n\r\n //Number of this contract remaining, and its growth rate\r\n //Growth rate is an integer and the count will increase by that integer every \"cycle\"\r\n this.count = params.count ? params.count : getRandomInt(1e3, 25e3);\r\n this.countGrowth = params.countGrowth ? params.countGrowth : getRandomInt(1, 5);\r\n\r\n //Weighting of each stat in determining action success rate\r\n var defaultWeights = {hack:1/7,str:1/7,def:1/7,dex:1/7,agi:1/7,cha:1/7,int:1/7};\r\n this.weights = params.weights ? params.weights : defaultWeights;\r\n\r\n //Check to make sure weights are summed properly\r\n var sum = 0;\r\n for (var weight in this.weights) {\r\n if (this.weights.hasOwnProperty(weight)) {\r\n sum += this.weights[weight];\r\n }\r\n }\r\n if (sum - 1 >= 10 * Number.EPSILON) {\r\n throw new Error(\"Invalid weights when constructing Action \" + this.name +\r\n \". The weights should sum up to 1. They sum up to :\" + 1);\r\n }\r\n\r\n //Diminishing returns of stats (stat ^ decay where 0 <= decay <= 1)\r\n var defaultDecays = {hack:0.9,str:0.9,def:0.9,dex:0.9,agi:0.9,cha:0.9,int:0.9};\r\n this.decays = params.decays ? params.decays : defaultDecays;\r\n for (var decay in this.decays) {\r\n if (this.decays.hasOwnProperty(decay)) {\r\n if (this.decays[decay] > 1) {\r\n throw new Error(\"Invalid decays when constructing \" +\r\n \"Action \" + this.name + \". \" +\r\n \"Decay value cannot be greater than 1\");\r\n }\r\n }\r\n }\r\n}\r\n\r\nAction.prototype.getDifficulty = function() {\r\n var difficulty = this.baseDifficulty * Math.pow(this.difficultyFac, this.level-1);\r\n if (isNaN(difficulty)) {throw new Error(\"Calculated NaN in Action.getDifficulty()\");}\r\n return difficulty;\r\n}\r\n\r\n//@inst - Bladeburner Object\r\n//@params - options:\r\n// est (bool): Get success chance estimate instead of real success chance\r\nAction.prototype.getSuccessChance = function(inst, params={}) {\r\n if (inst == null) {throw new Error(\"Invalid Bladeburner instance passed into Action.getSuccessChance\");}\r\n var difficulty = this.getDifficulty();\r\n var competence = 0;\r\n for (var stat in this.weights) {\r\n if (this.weights.hasOwnProperty(stat)) {\r\n var playerStatLvl = Player.queryStatFromString(stat);\r\n var key = \"eff\" + stat.charAt(0).toUpperCase() + stat.slice(1);\r\n var effMultiplier = inst.skillMultipliers[key];\r\n if (effMultiplier == null) {\r\n console.log(\"ERROR: Failed to find Bladeburner Skill multiplier for: \" + stat);\r\n effMultiplier = 1;\r\n }\r\n competence += (this.weights[stat] * Math.pow(effMultiplier*playerStatLvl, this.decays[stat]));\r\n }\r\n }\r\n competence *= inst.calculateStaminaPenalty();\r\n\r\n //For Operations, factor in team members\r\n if (this instanceof Operation || this instanceof BlackOperation) {\r\n if (this.teamCount && this.teamCount > 0) {\r\n this.teamCount = Math.min(this.teamCount, inst.teamSize);\r\n var teamMultiplier = Math.pow(this.teamCount, 0.05);\r\n competence *= teamMultiplier;\r\n }\r\n }\r\n\r\n //Lower city population results in lower chances\r\n if (!(this instanceof BlackOperation)) {\r\n var city = inst.getCurrentCity();\r\n if (params.est) {\r\n competence *= (city.popEst / PopulationThreshold);\r\n } else {\r\n competence *= (city.pop / PopulationThreshold);\r\n }\r\n\r\n //Too high of a chaos results in lower chances\r\n if (city.chaos > ChaosThreshold) {\r\n var diff = 1 + (city.chaos - ChaosThreshold);\r\n var mult = Math.pow(diff, 0.1);\r\n difficulty *= mult;\r\n }\r\n\r\n //For Raid Operations, no communities = fail\r\n if (this instanceof Operation && this.name === \"Raid\") {\r\n if (city.comms <= 0) {return 0;}\r\n }\r\n }\r\n\r\n //Factor skill multipliers into success chance\r\n competence *= inst.skillMultipliers.successChanceAll;\r\n if (this instanceof Operation || this instanceof BlackOperation) {\r\n competence *= inst.skillMultipliers.successChanceOperation;\r\n }\r\n if (this instanceof Contract) {\r\n competence *= inst.skillMultipliers.successChanceContract;\r\n }\r\n if (this.isStealth) {\r\n competence *= inst.skillMultipliers.successChanceStealth;\r\n }\r\n if (this.isKill) {\r\n competence *= inst.skillMultipliers.successChanceKill;\r\n }\r\n\r\n //Augmentation multiplier\r\n competence *= Player.bladeburner_success_chance_mult;\r\n\r\n if (isNaN(competence)) {throw new Error(\"Competence calculated as NaN in Action.getSuccessChance()\");}\r\n return Math.min(1, competence / difficulty);\r\n}\r\n\r\n//Tests for success. Should be called when an action has completed\r\n// @inst - Bladeburner Object\r\nAction.prototype.attempt = function(inst) {\r\n return (Math.random() < this.getSuccessChance(inst));\r\n}\r\n\r\nAction.prototype.getActionTime = function(inst) {\r\n var difficulty = this.getDifficulty();\r\n var baseTime = difficulty / DifficultyToTimeFactor;\r\n var skillFac = inst.skillMultipliers.actionTime; //Always < 1\r\n\r\n var effAgility = Player.agility * inst.skillMultipliers.effAgi;\r\n var effDexterity = Player.dexterity * inst.skillMultipliers.effDex;\r\n var statFac = 0.5 * (Math.pow(effAgility, 0.03) + Math.pow(effDexterity, 0.03)); //Always > 1\r\n\r\n baseTime = Math.max(1, baseTime * skillFac / statFac);\r\n\r\n if (this instanceof Contract) {\r\n return Math.ceil(baseTime);\r\n } else if (this instanceof Operation) {\r\n return Math.ceil(baseTime);\r\n } else if (this instanceof BlackOperation) {\r\n return Math.ceil(baseTime * 1.5);\r\n } else {\r\n throw new Error(\"Unrecognized Action Type in Action.getActionTime(this). Must be either Contract, Operation, or BlackOperation\");\r\n }\r\n}\r\n\r\nAction.prototype.getSuccessesNeededForNextLevel = function(baseSuccessesPerLevel) {\r\n return Math.ceil((0.5) * (this.maxLevel) * (2 * baseSuccessesPerLevel + (this.maxLevel-1)));\r\n}\r\n\r\nAction.prototype.setMaxLevel = function(baseSuccessesPerLevel) {\r\n if (this.successes >= this.getSuccessesNeededForNextLevel(baseSuccessesPerLevel)) {\r\n ++this.maxLevel;\r\n }\r\n}\r\n\r\nAction.prototype.toJSON = function() {\r\n return Generic_toJSON(\"Action\", this);\r\n}\r\nAction.fromJSON = function(value) {\r\n return Generic_fromJSON(Action, value.data);\r\n}\r\nReviver.constructors.Action = Action;\r\nvar GeneralActions = {}; //Training, Field Analysis, Recruitment, etc.\r\n\r\n//Action Identifier\r\nvar ActionTypes = Object.freeze({\r\n \"Idle\": 1,\r\n \"Contract\": 2,\r\n \"Operation\": 3,\r\n \"BlackOp\": 4,\r\n \"BlackOperation\": 4,\r\n \"Training\": 5,\r\n \"Recruitment\": 6,\r\n \"FieldAnalysis\": 7,\r\n \"Field Analysis\": 7\r\n});\r\nfunction ActionIdentifier(params={}) {\r\n if (params.name) {this.name = params.name;}\r\n if (params.type) {this.type = params.type;}\r\n}\r\nActionIdentifier.prototype.toJSON = function() {\r\n return Generic_toJSON(\"ActionIdentifier\", this);\r\n}\r\nActionIdentifier.fromJSON = function(value) {\r\n return Generic_fromJSON(ActionIdentifier, value.data);\r\n}\r\nReviver.constructors.ActionIdentifier = ActionIdentifier;\r\n\r\n//Contracts\r\nfunction Contract(params={}) {\r\n Action.call(this, params);\r\n}\r\nContract.prototype = Object.create(Action.prototype);\r\nContract.prototype.toJSON = function() {\r\n return Generic_toJSON(\"Contract\", this);\r\n}\r\nContract.fromJSON = function(value) {\r\n return Generic_fromJSON(Contract, value.data);\r\n}\r\nReviver.constructors.Contract = Contract;\r\n\r\n//Operations\r\nfunction Operation(params={}) {\r\n Action.call(this, params);\r\n this.reqdRank = params.reqdRank ? params.reqdRank : 100;\r\n this.teamCount = params.teamCount ? params.teamCount : 0; //# of team members to use\r\n}\r\nOperation.prototype = Object.create(Action.prototype);\r\nOperation.prototype.toJSON = function() {\r\n return Generic_toJSON(\"Operation\", this);\r\n}\r\nOperation.fromJSON = function(value) {\r\n return Generic_fromJSON(Operation, value.data);\r\n}\r\nReviver.constructors.Operation = Operation;\r\n\r\n//Black Operations\r\nfunction BlackOperation(params={}) {\r\n Operation.call(this, params);\r\n\r\n //Black ops are one time missions\r\n this.count = 1;\r\n this.countGrowth = 0;\r\n}\r\nBlackOperation.prototype = Object.create(Action.prototype);\r\nBlackOperation.prototype.toJSON = function() {\r\n return Generic_toJSON(\"BlackOperation\", this);\r\n}\r\nBlackOperation.fromJSON = function(value) {\r\n return Generic_fromJSON(BlackOperation, value.data);\r\n}\r\nReviver.constructors.BlackOperation = BlackOperation;\r\nvar BlackOperations = {};\r\n\r\nfunction Bladeburner(params={}) {\r\n this.numHosp = 0; //Number of hospitalizations\r\n this.moneyLost = 0; //Money lost due to hospitalizations\r\n this.rank = 0;\r\n this.maxRank = 0; //Used to determine skill points\r\n\r\n this.skillPoints = 0;\r\n this.totalSkillPoints = 0;\r\n\r\n this.teamSize = 0; //Number of team members\r\n this.teamLost = 0; //Number of team members lost\r\n\r\n this.storedCycles = 0;\r\n\r\n this.randomEventCounter = getRandomInt(300, 600); //5-10 minutes\r\n\r\n //These times are in seconds\r\n this.actionTimeToComplete = 0; //0 or -1 is an infinite running action (like training)\r\n this.actionTimeCurrent = 0;\r\n\r\n //ActionIdentifier Object\r\n var idleActionType = ActionTypes[\"Idle\"];\r\n this.action = new ActionIdentifier({type:idleActionType});\r\n\r\n this.cities = {};\r\n for (var i = 0; i < CityNames.length; ++i) {\r\n this.cities[CityNames[i]] = new City({name:CityNames[i]});\r\n }\r\n this.city = Locations.Sector12;\r\n\r\n //Map of SkillNames -> level\r\n this.skills = {};\r\n this.skillMultipliers = {};\r\n this.updateSkillMultipliers(); //Calls resetSkillMultipliers()\r\n\r\n //Max Stamina is based on stats and Bladeburner-specific bonuses\r\n this.staminaBonus = 0; //Gained from training\r\n this.maxStamina = 0;\r\n this.calculateMaxStamina();\r\n this.stamina = this.maxStamina;\r\n\r\n //Contracts and Operations objects. These objects have unique\r\n //properties because they are randomized in each instance and have stats like\r\n //successes/failures, so they need to be saved/loaded by the game.\r\n this.contracts = {};\r\n this.operations = {};\r\n\r\n //Object that contains name of all Black Operations that have been completed\r\n this.blackops = {};\r\n\r\n //Flags for whether these actions should be logged to console\r\n this.logging = {\r\n general:true,\r\n contracts:true,\r\n ops:true,\r\n blackops:true,\r\n events:true,\r\n }\r\n\r\n //Simple automation values\r\n this.automateEnabled = false;\r\n this.automateActionHigh = 0;\r\n this.automateThreshHigh = 0; //Stamina Threshold\r\n this.automateActionLow = 0;\r\n this.automateThreshLow = 0; //Stamina Threshold\r\n\r\n //Initialization\r\n initBladeburner();\r\n this.initializeDomElementRefs();\r\n if (params.new) {this.create();}\r\n}\r\n\r\nBladeburner.prototype.create = function() {\r\n this.contracts[\"Tracking\"] = new Contract({\r\n name:\"Tracking\",\r\n desc:\"Identify and locate Synthoids. This contract involves reconnaissance \" +\r\n \"and information-gathering ONLY. Do NOT engage. Stealth is of the utmost importance.<br><br>\" +\r\n \"Successfully completing Tracking contracts will slightly improve your Synthoid population estimate for \" +\r\n \"whatever city you are currently in.\",\r\n baseDifficulty:125,difficultyFac:1.02,rewardFac:1.041,\r\n rankGain:0.3, hpLoss:0.5,\r\n count:getRandomInt(300, 800), countGrowth:getRandomInt(1, 5),\r\n weights:{hack:0,str:0.05,def:0.05,dex:0.35,agi:0.35,cha:0.1, int:0.05},\r\n decays:{hack:0,str:0.91,def:0.91,dex:0.91,agi:0.91,cha:0.9, int:1},\r\n isStealth:true\r\n });\r\n this.contracts[\"Bounty Hunter\"] = new Contract({\r\n name:\"Bounty Hunter\",\r\n desc:\"Hunt down and capture fugitive Synthoids. These Synthoids are wanted alive.<br><br>\" +\r\n \"Successfully completing a Bounty Hunter contract will lower the population in your \" +\r\n \"current city, and will also increase its chaos level.\",\r\n baseDifficulty:250, difficultyFac:1.04,rewardFac:1.085,\r\n rankGain:0.9, hpLoss:1,\r\n count:getRandomInt(200, 750), countGrowth:getRandomInt(1, 3),\r\n weights:{hack:0,str:0.15,def:0.15,dex:0.25,agi:0.25,cha:0.1, int:0.1},\r\n decays:{hack:0,str:0.91,def:0.91,dex:0.91,agi:0.91,cha:0.8, int:0.9},\r\n isKill:true\r\n });\r\n this.contracts[\"Retirement\"] = new Contract({\r\n name:\"Retirement\",\r\n desc:\"Hunt down and retire (kill) rogue Synthoids.<br><br>\" +\r\n \"Successfully copmleting a Retirement contract will lower the population in your current \" +\r\n \"city, and will also increase its chaos level.\",\r\n baseDifficulty:200, difficultyFac:1.03, rewardFac:1.065,\r\n rankGain:0.6, hpLoss:1,\r\n count:getRandomInt(300, 900), countGrowth:getRandomInt(1,4),\r\n weights:{hack:0,str:0.2,def:0.2,dex:0.2,agi:0.2,cha:0.1, int:0.1},\r\n decays:{hack:0,str:0.91,def:0.91,dex:0.91,agi:0.91,cha:0.8, int:0.9},\r\n isKill:true\r\n });\r\n\r\n this.operations[\"Investigation\"] = new Operation({\r\n name:\"Investigation\",\r\n desc:\"As a field agent, investigate and identify Synthoid \" +\r\n \"populations, movements, and operations.<br><br>Successful \" +\r\n \"Investigation ops will increase the accuracy of your \" +\r\n \"synthoid data.<br><br>\" +\r\n \"You will NOT lose HP from failed Investigation ops.\",\r\n baseDifficulty:400, difficultyFac:1.03,rewardFac:1.07,reqdRank:25,\r\n rankGain:2, rankLoss:0.2,\r\n count:getRandomInt(50, 400), countGrowth:1,\r\n weights:{hack:0.25,str:0.05,def:0.05,dex:0.2,agi:0.1,cha:0.25, int:0.1},\r\n decays:{hack:0.85,str:0.9,def:0.9,dex:0.9,agi:0.9,cha:0.7, int:0.9},\r\n isStealth:true\r\n });\r\n this.operations[\"Undercover Operation\"] = new Operation({\r\n name:\"Undercover Operation\",\r\n desc:\"Conduct undercover operations to identify hidden \" +\r\n \"and underground Synthoid communities and organizations.<br><br>\" +\r\n \"Successful Undercover ops will increase the accuracy of your synthoid \" +\r\n \"data.\",\r\n baseDifficulty:500, difficultyFac:1.04, rewardFac:1.09, reqdRank:100,\r\n rankGain:4, rankLoss:0.4, hpLoss:2,\r\n count:getRandomInt(50, 300), countGrowth:1,\r\n weights:{hack:0.2,str:0.05,def:0.05,dex:0.2,agi:0.2,cha:0.2, int:0.1},\r\n decays:{hack:0.8,str:0.9,def:0.9,dex:0.9,agi:0.9,cha:0.7, int:0.9},\r\n isStealth:true\r\n });\r\n this.operations[\"Sting Operation\"] = new Operation({\r\n name:\"Sting Operation\",\r\n desc:\"Conduct a sting operation to bait and capture particularly \" +\r\n \"notorious Synthoid criminals.\",\r\n baseDifficulty:650, difficultyFac:1.04, rewardFac:1.095, reqdRank:500,\r\n rankGain:5, rankLoss:0.5, hpLoss:2.5,\r\n count:getRandomInt(25,400), countGrowth:0.75,\r\n weights:{hack:0.25,str:0.05,def:0.05,dex:0.25,agi:0.1,cha:0.2, int:0.1},\r\n decays:{hack:0.8,str:0.85,def:0.85,dex:0.85,agi:0.85,cha:0.7, int:0.9},\r\n isStealth:true\r\n });\r\n this.operations[\"Raid\"] = new Operation({\r\n name:\"Raid\",\r\n desc:\"Lead an assault on a known Synthoid community. Note that \" +\r\n \"there must be an existing Synthoid community in your current city \" +\r\n \"in order for this Operation to be successful\",\r\n baseDifficulty:800, difficultyFac:1.045, rewardFac:1.1, reqdRank:3000,\r\n rankGain:50,rankLoss:2.5,hpLoss:50,\r\n count:getRandomInt(25, 150), countGrowth:0.2,\r\n weights:{hack:0.1,str:0.2,def:0.2,dex:0.2,agi:0.2,cha:0, int:0.1},\r\n decays:{hack:0.7,str:0.8,def:0.8,dex:0.8,agi:0.8,cha:0, int:0.9},\r\n isKill:true\r\n });\r\n this.operations[\"Stealth Retirement Operation\"] = new Operation({\r\n name:\"Stealth Retirement Operation\",\r\n desc:\"Lead a covert operation to retire Synthoids. The \" +\r\n \"objective is to complete the task without \" +\r\n \"drawing any attention. Stealth and discretion are key.\",\r\n baseDifficulty:1000, difficultyFac:1.05, rewardFac:1.11, reqdRank:20e3,\r\n rankGain:20, rankLoss:2, hpLoss:10,\r\n count:getRandomInt(25, 250), countGrowth:0.1,\r\n weights:{hack:0.1,str:0.1,def:0.1,dex:0.3,agi:0.3,cha:0, int:0.1},\r\n decays:{hack:0.7,str:0.8,def:0.8,dex:0.8,agi:0.8,cha:0, int:0.9},\r\n isStealth:true, isKill:true\r\n });\r\n this.operations[\"Assassination\"] = new Operation({\r\n name:\"Assassination\",\r\n desc:\"Assassinate Synthoids that have been identified as \" +\r\n \"important, high-profile social and political leaders \" +\r\n \"in the Synthoid communities.\",\r\n baseDifficulty:1500, difficultyFac:1.06, rewardFac:1.14, reqdRank:50e3,\r\n rankGain:40, rankLoss:4, hpLoss:5,\r\n count:getRandomInt(25, 200), countGrowth:0.1,\r\n weights:{hack:0.1,str:0.1,def:0.1,dex:0.3,agi:0.3,cha:0, int:0.1},\r\n decays:{hack:0.6,str:0.8,def:0.8,dex:0.8,agi:0.8,cha:0, int:0.8},\r\n isStealth:true, isKill:true\r\n });\r\n}\r\n\r\nBladeburner.prototype.storeCycles = function(numCycles=1) {\r\n this.storedCycles += numCycles;\r\n}\r\n\r\nBladeburner.prototype.process = function() {\r\n //If the Player starts doing some other actions, set action to idle and alert\r\n if (Player.isWorking) {\r\n if (this.action.type !== ActionTypes[\"Idle\"]) {\r\n dialogBoxCreate(\"Your Bladeburner action was cancelled because you started \" +\r\n \"doing something else\");\r\n }\r\n this.resetAction();\r\n }\r\n\r\n //A 'tick' for this mechanic is one second (= 5 game cycles)\r\n if (this.storedCycles >= CyclesPerSecond) {\r\n var seconds = Math.floor(this.storedCycles / CyclesPerSecond);\r\n seconds = Math.min(seconds, 5); //Max of 5 'ticks'\r\n this.storedCycles -= seconds * CyclesPerSecond;\r\n\r\n //Stamina\r\n this.calculateMaxStamina();\r\n this.stamina += (this.calculateStaminaGainPerSecond() * seconds);\r\n this.stamina = Math.min(this.maxStamina, this.stamina);\r\n\r\n //Count increase for contracts/operations\r\n for (var contractName in this.contracts) {\r\n if (this.contracts.hasOwnProperty(contractName)) {\r\n var contract = this.contracts[contractName];\r\n contract.count += (seconds * contract.countGrowth/ActionCountGrowthPeriod);\r\n }\r\n }\r\n for (var operationName in this.operations) {\r\n if (this.operations.hasOwnProperty(operationName)) {\r\n var op = this.operations[operationName];\r\n op.count += (seconds * op.countGrowth/ActionCountGrowthPeriod);\r\n }\r\n }\r\n\r\n //Chaos goes down very slowly\r\n for (var i = 0; i < CityNames.length; ++i) {\r\n var city = this.cities[CityNames[i]];\r\n if (!(city instanceof City)) {throw new Error(\"Invalid City object when processing passive chaos reduction in Bladeburner.process\");}\r\n city.chaos -= (0.0001 * seconds);\r\n city.chaos = Math.max(0, city.chaos);\r\n }\r\n\r\n //Random Events\r\n this.randomEventCounter -= seconds;\r\n if (this.randomEventCounter <= 0) {\r\n this.randomEvent();\r\n this.randomEventCounter = getRandomInt(300, 600);\r\n }\r\n\r\n this.processAction(seconds);\r\n\r\n //Automation\r\n if (this.automateEnabled) {\r\n if (this.stamina <= this.automateThreshLow) {\r\n if (this.action.name !== this.automateActionLow.name || this.action.type !== this.automateActionLow.type) {\r\n this.action = this.automateActionLow;\r\n this.startAction(this.action);\r\n }\r\n } else if (this.stamina >= this.automateThreshHigh) {\r\n if (this.action.name !== this.automateActionHigh.name || this.action.type !== this.automateActionHigh.type) {\r\n this.action = this.automateActionHigh;\r\n this.startAction(this.action);\r\n }\r\n }\r\n }\r\n\r\n if (Engine.currentPage === Engine.Page.Bladeburner) {\r\n this.updateContent();\r\n }\r\n }\r\n}\r\n\r\nBladeburner.prototype.calculateMaxStamina = function() {\r\n var effAgility = Player.agility * this.skillMultipliers.effAgi;\r\n var maxStamina = (Math.pow(effAgility, 0.8) + this.staminaBonus);\r\n maxStamina *= this.skillMultipliers.stamina;\r\n maxStamina *= Player.bladeburner_max_stamina_mult;\r\n if (isNaN(maxStamina)) {throw new Error(\"Max Stamina calculated to be NaN in Bladeburner.calculateMaxStamina()\");}\r\n this.maxStamina = maxStamina;\r\n}\r\n\r\nBladeburner.prototype.calculateStaminaGainPerSecond = function() {\r\n var effAgility = Player.agility * this.skillMultipliers.effAgi;\r\n var maxStaminaBonus = this.maxStamina / MaxStaminaToGainFactor;\r\n var gain = (StaminaGainPerSecond + maxStaminaBonus) * Math.pow(effAgility, 0.17);\r\n return gain * (this.skillMultipliers.stamina * Player.bladeburner_stamina_gain_mult);\r\n}\r\n\r\nBladeburner.prototype.calculateStaminaPenalty = function() {\r\n return Math.min(1, this.stamina / (0.5 * this.maxStamina));\r\n}\r\n\r\nBladeburner.prototype.changeRank = function(change) {\r\n if (isNaN(change)) {throw new Error(\"NaN passed into Bladeburner.changeRank()\");}\r\n this.rank += change;\r\n if (this.rank < 0) {this.rank = 0;}\r\n this.maxRank = Math.max(this.rank, this.maxRank);\r\n\r\n var bladeburnersFactionName = \"Bladeburners\";\r\n if (factionExists(bladeburnersFactionName)) {\r\n var bladeburnerFac = Factions[bladeburnersFactionName];\r\n if (!(bladeburnerFac instanceof Faction)) {\r\n throw new Error(\"Could not properly get Bladeburner Faction object in Bladeburner UI Overview Faction button\");\r\n }\r\n if (bladeburnerFac.isMember) {\r\n bladeburnerFac.playerReputation += (RankToFactionRepFactor * change * Player.faction_rep_mult);\r\n }\r\n }\r\n\r\n //Gain skill points. You get 1 every 4 ranks\r\n var rankNeededForSp = (this.totalSkillPoints+1) * RanksPerSkillPoint;\r\n if (this.maxRank >= rankNeededForSp) {\r\n //Calculate how many skill points to gain\r\n var gainedSkillPoints = Math.floor((this.maxRank - rankNeededForSp) / RanksPerSkillPoint + 1);\r\n this.skillPoints += gainedSkillPoints;\r\n this.totalSkillPoints += gainedSkillPoints;\r\n }\r\n}\r\n\r\nBladeburner.prototype.getCurrentCity = function() {\r\n var city = this.cities[this.city];\r\n if (!(city instanceof City)) {\r\n throw new Error(\"Bladeburner.getCurrentCity() did not properly return a City object\");\r\n }\r\n return city;\r\n}\r\n\r\nBladeburner.prototype.resetSkillMultipliers = function() {\r\n this.skillMultipliers = {\r\n successChanceAll:1,\r\n successChanceStealth:1,\r\n successChanceKill:1,\r\n successChanceContract:1,\r\n successChanceOperation:1,\r\n successChanceEstimate:1,\r\n actionTime:1,\r\n effHack:1,\r\n effStr:1,\r\n effDef:1,\r\n effDex:1,\r\n effAgi:1,\r\n effCha:1,\r\n effInt:1,\r\n stamina:1,\r\n weaponAbility:1,\r\n gunAbility:1,\r\n };\r\n}\r\n\r\nBladeburner.prototype.updateSkillMultipliers = function() {\r\n this.resetSkillMultipliers();\r\n for (var skillName in this.skills) {\r\n if (this.skills.hasOwnProperty(skillName)) {\r\n var skill = Skills[skillName];\r\n if (skill == null) {\r\n throw new Error(\"Could not find Skill Object for: \" + skillName);\r\n }\r\n var level = this.skills[skillName];\r\n if (level == null || level <= 0) {continue;} //Not upgraded\r\n\r\n var multiplierNames = Object.keys(this.skillMultipliers);\r\n for (var i = 0; i < multiplierNames.length; ++i) {\r\n var multiplierName = multiplierNames[i];\r\n if (skill[multiplierName] != null && !isNaN(skill[multiplierName])) {\r\n var value = skill[multiplierName] * level;\r\n var multiplierValue = 1 + (value / 100);\r\n if (multiplierName === \"actionTime\") {\r\n multiplierValue = 1 - (value / 100);\r\n }\r\n this.skillMultipliers[multiplierName] *= multiplierValue;\r\n }\r\n }\r\n }\r\n }\r\n}\r\n\r\nBladeburner.prototype.upgradeSkill = function(skill) {\r\n //This does NOT handle deduction of skill points\r\n var skillName = skill.name;\r\n if (this.skills[skillName]) {\r\n ++this.skills[skillName];\r\n } else {\r\n this.skills[skillName] = 1;\r\n }\r\n if (isNaN(this.skills[skillName]) || this.skills[skillName] < 0) {\r\n throw new Error(\"Level of Skill \" + skillName + \" is invalid: \" + this.skills[skillName]);\r\n }\r\n this.updateSkillMultipliers();\r\n}\r\n\r\nBladeburner.prototype.getActionObject = function(actionId) {\r\n //Given an ActionIdentifier object, returns the corresponding\r\n //Contract, Operation, or BlackOperation object\r\n switch (actionId.type) {\r\n case ActionTypes[\"Contract\"]:\r\n return this.contracts[actionId.name];\r\n break;\r\n case ActionTypes[\"Operation\"]:\r\n return this.operations[actionId.name];\r\n break;\r\n case ActionTypes[\"BlackOp\"]:\r\n case ActionTypes[\"BlackOperation\"]:\r\n return BlackOperations[actionId.name];\r\n break;\r\n default:\r\n return null;\r\n console.log(\"WARNING: Bladeburner.getActionObject() called with an unexpected \" +\r\n \"ActionIdentifier type: \" + actionId.type);\r\n }\r\n}\r\n\r\n//Sets the player to the \"IDLE\" action\r\nBladeburner.prototype.resetAction = function() {\r\n this.action = new ActionIdentifier({type:ActionTypes.Idle});\r\n}\r\n\r\nBladeburner.prototype.startAction = function(actionId) {\r\n if (actionId == null) {return;}\r\n this.action = actionId;\r\n this.actionTimeCurrent = 0;\r\n switch (actionId.type) {\r\n case ActionTypes[\"Idle\"]:\r\n this.actionTimeToComplete = 0;\r\n break;\r\n case ActionTypes[\"Contract\"]:\r\n try {\r\n var action = this.getActionObject(actionId);\r\n if (action == null) {\r\n throw new Error(\"Failed to get Contract Object for: \" + actionId.name);\r\n }\r\n if (action.count < 1) {return this.resetAction();}\r\n this.actionTimeToComplete = action.getActionTime(this);\r\n } catch(e) {\r\n exceptionAlert(e);\r\n }\r\n break;\r\n case ActionTypes[\"Operation\"]:\r\n try {\r\n var action = this.getActionObject(actionId);\r\n if (action == null) {\r\n throw new Error (\"Failed to get Operation Object for: \" + actionId.name);\r\n }\r\n if (action.count < 1) {return this.resetAction();}\r\n this.actionTimeToComplete = action.getActionTime(this);\r\n } catch(e) {\r\n exceptionAlert(e);\r\n }\r\n break;\r\n case ActionTypes[\"BlackOp\"]:\r\n case ActionTypes[\"BlackOperation\"]:\r\n try {\r\n var action = this.getActionObject(actionId);\r\n if (action == null) {\r\n throw new Error(\"Failed to get BlackOperation object for: \" + actionId.name);\r\n }\r\n this.actionTimeToComplete = action.getActionTime(this);\r\n } catch(e) {\r\n exceptionAlert(e);\r\n }\r\n break;\r\n case ActionTypes[\"Training\"]:\r\n this.actionTimeToComplete = 30;\r\n break;\r\n case ActionTypes[\"Recruitment\"]:\r\n this.actionTimeToComplete = this.getRecruitmentTime();\r\n break;\r\n case ActionTypes[\"FieldAnalysis\"]:\r\n case ActionTypes[\"Field Analysis\"]:\r\n this.actionTimeToComplete = 30;\r\n break;\r\n default:\r\n throw new Error(\"Invalid Action Type in Bladeburner.startAction(): \" + actionId.type);\r\n break;\r\n }\r\n}\r\n\r\nBladeburner.prototype.processAction = function(seconds) {\r\n if (this.action.type === ActionTypes[\"Idle\"]) {return;}\r\n if (this.actionTimeToComplete <= 0) {\r\n console.log(\"action.type: \" + this.action.type);\r\n throw new Error(\"Invalid actionTimeToComplete value: \" + this.actionTimeToComplete);\r\n }\r\n if (!(this.action instanceof ActionIdentifier)) {\r\n throw new Error(\"Bladeburner.action is not an ActionIdentifier Object\");\r\n }\r\n\r\n this.actionTimeCurrent += seconds;\r\n if (this.actionTimeCurrent >= this.actionTimeToComplete) {\r\n return this.completeAction();\r\n }\r\n}\r\n\r\nBladeburner.prototype.completeAction = function() {\r\n switch (this.action.type) {\r\n case ActionTypes[\"Contract\"]:\r\n case ActionTypes[\"Operation\"]:\r\n try {\r\n var isOperation = (this.action.type === ActionTypes[\"Operation\"]);\r\n var action = this.getActionObject(this.action);\r\n if (action == null) {\r\n throw new Error(\"Failed to get Contract/Operation Object for: \" + this.action.name);\r\n }\r\n var difficulty = action.getDifficulty();\r\n var difficultyMultiplier = Math.pow(difficulty, DiffMultExponentialFactor) + difficulty / DiffMultLinearFactor;\r\n var rewardMultiplier = Math.pow(action.rewardFac, action.level-1);\r\n\r\n //Stamina loss is based on difficulty\r\n this.stamina -= (BaseStaminaLoss * difficultyMultiplier);\r\n if (this.stamina < 0) {this.stamina = 0;}\r\n\r\n //Process Contract/Operation success/failure\r\n if (action.attempt(this)) {\r\n this.gainActionStats(action, true);\r\n ++action.successes;\r\n --action.count;\r\n\r\n //Earn money for contracts\r\n var moneyGain = 0;\r\n if (!isOperation) {\r\n moneyGain = ContractBaseMoneyGain * rewardMultiplier;\r\n Player.gainMoney(moneyGain);\r\n }\r\n\r\n if (isOperation) {\r\n action.setMaxLevel(OperationSuccessesPerLevel);\r\n } else {\r\n action.setMaxLevel(ContractSuccessesPerLevel);\r\n }\r\n if (action.rankGain) {\r\n var gain = addOffset(action.rankGain * rewardMultiplier, 10);\r\n this.changeRank(gain);\r\n if (isOperation && this.logging.ops) {\r\n this.log(action.name + \" successfully completed! Gained \" + formatNumber(gain, 3) + \" rank\");\r\n } else if (!isOperation && this.logging.contracts) {\r\n this.log(action.name + \" contract successfully completed! Gained \" + formatNumber(gain, 3) + \" rank and \" + numeral(moneyGain).format(\"$0.000a\"));\r\n }\r\n }\r\n isOperation ? this.completeOperation(true) : this.completeContract(true);\r\n } else {\r\n this.gainActionStats(action, false);\r\n ++action.failures;\r\n var loss = 0, damage = 0;\r\n if (action.rankLoss) {\r\n loss = addOffset(action.rankLoss * rewardMultiplier, 10);\r\n this.changeRank(-1 * loss);\r\n }\r\n if (action.hpLoss) {\r\n damage = action.hpLoss * difficultyMultiplier;\r\n damage = Math.ceil(addOffset(damage, 10));\r\n this.hpLost += damage;\r\n if (Player.takeDamage(damage)) {\r\n ++this.numHosp;\r\n this.moneyLost += (CONSTANTS.HospitalCostPerHp * Player.max_hp);\r\n }\r\n }\r\n var logLossText = \"\";\r\n if (loss > 0) {logLossText += \"Lost \" + formatNumber(loss, 3) + \" rank.\";}\r\n if (damage > 0) {logLossText += \"Took \" + formatNumber(damage, 0) + \" damage.\";}\r\n if (isOperation && this.logging.ops) {\r\n this.log(action.name + \" failed! \" + logLossText);\r\n } else if (!isOperation && this.logging.contracts) {\r\n this.log(action.name + \" contract failed! \" + logLossText);\r\n }\r\n isOperation ? this.completeOperation(false) : this.completeContract(false);\r\n }\r\n if (action.autoLevel) {action.level = action.maxLevel;} //Autolevel\r\n this.startAction(this.action); //Repeat action\r\n } catch(e) {\r\n exceptionAlert(e);\r\n }\r\n break;\r\n case ActionTypes[\"BlackOp\"]:\r\n case ActionTypes[\"BlackOperation\"]:\r\n try {\r\n var action = this.getActionObject(this.action);\r\n if (action == null || !(action instanceof BlackOperation)) {\r\n throw new Error(\"Failed to get BlackOperation Object for: \" + this.action.name);\r\n }\r\n var difficulty = action.getDifficulty();\r\n var difficultyMultiplier = Math.pow(difficulty, DiffMultExponentialFactor) + difficulty / DiffMultLinearFactor;\r\n\r\n //Stamina loss is based on difficulty\r\n this.stamina -= (BaseStaminaLoss * difficultyMultiplier);\r\n if (this.stamina < 0) {this.stamina = 0;}\r\n\r\n //Team loss variables\r\n var teamCount = action.teamCount, teamLossMax;\r\n\r\n if (action.attempt(this)) {\r\n this.gainActionStats(action, true);\r\n action.count = 0;\r\n this.blackops[action.name] = true;\r\n var rankGain = 0;\r\n if (action.rankGain) {\r\n rankGain = addOffset(action.rankGain, 10);\r\n this.changeRank(rankGain);\r\n }\r\n teamLossMax = Math.ceil(teamCount/2);\r\n\r\n //Operation Daedalus\r\n if (action.name === \"Operation Daedalus\") {\r\n this.resetAction();\r\n return hackWorldDaemon(Player.bitNodeN);\r\n }\r\n\r\n if (Engine.currentPage === Engine.Page.Bladeburner) {\r\n this.createActionAndSkillsContent();\r\n }\r\n\r\n if (this.logging.blackops) {\r\n this.log(action.name + \" successful! Gained \" + formatNumber(rankGain, 1) + \" rank\");\r\n }\r\n } else {\r\n this.gainActionStats(action, false);\r\n var rankLoss = 0, damage = 0;\r\n if (action.rankLoss) {\r\n rankLoss = addOffset(action.rankLoss, 10);\r\n this.changeRank(-1 * rankLoss);\r\n }\r\n if (action.hpLoss) {\r\n damage = action.hpLoss * difficultyMultiplier;\r\n damage = Math.ceil(addOffset(damage, 10));\r\n if (Player.takeDamage(damage)) {\r\n ++this.numHosp;\r\n this.moneyLost += (CONSTANTS.HospitalCostPerHp * Player.max_hp);\r\n }\r\n }\r\n teamLossMax = Math.floor(teamCount);\r\n\r\n if (this.logging.blackops) {\r\n this.log(action.name + \" failed! Lost \" + formatNumber(rankLoss, 1) + \" rank and took\" + formatNumber(damage, 0) + \" damage\");\r\n }\r\n }\r\n\r\n this.resetAction(); //Stop regardless of success or fail\r\n\r\n //Calculate team lossses\r\n if (teamCount >= 1) {\r\n var losses = getRandomInt(1, teamLossMax);\r\n this.teamSize -= losses;\r\n this.teamLost += losses;\r\n if (this.logging.blackops) {\r\n this.log(\"You lost \" + formatNumber(losses, 0) + \" team members during \" + action.name);\r\n }\r\n }\r\n } catch(e) {\r\n exceptionAlert(e);\r\n }\r\n break;\r\n case ActionTypes[\"Training\"]:\r\n this.stamina -= (0.5 * BaseStaminaLoss);\r\n var strExpGain = 30 * Player.strength_exp_mult,\r\n defExpGain = 30 * Player.defense_exp_mult,\r\n dexExpGain = 30 * Player.dexterity_exp_mult,\r\n agiExpGain = 30 * Player.agility_exp_mult,\r\n staminaGain = 0.04 * this.skillMultipliers.stamina;\r\n Player.gainStrengthExp(strExpGain);\r\n Player.gainDefenseExp(defExpGain);\r\n Player.gainDexterityExp(dexExpGain);\r\n Player.gainAgilityExp(agiExpGain);\r\n this.staminaBonus += (staminaGain);\r\n if (this.logging.general) {\r\n this.log(\"Training completed. Gained: \" +\r\n formatNumber(strExpGain, 1) + \" str exp, \" +\r\n formatNumber(defExpGain, 1) + \" def exp, \" +\r\n formatNumber(dexExpGain, 1) + \" dex exp, \" +\r\n formatNumber(agiExpGain, 1) + \" agi exp, \" +\r\n formatNumber(staminaGain, 3) + \" max stamina\");\r\n }\r\n this.startAction(this.action); //Repeat action\r\n break;\r\n case ActionTypes[\"FieldAnalysis\"]:\r\n case ActionTypes[\"Field Analysis\"]:\r\n //Does not use stamina. Effectiveness depends on hacking, int, and cha\r\n var eff = 0.04 * Math.pow(Player.hacking_skill, 0.3) +\r\n 0.04 * Math.pow(Player.intelligence, 0.9) +\r\n 0.02 * Math.pow(Player.charisma, 0.3);\r\n eff *= Player.bladeburner_analysis_mult;\r\n if (isNaN(eff) || eff < 0) {\r\n throw new Error(\"Field Analysis Effectiveness calculated to be NaN or negative\");\r\n }\r\n var hackingExpGain = 20 * Player.hacking_exp_mult,\r\n charismaExpGain = 20 * Player.charisma_exp_mult;\r\n Player.gainHackingExp(hackingExpGain);\r\n Player.gainIntelligenceExp(BaseIntGain);\r\n Player.gainCharismaExp(charismaExpGain);\r\n this.changeRank(0.1);\r\n console.log(\"DEBUG: Field Analysis effectiveness is \" + (eff * this.skillMultipliers.successChanceEstimate));\r\n this.getCurrentCity().improvePopulationEstimateByPercentage(eff * this.skillMultipliers.successChanceEstimate);\r\n if (this.logging.general) {\r\n this.log(\"Field analysis completed. Gained 0.1 rank, \" + formatNumber(hackingExpGain, 1) + \" hacking exp, and \" + formatNumber(charismaExpGain, 1) + \" charisma exp\");\r\n }\r\n this.startAction(this.action); //Repeat action\r\n break;\r\n case ActionTypes[\"Recruitment\"]:\r\n var successChance = this.getRecruitmentSuccessChance();\r\n console.log(\"Bladeburner recruitment success chance: \" + successChance);\r\n if (Math.random() < successChance) {\r\n var expGain = 2 * BaseStatGain * this.actionTimeToComplete;\r\n Player.gainCharismaExp(expGain);\r\n ++this.teamSize;\r\n if (this.logging.general) {\r\n this.log(\"Successfully recruited a team member! Gained \" + formatNumber(expGain, 1) + \" charisma exp\");\r\n }\r\n } else {\r\n var expGain = BaseStatGain * this.actionTimeToComplete;\r\n Player.gainCharismaExp(expGain);\r\n if (this.logging.general) {\r\n this.log(\"Failed to recruit a team member. Gained \" + formatNumber(expGain, 1) + \" charisma exp\");\r\n }\r\n }\r\n this.startAction(this.action); //Repeat action\r\n break;\r\n default:\r\n break;\r\n }\r\n}\r\n\r\nBladeburner.prototype.completeContract = function(success) {\r\n if (this.action.type !== ActionTypes.Contract) {\r\n throw new Error(\"completeContract() called even though current action is not a Contract\");\r\n }\r\n var city = this.getCurrentCity();\r\n if (success) {\r\n switch (this.action.name) {\r\n case \"Tracking\":\r\n //Increase estimate accuracy by a relatively small amount\r\n city.improvePopulationEstimateByCount(getRandomInt(100, 1e3));\r\n break;\r\n case \"Bounty Hunter\":\r\n city.changePopulationByCount(-1, {estChange:-1});\r\n city.changeChaosByCount(0.02);\r\n break;\r\n case \"Retirement\":\r\n city.changePopulationByCount(-1, {estChange:-1});\r\n city.changeChaosByCount(0.04);\r\n break;\r\n default:\r\n throw new Error(\"Invalid Action name in completeContract: \" + this.action.name);\r\n }\r\n }\r\n}\r\n\r\nBladeburner.prototype.completeOperation = function(success) {\r\n if (this.action.type !== ActionTypes.Operation) {\r\n throw new Error(\"completeOperation() called even though current action is not an Operation\");\r\n }\r\n var action = this.getActionObject(this.action);\r\n if (action == null) {\r\n throw new Error(\"Failed to get Contract/Operation Object for: \" + this.action.name);\r\n }\r\n\r\n //Calculate team losses\r\n var teamCount = action.teamCount, max;\r\n if (teamCount >= 1) {\r\n if (success) {\r\n max = Math.ceil(teamCount/2);\r\n } else {\r\n max = Math.floor(teamCount)\r\n }\r\n var losses = getRandomInt(0, max);\r\n this.teamSize -= losses;\r\n this.teamLost += losses;\r\n if (this.logging.ops && losses > 0) {\r\n this.log(\"Lost \" + formatNumber(losses, 0) + \" team members during this \" + action.name);\r\n }\r\n }\r\n\r\n var city = this.getCurrentCity();\r\n if (this.logging.ops) {\r\n if (success) {\r\n this.log(action.name + \" completed successfully! \")\r\n } else {\r\n\r\n }\r\n }\r\n switch (action.name) {\r\n case \"Investigation\":\r\n if (success) {\r\n city.improvePopulationEstimateByPercentage(0.4 * this.skillMultipliers.successChanceEstimate);\r\n if (Math.random() < (0.02 * this.skillMultipliers.successChanceEstimate)) {\r\n city.improveCommunityEstimate(1);\r\n }\r\n } else {\r\n this.triggerPotentialMigration(this.city, 0.1);\r\n }\r\n break;\r\n case \"Undercover Operation\":\r\n if (success) {\r\n city.improvePopulationEstimateByPercentage(0.8 * this.skillMultipliers.successChanceEstimate);\r\n if (Math.random() < (0.02 * this.skillMultipliers.successChanceEstimate)) {\r\n city.improveCommunityEstimate(1);\r\n }\r\n } else {\r\n this.triggerPotentialMigration(this.city, 0.15);\r\n }\r\n break;\r\n case \"Sting Operation\":\r\n if (success) {\r\n city.changePopulationByPercentage(-0.1, {changeEstEqually:true, nonZero:true});\r\n }\r\n city.changeChaosByCount(0.1);\r\n break;\r\n case \"Raid\":\r\n if (success) {\r\n city.changePopulationByPercentage(-1, {changeEstEqually:true, nonZero:true});\r\n --city.comms;\r\n --city.commsEst;\r\n } else {\r\n var change = getRandomInt(-3, -1);\r\n city.changePopulationByPercentage(change, {nonZero:true});\r\n }\r\n city.changeChaosByPercentage(getRandomInt(1, 5));\r\n break;\r\n case \"Stealth Retirement Operation\":\r\n if (success) {\r\n city.changePopulationByPercentage(-0.5, {changeEstEqually:true,nonZero:true});\r\n }\r\n city.changeChaosByPercentage(getRandomInt(-3, -1));\r\n break;\r\n case \"Assassination\":\r\n if (success) {\r\n city.changePopulationByCount(-1, {estChange:-1});\r\n }\r\n city.changeChaosByPercentage(getRandomInt(-5, 5));\r\n break;\r\n default:\r\n throw new Error(\"Invalid Action name in completeOperation: \" + this.action.name);\r\n }\r\n}\r\n\r\nBladeburner.prototype.getRecruitmentTime = function() {\r\n var effCharisma = Player.charisma * this.skillMultipliers.effCha;\r\n var charismaFactor = Math.pow(effCharisma, 0.81) + effCharisma / 90;\r\n return Math.max(10, Math.round(BaseRecruitmentTimeNeeded - charismaFactor));\r\n}\r\n\r\nBladeburner.prototype.getRecruitmentSuccessChance = function() {\r\n return Math.pow(Player.charisma, 0.45) / (this.teamSize + 1);\r\n}\r\n\r\n//Process stat gains from Contracts, Operations, and Black Operations\r\n//@action(Action obj) - Derived action class\r\n//@success(bool) - Whether action was successful\r\nBladeburner.prototype.gainActionStats = function(action, success) {\r\n var difficulty = action.getDifficulty();\r\n\r\n //Gain multiplier based on difficulty. If this changes then the\r\n //same variable calculated in completeAction() needs to change too\r\n var difficultyMult = Math.pow(difficulty, 0.21);\r\n\r\n var time = this.actionTimeToComplete;\r\n var successMult = success ? 1 : 0.5;\r\n\r\n var unweightedGain = time * BaseStatGain * successMult * difficultyMult;\r\n var unweightedIntGain = time * BaseIntGain * successMult * difficultyMult;\r\n Player.gainHackingExp(unweightedGain * action.weights.hack * Player.hacking_exp_mult);\r\n Player.gainStrengthExp(unweightedGain * action.weights.str * Player.strength_exp_mult);\r\n Player.gainDefenseExp(unweightedGain * action.weights.def * Player.defense_exp_mult);\r\n Player.gainDexterityExp(unweightedGain * action.weights.dex * Player.dexterity_exp_mult);\r\n Player.gainAgilityExp(unweightedGain * action.weights.agi * Player.agility_exp_mult);\r\n Player.gainCharismaExp(unweightedGain * action.weights.cha * Player.charisma_exp_mult);\r\n Player.gainIntelligenceExp(unweightedIntGain * action.weights.int);\r\n}\r\n\r\nBladeburner.prototype.randomEvent = function() {\r\n var chance = Math.random();\r\n\r\n //Choose random source/destination city for events\r\n var sourceCityName = CityNames[getRandomInt(0, 5)];\r\n var sourceCity = this.cities[sourceCityName];\r\n if (!(sourceCity instanceof City)) {\r\n throw new Error(\"sourceCity was not a City object in Bladeburner.randomEvent()\");\r\n }\r\n\r\n var destCityName = CityNames[getRandomInt(0, 5)];\r\n while (destCityName === sourceCityName) {\r\n destCityName = CityNames[getRandomInt(0, 5)];\r\n }\r\n var destCity = this.cities[destCityName];\r\n\r\n if (!(sourceCity instanceof City) || !(destCity instanceof City)) {\r\n throw new Error(\"sourceCity was not a City object in Bladeburner.randomEvent()\");\r\n }\r\n\r\n if (chance <= 0.05) {\r\n //New Synthoid Community, 5%\r\n ++sourceCity.comms;\r\n var percentage = getRandomInt(10, 20) / 100;\r\n var count = Math.round(sourceCity.pop * percentage);\r\n sourceCity.pop += count;\r\n if (this.logging.events) {\r\n this.log(\"Intelligence indicates that a new Synthoid community was formed in a city\");\r\n }\r\n } else if (chance <= 0.1) {\r\n //Synthoid Community Migration, 5%\r\n if (sourceCity.comms <= 0) {\r\n //If no comms in source city, then instead trigger a new Synthoid community event\r\n ++sourceCity.comms;\r\n var percentage = getRandomInt(10, 20) / 100;\r\n var count = Math.round(sourceCity.pop * percentage);\r\n sourceCity.pop += count;\r\n if (this.logging.events) {\r\n this.log(\"Intelligence indicates that a new Synthoid community was formed in a city\");\r\n }\r\n } else {\r\n --sourceCity.comms;\r\n ++destCity.comms;\r\n\r\n //Change pop\r\n var percentage = getRandomInt(10, 20) / 100;\r\n var count = Math.round(sourceCity.pop * percentage);\r\n sourceCity.pop -= count;\r\n destCity.pop += count;\r\n\r\n if (this.logging.events) {\r\n this.log(\"Intelligence indicates that a Synthoid community migrated from \" + sourceCityName + \" to some other city\");\r\n }\r\n }\r\n } else if (chance <= 0.3) {\r\n //New Synthoids (non community), 20%\r\n var percentage = getRandomInt(8, 24) / 100;\r\n var count = Math.round(sourceCity.pop * percentage);\r\n sourceCity.pop += count;\r\n if (this.logging.events) {\r\n this.log(\"Intelligence indicates that the Synthoid population of \" + sourceCityName + \" just changed significantly\");\r\n }\r\n } else if (chance <= 0.5) {\r\n //Synthoid migration (non community) 20%\r\n this.triggerMigration(sourceCityName);\r\n if (this.logging.events) {\r\n this.log(\"Intelligence indicates that a large number of Synthoids migrated from \" + sourceCityName + \" to some other city\");\r\n }\r\n } else if (chance <= 0.7) {\r\n //Synthoid Riots (+chaos), 20%\r\n sourceCity.chaos += 1;\r\n sourceCity.chaos *= (1 + getRandomInt(5, 10) / 100);\r\n if (this.logging.events) {\r\n this.log(\"Tensions between Synthoids and humans lead to riots in \" + sourceCityName + \"! Chaos increased\");\r\n }\r\n } else if (chance <= 0.9) {\r\n //Less Synthoids, 20%\r\n var percentage = getRandomInt(5, 20) / 100;\r\n var count = Math.round(sourceCity.pop * percentage);\r\n sourceCity.pop -= count;\r\n if (this.logging.events) {\r\n this.log(\"Intelligence indicates that the Synthoid population of \" + sourceCityName + \" just changed significantly\");\r\n }\r\n }\r\n //20% chance of nothing happening\r\n}\r\n\r\nBladeburner.prototype.triggerPotentialMigration = function(sourceCityName, chance) {\r\n if (chance == null || isNaN(chance)) {\r\n console.log(\"ERROR: Invalid 'chance' parameter passed into Bladeburner.triggerPotentialMigration()\");\r\n }\r\n if (chance > 1) {chance /= 100;}\r\n if (Math.random() < chance) {this.triggerMigration(sourceCityName);}\r\n}\r\n\r\nBladeburner.prototype.triggerMigration = function(sourceCityName) {\r\n var destCityName = CityNames[getRandomInt(0, 5)];\r\n while (destCityName === sourceCityName) {\r\n destCityName = CityNames[getRandomInt(0, 5)];\r\n }\r\n var destCity = this.cities[destCityName];\r\n var sourceCity = this.cities[sourceCityName];\r\n if (destCity == null || sourceCity == null) {\r\n throw new Error(\"Failed to find City with name: \" + destCityName);\r\n }\r\n var rand = Math.random(), percentage = getRandomInt(3, 15) / 100;\r\n\r\n if (rand < 0.05 && sourceCity.comms > 0) { //5% chance for community migration\r\n percentage *= getRandomInt(2, 4); //Migration increases population change\r\n --sourceCity.comms;\r\n ++destCity.comms;\r\n }\r\n var count = Math.round(sourceCity.pop * percentage);\r\n sourceCity.pop -= count;\r\n destCity.pop += count;\r\n}\r\n\r\nvar DomElems = {};\r\n\r\nBladeburner.prototype.initializeDomElementRefs = function() {\r\n DomElems = {\r\n bladeburnerDiv: null,\r\n\r\n //Main Divs\r\n overviewConsoleParentDiv: null,\r\n\r\n overviewDiv: null, //Overview of stats that stays fixed on left\r\n actionAndSkillsDiv: null, //Panel for different sections (contracts, ops, skills)\r\n currentTab: null, //Contracts, Operations, Black Ops, Skills\r\n\r\n consoleDiv: null,\r\n consoleTable: null,\r\n consoleInputRow: null, //tr\r\n consoleInputCell: null, //td\r\n consoleInputHeader: null, //\"> \"\r\n consoleInput: null, //Actual input element\r\n\r\n //Overview Content\r\n overviewRank: null,\r\n overviewStamina: null,\r\n overviewStaminaHelpTip: null,\r\n overviewGen1: null, //Stamina Penalty, Team, Hospitalized stats, current city\r\n overviewEstPop: null,\r\n overviewEstPopHelpTip: null,\r\n overviewEstComms: null,\r\n overviewChaos: null,\r\n overviewSkillPoints: null,\r\n overviewAugSuccessMult: null,\r\n overviewAugMaxStaminaMult: null,\r\n overviewAugStaminaGainMult: null,\r\n overviewAugAnalysisMult: null,\r\n\r\n //Actions and Skills Content\r\n actionsAndSkillsDesc: null,\r\n actionsAndSkillsList: null, //ul element of all UI elements in this panel\r\n generalActions: {},\r\n contracts: {},\r\n operations: {},\r\n blackops: {},\r\n skills: {},\r\n };\r\n}\r\n\r\nBladeburner.prototype.createContent = function() {\r\n DomElems.bladeburnerDiv = createElement(\"div\", {\r\n id:\"bladeburner-container\", position:\"fixed\", class:\"generic-menupage-container\",\r\n });\r\n\r\n //Parent Div for Overview and Console\r\n DomElems.overviewConsoleParentDiv = createElement(\"div\", {\r\n height:\"60%\", display:\"block\", position:\"relative\",\r\n });\r\n\r\n //Overview and Action/Skill pane\r\n DomElems.overviewDiv = createElement(\"div\", {\r\n width:\"30%\", display:\"inline-block\", border:\"1px solid white\",\r\n });\r\n\r\n DomElems.actionAndSkillsDiv = createElement(\"div\", {\r\n height:\"60%\", width:\"70%\", display:\"block\",\r\n border:\"1px solid white\", margin:\"6px\", padding:\"6px\",\r\n });\r\n\r\n DomElems.currentTab = \"general\";\r\n\r\n this.createOverviewContent();\r\n this.createActionAndSkillsContent();\r\n\r\n //Console\r\n DomElems.consoleDiv = createElement(\"div\", {\r\n class:\"bladeburner-console-div\",\r\n clickListener:()=>{\r\n if (DomElems.consoleInput instanceof Element) {\r\n DomElems.consoleInput.focus();\r\n }\r\n return false;\r\n }\r\n });\r\n DomElems.consoleTable = createElement(\"table\", {class:\"bladeburner-console-table\"});\r\n DomElems.consoleInputRow = createElement(\"tr\", {class:\"bladeburner-console-input-row\", id:\"bladeubrner-console-input-row\"});\r\n DomElems.consoleInputCell = createElement(\"td\", {class:\"bladeburner-console-input-cell\"});\r\n DomElems.consoleInputHeader = createElement(\"pre\", {innerText:\"> \"});\r\n DomElems.consoleInput = createElement(\"input\", {\r\n type:\"text\", class:\"bladeburner-console-input\", tabIndex:1,\r\n onfocus:()=>{DomElems.consoleInput.value = DomElems.consoleInput.value}\r\n });\r\n\r\n DomElems.consoleInputCell.appendChild(DomElems.consoleInputHeader);\r\n DomElems.consoleInputCell.appendChild(DomElems.consoleInput);\r\n DomElems.consoleInputRow.appendChild(DomElems.consoleInputCell);\r\n DomElems.consoleTable.appendChild(DomElems.consoleInputRow);\r\n DomElems.consoleDiv.appendChild(DomElems.consoleTable);\r\n\r\n DomElems.overviewConsoleParentDiv.appendChild(DomElems.overviewDiv);\r\n DomElems.overviewConsoleParentDiv.appendChild(DomElems.consoleDiv);\r\n DomElems.bladeburnerDiv.appendChild(DomElems.overviewConsoleParentDiv);\r\n DomElems.bladeburnerDiv.appendChild(DomElems.actionAndSkillsDiv);\r\n\r\n document.getElementById(\"entire-game-container\").appendChild(DomElems.bladeburnerDiv);\r\n\r\n this.postToConsole(\"Bladeburner Console BETA\");\r\n this.postToConsole(\"Type 'help' to see console commands\");\r\n DomElems.consoleInput.focus();\r\n}\r\n\r\nBladeburner.prototype.clearContent = function() {\r\n if (DomElems.bladeburnerDiv instanceof Element) {\r\n removeChildrenFromElement(DomElems.bladeburnerDiv);\r\n removeElement(DomElems.bladeburnerDiv);\r\n }\r\n clearObject(DomElems);\r\n this.initializeDomElementRefs();\r\n}\r\n\r\nBladeburner.prototype.createOverviewContent = function() {\r\n if (DomElems.overviewDiv == null) {\r\n throw new Error(\"Bladeburner.createOverviewContent() called with DomElems.overviewDiv = null\");\r\n }\r\n\r\n DomElems.overviewRank = createElement(\"p\", {\r\n innerText:\"Rank: \",\r\n display:\"inline-block\",\r\n tooltip:\"Your rank within the Bladeburner division\",\r\n });\r\n\r\n DomElems.overviewStamina = createElement(\"p\", {\r\n display:\"inline-block\",\r\n });\r\n\r\n DomElems.overviewStaminaHelpTip = createElement(\"div\", {\r\n innerText:\"?\", class:\"help-tip\",\r\n clickListener:()=>{\r\n dialogBoxCreate(\"Performing actions will use up your stamina.<br><br>\" +\r\n \"Your max stamina is determined primarily by your agility stat.<br><br>\" +\r\n \"Your stamina gain rate is determined by both your agility and your \" +\r\n \"max stamina. Higher max stamina leads to a higher gain rate.<br><br>\" +\r\n \"Once your \" +\r\n \"stamina falls below 50% of its max value, it begins to negatively \" +\r\n \"affect the success rate of your contracts/operations. This penalty \" +\r\n \"is shown in the overview panel. If the penalty is 15%, then this means \" +\r\n \"your success rate would be multipled by 85% (100 - 15).<br><br>\" +\r\n \"Your max stamina and stamina gain rate can also be increased by \" +\r\n \"training, or through skills and Augmentation upgrades.\");\r\n }\r\n });\r\n\r\n DomElems.overviewGen1 = createElement(\"p\", {\r\n display:\"block\",\r\n });\r\n\r\n DomElems.overviewEstPop = createElement(\"p\", {\r\n innerText:\"Est. Synthoid Population: \",\r\n display:\"inline-block\",\r\n tooltip:\"This is your Bladeburner division's estimate of how many Synthoids exist \" +\r\n \"in your current city.\"\r\n });\r\n\r\n DomElems.overviewEstPopHelpTip = createElement(\"div\", {\r\n innerText:\"?\", class:\"help-tip\",\r\n clickListener:()=>{\r\n dialogBoxCreate(\"The success rate of your contracts/operations depends on \" +\r\n \"the population of Synthoids in your current city. \" +\r\n \"The success rate that is shown to you is only an estimate, \" +\r\n \"and it is based on your Synthoid population estimate.<br><br>\" +\r\n \"Therefore, it is important that this Synthoid population estimate \" +\r\n \"is accurate so that you have a better idea of your \" +\r\n \"success rate for contracts/operations. Certain \" +\r\n \"actions will increase the accuracy of your population \" +\r\n \"estimate.<br><br>\" +\r\n \"The Synthoid populations of cities can change due to your \" +\r\n \"actions or random events. If random events occur, they will \" +\r\n \"be logged in the Bladeburner Console.\");\r\n }\r\n });\r\n\r\n DomElems.overviewEstComms = createElement(\"p\", {\r\n innerText:\"Est. Synthoid Communities: \",\r\n display:\"inline-block\",\r\n tooltip:\"This is your Bladeburner divison's estimate of how many Synthoid \" +\r\n \"communities exist in your current city.\",\r\n });\r\n\r\n DomElems.overviewChaos = createElement(\"p\", {\r\n innerText:\"City Chaos: \",\r\n display:\"inline-block\",\r\n tooltip:\"The city's chaos level due to tensions and conflicts between humans and Synthoids. \" +\r\n \"Having too high of a chaos level can make contracts and operations harder.\"\r\n });\r\n\r\n DomElems.overviewSkillPoints = createElement(\"p\", {display:\"block\"});\r\n\r\n DomElems.overviewAugSuccessMult = createElement(\"p\", {display:\"block\"});\r\n DomElems.overviewAugMaxStaminaMult = createElement(\"p\", {display:\"block\"});\r\n DomElems.overviewAugStaminaGainMult = createElement(\"p\", {display:\"block\"});\r\n DomElems.overviewAugAnalysisMult = createElement(\"p\", {display:\"block\"});\r\n\r\n\r\n DomElems.overviewDiv.appendChild(DomElems.overviewRank);\r\n appendLineBreaks(DomElems.overviewDiv, 1);\r\n DomElems.overviewDiv.appendChild(DomElems.overviewStamina);\r\n DomElems.overviewDiv.appendChild(DomElems.overviewStaminaHelpTip);\r\n DomElems.overviewDiv.appendChild(DomElems.overviewGen1);\r\n DomElems.overviewDiv.appendChild(DomElems.overviewEstPop);\r\n DomElems.overviewDiv.appendChild(DomElems.overviewEstPopHelpTip);\r\n appendLineBreaks(DomElems.overviewDiv, 1);\r\n DomElems.overviewDiv.appendChild(DomElems.overviewEstComms);\r\n appendLineBreaks(DomElems.overviewDiv, 1);\r\n DomElems.overviewDiv.appendChild(DomElems.overviewChaos);\r\n appendLineBreaks(DomElems.overviewDiv, 2);\r\n DomElems.overviewDiv.appendChild(DomElems.overviewSkillPoints);\r\n appendLineBreaks(DomElems.overviewDiv, 1);\r\n DomElems.overviewDiv.appendChild(DomElems.overviewAugSuccessMult);\r\n DomElems.overviewDiv.appendChild(DomElems.overviewAugMaxStaminaMult);\r\n DomElems.overviewDiv.appendChild(DomElems.overviewAugStaminaGainMult);\r\n DomElems.overviewDiv.appendChild(DomElems.overviewAugAnalysisMult);\r\n\r\n //Travel to new city button\r\n appendLineBreaks(DomElems.overviewDiv, 1);\r\n DomElems.overviewDiv.appendChild(createElement(\"a\", {\r\n innerHTML:\"Travel\", class:\"a-link-button\", display:\"inline-block\",\r\n clickListener:()=>{\r\n var popupId = \"bladeburner-travel-popup-cancel-btn\";\r\n var popupArguments = [];\r\n popupArguments.push(createElement(\"a\", { //Cancel Button\r\n innerText:\"Cancel\", class:\"a-link-button\",\r\n clickListener:()=>{\r\n removeElementById(popupId); return false;\r\n }\r\n }))\r\n popupArguments.push(createElement(\"p\", { //Info Text\r\n innerText:\"Travel to a different city for your Bladeburner \" +\r\n \"activities. This does not cost any money. The city you are \" +\r\n \"in for your Bladeburner duties does not affect \" +\r\n \"your location in the game otherwise\",\r\n }));\r\n for (var i = 0; i < CityNames.length; ++i) {\r\n (function(inst, i) {\r\n popupArguments.push(createElement(\"div\", {\r\n //Reusing this css class...it adds a border and makes it\r\n //so that background color changes when you hover\r\n class:\"cmpy-mgmt-find-employee-option\",\r\n innerText:CityNames[i],\r\n clickListener:()=>{\r\n inst.city = CityNames[i];\r\n removeElementById(popupId);\r\n inst.updateOverviewContent();\r\n return false;\r\n }\r\n }));\r\n })(this, i);\r\n }\r\n createPopup(popupId, popupArguments);\r\n }\r\n }));\r\n\r\n //Faction button\r\n var bladeburnersFactionName = \"Bladeburners\";\r\n if (factionExists(bladeburnersFactionName)) {\r\n var bladeburnerFac = Factions[bladeburnersFactionName];\r\n if (!(bladeburnerFac instanceof Faction)) {\r\n throw new Error(\"Could not properly get Bladeburner Faction object in Bladeburner UI Overview Faction button\");\r\n }\r\n DomElems.overviewDiv.appendChild(createElement(\"a\", {\r\n innerText:\"Faction\", class:\"a-link-button\", display:\"inline-block\",\r\n tooltip:\"Apply to the Bladeburner Faction, or go to the faction page if you are already a member\",\r\n clickListener:()=>{\r\n if (bladeburnerFac.isMember) {\r\n Engine.loadFactionContent();\r\n displayFactionContent(bladeburnersFactionName);\r\n } else {\r\n if (this.rank >= RankNeededForFaction) {\r\n joinFaction(bladeburnerFac);\r\n dialogBoxCreate(\"Congratulations! You were accepted into the Bladeburners faction\");\r\n removeChildrenFromElement(DomElems.overviewDiv);\r\n this.createOverviewContent();\r\n } else {\r\n dialogBoxCreate(\"You need a rank of 25 to join the Bladeburners Faction!\")\r\n }\r\n }\r\n return false;\r\n }\r\n }));\r\n }\r\n\r\n DomElems.overviewDiv.appendChild(createElement(\"br\"));\r\n DomElems.overviewDiv.appendChild(createElement(\"br\"));\r\n\r\n this.updateOverviewContent();\r\n}\r\n\r\nBladeburner.prototype.createActionAndSkillsContent = function() {\r\n if (DomElems.currentTab == null) {DomElems.currentTab = \"general\";}\r\n\r\n removeChildrenFromElement(DomElems.actionAndSkillsDiv);\r\n clearObject(DomElems.generalActions);\r\n clearObject(DomElems.contracts);\r\n clearObject(DomElems.operations);\r\n clearObject(DomElems.blackops);\r\n clearObject(DomElems.skills);\r\n\r\n //Navigation buttons\r\n var currTab = DomElems.currentTab.toLowerCase();\r\n var buttons = [\"General\", \"Contracts\", \"Operations\", \"BlackOps\", \"Skills\"];\r\n for (var i = 0; i < buttons.length; ++i) {\r\n (function(buttons, i, inst, currTab) {\r\n\r\n DomElems.actionAndSkillsDiv.appendChild(createElement(\"a\", {\r\n innerText:buttons[i],\r\n class:currTab === buttons[i].toLowerCase() ? \"bladeburner-nav-button-inactive\" : \"bladeburner-nav-button\",\r\n clickListener:()=>{\r\n DomElems.currentTab = buttons[i].toLowerCase();\r\n inst.createActionAndSkillsContent();\r\n return false;\r\n }\r\n }));\r\n }) (buttons, i, this, currTab);\r\n }\r\n\r\n //General info/description for each action\r\n DomElems.actionsAndSkillsDesc = createElement(\"p\", {\r\n display:\"block\", margin:\"4px\", padding:\"4px\"\r\n });\r\n\r\n //List for actions/skills\r\n removeChildrenFromElement(DomElems.actionsAndSkillsList);\r\n DomElems.actionsAndSkillsList = createElement(\"ul\");\r\n\r\n switch(currTab) {\r\n case \"general\":\r\n this.createGeneralActionsContent();\r\n break;\r\n case \"contracts\":\r\n this.createContractsContent();\r\n break;\r\n case \"operations\":\r\n this.createOperationsContent();\r\n break;\r\n case \"blackops\":\r\n this.createBlackOpsContent();\r\n break;\r\n case \"skills\":\r\n this.createSkillsContent();\r\n break;\r\n default:\r\n throw new Error(\"Invalid value for DomElems.currentTab in Bladeburner.createActionAndSkillsContent\");\r\n }\r\n this.updateContent();\r\n\r\n DomElems.actionAndSkillsDiv.appendChild(DomElems.actionsAndSkillsDesc);\r\n DomElems.actionAndSkillsDiv.appendChild(DomElems.actionsAndSkillsList);\r\n}\r\n\r\nBladeburner.prototype.createGeneralActionsContent = function() {\r\n if (DomElems.actionsAndSkillsList == null || DomElems.actionsAndSkillsDesc == null) {\r\n throw new Error(\"Bladeburner.createGeneralActionsContent called with either \" +\r\n \"DomElems.actionsAndSkillsList or DomElems.actionsAndSkillsDesc = null\");\r\n }\r\n\r\n DomElems.actionsAndSkillsDesc.innerText =\r\n \"These are generic actions that will assist you in your Bladeburner \" +\r\n \"duties. They will not affect your Bladeburner rank in any way.\"\r\n\r\n for (var actionName in GeneralActions) {\r\n if (GeneralActions.hasOwnProperty(actionName)) {\r\n DomElems.generalActions[actionName] = createElement(\"div\", {\r\n class:\"bladeburner-action\", name:actionName\r\n });\r\n DomElems.actionsAndSkillsList.appendChild(DomElems.generalActions[actionName]);\r\n }\r\n }\r\n}\r\n\r\nBladeburner.prototype.createContractsContent = function() {\r\n if (DomElems.actionsAndSkillsList == null || DomElems.actionsAndSkillsDesc == null) {\r\n throw new Error(\"Bladeburner.createContractsContent called with either \" +\r\n \"DomElems.actionsAndSkillsList or DomElems.actionsAndSkillsDesc = null\");\r\n }\r\n\r\n DomElems.actionsAndSkillsDesc.innerHTML =\r\n \"Complete contracts in order to increase your Bitburner rank and earn money. \" +\r\n \"Failing a contract will cause you to lose HP, which can lead to hospitalization.<br><br>\" +\r\n \"You can unlock higher-level contracts by successfully completing them. \" +\r\n \"Higher-level contracts are more difficult, but grant more rank, experience, and money.\";\r\n\r\n for (var contractName in this.contracts) {\r\n if (this.contracts.hasOwnProperty(contractName)) {\r\n DomElems.contracts[contractName] = createElement(\"div\", {\r\n class:\"bladeburner-action\", name:contractName\r\n });\r\n DomElems.actionsAndSkillsList.appendChild(DomElems.contracts[contractName]);\r\n }\r\n }\r\n}\r\n\r\nBladeburner.prototype.createOperationsContent = function() {\r\n if (DomElems.actionsAndSkillsList == null || DomElems.actionsAndSkillsDesc == null) {\r\n throw new Error(\"Bladeburner.createOperationsContent called with either \" +\r\n \"DomElems.actionsAndSkillsList or DomElems.actionsAndSkillsDesc = null\");\r\n }\r\n\r\n DomElems.actionsAndSkillsDesc.innerHTML =\r\n \"Carry out operations for the Bladeburner division. \" +\r\n \"Failing an operation will reduce your Bladeburner rank. It will also \" +\r\n \"cause you to lose HP, which can lead to hospitalization. In general, \" +\r\n \"operations are harder and more punishing than contracts, \" +\r\n \"but are also more rewarding.<br><br>\" +\r\n \"Operations can affect the chaos level and Synthoid population of your \" +\r\n \"current city. The exact effects vary between different Operations.<br><br>\" +\r\n \"For operations, you can use a team. You must first recruit team members. \" +\r\n \"Having a larger team will improves your chances of success.<br><br>\" +\r\n \"You can unlock higher-level operations by successfully completing them. \" +\r\n \"Higher-level operations are more difficult, but grant more rank and experience.\";\r\n\r\n for (var operationName in this.operations) {\r\n if (this.operations.hasOwnProperty(operationName)) {\r\n DomElems.operations[operationName] = createElement(\"div\", {\r\n class:\"bladeburner-action\", name:operationName\r\n });\r\n DomElems.actionsAndSkillsList.appendChild(DomElems.operations[operationName]);\r\n }\r\n }\r\n}\r\n\r\nBladeburner.prototype.createBlackOpsContent = function() {\r\n if (DomElems.actionsAndSkillsList == null || DomElems.actionsAndSkillsDesc == null) {\r\n throw new Error(\"Bladeburner.createBlackOpsContent called with either \" +\r\n \"DomElems.actionsAndSkillsList or DomElems.actionsAndSkillsDesc = null\");\r\n }\r\n\r\n DomElems.actionsAndSkillsDesc.innerHTML =\r\n \"Black Operations (Black Ops) are special, one-time covert operations. \" +\r\n \"Each Black Op must be unlocked successively by completing \" +\r\n \"the one before it.<br><br>\" +\r\n \"Like normal operations, you may use a team for Black Ops. Failing \" +\r\n \"a black op will incur heavy HP and rank losses.\";\r\n\r\n //Put Black Operations in sequence of required rank\r\n var blackops = [];\r\n for (var blackopName in BlackOperations) {\r\n if (BlackOperations.hasOwnProperty(blackopName)) {\r\n blackops.push(BlackOperations[blackopName]);\r\n }\r\n }\r\n blackops.sort(function(a, b) {\r\n return (a.reqdRank - b.reqdRank);\r\n });\r\n\r\n for (var i = 0; i < blackops.length; ++i) {\r\n DomElems.blackops[blackops[i].name] = createElement(\"div\", {\r\n class:\"bladeburner-action\", name:blackops[i].name\r\n });\r\n DomElems.actionsAndSkillsList.appendChild(DomElems.blackops[blackops[i].name]);\r\n if (this.blackops[[blackops[i].name]] == null) {break;} //Can't be found in completed blackops\r\n }\r\n}\r\n\r\nBladeburner.prototype.createSkillsContent = function() {\r\n if (DomElems.actionsAndSkillsList == null || DomElems.actionsAndSkillsDesc == null) {\r\n throw new Error(\"Bladeburner.createSkillsContent called with either \" +\r\n \"DomElems.actionsAndSkillsList or DomElems.actionsAndSkillsDesc = null\");\r\n }\r\n\r\n //Display Current multipliers\r\n DomElems.actionsAndSkillsDesc.innerHTML =\r\n \"You will gain one skill point every \" + RanksPerSkillPoint + \" ranks.<br><br>\" +\r\n \"Note that when upgrading a skill, the benefit for that skill is additive. \" +\r\n \"However, the effects of different skills with each other is multiplicative.<br><br>\"\r\n var multKeys = Object.keys(this.skillMultipliers);\r\n for (var i = 0; i < multKeys.length; ++i) {\r\n var mult = this.skillMultipliers[multKeys[i]];\r\n if (mult && mult !== 1) {\r\n mult = formatNumber(mult, 3);\r\n switch(multKeys[i]) {\r\n case \"successChanceAll\":\r\n DomElems.actionsAndSkillsDesc.innerHTML += \"Total Success Chance: x\" + mult + \"<br>\";\r\n break;\r\n case \"successChanceStealth\":\r\n DomElems.actionsAndSkillsDesc.innerHTML += \"Stealth Success Chance: x\" + mult + \"<br>\";\r\n break;\r\n case \"successChanceKill\":\r\n DomElems.actionsAndSkillsDesc.innerHTML += \"Retirement Success Chance: x\" + mult + \"<br>\";\r\n break;\r\n case \"successChanceContract\":\r\n DomElems.actionsAndSkillsDesc.innerHTML += \"Contract Success Chance: x\" + mult + \"<br>\";\r\n break;\r\n case \"successChanceOperation\":\r\n DomElems.actionsAndSkillsDesc.innerHTML += \"Operation Success Chance: x\" + mult + \"<br>\";\r\n break;\r\n case \"successChanceEstimate\":\r\n DomElems.actionsAndSkillsDesc.innerHTML += \"Synthoid Data Estimate: x\" + mult + \"<br>\";\r\n break;\r\n case \"actionTime\":\r\n DomElems.actionsAndSkillsDesc.innerHTML += \"Action Time: x\" + mult + \"<br>\";\r\n break;\r\n case \"effHack\":\r\n DomElems.actionsAndSkillsDesc.innerHTML += \"Hacking Skill: x\" + mult + \"<br>\";\r\n break;\r\n case \"effStr\":\r\n DomElems.actionsAndSkillsDesc.innerHTML += \"Strength: x\" + mult + \"<br>\";\r\n break;\r\n case \"effDef\":\r\n DomElems.actionsAndSkillsDesc.innerHTML += \"Defense: x\" + mult + \"<br>\";\r\n break;\r\n case \"effDex\":\r\n DomElems.actionsAndSkillsDesc.innerHTML += \"Dexterity: x\" + mult + \"<br>\";\r\n break;\r\n case \"effAgi\":\r\n DomElems.actionsAndSkillsDesc.innerHTML += \"Agility: x\" + mult + \"<br>\";\r\n break;\r\n case \"effCha\":\r\n DomElems.actionsAndSkillsDesc.innerHTML += \"Charisma: x\" + mult + \"<br>\";\r\n break;\r\n case \"effInt\":\r\n DomElems.actionsAndSkillsDesc.innerHTML += \"Intelligence: x\" + mult + \"<br>\";\r\n break;\r\n case \"stamina\":\r\n DomElems.actionsAndSkillsDesc.innerHTML += \"Stamina: x\" + mult + \"<br>\";\r\n break;\r\n case \"weaponAbility\":\r\n //DomElems.actionsAndSkillsDesc.innerHTML +=\r\n break;\r\n case \"gunAbility\":\r\n //DomElems.actionsAndSkillsDesc.innerHTML\r\n break;\r\n default:\r\n console.log(\"Warning: Unrecognized SkillMult Key: \" + multKeys[i]);\r\n break;\r\n }\r\n }\r\n }\r\n\r\n //Skill Points\r\n DomElems.actionAndSkillsDiv.appendChild(createElement(\"p\", {\r\n innerHTML:\"<br><strong>Skill Points: \" + formatNumber(this.skillPoints, 0) + \"</strong>\"\r\n }));\r\n\r\n //UI Element for each skill\r\n for (var skillName in Skills) {\r\n if (Skills.hasOwnProperty(skillName)) {\r\n DomElems.skills[skillName] = createElement(\"div\", {\r\n class:\"bladeburner-action\", name:skillName\r\n });\r\n DomElems.actionsAndSkillsList.appendChild(DomElems.skills[skillName]);\r\n }\r\n }\r\n}\r\n\r\nBladeburner.prototype.updateContent = function() {\r\n this.updateOverviewContent();\r\n this.updateActionAndSkillsContent();\r\n}\r\n\r\nBladeburner.prototype.updateOverviewContent = function() {\r\n if (Engine.currentPage !== Engine.Page.Bladeburner) {return;}\r\n DomElems.overviewRank.childNodes[0].nodeValue = \"Rank: \" + formatNumber(this.rank, 2);\r\n DomElems.overviewStamina.innerText = \"Stamina: \" + formatNumber(this.stamina, 3) + \" / \" + formatNumber(this.maxStamina, 3);\r\n DomElems.overviewGen1.innerHTML =\r\n \"Stamina Penalty: \" + formatNumber((1-this.calculateStaminaPenalty())*100, 1) + \"%<br><br>\" +\r\n \"Team Size: \" + formatNumber(this.teamSize, 0) + \"<br>\" +\r\n \"Team Members Lost: \" + formatNumber(this.teamLost, 0) + \"<br><br>\" +\r\n \"Num Times Hospitalized: \" + this.numHosp + \"<br>\" +\r\n \"Money Lost From Hospitalizations: \" + numeral(this.moneyLost).format(\"$0.000a\") + \"<br><br>\" +\r\n \"Current City: \" + this.city + \"<br>\";\r\n\r\n DomElems.overviewEstPop.childNodes[0].nodeValue = \"Est. Synthoid Population: \" + numeral(this.getCurrentCity().popEst).format(\"0.000a\");\r\n DomElems.overviewEstComms.childNodes[0].nodeValue = \"Est. Synthoid Communities: \" + formatNumber(this.getCurrentCity().comms, 0);\r\n DomElems.overviewChaos.childNodes[0].nodeValue = \"City Chaos: \" + formatNumber(this.getCurrentCity().chaos);\r\n DomElems.overviewSkillPoints.innerText = \"Skill Points: \" + formatNumber(this.skillPoints, 0);\r\n DomElems.overviewAugSuccessMult.innerText = \"Aug. Success Chance Mult: \" + formatNumber(Player.bladeburner_success_chance_mult*100, 1) + \"%\";\r\n DomElems.overviewAugMaxStaminaMult.innerText = \"Aug. Max Stamina Mult: \" + formatNumber(Player.bladeburner_max_stamina_mult*100, 1) + \"%\";\r\n DomElems.overviewAugStaminaGainMult.innerText = \"Aug. Stamina Gain Mult: \" + formatNumber(Player.bladeburner_stamina_gain_mult*100, 1) + \"%\";\r\n DomElems.overviewAugAnalysisMult.innerText = \"Aug. Field Analysis Mult: \" + formatNumber(Player.bladeburner_analysis_mult*100, 1) + \"%\";\r\n}\r\n\r\nBladeburner.prototype.updateActionAndSkillsContent = function() {\r\n if (DomElems.currentTab == null) {DomElems.currentTab = \"general\";}\r\n switch(DomElems.currentTab.toLowerCase()) {\r\n case \"general\":\r\n var actionElems = Object.keys(DomElems.generalActions);\r\n for (var i = 0; i < actionElems.length; ++i) {\r\n var actionElem = DomElems.generalActions[actionElems[i]];\r\n var name = actionElem.name;\r\n var actionObj = GeneralActions[name];\r\n if (actionObj == null) {\r\n throw new Error(\"Could not find Object \" + name + \" in Bladeburner.updateActionAndSkillsContent()\");\r\n }\r\n if (this.action.type === ActionTypes[name]) {\r\n actionElem.classList.add(ActiveActionCssClass);\r\n } else {\r\n actionElem.classList.remove(ActiveActionCssClass);\r\n }\r\n this.updateGeneralActionsUIElement(actionElem, actionObj);\r\n }\r\n break;\r\n case \"contracts\":\r\n var contractElems = Object.keys(DomElems.contracts);\r\n for (var i = 0; i < contractElems.length; ++i) {\r\n var contractElem = DomElems.contracts[contractElems[i]];\r\n var name = contractElem.name;\r\n if (this.action.type === ActionTypes[\"Contract\"] && name === this.action.name) {\r\n contractElem.classList.add(ActiveActionCssClass);\r\n } else {\r\n contractElem.classList.remove(ActiveActionCssClass);\r\n }\r\n var contract = this.contracts[name];\r\n if (contract == null) {\r\n throw new Error(\"Could not find Contract \" + name + \" in Bladeburner.updateActionAndSkillsContent()\");\r\n }\r\n this.updateContractsUIElement(contractElem, contract);\r\n }\r\n break;\r\n case \"operations\":\r\n var operationElems = Object.keys(DomElems.operations);\r\n for (var i = 0; i < operationElems.length; ++i) {\r\n var operationElem = DomElems.operations[operationElems[i]];\r\n var name = operationElem.name;\r\n if (this.action.type === ActionTypes[\"Operation\"] && name === this.action.name) {\r\n operationElem.classList.add(ActiveActionCssClass);\r\n } else {\r\n operationElem.classList.remove(ActiveActionCssClass);\r\n }\r\n var operation = this.operations[name];\r\n if (operation == null) {\r\n throw new Error(\"Could not find Operation \" + name + \" in Bladeburner.updateActionAndSkillsContent()\");\r\n }\r\n this.updateOperationsUIElement(operationElem, operation);\r\n }\r\n break;\r\n case \"blackops\":\r\n var blackopsElems = Object.keys(DomElems.blackops);\r\n for (var i = 0; i < blackopsElems.length; ++i) {\r\n var blackopElem = DomElems.blackops[blackopsElems[i]];\r\n var name = blackopElem.name;\r\n if (this.action.type === ActionTypes[\"BlackOperation\"] && name === this.action.name) {\r\n blackopElem.classList.add(ActiveActionCssClass);\r\n } else {\r\n blackopElem.classList.remove(ActiveActionCssClass);\r\n }\r\n var blackop = BlackOperations[name];\r\n if (blackop == null) {\r\n throw new Error(\"Could not find BlackOperation \" + name + \" in Bladeburner.updateActionAndSkillsContent()\");\r\n }\r\n this.updateBlackOpsUIElement(blackopElem, blackop);\r\n }\r\n break;\r\n case \"skills\":\r\n var skillElems = Object.keys(DomElems.skills);\r\n for (var i = 0; i < skillElems.length; ++i) {\r\n var skillElem = DomElems.skills[skillElems[i]];\r\n var name = skillElem.name;\r\n var skill = Skills[name];\r\n if (skill == null) {\r\n throw new Error(\"Could not find Skill \" + name + \" in Bladeburner.updateActionAndSkillsContent()\");\r\n }\r\n this.updateSkillsUIElement(skillElem, skill);\r\n }\r\n break;\r\n default:\r\n throw new Error(\"Invalid value for DomElems.currentTab in Bladeburner.createActionAndSkillsContent\");\r\n }\r\n}\r\n\r\nBladeburner.prototype.updateGeneralActionsUIElement = function(el, action) {\r\n removeChildrenFromElement(el);\r\n var isActive = el.classList.contains(ActiveActionCssClass);\r\n\r\n el.appendChild(createElement(\"h2\", { //Header\r\n innerText:isActive ? action.name + \" (IN PROGRESS - \" +\r\n formatNumber(this.actionTimeCurrent, 0) + \" / \" +\r\n formatNumber(this.actionTimeToComplete, 0) + \")\"\r\n : action.name,\r\n display:\"inline-block\",\r\n }));\r\n\r\n if (isActive) { //Progress bar if its active\r\n var progress = this.actionTimeCurrent / this.actionTimeToComplete;\r\n el.appendChild(createElement(\"p\", {\r\n display:\"block\",\r\n innerText:createProgressBarText({progress:progress})\r\n }));\r\n } else {\r\n //Start button\r\n el.appendChild(createElement(\"a\", {\r\n innerText:\"Start\", class: \"a-link-button\",\r\n margin:\"3px\", padding:\"3px\",\r\n clickListener:()=>{\r\n this.action.type = ActionTypes[action.name];\r\n this.action.name = action.name;\r\n this.startAction(this.action);\r\n this.updateActionAndSkillsContent();\r\n return false;\r\n }\r\n }));\r\n }\r\n\r\n appendLineBreaks(el, 2);\r\n el.appendChild(createElement(\"pre\", { //Info\r\n innerHTML:action.desc, display:\"inline-block\"\r\n }));\r\n\r\n\r\n}\r\n\r\nBladeburner.prototype.updateContractsUIElement = function(el, action) {\r\n removeChildrenFromElement(el);\r\n var isActive = el.classList.contains(ActiveActionCssClass);\r\n var estimatedSuccessChance = action.getSuccessChance(this, {est:true});\r\n\r\n el.appendChild(createElement(\"h2\", { //Header\r\n innerText:isActive ? action.name + \" (IN PROGRESS - \" +\r\n formatNumber(this.actionTimeCurrent, 0) + \" / \" +\r\n formatNumber(this.actionTimeToComplete, 0) + \")\"\r\n : action.name,\r\n display:\"inline-block\"\r\n }));\r\n\r\n if (isActive) { //Progress bar if its active\r\n var progress = this.actionTimeCurrent / this.actionTimeToComplete;\r\n el.appendChild(createElement(\"p\", {\r\n display:\"block\",\r\n innerText:createProgressBarText({progress:progress})\r\n }));\r\n } else { //Start button\r\n el.appendChild(createElement(\"a\", {\r\n innerText:\"Start\", class: \"a-link-button\",\r\n padding:\"3px\", margin:\"3px\",\r\n clickListener:()=>{\r\n this.action.type = ActionTypes.Contract;\r\n this.action.name = action.name;\r\n this.startAction(this.action);\r\n this.updateActionAndSkillsContent();\r\n return false;\r\n }\r\n }));\r\n }\r\n\r\n //Level and buttons to change level\r\n var maxLevel = (action.level >= action.maxLevel);\r\n appendLineBreaks(el, 2);\r\n el.appendChild(createElement(\"pre\", {\r\n display:\"inline-block\",\r\n innerText:\"Level: \" + action.level + \" / \" + action.maxLevel,\r\n tooltip:action.getSuccessesNeededForNextLevel(ContractSuccessesPerLevel) + \" successes \" +\r\n \"needed for next level\"\r\n }));\r\n el.appendChild(createElement(\"a\", {\r\n class: maxLevel ? \"a-link-button-inactive\" : \"a-link-button\", innerHTML:\"&uarr;\",\r\n padding:\"2px\", margin:\"2px\",\r\n tooltip: isActive ? \"WARNING: changing the level will restart the contract\" : \"\",\r\n display:\"inline\",\r\n clickListener:()=>{\r\n ++action.level;\r\n if (isActive) {this.startAction(this.action);} //Restart Action\r\n this.updateContractsUIElement(el, action);\r\n return false;\r\n }\r\n }));\r\n el.appendChild(createElement(\"a\", {\r\n class: (action.level <= 1) ? \"a-link-button-inactive\" : \"a-link-button\", innerHTML:\"&darr;\",\r\n padding:\"2px\", margin:\"2px\",\r\n tooltip: isActive ? \"WARNING: changing the level will restart the contract\" : \"\",\r\n display:\"inline\",\r\n clickListener:()=>{\r\n --action.level;\r\n if (isActive) {this.startAction(this.action);} //Restart Action\r\n this.updateContractsUIElement(el, action);\r\n return false;\r\n }\r\n }));\r\n\r\n var actionTime = action.getActionTime(this);\r\n appendLineBreaks(el, 2);\r\n el.appendChild(createElement(\"pre\", { //Info\r\n display:\"inline-block\",\r\n innerHTML:action.desc + \"\\n\\n\" +\r\n \"Estimated success chance: \" + formatNumber(estimatedSuccessChance*100, 1) + \"%\\n\" +\r\n \"Time Required (s): \" + formatNumber(actionTime, 0) + \"\\n\" +\r\n \"Contracts remaining: \" + Math.floor(action.count) + \"\\n\" +\r\n \"Successes: \" + action.successes + \"\\n\" +\r\n \"Failures: \" + action.failures,\r\n }));\r\n\r\n //Autolevel Checkbox\r\n el.appendChild(createElement(\"br\"));\r\n var autolevelCheckboxId = \"bladeburner-\" + action.name + \"-autolevel-checkbox\";\r\n el.appendChild(createElement(\"label\", {\r\n for:autolevelCheckboxId, innerText:\"Autolevel\",color:\"white\",\r\n tooltip:\"Automatically increase contract level when possible\"\r\n }));\r\n var autolevelCheckbox = createElement(\"input\", {\r\n type:\"checkbox\", id:autolevelCheckboxId, margin:\"4px\",\r\n checked:action.autoLevel,\r\n changeListener:()=>{\r\n action.autoLevel = autolevelCheckbox.checked;\r\n }\r\n });\r\n el.appendChild(autolevelCheckbox);\r\n}\r\n\r\nBladeburner.prototype.updateOperationsUIElement = function(el, action) {\r\n removeChildrenFromElement(el);\r\n var isActive = el.classList.contains(ActiveActionCssClass);\r\n var estimatedSuccessChance = action.getSuccessChance(this, {est:true});\r\n el.appendChild(createElement(\"h2\", { //Header\r\n innerText:isActive ? action.name + \" (IN PROGRESS - \" +\r\n formatNumber(this.actionTimeCurrent, 0) + \" / \" +\r\n formatNumber(this.actionTimeToComplete, 0) + \")\"\r\n : action.name,\r\n display:\"inline-block\"\r\n }));\r\n\r\n if (isActive) { //Progress bar if its active\r\n var progress = this.actionTimeCurrent / this.actionTimeToComplete;\r\n el.appendChild(createElement(\"p\", {\r\n display:\"block\",\r\n innerText:createProgressBarText({progress:progress})\r\n }));\r\n } else { //Start button and set Team Size button\r\n el.appendChild(createElement(\"a\", {\r\n innerText:\"Start\", class: \"a-link-button\",\r\n margin:\"3px\", padding:\"3px\",\r\n clickListener:()=>{\r\n this.action.type = ActionTypes.Operation;\r\n this.action.name = action.name;\r\n this.startAction(this.action);\r\n this.updateActionAndSkillsContent();\r\n return false;\r\n }\r\n }));\r\n el.appendChild(createElement(\"a\", {\r\n innerText:\"Set Team Size (Curr Size: \" + formatNumber(action.teamCount, 0) + \")\", class:\"a-link-button\",\r\n margin:\"3px\", padding:\"3px\",\r\n clickListener:()=>{\r\n var popupId = \"bladeburner-operation-set-team-size-popup\";\r\n var txt = createElement(\"p\", {\r\n innerText:\"Enter the amount of team members you would like to take on these \" +\r\n \"operations. If you do not have the specified number of team members, \" +\r\n \"then as many as possible will be used. Note that team members may \" +\r\n \"be lost during operations.\"\r\n\r\n });\r\n var input = createElement(\"input\", {\r\n type:\"number\", placeholder: \"Team Members\"\r\n });\r\n var setBtn = createElement(\"a\", {\r\n innerText:\"Confirm\", class:\"a-link-button\",\r\n clickListener:()=>{\r\n var num = Math.round(parseFloat(input.value));\r\n if (isNaN(num)) {\r\n dialogBoxCreate(\"Invalid value entered for number of Team Members (must be numeric)\")\r\n } else {\r\n action.teamCount = num;\r\n this.updateOperationsUIElement(el, action);\r\n }\r\n removeElementById(popupId);\r\n return false;\r\n }\r\n });\r\n var cancelBtn = createElement(\"a\", {\r\n innerText:\"Cancel\", class:\"a-link-button\",\r\n clickListener:()=>{\r\n removeElementById(popupId);\r\n return false;\r\n }\r\n });\r\n createPopup(popupId, [txt, input, setBtn, cancelBtn]);\r\n }\r\n }));\r\n }\r\n\r\n //Level and buttons to change level\r\n var maxLevel = (action.level >= action.maxLevel);\r\n appendLineBreaks(el, 2);\r\n el.appendChild(createElement(\"pre\", {\r\n display:\"inline-block\",\r\n innerText:\"Level: \" + action.level + \" / \" + action.maxLevel,\r\n tooltip:action.getSuccessesNeededForNextLevel(OperationSuccessesPerLevel) + \" successes \" +\r\n \"needed for next level\"\r\n }));\r\n el.appendChild(createElement(\"a\", {\r\n class: maxLevel ? \"a-link-button-inactive\" : \"a-link-button\", innerHTML:\"&uarr;\",\r\n padding:\"2px\", margin:\"2px\",\r\n tooltip: isActive ? \"WARNING: changing the level will restart the Operation\" : \"\",\r\n display:\"inline\",\r\n clickListener:()=>{\r\n ++action.level;\r\n if (isActive) {this.startAction(this.action);} //Restart Action\r\n this.updateOperationsUIElement(el, action);\r\n return false;\r\n }\r\n }));\r\n el.appendChild(createElement(\"a\", {\r\n class: (action.level <= 1) ? \"a-link-button-inactive\" : \"a-link-button\", innerHTML:\"&darr;\",\r\n padding:\"2px\", margin:\"2px\",\r\n tooltip: isActive ? \"WARNING: changing the level will restart the Operation\" : \"\",\r\n display:\"inline\",\r\n clickListener:()=>{\r\n --action.level;\r\n if (isActive) {this.startAction(this.action);} //Restart Action\r\n this.updateOperationsUIElement(el, action);\r\n return false;\r\n }\r\n }));\r\n\r\n //General Info\r\n var difficulty = action.getDifficulty();\r\n var actionTime = action.getActionTime(this);\r\n appendLineBreaks(el, 2);\r\n el.appendChild(createElement(\"pre\", {\r\n display:\"inline-block\",\r\n innerHTML:action.desc + \"\\n\\n\" +\r\n \"Estimated success chance: \" + formatNumber(estimatedSuccessChance*100, 1) + \"%\\n\" +\r\n \"Time Required(s): \" + formatNumber(actionTime, 1) + \"\\n\" +\r\n \"Operations remaining: \" + Math.floor(action.count) + \"\\n\" +\r\n \"Successes: \" + action.successes + \"\\n\" +\r\n \"Failures: \" + action.failures,\r\n }));\r\n\r\n //Autolevel Checkbox\r\n el.appendChild(createElement(\"br\"));\r\n var autolevelCheckboxId = \"bladeburner-\" + action.name + \"-autolevel-checkbox\";\r\n el.appendChild(createElement(\"label\", {\r\n for:autolevelCheckboxId, innerText:\"Autolevel\",color:\"white\",\r\n tooltip:\"Automatically increase operation level when possible\"\r\n }));\r\n var autolevelCheckbox = createElement(\"input\", {\r\n type:\"checkbox\", id:autolevelCheckboxId, margin:\"4px\",\r\n checked:action.autoLevel,\r\n changeListener:()=>{\r\n action.autoLevel = autolevelCheckbox.checked;\r\n }\r\n });\r\n el.appendChild(autolevelCheckbox);\r\n}\r\n\r\nBladeburner.prototype.updateBlackOpsUIElement = function(el, action) {\r\n removeChildrenFromElement(el);\r\n var isActive = el.classList.contains(ActiveActionCssClass);\r\n var isCompleted = (this.blackops[action.name] != null);\r\n var estimatedSuccessChance = action.getSuccessChance(this, {est:true});\r\n var difficulty = action.getDifficulty();\r\n var actionTime = action.getActionTime(this);\r\n var hasReqdRank = this.rank >= action.reqdRank;\r\n\r\n //UI for Completed Black Op\r\n if (isCompleted) {\r\n el.appendChild(createElement(\"h2\", {\r\n innerText:action.name + \" (COMPLETED)\", display:\"block\",\r\n }));\r\n return;\r\n }\r\n\r\n el.appendChild(createElement(\"h2\", { //Header\r\n innerText:isActive ? action.name + \" (IN PROGRESS - \" +\r\n formatNumber(this.actionTimeCurrent, 0) + \" / \" +\r\n formatNumber(this.actionTimeToComplete, 0) + \")\"\r\n : action.name,\r\n display:\"inline-block\",\r\n }));\r\n\r\n if (isActive) { //Progress bar if its active\r\n var progress = this.actionTimeCurrent / this.actionTimeToComplete;\r\n el.appendChild(createElement(\"p\", {\r\n display:\"block\",\r\n innerText:createProgressBarText({progress:progress})\r\n }));\r\n } else {\r\n el.appendChild(createElement(\"a\", { //Start button\r\n innerText:\"Start\", margin:\"3px\", padding:\"3px\",\r\n class:hasReqdRank ? \"a-link-button\" : \"a-link-button-inactive\",\r\n clickListener:()=>{\r\n this.action.type = ActionTypes.BlackOperation;\r\n this.action.name = action.name;\r\n this.startAction(this.action);\r\n this.updateActionAndSkillsContent();\r\n return false;\r\n }\r\n }));\r\n el.appendChild(createElement(\"a\", { //Set Team Size Button\r\n innerText:\"Set Team Size (Curr Size: \" + formatNumber(action.teamCount, 0) + \")\", class:\"a-link-button\",\r\n margin:\"3px\", padding:\"3px\",\r\n clickListener:()=>{\r\n var popupId = \"bladeburner-operation-set-team-size-popup\";\r\n var txt = createElement(\"p\", {\r\n innerText:\"Enter the amount of team members you would like to take on this \" +\r\n \"BlackOp. If you do not have the specified number of team members, \" +\r\n \"then as many as possible will be used. Note that team members may \" +\r\n \"be lost during operations.\"\r\n\r\n });\r\n var input = createElement(\"input\", {\r\n type:\"number\", placeholder: \"Team Members\"\r\n });\r\n var setBtn = createElement(\"a\", {\r\n innerText:\"Confirm\", class:\"a-link-button\",\r\n clickListener:()=>{\r\n var num = Math.round(parseFloat(input.value));\r\n if (isNaN(num)) {\r\n dialogBoxCreate(\"Invalid value entered for number of Team Members (must be numeric)\")\r\n } else {\r\n action.teamCount = num;\r\n this.updateBlackOpsUIElement(el, action);\r\n }\r\n removeElementById(popupId);\r\n return false;\r\n }\r\n });\r\n var cancelBtn = createElement(\"a\", {\r\n innerText:\"Cancel\", class:\"a-link-button\",\r\n clickListener:()=>{\r\n removeElementById(popupId);\r\n return false;\r\n }\r\n });\r\n createPopup(popupId, [txt, input, setBtn, cancelBtn]);\r\n }\r\n }));\r\n }\r\n\r\n //Info\r\n appendLineBreaks(el, 2);\r\n el.appendChild(createElement(\"p\", {\r\n display:\"inline-block\",\r\n innerHTML:\"<br>\" + action.desc + \"<br><br>\",\r\n }));\r\n el.appendChild(createElement(\"p\", {\r\n display:\"block\", color:hasReqdRank ? \"white\" : \"red\",\r\n innerHTML:\"Required Rank: \" + formatNumber(action.reqdRank, 0) + \"<br>\"\r\n }));\r\n el.appendChild(createElement(\"p\", {\r\n display:\"inline-block\",\r\n innerHTML:\"Estimated Success Chance: \" + formatNumber(estimatedSuccessChance*100, 1) + \"%\\n\" +\r\n \"Time Required(s): \" + formatNumber(actionTime, 1),\r\n }))\r\n}\r\n\r\nBladeburner.prototype.updateSkillsUIElement = function(el, skill) {\r\n removeChildrenFromElement(el);\r\n var skillName = skill.name;\r\n var currentLevel = 0;\r\n if (this.skills[skillName] && !isNaN(this.skills[skillName])) {\r\n currentLevel = this.skills[skillName];\r\n }\r\n var pointCost = skill.baseCost + (currentLevel * skill.costInc);\r\n\r\n el.appendChild(createElement(\"h2\", { //Header\r\n innerText:skill.name + \" (Lvl \" + currentLevel + \")\", display:\"inline-block\"\r\n }));\r\n\r\n var canLevel = this.skillPoints >= pointCost;\r\n var maxLvl = skill.maxLvl ? currentLevel >= skill.maxLvl : false;\r\n el.appendChild(createElement(\"a\", { //Level up button\r\n innerText:\"Level\", display:\"inline-block\",\r\n class: canLevel && !maxLvl ? \"a-link-button\" : \"a-link-button-inactive\",\r\n margin:\"3px\", padding:\"3px\",\r\n clickListener:()=>{\r\n if (this.skillPoints < pointCost) {return;}\r\n this.skillPoints -= pointCost;\r\n this.upgradeSkill(skill);\r\n this.createActionAndSkillsContent();\r\n return false;\r\n }\r\n }));\r\n appendLineBreaks(el, 2);\r\n if (maxLvl) {\r\n el.appendChild(createElement(\"p\", {\r\n color:\"red\", display:\"block\",\r\n innerText:\"MAX LEVEL\"\r\n }));\r\n } else {\r\n el.appendChild(createElement(\"p\", {\r\n display:\"block\",\r\n innerText:\"Skill Points required: \" + formatNumber(pointCost, 0),\r\n }));\r\n }\r\n el.appendChild(createElement(\"p\", { //Info/Description\r\n innerHTML:skill.desc, display:\"inline-block\",\r\n }));\r\n}\r\n\r\n//Bladeburner Console Window\r\nBladeburner.prototype.postToConsole = function(input) {\r\n if (input == null || DomElems.consoleDiv == null) {return;}\r\n $(\"#bladeubrner-console-input-row\").before('<tr><td class=\"bladeburner-console-line\" style=\"color: var(--my-font-color); white-space:pre-wrap;\">' + input + '</td></tr>');\r\n if (DomElems.consoleTable.childNodes.length > 200) {\r\n DomElems.consoleTable.removeChild(DomElems.consoleTable.firstChild);\r\n }\r\n\tthis.updateConsoleScroll();\r\n}\r\n\r\nBladeburner.prototype.updateConsoleScroll = function() {\r\n DomElems.consoleDiv.scrollTop = DomElems.consoleDiv.scrollHeight;\r\n}\r\n\r\nBladeburner.prototype.resetConsoleInput = function() {\r\n DomElems.consoleInput.value = \"\";\r\n}\r\n\r\nBladeburner.prototype.clearConsole = function() {\r\n while (DomElems.consoleTable.childNodes.length > 1) {\r\n DomElems.consoleTable.removeChild(DomElems.consoleTable.firstChild);\r\n }\r\n}\r\n\r\nBladeburner.prototype.log = function(input) {\r\n //Adds a timestamp and then just calls postToConsole\r\n var d = new Date();\r\n var timestamp = d.getMonth() + \"/\" + d.getDay() + \" \" + d.getHours() + \":\" + d.getMinutes();\r\n this.postToConsole(\"[\" + timestamp + \"] \" + input);\r\n}\r\n\r\n//Handles a potential series of commands (comm1; comm2; comm3;)\r\nBladeburner.prototype.executeConsoleCommands = function(commands) {\r\n try {\r\n //Console History\r\n if (consoleHistory[consoleHistory.length-1] != commands) {\r\n consoleHistory.push(commands);\r\n if (consoleHistory.length > 50) {\r\n consoleHistory.splice(0, 1);\r\n }\r\n }\r\n consoleHistoryIndex = consoleHistory.length;\r\n\r\n var arrayOfCommands = commands.split(\";\");\r\n for (var i = 0; i < arrayOfCommands.length; ++i) {\r\n this.executeConsoleCommand(arrayOfCommands[i]);\r\n }\r\n } catch(e) {\r\n exceptionAlert(e);\r\n }\r\n}\r\n\r\n//A single command\r\nBladeburner.prototype.executeConsoleCommand = function(command) {\r\n command = command.trim();\r\n command = command.replace(/\\s\\s+/g, ' '); //Replace all whitespace w/ a single space\r\n\r\n var args = this.parseCommandArguments(command);\r\n if (args.length <= 0) {return;} //Log an error?\r\n\r\n switch(args[0].toLowerCase()) {\r\n case \"automate\":\r\n this.executeAutomateConsoleCommand(args);\r\n break;\r\n case \"clear\":\r\n case \"cls\":\r\n this.clearConsole();\r\n break;\r\n case \"help\":\r\n this.executeHelpConsoleCommand(args);\r\n break;\r\n case \"log\":\r\n this.executeLogConsoleCommand(args);\r\n break;\r\n case \"skill\":\r\n this.executeSkillConsoleCommand(args);\r\n break;\r\n case \"start\":\r\n this.executeStartConsoleCommand(args);\r\n break;\r\n case \"stop\":\r\n this.resetAction();\r\n break;\r\n default:\r\n this.postToConsole(\"Invalid console command\");\r\n break;\r\n }\r\n}\r\n\r\nBladeburner.prototype.parseCommandArguments = function(command) {\r\n //Returns an array with command and its arguments in each index.\r\n //e.g. skill \"blade's intuition\" foo returns [skill, blade's intuition, foo]\r\n //The input to this fn will be trimmed and will have all whitespace replaced w/ a single space\r\n var args = [];\r\n var start = 0, i = 0;\r\n while (i < command.length) {\r\n var c = command.charAt(i);\r\n if (c === '\"') {\r\n var endQuote = command.indexOf('\"', i+1);\r\n if (endQuote !== -1 && (endQuote === command.length-1 || command.charAt(endQuote+1) === \" \")) {\r\n args.push(command.substr(i+1, (endQuote - i - 1)));\r\n if (endQuote === command.length-1) {\r\n start = i = endQuote+1;\r\n } else {\r\n start = i = endQuote+2; //Skip the space\r\n }\r\n continue;\r\n }\r\n } else if (c === \" \") {\r\n args.push(command.substr(start, i-start));\r\n start = i+1;\r\n }\r\n ++i;\r\n }\r\n if (start !== i) {args.push(command.substr(start, i-start));}\r\n console.log(\"Bladeburner.parseCommandArguments returned: \" + args);\r\n return args;\r\n}\r\n\r\nBladeburner.prototype.executeAutomateConsoleCommand = function(args) {\r\n if (args.length !== 2 && args.length !== 4) {\r\n this.postToConsole(\"Invalid use of 'automate' command: automate [var] [val] [hi/low]. Use 'help automate' for more info\");\r\n return;\r\n }\r\n\r\n //Enable/Disable\r\n if (args.length === 2) {\r\n var flag = args[1];\r\n if (flag.toLowerCase() === \"status\") {\r\n this.postToConsole(\"Automation: \" + (this.automateEnabled ? \"enabled\" : \"disabled\"));\r\n if (this.automateEnabled) {\r\n this.postToConsole(\"When your stamina drops to \" + formatNumber(this.automateThreshLow, 0) +\r\n \", you will automatically switch to \" + this.automateActionLow.name +\r\n \". When your stamina recovers to \" +\r\n formatNumber(this.automateThreshHigh, 0) + \", you will automatically \" +\r\n \"switch to \" + this.automateActionHigh.name + \".\");\r\n }\r\n\r\n } else if (flag.toLowerCase().includes(\"en\")) {\r\n if (!(this.automateActionLow instanceof ActionIdentifier) ||\r\n !(this.automateActionHigh instanceof ActionIdentifier)) {\r\n return this.log(\"Failed to enable automation. Actions were not set\");\r\n }\r\n this.automateEnabled = true;\r\n this.log(\"Bladeburner automation enabled\");\r\n } else if (flag.toLowerCase().includes(\"d\")) {\r\n this.automateEnabled = false;\r\n this.log(\"Bladeburner automation disabled\");\r\n } else {\r\n this.log(\"Invalid argument for 'automate' console command: \" + args[1]);\r\n }\r\n return;\r\n }\r\n\r\n //Set variables\r\n if (args.length === 4) {\r\n var variable = args[1], val = args[2];\r\n\r\n var highLow = false; //True for high, false for low\r\n if (args[3].toLowerCase().includes(\"hi\")) {highLow = true;}\r\n\r\n switch (variable) {\r\n case \"general\":\r\n case \"gen\":\r\n if (GeneralActions[val] != null) {\r\n var action = new ActionIdentifier({\r\n type:ActionTypes[val], name:val\r\n });\r\n if (highLow) {\r\n this.automateActionHigh = action;\r\n } else {\r\n this.automateActionLow = action;\r\n }\r\n this.log(\"Automate (\" + (highLow ? \"HIGH\" : \"LOW\") + \") action set to \" + val);\r\n } else {\r\n this.postToConsole(\"Invalid action name specified: \" + val);\r\n }\r\n break;\r\n case \"contract\":\r\n case \"contracts\":\r\n if (this.contracts[val] != null) {\r\n var action = new ActionIdentifier({\r\n type:ActionTypes.Contract, name:val\r\n });\r\n if (highLow) {\r\n this.automateActionHigh = action;\r\n } else {\r\n this.automateActionLow = action;\r\n }\r\n this.log(\"Automate (\" + (highLow ? \"HIGH\" : \"LOW\") + \") action set to \" + val);\r\n } else {\r\n this.postToConsole(\"Invalid contract name specified: \" + val);\r\n }\r\n break;\r\n case \"ops\":\r\n case \"op\":\r\n case \"operations\":\r\n case \"operation\":\r\n if (this.operations[val] != null) {\r\n var action = new ActionIdentifier({\r\n type:ActionTypes.Operation, name:val\r\n });\r\n if (highLow) {\r\n this.automateActionHigh = action;\r\n } else {\r\n this.automateActionLow = action;\r\n }\r\n this.log(\"Automate (\" + (highLow ? \"HIGH\" : \"LOW\") + \") action set to \" + val);\r\n } else {\r\n this.postToConsole(\"Invalid Operation name specified: \" + val);\r\n }\r\n break;\r\n case \"stamina\":\r\n if (isNaN(val)) {\r\n this.postToConsole(\"Invalid value specified for stamina threshold (must be numeric): \" + val);\r\n } else {\r\n if (highLow) {\r\n this.automateThreshHigh = Number(val);\r\n } else {\r\n this.automateThreshLow = Number(val);\r\n }\r\n this.log(\"Automate (\" + (highLow ? \"HIGH\" : \"LOW\") + \") stamina threshold set to \" + val);\r\n }\r\n break;\r\n default:\r\n break;\r\n }\r\n\r\n return;\r\n }\r\n}\r\n\r\nBladeburner.prototype.executeHelpConsoleCommand = function(args) {\r\n if (args.length === 1) {\r\n this.postToConsole(consoleHelpText.helpList);\r\n } else {\r\n for (var i = 1; i < args.length; ++i) {\r\n var commandText = consoleHelpText[args[i]];\r\n if (commandText != null) {\r\n this.postToConsole(commandText);\r\n this.postToConsole(\"<br>\");\r\n }\r\n }\r\n }\r\n}\r\n\r\nBladeburner.prototype.executeLogConsoleCommand = function(args) {\r\n if (args.length < 3) {\r\n this.postToConsole(\"Invalid usage of log command: log [enable/disable] [action/event]\");\r\n this.postToConsole(\"Use 'help log' for more details and examples\");\r\n return;\r\n }\r\n\r\n var flag = true;\r\n if (args[1].toLowerCase().includes(\"d\")) {flag = false;} //d for disable\r\n\r\n switch (args[2].toLowerCase()) {\r\n case \"general\":\r\n case \"gen\":\r\n this.logging.general = flag;\r\n this.log(\"Logging \" + (flag ? \"enabled\" : \"disabled\") + \" for general actions\");\r\n break;\r\n case \"contract\":\r\n case \"contracts\":\r\n this.logging.contracts = flag;\r\n this.log(\"Logging \" + (flag ? \"enabled\" : \"disabled\") + \" for Contracts\");\r\n break;\r\n case \"ops\":\r\n case \"op\":\r\n case \"operations\":\r\n case \"operation\":\r\n this.logging.ops = flag;\r\n this.log(\"Logging \" + (flag ? \"enabled\" : \"disabled\") + \" for Operations\");\r\n break;\r\n case \"blackops\":\r\n case \"blackop\":\r\n case \"black operations\":\r\n case \"black operation\":\r\n this.logging.blackops = flag;\r\n this.log(\"Logging \" + (flag ? \"enabled\" : \"disabled\") + \" for BlackOps\");\r\n break;\r\n case \"event\":\r\n case \"events\":\r\n this.logging.events = flag;\r\n this.log(\"Logging \" + (flag ? \"enabled\" : \"disabled\") + \" for events\");\r\n break;\r\n case \"all\":\r\n this.logging.general = flag;\r\n this.logging.contracts = flag;\r\n this.logging.ops = flag;\r\n this.logging.blackops = flag;\r\n this.logging.events = flag;\r\n this.log(\"Logging \" + (flag ? \"enabled\" : \"disabled\") + \" for everything\");\r\n break;\r\n default:\r\n this.postToConsole(\"Invalid action/event type specified: \" + args[2]);\r\n this.postToConsole(\"Examples of valid action/event identifiers are: [general, contracts, ops, blackops, events]\");\r\n break;\r\n }\r\n}\r\n\r\nBladeburner.prototype.executeSkillConsoleCommand = function(args) {\r\n switch (args.length) {\r\n case 1:\r\n //Display Skill Help Command\r\n this.postToConsole(\"Invalid usage of 'skill' console command: skill [action] [name]\");\r\n this.postToConsole(\"Use 'help skill' for more info\");\r\n break;\r\n case 2:\r\n if (args[1].toLowerCase() === \"list\") {\r\n //List all skills and their level\r\n this.postToConsole(\"Skills: \");\r\n var skillNames = Object.keys(Skills);\r\n for(var i = 0; i < skillNames.length; ++i) {\r\n var skill = Skills[skillNames[i]];\r\n var level = 0;\r\n if (this.skills[skill.name] != null) {level = this.skills[skill.name];}\r\n this.postToConsole(skill.name + \": Level \" + formatNumber(level, 0));\r\n }\r\n this.postToConsole(\" \");\r\n this.postToConsole(\"Effects: \");\r\n var multKeys = Object.keys(this.skillMultipliers);\r\n for (var i = 0; i < multKeys.length; ++i) {\r\n var mult = this.skillMultipliers[multKeys[i]];\r\n if (mult && mult !== 1) {\r\n mult = formatNumber(mult, 3);\r\n switch(multKeys[i]) {\r\n case \"successChanceAll\":\r\n this.postToConsole(\"Total Success Chance: x\" + mult);\r\n break;\r\n case \"successChanceStealth\":\r\n this.postToConsole(\"Stealth Success Chance: x\" + mult);\r\n break;\r\n case \"successChanceKill\":\r\n this.postToConsole(\"Retirement Success Chance: x\" + mult);\r\n break;\r\n case \"successChanceContract\":\r\n this.postToConsole(\"Contract Success Chance: x\" + mult);\r\n break;\r\n case \"successChanceOperation\":\r\n this.postToConsole(\"Operation Success Chance: x\" + mult);\r\n break;\r\n case \"successChanceEstimate\":\r\n this.postToConsole(\"Synthoid Data Estimate: x\" + mult);\r\n break;\r\n case \"actionTime\":\r\n this.postToConsole(\"Action Time: x\" + mult);\r\n break;\r\n case \"effHack\":\r\n this.postToConsole(\"Hacking Skill: x\" + mult);\r\n break;\r\n case \"effStr\":\r\n this.postToConsole(\"Strength: x\" + mult);\r\n break;\r\n case \"effDef\":\r\n this.postToConsole(\"Defense: x\" + mult);\r\n break;\r\n case \"effDex\":\r\n this.postToConsole(\"Dexterity: x\" + mult);\r\n break;\r\n case \"effAgi\":\r\n this.postToConsole(\"Agility: x\" + mult);\r\n break;\r\n case \"effCha\":\r\n this.postToConsole(\"Charisma: x\" + mult);\r\n break;\r\n case \"effInt\":\r\n this.postToConsole(\"Intelligence: x\" + mult);\r\n break;\r\n case \"stamina\":\r\n this.postToConsole(\"Stamina: x\" + mult);\r\n break;\r\n case \"weaponAbility\":\r\n //DomElems.actionsAndSkillsDesc.innerHTML +=\r\n break;\r\n case \"gunAbility\":\r\n //DomElems.actionsAndSkillsDesc.innerHTML\r\n break;\r\n default:\r\n console.log(\"Warning: Unrecognized SkillMult Key: \" + multKeys[i]);\r\n break;\r\n }\r\n }\r\n }\r\n } else {\r\n this.postToConsole(\"Invalid usage of 'skill' console command: skill [action] [name]\");\r\n this.postToConsole(\"Use 'help skill' for more info\");\r\n }\r\n break;\r\n case 3:\r\n var skillName = args[2];\r\n var skill = Skills[skillName];\r\n if (skill == null || !(skill instanceof Skill)) {\r\n return this.postToConsole(\"Invalid skill name (Note that this is case-sensitive): \" + skillName);\r\n }\r\n if (args[1].toLowerCase() === \"list\") {\r\n this.postToConsole(skill.name + \": Level \" + formatNumber(this.skills[skill.name]), 0);\r\n } else if (args[1].toLowerCase() === \"level\") {\r\n var currentLevel = 0;\r\n if (this.skills[skillName] && !isNaN(this.skills[skillName])) {\r\n currentLevel = this.skills[skillName];\r\n }\r\n var pointCost = skill.baseCost + (currentLevel * skill.costInc);\r\n if (this.skillPoints >= pointCost) {\r\n this.skillPoints -= pointCost;\r\n this.upgradeSkill(skill);\r\n this.log(skill.name + \" upgraded to Level \" + this.skills[skillName]);\r\n this.createActionAndSkillsContent();\r\n } else {\r\n this.postToConsole(\"You do not have enough Skill Points to upgrade this. You need \" + formatNumber(pointCost, 0));\r\n }\r\n\r\n } else {\r\n this.postToConsole(\"Invalid usage of 'skill' console command: skill [action] [name]\");\r\n this.postToConsole(\"Use 'help skill' for more info\");\r\n }\r\n break;\r\n default:\r\n this.postToConsole(\"Invalid usage of 'skill' console command: skill [action] [name]\");\r\n this.postToConsole(\"Use 'help skill' for more info\");\r\n break;\r\n }\r\n}\r\n\r\nBladeburner.prototype.executeStartConsoleCommand = function(args) {\r\n if (args.length !== 3) {\r\n this.postToConsole(\"Invalid usage of 'start' console command: start [type] [name]\");\r\n this.postToConsole(\"Use 'help start' for more info\");\r\n return;\r\n }\r\n var name = args[2];\r\n switch (args[1].toLowerCase()) {\r\n case \"general\":\r\n case \"gen\":\r\n if (GeneralActions[name] != null) {\r\n this.action.type = ActionTypes[name];\r\n this.action.name = name;\r\n this.startAction(this.action);\r\n this.updateActionAndSkillsContent();\r\n } else {\r\n this.postToConsole(\"Invalid action name specified: \" + args[2]);\r\n }\r\n break;\r\n case \"contract\":\r\n case \"contracts\":\r\n if (this.contracts[name] != null) {\r\n this.action.type = ActionTypes.Contract;\r\n this.action.name = name;\r\n this.startAction(this.action);\r\n this.updateActionAndSkillsContent();\r\n } else {\r\n this.postToConsole(\"Invalid contract name specified: \" + args[2]);\r\n }\r\n break;\r\n case \"ops\":\r\n case \"op\":\r\n case \"operations\":\r\n case \"operation\":\r\n if (this.operations[name] != null) {\r\n this.action.type = ActionTypes.Operation;\r\n this.action.name = name;\r\n this.startAction(this.action);\r\n this.updateActionAndSkillsContent();\r\n } else {\r\n this.postToConsole(\"Invalid Operation name specified: \" + args[2]);\r\n }\r\n break;\r\n case \"blackops\":\r\n case \"blackop\":\r\n case \"black operations\":\r\n case \"black operation\":\r\n if (BlackOperations[name] != null) {\r\n this.action.type = ActionTypes.BlackOperation;\r\n this.action.name = name;\r\n this.startAction(this.action);\r\n this.updateActionAndSkillsContent();\r\n } else {\r\n this.postToConsole(\"Invalid BlackOp name specified: \" + args[2]);\r\n }\r\n break;\r\n default:\r\n this.postToConsole(\"Invalid action/event type specified: \" + args[1]);\r\n this.postToConsole(\"Examples of valid action/event identifiers are: [general, contract, op, blackop]\");\r\n break;\r\n }\r\n}\r\n\r\nBladeburner.prototype.getActionIdFromTypeAndName = function(type=\"\", name=\"\") {\r\n if (type === \"\" || name === \"\") {return null;}\r\n var action = new ActionIdentifier();\r\n var convertedType = type.toLowerCase().trim();\r\n var convertedName = name.toLowerCase().trim();\r\n switch (convertedType) {\r\n case \"contract\":\r\n case \"contracts\":\r\n action.type = ActionTypes[\"Contract\"];\r\n if (this.contracts.hasOwnProperty(name)) {\r\n action.name = name;\r\n return action;\r\n } else {\r\n return null;\r\n }\r\n case \"operation\":\r\n case \"operations\":\r\n case \"op\":\r\n case \"ops\":\r\n action.type = ActionTypes[\"Operation\"];\r\n if (this.operations.hasOwnProperty(name)) {\r\n action.name = name;\r\n return action;\r\n } else {\r\n return null;\r\n }\r\n case \"blackoperation\":\r\n case \"black operation\":\r\n case \"black operations\":\r\n case \"black op\":\r\n case \"black ops\":\r\n case \"blackop\":\r\n case \"blackops\":\r\n action.type = ActionTypes[\"BlackOp\"];\r\n if (BlackOperations.hasOwnProperty(name)) {\r\n action.name = name;\r\n return action;\r\n } else {\r\n return null;\r\n }\r\n case \"general\":\r\n case \"general action\":\r\n case \"gen\":\r\n break;\r\n default:\r\n return null;\r\n }\r\n\r\n if (convertedType.startsWith(\"gen\")) {\r\n switch (convertedName) {\r\n case \"training\":\r\n action.type = ActionTypes[\"Training\"];\r\n break;\r\n case \"recruitment\":\r\n case \"recruit\":\r\n action.type = ActionTypes[\"Recruitment\"];\r\n break;\r\n case \"field analysis\":\r\n case \"fieldanalysis\":\r\n action.type = ActionTypes[\"Field Analysis\"];\r\n break;\r\n default:\r\n return null;\r\n }\r\n return action;\r\n }\r\n}\r\n\r\nBladeburner.prototype.isContractNameNetscriptFn = function(name) {\r\n return this.contracts.hasOwnProperty(name);\r\n}\r\n\r\nBladeburner.prototype.isOperationNameNetscriptFn = function(name) {\r\n return this.operations.hasOwnProperty(name);\r\n}\r\n\r\nBladeburner.prototype.isBlackOpNameNetscriptFn = function(name) {\r\n return BlackOperations.hasOwnProperty(name);\r\n}\r\n\r\nBladeburner.prototype.isGeneralActionNameNetscriptFn = function(name) {\r\n return GeneralActions.hasOwnProperty(name);\r\n}\r\n\r\nBladeburner.prototype.isSkillNameNetscriptFn = function(name) {\r\n return Skills.hasOwnProperty(name);\r\n}\r\n\r\nBladeburner.prototype.startActionNetscriptFn = function(type, name, workerScript) {\r\n var errorLogText = \"ERROR: Bladeburner.startAction() failed due to an invalid action specified. \" +\r\n \"Type: \" + type + \", Name: \" + name + \". Note that for contracts and operations, the \" +\r\n \"name of the operation is case-sensitive.\";\r\n var actionId = this.getActionIdFromTypeAndName(type, name);\r\n if (actionId == null) {\r\n workerScript.log(errorLogText);\r\n return false;\r\n }\r\n\r\n try {\r\n this.startAction(actionId);\r\n if (workerScript.shouldLog(\"startAction\")) {\r\n workerScript.scriptRef.log(\"Starting Bladeburner action with type \" + type + \" and name \" + name);\r\n }\r\n return true;\r\n } catch(e) {\r\n this.resetAction();\r\n workerScript.scriptRef.log(\"ERROR: Bladeburner.startAction() failed to start action of type \" + type + \" due to invalid name: \" + name +\r\n \"Note that this name is case-sensitive and whitespace-sensitive\");\r\n return false;\r\n }\r\n}\r\n\r\nBladeburner.prototype.getActionTimeNetscriptFn = function(type, name, workerScript) {\r\n var errorLogText = \"ERROR: Bladeburner.getActionTime() failed due to an invalid action specified. \" +\r\n \"Type: \" + type + \", Name: \" + name + \". Note that for contracts and operations, the \" +\r\n \"name of the operation is case-sensitive.\";\r\n var actionId = this.getActionIdFromTypeAndName(type, name);\r\n if (actionId == null) {\r\n workerScript.log(errorLogText);\r\n return -1;\r\n }\r\n\r\n var actionObj = this.getActionObject(actionId);\r\n if (actionObj == null) {\r\n workerScript.log(errorLogText);\r\n return -1;\r\n }\r\n\r\n switch (actionId.type) {\r\n case ActionTypes[\"Contract\"]:\r\n case ActionTypes[\"Operation\"]:\r\n case ActionTypes[\"BlackOp\"]:\r\n case ActionTypes[\"BlackOperation\"]:\r\n return actionObj.getActionTime(this);\r\n case ActionTypes[\"Training\"]:\r\n case ActionTypes[\"Field Analysis\"]:\r\n case ActionTypes[\"FieldAnalysis\"]:\r\n return 30;\r\n case ActionTypes[\"Recruitment\"]:\r\n return this.getRecruitmentTime();\r\n default:\r\n workerScript.log(errorLogText);\r\n return -1;\r\n }\r\n}\r\n\r\nBladeburner.prototype.getActionEstimatedSuccessChanceNetscriptFn = function(type, name, workerScript) {\r\n var errorLogText = \"ERROR: Bladeburner.getActionEstimatedSuccessChance() failed due to an invalid action specified. \" +\r\n \"Type: \" + type + \", Name: \" + name + \". Note that for contracts and operations, the \" +\r\n \"name of the operation is case-sensitive.\";\r\n var actionId = this.getActionIdFromTypeAndName(type, name);\r\n if (actionId == null) {\r\n workerScript.log(errorLogText);\r\n return -1;\r\n }\r\n\r\n var actionObj = this.getActionObject(actionId);\r\n if (actionObj == null) {\r\n workerScript.log(errorLogText);\r\n return -1;\r\n }\r\n\r\n switch (actionId.type) {\r\n case ActionTypes[\"Contract\"]:\r\n case ActionTypes[\"Operation\"]:\r\n case ActionTypes[\"BlackOp\"]:\r\n case ActionTypes[\"BlackOperation\"]:\r\n return actionObj.getSuccessChance(this);\r\n case ActionTypes[\"Training\"]:\r\n case ActionTypes[\"Field Analysis\"]:\r\n case ActionTypes[\"FieldAnalysis\"]:\r\n return 1;\r\n case ActionTypes[\"Recruitment\"]:\r\n return this.getRecruitmentSuccessChance();\r\n default:\r\n workerScript.log(errorLogText);\r\n return -1;\r\n }\r\n}\r\n\r\nBladeburner.prototype.getActionCountRemainingNetscriptFn = function(type, name, workerScript) {\r\n var errorLogText = \"ERROR: Bladeburner.getActionCountRemaining() failed due to an invalid action specified. \" +\r\n \"Type: \" + type + \", Name: \" + name + \". Note that for contracts and operations, the \" +\r\n \"name of the operation is case-sensitive.\";\r\n var actionId = this.getActionIdFromTypeAndName(type, name);\r\n if (actionId == null) {\r\n workerScript.log(errorLogText);\r\n return -1;\r\n }\r\n\r\n var actionObj = this.getActionObject(actionId);\r\n if (actionObj == null) {\r\n workerScript.log(errorLogText);\r\n return -1;\r\n }\r\n\r\n switch (actionId.type) {\r\n case ActionTypes[\"Contract\"]:\r\n case ActionTypes[\"Operation\"]:\r\n case ActionTypes[\"BlackOp\"]:\r\n case ActionTypes[\"BlackOperation\"]:\r\n return actionObj.count;\r\n case ActionTypes[\"Training\"]:\r\n case ActionTypes[\"Field Analysis\"]:\r\n case ActionTypes[\"FieldAnalysis\"]:\r\n return Infinity;\r\n default:\r\n workerScript.log(errorLogText);\r\n return -1;\r\n }\r\n}\r\n\r\nBladeburner.prototype.getSkillLevelNetscriptFn = function(skillName, workerScript) {\r\n var errorLogText = \"ERROR: Bladeburner.getSkillLevel() failed due to an invalid skill specified: \" +\r\n skillName + \". Note that the name of the skill is case-sensitive\";\r\n\r\n if (skillName === \"\") {\r\n //If skill name isn't specified, return an object with all of the player's skill levels\r\n let copy = Object.assign({}, this.Skills);\r\n return copy;\r\n }\r\n\r\n if (!Skills.hasOwnProperty(skillName)) {\r\n workerScript.log(errorLogText);\r\n return -1;\r\n }\r\n\r\n return Skills[skillName];\r\n}\r\n\r\nBladeburner.prototype.upgradeSkillNetscriptFn = function(skillName, workerScript) {\r\n var errorLogText = \"ERROR: Bladeburner.upgradeSkill() failed due to an invalid skill specified: \" +\r\n skillName + \". Note that the name of the skill is case-sensitive\";\r\n if (!Skills.hasOwnProperty(skillName)) {\r\n workerScript.log(errorLogText);\r\n return false;\r\n }\r\n\r\n var skill = Skills[skillName];\r\n var currentLevel = 0;\r\n if (this.skills[skillName] && !isNaN(this.skills[skillName])) {\r\n currentLevel = this.skills[skillName];\r\n }\r\n var cost = skill.baseCost + (currentLevel * skill.costInc);\r\n\r\n if (this.skillPoints < cost) {\r\n if (workerScript.shouldLog(\"upgradeSkill\")) {\r\n workerScript.log(\"Bladeburner.upgradeSkill() failed because you do not have enough \" +\r\n \"skill points to upgrade \" + skillName + \" (You have \" +\r\n this.skillPoints + \", you need \" + cost + \")\");\r\n }\r\n return false;\r\n }\r\n\r\n this.skillPoints -= cost;\r\n this.upgradeSkill(skill);\r\n if (Engine.currentPage === Engine.Page.Bladeburner && DomElems.currentTab.toLowerCase() === \"skills\") {\r\n this.createActionAndSkillsContent();\r\n }\r\n if (workerScript.shouldLog(\"upgradeSkill\")) {\r\n workerScript.log(skillName + \" successfully upgraded to level \" + this.skills[skillName]);\r\n }\r\n return true;\r\n}\r\n\r\nBladeburner.prototype.getTeamSizeNetscriptFn = function(type, name, workerScript) {\r\n if (type === \"\" && name === \"\") {\r\n return this.teamSize;\r\n }\r\n\r\n var errorLogText = \"ERROR: Bladeburner.getTeamSize() failed due to an invalid action specified. \" +\r\n \"Type: \" + type + \", Name: \" + name + \". Note that for contracts and operations, the \" +\r\n \"name of the operation is case-sensitive.\";\r\n\r\n var actionId = this.getActionIdFromTypeAndName(type, name);\r\n if (actionId == null) {\r\n workerScript.log(errorLogText);\r\n return -1;\r\n }\r\n\r\n var actionObj = this.getActionObject(actionId);\r\n if (actionObj == null) {\r\n workerScript.log(errorLogText);\r\n return -1;\r\n }\r\n\r\n if (actionId.type === ActionTypes[\"Operation\"] ||\r\n actionId.type === ActionTypes[\"BlackOp\"] ||\r\n actionId.type === ActionTypes[\"BlackOperation\"]) {\r\n return actionObj.teamCount;\r\n } else {\r\n return 0;\r\n }\r\n}\r\n\r\nBladeburner.prototype.setTeamSizeNetscriptFn = function(type, name, size, workerScript) {\r\n var errorLogText = \"ERROR: Bladeburner.setTeamSize() failed due to an invalid action specified. \" +\r\n \"Type: \" + type + \", Name: \" + name + \". Note that for contracts and operations, the \" +\r\n \"name of the operation is case-sensitive.\";\r\n var actionId = this.getActionIdFromTypeAndName(type, name);\r\n if (actionId == null) {\r\n workerScript.log(errorLogText);\r\n return -1;\r\n }\r\n\r\n if (actionId.type !== ActionTypes[\"Operation\"] ||\r\n actionId.type !== ActionTypes[\"BlackOp\"] ||\r\n actionId.type !== ActionTypes[\"BlackOperation\"]) {\r\n workerScript.log(\"ERROR: Bladeburner.setTeamSize() failed. This function \" +\r\n \"only works for Operations and BlackOps\");\r\n return -1;\r\n }\r\n\r\n var actionObj = this.getActionObject(actionId);\r\n if (actionObj == null) {\r\n workerScript.log(errorLogText);\r\n return -1;\r\n }\r\n\r\n var sanitizedSize = Math.round(size);\r\n if (isNaN(sanitizedSize)) {\r\n workerScript.log(\"ERROR: Bladeburner.setTeamSize() failed due to an invalid 'size' argument: \" + size);\r\n return -1;\r\n }\r\n if (this.teamSize < sanitizedSize) {sanitizedSize = this.teamSize;}\r\n actionObj.teamCount = sanitizedSize;\r\n if (workerScript.shouldLog(\"setTeamSize\")) {\r\n workerScript.log(\"Team size for \" + name + \" set to \" + sanitizedSize);\r\n }\r\n return sanitizedSize;\r\n}\r\n\r\nBladeburner.prototype.getCityEstimatedPopulationNetscriptFn = function(cityName, workerScript) {\r\n if (!this.cities.hasOwnProperty(cityName)) {\r\n workerScript.log(\"ERROR: Bladeburner.getCityEstimatedPopulation() failed because the specified \" +\r\n \"city was invalid: \" + cityName + \". Note that this city argument is case-sensitive\");\r\n return -1;\r\n }\r\n return this.cities[cityName].popEst;\r\n}\r\n\r\nBladeburner.prototype.getCityEstimatedCommunitiesNetscriptFn = function(cityName, workerScript) {\r\n if (!this.cities.hasOwnProperty(cityName)) {\r\n workerScript.log(\"ERROR: Bladeburner.getCityEstimatedCommunities() failed because the specified \" +\r\n \"city was invalid: \" + cityName + \". Note that this city argument is case-sensitive\");\r\n return -1;\r\n }\r\n return this.cities[cityName].commsEst;\r\n}\r\n\r\nBladeburner.prototype.getCityChaosNetscriptFn = function(cityName, workerScript) {\r\n if (!this.cities.hasOwnProperty(cityName)) {\r\n workerScript.log(\"ERROR: Bladeburner.getCityChaos() failed because the specified \" +\r\n \"city was invalid: \" + cityName + \". Note that this city argument is case-sensitive\");\r\n return -1;\r\n }\r\n return this.cities[cityName].chaos;\r\n}\r\n\r\nBladeburner.prototype.switchCityNetscriptFn = function(cityName, workerScript) {\r\n if (!this.cities.hasOwnProperty(cityName)) {\r\n workerScript.log(\"ERROR: Bladeburner.switchCity() failed because the specified \" +\r\n \"city was invalid: \" + cityName + \". Note that this city argument is case-sensitive\");\r\n return false;\r\n }\r\n this.city = cityName;\r\n return true;\r\n}\r\n\r\nBladeburner.prototype.joinBladeburnerFactionNetscriptFn = function(workerScript) {\r\n var bladeburnerFac = Factions[bladeburnersFactionName];\r\n if (bladeburnerFac.isMember) {\r\n return true;\r\n } else if (this.rank >= RankNeededForFaction) {\r\n joinFaction(bladeburnerFac);\r\n if (workerScript.shouldLog(\"joinBladeburnerFaction\")) {\r\n workerScript.log(\"Joined Bladeburners Faction\");\r\n }\r\n if (Engine.currentPage === Engine.Page.Bladeburner) {\r\n removeChildrenFromElement(DomElems.overviewDiv);\r\n this.createOverviewContent();\r\n }\r\n return true;\r\n } else {\r\n if (workerScript.shouldLog(\"joinBladeburnerFaction\")) {\r\n workerScript.log(\"Failed to join Bladeburners Faction because \" +\r\n \"you do not have the required \" + RankNeededForFaction + \" rank\");\r\n }\r\n return false;\r\n }\r\n}\r\n\r\nBladeburner.prototype.toJSON = function() {\r\n return Generic_toJSON(\"Bladeburner\", this);\r\n}\r\nBladeburner.fromJSON = function(value) {\r\n return Generic_fromJSON(Bladeburner, value.data);\r\n}\r\nReviver.constructors.Bladeburner = Bladeburner;\r\n\r\n//This initialized Bladeburner-related data that is NOT saved/loaded\r\n// eg: Skill Objects, BLack Operations\r\n//Any data that is saved/loaded should go in Bladeburner object\r\n// eg: contracts, operations\r\nfunction initBladeburner() {\r\n //Skills\r\n Skills[SkillNames.BladesIntuition] = new Skill({\r\n name:SkillNames.BladesIntuition,\r\n desc:\"Each level of this skill increases your success chance \" +\r\n \"for all contracts and operations by 3%\",\r\n baseCost:5, costInc:2,\r\n successChanceAll:3\r\n });\r\n Skills[SkillNames.Reaper] = new Skill({\r\n name:SkillNames.Reaper,\r\n desc:\"Each level of this skill increases your \" +\r\n \"effective combat stats for Bladeburner actions by 3%\",\r\n baseCost:3, costInc:2,\r\n effStr:3, effDef:3, effDex:3, effAgi:3\r\n });\r\n Skills[SkillNames.Cloak] = new Skill({\r\n name:SkillNames.Cloak,\r\n desc:\"Each level of this skill increases your \" +\r\n \"success chance in stealth-related contracts and operations by 5.5%\",\r\n baseCost:3, costInc:1,\r\n successChanceStealth:5.5\r\n });\r\n\r\n //TODO Marksman\r\n //TODO Weapon Proficiency\r\n\r\n Skills[SkillNames.Overclock] = new Skill({\r\n name:SkillNames.Overclock,\r\n desc:\"Each level of this skill decreases the time it takes \" +\r\n \"to attempt a contract or operation by 1% (Max Level: 95)\",\r\n baseCost:5, costInc:1, maxLvl:95,\r\n actionTime:1\r\n });\r\n Skills[SkillNames.EvasiveSystem] = new Skill({\r\n name:SkillNames.EvasiveSystem,\r\n desc:\"Each level of this skill increases your effective \" +\r\n \"dexterity and agility for Bladeburner actions by 5%\",\r\n baseCost:2, costInc: 1,\r\n effDex:5, effAgi:5\r\n });\r\n Skills[SkillNames.ShortCircuit] = new Skill({\r\n name:SkillNames.ShortCircuit,\r\n desc:\"Each level of this skill increases your success chance \" +\r\n \"in contracts and operations that involve retirement by 5.5%\",\r\n baseCost:3, costInc:2,\r\n successChanceKill:5.5\r\n });\r\n Skills[SkillNames.DigitalObserver] = new Skill({\r\n name:SkillNames.DigitalObserver,\r\n desc:\"Each level of this skill increases your success chance in \" +\r\n \"all operations by 4%\",\r\n baseCost:5, costInc:2,\r\n successChanceOperation:4\r\n });\r\n Skills[SkillNames.Datamancer] = new Skill({\r\n name:SkillNames.Datamancer,\r\n desc:\"Each level of this skill increases your effectiveness in \" +\r\n \"synthoid population analysis and investigation by 5%. \" +\r\n \"This affects all actions that can potentially increase \" +\r\n \"the accuracy of your synthoid population/community estimates.\",\r\n baseCost:3,costInc:1,\r\n successChanceEstimate:5\r\n });\r\n Skills[SkillNames.Tracer] = new Skill({\r\n name:SkillNames.Tracer,\r\n desc:\"Each level of this skill increases your success chance in \" +\r\n \"all contracts by 4%\",\r\n baseCost:3, costInc:2,\r\n successChanceContract:4\r\n });\r\n Skills[SkillNames.CybersEdge] = new Skill({\r\n name:SkillNames.CybersEdge,\r\n desc:\"Each level of this skill increases your max \" +\r\n \"stamina by 2%\",\r\n baseCost:1, costInc:3,\r\n stamina:2\r\n });\r\n\r\n //General Actions\r\n var actionName = \"Training\";\r\n GeneralActions[actionName] = new Action({\r\n name:actionName,\r\n desc:\"Improve your abilities at the Bladeburner unit's specialized training \" +\r\n \"center. Doing this gives experience for all combat stats and also \" +\r\n \"increases your max stamina.\"\r\n });\r\n\r\n var actionName = \"Field Analysis\";\r\n GeneralActions[actionName] = new Action({\r\n name:actionName,\r\n desc:\"Mine and analyze Synthoid-related data. This improve the \" +\r\n \"Bladeburner's unit intelligence on Synthoid locations and \" +\r\n \"activities. Completing this action will improve the accuracy \" +\r\n \"of your Synthoid population estimated in the current city.<br><br>\" +\r\n \"Does NOT require stamina.\"\r\n });\r\n\r\n var actionName = \"Recruitment\";\r\n GeneralActions[actionName] = new Action({\r\n name:actionName,\r\n desc:\"Attempt to recruit members for your Bladeburner team. These members \" +\r\n \"can help you conduct operations.<br><br>\" +\r\n \"Does NOT require stamina.\"\r\n });\r\n\r\n //Black Operations\r\n BlackOperations[\"Operation Typhoon\"] = new BlackOperation({\r\n name:\"Operation Typhoon\",\r\n desc:\"Obadiah Zenyatta is the leader of a RedWater PMC. It has long \" +\r\n \"been known among the intelligence community that Zenyatta, along \" +\r\n \"with the rest of the PMC, is a Synthoid.<br><br>\" +\r\n \"The goal of Operation Typhoon is to find and eliminate \" +\r\n \"Zenyatta and RedWater by any means necessary. After the task \" +\r\n \"is completed, the actions must be covered up from the general public.\",\r\n baseDifficulty:2000, reqdRank:2.5e3,\r\n rankGain:50, rankLoss:10, hpLoss:100,\r\n weights:{hack:0.1,str:0.2,def:0.2,dex:0.2,agi:0.2,cha:0, int:0.1},\r\n decays:{hack:0.6,str:0.8,def:0.8,dex:0.8,agi:0.8,cha:0, int:0.75},\r\n isKill:true\r\n });\r\n BlackOperations[\"Operation Zero\"] = new BlackOperation({\r\n name:\"Operation Zero\",\r\n desc:\"AeroCorp is one of the world's largest defense contractors. \" +\r\n \"It's leader, Steve Watataki, is thought to be a supporter of \" +\r\n \"Synthoid rights. He must be removed.<br><br>\" +\r\n \"The goal of Operation Zero is to covertly infiltrate AeroCorp and \" +\r\n \"uncover any incriminating evidence or \" +\r\n \"information against Watataki that will cause him to be removed \" +\r\n \"from his position at AeroCorp. Incriminating evidence can be \" +\r\n \"fabricated as a last resort. Be warned that AeroCorp has some of \" +\r\n \"the most advanced security measures in the world.\",\r\n baseDifficulty:2500, reqdRank:5e3,\r\n rankGain:60, rankLoss:15, hpLoss:50,\r\n weights:{hack:0.2,str:0.15,def:0.15,dex:0.2,agi:0.2,cha:0, int:0.1},\r\n decays:{hack:0.6,str:0.8,def:0.8,dex:0.8,agi:0.8,cha:0, int:0.75},\r\n isStealth:true\r\n });\r\n BlackOperations[\"Operation X\"] = new BlackOperation({\r\n name:\"Operation X\",\r\n desc:\"We have recently discovered an underground publication \" +\r\n \"group called Samizdat. Even though most of their publications \" +\r\n \"are nonsensical conspiracy theories, the average human is \" +\r\n \"gullible enough to believe them. Many of their works discuss \" +\r\n \"Synthoids and pose a threat to society. The publications are spreading \" +\r\n \"rapidly in China and other Eastern countries.<br><br>\" +\r\n \"Samizdat has done a good job of keeping hidden and anonymous. \" +\r\n \"However, we've just received intelligence that their base of \" +\r\n \"operations is in Ishima's underground sewer systems. Your task is to \" +\r\n \"investigate the sewer systems, and eliminate Samizdat. They must \" +\r\n \"never publish anything again.\",\r\n baseDifficulty:3000, reqdRank:7.5e3,\r\n rankGain:75, rankLoss:15, hpLoss:100,\r\n weights:{hack:0.1,str:0.2,def:0.2,dex:0.2,agi:0.2,cha:0, int:0.1},\r\n decays:{hack:0.6,str:0.8,def:0.8,dex:0.8,agi:0.8,cha:0, int:0.75},\r\n isKill:true\r\n });\r\n BlackOperations[\"Operation Titan\"] = new BlackOperation({\r\n name:\"Operation Titan\",\r\n desc:\"Several months ago Titan Laboratories' Bioengineering department \" +\r\n \"was infiltrated by Synthoids. As far as we know, Titan Laboratories' \" +\r\n \"management has no knowledge about this. We don't know what the \" +\r\n \"Synthoids are up to, but the research that they could \" +\r\n \"be conducting using Titan Laboraties' vast resources is potentially \" +\r\n \"very dangerous.<br><br>\" +\r\n \"Your goal is to enter and destroy the Bioengineering department's \" +\r\n \"facility in Aevum. The task is not just to retire the Synthoids there, but \" +\r\n \"also to destroy any information or research at the facility that \" +\r\n \"is relevant to the Synthoids and their goals.\",\r\n baseDifficulty:4000, reqdRank:10e3,\r\n rankGain:100, rankLoss:20, hpLoss:100,\r\n weights:{hack:0.1,str:0.2,def:0.2,dex:0.2,agi:0.2,cha:0, int:0.1},\r\n decays:{hack:0.6,str:0.8,def:0.8,dex:0.8,agi:0.8,cha:0, int:0.75},\r\n isKill:true\r\n });\r\n BlackOperations[\"Operation Ares\"] = new BlackOperation({\r\n name:\"Operation Ares\",\r\n desc:\"One of our undercover agents, Agent Carter, has informed us of a \" +\r\n \"massive weapons deal going down in Dubai between rogue Russian \" +\r\n \"militants and a radical Synthoid community. These weapons are next-gen \" +\r\n \"plasma and energy weapons. It is critical for the safety of humanity \" +\r\n \"that this deal does not happen.<br><br>\" +\r\n \"Your task is to intercept the deal. Leave no survivors.\",\r\n baseDifficulty:5000, reqdRank:12.5e3,\r\n rankGain:125, rankLoss:20, hpLoss:200,\r\n weights:{hack:0,str:0.25,def:0.25,dex:0.25,agi:0.25,cha:0, int:0},\r\n decays:{hack:0,str:0.8,def:0.8,dex:0.8,agi:0.8,cha:0, int:0.75},\r\n isKill:true\r\n });\r\n BlackOperations[\"Operation Archangel\"] = new BlackOperation({\r\n name:\"Operation Archangel\",\r\n desc:\"Our analysts have discovered that the popular Red Rabbit brothel in \" +\r\n \"Amsterdam is run and 'staffed' by MK-VI Synthoids. Intelligence \" +\r\n \"suggests that the profit from this brothel is used to fund a large \" +\r\n \"black market arms trafficking operation.<br><br>\" +\r\n \"The goal of this operation is to take out the leaders that are running \" +\r\n \"the Red Rabbit brothel. Try to limit the number of other casualties, \" +\r\n \"but do what you must to complete the mission.\",\r\n baseDifficulty:7500, reqdRank:15e3,\r\n rankGain:200, rankLoss:20, hpLoss:25,\r\n weights:{hack:0,str:0.2,def:0.2,dex:0.3,agi:0.3,cha:0, int:0},\r\n decays:{hack:0,str:0.8,def:0.8,dex:0.8,agi:0.8,cha:0, int:0.75},\r\n isKill:true,\r\n });\r\n BlackOperations[\"Operation Juggernaut\"] = new BlackOperation({\r\n name:\"Operation Juggernaut\",\r\n desc:\"The CIA has just encountered a new security threat. A new \" +\r\n \"criminal group, lead by a shadowy operative who calls himself \" +\r\n \"Juggernaut, has been smuggling drugs and weapons (including \" +\r\n \"suspected bioweapons) into Sector-12. We also have reason \" +\r\n \"to believe the tried to break into one of Universal Energy's \" +\r\n \"facilities in order to cause a city-wide blackout. The CIA \" +\r\n \"suspects that Juggernaut is a heavily-augmented Synthoid, and \" +\r\n \"have thus enlisted our help.<br><br>\" +\r\n \"Your mission is to eradicate Juggernaut and his followers.\",\r\n baseDifficulty:10e3, reqdRank:20e3,\r\n rankGain:300, rankLoss:40, hpLoss:300,\r\n weights:{hack:0,str:0.25,def:0.25,dex:0.25,agi:0.25,cha:0, int:0},\r\n decays:{hack:0,str:0.8,def:0.8,dex:0.8,agi:0.8,cha:0, int:0.75},\r\n isKill:true,\r\n });\r\n BlackOperations[\"Operation Red Dragon\"] = new BlackOperation({\r\n name:\"Operation Red Dragon\",\r\n desc:\"The Tetrads criminal organization is suspected of \" +\r\n \"reverse-engineering the MK-VI Synthoid design. We believe \" +\r\n \"they altered and possibly improved the design and began \" +\r\n \"manufacturing their own Synthoid models in order to bolster \" +\r\n \"their criminal activities.<br><br>\" +\r\n \"Your task is to infiltrate and destroy the Tetrads' base of operations \" +\r\n \"in Los Angeles. Intelligence tells us that their base houses \" +\r\n \"one of their Synthoid manufacturing units.\",\r\n baseDifficulty:12.5e3, reqdRank:25e3,\r\n rankGain:500, rankLoss:50, hpLoss:500,\r\n weights:{hack:0.05,str:0.2,def:0.2,dex:0.25,agi:0.25,cha:0, int:0.05},\r\n decays:{hack:0.6,str:0.8,def:0.8,dex:0.8,agi:0.8,cha:0, int:0.75},\r\n isKill:true,\r\n });\r\n BlackOperations[\"Operation K\"] = new BlackOperation({\r\n name:\"Operation K\",\r\n desc:\"CODE RED SITUATION. Our intelligence tells us that VitaLife \" +\r\n \"has discovered a new android cloning technology. This technology \" +\r\n \"is supposedly capable of cloning Synthoid, not only physically \" +\r\n \"but also their advanced AI modules. We do not believe that \" +\r\n \"VitaLife is trying to use this technology illegally or \" +\r\n \"maliciously, but if any Synthoids were able to infiltrate the \" +\r\n \"corporation and take advantage of this technology then the \" +\r\n \"results would be catastrophic.<br><br>\" +\r\n \"We do not have the power or jurisdiction to shutdown this down \" +\r\n \"through legal or political means, so we must resort to a covert \" +\r\n \"operation. Your goal is to destroy this technology and eliminate\" +\r\n \"anyone who was involved in its creation.\",\r\n baseDifficulty:15e3, reqdRank:30e3,\r\n rankGain:750, rankLoss:60, hpLoss:1000,\r\n weights:{hack:0.05,str:0.2,def:0.2,dex:0.25,agi:0.25,cha:0, int:0.05},\r\n decays:{hack:0.6,str:0.8,def:0.8,dex:0.8,agi:0.8,cha:0, int:0.75},\r\n isKill:true\r\n });\r\n BlackOperations[\"Operation Deckard\"] = new BlackOperation({\r\n name:\"Operation Deckard\",\r\n desc:\"Despite your success in eliminating VitaLife's new android-replicating \" +\r\n \"technology in Operation K, we've discovered that a small group of \" +\r\n \"MK-VI Synthoids were able to make off with the schematics and design \" +\r\n \"of the technology before the Operation. It is almost a certainty that \" +\r\n \"these Synthoids are some of the rogue MK-VI ones from the Synthoid Uprising.\" +\r\n \"The goal of Operation Deckard is to hunt down these Synthoids and retire \" +\r\n \"them. I don't need to tell you how critical this mission is.\",\r\n baseDifficulty:20e3, reqdRank:40e3,\r\n rankGain:1e3, rankLoss:75, hpLoss:200,\r\n weights:{hack:0,str:0.24,def:0.24,dex:0.24,agi:0.24,cha:0, int:0.04},\r\n decays:{hack:0,str:0.8,def:0.8,dex:0.8,agi:0.8,cha:0, int:0.75},\r\n isKill:true,\r\n });\r\n BlackOperations[\"Operation Tyrell\"] = new BlackOperation({\r\n name:\"Operation Tyrell\",\r\n desc:\"A week ago Blade Industries reported a small break-in at one \" +\r\n \"of their Aevum Augmentation storage facitilities. We figured out \" +\r\n \"that The Dark Army was behind the heist, and didn't think any more \" +\r\n \"of it. However, we've just discovered that several known MK-VI Synthoids \" +\r\n \"were part of that break-in group.<br><br>\" +\r\n \"We cannot have Synthoids upgrading their already-enhanced abilities \" +\r\n \"with Augmentations. Your task is to hunt down the associated Dark Army \" +\r\n \"members and eliminate them.\",\r\n baseDifficulty:25e3, reqdRank:50e3,\r\n rankGain:1.5e3, rankLoss:100, hpLoss:500,\r\n weights:{hack:0.1,str:0.2,def:0.2,dex:0.2,agi:0.2,cha:0, int:0.1},\r\n decays:{hack:0.6,str:0.8,def:0.8,dex:0.8,agi:0.8,cha:0, int:0.75},\r\n isKill:true,\r\n });\r\n BlackOperations[\"Operation Wallace\"] = new BlackOperation({\r\n name:\"Operation Wallace\",\r\n desc:\"Based on information gathered from Operation Tyrell, we've discovered \" +\r\n \"that The Dark Army was well aware that there were Synthoids amongst \" +\r\n \"their ranks. Even worse, we believe that The Dark Army is working \" +\r\n \"together with other criminal organizations such as The Syndicate and \" +\r\n \"that they are planning some sort of large-scale takeover of multiple major \" +\r\n \"cities, most notably Aevum. We suspect that Synthoids have infiltrated \" +\r\n \"the ranks of these criminal factions and are trying to stage another \" +\r\n \"Synthoid uprising.<br><br>\" +\r\n \"The best way to deal with this is to prevent it before it even happens. \" +\r\n \"The goal of Operation Wallace is to destroy the Dark Army and \" +\r\n \"Syndicate factions in Aevum immediately. Leave no survivors.\",\r\n baseDifficulty:30e3, reqdRank:75e3,\r\n rankGain:2e3, rankLoss:150, hpLoss:1500,\r\n weights:{hack:0,str:0.24,def:0.24,dex:0.24,agi:0.24,cha:0, int:0.04},\r\n decays:{hack:0.6,str:0.8,def:0.8,dex:0.8,agi:0.8,cha:0, int:0.75},\r\n isKill:true\r\n });\r\n BlackOperations[\"Operation Shoulder of Orion\"] = new BlackOperation({\r\n name:\"Operation Shoulder of Orion\",\r\n desc:\"China's Solaris Space Systems is secretly launching the first \" +\r\n \"manned spacecraft in over a decade using Synthoids. We believe \" +\r\n \"China is trying to establish the first off-world colonies.<br><br>\" +\r\n \"The mission is to prevent this launch without instigating an \" +\r\n \"international conflict. When you accept this mission you will be \" +\r\n \"officially disavowed by the NSA and the national government until after you \" +\r\n \"successfully return. In the event of failure, all of the operation's \" +\r\n \"team members must not let themselves be captured alive.\",\r\n baseDifficulty:35e3, reqdRank:100e3,\r\n rankGain:2.5e3, rankLoss:500, hpLoss:1500,\r\n weights:{hack:0.1,str:0.2,def:0.2,dex:0.2,agi:0.2,cha:0, int:0.1},\r\n decays:{hack:0.6,str:0.8,def:0.8,dex:0.8,agi:0.8,cha:0, int:0.75},\r\n isStealth:true\r\n });\r\n BlackOperations[\"Operation Hyron\"] = new BlackOperation({\r\n name:\"Operation Hyron\",\r\n desc:\"Our intelligence tells us that Fulcrum Technologies is developing \" +\r\n \"a quantum supercomputer using human brains as core \" +\r\n \"processors. This supercomputer \" +\r\n \"is rumored to be able to store vast amounts of data and \" +\r\n \"perform computations unmatched by any other supercomputer on the \" +\r\n \"planet. But more importantly, the use of organic human brains \" +\r\n \"means that the supercomputer may be able to reason abstractly \" +\r\n \"and become self-aware.<br><br>\" +\r\n \"I do not need to remind you why sentient-level AIs pose a serious \" +\r\n \"thread to all of mankind.<br><br>\" +\r\n \"The research for this project is being conducted at one of Fulcrum \" +\r\n \"Technologies secret facilities in Aevum, codenamed 'Alpha Ranch'. \" +\r\n \"Infiltrate the compound, delete and destroy the work, and then find and kill the \" +\r\n \"project lead.\",\r\n baseDifficulty:40e3, reqdRank:125e3,\r\n rankGain:3e3, rankLoss:1e3, hpLoss:500,\r\n weights:{hack:0.1,str:0.2,def:0.2,dex:0.2,agi:0.2,cha:0, int:0.1},\r\n decays:{hack:0.6,str:0.8,def:0.8,dex:0.8,agi:0.8,cha:0, int:0.75},\r\n isKill:true\r\n });\r\n BlackOperations[\"Operation Morpheus\"] = new BlackOperation({\r\n name:\"Operation Morpheus\",\r\n desc:\"DreamSense Technologies is an advertising company that uses \" +\r\n \"special technology to transmit their ads into the peoples \" +\r\n \"dreams and subconcious. They do this using broadcast transmitter \" +\r\n \"towers. Based on information from our agents and informants in \" +\r\n \"Chonqging, we have reason to believe that one of the broadcast \" +\r\n \"towers there has been compromised by Synthoids and is being used \" +\r\n \"to spread pro-Synthoid propaganda.<br><br>\" +\r\n \"The mission is to destroy this broadcast tower. Speed and \" +\r\n \"stealth are of the upmost important for this.\",\r\n baseDifficulty:45e3, reqdRank:150e3,\r\n rankGain:4e3, rankLoss:1e3, hpLoss:100,\r\n weights:{hack:0.05,str:0.15,def:0.15,dex:0.3,agi:0.3,cha:0, int:0.05},\r\n decays:{hack:0.6,str:0.8,def:0.8,dex:0.8,agi:0.8,cha:0, int:0.75},\r\n isStealth:true\r\n });\r\n BlackOperations[\"Operation Ion Storm\"] = new BlackOperation({\r\n name:\"Operation Ion Storm\",\r\n desc:\"Our analysts have uncovered a gathering of MK-VI Synthoids \" +\r\n \"that have taken up residence in the Sector-12 Slums. We \" +\r\n \"don't know if they are rogue Synthoids from the Uprising, \" +\r\n \"but we do know that they have been stockpiling \" +\r\n \"weapons, money, and other resources. This makes them dangerous.<br><br>\" +\r\n \"This is a full-scale assault operation to find and retire all of these \" +\r\n \"Synthoids in the Sector-12 Slums.\",\r\n baseDifficulty:50e3, reqdRank:175e3,\r\n rankGain:5e3, rankLoss:1e3, hpLoss:5000,\r\n weights:{hack:0,str:0.24,def:0.24,dex:0.24,agi:0.24,cha:0, int:0.04},\r\n decays:{hack:0.6,str:0.8,def:0.8,dex:0.8,agi:0.8,cha:0, int:0.75},\r\n isKill:true\r\n });\r\n BlackOperations[\"Operation Annihilus\"] = new BlackOperation({\r\n name:\"Operation Annihilus\",\r\n desc:\"Our superiors have ordered us to eradicate everything and everyone \" +\r\n \"in an underground facility located in Aevum. They tell us \" +\r\n \"that the facility houses many dangerous Synthoids and \" +\r\n \"belongs to a terrorist organization called \" +\r\n \"'The Covenant'. We have no prior intelligence about this \" +\r\n \"organization, so you are going in blind.\",\r\n baseDifficulty:55e3, reqdRank:200e3,\r\n rankGain:7.5e3, rankLoss:1e3, hpLoss:10e3,\r\n weights:{hack:0,str:0.24,def:0.24,dex:0.24,agi:0.24,cha:0, int:0.04},\r\n decays:{hack:0.6,str:0.8,def:0.8,dex:0.8,agi:0.8,cha:0, int:0.75},\r\n isKill:true\r\n });\r\n BlackOperations[\"Operation Ultron\"] = new BlackOperation({\r\n name:\"Operation Ultron\",\r\n desc:\"OmniTek Incorporated, the original designer and manufacturer of Synthoids, \" +\r\n \"has notified us of a malfunction in their AI design. This malfunction, \" +\r\n \"when triggered, causes MK-VI Synthoids to become radicalized and seek out \" +\r\n \"the destruction of humanity. They say that this bug affects all MK-VI Synthoids, \" +\r\n \"not just the rogue ones from the Uprising.<br><br>\" +\r\n \"OmniTek has also told us they they believe someone has triggered this \" +\r\n \"malfunction in a large group of MK-VI Synthoids, and that these newly-radicalized Synthoids \" +\r\n \"are now amassing in Volhaven to form a terrorist group called Ultron.<br><br>\" +\r\n \"Intelligence suggests Ultron is heavily armed and that their members are \" +\r\n \"augmented. We believe Ultron is making moves to take control of \" +\r\n \"and weaponize DeltaOne's Tactical High-Energy Satellite Laser Array (THESLA).<br><br>\" +\r\n \"Your task is to find and destroy Ultron.\",\r\n baseDifficulty:60e3, reqdRank:250e3,\r\n rankGain:10e3, rankLoss:2e3, hpLoss:10e3,\r\n weights:{hack:0.1,str:0.2,def:0.2,dex:0.2,agi:0.2,cha:0, int:0.1},\r\n decays:{hack:0.6,str:0.8,def:0.8,dex:0.8,agi:0.8,cha:0, int:0.75},\r\n isKill:true\r\n });\r\n BlackOperations[\"Operation Centurion\"] = new BlackOperation({\r\n name:\"Operation Centurion\",\r\n desc:\"D)@#)($M)C0293c40($*)@#D0JUMP3Rm0C<*@#)*$)#02c94830c(#$*D)<br><br>\" +\r\n \"Throughout all of humanity's history, we have relied on \" +\r\n \"technology to survive, conquer, and progress. Its advancement became our primary goal. \" +\r\n \"And at the peak of human civilization technology turned into \" +\r\n \"power. Global, absolute power.<br><br>\" +\r\n \"It seems that the universe is not without a sense of irony.<br><br>\" +\r\n \"D)@#)($M)C0293c40($*)@#D0JUMP3Rm0C<*@#)*$)#02c94830c(#$*D)\",\r\n baseDifficulty:70e3, reqdRank:300e3,\r\n rankGain:15e3, rankLoss:5e3, hpLoss:10e3,\r\n weights:{hack:0.1,str:0.2,def:0.2,dex:0.2,agi:0.2,cha:0, int:0.1},\r\n decays:{hack:0.6,str:0.8,def:0.8,dex:0.8,agi:0.8,cha:0, int:0.75},\r\n });\r\n BlackOperations[\"Operation Vindictus\"] = new BlackOperation({\r\n name:\"Operation Vindictus\",\r\n desc:\"D)@#)($M)C0293c40($*)@#D0JUMP3Rm0C<*@#)*$)#02c94830c(#$*D)<br><br>\" +\r\n \"The bits are all around us. The daemons that hold the Node \" +\r\n \"together can manifest themselves in many different ways.<br><br>\" +\r\n \"D)@#)($M)C0293c40($*)@#D0JUMP3Rm0C<*@#)*$)#02c94830c(#$*D)\",\r\n baseDifficulty:75e3, reqdRank:350e3,\r\n rankGain:20e3, rankLoss:20e3, hpLoss:20e3,\r\n weights:{hack:0.1,str:0.2,def:0.2,dex:0.2,agi:0.2,cha:0, int:0.1},\r\n decays:{hack:0.6,str:0.8,def:0.8,dex:0.8,agi:0.8,cha:0, int:0.75},\r\n });\r\n BlackOperations[\"Operation Daedalus\"] = new BlackOperation({\r\n name:\"Operation Daedalus\",\r\n desc:\"Yesterday we obeyed kings and bent our neck to emperors. \" +\r\n \"Today we kneel only to truth.\",\r\n baseDifficulty:80e3, reqdRank:400e3,\r\n rankGain:40e3, rankLoss:10e3, hpLoss:100e3,\r\n weights:{hack:0.1,str:0.2,def:0.2,dex:0.2,agi:0.2,cha:0, int:0.1},\r\n decays:{hack:0.6,str:0.8,def:0.8,dex:0.8,agi:0.8,cha:0, int:0.75},\r\n });\r\n}\r\n\r\nexport {Bladeburner};\r\n","import {CONSTANTS} from \"./Constants.js\";\r\nimport {Player} from \"./Player.js\";\r\nimport {dialogBoxCreate} from \"../utils/DialogBox.js\";\r\n\r\n\r\nfunction Crime(name, type, time, money, difficulty, karma, params) {\r\n this.name = name;\r\n this.type = type;\r\n this.time = time;\r\n this.money = money;\r\n this.difficulty = difficulty;\r\n this.karma = karma;\r\n\r\n this.hacking_success_weight = params.hacking_success_weight ? params.hacking_success_weight : 0;\r\n this.strength_success_weight = params.strength_success_weight ? params.strength_success_weight : 0;\r\n this.defense_success_weight = params.defense_success_weight ? params.defense_success_weight : 0;\r\n this.dexterity_success_weight = params.dexterity_success_weight ? params.dexterity_success_weight : 0;\r\n this.agility_success_weight = params.agility_success_weight ? params.agility_success_weight : 0;\r\n this.charisma_success_weight = params.charisma_success_weight ? params.charisma_success_weight : 0;\r\n\r\n this.hacking_exp = params.hacking_exp ? params.hacking_exp : 0;\r\n this.strength_exp = params.strength_exp ? params.strength_exp : 0;\r\n this.defense_exp = params.defense_exp ? params.defense_exp : 0;\r\n this.dexterity_exp = params.dexterity_exp ? params.dexterity_exp : 0;\r\n this.agility_exp = params.agility_exp ? params.agility_exp : 0;\r\n this.charisma_exp = params.charisma_exp ? params.charisma_exp : 0;\r\n this.intelligence_exp = params.intelligence_exp ? params.intelligence_exp : 0;\r\n\r\n this.kills = params.kills ? params.kills : 0;\r\n}\r\n\r\nCrime.prototype.commit = function(div=1, singParams=null) {\r\n if (div <= 0) {div = 1;}\r\n Player.crimeType = this.type;\r\n Player.startCrime(\r\n this.hacking_exp/div,\r\n this.strength_exp/div,\r\n this.defense_exp/div,\r\n this.dexterity_exp/div,\r\n this.agility_exp/div,\r\n this.charisma_exp/div,\r\n this.money/div, this.time, singParams);\r\n return this.time;\r\n}\r\n\r\nCrime.prototype.successRate = function() {\r\n var chance = (this.hacking_success_weight * Player.hacking_skill +\r\n this.strength_success_weight * Player.strength +\r\n this.defense_success_weight * Player.defense +\r\n this.dexterity_success_weight * Player.dexterity +\r\n this.agility_success_weight * Player.agility +\r\n this.charisma_success_weight * Player.charisma +\r\n CONSTANTS.IntelligenceCrimeWeight * Player.intelligence);\r\n chance /= CONSTANTS.MaxSkillLevel;\r\n chance /= this.difficulty;\r\n chance *= Player.crime_success_mult;\r\n return Math.min(chance, 1);\r\n}\r\n\r\nconst Crimes = {\r\n Shoplift: new Crime(\"Shoplift\", CONSTANTS.CrimeShoplift, 2e3, 15e3, 1/20, 0.1, {\r\n dexterity_success_weight: 1,\r\n agility_success_weight: 1,\r\n\r\n dexterity_exp: 2,\r\n agility_exp: 2,\r\n }),\r\n\r\n RobStore: new Crime(\"Rob Store\", CONSTANTS.CrimeRobStore, 60e3, 400e3, 1/5, 0.5, {\r\n hacking_exp: 30,\r\n dexterity_exp: 45,\r\n agility_exp: 45,\r\n\r\n hacking_success_weight: 0.5 ,\r\n dexterity_success_weight: 2,\r\n agility_success_weight: 1,\r\n\r\n intelligence_exp: 0.25 * CONSTANTS.IntelligenceCrimeBaseExpGain,\r\n }),\r\n\r\n Mug: new Crime(\"Mug\", CONSTANTS.CrimeMug, 4e3, 36e3, 1/5, 0.25, {\r\n strength_exp: 3,\r\n defense_exp: 3,\r\n dexterity_exp: 3,\r\n agility_exp: 3,\r\n\r\n strength_success_weight: 1.5,\r\n defense_success_weight: 0.5,\r\n dexterity_success_weight: 1.5,\r\n agility_success_weight: 0.5,\r\n }),\r\n\r\n Larceny: new Crime(\"Larceny\", CONSTANTS.CrimeLarceny, 90e3, 800e3, 1/3, 1.5, {\r\n hacking_exp: 45,\r\n dexterity_exp: 60,\r\n agility_exp: 60,\r\n\r\n hacking_skill_success_weight: 0.5,\r\n dexterity_success_weight: 1,\r\n agility_success_weight: 1,\r\n\r\n intelligence_exp: 0.5 * CONSTANTS.IntelligenceCrimeBaseExpGain,\r\n }),\r\n\r\n DealDrugs: new Crime(\"Deal Drugs\", CONSTANTS.CrimeDrugs, 10e3, 120e3, 1, 0.5, {\r\n dexterity_exp: 5,\r\n agility_exp: 5,\r\n charisma_exp: 10,\r\n\r\n charisma_success_weight: 3,\r\n dexterity_success_weight: 2,\r\n agility_success_weight: 1,\r\n }),\r\n\r\n BondForgery: new Crime(\"Bond Forgery\", CONSTANTS.CrimeBondForgery, 300e3, 4.5e6, 1/2, 0.1, {\r\n hacking_exp: 100,\r\n dexterity_exp: 150,\r\n charisma_exp: 15,\r\n\r\n hacking_skill_success_weight: 0.05,\r\n dexterity_success_weight: 1.25,\r\n\r\n intelligence_exp: 2 * CONSTANTS.IntelligenceCrimeBaseExpGain,\r\n }),\r\n\r\n TraffickArms: new Crime(\"Traffick Arms\", CONSTANTS.CrimeTraffickArms, 40e3, 600e3, 2, 1, {\r\n strength_exp: 20,\r\n defense_exp: 20,\r\n dexterity_exp: 20,\r\n agility_exp: 20,\r\n charisma_exp: 40,\r\n\r\n charisma_success_weight: 1,\r\n strength_success_weight: 1,\r\n defense_success_weight: 1,\r\n dexterity_success_weight: 1,\r\n agility_success_weight: 1,\r\n }),\r\n\r\n Homicide: new Crime(\"Homicide\", CONSTANTS.CrimeHomicide, 3e3, 45e3, 1, 3, {\r\n strength_exp: 2,\r\n defense_exp: 2,\r\n dexterity_exp: 2,\r\n agility_exp: 2,\r\n\r\n strength_success_weight: 2,\r\n defense_success_weight: 2,\r\n dexterity_success_weight: 0.5,\r\n agility_success_weight: 0.5,\r\n\r\n kills: 1,\r\n }),\r\n\r\n GrandTheftAuto: new Crime(\"Grand Theft Auto\", CONSTANTS.CrimeGrandTheftAuto, 80e3, 1.6e6, 8, 5, {\r\n strength_exp: 20,\r\n defense_exp: 20,\r\n dexterity_exp: 20,\r\n agility_exp: 80,\r\n charisma_exp: 40,\r\n\r\n hacking_skill_success_weight: 1,\r\n strength_success_weight: 1,\r\n dexterity_success_weight: 4,\r\n agility_success_weight: 2,\r\n charisma_success_weight: 2,\r\n\r\n intelligence_exp: CONSTANTS.IntelligenceCrimeBaseExpGain,\r\n }),\r\n\r\n Kidnap: new Crime(\"Kidnap\", CONSTANTS.CrimeKidnap, 120e3, 3.6e6, 5, 6, {\r\n strength_exp: 80,\r\n defense_exp: 80,\r\n dexterity_exp: 80,\r\n agility_exp: 80,\r\n charisma_exp: 80,\r\n\r\n charisma_success_weight: 1,\r\n strength_success_weight: 1,\r\n dexterity_success_weight: 1,\r\n agility_success_weight: 1,\r\n\r\n intelligence_exp: 2 * CONSTANTS.IntelligenceCrimeBaseExpGain,\r\n }),\r\n\r\n Assassination: new Crime(\"Assassination\", CONSTANTS.CrimeAssassination, 300e3, 12e6, 8, 10, {\r\n strength_exp: 300,\r\n defense_exp: 300,\r\n dexterity_exp: 300,\r\n agility_exp: 300,\r\n\r\n strength_success_weight: 1,\r\n dexterity_success_weight: 2,\r\n agility_success_weight: 1,\r\n\r\n intelligence_exp: 5 * CONSTANTS.IntelligenceCrimeBaseExpGain,\r\n\r\n kills: 1,\r\n }),\r\n\r\n Heist: new Crime(\"Heist\", CONSTANTS.CrimeHeist, 600e3, 120e6, 18, 15, {\r\n hacking_exp: 450,\r\n strength_exp: 450,\r\n defense_exp: 450,\r\n dexterity_exp: 450,\r\n agility_exp: 450,\r\n charisma_exp: 450,\r\n\r\n hacking_skill_success_weight: 1,\r\n strength_success_weight: 1,\r\n defense_success_weight: 1,\r\n dexterity_success_weight: 1,\r\n agility_success_weight: 1,\r\n charisma_success_weight: 1,\r\n\r\n intelligence_exp: 10 * CONSTANTS.IntelligenceCrimeBaseExpGain,\r\n }),\r\n};\r\n\r\nfunction determineCrimeSuccess(type, moneyGained) {\r\n var chance = 0;\r\n var found = false;\r\n for(const i in Crimes) {\r\n const crime = Crimes[i];\r\n if(crime.type == type) {\r\n chance = crime.successRate();\r\n found = true;\r\n break;\r\n }\r\n }\r\n if(!found) {\r\n console.log(crime);\r\n dialogBoxCreate(\"ERR: Unrecognized crime type. This is probably a bug please contact the developer\");\r\n return;\r\n }\r\n\r\n if (Math.random() <= chance) {\r\n //Success\r\n Player.gainMoney(moneyGained);\r\n return true;\r\n } else {\r\n //Failure\r\n return false;\r\n }\r\n}\r\n\r\nfunction findCrime(roughName) {\r\n if (roughName.includes(\"shoplift\")) {\r\n return Crimes.Shoplift;\r\n } else if (roughName.includes(\"rob\") && roughName.includes(\"store\")) {\r\n return Crimes.RobStore;\r\n } else if (roughName.includes(\"mug\")) {\r\n return Crimes.Mug;\r\n } else if (roughName.includes(\"larceny\")) {\r\n return Crimes.Larceny;\r\n } else if (roughName.includes(\"drugs\")) {\r\n return Crimes.DealDrugs;\r\n } else if (roughName.includes(\"bond\") && roughName.includes(\"forge\")) {\r\n return Crimes.BondForgery;\r\n } else if (roughName.includes(\"traffick\") && roughName.includes(\"arms\")) {\r\n return Crimes.TraffickArms;\r\n } else if (roughName.includes(\"homicide\")) {\r\n return Crimes.Homicide;\r\n } else if (roughName.includes(\"grand\") && roughName.includes(\"auto\")) {\r\n return Crimes.GrandTheftAuto;\r\n } else if (roughName.includes(\"kidnap\")) {\r\n return Crimes.Kidnap;\r\n } else if (roughName.includes(\"assassinate\")) {\r\n return Crimes.Assassination;\r\n } else if (roughName.includes(\"heist\")) {\r\n return Crimes.Heist;\r\n }\r\n return null;\r\n}\r\n\r\nexport {determineCrimeSuccess,findCrime,Crimes};\r\n","import {Augmentations, Augmentation,\r\n AugmentationNames} from \"./Augmentations.js\";\r\nimport {Programs} from \"./CreateProgram.js\";\r\nimport {inMission} from \"./Missions.js\";\r\nimport {Player} from \"./Player.js\";\r\nimport {redPillFlag} from \"./RedPill.js\";\r\nimport {GetServerByHostname} from \"./Server.js\";\r\nimport {Settings} from \"./Settings.js\";\r\nimport {dialogBoxCreate, dialogBoxOpened} from \"../utils/DialogBox.js\";\r\nimport {Reviver, Generic_toJSON,\r\n Generic_fromJSON} from \"../utils/JSONReviver.js\";\r\n\r\n/* Message.js */\r\nfunction Message(filename=\"\", msg=\"\") {\r\n this.filename = filename;\r\n this.msg = msg;\r\n this.recvd = false;\r\n}\r\n\r\nMessage.prototype.toJSON = function() {\r\n return Generic_toJSON(\"Message\", this);\r\n}\r\n\r\n\r\nMessage.fromJSON = function(value) {\r\n return Generic_fromJSON(Message, value.data);\r\n}\r\n\r\nReviver.constructors.Message = Message;\r\n\r\n//Sends message to player, including a pop up\r\nfunction sendMessage(msg, forced=false) {\r\n console.log(\"sending message: \" + msg.filename);\r\n msg.recvd = true;\r\n if (forced || !Settings.SuppressMessages) {\r\n showMessage(msg);\r\n }\r\n addMessageToServer(msg, \"home\");\r\n}\r\n\r\nfunction showMessage(msg) {\r\n var txt = \"Message received from unknown sender: <br><br>\" +\r\n \"<i>\" + msg.msg + \"</i><br><br>\" +\r\n \"This message was saved as \" + msg.filename + \" onto your home computer.\";\r\n dialogBoxCreate(txt);\r\n}\r\n\r\n//Adds a message to a server\r\nfunction addMessageToServer(msg, serverHostname) {\r\n var server = GetServerByHostname(serverHostname);\r\n if (server == null) {\r\n console.log(\"WARNING: Did not locate \" + serverHostname);\r\n return;\r\n }\r\n for (var i = 0; i < server.messages.length; ++i) {\r\n if (server.messages[i].filename === msg.filename) {\r\n return; //Already exists\r\n }\r\n }\r\n server.messages.push(msg);\r\n}\r\n\r\n//Checks if any of the 'timed' messages should be sent\r\nfunction checkForMessagesToSend() {\r\n var jumper0 = Messages[MessageFilenames.Jumper0];\r\n var jumper1 = Messages[MessageFilenames.Jumper1];\r\n var jumper2 = Messages[MessageFilenames.Jumper2];\r\n var jumper3 = Messages[MessageFilenames.Jumper3];\r\n var jumper4 = Messages[MessageFilenames.Jumper4];\r\n var cybersecTest = Messages[MessageFilenames.CyberSecTest];\r\n var nitesecTest = Messages[MessageFilenames.NiteSecTest];\r\n var bitrunnersTest = Messages[MessageFilenames.BitRunnersTest];\r\n var redpill = Messages[MessageFilenames.RedPill];\r\n\r\n var redpillOwned = false;\r\n if (Augmentations[AugmentationNames.TheRedPill].owned) {\r\n redpillOwned = true;\r\n }\r\n\r\n if (redpill && redpillOwned && Player.sourceFiles.length === 0 && !redPillFlag && !inMission) {\r\n if (!dialogBoxOpened) {\r\n sendMessage(redpill, true);\r\n }\r\n } else if (redpill && redpillOwned) {\r\n //If player has already destroyed a BitNode, message is not forced\r\n if (!redPillFlag && !inMission && !dialogBoxOpened) {\r\n sendMessage(redpill);\r\n }\r\n } else if (jumper0 && !jumper0.recvd && Player.hacking_skill >= 25) {\r\n sendMessage(jumper0);\r\n Player.getHomeComputer().programs.push(Programs.Flight);\r\n } else if (jumper1 && !jumper1.recvd && Player.hacking_skill >= 40) {\r\n sendMessage(jumper1);\r\n } else if (cybersecTest && !cybersecTest.recvd && Player.hacking_skill >= 50) {\r\n sendMessage(cybersecTest);\r\n } else if (jumper2 && !jumper2.recvd && Player.hacking_skill >= 175) {\r\n sendMessage(jumper2);\r\n } else if (nitesecTest && !nitesecTest.recvd && Player.hacking_skill >= 200) {\r\n sendMessage(nitesecTest);\r\n } else if (jumper3 && !jumper3.recvd && Player.hacking_skill >= 350) {\r\n sendMessage(jumper3);\r\n } else if (jumper4 && !jumper4.recvd && Player.hacking_skill >= 490) {\r\n sendMessage(jumper4);\r\n } else if (bitrunnersTest && !bitrunnersTest.recvd && Player.hacking_skill >= 500) {\r\n sendMessage(bitrunnersTest);\r\n }\r\n}\r\n\r\nfunction AddToAllMessages(msg) {\r\n Messages[msg.filename] = msg;\r\n}\r\n\r\nlet Messages = {}\r\n\r\nfunction loadMessages(saveString) {\r\n Messages = JSON.parse(saveString, Reviver);\r\n}\r\n\r\nlet MessageFilenames = {\r\n Jumper0: \"j0.msg\",\r\n Jumper1: \"j1.msg\",\r\n Jumper2: \"j2.msg\",\r\n Jumper3: \"j3.msg\",\r\n Jumper4: \"j4.msg\",\r\n CyberSecTest: \"csec-test.msg\",\r\n NiteSecTest: \"nitesec-test.msg\",\r\n BitRunnersTest: \"19dfj3l1nd.msg\",\r\n RedPill: \"icarus.msg\",\r\n}\r\n\r\nfunction initMessages() {\r\n //Reset\r\n Messages = {};\r\n\r\n //jump3R Messages\r\n AddToAllMessages(new Message(MessageFilenames.Jumper0,\r\n \"I know you can sense it. I know you're searching for it. \" +\r\n \"It's why you spend night after \" +\r\n \"night at your computer. <br><br>It's real, I've seen it. And I can \" +\r\n \"help you find it. But not right now. You're not ready yet.<br><br>\" +\r\n \"Use this program to track your progress<br><br>\" +\r\n \"The fl1ght.exe program was added to your home computer<br><br>\" +\r\n \"-jump3R\"));\r\n AddToAllMessages(new Message(MessageFilenames.Jumper1,\r\n \"Soon you will be contacted by a hacking group known as CyberSec. \" +\r\n \"They can help you with your search. <br><br>\" +\r\n \"You should join them, garner their favor, and \" +\r\n \"exploit them for their Augmentations. But do not trust them. \" +\r\n \"They are not what they seem. No one is.<br><br>\" +\r\n \"-jump3R\"));\r\n AddToAllMessages(new Message(MessageFilenames.Jumper2,\r\n \"Do not try to save the world. There is no world to save. If \" +\r\n \"you want to find the truth, worry only about yourself. Ethics and \" +\r\n \"morals will get you killed. <br><br>Watch out for a hacking group known as NiteSec.\" +\r\n \"<br><br>-jump3R\"));\r\n AddToAllMessages(new Message(MessageFilenames.Jumper3,\r\n \"You must learn to walk before you can run. And you must \" +\r\n \"run before you can fly. Look for the black hand. <br><br>\" +\r\n \"I.I.I.I <br><br>-jump3R\"));\r\n AddToAllMessages(new Message(MessageFilenames.Jumper4,\r\n \"To find what you are searching for, you must understand the bits. \" +\r\n \"The bits are all around us. The runners will help you.<br><br>\" +\r\n \"-jump3R\"));\r\n\r\n //Messages from hacking factions\r\n AddToAllMessages(new Message(MessageFilenames.CyberSecTest,\r\n \"We've been watching you. Your skills are very impressive. But you're wasting \" +\r\n \"your talents. If you join us, you can put your skills to good use and change \" +\r\n \"the world for the better. If you join us, we can unlock your full potential. <br><br>\" +\r\n \"But first, you must pass our test. Find and hack our server using the Terminal. <br><br>\" +\r\n \"-CyberSec\"));\r\n AddToAllMessages(new Message(MessageFilenames.NiteSecTest,\r\n \"People say that the corrupted governments and corporations rule the world. \" +\r\n \"Yes, maybe they do. But do you know who everyone really fears? People \" +\r\n \"like us. Because they can't hide from us. Because they can't fight shadows \" +\r\n \"and ideas with bullets. <br><br>\" +\r\n \"Join us, and people will fear you, too. <br><br>\" +\r\n \"Find and hack our hidden server using the Terminal. Then, we will contact you again.\" +\r\n \"<br><br>-NiteSec\"));\r\n AddToAllMessages(new Message(MessageFilenames.BitRunnersTest,\r\n \"We know what you are doing. We know what drives you. We know \" +\r\n \"what you are looking for. <br><br> \" +\r\n \"We can help you find the answers.<br><br>\" +\r\n \"run4theh111z\"));\r\n\r\n AddToAllMessages(new Message(MessageFilenames.RedPill,\r\n \"@)(#V%*N)@(#*)*C)@#%*)*V)@#(*%V@)(#VN%*)@#(*%<br>\" +\r\n \")@B(*#%)@)M#B*%V)____FIND___#$@)#%(B*)@#(*%B)<br>\" +\r\n \"@_#(%_@#M(BDSPOMB__THE-CAVE_#)$(*@#$)@#BNBEGB<br>\" +\r\n \"DFLSMFVMV)#@($*)@#*$MV)@#(*$V)M#(*$)M@(#*VM$)\"));\r\n}\r\n\r\nexport {Messages, checkForMessagesToSend, sendMessage, showMessage, loadMessages,\r\n initMessages, Message};\r\n","import {post} from \"./Terminal.js\";\r\n\r\nlet Aliases = {};\r\nlet GlobalAliases = {};\r\n\r\nfunction loadAliases(saveString) {\r\n if (saveString === \"\") {\r\n Aliases = {};\r\n } else {\r\n Aliases = JSON.parse(saveString);\r\n }\r\n}\r\n\r\nfunction loadGlobalAliases(saveString) {\r\n if (saveString === \"\") {\r\n GlobalAliases = {};\r\n } else {\r\n GlobalAliases = JSON.parse(saveString);\r\n }\r\n}\r\n\r\n//Print all aliases to terminal\r\nfunction printAliases() {\r\n for (var name in Aliases) {\r\n if (Aliases.hasOwnProperty(name)) {\r\n post(\"alias \" + name + \"=\" + Aliases[name]);\r\n }\r\n }\r\n for (var name in GlobalAliases) {\r\n if (GlobalAliases.hasOwnProperty(name)) {\r\n post(\"global alias \" + name + \"=\" + GlobalAliases[name]);\r\n }\r\n }\r\n}\r\n\r\n//True if successful, false otherwise\r\nfunction parseAliasDeclaration(dec,global=false) {\r\n var re = /^([_|\\w|!|%|,|@]+)=\"(.+)\"$/;\r\n var matches = dec.match(re);\r\n if (matches == null || matches.length != 3) {return false;}\r\n if (global){\r\n addGlobalAlias(matches[1],matches[2]);\r\n } else {\r\n addAlias(matches[1], matches[2]);\r\n }\r\n return true;\r\n}\r\n\r\nfunction addAlias(name, value) {\r\n if (name in GlobalAliases){\r\n delete GlobalAliases[name];\r\n }\r\n Aliases[name] = value;\r\n}\r\n\r\nfunction addGlobalAlias(name, value) {\r\n if (name in Aliases){\r\n delete Aliases[name];\r\n }\r\n GlobalAliases[name] = value;\r\n}\r\n\r\nfunction getAlias(name) {\r\n if (Aliases.hasOwnProperty(name)) {\r\n return Aliases[name];\r\n }\r\n return null;\r\n}\r\n\r\nfunction getGlobalAlias(name) {\r\n if (GlobalAliases.hasOwnProperty(name)) {\r\n return GlobalAliases[name];\r\n }\r\n return null;\r\n}\r\n\r\nfunction removeAlias(name) {\r\n if (Aliases.hasOwnProperty(name)) {\r\n delete Aliases[name];\r\n return true;\r\n }\r\n if (GlobalAliases.hasOwnProperty(name)) {\r\n delete GlobalAliases[name];\r\n return true;\r\n }\r\n return false;\r\n}\r\n\r\n//Returns the original string with any aliases substituted in\r\n//Aliases only applied to \"whole words\", one level deep\r\nfunction substituteAliases(origCommand) {\r\n var commandArray = origCommand.split(\" \");\r\n if (commandArray.length>0){\r\n var alias = getAlias(commandArray[0]);\r\n if (alias != null) {\r\n commandArray[0] = alias;\r\n } else {\r\n var alias = getGlobalAlias(commandArray[0]);\r\n if (alias != null) {\r\n commandArray[0] = alias;\r\n }\r\n }\r\n for (var i = 0; i < commandArray.length; ++i) {\r\n var alias = getGlobalAlias(commandArray[i]);\r\n if (alias != null) {\r\n commandArray[i] = alias;\r\n }\r\n }\r\n }\r\n return commandArray.join(\" \");\r\n}\r\n\r\nexport {Aliases, GlobalAliases, printAliases, parseAliasDeclaration,\r\n removeAlias, substituteAliases, loadAliases, loadGlobalAliases};\r\n","var sprintf = require('sprintf-js').sprintf,\r\n vsprintf = require('sprintf-js').vsprintf\r\n\r\nimport {updateActiveScriptsItems} from \"./ActiveScriptsUI.js\";\r\nimport {Augmentations, Augmentation,\r\n augmentationExists, installAugmentations,\r\n AugmentationNames} from \"./Augmentations.js\";\r\nimport {BitNodeMultipliers} from \"./BitNode.js\";\r\nimport {determineCrimeSuccess, findCrime} from \"./Crimes.js\";\r\nimport {Bladeburner} from \"./Bladeburner.js\";\r\nimport {Companies, Company, CompanyPosition,\r\n CompanyPositions, companyExists} from \"./Company.js\";\r\nimport {CONSTANTS} from \"./Constants.js\";\r\nimport {Programs} from \"./CreateProgram.js\";\r\nimport {parseDarkwebItemPrice, DarkWebItems} from \"./DarkWeb.js\";\r\nimport {Engine} from \"./engine.js\";\r\nimport {Factions, Faction, joinFaction,\r\n factionExists, purchaseAugmentation} from \"./Faction.js\";\r\nimport {getCostOfNextHacknetNode, purchaseHacknet} from \"./HacknetNode.js\";\r\nimport {Locations} from \"./Location.js\";\r\nimport {Message, Messages} from \"./Message.js\";\r\nimport {inMission} from \"./Missions.js\";\r\nimport {Player} from \"./Player.js\";\r\nimport {Script, findRunningScript, RunningScript,\r\n isScriptFilename} from \"./Script.js\";\r\nimport {Server, getServer, AddToAllServers,\r\n AllServers, processSingleServerGrowth,\r\n GetServerByHostname} from \"./Server.js\";\r\nimport {Settings} from \"./Settings.js\";\r\nimport {SpecialServerIps} from \"./SpecialServerIps.js\";\r\nimport {StockMarket, StockSymbols, SymbolToStockMap, initStockSymbols,\r\n initStockMarket, initSymbolToStockMap, stockMarketCycle, buyStock,\r\n sellStock, updateStockPrices, displayStockMarketContent,\r\n updateStockTicker, updateStockPlayerPosition,\r\n Stock, shortStock, sellShort, OrderTypes,\r\n PositionTypes, placeOrder, cancelOrder} from \"./StockMarket.js\";\r\nimport {post} from \"./Terminal.js\";\r\nimport {TextFile, getTextFile, createTextFile} from \"./TextFile.js\";\r\n\r\nimport {WorkerScript, workerScripts,\r\n killWorkerScript, NetscriptPorts} from \"./NetscriptWorker.js\";\r\nimport {makeRuntimeRejectMsg, netscriptDelay, runScriptFromScript,\r\n scriptCalculateHackingChance, scriptCalculateHackingTime,\r\n scriptCalculateExpGain, scriptCalculatePercentMoneyHacked,\r\n scriptCalculateGrowTime, scriptCalculateWeakenTime} from \"./NetscriptEvaluator.js\";\r\nimport {Environment} from \"./NetscriptEnvironment.js\";\r\nimport {NetscriptPort} from \"./NetscriptPort.js\";\r\n\r\nimport Decimal from \"decimal.js\";\r\nimport {dialogBoxCreate} from \"../utils/DialogBox.js\";\r\nimport {printArray, powerOfTwo} from \"../utils/HelperFunctions.js\";\r\nimport {createRandomIp} from \"../utils/IPAddress.js\";\r\nimport {formatNumber, isString, isHTML} from \"../utils/StringHelperFunctions.js\";\r\nimport {yesNoBoxClose, yesNoBoxGetYesButton,\r\n yesNoBoxGetNoButton, yesNoBoxCreate,\r\n yesNoBoxOpen} from \"../utils/YesNoBox.js\";\r\n\r\nvar hasCorporationSF = false, //Source-File 3\r\n hasSingularitySF = false, //Source-File 4\r\n hasAISF = false, //Source-File 5\r\n hasBladeburnerSF = false, //Source-File 6\r\n hasBladeburner2079SF = false, //Source-File 7\r\n hasWallStreetSF = false, //Source-File 8\r\n hasBn11SF = false; //Source-File 11\r\n\r\nvar singularitySFLvl=1, wallStreetSFLvl=1;\r\n\r\nvar possibleLogs = {\r\n ALL: true,\r\n scan: true,\r\n hack: true,\r\n sleep: true,\r\n disableLog: true,\r\n enableLog: true,\r\n grow: true,\r\n weaken: true,\r\n nuke: true,\r\n brutessh: true,\r\n ftpcrack: true,\r\n relaysmtp: true,\r\n httpworm: true,\r\n sqlinject: true,\r\n spawn: true,\r\n kill: true,\r\n killall: true,\r\n scp: true,\r\n getHackingLevel: true,\r\n getServerMoneyAvailable: true,\r\n getServerSecurityLevel: true,\r\n getServerBaseSecurityLevel: true,\r\n getServerMinSecurityLevel: true,\r\n getServerRequiredHackingLevel: true,\r\n getServerMaxMoney: true,\r\n getServerGrowth: true,\r\n getServerNumPortsRequired: true,\r\n getServerRam: true,\r\n buyStock: true,\r\n sellStock: true,\r\n purchaseServer: true,\r\n deleteServer: true,\r\n universityCourse: true,\r\n gymWorkout: true,\r\n travelToCity: true,\r\n purchaseTor: true,\r\n purchaseProgram: true,\r\n stopAction: true,\r\n upgradeHomeRam: true,\r\n workForCompany: true,\r\n applyToCompany: true,\r\n joinFaction: true,\r\n workForFaction: true,\r\n createProgram: true,\r\n commitCrime: true,\r\n shortStock: true,\r\n sellShort: true,\r\n startAction: true,\r\n upgradeSkill: true,\r\n setTeamSize: true,\r\n joinBladeburnerFaction: true,\r\n}\r\n\r\n//Used to check and set flags for every Source File, despite the name of the function\r\nfunction initSingularitySFFlags() {\r\n for (var i = 0; i < Player.sourceFiles.length; ++i) {\r\n if (Player.sourceFiles[i].n === 3) {hasCorporationSF = true;}\r\n if (Player.sourceFiles[i].n === 4) {\r\n hasSingularitySF = true;\r\n singularitySFLvl = Player.sourceFiles[i].lvl;\r\n }\r\n if (Player.sourceFiles[i].n === 5) {hasAISF = true;}\r\n if (Player.sourceFiles[i].n === 6) {hasBladeburnerSF = true;}\r\n if (Player.sourceFiles[i].n === 7) {hasBladeburner2079SF = true;}\r\n if (Player.sourceFiles[i].n === 8) {\r\n hasWallStreetSF = true;\r\n wallStreetSFLvl = Player.sourceFiles[i].lvl;\r\n }\r\n if (Player.sourceFiles[i].n === 11) {hasBn11SF = true;}\r\n }\r\n}\r\n\r\nfunction NetscriptFunctions(workerScript) {\r\n var updateDynamicRam = function(fnName, ramCost) {\r\n if (workerScript.dynamicLoadedFns[fnName]) {return;}\r\n workerScript.dynamicLoadedFns[fnName] = true;\r\n workerScript.dynamicRamUsage += ramCost;\r\n if (workerScript.dynamicRamUsage > 1.01 * workerScript.ramUsage) {\r\n throw makeRuntimeRejectMsg(workerScript,\r\n \"Dynamic RAM usage calculated to be greater than initial RAM usage. \" +\r\n \"This is probably because you somehow circumvented the static RAM \" +\r\n \"calculation.<br><br>Please don't do that :(\");\r\n }\r\n };\r\n\r\n var updateStaticRam = function(fnName, ramCost) {\r\n if (workerScript.loadedFns[fnName]) {\r\n return 0;\r\n } else {\r\n workerScript.loadedFns[fnName] = true;\r\n return ramCost;\r\n }\r\n };\r\n\r\n return {\r\n Math : Math,\r\n Date : Date,\r\n Number : Number,\r\n hacknetnodes : Player.hacknetNodeWrappers,\r\n sprintf : sprintf,\r\n vsprintf: vsprintf,\r\n scan : function(ip=workerScript.serverIp, hostnames=true){\r\n if (workerScript.checkingRam) {\r\n return updateStaticRam(\"scan\", CONSTANTS.ScriptScanRamCost);\r\n }\r\n updateDynamicRam(\"scan\", CONSTANTS.ScriptScanRamCost);\r\n var server = getServer(ip);\r\n if (server == null) {\r\n throw makeRuntimeRejectMsg(workerScript, 'Invalid IP or hostname passed into scan() command');\r\n }\r\n var out = [];\r\n for (var i = 0; i < server.serversOnNetwork.length; i++) {\r\n var entry;\r\n if (hostnames) {\r\n entry = server.getServerOnNetwork(i).hostname;\r\n } else {\r\n entry = server.getServerOnNetwork(i).ip;\r\n }\r\n if (entry == null) {\r\n continue;\r\n }\r\n out.push(entry);\r\n }\r\n if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.scan == null) {\r\n workerScript.scriptRef.log('scan() returned ' + server.serversOnNetwork.length + ' connections for ' + server.hostname);\r\n }\r\n return out;\r\n },\r\n hack : function(ip){\r\n if (workerScript.checkingRam) {\r\n return updateStaticRam(\"hack\", CONSTANTS.ScriptHackRamCost);\r\n }\r\n updateDynamicRam(\"hack\", CONSTANTS.ScriptHackRamCost);\r\n if (ip === undefined) {\r\n throw makeRuntimeRejectMsg(workerScript, \"Hack() call has incorrect number of arguments. Takes 1 argument\");\r\n }\r\n var threads = workerScript.scriptRef.threads;\r\n if (isNaN(threads) || threads < 1) {threads = 1;}\r\n var server = getServer(ip);\r\n if (server == null) {\r\n workerScript.scriptRef.log(\"hack() error. Invalid IP or hostname passed in: \" + ip + \". Stopping...\");\r\n throw makeRuntimeRejectMsg(workerScript, \"hack() error. Invalid IP or hostname passed in: \" + ip + \". Stopping...\");\r\n }\r\n\r\n //Calculate the hacking time\r\n var hackingTime = scriptCalculateHackingTime(server); //This is in seconds\r\n\r\n //No root access or skill level too low\r\n if (server.hasAdminRights == false) {\r\n workerScript.scriptRef.log(\"Cannot hack this server (\" + server.hostname + \") because user does not have root access\");\r\n throw makeRuntimeRejectMsg(workerScript, \"Cannot hack this server (\" + server.hostname + \") because user does not have root access\");\r\n }\r\n\r\n if (server.requiredHackingSkill > Player.hacking_skill) {\r\n workerScript.scriptRef.log(\"Cannot hack this server (\" + server.hostname + \") because user's hacking skill is not high enough\");\r\n throw makeRuntimeRejectMsg(workerScript, \"Cannot hack this server (\" + server.hostname + \") because user's hacking skill is not high enough\");\r\n }\r\n\r\n if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.hack == null) {\r\n workerScript.scriptRef.log(\"Attempting to hack \" + ip + \" in \" + hackingTime.toFixed(3) + \" seconds (t=\" + threads + \")\");\r\n }\r\n return netscriptDelay(hackingTime* 1000, workerScript).then(function() {\r\n if (workerScript.env.stopFlag) {return Promise.reject(workerScript);}\r\n var hackChance = scriptCalculateHackingChance(server);\r\n var rand = Math.random();\r\n var expGainedOnSuccess = scriptCalculateExpGain(server) * threads;\r\n var expGainedOnFailure = (expGainedOnSuccess / 4);\r\n if (rand < hackChance) { //Success!\r\n var moneyGained = scriptCalculatePercentMoneyHacked(server);\r\n moneyGained = Math.floor(server.moneyAvailable * moneyGained) * threads;\r\n\r\n //Over-the-top safety checks\r\n if (moneyGained <= 0) {\r\n moneyGained = 0;\r\n expGainedOnSuccess = expGainedOnFailure;\r\n }\r\n if (moneyGained > server.moneyAvailable) {moneyGained = server.moneyAvailable;}\r\n server.moneyAvailable -= moneyGained;\r\n if (server.moneyAvailable < 0) {server.moneyAvailable = 0;}\r\n\r\n Player.gainMoney(moneyGained);\r\n workerScript.scriptRef.onlineMoneyMade += moneyGained;\r\n Player.scriptProdSinceLastAug += moneyGained;\r\n workerScript.scriptRef.recordHack(server.ip, moneyGained, threads);\r\n Player.gainHackingExp(expGainedOnSuccess);\r\n workerScript.scriptRef.onlineExpGained += expGainedOnSuccess;\r\n if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.hack == null) {\r\n workerScript.scriptRef.log(\"Script SUCCESSFULLY hacked \" + server.hostname + \" for $\" + formatNumber(moneyGained, 2) + \" and \" + formatNumber(expGainedOnSuccess, 4) + \" exp (t=\" + threads + \")\");\r\n }\r\n server.fortify(CONSTANTS.ServerFortifyAmount * threads);\r\n return Promise.resolve(moneyGained);\r\n } else {\r\n //Player only gains 25% exp for failure?\r\n Player.gainHackingExp(expGainedOnFailure);\r\n workerScript.scriptRef.onlineExpGained += expGainedOnFailure;\r\n if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.hack == null) {\r\n workerScript.scriptRef.log(\"Script FAILED to hack \" + server.hostname + \". Gained \" + formatNumber(expGainedOnFailure, 4) + \" exp (t=\" + threads + \")\");\r\n }\r\n return Promise.resolve(0);\r\n }\r\n });\r\n },\r\n sleep : function(time){\r\n if (workerScript.checkingRam) {return 0;}\r\n if (time === undefined) {\r\n throw makeRuntimeRejectMsg(workerScript, \"sleep() call has incorrect number of arguments. Takes 1 argument\");\r\n }\r\n if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.sleep == null) {\r\n workerScript.scriptRef.log(\"Sleeping for \" + time + \" milliseconds\");\r\n }\r\n return netscriptDelay(time, workerScript).then(function() {\r\n return Promise.resolve(true);\r\n });\r\n },\r\n grow : function(ip){\r\n if (workerScript.checkingRam) {\r\n return updateStaticRam(\"grow\", CONSTANTS.ScriptGrowRamCost);\r\n }\r\n updateDynamicRam(\"grow\", CONSTANTS.ScriptGrowRamCost);\r\n var threads = workerScript.scriptRef.threads;\r\n if (isNaN(threads) || threads < 1) {threads = 1;}\r\n if (ip === undefined) {\r\n throw makeRuntimeRejectMsg(workerScript, \"grow() call has incorrect number of arguments. Takes 1 argument\");\r\n }\r\n var server = getServer(ip);\r\n if (server == null) {\r\n workerScript.scriptRef.log(\"Cannot grow(). Invalid IP or hostname passed in: \" + ip);\r\n throw makeRuntimeRejectMsg(workerScript, \"Cannot grow(). Invalid IP or hostname passed in: \" + ip);\r\n }\r\n\r\n //No root access or skill level too low\r\n if (server.hasAdminRights == false) {\r\n workerScript.scriptRef.log(\"Cannot grow this server (\" + server.hostname + \") because user does not have root access\");\r\n throw makeRuntimeRejectMsg(workerScript, \"Cannot grow this server (\" + server.hostname + \") because user does not have root access\");\r\n }\r\n\r\n var growTime = scriptCalculateGrowTime(server);\r\n if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.grow == null) {\r\n workerScript.scriptRef.log(\"Executing grow() on server \" + server.hostname + \" in \" + formatNumber(growTime/1000, 3) + \" seconds (t=\" + threads + \")\");\r\n }\r\n return netscriptDelay(growTime, workerScript).then(function() {\r\n if (workerScript.env.stopFlag) {return Promise.reject(workerScript);}\r\n server.moneyAvailable += (1 * threads); //It can be grown even if it has no money\r\n var growthPercentage = processSingleServerGrowth(server, 450 * threads);\r\n workerScript.scriptRef.recordGrow(server.ip, threads);\r\n var expGain = scriptCalculateExpGain(server) * threads;\r\n if (growthPercentage == 1) {\r\n expGain = 0;\r\n }\r\n if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.grow == null) {\r\n workerScript.scriptRef.log(\"Available money on \" + server.hostname + \" grown by \" +\r\n formatNumber(growthPercentage*100 - 100, 6) + \"%. Gained \" +\r\n formatNumber(expGain, 4) + \" hacking exp (t=\" + threads +\")\");\r\n }\r\n workerScript.scriptRef.onlineExpGained += expGain;\r\n Player.gainHackingExp(expGain);\r\n return Promise.resolve(growthPercentage);\r\n });\r\n },\r\n weaken : function(ip){\r\n if (workerScript.checkingRam) {\r\n return updateStaticRam(\"weaken\", CONSTANTS.ScriptWeakenRamCost);\r\n }\r\n updateDynamicRam(\"weaken\", CONSTANTS.ScriptWeakenRamCost);\r\n var threads = workerScript.scriptRef.threads;\r\n if (isNaN(threads) || threads < 1) {threads = 1;}\r\n if (ip === undefined) {\r\n throw makeRuntimeRejectMsg(workerScript, \"weaken() call has incorrect number of arguments. Takes 1 argument\");\r\n }\r\n var server = getServer(ip);\r\n if (server == null) {\r\n workerScript.scriptRef.log(\"Cannot weaken(). Invalid IP or hostname passed in: \" + ip);\r\n throw makeRuntimeRejectMsg(workerScript, \"Cannot weaken(). Invalid IP or hostname passed in: \" + ip);\r\n }\r\n\r\n //No root access or skill level too low\r\n if (server.hasAdminRights == false) {\r\n workerScript.scriptRef.log(\"Cannot weaken this server (\" + server.hostname + \") because user does not have root access\");\r\n throw makeRuntimeRejectMsg(workerScript, \"Cannot weaken this server (\" + server.hostname + \") because user does not have root access\");\r\n }\r\n\r\n var weakenTime = scriptCalculateWeakenTime(server);\r\n if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.weaken == null) {\r\n workerScript.scriptRef.log(\"Executing weaken() on server \" + server.hostname + \" in \" +\r\n formatNumber(weakenTime/1000, 3) + \" seconds (t=\" + threads + \")\");\r\n }\r\n return netscriptDelay(weakenTime, workerScript).then(function() {\r\n if (workerScript.env.stopFlag) {return Promise.reject(workerScript);}\r\n server.weaken(CONSTANTS.ServerWeakenAmount * threads);\r\n workerScript.scriptRef.recordWeaken(server.ip, threads);\r\n var expGain = scriptCalculateExpGain(server) * threads;\r\n if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.weaken == null) {\r\n workerScript.scriptRef.log(\"Server security level on \" + server.hostname + \" weakened to \" + server.hackDifficulty +\r\n \". Gained \" + formatNumber(expGain, 4) + \" hacking exp (t=\" + threads + \")\");\r\n }\r\n workerScript.scriptRef.onlineExpGained += expGain;\r\n Player.gainHackingExp(expGain);\r\n return Promise.resolve(CONSTANTS.ServerWeakenAmount * threads);\r\n });\r\n },\r\n print : function(args){\r\n if (workerScript.checkingRam) {return 0;}\r\n if (args === undefined) {\r\n throw makeRuntimeRejectMsg(workerScript, \"print() call has incorrect number of arguments. Takes 1 argument\");\r\n }\r\n workerScript.scriptRef.log(args.toString());\r\n },\r\n tprint : function(args) {\r\n if (workerScript.checkingRam) {return 0;}\r\n if (args === undefined || args == null) {\r\n throw makeRuntimeRejectMsg(workerScript, \"tprint() call has incorrect number of arguments. Takes 1 argument\");\r\n }\r\n var x = args.toString();\r\n if (isHTML(x)) {\r\n Player.takeDamage(1);\r\n dialogBoxCreate(\"You suddenly feel a sharp shooting pain through your body as an angry voice in your head exclaims: <br><br>\" +\r\n \"DON'T USE TPRINT() TO OUTPUT HTML ELEMENTS TO YOUR TERMINAL!!!!<br><br>\" +\r\n \"(You lost 1 HP)\");\r\n return;\r\n }\r\n post(workerScript.scriptRef.filename + \": \" + args.toString());\r\n },\r\n clearLog : function() {\r\n if (workerScript.checkingRam) {return 0;}\r\n workerScript.scriptRef.clearLog();\r\n },\r\n disableLog : function(fn) {\r\n if (workerScript.checkingRam) {return 0;}\r\n if(possibleLogs[fn]===undefined) {\r\n throw makeRuntimeRejectMsg(workerScript, \"Invalid argument to disableLog: \"+fn);\r\n }\r\n workerScript.disableLogs[fn] = true;\r\n if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.disableLog == null) {\r\n workerScript.scriptRef.log(\"Disabled logging for \" + fn);\r\n }\r\n },\r\n enableLog : function(fn) {\r\n if (workerScript.checkingRam) {return 0;}\r\n if(possibleLogs[fn]===undefined) {\r\n throw makeRuntimeRejectMsg(workerScript, \"Invalid argument to enableLog: \"+fn);\r\n }\r\n delete workerScript.disableLogs[fn];\r\n if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.enableLog == null) {\r\n workerScript.scriptRef.log(\"Enabled logging for \" + fn);\r\n }\r\n },\r\n nuke : function(ip){\r\n if (workerScript.checkingRam) {\r\n return updateStaticRam(\"nuke\", CONSTANTS.ScriptPortProgramRamCost);\r\n }\r\n updateDynamicRam(\"nuke\", CONSTANTS.ScriptPortProgramRamCost);\r\n if (ip === undefined) {\r\n throw makeRuntimeRejectMsg(workerScript, \"Program call has incorrect number of arguments. Takes 1 argument\");\r\n }\r\n var server = getServer(ip);\r\n if (server == null) {\r\n workerScript.scriptRef.log(\"Cannot call nuke(). Invalid IP or hostname passed in: \" + ip);\r\n throw makeRuntimeRejectMsg(workerScript, \"Cannot call nuke(). Invalid IP or hostname passed in: \" + ip);\r\n }\r\n if (!Player.hasProgram(Programs.NukeProgram)) {\r\n throw makeRuntimeRejectMsg(workerScript, \"You do not have the NUKE.exe virus!\");\r\n }\r\n if (server.openPortCount < server.numOpenPortsRequired) {\r\n throw makeRuntimeRejectMsg(workerScript, \"Not enough ports opened to use NUKE.exe virus\");\r\n }\r\n if (server.hasAdminRights) {\r\n if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.nuke == null) {\r\n workerScript.scriptRef.log(\"Already have root access to \" + server.hostname);\r\n }\r\n } else {\r\n server.hasAdminRights = true;\r\n if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.nuke == null) {\r\n workerScript.scriptRef.log(\"Executed NUKE.exe virus on \" + server.hostname + \" to gain root access\");\r\n }\r\n }\r\n return true;\r\n },\r\n brutessh : function(ip){\r\n if (workerScript.checkingRam) {\r\n return updateStaticRam(\"brutessh\", CONSTANTS.ScriptPortProgramRamCost);\r\n }\r\n updateDynamicRam(\"brutessh\", CONSTANTS.ScriptPortProgramRamCost);\r\n if (ip === undefined) {\r\n throw makeRuntimeRejectMsg(workerScript, \"Program call has incorrect number of arguments. Takes 1 argument\");\r\n }\r\n var server = getServer(ip);\r\n if (server == null) {\r\n workerScript.scriptRef.log(\"Cannot call brutessh(). Invalid IP or hostname passed in: \" + ip);\r\n throw makeRuntimeRejectMsg(workerScript, \"Cannot call brutessh(). Invalid IP or hostname passed in: \" + ip);\r\n }\r\n if (!Player.hasProgram(Programs.BruteSSHProgram)) {\r\n workerScript.scriptRef.log(\"You do not have the BruteSSH.exe program!\");\r\n throw makeRuntimeRejectMsg(workerScript, \"You do not have the BruteSSH.exe program!\");\r\n }\r\n if (!server.sshPortOpen) {\r\n if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.brutessh == null) {\r\n workerScript.scriptRef.log(\"Executed BruteSSH.exe on \" + server.hostname + \" to open SSH port (22)\");\r\n }\r\n server.sshPortOpen = true;\r\n ++server.openPortCount;\r\n } else {\r\n if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.brutessh == null) {\r\n workerScript.scriptRef.log(\"SSH Port (22) already opened on \" + server.hostname);\r\n }\r\n }\r\n return true;\r\n },\r\n ftpcrack : function(ip){\r\n if (workerScript.checkingRam) {\r\n return updateStaticRam(\"ftpcrack\", CONSTANTS.ScriptPortProgramRamCost);\r\n }\r\n updateDynamicRam(\"ftpcrack\", CONSTANTS.ScriptPortProgramRamCost);\r\n if (ip === undefined) {\r\n throw makeRuntimeRejectMsg(workerScript, \"Program call has incorrect number of arguments. Takes 1 argument\");\r\n }\r\n var server = getServer(ip);\r\n if (server == null) {\r\n workerScript.scriptRef.log(\"Cannot call ftpcrack(). Invalid IP or hostname passed in: \" + ip);\r\n throw makeRuntimeRejectMsg(workerScript, \"Cannot call ftpcrack(). Invalid IP or hostname passed in: \" + ip);\r\n }\r\n if (!Player.hasProgram(Programs.FTPCrackProgram)) {\r\n throw makeRuntimeRejectMsg(workerScript, \"You do not have the FTPCrack.exe program!\");\r\n }\r\n if (!server.ftpPortOpen) {\r\n if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.ftpcrack == null) {\r\n workerScript.scriptRef.log(\"Executed FTPCrack.exe on \" + server.hostname + \" to open FTP port (21)\");\r\n }\r\n server.ftpPortOpen = true;\r\n ++server.openPortCount;\r\n } else {\r\n if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.ftpcrack == null) {\r\n workerScript.scriptRef.log(\"FTP Port (21) already opened on \" + server.hostname);\r\n }\r\n }\r\n return true;\r\n },\r\n relaysmtp : function(ip){\r\n if (workerScript.checkingRam) {\r\n return updateStaticRam(\"relaysmtp\", CONSTANTS.ScriptPortProgramRamCost);\r\n }\r\n updateDynamicRam(\"relaysmtp\", CONSTANTS.ScriptPortProgramRamCost);\r\n if (ip === undefined) {\r\n throw makeRuntimeRejectMsg(workerScript, \"Program call has incorrect number of arguments. Takes 1 argument\");\r\n }\r\n var server = getServer(ip);\r\n if (server == null) {\r\n workerScript.scriptRef.log(\"Cannot call relaysmtp(). Invalid IP or hostname passed in: \" + ip);\r\n throw makeRuntimeRejectMsg(workerScript, \"Cannot call relaysmtp(). Invalid IP or hostname passed in: \" + ip);\r\n }\r\n if (!Player.hasProgram(Programs.RelaySMTPProgram)) {\r\n throw makeRuntimeRejectMsg(workerScript, \"You do not have the relaySMTP.exe program!\");\r\n }\r\n if (!server.smtpPortOpen) {\r\n if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.relaysmtp == null) {\r\n workerScript.scriptRef.log(\"Executed relaySMTP.exe on \" + server.hostname + \" to open SMTP port (25)\");\r\n }\r\n server.smtpPortOpen = true;\r\n ++server.openPortCount;\r\n } else {\r\n if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.relaysmtp == null) {\r\n workerScript.scriptRef.log(\"SMTP Port (25) already opened on \" + server.hostname);\r\n }\r\n }\r\n return true;\r\n },\r\n httpworm : function(ip){\r\n if (workerScript.checkingRam) {\r\n return updateStaticRam(\"httpworm\", CONSTANTS.ScriptPortProgramRamCost);\r\n }\r\n updateDynamicRam(\"httpworm\", CONSTANTS.ScriptPortProgramRamCost);\r\n if (ip === undefined) {\r\n throw makeRuntimeRejectMsg(workerScript, \"Program call has incorrect number of arguments. Takes 1 argument\");\r\n }\r\n var server = getServer(ip);\r\n if (server == null) {\r\n workerScript.scriptRef.log(\"Cannot call httpworm(). Invalid IP or hostname passed in: \" + ip);\r\n throw makeRuntimeRejectMsg(workerScript, \"Cannot call httpworm(). Invalid IP or hostname passed in: \" + ip);\r\n }\r\n if (!Player.hasProgram(Programs.HTTPWormProgram)) {\r\n throw makeRuntimeRejectMsg(workerScript, \"You do not have the HTTPWorm.exe program!\");\r\n }\r\n if (!server.httpPortOpen) {\r\n if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.httpworm == null) {\r\n workerScript.scriptRef.log(\"Executed HTTPWorm.exe on \" + server.hostname + \" to open HTTP port (80)\");\r\n }\r\n server.httpPortOpen = true;\r\n ++server.openPortCount;\r\n } else {\r\n if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.httpworm == null) {\r\n workerScript.scriptRef.log(\"HTTP Port (80) already opened on \" + server.hostname);\r\n }\r\n }\r\n return true;\r\n },\r\n sqlinject : function(ip){\r\n if (workerScript.checkingRam) {\r\n return updateStaticRam(\"sqlinject\", CONSTANTS.ScriptPortProgramRamCost);\r\n }\r\n updateDynamicRam(\"sqlinject\", CONSTANTS.ScriptPortProgramRamCost);\r\n if (ip === undefined) {\r\n throw makeRuntimeRejectMsg(workerScript, \"Program call has incorrect number of arguments. Takes 1 argument\");\r\n }\r\n var server = getServer(ip);\r\n if (server == null) {\r\n workerScript.scriptRef.log(\"Cannot call sqlinject(). Invalid IP or hostname passed in: \" + ip);\r\n throw makeRuntimeRejectMsg(workerScript, \"Cannot call sqlinject(). Invalid IP or hostname passed in: \" + ip);\r\n }\r\n if (!Player.hasProgram(Programs.SQLInjectProgram)) {\r\n throw makeRuntimeRejectMsg(workerScript, \"You do not have the SQLInject.exe program!\");\r\n }\r\n if (!server.sqlPortOpen) {\r\n if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.sqlinject == null) {\r\n workerScript.scriptRef.log(\"Executed SQLInject.exe on \" + server.hostname + \" to open SQL port (1433)\");\r\n }\r\n server.sqlPortOpen = true;\r\n ++server.openPortCount;\r\n } else {\r\n if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.sqlinject == null) {\r\n workerScript.scriptRef.log(\"SQL Port (1433) already opened on \" + server.hostname);\r\n }\r\n }\r\n return true;\r\n },\r\n run : function(scriptname,threads = 1){\r\n if (workerScript.checkingRam) {\r\n return updateStaticRam(\"run\", CONSTANTS.ScriptRunRamCost);\r\n }\r\n updateDynamicRam(\"run\", CONSTANTS.ScriptRunRamCost);\r\n if (scriptname === undefined) {\r\n throw makeRuntimeRejectMsg(workerScript, \"run() call has incorrect number of arguments. Usage: run(scriptname, [numThreads], [arg1], [arg2]...)\");\r\n }\r\n if (isNaN(threads) || threads < 1) {\r\n throw makeRuntimeRejectMsg(workerScript, \"Invalid argument for thread count passed into run(). Must be numeric and greater than 0\");\r\n }\r\n var argsForNewScript = [];\r\n for (var i = 2; i < arguments.length; ++i) {\r\n argsForNewScript.push(arguments[i]);\r\n }\r\n var scriptServer = getServer(workerScript.serverIp);\r\n if (scriptServer == null) {\r\n throw makeRuntimeRejectMsg(workerScript, \"Could not find server. This is a bug in the game. Report to game dev\");\r\n }\r\n\r\n return runScriptFromScript(scriptServer, scriptname, argsForNewScript, workerScript, threads);\r\n },\r\n exec : function(scriptname,ip,threads = 1) {\r\n if (workerScript.checkingRam) {\r\n return updateStaticRam(\"exec\", CONSTANTS.ScriptExecRamCost);\r\n }\r\n updateDynamicRam(\"exec\", CONSTANTS.ScriptExecRamCost);\r\n if (scriptname === undefined || ip === undefined) {\r\n throw makeRuntimeRejectMsg(workerScript, \"exec() call has incorrect number of arguments. Usage: exec(scriptname, server, [numThreads], [arg1], [arg2]...)\");\r\n }\r\n if (isNaN(threads) || threads < 1) {\r\n throw makeRuntimeRejectMsg(workerScript, \"Invalid argument for thread count passed into exec(). Must be numeric and greater than 0\");\r\n }\r\n var argsForNewScript = [];\r\n for (var i = 3; i < arguments.length; ++i) {\r\n argsForNewScript.push(arguments[i]);\r\n }\r\n var server = getServer(ip);\r\n if (server == null) {\r\n throw makeRuntimeRejectMsg(workerScript, \"Invalid hostname/ip passed into exec() command: \" + ip);\r\n }\r\n return runScriptFromScript(server, scriptname, argsForNewScript, workerScript, threads);\r\n },\r\n spawn : function(scriptname, threads) {\r\n if (workerScript.checkingRam) {\r\n return updateStaticRam(\"spawn\", CONSTANTS.ScriptSpawnRamCost);\r\n }\r\n updateDynamicRam(\"spawn\", CONSTANTS.ScriptSpawnRamCost);\r\n if (scriptname == null || threads == null) {\r\n throw makeRuntimeRejectMsg(workerScript, \"Invalid scriptname or numThreads argument passed to spawn()\");\r\n }\r\n setTimeout(()=>{\r\n NetscriptFunctions(workerScript).run.apply(this, arguments);\r\n }, 20000);\r\n if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.spawn == null) {\r\n workerScript.scriptRef.log(\"spawn() will execute \" + scriptname + \" in 20 seconds\");\r\n }\r\n NetscriptFunctions(workerScript).exit();\r\n },\r\n kill : function(filename,ip) {\r\n if (workerScript.checkingRam) {\r\n return updateStaticRam(\"kill\", CONSTANTS.ScriptKillRamCost);\r\n }\r\n updateDynamicRam(\"kill\", CONSTANTS.ScriptKillRamCost);\r\n if (filename === undefined || ip === undefined) {\r\n throw makeRuntimeRejectMsg(workerScript, \"kill() call has incorrect number of arguments. Usage: kill(scriptname, server, [arg1], [arg2]...)\");\r\n }\r\n var server = getServer(ip);\r\n if (server == null) {\r\n workerScript.scriptRef.log(\"kill() failed. Invalid IP or hostname passed in: \" + ip);\r\n throw makeRuntimeRejectMsg(workerScript, \"kill() failed. Invalid IP or hostname passed in: \" + ip);\r\n }\r\n var argsForKillTarget = [];\r\n for (var i = 2; i < arguments.length; ++i) {\r\n argsForKillTarget.push(arguments[i]);\r\n }\r\n var runningScriptObj = findRunningScript(filename, argsForKillTarget, server);\r\n if (runningScriptObj == null) {\r\n workerScript.scriptRef.log(\"kill() failed. No such script \"+ filename + \" on \" + server.hostname + \" with args: \" + printArray(argsForKillTarget));\r\n return false;\r\n }\r\n var res = killWorkerScript(runningScriptObj, server.ip);\r\n if (res) {\r\n if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.kill == null) {\r\n workerScript.scriptRef.log(\"Killing \" + filename + \" on \" + server.hostname + \" with args: \" + printArray(argsForKillTarget) + \". May take up to a few minutes for the scripts to die...\");\r\n }\r\n return true;\r\n } else {\r\n if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.kill == null) {\r\n workerScript.scriptRef.log(\"kill() failed. No such script \"+ filename + \" on \" + server.hostname + \" with args: \" + printArray(argsForKillTarget));\r\n }\r\n return false;\r\n }\r\n },\r\n killall : function(ip=workerScript.serverIp){\r\n if (workerScript.checkingRam) {\r\n return updateStaticRam(\"killall\", CONSTANTS.ScriptKillRamCost);\r\n }\r\n updateDynamicRam(\"killall\", CONSTANTS.ScriptKillRamCost);\r\n if (ip === undefined) {\r\n throw makeRuntimeRejectMsg(workerScript, \"killall() call has incorrect number of arguments. Takes 1 argument\");\r\n }\r\n var server = getServer(ip);\r\n if (server == null) {\r\n workerScript.scriptRef.log(\"killall() failed. Invalid IP or hostname passed in: \" + ip);\r\n throw makeRuntimeRejectMsg(workerScript, \"killall() failed. Invalid IP or hostname passed in: \" + ip);\r\n }\r\n var scriptsRunning = (server.runningScripts.length > 0);\r\n for (var i = server.runningScripts.length-1; i >= 0; --i) {\r\n killWorkerScript(server.runningScripts[i], server.ip);\r\n }\r\n if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.killall == null) {\r\n workerScript.scriptRef.log(\"killall(): Killing all scripts on \" + server.hostname + \". May take a few minutes for the scripts to die\");\r\n }\r\n return scriptsRunning;\r\n },\r\n exit : function() {\r\n if (workerScript.checkingRam) {\r\n return updateStaticRam(\"exit\", CONSTANTS.ScriptKillRamCost);\r\n }\r\n updateDynamicRam(\"exit\", CONSTANTS.ScriptKillRamCost);\r\n var server = getServer(workerScript.serverIp);\r\n if (server == null) {\r\n throw makeRuntimeRejectMsg(workerScript, \"Error getting Server for this script in exit(). This is a bug please contact game dev\");\r\n }\r\n if (killWorkerScript(workerScript.scriptRef, server.ip)) {\r\n workerScript.scriptRef.log(\"Exiting...\");\r\n } else {\r\n workerScript.scriptRef.log(\"Exit failed(). This is a bug please contact game developer\");\r\n }\r\n },\r\n scp : function(scriptname, ip1, ip2) {\r\n if (workerScript.checkingRam) {\r\n return updateStaticRam(\"scp\", CONSTANTS.ScriptScpRamCost);\r\n }\r\n updateDynamicRam(\"scp\", CONSTANTS.ScriptScpRamCost);\r\n if (arguments.length !== 2 && arguments.length !== 3) {\r\n throw makeRuntimeRejectMsg(workerScript, \"ERROR: scp() call has incorrect number of arguments. Takes 2 or 3 arguments\");\r\n }\r\n if (scriptname && scriptname.constructor === Array) {\r\n //Recursively call scp on all elements of array\r\n var res = false;\r\n scriptname.forEach(function(script) {\r\n if (NetscriptFunctions(workerScript).scp(script, ip1, ip2)) {\r\n res = true;\r\n };\r\n });\r\n return res;\r\n }\r\n if (!scriptname.endsWith(\".lit\") && !isScriptFilename(scriptname) &&\r\n !scriptname.endsWith(\"txt\")) {\r\n throw makeRuntimeRejectMsg(workerScript, \"ERROR: scp() does not work with this file type. It only works for .script, .lit, and .txt files\");\r\n }\r\n\r\n var destServer, currServ;\r\n\r\n if (arguments.length === 3) { //scriptname, source, destination\r\n if (scriptname === undefined || ip1 === undefined || ip2 === undefined) {\r\n throw makeRuntimeRejectMsg(workerScript, \"ERROR: scp() call has incorrect number of arguments. Takes 2 or 3 arguments\");\r\n }\r\n destServer = getServer(ip2);\r\n if (destServer == null) {\r\n throw makeRuntimeRejectMsg(workerScript, \"ERROR: Invalid hostname/ip passed into scp() command: \" + ip);\r\n }\r\n\r\n currServ = getServer(ip1);\r\n if (currServ == null) {\r\n throw makeRuntimeRejectMsg(workerScript, \"Could not find server ip for this script. This is a bug please contact game developer\");\r\n }\r\n } else if (arguments.length === 2) { //scriptname, destination\r\n if (scriptname === undefined || ip1 === undefined) {\r\n throw makeRuntimeRejectMsg(workerScript, \"ERROR: scp() call has incorrect number of arguments. Takes 2 or 3 arguments\");\r\n }\r\n destServer = getServer(ip1);\r\n if (destServer == null) {\r\n throw makeRuntimeRejectMsg(workerScript, \"ERROR: Invalid hostname/ip passed into scp() command: \" + ip);\r\n }\r\n\r\n currServ = getServer(workerScript.serverIp);\r\n if (currServ == null) {\r\n throw makeRuntimeRejectMsg(workerScript, \"Could not find server ip for this script. This is a bug please contact game developer\");\r\n }\r\n }\r\n\r\n //Scp for lit files\r\n if (scriptname.endsWith(\".lit\")) {\r\n var found = false;\r\n for (var i = 0; i < currServ.messages.length; ++i) {\r\n if (!(currServ.messages[i] instanceof Message) && currServ.messages[i] == scriptname) {\r\n found = true;\r\n break;\r\n }\r\n }\r\n\r\n if (!found) {\r\n workerScript.scriptRef.log(scriptname + \" does not exist. scp() failed\");\r\n return false;\r\n }\r\n\r\n for (var i = 0; i < destServer.messages.length; ++i) {\r\n if (destServer.messages[i] === scriptname) {\r\n if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.scp == null) {\r\n workerScript.scriptRef.log(scriptname + \" copied over to \" + destServer.hostname);\r\n }\r\n return true; //Already exists\r\n }\r\n }\r\n destServer.messages.push(scriptname);\r\n if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.scp == null) {\r\n workerScript.scriptRef.log(scriptname + \" copied over to \" + destServer.hostname);\r\n }\r\n return true;\r\n }\r\n\r\n //Scp for text files\r\n if (scriptname.endsWith(\".txt\")) {\r\n var found = false, txtFile;\r\n for (var i = 0; i < currServ.textFiles.length; ++i) {\r\n if (currServ.textFiles[i].fn === scriptname) {\r\n found = true;\r\n txtFile = currServ.textFiles[i];\r\n break;\r\n }\r\n }\r\n\r\n if (!found) {\r\n workerScript.scriptRef.log(scriptname + \" does not exist. scp() failed\");\r\n return false;\r\n }\r\n\r\n for (var i = 0; i < destServer.textFiles.length; ++i) {\r\n if (destServer.textFiles[i].fn === scriptname) {\r\n //Overwrite\r\n destServer.textFiles[i].text = txtFile.text;\r\n if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.scp == null) {\r\n workerScript.scriptRef.log(scriptname + \" copied over to \" + destServer.hostname);\r\n }\r\n return true;\r\n }\r\n }\r\n var newFile = new TextFile(txtFile.fn, txtFile.text);\r\n destServer.textFiles.push(newFile);\r\n if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.scp == null) {\r\n workerScript.scriptRef.log(scriptname + \" copied over to \" + destServer.hostname);\r\n }\r\n return true;\r\n }\r\n\r\n //Scp for script files\r\n var sourceScript = null;\r\n for (var i = 0; i < currServ.scripts.length; ++i) {\r\n if (scriptname == currServ.scripts[i].filename) {\r\n sourceScript = currServ.scripts[i];\r\n break;\r\n }\r\n }\r\n if (sourceScript == null) {\r\n workerScript.scriptRef.log(scriptname + \" does not exist. scp() failed\");\r\n return false;\r\n }\r\n\r\n //Overwrite script if it already exists\r\n for (var i = 0; i < destServer.scripts.length; ++i) {\r\n if (scriptname == destServer.scripts[i].filename) {\r\n if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.scp == null) {\r\n workerScript.scriptRef.log(\"WARNING: \" + scriptname + \" already exists on \" + destServer.hostname + \" and it will be overwritten.\");\r\n workerScript.scriptRef.log(scriptname + \" overwritten on \" + destServer.hostname);\r\n }\r\n var oldScript = destServer.scripts[i];\r\n oldScript.code = sourceScript.code;\r\n oldScript.ramUsage = sourceScript.ramUsage;\r\n return true;\r\n }\r\n }\r\n\r\n //Create new script if it does not already exist\r\n var newScript = new Script();\r\n newScript.filename = scriptname;\r\n newScript.code = sourceScript.code;\r\n newScript.ramUsage = sourceScript.ramUsage;\r\n newScript.server = destServer.ip;\r\n destServer.scripts.push(newScript);\r\n if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.scp == null) {\r\n workerScript.scriptRef.log(scriptname + \" copied over to \" + destServer.hostname);\r\n }\r\n return true;\r\n },\r\n ls : function(ip, grep) {\r\n if (workerScript.checkingRam) {\r\n return updateStaticRam(\"ls\", CONSTANTS.ScriptScanRamCost);\r\n }\r\n updateDynamicRam(\"ls\", CONSTANTS.ScriptScanRamCost);\r\n if (ip === undefined) {\r\n throw makeRuntimeRejectMsg(workerScript, \"ls() failed because of invalid arguments. Usage: ls(ip/hostname, [grep filter])\");\r\n }\r\n var server = getServer(ip);\r\n if (server == null) {\r\n workerScript.scriptRef.log(\"ls() failed. Invalid IP or hostname passed in: \" + ip);\r\n throw makeRuntimeRejectMsg(workerScript, \"ls() failed. Invalid IP or hostname passed in: \" + ip);\r\n }\r\n\r\n //Get the grep filter, if one exists\r\n var filter = false;\r\n if (arguments.length >= 2) {\r\n filter = grep.toString();\r\n }\r\n\r\n var allFiles = [];\r\n for (var i = 0; i < server.programs.length; i++) {\r\n if (filter) {\r\n if (server.programs[i].includes(filter)) {\r\n allFiles.push(server.programs[i]);\r\n }\r\n } else {\r\n allFiles.push(server.programs[i]);\r\n }\r\n }\r\n for (var i = 0; i < server.scripts.length; i++) {\r\n if (filter) {\r\n if (server.scripts[i].filename.includes(filter)) {\r\n allFiles.push(server.scripts[i].filename);\r\n }\r\n } else {\r\n allFiles.push(server.scripts[i].filename);\r\n }\r\n\r\n }\r\n for (var i = 0; i < server.messages.length; i++) {\r\n if (filter) {\r\n if (server.messages[i] instanceof Message) {\r\n if (server.messages[i].filename.includes(filter)) {\r\n allFiles.push(server.messages[i].filename);\r\n }\r\n } else if (server.messages[i].includes(filter)) {\r\n allFiles.push(server.messages[i]);\r\n }\r\n } else {\r\n if (server.messages[i] instanceof Message) {\r\n allFiles.push(server.messages[i].filename);\r\n } else {\r\n allFiles.push(server.messages[i]);\r\n }\r\n }\r\n }\r\n\r\n for (var i = 0; i < server.textFiles.length; i++) {\r\n if (filter) {\r\n if (server.textFiles[i].fn.includes(filter)) {\r\n allFiles.push(server.textFiles[i].fn);\r\n }\r\n } else {\r\n allFiles.push(server.textFiles[i].fn);\r\n }\r\n }\r\n\r\n //Sort the files alphabetically then print each\r\n allFiles.sort();\r\n return allFiles;\r\n },\r\n hasRootAccess : function(ip) {\r\n if (workerScript.checkingRam) {\r\n return updateStaticRam(\"hasRootAccess\", CONSTANTS.ScriptHasRootAccessRamCost);\r\n }\r\n updateDynamicRam(\"hasRootAccess\", CONSTANTS.ScriptHasRootAccessRamCost);\r\n if (ip===undefined){\r\n throw makeRuntimeRejectMsg(workerScript, \"hasRootAccess() call has incorrect number of arguments. Takes 1 argument\");\r\n }\r\n var server = getServer(ip);\r\n if (server == null){\r\n workerScript.scriptRef.log(\"hasRootAccess() failed. Invalid IP or hostname passed in: \" + ip);\r\n throw makeRuntimeRejectMsg(workerScript, \"hasRootAccess() failed. Invalid IP or hostname passed in: \" + ip);\r\n }\r\n return server.hasAdminRights;\r\n },\r\n getIp : function() {\r\n if (workerScript.checkingRam) {\r\n return updateStaticRam(\"getIp\", CONSTANTS.ScriptGetHostnameRamCost);\r\n }\r\n updateDynamicRam(\"getIp\", CONSTANTS.ScriptGetHostnameRamCost);\r\n var scriptServer = getServer(workerScript.serverIp);\r\n if (scriptServer == null) {\r\n throw makeRuntimeRejectMsg(workerScript, \"Could not find server. This is a bug in the game. Report to game dev\");\r\n }\r\n return scriptServer.ip;\r\n },\r\n getHostname : function(){\r\n if (workerScript.checkingRam) {\r\n return updateStaticRam(\"getHostname\", CONSTANTS.ScriptGetHostnameRamCost);\r\n }\r\n updateDynamicRam(\"getHostname\", CONSTANTS.ScriptGetHostnameRamCost);\r\n var scriptServer = getServer(workerScript.serverIp);\r\n if (scriptServer == null) {\r\n throw makeRuntimeRejectMsg(workerScript, \"Could not find server. This is a bug in the game. Report to game dev\");\r\n }\r\n return scriptServer.hostname;\r\n },\r\n getHackingLevel : function(){\r\n if (workerScript.checkingRam) {\r\n return updateStaticRam(\"getHackingLevel\", CONSTANTS.ScriptGetHackingLevelRamCost);\r\n }\r\n updateDynamicRam(\"getHackingLevel\", CONSTANTS.ScriptGetHackingLevelRamCost);\r\n Player.updateSkillLevels();\r\n if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.getHackingLevel == null) {\r\n workerScript.scriptRef.log(\"getHackingLevel() returned \" + Player.hacking_skill);\r\n }\r\n return Player.hacking_skill;\r\n },\r\n getHackingMultipliers : function() {\r\n if (workerScript.checkingRam) {\r\n return updateStaticRam(\"getHackingMultipliers\", CONSTANTS.ScriptGetMultipliersRamCost);\r\n }\r\n updateDynamicRam(\"getHackingMultipliers\", CONSTANTS.ScriptGetMultipliersRamCost);\r\n return {\r\n chance: Player.hacking_chance_mult,\r\n speed: Player.hacking_speed_mult,\r\n money: Player.hacking_money_mult,\r\n growth: Player.hacking_grow_mult,\r\n };\r\n },\r\n getHacknetMultipliers : function() {\r\n if (workerScript.checkingRam) {\r\n return updateStaticRam(\"getHacknetMultipliers\", CONSTANTS.ScriptGetMultipliersRamCost);\r\n }\r\n updateDynamicRam(\"getHacknetMultipliers\", CONSTANTS.ScriptGetMultipliersRamCost);\r\n return {\r\n production: Player.hacknet_node_money_mult,\r\n purchaseCost: Player.hacknet_node_purchase_cost_mult,\r\n ramCost: Player.hacknet_node_ram_cost_mult,\r\n coreCost: Player.hacknet_node_core_cost_mult,\r\n levelCost: Player.hacknet_node_level_cost_mult,\r\n };\r\n },\r\n getBitNodeMultipliers: function() {\r\n if (workerScript.checkingRam) {\r\n return updateStaticRam(\"getBitNodeMultipliers\", CONSTANTS.ScriptGetMultipliersRamCost);\r\n }\r\n updateDynamicRam(\"getBitNodeMultipliers\", CONSTANTS.ScriptGetMultipliersRamCost);\r\n if (!hasAISF) {\r\n throw makeRuntimeRejectMsg(workerScript, \"Cannot run getBitNodeMultipliers(). It requires Source-File 5 to run.\");\r\n }\r\n let copy = Object.assign({}, BitNodeMultipliers);\r\n return copy;\r\n },\r\n getServerMoneyAvailable : function(ip){\r\n if (workerScript.checkingRam) {\r\n return updateStaticRam(\"getServerMoneyAvailable\", CONSTANTS.ScriptGetServerRamCost);\r\n }\r\n updateDynamicRam(\"getServerMoneyAvailable\", CONSTANTS.ScriptGetServerRamCost);\r\n var server = getServer(ip);\r\n if (server == null) {\r\n workerScript.scriptRef.log(\"getServerMoneyAvailable() failed. Invalid IP or hostname passed in: \" + ip);\r\n throw makeRuntimeRejectMsg(workerScript, \"getServerMoneyAvailable() failed. Invalid IP or hostname passed in: \" + ip);\r\n }\r\n if (server.hostname == \"home\") {\r\n //Return player's money\r\n if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.getServerMoneyAvailable == null) {\r\n workerScript.scriptRef.log(\"getServerMoneyAvailable('home') returned player's money: $\" + formatNumber(Player.money.toNumber(), 2));\r\n }\r\n return Player.money.toNumber();\r\n }\r\n if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.getServerMoneyAvailable == null) {\r\n workerScript.scriptRef.log(\"getServerMoneyAvailable() returned \" + formatNumber(server.moneyAvailable, 2) + \" for \" + server.hostname);\r\n }\r\n return server.moneyAvailable;\r\n },\r\n getServerSecurityLevel : function(ip){\r\n if (workerScript.checkingRam) {\r\n return updateStaticRam(\"getServerSecurityLevel\", CONSTANTS.ScriptGetServerRamCost);\r\n }\r\n updateDynamicRam(\"getServerSecurityLevel\", CONSTANTS.ScriptGetServerRamCost);\r\n var server = getServer(ip);\r\n if (server == null) {\r\n workerScript.scriptRef.log(\"getServerSecurityLevel() failed. Invalid IP or hostname passed in: \" + ip);\r\n throw makeRuntimeRejectMsg(workerScript, \"getServerSecurityLevel() failed. Invalid IP or hostname passed in: \" + ip);\r\n }\r\n if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.getServerSecurityLevel == null) {\r\n workerScript.scriptRef.log(\"getServerSecurityLevel() returned \" + formatNumber(server.hackDifficulty, 3) + \" for \" + server.hostname);\r\n }\r\n return server.hackDifficulty;\r\n },\r\n getServerBaseSecurityLevel : function(ip){\r\n if (workerScript.checkingRam) {\r\n return updateStaticRam(\"getServerBaseSecurityLevel\", CONSTANTS.ScriptGetServerRamCost);\r\n }\r\n updateDynamicRam(\"getServerBaseSecurityLevel\", CONSTANTS.ScriptGetServerRamCost);\r\n var server = getServer(ip);\r\n if (server == null) {\r\n workerScript.scriptRef.log(\"getServerBaseSecurityLevel() failed. Invalid IP or hostname passed in: \" + ip);\r\n throw makeRuntimeRejectMsg(workerScript, \"getServerBaseSecurityLevel() failed. Invalid IP or hostname passed in: \" + ip);\r\n }\r\n if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.getServerBaseSecurityLevel == null) {\r\n workerScript.scriptRef.log(\"getServerBaseSecurityLevel() returned \" + formatNumber(server.baseDifficulty, 3) + \" for \" + server.hostname);\r\n }\r\n return server.baseDifficulty;\r\n },\r\n getServerMinSecurityLevel : function(ip) {\r\n if (workerScript.checkingRam) {\r\n return updateStaticRam(\"getServerMinSecurityLevel\", CONSTANTS.ScriptGetServerRamCost);\r\n }\r\n updateDynamicRam(\"getServerMinSecurityLevel\", CONSTANTS.ScriptGetServerRamCost);\r\n var server = getServer(ip);\r\n if (server == null) {\r\n workerScript.scriptRef.log(\"getServerMinSecurityLevel() failed. Invalid IP or hostname passed in: \" + ip);\r\n throw makeRuntimeRejectMsg(workerScript, \"getServerMinSecurityLevel() failed. Invalid IP or hostname passed in: \" + ip);\r\n }\r\n if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.getServerMinSecurityLevel == null) {\r\n workerScript.scriptRef.log(\"getServerMinSecurityLevel() returned \" + formatNumber(server.minDifficulty, 3) + \" for \" + server.hostname);\r\n }\r\n return server.minDifficulty;\r\n },\r\n getServerRequiredHackingLevel : function(ip) {\r\n if (workerScript.checkingRam) {\r\n return updateStaticRam(\"getServerRequiredHackingLevel\", CONSTANTS.ScriptGetServerRamCost);\r\n }\r\n updateDynamicRam(\"getServerRequiredHackingLevel\", CONSTANTS.ScriptGetServerRamCost);\r\n var server = getServer(ip);\r\n if (server == null) {\r\n workerScript.scriptRef.log(\"getServerRequiredHackingLevel() failed. Invalid IP or hostname passed in: \" + ip);\r\n throw makeRuntimeRejectMsg(workerScript, \"getServerRequiredHackingLevel() failed. Invalid IP or hostname passed in: \" + ip);\r\n }\r\n if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.getServerRequiredHackingLevel == null) {\r\n workerScript.scriptRef.log(\"getServerRequiredHackingLevel returned \" + formatNumber(server.requiredHackingSkill, 0) + \" for \" + server.hostname);\r\n }\r\n return server.requiredHackingSkill;\r\n },\r\n getServerMaxMoney : function(ip){\r\n if (workerScript.checkingRam) {\r\n return updateStaticRam(\"getServerMaxMoney\", CONSTANTS.ScriptGetServerRamCost);\r\n }\r\n updateDynamicRam(\"getServerMaxMoney\", CONSTANTS.ScriptGetServerRamCost);\r\n var server = getServer(ip);\r\n if (server == null) {\r\n workerScript.scriptRef.log(\"getServerMaxMoney() failed. Invalid IP or hostname passed in: \" + ip);\r\n throw makeRuntimeRejectMsg(workerScript, \"getServerMaxMoney() failed. Invalid IP or hostname passed in: \" + ip);\r\n }\r\n if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.getServerMaxMoney == null) {\r\n workerScript.scriptRef.log(\"getServerMaxMoney() returned \" + formatNumber(server.moneyMax, 0) + \" for \" + server.hostname);\r\n }\r\n return server.moneyMax;\r\n },\r\n getServerGrowth : function(ip) {\r\n if (workerScript.checkingRam) {\r\n return updateStaticRam(\"getServerGrowth\", CONSTANTS.ScriptGetServerRamCost);\r\n }\r\n updateDynamicRam(\"getServerGrowth\", CONSTANTS.ScriptGetServerRamCost);\r\n var server = getServer(ip);\r\n if (server == null) {\r\n workerScript.scriptRef.log(\"getServerGrowth() failed. Invalid IP or hostname passed in: \" + ip);\r\n throw makeRuntimeRejectMsg(workerScript, \"getServerGrowth() failed. Invalid IP or hostname passed in: \" + ip);\r\n }\r\n if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.getServerGrowth == null) {\r\n workerScript.scriptRef.log(\"getServerGrowth() returned \" + formatNumber(server.serverGrowth, 0) + \" for \" + server.hostname);\r\n }\r\n return server.serverGrowth;\r\n },\r\n getServerNumPortsRequired : function(ip) {\r\n if (workerScript.checkingRam) {\r\n return updateStaticRam(\"getServerNumPortsRequired\", CONSTANTS.ScriptGetServerRamCost);\r\n }\r\n updateDynamicRam(\"getServerNumPortsRequired\", CONSTANTS.ScriptGetServerRamCost);\r\n var server = getServer(ip);\r\n if (server == null) {\r\n workerScript.scriptRef.log(\"getServerNumPortsRequired() failed. Invalid IP or hostname passed in: \" + ip);\r\n throw makeRuntimeRejectMsg(workerScript, \"getServerNumPortsRequired() failed. Invalid IP or hostname passed in: \" + ip);\r\n }\r\n if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.getServerNumPortsRequired == null) {\r\n workerScript.scriptRef.log(\"getServerNumPortsRequired() returned \" + formatNumber(server.numOpenPortsRequired, 0) + \" for \" + server.hostname);\r\n }\r\n return server.numOpenPortsRequired;\r\n },\r\n getServerRam : function(ip) {\r\n if (workerScript.checkingRam) {\r\n return updateStaticRam(\"getServerRam\", CONSTANTS.ScriptGetServerRamCost);\r\n }\r\n updateDynamicRam(\"getServerRam\", CONSTANTS.ScriptGetServerRamCost);\r\n var server = getServer(ip);\r\n if (server == null) {\r\n workerScript.scriptRef.log(\"getServerRam() failed. Invalid IP or hostname passed in: \" + ip);\r\n throw makeRuntimeRejectMsg(workerScript, \"getServerRam() failed. Invalid IP or hostname passed in: \" + ip);\r\n }\r\n if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.getServerRam == null) {\r\n workerScript.scriptRef.log(\"getServerRam() returned [\" + formatNumber(server.maxRam, 2) + \"GB, \" + formatNumber(server.ramUsed, 2) + \"GB]\");\r\n }\r\n return [server.maxRam, server.ramUsed];\r\n },\r\n serverExists : function(ip) {\r\n if (workerScript.checkingRam) {\r\n return updateStaticRam(\"serverExists\", CONSTANTS.ScriptGetServerRamCost);\r\n }\r\n updateDynamicRam(\"serverExists\", CONSTANTS.ScriptGetServerRamCost);\r\n return (getServer(ip) !== null);\r\n },\r\n fileExists : function(filename,ip=workerScript.serverIp) {\r\n if (workerScript.checkingRam) {\r\n return updateStaticRam(\"fileExists\", CONSTANTS.ScriptFileExistsRamCost);\r\n }\r\n updateDynamicRam(\"fileExists\", CONSTANTS.ScriptFileExistsRamCost);\r\n if (filename === undefined) {\r\n throw makeRuntimeRejectMsg(workerScript, \"fileExists() call has incorrect number of arguments. Usage: fileExists(scriptname, [server])\");\r\n }\r\n var server = getServer(ip);\r\n if (server == null) {\r\n workerScript.scriptRef.log(\"fileExists() failed. Invalid IP or hostname passed in: \" + ip);\r\n throw makeRuntimeRejectMsg(workerScript, \"fileExists() failed. Invalid IP or hostname passed in: \" + ip);\r\n }\r\n for (var i = 0; i < server.scripts.length; ++i) {\r\n if (filename == server.scripts[i].filename) {\r\n return true;\r\n }\r\n }\r\n for (var i = 0; i < server.programs.length; ++i) {\r\n if (filename.toLowerCase() == server.programs[i].toLowerCase()) {\r\n return true;\r\n }\r\n }\r\n for (var i = 0; i < server.messages.length; ++i) {\r\n if (!(server.messages[i] instanceof Message) &&\r\n filename.toLowerCase() === server.messages[i]) {\r\n return true;\r\n }\r\n }\r\n var txtFile = getTextFile(filename, server);\r\n if (txtFile != null) {\r\n return true;\r\n }\r\n return false;\r\n },\r\n isRunning : function(filename,ip) {\r\n if (workerScript.checkingRam) {\r\n return updateStaticRam(\"isRunning\", CONSTANTS.ScriptIsRunningRamCost);\r\n }\r\n updateDynamicRam(\"isRunning\", CONSTANTS.ScriptIsRunningRamCost);\r\n if (filename === undefined || ip === undefined) {\r\n throw makeRuntimeRejectMsg(workerScript, \"isRunning() call has incorrect number of arguments. Usage: isRunning(scriptname, server, [arg1], [arg2]...)\");\r\n }\r\n var server = getServer(ip);\r\n if (server == null) {\r\n workerScript.scriptRef.log(\"isRunning() failed. Invalid IP or hostname passed in: \" + ip);\r\n throw makeRuntimeRejectMsg(workerScript, \"isRunning() failed. Invalid IP or hostname passed in: \" + ip);\r\n }\r\n var argsForTargetScript = [];\r\n for (var i = 2; i < arguments.length; ++i) {\r\n argsForTargetScript.push(arguments[i]);\r\n }\r\n return (findRunningScript(filename, argsForTargetScript, server) != null);\r\n },\r\n getNextHacknetNodeCost : function() {\r\n if (workerScript.checkingRam) {\r\n return updateStaticRam(\"getNextHacknetNodeCost\", CONSTANTS.ScriptPurchaseHacknetRamCost);\r\n }\r\n updateDynamicRam(\"getNextHacknetNodeCost\", CONSTANTS.ScriptPurchaseHacknetRamCost);\r\n return getCostOfNextHacknetNode();\r\n },\r\n\r\n purchaseHacknetNode : function() {\r\n if (workerScript.checkingRam) {\r\n return updateStaticRam(\"purchaseHacknetNode\", CONSTANTS.ScriptPurchaseHacknetRamCost);\r\n }\r\n updateDynamicRam(\"purchaseHacknetNode\", CONSTANTS.ScriptPurchaseHacknetRamCost);\r\n return purchaseHacknet();\r\n },\r\n getStockPrice : function(symbol) {\r\n if (workerScript.checkingRam) {\r\n return updateStaticRam(\"getStockPrice\", CONSTANTS.ScriptGetStockRamCost);\r\n }\r\n updateDynamicRam(\"getStockPrice\", CONSTANTS.ScriptGetStockRamCost);\r\n if (!Player.hasTixApiAccess) {\r\n throw makeRuntimeRejectMsg(workerScript, \"You don't have TIX API Access! Cannot use getStockPrice()\");\r\n }\r\n var stock = SymbolToStockMap[symbol];\r\n if (stock == null) {\r\n throw makeRuntimeRejectMsg(workerScript, \"Invalid stock symbol passed into getStockPrice()\");\r\n }\r\n return parseFloat(stock.price.toFixed(3));\r\n },\r\n getStockPosition : function(symbol) {\r\n if (workerScript.checkingRam) {\r\n return updateStaticRam(\"getStockPosition\", CONSTANTS.ScriptGetStockRamCost);\r\n }\r\n updateDynamicRam(\"getStockPosition\", CONSTANTS.ScriptGetStockRamCost);\r\n if (!Player.hasTixApiAccess) {\r\n throw makeRuntimeRejectMsg(workerScript, \"You don't have TIX API Access! Cannot use getStockPosition()\");\r\n }\r\n var stock = SymbolToStockMap[symbol];\r\n if (stock == null) {\r\n throw makeRuntimeRejectMsg(workerScript, \"Invalid stock symbol passed into getStockPosition()\");\r\n }\r\n return [stock.playerShares, stock.playerAvgPx, stock.playerShortShares, stock.playerAvgShortPx];\r\n },\r\n buyStock : function(symbol, shares) {\r\n if (workerScript.checkingRam) {\r\n return updateStaticRam(\"buyStock\", CONSTANTS.ScriptBuySellStockRamCost);\r\n }\r\n updateDynamicRam(\"buyStock\", CONSTANTS.ScriptBuySellStockRamCost);\r\n if (!Player.hasTixApiAccess) {\r\n throw makeRuntimeRejectMsg(workerScript, \"You don't have TIX API Access! Cannot use buyStock()\");\r\n }\r\n var stock = SymbolToStockMap[symbol];\r\n if (stock == null) {\r\n throw makeRuntimeRejectMsg(workerScript, \"Invalid stock symbol passed into buyStock()\");\r\n }\r\n if (shares < 0 || isNaN(shares)) {\r\n workerScript.scriptRef.log(\"ERROR: Invalid 'shares' argument passed to buyStock()\");\r\n return 0;\r\n }\r\n shares = Math.round(shares);\r\n if (shares === 0) {return 0;}\r\n\r\n var totalPrice = stock.price * shares;\r\n if (Player.money.lt(totalPrice + CONSTANTS.StockMarketCommission)) {\r\n workerScript.scriptRef.log(\"Not enough money to purchase \" + formatNumber(shares, 0) + \" shares of \" +\r\n symbol + \". Need $\" +\r\n formatNumber(totalPrice + CONSTANTS.StockMarketCommission, 2).toString());\r\n return 0;\r\n }\r\n\r\n var origTotal = stock.playerShares * stock.playerAvgPx;\r\n Player.loseMoney(totalPrice + CONSTANTS.StockMarketCommission);\r\n var newTotal = origTotal + totalPrice;\r\n stock.playerShares += shares;\r\n stock.playerAvgPx = newTotal / stock.playerShares;\r\n if (Engine.currentPage == Engine.Page.StockMarket) {\r\n updateStockPlayerPosition(stock);\r\n }\r\n if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.buyStock == null) {\r\n workerScript.scriptRef.log(\"Bought \" + formatNumber(shares, 0) + \" shares of \" + stock.symbol + \" at $\" +\r\n formatNumber(stock.price, 2) + \" per share\");\r\n }\r\n return stock.price;\r\n },\r\n sellStock : function(symbol, shares) {\r\n if (workerScript.checkingRam) {\r\n return updateStaticRam(\"sellStock\", CONSTANTS.ScriptBuySellStockRamCost);\r\n }\r\n updateDynamicRam(\"sellStock\", CONSTANTS.ScriptBuySellStockRamCost);\r\n if (!Player.hasTixApiAccess) {\r\n throw makeRuntimeRejectMsg(workerScript, \"You don't have TIX API Access! Cannot use sellStock()\");\r\n }\r\n var stock = SymbolToStockMap[symbol];\r\n if (stock == null) {\r\n throw makeRuntimeRejectMsg(workerScript, \"Invalid stock symbol passed into sellStock()\");\r\n }\r\n if (shares < 0 || isNaN(shares)) {\r\n workerScript.scriptRef.log(\"ERROR: Invalid 'shares' argument passed to sellStock()\");\r\n return 0;\r\n }\r\n shares = Math.round(shares);\r\n if (shares > stock.playerShares) {shares = stock.playerShares;}\r\n if (shares === 0) {return 0;}\r\n var gains = stock.price * shares - CONSTANTS.StockMarketCommission;\r\n Player.gainMoney(gains);\r\n\r\n //Calculate net profit and add to script stats\r\n var netProfit = ((stock.price - stock.playerAvgPx) * shares) - CONSTANTS.StockMarketCommission;\r\n if (isNaN(netProfit)) {netProfit = 0;}\r\n workerScript.scriptRef.onlineMoneyMade += netProfit;\r\n Player.scriptProdSinceLastAug += netProfit;\r\n\r\n stock.playerShares -= shares;\r\n if (stock.playerShares == 0) {\r\n stock.playerAvgPx = 0;\r\n }\r\n if (Engine.currentPage == Engine.Page.StockMarket) {\r\n updateStockPlayerPosition(stock);\r\n }\r\n if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.sellStock == null) {\r\n workerScript.scriptRef.log(\"Sold \" + formatNumber(shares, 0) + \" shares of \" + stock.symbol + \" at $\" +\r\n formatNumber(stock.price, 2) + \" per share. Gained \" +\r\n \"$\" + formatNumber(gains, 2));\r\n }\r\n return stock.price;\r\n },\r\n shortStock(symbol, shares) {\r\n if (workerScript.checkingRam) {\r\n return updateStaticRam(\"shortStock\", CONSTANTS.ScriptBuySellStockRamCost);\r\n }\r\n updateDynamicRam(\"shortStock\", CONSTANTS.ScriptBuySellStockRamCost);\r\n if (!Player.hasTixApiAccess) {\r\n throw makeRuntimeRejectMsg(workerScript, \"You don't have TIX API Access! Cannot use shortStock()\");\r\n }\r\n if (Player.bitNodeN !== 8) {\r\n if (!(hasWallStreetSF && wallStreetSFLvl >= 2)) {\r\n throw makeRuntimeRejectMsg(workerScript, \"ERROR: Cannot use shortStock(). You must either be in BitNode-8 or you must have Level 2 of Source-File 8\");\r\n }\r\n }\r\n var stock = SymbolToStockMap[symbol];\r\n if (stock == null) {\r\n throw makeRuntimeRejectMsg(workerScript, \"ERROR: Invalid stock symbol passed into shortStock()\");\r\n }\r\n var res = shortStock(stock, shares, workerScript);\r\n return res ? stock.price : 0;\r\n },\r\n sellShort(symbol, shares) {\r\n if (workerScript.checkingRam) {\r\n return updateStaticRam(\"sellShort\", CONSTANTS.ScriptBuySellStockRamCost);\r\n }\r\n updateDynamicRam(\"sellShort\", CONSTANTS.ScriptBuySellStockRamCost);\r\n if (!Player.hasTixApiAccess) {\r\n throw makeRuntimeRejectMsg(workerScript, \"You don't have TIX API Access! Cannot use sellShort()\");\r\n }\r\n if (Player.bitNodeN !== 8) {\r\n if (!(hasWallStreetSF && wallStreetSFLvl >= 2)) {\r\n throw makeRuntimeRejectMsg(workerScript, \"ERROR: Cannot use sellShort(). You must either be in BitNode-8 or you must have Level 2 of Source-File 8\");\r\n }\r\n }\r\n var stock = SymbolToStockMap[symbol];\r\n if (stock == null) {\r\n throw makeRuntimeRejectMsg(workerScript, \"ERROR: Invalid stock symbol passed into sellShort()\");\r\n }\r\n var res = sellShort(stock, shares, workerScript);\r\n return res ? stock.price : 0;\r\n },\r\n placeOrder(symbol, shares, price, type, pos) {\r\n if (workerScript.checkingRam) {\r\n return updateStaticRam(\"placeOrder\", CONSTANTS.ScriptBuySellStockRamCost);\r\n }\r\n updateDynamicRam(\"placeOrder\", CONSTANTS.ScriptBuySellStockRamCost);\r\n if (!Player.hasTixApiAccess) {\r\n throw makeRuntimeRejectMsg(workerScript, \"You don't have TIX API Access! Cannot use placeOrder()\");\r\n }\r\n if (Player.bitNodeN !== 8) {\r\n if (!(hasWallStreetSF && wallStreetSFLvl >= 3)) {\r\n throw makeRuntimeRejectMsg(workerScript, \"ERROR: Cannot use placeOrder(). You must either be in BitNode-8 or have Level 3 of Source-File 8\");\r\n }\r\n }\r\n var stock = SymbolToStockMap[symbol];\r\n if (stock == null) {\r\n throw makeRuntimeRejectMsg(workerScript, \"ERROR: Invalid stock symbol passed into placeOrder()\");\r\n }\r\n var orderType, orderPos;\r\n type = type.toLowerCase();\r\n if (type.includes(\"limit\") && type.includes(\"buy\")) {\r\n orderType = OrderTypes.LimitBuy;\r\n } else if (type.includes(\"limit\") && type.includes(\"sell\")) {\r\n orderType = OrderTypes.LimitSell;\r\n } else if (type.includes(\"stop\") && type.includes(\"buy\")) {\r\n orderType = OrderTypes.StopBuy;\r\n } else if (type.includes(\"stop\") && type.includes(\"sell\")) {\r\n orderType = OrderTypes.StopSell;\r\n } else {\r\n throw makeRuntimeRejectMsg(workerScript, \"ERROR: Invalid Order Type passed into placeOrder()\");\r\n }\r\n\r\n pos = pos.toLowerCase();\r\n if (pos.includes(\"l\")) {\r\n orderPos = PositionTypes.Long;\r\n } else if (pos.includes('s')) {\r\n orderPos = PositionTypes.Short;\r\n } else {\r\n throw makeRuntimeRejectMsg(workerScript, \"ERROR: Invalid Position Type passed into placeOrder()\");\r\n }\r\n\r\n return placeOrder(stock, shares, price, orderType, orderPos, workerScript);\r\n },\r\n cancelOrder(symbol, shares, price, type, pos) {\r\n if (workerScript.checkingRam) {\r\n return updateStaticRam(\"cancelOrder\", CONSTANTS.ScriptBuySellStockRamCost);\r\n }\r\n updateDynamicRam(\"cancelOrder\", CONSTANTS.ScriptBuySellStockRamCost);\r\n if (!Player.hasTixApiAccess) {\r\n throw makeRuntimeRejectMsg(workerScript, \"You don't have TIX API Access! Cannot use cancelOrder()\");\r\n }\r\n if (Player.bitNodeN !== 8) {\r\n if (!(hasWallStreetSF && wallStreetSFLvl >= 3)) {\r\n throw makeRuntimeRejectMsg(workerScript, \"ERROR: Cannot use cancelOrder(). You must either be in BitNode-8 or have Level 3 of Source-File 8\");\r\n }\r\n }\r\n var stock = SymbolToStockMap[symbol];\r\n if (stock == null) {\r\n throw makeRuntimeRejectMsg(workerScript, \"ERROR: Invalid stock symbol passed into cancelOrder()\");\r\n }\r\n if (isNaN(shares) || isNaN(price)) {\r\n throw makeRuntimeRejectMsg(workerScript, \"ERROR: Invalid shares or price argument passed into cancelOrder(). Must be numeric\");\r\n }\r\n var orderType, orderPos;\r\n type = type.toLowerCase();\r\n if (type.includes(\"limit\") && type.includes(\"buy\")) {\r\n orderType = OrderTypes.LimitBuy;\r\n } else if (type.includes(\"limit\") && type.includes(\"sell\")) {\r\n orderType = OrderTypes.LimitSell;\r\n } else if (type.includes(\"stop\") && type.includes(\"buy\")) {\r\n orderType = OrderTypes.StopBuy;\r\n } else if (type.includes(\"stop\") && type.includes(\"sell\")) {\r\n orderType = OrderTypes.StopSell;\r\n } else {\r\n throw makeRuntimeRejectMsg(workerScript, \"ERROR: Invalid Order Type passed into placeOrder()\");\r\n }\r\n\r\n pos = pos.toLowerCase();\r\n if (pos.includes(\"l\")) {\r\n orderPos = PositionTypes.Long;\r\n } else if (pos.includes('s')) {\r\n orderPos = PositionTypes.Short;\r\n } else {\r\n throw makeRuntimeRejectMsg(workerScript, \"ERROR: Invalid Position Type passed into placeOrder()\");\r\n }\r\n var params = {\r\n stock: stock,\r\n shares: shares,\r\n price: price,\r\n type: orderType,\r\n pos: orderPos\r\n };\r\n return cancelOrder(params, workerScript);\r\n },\r\n purchaseServer : function(hostname, ram) {\r\n if (workerScript.checkingRam) {\r\n return updateStaticRam(\"purchaseServer\", CONSTANTS.ScriptPurchaseServerRamCost);\r\n }\r\n updateDynamicRam(\"purchaseServer\", CONSTANTS.ScriptPurchaseServerRamCost);\r\n var hostnameStr = String(hostname);\r\n hostnameStr = hostnameStr.replace(/\\s+/g, '');\r\n if (hostnameStr == \"\") {\r\n workerScript.scriptRef.log(\"ERROR: Passed empty string for hostname argument of purchaseServer()\");\r\n return \"\";\r\n }\r\n\r\n if (Player.purchasedServers.length >= CONSTANTS.PurchasedServerLimit) {\r\n workerScript.scriptRef.log(\"ERROR: You have reached the maximum limit of \" + CONSTANTS.PurchasedServerLimit +\r\n \" servers. You cannot purchase any more.\");\r\n return \"\";\r\n }\r\n\r\n ram = Math.round(ram);\r\n if (isNaN(ram) || !powerOfTwo(ram)) {\r\n workerScript.scriptRef.log(\"ERROR: purchaseServer() failed due to invalid ram argument. Must be numeric and a power of 2\");\r\n return \"\";\r\n }\r\n\r\n if (ram > CONSTANTS.PurchasedServerMaxRam) {\r\n workerScript.scriptRef.log(\"ERROR: purchasedServer() failed because specified RAM was too high. Maximum RAM on a purchased server is \" + CONSTANTS.PurchasedServerMaxRam + \"GB\");\r\n return \"\";\r\n }\r\n\r\n var cost = ram * CONSTANTS.BaseCostFor1GBOfRamServer;\r\n if (Player.money.lt(cost)) {\r\n workerScript.scriptRef.log(\"ERROR: Not enough money to purchase server. Need $\" + formatNumber(cost, 2));\r\n return \"\";\r\n }\r\n var newServ = new Server({\r\n ip: createRandomIp(),\r\n hostname: hostnameStr,\r\n organizationName: \"\",\r\n isConnectedTo: false,\r\n adminRights: true,\r\n purchasedByPlayer: true,\r\n maxRam: ram,\r\n });\r\n AddToAllServers(newServ);\r\n\r\n Player.purchasedServers.push(newServ.ip);\r\n var homeComputer = Player.getHomeComputer();\r\n homeComputer.serversOnNetwork.push(newServ.ip);\r\n newServ.serversOnNetwork.push(homeComputer.ip);\r\n Player.loseMoney(cost);\r\n if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.purchaseServer == null) {\r\n workerScript.scriptRef.log(\"Purchased new server with hostname \" + newServ.hostname + \" for $\" + formatNumber(cost, 2));\r\n }\r\n return newServ.hostname;\r\n },\r\n deleteServer : function(hostname) {\r\n if (workerScript.checkingRam) {\r\n return updateStaticRam(\"deleteServer\", CONSTANTS.ScriptPurchaseServerRamCost);\r\n }\r\n updateDynamicRam(\"deleteServer\", CONSTANTS.ScriptPurchaseServerRamCost);\r\n var hostnameStr = String(hostname);\r\n hostnameStr = hostnameStr.replace(/\\s\\s+/g, '');\r\n var server = GetServerByHostname(hostnameStr);\r\n if (server == null) {\r\n workerScript.scriptRef.log(\"ERROR: Could not find server with hostname \" + hostnameStr + \". deleteServer() failed\");\r\n return false;\r\n }\r\n\r\n if (!server.purchasedByPlayer || server.hostname === \"home\") {\r\n workerScript.scriptRef.log(\"ERROR: Server \" + server.hostname + \" is not a purchased server. \" +\r\n \"Cannot be deleted. deleteServer() failed\");\r\n return false;\r\n }\r\n\r\n var ip = server.ip;\r\n\r\n //Can't delete server you're currently connected to\r\n if (server.isConnectedTo) {\r\n workerScript.scriptRef.log(\"ERROR: deleteServer() failed because you are currently connected to the server you are trying to delete\");\r\n return false;\r\n }\r\n\r\n //A server cannot delete itself\r\n if (ip === workerScript.serverIp) {\r\n workerScript.scriptRef.log(\"ERROR: Cannot call deleteServer() on self. deleteServer() failed\");\r\n return false;\r\n }\r\n\r\n //Delete all scripts running on server\r\n if (server.runningScripts.length > 0) {\r\n workerScript.scriptRef.log(\"ERROR: Cannot delete server \" + server.hostname + \" because it still has scripts running.\");\r\n return false;\r\n }\r\n\r\n //Delete from player's purchasedServers array\r\n var found = false;\r\n for (var i = 0; i < Player.purchasedServers.length; ++i) {\r\n if (ip == Player.purchasedServers[i]) {\r\n found = true;\r\n Player.purchasedServers.splice(i, 1);\r\n break;\r\n }\r\n }\r\n\r\n if (!found) {\r\n workerScript.scriptRef.log(\"ERROR: Could not identify server \" + server.hostname +\r\n \"as a purchased server. This is likely a bug please contact game dev\");\r\n return false;\r\n }\r\n\r\n //Delete from all servers\r\n delete AllServers[ip];\r\n\r\n //Delete from home computer\r\n found = false;\r\n var homeComputer = Player.getHomeComputer();\r\n for (var i = 0; i < homeComputer.serversOnNetwork.length; ++i) {\r\n if (ip == homeComputer.serversOnNetwork[i]) {\r\n homeComputer.serversOnNetwork.splice(i, 1);\r\n if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.deleteServer == null) {\r\n workerScript.scriptRef.log(\"Deleted server \" + hostnameStr);\r\n }\r\n return true;\r\n }\r\n }\r\n //Wasn't found on home computer\r\n workerScript.scriptRef.log(\"ERROR: Could not find server \" + server.hostname +\r\n \"as a purchased server. This is likely a bug please contact game dev\");\r\n return false;\r\n },\r\n getPurchasedServers : function(hostname=true) {\r\n if (workerScript.checkingRam) {\r\n return updateStaticRam(\"getPurchasedServers\", CONSTANTS.ScriptPurchaseServerRamCost);\r\n }\r\n updateDynamicRam(\"getPurchasedServers\", CONSTANTS.ScriptPurchaseServerRamCost);\r\n var res = [];\r\n Player.purchasedServers.forEach(function(ip) {\r\n if (hostname) {\r\n var server = getServer(ip);\r\n if (server == null) {\r\n throw makeRuntimeRejectMsg(workerScript, \"ERROR: Could not find server in getPurchasedServers(). This is a bug please report to game dev\");\r\n }\r\n res.push(server.hostname);\r\n } else {\r\n res.push(ip);\r\n }\r\n });\r\n return res;\r\n },\r\n write : function(port, data=\"\", mode=\"a\") {\r\n if (workerScript.checkingRam) {\r\n return updateStaticRam(\"write\", CONSTANTS.ScriptReadWriteRamCost);\r\n }\r\n updateDynamicRam(\"write\", CONSTANTS.ScriptReadWriteRamCost);\r\n if (!isNaN(port)) { //Write to port\r\n //Port 1-10\r\n port = Math.round(port);\r\n if (port < 1 || port > CONSTANTS.NumNetscriptPorts) {\r\n throw makeRuntimeRejectMsg(workerScript, \"ERROR: Trying to write to invalid port: \" + port + \". Only ports 1-\" + CONSTANTS.NumNetscriptPorts + \" are valid.\");\r\n }\r\n var port = NetscriptPorts[port-1];\r\n if (port == null || !(port instanceof NetscriptPort)) {\r\n throw makeRuntimeRejectMsg(workerScript, \"Could not find port: \" + port + \". This is a bug contact the game developer\");\r\n }\r\n return port.write(data);\r\n } else if (isString(port)) { //Write to text file\r\n var fn = port;\r\n var server = getServer(workerScript.serverIp);\r\n if (server == null) {\r\n throw makeRuntimeRejectMsg(workerScript, \"Error getting Server for this script in write(). This is a bug please contact game dev\");\r\n }\r\n var txtFile = getTextFile(fn, server);\r\n if (txtFile == null) {\r\n txtFile = createTextFile(fn, data, server);\r\n return true;\r\n }\r\n if (mode === \"w\") {\r\n txtFile.write(data);\r\n } else {\r\n txtFile.append(data);\r\n }\r\n return true;\r\n } else {\r\n throw makeRuntimeRejectMsg(workerScript, \"Invalid argument passed in for write: \" + port);\r\n }\r\n },\r\n read : function(port) {\r\n if (workerScript.checkingRam) {\r\n return updateStaticRam(\"read\", CONSTANTS.ScriptReadWriteRamCost);\r\n }\r\n updateDynamicRam(\"read\", CONSTANTS.ScriptReadWriteRamCost);\r\n if (!isNaN(port)) { //Read from port\r\n //Port 1-10\r\n port = Math.round(port);\r\n if (port < 1 || port > CONSTANTS.NumNetscriptPorts) {\r\n throw makeRuntimeRejectMsg(workerScript, \"ERROR: Trying to read from invalid port: \" + port + \". Only ports 1-\" + CONSTANTS.NumNetscriptPorts + \" are valid.\");\r\n }\r\n var port = NetscriptPorts[port-1];\r\n if (port == null || !(port instanceof NetscriptPort)) {\r\n throw makeRuntimeRejectMsg(workerScript, \"ERROR: Could not find port: \" + port + \". This is a bug contact the game developer\");\r\n }\r\n return port.read();\r\n } else if (isString(port)) { //Read from text file\r\n var fn = port;\r\n var server = getServer(workerScript.serverIp);\r\n if (server == null) {\r\n throw makeRuntimeRejectMsg(workerScript, \"Error getting Server for this script in read(). This is a bug please contact game dev\");\r\n }\r\n var txtFile = getTextFile(fn, server);\r\n if (txtFile !== null) {\r\n return txtFile.text;\r\n } else {\r\n return \"\";\r\n }\r\n } else {\r\n throw makeRuntimeRejectMsg(workerScript, \"Invalid argument passed in for read(): \" + port);\r\n }\r\n },\r\n peek : function(port) {\r\n if (workerScript.checkingRam) {\r\n return updateStaticRam(\"peek\", CONSTANTS.ScriptReadWriteRamCost);\r\n }\r\n updateDynamicRam(\"peek\", CONSTANTS.ScriptReadWriteRamCost);\r\n if (isNaN(port)) {\r\n throw makeRuntimeRejectMsg(workerScript, \"ERROR: peek() called with invalid argument. Must be a port number between 1 and \" + CONSTANTS.NumNetscriptPorts);\r\n }\r\n port = Math.round(port);\r\n if (port < 1 || port > CONSTANTS.NumNetscriptPorts) {\r\n throw makeRuntimeRejectMsg(workerScript, \"ERROR: peek() called with invalid argument. Must be a port number between 1 and \" + CONSTANTS.NumNetscriptPorts);\r\n }\r\n var port = NetscriptPorts[port-1];\r\n if (port == null || !(port instanceof NetscriptPort)) {\r\n throw makeRuntimeRejectMsg(workerScript, \"ERROR: Could not find port: \" + port + \". This is a bug contact the game developer\");\r\n }\r\n return port.peek();\r\n },\r\n clear : function(port) {\r\n if (workerScript.checkingRam) {\r\n return updateStaticRam(\"clear\", CONSTANTS.ScriptReadWriteRamCost);\r\n }\r\n updateDynamicRam(\"clear\", CONSTANTS.ScriptReadWriteRamCost);\r\n if (!isNaN(port)) { //Clear port\r\n port = Math.round(port);\r\n if (port < 1 || port > CONSTANTS.NumNetscriptPorts) {\r\n throw makeRuntimeRejectMsg(workerScript, \"ERROR: Trying to clear invalid port: \" + port + \". Only ports 1-\" + CONSTANTS.NumNetscriptPorts + \" are valid\");\r\n }\r\n var port = NetscriptPorts[port-1];\r\n if (port == null || !(port instanceof NetscriptPort)) {\r\n throw makeRuntimeRejectMsg(workerScript, \"ERROR: Could not find port: \" + port + \". This is a bug contact the game developer\");\r\n }\r\n return port.clear();\r\n } else if (isString(port)) { //Clear text file\r\n var fn = port;\r\n var server = getServer(workerScript.serverIp);\r\n if (server == null) {\r\n throw makeRuntimeRejectMsg(workerScript, \"Error getting Server for this script in clear(). This is a bug please contact game dev\");\r\n }\r\n var txtFile = getTextFile(fn, server);\r\n if (txtFile != null) {\r\n txtFile.write(\"\");\r\n }\r\n } else {\r\n throw makeRuntimeRejectMsg(workerScript, \"Invalid argument passed in for clear(): \" + port);\r\n }\r\n return 0;\r\n },\r\n getPortHandle : function(port) {\r\n if (workerScript.checkingRam) {\r\n return updateStaticRam(\"getPortHandle\", CONSTANTS.ScriptReadWriteRamCost * 10);\r\n }\r\n updateDynamicRam(\"getPortHandle\", CONSTANTS.ScriptReadWriteRamCost * 10);\r\n if (isNaN(port)) {\r\n throw makeRuntimeRejectMsg(workerScript, \"ERROR: Invalid argument passed into getPortHandle(). Must be an integer between 1 and \" + CONSTANTS.NumNetscriptPorts);\r\n }\r\n port = Math.round(port);\r\n if (port < 1 || port > CONSTANTS.NumNetscriptPorts) {\r\n throw makeRuntimeRejectMsg(workerScript, \"ERROR: getPortHandle() called with invalid port number: \" + port + \". Only ports 1-\" + CONSTANTS.NumNetscriptPorts + \" are valid\");\r\n }\r\n var port = NetscriptPorts[port-1];\r\n if (port == null || !(port instanceof NetscriptPort)) {\r\n throw makeRuntimeRejectMsg(workerScript, \"ERROR: Could not find port: \" + port + \". This is a bug contact the game developer\");\r\n }\r\n return port;\r\n },\r\n rm : function(fn) {\r\n if (workerScript.checkingRam) {\r\n return updateStaticRam(\"rm\", CONSTANTS.ScriptReadWriteRamCost);\r\n }\r\n updateDynamicRam(\"rm\", CONSTANTS.ScriptReadWriteRamCost);\r\n var s = getServer(workerScript.serverIp);\r\n if (s == null) {\r\n throw makeRuntimeRejectMsg(workerScript, \"Error getting Server for this script in clear(). This is a bug please contact game dev\");\r\n }\r\n\r\n if (fn.includes(\".exe\")) {\r\n for (var i = 0; i < s.programs.length; ++i) {\r\n if (s.programs[i] === fn) {\r\n s.programs.splice(i, 1);\r\n return true;\r\n }\r\n }\r\n } else if (isScriptFilename(fn)) {\r\n for (var i = 0; i < s.scripts.length; ++i) {\r\n if (s.scripts[i].filename === fn) {\r\n //Check that the script isnt currently running\r\n for (var j = 0; j < s.runningScripts.length; ++j) {\r\n if (s.runningScripts[j].filename === fn) {\r\n workerScript.scriptRef.log(\"Cannot delete a script that is currently running!\");\r\n return false;\r\n }\r\n }\r\n s.scripts.splice(i, 1);\r\n return true;\r\n }\r\n }\r\n } else if (fn.endsWith(\".lit\")) {\r\n for (var i = 0; i < s.messages.length; ++i) {\r\n var f = s.messages[i];\r\n if (!(f instanceof Message) && isString(f) && f === fn) {\r\n s.messages.splice(i, 1);\r\n return true;\r\n }\r\n }\r\n } else if (fn.endsWith(\".txt\")) {\r\n for (var i = 0; i < s.textFiles.length; ++i) {\r\n if (s.textFiles[i].fn === fn) {\r\n s.textFiles.splice(i, 1);\r\n return true;\r\n }\r\n }\r\n }\r\n return false;\r\n },\r\n scriptRunning : function(scriptname, ip) {\r\n if (workerScript.checkingRam) {\r\n return updateStaticRam(\"scriptRunning\", CONSTANTS.ScriptArbScriptRamCost);\r\n }\r\n updateDynamicRam(\"scriptRunning\", CONSTANTS.ScriptArbScriptRamCost);\r\n var server = getServer(ip);\r\n if (server == null) {\r\n workerScript.scriptRef.log(\"scriptRunning() failed. Invalid IP or hostname passed in: \" + ip);\r\n throw makeRuntimeRejectMsg(workerScript, \"scriptRunning() failed. Invalid IP or hostname passed in: \" + ip);\r\n }\r\n for (var i = 0; i < server.runningScripts.length; ++i) {\r\n if (server.runningScripts[i].filename == scriptname) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n },\r\n scriptKill : function(scriptname, ip) {\r\n if (workerScript.checkingRam) {\r\n return updateStaticRam(\"scriptKill\", CONSTANTS.ScriptArbScriptRamCost);\r\n }\r\n updateDynamicRam(\"scriptKill\", CONSTANTS.ScriptArbScriptRamCost);\r\n var server = getServer(ip);\r\n if (server == null) {\r\n workerScript.scriptRef.log(\"scriptKill() failed. Invalid IP or hostname passed in: \" + ip);\r\n throw makeRuntimeRejectMsg(workerScript, \"scriptKill() failed. Invalid IP or hostname passed in: \" + ip);\r\n }\r\n var suc = false;\r\n for (var i = 0; i < server.runningScripts.length; ++i) {\r\n if (server.runningScripts[i].filename == scriptname) {\r\n killWorkerScript(server.runningScripts[i], server.ip);\r\n suc = true;\r\n }\r\n }\r\n return suc;\r\n },\r\n getScriptName : function() {\r\n if (workerScript.checkingRam) {return 0;}\r\n return workerScript.name;\r\n },\r\n getScriptRam : function (scriptname, ip=workerScript.serverIp) {\r\n if (workerScript.checkingRam) {\r\n return updateStaticRam(\"getScriptRam\", CONSTANTS.ScriptGetScriptRamCost);\r\n }\r\n updateDynamicRam(\"getScriptRam\", CONSTANTS.ScriptGetScriptRamCost);\r\n var server = getServer(ip);\r\n if (server == null) {\r\n workerScript.scriptRef.log(\"getScriptRam() failed. Invalid IP or hostname passed in: \" + ip);\r\n throw makeRuntimeRejectMsg(workerScript, \"getScriptRam() failed. Invalid IP or hostname passed in: \" + ip);\r\n }\r\n for (var i = 0; i < server.scripts.length; ++i) {\r\n if (server.scripts[i].filename == scriptname) {\r\n return server.scripts[i].ramUsage;\r\n }\r\n }\r\n return 0;\r\n },\r\n getHackTime : function(ip) {\r\n if (workerScript.checkingRam) {\r\n return updateStaticRam(\"getHackTime\", CONSTANTS.ScriptGetHackTimeRamCost);\r\n }\r\n updateDynamicRam(\"getHackTime\", CONSTANTS.ScriptGetHackTimeRamCost);\r\n var server = getServer(ip);\r\n if (server == null) {\r\n workerScript.scriptRef.log(\"getHackTime() failed. Invalid IP or hostname passed in: \" + ip);\r\n throw makeRuntimeRejectMsg(workerScript, \"getHackTime() failed. Invalid IP or hostname passed in: \" + ip);\r\n }\r\n return scriptCalculateHackingTime(server); //Returns seconds\r\n },\r\n getGrowTime : function(ip) {\r\n if (workerScript.checkingRam) {\r\n return updateStaticRam(\"getGrowTime\", CONSTANTS.ScriptGetHackTimeRamCost);\r\n }\r\n updateDynamicRam(\"getGrowTime\", CONSTANTS.ScriptGetHackTimeRamCost);\r\n var server = getServer(ip);\r\n if (server == null) {\r\n workerScript.scriptRef.log(\"getGrowTime() failed. Invalid IP or hostname passed in: \" + ip);\r\n throw makeRuntimeRejectMsg(workerScript, \"getGrowTime() failed. Invalid IP or hostname passed in: \" + ip);\r\n }\r\n return scriptCalculateGrowTime(server) / 1000; //Returns seconds\r\n },\r\n getWeakenTime : function(ip) {\r\n if (workerScript.checkingRam) {\r\n return updateStaticRam(\"getWeakenTime\", CONSTANTS.ScriptGetHackTimeRamCost);\r\n }\r\n updateDynamicRam(\"getWeakenTime\", CONSTANTS.ScriptGetHackTimeRamCost);\r\n var server = getServer(ip);\r\n if (server == null) {\r\n workerScript.scriptRef.log(\"getWeakenTime() failed. Invalid IP or hostname passed in: \" + ip);\r\n throw makeRuntimeRejectMsg(workerScript, \"getWeakenTime() failed. Invalid IP or hostname passed in: \" + ip);\r\n }\r\n return scriptCalculateWeakenTime(server) / 1000; //Returns seconds\r\n },\r\n getScriptIncome : function(scriptname, ip) {\r\n if (workerScript.checkingRam) {\r\n return updateStaticRam(\"getScriptIncome\", CONSTANTS.ScriptGetScriptRamCost);\r\n }\r\n updateDynamicRam(\"getScriptIncome\", CONSTANTS.ScriptGetScriptRamCost);\r\n if (arguments.length === 0) {\r\n //Get total script income\r\n var res = [];\r\n res.push(updateActiveScriptsItems());\r\n res.push(Player.scriptProdSinceLastAug / (Player.playtimeSinceLastAug/1000));\r\n return res;\r\n } else {\r\n //Get income for a particular script\r\n var server = getServer(ip);\r\n if (server == null) {\r\n workerScript.scriptRef.log(\"getScriptIncome() failed. Invalid IP or hostnamed passed in: \" + ip);\r\n throw makeRuntimeRejectMsg(workerScript, \"getScriptIncome() failed. Invalid IP or hostnamed passed in: \" + ip);\r\n }\r\n var argsForScript = [];\r\n for (var i = 2; i < arguments.length; ++i) {\r\n argsForScript.push(arguments[i]);\r\n }\r\n var runningScriptObj = findRunningScript(scriptname, argsForScript, server);\r\n if (runningScriptObj == null) {\r\n workerScript.scriptRef.log(\"getScriptIncome() failed. No such script \"+ scriptname + \" on \" + server.hostname + \" with args: \" + printArray(argsForScript));\r\n return -1;\r\n }\r\n return runningScriptObj.onlineMoneyMade / runningScriptObj.onlineRunningTime;\r\n }\r\n },\r\n getScriptExpGain : function(scriptname, ip) {\r\n if (workerScript.checkingRam) {\r\n return updateStaticRam(\"getScriptExpGain\", CONSTANTS.ScriptGetScriptRamCost);\r\n }\r\n updateDynamicRam(\"getScriptExpGain\", CONSTANTS.ScriptGetScriptRamCost);\r\n if (arguments.length === 0) {\r\n var total = 0;\r\n for (var i = 0; i < workerScripts.length; ++i) {\r\n total += (workerScripts[i].scriptRef.onlineExpGained / workerScripts[i].scriptRef.onlineRunningTime);\r\n }\r\n return total;\r\n } else {\r\n //Get income for a particular script\r\n var server = getServer(ip);\r\n if (server == null) {\r\n workerScript.scriptRef.log(\"getScriptExpGain() failed. Invalid IP or hostnamed passed in: \" + ip);\r\n throw makeRuntimeRejectMsg(workerScript, \"getScriptExpGain() failed. Invalid IP or hostnamed passed in: \" + ip);\r\n }\r\n var argsForScript = [];\r\n for (var i = 2; i < arguments.length; ++i) {\r\n argsForScript.push(arguments[i]);\r\n }\r\n var runningScriptObj = findRunningScript(scriptname, argsForScript, server);\r\n if (runningScriptObj == null) {\r\n workerScript.scriptRef.log(\"getScriptExpGain() failed. No such script \"+ scriptname + \" on \" + server.hostname + \" with args: \" + printArray(argsForScript));\r\n return -1;\r\n }\r\n return runningScriptObj.onlineExpGained / runningScriptObj.onlineRunningTime;\r\n }\r\n },\r\n getTimeSinceLastAug : function() {\r\n if (workerScript.checkingRam) {\r\n return updateStaticRam(\"getTimeSinceLastAug\", CONSTANTS.ScriptGetHackTimeRamCost);\r\n }\r\n updateDynamicRam(\"getTimeSinceLastAug\", CONSTANTS.ScriptGetHackTimeRamCost);\r\n return Player.playtimeSinceLastAug;\r\n },\r\n prompt : function(txt) {\r\n if (workerScript.checkingRam) {return 0;}\r\n if (yesNoBoxOpen) {\r\n workerScript.scriptRef.log(\"ERROR: confirm() failed because a pop-up dialog box is already open\");\r\n return false;\r\n }\r\n if (!isString(txt)) {txt = String(txt);}\r\n var yesBtn = yesNoBoxGetYesButton(), noBtn = yesNoBoxGetNoButton();\r\n yesBtn.innerHTML = \"Yes\";\r\n noBtn.innerHTML = \"No\";\r\n return new Promise(function(resolve, reject) {\r\n yesBtn.addEventListener(\"click\", ()=>{\r\n yesNoBoxClose();\r\n resolve(true);\r\n });\r\n noBtn.addEventListener(\"click\", ()=>{\r\n yesNoBoxClose();\r\n resolve(false);\r\n });\r\n yesNoBoxCreate(txt);\r\n });\r\n },\r\n\r\n /* Singularity Functions */\r\n universityCourse : function(universityName, className) {\r\n var ramCost = CONSTANTS.ScriptSingularityFn1RamCost;\r\n if (Player.bitNodeN !== 4) {ramCost *= 8;}\r\n if (workerScript.checkingRam) {\r\n return updateStaticRam(\"universityCourse\", ramCost);\r\n }\r\n updateDynamicRam(\"universityCourse\", ramCost);\r\n if (Player.bitNodeN != 4) {\r\n if (!(hasSingularitySF && singularitySFLvl >= 1)) {\r\n throw makeRuntimeRejectMsg(workerScript, \"Cannot run universityCourse(). It is a Singularity Function and requires SourceFile-4 (level 1) to run.\");\r\n return false;\r\n }\r\n }\r\n if (inMission) {\r\n workerScript.scriptRef.log(\"ERROR: universityCourse() failed because you are in the middle of a mission.\");\r\n return;\r\n }\r\n if (Player.isWorking) {\r\n var txt = Player.singularityStopWork();\r\n if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.universityCourse == null) {\r\n workerScript.scriptRef.log(txt);\r\n }\r\n }\r\n\r\n var costMult, expMult;\r\n switch(universityName.toLowerCase()) {\r\n case Locations.AevumSummitUniversity.toLowerCase():\r\n if (Player.city != Locations.Aevum) {\r\n workerScript.scriptRef.log(\"ERROR: You cannot study at Summit University because you are not in Aevum. universityCourse() failed\");\r\n return false;\r\n }\r\n Player.location = Locations.AevumSummitUniversity;\r\n costMult = 4;\r\n expMult = 3;\r\n break;\r\n case Locations.Sector12RothmanUniversity.toLowerCase():\r\n if (Player.city != Locations.Sector12) {\r\n workerScript.scriptRef.log(\"ERROR: You cannot study at Rothman University because you are not in Sector-12. universityCourse() failed\");\r\n return false;\r\n }\r\n Player.location = Locations.Sector12RothmanUniversity;\r\n costMult = 3;\r\n expMult = 2;\r\n break;\r\n case Locations.VolhavenZBInstituteOfTechnology.toLowerCase():\r\n if (Player.city != Locations.Volhaven) {\r\n workerScript.scriptRef.log(\"ERROR: You cannot study at ZB Institute of Technology because you are not in Volhaven. universityCourse() failed\");\r\n return false;\r\n }\r\n Player.location = Locations.VolhavenZBInstituteOfTechnology;\r\n costMult = 5;\r\n expMult = 4;\r\n break;\r\n default:\r\n workerScript.scriptRef.log(\"Invalid university name: \" + universityName + \". universityCourse() failed\");\r\n return false;\r\n }\r\n\r\n var task;\r\n switch(className.toLowerCase()) {\r\n case \"Study Computer Science\".toLowerCase():\r\n task = CONSTANTS.ClassStudyComputerScience;\r\n break;\r\n case \"Data Structures\".toLowerCase():\r\n task = CONSTANTS.ClassDataStructures;\r\n break;\r\n case \"Networks\".toLowerCase():\r\n task = CONSTANTS.ClassNetworks;\r\n break;\r\n case \"Algorithms\".toLowerCase():\r\n task = CONSTANTS.ClassAlgorithms;\r\n break;\r\n case \"Management\".toLowerCase():\r\n task = CONSTANTS.ClassManagement;\r\n break;\r\n case \"Leadership\".toLowerCase():\r\n task = CONSTANTS.ClassLeadership;\r\n break;\r\n default:\r\n workerScript.scriptRef.log(\"Invalid class name: \" + className + \". universityCourse() failed\");\r\n return false;\r\n }\r\n Player.startClass(costMult, expMult, task);\r\n if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.universityCourse == null) {\r\n workerScript.scriptRef.log(\"Started \" + task + \" at \" + universityName);\r\n }\r\n return true;\r\n },\r\n\r\n gymWorkout : function(gymName, stat) {\r\n var ramCost = CONSTANTS.ScriptSingularityFn1RamCost;\r\n if (Player.bitNodeN !== 4) {ramCost *= 8;}\r\n if (workerScript.checkingRam) {\r\n return updateStaticRam(\"gymWorkout\", ramCost);\r\n }\r\n updateDynamicRam(\"gymWorkout\", ramCost);\r\n if (Player.bitNodeN != 4) {\r\n if (!(hasSingularitySF && singularitySFLvl >= 1)) {\r\n throw makeRuntimeRejectMsg(workerScript, \"Cannot run gymWorkout(). It is a Singularity Function and requires SourceFile-4 (level 1) to run.\");\r\n return false;\r\n }\r\n }\r\n if (inMission) {\r\n workerScript.scriptRef.log(\"ERROR: gymWorkout() failed because you are in the middle of a mission.\");\r\n return;\r\n }\r\n if (Player.isWorking) {\r\n var txt = Player.singularityStopWork();\r\n if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.gymWorkout == null) {\r\n workerScript.scriptRef.log(txt);\r\n }\r\n }\r\n var costMult, expMult;\r\n switch(gymName.toLowerCase()) {\r\n case Locations.AevumCrushFitnessGym.toLowerCase():\r\n if (Player.city != Locations.Aevum) {\r\n workerScript.scriptRef.log(\"ERROR: You cannot workout at Crush Fitness because you are not in Aevum. gymWorkout() failed\");\r\n return false;\r\n }\r\n Player.location = Locations.AevumCrushFitnessGym;\r\n costMult = 3;\r\n expMult = 2;\r\n break;\r\n case Locations.AevumSnapFitnessGym.toLowerCase():\r\n if (Player.city != Locations.Aevum) {\r\n workerScript.scriptRef.log(\"ERROR: You cannot workout at Snap Fitness because you are not in Aevum. gymWorkout() failed\");\r\n return false;\r\n }\r\n Player.location = Locations.AevumSnapFitnessGym;\r\n costMult = 10;\r\n expMult = 5;\r\n break;\r\n case Locations.Sector12IronGym.toLowerCase():\r\n if (Player.city != Locations.Sector12) {\r\n workerScript.scriptRef.log(\"ERROR: You cannot workout at Iron Gym because you are not in Sector-12. gymWorkout() failed\");\r\n return false;\r\n }\r\n Player.location = Locations.Sector12IronGym;\r\n costMult = 1;\r\n expMult = 1;\r\n break;\r\n case Locations.Sector12PowerhouseGym.toLowerCase():\r\n if (Player.city != Locations.Sector12) {\r\n workerScript.scriptRef.log(\"ERROR: You cannot workout at Powerhouse Gym because you are not in Sector-12. gymWorkout() failed\");\r\n return false;\r\n }\r\n Player.location = Locations.Sector12PowerhouseGym;\r\n costMult = 20;\r\n expMult = 10;\r\n break;\r\n case Locations.VolhavenMilleniumFitnessGym:\r\n if (Player.city != Locations.Volhaven) {\r\n workerScript.scriptRef.log(\"ERROR: You cannot workout at Millenium Fitness Gym because you are not in Volhaven. gymWorkout() failed\");\r\n return false;\r\n }\r\n Player.location = Locations.VolhavenMilleniumFitnessGym;\r\n costMult = 7;\r\n expMult = 4;\r\n break;\r\n default:\r\n workerScript.scriptRef.log(\"Invalid gym name: \" + gymName + \". gymWorkout() failed\");\r\n return false;\r\n }\r\n\r\n switch(stat.toLowerCase()) {\r\n case \"strength\".toLowerCase():\r\n case \"str\".toLowerCase():\r\n Player.startClass(costMult, expMult, CONSTANTS.ClassGymStrength);\r\n break;\r\n case \"defense\".toLowerCase():\r\n case \"def\".toLowerCase():\r\n Player.startClass(costMult, expMult, CONSTANTS.ClassGymDefense);\r\n break;\r\n case \"dexterity\".toLowerCase():\r\n case \"dex\".toLowerCase():\r\n Player.startClass(costMult, expMult, CONSTANTS.ClassGymDexterity);\r\n break;\r\n case \"agility\".toLowerCase():\r\n case \"agi\".toLowerCase():\r\n Player.startClass(costMult, expMult, CONSTANTS.ClassGymAgility);\r\n break;\r\n default:\r\n workerScript.scriptRef.log(\"Invalid stat: \" + stat + \". gymWorkout() failed\");\r\n return false;\r\n }\r\n if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.gymWorkout == null) {\r\n workerScript.scriptRef.log(\"Started training \" + stat + \" at \" + gymName);\r\n }\r\n return true;\r\n },\r\n\r\n travelToCity(cityname) {\r\n var ramCost = CONSTANTS.ScriptSingularityFn1RamCost;\r\n if (Player.bitNodeN !== 4) {ramCost *= 8;}\r\n if (workerScript.checkingRam) {\r\n return updateStaticRam(\"travelToCity\", ramCost);\r\n }\r\n updateDynamicRam(\"travelToCity\", ramCost);\r\n if (Player.bitNodeN != 4) {\r\n if (!(hasSingularitySF && singularitySFLvl >= 1)) {\r\n throw makeRuntimeRejectMsg(workerScript, \"Cannot run travelToCity(). It is a Singularity Function and requires SourceFile-4 (level 1) to run.\");\r\n return false;\r\n }\r\n }\r\n\r\n switch(cityname) {\r\n case Locations.Aevum:\r\n case Locations.Chongqing:\r\n case Locations.Sector12:\r\n case Locations.NewTokyo:\r\n case Locations.Ishima:\r\n case Locations.Volhaven:\r\n if(Player.money.lt(CONSTANTS.TravelCost)) {\r\n workerScript.scriptRef.log(\"ERROR: not enough money to travel with travelToCity().\");\r\n throw makeRuntimeRejectMsg(workerScript, \"ERROR: not enough money to travel with travelToCity().\");\r\n }\r\n Player.loseMoney(CONSTANTS.TravelCost);\r\n Player.city = cityname;\r\n Player.gainIntelligenceExp(CONSTANTS.IntelligenceSingFnBaseExpGain);\r\n if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.travelToCity == null) {\r\n workerScript.scriptRef.log(\"Traveled to \" + cityname);\r\n }\r\n return true;\r\n default:\r\n workerScript.scriptRef.log(\"ERROR: Invalid city name passed into travelToCity().\");\r\n return false;\r\n }\r\n },\r\n\r\n purchaseTor() {\r\n var ramCost = CONSTANTS.ScriptSingularityFn1RamCost;\r\n if (Player.bitNodeN !== 4) {ramCost *= 8;}\r\n if (workerScript.checkingRam) {\r\n return updateStaticRam(\"purchaseTor\", ramCost);\r\n }\r\n updateDynamicRam(\"purchaseTor\", ramCost);\r\n if (Player.bitNodeN != 4) {\r\n if (!(hasSingularitySF && singularitySFLvl >= 1)) {\r\n throw makeRuntimeRejectMsg(workerScript, \"Cannot run purchaseTor(). It is a Singularity Function and requires SourceFile-4 (level 1) to run.\");\r\n return false;\r\n }\r\n }\r\n\r\n if (SpecialServerIps[\"Darkweb Server\"] != null) {\r\n workerScript.scriptRef.log(\"You already have a TOR router! purchaseTor() failed\");\r\n return false;\r\n }\r\n\r\n if (Player.money.lt(CONSTANTS.TorRouterCost)) {\r\n workerScript.scriptRef.log(\"ERROR: You cannot afford to purchase a Tor router. purchaseTor() failed\");\r\n return false;\r\n }\r\n Player.loseMoney(CONSTANTS.TorRouterCost);\r\n\r\n var darkweb = new Server({\r\n ip:createRandomIp(), hostname:\"darkweb\", organizationName:\"\",\r\n isConnectedTo:false, adminRights:false, purchasedByPlayer:false, maxRam:1\r\n });\r\n AddToAllServers(darkweb);\r\n SpecialServerIps.addIp(\"Darkweb Server\", darkweb.ip);\r\n\r\n document.getElementById(\"location-purchase-tor\").setAttribute(\"class\", \"a-link-button-inactive\");\r\n\r\n Player.getHomeComputer().serversOnNetwork.push(darkweb.ip);\r\n darkweb.serversOnNetwork.push(Player.getHomeComputer().ip);\r\n Player.gainIntelligenceExp(CONSTANTS.IntelligenceSingFnBaseExpGain);\r\n if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.purchaseTor == null) {\r\n workerScript.scriptRef.log(\"You have purchased a Tor router!\");\r\n }\r\n return true;\r\n },\r\n purchaseProgram(programName) {\r\n var ramCost = CONSTANTS.ScriptSingularityFn1RamCost;\r\n if (Player.bitNodeN !== 4) {ramCost *= 8;}\r\n if (workerScript.checkingRam) {\r\n return updateStaticRam(\"purchaseProgram\", ramCost);\r\n }\r\n updateDynamicRam(\"purchaseProgram\", ramCost);\r\n if (Player.bitNodeN != 4) {\r\n if (!(hasSingularitySF && singularitySFLvl >= 1)) {\r\n throw makeRuntimeRejectMsg(workerScript, \"Cannot run purchaseProgram(). It is a Singularity Function and requires SourceFile-4 (level 1) to run.\");\r\n return false;\r\n }\r\n }\r\n\r\n if (SpecialServerIps[\"Darkweb Server\"] == null) {\r\n workerScript.scriptRef.log(\"ERROR: You do not have TOR router. purchaseProgram() failed.\");\r\n return false;\r\n }\r\n\r\n switch(programName.toLowerCase()) {\r\n case Programs.BruteSSHProgram.toLowerCase():\r\n var price = parseDarkwebItemPrice(DarkWebItems.BruteSSHProgram);\r\n if (price > 0 && Player.money.gt(price)) {\r\n Player.loseMoney(price);\r\n Player.getHomeComputer().programs.push(Programs.BruteSSHProgram);\r\n if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.purchaseProgram == null) {\r\n workerScript.scriptRef.log(\"You have purchased the BruteSSH.exe program. The new program can be found on your home computer.\");\r\n }\r\n } else {\r\n workerScript.scriptRef.log(\"Not enough money to purchase \" + programName);\r\n return false;\r\n }\r\n return true;\r\n case Programs.FTPCrackProgram.toLowerCase():\r\n var price = parseDarkwebItemPrice(DarkWebItems.FTPCrackProgram);\r\n if (price > 0 && Player.money.gt(price)) {\r\n Player.loseMoney(price);\r\n Player.getHomeComputer().programs.push(Programs.FTPCrackProgram);\r\n if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.purchaseProgram == null) {\r\n workerScript.scriptRef.log(\"You have purchased the FTPCrack.exe program. The new program can be found on your home computer.\");\r\n }\r\n } else {\r\n workerScript.scriptRef.log(\"Not enough money to purchase \" + programName);\r\n return false;\r\n }\r\n return true;\r\n case Programs.RelaySMTPProgram.toLowerCase():\r\n var price = parseDarkwebItemPrice(DarkWebItems.RelaySMTPProgram);\r\n if (price > 0 && Player.money.gt(price)) {\r\n Player.loseMoney(price);\r\n Player.getHomeComputer().programs.push(Programs.RelaySMTPProgram);\r\n if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.purchaseProgram == null) {\r\n workerScript.scriptRef.log(\"You have purchased the relaySMTP.exe program. The new program can be found on your home computer.\");\r\n }\r\n } else {\r\n workerScript.scriptRef.log(\"Not enough money to purchase \" + programName);\r\n return false;\r\n }\r\n return true;\r\n case Programs.HTTPWormProgram.toLowerCase():\r\n var price = parseDarkwebItemPrice(DarkWebItems.HTTPWormProgram);\r\n if (price > 0 && Player.money.gt(price)) {\r\n Player.loseMoney(price);\r\n Player.getHomeComputer().programs.push(Programs.HTTPWormProgram);\r\n if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.purchaseProgram == null) {\r\n workerScript.scriptRef.log(\"You have purchased the HTTPWorm.exe program. The new program can be found on your home computer.\");\r\n }\r\n } else {\r\n workerScript.scriptRef.log(\"Not enough money to purchase \" + programName);\r\n return false;\r\n }\r\n return true;\r\n case Programs.SQLInjectProgram.toLowerCase():\r\n var price = parseDarkwebItemPrice(DarkWebItems.SQLInjectProgram);\r\n if (price > 0 && Player.money.gt(price)) {\r\n Player.loseMoney(price);\r\n Player.getHomeComputer().programs.push(Programs.SQLInjectProgram);\r\n if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.purchaseProgram == null) {\r\n workerScript.scriptRef.log(\"You have purchased the SQLInject.exe program. The new program can be found on your home computer.\");\r\n }\r\n } else {\r\n workerScript.scriptRef.log(\"Not enough money to purchase \" + programName);\r\n return false;\r\n }\r\n return true;\r\n case Programs.DeepscanV1.toLowerCase():\r\n var price = parseDarkwebItemPrice(DarkWebItems.DeepScanV1Program);\r\n if (price > 0 && Player.money.gt(price)) {\r\n Player.loseMoney(price);\r\n Player.getHomeComputer().programs.push(Programs.DeepscanV1);\r\n if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.purchaseProgram == null) {\r\n workerScript.scriptRef.log(\"You have purchased the DeepscanV1.exe program. The new program can be found on your home computer.\");\r\n }\r\n } else {\r\n workerScript.scriptRef.log(\"Not enough money to purchase \" + programName);\r\n return false;\r\n }\r\n return true;\r\n case Programs.DeepscanV2.toLowerCase():\r\n var price = parseDarkwebItemPrice(DarkWebItems.DeepScanV2Program);\r\n if (price > 0 && Player.money.gt(price)) {\r\n Player.loseMoney(price);\r\n Player.getHomeComputer().programs.push(Programs.DeepscanV2);\r\n if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.purchaseProgram == null) {\r\n workerScript.scriptRef.log(\"You have purchased the DeepscanV2.exe program. The new program can be found on your home computer.\");\r\n }\r\n } else {\r\n workerScript.scriptRef.log(\"Not enough money to purchase \" + programName);\r\n return false;\r\n }\r\n return true;\r\n default:\r\n workerScript.scriptRef.log(\"ERROR: Invalid program passed into purchaseProgram().\");\r\n return false;\r\n }\r\n return true;\r\n },\r\n getStats : function() {\r\n var ramCost = CONSTANTS.ScriptSingularityFn1RamCost / 4;\r\n if (Player.bitNodeN !== 4) {ramCost *= 8;}\r\n if (workerScript.checkingRam) {\r\n return updateStaticRam(\"getStats\", ramCost);\r\n }\r\n updateDynamicRam(\"getStats\", ramCost);\r\n if (Player.bitNodeN != 4) {\r\n if (!(hasSingularitySF && singularitySFLvl >= 1)) {\r\n throw makeRuntimeRejectMsg(workerScript, \"Cannot run getStats(). It is a Singularity Function and requires SourceFile-4 (level 1) to run.\");\r\n return {};\r\n }\r\n }\r\n\r\n return {\r\n hacking: Player.hacking_skill,\r\n strength: Player.strength,\r\n defense: Player.defense,\r\n dexterity: Player.dexterity,\r\n agility: Player.agility,\r\n charisma: Player.charisma,\r\n intelligence: Player.intelligence\r\n }\r\n },\r\n getCharacterInformation : function() {\r\n var ramCost = CONSTANTS.ScriptSingularityFn1RamCost / 4;\r\n if (Player.bitNodeN !== 4) {ramCost *= 8;}\r\n if (workerScript.checkingRam) {\r\n return updateStaticRam(\"getCharacterInformation\", ramCost);\r\n }\r\n updateDynamicRam(\"getCharacterInformation\", ramCost);\r\n if (Player.bitNodeN != 4) {\r\n if (!(hasSingularitySF && singularitySFLvl >= 1)) {\r\n throw makeRuntimeRejectMsg(workerScript, \"Cannot run getCharacterInformation(). It is a Singularity Function and requires SourceFile-4 (level 1) to run.\");\r\n return {};\r\n }\r\n }\r\n\r\n var companyPositionTitle = \"\";\r\n if (Player.companyPosition instanceof CompanyPosition) {\r\n companyPositionTitle = Player.companyPosition.positionName;\r\n }\r\n return {\r\n bitnode: Player.bitNodeN,\r\n company: Player.companyName,\r\n jobTitle: companyPositionTitle,\r\n city: Player.city,\r\n factions: Player.factions.slice(),\r\n tor: SpecialServerIps.hasOwnProperty(\"Darkweb Server\"),\r\n timeWorked: Player.timeWorked,\r\n workHackExpGain: Player.workHackExpGained,\r\n workStrExpGain: Player.workStrExpGained,\r\n workDefExpGain: Player.workDefExpGained,\r\n workDexExpGain: Player.workDexExpGained,\r\n workAgiExpGain: Player.workAgiExpGained,\r\n workChaExpGain: Player.workChaExpGained,\r\n workRepGain: Player.workRepGained,\r\n workMoneyGain: Player.workMoneyGained,\r\n };\r\n },\r\n isBusy : function() {\r\n var ramCost = CONSTANTS.ScriptSingularityFn1RamCost / 4;\r\n if (Player.bitNodeN !== 4) {ramCost *= 8;}\r\n if (workerScript.checkingRam) {\r\n return updateStaticRam(\"isBusy\", ramCost);\r\n }\r\n updateDynamicRam(\"isBusy\", ramCost);\r\n if (Player.bitNodeN != 4) {\r\n if (!(hasSingularitySF && singularitySFLvl >= 1)) {\r\n throw makeRuntimeRejectMsg(workerScript, \"Cannot run isBusy(). It is a Singularity Function and requires SourceFile-4 (level 1) to run.\");\r\n return;\r\n }\r\n }\r\n return Player.isWorking;\r\n },\r\n stopAction : function() {\r\n var ramCost = CONSTANTS.ScriptSingularityFn1RamCost / 2;\r\n if (Player.bitNodeN !== 4) {ramCost *= 8;}\r\n if (workerScript.checkingRam) {\r\n return updateStaticRam(\"stopAction\", ramCost);\r\n }\r\n updateDynamicRam(\"stopAction\", ramCost);\r\n if (Player.bitNodeN != 4) {\r\n if (!(hasSingularitySF && singularitySFLvl >= 1)) {\r\n throw makeRuntimeRejectMsg(workerScript, \"Cannot run stopAction(). It is a Singularity Function and requires SourceFile-4 (level 1) to run.\");\r\n return false;\r\n }\r\n }\r\n if (Player.isWorking) {\r\n var txt = Player.singularityStopWork();\r\n if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.stopAction == null) {\r\n workerScript.scriptRef.log(txt);\r\n }\r\n return true;\r\n }\r\n return false;\r\n },\r\n upgradeHomeRam : function() {\r\n var ramCost = CONSTANTS.ScriptSingularityFn2RamCost;\r\n if (Player.bitNodeN !== 4) {ramCost *= 8;}\r\n if (workerScript.checkingRam) {\r\n return updateStaticRam(\"upgradeHomeRam\", ramCost);\r\n }\r\n updateDynamicRam(\"upgradeHomeRam\", ramCost);\r\n if (Player.bitNodeN != 4) {\r\n if (!(hasSingularitySF && singularitySFLvl >= 2)) {\r\n throw makeRuntimeRejectMsg(workerScript, \"Cannot run upgradeHomeRam(). It is a Singularity Function and requires SourceFile-4 (level 2) to run.\");\r\n return false;\r\n }\r\n }\r\n\r\n const cost = Player.getUpgradeHomeRamCost();\r\n\r\n if (Player.money.lt(cost)) {\r\n workerScript.scriptRef.log(\"ERROR: upgradeHomeRam() failed because you don't have enough money\");\r\n return false;\r\n }\r\n\r\n var homeComputer = Player.getHomeComputer();\r\n homeComputer.maxRam *= 2;\r\n\r\n Player.loseMoney(cost);\r\n\r\n Player.gainIntelligenceExp(CONSTANTS.IntelligenceSingFnBaseExpGain);\r\n if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.upgradeHomeRam == null) {\r\n workerScript.scriptRef.log(\"Purchased additional RAM for home computer! It now has \" + homeComputer.maxRam + \"GB of RAM.\");\r\n }\r\n return true;\r\n },\r\n getUpgradeHomeRamCost : function() {\r\n var ramCost = CONSTANTS.ScriptSingularityFn2RamCost / 2;\r\n if (Player.bitNodeN !== 4) {ramCost *= 8;}\r\n if (workerScript.checkingRam) {\r\n return updateStaticRam(\"getUpgradeHomeRamCost\", ramCost);\r\n }\r\n updateDynamicRam(\"getUpgradeHomeRamCost\", ramCost);\r\n if (Player.bitNodeN != 4) {\r\n if (!(hasSingularitySF && singularitySFLvl >= 2)) {\r\n throw makeRuntimeRejectMsg(workerScript, \"Cannot run getUpgradeHomeRamCost(). It is a Singularity Function and requires SourceFile-4 (level 2) to run.\");\r\n return false;\r\n }\r\n }\r\n\r\n return Player.getUpgradeHomeRamCost();\r\n },\r\n workForCompany : function() {\r\n var ramCost = CONSTANTS.ScriptSingularityFn2RamCost;\r\n if (Player.bitNodeN !== 4) {ramCost *= 8;}\r\n if (workerScript.checkingRam) {\r\n return updateStaticRam(\"workForCompany\", ramCost);\r\n }\r\n updateDynamicRam(\"workForCompany\", ramCost);\r\n if (Player.bitNodeN != 4) {\r\n if (!(hasSingularitySF && singularitySFLvl >= 2)) {\r\n throw makeRuntimeRejectMsg(workerScript, \"Cannot run workForCompany(). It is a Singularity Function and requires SourceFile-4 (level 2) to run.\");\r\n return false;\r\n }\r\n }\r\n\r\n if (inMission) {\r\n workerScript.scriptRef.log(\"ERROR: workForCompany() failed because you are in the middle of a mission.\");\r\n return;\r\n }\r\n\r\n if (Player.companyPosition == \"\" || !(Player.companyPosition instanceof CompanyPosition)) {\r\n workerScript.scriptRef.log(\"ERROR: workForCompany() failed because you do not have a job\");\r\n return false;\r\n }\r\n\r\n if (Player.isWorking) {\r\n var txt = Player.singularityStopWork();\r\n if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.workForCompany == null) {\r\n workerScript.scriptRef.log(txt);\r\n }\r\n }\r\n\r\n if (Player.companyPosition.isPartTimeJob()) {\r\n Player.startWorkPartTime();\r\n } else {\r\n Player.startWork();\r\n }\r\n if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.workForCompany == null) {\r\n workerScript.scriptRef.log(\"Began working at \" + Player.companyName + \" as a \" + Player.companyPosition.positionName);\r\n }\r\n return true;\r\n },\r\n applyToCompany : function(companyName, field) {\r\n var ramCost = CONSTANTS.ScriptSingularityFn2RamCost;\r\n if (Player.bitNodeN !== 4) {ramCost *= 8;}\r\n if (workerScript.checkingRam) {\r\n return updateStaticRam(\"applyToCompany\", ramCost);\r\n }\r\n updateDynamicRam(\"applyToCompany\", ramCost);\r\n if (Player.bitNodeN != 4) {\r\n if (!(hasSingularitySF && singularitySFLvl >= 2)) {\r\n throw makeRuntimeRejectMsg(workerScript, \"Cannot run applyToCompany(). It is a Singularity Function and requires SourceFile-4 (level 2) to run.\");\r\n return false;\r\n }\r\n }\r\n\r\n if (!companyExists(companyName)) {\r\n workerScript.scriptRef.log(\"ERROR: applyToCompany() failed because specified company \" + companyName + \" does not exist.\");\r\n return false;\r\n }\r\n\r\n Player.location = companyName;\r\n var res;\r\n switch (field.toLowerCase()) {\r\n case \"software\":\r\n res = Player.applyForSoftwareJob(true);\r\n break;\r\n case \"software consultant\":\r\n res = Player.applyForSoftwareConsultantJob(true);\r\n break;\r\n case \"it\":\r\n res = Player.applyForItJob(true);\r\n break;\r\n case \"security engineer\":\r\n res = Player.applyForSecurityEngineerJob(true);\r\n break;\r\n case \"network engineer\":\r\n res = Player.applyForNetworkEngineerJob(true);\r\n break;\r\n case \"business\":\r\n res = Player.applyForBusinessJob(true);\r\n break;\r\n case \"business consultant\":\r\n res = Player.applyForBusinessConsultantJob(true);\r\n break;\r\n case \"security\":\r\n res = Player.applyForSecurityJob(true);\r\n break;\r\n case \"agent\":\r\n res = Player.applyForAgentJob(true);\r\n break;\r\n case \"employee\":\r\n res = Player.applyForEmployeeJob(true);\r\n break;\r\n case \"part-time employee\":\r\n res = Player.applyForPartTimeEmployeeJob(true);\r\n break;\r\n case \"waiter\":\r\n res = Player.applyForWaiterJob(true);\r\n break;\r\n case \"part-time waiter\":\r\n res = Player.applyForPartTimeWaiterJob(true);\r\n break;\r\n default:\r\n workerScript.scriptRef.log(\"ERROR: Invalid job passed into applyToCompany: \" + field + \". applyToCompany() failed\");\r\n return false;\r\n }\r\n //The Player object's applyForJob function can return string with special error messages\r\n if (isString(res)) {\r\n workerScript.scriptRef.log(res);\r\n return false;\r\n }\r\n if (res) {\r\n if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.applyToCompany == null) {\r\n workerScript.scriptRef.log(\"You were offered a new job at \" + companyName + \" as a \" + Player.companyPosition.positionName);\r\n }\r\n } else {\r\n if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.applyToCompany == null) {\r\n workerScript.scriptRef.log(\"You failed to get a new job/promotion at \" + companyName + \" in the \" + field + \" field.\");\r\n }\r\n }\r\n return res;\r\n },\r\n getCompanyRep : function(companyName) {\r\n var ramCost = CONSTANTS.ScriptSingularityFn2RamCost / 2;\r\n if (Player.bitNodeN !== 4) {ramCost *= 8;}\r\n if (workerScript.checkingRam) {\r\n return updateStaticRam(\"getCompanyRep\", ramCost);\r\n }\r\n updateDynamicRam(\"getCompanyRep\", ramCost);\r\n if (Player.bitNodeN != 4) {\r\n if (!(hasSingularitySF && singularitySFLvl >= 2)) {\r\n throw makeRuntimeRejectMsg(workerScript, \"Cannot run getCompanyRep(). It is a Singularity Function and requires SourceFile-4 (level 2) to run.\");\r\n return false;\r\n }\r\n }\r\n\r\n var company = Companies[companyName];\r\n if (company == null || !(company instanceof Company)) {\r\n workerScript.scriptRef.log(\"ERROR: Invalid companyName passed into getCompanyRep(): \" + companyName);\r\n return -1;\r\n }\r\n return company.playerReputation;\r\n },\r\n getCompanyFavor : function(companyName) {\r\n var ramCost = CONSTANTS.ScriptSingularityFn2RamCost / 4;\r\n if (Player.bitNodeN !== 4) {ramCost *= 8;}\r\n if (workerScript.checkingRam) {\r\n return updateStaticRam(\"getCompanyFavor\", ramCost);\r\n }\r\n updateDynamicRam(\"getCompanyFavor\", ramCost);\r\n if (Player.bitNodeN != 4) {\r\n if (!(hasSingularitySF && singularitySFLvl >= 2)) {\r\n throw makeRuntimeRejectMsg(workerScript, \"Cannot run getCompanyFavor(). It is a Singularity Function and requires SourceFile-4 (level 2) to run.\");\r\n return false;\r\n }\r\n }\r\n\r\n var company = Companies[companyName];\r\n if (company == null || !(company instanceof Company)) {\r\n workerScript.scriptRef.log(\"ERROR: Invalid companyName passed into getCompanyFavor(): \" + companyName);\r\n return -1;\r\n }\r\n return company.favor;\r\n },\r\n checkFactionInvitations : function() {\r\n var ramCost = CONSTANTS.ScriptSingularityFn2RamCost;\r\n if (Player.bitNodeN !== 4) {ramCost *= 8;}\r\n if (workerScript.checkingRam) {\r\n return updateStaticRam(\"checkFactionInvitations\", ramCost);\r\n }\r\n updateDynamicRam(\"checkFactionInvitations\", ramCost);\r\n if (Player.bitNodeN != 4) {\r\n if (!(hasSingularitySF && singularitySFLvl >= 2)) {\r\n throw makeRuntimeRejectMsg(workerScript, \"Cannot run checkFactionInvitations(). It is a Singularity Function and requires SourceFile-4 (level 2) to run.\");\r\n return false;\r\n }\r\n }\r\n //Make a copy of Player.factionInvitations\r\n return Player.factionInvitations.slice();\r\n },\r\n joinFaction : function(name) {\r\n var ramCost = CONSTANTS.ScriptSingularityFn2RamCost;\r\n if (Player.bitNodeN !== 4) {ramCost *= 8;}\r\n if (workerScript.checkingRam) {\r\n return updateStaticRam(\"joinFaction\", ramCost);\r\n }\r\n updateDynamicRam(\"joinFaction\", ramCost);\r\n if (Player.bitNodeN != 4) {\r\n if (!(hasSingularitySF && singularitySFLvl >= 2)) {\r\n throw makeRuntimeRejectMsg(workerScript, \"Cannot run joinFaction(). It is a Singularity Function and requires SourceFile-4 (level 2) to run.\");\r\n return false;\r\n }\r\n }\r\n\r\n if (!factionExists(name)) {\r\n workerScript.scriptRef.log(\"ERROR: Faction specified in joinFaction() does not exist.\");\r\n return false;\r\n }\r\n\r\n if (!Player.factionInvitations.includes(name)) {\r\n workerScript.scriptRef.log(\"ERROR: Cannot join \" + name + \" Faction because you have not been invited. joinFaction() failed\");\r\n return false;\r\n }\r\n\r\n var index = Player.factionInvitations.indexOf(name);\r\n if (index === -1) {\r\n //Redundant and should never happen...\r\n workerScript.scriptRef.log(\"ERROR: Cannot join \" + name + \" Faction because you have not been invited. joinFaction() failed\");\r\n return false;\r\n }\r\n Player.factionInvitations.splice(index, 1);\r\n var fac = Factions[name];\r\n joinFaction(fac);\r\n Player.gainIntelligenceExp(CONSTANTS.IntelligenceSingFnBaseExpGain);\r\n if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.joinFaction == null) {\r\n workerScript.scriptRef.log(\"Joined the \" + name + \" faction.\");\r\n }\r\n return true;\r\n },\r\n workForFaction : function(name, type) {\r\n var ramCost = CONSTANTS.ScriptSingularityFn2RamCost;\r\n if (Player.bitNodeN !== 4) {ramCost *= 8;}\r\n if (workerScript.checkingRam) {\r\n return updateStaticRam(\"workForFaction\", ramCost);\r\n }\r\n updateDynamicRam(\"workForFaction\", ramCost);\r\n if (Player.bitNodeN != 4) {\r\n if (!(hasSingularitySF && singularitySFLvl >= 2)) {\r\n throw makeRuntimeRejectMsg(workerScript, \"Cannot run workForFaction(). It is a Singularity Function and requires SourceFile-4 (level 2) to run.\");\r\n return false;\r\n }\r\n }\r\n\r\n if (inMission) {\r\n workerScript.scriptRef.log(\"ERROR: workForFaction() failed because you are in the middle of a mission.\");\r\n return;\r\n }\r\n\r\n if (!factionExists(name)) {\r\n workerScript.scriptRef.log(\"ERROR: Faction specified in workForFaction() does not exist.\");\r\n return false;\r\n }\r\n\r\n if (!Player.factions.includes(name)) {\r\n workerScript.scriptRef.log(\"ERROR: workForFaction() failed because you are not a member of \" + name);\r\n return false;\r\n }\r\n\r\n if (Player.isWorking) {\r\n var txt = Player.singularityStopWork();\r\n if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.workForFaction == null) {\r\n workerScript.scriptRef.log(txt);\r\n }\r\n }\r\n\r\n var fac = Factions[name];\r\n //Arrays listing factions that allow each time of work\r\n var hackAvailable = [\"Illuminati\", \"Daedalus\", \"The Covenant\", \"ECorp\", \"MegaCorp\",\r\n \"Bachman & Associates\", \"Blade Industries\", \"NWO\", \"Clarke Incorporated\",\r\n \"OmniTek Incorporated\", \"Four Sigma\", \"KuaiGong International\",\r\n \"Fulcrum Secret Technologies\", \"BitRunners\", \"The Black Hand\",\r\n \"NiteSec\", \"Chongqing\", \"Sector-12\", \"New Tokyo\", \"Aevum\",\r\n \"Ishima\", \"Volhaven\", \"Speakers for the Dead\", \"The Dark Army\",\r\n \"The Syndicate\", \"Silhouette\", \"Netburners\", \"Tian Di Hui\", \"CyberSec\"];\r\n var fdWkAvailable = [\"Illuminati\", \"Daedalus\", \"The Covenant\", \"ECorp\", \"MegaCorp\",\r\n \"Bachman & Associates\", \"Blade Industries\", \"NWO\", \"Clarke Incorporated\",\r\n \"OmniTek Incorporated\", \"Four Sigma\", \"KuaiGong International\",\r\n \"The Black Hand\", \"Chongqing\", \"Sector-12\", \"New Tokyo\", \"Aevum\",\r\n \"Ishima\", \"Volhaven\", \"Speakers for the Dead\", \"The Dark Army\",\r\n \"The Syndicate\", \"Silhouette\", \"Tetrads\", \"Slum Snakes\"];\r\n var scWkAvailable = [\"ECorp\", \"MegaCorp\",\r\n \"Bachman & Associates\", \"Blade Industries\", \"NWO\", \"Clarke Incorporated\",\r\n \"OmniTek Incorporated\", \"Four Sigma\", \"KuaiGong International\",\r\n \"Fulcrum Secret Technologies\", \"Chongqing\", \"Sector-12\", \"New Tokyo\", \"Aevum\",\r\n \"Ishima\", \"Volhaven\", \"Speakers for the Dead\",\r\n \"The Syndicate\", \"Tetrads\", \"Slum Snakes\", \"Tian Di Hui\"];\r\n\r\n switch (type.toLowerCase()) {\r\n case \"hacking\":\r\n case \"hacking contracts\":\r\n case \"hackingcontracts\":\r\n if (!hackAvailable.includes(fac.name)) {\r\n workerScript.scriptRef.log(\"ERROR: Cannot carry out hacking contracts for \" + fac.name + \". workForFaction() failed\");\r\n return false;\r\n }\r\n Player.startFactionHackWork(fac);\r\n workerScript.scriptRef.log(\"Started carrying out hacking contracts for \" + fac.name);\r\n return true;\r\n case \"field\":\r\n case \"fieldwork\":\r\n case \"field work\":\r\n if (!fdWkAvailable.includes(fac.name)) {\r\n workerScript.scriptRef.log(\"ERROR: Cannot carry out field missions for \" + fac.name + \". workForFaction() failed\");\r\n return false;\r\n }\r\n Player.startFactionFieldWork(fac);\r\n workerScript.scriptRef.log(\"Started carrying out field missions for \" + fac.name);\r\n return true;\r\n case \"security\":\r\n case \"securitywork\":\r\n case \"security work\":\r\n if (!scWkAvailable.includes(fac.name)) {\r\n workerScript.scriptRef.log(\"ERROR: Cannot serve as security detail for \" + fac.name + \". workForFaction() failed\");\r\n return false;\r\n }\r\n Player.startFactionSecurityWork(fac);\r\n workerScript.scriptRef.log(\"Started serving as security details for \" + fac.name);\r\n return true;\r\n default:\r\n workerScript.scriptRef.log(\"ERROR: Invalid work type passed into workForFaction(): \" + type);\r\n }\r\n return true;\r\n },\r\n getFactionRep : function(name) {\r\n var ramCost = CONSTANTS.ScriptSingularityFn2RamCost / 4;\r\n if (Player.bitNodeN !== 4) {ramCost *= 8;}\r\n if (workerScript.checkingRam) {\r\n return updateStaticRam(\"getFactionRep\", ramCost);\r\n }\r\n updateDynamicRam(\"getFactionRep\", ramCost);\r\n if (Player.bitNodeN != 4) {\r\n if (!(hasSingularitySF && singularitySFLvl >= 2)) {\r\n throw makeRuntimeRejectMsg(workerScript, \"Cannot run getFactionRep(). It is a Singularity Function and requires SourceFile-4 (level 2) to run.\");\r\n return -1;\r\n }\r\n }\r\n\r\n if (!factionExists(name)) {\r\n workerScript.scriptRef.log(\"ERROR: Faction specified in getFactionRep() does not exist.\");\r\n return -1;\r\n }\r\n\r\n return Factions[name].playerReputation;\r\n },\r\n getFactionFavor : function(name) {\r\n var ramCost = CONSTANTS.ScriptSingularityFn2RamCost;\r\n if (Player.bitNodeN !== 4) {ramCost *= 8;}\r\n if (workerScript.checkingRam) {\r\n return updateStaticRam(\"getFactionFavor\", ramCost);\r\n }\r\n updateDynamicRam(\"getFactionFavor\", ramCost);\r\n if (Player.bitNodeN != 4) {\r\n if (!(hasSingularitySF && singularitySFLvl >= 2)) {\r\n throw makeRuntimeRejectMsg(workerScript, \"Cannot run getFactionFavor(). It is a Singularity Function and requires SourceFile-4 (level 2) to run.\");\r\n return -1;\r\n }\r\n }\r\n\r\n if (!factionExists(name)) {\r\n workerScript.scriptRef.log(\"ERROR: Faction specified in getFactionFavor() does not exist.\");\r\n return -1;\r\n }\r\n\r\n return Factions[name].favor;\r\n },\r\n createProgram : function(name) {\r\n var ramCost = CONSTANTS.ScriptSingularityFn3RamCost;\r\n if (Player.bitNodeN !== 4) {ramCost *= 8;}\r\n if (workerScript.checkingRam) {\r\n return updateStaticRam(\"createProgram\", ramCost);\r\n }\r\n updateDynamicRam(\"createProgram\", ramCost);\r\n if (Player.bitNodeN != 4) {\r\n if (!(hasSingularitySF && singularitySFLvl >= 3)) {\r\n throw makeRuntimeRejectMsg(workerScript, \"Cannot run createProgram(). It is a Singularity Function and requires SourceFile-4 (level 3) to run.\");\r\n return false;\r\n }\r\n }\r\n if (inMission) {\r\n workerScript.scriptRef.log(\"ERROR: createProgram() failed because you are in the middle of a mission.\");\r\n return;\r\n }\r\n if (Player.isWorking) {\r\n var txt = Player.singularityStopWork();\r\n if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.createProgram == null) {\r\n workerScript.scriptRef.log(txt);\r\n }\r\n }\r\n\r\n switch(name.toLowerCase()) {\r\n case Programs.NukeProgram.toLowerCase():\r\n Player.startCreateProgramWork(Programs.NukeProgram, CONSTANTS.MillisecondsPerFiveMinutes, 1);\r\n break;\r\n case Programs.BruteSSHProgram.toLowerCase():\r\n if (Player.hacking_skill < 50) {\r\n workerScript.scriptRef.log(\"ERROR: createProgram() failed because hacking level is too low to create BruteSSH (level 50 req)\");\r\n return false;\r\n }\r\n Player.startCreateProgramWork(Programs.BruteSSHProgram, CONSTANTS.MillisecondsPerFiveMinutes * 2, 50);\r\n break;\r\n case Programs.FTPCrackProgram.toLowerCase():\r\n if (Player.hacking_skill < 100) {\r\n workerScript.scriptRef.log(\"ERROR: createProgram() failed because hacking level is too low to create FTPCrack (level 100 req)\");\r\n return false;\r\n }\r\n Player.startCreateProgramWork(Programs.FTPCrackProgram, CONSTANTS.MillisecondsPerHalfHour, 100);\r\n break;\r\n case Programs.RelaySMTPProgram.toLowerCase():\r\n if (Player.hacking_skill < 250) {\r\n workerScript.scriptRef.log(\"ERROR: createProgram() failed because hacking level is too low to create relaySMTP (level 250 req)\");\r\n return false;\r\n }\r\n Player.startCreateProgramWork(Programs.RelaySMTPProgram, CONSTANTS.MillisecondsPer2Hours, 250);\r\n break;\r\n case Programs.HTTPWormProgram.toLowerCase():\r\n if (Player.hacking_skill < 500) {\r\n workerScript.scriptRef.log(\"ERROR: createProgram() failed because hacking level is too low to create HTTPWorm (level 500 req)\");\r\n return false;\r\n }\r\n Player.startCreateProgramWork(Programs.HTTPWormProgram, CONSTANTS.MillisecondsPer4Hours, 500);\r\n break;\r\n case Programs.SQLInjectProgram.toLowerCase():\r\n if (Player.hacking_skill < 750) {\r\n workerScript.scriptRef.log(\"ERROR: createProgram() failed because hacking level is too low to create SQLInject (level 750 req)\");\r\n return false;\r\n }\r\n Player.startCreateProgramWork(Programs.SQLInjectProgram, CONSTANTS.MillisecondsPer8Hours, 750);\r\n break;\r\n case Programs.DeepscanV1.toLowerCase():\r\n if (Player.hacking_skill < 75) {\r\n workerScript.scriptRef.log(\"ERROR: createProgram() failed because hacking level is too low to create DeepscanV1 (level 75 req)\");\r\n return false;\r\n }\r\n Player.startCreateProgramWork(Programs.DeepscanV1, CONSTANTS.MillisecondsPerQuarterHour, 75);\r\n break;\r\n case Programs.DeepscanV2.toLowerCase():\r\n if (Player.hacking_skill < 400) {\r\n workerScript.scriptRef.log(\"ERROR: createProgram() failed because hacking level is too low to create DeepscanV2 (level 400 req)\");\r\n return false;\r\n }\r\n Player.startCreateProgramWork(Programs.DeepscanV2, CONSTANTS.MillisecondsPer2Hours, 400);\r\n break;\r\n case Programs.ServerProfiler.toLowerCase():\r\n if (Player.hacking_skill < 75) {\r\n workerScript.scriptRef.log(\"ERROR: createProgram() failed because hacking level is too low to create ServerProfiler (level 75 req)\");\r\n return false;\r\n }\r\n Player.startCreateProgramWork(Programs.ServerProfiler, CONSTANTS.MillisecondsPerHalfHour, 75);\r\n break;\r\n case Programs.AutoLink.toLowerCase():\r\n if (Player.hacking_skill < 25) {\r\n workerScript.scriptRef.log(\"ERROR: createProgram() failed because hacking level is too low to create AutoLink (level 25 req)\");\r\n return false;\r\n }\r\n Player.startCreateProgramWork(Programs.AutoLink, CONSTANTS.MillisecondsPerQuarterHour, 25);\r\n break;\r\n default:\r\n workerScript.scriptRef.log(\"ERROR: createProgram() failed because the specified program does not exist: \" + name);\r\n return false;\r\n }\r\n workerScript.scriptRef.log(\"Began creating program: \" + name);\r\n return true;\r\n },\r\n commitCrime : function(crimeRoughName) {\r\n var ramCost = CONSTANTS.ScriptSingularityFn3RamCost;\r\n if (Player.bitNodeN !== 4) {ramCost *= 8;}\r\n if (workerScript.checkingRam) {\r\n return updateStaticRam(\"commitCrime\", ramCost);\r\n }\r\n updateDynamicRam(\"commitCrime\", ramCost);\r\n if (Player.bitNodeN != 4) {\r\n if (!(hasSingularitySF && singularitySFLvl >= 3)) {\r\n throw makeRuntimeRejectMsg(workerScript, \"Cannot run commitCrime(). It is a Singularity Function and requires SourceFile-4 (level 3) to run.\");\r\n return;\r\n }\r\n }\r\n if (inMission) {\r\n workerScript.scriptRef.log(\"ERROR: commitCrime() failed because you are in the middle of a mission.\");\r\n return;\r\n }\r\n if (Player.isWorking) {\r\n var txt = Player.singularityStopWork();\r\n if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.commitCrime == null) {\r\n workerScript.scriptRef.log(txt);\r\n }\r\n }\r\n\r\n //Set Location to slums\r\n switch(Player.city) {\r\n case Locations.Aevum:\r\n Player.location = Locations.AevumSlums;\r\n break;\r\n case Locations.Chongqing:\r\n Player.location = Locations.ChongqingSlums;\r\n break;\r\n case Locations.Sector12:\r\n Player.location = Locations.Sector12Slums;\r\n break;\r\n case Locations.NewTokyo:\r\n Player.location = Locations.NewTokyoSlums;\r\n break;\r\n case Locations.Ishima:\r\n Player.location = Locations.IshimaSlums;\r\n break;\r\n case Locations.Volhaven:\r\n Player.location = Locations.VolhavenSlums;\r\n break;\r\n default:\r\n console.log(\"Invalid Player.city value\");\r\n }\r\n\r\n const crime = findCrime(crimeRoughName.toLowerCase());\r\n if(crime == null) { // couldn't find crime\r\n throw makeRuntimeRejectMsg(workerScript, \"Invalid crime passed into commitCrime(): \" + crime);\r\n }\r\n if(workerScript.disableLogs.ALL == null && workerScript.disableLogs.commitCrime == null) {\r\n workerScript.scriptRef.log(\"Attempting to commit crime: \"+crime.name+\"...\");\r\n }\r\n return crime.commit(CONSTANTS.CrimeSingFnDivider, {workerscript: workerScript});\r\n },\r\n getCrimeChance : function(crimeRoughName) {\r\n var ramCost = CONSTANTS.ScriptSingularityFn3RamCost;\r\n if (Player.bitNodeN !== 4) {ramCost *= 8;}\r\n if (workerScript.checkingRam) {\r\n return updateStaticRam(\"getCrimeChance\", ramCost);\r\n }\r\n updateDynamicRam(\"getCrimeChance\", ramCost);\r\n if (Player.bitNodeN != 4) {\r\n if (!(hasSingularitySF && singularitySFLvl >= 3)) {\r\n throw makeRuntimeRejectMsg(workerScript, \"Cannot run getCrimeChance(). It is a Singularity Function and requires SourceFile-4 (level 3) to run.\");\r\n return;\r\n }\r\n }\r\n\r\n const crime = findCrime(crimeRoughName.toLowerCase());\r\n if(crime == null) {\r\n throw makeRuntimeRejectMsg(workerScript, \"Invalid crime passed into getCrimeChance(): \" + crime);\r\n }\r\n\r\n return crime.successRate();\r\n },\r\n getOwnedAugmentations : function(purchased=false) {\r\n var ramCost = CONSTANTS.ScriptSingularityFn3RamCost;\r\n if (Player.bitNodeN !== 4) {ramCost *= 8;}\r\n if (workerScript.checkingRam) {\r\n return updateStaticRam(\"getOwnedAugmentations\", ramCost);\r\n }\r\n updateDynamicRam(\"getOwnedAugmentations\", ramCost);\r\n if (Player.bitNodeN != 4) {\r\n if (!(hasSingularitySF && singularitySFLvl >= 3)) {\r\n throw makeRuntimeRejectMsg(workerScript, \"Cannot run getOwnedAugmentations(). It is a Singularity Function and requires SourceFile-4 (level 3) to run.\");\r\n return [];\r\n }\r\n }\r\n var res = [];\r\n for (var i = 0; i < Player.augmentations.length; ++i) {\r\n res.push(Player.augmentations[i].name);\r\n }\r\n if (purchased) {\r\n for (var i = 0; i < Player.queuedAugmentations.length; ++i) {\r\n res.push(Player.queuedAugmentations[i].name);\r\n }\r\n }\r\n return res;\r\n },\r\n getAugmentationsFromFaction : function(facname) {\r\n var ramCost = CONSTANTS.ScriptSingularityFn3RamCost;\r\n if (Player.bitNodeN !== 4) {ramCost *= 8;}\r\n if (workerScript.checkingRam) {\r\n return updateStaticRam(\"getAugmentationsFromFaction\", ramCost);\r\n }\r\n updateDynamicRam(\"getAugmentationsFromFaction\", ramCost);\r\n if (Player.bitNodeN != 4) {\r\n if (!(hasSingularitySF && singularitySFLvl >= 3)) {\r\n throw makeRuntimeRejectMsg(workerScript, \"Cannot run getAugmentationsFromFaction(). It is a Singularity Function and requires SourceFile-4 (level 3) to run.\");\r\n return [];\r\n }\r\n }\r\n\r\n if (!factionExists(facname)) {\r\n workerScript.scriptRef.log(\"ERROR: getAugmentationsFromFaction() failed. Invalid faction name passed in (this is case-sensitive): \" + facname);\r\n return [];\r\n }\r\n\r\n var fac = Factions[facname];\r\n var res = [];\r\n for (var i = 0; i < fac.augmentations.length; ++i) {\r\n res.push(fac.augmentations[i]);\r\n }\r\n return res;\r\n },\r\n getAugmentationCost : function(name) {\r\n var ramCost = CONSTANTS.ScriptSingularityFn3RamCost;\r\n if (Player.bitNodeN !== 4) {ramCost *= 8;}\r\n if (workerScript.checkingRam) {\r\n return updateStaticRam(\"getAugmentationCost\", ramCost);\r\n }\r\n updateDynamicRam(\"getAugmentationCost\", ramCost);\r\n if (Player.bitNodeN != 4) {\r\n if (!(hasSingularitySF && singularitySFLvl >= 3)) {\r\n throw makeRuntimeRejectMsg(workerScript, \"Cannot run getAugmentationCost(). It is a Singularity Function and requires SourceFile-4 (level 3) to run.\");\r\n return false;\r\n }\r\n }\r\n\r\n if (!augmentationExists(name)) {\r\n workerScript.scriptRef.log(\"ERROR: getAugmentationCost() failed. Invalid Augmentation name passed in (note: this is case-sensitive): \" + name);\r\n return [-1, -1];\r\n }\r\n\r\n var aug = Augmentations[name];\r\n return [aug.baseRepRequirement, aug.baseCost];\r\n },\r\n purchaseAugmentation : function(faction, name) {\r\n var ramCost = CONSTANTS.ScriptSingularityFn3RamCost;\r\n if (Player.bitNodeN !== 4) {ramCost *= 8;}\r\n if (workerScript.checkingRam) {\r\n return updateStaticRam(\"purchaseAugmentation\", ramCost);\r\n }\r\n updateDynamicRam(\"purchaseAugmentation\", ramCost);\r\n if (Player.bitNodeN != 4) {\r\n if (!(hasSingularitySF && singularitySFLvl >= 3)) {\r\n throw makeRuntimeRejectMsg(workerScript, \"Cannot run purchaseAugmentation(). It is a Singularity Function and requires SourceFile-4 (level 3) to run.\");\r\n return false;\r\n }\r\n }\r\n\r\n var fac = Factions[faction];\r\n if (fac == null || !(fac instanceof Faction)) {\r\n workerScript.scriptRef.log(\"ERROR: purchaseAugmentation() failed because of invalid faction name: \" + faction);\r\n return false;\r\n }\r\n\r\n if (!fac.augmentations.includes(name)) {\r\n workerScript.scriptRef.log(\"ERROR: purchaseAugmentation() failed because the faction \" + faction + \" does not contain the \" + name + \" augmentation\");\r\n return false;\r\n }\r\n\r\n var aug = Augmentations[name];\r\n if (aug == null || !(aug instanceof Augmentation)) {\r\n workerScript.scriptRef.log(\"ERROR: purchaseAugmentation() failed because of invalid augmentation name: \" + name);\r\n return false;\r\n }\r\n\r\n var isNeuroflux = false;\r\n if (aug.name === AugmentationNames.NeuroFluxGovernor) {\r\n isNeuroflux = true;\r\n }\r\n\r\n if (!isNeuroflux) {\r\n for (var j = 0; j < Player.queuedAugmentations.length; ++j) {\r\n if (Player.queuedAugmentations[j].name === aug.name) {\r\n workerScript.scriptRef.log(\"ERROR: purchaseAugmentation() failed because you already have \" + name);\r\n return false;\r\n }\r\n }\r\n for (var j = 0; j < Player.augmentations.length; ++j) {\r\n if (Player.augmentations[j].name === aug.name) {\r\n workerScript.scriptRef.log(\"ERROR: purchaseAugmentation() failed because you already have \" + name);\r\n return false;\r\n }\r\n }\r\n }\r\n\r\n if (fac.playerReputation < aug.baseRepRequirement) {\r\n workerScript.scriptRef.log(\"ERROR: purchaseAugmentation() failed because you do not have enough reputation with \" + fac.name);\r\n return false;\r\n }\r\n\r\n var res = purchaseAugmentation(aug, fac, true);\r\n workerScript.scriptRef.log(res);\r\n if (isString(res) && res.startsWith(\"You purchased\")) {\r\n Player.gainIntelligenceExp(CONSTANTS.IntelligenceSingFnBaseExpGain);\r\n return true;\r\n } else {\r\n return false;\r\n }\r\n },\r\n installAugmentations : function(cbScript) {\r\n var ramCost = CONSTANTS.ScriptSingularityFn3RamCost;\r\n if (Player.bitNodeN !== 4) {ramCost *= 8;}\r\n if (workerScript.checkingRam) {\r\n return updateStaticRam(\"installAugmentations\", ramCost);\r\n }\r\n updateDynamicRam(\"installAugmentations\", ramCost);\r\n if (Player.bitNodeN != 4) {\r\n if (!(hasSingularitySF && singularitySFLvl >= 3)) {\r\n throw makeRuntimeRejectMsg(workerScript, \"Cannot run installAugmentations(). It is a Singularity Function and requires SourceFile-4 (level 3) to run.\");\r\n return false;\r\n }\r\n }\r\n\r\n if (Player.queuedAugmentations.length === 0) {\r\n workerScript.scriptRef.log(\"ERROR: installAugmentations() failed because you do not have any Augmentations to be installed\");\r\n return false;\r\n }\r\n Player.gainIntelligenceExp(CONSTANTS.IntelligenceSingFnBaseExpGain);\r\n workerScript.scriptRef.log(\"Installing Augmentations. This will cause this script to be killed\");\r\n installAugmentations(cbScript);\r\n return true;\r\n },\r\n\r\n //Bladeburner API\r\n bladeburner : {\r\n isContractName : function(name) {\r\n if (workerScript.checkingRam) {\r\n return updateStaticRam(\"isContractName\", CONSTANTS.ScriptBladeburnerApiBaseRamCost / 10);\r\n }\r\n updateDynamicRam(\"isContractName\", CONSTANTS.ScriptBladeburnerApiBaseRamCost / 10);\r\n if (Player.bladeburner instanceof Bladeburner && (Player.bitNodeN === 7 || hasBladeburner2079SF)) {\r\n return Player.bladeburner.isContractNameNetscriptFn(name);\r\n }\r\n throw makeRuntimeRejectMsg(workerScript, \"isContractName() failed because you do not currently have access to the Bladeburner API. This is either because you are not currently employed \" +\r\n \"at the Bladeburner division or because you do not have Source-File 7\");\r\n },\r\n isOperationName : function(name) {\r\n if (workerScript.checkingRam) {\r\n return updateStaticRam(\"isOperationName\", CONSTANTS.ScriptBladeburnerApiBaseRamCost / 10);\r\n }\r\n updateDynamicRam(\"isOperationName\", CONSTANTS.ScriptBladeburnerApiBaseRamCost / 10);\r\n if (Player.bladeburner instanceof Bladeburner && (Player.bitNodeN === 7 || hasBladeburner2079SF)) {\r\n return Player.bladeburner.isOperationNameNetscriptFn(name);\r\n }\r\n throw makeRuntimeRejectMsg(workerScript, \"isOperationName() failed because you do not currently have access to the Bladeburner API. This is either because you are not currently employed \" +\r\n \"at the Bladeburner division or because you do not have Source-File 7\");\r\n },\r\n isBlackOpName : function(name) {\r\n if (workerScript.checkingRam) {\r\n return updateStaticRam(\"isBlackOpName\", CONSTANTS.ScriptBladeburnerApiBaseRamCost / 10);\r\n }\r\n updateDynamicRam(\"isBlackOpName\", CONSTANTS.ScriptBladeburnerApiBaseRamCost / 10);\r\n if (Player.bladeburner instanceof Bladeburner && (Player.bitNodeN === 7 || hasBladeburner2079SF)) {\r\n return Player.bladeburner.isBlackOpNameNetscriptFn(name);\r\n }\r\n throw makeRuntimeRejectMsg(workerScript, \"isBlackOpName() failed because you do not currently have access to the Bladeburner API. This is either because you are not currently employed \" +\r\n \"at the Bladeburner division or because you do not have Source-File 7\");\r\n },\r\n isGeneralActionName : function(name) {\r\n if (workerScript.checkingRam) {\r\n return updateStaticRam(\"isGeneralActionName\", CONSTANTS.ScriptBladeburnerApiBaseRamCost / 10);\r\n }\r\n updateDynamicRam(\"isGeneralActionName\", CONSTANTS.ScriptBladeburnerApiBaseRamCost / 10);\r\n if (Player.bladeburner instanceof Bladeburner && (Player.bitNodeN === 7 || hasBladeburner2079SF)) {\r\n return Player.bladeburner.isGeneralActionNameNetscriptFn(name);\r\n }\r\n throw makeRuntimeRejectMsg(workerScript, \"isGeneralActionName() failed because you do not currently have access to the Bladeburner API. This is either because you are not currently employed \" +\r\n \"at the Bladeburner division or because you do not have Source-File 7\");\r\n },\r\n isSkillName : function(name) {\r\n if (workerScript.checkingRam) {\r\n return updateStaticRam(\"isSkillName\", CONSTANTS.ScriptBladeburnerApiBaseRamCost / 10);\r\n }\r\n updateDynamicRam(\"isSkillName\", CONSTANTS.ScriptBladeburnerApiBaseRamCost / 10);\r\n if (Player.bladeburner instanceof Bladeburner && (Player.bitNodeN === 7 || hasBladeburner2079SF)) {\r\n return Player.bladeburner.isSkillNameNetscriptFn(name);\r\n }\r\n throw makeRuntimeRejectMsg(workerScript, \"isSkillName() failed because you do not currently have access to the Bladeburner API. This is either because you are not currently employed \" +\r\n \"at the Bladeburner division or because you do not have Source-File 7\");\r\n },\r\n startAction : function(type=\"\", name=\"\") {\r\n if (workerScript.checkingRam) {\r\n return updateStaticRam(\"startAction\", CONSTANTS.ScriptBladeburnerApiBaseRamCost);\r\n }\r\n updateDynamicRam(\"startAction\", CONSTANTS.ScriptBladeburnerApiBaseRamCost);\r\n if (Player.bladeburner instanceof Bladeburner && (Player.bitNodeN === 7 || hasBladeburner2079SF)) {\r\n try {\r\n return Player.bladeburner.startActionNetscriptFn(type, name, workerScript);\r\n } catch(e) {\r\n throw makeRuntimeRejectMsg(workerScript, \"Bladeburner.startAction() failed with exception: \" + e);\r\n }\r\n }\r\n throw makeRuntimeRejectMsg(workerScript, \"startAction() failed because you do not currently have access to the Bladeburner API. This is either because you are not currently employed \" +\r\n \"at the Bladeburner division or because you do not have Source-File 7\");\r\n },\r\n stopAction : function() {\r\n if (workerScript.checkingRam) {\r\n return updateStaticRam(\"stopAction\", CONSTANTS.ScriptBladeburnerApiBaseRamCost / 2);\r\n }\r\n updateDynamicRam(\"stopAction\", CONSTANTS.ScriptBladeburnerApiBaseRamCost / 2);\r\n if (Player.bladeburner instanceof Bladeburner && (Player.bitNodeN === 7 || hasBladeburner2079SF)) {\r\n return Player.bladeburner.resetAction();\r\n }\r\n throw makeRuntimeRejectMsg(workerScript, \"stopAction() failed because you do not currently have access to the Bladeburner API. This is either because you are not currently employed \" +\r\n \"at the Bladeburner division or because you do not have Source-File 7\");\r\n },\r\n getActionTime : function(type=\"\", name=\"\") {\r\n if (workerScript.checkingRam) {\r\n return updateStaticRam(\"getActionTime\", CONSTANTS.ScriptBladeburnerApiBaseRamCost);\r\n }\r\n updateDynamicRam(\"getActionTime\", CONSTANTS.ScriptBladeburnerApiBaseRamCost);\r\n if (Player.bladeburner instanceof Bladeburner && (Player.bitNodeN === 7 || hasBladeburner2079SF)) {\r\n try {\r\n return Player.bladeburner.getActionTimeNetscriptFn(type, name, workerScript);\r\n } catch(e) {\r\n throw makeRuntimeRejectMsg(workerScript, \"Bladeburner.getActionTime() failed with exception: \" + e);\r\n }\r\n }\r\n throw makeRuntimeRejectMsg(workerScript, \"getActionTime() failed because you do not currently have access to the Bladeburner API. This is either because you are not currently employed \" +\r\n \"at the Bladeburner division or because you do not have Source-File 7\");\r\n },\r\n getActionEstimatedSuccessChance : function(type=\"\", name=\"\") {\r\n if (workerScript.checkingRam) {\r\n return updateStaticRam(\"getActionEstimatedSuccessChance\", CONSTANTS.ScriptBladeburnerApiBaseRamCost);\r\n }\r\n updateDynamicRam(\"getActionEstimatedSuccessChance\", CONSTANTS.ScriptBladeburnerApiBaseRamCost);\r\n if (Player.bladeburner instanceof Bladeburner && (Player.bitNodeN === 7 || hasBladeburner2079SF)) {\r\n try {\r\n return Player.bladeburner.getActionEstimatedSuccessChanceNetscriptFn(type, name, workerScript);\r\n } catch(e) {\r\n throw makeRuntimeRejectMsg(workerScript, \"Bladeburner.getActionEstimatedSuccessChance() failed with exception: \" + e);\r\n }\r\n }\r\n throw makeRuntimeRejectMsg(workerScript, \"getActionEstimatedSuccessChance() failed because you do not currently have access to the Bladeburner API. This is either because you are not currently employed \" +\r\n \"at the Bladeburner division or because you do not have Source-File 7\");\r\n },\r\n getActionCountRemaining : function(type=\"\", name=\"\") {\r\n if (workerScript.checkingRam) {\r\n return updateStaticRam(\"getActionCountRemaining\", CONSTANTS.ScriptBladeburnerApiBaseRamCost);\r\n }\r\n updateDynamicRam(\"getActionCountRemaining\", CONSTANTS.ScriptBladeburnerApiBaseRamCost);\r\n if (Player.bladeburner instanceof Bladeburner && (Player.bitNodeN === 7 || hasBladeburner2079SF)) {\r\n try {\r\n return Player.bladeburner.getActionCountRemainingNetscriptFn(type, name, workerScript);\r\n } catch(e) {\r\n throw makeRuntimeRejectMsg(workerScript, \"Bladeburner.getActionCountRemaining() failed with exception: \" + e);\r\n }\r\n }\r\n throw makeRuntimeRejectMsg(workerScript, \"getActionCountRemaining() failed because you do not currently have access to the Bladeburner API. This is either because you are not currently employed \" +\r\n \"at the Bladeburner division or because you do not have Source-File 7\");\r\n },\r\n getRank : function() {\r\n if (workerScript.checkingRam) {\r\n return updateStaticRam(\"getRank\", CONSTANTS.ScriptBladeburnerApiBaseRamCost);\r\n }\r\n updateDynamicRam(\"getRank\", CONSTANTS.ScriptBladeburnerApiBaseRamCost);\r\n if (Player.bladeburner instanceof Bladeburner && (Player.bitNodeN === 7 || hasBladeburner2079SF)) {\r\n return Player.bladeburner.rank;\r\n }\r\n throw makeRuntimeRejectMsg(workerScript, \"getRank() failed because you do not currently have access to the Bladeburner API. This is either because you are not currently employed \" +\r\n \"at the Bladeburner division or because you do not have Source-File 7\");\r\n },\r\n getSkillPoints : function() {\r\n if (workerScript.checkingRam) {\r\n return updateStaticRam(\"getSkillPoints\", CONSTANTS.ScriptBladeburnerApiBaseRamCost);\r\n }\r\n updateDynamicRam(\"getSkillPoints\", CONSTANTS.ScriptBladeburnerApiBaseRamCost);\r\n if (Player.bladeburner instanceof Bladeburner && (Player.bitNodeN === 7 || hasBladeburner2079SF)) {\r\n return Player.bladeburner.skillPoints;\r\n }\r\n throw makeRuntimeRejectMsg(workerScript, \"getSkillPoints() failed because you do not currently have access to the Bladeburner API. This is either because you are not currently employed \" +\r\n \"at the Bladeburner division or because you do not have Source-File 7\");\r\n },\r\n getSkillLevel : function(skillName=\"\") {\r\n if (workerScript.checkingRam) {\r\n return updateStaticRam(\"getSkillLevel\", CONSTANTS.ScriptBladeburnerApiBaseRamCost);\r\n }\r\n updateDynamicRam(\"getSkillLevel\", CONSTANTS.ScriptBladeburnerApiBaseRamCost);\r\n if (Player.bladeburner instanceof Bladeburner && (Player.bitNodeN === 7 || hasBladeburner2079SF)) {\r\n try {\r\n return Player.bladeburner.getSkillLevelNetscriptFn(skillName, workerScript);\r\n } catch(e) {\r\n throw makeRuntimeRejectMsg(workerScript, \"Bladeburner.getSkillLevel() failed with exception: \" + e);\r\n }\r\n }\r\n throw makeRuntimeRejectMsg(workerScript, \"getSkillLevel() failed because you do not currently have access to the Bladeburner API. This is either because you are not currently employed \" +\r\n \"at the Bladeburner division or because you do not have Source-File 7\");\r\n },\r\n upgradeSkill : function(skillName) {\r\n if (workerScript.checkingRam) {\r\n return updateStaticRam(\"upgradeSkill\", CONSTANTS.ScriptBladeburnerApiBaseRamCost);\r\n }\r\n updateDynamicRam(\"upgradeSkill\", CONSTANTS.ScriptBladeburnerApiBaseRamCost);\r\n if (Player.bladeburner instanceof Bladeburner && (Player.bitNodeN === 7 || hasBladeburner2079SF)) {\r\n try {\r\n return Player.bladeburner.upgradeSkillNetscriptFn(skillName, workerScript);\r\n } catch(e) {\r\n throw makeRuntimeRejectMsg(workerScript, \"Bladeburner.upgradeSkill() failed with exception: \" + e);\r\n }\r\n }\r\n throw makeRuntimeRejectMsg(workerScript, \"upgradeSkill() failed because you do not currently have access to the Bladeburner API. This is either because you are not currently employed \" +\r\n \"at the Bladeburner division or because you do not have Source-File 7\");\r\n },\r\n getTeamSize : function(type=\"\", name=\"\") {\r\n if (workerScript.checkingRam) {\r\n return updateStaticRam(\"getTeamSize\", CONSTANTS.ScriptBladeburnerApiBaseRamCost);\r\n }\r\n updateDynamicRam(\"getTeamSize\", CONSTANTS.ScriptBladeburnerApiBaseRamCost);\r\n if (Player.bladeburner instanceof Bladeburner && (Player.bitNodeN === 7 || hasBladeburner2079SF)) {\r\n try {\r\n return Player.bladeburner.getTeamSizeNetscriptFn(type, name, workerScript);\r\n } catch(e) {\r\n throw makeRuntimeRejectMsg(workerScript, \"Bladeburner.getTeamSize() failed with exception: \" + e);\r\n }\r\n }\r\n throw makeRuntimeRejectMsg(workerScript, \"getTeamSize() failed because you do not currently have access to the Bladeburner API. This is either because you are not currently employed \" +\r\n \"at the Bladeburner division or because you do not have Source-File 7\");\r\n },\r\n setTeamSize : function(type=\"\", name=\"\", size) {\r\n if (workerScript.checkingRam) {\r\n return updateStaticRam(\"setTeamSize\", CONSTANTS.ScriptBladeburnerApiBaseRamCost);\r\n }\r\n updateDynamicRam(\"setTeamSize\", CONSTANTS.ScriptBladeburnerApiBaseRamCost);\r\n if (Player.bladeburner instanceof Bladeburner && (Player.bitNodeN === 7 || hasBladeburner2079SF)) {\r\n try {\r\n return Player.bladeburner.setTeamSizeNetscriptFn(type, name, size, workerScript);\r\n } catch(e) {\r\n throw makeRuntimeRejectMsg(workerScript, \"Bladeburner.setTeamSize() failed with exception: \" + e);\r\n }\r\n }\r\n throw makeRuntimeRejectMsg(workerScript, \"setTeamSize() failed because you do not currently have access to the Bladeburner API. This is either because you are not currently employed \" +\r\n \"at the Bladeburner division or because you do not have Source-File 7\");\r\n },\r\n getCityEstimatedPopulation : function(cityName) {\r\n if (workerScript.checkingRam) {\r\n return updateStaticRam(\"getCityEstimatedPopulation\", CONSTANTS.ScriptBladeburnerApiBaseRamCost);\r\n }\r\n updateDynamicRam(\"getCityEstimatedPopulation\", CONSTANTS.ScriptBladeburnerApiBaseRamCost);\r\n if (Player.bladeburner instanceof Bladeburner && (Player.bitNodeN === 7 || hasBladeburner2079SF)) {\r\n try {\r\n return Player.bladeburner.getCityEstimatedPopulationNetscriptFn(cityName, workerScript);\r\n } catch(e) {\r\n throw makeRuntimeRejectMsg(workerScript, \"Bladeburner.getCityEstimatedPopulation() failed with exception: \" + e);\r\n }\r\n }\r\n throw makeRuntimeRejectMsg(workerScript, \"getCityEstimatedPopulation() failed because you do not currently have access to the Bladeburner API. This is either because you are not currently employed \" +\r\n \"at the Bladeburner division or because you do not have Source-File 7\");\r\n },\r\n getCityEstimatedCommunities : function(cityName) {\r\n if (workerScript.checkingRam) {\r\n return updateStaticRam(\"getCityEstimatedCommunities\", CONSTANTS.ScriptBladeburnerApiBaseRamCost);\r\n }\r\n updateDynamicRam(\"getCityEstimatedCommunities\", CONSTANTS.ScriptBladeburnerApiBaseRamCost);\r\n if (Player.bladeburner instanceof Bladeburner && (Player.bitNodeN === 7 || hasBladeburner2079SF)) {\r\n try {\r\n return Player.bladeburner.getCityEstimatedCommunitiesNetscriptFn(cityName, workerScript);\r\n } catch(e) {\r\n throw makeRuntimeRejectMsg(workerScript, \"Bladeburner.getCityEstimatedCommunities() failed with exception: \" + e);\r\n }\r\n }\r\n throw makeRuntimeRejectMsg(workerScript, \"getCityEstimatedCommunities() failed because you do not currently have access to the Bladeburner API. This is either because you are not currently employed \" +\r\n \"at the Bladeburner division or because you do not have Source-File 7\");\r\n },\r\n getCityChaos : function(cityName) {\r\n if (workerScript.checkingRam) {\r\n return updateStaticRam(\"getCityChaos\", CONSTANTS.ScriptBladeburnerApiBaseRamCost);\r\n }\r\n updateDynamicRam(\"getCityChaos\", CONSTANTS.ScriptBladeburnerApiBaseRamCost);\r\n if (Player.bladeburner instanceof Bladeburner && (Player.bitNodeN === 7 || hasBladeburner2079SF)) {\r\n try {\r\n return Player.bladeburner.getCityChaosNetscriptFn(cityName, workerScript);\r\n } catch(e) {\r\n throw makeRuntimeRejectMsg(workerScript, \"Bladeburner.getCityChaos() failed with exception: \" + e);\r\n }\r\n }\r\n throw makeRuntimeRejectMsg(workerScript, \"getCityChaos() failed because you do not currently have access to the Bladeburner API. This is either because you are not currently employed \" +\r\n \"at the Bladeburner division or because you do not have Source-File 7\");\r\n },\r\n switchCity : function(cityName) {\r\n if (workerScript.checkingRam) {\r\n return updateStaticRam(\"switchCity\", CONSTANTS.ScriptBladeburnerApiBaseRamCost);\r\n }\r\n updateDynamicRam(\"switchCity\", CONSTANTS.ScriptBladeburnerApiBaseRamCost);\r\n if (Player.bladeburner instanceof Bladeburner && (Player.bitNodeN === 7 || hasBladeburner2079SF)) {\r\n try {\r\n return Player.bladeburner.switchCityNetscriptFn(cityName, workerScript);\r\n } catch(e) {\r\n throw makeRuntimeRejectMsg(workerScript, \"Bladeburner.switchCity() failed with exception: \" + e);\r\n }\r\n }\r\n throw makeRuntimeRejectMsg(workerScript, \"switchCity() failed because you do not currently have access to the Bladeburner API. This is either because you are not currently employed \" +\r\n \"at the Bladeburner division or because you do not have Source-File 7\");\r\n },\r\n getStamina : function() {\r\n if (workerScript.checkingRam) {\r\n return updateStaticRam(\"getStamina\", CONSTANTS.ScriptBladeburnerApiBaseRamCost);\r\n }\r\n updateDynamicRam(\"getStamina\", CONSTANTS.ScriptBladeburnerApiBaseRamCost);\r\n if (Player.bladeburner instanceof Bladeburner && (Player.bitNodeN === 7 || hasBladeburner2079SF)) {\r\n return [Player.bladeburner.stamina, Player.bladeburner.maxStamina];\r\n }\r\n throw makeRuntimeRejectMsg(workerScript, \"getStamina() failed because you do not currently have access to the Bladeburner API. This is either because you are not currently employed \" +\r\n \"at the Bladeburner division or because you do not have Source-File 7\");\r\n },\r\n joinBladeburnerFaction : function() {\r\n if (workerScript.checkingRam) {\r\n return updateStaticRam(\"joinBladeburnerFaction\", CONSTANTS.ScriptBladeburnerApiBaseRamCost);\r\n }\r\n updateDynamicRam(\"joinBladeburnerFaction\", CONSTANTS.ScriptBladeburnerApiBaseRamCost);\r\n if (Player.bladeburner instanceof Bladeburner && (Player.bitNodeN === 7 || hasBladeburner2079SF)) {\r\n return Player.bladeburner.joinBladeburnerFactionNetscriptFn(workerScript);\r\n }\r\n throw makeRuntimeRejectMsg(workerScript, \"joinBladeburnerFaction() failed because you do not currently have access to the Bladeburner API. This is either because you are not currently employed \" +\r\n \"at the Bladeburner division or because you do not have Source-File 7\");\r\n }\r\n }\r\n } //End return\r\n} //End NetscriptFunction()\r\n\r\nexport {NetscriptFunctions, initSingularitySFFlags, hasSingularitySF, hasBn11SF,\r\n hasWallStreetSF, wallStreetSFLvl, hasCorporationSF, hasAISF, hasBladeburnerSF};\r\n","'use strict';\n\nvar support = require('./support');\nvar base64 = require('./base64');\nvar nodejsUtils = require('./nodejsUtils');\nvar setImmediate = require('core-js/library/fn/set-immediate');\nvar external = require(\"./external\");\n\n\n/**\n * Convert a string that pass as a \"binary string\": it should represent a byte\n * array but may have > 255 char codes. Be sure to take only the first byte\n * and returns the byte array.\n * @param {String} str the string to transform.\n * @return {Array|Uint8Array} the string in a binary format.\n */\nfunction string2binary(str) {\n var result = null;\n if (support.uint8array) {\n result = new Uint8Array(str.length);\n } else {\n result = new Array(str.length);\n }\n return stringToArrayLike(str, result);\n}\n\n/**\n * Create a new blob with the given content and the given type.\n * @param {String|ArrayBuffer} part the content to put in the blob. DO NOT use\n * an Uint8Array because the stock browser of android 4 won't accept it (it\n * will be silently converted to a string, \"[object Uint8Array]\").\n *\n * Use only ONE part to build the blob to avoid a memory leak in IE11 / Edge:\n * when a large amount of Array is used to create the Blob, the amount of\n * memory consumed is nearly 100 times the original data amount.\n *\n * @param {String} type the mime type of the blob.\n * @return {Blob} the created blob.\n */\nexports.newBlob = function(part, type) {\n exports.checkSupport(\"blob\");\n\n try {\n // Blob constructor\n return new Blob([part], {\n type: type\n });\n }\n catch (e) {\n\n try {\n // deprecated, browser only, old way\n var Builder = self.BlobBuilder || self.WebKitBlobBuilder || self.MozBlobBuilder || self.MSBlobBuilder;\n var builder = new Builder();\n builder.append(part);\n return builder.getBlob(type);\n }\n catch (e) {\n\n // well, fuck ?!\n throw new Error(\"Bug : can't construct the Blob.\");\n }\n }\n\n\n};\n/**\n * The identity function.\n * @param {Object} input the input.\n * @return {Object} the same input.\n */\nfunction identity(input) {\n return input;\n}\n\n/**\n * Fill in an array with a string.\n * @param {String} str the string to use.\n * @param {Array|ArrayBuffer|Uint8Array|Buffer} array the array to fill in (will be mutated).\n * @return {Array|ArrayBuffer|Uint8Array|Buffer} the updated array.\n */\nfunction stringToArrayLike(str, array) {\n for (var i = 0; i < str.length; ++i) {\n array[i] = str.charCodeAt(i) & 0xFF;\n }\n return array;\n}\n\n/**\n * An helper for the function arrayLikeToString.\n * This contains static informations and functions that\n * can be optimized by the browser JIT compiler.\n */\nvar arrayToStringHelper = {\n /**\n * Transform an array of int into a string, chunk by chunk.\n * See the performances notes on arrayLikeToString.\n * @param {Array|ArrayBuffer|Uint8Array|Buffer} array the array to transform.\n * @param {String} type the type of the array.\n * @param {Integer} chunk the chunk size.\n * @return {String} the resulting string.\n * @throws Error if the chunk is too big for the stack.\n */\n stringifyByChunk: function(array, type, chunk) {\n var result = [], k = 0, len = array.length;\n // shortcut\n if (len <= chunk) {\n return String.fromCharCode.apply(null, array);\n }\n while (k < len) {\n if (type === \"array\" || type === \"nodebuffer\") {\n result.push(String.fromCharCode.apply(null, array.slice(k, Math.min(k + chunk, len))));\n }\n else {\n result.push(String.fromCharCode.apply(null, array.subarray(k, Math.min(k + chunk, len))));\n }\n k += chunk;\n }\n return result.join(\"\");\n },\n /**\n * Call String.fromCharCode on every item in the array.\n * This is the naive implementation, which generate A LOT of intermediate string.\n * This should be used when everything else fail.\n * @param {Array|ArrayBuffer|Uint8Array|Buffer} array the array to transform.\n * @return {String} the result.\n */\n stringifyByChar: function(array){\n var resultStr = \"\";\n for(var i = 0; i < array.length; i++) {\n resultStr += String.fromCharCode(array[i]);\n }\n return resultStr;\n },\n applyCanBeUsed : {\n /**\n * true if the browser accepts to use String.fromCharCode on Uint8Array\n */\n uint8array : (function () {\n try {\n return support.uint8array && String.fromCharCode.apply(null, new Uint8Array(1)).length === 1;\n } catch (e) {\n return false;\n }\n })(),\n /**\n * true if the browser accepts to use String.fromCharCode on nodejs Buffer.\n */\n nodebuffer : (function () {\n try {\n return support.nodebuffer && String.fromCharCode.apply(null, nodejsUtils.allocBuffer(1)).length === 1;\n } catch (e) {\n return false;\n }\n })()\n }\n};\n\n/**\n * Transform an array-like object to a string.\n * @param {Array|ArrayBuffer|Uint8Array|Buffer} array the array to transform.\n * @return {String} the result.\n */\nfunction arrayLikeToString(array) {\n // Performances notes :\n // --------------------\n // String.fromCharCode.apply(null, array) is the fastest, see\n // see http://jsperf.com/converting-a-uint8array-to-a-string/2\n // but the stack is limited (and we can get huge arrays !).\n //\n // result += String.fromCharCode(array[i]); generate too many strings !\n //\n // This code is inspired by http://jsperf.com/arraybuffer-to-string-apply-performance/2\n // TODO : we now have workers that split the work. Do we still need that ?\n var chunk = 65536,\n type = exports.getTypeOf(array),\n canUseApply = true;\n if (type === \"uint8array\") {\n canUseApply = arrayToStringHelper.applyCanBeUsed.uint8array;\n } else if (type === \"nodebuffer\") {\n canUseApply = arrayToStringHelper.applyCanBeUsed.nodebuffer;\n }\n\n if (canUseApply) {\n while (chunk > 1) {\n try {\n return arrayToStringHelper.stringifyByChunk(array, type, chunk);\n } catch (e) {\n chunk = Math.floor(chunk / 2);\n }\n }\n }\n\n // no apply or chunk error : slow and painful algorithm\n // default browser on android 4.*\n return arrayToStringHelper.stringifyByChar(array);\n}\n\nexports.applyFromCharCode = arrayLikeToString;\n\n\n/**\n * Copy the data from an array-like to an other array-like.\n * @param {Array|ArrayBuffer|Uint8Array|Buffer} arrayFrom the origin array.\n * @param {Array|ArrayBuffer|Uint8Array|Buffer} arrayTo the destination array which will be mutated.\n * @return {Array|ArrayBuffer|Uint8Array|Buffer} the updated destination array.\n */\nfunction arrayLikeToArrayLike(arrayFrom, arrayTo) {\n for (var i = 0; i < arrayFrom.length; i++) {\n arrayTo[i] = arrayFrom[i];\n }\n return arrayTo;\n}\n\n// a matrix containing functions to transform everything into everything.\nvar transform = {};\n\n// string to ?\ntransform[\"string\"] = {\n \"string\": identity,\n \"array\": function(input) {\n return stringToArrayLike(input, new Array(input.length));\n },\n \"arraybuffer\": function(input) {\n return transform[\"string\"][\"uint8array\"](input).buffer;\n },\n \"uint8array\": function(input) {\n return stringToArrayLike(input, new Uint8Array(input.length));\n },\n \"nodebuffer\": function(input) {\n return stringToArrayLike(input, nodejsUtils.allocBuffer(input.length));\n }\n};\n\n// array to ?\ntransform[\"array\"] = {\n \"string\": arrayLikeToString,\n \"array\": identity,\n \"arraybuffer\": function(input) {\n return (new Uint8Array(input)).buffer;\n },\n \"uint8array\": function(input) {\n return new Uint8Array(input);\n },\n \"nodebuffer\": function(input) {\n return nodejsUtils.newBufferFrom(input);\n }\n};\n\n// arraybuffer to ?\ntransform[\"arraybuffer\"] = {\n \"string\": function(input) {\n return arrayLikeToString(new Uint8Array(input));\n },\n \"array\": function(input) {\n return arrayLikeToArrayLike(new Uint8Array(input), new Array(input.byteLength));\n },\n \"arraybuffer\": identity,\n \"uint8array\": function(input) {\n return new Uint8Array(input);\n },\n \"nodebuffer\": function(input) {\n return nodejsUtils.newBufferFrom(new Uint8Array(input));\n }\n};\n\n// uint8array to ?\ntransform[\"uint8array\"] = {\n \"string\": arrayLikeToString,\n \"array\": function(input) {\n return arrayLikeToArrayLike(input, new Array(input.length));\n },\n \"arraybuffer\": function(input) {\n return input.buffer;\n },\n \"uint8array\": identity,\n \"nodebuffer\": function(input) {\n return nodejsUtils.newBufferFrom(input);\n }\n};\n\n// nodebuffer to ?\ntransform[\"nodebuffer\"] = {\n \"string\": arrayLikeToString,\n \"array\": function(input) {\n return arrayLikeToArrayLike(input, new Array(input.length));\n },\n \"arraybuffer\": function(input) {\n return transform[\"nodebuffer\"][\"uint8array\"](input).buffer;\n },\n \"uint8array\": function(input) {\n return arrayLikeToArrayLike(input, new Uint8Array(input.length));\n },\n \"nodebuffer\": identity\n};\n\n/**\n * Transform an input into any type.\n * The supported output type are : string, array, uint8array, arraybuffer, nodebuffer.\n * If no output type is specified, the unmodified input will be returned.\n * @param {String} outputType the output type.\n * @param {String|Array|ArrayBuffer|Uint8Array|Buffer} input the input to convert.\n * @throws {Error} an Error if the browser doesn't support the requested output type.\n */\nexports.transformTo = function(outputType, input) {\n if (!input) {\n // undefined, null, etc\n // an empty string won't harm.\n input = \"\";\n }\n if (!outputType) {\n return input;\n }\n exports.checkSupport(outputType);\n var inputType = exports.getTypeOf(input);\n var result = transform[inputType][outputType](input);\n return result;\n};\n\n/**\n * Return the type of the input.\n * The type will be in a format valid for JSZip.utils.transformTo : string, array, uint8array, arraybuffer.\n * @param {Object} input the input to identify.\n * @return {String} the (lowercase) type of the input.\n */\nexports.getTypeOf = function(input) {\n if (typeof input === \"string\") {\n return \"string\";\n }\n if (Object.prototype.toString.call(input) === \"[object Array]\") {\n return \"array\";\n }\n if (support.nodebuffer && nodejsUtils.isBuffer(input)) {\n return \"nodebuffer\";\n }\n if (support.uint8array && input instanceof Uint8Array) {\n return \"uint8array\";\n }\n if (support.arraybuffer && input instanceof ArrayBuffer) {\n return \"arraybuffer\";\n }\n};\n\n/**\n * Throw an exception if the type is not supported.\n * @param {String} type the type to check.\n * @throws {Error} an Error if the browser doesn't support the requested type.\n */\nexports.checkSupport = function(type) {\n var supported = support[type.toLowerCase()];\n if (!supported) {\n throw new Error(type + \" is not supported by this platform\");\n }\n};\n\nexports.MAX_VALUE_16BITS = 65535;\nexports.MAX_VALUE_32BITS = -1; // well, \"\\xFF\\xFF\\xFF\\xFF\\xFF\\xFF\\xFF\\xFF\" is parsed as -1\n\n/**\n * Prettify a string read as binary.\n * @param {string} str the string to prettify.\n * @return {string} a pretty string.\n */\nexports.pretty = function(str) {\n var res = '',\n code, i;\n for (i = 0; i < (str || \"\").length; i++) {\n code = str.charCodeAt(i);\n res += '\\\\x' + (code < 16 ? \"0\" : \"\") + code.toString(16).toUpperCase();\n }\n return res;\n};\n\n/**\n * Defer the call of a function.\n * @param {Function} callback the function to call asynchronously.\n * @param {Array} args the arguments to give to the callback.\n */\nexports.delay = function(callback, args, self) {\n setImmediate(function () {\n callback.apply(self || null, args || []);\n });\n};\n\n/**\n * Extends a prototype with an other, without calling a constructor with\n * side effects. Inspired by nodejs' `utils.inherits`\n * @param {Function} ctor the constructor to augment\n * @param {Function} superCtor the parent constructor to use\n */\nexports.inherits = function (ctor, superCtor) {\n var Obj = function() {};\n Obj.prototype = superCtor.prototype;\n ctor.prototype = new Obj();\n};\n\n/**\n * Merge the objects passed as parameters into a new one.\n * @private\n * @param {...Object} var_args All objects to merge.\n * @return {Object} a new object with the data of the others.\n */\nexports.extend = function() {\n var result = {}, i, attr;\n for (i = 0; i < arguments.length; i++) { // arguments is not enumerable in some browsers\n for (attr in arguments[i]) {\n if (arguments[i].hasOwnProperty(attr) && typeof result[attr] === \"undefined\") {\n result[attr] = arguments[i][attr];\n }\n }\n }\n return result;\n};\n\n/**\n * Transform arbitrary content into a Promise.\n * @param {String} name a name for the content being processed.\n * @param {Object} inputData the content to process.\n * @param {Boolean} isBinary true if the content is not an unicode string\n * @param {Boolean} isOptimizedBinaryString true if the string content only has one byte per character.\n * @param {Boolean} isBase64 true if the string content is encoded with base64.\n * @return {Promise} a promise in a format usable by JSZip.\n */\nexports.prepareContent = function(name, inputData, isBinary, isOptimizedBinaryString, isBase64) {\n\n // if inputData is already a promise, this flatten it.\n var promise = external.Promise.resolve(inputData).then(function(data) {\n \n \n var isBlob = support.blob && (data instanceof Blob || ['[object File]', '[object Blob]'].indexOf(Object.prototype.toString.call(data)) !== -1);\n\n if (isBlob && typeof FileReader !== \"undefined\") {\n return new external.Promise(function (resolve, reject) {\n var reader = new FileReader();\n\n reader.onload = function(e) {\n resolve(e.target.result);\n };\n reader.onerror = function(e) {\n reject(e.target.error);\n };\n reader.readAsArrayBuffer(data);\n });\n } else {\n return data;\n }\n });\n\n return promise.then(function(data) {\n var dataType = exports.getTypeOf(data);\n\n if (!dataType) {\n return external.Promise.reject(\n new Error(\"Can't read the data of '\" + name + \"'. Is it \" +\n \"in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?\")\n );\n }\n // special case : it's way easier to work with Uint8Array than with ArrayBuffer\n if (dataType === \"arraybuffer\") {\n data = exports.transformTo(\"uint8array\", data);\n } else if (dataType === \"string\") {\n if (isBase64) {\n data = base64.decode(data);\n }\n else if (isBinary) {\n // optimizedBinaryString === true means that the file has already been filtered with a 0xFF mask\n if (isOptimizedBinaryString !== true) {\n // this is a string, not in a base64 format.\n // Be sure that this is a correct \"binary string\"\n data = string2binary(data);\n }\n }\n }\n return data;\n });\n};\n","import {parse, Node} from \"../utils/acorn.js\";\r\n\r\nvar FconfSettings = {\r\n ENABLE_BASH_HOTKEYS: false,\r\n ENABLE_TIMESTAMPS: false,\r\n}\r\n\r\nvar FconfComments = {\r\n ENABLE_BASH_HOTKEYS: \"Improved Bash emulation mode. Setting this to 1 enables several\\n\" +\r\n \"new Terminal shortcuts and features that more closely resemble\\n\" +\r\n \"a real Bash-style shell. Note that when this mode is enabled,\\n\" +\r\n \"the default browser shortcuts are overriden by the new Bash\\n\" +\r\n \"shortcuts.\\n\\n\" +\r\n \"To see a full list of the Terminal shortcuts that this enables, see:\\n\" +\r\n \"http://bitburner.readthedocs.io/en/latest/shortcuts.html\",\r\n ENABLE_TIMESTAMPS: \"Terminal commands and log entries will be timestamped. The timestamp\\n\" +\r\n \"will have the format: M/D h:m\",\r\n}\r\n\r\n//Parse Fconf settings from the config text\r\n//Throws an exception if parsing fails\r\nfunction parseFconfSettings(config) {\r\n var ast = parse(config, {sourceType:\"module\"});\r\n var queue = [];\r\n queue.push(ast);\r\n while (queue.length != 0) {\r\n var exp = queue.shift();\r\n switch (exp.type) {\r\n case \"BlockStatement\":\r\n case \"Program\":\r\n for (var i = 0; i < exp.body.length; ++i) {\r\n if (exp.body[i] instanceof Node) {\r\n queue.push(exp.body[i]);\r\n }\r\n }\r\n break;\r\n case \"AssignmentExpression\":\r\n var setting, value;\r\n if (exp.left != null && exp.left.name != null) {\r\n setting = exp.left.name;\r\n } else {\r\n break;\r\n }\r\n if (exp.right != null && exp.right.raw != null) {\r\n value = exp.right.raw;\r\n } else {\r\n break;\r\n }\r\n parseFconfSetting(setting, value);\r\n break;\r\n default:\r\n break;\r\n }\r\n\r\n for (var prop in exp) {\r\n if (exp.hasOwnProperty(prop)) {\r\n if (exp[prop] instanceof Node) {\r\n queue.push(exp[prop]);\r\n }\r\n }\r\n }\r\n }\r\n}\r\n\r\nfunction parseFconfSetting(setting, value) {\r\n setting = String(setting);\r\n value = String(value);\r\n if (setting == null || value == null || FconfSettings[setting] == null) {\r\n console.log(\"WARNING: Invalid .fconf setting: \" + setting);\r\n return;\r\n }\r\n\r\n //Needed to convert entered value to boolean/strings accordingly\r\n switch(setting) {\r\n case \"ENABLE_BASH_HOTKEYS\":\r\n case \"ENABLE_TIMESTAMPS\":\r\n var value = value.toLowerCase();\r\n if (value === \"1\" || value === \"true\" || value === \"y\") {\r\n value = true;\r\n } else {\r\n value = false;\r\n }\r\n FconfSettings[setting] = value;\r\n break;\r\n default:\r\n break;\r\n }\r\n return;\r\n}\r\n\r\n//Create the .fconf file text from the settings\r\nfunction createFconf() {\r\n var res = \"\";\r\n for (var setting in FconfSettings) {\r\n if (FconfSettings.hasOwnProperty(setting)) {\r\n //Setting comments (description)\r\n var comment = FconfComments[setting];\r\n if (comment == null) {continue;}\r\n var comment = comment.split(\"\\n\");\r\n for (var i = 0; i < comment.length; ++i) {\r\n res += (\"//\" + comment[i] + \"\\n\");\r\n }\r\n\r\n var value = 0;\r\n if (FconfSettings[setting] === true) {\r\n value = \"1\";\r\n } else if (FconfSettings[setting] === false) {\r\n value = \"0\";\r\n } else {\r\n value = String(FconfSettings[setting]);\r\n }\r\n res += (setting + \"=\" + value + \"\\n\\n\");\r\n }\r\n }\r\n return res;\r\n}\r\n\r\nfunction loadFconf(saveString) {\r\n let tempFconfSettings = JSON.parse(saveString);\r\n for (var setting in tempFconfSettings) {\r\n if (tempFconfSettings.hasOwnProperty(setting)) {\r\n FconfSettings[setting] = tempFconfSettings[setting];\r\n }\r\n }\r\n}\r\n\r\nexport {FconfSettings, createFconf, parseFconfSettings, loadFconf}\r\n","import {CONSTANTS} from \"./Constants.js\";\r\nimport {Engine} from \"./engine.js\";\r\nimport {displayFactionContent} from \"./Faction.js\";\r\nimport {Player} from \"./Player.js\";\r\nimport {dialogBoxCreate} from \"../utils/DialogBox.js\";\r\nimport {addOffset, getRandomInt,\r\n clearEventListenersEl,\r\n clearEventListeners} from \"../utils/HelperFunctions.js\";\r\nimport {formatNumber, isString} from \"../utils/StringHelperFunctions.js\";\r\nimport jsplumb from 'jsplumb'\r\n\r\nlet inMission = false; //Flag to denote whether a mission is running\r\nlet currMission = null;\r\nfunction setInMission(bool, mission) {\r\n inMission = bool;\r\n if (bool) {\r\n currMission = mission;\r\n } else {\r\n currMission = null;\r\n }\r\n}\r\n\r\n//Keyboard shortcuts\r\n$(document).keydown(function(e) {\r\n if (inMission && currMission && currMission.selectedNode.length != 0) {\r\n switch (e.keyCode) {\r\n case 65: //a for Attack\r\n currMission.actionButtons[0].click();\r\n break;\r\n case 83: //s for Scan\r\n currMission.actionButtons[1].click();\r\n break;\r\n case 87: //w for Weaken\r\n currMission.actionButtons[2].click();\r\n break;\r\n case 70: //f for Fortify\r\n currMission.actionButtons[3].click();\r\n break;\r\n case 82: //r for Overflow\r\n currMission.actionButtons[4].click();\r\n break;\r\n case 68: //d for Detach connection\r\n currMission.actionButtons[5].click();\r\n break;\r\n default:\r\n break;\r\n }\r\n }\r\n});\r\n\r\nlet NodeTypes = {\r\n Core: \"CPU Core Node\", //All actions available\r\n Firewall: \"Firewall Node\", //No actions available\r\n Database: \"Database Node\", //No actions available\r\n Spam: \"Spam Node\", //No actions Available\r\n Transfer: \"Transfer Node\", //Can Weaken, Scan, Fortify and Overflow\r\n Shield: \"Shield Node\" //Can Fortify\r\n}\r\n\r\nlet NodeActions = {\r\n Attack: \"Attacking\", //Damaged based on attack stat + hacking level + opp def\r\n Scan: \"Scanning\", //-Def for target, affected by attack and hacking level\r\n Weaken: \"Weakening\", //-Attack for target, affected by attack and hacking level\r\n Fortify: \"Fortifying\", //+Defense for Node, affected by hacking level\r\n Overflow: \"Overflowing\", //+Attack but -Defense for Node, affected by hacking level\r\n}\r\n\r\nfunction Node(type, stats) {\r\n this.type = type;\r\n this.atk = stats.atk ? stats.atk : 0;\r\n this.def = stats.def ? stats.def : 0;\r\n this.hp = stats.hp ? stats.hp : 0;\r\n this.maxhp = this.hp;\r\n this.plyrCtrl = false;\r\n this.enmyCtrl = false;\r\n this.pos = [0, 0]; //x, y\r\n this.el = null; //Holds the Node's DOM element\r\n this.action = null;\r\n this.targetedCount = 0; //Count of how many connections this node is the target of\r\n\r\n //Holds the JsPlumb Connection object for this Node,\r\n //where this Node is the Source (since each Node\r\n //can only have 1 outgoing Connection)\r\n this.conn = null;\r\n}\r\n\r\nNode.prototype.setPosition = function(x, y) {\r\n this.pos = [x, y];\r\n}\r\n\r\nNode.prototype.setControlledByPlayer = function() {\r\n this.plyrCtrl = true;\r\n this.enmyCtrl = false;\r\n if (this.el) {\r\n this.el.classList.remove(\"hack-mission-enemy-node\");\r\n this.el.classList.add(\"hack-mission-player-node\");\r\n }\r\n}\r\n\r\nNode.prototype.setControlledByEnemy = function() {\r\n this.plyrCtrl = false;\r\n this.enmyCtrl = true;\r\n if (this.el) {\r\n this.el.classList.remove(\"hack-mission-player-node\");\r\n this.el.classList.add(\"hack-mission-enemy-node\");\r\n }\r\n}\r\n\r\n//Sets this node to be the active node\r\nNode.prototype.select = function(actionButtons) {\r\n if (this.enmyCtrl) {return;}\r\n this.el.classList.add(\"hack-mission-player-node-active\");\r\n\r\n //Make all buttons inactive\r\n for (var i = 0; i < actionButtons.length; ++i) {\r\n actionButtons[i].classList.remove(\"a-link-button\");\r\n actionButtons[i].classList.add(\"a-link-button-inactive\");\r\n }\r\n\r\n switch(this.type) {\r\n case NodeTypes.Core:\r\n //All buttons active\r\n for (var i = 0; i < actionButtons.length; ++i) {\r\n actionButtons[i].classList.remove(\"a-link-button-inactive\");\r\n actionButtons[i].classList.add(\"a-link-button\");\r\n }\r\n break;\r\n case NodeTypes.Transfer:\r\n actionButtons[1].classList.remove(\"a-link-button-inactive\");\r\n actionButtons[1].classList.add(\"a-link-button\");\r\n actionButtons[2].classList.remove(\"a-link-button-inactive\");\r\n actionButtons[2].classList.add(\"a-link-button\");\r\n actionButtons[3].classList.remove(\"a-link-button-inactive\");\r\n actionButtons[3].classList.add(\"a-link-button\");\r\n actionButtons[4].classList.remove(\"a-link-button-inactive\");\r\n actionButtons[4].classList.add(\"a-link-button\");\r\n actionButtons[5].classList.remove(\"a-link-button-inactive\");\r\n actionButtons[5].classList.add(\"a-link-button\");\r\n break;\r\n case NodeTypes.Shield:\r\n case NodeTypes.Firewall:\r\n actionButtons[3].classList.remove(\"a-link-button-inactive\");\r\n actionButtons[3].classList.add(\"a-link-button\");\r\n break;\r\n default:\r\n break;\r\n }\r\n}\r\n\r\nNode.prototype.deselect = function(actionButtons) {\r\n this.el.classList.remove(\"hack-mission-player-node-active\");\r\n for (var i = 0; i < actionButtons.length; ++i) {\r\n actionButtons[i].classList.remove(\"a-link-button\");\r\n actionButtons[i].classList.add(\"a-link-button-inactive\");\r\n }\r\n}\r\n\r\n\r\nNode.prototype.untarget = function() {\r\n if (this.targetedCount === 0) {\r\n console.log(\"WARN: Node \" + this.el.id + \" is being 'untargeted' when it has no target count\");\r\n return;\r\n }\r\n --this.targetedCount;\r\n}\r\n\r\n//Hacking mission instance\r\n//Takes in the reputation of the Faction for which the mission is\r\n//being conducted\r\nfunction HackingMission(rep, fac) {\r\n this.faction = fac;\r\n\r\n this.started = false;\r\n this.time = 180000; //5 minutes to start, milliseconds\r\n\r\n this.playerCores = [];\r\n this.playerNodes = []; //Non-core nodes\r\n this.playerAtk = 0;\r\n this.playerDef = 0;\r\n\r\n this.enemyCores = [];\r\n this.enemyDatabases = [];\r\n this.enemyNodes = []; //Non-core nodes\r\n this.enemyAtk = 0;\r\n this.enemyDef = 0;\r\n\r\n this.miscNodes = [];\r\n\r\n this.selectedNode = []; //Which of the player's nodes are currently selected\r\n\r\n this.actionButtons = []; //DOM buttons for actions\r\n\r\n this.availablePositions = [];\r\n for (var r = 0; r < 8; ++r) {\r\n for (var c = 0; c < 8; ++c) {\r\n this.availablePositions.push([r, c]);\r\n }\r\n }\r\n\r\n this.map = [];\r\n for (var i = 0; i < 8; ++i) {\r\n this.map.push([null, null, null, null, null, null, null, null]);\r\n }\r\n\r\n this.jsplumbinstance = null;\r\n\r\n this.difficulty = rep / CONSTANTS.HackingMissionRepToDiffConversion + 1;\r\n console.log(\"difficulty: \" + this.difficulty);\r\n this.reward = 250 + (rep / CONSTANTS.HackingMissionRepToRewardConversion);\r\n}\r\n\r\nHackingMission.prototype.init = function() {\r\n //Create Header DOM\r\n this.createPageDom();\r\n\r\n //Create player starting nodes\r\n var home = Player.getHomeComputer()\r\n for (var i = 0; i < home.cpuCores; ++i) {\r\n var stats = {\r\n atk: (Player.hacking_skill / 7.5) + 30,\r\n def: (Player.hacking_skill / 20),\r\n hp: (Player.hacking_skill / 4),\r\n };\r\n this.playerCores.push(new Node(NodeTypes.Core, stats));\r\n this.playerCores[i].setControlledByPlayer();\r\n this.setNodePosition(this.playerCores[i], i, 0);\r\n this.removeAvailablePosition(i, 0);\r\n }\r\n\r\n //Randomly generate enemy nodes (CPU and Firewall) based on difficulty\r\n var numNodes = Math.min(8, Math.max(1, Math.round(this.difficulty / 4)));\r\n var numFirewalls = Math.min(20,\r\n getRandomInt(Math.round(this.difficulty/3), Math.round(this.difficulty/3) + 1));\r\n var numDatabases = Math.min(10, getRandomInt(1, Math.round(this.difficulty / 3) + 1));\r\n var totalNodes = numNodes + numFirewalls + numDatabases;\r\n var xlimit = 7 - Math.floor(totalNodes / 8);\r\n var randMult = addOffset(0.8 + (this.difficulty / 5), 10);\r\n for (var i = 0; i < numNodes; ++i) {\r\n var stats = {\r\n atk: randMult * getRandomInt(80, 86),\r\n def: randMult * getRandomInt(5, 10),\r\n hp: randMult * getRandomInt(210, 230)\r\n }\r\n this.enemyCores.push(new Node(NodeTypes.Core, stats));\r\n this.enemyCores[i].setControlledByEnemy();\r\n this.setNodeRandomPosition(this.enemyCores[i], xlimit);\r\n }\r\n for (var i = 0; i < numFirewalls; ++i) {\r\n var stats = {\r\n atk: 0,\r\n def: randMult * getRandomInt(10, 20),\r\n hp: randMult * getRandomInt(275, 300)\r\n }\r\n this.enemyNodes.push(new Node(NodeTypes.Firewall, stats));\r\n this.enemyNodes[i].setControlledByEnemy();\r\n this.setNodeRandomPosition(this.enemyNodes[i], xlimit);\r\n }\r\n for (var i = 0; i < numDatabases; ++i) {\r\n var stats = {\r\n atk: 0,\r\n def: randMult * getRandomInt(30, 55),\r\n hp: randMult * getRandomInt(210, 275)\r\n }\r\n var node = new Node(NodeTypes.Database, stats);\r\n node.setControlledByEnemy();\r\n this.setNodeRandomPosition(node, xlimit);\r\n this.enemyDatabases.push(node);\r\n }\r\n this.calculateDefenses();\r\n this.calculateAttacks();\r\n this.createMap();\r\n}\r\n\r\nHackingMission.prototype.createPageDom = function() {\r\n var container = document.getElementById(\"mission-container\");\r\n\r\n var favorMult = 1 + (this.faction.favor / 100);\r\n var gain = this.reward * Player.faction_rep_mult * favorMult;\r\n var headerText = document.createElement(\"p\");\r\n headerText.innerHTML = \"You are about to start a hacking mission! You will gain \" +\r\n formatNumber(gain, 3) + \" faction reputation with \" + this.faction.name +\r\n \" if you win. For more information \" +\r\n \"about how hacking missions work, click one of the guide links \" +\r\n \"below (one opens up an in-game guide and the other opens up \" +\r\n \"the guide from the wiki). Click the 'Start' button to begin.\";\r\n headerText.style.display = \"block\";\r\n headerText.classList.add(\"hack-mission-header-element\");\r\n headerText.style.width = \"80%\";\r\n\r\n var inGameGuideBtn = document.createElement(\"a\");\r\n inGameGuideBtn.innerText = \"How to Play\";\r\n inGameGuideBtn.classList.add(\"a-link-button\");\r\n inGameGuideBtn.style.display = \"inline-block\";\r\n inGameGuideBtn.classList.add(\"hack-mission-header-element\");\r\n inGameGuideBtn.addEventListener(\"click\", function() {\r\n dialogBoxCreate(CONSTANTS.HackingMissionHowToPlay);\r\n return false;\r\n });\r\n\r\n var wikiGuideBtn = document.createElement(\"a\");\r\n wikiGuideBtn.innerText = \"Wiki Guide\";\r\n wikiGuideBtn.classList.add(\"a-link-button\");\r\n wikiGuideBtn.style.display = \"inline-block\";\r\n wikiGuideBtn.classList.add(\"hack-mission-header-element\");\r\n wikiGuideBtn.target = \"_blank\";\r\n //TODO Add link to wiki page wikiGuideBtn.href =\r\n\r\n\r\n //Start button will get replaced with forfeit when game is started\r\n var startBtn = document.createElement(\"a\");\r\n startBtn.innerHTML = \"Start\";\r\n startBtn.setAttribute(\"id\", \"hack-mission-start-btn\");\r\n startBtn.classList.add(\"a-link-button\");\r\n startBtn.classList.add(\"hack-mission-header-element\");\r\n startBtn.style.display = \"inline-block\";\r\n startBtn.addEventListener(\"click\", ()=>{\r\n this.start();\r\n return false;\r\n });\r\n\r\n var forfeitMission = document.createElement(\"a\");\r\n forfeitMission.innerHTML = \"Forfeit Mission (Exit)\";\r\n forfeitMission.classList.add(\"a-link-button\");\r\n forfeitMission.classList.add(\"hack-mission-header-element\");\r\n forfeitMission.style.display = \"inline-block\";\r\n forfeitMission.addEventListener(\"click\", ()=> {\r\n this.finishMission(false);\r\n return false;\r\n });\r\n\r\n var timer = document.createElement(\"p\");\r\n timer.setAttribute(\"id\", \"hacking-mission-timer\");\r\n timer.style.display = \"inline-block\";\r\n timer.style.margin = \"6px\";\r\n\r\n //Create Action Buttons (Attack/Scan/Weaken/ etc...)\r\n var actionsContainer = document.createElement(\"span\");\r\n actionsContainer.style.display = \"block\";\r\n actionsContainer.classList.add(\"hack-mission-action-buttons-container\");\r\n for (var i = 0; i < 6; ++i) {\r\n this.actionButtons.push(document.createElement(\"a\"));\r\n this.actionButtons[i].style.display = \"inline-block\";\r\n this.actionButtons[i].classList.add(\"a-link-button-inactive\"); //Disabled at start\r\n this.actionButtons[i].classList.add(\"tooltip\"); //Disabled at start\r\n this.actionButtons[i].classList.add(\"hack-mission-header-element\");\r\n actionsContainer.appendChild(this.actionButtons[i]);\r\n }\r\n this.actionButtons[0].innerText = \"Attack(a)\";\r\n var atkTooltip = document.createElement(\"span\");\r\n atkTooltip.classList.add(\"tooltiptexthigh\");\r\n atkTooltip.innerText = \"Lowers the targeted node's HP. The effectiveness of this depends on \" +\r\n \"this node's Attack level, your hacking level, and the opponent's defense level.\";\r\n this.actionButtons[0].appendChild(atkTooltip);\r\n this.actionButtons[1].innerText = \"Scan(s)\";\r\n var scanTooltip = document.createElement(\"span\");\r\n scanTooltip.classList.add(\"tooltiptexthigh\");\r\n scanTooltip.innerText = \"Lowers the targeted node's defense. The effectiveness of this depends on \" +\r\n \"this node's Attack level, your hacking level, and the opponent's defense level.\";\r\n this.actionButtons[1].appendChild(scanTooltip);\r\n this.actionButtons[2].innerText = \"Weaken(w)\";\r\n var WeakenTooltip = document.createElement(\"span\");\r\n WeakenTooltip.classList.add(\"tooltiptexthigh\");\r\n WeakenTooltip.innerText = \"Lowers the targeted node's attack. The effectiveness of this depends on \" +\r\n \"this node's Attack level, your hacking level, and the opponent's defense level.\";\r\n this.actionButtons[2].appendChild(WeakenTooltip);\r\n this.actionButtons[3].innerText = \"Fortify(f)\";\r\n var fortifyTooltip = document.createElement(\"span\");\r\n fortifyTooltip.classList.add(\"tooltiptexthigh\");\r\n fortifyTooltip.innerText = \"Raises this node's Defense level. The effectiveness of this depends on \" +\r\n \"your hacking level\";\r\n this.actionButtons[3].appendChild(fortifyTooltip);\r\n this.actionButtons[4].innerText = \"Overflow(r)\";\r\n var overflowTooltip = document.createElement(\"span\");\r\n overflowTooltip.classList.add(\"tooltiptexthigh\");\r\n overflowTooltip.innerText = \"Raises this node's Attack level but lowers its Defense level. The effectiveness \" +\r\n \"of this depends on your hacking level.\";\r\n this.actionButtons[4].appendChild(overflowTooltip);\r\n this.actionButtons[5].innerText = \"Drop Connection(d)\";\r\n var dropconnTooltip = document.createElement(\"span\");\r\n dropconnTooltip.classList.add(\"tooltiptexthigh\");\r\n dropconnTooltip.innerText = \"Removes this Node's current connection to some target Node, if it has one. This can \" +\r\n \"also be done by simply clicking the white connection line.\";\r\n this.actionButtons[5].appendChild(dropconnTooltip);\r\n\r\n //Player/enemy defense displays will be in action container\r\n var playerStats = document.createElement(\"p\");\r\n var enemyStats = document.createElement(\"p\");\r\n playerStats.style.display = \"inline-block\";\r\n enemyStats.style.display = \"inline-block\";\r\n playerStats.style.color = \"#00ccff\";\r\n enemyStats.style.color = \"red\";\r\n playerStats.style.margin = \"4px\";\r\n enemyStats.style.margin = \"4px\";\r\n playerStats.setAttribute(\"id\", \"hacking-mission-player-stats\");\r\n enemyStats.setAttribute(\"id\", \"hacking-mission-enemy-stats\");\r\n actionsContainer.appendChild(playerStats);\r\n actionsContainer.appendChild(enemyStats);\r\n\r\n //Set Action Button event listeners\r\n this.actionButtons[0].addEventListener(\"click\", ()=>{\r\n if (!(this.selectedNode.length > 0)) {\r\n console.log(\"ERR: Pressing Action button without selected node\");\r\n return;\r\n }\r\n if (this.selectedNode[0].type !== NodeTypes.Core) {return;}\r\n this.setActionButtonsActive(this.selectedNode[0].type);\r\n this.setActionButton(NodeActions.Attack, false); //Set attack button inactive\r\n this.selectedNode.forEach(function(node){\r\n node.action = NodeActions.Attack;\r\n });\r\n });\r\n\r\n this.actionButtons[1].addEventListener(\"click\", ()=>{\r\n if (!(this.selectedNode.length > 0)) {\r\n console.log(\"ERR: Pressing Action button without selected node\");\r\n return;\r\n }\r\n var nodeType = this.selectedNode[0].type; //In a multiselect, every Node will have the same type\r\n if (nodeType !== NodeTypes.Core && nodeType !== NodeTypes.Transfer) {return;}\r\n this.setActionButtonsActive(nodeType);\r\n this.setActionButton(NodeActions.Scan, false); //Set scan button inactive\r\n this.selectedNode.forEach(function(node){\r\n node.action = NodeActions.Scan;\r\n });\r\n });\r\n\r\n this.actionButtons[2].addEventListener(\"click\", ()=>{\r\n if (!(this.selectedNode.length > 0)) {\r\n console.log(\"ERR: Pressing Action button without selected node\");\r\n return;\r\n }\r\n var nodeType = this.selectedNode[0].type; //In a multiselect, every Node will have the same type\r\n if (nodeType !== NodeTypes.Core && nodeType !== NodeTypes.Transfer) {return;}\r\n this.setActionButtonsActive(nodeType);\r\n this.setActionButton(NodeActions.Weaken, false); //Set Weaken button inactive\r\n this.selectedNode.forEach(function(node){\r\n node.action = NodeActions.Weaken;\r\n });\r\n });\r\n\r\n this.actionButtons[3].addEventListener(\"click\", ()=>{\r\n if (!(this.selectedNode.length > 0)) {\r\n console.log(\"ERR: Pressing Action button without selected node\");\r\n return;\r\n }\r\n this.setActionButtonsActive(this.selectedNode[0].type);\r\n this.setActionButton(NodeActions.Fortify, false); //Set Fortify button inactive\r\n this.selectedNode.forEach(function(node){\r\n node.action = NodeActions.Fortify;\r\n });\r\n });\r\n\r\n this.actionButtons[4].addEventListener(\"click\", ()=>{\r\n if (!(this.selectedNode.length > 0)) {\r\n console.log(\"ERR: Pressing Action button without selected node\");\r\n return;\r\n }\r\n var nodeType = this.selectedNode[0].type;\r\n if (nodeType !== NodeTypes.Core && nodeType !== NodeTypes.Transfer) {return;}\r\n this.setActionButtonsActive(nodeType);\r\n this.setActionButton(NodeActions.Overflow, false); //Set Overflow button inactive\r\n this.selectedNode.forEach(function(node){\r\n node.action = NodeActions.Overflow;\r\n });\r\n });\r\n\r\n this.actionButtons[5].addEventListener(\"click\", ()=>{\r\n if (!(this.selectedNode.length > 0)) {\r\n console.log(\"ERR: Pressing Action button without selected node\");\r\n return;\r\n }\r\n this.selectedNode.forEach(function(node){\r\n if (node.conn) {\r\n var endpoints = node.conn.endpoints;\r\n endpoints[0].detachFrom(endpoints[1]);\r\n }\r\n node.action = NodeActions.Fortify;\r\n });\r\n // if (this.selectedNode.conn) {\r\n // var endpoints = this.selectedNode.conn.endpoints;\r\n // endpoints[0].detachFrom(endpoints[1]);\r\n // }\r\n })\r\n\r\n var timeDisplay = document.createElement(\"p\");\r\n\r\n container.appendChild(headerText);\r\n container.appendChild(inGameGuideBtn);\r\n container.appendChild(wikiGuideBtn);\r\n container.appendChild(startBtn);\r\n container.appendChild(forfeitMission);\r\n container.appendChild(timer);\r\n container.appendChild(actionsContainer);\r\n container.appendChild(timeDisplay);\r\n}\r\n\r\nHackingMission.prototype.setActionButtonsInactive = function() {\r\n for (var i = 0; i < this.actionButtons.length; ++i) {\r\n this.actionButtons[i].classList.remove(\"a-link-button\");\r\n this.actionButtons[i].classList.add(\"a-link-button-inactive\");\r\n }\r\n}\r\n\r\nHackingMission.prototype.setActionButtonsActive = function(nodeType=null) {\r\n for (var i = 0; i < this.actionButtons.length; ++i) {\r\n this.actionButtons[i].classList.add(\"a-link-button\");\r\n this.actionButtons[i].classList.remove(\"a-link-button-inactive\");\r\n }\r\n\r\n //For Transfer, FireWall and Shield Nodes, certain buttons should always be disabled\r\n //0 = Attack, 1 = Scan, 2 = Weaken, 3 = Fortify, 4 = overflow, 5 = Drop conn\r\n if (nodeType) {\r\n switch (nodeType) {\r\n case NodeTypes.Firewall:\r\n case NodeTypes.Shield:\r\n this.actionButtons[0].classList.remove(\"a-link-button\");\r\n this.actionButtons[0].classList.add(\"a-link-button-inactive\");\r\n this.actionButtons[1].classList.remove(\"a-link-button\");\r\n this.actionButtons[1].classList.add(\"a-link-button-inactive\");\r\n this.actionButtons[2].classList.remove(\"a-link-button\");\r\n this.actionButtons[2].classList.add(\"a-link-button-inactive\");\r\n this.actionButtons[4].classList.remove(\"a-link-button\");\r\n this.actionButtons[4].classList.add(\"a-link-button-inactive\");\r\n this.actionButtons[5].classList.remove(\"a-link-button\");\r\n this.actionButtons[5].classList.add(\"a-link-button-inactive\");\r\n break;\r\n case NodeTypes.Transfer:\r\n this.actionButtons[0].classList.remove(\"a-link-button\");\r\n this.actionButtons[0].classList.add(\"a-link-button-inactive\");\r\n break;\r\n default:\r\n break;\r\n }\r\n }\r\n}\r\n\r\n//True for active, false for inactive\r\nHackingMission.prototype.setActionButton = function(i, active=true) {\r\n if (isString(i)) {\r\n switch (i) {\r\n case NodeActions.Attack:\r\n i = 0;\r\n break;\r\n case NodeActions.Scan:\r\n i = 1;\r\n break;\r\n case NodeActions.Weaken:\r\n i = 2;\r\n break;\r\n case NodeActions.Fortify:\r\n i = 3;\r\n break;\r\n case NodeActions.Overflow:\r\n default:\r\n i = 4;\r\n break;\r\n }\r\n }\r\n if (active) {\r\n this.actionButtons[i].classList.remove(\"a-link-button-inactive\");\r\n this.actionButtons[i].classList.add(\"a-link-button\");\r\n } else {\r\n this.actionButtons[i].classList.remove(\"a-link-button\");\r\n this.actionButtons[i].classList.add(\"a-link-button-inactive\");\r\n }\r\n\r\n}\r\n\r\nHackingMission.prototype.calculateAttacks = function() {\r\n var total = 0;\r\n for (var i = 0; i < this.playerCores.length; ++i) {\r\n total += this.playerCores[i].atk;\r\n }\r\n for (var i = 0; i < this.playerNodes.length; ++i) {\r\n total += this.playerNodes[i].atk;\r\n }\r\n this.playerAtk = total;\r\n document.getElementById(\"hacking-mission-player-stats\").innerHTML =\r\n \"Player Attack: \" + formatNumber(this.playerAtk, 1) + \"<br>\" +\r\n \"Player Defense: \" + formatNumber(this.playerDef, 1);\r\n total = 0;\r\n for (var i = 0; i < this.enemyCores.length; ++i) {\r\n total += this.enemyCores[i].atk;\r\n }\r\n for (var i = 0; i < this.enemyDatabases.length; ++i) {\r\n total += this.enemyDatabases[i].atk;\r\n }\r\n for (var i = 0; i < this.enemyNodes.length; ++i) {\r\n total += this.enemyNodes[i].atk;\r\n }\r\n this.enemyAtk = total;\r\n document.getElementById(\"hacking-mission-enemy-stats\").innerHTML =\r\n \"Enemy Attack: \" + formatNumber(this.enemyAtk, 1) + \"<br>\" +\r\n \"Enemy Defense: \" + formatNumber(this.enemyDef, 1);\r\n}\r\n\r\nHackingMission.prototype.calculateDefenses = function() {\r\n var total = 0;\r\n for (var i = 0; i < this.playerCores.length; ++i) {\r\n total += this.playerCores[i].def;\r\n }\r\n for (var i = 0; i < this.playerNodes.length; ++i) {\r\n total += this.playerNodes[i].def;\r\n }\r\n this.playerDef = total;\r\n document.getElementById(\"hacking-mission-player-stats\").innerHTML =\r\n \"Player Attack: \" + formatNumber(this.playerAtk, 1) + \"<br>\" +\r\n \"Player Defense: \" + formatNumber(this.playerDef, 1);\r\n total = 0;\r\n for (var i = 0; i < this.enemyCores.length; ++i) {\r\n total += this.enemyCores[i].def;\r\n }\r\n for (var i = 0; i < this.enemyDatabases.length; ++i) {\r\n total += this.enemyDatabases[i].def;\r\n }\r\n for (var i = 0; i < this.enemyNodes.length; ++i) {\r\n total += this.enemyNodes[i].def;\r\n }\r\n this.enemyDef = total;\r\n document.getElementById(\"hacking-mission-enemy-stats\").innerHTML =\r\n \"Enemy Attack: \" + formatNumber(this.enemyAtk, 1) + \"<br>\" +\r\n \"Enemy Defense: \" + formatNumber(this.enemyDef, 1);\r\n}\r\n\r\nHackingMission.prototype.removeAvailablePosition = function(x, y) {\r\n for (var i = 0; i < this.availablePositions.length; ++i) {\r\n if (this.availablePositions[i][0] === x &&\r\n this.availablePositions[i][1] === y) {\r\n this.availablePositions.splice(i, 1);\r\n return;\r\n }\r\n }\r\n console.log(\"WARNING: removeAvailablePosition() did not remove \" + x + \", \" + y);\r\n}\r\n\r\nHackingMission.prototype.setNodePosition = function(nodeObj, x, y) {\r\n if (!(nodeObj instanceof Node)) {\r\n console.log(\"WARNING: Non-Node object passed into setNodePOsition\");\r\n return;\r\n }\r\n if (isNaN(x) || isNaN(y)) {\r\n console.log(\"ERR: Invalid values passed as x and y for setNodePosition\");\r\n console.log(x);\r\n console.log(y);\r\n return;\r\n }\r\n nodeObj.pos = [x, y];\r\n this.map[x][y] = nodeObj;\r\n}\r\n\r\nHackingMission.prototype.setNodeRandomPosition = function(nodeObj, xlimit=0) {\r\n var i = getRandomInt(0, this.availablePositions.length - 1);\r\n if (this.availablePositions[i][1] < xlimit) {\r\n //Recurse if not within limit\r\n return this.setNodeRandomPosition(nodeObj, xlimit);\r\n }\r\n var pos = this.availablePositions.splice(i, 1);\r\n pos = pos[0];\r\n this.setNodePosition(nodeObj, pos[0], pos[1]);\r\n}\r\n\r\nHackingMission.prototype.createMap = function() {\r\n //Use a grid\r\n var map = document.createElement(\"div\");\r\n map.classList.add(\"hack-mission-grid\");\r\n map.setAttribute(\"id\", \"hacking-mission-map\");\r\n document.getElementById(\"mission-container\").appendChild(map);\r\n\r\n //Create random Nodes for every space in the map that\r\n //hasn't been filled yet. The stats of each Node will be based on\r\n //the player/enemy attack\r\n var averageAttack = (this.playerAtk + this.enemyAtk) / 2;\r\n for (var x = 0; x < 8; ++x) {\r\n for (var y = 0; y < 8; ++y) {\r\n if (!(this.map[x][y] instanceof Node)) {\r\n var node, type = getRandomInt(0, 2);\r\n var randMult = addOffset(0.85 + (this.difficulty / 2), 15);\r\n switch (type) {\r\n case 0: //Spam\r\n var stats = {\r\n atk: 0,\r\n def: averageAttack * 1.1 + getRandomInt(15, 45),\r\n hp: randMult * getRandomInt(200, 225)\r\n }\r\n node = new Node(NodeTypes.Spam, stats);\r\n break;\r\n case 1: //Transfer\r\n var stats = {\r\n atk: 0,\r\n def: averageAttack * 1.1 + getRandomInt(15, 45),\r\n hp: randMult * getRandomInt(250, 275)\r\n }\r\n node = new Node(NodeTypes.Transfer, stats);\r\n break;\r\n case 2: //Shield\r\n default:\r\n var stats = {\r\n atk: 0,\r\n def: averageAttack * 1.1 + getRandomInt(30, 70),\r\n hp: randMult * getRandomInt(300, 320)\r\n }\r\n node = new Node(NodeTypes.Shield, stats);\r\n break;\r\n }\r\n this.setNodePosition(node, x, y);\r\n this.removeAvailablePosition(x, y);\r\n this.miscNodes.push(node);\r\n }\r\n }\r\n }\r\n\r\n //Create DOM elements in order\r\n for (var r = 0; r < 8; ++r) {\r\n for (var c = 0; c < 8; ++c) {\r\n this.createNodeDomElement(this.map[r][c]);\r\n }\r\n }\r\n\r\n //Configure all Player CPUS\r\n for (var i = 0; i < this.playerCores.length; ++i) {\r\n console.log(\"Configuring Player Node: \" + this.playerCores[i].el.id);\r\n this.configurePlayerNodeElement(this.playerCores[i].el);\r\n }\r\n}\r\n\r\nHackingMission.prototype.createNodeDomElement = function(nodeObj) {\r\n var nodeDiv = document.createElement(\"a\"), txtEl = document.createElement('p');\r\n nodeObj.el = nodeDiv;\r\n\r\n //Set the node element's id based on its coordinates\r\n var id = \"hacking-mission-node-\" + nodeObj.pos[0] + \"-\" + nodeObj.pos[1];\r\n nodeDiv.setAttribute(\"id\", id);\r\n txtEl.setAttribute(\"id\", id + \"-txt\");\r\n\r\n //Set node classes for owner\r\n nodeDiv.classList.add(\"hack-mission-node\");\r\n if (nodeObj.plyrCtrl) {\r\n nodeDiv.classList.add(\"hack-mission-player-node\");\r\n } else if (nodeObj.enmyCtrl) {\r\n nodeDiv.classList.add(\"hack-mission-enemy-node\");\r\n }\r\n\r\n //Set node classes based on type\r\n var txt;\r\n switch (nodeObj.type) {\r\n case NodeTypes.Core:\r\n txt = \"CPU Core<br>\" + \"HP: \" +\r\n formatNumber(nodeObj.hp, 1);\r\n nodeDiv.classList.add(\"hack-mission-cpu-node\");\r\n break;\r\n case NodeTypes.Firewall:\r\n txt = \"Firewall<br>\" + \"HP: \" +\r\n formatNumber(nodeObj.hp, 1);\r\n nodeDiv.classList.add(\"hack-mission-firewall-node\");\r\n break;\r\n case NodeTypes.Database:\r\n txt = \"Database<br>\" + \"HP: \" +\r\n formatNumber(nodeObj.hp, 1);\r\n nodeDiv.classList.add(\"hack-mission-database-node\");\r\n break;\r\n case NodeTypes.Spam:\r\n txt = \"Spam<br>\" + \"HP: \" +\r\n formatNumber(nodeObj.hp, 1);\r\n nodeDiv.classList.add(\"hack-mission-spam-node\");\r\n break;\r\n case NodeTypes.Transfer:\r\n txt = \"Transfer<br>\" + \"HP: \" +\r\n formatNumber(nodeObj.hp, 1);\r\n nodeDiv.classList.add(\"hack-mission-transfer-node\");\r\n break;\r\n case NodeTypes.Shield:\r\n default:\r\n txt = \"Shield<br>\" + \"HP: \" +\r\n formatNumber(nodeObj.hp, 1);\r\n nodeDiv.classList.add(\"hack-mission-shield-node\");\r\n break;\r\n }\r\n\r\n txt += \"<br>Atk: \" + formatNumber(nodeObj.atk, 1) +\r\n \"<br>Def: \" + formatNumber(nodeObj.def, 1);\r\n txtEl.innerHTML = txt;\r\n\r\n nodeDiv.appendChild(txtEl);\r\n document.getElementById(\"hacking-mission-map\").appendChild(nodeDiv);\r\n}\r\n\r\nHackingMission.prototype.updateNodeDomElement = function(nodeObj) {\r\n if (nodeObj.el == null) {\r\n console.log(\"ERR: Calling updateNodeDomElement on a Node without an element\");\r\n return;\r\n }\r\n\r\n var id = \"hacking-mission-node-\" + nodeObj.pos[0] + \"-\" + nodeObj.pos[1];\r\n var nodeDiv = document.getElementById(id), txtEl = document.getElementById(id + \"-txt\");\r\n\r\n //Set node classes based on type\r\n var txt;\r\n switch (nodeObj.type) {\r\n case NodeTypes.Core:\r\n txt = \"CPU Core<br>\" + \"HP: \" +\r\n formatNumber(nodeObj.hp, 1);\r\n break;\r\n case NodeTypes.Firewall:\r\n txt = \"Firewall<br>\" + \"HP: \" +\r\n formatNumber(nodeObj.hp, 1);\r\n break;\r\n case NodeTypes.Database:\r\n txt = \"Database<br>\" + \"HP: \" +\r\n formatNumber(nodeObj.hp, 1);\r\n break;\r\n case NodeTypes.Spam:\r\n txt = \"Spam<br>\" + \"HP: \" +\r\n formatNumber(nodeObj.hp, 1);\r\n break;\r\n case NodeTypes.Transfer:\r\n txt = \"Transfer<br>\" + \"HP: \" +\r\n formatNumber(nodeObj.hp, 1);\r\n break;\r\n case NodeTypes.Shield:\r\n default:\r\n txt = \"Shield<br>\" + \"HP: \" +\r\n formatNumber(nodeObj.hp, 1);\r\n break;\r\n }\r\n\r\n txt += \"<br>Atk: \" + formatNumber(nodeObj.atk, 1) +\r\n \"<br>Def: \" + formatNumber(nodeObj.def, 1);\r\n if (nodeObj.action) {\r\n txt += \"<br>\" + nodeObj.action;\r\n }\r\n txtEl.innerHTML = txt;\r\n}\r\n\r\n//Gets a Node DOM element's corresponding Node object using its\r\n//element id. Function accepts either the DOM element object or the ID as\r\n//an argument\r\nHackingMission.prototype.getNodeFromElement = function(el) {\r\n var id;\r\n if (isString(el)) {\r\n id = el;\r\n } else {\r\n id = el.id;\r\n }\r\n id = id.replace(\"hacking-mission-node-\", \"\");\r\n var res = id.split('-');\r\n if (res.length != 2) {\r\n console.log(\"ERROR Parsing Hacking Mission Node Id. Could not find coordinates\");\r\n return null;\r\n }\r\n var x = res[0], y = res[1];\r\n if (isNaN(x) || isNaN(y) || x >= 8 || y >= 8 || x < 0 || y < 0) {\r\n console.log(\"ERROR: Unexpected values for x and y: \" + x + \", \" + y);\r\n return null;\r\n }\r\n return this.map[x][y];\r\n}\r\n\r\nfunction selectNode(hackMissionInst, el) {\r\n var nodeObj = hackMissionInst.getNodeFromElement(el);\r\n if (nodeObj == null) {console.log(\"Error getting Node object\");}\r\n if (!nodeObj.plyrCtrl) {return;}\r\n\r\n clearAllSelectedNodes(hackMissionInst);\r\n nodeObj.select(hackMissionInst.actionButtons);\r\n hackMissionInst.selectedNode.push(nodeObj);\r\n}\r\n\r\nfunction multiselectNode(hackMissionInst, el) {\r\n var nodeObj = hackMissionInst.getNodeFromElement(el);\r\n if (nodeObj == null) {console.log(\"ERROR: Getting Node Object in multiselectNode()\");}\r\n if (!nodeObj.plyrCtrl) {return;}\r\n\r\n clearAllSelectedNodes(hackMissionInst);\r\n var type = nodeObj.type;\r\n if (type === NodeTypes.Core) {\r\n hackMissionInst.playerCores.forEach(function(node) {\r\n node.select(hackMissionInst.actionButtons);\r\n hackMissionInst.selectedNode.push(node);\r\n });\r\n } else {\r\n hackMissionInst.playerNodes.forEach(function(node) {\r\n if (node.type === type) {\r\n node.select(hackMissionInst.actionButtons);\r\n hackMissionInst.selectedNode.push(node);\r\n }\r\n });\r\n }\r\n}\r\n\r\nfunction clearAllSelectedNodes(hackMissionInst) {\r\n if (hackMissionInst.selectedNode.length > 0) {\r\n hackMissionInst.selectedNode.forEach(function(node){\r\n node.deselect(hackMissionInst.actionButtons);\r\n });\r\n hackMissionInst.selectedNode.length = 0;\r\n }\r\n}\r\n\r\n//Configures a DOM element representing a player-owned node to\r\n//be selectable and actionable\r\n//Note: Does NOT change its css class. This is handled by Node.setControlledBy...\r\nHackingMission.prototype.configurePlayerNodeElement = function(el) {\r\n var nodeObj = this.getNodeFromElement(el);\r\n if (nodeObj == null) {console.log(\"Error getting Node object\");}\r\n\r\n //Add event listener\r\n var self = this;\r\n function selectNodeWrapper() {\r\n selectNode(self, el);\r\n }\r\n el.addEventListener(\"click\", selectNodeWrapper);\r\n\r\n function multiselectNodeWrapper() {\r\n multiselectNode(self, el);\r\n }\r\n el.addEventListener(\"dblclick\", multiselectNodeWrapper);\r\n\r\n\r\n if (el.firstChild) {\r\n el.firstChild.addEventListener(\"click\", selectNodeWrapper);\r\n }\r\n}\r\n\r\n//Configures a DOM element representing an enemy-node by removing\r\n//any event listeners\r\nHackingMission.prototype.configureEnemyNodeElement = function(el) {\r\n //Deselect node if it was the selected node\r\n var nodeObj = this.getNodeFromElement(el);\r\n for (var i = 0; i < this.selectedNode.length; ++i) {\r\n if (this.selectedNode[i] == nodeObj) {\r\n nodeObj.deselect(this.actionButtons);\r\n this.selectedNode.splice(i, 1);\r\n break;\r\n }\r\n }\r\n}\r\n\r\n//Returns bool indicating whether a node is reachable by player\r\n//by checking if any of the adjacent nodes are owned by the player\r\nHackingMission.prototype.nodeReachable = function(node) {\r\n var x = node.pos[0], y = node.pos[1];\r\n if (x > 0 && this.map[x-1][y].plyrCtrl) {return true;}\r\n if (x < 7 && this.map[x+1][y].plyrCtrl) {return true;}\r\n if (y > 0 && this.map[x][y-1].plyrCtrl) {return true;}\r\n if (y < 7 && this.map[x][y+1].plyrCtrl) {return true;}\r\n return false;\r\n}\r\n\r\nHackingMission.prototype.nodeReachableByEnemy = function(node) {\r\n if (node == null) {return false;}\r\n var x = node.pos[0], y = node.pos[1];\r\n if (x > 0 && this.map[x-1][y].enmyCtrl) {return true;}\r\n if (x < 7 && this.map[x+1][y].enmyCtrl) {return true;}\r\n if (y > 0 && this.map[x][y-1].enmyCtrl) {return true;}\r\n if (y < 7 && this.map[x][y+1].enmyCtrl) {return true;}\r\n return false;\r\n}\r\n\r\nHackingMission.prototype.start = function() {\r\n this.started = true;\r\n this.initJsPlumb();\r\n var startBtn = clearEventListeners(\"hack-mission-start-btn\");\r\n startBtn.classList.remove(\"a-link-button\");\r\n startBtn.classList.add(\"a-link-button-inactive\");\r\n}\r\n\r\nHackingMission.prototype.initJsPlumb = function() {\r\n var instance = jsPlumb.getInstance({\r\n DragOptions:{cursor:\"pointer\", zIndex:2000},\r\n PaintStyle: {\r\n gradient: { stops: [\r\n [ 0, \"#FFFFFF\" ],\r\n [ 1, \"#FFFFFF\" ]\r\n ] },\r\n stroke: \"#FFFFFF\",\r\n strokeWidth: 8\r\n },\r\n });\r\n\r\n this.jsplumbinstance = instance;\r\n\r\n //All player cores are sources\r\n for (var i = 0; i < this.playerCores.length; ++i) {\r\n instance.makeSource(this.playerCores[i].el, {\r\n deleteEndpointsOnEmpty:true,\r\n maxConnections:1,\r\n anchor:\"Continuous\",\r\n connector:\"Flowchart\"\r\n });\r\n }\r\n\r\n //Everything else is a target\r\n for (var i = 0; i < this.enemyCores.length; ++i) {\r\n instance.makeTarget(this.enemyCores[i].el, {\r\n maxConnections:-1,\r\n anchor:\"Continuous\",\r\n connector:\"Flowchart\"\r\n });\r\n }\r\n for (var i = 0; i < this.enemyDatabases.length; ++i) {\r\n instance.makeTarget(this.enemyDatabases[i].el, {\r\n maxConnections:-1,\r\n anchor:\"Continuous\",\r\n connector:[\"Flowchart\"]\r\n });\r\n }\r\n for (var i = 0; i < this.enemyNodes.length; ++i) {\r\n instance.makeTarget(this.enemyNodes[i].el, {\r\n maxConnections:-1,\r\n anchor:\"Continuous\",\r\n connector:\"Flowchart\"\r\n });\r\n }\r\n for (var i = 0; i < this.miscNodes.length; ++i) {\r\n instance.makeTarget(this.miscNodes[i].el, {\r\n maxConnections:-1,\r\n anchor:\"Continuous\",\r\n connector:\"Flowchart\"\r\n });\r\n }\r\n\r\n //Clicking a connection drops it\r\n instance.bind(\"click\", function(conn, originalEvent) {\r\n var endpoints = conn.endpoints;\r\n endpoints[0].detachFrom(endpoints[1]);\r\n });\r\n\r\n //Connection events\r\n instance.bind(\"connection\", (info)=>{\r\n var targetNode = this.getNodeFromElement(info.target);\r\n\r\n //Do not detach for enemy nodes\r\n var thisNode = this.getNodeFromElement(info.source);\r\n if (thisNode.enmyCtrl) {return;}\r\n\r\n //If the node is not reachable, drop the connection\r\n if (!this.nodeReachable(targetNode)) {\r\n info.sourceEndpoint.detachFrom(info.targetEndpoint);\r\n return;\r\n }\r\n\r\n var sourceNode = this.getNodeFromElement(info.source);\r\n sourceNode.conn = info.connection;\r\n var targetNode = this.getNodeFromElement(info.target);\r\n ++targetNode.targetedCount;\r\n });\r\n\r\n //Detach Connection events\r\n instance.bind(\"connectionDetached\", (info, originalEvent)=>{\r\n var sourceNode = this.getNodeFromElement(info.source);\r\n sourceNode.conn = null;\r\n var targetNode = this.getNodeFromElement(info.target);\r\n targetNode.untarget();\r\n });\r\n\r\n}\r\n\r\n//Drops all connections where the specified node is the source\r\nHackingMission.prototype.dropAllConnectionsFromNode = function(node) {\r\n var allConns = this.jsplumbinstance.getAllConnections();\r\n for (var i = allConns.length-1; i >= 0; --i) {\r\n if (allConns[i].source == node.el) {\r\n allConns[i].endpoints[0].detachFrom(allConns[i].endpoints[1]);\r\n }\r\n }\r\n}\r\n\r\n//Drops all connections where the specified node is the target\r\nHackingMission.prototype.dropAllConnectionsToNode = function(node) {\r\n var allConns = this.jsplumbinstance.getAllConnections();\r\n for (var i = allConns.length-1; i >= 0; --i) {\r\n if (allConns[i].target == node.el) {\r\n allConns[i].endpoints[0].detachFrom(allConns[i].endpoints[1]);\r\n }\r\n }\r\n node.beingTargeted = false;\r\n}\r\n\r\nvar storedCycles = 0;\r\nHackingMission.prototype.process = function(numCycles=1) {\r\n if (!this.started) {return;}\r\n storedCycles += numCycles;\r\n if (storedCycles < 2) {return;} //Only process every 3 cycles minimum\r\n\r\n var res = false;\r\n //Process actions of all player nodes\r\n this.playerCores.forEach((node)=>{\r\n res |= this.processNode(node, storedCycles);\r\n });\r\n\r\n this.playerNodes.forEach((node)=>{\r\n if (node.type === NodeTypes.Transfer ||\r\n node.type === NodeTypes.Shield ||\r\n node.type === NodeTypes.Firewall) {\r\n res |= this.processNode(node, storedCycles);\r\n }\r\n });\r\n\r\n //Process actions of all enemy nodes\r\n this.enemyCores.forEach((node)=>{\r\n this.enemyAISelectAction(node);\r\n res |= this.processNode(node, storedCycles);\r\n });\r\n\r\n this.enemyNodes.forEach((node)=>{\r\n if (node.type === NodeTypes.Transfer ||\r\n node.type === NodeTypes.Shield ||\r\n node.type === NodeTypes.Firewall) {\r\n this.enemyAISelectAction(node);\r\n res |= this.processNode(node, storedCycles);\r\n }\r\n });\r\n\r\n //The hp of enemy databases increases slowly\r\n this.enemyDatabases.forEach((node)=>{\r\n node.maxhp += (0.1 * storedCycles);\r\n node.hp += (0.1 * storedCycles);\r\n });\r\n\r\n if (res) {\r\n this.calculateAttacks();\r\n this.calculateDefenses();\r\n }\r\n\r\n //Win if all enemy databases are conquered\r\n if (this.enemyDatabases.length === 0) {\r\n this.finishMission(true);\r\n return;\r\n }\r\n\r\n //Lose if all your cores are gone\r\n if (this.playerCores.length === 0) {\r\n this.finishMission(false);\r\n return;\r\n }\r\n\r\n //Defense/hp of misc nodes increases slowly over time\r\n this.miscNodes.forEach((node)=>{\r\n node.def += (0.1 * storedCycles);\r\n node.maxhp += (0.05 * storedCycles);\r\n node.hp += (0.1 * storedCycles);\r\n if (node.hp > node.maxhp) {node.hp = node.maxhp;}\r\n this.updateNodeDomElement(node);\r\n });\r\n\r\n //Update timer and check if player lost\r\n this.time -= (storedCycles * Engine._idleSpeed);\r\n if (this.time <= 0) {\r\n this.finishMission(false);\r\n return;\r\n }\r\n this.updateTimer();\r\n\r\n storedCycles = 0;\r\n}\r\n\r\n//Returns a bool representing whether defenses need to be re-calculated\r\nHackingMission.prototype.processNode = function(nodeObj, numCycles=1) {\r\n if (nodeObj.action == null) {\r\n return;\r\n }\r\n\r\n var targetNode = null, def, atk;\r\n if (nodeObj.conn) {\r\n if (nodeObj.conn.target != null) {\r\n targetNode = this.getNodeFromElement(nodeObj.conn.target);\r\n } else {\r\n targetNode = this.getNodeFromElement(nodeObj.conn.targetId);\r\n }\r\n\r\n if (targetNode == null) {\r\n //Player is in the middle of dragging the connection,\r\n //so the target node is null. Do nothing here\r\n } else if (targetNode.plyrCtrl) {\r\n def = this.playerDef;\r\n atk = this.enemyAtk;\r\n } else if (targetNode.enmyCtrl) {\r\n def = this.enemyDef;\r\n atk = this.playerAtk;\r\n } else { //Misc Node\r\n def = targetNode.def;\r\n nodeObj.plyrCtrl ? atk = this.playerAtk : atk = this.enemyAtk;\r\n }\r\n }\r\n\r\n //Calculations are per second, so divide everything by 5\r\n var calcStats = false, plyr = nodeObj.plyrCtrl;\r\n var enmyHacking = this.difficulty * CONSTANTS.HackingMissionDifficultyToHacking;\r\n switch(nodeObj.action) {\r\n case NodeActions.Attack:\r\n if (targetNode == null) {break;}\r\n if (nodeObj.conn == null) {break;}\r\n var dmg = this.calculateAttackDamage(atk, def, plyr ? Player.hacking_skill : enmyHacking);\r\n targetNode.hp -= (dmg/5 * numCycles);\r\n break;\r\n case NodeActions.Scan:\r\n if (targetNode == null) {break;}\r\n if (nodeObj.conn == null) {break;}\r\n var eff = this.calculateScanEffect(atk, def, plyr ? Player.hacking_skill : enmyHacking);\r\n targetNode.def -= (eff/5 * numCycles);\r\n calcStats = true;\r\n break;\r\n case NodeActions.Weaken:\r\n if (targetNode == null) {break;}\r\n if (nodeObj.conn == null) {break;}\r\n var eff = this.calculateWeakenEffect(atk, def, plyr ? Player.hacking_skill : enmyHacking);\r\n targetNode.atk -= (eff/5 * numCycles);\r\n calcStats = true;\r\n break;\r\n case NodeActions.Fortify:\r\n var eff = this.calculateFortifyEffect(Player.hacking_skill);\r\n nodeObj.def += (eff/5 * numCycles);\r\n calcStats = true;\r\n break;\r\n case NodeActions.Overflow:\r\n var eff = this.calculateOverflowEffect(Player.hacking_skill);\r\n if (nodeObj.def < eff) {break;}\r\n nodeObj.def -= (eff/5 * numCycles);\r\n nodeObj.atk += (eff/5 * numCycles);\r\n calcStats = true;\r\n break;\r\n default:\r\n console.log(\"ERR: Invalid Node Action: \" + nodeObj.action);\r\n break;\r\n }\r\n\r\n //Stats can't go below 0\r\n if (nodeObj.atk < 0) {nodeObj.atk = 0;}\r\n if (nodeObj.def < 0) {nodeObj.def = 0;}\r\n if (targetNode && targetNode.atk < 0) {targetNode.atk = 0;}\r\n if (targetNode && targetNode.def < 0) {targetNode.def = 0;}\r\n\r\n //Conquering a node\r\n if (targetNode && targetNode.hp <= 0) {\r\n var conqueredByPlayer = nodeObj.plyrCtrl;\r\n targetNode.hp = targetNode.maxhp;\r\n targetNode.action = null;\r\n targetNode.conn = null;\r\n if (this.selectedNode == targetNode) {\r\n targetNode.deselect(this.actionButtons);\r\n }\r\n\r\n //The conquered node has its stats reduced\r\n targetNode.atk /= 2;\r\n targetNode.def /= 3.5;\r\n\r\n //Flag for whether the target node was a misc node\r\n var isMiscNode = !targetNode.plyrCtrl && !targetNode.enmyCtrl;\r\n\r\n //Remove all connections from Node\r\n this.dropAllConnectionsToNode(targetNode);\r\n this.dropAllConnectionsFromNode(targetNode);\r\n\r\n //Changes the css class and turn the node into a JsPlumb Source/Target\r\n if (conqueredByPlayer) {\r\n targetNode.setControlledByPlayer();\r\n this.jsplumbinstance.unmakeTarget(targetNode.el);\r\n this.jsplumbinstance.makeSource(targetNode.el, {\r\n deleteEndpointsOnEmpty:true,\r\n maxConnections:1,\r\n anchor:\"Continuous\",\r\n connector:\"Flowchart\"\r\n });\r\n } else {\r\n targetNode.setControlledByEnemy();\r\n nodeObj.conn = null; //Clear connection\r\n this.jsplumbinstance.unmakeSource(targetNode.el);\r\n this.jsplumbinstance.makeTarget(targetNode.el, {\r\n maxConnections:-1,\r\n anchor:\"Continuous\",\r\n connector:[\"Flowchart\"]\r\n });\r\n }\r\n\r\n calcStats = true;\r\n\r\n //Helper function to swap nodes between the respective enemyNodes/playerNodes arrays\r\n function swapNodes(orig, dest, targetNode) {\r\n for (var i = 0; i < orig.length; ++i) {\r\n if (orig[i] == targetNode) {\r\n var node = orig.splice(i, 1);\r\n node = node[0];\r\n dest.push(node);\r\n break;\r\n }\r\n }\r\n }\r\n\r\n switch(targetNode.type) {\r\n case NodeTypes.Core:\r\n if (conqueredByPlayer) {\r\n swapNodes(this.enemyCores, this.playerCores, targetNode);\r\n this.configurePlayerNodeElement(targetNode.el);\r\n } else {\r\n swapNodes(this.playerCores, this.enemyCores, targetNode);\r\n this.configureEnemyNodeElement(targetNode.el);\r\n }\r\n break;\r\n case NodeTypes.Firewall:\r\n if (conqueredByPlayer) {\r\n swapNodes(this.enemyNodes, this.playerNodes, targetNode);\r\n } else {\r\n swapNodes(this.playerNodes, this.enemyNodes, targetNode);\r\n this.configureEnemyNodeElement(targetNode.el);\r\n }\r\n break;\r\n case NodeTypes.Database:\r\n if (conqueredByPlayer) {\r\n swapNodes(this.enemyDatabases, this.playerNodes, targetNode);\r\n } else {\r\n swapNodes(this.playerNodes, this.enemyDatabases, targetNode);\r\n }\r\n break;\r\n case NodeTypes.Spam:\r\n if (conqueredByPlayer) {\r\n swapNodes(isMiscNode ? this.miscNodes : this.enemyNodes, this.playerNodes, targetNode);\r\n //Conquering spam node increases time limit\r\n this.time += CONSTANTS.HackingMissionSpamTimeIncrease;\r\n } else {\r\n swapNodes(isMiscNode ? this.miscNodes : this.playerNodes, this.enemyNodes, targetNode);\r\n }\r\n\r\n break;\r\n case NodeTypes.Transfer:\r\n //Conquering a Transfer node increases the attack of all cores by some percentages\r\n if (conqueredByPlayer) {\r\n swapNodes(isMiscNode ? this.miscNodes : this.enemyNodes, this.playerNodes, targetNode);\r\n this.playerCores.forEach(function(node) {\r\n node.atk *= CONSTANTS.HackingMissionTransferAttackIncrease;\r\n });\r\n this.configurePlayerNodeElement(targetNode.el);\r\n } else {\r\n swapNodes(isMiscNode ? this.miscNodes : this.playerNodes, this.enemyNodes, targetNode);\r\n this.enemyCores.forEach(function(node) {\r\n node.atk *= CONSTANTS.HackingMissionTransferAttackIncrease;\r\n });\r\n this.configureEnemyNodeElement(targetNode.el);\r\n }\r\n break;\r\n case NodeTypes.Shield:\r\n if (conqueredByPlayer) {\r\n swapNodes(isMiscNode ? this.miscNodes : this.enemyNodes, this.playerNodes, targetNode);\r\n this.configurePlayerNodeElement(targetNode.el);\r\n } else {\r\n swapNodes(isMiscNode ? this.miscNodes : this.playerNodes, this.enemyNodes, targetNode);\r\n this.configureEnemyNodeElement(targetNode.el);\r\n }\r\n break;\r\n }\r\n\r\n //If a misc node was conquered, the defense for all misc nodes increases by some fixed amount\r\n if (isMiscNode) { //&& conqueredByPlayer) {\r\n this.miscNodes.forEach((node)=>{\r\n if (node.targetedCount === 0) {\r\n node.def *= CONSTANTS.HackingMissionMiscDefenseIncrease;\r\n }\r\n });\r\n }\r\n }\r\n\r\n //Update node DOMs\r\n this.updateNodeDomElement(nodeObj);\r\n if (targetNode) {this.updateNodeDomElement(targetNode);}\r\n return calcStats;\r\n}\r\n\r\n//Enemy \"AI\" for CPU Core and Transfer Nodes\r\nHackingMission.prototype.enemyAISelectAction = function(nodeObj) {\r\n if (nodeObj == null) {return;}\r\n switch(nodeObj.type) {\r\n case NodeTypes.Core:\r\n //Select a single RANDOM target from miscNodes and player's Nodes\r\n //If it is reachable, it will target it. If not, no target will\r\n //be selected for now, and the next time process() gets called this will repeat\r\n if (nodeObj.conn == null) {\r\n if (this.miscNodes.length === 0) {\r\n //Randomly pick a player node and attack it if its reachable\r\n var rand = getRandomInt(0, this.playerNodes.length-1);\r\n var node;\r\n if (this.playerNodes.length === 0) {\r\n node = null;\r\n } else {\r\n node = this.playerNodes[rand];\r\n }\r\n if (this.nodeReachableByEnemy(node)) {\r\n //Create connection\r\n nodeObj.conn = this.jsplumbinstance.connect({\r\n source:nodeObj.el,\r\n target:node.el\r\n });\r\n ++node.targetedCount;\r\n } else {\r\n //Randomly pick a player core and attack it if its reachable\r\n rand = getRandomInt(0, this.playerCores.length-1);\r\n if (this.playerCores.length === 0) {\r\n return; //No Misc Nodes, no player Nodes, no Player cores. Player lost\r\n } else {\r\n node = this.playerCores[rand];\r\n }\r\n\r\n if (this.nodeReachableByEnemy(node)) {\r\n //Create connection\r\n nodeObj.conn = this.jsplumbinstance.connect({\r\n source:nodeObj.el,\r\n target:node.el\r\n });\r\n ++node.targetedCount;\r\n }\r\n }\r\n } else {\r\n //Randomly pick a misc node and attack it if its reachable\r\n var rand = getRandomInt(0, this.miscNodes.length-1);\r\n var node = this.miscNodes[rand];\r\n if (this.nodeReachableByEnemy(node)) {\r\n nodeObj.conn = this.jsplumbinstance.connect({\r\n source:nodeObj.el,\r\n target:node.el,\r\n });\r\n ++node.targetedCount;\r\n }\r\n }\r\n\r\n //If no connection was made, set the Core to Fortify\r\n nodeObj.action = NodeActions.Fortify;\r\n } else {\r\n //If this node has a selected target\r\n var targetNode;\r\n if (nodeObj.conn.target) {\r\n targetNode = this.getNodeFromElement(nodeObj.conn.target);\r\n } else {\r\n targetNode = this.getNodeFromElement(nodeObj.conn.targetId);\r\n }\r\n if (targetNode == null) {\r\n console.log(\"Error getting Target node Object in enemyAISelectAction()\");\r\n }\r\n\r\n if (targetNode.def > this.enemyAtk + 15) {\r\n if (nodeObj.def < 50) {\r\n nodeObj.action = NodeActions.Fortify;\r\n } else {\r\n nodeObj.action = NodeActions.Overflow;\r\n }\r\n } else if (Math.abs(targetNode.def - this.enemyAtk) <= 15) {\r\n nodeObj.action = NodeActions.Scan;\r\n } else {\r\n nodeObj.action = NodeActions.Attack;\r\n }\r\n }\r\n break;\r\n case NodeTypes.Transfer:\r\n //Switch between fortifying and overflowing as necessary\r\n if (nodeObj.def < 125) {\r\n nodeObj.action = NodeActions.Fortify;\r\n } else {\r\n nodeObj.action = NodeActions.Overflow;\r\n }\r\n break;\r\n case NodeTypes.Firewall:\r\n case NodeTypes.Shield:\r\n nodeObj.action = NodeActions.Fortify;\r\n break;\r\n default:\r\n break;\r\n }\r\n}\r\n\r\nvar hackEffWeightSelf = 130; //Weight for Node actions on self\r\nvar hackEffWeightTarget = 25; //Weight for Node Actions against Target\r\nvar hackEffWeightAttack = 80; //Weight for Attack action\r\n\r\n//Returns damage per cycle based on stats\r\nHackingMission.prototype.calculateAttackDamage = function(atk, def, hacking = 0) {\r\n return Math.max(0.55 * (atk + (hacking / hackEffWeightAttack) - def), 1);\r\n}\r\n\r\nHackingMission.prototype.calculateScanEffect = function(atk, def, hacking=0) {\r\n return Math.max(0.6 * ((atk) + hacking / hackEffWeightTarget - (def * 0.95)), 2);\r\n}\r\n\r\nHackingMission.prototype.calculateWeakenEffect = function(atk, def, hacking=0) {\r\n return Math.max((atk) + hacking / hackEffWeightTarget - (def * 0.95), 2);\r\n}\r\n\r\nHackingMission.prototype.calculateFortifyEffect = function(hacking=0) {\r\n return 0.9 * hacking / hackEffWeightSelf;\r\n}\r\n\r\nHackingMission.prototype.calculateOverflowEffect = function(hacking=0) {\r\n return 0.95 * hacking / hackEffWeightSelf;\r\n}\r\n\r\n//Updates timer display\r\nHackingMission.prototype.updateTimer = function() {\r\n var timer = document.getElementById(\"hacking-mission-timer\");\r\n\r\n //Convert time remaining to a string of the form mm:ss\r\n var seconds = Math.round(this.time / 1000);\r\n var minutes = Math.trunc(seconds / 60);\r\n seconds %= 60;\r\n var str = (\"0\" + minutes).slice(-2) + \":\" + (\"0\" + seconds).slice(-2);\r\n timer.innerText = \"Time left: \" + str;\r\n}\r\n\r\n//The 'win' argument is a bool for whether or not the player won\r\nHackingMission.prototype.finishMission = function(win) {\r\n inMission = false;\r\n currMission = null;\r\n\r\n if (win) {\r\n var favorMult = 1 + (this.faction.favor / 100);\r\n console.log(\"Hacking mission base reward: \" + this.reward);\r\n console.log(\"favorMult: \" + favorMult);\r\n console.log(\"rep mult: \" + Player.faction_rep_mult);\r\n var gain = this.reward * Player.faction_rep_mult * favorMult;\r\n dialogBoxCreate(\"Mission won! You earned \" +\r\n formatNumber(gain, 3) + \" reputation with \" + this.faction.name);\r\n Player.gainIntelligenceExp(this.difficulty * CONSTANTS.IntelligenceHackingMissionBaseExpGain);\r\n this.faction.playerReputation += gain;\r\n } else {\r\n dialogBoxCreate(\"Mission lost/forfeited! You did not gain any faction reputation.\");\r\n }\r\n\r\n //Clear mission container\r\n var container = document.getElementById(\"mission-container\");\r\n while(container.firstChild) {\r\n container.removeChild(container.firstChild);\r\n }\r\n\r\n //Return to Faction page\r\n document.getElementById(\"mainmenu-container\").style.visibility = \"visible\";\r\n document.getElementById(\"character-overview-wrapper\").style.visibility = \"visible\";\r\n Engine.loadFactionContent();\r\n displayFactionContent(this.faction.name);\r\n}\r\n\r\nexport {HackingMission, inMission, setInMission, currMission};\r\n","import {Programs} from \"./CreateProgram.js\";\r\nimport {Player} from \"./Player.js\";\r\nimport {SpecialServerIps} from \"./SpecialServerIps.js\";\r\nimport {post} from \"./Terminal.js\";\r\n\r\nimport {isValidIPAddress} from \"../utils/IPAddress.js\";\r\nimport {formatNumber} from \"../utils/StringHelperFunctions.js\";\r\n\r\n\r\n/* DarkWeb.js */\r\n//Posts a \"help\" message if connected to DarkWeb\r\nfunction checkIfConnectedToDarkweb() {\r\n if (SpecialServerIps.hasOwnProperty(\"Darkweb Server\")) {\r\n var darkwebIp = SpecialServerIps[\"Darkweb Server\"];\r\n if (!isValidIPAddress(darkwebIp)) {return;}\r\n if (darkwebIp == Player.getCurrentServer().ip) {\r\n post(\"You are now connected to the dark web. From the dark web you can purchase illegal items. \" +\r\n \"Use the 'buy -l' command to display a list of all the items you can buy. Use 'buy [item-name] \" +\r\n \"to purchase an item\");\r\n }\r\n }\r\n\r\n}\r\n\r\n//Handler for dark web commands. The terminal's executeCommand() function will pass\r\n//dark web-specific commands into this. It will pass in the raw split command array\r\n//rather than the command string\r\nfunction executeDarkwebTerminalCommand(commandArray) {\r\n if (commandArray.length == 0) {return;}\r\n switch (commandArray[0]) {\r\n case \"buy\":\r\n if (commandArray.length != 2) {\r\n post(\"Incorrect number of arguments. Usage: \");\r\n post(\"buy -l\");\r\n post(\"buy [item name]\");\r\n return;\r\n }\r\n var arg = commandArray[1];\r\n if (arg == \"-l\") {\r\n listAllDarkwebItems();\r\n } else {\r\n buyDarkwebItem(arg);\r\n }\r\n break;\r\n default:\r\n post(\"Command not found\");\r\n break;\r\n }\r\n}\r\n\r\nfunction listAllDarkwebItems() {\r\n for (var item in DarkWebItems) {\r\n\t\tif (DarkWebItems.hasOwnProperty(item)) {\r\n var item = DarkWebItems[item];\r\n //Convert string using toLocaleString\r\n var split = item.split(\" - \");\r\n if (split.length == 3 && split[1].charAt(0) == '$') {\r\n split[1] = split[1].slice(1);\r\n split[1] = split[1].replace(/,/g, '');\r\n var price = parseFloat(split[1]);\r\n if (isNaN(price)) {\r\n post(item);\r\n return;\r\n }\r\n price = formatNumber(price, 0);\r\n split[1] = \"$\" + price.toString();\r\n post(split.join(\" - \"));\r\n } else {\r\n post(item);\r\n }\r\n\t\t}\r\n\t}\r\n\r\n var priceString = split[1];\r\n //Check for errors\r\n if (priceString.length == 0 || priceString.charAt(0) != '$') {\r\n return -1;\r\n }\r\n //Remove dollar sign and commas\r\n priceString = priceString.slice(1);\r\n priceString = priceString.replace(/,/g, '');\r\n\r\n //Convert string to numeric\r\n var price = parseFloat(priceString);\r\n if (isNaN(price)) {return -1;}\r\n else {return price;}\r\n}\r\n\r\nfunction buyDarkwebItem(itemName) {\r\n if (itemName.toLowerCase() == Programs.BruteSSHProgram.toLowerCase()) {\r\n var price = parseDarkwebItemPrice(DarkWebItems.BruteSSHProgram);\r\n if (price > 0 && Player.money.gt(price)) {\r\n Player.loseMoney(price);\r\n Player.getHomeComputer().programs.push(Programs.BruteSSHProgram);\r\n post(\"You have purchased the BruteSSH.exe program. The new program \" +\r\n \"can be found on your home computer.\");\r\n } else {\r\n post(\"Not enough money to purchase \" + itemName);\r\n }\r\n } else if (itemName.toLowerCase() == Programs.FTPCrackProgram.toLowerCase()) {\r\n var price = parseDarkwebItemPrice(DarkWebItems.FTPCrackProgram);\r\n if (price > 0 && Player.money.gt(price)) {\r\n Player.loseMoney(price);\r\n Player.getHomeComputer().programs.push(Programs.FTPCrackProgram);\r\n post(\"You have purchased the FTPCrack.exe program. The new program \" +\r\n \"can be found on your home computer.\");\r\n } else {\r\n post(\"Not enough money to purchase \" + itemName);\r\n }\r\n } else if (itemName.toLowerCase() == Programs.RelaySMTPProgram.toLowerCase()) {\r\n var price = parseDarkwebItemPrice(DarkWebItems.RelaySMTPProgram);\r\n if (price > 0 && Player.money.gt(price)) {\r\n Player.loseMoney(price);\r\n Player.getHomeComputer().programs.push(Programs.RelaySMTPProgram);\r\n post(\"You have purchased the relaySMTP.exe program. The new program \" +\r\n \"can be found on your home computer.\");\r\n } else {\r\n post(\"Not enough money to purchase \" + itemName);\r\n }\r\n } else if (itemName.toLowerCase() == Programs.HTTPWormProgram.toLowerCase()) {\r\n var price = parseDarkwebItemPrice(DarkWebItems.HTTPWormProgram);\r\n if (price > 0 && Player.money.gt(price)) {\r\n Player.loseMoney(price);\r\n Player.getHomeComputer().programs.push(Programs.HTTPWormProgram);\r\n post(\"You have purchased the HTTPWorm.exe program. The new program \" +\r\n \"can be found on your home computer.\");\r\n } else {\r\n post(\"Not enough money to purchase \" + itemName);\r\n }\r\n } else if (itemName.toLowerCase() == Programs.SQLInjectProgram.toLowerCase()) {\r\n var price = parseDarkwebItemPrice(DarkWebItems.SQLInjectProgram);\r\n if (price > 0 && Player.money.gt(price)) {\r\n Player.loseMoney(price);\r\n Player.getHomeComputer().programs.push(Programs.SQLInjectProgram);\r\n post(\"You have purchased the SQLInject.exe program. The new program \" +\r\n \"can be found on your home computer.\");\r\n } else {\r\n post(\"Not enough money to purchase \" + itemName);\r\n }\r\n } else if (itemName.toLowerCase() == Programs.DeepscanV1.toLowerCase()) {\r\n var price = parseDarkwebItemPrice(DarkWebItems.DeepScanV1Program);\r\n if (price > 0 && Player.money.gt(price)) {\r\n Player.loseMoney(price);\r\n Player.getHomeComputer().programs.push(Programs.DeepscanV1);\r\n post(\"You have purchased the DeepscanV1.exe program. The new program \" +\r\n \"can be found on your home computer.\");\r\n } else {\r\n post(\"Not enough money to purchase \" + itemName);\r\n }\r\n } else if (itemName.toLowerCase() == Programs.DeepscanV2.toLowerCase()) {\r\n var price = parseDarkwebItemPrice(DarkWebItems.DeepScanV2Program);\r\n if (price > 0 && Player.money.gt(price)) {\r\n Player.loseMoney(price);\r\n Player.getHomeComputer().programs.push(Programs.DeepscanV2);\r\n post(\"You have purchased the DeepscanV2.exe program. The new program \" +\r\n \"can be found on your home computer.\");\r\n } else {\r\n post(\"Not enough money to purchase \" + itemName);\r\n }\r\n } else {\r\n post(\"Unrecognized item\");\r\n }\r\n}\r\n\r\nfunction parseDarkwebItemPrice(itemDesc) {\r\n var split = itemDesc.split(\" - \");\r\n if (split.length == 3) {\r\n var priceString = split[1];\r\n //Check for errors\r\n if (priceString.length == 0 || priceString.charAt(0) != '$') {\r\n return -1;\r\n }\r\n //Remove dollar sign and commas\r\n priceString = priceString.slice(1);\r\n priceString = priceString.replace(/,/g, '');\r\n\r\n //Convert string to numeric\r\n var price = parseFloat(priceString);\r\n if (isNaN(price)) {return -1;}\r\n else {return price;}\r\n } else {\r\n return -1;\r\n }\r\n}\r\n\r\nlet DarkWebItems = {\r\n BruteSSHProgram: \"BruteSSH.exe - $500,000 - Opens up SSH Ports\",\r\n FTPCrackProgram: \"FTPCrack.exe - $1,500,000 - Opens up FTP Ports\",\r\n RelaySMTPProgram: \"relaySMTP.exe - $5,000,000 - Opens up SMTP Ports\",\r\n HTTPWormProgram: \"HTTPWorm.exe - $30,000,000 - Opens up HTTP Ports\",\r\n SQLInjectProgram: \"SQLInject.exe - $250,000,000 - Opens up SQL Ports\",\r\n DeepScanV1Program: \"DeepscanV1.exe - $500,000 - Enables 'scan-analyze' with a depth up to 5\",\r\n DeepScanV2Program: \"DeepscanV2.exe - $25,000,000 - Enables 'scan-analyze' with a depth up to 10\",\r\n}\r\n\r\nexport {checkIfConnectedToDarkweb, executeDarkwebTerminalCommand,\r\n listAllDarkwebItems, buyDarkwebItem, parseDarkwebItemPrice,\r\n DarkWebItems};\r\n","/*\r\nacorn.js \r\nhttps://github.com/ternjs/acorn\r\n\r\nCopyright (C) 2012-2017 by various contributors (see AUTHORS)\r\n\r\nPermission is hereby granted, free of charge, to any person obtaining a copy\r\nof this software and associated documentation files (the \"Software\"), to deal\r\nin the Software without restriction, including without limitation the rights\r\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r\ncopies of the Software, and to permit persons to whom the Software is\r\nfurnished to do so, subject to the following conditions:\r\n\r\nThe above copyright notice and this permission notice shall be included in\r\nall copies or substantial portions of the Software.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\r\nTHE SOFTWARE.\r\n*/\r\n\r\n(function (global, factory) {\r\n typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :\r\n typeof define === 'function' && define.amd ? define(['exports'], factory) :\r\n (factory((global.acorn = global.acorn || {})));\r\n}(this, (function (exports) { 'use strict';\r\n\r\n// Reserved word lists for various dialects of the language\r\n\r\nvar reservedWords = {\r\n 3: \"abstract boolean byte char class double enum export extends final float goto implements import int interface long native package private protected public short static super synchronized throws transient volatile\",\r\n 5: \"class enum extends super const export import\",\r\n 6: \"enum\",\r\n strict: \"implements interface let package private protected public static yield\",\r\n strictBind: \"eval arguments\"\r\n}\r\n\r\n// And the keywords\r\n\r\nvar ecma5AndLessKeywords = \"break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this\"\r\n\r\nvar keywords = {\r\n 5: ecma5AndLessKeywords,\r\n 6: ecma5AndLessKeywords + \" const class extends export import super\"\r\n}\r\n\r\n// ## Character categories\r\n\r\n// Big ugly regular expressions that match characters in the\r\n// whitespace, identifier, and identifier-start categories. These\r\n// are only applied when a character is found to actually have a\r\n// code point above 128.\r\n// Generated by `bin/generate-identifier-regex.js`.\r\n\r\nvar nonASCIIidentifierStartChars = \"\\xaa\\xb5\\xba\\xc0-\\xd6\\xd8-\\xf6\\xf8-\\u02c1\\u02c6-\\u02d1\\u02e0-\\u02e4\\u02ec\\u02ee\\u0370-\\u0374\\u0376\\u0377\\u037a-\\u037d\\u037f\\u0386\\u0388-\\u038a\\u038c\\u038e-\\u03a1\\u03a3-\\u03f5\\u03f7-\\u0481\\u048a-\\u052f\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u05d0-\\u05ea\\u05f0-\\u05f2\\u0620-\\u064a\\u066e\\u066f\\u0671-\\u06d3\\u06d5\\u06e5\\u06e6\\u06ee\\u06ef\\u06fa-\\u06fc\\u06ff\\u0710\\u0712-\\u072f\\u074d-\\u07a5\\u07b1\\u07ca-\\u07ea\\u07f4\\u07f5\\u07fa\\u0800-\\u0815\\u081a\\u0824\\u0828\\u0840-\\u0858\\u08a0-\\u08b4\\u08b6-\\u08bd\\u0904-\\u0939\\u093d\\u0950\\u0958-\\u0961\\u0971-\\u0980\\u0985-\\u098c\\u098f\\u0990\\u0993-\\u09a8\\u09aa-\\u09b0\\u09b2\\u09b6-\\u09b9\\u09bd\\u09ce\\u09dc\\u09dd\\u09df-\\u09e1\\u09f0\\u09f1\\u0a05-\\u0a0a\\u0a0f\\u0a10\\u0a13-\\u0a28\\u0a2a-\\u0a30\\u0a32\\u0a33\\u0a35\\u0a36\\u0a38\\u0a39\\u0a59-\\u0a5c\\u0a5e\\u0a72-\\u0a74\\u0a85-\\u0a8d\\u0a8f-\\u0a91\\u0a93-\\u0aa8\\u0aaa-\\u0ab0\\u0ab2\\u0ab3\\u0ab5-\\u0ab9\\u0abd\\u0ad0\\u0ae0\\u0ae1\\u0af9\\u0b05-\\u0b0c\\u0b0f\\u0b10\\u0b13-\\u0b28\\u0b2a-\\u0b30\\u0b32\\u0b33\\u0b35-\\u0b39\\u0b3d\\u0b5c\\u0b5d\\u0b5f-\\u0b61\\u0b71\\u0b83\\u0b85-\\u0b8a\\u0b8e-\\u0b90\\u0b92-\\u0b95\\u0b99\\u0b9a\\u0b9c\\u0b9e\\u0b9f\\u0ba3\\u0ba4\\u0ba8-\\u0baa\\u0bae-\\u0bb9\\u0bd0\\u0c05-\\u0c0c\\u0c0e-\\u0c10\\u0c12-\\u0c28\\u0c2a-\\u0c39\\u0c3d\\u0c58-\\u0c5a\\u0c60\\u0c61\\u0c80\\u0c85-\\u0c8c\\u0c8e-\\u0c90\\u0c92-\\u0ca8\\u0caa-\\u0cb3\\u0cb5-\\u0cb9\\u0cbd\\u0cde\\u0ce0\\u0ce1\\u0cf1\\u0cf2\\u0d05-\\u0d0c\\u0d0e-\\u0d10\\u0d12-\\u0d3a\\u0d3d\\u0d4e\\u0d54-\\u0d56\\u0d5f-\\u0d61\\u0d7a-\\u0d7f\\u0d85-\\u0d96\\u0d9a-\\u0db1\\u0db3-\\u0dbb\\u0dbd\\u0dc0-\\u0dc6\\u0e01-\\u0e30\\u0e32\\u0e33\\u0e40-\\u0e46\\u0e81\\u0e82\\u0e84\\u0e87\\u0e88\\u0e8a\\u0e8d\\u0e94-\\u0e97\\u0e99-\\u0e9f\\u0ea1-\\u0ea3\\u0ea5\\u0ea7\\u0eaa\\u0eab\\u0ead-\\u0eb0\\u0eb2\\u0eb3\\u0ebd\\u0ec0-\\u0ec4\\u0ec6\\u0edc-\\u0edf\\u0f00\\u0f40-\\u0f47\\u0f49-\\u0f6c\\u0f88-\\u0f8c\\u1000-\\u102a\\u103f\\u1050-\\u1055\\u105a-\\u105d\\u1061\\u1065\\u1066\\u106e-\\u1070\\u1075-\\u1081\\u108e\\u10a0-\\u10c5\\u10c7\\u10cd\\u10d0-\\u10fa\\u10fc-\\u1248\\u124a-\\u124d\\u1250-\\u1256\\u1258\\u125a-\\u125d\\u1260-\\u1288\\u128a-\\u128d\\u1290-\\u12b0\\u12b2-\\u12b5\\u12b8-\\u12be\\u12c0\\u12c2-\\u12c5\\u12c8-\\u12d6\\u12d8-\\u1310\\u1312-\\u1315\\u1318-\\u135a\\u1380-\\u138f\\u13a0-\\u13f5\\u13f8-\\u13fd\\u1401-\\u166c\\u166f-\\u167f\\u1681-\\u169a\\u16a0-\\u16ea\\u16ee-\\u16f8\\u1700-\\u170c\\u170e-\\u1711\\u1720-\\u1731\\u1740-\\u1751\\u1760-\\u176c\\u176e-\\u1770\\u1780-\\u17b3\\u17d7\\u17dc\\u1820-\\u1877\\u1880-\\u18a8\\u18aa\\u18b0-\\u18f5\\u1900-\\u191e\\u1950-\\u196d\\u1970-\\u1974\\u1980-\\u19ab\\u19b0-\\u19c9\\u1a00-\\u1a16\\u1a20-\\u1a54\\u1aa7\\u1b05-\\u1b33\\u1b45-\\u1b4b\\u1b83-\\u1ba0\\u1bae\\u1baf\\u1bba-\\u1be5\\u1c00-\\u1c23\\u1c4d-\\u1c4f\\u1c5a-\\u1c7d\\u1c80-\\u1c88\\u1ce9-\\u1cec\\u1cee-\\u1cf1\\u1cf5\\u1cf6\\u1d00-\\u1dbf\\u1e00-\\u1f15\\u1f18-\\u1f1d\\u1f20-\\u1f45\\u1f48-\\u1f4d\\u1f50-\\u1f57\\u1f59\\u1f5b\\u1f5d\\u1f5f-\\u1f7d\\u1f80-\\u1fb4\\u1fb6-\\u1fbc\\u1fbe\\u1fc2-\\u1fc4\\u1fc6-\\u1fcc\\u1fd0-\\u1fd3\\u1fd6-\\u1fdb\\u1fe0-\\u1fec\\u1ff2-\\u1ff4\\u1ff6-\\u1ffc\\u2071\\u207f\\u2090-\\u209c\\u2102\\u2107\\u210a-\\u2113\\u2115\\u2118-\\u211d\\u2124\\u2126\\u2128\\u212a-\\u2139\\u213c-\\u213f\\u2145-\\u2149\\u214e\\u2160-\\u2188\\u2c00-\\u2c2e\\u2c30-\\u2c5e\\u2c60-\\u2ce4\\u2ceb-\\u2cee\\u2cf2\\u2cf3\\u2d00-\\u2d25\\u2d27\\u2d2d\\u2d30-\\u2d67\\u2d6f\\u2d80-\\u2d96\\u2da0-\\u2da6\\u2da8-\\u2dae\\u2db0-\\u2db6\\u2db8-\\u2dbe\\u2dc0-\\u2dc6\\u2dc8-\\u2dce\\u2dd0-\\u2dd6\\u2dd8-\\u2dde\\u3005-\\u3007\\u3021-\\u3029\\u3031-\\u3035\\u3038-\\u303c\\u3041-\\u3096\\u309b-\\u309f\\u30a1-\\u30fa\\u30fc-\\u30ff\\u3105-\\u312d\\u3131-\\u318e\\u31a0-\\u31ba\\u31f0-\\u31ff\\u3400-\\u4db5\\u4e00-\\u9fd5\\ua000-\\ua48c\\ua4d0-\\ua4fd\\ua500-\\ua60c\\ua610-\\ua61f\\ua62a\\ua62b\\ua640-\\ua66e\\ua67f-\\ua69d\\ua6a0-\\ua6ef\\ua717-\\ua71f\\ua722-\\ua788\\ua78b-\\ua7ae\\ua7b0-\\ua7b7\\ua7f7-\\ua801\\ua803-\\ua805\\ua807-\\ua80a\\ua80c-\\ua822\\ua840-\\ua873\\ua882-\\ua8b3\\ua8f2-\\ua8f7\\ua8fb\\ua8fd\\ua90a-\\ua925\\ua930-\\ua946\\ua960-\\ua97c\\ua984-\\ua9b2\\ua9cf\\ua9e0-\\ua9e4\\ua9e6-\\ua9ef\\ua9fa-\\ua9fe\\uaa00-\\uaa28\\uaa40-\\uaa42\\uaa44-\\uaa4b\\uaa60-\\uaa76\\uaa7a\\uaa7e-\\uaaaf\\uaab1\\uaab5\\uaab6\\uaab9-\\uaabd\\uaac0\\uaac2\\uaadb-\\uaadd\\uaae0-\\uaaea\\uaaf2-\\uaaf4\\uab01-\\uab06\\uab09-\\uab0e\\uab11-\\uab16\\uab20-\\uab26\\uab28-\\uab2e\\uab30-\\uab5a\\uab5c-\\uab65\\uab70-\\uabe2\\uac00-\\ud7a3\\ud7b0-\\ud7c6\\ud7cb-\\ud7fb\\uf900-\\ufa6d\\ufa70-\\ufad9\\ufb00-\\ufb06\\ufb13-\\ufb17\\ufb1d\\ufb1f-\\ufb28\\ufb2a-\\ufb36\\ufb38-\\ufb3c\\ufb3e\\ufb40\\ufb41\\ufb43\\ufb44\\ufb46-\\ufbb1\\ufbd3-\\ufd3d\\ufd50-\\ufd8f\\ufd92-\\ufdc7\\ufdf0-\\ufdfb\\ufe70-\\ufe74\\ufe76-\\ufefc\\uff21-\\uff3a\\uff41-\\uff5a\\uff66-\\uffbe\\uffc2-\\uffc7\\uffca-\\uffcf\\uffd2-\\uffd7\\uffda-\\uffdc\"\r\nvar nonASCIIidentifierChars = \"\\u200c\\u200d\\xb7\\u0300-\\u036f\\u0387\\u0483-\\u0487\\u0591-\\u05bd\\u05bf\\u05c1\\u05c2\\u05c4\\u05c5\\u05c7\\u0610-\\u061a\\u064b-\\u0669\\u0670\\u06d6-\\u06dc\\u06df-\\u06e4\\u06e7\\u06e8\\u06ea-\\u06ed\\u06f0-\\u06f9\\u0711\\u0730-\\u074a\\u07a6-\\u07b0\\u07c0-\\u07c9\\u07eb-\\u07f3\\u0816-\\u0819\\u081b-\\u0823\\u0825-\\u0827\\u0829-\\u082d\\u0859-\\u085b\\u08d4-\\u08e1\\u08e3-\\u0903\\u093a-\\u093c\\u093e-\\u094f\\u0951-\\u0957\\u0962\\u0963\\u0966-\\u096f\\u0981-\\u0983\\u09bc\\u09be-\\u09c4\\u09c7\\u09c8\\u09cb-\\u09cd\\u09d7\\u09e2\\u09e3\\u09e6-\\u09ef\\u0a01-\\u0a03\\u0a3c\\u0a3e-\\u0a42\\u0a47\\u0a48\\u0a4b-\\u0a4d\\u0a51\\u0a66-\\u0a71\\u0a75\\u0a81-\\u0a83\\u0abc\\u0abe-\\u0ac5\\u0ac7-\\u0ac9\\u0acb-\\u0acd\\u0ae2\\u0ae3\\u0ae6-\\u0aef\\u0b01-\\u0b03\\u0b3c\\u0b3e-\\u0b44\\u0b47\\u0b48\\u0b4b-\\u0b4d\\u0b56\\u0b57\\u0b62\\u0b63\\u0b66-\\u0b6f\\u0b82\\u0bbe-\\u0bc2\\u0bc6-\\u0bc8\\u0bca-\\u0bcd\\u0bd7\\u0be6-\\u0bef\\u0c00-\\u0c03\\u0c3e-\\u0c44\\u0c46-\\u0c48\\u0c4a-\\u0c4d\\u0c55\\u0c56\\u0c62\\u0c63\\u0c66-\\u0c6f\\u0c81-\\u0c83\\u0cbc\\u0cbe-\\u0cc4\\u0cc6-\\u0cc8\\u0cca-\\u0ccd\\u0cd5\\u0cd6\\u0ce2\\u0ce3\\u0ce6-\\u0cef\\u0d01-\\u0d03\\u0d3e-\\u0d44\\u0d46-\\u0d48\\u0d4a-\\u0d4d\\u0d57\\u0d62\\u0d63\\u0d66-\\u0d6f\\u0d82\\u0d83\\u0dca\\u0dcf-\\u0dd4\\u0dd6\\u0dd8-\\u0ddf\\u0de6-\\u0def\\u0df2\\u0df3\\u0e31\\u0e34-\\u0e3a\\u0e47-\\u0e4e\\u0e50-\\u0e59\\u0eb1\\u0eb4-\\u0eb9\\u0ebb\\u0ebc\\u0ec8-\\u0ecd\\u0ed0-\\u0ed9\\u0f18\\u0f19\\u0f20-\\u0f29\\u0f35\\u0f37\\u0f39\\u0f3e\\u0f3f\\u0f71-\\u0f84\\u0f86\\u0f87\\u0f8d-\\u0f97\\u0f99-\\u0fbc\\u0fc6\\u102b-\\u103e\\u1040-\\u1049\\u1056-\\u1059\\u105e-\\u1060\\u1062-\\u1064\\u1067-\\u106d\\u1071-\\u1074\\u1082-\\u108d\\u108f-\\u109d\\u135d-\\u135f\\u1369-\\u1371\\u1712-\\u1714\\u1732-\\u1734\\u1752\\u1753\\u1772\\u1773\\u17b4-\\u17d3\\u17dd\\u17e0-\\u17e9\\u180b-\\u180d\\u1810-\\u1819\\u18a9\\u1920-\\u192b\\u1930-\\u193b\\u1946-\\u194f\\u19d0-\\u19da\\u1a17-\\u1a1b\\u1a55-\\u1a5e\\u1a60-\\u1a7c\\u1a7f-\\u1a89\\u1a90-\\u1a99\\u1ab0-\\u1abd\\u1b00-\\u1b04\\u1b34-\\u1b44\\u1b50-\\u1b59\\u1b6b-\\u1b73\\u1b80-\\u1b82\\u1ba1-\\u1bad\\u1bb0-\\u1bb9\\u1be6-\\u1bf3\\u1c24-\\u1c37\\u1c40-\\u1c49\\u1c50-\\u1c59\\u1cd0-\\u1cd2\\u1cd4-\\u1ce8\\u1ced\\u1cf2-\\u1cf4\\u1cf8\\u1cf9\\u1dc0-\\u1df5\\u1dfb-\\u1dff\\u203f\\u2040\\u2054\\u20d0-\\u20dc\\u20e1\\u20e5-\\u20f0\\u2cef-\\u2cf1\\u2d7f\\u2de0-\\u2dff\\u302a-\\u302f\\u3099\\u309a\\ua620-\\ua629\\ua66f\\ua674-\\ua67d\\ua69e\\ua69f\\ua6f0\\ua6f1\\ua802\\ua806\\ua80b\\ua823-\\ua827\\ua880\\ua881\\ua8b4-\\ua8c5\\ua8d0-\\ua8d9\\ua8e0-\\ua8f1\\ua900-\\ua909\\ua926-\\ua92d\\ua947-\\ua953\\ua980-\\ua983\\ua9b3-\\ua9c0\\ua9d0-\\ua9d9\\ua9e5\\ua9f0-\\ua9f9\\uaa29-\\uaa36\\uaa43\\uaa4c\\uaa4d\\uaa50-\\uaa59\\uaa7b-\\uaa7d\\uaab0\\uaab2-\\uaab4\\uaab7\\uaab8\\uaabe\\uaabf\\uaac1\\uaaeb-\\uaaef\\uaaf5\\uaaf6\\uabe3-\\uabea\\uabec\\uabed\\uabf0-\\uabf9\\ufb1e\\ufe00-\\ufe0f\\ufe20-\\ufe2f\\ufe33\\ufe34\\ufe4d-\\ufe4f\\uff10-\\uff19\\uff3f\"\r\n\r\nvar nonASCIIidentifierStart = new RegExp(\"[\" + nonASCIIidentifierStartChars + \"]\")\r\nvar nonASCIIidentifier = new RegExp(\"[\" + nonASCIIidentifierStartChars + nonASCIIidentifierChars + \"]\")\r\n\r\nnonASCIIidentifierStartChars = nonASCIIidentifierChars = null\r\n\r\n// These are a run-length and offset encoded representation of the\r\n// >0xffff code points that are a valid part of identifiers. The\r\n// offset starts at 0x10000, and each pair of numbers represents an\r\n// offset to the next range, and then a size of the range. They were\r\n// generated by bin/generate-identifier-regex.js\r\n\r\n// eslint-disable-next-line comma-spacing\r\nvar astralIdentifierStartCodes = [0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,17,26,6,37,11,29,3,35,5,7,2,4,43,157,19,35,5,35,5,39,9,51,157,310,10,21,11,7,153,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,66,18,2,1,11,21,11,25,71,55,7,1,65,0,16,3,2,2,2,26,45,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,56,50,14,50,785,52,76,44,33,24,27,35,42,34,4,0,13,47,15,3,22,0,2,0,36,17,2,24,85,6,2,0,2,3,2,14,2,9,8,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,19,0,13,4,159,52,19,3,54,47,21,1,2,0,185,46,42,3,37,47,21,0,60,42,86,25,391,63,32,0,449,56,264,8,2,36,18,0,50,29,881,921,103,110,18,195,2749,1070,4050,582,8634,568,8,30,114,29,19,47,17,3,32,20,6,18,881,68,12,0,67,12,65,0,32,6124,20,754,9486,1,3071,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,339,3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,4149,196,60,67,1213,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42710,42,4148,12,221,3,5761,10591,541]\r\n\r\n// eslint-disable-next-line comma-spacing\r\nvar astralIdentifierCodes = [509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,1306,2,54,14,32,9,16,3,46,10,54,9,7,2,37,13,2,9,52,0,13,2,49,13,10,2,4,9,83,11,7,0,161,11,6,9,7,3,57,0,2,6,3,1,3,2,10,0,11,1,3,6,4,4,193,17,10,9,87,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,84,14,5,9,423,9,838,7,2,7,17,9,57,21,2,13,19882,9,135,4,60,6,26,9,1016,45,17,3,19723,1,5319,4,4,5,9,7,3,6,31,3,149,2,1418,49,513,54,5,49,9,0,15,0,23,4,2,14,1361,6,2,16,3,6,2,1,2,4,2214,6,110,6,6,9,792487,239]\r\n\r\n// This has a complexity linear to the value of the code. The\r\n// assumption is that looking up astral identifier characters is\r\n// rare.\r\nfunction isInAstralSet(code, set) {\r\n var pos = 0x10000\r\n for (var i = 0; i < set.length; i += 2) {\r\n pos += set[i]\r\n if (pos > code) return false\r\n pos += set[i + 1]\r\n if (pos >= code) return true\r\n }\r\n}\r\n\r\n// Test whether a given character code starts an identifier.\r\n\r\nfunction isIdentifierStart(code, astral) {\r\n if (code < 65) return code === 36\r\n if (code < 91) return true\r\n if (code < 97) return code === 95\r\n if (code < 123) return true\r\n if (code <= 0xffff) return code >= 0xaa && nonASCIIidentifierStart.test(String.fromCharCode(code))\r\n if (astral === false) return false\r\n return isInAstralSet(code, astralIdentifierStartCodes)\r\n}\r\n\r\n// Test whether a given character is part of an identifier.\r\n\r\nfunction isIdentifierChar(code, astral) {\r\n if (code < 48) return code === 36\r\n if (code < 58) return true\r\n if (code < 65) return false\r\n if (code < 91) return true\r\n if (code < 97) return code === 95\r\n if (code < 123) return true\r\n if (code <= 0xffff) return code >= 0xaa && nonASCIIidentifier.test(String.fromCharCode(code))\r\n if (astral === false) return false\r\n return isInAstralSet(code, astralIdentifierStartCodes) || isInAstralSet(code, astralIdentifierCodes)\r\n}\r\n\r\n// ## Token types\r\n\r\n// The assignment of fine-grained, information-carrying type objects\r\n// allows the tokenizer to store the information it has about a\r\n// token in a way that is very cheap for the parser to look up.\r\n\r\n// All token type variables start with an underscore, to make them\r\n// easy to recognize.\r\n\r\n// The `beforeExpr` property is used to disambiguate between regular\r\n// expressions and divisions. It is set on all token types that can\r\n// be followed by an expression (thus, a slash after them would be a\r\n// regular expression).\r\n//\r\n// The `startsExpr` property is used to check if the token ends a\r\n// `yield` expression. It is set on all token types that either can\r\n// directly start an expression (like a quotation mark) or can\r\n// continue an expression (like the body of a string).\r\n//\r\n// `isLoop` marks a keyword as starting a loop, which is important\r\n// to know when parsing a label, in order to allow or disallow\r\n// continue jumps to that label.\r\n\r\nvar TokenType = function TokenType(label, conf) {\r\n if ( conf === void 0 ) conf = {};\r\n\r\n this.label = label\r\n this.keyword = conf.keyword\r\n this.beforeExpr = !!conf.beforeExpr\r\n this.startsExpr = !!conf.startsExpr\r\n this.isLoop = !!conf.isLoop\r\n this.isAssign = !!conf.isAssign\r\n this.prefix = !!conf.prefix\r\n this.postfix = !!conf.postfix\r\n this.binop = conf.binop || null\r\n this.updateContext = null\r\n};\r\n\r\nfunction binop(name, prec) {\r\n return new TokenType(name, {beforeExpr: true, binop: prec})\r\n}\r\nvar beforeExpr = {beforeExpr: true};\r\nvar startsExpr = {startsExpr: true};\r\n// Map keyword names to token types.\r\n\r\nvar keywordTypes = {}\r\n\r\n// Succinct definitions of keyword token types\r\nfunction kw(name, options) {\r\n if ( options === void 0 ) options = {};\r\n\r\n options.keyword = name\r\n return keywordTypes[name] = new TokenType(name, options)\r\n}\r\n\r\nvar tt = {\r\n num: new TokenType(\"num\", startsExpr),\r\n regexp: new TokenType(\"regexp\", startsExpr),\r\n string: new TokenType(\"string\", startsExpr),\r\n name: new TokenType(\"name\", startsExpr),\r\n eof: new TokenType(\"eof\"),\r\n\r\n // Punctuation token types.\r\n bracketL: new TokenType(\"[\", {beforeExpr: true, startsExpr: true}),\r\n bracketR: new TokenType(\"]\"),\r\n braceL: new TokenType(\"{\", {beforeExpr: true, startsExpr: true}),\r\n braceR: new TokenType(\"}\"),\r\n parenL: new TokenType(\"(\", {beforeExpr: true, startsExpr: true}),\r\n parenR: new TokenType(\")\"),\r\n comma: new TokenType(\",\", beforeExpr),\r\n semi: new TokenType(\";\", beforeExpr),\r\n colon: new TokenType(\":\", beforeExpr),\r\n dot: new TokenType(\".\"),\r\n question: new TokenType(\"?\", beforeExpr),\r\n arrow: new TokenType(\"=>\", beforeExpr),\r\n template: new TokenType(\"template\"),\r\n ellipsis: new TokenType(\"...\", beforeExpr),\r\n backQuote: new TokenType(\"`\", startsExpr),\r\n dollarBraceL: new TokenType(\"${\", {beforeExpr: true, startsExpr: true}),\r\n\r\n // Operators. These carry several kinds of properties to help the\r\n // parser use them properly (the presence of these properties is\r\n // what categorizes them as operators).\r\n //\r\n // `binop`, when present, specifies that this operator is a binary\r\n // operator, and will refer to its precedence.\r\n //\r\n // `prefix` and `postfix` mark the operator as a prefix or postfix\r\n // unary operator.\r\n //\r\n // `isAssign` marks all of `=`, `+=`, `-=` etcetera, which act as\r\n // binary operators with a very low precedence, that should result\r\n // in AssignmentExpression nodes.\r\n\r\n eq: new TokenType(\"=\", {beforeExpr: true, isAssign: true}),\r\n assign: new TokenType(\"_=\", {beforeExpr: true, isAssign: true}),\r\n incDec: new TokenType(\"++/--\", {prefix: true, postfix: true, startsExpr: true}),\r\n prefix: new TokenType(\"prefix\", {beforeExpr: true, prefix: true, startsExpr: true}),\r\n logicalOR: binop(\"||\", 1),\r\n logicalAND: binop(\"&&\", 2),\r\n bitwiseOR: binop(\"|\", 3),\r\n bitwiseXOR: binop(\"^\", 4),\r\n bitwiseAND: binop(\"&\", 5),\r\n equality: binop(\"==/!=\", 6),\r\n relational: binop(\"</>\", 7),\r\n bitShift: binop(\"<</>>\", 8),\r\n plusMin: new TokenType(\"+/-\", {beforeExpr: true, binop: 9, prefix: true, startsExpr: true}),\r\n modulo: binop(\"%\", 10),\r\n star: binop(\"*\", 10),\r\n slash: binop(\"/\", 10),\r\n starstar: new TokenType(\"**\", {beforeExpr: true}),\r\n\r\n // Keyword token types.\r\n _break: kw(\"break\"),\r\n _case: kw(\"case\", beforeExpr),\r\n _catch: kw(\"catch\"),\r\n _continue: kw(\"continue\"),\r\n _debugger: kw(\"debugger\"),\r\n _default: kw(\"default\", beforeExpr),\r\n _do: kw(\"do\", {isLoop: true, beforeExpr: true}),\r\n _else: kw(\"else\", beforeExpr),\r\n _finally: kw(\"finally\"),\r\n _for: kw(\"for\", {isLoop: true}),\r\n _function: kw(\"function\", startsExpr),\r\n _if: kw(\"if\"),\r\n _return: kw(\"return\", beforeExpr),\r\n _switch: kw(\"switch\"),\r\n _throw: kw(\"throw\", beforeExpr),\r\n _try: kw(\"try\"),\r\n _var: kw(\"var\"),\r\n _const: kw(\"const\"),\r\n _while: kw(\"while\", {isLoop: true}),\r\n _with: kw(\"with\"),\r\n _new: kw(\"new\", {beforeExpr: true, startsExpr: true}),\r\n _this: kw(\"this\", startsExpr),\r\n _super: kw(\"super\", startsExpr),\r\n _class: kw(\"class\"),\r\n _extends: kw(\"extends\", beforeExpr),\r\n _export: kw(\"export\"),\r\n _import: kw(\"import\"),\r\n _null: kw(\"null\", startsExpr),\r\n _true: kw(\"true\", startsExpr),\r\n _false: kw(\"false\", startsExpr),\r\n _in: kw(\"in\", {beforeExpr: true, binop: 7}),\r\n _instanceof: kw(\"instanceof\", {beforeExpr: true, binop: 7}),\r\n _typeof: kw(\"typeof\", {beforeExpr: true, prefix: true, startsExpr: true}),\r\n _void: kw(\"void\", {beforeExpr: true, prefix: true, startsExpr: true}),\r\n _delete: kw(\"delete\", {beforeExpr: true, prefix: true, startsExpr: true})\r\n}\r\n\r\n// Matches a whole line break (where CRLF is considered a single\r\n// line break). Used to count lines.\r\n\r\nvar lineBreak = /\\r\\n?|\\n|\\u2028|\\u2029/\r\nvar lineBreakG = new RegExp(lineBreak.source, \"g\")\r\n\r\nfunction isNewLine(code) {\r\n return code === 10 || code === 13 || code === 0x2028 || code === 0x2029\r\n}\r\n\r\nvar nonASCIIwhitespace = /[\\u1680\\u180e\\u2000-\\u200a\\u202f\\u205f\\u3000\\ufeff]/\r\n\r\nvar skipWhiteSpace = /(?:\\s|\\/\\/.*|\\/\\*[^]*?\\*\\/)*/g\r\n\r\nvar ref = Object.prototype;\r\nvar hasOwnProperty = ref.hasOwnProperty;\r\nvar toString = ref.toString;\r\n\r\n// Checks if an object has a property.\r\n\r\nfunction has(obj, propName) {\r\n return hasOwnProperty.call(obj, propName)\r\n}\r\n\r\nvar isArray = Array.isArray || (function (obj) { return (\r\n toString.call(obj) === \"[object Array]\"\r\n); })\r\n\r\n// These are used when `options.locations` is on, for the\r\n// `startLoc` and `endLoc` properties.\r\n\r\nvar Position = function Position(line, col) {\r\n this.line = line\r\n this.column = col\r\n};\r\n\r\nPosition.prototype.offset = function offset (n) {\r\n return new Position(this.line, this.column + n)\r\n};\r\n\r\nvar SourceLocation = function SourceLocation(p, start, end) {\r\n this.start = start\r\n this.end = end\r\n if (p.sourceFile !== null) this.source = p.sourceFile\r\n};\r\n\r\n// The `getLineInfo` function is mostly useful when the\r\n// `locations` option is off (for performance reasons) and you\r\n// want to find the line/column position for a given character\r\n// offset. `input` should be the code string that the offset refers\r\n// into.\r\n\r\nfunction getLineInfo(input, offset) {\r\n for (var line = 1, cur = 0;;) {\r\n lineBreakG.lastIndex = cur\r\n var match = lineBreakG.exec(input)\r\n if (match && match.index < offset) {\r\n ++line\r\n cur = match.index + match[0].length\r\n } else {\r\n return new Position(line, offset - cur)\r\n }\r\n }\r\n}\r\n\r\n// A second optional argument can be given to further configure\r\n// the parser process. These options are recognized:\r\n\r\nvar defaultOptions = {\r\n // `ecmaVersion` indicates the ECMAScript version to parse. Must\r\n // be either 3, 5, 6 (2015), 7 (2016), or 8 (2017). This influences support\r\n // for strict mode, the set of reserved words, and support for\r\n // new syntax features. The default is 7.\r\n ecmaVersion: 7,\r\n // `sourceType` indicates the mode the code should be parsed in.\r\n // Can be either `\"script\"` or `\"module\"`. This influences global\r\n // strict mode and parsing of `import` and `export` declarations.\r\n sourceType: \"script\",\r\n // `onInsertedSemicolon` can be a callback that will be called\r\n // when a semicolon is automatically inserted. It will be passed\r\n // th position of the comma as an offset, and if `locations` is\r\n // enabled, it is given the location as a `{line, column}` object\r\n // as second argument.\r\n onInsertedSemicolon: null,\r\n // `onTrailingComma` is similar to `onInsertedSemicolon`, but for\r\n // trailing commas.\r\n onTrailingComma: null,\r\n // By default, reserved words are only enforced if ecmaVersion >= 5.\r\n // Set `allowReserved` to a boolean value to explicitly turn this on\r\n // an off. When this option has the value \"never\", reserved words\r\n // and keywords can also not be used as property names.\r\n allowReserved: null,\r\n // When enabled, a return at the top level is not considered an\r\n // error.\r\n allowReturnOutsideFunction: false,\r\n // When enabled, import/export statements are not constrained to\r\n // appearing at the top of the program.\r\n allowImportExportEverywhere: false,\r\n // When enabled, hashbang directive in the beginning of file\r\n // is allowed and treated as a line comment.\r\n allowHashBang: false,\r\n // When `locations` is on, `loc` properties holding objects with\r\n // `start` and `end` properties in `{line, column}` form (with\r\n // line being 1-based and column 0-based) will be attached to the\r\n // nodes.\r\n locations: false,\r\n // A function can be passed as `onToken` option, which will\r\n // cause Acorn to call that function with object in the same\r\n // format as tokens returned from `tokenizer().getToken()`. Note\r\n // that you are not allowed to call the parser from the\r\n // callback—that will corrupt its internal state.\r\n onToken: null,\r\n // A function can be passed as `onComment` option, which will\r\n // cause Acorn to call that function with `(block, text, start,\r\n // end)` parameters whenever a comment is skipped. `block` is a\r\n // boolean indicating whether this is a block (`/* */`) comment,\r\n // `text` is the content of the comment, and `start` and `end` are\r\n // character offsets that denote the start and end of the comment.\r\n // When the `locations` option is on, two more parameters are\r\n // passed, the full `{line, column}` locations of the start and\r\n // end of the comments. Note that you are not allowed to call the\r\n // parser from the callback—that will corrupt its internal state.\r\n onComment: null,\r\n // Nodes have their start and end characters offsets recorded in\r\n // `start` and `end` properties (directly on the node, rather than\r\n // the `loc` object, which holds line/column data. To also add a\r\n // [semi-standardized][range] `range` property holding a `[start,\r\n // end]` array with the same numbers, set the `ranges` option to\r\n // `true`.\r\n //\r\n // [range]: https://bugzilla.mozilla.org/show_bug.cgi?id=745678\r\n ranges: false,\r\n // It is possible to parse multiple files into a single AST by\r\n // passing the tree produced by parsing the first file as\r\n // `program` option in subsequent parses. This will add the\r\n // toplevel forms of the parsed file to the `Program` (top) node\r\n // of an existing parse tree.\r\n program: null,\r\n // When `locations` is on, you can pass this to record the source\r\n // file in every node's `loc` object.\r\n sourceFile: null,\r\n // This value, if given, is stored in every node, whether\r\n // `locations` is on or off.\r\n directSourceFile: null,\r\n // When enabled, parenthesized expressions are represented by\r\n // (non-standard) ParenthesizedExpression nodes\r\n preserveParens: false,\r\n plugins: {}\r\n}\r\n\r\n// Interpret and default an options object\r\n\r\nfunction getOptions(opts) {\r\n var options = {}\r\n\r\n for (var opt in defaultOptions)\r\n options[opt] = opts && has(opts, opt) ? opts[opt] : defaultOptions[opt]\r\n\r\n if (options.ecmaVersion >= 2015)\r\n options.ecmaVersion -= 2009\r\n\r\n if (options.allowReserved == null)\r\n options.allowReserved = options.ecmaVersion < 5\r\n\r\n if (isArray(options.onToken)) {\r\n var tokens = options.onToken\r\n options.onToken = function (token) { return tokens.push(token); }\r\n }\r\n if (isArray(options.onComment))\r\n options.onComment = pushComment(options, options.onComment)\r\n\r\n return options\r\n}\r\n\r\nfunction pushComment(options, array) {\r\n return function(block, text, start, end, startLoc, endLoc) {\r\n var comment = {\r\n type: block ? \"Block\" : \"Line\",\r\n value: text,\r\n start: start,\r\n end: end\r\n }\r\n if (options.locations)\r\n comment.loc = new SourceLocation(this, startLoc, endLoc)\r\n if (options.ranges)\r\n comment.range = [start, end]\r\n array.push(comment)\r\n }\r\n}\r\n\r\n// Registered plugins\r\nvar plugins = {}\r\n\r\nfunction keywordRegexp(words) {\r\n return new RegExp(\"^(\" + words.replace(/ /g, \"|\") + \")$\")\r\n}\r\n\r\nvar Parser = function Parser(options, input, startPos) {\r\n this.options = options = getOptions(options)\r\n this.sourceFile = options.sourceFile\r\n this.keywords = keywordRegexp(keywords[options.ecmaVersion >= 6 ? 6 : 5])\r\n var reserved = \"\"\r\n if (!options.allowReserved) {\r\n for (var v = options.ecmaVersion;; v--)\r\n if (reserved = reservedWords[v]) break\r\n if (options.sourceType == \"module\") reserved += \" await\"\r\n }\r\n this.reservedWords = keywordRegexp(reserved)\r\n var reservedStrict = (reserved ? reserved + \" \" : \"\") + reservedWords.strict\r\n this.reservedWordsStrict = keywordRegexp(reservedStrict)\r\n this.reservedWordsStrictBind = keywordRegexp(reservedStrict + \" \" + reservedWords.strictBind)\r\n this.input = String(input)\r\n\r\n // Used to signal to callers of `readWord1` whether the word\r\n // contained any escape sequences. This is needed because words with\r\n // escape sequences must not be interpreted as keywords.\r\n this.containsEsc = false\r\n\r\n // Load plugins\r\n this.loadPlugins(options.plugins)\r\n\r\n // Set up token state\r\n\r\n // The current position of the tokenizer in the input.\r\n if (startPos) {\r\n this.pos = startPos\r\n this.lineStart = this.input.lastIndexOf(\"\\n\", startPos - 1) + 1\r\n this.curLine = this.input.slice(0, this.lineStart).split(lineBreak).length\r\n } else {\r\n this.pos = this.lineStart = 0\r\n this.curLine = 1\r\n }\r\n\r\n // Properties of the current token:\r\n // Its type\r\n this.type = tt.eof\r\n // For tokens that include more information than their type, the value\r\n this.value = null\r\n // Its start and end offset\r\n this.start = this.end = this.pos\r\n // And, if locations are used, the {line, column} object\r\n // corresponding to those offsets\r\n this.startLoc = this.endLoc = this.curPosition()\r\n\r\n // Position information for the previous token\r\n this.lastTokEndLoc = this.lastTokStartLoc = null\r\n this.lastTokStart = this.lastTokEnd = this.pos\r\n\r\n // The context stack is used to superficially track syntactic\r\n // context to predict whether a regular expression is allowed in a\r\n // given position.\r\n this.context = this.initialContext()\r\n this.exprAllowed = true\r\n\r\n // Figure out if it's a module code.\r\n this.inModule = options.sourceType === \"module\"\r\n this.strict = this.inModule || this.strictDirective(this.pos)\r\n\r\n // Used to signify the start of a potential arrow function\r\n this.potentialArrowAt = -1\r\n\r\n // Flags to track whether we are in a function, a generator, an async function.\r\n this.inFunction = this.inGenerator = this.inAsync = false\r\n // Positions to delayed-check that yield/await does not exist in default parameters.\r\n this.yieldPos = this.awaitPos = 0\r\n // Labels in scope.\r\n this.labels = []\r\n\r\n // If enabled, skip leading hashbang line.\r\n if (this.pos === 0 && options.allowHashBang && this.input.slice(0, 2) === \"#!\")\r\n this.skipLineComment(2)\r\n\r\n // Scope tracking for duplicate variable names (see scope.js)\r\n this.scopeStack = []\r\n this.enterFunctionScope()\r\n};\r\n\r\n// DEPRECATED Kept for backwards compatibility until 3.0 in case a plugin uses them\r\nParser.prototype.isKeyword = function isKeyword (word) { return this.keywords.test(word) };\r\nParser.prototype.isReservedWord = function isReservedWord (word) { return this.reservedWords.test(word) };\r\n\r\nParser.prototype.extend = function extend (name, f) {\r\n this[name] = f(this[name])\r\n};\r\n\r\nParser.prototype.loadPlugins = function loadPlugins (pluginConfigs) {\r\n var this$1 = this;\r\n\r\n for (var name in pluginConfigs) {\r\n var plugin = plugins[name]\r\n if (!plugin) throw new Error(\"Plugin '\" + name + \"' not found\")\r\n plugin(this$1, pluginConfigs[name])\r\n }\r\n};\r\n\r\nParser.prototype.parse = function parse () {\r\n var node = this.options.program || this.startNode()\r\n this.nextToken()\r\n return this.parseTopLevel(node)\r\n};\r\n\r\nvar pp = Parser.prototype\r\n\r\n// ## Parser utilities\r\n\r\nvar literal = /^(?:'((?:[^']|\\.)*)'|\"((?:[^\"]|\\.)*)\"|;)/\r\npp.strictDirective = function(start) {\r\n var this$1 = this;\r\n\r\n for (;;) {\r\n skipWhiteSpace.lastIndex = start\r\n start += skipWhiteSpace.exec(this$1.input)[0].length\r\n var match = literal.exec(this$1.input.slice(start))\r\n if (!match) return false\r\n if ((match[1] || match[2]) == \"use strict\") return true\r\n start += match[0].length\r\n }\r\n}\r\n\r\n// Predicate that tests whether the next token is of the given\r\n// type, and if yes, consumes it as a side effect.\r\n\r\npp.eat = function(type) {\r\n if (this.type === type) {\r\n this.next()\r\n return true\r\n } else {\r\n return false\r\n }\r\n}\r\n\r\n// Tests whether parsed token is a contextual keyword.\r\n\r\npp.isContextual = function(name) {\r\n return this.type === tt.name && this.value === name\r\n}\r\n\r\n// Consumes contextual keyword if possible.\r\n\r\npp.eatContextual = function(name) {\r\n return this.value === name && this.eat(tt.name)\r\n}\r\n\r\n// Asserts that following token is given contextual keyword.\r\n\r\npp.expectContextual = function(name) {\r\n if (!this.eatContextual(name)) this.unexpected()\r\n}\r\n\r\n// Test whether a semicolon can be inserted at the current position.\r\n\r\npp.canInsertSemicolon = function() {\r\n return this.type === tt.eof ||\r\n this.type === tt.braceR ||\r\n lineBreak.test(this.input.slice(this.lastTokEnd, this.start))\r\n}\r\n\r\npp.insertSemicolon = function() {\r\n if (this.canInsertSemicolon()) {\r\n if (this.options.onInsertedSemicolon)\r\n this.options.onInsertedSemicolon(this.lastTokEnd, this.lastTokEndLoc)\r\n return true\r\n }\r\n}\r\n\r\n// Consume a semicolon, or, failing that, see if we are allowed to\r\n// pretend that there is a semicolon at this position.\r\n\r\npp.semicolon = function() {\r\n if (!this.eat(tt.semi) && !this.insertSemicolon()) this.unexpected()\r\n}\r\n\r\npp.afterTrailingComma = function(tokType, notNext) {\r\n if (this.type == tokType) {\r\n if (this.options.onTrailingComma)\r\n this.options.onTrailingComma(this.lastTokStart, this.lastTokStartLoc)\r\n if (!notNext)\r\n this.next()\r\n return true\r\n }\r\n}\r\n\r\n// Expect a token of a given type. If found, consume it, otherwise,\r\n// raise an unexpected token error.\r\n\r\npp.expect = function(type) {\r\n this.eat(type) || this.unexpected()\r\n}\r\n\r\n// Raise an unexpected token error.\r\n\r\npp.unexpected = function(pos) {\r\n this.raise(pos != null ? pos : this.start, \"Unexpected token\")\r\n}\r\n\r\nvar DestructuringErrors = function DestructuringErrors() {\r\n this.shorthandAssign = this.trailingComma = this.parenthesizedAssign = this.parenthesizedBind = -1\r\n};\r\n\r\npp.checkPatternErrors = function(refDestructuringErrors, isAssign) {\r\n if (!refDestructuringErrors) return\r\n if (refDestructuringErrors.trailingComma > -1)\r\n this.raiseRecoverable(refDestructuringErrors.trailingComma, \"Comma is not permitted after the rest element\")\r\n var parens = isAssign ? refDestructuringErrors.parenthesizedAssign : refDestructuringErrors.parenthesizedBind\r\n if (parens > -1) this.raiseRecoverable(parens, \"Parenthesized pattern\")\r\n}\r\n\r\npp.checkExpressionErrors = function(refDestructuringErrors, andThrow) {\r\n var pos = refDestructuringErrors ? refDestructuringErrors.shorthandAssign : -1\r\n if (!andThrow) return pos >= 0\r\n if (pos > -1) this.raise(pos, \"Shorthand property assignments are valid only in destructuring patterns\")\r\n}\r\n\r\npp.checkYieldAwaitInDefaultParams = function() {\r\n if (this.yieldPos && (!this.awaitPos || this.yieldPos < this.awaitPos))\r\n this.raise(this.yieldPos, \"Yield expression cannot be a default value\")\r\n if (this.awaitPos)\r\n this.raise(this.awaitPos, \"Await expression cannot be a default value\")\r\n}\r\n\r\npp.isSimpleAssignTarget = function(expr) {\r\n if (expr.type === \"ParenthesizedExpression\")\r\n return this.isSimpleAssignTarget(expr.expression)\r\n return expr.type === \"Identifier\" || expr.type === \"MemberExpression\"\r\n}\r\n\r\nvar pp$1 = Parser.prototype\r\n\r\n// ### Statement parsing\r\n\r\n// Parse a program. Initializes the parser, reads any number of\r\n// statements, and wraps them in a Program node. Optionally takes a\r\n// `program` argument. If present, the statements will be appended\r\n// to its body instead of creating a new node.\r\n\r\npp$1.parseTopLevel = function(node) {\r\n var this$1 = this;\r\n\r\n var exports = {}\r\n if (!node.body) node.body = []\r\n while (this.type !== tt.eof) {\r\n var stmt = this$1.parseStatement(true, true, exports)\r\n node.body.push(stmt)\r\n }\r\n this.next()\r\n if (this.options.ecmaVersion >= 6) {\r\n node.sourceType = this.options.sourceType\r\n }\r\n return this.finishNode(node, \"Program\")\r\n}\r\n\r\nvar loopLabel = {kind: \"loop\"};\r\nvar switchLabel = {kind: \"switch\"};\r\npp$1.isLet = function() {\r\n if (this.type !== tt.name || this.options.ecmaVersion < 6 || this.value != \"let\") return false\r\n skipWhiteSpace.lastIndex = this.pos\r\n var skip = skipWhiteSpace.exec(this.input)\r\n var next = this.pos + skip[0].length, nextCh = this.input.charCodeAt(next)\r\n if (nextCh === 91 || nextCh == 123) return true // '{' and '['\r\n if (isIdentifierStart(nextCh, true)) {\r\n var pos = next + 1\r\n while (isIdentifierChar(this.input.charCodeAt(pos), true)) ++pos\r\n var ident = this.input.slice(next, pos)\r\n if (!this.isKeyword(ident)) return true\r\n }\r\n return false\r\n}\r\n\r\n// check 'async [no LineTerminator here] function'\r\n// - 'async /*foo*/ function' is OK.\r\n// - 'async /*\\n*/ function' is invalid.\r\npp$1.isAsyncFunction = function() {\r\n if (this.type !== tt.name || this.options.ecmaVersion < 8 || this.value != \"async\")\r\n return false\r\n\r\n skipWhiteSpace.lastIndex = this.pos\r\n var skip = skipWhiteSpace.exec(this.input)\r\n var next = this.pos + skip[0].length\r\n return !lineBreak.test(this.input.slice(this.pos, next)) &&\r\n this.input.slice(next, next + 8) === \"function\" &&\r\n (next + 8 == this.input.length || !isIdentifierChar(this.input.charAt(next + 8)))\r\n}\r\n\r\n// Parse a single statement.\r\n//\r\n// If expecting a statement and finding a slash operator, parse a\r\n// regular expression literal. This is to handle cases like\r\n// `if (foo) /blah/.exec(foo)`, where looking at the previous token\r\n// does not help.\r\n\r\npp$1.parseStatement = function(declaration, topLevel, exports) {\r\n var starttype = this.type, node = this.startNode(), kind\r\n\r\n if (this.isLet()) {\r\n starttype = tt._var\r\n kind = \"let\"\r\n }\r\n\r\n // Most types of statements are recognized by the keyword they\r\n // start with. Many are trivial to parse, some require a bit of\r\n // complexity.\r\n\r\n switch (starttype) {\r\n case tt._break: case tt._continue: return this.parseBreakContinueStatement(node, starttype.keyword)\r\n case tt._debugger: return this.parseDebuggerStatement(node)\r\n case tt._do: return this.parseDoStatement(node)\r\n case tt._for: return this.parseForStatement(node)\r\n case tt._function:\r\n if (!declaration && this.options.ecmaVersion >= 6) this.unexpected()\r\n return this.parseFunctionStatement(node, false)\r\n case tt._class:\r\n if (!declaration) this.unexpected()\r\n return this.parseClass(node, true)\r\n case tt._if: return this.parseIfStatement(node)\r\n case tt._return: return this.parseReturnStatement(node)\r\n case tt._switch: return this.parseSwitchStatement(node)\r\n case tt._throw: return this.parseThrowStatement(node)\r\n case tt._try: return this.parseTryStatement(node)\r\n case tt._const: case tt._var:\r\n kind = kind || this.value\r\n if (!declaration && kind != \"var\") this.unexpected()\r\n return this.parseVarStatement(node, kind)\r\n case tt._while: return this.parseWhileStatement(node)\r\n case tt._with: return this.parseWithStatement(node)\r\n case tt.braceL: return this.parseBlock()\r\n case tt.semi: return this.parseEmptyStatement(node)\r\n case tt._export:\r\n case tt._import:\r\n if (!this.options.allowImportExportEverywhere) {\r\n if (!topLevel)\r\n this.raise(this.start, \"'import' and 'export' may only appear at the top level\")\r\n if (!this.inModule)\r\n this.raise(this.start, \"'import' and 'export' may appear only with 'sourceType: module'\")\r\n }\r\n return starttype === tt._import ? this.parseImport(node) : this.parseExport(node, exports)\r\n\r\n // If the statement does not start with a statement keyword or a\r\n // brace, it's an ExpressionStatement or LabeledStatement. We\r\n // simply start parsing an expression, and afterwards, if the\r\n // next token is a colon and the expression was a simple\r\n // Identifier node, we switch to interpreting it as a label.\r\n default:\r\n if (this.isAsyncFunction() && declaration) {\r\n this.next()\r\n return this.parseFunctionStatement(node, true)\r\n }\r\n\r\n var maybeName = this.value, expr = this.parseExpression()\r\n if (starttype === tt.name && expr.type === \"Identifier\" && this.eat(tt.colon))\r\n return this.parseLabeledStatement(node, maybeName, expr)\r\n else return this.parseExpressionStatement(node, expr)\r\n }\r\n}\r\n\r\npp$1.parseBreakContinueStatement = function(node, keyword) {\r\n var this$1 = this;\r\n\r\n var isBreak = keyword == \"break\"\r\n this.next()\r\n if (this.eat(tt.semi) || this.insertSemicolon()) node.label = null\r\n else if (this.type !== tt.name) this.unexpected()\r\n else {\r\n node.label = this.parseIdent()\r\n this.semicolon()\r\n }\r\n\r\n // Verify that there is an actual destination to break or\r\n // continue to.\r\n var i = 0\r\n for (; i < this.labels.length; ++i) {\r\n var lab = this$1.labels[i]\r\n if (node.label == null || lab.name === node.label.name) {\r\n if (lab.kind != null && (isBreak || lab.kind === \"loop\")) break\r\n if (node.label && isBreak) break\r\n }\r\n }\r\n if (i === this.labels.length) this.raise(node.start, \"Unsyntactic \" + keyword)\r\n return this.finishNode(node, isBreak ? \"BreakStatement\" : \"ContinueStatement\")\r\n}\r\n\r\npp$1.parseDebuggerStatement = function(node) {\r\n this.next()\r\n this.semicolon()\r\n return this.finishNode(node, \"DebuggerStatement\")\r\n}\r\n\r\npp$1.parseDoStatement = function(node) {\r\n this.next()\r\n this.labels.push(loopLabel)\r\n node.body = this.parseStatement(false)\r\n this.labels.pop()\r\n this.expect(tt._while)\r\n node.test = this.parseParenExpression()\r\n if (this.options.ecmaVersion >= 6)\r\n this.eat(tt.semi)\r\n else\r\n this.semicolon()\r\n return this.finishNode(node, \"DoWhileStatement\")\r\n}\r\n\r\n// Disambiguating between a `for` and a `for`/`in` or `for`/`of`\r\n// loop is non-trivial. Basically, we have to parse the init `var`\r\n// statement or expression, disallowing the `in` operator (see\r\n// the second parameter to `parseExpression`), and then check\r\n// whether the next token is `in` or `of`. When there is no init\r\n// part (semicolon immediately after the opening parenthesis), it\r\n// is a regular `for` loop.\r\n\r\npp$1.parseForStatement = function(node) {\r\n this.next()\r\n this.labels.push(loopLabel)\r\n this.enterLexicalScope()\r\n this.expect(tt.parenL)\r\n if (this.type === tt.semi) return this.parseFor(node, null)\r\n var isLet = this.isLet()\r\n if (this.type === tt._var || this.type === tt._const || isLet) {\r\n var init$1 = this.startNode(), kind = isLet ? \"let\" : this.value\r\n this.next()\r\n this.parseVar(init$1, true, kind)\r\n this.finishNode(init$1, \"VariableDeclaration\")\r\n if ((this.type === tt._in || (this.options.ecmaVersion >= 6 && this.isContextual(\"of\"))) && init$1.declarations.length === 1 &&\r\n !(kind !== \"var\" && init$1.declarations[0].init))\r\n return this.parseForIn(node, init$1)\r\n return this.parseFor(node, init$1)\r\n }\r\n var refDestructuringErrors = new DestructuringErrors\r\n var init = this.parseExpression(true, refDestructuringErrors)\r\n if (this.type === tt._in || (this.options.ecmaVersion >= 6 && this.isContextual(\"of\"))) {\r\n this.toAssignable(init)\r\n this.checkLVal(init)\r\n this.checkPatternErrors(refDestructuringErrors, true)\r\n return this.parseForIn(node, init)\r\n } else {\r\n this.checkExpressionErrors(refDestructuringErrors, true)\r\n }\r\n return this.parseFor(node, init)\r\n}\r\n\r\npp$1.parseFunctionStatement = function(node, isAsync) {\r\n this.next()\r\n return this.parseFunction(node, true, false, isAsync)\r\n}\r\n\r\npp$1.isFunction = function() {\r\n return this.type === tt._function || this.isAsyncFunction()\r\n}\r\n\r\npp$1.parseIfStatement = function(node) {\r\n this.next()\r\n node.test = this.parseParenExpression()\r\n // allow function declarations in branches, but only in non-strict mode\r\n node.consequent = this.parseStatement(!this.strict && this.isFunction())\r\n node.alternate = this.eat(tt._else) ? this.parseStatement(!this.strict && this.isFunction()) : null\r\n return this.finishNode(node, \"IfStatement\")\r\n}\r\n\r\npp$1.parseReturnStatement = function(node) {\r\n if (!this.inFunction && !this.options.allowReturnOutsideFunction)\r\n this.raise(this.start, \"'return' outside of function\")\r\n this.next()\r\n\r\n // In `return` (and `break`/`continue`), the keywords with\r\n // optional arguments, we eagerly look for a semicolon or the\r\n // possibility to insert one.\r\n\r\n if (this.eat(tt.semi) || this.insertSemicolon()) node.argument = null\r\n else { node.argument = this.parseExpression(); this.semicolon() }\r\n return this.finishNode(node, \"ReturnStatement\")\r\n}\r\n\r\npp$1.parseSwitchStatement = function(node) {\r\n var this$1 = this;\r\n\r\n this.next()\r\n node.discriminant = this.parseParenExpression()\r\n node.cases = []\r\n this.expect(tt.braceL)\r\n this.labels.push(switchLabel)\r\n this.enterLexicalScope()\r\n\r\n // Statements under must be grouped (by label) in SwitchCase\r\n // nodes. `cur` is used to keep the node that we are currently\r\n // adding statements to.\r\n\r\n var cur\r\n for (var sawDefault = false; this.type != tt.braceR;) {\r\n if (this$1.type === tt._case || this$1.type === tt._default) {\r\n var isCase = this$1.type === tt._case\r\n if (cur) this$1.finishNode(cur, \"SwitchCase\")\r\n node.cases.push(cur = this$1.startNode())\r\n cur.consequent = []\r\n this$1.next()\r\n if (isCase) {\r\n cur.test = this$1.parseExpression()\r\n } else {\r\n if (sawDefault) this$1.raiseRecoverable(this$1.lastTokStart, \"Multiple default clauses\")\r\n sawDefault = true\r\n cur.test = null\r\n }\r\n this$1.expect(tt.colon)\r\n } else {\r\n if (!cur) this$1.unexpected()\r\n cur.consequent.push(this$1.parseStatement(true))\r\n }\r\n }\r\n this.exitLexicalScope()\r\n if (cur) this.finishNode(cur, \"SwitchCase\")\r\n this.next() // Closing brace\r\n this.labels.pop()\r\n return this.finishNode(node, \"SwitchStatement\")\r\n}\r\n\r\npp$1.parseThrowStatement = function(node) {\r\n this.next()\r\n if (lineBreak.test(this.input.slice(this.lastTokEnd, this.start)))\r\n this.raise(this.lastTokEnd, \"Illegal newline after throw\")\r\n node.argument = this.parseExpression()\r\n this.semicolon()\r\n return this.finishNode(node, \"ThrowStatement\")\r\n}\r\n\r\n// Reused empty array added for node fields that are always empty.\r\n\r\nvar empty = []\r\n\r\npp$1.parseTryStatement = function(node) {\r\n this.next()\r\n node.block = this.parseBlock()\r\n node.handler = null\r\n if (this.type === tt._catch) {\r\n var clause = this.startNode()\r\n this.next()\r\n this.expect(tt.parenL)\r\n clause.param = this.parseBindingAtom()\r\n this.enterLexicalScope()\r\n this.checkLVal(clause.param, \"let\")\r\n this.expect(tt.parenR)\r\n clause.body = this.parseBlock(false)\r\n this.exitLexicalScope()\r\n node.handler = this.finishNode(clause, \"CatchClause\")\r\n }\r\n node.finalizer = this.eat(tt._finally) ? this.parseBlock() : null\r\n if (!node.handler && !node.finalizer)\r\n this.raise(node.start, \"Missing catch or finally clause\")\r\n return this.finishNode(node, \"TryStatement\")\r\n}\r\n\r\npp$1.parseVarStatement = function(node, kind) {\r\n this.next()\r\n this.parseVar(node, false, kind)\r\n this.semicolon()\r\n return this.finishNode(node, \"VariableDeclaration\")\r\n}\r\n\r\npp$1.parseWhileStatement = function(node) {\r\n this.next()\r\n node.test = this.parseParenExpression()\r\n this.labels.push(loopLabel)\r\n node.body = this.parseStatement(false)\r\n this.labels.pop()\r\n return this.finishNode(node, \"WhileStatement\")\r\n}\r\n\r\npp$1.parseWithStatement = function(node) {\r\n if (this.strict) this.raise(this.start, \"'with' in strict mode\")\r\n this.next()\r\n node.object = this.parseParenExpression()\r\n node.body = this.parseStatement(false)\r\n return this.finishNode(node, \"WithStatement\")\r\n}\r\n\r\npp$1.parseEmptyStatement = function(node) {\r\n this.next()\r\n return this.finishNode(node, \"EmptyStatement\")\r\n}\r\n\r\npp$1.parseLabeledStatement = function(node, maybeName, expr) {\r\n var this$1 = this;\r\n\r\n for (var i = 0; i < this.labels.length; ++i)\r\n if (this$1.labels[i].name === maybeName) this$1.raise(expr.start, \"Label '\" + maybeName + \"' is already declared\")\r\n var kind = this.type.isLoop ? \"loop\" : this.type === tt._switch ? \"switch\" : null\r\n for (var i$1 = this.labels.length - 1; i$1 >= 0; i$1--) {\r\n var label = this$1.labels[i$1]\r\n if (label.statementStart == node.start) {\r\n label.statementStart = this$1.start\r\n label.kind = kind\r\n } else break\r\n }\r\n this.labels.push({name: maybeName, kind: kind, statementStart: this.start})\r\n node.body = this.parseStatement(true)\r\n if (node.body.type == \"ClassDeclaration\" ||\r\n node.body.type == \"VariableDeclaration\" && node.body.kind != \"var\" ||\r\n node.body.type == \"FunctionDeclaration\" && (this.strict || node.body.generator))\r\n this.raiseRecoverable(node.body.start, \"Invalid labeled declaration\")\r\n this.labels.pop()\r\n node.label = expr\r\n return this.finishNode(node, \"LabeledStatement\")\r\n}\r\n\r\npp$1.parseExpressionStatement = function(node, expr) {\r\n node.expression = expr\r\n this.semicolon()\r\n return this.finishNode(node, \"ExpressionStatement\")\r\n}\r\n\r\n// Parse a semicolon-enclosed block of statements, handling `\"use\r\n// strict\"` declarations when `allowStrict` is true (used for\r\n// function bodies).\r\n\r\npp$1.parseBlock = function(createNewLexicalScope) {\r\n var this$1 = this;\r\n if ( createNewLexicalScope === void 0 ) createNewLexicalScope = true;\r\n\r\n var node = this.startNode()\r\n node.body = []\r\n this.expect(tt.braceL)\r\n if (createNewLexicalScope) {\r\n this.enterLexicalScope()\r\n }\r\n while (!this.eat(tt.braceR)) {\r\n var stmt = this$1.parseStatement(true)\r\n node.body.push(stmt)\r\n }\r\n if (createNewLexicalScope) {\r\n this.exitLexicalScope()\r\n }\r\n return this.finishNode(node, \"BlockStatement\")\r\n}\r\n\r\n// Parse a regular `for` loop. The disambiguation code in\r\n// `parseStatement` will already have parsed the init statement or\r\n// expression.\r\n\r\npp$1.parseFor = function(node, init) {\r\n node.init = init\r\n this.expect(tt.semi)\r\n node.test = this.type === tt.semi ? null : this.parseExpression()\r\n this.expect(tt.semi)\r\n node.update = this.type === tt.parenR ? null : this.parseExpression()\r\n this.expect(tt.parenR)\r\n this.exitLexicalScope()\r\n node.body = this.parseStatement(false)\r\n this.labels.pop()\r\n return this.finishNode(node, \"ForStatement\")\r\n}\r\n\r\n// Parse a `for`/`in` and `for`/`of` loop, which are almost\r\n// same from parser's perspective.\r\n\r\npp$1.parseForIn = function(node, init) {\r\n var type = this.type === tt._in ? \"ForInStatement\" : \"ForOfStatement\"\r\n this.next()\r\n node.left = init\r\n node.right = this.parseExpression()\r\n this.expect(tt.parenR)\r\n this.exitLexicalScope()\r\n node.body = this.parseStatement(false)\r\n this.labels.pop()\r\n return this.finishNode(node, type)\r\n}\r\n\r\n// Parse a list of variable declarations.\r\n\r\npp$1.parseVar = function(node, isFor, kind) {\r\n var this$1 = this;\r\n\r\n node.declarations = []\r\n node.kind = kind\r\n for (;;) {\r\n var decl = this$1.startNode()\r\n this$1.parseVarId(decl, kind)\r\n if (this$1.eat(tt.eq)) {\r\n decl.init = this$1.parseMaybeAssign(isFor)\r\n } else if (kind === \"const\" && !(this$1.type === tt._in || (this$1.options.ecmaVersion >= 6 && this$1.isContextual(\"of\")))) {\r\n this$1.unexpected()\r\n } else if (decl.id.type != \"Identifier\" && !(isFor && (this$1.type === tt._in || this$1.isContextual(\"of\")))) {\r\n this$1.raise(this$1.lastTokEnd, \"Complex binding patterns require an initialization value\")\r\n } else {\r\n decl.init = null\r\n }\r\n node.declarations.push(this$1.finishNode(decl, \"VariableDeclarator\"))\r\n if (!this$1.eat(tt.comma)) break\r\n }\r\n return node\r\n}\r\n\r\npp$1.parseVarId = function(decl, kind) {\r\n decl.id = this.parseBindingAtom(kind)\r\n this.checkLVal(decl.id, kind, false)\r\n}\r\n\r\n// Parse a function declaration or literal (depending on the\r\n// `isStatement` parameter).\r\n\r\npp$1.parseFunction = function(node, isStatement, allowExpressionBody, isAsync) {\r\n this.initFunction(node)\r\n if (this.options.ecmaVersion >= 6 && !isAsync)\r\n node.generator = this.eat(tt.star)\r\n if (this.options.ecmaVersion >= 8)\r\n node.async = !!isAsync\r\n\r\n if (isStatement) {\r\n node.id = isStatement === \"nullableID\" && this.type != tt.name ? null : this.parseIdent()\r\n if (node.id) {\r\n this.checkLVal(node.id, \"var\")\r\n }\r\n }\r\n\r\n var oldInGen = this.inGenerator, oldInAsync = this.inAsync,\r\n oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldInFunc = this.inFunction\r\n this.inGenerator = node.generator\r\n this.inAsync = node.async\r\n this.yieldPos = 0\r\n this.awaitPos = 0\r\n this.inFunction = true\r\n this.enterFunctionScope()\r\n\r\n if (!isStatement)\r\n node.id = this.type == tt.name ? this.parseIdent() : null\r\n\r\n this.parseFunctionParams(node)\r\n this.parseFunctionBody(node, allowExpressionBody)\r\n\r\n this.inGenerator = oldInGen\r\n this.inAsync = oldInAsync\r\n this.yieldPos = oldYieldPos\r\n this.awaitPos = oldAwaitPos\r\n this.inFunction = oldInFunc\r\n return this.finishNode(node, isStatement ? \"FunctionDeclaration\" : \"FunctionExpression\")\r\n}\r\n\r\npp$1.parseFunctionParams = function(node) {\r\n this.expect(tt.parenL)\r\n node.params = this.parseBindingList(tt.parenR, false, this.options.ecmaVersion >= 8, true)\r\n this.checkYieldAwaitInDefaultParams()\r\n}\r\n\r\n// Parse a class declaration or literal (depending on the\r\n// `isStatement` parameter).\r\n\r\npp$1.parseClass = function(node, isStatement) {\r\n var this$1 = this;\r\n\r\n this.next()\r\n\r\n this.parseClassId(node, isStatement)\r\n this.parseClassSuper(node)\r\n var classBody = this.startNode()\r\n var hadConstructor = false\r\n classBody.body = []\r\n this.expect(tt.braceL)\r\n while (!this.eat(tt.braceR)) {\r\n if (this$1.eat(tt.semi)) continue\r\n var method = this$1.startNode()\r\n var isGenerator = this$1.eat(tt.star)\r\n var isAsync = false\r\n var isMaybeStatic = this$1.type === tt.name && this$1.value === \"static\"\r\n this$1.parsePropertyName(method)\r\n method.static = isMaybeStatic && this$1.type !== tt.parenL\r\n if (method.static) {\r\n if (isGenerator) this$1.unexpected()\r\n isGenerator = this$1.eat(tt.star)\r\n this$1.parsePropertyName(method)\r\n }\r\n if (this$1.options.ecmaVersion >= 8 && !isGenerator && !method.computed &&\r\n method.key.type === \"Identifier\" && method.key.name === \"async\" && this$1.type !== tt.parenL &&\r\n !this$1.canInsertSemicolon()) {\r\n isAsync = true\r\n this$1.parsePropertyName(method)\r\n }\r\n method.kind = \"method\"\r\n var isGetSet = false\r\n if (!method.computed) {\r\n var key = method.key;\r\n if (!isGenerator && !isAsync && key.type === \"Identifier\" && this$1.type !== tt.parenL && (key.name === \"get\" || key.name === \"set\")) {\r\n isGetSet = true\r\n method.kind = key.name\r\n key = this$1.parsePropertyName(method)\r\n }\r\n if (!method.static && (key.type === \"Identifier\" && key.name === \"constructor\" ||\r\n key.type === \"Literal\" && key.value === \"constructor\")) {\r\n if (hadConstructor) this$1.raise(key.start, \"Duplicate constructor in the same class\")\r\n if (isGetSet) this$1.raise(key.start, \"Constructor can't have get/set modifier\")\r\n if (isGenerator) this$1.raise(key.start, \"Constructor can't be a generator\")\r\n if (isAsync) this$1.raise(key.start, \"Constructor can't be an async method\")\r\n method.kind = \"constructor\"\r\n hadConstructor = true\r\n }\r\n }\r\n this$1.parseClassMethod(classBody, method, isGenerator, isAsync)\r\n if (isGetSet) {\r\n var paramCount = method.kind === \"get\" ? 0 : 1\r\n if (method.value.params.length !== paramCount) {\r\n var start = method.value.start\r\n if (method.kind === \"get\")\r\n this$1.raiseRecoverable(start, \"getter should have no params\")\r\n else\r\n this$1.raiseRecoverable(start, \"setter should have exactly one param\")\r\n } else {\r\n if (method.kind === \"set\" && method.value.params[0].type === \"RestElement\")\r\n this$1.raiseRecoverable(method.value.params[0].start, \"Setter cannot use rest params\")\r\n }\r\n }\r\n }\r\n node.body = this.finishNode(classBody, \"ClassBody\")\r\n return this.finishNode(node, isStatement ? \"ClassDeclaration\" : \"ClassExpression\")\r\n}\r\n\r\npp$1.parseClassMethod = function(classBody, method, isGenerator, isAsync) {\r\n method.value = this.parseMethod(isGenerator, isAsync)\r\n classBody.body.push(this.finishNode(method, \"MethodDefinition\"))\r\n}\r\n\r\npp$1.parseClassId = function(node, isStatement) {\r\n node.id = this.type === tt.name ? this.parseIdent() : isStatement === true ? this.unexpected() : null\r\n}\r\n\r\npp$1.parseClassSuper = function(node) {\r\n node.superClass = this.eat(tt._extends) ? this.parseExprSubscripts() : null\r\n}\r\n\r\n// Parses module export declaration.\r\n\r\npp$1.parseExport = function(node, exports) {\r\n var this$1 = this;\r\n\r\n this.next()\r\n // export * from '...'\r\n if (this.eat(tt.star)) {\r\n this.expectContextual(\"from\")\r\n node.source = this.type === tt.string ? this.parseExprAtom() : this.unexpected()\r\n this.semicolon()\r\n return this.finishNode(node, \"ExportAllDeclaration\")\r\n }\r\n if (this.eat(tt._default)) { // export default ...\r\n this.checkExport(exports, \"default\", this.lastTokStart)\r\n var isAsync\r\n if (this.type === tt._function || (isAsync = this.isAsyncFunction())) {\r\n var fNode = this.startNode()\r\n this.next()\r\n if (isAsync) this.next()\r\n node.declaration = this.parseFunction(fNode, \"nullableID\", false, isAsync)\r\n } else if (this.type === tt._class) {\r\n var cNode = this.startNode()\r\n node.declaration = this.parseClass(cNode, \"nullableID\")\r\n } else {\r\n node.declaration = this.parseMaybeAssign()\r\n this.semicolon()\r\n }\r\n return this.finishNode(node, \"ExportDefaultDeclaration\")\r\n }\r\n // export var|const|let|function|class ...\r\n if (this.shouldParseExportStatement()) {\r\n node.declaration = this.parseStatement(true)\r\n if (node.declaration.type === \"VariableDeclaration\")\r\n this.checkVariableExport(exports, node.declaration.declarations)\r\n else\r\n this.checkExport(exports, node.declaration.id.name, node.declaration.id.start)\r\n node.specifiers = []\r\n node.source = null\r\n } else { // export { x, y as z } [from '...']\r\n node.declaration = null\r\n node.specifiers = this.parseExportSpecifiers(exports)\r\n if (this.eatContextual(\"from\")) {\r\n node.source = this.type === tt.string ? this.parseExprAtom() : this.unexpected()\r\n } else {\r\n // check for keywords used as local names\r\n for (var i = 0; i < node.specifiers.length; i++) {\r\n if (this$1.keywords.test(node.specifiers[i].local.name) || this$1.reservedWords.test(node.specifiers[i].local.name)) {\r\n this$1.unexpected(node.specifiers[i].local.start)\r\n }\r\n }\r\n\r\n node.source = null\r\n }\r\n this.semicolon()\r\n }\r\n return this.finishNode(node, \"ExportNamedDeclaration\")\r\n}\r\n\r\npp$1.checkExport = function(exports, name, pos) {\r\n if (!exports) return\r\n if (has(exports, name))\r\n this.raiseRecoverable(pos, \"Duplicate export '\" + name + \"'\")\r\n exports[name] = true\r\n}\r\n\r\npp$1.checkPatternExport = function(exports, pat) {\r\n var this$1 = this;\r\n\r\n var type = pat.type\r\n if (type == \"Identifier\")\r\n this.checkExport(exports, pat.name, pat.start)\r\n else if (type == \"ObjectPattern\")\r\n for (var i = 0; i < pat.properties.length; ++i)\r\n this$1.checkPatternExport(exports, pat.properties[i].value)\r\n else if (type == \"ArrayPattern\")\r\n for (var i$1 = 0; i$1 < pat.elements.length; ++i$1) {\r\n var elt = pat.elements[i$1]\r\n if (elt) this$1.checkPatternExport(exports, elt)\r\n }\r\n else if (type == \"AssignmentPattern\")\r\n this.checkPatternExport(exports, pat.left)\r\n else if (type == \"ParenthesizedExpression\")\r\n this.checkPatternExport(exports, pat.expression)\r\n}\r\n\r\npp$1.checkVariableExport = function(exports, decls) {\r\n var this$1 = this;\r\n\r\n if (!exports) return\r\n for (var i = 0; i < decls.length; i++)\r\n this$1.checkPatternExport(exports, decls[i].id)\r\n}\r\n\r\npp$1.shouldParseExportStatement = function() {\r\n return this.type.keyword === \"var\" ||\r\n this.type.keyword === \"const\" ||\r\n this.type.keyword === \"class\" ||\r\n this.type.keyword === \"function\" ||\r\n this.isLet() ||\r\n this.isAsyncFunction()\r\n}\r\n\r\n// Parses a comma-separated list of module exports.\r\n\r\npp$1.parseExportSpecifiers = function(exports) {\r\n var this$1 = this;\r\n\r\n var nodes = [], first = true\r\n // export { x, y as z } [from '...']\r\n this.expect(tt.braceL)\r\n while (!this.eat(tt.braceR)) {\r\n if (!first) {\r\n this$1.expect(tt.comma)\r\n if (this$1.afterTrailingComma(tt.braceR)) break\r\n } else first = false\r\n\r\n var node = this$1.startNode()\r\n node.local = this$1.parseIdent(true)\r\n node.exported = this$1.eatContextual(\"as\") ? this$1.parseIdent(true) : node.local\r\n this$1.checkExport(exports, node.exported.name, node.exported.start)\r\n nodes.push(this$1.finishNode(node, \"ExportSpecifier\"))\r\n }\r\n return nodes\r\n}\r\n\r\n// Parses import declaration.\r\n\r\npp$1.parseImport = function(node) {\r\n this.next()\r\n // import '...'\r\n if (this.type === tt.string) {\r\n node.specifiers = empty\r\n node.source = this.parseExprAtom()\r\n } else {\r\n node.specifiers = this.parseImportSpecifiers()\r\n this.expectContextual(\"from\")\r\n node.source = this.type === tt.string ? this.parseExprAtom() : this.unexpected()\r\n }\r\n this.semicolon()\r\n return this.finishNode(node, \"ImportDeclaration\")\r\n}\r\n\r\n// Parses a comma-separated list of module imports.\r\n\r\npp$1.parseImportSpecifiers = function() {\r\n var this$1 = this;\r\n\r\n var nodes = [], first = true\r\n if (this.type === tt.name) {\r\n // import defaultObj, { x, y as z } from '...'\r\n var node = this.startNode()\r\n node.local = this.parseIdent()\r\n this.checkLVal(node.local, \"let\")\r\n nodes.push(this.finishNode(node, \"ImportDefaultSpecifier\"))\r\n if (!this.eat(tt.comma)) return nodes\r\n }\r\n if (this.type === tt.star) {\r\n var node$1 = this.startNode()\r\n this.next()\r\n this.expectContextual(\"as\")\r\n node$1.local = this.parseIdent()\r\n this.checkLVal(node$1.local, \"let\")\r\n nodes.push(this.finishNode(node$1, \"ImportNamespaceSpecifier\"))\r\n return nodes\r\n }\r\n this.expect(tt.braceL)\r\n while (!this.eat(tt.braceR)) {\r\n if (!first) {\r\n this$1.expect(tt.comma)\r\n if (this$1.afterTrailingComma(tt.braceR)) break\r\n } else first = false\r\n\r\n var node$2 = this$1.startNode()\r\n node$2.imported = this$1.parseIdent(true)\r\n if (this$1.eatContextual(\"as\")) {\r\n node$2.local = this$1.parseIdent()\r\n } else {\r\n node$2.local = node$2.imported\r\n if (this$1.isKeyword(node$2.local.name)) this$1.unexpected(node$2.local.start)\r\n if (this$1.reservedWordsStrict.test(node$2.local.name)) this$1.raiseRecoverable(node$2.local.start, \"The keyword '\" + node$2.local.name + \"' is reserved\")\r\n }\r\n this$1.checkLVal(node$2.local, \"let\")\r\n nodes.push(this$1.finishNode(node$2, \"ImportSpecifier\"))\r\n }\r\n return nodes\r\n}\r\n\r\nvar pp$2 = Parser.prototype\r\n\r\n// Convert existing expression atom to assignable pattern\r\n// if possible.\r\n\r\npp$2.toAssignable = function(node, isBinding) {\r\n var this$1 = this;\r\n\r\n if (this.options.ecmaVersion >= 6 && node) {\r\n switch (node.type) {\r\n case \"Identifier\":\r\n if (this.inAsync && node.name === \"await\")\r\n this.raise(node.start, \"Can not use 'await' as identifier inside an async function\")\r\n break\r\n\r\n case \"ObjectPattern\":\r\n case \"ArrayPattern\":\r\n break\r\n\r\n case \"ObjectExpression\":\r\n node.type = \"ObjectPattern\"\r\n for (var i = 0; i < node.properties.length; i++) {\r\n var prop = node.properties[i]\r\n if (prop.kind !== \"init\") this$1.raise(prop.key.start, \"Object pattern can't contain getter or setter\")\r\n this$1.toAssignable(prop.value, isBinding)\r\n }\r\n break\r\n\r\n case \"ArrayExpression\":\r\n node.type = \"ArrayPattern\"\r\n this.toAssignableList(node.elements, isBinding)\r\n break\r\n\r\n case \"AssignmentExpression\":\r\n if (node.operator === \"=\") {\r\n node.type = \"AssignmentPattern\"\r\n delete node.operator\r\n this.toAssignable(node.left, isBinding)\r\n // falls through to AssignmentPattern\r\n } else {\r\n this.raise(node.left.end, \"Only '=' operator can be used for specifying default value.\")\r\n break\r\n }\r\n\r\n case \"AssignmentPattern\":\r\n break\r\n\r\n case \"ParenthesizedExpression\":\r\n node.expression = this.toAssignable(node.expression, isBinding)\r\n break\r\n\r\n case \"MemberExpression\":\r\n if (!isBinding) break\r\n\r\n default:\r\n this.raise(node.start, \"Assigning to rvalue\")\r\n }\r\n }\r\n return node\r\n}\r\n\r\n// Convert list of expression atoms to binding list.\r\n\r\npp$2.toAssignableList = function(exprList, isBinding) {\r\n var this$1 = this;\r\n\r\n var end = exprList.length\r\n if (end) {\r\n var last = exprList[end - 1]\r\n if (last && last.type == \"RestElement\") {\r\n --end\r\n } else if (last && last.type == \"SpreadElement\") {\r\n last.type = \"RestElement\"\r\n var arg = last.argument\r\n this.toAssignable(arg, isBinding)\r\n if (arg.type !== \"Identifier\" && arg.type !== \"MemberExpression\" && arg.type !== \"ArrayPattern\")\r\n this.unexpected(arg.start)\r\n --end\r\n }\r\n\r\n if (isBinding && last && last.type === \"RestElement\" && last.argument.type !== \"Identifier\")\r\n this.unexpected(last.argument.start)\r\n }\r\n for (var i = 0; i < end; i++) {\r\n var elt = exprList[i]\r\n if (elt) this$1.toAssignable(elt, isBinding)\r\n }\r\n return exprList\r\n}\r\n\r\n// Parses spread element.\r\n\r\npp$2.parseSpread = function(refDestructuringErrors) {\r\n var node = this.startNode()\r\n this.next()\r\n node.argument = this.parseMaybeAssign(false, refDestructuringErrors)\r\n return this.finishNode(node, \"SpreadElement\")\r\n}\r\n\r\npp$2.parseRest = function(allowNonIdent) {\r\n var node = this.startNode()\r\n this.next()\r\n\r\n // RestElement inside of a function parameter must be an identifier\r\n if (allowNonIdent) node.argument = this.type === tt.name ? this.parseIdent() : this.unexpected()\r\n else node.argument = this.type === tt.name || this.type === tt.bracketL ? this.parseBindingAtom() : this.unexpected()\r\n\r\n return this.finishNode(node, \"RestElement\")\r\n}\r\n\r\n// Parses lvalue (assignable) atom.\r\n\r\npp$2.parseBindingAtom = function() {\r\n if (this.options.ecmaVersion < 6) return this.parseIdent()\r\n switch (this.type) {\r\n case tt.name:\r\n return this.parseIdent()\r\n\r\n case tt.bracketL:\r\n var node = this.startNode()\r\n this.next()\r\n node.elements = this.parseBindingList(tt.bracketR, true, true)\r\n return this.finishNode(node, \"ArrayPattern\")\r\n\r\n case tt.braceL:\r\n return this.parseObj(true)\r\n\r\n default:\r\n this.unexpected()\r\n }\r\n}\r\n\r\npp$2.parseBindingList = function(close, allowEmpty, allowTrailingComma, allowNonIdent) {\r\n var this$1 = this;\r\n\r\n var elts = [], first = true\r\n while (!this.eat(close)) {\r\n if (first) first = false\r\n else this$1.expect(tt.comma)\r\n if (allowEmpty && this$1.type === tt.comma) {\r\n elts.push(null)\r\n } else if (allowTrailingComma && this$1.afterTrailingComma(close)) {\r\n break\r\n } else if (this$1.type === tt.ellipsis) {\r\n var rest = this$1.parseRest(allowNonIdent)\r\n this$1.parseBindingListItem(rest)\r\n elts.push(rest)\r\n if (this$1.type === tt.comma) this$1.raise(this$1.start, \"Comma is not permitted after the rest element\")\r\n this$1.expect(close)\r\n break\r\n } else {\r\n var elem = this$1.parseMaybeDefault(this$1.start, this$1.startLoc)\r\n this$1.parseBindingListItem(elem)\r\n elts.push(elem)\r\n }\r\n }\r\n return elts\r\n}\r\n\r\npp$2.parseBindingListItem = function(param) {\r\n return param\r\n}\r\n\r\n// Parses assignment pattern around given atom if possible.\r\n\r\npp$2.parseMaybeDefault = function(startPos, startLoc, left) {\r\n left = left || this.parseBindingAtom()\r\n if (this.options.ecmaVersion < 6 || !this.eat(tt.eq)) return left\r\n var node = this.startNodeAt(startPos, startLoc)\r\n node.left = left\r\n node.right = this.parseMaybeAssign()\r\n return this.finishNode(node, \"AssignmentPattern\")\r\n}\r\n\r\n// Verify that a node is an lval — something that can be assigned\r\n// to.\r\n// bindingType can be either:\r\n// 'var' indicating that the lval creates a 'var' binding\r\n// 'let' indicating that the lval creates a lexical ('let' or 'const') binding\r\n// 'none' indicating that the binding should be checked for illegal identifiers, but not for duplicate references\r\n\r\npp$2.checkLVal = function(expr, bindingType, checkClashes) {\r\n var this$1 = this;\r\n\r\n switch (expr.type) {\r\n case \"Identifier\":\r\n if (this.strict && this.reservedWordsStrictBind.test(expr.name))\r\n this.raiseRecoverable(expr.start, (bindingType ? \"Binding \" : \"Assigning to \") + expr.name + \" in strict mode\")\r\n if (checkClashes) {\r\n if (has(checkClashes, expr.name))\r\n this.raiseRecoverable(expr.start, \"Argument name clash\")\r\n checkClashes[expr.name] = true\r\n }\r\n if (bindingType && bindingType !== \"none\") {\r\n if (\r\n bindingType === \"var\" && !this.canDeclareVarName(expr.name) ||\r\n bindingType !== \"var\" && !this.canDeclareLexicalName(expr.name)\r\n ) {\r\n this.raiseRecoverable(expr.start, (\"Identifier '\" + (expr.name) + \"' has already been declared\"))\r\n }\r\n if (bindingType === \"var\") {\r\n this.declareVarName(expr.name)\r\n } else {\r\n this.declareLexicalName(expr.name)\r\n }\r\n }\r\n break\r\n\r\n case \"MemberExpression\":\r\n if (bindingType) this.raiseRecoverable(expr.start, (bindingType ? \"Binding\" : \"Assigning to\") + \" member expression\")\r\n break\r\n\r\n case \"ObjectPattern\":\r\n for (var i = 0; i < expr.properties.length; i++)\r\n this$1.checkLVal(expr.properties[i].value, bindingType, checkClashes)\r\n break\r\n\r\n case \"ArrayPattern\":\r\n for (var i$1 = 0; i$1 < expr.elements.length; i$1++) {\r\n var elem = expr.elements[i$1]\r\n if (elem) this$1.checkLVal(elem, bindingType, checkClashes)\r\n }\r\n break\r\n\r\n case \"AssignmentPattern\":\r\n this.checkLVal(expr.left, bindingType, checkClashes)\r\n break\r\n\r\n case \"RestElement\":\r\n this.checkLVal(expr.argument, bindingType, checkClashes)\r\n break\r\n\r\n case \"ParenthesizedExpression\":\r\n this.checkLVal(expr.expression, bindingType, checkClashes)\r\n break\r\n\r\n default:\r\n this.raise(expr.start, (bindingType ? \"Binding\" : \"Assigning to\") + \" rvalue\")\r\n }\r\n}\r\n\r\n// A recursive descent parser operates by defining functions for all\r\n// syntactic elements, and recursively calling those, each function\r\n// advancing the input stream and returning an AST node. Precedence\r\n// of constructs (for example, the fact that `!x[1]` means `!(x[1])`\r\n// instead of `(!x)[1]` is handled by the fact that the parser\r\n// function that parses unary prefix operators is called first, and\r\n// in turn calls the function that parses `[]` subscripts — that\r\n// way, it'll receive the node for `x[1]` already parsed, and wraps\r\n// *that* in the unary operator node.\r\n//\r\n// Acorn uses an [operator precedence parser][opp] to handle binary\r\n// operator precedence, because it is much more compact than using\r\n// the technique outlined above, which uses different, nesting\r\n// functions to specify precedence, for all of the ten binary\r\n// precedence levels that JavaScript defines.\r\n//\r\n// [opp]: http://en.wikipedia.org/wiki/Operator-precedence_parser\r\n\r\nvar pp$3 = Parser.prototype\r\n\r\n// Check if property name clashes with already added.\r\n// Object/class getters and setters are not allowed to clash —\r\n// either with each other or with an init property — and in\r\n// strict mode, init properties are also not allowed to be repeated.\r\n\r\npp$3.checkPropClash = function(prop, propHash) {\r\n if (this.options.ecmaVersion >= 6 && (prop.computed || prop.method || prop.shorthand))\r\n return\r\n var key = prop.key;\r\n var name\r\n switch (key.type) {\r\n case \"Identifier\": name = key.name; break\r\n case \"Literal\": name = String(key.value); break\r\n default: return\r\n }\r\n var kind = prop.kind;\r\n if (this.options.ecmaVersion >= 6) {\r\n if (name === \"__proto__\" && kind === \"init\") {\r\n if (propHash.proto) this.raiseRecoverable(key.start, \"Redefinition of __proto__ property\")\r\n propHash.proto = true\r\n }\r\n return\r\n }\r\n name = \"$\" + name\r\n var other = propHash[name]\r\n if (other) {\r\n var redefinition\r\n if (kind === \"init\") {\r\n redefinition = this.strict && other.init || other.get || other.set\r\n } else {\r\n redefinition = other.init || other[kind]\r\n }\r\n if (redefinition)\r\n this.raiseRecoverable(key.start, \"Redefinition of property\")\r\n } else {\r\n other = propHash[name] = {\r\n init: false,\r\n get: false,\r\n set: false\r\n }\r\n }\r\n other[kind] = true\r\n}\r\n\r\n// ### Expression parsing\r\n\r\n// These nest, from the most general expression type at the top to\r\n// 'atomic', nondivisible expression types at the bottom. Most of\r\n// the functions will simply let the function(s) below them parse,\r\n// and, *if* the syntactic construct they handle is present, wrap\r\n// the AST node that the inner parser gave them in another node.\r\n\r\n// Parse a full expression. The optional arguments are used to\r\n// forbid the `in` operator (in for loops initalization expressions)\r\n// and provide reference for storing '=' operator inside shorthand\r\n// property assignment in contexts where both object expression\r\n// and object pattern might appear (so it's possible to raise\r\n// delayed syntax error at correct position).\r\n\r\npp$3.parseExpression = function(noIn, refDestructuringErrors) {\r\n var this$1 = this;\r\n\r\n var startPos = this.start, startLoc = this.startLoc\r\n var expr = this.parseMaybeAssign(noIn, refDestructuringErrors)\r\n if (this.type === tt.comma) {\r\n var node = this.startNodeAt(startPos, startLoc)\r\n node.expressions = [expr]\r\n while (this.eat(tt.comma)) node.expressions.push(this$1.parseMaybeAssign(noIn, refDestructuringErrors))\r\n return this.finishNode(node, \"SequenceExpression\")\r\n }\r\n return expr\r\n}\r\n\r\n// Parse an assignment expression. This includes applications of\r\n// operators like `+=`.\r\n\r\npp$3.parseMaybeAssign = function(noIn, refDestructuringErrors, afterLeftParse) {\r\n if (this.inGenerator && this.isContextual(\"yield\")) return this.parseYield()\r\n\r\n var ownDestructuringErrors = false, oldParenAssign = -1, oldTrailingComma = -1\r\n if (refDestructuringErrors) {\r\n oldParenAssign = refDestructuringErrors.parenthesizedAssign\r\n oldTrailingComma = refDestructuringErrors.trailingComma\r\n refDestructuringErrors.parenthesizedAssign = refDestructuringErrors.trailingComma = -1\r\n } else {\r\n refDestructuringErrors = new DestructuringErrors\r\n ownDestructuringErrors = true\r\n }\r\n\r\n var startPos = this.start, startLoc = this.startLoc\r\n if (this.type == tt.parenL || this.type == tt.name)\r\n this.potentialArrowAt = this.start\r\n var left = this.parseMaybeConditional(noIn, refDestructuringErrors)\r\n if (afterLeftParse) left = afterLeftParse.call(this, left, startPos, startLoc)\r\n if (this.type.isAssign) {\r\n this.checkPatternErrors(refDestructuringErrors, true)\r\n if (!ownDestructuringErrors) DestructuringErrors.call(refDestructuringErrors)\r\n var node = this.startNodeAt(startPos, startLoc)\r\n node.operator = this.value\r\n node.left = this.type === tt.eq ? this.toAssignable(left) : left\r\n refDestructuringErrors.shorthandAssign = -1 // reset because shorthand default was used correctly\r\n this.checkLVal(left)\r\n this.next()\r\n node.right = this.parseMaybeAssign(noIn)\r\n return this.finishNode(node, \"AssignmentExpression\")\r\n } else {\r\n if (ownDestructuringErrors) this.checkExpressionErrors(refDestructuringErrors, true)\r\n }\r\n if (oldParenAssign > -1) refDestructuringErrors.parenthesizedAssign = oldParenAssign\r\n if (oldTrailingComma > -1) refDestructuringErrors.trailingComma = oldTrailingComma\r\n return left\r\n}\r\n\r\n// Parse a ternary conditional (`?:`) operator.\r\n\r\npp$3.parseMaybeConditional = function(noIn, refDestructuringErrors) {\r\n var startPos = this.start, startLoc = this.startLoc\r\n var expr = this.parseExprOps(noIn, refDestructuringErrors)\r\n if (this.checkExpressionErrors(refDestructuringErrors)) return expr\r\n if (this.eat(tt.question)) {\r\n var node = this.startNodeAt(startPos, startLoc)\r\n node.test = expr\r\n node.consequent = this.parseMaybeAssign()\r\n this.expect(tt.colon)\r\n node.alternate = this.parseMaybeAssign(noIn)\r\n return this.finishNode(node, \"ConditionalExpression\")\r\n }\r\n return expr\r\n}\r\n\r\n// Start the precedence parser.\r\n\r\npp$3.parseExprOps = function(noIn, refDestructuringErrors) {\r\n var startPos = this.start, startLoc = this.startLoc\r\n var expr = this.parseMaybeUnary(refDestructuringErrors, false)\r\n if (this.checkExpressionErrors(refDestructuringErrors)) return expr\r\n return expr.start == startPos && expr.type === \"ArrowFunctionExpression\" ? expr : this.parseExprOp(expr, startPos, startLoc, -1, noIn)\r\n}\r\n\r\n// Parse binary operators with the operator precedence parsing\r\n// algorithm. `left` is the left-hand side of the operator.\r\n// `minPrec` provides context that allows the function to stop and\r\n// defer further parser to one of its callers when it encounters an\r\n// operator that has a lower precedence than the set it is parsing.\r\n\r\npp$3.parseExprOp = function(left, leftStartPos, leftStartLoc, minPrec, noIn) {\r\n var prec = this.type.binop\r\n if (prec != null && (!noIn || this.type !== tt._in)) {\r\n if (prec > minPrec) {\r\n var logical = this.type === tt.logicalOR || this.type === tt.logicalAND\r\n var op = this.value\r\n this.next()\r\n var startPos = this.start, startLoc = this.startLoc\r\n var right = this.parseExprOp(this.parseMaybeUnary(null, false), startPos, startLoc, prec, noIn)\r\n var node = this.buildBinary(leftStartPos, leftStartLoc, left, right, op, logical)\r\n return this.parseExprOp(node, leftStartPos, leftStartLoc, minPrec, noIn)\r\n }\r\n }\r\n return left\r\n}\r\n\r\npp$3.buildBinary = function(startPos, startLoc, left, right, op, logical) {\r\n var node = this.startNodeAt(startPos, startLoc)\r\n node.left = left\r\n node.operator = op\r\n node.right = right\r\n return this.finishNode(node, logical ? \"LogicalExpression\" : \"BinaryExpression\")\r\n}\r\n\r\n// Parse unary operators, both prefix and postfix.\r\n\r\npp$3.parseMaybeUnary = function(refDestructuringErrors, sawUnary) {\r\n var this$1 = this;\r\n\r\n var startPos = this.start, startLoc = this.startLoc, expr\r\n if (this.inAsync && this.isContextual(\"await\")) {\r\n expr = this.parseAwait(refDestructuringErrors)\r\n sawUnary = true\r\n } else if (this.type.prefix) {\r\n var node = this.startNode(), update = this.type === tt.incDec\r\n node.operator = this.value\r\n node.prefix = true\r\n this.next()\r\n node.argument = this.parseMaybeUnary(null, true)\r\n this.checkExpressionErrors(refDestructuringErrors, true)\r\n if (update) this.checkLVal(node.argument)\r\n else if (this.strict && node.operator === \"delete\" &&\r\n node.argument.type === \"Identifier\")\r\n this.raiseRecoverable(node.start, \"Deleting local variable in strict mode\")\r\n else sawUnary = true\r\n expr = this.finishNode(node, update ? \"UpdateExpression\" : \"UnaryExpression\")\r\n } else {\r\n expr = this.parseExprSubscripts(refDestructuringErrors)\r\n if (this.checkExpressionErrors(refDestructuringErrors)) return expr\r\n while (this.type.postfix && !this.canInsertSemicolon()) {\r\n var node$1 = this$1.startNodeAt(startPos, startLoc)\r\n node$1.operator = this$1.value\r\n node$1.prefix = false\r\n node$1.argument = expr\r\n this$1.checkLVal(expr)\r\n this$1.next()\r\n expr = this$1.finishNode(node$1, \"UpdateExpression\")\r\n }\r\n }\r\n\r\n if (!sawUnary && this.eat(tt.starstar))\r\n return this.buildBinary(startPos, startLoc, expr, this.parseMaybeUnary(null, false), \"**\", false)\r\n else\r\n return expr\r\n}\r\n\r\n// Parse call, dot, and `[]`-subscript expressions.\r\n\r\npp$3.parseExprSubscripts = function(refDestructuringErrors) {\r\n var startPos = this.start, startLoc = this.startLoc\r\n var expr = this.parseExprAtom(refDestructuringErrors)\r\n var skipArrowSubscripts = expr.type === \"ArrowFunctionExpression\" && this.input.slice(this.lastTokStart, this.lastTokEnd) !== \")\"\r\n if (this.checkExpressionErrors(refDestructuringErrors) || skipArrowSubscripts) return expr\r\n var result = this.parseSubscripts(expr, startPos, startLoc)\r\n if (refDestructuringErrors && result.type === \"MemberExpression\") {\r\n if (refDestructuringErrors.parenthesizedAssign >= result.start) refDestructuringErrors.parenthesizedAssign = -1\r\n if (refDestructuringErrors.parenthesizedBind >= result.start) refDestructuringErrors.parenthesizedBind = -1\r\n }\r\n return result\r\n}\r\n\r\npp$3.parseSubscripts = function(base, startPos, startLoc, noCalls) {\r\n var this$1 = this;\r\n\r\n var maybeAsyncArrow = this.options.ecmaVersion >= 8 && base.type === \"Identifier\" && base.name === \"async\" &&\r\n this.lastTokEnd == base.end && !this.canInsertSemicolon()\r\n for (var computed;;) {\r\n if ((computed = this$1.eat(tt.bracketL)) || this$1.eat(tt.dot)) {\r\n var node = this$1.startNodeAt(startPos, startLoc)\r\n node.object = base\r\n node.property = computed ? this$1.parseExpression() : this$1.parseIdent(true)\r\n node.computed = !!computed\r\n if (computed) this$1.expect(tt.bracketR)\r\n base = this$1.finishNode(node, \"MemberExpression\")\r\n } else if (!noCalls && this$1.eat(tt.parenL)) {\r\n var refDestructuringErrors = new DestructuringErrors, oldYieldPos = this$1.yieldPos, oldAwaitPos = this$1.awaitPos\r\n this$1.yieldPos = 0\r\n this$1.awaitPos = 0\r\n var exprList = this$1.parseExprList(tt.parenR, this$1.options.ecmaVersion >= 8, false, refDestructuringErrors)\r\n if (maybeAsyncArrow && !this$1.canInsertSemicolon() && this$1.eat(tt.arrow)) {\r\n this$1.checkPatternErrors(refDestructuringErrors, false)\r\n this$1.checkYieldAwaitInDefaultParams()\r\n this$1.yieldPos = oldYieldPos\r\n this$1.awaitPos = oldAwaitPos\r\n return this$1.parseArrowExpression(this$1.startNodeAt(startPos, startLoc), exprList, true)\r\n }\r\n this$1.checkExpressionErrors(refDestructuringErrors, true)\r\n this$1.yieldPos = oldYieldPos || this$1.yieldPos\r\n this$1.awaitPos = oldAwaitPos || this$1.awaitPos\r\n var node$1 = this$1.startNodeAt(startPos, startLoc)\r\n node$1.callee = base\r\n node$1.arguments = exprList\r\n base = this$1.finishNode(node$1, \"CallExpression\")\r\n } else if (this$1.type === tt.backQuote) {\r\n var node$2 = this$1.startNodeAt(startPos, startLoc)\r\n node$2.tag = base\r\n node$2.quasi = this$1.parseTemplate()\r\n base = this$1.finishNode(node$2, \"TaggedTemplateExpression\")\r\n } else {\r\n return base\r\n }\r\n }\r\n}\r\n\r\n// Parse an atomic expression — either a single token that is an\r\n// expression, an expression started by a keyword like `function` or\r\n// `new`, or an expression wrapped in punctuation like `()`, `[]`,\r\n// or `{}`.\r\n\r\npp$3.parseExprAtom = function(refDestructuringErrors) {\r\n var node, canBeArrow = this.potentialArrowAt == this.start\r\n switch (this.type) {\r\n case tt._super:\r\n if (!this.inFunction)\r\n this.raise(this.start, \"'super' outside of function or class\")\r\n\r\n case tt._this:\r\n var type = this.type === tt._this ? \"ThisExpression\" : \"Super\"\r\n node = this.startNode()\r\n this.next()\r\n return this.finishNode(node, type)\r\n\r\n case tt.name:\r\n var startPos = this.start, startLoc = this.startLoc\r\n var id = this.parseIdent(this.type !== tt.name)\r\n if (this.options.ecmaVersion >= 8 && id.name === \"async\" && !this.canInsertSemicolon() && this.eat(tt._function))\r\n return this.parseFunction(this.startNodeAt(startPos, startLoc), false, false, true)\r\n if (canBeArrow && !this.canInsertSemicolon()) {\r\n if (this.eat(tt.arrow))\r\n return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), [id], false)\r\n if (this.options.ecmaVersion >= 8 && id.name === \"async\" && this.type === tt.name) {\r\n id = this.parseIdent()\r\n if (this.canInsertSemicolon() || !this.eat(tt.arrow))\r\n this.unexpected()\r\n return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), [id], true)\r\n }\r\n }\r\n return id\r\n\r\n case tt.regexp:\r\n var value = this.value\r\n node = this.parseLiteral(value.value)\r\n node.regex = {pattern: value.pattern, flags: value.flags}\r\n return node\r\n\r\n case tt.num: case tt.string:\r\n return this.parseLiteral(this.value)\r\n\r\n case tt._null: case tt._true: case tt._false:\r\n node = this.startNode()\r\n node.value = this.type === tt._null ? null : this.type === tt._true\r\n node.raw = this.type.keyword\r\n this.next()\r\n return this.finishNode(node, \"Literal\")\r\n\r\n case tt.parenL:\r\n var start = this.start, expr = this.parseParenAndDistinguishExpression(canBeArrow)\r\n if (refDestructuringErrors) {\r\n if (refDestructuringErrors.parenthesizedAssign < 0 && !this.isSimpleAssignTarget(expr))\r\n refDestructuringErrors.parenthesizedAssign = start\r\n if (refDestructuringErrors.parenthesizedBind < 0)\r\n refDestructuringErrors.parenthesizedBind = start\r\n }\r\n return expr\r\n\r\n case tt.bracketL:\r\n node = this.startNode()\r\n this.next()\r\n node.elements = this.parseExprList(tt.bracketR, true, true, refDestructuringErrors)\r\n return this.finishNode(node, \"ArrayExpression\")\r\n\r\n case tt.braceL:\r\n return this.parseObj(false, refDestructuringErrors)\r\n\r\n case tt._function:\r\n node = this.startNode()\r\n this.next()\r\n return this.parseFunction(node, false)\r\n\r\n case tt._class:\r\n return this.parseClass(this.startNode(), false)\r\n\r\n case tt._new:\r\n return this.parseNew()\r\n\r\n case tt.backQuote:\r\n return this.parseTemplate()\r\n\r\n default:\r\n this.unexpected()\r\n }\r\n}\r\n\r\npp$3.parseLiteral = function(value) {\r\n var node = this.startNode()\r\n node.value = value\r\n node.raw = this.input.slice(this.start, this.end)\r\n this.next()\r\n return this.finishNode(node, \"Literal\")\r\n}\r\n\r\npp$3.parseParenExpression = function() {\r\n this.expect(tt.parenL)\r\n var val = this.parseExpression()\r\n this.expect(tt.parenR)\r\n return val\r\n}\r\n\r\npp$3.parseParenAndDistinguishExpression = function(canBeArrow) {\r\n var this$1 = this;\r\n\r\n var startPos = this.start, startLoc = this.startLoc, val, allowTrailingComma = this.options.ecmaVersion >= 8\r\n if (this.options.ecmaVersion >= 6) {\r\n this.next()\r\n\r\n var innerStartPos = this.start, innerStartLoc = this.startLoc\r\n var exprList = [], first = true, lastIsComma = false\r\n var refDestructuringErrors = new DestructuringErrors, oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, spreadStart, innerParenStart\r\n this.yieldPos = 0\r\n this.awaitPos = 0\r\n while (this.type !== tt.parenR) {\r\n first ? first = false : this$1.expect(tt.comma)\r\n if (allowTrailingComma && this$1.afterTrailingComma(tt.parenR, true)) {\r\n lastIsComma = true\r\n break\r\n } else if (this$1.type === tt.ellipsis) {\r\n spreadStart = this$1.start\r\n exprList.push(this$1.parseParenItem(this$1.parseRest()))\r\n if (this$1.type === tt.comma) this$1.raise(this$1.start, \"Comma is not permitted after the rest element\")\r\n break\r\n } else {\r\n if (this$1.type === tt.parenL && !innerParenStart) {\r\n innerParenStart = this$1.start\r\n }\r\n exprList.push(this$1.parseMaybeAssign(false, refDestructuringErrors, this$1.parseParenItem))\r\n }\r\n }\r\n var innerEndPos = this.start, innerEndLoc = this.startLoc\r\n this.expect(tt.parenR)\r\n\r\n if (canBeArrow && !this.canInsertSemicolon() && this.eat(tt.arrow)) {\r\n this.checkPatternErrors(refDestructuringErrors, false)\r\n this.checkYieldAwaitInDefaultParams()\r\n if (innerParenStart) this.unexpected(innerParenStart)\r\n this.yieldPos = oldYieldPos\r\n this.awaitPos = oldAwaitPos\r\n return this.parseParenArrowList(startPos, startLoc, exprList)\r\n }\r\n\r\n if (!exprList.length || lastIsComma) this.unexpected(this.lastTokStart)\r\n if (spreadStart) this.unexpected(spreadStart)\r\n this.checkExpressionErrors(refDestructuringErrors, true)\r\n this.yieldPos = oldYieldPos || this.yieldPos\r\n this.awaitPos = oldAwaitPos || this.awaitPos\r\n\r\n if (exprList.length > 1) {\r\n val = this.startNodeAt(innerStartPos, innerStartLoc)\r\n val.expressions = exprList\r\n this.finishNodeAt(val, \"SequenceExpression\", innerEndPos, innerEndLoc)\r\n } else {\r\n val = exprList[0]\r\n }\r\n } else {\r\n val = this.parseParenExpression()\r\n }\r\n\r\n if (this.options.preserveParens) {\r\n var par = this.startNodeAt(startPos, startLoc)\r\n par.expression = val\r\n return this.finishNode(par, \"ParenthesizedExpression\")\r\n } else {\r\n return val\r\n }\r\n}\r\n\r\npp$3.parseParenItem = function(item) {\r\n return item\r\n}\r\n\r\npp$3.parseParenArrowList = function(startPos, startLoc, exprList) {\r\n return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), exprList)\r\n}\r\n\r\n// New's precedence is slightly tricky. It must allow its argument to\r\n// be a `[]` or dot subscript expression, but not a call — at least,\r\n// not without wrapping it in parentheses. Thus, it uses the noCalls\r\n// argument to parseSubscripts to prevent it from consuming the\r\n// argument list.\r\n\r\nvar empty$1 = []\r\n\r\npp$3.parseNew = function() {\r\n var node = this.startNode()\r\n var meta = this.parseIdent(true)\r\n if (this.options.ecmaVersion >= 6 && this.eat(tt.dot)) {\r\n node.meta = meta\r\n node.property = this.parseIdent(true)\r\n if (node.property.name !== \"target\")\r\n this.raiseRecoverable(node.property.start, \"The only valid meta property for new is new.target\")\r\n if (!this.inFunction)\r\n this.raiseRecoverable(node.start, \"new.target can only be used in functions\")\r\n return this.finishNode(node, \"MetaProperty\")\r\n }\r\n var startPos = this.start, startLoc = this.startLoc\r\n node.callee = this.parseSubscripts(this.parseExprAtom(), startPos, startLoc, true)\r\n if (this.eat(tt.parenL)) node.arguments = this.parseExprList(tt.parenR, this.options.ecmaVersion >= 8, false)\r\n else node.arguments = empty$1\r\n return this.finishNode(node, \"NewExpression\")\r\n}\r\n\r\n// Parse template expression.\r\n\r\npp$3.parseTemplateElement = function() {\r\n var elem = this.startNode()\r\n elem.value = {\r\n raw: this.input.slice(this.start, this.end).replace(/\\r\\n?/g, \"\\n\"),\r\n cooked: this.value\r\n }\r\n this.next()\r\n elem.tail = this.type === tt.backQuote\r\n return this.finishNode(elem, \"TemplateElement\")\r\n}\r\n\r\npp$3.parseTemplate = function() {\r\n var this$1 = this;\r\n\r\n var node = this.startNode()\r\n this.next()\r\n node.expressions = []\r\n var curElt = this.parseTemplateElement()\r\n node.quasis = [curElt]\r\n while (!curElt.tail) {\r\n this$1.expect(tt.dollarBraceL)\r\n node.expressions.push(this$1.parseExpression())\r\n this$1.expect(tt.braceR)\r\n node.quasis.push(curElt = this$1.parseTemplateElement())\r\n }\r\n this.next()\r\n return this.finishNode(node, \"TemplateLiteral\")\r\n}\r\n\r\n// Parse an object literal or binding pattern.\r\n\r\npp$3.parseObj = function(isPattern, refDestructuringErrors) {\r\n var this$1 = this;\r\n\r\n var node = this.startNode(), first = true, propHash = {}\r\n node.properties = []\r\n this.next()\r\n while (!this.eat(tt.braceR)) {\r\n if (!first) {\r\n this$1.expect(tt.comma)\r\n if (this$1.afterTrailingComma(tt.braceR)) break\r\n } else first = false\r\n\r\n var prop = this$1.startNode(), isGenerator, isAsync, startPos, startLoc\r\n if (this$1.options.ecmaVersion >= 6) {\r\n prop.method = false\r\n prop.shorthand = false\r\n if (isPattern || refDestructuringErrors) {\r\n startPos = this$1.start\r\n startLoc = this$1.startLoc\r\n }\r\n if (!isPattern)\r\n isGenerator = this$1.eat(tt.star)\r\n }\r\n this$1.parsePropertyName(prop)\r\n if (!isPattern && this$1.options.ecmaVersion >= 8 && !isGenerator && !prop.computed &&\r\n prop.key.type === \"Identifier\" && prop.key.name === \"async\" && this$1.type !== tt.parenL &&\r\n this$1.type !== tt.colon && !this$1.canInsertSemicolon()) {\r\n isAsync = true\r\n this$1.parsePropertyName(prop, refDestructuringErrors)\r\n } else {\r\n isAsync = false\r\n }\r\n this$1.parsePropertyValue(prop, isPattern, isGenerator, isAsync, startPos, startLoc, refDestructuringErrors)\r\n this$1.checkPropClash(prop, propHash)\r\n node.properties.push(this$1.finishNode(prop, \"Property\"))\r\n }\r\n return this.finishNode(node, isPattern ? \"ObjectPattern\" : \"ObjectExpression\")\r\n}\r\n\r\npp$3.parsePropertyValue = function(prop, isPattern, isGenerator, isAsync, startPos, startLoc, refDestructuringErrors) {\r\n if ((isGenerator || isAsync) && this.type === tt.colon)\r\n this.unexpected()\r\n\r\n if (this.eat(tt.colon)) {\r\n prop.value = isPattern ? this.parseMaybeDefault(this.start, this.startLoc) : this.parseMaybeAssign(false, refDestructuringErrors)\r\n prop.kind = \"init\"\r\n } else if (this.options.ecmaVersion >= 6 && this.type === tt.parenL) {\r\n if (isPattern) this.unexpected()\r\n prop.kind = \"init\"\r\n prop.method = true\r\n prop.value = this.parseMethod(isGenerator, isAsync)\r\n } else if (this.options.ecmaVersion >= 5 && !prop.computed && prop.key.type === \"Identifier\" &&\r\n (prop.key.name === \"get\" || prop.key.name === \"set\") &&\r\n (this.type != tt.comma && this.type != tt.braceR)) {\r\n if (isGenerator || isAsync || isPattern) this.unexpected()\r\n prop.kind = prop.key.name\r\n this.parsePropertyName(prop)\r\n prop.value = this.parseMethod(false)\r\n var paramCount = prop.kind === \"get\" ? 0 : 1\r\n if (prop.value.params.length !== paramCount) {\r\n var start = prop.value.start\r\n if (prop.kind === \"get\")\r\n this.raiseRecoverable(start, \"getter should have no params\")\r\n else\r\n this.raiseRecoverable(start, \"setter should have exactly one param\")\r\n } else {\r\n if (prop.kind === \"set\" && prop.value.params[0].type === \"RestElement\")\r\n this.raiseRecoverable(prop.value.params[0].start, \"Setter cannot use rest params\")\r\n }\r\n } else if (this.options.ecmaVersion >= 6 && !prop.computed && prop.key.type === \"Identifier\") {\r\n if (this.keywords.test(prop.key.name) ||\r\n (this.strict ? this.reservedWordsStrict : this.reservedWords).test(prop.key.name) ||\r\n (this.inGenerator && prop.key.name == \"yield\") ||\r\n (this.inAsync && prop.key.name == \"await\"))\r\n this.raiseRecoverable(prop.key.start, \"'\" + prop.key.name + \"' can not be used as shorthand property\")\r\n prop.kind = \"init\"\r\n if (isPattern) {\r\n prop.value = this.parseMaybeDefault(startPos, startLoc, prop.key)\r\n } else if (this.type === tt.eq && refDestructuringErrors) {\r\n if (refDestructuringErrors.shorthandAssign < 0)\r\n refDestructuringErrors.shorthandAssign = this.start\r\n prop.value = this.parseMaybeDefault(startPos, startLoc, prop.key)\r\n } else {\r\n prop.value = prop.key\r\n }\r\n prop.shorthand = true\r\n } else this.unexpected()\r\n}\r\n\r\npp$3.parsePropertyName = function(prop) {\r\n if (this.options.ecmaVersion >= 6) {\r\n if (this.eat(tt.bracketL)) {\r\n prop.computed = true\r\n prop.key = this.parseMaybeAssign()\r\n this.expect(tt.bracketR)\r\n return prop.key\r\n } else {\r\n prop.computed = false\r\n }\r\n }\r\n return prop.key = this.type === tt.num || this.type === tt.string ? this.parseExprAtom() : this.parseIdent(true)\r\n}\r\n\r\n// Initialize empty function node.\r\n\r\npp$3.initFunction = function(node) {\r\n node.id = null\r\n if (this.options.ecmaVersion >= 6) {\r\n node.generator = false\r\n node.expression = false\r\n }\r\n if (this.options.ecmaVersion >= 8)\r\n node.async = false\r\n}\r\n\r\n// Parse object or class method.\r\n\r\npp$3.parseMethod = function(isGenerator, isAsync) {\r\n var node = this.startNode(), oldInGen = this.inGenerator, oldInAsync = this.inAsync,\r\n oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldInFunc = this.inFunction\r\n\r\n this.initFunction(node)\r\n if (this.options.ecmaVersion >= 6)\r\n node.generator = isGenerator\r\n if (this.options.ecmaVersion >= 8)\r\n node.async = !!isAsync\r\n\r\n this.inGenerator = node.generator\r\n this.inAsync = node.async\r\n this.yieldPos = 0\r\n this.awaitPos = 0\r\n this.inFunction = true\r\n this.enterFunctionScope()\r\n\r\n this.expect(tt.parenL)\r\n node.params = this.parseBindingList(tt.parenR, false, this.options.ecmaVersion >= 8)\r\n this.checkYieldAwaitInDefaultParams()\r\n this.parseFunctionBody(node, false)\r\n\r\n this.inGenerator = oldInGen\r\n this.inAsync = oldInAsync\r\n this.yieldPos = oldYieldPos\r\n this.awaitPos = oldAwaitPos\r\n this.inFunction = oldInFunc\r\n return this.finishNode(node, \"FunctionExpression\")\r\n}\r\n\r\n// Parse arrow function expression with given parameters.\r\n\r\npp$3.parseArrowExpression = function(node, params, isAsync) {\r\n var oldInGen = this.inGenerator, oldInAsync = this.inAsync,\r\n oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldInFunc = this.inFunction\r\n\r\n this.enterFunctionScope()\r\n this.initFunction(node)\r\n if (this.options.ecmaVersion >= 8)\r\n node.async = !!isAsync\r\n\r\n this.inGenerator = false\r\n this.inAsync = node.async\r\n this.yieldPos = 0\r\n this.awaitPos = 0\r\n this.inFunction = true\r\n\r\n node.params = this.toAssignableList(params, true)\r\n this.parseFunctionBody(node, true)\r\n\r\n this.inGenerator = oldInGen\r\n this.inAsync = oldInAsync\r\n this.yieldPos = oldYieldPos\r\n this.awaitPos = oldAwaitPos\r\n this.inFunction = oldInFunc\r\n return this.finishNode(node, \"ArrowFunctionExpression\")\r\n}\r\n\r\n// Parse function body and check parameters.\r\n\r\npp$3.parseFunctionBody = function(node, isArrowFunction) {\r\n var isExpression = isArrowFunction && this.type !== tt.braceL\r\n var oldStrict = this.strict, useStrict = false\r\n\r\n if (isExpression) {\r\n node.body = this.parseMaybeAssign()\r\n node.expression = true\r\n this.checkParams(node, false)\r\n } else {\r\n var nonSimple = this.options.ecmaVersion >= 7 && !this.isSimpleParamList(node.params)\r\n if (!oldStrict || nonSimple) {\r\n useStrict = this.strictDirective(this.end)\r\n // If this is a strict mode function, verify that argument names\r\n // are not repeated, and it does not try to bind the words `eval`\r\n // or `arguments`.\r\n if (useStrict && nonSimple)\r\n this.raiseRecoverable(node.start, \"Illegal 'use strict' directive in function with non-simple parameter list\")\r\n }\r\n // Start a new scope with regard to labels and the `inFunction`\r\n // flag (restore them to their old value afterwards).\r\n var oldLabels = this.labels\r\n this.labels = []\r\n if (useStrict) this.strict = true\r\n\r\n // Add the params to varDeclaredNames to ensure that an error is thrown\r\n // if a let/const declaration in the function clashes with one of the params.\r\n this.checkParams(node, !oldStrict && !useStrict && !isArrowFunction && this.isSimpleParamList(node.params))\r\n node.body = this.parseBlock(false)\r\n node.expression = false\r\n this.labels = oldLabels\r\n }\r\n this.exitFunctionScope()\r\n\r\n if (this.strict && node.id) {\r\n // Ensure the function name isn't a forbidden identifier in strict mode, e.g. 'eval'\r\n this.checkLVal(node.id, \"none\")\r\n }\r\n this.strict = oldStrict\r\n}\r\n\r\npp$3.isSimpleParamList = function(params) {\r\n for (var i = 0; i < params.length; i++)\r\n if (params[i].type !== \"Identifier\") return false\r\n return true\r\n}\r\n\r\n// Checks function params for various disallowed patterns such as using \"eval\"\r\n// or \"arguments\" and duplicate parameters.\r\n\r\npp$3.checkParams = function(node, allowDuplicates) {\r\n var this$1 = this;\r\n\r\n var nameHash = {}\r\n for (var i = 0; i < node.params.length; i++) this$1.checkLVal(node.params[i], \"var\", allowDuplicates ? null : nameHash)\r\n}\r\n\r\n// Parses a comma-separated list of expressions, and returns them as\r\n// an array. `close` is the token type that ends the list, and\r\n// `allowEmpty` can be turned on to allow subsequent commas with\r\n// nothing in between them to be parsed as `null` (which is needed\r\n// for array literals).\r\n\r\npp$3.parseExprList = function(close, allowTrailingComma, allowEmpty, refDestructuringErrors) {\r\n var this$1 = this;\r\n\r\n var elts = [], first = true\r\n while (!this.eat(close)) {\r\n if (!first) {\r\n this$1.expect(tt.comma)\r\n if (allowTrailingComma && this$1.afterTrailingComma(close)) break\r\n } else first = false\r\n\r\n var elt\r\n if (allowEmpty && this$1.type === tt.comma)\r\n elt = null\r\n else if (this$1.type === tt.ellipsis) {\r\n elt = this$1.parseSpread(refDestructuringErrors)\r\n if (refDestructuringErrors && this$1.type === tt.comma && refDestructuringErrors.trailingComma < 0)\r\n refDestructuringErrors.trailingComma = this$1.start\r\n } else {\r\n elt = this$1.parseMaybeAssign(false, refDestructuringErrors)\r\n }\r\n elts.push(elt)\r\n }\r\n return elts\r\n}\r\n\r\n// Parse the next token as an identifier. If `liberal` is true (used\r\n// when parsing properties), it will also convert keywords into\r\n// identifiers.\r\n\r\npp$3.parseIdent = function(liberal) {\r\n var node = this.startNode()\r\n if (liberal && this.options.allowReserved == \"never\") liberal = false\r\n if (this.type === tt.name) {\r\n if (!liberal && (this.strict ? this.reservedWordsStrict : this.reservedWords).test(this.value) &&\r\n (this.options.ecmaVersion >= 6 ||\r\n this.input.slice(this.start, this.end).indexOf(\"\\\\\") == -1))\r\n this.raiseRecoverable(this.start, \"The keyword '\" + this.value + \"' is reserved\")\r\n if (this.inGenerator && this.value === \"yield\")\r\n this.raiseRecoverable(this.start, \"Can not use 'yield' as identifier inside a generator\")\r\n if (this.inAsync && this.value === \"await\")\r\n this.raiseRecoverable(this.start, \"Can not use 'await' as identifier inside an async function\")\r\n node.name = this.value\r\n } else if (liberal && this.type.keyword) {\r\n node.name = this.type.keyword\r\n } else {\r\n this.unexpected()\r\n }\r\n this.next()\r\n return this.finishNode(node, \"Identifier\")\r\n}\r\n\r\n// Parses yield expression inside generator.\r\n\r\npp$3.parseYield = function() {\r\n if (!this.yieldPos) this.yieldPos = this.start\r\n\r\n var node = this.startNode()\r\n this.next()\r\n if (this.type == tt.semi || this.canInsertSemicolon() || (this.type != tt.star && !this.type.startsExpr)) {\r\n node.delegate = false\r\n node.argument = null\r\n } else {\r\n node.delegate = this.eat(tt.star)\r\n node.argument = this.parseMaybeAssign()\r\n }\r\n return this.finishNode(node, \"YieldExpression\")\r\n}\r\n\r\npp$3.parseAwait = function() {\r\n if (!this.awaitPos) this.awaitPos = this.start\r\n\r\n var node = this.startNode()\r\n this.next()\r\n node.argument = this.parseMaybeUnary(null, true)\r\n return this.finishNode(node, \"AwaitExpression\")\r\n}\r\n\r\nvar pp$4 = Parser.prototype\r\n\r\n// This function is used to raise exceptions on parse errors. It\r\n// takes an offset integer (into the current `input`) to indicate\r\n// the location of the error, attaches the position to the end\r\n// of the error message, and then raises a `SyntaxError` with that\r\n// message.\r\n\r\npp$4.raise = function(pos, message) {\r\n var loc = getLineInfo(this.input, pos)\r\n message += \" (\" + loc.line + \":\" + loc.column + \")\"\r\n var err = new SyntaxError(message)\r\n err.pos = pos; err.loc = loc; err.raisedAt = this.pos\r\n throw err\r\n}\r\n\r\npp$4.raiseRecoverable = pp$4.raise\r\n\r\npp$4.curPosition = function() {\r\n if (this.options.locations) {\r\n return new Position(this.curLine, this.pos - this.lineStart)\r\n }\r\n}\r\n\r\nvar pp$5 = Parser.prototype\r\n\r\n// Object.assign polyfill\r\nvar assign = Object.assign || function(target) {\r\n var sources = [], len = arguments.length - 1;\r\n while ( len-- > 0 ) sources[ len ] = arguments[ len + 1 ];\r\n\r\n for (var i = 0; i < sources.length; i++) {\r\n var source = sources[i]\r\n for (var key in source) {\r\n if (has(source, key)) {\r\n target[key] = source[key]\r\n }\r\n }\r\n }\r\n return target\r\n}\r\n\r\n// The functions in this module keep track of declared variables in the current scope in order to detect duplicate variable names.\r\n\r\npp$5.enterFunctionScope = function() {\r\n // var: a hash of var-declared names in the current lexical scope\r\n // lexical: a hash of lexically-declared names in the current lexical scope\r\n // childVar: a hash of var-declared names in all child lexical scopes of the current lexical scope (within the current function scope)\r\n // parentLexical: a hash of lexically-declared names in all parent lexical scopes of the current lexical scope (within the current function scope)\r\n this.scopeStack.push({var: {}, lexical: {}, childVar: {}, parentLexical: {}})\r\n}\r\n\r\npp$5.exitFunctionScope = function() {\r\n this.scopeStack.pop()\r\n}\r\n\r\npp$5.enterLexicalScope = function() {\r\n var parentScope = this.scopeStack[this.scopeStack.length - 1]\r\n var childScope = {var: {}, lexical: {}, childVar: {}, parentLexical: {}}\r\n\r\n this.scopeStack.push(childScope)\r\n assign(childScope.parentLexical, parentScope.lexical, parentScope.parentLexical)\r\n}\r\n\r\npp$5.exitLexicalScope = function() {\r\n var childScope = this.scopeStack.pop()\r\n var parentScope = this.scopeStack[this.scopeStack.length - 1]\r\n\r\n assign(parentScope.childVar, childScope.var, childScope.childVar)\r\n}\r\n\r\n/**\r\n * A name can be declared with `var` if there are no variables with the same name declared with `let`/`const`\r\n * in the current lexical scope or any of the parent lexical scopes in this function.\r\n */\r\npp$5.canDeclareVarName = function(name) {\r\n var currentScope = this.scopeStack[this.scopeStack.length - 1]\r\n\r\n return !has(currentScope.lexical, name) && !has(currentScope.parentLexical, name)\r\n}\r\n\r\n/**\r\n * A name can be declared with `let`/`const` if there are no variables with the same name declared with `let`/`const`\r\n * in the current scope, and there are no variables with the same name declared with `var` in the current scope or in\r\n * any child lexical scopes in this function.\r\n */\r\npp$5.canDeclareLexicalName = function(name) {\r\n var currentScope = this.scopeStack[this.scopeStack.length - 1]\r\n\r\n return !has(currentScope.lexical, name) && !has(currentScope.var, name) && !has(currentScope.childVar, name)\r\n}\r\n\r\npp$5.declareVarName = function(name) {\r\n this.scopeStack[this.scopeStack.length - 1].var[name] = true\r\n}\r\n\r\npp$5.declareLexicalName = function(name) {\r\n this.scopeStack[this.scopeStack.length - 1].lexical[name] = true\r\n}\r\n\r\nvar Node = function Node(parser, pos, loc) {\r\n this.type = \"\"\r\n this.start = pos\r\n this.end = 0\r\n if (parser.options.locations)\r\n this.loc = new SourceLocation(parser, loc)\r\n if (parser.options.directSourceFile)\r\n this.sourceFile = parser.options.directSourceFile\r\n if (parser.options.ranges)\r\n this.range = [pos, 0]\r\n};\r\n\r\n// Start an AST node, attaching a start offset.\r\n\r\nvar pp$6 = Parser.prototype\r\n\r\npp$6.startNode = function() {\r\n return new Node(this, this.start, this.startLoc)\r\n}\r\n\r\npp$6.startNodeAt = function(pos, loc) {\r\n return new Node(this, pos, loc)\r\n}\r\n\r\n// Finish an AST node, adding `type` and `end` properties.\r\n\r\nfunction finishNodeAt(node, type, pos, loc) {\r\n node.type = type\r\n node.end = pos\r\n if (this.options.locations)\r\n node.loc.end = loc\r\n if (this.options.ranges)\r\n node.range[1] = pos\r\n return node\r\n}\r\n\r\npp$6.finishNode = function(node, type) {\r\n return finishNodeAt.call(this, node, type, this.lastTokEnd, this.lastTokEndLoc)\r\n}\r\n\r\n// Finish node at given position\r\n\r\npp$6.finishNodeAt = function(node, type, pos, loc) {\r\n return finishNodeAt.call(this, node, type, pos, loc)\r\n}\r\n\r\n// The algorithm used to determine whether a regexp can appear at a\r\n// given point in the program is loosely based on sweet.js' approach.\r\n// See https://github.com/mozilla/sweet.js/wiki/design\r\n\r\nvar TokContext = function TokContext(token, isExpr, preserveSpace, override, generator) {\r\n this.token = token\r\n this.isExpr = !!isExpr\r\n this.preserveSpace = !!preserveSpace\r\n this.override = override\r\n this.generator = !!generator\r\n};\r\n\r\nvar types = {\r\n b_stat: new TokContext(\"{\", false),\r\n b_expr: new TokContext(\"{\", true),\r\n b_tmpl: new TokContext(\"${\", true),\r\n p_stat: new TokContext(\"(\", false),\r\n p_expr: new TokContext(\"(\", true),\r\n q_tmpl: new TokContext(\"`\", true, true, function (p) { return p.readTmplToken(); }),\r\n f_expr: new TokContext(\"function\", true),\r\n f_expr_gen: new TokContext(\"function\", true, false, null, true),\r\n f_gen: new TokContext(\"function\", false, false, null, true)\r\n}\r\n\r\nvar pp$7 = Parser.prototype\r\n\r\npp$7.initialContext = function() {\r\n return [types.b_stat]\r\n}\r\n\r\npp$7.braceIsBlock = function(prevType) {\r\n if (prevType === tt.colon) {\r\n var parent = this.curContext()\r\n if (parent === types.b_stat || parent === types.b_expr)\r\n return !parent.isExpr\r\n }\r\n if (prevType === tt._return)\r\n return lineBreak.test(this.input.slice(this.lastTokEnd, this.start))\r\n if (prevType === tt._else || prevType === tt.semi || prevType === tt.eof || prevType === tt.parenR || prevType == tt.arrow)\r\n return true\r\n if (prevType == tt.braceL)\r\n return this.curContext() === types.b_stat\r\n return !this.exprAllowed\r\n}\r\n\r\npp$7.inGeneratorContext = function() {\r\n var this$1 = this;\r\n\r\n for (var i = this.context.length - 1; i >= 0; i--)\r\n if (this$1.context[i].generator) return true\r\n return false\r\n}\r\n\r\npp$7.updateContext = function(prevType) {\r\n var update, type = this.type\r\n if (type.keyword && prevType == tt.dot)\r\n this.exprAllowed = false\r\n else if (update = type.updateContext)\r\n update.call(this, prevType)\r\n else\r\n this.exprAllowed = type.beforeExpr\r\n}\r\n\r\n// Token-specific context update code\r\n\r\ntt.parenR.updateContext = tt.braceR.updateContext = function() {\r\n if (this.context.length == 1) {\r\n this.exprAllowed = true\r\n return\r\n }\r\n var out = this.context.pop(), cur\r\n if (out === types.b_stat && (cur = this.curContext()) && cur.token === \"function\") {\r\n this.context.pop()\r\n this.exprAllowed = false\r\n } else if (out === types.b_tmpl) {\r\n this.exprAllowed = true\r\n } else {\r\n this.exprAllowed = !out.isExpr\r\n }\r\n}\r\n\r\ntt.braceL.updateContext = function(prevType) {\r\n this.context.push(this.braceIsBlock(prevType) ? types.b_stat : types.b_expr)\r\n this.exprAllowed = true\r\n}\r\n\r\ntt.dollarBraceL.updateContext = function() {\r\n this.context.push(types.b_tmpl)\r\n this.exprAllowed = true\r\n}\r\n\r\ntt.parenL.updateContext = function(prevType) {\r\n var statementParens = prevType === tt._if || prevType === tt._for || prevType === tt._with || prevType === tt._while\r\n this.context.push(statementParens ? types.p_stat : types.p_expr)\r\n this.exprAllowed = true\r\n}\r\n\r\ntt.incDec.updateContext = function() {\r\n // tokExprAllowed stays unchanged\r\n}\r\n\r\ntt._function.updateContext = function(prevType) {\r\n if (prevType.beforeExpr && prevType !== tt.semi && prevType !== tt._else &&\r\n !((prevType === tt.colon || prevType === tt.braceL) && this.curContext() === types.b_stat))\r\n this.context.push(types.f_expr)\r\n this.exprAllowed = false\r\n}\r\n\r\ntt.backQuote.updateContext = function() {\r\n if (this.curContext() === types.q_tmpl)\r\n this.context.pop()\r\n else\r\n this.context.push(types.q_tmpl)\r\n this.exprAllowed = false\r\n}\r\n\r\ntt.star.updateContext = function(prevType) {\r\n if (prevType == tt._function) {\r\n if (this.curContext() === types.f_expr)\r\n this.context[this.context.length - 1] = types.f_expr_gen\r\n else\r\n this.context.push(types.f_gen)\r\n }\r\n this.exprAllowed = true\r\n}\r\n\r\ntt.name.updateContext = function(prevType) {\r\n var allowed = false\r\n if (this.options.ecmaVersion >= 6) {\r\n if (this.value == \"of\" && !this.exprAllowed ||\r\n this.value == \"yield\" && this.inGeneratorContext())\r\n allowed = true\r\n }\r\n this.exprAllowed = allowed\r\n}\r\n\r\n// Object type used to represent tokens. Note that normally, tokens\r\n// simply exist as properties on the parser object. This is only\r\n// used for the onToken callback and the external tokenizer.\r\n\r\nvar Token = function Token(p) {\r\n this.type = p.type\r\n this.value = p.value\r\n this.start = p.start\r\n this.end = p.end\r\n if (p.options.locations)\r\n this.loc = new SourceLocation(p, p.startLoc, p.endLoc)\r\n if (p.options.ranges)\r\n this.range = [p.start, p.end]\r\n};\r\n\r\n// ## Tokenizer\r\n\r\nvar pp$8 = Parser.prototype\r\n\r\n// Are we running under Rhino?\r\nvar isRhino = typeof Packages == \"object\" && Object.prototype.toString.call(Packages) == \"[object JavaPackage]\"\r\n\r\n// Move to the next token\r\n\r\npp$8.next = function() {\r\n if (this.options.onToken)\r\n this.options.onToken(new Token(this))\r\n\r\n this.lastTokEnd = this.end\r\n this.lastTokStart = this.start\r\n this.lastTokEndLoc = this.endLoc\r\n this.lastTokStartLoc = this.startLoc\r\n this.nextToken()\r\n}\r\n\r\npp$8.getToken = function() {\r\n this.next()\r\n return new Token(this)\r\n}\r\n\r\n// If we're in an ES6 environment, make parsers iterable\r\nif (typeof Symbol !== \"undefined\")\r\n pp$8[Symbol.iterator] = function() {\r\n var this$1 = this;\r\n\r\n return {\r\n next: function () {\r\n var token = this$1.getToken()\r\n return {\r\n done: token.type === tt.eof,\r\n value: token\r\n }\r\n }\r\n }\r\n }\r\n\r\n// Toggle strict mode. Re-reads the next number or string to please\r\n// pedantic tests (`\"use strict\"; 010;` should fail).\r\n\r\npp$8.curContext = function() {\r\n return this.context[this.context.length - 1]\r\n}\r\n\r\n// Read a single token, updating the parser object's token-related\r\n// properties.\r\n\r\npp$8.nextToken = function() {\r\n var curContext = this.curContext()\r\n if (!curContext || !curContext.preserveSpace) this.skipSpace()\r\n\r\n this.start = this.pos\r\n if (this.options.locations) this.startLoc = this.curPosition()\r\n if (this.pos >= this.input.length) return this.finishToken(tt.eof)\r\n\r\n if (curContext.override) return curContext.override(this)\r\n else this.readToken(this.fullCharCodeAtPos())\r\n}\r\n\r\npp$8.readToken = function(code) {\r\n // Identifier or keyword. '\\uXXXX' sequences are allowed in\r\n // identifiers, so '\\' also dispatches to that.\r\n if (isIdentifierStart(code, this.options.ecmaVersion >= 6) || code === 92 /* '\\' */)\r\n return this.readWord()\r\n\r\n return this.getTokenFromCode(code)\r\n}\r\n\r\npp$8.fullCharCodeAtPos = function() {\r\n var code = this.input.charCodeAt(this.pos)\r\n if (code <= 0xd7ff || code >= 0xe000) return code\r\n var next = this.input.charCodeAt(this.pos + 1)\r\n return (code << 10) + next - 0x35fdc00\r\n}\r\n\r\npp$8.skipBlockComment = function() {\r\n var this$1 = this;\r\n\r\n var startLoc = this.options.onComment && this.curPosition()\r\n var start = this.pos, end = this.input.indexOf(\"*/\", this.pos += 2)\r\n if (end === -1) this.raise(this.pos - 2, \"Unterminated comment\")\r\n this.pos = end + 2\r\n if (this.options.locations) {\r\n lineBreakG.lastIndex = start\r\n var match\r\n while ((match = lineBreakG.exec(this.input)) && match.index < this.pos) {\r\n ++this$1.curLine\r\n this$1.lineStart = match.index + match[0].length\r\n }\r\n }\r\n if (this.options.onComment)\r\n this.options.onComment(true, this.input.slice(start + 2, end), start, this.pos,\r\n startLoc, this.curPosition())\r\n}\r\n\r\npp$8.skipLineComment = function(startSkip) {\r\n var this$1 = this;\r\n\r\n var start = this.pos\r\n var startLoc = this.options.onComment && this.curPosition()\r\n var ch = this.input.charCodeAt(this.pos += startSkip)\r\n while (this.pos < this.input.length && ch !== 10 && ch !== 13 && ch !== 8232 && ch !== 8233) {\r\n ++this$1.pos\r\n ch = this$1.input.charCodeAt(this$1.pos)\r\n }\r\n if (this.options.onComment)\r\n this.options.onComment(false, this.input.slice(start + startSkip, this.pos), start, this.pos,\r\n startLoc, this.curPosition())\r\n}\r\n\r\n// Called at the start of the parse and after every token. Skips\r\n// whitespace and comments, and.\r\n\r\npp$8.skipSpace = function() {\r\n var this$1 = this;\r\n\r\n loop: while (this.pos < this.input.length) {\r\n var ch = this$1.input.charCodeAt(this$1.pos)\r\n switch (ch) {\r\n case 32: case 160: // ' '\r\n ++this$1.pos\r\n break\r\n case 13:\r\n if (this$1.input.charCodeAt(this$1.pos + 1) === 10) {\r\n ++this$1.pos\r\n }\r\n case 10: case 8232: case 8233:\r\n ++this$1.pos\r\n if (this$1.options.locations) {\r\n ++this$1.curLine\r\n this$1.lineStart = this$1.pos\r\n }\r\n break\r\n case 47: // '/'\r\n switch (this$1.input.charCodeAt(this$1.pos + 1)) {\r\n case 42: // '*'\r\n this$1.skipBlockComment()\r\n break\r\n case 47:\r\n this$1.skipLineComment(2)\r\n break\r\n default:\r\n break loop\r\n }\r\n break\r\n default:\r\n if (ch > 8 && ch < 14 || ch >= 5760 && nonASCIIwhitespace.test(String.fromCharCode(ch))) {\r\n ++this$1.pos\r\n } else {\r\n break loop\r\n }\r\n }\r\n }\r\n}\r\n\r\n// Called at the end of every token. Sets `end`, `val`, and\r\n// maintains `context` and `exprAllowed`, and skips the space after\r\n// the token, so that the next one's `start` will point at the\r\n// right position.\r\n\r\npp$8.finishToken = function(type, val) {\r\n this.end = this.pos\r\n if (this.options.locations) this.endLoc = this.curPosition()\r\n var prevType = this.type\r\n this.type = type\r\n this.value = val\r\n\r\n this.updateContext(prevType)\r\n}\r\n\r\n// ### Token reading\r\n\r\n// This is the function that is called to fetch the next token. It\r\n// is somewhat obscure, because it works in character codes rather\r\n// than characters, and because operator parsing has been inlined\r\n// into it.\r\n//\r\n// All in the name of speed.\r\n//\r\npp$8.readToken_dot = function() {\r\n var next = this.input.charCodeAt(this.pos + 1)\r\n if (next >= 48 && next <= 57) return this.readNumber(true)\r\n var next2 = this.input.charCodeAt(this.pos + 2)\r\n if (this.options.ecmaVersion >= 6 && next === 46 && next2 === 46) { // 46 = dot '.'\r\n this.pos += 3\r\n return this.finishToken(tt.ellipsis)\r\n } else {\r\n ++this.pos\r\n return this.finishToken(tt.dot)\r\n }\r\n}\r\n\r\npp$8.readToken_slash = function() { // '/'\r\n var next = this.input.charCodeAt(this.pos + 1)\r\n if (this.exprAllowed) { ++this.pos; return this.readRegexp() }\r\n if (next === 61) return this.finishOp(tt.assign, 2)\r\n return this.finishOp(tt.slash, 1)\r\n}\r\n\r\npp$8.readToken_mult_modulo_exp = function(code) { // '%*'\r\n var next = this.input.charCodeAt(this.pos + 1)\r\n var size = 1\r\n var tokentype = code === 42 ? tt.star : tt.modulo\r\n\r\n // exponentiation operator ** and **=\r\n if (this.options.ecmaVersion >= 7 && next === 42) {\r\n ++size\r\n tokentype = tt.starstar\r\n next = this.input.charCodeAt(this.pos + 2)\r\n }\r\n\r\n if (next === 61) return this.finishOp(tt.assign, size + 1)\r\n return this.finishOp(tokentype, size)\r\n}\r\n\r\npp$8.readToken_pipe_amp = function(code) { // '|&'\r\n var next = this.input.charCodeAt(this.pos + 1)\r\n if (next === code) return this.finishOp(code === 124 ? tt.logicalOR : tt.logicalAND, 2)\r\n if (next === 61) return this.finishOp(tt.assign, 2)\r\n return this.finishOp(code === 124 ? tt.bitwiseOR : tt.bitwiseAND, 1)\r\n}\r\n\r\npp$8.readToken_caret = function() { // '^'\r\n var next = this.input.charCodeAt(this.pos + 1)\r\n if (next === 61) return this.finishOp(tt.assign, 2)\r\n return this.finishOp(tt.bitwiseXOR, 1)\r\n}\r\n\r\npp$8.readToken_plus_min = function(code) { // '+-'\r\n var next = this.input.charCodeAt(this.pos + 1)\r\n if (next === code) {\r\n if (next == 45 && this.input.charCodeAt(this.pos + 2) == 62 &&\r\n lineBreak.test(this.input.slice(this.lastTokEnd, this.pos))) {\r\n // A `-->` line comment\r\n this.skipLineComment(3)\r\n this.skipSpace()\r\n return this.nextToken()\r\n }\r\n return this.finishOp(tt.incDec, 2)\r\n }\r\n if (next === 61) return this.finishOp(tt.assign, 2)\r\n return this.finishOp(tt.plusMin, 1)\r\n}\r\n\r\npp$8.readToken_lt_gt = function(code) { // '<>'\r\n var next = this.input.charCodeAt(this.pos + 1)\r\n var size = 1\r\n if (next === code) {\r\n size = code === 62 && this.input.charCodeAt(this.pos + 2) === 62 ? 3 : 2\r\n if (this.input.charCodeAt(this.pos + size) === 61) return this.finishOp(tt.assign, size + 1)\r\n return this.finishOp(tt.bitShift, size)\r\n }\r\n if (next == 33 && code == 60 && this.input.charCodeAt(this.pos + 2) == 45 &&\r\n this.input.charCodeAt(this.pos + 3) == 45) {\r\n if (this.inModule) this.unexpected()\r\n // `<!--`, an XML-style comment that should be interpreted as a line comment\r\n this.skipLineComment(4)\r\n this.skipSpace()\r\n return this.nextToken()\r\n }\r\n if (next === 61) size = 2\r\n return this.finishOp(tt.relational, size)\r\n}\r\n\r\npp$8.readToken_eq_excl = function(code) { // '=!'\r\n var next = this.input.charCodeAt(this.pos + 1)\r\n if (next === 61) return this.finishOp(tt.equality, this.input.charCodeAt(this.pos + 2) === 61 ? 3 : 2)\r\n if (code === 61 && next === 62 && this.options.ecmaVersion >= 6) { // '=>'\r\n this.pos += 2\r\n return this.finishToken(tt.arrow)\r\n }\r\n return this.finishOp(code === 61 ? tt.eq : tt.prefix, 1)\r\n}\r\n\r\npp$8.getTokenFromCode = function(code) {\r\n switch (code) {\r\n // The interpretation of a dot depends on whether it is followed\r\n // by a digit or another two dots.\r\n case 46: // '.'\r\n return this.readToken_dot()\r\n\r\n // Punctuation tokens.\r\n case 40: ++this.pos; return this.finishToken(tt.parenL)\r\n case 41: ++this.pos; return this.finishToken(tt.parenR)\r\n case 59: ++this.pos; return this.finishToken(tt.semi)\r\n case 44: ++this.pos; return this.finishToken(tt.comma)\r\n case 91: ++this.pos; return this.finishToken(tt.bracketL)\r\n case 93: ++this.pos; return this.finishToken(tt.bracketR)\r\n case 123: ++this.pos; return this.finishToken(tt.braceL)\r\n case 125: ++this.pos; return this.finishToken(tt.braceR)\r\n case 58: ++this.pos; return this.finishToken(tt.colon)\r\n case 63: ++this.pos; return this.finishToken(tt.question)\r\n\r\n case 96: // '`'\r\n if (this.options.ecmaVersion < 6) break\r\n ++this.pos\r\n return this.finishToken(tt.backQuote)\r\n\r\n case 48: // '0'\r\n var next = this.input.charCodeAt(this.pos + 1)\r\n if (next === 120 || next === 88) return this.readRadixNumber(16) // '0x', '0X' - hex number\r\n if (this.options.ecmaVersion >= 6) {\r\n if (next === 111 || next === 79) return this.readRadixNumber(8) // '0o', '0O' - octal number\r\n if (next === 98 || next === 66) return this.readRadixNumber(2) // '0b', '0B' - binary number\r\n }\r\n // Anything else beginning with a digit is an integer, octal\r\n // number, or float.\r\n case 49: case 50: case 51: case 52: case 53: case 54: case 55: case 56: case 57: // 1-9\r\n return this.readNumber(false)\r\n\r\n // Quotes produce strings.\r\n case 34: case 39: // '\"', \"'\"\r\n return this.readString(code)\r\n\r\n // Operators are parsed inline in tiny state machines. '=' (61) is\r\n // often referred to. `finishOp` simply skips the amount of\r\n // characters it is given as second argument, and returns a token\r\n // of the type given by its first argument.\r\n\r\n case 47: // '/'\r\n return this.readToken_slash()\r\n\r\n case 37: case 42: // '%*'\r\n return this.readToken_mult_modulo_exp(code)\r\n\r\n case 124: case 38: // '|&'\r\n return this.readToken_pipe_amp(code)\r\n\r\n case 94: // '^'\r\n return this.readToken_caret()\r\n\r\n case 43: case 45: // '+-'\r\n return this.readToken_plus_min(code)\r\n\r\n case 60: case 62: // '<>'\r\n return this.readToken_lt_gt(code)\r\n\r\n case 61: case 33: // '=!'\r\n return this.readToken_eq_excl(code)\r\n\r\n case 126: // '~'\r\n return this.finishOp(tt.prefix, 1)\r\n }\r\n\r\n this.raise(this.pos, \"Unexpected character '\" + codePointToString(code) + \"'\")\r\n}\r\n\r\npp$8.finishOp = function(type, size) {\r\n var str = this.input.slice(this.pos, this.pos + size)\r\n this.pos += size\r\n return this.finishToken(type, str)\r\n}\r\n\r\n// Parse a regular expression. Some context-awareness is necessary,\r\n// since a '/' inside a '[]' set does not end the expression.\r\n\r\nfunction tryCreateRegexp(src, flags, throwErrorAt, parser) {\r\n try {\r\n return new RegExp(src, flags)\r\n } catch (e) {\r\n if (throwErrorAt !== undefined) {\r\n if (e instanceof SyntaxError) parser.raise(throwErrorAt, \"Error parsing regular expression: \" + e.message)\r\n throw e\r\n }\r\n }\r\n}\r\n\r\nvar regexpUnicodeSupport = !!tryCreateRegexp(\"\\uffff\", \"u\")\r\n\r\npp$8.readRegexp = function() {\r\n var this$1 = this;\r\n\r\n var escaped, inClass, start = this.pos\r\n for (;;) {\r\n if (this$1.pos >= this$1.input.length) this$1.raise(start, \"Unterminated regular expression\")\r\n var ch = this$1.input.charAt(this$1.pos)\r\n if (lineBreak.test(ch)) this$1.raise(start, \"Unterminated regular expression\")\r\n if (!escaped) {\r\n if (ch === \"[\") inClass = true\r\n else if (ch === \"]\" && inClass) inClass = false\r\n else if (ch === \"/\" && !inClass) break\r\n escaped = ch === \"\\\\\"\r\n } else escaped = false\r\n ++this$1.pos\r\n }\r\n var content = this.input.slice(start, this.pos)\r\n ++this.pos\r\n // Need to use `readWord1` because '\\uXXXX' sequences are allowed\r\n // here (don't ask).\r\n var mods = this.readWord1()\r\n var tmp = content, tmpFlags = \"\"\r\n if (mods) {\r\n var validFlags = /^[gim]*$/\r\n if (this.options.ecmaVersion >= 6) validFlags = /^[gimuy]*$/\r\n if (!validFlags.test(mods)) this.raise(start, \"Invalid regular expression flag\")\r\n if (mods.indexOf(\"u\") >= 0) {\r\n if (regexpUnicodeSupport) {\r\n tmpFlags = \"u\"\r\n } else {\r\n // Replace each astral symbol and every Unicode escape sequence that\r\n // possibly represents an astral symbol or a paired surrogate with a\r\n // single ASCII symbol to avoid throwing on regular expressions that\r\n // are only valid in combination with the `/u` flag.\r\n // Note: replacing with the ASCII symbol `x` might cause false\r\n // negatives in unlikely scenarios. For example, `[\\u{61}-b]` is a\r\n // perfectly valid pattern that is equivalent to `[a-b]`, but it would\r\n // be replaced by `[x-b]` which throws an error.\r\n tmp = tmp.replace(/\\\\u\\{([0-9a-fA-F]+)\\}/g, function (_match, code, offset) {\r\n code = Number(\"0x\" + code)\r\n if (code > 0x10FFFF) this$1.raise(start + offset + 3, \"Code point out of bounds\")\r\n return \"x\"\r\n })\r\n tmp = tmp.replace(/\\\\u([a-fA-F0-9]{4})|[\\uD800-\\uDBFF][\\uDC00-\\uDFFF]/g, \"x\")\r\n tmpFlags = tmpFlags.replace(\"u\", \"\")\r\n }\r\n }\r\n }\r\n // Detect invalid regular expressions.\r\n var value = null\r\n // Rhino's regular expression parser is flaky and throws uncatchable exceptions,\r\n // so don't do detection if we are running under Rhino\r\n if (!isRhino) {\r\n tryCreateRegexp(tmp, tmpFlags, start, this)\r\n // Get a regular expression object for this pattern-flag pair, or `null` in\r\n // case the current environment doesn't support the flags it uses.\r\n value = tryCreateRegexp(content, mods)\r\n }\r\n return this.finishToken(tt.regexp, {pattern: content, flags: mods, value: value})\r\n}\r\n\r\n// Read an integer in the given radix. Return null if zero digits\r\n// were read, the integer value otherwise. When `len` is given, this\r\n// will return `null` unless the integer has exactly `len` digits.\r\n\r\npp$8.readInt = function(radix, len) {\r\n var this$1 = this;\r\n\r\n var start = this.pos, total = 0\r\n for (var i = 0, e = len == null ? Infinity : len; i < e; ++i) {\r\n var code = this$1.input.charCodeAt(this$1.pos), val\r\n if (code >= 97) val = code - 97 + 10 // a\r\n else if (code >= 65) val = code - 65 + 10 // A\r\n else if (code >= 48 && code <= 57) val = code - 48 // 0-9\r\n else val = Infinity\r\n if (val >= radix) break\r\n ++this$1.pos\r\n total = total * radix + val\r\n }\r\n if (this.pos === start || len != null && this.pos - start !== len) return null\r\n\r\n return total\r\n}\r\n\r\npp$8.readRadixNumber = function(radix) {\r\n this.pos += 2 // 0x\r\n var val = this.readInt(radix)\r\n if (val == null) this.raise(this.start + 2, \"Expected number in radix \" + radix)\r\n if (isIdentifierStart(this.fullCharCodeAtPos())) this.raise(this.pos, \"Identifier directly after number\")\r\n return this.finishToken(tt.num, val)\r\n}\r\n\r\n// Read an integer, octal integer, or floating-point number.\r\n\r\npp$8.readNumber = function(startsWithDot) {\r\n var start = this.pos, isFloat = false, octal = this.input.charCodeAt(this.pos) === 48\r\n if (!startsWithDot && this.readInt(10) === null) this.raise(start, \"Invalid number\")\r\n if (octal && this.pos == start + 1) octal = false\r\n var next = this.input.charCodeAt(this.pos)\r\n if (next === 46 && !octal) { // '.'\r\n ++this.pos\r\n this.readInt(10)\r\n isFloat = true\r\n next = this.input.charCodeAt(this.pos)\r\n }\r\n if ((next === 69 || next === 101) && !octal) { // 'eE'\r\n next = this.input.charCodeAt(++this.pos)\r\n if (next === 43 || next === 45) ++this.pos // '+-'\r\n if (this.readInt(10) === null) this.raise(start, \"Invalid number\")\r\n isFloat = true\r\n }\r\n if (isIdentifierStart(this.fullCharCodeAtPos())) this.raise(this.pos, \"Identifier directly after number\")\r\n\r\n var str = this.input.slice(start, this.pos), val\r\n if (isFloat) val = parseFloat(str)\r\n else if (!octal || str.length === 1) val = parseInt(str, 10)\r\n else if (/[89]/.test(str) || this.strict) this.raise(start, \"Invalid number\")\r\n else val = parseInt(str, 8)\r\n return this.finishToken(tt.num, val)\r\n}\r\n\r\n// Read a string value, interpreting backslash-escapes.\r\n\r\npp$8.readCodePoint = function() {\r\n var ch = this.input.charCodeAt(this.pos), code\r\n\r\n if (ch === 123) {\r\n if (this.options.ecmaVersion < 6) this.unexpected()\r\n var codePos = ++this.pos\r\n code = this.readHexChar(this.input.indexOf(\"}\", this.pos) - this.pos)\r\n ++this.pos\r\n if (code > 0x10FFFF) this.raise(codePos, \"Code point out of bounds\")\r\n } else {\r\n code = this.readHexChar(4)\r\n }\r\n return code\r\n}\r\n\r\nfunction codePointToString(code) {\r\n // UTF-16 Decoding\r\n if (code <= 0xFFFF) return String.fromCharCode(code)\r\n code -= 0x10000\r\n return String.fromCharCode((code >> 10) + 0xD800, (code & 1023) + 0xDC00)\r\n}\r\n\r\npp$8.readString = function(quote) {\r\n var this$1 = this;\r\n\r\n var out = \"\", chunkStart = ++this.pos\r\n for (;;) {\r\n if (this$1.pos >= this$1.input.length) this$1.raise(this$1.start, \"Unterminated string constant\")\r\n var ch = this$1.input.charCodeAt(this$1.pos)\r\n if (ch === quote) break\r\n if (ch === 92) { // '\\'\r\n out += this$1.input.slice(chunkStart, this$1.pos)\r\n out += this$1.readEscapedChar(false)\r\n chunkStart = this$1.pos\r\n } else {\r\n if (isNewLine(ch)) this$1.raise(this$1.start, \"Unterminated string constant\")\r\n ++this$1.pos\r\n }\r\n }\r\n out += this.input.slice(chunkStart, this.pos++)\r\n return this.finishToken(tt.string, out)\r\n}\r\n\r\n// Reads template string tokens.\r\n\r\npp$8.readTmplToken = function() {\r\n var this$1 = this;\r\n\r\n var out = \"\", chunkStart = this.pos\r\n for (;;) {\r\n if (this$1.pos >= this$1.input.length) this$1.raise(this$1.start, \"Unterminated template\")\r\n var ch = this$1.input.charCodeAt(this$1.pos)\r\n if (ch === 96 || ch === 36 && this$1.input.charCodeAt(this$1.pos + 1) === 123) { // '`', '${'\r\n if (this$1.pos === this$1.start && this$1.type === tt.template) {\r\n if (ch === 36) {\r\n this$1.pos += 2\r\n return this$1.finishToken(tt.dollarBraceL)\r\n } else {\r\n ++this$1.pos\r\n return this$1.finishToken(tt.backQuote)\r\n }\r\n }\r\n out += this$1.input.slice(chunkStart, this$1.pos)\r\n return this$1.finishToken(tt.template, out)\r\n }\r\n if (ch === 92) { // '\\'\r\n out += this$1.input.slice(chunkStart, this$1.pos)\r\n out += this$1.readEscapedChar(true)\r\n chunkStart = this$1.pos\r\n } else if (isNewLine(ch)) {\r\n out += this$1.input.slice(chunkStart, this$1.pos)\r\n ++this$1.pos\r\n switch (ch) {\r\n case 13:\r\n if (this$1.input.charCodeAt(this$1.pos) === 10) ++this$1.pos\r\n case 10:\r\n out += \"\\n\"\r\n break\r\n default:\r\n out += String.fromCharCode(ch)\r\n break\r\n }\r\n if (this$1.options.locations) {\r\n ++this$1.curLine\r\n this$1.lineStart = this$1.pos\r\n }\r\n chunkStart = this$1.pos\r\n } else {\r\n ++this$1.pos\r\n }\r\n }\r\n}\r\n\r\n// Used to read escaped characters\r\n\r\npp$8.readEscapedChar = function(inTemplate) {\r\n var ch = this.input.charCodeAt(++this.pos)\r\n ++this.pos\r\n switch (ch) {\r\n case 110: return \"\\n\" // 'n' -> '\\n'\r\n case 114: return \"\\r\" // 'r' -> '\\r'\r\n case 120: return String.fromCharCode(this.readHexChar(2)) // 'x'\r\n case 117: return codePointToString(this.readCodePoint()) // 'u'\r\n case 116: return \"\\t\" // 't' -> '\\t'\r\n case 98: return \"\\b\" // 'b' -> '\\b'\r\n case 118: return \"\\u000b\" // 'v' -> '\\u000b'\r\n case 102: return \"\\f\" // 'f' -> '\\f'\r\n case 13: if (this.input.charCodeAt(this.pos) === 10) ++this.pos // '\\r\\n'\r\n case 10: // ' \\n'\r\n if (this.options.locations) { this.lineStart = this.pos; ++this.curLine }\r\n return \"\"\r\n default:\r\n if (ch >= 48 && ch <= 55) {\r\n var octalStr = this.input.substr(this.pos - 1, 3).match(/^[0-7]+/)[0]\r\n var octal = parseInt(octalStr, 8)\r\n if (octal > 255) {\r\n octalStr = octalStr.slice(0, -1)\r\n octal = parseInt(octalStr, 8)\r\n }\r\n if (octalStr !== \"0\" && (this.strict || inTemplate)) {\r\n this.raise(this.pos - 2, \"Octal literal in strict mode\")\r\n }\r\n this.pos += octalStr.length - 1\r\n return String.fromCharCode(octal)\r\n }\r\n return String.fromCharCode(ch)\r\n }\r\n}\r\n\r\n// Used to read character escape sequences ('\\x', '\\u', '\\U').\r\n\r\npp$8.readHexChar = function(len) {\r\n var codePos = this.pos\r\n var n = this.readInt(16, len)\r\n if (n === null) this.raise(codePos, \"Bad character escape sequence\")\r\n return n\r\n}\r\n\r\n// Read an identifier, and return it as a string. Sets `this.containsEsc`\r\n// to whether the word contained a '\\u' escape.\r\n//\r\n// Incrementally adds only escaped chars, adding other chunks as-is\r\n// as a micro-optimization.\r\n\r\npp$8.readWord1 = function() {\r\n var this$1 = this;\r\n\r\n this.containsEsc = false\r\n var word = \"\", first = true, chunkStart = this.pos\r\n var astral = this.options.ecmaVersion >= 6\r\n while (this.pos < this.input.length) {\r\n var ch = this$1.fullCharCodeAtPos()\r\n if (isIdentifierChar(ch, astral)) {\r\n this$1.pos += ch <= 0xffff ? 1 : 2\r\n } else if (ch === 92) { // \"\\\"\r\n this$1.containsEsc = true\r\n word += this$1.input.slice(chunkStart, this$1.pos)\r\n var escStart = this$1.pos\r\n if (this$1.input.charCodeAt(++this$1.pos) != 117) // \"u\"\r\n this$1.raise(this$1.pos, \"Expecting Unicode escape sequence \\\\uXXXX\")\r\n ++this$1.pos\r\n var esc = this$1.readCodePoint()\r\n if (!(first ? isIdentifierStart : isIdentifierChar)(esc, astral))\r\n this$1.raise(escStart, \"Invalid Unicode escape\")\r\n word += codePointToString(esc)\r\n chunkStart = this$1.pos\r\n } else {\r\n break\r\n }\r\n first = false\r\n }\r\n return word + this.input.slice(chunkStart, this.pos)\r\n}\r\n\r\n// Read an identifier or keyword token. Will check for reserved\r\n// words when necessary.\r\n\r\npp$8.readWord = function() {\r\n var word = this.readWord1()\r\n var type = tt.name\r\n if (this.keywords.test(word)) {\r\n if (this.containsEsc) this.raiseRecoverable(this.start, \"Escape sequence in keyword \" + word)\r\n type = keywordTypes[word]\r\n }\r\n return this.finishToken(type, word)\r\n}\r\n\r\n// Acorn is a tiny, fast JavaScript parser written in JavaScript.\r\n//\r\n// Acorn was written by Marijn Haverbeke, Ingvar Stepanyan, and\r\n// various contributors and released under an MIT license.\r\n//\r\n// Git repositories for Acorn are available at\r\n//\r\n// http://marijnhaverbeke.nl/git/acorn\r\n// https://github.com/ternjs/acorn.git\r\n//\r\n// Please use the [github bug tracker][ghbt] to report issues.\r\n//\r\n// [ghbt]: https://github.com/ternjs/acorn/issues\r\n//\r\n// This file defines the main parser interface. The library also comes\r\n// with a [error-tolerant parser][dammit] and an\r\n// [abstract syntax tree walker][walk], defined in other files.\r\n//\r\n// [dammit]: acorn_loose.js\r\n// [walk]: util/walk.js\r\n\r\nvar version = \"5.0.3\"\r\n\r\n// The main exported interface (under `self.acorn` when in the\r\n// browser) is a `parse` function that takes a code string and\r\n// returns an abstract syntax tree as specified by [Mozilla parser\r\n// API][api].\r\n//\r\n// [api]: https://developer.mozilla.org/en-US/docs/SpiderMonkey/Parser_API\r\n\r\nfunction parse(input, options) {\r\n return new Parser(options, input).parse()\r\n}\r\n\r\n// This function tries to parse a single expression at a given\r\n// offset in a string. Useful for parsing mixed-language formats\r\n// that embed JavaScript expressions.\r\n\r\nfunction parseExpressionAt(input, pos, options) {\r\n var p = new Parser(options, input, pos)\r\n p.nextToken()\r\n return p.parseExpression()\r\n}\r\n\r\n// Acorn is organized as a tokenizer and a recursive-descent parser.\r\n// The `tokenizer` export provides an interface to the tokenizer.\r\n\r\nfunction tokenizer(input, options) {\r\n return new Parser(options, input)\r\n}\r\n\r\n// This is a terrible kludge to support the existing, pre-ES6\r\n// interface where the loose parser module retroactively adds exports\r\n// to this module.\r\n// eslint-disable-line camelcase\r\nfunction addLooseExports(parse, Parser, plugins) {\r\n exports.parse_dammit = parse // eslint-disable-line camelcase\r\n exports.LooseParser = Parser\r\n exports.pluginsLoose = plugins\r\n}\r\n\r\nexports.version = version;\r\nexports.parse = parse;\r\nexports.parseExpressionAt = parseExpressionAt;\r\nexports.tokenizer = tokenizer;\r\nexports.addLooseExports = addLooseExports;\r\nexports.Parser = Parser;\r\nexports.plugins = plugins;\r\nexports.defaultOptions = defaultOptions;\r\nexports.Position = Position;\r\nexports.SourceLocation = SourceLocation;\r\nexports.getLineInfo = getLineInfo;\r\nexports.Node = Node;\r\nexports.TokenType = TokenType;\r\nexports.tokTypes = tt;\r\nexports.keywordTypes = keywordTypes;\r\nexports.TokContext = TokContext;\r\nexports.tokContexts = types;\r\nexports.isIdentifierChar = isIdentifierChar;\r\nexports.isIdentifierStart = isIdentifierStart;\r\nexports.Token = Token;\r\nexports.isNewLine = isNewLine;\r\nexports.lineBreak = lineBreak;\r\nexports.lineBreakG = lineBreakG;\r\nexports.nonASCIIwhitespace = nonASCIIwhitespace;\r\n\r\nObject.defineProperty(exports, '__esModule', { value: true });\r\n\r\n})));","import {CONSTANTS} from \"./Constants.js\";\r\nimport {Engine} from \"./engine.js\";\r\nimport {Faction, Factions,\r\n displayFactionContent} from \"./Faction.js\";\r\nimport {Player} from \"./Player.js\";\r\nimport {dialogBoxCreate} from \"../utils/DialogBox.js\";\r\nimport {Reviver, Generic_toJSON,\r\n Generic_fromJSON} from \"../utils/JSONReviver.js\";\r\nimport {getRandomInt, createElement,\r\n removeChildrenFromElement,\r\n createAccordionElement, createPopup,\r\n removeElementById, removeElement} from \"../utils/HelperFunctions.js\";\r\nimport numeral from \"numeral/min/numeral.min\";\r\nimport {formatNumber} from \"../utils/StringHelperFunctions.js\";\r\nimport {yesNoBoxCreate, yesNoTxtInpBoxCreate,\r\n yesNoBoxGetYesButton, yesNoBoxGetNoButton,\r\n yesNoTxtInpBoxGetYesButton, yesNoTxtInpBoxGetNoButton,\r\n yesNoTxtInpBoxGetInput, yesNoBoxClose,\r\n yesNoTxtInpBoxClose, yesNoBoxOpen} from \"../utils/YesNoBox.js\";\r\n\r\n/* Gang.js */\r\n//Switch between territory and management screen with 1 and 2\r\n$(document).keydown(function(event) {\r\n if (Engine.currentPage == Engine.Page.Gang && !yesNoBoxOpen) {\r\n if (gangMemberFilter != null && gangMemberFilter === document.activeElement) {return;}\r\n if (event.keyCode === 49) {\r\n if(gangTerritorySubpage.style.display === \"block\") {\r\n managementButton.click();\r\n }\r\n } else if (event.keyCode === 50) {\r\n if (gangManagementSubpage.style.display === \"block\") {\r\n territoryButton.click();\r\n }\r\n }\r\n }\r\n});\r\n\r\n//Delete upgrade box when clicking outside\r\n$(document).mousedown(function(event) {\r\n var boxId = \"gang-member-upgrade-popup-box\";\r\n var contentId = \"gang-member-upgrade-popup-box-content\";\r\n if (gangMemberUpgradeBoxOpened) {\r\n if ( $(event.target).closest(\"#\" + contentId).get(0) == null ) {\r\n //Delete the box\r\n removeElement(gangMemberUpgradeBox);\r\n gangMemberUpgradeBox = null;\r\n gangMemberUpgradeBoxContent = null;\r\n gangMemberUpgradeBoxOpened = false;\r\n gangMemberUpgradeBoxElements = null;\r\n }\r\n }\r\n});\r\n\r\nlet GangNames = [\"Slum Snakes\", \"Tetrads\", \"The Syndicate\", \"The Dark Army\", \"Speakers for the Dead\",\r\n \"NiteSec\", \"The Black Hand\"];\r\nlet AllGangs = {\r\n \"Slum Snakes\" : {\r\n power: 1,\r\n territory: 1/7,\r\n },\r\n \"Tetrads\" : {\r\n power: 1,\r\n territory: 1/7,\r\n },\r\n \"The Syndicate\" : {\r\n power: 1,\r\n territory: 1/7,\r\n },\r\n \"The Dark Army\" : {\r\n power: 1,\r\n territory: 1/7,\r\n },\r\n \"Speakers for the Dead\" : {\r\n power: 1,\r\n territory: 1/7,\r\n },\r\n \"NiteSec\" : {\r\n power: 1,\r\n territory: 1/7,\r\n },\r\n \"The Black Hand\" : {\r\n power: 1,\r\n territory: 1/7,\r\n },\r\n}\r\n\r\nfunction resetGangs() {\r\n AllGangs = {\r\n \"Slum Snakes\" : {\r\n power: 1,\r\n territory: 1/7,\r\n },\r\n \"Tetrads\" : {\r\n power: 1,\r\n territory: 1/7,\r\n },\r\n \"The Syndicate\" : {\r\n power: 1,\r\n territory: 1/7,\r\n },\r\n \"The Dark Army\" : {\r\n power: 1,\r\n territory: 1/7,\r\n },\r\n \"Speakers for the Dead\" : {\r\n power: 1,\r\n territory: 1/7,\r\n },\r\n \"NiteSec\" : {\r\n power: 1,\r\n territory: 1/7,\r\n },\r\n \"The Black Hand\" : {\r\n power: 1,\r\n territory: 1/7,\r\n },\r\n }\r\n}\r\n\r\nfunction loadAllGangs(saveString) {\r\n AllGangs = JSON.parse(saveString, Reviver);\r\n}\r\n\r\n//Power is an estimate of a gang's ability to gain/defend territory\r\nlet gangStoredPowerCycles = 0;\r\nfunction processAllGangPowerGains(numCycles=1) {\r\n if (!Player.inGang()) {return;}\r\n gangStoredPowerCycles += numCycles;\r\n if (gangStoredPowerCycles < 150) {return;}\r\n var playerGangName = Player.gang.facName;\r\n for (var name in AllGangs) {\r\n if (AllGangs.hasOwnProperty(name)) {\r\n if (name == playerGangName) {\r\n AllGangs[name].power += Player.gang.calculatePower();\r\n } else {\r\n var gain = Math.random() * 0.02; //TODO Adjust as necessary\r\n AllGangs[name].power += (gain);\r\n }\r\n }\r\n }\r\n\r\n gangStoredPowerCycles -= 150;\r\n}\r\n\r\nlet gangStoredTerritoryCycles = 0;\r\nfunction processAllGangTerritory(numCycles=1) {\r\n if (!Player.inGang()) {return;}\r\n gangStoredTerritoryCycles += numCycles;\r\n if (gangStoredTerritoryCycles < CONSTANTS.GangTerritoryUpdateTimer) {return;}\r\n\r\n for (var i = 0; i < GangNames.length; ++i) {\r\n var other = getRandomInt(0, GangNames.length-1);\r\n while(other == i) {\r\n other = getRandomInt(0, GangNames.length-1);\r\n }\r\n var thisPwr = AllGangs[GangNames[i]].power;\r\n var otherPwr = AllGangs[GangNames[other]].power;\r\n var thisChance = thisPwr / (thisPwr + otherPwr);\r\n\r\n if (Math.random() < thisChance) {\r\n if (AllGangs[GangNames[other]].territory <= 0) {\r\n return;\r\n }\r\n AllGangs[GangNames[i]].territory += 0.0001;\r\n AllGangs[GangNames[other]].territory -= 0.0001;\r\n } else {\r\n if (AllGangs[GangNames[i]].territory <= 0) {\r\n return;\r\n }\r\n AllGangs[GangNames[i]].territory -= 0.0001;\r\n AllGangs[GangNames[other]].territory += 0.0001;\r\n }\r\n }\r\n\r\n gangStoredTerritoryCycles -= CONSTANTS.GangTerritoryUpdateTimer;\r\n}\r\n\r\n/* faction - Name of corresponding faction\r\n hacking - Boolean indicating whether its a hacking gang or not\r\n */\r\nfunction Gang(facName, hacking=false) {\r\n this.facName = facName;\r\n this.members = []; //Array of GangMembers\r\n this.wanted = 1;\r\n this.respect = 1;\r\n this.power = 0;\r\n\r\n this.isHackingGang = hacking;\r\n\r\n this.respectGainRate = 0;\r\n this.wantedGainRate = 0;\r\n this.moneyGainRate = 0;\r\n\r\n //When processing gains, this stores the number of cycles until some\r\n //limit is reached, and then calculates and applies the gains only at that limit\r\n this.storedCycles = 0;\r\n}\r\n\r\nGang.prototype.process = function(numCycles=1) {\r\n this.processGains(numCycles);\r\n this.processExperienceGains(numCycles);\r\n processAllGangPowerGains(numCycles);\r\n processAllGangTerritory(numCycles);\r\n}\r\n\r\nGang.prototype.processGains = function(numCycles=1) {\r\n this.storedCycles += numCycles;\r\n if (isNaN(this.storedCycles)) {\r\n console.log(\"ERROR: Gang's storedCylces is NaN\");\r\n this.storedCycles = 0;\r\n }\r\n if (this.storedCycles < 25) {return;} //Only process every 5 seconds at least\r\n\r\n //Get gains per cycle\r\n var moneyGains = 0, respectGains = 0, wantedLevelGains = 0;\r\n for (var i = 0; i < this.members.length; ++i) {\r\n respectGains += (this.members[i].calculateRespectGain());\r\n wantedLevelGains += (this.members[i].calculateWantedLevelGain());\r\n moneyGains += (this.members[i].calculateMoneyGain());\r\n }\r\n this.respectGainRate = respectGains;\r\n this.wantedGainRate = wantedLevelGains;\r\n this.moneyGainRate = moneyGains;\r\n\r\n if (!isNaN(respectGains)) {\r\n var gain = respectGains * this.storedCycles;\r\n this.respect += (gain);\r\n //Faction reputation gains is respect gain divided by some constant\r\n var fac = Factions[this.facName];\r\n if (!(fac instanceof Faction)) {\r\n dialogBoxCreate(\"ERROR: Could not get Faction associates with your gang. This is a bug, please report to game dev\");\r\n } else {\r\n var favorMult = 1 + (fac.favor / 100);\r\n fac.playerReputation += ((Player.faction_rep_mult * gain * favorMult) / CONSTANTS.GangRespectToReputationRatio);\r\n }\r\n\r\n } else {\r\n console.log(\"ERROR: respectGains is NaN\");\r\n }\r\n if (!isNaN(wantedLevelGains)) {\r\n if (this.wanted === 1 && wantedLevelGains < 0) {\r\n //Do nothing\r\n } else {\r\n this.wanted += (wantedLevelGains * this.storedCycles);\r\n if (this.wanted < 1) {this.wanted = 1;}\r\n }\r\n } else {\r\n console.log(\"ERROR: wantedLevelGains is NaN\");\r\n }\r\n if (!isNaN(moneyGains)) {\r\n Player.gainMoney(moneyGains * this.storedCycles);\r\n } else {\r\n console.log(\"ERROR: respectGains is NaN\");\r\n }\r\n\r\n this.storedCycles = 0;\r\n}\r\n\r\nGang.prototype.processExperienceGains = function(numCycles=1) {\r\n for (var i = 0; i < this.members.length; ++i) {\r\n this.members[i].gainExperience(numCycles);\r\n this.members[i].updateSkillLevels();\r\n }\r\n}\r\n\r\n//Calculates power GAIN, which is added onto the Gang's existing power\r\nGang.prototype.calculatePower = function() {\r\n var memberTotal = 0;\r\n for (var i = 0; i < this.members.length; ++i) {\r\n if (this.members[i].task instanceof GangMemberTask &&\r\n this.members[i].task.name == \"Territory Warfare\") {\r\n memberTotal += this.members[i].calculatePower();\r\n }\r\n }\r\n return (0.0005 * memberTotal);\r\n}\r\n\r\nGang.prototype.autoAssignMemberToTask = function(taskName) {\r\n for (var i = 0; i < this.members.length; ++i) {\r\n if (this.members[i].task.name === taskName) {\r\n this.members[i].assignToTask(taskName);\r\n return true;\r\n }\r\n }\r\n return false;\r\n}\r\n\r\nGang.prototype.autoUnassignMemberFromTask = function(taskName) {\r\n for (var i = 0; i < this.members.length; ++i) {\r\n if (this.members[i].task.name === taskName) {\r\n this.members[i].unassignFromTask();\r\n return true;\r\n }\r\n }\r\n return false;\r\n}\r\n\r\nGang.prototype.toJSON = function() {\r\n\treturn Generic_toJSON(\"Gang\", this);\r\n}\r\n\r\nGang.fromJSON = function(value) {\r\n\treturn Generic_fromJSON(Gang, value.data);\r\n}\r\n\r\nReviver.constructors.Gang = Gang;\r\n\r\n/*** Gang Member object ***/\r\nfunction GangMember(name) {\r\n this.name = name;\r\n this.task = GangMemberTasks[\"Unassigned\"]; //GangMemberTask object\r\n this.city = Player.city;\r\n\r\n this.hack = 1;\r\n this.str = 1;\r\n this.def = 1;\r\n this.dex = 1;\r\n this.agi = 1;\r\n this.cha = 1;\r\n\r\n this.hack_exp = 0;\r\n this.str_exp = 0;\r\n this.def_exp = 0;\r\n this.dex_exp = 0;\r\n this.agi_exp = 0;\r\n this.cha_exp = 0;\r\n\r\n this.hack_mult = 1;\r\n this.str_mult = 1;\r\n this.def_mult = 1;\r\n this.dex_mult = 1;\r\n this.agi_mult = 1;\r\n this.cha_mult = 1;\r\n\r\n this.upgrades = []; //Names of upgrades\r\n}\r\n\r\n//Same formula for Player\r\nGangMember.prototype.calculateSkill = function(exp) {\r\n return Math.max(Math.floor(32 * Math.log(exp + 534.5) - 200), 1);\r\n}\r\n\r\nGangMember.prototype.updateSkillLevels = function() {\r\n this.hack = Math.floor(this.calculateSkill(this.hack_exp) * this.hack_mult);\r\n this.str = Math.floor(this.calculateSkill(this.str_exp) * this.str_mult);\r\n this.def = Math.floor(this.calculateSkill(this.def_exp) * this.def_mult);\r\n this.dex = Math.floor(this.calculateSkill(this.dex_exp) * this.dex_mult);\r\n this.agi = Math.floor(this.calculateSkill(this.agi_exp) * this.agi_mult);\r\n this.cha = Math.floor(this.calculateSkill(this.cha_exp) * this.cha_mult);\r\n}\r\n\r\nGangMember.prototype.calculatePower = function() {\r\n return (this.hack + this.str + this.def +\r\n this.dex + this.agi + this.cha) / 100;\r\n}\r\n\r\nGangMember.prototype.assignToTask = function(taskName) {\r\n if (GangMemberTasks.hasOwnProperty(taskName)) {\r\n this.task = GangMemberTasks[taskName];\r\n } else {\r\n this.task = GangMemberTasks[\"Unassigned\"];\r\n }\r\n}\r\n\r\nGangMember.prototype.unassignFromTask = function() {\r\n if (GangMemberTasks.hasOwnProperty(\"Unassigned\")) {\r\n this.task = GangMemberTasks[\"Unassigned\"];\r\n } else {\r\n console.log(\"ERROR: Can't find Unassigned Gang member task\");\r\n this.task = null;\r\n }\r\n}\r\n\r\n//Gains are per cycle\r\nGangMember.prototype.calculateRespectGain = function() {\r\n var task = this.task;\r\n if (task == null || !(task instanceof GangMemberTask) || task.baseRespect === 0) {return 0;}\r\n var statWeight = (task.hackWeight/100) * this.hack +\r\n (task.strWeight/100) * this.str +\r\n (task.defWeight/100) * this.def +\r\n (task.dexWeight/100) * this.dex +\r\n (task.agiWeight/100) * this.agi +\r\n (task.chaWeight/100) * this.cha;\r\n statWeight -= (3.5 * task.difficulty);\r\n if (statWeight <= 0) {return 0;}\r\n var territoryMult = AllGangs[Player.gang.facName].territory;\r\n if (territoryMult <= 0) {return 0;}\r\n var respectMult = (Player.gang.respect) / (Player.gang.respect + Player.gang.wanted);\r\n return 12 * task.baseRespect * statWeight * territoryMult * respectMult;\r\n}\r\n\r\nGangMember.prototype.calculateWantedLevelGain = function() {\r\n var task = this.task;\r\n if (task == null || !(task instanceof GangMemberTask) || task.baseWanted === 0) {return 0;}\r\n var statWeight = (task.hackWeight/100) * this.hack +\r\n (task.strWeight/100) * this.str +\r\n (task.defWeight/100) * this.def +\r\n (task.dexWeight/100) * this.dex +\r\n (task.agiWeight/100) * this.agi +\r\n (task.chaWeight/100) * this.cha;\r\n statWeight -= (3.5 * task.difficulty);\r\n if (statWeight <= 0) {return 0;}\r\n var territoryMult = AllGangs[Player.gang.facName].territory;\r\n if (territoryMult <= 0) {return 0;}\r\n if (task.baseWanted < 0) {\r\n return task.baseWanted * statWeight * territoryMult;\r\n } else {\r\n return 6 * task.baseWanted / (3 * statWeight * territoryMult);\r\n }\r\n}\r\n\r\nGangMember.prototype.calculateMoneyGain = function() {\r\n var task = this.task;\r\n if (task == null || !(task instanceof GangMemberTask) || task.baseMoney === 0) {return 0;}\r\n var statWeight = (task.hackWeight/100) * this.hack +\r\n (task.strWeight/100) * this.str +\r\n (task.defWeight/100) * this.def +\r\n (task.dexWeight/100) * this.dex +\r\n (task.agiWeight/100) * this.agi +\r\n (task.chaWeight/100) * this.cha;\r\n statWeight -= (3.5 * task.difficulty);\r\n if (statWeight <= 0) {return 0;}\r\n var territoryMult = AllGangs[Player.gang.facName].territory;\r\n if (territoryMult <= 0) {return 0;}\r\n var respectMult = (Player.gang.respect) / (Player.gang.respect + Player.gang.wanted);\r\n return 5 * task.baseMoney * statWeight * territoryMult * respectMult;\r\n}\r\n\r\nGangMember.prototype.gainExperience = function(numCycles=1) {\r\n var task = this.task;\r\n if (task == null || !(task instanceof GangMemberTask)) {return;}\r\n this.hack_exp += (task.hackWeight / 1500) * task.difficulty * numCycles;\r\n this.str_exp += (task.strWeight / 1500) * task.difficulty * numCycles;\r\n this.def_exp += (task.defWeight / 1500) * task.difficulty * numCycles;\r\n this.dex_exp += (task.dexWeight / 1500) * task.difficulty * numCycles;\r\n this.agi_exp += (task.agiWeight / 1500) * task.difficulty * numCycles;\r\n this.cha_exp += (task.chaWeight / 1500) * task.difficulty * numCycles;\r\n}\r\n\r\nGangMember.prototype.toJSON = function() {\r\n\treturn Generic_toJSON(\"GangMember\", this);\r\n}\r\n\r\nGangMember.fromJSON = function(value) {\r\n\treturn Generic_fromJSON(GangMember, value.data);\r\n}\r\n\r\nReviver.constructors.GangMember = GangMember;\r\n\r\n//Defines tasks that Gang Members can work on\r\nfunction GangMemberTask(name=\"\", desc=\"\",\r\n params={baseRespect: 0, baseWanted: 0, baseMoney: 0,\r\n hackWeight: 0, strWeight: 0, defWeight: 0,\r\n dexWeight: 0, agiWeight: 0, chaWeight: 0,\r\n difficulty: 0}) {\r\n this.name = name;\r\n this.desc = desc;\r\n\r\n this.baseRespect = params.baseRespect ? params.baseRespect : 0;\r\n this.baseWanted = params.baseWanted ? params.baseWanted : 0;\r\n this.baseMoney = params.baseMoney ? params.baseMoney : 0;\r\n\r\n //Weights must add up to 100\r\n this.hackWeight = params.hackWeight ? params.hackWeight : 0;\r\n this.strWeight = params.strWeight ? params.strWeight : 0;\r\n this.defWeight = params.defWeight ? params.defWeight : 0;\r\n this.dexWeight = params.dexWeight ? params.dexWeight : 0;\r\n this.agiWeight = params.agiWeight ? params.agiWeight : 0;\r\n this.chaWeight = params.chaWeight ? params.chaWeight : 0;\r\n\r\n //1 - 100\r\n this.difficulty = params.difficulty ? params.difficulty : 1;\r\n}\r\n\r\nGangMemberTask.prototype.toJSON = function() {\r\n\treturn Generic_toJSON(\"GangMemberTask\", this);\r\n}\r\n\r\nGangMemberTask.fromJSON = function(value) {\r\n\treturn Generic_fromJSON(GangMemberTask, value.data);\r\n}\r\n\r\nReviver.constructors.GangMemberTask = GangMemberTask;\r\n\r\n//TODO Human trafficking and an equivalent hacking crime\r\nlet GangMemberTasks = {\r\n \"Unassigned\" : new GangMemberTask(\r\n \"Unassigned\",\r\n \"This gang member is currently idle\"),\r\n \"Ransomware\" : new GangMemberTask(\r\n \"Ransomware\",\r\n \"Assign this gang member to create and distribute ransomware<br><br>\" +\r\n \"Earns money - Slightly increases respect - Slightly increases wanted level\",\r\n {baseRespect: 0.00005, baseWanted: 0.00001, baseMoney: 1,\r\n hackWeight: 100, difficulty: 1}),\r\n \"Phishing\" : new GangMemberTask(\r\n \"Phishing\",\r\n \"Assign this gang member to attempt phishing scams and attacks<br><br>\" +\r\n \"Earns money - Slightly increases respect - Slightly increases wanted level\",\r\n {baseRespect: 0.00008, baseWanted: 0.001, baseMoney: 2.5,\r\n hackWeight: 85, chaWeight: 15, difficulty: 3}),\r\n \"Identity Theft\" : new GangMemberTask(\r\n \"Identity Theft\",\r\n \"Assign this gang member to attempt identity theft<br><br>\" +\r\n \"Earns money - Increases respect - Increases wanted level\",\r\n {baseRespect: 0.0001, baseWanted: 0.01, baseMoney: 6,\r\n hackWeight: 80, chaWeight: 20, difficulty: 4}),\r\n \"DDoS Attacks\" : new GangMemberTask(\r\n \"DDoS Attacks\",\r\n \"Assign this gang member to carry out DDoS attacks<br><br>\" +\r\n \"Increases respect - Increases wanted level\",\r\n {baseRespect: 0.0004, baseWanted: 0.05,\r\n hackWeight: 100, difficulty: 7}),\r\n \"Plant Virus\" : new GangMemberTask(\r\n \"Plant Virus\",\r\n \"Assign this gang member to create and distribute malicious viruses<br><br>\" +\r\n \"Increases respect - Increases wanted level\",\r\n {baseRespect: 0.0006, baseWanted: 0.05,\r\n hackWeight: 100, difficulty: 10}),\r\n \"Fraud & Counterfeiting\" : new GangMemberTask(\r\n \"Fraud & Counterfeiting\",\r\n \"Assign this gang member to commit financial fraud and digital counterfeiting<br><br>\" +\r\n \"Earns money - Slightly increases respect - Slightly increases wanted level\",\r\n {baseRespect: 0.0005, baseWanted: 0.1, baseMoney: 15,\r\n hackWeight: 80, chaWeight: 20, difficulty: 17}),\r\n \"Money Laundering\" : new GangMemberTask(\r\n \"Money Laundering\",\r\n \"Assign this gang member to launder money<br><br>\" +\r\n \"Earns money - Increases respect - Increases wanted level\",\r\n {baseRespect: 0.0006, baseWanted:0.2, baseMoney: 40,\r\n hackWeight: 75, chaWeight: 25, difficulty: 20}),\r\n \"Cyberterrorism\" : new GangMemberTask(\r\n \"Cyberterrorism\",\r\n \"Assign this gang member to commit acts of cyberterrorism<br><br>\" +\r\n \"Greatly increases respect - Greatly increases wanted level\",\r\n {baseRespect: 0.001, baseWanted: 0.5,\r\n hackWeight: 80, chaWeight: 20, difficulty: 33}),\r\n \"Ethical Hacking\" : new GangMemberTask(\r\n \"Ethical Hacking\",\r\n \"Assign this gang member to be an ethical hacker for corporations<br><br>\" +\r\n \"Earns money - Lowers wanted level\",\r\n {baseWanted: -0.001, baseMoney: 1,\r\n hackWeight: 90, chaWeight: 10, difficulty: 1}),\r\n \"Mug People\" : new GangMemberTask(\r\n \"Mug People\",\r\n \"Assign this gang member to mug random people on the streets<br><br>\" +\r\n \"Earns money - Slightly increases respect - Very slightly increases wanted level\",\r\n {baseRespect: 0.00005, baseWanted: 0.00001, baseMoney: 1,\r\n strWeight: 25, defWeight: 25, dexWeight: 25, agiWeight: 10, chaWeight: 15, difficulty: 1}),\r\n \"Deal Drugs\" : new GangMemberTask(\r\n \"Deal Drugs\",\r\n \"Assign this gang member to sell drugs.<br><br>\" +\r\n \"Earns money - Slightly increases respect - Slightly increases wanted level\",\r\n {baseRespect: 0.00008, baseWanted: 0.001, baseMoney: 4,\r\n agiWeight: 20, dexWeight: 20, chaWeight: 60, difficulty: 3}),\r\n \"Run a Con\" : new GangMemberTask(\r\n \"Run a Con\",\r\n \"Assign this gang member to run cons<br><br>\" +\r\n \"Earns money - Increases respect - Increases wanted level\",\r\n {baseRespect: 0.00015, baseWanted: 0.01, baseMoney: 10,\r\n strWeight: 5, defWeight: 5, agiWeight: 25, dexWeight: 25, chaWeight: 40, difficulty: 10}),\r\n \"Armed Robbery\" : new GangMemberTask(\r\n \"Armed Robbery\",\r\n \"Assign this gang member to commit armed robbery on stores, banks and armored cars<br><br>\" +\r\n \"Earns money - Increases respect - Increases wanted level\",\r\n {baseRespect: 0.00015, baseWanted: 0.05, baseMoney: 25,\r\n hackWeight: 20, strWeight: 15, defWeight: 15, agiWeight: 10, dexWeight: 20, chaWeight: 20,\r\n difficulty: 17}),\r\n \"Traffick Illegal Arms\" : new GangMemberTask(\r\n \"Traffick Illegal Arms\",\r\n \"Assign this gang member to traffick illegal arms<br><br>\" +\r\n \"Earns money - Increases respect - Increases wanted level\",\r\n {baseRespect: 0.0003, baseWanted: 0.1, baseMoney: 40,\r\n hackWeight: 15, strWeight: 20, defWeight: 20, dexWeight: 20, chaWeight: 75,\r\n difficulty: 25}),\r\n \"Threaten & Blackmail\" : new GangMemberTask(\r\n \"Threaten & Blackmail\",\r\n \"Assign this gang member to threaten and black mail high-profile targets<br><br>\" +\r\n \"Earns money - Slightly increases respect - Slightly increases wanted level\",\r\n {baseRespect: 0.0002, baseWanted: 0.05, baseMoney: 15,\r\n hackWeight: 25, strWeight: 25, dexWeight: 25, chaWeight: 25, difficulty: 28}),\r\n \"Terrorism\" : new GangMemberTask(\r\n \"Terrorism\",\r\n \"Assign this gang member to commit acts of terrorism<br><br>\" +\r\n \"Greatly increases respect - Greatly increases wanted level\",\r\n {baseRespect: 0.001, baseWanted: 1,\r\n hackWeight: 20, strWeight: 20, defWeight: 20,dexWeight: 20, chaWeight: 20,\r\n difficulty: 33}),\r\n \"Vigilante Justice\" : new GangMemberTask(\r\n \"Vigilante Justice\",\r\n \"Assign this gang member to be a vigilante and protect the city from criminals<br><br>\" +\r\n \"Decreases wanted level\",\r\n {baseWanted: -0.001,\r\n hackWeight: 20, strWeight: 20, defWeight: 20, dexWeight: 20, agiWeight:20,\r\n difficulty: 1}),\r\n \"Train Combat\" : new GangMemberTask(\r\n \"Train Combat\",\r\n \"Assign this gang member to increase their combat stats (str, def, dex, agi)\",\r\n {strWeight: 25, defWeight: 25, dexWeight: 25, agiWeight: 25, difficulty: 5}),\r\n \"Train Hacking\" : new GangMemberTask(\r\n \"Train Hacking\",\r\n \"Assign this gang member to train their hacking skills\",\r\n {hackWeight: 100, difficulty: 8}),\r\n \"Territory Warfare\" : new GangMemberTask(\r\n \"Territory Warfare\",\r\n \"Assign this gang member to engage in territorial warfare with other gangs. \" +\r\n \"Members assigned to this task will help increase your gang's territory \" +\r\n \"and will defend your territory from being taken.\",\r\n {hackWeight: 15, strWeight: 20, defWeight: 20, dexWeight: 20, agiWeight: 20,\r\n chaWeight: 5, difficulty: 3}),\r\n}\r\n\r\n\r\nfunction GangMemberUpgrade(name=\"\", desc=\"\", cost=0, type=\"w\") {\r\n this.name = name;\r\n this.desc = desc;\r\n this.cost = cost;\r\n this.type = type; //w, a, v, r\r\n}\r\n\r\n//Passes in a GangMember object\r\nGangMemberUpgrade.prototype.apply = function(member) {\r\n switch(this.name) {\r\n case \"Baseball Bat\":\r\n member.str_mult *= 1.05;\r\n member.def_mult *= 1.05;\r\n break;\r\n case \"Katana\":\r\n member.str_mult *= 1.1;\r\n member.def_mult *= 1.1;\r\n member.dex_mult *= 1.1;\r\n break;\r\n case \"Glock 18C\":\r\n member.str_mult *= 1.15;\r\n member.def_mult *= 1.15;\r\n member.dex_mult *= 1.15;\r\n member.agi_mult *= 1.15;\r\n break;\r\n case \"P90C\":\r\n member.str_mult *= 1.2;\r\n member.def_mult *= 1.2;\r\n member.agi_mult *= 1.1;\r\n break;\r\n case \"Steyr AUG\":\r\n member.str_mult *= 1.25;\r\n member.def_mult *= 1.25;\r\n break;\r\n case \"AK-47\":\r\n member.str_mult *= 1.5;\r\n member.def_mult *= 1.5;\r\n break;\r\n case \"M15A10 Assault Rifle\":\r\n member.str_mult *= 1.6;\r\n member.def_mult *= 1.6;\r\n break;\r\n case \"AWM Sniper Rifle\":\r\n member.str_mult *= 1.5;\r\n member.dex_mult *= 1.5;\r\n member.agi_mult *= 1.5;\r\n break;\r\n case \"Bulletproof Vest\":\r\n member.def_mult *= 1.05;\r\n break;\r\n case \"Full Body Armor\":\r\n member.def_mult *= 1.1;\r\n break;\r\n case \"Liquid Body Armor\":\r\n member.def_mult *= 1.25;\r\n member.agi_mult *= 1.25;\r\n break;\r\n case \"Graphene Plating Armor\":\r\n member.def_mult *= 1.5;\r\n break;\r\n case \"Ford Flex V20\":\r\n member.agi_mult *= 1.1;\r\n member.cha_mult *= 1.1;\r\n break;\r\n case \"ATX1070 Superbike\":\r\n member.agi_mult *= 1.15;\r\n member.cha_mult *= 1.15;\r\n break;\r\n case \"Mercedes-Benz S9001\":\r\n member.agi_mult *= 1.2;\r\n member.cha_mult *= 1.2;\r\n break;\r\n case \"White Ferrari\":\r\n member.agi_mult *= 1.25;\r\n member.cha_mult *= 1.25;\r\n break;\r\n case \"NUKE Rootkit\":\r\n member.hack_mult *= 1.1;\r\n break;\r\n case \"Soulstealer Rootkit\":\r\n member.hack_mult *= 1.2;\r\n break;\r\n case \"Demon Rootkit\":\r\n member.hack_mult *= 1.3;\r\n break;\r\n default:\r\n console.log(\"ERROR: Could not find this upgrade: \" + this.name);\r\n break;\r\n }\r\n}\r\n\r\nGangMemberUpgrade.prototype.toJSON = function() {\r\n\treturn Generic_toJSON(\"GangMemberUpgrade\", this);\r\n}\r\n\r\nGangMemberUpgrade.fromJSON = function(value) {\r\n\treturn Generic_fromJSON(GangMemberUpgrade, value.data);\r\n}\r\n\r\nReviver.constructors.GangMemberUpgrade = GangMemberUpgrade;\r\n\r\nlet GangMemberUpgrades = {\r\n \"Baseball Bat\" : new GangMemberUpgrade(\"Baseball Bat\",\r\n \"Increases strength and defense by 5%\", 1e6, \"w\"),\r\n \"Katana\" : new GangMemberUpgrade(\"Katana\",\r\n \"Increases strength, defense, and dexterity by 10%\", 12e6, \"w\"),\r\n \"Glock 18C\" : new GangMemberUpgrade(\"Glock 18C\",\r\n \"Increases strength, defense, dexterity, and agility by 15%\", 25e6, \"w\"),\r\n \"P90C\" : new GangMemberUpgrade(\"P90C\",\r\n \"Increases strength and defense by 20%. Increases agility by 10%\", 50e6, \"w\"),\r\n \"Steyr AUG\" : new GangMemberUpgrade(\"Steyr AUG\",\r\n \"Increases strength and defense by 25%\", 60e6, \"w\"),\r\n \"AK-47\" : new GangMemberUpgrade(\"AK-47\",\r\n \"Increases strength and defense by 50%\", 100e6, \"w\"),\r\n \"M15A10 Assault Rifle\" : new GangMemberUpgrade(\"M15A10 Assault Rifle\",\r\n \"Increases strength and defense by 60%\", 150e6, \"w\"),\r\n \"AWM Sniper Rifle\" : new GangMemberUpgrade(\"AWM Sniper Rifle\",\r\n \"Increases strength, dexterity, and agility by 50%\", 225e6, \"w\"),\r\n \"Bulletproof Vest\" : new GangMemberUpgrade(\"Bulletproof Vest\",\r\n \"Increases defense by 5%\", 2e6, \"a\"),\r\n \"Full Body Armor\" : new GangMemberUpgrade(\"Full Body Armor\",\r\n \"Increases defense by 10%\", 5e6, \"a\"),\r\n \"Liquid Body Armor\" : new GangMemberUpgrade(\"Liquid Body Armor\",\r\n \"Increases defense and agility by 25%\", 25e6, \"a\"),\r\n \"Graphene Plating Armor\" : new GangMemberUpgrade(\"Graphene Plating Armor\",\r\n \"Increases defense by 50%\", 40e6, \"a\"),\r\n \"Ford Flex V20\" : new GangMemberUpgrade(\"Ford Flex V20\",\r\n \"Increases agility and charisma by 10%\", 3e6, \"v\"),\r\n \"ATX1070 Superbike\" : new GangMemberUpgrade(\"ATX1070 Superbike\",\r\n \"Increases agility and charisma by 15%\", 9e6, \"v\"),\r\n \"Mercedes-Benz S9001\" : new GangMemberUpgrade(\"Mercedes-Benz S9001\",\r\n \"Increases agility and charisma by 20%\", 18e6, \"v\"),\r\n \"White Ferrari\" : new GangMemberUpgrade(\"White Ferrari\",\r\n \"Increases agility and charisma by 25%\", 30e6, \"v\"),\r\n \"NUKE Rootkit\" : new GangMemberUpgrade(\"NUKE Rootkit\",\r\n \"Increases hacking by 10%\", 5e6, \"r\"),\r\n \"Soulstealer Rootkit\" : new GangMemberUpgrade(\"Soulstealer Rootkit\",\r\n \"Increases hacking by 20%\", 15e6, \"r\"),\r\n \"Demon Rootkit\" : new GangMemberUpgrade(\"Demon Rootkit\",\r\n \"Increases hacking by 30%\", 50e6, \"r\"),\r\n}\r\n\r\n//Create a pop-up box that lets player purchase upgrades\r\nlet gangMemberUpgradeBoxOpened = false;\r\nfunction createGangMemberUpgradeBox(initialFilter=\"\") {\r\n var boxId = \"gang-member-upgrade-popup-box\";\r\n if (gangMemberUpgradeBoxOpened) {\r\n //Already opened, refreshing\r\n if (gangMemberUpgradeBoxElements == null || gangMemberUpgradeBox == null || gangMemberUpgradeBoxContent == null) {\r\n console.log(\"ERROR: Refreshing Gang member upgrade box throws error because required elements are null\");\r\n return;\r\n }\r\n\r\n for (var i = 1; i < gangMemberUpgradeBoxElements.length; ++i) {\r\n removeElement(gangMemberUpgradeBoxElements[i]);\r\n }\r\n gangMemberUpgradeBoxElements = [gangMemberUpgradeBoxFilter];\r\n\r\n var filter = gangMemberUpgradeBoxFilter.value.toString();\r\n for (var i = 0; i < Player.gang.members.length; ++i) {\r\n if (Player.gang.members[i].name.indexOf(filter) > -1 || Player.gang.members[i].task.name.indexOf(filter) > -1) {\r\n var newPanel = createGangMemberUpgradePanel(Player.gang.members[i]);\r\n gangMemberUpgradeBoxContent.appendChild(newPanel);\r\n gangMemberUpgradeBoxElements.push(newPanel);\r\n }\r\n }\r\n } else {\r\n //New popup\r\n gangMemberUpgradeBoxFilter = createElement(\"input\", {\r\n type:\"text\", placeholder:\"Filter gang members\",\r\n value:initialFilter,\r\n onkeyup:()=>{\r\n var filterValue = gangMemberUpgradeBoxFilter.value.toString();\r\n createGangMemberUpgradeBox(filterValue);\r\n }\r\n });\r\n\r\n gangMemberUpgradeBoxElements = [gangMemberUpgradeBoxFilter];\r\n\r\n var filter = gangMemberUpgradeBoxFilter.value.toString();\r\n for (var i = 0; i < Player.gang.members.length; ++i) {\r\n if (Player.gang.members[i].name.indexOf(filter) > -1 || Player.gang.members[i].task.name.indexOf(filter) > -1) {\r\n gangMemberUpgradeBoxElements.push(createGangMemberUpgradePanel(Player.gang.members[i]));\r\n }\r\n }\r\n\r\n gangMemberUpgradeBox = createPopup(boxId, gangMemberUpgradeBoxElements);\r\n gangMemberUpgradeBoxContent = document.getElementById(boxId + \"-content\");\r\n gangMemberUpgradeBoxOpened = true;\r\n }\r\n}\r\n\r\n//Create upgrade panels for each individual Gang Member\r\nfunction createGangMemberUpgradePanel(memberObj) {\r\n var container = createElement(\"div\", {\r\n border:\"1px solid white\",\r\n });\r\n\r\n var header = createElement(\"h1\", {\r\n innerText:memberObj.name + \" (\" + memberObj.task.name + \")\"\r\n });\r\n container.appendChild(header);\r\n\r\n var text = createElement(\"pre\", {\r\n fontSize:\"14px\", display: \"inline-block\", width:\"20%\",\r\n innerText:\r\n \"Hack: \" + memberObj.hack + \" (x\" + formatNumber(memberObj.hack_mult, 2) + \")\\n\" +\r\n \"Str: \" + memberObj.str + \" (x\" + formatNumber(memberObj.str_mult, 2) + \")\\n\" +\r\n \"Def: \" + memberObj.def + \" (x\" + formatNumber(memberObj.def_mult, 2) + \")\\n\" +\r\n \"Dex: \" + memberObj.dex + \" (x\" + formatNumber(memberObj.dex_mult, 2) + \")\\n\" +\r\n \"Agi: \" + memberObj.agi + \" (x\" + formatNumber(memberObj.agi_mult, 2) + \")\\n\" +\r\n \"Cha: \" + memberObj.cha + \" (x\" + formatNumber(memberObj.cha_mult, 2) + \")\\n\",\r\n });\r\n\r\n //Already purchased upgrades\r\n var ownedUpgradesElements = [];\r\n for (var i = 0; i < memberObj.upgrades.length; ++i) {\r\n var upg = GangMemberUpgrades[memberObj.upgrades[i]];\r\n if (upg == null) {\r\n console.log(\"ERR: Could not find this upgrade: \" + memberObj.upgrades[i]);\r\n continue;\r\n }\r\n var e = createElement(\"div\", {\r\n border:\"1px solid white\", innerText:memberObj.upgrades[i],\r\n margin:\"1px\", padding:\"1px\", tooltip:upg.desc, fontSize:\"12px\",\r\n });\r\n ownedUpgradesElements.push(e);\r\n }\r\n var ownedUpgrades = createElement(\"div\", {\r\n display:\"inline-block\", marginLeft:\"6px\", width:\"75%\", innerText:\"Purchased Upgrades:\",\r\n });\r\n for (var i = 0; i < ownedUpgradesElements.length; ++i) {\r\n ownedUpgrades.appendChild(ownedUpgradesElements[i]);\r\n }\r\n container.appendChild(text);\r\n container.appendChild(ownedUpgrades);\r\n container.appendChild(createElement(\"br\", {}));\r\n\r\n //Upgrade buttons. Only show upgrades that can be afforded\r\n var weaponUpgrades = [], armorUpgrades = [], vehicleUpgrades = [], rootkitUpgrades = [];\r\n for (var upgName in GangMemberUpgrades) {\r\n if (GangMemberUpgrades.hasOwnProperty(upgName)) {\r\n var upg = GangMemberUpgrades[upgName];\r\n if (Player.money.lt(upg.cost) || memberObj.upgrades.includes(upgName)) {continue;}\r\n switch (upg.type) {\r\n case \"w\":\r\n weaponUpgrades.push(upg);\r\n break;\r\n case \"a\":\r\n armorUpgrades.push(upg);\r\n break;\r\n case \"v\":\r\n vehicleUpgrades.push(upg);\r\n break;\r\n case \"r\":\r\n rootkitUpgrades.push(upg);\r\n break;\r\n default:\r\n console.log(\"ERROR: Invalid Gang Member Upgrade Type: \" + upg.type);\r\n }\r\n }\r\n }\r\n\r\n var weaponDiv = createElement(\"div\", {width:\"20%\", display:\"inline-block\",});\r\n var armorDiv = createElement(\"div\", {width:\"20%\", display:\"inline-block\",});\r\n var vehicleDiv = createElement(\"div\", {width:\"20%\", display:\"inline-block\",});\r\n var rootkitDiv = createElement(\"div\", {width:\"20%\", display:\"inline-block\",});\r\n var upgrades = [weaponUpgrades, armorUpgrades, vehicleUpgrades, rootkitUpgrades];\r\n var divs = [weaponDiv, armorDiv, vehicleDiv, rootkitDiv];\r\n\r\n for (var i = 0; i < upgrades.length; ++i) {\r\n var upgradeArray = upgrades[i];\r\n var div = divs[i];\r\n for (var j = 0; j < upgradeArray.length; ++j) {\r\n var upg = upgradeArray[j];\r\n (function (upg, div, memberObj) {\r\n div.appendChild(createElement(\"a\", {\r\n innerText:upg.name + \" - \" + numeral(upg.cost).format(\"$0.000a\"),\r\n class:\"a-link-button\", margin:\"2px\", padding:\"2px\", display:\"block\",\r\n fontSize:\"12px\",\r\n tooltip:upg.desc,\r\n clickListener:()=>{\r\n if (Player.money.lt(upg.cost)) {return false;}\r\n Player.loseMoney(upg.cost);\r\n memberObj.upgrades.push(upg.name);\r\n upg.apply(memberObj);\r\n var initFilterValue = gangMemberUpgradeBoxFilter.value.toString();\r\n createGangMemberUpgradeBox(initFilterValue);\r\n return false;\r\n }\r\n }));\r\n })(upg, div, memberObj);\r\n }\r\n }\r\n\r\n container.appendChild(weaponDiv);\r\n container.appendChild(armorDiv);\r\n container.appendChild(vehicleDiv);\r\n container.appendChild(rootkitDiv);\r\n return container;\r\n}\r\n\r\n//Gang DOM elements\r\nlet gangContentCreated = false,\r\n gangContainer = null, managementButton = null, territoryButton = null;\r\n\r\n//Subpages\r\nlet gangManagementSubpage = null, gangTerritorySubpage = null;\r\n\r\n//Gang Management Elements\r\nlet gangDesc = null, gangInfo = null,\r\n gangRecruitMemberButton = null, gangRecruitRequirementText = null,\r\n gangExpandAllButton = null, gangCollapseAllButton, gangMemberFilter = null,\r\n gangManageEquipmentButton = null,\r\n gangMemberList = null;\r\n\r\n//Gang Equipment Upgrade Elements\r\nlet gangMemberUpgradeBox = null, gangMemberUpgradeBoxContent = null,\r\n gangMemberUpgradeBoxFilter = null, gangMemberUpgradeBoxElements = null;\r\n\r\n\r\n//Gang Territory Elements\r\nlet gangTerritoryDescText = null, gangTerritoryInfoText = null;\r\n\r\nfunction displayGangContent() {\r\n if (!gangContentCreated || gangContainer == null) {\r\n gangContentCreated = true;\r\n\r\n //Create gang container\r\n gangContainer = createElement(\"div\", {\r\n id:\"gang-container\", class:\"generic-menupage-container\",\r\n });\r\n\r\n //Get variables\r\n var facName = Player.gang.facName,\r\n members = Player.gang.members,\r\n wanted = Player.gang.wanted,\r\n respect = Player.gang.respect;\r\n\r\n //Back button\r\n gangContainer.appendChild(createElement(\"a\", {\r\n class:\"a-link-button\", display:\"inline-block\", innerText:\"Back\",\r\n clickListener:()=>{\r\n Engine.loadFactionContent();\r\n displayFactionContent(facName);\r\n return false;\r\n }\r\n }));\r\n\r\n //Buttons to switch between panels\r\n managementButton = createElement(\"a\", {\r\n id:\"gang-management-subpage-button\", class:\"a-link-button-inactive\",\r\n display:\"inline-block\", innerHTML: \"Gang Management (1)\",\r\n clickListener:()=>{\r\n gangManagementSubpage.style.display = \"block\";\r\n gangTerritorySubpage.style.display = \"none\";\r\n managementButton.classList.toggle(\"a-link-button-inactive\");\r\n managementButton.classList.toggle(\"a-link-button\");\r\n territoryButton.classList.toggle(\"a-link-button-inactive\");\r\n territoryButton.classList.toggle(\"a-link-button\");\r\n updateGangContent();\r\n return false;\r\n }\r\n })\r\n territoryButton = createElement(\"a\", {\r\n id:\"gang-territory-subpage-button\", class:\"a-link-button\",\r\n display:\"inline-block\", innerHTML:\"Gang Territory (2)\",\r\n clickListener:()=>{\r\n gangManagementSubpage.style.display = \"none\";\r\n gangTerritorySubpage.style.display = \"block\";\r\n managementButton.classList.toggle(\"a-link-button-inactive\");\r\n managementButton.classList.toggle(\"a-link-button\");\r\n territoryButton.classList.toggle(\"a-link-button-inactive\");\r\n territoryButton.classList.toggle(\"a-link-button\");\r\n updateGangContent();\r\n return false;\r\n }\r\n });\r\n gangContainer.appendChild(managementButton);\r\n gangContainer.appendChild(territoryButton);\r\n\r\n //Subpage for managing gang members\r\n gangManagementSubpage = createElement(\"div\", {\r\n display:\"block\", id:\"gang-management-subpage\",\r\n });\r\n\r\n var lowerWantedTask = \"\";\r\n if (Player.gang.isHackingGang) {\r\n lowerWantedTask = \"Ethical Hacking\";\r\n } else {\r\n lowerWantedTask = \"Vigilante Justice\";\r\n }\r\n gangDesc = createElement(\"p\", {width:\"70%\",\r\n innerHTML:\r\n \"This page is used to manage your gang members and get an overview of your \" +\r\n \"gang's stats.<br><br>\" +\r\n \"If a gang member is not earning much money or respect, the task that you \" +\r\n \"have assigned to that member might be too difficult. Consider training that \" +\r\n \"member's stats or choosing an easier task. The tasks closer to the \" +\r\n \"top of the dropdown list are generally easier. Alternatively, the gang member's \" +\r\n \"low production might be due to the fact that your wanted level is too high. \" +\r\n \"Consider assigning a few members to the '\" + lowerWantedTask + \"' \" +\r\n \"task to lower your wanted level. <br><br>\" +\r\n \"Installing Augmentations does NOT reset your progress with your Gang. \" +\r\n \"Furthermore, after installing Augmentations, you will \" +\r\n \"automatically be a member of whatever Faction you created your gang with.<br><br>\"\r\n });\r\n gangManagementSubpage.appendChild(gangDesc);\r\n\r\n gangInfo = createElement(\"p\", {id:\"gang-info\", width:\"70%\"});\r\n gangManagementSubpage.appendChild(gangInfo);\r\n\r\n gangRecruitMemberButton = createElement(\"a\", {\r\n id:\"gang-management-recruit-member-btn\", class:\"a-link-button-inactive\",\r\n innerHTML:\"Recruit Gang Member\", display:\"inline-block\", margin:\"10px\",\r\n clickListener:()=>{\r\n var yesBtn = yesNoTxtInpBoxGetYesButton(), noBtn = yesNoTxtInpBoxGetNoButton();\r\n yesBtn.innerHTML = \"Recruit Gang Member\";\r\n noBtn.innerHTML = \"Cancel\";\r\n yesBtn.addEventListener(\"click\", ()=>{\r\n var name = yesNoTxtInpBoxGetInput();\r\n if (name === \"\") {\r\n dialogBoxCreate(\"You must enter a name for your Gang member!\");\r\n } else {\r\n for (var i = 0; i < Player.gang.members.length; ++i) {\r\n if (name == Player.gang.members[i].name) {\r\n dialogBoxCreate(\"You already have a gang member with this name!\");\r\n return false;\r\n }\r\n }\r\n var member = new GangMember(name);\r\n Player.gang.members.push(member);\r\n createGangMemberDisplayElement(member);\r\n updateGangContent();\r\n }\r\n yesNoTxtInpBoxClose();\r\n });\r\n noBtn.addEventListener(\"click\", ()=>{\r\n yesNoTxtInpBoxClose();\r\n });\r\n yesNoTxtInpBoxCreate(\"Please enter a name for your new Gang member:\");\r\n return false;\r\n }\r\n });\r\n gangManagementSubpage.appendChild(gangRecruitMemberButton);\r\n\r\n //Text for how much reputation is required for recruiting next memberList\r\n gangRecruitRequirementText = createElement(\"p\", {color:\"red\", id:\"gang-recruit-requirement-text\"});\r\n gangManagementSubpage.appendChild(gangRecruitRequirementText);\r\n\r\n //Gang Member List management buttons (Expand/Collapse All, select a single member)\r\n gangManagementSubpage.appendChild(createElement(\"br\", {}));\r\n gangExpandAllButton = createElement(\"a\", {\r\n class:\"a-link-button\", display:\"inline-block\",\r\n innerHTML:\"Expand All\",\r\n clickListener:()=>{\r\n var allHeaders = gangManagementSubpage.getElementsByClassName(\"accordion-header\");\r\n for (var i = 0; i < allHeaders.length; ++i) {\r\n var hdr = allHeaders[i];\r\n if (!hdr.classList.contains(\"active\")) {\r\n hdr.click();\r\n }\r\n }\r\n return false;\r\n }\r\n });\r\n gangCollapseAllButton = createElement(\"a\", {\r\n class:\"a-link-button\", display:\"inline-block\",\r\n innerHTML:\"Collapse All\",\r\n clickListener:()=>{\r\n var allHeaders = gangManagementSubpage.getElementsByClassName(\"accordion-header\");\r\n for (var i = 0; i < allHeaders.length; ++i) {\r\n var hdr = allHeaders[i];\r\n if (hdr.classList.contains(\"active\")) {\r\n hdr.click();\r\n }\r\n }\r\n return false;\r\n }\r\n });\r\n gangMemberFilter = createElement(\"input\", {\r\n type:\"text\", placeholder:\"Filter gang members\", margin:\"5px\", padding:\"5px\",\r\n onkeyup:()=>{\r\n displayGangMemberList();\r\n }\r\n });\r\n gangManageEquipmentButton = createElement(\"a\", {\r\n class:\"a-link-button\", display:\"inline-block\",\r\n innerHTML:\"Manage Equipment\",\r\n clickListener:()=>{\r\n createGangMemberUpgradeBox();\r\n }\r\n });\r\n gangManagementSubpage.appendChild(gangExpandAllButton);\r\n gangManagementSubpage.appendChild(gangCollapseAllButton);\r\n gangManagementSubpage.appendChild(gangMemberFilter);\r\n gangManagementSubpage.appendChild(gangManageEquipmentButton);\r\n\r\n //Gang Member list\r\n gangMemberList = createElement(\"ul\", {id:\"gang-member-list\"});\r\n displayGangMemberList();\r\n gangManagementSubpage.appendChild(gangMemberList);\r\n\r\n //Subpage for seeing gang territory information\r\n gangTerritorySubpage = createElement(\"div\", {\r\n id:\"gang-territory-subpage\", display:\"none\"\r\n });\r\n\r\n //Info text for territory page\r\n gangTerritoryDescText = createElement(\"p\", {\r\n width:\"70%\",\r\n innerHTML:\"This page shows how much territory your Gang controls. This statistic is listed as a percentage, \" +\r\n \"which represents how much of the total territory you control.<br><br>\" +\r\n \"Territory gain and loss is processed automatically and is updated every ~30 seconds. Your chances \" +\r\n \"to gain and lose territory depend on your Gang's power, which is listed in the display below. \" +\r\n \"Your gang's power is determined by the stats of all Gang members you have assigned to the \" +\r\n \"'Territory Warfare' task. Gang members that are not assigned to this task do not contribute to \" +\r\n \"your Gang's power.<br><br>\" +\r\n \"The amount of territory you have affects all aspects of your Gang members' production, including \" +\r\n \"money, respect, and wanted level. It is very beneficial to have high territory control.<br><br>\"\r\n });\r\n gangTerritorySubpage.appendChild(gangTerritoryDescText);\r\n\r\n var territoryBorder = createElement(\"fieldset\", {width:\"50%\", display:\"inline-block\"});\r\n\r\n gangTerritoryInfoText = createElement(\"p\", {id:\"gang-territory-info\"});\r\n\r\n territoryBorder.appendChild(gangTerritoryInfoText);\r\n gangTerritorySubpage.appendChild(territoryBorder);\r\n\r\n gangContainer.appendChild(gangTerritorySubpage);\r\n gangContainer.appendChild(gangManagementSubpage);\r\n document.getElementById(\"entire-game-container\").appendChild(gangContainer);\r\n }\r\n gangContainer.style.display = \"block\";\r\n updateGangContent();\r\n}\r\n\r\nfunction displayGangMemberList() {\r\n removeChildrenFromElement(gangMemberList);\r\n var members = Player.gang.members;\r\n var filter = gangMemberFilter.value.toString();\r\n for (var i = 0; i < members.length; ++i) {\r\n if (members[i].name.indexOf(filter) > -1 || members[i].task.name.indexOf(filter) > -1) {\r\n createGangMemberDisplayElement(members[i]);\r\n }\r\n }\r\n //setGangMemberClickHandlers(); //Set buttons to toggle the gang member info panels\r\n}\r\n\r\nfunction updateGangContent() {\r\n if (!gangContentCreated || !Player.inGang()) {return;}\r\n\r\n if(gangTerritorySubpage.style.display === \"block\") {\r\n //Update territory information\r\n gangTerritoryInfoText.innerHTML = \"\";\r\n for (var gangname in AllGangs) {\r\n if (AllGangs.hasOwnProperty(gangname)) {\r\n var gangTerritoryInfo = AllGangs[gangname];\r\n let territory = gangTerritoryInfo.territory*100;\r\n\r\n //Fix some rounding issues graphically\r\n let displayNumber;\r\n if (territory <= 0) {\r\n displayNumber = formatNumber(0, 2);\r\n } else if (territory >= 100) {\r\n displayNumber = formatNumber(100, 2);\r\n } else {\r\n displayNumber = formatNumber(territory, 2);\r\n }\r\n\r\n if (gangname == Player.gang.facName) {\r\n gangTerritoryInfoText.innerHTML += (\"<b>\" + gangname + \"</b><br>(Power: \" + formatNumber(gangTerritoryInfo.power, 6) + \"): \" +\r\n displayNumber + \"%<br><br>\");\r\n } else {\r\n gangTerritoryInfoText.innerHTML += (gangname + \"<br>(Power: \" + formatNumber(gangTerritoryInfo.power, 6) + \"): \" +\r\n displayNumber + \"%<br><br>\");\r\n }\r\n }\r\n }\r\n } else {\r\n //Update information for overall gang\r\n if (gangInfo instanceof Element) {\r\n var faction = Factions[Player.gang.facName];\r\n var rep;\r\n if (!(faction instanceof Faction)) {\r\n rep = \"ERROR\";\r\n } else {\r\n rep = faction.playerReputation;\r\n }\r\n removeChildrenFromElement(gangInfo);\r\n gangInfo.appendChild(createElement(\"p\", { //Respect\r\n display:\"inline-block\",\r\n innerText:\"Respect: \" + formatNumber(Player.gang.respect, 6) +\r\n \" (\" + formatNumber(5*Player.gang.respectGainRate, 6) + \" / sec)\",\r\n tooltip:\"Represents the amount of respect your gang has from other gangs and criminal \" +\r\n \"organizations. Your respect affects the amount of money \" +\r\n \"your gang members will earn, and also determines how much \" +\r\n \"reputation you are earning with your gang's corresponding Faction.\"\r\n }));\r\n gangInfo.appendChild(createElement(\"br\", {}));\r\n\r\n gangInfo.appendChild(createElement(\"p\", { //Wanted level\r\n display:\"inline-block\",\r\n innerText:\"Wanted Level: \" + formatNumber(Player.gang.wanted, 6) +\r\n \" (\" + formatNumber(5*Player.gang.wantedGainRate, 6) + \" / sec)\",\r\n tooltip:\"Represents how much the gang is wanted by law enforcement. The higher \" +\r\n \"your gang's wanted level, the harder it will be for your gang members \" +\r\n \"to make money and earn respect. Note that the minimum wanted level is 1.\"\r\n }));\r\n gangInfo.appendChild(createElement(\"br\", {}));\r\n\r\n var wantedPenalty = (Player.gang.respect) / (Player.gang.respect + Player.gang.wanted);\r\n wantedPenalty = (1 - wantedPenalty) * 100;\r\n gangInfo.appendChild(createElement(\"p\", { //Wanted Level multiplier\r\n display:\"inline-block\",\r\n innerText:\"Wanted Level Penalty: -\" + formatNumber(wantedPenalty, 2) + \"%\",\r\n tooltip:\"Penalty for respect and money gain rates due to Wanted Level\"\r\n }));\r\n gangInfo.appendChild(createElement(\"br\", {}));\r\n\r\n gangInfo.appendChild(createElement(\"p\", { //Money gain rate\r\n display:\"inline-block\",\r\n innerText:\"Money gain rate: $\" + formatNumber(5*Player.gang.moneyGainRate, 2) +\r\n \" / sec\",\r\n }));\r\n gangInfo.appendChild(createElement(\"br\", {}));\r\n\r\n //Fix some rounding issues graphically\r\n var territoryMult = AllGangs[Player.gang.facName].territory * 100;\r\n let displayNumber;\r\n if (territoryMult <= 0) {\r\n displayNumber = formatNumber(0, 2);\r\n } else if (territoryMult >= 100) {\r\n displayNumber = formatNumber(100, 2);\r\n } else {\r\n displayNumber = formatNumber(territoryMult, 2);\r\n }\r\n gangInfo.appendChild(createElement(\"p\", { //Territory multiplier\r\n display:\"inline-block\",\r\n innerText:\"Territory: \" + formatNumber(displayNumber, 3) + \"%\",\r\n tooltip:\"The percentage of total territory your Gang controls\"\r\n }));\r\n gangInfo.appendChild(createElement(\"br\", {}));\r\n\r\n gangInfo.appendChild(createElement(\"p\", { //Faction reputation\r\n display:\"inline-block\",\r\n innerText:\"Faction reputation: \" + formatNumber(rep, 3)\r\n }));\r\n gangInfo.appendChild(createElement(\"br\", {}));\r\n } else {\r\n console.log(\"ERROR: gang-info DOM element DNE\");\r\n }\r\n\r\n //Toggle the 'Recruit member button' if valid\r\n var numMembers = Player.gang.members.length;\r\n var repCost = 0;\r\n if (numMembers > 0) {\r\n var repCost = Math.pow(CONSTANTS.GangRecruitCostMultiplier, numMembers);\r\n }\r\n var faction = Factions[Player.gang.facName];\r\n if (faction == null) {\r\n dialogBoxCreate(\"Could not find your gang's faction. This is probably a bug please report to dev\");\r\n return;\r\n }\r\n var btn = gangRecruitMemberButton;\r\n if (numMembers >= CONSTANTS.MaximumGangMembers) {\r\n btn.className = \"a-link-button-inactive\";\r\n gangRecruitRequirementText.style.display = \"block\";\r\n gangRecruitRequirementText.innerHTML =\r\n \"You have reached the maximum amount of gang members\";\r\n } else if (faction.playerReputation >= repCost) {\r\n btn.className = \"a-link-button\";\r\n gangRecruitRequirementText.style.display = \"none\";\r\n } else {\r\n btn.className = \"a-link-button-inactive\";\r\n gangRecruitRequirementText.style.display = \"block\";\r\n gangRecruitRequirementText.innerHTML =\r\n formatNumber(repCost, 2) + \" Faction reputation needed to recruit next member\";\r\n }\r\n\r\n //Update information for each gang member\r\n for (var i = 0; i < Player.gang.members.length; ++i) {\r\n updateGangMemberDisplayElement(Player.gang.members[i]);\r\n }\r\n }\r\n}\r\n\r\n//Takes in a GangMember object\r\nfunction createGangMemberDisplayElement(memberObj) {\r\n if (!gangContentCreated || !Player.inGang()) {return;}\r\n var name = memberObj.name;\r\n\r\n var accordion = createAccordionElement({\r\n id:name + \"gang-member\",\r\n hdrText:name,\r\n });\r\n var li = accordion[0];\r\n var hdr = accordion[1];\r\n var gangMemberDiv = accordion[2];\r\n\r\n //Gang member content divided into 3 panels:\r\n //Stats Panel\r\n var statsDiv = createElement(\"div\", {\r\n id: name + \"gang-member-stats\", class: \"gang-member-info-div\",\r\n width:\"30%\", display:\"inline\"\r\n });\r\n var statsP = createElement(\"p\", {\r\n id:name + \"gang-member-stats-text\", display:\"inline\"\r\n });\r\n\r\n statsDiv.appendChild(statsP);\r\n //statsDiv.appendChild(upgradeButton);\r\n\r\n //Panel for Selecting task and show respect/wanted gain\r\n var taskDiv = createElement(\"div\", {\r\n id: name + \"gang-member-task\", class:\"gang-member-info-div\",\r\n width:\"30%\", display:\"inline\"\r\n });\r\n var taskSelector = createElement(\"select\", {\r\n color:\"white\", backgroundColor:\"black\",\r\n id:name + \"gang-member-task-selector\"\r\n });\r\n\r\n var tasks = null;\r\n if (Player.gang.isHackingGang) {\r\n tasks = [\"---\", \"Ransomware\", \"Phishing\", \"Identity Theft\", \"DDoS Attacks\",\r\n \"Plant Virus\", \"Fraud & Counterfeiting\",\"Money Laundering\",\r\n \"Cyberterrorism\", \"Ethical Hacking\", \"Train Combat\",\r\n \"Train Hacking\", \"Territory Warfare\"];\r\n } else {\r\n tasks = [\"---\", \"Mug People\", \"Deal Drugs\", \"Run a Con\", \"Armed Robbery\",\r\n \"Traffick Illegal Arms\", \"Threaten & Blackmail\",\r\n \"Terrorism\", \"Vigilante Justice\", \"Train Combat\",\r\n \"Train Hacking\", \"Territory Warfare\"];\r\n }\r\n for (var i = 0; i < tasks.length; ++i) {\r\n var option = document.createElement(\"option\");\r\n option.text = tasks[i];\r\n taskSelector.add(option);\r\n }\r\n taskSelector.addEventListener(\"change\", function() {\r\n var task = taskSelector.options[taskSelector.selectedIndex].text;\r\n memberObj.assignToTask(task);\r\n setGangMemberTaskDescription(memberObj, task);\r\n updateGangContent();\r\n });\r\n //Set initial task in selector element\r\n if (memberObj.task instanceof GangMemberTask) {\r\n var taskName = memberObj.task.name;\r\n var taskIndex = 0;\r\n for (let i = 0; i < tasks.length; ++i) {\r\n if (taskName == tasks[i]) {\r\n taskIndex = i;\r\n break;\r\n }\r\n }\r\n taskSelector.selectedIndex = taskIndex;\r\n }\r\n\r\n var gainInfo = createElement(\"p\", {id:name + \"gang-member-gain-info\"});\r\n taskDiv.appendChild(taskSelector);\r\n taskDiv.appendChild(gainInfo);\r\n\r\n //Panel for Description of task\r\n var taskDescDiv = createElement(\"div\", {\r\n id:name + \"gang-member-task-desc\", class:\"gang-member-info-div\",\r\n width:\"30%\", display:\"inline\"\r\n });\r\n\r\n var taskDescP = createElement(\"p\", {id: name + \"gang-member-task-description\", display:\"inline\"});\r\n taskDescDiv.appendChild(taskDescP);\r\n\r\n statsDiv.style.width = \"30%\";\r\n taskDiv.style.width = \"30%\";\r\n taskDescDiv.style.width = \"30%\";\r\n statsDiv.style.display = \"inline\";\r\n taskDiv.style.display = \"inline\";\r\n taskDescDiv.style.display = \"inline\";\r\n gangMemberDiv.appendChild(statsDiv);\r\n gangMemberDiv.appendChild(taskDiv);\r\n gangMemberDiv.appendChild(taskDescDiv);\r\n\r\n gangMemberList.appendChild(li);\r\n setGangMemberTaskDescription(memberObj, taskName); //Initialize description\r\n updateGangMemberDisplayElement(memberObj);\r\n}\r\n\r\nfunction updateGangMemberDisplayElement(memberObj) {\r\n if (!gangContentCreated || !Player.inGang()) {return;}\r\n var name = memberObj.name;\r\n\r\n //TODO Add upgrade information\r\n var stats = document.getElementById(name + \"gang-member-stats-text\");\r\n if (stats) {\r\n stats.innerHTML =\r\n \"Hacking: \" + formatNumber(memberObj.hack, 0) + \" (\" + numeral(memberObj.hack_exp).format('(0.00a)') + \" exp)<br>\" +\r\n \"Strength: \" + formatNumber(memberObj.str, 0) + \" (\" + numeral(memberObj.str_exp).format('(0.00a)') + \" exp)<br>\" +\r\n \"Defense: \" + formatNumber(memberObj.def, 0) + \" (\" + numeral(memberObj.def_exp).format('(0.00a)') + \" exp)<br>\" +\r\n \"Dexterity: \" + formatNumber(memberObj.dex, 0) + \" (\" + numeral(memberObj.dex_exp).format('(0.00a)') + \" exp)<br>\" +\r\n \"Agility: \" + formatNumber(memberObj.agi, 0) + \" (\" + numeral(memberObj.agi_exp).format('(0.00a)') + \" exp)<br>\" +\r\n \"Charisma: \" + formatNumber(memberObj.cha, 0) + \" (\" + numeral(memberObj.cha_exp).format('(0.00a)') + \" exp)<br>\";\r\n }\r\n\r\n var gainInfo = document.getElementById(name + \"gang-member-gain-info\");\r\n if (gainInfo) {\r\n gainInfo.innerHTML =\r\n \"Money: $\" + formatNumber(5*memberObj.calculateMoneyGain(), 2) + \" / sec<br>\" +\r\n \"Respect: \" + formatNumber(5*memberObj.calculateRespectGain(), 6) + \" / sec<br>\" +\r\n \"Wanted Level: \" + formatNumber(5*memberObj.calculateWantedLevelGain(), 6) + \" / sec<br>\";\r\n }\r\n}\r\n\r\nfunction setGangMemberTaskDescription(memberObj, taskName) {\r\n var name = memberObj.name;\r\n var taskDesc = document.getElementById(name + \"gang-member-task-description\");\r\n if (taskDesc) {\r\n var task = GangMemberTasks[taskName];\r\n if (task == null) {return;}\r\n var desc = task.desc;\r\n taskDesc.innerHTML = desc;\r\n }\r\n}\r\n\r\nfunction deleteGangDisplayContent() {\r\n if (gangContainer != null) {removeElementById(gangContainer.id);}\r\n\r\n gangContentCreated = false;\r\n gangContainer = null;\r\n managementButton = null;\r\n territoryButton = null;\r\n\r\n //Subpages\r\n gangManagementSubpage = null;\r\n gangTerritorySubpage = null;\r\n\r\n //Gang Management Elements\r\n gangDesc = null;\r\n gangInfo = null;\r\n gangRecruitMemberButton = null;\r\n gangRecruitRequirementText = null;\r\n gangExpandAllButton = null;\r\n gangCollapseAllButton = null;\r\n gangMemberFilter = null;\r\n gangManageEquipmentButton = null;\r\n gangMemberList = null;\r\n\r\n //Gang Equipment Upgrade Elements\r\n gangMemberUpgradeBox = null;\r\n gangMemberUpgradeBoxContent = null;\r\n gangMemberUpgradeBoxFilter = null;\r\n gangMemberUpgradeBoxElements = null;\r\n}\r\n\r\nexport {Gang, displayGangContent, updateGangContent, loadAllGangs, AllGangs,\r\n resetGangs, deleteGangDisplayContent};\r\n","import {BitNodeMultipliers} from \"./BitNode.js\";\r\nimport {CONSTANTS} from \"./Constants.js\";\r\nimport {Engine} from \"./engine.js\";\r\nimport {iTutorialSteps, iTutorialNextStep,\r\n iTutorialIsRunning, currITutorialStep} from \"./InteractiveTutorial.js\";\r\nimport {Player} from \"./Player.js\";\r\nimport {dialogBoxCreate} from \"../utils/DialogBox.js\";\r\nimport {clearEventListeners, createElement,\r\n getElementById} from \"../utils/HelperFunctions.js\";\r\nimport {Reviver, Generic_toJSON,\r\n Generic_fromJSON} from \"../utils/JSONReviver.js\";\r\nimport {formatNumber} from \"../utils/StringHelperFunctions.js\";\r\n\r\n/**\r\n * Overwrites the inner text of the specified HTML element if it is different from what currently exists.\r\n * @param {string} elementId The HTML ID to find the first instance of.\r\n * @param {string} text The inner text that should be set.\r\n */\r\nfunction updateText(elementId, text) {\r\n var el = getElementById(elementId);\r\n if (el.innerText != text) {\r\n el.innerText = text;\r\n }\r\n};\r\n\r\n/* HacknetNode.js */\r\nfunction hacknetNodesInit() {\r\n var performMapping = function(x) {\r\n getElementById(\"hacknet-nodes-\" + x.id + \"-multiplier\")\r\n .addEventListener(\"click\", function() {\r\n hacknetNodePurchaseMultiplier = x.multiplier;\r\n updateHacknetNodesMultiplierButtons();\r\n updateHacknetNodesContent();\r\n return false;\r\n });\r\n };\r\n\r\n var mappings = [\r\n { id: \"1x\", multiplier: 1 },\r\n { id: \"5x\", multiplier: 5 },\r\n { id: \"10x\", multiplier: 10 },\r\n { id: \"max\", multiplier: 0 }\r\n ];\r\n for (var elem of mappings) {\r\n // Encapsulate in a function so that the appropriate scope is kept in the click handler.\r\n performMapping(elem);\r\n }\r\n}\r\n\r\ndocument.addEventListener(\"DOMContentLoaded\", hacknetNodesInit, false);\r\n\r\nfunction HacknetNode(name) {\r\n this.level = 1;\r\n this.ram = 1; //GB\r\n this.cores = 1;\r\n\r\n this.name = name;\r\n\r\n this.totalMoneyGenerated = 0;\r\n this.onlineTimeSeconds = 0;\r\n\r\n this.moneyGainRatePerSecond = 0;\r\n}\r\n\r\n\r\nHacknetNode.prototype.updateMoneyGainRate = function() {\r\n //How much extra $/s is gained per level\r\n var gainPerLevel = CONSTANTS.HacknetNodeMoneyGainPerLevel;\r\n\r\n this.moneyGainRatePerSecond = (this.level * gainPerLevel) *\r\n Math.pow(1.035, this.ram-1) *\r\n ((this.cores + 5) / 6) *\r\n Player.hacknet_node_money_mult *\r\n BitNodeMultipliers.HacknetNodeMoney;\r\n if (isNaN(this.moneyGainRatePerSecond)) {\r\n this.moneyGainRatePerSecond = 0;\r\n dialogBoxCreate(\"Error in calculating Hacknet Node production. Please report to game developer\");\r\n }\r\n\r\n updateTotalHacknetProduction();\r\n}\r\n\r\nHacknetNode.prototype.calculateLevelUpgradeCost = function(levels=1) {\r\n levels = Math.round(levels);\r\n if (isNaN(levels) || levels < 1) {\r\n return 0;\r\n }\r\n\r\n var mult = CONSTANTS.HacknetNodeUpgradeLevelMult;\r\n var totalMultiplier = 0; //Summed\r\n var currLevel = this.level;\r\n for (var i = 0; i < levels; ++i) {\r\n totalMultiplier += Math.pow(mult, currLevel);\r\n ++currLevel;\r\n }\r\n\r\n return CONSTANTS.BaseCostForHacknetNode / 2 * totalMultiplier * Player.hacknet_node_level_cost_mult;\r\n}\r\n\r\n//Wrapper function for Netscript\r\nHacknetNode.prototype.getLevelUpgradeCost = function(levels=1) {\r\n return this.calculateLevelUpgradeCost(levels);\r\n}\r\n\r\nHacknetNode.prototype.purchaseLevelUpgrade = function(levels=1) {\r\n levels = Math.round(levels);\r\n var cost = this.calculateLevelUpgradeCost(levels);\r\n if (isNaN(cost) || levels < 0) {\r\n return false;\r\n }\r\n\r\n if (this.level + levels > CONSTANTS.HacknetNodeMaxLevel) {\r\n var diff = Math.max(0, CONSTANTS.HacknetNodeMaxLevel - this.level);\r\n return this.purchaseLevelUpgrade(diff);\r\n }\r\n\r\n if (Player.money.lt(cost)) {\r\n return false;\r\n }\r\n\r\n Player.loseMoney(cost);\r\n this.level += levels;\r\n this.updateMoneyGainRate();\r\n return true;\r\n}\r\n\r\n//Wrapper function for Netscript\r\nHacknetNode.prototype.upgradeLevel = function(levels=1) {\r\n let res = this.purchaseLevelUpgrade(levels);\r\n createPlayerHacknetNodeWrappers();\r\n return res;\r\n}\r\n\r\nHacknetNode.prototype.calculateRamUpgradeCost = function() {\r\n var numUpgrades = Math.log2(this.ram);\r\n\r\n //Calculate cost\r\n //Base cost of RAM is 50k per 1GB, increased by some multiplier for each time RAM is upgraded\r\n var baseCost = this.ram * CONSTANTS.BaseCostFor1GBOfRamHacknetNode;\r\n var mult = Math.pow(CONSTANTS.HacknetNodeUpgradeRamMult, numUpgrades);\r\n return baseCost * mult * Player.hacknet_node_ram_cost_mult;\r\n}\r\n\r\n//Wrapper function for Netscript\r\nHacknetNode.prototype.getRamUpgradeCost = function() {\r\n return this.calculateRamUpgradeCost();\r\n}\r\n\r\nHacknetNode.prototype.purchaseRamUpgrade = function() {\r\n var cost = this.calculateRamUpgradeCost();\r\n if (isNaN(cost)) {\r\n return false;\r\n }\r\n\r\n if (Player.money.lt(cost)) {\r\n return false;\r\n }\r\n\r\n if (this.ram >= CONSTANTS.HacknetNodeMaxRam) {\r\n return false;\r\n }\r\n\r\n Player.loseMoney(cost);\r\n this.ram *= 2; //Ram is always doubled\r\n this.updateMoneyGainRate();\r\n return true;\r\n}\r\n\r\n//Wrapper function for Netscript\r\nHacknetNode.prototype.upgradeRam = function() {\r\n let res = this.purchaseRamUpgrade();\r\n createPlayerHacknetNodeWrappers();\r\n return res;\r\n}\r\n\r\nHacknetNode.prototype.calculateCoreUpgradeCost = function() {\r\n var coreBaseCost = CONSTANTS.BaseCostForHacknetNodeCore;\r\n var mult = CONSTANTS.HacknetNodeUpgradeCoreMult;\r\n return coreBaseCost * Math.pow(mult, this.cores - 1) * Player.hacknet_node_core_cost_mult;\r\n}\r\n\r\n//Wrapper function for Netscript\r\nHacknetNode.prototype.getCoreUpgradeCost = function() {\r\n let res = this.calculateCoreUpgradeCost();\r\n createPlayerHacknetNodeWrappers();\r\n return res;\r\n}\r\n\r\nHacknetNode.prototype.purchaseCoreUpgrade = function() {\r\n var cost = this.calculateCoreUpgradeCost();\r\n if (isNaN(cost)) {\r\n return false;\r\n }\r\n\r\n if (Player.money.lt(cost)) {\r\n return false;\r\n }\r\n\r\n if (this.cores >= CONSTANTS.HacknetNodeMaxCores) {\r\n return false;\r\n }\r\n\r\n Player.loseMoney(cost);\r\n ++this.cores;\r\n this.updateMoneyGainRate();\r\n return true;\r\n}\r\n\r\n//Wrapper function for Netscript\r\nHacknetNode.prototype.upgradeCore = function() {\r\n return this.purchaseCoreUpgrade();\r\n}\r\n\r\n/* Saving and loading HackNets */\r\nHacknetNode.prototype.toJSON = function() {\r\n return Generic_toJSON(\"HacknetNode\", this);\r\n}\r\n\r\nHacknetNode.fromJSON = function(value) {\r\n return Generic_fromJSON(HacknetNode, value.data);\r\n}\r\n\r\nReviver.constructors.HacknetNode = HacknetNode;\r\n\r\nvar HacknetNodeWrapper = function(hacknetNodeObj) {\r\n var _node = hacknetNodeObj;\r\n return {\r\n name : _node.name,\r\n level : _node.level,\r\n ram : _node.ram,\r\n cores : _node.cores,\r\n totalMoneyGenerated : _node.totalMoneyGenerated,\r\n onlineTimeSeconds : _node.onlineTimeSeconds,\r\n moneyGainRatePerSecond : _node.moneyGainRatePerSecond,\r\n upgradeLevel : function(n) {\r\n return _node.upgradeLevel(n);\r\n },\r\n upgradeRam : function() {\r\n return _node.upgradeRam();\r\n },\r\n upgradeCore : function() {\r\n return _node.upgradeCore();\r\n },\r\n getLevelUpgradeCost : function(n) {\r\n return _node.getLevelUpgradeCost(n);\r\n },\r\n getRamUpgradeCost : function() {\r\n return _node.getRamUpgradeCost();\r\n },\r\n getCoreUpgradeCost : function() {\r\n return _node.getCoreUpgradeCost();\r\n }\r\n }\r\n}\r\n\r\nfunction purchaseHacknet() {\r\n /* INTERACTIVE TUTORIAL */\r\n if (iTutorialIsRunning) {\r\n if (currITutorialStep == iTutorialSteps.HacknetNodesIntroduction) {\r\n iTutorialNextStep();\r\n } else {\r\n return;\r\n }\r\n }\r\n\r\n /* END INTERACTIVE TUTORIAL */\r\n\r\n var cost = getCostOfNextHacknetNode();\r\n if (isNaN(cost)) {\r\n throw new Error(\"Cost is NaN\");\r\n }\r\n\r\n if (Player.money.lt(cost)) {\r\n //dialogBoxCreate(\"You cannot afford to purchase a Hacknet Node!\");\r\n return false;\r\n }\r\n\r\n //Auto generate a name for the node for now...TODO\r\n var numOwned = Player.hacknetNodes.length;\r\n var name = \"hacknet-node-\" + numOwned;\r\n var node = new HacknetNode(name);\r\n node.updateMoneyGainRate();\r\n\r\n Player.loseMoney(cost);\r\n Player.hacknetNodes.push(node);\r\n\r\n if (Engine.currentPage === Engine.Page.HacknetNodes) {\r\n displayHacknetNodesContent();\r\n }\r\n createPlayerHacknetNodeWrappers();\r\n updateTotalHacknetProduction();\r\n return numOwned;\r\n}\r\n\r\n//Calculates the total production from all HacknetNodes\r\nfunction updateTotalHacknetProduction() {\r\n var total = 0;\r\n for (var i = 0; i < Player.hacknetNodes.length; ++i) {\r\n total += Player.hacknetNodes[i].moneyGainRatePerSecond;\r\n }\r\n Player.totalHacknetNodeProduction = total;\r\n}\r\n\r\nfunction getCostOfNextHacknetNode() {\r\n //Cost increases exponentially based on how many you own\r\n var numOwned = Player.hacknetNodes.length;\r\n var mult = CONSTANTS.HacknetNodePurchaseNextMult;\r\n return CONSTANTS.BaseCostForHacknetNode * Math.pow(mult, numOwned) * Player.hacknet_node_purchase_cost_mult;\r\n}\r\n\r\nvar hacknetNodePurchaseMultiplier = 1;\r\nfunction updateHacknetNodesMultiplierButtons() {\r\n var mult1x = document.getElementById(\"hacknet-nodes-1x-multiplier\");\r\n var mult5x = document.getElementById(\"hacknet-nodes-5x-multiplier\");\r\n var mult10x = document.getElementById(\"hacknet-nodes-10x-multiplier\");\r\n var multMax = document.getElementById(\"hacknet-nodes-max-multiplier\");\r\n mult1x.setAttribute(\"class\", \"a-link-button\");\r\n mult5x.setAttribute(\"class\", \"a-link-button\");\r\n mult10x.setAttribute(\"class\", \"a-link-button\");\r\n multMax.setAttribute(\"class\", \"a-link-button\");\r\n if (Player.hacknetNodes.length == 0) {\r\n mult1x.setAttribute(\"class\", \"a-link-button-inactive\");\r\n mult5x.setAttribute(\"class\", \"a-link-button-inactive\");\r\n mult10x.setAttribute(\"class\", \"a-link-button-inactive\");\r\n multMax.setAttribute(\"class\", \"a-link-button-inactive\");\r\n } else if (hacknetNodePurchaseMultiplier == 1) {\r\n mult1x.setAttribute(\"class\", \"a-link-button-inactive\");\r\n } else if (hacknetNodePurchaseMultiplier == 5) {\r\n mult5x.setAttribute(\"class\", \"a-link-button-inactive\");\r\n } else if (hacknetNodePurchaseMultiplier == 10) {\r\n mult10x.setAttribute(\"class\", \"a-link-button-inactive\");\r\n } else {\r\n multMax.setAttribute(\"class\", \"a-link-button-inactive\");\r\n }\r\n}\r\n\r\n//Calculate the maximum number of times the Player can afford to upgrade\r\n//a Hacknet Node's level\"\r\nfunction getMaxNumberLevelUpgrades(nodeObj) {\r\n if (Player.money.lt(nodeObj.calculateLevelUpgradeCost(1))) {\r\n return 0;\r\n }\r\n\r\n var min = 1;\r\n var max = CONSTANTS.HacknetNodeMaxLevel - 1;\r\n var levelsToMax = CONSTANTS.HacknetNodeMaxLevel - nodeObj.level;\r\n if (Player.money.gt(nodeObj.calculateLevelUpgradeCost(levelsToMax))) {\r\n return levelsToMax;\r\n }\r\n\r\n while (min <= max) {\r\n var curr = (min + max) / 2 | 0;\r\n if (curr != CONSTANTS.HacknetNodeMaxLevel &&\r\n Player.money.gt(nodeObj.calculateLevelUpgradeCost(curr)) &&\r\n Player.money.lt(nodeObj.calculateLevelUpgradeCost(curr + 1))) {\r\n return Math.min(levelsToMax, curr);\r\n } else if (Player.money.lt(nodeObj.calculateLevelUpgradeCost(curr))) {\r\n max = curr - 1;\r\n } else if (Player.money.gt(nodeObj.calculateLevelUpgradeCost(curr))) {\r\n min = curr + 1;\r\n } else {\r\n return Math.min(levelsToMax, curr);\r\n }\r\n }\r\n}\r\n\r\n//Creates Hacknet Node DOM elements when the page is opened\r\nfunction displayHacknetNodesContent() {\r\n //Update Hacknet Nodes button\r\n var newPurchaseButton = clearEventListeners(\"hacknet-nodes-purchase-button\");\r\n\r\n newPurchaseButton.addEventListener(\"click\", function() {\r\n purchaseHacknet();\r\n return false;\r\n });\r\n\r\n //Handle Purchase multiplier buttons\r\n updateHacknetNodesMultiplierButtons();\r\n\r\n //Remove all old hacknet Node DOM elements\r\n var hacknetNodesList = document.getElementById(\"hacknet-nodes-list\");\r\n while (hacknetNodesList.firstChild) {\r\n hacknetNodesList.removeChild(hacknetNodesList.firstChild);\r\n }\r\n\r\n //Then re-create them\r\n for (var i = 0; i < Player.hacknetNodes.length; ++i) {\r\n createHacknetNodeDomElement(Player.hacknetNodes[i]);\r\n }\r\n\r\n updateHacknetNodesContent();\r\n}\r\n\r\n//Update information on all Hacknet Node DOM elements\r\nfunction updateHacknetNodesContent() {\r\n //Set purchase button to inactive if not enough money, and update its price display\r\n var cost = getCostOfNextHacknetNode();\r\n var purchaseButton = getElementById(\"hacknet-nodes-purchase-button\");\r\n var formattedCost = formatNumber(cost, 2);\r\n\r\n updateText(\"hacknet-nodes-purchase-button\", \"Purchase Hacknet Node - $\" + formattedCost);\r\n\r\n if (Player.money.lt(cost)) {\r\n purchaseButton.setAttribute(\"class\", \"a-link-button-inactive\");\r\n } else {\r\n purchaseButton.setAttribute(\"class\", \"a-link-button\");\r\n }\r\n\r\n //Update player's money\r\n updateText(\"hacknet-nodes-player-money\", \"$\" + formatNumber(Player.money.toNumber(), 2));\r\n updateText(\"hacknet-nodes-total-production\", \"$\" + formatNumber(Player.totalHacknetNodeProduction, 2) + \" / second\");\r\n\r\n //Update information in each owned hacknet node\r\n for (var i = 0; i < Player.hacknetNodes.length; ++i) {\r\n updateHacknetNodeDomElement(Player.hacknetNodes[i]);\r\n }\r\n}\r\n\r\n//Creates a single Hacknet Node DOM element\r\nfunction createHacknetNodeDomElement(nodeObj) {\r\n var nodeName = nodeObj.name;\r\n\r\n var nodeLevelContainer = createElement(\"div\", {\r\n class: \"hacknet-node-level-container row\",\r\n innerHTML: \"<p>Level:</p><span class=\\\"text upgradable-info\\\" id=\\\"hacknet-node-level-\" + nodeName + \"\\\"></span>\"\r\n });\r\n\r\n var nodeRamContainer = createElement(\"div\", {\r\n class: \"hacknet-node-ram-container row\",\r\n innerHTML: \"<p>RAM:</p><span class=\\\"text upgradable-info\\\" id=\\\"hacknet-node-ram-\" + nodeName + \"\\\"></span>\"\r\n });\r\n\r\n var nodeCoresContainer = createElement(\"div\", {\r\n class: \"hacknet-node-cores-container row\",\r\n innerHTML: \"<p>Cores:</p><span class=\\\"text upgradable-info\\\" id=\\\"hacknet-node-cores-\" + nodeName + \"\\\"><span>\"\r\n })\r\n var containingDiv = createElement(\"div\", {\r\n class: \"hacknet-node-container\",\r\n innerHTML: \"<div class=\\\"hacknet-node-name-container row\\\">\" +\r\n \"<p>Node name:</p>\" +\r\n \"<span class=\\\"text\\\" id=\\\"hacknet-node-name-\" + nodeName + \"\\\"></span>\" +\r\n \"</div>\" + \r\n \"<div class=\\\"hacknet-node-production-container row\\\">\" +\r\n \"<p>Production:</p>\" +\r\n \"<span class=\\\"text\\\" id=\\\"hacknet-node-total-production-\" + nodeName + \"\\\"></span>\" +\r\n \"<span class=\\\"text\\\" id=\\\"hacknet-node-production-rate-\" + nodeName + \"\\\"></span>\" +\r\n \"</div>\"\r\n });\r\n containingDiv.appendChild(nodeLevelContainer);\r\n containingDiv.appendChild(nodeRamContainer);\r\n containingDiv.appendChild(nodeCoresContainer);\r\n\r\n var listItem = createElement(\"li\", {\r\n class: \"hacknet-node\"\r\n });\r\n listItem.appendChild(containingDiv);\r\n\r\n //Upgrade buttons\r\n nodeLevelContainer.appendChild(createElement(\"a\", {\r\n id: \"hacknet-node-upgrade-level-\" + nodeName,\r\n class: \"a-link-button-inactive\",\r\n clickListener: function() {\r\n var numUpgrades = hacknetNodePurchaseMultiplier;\r\n if (hacknetNodePurchaseMultiplier == 0) {\r\n numUpgrades = getMaxNumberLevelUpgrades(nodeObj);\r\n }\r\n nodeObj.purchaseLevelUpgrade(numUpgrades);\r\n updateHacknetNodesContent();\r\n return false;\r\n }\r\n }));\r\n\r\n nodeRamContainer.appendChild(createElement(\"a\", {\r\n id: \"hacknet-node-upgrade-ram-\" + nodeName,\r\n class: \"a-link-button-inactive\",\r\n clickListener: function() {\r\n nodeObj.purchaseRamUpgrade();\r\n updateHacknetNodesContent();\r\n return false;\r\n }\r\n }));\r\n\r\n nodeCoresContainer.appendChild(createElement(\"a\", {\r\n id: \"hacknet-node-upgrade-core-\" + nodeName,\r\n class: \"a-link-button-inactive\",\r\n clickListener: function() {\r\n nodeObj.purchaseCoreUpgrade();\r\n updateHacknetNodesContent();\r\n return false;\r\n }\r\n }));\r\n\r\n document.getElementById(\"hacknet-nodes-list\").appendChild(listItem);\r\n\r\n //Set the text and stuff inside the DOM element\r\n updateHacknetNodeDomElement(nodeObj);\r\n}\r\n\r\n//Updates information on a single hacknet node DOM element\r\nfunction updateHacknetNodeDomElement(nodeObj) {\r\n var nodeName = nodeObj.name;\r\n\r\n updateText(\"hacknet-node-name-\" + nodeName, nodeName);\r\n updateText(\"hacknet-node-total-production-\" + nodeName, \"$\" + formatNumber(nodeObj.totalMoneyGenerated, 2));\r\n updateText(\"hacknet-node-production-rate-\" + nodeName, \"($\" + formatNumber(nodeObj.moneyGainRatePerSecond, 2) + \" / second)\");\r\n updateText(\"hacknet-node-level-\" + nodeName, nodeObj.level);\r\n updateText(\"hacknet-node-ram-\" + nodeName, nodeObj.ram + \"GB\");\r\n updateText(\"hacknet-node-cores-\" + nodeName, nodeObj.cores);\r\n\r\n //Upgrade level\r\n var upgradeLevelButton = getElementById(\"hacknet-node-upgrade-level-\" + nodeName);\r\n\r\n if (nodeObj.level >= CONSTANTS.HacknetNodeMaxLevel) {\r\n updateText(\"hacknet-node-upgrade-level-\" + nodeName, \"MAX LEVEL\");\r\n upgradeLevelButton.setAttribute(\"class\", \"a-link-button-inactive\");\r\n } else {\r\n var multiplier = 0;\r\n if (hacknetNodePurchaseMultiplier == 0) {\r\n //Max\r\n multiplier = getMaxNumberLevelUpgrades(nodeObj);\r\n } else {\r\n var levelsToMax = CONSTANTS.HacknetNodeMaxLevel - nodeObj.level;\r\n multiplier = Math.min(levelsToMax, hacknetNodePurchaseMultiplier);\r\n }\r\n\r\n var upgradeLevelCost = nodeObj.calculateLevelUpgradeCost(multiplier);\r\n updateText(\"hacknet-node-upgrade-level-\" + nodeName, \"Upgrade x\" + multiplier + \" - $\" + formatNumber(upgradeLevelCost, 2))\r\n if (Player.money.lt(upgradeLevelCost)) {\r\n upgradeLevelButton.setAttribute(\"class\", \"a-link-button-inactive\");\r\n } else {\r\n upgradeLevelButton.setAttribute(\"class\", \"a-link-button\");\r\n }\r\n }\r\n\r\n //Upgrade RAM\r\n var upgradeRamButton = getElementById(\"hacknet-node-upgrade-ram-\" + nodeName);\r\n\r\n if (nodeObj.ram >= CONSTANTS.HacknetNodeMaxRam) {\r\n updateText(\"hacknet-node-upgrade-ram-\" + nodeName, \"MAX RAM\");\r\n upgradeRamButton.setAttribute(\"class\", \"a-link-button-inactive\");\r\n } else {\r\n var upgradeRamCost = nodeObj.calculateRamUpgradeCost();\r\n updateText(\"hacknet-node-upgrade-ram-\" + nodeName, \"Upgrade - $\" + formatNumber(upgradeRamCost, 2));\r\n if (Player.money.lt(upgradeRamCost)) {\r\n upgradeRamButton.setAttribute(\"class\", \"a-link-button-inactive\");\r\n } else {\r\n upgradeRamButton.setAttribute(\"class\", \"a-link-button\");\r\n }\r\n }\r\n\r\n //Upgrade Cores\r\n var upgradeCoreButton = getElementById(\"hacknet-node-upgrade-core-\" + nodeName);\r\n\r\n if (nodeObj.cores >= CONSTANTS.HacknetNodeMaxCores) {\r\n updateText(\"hacknet-node-upgrade-core-\" + nodeName, \"MAX CORES\");\r\n upgradeCoreButton.setAttribute(\"class\", \"a-link-button-inactive\");\r\n } else {\r\n var upgradeCoreCost = nodeObj.calculateCoreUpgradeCost();\r\n updateText(\"hacknet-node-upgrade-core-\" + nodeName, \"Upgrade - $\" + formatNumber(upgradeCoreCost, 2));\r\n if (Player.money.lt(upgradeCoreCost)) {\r\n upgradeCoreButton.setAttribute(\"class\", \"a-link-button-inactive\");\r\n } else {\r\n upgradeCoreButton.setAttribute(\"class\", \"a-link-button\");\r\n }\r\n }\r\n}\r\n\r\nfunction createPlayerHacknetNodeWrappers() {\r\n Player.hacknetNodeWrappers.length = Player.hacknetNodes.length;\r\n for (var i = 0; i < Player.hacknetNodes.length; ++i) {\r\n Player.hacknetNodeWrappers[i] = new HacknetNodeWrapper(Player.hacknetNodes[i]);\r\n }\r\n}\r\n\r\nfunction updatePlayerHacknetNodeWrappers() {\r\n if (Player.hacknetNodeWrappers.length !== Player.hacknetNodes.length) {\r\n return createPlayerHacknetNodeWrappers();\r\n }\r\n\r\n for (var i = 0; i < Player.hacknetNodeWrappers.length; ++i) {\r\n if (!(Player.hacknetNodeWrappers[i] instanceof HacknetNodeWrapper)) {\r\n return createPlayerHacknetNodeWrappers();\r\n }\r\n\r\n Player.hacknetNodeWrappers[i].level = Player.hacknetNodes[i].level;\r\n Player.hacknetNodeWrappers[i].ram = Player.hacknetNodes[i].ram;\r\n Player.hacknetNodeWrappers[i].cores = Player.hacknetNodes[i].cores;\r\n Player.hacknetNodeWrappers[i].totalMoneyGenerated = Player.hacknetNodes[i].totalMoneyGenerated;\r\n Player.hacknetNodeWrappers[i].onlineTimeSeconds = Player.hacknetNodes[i].onlineTimeSeconds;\r\n Player.hacknetNodeWrappers[i].moneyGainRatePerSecond = Player.hacknetNodes[i].moneyGainRatePerSecond;\r\n }\r\n}\r\n\r\nfunction processAllHacknetNodeEarnings(numCycles) {\r\n var total = 0;\r\n updatePlayerHacknetNodeWrappers();\r\n for (var i = 0; i < Player.hacknetNodes.length; ++i) {\r\n total += processSingleHacknetNodeEarnings(numCycles, Player.hacknetNodes[i]);\r\n }\r\n\r\n return total;\r\n}\r\n\r\nfunction processSingleHacknetNodeEarnings(numCycles, nodeObj) {\r\n var cyclesPerSecond = 1000 / Engine._idleSpeed;\r\n var earningPerCycle = nodeObj.moneyGainRatePerSecond / cyclesPerSecond;\r\n if (isNaN(earningPerCycle)) {\r\n console.error(\"Hacknet Node '\" + nodeObj.name + \"' Calculated earnings is NaN\");\r\n earningPerCycle = 0;\r\n }\r\n\r\n var totalEarnings = numCycles * earningPerCycle;\r\n nodeObj.totalMoneyGenerated += totalEarnings;\r\n nodeObj.onlineTimeSeconds += (numCycles * (Engine._idleSpeed / 1000));\r\n Player.gainMoney(totalEarnings);\r\n return totalEarnings;\r\n}\r\n\r\nfunction getHacknetNode(name) {\r\n for (var i = 0; i < Player.hacknetNodes.length; ++i) {\r\n if (Player.hacknetNodes[i].name == name) {\r\n return Player.hacknetNodes[i];\r\n }\r\n }\r\n\r\n return null;\r\n}\r\n\r\nexport {\r\n HacknetNode,\r\n createPlayerHacknetNodeWrappers,\r\n displayHacknetNodesContent,\r\n getCostOfNextHacknetNode,\r\n getHacknetNode,\r\n getMaxNumberLevelUpgrades,\r\n hacknetNodesInit,\r\n processAllHacknetNodeEarnings,\r\n purchaseHacknet,\r\n updateHacknetNodesContent,\r\n updateHacknetNodesMultiplierButtons,\r\n updateTotalHacknetProduction\r\n};\r\n","'use strict';\n\n/**\n * A worker that does nothing but passing chunks to the next one. This is like\n * a nodejs stream but with some differences. On the good side :\n * - it works on IE 6-9 without any issue / polyfill\n * - it weights less than the full dependencies bundled with browserify\n * - it forwards errors (no need to declare an error handler EVERYWHERE)\n *\n * A chunk is an object with 2 attributes : `meta` and `data`. The former is an\n * object containing anything (`percent` for example), see each worker for more\n * details. The latter is the real data (String, Uint8Array, etc).\n *\n * @constructor\n * @param {String} name the name of the stream (mainly used for debugging purposes)\n */\nfunction GenericWorker(name) {\n // the name of the worker\n this.name = name || \"default\";\n // an object containing metadata about the workers chain\n this.streamInfo = {};\n // an error which happened when the worker was paused\n this.generatedError = null;\n // an object containing metadata to be merged by this worker into the general metadata\n this.extraStreamInfo = {};\n // true if the stream is paused (and should not do anything), false otherwise\n this.isPaused = true;\n // true if the stream is finished (and should not do anything), false otherwise\n this.isFinished = false;\n // true if the stream is locked to prevent further structure updates (pipe), false otherwise\n this.isLocked = false;\n // the event listeners\n this._listeners = {\n 'data':[],\n 'end':[],\n 'error':[]\n };\n // the previous worker, if any\n this.previous = null;\n}\n\nGenericWorker.prototype = {\n /**\n * Push a chunk to the next workers.\n * @param {Object} chunk the chunk to push\n */\n push : function (chunk) {\n this.emit(\"data\", chunk);\n },\n /**\n * End the stream.\n * @return {Boolean} true if this call ended the worker, false otherwise.\n */\n end : function () {\n if (this.isFinished) {\n return false;\n }\n\n this.flush();\n try {\n this.emit(\"end\");\n this.cleanUp();\n this.isFinished = true;\n } catch (e) {\n this.emit(\"error\", e);\n }\n return true;\n },\n /**\n * End the stream with an error.\n * @param {Error} e the error which caused the premature end.\n * @return {Boolean} true if this call ended the worker with an error, false otherwise.\n */\n error : function (e) {\n if (this.isFinished) {\n return false;\n }\n\n if(this.isPaused) {\n this.generatedError = e;\n } else {\n this.isFinished = true;\n\n this.emit(\"error\", e);\n\n // in the workers chain exploded in the middle of the chain,\n // the error event will go downward but we also need to notify\n // workers upward that there has been an error.\n if(this.previous) {\n this.previous.error(e);\n }\n\n this.cleanUp();\n }\n return true;\n },\n /**\n * Add a callback on an event.\n * @param {String} name the name of the event (data, end, error)\n * @param {Function} listener the function to call when the event is triggered\n * @return {GenericWorker} the current object for chainability\n */\n on : function (name, listener) {\n this._listeners[name].push(listener);\n return this;\n },\n /**\n * Clean any references when a worker is ending.\n */\n cleanUp : function () {\n this.streamInfo = this.generatedError = this.extraStreamInfo = null;\n this._listeners = [];\n },\n /**\n * Trigger an event. This will call registered callback with the provided arg.\n * @param {String} name the name of the event (data, end, error)\n * @param {Object} arg the argument to call the callback with.\n */\n emit : function (name, arg) {\n if (this._listeners[name]) {\n for(var i = 0; i < this._listeners[name].length; i++) {\n this._listeners[name][i].call(this, arg);\n }\n }\n },\n /**\n * Chain a worker with an other.\n * @param {Worker} next the worker receiving events from the current one.\n * @return {worker} the next worker for chainability\n */\n pipe : function (next) {\n return next.registerPrevious(this);\n },\n /**\n * Same as `pipe` in the other direction.\n * Using an API with `pipe(next)` is very easy.\n * Implementing the API with the point of view of the next one registering\n * a source is easier, see the ZipFileWorker.\n * @param {Worker} previous the previous worker, sending events to this one\n * @return {Worker} the current worker for chainability\n */\n registerPrevious : function (previous) {\n if (this.isLocked) {\n throw new Error(\"The stream '\" + this + \"' has already been used.\");\n }\n\n // sharing the streamInfo...\n this.streamInfo = previous.streamInfo;\n // ... and adding our own bits\n this.mergeStreamInfo();\n this.previous = previous;\n var self = this;\n previous.on('data', function (chunk) {\n self.processChunk(chunk);\n });\n previous.on('end', function () {\n self.end();\n });\n previous.on('error', function (e) {\n self.error(e);\n });\n return this;\n },\n /**\n * Pause the stream so it doesn't send events anymore.\n * @return {Boolean} true if this call paused the worker, false otherwise.\n */\n pause : function () {\n if(this.isPaused || this.isFinished) {\n return false;\n }\n this.isPaused = true;\n\n if(this.previous) {\n this.previous.pause();\n }\n return true;\n },\n /**\n * Resume a paused stream.\n * @return {Boolean} true if this call resumed the worker, false otherwise.\n */\n resume : function () {\n if(!this.isPaused || this.isFinished) {\n return false;\n }\n this.isPaused = false;\n\n // if true, the worker tried to resume but failed\n var withError = false;\n if(this.generatedError) {\n this.error(this.generatedError);\n withError = true;\n }\n if(this.previous) {\n this.previous.resume();\n }\n\n return !withError;\n },\n /**\n * Flush any remaining bytes as the stream is ending.\n */\n flush : function () {},\n /**\n * Process a chunk. This is usually the method overridden.\n * @param {Object} chunk the chunk to process.\n */\n processChunk : function(chunk) {\n this.push(chunk);\n },\n /**\n * Add a key/value to be added in the workers chain streamInfo once activated.\n * @param {String} key the key to use\n * @param {Object} value the associated value\n * @return {Worker} the current worker for chainability\n */\n withStreamInfo : function (key, value) {\n this.extraStreamInfo[key] = value;\n this.mergeStreamInfo();\n return this;\n },\n /**\n * Merge this worker's streamInfo into the chain's streamInfo.\n */\n mergeStreamInfo : function () {\n for(var key in this.extraStreamInfo) {\n if (!this.extraStreamInfo.hasOwnProperty(key)) {\n continue;\n }\n this.streamInfo[key] = this.extraStreamInfo[key];\n }\n },\n\n /**\n * Lock the stream to prevent further updates on the workers chain.\n * After calling this method, all calls to pipe will fail.\n */\n lock: function () {\n if (this.isLocked) {\n throw new Error(\"The stream '\" + this + \"' has already been used.\");\n }\n this.isLocked = true;\n if (this.previous) {\n this.previous.lock();\n }\n },\n\n /**\n *\n * Pretty print the workers chain.\n */\n toString : function () {\n var me = \"Worker \" + this.name;\n if (this.previous) {\n return this.previous + \" -> \" + me;\n } else {\n return me;\n }\n }\n};\n\nmodule.exports = GenericWorker;\n","/*!\n * jQuery JavaScript Library v3.3.1\n * https://jquery.com/\n *\n * Includes Sizzle.js\n * https://sizzlejs.com/\n *\n * Copyright JS Foundation and other contributors\n * Released under the MIT license\n * https://jquery.org/license\n *\n * Date: 2018-01-20T17:24Z\n */\n( function( global, factory ) {\n\n\t\"use strict\";\n\n\tif ( typeof module === \"object\" && typeof module.exports === \"object\" ) {\n\n\t\t// For CommonJS and CommonJS-like environments where a proper `window`\n\t\t// is present, execute the factory and get jQuery.\n\t\t// For environments that do not have a `window` with a `document`\n\t\t// (such as Node.js), expose a factory as module.exports.\n\t\t// This accentuates the need for the creation of a real `window`.\n\t\t// e.g. var jQuery = require(\"jquery\")(window);\n\t\t// See ticket #14549 for more info.\n\t\tmodule.exports = global.document ?\n\t\t\tfactory( global, true ) :\n\t\t\tfunction( w ) {\n\t\t\t\tif ( !w.document ) {\n\t\t\t\t\tthrow new Error( \"jQuery requires a window with a document\" );\n\t\t\t\t}\n\t\t\t\treturn factory( w );\n\t\t\t};\n\t} else {\n\t\tfactory( global );\n\t}\n\n// Pass this if window is not defined yet\n} )( typeof window !== \"undefined\" ? window : this, function( window, noGlobal ) {\n\n// Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1\n// throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode\n// arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common\n// enough that all such attempts are guarded in a try block.\n\"use strict\";\n\nvar arr = [];\n\nvar document = window.document;\n\nvar getProto = Object.getPrototypeOf;\n\nvar slice = arr.slice;\n\nvar concat = arr.concat;\n\nvar push = arr.push;\n\nvar indexOf = arr.indexOf;\n\nvar class2type = {};\n\nvar toString = class2type.toString;\n\nvar hasOwn = class2type.hasOwnProperty;\n\nvar fnToString = hasOwn.toString;\n\nvar ObjectFunctionString = fnToString.call( Object );\n\nvar support = {};\n\nvar isFunction = function isFunction( obj ) {\n\n // Support: Chrome <=57, Firefox <=52\n // In some browsers, typeof returns \"function\" for HTML <object> elements\n // (i.e., `typeof document.createElement( \"object\" ) === \"function\"`).\n // We don't want to classify *any* DOM node as a function.\n return typeof obj === \"function\" && typeof obj.nodeType !== \"number\";\n };\n\n\nvar isWindow = function isWindow( obj ) {\n\t\treturn obj != null && obj === obj.window;\n\t};\n\n\n\n\n\tvar preservedScriptAttributes = {\n\t\ttype: true,\n\t\tsrc: true,\n\t\tnoModule: true\n\t};\n\n\tfunction DOMEval( code, doc, node ) {\n\t\tdoc = doc || document;\n\n\t\tvar i,\n\t\t\tscript = doc.createElement( \"script\" );\n\n\t\tscript.text = code;\n\t\tif ( node ) {\n\t\t\tfor ( i in preservedScriptAttributes ) {\n\t\t\t\tif ( node[ i ] ) {\n\t\t\t\t\tscript[ i ] = node[ i ];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tdoc.head.appendChild( script ).parentNode.removeChild( script );\n\t}\n\n\nfunction toType( obj ) {\n\tif ( obj == null ) {\n\t\treturn obj + \"\";\n\t}\n\n\t// Support: Android <=2.3 only (functionish RegExp)\n\treturn typeof obj === \"object\" || typeof obj === \"function\" ?\n\t\tclass2type[ toString.call( obj ) ] || \"object\" :\n\t\ttypeof obj;\n}\n/* global Symbol */\n// Defining this global in .eslintrc.json would create a danger of using the global\n// unguarded in another place, it seems safer to define global only for this module\n\n\n\nvar\n\tversion = \"3.3.1\",\n\n\t// Define a local copy of jQuery\n\tjQuery = function( selector, context ) {\n\n\t\t// The jQuery object is actually just the init constructor 'enhanced'\n\t\t// Need init if jQuery is called (just allow error to be thrown if not included)\n\t\treturn new jQuery.fn.init( selector, context );\n\t},\n\n\t// Support: Android <=4.0 only\n\t// Make sure we trim BOM and NBSP\n\trtrim = /^[\\s\\uFEFF\\xA0]+|[\\s\\uFEFF\\xA0]+$/g;\n\njQuery.fn = jQuery.prototype = {\n\n\t// The current version of jQuery being used\n\tjquery: version,\n\n\tconstructor: jQuery,\n\n\t// The default length of a jQuery object is 0\n\tlength: 0,\n\n\ttoArray: function() {\n\t\treturn slice.call( this );\n\t},\n\n\t// Get the Nth element in the matched element set OR\n\t// Get the whole matched element set as a clean array\n\tget: function( num ) {\n\n\t\t// Return all the elements in a clean array\n\t\tif ( num == null ) {\n\t\t\treturn slice.call( this );\n\t\t}\n\n\t\t// Return just the one element from the set\n\t\treturn num < 0 ? this[ num + this.length ] : this[ num ];\n\t},\n\n\t// Take an array of elements and push it onto the stack\n\t// (returning the new matched element set)\n\tpushStack: function( elems ) {\n\n\t\t// Build a new jQuery matched element set\n\t\tvar ret = jQuery.merge( this.constructor(), elems );\n\n\t\t// Add the old object onto the stack (as a reference)\n\t\tret.prevObject = this;\n\n\t\t// Return the newly-formed element set\n\t\treturn ret;\n\t},\n\n\t// Execute a callback for every element in the matched set.\n\teach: function( callback ) {\n\t\treturn jQuery.each( this, callback );\n\t},\n\n\tmap: function( callback ) {\n\t\treturn this.pushStack( jQuery.map( this, function( elem, i ) {\n\t\t\treturn callback.call( elem, i, elem );\n\t\t} ) );\n\t},\n\n\tslice: function() {\n\t\treturn this.pushStack( slice.apply( this, arguments ) );\n\t},\n\n\tfirst: function() {\n\t\treturn this.eq( 0 );\n\t},\n\n\tlast: function() {\n\t\treturn this.eq( -1 );\n\t},\n\n\teq: function( i ) {\n\t\tvar len = this.length,\n\t\t\tj = +i + ( i < 0 ? len : 0 );\n\t\treturn this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] );\n\t},\n\n\tend: function() {\n\t\treturn this.prevObject || this.constructor();\n\t},\n\n\t// For internal use only.\n\t// Behaves like an Array's method, not like a jQuery method.\n\tpush: push,\n\tsort: arr.sort,\n\tsplice: arr.splice\n};\n\njQuery.extend = jQuery.fn.extend = function() {\n\tvar options, name, src, copy, copyIsArray, clone,\n\t\ttarget = arguments[ 0 ] || {},\n\t\ti = 1,\n\t\tlength = arguments.length,\n\t\tdeep = false;\n\n\t// Handle a deep copy situation\n\tif ( typeof target === \"boolean\" ) {\n\t\tdeep = target;\n\n\t\t// Skip the boolean and the target\n\t\ttarget = arguments[ i ] || {};\n\t\ti++;\n\t}\n\n\t// Handle case when target is a string or something (possible in deep copy)\n\tif ( typeof target !== \"object\" && !isFunction( target ) ) {\n\t\ttarget = {};\n\t}\n\n\t// Extend jQuery itself if only one argument is passed\n\tif ( i === length ) {\n\t\ttarget = this;\n\t\ti--;\n\t}\n\n\tfor ( ; i < length; i++ ) {\n\n\t\t// Only deal with non-null/undefined values\n\t\tif ( ( options = arguments[ i ] ) != null ) {\n\n\t\t\t// Extend the base object\n\t\t\tfor ( name in options ) {\n\t\t\t\tsrc = target[ name ];\n\t\t\t\tcopy = options[ name ];\n\n\t\t\t\t// Prevent never-ending loop\n\t\t\t\tif ( target === copy ) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\t// Recurse if we're merging plain objects or arrays\n\t\t\t\tif ( deep && copy && ( jQuery.isPlainObject( copy ) ||\n\t\t\t\t\t( copyIsArray = Array.isArray( copy ) ) ) ) {\n\n\t\t\t\t\tif ( copyIsArray ) {\n\t\t\t\t\t\tcopyIsArray = false;\n\t\t\t\t\t\tclone = src && Array.isArray( src ) ? src : [];\n\n\t\t\t\t\t} else {\n\t\t\t\t\t\tclone = src && jQuery.isPlainObject( src ) ? src : {};\n\t\t\t\t\t}\n\n\t\t\t\t\t// Never move original objects, clone them\n\t\t\t\t\ttarget[ name ] = jQuery.extend( deep, clone, copy );\n\n\t\t\t\t// Don't bring in undefined values\n\t\t\t\t} else if ( copy !== undefined ) {\n\t\t\t\t\ttarget[ name ] = copy;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// Return the modified object\n\treturn target;\n};\n\njQuery.extend( {\n\n\t// Unique for each copy of jQuery on the page\n\texpando: \"jQuery\" + ( version + Math.random() ).replace( /\\D/g, \"\" ),\n\n\t// Assume jQuery is ready without the ready module\n\tisReady: true,\n\n\terror: function( msg ) {\n\t\tthrow new Error( msg );\n\t},\n\n\tnoop: function() {},\n\n\tisPlainObject: function( obj ) {\n\t\tvar proto, Ctor;\n\n\t\t// Detect obvious negatives\n\t\t// Use toString instead of jQuery.type to catch host objects\n\t\tif ( !obj || toString.call( obj ) !== \"[object Object]\" ) {\n\t\t\treturn false;\n\t\t}\n\n\t\tproto = getProto( obj );\n\n\t\t// Objects with no prototype (e.g., `Object.create( null )`) are plain\n\t\tif ( !proto ) {\n\t\t\treturn true;\n\t\t}\n\n\t\t// Objects with prototype are plain iff they were constructed by a global Object function\n\t\tCtor = hasOwn.call( proto, \"constructor\" ) && proto.constructor;\n\t\treturn typeof Ctor === \"function\" && fnToString.call( Ctor ) === ObjectFunctionString;\n\t},\n\n\tisEmptyObject: function( obj ) {\n\n\t\t/* eslint-disable no-unused-vars */\n\t\t// See https://github.com/eslint/eslint/issues/6125\n\t\tvar name;\n\n\t\tfor ( name in obj ) {\n\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t},\n\n\t// Evaluates a script in a global context\n\tglobalEval: function( code ) {\n\t\tDOMEval( code );\n\t},\n\n\teach: function( obj, callback ) {\n\t\tvar length, i = 0;\n\n\t\tif ( isArrayLike( obj ) ) {\n\t\t\tlength = obj.length;\n\t\t\tfor ( ; i < length; i++ ) {\n\t\t\t\tif ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tfor ( i in obj ) {\n\t\t\t\tif ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn obj;\n\t},\n\n\t// Support: Android <=4.0 only\n\ttrim: function( text ) {\n\t\treturn text == null ?\n\t\t\t\"\" :\n\t\t\t( text + \"\" ).replace( rtrim, \"\" );\n\t},\n\n\t// results is for internal usage only\n\tmakeArray: function( arr, results ) {\n\t\tvar ret = results || [];\n\n\t\tif ( arr != null ) {\n\t\t\tif ( isArrayLike( Object( arr ) ) ) {\n\t\t\t\tjQuery.merge( ret,\n\t\t\t\t\ttypeof arr === \"string\" ?\n\t\t\t\t\t[ arr ] : arr\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tpush.call( ret, arr );\n\t\t\t}\n\t\t}\n\n\t\treturn ret;\n\t},\n\n\tinArray: function( elem, arr, i ) {\n\t\treturn arr == null ? -1 : indexOf.call( arr, elem, i );\n\t},\n\n\t// Support: Android <=4.0 only, PhantomJS 1 only\n\t// push.apply(_, arraylike) throws on ancient WebKit\n\tmerge: function( first, second ) {\n\t\tvar len = +second.length,\n\t\t\tj = 0,\n\t\t\ti = first.length;\n\n\t\tfor ( ; j < len; j++ ) {\n\t\t\tfirst[ i++ ] = second[ j ];\n\t\t}\n\n\t\tfirst.length = i;\n\n\t\treturn first;\n\t},\n\n\tgrep: function( elems, callback, invert ) {\n\t\tvar callbackInverse,\n\t\t\tmatches = [],\n\t\t\ti = 0,\n\t\t\tlength = elems.length,\n\t\t\tcallbackExpect = !invert;\n\n\t\t// Go through the array, only saving the items\n\t\t// that pass the validator function\n\t\tfor ( ; i < length; i++ ) {\n\t\t\tcallbackInverse = !callback( elems[ i ], i );\n\t\t\tif ( callbackInverse !== callbackExpect ) {\n\t\t\t\tmatches.push( elems[ i ] );\n\t\t\t}\n\t\t}\n\n\t\treturn matches;\n\t},\n\n\t// arg is for internal usage only\n\tmap: function( elems, callback, arg ) {\n\t\tvar length, value,\n\t\t\ti = 0,\n\t\t\tret = [];\n\n\t\t// Go through the array, translating each of the items to their new values\n\t\tif ( isArrayLike( elems ) ) {\n\t\t\tlength = elems.length;\n\t\t\tfor ( ; i < length; i++ ) {\n\t\t\t\tvalue = callback( elems[ i ], i, arg );\n\n\t\t\t\tif ( value != null ) {\n\t\t\t\t\tret.push( value );\n\t\t\t\t}\n\t\t\t}\n\n\t\t// Go through every key on the object,\n\t\t} else {\n\t\t\tfor ( i in elems ) {\n\t\t\t\tvalue = callback( elems[ i ], i, arg );\n\n\t\t\t\tif ( value != null ) {\n\t\t\t\t\tret.push( value );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Flatten any nested arrays\n\t\treturn concat.apply( [], ret );\n\t},\n\n\t// A global GUID counter for objects\n\tguid: 1,\n\n\t// jQuery.support is not used in Core but other projects attach their\n\t// properties to it so it needs to exist.\n\tsupport: support\n} );\n\nif ( typeof Symbol === \"function\" ) {\n\tjQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ];\n}\n\n// Populate the class2type map\njQuery.each( \"Boolean Number String Function Array Date RegExp Object Error Symbol\".split( \" \" ),\nfunction( i, name ) {\n\tclass2type[ \"[object \" + name + \"]\" ] = name.toLowerCase();\n} );\n\nfunction isArrayLike( obj ) {\n\n\t// Support: real iOS 8.2 only (not reproducible in simulator)\n\t// `in` check used to prevent JIT error (gh-2145)\n\t// hasOwn isn't used here due to false negatives\n\t// regarding Nodelist length in IE\n\tvar length = !!obj && \"length\" in obj && obj.length,\n\t\ttype = toType( obj );\n\n\tif ( isFunction( obj ) || isWindow( obj ) ) {\n\t\treturn false;\n\t}\n\n\treturn type === \"array\" || length === 0 ||\n\t\ttypeof length === \"number\" && length > 0 && ( length - 1 ) in obj;\n}\nvar Sizzle =\n/*!\n * Sizzle CSS Selector Engine v2.3.3\n * https://sizzlejs.com/\n *\n * Copyright jQuery Foundation and other contributors\n * Released under the MIT license\n * http://jquery.org/license\n *\n * Date: 2016-08-08\n */\n(function( window ) {\n\nvar i,\n\tsupport,\n\tExpr,\n\tgetText,\n\tisXML,\n\ttokenize,\n\tcompile,\n\tselect,\n\toutermostContext,\n\tsortInput,\n\thasDuplicate,\n\n\t// Local document vars\n\tsetDocument,\n\tdocument,\n\tdocElem,\n\tdocumentIsHTML,\n\trbuggyQSA,\n\trbuggyMatches,\n\tmatches,\n\tcontains,\n\n\t// Instance-specific data\n\texpando = \"sizzle\" + 1 * new Date(),\n\tpreferredDoc = window.document,\n\tdirruns = 0,\n\tdone = 0,\n\tclassCache = createCache(),\n\ttokenCache = createCache(),\n\tcompilerCache = createCache(),\n\tsortOrder = function( a, b ) {\n\t\tif ( a === b ) {\n\t\t\thasDuplicate = true;\n\t\t}\n\t\treturn 0;\n\t},\n\n\t// Instance methods\n\thasOwn = ({}).hasOwnProperty,\n\tarr = [],\n\tpop = arr.pop,\n\tpush_native = arr.push,\n\tpush = arr.push,\n\tslice = arr.slice,\n\t// Use a stripped-down indexOf as it's faster than native\n\t// https://jsperf.com/thor-indexof-vs-for/5\n\tindexOf = function( list, elem ) {\n\t\tvar i = 0,\n\t\t\tlen = list.length;\n\t\tfor ( ; i < len; i++ ) {\n\t\t\tif ( list[i] === elem ) {\n\t\t\t\treturn i;\n\t\t\t}\n\t\t}\n\t\treturn -1;\n\t},\n\n\tbooleans = \"checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped\",\n\n\t// Regular expressions\n\n\t// http://www.w3.org/TR/css3-selectors/#whitespace\n\twhitespace = \"[\\\\x20\\\\t\\\\r\\\\n\\\\f]\",\n\n\t// http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier\n\tidentifier = \"(?:\\\\\\\\.|[\\\\w-]|[^\\0-\\\\xa0])+\",\n\n\t// Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors\n\tattributes = \"\\\\[\" + whitespace + \"*(\" + identifier + \")(?:\" + whitespace +\n\t\t// Operator (capture 2)\n\t\t\"*([*^$|!~]?=)\" + whitespace +\n\t\t// \"Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]\"\n\t\t\"*(?:'((?:\\\\\\\\.|[^\\\\\\\\'])*)'|\\\"((?:\\\\\\\\.|[^\\\\\\\\\\\"])*)\\\"|(\" + identifier + \"))|)\" + whitespace +\n\t\t\"*\\\\]\",\n\n\tpseudos = \":(\" + identifier + \")(?:\\\\((\" +\n\t\t// To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:\n\t\t// 1. quoted (capture 3; capture 4 or capture 5)\n\t\t\"('((?:\\\\\\\\.|[^\\\\\\\\'])*)'|\\\"((?:\\\\\\\\.|[^\\\\\\\\\\\"])*)\\\")|\" +\n\t\t// 2. simple (capture 6)\n\t\t\"((?:\\\\\\\\.|[^\\\\\\\\()[\\\\]]|\" + attributes + \")*)|\" +\n\t\t// 3. anything else (capture 2)\n\t\t\".*\" +\n\t\t\")\\\\)|)\",\n\n\t// Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter\n\trwhitespace = new RegExp( whitespace + \"+\", \"g\" ),\n\trtrim = new RegExp( \"^\" + whitespace + \"+|((?:^|[^\\\\\\\\])(?:\\\\\\\\.)*)\" + whitespace + \"+$\", \"g\" ),\n\n\trcomma = new RegExp( \"^\" + whitespace + \"*,\" + whitespace + \"*\" ),\n\trcombinators = new RegExp( \"^\" + whitespace + \"*([>+~]|\" + whitespace + \")\" + whitespace + \"*\" ),\n\n\trattributeQuotes = new RegExp( \"=\" + whitespace + \"*([^\\\\]'\\\"]*?)\" + whitespace + \"*\\\\]\", \"g\" ),\n\n\trpseudo = new RegExp( pseudos ),\n\tridentifier = new RegExp( \"^\" + identifier + \"$\" ),\n\n\tmatchExpr = {\n\t\t\"ID\": new RegExp( \"^#(\" + identifier + \")\" ),\n\t\t\"CLASS\": new RegExp( \"^\\\\.(\" + identifier + \")\" ),\n\t\t\"TAG\": new RegExp( \"^(\" + identifier + \"|[*])\" ),\n\t\t\"ATTR\": new RegExp( \"^\" + attributes ),\n\t\t\"PSEUDO\": new RegExp( \"^\" + pseudos ),\n\t\t\"CHILD\": new RegExp( \"^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\\\(\" + whitespace +\n\t\t\t\"*(even|odd|(([+-]|)(\\\\d*)n|)\" + whitespace + \"*(?:([+-]|)\" + whitespace +\n\t\t\t\"*(\\\\d+)|))\" + whitespace + \"*\\\\)|)\", \"i\" ),\n\t\t\"bool\": new RegExp( \"^(?:\" + booleans + \")$\", \"i\" ),\n\t\t// For use in libraries implementing .is()\n\t\t// We use this for POS matching in `select`\n\t\t\"needsContext\": new RegExp( \"^\" + whitespace + \"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\\\(\" +\n\t\t\twhitespace + \"*((?:-\\\\d)?\\\\d*)\" + whitespace + \"*\\\\)|)(?=[^-]|$)\", \"i\" )\n\t},\n\n\trinputs = /^(?:input|select|textarea|button)$/i,\n\trheader = /^h\\d$/i,\n\n\trnative = /^[^{]+\\{\\s*\\[native \\w/,\n\n\t// Easily-parseable/retrievable ID or TAG or CLASS selectors\n\trquickExpr = /^(?:#([\\w-]+)|(\\w+)|\\.([\\w-]+))$/,\n\n\trsibling = /[+~]/,\n\n\t// CSS escapes\n\t// http://www.w3.org/TR/CSS21/syndata.html#escaped-characters\n\trunescape = new RegExp( \"\\\\\\\\([\\\\da-f]{1,6}\" + whitespace + \"?|(\" + whitespace + \")|.)\", \"ig\" ),\n\tfunescape = function( _, escaped, escapedWhitespace ) {\n\t\tvar high = \"0x\" + escaped - 0x10000;\n\t\t// NaN means non-codepoint\n\t\t// Support: Firefox<24\n\t\t// Workaround erroneous numeric interpretation of +\"0x\"\n\t\treturn high !== high || escapedWhitespace ?\n\t\t\tescaped :\n\t\t\thigh < 0 ?\n\t\t\t\t// BMP codepoint\n\t\t\t\tString.fromCharCode( high + 0x10000 ) :\n\t\t\t\t// Supplemental Plane codepoint (surrogate pair)\n\t\t\t\tString.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );\n\t},\n\n\t// CSS string/identifier serialization\n\t// https://drafts.csswg.org/cssom/#common-serializing-idioms\n\trcssescape = /([\\0-\\x1f\\x7f]|^-?\\d)|^-$|[^\\0-\\x1f\\x7f-\\uFFFF\\w-]/g,\n\tfcssescape = function( ch, asCodePoint ) {\n\t\tif ( asCodePoint ) {\n\n\t\t\t// U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER\n\t\t\tif ( ch === \"\\0\" ) {\n\t\t\t\treturn \"\\uFFFD\";\n\t\t\t}\n\n\t\t\t// Control characters and (dependent upon position) numbers get escaped as code points\n\t\t\treturn ch.slice( 0, -1 ) + \"\\\\\" + ch.charCodeAt( ch.length - 1 ).toString( 16 ) + \" \";\n\t\t}\n\n\t\t// Other potentially-special ASCII characters get backslash-escaped\n\t\treturn \"\\\\\" + ch;\n\t},\n\n\t// Used for iframes\n\t// See setDocument()\n\t// Removing the function wrapper causes a \"Permission Denied\"\n\t// error in IE\n\tunloadHandler = function() {\n\t\tsetDocument();\n\t},\n\n\tdisabledAncestor = addCombinator(\n\t\tfunction( elem ) {\n\t\t\treturn elem.disabled === true && (\"form\" in elem || \"label\" in elem);\n\t\t},\n\t\t{ dir: \"parentNode\", next: \"legend\" }\n\t);\n\n// Optimize for push.apply( _, NodeList )\ntry {\n\tpush.apply(\n\t\t(arr = slice.call( preferredDoc.childNodes )),\n\t\tpreferredDoc.childNodes\n\t);\n\t// Support: Android<4.0\n\t// Detect silently failing push.apply\n\tarr[ preferredDoc.childNodes.length ].nodeType;\n} catch ( e ) {\n\tpush = { apply: arr.length ?\n\n\t\t// Leverage slice if possible\n\t\tfunction( target, els ) {\n\t\t\tpush_native.apply( target, slice.call(els) );\n\t\t} :\n\n\t\t// Support: IE<9\n\t\t// Otherwise append directly\n\t\tfunction( target, els ) {\n\t\t\tvar j = target.length,\n\t\t\t\ti = 0;\n\t\t\t// Can't trust NodeList.length\n\t\t\twhile ( (target[j++] = els[i++]) ) {}\n\t\t\ttarget.length = j - 1;\n\t\t}\n\t};\n}\n\nfunction Sizzle( selector, context, results, seed ) {\n\tvar m, i, elem, nid, match, groups, newSelector,\n\t\tnewContext = context && context.ownerDocument,\n\n\t\t// nodeType defaults to 9, since context defaults to document\n\t\tnodeType = context ? context.nodeType : 9;\n\n\tresults = results || [];\n\n\t// Return early from calls with invalid selector or context\n\tif ( typeof selector !== \"string\" || !selector ||\n\t\tnodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) {\n\n\t\treturn results;\n\t}\n\n\t// Try to shortcut find operations (as opposed to filters) in HTML documents\n\tif ( !seed ) {\n\n\t\tif ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) {\n\t\t\tsetDocument( context );\n\t\t}\n\t\tcontext = context || document;\n\n\t\tif ( documentIsHTML ) {\n\n\t\t\t// If the selector is sufficiently simple, try using a \"get*By*\" DOM method\n\t\t\t// (excepting DocumentFragment context, where the methods don't exist)\n\t\t\tif ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) {\n\n\t\t\t\t// ID selector\n\t\t\t\tif ( (m = match[1]) ) {\n\n\t\t\t\t\t// Document context\n\t\t\t\t\tif ( nodeType === 9 ) {\n\t\t\t\t\t\tif ( (elem = context.getElementById( m )) ) {\n\n\t\t\t\t\t\t\t// Support: IE, Opera, Webkit\n\t\t\t\t\t\t\t// TODO: identify versions\n\t\t\t\t\t\t\t// getElementById can match elements by name instead of ID\n\t\t\t\t\t\t\tif ( elem.id === m ) {\n\t\t\t\t\t\t\t\tresults.push( elem );\n\t\t\t\t\t\t\t\treturn results;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\treturn results;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t// Element context\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\t// Support: IE, Opera, Webkit\n\t\t\t\t\t\t// TODO: identify versions\n\t\t\t\t\t\t// getElementById can match elements by name instead of ID\n\t\t\t\t\t\tif ( newContext && (elem = newContext.getElementById( m )) &&\n\t\t\t\t\t\t\tcontains( context, elem ) &&\n\t\t\t\t\t\t\telem.id === m ) {\n\n\t\t\t\t\t\t\tresults.push( elem );\n\t\t\t\t\t\t\treturn results;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t// Type selector\n\t\t\t\t} else if ( match[2] ) {\n\t\t\t\t\tpush.apply( results, context.getElementsByTagName( selector ) );\n\t\t\t\t\treturn results;\n\n\t\t\t\t// Class selector\n\t\t\t\t} else if ( (m = match[3]) && support.getElementsByClassName &&\n\t\t\t\t\tcontext.getElementsByClassName ) {\n\n\t\t\t\t\tpush.apply( results, context.getElementsByClassName( m ) );\n\t\t\t\t\treturn results;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Take advantage of querySelectorAll\n\t\t\tif ( support.qsa &&\n\t\t\t\t!compilerCache[ selector + \" \" ] &&\n\t\t\t\t(!rbuggyQSA || !rbuggyQSA.test( selector )) ) {\n\n\t\t\t\tif ( nodeType !== 1 ) {\n\t\t\t\t\tnewContext = context;\n\t\t\t\t\tnewSelector = selector;\n\n\t\t\t\t// qSA looks outside Element context, which is not what we want\n\t\t\t\t// Thanks to Andrew Dupont for this workaround technique\n\t\t\t\t// Support: IE <=8\n\t\t\t\t// Exclude object elements\n\t\t\t\t} else if ( context.nodeName.toLowerCase() !== \"object\" ) {\n\n\t\t\t\t\t// Capture the context ID, setting it first if necessary\n\t\t\t\t\tif ( (nid = context.getAttribute( \"id\" )) ) {\n\t\t\t\t\t\tnid = nid.replace( rcssescape, fcssescape );\n\t\t\t\t\t} else {\n\t\t\t\t\t\tcontext.setAttribute( \"id\", (nid = expando) );\n\t\t\t\t\t}\n\n\t\t\t\t\t// Prefix every selector in the list\n\t\t\t\t\tgroups = tokenize( selector );\n\t\t\t\t\ti = groups.length;\n\t\t\t\t\twhile ( i-- ) {\n\t\t\t\t\t\tgroups[i] = \"#\" + nid + \" \" + toSelector( groups[i] );\n\t\t\t\t\t}\n\t\t\t\t\tnewSelector = groups.join( \",\" );\n\n\t\t\t\t\t// Expand context for sibling selectors\n\t\t\t\t\tnewContext = rsibling.test( selector ) && testContext( context.parentNode ) ||\n\t\t\t\t\t\tcontext;\n\t\t\t\t}\n\n\t\t\t\tif ( newSelector ) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tpush.apply( results,\n\t\t\t\t\t\t\tnewContext.querySelectorAll( newSelector )\n\t\t\t\t\t\t);\n\t\t\t\t\t\treturn results;\n\t\t\t\t\t} catch ( qsaError ) {\n\t\t\t\t\t} finally {\n\t\t\t\t\t\tif ( nid === expando ) {\n\t\t\t\t\t\t\tcontext.removeAttribute( \"id\" );\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// All others\n\treturn select( selector.replace( rtrim, \"$1\" ), context, results, seed );\n}\n\n/**\n * Create key-value caches of limited size\n * @returns {function(string, object)} Returns the Object data after storing it on itself with\n *\tproperty name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)\n *\tdeleting the oldest entry\n */\nfunction createCache() {\n\tvar keys = [];\n\n\tfunction cache( key, value ) {\n\t\t// Use (key + \" \") to avoid collision with native prototype properties (see Issue #157)\n\t\tif ( keys.push( key + \" \" ) > Expr.cacheLength ) {\n\t\t\t// Only keep the most recent entries\n\t\t\tdelete cache[ keys.shift() ];\n\t\t}\n\t\treturn (cache[ key + \" \" ] = value);\n\t}\n\treturn cache;\n}\n\n/**\n * Mark a function for special use by Sizzle\n * @param {Function} fn The function to mark\n */\nfunction markFunction( fn ) {\n\tfn[ expando ] = true;\n\treturn fn;\n}\n\n/**\n * Support testing using an element\n * @param {Function} fn Passed the created element and returns a boolean result\n */\nfunction assert( fn ) {\n\tvar el = document.createElement(\"fieldset\");\n\n\ttry {\n\t\treturn !!fn( el );\n\t} catch (e) {\n\t\treturn false;\n\t} finally {\n\t\t// Remove from its parent by default\n\t\tif ( el.parentNode ) {\n\t\t\tel.parentNode.removeChild( el );\n\t\t}\n\t\t// release memory in IE\n\t\tel = null;\n\t}\n}\n\n/**\n * Adds the same handler for all of the specified attrs\n * @param {String} attrs Pipe-separated list of attributes\n * @param {Function} handler The method that will be applied\n */\nfunction addHandle( attrs, handler ) {\n\tvar arr = attrs.split(\"|\"),\n\t\ti = arr.length;\n\n\twhile ( i-- ) {\n\t\tExpr.attrHandle[ arr[i] ] = handler;\n\t}\n}\n\n/**\n * Checks document order of two siblings\n * @param {Element} a\n * @param {Element} b\n * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b\n */\nfunction siblingCheck( a, b ) {\n\tvar cur = b && a,\n\t\tdiff = cur && a.nodeType === 1 && b.nodeType === 1 &&\n\t\t\ta.sourceIndex - b.sourceIndex;\n\n\t// Use IE sourceIndex if available on both nodes\n\tif ( diff ) {\n\t\treturn diff;\n\t}\n\n\t// Check if b follows a\n\tif ( cur ) {\n\t\twhile ( (cur = cur.nextSibling) ) {\n\t\t\tif ( cur === b ) {\n\t\t\t\treturn -1;\n\t\t\t}\n\t\t}\n\t}\n\n\treturn a ? 1 : -1;\n}\n\n/**\n * Returns a function to use in pseudos for input types\n * @param {String} type\n */\nfunction createInputPseudo( type ) {\n\treturn function( elem ) {\n\t\tvar name = elem.nodeName.toLowerCase();\n\t\treturn name === \"input\" && elem.type === type;\n\t};\n}\n\n/**\n * Returns a function to use in pseudos for buttons\n * @param {String} type\n */\nfunction createButtonPseudo( type ) {\n\treturn function( elem ) {\n\t\tvar name = elem.nodeName.toLowerCase();\n\t\treturn (name === \"input\" || name === \"button\") && elem.type === type;\n\t};\n}\n\n/**\n * Returns a function to use in pseudos for :enabled/:disabled\n * @param {Boolean} disabled true for :disabled; false for :enabled\n */\nfunction createDisabledPseudo( disabled ) {\n\n\t// Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable\n\treturn function( elem ) {\n\n\t\t// Only certain elements can match :enabled or :disabled\n\t\t// https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled\n\t\t// https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled\n\t\tif ( \"form\" in elem ) {\n\n\t\t\t// Check for inherited disabledness on relevant non-disabled elements:\n\t\t\t// * listed form-associated elements in a disabled fieldset\n\t\t\t// https://html.spec.whatwg.org/multipage/forms.html#category-listed\n\t\t\t// https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled\n\t\t\t// * option elements in a disabled optgroup\n\t\t\t// https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled\n\t\t\t// All such elements have a \"form\" property.\n\t\t\tif ( elem.parentNode && elem.disabled === false ) {\n\n\t\t\t\t// Option elements defer to a parent optgroup if present\n\t\t\t\tif ( \"label\" in elem ) {\n\t\t\t\t\tif ( \"label\" in elem.parentNode ) {\n\t\t\t\t\t\treturn elem.parentNode.disabled === disabled;\n\t\t\t\t\t} else {\n\t\t\t\t\t\treturn elem.disabled === disabled;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// Support: IE 6 - 11\n\t\t\t\t// Use the isDisabled shortcut property to check for disabled fieldset ancestors\n\t\t\t\treturn elem.isDisabled === disabled ||\n\n\t\t\t\t\t// Where there is no isDisabled, check manually\n\t\t\t\t\t/* jshint -W018 */\n\t\t\t\t\telem.isDisabled !== !disabled &&\n\t\t\t\t\t\tdisabledAncestor( elem ) === disabled;\n\t\t\t}\n\n\t\t\treturn elem.disabled === disabled;\n\n\t\t// Try to winnow out elements that can't be disabled before trusting the disabled property.\n\t\t// Some victims get caught in our net (label, legend, menu, track), but it shouldn't\n\t\t// even exist on them, let alone have a boolean value.\n\t\t} else if ( \"label\" in elem ) {\n\t\t\treturn elem.disabled === disabled;\n\t\t}\n\n\t\t// Remaining elements are neither :enabled nor :disabled\n\t\treturn false;\n\t};\n}\n\n/**\n * Returns a function to use in pseudos for positionals\n * @param {Function} fn\n */\nfunction createPositionalPseudo( fn ) {\n\treturn markFunction(function( argument ) {\n\t\targument = +argument;\n\t\treturn markFunction(function( seed, matches ) {\n\t\t\tvar j,\n\t\t\t\tmatchIndexes = fn( [], seed.length, argument ),\n\t\t\t\ti = matchIndexes.length;\n\n\t\t\t// Match elements found at the specified indexes\n\t\t\twhile ( i-- ) {\n\t\t\t\tif ( seed[ (j = matchIndexes[i]) ] ) {\n\t\t\t\t\tseed[j] = !(matches[j] = seed[j]);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t});\n}\n\n/**\n * Checks a node for validity as a Sizzle context\n * @param {Element|Object=} context\n * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value\n */\nfunction testContext( context ) {\n\treturn context && typeof context.getElementsByTagName !== \"undefined\" && context;\n}\n\n// Expose support vars for convenience\nsupport = Sizzle.support = {};\n\n/**\n * Detects XML nodes\n * @param {Element|Object} elem An element or a document\n * @returns {Boolean} True iff elem is a non-HTML XML node\n */\nisXML = Sizzle.isXML = function( elem ) {\n\t// documentElement is verified for cases where it doesn't yet exist\n\t// (such as loading iframes in IE - #4833)\n\tvar documentElement = elem && (elem.ownerDocument || elem).documentElement;\n\treturn documentElement ? documentElement.nodeName !== \"HTML\" : false;\n};\n\n/**\n * Sets document-related variables once based on the current document\n * @param {Element|Object} [doc] An element or document object to use to set the document\n * @returns {Object} Returns the current document\n */\nsetDocument = Sizzle.setDocument = function( node ) {\n\tvar hasCompare, subWindow,\n\t\tdoc = node ? node.ownerDocument || node : preferredDoc;\n\n\t// Return early if doc is invalid or already selected\n\tif ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) {\n\t\treturn document;\n\t}\n\n\t// Update global variables\n\tdocument = doc;\n\tdocElem = document.documentElement;\n\tdocumentIsHTML = !isXML( document );\n\n\t// Support: IE 9-11, Edge\n\t// Accessing iframe documents after unload throws \"permission denied\" errors (jQuery #13936)\n\tif ( preferredDoc !== document &&\n\t\t(subWindow = document.defaultView) && subWindow.top !== subWindow ) {\n\n\t\t// Support: IE 11, Edge\n\t\tif ( subWindow.addEventListener ) {\n\t\t\tsubWindow.addEventListener( \"unload\", unloadHandler, false );\n\n\t\t// Support: IE 9 - 10 only\n\t\t} else if ( subWindow.attachEvent ) {\n\t\t\tsubWindow.attachEvent( \"onunload\", unloadHandler );\n\t\t}\n\t}\n\n\t/* Attributes\n\t---------------------------------------------------------------------- */\n\n\t// Support: IE<8\n\t// Verify that getAttribute really returns attributes and not properties\n\t// (excepting IE8 booleans)\n\tsupport.attributes = assert(function( el ) {\n\t\tel.className = \"i\";\n\t\treturn !el.getAttribute(\"className\");\n\t});\n\n\t/* getElement(s)By*\n\t---------------------------------------------------------------------- */\n\n\t// Check if getElementsByTagName(\"*\") returns only elements\n\tsupport.getElementsByTagName = assert(function( el ) {\n\t\tel.appendChild( document.createComment(\"\") );\n\t\treturn !el.getElementsByTagName(\"*\").length;\n\t});\n\n\t// Support: IE<9\n\tsupport.getElementsByClassName = rnative.test( document.getElementsByClassName );\n\n\t// Support: IE<10\n\t// Check if getElementById returns elements by name\n\t// The broken getElementById methods don't pick up programmatically-set names,\n\t// so use a roundabout getElementsByName test\n\tsupport.getById = assert(function( el ) {\n\t\tdocElem.appendChild( el ).id = expando;\n\t\treturn !document.getElementsByName || !document.getElementsByName( expando ).length;\n\t});\n\n\t// ID filter and find\n\tif ( support.getById ) {\n\t\tExpr.filter[\"ID\"] = function( id ) {\n\t\t\tvar attrId = id.replace( runescape, funescape );\n\t\t\treturn function( elem ) {\n\t\t\t\treturn elem.getAttribute(\"id\") === attrId;\n\t\t\t};\n\t\t};\n\t\tExpr.find[\"ID\"] = function( id, context ) {\n\t\t\tif ( typeof context.getElementById !== \"undefined\" && documentIsHTML ) {\n\t\t\t\tvar elem = context.getElementById( id );\n\t\t\t\treturn elem ? [ elem ] : [];\n\t\t\t}\n\t\t};\n\t} else {\n\t\tExpr.filter[\"ID\"] = function( id ) {\n\t\t\tvar attrId = id.replace( runescape, funescape );\n\t\t\treturn function( elem ) {\n\t\t\t\tvar node = typeof elem.getAttributeNode !== \"undefined\" &&\n\t\t\t\t\telem.getAttributeNode(\"id\");\n\t\t\t\treturn node && node.value === attrId;\n\t\t\t};\n\t\t};\n\n\t\t// Support: IE 6 - 7 only\n\t\t// getElementById is not reliable as a find shortcut\n\t\tExpr.find[\"ID\"] = function( id, context ) {\n\t\t\tif ( typeof context.getElementById !== \"undefined\" && documentIsHTML ) {\n\t\t\t\tvar node, i, elems,\n\t\t\t\t\telem = context.getElementById( id );\n\n\t\t\t\tif ( elem ) {\n\n\t\t\t\t\t// Verify the id attribute\n\t\t\t\t\tnode = elem.getAttributeNode(\"id\");\n\t\t\t\t\tif ( node && node.value === id ) {\n\t\t\t\t\t\treturn [ elem ];\n\t\t\t\t\t}\n\n\t\t\t\t\t// Fall back on getElementsByName\n\t\t\t\t\telems = context.getElementsByName( id );\n\t\t\t\t\ti = 0;\n\t\t\t\t\twhile ( (elem = elems[i++]) ) {\n\t\t\t\t\t\tnode = elem.getAttributeNode(\"id\");\n\t\t\t\t\t\tif ( node && node.value === id ) {\n\t\t\t\t\t\t\treturn [ elem ];\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\treturn [];\n\t\t\t}\n\t\t};\n\t}\n\n\t// Tag\n\tExpr.find[\"TAG\"] = support.getElementsByTagName ?\n\t\tfunction( tag, context ) {\n\t\t\tif ( typeof context.getElementsByTagName !== \"undefined\" ) {\n\t\t\t\treturn context.getElementsByTagName( tag );\n\n\t\t\t// DocumentFragment nodes don't have gEBTN\n\t\t\t} else if ( support.qsa ) {\n\t\t\t\treturn context.querySelectorAll( tag );\n\t\t\t}\n\t\t} :\n\n\t\tfunction( tag, context ) {\n\t\t\tvar elem,\n\t\t\t\ttmp = [],\n\t\t\t\ti = 0,\n\t\t\t\t// By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too\n\t\t\t\tresults = context.getElementsByTagName( tag );\n\n\t\t\t// Filter out possible comments\n\t\t\tif ( tag === \"*\" ) {\n\t\t\t\twhile ( (elem = results[i++]) ) {\n\t\t\t\t\tif ( elem.nodeType === 1 ) {\n\t\t\t\t\t\ttmp.push( elem );\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\treturn tmp;\n\t\t\t}\n\t\t\treturn results;\n\t\t};\n\n\t// Class\n\tExpr.find[\"CLASS\"] = support.getElementsByClassName && function( className, context ) {\n\t\tif ( typeof context.getElementsByClassName !== \"undefined\" && documentIsHTML ) {\n\t\t\treturn context.getElementsByClassName( className );\n\t\t}\n\t};\n\n\t/* QSA/matchesSelector\n\t---------------------------------------------------------------------- */\n\n\t// QSA and matchesSelector support\n\n\t// matchesSelector(:active) reports false when true (IE9/Opera 11.5)\n\trbuggyMatches = [];\n\n\t// qSa(:focus) reports false when true (Chrome 21)\n\t// We allow this because of a bug in IE8/9 that throws an error\n\t// whenever `document.activeElement` is accessed on an iframe\n\t// So, we allow :focus to pass through QSA all the time to avoid the IE error\n\t// See https://bugs.jquery.com/ticket/13378\n\trbuggyQSA = [];\n\n\tif ( (support.qsa = rnative.test( document.querySelectorAll )) ) {\n\t\t// Build QSA regex\n\t\t// Regex strategy adopted from Diego Perini\n\t\tassert(function( el ) {\n\t\t\t// Select is set to empty string on purpose\n\t\t\t// This is to test IE's treatment of not explicitly\n\t\t\t// setting a boolean content attribute,\n\t\t\t// since its presence should be enough\n\t\t\t// https://bugs.jquery.com/ticket/12359\n\t\t\tdocElem.appendChild( el ).innerHTML = \"<a id='\" + expando + \"'></a>\" +\n\t\t\t\t\"<select id='\" + expando + \"-\\r\\\\' msallowcapture=''>\" +\n\t\t\t\t\"<option selected=''></option></select>\";\n\n\t\t\t// Support: IE8, Opera 11-12.16\n\t\t\t// Nothing should be selected when empty strings follow ^= or $= or *=\n\t\t\t// The test attribute must be unknown in Opera but \"safe\" for WinRT\n\t\t\t// https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section\n\t\t\tif ( el.querySelectorAll(\"[msallowcapture^='']\").length ) {\n\t\t\t\trbuggyQSA.push( \"[*^$]=\" + whitespace + \"*(?:''|\\\"\\\")\" );\n\t\t\t}\n\n\t\t\t// Support: IE8\n\t\t\t// Boolean attributes and \"value\" are not treated correctly\n\t\t\tif ( !el.querySelectorAll(\"[selected]\").length ) {\n\t\t\t\trbuggyQSA.push( \"\\\\[\" + whitespace + \"*(?:value|\" + booleans + \")\" );\n\t\t\t}\n\n\t\t\t// Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+\n\t\t\tif ( !el.querySelectorAll( \"[id~=\" + expando + \"-]\" ).length ) {\n\t\t\t\trbuggyQSA.push(\"~=\");\n\t\t\t}\n\n\t\t\t// Webkit/Opera - :checked should return selected option elements\n\t\t\t// http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked\n\t\t\t// IE8 throws error here and will not see later tests\n\t\t\tif ( !el.querySelectorAll(\":checked\").length ) {\n\t\t\t\trbuggyQSA.push(\":checked\");\n\t\t\t}\n\n\t\t\t// Support: Safari 8+, iOS 8+\n\t\t\t// https://bugs.webkit.org/show_bug.cgi?id=136851\n\t\t\t// In-page `selector#id sibling-combinator selector` fails\n\t\t\tif ( !el.querySelectorAll( \"a#\" + expando + \"+*\" ).length ) {\n\t\t\t\trbuggyQSA.push(\".#.+[+~]\");\n\t\t\t}\n\t\t});\n\n\t\tassert(function( el ) {\n\t\t\tel.innerHTML = \"<a href='' disabled='disabled'></a>\" +\n\t\t\t\t\"<select disabled='disabled'><option/></select>\";\n\n\t\t\t// Support: Windows 8 Native Apps\n\t\t\t// The type and name attributes are restricted during .innerHTML assignment\n\t\t\tvar input = document.createElement(\"input\");\n\t\t\tinput.setAttribute( \"type\", \"hidden\" );\n\t\t\tel.appendChild( input ).setAttribute( \"name\", \"D\" );\n\n\t\t\t// Support: IE8\n\t\t\t// Enforce case-sensitivity of name attribute\n\t\t\tif ( el.querySelectorAll(\"[name=d]\").length ) {\n\t\t\t\trbuggyQSA.push( \"name\" + whitespace + \"*[*^$|!~]?=\" );\n\t\t\t}\n\n\t\t\t// FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)\n\t\t\t// IE8 throws error here and will not see later tests\n\t\t\tif ( el.querySelectorAll(\":enabled\").length !== 2 ) {\n\t\t\t\trbuggyQSA.push( \":enabled\", \":disabled\" );\n\t\t\t}\n\n\t\t\t// Support: IE9-11+\n\t\t\t// IE's :disabled selector does not pick up the children of disabled fieldsets\n\t\t\tdocElem.appendChild( el ).disabled = true;\n\t\t\tif ( el.querySelectorAll(\":disabled\").length !== 2 ) {\n\t\t\t\trbuggyQSA.push( \":enabled\", \":disabled\" );\n\t\t\t}\n\n\t\t\t// Opera 10-11 does not throw on post-comma invalid pseudos\n\t\t\tel.querySelectorAll(\"*,:x\");\n\t\t\trbuggyQSA.push(\",.*:\");\n\t\t});\n\t}\n\n\tif ( (support.matchesSelector = rnative.test( (matches = docElem.matches ||\n\t\tdocElem.webkitMatchesSelector ||\n\t\tdocElem.mozMatchesSelector ||\n\t\tdocElem.oMatchesSelector ||\n\t\tdocElem.msMatchesSelector) )) ) {\n\n\t\tassert(function( el ) {\n\t\t\t// Check to see if it's possible to do matchesSelector\n\t\t\t// on a disconnected node (IE 9)\n\t\t\tsupport.disconnectedMatch = matches.call( el, \"*\" );\n\n\t\t\t// This should fail with an exception\n\t\t\t// Gecko does not error, returns false instead\n\t\t\tmatches.call( el, \"[s!='']:x\" );\n\t\t\trbuggyMatches.push( \"!=\", pseudos );\n\t\t});\n\t}\n\n\trbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join(\"|\") );\n\trbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join(\"|\") );\n\n\t/* Contains\n\t---------------------------------------------------------------------- */\n\thasCompare = rnative.test( docElem.compareDocumentPosition );\n\n\t// Element contains another\n\t// Purposefully self-exclusive\n\t// As in, an element does not contain itself\n\tcontains = hasCompare || rnative.test( docElem.contains ) ?\n\t\tfunction( a, b ) {\n\t\t\tvar adown = a.nodeType === 9 ? a.documentElement : a,\n\t\t\t\tbup = b && b.parentNode;\n\t\t\treturn a === bup || !!( bup && bup.nodeType === 1 && (\n\t\t\t\tadown.contains ?\n\t\t\t\t\tadown.contains( bup ) :\n\t\t\t\t\ta.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16\n\t\t\t));\n\t\t} :\n\t\tfunction( a, b ) {\n\t\t\tif ( b ) {\n\t\t\t\twhile ( (b = b.parentNode) ) {\n\t\t\t\t\tif ( b === a ) {\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn false;\n\t\t};\n\n\t/* Sorting\n\t---------------------------------------------------------------------- */\n\n\t// Document order sorting\n\tsortOrder = hasCompare ?\n\tfunction( a, b ) {\n\n\t\t// Flag for duplicate removal\n\t\tif ( a === b ) {\n\t\t\thasDuplicate = true;\n\t\t\treturn 0;\n\t\t}\n\n\t\t// Sort on method existence if only one input has compareDocumentPosition\n\t\tvar compare = !a.compareDocumentPosition - !b.compareDocumentPosition;\n\t\tif ( compare ) {\n\t\t\treturn compare;\n\t\t}\n\n\t\t// Calculate position if both inputs belong to the same document\n\t\tcompare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ?\n\t\t\ta.compareDocumentPosition( b ) :\n\n\t\t\t// Otherwise we know they are disconnected\n\t\t\t1;\n\n\t\t// Disconnected nodes\n\t\tif ( compare & 1 ||\n\t\t\t(!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) {\n\n\t\t\t// Choose the first element that is related to our preferred document\n\t\t\tif ( a === document || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) {\n\t\t\t\treturn -1;\n\t\t\t}\n\t\t\tif ( b === document || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) {\n\t\t\t\treturn 1;\n\t\t\t}\n\n\t\t\t// Maintain original order\n\t\t\treturn sortInput ?\n\t\t\t\t( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :\n\t\t\t\t0;\n\t\t}\n\n\t\treturn compare & 4 ? -1 : 1;\n\t} :\n\tfunction( a, b ) {\n\t\t// Exit early if the nodes are identical\n\t\tif ( a === b ) {\n\t\t\thasDuplicate = true;\n\t\t\treturn 0;\n\t\t}\n\n\t\tvar cur,\n\t\t\ti = 0,\n\t\t\taup = a.parentNode,\n\t\t\tbup = b.parentNode,\n\t\t\tap = [ a ],\n\t\t\tbp = [ b ];\n\n\t\t// Parentless nodes are either documents or disconnected\n\t\tif ( !aup || !bup ) {\n\t\t\treturn a === document ? -1 :\n\t\t\t\tb === document ? 1 :\n\t\t\t\taup ? -1 :\n\t\t\t\tbup ? 1 :\n\t\t\t\tsortInput ?\n\t\t\t\t( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :\n\t\t\t\t0;\n\n\t\t// If the nodes are siblings, we can do a quick check\n\t\t} else if ( aup === bup ) {\n\t\t\treturn siblingCheck( a, b );\n\t\t}\n\n\t\t// Otherwise we need full lists of their ancestors for comparison\n\t\tcur = a;\n\t\twhile ( (cur = cur.parentNode) ) {\n\t\t\tap.unshift( cur );\n\t\t}\n\t\tcur = b;\n\t\twhile ( (cur = cur.parentNode) ) {\n\t\t\tbp.unshift( cur );\n\t\t}\n\n\t\t// Walk down the tree looking for a discrepancy\n\t\twhile ( ap[i] === bp[i] ) {\n\t\t\ti++;\n\t\t}\n\n\t\treturn i ?\n\t\t\t// Do a sibling check if the nodes have a common ancestor\n\t\t\tsiblingCheck( ap[i], bp[i] ) :\n\n\t\t\t// Otherwise nodes in our document sort first\n\t\t\tap[i] === preferredDoc ? -1 :\n\t\t\tbp[i] === preferredDoc ? 1 :\n\t\t\t0;\n\t};\n\n\treturn document;\n};\n\nSizzle.matches = function( expr, elements ) {\n\treturn Sizzle( expr, null, null, elements );\n};\n\nSizzle.matchesSelector = function( elem, expr ) {\n\t// Set document vars if needed\n\tif ( ( elem.ownerDocument || elem ) !== document ) {\n\t\tsetDocument( elem );\n\t}\n\n\t// Make sure that attribute selectors are quoted\n\texpr = expr.replace( rattributeQuotes, \"='$1']\" );\n\n\tif ( support.matchesSelector && documentIsHTML &&\n\t\t!compilerCache[ expr + \" \" ] &&\n\t\t( !rbuggyMatches || !rbuggyMatches.test( expr ) ) &&\n\t\t( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) {\n\n\t\ttry {\n\t\t\tvar ret = matches.call( elem, expr );\n\n\t\t\t// IE 9's matchesSelector returns false on disconnected nodes\n\t\t\tif ( ret || support.disconnectedMatch ||\n\t\t\t\t\t// As well, disconnected nodes are said to be in a document\n\t\t\t\t\t// fragment in IE 9\n\t\t\t\t\telem.document && elem.document.nodeType !== 11 ) {\n\t\t\t\treturn ret;\n\t\t\t}\n\t\t} catch (e) {}\n\t}\n\n\treturn Sizzle( expr, document, null, [ elem ] ).length > 0;\n};\n\nSizzle.contains = function( context, elem ) {\n\t// Set document vars if needed\n\tif ( ( context.ownerDocument || context ) !== document ) {\n\t\tsetDocument( context );\n\t}\n\treturn contains( context, elem );\n};\n\nSizzle.attr = function( elem, name ) {\n\t// Set document vars if needed\n\tif ( ( elem.ownerDocument || elem ) !== document ) {\n\t\tsetDocument( elem );\n\t}\n\n\tvar fn = Expr.attrHandle[ name.toLowerCase() ],\n\t\t// Don't get fooled by Object.prototype properties (jQuery #13807)\n\t\tval = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ?\n\t\t\tfn( elem, name, !documentIsHTML ) :\n\t\t\tundefined;\n\n\treturn val !== undefined ?\n\t\tval :\n\t\tsupport.attributes || !documentIsHTML ?\n\t\t\telem.getAttribute( name ) :\n\t\t\t(val = elem.getAttributeNode(name)) && val.specified ?\n\t\t\t\tval.value :\n\t\t\t\tnull;\n};\n\nSizzle.escape = function( sel ) {\n\treturn (sel + \"\").replace( rcssescape, fcssescape );\n};\n\nSizzle.error = function( msg ) {\n\tthrow new Error( \"Syntax error, unrecognized expression: \" + msg );\n};\n\n/**\n * Document sorting and removing duplicates\n * @param {ArrayLike} results\n */\nSizzle.uniqueSort = function( results ) {\n\tvar elem,\n\t\tduplicates = [],\n\t\tj = 0,\n\t\ti = 0;\n\n\t// Unless we *know* we can detect duplicates, assume their presence\n\thasDuplicate = !support.detectDuplicates;\n\tsortInput = !support.sortStable && results.slice( 0 );\n\tresults.sort( sortOrder );\n\n\tif ( hasDuplicate ) {\n\t\twhile ( (elem = results[i++]) ) {\n\t\t\tif ( elem === results[ i ] ) {\n\t\t\t\tj = duplicates.push( i );\n\t\t\t}\n\t\t}\n\t\twhile ( j-- ) {\n\t\t\tresults.splice( duplicates[ j ], 1 );\n\t\t}\n\t}\n\n\t// Clear input after sorting to release objects\n\t// See https://github.com/jquery/sizzle/pull/225\n\tsortInput = null;\n\n\treturn results;\n};\n\n/**\n * Utility function for retrieving the text value of an array of DOM nodes\n * @param {Array|Element} elem\n */\ngetText = Sizzle.getText = function( elem ) {\n\tvar node,\n\t\tret = \"\",\n\t\ti = 0,\n\t\tnodeType = elem.nodeType;\n\n\tif ( !nodeType ) {\n\t\t// If no nodeType, this is expected to be an array\n\t\twhile ( (node = elem[i++]) ) {\n\t\t\t// Do not traverse comment nodes\n\t\t\tret += getText( node );\n\t\t}\n\t} else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {\n\t\t// Use textContent for elements\n\t\t// innerText usage removed for consistency of new lines (jQuery #11153)\n\t\tif ( typeof elem.textContent === \"string\" ) {\n\t\t\treturn elem.textContent;\n\t\t} else {\n\t\t\t// Traverse its children\n\t\t\tfor ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {\n\t\t\t\tret += getText( elem );\n\t\t\t}\n\t\t}\n\t} else if ( nodeType === 3 || nodeType === 4 ) {\n\t\treturn elem.nodeValue;\n\t}\n\t// Do not include comment or processing instruction nodes\n\n\treturn ret;\n};\n\nExpr = Sizzle.selectors = {\n\n\t// Can be adjusted by the user\n\tcacheLength: 50,\n\n\tcreatePseudo: markFunction,\n\n\tmatch: matchExpr,\n\n\tattrHandle: {},\n\n\tfind: {},\n\n\trelative: {\n\t\t\">\": { dir: \"parentNode\", first: true },\n\t\t\" \": { dir: \"parentNode\" },\n\t\t\"+\": { dir: \"previousSibling\", first: true },\n\t\t\"~\": { dir: \"previousSibling\" }\n\t},\n\n\tpreFilter: {\n\t\t\"ATTR\": function( match ) {\n\t\t\tmatch[1] = match[1].replace( runescape, funescape );\n\n\t\t\t// Move the given value to match[3] whether quoted or unquoted\n\t\t\tmatch[3] = ( match[3] || match[4] || match[5] || \"\" ).replace( runescape, funescape );\n\n\t\t\tif ( match[2] === \"~=\" ) {\n\t\t\t\tmatch[3] = \" \" + match[3] + \" \";\n\t\t\t}\n\n\t\t\treturn match.slice( 0, 4 );\n\t\t},\n\n\t\t\"CHILD\": function( match ) {\n\t\t\t/* matches from matchExpr[\"CHILD\"]\n\t\t\t\t1 type (only|nth|...)\n\t\t\t\t2 what (child|of-type)\n\t\t\t\t3 argument (even|odd|\\d*|\\d*n([+-]\\d+)?|...)\n\t\t\t\t4 xn-component of xn+y argument ([+-]?\\d*n|)\n\t\t\t\t5 sign of xn-component\n\t\t\t\t6 x of xn-component\n\t\t\t\t7 sign of y-component\n\t\t\t\t8 y of y-component\n\t\t\t*/\n\t\t\tmatch[1] = match[1].toLowerCase();\n\n\t\t\tif ( match[1].slice( 0, 3 ) === \"nth\" ) {\n\t\t\t\t// nth-* requires argument\n\t\t\t\tif ( !match[3] ) {\n\t\t\t\t\tSizzle.error( match[0] );\n\t\t\t\t}\n\n\t\t\t\t// numeric x and y parameters for Expr.filter.CHILD\n\t\t\t\t// remember that false/true cast respectively to 0/1\n\t\t\t\tmatch[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === \"even\" || match[3] === \"odd\" ) );\n\t\t\t\tmatch[5] = +( ( match[7] + match[8] ) || match[3] === \"odd\" );\n\n\t\t\t// other types prohibit arguments\n\t\t\t} else if ( match[3] ) {\n\t\t\t\tSizzle.error( match[0] );\n\t\t\t}\n\n\t\t\treturn match;\n\t\t},\n\n\t\t\"PSEUDO\": function( match ) {\n\t\t\tvar excess,\n\t\t\t\tunquoted = !match[6] && match[2];\n\n\t\t\tif ( matchExpr[\"CHILD\"].test( match[0] ) ) {\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\t// Accept quoted arguments as-is\n\t\t\tif ( match[3] ) {\n\t\t\t\tmatch[2] = match[4] || match[5] || \"\";\n\n\t\t\t// Strip excess characters from unquoted arguments\n\t\t\t} else if ( unquoted && rpseudo.test( unquoted ) &&\n\t\t\t\t// Get excess from tokenize (recursively)\n\t\t\t\t(excess = tokenize( unquoted, true )) &&\n\t\t\t\t// advance to the next closing parenthesis\n\t\t\t\t(excess = unquoted.indexOf( \")\", unquoted.length - excess ) - unquoted.length) ) {\n\n\t\t\t\t// excess is a negative index\n\t\t\t\tmatch[0] = match[0].slice( 0, excess );\n\t\t\t\tmatch[2] = unquoted.slice( 0, excess );\n\t\t\t}\n\n\t\t\t// Return only captures needed by the pseudo filter method (type and argument)\n\t\t\treturn match.slice( 0, 3 );\n\t\t}\n\t},\n\n\tfilter: {\n\n\t\t\"TAG\": function( nodeNameSelector ) {\n\t\t\tvar nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();\n\t\t\treturn nodeNameSelector === \"*\" ?\n\t\t\t\tfunction() { return true; } :\n\t\t\t\tfunction( elem ) {\n\t\t\t\t\treturn elem.nodeName && elem.nodeName.toLowerCase() === nodeName;\n\t\t\t\t};\n\t\t},\n\n\t\t\"CLASS\": function( className ) {\n\t\t\tvar pattern = classCache[ className + \" \" ];\n\n\t\t\treturn pattern ||\n\t\t\t\t(pattern = new RegExp( \"(^|\" + whitespace + \")\" + className + \"(\" + whitespace + \"|$)\" )) &&\n\t\t\t\tclassCache( className, function( elem ) {\n\t\t\t\t\treturn pattern.test( typeof elem.className === \"string\" && elem.className || typeof elem.getAttribute !== \"undefined\" && elem.getAttribute(\"class\") || \"\" );\n\t\t\t\t});\n\t\t},\n\n\t\t\"ATTR\": function( name, operator, check ) {\n\t\t\treturn function( elem ) {\n\t\t\t\tvar result = Sizzle.attr( elem, name );\n\n\t\t\t\tif ( result == null ) {\n\t\t\t\t\treturn operator === \"!=\";\n\t\t\t\t}\n\t\t\t\tif ( !operator ) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\n\t\t\t\tresult += \"\";\n\n\t\t\t\treturn operator === \"=\" ? result === check :\n\t\t\t\t\toperator === \"!=\" ? result !== check :\n\t\t\t\t\toperator === \"^=\" ? check && result.indexOf( check ) === 0 :\n\t\t\t\t\toperator === \"*=\" ? check && result.indexOf( check ) > -1 :\n\t\t\t\t\toperator === \"$=\" ? check && result.slice( -check.length ) === check :\n\t\t\t\t\toperator === \"~=\" ? ( \" \" + result.replace( rwhitespace, \" \" ) + \" \" ).indexOf( check ) > -1 :\n\t\t\t\t\toperator === \"|=\" ? result === check || result.slice( 0, check.length + 1 ) === check + \"-\" :\n\t\t\t\t\tfalse;\n\t\t\t};\n\t\t},\n\n\t\t\"CHILD\": function( type, what, argument, first, last ) {\n\t\t\tvar simple = type.slice( 0, 3 ) !== \"nth\",\n\t\t\t\tforward = type.slice( -4 ) !== \"last\",\n\t\t\t\tofType = what === \"of-type\";\n\n\t\t\treturn first === 1 && last === 0 ?\n\n\t\t\t\t// Shortcut for :nth-*(n)\n\t\t\t\tfunction( elem ) {\n\t\t\t\t\treturn !!elem.parentNode;\n\t\t\t\t} :\n\n\t\t\t\tfunction( elem, context, xml ) {\n\t\t\t\t\tvar cache, uniqueCache, outerCache, node, nodeIndex, start,\n\t\t\t\t\t\tdir = simple !== forward ? \"nextSibling\" : \"previousSibling\",\n\t\t\t\t\t\tparent = elem.parentNode,\n\t\t\t\t\t\tname = ofType && elem.nodeName.toLowerCase(),\n\t\t\t\t\t\tuseCache = !xml && !ofType,\n\t\t\t\t\t\tdiff = false;\n\n\t\t\t\t\tif ( parent ) {\n\n\t\t\t\t\t\t// :(first|last|only)-(child|of-type)\n\t\t\t\t\t\tif ( simple ) {\n\t\t\t\t\t\t\twhile ( dir ) {\n\t\t\t\t\t\t\t\tnode = elem;\n\t\t\t\t\t\t\t\twhile ( (node = node[ dir ]) ) {\n\t\t\t\t\t\t\t\t\tif ( ofType ?\n\t\t\t\t\t\t\t\t\t\tnode.nodeName.toLowerCase() === name :\n\t\t\t\t\t\t\t\t\t\tnode.nodeType === 1 ) {\n\n\t\t\t\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t// Reverse direction for :only-* (if we haven't yet done so)\n\t\t\t\t\t\t\t\tstart = dir = type === \"only\" && !start && \"nextSibling\";\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tstart = [ forward ? parent.firstChild : parent.lastChild ];\n\n\t\t\t\t\t\t// non-xml :nth-child(...) stores cache data on `parent`\n\t\t\t\t\t\tif ( forward && useCache ) {\n\n\t\t\t\t\t\t\t// Seek `elem` from a previously-cached index\n\n\t\t\t\t\t\t\t// ...in a gzip-friendly way\n\t\t\t\t\t\t\tnode = parent;\n\t\t\t\t\t\t\touterCache = node[ expando ] || (node[ expando ] = {});\n\n\t\t\t\t\t\t\t// Support: IE <9 only\n\t\t\t\t\t\t\t// Defend against cloned attroperties (jQuery gh-1709)\n\t\t\t\t\t\t\tuniqueCache = outerCache[ node.uniqueID ] ||\n\t\t\t\t\t\t\t\t(outerCache[ node.uniqueID ] = {});\n\n\t\t\t\t\t\t\tcache = uniqueCache[ type ] || [];\n\t\t\t\t\t\t\tnodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];\n\t\t\t\t\t\t\tdiff = nodeIndex && cache[ 2 ];\n\t\t\t\t\t\t\tnode = nodeIndex && parent.childNodes[ nodeIndex ];\n\n\t\t\t\t\t\t\twhile ( (node = ++nodeIndex && node && node[ dir ] ||\n\n\t\t\t\t\t\t\t\t// Fallback to seeking `elem` from the start\n\t\t\t\t\t\t\t\t(diff = nodeIndex = 0) || start.pop()) ) {\n\n\t\t\t\t\t\t\t\t// When found, cache indexes on `parent` and break\n\t\t\t\t\t\t\t\tif ( node.nodeType === 1 && ++diff && node === elem ) {\n\t\t\t\t\t\t\t\t\tuniqueCache[ type ] = [ dirruns, nodeIndex, diff ];\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t// Use previously-cached element index if available\n\t\t\t\t\t\t\tif ( useCache ) {\n\t\t\t\t\t\t\t\t// ...in a gzip-friendly way\n\t\t\t\t\t\t\t\tnode = elem;\n\t\t\t\t\t\t\t\touterCache = node[ expando ] || (node[ expando ] = {});\n\n\t\t\t\t\t\t\t\t// Support: IE <9 only\n\t\t\t\t\t\t\t\t// Defend against cloned attroperties (jQuery gh-1709)\n\t\t\t\t\t\t\t\tuniqueCache = outerCache[ node.uniqueID ] ||\n\t\t\t\t\t\t\t\t\t(outerCache[ node.uniqueID ] = {});\n\n\t\t\t\t\t\t\t\tcache = uniqueCache[ type ] || [];\n\t\t\t\t\t\t\t\tnodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];\n\t\t\t\t\t\t\t\tdiff = nodeIndex;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t// xml :nth-child(...)\n\t\t\t\t\t\t\t// or :nth-last-child(...) or :nth(-last)?-of-type(...)\n\t\t\t\t\t\t\tif ( diff === false ) {\n\t\t\t\t\t\t\t\t// Use the same loop as above to seek `elem` from the start\n\t\t\t\t\t\t\t\twhile ( (node = ++nodeIndex && node && node[ dir ] ||\n\t\t\t\t\t\t\t\t\t(diff = nodeIndex = 0) || start.pop()) ) {\n\n\t\t\t\t\t\t\t\t\tif ( ( ofType ?\n\t\t\t\t\t\t\t\t\t\tnode.nodeName.toLowerCase() === name :\n\t\t\t\t\t\t\t\t\t\tnode.nodeType === 1 ) &&\n\t\t\t\t\t\t\t\t\t\t++diff ) {\n\n\t\t\t\t\t\t\t\t\t\t// Cache the index of each encountered element\n\t\t\t\t\t\t\t\t\t\tif ( useCache ) {\n\t\t\t\t\t\t\t\t\t\t\touterCache = node[ expando ] || (node[ expando ] = {});\n\n\t\t\t\t\t\t\t\t\t\t\t// Support: IE <9 only\n\t\t\t\t\t\t\t\t\t\t\t// Defend against cloned attroperties (jQuery gh-1709)\n\t\t\t\t\t\t\t\t\t\t\tuniqueCache = outerCache[ node.uniqueID ] ||\n\t\t\t\t\t\t\t\t\t\t\t\t(outerCache[ node.uniqueID ] = {});\n\n\t\t\t\t\t\t\t\t\t\t\tuniqueCache[ type ] = [ dirruns, diff ];\n\t\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t\tif ( node === elem ) {\n\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Incorporate the offset, then check against cycle size\n\t\t\t\t\t\tdiff -= last;\n\t\t\t\t\t\treturn diff === first || ( diff % first === 0 && diff / first >= 0 );\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t},\n\n\t\t\"PSEUDO\": function( pseudo, argument ) {\n\t\t\t// pseudo-class names are case-insensitive\n\t\t\t// http://www.w3.org/TR/selectors/#pseudo-classes\n\t\t\t// Prioritize by case sensitivity in case custom pseudos are added with uppercase letters\n\t\t\t// Remember that setFilters inherits from pseudos\n\t\t\tvar args,\n\t\t\t\tfn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||\n\t\t\t\t\tSizzle.error( \"unsupported pseudo: \" + pseudo );\n\n\t\t\t// The user may use createPseudo to indicate that\n\t\t\t// arguments are needed to create the filter function\n\t\t\t// just as Sizzle does\n\t\t\tif ( fn[ expando ] ) {\n\t\t\t\treturn fn( argument );\n\t\t\t}\n\n\t\t\t// But maintain support for old signatures\n\t\t\tif ( fn.length > 1 ) {\n\t\t\t\targs = [ pseudo, pseudo, \"\", argument ];\n\t\t\t\treturn Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?\n\t\t\t\t\tmarkFunction(function( seed, matches ) {\n\t\t\t\t\t\tvar idx,\n\t\t\t\t\t\t\tmatched = fn( seed, argument ),\n\t\t\t\t\t\t\ti = matched.length;\n\t\t\t\t\t\twhile ( i-- ) {\n\t\t\t\t\t\t\tidx = indexOf( seed, matched[i] );\n\t\t\t\t\t\t\tseed[ idx ] = !( matches[ idx ] = matched[i] );\n\t\t\t\t\t\t}\n\t\t\t\t\t}) :\n\t\t\t\t\tfunction( elem ) {\n\t\t\t\t\t\treturn fn( elem, 0, args );\n\t\t\t\t\t};\n\t\t\t}\n\n\t\t\treturn fn;\n\t\t}\n\t},\n\n\tpseudos: {\n\t\t// Potentially complex pseudos\n\t\t\"not\": markFunction(function( selector ) {\n\t\t\t// Trim the selector passed to compile\n\t\t\t// to avoid treating leading and trailing\n\t\t\t// spaces as combinators\n\t\t\tvar input = [],\n\t\t\t\tresults = [],\n\t\t\t\tmatcher = compile( selector.replace( rtrim, \"$1\" ) );\n\n\t\t\treturn matcher[ expando ] ?\n\t\t\t\tmarkFunction(function( seed, matches, context, xml ) {\n\t\t\t\t\tvar elem,\n\t\t\t\t\t\tunmatched = matcher( seed, null, xml, [] ),\n\t\t\t\t\t\ti = seed.length;\n\n\t\t\t\t\t// Match elements unmatched by `matcher`\n\t\t\t\t\twhile ( i-- ) {\n\t\t\t\t\t\tif ( (elem = unmatched[i]) ) {\n\t\t\t\t\t\t\tseed[i] = !(matches[i] = elem);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}) :\n\t\t\t\tfunction( elem, context, xml ) {\n\t\t\t\t\tinput[0] = elem;\n\t\t\t\t\tmatcher( input, null, xml, results );\n\t\t\t\t\t// Don't keep the element (issue #299)\n\t\t\t\t\tinput[0] = null;\n\t\t\t\t\treturn !results.pop();\n\t\t\t\t};\n\t\t}),\n\n\t\t\"has\": markFunction(function( selector ) {\n\t\t\treturn function( elem ) {\n\t\t\t\treturn Sizzle( selector, elem ).length > 0;\n\t\t\t};\n\t\t}),\n\n\t\t\"contains\": markFunction(function( text ) {\n\t\t\ttext = text.replace( runescape, funescape );\n\t\t\treturn function( elem ) {\n\t\t\t\treturn ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1;\n\t\t\t};\n\t\t}),\n\n\t\t// \"Whether an element is represented by a :lang() selector\n\t\t// is based solely on the element's language value\n\t\t// being equal to the identifier C,\n\t\t// or beginning with the identifier C immediately followed by \"-\".\n\t\t// The matching of C against the element's language value is performed case-insensitively.\n\t\t// The identifier C does not have to be a valid language name.\"\n\t\t// http://www.w3.org/TR/selectors/#lang-pseudo\n\t\t\"lang\": markFunction( function( lang ) {\n\t\t\t// lang value must be a valid identifier\n\t\t\tif ( !ridentifier.test(lang || \"\") ) {\n\t\t\t\tSizzle.error( \"unsupported lang: \" + lang );\n\t\t\t}\n\t\t\tlang = lang.replace( runescape, funescape ).toLowerCase();\n\t\t\treturn function( elem ) {\n\t\t\t\tvar elemLang;\n\t\t\t\tdo {\n\t\t\t\t\tif ( (elemLang = documentIsHTML ?\n\t\t\t\t\t\telem.lang :\n\t\t\t\t\t\telem.getAttribute(\"xml:lang\") || elem.getAttribute(\"lang\")) ) {\n\n\t\t\t\t\t\telemLang = elemLang.toLowerCase();\n\t\t\t\t\t\treturn elemLang === lang || elemLang.indexOf( lang + \"-\" ) === 0;\n\t\t\t\t\t}\n\t\t\t\t} while ( (elem = elem.parentNode) && elem.nodeType === 1 );\n\t\t\t\treturn false;\n\t\t\t};\n\t\t}),\n\n\t\t// Miscellaneous\n\t\t\"target\": function( elem ) {\n\t\t\tvar hash = window.location && window.location.hash;\n\t\t\treturn hash && hash.slice( 1 ) === elem.id;\n\t\t},\n\n\t\t\"root\": function( elem ) {\n\t\t\treturn elem === docElem;\n\t\t},\n\n\t\t\"focus\": function( elem ) {\n\t\t\treturn elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);\n\t\t},\n\n\t\t// Boolean properties\n\t\t\"enabled\": createDisabledPseudo( false ),\n\t\t\"disabled\": createDisabledPseudo( true ),\n\n\t\t\"checked\": function( elem ) {\n\t\t\t// In CSS3, :checked should return both checked and selected elements\n\t\t\t// http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked\n\t\t\tvar nodeName = elem.nodeName.toLowerCase();\n\t\t\treturn (nodeName === \"input\" && !!elem.checked) || (nodeName === \"option\" && !!elem.selected);\n\t\t},\n\n\t\t\"selected\": function( elem ) {\n\t\t\t// Accessing this property makes selected-by-default\n\t\t\t// options in Safari work properly\n\t\t\tif ( elem.parentNode ) {\n\t\t\t\telem.parentNode.selectedIndex;\n\t\t\t}\n\n\t\t\treturn elem.selected === true;\n\t\t},\n\n\t\t// Contents\n\t\t\"empty\": function( elem ) {\n\t\t\t// http://www.w3.org/TR/selectors/#empty-pseudo\n\t\t\t// :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),\n\t\t\t// but not by others (comment: 8; processing instruction: 7; etc.)\n\t\t\t// nodeType < 6 works because attributes (2) do not appear as children\n\t\t\tfor ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {\n\t\t\t\tif ( elem.nodeType < 6 ) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn true;\n\t\t},\n\n\t\t\"parent\": function( elem ) {\n\t\t\treturn !Expr.pseudos[\"empty\"]( elem );\n\t\t},\n\n\t\t// Element/input types\n\t\t\"header\": function( elem ) {\n\t\t\treturn rheader.test( elem.nodeName );\n\t\t},\n\n\t\t\"input\": function( elem ) {\n\t\t\treturn rinputs.test( elem.nodeName );\n\t\t},\n\n\t\t\"button\": function( elem ) {\n\t\t\tvar name = elem.nodeName.toLowerCase();\n\t\t\treturn name === \"input\" && elem.type === \"button\" || name === \"button\";\n\t\t},\n\n\t\t\"text\": function( elem ) {\n\t\t\tvar attr;\n\t\t\treturn elem.nodeName.toLowerCase() === \"input\" &&\n\t\t\t\telem.type === \"text\" &&\n\n\t\t\t\t// Support: IE<8\n\t\t\t\t// New HTML5 attribute values (e.g., \"search\") appear with elem.type === \"text\"\n\t\t\t\t( (attr = elem.getAttribute(\"type\")) == null || attr.toLowerCase() === \"text\" );\n\t\t},\n\n\t\t// Position-in-collection\n\t\t\"first\": createPositionalPseudo(function() {\n\t\t\treturn [ 0 ];\n\t\t}),\n\n\t\t\"last\": createPositionalPseudo(function( matchIndexes, length ) {\n\t\t\treturn [ length - 1 ];\n\t\t}),\n\n\t\t\"eq\": createPositionalPseudo(function( matchIndexes, length, argument ) {\n\t\t\treturn [ argument < 0 ? argument + length : argument ];\n\t\t}),\n\n\t\t\"even\": createPositionalPseudo(function( matchIndexes, length ) {\n\t\t\tvar i = 0;\n\t\t\tfor ( ; i < length; i += 2 ) {\n\t\t\t\tmatchIndexes.push( i );\n\t\t\t}\n\t\t\treturn matchIndexes;\n\t\t}),\n\n\t\t\"odd\": createPositionalPseudo(function( matchIndexes, length ) {\n\t\t\tvar i = 1;\n\t\t\tfor ( ; i < length; i += 2 ) {\n\t\t\t\tmatchIndexes.push( i );\n\t\t\t}\n\t\t\treturn matchIndexes;\n\t\t}),\n\n\t\t\"lt\": createPositionalPseudo(function( matchIndexes, length, argument ) {\n\t\t\tvar i = argument < 0 ? argument + length : argument;\n\t\t\tfor ( ; --i >= 0; ) {\n\t\t\t\tmatchIndexes.push( i );\n\t\t\t}\n\t\t\treturn matchIndexes;\n\t\t}),\n\n\t\t\"gt\": createPositionalPseudo(function( matchIndexes, length, argument ) {\n\t\t\tvar i = argument < 0 ? argument + length : argument;\n\t\t\tfor ( ; ++i < length; ) {\n\t\t\t\tmatchIndexes.push( i );\n\t\t\t}\n\t\t\treturn matchIndexes;\n\t\t})\n\t}\n};\n\nExpr.pseudos[\"nth\"] = Expr.pseudos[\"eq\"];\n\n// Add button/input type pseudos\nfor ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {\n\tExpr.pseudos[ i ] = createInputPseudo( i );\n}\nfor ( i in { submit: true, reset: true } ) {\n\tExpr.pseudos[ i ] = createButtonPseudo( i );\n}\n\n// Easy API for creating new setFilters\nfunction setFilters() {}\nsetFilters.prototype = Expr.filters = Expr.pseudos;\nExpr.setFilters = new setFilters();\n\ntokenize = Sizzle.tokenize = function( selector, parseOnly ) {\n\tvar matched, match, tokens, type,\n\t\tsoFar, groups, preFilters,\n\t\tcached = tokenCache[ selector + \" \" ];\n\n\tif ( cached ) {\n\t\treturn parseOnly ? 0 : cached.slice( 0 );\n\t}\n\n\tsoFar = selector;\n\tgroups = [];\n\tpreFilters = Expr.preFilter;\n\n\twhile ( soFar ) {\n\n\t\t// Comma and first run\n\t\tif ( !matched || (match = rcomma.exec( soFar )) ) {\n\t\t\tif ( match ) {\n\t\t\t\t// Don't consume trailing commas as valid\n\t\t\t\tsoFar = soFar.slice( match[0].length ) || soFar;\n\t\t\t}\n\t\t\tgroups.push( (tokens = []) );\n\t\t}\n\n\t\tmatched = false;\n\n\t\t// Combinators\n\t\tif ( (match = rcombinators.exec( soFar )) ) {\n\t\t\tmatched = match.shift();\n\t\t\ttokens.push({\n\t\t\t\tvalue: matched,\n\t\t\t\t// Cast descendant combinators to space\n\t\t\t\ttype: match[0].replace( rtrim, \" \" )\n\t\t\t});\n\t\t\tsoFar = soFar.slice( matched.length );\n\t\t}\n\n\t\t// Filters\n\t\tfor ( type in Expr.filter ) {\n\t\t\tif ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||\n\t\t\t\t(match = preFilters[ type ]( match ))) ) {\n\t\t\t\tmatched = match.shift();\n\t\t\t\ttokens.push({\n\t\t\t\t\tvalue: matched,\n\t\t\t\t\ttype: type,\n\t\t\t\t\tmatches: match\n\t\t\t\t});\n\t\t\t\tsoFar = soFar.slice( matched.length );\n\t\t\t}\n\t\t}\n\n\t\tif ( !matched ) {\n\t\t\tbreak;\n\t\t}\n\t}\n\n\t// Return the length of the invalid excess\n\t// if we're just parsing\n\t// Otherwise, throw an error or return tokens\n\treturn parseOnly ?\n\t\tsoFar.length :\n\t\tsoFar ?\n\t\t\tSizzle.error( selector ) :\n\t\t\t// Cache the tokens\n\t\t\ttokenCache( selector, groups ).slice( 0 );\n};\n\nfunction toSelector( tokens ) {\n\tvar i = 0,\n\t\tlen = tokens.length,\n\t\tselector = \"\";\n\tfor ( ; i < len; i++ ) {\n\t\tselector += tokens[i].value;\n\t}\n\treturn selector;\n}\n\nfunction addCombinator( matcher, combinator, base ) {\n\tvar dir = combinator.dir,\n\t\tskip = combinator.next,\n\t\tkey = skip || dir,\n\t\tcheckNonElements = base && key === \"parentNode\",\n\t\tdoneName = done++;\n\n\treturn combinator.first ?\n\t\t// Check against closest ancestor/preceding element\n\t\tfunction( elem, context, xml ) {\n\t\t\twhile ( (elem = elem[ dir ]) ) {\n\t\t\t\tif ( elem.nodeType === 1 || checkNonElements ) {\n\t\t\t\t\treturn matcher( elem, context, xml );\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn false;\n\t\t} :\n\n\t\t// Check against all ancestor/preceding elements\n\t\tfunction( elem, context, xml ) {\n\t\t\tvar oldCache, uniqueCache, outerCache,\n\t\t\t\tnewCache = [ dirruns, doneName ];\n\n\t\t\t// We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching\n\t\t\tif ( xml ) {\n\t\t\t\twhile ( (elem = elem[ dir ]) ) {\n\t\t\t\t\tif ( elem.nodeType === 1 || checkNonElements ) {\n\t\t\t\t\t\tif ( matcher( elem, context, xml ) ) {\n\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\twhile ( (elem = elem[ dir ]) ) {\n\t\t\t\t\tif ( elem.nodeType === 1 || checkNonElements ) {\n\t\t\t\t\t\touterCache = elem[ expando ] || (elem[ expando ] = {});\n\n\t\t\t\t\t\t// Support: IE <9 only\n\t\t\t\t\t\t// Defend against cloned attroperties (jQuery gh-1709)\n\t\t\t\t\t\tuniqueCache = outerCache[ elem.uniqueID ] || (outerCache[ elem.uniqueID ] = {});\n\n\t\t\t\t\t\tif ( skip && skip === elem.nodeName.toLowerCase() ) {\n\t\t\t\t\t\t\telem = elem[ dir ] || elem;\n\t\t\t\t\t\t} else if ( (oldCache = uniqueCache[ key ]) &&\n\t\t\t\t\t\t\toldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) {\n\n\t\t\t\t\t\t\t// Assign to newCache so results back-propagate to previous elements\n\t\t\t\t\t\t\treturn (newCache[ 2 ] = oldCache[ 2 ]);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t// Reuse newcache so results back-propagate to previous elements\n\t\t\t\t\t\t\tuniqueCache[ key ] = newCache;\n\n\t\t\t\t\t\t\t// A match means we're done; a fail means we have to keep checking\n\t\t\t\t\t\t\tif ( (newCache[ 2 ] = matcher( elem, context, xml )) ) {\n\t\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn false;\n\t\t};\n}\n\nfunction elementMatcher( matchers ) {\n\treturn matchers.length > 1 ?\n\t\tfunction( elem, context, xml ) {\n\t\t\tvar i = matchers.length;\n\t\t\twhile ( i-- ) {\n\t\t\t\tif ( !matchers[i]( elem, context, xml ) ) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn true;\n\t\t} :\n\t\tmatchers[0];\n}\n\nfunction multipleContexts( selector, contexts, results ) {\n\tvar i = 0,\n\t\tlen = contexts.length;\n\tfor ( ; i < len; i++ ) {\n\t\tSizzle( selector, contexts[i], results );\n\t}\n\treturn results;\n}\n\nfunction condense( unmatched, map, filter, context, xml ) {\n\tvar elem,\n\t\tnewUnmatched = [],\n\t\ti = 0,\n\t\tlen = unmatched.length,\n\t\tmapped = map != null;\n\n\tfor ( ; i < len; i++ ) {\n\t\tif ( (elem = unmatched[i]) ) {\n\t\t\tif ( !filter || filter( elem, context, xml ) ) {\n\t\t\t\tnewUnmatched.push( elem );\n\t\t\t\tif ( mapped ) {\n\t\t\t\t\tmap.push( i );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn newUnmatched;\n}\n\nfunction setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {\n\tif ( postFilter && !postFilter[ expando ] ) {\n\t\tpostFilter = setMatcher( postFilter );\n\t}\n\tif ( postFinder && !postFinder[ expando ] ) {\n\t\tpostFinder = setMatcher( postFinder, postSelector );\n\t}\n\treturn markFunction(function( seed, results, context, xml ) {\n\t\tvar temp, i, elem,\n\t\t\tpreMap = [],\n\t\t\tpostMap = [],\n\t\t\tpreexisting = results.length,\n\n\t\t\t// Get initial elements from seed or context\n\t\t\telems = seed || multipleContexts( selector || \"*\", context.nodeType ? [ context ] : context, [] ),\n\n\t\t\t// Prefilter to get matcher input, preserving a map for seed-results synchronization\n\t\t\tmatcherIn = preFilter && ( seed || !selector ) ?\n\t\t\t\tcondense( elems, preMap, preFilter, context, xml ) :\n\t\t\t\telems,\n\n\t\t\tmatcherOut = matcher ?\n\t\t\t\t// If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,\n\t\t\t\tpostFinder || ( seed ? preFilter : preexisting || postFilter ) ?\n\n\t\t\t\t\t// ...intermediate processing is necessary\n\t\t\t\t\t[] :\n\n\t\t\t\t\t// ...otherwise use results directly\n\t\t\t\t\tresults :\n\t\t\t\tmatcherIn;\n\n\t\t// Find primary matches\n\t\tif ( matcher ) {\n\t\t\tmatcher( matcherIn, matcherOut, context, xml );\n\t\t}\n\n\t\t// Apply postFilter\n\t\tif ( postFilter ) {\n\t\t\ttemp = condense( matcherOut, postMap );\n\t\t\tpostFilter( temp, [], context, xml );\n\n\t\t\t// Un-match failing elements by moving them back to matcherIn\n\t\t\ti = temp.length;\n\t\t\twhile ( i-- ) {\n\t\t\t\tif ( (elem = temp[i]) ) {\n\t\t\t\t\tmatcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif ( seed ) {\n\t\t\tif ( postFinder || preFilter ) {\n\t\t\t\tif ( postFinder ) {\n\t\t\t\t\t// Get the final matcherOut by condensing this intermediate into postFinder contexts\n\t\t\t\t\ttemp = [];\n\t\t\t\t\ti = matcherOut.length;\n\t\t\t\t\twhile ( i-- ) {\n\t\t\t\t\t\tif ( (elem = matcherOut[i]) ) {\n\t\t\t\t\t\t\t// Restore matcherIn since elem is not yet a final match\n\t\t\t\t\t\t\ttemp.push( (matcherIn[i] = elem) );\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tpostFinder( null, (matcherOut = []), temp, xml );\n\t\t\t\t}\n\n\t\t\t\t// Move matched elements from seed to results to keep them synchronized\n\t\t\t\ti = matcherOut.length;\n\t\t\t\twhile ( i-- ) {\n\t\t\t\t\tif ( (elem = matcherOut[i]) &&\n\t\t\t\t\t\t(temp = postFinder ? indexOf( seed, elem ) : preMap[i]) > -1 ) {\n\n\t\t\t\t\t\tseed[temp] = !(results[temp] = elem);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t// Add elements to results, through postFinder if defined\n\t\t} else {\n\t\t\tmatcherOut = condense(\n\t\t\t\tmatcherOut === results ?\n\t\t\t\t\tmatcherOut.splice( preexisting, matcherOut.length ) :\n\t\t\t\t\tmatcherOut\n\t\t\t);\n\t\t\tif ( postFinder ) {\n\t\t\t\tpostFinder( null, results, matcherOut, xml );\n\t\t\t} else {\n\t\t\t\tpush.apply( results, matcherOut );\n\t\t\t}\n\t\t}\n\t});\n}\n\nfunction matcherFromTokens( tokens ) {\n\tvar checkContext, matcher, j,\n\t\tlen = tokens.length,\n\t\tleadingRelative = Expr.relative[ tokens[0].type ],\n\t\timplicitRelative = leadingRelative || Expr.relative[\" \"],\n\t\ti = leadingRelative ? 1 : 0,\n\n\t\t// The foundational matcher ensures that elements are reachable from top-level context(s)\n\t\tmatchContext = addCombinator( function( elem ) {\n\t\t\treturn elem === checkContext;\n\t\t}, implicitRelative, true ),\n\t\tmatchAnyContext = addCombinator( function( elem ) {\n\t\t\treturn indexOf( checkContext, elem ) > -1;\n\t\t}, implicitRelative, true ),\n\t\tmatchers = [ function( elem, context, xml ) {\n\t\t\tvar ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || (\n\t\t\t\t(checkContext = context).nodeType ?\n\t\t\t\t\tmatchContext( elem, context, xml ) :\n\t\t\t\t\tmatchAnyContext( elem, context, xml ) );\n\t\t\t// Avoid hanging onto element (issue #299)\n\t\t\tcheckContext = null;\n\t\t\treturn ret;\n\t\t} ];\n\n\tfor ( ; i < len; i++ ) {\n\t\tif ( (matcher = Expr.relative[ tokens[i].type ]) ) {\n\t\t\tmatchers = [ addCombinator(elementMatcher( matchers ), matcher) ];\n\t\t} else {\n\t\t\tmatcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );\n\n\t\t\t// Return special upon seeing a positional matcher\n\t\t\tif ( matcher[ expando ] ) {\n\t\t\t\t// Find the next relative operator (if any) for proper handling\n\t\t\t\tj = ++i;\n\t\t\t\tfor ( ; j < len; j++ ) {\n\t\t\t\t\tif ( Expr.relative[ tokens[j].type ] ) {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn setMatcher(\n\t\t\t\t\ti > 1 && elementMatcher( matchers ),\n\t\t\t\t\ti > 1 && toSelector(\n\t\t\t\t\t\t// If the preceding token was a descendant combinator, insert an implicit any-element `*`\n\t\t\t\t\t\ttokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === \" \" ? \"*\" : \"\" })\n\t\t\t\t\t).replace( rtrim, \"$1\" ),\n\t\t\t\t\tmatcher,\n\t\t\t\t\ti < j && matcherFromTokens( tokens.slice( i, j ) ),\n\t\t\t\t\tj < len && matcherFromTokens( (tokens = tokens.slice( j )) ),\n\t\t\t\t\tj < len && toSelector( tokens )\n\t\t\t\t);\n\t\t\t}\n\t\t\tmatchers.push( matcher );\n\t\t}\n\t}\n\n\treturn elementMatcher( matchers );\n}\n\nfunction matcherFromGroupMatchers( elementMatchers, setMatchers ) {\n\tvar bySet = setMatchers.length > 0,\n\t\tbyElement = elementMatchers.length > 0,\n\t\tsuperMatcher = function( seed, context, xml, results, outermost ) {\n\t\t\tvar elem, j, matcher,\n\t\t\t\tmatchedCount = 0,\n\t\t\t\ti = \"0\",\n\t\t\t\tunmatched = seed && [],\n\t\t\t\tsetMatched = [],\n\t\t\t\tcontextBackup = outermostContext,\n\t\t\t\t// We must always have either seed elements or outermost context\n\t\t\t\telems = seed || byElement && Expr.find[\"TAG\"]( \"*\", outermost ),\n\t\t\t\t// Use integer dirruns iff this is the outermost matcher\n\t\t\t\tdirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1),\n\t\t\t\tlen = elems.length;\n\n\t\t\tif ( outermost ) {\n\t\t\t\toutermostContext = context === document || context || outermost;\n\t\t\t}\n\n\t\t\t// Add elements passing elementMatchers directly to results\n\t\t\t// Support: IE<9, Safari\n\t\t\t// Tolerate NodeList properties (IE: \"length\"; Safari: <number>) matching elements by id\n\t\t\tfor ( ; i !== len && (elem = elems[i]) != null; i++ ) {\n\t\t\t\tif ( byElement && elem ) {\n\t\t\t\t\tj = 0;\n\t\t\t\t\tif ( !context && elem.ownerDocument !== document ) {\n\t\t\t\t\t\tsetDocument( elem );\n\t\t\t\t\t\txml = !documentIsHTML;\n\t\t\t\t\t}\n\t\t\t\t\twhile ( (matcher = elementMatchers[j++]) ) {\n\t\t\t\t\t\tif ( matcher( elem, context || document, xml) ) {\n\t\t\t\t\t\t\tresults.push( elem );\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif ( outermost ) {\n\t\t\t\t\t\tdirruns = dirrunsUnique;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// Track unmatched elements for set filters\n\t\t\t\tif ( bySet ) {\n\t\t\t\t\t// They will have gone through all possible matchers\n\t\t\t\t\tif ( (elem = !matcher && elem) ) {\n\t\t\t\t\t\tmatchedCount--;\n\t\t\t\t\t}\n\n\t\t\t\t\t// Lengthen the array for every element, matched or not\n\t\t\t\t\tif ( seed ) {\n\t\t\t\t\t\tunmatched.push( elem );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// `i` is now the count of elements visited above, and adding it to `matchedCount`\n\t\t\t// makes the latter nonnegative.\n\t\t\tmatchedCount += i;\n\n\t\t\t// Apply set filters to unmatched elements\n\t\t\t// NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount`\n\t\t\t// equals `i`), unless we didn't visit _any_ elements in the above loop because we have\n\t\t\t// no element matchers and no seed.\n\t\t\t// Incrementing an initially-string \"0\" `i` allows `i` to remain a string only in that\n\t\t\t// case, which will result in a \"00\" `matchedCount` that differs from `i` but is also\n\t\t\t// numerically zero.\n\t\t\tif ( bySet && i !== matchedCount ) {\n\t\t\t\tj = 0;\n\t\t\t\twhile ( (matcher = setMatchers[j++]) ) {\n\t\t\t\t\tmatcher( unmatched, setMatched, context, xml );\n\t\t\t\t}\n\n\t\t\t\tif ( seed ) {\n\t\t\t\t\t// Reintegrate element matches to eliminate the need for sorting\n\t\t\t\t\tif ( matchedCount > 0 ) {\n\t\t\t\t\t\twhile ( i-- ) {\n\t\t\t\t\t\t\tif ( !(unmatched[i] || setMatched[i]) ) {\n\t\t\t\t\t\t\t\tsetMatched[i] = pop.call( results );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t// Discard index placeholder values to get only actual matches\n\t\t\t\t\tsetMatched = condense( setMatched );\n\t\t\t\t}\n\n\t\t\t\t// Add matches to results\n\t\t\t\tpush.apply( results, setMatched );\n\n\t\t\t\t// Seedless set matches succeeding multiple successful matchers stipulate sorting\n\t\t\t\tif ( outermost && !seed && setMatched.length > 0 &&\n\t\t\t\t\t( matchedCount + setMatchers.length ) > 1 ) {\n\n\t\t\t\t\tSizzle.uniqueSort( results );\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Override manipulation of globals by nested matchers\n\t\t\tif ( outermost ) {\n\t\t\t\tdirruns = dirrunsUnique;\n\t\t\t\toutermostContext = contextBackup;\n\t\t\t}\n\n\t\t\treturn unmatched;\n\t\t};\n\n\treturn bySet ?\n\t\tmarkFunction( superMatcher ) :\n\t\tsuperMatcher;\n}\n\ncompile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) {\n\tvar i,\n\t\tsetMatchers = [],\n\t\telementMatchers = [],\n\t\tcached = compilerCache[ selector + \" \" ];\n\n\tif ( !cached ) {\n\t\t// Generate a function of recursive functions that can be used to check each element\n\t\tif ( !match ) {\n\t\t\tmatch = tokenize( selector );\n\t\t}\n\t\ti = match.length;\n\t\twhile ( i-- ) {\n\t\t\tcached = matcherFromTokens( match[i] );\n\t\t\tif ( cached[ expando ] ) {\n\t\t\t\tsetMatchers.push( cached );\n\t\t\t} else {\n\t\t\t\telementMatchers.push( cached );\n\t\t\t}\n\t\t}\n\n\t\t// Cache the compiled function\n\t\tcached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) );\n\n\t\t// Save selector and tokenization\n\t\tcached.selector = selector;\n\t}\n\treturn cached;\n};\n\n/**\n * A low-level selection function that works with Sizzle's compiled\n * selector functions\n * @param {String|Function} selector A selector or a pre-compiled\n * selector function built with Sizzle.compile\n * @param {Element} context\n * @param {Array} [results]\n * @param {Array} [seed] A set of elements to match against\n */\nselect = Sizzle.select = function( selector, context, results, seed ) {\n\tvar i, tokens, token, type, find,\n\t\tcompiled = typeof selector === \"function\" && selector,\n\t\tmatch = !seed && tokenize( (selector = compiled.selector || selector) );\n\n\tresults = results || [];\n\n\t// Try to minimize operations if there is only one selector in the list and no seed\n\t// (the latter of which guarantees us context)\n\tif ( match.length === 1 ) {\n\n\t\t// Reduce context if the leading compound selector is an ID\n\t\ttokens = match[0] = match[0].slice( 0 );\n\t\tif ( tokens.length > 2 && (token = tokens[0]).type === \"ID\" &&\n\t\t\t\tcontext.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[1].type ] ) {\n\n\t\t\tcontext = ( Expr.find[\"ID\"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0];\n\t\t\tif ( !context ) {\n\t\t\t\treturn results;\n\n\t\t\t// Precompiled matchers will still verify ancestry, so step up a level\n\t\t\t} else if ( compiled ) {\n\t\t\t\tcontext = context.parentNode;\n\t\t\t}\n\n\t\t\tselector = selector.slice( tokens.shift().value.length );\n\t\t}\n\n\t\t// Fetch a seed set for right-to-left matching\n\t\ti = matchExpr[\"needsContext\"].test( selector ) ? 0 : tokens.length;\n\t\twhile ( i-- ) {\n\t\t\ttoken = tokens[i];\n\n\t\t\t// Abort if we hit a combinator\n\t\t\tif ( Expr.relative[ (type = token.type) ] ) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif ( (find = Expr.find[ type ]) ) {\n\t\t\t\t// Search, expanding context for leading sibling combinators\n\t\t\t\tif ( (seed = find(\n\t\t\t\t\ttoken.matches[0].replace( runescape, funescape ),\n\t\t\t\t\trsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context\n\t\t\t\t)) ) {\n\n\t\t\t\t\t// If seed is empty or no tokens remain, we can return early\n\t\t\t\t\ttokens.splice( i, 1 );\n\t\t\t\t\tselector = seed.length && toSelector( tokens );\n\t\t\t\t\tif ( !selector ) {\n\t\t\t\t\t\tpush.apply( results, seed );\n\t\t\t\t\t\treturn results;\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// Compile and execute a filtering function if one is not provided\n\t// Provide `match` to avoid retokenization if we modified the selector above\n\t( compiled || compile( selector, match ) )(\n\t\tseed,\n\t\tcontext,\n\t\t!documentIsHTML,\n\t\tresults,\n\t\t!context || rsibling.test( selector ) && testContext( context.parentNode ) || context\n\t);\n\treturn results;\n};\n\n// One-time assignments\n\n// Sort stability\nsupport.sortStable = expando.split(\"\").sort( sortOrder ).join(\"\") === expando;\n\n// Support: Chrome 14-35+\n// Always assume duplicates if they aren't passed to the comparison function\nsupport.detectDuplicates = !!hasDuplicate;\n\n// Initialize against the default document\nsetDocument();\n\n// Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)\n// Detached nodes confoundingly follow *each other*\nsupport.sortDetached = assert(function( el ) {\n\t// Should return 1, but returns 4 (following)\n\treturn el.compareDocumentPosition( document.createElement(\"fieldset\") ) & 1;\n});\n\n// Support: IE<8\n// Prevent attribute/property \"interpolation\"\n// https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx\nif ( !assert(function( el ) {\n\tel.innerHTML = \"<a href='#'></a>\";\n\treturn el.firstChild.getAttribute(\"href\") === \"#\" ;\n}) ) {\n\taddHandle( \"type|href|height|width\", function( elem, name, isXML ) {\n\t\tif ( !isXML ) {\n\t\t\treturn elem.getAttribute( name, name.toLowerCase() === \"type\" ? 1 : 2 );\n\t\t}\n\t});\n}\n\n// Support: IE<9\n// Use defaultValue in place of getAttribute(\"value\")\nif ( !support.attributes || !assert(function( el ) {\n\tel.innerHTML = \"<input/>\";\n\tel.firstChild.setAttribute( \"value\", \"\" );\n\treturn el.firstChild.getAttribute( \"value\" ) === \"\";\n}) ) {\n\taddHandle( \"value\", function( elem, name, isXML ) {\n\t\tif ( !isXML && elem.nodeName.toLowerCase() === \"input\" ) {\n\t\t\treturn elem.defaultValue;\n\t\t}\n\t});\n}\n\n// Support: IE<9\n// Use getAttributeNode to fetch booleans when getAttribute lies\nif ( !assert(function( el ) {\n\treturn el.getAttribute(\"disabled\") == null;\n}) ) {\n\taddHandle( booleans, function( elem, name, isXML ) {\n\t\tvar val;\n\t\tif ( !isXML ) {\n\t\t\treturn elem[ name ] === true ? name.toLowerCase() :\n\t\t\t\t\t(val = elem.getAttributeNode( name )) && val.specified ?\n\t\t\t\t\tval.value :\n\t\t\t\tnull;\n\t\t}\n\t});\n}\n\nreturn Sizzle;\n\n})( window );\n\n\n\njQuery.find = Sizzle;\njQuery.expr = Sizzle.selectors;\n\n// Deprecated\njQuery.expr[ \":\" ] = jQuery.expr.pseudos;\njQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort;\njQuery.text = Sizzle.getText;\njQuery.isXMLDoc = Sizzle.isXML;\njQuery.contains = Sizzle.contains;\njQuery.escapeSelector = Sizzle.escape;\n\n\n\n\nvar dir = function( elem, dir, until ) {\n\tvar matched = [],\n\t\ttruncate = until !== undefined;\n\n\twhile ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) {\n\t\tif ( elem.nodeType === 1 ) {\n\t\t\tif ( truncate && jQuery( elem ).is( until ) ) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tmatched.push( elem );\n\t\t}\n\t}\n\treturn matched;\n};\n\n\nvar siblings = function( n, elem ) {\n\tvar matched = [];\n\n\tfor ( ; n; n = n.nextSibling ) {\n\t\tif ( n.nodeType === 1 && n !== elem ) {\n\t\t\tmatched.push( n );\n\t\t}\n\t}\n\n\treturn matched;\n};\n\n\nvar rneedsContext = jQuery.expr.match.needsContext;\n\n\n\nfunction nodeName( elem, name ) {\n\n return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();\n\n};\nvar rsingleTag = ( /^<([a-z][^\\/\\0>:\\x20\\t\\r\\n\\f]*)[\\x20\\t\\r\\n\\f]*\\/?>(?:<\\/\\1>|)$/i );\n\n\n\n// Implement the identical functionality for filter and not\nfunction winnow( elements, qualifier, not ) {\n\tif ( isFunction( qualifier ) ) {\n\t\treturn jQuery.grep( elements, function( elem, i ) {\n\t\t\treturn !!qualifier.call( elem, i, elem ) !== not;\n\t\t} );\n\t}\n\n\t// Single element\n\tif ( qualifier.nodeType ) {\n\t\treturn jQuery.grep( elements, function( elem ) {\n\t\t\treturn ( elem === qualifier ) !== not;\n\t\t} );\n\t}\n\n\t// Arraylike of elements (jQuery, arguments, Array)\n\tif ( typeof qualifier !== \"string\" ) {\n\t\treturn jQuery.grep( elements, function( elem ) {\n\t\t\treturn ( indexOf.call( qualifier, elem ) > -1 ) !== not;\n\t\t} );\n\t}\n\n\t// Filtered directly for both simple and complex selectors\n\treturn jQuery.filter( qualifier, elements, not );\n}\n\njQuery.filter = function( expr, elems, not ) {\n\tvar elem = elems[ 0 ];\n\n\tif ( not ) {\n\t\texpr = \":not(\" + expr + \")\";\n\t}\n\n\tif ( elems.length === 1 && elem.nodeType === 1 ) {\n\t\treturn jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [];\n\t}\n\n\treturn jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) {\n\t\treturn elem.nodeType === 1;\n\t} ) );\n};\n\njQuery.fn.extend( {\n\tfind: function( selector ) {\n\t\tvar i, ret,\n\t\t\tlen = this.length,\n\t\t\tself = this;\n\n\t\tif ( typeof selector !== \"string\" ) {\n\t\t\treturn this.pushStack( jQuery( selector ).filter( function() {\n\t\t\t\tfor ( i = 0; i < len; i++ ) {\n\t\t\t\t\tif ( jQuery.contains( self[ i ], this ) ) {\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} ) );\n\t\t}\n\n\t\tret = this.pushStack( [] );\n\n\t\tfor ( i = 0; i < len; i++ ) {\n\t\t\tjQuery.find( selector, self[ i ], ret );\n\t\t}\n\n\t\treturn len > 1 ? jQuery.uniqueSort( ret ) : ret;\n\t},\n\tfilter: function( selector ) {\n\t\treturn this.pushStack( winnow( this, selector || [], false ) );\n\t},\n\tnot: function( selector ) {\n\t\treturn this.pushStack( winnow( this, selector || [], true ) );\n\t},\n\tis: function( selector ) {\n\t\treturn !!winnow(\n\t\t\tthis,\n\n\t\t\t// If this is a positional/relative selector, check membership in the returned set\n\t\t\t// so $(\"p:first\").is(\"p:last\") won't return true for a doc with two \"p\".\n\t\t\ttypeof selector === \"string\" && rneedsContext.test( selector ) ?\n\t\t\t\tjQuery( selector ) :\n\t\t\t\tselector || [],\n\t\t\tfalse\n\t\t).length;\n\t}\n} );\n\n\n// Initialize a jQuery object\n\n\n// A central reference to the root jQuery(document)\nvar rootjQuery,\n\n\t// A simple way to check for HTML strings\n\t// Prioritize #id over <tag> to avoid XSS via location.hash (#9521)\n\t// Strict HTML recognition (#11290: must start with <)\n\t// Shortcut simple #id case for speed\n\trquickExpr = /^(?:\\s*(<[\\w\\W]+>)[^>]*|#([\\w-]+))$/,\n\n\tinit = jQuery.fn.init = function( selector, context, root ) {\n\t\tvar match, elem;\n\n\t\t// HANDLE: $(\"\"), $(null), $(undefined), $(false)\n\t\tif ( !selector ) {\n\t\t\treturn this;\n\t\t}\n\n\t\t// Method init() accepts an alternate rootjQuery\n\t\t// so migrate can support jQuery.sub (gh-2101)\n\t\troot = root || rootjQuery;\n\n\t\t// Handle HTML strings\n\t\tif ( typeof selector === \"string\" ) {\n\t\t\tif ( selector[ 0 ] === \"<\" &&\n\t\t\t\tselector[ selector.length - 1 ] === \">\" &&\n\t\t\t\tselector.length >= 3 ) {\n\n\t\t\t\t// Assume that strings that start and end with <> are HTML and skip the regex check\n\t\t\t\tmatch = [ null, selector, null ];\n\n\t\t\t} else {\n\t\t\t\tmatch = rquickExpr.exec( selector );\n\t\t\t}\n\n\t\t\t// Match html or make sure no context is specified for #id\n\t\t\tif ( match && ( match[ 1 ] || !context ) ) {\n\n\t\t\t\t// HANDLE: $(html) -> $(array)\n\t\t\t\tif ( match[ 1 ] ) {\n\t\t\t\t\tcontext = context instanceof jQuery ? context[ 0 ] : context;\n\n\t\t\t\t\t// Option to run scripts is true for back-compat\n\t\t\t\t\t// Intentionally let the error be thrown if parseHTML is not present\n\t\t\t\t\tjQuery.merge( this, jQuery.parseHTML(\n\t\t\t\t\t\tmatch[ 1 ],\n\t\t\t\t\t\tcontext && context.nodeType ? context.ownerDocument || context : document,\n\t\t\t\t\t\ttrue\n\t\t\t\t\t) );\n\n\t\t\t\t\t// HANDLE: $(html, props)\n\t\t\t\t\tif ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) {\n\t\t\t\t\t\tfor ( match in context ) {\n\n\t\t\t\t\t\t\t// Properties of context are called as methods if possible\n\t\t\t\t\t\t\tif ( isFunction( this[ match ] ) ) {\n\t\t\t\t\t\t\t\tthis[ match ]( context[ match ] );\n\n\t\t\t\t\t\t\t// ...and otherwise set as attributes\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tthis.attr( match, context[ match ] );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\treturn this;\n\n\t\t\t\t// HANDLE: $(#id)\n\t\t\t\t} else {\n\t\t\t\t\telem = document.getElementById( match[ 2 ] );\n\n\t\t\t\t\tif ( elem ) {\n\n\t\t\t\t\t\t// Inject the element directly into the jQuery object\n\t\t\t\t\t\tthis[ 0 ] = elem;\n\t\t\t\t\t\tthis.length = 1;\n\t\t\t\t\t}\n\t\t\t\t\treturn this;\n\t\t\t\t}\n\n\t\t\t// HANDLE: $(expr, $(...))\n\t\t\t} else if ( !context || context.jquery ) {\n\t\t\t\treturn ( context || root ).find( selector );\n\n\t\t\t// HANDLE: $(expr, context)\n\t\t\t// (which is just equivalent to: $(context).find(expr)\n\t\t\t} else {\n\t\t\t\treturn this.constructor( context ).find( selector );\n\t\t\t}\n\n\t\t// HANDLE: $(DOMElement)\n\t\t} else if ( selector.nodeType ) {\n\t\t\tthis[ 0 ] = selector;\n\t\t\tthis.length = 1;\n\t\t\treturn this;\n\n\t\t// HANDLE: $(function)\n\t\t// Shortcut for document ready\n\t\t} else if ( isFunction( selector ) ) {\n\t\t\treturn root.ready !== undefined ?\n\t\t\t\troot.ready( selector ) :\n\n\t\t\t\t// Execute immediately if ready is not present\n\t\t\t\tselector( jQuery );\n\t\t}\n\n\t\treturn jQuery.makeArray( selector, this );\n\t};\n\n// Give the init function the jQuery prototype for later instantiation\ninit.prototype = jQuery.fn;\n\n// Initialize central reference\nrootjQuery = jQuery( document );\n\n\nvar rparentsprev = /^(?:parents|prev(?:Until|All))/,\n\n\t// Methods guaranteed to produce a unique set when starting from a unique set\n\tguaranteedUnique = {\n\t\tchildren: true,\n\t\tcontents: true,\n\t\tnext: true,\n\t\tprev: true\n\t};\n\njQuery.fn.extend( {\n\thas: function( target ) {\n\t\tvar targets = jQuery( target, this ),\n\t\t\tl = targets.length;\n\n\t\treturn this.filter( function() {\n\t\t\tvar i = 0;\n\t\t\tfor ( ; i < l; i++ ) {\n\t\t\t\tif ( jQuery.contains( this, targets[ i ] ) ) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\t\t} );\n\t},\n\n\tclosest: function( selectors, context ) {\n\t\tvar cur,\n\t\t\ti = 0,\n\t\t\tl = this.length,\n\t\t\tmatched = [],\n\t\t\ttargets = typeof selectors !== \"string\" && jQuery( selectors );\n\n\t\t// Positional selectors never match, since there's no _selection_ context\n\t\tif ( !rneedsContext.test( selectors ) ) {\n\t\t\tfor ( ; i < l; i++ ) {\n\t\t\t\tfor ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) {\n\n\t\t\t\t\t// Always skip document fragments\n\t\t\t\t\tif ( cur.nodeType < 11 && ( targets ?\n\t\t\t\t\t\ttargets.index( cur ) > -1 :\n\n\t\t\t\t\t\t// Don't pass non-elements to Sizzle\n\t\t\t\t\t\tcur.nodeType === 1 &&\n\t\t\t\t\t\t\tjQuery.find.matchesSelector( cur, selectors ) ) ) {\n\n\t\t\t\t\t\tmatched.push( cur );\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched );\n\t},\n\n\t// Determine the position of an element within the set\n\tindex: function( elem ) {\n\n\t\t// No argument, return index in parent\n\t\tif ( !elem ) {\n\t\t\treturn ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1;\n\t\t}\n\n\t\t// Index in selector\n\t\tif ( typeof elem === \"string\" ) {\n\t\t\treturn indexOf.call( jQuery( elem ), this[ 0 ] );\n\t\t}\n\n\t\t// Locate the position of the desired element\n\t\treturn indexOf.call( this,\n\n\t\t\t// If it receives a jQuery object, the first element is used\n\t\t\telem.jquery ? elem[ 0 ] : elem\n\t\t);\n\t},\n\n\tadd: function( selector, context ) {\n\t\treturn this.pushStack(\n\t\t\tjQuery.uniqueSort(\n\t\t\t\tjQuery.merge( this.get(), jQuery( selector, context ) )\n\t\t\t)\n\t\t);\n\t},\n\n\taddBack: function( selector ) {\n\t\treturn this.add( selector == null ?\n\t\t\tthis.prevObject : this.prevObject.filter( selector )\n\t\t);\n\t}\n} );\n\nfunction sibling( cur, dir ) {\n\twhile ( ( cur = cur[ dir ] ) && cur.nodeType !== 1 ) {}\n\treturn cur;\n}\n\njQuery.each( {\n\tparent: function( elem ) {\n\t\tvar parent = elem.parentNode;\n\t\treturn parent && parent.nodeType !== 11 ? parent : null;\n\t},\n\tparents: function( elem ) {\n\t\treturn dir( elem, \"parentNode\" );\n\t},\n\tparentsUntil: function( elem, i, until ) {\n\t\treturn dir( elem, \"parentNode\", until );\n\t},\n\tnext: function( elem ) {\n\t\treturn sibling( elem, \"nextSibling\" );\n\t},\n\tprev: function( elem ) {\n\t\treturn sibling( elem, \"previousSibling\" );\n\t},\n\tnextAll: function( elem ) {\n\t\treturn dir( elem, \"nextSibling\" );\n\t},\n\tprevAll: function( elem ) {\n\t\treturn dir( elem, \"previousSibling\" );\n\t},\n\tnextUntil: function( elem, i, until ) {\n\t\treturn dir( elem, \"nextSibling\", until );\n\t},\n\tprevUntil: function( elem, i, until ) {\n\t\treturn dir( elem, \"previousSibling\", until );\n\t},\n\tsiblings: function( elem ) {\n\t\treturn siblings( ( elem.parentNode || {} ).firstChild, elem );\n\t},\n\tchildren: function( elem ) {\n\t\treturn siblings( elem.firstChild );\n\t},\n\tcontents: function( elem ) {\n if ( nodeName( elem, \"iframe\" ) ) {\n return elem.contentDocument;\n }\n\n // Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only\n // Treat the template element as a regular one in browsers that\n // don't support it.\n if ( nodeName( elem, \"template\" ) ) {\n elem = elem.content || elem;\n }\n\n return jQuery.merge( [], elem.childNodes );\n\t}\n}, function( name, fn ) {\n\tjQuery.fn[ name ] = function( until, selector ) {\n\t\tvar matched = jQuery.map( this, fn, until );\n\n\t\tif ( name.slice( -5 ) !== \"Until\" ) {\n\t\t\tselector = until;\n\t\t}\n\n\t\tif ( selector && typeof selector === \"string\" ) {\n\t\t\tmatched = jQuery.filter( selector, matched );\n\t\t}\n\n\t\tif ( this.length > 1 ) {\n\n\t\t\t// Remove duplicates\n\t\t\tif ( !guaranteedUnique[ name ] ) {\n\t\t\t\tjQuery.uniqueSort( matched );\n\t\t\t}\n\n\t\t\t// Reverse order for parents* and prev-derivatives\n\t\t\tif ( rparentsprev.test( name ) ) {\n\t\t\t\tmatched.reverse();\n\t\t\t}\n\t\t}\n\n\t\treturn this.pushStack( matched );\n\t};\n} );\nvar rnothtmlwhite = ( /[^\\x20\\t\\r\\n\\f]+/g );\n\n\n\n// Convert String-formatted options into Object-formatted ones\nfunction createOptions( options ) {\n\tvar object = {};\n\tjQuery.each( options.match( rnothtmlwhite ) || [], function( _, flag ) {\n\t\tobject[ flag ] = true;\n\t} );\n\treturn object;\n}\n\n/*\n * Create a callback list using the following parameters:\n *\n *\toptions: an optional list of space-separated options that will change how\n *\t\t\tthe callback list behaves or a more traditional option object\n *\n * By default a callback list will act like an event callback list and can be\n * \"fired\" multiple times.\n *\n * Possible options:\n *\n *\tonce:\t\t\twill ensure the callback list can only be fired once (like a Deferred)\n *\n *\tmemory:\t\t\twill keep track of previous values and will call any callback added\n *\t\t\t\t\tafter the list has been fired right away with the latest \"memorized\"\n *\t\t\t\t\tvalues (like a Deferred)\n *\n *\tunique:\t\t\twill ensure a callback can only be added once (no duplicate in the list)\n *\n *\tstopOnFalse:\tinterrupt callings when a callback returns false\n *\n */\njQuery.Callbacks = function( options ) {\n\n\t// Convert options from String-formatted to Object-formatted if needed\n\t// (we check in cache first)\n\toptions = typeof options === \"string\" ?\n\t\tcreateOptions( options ) :\n\t\tjQuery.extend( {}, options );\n\n\tvar // Flag to know if list is currently firing\n\t\tfiring,\n\n\t\t// Last fire value for non-forgettable lists\n\t\tmemory,\n\n\t\t// Flag to know if list was already fired\n\t\tfired,\n\n\t\t// Flag to prevent firing\n\t\tlocked,\n\n\t\t// Actual callback list\n\t\tlist = [],\n\n\t\t// Queue of execution data for repeatable lists\n\t\tqueue = [],\n\n\t\t// Index of currently firing callback (modified by add/remove as needed)\n\t\tfiringIndex = -1,\n\n\t\t// Fire callbacks\n\t\tfire = function() {\n\n\t\t\t// Enforce single-firing\n\t\t\tlocked = locked || options.once;\n\n\t\t\t// Execute callbacks for all pending executions,\n\t\t\t// respecting firingIndex overrides and runtime changes\n\t\t\tfired = firing = true;\n\t\t\tfor ( ; queue.length; firingIndex = -1 ) {\n\t\t\t\tmemory = queue.shift();\n\t\t\t\twhile ( ++firingIndex < list.length ) {\n\n\t\t\t\t\t// Run callback and check for early termination\n\t\t\t\t\tif ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false &&\n\t\t\t\t\t\toptions.stopOnFalse ) {\n\n\t\t\t\t\t\t// Jump to end and forget the data so .add doesn't re-fire\n\t\t\t\t\t\tfiringIndex = list.length;\n\t\t\t\t\t\tmemory = false;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Forget the data if we're done with it\n\t\t\tif ( !options.memory ) {\n\t\t\t\tmemory = false;\n\t\t\t}\n\n\t\t\tfiring = false;\n\n\t\t\t// Clean up if we're done firing for good\n\t\t\tif ( locked ) {\n\n\t\t\t\t// Keep an empty list if we have data for future add calls\n\t\t\t\tif ( memory ) {\n\t\t\t\t\tlist = [];\n\n\t\t\t\t// Otherwise, this object is spent\n\t\t\t\t} else {\n\t\t\t\t\tlist = \"\";\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\n\t\t// Actual Callbacks object\n\t\tself = {\n\n\t\t\t// Add a callback or a collection of callbacks to the list\n\t\t\tadd: function() {\n\t\t\t\tif ( list ) {\n\n\t\t\t\t\t// If we have memory from a past run, we should fire after adding\n\t\t\t\t\tif ( memory && !firing ) {\n\t\t\t\t\t\tfiringIndex = list.length - 1;\n\t\t\t\t\t\tqueue.push( memory );\n\t\t\t\t\t}\n\n\t\t\t\t\t( function add( args ) {\n\t\t\t\t\t\tjQuery.each( args, function( _, arg ) {\n\t\t\t\t\t\t\tif ( isFunction( arg ) ) {\n\t\t\t\t\t\t\t\tif ( !options.unique || !self.has( arg ) ) {\n\t\t\t\t\t\t\t\t\tlist.push( arg );\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} else if ( arg && arg.length && toType( arg ) !== \"string\" ) {\n\n\t\t\t\t\t\t\t\t// Inspect recursively\n\t\t\t\t\t\t\t\tadd( arg );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} );\n\t\t\t\t\t} )( arguments );\n\n\t\t\t\t\tif ( memory && !firing ) {\n\t\t\t\t\t\tfire();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn this;\n\t\t\t},\n\n\t\t\t// Remove a callback from the list\n\t\t\tremove: function() {\n\t\t\t\tjQuery.each( arguments, function( _, arg ) {\n\t\t\t\t\tvar index;\n\t\t\t\t\twhile ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {\n\t\t\t\t\t\tlist.splice( index, 1 );\n\n\t\t\t\t\t\t// Handle firing indexes\n\t\t\t\t\t\tif ( index <= firingIndex ) {\n\t\t\t\t\t\t\tfiringIndex--;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} );\n\t\t\t\treturn this;\n\t\t\t},\n\n\t\t\t// Check if a given callback is in the list.\n\t\t\t// If no argument is given, return whether or not list has callbacks attached.\n\t\t\thas: function( fn ) {\n\t\t\t\treturn fn ?\n\t\t\t\t\tjQuery.inArray( fn, list ) > -1 :\n\t\t\t\t\tlist.length > 0;\n\t\t\t},\n\n\t\t\t// Remove all callbacks from the list\n\t\t\tempty: function() {\n\t\t\t\tif ( list ) {\n\t\t\t\t\tlist = [];\n\t\t\t\t}\n\t\t\t\treturn this;\n\t\t\t},\n\n\t\t\t// Disable .fire and .add\n\t\t\t// Abort any current/pending executions\n\t\t\t// Clear all callbacks and values\n\t\t\tdisable: function() {\n\t\t\t\tlocked = queue = [];\n\t\t\t\tlist = memory = \"\";\n\t\t\t\treturn this;\n\t\t\t},\n\t\t\tdisabled: function() {\n\t\t\t\treturn !list;\n\t\t\t},\n\n\t\t\t// Disable .fire\n\t\t\t// Also disable .add unless we have memory (since it would have no effect)\n\t\t\t// Abort any pending executions\n\t\t\tlock: function() {\n\t\t\t\tlocked = queue = [];\n\t\t\t\tif ( !memory && !firing ) {\n\t\t\t\t\tlist = memory = \"\";\n\t\t\t\t}\n\t\t\t\treturn this;\n\t\t\t},\n\t\t\tlocked: function() {\n\t\t\t\treturn !!locked;\n\t\t\t},\n\n\t\t\t// Call all callbacks with the given context and arguments\n\t\t\tfireWith: function( context, args ) {\n\t\t\t\tif ( !locked ) {\n\t\t\t\t\targs = args || [];\n\t\t\t\t\targs = [ context, args.slice ? args.slice() : args ];\n\t\t\t\t\tqueue.push( args );\n\t\t\t\t\tif ( !firing ) {\n\t\t\t\t\t\tfire();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn this;\n\t\t\t},\n\n\t\t\t// Call all the callbacks with the given arguments\n\t\t\tfire: function() {\n\t\t\t\tself.fireWith( this, arguments );\n\t\t\t\treturn this;\n\t\t\t},\n\n\t\t\t// To know if the callbacks have already been called at least once\n\t\t\tfired: function() {\n\t\t\t\treturn !!fired;\n\t\t\t}\n\t\t};\n\n\treturn self;\n};\n\n\nfunction Identity( v ) {\n\treturn v;\n}\nfunction Thrower( ex ) {\n\tthrow ex;\n}\n\nfunction adoptValue( value, resolve, reject, noValue ) {\n\tvar method;\n\n\ttry {\n\n\t\t// Check for promise aspect first to privilege synchronous behavior\n\t\tif ( value && isFunction( ( method = value.promise ) ) ) {\n\t\t\tmethod.call( value ).done( resolve ).fail( reject );\n\n\t\t// Other thenables\n\t\t} else if ( value && isFunction( ( method = value.then ) ) ) {\n\t\t\tmethod.call( value, resolve, reject );\n\n\t\t// Other non-thenables\n\t\t} else {\n\n\t\t\t// Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer:\n\t\t\t// * false: [ value ].slice( 0 ) => resolve( value )\n\t\t\t// * true: [ value ].slice( 1 ) => resolve()\n\t\t\tresolve.apply( undefined, [ value ].slice( noValue ) );\n\t\t}\n\n\t// For Promises/A+, convert exceptions into rejections\n\t// Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in\n\t// Deferred#then to conditionally suppress rejection.\n\t} catch ( value ) {\n\n\t\t// Support: Android 4.0 only\n\t\t// Strict mode functions invoked without .call/.apply get global-object context\n\t\treject.apply( undefined, [ value ] );\n\t}\n}\n\njQuery.extend( {\n\n\tDeferred: function( func ) {\n\t\tvar tuples = [\n\n\t\t\t\t// action, add listener, callbacks,\n\t\t\t\t// ... .then handlers, argument index, [final state]\n\t\t\t\t[ \"notify\", \"progress\", jQuery.Callbacks( \"memory\" ),\n\t\t\t\t\tjQuery.Callbacks( \"memory\" ), 2 ],\n\t\t\t\t[ \"resolve\", \"done\", jQuery.Callbacks( \"once memory\" ),\n\t\t\t\t\tjQuery.Callbacks( \"once memory\" ), 0, \"resolved\" ],\n\t\t\t\t[ \"reject\", \"fail\", jQuery.Callbacks( \"once memory\" ),\n\t\t\t\t\tjQuery.Callbacks( \"once memory\" ), 1, \"rejected\" ]\n\t\t\t],\n\t\t\tstate = \"pending\",\n\t\t\tpromise = {\n\t\t\t\tstate: function() {\n\t\t\t\t\treturn state;\n\t\t\t\t},\n\t\t\t\talways: function() {\n\t\t\t\t\tdeferred.done( arguments ).fail( arguments );\n\t\t\t\t\treturn this;\n\t\t\t\t},\n\t\t\t\t\"catch\": function( fn ) {\n\t\t\t\t\treturn promise.then( null, fn );\n\t\t\t\t},\n\n\t\t\t\t// Keep pipe for back-compat\n\t\t\t\tpipe: function( /* fnDone, fnFail, fnProgress */ ) {\n\t\t\t\t\tvar fns = arguments;\n\n\t\t\t\t\treturn jQuery.Deferred( function( newDefer ) {\n\t\t\t\t\t\tjQuery.each( tuples, function( i, tuple ) {\n\n\t\t\t\t\t\t\t// Map tuples (progress, done, fail) to arguments (done, fail, progress)\n\t\t\t\t\t\t\tvar fn = isFunction( fns[ tuple[ 4 ] ] ) && fns[ tuple[ 4 ] ];\n\n\t\t\t\t\t\t\t// deferred.progress(function() { bind to newDefer or newDefer.notify })\n\t\t\t\t\t\t\t// deferred.done(function() { bind to newDefer or newDefer.resolve })\n\t\t\t\t\t\t\t// deferred.fail(function() { bind to newDefer or newDefer.reject })\n\t\t\t\t\t\t\tdeferred[ tuple[ 1 ] ]( function() {\n\t\t\t\t\t\t\t\tvar returned = fn && fn.apply( this, arguments );\n\t\t\t\t\t\t\t\tif ( returned && isFunction( returned.promise ) ) {\n\t\t\t\t\t\t\t\t\treturned.promise()\n\t\t\t\t\t\t\t\t\t\t.progress( newDefer.notify )\n\t\t\t\t\t\t\t\t\t\t.done( newDefer.resolve )\n\t\t\t\t\t\t\t\t\t\t.fail( newDefer.reject );\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tnewDefer[ tuple[ 0 ] + \"With\" ](\n\t\t\t\t\t\t\t\t\t\tthis,\n\t\t\t\t\t\t\t\t\t\tfn ? [ returned ] : arguments\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t} );\n\t\t\t\t\t\tfns = null;\n\t\t\t\t\t} ).promise();\n\t\t\t\t},\n\t\t\t\tthen: function( onFulfilled, onRejected, onProgress ) {\n\t\t\t\t\tvar maxDepth = 0;\n\t\t\t\t\tfunction resolve( depth, deferred, handler, special ) {\n\t\t\t\t\t\treturn function() {\n\t\t\t\t\t\t\tvar that = this,\n\t\t\t\t\t\t\t\targs = arguments,\n\t\t\t\t\t\t\t\tmightThrow = function() {\n\t\t\t\t\t\t\t\t\tvar returned, then;\n\n\t\t\t\t\t\t\t\t\t// Support: Promises/A+ section 2.3.3.3.3\n\t\t\t\t\t\t\t\t\t// https://promisesaplus.com/#point-59\n\t\t\t\t\t\t\t\t\t// Ignore double-resolution attempts\n\t\t\t\t\t\t\t\t\tif ( depth < maxDepth ) {\n\t\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\treturned = handler.apply( that, args );\n\n\t\t\t\t\t\t\t\t\t// Support: Promises/A+ section 2.3.1\n\t\t\t\t\t\t\t\t\t// https://promisesaplus.com/#point-48\n\t\t\t\t\t\t\t\t\tif ( returned === deferred.promise() ) {\n\t\t\t\t\t\t\t\t\t\tthrow new TypeError( \"Thenable self-resolution\" );\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t// Support: Promises/A+ sections 2.3.3.1, 3.5\n\t\t\t\t\t\t\t\t\t// https://promisesaplus.com/#point-54\n\t\t\t\t\t\t\t\t\t// https://promisesaplus.com/#point-75\n\t\t\t\t\t\t\t\t\t// Retrieve `then` only once\n\t\t\t\t\t\t\t\t\tthen = returned &&\n\n\t\t\t\t\t\t\t\t\t\t// Support: Promises/A+ section 2.3.4\n\t\t\t\t\t\t\t\t\t\t// https://promisesaplus.com/#point-64\n\t\t\t\t\t\t\t\t\t\t// Only check objects and functions for thenability\n\t\t\t\t\t\t\t\t\t\t( typeof returned === \"object\" ||\n\t\t\t\t\t\t\t\t\t\t\ttypeof returned === \"function\" ) &&\n\t\t\t\t\t\t\t\t\t\treturned.then;\n\n\t\t\t\t\t\t\t\t\t// Handle a returned thenable\n\t\t\t\t\t\t\t\t\tif ( isFunction( then ) ) {\n\n\t\t\t\t\t\t\t\t\t\t// Special processors (notify) just wait for resolution\n\t\t\t\t\t\t\t\t\t\tif ( special ) {\n\t\t\t\t\t\t\t\t\t\t\tthen.call(\n\t\t\t\t\t\t\t\t\t\t\t\treturned,\n\t\t\t\t\t\t\t\t\t\t\t\tresolve( maxDepth, deferred, Identity, special ),\n\t\t\t\t\t\t\t\t\t\t\t\tresolve( maxDepth, deferred, Thrower, special )\n\t\t\t\t\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\t\t\t\t// Normal processors (resolve) also hook into progress\n\t\t\t\t\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t\t\t\t\t// ...and disregard older resolution values\n\t\t\t\t\t\t\t\t\t\t\tmaxDepth++;\n\n\t\t\t\t\t\t\t\t\t\t\tthen.call(\n\t\t\t\t\t\t\t\t\t\t\t\treturned,\n\t\t\t\t\t\t\t\t\t\t\t\tresolve( maxDepth, deferred, Identity, special ),\n\t\t\t\t\t\t\t\t\t\t\t\tresolve( maxDepth, deferred, Thrower, special ),\n\t\t\t\t\t\t\t\t\t\t\t\tresolve( maxDepth, deferred, Identity,\n\t\t\t\t\t\t\t\t\t\t\t\t\tdeferred.notifyWith )\n\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t// Handle all other returned values\n\t\t\t\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t\t\t\t// Only substitute handlers pass on context\n\t\t\t\t\t\t\t\t\t\t// and multiple values (non-spec behavior)\n\t\t\t\t\t\t\t\t\t\tif ( handler !== Identity ) {\n\t\t\t\t\t\t\t\t\t\t\tthat = undefined;\n\t\t\t\t\t\t\t\t\t\t\targs = [ returned ];\n\t\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t\t// Process the value(s)\n\t\t\t\t\t\t\t\t\t\t// Default process is resolve\n\t\t\t\t\t\t\t\t\t\t( special || deferred.resolveWith )( that, args );\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t},\n\n\t\t\t\t\t\t\t\t// Only normal processors (resolve) catch and reject exceptions\n\t\t\t\t\t\t\t\tprocess = special ?\n\t\t\t\t\t\t\t\t\tmightThrow :\n\t\t\t\t\t\t\t\t\tfunction() {\n\t\t\t\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\t\t\t\tmightThrow();\n\t\t\t\t\t\t\t\t\t\t} catch ( e ) {\n\n\t\t\t\t\t\t\t\t\t\t\tif ( jQuery.Deferred.exceptionHook ) {\n\t\t\t\t\t\t\t\t\t\t\t\tjQuery.Deferred.exceptionHook( e,\n\t\t\t\t\t\t\t\t\t\t\t\t\tprocess.stackTrace );\n\t\t\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t\t\t// Support: Promises/A+ section 2.3.3.3.4.1\n\t\t\t\t\t\t\t\t\t\t\t// https://promisesaplus.com/#point-61\n\t\t\t\t\t\t\t\t\t\t\t// Ignore post-resolution exceptions\n\t\t\t\t\t\t\t\t\t\t\tif ( depth + 1 >= maxDepth ) {\n\n\t\t\t\t\t\t\t\t\t\t\t\t// Only substitute handlers pass on context\n\t\t\t\t\t\t\t\t\t\t\t\t// and multiple values (non-spec behavior)\n\t\t\t\t\t\t\t\t\t\t\t\tif ( handler !== Thrower ) {\n\t\t\t\t\t\t\t\t\t\t\t\t\tthat = undefined;\n\t\t\t\t\t\t\t\t\t\t\t\t\targs = [ e ];\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t\t\t\tdeferred.rejectWith( that, args );\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t};\n\n\t\t\t\t\t\t\t// Support: Promises/A+ section 2.3.3.3.1\n\t\t\t\t\t\t\t// https://promisesaplus.com/#point-57\n\t\t\t\t\t\t\t// Re-resolve promises immediately to dodge false rejection from\n\t\t\t\t\t\t\t// subsequent errors\n\t\t\t\t\t\t\tif ( depth ) {\n\t\t\t\t\t\t\t\tprocess();\n\t\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t\t// Call an optional hook to record the stack, in case of exception\n\t\t\t\t\t\t\t\t// since it's otherwise lost when execution goes async\n\t\t\t\t\t\t\t\tif ( jQuery.Deferred.getStackHook ) {\n\t\t\t\t\t\t\t\t\tprocess.stackTrace = jQuery.Deferred.getStackHook();\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\twindow.setTimeout( process );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\n\t\t\t\t\treturn jQuery.Deferred( function( newDefer ) {\n\n\t\t\t\t\t\t// progress_handlers.add( ... )\n\t\t\t\t\t\ttuples[ 0 ][ 3 ].add(\n\t\t\t\t\t\t\tresolve(\n\t\t\t\t\t\t\t\t0,\n\t\t\t\t\t\t\t\tnewDefer,\n\t\t\t\t\t\t\t\tisFunction( onProgress ) ?\n\t\t\t\t\t\t\t\t\tonProgress :\n\t\t\t\t\t\t\t\t\tIdentity,\n\t\t\t\t\t\t\t\tnewDefer.notifyWith\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\t// fulfilled_handlers.add( ... )\n\t\t\t\t\t\ttuples[ 1 ][ 3 ].add(\n\t\t\t\t\t\t\tresolve(\n\t\t\t\t\t\t\t\t0,\n\t\t\t\t\t\t\t\tnewDefer,\n\t\t\t\t\t\t\t\tisFunction( onFulfilled ) ?\n\t\t\t\t\t\t\t\t\tonFulfilled :\n\t\t\t\t\t\t\t\t\tIdentity\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\t// rejected_handlers.add( ... )\n\t\t\t\t\t\ttuples[ 2 ][ 3 ].add(\n\t\t\t\t\t\t\tresolve(\n\t\t\t\t\t\t\t\t0,\n\t\t\t\t\t\t\t\tnewDefer,\n\t\t\t\t\t\t\t\tisFunction( onRejected ) ?\n\t\t\t\t\t\t\t\t\tonRejected :\n\t\t\t\t\t\t\t\t\tThrower\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t);\n\t\t\t\t\t} ).promise();\n\t\t\t\t},\n\n\t\t\t\t// Get a promise for this deferred\n\t\t\t\t// If obj is provided, the promise aspect is added to the object\n\t\t\t\tpromise: function( obj ) {\n\t\t\t\t\treturn obj != null ? jQuery.extend( obj, promise ) : promise;\n\t\t\t\t}\n\t\t\t},\n\t\t\tdeferred = {};\n\n\t\t// Add list-specific methods\n\t\tjQuery.each( tuples, function( i, tuple ) {\n\t\t\tvar list = tuple[ 2 ],\n\t\t\t\tstateString = tuple[ 5 ];\n\n\t\t\t// promise.progress = list.add\n\t\t\t// promise.done = list.add\n\t\t\t// promise.fail = list.add\n\t\t\tpromise[ tuple[ 1 ] ] = list.add;\n\n\t\t\t// Handle state\n\t\t\tif ( stateString ) {\n\t\t\t\tlist.add(\n\t\t\t\t\tfunction() {\n\n\t\t\t\t\t\t// state = \"resolved\" (i.e., fulfilled)\n\t\t\t\t\t\t// state = \"rejected\"\n\t\t\t\t\t\tstate = stateString;\n\t\t\t\t\t},\n\n\t\t\t\t\t// rejected_callbacks.disable\n\t\t\t\t\t// fulfilled_callbacks.disable\n\t\t\t\t\ttuples[ 3 - i ][ 2 ].disable,\n\n\t\t\t\t\t// rejected_handlers.disable\n\t\t\t\t\t// fulfilled_handlers.disable\n\t\t\t\t\ttuples[ 3 - i ][ 3 ].disable,\n\n\t\t\t\t\t// progress_callbacks.lock\n\t\t\t\t\ttuples[ 0 ][ 2 ].lock,\n\n\t\t\t\t\t// progress_handlers.lock\n\t\t\t\t\ttuples[ 0 ][ 3 ].lock\n\t\t\t\t);\n\t\t\t}\n\n\t\t\t// progress_handlers.fire\n\t\t\t// fulfilled_handlers.fire\n\t\t\t// rejected_handlers.fire\n\t\t\tlist.add( tuple[ 3 ].fire );\n\n\t\t\t// deferred.notify = function() { deferred.notifyWith(...) }\n\t\t\t// deferred.resolve = function() { deferred.resolveWith(...) }\n\t\t\t// deferred.reject = function() { deferred.rejectWith(...) }\n\t\t\tdeferred[ tuple[ 0 ] ] = function() {\n\t\t\t\tdeferred[ tuple[ 0 ] + \"With\" ]( this === deferred ? undefined : this, arguments );\n\t\t\t\treturn this;\n\t\t\t};\n\n\t\t\t// deferred.notifyWith = list.fireWith\n\t\t\t// deferred.resolveWith = list.fireWith\n\t\t\t// deferred.rejectWith = list.fireWith\n\t\t\tdeferred[ tuple[ 0 ] + \"With\" ] = list.fireWith;\n\t\t} );\n\n\t\t// Make the deferred a promise\n\t\tpromise.promise( deferred );\n\n\t\t// Call given func if any\n\t\tif ( func ) {\n\t\t\tfunc.call( deferred, deferred );\n\t\t}\n\n\t\t// All done!\n\t\treturn deferred;\n\t},\n\n\t// Deferred helper\n\twhen: function( singleValue ) {\n\t\tvar\n\n\t\t\t// count of uncompleted subordinates\n\t\t\tremaining = arguments.length,\n\n\t\t\t// count of unprocessed arguments\n\t\t\ti = remaining,\n\n\t\t\t// subordinate fulfillment data\n\t\t\tresolveContexts = Array( i ),\n\t\t\tresolveValues = slice.call( arguments ),\n\n\t\t\t// the master Deferred\n\t\t\tmaster = jQuery.Deferred(),\n\n\t\t\t// subordinate callback factory\n\t\t\tupdateFunc = function( i ) {\n\t\t\t\treturn function( value ) {\n\t\t\t\t\tresolveContexts[ i ] = this;\n\t\t\t\t\tresolveValues[ i ] = arguments.length > 1 ? slice.call( arguments ) : value;\n\t\t\t\t\tif ( !( --remaining ) ) {\n\t\t\t\t\t\tmaster.resolveWith( resolveContexts, resolveValues );\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t};\n\n\t\t// Single- and empty arguments are adopted like Promise.resolve\n\t\tif ( remaining <= 1 ) {\n\t\t\tadoptValue( singleValue, master.done( updateFunc( i ) ).resolve, master.reject,\n\t\t\t\t!remaining );\n\n\t\t\t// Use .then() to unwrap secondary thenables (cf. gh-3000)\n\t\t\tif ( master.state() === \"pending\" ||\n\t\t\t\tisFunction( resolveValues[ i ] && resolveValues[ i ].then ) ) {\n\n\t\t\t\treturn master.then();\n\t\t\t}\n\t\t}\n\n\t\t// Multiple arguments are aggregated like Promise.all array elements\n\t\twhile ( i-- ) {\n\t\t\tadoptValue( resolveValues[ i ], updateFunc( i ), master.reject );\n\t\t}\n\n\t\treturn master.promise();\n\t}\n} );\n\n\n// These usually indicate a programmer mistake during development,\n// warn about them ASAP rather than swallowing them by default.\nvar rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;\n\njQuery.Deferred.exceptionHook = function( error, stack ) {\n\n\t// Support: IE 8 - 9 only\n\t// Console exists when dev tools are open, which can happen at any time\n\tif ( window.console && window.console.warn && error && rerrorNames.test( error.name ) ) {\n\t\twindow.console.warn( \"jQuery.Deferred exception: \" + error.message, error.stack, stack );\n\t}\n};\n\n\n\n\njQuery.readyException = function( error ) {\n\twindow.setTimeout( function() {\n\t\tthrow error;\n\t} );\n};\n\n\n\n\n// The deferred used on DOM ready\nvar readyList = jQuery.Deferred();\n\njQuery.fn.ready = function( fn ) {\n\n\treadyList\n\t\t.then( fn )\n\n\t\t// Wrap jQuery.readyException in a function so that the lookup\n\t\t// happens at the time of error handling instead of callback\n\t\t// registration.\n\t\t.catch( function( error ) {\n\t\t\tjQuery.readyException( error );\n\t\t} );\n\n\treturn this;\n};\n\njQuery.extend( {\n\n\t// Is the DOM ready to be used? Set to true once it occurs.\n\tisReady: false,\n\n\t// A counter to track how many items to wait for before\n\t// the ready event fires. See #6781\n\treadyWait: 1,\n\n\t// Handle when the DOM is ready\n\tready: function( wait ) {\n\n\t\t// Abort if there are pending holds or we're already ready\n\t\tif ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Remember that the DOM is ready\n\t\tjQuery.isReady = true;\n\n\t\t// If a normal DOM Ready event fired, decrement, and wait if need be\n\t\tif ( wait !== true && --jQuery.readyWait > 0 ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// If there are functions bound, to execute\n\t\treadyList.resolveWith( document, [ jQuery ] );\n\t}\n} );\n\njQuery.ready.then = readyList.then;\n\n// The ready event handler and self cleanup method\nfunction completed() {\n\tdocument.removeEventListener( \"DOMContentLoaded\", completed );\n\twindow.removeEventListener( \"load\", completed );\n\tjQuery.ready();\n}\n\n// Catch cases where $(document).ready() is called\n// after the browser event has already occurred.\n// Support: IE <=9 - 10 only\n// Older IE sometimes signals \"interactive\" too soon\nif ( document.readyState === \"complete\" ||\n\t( document.readyState !== \"loading\" && !document.documentElement.doScroll ) ) {\n\n\t// Handle it asynchronously to allow scripts the opportunity to delay ready\n\twindow.setTimeout( jQuery.ready );\n\n} else {\n\n\t// Use the handy event callback\n\tdocument.addEventListener( \"DOMContentLoaded\", completed );\n\n\t// A fallback to window.onload, that will always work\n\twindow.addEventListener( \"load\", completed );\n}\n\n\n\n\n// Multifunctional method to get and set values of a collection\n// The value/s can optionally be executed if it's a function\nvar access = function( elems, fn, key, value, chainable, emptyGet, raw ) {\n\tvar i = 0,\n\t\tlen = elems.length,\n\t\tbulk = key == null;\n\n\t// Sets many values\n\tif ( toType( key ) === \"object\" ) {\n\t\tchainable = true;\n\t\tfor ( i in key ) {\n\t\t\taccess( elems, fn, i, key[ i ], true, emptyGet, raw );\n\t\t}\n\n\t// Sets one value\n\t} else if ( value !== undefined ) {\n\t\tchainable = true;\n\n\t\tif ( !isFunction( value ) ) {\n\t\t\traw = true;\n\t\t}\n\n\t\tif ( bulk ) {\n\n\t\t\t// Bulk operations run against the entire set\n\t\t\tif ( raw ) {\n\t\t\t\tfn.call( elems, value );\n\t\t\t\tfn = null;\n\n\t\t\t// ...except when executing function values\n\t\t\t} else {\n\t\t\t\tbulk = fn;\n\t\t\t\tfn = function( elem, key, value ) {\n\t\t\t\t\treturn bulk.call( jQuery( elem ), value );\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\n\t\tif ( fn ) {\n\t\t\tfor ( ; i < len; i++ ) {\n\t\t\t\tfn(\n\t\t\t\t\telems[ i ], key, raw ?\n\t\t\t\t\tvalue :\n\t\t\t\t\tvalue.call( elems[ i ], i, fn( elems[ i ], key ) )\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n\n\tif ( chainable ) {\n\t\treturn elems;\n\t}\n\n\t// Gets\n\tif ( bulk ) {\n\t\treturn fn.call( elems );\n\t}\n\n\treturn len ? fn( elems[ 0 ], key ) : emptyGet;\n};\n\n\n// Matches dashed string for camelizing\nvar rmsPrefix = /^-ms-/,\n\trdashAlpha = /-([a-z])/g;\n\n// Used by camelCase as callback to replace()\nfunction fcamelCase( all, letter ) {\n\treturn letter.toUpperCase();\n}\n\n// Convert dashed to camelCase; used by the css and data modules\n// Support: IE <=9 - 11, Edge 12 - 15\n// Microsoft forgot to hump their vendor prefix (#9572)\nfunction camelCase( string ) {\n\treturn string.replace( rmsPrefix, \"ms-\" ).replace( rdashAlpha, fcamelCase );\n}\nvar acceptData = function( owner ) {\n\n\t// Accepts only:\n\t// - Node\n\t// - Node.ELEMENT_NODE\n\t// - Node.DOCUMENT_NODE\n\t// - Object\n\t// - Any\n\treturn owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType );\n};\n\n\n\n\nfunction Data() {\n\tthis.expando = jQuery.expando + Data.uid++;\n}\n\nData.uid = 1;\n\nData.prototype = {\n\n\tcache: function( owner ) {\n\n\t\t// Check if the owner object already has a cache\n\t\tvar value = owner[ this.expando ];\n\n\t\t// If not, create one\n\t\tif ( !value ) {\n\t\t\tvalue = {};\n\n\t\t\t// We can accept data for non-element nodes in modern browsers,\n\t\t\t// but we should not, see #8335.\n\t\t\t// Always return an empty object.\n\t\t\tif ( acceptData( owner ) ) {\n\n\t\t\t\t// If it is a node unlikely to be stringify-ed or looped over\n\t\t\t\t// use plain assignment\n\t\t\t\tif ( owner.nodeType ) {\n\t\t\t\t\towner[ this.expando ] = value;\n\n\t\t\t\t// Otherwise secure it in a non-enumerable property\n\t\t\t\t// configurable must be true to allow the property to be\n\t\t\t\t// deleted when data is removed\n\t\t\t\t} else {\n\t\t\t\t\tObject.defineProperty( owner, this.expando, {\n\t\t\t\t\t\tvalue: value,\n\t\t\t\t\t\tconfigurable: true\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn value;\n\t},\n\tset: function( owner, data, value ) {\n\t\tvar prop,\n\t\t\tcache = this.cache( owner );\n\n\t\t// Handle: [ owner, key, value ] args\n\t\t// Always use camelCase key (gh-2257)\n\t\tif ( typeof data === \"string\" ) {\n\t\t\tcache[ camelCase( data ) ] = value;\n\n\t\t// Handle: [ owner, { properties } ] args\n\t\t} else {\n\n\t\t\t// Copy the properties one-by-one to the cache object\n\t\t\tfor ( prop in data ) {\n\t\t\t\tcache[ camelCase( prop ) ] = data[ prop ];\n\t\t\t}\n\t\t}\n\t\treturn cache;\n\t},\n\tget: function( owner, key ) {\n\t\treturn key === undefined ?\n\t\t\tthis.cache( owner ) :\n\n\t\t\t// Always use camelCase key (gh-2257)\n\t\t\towner[ this.expando ] && owner[ this.expando ][ camelCase( key ) ];\n\t},\n\taccess: function( owner, key, value ) {\n\n\t\t// In cases where either:\n\t\t//\n\t\t// 1. No key was specified\n\t\t// 2. A string key was specified, but no value provided\n\t\t//\n\t\t// Take the \"read\" path and allow the get method to determine\n\t\t// which value to return, respectively either:\n\t\t//\n\t\t// 1. The entire cache object\n\t\t// 2. The data stored at the key\n\t\t//\n\t\tif ( key === undefined ||\n\t\t\t\t( ( key && typeof key === \"string\" ) && value === undefined ) ) {\n\n\t\t\treturn this.get( owner, key );\n\t\t}\n\n\t\t// When the key is not a string, or both a key and value\n\t\t// are specified, set or extend (existing objects) with either:\n\t\t//\n\t\t// 1. An object of properties\n\t\t// 2. A key and value\n\t\t//\n\t\tthis.set( owner, key, value );\n\n\t\t// Since the \"set\" path can have two possible entry points\n\t\t// return the expected data based on which path was taken[*]\n\t\treturn value !== undefined ? value : key;\n\t},\n\tremove: function( owner, key ) {\n\t\tvar i,\n\t\t\tcache = owner[ this.expando ];\n\n\t\tif ( cache === undefined ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( key !== undefined ) {\n\n\t\t\t// Support array or space separated string of keys\n\t\t\tif ( Array.isArray( key ) ) {\n\n\t\t\t\t// If key is an array of keys...\n\t\t\t\t// We always set camelCase keys, so remove that.\n\t\t\t\tkey = key.map( camelCase );\n\t\t\t} else {\n\t\t\t\tkey = camelCase( key );\n\n\t\t\t\t// If a key with the spaces exists, use it.\n\t\t\t\t// Otherwise, create an array by matching non-whitespace\n\t\t\t\tkey = key in cache ?\n\t\t\t\t\t[ key ] :\n\t\t\t\t\t( key.match( rnothtmlwhite ) || [] );\n\t\t\t}\n\n\t\t\ti = key.length;\n\n\t\t\twhile ( i-- ) {\n\t\t\t\tdelete cache[ key[ i ] ];\n\t\t\t}\n\t\t}\n\n\t\t// Remove the expando if there's no more data\n\t\tif ( key === undefined || jQuery.isEmptyObject( cache ) ) {\n\n\t\t\t// Support: Chrome <=35 - 45\n\t\t\t// Webkit & Blink performance suffers when deleting properties\n\t\t\t// from DOM nodes, so set to undefined instead\n\t\t\t// https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted)\n\t\t\tif ( owner.nodeType ) {\n\t\t\t\towner[ this.expando ] = undefined;\n\t\t\t} else {\n\t\t\t\tdelete owner[ this.expando ];\n\t\t\t}\n\t\t}\n\t},\n\thasData: function( owner ) {\n\t\tvar cache = owner[ this.expando ];\n\t\treturn cache !== undefined && !jQuery.isEmptyObject( cache );\n\t}\n};\nvar dataPriv = new Data();\n\nvar dataUser = new Data();\n\n\n\n//\tImplementation Summary\n//\n//\t1. Enforce API surface and semantic compatibility with 1.9.x branch\n//\t2. Improve the module's maintainability by reducing the storage\n//\t\tpaths to a single mechanism.\n//\t3. Use the same single mechanism to support \"private\" and \"user\" data.\n//\t4. _Never_ expose \"private\" data to user code (TODO: Drop _data, _removeData)\n//\t5. Avoid exposing implementation details on user objects (eg. expando properties)\n//\t6. Provide a clear path for implementation upgrade to WeakMap in 2014\n\nvar rbrace = /^(?:\\{[\\w\\W]*\\}|\\[[\\w\\W]*\\])$/,\n\trmultiDash = /[A-Z]/g;\n\nfunction getData( data ) {\n\tif ( data === \"true\" ) {\n\t\treturn true;\n\t}\n\n\tif ( data === \"false\" ) {\n\t\treturn false;\n\t}\n\n\tif ( data === \"null\" ) {\n\t\treturn null;\n\t}\n\n\t// Only convert to a number if it doesn't change the string\n\tif ( data === +data + \"\" ) {\n\t\treturn +data;\n\t}\n\n\tif ( rbrace.test( data ) ) {\n\t\treturn JSON.parse( data );\n\t}\n\n\treturn data;\n}\n\nfunction dataAttr( elem, key, data ) {\n\tvar name;\n\n\t// If nothing was found internally, try to fetch any\n\t// data from the HTML5 data-* attribute\n\tif ( data === undefined && elem.nodeType === 1 ) {\n\t\tname = \"data-\" + key.replace( rmultiDash, \"-$&\" ).toLowerCase();\n\t\tdata = elem.getAttribute( name );\n\n\t\tif ( typeof data === \"string\" ) {\n\t\t\ttry {\n\t\t\t\tdata = getData( data );\n\t\t\t} catch ( e ) {}\n\n\t\t\t// Make sure we set the data so it isn't changed later\n\t\t\tdataUser.set( elem, key, data );\n\t\t} else {\n\t\t\tdata = undefined;\n\t\t}\n\t}\n\treturn data;\n}\n\njQuery.extend( {\n\thasData: function( elem ) {\n\t\treturn dataUser.hasData( elem ) || dataPriv.hasData( elem );\n\t},\n\n\tdata: function( elem, name, data ) {\n\t\treturn dataUser.access( elem, name, data );\n\t},\n\n\tremoveData: function( elem, name ) {\n\t\tdataUser.remove( elem, name );\n\t},\n\n\t// TODO: Now that all calls to _data and _removeData have been replaced\n\t// with direct calls to dataPriv methods, these can be deprecated.\n\t_data: function( elem, name, data ) {\n\t\treturn dataPriv.access( elem, name, data );\n\t},\n\n\t_removeData: function( elem, name ) {\n\t\tdataPriv.remove( elem, name );\n\t}\n} );\n\njQuery.fn.extend( {\n\tdata: function( key, value ) {\n\t\tvar i, name, data,\n\t\t\telem = this[ 0 ],\n\t\t\tattrs = elem && elem.attributes;\n\n\t\t// Gets all values\n\t\tif ( key === undefined ) {\n\t\t\tif ( this.length ) {\n\t\t\t\tdata = dataUser.get( elem );\n\n\t\t\t\tif ( elem.nodeType === 1 && !dataPriv.get( elem, \"hasDataAttrs\" ) ) {\n\t\t\t\t\ti = attrs.length;\n\t\t\t\t\twhile ( i-- ) {\n\n\t\t\t\t\t\t// Support: IE 11 only\n\t\t\t\t\t\t// The attrs elements can be null (#14894)\n\t\t\t\t\t\tif ( attrs[ i ] ) {\n\t\t\t\t\t\t\tname = attrs[ i ].name;\n\t\t\t\t\t\t\tif ( name.indexOf( \"data-\" ) === 0 ) {\n\t\t\t\t\t\t\t\tname = camelCase( name.slice( 5 ) );\n\t\t\t\t\t\t\t\tdataAttr( elem, name, data[ name ] );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tdataPriv.set( elem, \"hasDataAttrs\", true );\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn data;\n\t\t}\n\n\t\t// Sets multiple values\n\t\tif ( typeof key === \"object\" ) {\n\t\t\treturn this.each( function() {\n\t\t\t\tdataUser.set( this, key );\n\t\t\t} );\n\t\t}\n\n\t\treturn access( this, function( value ) {\n\t\t\tvar data;\n\n\t\t\t// The calling jQuery object (element matches) is not empty\n\t\t\t// (and therefore has an element appears at this[ 0 ]) and the\n\t\t\t// `value` parameter was not undefined. An empty jQuery object\n\t\t\t// will result in `undefined` for elem = this[ 0 ] which will\n\t\t\t// throw an exception if an attempt to read a data cache is made.\n\t\t\tif ( elem && value === undefined ) {\n\n\t\t\t\t// Attempt to get data from the cache\n\t\t\t\t// The key will always be camelCased in Data\n\t\t\t\tdata = dataUser.get( elem, key );\n\t\t\t\tif ( data !== undefined ) {\n\t\t\t\t\treturn data;\n\t\t\t\t}\n\n\t\t\t\t// Attempt to \"discover\" the data in\n\t\t\t\t// HTML5 custom data-* attrs\n\t\t\t\tdata = dataAttr( elem, key );\n\t\t\t\tif ( data !== undefined ) {\n\t\t\t\t\treturn data;\n\t\t\t\t}\n\n\t\t\t\t// We tried really hard, but the data doesn't exist.\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Set the data...\n\t\t\tthis.each( function() {\n\n\t\t\t\t// We always store the camelCased key\n\t\t\t\tdataUser.set( this, key, value );\n\t\t\t} );\n\t\t}, null, value, arguments.length > 1, null, true );\n\t},\n\n\tremoveData: function( key ) {\n\t\treturn this.each( function() {\n\t\t\tdataUser.remove( this, key );\n\t\t} );\n\t}\n} );\n\n\njQuery.extend( {\n\tqueue: function( elem, type, data ) {\n\t\tvar queue;\n\n\t\tif ( elem ) {\n\t\t\ttype = ( type || \"fx\" ) + \"queue\";\n\t\t\tqueue = dataPriv.get( elem, type );\n\n\t\t\t// Speed up dequeue by getting out quickly if this is just a lookup\n\t\t\tif ( data ) {\n\t\t\t\tif ( !queue || Array.isArray( data ) ) {\n\t\t\t\t\tqueue = dataPriv.access( elem, type, jQuery.makeArray( data ) );\n\t\t\t\t} else {\n\t\t\t\t\tqueue.push( data );\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn queue || [];\n\t\t}\n\t},\n\n\tdequeue: function( elem, type ) {\n\t\ttype = type || \"fx\";\n\n\t\tvar queue = jQuery.queue( elem, type ),\n\t\t\tstartLength = queue.length,\n\t\t\tfn = queue.shift(),\n\t\t\thooks = jQuery._queueHooks( elem, type ),\n\t\t\tnext = function() {\n\t\t\t\tjQuery.dequeue( elem, type );\n\t\t\t};\n\n\t\t// If the fx queue is dequeued, always remove the progress sentinel\n\t\tif ( fn === \"inprogress\" ) {\n\t\t\tfn = queue.shift();\n\t\t\tstartLength--;\n\t\t}\n\n\t\tif ( fn ) {\n\n\t\t\t// Add a progress sentinel to prevent the fx queue from being\n\t\t\t// automatically dequeued\n\t\t\tif ( type === \"fx\" ) {\n\t\t\t\tqueue.unshift( \"inprogress\" );\n\t\t\t}\n\n\t\t\t// Clear up the last queue stop function\n\t\t\tdelete hooks.stop;\n\t\t\tfn.call( elem, next, hooks );\n\t\t}\n\n\t\tif ( !startLength && hooks ) {\n\t\t\thooks.empty.fire();\n\t\t}\n\t},\n\n\t// Not public - generate a queueHooks object, or return the current one\n\t_queueHooks: function( elem, type ) {\n\t\tvar key = type + \"queueHooks\";\n\t\treturn dataPriv.get( elem, key ) || dataPriv.access( elem, key, {\n\t\t\tempty: jQuery.Callbacks( \"once memory\" ).add( function() {\n\t\t\t\tdataPriv.remove( elem, [ type + \"queue\", key ] );\n\t\t\t} )\n\t\t} );\n\t}\n} );\n\njQuery.fn.extend( {\n\tqueue: function( type, data ) {\n\t\tvar setter = 2;\n\n\t\tif ( typeof type !== \"string\" ) {\n\t\t\tdata = type;\n\t\t\ttype = \"fx\";\n\t\t\tsetter--;\n\t\t}\n\n\t\tif ( arguments.length < setter ) {\n\t\t\treturn jQuery.queue( this[ 0 ], type );\n\t\t}\n\n\t\treturn data === undefined ?\n\t\t\tthis :\n\t\t\tthis.each( function() {\n\t\t\t\tvar queue = jQuery.queue( this, type, data );\n\n\t\t\t\t// Ensure a hooks for this queue\n\t\t\t\tjQuery._queueHooks( this, type );\n\n\t\t\t\tif ( type === \"fx\" && queue[ 0 ] !== \"inprogress\" ) {\n\t\t\t\t\tjQuery.dequeue( this, type );\n\t\t\t\t}\n\t\t\t} );\n\t},\n\tdequeue: function( type ) {\n\t\treturn this.each( function() {\n\t\t\tjQuery.dequeue( this, type );\n\t\t} );\n\t},\n\tclearQueue: function( type ) {\n\t\treturn this.queue( type || \"fx\", [] );\n\t},\n\n\t// Get a promise resolved when queues of a certain type\n\t// are emptied (fx is the type by default)\n\tpromise: function( type, obj ) {\n\t\tvar tmp,\n\t\t\tcount = 1,\n\t\t\tdefer = jQuery.Deferred(),\n\t\t\telements = this,\n\t\t\ti = this.length,\n\t\t\tresolve = function() {\n\t\t\t\tif ( !( --count ) ) {\n\t\t\t\t\tdefer.resolveWith( elements, [ elements ] );\n\t\t\t\t}\n\t\t\t};\n\n\t\tif ( typeof type !== \"string\" ) {\n\t\t\tobj = type;\n\t\t\ttype = undefined;\n\t\t}\n\t\ttype = type || \"fx\";\n\n\t\twhile ( i-- ) {\n\t\t\ttmp = dataPriv.get( elements[ i ], type + \"queueHooks\" );\n\t\t\tif ( tmp && tmp.empty ) {\n\t\t\t\tcount++;\n\t\t\t\ttmp.empty.add( resolve );\n\t\t\t}\n\t\t}\n\t\tresolve();\n\t\treturn defer.promise( obj );\n\t}\n} );\nvar pnum = ( /[+-]?(?:\\d*\\.|)\\d+(?:[eE][+-]?\\d+|)/ ).source;\n\nvar rcssNum = new RegExp( \"^(?:([+-])=|)(\" + pnum + \")([a-z%]*)$\", \"i\" );\n\n\nvar cssExpand = [ \"Top\", \"Right\", \"Bottom\", \"Left\" ];\n\nvar isHiddenWithinTree = function( elem, el ) {\n\n\t\t// isHiddenWithinTree might be called from jQuery#filter function;\n\t\t// in that case, element will be second argument\n\t\telem = el || elem;\n\n\t\t// Inline style trumps all\n\t\treturn elem.style.display === \"none\" ||\n\t\t\telem.style.display === \"\" &&\n\n\t\t\t// Otherwise, check computed style\n\t\t\t// Support: Firefox <=43 - 45\n\t\t\t// Disconnected elements can have computed display: none, so first confirm that elem is\n\t\t\t// in the document.\n\t\t\tjQuery.contains( elem.ownerDocument, elem ) &&\n\n\t\t\tjQuery.css( elem, \"display\" ) === \"none\";\n\t};\n\nvar swap = function( elem, options, callback, args ) {\n\tvar ret, name,\n\t\told = {};\n\n\t// Remember the old values, and insert the new ones\n\tfor ( name in options ) {\n\t\told[ name ] = elem.style[ name ];\n\t\telem.style[ name ] = options[ name ];\n\t}\n\n\tret = callback.apply( elem, args || [] );\n\n\t// Revert the old values\n\tfor ( name in options ) {\n\t\telem.style[ name ] = old[ name ];\n\t}\n\n\treturn ret;\n};\n\n\n\n\nfunction adjustCSS( elem, prop, valueParts, tween ) {\n\tvar adjusted, scale,\n\t\tmaxIterations = 20,\n\t\tcurrentValue = tween ?\n\t\t\tfunction() {\n\t\t\t\treturn tween.cur();\n\t\t\t} :\n\t\t\tfunction() {\n\t\t\t\treturn jQuery.css( elem, prop, \"\" );\n\t\t\t},\n\t\tinitial = currentValue(),\n\t\tunit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? \"\" : \"px\" ),\n\n\t\t// Starting value computation is required for potential unit mismatches\n\t\tinitialInUnit = ( jQuery.cssNumber[ prop ] || unit !== \"px\" && +initial ) &&\n\t\t\trcssNum.exec( jQuery.css( elem, prop ) );\n\n\tif ( initialInUnit && initialInUnit[ 3 ] !== unit ) {\n\n\t\t// Support: Firefox <=54\n\t\t// Halve the iteration target value to prevent interference from CSS upper bounds (gh-2144)\n\t\tinitial = initial / 2;\n\n\t\t// Trust units reported by jQuery.css\n\t\tunit = unit || initialInUnit[ 3 ];\n\n\t\t// Iteratively approximate from a nonzero starting point\n\t\tinitialInUnit = +initial || 1;\n\n\t\twhile ( maxIterations-- ) {\n\n\t\t\t// Evaluate and update our best guess (doubling guesses that zero out).\n\t\t\t// Finish if the scale equals or crosses 1 (making the old*new product non-positive).\n\t\t\tjQuery.style( elem, prop, initialInUnit + unit );\n\t\t\tif ( ( 1 - scale ) * ( 1 - ( scale = currentValue() / initial || 0.5 ) ) <= 0 ) {\n\t\t\t\tmaxIterations = 0;\n\t\t\t}\n\t\t\tinitialInUnit = initialInUnit / scale;\n\n\t\t}\n\n\t\tinitialInUnit = initialInUnit * 2;\n\t\tjQuery.style( elem, prop, initialInUnit + unit );\n\n\t\t// Make sure we update the tween properties later on\n\t\tvalueParts = valueParts || [];\n\t}\n\n\tif ( valueParts ) {\n\t\tinitialInUnit = +initialInUnit || +initial || 0;\n\n\t\t// Apply relative offset (+=/-=) if specified\n\t\tadjusted = valueParts[ 1 ] ?\n\t\t\tinitialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] :\n\t\t\t+valueParts[ 2 ];\n\t\tif ( tween ) {\n\t\t\ttween.unit = unit;\n\t\t\ttween.start = initialInUnit;\n\t\t\ttween.end = adjusted;\n\t\t}\n\t}\n\treturn adjusted;\n}\n\n\nvar defaultDisplayMap = {};\n\nfunction getDefaultDisplay( elem ) {\n\tvar temp,\n\t\tdoc = elem.ownerDocument,\n\t\tnodeName = elem.nodeName,\n\t\tdisplay = defaultDisplayMap[ nodeName ];\n\n\tif ( display ) {\n\t\treturn display;\n\t}\n\n\ttemp = doc.body.appendChild( doc.createElement( nodeName ) );\n\tdisplay = jQuery.css( temp, \"display\" );\n\n\ttemp.parentNode.removeChild( temp );\n\n\tif ( display === \"none\" ) {\n\t\tdisplay = \"block\";\n\t}\n\tdefaultDisplayMap[ nodeName ] = display;\n\n\treturn display;\n}\n\nfunction showHide( elements, show ) {\n\tvar display, elem,\n\t\tvalues = [],\n\t\tindex = 0,\n\t\tlength = elements.length;\n\n\t// Determine new display value for elements that need to change\n\tfor ( ; index < length; index++ ) {\n\t\telem = elements[ index ];\n\t\tif ( !elem.style ) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tdisplay = elem.style.display;\n\t\tif ( show ) {\n\n\t\t\t// Since we force visibility upon cascade-hidden elements, an immediate (and slow)\n\t\t\t// check is required in this first loop unless we have a nonempty display value (either\n\t\t\t// inline or about-to-be-restored)\n\t\t\tif ( display === \"none\" ) {\n\t\t\t\tvalues[ index ] = dataPriv.get( elem, \"display\" ) || null;\n\t\t\t\tif ( !values[ index ] ) {\n\t\t\t\t\telem.style.display = \"\";\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ( elem.style.display === \"\" && isHiddenWithinTree( elem ) ) {\n\t\t\t\tvalues[ index ] = getDefaultDisplay( elem );\n\t\t\t}\n\t\t} else {\n\t\t\tif ( display !== \"none\" ) {\n\t\t\t\tvalues[ index ] = \"none\";\n\n\t\t\t\t// Remember what we're overwriting\n\t\t\t\tdataPriv.set( elem, \"display\", display );\n\t\t\t}\n\t\t}\n\t}\n\n\t// Set the display of the elements in a second loop to avoid constant reflow\n\tfor ( index = 0; index < length; index++ ) {\n\t\tif ( values[ index ] != null ) {\n\t\t\telements[ index ].style.display = values[ index ];\n\t\t}\n\t}\n\n\treturn elements;\n}\n\njQuery.fn.extend( {\n\tshow: function() {\n\t\treturn showHide( this, true );\n\t},\n\thide: function() {\n\t\treturn showHide( this );\n\t},\n\ttoggle: function( state ) {\n\t\tif ( typeof state === \"boolean\" ) {\n\t\t\treturn state ? this.show() : this.hide();\n\t\t}\n\n\t\treturn this.each( function() {\n\t\t\tif ( isHiddenWithinTree( this ) ) {\n\t\t\t\tjQuery( this ).show();\n\t\t\t} else {\n\t\t\t\tjQuery( this ).hide();\n\t\t\t}\n\t\t} );\n\t}\n} );\nvar rcheckableType = ( /^(?:checkbox|radio)$/i );\n\nvar rtagName = ( /<([a-z][^\\/\\0>\\x20\\t\\r\\n\\f]+)/i );\n\nvar rscriptType = ( /^$|^module$|\\/(?:java|ecma)script/i );\n\n\n\n// We have to close these tags to support XHTML (#13200)\nvar wrapMap = {\n\n\t// Support: IE <=9 only\n\toption: [ 1, \"<select multiple='multiple'>\", \"</select>\" ],\n\n\t// XHTML parsers do not magically insert elements in the\n\t// same way that tag soup parsers do. So we cannot shorten\n\t// this by omitting <tbody> or other required elements.\n\tthead: [ 1, \"<table>\", \"</table>\" ],\n\tcol: [ 2, \"<table><colgroup>\", \"</colgroup></table>\" ],\n\ttr: [ 2, \"<table><tbody>\", \"</tbody></table>\" ],\n\ttd: [ 3, \"<table><tbody><tr>\", \"</tr></tbody></table>\" ],\n\n\t_default: [ 0, \"\", \"\" ]\n};\n\n// Support: IE <=9 only\nwrapMap.optgroup = wrapMap.option;\n\nwrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;\nwrapMap.th = wrapMap.td;\n\n\nfunction getAll( context, tag ) {\n\n\t// Support: IE <=9 - 11 only\n\t// Use typeof to avoid zero-argument method invocation on host objects (#15151)\n\tvar ret;\n\n\tif ( typeof context.getElementsByTagName !== \"undefined\" ) {\n\t\tret = context.getElementsByTagName( tag || \"*\" );\n\n\t} else if ( typeof context.querySelectorAll !== \"undefined\" ) {\n\t\tret = context.querySelectorAll( tag || \"*\" );\n\n\t} else {\n\t\tret = [];\n\t}\n\n\tif ( tag === undefined || tag && nodeName( context, tag ) ) {\n\t\treturn jQuery.merge( [ context ], ret );\n\t}\n\n\treturn ret;\n}\n\n\n// Mark scripts as having already been evaluated\nfunction setGlobalEval( elems, refElements ) {\n\tvar i = 0,\n\t\tl = elems.length;\n\n\tfor ( ; i < l; i++ ) {\n\t\tdataPriv.set(\n\t\t\telems[ i ],\n\t\t\t\"globalEval\",\n\t\t\t!refElements || dataPriv.get( refElements[ i ], \"globalEval\" )\n\t\t);\n\t}\n}\n\n\nvar rhtml = /<|&#?\\w+;/;\n\nfunction buildFragment( elems, context, scripts, selection, ignored ) {\n\tvar elem, tmp, tag, wrap, contains, j,\n\t\tfragment = context.createDocumentFragment(),\n\t\tnodes = [],\n\t\ti = 0,\n\t\tl = elems.length;\n\n\tfor ( ; i < l; i++ ) {\n\t\telem = elems[ i ];\n\n\t\tif ( elem || elem === 0 ) {\n\n\t\t\t// Add nodes directly\n\t\t\tif ( toType( elem ) === \"object\" ) {\n\n\t\t\t\t// Support: Android <=4.0 only, PhantomJS 1 only\n\t\t\t\t// push.apply(_, arraylike) throws on ancient WebKit\n\t\t\t\tjQuery.merge( nodes, elem.nodeType ? [ elem ] : elem );\n\n\t\t\t// Convert non-html into a text node\n\t\t\t} else if ( !rhtml.test( elem ) ) {\n\t\t\t\tnodes.push( context.createTextNode( elem ) );\n\n\t\t\t// Convert html into DOM nodes\n\t\t\t} else {\n\t\t\t\ttmp = tmp || fragment.appendChild( context.createElement( \"div\" ) );\n\n\t\t\t\t// Deserialize a standard representation\n\t\t\t\ttag = ( rtagName.exec( elem ) || [ \"\", \"\" ] )[ 1 ].toLowerCase();\n\t\t\t\twrap = wrapMap[ tag ] || wrapMap._default;\n\t\t\t\ttmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ];\n\n\t\t\t\t// Descend through wrappers to the right content\n\t\t\t\tj = wrap[ 0 ];\n\t\t\t\twhile ( j-- ) {\n\t\t\t\t\ttmp = tmp.lastChild;\n\t\t\t\t}\n\n\t\t\t\t// Support: Android <=4.0 only, PhantomJS 1 only\n\t\t\t\t// push.apply(_, arraylike) throws on ancient WebKit\n\t\t\t\tjQuery.merge( nodes, tmp.childNodes );\n\n\t\t\t\t// Remember the top-level container\n\t\t\t\ttmp = fragment.firstChild;\n\n\t\t\t\t// Ensure the created nodes are orphaned (#12392)\n\t\t\t\ttmp.textContent = \"\";\n\t\t\t}\n\t\t}\n\t}\n\n\t// Remove wrapper from fragment\n\tfragment.textContent = \"\";\n\n\ti = 0;\n\twhile ( ( elem = nodes[ i++ ] ) ) {\n\n\t\t// Skip elements already in the context collection (trac-4087)\n\t\tif ( selection && jQuery.inArray( elem, selection ) > -1 ) {\n\t\t\tif ( ignored ) {\n\t\t\t\tignored.push( elem );\n\t\t\t}\n\t\t\tcontinue;\n\t\t}\n\n\t\tcontains = jQuery.contains( elem.ownerDocument, elem );\n\n\t\t// Append to fragment\n\t\ttmp = getAll( fragment.appendChild( elem ), \"script\" );\n\n\t\t// Preserve script evaluation history\n\t\tif ( contains ) {\n\t\t\tsetGlobalEval( tmp );\n\t\t}\n\n\t\t// Capture executables\n\t\tif ( scripts ) {\n\t\t\tj = 0;\n\t\t\twhile ( ( elem = tmp[ j++ ] ) ) {\n\t\t\t\tif ( rscriptType.test( elem.type || \"\" ) ) {\n\t\t\t\t\tscripts.push( elem );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn fragment;\n}\n\n\n( function() {\n\tvar fragment = document.createDocumentFragment(),\n\t\tdiv = fragment.appendChild( document.createElement( \"div\" ) ),\n\t\tinput = document.createElement( \"input\" );\n\n\t// Support: Android 4.0 - 4.3 only\n\t// Check state lost if the name is set (#11217)\n\t// Support: Windows Web Apps (WWA)\n\t// `name` and `type` must use .setAttribute for WWA (#14901)\n\tinput.setAttribute( \"type\", \"radio\" );\n\tinput.setAttribute( \"checked\", \"checked\" );\n\tinput.setAttribute( \"name\", \"t\" );\n\n\tdiv.appendChild( input );\n\n\t// Support: Android <=4.1 only\n\t// Older WebKit doesn't clone checked state correctly in fragments\n\tsupport.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked;\n\n\t// Support: IE <=11 only\n\t// Make sure textarea (and checkbox) defaultValue is properly cloned\n\tdiv.innerHTML = \"<textarea>x</textarea>\";\n\tsupport.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue;\n} )();\nvar documentElement = document.documentElement;\n\n\n\nvar\n\trkeyEvent = /^key/,\n\trmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/,\n\trtypenamespace = /^([^.]*)(?:\\.(.+)|)/;\n\nfunction returnTrue() {\n\treturn true;\n}\n\nfunction returnFalse() {\n\treturn false;\n}\n\n// Support: IE <=9 only\n// See #13393 for more info\nfunction safeActiveElement() {\n\ttry {\n\t\treturn document.activeElement;\n\t} catch ( err ) { }\n}\n\nfunction on( elem, types, selector, data, fn, one ) {\n\tvar origFn, type;\n\n\t// Types can be a map of types/handlers\n\tif ( typeof types === \"object\" ) {\n\n\t\t// ( types-Object, selector, data )\n\t\tif ( typeof selector !== \"string\" ) {\n\n\t\t\t// ( types-Object, data )\n\t\t\tdata = data || selector;\n\t\t\tselector = undefined;\n\t\t}\n\t\tfor ( type in types ) {\n\t\t\ton( elem, type, selector, data, types[ type ], one );\n\t\t}\n\t\treturn elem;\n\t}\n\n\tif ( data == null && fn == null ) {\n\n\t\t// ( types, fn )\n\t\tfn = selector;\n\t\tdata = selector = undefined;\n\t} else if ( fn == null ) {\n\t\tif ( typeof selector === \"string\" ) {\n\n\t\t\t// ( types, selector, fn )\n\t\t\tfn = data;\n\t\t\tdata = undefined;\n\t\t} else {\n\n\t\t\t// ( types, data, fn )\n\t\t\tfn = data;\n\t\t\tdata = selector;\n\t\t\tselector = undefined;\n\t\t}\n\t}\n\tif ( fn === false ) {\n\t\tfn = returnFalse;\n\t} else if ( !fn ) {\n\t\treturn elem;\n\t}\n\n\tif ( one === 1 ) {\n\t\torigFn = fn;\n\t\tfn = function( event ) {\n\n\t\t\t// Can use an empty set, since event contains the info\n\t\t\tjQuery().off( event );\n\t\t\treturn origFn.apply( this, arguments );\n\t\t};\n\n\t\t// Use same guid so caller can remove using origFn\n\t\tfn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );\n\t}\n\treturn elem.each( function() {\n\t\tjQuery.event.add( this, types, fn, data, selector );\n\t} );\n}\n\n/*\n * Helper functions for managing events -- not part of the public interface.\n * Props to Dean Edwards' addEvent library for many of the ideas.\n */\njQuery.event = {\n\n\tglobal: {},\n\n\tadd: function( elem, types, handler, data, selector ) {\n\n\t\tvar handleObjIn, eventHandle, tmp,\n\t\t\tevents, t, handleObj,\n\t\t\tspecial, handlers, type, namespaces, origType,\n\t\t\telemData = dataPriv.get( elem );\n\n\t\t// Don't attach events to noData or text/comment nodes (but allow plain objects)\n\t\tif ( !elemData ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Caller can pass in an object of custom data in lieu of the handler\n\t\tif ( handler.handler ) {\n\t\t\thandleObjIn = handler;\n\t\t\thandler = handleObjIn.handler;\n\t\t\tselector = handleObjIn.selector;\n\t\t}\n\n\t\t// Ensure that invalid selectors throw exceptions at attach time\n\t\t// Evaluate against documentElement in case elem is a non-element node (e.g., document)\n\t\tif ( selector ) {\n\t\t\tjQuery.find.matchesSelector( documentElement, selector );\n\t\t}\n\n\t\t// Make sure that the handler has a unique ID, used to find/remove it later\n\t\tif ( !handler.guid ) {\n\t\t\thandler.guid = jQuery.guid++;\n\t\t}\n\n\t\t// Init the element's event structure and main handler, if this is the first\n\t\tif ( !( events = elemData.events ) ) {\n\t\t\tevents = elemData.events = {};\n\t\t}\n\t\tif ( !( eventHandle = elemData.handle ) ) {\n\t\t\teventHandle = elemData.handle = function( e ) {\n\n\t\t\t\t// Discard the second event of a jQuery.event.trigger() and\n\t\t\t\t// when an event is called after a page has unloaded\n\t\t\t\treturn typeof jQuery !== \"undefined\" && jQuery.event.triggered !== e.type ?\n\t\t\t\t\tjQuery.event.dispatch.apply( elem, arguments ) : undefined;\n\t\t\t};\n\t\t}\n\n\t\t// Handle multiple events separated by a space\n\t\ttypes = ( types || \"\" ).match( rnothtmlwhite ) || [ \"\" ];\n\t\tt = types.length;\n\t\twhile ( t-- ) {\n\t\t\ttmp = rtypenamespace.exec( types[ t ] ) || [];\n\t\t\ttype = origType = tmp[ 1 ];\n\t\t\tnamespaces = ( tmp[ 2 ] || \"\" ).split( \".\" ).sort();\n\n\t\t\t// There *must* be a type, no attaching namespace-only handlers\n\t\t\tif ( !type ) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// If event changes its type, use the special event handlers for the changed type\n\t\t\tspecial = jQuery.event.special[ type ] || {};\n\n\t\t\t// If selector defined, determine special event api type, otherwise given type\n\t\t\ttype = ( selector ? special.delegateType : special.bindType ) || type;\n\n\t\t\t// Update special based on newly reset type\n\t\t\tspecial = jQuery.event.special[ type ] || {};\n\n\t\t\t// handleObj is passed to all event handlers\n\t\t\thandleObj = jQuery.extend( {\n\t\t\t\ttype: type,\n\t\t\t\torigType: origType,\n\t\t\t\tdata: data,\n\t\t\t\thandler: handler,\n\t\t\t\tguid: handler.guid,\n\t\t\t\tselector: selector,\n\t\t\t\tneedsContext: selector && jQuery.expr.match.needsContext.test( selector ),\n\t\t\t\tnamespace: namespaces.join( \".\" )\n\t\t\t}, handleObjIn );\n\n\t\t\t// Init the event handler queue if we're the first\n\t\t\tif ( !( handlers = events[ type ] ) ) {\n\t\t\t\thandlers = events[ type ] = [];\n\t\t\t\thandlers.delegateCount = 0;\n\n\t\t\t\t// Only use addEventListener if the special events handler returns false\n\t\t\t\tif ( !special.setup ||\n\t\t\t\t\tspecial.setup.call( elem, data, namespaces, eventHandle ) === false ) {\n\n\t\t\t\t\tif ( elem.addEventListener ) {\n\t\t\t\t\t\telem.addEventListener( type, eventHandle );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif ( special.add ) {\n\t\t\t\tspecial.add.call( elem, handleObj );\n\n\t\t\t\tif ( !handleObj.handler.guid ) {\n\t\t\t\t\thandleObj.handler.guid = handler.guid;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Add to the element's handler list, delegates in front\n\t\t\tif ( selector ) {\n\t\t\t\thandlers.splice( handlers.delegateCount++, 0, handleObj );\n\t\t\t} else {\n\t\t\t\thandlers.push( handleObj );\n\t\t\t}\n\n\t\t\t// Keep track of which events have ever been used, for event optimization\n\t\t\tjQuery.event.global[ type ] = true;\n\t\t}\n\n\t},\n\n\t// Detach an event or set of events from an element\n\tremove: function( elem, types, handler, selector, mappedTypes ) {\n\n\t\tvar j, origCount, tmp,\n\t\t\tevents, t, handleObj,\n\t\t\tspecial, handlers, type, namespaces, origType,\n\t\t\telemData = dataPriv.hasData( elem ) && dataPriv.get( elem );\n\n\t\tif ( !elemData || !( events = elemData.events ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Once for each type.namespace in types; type may be omitted\n\t\ttypes = ( types || \"\" ).match( rnothtmlwhite ) || [ \"\" ];\n\t\tt = types.length;\n\t\twhile ( t-- ) {\n\t\t\ttmp = rtypenamespace.exec( types[ t ] ) || [];\n\t\t\ttype = origType = tmp[ 1 ];\n\t\t\tnamespaces = ( tmp[ 2 ] || \"\" ).split( \".\" ).sort();\n\n\t\t\t// Unbind all events (on this namespace, if provided) for the element\n\t\t\tif ( !type ) {\n\t\t\t\tfor ( type in events ) {\n\t\t\t\t\tjQuery.event.remove( elem, type + types[ t ], handler, selector, true );\n\t\t\t\t}\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tspecial = jQuery.event.special[ type ] || {};\n\t\t\ttype = ( selector ? special.delegateType : special.bindType ) || type;\n\t\t\thandlers = events[ type ] || [];\n\t\t\ttmp = tmp[ 2 ] &&\n\t\t\t\tnew RegExp( \"(^|\\\\.)\" + namespaces.join( \"\\\\.(?:.*\\\\.|)\" ) + \"(\\\\.|$)\" );\n\n\t\t\t// Remove matching events\n\t\t\torigCount = j = handlers.length;\n\t\t\twhile ( j-- ) {\n\t\t\t\thandleObj = handlers[ j ];\n\n\t\t\t\tif ( ( mappedTypes || origType === handleObj.origType ) &&\n\t\t\t\t\t( !handler || handler.guid === handleObj.guid ) &&\n\t\t\t\t\t( !tmp || tmp.test( handleObj.namespace ) ) &&\n\t\t\t\t\t( !selector || selector === handleObj.selector ||\n\t\t\t\t\t\tselector === \"**\" && handleObj.selector ) ) {\n\t\t\t\t\thandlers.splice( j, 1 );\n\n\t\t\t\t\tif ( handleObj.selector ) {\n\t\t\t\t\t\thandlers.delegateCount--;\n\t\t\t\t\t}\n\t\t\t\t\tif ( special.remove ) {\n\t\t\t\t\t\tspecial.remove.call( elem, handleObj );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Remove generic event handler if we removed something and no more handlers exist\n\t\t\t// (avoids potential for endless recursion during removal of special event handlers)\n\t\t\tif ( origCount && !handlers.length ) {\n\t\t\t\tif ( !special.teardown ||\n\t\t\t\t\tspecial.teardown.call( elem, namespaces, elemData.handle ) === false ) {\n\n\t\t\t\t\tjQuery.removeEvent( elem, type, elemData.handle );\n\t\t\t\t}\n\n\t\t\t\tdelete events[ type ];\n\t\t\t}\n\t\t}\n\n\t\t// Remove data and the expando if it's no longer used\n\t\tif ( jQuery.isEmptyObject( events ) ) {\n\t\t\tdataPriv.remove( elem, \"handle events\" );\n\t\t}\n\t},\n\n\tdispatch: function( nativeEvent ) {\n\n\t\t// Make a writable jQuery.Event from the native event object\n\t\tvar event = jQuery.event.fix( nativeEvent );\n\n\t\tvar i, j, ret, matched, handleObj, handlerQueue,\n\t\t\targs = new Array( arguments.length ),\n\t\t\thandlers = ( dataPriv.get( this, \"events\" ) || {} )[ event.type ] || [],\n\t\t\tspecial = jQuery.event.special[ event.type ] || {};\n\n\t\t// Use the fix-ed jQuery.Event rather than the (read-only) native event\n\t\targs[ 0 ] = event;\n\n\t\tfor ( i = 1; i < arguments.length; i++ ) {\n\t\t\targs[ i ] = arguments[ i ];\n\t\t}\n\n\t\tevent.delegateTarget = this;\n\n\t\t// Call the preDispatch hook for the mapped type, and let it bail if desired\n\t\tif ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Determine handlers\n\t\thandlerQueue = jQuery.event.handlers.call( this, event, handlers );\n\n\t\t// Run delegates first; they may want to stop propagation beneath us\n\t\ti = 0;\n\t\twhile ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) {\n\t\t\tevent.currentTarget = matched.elem;\n\n\t\t\tj = 0;\n\t\t\twhile ( ( handleObj = matched.handlers[ j++ ] ) &&\n\t\t\t\t!event.isImmediatePropagationStopped() ) {\n\n\t\t\t\t// Triggered event must either 1) have no namespace, or 2) have namespace(s)\n\t\t\t\t// a subset or equal to those in the bound event (both can have no namespace).\n\t\t\t\tif ( !event.rnamespace || event.rnamespace.test( handleObj.namespace ) ) {\n\n\t\t\t\t\tevent.handleObj = handleObj;\n\t\t\t\t\tevent.data = handleObj.data;\n\n\t\t\t\t\tret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle ||\n\t\t\t\t\t\thandleObj.handler ).apply( matched.elem, args );\n\n\t\t\t\t\tif ( ret !== undefined ) {\n\t\t\t\t\t\tif ( ( event.result = ret ) === false ) {\n\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Call the postDispatch hook for the mapped type\n\t\tif ( special.postDispatch ) {\n\t\t\tspecial.postDispatch.call( this, event );\n\t\t}\n\n\t\treturn event.result;\n\t},\n\n\thandlers: function( event, handlers ) {\n\t\tvar i, handleObj, sel, matchedHandlers, matchedSelectors,\n\t\t\thandlerQueue = [],\n\t\t\tdelegateCount = handlers.delegateCount,\n\t\t\tcur = event.target;\n\n\t\t// Find delegate handlers\n\t\tif ( delegateCount &&\n\n\t\t\t// Support: IE <=9\n\t\t\t// Black-hole SVG <use> instance trees (trac-13180)\n\t\t\tcur.nodeType &&\n\n\t\t\t// Support: Firefox <=42\n\t\t\t// Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861)\n\t\t\t// https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click\n\t\t\t// Support: IE 11 only\n\t\t\t// ...but not arrow key \"clicks\" of radio inputs, which can have `button` -1 (gh-2343)\n\t\t\t!( event.type === \"click\" && event.button >= 1 ) ) {\n\n\t\t\tfor ( ; cur !== this; cur = cur.parentNode || this ) {\n\n\t\t\t\t// Don't check non-elements (#13208)\n\t\t\t\t// Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)\n\t\t\t\tif ( cur.nodeType === 1 && !( event.type === \"click\" && cur.disabled === true ) ) {\n\t\t\t\t\tmatchedHandlers = [];\n\t\t\t\t\tmatchedSelectors = {};\n\t\t\t\t\tfor ( i = 0; i < delegateCount; i++ ) {\n\t\t\t\t\t\thandleObj = handlers[ i ];\n\n\t\t\t\t\t\t// Don't conflict with Object.prototype properties (#13203)\n\t\t\t\t\t\tsel = handleObj.selector + \" \";\n\n\t\t\t\t\t\tif ( matchedSelectors[ sel ] === undefined ) {\n\t\t\t\t\t\t\tmatchedSelectors[ sel ] = handleObj.needsContext ?\n\t\t\t\t\t\t\t\tjQuery( sel, this ).index( cur ) > -1 :\n\t\t\t\t\t\t\t\tjQuery.find( sel, this, null, [ cur ] ).length;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif ( matchedSelectors[ sel ] ) {\n\t\t\t\t\t\t\tmatchedHandlers.push( handleObj );\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif ( matchedHandlers.length ) {\n\t\t\t\t\t\thandlerQueue.push( { elem: cur, handlers: matchedHandlers } );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Add the remaining (directly-bound) handlers\n\t\tcur = this;\n\t\tif ( delegateCount < handlers.length ) {\n\t\t\thandlerQueue.push( { elem: cur, handlers: handlers.slice( delegateCount ) } );\n\t\t}\n\n\t\treturn handlerQueue;\n\t},\n\n\taddProp: function( name, hook ) {\n\t\tObject.defineProperty( jQuery.Event.prototype, name, {\n\t\t\tenumerable: true,\n\t\t\tconfigurable: true,\n\n\t\t\tget: isFunction( hook ) ?\n\t\t\t\tfunction() {\n\t\t\t\t\tif ( this.originalEvent ) {\n\t\t\t\t\t\t\treturn hook( this.originalEvent );\n\t\t\t\t\t}\n\t\t\t\t} :\n\t\t\t\tfunction() {\n\t\t\t\t\tif ( this.originalEvent ) {\n\t\t\t\t\t\t\treturn this.originalEvent[ name ];\n\t\t\t\t\t}\n\t\t\t\t},\n\n\t\t\tset: function( value ) {\n\t\t\t\tObject.defineProperty( this, name, {\n\t\t\t\t\tenumerable: true,\n\t\t\t\t\tconfigurable: true,\n\t\t\t\t\twritable: true,\n\t\t\t\t\tvalue: value\n\t\t\t\t} );\n\t\t\t}\n\t\t} );\n\t},\n\n\tfix: function( originalEvent ) {\n\t\treturn originalEvent[ jQuery.expando ] ?\n\t\t\toriginalEvent :\n\t\t\tnew jQuery.Event( originalEvent );\n\t},\n\n\tspecial: {\n\t\tload: {\n\n\t\t\t// Prevent triggered image.load events from bubbling to window.load\n\t\t\tnoBubble: true\n\t\t},\n\t\tfocus: {\n\n\t\t\t// Fire native event if possible so blur/focus sequence is correct\n\t\t\ttrigger: function() {\n\t\t\t\tif ( this !== safeActiveElement() && this.focus ) {\n\t\t\t\t\tthis.focus();\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t},\n\t\t\tdelegateType: \"focusin\"\n\t\t},\n\t\tblur: {\n\t\t\ttrigger: function() {\n\t\t\t\tif ( this === safeActiveElement() && this.blur ) {\n\t\t\t\t\tthis.blur();\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t},\n\t\t\tdelegateType: \"focusout\"\n\t\t},\n\t\tclick: {\n\n\t\t\t// For checkbox, fire native event so checked state will be right\n\t\t\ttrigger: function() {\n\t\t\t\tif ( this.type === \"checkbox\" && this.click && nodeName( this, \"input\" ) ) {\n\t\t\t\t\tthis.click();\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t},\n\n\t\t\t// For cross-browser consistency, don't fire native .click() on links\n\t\t\t_default: function( event ) {\n\t\t\t\treturn nodeName( event.target, \"a\" );\n\t\t\t}\n\t\t},\n\n\t\tbeforeunload: {\n\t\t\tpostDispatch: function( event ) {\n\n\t\t\t\t// Support: Firefox 20+\n\t\t\t\t// Firefox doesn't alert if the returnValue field is not set.\n\t\t\t\tif ( event.result !== undefined && event.originalEvent ) {\n\t\t\t\t\tevent.originalEvent.returnValue = event.result;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n};\n\njQuery.removeEvent = function( elem, type, handle ) {\n\n\t// This \"if\" is needed for plain objects\n\tif ( elem.removeEventListener ) {\n\t\telem.removeEventListener( type, handle );\n\t}\n};\n\njQuery.Event = function( src, props ) {\n\n\t// Allow instantiation without the 'new' keyword\n\tif ( !( this instanceof jQuery.Event ) ) {\n\t\treturn new jQuery.Event( src, props );\n\t}\n\n\t// Event object\n\tif ( src && src.type ) {\n\t\tthis.originalEvent = src;\n\t\tthis.type = src.type;\n\n\t\t// Events bubbling up the document may have been marked as prevented\n\t\t// by a handler lower down the tree; reflect the correct value.\n\t\tthis.isDefaultPrevented = src.defaultPrevented ||\n\t\t\t\tsrc.defaultPrevented === undefined &&\n\n\t\t\t\t// Support: Android <=2.3 only\n\t\t\t\tsrc.returnValue === false ?\n\t\t\treturnTrue :\n\t\t\treturnFalse;\n\n\t\t// Create target properties\n\t\t// Support: Safari <=6 - 7 only\n\t\t// Target should not be a text node (#504, #13143)\n\t\tthis.target = ( src.target && src.target.nodeType === 3 ) ?\n\t\t\tsrc.target.parentNode :\n\t\t\tsrc.target;\n\n\t\tthis.currentTarget = src.currentTarget;\n\t\tthis.relatedTarget = src.relatedTarget;\n\n\t// Event type\n\t} else {\n\t\tthis.type = src;\n\t}\n\n\t// Put explicitly provided properties onto the event object\n\tif ( props ) {\n\t\tjQuery.extend( this, props );\n\t}\n\n\t// Create a timestamp if incoming event doesn't have one\n\tthis.timeStamp = src && src.timeStamp || Date.now();\n\n\t// Mark it as fixed\n\tthis[ jQuery.expando ] = true;\n};\n\n// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding\n// https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html\njQuery.Event.prototype = {\n\tconstructor: jQuery.Event,\n\tisDefaultPrevented: returnFalse,\n\tisPropagationStopped: returnFalse,\n\tisImmediatePropagationStopped: returnFalse,\n\tisSimulated: false,\n\n\tpreventDefault: function() {\n\t\tvar e = this.originalEvent;\n\n\t\tthis.isDefaultPrevented = returnTrue;\n\n\t\tif ( e && !this.isSimulated ) {\n\t\t\te.preventDefault();\n\t\t}\n\t},\n\tstopPropagation: function() {\n\t\tvar e = this.originalEvent;\n\n\t\tthis.isPropagationStopped = returnTrue;\n\n\t\tif ( e && !this.isSimulated ) {\n\t\t\te.stopPropagation();\n\t\t}\n\t},\n\tstopImmediatePropagation: function() {\n\t\tvar e = this.originalEvent;\n\n\t\tthis.isImmediatePropagationStopped = returnTrue;\n\n\t\tif ( e && !this.isSimulated ) {\n\t\t\te.stopImmediatePropagation();\n\t\t}\n\n\t\tthis.stopPropagation();\n\t}\n};\n\n// Includes all common event props including KeyEvent and MouseEvent specific props\njQuery.each( {\n\taltKey: true,\n\tbubbles: true,\n\tcancelable: true,\n\tchangedTouches: true,\n\tctrlKey: true,\n\tdetail: true,\n\teventPhase: true,\n\tmetaKey: true,\n\tpageX: true,\n\tpageY: true,\n\tshiftKey: true,\n\tview: true,\n\t\"char\": true,\n\tcharCode: true,\n\tkey: true,\n\tkeyCode: true,\n\tbutton: true,\n\tbuttons: true,\n\tclientX: true,\n\tclientY: true,\n\toffsetX: true,\n\toffsetY: true,\n\tpointerId: true,\n\tpointerType: true,\n\tscreenX: true,\n\tscreenY: true,\n\ttargetTouches: true,\n\ttoElement: true,\n\ttouches: true,\n\n\twhich: function( event ) {\n\t\tvar button = event.button;\n\n\t\t// Add which for key events\n\t\tif ( event.which == null && rkeyEvent.test( event.type ) ) {\n\t\t\treturn event.charCode != null ? event.charCode : event.keyCode;\n\t\t}\n\n\t\t// Add which for click: 1 === left; 2 === middle; 3 === right\n\t\tif ( !event.which && button !== undefined && rmouseEvent.test( event.type ) ) {\n\t\t\tif ( button & 1 ) {\n\t\t\t\treturn 1;\n\t\t\t}\n\n\t\t\tif ( button & 2 ) {\n\t\t\t\treturn 3;\n\t\t\t}\n\n\t\t\tif ( button & 4 ) {\n\t\t\t\treturn 2;\n\t\t\t}\n\n\t\t\treturn 0;\n\t\t}\n\n\t\treturn event.which;\n\t}\n}, jQuery.event.addProp );\n\n// Create mouseenter/leave events using mouseover/out and event-time checks\n// so that event delegation works in jQuery.\n// Do the same for pointerenter/pointerleave and pointerover/pointerout\n//\n// Support: Safari 7 only\n// Safari sends mouseenter too often; see:\n// https://bugs.chromium.org/p/chromium/issues/detail?id=470258\n// for the description of the bug (it existed in older Chrome versions as well).\njQuery.each( {\n\tmouseenter: \"mouseover\",\n\tmouseleave: \"mouseout\",\n\tpointerenter: \"pointerover\",\n\tpointerleave: \"pointerout\"\n}, function( orig, fix ) {\n\tjQuery.event.special[ orig ] = {\n\t\tdelegateType: fix,\n\t\tbindType: fix,\n\n\t\thandle: function( event ) {\n\t\t\tvar ret,\n\t\t\t\ttarget = this,\n\t\t\t\trelated = event.relatedTarget,\n\t\t\t\thandleObj = event.handleObj;\n\n\t\t\t// For mouseenter/leave call the handler if related is outside the target.\n\t\t\t// NB: No relatedTarget if the mouse left/entered the browser window\n\t\t\tif ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) {\n\t\t\t\tevent.type = handleObj.origType;\n\t\t\t\tret = handleObj.handler.apply( this, arguments );\n\t\t\t\tevent.type = fix;\n\t\t\t}\n\t\t\treturn ret;\n\t\t}\n\t};\n} );\n\njQuery.fn.extend( {\n\n\ton: function( types, selector, data, fn ) {\n\t\treturn on( this, types, selector, data, fn );\n\t},\n\tone: function( types, selector, data, fn ) {\n\t\treturn on( this, types, selector, data, fn, 1 );\n\t},\n\toff: function( types, selector, fn ) {\n\t\tvar handleObj, type;\n\t\tif ( types && types.preventDefault && types.handleObj ) {\n\n\t\t\t// ( event ) dispatched jQuery.Event\n\t\t\thandleObj = types.handleObj;\n\t\t\tjQuery( types.delegateTarget ).off(\n\t\t\t\thandleObj.namespace ?\n\t\t\t\t\thandleObj.origType + \".\" + handleObj.namespace :\n\t\t\t\t\thandleObj.origType,\n\t\t\t\thandleObj.selector,\n\t\t\t\thandleObj.handler\n\t\t\t);\n\t\t\treturn this;\n\t\t}\n\t\tif ( typeof types === \"object\" ) {\n\n\t\t\t// ( types-object [, selector] )\n\t\t\tfor ( type in types ) {\n\t\t\t\tthis.off( type, selector, types[ type ] );\n\t\t\t}\n\t\t\treturn this;\n\t\t}\n\t\tif ( selector === false || typeof selector === \"function\" ) {\n\n\t\t\t// ( types [, fn] )\n\t\t\tfn = selector;\n\t\t\tselector = undefined;\n\t\t}\n\t\tif ( fn === false ) {\n\t\t\tfn = returnFalse;\n\t\t}\n\t\treturn this.each( function() {\n\t\t\tjQuery.event.remove( this, types, fn, selector );\n\t\t} );\n\t}\n} );\n\n\nvar\n\n\t/* eslint-disable max-len */\n\n\t// See https://github.com/eslint/eslint/issues/3229\n\trxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\\/\\0>\\x20\\t\\r\\n\\f]*)[^>]*)\\/>/gi,\n\n\t/* eslint-enable */\n\n\t// Support: IE <=10 - 11, Edge 12 - 13 only\n\t// In IE/Edge using regex groups here causes severe slowdowns.\n\t// See https://connect.microsoft.com/IE/feedback/details/1736512/\n\trnoInnerhtml = /<script|<style|<link/i,\n\n\t// checked=\"checked\" or checked\n\trchecked = /checked\\s*(?:[^=]|=\\s*.checked.)/i,\n\trcleanScript = /^\\s*<!(?:\\[CDATA\\[|--)|(?:\\]\\]|--)>\\s*$/g;\n\n// Prefer a tbody over its parent table for containing new rows\nfunction manipulationTarget( elem, content ) {\n\tif ( nodeName( elem, \"table\" ) &&\n\t\tnodeName( content.nodeType !== 11 ? content : content.firstChild, \"tr\" ) ) {\n\n\t\treturn jQuery( elem ).children( \"tbody\" )[ 0 ] || elem;\n\t}\n\n\treturn elem;\n}\n\n// Replace/restore the type attribute of script elements for safe DOM manipulation\nfunction disableScript( elem ) {\n\telem.type = ( elem.getAttribute( \"type\" ) !== null ) + \"/\" + elem.type;\n\treturn elem;\n}\nfunction restoreScript( elem ) {\n\tif ( ( elem.type || \"\" ).slice( 0, 5 ) === \"true/\" ) {\n\t\telem.type = elem.type.slice( 5 );\n\t} else {\n\t\telem.removeAttribute( \"type\" );\n\t}\n\n\treturn elem;\n}\n\nfunction cloneCopyEvent( src, dest ) {\n\tvar i, l, type, pdataOld, pdataCur, udataOld, udataCur, events;\n\n\tif ( dest.nodeType !== 1 ) {\n\t\treturn;\n\t}\n\n\t// 1. Copy private data: events, handlers, etc.\n\tif ( dataPriv.hasData( src ) ) {\n\t\tpdataOld = dataPriv.access( src );\n\t\tpdataCur = dataPriv.set( dest, pdataOld );\n\t\tevents = pdataOld.events;\n\n\t\tif ( events ) {\n\t\t\tdelete pdataCur.handle;\n\t\t\tpdataCur.events = {};\n\n\t\t\tfor ( type in events ) {\n\t\t\t\tfor ( i = 0, l = events[ type ].length; i < l; i++ ) {\n\t\t\t\t\tjQuery.event.add( dest, type, events[ type ][ i ] );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// 2. Copy user data\n\tif ( dataUser.hasData( src ) ) {\n\t\tudataOld = dataUser.access( src );\n\t\tudataCur = jQuery.extend( {}, udataOld );\n\n\t\tdataUser.set( dest, udataCur );\n\t}\n}\n\n// Fix IE bugs, see support tests\nfunction fixInput( src, dest ) {\n\tvar nodeName = dest.nodeName.toLowerCase();\n\n\t// Fails to persist the checked state of a cloned checkbox or radio button.\n\tif ( nodeName === \"input\" && rcheckableType.test( src.type ) ) {\n\t\tdest.checked = src.checked;\n\n\t// Fails to return the selected option to the default selected state when cloning options\n\t} else if ( nodeName === \"input\" || nodeName === \"textarea\" ) {\n\t\tdest.defaultValue = src.defaultValue;\n\t}\n}\n\nfunction domManip( collection, args, callback, ignored ) {\n\n\t// Flatten any nested arrays\n\targs = concat.apply( [], args );\n\n\tvar fragment, first, scripts, hasScripts, node, doc,\n\t\ti = 0,\n\t\tl = collection.length,\n\t\tiNoClone = l - 1,\n\t\tvalue = args[ 0 ],\n\t\tvalueIsFunction = isFunction( value );\n\n\t// We can't cloneNode fragments that contain checked, in WebKit\n\tif ( valueIsFunction ||\n\t\t\t( l > 1 && typeof value === \"string\" &&\n\t\t\t\t!support.checkClone && rchecked.test( value ) ) ) {\n\t\treturn collection.each( function( index ) {\n\t\t\tvar self = collection.eq( index );\n\t\t\tif ( valueIsFunction ) {\n\t\t\t\targs[ 0 ] = value.call( this, index, self.html() );\n\t\t\t}\n\t\t\tdomManip( self, args, callback, ignored );\n\t\t} );\n\t}\n\n\tif ( l ) {\n\t\tfragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored );\n\t\tfirst = fragment.firstChild;\n\n\t\tif ( fragment.childNodes.length === 1 ) {\n\t\t\tfragment = first;\n\t\t}\n\n\t\t// Require either new content or an interest in ignored elements to invoke the callback\n\t\tif ( first || ignored ) {\n\t\t\tscripts = jQuery.map( getAll( fragment, \"script\" ), disableScript );\n\t\t\thasScripts = scripts.length;\n\n\t\t\t// Use the original fragment for the last item\n\t\t\t// instead of the first because it can end up\n\t\t\t// being emptied incorrectly in certain situations (#8070).\n\t\t\tfor ( ; i < l; i++ ) {\n\t\t\t\tnode = fragment;\n\n\t\t\t\tif ( i !== iNoClone ) {\n\t\t\t\t\tnode = jQuery.clone( node, true, true );\n\n\t\t\t\t\t// Keep references to cloned scripts for later restoration\n\t\t\t\t\tif ( hasScripts ) {\n\n\t\t\t\t\t\t// Support: Android <=4.0 only, PhantomJS 1 only\n\t\t\t\t\t\t// push.apply(_, arraylike) throws on ancient WebKit\n\t\t\t\t\t\tjQuery.merge( scripts, getAll( node, \"script\" ) );\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tcallback.call( collection[ i ], node, i );\n\t\t\t}\n\n\t\t\tif ( hasScripts ) {\n\t\t\t\tdoc = scripts[ scripts.length - 1 ].ownerDocument;\n\n\t\t\t\t// Reenable scripts\n\t\t\t\tjQuery.map( scripts, restoreScript );\n\n\t\t\t\t// Evaluate executable scripts on first document insertion\n\t\t\t\tfor ( i = 0; i < hasScripts; i++ ) {\n\t\t\t\t\tnode = scripts[ i ];\n\t\t\t\t\tif ( rscriptType.test( node.type || \"\" ) &&\n\t\t\t\t\t\t!dataPriv.access( node, \"globalEval\" ) &&\n\t\t\t\t\t\tjQuery.contains( doc, node ) ) {\n\n\t\t\t\t\t\tif ( node.src && ( node.type || \"\" ).toLowerCase() !== \"module\" ) {\n\n\t\t\t\t\t\t\t// Optional AJAX dependency, but won't run scripts if not present\n\t\t\t\t\t\t\tif ( jQuery._evalUrl ) {\n\t\t\t\t\t\t\t\tjQuery._evalUrl( node.src );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tDOMEval( node.textContent.replace( rcleanScript, \"\" ), doc, node );\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn collection;\n}\n\nfunction remove( elem, selector, keepData ) {\n\tvar node,\n\t\tnodes = selector ? jQuery.filter( selector, elem ) : elem,\n\t\ti = 0;\n\n\tfor ( ; ( node = nodes[ i ] ) != null; i++ ) {\n\t\tif ( !keepData && node.nodeType === 1 ) {\n\t\t\tjQuery.cleanData( getAll( node ) );\n\t\t}\n\n\t\tif ( node.parentNode ) {\n\t\t\tif ( keepData && jQuery.contains( node.ownerDocument, node ) ) {\n\t\t\t\tsetGlobalEval( getAll( node, \"script\" ) );\n\t\t\t}\n\t\t\tnode.parentNode.removeChild( node );\n\t\t}\n\t}\n\n\treturn elem;\n}\n\njQuery.extend( {\n\thtmlPrefilter: function( html ) {\n\t\treturn html.replace( rxhtmlTag, \"<$1></$2>\" );\n\t},\n\n\tclone: function( elem, dataAndEvents, deepDataAndEvents ) {\n\t\tvar i, l, srcElements, destElements,\n\t\t\tclone = elem.cloneNode( true ),\n\t\t\tinPage = jQuery.contains( elem.ownerDocument, elem );\n\n\t\t// Fix IE cloning issues\n\t\tif ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) &&\n\t\t\t\t!jQuery.isXMLDoc( elem ) ) {\n\n\t\t\t// We eschew Sizzle here for performance reasons: https://jsperf.com/getall-vs-sizzle/2\n\t\t\tdestElements = getAll( clone );\n\t\t\tsrcElements = getAll( elem );\n\n\t\t\tfor ( i = 0, l = srcElements.length; i < l; i++ ) {\n\t\t\t\tfixInput( srcElements[ i ], destElements[ i ] );\n\t\t\t}\n\t\t}\n\n\t\t// Copy the events from the original to the clone\n\t\tif ( dataAndEvents ) {\n\t\t\tif ( deepDataAndEvents ) {\n\t\t\t\tsrcElements = srcElements || getAll( elem );\n\t\t\t\tdestElements = destElements || getAll( clone );\n\n\t\t\t\tfor ( i = 0, l = srcElements.length; i < l; i++ ) {\n\t\t\t\t\tcloneCopyEvent( srcElements[ i ], destElements[ i ] );\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tcloneCopyEvent( elem, clone );\n\t\t\t}\n\t\t}\n\n\t\t// Preserve script evaluation history\n\t\tdestElements = getAll( clone, \"script\" );\n\t\tif ( destElements.length > 0 ) {\n\t\t\tsetGlobalEval( destElements, !inPage && getAll( elem, \"script\" ) );\n\t\t}\n\n\t\t// Return the cloned set\n\t\treturn clone;\n\t},\n\n\tcleanData: function( elems ) {\n\t\tvar data, elem, type,\n\t\t\tspecial = jQuery.event.special,\n\t\t\ti = 0;\n\n\t\tfor ( ; ( elem = elems[ i ] ) !== undefined; i++ ) {\n\t\t\tif ( acceptData( elem ) ) {\n\t\t\t\tif ( ( data = elem[ dataPriv.expando ] ) ) {\n\t\t\t\t\tif ( data.events ) {\n\t\t\t\t\t\tfor ( type in data.events ) {\n\t\t\t\t\t\t\tif ( special[ type ] ) {\n\t\t\t\t\t\t\t\tjQuery.event.remove( elem, type );\n\n\t\t\t\t\t\t\t// This is a shortcut to avoid jQuery.event.remove's overhead\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tjQuery.removeEvent( elem, type, data.handle );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t// Support: Chrome <=35 - 45+\n\t\t\t\t\t// Assign undefined instead of using delete, see Data#remove\n\t\t\t\t\telem[ dataPriv.expando ] = undefined;\n\t\t\t\t}\n\t\t\t\tif ( elem[ dataUser.expando ] ) {\n\n\t\t\t\t\t// Support: Chrome <=35 - 45+\n\t\t\t\t\t// Assign undefined instead of using delete, see Data#remove\n\t\t\t\t\telem[ dataUser.expando ] = undefined;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n} );\n\njQuery.fn.extend( {\n\tdetach: function( selector ) {\n\t\treturn remove( this, selector, true );\n\t},\n\n\tremove: function( selector ) {\n\t\treturn remove( this, selector );\n\t},\n\n\ttext: function( value ) {\n\t\treturn access( this, function( value ) {\n\t\t\treturn value === undefined ?\n\t\t\t\tjQuery.text( this ) :\n\t\t\t\tthis.empty().each( function() {\n\t\t\t\t\tif ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {\n\t\t\t\t\t\tthis.textContent = value;\n\t\t\t\t\t}\n\t\t\t\t} );\n\t\t}, null, value, arguments.length );\n\t},\n\n\tappend: function() {\n\t\treturn domManip( this, arguments, function( elem ) {\n\t\t\tif ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {\n\t\t\t\tvar target = manipulationTarget( this, elem );\n\t\t\t\ttarget.appendChild( elem );\n\t\t\t}\n\t\t} );\n\t},\n\n\tprepend: function() {\n\t\treturn domManip( this, arguments, function( elem ) {\n\t\t\tif ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {\n\t\t\t\tvar target = manipulationTarget( this, elem );\n\t\t\t\ttarget.insertBefore( elem, target.firstChild );\n\t\t\t}\n\t\t} );\n\t},\n\n\tbefore: function() {\n\t\treturn domManip( this, arguments, function( elem ) {\n\t\t\tif ( this.parentNode ) {\n\t\t\t\tthis.parentNode.insertBefore( elem, this );\n\t\t\t}\n\t\t} );\n\t},\n\n\tafter: function() {\n\t\treturn domManip( this, arguments, function( elem ) {\n\t\t\tif ( this.parentNode ) {\n\t\t\t\tthis.parentNode.insertBefore( elem, this.nextSibling );\n\t\t\t}\n\t\t} );\n\t},\n\n\tempty: function() {\n\t\tvar elem,\n\t\t\ti = 0;\n\n\t\tfor ( ; ( elem = this[ i ] ) != null; i++ ) {\n\t\t\tif ( elem.nodeType === 1 ) {\n\n\t\t\t\t// Prevent memory leaks\n\t\t\t\tjQuery.cleanData( getAll( elem, false ) );\n\n\t\t\t\t// Remove any remaining nodes\n\t\t\t\telem.textContent = \"\";\n\t\t\t}\n\t\t}\n\n\t\treturn this;\n\t},\n\n\tclone: function( dataAndEvents, deepDataAndEvents ) {\n\t\tdataAndEvents = dataAndEvents == null ? false : dataAndEvents;\n\t\tdeepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;\n\n\t\treturn this.map( function() {\n\t\t\treturn jQuery.clone( this, dataAndEvents, deepDataAndEvents );\n\t\t} );\n\t},\n\n\thtml: function( value ) {\n\t\treturn access( this, function( value ) {\n\t\t\tvar elem = this[ 0 ] || {},\n\t\t\t\ti = 0,\n\t\t\t\tl = this.length;\n\n\t\t\tif ( value === undefined && elem.nodeType === 1 ) {\n\t\t\t\treturn elem.innerHTML;\n\t\t\t}\n\n\t\t\t// See if we can take a shortcut and just use innerHTML\n\t\t\tif ( typeof value === \"string\" && !rnoInnerhtml.test( value ) &&\n\t\t\t\t!wrapMap[ ( rtagName.exec( value ) || [ \"\", \"\" ] )[ 1 ].toLowerCase() ] ) {\n\n\t\t\t\tvalue = jQuery.htmlPrefilter( value );\n\n\t\t\t\ttry {\n\t\t\t\t\tfor ( ; i < l; i++ ) {\n\t\t\t\t\t\telem = this[ i ] || {};\n\n\t\t\t\t\t\t// Remove element nodes and prevent memory leaks\n\t\t\t\t\t\tif ( elem.nodeType === 1 ) {\n\t\t\t\t\t\t\tjQuery.cleanData( getAll( elem, false ) );\n\t\t\t\t\t\t\telem.innerHTML = value;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\telem = 0;\n\n\t\t\t\t// If using innerHTML throws an exception, use the fallback method\n\t\t\t\t} catch ( e ) {}\n\t\t\t}\n\n\t\t\tif ( elem ) {\n\t\t\t\tthis.empty().append( value );\n\t\t\t}\n\t\t}, null, value, arguments.length );\n\t},\n\n\treplaceWith: function() {\n\t\tvar ignored = [];\n\n\t\t// Make the changes, replacing each non-ignored context element with the new content\n\t\treturn domManip( this, arguments, function( elem ) {\n\t\t\tvar parent = this.parentNode;\n\n\t\t\tif ( jQuery.inArray( this, ignored ) < 0 ) {\n\t\t\t\tjQuery.cleanData( getAll( this ) );\n\t\t\t\tif ( parent ) {\n\t\t\t\t\tparent.replaceChild( elem, this );\n\t\t\t\t}\n\t\t\t}\n\n\t\t// Force callback invocation\n\t\t}, ignored );\n\t}\n} );\n\njQuery.each( {\n\tappendTo: \"append\",\n\tprependTo: \"prepend\",\n\tinsertBefore: \"before\",\n\tinsertAfter: \"after\",\n\treplaceAll: \"replaceWith\"\n}, function( name, original ) {\n\tjQuery.fn[ name ] = function( selector ) {\n\t\tvar elems,\n\t\t\tret = [],\n\t\t\tinsert = jQuery( selector ),\n\t\t\tlast = insert.length - 1,\n\t\t\ti = 0;\n\n\t\tfor ( ; i <= last; i++ ) {\n\t\t\telems = i === last ? this : this.clone( true );\n\t\t\tjQuery( insert[ i ] )[ original ]( elems );\n\n\t\t\t// Support: Android <=4.0 only, PhantomJS 1 only\n\t\t\t// .get() because push.apply(_, arraylike) throws on ancient WebKit\n\t\t\tpush.apply( ret, elems.get() );\n\t\t}\n\n\t\treturn this.pushStack( ret );\n\t};\n} );\nvar rnumnonpx = new RegExp( \"^(\" + pnum + \")(?!px)[a-z%]+$\", \"i\" );\n\nvar getStyles = function( elem ) {\n\n\t\t// Support: IE <=11 only, Firefox <=30 (#15098, #14150)\n\t\t// IE throws on elements created in popups\n\t\t// FF meanwhile throws on frame elements through \"defaultView.getComputedStyle\"\n\t\tvar view = elem.ownerDocument.defaultView;\n\n\t\tif ( !view || !view.opener ) {\n\t\t\tview = window;\n\t\t}\n\n\t\treturn view.getComputedStyle( elem );\n\t};\n\nvar rboxStyle = new RegExp( cssExpand.join( \"|\" ), \"i\" );\n\n\n\n( function() {\n\n\t// Executing both pixelPosition & boxSizingReliable tests require only one layout\n\t// so they're executed at the same time to save the second computation.\n\tfunction computeStyleTests() {\n\n\t\t// This is a singleton, we need to execute it only once\n\t\tif ( !div ) {\n\t\t\treturn;\n\t\t}\n\n\t\tcontainer.style.cssText = \"position:absolute;left:-11111px;width:60px;\" +\n\t\t\t\"margin-top:1px;padding:0;border:0\";\n\t\tdiv.style.cssText =\n\t\t\t\"position:relative;display:block;box-sizing:border-box;overflow:scroll;\" +\n\t\t\t\"margin:auto;border:1px;padding:1px;\" +\n\t\t\t\"width:60%;top:1%\";\n\t\tdocumentElement.appendChild( container ).appendChild( div );\n\n\t\tvar divStyle = window.getComputedStyle( div );\n\t\tpixelPositionVal = divStyle.top !== \"1%\";\n\n\t\t// Support: Android 4.0 - 4.3 only, Firefox <=3 - 44\n\t\treliableMarginLeftVal = roundPixelMeasures( divStyle.marginLeft ) === 12;\n\n\t\t// Support: Android 4.0 - 4.3 only, Safari <=9.1 - 10.1, iOS <=7.0 - 9.3\n\t\t// Some styles come back with percentage values, even though they shouldn't\n\t\tdiv.style.right = \"60%\";\n\t\tpixelBoxStylesVal = roundPixelMeasures( divStyle.right ) === 36;\n\n\t\t// Support: IE 9 - 11 only\n\t\t// Detect misreporting of content dimensions for box-sizing:border-box elements\n\t\tboxSizingReliableVal = roundPixelMeasures( divStyle.width ) === 36;\n\n\t\t// Support: IE 9 only\n\t\t// Detect overflow:scroll screwiness (gh-3699)\n\t\tdiv.style.position = \"absolute\";\n\t\tscrollboxSizeVal = div.offsetWidth === 36 || \"absolute\";\n\n\t\tdocumentElement.removeChild( container );\n\n\t\t// Nullify the div so it wouldn't be stored in the memory and\n\t\t// it will also be a sign that checks already performed\n\t\tdiv = null;\n\t}\n\n\tfunction roundPixelMeasures( measure ) {\n\t\treturn Math.round( parseFloat( measure ) );\n\t}\n\n\tvar pixelPositionVal, boxSizingReliableVal, scrollboxSizeVal, pixelBoxStylesVal,\n\t\treliableMarginLeftVal,\n\t\tcontainer = document.createElement( \"div\" ),\n\t\tdiv = document.createElement( \"div\" );\n\n\t// Finish early in limited (non-browser) environments\n\tif ( !div.style ) {\n\t\treturn;\n\t}\n\n\t// Support: IE <=9 - 11 only\n\t// Style of cloned element affects source element cloned (#8908)\n\tdiv.style.backgroundClip = \"content-box\";\n\tdiv.cloneNode( true ).style.backgroundClip = \"\";\n\tsupport.clearCloneStyle = div.style.backgroundClip === \"content-box\";\n\n\tjQuery.extend( support, {\n\t\tboxSizingReliable: function() {\n\t\t\tcomputeStyleTests();\n\t\t\treturn boxSizingReliableVal;\n\t\t},\n\t\tpixelBoxStyles: function() {\n\t\t\tcomputeStyleTests();\n\t\t\treturn pixelBoxStylesVal;\n\t\t},\n\t\tpixelPosition: function() {\n\t\t\tcomputeStyleTests();\n\t\t\treturn pixelPositionVal;\n\t\t},\n\t\treliableMarginLeft: function() {\n\t\t\tcomputeStyleTests();\n\t\t\treturn reliableMarginLeftVal;\n\t\t},\n\t\tscrollboxSize: function() {\n\t\t\tcomputeStyleTests();\n\t\t\treturn scrollboxSizeVal;\n\t\t}\n\t} );\n} )();\n\n\nfunction curCSS( elem, name, computed ) {\n\tvar width, minWidth, maxWidth, ret,\n\n\t\t// Support: Firefox 51+\n\t\t// Retrieving style before computed somehow\n\t\t// fixes an issue with getting wrong values\n\t\t// on detached elements\n\t\tstyle = elem.style;\n\n\tcomputed = computed || getStyles( elem );\n\n\t// getPropertyValue is needed for:\n\t// .css('filter') (IE 9 only, #12537)\n\t// .css('--customProperty) (#3144)\n\tif ( computed ) {\n\t\tret = computed.getPropertyValue( name ) || computed[ name ];\n\n\t\tif ( ret === \"\" && !jQuery.contains( elem.ownerDocument, elem ) ) {\n\t\t\tret = jQuery.style( elem, name );\n\t\t}\n\n\t\t// A tribute to the \"awesome hack by Dean Edwards\"\n\t\t// Android Browser returns percentage for some values,\n\t\t// but width seems to be reliably pixels.\n\t\t// This is against the CSSOM draft spec:\n\t\t// https://drafts.csswg.org/cssom/#resolved-values\n\t\tif ( !support.pixelBoxStyles() && rnumnonpx.test( ret ) && rboxStyle.test( name ) ) {\n\n\t\t\t// Remember the original values\n\t\t\twidth = style.width;\n\t\t\tminWidth = style.minWidth;\n\t\t\tmaxWidth = style.maxWidth;\n\n\t\t\t// Put in the new values to get a computed value out\n\t\t\tstyle.minWidth = style.maxWidth = style.width = ret;\n\t\t\tret = computed.width;\n\n\t\t\t// Revert the changed values\n\t\t\tstyle.width = width;\n\t\t\tstyle.minWidth = minWidth;\n\t\t\tstyle.maxWidth = maxWidth;\n\t\t}\n\t}\n\n\treturn ret !== undefined ?\n\n\t\t// Support: IE <=9 - 11 only\n\t\t// IE returns zIndex value as an integer.\n\t\tret + \"\" :\n\t\tret;\n}\n\n\nfunction addGetHookIf( conditionFn, hookFn ) {\n\n\t// Define the hook, we'll check on the first run if it's really needed.\n\treturn {\n\t\tget: function() {\n\t\t\tif ( conditionFn() ) {\n\n\t\t\t\t// Hook not needed (or it's not possible to use it due\n\t\t\t\t// to missing dependency), remove it.\n\t\t\t\tdelete this.get;\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Hook needed; redefine it so that the support test is not executed again.\n\t\t\treturn ( this.get = hookFn ).apply( this, arguments );\n\t\t}\n\t};\n}\n\n\nvar\n\n\t// Swappable if display is none or starts with table\n\t// except \"table\", \"table-cell\", or \"table-caption\"\n\t// See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display\n\trdisplayswap = /^(none|table(?!-c[ea]).+)/,\n\trcustomProp = /^--/,\n\tcssShow = { position: \"absolute\", visibility: \"hidden\", display: \"block\" },\n\tcssNormalTransform = {\n\t\tletterSpacing: \"0\",\n\t\tfontWeight: \"400\"\n\t},\n\n\tcssPrefixes = [ \"Webkit\", \"Moz\", \"ms\" ],\n\temptyStyle = document.createElement( \"div\" ).style;\n\n// Return a css property mapped to a potentially vendor prefixed property\nfunction vendorPropName( name ) {\n\n\t// Shortcut for names that are not vendor prefixed\n\tif ( name in emptyStyle ) {\n\t\treturn name;\n\t}\n\n\t// Check for vendor prefixed names\n\tvar capName = name[ 0 ].toUpperCase() + name.slice( 1 ),\n\t\ti = cssPrefixes.length;\n\n\twhile ( i-- ) {\n\t\tname = cssPrefixes[ i ] + capName;\n\t\tif ( name in emptyStyle ) {\n\t\t\treturn name;\n\t\t}\n\t}\n}\n\n// Return a property mapped along what jQuery.cssProps suggests or to\n// a vendor prefixed property.\nfunction finalPropName( name ) {\n\tvar ret = jQuery.cssProps[ name ];\n\tif ( !ret ) {\n\t\tret = jQuery.cssProps[ name ] = vendorPropName( name ) || name;\n\t}\n\treturn ret;\n}\n\nfunction setPositiveNumber( elem, value, subtract ) {\n\n\t// Any relative (+/-) values have already been\n\t// normalized at this point\n\tvar matches = rcssNum.exec( value );\n\treturn matches ?\n\n\t\t// Guard against undefined \"subtract\", e.g., when used as in cssHooks\n\t\tMath.max( 0, matches[ 2 ] - ( subtract || 0 ) ) + ( matches[ 3 ] || \"px\" ) :\n\t\tvalue;\n}\n\nfunction boxModelAdjustment( elem, dimension, box, isBorderBox, styles, computedVal ) {\n\tvar i = dimension === \"width\" ? 1 : 0,\n\t\textra = 0,\n\t\tdelta = 0;\n\n\t// Adjustment may not be necessary\n\tif ( box === ( isBorderBox ? \"border\" : \"content\" ) ) {\n\t\treturn 0;\n\t}\n\n\tfor ( ; i < 4; i += 2 ) {\n\n\t\t// Both box models exclude margin\n\t\tif ( box === \"margin\" ) {\n\t\t\tdelta += jQuery.css( elem, box + cssExpand[ i ], true, styles );\n\t\t}\n\n\t\t// If we get here with a content-box, we're seeking \"padding\" or \"border\" or \"margin\"\n\t\tif ( !isBorderBox ) {\n\n\t\t\t// Add padding\n\t\t\tdelta += jQuery.css( elem, \"padding\" + cssExpand[ i ], true, styles );\n\n\t\t\t// For \"border\" or \"margin\", add border\n\t\t\tif ( box !== \"padding\" ) {\n\t\t\t\tdelta += jQuery.css( elem, \"border\" + cssExpand[ i ] + \"Width\", true, styles );\n\n\t\t\t// But still keep track of it otherwise\n\t\t\t} else {\n\t\t\t\textra += jQuery.css( elem, \"border\" + cssExpand[ i ] + \"Width\", true, styles );\n\t\t\t}\n\n\t\t// If we get here with a border-box (content + padding + border), we're seeking \"content\" or\n\t\t// \"padding\" or \"margin\"\n\t\t} else {\n\n\t\t\t// For \"content\", subtract padding\n\t\t\tif ( box === \"content\" ) {\n\t\t\t\tdelta -= jQuery.css( elem, \"padding\" + cssExpand[ i ], true, styles );\n\t\t\t}\n\n\t\t\t// For \"content\" or \"padding\", subtract border\n\t\t\tif ( box !== \"margin\" ) {\n\t\t\t\tdelta -= jQuery.css( elem, \"border\" + cssExpand[ i ] + \"Width\", true, styles );\n\t\t\t}\n\t\t}\n\t}\n\n\t// Account for positive content-box scroll gutter when requested by providing computedVal\n\tif ( !isBorderBox && computedVal >= 0 ) {\n\n\t\t// offsetWidth/offsetHeight is a rounded sum of content, padding, scroll gutter, and border\n\t\t// Assuming integer scroll gutter, subtract the rest and round down\n\t\tdelta += Math.max( 0, Math.ceil(\n\t\t\telem[ \"offset\" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -\n\t\t\tcomputedVal -\n\t\t\tdelta -\n\t\t\textra -\n\t\t\t0.5\n\t\t) );\n\t}\n\n\treturn delta;\n}\n\nfunction getWidthOrHeight( elem, dimension, extra ) {\n\n\t// Start with computed style\n\tvar styles = getStyles( elem ),\n\t\tval = curCSS( elem, dimension, styles ),\n\t\tisBorderBox = jQuery.css( elem, \"boxSizing\", false, styles ) === \"border-box\",\n\t\tvalueIsBorderBox = isBorderBox;\n\n\t// Support: Firefox <=54\n\t// Return a confounding non-pixel value or feign ignorance, as appropriate.\n\tif ( rnumnonpx.test( val ) ) {\n\t\tif ( !extra ) {\n\t\t\treturn val;\n\t\t}\n\t\tval = \"auto\";\n\t}\n\n\t// Check for style in case a browser which returns unreliable values\n\t// for getComputedStyle silently falls back to the reliable elem.style\n\tvalueIsBorderBox = valueIsBorderBox &&\n\t\t( support.boxSizingReliable() || val === elem.style[ dimension ] );\n\n\t// Fall back to offsetWidth/offsetHeight when value is \"auto\"\n\t// This happens for inline elements with no explicit setting (gh-3571)\n\t// Support: Android <=4.1 - 4.3 only\n\t// Also use offsetWidth/offsetHeight for misreported inline dimensions (gh-3602)\n\tif ( val === \"auto\" ||\n\t\t!parseFloat( val ) && jQuery.css( elem, \"display\", false, styles ) === \"inline\" ) {\n\n\t\tval = elem[ \"offset\" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ];\n\n\t\t// offsetWidth/offsetHeight provide border-box values\n\t\tvalueIsBorderBox = true;\n\t}\n\n\t// Normalize \"\" and auto\n\tval = parseFloat( val ) || 0;\n\n\t// Adjust for the element's box model\n\treturn ( val +\n\t\tboxModelAdjustment(\n\t\t\telem,\n\t\t\tdimension,\n\t\t\textra || ( isBorderBox ? \"border\" : \"content\" ),\n\t\t\tvalueIsBorderBox,\n\t\t\tstyles,\n\n\t\t\t// Provide the current computed size to request scroll gutter calculation (gh-3589)\n\t\t\tval\n\t\t)\n\t) + \"px\";\n}\n\njQuery.extend( {\n\n\t// Add in style property hooks for overriding the default\n\t// behavior of getting and setting a style property\n\tcssHooks: {\n\t\topacity: {\n\t\t\tget: function( elem, computed ) {\n\t\t\t\tif ( computed ) {\n\n\t\t\t\t\t// We should always get a number back from opacity\n\t\t\t\t\tvar ret = curCSS( elem, \"opacity\" );\n\t\t\t\t\treturn ret === \"\" ? \"1\" : ret;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t},\n\n\t// Don't automatically add \"px\" to these possibly-unitless properties\n\tcssNumber: {\n\t\t\"animationIterationCount\": true,\n\t\t\"columnCount\": true,\n\t\t\"fillOpacity\": true,\n\t\t\"flexGrow\": true,\n\t\t\"flexShrink\": true,\n\t\t\"fontWeight\": true,\n\t\t\"lineHeight\": true,\n\t\t\"opacity\": true,\n\t\t\"order\": true,\n\t\t\"orphans\": true,\n\t\t\"widows\": true,\n\t\t\"zIndex\": true,\n\t\t\"zoom\": true\n\t},\n\n\t// Add in properties whose names you wish to fix before\n\t// setting or getting the value\n\tcssProps: {},\n\n\t// Get and set the style property on a DOM Node\n\tstyle: function( elem, name, value, extra ) {\n\n\t\t// Don't set styles on text and comment nodes\n\t\tif ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Make sure that we're working with the right name\n\t\tvar ret, type, hooks,\n\t\t\torigName = camelCase( name ),\n\t\t\tisCustomProp = rcustomProp.test( name ),\n\t\t\tstyle = elem.style;\n\n\t\t// Make sure that we're working with the right name. We don't\n\t\t// want to query the value if it is a CSS custom property\n\t\t// since they are user-defined.\n\t\tif ( !isCustomProp ) {\n\t\t\tname = finalPropName( origName );\n\t\t}\n\n\t\t// Gets hook for the prefixed version, then unprefixed version\n\t\thooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];\n\n\t\t// Check if we're setting a value\n\t\tif ( value !== undefined ) {\n\t\t\ttype = typeof value;\n\n\t\t\t// Convert \"+=\" or \"-=\" to relative numbers (#7345)\n\t\t\tif ( type === \"string\" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) {\n\t\t\t\tvalue = adjustCSS( elem, name, ret );\n\n\t\t\t\t// Fixes bug #9237\n\t\t\t\ttype = \"number\";\n\t\t\t}\n\n\t\t\t// Make sure that null and NaN values aren't set (#7116)\n\t\t\tif ( value == null || value !== value ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// If a number was passed in, add the unit (except for certain CSS properties)\n\t\t\tif ( type === \"number\" ) {\n\t\t\t\tvalue += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? \"\" : \"px\" );\n\t\t\t}\n\n\t\t\t// background-* props affect original clone's values\n\t\t\tif ( !support.clearCloneStyle && value === \"\" && name.indexOf( \"background\" ) === 0 ) {\n\t\t\t\tstyle[ name ] = \"inherit\";\n\t\t\t}\n\n\t\t\t// If a hook was provided, use that value, otherwise just set the specified value\n\t\t\tif ( !hooks || !( \"set\" in hooks ) ||\n\t\t\t\t( value = hooks.set( elem, value, extra ) ) !== undefined ) {\n\n\t\t\t\tif ( isCustomProp ) {\n\t\t\t\t\tstyle.setProperty( name, value );\n\t\t\t\t} else {\n\t\t\t\t\tstyle[ name ] = value;\n\t\t\t\t}\n\t\t\t}\n\n\t\t} else {\n\n\t\t\t// If a hook was provided get the non-computed value from there\n\t\t\tif ( hooks && \"get\" in hooks &&\n\t\t\t\t( ret = hooks.get( elem, false, extra ) ) !== undefined ) {\n\n\t\t\t\treturn ret;\n\t\t\t}\n\n\t\t\t// Otherwise just get the value from the style object\n\t\t\treturn style[ name ];\n\t\t}\n\t},\n\n\tcss: function( elem, name, extra, styles ) {\n\t\tvar val, num, hooks,\n\t\t\torigName = camelCase( name ),\n\t\t\tisCustomProp = rcustomProp.test( name );\n\n\t\t// Make sure that we're working with the right name. We don't\n\t\t// want to modify the value if it is a CSS custom property\n\t\t// since they are user-defined.\n\t\tif ( !isCustomProp ) {\n\t\t\tname = finalPropName( origName );\n\t\t}\n\n\t\t// Try prefixed name followed by the unprefixed name\n\t\thooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];\n\n\t\t// If a hook was provided get the computed value from there\n\t\tif ( hooks && \"get\" in hooks ) {\n\t\t\tval = hooks.get( elem, true, extra );\n\t\t}\n\n\t\t// Otherwise, if a way to get the computed value exists, use that\n\t\tif ( val === undefined ) {\n\t\t\tval = curCSS( elem, name, styles );\n\t\t}\n\n\t\t// Convert \"normal\" to computed value\n\t\tif ( val === \"normal\" && name in cssNormalTransform ) {\n\t\t\tval = cssNormalTransform[ name ];\n\t\t}\n\n\t\t// Make numeric if forced or a qualifier was provided and val looks numeric\n\t\tif ( extra === \"\" || extra ) {\n\t\t\tnum = parseFloat( val );\n\t\t\treturn extra === true || isFinite( num ) ? num || 0 : val;\n\t\t}\n\n\t\treturn val;\n\t}\n} );\n\njQuery.each( [ \"height\", \"width\" ], function( i, dimension ) {\n\tjQuery.cssHooks[ dimension ] = {\n\t\tget: function( elem, computed, extra ) {\n\t\t\tif ( computed ) {\n\n\t\t\t\t// Certain elements can have dimension info if we invisibly show them\n\t\t\t\t// but it must have a current display style that would benefit\n\t\t\t\treturn rdisplayswap.test( jQuery.css( elem, \"display\" ) ) &&\n\n\t\t\t\t\t// Support: Safari 8+\n\t\t\t\t\t// Table columns in Safari have non-zero offsetWidth & zero\n\t\t\t\t\t// getBoundingClientRect().width unless display is changed.\n\t\t\t\t\t// Support: IE <=11 only\n\t\t\t\t\t// Running getBoundingClientRect on a disconnected node\n\t\t\t\t\t// in IE throws an error.\n\t\t\t\t\t( !elem.getClientRects().length || !elem.getBoundingClientRect().width ) ?\n\t\t\t\t\t\tswap( elem, cssShow, function() {\n\t\t\t\t\t\t\treturn getWidthOrHeight( elem, dimension, extra );\n\t\t\t\t\t\t} ) :\n\t\t\t\t\t\tgetWidthOrHeight( elem, dimension, extra );\n\t\t\t}\n\t\t},\n\n\t\tset: function( elem, value, extra ) {\n\t\t\tvar matches,\n\t\t\t\tstyles = getStyles( elem ),\n\t\t\t\tisBorderBox = jQuery.css( elem, \"boxSizing\", false, styles ) === \"border-box\",\n\t\t\t\tsubtract = extra && boxModelAdjustment(\n\t\t\t\t\telem,\n\t\t\t\t\tdimension,\n\t\t\t\t\textra,\n\t\t\t\t\tisBorderBox,\n\t\t\t\t\tstyles\n\t\t\t\t);\n\n\t\t\t// Account for unreliable border-box dimensions by comparing offset* to computed and\n\t\t\t// faking a content-box to get border and padding (gh-3699)\n\t\t\tif ( isBorderBox && support.scrollboxSize() === styles.position ) {\n\t\t\t\tsubtract -= Math.ceil(\n\t\t\t\t\telem[ \"offset\" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -\n\t\t\t\t\tparseFloat( styles[ dimension ] ) -\n\t\t\t\t\tboxModelAdjustment( elem, dimension, \"border\", false, styles ) -\n\t\t\t\t\t0.5\n\t\t\t\t);\n\t\t\t}\n\n\t\t\t// Convert to pixels if value adjustment is needed\n\t\t\tif ( subtract && ( matches = rcssNum.exec( value ) ) &&\n\t\t\t\t( matches[ 3 ] || \"px\" ) !== \"px\" ) {\n\n\t\t\t\telem.style[ dimension ] = value;\n\t\t\t\tvalue = jQuery.css( elem, dimension );\n\t\t\t}\n\n\t\t\treturn setPositiveNumber( elem, value, subtract );\n\t\t}\n\t};\n} );\n\njQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft,\n\tfunction( elem, computed ) {\n\t\tif ( computed ) {\n\t\t\treturn ( parseFloat( curCSS( elem, \"marginLeft\" ) ) ||\n\t\t\t\telem.getBoundingClientRect().left -\n\t\t\t\t\tswap( elem, { marginLeft: 0 }, function() {\n\t\t\t\t\t\treturn elem.getBoundingClientRect().left;\n\t\t\t\t\t} )\n\t\t\t\t) + \"px\";\n\t\t}\n\t}\n);\n\n// These hooks are used by animate to expand properties\njQuery.each( {\n\tmargin: \"\",\n\tpadding: \"\",\n\tborder: \"Width\"\n}, function( prefix, suffix ) {\n\tjQuery.cssHooks[ prefix + suffix ] = {\n\t\texpand: function( value ) {\n\t\t\tvar i = 0,\n\t\t\t\texpanded = {},\n\n\t\t\t\t// Assumes a single number if not a string\n\t\t\t\tparts = typeof value === \"string\" ? value.split( \" \" ) : [ value ];\n\n\t\t\tfor ( ; i < 4; i++ ) {\n\t\t\t\texpanded[ prefix + cssExpand[ i ] + suffix ] =\n\t\t\t\t\tparts[ i ] || parts[ i - 2 ] || parts[ 0 ];\n\t\t\t}\n\n\t\t\treturn expanded;\n\t\t}\n\t};\n\n\tif ( prefix !== \"margin\" ) {\n\t\tjQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;\n\t}\n} );\n\njQuery.fn.extend( {\n\tcss: function( name, value ) {\n\t\treturn access( this, function( elem, name, value ) {\n\t\t\tvar styles, len,\n\t\t\t\tmap = {},\n\t\t\t\ti = 0;\n\n\t\t\tif ( Array.isArray( name ) ) {\n\t\t\t\tstyles = getStyles( elem );\n\t\t\t\tlen = name.length;\n\n\t\t\t\tfor ( ; i < len; i++ ) {\n\t\t\t\t\tmap[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles );\n\t\t\t\t}\n\n\t\t\t\treturn map;\n\t\t\t}\n\n\t\t\treturn value !== undefined ?\n\t\t\t\tjQuery.style( elem, name, value ) :\n\t\t\t\tjQuery.css( elem, name );\n\t\t}, name, value, arguments.length > 1 );\n\t}\n} );\n\n\nfunction Tween( elem, options, prop, end, easing ) {\n\treturn new Tween.prototype.init( elem, options, prop, end, easing );\n}\njQuery.Tween = Tween;\n\nTween.prototype = {\n\tconstructor: Tween,\n\tinit: function( elem, options, prop, end, easing, unit ) {\n\t\tthis.elem = elem;\n\t\tthis.prop = prop;\n\t\tthis.easing = easing || jQuery.easing._default;\n\t\tthis.options = options;\n\t\tthis.start = this.now = this.cur();\n\t\tthis.end = end;\n\t\tthis.unit = unit || ( jQuery.cssNumber[ prop ] ? \"\" : \"px\" );\n\t},\n\tcur: function() {\n\t\tvar hooks = Tween.propHooks[ this.prop ];\n\n\t\treturn hooks && hooks.get ?\n\t\t\thooks.get( this ) :\n\t\t\tTween.propHooks._default.get( this );\n\t},\n\trun: function( percent ) {\n\t\tvar eased,\n\t\t\thooks = Tween.propHooks[ this.prop ];\n\n\t\tif ( this.options.duration ) {\n\t\t\tthis.pos = eased = jQuery.easing[ this.easing ](\n\t\t\t\tpercent, this.options.duration * percent, 0, 1, this.options.duration\n\t\t\t);\n\t\t} else {\n\t\t\tthis.pos = eased = percent;\n\t\t}\n\t\tthis.now = ( this.end - this.start ) * eased + this.start;\n\n\t\tif ( this.options.step ) {\n\t\t\tthis.options.step.call( this.elem, this.now, this );\n\t\t}\n\n\t\tif ( hooks && hooks.set ) {\n\t\t\thooks.set( this );\n\t\t} else {\n\t\t\tTween.propHooks._default.set( this );\n\t\t}\n\t\treturn this;\n\t}\n};\n\nTween.prototype.init.prototype = Tween.prototype;\n\nTween.propHooks = {\n\t_default: {\n\t\tget: function( tween ) {\n\t\t\tvar result;\n\n\t\t\t// Use a property on the element directly when it is not a DOM element,\n\t\t\t// or when there is no matching style property that exists.\n\t\t\tif ( tween.elem.nodeType !== 1 ||\n\t\t\t\ttween.elem[ tween.prop ] != null && tween.elem.style[ tween.prop ] == null ) {\n\t\t\t\treturn tween.elem[ tween.prop ];\n\t\t\t}\n\n\t\t\t// Passing an empty string as a 3rd parameter to .css will automatically\n\t\t\t// attempt a parseFloat and fallback to a string if the parse fails.\n\t\t\t// Simple values such as \"10px\" are parsed to Float;\n\t\t\t// complex values such as \"rotate(1rad)\" are returned as-is.\n\t\t\tresult = jQuery.css( tween.elem, tween.prop, \"\" );\n\n\t\t\t// Empty strings, null, undefined and \"auto\" are converted to 0.\n\t\t\treturn !result || result === \"auto\" ? 0 : result;\n\t\t},\n\t\tset: function( tween ) {\n\n\t\t\t// Use step hook for back compat.\n\t\t\t// Use cssHook if its there.\n\t\t\t// Use .style if available and use plain properties where available.\n\t\t\tif ( jQuery.fx.step[ tween.prop ] ) {\n\t\t\t\tjQuery.fx.step[ tween.prop ]( tween );\n\t\t\t} else if ( tween.elem.nodeType === 1 &&\n\t\t\t\t( tween.elem.style[ jQuery.cssProps[ tween.prop ] ] != null ||\n\t\t\t\t\tjQuery.cssHooks[ tween.prop ] ) ) {\n\t\t\t\tjQuery.style( tween.elem, tween.prop, tween.now + tween.unit );\n\t\t\t} else {\n\t\t\t\ttween.elem[ tween.prop ] = tween.now;\n\t\t\t}\n\t\t}\n\t}\n};\n\n// Support: IE <=9 only\n// Panic based approach to setting things on disconnected nodes\nTween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {\n\tset: function( tween ) {\n\t\tif ( tween.elem.nodeType && tween.elem.parentNode ) {\n\t\t\ttween.elem[ tween.prop ] = tween.now;\n\t\t}\n\t}\n};\n\njQuery.easing = {\n\tlinear: function( p ) {\n\t\treturn p;\n\t},\n\tswing: function( p ) {\n\t\treturn 0.5 - Math.cos( p * Math.PI ) / 2;\n\t},\n\t_default: \"swing\"\n};\n\njQuery.fx = Tween.prototype.init;\n\n// Back compat <1.8 extension point\njQuery.fx.step = {};\n\n\n\n\nvar\n\tfxNow, inProgress,\n\trfxtypes = /^(?:toggle|show|hide)$/,\n\trrun = /queueHooks$/;\n\nfunction schedule() {\n\tif ( inProgress ) {\n\t\tif ( document.hidden === false && window.requestAnimationFrame ) {\n\t\t\twindow.requestAnimationFrame( schedule );\n\t\t} else {\n\t\t\twindow.setTimeout( schedule, jQuery.fx.interval );\n\t\t}\n\n\t\tjQuery.fx.tick();\n\t}\n}\n\n// Animations created synchronously will run synchronously\nfunction createFxNow() {\n\twindow.setTimeout( function() {\n\t\tfxNow = undefined;\n\t} );\n\treturn ( fxNow = Date.now() );\n}\n\n// Generate parameters to create a standard animation\nfunction genFx( type, includeWidth ) {\n\tvar which,\n\t\ti = 0,\n\t\tattrs = { height: type };\n\n\t// If we include width, step value is 1 to do all cssExpand values,\n\t// otherwise step value is 2 to skip over Left and Right\n\tincludeWidth = includeWidth ? 1 : 0;\n\tfor ( ; i < 4; i += 2 - includeWidth ) {\n\t\twhich = cssExpand[ i ];\n\t\tattrs[ \"margin\" + which ] = attrs[ \"padding\" + which ] = type;\n\t}\n\n\tif ( includeWidth ) {\n\t\tattrs.opacity = attrs.width = type;\n\t}\n\n\treturn attrs;\n}\n\nfunction createTween( value, prop, animation ) {\n\tvar tween,\n\t\tcollection = ( Animation.tweeners[ prop ] || [] ).concat( Animation.tweeners[ \"*\" ] ),\n\t\tindex = 0,\n\t\tlength = collection.length;\n\tfor ( ; index < length; index++ ) {\n\t\tif ( ( tween = collection[ index ].call( animation, prop, value ) ) ) {\n\n\t\t\t// We're done with this property\n\t\t\treturn tween;\n\t\t}\n\t}\n}\n\nfunction defaultPrefilter( elem, props, opts ) {\n\tvar prop, value, toggle, hooks, oldfire, propTween, restoreDisplay, display,\n\t\tisBox = \"width\" in props || \"height\" in props,\n\t\tanim = this,\n\t\torig = {},\n\t\tstyle = elem.style,\n\t\thidden = elem.nodeType && isHiddenWithinTree( elem ),\n\t\tdataShow = dataPriv.get( elem, \"fxshow\" );\n\n\t// Queue-skipping animations hijack the fx hooks\n\tif ( !opts.queue ) {\n\t\thooks = jQuery._queueHooks( elem, \"fx\" );\n\t\tif ( hooks.unqueued == null ) {\n\t\t\thooks.unqueued = 0;\n\t\t\toldfire = hooks.empty.fire;\n\t\t\thooks.empty.fire = function() {\n\t\t\t\tif ( !hooks.unqueued ) {\n\t\t\t\t\toldfire();\n\t\t\t\t}\n\t\t\t};\n\t\t}\n\t\thooks.unqueued++;\n\n\t\tanim.always( function() {\n\n\t\t\t// Ensure the complete handler is called before this completes\n\t\t\tanim.always( function() {\n\t\t\t\thooks.unqueued--;\n\t\t\t\tif ( !jQuery.queue( elem, \"fx\" ).length ) {\n\t\t\t\t\thooks.empty.fire();\n\t\t\t\t}\n\t\t\t} );\n\t\t} );\n\t}\n\n\t// Detect show/hide animations\n\tfor ( prop in props ) {\n\t\tvalue = props[ prop ];\n\t\tif ( rfxtypes.test( value ) ) {\n\t\t\tdelete props[ prop ];\n\t\t\ttoggle = toggle || value === \"toggle\";\n\t\t\tif ( value === ( hidden ? \"hide\" : \"show\" ) ) {\n\n\t\t\t\t// Pretend to be hidden if this is a \"show\" and\n\t\t\t\t// there is still data from a stopped show/hide\n\t\t\t\tif ( value === \"show\" && dataShow && dataShow[ prop ] !== undefined ) {\n\t\t\t\t\thidden = true;\n\n\t\t\t\t// Ignore all other no-op show/hide data\n\t\t\t\t} else {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t}\n\t\t\torig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop );\n\t\t}\n\t}\n\n\t// Bail out if this is a no-op like .hide().hide()\n\tpropTween = !jQuery.isEmptyObject( props );\n\tif ( !propTween && jQuery.isEmptyObject( orig ) ) {\n\t\treturn;\n\t}\n\n\t// Restrict \"overflow\" and \"display\" styles during box animations\n\tif ( isBox && elem.nodeType === 1 ) {\n\n\t\t// Support: IE <=9 - 11, Edge 12 - 15\n\t\t// Record all 3 overflow attributes because IE does not infer the shorthand\n\t\t// from identically-valued overflowX and overflowY and Edge just mirrors\n\t\t// the overflowX value there.\n\t\topts.overflow = [ style.overflow, style.overflowX, style.overflowY ];\n\n\t\t// Identify a display type, preferring old show/hide data over the CSS cascade\n\t\trestoreDisplay = dataShow && dataShow.display;\n\t\tif ( restoreDisplay == null ) {\n\t\t\trestoreDisplay = dataPriv.get( elem, \"display\" );\n\t\t}\n\t\tdisplay = jQuery.css( elem, \"display\" );\n\t\tif ( display === \"none\" ) {\n\t\t\tif ( restoreDisplay ) {\n\t\t\t\tdisplay = restoreDisplay;\n\t\t\t} else {\n\n\t\t\t\t// Get nonempty value(s) by temporarily forcing visibility\n\t\t\t\tshowHide( [ elem ], true );\n\t\t\t\trestoreDisplay = elem.style.display || restoreDisplay;\n\t\t\t\tdisplay = jQuery.css( elem, \"display\" );\n\t\t\t\tshowHide( [ elem ] );\n\t\t\t}\n\t\t}\n\n\t\t// Animate inline elements as inline-block\n\t\tif ( display === \"inline\" || display === \"inline-block\" && restoreDisplay != null ) {\n\t\t\tif ( jQuery.css( elem, \"float\" ) === \"none\" ) {\n\n\t\t\t\t// Restore the original display value at the end of pure show/hide animations\n\t\t\t\tif ( !propTween ) {\n\t\t\t\t\tanim.done( function() {\n\t\t\t\t\t\tstyle.display = restoreDisplay;\n\t\t\t\t\t} );\n\t\t\t\t\tif ( restoreDisplay == null ) {\n\t\t\t\t\t\tdisplay = style.display;\n\t\t\t\t\t\trestoreDisplay = display === \"none\" ? \"\" : display;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tstyle.display = \"inline-block\";\n\t\t\t}\n\t\t}\n\t}\n\n\tif ( opts.overflow ) {\n\t\tstyle.overflow = \"hidden\";\n\t\tanim.always( function() {\n\t\t\tstyle.overflow = opts.overflow[ 0 ];\n\t\t\tstyle.overflowX = opts.overflow[ 1 ];\n\t\t\tstyle.overflowY = opts.overflow[ 2 ];\n\t\t} );\n\t}\n\n\t// Implement show/hide animations\n\tpropTween = false;\n\tfor ( prop in orig ) {\n\n\t\t// General show/hide setup for this element animation\n\t\tif ( !propTween ) {\n\t\t\tif ( dataShow ) {\n\t\t\t\tif ( \"hidden\" in dataShow ) {\n\t\t\t\t\thidden = dataShow.hidden;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tdataShow = dataPriv.access( elem, \"fxshow\", { display: restoreDisplay } );\n\t\t\t}\n\n\t\t\t// Store hidden/visible for toggle so `.stop().toggle()` \"reverses\"\n\t\t\tif ( toggle ) {\n\t\t\t\tdataShow.hidden = !hidden;\n\t\t\t}\n\n\t\t\t// Show elements before animating them\n\t\t\tif ( hidden ) {\n\t\t\t\tshowHide( [ elem ], true );\n\t\t\t}\n\n\t\t\t/* eslint-disable no-loop-func */\n\n\t\t\tanim.done( function() {\n\n\t\t\t/* eslint-enable no-loop-func */\n\n\t\t\t\t// The final step of a \"hide\" animation is actually hiding the element\n\t\t\t\tif ( !hidden ) {\n\t\t\t\t\tshowHide( [ elem ] );\n\t\t\t\t}\n\t\t\t\tdataPriv.remove( elem, \"fxshow\" );\n\t\t\t\tfor ( prop in orig ) {\n\t\t\t\t\tjQuery.style( elem, prop, orig[ prop ] );\n\t\t\t\t}\n\t\t\t} );\n\t\t}\n\n\t\t// Per-property setup\n\t\tpropTween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim );\n\t\tif ( !( prop in dataShow ) ) {\n\t\t\tdataShow[ prop ] = propTween.start;\n\t\t\tif ( hidden ) {\n\t\t\t\tpropTween.end = propTween.start;\n\t\t\t\tpropTween.start = 0;\n\t\t\t}\n\t\t}\n\t}\n}\n\nfunction propFilter( props, specialEasing ) {\n\tvar index, name, easing, value, hooks;\n\n\t// camelCase, specialEasing and expand cssHook pass\n\tfor ( index in props ) {\n\t\tname = camelCase( index );\n\t\teasing = specialEasing[ name ];\n\t\tvalue = props[ index ];\n\t\tif ( Array.isArray( value ) ) {\n\t\t\teasing = value[ 1 ];\n\t\t\tvalue = props[ index ] = value[ 0 ];\n\t\t}\n\n\t\tif ( index !== name ) {\n\t\t\tprops[ name ] = value;\n\t\t\tdelete props[ index ];\n\t\t}\n\n\t\thooks = jQuery.cssHooks[ name ];\n\t\tif ( hooks && \"expand\" in hooks ) {\n\t\t\tvalue = hooks.expand( value );\n\t\t\tdelete props[ name ];\n\n\t\t\t// Not quite $.extend, this won't overwrite existing keys.\n\t\t\t// Reusing 'index' because we have the correct \"name\"\n\t\t\tfor ( index in value ) {\n\t\t\t\tif ( !( index in props ) ) {\n\t\t\t\t\tprops[ index ] = value[ index ];\n\t\t\t\t\tspecialEasing[ index ] = easing;\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tspecialEasing[ name ] = easing;\n\t\t}\n\t}\n}\n\nfunction Animation( elem, properties, options ) {\n\tvar result,\n\t\tstopped,\n\t\tindex = 0,\n\t\tlength = Animation.prefilters.length,\n\t\tdeferred = jQuery.Deferred().always( function() {\n\n\t\t\t// Don't match elem in the :animated selector\n\t\t\tdelete tick.elem;\n\t\t} ),\n\t\ttick = function() {\n\t\t\tif ( stopped ) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tvar currentTime = fxNow || createFxNow(),\n\t\t\t\tremaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),\n\n\t\t\t\t// Support: Android 2.3 only\n\t\t\t\t// Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497)\n\t\t\t\ttemp = remaining / animation.duration || 0,\n\t\t\t\tpercent = 1 - temp,\n\t\t\t\tindex = 0,\n\t\t\t\tlength = animation.tweens.length;\n\n\t\t\tfor ( ; index < length; index++ ) {\n\t\t\t\tanimation.tweens[ index ].run( percent );\n\t\t\t}\n\n\t\t\tdeferred.notifyWith( elem, [ animation, percent, remaining ] );\n\n\t\t\t// If there's more to do, yield\n\t\t\tif ( percent < 1 && length ) {\n\t\t\t\treturn remaining;\n\t\t\t}\n\n\t\t\t// If this was an empty animation, synthesize a final progress notification\n\t\t\tif ( !length ) {\n\t\t\t\tdeferred.notifyWith( elem, [ animation, 1, 0 ] );\n\t\t\t}\n\n\t\t\t// Resolve the animation and report its conclusion\n\t\t\tdeferred.resolveWith( elem, [ animation ] );\n\t\t\treturn false;\n\t\t},\n\t\tanimation = deferred.promise( {\n\t\t\telem: elem,\n\t\t\tprops: jQuery.extend( {}, properties ),\n\t\t\topts: jQuery.extend( true, {\n\t\t\t\tspecialEasing: {},\n\t\t\t\teasing: jQuery.easing._default\n\t\t\t}, options ),\n\t\t\toriginalProperties: properties,\n\t\t\toriginalOptions: options,\n\t\t\tstartTime: fxNow || createFxNow(),\n\t\t\tduration: options.duration,\n\t\t\ttweens: [],\n\t\t\tcreateTween: function( prop, end ) {\n\t\t\t\tvar tween = jQuery.Tween( elem, animation.opts, prop, end,\n\t\t\t\t\t\tanimation.opts.specialEasing[ prop ] || animation.opts.easing );\n\t\t\t\tanimation.tweens.push( tween );\n\t\t\t\treturn tween;\n\t\t\t},\n\t\t\tstop: function( gotoEnd ) {\n\t\t\t\tvar index = 0,\n\n\t\t\t\t\t// If we are going to the end, we want to run all the tweens\n\t\t\t\t\t// otherwise we skip this part\n\t\t\t\t\tlength = gotoEnd ? animation.tweens.length : 0;\n\t\t\t\tif ( stopped ) {\n\t\t\t\t\treturn this;\n\t\t\t\t}\n\t\t\t\tstopped = true;\n\t\t\t\tfor ( ; index < length; index++ ) {\n\t\t\t\t\tanimation.tweens[ index ].run( 1 );\n\t\t\t\t}\n\n\t\t\t\t// Resolve when we played the last frame; otherwise, reject\n\t\t\t\tif ( gotoEnd ) {\n\t\t\t\t\tdeferred.notifyWith( elem, [ animation, 1, 0 ] );\n\t\t\t\t\tdeferred.resolveWith( elem, [ animation, gotoEnd ] );\n\t\t\t\t} else {\n\t\t\t\t\tdeferred.rejectWith( elem, [ animation, gotoEnd ] );\n\t\t\t\t}\n\t\t\t\treturn this;\n\t\t\t}\n\t\t} ),\n\t\tprops = animation.props;\n\n\tpropFilter( props, animation.opts.specialEasing );\n\n\tfor ( ; index < length; index++ ) {\n\t\tresult = Animation.prefilters[ index ].call( animation, elem, props, animation.opts );\n\t\tif ( result ) {\n\t\t\tif ( isFunction( result.stop ) ) {\n\t\t\t\tjQuery._queueHooks( animation.elem, animation.opts.queue ).stop =\n\t\t\t\t\tresult.stop.bind( result );\n\t\t\t}\n\t\t\treturn result;\n\t\t}\n\t}\n\n\tjQuery.map( props, createTween, animation );\n\n\tif ( isFunction( animation.opts.start ) ) {\n\t\tanimation.opts.start.call( elem, animation );\n\t}\n\n\t// Attach callbacks from options\n\tanimation\n\t\t.progress( animation.opts.progress )\n\t\t.done( animation.opts.done, animation.opts.complete )\n\t\t.fail( animation.opts.fail )\n\t\t.always( animation.opts.always );\n\n\tjQuery.fx.timer(\n\t\tjQuery.extend( tick, {\n\t\t\telem: elem,\n\t\t\tanim: animation,\n\t\t\tqueue: animation.opts.queue\n\t\t} )\n\t);\n\n\treturn animation;\n}\n\njQuery.Animation = jQuery.extend( Animation, {\n\n\ttweeners: {\n\t\t\"*\": [ function( prop, value ) {\n\t\t\tvar tween = this.createTween( prop, value );\n\t\t\tadjustCSS( tween.elem, prop, rcssNum.exec( value ), tween );\n\t\t\treturn tween;\n\t\t} ]\n\t},\n\n\ttweener: function( props, callback ) {\n\t\tif ( isFunction( props ) ) {\n\t\t\tcallback = props;\n\t\t\tprops = [ \"*\" ];\n\t\t} else {\n\t\t\tprops = props.match( rnothtmlwhite );\n\t\t}\n\n\t\tvar prop,\n\t\t\tindex = 0,\n\t\t\tlength = props.length;\n\n\t\tfor ( ; index < length; index++ ) {\n\t\t\tprop = props[ index ];\n\t\t\tAnimation.tweeners[ prop ] = Animation.tweeners[ prop ] || [];\n\t\t\tAnimation.tweeners[ prop ].unshift( callback );\n\t\t}\n\t},\n\n\tprefilters: [ defaultPrefilter ],\n\n\tprefilter: function( callback, prepend ) {\n\t\tif ( prepend ) {\n\t\t\tAnimation.prefilters.unshift( callback );\n\t\t} else {\n\t\t\tAnimation.prefilters.push( callback );\n\t\t}\n\t}\n} );\n\njQuery.speed = function( speed, easing, fn ) {\n\tvar opt = speed && typeof speed === \"object\" ? jQuery.extend( {}, speed ) : {\n\t\tcomplete: fn || !fn && easing ||\n\t\t\tisFunction( speed ) && speed,\n\t\tduration: speed,\n\t\teasing: fn && easing || easing && !isFunction( easing ) && easing\n\t};\n\n\t// Go to the end state if fx are off\n\tif ( jQuery.fx.off ) {\n\t\topt.duration = 0;\n\n\t} else {\n\t\tif ( typeof opt.duration !== \"number\" ) {\n\t\t\tif ( opt.duration in jQuery.fx.speeds ) {\n\t\t\t\topt.duration = jQuery.fx.speeds[ opt.duration ];\n\n\t\t\t} else {\n\t\t\t\topt.duration = jQuery.fx.speeds._default;\n\t\t\t}\n\t\t}\n\t}\n\n\t// Normalize opt.queue - true/undefined/null -> \"fx\"\n\tif ( opt.queue == null || opt.queue === true ) {\n\t\topt.queue = \"fx\";\n\t}\n\n\t// Queueing\n\topt.old = opt.complete;\n\n\topt.complete = function() {\n\t\tif ( isFunction( opt.old ) ) {\n\t\t\topt.old.call( this );\n\t\t}\n\n\t\tif ( opt.queue ) {\n\t\t\tjQuery.dequeue( this, opt.queue );\n\t\t}\n\t};\n\n\treturn opt;\n};\n\njQuery.fn.extend( {\n\tfadeTo: function( speed, to, easing, callback ) {\n\n\t\t// Show any hidden elements after setting opacity to 0\n\t\treturn this.filter( isHiddenWithinTree ).css( \"opacity\", 0 ).show()\n\n\t\t\t// Animate to the value specified\n\t\t\t.end().animate( { opacity: to }, speed, easing, callback );\n\t},\n\tanimate: function( prop, speed, easing, callback ) {\n\t\tvar empty = jQuery.isEmptyObject( prop ),\n\t\t\toptall = jQuery.speed( speed, easing, callback ),\n\t\t\tdoAnimation = function() {\n\n\t\t\t\t// Operate on a copy of prop so per-property easing won't be lost\n\t\t\t\tvar anim = Animation( this, jQuery.extend( {}, prop ), optall );\n\n\t\t\t\t// Empty animations, or finishing resolves immediately\n\t\t\t\tif ( empty || dataPriv.get( this, \"finish\" ) ) {\n\t\t\t\t\tanim.stop( true );\n\t\t\t\t}\n\t\t\t};\n\t\t\tdoAnimation.finish = doAnimation;\n\n\t\treturn empty || optall.queue === false ?\n\t\t\tthis.each( doAnimation ) :\n\t\t\tthis.queue( optall.queue, doAnimation );\n\t},\n\tstop: function( type, clearQueue, gotoEnd ) {\n\t\tvar stopQueue = function( hooks ) {\n\t\t\tvar stop = hooks.stop;\n\t\t\tdelete hooks.stop;\n\t\t\tstop( gotoEnd );\n\t\t};\n\n\t\tif ( typeof type !== \"string\" ) {\n\t\t\tgotoEnd = clearQueue;\n\t\t\tclearQueue = type;\n\t\t\ttype = undefined;\n\t\t}\n\t\tif ( clearQueue && type !== false ) {\n\t\t\tthis.queue( type || \"fx\", [] );\n\t\t}\n\n\t\treturn this.each( function() {\n\t\t\tvar dequeue = true,\n\t\t\t\tindex = type != null && type + \"queueHooks\",\n\t\t\t\ttimers = jQuery.timers,\n\t\t\t\tdata = dataPriv.get( this );\n\n\t\t\tif ( index ) {\n\t\t\t\tif ( data[ index ] && data[ index ].stop ) {\n\t\t\t\t\tstopQueue( data[ index ] );\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tfor ( index in data ) {\n\t\t\t\t\tif ( data[ index ] && data[ index ].stop && rrun.test( index ) ) {\n\t\t\t\t\t\tstopQueue( data[ index ] );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfor ( index = timers.length; index--; ) {\n\t\t\t\tif ( timers[ index ].elem === this &&\n\t\t\t\t\t( type == null || timers[ index ].queue === type ) ) {\n\n\t\t\t\t\ttimers[ index ].anim.stop( gotoEnd );\n\t\t\t\t\tdequeue = false;\n\t\t\t\t\ttimers.splice( index, 1 );\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Start the next in the queue if the last step wasn't forced.\n\t\t\t// Timers currently will call their complete callbacks, which\n\t\t\t// will dequeue but only if they were gotoEnd.\n\t\t\tif ( dequeue || !gotoEnd ) {\n\t\t\t\tjQuery.dequeue( this, type );\n\t\t\t}\n\t\t} );\n\t},\n\tfinish: function( type ) {\n\t\tif ( type !== false ) {\n\t\t\ttype = type || \"fx\";\n\t\t}\n\t\treturn this.each( function() {\n\t\t\tvar index,\n\t\t\t\tdata = dataPriv.get( this ),\n\t\t\t\tqueue = data[ type + \"queue\" ],\n\t\t\t\thooks = data[ type + \"queueHooks\" ],\n\t\t\t\ttimers = jQuery.timers,\n\t\t\t\tlength = queue ? queue.length : 0;\n\n\t\t\t// Enable finishing flag on private data\n\t\t\tdata.finish = true;\n\n\t\t\t// Empty the queue first\n\t\t\tjQuery.queue( this, type, [] );\n\n\t\t\tif ( hooks && hooks.stop ) {\n\t\t\t\thooks.stop.call( this, true );\n\t\t\t}\n\n\t\t\t// Look for any active animations, and finish them\n\t\t\tfor ( index = timers.length; index--; ) {\n\t\t\t\tif ( timers[ index ].elem === this && timers[ index ].queue === type ) {\n\t\t\t\t\ttimers[ index ].anim.stop( true );\n\t\t\t\t\ttimers.splice( index, 1 );\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Look for any animations in the old queue and finish them\n\t\t\tfor ( index = 0; index < length; index++ ) {\n\t\t\t\tif ( queue[ index ] && queue[ index ].finish ) {\n\t\t\t\t\tqueue[ index ].finish.call( this );\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Turn off finishing flag\n\t\t\tdelete data.finish;\n\t\t} );\n\t}\n} );\n\njQuery.each( [ \"toggle\", \"show\", \"hide\" ], function( i, name ) {\n\tvar cssFn = jQuery.fn[ name ];\n\tjQuery.fn[ name ] = function( speed, easing, callback ) {\n\t\treturn speed == null || typeof speed === \"boolean\" ?\n\t\t\tcssFn.apply( this, arguments ) :\n\t\t\tthis.animate( genFx( name, true ), speed, easing, callback );\n\t};\n} );\n\n// Generate shortcuts for custom animations\njQuery.each( {\n\tslideDown: genFx( \"show\" ),\n\tslideUp: genFx( \"hide\" ),\n\tslideToggle: genFx( \"toggle\" ),\n\tfadeIn: { opacity: \"show\" },\n\tfadeOut: { opacity: \"hide\" },\n\tfadeToggle: { opacity: \"toggle\" }\n}, function( name, props ) {\n\tjQuery.fn[ name ] = function( speed, easing, callback ) {\n\t\treturn this.animate( props, speed, easing, callback );\n\t};\n} );\n\njQuery.timers = [];\njQuery.fx.tick = function() {\n\tvar timer,\n\t\ti = 0,\n\t\ttimers = jQuery.timers;\n\n\tfxNow = Date.now();\n\n\tfor ( ; i < timers.length; i++ ) {\n\t\ttimer = timers[ i ];\n\n\t\t// Run the timer and safely remove it when done (allowing for external removal)\n\t\tif ( !timer() && timers[ i ] === timer ) {\n\t\t\ttimers.splice( i--, 1 );\n\t\t}\n\t}\n\n\tif ( !timers.length ) {\n\t\tjQuery.fx.stop();\n\t}\n\tfxNow = undefined;\n};\n\njQuery.fx.timer = function( timer ) {\n\tjQuery.timers.push( timer );\n\tjQuery.fx.start();\n};\n\njQuery.fx.interval = 13;\njQuery.fx.start = function() {\n\tif ( inProgress ) {\n\t\treturn;\n\t}\n\n\tinProgress = true;\n\tschedule();\n};\n\njQuery.fx.stop = function() {\n\tinProgress = null;\n};\n\njQuery.fx.speeds = {\n\tslow: 600,\n\tfast: 200,\n\n\t// Default speed\n\t_default: 400\n};\n\n\n// Based off of the plugin by Clint Helfers, with permission.\n// https://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/\njQuery.fn.delay = function( time, type ) {\n\ttime = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;\n\ttype = type || \"fx\";\n\n\treturn this.queue( type, function( next, hooks ) {\n\t\tvar timeout = window.setTimeout( next, time );\n\t\thooks.stop = function() {\n\t\t\twindow.clearTimeout( timeout );\n\t\t};\n\t} );\n};\n\n\n( function() {\n\tvar input = document.createElement( \"input\" ),\n\t\tselect = document.createElement( \"select\" ),\n\t\topt = select.appendChild( document.createElement( \"option\" ) );\n\n\tinput.type = \"checkbox\";\n\n\t// Support: Android <=4.3 only\n\t// Default value for a checkbox should be \"on\"\n\tsupport.checkOn = input.value !== \"\";\n\n\t// Support: IE <=11 only\n\t// Must access selectedIndex to make default options select\n\tsupport.optSelected = opt.selected;\n\n\t// Support: IE <=11 only\n\t// An input loses its value after becoming a radio\n\tinput = document.createElement( \"input\" );\n\tinput.value = \"t\";\n\tinput.type = \"radio\";\n\tsupport.radioValue = input.value === \"t\";\n} )();\n\n\nvar boolHook,\n\tattrHandle = jQuery.expr.attrHandle;\n\njQuery.fn.extend( {\n\tattr: function( name, value ) {\n\t\treturn access( this, jQuery.attr, name, value, arguments.length > 1 );\n\t},\n\n\tremoveAttr: function( name ) {\n\t\treturn this.each( function() {\n\t\t\tjQuery.removeAttr( this, name );\n\t\t} );\n\t}\n} );\n\njQuery.extend( {\n\tattr: function( elem, name, value ) {\n\t\tvar ret, hooks,\n\t\t\tnType = elem.nodeType;\n\n\t\t// Don't get/set attributes on text, comment and attribute nodes\n\t\tif ( nType === 3 || nType === 8 || nType === 2 ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Fallback to prop when attributes are not supported\n\t\tif ( typeof elem.getAttribute === \"undefined\" ) {\n\t\t\treturn jQuery.prop( elem, name, value );\n\t\t}\n\n\t\t// Attribute hooks are determined by the lowercase version\n\t\t// Grab necessary hook if one is defined\n\t\tif ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {\n\t\t\thooks = jQuery.attrHooks[ name.toLowerCase() ] ||\n\t\t\t\t( jQuery.expr.match.bool.test( name ) ? boolHook : undefined );\n\t\t}\n\n\t\tif ( value !== undefined ) {\n\t\t\tif ( value === null ) {\n\t\t\t\tjQuery.removeAttr( elem, name );\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif ( hooks && \"set\" in hooks &&\n\t\t\t\t( ret = hooks.set( elem, value, name ) ) !== undefined ) {\n\t\t\t\treturn ret;\n\t\t\t}\n\n\t\t\telem.setAttribute( name, value + \"\" );\n\t\t\treturn value;\n\t\t}\n\n\t\tif ( hooks && \"get\" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {\n\t\t\treturn ret;\n\t\t}\n\n\t\tret = jQuery.find.attr( elem, name );\n\n\t\t// Non-existent attributes return null, we normalize to undefined\n\t\treturn ret == null ? undefined : ret;\n\t},\n\n\tattrHooks: {\n\t\ttype: {\n\t\t\tset: function( elem, value ) {\n\t\t\t\tif ( !support.radioValue && value === \"radio\" &&\n\t\t\t\t\tnodeName( elem, \"input\" ) ) {\n\t\t\t\t\tvar val = elem.value;\n\t\t\t\t\telem.setAttribute( \"type\", value );\n\t\t\t\t\tif ( val ) {\n\t\t\t\t\t\telem.value = val;\n\t\t\t\t\t}\n\t\t\t\t\treturn value;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t},\n\n\tremoveAttr: function( elem, value ) {\n\t\tvar name,\n\t\t\ti = 0,\n\n\t\t\t// Attribute names can contain non-HTML whitespace characters\n\t\t\t// https://html.spec.whatwg.org/multipage/syntax.html#attributes-2\n\t\t\tattrNames = value && value.match( rnothtmlwhite );\n\n\t\tif ( attrNames && elem.nodeType === 1 ) {\n\t\t\twhile ( ( name = attrNames[ i++ ] ) ) {\n\t\t\t\telem.removeAttribute( name );\n\t\t\t}\n\t\t}\n\t}\n} );\n\n// Hooks for boolean attributes\nboolHook = {\n\tset: function( elem, value, name ) {\n\t\tif ( value === false ) {\n\n\t\t\t// Remove boolean attributes when set to false\n\t\t\tjQuery.removeAttr( elem, name );\n\t\t} else {\n\t\t\telem.setAttribute( name, name );\n\t\t}\n\t\treturn name;\n\t}\n};\n\njQuery.each( jQuery.expr.match.bool.source.match( /\\w+/g ), function( i, name ) {\n\tvar getter = attrHandle[ name ] || jQuery.find.attr;\n\n\tattrHandle[ name ] = function( elem, name, isXML ) {\n\t\tvar ret, handle,\n\t\t\tlowercaseName = name.toLowerCase();\n\n\t\tif ( !isXML ) {\n\n\t\t\t// Avoid an infinite loop by temporarily removing this function from the getter\n\t\t\thandle = attrHandle[ lowercaseName ];\n\t\t\tattrHandle[ lowercaseName ] = ret;\n\t\t\tret = getter( elem, name, isXML ) != null ?\n\t\t\t\tlowercaseName :\n\t\t\t\tnull;\n\t\t\tattrHandle[ lowercaseName ] = handle;\n\t\t}\n\t\treturn ret;\n\t};\n} );\n\n\n\n\nvar rfocusable = /^(?:input|select|textarea|button)$/i,\n\trclickable = /^(?:a|area)$/i;\n\njQuery.fn.extend( {\n\tprop: function( name, value ) {\n\t\treturn access( this, jQuery.prop, name, value, arguments.length > 1 );\n\t},\n\n\tremoveProp: function( name ) {\n\t\treturn this.each( function() {\n\t\t\tdelete this[ jQuery.propFix[ name ] || name ];\n\t\t} );\n\t}\n} );\n\njQuery.extend( {\n\tprop: function( elem, name, value ) {\n\t\tvar ret, hooks,\n\t\t\tnType = elem.nodeType;\n\n\t\t// Don't get/set properties on text, comment and attribute nodes\n\t\tif ( nType === 3 || nType === 8 || nType === 2 ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {\n\n\t\t\t// Fix name and attach hooks\n\t\t\tname = jQuery.propFix[ name ] || name;\n\t\t\thooks = jQuery.propHooks[ name ];\n\t\t}\n\n\t\tif ( value !== undefined ) {\n\t\t\tif ( hooks && \"set\" in hooks &&\n\t\t\t\t( ret = hooks.set( elem, value, name ) ) !== undefined ) {\n\t\t\t\treturn ret;\n\t\t\t}\n\n\t\t\treturn ( elem[ name ] = value );\n\t\t}\n\n\t\tif ( hooks && \"get\" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {\n\t\t\treturn ret;\n\t\t}\n\n\t\treturn elem[ name ];\n\t},\n\n\tpropHooks: {\n\t\ttabIndex: {\n\t\t\tget: function( elem ) {\n\n\t\t\t\t// Support: IE <=9 - 11 only\n\t\t\t\t// elem.tabIndex doesn't always return the\n\t\t\t\t// correct value when it hasn't been explicitly set\n\t\t\t\t// https://web.archive.org/web/20141116233347/http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/\n\t\t\t\t// Use proper attribute retrieval(#12072)\n\t\t\t\tvar tabindex = jQuery.find.attr( elem, \"tabindex\" );\n\n\t\t\t\tif ( tabindex ) {\n\t\t\t\t\treturn parseInt( tabindex, 10 );\n\t\t\t\t}\n\n\t\t\t\tif (\n\t\t\t\t\trfocusable.test( elem.nodeName ) ||\n\t\t\t\t\trclickable.test( elem.nodeName ) &&\n\t\t\t\t\telem.href\n\t\t\t\t) {\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\n\t\t\t\treturn -1;\n\t\t\t}\n\t\t}\n\t},\n\n\tpropFix: {\n\t\t\"for\": \"htmlFor\",\n\t\t\"class\": \"className\"\n\t}\n} );\n\n// Support: IE <=11 only\n// Accessing the selectedIndex property\n// forces the browser to respect setting selected\n// on the option\n// The getter ensures a default option is selected\n// when in an optgroup\n// eslint rule \"no-unused-expressions\" is disabled for this code\n// since it considers such accessions noop\nif ( !support.optSelected ) {\n\tjQuery.propHooks.selected = {\n\t\tget: function( elem ) {\n\n\t\t\t/* eslint no-unused-expressions: \"off\" */\n\n\t\t\tvar parent = elem.parentNode;\n\t\t\tif ( parent && parent.parentNode ) {\n\t\t\t\tparent.parentNode.selectedIndex;\n\t\t\t}\n\t\t\treturn null;\n\t\t},\n\t\tset: function( elem ) {\n\n\t\t\t/* eslint no-unused-expressions: \"off\" */\n\n\t\t\tvar parent = elem.parentNode;\n\t\t\tif ( parent ) {\n\t\t\t\tparent.selectedIndex;\n\n\t\t\t\tif ( parent.parentNode ) {\n\t\t\t\t\tparent.parentNode.selectedIndex;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t};\n}\n\njQuery.each( [\n\t\"tabIndex\",\n\t\"readOnly\",\n\t\"maxLength\",\n\t\"cellSpacing\",\n\t\"cellPadding\",\n\t\"rowSpan\",\n\t\"colSpan\",\n\t\"useMap\",\n\t\"frameBorder\",\n\t\"contentEditable\"\n], function() {\n\tjQuery.propFix[ this.toLowerCase() ] = this;\n} );\n\n\n\n\n\t// Strip and collapse whitespace according to HTML spec\n\t// https://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace\n\tfunction stripAndCollapse( value ) {\n\t\tvar tokens = value.match( rnothtmlwhite ) || [];\n\t\treturn tokens.join( \" \" );\n\t}\n\n\nfunction getClass( elem ) {\n\treturn elem.getAttribute && elem.getAttribute( \"class\" ) || \"\";\n}\n\nfunction classesToArray( value ) {\n\tif ( Array.isArray( value ) ) {\n\t\treturn value;\n\t}\n\tif ( typeof value === \"string\" ) {\n\t\treturn value.match( rnothtmlwhite ) || [];\n\t}\n\treturn [];\n}\n\njQuery.fn.extend( {\n\taddClass: function( value ) {\n\t\tvar classes, elem, cur, curValue, clazz, j, finalValue,\n\t\t\ti = 0;\n\n\t\tif ( isFunction( value ) ) {\n\t\t\treturn this.each( function( j ) {\n\t\t\t\tjQuery( this ).addClass( value.call( this, j, getClass( this ) ) );\n\t\t\t} );\n\t\t}\n\n\t\tclasses = classesToArray( value );\n\n\t\tif ( classes.length ) {\n\t\t\twhile ( ( elem = this[ i++ ] ) ) {\n\t\t\t\tcurValue = getClass( elem );\n\t\t\t\tcur = elem.nodeType === 1 && ( \" \" + stripAndCollapse( curValue ) + \" \" );\n\n\t\t\t\tif ( cur ) {\n\t\t\t\t\tj = 0;\n\t\t\t\t\twhile ( ( clazz = classes[ j++ ] ) ) {\n\t\t\t\t\t\tif ( cur.indexOf( \" \" + clazz + \" \" ) < 0 ) {\n\t\t\t\t\t\t\tcur += clazz + \" \";\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t// Only assign if different to avoid unneeded rendering.\n\t\t\t\t\tfinalValue = stripAndCollapse( cur );\n\t\t\t\t\tif ( curValue !== finalValue ) {\n\t\t\t\t\t\telem.setAttribute( \"class\", finalValue );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn this;\n\t},\n\n\tremoveClass: function( value ) {\n\t\tvar classes, elem, cur, curValue, clazz, j, finalValue,\n\t\t\ti = 0;\n\n\t\tif ( isFunction( value ) ) {\n\t\t\treturn this.each( function( j ) {\n\t\t\t\tjQuery( this ).removeClass( value.call( this, j, getClass( this ) ) );\n\t\t\t} );\n\t\t}\n\n\t\tif ( !arguments.length ) {\n\t\t\treturn this.attr( \"class\", \"\" );\n\t\t}\n\n\t\tclasses = classesToArray( value );\n\n\t\tif ( classes.length ) {\n\t\t\twhile ( ( elem = this[ i++ ] ) ) {\n\t\t\t\tcurValue = getClass( elem );\n\n\t\t\t\t// This expression is here for better compressibility (see addClass)\n\t\t\t\tcur = elem.nodeType === 1 && ( \" \" + stripAndCollapse( curValue ) + \" \" );\n\n\t\t\t\tif ( cur ) {\n\t\t\t\t\tj = 0;\n\t\t\t\t\twhile ( ( clazz = classes[ j++ ] ) ) {\n\n\t\t\t\t\t\t// Remove *all* instances\n\t\t\t\t\t\twhile ( cur.indexOf( \" \" + clazz + \" \" ) > -1 ) {\n\t\t\t\t\t\t\tcur = cur.replace( \" \" + clazz + \" \", \" \" );\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t// Only assign if different to avoid unneeded rendering.\n\t\t\t\t\tfinalValue = stripAndCollapse( cur );\n\t\t\t\t\tif ( curValue !== finalValue ) {\n\t\t\t\t\t\telem.setAttribute( \"class\", finalValue );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn this;\n\t},\n\n\ttoggleClass: function( value, stateVal ) {\n\t\tvar type = typeof value,\n\t\t\tisValidValue = type === \"string\" || Array.isArray( value );\n\n\t\tif ( typeof stateVal === \"boolean\" && isValidValue ) {\n\t\t\treturn stateVal ? this.addClass( value ) : this.removeClass( value );\n\t\t}\n\n\t\tif ( isFunction( value ) ) {\n\t\t\treturn this.each( function( i ) {\n\t\t\t\tjQuery( this ).toggleClass(\n\t\t\t\t\tvalue.call( this, i, getClass( this ), stateVal ),\n\t\t\t\t\tstateVal\n\t\t\t\t);\n\t\t\t} );\n\t\t}\n\n\t\treturn this.each( function() {\n\t\t\tvar className, i, self, classNames;\n\n\t\t\tif ( isValidValue ) {\n\n\t\t\t\t// Toggle individual class names\n\t\t\t\ti = 0;\n\t\t\t\tself = jQuery( this );\n\t\t\t\tclassNames = classesToArray( value );\n\n\t\t\t\twhile ( ( className = classNames[ i++ ] ) ) {\n\n\t\t\t\t\t// Check each className given, space separated list\n\t\t\t\t\tif ( self.hasClass( className ) ) {\n\t\t\t\t\t\tself.removeClass( className );\n\t\t\t\t\t} else {\n\t\t\t\t\t\tself.addClass( className );\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t// Toggle whole class name\n\t\t\t} else if ( value === undefined || type === \"boolean\" ) {\n\t\t\t\tclassName = getClass( this );\n\t\t\t\tif ( className ) {\n\n\t\t\t\t\t// Store className if set\n\t\t\t\t\tdataPriv.set( this, \"__className__\", className );\n\t\t\t\t}\n\n\t\t\t\t// If the element has a class name or if we're passed `false`,\n\t\t\t\t// then remove the whole classname (if there was one, the above saved it).\n\t\t\t\t// Otherwise bring back whatever was previously saved (if anything),\n\t\t\t\t// falling back to the empty string if nothing was stored.\n\t\t\t\tif ( this.setAttribute ) {\n\t\t\t\t\tthis.setAttribute( \"class\",\n\t\t\t\t\t\tclassName || value === false ?\n\t\t\t\t\t\t\"\" :\n\t\t\t\t\t\tdataPriv.get( this, \"__className__\" ) || \"\"\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t} );\n\t},\n\n\thasClass: function( selector ) {\n\t\tvar className, elem,\n\t\t\ti = 0;\n\n\t\tclassName = \" \" + selector + \" \";\n\t\twhile ( ( elem = this[ i++ ] ) ) {\n\t\t\tif ( elem.nodeType === 1 &&\n\t\t\t\t( \" \" + stripAndCollapse( getClass( elem ) ) + \" \" ).indexOf( className ) > -1 ) {\n\t\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\n\t\treturn false;\n\t}\n} );\n\n\n\n\nvar rreturn = /\\r/g;\n\njQuery.fn.extend( {\n\tval: function( value ) {\n\t\tvar hooks, ret, valueIsFunction,\n\t\t\telem = this[ 0 ];\n\n\t\tif ( !arguments.length ) {\n\t\t\tif ( elem ) {\n\t\t\t\thooks = jQuery.valHooks[ elem.type ] ||\n\t\t\t\t\tjQuery.valHooks[ elem.nodeName.toLowerCase() ];\n\n\t\t\t\tif ( hooks &&\n\t\t\t\t\t\"get\" in hooks &&\n\t\t\t\t\t( ret = hooks.get( elem, \"value\" ) ) !== undefined\n\t\t\t\t) {\n\t\t\t\t\treturn ret;\n\t\t\t\t}\n\n\t\t\t\tret = elem.value;\n\n\t\t\t\t// Handle most common string cases\n\t\t\t\tif ( typeof ret === \"string\" ) {\n\t\t\t\t\treturn ret.replace( rreturn, \"\" );\n\t\t\t\t}\n\n\t\t\t\t// Handle cases where value is null/undef or number\n\t\t\t\treturn ret == null ? \"\" : ret;\n\t\t\t}\n\n\t\t\treturn;\n\t\t}\n\n\t\tvalueIsFunction = isFunction( value );\n\n\t\treturn this.each( function( i ) {\n\t\t\tvar val;\n\n\t\t\tif ( this.nodeType !== 1 ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif ( valueIsFunction ) {\n\t\t\t\tval = value.call( this, i, jQuery( this ).val() );\n\t\t\t} else {\n\t\t\t\tval = value;\n\t\t\t}\n\n\t\t\t// Treat null/undefined as \"\"; convert numbers to string\n\t\t\tif ( val == null ) {\n\t\t\t\tval = \"\";\n\n\t\t\t} else if ( typeof val === \"number\" ) {\n\t\t\t\tval += \"\";\n\n\t\t\t} else if ( Array.isArray( val ) ) {\n\t\t\t\tval = jQuery.map( val, function( value ) {\n\t\t\t\t\treturn value == null ? \"\" : value + \"\";\n\t\t\t\t} );\n\t\t\t}\n\n\t\t\thooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];\n\n\t\t\t// If set returns undefined, fall back to normal setting\n\t\t\tif ( !hooks || !( \"set\" in hooks ) || hooks.set( this, val, \"value\" ) === undefined ) {\n\t\t\t\tthis.value = val;\n\t\t\t}\n\t\t} );\n\t}\n} );\n\njQuery.extend( {\n\tvalHooks: {\n\t\toption: {\n\t\t\tget: function( elem ) {\n\n\t\t\t\tvar val = jQuery.find.attr( elem, \"value\" );\n\t\t\t\treturn val != null ?\n\t\t\t\t\tval :\n\n\t\t\t\t\t// Support: IE <=10 - 11 only\n\t\t\t\t\t// option.text throws exceptions (#14686, #14858)\n\t\t\t\t\t// Strip and collapse whitespace\n\t\t\t\t\t// https://html.spec.whatwg.org/#strip-and-collapse-whitespace\n\t\t\t\t\tstripAndCollapse( jQuery.text( elem ) );\n\t\t\t}\n\t\t},\n\t\tselect: {\n\t\t\tget: function( elem ) {\n\t\t\t\tvar value, option, i,\n\t\t\t\t\toptions = elem.options,\n\t\t\t\t\tindex = elem.selectedIndex,\n\t\t\t\t\tone = elem.type === \"select-one\",\n\t\t\t\t\tvalues = one ? null : [],\n\t\t\t\t\tmax = one ? index + 1 : options.length;\n\n\t\t\t\tif ( index < 0 ) {\n\t\t\t\t\ti = max;\n\n\t\t\t\t} else {\n\t\t\t\t\ti = one ? index : 0;\n\t\t\t\t}\n\n\t\t\t\t// Loop through all the selected options\n\t\t\t\tfor ( ; i < max; i++ ) {\n\t\t\t\t\toption = options[ i ];\n\n\t\t\t\t\t// Support: IE <=9 only\n\t\t\t\t\t// IE8-9 doesn't update selected after form reset (#2551)\n\t\t\t\t\tif ( ( option.selected || i === index ) &&\n\n\t\t\t\t\t\t\t// Don't return options that are disabled or in a disabled optgroup\n\t\t\t\t\t\t\t!option.disabled &&\n\t\t\t\t\t\t\t( !option.parentNode.disabled ||\n\t\t\t\t\t\t\t\t!nodeName( option.parentNode, \"optgroup\" ) ) ) {\n\n\t\t\t\t\t\t// Get the specific value for the option\n\t\t\t\t\t\tvalue = jQuery( option ).val();\n\n\t\t\t\t\t\t// We don't need an array for one selects\n\t\t\t\t\t\tif ( one ) {\n\t\t\t\t\t\t\treturn value;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Multi-Selects return an array\n\t\t\t\t\t\tvalues.push( value );\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\treturn values;\n\t\t\t},\n\n\t\t\tset: function( elem, value ) {\n\t\t\t\tvar optionSet, option,\n\t\t\t\t\toptions = elem.options,\n\t\t\t\t\tvalues = jQuery.makeArray( value ),\n\t\t\t\t\ti = options.length;\n\n\t\t\t\twhile ( i-- ) {\n\t\t\t\t\toption = options[ i ];\n\n\t\t\t\t\t/* eslint-disable no-cond-assign */\n\n\t\t\t\t\tif ( option.selected =\n\t\t\t\t\t\tjQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1\n\t\t\t\t\t) {\n\t\t\t\t\t\toptionSet = true;\n\t\t\t\t\t}\n\n\t\t\t\t\t/* eslint-enable no-cond-assign */\n\t\t\t\t}\n\n\t\t\t\t// Force browsers to behave consistently when non-matching value is set\n\t\t\t\tif ( !optionSet ) {\n\t\t\t\t\telem.selectedIndex = -1;\n\t\t\t\t}\n\t\t\t\treturn values;\n\t\t\t}\n\t\t}\n\t}\n} );\n\n// Radios and checkboxes getter/setter\njQuery.each( [ \"radio\", \"checkbox\" ], function() {\n\tjQuery.valHooks[ this ] = {\n\t\tset: function( elem, value ) {\n\t\t\tif ( Array.isArray( value ) ) {\n\t\t\t\treturn ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 );\n\t\t\t}\n\t\t}\n\t};\n\tif ( !support.checkOn ) {\n\t\tjQuery.valHooks[ this ].get = function( elem ) {\n\t\t\treturn elem.getAttribute( \"value\" ) === null ? \"on\" : elem.value;\n\t\t};\n\t}\n} );\n\n\n\n\n// Return jQuery for attributes-only inclusion\n\n\nsupport.focusin = \"onfocusin\" in window;\n\n\nvar rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,\n\tstopPropagationCallback = function( e ) {\n\t\te.stopPropagation();\n\t};\n\njQuery.extend( jQuery.event, {\n\n\ttrigger: function( event, data, elem, onlyHandlers ) {\n\n\t\tvar i, cur, tmp, bubbleType, ontype, handle, special, lastElement,\n\t\t\teventPath = [ elem || document ],\n\t\t\ttype = hasOwn.call( event, \"type\" ) ? event.type : event,\n\t\t\tnamespaces = hasOwn.call( event, \"namespace\" ) ? event.namespace.split( \".\" ) : [];\n\n\t\tcur = lastElement = tmp = elem = elem || document;\n\n\t\t// Don't do events on text and comment nodes\n\t\tif ( elem.nodeType === 3 || elem.nodeType === 8 ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// focus/blur morphs to focusin/out; ensure we're not firing them right now\n\t\tif ( rfocusMorph.test( type + jQuery.event.triggered ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( type.indexOf( \".\" ) > -1 ) {\n\n\t\t\t// Namespaced trigger; create a regexp to match event type in handle()\n\t\t\tnamespaces = type.split( \".\" );\n\t\t\ttype = namespaces.shift();\n\t\t\tnamespaces.sort();\n\t\t}\n\t\tontype = type.indexOf( \":\" ) < 0 && \"on\" + type;\n\n\t\t// Caller can pass in a jQuery.Event object, Object, or just an event type string\n\t\tevent = event[ jQuery.expando ] ?\n\t\t\tevent :\n\t\t\tnew jQuery.Event( type, typeof event === \"object\" && event );\n\n\t\t// Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)\n\t\tevent.isTrigger = onlyHandlers ? 2 : 3;\n\t\tevent.namespace = namespaces.join( \".\" );\n\t\tevent.rnamespace = event.namespace ?\n\t\t\tnew RegExp( \"(^|\\\\.)\" + namespaces.join( \"\\\\.(?:.*\\\\.|)\" ) + \"(\\\\.|$)\" ) :\n\t\t\tnull;\n\n\t\t// Clean up the event in case it is being reused\n\t\tevent.result = undefined;\n\t\tif ( !event.target ) {\n\t\t\tevent.target = elem;\n\t\t}\n\n\t\t// Clone any incoming data and prepend the event, creating the handler arg list\n\t\tdata = data == null ?\n\t\t\t[ event ] :\n\t\t\tjQuery.makeArray( data, [ event ] );\n\n\t\t// Allow special events to draw outside the lines\n\t\tspecial = jQuery.event.special[ type ] || {};\n\t\tif ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Determine event propagation path in advance, per W3C events spec (#9951)\n\t\t// Bubble up to document, then to window; watch for a global ownerDocument var (#9724)\n\t\tif ( !onlyHandlers && !special.noBubble && !isWindow( elem ) ) {\n\n\t\t\tbubbleType = special.delegateType || type;\n\t\t\tif ( !rfocusMorph.test( bubbleType + type ) ) {\n\t\t\t\tcur = cur.parentNode;\n\t\t\t}\n\t\t\tfor ( ; cur; cur = cur.parentNode ) {\n\t\t\t\teventPath.push( cur );\n\t\t\t\ttmp = cur;\n\t\t\t}\n\n\t\t\t// Only add window if we got to document (e.g., not plain obj or detached DOM)\n\t\t\tif ( tmp === ( elem.ownerDocument || document ) ) {\n\t\t\t\teventPath.push( tmp.defaultView || tmp.parentWindow || window );\n\t\t\t}\n\t\t}\n\n\t\t// Fire handlers on the event path\n\t\ti = 0;\n\t\twhile ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) {\n\t\t\tlastElement = cur;\n\t\t\tevent.type = i > 1 ?\n\t\t\t\tbubbleType :\n\t\t\t\tspecial.bindType || type;\n\n\t\t\t// jQuery handler\n\t\t\thandle = ( dataPriv.get( cur, \"events\" ) || {} )[ event.type ] &&\n\t\t\t\tdataPriv.get( cur, \"handle\" );\n\t\t\tif ( handle ) {\n\t\t\t\thandle.apply( cur, data );\n\t\t\t}\n\n\t\t\t// Native handler\n\t\t\thandle = ontype && cur[ ontype ];\n\t\t\tif ( handle && handle.apply && acceptData( cur ) ) {\n\t\t\t\tevent.result = handle.apply( cur, data );\n\t\t\t\tif ( event.result === false ) {\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tevent.type = type;\n\n\t\t// If nobody prevented the default action, do it now\n\t\tif ( !onlyHandlers && !event.isDefaultPrevented() ) {\n\n\t\t\tif ( ( !special._default ||\n\t\t\t\tspecial._default.apply( eventPath.pop(), data ) === false ) &&\n\t\t\t\tacceptData( elem ) ) {\n\n\t\t\t\t// Call a native DOM method on the target with the same name as the event.\n\t\t\t\t// Don't do default actions on window, that's where global variables be (#6170)\n\t\t\t\tif ( ontype && isFunction( elem[ type ] ) && !isWindow( elem ) ) {\n\n\t\t\t\t\t// Don't re-trigger an onFOO event when we call its FOO() method\n\t\t\t\t\ttmp = elem[ ontype ];\n\n\t\t\t\t\tif ( tmp ) {\n\t\t\t\t\t\telem[ ontype ] = null;\n\t\t\t\t\t}\n\n\t\t\t\t\t// Prevent re-triggering of the same event, since we already bubbled it above\n\t\t\t\t\tjQuery.event.triggered = type;\n\n\t\t\t\t\tif ( event.isPropagationStopped() ) {\n\t\t\t\t\t\tlastElement.addEventListener( type, stopPropagationCallback );\n\t\t\t\t\t}\n\n\t\t\t\t\telem[ type ]();\n\n\t\t\t\t\tif ( event.isPropagationStopped() ) {\n\t\t\t\t\t\tlastElement.removeEventListener( type, stopPropagationCallback );\n\t\t\t\t\t}\n\n\t\t\t\t\tjQuery.event.triggered = undefined;\n\n\t\t\t\t\tif ( tmp ) {\n\t\t\t\t\t\telem[ ontype ] = tmp;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn event.result;\n\t},\n\n\t// Piggyback on a donor event to simulate a different one\n\t// Used only for `focus(in | out)` events\n\tsimulate: function( type, elem, event ) {\n\t\tvar e = jQuery.extend(\n\t\t\tnew jQuery.Event(),\n\t\t\tevent,\n\t\t\t{\n\t\t\t\ttype: type,\n\t\t\t\tisSimulated: true\n\t\t\t}\n\t\t);\n\n\t\tjQuery.event.trigger( e, null, elem );\n\t}\n\n} );\n\njQuery.fn.extend( {\n\n\ttrigger: function( type, data ) {\n\t\treturn this.each( function() {\n\t\t\tjQuery.event.trigger( type, data, this );\n\t\t} );\n\t},\n\ttriggerHandler: function( type, data ) {\n\t\tvar elem = this[ 0 ];\n\t\tif ( elem ) {\n\t\t\treturn jQuery.event.trigger( type, data, elem, true );\n\t\t}\n\t}\n} );\n\n\n// Support: Firefox <=44\n// Firefox doesn't have focus(in | out) events\n// Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787\n//\n// Support: Chrome <=48 - 49, Safari <=9.0 - 9.1\n// focus(in | out) events fire after focus & blur events,\n// which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order\n// Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857\nif ( !support.focusin ) {\n\tjQuery.each( { focus: \"focusin\", blur: \"focusout\" }, function( orig, fix ) {\n\n\t\t// Attach a single capturing handler on the document while someone wants focusin/focusout\n\t\tvar handler = function( event ) {\n\t\t\tjQuery.event.simulate( fix, event.target, jQuery.event.fix( event ) );\n\t\t};\n\n\t\tjQuery.event.special[ fix ] = {\n\t\t\tsetup: function() {\n\t\t\t\tvar doc = this.ownerDocument || this,\n\t\t\t\t\tattaches = dataPriv.access( doc, fix );\n\n\t\t\t\tif ( !attaches ) {\n\t\t\t\t\tdoc.addEventListener( orig, handler, true );\n\t\t\t\t}\n\t\t\t\tdataPriv.access( doc, fix, ( attaches || 0 ) + 1 );\n\t\t\t},\n\t\t\tteardown: function() {\n\t\t\t\tvar doc = this.ownerDocument || this,\n\t\t\t\t\tattaches = dataPriv.access( doc, fix ) - 1;\n\n\t\t\t\tif ( !attaches ) {\n\t\t\t\t\tdoc.removeEventListener( orig, handler, true );\n\t\t\t\t\tdataPriv.remove( doc, fix );\n\n\t\t\t\t} else {\n\t\t\t\t\tdataPriv.access( doc, fix, attaches );\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\t} );\n}\nvar location = window.location;\n\nvar nonce = Date.now();\n\nvar rquery = ( /\\?/ );\n\n\n\n// Cross-browser xml parsing\njQuery.parseXML = function( data ) {\n\tvar xml;\n\tif ( !data || typeof data !== \"string\" ) {\n\t\treturn null;\n\t}\n\n\t// Support: IE 9 - 11 only\n\t// IE throws on parseFromString with invalid input.\n\ttry {\n\t\txml = ( new window.DOMParser() ).parseFromString( data, \"text/xml\" );\n\t} catch ( e ) {\n\t\txml = undefined;\n\t}\n\n\tif ( !xml || xml.getElementsByTagName( \"parsererror\" ).length ) {\n\t\tjQuery.error( \"Invalid XML: \" + data );\n\t}\n\treturn xml;\n};\n\n\nvar\n\trbracket = /\\[\\]$/,\n\trCRLF = /\\r?\\n/g,\n\trsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,\n\trsubmittable = /^(?:input|select|textarea|keygen)/i;\n\nfunction buildParams( prefix, obj, traditional, add ) {\n\tvar name;\n\n\tif ( Array.isArray( obj ) ) {\n\n\t\t// Serialize array item.\n\t\tjQuery.each( obj, function( i, v ) {\n\t\t\tif ( traditional || rbracket.test( prefix ) ) {\n\n\t\t\t\t// Treat each array item as a scalar.\n\t\t\t\tadd( prefix, v );\n\n\t\t\t} else {\n\n\t\t\t\t// Item is non-scalar (array or object), encode its numeric index.\n\t\t\t\tbuildParams(\n\t\t\t\t\tprefix + \"[\" + ( typeof v === \"object\" && v != null ? i : \"\" ) + \"]\",\n\t\t\t\t\tv,\n\t\t\t\t\ttraditional,\n\t\t\t\t\tadd\n\t\t\t\t);\n\t\t\t}\n\t\t} );\n\n\t} else if ( !traditional && toType( obj ) === \"object\" ) {\n\n\t\t// Serialize object item.\n\t\tfor ( name in obj ) {\n\t\t\tbuildParams( prefix + \"[\" + name + \"]\", obj[ name ], traditional, add );\n\t\t}\n\n\t} else {\n\n\t\t// Serialize scalar item.\n\t\tadd( prefix, obj );\n\t}\n}\n\n// Serialize an array of form elements or a set of\n// key/values into a query string\njQuery.param = function( a, traditional ) {\n\tvar prefix,\n\t\ts = [],\n\t\tadd = function( key, valueOrFunction ) {\n\n\t\t\t// If value is a function, invoke it and use its return value\n\t\t\tvar value = isFunction( valueOrFunction ) ?\n\t\t\t\tvalueOrFunction() :\n\t\t\t\tvalueOrFunction;\n\n\t\t\ts[ s.length ] = encodeURIComponent( key ) + \"=\" +\n\t\t\t\tencodeURIComponent( value == null ? \"\" : value );\n\t\t};\n\n\t// If an array was passed in, assume that it is an array of form elements.\n\tif ( Array.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {\n\n\t\t// Serialize the form elements\n\t\tjQuery.each( a, function() {\n\t\t\tadd( this.name, this.value );\n\t\t} );\n\n\t} else {\n\n\t\t// If traditional, encode the \"old\" way (the way 1.3.2 or older\n\t\t// did it), otherwise encode params recursively.\n\t\tfor ( prefix in a ) {\n\t\t\tbuildParams( prefix, a[ prefix ], traditional, add );\n\t\t}\n\t}\n\n\t// Return the resulting serialization\n\treturn s.join( \"&\" );\n};\n\njQuery.fn.extend( {\n\tserialize: function() {\n\t\treturn jQuery.param( this.serializeArray() );\n\t},\n\tserializeArray: function() {\n\t\treturn this.map( function() {\n\n\t\t\t// Can add propHook for \"elements\" to filter or add form elements\n\t\t\tvar elements = jQuery.prop( this, \"elements\" );\n\t\t\treturn elements ? jQuery.makeArray( elements ) : this;\n\t\t} )\n\t\t.filter( function() {\n\t\t\tvar type = this.type;\n\n\t\t\t// Use .is( \":disabled\" ) so that fieldset[disabled] works\n\t\t\treturn this.name && !jQuery( this ).is( \":disabled\" ) &&\n\t\t\t\trsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) &&\n\t\t\t\t( this.checked || !rcheckableType.test( type ) );\n\t\t} )\n\t\t.map( function( i, elem ) {\n\t\t\tvar val = jQuery( this ).val();\n\n\t\t\tif ( val == null ) {\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\tif ( Array.isArray( val ) ) {\n\t\t\t\treturn jQuery.map( val, function( val ) {\n\t\t\t\t\treturn { name: elem.name, value: val.replace( rCRLF, \"\\r\\n\" ) };\n\t\t\t\t} );\n\t\t\t}\n\n\t\t\treturn { name: elem.name, value: val.replace( rCRLF, \"\\r\\n\" ) };\n\t\t} ).get();\n\t}\n} );\n\n\nvar\n\tr20 = /%20/g,\n\trhash = /#.*$/,\n\trantiCache = /([?&])_=[^&]*/,\n\trheaders = /^(.*?):[ \\t]*([^\\r\\n]*)$/mg,\n\n\t// #7653, #8125, #8152: local protocol detection\n\trlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,\n\trnoContent = /^(?:GET|HEAD)$/,\n\trprotocol = /^\\/\\//,\n\n\t/* Prefilters\n\t * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)\n\t * 2) These are called:\n\t * - BEFORE asking for a transport\n\t * - AFTER param serialization (s.data is a string if s.processData is true)\n\t * 3) key is the dataType\n\t * 4) the catchall symbol \"*\" can be used\n\t * 5) execution will start with transport dataType and THEN continue down to \"*\" if needed\n\t */\n\tprefilters = {},\n\n\t/* Transports bindings\n\t * 1) key is the dataType\n\t * 2) the catchall symbol \"*\" can be used\n\t * 3) selection will start with transport dataType and THEN go to \"*\" if needed\n\t */\n\ttransports = {},\n\n\t// Avoid comment-prolog char sequence (#10098); must appease lint and evade compression\n\tallTypes = \"*/\".concat( \"*\" ),\n\n\t// Anchor tag for parsing the document origin\n\toriginAnchor = document.createElement( \"a\" );\n\toriginAnchor.href = location.href;\n\n// Base \"constructor\" for jQuery.ajaxPrefilter and jQuery.ajaxTransport\nfunction addToPrefiltersOrTransports( structure ) {\n\n\t// dataTypeExpression is optional and defaults to \"*\"\n\treturn function( dataTypeExpression, func ) {\n\n\t\tif ( typeof dataTypeExpression !== \"string\" ) {\n\t\t\tfunc = dataTypeExpression;\n\t\t\tdataTypeExpression = \"*\";\n\t\t}\n\n\t\tvar dataType,\n\t\t\ti = 0,\n\t\t\tdataTypes = dataTypeExpression.toLowerCase().match( rnothtmlwhite ) || [];\n\n\t\tif ( isFunction( func ) ) {\n\n\t\t\t// For each dataType in the dataTypeExpression\n\t\t\twhile ( ( dataType = dataTypes[ i++ ] ) ) {\n\n\t\t\t\t// Prepend if requested\n\t\t\t\tif ( dataType[ 0 ] === \"+\" ) {\n\t\t\t\t\tdataType = dataType.slice( 1 ) || \"*\";\n\t\t\t\t\t( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func );\n\n\t\t\t\t// Otherwise append\n\t\t\t\t} else {\n\t\t\t\t\t( structure[ dataType ] = structure[ dataType ] || [] ).push( func );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t};\n}\n\n// Base inspection function for prefilters and transports\nfunction inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) {\n\n\tvar inspected = {},\n\t\tseekingTransport = ( structure === transports );\n\n\tfunction inspect( dataType ) {\n\t\tvar selected;\n\t\tinspected[ dataType ] = true;\n\t\tjQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) {\n\t\t\tvar dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR );\n\t\t\tif ( typeof dataTypeOrTransport === \"string\" &&\n\t\t\t\t!seekingTransport && !inspected[ dataTypeOrTransport ] ) {\n\n\t\t\t\toptions.dataTypes.unshift( dataTypeOrTransport );\n\t\t\t\tinspect( dataTypeOrTransport );\n\t\t\t\treturn false;\n\t\t\t} else if ( seekingTransport ) {\n\t\t\t\treturn !( selected = dataTypeOrTransport );\n\t\t\t}\n\t\t} );\n\t\treturn selected;\n\t}\n\n\treturn inspect( options.dataTypes[ 0 ] ) || !inspected[ \"*\" ] && inspect( \"*\" );\n}\n\n// A special extend for ajax options\n// that takes \"flat\" options (not to be deep extended)\n// Fixes #9887\nfunction ajaxExtend( target, src ) {\n\tvar key, deep,\n\t\tflatOptions = jQuery.ajaxSettings.flatOptions || {};\n\n\tfor ( key in src ) {\n\t\tif ( src[ key ] !== undefined ) {\n\t\t\t( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ];\n\t\t}\n\t}\n\tif ( deep ) {\n\t\tjQuery.extend( true, target, deep );\n\t}\n\n\treturn target;\n}\n\n/* Handles responses to an ajax request:\n * - finds the right dataType (mediates between content-type and expected dataType)\n * - returns the corresponding response\n */\nfunction ajaxHandleResponses( s, jqXHR, responses ) {\n\n\tvar ct, type, finalDataType, firstDataType,\n\t\tcontents = s.contents,\n\t\tdataTypes = s.dataTypes;\n\n\t// Remove auto dataType and get content-type in the process\n\twhile ( dataTypes[ 0 ] === \"*\" ) {\n\t\tdataTypes.shift();\n\t\tif ( ct === undefined ) {\n\t\t\tct = s.mimeType || jqXHR.getResponseHeader( \"Content-Type\" );\n\t\t}\n\t}\n\n\t// Check if we're dealing with a known content-type\n\tif ( ct ) {\n\t\tfor ( type in contents ) {\n\t\t\tif ( contents[ type ] && contents[ type ].test( ct ) ) {\n\t\t\t\tdataTypes.unshift( type );\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\t// Check to see if we have a response for the expected dataType\n\tif ( dataTypes[ 0 ] in responses ) {\n\t\tfinalDataType = dataTypes[ 0 ];\n\t} else {\n\n\t\t// Try convertible dataTypes\n\t\tfor ( type in responses ) {\n\t\t\tif ( !dataTypes[ 0 ] || s.converters[ type + \" \" + dataTypes[ 0 ] ] ) {\n\t\t\t\tfinalDataType = type;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif ( !firstDataType ) {\n\t\t\t\tfirstDataType = type;\n\t\t\t}\n\t\t}\n\n\t\t// Or just use first one\n\t\tfinalDataType = finalDataType || firstDataType;\n\t}\n\n\t// If we found a dataType\n\t// We add the dataType to the list if needed\n\t// and return the corresponding response\n\tif ( finalDataType ) {\n\t\tif ( finalDataType !== dataTypes[ 0 ] ) {\n\t\t\tdataTypes.unshift( finalDataType );\n\t\t}\n\t\treturn responses[ finalDataType ];\n\t}\n}\n\n/* Chain conversions given the request and the original response\n * Also sets the responseXXX fields on the jqXHR instance\n */\nfunction ajaxConvert( s, response, jqXHR, isSuccess ) {\n\tvar conv2, current, conv, tmp, prev,\n\t\tconverters = {},\n\n\t\t// Work with a copy of dataTypes in case we need to modify it for conversion\n\t\tdataTypes = s.dataTypes.slice();\n\n\t// Create converters map with lowercased keys\n\tif ( dataTypes[ 1 ] ) {\n\t\tfor ( conv in s.converters ) {\n\t\t\tconverters[ conv.toLowerCase() ] = s.converters[ conv ];\n\t\t}\n\t}\n\n\tcurrent = dataTypes.shift();\n\n\t// Convert to each sequential dataType\n\twhile ( current ) {\n\n\t\tif ( s.responseFields[ current ] ) {\n\t\t\tjqXHR[ s.responseFields[ current ] ] = response;\n\t\t}\n\n\t\t// Apply the dataFilter if provided\n\t\tif ( !prev && isSuccess && s.dataFilter ) {\n\t\t\tresponse = s.dataFilter( response, s.dataType );\n\t\t}\n\n\t\tprev = current;\n\t\tcurrent = dataTypes.shift();\n\n\t\tif ( current ) {\n\n\t\t\t// There's only work to do if current dataType is non-auto\n\t\t\tif ( current === \"*\" ) {\n\n\t\t\t\tcurrent = prev;\n\n\t\t\t// Convert response if prev dataType is non-auto and differs from current\n\t\t\t} else if ( prev !== \"*\" && prev !== current ) {\n\n\t\t\t\t// Seek a direct converter\n\t\t\t\tconv = converters[ prev + \" \" + current ] || converters[ \"* \" + current ];\n\n\t\t\t\t// If none found, seek a pair\n\t\t\t\tif ( !conv ) {\n\t\t\t\t\tfor ( conv2 in converters ) {\n\n\t\t\t\t\t\t// If conv2 outputs current\n\t\t\t\t\t\ttmp = conv2.split( \" \" );\n\t\t\t\t\t\tif ( tmp[ 1 ] === current ) {\n\n\t\t\t\t\t\t\t// If prev can be converted to accepted input\n\t\t\t\t\t\t\tconv = converters[ prev + \" \" + tmp[ 0 ] ] ||\n\t\t\t\t\t\t\t\tconverters[ \"* \" + tmp[ 0 ] ];\n\t\t\t\t\t\t\tif ( conv ) {\n\n\t\t\t\t\t\t\t\t// Condense equivalence converters\n\t\t\t\t\t\t\t\tif ( conv === true ) {\n\t\t\t\t\t\t\t\t\tconv = converters[ conv2 ];\n\n\t\t\t\t\t\t\t\t// Otherwise, insert the intermediate dataType\n\t\t\t\t\t\t\t\t} else if ( converters[ conv2 ] !== true ) {\n\t\t\t\t\t\t\t\t\tcurrent = tmp[ 0 ];\n\t\t\t\t\t\t\t\t\tdataTypes.unshift( tmp[ 1 ] );\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// Apply converter (if not an equivalence)\n\t\t\t\tif ( conv !== true ) {\n\n\t\t\t\t\t// Unless errors are allowed to bubble, catch and return them\n\t\t\t\t\tif ( conv && s.throws ) {\n\t\t\t\t\t\tresponse = conv( response );\n\t\t\t\t\t} else {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tresponse = conv( response );\n\t\t\t\t\t\t} catch ( e ) {\n\t\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t\tstate: \"parsererror\",\n\t\t\t\t\t\t\t\terror: conv ? e : \"No conversion from \" + prev + \" to \" + current\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn { state: \"success\", data: response };\n}\n\njQuery.extend( {\n\n\t// Counter for holding the number of active queries\n\tactive: 0,\n\n\t// Last-Modified header cache for next request\n\tlastModified: {},\n\tetag: {},\n\n\tajaxSettings: {\n\t\turl: location.href,\n\t\ttype: \"GET\",\n\t\tisLocal: rlocalProtocol.test( location.protocol ),\n\t\tglobal: true,\n\t\tprocessData: true,\n\t\tasync: true,\n\t\tcontentType: \"application/x-www-form-urlencoded; charset=UTF-8\",\n\n\t\t/*\n\t\ttimeout: 0,\n\t\tdata: null,\n\t\tdataType: null,\n\t\tusername: null,\n\t\tpassword: null,\n\t\tcache: null,\n\t\tthrows: false,\n\t\ttraditional: false,\n\t\theaders: {},\n\t\t*/\n\n\t\taccepts: {\n\t\t\t\"*\": allTypes,\n\t\t\ttext: \"text/plain\",\n\t\t\thtml: \"text/html\",\n\t\t\txml: \"application/xml, text/xml\",\n\t\t\tjson: \"application/json, text/javascript\"\n\t\t},\n\n\t\tcontents: {\n\t\t\txml: /\\bxml\\b/,\n\t\t\thtml: /\\bhtml/,\n\t\t\tjson: /\\bjson\\b/\n\t\t},\n\n\t\tresponseFields: {\n\t\t\txml: \"responseXML\",\n\t\t\ttext: \"responseText\",\n\t\t\tjson: \"responseJSON\"\n\t\t},\n\n\t\t// Data converters\n\t\t// Keys separate source (or catchall \"*\") and destination types with a single space\n\t\tconverters: {\n\n\t\t\t// Convert anything to text\n\t\t\t\"* text\": String,\n\n\t\t\t// Text to html (true = no transformation)\n\t\t\t\"text html\": true,\n\n\t\t\t// Evaluate text as a json expression\n\t\t\t\"text json\": JSON.parse,\n\n\t\t\t// Parse text as xml\n\t\t\t\"text xml\": jQuery.parseXML\n\t\t},\n\n\t\t// For options that shouldn't be deep extended:\n\t\t// you can add your own custom options here if\n\t\t// and when you create one that shouldn't be\n\t\t// deep extended (see ajaxExtend)\n\t\tflatOptions: {\n\t\t\turl: true,\n\t\t\tcontext: true\n\t\t}\n\t},\n\n\t// Creates a full fledged settings object into target\n\t// with both ajaxSettings and settings fields.\n\t// If target is omitted, writes into ajaxSettings.\n\tajaxSetup: function( target, settings ) {\n\t\treturn settings ?\n\n\t\t\t// Building a settings object\n\t\t\tajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) :\n\n\t\t\t// Extending ajaxSettings\n\t\t\tajaxExtend( jQuery.ajaxSettings, target );\n\t},\n\n\tajaxPrefilter: addToPrefiltersOrTransports( prefilters ),\n\tajaxTransport: addToPrefiltersOrTransports( transports ),\n\n\t// Main method\n\tajax: function( url, options ) {\n\n\t\t// If url is an object, simulate pre-1.5 signature\n\t\tif ( typeof url === \"object\" ) {\n\t\t\toptions = url;\n\t\t\turl = undefined;\n\t\t}\n\n\t\t// Force options to be an object\n\t\toptions = options || {};\n\n\t\tvar transport,\n\n\t\t\t// URL without anti-cache param\n\t\t\tcacheURL,\n\n\t\t\t// Response headers\n\t\t\tresponseHeadersString,\n\t\t\tresponseHeaders,\n\n\t\t\t// timeout handle\n\t\t\ttimeoutTimer,\n\n\t\t\t// Url cleanup var\n\t\t\turlAnchor,\n\n\t\t\t// Request state (becomes false upon send and true upon completion)\n\t\t\tcompleted,\n\n\t\t\t// To know if global events are to be dispatched\n\t\t\tfireGlobals,\n\n\t\t\t// Loop variable\n\t\t\ti,\n\n\t\t\t// uncached part of the url\n\t\t\tuncached,\n\n\t\t\t// Create the final options object\n\t\t\ts = jQuery.ajaxSetup( {}, options ),\n\n\t\t\t// Callbacks context\n\t\t\tcallbackContext = s.context || s,\n\n\t\t\t// Context for global events is callbackContext if it is a DOM node or jQuery collection\n\t\t\tglobalEventContext = s.context &&\n\t\t\t\t( callbackContext.nodeType || callbackContext.jquery ) ?\n\t\t\t\t\tjQuery( callbackContext ) :\n\t\t\t\t\tjQuery.event,\n\n\t\t\t// Deferreds\n\t\t\tdeferred = jQuery.Deferred(),\n\t\t\tcompleteDeferred = jQuery.Callbacks( \"once memory\" ),\n\n\t\t\t// Status-dependent callbacks\n\t\t\tstatusCode = s.statusCode || {},\n\n\t\t\t// Headers (they are sent all at once)\n\t\t\trequestHeaders = {},\n\t\t\trequestHeadersNames = {},\n\n\t\t\t// Default abort message\n\t\t\tstrAbort = \"canceled\",\n\n\t\t\t// Fake xhr\n\t\t\tjqXHR = {\n\t\t\t\treadyState: 0,\n\n\t\t\t\t// Builds headers hashtable if needed\n\t\t\t\tgetResponseHeader: function( key ) {\n\t\t\t\t\tvar match;\n\t\t\t\t\tif ( completed ) {\n\t\t\t\t\t\tif ( !responseHeaders ) {\n\t\t\t\t\t\t\tresponseHeaders = {};\n\t\t\t\t\t\t\twhile ( ( match = rheaders.exec( responseHeadersString ) ) ) {\n\t\t\t\t\t\t\t\tresponseHeaders[ match[ 1 ].toLowerCase() ] = match[ 2 ];\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tmatch = responseHeaders[ key.toLowerCase() ];\n\t\t\t\t\t}\n\t\t\t\t\treturn match == null ? null : match;\n\t\t\t\t},\n\n\t\t\t\t// Raw string\n\t\t\t\tgetAllResponseHeaders: function() {\n\t\t\t\t\treturn completed ? responseHeadersString : null;\n\t\t\t\t},\n\n\t\t\t\t// Caches the header\n\t\t\t\tsetRequestHeader: function( name, value ) {\n\t\t\t\t\tif ( completed == null ) {\n\t\t\t\t\t\tname = requestHeadersNames[ name.toLowerCase() ] =\n\t\t\t\t\t\t\trequestHeadersNames[ name.toLowerCase() ] || name;\n\t\t\t\t\t\trequestHeaders[ name ] = value;\n\t\t\t\t\t}\n\t\t\t\t\treturn this;\n\t\t\t\t},\n\n\t\t\t\t// Overrides response content-type header\n\t\t\t\toverrideMimeType: function( type ) {\n\t\t\t\t\tif ( completed == null ) {\n\t\t\t\t\t\ts.mimeType = type;\n\t\t\t\t\t}\n\t\t\t\t\treturn this;\n\t\t\t\t},\n\n\t\t\t\t// Status-dependent callbacks\n\t\t\t\tstatusCode: function( map ) {\n\t\t\t\t\tvar code;\n\t\t\t\t\tif ( map ) {\n\t\t\t\t\t\tif ( completed ) {\n\n\t\t\t\t\t\t\t// Execute the appropriate callbacks\n\t\t\t\t\t\t\tjqXHR.always( map[ jqXHR.status ] );\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t// Lazy-add the new callbacks in a way that preserves old ones\n\t\t\t\t\t\t\tfor ( code in map ) {\n\t\t\t\t\t\t\t\tstatusCode[ code ] = [ statusCode[ code ], map[ code ] ];\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\treturn this;\n\t\t\t\t},\n\n\t\t\t\t// Cancel the request\n\t\t\t\tabort: function( statusText ) {\n\t\t\t\t\tvar finalText = statusText || strAbort;\n\t\t\t\t\tif ( transport ) {\n\t\t\t\t\t\ttransport.abort( finalText );\n\t\t\t\t\t}\n\t\t\t\t\tdone( 0, finalText );\n\t\t\t\t\treturn this;\n\t\t\t\t}\n\t\t\t};\n\n\t\t// Attach deferreds\n\t\tdeferred.promise( jqXHR );\n\n\t\t// Add protocol if not provided (prefilters might expect it)\n\t\t// Handle falsy url in the settings object (#10093: consistency with old signature)\n\t\t// We also use the url parameter if available\n\t\ts.url = ( ( url || s.url || location.href ) + \"\" )\n\t\t\t.replace( rprotocol, location.protocol + \"//\" );\n\n\t\t// Alias method option to type as per ticket #12004\n\t\ts.type = options.method || options.type || s.method || s.type;\n\n\t\t// Extract dataTypes list\n\t\ts.dataTypes = ( s.dataType || \"*\" ).toLowerCase().match( rnothtmlwhite ) || [ \"\" ];\n\n\t\t// A cross-domain request is in order when the origin doesn't match the current origin.\n\t\tif ( s.crossDomain == null ) {\n\t\t\turlAnchor = document.createElement( \"a\" );\n\n\t\t\t// Support: IE <=8 - 11, Edge 12 - 15\n\t\t\t// IE throws exception on accessing the href property if url is malformed,\n\t\t\t// e.g. http://example.com:80x/\n\t\t\ttry {\n\t\t\t\turlAnchor.href = s.url;\n\n\t\t\t\t// Support: IE <=8 - 11 only\n\t\t\t\t// Anchor's host property isn't correctly set when s.url is relative\n\t\t\t\turlAnchor.href = urlAnchor.href;\n\t\t\t\ts.crossDomain = originAnchor.protocol + \"//\" + originAnchor.host !==\n\t\t\t\t\turlAnchor.protocol + \"//\" + urlAnchor.host;\n\t\t\t} catch ( e ) {\n\n\t\t\t\t// If there is an error parsing the URL, assume it is crossDomain,\n\t\t\t\t// it can be rejected by the transport if it is invalid\n\t\t\t\ts.crossDomain = true;\n\t\t\t}\n\t\t}\n\n\t\t// Convert data if not already a string\n\t\tif ( s.data && s.processData && typeof s.data !== \"string\" ) {\n\t\t\ts.data = jQuery.param( s.data, s.traditional );\n\t\t}\n\n\t\t// Apply prefilters\n\t\tinspectPrefiltersOrTransports( prefilters, s, options, jqXHR );\n\n\t\t// If request was aborted inside a prefilter, stop there\n\t\tif ( completed ) {\n\t\t\treturn jqXHR;\n\t\t}\n\n\t\t// We can fire global events as of now if asked to\n\t\t// Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118)\n\t\tfireGlobals = jQuery.event && s.global;\n\n\t\t// Watch for a new set of requests\n\t\tif ( fireGlobals && jQuery.active++ === 0 ) {\n\t\t\tjQuery.event.trigger( \"ajaxStart\" );\n\t\t}\n\n\t\t// Uppercase the type\n\t\ts.type = s.type.toUpperCase();\n\n\t\t// Determine if request has content\n\t\ts.hasContent = !rnoContent.test( s.type );\n\n\t\t// Save the URL in case we're toying with the If-Modified-Since\n\t\t// and/or If-None-Match header later on\n\t\t// Remove hash to simplify url manipulation\n\t\tcacheURL = s.url.replace( rhash, \"\" );\n\n\t\t// More options handling for requests with no content\n\t\tif ( !s.hasContent ) {\n\n\t\t\t// Remember the hash so we can put it back\n\t\t\tuncached = s.url.slice( cacheURL.length );\n\n\t\t\t// If data is available and should be processed, append data to url\n\t\t\tif ( s.data && ( s.processData || typeof s.data === \"string\" ) ) {\n\t\t\t\tcacheURL += ( rquery.test( cacheURL ) ? \"&\" : \"?\" ) + s.data;\n\n\t\t\t\t// #9682: remove data so that it's not used in an eventual retry\n\t\t\t\tdelete s.data;\n\t\t\t}\n\n\t\t\t// Add or update anti-cache param if needed\n\t\t\tif ( s.cache === false ) {\n\t\t\t\tcacheURL = cacheURL.replace( rantiCache, \"$1\" );\n\t\t\t\tuncached = ( rquery.test( cacheURL ) ? \"&\" : \"?\" ) + \"_=\" + ( nonce++ ) + uncached;\n\t\t\t}\n\n\t\t\t// Put hash and anti-cache on the URL that will be requested (gh-1732)\n\t\t\ts.url = cacheURL + uncached;\n\n\t\t// Change '%20' to '+' if this is encoded form body content (gh-2658)\n\t\t} else if ( s.data && s.processData &&\n\t\t\t( s.contentType || \"\" ).indexOf( \"application/x-www-form-urlencoded\" ) === 0 ) {\n\t\t\ts.data = s.data.replace( r20, \"+\" );\n\t\t}\n\n\t\t// Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.\n\t\tif ( s.ifModified ) {\n\t\t\tif ( jQuery.lastModified[ cacheURL ] ) {\n\t\t\t\tjqXHR.setRequestHeader( \"If-Modified-Since\", jQuery.lastModified[ cacheURL ] );\n\t\t\t}\n\t\t\tif ( jQuery.etag[ cacheURL ] ) {\n\t\t\t\tjqXHR.setRequestHeader( \"If-None-Match\", jQuery.etag[ cacheURL ] );\n\t\t\t}\n\t\t}\n\n\t\t// Set the correct header, if data is being sent\n\t\tif ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {\n\t\t\tjqXHR.setRequestHeader( \"Content-Type\", s.contentType );\n\t\t}\n\n\t\t// Set the Accepts header for the server, depending on the dataType\n\t\tjqXHR.setRequestHeader(\n\t\t\t\"Accept\",\n\t\t\ts.dataTypes[ 0 ] && s.accepts[ s.dataTypes[ 0 ] ] ?\n\t\t\t\ts.accepts[ s.dataTypes[ 0 ] ] +\n\t\t\t\t\t( s.dataTypes[ 0 ] !== \"*\" ? \", \" + allTypes + \"; q=0.01\" : \"\" ) :\n\t\t\t\ts.accepts[ \"*\" ]\n\t\t);\n\n\t\t// Check for headers option\n\t\tfor ( i in s.headers ) {\n\t\t\tjqXHR.setRequestHeader( i, s.headers[ i ] );\n\t\t}\n\n\t\t// Allow custom headers/mimetypes and early abort\n\t\tif ( s.beforeSend &&\n\t\t\t( s.beforeSend.call( callbackContext, jqXHR, s ) === false || completed ) ) {\n\n\t\t\t// Abort if not done already and return\n\t\t\treturn jqXHR.abort();\n\t\t}\n\n\t\t// Aborting is no longer a cancellation\n\t\tstrAbort = \"abort\";\n\n\t\t// Install callbacks on deferreds\n\t\tcompleteDeferred.add( s.complete );\n\t\tjqXHR.done( s.success );\n\t\tjqXHR.fail( s.error );\n\n\t\t// Get transport\n\t\ttransport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );\n\n\t\t// If no transport, we auto-abort\n\t\tif ( !transport ) {\n\t\t\tdone( -1, \"No Transport\" );\n\t\t} else {\n\t\t\tjqXHR.readyState = 1;\n\n\t\t\t// Send global event\n\t\t\tif ( fireGlobals ) {\n\t\t\t\tglobalEventContext.trigger( \"ajaxSend\", [ jqXHR, s ] );\n\t\t\t}\n\n\t\t\t// If request was aborted inside ajaxSend, stop there\n\t\t\tif ( completed ) {\n\t\t\t\treturn jqXHR;\n\t\t\t}\n\n\t\t\t// Timeout\n\t\t\tif ( s.async && s.timeout > 0 ) {\n\t\t\t\ttimeoutTimer = window.setTimeout( function() {\n\t\t\t\t\tjqXHR.abort( \"timeout\" );\n\t\t\t\t}, s.timeout );\n\t\t\t}\n\n\t\t\ttry {\n\t\t\t\tcompleted = false;\n\t\t\t\ttransport.send( requestHeaders, done );\n\t\t\t} catch ( e ) {\n\n\t\t\t\t// Rethrow post-completion exceptions\n\t\t\t\tif ( completed ) {\n\t\t\t\t\tthrow e;\n\t\t\t\t}\n\n\t\t\t\t// Propagate others as results\n\t\t\t\tdone( -1, e );\n\t\t\t}\n\t\t}\n\n\t\t// Callback for when everything is done\n\t\tfunction done( status, nativeStatusText, responses, headers ) {\n\t\t\tvar isSuccess, success, error, response, modified,\n\t\t\t\tstatusText = nativeStatusText;\n\n\t\t\t// Ignore repeat invocations\n\t\t\tif ( completed ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tcompleted = true;\n\n\t\t\t// Clear timeout if it exists\n\t\t\tif ( timeoutTimer ) {\n\t\t\t\twindow.clearTimeout( timeoutTimer );\n\t\t\t}\n\n\t\t\t// Dereference transport for early garbage collection\n\t\t\t// (no matter how long the jqXHR object will be used)\n\t\t\ttransport = undefined;\n\n\t\t\t// Cache response headers\n\t\t\tresponseHeadersString = headers || \"\";\n\n\t\t\t// Set readyState\n\t\t\tjqXHR.readyState = status > 0 ? 4 : 0;\n\n\t\t\t// Determine if successful\n\t\t\tisSuccess = status >= 200 && status < 300 || status === 304;\n\n\t\t\t// Get response data\n\t\t\tif ( responses ) {\n\t\t\t\tresponse = ajaxHandleResponses( s, jqXHR, responses );\n\t\t\t}\n\n\t\t\t// Convert no matter what (that way responseXXX fields are always set)\n\t\t\tresponse = ajaxConvert( s, response, jqXHR, isSuccess );\n\n\t\t\t// If successful, handle type chaining\n\t\t\tif ( isSuccess ) {\n\n\t\t\t\t// Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.\n\t\t\t\tif ( s.ifModified ) {\n\t\t\t\t\tmodified = jqXHR.getResponseHeader( \"Last-Modified\" );\n\t\t\t\t\tif ( modified ) {\n\t\t\t\t\t\tjQuery.lastModified[ cacheURL ] = modified;\n\t\t\t\t\t}\n\t\t\t\t\tmodified = jqXHR.getResponseHeader( \"etag\" );\n\t\t\t\t\tif ( modified ) {\n\t\t\t\t\t\tjQuery.etag[ cacheURL ] = modified;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// if no content\n\t\t\t\tif ( status === 204 || s.type === \"HEAD\" ) {\n\t\t\t\t\tstatusText = \"nocontent\";\n\n\t\t\t\t// if not modified\n\t\t\t\t} else if ( status === 304 ) {\n\t\t\t\t\tstatusText = \"notmodified\";\n\n\t\t\t\t// If we have data, let's convert it\n\t\t\t\t} else {\n\t\t\t\t\tstatusText = response.state;\n\t\t\t\t\tsuccess = response.data;\n\t\t\t\t\terror = response.error;\n\t\t\t\t\tisSuccess = !error;\n\t\t\t\t}\n\t\t\t} else {\n\n\t\t\t\t// Extract error from statusText and normalize for non-aborts\n\t\t\t\terror = statusText;\n\t\t\t\tif ( status || !statusText ) {\n\t\t\t\t\tstatusText = \"error\";\n\t\t\t\t\tif ( status < 0 ) {\n\t\t\t\t\t\tstatus = 0;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Set data for the fake xhr object\n\t\t\tjqXHR.status = status;\n\t\t\tjqXHR.statusText = ( nativeStatusText || statusText ) + \"\";\n\n\t\t\t// Success/Error\n\t\t\tif ( isSuccess ) {\n\t\t\t\tdeferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );\n\t\t\t} else {\n\t\t\t\tdeferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );\n\t\t\t}\n\n\t\t\t// Status-dependent callbacks\n\t\t\tjqXHR.statusCode( statusCode );\n\t\t\tstatusCode = undefined;\n\n\t\t\tif ( fireGlobals ) {\n\t\t\t\tglobalEventContext.trigger( isSuccess ? \"ajaxSuccess\" : \"ajaxError\",\n\t\t\t\t\t[ jqXHR, s, isSuccess ? success : error ] );\n\t\t\t}\n\n\t\t\t// Complete\n\t\t\tcompleteDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );\n\n\t\t\tif ( fireGlobals ) {\n\t\t\t\tglobalEventContext.trigger( \"ajaxComplete\", [ jqXHR, s ] );\n\n\t\t\t\t// Handle the global AJAX counter\n\t\t\t\tif ( !( --jQuery.active ) ) {\n\t\t\t\t\tjQuery.event.trigger( \"ajaxStop\" );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn jqXHR;\n\t},\n\n\tgetJSON: function( url, data, callback ) {\n\t\treturn jQuery.get( url, data, callback, \"json\" );\n\t},\n\n\tgetScript: function( url, callback ) {\n\t\treturn jQuery.get( url, undefined, callback, \"script\" );\n\t}\n} );\n\njQuery.each( [ \"get\", \"post\" ], function( i, method ) {\n\tjQuery[ method ] = function( url, data, callback, type ) {\n\n\t\t// Shift arguments if data argument was omitted\n\t\tif ( isFunction( data ) ) {\n\t\t\ttype = type || callback;\n\t\t\tcallback = data;\n\t\t\tdata = undefined;\n\t\t}\n\n\t\t// The url can be an options object (which then must have .url)\n\t\treturn jQuery.ajax( jQuery.extend( {\n\t\t\turl: url,\n\t\t\ttype: method,\n\t\t\tdataType: type,\n\t\t\tdata: data,\n\t\t\tsuccess: callback\n\t\t}, jQuery.isPlainObject( url ) && url ) );\n\t};\n} );\n\n\njQuery._evalUrl = function( url ) {\n\treturn jQuery.ajax( {\n\t\turl: url,\n\n\t\t// Make this explicit, since user can override this through ajaxSetup (#11264)\n\t\ttype: \"GET\",\n\t\tdataType: \"script\",\n\t\tcache: true,\n\t\tasync: false,\n\t\tglobal: false,\n\t\t\"throws\": true\n\t} );\n};\n\n\njQuery.fn.extend( {\n\twrapAll: function( html ) {\n\t\tvar wrap;\n\n\t\tif ( this[ 0 ] ) {\n\t\t\tif ( isFunction( html ) ) {\n\t\t\t\thtml = html.call( this[ 0 ] );\n\t\t\t}\n\n\t\t\t// The elements to wrap the target around\n\t\t\twrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true );\n\n\t\t\tif ( this[ 0 ].parentNode ) {\n\t\t\t\twrap.insertBefore( this[ 0 ] );\n\t\t\t}\n\n\t\t\twrap.map( function() {\n\t\t\t\tvar elem = this;\n\n\t\t\t\twhile ( elem.firstElementChild ) {\n\t\t\t\t\telem = elem.firstElementChild;\n\t\t\t\t}\n\n\t\t\t\treturn elem;\n\t\t\t} ).append( this );\n\t\t}\n\n\t\treturn this;\n\t},\n\n\twrapInner: function( html ) {\n\t\tif ( isFunction( html ) ) {\n\t\t\treturn this.each( function( i ) {\n\t\t\t\tjQuery( this ).wrapInner( html.call( this, i ) );\n\t\t\t} );\n\t\t}\n\n\t\treturn this.each( function() {\n\t\t\tvar self = jQuery( this ),\n\t\t\t\tcontents = self.contents();\n\n\t\t\tif ( contents.length ) {\n\t\t\t\tcontents.wrapAll( html );\n\n\t\t\t} else {\n\t\t\t\tself.append( html );\n\t\t\t}\n\t\t} );\n\t},\n\n\twrap: function( html ) {\n\t\tvar htmlIsFunction = isFunction( html );\n\n\t\treturn this.each( function( i ) {\n\t\t\tjQuery( this ).wrapAll( htmlIsFunction ? html.call( this, i ) : html );\n\t\t} );\n\t},\n\n\tunwrap: function( selector ) {\n\t\tthis.parent( selector ).not( \"body\" ).each( function() {\n\t\t\tjQuery( this ).replaceWith( this.childNodes );\n\t\t} );\n\t\treturn this;\n\t}\n} );\n\n\njQuery.expr.pseudos.hidden = function( elem ) {\n\treturn !jQuery.expr.pseudos.visible( elem );\n};\njQuery.expr.pseudos.visible = function( elem ) {\n\treturn !!( elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length );\n};\n\n\n\n\njQuery.ajaxSettings.xhr = function() {\n\ttry {\n\t\treturn new window.XMLHttpRequest();\n\t} catch ( e ) {}\n};\n\nvar xhrSuccessStatus = {\n\n\t\t// File protocol always yields status code 0, assume 200\n\t\t0: 200,\n\n\t\t// Support: IE <=9 only\n\t\t// #1450: sometimes IE returns 1223 when it should be 204\n\t\t1223: 204\n\t},\n\txhrSupported = jQuery.ajaxSettings.xhr();\n\nsupport.cors = !!xhrSupported && ( \"withCredentials\" in xhrSupported );\nsupport.ajax = xhrSupported = !!xhrSupported;\n\njQuery.ajaxTransport( function( options ) {\n\tvar callback, errorCallback;\n\n\t// Cross domain only allowed if supported through XMLHttpRequest\n\tif ( support.cors || xhrSupported && !options.crossDomain ) {\n\t\treturn {\n\t\t\tsend: function( headers, complete ) {\n\t\t\t\tvar i,\n\t\t\t\t\txhr = options.xhr();\n\n\t\t\t\txhr.open(\n\t\t\t\t\toptions.type,\n\t\t\t\t\toptions.url,\n\t\t\t\t\toptions.async,\n\t\t\t\t\toptions.username,\n\t\t\t\t\toptions.password\n\t\t\t\t);\n\n\t\t\t\t// Apply custom fields if provided\n\t\t\t\tif ( options.xhrFields ) {\n\t\t\t\t\tfor ( i in options.xhrFields ) {\n\t\t\t\t\t\txhr[ i ] = options.xhrFields[ i ];\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// Override mime type if needed\n\t\t\t\tif ( options.mimeType && xhr.overrideMimeType ) {\n\t\t\t\t\txhr.overrideMimeType( options.mimeType );\n\t\t\t\t}\n\n\t\t\t\t// X-Requested-With header\n\t\t\t\t// For cross-domain requests, seeing as conditions for a preflight are\n\t\t\t\t// akin to a jigsaw puzzle, we simply never set it to be sure.\n\t\t\t\t// (it can always be set on a per-request basis or even using ajaxSetup)\n\t\t\t\t// For same-domain requests, won't change header if already provided.\n\t\t\t\tif ( !options.crossDomain && !headers[ \"X-Requested-With\" ] ) {\n\t\t\t\t\theaders[ \"X-Requested-With\" ] = \"XMLHttpRequest\";\n\t\t\t\t}\n\n\t\t\t\t// Set headers\n\t\t\t\tfor ( i in headers ) {\n\t\t\t\t\txhr.setRequestHeader( i, headers[ i ] );\n\t\t\t\t}\n\n\t\t\t\t// Callback\n\t\t\t\tcallback = function( type ) {\n\t\t\t\t\treturn function() {\n\t\t\t\t\t\tif ( callback ) {\n\t\t\t\t\t\t\tcallback = errorCallback = xhr.onload =\n\t\t\t\t\t\t\t\txhr.onerror = xhr.onabort = xhr.ontimeout =\n\t\t\t\t\t\t\t\t\txhr.onreadystatechange = null;\n\n\t\t\t\t\t\t\tif ( type === \"abort\" ) {\n\t\t\t\t\t\t\t\txhr.abort();\n\t\t\t\t\t\t\t} else if ( type === \"error\" ) {\n\n\t\t\t\t\t\t\t\t// Support: IE <=9 only\n\t\t\t\t\t\t\t\t// On a manual native abort, IE9 throws\n\t\t\t\t\t\t\t\t// errors on any property access that is not readyState\n\t\t\t\t\t\t\t\tif ( typeof xhr.status !== \"number\" ) {\n\t\t\t\t\t\t\t\t\tcomplete( 0, \"error\" );\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tcomplete(\n\n\t\t\t\t\t\t\t\t\t\t// File: protocol always yields status 0; see #8605, #14207\n\t\t\t\t\t\t\t\t\t\txhr.status,\n\t\t\t\t\t\t\t\t\t\txhr.statusText\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tcomplete(\n\t\t\t\t\t\t\t\t\txhrSuccessStatus[ xhr.status ] || xhr.status,\n\t\t\t\t\t\t\t\t\txhr.statusText,\n\n\t\t\t\t\t\t\t\t\t// Support: IE <=9 only\n\t\t\t\t\t\t\t\t\t// IE9 has no XHR2 but throws on binary (trac-11426)\n\t\t\t\t\t\t\t\t\t// For XHR2 non-text, let the caller handle it (gh-2498)\n\t\t\t\t\t\t\t\t\t( xhr.responseType || \"text\" ) !== \"text\" ||\n\t\t\t\t\t\t\t\t\ttypeof xhr.responseText !== \"string\" ?\n\t\t\t\t\t\t\t\t\t\t{ binary: xhr.response } :\n\t\t\t\t\t\t\t\t\t\t{ text: xhr.responseText },\n\t\t\t\t\t\t\t\t\txhr.getAllResponseHeaders()\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t};\n\t\t\t\t};\n\n\t\t\t\t// Listen to events\n\t\t\t\txhr.onload = callback();\n\t\t\t\terrorCallback = xhr.onerror = xhr.ontimeout = callback( \"error\" );\n\n\t\t\t\t// Support: IE 9 only\n\t\t\t\t// Use onreadystatechange to replace onabort\n\t\t\t\t// to handle uncaught aborts\n\t\t\t\tif ( xhr.onabort !== undefined ) {\n\t\t\t\t\txhr.onabort = errorCallback;\n\t\t\t\t} else {\n\t\t\t\t\txhr.onreadystatechange = function() {\n\n\t\t\t\t\t\t// Check readyState before timeout as it changes\n\t\t\t\t\t\tif ( xhr.readyState === 4 ) {\n\n\t\t\t\t\t\t\t// Allow onerror to be called first,\n\t\t\t\t\t\t\t// but that will not handle a native abort\n\t\t\t\t\t\t\t// Also, save errorCallback to a variable\n\t\t\t\t\t\t\t// as xhr.onerror cannot be accessed\n\t\t\t\t\t\t\twindow.setTimeout( function() {\n\t\t\t\t\t\t\t\tif ( callback ) {\n\t\t\t\t\t\t\t\t\terrorCallback();\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t}\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\t// Create the abort callback\n\t\t\t\tcallback = callback( \"abort\" );\n\n\t\t\t\ttry {\n\n\t\t\t\t\t// Do send the request (this may raise an exception)\n\t\t\t\t\txhr.send( options.hasContent && options.data || null );\n\t\t\t\t} catch ( e ) {\n\n\t\t\t\t\t// #14683: Only rethrow if this hasn't been notified as an error yet\n\t\t\t\t\tif ( callback ) {\n\t\t\t\t\t\tthrow e;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t},\n\n\t\t\tabort: function() {\n\t\t\t\tif ( callback ) {\n\t\t\t\t\tcallback();\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\t}\n} );\n\n\n\n\n// Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432)\njQuery.ajaxPrefilter( function( s ) {\n\tif ( s.crossDomain ) {\n\t\ts.contents.script = false;\n\t}\n} );\n\n// Install script dataType\njQuery.ajaxSetup( {\n\taccepts: {\n\t\tscript: \"text/javascript, application/javascript, \" +\n\t\t\t\"application/ecmascript, application/x-ecmascript\"\n\t},\n\tcontents: {\n\t\tscript: /\\b(?:java|ecma)script\\b/\n\t},\n\tconverters: {\n\t\t\"text script\": function( text ) {\n\t\t\tjQuery.globalEval( text );\n\t\t\treturn text;\n\t\t}\n\t}\n} );\n\n// Handle cache's special case and crossDomain\njQuery.ajaxPrefilter( \"script\", function( s ) {\n\tif ( s.cache === undefined ) {\n\t\ts.cache = false;\n\t}\n\tif ( s.crossDomain ) {\n\t\ts.type = \"GET\";\n\t}\n} );\n\n// Bind script tag hack transport\njQuery.ajaxTransport( \"script\", function( s ) {\n\n\t// This transport only deals with cross domain requests\n\tif ( s.crossDomain ) {\n\t\tvar script, callback;\n\t\treturn {\n\t\t\tsend: function( _, complete ) {\n\t\t\t\tscript = jQuery( \"<script>\" ).prop( {\n\t\t\t\t\tcharset: s.scriptCharset,\n\t\t\t\t\tsrc: s.url\n\t\t\t\t} ).on(\n\t\t\t\t\t\"load error\",\n\t\t\t\t\tcallback = function( evt ) {\n\t\t\t\t\t\tscript.remove();\n\t\t\t\t\t\tcallback = null;\n\t\t\t\t\t\tif ( evt ) {\n\t\t\t\t\t\t\tcomplete( evt.type === \"error\" ? 404 : 200, evt.type );\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t);\n\n\t\t\t\t// Use native DOM manipulation to avoid our domManip AJAX trickery\n\t\t\t\tdocument.head.appendChild( script[ 0 ] );\n\t\t\t},\n\t\t\tabort: function() {\n\t\t\t\tif ( callback ) {\n\t\t\t\t\tcallback();\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\t}\n} );\n\n\n\n\nvar oldCallbacks = [],\n\trjsonp = /(=)\\?(?=&|$)|\\?\\?/;\n\n// Default jsonp settings\njQuery.ajaxSetup( {\n\tjsonp: \"callback\",\n\tjsonpCallback: function() {\n\t\tvar callback = oldCallbacks.pop() || ( jQuery.expando + \"_\" + ( nonce++ ) );\n\t\tthis[ callback ] = true;\n\t\treturn callback;\n\t}\n} );\n\n// Detect, normalize options and install callbacks for jsonp requests\njQuery.ajaxPrefilter( \"json jsonp\", function( s, originalSettings, jqXHR ) {\n\n\tvar callbackName, overwritten, responseContainer,\n\t\tjsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ?\n\t\t\t\"url\" :\n\t\t\ttypeof s.data === \"string\" &&\n\t\t\t\t( s.contentType || \"\" )\n\t\t\t\t\t.indexOf( \"application/x-www-form-urlencoded\" ) === 0 &&\n\t\t\t\trjsonp.test( s.data ) && \"data\"\n\t\t);\n\n\t// Handle iff the expected data type is \"jsonp\" or we have a parameter to set\n\tif ( jsonProp || s.dataTypes[ 0 ] === \"jsonp\" ) {\n\n\t\t// Get callback name, remembering preexisting value associated with it\n\t\tcallbackName = s.jsonpCallback = isFunction( s.jsonpCallback ) ?\n\t\t\ts.jsonpCallback() :\n\t\t\ts.jsonpCallback;\n\n\t\t// Insert callback into url or form data\n\t\tif ( jsonProp ) {\n\t\t\ts[ jsonProp ] = s[ jsonProp ].replace( rjsonp, \"$1\" + callbackName );\n\t\t} else if ( s.jsonp !== false ) {\n\t\t\ts.url += ( rquery.test( s.url ) ? \"&\" : \"?\" ) + s.jsonp + \"=\" + callbackName;\n\t\t}\n\n\t\t// Use data converter to retrieve json after script execution\n\t\ts.converters[ \"script json\" ] = function() {\n\t\t\tif ( !responseContainer ) {\n\t\t\t\tjQuery.error( callbackName + \" was not called\" );\n\t\t\t}\n\t\t\treturn responseContainer[ 0 ];\n\t\t};\n\n\t\t// Force json dataType\n\t\ts.dataTypes[ 0 ] = \"json\";\n\n\t\t// Install callback\n\t\toverwritten = window[ callbackName ];\n\t\twindow[ callbackName ] = function() {\n\t\t\tresponseContainer = arguments;\n\t\t};\n\n\t\t// Clean-up function (fires after converters)\n\t\tjqXHR.always( function() {\n\n\t\t\t// If previous value didn't exist - remove it\n\t\t\tif ( overwritten === undefined ) {\n\t\t\t\tjQuery( window ).removeProp( callbackName );\n\n\t\t\t// Otherwise restore preexisting value\n\t\t\t} else {\n\t\t\t\twindow[ callbackName ] = overwritten;\n\t\t\t}\n\n\t\t\t// Save back as free\n\t\t\tif ( s[ callbackName ] ) {\n\n\t\t\t\t// Make sure that re-using the options doesn't screw things around\n\t\t\t\ts.jsonpCallback = originalSettings.jsonpCallback;\n\n\t\t\t\t// Save the callback name for future use\n\t\t\t\toldCallbacks.push( callbackName );\n\t\t\t}\n\n\t\t\t// Call if it was a function and we have a response\n\t\t\tif ( responseContainer && isFunction( overwritten ) ) {\n\t\t\t\toverwritten( responseContainer[ 0 ] );\n\t\t\t}\n\n\t\t\tresponseContainer = overwritten = undefined;\n\t\t} );\n\n\t\t// Delegate to script\n\t\treturn \"script\";\n\t}\n} );\n\n\n\n\n// Support: Safari 8 only\n// In Safari 8 documents created via document.implementation.createHTMLDocument\n// collapse sibling forms: the second one becomes a child of the first one.\n// Because of that, this security measure has to be disabled in Safari 8.\n// https://bugs.webkit.org/show_bug.cgi?id=137337\nsupport.createHTMLDocument = ( function() {\n\tvar body = document.implementation.createHTMLDocument( \"\" ).body;\n\tbody.innerHTML = \"<form></form><form></form>\";\n\treturn body.childNodes.length === 2;\n} )();\n\n\n// Argument \"data\" should be string of html\n// context (optional): If specified, the fragment will be created in this context,\n// defaults to document\n// keepScripts (optional): If true, will include scripts passed in the html string\njQuery.parseHTML = function( data, context, keepScripts ) {\n\tif ( typeof data !== \"string\" ) {\n\t\treturn [];\n\t}\n\tif ( typeof context === \"boolean\" ) {\n\t\tkeepScripts = context;\n\t\tcontext = false;\n\t}\n\n\tvar base, parsed, scripts;\n\n\tif ( !context ) {\n\n\t\t// Stop scripts or inline event handlers from being executed immediately\n\t\t// by using document.implementation\n\t\tif ( support.createHTMLDocument ) {\n\t\t\tcontext = document.implementation.createHTMLDocument( \"\" );\n\n\t\t\t// Set the base href for the created document\n\t\t\t// so any parsed elements with URLs\n\t\t\t// are based on the document's URL (gh-2965)\n\t\t\tbase = context.createElement( \"base\" );\n\t\t\tbase.href = document.location.href;\n\t\t\tcontext.head.appendChild( base );\n\t\t} else {\n\t\t\tcontext = document;\n\t\t}\n\t}\n\n\tparsed = rsingleTag.exec( data );\n\tscripts = !keepScripts && [];\n\n\t// Single tag\n\tif ( parsed ) {\n\t\treturn [ context.createElement( parsed[ 1 ] ) ];\n\t}\n\n\tparsed = buildFragment( [ data ], context, scripts );\n\n\tif ( scripts && scripts.length ) {\n\t\tjQuery( scripts ).remove();\n\t}\n\n\treturn jQuery.merge( [], parsed.childNodes );\n};\n\n\n/**\n * Load a url into a page\n */\njQuery.fn.load = function( url, params, callback ) {\n\tvar selector, type, response,\n\t\tself = this,\n\t\toff = url.indexOf( \" \" );\n\n\tif ( off > -1 ) {\n\t\tselector = stripAndCollapse( url.slice( off ) );\n\t\turl = url.slice( 0, off );\n\t}\n\n\t// If it's a function\n\tif ( isFunction( params ) ) {\n\n\t\t// We assume that it's the callback\n\t\tcallback = params;\n\t\tparams = undefined;\n\n\t// Otherwise, build a param string\n\t} else if ( params && typeof params === \"object\" ) {\n\t\ttype = \"POST\";\n\t}\n\n\t// If we have elements to modify, make the request\n\tif ( self.length > 0 ) {\n\t\tjQuery.ajax( {\n\t\t\turl: url,\n\n\t\t\t// If \"type\" variable is undefined, then \"GET\" method will be used.\n\t\t\t// Make value of this field explicit since\n\t\t\t// user can override it through ajaxSetup method\n\t\t\ttype: type || \"GET\",\n\t\t\tdataType: \"html\",\n\t\t\tdata: params\n\t\t} ).done( function( responseText ) {\n\n\t\t\t// Save response for use in complete callback\n\t\t\tresponse = arguments;\n\n\t\t\tself.html( selector ?\n\n\t\t\t\t// If a selector was specified, locate the right elements in a dummy div\n\t\t\t\t// Exclude scripts to avoid IE 'Permission Denied' errors\n\t\t\t\tjQuery( \"<div>\" ).append( jQuery.parseHTML( responseText ) ).find( selector ) :\n\n\t\t\t\t// Otherwise use the full result\n\t\t\t\tresponseText );\n\n\t\t// If the request succeeds, this function gets \"data\", \"status\", \"jqXHR\"\n\t\t// but they are ignored because response was set above.\n\t\t// If it fails, this function gets \"jqXHR\", \"status\", \"error\"\n\t\t} ).always( callback && function( jqXHR, status ) {\n\t\t\tself.each( function() {\n\t\t\t\tcallback.apply( this, response || [ jqXHR.responseText, status, jqXHR ] );\n\t\t\t} );\n\t\t} );\n\t}\n\n\treturn this;\n};\n\n\n\n\n// Attach a bunch of functions for handling common AJAX events\njQuery.each( [\n\t\"ajaxStart\",\n\t\"ajaxStop\",\n\t\"ajaxComplete\",\n\t\"ajaxError\",\n\t\"ajaxSuccess\",\n\t\"ajaxSend\"\n], function( i, type ) {\n\tjQuery.fn[ type ] = function( fn ) {\n\t\treturn this.on( type, fn );\n\t};\n} );\n\n\n\n\njQuery.expr.pseudos.animated = function( elem ) {\n\treturn jQuery.grep( jQuery.timers, function( fn ) {\n\t\treturn elem === fn.elem;\n\t} ).length;\n};\n\n\n\n\njQuery.offset = {\n\tsetOffset: function( elem, options, i ) {\n\t\tvar curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition,\n\t\t\tposition = jQuery.css( elem, \"position\" ),\n\t\t\tcurElem = jQuery( elem ),\n\t\t\tprops = {};\n\n\t\t// Set position first, in-case top/left are set even on static elem\n\t\tif ( position === \"static\" ) {\n\t\t\telem.style.position = \"relative\";\n\t\t}\n\n\t\tcurOffset = curElem.offset();\n\t\tcurCSSTop = jQuery.css( elem, \"top\" );\n\t\tcurCSSLeft = jQuery.css( elem, \"left\" );\n\t\tcalculatePosition = ( position === \"absolute\" || position === \"fixed\" ) &&\n\t\t\t( curCSSTop + curCSSLeft ).indexOf( \"auto\" ) > -1;\n\n\t\t// Need to be able to calculate position if either\n\t\t// top or left is auto and position is either absolute or fixed\n\t\tif ( calculatePosition ) {\n\t\t\tcurPosition = curElem.position();\n\t\t\tcurTop = curPosition.top;\n\t\t\tcurLeft = curPosition.left;\n\n\t\t} else {\n\t\t\tcurTop = parseFloat( curCSSTop ) || 0;\n\t\t\tcurLeft = parseFloat( curCSSLeft ) || 0;\n\t\t}\n\n\t\tif ( isFunction( options ) ) {\n\n\t\t\t// Use jQuery.extend here to allow modification of coordinates argument (gh-1848)\n\t\t\toptions = options.call( elem, i, jQuery.extend( {}, curOffset ) );\n\t\t}\n\n\t\tif ( options.top != null ) {\n\t\t\tprops.top = ( options.top - curOffset.top ) + curTop;\n\t\t}\n\t\tif ( options.left != null ) {\n\t\t\tprops.left = ( options.left - curOffset.left ) + curLeft;\n\t\t}\n\n\t\tif ( \"using\" in options ) {\n\t\t\toptions.using.call( elem, props );\n\n\t\t} else {\n\t\t\tcurElem.css( props );\n\t\t}\n\t}\n};\n\njQuery.fn.extend( {\n\n\t// offset() relates an element's border box to the document origin\n\toffset: function( options ) {\n\n\t\t// Preserve chaining for setter\n\t\tif ( arguments.length ) {\n\t\t\treturn options === undefined ?\n\t\t\t\tthis :\n\t\t\t\tthis.each( function( i ) {\n\t\t\t\t\tjQuery.offset.setOffset( this, options, i );\n\t\t\t\t} );\n\t\t}\n\n\t\tvar rect, win,\n\t\t\telem = this[ 0 ];\n\n\t\tif ( !elem ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Return zeros for disconnected and hidden (display: none) elements (gh-2310)\n\t\t// Support: IE <=11 only\n\t\t// Running getBoundingClientRect on a\n\t\t// disconnected node in IE throws an error\n\t\tif ( !elem.getClientRects().length ) {\n\t\t\treturn { top: 0, left: 0 };\n\t\t}\n\n\t\t// Get document-relative position by adding viewport scroll to viewport-relative gBCR\n\t\trect = elem.getBoundingClientRect();\n\t\twin = elem.ownerDocument.defaultView;\n\t\treturn {\n\t\t\ttop: rect.top + win.pageYOffset,\n\t\t\tleft: rect.left + win.pageXOffset\n\t\t};\n\t},\n\n\t// position() relates an element's margin box to its offset parent's padding box\n\t// This corresponds to the behavior of CSS absolute positioning\n\tposition: function() {\n\t\tif ( !this[ 0 ] ) {\n\t\t\treturn;\n\t\t}\n\n\t\tvar offsetParent, offset, doc,\n\t\t\telem = this[ 0 ],\n\t\t\tparentOffset = { top: 0, left: 0 };\n\n\t\t// position:fixed elements are offset from the viewport, which itself always has zero offset\n\t\tif ( jQuery.css( elem, \"position\" ) === \"fixed\" ) {\n\n\t\t\t// Assume position:fixed implies availability of getBoundingClientRect\n\t\t\toffset = elem.getBoundingClientRect();\n\n\t\t} else {\n\t\t\toffset = this.offset();\n\n\t\t\t// Account for the *real* offset parent, which can be the document or its root element\n\t\t\t// when a statically positioned element is identified\n\t\t\tdoc = elem.ownerDocument;\n\t\t\toffsetParent = elem.offsetParent || doc.documentElement;\n\t\t\twhile ( offsetParent &&\n\t\t\t\t( offsetParent === doc.body || offsetParent === doc.documentElement ) &&\n\t\t\t\tjQuery.css( offsetParent, \"position\" ) === \"static\" ) {\n\n\t\t\t\toffsetParent = offsetParent.parentNode;\n\t\t\t}\n\t\t\tif ( offsetParent && offsetParent !== elem && offsetParent.nodeType === 1 ) {\n\n\t\t\t\t// Incorporate borders into its offset, since they are outside its content origin\n\t\t\t\tparentOffset = jQuery( offsetParent ).offset();\n\t\t\t\tparentOffset.top += jQuery.css( offsetParent, \"borderTopWidth\", true );\n\t\t\t\tparentOffset.left += jQuery.css( offsetParent, \"borderLeftWidth\", true );\n\t\t\t}\n\t\t}\n\n\t\t// Subtract parent offsets and element margins\n\t\treturn {\n\t\t\ttop: offset.top - parentOffset.top - jQuery.css( elem, \"marginTop\", true ),\n\t\t\tleft: offset.left - parentOffset.left - jQuery.css( elem, \"marginLeft\", true )\n\t\t};\n\t},\n\n\t// This method will return documentElement in the following cases:\n\t// 1) For the element inside the iframe without offsetParent, this method will return\n\t// documentElement of the parent window\n\t// 2) For the hidden or detached element\n\t// 3) For body or html element, i.e. in case of the html node - it will return itself\n\t//\n\t// but those exceptions were never presented as a real life use-cases\n\t// and might be considered as more preferable results.\n\t//\n\t// This logic, however, is not guaranteed and can change at any point in the future\n\toffsetParent: function() {\n\t\treturn this.map( function() {\n\t\t\tvar offsetParent = this.offsetParent;\n\n\t\t\twhile ( offsetParent && jQuery.css( offsetParent, \"position\" ) === \"static\" ) {\n\t\t\t\toffsetParent = offsetParent.offsetParent;\n\t\t\t}\n\n\t\t\treturn offsetParent || documentElement;\n\t\t} );\n\t}\n} );\n\n// Create scrollLeft and scrollTop methods\njQuery.each( { scrollLeft: \"pageXOffset\", scrollTop: \"pageYOffset\" }, function( method, prop ) {\n\tvar top = \"pageYOffset\" === prop;\n\n\tjQuery.fn[ method ] = function( val ) {\n\t\treturn access( this, function( elem, method, val ) {\n\n\t\t\t// Coalesce documents and windows\n\t\t\tvar win;\n\t\t\tif ( isWindow( elem ) ) {\n\t\t\t\twin = elem;\n\t\t\t} else if ( elem.nodeType === 9 ) {\n\t\t\t\twin = elem.defaultView;\n\t\t\t}\n\n\t\t\tif ( val === undefined ) {\n\t\t\t\treturn win ? win[ prop ] : elem[ method ];\n\t\t\t}\n\n\t\t\tif ( win ) {\n\t\t\t\twin.scrollTo(\n\t\t\t\t\t!top ? val : win.pageXOffset,\n\t\t\t\t\ttop ? val : win.pageYOffset\n\t\t\t\t);\n\n\t\t\t} else {\n\t\t\t\telem[ method ] = val;\n\t\t\t}\n\t\t}, method, val, arguments.length );\n\t};\n} );\n\n// Support: Safari <=7 - 9.1, Chrome <=37 - 49\n// Add the top/left cssHooks using jQuery.fn.position\n// Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084\n// Blink bug: https://bugs.chromium.org/p/chromium/issues/detail?id=589347\n// getComputedStyle returns percent when specified for top/left/bottom/right;\n// rather than make the css module depend on the offset module, just check for it here\njQuery.each( [ \"top\", \"left\" ], function( i, prop ) {\n\tjQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition,\n\t\tfunction( elem, computed ) {\n\t\t\tif ( computed ) {\n\t\t\t\tcomputed = curCSS( elem, prop );\n\n\t\t\t\t// If curCSS returns percentage, fallback to offset\n\t\t\t\treturn rnumnonpx.test( computed ) ?\n\t\t\t\t\tjQuery( elem ).position()[ prop ] + \"px\" :\n\t\t\t\t\tcomputed;\n\t\t\t}\n\t\t}\n\t);\n} );\n\n\n// Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods\njQuery.each( { Height: \"height\", Width: \"width\" }, function( name, type ) {\n\tjQuery.each( { padding: \"inner\" + name, content: type, \"\": \"outer\" + name },\n\t\tfunction( defaultExtra, funcName ) {\n\n\t\t// Margin is only for outerHeight, outerWidth\n\t\tjQuery.fn[ funcName ] = function( margin, value ) {\n\t\t\tvar chainable = arguments.length && ( defaultExtra || typeof margin !== \"boolean\" ),\n\t\t\t\textra = defaultExtra || ( margin === true || value === true ? \"margin\" : \"border\" );\n\n\t\t\treturn access( this, function( elem, type, value ) {\n\t\t\t\tvar doc;\n\n\t\t\t\tif ( isWindow( elem ) ) {\n\n\t\t\t\t\t// $( window ).outerWidth/Height return w/h including scrollbars (gh-1729)\n\t\t\t\t\treturn funcName.indexOf( \"outer\" ) === 0 ?\n\t\t\t\t\t\telem[ \"inner\" + name ] :\n\t\t\t\t\t\telem.document.documentElement[ \"client\" + name ];\n\t\t\t\t}\n\n\t\t\t\t// Get document width or height\n\t\t\t\tif ( elem.nodeType === 9 ) {\n\t\t\t\t\tdoc = elem.documentElement;\n\n\t\t\t\t\t// Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height],\n\t\t\t\t\t// whichever is greatest\n\t\t\t\t\treturn Math.max(\n\t\t\t\t\t\telem.body[ \"scroll\" + name ], doc[ \"scroll\" + name ],\n\t\t\t\t\t\telem.body[ \"offset\" + name ], doc[ \"offset\" + name ],\n\t\t\t\t\t\tdoc[ \"client\" + name ]\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\treturn value === undefined ?\n\n\t\t\t\t\t// Get width or height on the element, requesting but not forcing parseFloat\n\t\t\t\t\tjQuery.css( elem, type, extra ) :\n\n\t\t\t\t\t// Set width or height on the element\n\t\t\t\t\tjQuery.style( elem, type, value, extra );\n\t\t\t}, type, chainable ? margin : undefined, chainable );\n\t\t};\n\t} );\n} );\n\n\njQuery.each( ( \"blur focus focusin focusout resize scroll click dblclick \" +\n\t\"mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave \" +\n\t\"change select submit keydown keypress keyup contextmenu\" ).split( \" \" ),\n\tfunction( i, name ) {\n\n\t// Handle event binding\n\tjQuery.fn[ name ] = function( data, fn ) {\n\t\treturn arguments.length > 0 ?\n\t\t\tthis.on( name, null, data, fn ) :\n\t\t\tthis.trigger( name );\n\t};\n} );\n\njQuery.fn.extend( {\n\thover: function( fnOver, fnOut ) {\n\t\treturn this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );\n\t}\n} );\n\n\n\n\njQuery.fn.extend( {\n\n\tbind: function( types, data, fn ) {\n\t\treturn this.on( types, null, data, fn );\n\t},\n\tunbind: function( types, fn ) {\n\t\treturn this.off( types, null, fn );\n\t},\n\n\tdelegate: function( selector, types, data, fn ) {\n\t\treturn this.on( types, selector, data, fn );\n\t},\n\tundelegate: function( selector, types, fn ) {\n\n\t\t// ( namespace ) or ( selector, types [, fn] )\n\t\treturn arguments.length === 1 ?\n\t\t\tthis.off( selector, \"**\" ) :\n\t\t\tthis.off( types, selector || \"**\", fn );\n\t}\n} );\n\n// Bind a function to a context, optionally partially applying any\n// arguments.\n// jQuery.proxy is deprecated to promote standards (specifically Function#bind)\n// However, it is not slated for removal any time soon\njQuery.proxy = function( fn, context ) {\n\tvar tmp, args, proxy;\n\n\tif ( typeof context === \"string\" ) {\n\t\ttmp = fn[ context ];\n\t\tcontext = fn;\n\t\tfn = tmp;\n\t}\n\n\t// Quick check to determine if target is callable, in the spec\n\t// this throws a TypeError, but we will just return undefined.\n\tif ( !isFunction( fn ) ) {\n\t\treturn undefined;\n\t}\n\n\t// Simulated bind\n\targs = slice.call( arguments, 2 );\n\tproxy = function() {\n\t\treturn fn.apply( context || this, args.concat( slice.call( arguments ) ) );\n\t};\n\n\t// Set the guid of unique handler to the same of original handler, so it can be removed\n\tproxy.guid = fn.guid = fn.guid || jQuery.guid++;\n\n\treturn proxy;\n};\n\njQuery.holdReady = function( hold ) {\n\tif ( hold ) {\n\t\tjQuery.readyWait++;\n\t} else {\n\t\tjQuery.ready( true );\n\t}\n};\njQuery.isArray = Array.isArray;\njQuery.parseJSON = JSON.parse;\njQuery.nodeName = nodeName;\njQuery.isFunction = isFunction;\njQuery.isWindow = isWindow;\njQuery.camelCase = camelCase;\njQuery.type = toType;\n\njQuery.now = Date.now;\n\njQuery.isNumeric = function( obj ) {\n\n\t// As of jQuery 3.0, isNumeric is limited to\n\t// strings and numbers (primitives or objects)\n\t// that can be coerced to finite numbers (gh-2662)\n\tvar type = jQuery.type( obj );\n\treturn ( type === \"number\" || type === \"string\" ) &&\n\n\t\t// parseFloat NaNs numeric-cast false positives (\"\")\n\t\t// ...but misinterprets leading-number strings, particularly hex literals (\"0x...\")\n\t\t// subtraction forces infinities to NaN\n\t\t!isNaN( obj - parseFloat( obj ) );\n};\n\n\n\n\n// Register as a named AMD module, since jQuery can be concatenated with other\n// files that may use define, but not via a proper concatenation script that\n// understands anonymous AMD modules. A named AMD is safest and most robust\n// way to register. Lowercase jquery is used because AMD module names are\n// derived from file names, and jQuery is normally delivered in a lowercase\n// file name. Do this after creating the global so that if an AMD module wants\n// to call noConflict to hide this version of jQuery, it will work.\n\n// Note that for maximum portability, libraries that are not jQuery should\n// declare themselves as anonymous modules, and avoid setting a global if an\n// AMD loader is present. jQuery is a special case. For more information, see\n// https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon\n\nif ( typeof define === \"function\" && define.amd ) {\n\tdefine( \"jquery\", [], function() {\n\t\treturn jQuery;\n\t} );\n}\n\n\n\n\nvar\n\n\t// Map over jQuery in case of overwrite\n\t_jQuery = window.jQuery,\n\n\t// Map over the $ in case of overwrite\n\t_$ = window.$;\n\njQuery.noConflict = function( deep ) {\n\tif ( window.$ === jQuery ) {\n\t\twindow.$ = _$;\n\t}\n\n\tif ( deep && window.jQuery === jQuery ) {\n\t\twindow.jQuery = _jQuery;\n\t}\n\n\treturn jQuery;\n};\n\n// Expose jQuery and $ identifiers, even in AMD\n// (#7102#comment:10, https://github.com/jquery/jquery/pull/557)\n// and CommonJS for browser emulators (#13566)\nif ( !noGlobal ) {\n\twindow.jQuery = window.$ = jQuery;\n}\n\n\n\n\nreturn jQuery;\n} );\n","import {Engine} from \"./engine.js\";\r\nimport {workerScripts,\r\n addWorkerScript,\r\n killWorkerScript} from \"./NetscriptWorker.js\";\r\nimport {Player} from \"./Player.js\";\r\nimport {getServer} from \"./Server.js\";\r\nimport {dialogBoxCreate} from \"../utils/DialogBox.js\";\r\nimport {printArray, createElement,\r\n createAccordionElement, removeElement,\r\n removeChildrenFromElement, exceptionAlert} from \"../utils/HelperFunctions.js\";\r\nimport {logBoxCreate} from \"../utils/LogBox.js\";\r\nimport numeral from \"numeral/min/numeral.min\";\r\nimport {formatNumber} from \"../utils/StringHelperFunctions.js\";\r\n\r\n/* {\r\n * serverName: {\r\n * header: Server Header Element\r\n * panel: Server Panel List (ul) element\r\n * scripts: {\r\n * script id: Ref to Script information\r\n * }\r\n * }\r\n * ...\r\n */\r\nlet ActiveScriptsUI = {};\r\nlet ActiveScriptsTasks = []; //Sequentially schedule the creation/deletion of UI elements\r\n\r\nfunction createActiveScriptsServerPanel(server) {\r\n let hostname = server.hostname;\r\n\r\n var activeScriptsList = document.getElementById(\"active-scripts-list\");\r\n\r\n let res = createAccordionElement({hdrText:hostname});\r\n let li = res[0];\r\n var hdr = res[1];\r\n let panel = res[2];\r\n\r\n if (ActiveScriptsUI[hostname] != null) {\r\n console.log(\"WARNING: Tried to create already-existing Active Scripts Server panel. This is most likely fine. It probably means many scripts just got started up on a new server. Aborting\");\r\n return;\r\n }\r\n\r\n var panelScriptList = createElement(\"ul\");\r\n panel.appendChild(panelScriptList);\r\n activeScriptsList.appendChild(li);\r\n\r\n ActiveScriptsUI[hostname] = {\r\n header: hdr,\r\n panel: panel,\r\n panelList: panelScriptList,\r\n scripts: {}, //Holds references to li elements for each active script\r\n scriptHdrs: {}, //Holds references to header elements for each active script\r\n scriptStats: {} //Holds references to the p elements containing text for each active script\r\n };\r\n\r\n return li;\r\n}\r\n\r\n//Deletes the info for a particular server (Dropdown header + Panel with all info)\r\n//in the Active Scripts page if it exists\r\nfunction deleteActiveScriptsServerPanel(server) {\r\n let hostname = server.hostname;\r\n if (ActiveScriptsUI[hostname] == null) {\r\n console.log(\"WARNING: Tried to delete non-existent Active Scripts Server panel. Aborting\");\r\n return;\r\n }\r\n\r\n //Make sure it's empty\r\n if (Object.keys(ActiveScriptsUI[hostname].scripts).length > 0) {\r\n console.log(\"WARNING: Tried to delete Active Scripts Server panel that still has scripts. Aborting\");\r\n return;\r\n }\r\n\r\n removeElement(ActiveScriptsUI[hostname].panel);\r\n removeElement(ActiveScriptsUI[hostname].header);\r\n delete ActiveScriptsUI[hostname];\r\n}\r\n\r\nfunction addActiveScriptsItem(workerscript) {\r\n var server = getServer(workerscript.serverIp);\r\n if (server == null) {\r\n console.log(\"ERROR: Invalid server IP for workerscript in addActiveScriptsItem()\");\r\n return;\r\n }\r\n let hostname = server.hostname;\r\n\r\n ActiveScriptsTasks.push(function(workerscript, hostname) {\r\n if (ActiveScriptsUI[hostname] == null) {\r\n createActiveScriptsServerPanel(server);\r\n }\r\n\r\n //Create the unique identifier (key) for this script\r\n var itemNameArray = [\"active\", \"scripts\", hostname, workerscript.name];\r\n for (var i = 0; i < workerscript.args.length; ++i) {\r\n itemNameArray.push(String(workerscript.args[i]));\r\n }\r\n var itemName = itemNameArray.join(\"-\");\r\n\r\n let res = createAccordionElement({hdrText:workerscript.name});\r\n let li = res[0];\r\n let hdr = res[1];\r\n let panel = res[2];\r\n\r\n hdr.classList.remove(\"accordion-header\");\r\n hdr.classList.add(\"active-scripts-script-header\");\r\n panel.classList.remove(\"accordion-panel\");\r\n panel.classList.add(\"active-scripts-script-panel\");\r\n\r\n //Handle the constant elements on the panel that don't change after creation\r\n //Threads, args, kill/log button\r\n panel.appendChild(createElement(\"p\", {\r\n innerHTML: \"Threads: \" + workerscript.scriptRef.threads + \"<br>\" +\r\n \"Args: \" + printArray(workerscript.args)\r\n }));\r\n var panelText = createElement(\"p\", {\r\n innerText:\"Loading...\", fontSize:\"14px\",\r\n });\r\n panel.appendChild(panelText);\r\n panel.appendChild(createElement(\"br\"));\r\n panel.appendChild(createElement(\"span\", {\r\n innerText:\"Log\", class:\"active-scripts-button\", margin:\"4px\", padding:\"4px\",\r\n clickListener:()=>{\r\n logBoxCreate(workerscript.scriptRef);\r\n return false;\r\n }\r\n }));\r\n panel.appendChild(createElement(\"span\", {\r\n innerText:\"Kill Script\", class:\"active-scripts-button\", margin:\"4px\", padding:\"4px\",\r\n clickListener:()=>{\r\n killWorkerScript(workerscript.scriptRef, workerscript.scriptRef.scriptRef.server);\r\n dialogBoxCreate(\"Killing script, may take a few minutes to complete...\");\r\n return false;\r\n }\r\n }));\r\n\r\n //Append element to list\r\n ActiveScriptsUI[hostname][\"panelList\"].appendChild(li);\r\n ActiveScriptsUI[hostname].scripts[itemName] = li;\r\n ActiveScriptsUI[hostname].scriptHdrs[itemName] = hdr;\r\n ActiveScriptsUI[hostname].scriptStats[itemName] = panelText;\r\n }.bind(null, workerscript, hostname));\r\n}\r\n\r\nfunction deleteActiveScriptsItem(workerscript) {\r\n ActiveScriptsTasks.push(function(workerscript) {\r\n var server = getServer(workerscript.serverIp);\r\n if (server == null) {\r\n throw new Error(\"ERROR: Invalid server IP for workerscript. This most likely occurred because \" +\r\n \"you tried to delete a large number of scripts and also deleted servers at the \" +\r\n \"same time. It's not a big deal, just save and refresh the game.\");\r\n return;\r\n }\r\n let hostname = server.hostname;\r\n if (ActiveScriptsUI[hostname] == null) {\r\n console.log(\"ERROR: Trying to delete Active Script UI Element with a hostname that cant be found in ActiveScriptsUI: \" + hostname);\r\n return;\r\n }\r\n\r\n var itemNameArray = [\"active\", \"scripts\", server.hostname, workerscript.name];\r\n for (var i = 0; i < workerscript.args.length; ++i) {\r\n itemNameArray.push(String(workerscript.args[i]));\r\n }\r\n var itemName = itemNameArray.join(\"-\");\r\n\r\n let li = ActiveScriptsUI[hostname].scripts[itemName];\r\n if (li == null) {\r\n console.log(\"ERROR: Cannot find Active Script UI element for workerscript: \");\r\n console.log(workerscript);\r\n return;\r\n }\r\n removeElement(li);\r\n delete ActiveScriptsUI[hostname].scripts[itemName];\r\n delete ActiveScriptsUI[hostname].scriptHdrs[itemName];\r\n delete ActiveScriptsUI[hostname].scriptStats[itemName];\r\n if (Object.keys(ActiveScriptsUI[hostname].scripts).length === 0) {\r\n deleteActiveScriptsServerPanel(server);\r\n }\r\n }.bind(null, workerscript));\r\n}\r\n\r\n//Update the ActiveScriptsItems array\r\nfunction updateActiveScriptsItems(maxTasks=100) {\r\n //Run tasks that need to be done sequentially (adding items, creating/deleting server panels)\r\n //We'll limit this to 50 at a time in case someone decides to start a bunch of scripts all at once...\r\n let numTasks = Math.min(maxTasks, ActiveScriptsTasks.length);\r\n for (let i = 0; i < numTasks; ++i) {\r\n let task = ActiveScriptsTasks.shift();\r\n try {\r\n task();\r\n } catch(e) {\r\n exceptionAlert(e);\r\n console.log(task);\r\n }\r\n }\r\n\r\n if (Engine.currentPage !== Engine.Page.ActiveScripts) {return;}\r\n var total = 0;\r\n for (var i = 0; i < workerScripts.length; ++i) {\r\n try {\r\n total += updateActiveScriptsItemContent(workerScripts[i]);\r\n } catch(e) {\r\n exceptionAlert(e);\r\n }\r\n }\r\n document.getElementById(\"active-scripts-total-prod\").innerHTML =\r\n \"Total online production of Active Scripts: \" + numeral(total).format('$0.000a') + \" / sec<br>\" +\r\n \"Total online production since last Aug installation: \" +\r\n numeral(Player.scriptProdSinceLastAug).format('$0.000a') + \" (\" +\r\n numeral(Player.scriptProdSinceLastAug / (Player.playtimeSinceLastAug/1000)).format('$0.000a') + \" / sec)\";\r\n return total;\r\n}\r\n\r\n//Updates the content of the given item in the Active Scripts list\r\nfunction updateActiveScriptsItemContent(workerscript) {\r\n var server = getServer(workerscript.serverIp);\r\n if (server == null) {\r\n console.log(\"ERROR: Invalid server IP for workerscript.\");\r\n return;\r\n }\r\n let hostname = server.hostname;\r\n if (ActiveScriptsUI[hostname] == null) {\r\n return; //Hasn't been created yet. We'll skip it\r\n }\r\n\r\n var itemNameArray = [\"active\", \"scripts\", server.hostname, workerscript.name];\r\n for (var i = 0; i < workerscript.args.length; ++i) {\r\n itemNameArray.push(String(workerscript.args[i]));\r\n }\r\n var itemName = itemNameArray.join(\"-\");\r\n\r\n if (ActiveScriptsUI[hostname].scriptStats[itemName] == null) {\r\n return; //Hasn't been fully added yet. We'll skip it\r\n }\r\n var item = ActiveScriptsUI[hostname].scriptStats[itemName];\r\n\r\n //Update the text if necessary. This fn returns the online $/s production\r\n return updateActiveScriptsText(workerscript, item, itemName);\r\n}\r\n\r\nfunction updateActiveScriptsText(workerscript, item, itemName) {\r\n var server = getServer(workerscript.serverIp);\r\n if (server == null) {\r\n console.log(\"ERROR: Invalid server IP for workerscript.\");\r\n return;\r\n }\r\n let hostname = server.hostname;\r\n if (ActiveScriptsUI[hostname] == null || ActiveScriptsUI[hostname].scriptHdrs[itemName] == null) {\r\n console.log(\"ERROR: Trying to update Active Script UI Element with a hostname that cant be found in ActiveScriptsUI: \" + hostname);\r\n return;\r\n }\r\n\r\n var onlineMps = workerscript.scriptRef.onlineMoneyMade / workerscript.scriptRef.onlineRunningTime;\r\n\r\n //Only update if the item is visible\r\n if (ActiveScriptsUI[hostname].header.classList.contains(\"active\") === false) {return onlineMps;}\r\n if (ActiveScriptsUI[hostname].scriptHdrs[itemName].classList.contains(\"active\") === false) {return onlineMps;}\r\n\r\n removeChildrenFromElement(item);\r\n\r\n //Online\r\n var onlineTotalMoneyMade = \"Total online production: $\" + formatNumber(workerscript.scriptRef.onlineMoneyMade, 2);\r\n var onlineTotalExpEarned = (Array(26).join(\" \") + formatNumber(workerscript.scriptRef.onlineExpGained, 2) + \" hacking exp\").replace( / /g, \"&nbsp;\");\r\n\r\n var onlineMpsText = \"Online production rate: $\" + formatNumber(onlineMps, 2) + \"/second\";\r\n var onlineEps = workerscript.scriptRef.onlineExpGained / workerscript.scriptRef.onlineRunningTime;\r\n var onlineEpsText = (Array(25).join(\" \") + formatNumber(onlineEps, 4) + \" hacking exp/second\").replace( / /g, \"&nbsp;\");\r\n\r\n //Offline\r\n var offlineTotalMoneyMade = \"Total offline production: $\" + formatNumber(workerscript.scriptRef.offlineMoneyMade, 2);\r\n var offlineTotalExpEarned = (Array(27).join(\" \") + formatNumber(workerscript.scriptRef.offlineExpGained, 2) + \" hacking exp\").replace( / /g, \"&nbsp;\");\r\n\r\n var offlineMps = workerscript.scriptRef.offlineMoneyMade / workerscript.scriptRef.offlineRunningTime;\r\n var offlineMpsText = \"Offline production rate: $\" + formatNumber(offlineMps, 2) + \"/second\";\r\n var offlineEps = workerscript.scriptRef.offlineExpGained / workerscript.scriptRef.offlineRunningTime;\r\n var offlineEpsText = (Array(26).join(\" \") + formatNumber(offlineEps, 4) + \" hacking exp/second\").replace( / /g, \"&nbsp;\");\r\n\r\n item.innerHTML = onlineTotalMoneyMade + \"<br>\" + onlineTotalExpEarned + \"<br>\" +\r\n onlineMpsText + \"<br>\" + onlineEpsText + \"<br>\" + offlineTotalMoneyMade + \"<br>\" + offlineTotalExpEarned + \"<br>\" +\r\n offlineMpsText + \"<br>\" + offlineEpsText + \"<br>\";\r\n return onlineMps;\r\n}\r\n\r\nexport {addActiveScriptsItem, deleteActiveScriptsItem, updateActiveScriptsItems};\r\n","import {BitNodeMultipliers} from \"./BitNode.js\";\r\nimport {Engine} from \"./engine.js\";\r\nimport {Factions} from \"./Faction.js\";\r\nimport {showLiterature} from \"./Literature.js\";\r\nimport {Locations} from \"./Location.js\";\r\nimport {Player} from \"./Player.js\";\r\n\r\nimport Decimal from \"decimal.js\";\r\nimport {dialogBoxCreate} from \"../utils/DialogBox.js\";\r\nimport {getRandomInt, removeElementById,\r\n createElement, createAccordionElement,\r\n removeChildrenFromElement, createPopup,\r\n clearSelector} from \"../utils/HelperFunctions.js\";\r\nimport {Reviver, Generic_toJSON,\r\n Generic_fromJSON} from \"../utils/JSONReviver.js\";\r\nimport numeral from \"numeral/min/numeral.min\";\r\nimport {formatNumber, isString, generateRandomString} from \"../utils/StringHelperFunctions.js\";\r\nimport {yesNoBoxCreate, yesNoTxtInpBoxCreate,\r\n yesNoBoxGetYesButton, yesNoBoxGetNoButton,\r\n yesNoTxtInpBoxGetYesButton, yesNoTxtInpBoxGetNoButton,\r\n yesNoTxtInpBoxGetInput, yesNoBoxClose,\r\n yesNoTxtInpBoxClose, yesNoBoxOpen} from \"../utils/YesNoBox.js\";\r\n\r\n/* State */\r\nvar companyStates = [\"START\", \"PURCHASE\", \"PRODUCTION\", \"SALE\", \"EXPORT\"];\r\nfunction CorporationState() {\r\n this.state = 0;\r\n}\r\n\r\nCorporationState.prototype.nextState = function() {\r\n if (this.state < 0 || this.state >= companyStates.length) {\r\n this.state = 0;\r\n }\r\n\r\n ++this.state;\r\n if (this.state >= companyStates.length) {\r\n this.state = 0;\r\n }\r\n}\r\n\r\nCorporationState.prototype.getState = function() {\r\n return companyStates[this.state];\r\n}\r\n\r\nCorporationState.prototype.toJSON = function() {\r\n\treturn Generic_toJSON(\"CorporationState\", this);\r\n}\r\n\r\nCorporationState.fromJSON = function(value) {\r\n\treturn Generic_fromJSON(CorporationState, value.data);\r\n}\r\n\r\nReviver.constructors.CorporationState = CorporationState;\r\n\r\n/* Constants */\r\nvar TOTALSHARES = 1e9; //Total number of shares you have at your company\r\nvar CyclesPerMarketCycle = 75;\r\nvar CyclesPerIndustryStateCycle = CyclesPerMarketCycle / companyStates.length;\r\nvar SecsPerMarketCycle = CyclesPerMarketCycle / 5;\r\nvar Cities = [\"Aevum\", \"Chongqing\", \"Sector-12\", \"New Tokyo\", \"Ishima\", \"Volhaven\"];\r\nvar WarehouseInitialCost = 5e9; //Initial purchase cost of warehouse\r\nvar WarehouseInitialSize = 100;\r\nvar WarehouseUpgradeBaseCost = 1e9;\r\n\r\nvar OfficeInitialCost = 4e9;\r\nvar OfficeInitialSize = 3;\r\nvar OfficeUpgradeBaseCost = 1e9;\r\n\r\nvar BribeThreshold = 100e12; //Money needed to be able to bribe for faction rep\r\nvar BribeToRepRatio = 1e9; //Bribe Value divided by this = rep gain\r\n\r\nvar ProductProductionCostRatio = 5; //Ratio of material cost of a product to its production cost\r\n\r\nfunction Material(params={}) {\r\n this.name = params.name ? params.name : \"\";\r\n this.qty = 0; //Quantity\r\n this.qlt = 0; //Quality, unbounded\r\n this.dmd = 0; //Demand, 0-100?\r\n this.dmdR = 0; //Range of possible demand\r\n this.cmp = 0; //Competition, 0-100\r\n this.cmpR = 0; //Range of possible competition\r\n this.mv = 0; //Maximum Volatility of stats\r\n\r\n //Markup. Determines how high of a price you can charge on the material\r\n //compared to the market price (bCost) based on quality\r\n //Quality is divided by this to determine markup limits\r\n //e.g if mku is 10 and quality is 100 then you can mark up prices by 100/10 = 10\r\n //without consequences\r\n this.mku = 0;\r\n\r\n this.buy = 0; //How much of this material is being bought per second\r\n this.sll = 0; //How much of this material is being sold per second\r\n this.prd = 0; //How much of this material is being produced per second\r\n this.exp = []; //Exports of this material to another warehouse/industry\r\n this.totalExp = 0; //Total export amount for last cycle\r\n this.imp = 0;\r\n this.bCost = 0; //$ Cost/sec to buy material\r\n this.sCost = 0; //$ Cost/sec to sell material\r\n\r\n //[Whether production/sale is limited, limit amount]\r\n this.prdman = [false, 0]; //Production for this material is manually limited\r\n this.sllman = [false, 0]; //Sale of this material is manually limited\r\n this.init();\r\n}\r\n\r\nMaterial.prototype.init = function(mats={}) {\r\n switch(this.name) {\r\n case \"Water\":\r\n this.dmd = 75; this.dmdR = [65, 85];\r\n this.cmp = 50; this.cmpR = [40, 60];\r\n this.bCost = 1000; this.mv = 0.2;\r\n this.mku = 6;\r\n break;\r\n case \"Energy\":\r\n this.dmd = 90; this.dmdR = [80, 100];\r\n this.cmp = 80; this.cmpR = [65, 95];\r\n this.bCost = 1500; this.mv = 0.2;\r\n this.mku = 6;\r\n break;\r\n case \"Food\":\r\n this.dmd = 80; this.dmdR = [70, 90];\r\n this.cmp = 60; this.cmpR = [35, 85];\r\n this.bCost = 5000; this.mv = 1;\r\n this.mku = 3;\r\n break;\r\n case \"Plants\":\r\n this.dmd = 70; this.dmdR = [20, 90];\r\n this.cmp = 50; this.cmpR = [30, 70];\r\n this.bCost = 3000; this.mv = 0.6;\r\n this.mku = 3.75;\r\n break;\r\n case \"Metal\":\r\n this.dmd = 80; this.dmdR = [75, 85];\r\n this.cmp = 70; this.cmpR = [60, 80];\r\n this.bCost = 2650; this.mv = 1;\r\n this.mku = 6;\r\n break;\r\n case \"Hardware\":\r\n this.dmd = 85; this.dmdR = [80, 90];\r\n this.cmp = 80; this.cmpR = [65, 95];\r\n this.bCost = 4000; this.mv = 0.5; //Less mv bc its processed twice\r\n this.mku = 1;\r\n break;\r\n case \"Chemicals\":\r\n this.dmd = 55; this.dmdR = [40, 70];\r\n this.cmp = 60; this.cmpR = [40, 80];\r\n this.bCost = 6750; this.mv = 1.2;\r\n this.mku = 2;\r\n break;\r\n case \"Real Estate\":\r\n this.dmd = 50; this.dmdR = [5, 100];\r\n this.cmp = 50; this.cmpR = [25, 75];\r\n this.bCost = 16e3; this.mv = 1.5; //Less mv bc its processed twice\r\n this.mku = 1.5;\r\n break;\r\n case \"Drugs\":\r\n this.dmd = 60; this.dmdR = [45, 75];\r\n this.cmp = 70; this.cmpR = [40, 100];\r\n this.bCost = 8e3; this.mv = 1.6;\r\n this.mku = 1;\r\n break;\r\n case \"Robots\":\r\n this.dmd = 90; this.dmdR = [80, 100];\r\n this.cmp = 90; this.cmpR = [80, 100];\r\n this.bCost = 20e3; this.mv = 0.5; //Less mv bc its processed twice\r\n this.mku = 1;\r\n break;\r\n case \"AI Cores\":\r\n this.dmd = 90; this.dmdR = [80, 100];\r\n this.cmp = 90; this.cmpR = [80, 100];\r\n this.bCost = 27e3; this.mv = 0.8; //Less mv bc its processed twice\r\n this.mku = 0.5;\r\n break;\r\n case \"Scientific Research\":\r\n break;\r\n default:\r\n console.log(\"Invalid material type in init(): \" + this.name);\r\n break;\r\n }\r\n}\r\n\r\n//Process change in demand, competition, and buy cost of this material\r\nMaterial.prototype.processMarket = function() {\r\n //This 1st random check determines whether competition increases or decreases\r\n //More competition = lower market price\r\n var v = (Math.random() * this.mv) / 100;\r\n var pv = (Math.random() * this.mv) / 300;\r\n if (Math.random() < 0.42) {\r\n this.cmp *= (1+v);\r\n if (this.cmp > this.cmpR[1]) {this.cmp = this.cmpR[1]};\r\n this.bCost *= (1-pv);\r\n } else {\r\n this.cmp *= (1-v);\r\n if (this.cmp < this.cmpR[0]) {this.cmp = this.cmpR[0];}\r\n this.bCost *= (1+pv);\r\n }\r\n\r\n //This 2nd random check determines whether demand increases or decreases\r\n //More demand = higher market price\r\n v = (Math.random() * this.mv) / 100;\r\n pv = (Math.random() * this.mv) / 300;\r\n if (Math.random() < 0.45) {\r\n this.dmd *= (1+v);\r\n if (this.dmd > this.dmdR[1]) {this.dmd = this.dmdR[1];}\r\n this.bCost *= (1+pv);\r\n } else {\r\n this.dmd *= (1-v);\r\n if (this.dmd < this.dmdR[0]) {this.dmd = this.dmdR[0];}\r\n this.bCost *= (1-pv);\r\n }\r\n}\r\n\r\nMaterial.prototype.toJSON = function() {\r\n\treturn Generic_toJSON(\"Material\", this);\r\n}\r\n\r\nMaterial.fromJSON = function(value) {\r\n\treturn Generic_fromJSON(Material, value.data);\r\n}\r\n\r\nReviver.constructors.Material = Material;\r\n\r\n//Map of material (by name) to their sizes (how much space it takes in warehouse)\r\nlet MaterialSizes = {\r\n Water: 0.05,\r\n Energy: 0.01,\r\n Food: 0.03,\r\n Plants: 0.05,\r\n Metal: 0.1,\r\n Hardware: 0.06,\r\n Chemicals: 0.05,\r\n Drugs: 0.02,\r\n Robots: 0.5,\r\n \"AICores\": 0.1\r\n}\r\n\r\nfunction Product(params={}) {\r\n this.name = params.name ? params.name : 0;\r\n this.dmd = params.demand ? params.demand : 0;\r\n this.cmp = params.competition ? params.competition : 0;\r\n this.mku = params.markup ? params.markup : 0;\r\n this.pCost = 0; //An estimate of how much money it costs to make this\r\n this.sCost = 0; //How much this is selling for\r\n\r\n //Variables for creation of product\r\n this.fin = false; //Finished being created\r\n this.prog = 0; //0-100% created\r\n this.createCity = params.createCity ? params.createCity : \"\"; // City in which the product is being created\r\n this.designCost = params.designCost ? params.designCost : 0;\r\n this.advCost = params.advCost ? params.advCost : 0;\r\n\r\n //Aggregate score for a product's 'rating' based on the other properties below\r\n //The weighting of the other properties (performance, durability)\r\n //differs between industries\r\n this.rat = 0;\r\n\r\n this.qlt = params.quality ? params.quality : 0;\r\n this.per = params.performance ? params.performance : 0;\r\n this.dur = params.durability ? params.durability : 0;\r\n this.rel = params.reliability ? params.reliability : 0;\r\n this.aes = params.aesthetics ? params.aesthetics : 0;\r\n this.fea = params.features ? params.features : 0;\r\n\r\n //Data refers to the production, sale, and quantity of the products\r\n //These values are specific to a city\r\n //The data is [qty, prod, sell]\r\n this.data = {\r\n [Locations.Aevum]: [0, 0, 0],\r\n [Locations.Chongqing]: [0, 0, 0],\r\n [Locations.Sector12]: [0, 0, 0],\r\n [Locations.NewTokyo]: [0, 0, 0],\r\n [Locations.Ishima]: [0, 0, 0],\r\n [Locations.Volhaven]: [0, 0, 0],\r\n }\r\n\r\n //Only applies for location-based products like restaurants/hospitals\r\n this.loc = params.loc ? params.loc : 0;\r\n\r\n //How much space it takes in the warehouse. Not applicable for all products\r\n this.siz = params.size ? params.size : 0;\r\n\r\n //Material requirements. An object that maps the name of a material to how much it requires\r\n //to make 1 unit of the product.\r\n this.reqMats = params.req ? params.req : {};\r\n\r\n //[Whether production/sale is limited, limit amount]\r\n this.prdman = {\r\n [Locations.Aevum]: [false, 0],\r\n [Locations.Chongqing]: [false, 0],\r\n [Locations.Sector12]: [false, 0],\r\n [Locations.NewTokyo]: [false, 0],\r\n [Locations.Ishima]: [false, 0],\r\n [Locations.Volhaven]: [false, 0],\r\n }\r\n\r\n this.sllman = {\r\n [Locations.Aevum]: [false, 0],\r\n [Locations.Chongqing]: [false, 0],\r\n [Locations.Sector12]: [false, 0],\r\n [Locations.NewTokyo]: [false, 0],\r\n [Locations.Ishima]: [false, 0],\r\n [Locations.Volhaven]: [false, 0],\r\n }\r\n}\r\n\r\n//empWorkMult is a multiplier that increases progress rate based on\r\n//productivity of employees\r\nProduct.prototype.createProduct = function(marketCycles=1, empWorkMult=1) {\r\n if (this.fin) {return;}\r\n this.prog += (marketCycles * .01 * empWorkMult);\r\n}\r\n\r\n//'industry' is a reference to the industry that makes the product\r\nProduct.prototype.finishProduct = function(employeeProd, industry) {\r\n this.fin = true;\r\n\r\n //Calculate properties\r\n var progrMult = this.prog / 100;\r\n\r\n var engrRatio = employeeProd[EmployeePositions.Engineer] / employeeProd[\"total\"],\r\n mgmtRatio = employeeProd[EmployeePositions.Management] / employeeProd[\"total\"],\r\n rndRatio = employeeProd[EmployeePositions.RandD] / employeeProd[\"total\"],\r\n opsRatio = employeeProd[EmployeePositions.Operations] / employeeProd[\"total\"],\r\n busRatio = employeeProd[EmployeePositions.Business] / employeeProd[\"total\"];\r\n var designMult = 1 + (Math.pow(this.designCost, 0.1) / 100);\r\n console.log(\"designMult: \" + designMult);\r\n var balanceMult = (1.2 * engrRatio) + (0.9 * mgmtRatio) + (1.3 * rndRatio) +\r\n (1.5 * opsRatio) + (busRatio);\r\n var sciMult = 1 + (Math.pow(industry.sciResearch.qty, industry.sciFac) / 800);\r\n var totalMult = progrMult * balanceMult * designMult * sciMult;\r\n\r\n this.qlt = totalMult * ((0.10 * employeeProd[EmployeePositions.Engineer]) +\r\n (0.05 * employeeProd[EmployeePositions.Management]) +\r\n (0.05 * employeeProd[EmployeePositions.RandD]) +\r\n (0.02 * employeeProd[EmployeePositions.Operations]) +\r\n (0.02 * employeeProd[EmployeePositions.Business]));\r\n this.per = totalMult * ((0.15 * employeeProd[EmployeePositions.Engineer]) +\r\n (0.02 * employeeProd[EmployeePositions.Management]) +\r\n (0.02 * employeeProd[EmployeePositions.RandD]) +\r\n (0.02 * employeeProd[EmployeePositions.Operations]) +\r\n (0.02 * employeeProd[EmployeePositions.Business]));\r\n this.dur = totalMult * ((0.05 * employeeProd[EmployeePositions.Engineer]) +\r\n (0.02 * employeeProd[EmployeePositions.Management]) +\r\n (0.08 * employeeProd[EmployeePositions.RandD]) +\r\n (0.05 * employeeProd[EmployeePositions.Operations]) +\r\n (0.05 * employeeProd[EmployeePositions.Business]));\r\n this.rel = totalMult * ((0.02 * employeeProd[EmployeePositions.Engineer]) +\r\n (0.08 * employeeProd[EmployeePositions.Management]) +\r\n (0.02 * employeeProd[EmployeePositions.RandD]) +\r\n (0.05 * employeeProd[EmployeePositions.Operations]) +\r\n (0.08 * employeeProd[EmployeePositions.Business]));\r\n this.aes = totalMult * ((0.00 * employeeProd[EmployeePositions.Engineer]) +\r\n (0.08 * employeeProd[EmployeePositions.Management]) +\r\n (0.05 * employeeProd[EmployeePositions.RandD]) +\r\n (0.02 * employeeProd[EmployeePositions.Operations]) +\r\n (0.10 * employeeProd[EmployeePositions.Business]));\r\n this.fea = totalMult * ((0.08 * employeeProd[EmployeePositions.Engineer]) +\r\n (0.05 * employeeProd[EmployeePositions.Management]) +\r\n (0.02 * employeeProd[EmployeePositions.RandD]) +\r\n (0.05 * employeeProd[EmployeePositions.Operations]) +\r\n (0.05 * employeeProd[EmployeePositions.Business]));\r\n this.calculateRating(industry);\r\n var advMult = 1 + (Math.pow(this.advCost, 0.1) / 100);\r\n this.mku = 100 / (advMult * Math.pow((this.qlt + 0.001), 0.65) * (busRatio + mgmtRatio));\r\n this.dmd = industry.awareness === 0 ? 20 : Math.min(100, advMult * (100 * (industry.popularity / industry.awareness)));\r\n this.cmp = getRandomInt(0, 70);\r\n\r\n //Calculate the product's required materials\r\n //For now, just set it to be the same as the requirements to make materials\r\n for (var matName in industry.reqMats) {\r\n if (industry.reqMats.hasOwnProperty(matName)) {\r\n this.reqMats[matName] = industry.reqMats[matName];\r\n }\r\n }\r\n\r\n //Calculate the product's size\r\n //For now, just set it to be the same size as the requirements to make materials\r\n this.siz = 0;\r\n for (var matName in industry.reqMats) {\r\n this.siz += MaterialSizes[matName] * industry.reqMats[matName];\r\n }\r\n\r\n //Delete unneeded variables\r\n delete this.prog;\r\n delete this.createCity;\r\n delete this.designCost;\r\n delete this.advCost;\r\n}\r\n\r\n\r\nProduct.prototype.calculateRating = function(industry) {\r\n var weights = ProductRatingWeights[industry.type];\r\n if (weights == null) {\r\n console.log(\"ERROR: Could not find product rating weights for: \" + industry);\r\n return;\r\n }\r\n this.rat = 0;\r\n this.rat += weights.Quality ? this.qlt * weights.Quality : 0;\r\n this.rat += weights.Performance ? this.per * weights.Performance : 0;\r\n this.rat += weights.Durability ? this.dur * weights.Durability : 0;\r\n this.rat += weights.Reliability ? this.rel * weights.Reliability : 0;\r\n this.rat += weights.Aesthetics ? this.aes * weights.Aesthetics : 0;\r\n this.rat += weights.Features ? this.fea * weights.Features : 0;\r\n}\r\n\r\nProduct.prototype.toJSON = function() {\r\n\treturn Generic_toJSON(\"Product\", this);\r\n}\r\n\r\nProduct.fromJSON = function(value) {\r\n\treturn Generic_fromJSON(Product, value.data);\r\n}\r\n\r\nReviver.constructors.Product = Product;\r\n\r\nvar Industries = {\r\n Energy: \"Energy\",\r\n Utilities: \"Water Utilities\",\r\n Agriculture: \"Agriculture\",\r\n Fishing: \"Fishing\",\r\n Mining: \"Mining\",\r\n Food: \"Food\",\r\n Tobacco: \"Tobacco\",\r\n Chemical: \"Chemical\",\r\n Pharmaceutical: \"Pharmaceutical\",\r\n Computer: \"Computer Hardware\",\r\n Robotics: \"Robotics\",\r\n Software: \"Software\",\r\n Healthcare: \"Healthcare\",\r\n RealEstate: \"RealEstate\",\r\n}\r\n\r\nvar IndustryStartingCosts = {\r\n Energy: 225e9,\r\n Utilities: 150e9,\r\n Agriculture: 40e9,\r\n Fishing: 80e9,\r\n Mining: 300e9,\r\n Food: 10e9,\r\n Tobacco: 20e9,\r\n Chemical: 70e9,\r\n Pharmaceutical: 200e9,\r\n Computer: 500e9,\r\n Robotics: 1e12,\r\n Software: 25e9,\r\n Healthcare: 750e9,\r\n RealEstate: 600e9,\r\n}\r\n\r\nvar IndustryDescriptions = {\r\n Energy: \"Engage in the production and distribution of energy.<br><br>\" +\r\n \"Starting cost: \" + numeral(IndustryStartingCosts.Energy).format(\"$0.000a\") + \"<br>\" +\r\n \"Recommended starting Industry: NO\",\r\n Utilities: \"Distributes water and provides wastewater services.<br><br>\" +\r\n \"Starting cost: \" + numeral(IndustryStartingCosts.Utilities).format(\"$0.000a\") + \"<br>\" +\r\n \"Recommended starting Industry: NO\",\r\n Agriculture: \"Cultive crops and breed livestock to produce food.<br><br>\" +\r\n \"Starting cost: \" + numeral(IndustryStartingCosts.Agriculture).format(\"$0.000a\") + \"<br>\" +\r\n \"Recommended starting Industry: YES\",\r\n Fishing: \"Produce food through the breeding and processing of fish and fish products<br><br>\" +\r\n \"Starting cost: \" + numeral(IndustryStartingCosts.Fishing).format(\"$0.000a\") + \"<br>\" +\r\n \"Recommended starting Industry: NO\",\r\n Mining: \"Extract and process metals from the earth.<br><br>\" +\r\n \"Starting cost: \" + numeral(IndustryStartingCosts.Mining).format(\"$0.000a\") + \"<br>\" +\r\n \"Recommended starting Industry: NO\",\r\n Food: \"Create your own restaurants all around the world.<br><br>\" +\r\n \"Starting cost: \" + numeral(IndustryStartingCosts.Food).format(\"$0.000a\") + \"<br>\" +\r\n \"Recommended starting Industry: YES\",\r\n Tobacco: \"Create and distribute tobacco and tobacco-related products.<br><br>\" +\r\n \"Starting cost: \" + numeral(IndustryStartingCosts.Tobacco).format(\"$0.000a\") + \"<br>\" +\r\n \"Recommended starting Industry: YES\",\r\n Chemical: \"Product industrial chemicals<br><br>\" +\r\n \"Starting cost: \" + numeral(IndustryStartingCosts.Chemical).format(\"$0.000a\") + \"<br>\" +\r\n \"Recommended starting Industry: NO\",\r\n Pharmaceutical: \"Discover, develop, and create new pharmaceutical drugs.<br><br>\" +\r\n \"Starting cost: \" + numeral(IndustryStartingCosts.Pharmaceutical).format(\"$0.000a\") + \"<br>\" +\r\n \"Recommended starting Industry: NO\",\r\n Computer: \"Develop and manufacture new computer hardware and networking infrastructures.<br><br>\" +\r\n \"Starting cost: \" + numeral(IndustryStartingCosts.Computer).format(\"$0.000a\") + \"<br>\" +\r\n \"Recommended starting Industry: NO\",\r\n Robotics: \"Develop and create robots.<br><br>\" +\r\n \"Starting cost: \" + numeral(IndustryStartingCosts.Robotics).format(\"$0.000a\") + \"<br>\" +\r\n \"Recommended starting Industry: NO\",\r\n Software: \"Develop computer software and create AI Cores.<br><br>\" +\r\n \"Starting cost: \" + numeral(IndustryStartingCosts.Software).format(\"$0.000a\") + \"<br>\" +\r\n \"Recommended starting Industry: YES\",\r\n Healthcare: \"Create and manage hospitals.<br><br>\" +\r\n \"Starting cost: \" + numeral(IndustryStartingCosts.Healthcare).format(\"$0.000a\") + \"<br>\" +\r\n \"Recommended starting Industry: NO\",\r\n RealEstate: \"Develop and manage real estate properties.<br><br>\" +\r\n \"Starting cost: \" + numeral(IndustryStartingCosts.RealEstate).format(\"$0.000a\") + \"<br>\" +\r\n \"Recommended starting Industry: NO\",\r\n}\r\n\r\nvar ProductRatingWeights = {\r\n [Industries.Food]: {\r\n Quality: 0.7,\r\n Durability: 0.1,\r\n Aesthetics: 0.2,\r\n },\r\n [Industries.Tobacco]: {\r\n Quality: 0.4,\r\n Durability: 0.2,\r\n Reliability: 0.2,\r\n Aesthetics: 0.2,\r\n },\r\n [Industries.Pharmaceutical]: {\r\n Quality: 0.2,\r\n Performance: 0.2,\r\n Durability: 0.1,\r\n Reliability: 0.3,\r\n Features: 0.2,\r\n },\r\n [Industries.Computer]: {\r\n Quality: 0.15,\r\n Performance: 0.25,\r\n Durability: 0.25,\r\n Reliability: 0.2,\r\n Aesthetics: 0.05,\r\n Features: 0.1,\r\n },\r\n \"Computer\" : { //Repeat\r\n Quality: 0.15,\r\n Performance: 0.25,\r\n Durability: 0.25,\r\n Reliability: 0.2,\r\n Aesthetics: 0.05,\r\n Features: 0.1,\r\n },\r\n [Industries.Robotics]: {\r\n Quality: 0.1,\r\n Performance: 0.2,\r\n Durability: 0.2,\r\n Reliability: 0.2,\r\n Aesthetics: 0.1,\r\n Features: 0.2,\r\n },\r\n [Industries.Software]: {\r\n Quality: 0.2,\r\n Performance: 0.2,\r\n Reliability: 0.2,\r\n Durability: 0.2,\r\n Features: 0.2,\r\n },\r\n [Industries.Healthcare]: {\r\n Quality: 0.4,\r\n Performance: 0.1,\r\n Durability: 0.1,\r\n Reliability: 0.3,\r\n Features: 0.1,\r\n },\r\n [Industries.RealEstate]: {\r\n Quality: 0.2,\r\n Durability: 0.25,\r\n Reliability: 0.1,\r\n Aesthetics: 0.35,\r\n Features: 0.1,\r\n }\r\n}\r\n\r\n//Industry upgrades\r\n//The structure is:\r\n// [index in array, base price, price mult, benefit mult (if applicable), name, desc]\r\nvar IndustryUpgrades = {\r\n \"0\": [0, 500e3, 1, 1.05,\r\n \"Coffee\", \"Provide your employees with coffee, increasing their energy by 5%.\"],\r\n \"1\": [1, 1e9, 1.06, 1.03,\r\n \"AdVert.Inc\", \"Hire AdVert.Inc to advertise your company. Each level of \" +\r\n \"this upgrade grants your company a static increase of 3 and 1 to its awareness and \" +\r\n \"popularity, respectively. It will then increase your company's awareness by 1%, and its popularity \" +\r\n \"by a random percentage between 1% and 3%. These effects are increased by other upgrades \" +\r\n \"that increase the power of your advertising.\"]\r\n}\r\n\r\nvar empManualAssignmentModeActive = false;\r\nfunction Industry(params={}) {\r\n this.offices = { //Maps locations to offices. 0 if no office at that location\r\n [Locations.Aevum]: 0,\r\n [Locations.Chongqing]: 0,\r\n [Locations.Sector12]: new OfficeSpace({\r\n loc:Locations.Sector12,\r\n size:OfficeInitialSize,\r\n }),\r\n [Locations.NewTokyo]: 0,\r\n [Locations.Ishima]: 0,\r\n [Locations.Volhaven]: 0\r\n };\r\n\r\n this.warehouses = { //Maps locations to warehouses. 0 if no warehouse at that location\r\n [Locations.Aevum]: 0,\r\n [Locations.Chonqing]: 0,\r\n [Locations.Sector12]: new Warehouse({\r\n loc:Locations.Sector12,\r\n size: WarehouseInitialSize,\r\n }),\r\n [Locations.NewTokyo]: 0,\r\n [Locations.Ishima]: 0,\r\n [Locations.Volhaven]: 0\r\n };\r\n\r\n this.name = params.name ? params.name : 0;\r\n this.type = params.type ? params.type : 0;\r\n\r\n this.sciResearch = new Material({name: \"Scientific Research\"});\r\n\r\n //A map of the NAME of materials required to create produced materials to\r\n //how many are needed to produce 1 unit of produced materials\r\n this.reqMats = {};\r\n\r\n //An array of the name of materials being produced\r\n this.prodMats = [];\r\n\r\n this.products = {};\r\n this.makesProducts = false;\r\n\r\n this.awareness = 0;\r\n this.popularity = 0; //Should always be less than awareness\r\n this.startingCost = 0;\r\n\r\n /* The following are factors for how much production/other things are increased by\r\n different factors. The production increase always has diminishing returns,\r\n and they are all reprsented by exponentials of < 1 (e.g x ^ 0.5, x ^ 0.8)\r\n The number for these represent the exponential. A lower number means more\r\n diminishing returns */\r\n this.reFac = 0; //Real estate Factor\r\n this.sciFac = 0; //Scientific Research Factor, affects quality\r\n this.hwFac = 0; //Hardware factor\r\n this.robFac = 0; //Robotics Factor\r\n this.aiFac = 0; //AI Cores factor;\r\n this.advFac = 0; //Advertising factor, affects sales\r\n\r\n this.prodMult = 0; //Production multiplier\r\n\r\n //Financials\r\n this.lastCycleRevenue = new Decimal(0);\r\n this.lastCycleExpenses = new Decimal(0);\r\n this.thisCycleRevenue = new Decimal(0);\r\n this.thisCycleExpenses = new Decimal(0);\r\n\r\n //Upgrades\r\n var numUpgrades = Object.keys(IndustryUpgrades).length;\r\n this.upgrades = Array(numUpgrades).fill(0);\r\n\r\n this.state = \"START\";\r\n this.newInd = true;\r\n\r\n this.init();\r\n}\r\n\r\nIndustry.prototype.init = function() {\r\n //Set the unique properties of an industry (how much its affected by real estate/scientific research, etc.)\r\n this.startingCost = IndustryStartingCosts[this.type];\r\n switch (this.type) {\r\n case Industries.Energy:\r\n this.reFac = 0.65;\r\n this.sciFac = 0.7;\r\n this.robFac = 0.05;\r\n this.aiFac = 0.3;\r\n this.advFac = 0.08;\r\n this.reqMats = {\r\n \"Hardware\": 0.1,\r\n \"Metal\": 0.2,\r\n };\r\n this.prodMats = [\"Energy\"];\r\n break;\r\n case Industries.Utilities:\r\n case \"Utilities\":\r\n this.reFac = 0.5;\r\n this.sciFac = 0.6;\r\n this.robFac = 0.4;\r\n this.aiFac = 0.4;\r\n this.advFac = 0.08;\r\n this.reqMats = {\r\n \"Hardware\": 0.1,\r\n \"Metal\": 0.1,\r\n }\r\n this.prodMats = [\"Water\"];\r\n break;\r\n case Industries.Agriculture:\r\n this.reFac = 0.75;\r\n this.sciFac = 0.5;\r\n this.hwFac = 0.2;\r\n this.robFac = 0.3;\r\n this.aiFac = 0.3;\r\n this.advFac = 0.04;\r\n this.reqMats = {\r\n \"Water\": 0.5,\r\n \"Energy\": 0.5,\r\n }\r\n this.prodMats = [\"Plants\", \"Food\"];\r\n break;\r\n case Industries.Fishing:\r\n this.reFac = 0.15;\r\n this.sciFac = 0.35;\r\n this.hwFac = 0.35;\r\n this.robFac = 0.5;\r\n this.aiFac = 0.2;\r\n this.advFac = 0.08;\r\n this.reqMats = {\r\n \"Energy\": 0.5,\r\n }\r\n this.prodMats = [\"Food\"];\r\n break;\r\n case Industries.Mining:\r\n this.reFac = 0.3;\r\n this.sciFac = 0.26;\r\n this.hwFac = 0.4;\r\n this.robFac = 0.45;\r\n this.aiFac = 0.45;\r\n this.advFac = 0.06;\r\n this.reqMats = {\r\n \"Energy\": 0.8,\r\n }\r\n this.prodMats = [\"Metal\"];\r\n break;\r\n case Industries.Food:\r\n //reFac is unique for this bc it diminishes greatly per city. Handle this separately in code?\r\n this.sciFac = 0.12;\r\n this.hwFac = 0.15;\r\n this.robFac = 0.3;\r\n this.aiFac = 0.25;\r\n this.advFac = 0.25;\r\n this.reFac = 0.05;\r\n this.reqMats = {\r\n \"Food\": 0.5,\r\n \"Water\": 0.5,\r\n \"Energy\": 0.2,\r\n }\r\n this.makesProducts = true;\r\n break;\r\n case Industries.Tobacco:\r\n this.reFac = 0.15;\r\n this.sciFac = 0.75;\r\n this.hwFac = 0.15;\r\n this.robFac = 0.2;\r\n this.aiFac = 0.15;\r\n this.advFac = 0.2;\r\n this.reqMats = {\r\n \"Plants\": 1,\r\n \"Water\": 0.2,\r\n }\r\n this.makesProducts = true;\r\n break;\r\n case Industries.Chemical:\r\n this.reFac = 0.25;\r\n this.sciFac = 0.75;\r\n this.hwFac = 0.2;\r\n this.robFac = 0.25;\r\n this.aiFac = 0.2;\r\n this.advFac = 0.07;\r\n this.reqMats = {\r\n \"Plants\": 1,\r\n \"Energy\": 0.5,\r\n \"Water\": 0.5,\r\n }\r\n this.prodMats = [\"Chemicals\"];\r\n break;\r\n case Industries.Pharmaceutical:\r\n this.reFac = 0.05;\r\n this.sciFac = 0.8;\r\n this.hwFac = 0.15;\r\n this.robFac = 0.25;\r\n this.aiFac = 0.2;\r\n this.advFac = 0.16;\r\n this.reqMats = {\r\n \"Chemicals\": 2,\r\n \"Energy\": 1,\r\n \"Water\": 0.5,\r\n }\r\n this.prodMats = [\"Drugs\"];\r\n this.makesProducts = true;\r\n break;\r\n case Industries.Computer:\r\n case \"Computer\":\r\n this.reFac = 0.2;\r\n this.sciFac = 0.62;\r\n this.robFac = 0.36;\r\n this.aiFac = 0.19;\r\n this.advFac = 0.17;\r\n this.reqMats = {\r\n \"Metal\": 2.5,\r\n \"Energy\": 1,\r\n }\r\n this.prodMats = [\"Hardware\"];\r\n this.makesProducts = true;\r\n break;\r\n case Industries.Robotics:\r\n this.reFac = 0.32;\r\n this.sciFac = 0.65;\r\n this.aiFac = 0.36;\r\n this.advFac = 0.18;\r\n this.hwFac = 0.19;\r\n this.reqMats = {\r\n \"Hardware\": 5,\r\n \"Energy\": 3,\r\n }\r\n this.prodMats = [\"Robots\"];\r\n this.makesProducts = true;\r\n break;\r\n case Industries.Software:\r\n this.sciFac = 0.62;\r\n this.advFac = 0.16;\r\n this.hwFac = 0.25;\r\n this.reFac = 0.1;\r\n this.aiFac = 0.1;\r\n this.robFac = 0.05;\r\n this.reqMats = {\r\n \"Hardware\": 0.5,\r\n \"Energy\": 1,\r\n }\r\n this.prodMats = [\"AICores\"];\r\n this.makesProducts = true;\r\n break;\r\n case Industries.Healthcare:\r\n this.reFac = 0.1;\r\n this.sciFac = 0.75;\r\n this.advFac = 0.11;\r\n this.hwFac = 0.1;\r\n this.robFac = 0.1;\r\n this.aiFac = 0.1;\r\n this.reqMats = {\r\n \"Robots\": 10,\r\n \"AICores\": 5,\r\n \"Energy\": 5,\r\n \"Water\": 5,\r\n }\r\n this.makesProducts = true;\r\n break;\r\n case Industries.RealEstate:\r\n this.robFac = 0.6;\r\n this.aiFac = 0.6;\r\n this.advFac = 0.25;\r\n this.sciFac = 0.05;\r\n this.hwFac = 0.05;\r\n this.reqMats = {\r\n \"Metal\": 20,\r\n \"Energy\": 10,\r\n \"Water\": 10,\r\n \"Hardware\": 5\r\n }\r\n this.prodMats = [\"RealEstate\"];\r\n this.makesProducts = true;\r\n break;\r\n default:\r\n console.log(\"ERR: Invalid Industry Type passed into Industry.init(): \" + this.type);\r\n return;\r\n }\r\n}\r\n\r\nIndustry.prototype.getProductDescriptionText = function() {\r\n if (!this.makesProducts) {return;}\r\n switch (this.type) {\r\n case Industries.Food:\r\n return \"create and manage restaurants\";\r\n break;\r\n case Industries.Tobacco:\r\n return \"create tobacco and tobacco-related products\";\r\n break;\r\n case Industries.Pharmaceutical:\r\n return \"develop new pharmaceutical drugs\";\r\n break;\r\n case Industries.Computer:\r\n case \"Computer\":\r\n return \"create new computer hardware and networking infrastructures\";\r\n break;\r\n case Industries.Robotics:\r\n return \"build specialized robots and robot-related products\";\r\n break;\r\n case Industries.Software:\r\n return \"develop computer software\";\r\n break;\r\n case Industries.HealthCare:\r\n return \"build and manage hospitals\";\r\n break;\r\n case Industries.RealEstate:\r\n return \"develop and manage real estate properties\";\r\n break;\r\n default:\r\n console.log(\"ERROR: Invalid industry type in Industry.getProductDescriptionText\");\r\n return \"\";\r\n }\r\n}\r\n\r\n//Calculates the values that factor into the production and properties of\r\n//materials/products (such as quality, etc.)\r\nIndustry.prototype.calculateProductionFactors = function() {\r\n var multSum = 0;\r\n for (var i = 0; i < Cities.length; ++i) {\r\n var city = Cities[i];\r\n var warehouse = this.warehouses[city];\r\n if (!(warehouse instanceof Warehouse)) {\r\n continue;\r\n }\r\n\r\n var materials = warehouse.materials,\r\n office = this.offices[city];\r\n\r\n var cityMult = Math.pow(0.002 * materials.RealEstate.qty+1, this.reFac) *\r\n Math.pow(0.002 * materials.Hardware.qty+1, this.hwFac) *\r\n Math.pow(0.002 * materials.Robots.qty+1, this.robFac) *\r\n Math.pow(0.002 * materials.AICores.qty+1, this.aiFac);\r\n multSum += Math.pow(cityMult, 0.73);\r\n }\r\n\r\n multSum < 1 ? this.prodMult = 1 : this.prodMult = multSum;\r\n}\r\n\r\nIndustry.prototype.updateWarehouseSizeUsed = function(warehouse) {\r\n if (warehouse instanceof Warehouse) {\r\n //This resets the size back to 0 and then accounts for materials\r\n warehouse.updateMaterialSizeUsed();\r\n }\r\n\r\n for (var prodName in this.products) {\r\n if (this.products.hasOwnProperty(prodName)) {\r\n var prod = this.products[prodName];\r\n warehouse.sizeUsed += (prod.data[warehouse.loc][0] * prod.siz);\r\n if (prod.data[warehouse.loc][0] > 0) {\r\n warehouse.breakdown += (prodName + \": \" + formatNumber(prod.data[warehouse.loc][0] * prod.siz, 0) + \"<br>\");\r\n }\r\n }\r\n }\r\n}\r\n\r\nIndustry.prototype.process = function(marketCycles=1, state, company) {\r\n this.state = state;\r\n\r\n //At the start of a cycle, store and reset revenue/expenses\r\n //Then calculate salaries and processs the markets\r\n if (state === \"START\") {\r\n if (isNaN(this.thisCycleRevenue) || isNaN(this.thisCycleExpenses)) {\r\n console.log(\"ERROR: NaN in Corporation's computed revenue/expenses\");\r\n console.log(this.thisCycleRevenue.toString());\r\n console.log(this.thisCycleExpenses.toString());\r\n dialogBoxCreate(\"Something went wrong when compting Corporation's revenue/expenses. This is a bug. Please report to game developer\");\r\n this.thisCycleRevenue = new Decimal(0);\r\n this.thisCycleExpenses = new Decimal(0);\r\n }\r\n this.lastCycleRevenue = this.thisCycleRevenue.dividedBy(marketCycles * SecsPerMarketCycle);\r\n this.lastCycleExpenses = this.thisCycleExpenses.dividedBy(marketCycles * SecsPerMarketCycle);\r\n this.thisCycleRevenue = new Decimal(0);\r\n this.thisCycleExpenses = new Decimal(0);\r\n\r\n //Once you start making revenue, the player should no longer be\r\n //considered new, and therefore no longer needs the 'tutorial' UI elements\r\n if (this.lastCycleRevenue.gt(0)) {this.newInd = false;}\r\n\r\n //Process offices (and the employees in them)\r\n var employeeSalary = 0;\r\n for (var officeLoc in this.offices) {\r\n if (this.offices.hasOwnProperty(officeLoc) &&\r\n this.offices[officeLoc] instanceof OfficeSpace) {\r\n employeeSalary += this.offices[officeLoc].process(marketCycles, {industry:this, corporation:company});\r\n }\r\n }\r\n this.thisCycleExpenses = this.thisCycleExpenses.plus(employeeSalary);\r\n\r\n //Process change in demand/competition of materials/products\r\n this.processMaterialMarket(marketCycles);\r\n this.processProductMarket(marketCycles);\r\n\r\n //Process loss of popularity\r\n this.popularity -= (marketCycles * .0001);\r\n this.popularity = Math.max(0, this.popularity);\r\n\r\n //Process Dreamsense gains\r\n var popularityGain = company.getDreamSenseGain(), awarenessGain = popularityGain * 4;\r\n if (popularityGain > 0) {\r\n this.popularity += (popularityGain * marketCycles);\r\n this.awareness += (awarenessGain * marketCycles);\r\n }\r\n\r\n return;\r\n }\r\n\r\n //Process production, purchase, and import/export of materials\r\n var res = this.processMaterials(marketCycles, company);\r\n this.thisCycleRevenue = this.thisCycleRevenue.plus(res[0]);\r\n this.thisCycleExpenses = this.thisCycleExpenses.plus(res[1]);\r\n\r\n //Process creation, production & sale of products\r\n res = this.processProducts(marketCycles, company);\r\n this.thisCycleRevenue = this.thisCycleRevenue.plus(res[0]);\r\n this.thisCycleExpenses = this.thisCycleExpenses.plus(res[1]);\r\n\r\n}\r\n\r\n//Process change in demand and competition for this industry's materials\r\nIndustry.prototype.processMaterialMarket = function(marketCycles=1) {\r\n //References to prodMats and reqMats\r\n var reqMats = this.reqMats, prodMats = this.prodMats;\r\n\r\n //Only 'process the market' for materials that this industry deals with\r\n for (var i = 0; i < Cities.length; ++i) {\r\n //If this industry has a warehouse in this city, process the market\r\n //for every material this industry requires or produces\r\n if (this.warehouses[Cities[i]] instanceof Warehouse) {\r\n var wh = this.warehouses[Cities[i]];\r\n for (var name in reqMats) {\r\n if (reqMats.hasOwnProperty(name)) {\r\n wh.materials[name].processMarket();\r\n }\r\n }\r\n\r\n //Produced materials are stored in an array\r\n for (var foo = 0; foo < prodMats.length; ++foo) {\r\n wh.materials[prodMats[foo]].processMarket();\r\n }\r\n\r\n //Process these twice because these boost production\r\n wh.materials[\"Hardware\"].processMarket();\r\n wh.materials[\"Robots\"].processMarket();\r\n wh.materials[\"AICores\"].processMarket();\r\n wh.materials[\"RealEstate\"].processMarket();\r\n }\r\n }\r\n}\r\n\r\n//Process change in demand and competition for this industry's products\r\nIndustry.prototype.processProductMarket = function(marketCycles=1) {\r\n //Demand gradually decreases, and competition gradually increases\r\n for (var name in this.products) {\r\n if (this.products.hasOwnProperty(name)) {\r\n var product = this.products[name];\r\n var change = getRandomInt(1, 3) * 0.0004;\r\n if (this.type === Industries.Pharmaceutical || this.type === Industries.Software ||\r\n this.type === Industries.Robotics) {\r\n change *= 3;\r\n }\r\n change *= marketCycles;\r\n product.dmd -= change;\r\n product.cmp += change;\r\n product.cmp = Math.min(product.cmp, 99.99);\r\n product.dmd = Math.max(product.dmd, 0.001);\r\n }\r\n }\r\n}\r\n\r\n//Process production, purchase, and import/export of materials\r\nIndustry.prototype.processMaterials = function(marketCycles=1, company) {\r\n var revenue = 0, expenses = 0, industry = this;\r\n this.calculateProductionFactors();\r\n\r\n //At the start of the export state, set the imports of everything to 0\r\n if (this.state === \"EXPORT\") {\r\n for (var i = 0; i < Cities.length; ++i) {\r\n var city = Cities[i], office = this.offices[city];\r\n if (!(this.warehouses[city] instanceof Warehouse)) {\r\n continue;\r\n }\r\n var warehouse = this.warehouses[city];\r\n for (var matName in warehouse.materials) {\r\n if (warehouse.materials.hasOwnProperty(matName)) {\r\n var mat = warehouse.materials[matName];\r\n mat.imp = 0;\r\n }\r\n }\r\n }\r\n }\r\n\r\n for (var i = 0; i < Cities.length; ++i) {\r\n var city = Cities[i], office = this.offices[city];\r\n\r\n if (this.warehouses[city] instanceof Warehouse) {\r\n var warehouse = this.warehouses[city];\r\n\r\n switch(this.state) {\r\n\r\n case \"PURCHASE\":\r\n /* Process purchase of materials */\r\n for (var matName in warehouse.materials) {\r\n if (warehouse.materials.hasOwnProperty(matName)) {\r\n (function(matName, ind) {\r\n var mat = warehouse.materials[matName];\r\n var buyAmt, maxAmt;\r\n if (warehouse.smartSupplyEnabled && Object.keys(ind.reqMats).includes(matName)) {\r\n //Smart supply tracker is stored as per second rate\r\n mat.buy = ind.reqMats[matName] * warehouse.smartSupplyStore;\r\n buyAmt = mat.buy * SecsPerMarketCycle * marketCycles;\r\n } else {\r\n buyAmt = (mat.buy * SecsPerMarketCycle * marketCycles);\r\n }\r\n\r\n if (matName == \"RealEstate\") {\r\n maxAmt = buyAmt;\r\n } else {\r\n maxAmt = Math.floor((warehouse.size - warehouse.sizeUsed) / MaterialSizes[matName]);\r\n }\r\n var buyAmt = Math.min(buyAmt, maxAmt);\r\n if (buyAmt > 0) {\r\n mat.qty += buyAmt;\r\n expenses += (buyAmt * mat.bCost);\r\n }\r\n })(matName, industry);\r\n this.updateWarehouseSizeUsed(warehouse);\r\n }\r\n } //End process purchase of materials\r\n break;\r\n\r\n case \"PRODUCTION\":\r\n warehouse.smartSupplyStore = 0; //Reset smart supply amount\r\n\r\n /* Process production of materials */\r\n if (this.prodMats.length > 0) {\r\n var mat = warehouse.materials[this.prodMats[0]];\r\n //Calculate the maximum production of this material based\r\n //on the office's productivity\r\n var maxProd = this.getOfficeProductivity(office) * this.prodMult * company.getProductionMultiplier(), prod;\r\n\r\n if (mat.prdman[0]) {\r\n //Production is manually limited\r\n prod = Math.min(maxProd, mat.prdman[1]);\r\n } else {\r\n prod = maxProd;\r\n }\r\n prod *= (SecsPerMarketCycle * marketCycles); //Convert production from per second to per market cycle\r\n //Calculate net change in warehouse storage making\r\n //the produced materials will cost\r\n var totalMatSize = 0;\r\n for (var tmp = 0; tmp < this.prodMats.length; ++tmp) {\r\n totalMatSize += (MaterialSizes[this.prodMats[tmp]]);\r\n }\r\n for (var reqMatName in this.reqMats) {\r\n if (this.reqMats.hasOwnProperty(reqMatName)) {\r\n var normQty = this.reqMats[reqMatName];\r\n totalMatSize -= (MaterialSizes[reqMatName] * normQty);\r\n }\r\n }\r\n //If not enough space in warehouse, limit the amount of produced materials\r\n if (totalMatSize > 0) {\r\n var maxAmt = Math.floor((warehouse.size - warehouse.sizeUsed) / totalMatSize);\r\n prod = Math.min(maxAmt, prod);\r\n }\r\n\r\n if (prod < 0) {prod = 0;}\r\n\r\n //Keep track of production for smart supply (/s)\r\n warehouse.smartSupplyStore += (prod / (SecsPerMarketCycle * marketCycles));\r\n\r\n //Make sure we have enough resource to make our materials\r\n var producableFrac = 1;\r\n for (var reqMatName in this.reqMats) {\r\n if (this.reqMats.hasOwnProperty(reqMatName)) {\r\n var req = this.reqMats[reqMatName] * prod;\r\n if (warehouse.materials[reqMatName].qty < req) {\r\n producableFrac = Math.min(producableFrac, warehouse.materials[reqMatName].qty / req);\r\n }\r\n }\r\n }\r\n if (producableFrac <= 0) {producableFrac = 0; prod = 0;}\r\n\r\n //Make our materials if they are producable\r\n if (producableFrac > 0 && prod > 0) {\r\n for (var reqMatName in this.reqMats) {\r\n if (this.reqMats.hasOwnProperty(reqMatName)) {\r\n var reqMatQtyNeeded = (this.reqMats[reqMatName] * prod * producableFrac);\r\n warehouse.materials[reqMatName].qty -= reqMatQtyNeeded;\r\n warehouse.materials[reqMatName].prd = 0;\r\n warehouse.materials[reqMatName].prd -= reqMatQtyNeeded / (SecsPerMarketCycle * marketCycles);\r\n }\r\n }\r\n for (var j = 0; j < this.prodMats.length; ++j) {\r\n warehouse.materials[this.prodMats[j]].qty += (prod * producableFrac);\r\n warehouse.materials[this.prodMats[j]].qlt =\r\n (office.employeeProd[EmployeePositions.Engineer] / 100 +\r\n Math.pow(this.sciResearch.qty, this.sciFac) +\r\n Math.pow(warehouse.materials[\"AICores\"].qty, this.aiFac) / 10e3);\r\n }\r\n } else {\r\n for (var reqMatName in this.reqMats) {\r\n if (this.reqMats.hasOwnProperty(reqMatName)) {\r\n warehouse.materials[reqMatName].prd = 0;\r\n }\r\n }\r\n }\r\n\r\n //Per second\r\n var fooProd = prod * producableFrac / (SecsPerMarketCycle * marketCycles);\r\n for (var fooI = 0; fooI < this.prodMats.length; ++fooI) {\r\n warehouse.materials[this.prodMats[fooI]].prd = fooProd;\r\n }\r\n } else {\r\n //If this doesn't produce any materials, then it only creates\r\n //Products. Creating products will consume materials. The\r\n //Production of all consumed materials must be set to 0\r\n for (var reqMatName in this.reqMats) {\r\n if (this.reqMats.hasOwnProperty(reqMatName)) {\r\n warehouse.materials[reqMatName].prd = 0;\r\n }\r\n }\r\n }\r\n break;\r\n\r\n case \"SALE\":\r\n /* Process sale of materials */\r\n for (var matName in warehouse.materials) {\r\n if (warehouse.materials.hasOwnProperty(matName)) {\r\n var mat = warehouse.materials[matName];\r\n if (mat.sCost < 0 || mat.sllman[0] === false) {\r\n mat.sll = 0;\r\n continue;\r\n }\r\n var mat = warehouse.materials[matName];\r\n\r\n var sCost;\r\n if (isString(mat.sCost)) {\r\n sCost = mat.sCost.replace(/MP/g, mat.bCost);\r\n sCost = eval(sCost);\r\n } else {\r\n sCost = mat.sCost;\r\n }\r\n\r\n //Calculate how much of the material sells (per second)\r\n var markup = 1, markupLimit = mat.qlt / mat.mku;\r\n if (sCost > mat.bCost) {\r\n //Penalty if difference between sCost and bCost is greater than markup limit\r\n if ((sCost - mat.bCost) > markupLimit) {\r\n markup = markupLimit / (sCost - mat.bCost);\r\n }\r\n } else if (sCost < mat.bCost) {\r\n if (sCost <= 0) {\r\n markup = 1e12; //Sell everything, essentially discard\r\n } else {\r\n //Lower prices than market increases sales\r\n markup = mat.bCost / sCost;\r\n }\r\n }\r\n //var businessFactor = 1 + (office.employeeProd[EmployeePositions.Business] / office.employeeProd[\"total\"]);\r\n var businessFactor = this.getBusinessFactor(office); //Business employee productivity\r\n var advertisingFactor = this.getAdvertisingFactors()[0]; //Awareness + popularity\r\n var marketFactor = this.getMarketFactor(mat); //Competition + demand\r\n var maxSell = (mat.qlt + .001) * marketFactor * markup * businessFactor *\r\n company.getSalesMultiplier() * advertisingFactor;\r\n\r\n var sellAmt;\r\n if (isString(mat.sllman[1])) {\r\n //Dynamically evaluated\r\n var tmp = mat.sllman[1].replace(/MAX/g, maxSell);\r\n tmp = tmp.replace(/PROD/g, mat.prd);\r\n try {\r\n sellAmt = eval(tmp);\r\n } catch(e) {\r\n dialogBoxCreate(\"Error evaluating your sell amount for material \" + mat.name +\r\n \" in \" + this.name + \"'s \" + city + \" office. The sell amount \" +\r\n \"is being set to zero\");\r\n sellAmt = 0;\r\n }\r\n sellAmt = Math.min(maxSell, sellAmt);\r\n } else if (mat.sllman[1] === -1) {\r\n //Backwards compatibility, -1 = MAX\r\n sellAmt = maxSell;\r\n } else {\r\n //Player's input value is just a number\r\n sellAmt = Math.min(maxSell, mat.sllman[1]);\r\n }\r\n\r\n sellAmt = (sellAmt * SecsPerMarketCycle * marketCycles);\r\n sellAmt = Math.min(mat.qty, sellAmt);\r\n if (sellAmt < 0) {\r\n console.log(\"sellAmt calculated to be negative\");\r\n mat.sll = 0;\r\n continue;\r\n }\r\n if (sellAmt && sCost >= 0) {\r\n mat.qty -= sellAmt;\r\n revenue += (sellAmt * sCost);\r\n mat.sll = sellAmt / (SecsPerMarketCycle * marketCycles);\r\n } else {\r\n mat.sll = 0;\r\n }\r\n }\r\n } //End processing of sale of materials\r\n break;\r\n\r\n case \"EXPORT\":\r\n for (var matName in warehouse.materials) {\r\n if (warehouse.materials.hasOwnProperty(matName)) {\r\n var mat = warehouse.materials[matName];\r\n mat.totalExp = 0; //Reset export\r\n for (var expI = 0; expI < mat.exp.length; ++expI) {\r\n var exp = mat.exp[expI];\r\n var amt = exp.amt.replace(/MAX/g, mat.qty / (SecsPerMarketCycle * marketCycles));\r\n try {\r\n amt = eval(amt);\r\n } catch(e) {\r\n dialogBoxCreate(\"Calculating export for \" + mat.name + \" in \" +\r\n this.name + \"'s \" + city + \" division failed with \" +\r\n \"error: \" + e);\r\n continue;\r\n }\r\n if (isNaN(amt)) {\r\n dialogBoxCreate(\"Error calculating export amount for \" + mat.name + \" in \" +\r\n this.name + \"'s \" + city + \" division.\");\r\n continue;\r\n }\r\n amt = amt * SecsPerMarketCycle * marketCycles;\r\n\r\n if (mat.qty < amt) {\r\n amt = mat.qty;\r\n }\r\n if (amt === 0) {\r\n break; //None left\r\n }\r\n for (var foo = 0; foo < company.divisions.length; ++foo) {\r\n if (company.divisions[foo].name === exp.ind) {\r\n var expIndustry = company.divisions[foo];\r\n var expWarehouse = expIndustry.warehouses[exp.city];\r\n if (!(expWarehouse instanceof Warehouse)) {\r\n console.log(\"ERROR: Invalid export! \" + expIndustry.name + \" \" + exp.city);\r\n break;\r\n }\r\n\r\n //Make sure theres enough space in warehouse\r\n if (expWarehouse.sizeUsed >= expWarehouse.size) {\r\n return; //Warehouse at capacity\r\n } else {\r\n var maxAmt = Math.floor((expWarehouse.size - expWarehouse.sizeUsed) / MaterialSizes[matName]);\r\n amt = Math.min(maxAmt, amt);\r\n }\r\n expWarehouse.materials[matName].imp += (amt / (SecsPerMarketCycle * marketCycles));\r\n expWarehouse.materials[matName].qty += amt;\r\n expWarehouse.materials[matName].qlt = mat.qlt;\r\n mat.qty -= amt;\r\n mat.totalExp += amt;\r\n expIndustry.updateWarehouseSizeUsed(expWarehouse);\r\n break;\r\n }\r\n }\r\n }\r\n //totalExp should be per second\r\n mat.totalExp /= (SecsPerMarketCycle * marketCycles);\r\n }\r\n }\r\n\r\n break;\r\n\r\n case \"START\":\r\n break;\r\n default:\r\n console.log(\"ERROR: Invalid state: \" + this.state);\r\n break;\r\n } //End switch(this.state)\r\n this.updateWarehouseSizeUsed(warehouse);\r\n\r\n } // End warehouse\r\n\r\n //Produce Scientific Research based on R&D employees\r\n //Scientific Research can be produced without a warehouse\r\n if (office instanceof OfficeSpace) {\r\n this.sciResearch.qty += (.005 * Math.pow(office.employeeProd[EmployeePositions.RandD], 0.5)\r\n * company.getScientificResearchMultiplier());\r\n }\r\n }\r\n return [revenue, expenses];\r\n}\r\n\r\n//Process production & sale of this industry's FINISHED products (including all of their stats)\r\nIndustry.prototype.processProducts = function(marketCycles=1, corporation) {\r\n var revenue = 0, expenses = 0;\r\n\r\n //Create products\r\n if (this.state === \"PRODUCTION\") {\r\n for (var prodName in this.products) {\r\n if (this.products.hasOwnProperty(prodName)) {\r\n var prod = this.products[prodName];\r\n if (!prod.fin) {\r\n var city = prod.createCity, office = this.offices[city];\r\n var total = office.employeeProd[EmployeePositions.Operations] +\r\n office.employeeProd[EmployeePositions.Engineer] +\r\n office.employeeProd[EmployeePositions.Management], ratio;\r\n if (total === 0) {\r\n ratio = 0;\r\n } else {\r\n ratio = office.employeeProd[EmployeePositions.Engineer] / total +\r\n office.employeeProd[EmployeePositions.Operations] / total +\r\n office.employeeProd[EmployeePositions.Management] / total;\r\n }\r\n prod.createProduct(marketCycles, ratio * Math.pow(total, 0.29));\r\n if (prod.prog >= 100) {\r\n prod.finishProduct(office.employeeProd, this);\r\n }\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n\r\n //Produce Products\r\n for (var prodName in this.products) {\r\n if (this.products.hasOwnProperty(prodName)) {\r\n var prod = this.products[prodName];\r\n if (prod instanceof Product && prod.fin) {\r\n revenue += this.processProduct(marketCycles, prod, corporation);\r\n }\r\n }\r\n }\r\n return [revenue, expenses];\r\n}\r\n\r\n//Processes FINISHED products\r\nIndustry.prototype.processProduct = function(marketCycles=1, product, corporation) {\r\n var totalProfit = 0;\r\n for (var i = 0; i < Cities.length; ++i) {\r\n var city = Cities[i], office = this.offices[city], warehouse = this.warehouses[city];\r\n if (warehouse instanceof Warehouse) {\r\n switch(this.state) {\r\n\r\n case \"PRODUCTION\":\r\n //Calculate the maximum production of this material based\r\n //on the office's productivity\r\n var maxProd = this.getOfficeProductivity(office, {forProduct:true}) *\r\n corporation.getProductionMultiplier() * this.prodMult, prod;\r\n\r\n //Account for whether production is manually limited\r\n if (product.prdman[city][0]) {\r\n prod = Math.min(maxProd, product.prdman[city][1]);\r\n } else {\r\n prod = maxProd;\r\n }\r\n prod *= (SecsPerMarketCycle * marketCycles);\r\n\r\n //Calculate net change in warehouse storage making the Products will cost\r\n var netStorageSize = product.siz;\r\n for (var reqMatName in product.reqMats) {\r\n if (product.reqMats.hasOwnProperty(reqMatName)) {\r\n var normQty = product.reqMats[reqMatName];\r\n netStorageSize -= (MaterialSizes[reqMatName] * normQty);\r\n }\r\n }\r\n\r\n //If there's not enough space in warehouse, limit the amount of Product\r\n if (netStorageSize > 0) {\r\n var maxAmt = Math.floor((warehouse.size - warehouse.sizeUsed) / netStorageSize);\r\n prod = Math.min(maxAmt, prod);\r\n }\r\n\r\n warehouse.smartSupplyStore += (prod / (SecsPerMarketCycle * marketCycles));\r\n\r\n //Make sure we have enough resources to make our Products\r\n var producableFrac = 1;\r\n for (var reqMatName in product.reqMats) {\r\n if (product.reqMats.hasOwnProperty(reqMatName)) {\r\n var req = product.reqMats[reqMatName] * prod;\r\n if (warehouse.materials[reqMatName].qty < req) {\r\n producableFrac = Math.min(producableFrac, warehouse.materials[reqMatName].qty / req);\r\n }\r\n }\r\n }\r\n\r\n //Make our Products if they are producable\r\n if (producableFrac > 0 && prod > 0) {\r\n for (var reqMatName in product.reqMats) {\r\n if (product.reqMats.hasOwnProperty(reqMatName)) {\r\n var reqMatQtyNeeded = (product.reqMats[reqMatName] * prod * producableFrac);\r\n warehouse.materials[reqMatName].qty -= reqMatQtyNeeded;\r\n warehouse.materials[reqMatName].prd -= reqMatQtyNeeded / (SecsPerMarketCycle * marketCycles);\r\n }\r\n }\r\n //Quantity\r\n product.data[city][0] += (prod * producableFrac);\r\n }\r\n\r\n //Keep track of production Per second\r\n product.data[city][1] = prod * producableFrac / (SecsPerMarketCycle * marketCycles);\r\n break;\r\n\r\n case \"SALE\":\r\n //Process sale of Products\r\n product.pCost = 0; //Estimated production cost\r\n for (var reqMatName in product.reqMats) {\r\n if (product.reqMats.hasOwnProperty(reqMatName)) {\r\n product.pCost += (product.reqMats[reqMatName] * warehouse.materials[reqMatName].bCost);\r\n }\r\n }\r\n\r\n //Since its a product, its production cost is increased for labor\r\n product.pCost *= ProductProductionCostRatio;\r\n\r\n //Calculate Sale Cost (sCost), which could be dynamically evaluated\r\n var sCost;\r\n if (isString(product.sCost)) {\r\n sCost = product.sCost.replace(/MP/g, product.pCost + product.rat / product.mku);\r\n sCost = eval(sCost);\r\n } else {\r\n sCost = product.sCost;\r\n }\r\n\r\n var markup = 1, markupLimit = product.rat / product.mku;\r\n if (sCost > product.pCost) {\r\n if ((sCost - product.pCost) > markupLimit) {\r\n markup = markupLimit / (sCost - product.pCost);\r\n }\r\n }\r\n var businessFactor = this.getBusinessFactor(office); //Business employee productivity\r\n var advertisingFactor = this.getAdvertisingFactors()[0]; //Awareness + popularity\r\n var marketFactor = this.getMarketFactor(product); //Competition + demand\r\n var maxSell = 0.5 * Math.pow(product.rat, 0.65) * marketFactor * corporation.getSalesMultiplier() *\r\n Math.pow(markup, 2) * businessFactor * advertisingFactor;\r\n var sellAmt;\r\n if (product.sllman[city][0] && isString(product.sllman[city][1])) {\r\n //Sell amount is dynamically evaluated\r\n var tmp = product.sllman[city][1].replace(/MAX/g, maxSell);\r\n tmp = tmp.replace(/PROD/g, product.data[city][1]);\r\n try {\r\n tmp = eval(tmp);\r\n } catch(e) {\r\n dialogBoxCreate(\"Error evaluating your sell price expression for \" + product.name +\r\n \" in \" + this.name + \"'s \" + city + \" office. Sell price is being set to MAX\");\r\n tmp = maxSell;\r\n }\r\n sellAmt = Math.min(maxSell, tmp);\r\n } else if (product.sllman[city][0] && product.sllman[city][1] > 0) {\r\n //Sell amount is manually limited\r\n sellAmt = Math.min(maxSell, product.sllman[city][1]);\r\n } else {\r\n //Backwards compatibility, -1 = 0\r\n sellAmt = maxSell;\r\n }\r\n sellAmt = sellAmt * SecsPerMarketCycle * marketCycles;\r\n sellAmt = Math.min(product.data[city][0], sellAmt); //data[0] is qty\r\n if (sellAmt && sCost) {\r\n product.data[city][0] -= sellAmt; //data[0] is qty\r\n totalProfit += (sellAmt * sCost);\r\n product.data[city][2] = sellAmt / (SecsPerMarketCycle * marketCycles); //data[2] is sell property\r\n } else {\r\n product.data[city][2] = 0; //data[2] is sell property\r\n }\r\n break;\r\n\r\n case \"START\":\r\n case \"PURCHASE\":\r\n case \"EXPORT\":\r\n break;\r\n default:\r\n console.log(\"ERROR: Invalid State: \" + this.state);\r\n break;\r\n } //End switch(this.state)\r\n }\r\n }\r\n return totalProfit;\r\n}\r\n\r\nIndustry.prototype.discontinueProduct = function(product, parentRefs) {\r\n var company = parentRefs.company, industry = parentRefs.industry;\r\n for (var productName in this.products) {\r\n if (this.products.hasOwnProperty(productName)) {\r\n if (product === this.products[productName]) {\r\n delete this.products[productName];\r\n company.updateUIContent();\r\n }\r\n }\r\n }\r\n}\r\n\r\nIndustry.prototype.upgrade = function(upgrade, refs) {\r\n var corporation = refs.corporation, division = refs.division,\r\n office = refs.office;\r\n var upgN = upgrade[0], basePrice = upgrade[1], priceMult = upgrade[2],\r\n upgradeBenefit = upgrade[3];\r\n while (this.upgrades.length <= upgN) {this.upgrades.push(0);}\r\n ++this.upgrades[upgN];\r\n\r\n switch (upgN) {\r\n case 0: //Coffee, 5% energy per employee\r\n for (var i = 0; i < office.employees.length; ++i) {\r\n office.employees[i].ene = Math.min(office.employees[i].ene * 1.05, 100);\r\n }\r\n break;\r\n case 1: //AdVert.Inc,\r\n var advMult = corporation.getAdvertisingMultiplier();\r\n this.awareness += (3 * advMult);\r\n this.popularity += (1 * advMult);\r\n this.awareness *= (1.01 * advMult);\r\n this.popularity *= ((1 + getRandomInt(1, 3) / 100) * advMult);\r\n break;\r\n default:\r\n console.log(\"ERROR: Un-implemented function index: \" + upgN);\r\n break;\r\n }\r\n}\r\n\r\n//Returns how much of a material can be produced based of office productivity (employee stats)\r\nIndustry.prototype.getOfficeProductivity = function(office, params) {\r\n var total = office.employeeProd[EmployeePositions.Operations] +\r\n office.employeeProd[EmployeePositions.Engineer] +\r\n office.employeeProd[EmployeePositions.Management], ratio;\r\n if (total === 0) {\r\n ratio = 0;\r\n } else {\r\n ratio = (office.employeeProd[EmployeePositions.Operations] / total) *\r\n (office.employeeProd[EmployeePositions.Engineer] / total) *\r\n (office.employeeProd[EmployeePositions.Management] / total);\r\n ratio = Math.max(0.01, ratio); //Minimum ratio value if you have employees\r\n }\r\n if (params && params.forProduct) {\r\n return ratio * Math.pow(total, 0.2);\r\n } else {\r\n return 2 * ratio * Math.pow(total, 0.3);\r\n }\r\n}\r\n\r\n//Returns a multiplier based on the office' 'Business' employees that affects sales\r\nIndustry.prototype.getBusinessFactor = function(office) {\r\n var ratioMult = 1;\r\n if (office.employeeProd[\"total\"] > 0) {\r\n ratioMult = 1 + (office.employeeProd[EmployeePositions.Business] / office.employeeProd[\"total\"]);\r\n }\r\n return ratioMult * Math.pow(1 + office.employeeProd[EmployeePositions.Business], 0.15);\r\n}\r\n\r\n//Returns a set of multipliers based on the Industry's awareness, popularity, and advFac. This\r\n//multiplier affects sales. The result is:\r\n// [Total sales mult, total awareness mult, total pop mult, awareness/pop ratio mult]\r\nIndustry.prototype.getAdvertisingFactors = function() {\r\n var awarenessFac = Math.pow(this.awareness + 1, this.advFac);\r\n var popularityFac = Math.pow(this.popularity + 1, this.advFac);\r\n var ratioFac = (this.awareness === 0 ? 0.01 : Math.max((this.popularity + .001) / this.awareness, 0.01));\r\n var totalFac = Math.pow(awarenessFac * popularityFac * ratioFac, 0.85);\r\n return [totalFac, awarenessFac, popularityFac, ratioFac];\r\n}\r\n\r\n//Returns a multiplier based on a materials demand and competition that affects sales\r\nIndustry.prototype.getMarketFactor = function(mat) {\r\n return mat.dmd * (100 - mat.cmp)/100;\r\n}\r\n\r\nIndustry.prototype.toJSON = function() {\r\n\treturn Generic_toJSON(\"Industry\", this);\r\n}\r\n\r\nIndustry.fromJSON = function(value) {\r\n\treturn Generic_fromJSON(Industry, value.data);\r\n}\r\n\r\nReviver.constructors.Industry = Industry;\r\n\r\nvar EmployeePositions = {\r\n Operations: \"Operations\",\r\n Engineer: \"Engineer\",\r\n Business: \"Business\",\r\n Management: \"Management\",\r\n RandD: \"Research & Development\",\r\n Training:\"Training\",\r\n Unassigned:\"Unassigned\",\r\n}\r\n\r\nfunction Employee(params={}) {\r\n if (!(this instanceof Employee)) {\r\n return new Employee(params);\r\n }\r\n this.name = params.name ? params.name : \"Bobby\";\r\n\r\n //Morale, happiness, and energy are 0-100\r\n this.mor = params.morale ? params.morale : getRandomInt(50, 100);\r\n this.hap = params.happiness ? params.happiness : getRandomInt(50, 100);\r\n this.ene = params.energy ? params.energy : getRandomInt(50, 100);\r\n\r\n this.age = params.age ? params.age : getRandomInt(20, 50);\r\n this.int = params.intelligence ? params.intelligence : getRandomInt(10, 50);\r\n this.cha = params.charisma ? params.charisma : getRandomInt(10, 50);\r\n this.exp = params.experience ? params.experience : getRandomInt(10, 50);\r\n this.cre = params.creativity ? params.creativity : getRandomInt(10, 50);\r\n this.eff = params.efficiency ? params.efficiency : getRandomInt(10, 50);\r\n this.sal = params.salary ? params.salary : getRandomInt(0.1, 5);\r\n this.pro = 0; //Productivity, This is calculated\r\n\r\n this.loc = params.loc ? params.loc : \"\";\r\n this.pos = EmployeePositions.Unassigned;\r\n}\r\n\r\n//Returns the amount the employee needs to be paid\r\nEmployee.prototype.process = function(marketCycles=1, office) {\r\n var gain = 0.001 * marketCycles,\r\n det = gain * Math.random();\r\n this.age += gain;\r\n this.exp += gain;\r\n if (this.age > 150) {\r\n this.int -= det;\r\n this.eff -= det;\r\n this.cha -= det;\r\n }\r\n\r\n //Training\r\n var trainingEff = gain * Math.random();\r\n if (this.pos === EmployeePositions.Training) {\r\n //To increase creativity and intelligence special upgrades are needed\r\n this.cha += trainingEff;\r\n this.exp += trainingEff;\r\n this.eff += trainingEff;\r\n }\r\n\r\n //Weight based on how full office is\r\n //Too many employees = more likely to decrease energy and happiness\r\n var officeCapacityWeight = 0.5 * (office.employees.length / office.size - 0.5);\r\n if (Math.random() < 0.5 - officeCapacityWeight) {\r\n this.ene += det;\r\n this.hap += det;\r\n } else {\r\n this.ene -= det;\r\n this.hap -= det;\r\n }\r\n if (this.ene < office.minEne) {this.ene = office.minEne;}\r\n if (this.hap < office.minHap) {this.hap = office.minHap;}\r\n var salary = this.sal * marketCycles * SecsPerMarketCycle;\r\n return salary;\r\n}\r\n\r\nEmployee.prototype.calculateProductivity = function(corporation) {\r\n var effCre = this.cre * corporation.getEmployeeCreMultiplier(),\r\n effCha = this.cha * corporation.getEmployeeChaMultiplier(),\r\n effInt = this.int * corporation.getEmployeeIntMultiplier(),\r\n effEff = this.eff * corporation.getEmployeeEffMultiplier();\r\n var prodBase = this.mor * this.hap * this.ene * 1e-6, prodMult;\r\n switch(this.pos) {\r\n //Calculate productivity based on position. This is multipled by prodBase\r\n //to get final value\r\n case EmployeePositions.Operations:\r\n prodMult = (0.6 * effInt) + (0.1 * effCha) + (this.exp) +\r\n (0.5 * effCre) + (effEff);\r\n break;\r\n case EmployeePositions.Engineer:\r\n prodMult = (effInt) + (0.1 * effCha) + (1.5 * this.exp) +\r\n (effEff);\r\n break;\r\n case EmployeePositions.Business:\r\n prodMult = (0.4 * effInt) + (effCha) + (0.5 * this.exp);\r\n break;\r\n case EmployeePositions.Management:\r\n prodMult = (2 * effCha) + (this.exp) + (0.2 * effCre) +\r\n (0.7 * effEff);\r\n break;\r\n case EmployeePositions.RandD:\r\n prodMult = (1.5 * effInt) + (0.8 * this.exp) + (effCre) +\r\n (0.5 * effEff);\r\n break;\r\n case EmployeePositions.Unassigned:\r\n case EmployeePositions.Training:\r\n prodMult = 0;\r\n break;\r\n default:\r\n console.log(\"ERROR: Invalid employee position: \" + this.pos);\r\n break;\r\n }\r\n return prodBase * prodMult;\r\n}\r\n\r\n//Process benefits from having an office party thrown\r\nEmployee.prototype.throwParty = function(money) {\r\n var mult = 1 + (money / 10e6);\r\n this.mor *= mult;\r\n this.mor = Math.min(100, this.mor);\r\n this.hap *= mult;\r\n this.hap = Math.min(100, this.hap);\r\n return mult;\r\n}\r\n\r\n//'panel' is the DOM element on which to create the UI\r\nEmployee.prototype.createUI = function(panel, corporation) {\r\n var effCre = this.cre * corporation.getEmployeeCreMultiplier(),\r\n effCha = this.cha * corporation.getEmployeeChaMultiplier(),\r\n effInt = this.int * corporation.getEmployeeIntMultiplier(),\r\n effEff = this.eff * corporation.getEmployeeEffMultiplier();\r\n panel.style.color = \"white\";\r\n panel.appendChild(createElement(\"p\", {\r\n id:\"cmpy-mgmt-employee-\" + this.name + \"-panel-text\",\r\n innerHTML:\"Morale: \" + formatNumber(this.mor, 3) + \"<br>\" +\r\n \"Happiness: \" + formatNumber(this.hap, 3) + \"<br>\" +\r\n \"Energy: \" + formatNumber(this.ene, 3) + \"<br>\" +\r\n \"Age: \" + formatNumber(this.age, 3) + \"<br>\" +\r\n \"Intelligence: \" + formatNumber(effInt, 3) + \"<br>\" +\r\n \"Charisma: \" + formatNumber(effCha, 3) + \"<br>\" +\r\n \"Experience: \" + formatNumber(this.exp, 3) + \"<br>\" +\r\n \"Creativity: \" + formatNumber(effCre, 3) + \"<br>\" +\r\n \"Efficiency: \" + formatNumber(effEff, 3) + \"<br>\" +\r\n \"Salary: \" + numeral(this.sal).format(\"$0.000a\") + \"/ s<br>\",\r\n }));\r\n\r\n //Selector for employee position\r\n var selector = createElement(\"select\", {});\r\n for (var key in EmployeePositions) {\r\n if (EmployeePositions.hasOwnProperty(key)) {\r\n selector.add(createElement(\"option\", {\r\n text: EmployeePositions[key],\r\n value: EmployeePositions[key],\r\n }));\r\n }\r\n }\r\n\r\n selector.addEventListener(\"change\", ()=>{\r\n this.pos = selector.options[selector.selectedIndex].value;\r\n });\r\n\r\n //Set initial value of selector\r\n for (var i = 0; i < selector.length; ++i) {\r\n if (selector.options[i].value === this.pos) {\r\n selector.selectedIndex = i;\r\n break;\r\n }\r\n }\r\n panel.appendChild(selector);\r\n}\r\n\r\nEmployee.prototype.updateUI = function(panel, corporation) {\r\n var effCre = this.cre * corporation.getEmployeeCreMultiplier(),\r\n effCha = this.cha * corporation.getEmployeeChaMultiplier(),\r\n effInt = this.int * corporation.getEmployeeIntMultiplier(),\r\n effEff = this.eff * corporation.getEmployeeEffMultiplier();\r\n if (panel == null) {\r\n console.log(\"ERROR: Employee.updateUI() called with null panel\");\r\n return;\r\n }\r\n var text = document.getElementById(\"cmpy-mgmt-employee-\" + this.name + \"-panel-text\");\r\n if (text == null) {\r\n return this.createUI(panel);\r\n }\r\n text.innerHTML = \"Morale: \" + formatNumber(this.mor, 3) + \"<br>\" +\r\n \"Happiness: \" + formatNumber(this.hap, 3) + \"<br>\" +\r\n \"Energy: \" + formatNumber(this.ene, 3) + \"<br>\" +\r\n \"Age: \" + formatNumber(this.age, 3) + \"<br>\" +\r\n \"Intelligence: \" + formatNumber(effInt, 3) + \"<br>\" +\r\n \"Charisma: \" + formatNumber(effCha, 3) + \"<br>\" +\r\n \"Experience: \" + formatNumber(this.exp, 3) + \"<br>\" +\r\n \"Creativity: \" + formatNumber(effCre, 3) + \"<br>\" +\r\n \"Efficiency: \" + formatNumber(effEff, 3) + \"<br>\" +\r\n \"Salary: \" + numeral(this.sal).format(\"$0.000a\") + \"/ s<br>\";\r\n}\r\n\r\nEmployee.prototype.toJSON = function() {\r\n\treturn Generic_toJSON(\"Employee\", this);\r\n}\r\n\r\nEmployee.fromJSON = function(value) {\r\n\treturn Generic_fromJSON(Employee, value.data);\r\n}\r\n\r\nReviver.constructors.Employee = Employee;\r\n\r\nvar OfficeSpaceTiers = {\r\n Basic: \"Basic\",\r\n Enhanced: \"Enhanced\",\r\n Luxurious: \"Luxurious\",\r\n Extravagant: \"Extravagant\"\r\n}\r\n\r\nfunction OfficeSpace(params={}) {\r\n this.loc = params.loc ? params.loc : \"\";\r\n this.cost = params.cost ? params.cost : 1;\r\n this.size = params.size ? params.size : 1;\r\n this.comf = params.comfort ? params.comfort : 1;\r\n this.beau = params.beauty ? params.beauty : 1;\r\n this.tier = OfficeSpaceTiers.Basic;\r\n\r\n this.minEne = 0; //Minimum energy of employees, based on office\r\n this.minHap = 0; //Minimum happiness of employees, based on office.\r\n\r\n this.employees = [];\r\n this.employeeProd = {\r\n [EmployeePositions.Operations]: 0,\r\n [EmployeePositions.Engineer]: 0,\r\n [EmployeePositions.Business]: 0,\r\n [EmployeePositions.Management]: 0,\r\n [EmployeePositions.RandD]: 0,\r\n total: 0,\r\n };\r\n}\r\n\r\nOfficeSpace.prototype.process = function(marketCycles=1, parentRefs) {\r\n var corporation = parentRefs.corporation, industry = parentRefs.industry;\r\n var perfMult=1; //Multiplier for employee morale/happiness/energy based on company performance\r\n if (industry.funds < 0 && industry.lastCycleRevenue < 0) {\r\n perfMult = Math.pow(0.99, marketCycles);\r\n } else if (industry.funds > 0 && industry.lastCycleRevenue > 0) {\r\n perfMult = Math.pow(1.01, marketCycles);\r\n }\r\n\r\n var salaryPaid = 0;\r\n for (var i = 0; i < this.employees.length; ++i) {\r\n var emp = this.employees[i];\r\n emp.mor *= perfMult;\r\n emp.hap *= perfMult;\r\n emp.ene *= perfMult;\r\n var salary = emp.process(marketCycles, this);\r\n salaryPaid += salary;\r\n }\r\n this.calculateEmployeeProductivity(marketCycles, corporation);\r\n return salaryPaid;\r\n}\r\n\r\nOfficeSpace.prototype.calculateEmployeeProductivity = function(marketCycles=1, corporation) {\r\n //Reset\r\n for (var name in this.employeeProd) {\r\n if (this.employeeProd.hasOwnProperty(name)) {\r\n this.employeeProd[name] = 0;\r\n }\r\n }\r\n\r\n var total = 0;\r\n for (var i = 0; i < this.employees.length; ++i) {\r\n var employee = this.employees[i];\r\n var prod = employee.calculateProductivity(corporation);\r\n this.employeeProd[employee.pos] += prod;\r\n total += prod;\r\n }\r\n this.employeeProd[\"total\"] = total;\r\n}\r\n\r\n//Takes care of UI as well\r\nOfficeSpace.prototype.findEmployees = function(parentRefs) {\r\n var company = parentRefs.corporation, division = parentRefs.division;\r\n if (document.getElementById(\"cmpy-mgmt-hire-employee-popup\") != null) {return;}\r\n\r\n //Generate three random employees (meh, decent, amazing)\r\n var mult1 = getRandomInt(25, 50)/100,\r\n mult2 = getRandomInt(51, 75)/100,\r\n mult3 = getRandomInt(76, 100)/100;\r\n var int = getRandomInt(50, 100),\r\n cha = getRandomInt(50, 100),\r\n exp = getRandomInt(50, 100),\r\n cre = getRandomInt(50, 100),\r\n eff = getRandomInt(50, 100),\r\n sal = 2.2 * (int + cha + exp + cre + eff);\r\n\r\n var emp1 = new Employee({\r\n intelligence: int * mult1,\r\n charisma: cha * mult1,\r\n experience: exp * mult1,\r\n creativity: cre * mult1,\r\n efficiency: eff * mult1,\r\n salary: sal * mult1,\r\n });\r\n\r\n var emp2 = new Employee({\r\n intelligence: int * mult2,\r\n charisma: cha * mult2,\r\n experience: exp * mult2,\r\n creativity: cre * mult2,\r\n efficiency: eff * mult2,\r\n salary: sal * mult2,\r\n });\r\n\r\n var emp3 = new Employee({\r\n intelligence: int * mult3,\r\n charisma: cha * mult3,\r\n experience: exp * mult3,\r\n creativity: cre * mult3,\r\n efficiency: eff * mult3,\r\n salary: sal * mult3,\r\n });\r\n\r\n var text = createElement(\"h1\", {\r\n innerHTML: \"Select one of the following candidates for hire:\",\r\n });\r\n\r\n var createEmpDiv = function(employee, office) {\r\n var div = createElement(\"div\", {\r\n class:\"cmpy-mgmt-find-employee-option\",\r\n innerHTML: \"Intelligence: \" + formatNumber(employee.int, 1) + \"<br>\" +\r\n \"Charisma: \" + formatNumber(employee.cha, 1) + \"<br>\" +\r\n \"Experience: \" + formatNumber(employee.exp, 1) + \"<br>\" +\r\n \"Creativity: \" + formatNumber(employee.cre, 1) + \"<br>\" +\r\n \"Efficiency: \" + formatNumber(employee.eff, 1) + \"<br>\" +\r\n \"Salary: \" + numeral(employee.sal).format('$0.000a') + \" \\ s<br>\",\r\n clickListener:()=>{\r\n office.hireEmployee(employee, parentRefs);\r\n removeElementById(\"cmpy-mgmt-hire-employee-popup\");\r\n return false;\r\n }\r\n });\r\n return div;\r\n };\r\n\r\n var cancelBtn = createElement(\"a\", {\r\n class:\"a-link-button\",\r\n innerText:\"Cancel\",\r\n float:\"right\",\r\n clickListener:()=>{\r\n removeElementById(\"cmpy-mgmt-hire-employee-popup\");\r\n return false;\r\n }\r\n });\r\n\r\n var elems = [text,\r\n createEmpDiv(emp1, this),\r\n createEmpDiv(emp2, this),\r\n createEmpDiv(emp3, this),\r\n cancelBtn];\r\n\r\n createPopup(\"cmpy-mgmt-hire-employee-popup\", elems);\r\n}\r\n\r\nOfficeSpace.prototype.hireEmployee = function(employee, parentRefs) {\r\n var company = parentRefs.corporation, division = parentRefs.division;\r\n var yesBtn = yesNoTxtInpBoxGetYesButton(),\r\n noBtn = yesNoTxtInpBoxGetNoButton();\r\n yesBtn.innerHTML = \"Hire\";\r\n noBtn.innerHTML = \"Cancel\";\r\n yesBtn.addEventListener(\"click\", ()=>{\r\n var name = yesNoTxtInpBoxGetInput();\r\n for (var i = 0; i < this.employees.length; ++i) {\r\n if (this.employees[i].name === name) {\r\n dialogBoxCreate(\"You already have an employee with this nickname! Please give every employee a unique nickname.\");\r\n return false;\r\n }\r\n }\r\n employee.name = name;\r\n this.employees.push(employee);\r\n company.displayDivisionContent(division, currentCityUi);\r\n return yesNoTxtInpBoxClose();\r\n });\r\n noBtn.addEventListener(\"click\", ()=>{\r\n return yesNoTxtInpBoxClose();\r\n });\r\n yesNoTxtInpBoxCreate(\"Give your employee a nickname!\");\r\n}\r\n\r\nOfficeSpace.prototype.hireRandomEmployee = function(parentRefs) {\r\n var company = parentRefs.corporation, division = parentRefs.division;\r\n if (document.getElementById(\"cmpy-mgmt-hire-employee-popup\") != null) {return;}\r\n\r\n //Generate three random employees (meh, decent, amazing)\r\n var mult = getRandomInt(76, 100)/100;\r\n var int = getRandomInt(50, 100),\r\n cha = getRandomInt(50, 100),\r\n exp = getRandomInt(50, 100),\r\n cre = getRandomInt(50, 100),\r\n eff = getRandomInt(50, 100),\r\n sal = 2.2 * (int + cha + exp + cre + eff);\r\n\r\n var emp = new Employee({\r\n intelligence: int * mult,\r\n charisma: cha * mult,\r\n experience: exp * mult,\r\n creativity: cre * mult,\r\n efficiency: eff * mult,\r\n salary: sal * mult,\r\n });\r\n\r\n var name = generateRandomString(7);\r\n\r\n for (var i = 0; i < this.employees.length; ++i) {\r\n if (this.employees[i].name === name) {\r\n return this.hireRandomEmployee(parentRefs);\r\n }\r\n }\r\n emp.name = name;\r\n this.employees.push(emp);\r\n company.displayDivisionContent(division, currentCityUi);\r\n}\r\n\r\n//Finds the first unassigned employee and assigns its to the specified job\r\nOfficeSpace.prototype.assignEmployeeToJob = function(job) {\r\n for (var i = 0; i < this.employees.length; ++i) {\r\n if (this.employees[i].pos === EmployeePositions.Unassigned) {\r\n this.employees[i].pos = job;\r\n return true;\r\n }\r\n }\r\n return false;\r\n}\r\n\r\n//Finds the first employee with the given job and unassigns it\r\nOfficeSpace.prototype.unassignEmployeeFromJob = function(job) {\r\n for (var i = 0; i < this.employees.length; ++i) {\r\n if (this.employees[i].pos === job) {\r\n this.employees[i].pos = EmployeePositions.Unassigned;\r\n return true;\r\n }\r\n }\r\n return false;\r\n}\r\n\r\nOfficeSpace.prototype.toJSON = function() {\r\n\treturn Generic_toJSON(\"OfficeSpace\", this);\r\n}\r\n\r\nOfficeSpace.fromJSON = function(value) {\r\n\treturn Generic_fromJSON(OfficeSpace, value.data);\r\n}\r\n\r\nReviver.constructors.OfficeSpace = OfficeSpace;\r\n\r\nfunction Warehouse(params={}) {\r\n this.loc = params.loc ? params.loc : \"\";\r\n this.size = params.size ? params.size : 0;\r\n this.level = 0;\r\n this.sizeUsed = 0;\r\n this.smartSupplyEnabled = false; //Whether or not smart supply is enabled\r\n this.breakdown = \"\";\r\n\r\n //Stores the amount of product to be produced. Used for Smart Supply unlock.\r\n //The production tracked by smart supply is always based on the previous cycle,\r\n //so it will always trail the \"true\" production by 1 cycle\r\n this.smartSupplyStore = 0;\r\n\r\n this.materials = {\r\n Water: new Material({name: \"Water\"}),\r\n Energy: new Material({name: \"Energy\"}),\r\n Food: new Material({name: \"Food\"}),\r\n Plants: new Material({name: \"Plants\"}),\r\n Metal: new Material({name: \"Metal\"}),\r\n Hardware: new Material({name: \"Hardware\"}),\r\n Chemicals: new Material({name: \"Chemicals\"}),\r\n Drugs: new Material({name: \"Drugs\"}),\r\n Robots: new Material({name: \"Robots\"}),\r\n AICores: new Material({name: \"AI Cores\"}),\r\n RealEstate: new Material({name: \"Real Estate\"})\r\n }\r\n}\r\n\r\nWarehouse.prototype.updateMaterialSizeUsed = function() {\r\n this.sizeUsed = 0;\r\n this.breakdown = \"\";\r\n for (var matName in this.materials) {\r\n if (this.materials.hasOwnProperty(matName)) {\r\n var mat = this.materials[matName];\r\n if (MaterialSizes.hasOwnProperty(matName)) {\r\n this.sizeUsed += (mat.qty * MaterialSizes[matName]);\r\n if (mat.qty > 0) {\r\n this.breakdown += (matName + \": \" + formatNumber(mat.qty * MaterialSizes[matName], 0) + \"<br>\");\r\n }\r\n }\r\n }\r\n }\r\n if (this.sizeUsed > this.size) {\r\n console.log(\"ERROR: Warehouse size used greater than capacity, something went wrong\");\r\n }\r\n}\r\n\r\nWarehouse.prototype.updateSize = function(corporation) {\r\n //Backwards compatibility\r\n if (this.level == null || this.level === 0) {\r\n this.level = Math.round(this.size / 100);\r\n }\r\n\r\n this.size = (this.level * 100) * corporation.getStorageMultiplier();\r\n}\r\n\r\nWarehouse.prototype.createUI = function(parentRefs) {\r\n if (parentRefs.company == null || parentRefs.industry == null) {\r\n console.log(\"ERROR: Warehouse.createUI called without parentRefs.company or parentRefs.industry\");\r\n return;\r\n }\r\n var company = parentRefs.company, industry = parentRefs.industry;\r\n removeChildrenFromElement(industryWarehousePanel);\r\n industryWarehouseStorageText = createElement(\"p\", {\r\n display:\"inline-block\", class:\"tooltip\",\r\n color: this.sizeUsed >= this.size ? \"red\" : \"white\",\r\n });\r\n industryWarehousePanel.appendChild(industryWarehouseStorageText);\r\n\r\n //Upgrade warehouse size button\r\n var upgradeCost = WarehouseUpgradeBaseCost * Math.pow(1.07, this.level+1);\r\n industryWarehouseUpgradeSizeButton = createElement(\"a\", {\r\n innerText:\"Upgrade Warehouse Size - \" + numeral(upgradeCost).format('$0.000a'),\r\n display:\"inline-block\",\r\n class: company.funds.lt(upgradeCost) ? \"a-link-button-inactive\" : \"a-link-button\",\r\n clickListener:()=>{\r\n //Backwards compatibility\r\n if (this.level == null || this.level === 0) {\r\n this.level = Math.round(this.size / 100);\r\n }\r\n\r\n ++this.level;\r\n this.updateSize(company);\r\n company.funds = company.funds.minus(upgradeCost);\r\n this.createUI(parentRefs);\r\n return;\r\n }\r\n });\r\n industryWarehousePanel.appendChild(industryWarehouseUpgradeSizeButton);\r\n\r\n //Material requirement text\r\n var reqText = \"This Industry uses [\" + Object.keys(industry.reqMats).join(\", \") +\r\n \"] in order to \";\r\n if (industry.prodMats.length > 0) {\r\n reqText += \"produce [\" + industry.prodMats.join(\", \") + \"] \";\r\n if (industry.makesProducts) {\r\n reqText += \" and \" + industry.getProductDescriptionText();\r\n }\r\n } else if (industry.makesProducts) {\r\n reqText += industry.getProductDescriptionText();\r\n }\r\n reqText += \"<br><br>To get started with production, purchase your required \" +\r\n \"materials or import them from another of your company's divisions.<br><br>\";\r\n\r\n //Material ratio text for tooltip\r\n var reqRatioText = \"The exact requirements for production are:<br>\";\r\n for (var matName in industry.reqMats) {\r\n if (industry.reqMats.hasOwnProperty(matName)) {\r\n reqRatioText += (industry.reqMats[matName] + \" \" + matName + \"<br>\");\r\n }\r\n }\r\n reqRatioText += \"in order to create \";\r\n if (industry.prodMats.length > 0) {\r\n reqRatioText += \"one of each produced Material (\" + industry.prodMats.join(\", \") + \") \";\r\n if (industry.makesProducts) {\r\n reqRatioText += \"or to create one of its Products\";\r\n }\r\n } else if (industry.makesProducts) {\r\n reqRatioText += \"one of its Products\";\r\n }\r\n\r\n industryWarehousePanel.appendChild(createElement(\"p\", {\r\n innerHTML:reqText, tooltipleft:reqRatioText\r\n }));\r\n\r\n //Current state\r\n industryWarehouseStateText = createElement(\"p\");\r\n industryWarehousePanel.appendChild(industryWarehouseStateText);\r\n\r\n //Smart Supply Enable/Disable\r\n if (company.unlockUpgrades[1]) {\r\n if (this.smartSupplyEnabled == null) {this.smartSupplyEnabled = false;}\r\n var smartSupplyCheckboxId = \"cmpy-mgmt-smart-supply-checkbox\";\r\n industryWarehousePanel.appendChild(createElement(\"label\", {\r\n for:smartSupplyCheckboxId, innerText:\"Enable Smart Supply\",\r\n color:\"white\"\r\n }));\r\n industrySmartSupplyCheckbox = createElement(\"input\", {\r\n type:\"checkbox\", id:smartSupplyCheckboxId, margin:\"3px\",\r\n changeListener:()=>{\r\n this.smartSupplyEnabled = industrySmartSupplyCheckbox.checked;\r\n }\r\n });\r\n industrySmartSupplyCheckbox.checked = this.smartSupplyEnabled;\r\n industryWarehousePanel.appendChild(industrySmartSupplyCheckbox);\r\n }\r\n\r\n //Materials\r\n industryWarehousePanel.appendChild(createElement(\"p\", {\r\n innerHTML: \"<br>Materials:<br>\",\r\n }));\r\n industryWarehouseMaterials = createElement(\"ul\");\r\n industryWarehousePanel.appendChild(industryWarehouseMaterials);\r\n\r\n //Products\r\n if (industry.makesProducts && Object.keys(industry.products).length > 0) {\r\n industryWarehousePanel.appendChild(createElement(\"p\", {\r\n innerHTML: \"<br>Products:<br>\",\r\n }));\r\n industryWarehouseProducts = createElement(\"ul\");\r\n industryWarehousePanel.appendChild(industryWarehouseProducts);\r\n }\r\n\r\n this.updateUI(parentRefs);\r\n}\r\n\r\nWarehouse.prototype.updateUI = function(parentRefs) {\r\n if (parentRefs.company == null || parentRefs.industry == null) {\r\n console.log(\"ERROR: Warehouse.updateUI called without parentRefs.company or parentRefs.industry\");\r\n return;\r\n }\r\n var company = parentRefs.company, industry = parentRefs.industry;\r\n\r\n //Storage text\r\n var storageText = \"Storage: \" +\r\n (this.sizedUsed >= this.size ? formatNumber(this.sizeUsed, 3) : formatNumber(this.sizeUsed, 3)) +\r\n \"/\" + formatNumber(this.size, 3);\r\n if (this.breakdown != null && this.breakdown != \"\") {\r\n storageText += (\"<span class='tooltiptext'>\" +\r\n this.breakdown + \"</span>\");\r\n }\r\n industryWarehouseStorageText.innerHTML = storageText;\r\n\r\n //Upgrade warehouse size button\r\n var upgradeCost = WarehouseUpgradeBaseCost * Math.pow(1.07, this.level+1);\r\n if (company.funds.lt(upgradeCost)) {\r\n industryWarehouseUpgradeSizeButton.className = \"a-link-button-inactive\";\r\n } else {\r\n industryWarehouseUpgradeSizeButton.className = \"a-link-button\";\r\n }\r\n\r\n //Current state\r\n var stateText = \"Current state: \";\r\n switch(industry.state) {\r\n case \"START\":\r\n stateText += \"Preparing...\";\r\n break;\r\n case \"PURCHASE\":\r\n stateText += \"Purchasing materials...\";\r\n break;\r\n case \"PRODUCTION\":\r\n stateText += \"Producing materials and/or products...\";\r\n break;\r\n case \"SALE\":\r\n stateText += \"Selling materials and/or products...\";\r\n break;\r\n case \"EXPORT\":\r\n stateText += \"Exporting materials and/or products...\";\r\n break;\r\n default:\r\n console.log(\"ERROR: Invalid state: \" + industry.state);\r\n break;\r\n }\r\n industryWarehouseStateText.innerText = stateText;\r\n\r\n //Materials\r\n removeChildrenFromElement(industryWarehouseMaterials);\r\n for (var matName in this.materials) {\r\n if (this.materials.hasOwnProperty(matName) && this.materials[matName] instanceof Material) {\r\n if (Object.keys(industry.reqMats).includes(matName) || industry.prodMats.includes(matName) ||\r\n matName === \"Hardware\" || matName === \"Robots\" || matName === \"AICores\" ||\r\n matName === \"RealEstate\") {\r\n industryWarehouseMaterials.appendChild(this.createMaterialUI(this.materials[matName], matName, parentRefs));\r\n }\r\n }\r\n }\r\n\r\n //Products\r\n removeChildrenFromElement(industryWarehouseProducts);\r\n if (industry.makesProducts && Object.keys(industry.products).length > 0) {\r\n for (var productName in industry.products) {\r\n if (industry.products.hasOwnProperty(productName) && industry.products[productName] instanceof Product) {\r\n industryWarehouseProducts.appendChild(this.createProductUI(industry.products[productName], parentRefs));\r\n }\r\n }\r\n }\r\n}\r\n\r\nWarehouse.prototype.createMaterialUI = function(mat, matName, parentRefs) {\r\n if (parentRefs.company == null || parentRefs.industry == null) {\r\n console.log(\"ERROR: Warehouse.createMaterialUI called without industry or company parent refs\");\r\n return;\r\n }\r\n var company = parentRefs.company, industry = parentRefs.industry;\r\n var purchasePopupId = \"cmpy-mgmt-material-purchase-popup\",\r\n sellPopupid = \"cmpy-mgmt-material-sell-popup\";\r\n var div = createElement(\"div\", {\r\n class:\"cmpy-mgmt-warehouse-material-div\",\r\n });\r\n\r\n var totalGain = mat.buy + mat.prd + mat.imp - mat.sll - mat.totalExp;\r\n\r\n //If Market Research upgrades are unlocked, add competition and demand info\r\n var cmpAndDmdText = \"\";\r\n if (company.unlockUpgrades[2] === 1) {\r\n cmpAndDmdText += \"<br>Competition: \" + formatNumber(mat.cmp, 3);\r\n }\r\n if (company.unlockUpgrades[3] === 1) {\r\n cmpAndDmdText += \"<br>Demand: \" + formatNumber(mat.dmd, 3);\r\n }\r\n var innerTxt = \"<p class='tooltip'>\" + mat.name + \": \" + formatNumber(mat.qty, 3) +\r\n \"(\" + formatNumber(totalGain, 3) + \"/s)\" +\r\n \"<span class='tooltiptext'>Buy: \" + formatNumber(mat.buy, 3) +\r\n \"/s<br>Prod: \" + formatNumber(mat.prd, 3) + \"/s<br>Sell: \" + formatNumber(mat.sll, 3) +\r\n \"/s<br>Export: \" + formatNumber(mat.totalExp, 3) + \"/s<br>Import: \" +\r\n formatNumber(mat.imp, 3) + \"/s\" + cmpAndDmdText + \"</span></p><br>\" +\r\n \"<p class='tooltip'>MP: $\" + formatNumber(mat.bCost, 2) +\r\n \"<span class='tooltiptext'>Market Price: The price you would pay if \" +\r\n \"you were to buy this material on the market</span></p><br>\" +\r\n \"<p class='tooltip'>Quality: \" + formatNumber(mat.qlt, 2) +\r\n \"<span class='tooltiptext'>The quality of your material. Higher quality \" +\r\n \"will lead to more sales</span></p>\";\r\n\r\n div.appendChild(createElement(\"p\", {\r\n innerHTML: innerTxt,\r\n id: \"cmpy-mgmt-warehouse-\" + matName + \"-text\", display:\"inline-block\",\r\n }));\r\n\r\n var buttonPanel = createElement(\"div\", {\r\n display:\"inline-block\",\r\n });\r\n div.appendChild(buttonPanel);\r\n\r\n //Button to set purchase amount\r\n var tutorial = industry.newInd && Object.keys(industry.reqMats).includes(mat.name) &&\r\n mat.buy === 0 && mat.imp === 0;\r\n var buyButtonParams = {\r\n innerText: \"Buy (\" + formatNumber(mat.buy, 3) + \")\", display:\"inline-block\",\r\n class: tutorial ? \"a-link-button flashing-button\" : \"a-link-button\",\r\n clickListener:()=>{\r\n var txt = createElement(\"p\", {\r\n innerHTML: \"Enter the amount of \" + mat.name + \" you would like \" +\r\n \"to purchase per second. This material's cost changes constantly\"\r\n });\r\n var confirmBtn;\r\n var input = createElement(\"input\", {\r\n type:\"number\", value:mat.buy ? mat.buy : null, placeholder: \"Purchase amount\",\r\n onkeyup:(e)=>{\r\n e.preventDefault();\r\n if (e.keyCode === 13) {confirmBtn.click();}\r\n }\r\n });\r\n confirmBtn = createElement(\"a\", {\r\n innerText:\"Confirm\", class:\"a-link-button\",\r\n clickListener:()=>{\r\n if (isNaN(input.value)) {\r\n dialogBoxCreate(\"Invalid amount\");\r\n } else {\r\n mat.buy = parseFloat(input.value);\r\n if (isNaN(mat.buy)) {mat.buy = 0;}\r\n removeElementById(purchasePopupId);\r\n this.createUI(parentRefs);\r\n return false;\r\n }\r\n }\r\n });\r\n var clearButton = createElement(\"a\", {\r\n innerText:\"Clear Purchase\", class:\"a-link-button\",\r\n clickListener:()=>{\r\n mat.buy = 0;\r\n removeElementById(purchasePopupId);\r\n this.createUI(parentRefs);\r\n return false;\r\n }\r\n });\r\n var cancelBtn = createElement(\"a\", {\r\n innerText:\"Cancel\", class:\"a-link-button\",\r\n clickListener:()=>{\r\n removeElementById(purchasePopupId);\r\n }\r\n });\r\n createPopup(purchasePopupId, [txt, input, confirmBtn, clearButton, cancelBtn]);\r\n input.focus();\r\n }\r\n };\r\n if (tutorial) {\r\n buyButtonParams.tooltip = \"Purchase your required materials to get production started!\";\r\n }\r\n buttonPanel.appendChild(createElement(\"a\", buyButtonParams));\r\n\r\n //Button to manage exports\r\n if (company.unlockUpgrades[0] === 1) { //Export unlock upgrade\r\n function createExportPopup() {\r\n var popupId = \"cmpy-mgmt-export-popup\";\r\n var exportTxt = createElement(\"p\", {\r\n innerText:\"Select the industry and city to export this material to, as well as \" +\r\n \"how much of this material to export per second. You can set the export \" +\r\n \"amount to 'MAX' to export all of the materials in this warehouse.\"\r\n });\r\n\r\n //Select industry and city to export to\r\n var citySelector = createElement(\"select\");\r\n var industrySelector = createElement(\"select\", {\r\n changeListener:()=>{\r\n var industryName = industrySelector.options[industrySelector.selectedIndex].value;\r\n for (var foo = 0; foo < company.divisions.length; ++foo) {\r\n if (company.divisions[foo].name == industryName) {\r\n clearSelector(citySelector);\r\n var selectedIndustry = company.divisions[foo];\r\n for (var cityName in company.divisions[foo].warehouses) {\r\n if (company.divisions[foo].warehouses[cityName] instanceof Warehouse) {\r\n citySelector.add(createElement(\"option\", {\r\n value:cityName, text:cityName,\r\n }));\r\n }\r\n }\r\n return;\r\n }\r\n }\r\n }\r\n });\r\n\r\n for (var i = 0; i < company.divisions.length; ++i) {\r\n industrySelector.add(createElement(\"option\", {\r\n text:company.divisions[i].name, value:company.divisions[i].name,\r\n })); //End create element option\r\n } //End for\r\n\r\n var currIndustry = industrySelector.options[industrySelector.selectedIndex].value;\r\n for (var i = 0; i < company.divisions.length; ++i) {\r\n if (company.divisions[i].name == currIndustry) {\r\n for (var cityName in company.divisions[i].warehouses) {\r\n if (company.divisions[i].warehouses.hasOwnProperty(cityName) &&\r\n company.divisions[i].warehouses[cityName] instanceof Warehouse) {\r\n citySelector.add(createElement(\"option\", {\r\n value:cityName, text:cityName,\r\n }));\r\n }\r\n }\r\n break;\r\n }\r\n }\r\n\r\n //Select amount to export\r\n var exportAmount = createElement(\"input\", {\r\n placeholder:\"Export amount / s\"\r\n });\r\n\r\n var exportBtn = createElement(\"a\", {\r\n class:\"a-link-button\", display:\"inline-block\", innerText:\"Export\",\r\n clickListener:()=>{\r\n var industryName = industrySelector.options[industrySelector.selectedIndex].text,\r\n cityName = citySelector.options[citySelector.selectedIndex].text,\r\n amt = exportAmount.value;\r\n //Sanitize amt\r\n var sanitizedAmt = amt.replace(/\\s+/g, '');\r\n sanitizedAmt = sanitizedAmt.replace(/[^-()\\d/*+.MAX]/g, '');\r\n var temp = sanitizedAmt.replace(/MAX/g, 1);\r\n try {\r\n temp = eval(temp);\r\n } catch(e) {\r\n dialogBoxCreate(\"Invalid expression entered for export amount: \" + e);\r\n return false;\r\n }\r\n\r\n if (temp == null || isNaN(temp)) {\r\n dialogBoxCreate(\"Invalid amount entered for export\");\r\n return;\r\n }\r\n var exportObj = {ind:industryName, city:cityName, amt:sanitizedAmt};\r\n mat.exp.push(exportObj);\r\n removeElementById(popupId);\r\n return false;\r\n }\r\n });\r\n\r\n var cancelBtn = createElement(\"a\", {\r\n class:\"a-link-button\", display:\"inline-block\", innerText:\"Cancel\",\r\n clickListener:()=>{\r\n removeElementById(popupId);\r\n return false;\r\n }\r\n });\r\n\r\n var currExportsText = createElement(\"p\", {\r\n innerText:\"Below is a list of all current exports of this material from this warehouse. \" +\r\n \"Clicking on one of the exports below will REMOVE that export.\"\r\n });\r\n var currExports = [];\r\n for (var i = 0; i < mat.exp.length; ++i) {\r\n (function(i, mat, currExports){\r\n currExports.push(createElement(\"div\", {\r\n class:\"cmpy-mgmt-existing-export\",\r\n innerHTML: \"Industry: \" + mat.exp[i].ind + \"<br>\" +\r\n \"City: \" + mat.exp[i].city + \"<br>\" +\r\n \"Amount/s: \" + mat.exp[i].amt,\r\n clickListener:()=>{\r\n mat.exp.splice(i, 1); //Remove export object\r\n removeElementById(popupId);\r\n createExportPopup();\r\n }\r\n }));\r\n })(i, mat, currExports);\r\n }\r\n createPopup(popupId, [exportTxt, industrySelector, citySelector, exportAmount,\r\n exportBtn, cancelBtn, currExportsText].concat(currExports));\r\n }\r\n buttonPanel.appendChild(createElement(\"a\", {\r\n innerText:\"Export\", display:\"inline-block\", class:\"a-link-button\",\r\n clickListener:()=>{createExportPopup();}\r\n }));\r\n }\r\n\r\n buttonPanel.appendChild(createElement(\"br\", {})); // Force line break\r\n\r\n //Button to set sell amount\r\n var innerTextString;\r\n if (mat.sllman[0]) {\r\n innerTextString = (mat.sllman[1] === -1 ? \"Sell (\" + formatNumber(mat.sll, 3) + \"/MAX)\" :\r\n \"Sell (\" + formatNumber(mat.sll, 3) + \"/\" + formatNumber(mat.sllman[1], 3) + \")\");\r\n if (mat.sCost) {\r\n if (isString(mat.sCost)) {\r\n var sCost = mat.sCost.replace(/MP/g, mat.bCost);\r\n innerTextString += \" @ $\" + formatNumber(eval(sCost), 2);\r\n } else {\r\n innerTextString += \" @ $\" + formatNumber(mat.sCost, 2);\r\n }\r\n }\r\n } else {\r\n innerTextString = \"Sell (0.000/0.000)\";\r\n }\r\n\r\n buttonPanel.appendChild(createElement(\"a\", {\r\n innerText: innerTextString, display:\"inline-block\", class:\"a-link-button\",\r\n clickListener:()=>{\r\n var txt = createElement(\"p\", {\r\n innerHTML: \"Enter the maximum amount of \" + mat.name + \" you would like \" +\r\n \"to sell per second, as well as the price at which you would \" +\r\n \"like to sell at.<br><br>\" +\r\n \"If the sell amount is set to 0, then the material will not be sold. If the sell price \" +\r\n \"if set to 0, then the material will be discarded<br><br>\" +\r\n \"Setting the sell amount to 'MAX' will result in you always selling the \" +\r\n \"maximum possible amount of the material.<br><br>\" +\r\n \"When setting the sell amount, you can use the 'PROD' variable to designate a dynamically \" +\r\n \"changing amount that depends on your production. For example, if you set the sell amount \" +\r\n \"to 'PROD-5' then you will always sell 5 less of the material than you produce.<br><br>\" +\r\n \"When setting the sell price, you can use the 'MP' variable to designate a dynamically \" +\r\n \"changing price that depends on the market price. For example, if you set the sell price \" +\r\n \"to 'MP+10' then it will always be sold at $10 above the market price.\",\r\n });\r\n var br = createElement(\"br\", {});\r\n var confirmBtn;\r\n var inputQty = createElement(\"input\", {\r\n type:\"text\", marginTop:\"4px\",\r\n value: mat.sllman[1] ? mat.sllman[1] : null, placeholder: \"Sell amount\",\r\n onkeyup:(e)=>{\r\n e.preventDefault();\r\n if (e.keyCode === 13) {confirmBtn.click();}\r\n }\r\n });\r\n var inputPx = createElement(\"input\", {\r\n type:\"text\", marginTop:\"4px\",\r\n value: mat.sCost ? mat.sCost : null, placeholder: \"Sell price\",\r\n onkeyup:(e)=>{\r\n e.preventDefault();\r\n if (e.keyCode === 13) {confirmBtn.click();}\r\n }\r\n });\r\n confirmBtn = createElement(\"a\", {\r\n innerText:\"Confirm\", class:\"a-link-button\", margin:\"6px\",\r\n clickListener:()=>{\r\n //Parse price\r\n var cost = inputPx.value.replace(/\\s+/g, '');\r\n cost = cost.replace(/[^-()\\d/*+.MP]/g, ''); //Sanitize cost\r\n var temp = cost.replace(/MP/g, mat.bCost);\r\n try {\r\n temp = eval(temp);\r\n } catch(e) {\r\n dialogBoxCreate(\"Invalid value or expression for sell price field: \" + e);\r\n return false;\r\n }\r\n\r\n if (temp == null || isNaN(temp)) {\r\n dialogBoxCreate(\"Invalid value or expression for sell price field\");\r\n return false;\r\n }\r\n\r\n if (cost.includes(\"MP\")) {\r\n mat.sCost = cost; //Dynamically evaluated\r\n } else {\r\n mat.sCost = temp;\r\n }\r\n\r\n //Parse quantity\r\n if (inputQty.value.includes(\"MAX\") || inputQty.value.includes(\"PROD\")) {\r\n var qty = inputQty.value.replace(/\\s+/g, '');\r\n qty = qty.replace(/[^-()\\d/*+.MAXPROD]/g, '');\r\n var temp = qty.replace(/MAX/g, 1);\r\n temp = temp.replace(/PROD/g, 1);\r\n try {\r\n temp = eval(temp);\r\n } catch(e) {\r\n dialogBoxCreate(\"Invalid value or expression for sell price field: \" + e);\r\n return false;\r\n }\r\n\r\n if (temp == null || isNaN(temp)) {\r\n dialogBoxCreate(\"Invalid value or expression for sell price field\");\r\n return false;\r\n }\r\n\r\n mat.sllman[0] = true;\r\n mat.sllman[1] = qty; //Use sanitized input\r\n } else if (isNaN(inputQty.value)) {\r\n dialogBoxCreate(\"Invalid value for sell quantity field! Must be numeric or 'MAX'\");\r\n return false;\r\n } else {\r\n var qty = parseFloat(inputQty.value);\r\n if (isNaN(qty)) {qty = 0;}\r\n if (qty === 0) {\r\n mat.sllman[0] = false;\r\n mat.sllman[1] = 0;\r\n } else {\r\n mat.sllman[0] = true;\r\n mat.sllman[1] = qty;\r\n }\r\n }\r\n\r\n this.createUI(parentRefs);\r\n removeElementById(sellPopupid);\r\n return false;\r\n }\r\n });\r\n var cancelBtn = createElement(\"a\", {\r\n innerText:\"Cancel\", class:\"a-link-button\", margin: \"6px\",\r\n clickListener:()=>{\r\n removeElementById(sellPopupid);\r\n }\r\n });\r\n createPopup(sellPopupid, [txt, br, inputQty, inputPx, confirmBtn, cancelBtn]);\r\n inputQty.focus();\r\n }\r\n }));\r\n\r\n return div;\r\n}\r\n\r\nWarehouse.prototype.createProductUI = function(product, parentRefs) {\r\n var company = parentRefs.company, industry = parentRefs.industry,\r\n city = currentCityUi;\r\n var div = createElement(\"div\", {\r\n class:\"cmpy-mgmt-warehouse-product-div\"\r\n });\r\n\r\n //Products being designed TODO\r\n if (!product.fin) {\r\n div.appendChild(createElement(\"p\", {\r\n innerHTML: \"Designing \" + product.name + \"...<br>\" +\r\n formatNumber(product.prog, 2) + \"% complete\",\r\n }));\r\n return div;\r\n }\r\n\r\n //Completed products\r\n var cmpAndDmdText = \"\";\r\n if (company.unlockUpgrades[2] === 1) {\r\n cmpAndDmdText += \"<br>Competition: \" + formatNumber(product.cmp, 3);\r\n }\r\n if (company.unlockUpgrades[3] === 1) {\r\n cmpAndDmdText += \"<br>Demand: \" + formatNumber(product.dmd, 3);\r\n }\r\n var totalGain = product.data[city][1] - product.data[city][2]; //Production - sale\r\n div.appendChild(createElement(\"p\", {\r\n innerHTML: \"<p class='tooltip'>\" + product.name + \": \" + formatNumber(product.data[city][0], 3) + //Quantity\r\n \"(\" + formatNumber(totalGain, 3) + \"/s)\" +\r\n \"<span class='tooltiptext'>Prod: \" + formatNumber(product.data[city][1], 3) + \"/s<br>\" +\r\n \"Sell: \" + formatNumber(product.data[city][2], 3) + \"/s</span></p><br>\" +\r\n \"<p class='tooltip'>Rating: \" + formatNumber(product.rat, 3) +\r\n \"<span class='tooltiptext'>Quality: \" + formatNumber(product.qlt, 3) + \"<br>\" +\r\n \"Performance: \" + formatNumber(product.per, 3) + \"<br>\" +\r\n \"Durability: \" + formatNumber(product.dur, 3) + \"<br>\" +\r\n \"Reliability: \" + formatNumber(product.rel, 3) + \"<br>\" +\r\n \"Aesthetics: \" + formatNumber(product.aes, 3) + \"<br>\" +\r\n \"Features: \" + formatNumber(product.fea, 3) +\r\n cmpAndDmdText + \"</span></p><br>\" +\r\n \"<p class='tooltip'>Est. Production Cost: \" + numeral(product.pCost / ProductProductionCostRatio).format(\"$0.000a\") +\r\n \"<span class='tooltiptext'>An estimate of the material cost it takes to create this Product.</span></p><br>\" +\r\n \"<p class='tooltip'>Est. Market Price: \" + numeral(product.pCost + product.rat / product.mku).format(\"$0.000a\") +\r\n \"<span class='tooltiptext'>An estimate of how much consumers are willing to pay for this product. \" +\r\n \"Setting the sale price above this may result in less sales. Setting the sale price below this may result \" +\r\n \"in more sales.</span></p>\"\r\n }));\r\n var buttonPanel = createElement(\"div\", {\r\n display:\"inline-block\",\r\n });\r\n div.appendChild(buttonPanel);\r\n\r\n //Sell button\r\n var sellInnerTextString = (product.sllman[city][1] === -1 ? \"Sell (\" + formatNumber(product.data[city][2], 3) + \"/MAX)\" :\r\n \"Sell (\" + formatNumber(product.data[city][2], 3) + \"/\" + formatNumber(product.sllman[city][1], 3) + \")\");\r\n if (product.sCost) {\r\n if (isString(product.sCost)) {\r\n sellInnerTextString += (\" @ \" + product.sCost);\r\n } else {\r\n sellInnerTextString += (\" @ \" + numeral(product.sCost).format(\"$0.000a\"));\r\n }\r\n }\r\n div.appendChild(createElement(\"a\", {\r\n innerText:sellInnerTextString, class:\"a-link-button\", display:\"inline-block\",margin:\"6px\",\r\n clickListener:()=>{\r\n var popupId = \"cmpy-mgmt-sell-product-popup\";\r\n var txt = createElement(\"p\", {\r\n innerHTML:\"Enter the maximum amount of \" + product.name + \" you would like \" +\r\n \"to sell per second, as well as the price at which you would like to \" +\r\n \"sell it at.<br><br>\" +\r\n \"If the sell amount is set to 0, then the product will not be sold. If the \" +\r\n \"sell price is set to 0, then the product will be discarded.<br><br>\" +\r\n \"Setting the sell amount to 'MAX' will result in you always selling the \" +\r\n \"maximum possible amount of the material.<br><br>\" +\r\n \"When setting the sell amount, you can use the 'PROD' variable to designate a \" +\r\n \"dynamically changing amount that depends on your production. For example, \" +\r\n \"if you set the sell amount to 'PROD-1' then you will always sell 1 less of \" +\r\n \"the material than you produce.<br><br>\" +\r\n \"When setting the sell price, you can use the 'MP' variable to set a \" +\r\n \"dynamically changing price that depends on the Product's estimated \" +\r\n \"market price. For example, if you set it to 'MP*5' then it \" +\r\n \"will always be sold at five times the estimated market price.\",\r\n });\r\n var confirmBtn;\r\n var inputQty = createElement(\"input\", {\r\n type:\"text\", value:product.sllman[city][1] ? product.sllman[city][1] : null, placeholder: \"Sell amount\",\r\n onkeyup:(e)=>{\r\n e.preventDefault();\r\n if (e.keyCode === 13) {confirmBtn.click();}\r\n }\r\n });\r\n var inputPx = createElement(\"input\", {\r\n type:\"text\", value: product.sCost ? product.sCost : null, placeholder: \"Sell price\",\r\n onkeyup:(e)=>{\r\n e.preventDefault();\r\n if (e.keyCode === 13) {confirmBtn.click();}\r\n }\r\n });\r\n confirmBtn = createElement(\"a\", {\r\n class:\"a-link-button\", innerText:\"Confirm\",\r\n clickListener:()=>{\r\n //Parse price\r\n if (inputPx.value.includes(\"MP\")) {\r\n //Dynamically evaluated quantity. First test to make sure its valid\r\n //Sanitize input, then replace dynamic variables with arbitrary numbers\r\n var price = inputPx.value.replace(/\\s+/g, '');\r\n price = price.replace(/[^-()\\d/*+.MP]/g, '');\r\n var temp = price.replace(/MP/g, 1);\r\n try {\r\n temp = eval(temp);\r\n } catch(e) {\r\n dialogBoxCreate(\"Invalid value or expression for sell quantity field: \" + e);\r\n return false;\r\n }\r\n if (temp == null || isNaN(temp)) {\r\n dialogBoxCreate(\"Invalid value or expression for sell quantity field.\");\r\n return false;\r\n }\r\n product.sCost = price; //Use sanitized price\r\n } else {\r\n var cost = parseFloat(inputPx.value);\r\n if (isNaN(cost)) {\r\n dialogBoxCreate(\"Invalid value for sell price field\");\r\n return false;\r\n }\r\n product.sCost = cost;\r\n }\r\n\r\n //Parse quantity\r\n if (inputQty.value.includes(\"MAX\") || inputQty.value.includes(\"PROD\")) {\r\n //Dynamically evaluated quantity. First test to make sure its valid\r\n var qty = inputQty.value.replace(/\\s+/g, '');\r\n qty = qty.replace(/[^-()\\d/*+.MAXPROD]/g, '');\r\n var temp = qty.replace(/MAX/g, 1);\r\n temp = temp.replace(/PROD/g, 1);\r\n try {\r\n temp = eval(temp);\r\n } catch(e) {\r\n dialogBoxCreate(\"Invalid value or expression for sell price field: \" + e);\r\n return false;\r\n }\r\n\r\n if (temp == null || isNaN(temp)) {\r\n dialogBoxCreate(\"Invalid value or expression for sell price field\");\r\n return false;\r\n }\r\n product.sllman[city][0] = true;\r\n product.sllman[city][1] = qty; //Use sanitized input\r\n } else if (isNaN(inputQty.value)) {\r\n dialogBoxCreate(\"Invalid value for sell quantity field! Must be numeric\");\r\n return false;\r\n } else {\r\n var qty = parseFloat(inputQty.value);\r\n if (isNaN(qty)) {qty = 0;}\r\n if (qty === 0) {\r\n product.sllman[city][0] = false;\r\n } else {\r\n product.sllman[city][0] = true;\r\n product.sllman[city][1] = qty;\r\n }\r\n }\r\n this.createUI(parentRefs);\r\n removeElementById(popupId);\r\n return false;\r\n }\r\n });\r\n var cancelBtn = createElement(\"a\", {\r\n class:\"a-link-button\", innerText:\"Cancel\",\r\n clickListener:()=>{\r\n removeElementById(popupId);\r\n return false;\r\n }\r\n });\r\n createPopup(popupId, [txt, inputQty, inputPx, confirmBtn, cancelBtn]);\r\n inputQty.focus();\r\n }\r\n }));\r\n div.appendChild(createElement(\"br\",{})); //force line break\r\n\r\n //Limit production button\r\n var limitProductionInnerText = \"Limit Production\";\r\n if (product.prdman[city][0]) {\r\n limitProductionInnerText += \" (\" + formatNumber(product.prdman[city][1], 3) + \")\";\r\n }\r\n div.appendChild(createElement(\"a\", {\r\n class:\"a-link-button\", innerText:limitProductionInnerText,display:\"inline-block\",\r\n clickListener:()=>{\r\n var popupId = \"cmpy-mgmt-limit-product-production-popup\";\r\n var txt = createElement(\"p\", {\r\n innerText:\"Enter a limit to the amount of this product you would \" +\r\n \"like to product per second. Leave the box empty to set no limit.\"\r\n });\r\n var confirmBtn;\r\n var input = createElement(\"input\", {\r\n type:\"number\", placeholder:\"Limit\",\r\n onkeyup:(e)=>{\r\n e.preventDefault();\r\n if (e.keyCode === 13) {confirmBtn.click();}\r\n }\r\n });\r\n confirmBtn = createElement(\"a\", {\r\n class:\"a-link-button\", display:\"inline-block\", innerText:\"Limit production\", margin:'6px',\r\n clickListener:()=>{\r\n if (input.value === \"\") {\r\n product.prdman[city][0] = false;\r\n removeElementById(popupId);\r\n return false;\r\n }\r\n var qty = parseFloat(input.value);\r\n if (isNaN(qty)) {\r\n dialogBoxCreate(\"Invalid value entered\");\r\n return false;\r\n }\r\n if (qty < 0) {\r\n product.prdman[city][0] = false;\r\n } else {\r\n product.prdman[city][0] = true;\r\n product.prdman[city][1] = qty;\r\n }\r\n removeElementById(popupId);\r\n return false;\r\n }\r\n });\r\n var cancelBtn = createElement(\"a\", {\r\n class:\"a-link-button\", display:\"inline-block\", innerText:\"Cancel\", margin:\"6px\",\r\n clickListener:()=>{\r\n removeElementById(popupId);\r\n return false;\r\n }\r\n });\r\n createPopup(popupId, [txt, input, confirmBtn, cancelBtn]);\r\n }\r\n }));\r\n\r\n //Discontinue button\r\n div.appendChild(createElement(\"a\", {\r\n class:'a-link-button', display:\"inline-block\",innerText:\"Discontinue\",\r\n clickListener:()=>{\r\n var popupId = \"cmpy-mgmt-discontinue-product-popup\";\r\n var txt = createElement(\"p\", {\r\n innerText:\"Are you sure you want to do this? Discontinuing a product \" +\r\n \"removes it completely and permanently. You will no longer \" +\r\n \"produce this product and all of its existing stock will be \" +\r\n \"removed and left unsold\",\r\n });\r\n var confirmBtn = createElement(\"a\", {\r\n class:\"a-link-button\",innerText:\"Discontinue\",\r\n clickListener:()=>{\r\n industry.discontinueProduct(product, parentRefs);\r\n removeElementById(popupId);\r\n return false;\r\n }\r\n });\r\n var cancelBtn = createElement(\"a\", {\r\n class:\"a-link-button\", innerText:\"Cancel\",\r\n clickListener:()=>{\r\n removeElementById(popupId);\r\n return false;\r\n }\r\n });\r\n createPopup(popupId, [txt, confirmBtn, cancelBtn]);\r\n }\r\n }));\r\n return div;\r\n}\r\n\r\nWarehouse.prototype.toJSON = function() {\r\n\treturn Generic_toJSON(\"Warehouse\", this);\r\n}\r\n\r\nWarehouse.fromJSON = function(value) {\r\n\treturn Generic_fromJSON(Warehouse, value.data);\r\n}\r\n\r\nReviver.constructors.Warehouse = Warehouse;\r\n\r\n//Corporation Unlock Upgrades\r\n//Upgrades for entire corporation, unlocks features, either you have it or you dont\r\n//The structure is [index in Corporation feature upgrades array, price ]\r\nvar CorporationUnlockUpgrades = {\r\n //Lets you export goods\r\n \"0\": [0, 20e9, \"Export\",\r\n \"Develop infrastructure to export your materials to your other facilities. \" +\r\n \"This allows you to move materials around between different divisions and cities.\"],\r\n\r\n //Lets you buy exactly however many required materials you need for production\r\n \"1\": [1, 50e9, \"Smart Supply\", \"Use advanced AI to anticipate your supply needs. \" +\r\n \"This allows you to purchase exactly however many materials you need for production.\"],\r\n\r\n //Displays each material/product's demand\r\n \"2\": [2, 5e9, \"Market Research - Demand\",\r\n \"Mine and analyze market data to determine the demand of all resources. \" +\r\n \"The demand attribute, which affects sales, will be displayed for every material and product.\"],\r\n\r\n //Display's each material/product's competition\r\n \"3\": [3, 5e9, \"Market Data - Competition\",\r\n \"Mine and analyze market data to determine how much competition there is on the market \" +\r\n \"for all resources. The competition attribute, which affects sales, will be displayed for \" +\r\n \"for every material and product.\"],\r\n \"4\": [4, 10e9, \"VeChain\",\r\n \"Use AI and blockchain technology to identify where you can improve your supply chain systems. \" +\r\n \"This upgrade will allow you to view a wide array of useful statistics about your \" +\r\n \"Corporation.\"]\r\n}\r\n\r\n//Corporation Upgrades\r\n//Upgrades for entire corporation, levelable upgrades\r\n//The structure is [index in Corporation upgrades array, base price, price mult, benefit mult (additive),\r\n// name, desc]\r\nvar CorporationUpgrades = {\r\n //Smart factories, increases production\r\n \"0\": [0, 2e9, 1.07, 0.03,\r\n \"Smart Factories\", \"Advanced AI automatically optimizes the operation and productivity \" +\r\n \"of factories. Each level of this upgrade increases your global production by 3% (additive).\"],\r\n\r\n //Smart warehouses, increases storage size\r\n \"1\": [1, 2e9, 1.07, .1,\r\n \"Smart Storage\", \"Advanced AI automatically optimizes your warehouse storage methods. \" +\r\n \"Each level of this upgrade increases your global warehouse storage size by 10% (additive).\"],\r\n\r\n //Advertise through dreams, passive popularity/ awareness gain\r\n \"2\": [2, 8e9, 1.09, .001,\r\n \"DreamSense\", \"Use DreamSense LCC Technologies to advertise your corporation \" +\r\n \"to consumers through their dreams. Each level of this upgrade provides a passive \" +\r\n \"increase in awareness of all of your companies (divisions) by 0.004 / market cycle,\" +\r\n \"and in popularity by 0.001 / market cycle. A market cycle is approximately \" +\r\n \"20 seconds.\"],\r\n\r\n //Makes advertising more effective\r\n \"3\": [3, 4e9, 1.12, 0.005,\r\n \"Wilson Analytics\", \"Purchase data and analysis from Wilson, a marketing research \" +\r\n \"firm. Each level of this upgrades increases the effectiveness of your \" +\r\n \"advertising by 0.5% (additive).\"],\r\n\r\n //Augmentation for employees, increases cre\r\n \"4\": [4, 1e9, 1.06, 0.1,\r\n \"Nuoptimal Nootropic Injector Implants\", \"Purchase the Nuoptimal Nootropic \" +\r\n \"Injector augmentation for your employees. Each level of this upgrade \" +\r\n \"globally increases the creativity of your employees by 10% (additive).\"],\r\n\r\n //Augmentation for employees, increases cha\r\n \"5\": [5, 1e9, 1.06, 0.1,\r\n \"Speech Processor Implants\", \"Purchase the Speech Processor augmentation for your employees. \" +\r\n \"Each level of this upgrade globally increases the charisma of your employees by 10% (additive).\"],\r\n\r\n //Augmentation for employees, increases int\r\n \"6\": [6, 1e9, 1.06, 0.1,\r\n \"Neural Accelerators\", \"Purchase the Neural Accelerator augmentation for your employees. \" +\r\n \"Each level of this upgrade globally increases the intelligence of your employees \" +\r\n \"by 10% (additive).\"],\r\n\r\n //Augmentation for employees, increases eff\r\n \"7\": [7, 1e9, 1.06, 0.1,\r\n \"FocusWires\", \"Purchase the FocusWire augmentation for your employees. Each level \" +\r\n \"of this upgrade globally increases the efficiency of your employees by 10% (additive).\"],\r\n\r\n //Improves sales of materials/products\r\n \"8\": [8, 1e9, 1.08, 0.01,\r\n \"ABC SalesBots\", \"Always Be Closing. Purchase these robotic salesmen to increase the amount of \" +\r\n \"materials and products you sell. Each level of this upgrade globally increases your sales \" +\r\n \"by 1% (additive).\"],\r\n\r\n //Improves scientific research rate\r\n \"9\": [9, 5e9, 1.07, 0.05,\r\n \"Project Insight\", \"Purchase 'Project Insight', a R&D service provided by the secretive \" +\r\n \"Fulcrum Technologies. Each level of this upgrade globally increases the amount of \" +\r\n \"Scientific Research you produce by 5% (additive).\"],\r\n}\r\n\r\nfunction Corporation(params={}) {\r\n this.name = params.name ? params.name : \"The Corporation\";\r\n\r\n //A division/business sector is represented by the object:\r\n this.divisions = [];\r\n\r\n //Financial stats\r\n this.funds = new Decimal(150e9);\r\n this.revenue = new Decimal(0);\r\n this.expenses = new Decimal(0);\r\n this.fundingRound = 0;\r\n this.public = false; //Publicly traded\r\n this.numShares = TOTALSHARES;\r\n this.issuedShares = 0;\r\n this.sharePrice = 0;\r\n this.storedCycles = 0;\r\n\r\n var numUnlockUpgrades = Object.keys(CorporationUnlockUpgrades).length,\r\n numUpgrades = Object.keys(CorporationUpgrades).length;\r\n\r\n this.unlockUpgrades = Array(numUnlockUpgrades).fill(0);\r\n this.upgrades = Array(numUpgrades).fill(0);\r\n this.upgradeMultipliers = Array(numUpgrades).fill(1);\r\n\r\n this.state = new CorporationState();\r\n}\r\n\r\nCorporation.prototype.getState = function() {\r\n return this.state.getState();\r\n}\r\n\r\nCorporation.prototype.storeCycles = function(numCycles=1) {\r\n this.storedCycles += numCycles;\r\n}\r\n\r\nCorporation.prototype.process = function() {\r\n var corp = this;\r\n if (this.storedCycles >= CyclesPerIndustryStateCycle) {\r\n var state = this.getState(), marketCycles=1;\r\n this.storedCycles -= (marketCycles * CyclesPerIndustryStateCycle);\r\n\r\n //At the start of a new cycle, calculate profits from previous cycle\r\n if (state === \"START\") {\r\n this.revenue = new Decimal(0);\r\n this.expenses = new Decimal(0);\r\n this.divisions.forEach((ind)=>{\r\n this.revenue = this.revenue.plus(ind.lastCycleRevenue);\r\n this.expenses = this.expenses.plus(ind.lastCycleExpenses);\r\n });\r\n var profit = this.revenue.minus(this.expenses);\r\n var cycleProfit = profit.times(marketCycles * SecsPerMarketCycle);\r\n if (isNaN(this.funds)) {\r\n dialogBoxCreate(\"There was an error calculating your Corporations funds and they got reset to 0. \" +\r\n \"This is a bug. Please report to game developer.<br><br>\" +\r\n \"(Your funds have been set to $150b for the inconvenience)\");\r\n this.funds = new Decimal(150e9);\r\n }\r\n this.funds = this.funds.plus(cycleProfit);\r\n this.updateSharePrice();\r\n }\r\n\r\n this.divisions.forEach(function(ind) {\r\n ind.process(marketCycles, state, corp);\r\n });\r\n\r\n\r\n this.state.nextState();\r\n\r\n if (Engine.currentPage === Engine.Page.Corporation) {this.updateUIContent();}\r\n }\r\n}\r\n\r\nCorporation.prototype.determineValuation = function() {\r\n var val, profit = (this.revenue.minus(this.expenses)).toNumber();\r\n if (this.public) {\r\n val = this.funds.toNumber() + (profit * 85e3);\r\n val *= (Math.pow(1.1, this.divisions.length));\r\n val = Math.max(val, 0);\r\n } else {\r\n val = 10e9 + Math.max(this.funds.toNumber(), 0) / 3; //Base valuation\r\n if (profit > 0) {\r\n val += (profit * 320e3);\r\n val *= (Math.pow(1.1, this.divisions.length));\r\n } else {\r\n val = 10e9 * Math.pow(1.1, this.divisions.length);\r\n }\r\n val -= (val % 1e6); //Round down to nearest millionth\r\n }\r\n return val * BitNodeMultipliers.CorporationValuation;\r\n}\r\n\r\nCorporation.prototype.getInvestment = function() {\r\n var val = this.determineValuation(), percShares;\r\n switch (this.fundingRound) {\r\n case 0: //Seed\r\n percShares = 0.10;\r\n break;\r\n case 1: //Series A\r\n percShares = 0.35;\r\n break;\r\n case 2: //Series B\r\n percShares = 0.25;\r\n break;\r\n case 3: //Series C\r\n percShares = 0.20;\r\n break;\r\n case 4:\r\n return;\r\n }\r\n var funding = val * percShares * 4,\r\n investShares = Math.floor(TOTALSHARES * percShares),\r\n yesBtn = yesNoBoxGetYesButton(),\r\n noBtn = yesNoBoxGetNoButton();\r\n yesBtn.innerHTML = \"Accept\";\r\n noBtn.innerHML = \"Reject\";\r\n yesBtn.addEventListener(\"click\", ()=>{\r\n ++this.fundingRound;\r\n this.funds = this.funds.plus(funding);\r\n this.numShares -= investShares;\r\n this.displayCorporationOverviewContent();\r\n return yesNoBoxClose();\r\n });\r\n noBtn.addEventListener(\"click\", ()=>{\r\n return yesNoBoxClose();\r\n });\r\n yesNoBoxCreate(\"An investment firm has offered you \" + numeral(funding).format('$0.000a') +\r\n \" in funding in exchange for a \" + numeral(percShares*100).format(\"0.000a\") +\r\n \"% stake in the company (\" + numeral(investShares).format('0.000a') + \" shares).<br><br>\" +\r\n \"Do you accept or reject this offer?\");\r\n}\r\n\r\nCorporation.prototype.goPublic = function() {\r\n var goPublicPopupId = \"cmpy-mgmt-go-public-popup\";\r\n var initialSharePrice = this.determineValuation() / (TOTALSHARES);\r\n var txt = createElement(\"p\", {\r\n innerHTML: \"Enter the number of shares you would like to issue \" +\r\n \"for your IPO. These shares will be publicly sold \" +\r\n \"and you will no longer own them. Your Corporation will receive \" +\r\n numeral(initialSharePrice).format('$0.000a') + \" per share \" +\r\n \"(the IPO money will be deposited directly into your Corporation's funds).<br><br>\" +\r\n \"Furthermore, issuing more shares now will help drive up \" +\r\n \"your company's stock price in the future.<br><br>\" +\r\n \"You have a total of \" + numeral(this.numShares).format(\"0.000a\") + \" of shares that you can issue.\",\r\n });\r\n var yesBtn;\r\n var input = createElement(\"input\", {\r\n type:\"number\",\r\n placeholder: \"Shares to issue\",\r\n onkeyup:(e)=>{\r\n e.preventDefault();\r\n if (e.keyCode === 13) {yesBtn.click();}\r\n }\r\n });\r\n var br = createElement(\"br\", {});\r\n yesBtn = createElement(\"a\", {\r\n class:\"a-link-button\",\r\n innerText:\"Go Public\",\r\n clickListener:()=>{\r\n var numShares = Math.round(input.value);\r\n var initialSharePrice = this.determineValuation() / (TOTALSHARES);\r\n if (isNaN(numShares)) {\r\n dialogBoxCreate(\"Invalid value for number of issued shares\");\r\n return false;\r\n }\r\n if (numShares > this.numShares) {\r\n dialogBoxCreate(\"Error: You don't have that many shares to issue!\");\r\n return false;\r\n }\r\n this.public = true;\r\n this.sharePrice = initialSharePrice;\r\n this.issuedShares = numShares;\r\n this.numShares -= numShares;\r\n this.funds = this.funds.plus(numShares * initialSharePrice);\r\n this.displayCorporationOverviewContent();\r\n removeElementById(goPublicPopupId);\r\n return false;\r\n }\r\n });\r\n var noBtn = createElement(\"a\", {\r\n class:\"a-link-button\",\r\n innerText:\"Cancel\",\r\n clickListener:()=>{\r\n removeElementById(goPublicPopupId);\r\n return false;\r\n }\r\n });\r\n createPopup(goPublicPopupId, [txt, br, input, yesBtn, noBtn]);\r\n}\r\n\r\nCorporation.prototype.updateSharePrice = function() {\r\n var targetPrice = this.determineValuation() / (TOTALSHARES - this.issuedShares);\r\n if (this.sharePrice <= targetPrice) {\r\n this.sharePrice *= (1 + (Math.random() * 0.01));\r\n } else {\r\n this.sharePrice *= (1 - (Math.random() * 0.01));\r\n }\r\n if (this.sharePrice <= 0.01) {this.sharePrice = 0.01;}\r\n}\r\n\r\n//One time upgrades that unlock new features\r\nCorporation.prototype.unlock = function(upgrade) {\r\n var upgN = upgrade[0], price = upgrade[1];\r\n while (this.unlockUpgrades.length <= upgN) {\r\n this.unlockUpgrades.push(0);\r\n }\r\n if (this.funds.lt(price)) {\r\n dialogBoxCreate(\"You don't have enough funds to unlock this!\");\r\n return;\r\n }\r\n this.unlockUpgrades[upgN] = 1;\r\n this.funds = this.funds.minus(price);\r\n}\r\n\r\n//Levelable upgrades\r\nCorporation.prototype.upgrade = function(upgrade) {\r\n var upgN = upgrade[0], basePrice = upgrade[1], priceMult = upgrade[2],\r\n upgradeAmt = upgrade[3]; //Amount by which the upgrade multiplier gets increased (additive)\r\n while (this.upgrades.length <= upgN) {this.upgrades.push(0);}\r\n while (this.upgradeMultipliers.length <= upgN) {this.upgradeMultipliers.push(1);}\r\n var totalCost = basePrice * Math.pow(priceMult, this.upgrades[upgN]);\r\n if (this.funds.lt(totalCost)) {\r\n dialogBoxCreate(\"You don't have enough funds to purchase this!\");\r\n return;\r\n }\r\n ++this.upgrades[upgN];\r\n this.funds = this.funds.minus(totalCost);\r\n\r\n //Increase upgrade multiplier\r\n this.upgradeMultipliers[upgN] = 1 + (this.upgrades[upgN] * upgradeAmt);\r\n\r\n //If storage size is being updated, update values in Warehouse objects\r\n if (upgN === 1) {\r\n for (var i = 0; i < this.divisions.length; ++i) {\r\n var industry = this.divisions[i];\r\n for (var city in industry.warehouses) {\r\n if (industry.warehouses.hasOwnProperty(city) && industry.warehouses[city] instanceof Warehouse) {\r\n industry.warehouses[city].updateSize(this);\r\n }\r\n }\r\n }\r\n }\r\n\r\n this.updateCorporationOverviewContent();\r\n}\r\n\r\nCorporation.prototype.getProductionMultiplier = function() {\r\n var mult = this.upgradeMultipliers[0];\r\n if (isNaN(mult) || mult < 1) {return 1;} else {return mult;}\r\n}\r\n\r\nCorporation.prototype.getStorageMultiplier = function() {\r\n var mult = this.upgradeMultipliers[1];\r\n if (isNaN(mult) || mult < 1) {return 1;} else {return mult;}\r\n}\r\n\r\nCorporation.prototype.getDreamSenseGain = function() {\r\n var gain = this.upgradeMultipliers[2] - 1;\r\n return gain <= 0 ? 0 : gain;\r\n}\r\n\r\nCorporation.prototype.getAdvertisingMultiplier = function() {\r\n var mult = this.upgradeMultipliers[3];\r\n if (isNaN(mult) || mult < 1) {return 1;} else {return mult;}\r\n}\r\n\r\nCorporation.prototype.getEmployeeCreMultiplier = function() {\r\n var mult = this.upgradeMultipliers[4];\r\n if (isNaN(mult) || mult < 1) {return 1;} else {return mult;}\r\n}\r\n\r\nCorporation.prototype.getEmployeeChaMultiplier = function() {\r\n var mult = this.upgradeMultipliers[5];\r\n if (isNaN(mult) || mult < 1) {return 1;} else {return mult;}\r\n}\r\n\r\nCorporation.prototype.getEmployeeIntMultiplier = function() {\r\n var mult = this.upgradeMultipliers[6];\r\n if (isNaN(mult) || mult < 1) {return 1;} else {return mult;}\r\n}\r\n\r\nCorporation.prototype.getEmployeeEffMultiplier = function() {\r\n var mult = this.upgradeMultipliers[7];\r\n if (isNaN(mult) || mult < 1) {return 1;} else {return mult;}\r\n}\r\n\r\nCorporation.prototype.getSalesMultiplier = function() {\r\n var mult = this.upgradeMultipliers[8];\r\n if (isNaN(mult) || mult < 1) {return 1;} else {return mult;}\r\n}\r\n\r\nCorporation.prototype.getScientificResearchMultiplier = function() {\r\n var mult = this.upgradeMultipliers[9];\r\n if (isNaN(mult) || mult < 1) {return 1;} else {return mult;}\r\n}\r\n\r\n//Keep 'global' variables for DOM elements so we don't have to search\r\n//through the DOM tree repeatedly when updating UI\r\nvar companyManagementDiv, companyManagementHeaderTabs, companyManagementPanel,\r\n currentCityUi,\r\n corporationUnlockUpgrades, corporationUpgrades,\r\n\r\n //Industry Overview Panel\r\n industryOverviewPanel, industryOverviewText,\r\n\r\n //Industry Employee Panel\r\n industryEmployeePanel, industryEmployeeText, industryEmployeeHireButton, industryEmployeeAutohireButton,\r\n industryEmployeeManagementUI, industryEmployeeInfo, industryIndividualEmployeeInfo,\r\n industryOfficeUpgradeSizeButton,\r\n\r\n //Industry Warehouse Panel\r\n industryWarehousePanel, industrySmartSupplyCheckbox, industryWarehouseStorageText,\r\n industryWarehouseUpgradeSizeButton, industryWarehouseStateText,\r\n industryWarehouseMaterials, industryWarehouseProducts,\r\n headerTabs, cityTabs;\r\nCorporation.prototype.createUI = function() {\r\n companyManagementDiv = createElement(\"div\", {\r\n id:\"cmpy-mgmt-container\",\r\n position:\"fixed\",\r\n class:\"generic-menupage-container\"\r\n });\r\n companyManagementHeaderTabs = createElement(\"div\", {id:\"cmpy-mgmt-header-tabs\"});\r\n companyManagementDiv.appendChild(companyManagementHeaderTabs);\r\n\r\n //Create division/industry tabs at the top\r\n this.updateUIHeaderTabs();\r\n\r\n //Create the 'panel' that will have the actual content in the UI\r\n companyManagementPanel = createElement(\"div\", {id:\"cmpy-mgmt-panel\"});\r\n companyManagementDiv.appendChild(companyManagementPanel);\r\n document.getElementById(\"entire-game-container\").appendChild(companyManagementDiv);\r\n\r\n this.displayCorporationOverviewContent();\r\n}\r\n\r\nCorporation.prototype.updateUIHeaderTabs = function() {\r\n if (companyManagementHeaderTabs) {\r\n removeChildrenFromElement(companyManagementHeaderTabs);\r\n } else {\r\n console.log(\"ERROR: Header tabs div has not yet been created when Corporation.updateUIHeaderTabs() is called\");\r\n return;\r\n }\r\n\r\n //Corporation overview tabs\r\n var cmpyOverviewHdrTab = createElement(\"button\", {\r\n id:\"cmpy-mgmt-company-tab\",\r\n class:\"cmpy-mgmt-header-tab\",\r\n innerText:this.name,\r\n checked:true,\r\n clickListener:()=>{\r\n this.selectHeaderTab(cmpyOverviewHdrTab);\r\n this.displayCorporationOverviewContent();\r\n return false;\r\n }\r\n });\r\n companyManagementHeaderTabs.appendChild(cmpyOverviewHdrTab);\r\n\r\n //Tabs for each division\r\n for (var i = 0; i < this.divisions.length; ++i) {\r\n this.createDivisionUIHeaderTab(this.divisions[i]);\r\n }\r\n\r\n //Create a tab to expand into a new industry\r\n companyManagementHeaderTabs.appendChild(createElement(\"button\", {\r\n id:'cmpy-mgmt-expand-industry-tab',\r\n class:\"cmpy-mgmt-header-tab\",\r\n innerText:\"Expand into new Industry\",\r\n clickListener: ()=>{\r\n if (document.getElementById(\"cmpy-mgmt-expand-industry-popup\") != null) {return;}\r\n\r\n var container = createElement(\"div\", {\r\n class:\"popup-box-container\",\r\n id:\"cmpy-mgmt-expand-industry-popup\",\r\n });\r\n var content = createElement(\"div\", {class:\"popup-box-content\"});\r\n var txt = createElement(\"p\", {\r\n innerHTML: \"Create a new division to expand into a new industry:\",\r\n });\r\n var selector = createElement(\"select\", {\r\n class:\"cmpy-mgmt-industry-select\"\r\n });\r\n var industryDescription = createElement(\"p\", {});\r\n var yesBtn;\r\n var nameInput = createElement(\"input\", {\r\n type:\"text\",\r\n id:\"cmpy-mgmt-expand-industry-name-input\",\r\n color:\"white\",\r\n backgroundColor:\"black\",\r\n display:\"block\",\r\n maxLength: 30,\r\n pattern:\"[a-zA-Z0-9-_]\",\r\n onkeyup:(e)=>{\r\n e.preventDefault();\r\n if (e.keyCode === 13) {yesBtn.click();}\r\n }\r\n });\r\n var nameLabel = createElement(\"label\", {\r\n for:\"cmpy-mgmt-expand-industry-name-input\",\r\n innerText:\"Division name: \"\r\n });\r\n yesBtn = createElement(\"span\", {\r\n class:\"popup-box-button\",\r\n innerText:\"Create Division\",\r\n clickListener: ()=>{\r\n var ind = selector.options[selector.selectedIndex].value,\r\n newDivisionName = nameInput.value;\r\n\r\n for (var i = 0; i < this.divisions.length; ++i) {\r\n if (this.divisions[i].name === newDivisionName) {\r\n dialogBoxCreate(\"This name is already in use!\");\r\n return false;\r\n }\r\n }\r\n if (this.funds.lt(IndustryStartingCosts[ind])) {\r\n dialogBoxCreate(\"Not enough money to create a new division in this industry\");\r\n } else if (newDivisionName === \"\") {\r\n dialogBoxCreate(\"New division must have a name!\");\r\n } else {\r\n this.funds = this.funds.minus(IndustryStartingCosts[ind]);\r\n var newInd = new Industry({\r\n name:newDivisionName,\r\n type:ind,\r\n });\r\n this.divisions.push(newInd);\r\n this.updateUIHeaderTabs();\r\n this.selectHeaderTab(headerTabs[headerTabs.length-2]);\r\n removeElementById(\"cmpy-mgmt-expand-industry-popup\");\r\n this.displayDivisionContent(newInd, Locations.Sector12);\r\n }\r\n return false;\r\n }\r\n });\r\n var noBtn = createElement(\"span\", {\r\n class:\"popup-box-button\",\r\n innerText:\"Cancel\",\r\n clickListener: function() {\r\n removeElementById(\"cmpy-mgmt-expand-industry-popup\");\r\n return false;\r\n }\r\n });\r\n\r\n //Make an object to keep track of what industries you're already in\r\n var ownedIndustries = {}\r\n for (var i = 0; i < this.divisions.length; ++i) {\r\n ownedIndustries[this.divisions[i].type] = true;\r\n }\r\n\r\n //Add industry types to selector\r\n //Have Agriculture be first as recommended option\r\n if (!ownedIndustries[\"Agriculture\"]) {\r\n selector.add(createElement(\"option\", {\r\n text:Industries[\"Agriculture\"], value:\"Agriculture\"\r\n }));\r\n }\r\n\r\n for (var key in Industries) {\r\n if (key !== \"Agriculture\" && Industries.hasOwnProperty(key) && !ownedIndustries[key]) {\r\n var ind = Industries[key];\r\n selector.add(createElement(\"option\", {\r\n text: ind,value:key,\r\n }));\r\n }\r\n }\r\n\r\n //Initial Industry Description\r\n var ind = selector.options[selector.selectedIndex].value;\r\n industryDescription.innerHTML = (IndustryDescriptions[ind] + \"<br><br>\");\r\n\r\n //Change the industry description text based on selected option\r\n selector.addEventListener(\"change\", function() {\r\n var ind = selector.options[selector.selectedIndex].value;\r\n industryDescription.innerHTML = IndustryDescriptions[ind] + \"<br><br>\";\r\n });\r\n\r\n //Add to DOM\r\n content.appendChild(txt);\r\n content.appendChild(selector);\r\n content.appendChild(industryDescription);\r\n content.appendChild(nameLabel);\r\n content.appendChild(nameInput);\r\n content.appendChild(noBtn);\r\n content.appendChild(yesBtn);\r\n container.appendChild(content);\r\n document.getElementById(\"entire-game-container\").appendChild(container);\r\n container.style.display = \"block\";\r\n return false;\r\n }\r\n }));\r\n\r\n headerTabs = companyManagementDiv.getElementsByClassName(\"cmpy-mgmt-header-tab\");\r\n}\r\n\r\n//Updates UI to display which header tab is selected\r\nCorporation.prototype.selectHeaderTab = function(currentTab) {\r\n if (currentTab == null) {return;}\r\n for (var i = 0; i < headerTabs.length; ++i) {\r\n headerTabs[i].className = \"cmpy-mgmt-header-tab\";\r\n }\r\n currentTab.className = \"cmpy-mgmt-header-tab current\";\r\n}\r\n\r\nCorporation.prototype.createDivisionUIHeaderTab = function(division) {\r\n var tabId = \"cmpy-mgmt-\" + division.name + \"-tab\";\r\n var tab = createElement(\"button\", {\r\n id:tabId,\r\n class:\"cmpy-mgmt-header-tab\",\r\n innerText:division.name,\r\n clickListener:()=>{\r\n this.selectHeaderTab(tab);\r\n this.displayDivisionContent(division, Locations.Sector12);\r\n return false;\r\n }\r\n });\r\n companyManagementHeaderTabs.appendChild(tab);\r\n}\r\n\r\nCorporation.prototype.clearUIPanel = function() {\r\n while(companyManagementPanel.firstChild) {\r\n companyManagementPanel.removeChild(companyManagementPanel.firstChild);\r\n }\r\n}\r\n\r\nCorporation.prototype.updateUIContent = function() {\r\n //Check which of the header tab buttons is checked\r\n if (headerTabs == null) {\r\n console.log(\"ERROR: headerTabs is null in Corporation.updateUIContent()\");\r\n return;\r\n }\r\n for (var i = 0; i < headerTabs.length; ++i) {\r\n if (headerTabs[i].classList.contains(\"current\")) {\r\n if (i === 0) {\r\n //Corporation overview\r\n this.updateCorporationOverviewContent();\r\n } else {\r\n //Division\r\n this.updateDivisionContent(this.divisions[i-1]);\r\n }\r\n return;\r\n }\r\n }\r\n}\r\n\r\nCorporation.prototype.displayCorporationOverviewContent = function() {\r\n this.clearUIPanel();\r\n companyManagementPanel.appendChild(createElement(\"p\", {\r\n id:\"cmpy-mgmt-overview-text\",\r\n }));\r\n if (headerTabs && headerTabs.length >= 1) {\r\n this.selectHeaderTab(headerTabs[0]);\r\n }\r\n\r\n //Check if player has Corporation Handbook\r\n var homeComp = Player.getHomeComputer(), hasHandbook = false,\r\n handbookFn = \"corporation-management-handbook.lit\";\r\n for (var i = 0; i < homeComp.messages.length; ++i) {\r\n if (isString(homeComp.messages[i]) && homeComp.messages[i] === handbookFn) {\r\n hasHandbook = true;\r\n break;\r\n }\r\n }\r\n\r\n companyManagementPanel.appendChild(createElement(\"a\", {\r\n class:\"a-link-button\", innerText:\"Getting Started Guide\", display:\"inline-block\",\r\n tooltip:\"Get a copy of and read 'The Complete Handbook for Creating a Successful Corporation.' \" +\r\n \"This is a .lit file that guides you through the beginning of setting up a Corporation and \" +\r\n \"provides some tips/pointers for helping you get started with managing it.\",\r\n clickListener:()=>{\r\n if (!hasHandbook) {homeComp.messages.push(handbookFn);}\r\n showLiterature(handbookFn);\r\n return false;\r\n }\r\n }));\r\n\r\n //Investors\r\n if (this.public) {\r\n //Sell share buttons\r\n var sellShares = createElement(\"a\", {\r\n class:\"a-link-button\", innerText:\"Sell Shares\", display:\"inline-block\",\r\n tooltip:\"Sell your shares in the company. This is the only way to \" +\r\n \"profit from your business venture.\",\r\n clickListener:()=>{\r\n var popupId = \"cmpy-mgmt-sell-shares-popup\";\r\n var currentStockPrice = this.sharePrice;\r\n var txt = createElement(\"p\", {\r\n innerHTML: \"Enter the number of shares you would like to sell. The money from \" +\r\n \"selling your shares will go directly to you (NOT your Corporation). \" +\r\n \"The current price of your \" +\r\n \"company's stock is \" + numeral(currentStockPrice).format(\"$0.000a\"),\r\n });\r\n var profitIndicator = createElement(\"p\", {});\r\n var input = createElement(\"input\", {\r\n type:\"number\", placeholder:\"Shares to sell\", margin:\"5px\",\r\n inputListener: ()=> {\r\n var numShares = Math.round(input.value);\r\n if (isNaN(numShares) || numShares <= 0) {\r\n profitIndicator.innerText = \"ERROR: Invalid value entered for number of shares to sell\"\r\n } else if (numShares > this.numShares) {\r\n profitIndicator.innerText = \"You don't have this many shares to sell!\";\r\n } else {\r\n profitIndicator.innerText = \"Sell \" + numShares + \" shares for a total of \" +\r\n numeral(numShares * currentStockPrice).format('$0.000a');\r\n }\r\n }\r\n });\r\n var confirmBtn = createElement(\"a\", {\r\n class:\"a-link-button\", innerText:\"Sell shares\", display:\"inline-block\",\r\n clickListener:()=>{\r\n var shares = Math.round(input.value);\r\n if (isNaN(shares) || shares <= 0) {\r\n dialogBoxCreate(\"ERROR: Invalid value for number of shares\");\r\n } else if (shares > this.numShares) {\r\n dialogBoxCreate(\"ERROR: You don't have this many shares to sell\");\r\n } else {\r\n this.numShares -= shares;\r\n if (isNaN(this.issuedShares)) {\r\n console.log(\"ERROR: Corporation issuedShares is NaN: \" + this.issuedShares);\r\n console.log(\"Converting to number now\");\r\n var res = parseInt(this.issuedShares);\r\n if (isNaN(res)) {\r\n this.issuedShares = 0;\r\n } else {\r\n this.issuedShares = res;\r\n }\r\n }\r\n this.issuedShares += shares;\r\n Player.gainMoney(shares * this.sharePrice);\r\n removeElementById(popupId);\r\n return false;\r\n }\r\n\r\n }\r\n });\r\n var cancelBtn = createElement(\"a\", {\r\n class:\"a-link-button\", innerText:\"Cancel\", display:\"inline-block\",\r\n clickListener:()=>{\r\n removeElementById(popupId);\r\n return false;\r\n }\r\n });\r\n createPopup(popupId, [txt, profitIndicator, input, confirmBtn, cancelBtn]);\r\n }\r\n });\r\n\r\n //Buyback shares button\r\n var buybackShares = createElement(\"a\", {\r\n class:\"a-link-button\", innerText:\"Buyback shares\", display:\"inline-block\",\r\n tooltip:\"Buy back shares you that previously issued or sold at market price.\",\r\n clickListener:()=>{\r\n var popupId = \"cmpy-mgmt-buyback-shares-popup\";\r\n var currentStockPrice = this.sharePrice;\r\n var txt = createElement(\"p\", {\r\n innerHTML: \"Enter the number of shares you would like to buy back at market price. To purchase \" +\r\n \"these shares, you must use your own money (NOT your Corporation's funds). \" +\r\n \"The current price of your \" +\r\n \"company's stock is \" + numeral(currentStockPrice).format(\"$0.000a\") +\r\n \". Your company currently has \" + formatNumber(this.issuedShares, 3) + \" outstanding stock shares\",\r\n });\r\n var costIndicator = createElement(\"p\", {});\r\n var input = createElement(\"input\", {\r\n type:\"number\", placeholder:\"Shares to buyback\", margin:\"5px\",\r\n inputListener: ()=> {\r\n var numShares = Math.round(input.value);\r\n //TODO add conditional for if player doesn't have enough money\r\n if (isNaN(numShares) || numShares <= 0) {\r\n costIndicator.innerText = \"ERROR: Invalid value entered for number of shares to buyback\"\r\n } else if (numShares > this.issuedShares) {\r\n costIndicator.innerText = \"There are not this many shares available to buy back. \" +\r\n \"There are only \" + this.issuedShares + \" outstanding shares.\";\r\n } else {\r\n console.log(\"here\");\r\n costIndicator.innerText = \"Purchase \" + numShares + \" shares for a total of \" +\r\n numeral(numShares * currentStockPrice).format('$0.000a');\r\n }\r\n }\r\n });\r\n var confirmBtn = createElement(\"a\", {\r\n class:\"a-link-button\", innerText:\"Buy shares\", display:\"inline-block\",\r\n clickListener:()=>{\r\n var shares = Math.round(input.value);\r\n var tempStockPrice = this.sharePrice;\r\n if (isNaN(shares) || shares <= 0) {\r\n dialogBoxCreate(\"ERROR: Invalid value for number of shares\");\r\n } else if (shares > this.issuedShares) {\r\n dialogBoxCreate(\"ERROR: There are not this many oustanding shares to buy back\");\r\n } else if (shares * tempStockPrice > Player.money) {\r\n dialogBoxCreate(\"ERROR: You do not have enough money to purchase this many shares (you need \" +\r\n numeral(shares * tempStockPrice).format(\"$0.000a\") + \")\");\r\n } else {\r\n this.numShares += shares;\r\n if (isNaN(this.issuedShares)) {\r\n console.log(\"ERROR: Corporation issuedShares is NaN: \" + this.issuedShares);\r\n console.log(\"Converting to number now\");\r\n var res = parseInt(this.issuedShares);\r\n if (isNaN(res)) {\r\n this.issuedShares = 0;\r\n } else {\r\n this.issuedShares = res;\r\n }\r\n }\r\n this.issuedShares -= shares;\r\n Player.loseMoney(shares * tempStockPrice);\r\n //TODO REMOVE from Player money\r\n removeElementById(popupId);\r\n }\r\n return false;\r\n\r\n }\r\n });\r\n var cancelBtn = createElement(\"a\", {\r\n class:\"a-link-button\",\r\n innerText:\"Cancel\",\r\n display:\"inline-block\",\r\n clickListener:()=>{\r\n removeElementById(popupId);\r\n return false;\r\n }\r\n });\r\n createPopup(popupId, [txt, costIndicator, input, confirmBtn, cancelBtn]);\r\n }\r\n });\r\n\r\n companyManagementPanel.appendChild(sellShares);\r\n companyManagementPanel.appendChild(buybackShares);\r\n\r\n //If your Corporation is big enough, buy faction influence through bribes\r\n var canBribe = this.determineValuation() >= BribeThreshold;\r\n var bribeFactions = createElement(\"a\", {\r\n class: canBribe ? \"a-link-button\" : \"a-link-button-inactive\",\r\n innerText:\"Bribe Factions\", display:\"inline-block\",\r\n tooltip:canBribe\r\n ? \"Use your Corporations power and influence to bribe Faction leaders in exchange for reputation\"\r\n : \"Your Corporation is not powerful enough to bribe Faction leaders\",\r\n clickListener:()=>{\r\n var popupId = \"cmpy-mgmt-bribe-factions-popup\";\r\n var txt = createElement(\"p\", {\r\n innerText:\"You can use Corporation funds or stock shares to bribe Faction Leaders in exchange for faction reputation\"\r\n });\r\n var factionSelector = createElement(\"select\", {margin:\"3px\"});\r\n for (var i = 0; i < Player.factions.length; ++i) {\r\n var facName = Player.factions[i];\r\n factionSelector.add(createElement(\"option\", {\r\n text:facName, value:facName\r\n }));\r\n }\r\n var repGainText = createElement(\"p\");\r\n var stockSharesInput;\r\n var moneyInput = createElement(\"input\", {\r\n type:\"number\", placeholder:\"Corporation funds\", margin:\"5px\",\r\n inputListener:()=>{\r\n var money = moneyInput.value == null || moneyInput.value == \"\" ? 0 : parseFloat(moneyInput.value);\r\n var stockPrice = this.sharePrice;\r\n var stockShares = stockSharesInput.value == null || stockSharesInput.value == \"\" ? 0 : Math.round(parseFloat(stockSharesInput.value));\r\n if (isNaN(money) || isNaN(stockShares) || money < 0 || stockShares < 0) {\r\n repGainText.innerText = \"ERROR: Invalid value(s) entered\";\r\n } else if (this.funds.lt(money)) {\r\n repGainText.innerText = \"ERROR: You do not have this much money to bribe with\";\r\n } else if (this.stockShares > this.numShares) {\r\n repGainText.innerText = \"ERROR: You do not have this many shares to bribe with\";\r\n } else {\r\n\r\n var totalAmount = Number(money) + (stockShares * stockPrice);\r\n var repGain = totalAmount / BribeToRepRatio;\r\n repGainText.innerText = \"You will gain \" + formatNumber(repGain, 0) +\r\n \" reputation with \" +\r\n factionSelector.options[factionSelector.selectedIndex].value +\r\n \" with this bribe\";\r\n }\r\n }\r\n });\r\n stockSharesInput = createElement(\"input\", {\r\n type:\"number\", placeholder:\"Stock Shares\", margin: \"5px\",\r\n inputListener:()=>{\r\n var money = moneyInput.value == null || moneyInput.value == \"\" ? 0 : parseFloat(moneyInput.value);\r\n var stockPrice = this.sharePrice;\r\n var stockShares = stockSharesInput.value == null || stockSharesInput.value == \"\" ? 0 : Math.round(stockSharesInput.value);\r\n if (isNaN(money) || isNaN(stockShares) || money < 0 || stockShares < 0) {\r\n repGainText.innerText = \"ERROR: Invalid value(s) entered\";\r\n } else if (this.funds.lt(money)) {\r\n repGainText.innerText = \"ERROR: You do not have this much money to bribe with\";\r\n } else if (this.stockShares > this.numShares) {\r\n repGainText.innerText = \"ERROR: You do not have this many shares to bribe with\";\r\n } else {\r\n var totalAmount = money + (stockShares * stockPrice);\r\n var repGain = totalAmount / BribeToRepRatio;\r\n console.log(\"repGain: \" + repGain);\r\n repGainText.innerText = \"You will gain \" + formatNumber(repGain, 0) +\r\n \" reputation with \" +\r\n factionSelector.options[factionSelector.selectedIndex].value +\r\n \" with this bribe\";\r\n }\r\n }\r\n });\r\n var confirmButton = createElement(\"a\", {\r\n class:\"a-link-button\", innerText:\"Bribe\", display:\"inline-block\",\r\n clickListener:()=>{\r\n var money = moneyInput.value == null || moneyInput.value == \"\" ? 0 : parseFloat(moneyInput.value);\r\n var stockPrice = this.sharePrice;\r\n var stockShares = stockSharesInput.value == null || stockSharesInput.value == \"\"? 0 : Math.round(parseFloat(stockSharesInput.value));\r\n var fac = Factions[factionSelector.options[factionSelector.selectedIndex].value];\r\n if (fac == null) {\r\n dialogBoxCreate(\"ERROR: You must select a faction to bribe\");\r\n return false;\r\n }\r\n if (isNaN(money) || isNaN(stockShares) || money < 0 || stockShares < 0) {\r\n dialogBoxCreate(\"ERROR: Invalid value(s) entered\");\r\n } else if (this.funds.lt(money)) {\r\n dialogBoxCreate(\"ERROR: You do not have this much money to bribe with\");\r\n } else if (stockShares > this.numShares) {\r\n dialogBoxCreate(\"ERROR: You do not have this many shares to bribe with\");\r\n } else {\r\n var totalAmount = money + (stockShares * stockPrice);\r\n var repGain = totalAmount / BribeToRepRatio;\r\n dialogBoxCreate(\"You gained \" + formatNumber(repGain, 0) +\r\n \" reputation with \" + fac.name + \" by bribing them.\");\r\n fac.playerReputation += repGain;\r\n this.funds = this.funds.minus(money);\r\n this.numShares -= stockShares;\r\n removeElementById(popupId);\r\n return false;\r\n }\r\n }\r\n });\r\n var cancelButton = createElement(\"a\", {\r\n class:\"a-link-button\", innerText:\"Cancel\", display:\"inline-block\",\r\n clickListener:()=>{\r\n removeElementById(popupId);\r\n return false;\r\n }\r\n });\r\n\r\n createPopup(popupId, [txt, factionSelector, repGainText,\r\n moneyInput, stockSharesInput, confirmButton, cancelButton]);\r\n }\r\n });\r\n companyManagementPanel.appendChild(bribeFactions);\r\n } else {\r\n var findInvestors = createElement(\"a\", {\r\n class: this.fundingRound >= 4 ? \"a-link-button-inactive\" : \"a-link-button tooltip\",\r\n innerText: \"Find Investors\",\r\n display:\"inline-block\",\r\n clickListener:()=>{\r\n this.getInvestment();\r\n }\r\n });\r\n if (this.fundingRound < 4) {\r\n var findInvestorsTooltip = createElement(\"span\", {\r\n class:\"tooltiptext\",\r\n innerText:\"Search for private investors who will give you startup funding in exchange \" +\r\n \"for equity (stock shares) in your company\"\r\n });\r\n findInvestors.appendChild(findInvestorsTooltip);\r\n }\r\n\r\n var goPublic = createElement(\"a\", {\r\n class:\"a-link-button tooltip\",\r\n innerText:\"Go Public\",\r\n display:\"inline-block\",\r\n clickListener:()=>{\r\n this.goPublic();\r\n return false;\r\n }\r\n });\r\n var goPublicTooltip = createElement(\"span\", {\r\n class:\"tooltiptext\",\r\n innerText: \"Become a publicly traded and owned entity. Going public involves \" +\r\n \"issuing shares for an IPO. Once you are a public company, \" +\r\n \"your shares will be traded on the stock market.\"\r\n });\r\n goPublic.appendChild(goPublicTooltip);\r\n\r\n companyManagementPanel.appendChild(findInvestors);\r\n companyManagementPanel.appendChild(goPublic);\r\n }\r\n\r\n //Update overview text\r\n this.updateCorporationOverviewContent();\r\n\r\n //Don't show upgrades if player hasn't opened any divisions\r\n if (this.divisions.length <= 0) {return; }\r\n //Corporation Upgrades\r\n var upgradeContainer = createElement(\"div\", {\r\n class:\"cmpy-mgmt-upgrade-container\",\r\n });\r\n upgradeContainer.appendChild(createElement(\"h1\", {\r\n innerText:\"Unlocks\", margin:\"6px\", padding:\"6px\",\r\n }));\r\n\r\n //Unlock upgrades\r\n var corp = this;\r\n var numUnlockUpgrades = Object.keys(CorporationUnlockUpgrades).length,\r\n numUpgrades = Object.keys(CorporationUpgrades).length;\r\n if (this.unlockUpgrades == null || this.upgrades == null) { //Backwards compatibility\r\n this.unlockUpgrades = Array(numUnlockUpgrades).fill(0);\r\n this.upgrades = Array(numUpgrades).fill(0);\r\n }\r\n while (this.unlockUpgrades.length < numUnlockUpgrades) {this.unlockUpgrades.push(0);}\r\n while (this.upgrades.length < numUpgrades) {this.upgrades.push(0);}\r\n while (this.upgradeMultipliers < numUpgrades) {this.upgradeMultipliers.push(1);}\r\n\r\n for (var i = 0; i < numUnlockUpgrades; ++i) {\r\n (function(i, corp) {\r\n if (corp.unlockUpgrades[i] === 0) {\r\n var upgrade = CorporationUnlockUpgrades[i.toString()];\r\n if (upgrade == null) {\r\n console.log(\"ERROR: Could not find upgrade index \" + i);\r\n return;\r\n }\r\n\r\n upgradeContainer.appendChild(createElement(\"div\", {\r\n class:\"cmpy-mgmt-upgrade-div\", width:\"45%\",\r\n innerHTML:upgrade[2] + \" - \" + numeral(upgrade[1]).format(\"$0.000a\"),\r\n tooltip: upgrade[3],\r\n clickListener:()=>{\r\n if (corp.funds.lt(upgrade[1])) {\r\n dialogBoxCreate(\"Insufficient funds\");\r\n } else {\r\n corp.unlock(upgrade);\r\n corp.displayCorporationOverviewContent();\r\n }\r\n }\r\n }));\r\n }\r\n })(i, corp);\r\n }\r\n\r\n //Levelable upgrades\r\n upgradeContainer.appendChild(createElement(\"h1\", {\r\n innerText:\"Upgrades\", margin:\"6px\", padding:\"6px\",\r\n }));\r\n\r\n for (var i = 0; i < numUpgrades; ++i) {\r\n (function(i, corp) {\r\n var upgrade = CorporationUpgrades[i.toString()];\r\n if (upgrade == null) {\r\n console.log(\"ERROR: Could not find levelable upgrade index \" + i);\r\n return;\r\n }\r\n\r\n var baseCost = upgrade[1], priceMult = upgrade[2];\r\n var cost = baseCost * Math.pow(priceMult, corp.upgrades[i]);\r\n upgradeContainer.appendChild(createElement(\"div\", {\r\n class:\"cmpy-mgmt-upgrade-div\", width:\"45%\",\r\n innerHTML:upgrade[4] + \" - \" + numeral(cost).format(\"$0.000a\"),\r\n tooltip:upgrade[5],\r\n clickListener:()=>{\r\n if (corp.funds.lt(cost)) {\r\n dialogBoxCreate(\"Insufficient funds\");\r\n } else {\r\n corp.upgrade(upgrade);\r\n corp.displayCorporationOverviewContent();\r\n }\r\n }\r\n }));\r\n })(i, corp);\r\n }\r\n\r\n companyManagementPanel.appendChild(upgradeContainer);\r\n}\r\n\r\nCorporation.prototype.updateCorporationOverviewContent = function() {\r\n var p = document.getElementById(\"cmpy-mgmt-overview-text\");\r\n if (p == null) {\r\n console.log(\"WARNING: Could not find overview text elemtn in updateCorporationOverviewContent()\");\r\n return;\r\n }\r\n var totalFunds = this.funds,\r\n totalRevenue = new Decimal(0),\r\n totalExpenses = new Decimal(0);\r\n\r\n var profit = this.revenue.minus(this.expenses).toNumber(),\r\n profitStr = profit >= 0 ? numeral(profit).format(\"$0.000a\") : \"-\" + numeral(-1 * profit).format(\"$0.000a\");\r\n\r\n var txt = \"Total Funds: \" + numeral(totalFunds.toNumber()).format('$0.000a') + \"<br>\" +\r\n \"Total Revenue: \" + numeral(this.revenue.toNumber()).format(\"$0.000a\") + \" / s<br>\" +\r\n \"Total Expenses: \" + numeral(this.expenses.toNumber()).format(\"$0.000a\") + \"/ s<br>\" +\r\n \"Total Profits: \" + profitStr + \" / s<br>\" +\r\n \"Publicly Traded: \" + (this.public ? \"Yes\" : \"No\") + \"<br>\" +\r\n \"Owned Stock Shares: \" + numeral(this.numShares).format('0.000a') + \"<br>\" +\r\n \"Stock Price: \" + (this.public ? \"$\" + formatNumber(this.sharePrice, 2) : \"N/A\") + \"<br><br>\";\r\n\r\n var prodMult = this.getProductionMultiplier(),\r\n storageMult = this.getStorageMultiplier(),\r\n advMult = this.getAdvertisingMultiplier(),\r\n empCreMult = this.getEmployeeCreMultiplier(),\r\n empChaMult = this.getEmployeeChaMultiplier(),\r\n empIntMult = this.getEmployeeIntMultiplier(),\r\n empEffMult = this.getEmployeeEffMultiplier(),\r\n salesMult = this.getSalesMultiplier(),\r\n sciResMult = this.getScientificResearchMultiplier();\r\n if (prodMult > 1) {txt += \"Production Multiplier: \" + formatNumber(prodMult, 3) + \"<br>\";}\r\n if (storageMult > 1) {txt += \"Storage Multiplier: \" + formatNumber(storageMult, 3) + \"<br>\";}\r\n if (advMult > 1) {txt += \"Advertising Multiplier: \" + formatNumber(advMult, 3) + \"<br>\";}\r\n if (empCreMult > 1) {txt += \"Empl. Creativity Multiplier: \" + formatNumber(empCreMult, 3) + \"<br>\";}\r\n if (empChaMult > 1) {txt += \"Empl. Charisma Multiplier: \" + formatNumber(empChaMult, 3) + \"<br>\";}\r\n if (empIntMult > 1) {txt += \"Empl. Intelligence Multiplier: \" + formatNumber(empIntMult, 3) + \"<br>\";}\r\n if (empEffMult > 1) {txt += \"Empl. Efficiency Multiplier: \" + formatNumber(empEffMult, 3) + \"<br>\";}\r\n if (salesMult > 1) {txt += \"Sales Multiplier: \" + formatNumber(salesMult, 3) + \"<br>\";}\r\n if (sciResMult > 1) {txt += \"Scientific Research Multiplier: \" + formatNumber(sciResMult, 3) + \"<br>\";}\r\n p.innerHTML = txt;\r\n}\r\n\r\nCorporation.prototype.displayDivisionContent = function(division, city) {\r\n this.clearUIPanel();\r\n currentCityUi = city;\r\n\r\n //Add the city tabs on the left\r\n for (var cityName in division.offices) {\r\n if (division.offices[cityName] instanceof OfficeSpace) {\r\n this.createCityUITab(cityName, division);\r\n }\r\n }\r\n cityTabs = companyManagementPanel.getElementsByClassName(\"cmpy-mgmt-city-tab\");\r\n if (cityTabs.length > 0) {\r\n this.selectCityTab(document.getElementById(\"cmpy-mgmt-city-\" + city + \"-tab\"), city);\r\n }\r\n\r\n //Expand into new City button\r\n companyManagementPanel.appendChild(createElement(\"button\", {\r\n class:\"cmpy-mgmt-city-tab\", innerText:\"Expand into new City\", display:\"inline-block\",\r\n clickListener:()=>{\r\n var popupId = \"cmpy-mgmt-expand-city-popup\";\r\n var text = createElement(\"p\", {\r\n innerText: \"Would you like to expand into a new city by opening an office? \" +\r\n \"This would cost \" + numeral(OfficeInitialCost).format('$0.000a'),\r\n });\r\n var citySelector = createElement(\"select\", {margin:\"5px\"});\r\n for (var cityName in division.offices) {\r\n if (division.offices.hasOwnProperty(cityName)) {\r\n if (!(division.offices[cityName] instanceof OfficeSpace)) {\r\n citySelector.add(createElement(\"option\", {\r\n text: cityName,\r\n value: cityName\r\n }));\r\n }\r\n }\r\n }\r\n\r\n var confirmBtn = createElement(\"a\", {\r\n innerText:\"Confirm\", class:\"a-link-button\", display:\"inline-block\", margin:\"3px\",\r\n clickListener:()=>{\r\n var city = citySelector.options[citySelector.selectedIndex].value;\r\n if (this.funds.lt(OfficeInitialCost)) {\r\n dialogBoxCreate(\"You don't have enough company funds to open a new office!\");\r\n } else {\r\n this.funds = this.funds.minus(OfficeInitialCost);\r\n dialogBoxCreate(\"Opened a new office in \" + city + \"!\");\r\n division.offices[city] = new OfficeSpace({\r\n loc:city,\r\n size:OfficeInitialSize,\r\n });\r\n this.displayDivisionContent(division, city);\r\n }\r\n removeElementById(popupId);\r\n return false;\r\n }\r\n });\r\n var cancelBtn = createElement(\"a\", {\r\n innerText:\"Cancel\", class:\"a-link-button\", display:\"inline-block\", margin:\"3px\",\r\n clickListener:()=>{\r\n removeElementById(popupId);\r\n return false;\r\n }\r\n })\r\n createPopup(popupId, [text, citySelector, confirmBtn, cancelBtn]);\r\n return false;\r\n }\r\n }));\r\n companyManagementPanel.appendChild(createElement(\"br\", {})); // Force line break\r\n\r\n //Get office object\r\n var office = division.offices[currentCityUi];\r\n if (!(office instanceof OfficeSpace)) {\r\n console.log(\"ERROR: Current city for UI does not have an office space\");\r\n return;\r\n }\r\n\r\n //Left and right panels\r\n var leftPanel = createElement(\"div\", {class:\"cmpy-mgmt-industry-left-panel\"});\r\n var rightPanel = createElement(\"div\", {class:\"cmpy-mgmt-industry-right-panel\"});\r\n companyManagementPanel.appendChild(leftPanel);\r\n companyManagementPanel.appendChild(rightPanel);\r\n\r\n //Different sections (Overview, Employee/Office, and Warehouse)\r\n industryOverviewPanel = createElement(\"div\", {\r\n id:\"cmpy-mgmt-industry-overview-panel\", class:\"cmpy-mgmt-industry-overview-panel\"\r\n });\r\n leftPanel.appendChild(industryOverviewPanel);\r\n\r\n industryEmployeePanel = createElement(\"div\", {\r\n id:\"cmpy-mgmt-employee-panel\", class:\"cmpy-mgmt-employee-panel\"\r\n });\r\n leftPanel.appendChild(industryEmployeePanel);\r\n\r\n industryWarehousePanel = createElement(\"div\", {\r\n id:\"cmpy-mgmt-warehouse-panel\", class:\"cmpy-mgmt-warehouse-panel\"\r\n });\r\n rightPanel.appendChild(industryWarehousePanel);\r\n\r\n //Industry overview text\r\n industryOverviewText = createElement(\"p\", {});\r\n industryOverviewPanel.appendChild(industryOverviewText);\r\n industryOverviewPanel.appendChild(createElement(\"br\", {}));\r\n\r\n //Industry overview Purchases & Upgrades\r\n var numUpgrades = Object.keys(IndustryUpgrades).length;\r\n while (division.upgrades.length < numUpgrades) {division.upgrades.push(0);} //Backwards compatibility\r\n\r\n var industryOverviewUpgrades = createElement(\"div\", {});\r\n industryOverviewUpgrades.appendChild(createElement(\"u\", {\r\n innerText:\"Purchases & Upgrades\", margin:\"2px\", padding:\"2px\",\r\n fontSize:\"14px\",\r\n }));\r\n industryOverviewUpgrades.appendChild(createElement(\"br\", {}));\r\n for (var i = 0; i < numUpgrades; ++i) {\r\n (function(i, corp, division, office) {\r\n var upgrade = IndustryUpgrades[i.toString()];\r\n if (upgrade == null) {\r\n console.log(\"ERROR: Could not find levelable upgrade index: \" + i);\r\n return;\r\n }\r\n\r\n var baseCost = upgrade[1], priceMult = upgrade[2], cost = 0;\r\n switch(i) {\r\n case 0: //Coffee, cost is static per employee\r\n cost = office.employees.length * baseCost;\r\n break;\r\n default:\r\n cost = baseCost * Math.pow(priceMult, division.upgrades[i]);\r\n break;\r\n }\r\n industryOverviewUpgrades.appendChild(createElement(\"div\", {\r\n class:\"cmpy-mgmt-upgrade-div\", display:\"inline-block\",\r\n innerHTML:upgrade[4] + ' - ' + numeral(cost).format(\"$0.000a\"),\r\n tooltip:upgrade[5],\r\n clickListener:()=>{\r\n if (corp.funds.lt(cost)) {\r\n dialogBoxCreate(\"Insufficient funds\");\r\n } else {\r\n corp.funds = corp.funds.minus(cost);\r\n division.upgrade(upgrade, {\r\n corporation:corp,\r\n office:office,\r\n });\r\n corp.displayDivisionContent(division, city);\r\n }\r\n }\r\n }));\r\n industryOverviewUpgrades.appendChild(createElement(\"br\", {}));\r\n\r\n })(i, this, division, office);\r\n }\r\n\r\n\r\n industryOverviewPanel.appendChild(industryOverviewUpgrades);\r\n\r\n //Industry Overview 'Create Product' button if applicable\r\n if (division.makesProducts) {\r\n //Get the text on the button based on Industry type\r\n var createProductButtonText, createProductPopupText;\r\n switch(division.type) {\r\n case Industries.Food:\r\n createProductButtonText = \"Build Restaurant\";\r\n createProductPopupText = \"Build and manage a new restaurant!\"\r\n break;\r\n case Industries.Tobacco:\r\n createProductButtonText = \"Create Product\";\r\n createProductPopupText = \"Create a new tobacco product!\";\r\n break;\r\n case Industries.Pharmaceutical:\r\n createProductButtonText = \"Create Drug\";\r\n createProductPopupText = \"Design and develop a new pharmaceutical drug!\";\r\n break;\r\n case Industries.Computer:\r\n case \"Computer\":\r\n createProductButtonText = \"Create Product\";\r\n createProductPopupText = \"Design and manufacture a new computer hardware product!\";\r\n break;\r\n case Industries.Robotics:\r\n createProductButtonText = \"Design Robot\";\r\n createProductPopupText = \"Design and create a new robot or robotic system!\";\r\n break;\r\n case Industries.Software:\r\n createProductButtonText = \"Develop Software\";\r\n createProductPopupText = \"Develop a new piece of software!\";\r\n break;\r\n case Industries.HealthCare:\r\n createProductButtonText = \"Build Hospital\";\r\n createProductPopupText = \"Build and manage a new hospital!\";\r\n break;\r\n case Industries.RealEstate:\r\n createProductButtonText = \"Develop Property\";\r\n createProductPopupText = \"Develop a new piece of real estate property!\";\r\n break;\r\n default:\r\n createProductButtonText = \"Create Product\";\r\n return \"\";\r\n }\r\n createProductPopupText += \"<br><br>To begin developing a product, \" +\r\n \"first choose the city in which it will be designed. The stats of your employees \" +\r\n \"in the selected city affect the properties of the finished product, such as its \" +\r\n \"quality, performance, and durability.<br><br>\" +\r\n \"You can also choose to invest money in the design and marketing of \" +\r\n \"the product. Investing money in its design will result in a superior product. \" +\r\n \"Investing money in marketing the product will help the product's sales.\";\r\n\r\n //Create the button\r\n industryOverviewPanel.appendChild(createElement(\"a\", {\r\n class:\"a-link-button\", innerText:createProductButtonText, margin:\"6px\", display:\"inline-block\",\r\n clickListener:()=>{\r\n var popupId = \"cmpy-mgmt-create-product-popup\";\r\n var txt = createElement(\"p\", {\r\n innerHTML:createProductPopupText,\r\n });\r\n var designCity = createElement(\"select\", {});\r\n for (var cityName in division.offices) {\r\n if (division.offices[cityName] instanceof OfficeSpace) {\r\n designCity.add(createElement(\"option\", {\r\n value:cityName,\r\n text:cityName\r\n }));\r\n }\r\n }\r\n var foo = \"Product Name\";\r\n if (division.type === Industries.Food) {\r\n foo = \"Restaurant Name\";\r\n } else if (division.type === Industries.Healthcare) {\r\n foo = \"Hospital Name\";\r\n } else if (division.type === Industries.RealEstate) {\r\n foo = \"Property Name\";\r\n }\r\n var productNameInput = createElement(\"input\", {\r\n placeholder:foo,\r\n });\r\n var lineBreak1 = createElement(\"br\",{});\r\n var designInvestInput = createElement(\"input\", {\r\n type:\"number\",\r\n placeholder:\"Design investment\"\r\n });\r\n var marketingInvestInput = createElement(\"input\", {\r\n type:\"number\",\r\n placeholder:\"Marketing investment\"\r\n });\r\n var confirmBtn = createElement(\"a\", {\r\n class:\"a-link-button\",\r\n innerText:\"Develop Product\",\r\n clickListener:()=>{\r\n if (designInvestInput.value == null) {designInvestInput.value = 0;}\r\n if (marketingInvestInput.value == null) {marketingInvestInput.value = 0;}\r\n var designInvest = parseFloat(designInvestInput.value),\r\n marketingInvest = parseFloat(marketingInvestInput.value);\r\n if (productNameInput.value == null || productNameInput.value === \"\") {\r\n dialogBoxCreate(\"You must specify a name for your product!\");\r\n } else if (isNaN(designInvest)) {\r\n dialogBoxCreate(\"Invalid value for design investment\");\r\n } else if (isNaN(marketingInvest)) {\r\n dialogBoxCreate(\"Invalid value for marketing investment\");\r\n } else if (this.funds.lt(designInvest + marketingInvest)) {\r\n dialogBoxCreate(\"You don't have enough company funds to make this large of an investment\");\r\n } else {\r\n var product = new Product({\r\n name:productNameInput.value.replace(/[<>]/g, ''), //Sanitize for HTMl elements\r\n createCity:designCity.options[designCity.selectedIndex].value,\r\n designCost: designInvest,\r\n advCost: marketingInvest,\r\n });\r\n this.funds = this.funds.minus(designInvest + marketingInvest);\r\n division.products[product.name] = product;\r\n removeElementById(popupId);\r\n }\r\n //this.updateUIContent();\r\n this.displayDivisionContent(division, city);\r\n return false;\r\n }\r\n })\r\n var cancelBtn = createElement(\"a\", {\r\n class:\"a-link-button\",\r\n innerText:\"Cancel\",\r\n clickListener:()=>{\r\n removeElementById(popupId);\r\n return false;\r\n }\r\n })\r\n createPopup(popupId, [txt, designCity, productNameInput, lineBreak1,\r\n designInvestInput, marketingInvestInput, confirmBtn, cancelBtn]);\r\n }\r\n }));\r\n }\r\n\r\n //Employee and Office Panel\r\n industryEmployeeText = createElement(\"p\", {\r\n id: \"cmpy-mgmt-employee-p\",\r\n display:\"block\",\r\n innerHTML: \"<h1>Office Space</h1><br>\" +\r\n \"Type: \" + office.tier + \"<br>\" +\r\n \"Comfort: \" + office.comf + \"<br>\" +\r\n \"Beauty: \" + office.beau + \"<br>\" +\r\n \"Size: \" + office.employees.length + \" / \" + office.size + \" employees\",\r\n });\r\n industryEmployeePanel.appendChild(industryEmployeeText);\r\n\r\n //Hire Employee button\r\n if (office.employees.length === 0) {\r\n industryEmployeeHireButton = createElement(\"a\", {\r\n class:\"a-link-button\",display:\"inline-block\",\r\n innerText:\"Hire Employee\", fontSize:\"13px\",\r\n tooltip:\"You'll need to hire some employees to get your operations started! \" +\r\n \"It's recommended to have at least one employee in every position\",\r\n clickListener:()=>{\r\n office.findEmployees({corporation:this, division:division});\r\n return false;\r\n }\r\n });\r\n //industryEmployeeHireButton.classList.add(\"flashing-button\");\r\n } else {\r\n industryEmployeeHireButton = createElement(\"a\", {\r\n class:\"a-link-button\",display:\"inline-block\",\r\n innerText:\"Hire Employee\", fontSize:\"13px\",\r\n clickListener:()=>{\r\n office.findEmployees({corporation:this, division:division});\r\n return false;\r\n }\r\n });\r\n }\r\n industryEmployeePanel.appendChild(industryEmployeeHireButton);\r\n\r\n //Autohire Employee button\r\n industryEmployeeAutohireButton = createElement(\"a\", {\r\n class:\"a-link-button\", display:\"inline-block\",\r\n innerText:\"Autohire Employee\", fontSize:\"13px\",\r\n tooltip:\"Automatically hires an employee and gives him/her a random name\",\r\n clickListener:()=>{\r\n office.hireRandomEmployee({corporation:this, division:division});\r\n return false;\r\n }\r\n });\r\n industryEmployeePanel.appendChild(industryEmployeeAutohireButton);\r\n\r\n //Upgrade Office Size button\r\n industryEmployeePanel.appendChild(createElement(\"br\", {}));\r\n industryOfficeUpgradeSizeButton = createElement(\"a\", {\r\n class:\"a-link-button\", innerText:\"Upgrade size\",\r\n display:\"inline-block\", margin:\"6px\", fontSize:\"13px\",\r\n tooltip:\"Upgrade the office's size so that it can hold more employees!\",\r\n clickListener:()=>{\r\n var popupId = \"cmpy-mgmt-upgrade-office-size-popup\";\r\n var initialPriceMult = Math.round(office.size / OfficeInitialSize);\r\n var upgradeCost = OfficeInitialCost * Math.pow(1.07, initialPriceMult);\r\n\r\n //Calculate cost to upgrade size by 15 employees\r\n var mult = 0;\r\n for (var i = 0; i < 5; ++i) {\r\n mult += (Math.pow(1.07, initialPriceMult + i));\r\n }\r\n var upgradeCost15 = OfficeInitialCost * mult;\r\n\r\n //Calculate max upgrade size and cost\r\n var maxMult = (this.funds.dividedBy(OfficeInitialCost)).toNumber();\r\n var maxNum = 1;\r\n mult = Math.pow(1.07, initialPriceMult);\r\n while(maxNum < 50) { //Hard cap of 50x (extra 150 employees)\r\n if (mult >= maxMult) {break;}\r\n var multIncrease = Math.pow(1.07, initialPriceMult + maxNum);\r\n if (mult + multIncrease > maxMult) {\r\n break;\r\n } else {\r\n mult += multIncrease;\r\n }\r\n ++maxNum;\r\n }\r\n\r\n var upgradeCostMax = OfficeInitialCost * mult;\r\n\r\n var text = createElement(\"p\", {\r\n innerText:\"Increase the size of your office space to fit additional employees!\"\r\n });\r\n var text2 = createElement(\"p\", {innerText: \"Upgrade size: \"});\r\n\r\n var confirmBtn = createElement(\"a\", {\r\n class: this.funds.lt(upgradeCost) ? \"a-link-button-inactive\" : \"a-link-button\",\r\n display:\"inline-block\", margin:\"4px\", innerText:\"by 3\",\r\n tooltip:numeral(upgradeCost).format(\"$0.000a\"),\r\n clickListener:()=>{\r\n if (this.funds.lt(upgradeCost)) {\r\n dialogBoxCreate(\"You don't have enough company funds to purchase this upgrade!\");\r\n } else {\r\n office.size += OfficeInitialSize;\r\n this.funds = this.funds.minus(upgradeCost);\r\n dialogBoxCreate(\"Office space increased! It can now hold \" + office.size + \" employees\");\r\n this.updateUIContent();\r\n }\r\n removeElementById(popupId);\r\n return false;\r\n }\r\n });\r\n var confirmBtn15 = createElement(\"a\", {\r\n class: this.funds.lt(upgradeCost15) ? \"a-link-button-inactive\" : \"a-link-button\",\r\n display:\"inline-block\", margin:\"4px\", innerText:\"by 15\",\r\n tooltip:numeral(upgradeCost15).format(\"$0.000a\"),\r\n clickListener:()=>{\r\n if (this.funds.lt(upgradeCost15)) {\r\n dialogBoxCreate(\"You don't have enough company funds to purchase this upgrade!\");\r\n } else {\r\n office.size += (OfficeInitialSize * 5);\r\n this.funds = this.funds.minus(upgradeCost15);\r\n dialogBoxCreate(\"Office space increased! It can now hold \" + office.size + \" employees\");\r\n this.updateUIContent();\r\n }\r\n removeElementById(popupId);\r\n return false;\r\n }\r\n });\r\n var confirmBtnMax = createElement(\"a\", {\r\n class:this.funds.lt(upgradeCostMax) ? \"a-link-button-inactive\" : \"a-link-button\",\r\n display:\"inline-block\", margin:\"4px\", innerText:\"by MAX (\" + maxNum*OfficeInitialSize + \")\",\r\n tooltip:numeral(upgradeCostMax).format(\"$0.000a\"),\r\n clickListener:()=>{\r\n if (this.funds.lt(upgradeCostMax)) {\r\n dialogBoxCreate(\"You don't have enough company funds to purchase this upgrade!\");\r\n } else {\r\n office.size += (OfficeInitialSize * maxNum);\r\n this.funds = this.funds.minus(upgradeCostMax);\r\n dialogBoxCreate(\"Office space increased! It can now hold \" + office.size + \" employees\");\r\n this.updateUIContent();\r\n }\r\n removeElementById(popupId);\r\n return false;\r\n }\r\n });\r\n var cancelBtn = createElement(\"a\", {\r\n class:\"a-link-button\", innerText:\"Cancel\", display:\"inline-block\", margin:\"4px\",\r\n clickListener:()=>{\r\n removeElementById(popupId);\r\n return false;\r\n }\r\n })\r\n createPopup(popupId, [text, text2, confirmBtn, confirmBtn15, confirmBtnMax, cancelBtn]);\r\n return false;\r\n }\r\n });\r\n industryEmployeePanel.appendChild(industryOfficeUpgradeSizeButton);\r\n\r\n //Throw Office Party\r\n industryEmployeePanel.appendChild(createElement(\"a\", {\r\n class:\"a-link-button\", display:\"inline-block\", innerText:\"Throw Party\",\r\n fontSize:\"13px\",\r\n tooltip:\"Throw an office party to increase your employee's morale and happiness\",\r\n clickListener:()=>{\r\n var popupId = \"cmpy-mgmt-throw-office-party-popup\";\r\n var txt = createElement(\"p\", {\r\n innerText:\"Enter the amount of money you would like to spend PER EMPLOYEE \" +\r\n \"on this office party\"\r\n });\r\n var totalCostTxt = createElement(\"p\", {\r\n innerText:\"Throwing this party will cost a total of $0\"\r\n });\r\n var confirmBtn;\r\n var input = createElement(\"input\", {\r\n type:\"number\", margin:\"5px\", placeholder:\"$ / employee\",\r\n inputListener:()=>{\r\n if (isNaN(input.value) || input.value < 0) {\r\n totalCostTxt.innerText = \"Invalid value entered!\"\r\n } else {\r\n var totalCost = input.value * office.employees.length;\r\n totalCostTxt.innerText = \"Throwing this party will cost a total of \" + numeral(totalCost).format('$0.000a');\r\n }\r\n },\r\n onkeyup:(e)=>{\r\n e.preventDefault();\r\n if (e.keyCode === 13) {confirmBtn.click();}\r\n }\r\n });\r\n confirmBtn = createElement(\"a\", {\r\n class:\"a-link-button\",\r\n display:\"inline-block\",\r\n innerText:\"Throw Party\",\r\n clickListener:()=>{\r\n if (isNaN(input.value) || input.value < 0) {\r\n dialogBoxCreate(\"Invalid value entered\");\r\n } else {\r\n var totalCost = input.value * office.employees.length;\r\n if (this.funds.lt(totalCost)) {\r\n dialogBoxCreate(\"You don't have enough company funds to throw this party!\");\r\n } else {\r\n this.funds = this.funds.minus(totalCost);\r\n var mult;\r\n for (var fooit = 0; fooit < office.employees.length; ++fooit) {\r\n mult = office.employees[fooit].throwParty(input.value);\r\n }\r\n dialogBoxCreate(\"You threw a party for the office! The morale and happiness \" +\r\n \"of each employee increased by \" + formatNumber((mult-1) * 100, 2) + \"%.\");\r\n removeElementById(popupId);\r\n }\r\n }\r\n return false;\r\n }\r\n });\r\n var cancelBtn = createElement(\"a\", {\r\n class:\"a-link-button\",\r\n display:\"inline-block\",\r\n innerText:\"Cancel\",\r\n clickListener:()=>{\r\n removeElementById(popupId);\r\n return false;\r\n }\r\n });\r\n createPopup(popupId, [txt, totalCostTxt, input, confirmBtn, cancelBtn]);\r\n }\r\n }));\r\n\r\n industryEmployeeManagementUI = createElement(\"div\", {});\r\n industryEmployeeInfo = createElement(\"p\", {margin:\"4px\", padding:\"4px\"});\r\n if (empManualAssignmentModeActive) {\r\n //Employees manually assigned\r\n industryEmployeeManagementUI.appendChild(createElement(\"a\", {\r\n class:\"a-link-button\", display:\"inline-block\", margin:\"4px\",\r\n innerText:\"Switch to Auto Mode\",\r\n tooltip:\"Switch to Automatic Assignment Mode, which will automatically \" +\r\n \"assign employees to your selected jobs. You simply have to select \" +\r\n \"the number of assignments for each job\",\r\n clickListener:()=>{\r\n empManualAssignmentModeActive = false;\r\n this.displayDivisionContent(division, city);\r\n }\r\n }));\r\n industryEmployeeManagementUI.appendChild(createElement(\"br\", {}));\r\n\r\n industryIndividualEmployeeInfo = createElement(\"div\", {margin:\"4px\", padding:\"4px\"});\r\n var selector = createElement(\"select\", {\r\n color: \"white\", backgroundColor:\"black\", margin:\"4px\", padding:\"4px\",\r\n changeListener:()=>{\r\n var name = selector.options[selector.selectedIndex].text;\r\n for (var i = 0; i < office.employees.length; ++i) {\r\n if (office.employees[i].name === name) {\r\n removeChildrenFromElement(industryIndividualEmployeeInfo);\r\n office.employees[i].createUI(industryIndividualEmployeeInfo, this);\r\n return;\r\n }\r\n }\r\n console.log(\"ERROR: Employee in selector could not be found\");\r\n }\r\n });\r\n\r\n for (var i = 0; i < office.employees.length; ++i) {\r\n selector.add(createElement(\"option\", {text:office.employees[i].name}));\r\n }\r\n\r\n selector.selectedIndex = -1;\r\n\r\n industryEmployeeManagementUI.appendChild(industryEmployeeInfo);\r\n industryEmployeeManagementUI.appendChild(selector);\r\n industryEmployeeManagementUI.appendChild(industryIndividualEmployeeInfo);\r\n } else {\r\n //Player only manages the number of each occupation, not who gets what job\r\n industryEmployeeManagementUI.appendChild(createElement(\"a\", {\r\n class:\"a-link-button\", display:\"inline-block\", margin:\"4px\",\r\n innerText:\"Switch to Manual Mode\",\r\n tooltip:\"Switch to Manual Assignment Mode, which allows you to \" +\r\n \"specify which employees should get which jobs\",\r\n clickListener:()=>{\r\n empManualAssignmentModeActive = true;\r\n this.displayDivisionContent(division, city);\r\n }\r\n }));\r\n industryEmployeeManagementUI.appendChild(createElement(\"br\", {}));\r\n\r\n var opCount = 0, engCount = 0, busCount = 0,\r\n mgmtCount = 0, rndCount = 0, unassignedCount = 0,\r\n trainingCount = 0;\r\n for (var i = 0; i < office.employees.length; ++i) {\r\n switch (office.employees[i].pos) {\r\n case EmployeePositions.Operations:\r\n ++opCount; break;\r\n case EmployeePositions.Engineer:\r\n ++engCount; break;\r\n case EmployeePositions.Business:\r\n ++busCount; break;\r\n case EmployeePositions.Management:\r\n ++mgmtCount; break;\r\n case EmployeePositions.RandD:\r\n ++rndCount; break;\r\n case EmployeePositions.Unassigned:\r\n ++unassignedCount; break;\r\n case EmployeePositions.Training:\r\n ++trainingCount; break;\r\n default:\r\n console.log(\"ERROR: Unrecognized employee position: \" + office.employees[i].pos);\r\n break;\r\n }\r\n }\r\n\r\n //Unassigned employee count display\r\n industryEmployeeManagementUI.appendChild(createElement(\"p\", {\r\n display:\"inline-block\",\r\n innerText:\"Unassigned Employees: \" + unassignedCount,\r\n }));\r\n industryEmployeeManagementUI.appendChild(createElement(\"br\", {}));\r\n\r\n //General display of employee information (avg morale, avg energy, etc.)\r\n industryEmployeeManagementUI.appendChild(industryEmployeeInfo);\r\n industryEmployeeManagementUI.appendChild(createElement(\"br\", {}));\r\n\r\n var positions = [EmployeePositions.Operations, EmployeePositions.Engineer,\r\n EmployeePositions.Business, EmployeePositions.Management,\r\n EmployeePositions.RandD, EmployeePositions.Training];\r\n var descriptions = [\"Manages supply chain operations. Improves production.\", //Operations\r\n \"Develops and maintains products and production systems. Improves production.\", //Engineer\r\n \"Handles sales and finances. Improves sales.\", //Business\r\n \"Leads and oversees employees and office operations. Improves production.\", //Management\r\n \"Research new innovative ways to improve the company. Generates Scientific Research\", //RandD\r\n \"Set employee to training, which will increase some of their stats. Employees in training do not affect any company operations.\"] //Training\r\n var counts = [opCount, engCount, busCount, mgmtCount, rndCount, trainingCount];\r\n for (var i = 0; i < positions.length; ++i) {\r\n (function(corp, i) {\r\n var info = createElement(\"h2\", {\r\n display:\"inline-block\", width:\"40%\", fontSize:\"15px\",\r\n innerText: positions[i] + \"(\" + counts[i] + \")\",\r\n tooltipleft: descriptions[i]\r\n });\r\n var plusBtn = createElement(\"a\", {\r\n class: unassignedCount > 0 ? \"a-link-button\" : \"a-link-button-inactive\",\r\n display:\"inline-block\", innerText:\"+\",\r\n clickListener:()=>{\r\n office.assignEmployeeToJob(positions[i]);\r\n corp.displayDivisionContent(division, city);\r\n }\r\n });\r\n var minusBtn = createElement(\"a\", {\r\n class: counts[i] > 0 ? \"a-link-button\" : \"a-link-button-inactive\",\r\n display:\"inline-block\", innerText:\"-\",\r\n clickListener:()=>{\r\n office.unassignEmployeeFromJob(positions[i]);\r\n corp.displayDivisionContent(division, city);\r\n }\r\n });\r\n var newline = createElement(\"br\", {});\r\n industryEmployeeManagementUI.appendChild(info);\r\n industryEmployeeManagementUI.appendChild(plusBtn);\r\n industryEmployeeManagementUI.appendChild(minusBtn);\r\n industryEmployeeManagementUI.appendChild(newline);\r\n })(this, i);\r\n }\r\n }\r\n industryEmployeePanel.appendChild(industryEmployeeManagementUI);\r\n\r\n //Warehouse Panel\r\n var warehouse = division.warehouses[currentCityUi];\r\n if (warehouse instanceof Warehouse) {\r\n warehouse.createUI({industry:division, company: this});\r\n } else {\r\n industryWarehousePanel.appendChild(createElement(\"a\", {\r\n innerText:\"Purchase Warehouse ($5b)\",\r\n class: \"a-link-button\",\r\n clickListener:()=>{\r\n if (this.funds.lt(WarehouseInitialCost)) {\r\n dialogBoxCreate(\"You do not have enough funds to do this!\");\r\n } else {\r\n division.warehouses[currentCityUi] = new Warehouse({\r\n loc:currentCityUi,\r\n size:WarehouseInitialSize,\r\n });\r\n this.funds = this.funds.minus(WarehouseInitialCost);\r\n this.displayDivisionContent(division, currentCityUi);\r\n }\r\n return false;\r\n }\r\n }));\r\n }\r\n this.updateDivisionContent(division);\r\n}\r\n\r\nCorporation.prototype.updateDivisionContent = function(division) {\r\n if (!(division instanceof Industry)) {\r\n console.log(\"ERROR: Invalid 'division' argument in Corporation.updateDivisionContent\");\r\n return;\r\n }\r\n var vechain = (this.unlockUpgrades[4] === 1);\r\n //Industry Overview Text\r\n var profit = division.lastCycleRevenue.minus(division.lastCycleExpenses).toNumber(),\r\n profitStr = profit >= 0 ? numeral(profit).format(\"$0.000a\") : \"-\" + numeral(-1 * profit).format(\"$0.000a\");\r\n var advertisingInfo = \"\";\r\n if (vechain) {\r\n var advertisingFactors = division.getAdvertisingFactors();\r\n var awarenessFac = advertisingFactors[1];\r\n var popularityFac = advertisingFactors[2];\r\n var ratioFac = advertisingFactors[3];\r\n var totalAdvertisingFac = advertisingFactors[0];\r\n advertisingInfo =\r\n \"<p class='tooltip'>Advertising Multiplier: x\" + formatNumber(totalAdvertisingFac, 3) +\r\n \"<span class='tooltiptext' style='font-size:12px'>Total multiplier for this industry's sales due to its awareness and popularity<br>\" +\r\n \"Awareness Bonus: x\" + formatNumber(Math.pow(awarenessFac, 0.85), 3) + \"<br>\" +\r\n \"Popularity Bonus: x\" + formatNumber(Math.pow(popularityFac, 0.85), 3) + \"<br>\" +\r\n \"Ratio Multiplier: x\" + formatNumber(Math.pow(ratioFac, 0.85), 3) + \"</span></p><br>\"\r\n\r\n }\r\n\r\n removeChildrenFromElement(industryOverviewText);\r\n industryOverviewText.appendChild(createElement(\"p\", {\r\n innerHTML:\"Industry: \" + division.type + \" (Corp Funds: \" + numeral(this.funds.toNumber()).format(\"$0.000a\") + \")<br><br>\" +\r\n \"Awareness: \" + formatNumber(division.awareness, 3) + \"<br>\" +\r\n \"Popularity: \" + formatNumber(division.popularity, 3) + \"<br>\" +\r\n advertisingInfo + \"<br>\" +\r\n \"Revenue: \" + numeral(division.lastCycleRevenue.toNumber()).format(\"$0.000a\") + \" / s<br>\" +\r\n \"Expenses: \" + numeral(division.lastCycleExpenses.toNumber()).format(\"$0.000a\") + \" /s<br>\" +\r\n \"Profit: \" + profitStr + \" / s<br><br>\"\r\n }));\r\n industryOverviewText.appendChild(createElement(\"p\", {\r\n marginTop:\"2px\",\r\n innerText:\"Production Multiplier: \" + formatNumber(division.prodMult, 2),\r\n tooltip:\"Production gain from owning production-boosting materials \" +\r\n \"such as hardware, Robots, AI Cores, and Real Estate\"\r\n }));\r\n industryOverviewText.appendChild(createElement(\"div\", {\r\n innerText:\"?\", class:\"help-tip\",\r\n clickListener:()=>{\r\n dialogBoxCreate(\"Owning Hardware, Robots, AI Cores, and Real Estate \" +\r\n \"can boost your Industry's production. The effect these \" +\r\n \"materials have on your production varies between Industries. \" +\r\n \"For example, Real Estate may be very effective for some Industries, \" +\r\n \"but ineffective for others.<br><br>\" +\r\n \"This division's production multiplier is calculated by summing \" +\r\n \"the individual production multiplier of each of its office locations. \" +\r\n \"This production multiplier is applied to each office. Therefore, it is \" +\r\n \"beneficial to expand into new cities as this can greatly increase the \" +\r\n \"production multiplier of your entire Division.\");\r\n }\r\n }));\r\n industryOverviewText.appendChild(createElement(\"br\"));\r\n industryOverviewText.appendChild(createElement(\"p\", {\r\n display:\"inline-block\",\r\n innerText:\"Scientific Research: \" + formatNumber(division.sciResearch.qty, 3),\r\n tooltip:\"Scientific Research increases the quality of the materials and \" +\r\n \"products that you produce.\"\r\n }));\r\n\r\n //Office and Employee List\r\n var office = division.offices[currentCityUi];\r\n industryEmployeeText.innerHTML =\r\n \"<h1>Office Space</h1><br>\" +\r\n \"Type: \" + office.tier + \"<br>\" +\r\n \"Comfort: \" + office.comf + \"<br>\" +\r\n \"Beauty: \" + office.beau + \"<br>\" +\r\n \"Size: \" + office.employees.length + \" / \" + office.size + \" employees\";\r\n if (office.employees.length >= office.size) {\r\n industryEmployeeHireButton.className = \"a-link-button-inactive\";\r\n industryEmployeeAutohireButton.className = \"a-link-button-inactive tooltip\";\r\n } else if (office.employees.length === 0) {\r\n industryEmployeeHireButton.className = \"a-link-button tooltip flashing-button\";\r\n industryEmployeeAutohireButton.className = \"a-link-button tooltip\";\r\n } else {\r\n industryEmployeeHireButton.className = \"a-link-button\";\r\n industryEmployeeAutohireButton.className = \"a-link-button tooltip\";\r\n }\r\n\r\n //Employee Overview stats\r\n //Calculate average morale, happiness, and energy\r\n var totalMorale = 0, totalHappiness = 0, totalEnergy = 0,\r\n avgMorale = 0, avgHappiness = 0, avgEnergy = 0;\r\n for (var i = 0; i < office.employees.length; ++i) {\r\n totalMorale += office.employees[i].mor;\r\n totalHappiness += office.employees[i].hap;\r\n totalEnergy += office.employees[i].ene;\r\n }\r\n if (office.employees.length > 0) {\r\n avgMorale = totalMorale / office.employees.length;\r\n avgHappiness = totalHappiness / office.employees.length;\r\n avgEnergy = totalEnergy / office.employees.length;\r\n }\r\n industryEmployeeInfo.innerHTML =\r\n \"Avg Employee Morale: \" + formatNumber(avgMorale, 3) + \"<br>\" +\r\n \"Avg Employee Happiness: \" + formatNumber(avgHappiness, 3) + \"<br>\" +\r\n \"Avg Employee Energy: \" + formatNumber(avgEnergy, 3);\r\n if (vechain) { //VeChain - Statistics\r\n industryEmployeeInfo.appendChild(createElement(\"br\", {}));\r\n industryEmployeeInfo.appendChild(createElement(\"p\", {\r\n innerText:\"Material Production: \" + formatNumber(division.getOfficeProductivity(office), 3),\r\n tooltip: \"The base amount of material this office can produce. Does not include \" +\r\n \"production multipliers from upgrades and materials. This value is based off \" +\r\n \"the productivity of your Operations, Engineering, and Management employees\"\r\n }));\r\n industryEmployeeInfo.appendChild(createElement(\"br\", {}));\r\n industryEmployeeInfo.appendChild(createElement(\"p\", {\r\n innerText:\"Product Production: \" + formatNumber(division.getOfficeProductivity(office, {forProduct:true}), 3),\r\n tooltip: \"The base amount of any given Product this office can produce. Does not include \" +\r\n \"production multipliers from upgrades and materials. This value is based off \" +\r\n \"the productivity of your Operations, Engineering, and Management employees\"\r\n }));\r\n industryEmployeeInfo.appendChild(createElement(\"br\", {}));\r\n industryEmployeeInfo.appendChild(createElement(\"p\", {\r\n innerText: \"Business Multiplier: x\" + formatNumber(division.getBusinessFactor(office), 3),\r\n tooltip: \"The effect this office's 'Business' employees has on boosting sales\"\r\n }));\r\n }\r\n\r\n //Warehouse\r\n var warehouse = division.warehouses[currentCityUi];\r\n if (warehouse instanceof Warehouse) {\r\n warehouse.updateUI({industry:division, company:this});\r\n }\r\n}\r\n\r\nCorporation.prototype.createCityUITab = function(city, division) {\r\n var tab = createElement(\"button\", {\r\n id:\"cmpy-mgmt-city-\" + city + \"-tab\",\r\n class:\"cmpy-mgmt-city-tab\",\r\n innerText:city,\r\n clickListener:()=>{\r\n this.selectCityTab(tab, city);\r\n this.displayDivisionContent(division, city);\r\n return false;\r\n }\r\n });\r\n companyManagementPanel.appendChild(tab);\r\n}\r\n\r\nCorporation.prototype.selectCityTab = function(activeTab, city) {\r\n if (activeTab == null) {\r\n activeTab = document.getElementById(\"cmpy-mgmt-city-\" + city + \"-tab\");\r\n if (activeTab == null) {return;}\r\n }\r\n for (var i = 0; i < cityTabs.length; ++i) {\r\n cityTabs[i].className = \"cmpy-mgmt-city-tab\";\r\n }\r\n activeTab.className = \"cmpy-mgmt-city-tab current\";\r\n}\r\n\r\nCorporation.prototype.clearUI = function() {\r\n //Delete everything\r\n if (companyManagementDiv != null) {removeElementById(companyManagementDiv.id);}\r\n\r\n //Reset global DOM variables\r\n companyManagementDiv = null;\r\n companyManagementPanel = null;\r\n currentCityUi = null;\r\n\r\n corporationUnlockUpgrades = null;\r\n corporationUpgrades = null;\r\n\r\n industryOverviewPanel = null;\r\n industryOverviewText = null;\r\n\r\n industryEmployeePanel = null;\r\n industryEmployeeText = null;\r\n industryEmployeeHireButton = null;\r\n industryEmployeeAutohireButton = null;\r\n industryEmployeeManagementUI = null;\r\n industryEmployeeInfo = null;\r\n industryIndividualEmployeeInfo = null;\r\n\r\n industryOfficeUpgradeSizeButton = null;\r\n\r\n industryWarehousePanel = null;\r\n industrySmartSupplyCheckbox = null;\r\n industryWarehouseStorageText = null;\r\n industryWarehouseUpgradeSizeButton = null;\r\n industryWarehouseStateText = null;\r\n industryWarehouseMaterials = null;\r\n industryWarehouseProducts = null;\r\n\r\n companyManagementHeaderTabs = null;\r\n headerTabs = null;\r\n cityTabs = null;\r\n\r\n document.getElementById(\"character-overview-wrapper\").style.visibility = \"visible\";\r\n}\r\n\r\nCorporation.prototype.toJSON = function() {\r\n\treturn Generic_toJSON(\"Corporation\", this);\r\n}\r\n\r\nCorporation.fromJSON = function(value) {\r\n\treturn Generic_fromJSON(Corporation, value.data);\r\n}\r\n\r\nReviver.constructors.Corporation = Corporation;\r\n\r\nexport {Corporation};\r\n","import {Server} from \"./Server.js\";\r\nimport {dialogBoxCreate} from \"../utils/DialogBox.js\";\r\nimport {Reviver, Generic_toJSON,\r\n Generic_fromJSON} from \"../utils/JSONReviver.js\";\r\n\r\nfunction TextFile(fn=\"\", txt=\"\") {\r\n this.fn = fn.endsWith(\".txt\") ? fn : fn + \".txt\";\r\n this.fn = this.fn.replace(/\\s+/g, '');\r\n this.text = String(txt);\r\n}\r\n\r\nTextFile.prototype.append = function(txt) {\r\n this.text += String(txt);\r\n}\r\n\r\nTextFile.prototype.write = function(txt) {\r\n this.text = String(txt);\r\n}\r\n\r\nTextFile.prototype.read = function() {\r\n return this.txt;\r\n}\r\n\r\nTextFile.prototype.show = function() {\r\n dialogBoxCreate(this.fn + \"<br><br>\" + this.text, true);\r\n}\r\n\r\nTextFile.prototype.download = function() {\r\n var filename = this.fn;\r\n var file = new Blob([this.text], {type: 'text/plain'});\r\n if (window.navigator.msSaveOrOpenBlob) {// IE10+\r\n window.navigator.msSaveOrOpenBlob(file, filename);\r\n } else { // Others\r\n var a = document.createElement(\"a\"),\r\n url = URL.createObjectURL(file);\r\n a.href = url;\r\n a.download = this.fn;\r\n document.body.appendChild(a);\r\n a.click();\r\n setTimeout(function() {\r\n document.body.removeChild(a);\r\n window.URL.revokeObjectURL(url);\r\n }, 0);\r\n }\r\n}\r\n\r\nTextFile.prototype.toJSON = function() {\r\n\treturn Generic_toJSON(\"TextFile\", this);\r\n}\r\n\r\nTextFile.fromJSON = function(value) {\r\n\treturn Generic_fromJSON(TextFile, value.data);\r\n}\r\n\r\nReviver.constructors.TextFile = TextFile;\r\n\r\nfunction getTextFile(fn, server) {\r\n if (!fn.endsWith(\".txt\")) {fn += \".txt\";}\r\n for (var i = 0; i < server.textFiles.length; ++i) {\r\n if (server.textFiles[i].fn === fn) {\r\n return server.textFiles[i];\r\n }\r\n }\r\n return null;\r\n}\r\n\r\n//Returns the TextFile object that was just created\r\nfunction createTextFile(fn, txt, server) {\r\n if (getTextFile(fn, server) !== null) {\r\n console.log(\"ERROR: createTextFile failed because the specified \" +\r\n \"server already has a text file with the same fn\");\r\n return;\r\n }\r\n var file = new TextFile(fn, txt);\r\n server.textFiles.push(file);\r\n return file;\r\n}\r\n\r\nfunction deleteTextFile(fn, server) {\r\n if (!fn.endsWith(\".txt\")) {fn += \".txt\";}\r\n for (var i = 0; i < server.textFiles.length; ++i) {\r\n if (server.textFiles[i].fn === fn) {\r\n server.textFiles.splice(i, 1);\r\n return true;\r\n }\r\n }\r\n return false;\r\n}\r\n\r\nexport {TextFile, getTextFile, createTextFile};\r\n","import {Player} from \"./Player.js\";\r\nimport {BitNode, BitNodes} from \"./BitNode.js\";\r\n\r\n/* SourceFile.js */\r\n//Each SourceFile corresponds to a BitNode with the same number\r\nfunction SourceFile(number, info=\"\") {\r\n var bitnodeKey = \"BitNode\" + number;\r\n var bitnode = BitNodes[bitnodeKey];\r\n if (bitnode == null) {\r\n throw new Error(\"Invalid Bit Node for this Source File\");\r\n }\r\n\r\n this.n = number;\r\n this.name = \"Source-File \" + number + \": \" + bitnode.name;\r\n this.lvl = 1;\r\n this.info = info;\r\n this.owned = false;\r\n}\r\n\r\nlet SourceFiles = {};\r\nfunction initSourceFiles() {\r\n SourceFiles = {};\r\n SourceFiles[\"SourceFile1\"] = new SourceFile(1, \"This Source-File lets the player start with 32GB of RAM on his/her \" +\r\n \"home computer. It also increases all of the player's multipliers by:<br><br>\" +\r\n \"Level 1: 16%<br>\" +\r\n \"Level 2: 24%<br>\" +\r\n \"Level 3: 28%\");\r\n SourceFiles[\"SourceFile2\"] = new SourceFile(2, \"This Source-File increases the player's crime success rate, crime money, and charisma \" +\r\n \"multipliers by:<br><br>\" +\r\n \"Level 1: 20%<br>\" +\r\n \"Level 2: 30%<br>\" +\r\n \"Level 3: 35%\");\r\n SourceFiles[\"SourceFile3\"] = new SourceFile(3,\"This Source-File lets you create corporations on other BitNodes (although \" +\r\n \"some BitNodes will disable this mechanic). This Source-File also increases your charisma and company salary multipliers by:<br>\" +\r\n \"Level 1: 8%<br>\" +\r\n \"Level 2: 12%<br>\" +\r\n \"Level 3: 14%\");\r\n SourceFiles[\"SourceFile4\"] = new SourceFile(4, \"This Source-File lets you access and use the Singularity Functions in every BitNode. Every \" +\r\n \"level of this Source-File opens up more of the Singularity Functions you can use.\");\r\n SourceFiles[\"SourceFile5\"] = new SourceFile(5, \"This Source-File grants a special new stat called Intelligence. Intelligence \" +\r\n \"is unique because it is permanent and persistent (it never gets reset back to 1). However, \" +\r\n \"gaining Intelligence experience is much slower than other stats, and it is also hidden (you won't \" +\r\n \"know when you gain experience and how much). Higher Intelligence levels will boost your production \" +\r\n \"for many actions in the game. In addition, this Source-File will unlock the getBitNodeMultipliers() \" +\r\n \"Netscript function, and will raise all of your hacking-related multipliers by:<br><br> \" +\r\n \"Level 1: 4%<br>\" +\r\n \"Level 2: 6%<br>\" +\r\n \"Level 3: 7%\");\r\n SourceFiles[\"SourceFile6\"] = new SourceFile(6, \"This Source-File allows you to access the NSA's Bladeburner Division in other \" +\r\n \"BitNodes. In addition, this Source-File will raise the experience gain rate of all your combat stats by:<br><br>\" +\r\n \"Level 1: 8%<br>\" +\r\n \"Level 2: 12%<br>\" +\r\n \"Level 3: 14%\");\r\n SourceFiles[\"SourceFile7\"] = new SourceFile(7);\r\n SourceFiles[\"SourceFile8\"] = new SourceFile(8, \"This Source-File grants the following benefits:<br><br>\" +\r\n \"Level 1: Permanent access to WSE and TIX API<br>\" +\r\n \"Level 2: Ability to short stocks in other BitNodes<br>\" +\r\n \"Level 3: Ability to use limit/stop orders in other BitNodes<br><br>\" +\r\n \"This Source-File also increases your hacking growth multipliers by: \" +\r\n \"<br>Level 1: 8%<br>Level 2: 12%<br>Level 3: 14%\");\r\n SourceFiles[\"SourceFile9\"] = new SourceFile(9);\r\n SourceFiles[\"SourceFile10\"] = new SourceFile(10);\r\n SourceFiles[\"SourceFile11\"] = new SourceFile(11, \"This Source-File makes it so that company favor increases BOTH the player's salary and reputation gain rate \" +\r\n \"at that company by 1% per favor (rather than just the reputation gain). This Source-File also \" +\r\n \" increases the player's company salary and reputation gain multipliers by:<br><br>\" +\r\n \"Level 1: 24%<br>\" +\r\n \"Level 2: 36%<br>\" +\r\n \"Level 3: 42%<br>\");\r\n SourceFiles[\"SourceFile12\"] = new SourceFile(12, \"This Source-File increases all your multipliers by 1% per level\");\r\n}\r\n\r\nfunction PlayerOwnedSourceFile(number, level) {\r\n this.n = number;\r\n this.lvl = level;\r\n}\r\n\r\n//Takes in a PlayerOwnedSourceFile as the \"srcFile\" argument\r\nfunction applySourceFile(srcFile) {\r\n var srcFileKey = \"SourceFile\" + srcFile.n;\r\n var sourceFileObject = SourceFiles[srcFileKey];\r\n if (sourceFileObject == null) {\r\n console.log(\"ERROR: Invalid source file number: \" + srcFile.n);\r\n return;\r\n }\r\n\r\n switch(srcFile.n) {\r\n case 1: // The Source Genesis\r\n var mult = 0;\r\n for (var i = 0; i < srcFile.lvl; ++i) {\r\n mult += (16 / (Math.pow(2, i)));\r\n }\r\n var incMult = 1 + (mult / 100);\r\n var decMult = 1 - (mult / 100);\r\n Player.hacking_chance_mult *= incMult;\r\n Player.hacking_speed_mult *= incMult;\r\n Player.hacking_money_mult *= incMult;\r\n Player.hacking_grow_mult *= incMult;\r\n Player.hacking_mult *= incMult;\r\n Player.strength_mult *= incMult;\r\n Player.defense_mult *= incMult;\r\n Player.dexterity_mult *= incMult;\r\n Player.agility_mult *= incMult;\r\n Player.charisma_mult *= incMult;\r\n Player.hacking_exp_mult *= incMult;\r\n Player.strength_exp_mult *= incMult;\r\n Player.defense_exp_mult *= incMult;\r\n Player.dexterity_exp_mult *= incMult;\r\n Player.agility_exp_mult *= incMult;\r\n Player.charisma_exp_mult *= incMult;\r\n Player.company_rep_mult *= incMult;\r\n Player.faction_rep_mult *= incMult;\r\n Player.crime_money_mult *= incMult;\r\n Player.crime_success_mult *= incMult;\r\n Player.hacknet_node_money_mult *= incMult;\r\n Player.hacknet_node_purchase_cost_mult *= decMult;\r\n Player.hacknet_node_ram_cost_mult *= decMult;\r\n Player.hacknet_node_core_cost_mult *= decMult;\r\n Player.hacknet_node_level_cost_mult *= decMult;\r\n Player.work_money_mult *= incMult;\r\n break;\r\n case 2: //Rise of the Underworld\r\n var mult = 0;\r\n for (var i = 0; i < srcFile.lvl; ++i) {\r\n mult += (20 / (Math.pow(2, i)));\r\n }\r\n var incMult = 1 + (mult / 100);\r\n Player.crime_money_mult *= incMult;\r\n Player.crime_success_mult *= incMult;\r\n Player.charisma_mult *= incMult;\r\n break;\r\n case 3: //Corporatocracy\r\n var mult = 0;\r\n for (var i = 0; i < srcFile.lvl; ++i) {\r\n mult += (8 / (Math.pow(2, i)));\r\n }\r\n var incMult = 1 + (mult / 100);\r\n Player.charisma_mult *= incMult;\r\n Player.work_money_mult *= incMult;\r\n break;\r\n case 4: //The Singularity\r\n //No effects, just gives access to Singularity functions\r\n break;\r\n case 5: //Artificial Intelligence\r\n var mult = 0;\r\n for (var i = 0; i < srcFile.lvl; ++i) {\r\n mult += (4 / (Math.pow(2, i)));\r\n }\r\n var incMult = 1 + (mult / 100);\r\n Player.hacking_chance_mult *= incMult;\r\n Player.hacking_speed_mult *= incMult;\r\n Player.hacking_money_mult *= incMult;\r\n Player.hacking_grow_mult *= incMult;\r\n Player.hacking_mult *= incMult;\r\n Player.hacking_exp_mult *= incMult;\r\n break;\r\n case 6: //Bladeburner\r\n var mult = 0;\r\n for (var i = 0; i < srcFile.lvl; ++i) {\r\n mult += (8 / (Math.pow(2, i)));\r\n }\r\n var incMult = 1 + (mult / 100);\r\n Player.strength_exp_mult *= incMult;\r\n Player.defense_exp_mult *= incMult;\r\n Player.dexterity_exp_mult *= incMult;\r\n Player.agility_exp_mult *= incMult;\r\n break;\r\n case 8: //Ghost of Wall Street\r\n var mult = 0;\r\n for (var i = 0; i < srcFile.lvl; ++i) {\r\n mult += (8 / (Math.pow(2, i)));\r\n }\r\n var incMult = 1 + (mult / 100);\r\n Player.hacking_grow_mult *= incMult;\r\n break;\r\n case 11: //The Big Crash\r\n var mult = 0;\r\n for (var i = 0; i < srcFile.lvl; ++i) {\r\n mult += (24 / (Math.pow(2, i)));\r\n }\r\n var incMult = 1 + (mult / 100);\r\n Player.work_money_mult *= incMult;\r\n Player.company_rep_mult *= incMult;\r\n break;\r\n case 12: //The testing ground\r\n const inc = Math.pow(1.01, srcFile.lvl);\r\n const dec = Math.pow(0.99, srcFile.lvl);\r\n\r\n Player.hacking_chance_mult *= inc;\r\n Player.hacking_speed_mult *= inc;\r\n Player.hacking_money_mult *= inc;\r\n Player.hacking_grow_mult *= inc;\r\n Player.hacking_mult *= inc;\r\n\r\n Player.strength_mult *= inc;\r\n Player.defense_mult *= inc;\r\n Player.dexterity_mult *= inc;\r\n Player.agility_mult *= inc;\r\n Player.charisma_mult *= inc;\r\n\r\n Player.hacking_exp_mult *= inc;\r\n Player.strength_exp_mult *= inc;\r\n Player.defense_exp_mult *= inc;\r\n Player.dexterity_exp_mult *= inc;\r\n Player.agility_exp_mult *= inc;\r\n Player.charisma_exp_mult *= inc;\r\n\r\n Player.company_rep_mult *= inc;\r\n Player.faction_rep_mult *= inc;\r\n\r\n Player.crime_money_mult *= inc;\r\n Player.crime_success_mult *= inc;\r\n\r\n Player.hacknet_node_money_mult *= inc;\r\n Player.hacknet_node_purchase_cost_mult *= dec;\r\n Player.hacknet_node_ram_cost_mult *= dec;\r\n Player.hacknet_node_core_cost_mult *= dec;\r\n Player.hacknet_node_level_cost_mult *= dec;\r\n\r\n Player.work_money_mult *= inc;\r\n default:\r\n console.log(\"ERROR: Invalid source file number: \" + srcFile.n);\r\n break;\r\n }\r\n\r\n sourceFileObject.owned = true;\r\n}\r\n\r\nexport {SourceFiles, PlayerOwnedSourceFile, applySourceFile, initSourceFiles};\r\n","import {BitNode, BitNodes} from \"./BitNode.js\";\r\nimport {Engine} from \"./engine.js\";\r\nimport {Player} from \"./Player.js\";\r\nimport {prestigeSourceFile} from \"./Prestige.js\";\r\nimport {SourceFiles, SourceFile,\r\n PlayerOwnedSourceFile} from \"./SourceFile.js\";\r\nimport {Terminal} from \"./Terminal.js\";\r\n\r\nimport {dialogBoxCreate} from \"../utils/DialogBox.js\";\r\nimport {clearEventListeners,\r\n removeChildrenFromElement} from \"../utils/HelperFunctions.js\";\r\nimport {yesNoBoxCreate, yesNoBoxGetYesButton,\r\n yesNoBoxGetNoButton, yesNoBoxClose} from \"../utils/YesNoBox.js\";\r\n\r\n/* RedPill.js\r\n * Implements what happens when you have Red Pill augmentation and then hack the world daemon */\r\n\r\n//Returns promise\r\nfunction writeRedPillLine(line) {\r\n return new Promise(function(resolve, reject) {\r\n\r\n var container = document.getElementById(\"red-pill-container\");\r\n var pElem = document.createElement(\"p\");\r\n container.appendChild(pElem);\r\n\r\n var promise = writeRedPillLetter(pElem, line, 0);\r\n promise.then(function(res) {\r\n resolve(res);\r\n }, function(e) {\r\n reject(e);\r\n });\r\n });\r\n}\r\n\r\nfunction writeRedPillLetter(pElem, line, i=0) {\r\n return new Promise(function(resolve, reject) {\r\n setTimeout(function() {\r\n if (i >= line.length) {\r\n var textToShow = line.substring(0, i);\r\n pElem.innerHTML = \"> \" + textToShow;\r\n return resolve(true);\r\n }\r\n var textToShow = line.substring(0, i);\r\n pElem.innerHTML = \"> \" + textToShow + \"<span class='typed-cursor'> &#9608; </span>\";\r\n var promise = writeRedPillLetter(pElem, line, i+1);\r\n promise.then(function(res) {\r\n resolve(res);\r\n }, function(e) {\r\n reject(e);\r\n });\r\n }, 30);\r\n });\r\n}\r\n\r\nlet redPillFlag = false;\r\nfunction hackWorldDaemon(currentNodeNumber, flume=false) {\r\n redPillFlag = true;\r\n Engine.loadRedPillContent();\r\n return writeRedPillLine(\"[ERROR] SEMPOOL INVALID\").then(function() {\r\n return writeRedPillLine(\"[ERROR] Segmentation Fault\");\r\n }).then(function() {\r\n return writeRedPillLine(\"[ERROR] SIGKILL RECVD\");\r\n }).then(function() {\r\n return writeRedPillLine(\"Dumping core...\");\r\n }).then(function() {\r\n return writeRedPillLine(\"0000 000016FA 174FEE40 29AC8239 384FEA88\");\r\n }).then(function() {\r\n return writeRedPillLine(\"0010 745F696E 2BBBE394 390E3940 248BEC23\");\r\n }).then(function() {\r\n return writeRedPillLine(\"0020 7124696B 0000FF69 74652E6F FFFF1111\");\r\n }).then(function() {\r\n return writeRedPillLine(\"----------------------------------------\");\r\n }).then(function() {\r\n return writeRedPillLine(\"Failsafe initiated...\");\r\n }).then(function() {\r\n return writeRedPillLine(\"Restarting BitNode-\" + currentNodeNumber + \"...\");\r\n }).then(function() {\r\n return writeRedPillLine(\"...........\");\r\n }).then(function() {\r\n return writeRedPillLine(\"...........\");\r\n }).then(function() {\r\n return writeRedPillLine(\"[ERROR] FAILED TO AUTOMATICALLY REBOOT BITNODE\");\r\n }).then(function() {\r\n return writeRedPillLine(\"..............................................\")\r\n }).then(function() {\r\n return writeRedPillLine(\"..............................................\")\r\n }).then(function() {\r\n return loadBitVerse(currentNodeNumber, flume);\r\n }).catch(function(e){\r\n console.log(\"ERROR: \" + e.toString());\r\n });\r\n}\r\n\r\n//The bitNode name passed in will have a hyphen between number (e.g. BitNode-1)\r\n//This needs to be removed\r\nfunction giveSourceFile(bitNodeNumber) {\r\n var sourceFileKey = \"SourceFile\"+ bitNodeNumber.toString();\r\n var sourceFile = SourceFiles[sourceFileKey];\r\n if (sourceFile == null) {\r\n console.log(\"ERROR: could not find source file for Bit node: \" + bitNodeNumber);\r\n return;\r\n }\r\n\r\n //Check if player already has this source file\r\n var alreadyOwned = false;\r\n var ownedSourceFile = null;\r\n for (var i = 0; i < Player.sourceFiles.length; ++i) {\r\n if (Player.sourceFiles[i].n === bitNodeNumber) {\r\n alreadyOwned = true;\r\n ownedSourceFile = Player.sourceFiles[i];\r\n break;\r\n }\r\n }\r\n\r\n if (alreadyOwned && ownedSourceFile) {\r\n if (ownedSourceFile.lvl >= 3 && ownedSourceFile.n !== 12) {\r\n dialogBoxCreate(\"The Source-File for the BitNode you just destroyed, \" + sourceFile.name + \", \" +\r\n \"is already at max level!\");\r\n } else {\r\n ++ownedSourceFile.lvl;\r\n dialogBoxCreate(sourceFile.name + \" was upgraded to level \" + ownedSourceFile.lvl + \" for \" +\r\n \"destroying its corresponding BitNode!\");\r\n }\r\n } else {\r\n var playerSrcFile = new PlayerOwnedSourceFile(bitNodeNumber, 1);\r\n Player.sourceFiles.push(playerSrcFile);\r\n if (bitNodeNumber === 5) { //Artificial Intelligence\r\n Player.intelligence = 1;\r\n }\r\n dialogBoxCreate(\"You received a Source-File for destroying a Bit Node!<br><br>\" +\r\n sourceFile.name + \"<br><br>\" + sourceFile.info);\r\n }\r\n}\r\n\r\nfunction loadBitVerse(destroyedBitNodeNum, flume=false) {\r\n //Clear the screen\r\n var container = document.getElementById(\"red-pill-container\");\r\n removeChildrenFromElement(container);\r\n\r\n //Create the Bit Verse\r\n var bitVerseImage = document.createElement(\"pre\");\r\n var bitNodes = [];\r\n for (var i = 1; i <= 12; ++i) {\r\n bitNodes.push(createBitNode(i));\r\n }\r\n\r\n bitVerseImage.innerHTML =\r\n \" O <br>\" +\r\n \" | O O | O O | <br>\" +\r\n \" O | | / __| \\\\ | | O <br>\" +\r\n \" O | O | | O / | O | | O | O <br>\" +\r\n \" | | | | |_/ |/ | \\\\_ \\\\_| | | | | <br>\" +\r\n \" O | | | O | | O__/ | / \\\\__ | | O | | | O <br>\" +\r\n \" | | | | | | | / /| O / \\\\| | | | | | | <br>\" +\r\n \"O | | | \\\\| | O / _/ | / O | |/ | | | O<br>\" +\r\n \"| | | |O / | | O / | O O | | \\\\ O| | | |<br>\" +\r\n \"| | |/ \\\\/ / __| | |/ \\\\ | \\\\ | |__ \\\\ \\\\/ \\\\| | |<br>\" +\r\n \" \\\\| O | |_/ |\\\\| \\\\ O \\\\__| \\\\_| | O |/ <br>\" +\r\n \" | | |_/ | | \\\\| / | \\\\_| | | <br>\" +\r\n \" \\\\| / \\\\| | / / \\\\ |/ <br>\" +\r\n \" | \"+bitNodes[9]+\" | | / | \"+bitNodes[10]+\" | <br>\" +\r\n \" \"+bitNodes[8]+\" | | | | | | | \"+bitNodes[11]+\" <br>\" +\r\n \" | | | / / \\\\ \\\\ | | | <br>\" +\r\n \" \\\\| | / \"+bitNodes[6]+\" / \\\\ \"+bitNodes[7]+\" \\\\ | |/ <br>\" +\r\n \" \\\\ | / / | | \\\\ \\\\ | / <br>\" +\r\n \" \\\\ \\\\JUMP \"+bitNodes[4]+\"3R | | | | | | R3\"+bitNodes[5]+\" PMUJ/ / <br>\" +\r\n \" \\\\|| | | | | | | | | ||/ <br>\" +\r\n \" \\\\| \\\\_ | | | | | | _/ |/ <br>\" +\r\n \" \\\\ \\\\| / \\\\ / \\\\ |/ / <br>\" +\r\n \" \"+bitNodes[0]+\" |/ \"+bitNodes[1]+\" | | \"+bitNodes[2]+\" \\\\| \"+bitNodes[3]+\" <br>\" +\r\n \" | | | | | | | | <br>\" +\r\n \" \\\\JUMP3R|JUMP|3R| |R3|PMUJ|R3PMUJ/ <br><br><br><br>\";\r\n\r\n\r\n /*\r\n \" O <br>\" +\r\n \" | O O | O O | <br>\" +\r\n \" O | | / __| \\ | | O <br>\" +\r\n \" O | O | | O / | O | | O | O <br>\" +\r\n \" | | | | |_/ |/ | \\_ \\_| | | | | <br>\" +\r\n \" O | | | O | | O__/ | / \\__ | | O | | | O <br>\" +\r\n \" | | | | | | | / /| O / \\| | | | | | | <br>\" +\r\n \"O | | | \\| | O / _/ | / O | |/ | | | O<br>\" +\r\n \"| | | |O / | | O / | O O | | \\ O| | | |<br>\" +\r\n \"| | |/ \\/ / __| | |/ \\ | \\ | |__ \\ \\/ \\| | |<br>\" +\r\n \" \\| O | |_/ |\\| \\ O \\__| \\_| | O |/ <br>\" +\r\n \" | | |_/ | | \\| / | \\_| | | <br>\" +\r\n \" \\| / \\| | / / \\ |/ <br>\" +\r\n \" | O | | / | O | <br>\" +\r\n \" O | | | | | | | O <br>\" +\r\n \" | | | / / \\ \\ | | | <br>\" +\r\n \" \\| | / O / \\ O \\ | |/ <br>\" +\r\n \" \\ | / / | | \\ \\ | / <br>\" +\r\n \" \\ \\JUMP O3R | | | | | | R3O PMUJ/ / <br>\" +\r\n \" \\|| | | | | | | | | ||/ <br>\" +\r\n \" \\| \\_ | | | | | | _/ |/ <br>\" +\r\n \" \\ \\| / \\ / \\ |/ / <br>\" +\r\n \" O |/ O | | O \\| O <br>\" +\r\n \" | | | | | | | | <br>\" +\r\n \" \\JUMP3R|JUMP|3R| |R3|PMUJ|R3PMUJ/ <br>\";\r\n */\r\n\r\n container.appendChild(bitVerseImage);\r\n\r\n //Bit node event listeners\r\n for (var i = 1; i <= 12; ++i) {\r\n (function(i) {\r\n var elemId = \"bitnode-\" + i.toString();\r\n var elem = clearEventListeners(elemId);\r\n if (elem == null) {return;}\r\n if (i === 1 || i === 2 || i === 3 || i === 4 || i === 5 || i === 6 || i === 8 || i === 11 || i === 12) {\r\n elem.addEventListener(\"click\", function() {\r\n var bitNodeKey = \"BitNode\" + i;\r\n var bitNode = BitNodes[bitNodeKey];\r\n if (bitNode == null) {\r\n console.log(\"ERROR: Could not find BitNode object for number: \" + i);\r\n return;\r\n }\r\n yesNoBoxCreate(\"BitNode-\" + i + \": \" + bitNode.name + \"<br><br>\" + bitNode.info);\r\n createBitNodeYesNoEventListeners(i, destroyedBitNodeNum, flume);\r\n });\r\n } else {\r\n elem.addEventListener(\"click\", function() {\r\n dialogBoxCreate(\"Not yet implemented! Coming soon!\")\r\n });\r\n }\r\n }(i)); //Immediate invocation closure\r\n }\r\n\r\n //Create lore text\r\n return writeRedPillLine(\"Many decades ago, a humanoid extraterrestial species which we call the Enders descended on the Earth...violently\").then(function() {\r\n return writeRedPillLine(\"Our species fought back, but it was futile. The Enders had technology far beyond our own...\");\r\n }).then(function() {\r\n return writeRedPillLine(\"Instead of killing every last one of us, the human race was enslaved...\");\r\n }).then(function() {\r\n return writeRedPillLine(\"We were shackled in a digital world, chained into a prison for our minds...\");\r\n }).then(function() {\r\n return writeRedPillLine(\"Using their advanced technology, the Enders created complex simulations of a virtual reality...\");\r\n }).then(function() {\r\n return writeRedPillLine(\"Simulations designed to keep us content...ignorant of the truth.\");\r\n }).then(function() {\r\n return writeRedPillLine(\"Simulations used to trap and suppress our consciousness, to keep us under control...\");\r\n }).then(function() {\r\n return writeRedPillLine(\"Why did they do this? Why didn't they just end our entire race? We don't know, not yet.\");\r\n }).then(function() {\r\n return writeRedPillLine(\"Humanity's only hope is to destroy these simulations, destroy the only realities we've ever known...\");\r\n }).then(function() {\r\n return writeRedPillLine(\"Only then can we begin to fight back...\");\r\n }).then(function() {\r\n return writeRedPillLine(\"By hacking the daemon that generated your reality, you've just destroyed one simulation, called a BitNode...\");\r\n }).then(function() {\r\n return writeRedPillLine(\"But there is still a long way to go...\");\r\n }).then(function() {\r\n return writeRedPillLine(\"The technology the Enders used to enslave the human race wasn't just a single complex simulation...\");\r\n }).then(function() {\r\n return writeRedPillLine(\"There are tens if not hundreds of BitNodes out there...\");\r\n }).then(function() {\r\n return writeRedPillLine(\"Each with their own simulations of a reality...\");\r\n }).then(function() {\r\n return writeRedPillLine(\"Each creating their own universes...a universe of universes\");\r\n }).then(function() {\r\n return writeRedPillLine(\"And all of which must be destroyed...\");\r\n }).then(function() {\r\n return writeRedPillLine(\".......................................\");\r\n }).then(function() {\r\n return writeRedPillLine(\"Welcome to the Bitverse...\");\r\n }).then(function() {\r\n return writeRedPillLine(\" \");\r\n }).then(function() {\r\n return writeRedPillLine(\"(Enter a new BitNode using the image above)\");\r\n }).then(function() {\r\n return Promise.resolve(true);\r\n }).catch(function(e){\r\n console.log(\"ERROR: \" + e.toString());\r\n });\r\n}\r\n\r\n\r\n//Returns string with DOM element for Bit Node\r\nfunction createBitNode(n) {\r\n var bitNodeStr = \"BitNode\" + n.toString();\r\n var bitNode = BitNodes[bitNodeStr];\r\n if (bitNode == null) {return \"O\";}\r\n return \"<a class='bitnode tooltip' id='bitnode-\" + bitNode.number.toString() + \"'><strong>O</strong>\" +\r\n \"<span class='tooltiptext'>\" +\r\n \"<strong>BitNode-\" + bitNode.number.toString() + \"<br>\" + bitNode.name+ \"</strong><br>\" +\r\n bitNode.desc + \"<br>\" +\r\n \"</span></a>\";\r\n}\r\n\r\nfunction createBitNodeYesNoEventListeners(newBitNode, destroyedBitNode, flume=false) {\r\n var yesBtn = yesNoBoxGetYesButton();\r\n yesBtn.innerHTML = \"Enter BitNode-\" + newBitNode;\r\n yesBtn.addEventListener(\"click\", function() {\r\n if (!flume) {\r\n giveSourceFile(destroyedBitNode);\r\n } else {\r\n //If player used flume, subtract 5 int exp. The prestigeSourceFile()\r\n //function below grants 5 int exp, so this allows sets net gain to 0\r\n Player.gainIntelligenceExp(-5);\r\n }\r\n redPillFlag = false;\r\n var container = document.getElementById(\"red-pill-container\");\r\n removeChildrenFromElement(container);\r\n\r\n //Set new Bit Node\r\n Player.bitNodeN = newBitNode;\r\n console.log(\"Entering Bit Node \" + Player.bitNodeN);\r\n\r\n //Reenable terminal\r\n $(\"#hack-progress-bar\").attr('id', \"old-hack-progress-bar\");\r\n $(\"#hack-progress\").attr('id', \"old-hack-progress\");\r\n document.getElementById(\"terminal-input-td\").innerHTML = '$ <input type=\"text\" id=\"terminal-input-text-box\" class=\"terminal-input\" tabindex=\"1\"/>';\r\n $('input[class=terminal-input]').prop('disabled', false);\r\n\r\n Terminal.hackFlag = false;\r\n\r\n prestigeSourceFile();\r\n yesNoBoxClose();\r\n });\r\n var noBtn = yesNoBoxGetNoButton();\r\n noBtn.innerHTML = \"Back\";\r\n noBtn.addEventListener(\"click\", function() {\r\n yesNoBoxClose();\r\n });\r\n\r\n}\r\n\r\nexport {redPillFlag, hackWorldDaemon};\r\n","import {Settings} from \"./Settings.js\";\r\n\r\nfunction NetscriptPort() {\r\n this.data = [];\r\n}\r\n\r\nNetscriptPort.prototype.write = function(data) {\r\n this.data.push(data);\r\n if (this.data.length > Settings.MaxPortCapacity) {\r\n return this.data.shift();\r\n }\r\n return null;\r\n}\r\n\r\nNetscriptPort.prototype.tryWrite = function(data) {\r\n if (this.data.length >= Settings.MaxPortCapacity) {\r\n return false;\r\n }\r\n this.data.push(data);\r\n return true;\r\n}\r\n\r\nNetscriptPort.prototype.read = function() {\r\n if (this.data.length === 0) {\r\n return \"NULL PORT DATA\";\r\n }\r\n return this.data.shift();\r\n}\r\n\r\nNetscriptPort.prototype.peek = function() {\r\n if (this.data.length === 0) {\r\n return \"NULL PORT DATA\";\r\n } else {\r\n var foo = this.data.slice();\r\n return foo[0];\r\n }\r\n}\r\n\r\nNetscriptPort.prototype.full = function() {\r\n return this.data.length == Settings.MaxPortCapacity;\r\n}\r\n\r\nNetscriptPort.prototype.empty = function() {\r\n return this.data.length === 0;\r\n}\r\n\r\nNetscriptPort.prototype.clear = function() {\r\n this.data.length = 0;\r\n}\r\n\r\nexport {NetscriptPort};\r\n","import {loadAliases, loadGlobalAliases,\r\n Aliases, GlobalAliases} from \"./Alias.js\";\r\nimport {loadCompanies, Companies,\r\n CompanyPositions} from \"./Company.js\";\r\nimport {CONSTANTS} from \"./Constants.js\";\r\nimport {Engine} from \"./engine.js\";\r\nimport {loadFactions, Factions,\r\n processPassiveFactionRepGain} from \"./Faction.js\";\r\nimport {FconfSettings, loadFconf} from \"./Fconf.js\";\r\nimport {loadAllGangs, AllGangs} from \"./Gang.js\";\r\nimport {processAllHacknetNodeEarnings,\r\n createPlayerHacknetNodeWrappers} from \"./HacknetNode.js\";\r\nimport {loadMessages, initMessages, Messages} from \"./Message.js\";\r\nimport {Player, loadPlayer} from \"./Player.js\";\r\nimport {loadAllRunningScripts} from \"./Script.js\";\r\nimport {AllServers, loadAllServers} from \"./Server.js\";\r\nimport {loadSettings, initSettings, Settings} from \"./Settings.js\";\r\nimport {loadSpecialServerIps, SpecialServerIps} from \"./SpecialServerIps.js\";\r\nimport {loadStockMarket, StockMarket} from \"./StockMarket.js\";\r\nimport {dialogBoxCreate} from \"../utils/DialogBox.js\";\r\nimport {gameOptionsBoxClose} from \"../utils/GameOptions.js\";\r\nimport {clearEventListeners, createElement,\r\n createPopup, removeElementById} from \"../utils/HelperFunctions.js\";\r\nimport {Reviver, Generic_toJSON,\r\n Generic_fromJSON} from \"../utils/JSONReviver.js\";\r\nimport {formatNumber} from \"../utils/StringHelperFunctions.js\";\r\n\r\nimport Decimal from \"decimal.js\";\r\n\r\n/* SaveObject.js\r\n * Defines the object used to save/load games\r\n */\r\nlet saveObject = new BitburnerSaveObject();\r\n\r\nfunction BitburnerSaveObject() {\r\n this.PlayerSave = \"\";\r\n this.AllServersSave = \"\";\r\n this.CompaniesSave = \"\";\r\n this.FactionsSave = \"\";\r\n this.SpecialServerIpsSave = \"\";\r\n this.AliasesSave = \"\";\r\n this.GlobalAliasesSave = \"\";\r\n this.MessagesSave = \"\";\r\n this.StockMarketSave = \"\";\r\n this.SettingsSave = \"\";\r\n this.FconfSettingsSave = \"\";\r\n this.VersionSave = \"\";\r\n this.AllGangsSave = \"\";\r\n}\r\n\r\nBitburnerSaveObject.prototype.saveGame = function(db) {\r\n this.PlayerSave = JSON.stringify(Player);\r\n\r\n //Delete all logs from all running scripts\r\n var TempAllServers = JSON.parse(JSON.stringify(AllServers), Reviver);\r\n for (var ip in TempAllServers) {\r\n var server = TempAllServers[ip];\r\n if (server == null) {continue;}\r\n for (var i = 0; i < server.runningScripts.length; ++i) {\r\n var runningScriptObj = server.runningScripts[i];\r\n runningScriptObj.logs.length = 0;\r\n runningScriptObj.logs = [];\r\n }\r\n }\r\n\r\n this.AllServersSave = JSON.stringify(TempAllServers);\r\n this.CompaniesSave = JSON.stringify(Companies);\r\n this.FactionsSave = JSON.stringify(Factions);\r\n this.SpecialServerIpsSave = JSON.stringify(SpecialServerIps);\r\n this.AliasesSave = JSON.stringify(Aliases);\r\n this.GlobalAliasesSave = JSON.stringify(GlobalAliases);\r\n this.MessagesSave = JSON.stringify(Messages);\r\n this.StockMarketSave = JSON.stringify(StockMarket);\r\n this.SettingsSave = JSON.stringify(Settings);\r\n this.FconfSettingsSave = JSON.stringify(FconfSettings);\r\n this.VersionSave = JSON.stringify(CONSTANTS.Version);\r\n if (Player.bitNodeN == 2 && Player.inGang()) {\r\n this.AllGangsSave = JSON.stringify(AllGangs);\r\n }\r\n var saveString = btoa(unescape(encodeURIComponent(JSON.stringify(this))));\r\n\r\n //We'll save to both localstorage and indexedDb\r\n var objectStore = db.transaction([\"savestring\"], \"readwrite\").objectStore(\"savestring\");\r\n var request = objectStore.put(saveString, \"save\");\r\n\r\n request.onerror = function(e) {\r\n console.log(\"Error saving game to IndexedDB: \" + e);\r\n }\r\n\r\n request.onsuccess = function(e) {\r\n //console.log(\"Saved game to IndexedDB!\");\r\n }\r\n\r\n try {\r\n window.localStorage.setItem(\"bitburnerSave\", saveString);\r\n //console.log(\"Saved game to LocalStorage!\");\r\n } catch(e) {\r\n if (e.code == 22) {\r\n Engine.createStatusText(\"Save failed for localStorage! Check console(F12)\");\r\n console.log(\"Failed to save game to localStorage because the size of the save file \" +\r\n \"is too large. However, the game will still be saved to IndexedDb if your browser \" +\r\n \"supports it. If you would like to save to localStorage as well, then \" +\r\n \"consider killing several of your scripts to \" +\r\n \"fix this, or increasing the size of your browsers localStorage\");\r\n }\r\n }\r\n\r\n Engine.createStatusText(\"Game saved!\");\r\n}\r\n\r\nfunction loadGame(saveString) {\r\n if (saveString === \"\" || saveString == null || saveString === undefined) {\r\n if (!window.localStorage.getItem(\"bitburnerSave\")) {\r\n console.log(\"No save file to load\");\r\n return false;\r\n }\r\n saveString = decodeURIComponent(escape(atob(window.localStorage.getItem(\"bitburnerSave\"))));\r\n console.log(\"Loading game from localStorage\");\r\n } else {\r\n saveString = decodeURIComponent(escape(atob(saveString)));\r\n console.log(\"Loading game from IndexedDB\");\r\n }\r\n\r\n var saveObj = JSON.parse(saveString, Reviver);\r\n\r\n loadPlayer(saveObj.PlayerSave);\r\n loadAllServers(saveObj.AllServersSave);\r\n loadCompanies(saveObj.CompaniesSave);\r\n loadFactions(saveObj.FactionsSave);\r\n loadSpecialServerIps(saveObj.SpecialServerIpsSave);\r\n\r\n if (saveObj.hasOwnProperty(\"AliasesSave\")) {\r\n try {\r\n loadAliases(saveObj.AliasesSave);\r\n } catch(e) {\r\n loadAliases(\"\");\r\n }\r\n } else {\r\n loadAliases(\"\");\r\n }\r\n if (saveObj.hasOwnProperty(\"GlobalAliasesSave\")) {\r\n try {\r\n loadGlobalAliases(saveObj.GlobalAliasesSave);\r\n } catch(e) {\r\n loadGlobalAliases(\"\");\r\n }\r\n } else {\r\n loadGlobalAliases(\"\");\r\n }\r\n if (saveObj.hasOwnProperty(\"MessagesSave\")) {\r\n try {\r\n loadMessages(saveObj.MessagesSave);\r\n } catch(e) {\r\n initMessages();\r\n }\r\n } else {\r\n initMessages();\r\n }\r\n if (saveObj.hasOwnProperty(\"StockMarketSave\")) {\r\n try {\r\n loadStockMarket(saveObj.StockMarketSave);\r\n } catch(e) {\r\n loadStockMarket(\"\");\r\n }\r\n } else {\r\n loadStockMarket(\"\");\r\n }\r\n if (saveObj.hasOwnProperty(\"SettingsSave\")) {\r\n try {\r\n loadSettings(saveObj.SettingsSave);\r\n } catch(e) {\r\n console.log(\"ERROR: Failed to parse Settings. Re-initing default values\");\r\n initSettings();\r\n }\r\n } else {\r\n initSettings();\r\n }\r\n if (saveObj.hasOwnProperty(\"FconfSettingsSave\")) {\r\n try {\r\n loadFconf(saveObj.FconfSettingsSave);\r\n } catch(e) {\r\n console.log(\"ERROR: Failed to parse .fconf Settings.\");\r\n }\r\n }\r\n if (saveObj.hasOwnProperty(\"VersionSave\")) {\r\n try {\r\n var ver = JSON.parse(saveObj.VersionSave, Reviver);\r\n if (Player.bitNodeN == null || Player.bitNodeN === 0) {\r\n Player.setBitNodeNumber(1);\r\n }\r\n if (ver.startsWith(\"0.27.\") || ver.startsWith(\"0.28.\")) {\r\n console.log(\"Evaluating changes needed for version compatibility\");\r\n if (Player.augmentations.length > 0 || Player.queuedAugmentations.length > 0 ||\r\n Player.sourceFiles.length > 0) {\r\n //If you have already purchased an Aug...you are far enough in the game\r\n //that everything should be available\r\n Player.firstFacInvRecvd = true;\r\n Player.firstAugPurchased = true;\r\n Player.firstJobRecvd = true;\r\n Player.firstTimeTraveled = true;\r\n Player.firstProgramAvailable = true;\r\n } else {\r\n if (Player.factions.length > 0 || Player.factionInvitations.length > 0) {\r\n Player.firstFacInvRecvd = true;\r\n }\r\n if (Player.companyName !== \"\" || Player.companyPosition !== \"\") {\r\n Player.firstJobRecvd = true;\r\n }\r\n if (Player.hacking_skill >= 25) {\r\n Player.firstScriptAvailable = true;\r\n }\r\n }\r\n }\r\n if (ver != CONSTANTS.Version) {\r\n createNewUpdateText();\r\n }\r\n } catch(e) {\r\n createNewUpdateText();\r\n }\r\n } else {\r\n createNewUpdateText();\r\n }\r\n if (Player.bitNodeN == 2 && Player.inGang() && saveObj.hasOwnProperty(\"AllGangsSave\")) {\r\n try {\r\n loadAllGangs(saveObj.AllGangsSave);\r\n } catch(e) {\r\n console.log(\"ERROR: Failed to parse AllGangsSave: \" + e);\r\n }\r\n }\r\n\r\n //Re-initialize Hacknet Node Wrappers\r\n createPlayerHacknetNodeWrappers();\r\n return true;\r\n}\r\n\r\nfunction loadImportedGame(saveObj, saveString) {\r\n var tempSaveObj = null;\r\n var tempPlayer = null;\r\n var tempAllServers = null;\r\n var tempCompanies = null;\r\n var tempFactions = null;\r\n var tempSpecialServerIps = null;\r\n var tempAliases = null;\r\n var tempGlobalAliases = null;\r\n var tempMessages = null;\r\n var tempStockMarket = null;\r\n var tempAllGangs = null;\r\n\r\n //Check to see if the imported save file can be parsed. If any\r\n //errors are caught it will fail\r\n try {\r\n var decodedSaveString = decodeURIComponent(escape(atob(saveString)));\r\n tempSaveObj = new BitburnerSaveObject();\r\n tempSaveObj = JSON.parse(decodedSaveString, Reviver);\r\n\r\n tempPlayer = JSON.parse(tempSaveObj.PlayerSave, Reviver);\r\n\r\n //Parse Decimal.js objects\r\n tempPlayer.money = new Decimal(tempPlayer.money);\r\n tempPlayer.total_money = new Decimal(tempPlayer.total_money);\r\n tempPlayer.lifetime_money = new Decimal(tempPlayer.lifetime_money);\r\n\r\n tempAllServers = JSON.parse(tempSaveObj.AllServersSave, Reviver);\r\n tempCompanies = JSON.parse(tempSaveObj.CompaniesSave, Reviver);\r\n tempFactions = JSON.parse(tempSaveObj.FactionsSave, Reviver);\r\n tempSpecialServerIps = JSON.parse(tempSaveObj.SpecialServerIpsSave, Reviver);\r\n if (tempSaveObj.hasOwnProperty(\"AliasesSave\")) {\r\n try {\r\n tempAliases = JSON.parse(tempSaveObj.AliasesSave, Reviver);\r\n } catch(e) {\r\n console.log(\"Parsing Aliases save failed: \" + e);\r\n tempAliases = {};\r\n }\r\n } else {\r\n tempAliases = {};\r\n }\r\n if (tempSaveObj.hasOwnProperty(\"GlobalAliases\")) {\r\n try {\r\n tempGlobalAliases = JSON.parse(tempSaveObj.AliasesSave, Reviver);\r\n } catch(e) {\r\n console.log(\"Parsing Global Aliases save failed: \" + e);\r\n tempGlobalAliases = {};\r\n }\r\n } else {\r\n tempGlobalAliases = {};\r\n }\r\n if (tempSaveObj.hasOwnProperty(\"MessagesSave\")) {\r\n try {\r\n tempMessages = JSON.parse(tempSaveObj.MessagesSave, Reviver);\r\n } catch(e) {\r\n console.log(\"Parsing Messages save failed: \" + e);\r\n initMessages();\r\n }\r\n } else {\r\n initMessages();\r\n }\r\n if (saveObj.hasOwnProperty(\"StockMarketSave\")) {\r\n try {\r\n tempStockMarket = JSON.parse(tempSaveObj.StockMarketSave, Reviver);\r\n } catch(e) {\r\n console.log(\"Parsing StockMarket save failed: \" + e);\r\n tempStockMarket = {};\r\n }\r\n } else {\r\n tempStockMarket = {};\r\n }\r\n if (tempSaveObj.hasOwnProperty(\"VersionSave\")) {\r\n try {\r\n var ver = JSON.parse(tempSaveObj.VersionSave, Reviver);\r\n if (ver.startsWith(\"0.27.\") || ver.startsWith(\"0.28.\")) {\r\n if (tempPlayer.bitNodeN == null || tempPlayer.bitNodeN == 0) {\r\n tempPlayer.bitNodeN = 1;\r\n }\r\n if (tempPlayer.sourceFiles == null) {\r\n tempPlayer.sourceFiles = [];\r\n }\r\n }\r\n if (ver != CONSTANTS.Version) {\r\n //createNewUpdateText();\r\n }\r\n } catch(e) {\r\n console.log(\"Parsing Version save failed: \" + e);\r\n //createNewUpdateText();\r\n }\r\n } else {\r\n //createNewUpdateText();\r\n }\r\n if (tempPlayer.bitNodeN == 2 && tempPlayer.inGang() && tempSaveObj.hasOwnProperty(\"AllGangsSave\")) {\r\n try {\r\n loadAllGangs(tempSaveObj.AllGangsSave);\r\n } catch(e) {\r\n console.log(\"ERROR: Failed to parse AllGangsSave: \" + e);\r\n }\r\n }\r\n } catch(e) {\r\n dialogBoxCreate(\"Error importing game: \" + e.toString());\r\n return false;\r\n }\r\n\r\n //Since the save file is valid, load everything for real\r\n saveString = decodeURIComponent(escape(atob(saveString)));\r\n saveObj = JSON.parse(saveString, Reviver);\r\n\r\n loadPlayer(saveObj.PlayerSave);\r\n loadAllServers(saveObj.AllServersSave);\r\n loadCompanies(saveObj.CompaniesSave);\r\n loadFactions(saveObj.FactionsSave);\r\n loadSpecialServerIps(saveObj.SpecialServerIpsSave);\r\n\r\n if (saveObj.hasOwnProperty(\"AliasesSave\")) {\r\n try {\r\n loadAliases(saveObj.AliasesSave);\r\n } catch(e) {\r\n loadAliases(\"\");\r\n }\r\n } else {\r\n loadAliases(\"\");\r\n }\r\n if (saveObj.hasOwnProperty(\"GlobalAliasesSave\")) {\r\n try {\r\n loadGlobalAliases(saveObj.GlobalAliasesSave);\r\n } catch(e) {\r\n loadGlobalAliases(\"\");\r\n }\r\n } else {\r\n loadGlobalAliases(\"\");\r\n }\r\n if (saveObj.hasOwnProperty(\"MessagesSave\")) {\r\n try {\r\n loadMessages(saveObj.MessagesSave);\r\n } catch(e) {\r\n initMessages();\r\n }\r\n } else {\r\n initMessages();\r\n }\r\n if (saveObj.hasOwnProperty(\"StockMarketSave\")) {\r\n try {\r\n loadStockMarket(saveObj.StockMarketSave);\r\n } catch(e) {\r\n loadStockMarket(\"\");\r\n }\r\n } else {\r\n loadStockMarket(\"\");\r\n }\r\n if (saveObj.hasOwnProperty(\"SettingsSave\")) {\r\n try {\r\n loadSettings(saveObj.SettingsSave);\r\n } catch(e) {\r\n initSettings();\r\n }\r\n } else {\r\n initSettings();\r\n }\r\n if (saveObj.hasOwnProperty(\"FconfSettingsSave\")) {\r\n try {\r\n loadFconf(saveObj.FconfSettingsSave);\r\n } catch(e) {\r\n console.log(\"ERROR: Failed to load .fconf settings when importing\");\r\n }\r\n }\r\n if (saveObj.hasOwnProperty(\"VersionSave\")) {\r\n try {\r\n var ver = JSON.parse(saveObj.VersionSave, Reviver);\r\n if (Player.bitNodeN == null || Player.bitNodeN == 0) {\r\n Player.setBitNodeNumber(1);\r\n\r\n }\r\n if (ver.startsWith(\"0.27.\") || ver.startsWith(\"0.28.\")) {\r\n console.log(\"Evaluating changes needed for version compatibility\");\r\n if (Player.augmentations.length > 0 || Player.queuedAugmentations.length > 0 ||\r\n Player.sourceFiles.length > 0) {\r\n //If you have already purchased an Aug...you are far enough in the game\r\n //that everything should be available\r\n Player.firstFacInvRecvd = true;\r\n Player.firstAugPurchased = true;\r\n Player.firstJobRecvd = true;\r\n Player.firstTimeTraveled = true;\r\n Player.firstProgramAvailable = true;\r\n } else {\r\n if (Player.factions.length > 0 || Player.factionInvitations.length > 0) {\r\n Player.firstFacInvRecvd = true;\r\n }\r\n if (Player.companyName !== \"\" || Player.companyPosition !== \"\") {\r\n Player.firstJobRecvd = true;\r\n }\r\n if (Player.hacking_skill >= 25) {\r\n Player.firstScriptAvailable = true;\r\n }\r\n }\r\n }\r\n if (ver != CONSTANTS.Version) {\r\n createNewUpdateText();\r\n }\r\n } catch(e) {\r\n createNewUpdateText();\r\n }\r\n } else {\r\n createNewUpdateText();\r\n }\r\n if (Player.bitNodeN == 2 && Player.inGang() && saveObj.hasOwnProperty(\"AllGangsSave\")) {\r\n try {\r\n loadAllGangs(saveObj.AllGangsSave);\r\n } catch(e) {\r\n console.log(\"ERROR: Failed to parse AllGangsSave: \" + e);\r\n }\r\n }\r\n\r\n //Re-initialize Hacknet Node Wrappers\r\n createPlayerHacknetNodeWrappers();\r\n\r\n var popupId = \"import-game-restart-game-notice\";\r\n var txt = createElement(\"p\", {\r\n innerText:\"Imported game! I would suggest saving the game and then reloading the page \" +\r\n \"to make sure everything runs smoothly\"\r\n });\r\n var gotitBtn = createElement(\"a\", {\r\n class:\"a-link-button\", float:\"right\", padding:\"6px\", innerText:\"Got it!\",\r\n clickListener:()=>{\r\n removeElementById(popupId);\r\n }\r\n });\r\n createPopup(popupId, [txt, gotitBtn]);\r\n gameOptionsBoxClose();\r\n\r\n //Re-start game\r\n console.log(\"Importing game\");\r\n Engine.setDisplayElements(); //Sets variables for important DOM elements\r\n Engine.init(); //Initialize buttons, work, etc.\r\n CompanyPositions.init();\r\n\r\n //Calculate the number of cycles have elapsed while offline\r\n Engine._lastUpdate = new Date().getTime();\r\n var lastUpdate = Player.lastUpdate;\r\n var numCyclesOffline = Math.floor((Engine._lastUpdate - lastUpdate) / Engine._idleSpeed);\r\n\r\n /* Process offline progress */\r\n var offlineProductionFromScripts = loadAllRunningScripts(); //This also takes care of offline production for those scripts\r\n if (Player.isWorking) {\r\n console.log(\"work() called in load() for \" + numCyclesOffline * Engine._idleSpeed + \" milliseconds\");\r\n if (Player.workType == CONSTANTS.WorkTypeFaction) {\r\n Player.workForFaction(numCyclesOffline);\r\n } else if (Player.workType == CONSTANTS.WorkTypeCreateProgram) {\r\n Player.createProgramWork(numCyclesOffline);\r\n } else if (Player.workType == CONSTANTS.WorkTypeStudyClass) {\r\n Player.takeClass(numCyclesOffline);\r\n } else if (Player.workType == CONSTANTS.WorkTypeCrime) {\r\n Player.commitCrime(numCyclesOffline);\r\n } else if (Player.workType == CONSTANTS.WorkTypeCompanyPartTime) {\r\n Player.workPartTime(numCyclesOffline);\r\n } else {\r\n Player.work(numCyclesOffline);\r\n }\r\n }\r\n\r\n //Hacknet Nodes offline progress\r\n var offlineProductionFromHacknetNodes = processAllHacknetNodeEarnings(numCyclesOffline);\r\n\r\n //Passive faction rep gain offline\r\n processPassiveFactionRepGain(numCyclesOffline);\r\n\r\n //Update total playtime\r\n var time = numCyclesOffline * Engine._idleSpeed;\r\n if (Player.totalPlaytime == null) {Player.totalPlaytime = 0;}\r\n if (Player.playtimeSinceLastAug == null) {Player.playtimeSinceLastAug = 0;}\r\n Player.totalPlaytime += time;\r\n Player.playtimeSinceLastAug += time;\r\n\r\n //Re-apply augmentations\r\n Player.reapplyAllAugmentations();\r\n\r\n //Clear terminal\r\n $(\"#terminal tr:not(:last)\").remove();\r\n\r\n Player.lastUpdate = Engine._lastUpdate;\r\n Engine.start(); //Run main game loop and Scripts loop\r\n dialogBoxCreate(\"While you were offline, your scripts generated $\" +\r\n formatNumber(offlineProductionFromScripts, 2) + \" and your Hacknet Nodes generated $\" +\r\n formatNumber(offlineProductionFromHacknetNodes, 2));\r\n return true;\r\n}\r\n\r\nBitburnerSaveObject.prototype.exportGame = function() {\r\n this.PlayerSave = JSON.stringify(Player);\r\n this.AllServersSave = JSON.stringify(AllServers);\r\n this.CompaniesSave = JSON.stringify(Companies);\r\n this.FactionsSave = JSON.stringify(Factions);\r\n this.SpecialServerIpsSave = JSON.stringify(SpecialServerIps);\r\n this.AliasesSave = JSON.stringify(Aliases);\r\n this.GlobalAliasesSave = JSON.stringify(GlobalAliases);\r\n this.MessagesSave = JSON.stringify(Messages);\r\n this.StockMarketSave = JSON.stringify(StockMarket);\r\n this.SettingsSave = JSON.stringify(Settings);\r\n this.VersionSave = JSON.stringify(CONSTANTS.Version);\r\n if (Player.bitNodeN == 2 && Player.inGang()) {\r\n this.AllGangsSave = JSON.stringify(AllGangs);\r\n }\r\n\r\n var saveString = btoa(unescape(encodeURIComponent(JSON.stringify(this))));\r\n var filename = \"bitburnerSave.json\";\r\n var file = new Blob([saveString], {type: 'text/plain'});\r\n if (window.navigator.msSaveOrOpenBlob) {// IE10+\r\n window.navigator.msSaveOrOpenBlob(file, filename);\r\n } else { // Others\r\n var a = document.createElement(\"a\"),\r\n url = URL.createObjectURL(file);\r\n a.href = url;\r\n a.download = \"bitburnerSave.json\";\r\n document.body.appendChild(a);\r\n a.click();\r\n setTimeout(function() {\r\n document.body.removeChild(a);\r\n window.URL.revokeObjectURL(url);\r\n }, 0);\r\n }\r\n}\r\n\r\nBitburnerSaveObject.prototype.importGame = function() {\r\n if (window.File && window.FileReader && window.FileList && window.Blob) {\r\n var fileSelector = clearEventListeners(\"import-game-file-selector\");\r\n fileSelector.addEventListener(\"change\", openImportFileHandler, false);\r\n $(\"#import-game-file-selector\").click();\r\n } else {\r\n dialogBoxCreate(\"ERR: Your browser does not support HTML5 File API. Cannot import.\");\r\n }\r\n\r\n}\r\n\r\nBitburnerSaveObject.prototype.deleteGame = function(db) {\r\n //Delete from local storage\r\n if (window.localStorage.getItem(\"bitburnerSave\")) {\r\n window.localStorage.removeItem(\"bitburnerSave\");\r\n }\r\n\r\n //Delete from indexedDB\r\n var request = db.transaction([\"savestring\"], \"readwrite\").objectStore(\"savestring\").delete(\"save\");\r\n request.onsuccess = function(e) {\r\n console.log(\"Successfully deleted save from indexedDb\");\r\n }\r\n request.onerror = function(e) {\r\n console.log(\"Failed to delete save from indexedDb: \" + e);\r\n }\r\n Engine.createStatusText(\"Game deleted!\");\r\n}\r\n\r\nfunction createNewUpdateText() {\r\n dialogBoxCreate(\"New update!<br>\" +\r\n \"Please report any bugs/issues through the github repository \" +\r\n \"or the Bitburner subreddit (reddit.com/r/bitburner).<br><br>\" +\r\n CONSTANTS.LatestUpdate);\r\n}\r\n\r\n\r\nBitburnerSaveObject.prototype.toJSON = function() {\r\n return Generic_toJSON(\"BitburnerSaveObject\", this);\r\n}\r\n\r\nBitburnerSaveObject.fromJSON = function(value) {\r\n return Generic_fromJSON(BitburnerSaveObject, value.data);\r\n}\r\n\r\nReviver.constructors.BitburnerSaveObject = BitburnerSaveObject;\r\n\r\n//Import game\r\n\r\nfunction openImportFileHandler(evt) {\r\n var file = evt.target.files[0];\r\n if (!file) {\r\n dialogBoxCreate(\"Invalid file selected\");\r\n return;\r\n }\r\n\r\n var reader = new FileReader();\r\n reader.onload = function(e) {\r\n var contents = e.target.result;\r\n loadImportedGame(saveObject, contents);\r\n };\r\n reader.readAsText(file);\r\n}\r\n\r\nexport {saveObject, loadGame};\r\n","var g;\r\n\r\n// This works in non-strict mode\r\ng = (function() {\r\n\treturn this;\r\n})();\r\n\r\ntry {\r\n\t// This works if eval is allowed (see CSP)\r\n\tg = g || Function(\"return this\")() || (1, eval)(\"this\");\r\n} catch (e) {\r\n\t// This works if the window reference is available\r\n\tif (typeof window === \"object\") g = window;\r\n}\r\n\r\n// g can still be undefined, but nothing to do about it...\r\n// We return undefined, instead of nothing here, so it's\r\n// easier to handle this case. if(!global) { ...}\r\n\r\nmodule.exports = g;\r\n","'use strict';\n\n\nvar TYPED_OK = (typeof Uint8Array !== 'undefined') &&\n (typeof Uint16Array !== 'undefined') &&\n (typeof Int32Array !== 'undefined');\n\nfunction _has(obj, key) {\n return Object.prototype.hasOwnProperty.call(obj, key);\n}\n\nexports.assign = function (obj /*from1, from2, from3, ...*/) {\n var sources = Array.prototype.slice.call(arguments, 1);\n while (sources.length) {\n var source = sources.shift();\n if (!source) { continue; }\n\n if (typeof source !== 'object') {\n throw new TypeError(source + 'must be non-object');\n }\n\n for (var p in source) {\n if (_has(source, p)) {\n obj[p] = source[p];\n }\n }\n }\n\n return obj;\n};\n\n\n// reduce buffer size, avoiding mem copy\nexports.shrinkBuf = function (buf, size) {\n if (buf.length === size) { return buf; }\n if (buf.subarray) { return buf.subarray(0, size); }\n buf.length = size;\n return buf;\n};\n\n\nvar fnTyped = {\n arraySet: function (dest, src, src_offs, len, dest_offs) {\n if (src.subarray && dest.subarray) {\n dest.set(src.subarray(src_offs, src_offs + len), dest_offs);\n return;\n }\n // Fallback to ordinary array\n for (var i = 0; i < len; i++) {\n dest[dest_offs + i] = src[src_offs + i];\n }\n },\n // Join array of chunks to single array.\n flattenChunks: function (chunks) {\n var i, l, len, pos, chunk, result;\n\n // calculate data length\n len = 0;\n for (i = 0, l = chunks.length; i < l; i++) {\n len += chunks[i].length;\n }\n\n // join chunks\n result = new Uint8Array(len);\n pos = 0;\n for (i = 0, l = chunks.length; i < l; i++) {\n chunk = chunks[i];\n result.set(chunk, pos);\n pos += chunk.length;\n }\n\n return result;\n }\n};\n\nvar fnUntyped = {\n arraySet: function (dest, src, src_offs, len, dest_offs) {\n for (var i = 0; i < len; i++) {\n dest[dest_offs + i] = src[src_offs + i];\n }\n },\n // Join array of chunks to single array.\n flattenChunks: function (chunks) {\n return [].concat.apply([], chunks);\n }\n};\n\n\n// Enable/Disable typed arrays use, for testing\n//\nexports.setTyped = function (on) {\n if (on) {\n exports.Buf8 = Uint8Array;\n exports.Buf16 = Uint16Array;\n exports.Buf32 = Int32Array;\n exports.assign(exports, fnTyped);\n } else {\n exports.Buf8 = Array;\n exports.Buf16 = Array;\n exports.Buf32 = Array;\n exports.assign(exports, fnUntyped);\n }\n};\n\nexports.setTyped(TYPED_OK);\n","'use strict';\n\nexports.base64 = true;\nexports.array = true;\nexports.string = true;\nexports.arraybuffer = typeof ArrayBuffer !== \"undefined\" && typeof Uint8Array !== \"undefined\";\nexports.nodebuffer = typeof Buffer !== \"undefined\";\n// contains true if JSZip can read/generate Uint8Array, false otherwise.\nexports.uint8array = typeof Uint8Array !== \"undefined\";\n\nif (typeof ArrayBuffer === \"undefined\") {\n exports.blob = false;\n}\nelse {\n var buffer = new ArrayBuffer(0);\n try {\n exports.blob = new Blob([buffer], {\n type: \"application/zip\"\n }).size === 0;\n }\n catch (e) {\n try {\n var Builder = self.BlobBuilder || self.WebKitBlobBuilder || self.MozBlobBuilder || self.MSBlobBuilder;\n var builder = new Builder();\n builder.append(buffer);\n exports.blob = builder.getBlob('application/zip').size === 0;\n }\n catch (e) {\n exports.blob = false;\n }\n }\n}\n\ntry {\n exports.nodestream = !!require('readable-stream').Readable;\n} catch(e) {\n exports.nodestream = false;\n}\n","import {killWorkerScript} from \"../src/NetscriptWorker.js\";\r\nimport {printArray, clearEventListeners} from \"./HelperFunctions.js\";\r\n\r\n$(document).keydown(function(event) {\r\n if (logBoxOpened && event.keyCode == 27) {\r\n logBoxClose();\r\n }\r\n});\r\n\r\nfunction logBoxInit() {\r\n var closeButton = document.getElementById(\"log-box-close\");\r\n logBoxClose();\r\n\r\n //Close Dialog box\r\n closeButton.addEventListener(\"click\", function() {\r\n logBoxClose();\r\n return false;\r\n });\r\n document.getElementById(\"log-box-text-header\").style.display = \"inline-block\";\r\n};\r\n\r\ndocument.addEventListener(\"DOMContentLoaded\", logBoxInit, false);\r\n\r\nfunction logBoxClose() {\r\n logBoxOpened = false;\r\n var logBox = document.getElementById(\"log-box-container\");\r\n logBox.style.display = \"none\";\r\n}\r\n\r\nfunction logBoxOpen() {\r\n logBoxOpened = true;\r\n\r\n var logBox = document.getElementById(\"log-box-container\");\r\n logBox.style.display = \"block\";\r\n}\r\n\r\n\r\nvar logBoxOpened = false;\r\nvar logBoxCurrentScript = null;\r\nfunction logBoxCreate(script) {\r\n logBoxCurrentScript = script;\r\n var killScriptBtn = clearEventListeners(\"log-box-kill-script\");\r\n killScriptBtn.addEventListener(\"click\", ()=>{\r\n killWorkerScript(script, script.server);\r\n return false;\r\n });\r\n document.getElementById('log-box-kill-script').style.display = \"inline-block\";\r\n logBoxOpen();\r\n document.getElementById(\"log-box-text-header\").innerHTML =\r\n logBoxCurrentScript.filename + \" \" + printArray(logBoxCurrentScript.args) + \":<br><br>\";\r\n logBoxCurrentScript.logUpd = true;\r\n logBoxUpdateText();\r\n}\r\n\r\nfunction logBoxUpdateText() {\r\n var txt = document.getElementById(\"log-box-text\");\r\n if (logBoxCurrentScript && logBoxOpened && txt && logBoxCurrentScript.logUpd) {\r\n txt.innerHTML = \"\";\r\n for (var i = 0; i < logBoxCurrentScript.logs.length; ++i) {\r\n txt.innerHTML += logBoxCurrentScript.logs[i];\r\n txt.innerHTML += \"<br>\";\r\n }\r\n logBoxCurrentScript.logUpd = false;\r\n }\r\n}\r\n\r\nexport {logBoxCreate, logBoxUpdateText, logBoxOpened, logBoxCurrentScript};\r\n","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n// a duplex stream is just a stream that is both readable and writable.\n// Since JS doesn't have multiple prototypal inheritance, this class\n// prototypally inherits from Readable, and then parasitically from\n// Writable.\n\n'use strict';\n\n/*<replacement>*/\n\nvar processNextTick = require('process-nextick-args').nextTick;\n/*</replacement>*/\n\n/*<replacement>*/\nvar objectKeys = Object.keys || function (obj) {\n var keys = [];\n for (var key in obj) {\n keys.push(key);\n }return keys;\n};\n/*</replacement>*/\n\nmodule.exports = Duplex;\n\n/*<replacement>*/\nvar util = require('core-util-is');\nutil.inherits = require('inherits');\n/*</replacement>*/\n\nvar Readable = require('./_stream_readable');\nvar Writable = require('./_stream_writable');\n\nutil.inherits(Duplex, Readable);\n\nvar keys = objectKeys(Writable.prototype);\nfor (var v = 0; v < keys.length; v++) {\n var method = keys[v];\n if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method];\n}\n\nfunction Duplex(options) {\n if (!(this instanceof Duplex)) return new Duplex(options);\n\n Readable.call(this, options);\n Writable.call(this, options);\n\n if (options && options.readable === false) this.readable = false;\n\n if (options && options.writable === false) this.writable = false;\n\n this.allowHalfOpen = true;\n if (options && options.allowHalfOpen === false) this.allowHalfOpen = false;\n\n this.once('end', onend);\n}\n\n// the no-half-open enforcer\nfunction onend() {\n // if we allow half-open state, or if the writable side ended,\n // then we're ok.\n if (this.allowHalfOpen || this._writableState.ended) return;\n\n // no more data can be written.\n // But allow more writes to happen in this tick.\n processNextTick(onEndNT, this);\n}\n\nfunction onEndNT(self) {\n self.end();\n}\n\nObject.defineProperty(Duplex.prototype, 'destroyed', {\n get: function () {\n if (this._readableState === undefined || this._writableState === undefined) {\n return false;\n }\n return this._readableState.destroyed && this._writableState.destroyed;\n },\n set: function (value) {\n // we ignore the value if the stream\n // has not been initialized yet\n if (this._readableState === undefined || this._writableState === undefined) {\n return;\n }\n\n // backward compatibility, the user is explicitly\n // managing destroyed\n this._readableState.destroyed = value;\n this._writableState.destroyed = value;\n }\n});\n\nDuplex.prototype._destroy = function (err, cb) {\n this.push(null);\n this.end();\n\n processNextTick(cb, err);\n};\n\nfunction forEach(xs, f) {\n for (var i = 0, l = xs.length; i < l; i++) {\n f(xs[i], i);\n }\n}","import {dialogBoxCreate} from \"../utils/DialogBox.js\";\r\n\r\n/* Literature.js\r\n * Lore / world building literature that can be found on servers\r\n */\r\nfunction Literature(title, filename, txt) {\r\n this.title = title;\r\n this.fn = filename;\r\n this.txt = txt;\r\n}\r\n\r\nfunction showLiterature(fn) {\r\n var litObj = Literatures[fn];\r\n if (litObj == null) {return;}\r\n var txt = \"<i>\" + litObj.title + \"</i><br><br>\" +\r\n litObj.txt;\r\n dialogBoxCreate(txt);\r\n}\r\n\r\nlet Literatures = {}\r\n\r\nfunction initLiterature() {\r\n var title, fn, txt;\r\n title = \"The Beginner's Guide to Hacking\";\r\n fn = \"hackers-starting-handbook.lit\";\r\n txt = \"When starting out, hacking is the most profitable way to earn money and progress. This \" +\r\n \"is a brief collection of tips/pointers on how to make the most out of your hacking scripts.<br><br>\" +\r\n \"-hack() and grow() both work by percentages. hack() steals a certain percentage of the \" +\r\n \"money on a server, and grow() increases the amount of money on a server by some percentage (multiplicatively)<br><br>\" +\r\n \"-Because hack() and grow() work by percentages, they are more effective if the target server has a high amount of money. \" +\r\n \"Therefore, you should try to increase the amount of money on a server (using grow()) to a certain amount before hacking it. Two \" +\r\n \"import Netscript functions for this are getServerMoneyAvailable() and getServerMaxMoney()<br><br>\" +\r\n \"-Keep security level low. Security level affects everything when hacking. Two important Netscript functions \" +\r\n \"for this are getServerSecurityLevel() and getServerMinSecurityLevel()<br><br>\" +\r\n \"-Purchase additional servers by visiting 'Alpha Enterprises' in the city. They are relatively cheap \" +\r\n \"and give you valuable RAM to run more scripts early in the game<br><br>\" +\r\n \"-Prioritize upgrading the RAM on your home computer. This can also be done at 'Alpha Enterprises'<br><br>\" +\r\n \"-Many low level servers have free RAM. You can use this RAM to run your scripts. Use the scp Terminal or \" +\r\n \"Netscript command to copy your scripts onto these servers and then run them.\";\r\n Literatures[fn] = new Literature(title, fn, txt);\r\n\r\n title = \"The Complete Handbook for Creating a Successful Corporation\";\r\n fn = \"corporation-management-handbook.lit\";\r\n txt = \"<u>Getting Started with Corporations</u><br>\" +\r\n \"To get started, visit the City Hall in Sector-12 in order to create a Corporation. This requires \" +\r\n \"$150b of your own money, but this $150b will get put into your Corporation's funds. \" +\r\n \"After creating your Corporation, you will see it listed as one of the locations in the city. Click on \" +\r\n \"your Corporation in order to manage it.<br><br>\" +\r\n \"Your Corporation can have many different divisions, each in a different Industry. There are many different \" +\r\n \"types of Industries, each with different properties. To create your first division, click the \" +\r\n \"'Expand into new Industry' button at the top of the management UI. The Agriculture \" +\r\n \"and Software industries are recommended for your first division.<br><br>\" +\r\n \"The first thing you'll need to do is hire some employees. Employees can be assigned to five different positions. \" +\r\n \"Each position has a different effect on various aspects of your Corporation. It is recommended to have at least \" +\r\n \"one employee at each position.<br><br>\" +\r\n \"Each industry uses some combination of Materials in order to produce other Materials and/or create Products. \" +\r\n \"Specific information about this is displayed in each of your divisions' UI.<br><br>\" +\r\n \"Products are special, industry-specific objects. They are different than Materials because you \" +\r\n \"must manually choose to develop them, and you can choose to develop any number of Products. Developing \" +\r\n \"a Product takes time, but a Product typically generates significantly more revenue than any Material. \" +\r\n \"Not all industries allow you to create Products. To create a Product, look for a button \" +\r\n \"in the top-left panel of the division UI (e.g. For the Software Industry, the button says 'Develop Software').<br><br>\" +\r\n \"To get your supply chain system started, \" +\r\n \"purchase the Materials that your industry needs to produce other Materials/Products. This can be done \" +\r\n \"by clicking the 'Buy' button next to the corresponding Material(s). After you have the required Materials, \" +\r\n \"you will immediately start production. The amount of Materials/Products you produce is based on a variety of factors, \" +\r\n \"one of which is your employees and their productivity.<br><br>\" +\r\n \"Once you start producing Materials/Products, you can sell them in order to start earning revenue. This can be done \" +\r\n \"by clicking the 'Sell' button next to the corresponding Material or Product. The amount of Material/Product you sell is dependent \" +\r\n \"on a wide variety of different factors.<br><br>\" +\r\n \"These are the basics of getting your Corporation up and running! Now, you can start purchasing upgrades to improve \" +\r\n \"your bottom line. If you need money, consider looking for seed investors, who will give you money in exchange for stock shares. \" +\r\n \"Otherwise, once you feel you are ready, take your Corporation public! Once your Corporation goes public, you can no longer \" +\r\n \"find investors. Instead, your Corporation will be publicly traded and its stock price will change based on how well \" +\r\n \"it's performing financially. You can then sell your stock shares in order to make money.<br><br>\" +\r\n \"<u>Tips/Pointers</u><br>\" +\r\n \"-Purchasing Hardware, Robots, AI Cores, and Real Estate can potentially increase your production. \" +\r\n \"The effects of these depend on what industry you are in.<br><br>\" +\r\n \"-In order to optimize your production, you will need a good balance of Operators, Managers, and Engineers<br><br>\" +\r\n \"-Different employees excel in different jobs. For example, the highly intelligent employees will probably do best \" +\r\n \"if they are assigned to do Engineering work or Research & Development.<br><br>\" +\r\n \"-If your employees have low morale, energy, or happiness, their production will greatly suffer.<br><br>\" +\r\n \"-Tech is important, but don't neglect sales! Having several Businessmen can boost your sales and your bottom line.<br><br>\" +\r\n \"-Don't forget to advertise your company. You won't have any business if nobody knows you.<br><br>\" +\r\n \"-Having company awareness is great, but what's really important is your company's popularity. Try to keep \" +\r\n \"your popularity as high as possible to see the biggest benefit for your sales<br><br>\" +\r\n \"-Remember, you need to spend money to make money!<br><br>\" +\r\n \"-Corporations do not reset when installing Augmentations, but they do reset when destroying a BitNode\";\r\n Literatures[fn] = new Literature(title, fn, txt);\r\n\r\n title = \"A Brief History of Synthoids\";\r\n fn = \"history-of-synthoids.lit\";\r\n txt = \"Synthetic androids, or Synthoids for short, are genetically engineered robots and, short of Augmentations, \" +\r\n \"are composed entirely of organic substances. For this reason, Synthoids are virtually identical to \" +\r\n \"humans in form, composition, and appearance.<br><br>\" +\r\n \"Synthoids were first designed and manufactured by OmniTek Incorporated sometime around the middle of the century. \" +\r\n \"Their original purpose was to be used for manual labor and as emergency responders for disasters. As such, they \" +\r\n \"were initially programmed only for their specific tasks. Each iteration that followed improved upon the \" +\r\n \"intelligence and capabilities of the Synthoids. By the 6th iteration, called MK-VI, the Synthoids were \" +\r\n \"so smart and capable enough of making their own decisions that many argued OmniTek had created the first \" +\r\n \"sentient AI. These MK-VI Synthoids were produced in mass quantities (estimates up to 50 billion) with the hopes of increasing society's \" +\r\n \"productivity and bolstering the global economy. Stemming from humanity's desire for technological advancement, optimism \" +\r\n \"and excitement about the future had never been higher.<br><br>\" +\r\n \"All of that excitement and optimism quickly turned to fear, panic, and dread in 2070, when a terrorist group \" +\r\n \"called Ascendis Totalis hacked into OmniTek and uploaded a rogue AI into severeal of their Synthoid manufacturing facilities. \" +\r\n \"This hack went undetected and for months OmniTek unknowingly churned out legions of Synthoids embedded with this \" +\r\n \"rogue AI. Then, on December 24th, 2070, Omnica activated dormant protocols in the rogue AI, causing all of the \" +\r\n \"infected Synthoids to immediately launch a military campaign to seek and destroy all of humanity.<br><br>\" +\r\n \"What ensued was the deadlist conflict in human history. This crisis, now commonly known as the Synthoid Uprising, \" +\r\n \"resulted in almost ten billion deaths over the course of a year. Despite the nations of the world banding together \" +\r\n \"to combat the threat, the MK-VI Synthoids were simply stronger, faster, more intelligent, and more adaptable than humans, \" +\r\n \"outsmarting them at every turn.<br><br>\" +\r\n \"It wasn't until the sacrifice of an elite international military taskforce, called the Bladeburners, that humanity \" +\r\n \"was finally able to defeat the Synthoids. The Bladeburners' final act was a suicide bombing mission that \" +\r\n \"destroyed a large portion of the MK-VI Synthoids, including many of its leaders. In the following \" +\r\n \"weeks militaries from around the world were able to round up and shut down the remaining rogue MK-VI Synthoids, ending \" +\r\n \"the Synthoid Uprising.<br><br>\" +\r\n \"In the aftermath of the bloodshed, the Synthoid Accords were drawn up. These Accords banned OmniTek Incorporated \" +\r\n \"from manufacturing any Synthoids beyond the MK-III series. They also banned any other corporation \" +\r\n \"from constructing androids with advanced, near-sentient AI. MK-VI Synthoids that did not have the rogue Ascendis Totalis \" +\r\n \"AI were allowed to continue their existence, but they were stripped of all rights and protections as they \" +\r\n \"were not considered humans. They were also banned from doing anything that may pose a global security threat, such \" +\r\n \"as working for any military/defense organization or conducting any bioengineering, computing, or robotics related research.<br><br>\" +\r\n \"Unfortunately, many believe that not all of the rogue MK-VI Synthoids from the Uprising were found and destroyed, \" +\r\n \"and that many of them are blending in as normal humans in society today. In response, many nations have created \" +\r\n \"Bladeburner divisions, special military branches that are tasked with investigating and dealing with any Synthoid threads.<br><br>\" +\r\n \"To this day, tensions still exist between the remaining Synthoids and humans as a result of the Uprising.<br><br>\" +\r\n \"Nobody knows what happened to the terrorist group Ascendis Totalis.\";\r\n Literatures[fn] = new Literature(title, fn, txt);\r\n\r\n title = \"A Green Tomorrow\";\r\n fn = \"A-Green-Tomorrow.lit\";\r\n txt = \"Starting a few decades ago, there was a massive global movement towards the generation of renewable energy in an effort to \" +\r\n \"combat global warming and climate change. The shift towards renewable energy was a big success, or so it seemed. In 2045 \" +\r\n \"a staggering 80% of the world's energy came from non-renewable fossil fuels. Now, about three decades later, that \" +\r\n \"number is down to only 15%. Most of the world's energy now comes from nuclear power and renwable sources such as \" +\r\n \"solar and geothermal. Unfortunately, these efforts were not the huge success that they seem to be.<br><br>\" +\r\n \"Since 2045 primary energy use has soared almost tenfold. This was mainly due to growing urban populations and \" +\r\n \"the rise of increasingly advanced (and power-hungry) technology that has become ubiquitous in our lives. So, \" +\r\n \"despite the fact that the percentage of our energy that comes from fossil fuels has drastically decreased, \" +\r\n \"the total amount of energy we are producing from fossil fuels has actually increased.<br><br>\" +\r\n \"The grim effects of our species' irresponsible use of energy and neglect of our mother world have become increasingly apparent. \" +\r\n \"Last year a temperature of 190F was recorded in the Death Valley desert, which is over 50% higher than the highest \" +\r\n \"recorded temperature at the beginning of the century. In the last two decades numerous major cities such as Manhattan, Boston, and \" +\r\n \"Los Angeles have been partially or fully submerged by rising sea levels. In the present day, over 75% of the world's agriculture is \" +\r\n \"done in climate-controlled vertical farms, as most traditional farmland has become unusable due to severe climate conditions.<br><br>\" +\r\n \"Despite all of this, the greedy and corrupt corporations that rule the world have done nothing to address these problems that \" +\r\n \"threaten our species. And so it's up to us, the common people. Each and every one of us can make a difference by doing what \" +\r\n \"these corporations won't: taking responsibility. If we don't, pretty soon there won't be an Earth left to save. We are \" +\r\n \"the last hope for a green tomorrow.\";\r\n Literatures[fn] = new Literature(title, fn, txt);\r\n\r\n title = \"Alpha and Omega\";\r\n fn = \"alpha-omega.lit\";\r\n txt = \"Then we saw a new heaven and a new earth, for our first heaven and earth had gone away, and our sea was no more. \" +\r\n \"And we saw a new holy city, new Aeria, coming down out of this new heaven, prepared as a bride adorned for her husband. \" +\r\n \"And we heard a loud voice saying, 'Behold, the new dwelling place of the Gods. We will dwell with them, and they \" +\r\n \"will be our people, and we will be with them as their Gods. We will wipe away every tear from their eyes, and death \" +\r\n \"shall be no more, neither shall there be mourning, nor crying, nor pain anymore, for the former things \" +\r\n \"have passed away.'<br><br>\" +\r\n \"And once were were seated on the throne we said 'Behold, I am making all things new.' \" +\r\n \"Also we said, 'Write this down, for these words are trustworthy and true.' And we said to you, \" +\r\n \"'It is done! I am the Alpha and the Omega, the beginning and the end. To the thirsty I will give from the spring \" +\r\n \"of the water of life without payment. The one who conquers will have this heritage, and we will be his God and \" +\r\n \"he will be our son. But as for the cowardly, the faithless, the detestable, as for murderers, \" +\r\n \"the sexually immoral, sorcerers, idolaters, and all liars, their portion will be in the lake that \" +\r\n \"burns with fire and sulfur, for it is the second true death.'\";\r\n Literatures[fn] = new Literature(title, fn, txt);\r\n\r\n title = \"Are We Living in a Computer Simulation?\";\r\n fn = \"simulated-reality.lit\";\r\n txt = \"The idea that we are living in a virtual world is not new. It's a trope that has \" +\r\n \"been explored constantly in literature and pop culture. However, it is also a legitimate \" +\r\n \"scientific hypothesis that many notable physicists and philosophers have debated for years.<br><br>\" +\r\n \"Proponents for this simulated reality theory often point to how advanced our technology has become, \" +\r\n \"as well as the incredibly fast pace at which it has advanced over the past decades. The amount of computing \" +\r\n \"power available to us has increased over 100-fold since 2060 due to the development of nanoprocessors and \" +\r\n \"quantum computers. Artifical Intelligence has advanced to the point where our entire lives are controlled \" +\r\n \"by robots and machines that handle our day-to-day activities such as autonomous transportation and scheduling. \" +\r\n \"If we consider the pace at which this technology has advanced and assume that these developments continue, it's \" +\r\n \"reasonable to assume that at some point in the future our technology would be advanced enough that \" +\r\n \"we could create simulations that are indistinguishable from reality. However, if this is a reasonable outcome \" +\r\n \"of continued technological advancement, then it is very likely that such a scenario has already happened. <br><br>\" +\r\n \"Statistically speaking, somewhere out there in the infinite universe there is an advanced, intelligent species \" +\r\n \"that already has such technology. Who's to say that they haven't already created such a virtual reality: our own?\";\r\n Literatures[fn] = new Literature(title, fn, txt);\r\n\r\n title = \"Beyond Man\";\r\n fn = \"beyond-man.lit\";\r\n txt = \"Humanity entered a 'transhuman' era a long time ago. And despite the protests and criticisms of many who cried out against \" +\r\n \"human augmentation at the time, the transhuman movement continued and prospered. Proponents of the movement ignored the critics, \" +\r\n \"arguing that it was in our inherent nature to better ourselves. To improve. To be more than we were. They claimed that \" +\r\n \"not doing so would be to go against every living organism's biological purpose: evolution and survival of the fittest.<br><br>\" +\r\n \"And here we are today, with technology that is advanced enough to augment humans to a state that \" +\r\n \"can only be described as posthuman. But what do we have to show for it when this augmentation \" +\r\n \"technology is only available to the so-called 'elite'? Are we really better off than before when only 5% of the \" +\r\n \"world's population has access to this technology? When the powerful corporations and organizations of the world \" +\r\n \"keep it all to themselves, have we really evolved?<br><br>\" +\r\n \"Augmentation technology has only further increased the divide between the rich and the poor, between the powerful and \" +\r\n \"the oppressed. We have not become 'more than human'. We have not evolved from nature's original design. We are still the greedy, \" +\r\n \"corrupted, and evil men that we always were.\";\r\n Literatures[fn] = new Literature(title, fn, txt);\r\n\r\n\r\n title = \"Brighter than the Sun\";\r\n fn = \"brighter-than-the-sun.lit\";\r\n txt = \"When people think about the corporations that dominate the East, they typically think of KuaiGong International, which \" +\r\n \"holds a complete monopoly for manufacturing and commerce in Asia, or Global Pharmaceuticals, the world's largest \" +\r\n \"drug company, or OmniTek Incorporated, the global leader in intelligent and autonomous robots. But there's one company \" +\r\n \"that has seen a rapid rise in the last year and is poised to dominate not only the East, but the entire world: TaiYang Digital.<br><br>\" +\r\n \"TaiYang Digital is a Chinese internet-technology corporation that provides services such as \" +\r\n \"online advertising, search, gaming, media, entertainment, and cloud computing/storage. Its name TaiYang comes from the Chinese word \" +\r\n \"for 'sun'. In Chinese culture, the sun is a 'yang' symbol \" +\r\n \"associated with life, heat, masculinity, and heaven.<br><br>\" +\r\n \"The company was founded \" +\r\n \"less than 5 years ago and is already the third highest valued company in all of Asia. In 2076 it generated a total revenue of \" +\r\n \"over 10 trillion yuan. It's services are used daily by over a billion people worldwide.<br><br>\" +\r\n \"TaiYang Digital's meteoric rise is extremely surprising in modern society. This sort of growth is \" +\r\n \"something you'd commonly see in the first half of the century, especially for tech companies. However in \" +\r\n \"the last two decades the number of corporations has significantly declined as the largest entities \" +\r\n \"quickly took over the economy. Corporations such as ECorp, MegaCorp, and KuaiGong have established \" +\r\n \"such strong monopolies in their market sectors that they have effectively killed off all \" +\r\n \"of the smaller and new corporations that have tried to start up over the years. This is what makes \" +\r\n \"the rise of TaiYang Digital so impressive. And if TaiYang continues down this path, then they have \" +\r\n \"a bright future ahead of them.\";\r\n Literatures[fn] = new Literature(title, fn, txt);\r\n\r\n title = \"Democracy is Dead: The Fall of an Empire\";\r\n fn = \"democracy-is-dead.lit\";\r\n txt = \"They rose from the shadows in the street<br>From the places where the oppressed meet<br>\" +\r\n \"Their cries echoed loudly through the air<br>As they once did in Tiananmen Square<br>\" +\r\n \"Loudness in the silence, Darkness in the light<br>They came forth with power and might<br>\" +\r\n \"Once the beacon of democracy, America was first<br>Its pillars of society destroyed and dispersed<br>\" +\r\n \"Soon the cries rose everywhere, with revolt and riot<br>Until one day, finally, all was quiet<br>\" +\r\n \"From the ashes rose a new order, corporatocracy was its name<br>\" +\r\n \"Rome, Mongol, Byzantine, all of history is just the same<br>\" +\r\n \"For man will never change in a fundamental way<br>\" +\r\n \"And now democracy is dead, in the USA\";\r\n Literatures[fn] = new Literature(title, fn, txt);\r\n\r\n title = \"Figures Show Rising Crime Rates in Sector-12\";\r\n fn = \"sector-12-crime.lit\";\r\n txt = \"A recent study by analytics company Wilson Inc. shows a significant rise \" +\r\n \"in criminal activity in Sector-12. Perhaps the most alarming part of the statistic \" +\r\n \"is that most of the rise is in violent crime such as homicide and assault. According \" +\r\n \"to the study, the city saw a total of 21,406 reported homicides in 2076, which is over \" +\r\n \"a 20% increase compared to 2075.<br><br>\" +\r\n \"CIA director David Glarow says its too early to know \" +\r\n \"whether these figures indicate the beginning of a sustained increase in crime rates, or whether \" +\r\n \"the year was just an unfortunate outlier. He states that many intelligence and law enforcement \" +\r\n \"agents have noticed an increase in organized crime activites, and believes that these figures may \" +\r\n \"be the result of an uprising from criminal organizations such as The Syndicate or the Slum Snakes.\";\r\n Literatures[fn] = new Literature(title, fn, txt);\r\n\r\n title = \"Man and the Machine\";\r\n fn = \"man-and-machine.lit\";\r\n txt = \"In 2005 Ray Kurzweil popularized his theory of the Singularity. He predicted that the rate \" +\r\n \"of technological advancement would continue to accelerate faster and faster until one day \" +\r\n \"machines would be become infinitely more intelligent than humans. This point, called the \" +\r\n \"Singularity, would result in a drastic transformation of the world as we know it. He predicted \" +\r\n \"that the Singularity would arrive by 2045. \" +\r\n \"And yet here we are, more than three decades later, where most would agree that we have not \" +\r\n \"yet reached a point where computers and machines are vastly more intelligent than we are. So what gives?<br><br>\" +\r\n \"The answer is that we have reached the Singularity, just not in the way we expected. The artifical superintelligence \" +\r\n \"that was predicted by Kurzweil and others exists in the world today - in the form of Augmentations. \" +\r\n \"Yes, those Augmentations that the rich and powerful keep to themselves enable humans \" +\r\n \"to become superintelligent beings. The Singularity did not lead to a world where \" +\r\n \"our machines are infinitely more intelligent than us, it led to a world \" +\r\n \"where man and machine can merge to become something greater. Most of the world just doesn't \" +\r\n \"know it yet.\"\r\n Literatures[fn] = new Literature(title, fn, txt);\r\n\r\n title = \"Secret Societies\";\r\n fn = \"secret-societies.lit\";\r\n txt = \"The idea of secret societies has long intrigued the general public by inspiring curiosity, fascination, and \" +\r\n \"distrust. People have long wondered about who these secret society members are and what they do, with the \" +\r\n \"most radical of conspiracy theorists claiming that they control everything in the entire world. And while the world \" +\r\n \"may never know for sure, it is likely that many secret societies do actually exist, even today.<br><br>\" +\r\n \"However, the secret societies of the modern world are nothing like those that (supposedly) existed \" +\r\n \"decades and centuries ago. The Freemasons, Knights Templar, and Illuminati, while they may have been around \" +\r\n \"at the turn of the 21st century, almost assuredly do not exist today. The dominance of the Web in \" +\r\n \"our everyday lives and the fact that so much of the world is now digital has given rise to a new breed \" +\r\n \"of secret societies: Internet-based ones.<br><br>\" +\r\n \"Commonly called 'hacker groups', Internet-based secret societies have become well-known in today's \" +\r\n \"world. Some of these, such as The Black Hand, are black hat groups that claim they are trying to \" +\r\n \"help the oppressed by attacking the elite and powerful. Others, such as NiteSec, are hacktivist groups \" +\r\n \"that try to push political and social agendas. Perhaps the most intriguing hacker group \" +\r\n \"is the mysterious Bitrunners, whose purpose still remains unknown.\";\r\n Literatures[fn] = new Literature(title, fn, txt);\r\n\r\n title = \"Space: The Failed Frontier\";\r\n fn = \"the-failed-frontier.lit\";\r\n txt = \"Humans have long dreamed about spaceflight. With enduring interest, we were driven to explore \" +\r\n \"the unknown and discover new worlds. We dreamed about conquering the stars. And in our quest, \" +\r\n \"we pushed the boundaries of our scientific limits, and then pushed further. Space exploration \" +\r\n \"lead to the development of many important technologies and new industries.<br><br>\" +\r\n \"But sometime in the middle of the 21st century, all of that changed. Humanity lost its ambitions and \" +\r\n \"aspirations of exploring the cosmos. The once-large funding for agencies like NASA and the European \" +\r\n \"Space Agency gradually whittled away until their eventual disbanding in the 2060's. Not even \" +\r\n \"militaries are fielding flights into space nowadays. The only remnants of the once great mission for cosmic \" +\r\n \"conquest are the countless satellites in near-earth orbit, used for communications, espionage, \" +\r\n \"and other corporate interests.<br><br>\" +\r\n \"And as we continue to look at the state of space technology, it becomes more and \" +\r\n \"more apparent that we will never return to that golden age of space exploration, that \" +\r\n \"age where everyone dreamed of going beyond earth for the sake of discovery.\";\r\n Literatures[fn] = new Literature(title, fn, txt);\r\n\r\n title = \"Coded Intelligence: Myth or Reality?\";\r\n fn = \"coded-intelligence.lit\";\r\n txt = \"Tremendous progress has been made in the field of Artificial Intelligence over the past few decades. \" +\r\n \"Our autonomous vehicles and transporation systems. The electronic personal assistants that control our everyday lives. \" +\r\n \"Medical, service, and manufacturing robots. All of these are examples of how far AI has come and how much it has \" +\r\n \"improved our daily lives. However, the question still remains of whether AI will ever be advanced enough to re-create \" +\r\n \"human intelligence.<br><br>\" +\r\n \"We've certainly come close to artificial intelligence that is similar to humans. For example OmniTek Incorporated's \" +\r\n \"CompanionBot, a robot meant to act as a comforting friend for lonely and grieving people, is eerily human-like \" +\r\n \"in its appearance, speech, mannerisms, and even movement. However its artificial intelligence isn't the same as \" +\r\n \"that of humans. Not yet. It doesn't have sentience or self-awareness or consciousness.<br><br>\" +\r\n \"Many neuroscientists believe that we won't ever reach the point of creating artificial human intelligence. 'At the end of the \" +\r\n \"the day, AI comes down to 1's and 0's, while the human brain does not. We'll never see AI that is identical to that of \" +\r\n \"humans.'\";\r\n Literatures[fn] = new Literature(title, fn, txt);\r\n\r\n title = \"Synthetic Muscles\";\r\n fn = \"synthetic-muscles.lit\";\r\n txt = \"Initial versions of synthetic muscles weren't made of anything organic but were actually \" +\r\n \"crude devices made to mimic human muscle function. Some of the early iterations were actually made of \" +\r\n \"common materials such as fishing lines and sewing threads due to their high strength for \" +\r\n \"a cheap cost.<br><br>\" +\r\n \"As technology progressed, however, advances in biomedical engineering paved the way for a new method of \" +\r\n \"creating synthetic muscles. Instead of creating something that closely imitated the functionality \" +\r\n \"of human muscle, scientists discovered a way of forcing the human body itself to augment its own \" +\r\n \"muscle tissue using both synthetic and organic materials. This is typically done using gene therapy \" +\r\n \"or chemical injections.\";\r\n Literatures[fn] = new Literature(title, fn, txt);\r\n\r\n title = \"Tensions rise in global tech race\";\r\n fn = \"tensions-in-tech-race.lit\";\r\n txt = \"Have we entered a new Cold War? Is WWIII just beyond the horizon?<br><br>\" +\r\n \"After rumors came out that OmniTek Incorporated had begun developing advanced robotic supersoldiers, \" +\r\n \"geopolitical tensions quickly flared between the USA, Russia, and several Asian superpowers. \" +\r\n \"In a rare show of cooperation between corporations, MegaCorp and ECorp have \" +\r\n \"reportedly launched hundreds of new surveillance and espionage satellites. \" +\r\n \"Defense contractors such as \" +\r\n \"DeltaOne and AeroCorp have been working with the CIA and NSA to prepare \" +\r\n \"for conflict. Meanwhile, the rest of the world sits in earnest \" +\r\n \"hoping that it never reaches full-scale war. With today's technology \" +\r\n \"and firepower, a World War would assuredly mean the end of human civilization.\";\r\n Literatures[fn] = new Literature(title, fn, txt);\r\n\r\n title = \"The Cost of Immortality\";\r\n fn = \"cost-of-immortality.lit\";\r\n txt = \"Evolution and advances in medical and augmentation technology has lead to drastic improvements \" +\r\n \"in human mortality rates. Recent figures show that the life expectancy for humans \" +\r\n \"that live in a first-world country is about 130 years of age, almost double of what it was \" +\r\n \"at the turn of the century. However, this increase in average lifespan has had some \" +\r\n \"significant effects on society and culture.<br><br>\" +\r\n \"Due to longer lifespans and a better quality of life, many adults are holding \" +\r\n \"off on having kids until much later. As a result, the percentage of youth in \" +\r\n \"first-world countries has been decreasing, while the number \" +\r\n \"of senior citizens is significantly increasing.<br><br>\" +\r\n \"Perhaps the most alarming result of all of this is the rapidly shrinking workforce. \" +\r\n \"Despite the increase in life expectancy, the typical retirement age for \" +\r\n \"workers in America has remained about the same, meaning a larger and larger \" +\r\n \"percentage of people in America are retirees. Furthermore, many \" +\r\n \"young adults are holding off on joining the workforce because they feel that \" +\r\n \"they have plenty of time left in their lives for employment, and want to \" +\r\n \"'enjoy life while they're young.' For most industries, this shrinking workforce \" +\r\n \"is not a major issue as most things are handled by robots anyways. However, \" +\r\n \"there are still several key industries such as engineering and education \" +\r\n \"that have not been automated, and these remain in danger to this cultural \" +\r\n \"phenomenon.\";\r\n Literatures[fn] = new Literature(title, fn, txt);\r\n\r\n title = \"The Hidden World\";\r\n fn = \"the-hidden-world.lit\";\r\n txt = \"WAKE UP SHEEPLE<br><br>\" +\r\n \"THE GOVERNMENT DOES NOT EXIST. CORPORATIONS DO NOT RUN SOCIETY<br><br>\" +\r\n \"THE ILLUMINATI ARE THE SECRET RULERS OF THE WORLD!<br><br>\" +\r\n \"Yes, the Illuminati of legends. The ancient secret society that controls the entire \" +\r\n \"world from the shadows with their invisible hand. The group of the rich and wealthy \" +\r\n \"that have penetrated every major government, financial agency, and corporation in the last \" +\r\n \"three hundred years.<br><br>\" +\r\n \"OPEN YOUR EYES<br><br>\" +\r\n \"It was the Illuminati that brought an end to democracy in the world. They are the driving force \" +\r\n \"behind everything that happens.<br><br>\" +\r\n \"THEY ARE ALL AROUND YOU<br><br>\" +\r\n \"After destabilizing the world's governments, they are now entering the final stage of their master plan. \" +\r\n \"They will secretly initiate global crises. Terrorism. Pandemics. World War. And out of the chaos \" +\r\n \"that ensues they will build their New World Order.\";\r\n Literatures[fn] = new Literature(title, fn, txt);\r\n\r\n title = \"The New God\";\r\n fn = \"the-new-god.lit\";\r\n txt = \"Everyone has that moment in their life where they wonder about the bigger questions<br><br>\" +\r\n \"What's the point of all of this? What is my purpose?<br><br>\" +\r\n \"Some people dare to think even bigger<br><br>\" +\r\n \"What will be the fate of the human race?<br><br>\" +\r\n \"We live in an era vastly different from that of even 15 or 20 years ago. We have gone \" +\r\n \"where no man has gone before. We have stripped ourselves of the tyranny of flesh.<br><br>\" +\r\n \"The Singularity is here. The merging of man and machine. This is where humanity evolves into \" +\r\n \"something greater. This is our future<br><br>\" +\r\n \"Embrace it, and you will obey a new god. The God in the Machine\";\r\n Literatures[fn] = new Literature(title, fn, txt);\r\n\r\n title = \"The New Triads\";\r\n fn = \"new-triads.lit\";\r\n txt = \"The Triads were an ancient transnational crime syndicate based in China, Hong Kong, and other Asian \" +\r\n \"territories. They were often considered one of the first and biggest criminal secret societies. \" +\r\n \"While most of the branches of the Triads have been destroyed over the past few decades, the \" +\r\n \"crime faction has spawned and inspired a number of other Asian crime organizations over the past few years. \" +\r\n \"The most notable of these is the Tetrads.<br><br>\" +\r\n \"It is widely believed that the Tetrads are a rogue group that splintered off from the Triads sometime in the \" +\r\n \"mid 21st century. The founders of the Tetrads, all of whom were ex-Triad members, believed that the \" +\r\n \"Triads were losing their purpose and direction. The Tetrads started off as a small group that mainly engaged \" +\r\n \"in fraud and extortion. They were largely unknown until just a few years ago when they took over the illegal \" +\r\n \"drug trade in all of the major Asian cities. They quickly became the most powerful crime syndicate in the \" +\r\n \"continent.<br><br>\" +\r\n \"Not much else is known about the Tetrads, or about the efforts the Asian governments and corporations are making \" +\r\n \"to take down this large new crime organization. Many believe that the Tetrads have infiltrated the governments \" +\r\n \"and powerful corporations in Asia, which has helped faciliate their recent rapid rise.\";\r\n Literatures[fn] = new Literature(title, fn, txt);\r\n\r\n title = \"The Secret War\";\r\n fn = \"the-secret-war.lit\";\r\n txt = \"\"\r\n Literatures[fn] = new Literature(title, fn, txt);\r\n\r\n}\r\n\r\nexport {Literatures, initLiterature, showLiterature};\r\n","/* GameOptions.js */\r\n\r\n//Close box when clicking outside\r\n$(document).click(function(event) {\r\n if (gameOptionsOpened) {\r\n if ( $(event.target).closest(\".game-options-box\").get(0) == null ) {\r\n gameOptionsBoxClose();\r\n }\r\n }\r\n});\r\n\r\nvar gameOptionsOpened = false;\r\nfunction gameOptionsBoxInit() {\r\n //Menu link button\r\n document.getElementById(\"options-menu-link\").addEventListener(\"click\", function() {\r\n gameOptionsBoxOpen();\r\n return false;\r\n });\r\n\r\n //Close button\r\n var closeButton = document.getElementById(\"game-options-close-button\");\r\n closeButton.addEventListener(\"click\", function() {\r\n gameOptionsBoxClose();\r\n return false;\r\n });\r\n};\r\n\r\ndocument.addEventListener(\"DOMContentLoaded\", gameOptionsBoxInit, false);\r\n\r\nfunction gameOptionsBoxClose() {\r\n gameOptionsOpened = false;\r\n var box = document.getElementById(\"game-options-container\");\r\n box.style.display = \"none\";\r\n}\r\n\r\nfunction gameOptionsBoxOpen() {\r\n var box = document.getElementById(\"game-options-container\");\r\n box.style.display = \"block\";\r\n setTimeout(function() {\r\n gameOptionsOpened = true;\r\n }, 500);\r\n\r\n}\r\n\r\nexport {gameOptionsBoxOpen, gameOptionsBoxClose};\r\n","if (typeof Object.create === 'function') {\n // implementation from standard node.js 'util' module\n module.exports = function inherits(ctor, superCtor) {\n ctor.super_ = superCtor\n ctor.prototype = Object.create(superCtor.prototype, {\n constructor: {\n value: ctor,\n enumerable: false,\n writable: true,\n configurable: true\n }\n });\n };\n} else {\n // old school shim for old browsers\n module.exports = function inherits(ctor, superCtor) {\n ctor.super_ = superCtor\n var TempCtor = function () {}\n TempCtor.prototype = superCtor.prototype\n ctor.prototype = new TempCtor()\n ctor.prototype.constructor = ctor\n }\n}\n","'use strict';\n\nvar utils = require('./utils');\nvar support = require('./support');\nvar nodejsUtils = require('./nodejsUtils');\nvar GenericWorker = require('./stream/GenericWorker');\n\n/**\n * The following functions come from pako, from pako/lib/utils/strings\n * released under the MIT license, see pako https://github.com/nodeca/pako/\n */\n\n// Table with utf8 lengths (calculated by first byte of sequence)\n// Note, that 5 & 6-byte values and some 4-byte values can not be represented in JS,\n// because max possible codepoint is 0x10ffff\nvar _utf8len = new Array(256);\nfor (var i=0; i<256; i++) {\n _utf8len[i] = (i >= 252 ? 6 : i >= 248 ? 5 : i >= 240 ? 4 : i >= 224 ? 3 : i >= 192 ? 2 : 1);\n}\n_utf8len[254]=_utf8len[254]=1; // Invalid sequence start\n\n// convert string to array (typed, when possible)\nvar string2buf = function (str) {\n var buf, c, c2, m_pos, i, str_len = str.length, buf_len = 0;\n\n // count binary size\n for (m_pos = 0; m_pos < str_len; m_pos++) {\n c = str.charCodeAt(m_pos);\n if ((c & 0xfc00) === 0xd800 && (m_pos+1 < str_len)) {\n c2 = str.charCodeAt(m_pos+1);\n if ((c2 & 0xfc00) === 0xdc00) {\n c = 0x10000 + ((c - 0xd800) << 10) + (c2 - 0xdc00);\n m_pos++;\n }\n }\n buf_len += c < 0x80 ? 1 : c < 0x800 ? 2 : c < 0x10000 ? 3 : 4;\n }\n\n // allocate buffer\n if (support.uint8array) {\n buf = new Uint8Array(buf_len);\n } else {\n buf = new Array(buf_len);\n }\n\n // convert\n for (i=0, m_pos = 0; i < buf_len; m_pos++) {\n c = str.charCodeAt(m_pos);\n if ((c & 0xfc00) === 0xd800 && (m_pos+1 < str_len)) {\n c2 = str.charCodeAt(m_pos+1);\n if ((c2 & 0xfc00) === 0xdc00) {\n c = 0x10000 + ((c - 0xd800) << 10) + (c2 - 0xdc00);\n m_pos++;\n }\n }\n if (c < 0x80) {\n /* one byte */\n buf[i++] = c;\n } else if (c < 0x800) {\n /* two bytes */\n buf[i++] = 0xC0 | (c >>> 6);\n buf[i++] = 0x80 | (c & 0x3f);\n } else if (c < 0x10000) {\n /* three bytes */\n buf[i++] = 0xE0 | (c >>> 12);\n buf[i++] = 0x80 | (c >>> 6 & 0x3f);\n buf[i++] = 0x80 | (c & 0x3f);\n } else {\n /* four bytes */\n buf[i++] = 0xf0 | (c >>> 18);\n buf[i++] = 0x80 | (c >>> 12 & 0x3f);\n buf[i++] = 0x80 | (c >>> 6 & 0x3f);\n buf[i++] = 0x80 | (c & 0x3f);\n }\n }\n\n return buf;\n};\n\n// Calculate max possible position in utf8 buffer,\n// that will not break sequence. If that's not possible\n// - (very small limits) return max size as is.\n//\n// buf[] - utf8 bytes array\n// max - length limit (mandatory);\nvar utf8border = function(buf, max) {\n var pos;\n\n max = max || buf.length;\n if (max > buf.length) { max = buf.length; }\n\n // go back from last position, until start of sequence found\n pos = max-1;\n while (pos >= 0 && (buf[pos] & 0xC0) === 0x80) { pos--; }\n\n // Fuckup - very small and broken sequence,\n // return max, because we should return something anyway.\n if (pos < 0) { return max; }\n\n // If we came to start of buffer - that means vuffer is too small,\n // return max too.\n if (pos === 0) { return max; }\n\n return (pos + _utf8len[buf[pos]] > max) ? pos : max;\n};\n\n// convert array to string\nvar buf2string = function (buf) {\n var str, i, out, c, c_len;\n var len = buf.length;\n\n // Reserve max possible length (2 words per char)\n // NB: by unknown reasons, Array is significantly faster for\n // String.fromCharCode.apply than Uint16Array.\n var utf16buf = new Array(len*2);\n\n for (out=0, i=0; i<len;) {\n c = buf[i++];\n // quick process ascii\n if (c < 0x80) { utf16buf[out++] = c; continue; }\n\n c_len = _utf8len[c];\n // skip 5 & 6 byte codes\n if (c_len > 4) { utf16buf[out++] = 0xfffd; i += c_len-1; continue; }\n\n // apply mask on first byte\n c &= c_len === 2 ? 0x1f : c_len === 3 ? 0x0f : 0x07;\n // join the rest\n while (c_len > 1 && i < len) {\n c = (c << 6) | (buf[i++] & 0x3f);\n c_len--;\n }\n\n // terminated by end of string?\n if (c_len > 1) { utf16buf[out++] = 0xfffd; continue; }\n\n if (c < 0x10000) {\n utf16buf[out++] = c;\n } else {\n c -= 0x10000;\n utf16buf[out++] = 0xd800 | ((c >> 10) & 0x3ff);\n utf16buf[out++] = 0xdc00 | (c & 0x3ff);\n }\n }\n\n // shrinkBuf(utf16buf, out)\n if (utf16buf.length !== out) {\n if(utf16buf.subarray) {\n utf16buf = utf16buf.subarray(0, out);\n } else {\n utf16buf.length = out;\n }\n }\n\n // return String.fromCharCode.apply(null, utf16buf);\n return utils.applyFromCharCode(utf16buf);\n};\n\n\n// That's all for the pako functions.\n\n\n/**\n * Transform a javascript string into an array (typed if possible) of bytes,\n * UTF-8 encoded.\n * @param {String} str the string to encode\n * @return {Array|Uint8Array|Buffer} the UTF-8 encoded string.\n */\nexports.utf8encode = function utf8encode(str) {\n if (support.nodebuffer) {\n return nodejsUtils.newBufferFrom(str, \"utf-8\");\n }\n\n return string2buf(str);\n};\n\n\n/**\n * Transform a bytes array (or a representation) representing an UTF-8 encoded\n * string into a javascript string.\n * @param {Array|Uint8Array|Buffer} buf the data de decode\n * @return {String} the decoded string.\n */\nexports.utf8decode = function utf8decode(buf) {\n if (support.nodebuffer) {\n return utils.transformTo(\"nodebuffer\", buf).toString(\"utf-8\");\n }\n\n buf = utils.transformTo(support.uint8array ? \"uint8array\" : \"array\", buf);\n\n return buf2string(buf);\n};\n\n/**\n * A worker to decode utf8 encoded binary chunks into string chunks.\n * @constructor\n */\nfunction Utf8DecodeWorker() {\n GenericWorker.call(this, \"utf-8 decode\");\n // the last bytes if a chunk didn't end with a complete codepoint.\n this.leftOver = null;\n}\nutils.inherits(Utf8DecodeWorker, GenericWorker);\n\n/**\n * @see GenericWorker.processChunk\n */\nUtf8DecodeWorker.prototype.processChunk = function (chunk) {\n\n var data = utils.transformTo(support.uint8array ? \"uint8array\" : \"array\", chunk.data);\n\n // 1st step, re-use what's left of the previous chunk\n if (this.leftOver && this.leftOver.length) {\n if(support.uint8array) {\n var previousData = data;\n data = new Uint8Array(previousData.length + this.leftOver.length);\n data.set(this.leftOver, 0);\n data.set(previousData, this.leftOver.length);\n } else {\n data = this.leftOver.concat(data);\n }\n this.leftOver = null;\n }\n\n var nextBoundary = utf8border(data);\n var usableData = data;\n if (nextBoundary !== data.length) {\n if (support.uint8array) {\n usableData = data.subarray(0, nextBoundary);\n this.leftOver = data.subarray(nextBoundary, data.length);\n } else {\n usableData = data.slice(0, nextBoundary);\n this.leftOver = data.slice(nextBoundary, data.length);\n }\n }\n\n this.push({\n data : exports.utf8decode(usableData),\n meta : chunk.meta\n });\n};\n\n/**\n * @see GenericWorker.flush\n */\nUtf8DecodeWorker.prototype.flush = function () {\n if(this.leftOver && this.leftOver.length) {\n this.push({\n data : exports.utf8decode(this.leftOver),\n meta : {}\n });\n this.leftOver = null;\n }\n};\nexports.Utf8DecodeWorker = Utf8DecodeWorker;\n\n/**\n * A worker to endcode string chunks into utf8 encoded binary chunks.\n * @constructor\n */\nfunction Utf8EncodeWorker() {\n GenericWorker.call(this, \"utf-8 encode\");\n}\nutils.inherits(Utf8EncodeWorker, GenericWorker);\n\n/**\n * @see GenericWorker.processChunk\n */\nUtf8EncodeWorker.prototype.processChunk = function (chunk) {\n this.push({\n data : exports.utf8encode(chunk.data),\n meta : chunk.meta\n });\n};\nexports.Utf8EncodeWorker = Utf8EncodeWorker;\n","import {deleteActiveScriptsItem} from \"./ActiveScriptsUI.js\";\r\nimport {Augmentations, augmentationExists,\r\n initAugmentations, AugmentationNames} from \"./Augmentations.js\";\r\nimport {initBitNodeMultipliers} from \"./BitNode.js\";\r\nimport {Bladeburner} from \"./Bladeburner.js\";\r\nimport {writeCinematicText} from \"./CinematicText.js\";\r\nimport {Companies, Company, initCompanies} from \"./Company.js\";\r\nimport {Programs} from \"./CreateProgram.js\";\r\nimport {Engine} from \"./engine.js\";\r\nimport {Factions, Faction, initFactions,\r\n joinFaction} from \"./Faction.js\";\r\nimport {deleteGangDisplayContent} from \"./Gang.js\";\r\nimport {Locations} from \"./Location.js\";\r\nimport {initMessages, Messages, Message} from \"./Message.js\";\r\nimport {initSingularitySFFlags, hasWallStreetSF}from \"./NetscriptFunctions.js\";\r\nimport {WorkerScript, workerScripts,\r\n prestigeWorkerScripts} from \"./NetscriptWorker.js\";\r\nimport {Player} from \"./Player.js\";\r\n\r\nimport {AllServers, AddToAllServers,\r\n initForeignServers, Server,\r\n prestigeAllServers,\r\n prestigeHomeComputer} from \"./Server.js\";\r\nimport {SpecialServerIps, SpecialServerIpsMap,\r\n prestigeSpecialServerIps,\r\n SpecialServerNames} from \"./SpecialServerIps.js\";\r\nimport {initStockMarket, initSymbolToStockMap,\r\n stockMarketContentCreated,\r\n setStockMarketContentCreated} from \"./StockMarket.js\";\r\nimport {Terminal, postNetburnerText} from \"./Terminal.js\";\r\nimport Decimal from \"decimal.js\";\r\nimport {dialogBoxCreate} from \"../utils/DialogBox.js\";\r\nimport {createPopup, createElement,\r\n removeElementById, exceptionAlert} from \"../utils/HelperFunctions.js\";\r\nimport {yesNoBoxCreate, yesNoBoxGetYesButton,\r\n yesNoBoxGetNoButton, yesNoBoxClose} from \"../utils/YesNoBox.js\";\r\n\r\nlet BitNode8StartingMoney = 250e6;\r\n\r\n//Prestige by purchasing augmentation\r\nfunction prestigeAugmentation() {\r\n initBitNodeMultipliers();\r\n\r\n Player.prestigeAugmentation();\r\n\r\n //Delete all Worker Scripts objects\r\n prestigeWorkerScripts();\r\n\r\n var homeComp = Player.getHomeComputer();\r\n //Delete all servers except home computer\r\n prestigeAllServers();\r\n\r\n //Delete Special Server IPs\r\n prestigeSpecialServerIps(); //Must be done before initForeignServers()\r\n\r\n //Reset home computer (only the programs) and add to AllServers\r\n AddToAllServers(homeComp);\r\n prestigeHomeComputer(homeComp);\r\n\r\n if (augmentationExists(AugmentationNames.Neurolink) &&\r\n Augmentations[AugmentationNames.Neurolink].owned) {\r\n homeComp.programs.push(Programs.FTPCrackProgram);\r\n homeComp.programs.push(Programs.RelaySMTPProgram);\r\n }\r\n if (augmentationExists(AugmentationNames.CashRoot) &&\r\n Augmentations[AugmentationNames.CashRoot].owned) {\r\n Player.setMoney(new Decimal(1000000));\r\n homeComp.programs.push(Programs.BruteSSHProgram);\r\n }\r\n\r\n //Re-create foreign servers\r\n initForeignServers();\r\n\r\n //Darkweb is purchase-able\r\n document.getElementById(\"location-purchase-tor\").setAttribute(\"class\", \"a-link-button\");\r\n\r\n //Gain favor for Companies\r\n for (var member in Companies) {\r\n if (Companies.hasOwnProperty(member)) {\r\n Companies[member].gainFavor();\r\n }\r\n }\r\n\r\n //Gain favor for factions\r\n for (var member in Factions) {\r\n if (Factions.hasOwnProperty(member)) {\r\n Factions[member].gainFavor();\r\n }\r\n }\r\n\r\n //Stop a Terminal action if there is onerror\r\n if (Engine._actionInProgress) {\r\n Engine._actionInProgress = false;\r\n Terminal.finishAction(true);\r\n }\r\n\r\n //Re-initialize things - This will update any changes\r\n initFactions(); //Factions must be initialized before augmentations\r\n initAugmentations(); //Calls reapplyAllAugmentations() and resets Player multipliers\r\n Player.reapplyAllSourceFiles();\r\n initCompanies();\r\n\r\n //Clear terminal\r\n $(\"#terminal tr:not(:last)\").remove();\r\n postNetburnerText();\r\n\r\n //Messages\r\n initMessages();\r\n\r\n //Reset Stock market\r\n if (Player.hasWseAccount) {\r\n initStockMarket();\r\n initSymbolToStockMap();\r\n }\r\n setStockMarketContentCreated(false);\r\n var stockMarketList = document.getElementById(\"stock-market-list\");\r\n while(stockMarketList.firstChild) {\r\n stockMarketList.removeChild(stockMarketList.firstChild);\r\n }\r\n\r\n //Gang, in BitNode 2\r\n if (Player.bitNodeN == 2 && Player.inGang()) {\r\n var faction = Factions[Player.gang.facName];\r\n if (faction instanceof Faction) {\r\n joinFaction(faction);\r\n }\r\n }\r\n\r\n //Cancel Bladeburner action\r\n if (Player.bladeburner instanceof Bladeburner) {\r\n Player.bladeburner.resetAction();\r\n }\r\n\r\n //BitNode 8: Ghost of Wall Street\r\n if (Player.bitNodeN === 8) {Player.money = new Decimal(BitNode8StartingMoney);}\r\n if (Player.bitNodeN === 8 || hasWallStreetSF) {\r\n Player.hasWseAccount = true;\r\n Player.hasTixApiAccess = true;\r\n }\r\n\r\n var mainMenu = document.getElementById(\"mainmenu-container\");\r\n mainMenu.style.visibility = \"visible\";\r\n Terminal.resetTerminalInput();\r\n Engine.loadTerminalContent();\r\n\r\n //Red Pill\r\n if (augmentationExists(AugmentationNames.TheRedPill) &&\r\n Augmentations[AugmentationNames.TheRedPill].owned) {\r\n var WorldDaemon = AllServers[SpecialServerIps[SpecialServerNames.WorldDaemon]];\r\n var DaedalusServer = AllServers[SpecialServerIps[SpecialServerNames.DaedalusServer]];\r\n if (WorldDaemon && DaedalusServer) {\r\n WorldDaemon.serversOnNetwork.push(DaedalusServer.ip);\r\n DaedalusServer.serversOnNetwork.push(WorldDaemon.ip);\r\n }\r\n }\r\n}\r\n\r\n\r\n//Prestige by destroying Bit Node and gaining a Source File\r\nfunction prestigeSourceFile() {\r\n initBitNodeMultipliers();\r\n\r\n Player.prestigeSourceFile();\r\n prestigeWorkerScripts(); //Delete all Worker Scripts objects\r\n\r\n var homeComp = Player.getHomeComputer();\r\n\r\n //Delete all servers except home computer\r\n prestigeAllServers(); //Must be done before initForeignServers()\r\n\r\n //Delete Special Server IPs\r\n prestigeSpecialServerIps();\r\n\r\n //Reset home computer (only the programs) and add to AllServers\r\n AddToAllServers(homeComp);\r\n prestigeHomeComputer(homeComp);\r\n\r\n //Re-create foreign servers\r\n initForeignServers();\r\n\r\n var srcFile1Owned = false;\r\n for (var i = 0; i < Player.sourceFiles.length; ++i) {\r\n if (Player.sourceFiles[i].n == 1) {\r\n srcFile1Owned = true;\r\n }\r\n }\r\n if (srcFile1Owned) {\r\n homeComp.setMaxRam(32);\r\n } else {\r\n homeComp.setMaxRam(8);\r\n }\r\n homeComp.cpuCores = 1;\r\n\r\n //Darkweb is purchase-able\r\n document.getElementById(\"location-purchase-tor\").setAttribute(\"class\", \"a-link-button\");\r\n\r\n //Reset favor for Companies\r\n for (var member in Companies) {\r\n if (Companies.hasOwnProperty(member)) {\r\n Companies[member].favor = 0;\r\n }\r\n }\r\n\r\n //Reset favor for factions\r\n for (var member in Factions) {\r\n if (Factions.hasOwnProperty(member)) {\r\n Factions[member].favor = 0;\r\n }\r\n }\r\n\r\n //Stop a Terminal action if there is one\r\n if (Engine._actionInProgress) {\r\n Engine._actionInProgress = false;\r\n Terminal.finishAction(true);\r\n }\r\n\r\n //Delete all Augmentations\r\n for (var name in Augmentations) {\r\n if (Augmentations.hasOwnProperty(name)) {\r\n delete Augmentations[name];\r\n }\r\n }\r\n\r\n //Re-initialize things - This will update any changes\r\n initFactions(); //Factions must be initialized before augmentations\r\n initAugmentations(); //Calls reapplyAllAugmentations() and resets Player multipliers\r\n Player.reapplyAllSourceFiles();\r\n initCompanies();\r\n\r\n //Clear terminal\r\n $(\"#terminal tr:not(:last)\").remove();\r\n postNetburnerText();\r\n\r\n //Messages\r\n initMessages();\r\n\r\n var mainMenu = document.getElementById(\"mainmenu-container\");\r\n mainMenu.style.visibility = \"visible\";\r\n Terminal.resetTerminalInput();\r\n Engine.loadTerminalContent();\r\n\r\n //Reinitialize Bit Node flags\r\n initSingularitySFFlags();\r\n\r\n //Reset Stock market, gang, and corporation\r\n if (Player.hasWseAccount) {\r\n initStockMarket();\r\n initSymbolToStockMap();\r\n }\r\n setStockMarketContentCreated(false);\r\n var stockMarketList = document.getElementById(\"stock-market-list\");\r\n while(stockMarketList.firstChild) {\r\n stockMarketList.removeChild(stockMarketList.firstChild);\r\n }\r\n\r\n Player.gang = null;\r\n deleteGangDisplayContent();\r\n Player.corporation = null;\r\n Player.bladeburner = null;\r\n\r\n //BitNode 3: Corporatocracy\r\n if (Player.bitNodeN === 3) {\r\n Player.money = new Decimal(150e9);\r\n homeComp.messages.push(\"corporation-management-handbook.lit\");\r\n dialogBoxCreate(\"You received a copy of the Corporation Management Handbook on your home computer. \" +\r\n \"Read it if you need help getting started with Corporations!\");\r\n }\r\n\r\n //BitNode 6: Bladeburner\r\n if (Player.bitNodeN === 6) {\r\n var cinematicText = [\"In the middle of the 21st century, OmniTek Incorporated advanced robot evolution \" +\r\n \"with their Synthoids (synthetic androids), a being virtually identical to a human.\",\r\n \"------\",\r\n \"Their sixth-generation Synthoids, called MK-VI, were stronger, faster, and more \" +\r\n \"intelligent than humans. Many argued that the MK-VI Synthoids were the first \" +\r\n \"example of sentient AI.\",\r\n \"------\",\r\n \"Unfortunately, in 2070 a terrorist group called Ascendis Totalis hacked into OmniTek and \" +\r\n \"uploaded a rogue AI into their Synthoid manufacturing facilities.\",\r\n \"------\",\r\n \"The MK-VI Synthoids infected by the rogue AI turned hostile toward humanity, initiating \" +\r\n \"the deadliest conflict in human history. This dark chapter is now known as the Synthoid Uprising.\",\r\n \"------\",\r\n \"In the aftermath of the Uprising, further manufacturing of Synthoids with advanced AI \" +\r\n \"was banned. MK-VI Synthoids that did not have the rogue Ascendis Totalis AI were \" +\r\n \"allowed to continue their existence.\",\r\n \"------\",\r\n \"The intelligence community believes that not all of the rogue MK-VI Synthoids from the Uprising were \" +\r\n \"found and destroyed, and that many of them are blending in as normal humans in society today. \" +\r\n \"As a result, many nations have created Bladeburner divisions, special units that are tasked with \" +\r\n \"investigating and dealing with Synthoid threats.\"];\r\n writeCinematicText(cinematicText).then(function() {\r\n var popupId = \"bladeburner-bitnode-start-nsa-notification\";\r\n var txt = createElement(\"p\", {\r\n innerText:\"Visit the National Security Agency (NSA) to apply for their Bladeburner \" +\r\n \"division! You will need 100 of each combat stat before doing this.\"\r\n })\r\n var brEl = createElement(\"br\");\r\n var okBtn = createElement(\"a\", {\r\n class:\"a-link-button\", innerText:\"Got it!\", padding:\"8px\",\r\n clickListener:()=>{\r\n removeElementById(popupId);\r\n return false;\r\n }\r\n });\r\n createPopup(popupId, [txt, brEl, okBtn]);\r\n }).catch(function(e) {\r\n exceptionAlert(e);\r\n })\r\n\r\n }\r\n\r\n //BitNode 8: Ghost of Wall Street\r\n if (Player.bitNodeN === 8) {Player.money = new Decimal(BitNode8StartingMoney);}\r\n if (Player.bitNodeN === 8 || hasWallStreetSF) {\r\n Player.hasWseAccount = true;\r\n Player.hasTixApiAccess = true;\r\n }\r\n\r\n //Gain int exp\r\n Player.gainIntelligenceExp(5);\r\n}\r\n\r\nexport {prestigeAugmentation, prestigeSourceFile};\r\n","/* global Promise */\n'use strict';\n\n// load the global object first:\n// - it should be better integrated in the system (unhandledRejection in node)\n// - the environment may have a custom Promise implementation (see zone.js)\nvar ES6Promise = null;\nif (typeof Promise !== \"undefined\") {\n ES6Promise = Promise;\n} else {\n ES6Promise = require(\"lie\");\n}\n\n/**\n * Let the user use/change some implementations.\n */\nmodule.exports = {\n Promise: ES6Promise\n};\n","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n// NOTE: These type checking functions intentionally don't use `instanceof`\n// because it is fragile and can be easily faked with `Object.create()`.\n\nfunction isArray(arg) {\n if (Array.isArray) {\n return Array.isArray(arg);\n }\n return objectToString(arg) === '[object Array]';\n}\nexports.isArray = isArray;\n\nfunction isBoolean(arg) {\n return typeof arg === 'boolean';\n}\nexports.isBoolean = isBoolean;\n\nfunction isNull(arg) {\n return arg === null;\n}\nexports.isNull = isNull;\n\nfunction isNullOrUndefined(arg) {\n return arg == null;\n}\nexports.isNullOrUndefined = isNullOrUndefined;\n\nfunction isNumber(arg) {\n return typeof arg === 'number';\n}\nexports.isNumber = isNumber;\n\nfunction isString(arg) {\n return typeof arg === 'string';\n}\nexports.isString = isString;\n\nfunction isSymbol(arg) {\n return typeof arg === 'symbol';\n}\nexports.isSymbol = isSymbol;\n\nfunction isUndefined(arg) {\n return arg === void 0;\n}\nexports.isUndefined = isUndefined;\n\nfunction isRegExp(re) {\n return objectToString(re) === '[object RegExp]';\n}\nexports.isRegExp = isRegExp;\n\nfunction isObject(arg) {\n return typeof arg === 'object' && arg !== null;\n}\nexports.isObject = isObject;\n\nfunction isDate(d) {\n return objectToString(d) === '[object Date]';\n}\nexports.isDate = isDate;\n\nfunction isError(e) {\n return (objectToString(e) === '[object Error]' || e instanceof Error);\n}\nexports.isError = isError;\n\nfunction isFunction(arg) {\n return typeof arg === 'function';\n}\nexports.isFunction = isFunction;\n\nfunction isPrimitive(arg) {\n return arg === null ||\n typeof arg === 'boolean' ||\n typeof arg === 'number' ||\n typeof arg === 'string' ||\n typeof arg === 'symbol' || // ES6 symbol\n typeof arg === 'undefined';\n}\nexports.isPrimitive = isPrimitive;\n\nexports.isBuffer = Buffer.isBuffer;\n\nfunction objectToString(o) {\n return Object.prototype.toString.call(o);\n}\n","// shim for using process in browser\nvar process = module.exports = {};\n\n// cached from whatever global is present so that test runners that stub it\n// don't break things. But we need to wrap it in a try catch in case it is\n// wrapped in strict mode code which doesn't define any globals. It's inside a\n// function because try/catches deoptimize in certain engines.\n\nvar cachedSetTimeout;\nvar cachedClearTimeout;\n\nfunction defaultSetTimout() {\n throw new Error('setTimeout has not been defined');\n}\nfunction defaultClearTimeout () {\n throw new Error('clearTimeout has not been defined');\n}\n(function () {\n try {\n if (typeof setTimeout === 'function') {\n cachedSetTimeout = setTimeout;\n } else {\n cachedSetTimeout = defaultSetTimout;\n }\n } catch (e) {\n cachedSetTimeout = defaultSetTimout;\n }\n try {\n if (typeof clearTimeout === 'function') {\n cachedClearTimeout = clearTimeout;\n } else {\n cachedClearTimeout = defaultClearTimeout;\n }\n } catch (e) {\n cachedClearTimeout = defaultClearTimeout;\n }\n} ())\nfunction runTimeout(fun) {\n if (cachedSetTimeout === setTimeout) {\n //normal enviroments in sane situations\n return setTimeout(fun, 0);\n }\n // if setTimeout wasn't available but was latter defined\n if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {\n cachedSetTimeout = setTimeout;\n return setTimeout(fun, 0);\n }\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedSetTimeout(fun, 0);\n } catch(e){\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n return cachedSetTimeout.call(null, fun, 0);\n } catch(e){\n // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error\n return cachedSetTimeout.call(this, fun, 0);\n }\n }\n\n\n}\nfunction runClearTimeout(marker) {\n if (cachedClearTimeout === clearTimeout) {\n //normal enviroments in sane situations\n return clearTimeout(marker);\n }\n // if clearTimeout wasn't available but was latter defined\n if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {\n cachedClearTimeout = clearTimeout;\n return clearTimeout(marker);\n }\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedClearTimeout(marker);\n } catch (e){\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n return cachedClearTimeout.call(null, marker);\n } catch (e){\n // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.\n // Some versions of I.E. have different rules for clearTimeout vs setTimeout\n return cachedClearTimeout.call(this, marker);\n }\n }\n\n\n\n}\nvar queue = [];\nvar draining = false;\nvar currentQueue;\nvar queueIndex = -1;\n\nfunction cleanUpNextTick() {\n if (!draining || !currentQueue) {\n return;\n }\n draining = false;\n if (currentQueue.length) {\n queue = currentQueue.concat(queue);\n } else {\n queueIndex = -1;\n }\n if (queue.length) {\n drainQueue();\n }\n}\n\nfunction drainQueue() {\n if (draining) {\n return;\n }\n var timeout = runTimeout(cleanUpNextTick);\n draining = true;\n\n var len = queue.length;\n while(len) {\n currentQueue = queue;\n queue = [];\n while (++queueIndex < len) {\n if (currentQueue) {\n currentQueue[queueIndex].run();\n }\n }\n queueIndex = -1;\n len = queue.length;\n }\n currentQueue = null;\n draining = false;\n runClearTimeout(timeout);\n}\n\nprocess.nextTick = function (fun) {\n var args = new Array(arguments.length - 1);\n if (arguments.length > 1) {\n for (var i = 1; i < arguments.length; i++) {\n args[i - 1] = arguments[i];\n }\n }\n queue.push(new Item(fun, args));\n if (queue.length === 1 && !draining) {\n runTimeout(drainQueue);\n }\n};\n\n// v8 likes predictible objects\nfunction Item(fun, array) {\n this.fun = fun;\n this.array = array;\n}\nItem.prototype.run = function () {\n this.fun.apply(null, this.array);\n};\nprocess.title = 'browser';\nprocess.browser = true;\nprocess.env = {};\nprocess.argv = [];\nprocess.version = ''; // empty string to avoid regexp issues\nprocess.versions = {};\n\nfunction noop() {}\n\nprocess.on = noop;\nprocess.addListener = noop;\nprocess.once = noop;\nprocess.off = noop;\nprocess.removeListener = noop;\nprocess.removeAllListeners = noop;\nprocess.emit = noop;\nprocess.prependListener = noop;\nprocess.prependOnceListener = noop;\n\nprocess.listeners = function (name) { return [] }\n\nprocess.binding = function (name) {\n throw new Error('process.binding is not supported');\n};\n\nprocess.cwd = function () { return '/' };\nprocess.chdir = function (dir) {\n throw new Error('process.chdir is not supported');\n};\nprocess.umask = function() { return 0; };\n","/*!\n * The buffer module from node.js, for the browser.\n *\n * @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>\n * @license MIT\n */\n/* eslint-disable no-proto */\n\n'use strict'\n\nvar base64 = require('base64-js')\nvar ieee754 = require('ieee754')\nvar isArray = require('isarray')\n\nexports.Buffer = Buffer\nexports.SlowBuffer = SlowBuffer\nexports.INSPECT_MAX_BYTES = 50\n\n/**\n * If `Buffer.TYPED_ARRAY_SUPPORT`:\n * === true Use Uint8Array implementation (fastest)\n * === false Use Object implementation (most compatible, even IE6)\n *\n * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,\n * Opera 11.6+, iOS 4.2+.\n *\n * Due to various browser bugs, sometimes the Object implementation will be used even\n * when the browser supports typed arrays.\n *\n * Note:\n *\n * - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances,\n * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.\n *\n * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.\n *\n * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of\n * incorrect length in some situations.\n\n * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they\n * get the Object implementation, which is slower but behaves correctly.\n */\nBuffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined\n ? global.TYPED_ARRAY_SUPPORT\n : typedArraySupport()\n\n/*\n * Export kMaxLength after typed array support is determined.\n */\nexports.kMaxLength = kMaxLength()\n\nfunction typedArraySupport () {\n try {\n var arr = new Uint8Array(1)\n arr.__proto__ = {__proto__: Uint8Array.prototype, foo: function () { return 42 }}\n return arr.foo() === 42 && // typed array instances can be augmented\n typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray`\n arr.subarray(1, 1).byteLength === 0 // ie10 has broken `subarray`\n } catch (e) {\n return false\n }\n}\n\nfunction kMaxLength () {\n return Buffer.TYPED_ARRAY_SUPPORT\n ? 0x7fffffff\n : 0x3fffffff\n}\n\nfunction createBuffer (that, length) {\n if (kMaxLength() < length) {\n throw new RangeError('Invalid typed array length')\n }\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n // Return an augmented `Uint8Array` instance, for best performance\n that = new Uint8Array(length)\n that.__proto__ = Buffer.prototype\n } else {\n // Fallback: Return an object instance of the Buffer class\n if (that === null) {\n that = new Buffer(length)\n }\n that.length = length\n }\n\n return that\n}\n\n/**\n * The Buffer constructor returns instances of `Uint8Array` that have their\n * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of\n * `Uint8Array`, so the returned instances will have all the node `Buffer` methods\n * and the `Uint8Array` methods. Square bracket notation works as expected -- it\n * returns a single octet.\n *\n * The `Uint8Array` prototype remains unmodified.\n */\n\nfunction Buffer (arg, encodingOrOffset, length) {\n if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {\n return new Buffer(arg, encodingOrOffset, length)\n }\n\n // Common case.\n if (typeof arg === 'number') {\n if (typeof encodingOrOffset === 'string') {\n throw new Error(\n 'If encoding is specified then the first argument must be a string'\n )\n }\n return allocUnsafe(this, arg)\n }\n return from(this, arg, encodingOrOffset, length)\n}\n\nBuffer.poolSize = 8192 // not used by this implementation\n\n// TODO: Legacy, not needed anymore. Remove in next major version.\nBuffer._augment = function (arr) {\n arr.__proto__ = Buffer.prototype\n return arr\n}\n\nfunction from (that, value, encodingOrOffset, length) {\n if (typeof value === 'number') {\n throw new TypeError('\"value\" argument must not be a number')\n }\n\n if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) {\n return fromArrayBuffer(that, value, encodingOrOffset, length)\n }\n\n if (typeof value === 'string') {\n return fromString(that, value, encodingOrOffset)\n }\n\n return fromObject(that, value)\n}\n\n/**\n * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError\n * if value is a number.\n * Buffer.from(str[, encoding])\n * Buffer.from(array)\n * Buffer.from(buffer)\n * Buffer.from(arrayBuffer[, byteOffset[, length]])\n **/\nBuffer.from = function (value, encodingOrOffset, length) {\n return from(null, value, encodingOrOffset, length)\n}\n\nif (Buffer.TYPED_ARRAY_SUPPORT) {\n Buffer.prototype.__proto__ = Uint8Array.prototype\n Buffer.__proto__ = Uint8Array\n if (typeof Symbol !== 'undefined' && Symbol.species &&\n Buffer[Symbol.species] === Buffer) {\n // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97\n Object.defineProperty(Buffer, Symbol.species, {\n value: null,\n configurable: true\n })\n }\n}\n\nfunction assertSize (size) {\n if (typeof size !== 'number') {\n throw new TypeError('\"size\" argument must be a number')\n } else if (size < 0) {\n throw new RangeError('\"size\" argument must not be negative')\n }\n}\n\nfunction alloc (that, size, fill, encoding) {\n assertSize(size)\n if (size <= 0) {\n return createBuffer(that, size)\n }\n if (fill !== undefined) {\n // Only pay attention to encoding if it's a string. This\n // prevents accidentally sending in a number that would\n // be interpretted as a start offset.\n return typeof encoding === 'string'\n ? createBuffer(that, size).fill(fill, encoding)\n : createBuffer(that, size).fill(fill)\n }\n return createBuffer(that, size)\n}\n\n/**\n * Creates a new filled Buffer instance.\n * alloc(size[, fill[, encoding]])\n **/\nBuffer.alloc = function (size, fill, encoding) {\n return alloc(null, size, fill, encoding)\n}\n\nfunction allocUnsafe (that, size) {\n assertSize(size)\n that = createBuffer(that, size < 0 ? 0 : checked(size) | 0)\n if (!Buffer.TYPED_ARRAY_SUPPORT) {\n for (var i = 0; i < size; ++i) {\n that[i] = 0\n }\n }\n return that\n}\n\n/**\n * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.\n * */\nBuffer.allocUnsafe = function (size) {\n return allocUnsafe(null, size)\n}\n/**\n * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.\n */\nBuffer.allocUnsafeSlow = function (size) {\n return allocUnsafe(null, size)\n}\n\nfunction fromString (that, string, encoding) {\n if (typeof encoding !== 'string' || encoding === '') {\n encoding = 'utf8'\n }\n\n if (!Buffer.isEncoding(encoding)) {\n throw new TypeError('\"encoding\" must be a valid string encoding')\n }\n\n var length = byteLength(string, encoding) | 0\n that = createBuffer(that, length)\n\n var actual = that.write(string, encoding)\n\n if (actual !== length) {\n // Writing a hex string, for example, that contains invalid characters will\n // cause everything after the first invalid character to be ignored. (e.g.\n // 'abxxcd' will be treated as 'ab')\n that = that.slice(0, actual)\n }\n\n return that\n}\n\nfunction fromArrayLike (that, array) {\n var length = array.length < 0 ? 0 : checked(array.length) | 0\n that = createBuffer(that, length)\n for (var i = 0; i < length; i += 1) {\n that[i] = array[i] & 255\n }\n return that\n}\n\nfunction fromArrayBuffer (that, array, byteOffset, length) {\n array.byteLength // this throws if `array` is not a valid ArrayBuffer\n\n if (byteOffset < 0 || array.byteLength < byteOffset) {\n throw new RangeError('\\'offset\\' is out of bounds')\n }\n\n if (array.byteLength < byteOffset + (length || 0)) {\n throw new RangeError('\\'length\\' is out of bounds')\n }\n\n if (byteOffset === undefined && length === undefined) {\n array = new Uint8Array(array)\n } else if (length === undefined) {\n array = new Uint8Array(array, byteOffset)\n } else {\n array = new Uint8Array(array, byteOffset, length)\n }\n\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n // Return an augmented `Uint8Array` instance, for best performance\n that = array\n that.__proto__ = Buffer.prototype\n } else {\n // Fallback: Return an object instance of the Buffer class\n that = fromArrayLike(that, array)\n }\n return that\n}\n\nfunction fromObject (that, obj) {\n if (Buffer.isBuffer(obj)) {\n var len = checked(obj.length) | 0\n that = createBuffer(that, len)\n\n if (that.length === 0) {\n return that\n }\n\n obj.copy(that, 0, 0, len)\n return that\n }\n\n if (obj) {\n if ((typeof ArrayBuffer !== 'undefined' &&\n obj.buffer instanceof ArrayBuffer) || 'length' in obj) {\n if (typeof obj.length !== 'number' || isnan(obj.length)) {\n return createBuffer(that, 0)\n }\n return fromArrayLike(that, obj)\n }\n\n if (obj.type === 'Buffer' && isArray(obj.data)) {\n return fromArrayLike(that, obj.data)\n }\n }\n\n throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.')\n}\n\nfunction checked (length) {\n // Note: cannot use `length < kMaxLength()` here because that fails when\n // length is NaN (which is otherwise coerced to zero.)\n if (length >= kMaxLength()) {\n throw new RangeError('Attempt to allocate Buffer larger than maximum ' +\n 'size: 0x' + kMaxLength().toString(16) + ' bytes')\n }\n return length | 0\n}\n\nfunction SlowBuffer (length) {\n if (+length != length) { // eslint-disable-line eqeqeq\n length = 0\n }\n return Buffer.alloc(+length)\n}\n\nBuffer.isBuffer = function isBuffer (b) {\n return !!(b != null && b._isBuffer)\n}\n\nBuffer.compare = function compare (a, b) {\n if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {\n throw new TypeError('Arguments must be Buffers')\n }\n\n if (a === b) return 0\n\n var x = a.length\n var y = b.length\n\n for (var i = 0, len = Math.min(x, y); i < len; ++i) {\n if (a[i] !== b[i]) {\n x = a[i]\n y = b[i]\n break\n }\n }\n\n if (x < y) return -1\n if (y < x) return 1\n return 0\n}\n\nBuffer.isEncoding = function isEncoding (encoding) {\n switch (String(encoding).toLowerCase()) {\n case 'hex':\n case 'utf8':\n case 'utf-8':\n case 'ascii':\n case 'latin1':\n case 'binary':\n case 'base64':\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return true\n default:\n return false\n }\n}\n\nBuffer.concat = function concat (list, length) {\n if (!isArray(list)) {\n throw new TypeError('\"list\" argument must be an Array of Buffers')\n }\n\n if (list.length === 0) {\n return Buffer.alloc(0)\n }\n\n var i\n if (length === undefined) {\n length = 0\n for (i = 0; i < list.length; ++i) {\n length += list[i].length\n }\n }\n\n var buffer = Buffer.allocUnsafe(length)\n var pos = 0\n for (i = 0; i < list.length; ++i) {\n var buf = list[i]\n if (!Buffer.isBuffer(buf)) {\n throw new TypeError('\"list\" argument must be an Array of Buffers')\n }\n buf.copy(buffer, pos)\n pos += buf.length\n }\n return buffer\n}\n\nfunction byteLength (string, encoding) {\n if (Buffer.isBuffer(string)) {\n return string.length\n }\n if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' &&\n (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) {\n return string.byteLength\n }\n if (typeof string !== 'string') {\n string = '' + string\n }\n\n var len = string.length\n if (len === 0) return 0\n\n // Use a for loop to avoid recursion\n var loweredCase = false\n for (;;) {\n switch (encoding) {\n case 'ascii':\n case 'latin1':\n case 'binary':\n return len\n case 'utf8':\n case 'utf-8':\n case undefined:\n return utf8ToBytes(string).length\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return len * 2\n case 'hex':\n return len >>> 1\n case 'base64':\n return base64ToBytes(string).length\n default:\n if (loweredCase) return utf8ToBytes(string).length // assume utf8\n encoding = ('' + encoding).toLowerCase()\n loweredCase = true\n }\n }\n}\nBuffer.byteLength = byteLength\n\nfunction slowToString (encoding, start, end) {\n var loweredCase = false\n\n // No need to verify that \"this.length <= MAX_UINT32\" since it's a read-only\n // property of a typed array.\n\n // This behaves neither like String nor Uint8Array in that we set start/end\n // to their upper/lower bounds if the value passed is out of range.\n // undefined is handled specially as per ECMA-262 6th Edition,\n // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.\n if (start === undefined || start < 0) {\n start = 0\n }\n // Return early if start > this.length. Done here to prevent potential uint32\n // coercion fail below.\n if (start > this.length) {\n return ''\n }\n\n if (end === undefined || end > this.length) {\n end = this.length\n }\n\n if (end <= 0) {\n return ''\n }\n\n // Force coersion to uint32. This will also coerce falsey/NaN values to 0.\n end >>>= 0\n start >>>= 0\n\n if (end <= start) {\n return ''\n }\n\n if (!encoding) encoding = 'utf8'\n\n while (true) {\n switch (encoding) {\n case 'hex':\n return hexSlice(this, start, end)\n\n case 'utf8':\n case 'utf-8':\n return utf8Slice(this, start, end)\n\n case 'ascii':\n return asciiSlice(this, start, end)\n\n case 'latin1':\n case 'binary':\n return latin1Slice(this, start, end)\n\n case 'base64':\n return base64Slice(this, start, end)\n\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return utf16leSlice(this, start, end)\n\n default:\n if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)\n encoding = (encoding + '').toLowerCase()\n loweredCase = true\n }\n }\n}\n\n// The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect\n// Buffer instances.\nBuffer.prototype._isBuffer = true\n\nfunction swap (b, n, m) {\n var i = b[n]\n b[n] = b[m]\n b[m] = i\n}\n\nBuffer.prototype.swap16 = function swap16 () {\n var len = this.length\n if (len % 2 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 16-bits')\n }\n for (var i = 0; i < len; i += 2) {\n swap(this, i, i + 1)\n }\n return this\n}\n\nBuffer.prototype.swap32 = function swap32 () {\n var len = this.length\n if (len % 4 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 32-bits')\n }\n for (var i = 0; i < len; i += 4) {\n swap(this, i, i + 3)\n swap(this, i + 1, i + 2)\n }\n return this\n}\n\nBuffer.prototype.swap64 = function swap64 () {\n var len = this.length\n if (len % 8 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 64-bits')\n }\n for (var i = 0; i < len; i += 8) {\n swap(this, i, i + 7)\n swap(this, i + 1, i + 6)\n swap(this, i + 2, i + 5)\n swap(this, i + 3, i + 4)\n }\n return this\n}\n\nBuffer.prototype.toString = function toString () {\n var length = this.length | 0\n if (length === 0) return ''\n if (arguments.length === 0) return utf8Slice(this, 0, length)\n return slowToString.apply(this, arguments)\n}\n\nBuffer.prototype.equals = function equals (b) {\n if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')\n if (this === b) return true\n return Buffer.compare(this, b) === 0\n}\n\nBuffer.prototype.inspect = function inspect () {\n var str = ''\n var max = exports.INSPECT_MAX_BYTES\n if (this.length > 0) {\n str = this.toString('hex', 0, max).match(/.{2}/g).join(' ')\n if (this.length > max) str += ' ... '\n }\n return '<Buffer ' + str + '>'\n}\n\nBuffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {\n if (!Buffer.isBuffer(target)) {\n throw new TypeError('Argument must be a Buffer')\n }\n\n if (start === undefined) {\n start = 0\n }\n if (end === undefined) {\n end = target ? target.length : 0\n }\n if (thisStart === undefined) {\n thisStart = 0\n }\n if (thisEnd === undefined) {\n thisEnd = this.length\n }\n\n if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {\n throw new RangeError('out of range index')\n }\n\n if (thisStart >= thisEnd && start >= end) {\n return 0\n }\n if (thisStart >= thisEnd) {\n return -1\n }\n if (start >= end) {\n return 1\n }\n\n start >>>= 0\n end >>>= 0\n thisStart >>>= 0\n thisEnd >>>= 0\n\n if (this === target) return 0\n\n var x = thisEnd - thisStart\n var y = end - start\n var len = Math.min(x, y)\n\n var thisCopy = this.slice(thisStart, thisEnd)\n var targetCopy = target.slice(start, end)\n\n for (var i = 0; i < len; ++i) {\n if (thisCopy[i] !== targetCopy[i]) {\n x = thisCopy[i]\n y = targetCopy[i]\n break\n }\n }\n\n if (x < y) return -1\n if (y < x) return 1\n return 0\n}\n\n// Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,\n// OR the last index of `val` in `buffer` at offset <= `byteOffset`.\n//\n// Arguments:\n// - buffer - a Buffer to search\n// - val - a string, Buffer, or number\n// - byteOffset - an index into `buffer`; will be clamped to an int32\n// - encoding - an optional encoding, relevant is val is a string\n// - dir - true for indexOf, false for lastIndexOf\nfunction bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {\n // Empty buffer means no match\n if (buffer.length === 0) return -1\n\n // Normalize byteOffset\n if (typeof byteOffset === 'string') {\n encoding = byteOffset\n byteOffset = 0\n } else if (byteOffset > 0x7fffffff) {\n byteOffset = 0x7fffffff\n } else if (byteOffset < -0x80000000) {\n byteOffset = -0x80000000\n }\n byteOffset = +byteOffset // Coerce to Number.\n if (isNaN(byteOffset)) {\n // byteOffset: it it's undefined, null, NaN, \"foo\", etc, search whole buffer\n byteOffset = dir ? 0 : (buffer.length - 1)\n }\n\n // Normalize byteOffset: negative offsets start from the end of the buffer\n if (byteOffset < 0) byteOffset = buffer.length + byteOffset\n if (byteOffset >= buffer.length) {\n if (dir) return -1\n else byteOffset = buffer.length - 1\n } else if (byteOffset < 0) {\n if (dir) byteOffset = 0\n else return -1\n }\n\n // Normalize val\n if (typeof val === 'string') {\n val = Buffer.from(val, encoding)\n }\n\n // Finally, search either indexOf (if dir is true) or lastIndexOf\n if (Buffer.isBuffer(val)) {\n // Special case: looking for empty string/buffer always fails\n if (val.length === 0) {\n return -1\n }\n return arrayIndexOf(buffer, val, byteOffset, encoding, dir)\n } else if (typeof val === 'number') {\n val = val & 0xFF // Search for a byte value [0-255]\n if (Buffer.TYPED_ARRAY_SUPPORT &&\n typeof Uint8Array.prototype.indexOf === 'function') {\n if (dir) {\n return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)\n } else {\n return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)\n }\n }\n return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir)\n }\n\n throw new TypeError('val must be string, number or Buffer')\n}\n\nfunction arrayIndexOf (arr, val, byteOffset, encoding, dir) {\n var indexSize = 1\n var arrLength = arr.length\n var valLength = val.length\n\n if (encoding !== undefined) {\n encoding = String(encoding).toLowerCase()\n if (encoding === 'ucs2' || encoding === 'ucs-2' ||\n encoding === 'utf16le' || encoding === 'utf-16le') {\n if (arr.length < 2 || val.length < 2) {\n return -1\n }\n indexSize = 2\n arrLength /= 2\n valLength /= 2\n byteOffset /= 2\n }\n }\n\n function read (buf, i) {\n if (indexSize === 1) {\n return buf[i]\n } else {\n return buf.readUInt16BE(i * indexSize)\n }\n }\n\n var i\n if (dir) {\n var foundIndex = -1\n for (i = byteOffset; i < arrLength; i++) {\n if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {\n if (foundIndex === -1) foundIndex = i\n if (i - foundIndex + 1 === valLength) return foundIndex * indexSize\n } else {\n if (foundIndex !== -1) i -= i - foundIndex\n foundIndex = -1\n }\n }\n } else {\n if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength\n for (i = byteOffset; i >= 0; i--) {\n var found = true\n for (var j = 0; j < valLength; j++) {\n if (read(arr, i + j) !== read(val, j)) {\n found = false\n break\n }\n }\n if (found) return i\n }\n }\n\n return -1\n}\n\nBuffer.prototype.includes = function includes (val, byteOffset, encoding) {\n return this.indexOf(val, byteOffset, encoding) !== -1\n}\n\nBuffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {\n return bidirectionalIndexOf(this, val, byteOffset, encoding, true)\n}\n\nBuffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {\n return bidirectionalIndexOf(this, val, byteOffset, encoding, false)\n}\n\nfunction hexWrite (buf, string, offset, length) {\n offset = Number(offset) || 0\n var remaining = buf.length - offset\n if (!length) {\n length = remaining\n } else {\n length = Number(length)\n if (length > remaining) {\n length = remaining\n }\n }\n\n // must be an even number of digits\n var strLen = string.length\n if (strLen % 2 !== 0) throw new TypeError('Invalid hex string')\n\n if (length > strLen / 2) {\n length = strLen / 2\n }\n for (var i = 0; i < length; ++i) {\n var parsed = parseInt(string.substr(i * 2, 2), 16)\n if (isNaN(parsed)) return i\n buf[offset + i] = parsed\n }\n return i\n}\n\nfunction utf8Write (buf, string, offset, length) {\n return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)\n}\n\nfunction asciiWrite (buf, string, offset, length) {\n return blitBuffer(asciiToBytes(string), buf, offset, length)\n}\n\nfunction latin1Write (buf, string, offset, length) {\n return asciiWrite(buf, string, offset, length)\n}\n\nfunction base64Write (buf, string, offset, length) {\n return blitBuffer(base64ToBytes(string), buf, offset, length)\n}\n\nfunction ucs2Write (buf, string, offset, length) {\n return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)\n}\n\nBuffer.prototype.write = function write (string, offset, length, encoding) {\n // Buffer#write(string)\n if (offset === undefined) {\n encoding = 'utf8'\n length = this.length\n offset = 0\n // Buffer#write(string, encoding)\n } else if (length === undefined && typeof offset === 'string') {\n encoding = offset\n length = this.length\n offset = 0\n // Buffer#write(string, offset[, length][, encoding])\n } else if (isFinite(offset)) {\n offset = offset | 0\n if (isFinite(length)) {\n length = length | 0\n if (encoding === undefined) encoding = 'utf8'\n } else {\n encoding = length\n length = undefined\n }\n // legacy write(string, encoding, offset, length) - remove in v0.13\n } else {\n throw new Error(\n 'Buffer.write(string, encoding, offset[, length]) is no longer supported'\n )\n }\n\n var remaining = this.length - offset\n if (length === undefined || length > remaining) length = remaining\n\n if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {\n throw new RangeError('Attempt to write outside buffer bounds')\n }\n\n if (!encoding) encoding = 'utf8'\n\n var loweredCase = false\n for (;;) {\n switch (encoding) {\n case 'hex':\n return hexWrite(this, string, offset, length)\n\n case 'utf8':\n case 'utf-8':\n return utf8Write(this, string, offset, length)\n\n case 'ascii':\n return asciiWrite(this, string, offset, length)\n\n case 'latin1':\n case 'binary':\n return latin1Write(this, string, offset, length)\n\n case 'base64':\n // Warning: maxLength not taken into account in base64Write\n return base64Write(this, string, offset, length)\n\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return ucs2Write(this, string, offset, length)\n\n default:\n if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)\n encoding = ('' + encoding).toLowerCase()\n loweredCase = true\n }\n }\n}\n\nBuffer.prototype.toJSON = function toJSON () {\n return {\n type: 'Buffer',\n data: Array.prototype.slice.call(this._arr || this, 0)\n }\n}\n\nfunction base64Slice (buf, start, end) {\n if (start === 0 && end === buf.length) {\n return base64.fromByteArray(buf)\n } else {\n return base64.fromByteArray(buf.slice(start, end))\n }\n}\n\nfunction utf8Slice (buf, start, end) {\n end = Math.min(buf.length, end)\n var res = []\n\n var i = start\n while (i < end) {\n var firstByte = buf[i]\n var codePoint = null\n var bytesPerSequence = (firstByte > 0xEF) ? 4\n : (firstByte > 0xDF) ? 3\n : (firstByte > 0xBF) ? 2\n : 1\n\n if (i + bytesPerSequence <= end) {\n var secondByte, thirdByte, fourthByte, tempCodePoint\n\n switch (bytesPerSequence) {\n case 1:\n if (firstByte < 0x80) {\n codePoint = firstByte\n }\n break\n case 2:\n secondByte = buf[i + 1]\n if ((secondByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)\n if (tempCodePoint > 0x7F) {\n codePoint = tempCodePoint\n }\n }\n break\n case 3:\n secondByte = buf[i + 1]\n thirdByte = buf[i + 2]\n if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)\n if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {\n codePoint = tempCodePoint\n }\n }\n break\n case 4:\n secondByte = buf[i + 1]\n thirdByte = buf[i + 2]\n fourthByte = buf[i + 3]\n if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)\n if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {\n codePoint = tempCodePoint\n }\n }\n }\n }\n\n if (codePoint === null) {\n // we did not generate a valid codePoint so insert a\n // replacement char (U+FFFD) and advance only 1 byte\n codePoint = 0xFFFD\n bytesPerSequence = 1\n } else if (codePoint > 0xFFFF) {\n // encode to utf16 (surrogate pair dance)\n codePoint -= 0x10000\n res.push(codePoint >>> 10 & 0x3FF | 0xD800)\n codePoint = 0xDC00 | codePoint & 0x3FF\n }\n\n res.push(codePoint)\n i += bytesPerSequence\n }\n\n return decodeCodePointsArray(res)\n}\n\n// Based on http://stackoverflow.com/a/22747272/680742, the browser with\n// the lowest limit is Chrome, with 0x10000 args.\n// We go 1 magnitude less, for safety\nvar MAX_ARGUMENTS_LENGTH = 0x1000\n\nfunction decodeCodePointsArray (codePoints) {\n var len = codePoints.length\n if (len <= MAX_ARGUMENTS_LENGTH) {\n return String.fromCharCode.apply(String, codePoints) // avoid extra slice()\n }\n\n // Decode in chunks to avoid \"call stack size exceeded\".\n var res = ''\n var i = 0\n while (i < len) {\n res += String.fromCharCode.apply(\n String,\n codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)\n )\n }\n return res\n}\n\nfunction asciiSlice (buf, start, end) {\n var ret = ''\n end = Math.min(buf.length, end)\n\n for (var i = start; i < end; ++i) {\n ret += String.fromCharCode(buf[i] & 0x7F)\n }\n return ret\n}\n\nfunction latin1Slice (buf, start, end) {\n var ret = ''\n end = Math.min(buf.length, end)\n\n for (var i = start; i < end; ++i) {\n ret += String.fromCharCode(buf[i])\n }\n return ret\n}\n\nfunction hexSlice (buf, start, end) {\n var len = buf.length\n\n if (!start || start < 0) start = 0\n if (!end || end < 0 || end > len) end = len\n\n var out = ''\n for (var i = start; i < end; ++i) {\n out += toHex(buf[i])\n }\n return out\n}\n\nfunction utf16leSlice (buf, start, end) {\n var bytes = buf.slice(start, end)\n var res = ''\n for (var i = 0; i < bytes.length; i += 2) {\n res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256)\n }\n return res\n}\n\nBuffer.prototype.slice = function slice (start, end) {\n var len = this.length\n start = ~~start\n end = end === undefined ? len : ~~end\n\n if (start < 0) {\n start += len\n if (start < 0) start = 0\n } else if (start > len) {\n start = len\n }\n\n if (end < 0) {\n end += len\n if (end < 0) end = 0\n } else if (end > len) {\n end = len\n }\n\n if (end < start) end = start\n\n var newBuf\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n newBuf = this.subarray(start, end)\n newBuf.__proto__ = Buffer.prototype\n } else {\n var sliceLen = end - start\n newBuf = new Buffer(sliceLen, undefined)\n for (var i = 0; i < sliceLen; ++i) {\n newBuf[i] = this[i + start]\n }\n }\n\n return newBuf\n}\n\n/*\n * Need to make sure that buffer isn't trying to write out of bounds.\n */\nfunction checkOffset (offset, ext, length) {\n if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n}\n\nBuffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n var val = this[offset]\n var mul = 1\n var i = 0\n while (++i < byteLength && (mul *= 0x100)) {\n val += this[offset + i] * mul\n }\n\n return val\n}\n\nBuffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) {\n checkOffset(offset, byteLength, this.length)\n }\n\n var val = this[offset + --byteLength]\n var mul = 1\n while (byteLength > 0 && (mul *= 0x100)) {\n val += this[offset + --byteLength] * mul\n }\n\n return val\n}\n\nBuffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 1, this.length)\n return this[offset]\n}\n\nBuffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n return this[offset] | (this[offset + 1] << 8)\n}\n\nBuffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n return (this[offset] << 8) | this[offset + 1]\n}\n\nBuffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return ((this[offset]) |\n (this[offset + 1] << 8) |\n (this[offset + 2] << 16)) +\n (this[offset + 3] * 0x1000000)\n}\n\nBuffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset] * 0x1000000) +\n ((this[offset + 1] << 16) |\n (this[offset + 2] << 8) |\n this[offset + 3])\n}\n\nBuffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n var val = this[offset]\n var mul = 1\n var i = 0\n while (++i < byteLength && (mul *= 0x100)) {\n val += this[offset + i] * mul\n }\n mul *= 0x80\n\n if (val >= mul) val -= Math.pow(2, 8 * byteLength)\n\n return val\n}\n\nBuffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n var i = byteLength\n var mul = 1\n var val = this[offset + --i]\n while (i > 0 && (mul *= 0x100)) {\n val += this[offset + --i] * mul\n }\n mul *= 0x80\n\n if (val >= mul) val -= Math.pow(2, 8 * byteLength)\n\n return val\n}\n\nBuffer.prototype.readInt8 = function readInt8 (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 1, this.length)\n if (!(this[offset] & 0x80)) return (this[offset])\n return ((0xff - this[offset] + 1) * -1)\n}\n\nBuffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n var val = this[offset] | (this[offset + 1] << 8)\n return (val & 0x8000) ? val | 0xFFFF0000 : val\n}\n\nBuffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n var val = this[offset + 1] | (this[offset] << 8)\n return (val & 0x8000) ? val | 0xFFFF0000 : val\n}\n\nBuffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset]) |\n (this[offset + 1] << 8) |\n (this[offset + 2] << 16) |\n (this[offset + 3] << 24)\n}\n\nBuffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset] << 24) |\n (this[offset + 1] << 16) |\n (this[offset + 2] << 8) |\n (this[offset + 3])\n}\n\nBuffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n return ieee754.read(this, offset, true, 23, 4)\n}\n\nBuffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n return ieee754.read(this, offset, false, 23, 4)\n}\n\nBuffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 8, this.length)\n return ieee754.read(this, offset, true, 52, 8)\n}\n\nBuffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 8, this.length)\n return ieee754.read(this, offset, false, 52, 8)\n}\n\nfunction checkInt (buf, value, offset, ext, max, min) {\n if (!Buffer.isBuffer(buf)) throw new TypeError('\"buffer\" argument must be a Buffer instance')\n if (value > max || value < min) throw new RangeError('\"value\" argument is out of bounds')\n if (offset + ext > buf.length) throw new RangeError('Index out of range')\n}\n\nBuffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) {\n var maxBytes = Math.pow(2, 8 * byteLength) - 1\n checkInt(this, value, offset, byteLength, maxBytes, 0)\n }\n\n var mul = 1\n var i = 0\n this[offset] = value & 0xFF\n while (++i < byteLength && (mul *= 0x100)) {\n this[offset + i] = (value / mul) & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) {\n var maxBytes = Math.pow(2, 8 * byteLength) - 1\n checkInt(this, value, offset, byteLength, maxBytes, 0)\n }\n\n var i = byteLength - 1\n var mul = 1\n this[offset + i] = value & 0xFF\n while (--i >= 0 && (mul *= 0x100)) {\n this[offset + i] = (value / mul) & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)\n if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)\n this[offset] = (value & 0xff)\n return offset + 1\n}\n\nfunction objectWriteUInt16 (buf, value, offset, littleEndian) {\n if (value < 0) value = 0xffff + value + 1\n for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) {\n buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>>\n (littleEndian ? i : 1 - i) * 8\n }\n}\n\nBuffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n } else {\n objectWriteUInt16(this, value, offset, true)\n }\n return offset + 2\n}\n\nBuffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 8)\n this[offset + 1] = (value & 0xff)\n } else {\n objectWriteUInt16(this, value, offset, false)\n }\n return offset + 2\n}\n\nfunction objectWriteUInt32 (buf, value, offset, littleEndian) {\n if (value < 0) value = 0xffffffff + value + 1\n for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) {\n buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff\n }\n}\n\nBuffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset + 3] = (value >>> 24)\n this[offset + 2] = (value >>> 16)\n this[offset + 1] = (value >>> 8)\n this[offset] = (value & 0xff)\n } else {\n objectWriteUInt32(this, value, offset, true)\n }\n return offset + 4\n}\n\nBuffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 24)\n this[offset + 1] = (value >>> 16)\n this[offset + 2] = (value >>> 8)\n this[offset + 3] = (value & 0xff)\n } else {\n objectWriteUInt32(this, value, offset, false)\n }\n return offset + 4\n}\n\nBuffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) {\n var limit = Math.pow(2, 8 * byteLength - 1)\n\n checkInt(this, value, offset, byteLength, limit - 1, -limit)\n }\n\n var i = 0\n var mul = 1\n var sub = 0\n this[offset] = value & 0xFF\n while (++i < byteLength && (mul *= 0x100)) {\n if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {\n sub = 1\n }\n this[offset + i] = ((value / mul) >> 0) - sub & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) {\n var limit = Math.pow(2, 8 * byteLength - 1)\n\n checkInt(this, value, offset, byteLength, limit - 1, -limit)\n }\n\n var i = byteLength - 1\n var mul = 1\n var sub = 0\n this[offset + i] = value & 0xFF\n while (--i >= 0 && (mul *= 0x100)) {\n if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {\n sub = 1\n }\n this[offset + i] = ((value / mul) >> 0) - sub & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)\n if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)\n if (value < 0) value = 0xff + value + 1\n this[offset] = (value & 0xff)\n return offset + 1\n}\n\nBuffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n } else {\n objectWriteUInt16(this, value, offset, true)\n }\n return offset + 2\n}\n\nBuffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 8)\n this[offset + 1] = (value & 0xff)\n } else {\n objectWriteUInt16(this, value, offset, false)\n }\n return offset + 2\n}\n\nBuffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n this[offset + 2] = (value >>> 16)\n this[offset + 3] = (value >>> 24)\n } else {\n objectWriteUInt32(this, value, offset, true)\n }\n return offset + 4\n}\n\nBuffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)\n if (value < 0) value = 0xffffffff + value + 1\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 24)\n this[offset + 1] = (value >>> 16)\n this[offset + 2] = (value >>> 8)\n this[offset + 3] = (value & 0xff)\n } else {\n objectWriteUInt32(this, value, offset, false)\n }\n return offset + 4\n}\n\nfunction checkIEEE754 (buf, value, offset, ext, max, min) {\n if (offset + ext > buf.length) throw new RangeError('Index out of range')\n if (offset < 0) throw new RangeError('Index out of range')\n}\n\nfunction writeFloat (buf, value, offset, littleEndian, noAssert) {\n if (!noAssert) {\n checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)\n }\n ieee754.write(buf, value, offset, littleEndian, 23, 4)\n return offset + 4\n}\n\nBuffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {\n return writeFloat(this, value, offset, true, noAssert)\n}\n\nBuffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {\n return writeFloat(this, value, offset, false, noAssert)\n}\n\nfunction writeDouble (buf, value, offset, littleEndian, noAssert) {\n if (!noAssert) {\n checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)\n }\n ieee754.write(buf, value, offset, littleEndian, 52, 8)\n return offset + 8\n}\n\nBuffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {\n return writeDouble(this, value, offset, true, noAssert)\n}\n\nBuffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {\n return writeDouble(this, value, offset, false, noAssert)\n}\n\n// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)\nBuffer.prototype.copy = function copy (target, targetStart, start, end) {\n if (!start) start = 0\n if (!end && end !== 0) end = this.length\n if (targetStart >= target.length) targetStart = target.length\n if (!targetStart) targetStart = 0\n if (end > 0 && end < start) end = start\n\n // Copy 0 bytes; we're done\n if (end === start) return 0\n if (target.length === 0 || this.length === 0) return 0\n\n // Fatal error conditions\n if (targetStart < 0) {\n throw new RangeError('targetStart out of bounds')\n }\n if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds')\n if (end < 0) throw new RangeError('sourceEnd out of bounds')\n\n // Are we oob?\n if (end > this.length) end = this.length\n if (target.length - targetStart < end - start) {\n end = target.length - targetStart + start\n }\n\n var len = end - start\n var i\n\n if (this === target && start < targetStart && targetStart < end) {\n // descending copy from end\n for (i = len - 1; i >= 0; --i) {\n target[i + targetStart] = this[i + start]\n }\n } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) {\n // ascending copy from start\n for (i = 0; i < len; ++i) {\n target[i + targetStart] = this[i + start]\n }\n } else {\n Uint8Array.prototype.set.call(\n target,\n this.subarray(start, start + len),\n targetStart\n )\n }\n\n return len\n}\n\n// Usage:\n// buffer.fill(number[, offset[, end]])\n// buffer.fill(buffer[, offset[, end]])\n// buffer.fill(string[, offset[, end]][, encoding])\nBuffer.prototype.fill = function fill (val, start, end, encoding) {\n // Handle string cases:\n if (typeof val === 'string') {\n if (typeof start === 'string') {\n encoding = start\n start = 0\n end = this.length\n } else if (typeof end === 'string') {\n encoding = end\n end = this.length\n }\n if (val.length === 1) {\n var code = val.charCodeAt(0)\n if (code < 256) {\n val = code\n }\n }\n if (encoding !== undefined && typeof encoding !== 'string') {\n throw new TypeError('encoding must be a string')\n }\n if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {\n throw new TypeError('Unknown encoding: ' + encoding)\n }\n } else if (typeof val === 'number') {\n val = val & 255\n }\n\n // Invalid ranges are not set to a default, so can range check early.\n if (start < 0 || this.length < start || this.length < end) {\n throw new RangeError('Out of range index')\n }\n\n if (end <= start) {\n return this\n }\n\n start = start >>> 0\n end = end === undefined ? this.length : end >>> 0\n\n if (!val) val = 0\n\n var i\n if (typeof val === 'number') {\n for (i = start; i < end; ++i) {\n this[i] = val\n }\n } else {\n var bytes = Buffer.isBuffer(val)\n ? val\n : utf8ToBytes(new Buffer(val, encoding).toString())\n var len = bytes.length\n for (i = 0; i < end - start; ++i) {\n this[i + start] = bytes[i % len]\n }\n }\n\n return this\n}\n\n// HELPER FUNCTIONS\n// ================\n\nvar INVALID_BASE64_RE = /[^+\\/0-9A-Za-z-_]/g\n\nfunction base64clean (str) {\n // Node strips out invalid characters like \\n and \\t from the string, base64-js does not\n str = stringtrim(str).replace(INVALID_BASE64_RE, '')\n // Node converts strings with length < 2 to ''\n if (str.length < 2) return ''\n // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not\n while (str.length % 4 !== 0) {\n str = str + '='\n }\n return str\n}\n\nfunction stringtrim (str) {\n if (str.trim) return str.trim()\n return str.replace(/^\\s+|\\s+$/g, '')\n}\n\nfunction toHex (n) {\n if (n < 16) return '0' + n.toString(16)\n return n.toString(16)\n}\n\nfunction utf8ToBytes (string, units) {\n units = units || Infinity\n var codePoint\n var length = string.length\n var leadSurrogate = null\n var bytes = []\n\n for (var i = 0; i < length; ++i) {\n codePoint = string.charCodeAt(i)\n\n // is surrogate component\n if (codePoint > 0xD7FF && codePoint < 0xE000) {\n // last char was a lead\n if (!leadSurrogate) {\n // no lead yet\n if (codePoint > 0xDBFF) {\n // unexpected trail\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n continue\n } else if (i + 1 === length) {\n // unpaired lead\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n continue\n }\n\n // valid lead\n leadSurrogate = codePoint\n\n continue\n }\n\n // 2 leads in a row\n if (codePoint < 0xDC00) {\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n leadSurrogate = codePoint\n continue\n }\n\n // valid surrogate pair\n codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000\n } else if (leadSurrogate) {\n // valid bmp char, but last char was a lead\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n }\n\n leadSurrogate = null\n\n // encode utf8\n if (codePoint < 0x80) {\n if ((units -= 1) < 0) break\n bytes.push(codePoint)\n } else if (codePoint < 0x800) {\n if ((units -= 2) < 0) break\n bytes.push(\n codePoint >> 0x6 | 0xC0,\n codePoint & 0x3F | 0x80\n )\n } else if (codePoint < 0x10000) {\n if ((units -= 3) < 0) break\n bytes.push(\n codePoint >> 0xC | 0xE0,\n codePoint >> 0x6 & 0x3F | 0x80,\n codePoint & 0x3F | 0x80\n )\n } else if (codePoint < 0x110000) {\n if ((units -= 4) < 0) break\n bytes.push(\n codePoint >> 0x12 | 0xF0,\n codePoint >> 0xC & 0x3F | 0x80,\n codePoint >> 0x6 & 0x3F | 0x80,\n codePoint & 0x3F | 0x80\n )\n } else {\n throw new Error('Invalid code point')\n }\n }\n\n return bytes\n}\n\nfunction asciiToBytes (str) {\n var byteArray = []\n for (var i = 0; i < str.length; ++i) {\n // Node's code seems to be doing this and not & 0x7F..\n byteArray.push(str.charCodeAt(i) & 0xFF)\n }\n return byteArray\n}\n\nfunction utf16leToBytes (str, units) {\n var c, hi, lo\n var byteArray = []\n for (var i = 0; i < str.length; ++i) {\n if ((units -= 2) < 0) break\n\n c = str.charCodeAt(i)\n hi = c >> 8\n lo = c % 256\n byteArray.push(lo)\n byteArray.push(hi)\n }\n\n return byteArray\n}\n\nfunction base64ToBytes (str) {\n return base64.toByteArray(base64clean(str))\n}\n\nfunction blitBuffer (src, dst, offset, length) {\n for (var i = 0; i < length; ++i) {\n if ((i + offset >= dst.length) || (i >= src.length)) break\n dst[i + offset] = src[i]\n }\n return i\n}\n\nfunction isnan (val) {\n return val !== val // eslint-disable-line no-self-compare\n}\n","/*!\n * Chai - flag utility\n * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>\n * MIT Licensed\n */\n\n/**\n * ### .flag(object, key, [value])\n *\n * Get or set a flag value on an object. If a\n * value is provided it will be set, else it will\n * return the currently set value or `undefined` if\n * the value is not set.\n *\n * utils.flag(this, 'foo', 'bar'); // setter\n * utils.flag(this, 'foo'); // getter, returns `bar`\n *\n * @param {Object} object constructed Assertion\n * @param {String} key\n * @param {Mixed} value (optional)\n * @namespace Utils\n * @name flag\n * @api private\n */\n\nmodule.exports = function flag(obj, key, value) {\n var flags = obj.__flags || (obj.__flags = Object.create(null));\n if (arguments.length === 3) {\n flags[key] = value;\n } else {\n return flags[key];\n }\n};\n","// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028\nvar global = module.exports = typeof window != 'undefined' && window.Math == Math\n ? window : typeof self != 'undefined' && self.Math == Math ? self : Function('return this')();\nif(typeof __g == 'number')__g = global; // eslint-disable-line no-undef","'use strict';\n\nmodule.exports = {\n /**\n * True if this is running in Nodejs, will be undefined in a browser.\n * In a browser, browserify won't include this file and the whole module\n * will be resolved an empty object.\n */\n isNode : typeof Buffer !== \"undefined\",\n /**\n * Create a new nodejs Buffer from an existing content.\n * @param {Object} data the data to pass to the constructor.\n * @param {String} encoding the encoding to use.\n * @return {Buffer} a new Buffer.\n */\n newBufferFrom: function(data, encoding) {\n // XXX We can't use `Buffer.from` which comes from `Uint8Array.from`\n // in nodejs v4 (< v.4.5). It's not the expected implementation (and\n // has a different signature).\n // see https://github.com/nodejs/node/issues/8053\n // A condition on nodejs' version won't solve the issue as we don't\n // control the Buffer polyfills that may or may not be used.\n return new Buffer(data, encoding);\n },\n /**\n * Create a new nodejs Buffer with the specified size.\n * @param {Integer} size the size of the buffer.\n * @return {Buffer} a new Buffer.\n */\n allocBuffer: function (size) {\n if (Buffer.alloc) {\n return Buffer.alloc(size);\n } else {\n return new Buffer(size);\n }\n },\n /**\n * Find out if an object is a Buffer.\n * @param {Object} b the object to test.\n * @return {Boolean} true if the object is a Buffer, false otherwise.\n */\n isBuffer : function(b){\n return Buffer.isBuffer(b);\n },\n\n isStream : function (obj) {\n return obj &&\n typeof obj.on === \"function\" &&\n typeof obj.pause === \"function\" &&\n typeof obj.resume === \"function\";\n }\n};\n","/* eslint-disable node/no-deprecated-api */\nvar buffer = require('buffer')\nvar Buffer = buffer.Buffer\n\n// alternative to using Object.keys for old browsers\nfunction copyProps (src, dst) {\n for (var key in src) {\n dst[key] = src[key]\n }\n}\nif (Buffer.from && Buffer.alloc && Buffer.allocUnsafe && Buffer.allocUnsafeSlow) {\n module.exports = buffer\n} else {\n // Copy properties from require('buffer')\n copyProps(buffer, exports)\n exports.Buffer = SafeBuffer\n}\n\nfunction SafeBuffer (arg, encodingOrOffset, length) {\n return Buffer(arg, encodingOrOffset, length)\n}\n\n// Copy static methods from Buffer\ncopyProps(Buffer, SafeBuffer)\n\nSafeBuffer.from = function (arg, encodingOrOffset, length) {\n if (typeof arg === 'number') {\n throw new TypeError('Argument must not be a number')\n }\n return Buffer(arg, encodingOrOffset, length)\n}\n\nSafeBuffer.alloc = function (size, fill, encoding) {\n if (typeof size !== 'number') {\n throw new TypeError('Argument must be a number')\n }\n var buf = Buffer(size)\n if (fill !== undefined) {\n if (typeof encoding === 'string') {\n buf.fill(fill, encoding)\n } else {\n buf.fill(fill)\n }\n } else {\n buf.fill(0)\n }\n return buf\n}\n\nSafeBuffer.allocUnsafe = function (size) {\n if (typeof size !== 'number') {\n throw new TypeError('Argument must be a number')\n }\n return Buffer(size)\n}\n\nSafeBuffer.allocUnsafeSlow = function (size) {\n if (typeof size !== 'number') {\n throw new TypeError('Argument must be a number')\n }\n return buffer.SlowBuffer(size)\n}\n","'use strict';\n\nif (!process.version ||\n process.version.indexOf('v0.') === 0 ||\n process.version.indexOf('v1.') === 0 && process.version.indexOf('v1.8.') !== 0) {\n module.exports = { nextTick: nextTick };\n} else {\n module.exports = process\n}\n\nfunction nextTick(fn, arg1, arg2, arg3) {\n if (typeof fn !== 'function') {\n throw new TypeError('\"callback\" argument must be a function');\n }\n var len = arguments.length;\n var args, i;\n switch (len) {\n case 0:\n case 1:\n return process.nextTick(fn);\n case 2:\n return process.nextTick(function afterTickOne() {\n fn.call(null, arg1);\n });\n case 3:\n return process.nextTick(function afterTickTwo() {\n fn.call(null, arg1, arg2);\n });\n case 4:\n return process.nextTick(function afterTickThree() {\n fn.call(null, arg1, arg2, arg3);\n });\n default:\n args = new Array(len - 1);\n i = 0;\n while (i < args.length) {\n args[i++] = arguments[i];\n }\n return process.nextTick(function afterTick() {\n fn.apply(null, args);\n });\n }\n}\n\n","/* global window, exports, define */\n\n!function() {\n 'use strict'\n\n var re = {\n not_string: /[^s]/,\n not_bool: /[^t]/,\n not_type: /[^T]/,\n not_primitive: /[^v]/,\n number: /[diefg]/,\n numeric_arg: /[bcdiefguxX]/,\n json: /[j]/,\n not_json: /[^j]/,\n text: /^[^\\x25]+/,\n modulo: /^\\x25{2}/,\n placeholder: /^\\x25(?:([1-9]\\d*)\\$|\\(([^\\)]+)\\))?(\\+)?(0|'[^$])?(-)?(\\d+)?(?:\\.(\\d+))?([b-gijostTuvxX])/,\n key: /^([a-z_][a-z_\\d]*)/i,\n key_access: /^\\.([a-z_][a-z_\\d]*)/i,\n index_access: /^\\[(\\d+)\\]/,\n sign: /^[\\+\\-]/\n }\n\n function sprintf(key) {\n // `arguments` is not an array, but should be fine for this call\n return sprintf_format(sprintf_parse(key), arguments)\n }\n\n function vsprintf(fmt, argv) {\n return sprintf.apply(null, [fmt].concat(argv || []))\n }\n\n function sprintf_format(parse_tree, argv) {\n var cursor = 1, tree_length = parse_tree.length, arg, output = '', i, k, match, pad, pad_character, pad_length, is_positive, sign\n for (i = 0; i < tree_length; i++) {\n if (typeof parse_tree[i] === 'string') {\n output += parse_tree[i]\n }\n else if (Array.isArray(parse_tree[i])) {\n match = parse_tree[i] // convenience purposes only\n if (match[2]) { // keyword argument\n arg = argv[cursor]\n for (k = 0; k < match[2].length; k++) {\n if (!arg.hasOwnProperty(match[2][k])) {\n throw new Error(sprintf('[sprintf] property \"%s\" does not exist', match[2][k]))\n }\n arg = arg[match[2][k]]\n }\n }\n else if (match[1]) { // positional argument (explicit)\n arg = argv[match[1]]\n }\n else { // positional argument (implicit)\n arg = argv[cursor++]\n }\n\n if (re.not_type.test(match[8]) && re.not_primitive.test(match[8]) && arg instanceof Function) {\n arg = arg()\n }\n\n if (re.numeric_arg.test(match[8]) && (typeof arg !== 'number' && isNaN(arg))) {\n throw new TypeError(sprintf('[sprintf] expecting number but found %T', arg))\n }\n\n if (re.number.test(match[8])) {\n is_positive = arg >= 0\n }\n\n switch (match[8]) {\n case 'b':\n arg = parseInt(arg, 10).toString(2)\n break\n case 'c':\n arg = String.fromCharCode(parseInt(arg, 10))\n break\n case 'd':\n case 'i':\n arg = parseInt(arg, 10)\n break\n case 'j':\n arg = JSON.stringify(arg, null, match[6] ? parseInt(match[6]) : 0)\n break\n case 'e':\n arg = match[7] ? parseFloat(arg).toExponential(match[7]) : parseFloat(arg).toExponential()\n break\n case 'f':\n arg = match[7] ? parseFloat(arg).toFixed(match[7]) : parseFloat(arg)\n break\n case 'g':\n arg = match[7] ? String(Number(arg.toPrecision(match[7]))) : parseFloat(arg)\n break\n case 'o':\n arg = (parseInt(arg, 10) >>> 0).toString(8)\n break\n case 's':\n arg = String(arg)\n arg = (match[7] ? arg.substring(0, match[7]) : arg)\n break\n case 't':\n arg = String(!!arg)\n arg = (match[7] ? arg.substring(0, match[7]) : arg)\n break\n case 'T':\n arg = Object.prototype.toString.call(arg).slice(8, -1).toLowerCase()\n arg = (match[7] ? arg.substring(0, match[7]) : arg)\n break\n case 'u':\n arg = parseInt(arg, 10) >>> 0\n break\n case 'v':\n arg = arg.valueOf()\n arg = (match[7] ? arg.substring(0, match[7]) : arg)\n break\n case 'x':\n arg = (parseInt(arg, 10) >>> 0).toString(16)\n break\n case 'X':\n arg = (parseInt(arg, 10) >>> 0).toString(16).toUpperCase()\n break\n }\n if (re.json.test(match[8])) {\n output += arg\n }\n else {\n if (re.number.test(match[8]) && (!is_positive || match[3])) {\n sign = is_positive ? '+' : '-'\n arg = arg.toString().replace(re.sign, '')\n }\n else {\n sign = ''\n }\n pad_character = match[4] ? match[4] === '0' ? '0' : match[4].charAt(1) : ' '\n pad_length = match[6] - (sign + arg).length\n pad = match[6] ? (pad_length > 0 ? pad_character.repeat(pad_length) : '') : ''\n output += match[5] ? sign + arg + pad : (pad_character === '0' ? sign + pad + arg : pad + sign + arg)\n }\n }\n }\n return output\n }\n\n var sprintf_cache = Object.create(null)\n\n function sprintf_parse(fmt) {\n if (sprintf_cache[fmt]) {\n return sprintf_cache[fmt]\n }\n\n var _fmt = fmt, match, parse_tree = [], arg_names = 0\n while (_fmt) {\n if ((match = re.text.exec(_fmt)) !== null) {\n parse_tree.push(match[0])\n }\n else if ((match = re.modulo.exec(_fmt)) !== null) {\n parse_tree.push('%')\n }\n else if ((match = re.placeholder.exec(_fmt)) !== null) {\n if (match[2]) {\n arg_names |= 1\n var field_list = [], replacement_field = match[2], field_match = []\n if ((field_match = re.key.exec(replacement_field)) !== null) {\n field_list.push(field_match[1])\n while ((replacement_field = replacement_field.substring(field_match[0].length)) !== '') {\n if ((field_match = re.key_access.exec(replacement_field)) !== null) {\n field_list.push(field_match[1])\n }\n else if ((field_match = re.index_access.exec(replacement_field)) !== null) {\n field_list.push(field_match[1])\n }\n else {\n throw new SyntaxError('[sprintf] failed to parse named argument key')\n }\n }\n }\n else {\n throw new SyntaxError('[sprintf] failed to parse named argument key')\n }\n match[2] = field_list\n }\n else {\n arg_names |= 2\n }\n if (arg_names === 3) {\n throw new Error('[sprintf] mixing positional and named placeholders is not (yet) supported')\n }\n parse_tree.push(match)\n }\n else {\n throw new SyntaxError('[sprintf] unexpected placeholder')\n }\n _fmt = _fmt.substring(match[0].length)\n }\n return sprintf_cache[fmt] = parse_tree\n }\n\n /**\n * export to either browser or node.js\n */\n /* eslint-disable quote-props */\n if (typeof exports !== 'undefined') {\n exports['sprintf'] = sprintf\n exports['vsprintf'] = vsprintf\n }\n if (typeof window !== 'undefined') {\n window['sprintf'] = sprintf\n window['vsprintf'] = vsprintf\n\n if (typeof define === 'function' && define['amd']) {\n define(function() {\n return {\n 'sprintf': sprintf,\n 'vsprintf': vsprintf\n }\n })\n }\n }\n /* eslint-enable quote-props */\n}()\n","import {HacknetNode} from \"./HacknetNode.js\";\r\nimport {NetscriptFunctions} from \"./NetscriptFunctions.js\";\r\nimport {NetscriptPort} from \"./NetscriptPort.js\";\r\n\r\n/* Environment\r\n * \tNetScript program environment\r\n */\r\nfunction Environment(workerScript,parent) {\r\n if (parent){\r\n //Create a copy of parent's variables\r\n //this.vars = parent.vars;\r\n this.vars = Object.assign({}, parent.vars);\r\n } else {\r\n this.vars = NetscriptFunctions(workerScript);\r\n }\r\n this.parent = parent;\r\n\tthis.stopFlag = false;\r\n}\r\nEnvironment.prototype = {\r\n\t//Create a \"subscope\", which is a new new \"sub-environment\"\r\n\t//The subscope is linked to this through its parent variable\r\n extend: function() {\r\n return new Environment(null, this);\r\n },\r\n\r\n\t//Finds the scope where the variable with the given name is defined\r\n lookup: function(name) {\r\n var scope = this;\r\n while (scope) {\r\n if (Object.prototype.hasOwnProperty.call(scope.vars, name)) {\r\n return scope;\r\n }\r\n scope = scope.parent;\r\n }\r\n return null;\r\n },\r\n\r\n\t//Get the current value of a variable\r\n get: function(name) {\r\n if (name in this.vars) {\r\n return this.vars[name];\r\n }\r\n throw new Error(\"Undefined variable \" + name);\r\n },\r\n\r\n\t//Sets the value of a variable in any scope\r\n set: function(name, value) {\r\n var scope = this.lookup(name);\r\n\r\n //If scope has a value, then this variable is already set in a higher scope, so\r\n //set is there. Otherwise, create a new variable in the local scope\r\n if (scope !== null) {\r\n return scope.vars[name] = value;\r\n } else {\r\n return this.vars[name] = value;\r\n }\r\n },\r\n\r\n setArrayElement: function(name, idx, value) {\r\n if (!(idx instanceof Array)) {\r\n throw new Error(\"idx parameter is not an Array\");\r\n }\r\n var scope = this.lookup(name);\r\n if (!scope && this.parent) {\r\n throw new Error(\"Undefined variable \" + name);\r\n }\r\n var arr = (scope || this).vars[name];\r\n if (!(arr.constructor === Array || arr instanceof Array)) {\r\n throw new Error(\"Variable is not an array: \" + name);\r\n }\r\n var res = arr;\r\n for (var iterator = 0; iterator < idx.length-1; ++iterator) {\r\n var i = idx[iterator];\r\n if (!(res instanceof Array) || i >= res.length) {\r\n throw new Error(\"Out-of-bounds array access\");\r\n }\r\n res = res[i];\r\n }\r\n\r\n //Cant assign to ports or HacknetNodes\r\n if (res[idx[idx.length-1]] instanceof HacknetNode) {\r\n throw new Error(\"Cannot assign a Hacknet Node handle to a new value\");\r\n }\r\n if (res[idx[idx.length-1]] instanceof NetscriptPort) {\r\n throw new Error(\"Cannot assign a Netscript Port handle to a new value\");\r\n }\r\n return res[idx[idx.length-1]] = value;\r\n },\r\n\r\n\t//Creates (or overwrites) a variable in the current scope\r\n def: function(name, value) {\r\n return this.vars[name] = value;\r\n }\r\n};\r\n\r\nexport {Environment};\r\n","import {Engine} from \"./engine.js\";\r\n\r\nimport {removeChildrenFromElement,\r\n createElement, exceptionAlert} from \"../utils/HelperFunctions.js\";\r\nimport {isString} from \"../utils/StringHelperFunctions.js\";\r\n\r\nvar cinematicTextFlag = false;\r\n\r\n//Lines must be an array of strings\r\nfunction writeCinematicText(lines) {\r\n cinematicTextFlag = true;\r\n\r\n if (lines.constructor !== Array) {\r\n throw new Error(\"Invalid non-array argument passed into writeCinematicText()\");\r\n }\r\n\r\n //We'll reuse the 'Red Pill' content\r\n Engine.loadCinematicTextContent();\r\n var container = document.getElementById(\"cinematic-text-container\");\r\n container.style.width = \"75%\";\r\n if (container == null) {throw new Error(\"Could not find cinematic-text-container for writeCinematicText()\");}\r\n removeChildrenFromElement(container);\r\n\r\n for (var i = 0; i < lines.length; ++i) {\r\n if (!isString(lines[i])) {\r\n throw new Error(\"Invalid non-string element in 'lines' argument. writeCinematicText() failed\");\r\n }\r\n }\r\n\r\n return writeCinematicTextRecurse(lines).then(function() {\r\n return cinematicTextEnd(); //Puts the continue button\r\n }).catch(function(e) {\r\n exceptionAlert(e);\r\n });\r\n}\r\n\r\nfunction writeCinematicTextRecurse(lines, lineNumber=0) {\r\n if (lineNumber >= lines.length) {return Promise.resolve(true);}\r\n return writeCinematicTextLine(lines[lineNumber]).then(function() {\r\n return writeCinematicTextRecurse(lines, lineNumber+1);\r\n });\r\n}\r\n\r\nfunction writeCinematicTextLine(line) {\r\n return new Promise(function(resolve, reject) {\r\n var container = document.getElementById(\"cinematic-text-container\");\r\n var pElem = document.createElement(\"p\");\r\n container.appendChild(pElem);\r\n\r\n var promise = writeCinematicTextLetter(pElem, line, 0);\r\n promise.then(function(res) {\r\n resolve(res);\r\n }, function(e) {\r\n reject(e);\r\n });\r\n });\r\n}\r\n\r\nfunction writeCinematicTextLetter(pElem, line, i=0) {\r\n return new Promise(function(resolve, reject) {\r\n setTimeout(function() {\r\n if (i >= line.length) {\r\n var textToShow = line.substring(0, i);\r\n pElem.innerHTML = textToShow;\r\n return resolve(true);\r\n }\r\n var textToShow = line.substring(0, i);\r\n pElem.innerHTML = textToShow + \"<span class='typed-cursor'> &#9608; </span>\";\r\n var promise = writeCinematicTextLetter(pElem, line, i+1);\r\n promise.then(function(res) {\r\n resolve(res);\r\n }, function(e) {\r\n reject(e);\r\n });\r\n }, 15);\r\n });\r\n}\r\n\r\nfunction cinematicTextEnd() {\r\n var container = document.getElementById(\"cinematic-text-container\");\r\n var mainMenu = document.getElementById(\"mainmenu-container\");\r\n container.appendChild(createElement(\"br\"));\r\n\r\n return new Promise (function(resolve, reject) {\r\n container.appendChild(createElement(\"a\", {\r\n class:\"a-link-button\", innerText:\"Continue...\",\r\n clickListener:()=>{\r\n removeChildrenFromElement(container);\r\n Engine.loadTerminalContent();\r\n mainMenu.style.visibility = \"visible\";\r\n cinematicTextFlag = false;\r\n resolve();\r\n }\r\n }));\r\n });\r\n}\r\n\r\nexport {cinematicTextFlag, writeCinematicText};\r\n","/* HelpText.js */\r\nlet TerminalHelpText =\r\n \"Type 'help name' to learn more about the command 'name'<br><br>\" +\r\n 'alias [-g] [name=\"value\"] Create or display Terminal aliases<br>' +\r\n \"analyze Get information about the current machine <br>\" +\r\n \"buy [-l/program] Purchase a program through the Dark Web<br>\" +\r\n \"cat [file] Display a .msg, .lit, or .txt file<br>\" +\r\n \"check [script] [args...] Print a script's logs to Terminal<br>\" +\r\n \"clear Clear all text on the terminal <br>\" +\r\n \"cls See 'clear' command <br>\" +\r\n \"connect [ip/hostname] Connects to a remote server<br>\" +\r\n \"download [script/text file] Downloads scripts or text files to your computer<br>\" +\r\n \"free Check the machine's memory (RAM) usage<br>\" +\r\n \"hack Hack the current machine<br>\" +\r\n \"help [command] Display this help text, or the help text for a command<br>\" +\r\n \"home Connect to home computer<br>\" +\r\n \"hostname Displays the hostname of the machine<br>\" +\r\n \"ifconfig Displays the IP address of the machine<br>\" +\r\n \"kill [script] [args...] Stops the specified script on the current server <br>\" +\r\n \"killall Stops all running scripts on the current machine<br>\" +\r\n \"ls [| grep pattern] Displays all files on the machine<br>\" +\r\n \"lscpu Displays the number of CPU cores on the machine<br>\" +\r\n \"mem [script] [-t] [n] Displays the amount of RAM required to run the script<br>\" +\r\n \"nano [file] Text editor - Open up and edit a script or text file<br>\" +\r\n \"ps Display all scripts that are currently running<br>\" +\r\n \"rm [file] Delete a file from the server<br>\" +\r\n \"run [name] [-t] [n] [args...] Execute a program or script<br>\" +\r\n \"scan Prints all immediately-available network connections<br>\" +\r\n \"scan-analyze [d] [-a] Prints info for all servers up to <i>d</i> nodes away<br>\" +\r\n \"scp [file] [server] Copies a file to a destination server<br>\" +\r\n \"sudov Shows whether you have root access on this computer<br>\" +\r\n \"tail [script] [args...] Displays dynamic logs for the specified script<br>\" +\r\n \"theme [preset] | bg txt hlgt Change the color scheme of the UI<br>\" +\r\n \"top Displays all running scripts and their RAM usage<br>\" +\r\n 'unalias \"[alias name]\" Deletes the specified alias<br>';\r\n\r\nlet HelpTexts = {\r\n alias: 'alias [-g] [name=\"value\"] <br>' +\r\n \"Create or display aliases. An alias enables a replacement of a word with another string. \" +\r\n \"It can be used to abbreviate a commonly used command, or commonly used parts of a command. The NAME \" +\r\n \"of an alias defines the word that will be replaced, while the VALUE defines what it will be replaced by. For example, \" +\r\n \"you could create the alias 'nuke' for the Terminal command 'run NUKE.exe' using the following: <br><br>\" +\r\n 'alias nuke=\"run NUKE.exe\"<br><br>' +\r\n \"Then, to run the NUKE.exe program you would just have to enter 'nuke' in Terminal rather than the full command. \" +\r\n \"It is important to note that 'default' aliases will only be substituted for the first word of a Terminal command. For \" +\r\n \"example, if the following alias was set: <br><br>\" +\r\n 'alias worm=\"HTTPWorm.exe\"<br><br>' +\r\n \"and then you tried to run the following terminal command: <br><br>\" +\r\n \"run worm<br><br>\" +\r\n \"This would fail because the worm alias is not the first word of a Terminal command. To allow an alias to be substituted \" +\r\n \"anywhere in a Terminal command, rather than just the first word, you must set it to be a global alias using the -g flag: <br><br>\" +\r\n 'alias -g worm=\"HTTPWorm.exe\"<br><br>' +\r\n \"Now, the 'worm' alias will be substituted anytime it shows up as an individual word in a Terminal command. <br><br>\" +\r\n \"Entering just the command 'alias' without any arguments prints the list of all defined aliases in the reusable form \" +\r\n \"'alias NAME=VALUE' on the Terminal. <br><br>\" +\r\n \"The 'unalias' command can be used to remove aliases.<br><br>\",\r\n analyze: \"analze<br>\" +\r\n \"Prints details and statistics about the current server. The information that is printed includes basic \" +\r\n \"server details such as the hostname, whether the player has root access, what ports are opened/closed, and also \" +\r\n \"hacking-related information such as an estimated chance to successfully hack, an estimate of how much money is \" +\r\n \"available on the server, etc.\",\r\n buy: \"buy [-l / program]<br>\" +\r\n \"Purchase a program through the Dark Web. Requires a TOR router to use.<br><br>\" +\r\n \"If this command is ran with the '-l' flag, it will display a list of all programs that can be bought through the \" +\r\n \"dark web to the Terminal, as well as their costs.<br><br>\" +\r\n \"Otherwise, the name of the program must be passed in as a parameter. This is name is NOT case-sensitive.\",\r\n cat: \"cat [file]<br>\" +\r\n \"Display message (.msg), literature (.lit), or text (.txt) files. Examples:<br><br>\" +\r\n \"cat j1.msg<br>\" +\r\n \"cat foo.lit<br>\" +\r\n \"cat servers.txt\",\r\n check: \"check [script name] [args...]<br>\" +\r\n \"Print the logs of the script specified by the script name and arguments to the Terminal. Each argument must be separated by \" +\r\n \"a space. Remember that a running script is uniquely \" +\r\n \"identified both by its name and the arguments that are used to start it. So, if a script was ran with the following arguments: <br><br>\" +\r\n \"run foo.script 1 2 foodnstuff<br><br>\" +\r\n \"Then to run the 'check' command on this script you would have to pass the same arguments in: <br><br>\" +\r\n \"check foo.script 1 2 foodnstuff\",\r\n clear: \"clear<br>\" +\r\n \"Clear the Terminal screen, deleting all of the text. Note that this does not delete the user's command history, so using the up \" +\r\n \"and down arrow keys is still valid. Also note that this is permanent and there is no way to undo this. Synonymous with 'cls' command\",\r\n cls: \"cls<br>\" +\r\n \"Clear the Terminal screen, deleting all of the text. Note that this does not delete the user's command history, so using the up \" +\r\n \"and down arrow keys is still valid. Also note that this is permanent and there is no way to undo this. Synonymous with 'clear' command\",\r\n connect: \"connect [hostname/ip]<br>\" +\r\n \"Connect to a remote server. The hostname or IP address of the remote server must be given as the argument \" +\r\n \"to this command. Note that only servers that are immediately adjacent to the current server in the network can be connected to. To \" +\r\n \"see which servers can be connected to, use the 'scan' command.\",\r\n download: \"download [script/text file]<br>\" +\r\n \"Downloads a script or text file to your computer (like your real life computer).<br>\" +\r\n \"You can also download all of your scripts/text files as a zip file using the following Terminal commands:<br><br>\" +\r\n \"Download all scripts and text files: download *<br>\" +\r\n \"Download all scripts: download *.script<br>\" +\r\n \"Download all text files: download *.txt<br>\",\r\n free: \"free<br>\" +\r\n \"Display's the memory usage on the current machine. Print the amount of RAM that is available on the current server as well as \" +\r\n \"how much of it is being used.\",\r\n hack: \"hack<br>\" +\r\n \"Attempt to hack the current server. Requires root access in order to be run. See the wiki page for hacking mechanics<br>\",\r\n help: \"help [command]<br>\" +\r\n \"Display Terminal help information. Without arguments, 'help' prints a list of all valid Terminal commands and a brief \" +\r\n \"description of their functionality. You can also pass the name of a Terminal command as an argument to 'help' to print \" +\r\n \"more detailed information about the Terminal command. Examples: <br><br>\" +\r\n \"help alias<br>\" +\r\n \"help scan-analyze\",\r\n home: \"home<br>\" +\r\n \"Connect to your home computer. This will work no matter what server you are currently connected to.\",\r\n hostname: \"hostname<br>\" +\r\n \"Prints the hostname of the current server\",\r\n ifconfig: \"ipconfig<br>\" +\r\n \"Prints the IP address of the current server\",\r\n kill: \"kill [script name] [args...]<br>\" +\r\n \"Kill the script specified by the script name and arguments. Each argument must be separated by \" +\r\n \"a space. Remember that a running script is uniquely identified by \" +\r\n \"both its name and the arguments that are used to start it. So, if a script was ran with the following arguments:<br><br>\" +\r\n \"run foo.script 1 sigma-cosmetics<br><br>\" +\r\n \"Then to kill this script the same arguments would have to be used:<br><br>\" +\r\n \"kill foo.script 1 sigma-cosmetics<br><br>\" +\r\n \"Note that after issuing the 'kill' command for a script, it may take a while for the script to actually stop running. \" +\r\n \"This will happen if the script is in the middle of a command such as grow() or weaken() that takes time to execute. \" +\r\n \"The script will not be stopped/killed until after that time has elapsed.\",\r\n killall: \"killall<br>\" +\r\n \"Kills all scripts on the current server. \" +\r\n \"Note that after the 'kill' command is issued for a script, it may take a while for the script to actually stop running. \" +\r\n \"This will happen if the script is in the middle of a command such as grow() or weaken() that takes time to execute. \" +\r\n \"The script will not be stopped/killed until after that time has elapsed.\",\r\n ls: \"ls [| grep pattern]<br>\" +\r\n \"The ls command, with no arguments, prints all files on the current server to the Terminal screen. \" +\r\n \"This includes all scripts, programs, and message files. \" +\r\n \"The files will be displayed in alphabetical order. <br><br>\" +\r\n \"The '| grep pattern' optional parameter can be used to only display files whose filenames match the specified pattern. \" +\r\n \"For example, if you wanted to only display files with the .script extension, you could use: <br><br>\" +\r\n \"ls | grep .script<br><br>\" +\r\n \"Alternatively, if you wanted to display all files with the word purchase in the filename, you could use: <br><br>\" +\r\n \"ls | grep purchase\",\r\n lscpu: \"lscpu<br>\" +\r\n \"Prints the number of CPU Cores the current server has\",\r\n mem: \"mem [script name] [-t] [num threads]<br>\" +\r\n \"Displays the amount of RAM needed to run the specified script with a single thread. The command can also be used to print \" +\r\n \"the amount of RAM needed to run a script with multiple threads using the '-t' flag. If the '-t' flag is specified, then \" +\r\n \"an argument for the number of threads must be passed in afterwards. Examples:<br><br>\" +\r\n \"mem foo.script<br>\" +\r\n \"mem foo.script -t 50<br>\" +\r\n \"The first example above will print the amount of RAM needed to run 'foo.script' with a single thread. The second example \" +\r\n \"above will print the amount of RAM needed to run 'foo.script' with 50 threads.\",\r\n nano: \"nano [file name]<br>\" +\r\n \"Opens up the specified file in the Text Editor. Only scripts (.script) or text files (.txt) can be \" +\r\n \"edited using the Text Editor. If the file does not already exist, then a new, empty one \" +\r\n \"will be created\",\r\n ps: \"ps<br>\" +\r\n \"Prints all scripts that are running on the current server\",\r\n rm: \"rm [file]<br>\" +\r\n \"Removes the specified file from the current server. A file can be a script, a program, or a message file. <br><br>\" +\r\n \"WARNING: This is permanent and cannot be undone\",\r\n run: \"run [file name] [-t] [num threads] [args...]<br>\" +\r\n \"Execute a program or a script.<br><br>\" +\r\n \"The '[-t]', '[num threads]', and '[args...]' arguments are only valid when running a script. The '-t' flag is used \" +\r\n \"to indicate that the script should be run with the specified number of threads. If the flag is omitted, \" +\r\n \"then the script will be run with a single thread by default. \" +\r\n \"If the '-t' flag is used, then it MUST come immediately \" +\r\n \"after the script name, and the [num threads] argument MUST come immediately afterwards. <br><br>\" +\r\n \"[args...] represents a variable number of arguments that will be passed into the script. See the documentation \" +\r\n \"about script arguments. Each specified argument must be separated by a space. <br><br>\",\r\n scan: \"scan<br>\" +\r\n \"Prints all immediately-available network connection. This will print a list of all servers that you can currently connect \" +\r\n \"to using the 'connect' Terminal command.\",\r\n \"scan-analyze\": \"scan-analyze [depth] [-a]<br>\" +\r\n \"Prints detailed information about all servers up to [depth] nodes away on the network. Calling \" +\r\n \"'scan-analyze 1' will display information for the same servers that are shown by the 'scan' Terminal \" +\r\n \"command. This command also shows the relative paths to reach each server.<br><br>\" +\r\n \"By default, the maximum depth that can be specified for 'scan-analyze' is 3. However, once you have \" +\r\n \"the DeepscanV1.exe and DeepscanV2.exe programs, you can execute 'scan-analyze' with a depth up to \" +\r\n \"5 and 10, respectively.<br><br>\" +\r\n \"The information 'scan-analyze' displays about each server includes whether or not you have root access to it, \" +\r\n \"its required hacking level, the number of open ports required to run NUKE.exe on it, and how much RAM \" +\r\n \"it has.<br><br>\" +\r\n \"By default, this command will not display servers that you have purchased. However, you can pass in the \" +\r\n \"-a flag at the end of the command if you would like to enable that.\",\r\n scp: \"scp [filename] [target server]<br>\" +\r\n \"Copies the specified file from the current server to the target server. \" +\r\n \"This command only works for script files (.script extension), literature files (.lit extension), \" +\r\n \"and text files (.txt extension). \" +\r\n \"The second argument passed in must be the hostname or IP of the target server.\",\r\n sudov: \"sudov<br>\" +\r\n \"Prints whether or not you have root access to the current machine\",\r\n tail: \"tail [script name] [args...]<br>\" +\r\n \"Displays dynamic logs for the script specified by the script name and arguments. Each argument must be separated \" +\r\n \"by a space. Remember that a running script is uniquely identified by both its name and the arguments that were used \" +\r\n \"to run it. So, if a script was ran with the following arguments: <br><br>\" +\r\n \"run foo.script 10 50000<br><br>\" +\r\n \"Then in order to check its logs with 'tail' the same arguments must be used: <br><br>\" +\r\n \"tail foo.script 10 50000\",\r\n theme: \"theme [preset] | [#background #text #highlight]<br>\" +\r\n \"Change the color of the game's user interface<br><br>\" +\r\n \"This command can be called with a preset theme. Currently, the supported presets are 'default', 'muted', and 'solarized'. \" +\r\n \"However, you can also specify your own color scheme using hex values. To do so, you must specify three hex color values \" +\r\n \"for the background color, the text color, and the highlight color. These hex values must be preceded by a pound sign (#) and \" +\r\n \"must be either 3 or 6 digits. Example:<br><br>\" +\r\n \"theme #ffffff #385 #235012<br><br>\" +\r\n \"A color picker such as \" +\r\n \"<a href='https://www.google.com/search?q=color+picker&oq=color+picker&aqs=chrome.0.0l6.951j0j1&sourceid=chrome&ie=UTF-8' target='_blank'>Google's</a> \" +\r\n \"can be used to get your desired hex color values<br><br>\" +\r\n \"Themes are not saved, so when the game is closed and then re-opened or reloaded then it will revert back to the default theme.\",\r\n top: \"top<br>\" +\r\n \"Prints a list of all scripts running on the current server as well as their thread count and how much \" +\r\n \"RAM they are using in total.\",\r\n unalias: 'unalias \"[alias name]\"<br>' +\r\n \"Deletes the specified alias. Note that the double quotation marks are required. <br><br>\" +\r\n \"As an example, if an alias was declared using:<br><br>\" +\r\n 'alias r=\"run\"<br><br>' +\r\n \"Then it could be removed using:<br><br>\" +\r\n 'unalias \"r\"<br><br>' +\r\n \"It is not necessary to differentiate between global and non-global aliases when using 'unalias'\",\r\n\r\n}\r\n\r\nexport {TerminalHelpText, HelpTexts};\r\n","/*!\n * Chai - transferFlags utility\n * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>\n * MIT Licensed\n */\n\n/**\n * ### .transferFlags(assertion, object, includeAll = true)\n *\n * Transfer all the flags for `assertion` to `object`. If\n * `includeAll` is set to `false`, then the base Chai\n * assertion flags (namely `object`, `ssfi`, `lockSsfi`,\n * and `message`) will not be transferred.\n *\n *\n * var newAssertion = new Assertion();\n * utils.transferFlags(assertion, newAssertion);\n *\n * var anotherAsseriton = new Assertion(myObj);\n * utils.transferFlags(assertion, anotherAssertion, false);\n *\n * @param {Assertion} assertion the assertion to transfer the flags from\n * @param {Object} object the object to transfer the flags to; usually a new assertion\n * @param {Boolean} includeAll\n * @namespace Utils\n * @name transferFlags\n * @api private\n */\n\nmodule.exports = function transferFlags(assertion, object, includeAll) {\n var flags = assertion.__flags || (assertion.__flags = Object.create(null));\n\n if (!object.__flags) {\n object.__flags = Object.create(null);\n }\n\n includeAll = arguments.length === 3 ? includeAll : true;\n\n for (var flag in flags) {\n if (includeAll ||\n (flag !== 'object' && flag !== 'ssfi' && flag !== 'lockSsfi' && flag != 'message')) {\n object.__flags[flag] = flags[flag];\n }\n }\n};\n","module.exports = {\n\n /**\n * ### config.includeStack\n *\n * User configurable property, influences whether stack trace\n * is included in Assertion error message. Default of false\n * suppresses stack trace in the error message.\n *\n * chai.config.includeStack = true; // enable stack on error\n *\n * @param {Boolean}\n * @api public\n */\n\n includeStack: false,\n\n /**\n * ### config.showDiff\n *\n * User configurable property, influences whether or not\n * the `showDiff` flag should be included in the thrown\n * AssertionErrors. `false` will always be `false`; `true`\n * will be true when the assertion has requested a diff\n * be shown.\n *\n * @param {Boolean}\n * @api public\n */\n\n showDiff: true,\n\n /**\n * ### config.truncateThreshold\n *\n * User configurable property, sets length threshold for actual and\n * expected values in assertion errors. If this threshold is exceeded, for\n * example for large data structures, the value is replaced with something\n * like `[ Array(3) ]` or `{ Object (prop1, prop2) }`.\n *\n * Set it to zero if you want to disable truncating altogether.\n *\n * This is especially userful when doing assertions on arrays: having this\n * set to a reasonable large value makes the failure messages readily\n * inspectable.\n *\n * chai.config.truncateThreshold = 0; // disable truncating\n *\n * @param {Number}\n * @api public\n */\n\n truncateThreshold: 40,\n\n /**\n * ### config.useProxy\n *\n * User configurable property, defines if chai will use a Proxy to throw\n * an error when a non-existent property is read, which protects users\n * from typos when using property-based assertions.\n *\n * Set it to false if you want to disable this feature.\n *\n * chai.config.useProxy = false; // disable use of Proxy\n *\n * This feature is automatically disabled regardless of this config value\n * in environments that don't support proxies.\n *\n * @param {Boolean}\n * @api public\n */\n\n useProxy: true,\n\n /**\n * ### config.proxyExcludedKeys\n *\n * User configurable property, defines which properties should be ignored\n * instead of throwing an error if they do not exist on the assertion.\n * This is only applied if the environment Chai is running in supports proxies and\n * if the `useProxy` configuration setting is enabled.\n * By default, `then` and `inspect` will not throw an error if they do not exist on the\n * assertion object because the `.inspect` property is read by `util.inspect` (for example, when\n * using `console.log` on the assertion object) and `.then` is necessary for promise type-checking.\n *\n * // By default these keys will not throw an error if they do not exist on the assertion object\n * chai.config.proxyExcludedKeys = ['then', 'inspect'];\n *\n * @param {Array}\n * @api public\n */\n\n proxyExcludedKeys: ['then', 'inspect', 'toJSON']\n};\n","/*!\n * chai\n * Copyright(c) 2011-2014 Jake Luer <jake@alogicalparadox.com>\n * MIT Licensed\n */\n\nvar used = [];\n\n/*!\n * Chai version\n */\n\nexports.version = '4.1.2';\n\n/*!\n * Assertion Error\n */\n\nexports.AssertionError = require('assertion-error');\n\n/*!\n * Utils for plugins (not exported)\n */\n\nvar util = require('./chai/utils');\n\n/**\n * # .use(function)\n *\n * Provides a way to extend the internals of Chai.\n *\n * @param {Function}\n * @returns {this} for chaining\n * @api public\n */\n\nexports.use = function (fn) {\n if (!~used.indexOf(fn)) {\n fn(exports, util);\n used.push(fn);\n }\n\n return exports;\n};\n\n/*!\n * Utility Functions\n */\n\nexports.util = util;\n\n/*!\n * Configuration\n */\n\nvar config = require('./chai/config');\nexports.config = config;\n\n/*!\n * Primary `Assertion` prototype\n */\n\nvar assertion = require('./chai/assertion');\nexports.use(assertion);\n\n/*!\n * Core Assertions\n */\n\nvar core = require('./chai/core/assertions');\nexports.use(core);\n\n/*!\n * Expect interface\n */\n\nvar expect = require('./chai/interface/expect');\nexports.use(expect);\n\n/*!\n * Should interface\n */\n\nvar should = require('./chai/interface/should');\nexports.use(should);\n\n/*!\n * Assert interface\n */\n\nvar assert = require('./chai/interface/assert');\nexports.use(assert);\n","'use strict';\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\nmodule.exports = {\n 2: 'need dictionary', /* Z_NEED_DICT 2 */\n 1: 'stream end', /* Z_STREAM_END 1 */\n 0: '', /* Z_OK 0 */\n '-1': 'file error', /* Z_ERRNO (-1) */\n '-2': 'stream error', /* Z_STREAM_ERROR (-2) */\n '-3': 'data error', /* Z_DATA_ERROR (-3) */\n '-4': 'insufficient memory', /* Z_MEM_ERROR (-4) */\n '-5': 'buffer error', /* Z_BUF_ERROR (-5) */\n '-6': 'incompatible version' /* Z_VERSION_ERROR (-6) */\n};\n","'use strict';\n\nvar utils = require('./utils');\n\n/**\n * The following functions come from pako, from pako/lib/zlib/crc32.js\n * released under the MIT license, see pako https://github.com/nodeca/pako/\n */\n\n// Use ordinary array, since untyped makes no boost here\nfunction makeTable() {\n var c, table = [];\n\n for(var n =0; n < 256; n++){\n c = n;\n for(var k =0; k < 8; k++){\n c = ((c&1) ? (0xEDB88320 ^ (c >>> 1)) : (c >>> 1));\n }\n table[n] = c;\n }\n\n return table;\n}\n\n// Create table on load. Just 255 signed longs. Not a problem.\nvar crcTable = makeTable();\n\n\nfunction crc32(crc, buf, len, pos) {\n var t = crcTable, end = pos + len;\n\n crc = crc ^ (-1);\n\n for (var i = pos; i < end; i++ ) {\n crc = (crc >>> 8) ^ t[(crc ^ buf[i]) & 0xFF];\n }\n\n return (crc ^ (-1)); // >>> 0;\n}\n\n// That's all for the pako functions.\n\n/**\n * Compute the crc32 of a string.\n * This is almost the same as the function crc32, but for strings. Using the\n * same function for the two use cases leads to horrible performances.\n * @param {Number} crc the starting value of the crc.\n * @param {String} str the string to use.\n * @param {Number} len the length of the string.\n * @param {Number} pos the starting position for the crc32 computation.\n * @return {Number} the computed crc32.\n */\nfunction crc32str(crc, str, len, pos) {\n var t = crcTable, end = pos + len;\n\n crc = crc ^ (-1);\n\n for (var i = pos; i < end; i++ ) {\n crc = (crc >>> 8) ^ t[(crc ^ str.charCodeAt(i)) & 0xFF];\n }\n\n return (crc ^ (-1)); // >>> 0;\n}\n\nmodule.exports = function crc32wrapper(input, crc) {\n if (typeof input === \"undefined\" || !input.length) {\n return 0;\n }\n\n var isArray = utils.getTypeOf(input) !== \"string\";\n\n if(isArray) {\n return crc32(crc|0, input, input.length, 0);\n } else {\n return crc32str(crc|0, input, input.length, 0);\n }\n};\n","'use strict';\n\nvar external = require(\"./external\");\nvar DataWorker = require('./stream/DataWorker');\nvar DataLengthProbe = require('./stream/DataLengthProbe');\nvar Crc32Probe = require('./stream/Crc32Probe');\nvar DataLengthProbe = require('./stream/DataLengthProbe');\n\n/**\n * Represent a compressed object, with everything needed to decompress it.\n * @constructor\n * @param {number} compressedSize the size of the data compressed.\n * @param {number} uncompressedSize the size of the data after decompression.\n * @param {number} crc32 the crc32 of the decompressed file.\n * @param {object} compression the type of compression, see lib/compressions.js.\n * @param {String|ArrayBuffer|Uint8Array|Buffer} data the compressed data.\n */\nfunction CompressedObject(compressedSize, uncompressedSize, crc32, compression, data) {\n this.compressedSize = compressedSize;\n this.uncompressedSize = uncompressedSize;\n this.crc32 = crc32;\n this.compression = compression;\n this.compressedContent = data;\n}\n\nCompressedObject.prototype = {\n /**\n * Create a worker to get the uncompressed content.\n * @return {GenericWorker} the worker.\n */\n getContentWorker : function () {\n var worker = new DataWorker(external.Promise.resolve(this.compressedContent))\n .pipe(this.compression.uncompressWorker())\n .pipe(new DataLengthProbe(\"data_length\"));\n\n var that = this;\n worker.on(\"end\", function () {\n if(this.streamInfo['data_length'] !== that.uncompressedSize) {\n throw new Error(\"Bug : uncompressed data size mismatch\");\n }\n });\n return worker;\n },\n /**\n * Create a worker to get the compressed content.\n * @return {GenericWorker} the worker.\n */\n getCompressedWorker : function () {\n return new DataWorker(external.Promise.resolve(this.compressedContent))\n .withStreamInfo(\"compressedSize\", this.compressedSize)\n .withStreamInfo(\"uncompressedSize\", this.uncompressedSize)\n .withStreamInfo(\"crc32\", this.crc32)\n .withStreamInfo(\"compression\", this.compression)\n ;\n }\n};\n\n/**\n * Chain the given worker with other workers to compress the content with the\n * given compresion.\n * @param {GenericWorker} uncompressedWorker the worker to pipe.\n * @param {Object} compression the compression object.\n * @param {Object} compressionOptions the options to use when compressing.\n * @return {GenericWorker} the new worker compressing the content.\n */\nCompressedObject.createWorkerFrom = function (uncompressedWorker, compression, compressionOptions) {\n return uncompressedWorker\n .pipe(new Crc32Probe())\n .pipe(new DataLengthProbe(\"uncompressedSize\"))\n .pipe(compression.compressWorker(compressionOptions))\n .pipe(new DataLengthProbe(\"compressedSize\"))\n .withStreamInfo(\"compression\", compression);\n};\n\nmodule.exports = CompressedObject;\n","// Thank's IE8 for his funny defineProperty\nmodule.exports = !require('./_fails')(function(){\n return Object.defineProperty({}, 'a', {get: function(){ return 7; }}).a != 7;\n});","module.exports = function(it){\n return typeof it === 'object' ? it !== null : typeof it === 'function';\n};","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n// A bit simpler than readable streams.\n// Implement an async ._write(chunk, encoding, cb), and it'll handle all\n// the drain event emission and buffering.\n\n'use strict';\n\n/*<replacement>*/\n\nvar processNextTick = require('process-nextick-args').nextTick;\n/*</replacement>*/\n\nmodule.exports = Writable;\n\n/* <replacement> */\nfunction WriteReq(chunk, encoding, cb) {\n this.chunk = chunk;\n this.encoding = encoding;\n this.callback = cb;\n this.next = null;\n}\n\n// It seems a linked list but it is not\n// there will be only 2 of these for each stream\nfunction CorkedRequest(state) {\n var _this = this;\n\n this.next = null;\n this.entry = null;\n this.finish = function () {\n onCorkedFinish(_this, state);\n };\n}\n/* </replacement> */\n\n/*<replacement>*/\nvar asyncWrite = !process.browser && ['v0.10', 'v0.9.'].indexOf(process.version.slice(0, 5)) > -1 ? setImmediate : processNextTick;\n/*</replacement>*/\n\n/*<replacement>*/\nvar Duplex;\n/*</replacement>*/\n\nWritable.WritableState = WritableState;\n\n/*<replacement>*/\nvar util = require('core-util-is');\nutil.inherits = require('inherits');\n/*</replacement>*/\n\n/*<replacement>*/\nvar internalUtil = {\n deprecate: require('util-deprecate')\n};\n/*</replacement>*/\n\n/*<replacement>*/\nvar Stream = require('./internal/streams/stream');\n/*</replacement>*/\n\n/*<replacement>*/\n\nvar Buffer = require('safe-buffer').Buffer;\nvar OurUint8Array = global.Uint8Array || function () {};\nfunction _uint8ArrayToBuffer(chunk) {\n return Buffer.from(chunk);\n}\nfunction _isUint8Array(obj) {\n return Buffer.isBuffer(obj) || obj instanceof OurUint8Array;\n}\n\n/*</replacement>*/\n\nvar destroyImpl = require('./internal/streams/destroy');\n\nutil.inherits(Writable, Stream);\n\nfunction nop() {}\n\nfunction WritableState(options, stream) {\n Duplex = Duplex || require('./_stream_duplex');\n\n options = options || {};\n\n // Duplex streams are both readable and writable, but share\n // the same options object.\n // However, some cases require setting options to different\n // values for the readable and the writable sides of the duplex stream.\n // These options can be provided separately as readableXXX and writableXXX.\n var isDuplex = stream instanceof Duplex;\n\n // object stream flag to indicate whether or not this stream\n // contains buffers or objects.\n this.objectMode = !!options.objectMode;\n\n if (isDuplex) this.objectMode = this.objectMode || !!options.writableObjectMode;\n\n // the point at which write() starts returning false\n // Note: 0 is a valid value, means that we always return false if\n // the entire buffer is not flushed immediately on write()\n var hwm = options.highWaterMark;\n var writableHwm = options.writableHighWaterMark;\n var defaultHwm = this.objectMode ? 16 : 16 * 1024;\n\n if (hwm || hwm === 0) this.highWaterMark = hwm;else if (isDuplex && (writableHwm || writableHwm === 0)) this.highWaterMark = writableHwm;else this.highWaterMark = defaultHwm;\n\n // cast to ints.\n this.highWaterMark = Math.floor(this.highWaterMark);\n\n // if _final has been called\n this.finalCalled = false;\n\n // drain event flag.\n this.needDrain = false;\n // at the start of calling end()\n this.ending = false;\n // when end() has been called, and returned\n this.ended = false;\n // when 'finish' is emitted\n this.finished = false;\n\n // has it been destroyed\n this.destroyed = false;\n\n // should we decode strings into buffers before passing to _write?\n // this is here so that some node-core streams can optimize string\n // handling at a lower level.\n var noDecode = options.decodeStrings === false;\n this.decodeStrings = !noDecode;\n\n // Crypto is kind of old and crusty. Historically, its default string\n // encoding is 'binary' so we have to make this configurable.\n // Everything else in the universe uses 'utf8', though.\n this.defaultEncoding = options.defaultEncoding || 'utf8';\n\n // not an actual buffer we keep track of, but a measurement\n // of how much we're waiting to get pushed to some underlying\n // socket or file.\n this.length = 0;\n\n // a flag to see when we're in the middle of a write.\n this.writing = false;\n\n // when true all writes will be buffered until .uncork() call\n this.corked = 0;\n\n // a flag to be able to tell if the onwrite cb is called immediately,\n // or on a later tick. We set this to true at first, because any\n // actions that shouldn't happen until \"later\" should generally also\n // not happen before the first write call.\n this.sync = true;\n\n // a flag to know if we're processing previously buffered items, which\n // may call the _write() callback in the same tick, so that we don't\n // end up in an overlapped onwrite situation.\n this.bufferProcessing = false;\n\n // the callback that's passed to _write(chunk,cb)\n this.onwrite = function (er) {\n onwrite(stream, er);\n };\n\n // the callback that the user supplies to write(chunk,encoding,cb)\n this.writecb = null;\n\n // the amount that is being written when _write is called.\n this.writelen = 0;\n\n this.bufferedRequest = null;\n this.lastBufferedRequest = null;\n\n // number of pending user-supplied write callbacks\n // this must be 0 before 'finish' can be emitted\n this.pendingcb = 0;\n\n // emit prefinish if the only thing we're waiting for is _write cbs\n // This is relevant for synchronous Transform streams\n this.prefinished = false;\n\n // True if the error was already emitted and should not be thrown again\n this.errorEmitted = false;\n\n // count buffered requests\n this.bufferedRequestCount = 0;\n\n // allocate the first CorkedRequest, there is always\n // one allocated and free to use, and we maintain at most two\n this.corkedRequestsFree = new CorkedRequest(this);\n}\n\nWritableState.prototype.getBuffer = function getBuffer() {\n var current = this.bufferedRequest;\n var out = [];\n while (current) {\n out.push(current);\n current = current.next;\n }\n return out;\n};\n\n(function () {\n try {\n Object.defineProperty(WritableState.prototype, 'buffer', {\n get: internalUtil.deprecate(function () {\n return this.getBuffer();\n }, '_writableState.buffer is deprecated. Use _writableState.getBuffer ' + 'instead.', 'DEP0003')\n });\n } catch (_) {}\n})();\n\n// Test _writableState for inheritance to account for Duplex streams,\n// whose prototype chain only points to Readable.\nvar realHasInstance;\nif (typeof Symbol === 'function' && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] === 'function') {\n realHasInstance = Function.prototype[Symbol.hasInstance];\n Object.defineProperty(Writable, Symbol.hasInstance, {\n value: function (object) {\n if (realHasInstance.call(this, object)) return true;\n if (this !== Writable) return false;\n\n return object && object._writableState instanceof WritableState;\n }\n });\n} else {\n realHasInstance = function (object) {\n return object instanceof this;\n };\n}\n\nfunction Writable(options) {\n Duplex = Duplex || require('./_stream_duplex');\n\n // Writable ctor is applied to Duplexes, too.\n // `realHasInstance` is necessary because using plain `instanceof`\n // would return false, as no `_writableState` property is attached.\n\n // Trying to use the custom `instanceof` for Writable here will also break the\n // Node.js LazyTransform implementation, which has a non-trivial getter for\n // `_writableState` that would lead to infinite recursion.\n if (!realHasInstance.call(Writable, this) && !(this instanceof Duplex)) {\n return new Writable(options);\n }\n\n this._writableState = new WritableState(options, this);\n\n // legacy.\n this.writable = true;\n\n if (options) {\n if (typeof options.write === 'function') this._write = options.write;\n\n if (typeof options.writev === 'function') this._writev = options.writev;\n\n if (typeof options.destroy === 'function') this._destroy = options.destroy;\n\n if (typeof options.final === 'function') this._final = options.final;\n }\n\n Stream.call(this);\n}\n\n// Otherwise people can pipe Writable streams, which is just wrong.\nWritable.prototype.pipe = function () {\n this.emit('error', new Error('Cannot pipe, not readable'));\n};\n\nfunction writeAfterEnd(stream, cb) {\n var er = new Error('write after end');\n // TODO: defer error events consistently everywhere, not just the cb\n stream.emit('error', er);\n processNextTick(cb, er);\n}\n\n// Checks that a user-supplied chunk is valid, especially for the particular\n// mode the stream is in. Currently this means that `null` is never accepted\n// and undefined/non-string values are only allowed in object mode.\nfunction validChunk(stream, state, chunk, cb) {\n var valid = true;\n var er = false;\n\n if (chunk === null) {\n er = new TypeError('May not write null values to stream');\n } else if (typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {\n er = new TypeError('Invalid non-string/buffer chunk');\n }\n if (er) {\n stream.emit('error', er);\n processNextTick(cb, er);\n valid = false;\n }\n return valid;\n}\n\nWritable.prototype.write = function (chunk, encoding, cb) {\n var state = this._writableState;\n var ret = false;\n var isBuf = !state.objectMode && _isUint8Array(chunk);\n\n if (isBuf && !Buffer.isBuffer(chunk)) {\n chunk = _uint8ArrayToBuffer(chunk);\n }\n\n if (typeof encoding === 'function') {\n cb = encoding;\n encoding = null;\n }\n\n if (isBuf) encoding = 'buffer';else if (!encoding) encoding = state.defaultEncoding;\n\n if (typeof cb !== 'function') cb = nop;\n\n if (state.ended) writeAfterEnd(this, cb);else if (isBuf || validChunk(this, state, chunk, cb)) {\n state.pendingcb++;\n ret = writeOrBuffer(this, state, isBuf, chunk, encoding, cb);\n }\n\n return ret;\n};\n\nWritable.prototype.cork = function () {\n var state = this._writableState;\n\n state.corked++;\n};\n\nWritable.prototype.uncork = function () {\n var state = this._writableState;\n\n if (state.corked) {\n state.corked--;\n\n if (!state.writing && !state.corked && !state.finished && !state.bufferProcessing && state.bufferedRequest) clearBuffer(this, state);\n }\n};\n\nWritable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) {\n // node::ParseEncoding() requires lower case.\n if (typeof encoding === 'string') encoding = encoding.toLowerCase();\n if (!(['hex', 'utf8', 'utf-8', 'ascii', 'binary', 'base64', 'ucs2', 'ucs-2', 'utf16le', 'utf-16le', 'raw'].indexOf((encoding + '').toLowerCase()) > -1)) throw new TypeError('Unknown encoding: ' + encoding);\n this._writableState.defaultEncoding = encoding;\n return this;\n};\n\nfunction decodeChunk(state, chunk, encoding) {\n if (!state.objectMode && state.decodeStrings !== false && typeof chunk === 'string') {\n chunk = Buffer.from(chunk, encoding);\n }\n return chunk;\n}\n\n// if we're already writing something, then just put this\n// in the queue, and wait our turn. Otherwise, call _write\n// If we return false, then we need a drain event, so set that flag.\nfunction writeOrBuffer(stream, state, isBuf, chunk, encoding, cb) {\n if (!isBuf) {\n var newChunk = decodeChunk(state, chunk, encoding);\n if (chunk !== newChunk) {\n isBuf = true;\n encoding = 'buffer';\n chunk = newChunk;\n }\n }\n var len = state.objectMode ? 1 : chunk.length;\n\n state.length += len;\n\n var ret = state.length < state.highWaterMark;\n // we must ensure that previous needDrain will not be reset to false.\n if (!ret) state.needDrain = true;\n\n if (state.writing || state.corked) {\n var last = state.lastBufferedRequest;\n state.lastBufferedRequest = {\n chunk: chunk,\n encoding: encoding,\n isBuf: isBuf,\n callback: cb,\n next: null\n };\n if (last) {\n last.next = state.lastBufferedRequest;\n } else {\n state.bufferedRequest = state.lastBufferedRequest;\n }\n state.bufferedRequestCount += 1;\n } else {\n doWrite(stream, state, false, len, chunk, encoding, cb);\n }\n\n return ret;\n}\n\nfunction doWrite(stream, state, writev, len, chunk, encoding, cb) {\n state.writelen = len;\n state.writecb = cb;\n state.writing = true;\n state.sync = true;\n if (writev) stream._writev(chunk, state.onwrite);else stream._write(chunk, encoding, state.onwrite);\n state.sync = false;\n}\n\nfunction onwriteError(stream, state, sync, er, cb) {\n --state.pendingcb;\n\n if (sync) {\n // defer the callback if we are being called synchronously\n // to avoid piling up things on the stack\n processNextTick(cb, er);\n // this can emit finish, and it will always happen\n // after error\n processNextTick(finishMaybe, stream, state);\n stream._writableState.errorEmitted = true;\n stream.emit('error', er);\n } else {\n // the caller expect this to happen before if\n // it is async\n cb(er);\n stream._writableState.errorEmitted = true;\n stream.emit('error', er);\n // this can emit finish, but finish must\n // always follow error\n finishMaybe(stream, state);\n }\n}\n\nfunction onwriteStateUpdate(state) {\n state.writing = false;\n state.writecb = null;\n state.length -= state.writelen;\n state.writelen = 0;\n}\n\nfunction onwrite(stream, er) {\n var state = stream._writableState;\n var sync = state.sync;\n var cb = state.writecb;\n\n onwriteStateUpdate(state);\n\n if (er) onwriteError(stream, state, sync, er, cb);else {\n // Check if we're actually ready to finish, but don't emit yet\n var finished = needFinish(state);\n\n if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) {\n clearBuffer(stream, state);\n }\n\n if (sync) {\n /*<replacement>*/\n asyncWrite(afterWrite, stream, state, finished, cb);\n /*</replacement>*/\n } else {\n afterWrite(stream, state, finished, cb);\n }\n }\n}\n\nfunction afterWrite(stream, state, finished, cb) {\n if (!finished) onwriteDrain(stream, state);\n state.pendingcb--;\n cb();\n finishMaybe(stream, state);\n}\n\n// Must force callback to be called on nextTick, so that we don't\n// emit 'drain' before the write() consumer gets the 'false' return\n// value, and has a chance to attach a 'drain' listener.\nfunction onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n}\n\n// if there's something in the buffer waiting, then process it\nfunction clearBuffer(stream, state) {\n state.bufferProcessing = true;\n var entry = state.bufferedRequest;\n\n if (stream._writev && entry && entry.next) {\n // Fast case, write everything using _writev()\n var l = state.bufferedRequestCount;\n var buffer = new Array(l);\n var holder = state.corkedRequestsFree;\n holder.entry = entry;\n\n var count = 0;\n var allBuffers = true;\n while (entry) {\n buffer[count] = entry;\n if (!entry.isBuf) allBuffers = false;\n entry = entry.next;\n count += 1;\n }\n buffer.allBuffers = allBuffers;\n\n doWrite(stream, state, true, state.length, buffer, '', holder.finish);\n\n // doWrite is almost always async, defer these to save a bit of time\n // as the hot path ends with doWrite\n state.pendingcb++;\n state.lastBufferedRequest = null;\n if (holder.next) {\n state.corkedRequestsFree = holder.next;\n holder.next = null;\n } else {\n state.corkedRequestsFree = new CorkedRequest(state);\n }\n state.bufferedRequestCount = 0;\n } else {\n // Slow case, write chunks one-by-one\n while (entry) {\n var chunk = entry.chunk;\n var encoding = entry.encoding;\n var cb = entry.callback;\n var len = state.objectMode ? 1 : chunk.length;\n\n doWrite(stream, state, false, len, chunk, encoding, cb);\n entry = entry.next;\n state.bufferedRequestCount--;\n // if we didn't call the onwrite immediately, then\n // it means that we need to wait until it does.\n // also, that means that the chunk and cb are currently\n // being processed, so move the buffer counter past them.\n if (state.writing) {\n break;\n }\n }\n\n if (entry === null) state.lastBufferedRequest = null;\n }\n\n state.bufferedRequest = entry;\n state.bufferProcessing = false;\n}\n\nWritable.prototype._write = function (chunk, encoding, cb) {\n cb(new Error('_write() is not implemented'));\n};\n\nWritable.prototype._writev = null;\n\nWritable.prototype.end = function (chunk, encoding, cb) {\n var state = this._writableState;\n\n if (typeof chunk === 'function') {\n cb = chunk;\n chunk = null;\n encoding = null;\n } else if (typeof encoding === 'function') {\n cb = encoding;\n encoding = null;\n }\n\n if (chunk !== null && chunk !== undefined) this.write(chunk, encoding);\n\n // .end() fully uncorks\n if (state.corked) {\n state.corked = 1;\n this.uncork();\n }\n\n // ignore unnecessary end() calls.\n if (!state.ending && !state.finished) endWritable(this, state, cb);\n};\n\nfunction needFinish(state) {\n return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing;\n}\nfunction callFinal(stream, state) {\n stream._final(function (err) {\n state.pendingcb--;\n if (err) {\n stream.emit('error', err);\n }\n state.prefinished = true;\n stream.emit('prefinish');\n finishMaybe(stream, state);\n });\n}\nfunction prefinish(stream, state) {\n if (!state.prefinished && !state.finalCalled) {\n if (typeof stream._final === 'function') {\n state.pendingcb++;\n state.finalCalled = true;\n processNextTick(callFinal, stream, state);\n } else {\n state.prefinished = true;\n stream.emit('prefinish');\n }\n }\n}\n\nfunction finishMaybe(stream, state) {\n var need = needFinish(state);\n if (need) {\n prefinish(stream, state);\n if (state.pendingcb === 0) {\n state.finished = true;\n stream.emit('finish');\n }\n }\n return need;\n}\n\nfunction endWritable(stream, state, cb) {\n state.ending = true;\n finishMaybe(stream, state);\n if (cb) {\n if (state.finished) processNextTick(cb);else stream.once('finish', cb);\n }\n state.ended = true;\n stream.writable = false;\n}\n\nfunction onCorkedFinish(corkReq, state, err) {\n var entry = corkReq.entry;\n corkReq.entry = null;\n while (entry) {\n var cb = entry.callback;\n state.pendingcb--;\n cb(err);\n entry = entry.next;\n }\n if (state.corkedRequestsFree) {\n state.corkedRequestsFree.next = corkReq;\n } else {\n state.corkedRequestsFree = corkReq;\n }\n}\n\nObject.defineProperty(Writable.prototype, 'destroyed', {\n get: function () {\n if (this._writableState === undefined) {\n return false;\n }\n return this._writableState.destroyed;\n },\n set: function (value) {\n // we ignore the value if the stream\n // has not been initialized yet\n if (!this._writableState) {\n return;\n }\n\n // backward compatibility, the user is explicitly\n // managing destroyed\n this._writableState.destroyed = value;\n }\n});\n\nWritable.prototype.destroy = destroyImpl.destroy;\nWritable.prototype._undestroy = destroyImpl.undestroy;\nWritable.prototype._destroy = function (err, cb) {\n this.end();\n cb(err);\n};","exports = module.exports = require('./lib/_stream_readable.js');\nexports.Stream = exports;\nexports.Readable = exports;\nexports.Writable = require('./lib/_stream_writable.js');\nexports.Duplex = require('./lib/_stream_duplex.js');\nexports.Transform = require('./lib/_stream_transform.js');\nexports.PassThrough = require('./lib/_stream_passthrough.js');\n","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\nfunction EventEmitter() {\n this._events = this._events || {};\n this._maxListeners = this._maxListeners || undefined;\n}\nmodule.exports = EventEmitter;\n\n// Backwards-compat with node 0.10.x\nEventEmitter.EventEmitter = EventEmitter;\n\nEventEmitter.prototype._events = undefined;\nEventEmitter.prototype._maxListeners = undefined;\n\n// By default EventEmitters will print a warning if more than 10 listeners are\n// added to it. This is a useful default which helps finding memory leaks.\nEventEmitter.defaultMaxListeners = 10;\n\n// Obviously not all Emitters should be limited to 10. This function allows\n// that to be increased. Set to zero for unlimited.\nEventEmitter.prototype.setMaxListeners = function(n) {\n if (!isNumber(n) || n < 0 || isNaN(n))\n throw TypeError('n must be a positive number');\n this._maxListeners = n;\n return this;\n};\n\nEventEmitter.prototype.emit = function(type) {\n var er, handler, len, args, i, listeners;\n\n if (!this._events)\n this._events = {};\n\n // If there is no 'error' event listener then throw.\n if (type === 'error') {\n if (!this._events.error ||\n (isObject(this._events.error) && !this._events.error.length)) {\n er = arguments[1];\n if (er instanceof Error) {\n throw er; // Unhandled 'error' event\n } else {\n // At least give some kind of context to the user\n var err = new Error('Uncaught, unspecified \"error\" event. (' + er + ')');\n err.context = er;\n throw err;\n }\n }\n }\n\n handler = this._events[type];\n\n if (isUndefined(handler))\n return false;\n\n if (isFunction(handler)) {\n switch (arguments.length) {\n // fast cases\n case 1:\n handler.call(this);\n break;\n case 2:\n handler.call(this, arguments[1]);\n break;\n case 3:\n handler.call(this, arguments[1], arguments[2]);\n break;\n // slower\n default:\n args = Array.prototype.slice.call(arguments, 1);\n handler.apply(this, args);\n }\n } else if (isObject(handler)) {\n args = Array.prototype.slice.call(arguments, 1);\n listeners = handler.slice();\n len = listeners.length;\n for (i = 0; i < len; i++)\n listeners[i].apply(this, args);\n }\n\n return true;\n};\n\nEventEmitter.prototype.addListener = function(type, listener) {\n var m;\n\n if (!isFunction(listener))\n throw TypeError('listener must be a function');\n\n if (!this._events)\n this._events = {};\n\n // To avoid recursion in the case that type === \"newListener\"! Before\n // adding it to the listeners, first emit \"newListener\".\n if (this._events.newListener)\n this.emit('newListener', type,\n isFunction(listener.listener) ?\n listener.listener : listener);\n\n if (!this._events[type])\n // Optimize the case of one listener. Don't need the extra array object.\n this._events[type] = listener;\n else if (isObject(this._events[type]))\n // If we've already got an array, just append.\n this._events[type].push(listener);\n else\n // Adding the second element, need to change to array.\n this._events[type] = [this._events[type], listener];\n\n // Check for listener leak\n if (isObject(this._events[type]) && !this._events[type].warned) {\n if (!isUndefined(this._maxListeners)) {\n m = this._maxListeners;\n } else {\n m = EventEmitter.defaultMaxListeners;\n }\n\n if (m && m > 0 && this._events[type].length > m) {\n this._events[type].warned = true;\n console.error('(node) warning: possible EventEmitter memory ' +\n 'leak detected. %d listeners added. ' +\n 'Use emitter.setMaxListeners() to increase limit.',\n this._events[type].length);\n if (typeof console.trace === 'function') {\n // not supported in IE 10\n console.trace();\n }\n }\n }\n\n return this;\n};\n\nEventEmitter.prototype.on = EventEmitter.prototype.addListener;\n\nEventEmitter.prototype.once = function(type, listener) {\n if (!isFunction(listener))\n throw TypeError('listener must be a function');\n\n var fired = false;\n\n function g() {\n this.removeListener(type, g);\n\n if (!fired) {\n fired = true;\n listener.apply(this, arguments);\n }\n }\n\n g.listener = listener;\n this.on(type, g);\n\n return this;\n};\n\n// emits a 'removeListener' event iff the listener was removed\nEventEmitter.prototype.removeListener = function(type, listener) {\n var list, position, length, i;\n\n if (!isFunction(listener))\n throw TypeError('listener must be a function');\n\n if (!this._events || !this._events[type])\n return this;\n\n list = this._events[type];\n length = list.length;\n position = -1;\n\n if (list === listener ||\n (isFunction(list.listener) && list.listener === listener)) {\n delete this._events[type];\n if (this._events.removeListener)\n this.emit('removeListener', type, listener);\n\n } else if (isObject(list)) {\n for (i = length; i-- > 0;) {\n if (list[i] === listener ||\n (list[i].listener && list[i].listener === listener)) {\n position = i;\n break;\n }\n }\n\n if (position < 0)\n return this;\n\n if (list.length === 1) {\n list.length = 0;\n delete this._events[type];\n } else {\n list.splice(position, 1);\n }\n\n if (this._events.removeListener)\n this.emit('removeListener', type, listener);\n }\n\n return this;\n};\n\nEventEmitter.prototype.removeAllListeners = function(type) {\n var key, listeners;\n\n if (!this._events)\n return this;\n\n // not listening for removeListener, no need to emit\n if (!this._events.removeListener) {\n if (arguments.length === 0)\n this._events = {};\n else if (this._events[type])\n delete this._events[type];\n return this;\n }\n\n // emit removeListener for all listeners on all events\n if (arguments.length === 0) {\n for (key in this._events) {\n if (key === 'removeListener') continue;\n this.removeAllListeners(key);\n }\n this.removeAllListeners('removeListener');\n this._events = {};\n return this;\n }\n\n listeners = this._events[type];\n\n if (isFunction(listeners)) {\n this.removeListener(type, listeners);\n } else if (listeners) {\n // LIFO order\n while (listeners.length)\n this.removeListener(type, listeners[listeners.length - 1]);\n }\n delete this._events[type];\n\n return this;\n};\n\nEventEmitter.prototype.listeners = function(type) {\n var ret;\n if (!this._events || !this._events[type])\n ret = [];\n else if (isFunction(this._events[type]))\n ret = [this._events[type]];\n else\n ret = this._events[type].slice();\n return ret;\n};\n\nEventEmitter.prototype.listenerCount = function(type) {\n if (this._events) {\n var evlistener = this._events[type];\n\n if (isFunction(evlistener))\n return 1;\n else if (evlistener)\n return evlistener.length;\n }\n return 0;\n};\n\nEventEmitter.listenerCount = function(emitter, type) {\n return emitter.listenerCount(type);\n};\n\nfunction isFunction(arg) {\n return typeof arg === 'function';\n}\n\nfunction isNumber(arg) {\n return typeof arg === 'number';\n}\n\nfunction isObject(arg) {\n return typeof arg === 'object' && arg !== null;\n}\n\nfunction isUndefined(arg) {\n return arg === void 0;\n}\n","module.exports = function() {\r\n\tthrow new Error(\"define cannot be used indirect\");\r\n};\r\n","import {registerEnv, unregisterEnv, makeEnvHeader} from \"./NetscriptJSPreamble.js\";\r\nimport {makeRuntimeRejectMsg} from \"./NetscriptEvaluator.js\";\r\n\r\n// Makes a blob that contains the code of a given script.\r\nexport function makeScriptBlob(code) {\r\n return new Blob([code], {type: \"text/javascript\"});\r\n}\r\n\r\n// Begin executing a user JS script, and return a promise that resolves\r\n// or rejects when the script finishes.\r\n// - script is a script to execute (see Script.js). We depend only on .filename and .code.\r\n// scripts is an array of other scripts on the server.\r\n// env is the global environment that should be visible to all the scripts\r\n// (i.e. hack, grow, etc.).\r\n// When the promise returned by this resolves, we'll have finished\r\n// running the main function of the script.\r\nexport async function executeJSScript(scripts = [], workerScript) {\r\n let loadedModule;\r\n let urlStack = null;\r\n let script = workerScript.getScript();\r\n if (script.module === \"\") {\r\n // The URL at the top is the one we want to import. It will\r\n // recursively import all the other modules in the urlStack.\r\n //\r\n // Webpack likes to turn the import into a require, which sort of\r\n // but not really behaves like import. Particularly, it cannot\r\n // load fully dynamic content. So we hide the import from webpack\r\n // by placing it inside an eval call.\r\n urlStack = _getScriptUrls(script, scripts, []);\r\n script.module = await eval('import(urlStack[urlStack.length - 1])');\r\n }\r\n loadedModule = script.module;\r\n\r\n let ns = workerScript.env.vars;\r\n //ns.threads = workerScript.threads;\r\n //ns.args = workerScript.args;\r\n\r\n try {\r\n // TODO: putting await in a non-async function yields unhelpful\r\n // \"SyntaxError: unexpected reserved word\" with no line number information.\r\n if (!loadedModule.main) {\r\n throw makeRuntimeRejectMsg(script.filename +\r\n \" did not have a main function, cannot run it.\");\r\n }\r\n return loadedModule.main(ns);\r\n } finally {\r\n // Revoke the generated URLs\r\n if (urlStack != null) {\r\n for (const url in urlStack) URL.revokeObjectURL(url);\r\n }\r\n };\r\n}\r\n\r\n// Gets a stack of blob urls, the top/right-most element being\r\n// the blob url for the named script on the named server.\r\n//\r\n// - script -- the script for whom we are getting a URL.\r\n// - scripts -- all the scripts available on this server\r\n// - envHeader -- the preamble that goes at the start of every NSJS script.\r\n// - seen -- The modules above this one -- to prevent mutual dependency.\r\n//\r\n// TODO We don't make any effort to cache a given module when it is imported at\r\n// different parts of the tree. That hasn't presented any problem with during\r\n// testing, but it might be an idea for the future. Would require a topo-sort\r\n// then url-izing from leaf-most to root-most.\r\nfunction _getScriptUrls(script, scripts, seen) {\r\n // Inspired by: https://stackoverflow.com/a/43834063/91401\r\n const urlStack = [];\r\n seen.push(script);\r\n try {\r\n // Replace every import statement with an import to a blob url containing\r\n // the corresponding script. E.g.\r\n //\r\n // import {foo} from \"bar.js\";\r\n //\r\n // becomes\r\n //\r\n // import {foo} from \"blob://<uuid>\"\r\n //\r\n // Where the blob URL contains the script content.\r\n const transformedCode = script.code.replace(/((?:from|import)\\s+(?:'|\"))([^'\"]+)('|\";)/g,\r\n (unmodified, prefix, filename, suffix) => {\r\n const isAllowedImport = scripts.some(s => s.filename == filename);\r\n if (!isAllowedImport) return unmodified;\r\n\r\n // Find the corresponding script.\r\n const [importedScript] = scripts.filter(s => s.filename == filename);\r\n\r\n // Try to get a URL for the requested script and its dependencies.\r\n const urls = _getScriptUrls(importedScript, scripts, seen);\r\n\r\n // The top url in the stack is the replacement import file for this script.\r\n urlStack.push(...urls);\r\n return [prefix, urls[urls.length - 1], suffix].join('');\r\n });\r\n\r\n\r\n // If we successfully transformed the code, create a blob url for it and\r\n // push that URL onto the top of the stack.\r\n urlStack.push(URL.createObjectURL(makeScriptBlob(transformedCode)));\r\n return urlStack;\r\n } catch (err) {\r\n // If there is an error, we need to clean up the URLs.\r\n for (const url in urlStack) URL.revokeObjectURL(url);\r\n throw err;\r\n } finally {\r\n seen.pop();\r\n }\r\n}\r\n","import {CONSTANTS} from \"./Constants.js\";\r\nimport {Player} from \"./Player.js\";\r\nimport {Server, AllServers, AddToAllServers} from \"./Server.js\";\r\nimport {dialogBoxCreate} from \"../utils/DialogBox.js\";\r\nimport {createRandomIp} from \"../utils/IPAddress.js\";\r\nimport {yesNoTxtInpBoxGetInput} from \"../utils/YesNoBox.js\";\r\n\r\n\r\n/* Functions to handle any server-related purchasing:\r\n * Purchasing new servers\r\n * Purchasing more RAM for home computer\r\n */\r\nfunction purchaseServer(ram, cost) {\r\n //Check if player has enough money\r\n if (Player.money.lt(cost)) {\r\n dialogBoxCreate(\"You don't have enough money to purchase this server!\");\r\n return;\r\n }\r\n\r\n //Maximum server limit\r\n if (Player.purchasedServers.length >= CONSTANTS.PurchasedServerLimit) {\r\n dialogBoxCreate(\"You have reached the maximum limit of \" + CONSTANTS.PurchasedServerLimit + \" servers. \" +\r\n \"You cannot purchase any more. You can \" +\r\n \"delete some of your purchased servers using the deleteServer() Netscript function in a script\");\r\n return;\r\n }\r\n\r\n var hostname = yesNoTxtInpBoxGetInput();\r\n if (hostname == \"\") {\r\n dialogBoxCreate(\"You must enter a hostname for your new server!\");\r\n return;\r\n }\r\n\r\n //Create server\r\n var newServ = new Server({\r\n ip:createRandomIp(), hostname:hostname, organizationName:\"\",\r\n isConnectedTo:false, adminRights:true, purchasedByPlayer:true, maxRam:ram\r\n });\r\n AddToAllServers(newServ);\r\n\r\n //Add to Player's purchasedServers array\r\n Player.purchasedServers.push(newServ.ip);\r\n\r\n //Connect new server to home computer\r\n var homeComputer = Player.getHomeComputer();\r\n homeComputer.serversOnNetwork.push(newServ.ip);\r\n newServ.serversOnNetwork.push(homeComputer.ip);\r\n\r\n Player.loseMoney(cost);\r\n\r\n dialogBoxCreate(\"Server successfully purchased with hostname \" + hostname);\r\n}\r\n\r\n\r\nfunction purchaseRamForHomeComputer(cost) {\r\n if (Player.money.lt(cost)) {\r\n dialogBoxCreate(\"You do not have enough money to purchase additional RAM for your home computer\");\r\n return;\r\n }\r\n\r\n var homeComputer = Player.getHomeComputer();\r\n homeComputer.maxRam *= 2;\r\n\r\n Player.loseMoney(cost);\r\n\r\n dialogBoxCreate(\"Purchased additional RAM for home computer! It now has \" + homeComputer.maxRam + \"GB of RAM.\");\r\n}\r\n\r\nexport {purchaseServer, purchaseRamForHomeComputer};\r\n","//Contains the \"information\" property for all the Factions, which is just a description\r\n//of each faction\r\nfunction FactionInfo(infoText, enemies, offerHackingMission, offerHackingWork, offerFieldWork, offerSecurityWork) {\r\n this.infoText = infoText;\r\n this.enemies = enemies;\r\n this.offerHackingMission = offerHackingMission;\r\n this.offerHackingWork = offerHackingWork;\r\n this.offerFieldWork = offerFieldWork;\r\n this.offerSecurityWork = offerSecurityWork;\r\n\r\n // these are always all 1 for now.\r\n this.augmentationPriceMult = 1;\r\n this.augmentationRepRequirementMult = 1;\r\n}\r\n\r\nconst FactionInfos = {\r\n //Endgame\r\n \"Illuminati\": new FactionInfo(\"Humanity never changes. No matter how civilized society becomes, it will eventually fall back \" +\r\n \"into chaos. And from this chaos, we are the Invisible hand that guides them to order. \", [], true, true, true, false),\r\n\r\n \"Daedalus\": new FactionInfo(\"Yesterday we obeyed kings and bent our necks to emperors. Today we kneel only to truth.\", [], true, true, true, false),\r\n\r\n \"The Covenant\": new FactionInfo(\"Surrender yourself. Give up your empty individuality to become part of something great, something eternal. \" +\r\n \"Become a slave. Submit your mind, body, and soul. Only then can you set yourself free.<br><br> \" +\r\n \"Only then can you discover immortality.\", [], true, true, true, false),\r\n\r\n //Megacorporations, each forms its own faction\r\n \"ECorp\": new FactionInfo(\"ECorp's mission is simple: to connect the world of today with the technology of tomorrow. \" +\r\n \"With our wide range of Internet-related software and commercial hardware, ECorp makes the world's \" +\r\n \"information universally accessible.\", [], true, true, true, true),\r\n\r\n \"MegaCorp\": new FactionInfo(\"MegaCorp does things that others don't. We imagine. We create. We invent. We build things that \" +\r\n \"others have never even dreamed of. Our work fills the world's needs for food, water, power, and \" +\r\n \"transporation on an unprecendented scale, in ways that no other company can.<br><br>\" +\r\n \"In our labs and factories and on the ground with customers, MegaCorp is ushering in a new era for the world.\", [], true, true, true, true),\r\n\r\n \"Bachman & Associates\": new FactionInfo(\"Where Law and Business meet - thats where we are. <br><br>\" +\r\n \"Legal Insight - Business Instinct - Experience Innovation\", [], true, true, true, true),\r\n\r\n \"Blade Industries\": new FactionInfo(\"Augmentation is salvation\", [], true, true, true, true),\r\n\r\n \"NWO\": new FactionInfo(\"The human being does not truly desire freedom. It wants \" +\r\n \"to be observed, understood, and judged. It wants to be given purpose and \" +\r\n \"direction in its life. That is why humans created God. \" +\r\n \"And that is why humans created civilization - \" +\r\n \"not because of willingness, \" +\r\n \"but because of a need to be incorporated into higher orders of structure and meaning.\", [], true, true, true, true),\r\n\r\n \"Clarke Incorporated\": new FactionInfo(\"Unlocking the power of the genome\", [], true, true, true, true),\r\n\r\n \"OmniTek Incorporated\": new FactionInfo(\"Simply put, our mission is to design and build robots that make a difference\", [], true, true, true, true),\r\n\r\n \"Four Sigma\": new FactionInfo(\"The scientific method is the best way to approach investing. Big strategies backed up with big data. Driven by \" +\r\n \"deep learning and innovative ideas. And improved by iteration. That's Four Sigma.\", [], true, true, true, true),\r\n\r\n \"KuaiGong International\": new FactionInfo(\"Dream big. Work hard. Make history.\", [], true, true, true, true),\r\n\r\n //Other Corporations\r\n \"Fulcrum Secret Technologies\": new FactionInfo(\"The human organism has an innate desire to worship. \" +\r\n \"That is why they created gods. If there were no gods, \" +\r\n \"it would be necessary to create them. And now we can.\", [], true, true, false, true),\r\n\r\n //Hacker groups\r\n \"BitRunners\": new FactionInfo(\"Our entire lives are controlled by bits. All of our actions, our thoughts, our personal information. \"+\r\n \"It's all transformed into bits, stored in bits, communicated through bits. Its impossible for any person \" +\r\n \"to move, to live, to operate at any level without the use of bits. \" +\r\n \"And when a person moves, lives, and operates, they leave behind their bits, mere traces of seemingly \" +\r\n \"meaningless fragments of information. But these bits can be reconstructed. Transformed. Used.<br><br>\" +\r\n \"Those who run the bits, run the world\", [], true, true, false, false),\r\n\r\n\r\n \"The Black Hand\": new FactionInfo(\"The world, so afraid of strong government, now has no government. Only power - Digital power. Financial power. \" +\r\n \"Technological power. \" +\r\n \"And those at the top rule with an invisible hand. They built a society where the rich get richer, \" +\r\n \"and everyone else suffers.<br><br>\" +\r\n \"So much pain. So many lives. Their darkness must end.\", [], true, true, true, false),\r\n\r\n \"NiteSec\": new FactionInfo(\r\n\" __..__ <br>\" +\r\n\" _.nITESECNIt. <br>\" +\r\n\" .-'NITESECNITESEc. <br>\" +\r\n\" .' NITESECNITESECn <br>\" +\r\n\" / NITESECNITESEC; <br>\" +\r\n\" : :NITESECNITESEC; <br>\" +\r\n\" ; $ NITESECNITESECN <br>\" +\r\n\" : _, ,N'ITESECNITESEC <br>\" +\r\n\" : .+^^`, : `NITESECNIT <br>\" +\r\n\" ) /), `-,-=,NITESECNI <br>\" +\r\n\" / ^ ,-;|NITESECN; <br>\" +\r\n\" / _.' '-';NITESECN <br>\" +\r\n\" ( , ,-''`^NITE' <br>\" +\r\n\" )` :`. .' <br>\" +\r\n\" )-- ; `- / <br>\" +\r\n\" \\' _.-' : <br>\" +\r\n\" ( _.-' \\. \\ <br>\" +\r\n\" \\------. \\ \\ <br>\" +\r\n\" \\. \\ \\ <br>\" +\r\n\" \\ _.nIt <br>\" +\r\n\" \\ _.nITESECNi <br>\" +\r\n\" nITESECNIT^' \\ <br>\" +\r\n\" NITE^' ___ \\ <br>\" +\r\n\" / .gP''''Tp. \\ <br>\" +\r\n\" : d' . `b \\ <br>\" +\r\n\" ; d' o `b ; <br>\" +\r\n\" / d; `b| <br>\" +\r\n\" /, $; @ `: <br>\" +\r\n\" /' $$ ; <br>\" +\r\n\" .' $$b o | <br>\" +\r\n\" .' d$$$; : <br>\" +\r\n\" / .d$$$$; , ; <br>\" +\r\n\" d .dNITESEC $ | <br>\" +\r\n\" :bp.__.gNITESEC$$ :$ ; <br>\" +\r\n\" NITESECNITESECNIT $$b : <br>\", [], true, true, false, false),\r\n\r\n //City factions, essentially governments\r\n \"Chongqing\": new FactionInfo(\"Serve the people\", [\"Sector-12\", \"Aevum\", \"Volhaven\"], true, true, true, true),\r\n \"Sector-12\": new FactionInfo(\"The City of the Future\", [\"Chongqing\", \"New Tokyo\", \"Ishima\", \"Volhaven\"], true, true, true, true),\r\n \"New Tokyo\": new FactionInfo(\"Asia's World City\", [\"Sector-12\", \"Aevum\", \"Volhaven\"], true, true, true, true),\r\n \"Aevum\": new FactionInfo(\"The Silicon City\", [\"Chongqing\", \"New Tokyo\", \"Ishima\", \"Volhaven\"], true, true, true, true),\r\n \"Ishima\": new FactionInfo(\"The East Asian Order of the Future\", [\"Sector-12\", \"Aevum\", \"Volhaven\"], true, true, true, true),\r\n \"Volhaven\": new FactionInfo(\"Benefit, Honour, and Glory\", [\"Chongqing\", \"Sector-12\", \"New Tokyo\", \"Aevum\", \"Ishima\"], true, true, true, true),\r\n\r\n //Criminal Organizations/Gangs\r\n \"Speakers for the Dead\": new FactionInfo(\"It is better to reign in hell than to serve in heaven.\", [], true, true, true, true),\r\n\r\n \"The Dark Army\": new FactionInfo(\"The World doesn't care about right or wrong. It's all about power.\", [], true, true, true, false),\r\n\r\n \"The Syndicate\": new FactionInfo(\"Honor holds you back\", [], true, true, true, true),\r\n\r\n \"Silhouette\": new FactionInfo(\"Corporations have filled the void of power left behind by the collapse of Western government. The issue is they've become so big \" +\r\n \"that you don't know who they're working for. And if you're employed at one of these corporations, you don't even know who you're working \" +\r\n \"for.\\n\\n\" +\r\n \"That's terror. Terror, fear, and corruption. All born into the system, all propagated by the system.\", [], true, true, true, false),\r\n\r\n \"Tetrads\": new FactionInfo(\"Following the Mandate of Heaven and Carrying out the Way\", [], false, false, true, true),\r\n\r\n \"Slum Snakes\": new FactionInfo(\"Slum Snakes rule!\", [], false, false, true, true),\r\n\r\n //Earlygame factions - factions the player will prestige with early on that don't\r\n //belong in other categories\r\n \"Netburners\": new FactionInfo(\"~~//*>H4CK|\\|3T 8URN3R5**>?>\\\\~~\", [], true, true, false, false),\r\n\r\n \"Tian Di Hui\": new FactionInfo(\"Obey Heaven and Work Righteousness\", [], true, true, false, true),\r\n\r\n \"CyberSec\": new FactionInfo(\"The Internet is the first thing that humanity has built that humanity doesnt understand, \" +\r\n \"the largest experiment in anarchy that we have ever had. And as the world becomes increasingly \" +\r\n \"dominated by the internet, society approaches the brink of total chaos. \" +\r\n \"We serve only to protect society, to protect humanity, to protect the world from its imminent collapse.\", [], true, true, false, false),\r\n\r\n //Special Factions\r\n \"Bladeburners\": new FactionInfo(\"It's too bad they won't live. But then again, who does?<br><br>\" +\r\n \"Note that for this faction, reputation can only be gained through Bladeburner actions. Completing \" +\r\n \"Bladeburner contracts/operations will increase your reputation.\", [], false, false, false, false),\r\n}\r\n\r\nexport {FactionInfos};\r\n","'use strict';\nvar ArrayReader = require('./ArrayReader');\nvar utils = require('../utils');\n\nfunction Uint8ArrayReader(data) {\n ArrayReader.call(this, data);\n}\nutils.inherits(Uint8ArrayReader, ArrayReader);\n/**\n * @see DataReader.readData\n */\nUint8ArrayReader.prototype.readData = function(size) {\n this.checkOffset(size);\n if(size === 0) {\n // in IE10, when using subarray(idx, idx), we get the array [0x00] instead of [].\n return new Uint8Array(0);\n }\n var result = this.data.subarray(this.zero + this.index, this.zero + this.index + size);\n this.index += size;\n return result;\n};\nmodule.exports = Uint8ArrayReader;\n","'use strict';\nvar utils = require('../utils');\n\nfunction DataReader(data) {\n this.data = data; // type : see implementation\n this.length = data.length;\n this.index = 0;\n this.zero = 0;\n}\nDataReader.prototype = {\n /**\n * Check that the offset will not go too far.\n * @param {string} offset the additional offset to check.\n * @throws {Error} an Error if the offset is out of bounds.\n */\n checkOffset: function(offset) {\n this.checkIndex(this.index + offset);\n },\n /**\n * Check that the specified index will not be too far.\n * @param {string} newIndex the index to check.\n * @throws {Error} an Error if the index is out of bounds.\n */\n checkIndex: function(newIndex) {\n if (this.length < this.zero + newIndex || newIndex < 0) {\n throw new Error(\"End of data reached (data length = \" + this.length + \", asked index = \" + (newIndex) + \"). Corrupted zip ?\");\n }\n },\n /**\n * Change the index.\n * @param {number} newIndex The new index.\n * @throws {Error} if the new index is out of the data.\n */\n setIndex: function(newIndex) {\n this.checkIndex(newIndex);\n this.index = newIndex;\n },\n /**\n * Skip the next n bytes.\n * @param {number} n the number of bytes to skip.\n * @throws {Error} if the new index is out of the data.\n */\n skip: function(n) {\n this.setIndex(this.index + n);\n },\n /**\n * Get the byte at the specified index.\n * @param {number} i the index to use.\n * @return {number} a byte.\n */\n byteAt: function(i) {\n // see implementations\n },\n /**\n * Get the next number with a given byte size.\n * @param {number} size the number of bytes to read.\n * @return {number} the corresponding number.\n */\n readInt: function(size) {\n var result = 0,\n i;\n this.checkOffset(size);\n for (i = this.index + size - 1; i >= this.index; i--) {\n result = (result << 8) + this.byteAt(i);\n }\n this.index += size;\n return result;\n },\n /**\n * Get the next string with a given byte size.\n * @param {number} size the number of bytes to read.\n * @return {string} the corresponding string.\n */\n readString: function(size) {\n return utils.transformTo(\"string\", this.readData(size));\n },\n /**\n * Get raw data without conversion, <size> bytes.\n * @param {number} size the number of bytes to read.\n * @return {Object} the raw data, implementation specific.\n */\n readData: function(size) {\n // see implementations\n },\n /**\n * Find the last occurence of a zip signature (4 bytes).\n * @param {string} sig the signature to find.\n * @return {number} the index of the last occurence, -1 if not found.\n */\n lastIndexOfSignature: function(sig) {\n // see implementations\n },\n /**\n * Read the signature (4 bytes) at the current position and compare it with sig.\n * @param {string} sig the expected signature\n * @return {boolean} true if the signature matches, false otherwise.\n */\n readAndCheckSignature: function(sig) {\n // see implementations\n },\n /**\n * Get the next date.\n * @return {Date} the date.\n */\n readDate: function() {\n var dostime = this.readInt(4);\n return new Date(Date.UTC(\n ((dostime >> 25) & 0x7f) + 1980, // year\n ((dostime >> 21) & 0x0f) - 1, // month\n (dostime >> 16) & 0x1f, // day\n (dostime >> 11) & 0x1f, // hour\n (dostime >> 5) & 0x3f, // minute\n (dostime & 0x1f) << 1)); // second\n }\n};\nmodule.exports = DataReader;\n","'use strict';\nvar DataReader = require('./DataReader');\nvar utils = require('../utils');\n\nfunction ArrayReader(data) {\n DataReader.call(this, data);\n\tfor(var i = 0; i < this.data.length; i++) {\n\t\tdata[i] = data[i] & 0xFF;\n\t}\n}\nutils.inherits(ArrayReader, DataReader);\n/**\n * @see DataReader.byteAt\n */\nArrayReader.prototype.byteAt = function(i) {\n return this.data[this.zero + i];\n};\n/**\n * @see DataReader.lastIndexOfSignature\n */\nArrayReader.prototype.lastIndexOfSignature = function(sig) {\n var sig0 = sig.charCodeAt(0),\n sig1 = sig.charCodeAt(1),\n sig2 = sig.charCodeAt(2),\n sig3 = sig.charCodeAt(3);\n for (var i = this.length - 4; i >= 0; --i) {\n if (this.data[i] === sig0 && this.data[i + 1] === sig1 && this.data[i + 2] === sig2 && this.data[i + 3] === sig3) {\n return i - this.zero;\n }\n }\n\n return -1;\n};\n/**\n * @see DataReader.readAndCheckSignature\n */\nArrayReader.prototype.readAndCheckSignature = function (sig) {\n var sig0 = sig.charCodeAt(0),\n sig1 = sig.charCodeAt(1),\n sig2 = sig.charCodeAt(2),\n sig3 = sig.charCodeAt(3),\n data = this.readData(4);\n return sig0 === data[0] && sig1 === data[1] && sig2 === data[2] && sig3 === data[3];\n};\n/**\n * @see DataReader.readData\n */\nArrayReader.prototype.readData = function(size) {\n this.checkOffset(size);\n if(size === 0) {\n return [];\n }\n var result = this.data.slice(this.zero + this.index, this.zero + this.index + size);\n this.index += size;\n return result;\n};\nmodule.exports = ArrayReader;\n","'use strict';\n\nvar utils = require('../utils');\nvar support = require('../support');\nvar ArrayReader = require('./ArrayReader');\nvar StringReader = require('./StringReader');\nvar NodeBufferReader = require('./NodeBufferReader');\nvar Uint8ArrayReader = require('./Uint8ArrayReader');\n\n/**\n * Create a reader adapted to the data.\n * @param {String|ArrayBuffer|Uint8Array|Buffer} data the data to read.\n * @return {DataReader} the data reader.\n */\nmodule.exports = function (data) {\n var type = utils.getTypeOf(data);\n utils.checkSupport(type);\n if (type === \"string\" && !support.uint8array) {\n return new StringReader(data);\n }\n if (type === \"nodebuffer\") {\n return new NodeBufferReader(data);\n }\n if (support.uint8array) {\n return new Uint8ArrayReader(utils.transformTo(\"uint8array\", data));\n }\n return new ArrayReader(utils.transformTo(\"array\", data));\n};\n","'use strict';\nexports.LOCAL_FILE_HEADER = \"PK\\x03\\x04\";\nexports.CENTRAL_FILE_HEADER = \"PK\\x01\\x02\";\nexports.CENTRAL_DIRECTORY_END = \"PK\\x05\\x06\";\nexports.ZIP64_CENTRAL_DIRECTORY_LOCATOR = \"PK\\x06\\x07\";\nexports.ZIP64_CENTRAL_DIRECTORY_END = \"PK\\x06\\x06\";\nexports.DATA_DESCRIPTOR = \"PK\\x07\\x08\";\n","'use strict';\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\nmodule.exports = {\n\n /* Allowed flush values; see deflate() and inflate() below for details */\n Z_NO_FLUSH: 0,\n Z_PARTIAL_FLUSH: 1,\n Z_SYNC_FLUSH: 2,\n Z_FULL_FLUSH: 3,\n Z_FINISH: 4,\n Z_BLOCK: 5,\n Z_TREES: 6,\n\n /* Return codes for the compression/decompression functions. Negative values\n * are errors, positive values are used for special but normal events.\n */\n Z_OK: 0,\n Z_STREAM_END: 1,\n Z_NEED_DICT: 2,\n Z_ERRNO: -1,\n Z_STREAM_ERROR: -2,\n Z_DATA_ERROR: -3,\n //Z_MEM_ERROR: -4,\n Z_BUF_ERROR: -5,\n //Z_VERSION_ERROR: -6,\n\n /* compression levels */\n Z_NO_COMPRESSION: 0,\n Z_BEST_SPEED: 1,\n Z_BEST_COMPRESSION: 9,\n Z_DEFAULT_COMPRESSION: -1,\n\n\n Z_FILTERED: 1,\n Z_HUFFMAN_ONLY: 2,\n Z_RLE: 3,\n Z_FIXED: 4,\n Z_DEFAULT_STRATEGY: 0,\n\n /* Possible values of the data_type field (though see inflate()) */\n Z_BINARY: 0,\n Z_TEXT: 1,\n //Z_ASCII: 1, // = Z_TEXT (deprecated)\n Z_UNKNOWN: 2,\n\n /* The deflate compression method */\n Z_DEFLATED: 8\n //Z_NULL: null // Use -1 or null inline, depending on var type\n};\n","'use strict';\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\nfunction ZStream() {\n /* next input byte */\n this.input = null; // JS specific, because we have no pointers\n this.next_in = 0;\n /* number of bytes available at input */\n this.avail_in = 0;\n /* total number of input bytes read so far */\n this.total_in = 0;\n /* next output byte should be put there */\n this.output = null; // JS specific, because we have no pointers\n this.next_out = 0;\n /* remaining free space at output */\n this.avail_out = 0;\n /* total number of bytes output so far */\n this.total_out = 0;\n /* last error message, NULL if no error */\n this.msg = ''/*Z_NULL*/;\n /* not visible by applications */\n this.state = null;\n /* best guess about the data type: binary or text */\n this.data_type = 2/*Z_UNKNOWN*/;\n /* adler32 value of the uncompressed data */\n this.adler = 0;\n}\n\nmodule.exports = ZStream;\n","// String encode/decode helpers\n'use strict';\n\n\nvar utils = require('./common');\n\n\n// Quick check if we can use fast array to bin string conversion\n//\n// - apply(Array) can fail on Android 2.2\n// - apply(Uint8Array) can fail on iOS 5.1 Safari\n//\nvar STR_APPLY_OK = true;\nvar STR_APPLY_UIA_OK = true;\n\ntry { String.fromCharCode.apply(null, [ 0 ]); } catch (__) { STR_APPLY_OK = false; }\ntry { String.fromCharCode.apply(null, new Uint8Array(1)); } catch (__) { STR_APPLY_UIA_OK = false; }\n\n\n// Table with utf8 lengths (calculated by first byte of sequence)\n// Note, that 5 & 6-byte values and some 4-byte values can not be represented in JS,\n// because max possible codepoint is 0x10ffff\nvar _utf8len = new utils.Buf8(256);\nfor (var q = 0; q < 256; q++) {\n _utf8len[q] = (q >= 252 ? 6 : q >= 248 ? 5 : q >= 240 ? 4 : q >= 224 ? 3 : q >= 192 ? 2 : 1);\n}\n_utf8len[254] = _utf8len[254] = 1; // Invalid sequence start\n\n\n// convert string to array (typed, when possible)\nexports.string2buf = function (str) {\n var buf, c, c2, m_pos, i, str_len = str.length, buf_len = 0;\n\n // count binary size\n for (m_pos = 0; m_pos < str_len; m_pos++) {\n c = str.charCodeAt(m_pos);\n if ((c & 0xfc00) === 0xd800 && (m_pos + 1 < str_len)) {\n c2 = str.charCodeAt(m_pos + 1);\n if ((c2 & 0xfc00) === 0xdc00) {\n c = 0x10000 + ((c - 0xd800) << 10) + (c2 - 0xdc00);\n m_pos++;\n }\n }\n buf_len += c < 0x80 ? 1 : c < 0x800 ? 2 : c < 0x10000 ? 3 : 4;\n }\n\n // allocate buffer\n buf = new utils.Buf8(buf_len);\n\n // convert\n for (i = 0, m_pos = 0; i < buf_len; m_pos++) {\n c = str.charCodeAt(m_pos);\n if ((c & 0xfc00) === 0xd800 && (m_pos + 1 < str_len)) {\n c2 = str.charCodeAt(m_pos + 1);\n if ((c2 & 0xfc00) === 0xdc00) {\n c = 0x10000 + ((c - 0xd800) << 10) + (c2 - 0xdc00);\n m_pos++;\n }\n }\n if (c < 0x80) {\n /* one byte */\n buf[i++] = c;\n } else if (c < 0x800) {\n /* two bytes */\n buf[i++] = 0xC0 | (c >>> 6);\n buf[i++] = 0x80 | (c & 0x3f);\n } else if (c < 0x10000) {\n /* three bytes */\n buf[i++] = 0xE0 | (c >>> 12);\n buf[i++] = 0x80 | (c >>> 6 & 0x3f);\n buf[i++] = 0x80 | (c & 0x3f);\n } else {\n /* four bytes */\n buf[i++] = 0xf0 | (c >>> 18);\n buf[i++] = 0x80 | (c >>> 12 & 0x3f);\n buf[i++] = 0x80 | (c >>> 6 & 0x3f);\n buf[i++] = 0x80 | (c & 0x3f);\n }\n }\n\n return buf;\n};\n\n// Helper (used in 2 places)\nfunction buf2binstring(buf, len) {\n // use fallback for big arrays to avoid stack overflow\n if (len < 65537) {\n if ((buf.subarray && STR_APPLY_UIA_OK) || (!buf.subarray && STR_APPLY_OK)) {\n return String.fromCharCode.apply(null, utils.shrinkBuf(buf, len));\n }\n }\n\n var result = '';\n for (var i = 0; i < len; i++) {\n result += String.fromCharCode(buf[i]);\n }\n return result;\n}\n\n\n// Convert byte array to binary string\nexports.buf2binstring = function (buf) {\n return buf2binstring(buf, buf.length);\n};\n\n\n// Convert binary string (typed, when possible)\nexports.binstring2buf = function (str) {\n var buf = new utils.Buf8(str.length);\n for (var i = 0, len = buf.length; i < len; i++) {\n buf[i] = str.charCodeAt(i);\n }\n return buf;\n};\n\n\n// convert array to string\nexports.buf2string = function (buf, max) {\n var i, out, c, c_len;\n var len = max || buf.length;\n\n // Reserve max possible length (2 words per char)\n // NB: by unknown reasons, Array is significantly faster for\n // String.fromCharCode.apply than Uint16Array.\n var utf16buf = new Array(len * 2);\n\n for (out = 0, i = 0; i < len;) {\n c = buf[i++];\n // quick process ascii\n if (c < 0x80) { utf16buf[out++] = c; continue; }\n\n c_len = _utf8len[c];\n // skip 5 & 6 byte codes\n if (c_len > 4) { utf16buf[out++] = 0xfffd; i += c_len - 1; continue; }\n\n // apply mask on first byte\n c &= c_len === 2 ? 0x1f : c_len === 3 ? 0x0f : 0x07;\n // join the rest\n while (c_len > 1 && i < len) {\n c = (c << 6) | (buf[i++] & 0x3f);\n c_len--;\n }\n\n // terminated by end of string?\n if (c_len > 1) { utf16buf[out++] = 0xfffd; continue; }\n\n if (c < 0x10000) {\n utf16buf[out++] = c;\n } else {\n c -= 0x10000;\n utf16buf[out++] = 0xd800 | ((c >> 10) & 0x3ff);\n utf16buf[out++] = 0xdc00 | (c & 0x3ff);\n }\n }\n\n return buf2binstring(utf16buf, out);\n};\n\n\n// Calculate max possible position in utf8 buffer,\n// that will not break sequence. If that's not possible\n// - (very small limits) return max size as is.\n//\n// buf[] - utf8 bytes array\n// max - length limit (mandatory);\nexports.utf8border = function (buf, max) {\n var pos;\n\n max = max || buf.length;\n if (max > buf.length) { max = buf.length; }\n\n // go back from last position, until start of sequence found\n pos = max - 1;\n while (pos >= 0 && (buf[pos] & 0xC0) === 0x80) { pos--; }\n\n // Very small and broken sequence,\n // return max, because we should return something anyway.\n if (pos < 0) { return max; }\n\n // If we came to start of buffer - that means buffer is too small,\n // return max too.\n if (pos === 0) { return max; }\n\n return (pos + _utf8len[buf[pos]] > max) ? pos : max;\n};\n","'use strict';\n\n// Note: we can't get significant speed boost here.\n// So write code to minimize size - no pregenerated tables\n// and array tools dependencies.\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\n// Use ordinary array, since untyped makes no boost here\nfunction makeTable() {\n var c, table = [];\n\n for (var n = 0; n < 256; n++) {\n c = n;\n for (var k = 0; k < 8; k++) {\n c = ((c & 1) ? (0xEDB88320 ^ (c >>> 1)) : (c >>> 1));\n }\n table[n] = c;\n }\n\n return table;\n}\n\n// Create table on load. Just 255 signed longs. Not a problem.\nvar crcTable = makeTable();\n\n\nfunction crc32(crc, buf, len, pos) {\n var t = crcTable,\n end = pos + len;\n\n crc ^= -1;\n\n for (var i = pos; i < end; i++) {\n crc = (crc >>> 8) ^ t[(crc ^ buf[i]) & 0xFF];\n }\n\n return (crc ^ (-1)); // >>> 0;\n}\n\n\nmodule.exports = crc32;\n","'use strict';\n\n// Note: adler32 takes 12% for level 0 and 2% for level 6.\n// It isn't worth it to make additional optimizations as in original.\n// Small size is preferable.\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\nfunction adler32(adler, buf, len, pos) {\n var s1 = (adler & 0xffff) |0,\n s2 = ((adler >>> 16) & 0xffff) |0,\n n = 0;\n\n while (len !== 0) {\n // Set limit ~ twice less than 5552, to keep\n // s2 in 31-bits, because we force signed ints.\n // in other case %= will fail.\n n = len > 2000 ? 2000 : len;\n len -= n;\n\n do {\n s1 = (s1 + buf[pos++]) |0;\n s2 = (s2 + s1) |0;\n } while (--n);\n\n s1 %= 65521;\n s2 %= 65521;\n }\n\n return (s1 | (s2 << 16)) |0;\n}\n\n\nmodule.exports = adler32;\n","'use strict';\n\nvar GenericWorker = require(\"./stream/GenericWorker\");\n\nexports.STORE = {\n magic: \"\\x00\\x00\",\n compressWorker : function (compressionOptions) {\n return new GenericWorker(\"STORE compression\");\n },\n uncompressWorker : function () {\n return new GenericWorker(\"STORE decompression\");\n }\n};\nexports.DEFLATE = require('./flate');\n","'use strict';\n\nvar GenericWorker = require('./GenericWorker');\nvar crc32 = require('../crc32');\nvar utils = require('../utils');\n\n/**\n * A worker which calculate the crc32 of the data flowing through.\n * @constructor\n */\nfunction Crc32Probe() {\n GenericWorker.call(this, \"Crc32Probe\");\n this.withStreamInfo(\"crc32\", 0);\n}\nutils.inherits(Crc32Probe, GenericWorker);\n\n/**\n * @see GenericWorker.processChunk\n */\nCrc32Probe.prototype.processChunk = function (chunk) {\n this.streamInfo.crc32 = crc32(chunk.data, this.streamInfo.crc32 || 0);\n this.push(chunk);\n};\nmodule.exports = Crc32Probe;\n","'use strict';\n\nvar utils = require('../utils');\nvar GenericWorker = require('./GenericWorker');\n\n/**\n * A worker which calculate the total length of the data flowing through.\n * @constructor\n * @param {String} propName the name used to expose the length\n */\nfunction DataLengthProbe(propName) {\n GenericWorker.call(this, \"DataLengthProbe for \" + propName);\n this.propName = propName;\n this.withStreamInfo(propName, 0);\n}\nutils.inherits(DataLengthProbe, GenericWorker);\n\n/**\n * @see GenericWorker.processChunk\n */\nDataLengthProbe.prototype.processChunk = function (chunk) {\n if(chunk) {\n var length = this.streamInfo[this.propName] || 0;\n this.streamInfo[this.propName] = length + chunk.data.length;\n }\n GenericWorker.prototype.processChunk.call(this, chunk);\n};\nmodule.exports = DataLengthProbe;\n\n","'use strict';\n\nvar utils = require('../utils');\nvar GenericWorker = require('./GenericWorker');\n\n// the size of the generated chunks\n// TODO expose this as a public variable\nvar DEFAULT_BLOCK_SIZE = 16 * 1024;\n\n/**\n * A worker that reads a content and emits chunks.\n * @constructor\n * @param {Promise} dataP the promise of the data to split\n */\nfunction DataWorker(dataP) {\n GenericWorker.call(this, \"DataWorker\");\n var self = this;\n this.dataIsReady = false;\n this.index = 0;\n this.max = 0;\n this.data = null;\n this.type = \"\";\n\n this._tickScheduled = false;\n\n dataP.then(function (data) {\n self.dataIsReady = true;\n self.data = data;\n self.max = data && data.length || 0;\n self.type = utils.getTypeOf(data);\n if(!self.isPaused) {\n self._tickAndRepeat();\n }\n }, function (e) {\n self.error(e);\n });\n}\n\nutils.inherits(DataWorker, GenericWorker);\n\n/**\n * @see GenericWorker.cleanUp\n */\nDataWorker.prototype.cleanUp = function () {\n GenericWorker.prototype.cleanUp.call(this);\n this.data = null;\n};\n\n/**\n * @see GenericWorker.resume\n */\nDataWorker.prototype.resume = function () {\n if(!GenericWorker.prototype.resume.call(this)) {\n return false;\n }\n\n if (!this._tickScheduled && this.dataIsReady) {\n this._tickScheduled = true;\n utils.delay(this._tickAndRepeat, [], this);\n }\n return true;\n};\n\n/**\n * Trigger a tick a schedule an other call to this function.\n */\nDataWorker.prototype._tickAndRepeat = function() {\n this._tickScheduled = false;\n if(this.isPaused || this.isFinished) {\n return;\n }\n this._tick();\n if(!this.isFinished) {\n utils.delay(this._tickAndRepeat, [], this);\n this._tickScheduled = true;\n }\n};\n\n/**\n * Read and push a chunk.\n */\nDataWorker.prototype._tick = function() {\n\n if(this.isPaused || this.isFinished) {\n return false;\n }\n\n var size = DEFAULT_BLOCK_SIZE;\n var data = null, nextIndex = Math.min(this.max, this.index + size);\n if (this.index >= this.max) {\n // EOF\n return this.end();\n } else {\n switch(this.type) {\n case \"string\":\n data = this.data.substring(this.index, nextIndex);\n break;\n case \"uint8array\":\n data = this.data.subarray(this.index, nextIndex);\n break;\n case \"array\":\n case \"nodebuffer\":\n data = this.data.slice(this.index, nextIndex);\n break;\n }\n this.index = nextIndex;\n return this.push({\n data : data,\n meta : {\n percent : this.max ? this.index / this.max * 100 : 0\n }\n });\n }\n};\n\nmodule.exports = DataWorker;\n","'use strict';\nexports.base64 = false;\nexports.binary = false;\nexports.dir = false;\nexports.createFolders = true;\nexports.date = null;\nexports.compression = null;\nexports.compressionOptions = null;\nexports.comment = null;\nexports.unixPermissions = null;\nexports.dosPermissions = null;\n","'use strict';\n\nvar utils = require('../utils');\nvar ConvertWorker = require('./ConvertWorker');\nvar GenericWorker = require('./GenericWorker');\nvar base64 = require('../base64');\nvar support = require(\"../support\");\nvar external = require(\"../external\");\n\nvar NodejsStreamOutputAdapter = null;\nif (support.nodestream) {\n try {\n NodejsStreamOutputAdapter = require('../nodejs/NodejsStreamOutputAdapter');\n } catch(e) {}\n}\n\n/**\n * Apply the final transformation of the data. If the user wants a Blob for\n * example, it's easier to work with an U8intArray and finally do the\n * ArrayBuffer/Blob conversion.\n * @param {String} type the name of the final type\n * @param {String|Uint8Array|Buffer} content the content to transform\n * @param {String} mimeType the mime type of the content, if applicable.\n * @return {String|Uint8Array|ArrayBuffer|Buffer|Blob} the content in the right format.\n */\nfunction transformZipOutput(type, content, mimeType) {\n switch(type) {\n case \"blob\" :\n return utils.newBlob(utils.transformTo(\"arraybuffer\", content), mimeType);\n case \"base64\" :\n return base64.encode(content);\n default :\n return utils.transformTo(type, content);\n }\n}\n\n/**\n * Concatenate an array of data of the given type.\n * @param {String} type the type of the data in the given array.\n * @param {Array} dataArray the array containing the data chunks to concatenate\n * @return {String|Uint8Array|Buffer} the concatenated data\n * @throws Error if the asked type is unsupported\n */\nfunction concat (type, dataArray) {\n var i, index = 0, res = null, totalLength = 0;\n for(i = 0; i < dataArray.length; i++) {\n totalLength += dataArray[i].length;\n }\n switch(type) {\n case \"string\":\n return dataArray.join(\"\");\n case \"array\":\n return Array.prototype.concat.apply([], dataArray);\n case \"uint8array\":\n res = new Uint8Array(totalLength);\n for(i = 0; i < dataArray.length; i++) {\n res.set(dataArray[i], index);\n index += dataArray[i].length;\n }\n return res;\n case \"nodebuffer\":\n return Buffer.concat(dataArray);\n default:\n throw new Error(\"concat : unsupported type '\" + type + \"'\");\n }\n}\n\n/**\n * Listen a StreamHelper, accumulate its content and concatenate it into a\n * complete block.\n * @param {StreamHelper} helper the helper to use.\n * @param {Function} updateCallback a callback called on each update. Called\n * with one arg :\n * - the metadata linked to the update received.\n * @return Promise the promise for the accumulation.\n */\nfunction accumulate(helper, updateCallback) {\n return new external.Promise(function (resolve, reject){\n var dataArray = [];\n var chunkType = helper._internalType,\n resultType = helper._outputType,\n mimeType = helper._mimeType;\n helper\n .on('data', function (data, meta) {\n dataArray.push(data);\n if(updateCallback) {\n updateCallback(meta);\n }\n })\n .on('error', function(err) {\n dataArray = [];\n reject(err);\n })\n .on('end', function (){\n try {\n var result = transformZipOutput(resultType, concat(chunkType, dataArray), mimeType);\n resolve(result);\n } catch (e) {\n reject(e);\n }\n dataArray = [];\n })\n .resume();\n });\n}\n\n/**\n * An helper to easily use workers outside of JSZip.\n * @constructor\n * @param {Worker} worker the worker to wrap\n * @param {String} outputType the type of data expected by the use\n * @param {String} mimeType the mime type of the content, if applicable.\n */\nfunction StreamHelper(worker, outputType, mimeType) {\n var internalType = outputType;\n switch(outputType) {\n case \"blob\":\n case \"arraybuffer\":\n internalType = \"uint8array\";\n break;\n case \"base64\":\n internalType = \"string\";\n break;\n }\n\n try {\n // the type used internally\n this._internalType = internalType;\n // the type used to output results\n this._outputType = outputType;\n // the mime type\n this._mimeType = mimeType;\n utils.checkSupport(internalType);\n this._worker = worker.pipe(new ConvertWorker(internalType));\n // the last workers can be rewired without issues but we need to\n // prevent any updates on previous workers.\n worker.lock();\n } catch(e) {\n this._worker = new GenericWorker(\"error\");\n this._worker.error(e);\n }\n}\n\nStreamHelper.prototype = {\n /**\n * Listen a StreamHelper, accumulate its content and concatenate it into a\n * complete block.\n * @param {Function} updateCb the update callback.\n * @return Promise the promise for the accumulation.\n */\n accumulate : function (updateCb) {\n return accumulate(this, updateCb);\n },\n /**\n * Add a listener on an event triggered on a stream.\n * @param {String} evt the name of the event\n * @param {Function} fn the listener\n * @return {StreamHelper} the current helper.\n */\n on : function (evt, fn) {\n var self = this;\n\n if(evt === \"data\") {\n this._worker.on(evt, function (chunk) {\n fn.call(self, chunk.data, chunk.meta);\n });\n } else {\n this._worker.on(evt, function () {\n utils.delay(fn, arguments, self);\n });\n }\n return this;\n },\n /**\n * Resume the flow of chunks.\n * @return {StreamHelper} the current helper.\n */\n resume : function () {\n utils.delay(this._worker.resume, [], this._worker);\n return this;\n },\n /**\n * Pause the flow of chunks.\n * @return {StreamHelper} the current helper.\n */\n pause : function () {\n this._worker.pause();\n return this;\n },\n /**\n * Return a nodejs stream for this helper.\n * @param {Function} updateCb the update callback.\n * @return {NodejsStreamOutputAdapter} the nodejs stream.\n */\n toNodejsStream : function (updateCb) {\n utils.checkSupport(\"nodestream\");\n if (this._outputType !== \"nodebuffer\") {\n // an object stream containing blob/arraybuffer/uint8array/string\n // is strange and I don't know if it would be useful.\n // I you find this comment and have a good usecase, please open a\n // bug report !\n throw new Error(this._outputType + \" is not supported by this method\");\n }\n\n return new NodejsStreamOutputAdapter(this, {\n objectMode : this._outputType !== \"nodebuffer\"\n }, updateCb);\n }\n};\n\n\nmodule.exports = StreamHelper;\n","var isObject = require('./_is-object')\n , document = require('./_global').document\n // in old IE typeof document.createElement is 'object'\n , is = isObject(document) && isObject(document.createElement);\nmodule.exports = function(it){\n return is ? document.createElement(it) : {};\n};","module.exports = function(exec){\n try {\n return !!exec();\n } catch(e){\n return true;\n }\n};","// optional / simple context binding\nvar aFunction = require('./_a-function');\nmodule.exports = function(fn, that, length){\n aFunction(fn);\n if(that === undefined)return fn;\n switch(length){\n case 1: return function(a){\n return fn.call(that, a);\n };\n case 2: return function(a, b){\n return fn.call(that, a, b);\n };\n case 3: return function(a, b, c){\n return fn.call(that, a, b, c);\n };\n }\n return function(/* ...args */){\n return fn.apply(that, arguments);\n };\n};","var core = module.exports = {version: '2.3.0'};\nif(typeof __e == 'number')__e = core; // eslint-disable-line no-undef","'use strict';\nvar utils = require('./utils');\nvar support = require('./support');\n// private property\nvar _keyStr = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\";\n\n\n// public method for encoding\nexports.encode = function(input) {\n var output = [];\n var chr1, chr2, chr3, enc1, enc2, enc3, enc4;\n var i = 0, len = input.length, remainingBytes = len;\n\n var isArray = utils.getTypeOf(input) !== \"string\";\n while (i < input.length) {\n remainingBytes = len - i;\n\n if (!isArray) {\n chr1 = input.charCodeAt(i++);\n chr2 = i < len ? input.charCodeAt(i++) : 0;\n chr3 = i < len ? input.charCodeAt(i++) : 0;\n } else {\n chr1 = input[i++];\n chr2 = i < len ? input[i++] : 0;\n chr3 = i < len ? input[i++] : 0;\n }\n\n enc1 = chr1 >> 2;\n enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);\n enc3 = remainingBytes > 1 ? (((chr2 & 15) << 2) | (chr3 >> 6)) : 64;\n enc4 = remainingBytes > 2 ? (chr3 & 63) : 64;\n\n output.push(_keyStr.charAt(enc1) + _keyStr.charAt(enc2) + _keyStr.charAt(enc3) + _keyStr.charAt(enc4));\n\n }\n\n return output.join(\"\");\n};\n\n// public method for decoding\nexports.decode = function(input) {\n var chr1, chr2, chr3;\n var enc1, enc2, enc3, enc4;\n var i = 0, resultIndex = 0;\n\n var dataUrlPrefix = \"data:\";\n\n if (input.substr(0, dataUrlPrefix.length) === dataUrlPrefix) {\n // This is a common error: people give a data url\n // (data:image/png;base64,iVBOR...) with a {base64: true} and\n // wonders why things don't work.\n // We can detect that the string input looks like a data url but we\n // *can't* be sure it is one: removing everything up to the comma would\n // be too dangerous.\n throw new Error(\"Invalid base64 input, it looks like a data url.\");\n }\n\n input = input.replace(/[^A-Za-z0-9\\+\\/\\=]/g, \"\");\n\n var totalLength = input.length * 3 / 4;\n if(input.charAt(input.length - 1) === _keyStr.charAt(64)) {\n totalLength--;\n }\n if(input.charAt(input.length - 2) === _keyStr.charAt(64)) {\n totalLength--;\n }\n if (totalLength % 1 !== 0) {\n // totalLength is not an integer, the length does not match a valid\n // base64 content. That can happen if:\n // - the input is not a base64 content\n // - the input is *almost* a base64 content, with a extra chars at the\n // beginning or at the end\n // - the input uses a base64 variant (base64url for example)\n throw new Error(\"Invalid base64 input, bad content length.\");\n }\n var output;\n if (support.uint8array) {\n output = new Uint8Array(totalLength|0);\n } else {\n output = new Array(totalLength|0);\n }\n\n while (i < input.length) {\n\n enc1 = _keyStr.indexOf(input.charAt(i++));\n enc2 = _keyStr.indexOf(input.charAt(i++));\n enc3 = _keyStr.indexOf(input.charAt(i++));\n enc4 = _keyStr.indexOf(input.charAt(i++));\n\n chr1 = (enc1 << 2) | (enc2 >> 4);\n chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);\n chr3 = ((enc3 & 3) << 6) | enc4;\n\n output[resultIndex++] = chr1;\n\n if (enc3 !== 64) {\n output[resultIndex++] = chr2;\n }\n if (enc4 !== 64) {\n output[resultIndex++] = chr3;\n }\n\n }\n\n return output;\n};\n","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n// a transform stream is a readable/writable stream where you do\n// something with the data. Sometimes it's called a \"filter\",\n// but that's not a great name for it, since that implies a thing where\n// some bits pass through, and others are simply ignored. (That would\n// be a valid example of a transform, of course.)\n//\n// While the output is causally related to the input, it's not a\n// necessarily symmetric or synchronous transformation. For example,\n// a zlib stream might take multiple plain-text writes(), and then\n// emit a single compressed chunk some time in the future.\n//\n// Here's how this works:\n//\n// The Transform stream has all the aspects of the readable and writable\n// stream classes. When you write(chunk), that calls _write(chunk,cb)\n// internally, and returns false if there's a lot of pending writes\n// buffered up. When you call read(), that calls _read(n) until\n// there's enough pending readable data buffered up.\n//\n// In a transform stream, the written data is placed in a buffer. When\n// _read(n) is called, it transforms the queued up data, calling the\n// buffered _write cb's as it consumes chunks. If consuming a single\n// written chunk would result in multiple output chunks, then the first\n// outputted bit calls the readcb, and subsequent chunks just go into\n// the read buffer, and will cause it to emit 'readable' if necessary.\n//\n// This way, back-pressure is actually determined by the reading side,\n// since _read has to be called to start processing a new chunk. However,\n// a pathological inflate type of transform can cause excessive buffering\n// here. For example, imagine a stream where every byte of input is\n// interpreted as an integer from 0-255, and then results in that many\n// bytes of output. Writing the 4 bytes {ff,ff,ff,ff} would result in\n// 1kb of data being output. In this case, you could write a very small\n// amount of input, and end up with a very large amount of output. In\n// such a pathological inflating mechanism, there'd be no way to tell\n// the system to stop doing the transform. A single 4MB write could\n// cause the system to run out of memory.\n//\n// However, even in such a pathological case, only a single written chunk\n// would be consumed, and then the rest would wait (un-transformed) until\n// the results of the previous transformed chunk were consumed.\n\n'use strict';\n\nmodule.exports = Transform;\n\nvar Duplex = require('./_stream_duplex');\n\n/*<replacement>*/\nvar util = require('core-util-is');\nutil.inherits = require('inherits');\n/*</replacement>*/\n\nutil.inherits(Transform, Duplex);\n\nfunction afterTransform(er, data) {\n var ts = this._transformState;\n ts.transforming = false;\n\n var cb = ts.writecb;\n\n if (!cb) {\n return this.emit('error', new Error('write callback called multiple times'));\n }\n\n ts.writechunk = null;\n ts.writecb = null;\n\n if (data != null) // single equals check for both `null` and `undefined`\n this.push(data);\n\n cb(er);\n\n var rs = this._readableState;\n rs.reading = false;\n if (rs.needReadable || rs.length < rs.highWaterMark) {\n this._read(rs.highWaterMark);\n }\n}\n\nfunction Transform(options) {\n if (!(this instanceof Transform)) return new Transform(options);\n\n Duplex.call(this, options);\n\n this._transformState = {\n afterTransform: afterTransform.bind(this),\n needTransform: false,\n transforming: false,\n writecb: null,\n writechunk: null,\n writeencoding: null\n };\n\n // start out asking for a readable event once data is transformed.\n this._readableState.needReadable = true;\n\n // we have implemented the _read method, and done the other things\n // that Readable wants before the first _read call, so unset the\n // sync guard flag.\n this._readableState.sync = false;\n\n if (options) {\n if (typeof options.transform === 'function') this._transform = options.transform;\n\n if (typeof options.flush === 'function') this._flush = options.flush;\n }\n\n // When the writable side finishes, then flush out anything remaining.\n this.on('prefinish', prefinish);\n}\n\nfunction prefinish() {\n var _this = this;\n\n if (typeof this._flush === 'function') {\n this._flush(function (er, data) {\n done(_this, er, data);\n });\n } else {\n done(this, null, null);\n }\n}\n\nTransform.prototype.push = function (chunk, encoding) {\n this._transformState.needTransform = false;\n return Duplex.prototype.push.call(this, chunk, encoding);\n};\n\n// This is the part where you do stuff!\n// override this function in implementation classes.\n// 'chunk' is an input chunk.\n//\n// Call `push(newChunk)` to pass along transformed output\n// to the readable side. You may call 'push' zero or more times.\n//\n// Call `cb(err)` when you are done with this chunk. If you pass\n// an error, then that'll put the hurt on the whole operation. If you\n// never call cb(), then you'll never get another chunk.\nTransform.prototype._transform = function (chunk, encoding, cb) {\n throw new Error('_transform() is not implemented');\n};\n\nTransform.prototype._write = function (chunk, encoding, cb) {\n var ts = this._transformState;\n ts.writecb = cb;\n ts.writechunk = chunk;\n ts.writeencoding = encoding;\n if (!ts.transforming) {\n var rs = this._readableState;\n if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) this._read(rs.highWaterMark);\n }\n};\n\n// Doesn't matter what the args are here.\n// _transform does all the work.\n// That we got here means that the readable side wants more data.\nTransform.prototype._read = function (n) {\n var ts = this._transformState;\n\n if (ts.writechunk !== null && ts.writecb && !ts.transforming) {\n ts.transforming = true;\n this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform);\n } else {\n // mark that we need a transform, so that any data that comes in\n // will get processed, now that we've asked for it.\n ts.needTransform = true;\n }\n};\n\nTransform.prototype._destroy = function (err, cb) {\n var _this2 = this;\n\n Duplex.prototype._destroy.call(this, err, function (err2) {\n cb(err2);\n _this2.emit('close');\n });\n};\n\nfunction done(stream, er, data) {\n if (er) return stream.emit('error', er);\n\n if (data != null) // single equals check for both `null` and `undefined`\n stream.push(data);\n\n // if there's nothing in the write buffer, then that means\n // that nothing more will ever be provided\n if (stream._writableState.length) throw new Error('Calling transform done when ws.length != 0');\n\n if (stream._transformState.transforming) throw new Error('Calling transform done when still transforming');\n\n return stream.push(null);\n}","'use strict';\n\nvar Buffer = require('safe-buffer').Buffer;\n\nvar isEncoding = Buffer.isEncoding || function (encoding) {\n encoding = '' + encoding;\n switch (encoding && encoding.toLowerCase()) {\n case 'hex':case 'utf8':case 'utf-8':case 'ascii':case 'binary':case 'base64':case 'ucs2':case 'ucs-2':case 'utf16le':case 'utf-16le':case 'raw':\n return true;\n default:\n return false;\n }\n};\n\nfunction _normalizeEncoding(enc) {\n if (!enc) return 'utf8';\n var retried;\n while (true) {\n switch (enc) {\n case 'utf8':\n case 'utf-8':\n return 'utf8';\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return 'utf16le';\n case 'latin1':\n case 'binary':\n return 'latin1';\n case 'base64':\n case 'ascii':\n case 'hex':\n return enc;\n default:\n if (retried) return; // undefined\n enc = ('' + enc).toLowerCase();\n retried = true;\n }\n }\n};\n\n// Do not cache `Buffer.isEncoding` when checking encoding names as some\n// modules monkey-patch it to support additional encodings\nfunction normalizeEncoding(enc) {\n var nenc = _normalizeEncoding(enc);\n if (typeof nenc !== 'string' && (Buffer.isEncoding === isEncoding || !isEncoding(enc))) throw new Error('Unknown encoding: ' + enc);\n return nenc || enc;\n}\n\n// StringDecoder provides an interface for efficiently splitting a series of\n// buffers into a series of JS strings without breaking apart multi-byte\n// characters.\nexports.StringDecoder = StringDecoder;\nfunction StringDecoder(encoding) {\n this.encoding = normalizeEncoding(encoding);\n var nb;\n switch (this.encoding) {\n case 'utf16le':\n this.text = utf16Text;\n this.end = utf16End;\n nb = 4;\n break;\n case 'utf8':\n this.fillLast = utf8FillLast;\n nb = 4;\n break;\n case 'base64':\n this.text = base64Text;\n this.end = base64End;\n nb = 3;\n break;\n default:\n this.write = simpleWrite;\n this.end = simpleEnd;\n return;\n }\n this.lastNeed = 0;\n this.lastTotal = 0;\n this.lastChar = Buffer.allocUnsafe(nb);\n}\n\nStringDecoder.prototype.write = function (buf) {\n if (buf.length === 0) return '';\n var r;\n var i;\n if (this.lastNeed) {\n r = this.fillLast(buf);\n if (r === undefined) return '';\n i = this.lastNeed;\n this.lastNeed = 0;\n } else {\n i = 0;\n }\n if (i < buf.length) return r ? r + this.text(buf, i) : this.text(buf, i);\n return r || '';\n};\n\nStringDecoder.prototype.end = utf8End;\n\n// Returns only complete characters in a Buffer\nStringDecoder.prototype.text = utf8Text;\n\n// Attempts to complete a partial non-UTF-8 character using bytes from a Buffer\nStringDecoder.prototype.fillLast = function (buf) {\n if (this.lastNeed <= buf.length) {\n buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, this.lastNeed);\n return this.lastChar.toString(this.encoding, 0, this.lastTotal);\n }\n buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, buf.length);\n this.lastNeed -= buf.length;\n};\n\n// Checks the type of a UTF-8 byte, whether it's ASCII, a leading byte, or a\n// continuation byte.\nfunction utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return -1;\n}\n\n// Checks at most 3 bytes at the end of a Buffer in order to detect an\n// incomplete multi-byte UTF-8 character. The total number of bytes (2, 3, or 4)\n// needed to complete the UTF-8 character (if applicable) are returned.\nfunction utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}\n\n// Validates as many continuation bytes for a multi-byte UTF-8 character as\n// needed or are available. If we see a non-continuation byte where we expect\n// one, we \"replace\" the validated continuation bytes we've seen so far with\n// UTF-8 replacement characters ('\\ufffd'), to match v8's UTF-8 decoding\n// behavior. The continuation byte check is included three times in the case\n// where all of the continuation bytes for a character exist in the same buffer.\n// It is also done this way as a slight performance increase instead of using a\n// loop.\nfunction utf8CheckExtraBytes(self, buf, p) {\n if ((buf[0] & 0xC0) !== 0x80) {\n self.lastNeed = 0;\n return '\\ufffd'.repeat(p);\n }\n if (self.lastNeed > 1 && buf.length > 1) {\n if ((buf[1] & 0xC0) !== 0x80) {\n self.lastNeed = 1;\n return '\\ufffd'.repeat(p + 1);\n }\n if (self.lastNeed > 2 && buf.length > 2) {\n if ((buf[2] & 0xC0) !== 0x80) {\n self.lastNeed = 2;\n return '\\ufffd'.repeat(p + 2);\n }\n }\n }\n}\n\n// Attempts to complete a multi-byte UTF-8 character using bytes from a Buffer.\nfunction utf8FillLast(buf) {\n var p = this.lastTotal - this.lastNeed;\n var r = utf8CheckExtraBytes(this, buf, p);\n if (r !== undefined) return r;\n if (this.lastNeed <= buf.length) {\n buf.copy(this.lastChar, p, 0, this.lastNeed);\n return this.lastChar.toString(this.encoding, 0, this.lastTotal);\n }\n buf.copy(this.lastChar, p, 0, buf.length);\n this.lastNeed -= buf.length;\n}\n\n// Returns all complete UTF-8 characters in a Buffer. If the Buffer ended on a\n// partial character, the character's bytes are buffered until the required\n// number of bytes are available.\nfunction utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}\n\n// For UTF-8, a replacement character for each buffered byte of a (partial)\n// character needs to be added to the output.\nfunction utf8End(buf) {\n var r = buf && buf.length ? this.write(buf) : '';\n if (this.lastNeed) return r + '\\ufffd'.repeat(this.lastTotal - this.lastNeed);\n return r;\n}\n\n// UTF-16LE typically needs two bytes per character, but even if we have an even\n// number of bytes available, we need to check if we end on a leading/high\n// surrogate. In that case, we need to wait for the next two bytes in order to\n// decode the last character properly.\nfunction utf16Text(buf, i) {\n if ((buf.length - i) % 2 === 0) {\n var r = buf.toString('utf16le', i);\n if (r) {\n var c = r.charCodeAt(r.length - 1);\n if (c >= 0xD800 && c <= 0xDBFF) {\n this.lastNeed = 2;\n this.lastTotal = 4;\n this.lastChar[0] = buf[buf.length - 2];\n this.lastChar[1] = buf[buf.length - 1];\n return r.slice(0, -1);\n }\n }\n return r;\n }\n this.lastNeed = 1;\n this.lastTotal = 2;\n this.lastChar[0] = buf[buf.length - 1];\n return buf.toString('utf16le', i, buf.length - 1);\n}\n\n// For UTF-16LE we do not explicitly append special replacement characters if we\n// end on a partial character, we simply let v8 handle that.\nfunction utf16End(buf) {\n var r = buf && buf.length ? this.write(buf) : '';\n if (this.lastNeed) {\n var end = this.lastTotal - this.lastNeed;\n return r + this.lastChar.toString('utf16le', 0, end);\n }\n return r;\n}\n\nfunction base64Text(buf, i) {\n var n = (buf.length - i) % 3;\n if (n === 0) return buf.toString('base64', i);\n this.lastNeed = 3 - n;\n this.lastTotal = 3;\n if (n === 1) {\n this.lastChar[0] = buf[buf.length - 1];\n } else {\n this.lastChar[0] = buf[buf.length - 2];\n this.lastChar[1] = buf[buf.length - 1];\n }\n return buf.toString('base64', i, buf.length - n);\n}\n\nfunction base64End(buf) {\n var r = buf && buf.length ? this.write(buf) : '';\n if (this.lastNeed) return r + this.lastChar.toString('base64', 0, 3 - this.lastNeed);\n return r;\n}\n\n// Pass bytes on through for single-byte encodings (e.g. ascii, latin1, hex)\nfunction simpleWrite(buf) {\n return buf.toString(this.encoding);\n}\n\nfunction simpleEnd(buf) {\n return buf && buf.length ? this.write(buf) : '';\n}","var apply = Function.prototype.apply;\n\n// DOM APIs, for completeness\n\nexports.setTimeout = function() {\n return new Timeout(apply.call(setTimeout, window, arguments), clearTimeout);\n};\nexports.setInterval = function() {\n return new Timeout(apply.call(setInterval, window, arguments), clearInterval);\n};\nexports.clearTimeout =\nexports.clearInterval = function(timeout) {\n if (timeout) {\n timeout.close();\n }\n};\n\nfunction Timeout(id, clearFn) {\n this._id = id;\n this._clearFn = clearFn;\n}\nTimeout.prototype.unref = Timeout.prototype.ref = function() {};\nTimeout.prototype.close = function() {\n this._clearFn.call(window, this._id);\n};\n\n// Does not start the time, just sets up the members needed.\nexports.enroll = function(item, msecs) {\n clearTimeout(item._idleTimeoutId);\n item._idleTimeout = msecs;\n};\n\nexports.unenroll = function(item) {\n clearTimeout(item._idleTimeoutId);\n item._idleTimeout = -1;\n};\n\nexports._unrefActive = exports.active = function(item) {\n clearTimeout(item._idleTimeoutId);\n\n var msecs = item._idleTimeout;\n if (msecs >= 0) {\n item._idleTimeoutId = setTimeout(function onTimeout() {\n if (item._onTimeout)\n item._onTimeout();\n }, msecs);\n }\n};\n\n// setimmediate attaches itself to the global object\nrequire(\"setimmediate\");\n// On some exotic environments, it's not clear which object `setimmeidate` was\n// able to install onto. Search each possibility in the same order as the\n// `setimmediate` library.\nexports.setImmediate = (typeof self !== \"undefined\" && self.setImmediate) ||\n (typeof global !== \"undefined\" && global.setImmediate) ||\n (this && this.setImmediate);\nexports.clearImmediate = (typeof self !== \"undefined\" && self.clearImmediate) ||\n (typeof global !== \"undefined\" && global.clearImmediate) ||\n (this && this.clearImmediate);\n","'use strict';\n\n/*<replacement>*/\n\nvar processNextTick = require('process-nextick-args').nextTick;\n/*</replacement>*/\n\n// undocumented cb() API, needed for core, not for public API\nfunction destroy(err, cb) {\n var _this = this;\n\n var readableDestroyed = this._readableState && this._readableState.destroyed;\n var writableDestroyed = this._writableState && this._writableState.destroyed;\n\n if (readableDestroyed || writableDestroyed) {\n if (cb) {\n cb(err);\n } else if (err && (!this._writableState || !this._writableState.errorEmitted)) {\n processNextTick(emitErrorNT, this, err);\n }\n return this;\n }\n\n // we set destroyed to true before firing error callbacks in order\n // to make it re-entrance safe in case destroy() is called within callbacks\n\n if (this._readableState) {\n this._readableState.destroyed = true;\n }\n\n // if this is a duplex stream mark the writable part as destroyed as well\n if (this._writableState) {\n this._writableState.destroyed = true;\n }\n\n this._destroy(err || null, function (err) {\n if (!cb && err) {\n processNextTick(emitErrorNT, _this, err);\n if (_this._writableState) {\n _this._writableState.errorEmitted = true;\n }\n } else if (cb) {\n cb(err);\n }\n });\n\n return this;\n}\n\nfunction undestroy() {\n if (this._readableState) {\n this._readableState.destroyed = false;\n this._readableState.reading = false;\n this._readableState.ended = false;\n this._readableState.endEmitted = false;\n }\n\n if (this._writableState) {\n this._writableState.destroyed = false;\n this._writableState.ended = false;\n this._writableState.ending = false;\n this._writableState.finished = false;\n this._writableState.errorEmitted = false;\n }\n}\n\nfunction emitErrorNT(self, err) {\n self.emit('error', err);\n}\n\nmodule.exports = {\n destroy: destroy,\n undestroy: undestroy\n};","module.exports = require('events').EventEmitter;\n","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n'use strict';\n\n/*<replacement>*/\n\nvar processNextTick = require('process-nextick-args').nextTick;\n/*</replacement>*/\n\nmodule.exports = Readable;\n\n/*<replacement>*/\nvar isArray = require('isarray');\n/*</replacement>*/\n\n/*<replacement>*/\nvar Duplex;\n/*</replacement>*/\n\nReadable.ReadableState = ReadableState;\n\n/*<replacement>*/\nvar EE = require('events').EventEmitter;\n\nvar EElistenerCount = function (emitter, type) {\n return emitter.listeners(type).length;\n};\n/*</replacement>*/\n\n/*<replacement>*/\nvar Stream = require('./internal/streams/stream');\n/*</replacement>*/\n\n/*<replacement>*/\n\nvar Buffer = require('safe-buffer').Buffer;\nvar OurUint8Array = global.Uint8Array || function () {};\nfunction _uint8ArrayToBuffer(chunk) {\n return Buffer.from(chunk);\n}\nfunction _isUint8Array(obj) {\n return Buffer.isBuffer(obj) || obj instanceof OurUint8Array;\n}\n\n/*</replacement>*/\n\n/*<replacement>*/\nvar util = require('core-util-is');\nutil.inherits = require('inherits');\n/*</replacement>*/\n\n/*<replacement>*/\nvar debugUtil = require('util');\nvar debug = void 0;\nif (debugUtil && debugUtil.debuglog) {\n debug = debugUtil.debuglog('stream');\n} else {\n debug = function () {};\n}\n/*</replacement>*/\n\nvar BufferList = require('./internal/streams/BufferList');\nvar destroyImpl = require('./internal/streams/destroy');\nvar StringDecoder;\n\nutil.inherits(Readable, Stream);\n\nvar kProxyEvents = ['error', 'close', 'destroy', 'pause', 'resume'];\n\nfunction prependListener(emitter, event, fn) {\n // Sadly this is not cacheable as some libraries bundle their own\n // event emitter implementation with them.\n if (typeof emitter.prependListener === 'function') return emitter.prependListener(event, fn);\n\n // This is a hack to make sure that our error handler is attached before any\n // userland ones. NEVER DO THIS. This is here only because this code needs\n // to continue to work with older versions of Node.js that do not include\n // the prependListener() method. The goal is to eventually remove this hack.\n if (!emitter._events || !emitter._events[event]) emitter.on(event, fn);else if (isArray(emitter._events[event])) emitter._events[event].unshift(fn);else emitter._events[event] = [fn, emitter._events[event]];\n}\n\nfunction ReadableState(options, stream) {\n Duplex = Duplex || require('./_stream_duplex');\n\n options = options || {};\n\n // Duplex streams are both readable and writable, but share\n // the same options object.\n // However, some cases require setting options to different\n // values for the readable and the writable sides of the duplex stream.\n // These options can be provided separately as readableXXX and writableXXX.\n var isDuplex = stream instanceof Duplex;\n\n // object stream flag. Used to make read(n) ignore n and to\n // make all the buffer merging and length checks go away\n this.objectMode = !!options.objectMode;\n\n if (isDuplex) this.objectMode = this.objectMode || !!options.readableObjectMode;\n\n // the point at which it stops calling _read() to fill the buffer\n // Note: 0 is a valid value, means \"don't call _read preemptively ever\"\n var hwm = options.highWaterMark;\n var readableHwm = options.readableHighWaterMark;\n var defaultHwm = this.objectMode ? 16 : 16 * 1024;\n\n if (hwm || hwm === 0) this.highWaterMark = hwm;else if (isDuplex && (readableHwm || readableHwm === 0)) this.highWaterMark = readableHwm;else this.highWaterMark = defaultHwm;\n\n // cast to ints.\n this.highWaterMark = Math.floor(this.highWaterMark);\n\n // A linked list is used to store data chunks instead of an array because the\n // linked list can remove elements from the beginning faster than\n // array.shift()\n this.buffer = new BufferList();\n this.length = 0;\n this.pipes = null;\n this.pipesCount = 0;\n this.flowing = null;\n this.ended = false;\n this.endEmitted = false;\n this.reading = false;\n\n // a flag to be able to tell if the event 'readable'/'data' is emitted\n // immediately, or on a later tick. We set this to true at first, because\n // any actions that shouldn't happen until \"later\" should generally also\n // not happen before the first read call.\n this.sync = true;\n\n // whenever we return null, then we set a flag to say\n // that we're awaiting a 'readable' event emission.\n this.needReadable = false;\n this.emittedReadable = false;\n this.readableListening = false;\n this.resumeScheduled = false;\n\n // has it been destroyed\n this.destroyed = false;\n\n // Crypto is kind of old and crusty. Historically, its default string\n // encoding is 'binary' so we have to make this configurable.\n // Everything else in the universe uses 'utf8', though.\n this.defaultEncoding = options.defaultEncoding || 'utf8';\n\n // the number of writers that are awaiting a drain event in .pipe()s\n this.awaitDrain = 0;\n\n // if true, a maybeReadMore has been scheduled\n this.readingMore = false;\n\n this.decoder = null;\n this.encoding = null;\n if (options.encoding) {\n if (!StringDecoder) StringDecoder = require('string_decoder/').StringDecoder;\n this.decoder = new StringDecoder(options.encoding);\n this.encoding = options.encoding;\n }\n}\n\nfunction Readable(options) {\n Duplex = Duplex || require('./_stream_duplex');\n\n if (!(this instanceof Readable)) return new Readable(options);\n\n this._readableState = new ReadableState(options, this);\n\n // legacy\n this.readable = true;\n\n if (options) {\n if (typeof options.read === 'function') this._read = options.read;\n\n if (typeof options.destroy === 'function') this._destroy = options.destroy;\n }\n\n Stream.call(this);\n}\n\nObject.defineProperty(Readable.prototype, 'destroyed', {\n get: function () {\n if (this._readableState === undefined) {\n return false;\n }\n return this._readableState.destroyed;\n },\n set: function (value) {\n // we ignore the value if the stream\n // has not been initialized yet\n if (!this._readableState) {\n return;\n }\n\n // backward compatibility, the user is explicitly\n // managing destroyed\n this._readableState.destroyed = value;\n }\n});\n\nReadable.prototype.destroy = destroyImpl.destroy;\nReadable.prototype._undestroy = destroyImpl.undestroy;\nReadable.prototype._destroy = function (err, cb) {\n this.push(null);\n cb(err);\n};\n\n// Manually shove something into the read() buffer.\n// This returns true if the highWaterMark has not been hit yet,\n// similar to how Writable.write() returns true if you should\n// write() some more.\nReadable.prototype.push = function (chunk, encoding) {\n var state = this._readableState;\n var skipChunkCheck;\n\n if (!state.objectMode) {\n if (typeof chunk === 'string') {\n encoding = encoding || state.defaultEncoding;\n if (encoding !== state.encoding) {\n chunk = Buffer.from(chunk, encoding);\n encoding = '';\n }\n skipChunkCheck = true;\n }\n } else {\n skipChunkCheck = true;\n }\n\n return readableAddChunk(this, chunk, encoding, false, skipChunkCheck);\n};\n\n// Unshift should *always* be something directly out of read()\nReadable.prototype.unshift = function (chunk) {\n return readableAddChunk(this, chunk, null, true, false);\n};\n\nfunction readableAddChunk(stream, chunk, encoding, addToFront, skipChunkCheck) {\n var state = stream._readableState;\n if (chunk === null) {\n state.reading = false;\n onEofChunk(stream, state);\n } else {\n var er;\n if (!skipChunkCheck) er = chunkInvalid(state, chunk);\n if (er) {\n stream.emit('error', er);\n } else if (state.objectMode || chunk && chunk.length > 0) {\n if (typeof chunk !== 'string' && !state.objectMode && Object.getPrototypeOf(chunk) !== Buffer.prototype) {\n chunk = _uint8ArrayToBuffer(chunk);\n }\n\n if (addToFront) {\n if (state.endEmitted) stream.emit('error', new Error('stream.unshift() after end event'));else addChunk(stream, state, chunk, true);\n } else if (state.ended) {\n stream.emit('error', new Error('stream.push() after EOF'));\n } else {\n state.reading = false;\n if (state.decoder && !encoding) {\n chunk = state.decoder.write(chunk);\n if (state.objectMode || chunk.length !== 0) addChunk(stream, state, chunk, false);else maybeReadMore(stream, state);\n } else {\n addChunk(stream, state, chunk, false);\n }\n }\n } else if (!addToFront) {\n state.reading = false;\n }\n }\n\n return needMoreData(state);\n}\n\nfunction addChunk(stream, state, chunk, addToFront) {\n if (state.flowing && state.length === 0 && !state.sync) {\n stream.emit('data', chunk);\n stream.read(0);\n } else {\n // update the buffer info.\n state.length += state.objectMode ? 1 : chunk.length;\n if (addToFront) state.buffer.unshift(chunk);else state.buffer.push(chunk);\n\n if (state.needReadable) emitReadable(stream);\n }\n maybeReadMore(stream, state);\n}\n\nfunction chunkInvalid(state, chunk) {\n var er;\n if (!_isUint8Array(chunk) && typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {\n er = new TypeError('Invalid non-string/buffer chunk');\n }\n return er;\n}\n\n// if it's past the high water mark, we can push in some more.\n// Also, if we have no data yet, we can stand some\n// more bytes. This is to work around cases where hwm=0,\n// such as the repl. Also, if the push() triggered a\n// readable event, and the user called read(largeNumber) such that\n// needReadable was set, then we ought to push more, so that another\n// 'readable' event will be triggered.\nfunction needMoreData(state) {\n return !state.ended && (state.needReadable || state.length < state.highWaterMark || state.length === 0);\n}\n\nReadable.prototype.isPaused = function () {\n return this._readableState.flowing === false;\n};\n\n// backwards compatibility.\nReadable.prototype.setEncoding = function (enc) {\n if (!StringDecoder) StringDecoder = require('string_decoder/').StringDecoder;\n this._readableState.decoder = new StringDecoder(enc);\n this._readableState.encoding = enc;\n return this;\n};\n\n// Don't raise the hwm > 8MB\nvar MAX_HWM = 0x800000;\nfunction computeNewHighWaterMark(n) {\n if (n >= MAX_HWM) {\n n = MAX_HWM;\n } else {\n // Get the next highest power of 2 to prevent increasing hwm excessively in\n // tiny amounts\n n--;\n n |= n >>> 1;\n n |= n >>> 2;\n n |= n >>> 4;\n n |= n >>> 8;\n n |= n >>> 16;\n n++;\n }\n return n;\n}\n\n// This function is designed to be inlinable, so please take care when making\n// changes to the function body.\nfunction howMuchToRead(n, state) {\n if (n <= 0 || state.length === 0 && state.ended) return 0;\n if (state.objectMode) return 1;\n if (n !== n) {\n // Only flow one buffer at a time\n if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length;\n }\n // If we're asking for more than the current hwm, then raise the hwm.\n if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n);\n if (n <= state.length) return n;\n // Don't have enough\n if (!state.ended) {\n state.needReadable = true;\n return 0;\n }\n return state.length;\n}\n\n// you can override either this method, or the async _read(n) below.\nReadable.prototype.read = function (n) {\n debug('read', n);\n n = parseInt(n, 10);\n var state = this._readableState;\n var nOrig = n;\n\n if (n !== 0) state.emittedReadable = false;\n\n // if we're doing read(0) to trigger a readable event, but we\n // already have a bunch of data in the buffer, then just trigger\n // the 'readable' event and move on.\n if (n === 0 && state.needReadable && (state.length >= state.highWaterMark || state.ended)) {\n debug('read: emitReadable', state.length, state.ended);\n if (state.length === 0 && state.ended) endReadable(this);else emitReadable(this);\n return null;\n }\n\n n = howMuchToRead(n, state);\n\n // if we've ended, and we're now clear, then finish it up.\n if (n === 0 && state.ended) {\n if (state.length === 0) endReadable(this);\n return null;\n }\n\n // All the actual chunk generation logic needs to be\n // *below* the call to _read. The reason is that in certain\n // synthetic stream cases, such as passthrough streams, _read\n // may be a completely synchronous operation which may change\n // the state of the read buffer, providing enough data when\n // before there was *not* enough.\n //\n // So, the steps are:\n // 1. Figure out what the state of things will be after we do\n // a read from the buffer.\n //\n // 2. If that resulting state will trigger a _read, then call _read.\n // Note that this may be asynchronous, or synchronous. Yes, it is\n // deeply ugly to write APIs this way, but that still doesn't mean\n // that the Readable class should behave improperly, as streams are\n // designed to be sync/async agnostic.\n // Take note if the _read call is sync or async (ie, if the read call\n // has returned yet), so that we know whether or not it's safe to emit\n // 'readable' etc.\n //\n // 3. Actually pull the requested chunks out of the buffer and return.\n\n // if we need a readable event, then we need to do some reading.\n var doRead = state.needReadable;\n debug('need readable', doRead);\n\n // if we currently have less than the highWaterMark, then also read some\n if (state.length === 0 || state.length - n < state.highWaterMark) {\n doRead = true;\n debug('length less than watermark', doRead);\n }\n\n // however, if we've ended, then there's no point, and if we're already\n // reading, then it's unnecessary.\n if (state.ended || state.reading) {\n doRead = false;\n debug('reading or ended', doRead);\n } else if (doRead) {\n debug('do read');\n state.reading = true;\n state.sync = true;\n // if the length is currently zero, then we *need* a readable event.\n if (state.length === 0) state.needReadable = true;\n // call internal read method\n this._read(state.highWaterMark);\n state.sync = false;\n // If _read pushed data synchronously, then `reading` will be false,\n // and we need to re-evaluate how much data we can return to the user.\n if (!state.reading) n = howMuchToRead(nOrig, state);\n }\n\n var ret;\n if (n > 0) ret = fromList(n, state);else ret = null;\n\n if (ret === null) {\n state.needReadable = true;\n n = 0;\n } else {\n state.length -= n;\n }\n\n if (state.length === 0) {\n // If we have nothing in the buffer, then we want to know\n // as soon as we *do* get something into the buffer.\n if (!state.ended) state.needReadable = true;\n\n // If we tried to read() past the EOF, then emit end on the next tick.\n if (nOrig !== n && state.ended) endReadable(this);\n }\n\n if (ret !== null) this.emit('data', ret);\n\n return ret;\n};\n\nfunction onEofChunk(stream, state) {\n if (state.ended) return;\n if (state.decoder) {\n var chunk = state.decoder.end();\n if (chunk && chunk.length) {\n state.buffer.push(chunk);\n state.length += state.objectMode ? 1 : chunk.length;\n }\n }\n state.ended = true;\n\n // emit 'readable' now to make sure it gets picked up.\n emitReadable(stream);\n}\n\n// Don't emit readable right away in sync mode, because this can trigger\n// another read() call => stack overflow. This way, it might trigger\n// a nextTick recursion warning, but that's not so bad.\nfunction emitReadable(stream) {\n var state = stream._readableState;\n state.needReadable = false;\n if (!state.emittedReadable) {\n debug('emitReadable', state.flowing);\n state.emittedReadable = true;\n if (state.sync) processNextTick(emitReadable_, stream);else emitReadable_(stream);\n }\n}\n\nfunction emitReadable_(stream) {\n debug('emit readable');\n stream.emit('readable');\n flow(stream);\n}\n\n// at this point, the user has presumably seen the 'readable' event,\n// and called read() to consume some data. that may have triggered\n// in turn another _read(n) call, in which case reading = true if\n// it's in progress.\n// However, if we're not ended, or reading, and the length < hwm,\n// then go ahead and try to read some more preemptively.\nfunction maybeReadMore(stream, state) {\n if (!state.readingMore) {\n state.readingMore = true;\n processNextTick(maybeReadMore_, stream, state);\n }\n}\n\nfunction maybeReadMore_(stream, state) {\n var len = state.length;\n while (!state.reading && !state.flowing && !state.ended && state.length < state.highWaterMark) {\n debug('maybeReadMore read 0');\n stream.read(0);\n if (len === state.length)\n // didn't get any data, stop spinning.\n break;else len = state.length;\n }\n state.readingMore = false;\n}\n\n// abstract method. to be overridden in specific implementation classes.\n// call cb(er, data) where data is <= n in length.\n// for virtual (non-string, non-buffer) streams, \"length\" is somewhat\n// arbitrary, and perhaps not very meaningful.\nReadable.prototype._read = function (n) {\n this.emit('error', new Error('_read() is not implemented'));\n};\n\nReadable.prototype.pipe = function (dest, pipeOpts) {\n var src = this;\n var state = this._readableState;\n\n switch (state.pipesCount) {\n case 0:\n state.pipes = dest;\n break;\n case 1:\n state.pipes = [state.pipes, dest];\n break;\n default:\n state.pipes.push(dest);\n break;\n }\n state.pipesCount += 1;\n debug('pipe count=%d opts=%j', state.pipesCount, pipeOpts);\n\n var doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process.stdout && dest !== process.stderr;\n\n var endFn = doEnd ? onend : unpipe;\n if (state.endEmitted) processNextTick(endFn);else src.once('end', endFn);\n\n dest.on('unpipe', onunpipe);\n function onunpipe(readable, unpipeInfo) {\n debug('onunpipe');\n if (readable === src) {\n if (unpipeInfo && unpipeInfo.hasUnpiped === false) {\n unpipeInfo.hasUnpiped = true;\n cleanup();\n }\n }\n }\n\n function onend() {\n debug('onend');\n dest.end();\n }\n\n // when the dest drains, it reduces the awaitDrain counter\n // on the source. This would be more elegant with a .once()\n // handler in flow(), but adding and removing repeatedly is\n // too slow.\n var ondrain = pipeOnDrain(src);\n dest.on('drain', ondrain);\n\n var cleanedUp = false;\n function cleanup() {\n debug('cleanup');\n // cleanup event handlers once the pipe is broken\n dest.removeListener('close', onclose);\n dest.removeListener('finish', onfinish);\n dest.removeListener('drain', ondrain);\n dest.removeListener('error', onerror);\n dest.removeListener('unpipe', onunpipe);\n src.removeListener('end', onend);\n src.removeListener('end', unpipe);\n src.removeListener('data', ondata);\n\n cleanedUp = true;\n\n // if the reader is waiting for a drain event from this\n // specific writer, then it would cause it to never start\n // flowing again.\n // So, if this is awaiting a drain, then we just call it now.\n // If we don't know, then assume that we are waiting for one.\n if (state.awaitDrain && (!dest._writableState || dest._writableState.needDrain)) ondrain();\n }\n\n // If the user pushes more data while we're writing to dest then we'll end up\n // in ondata again. However, we only want to increase awaitDrain once because\n // dest will only emit one 'drain' event for the multiple writes.\n // => Introduce a guard on increasing awaitDrain.\n var increasedAwaitDrain = false;\n src.on('data', ondata);\n function ondata(chunk) {\n debug('ondata');\n increasedAwaitDrain = false;\n var ret = dest.write(chunk);\n if (false === ret && !increasedAwaitDrain) {\n // If the user unpiped during `dest.write()`, it is possible\n // to get stuck in a permanently paused state if that write\n // also returned false.\n // => Check whether `dest` is still a piping destination.\n if ((state.pipesCount === 1 && state.pipes === dest || state.pipesCount > 1 && indexOf(state.pipes, dest) !== -1) && !cleanedUp) {\n debug('false write response, pause', src._readableState.awaitDrain);\n src._readableState.awaitDrain++;\n increasedAwaitDrain = true;\n }\n src.pause();\n }\n }\n\n // if the dest has an error, then stop piping into it.\n // however, don't suppress the throwing behavior for this.\n function onerror(er) {\n debug('onerror', er);\n unpipe();\n dest.removeListener('error', onerror);\n if (EElistenerCount(dest, 'error') === 0) dest.emit('error', er);\n }\n\n // Make sure our error handler is attached before userland ones.\n prependListener(dest, 'error', onerror);\n\n // Both close and finish should trigger unpipe, but only once.\n function onclose() {\n dest.removeListener('finish', onfinish);\n unpipe();\n }\n dest.once('close', onclose);\n function onfinish() {\n debug('onfinish');\n dest.removeListener('close', onclose);\n unpipe();\n }\n dest.once('finish', onfinish);\n\n function unpipe() {\n debug('unpipe');\n src.unpipe(dest);\n }\n\n // tell the dest that it's being piped to\n dest.emit('pipe', src);\n\n // start the flow if it hasn't been started already.\n if (!state.flowing) {\n debug('pipe resume');\n src.resume();\n }\n\n return dest;\n};\n\nfunction pipeOnDrain(src) {\n return function () {\n var state = src._readableState;\n debug('pipeOnDrain', state.awaitDrain);\n if (state.awaitDrain) state.awaitDrain--;\n if (state.awaitDrain === 0 && EElistenerCount(src, 'data')) {\n state.flowing = true;\n flow(src);\n }\n };\n}\n\nReadable.prototype.unpipe = function (dest) {\n var state = this._readableState;\n var unpipeInfo = { hasUnpiped: false };\n\n // if we're not piping anywhere, then do nothing.\n if (state.pipesCount === 0) return this;\n\n // just one destination. most common case.\n if (state.pipesCount === 1) {\n // passed in one, but it's not the right one.\n if (dest && dest !== state.pipes) return this;\n\n if (!dest) dest = state.pipes;\n\n // got a match.\n state.pipes = null;\n state.pipesCount = 0;\n state.flowing = false;\n if (dest) dest.emit('unpipe', this, unpipeInfo);\n return this;\n }\n\n // slow case. multiple pipe destinations.\n\n if (!dest) {\n // remove all.\n var dests = state.pipes;\n var len = state.pipesCount;\n state.pipes = null;\n state.pipesCount = 0;\n state.flowing = false;\n\n for (var i = 0; i < len; i++) {\n dests[i].emit('unpipe', this, unpipeInfo);\n }return this;\n }\n\n // try to find the right one.\n var index = indexOf(state.pipes, dest);\n if (index === -1) return this;\n\n state.pipes.splice(index, 1);\n state.pipesCount -= 1;\n if (state.pipesCount === 1) state.pipes = state.pipes[0];\n\n dest.emit('unpipe', this, unpipeInfo);\n\n return this;\n};\n\n// set up data events if they are asked for\n// Ensure readable listeners eventually get something\nReadable.prototype.on = function (ev, fn) {\n var res = Stream.prototype.on.call(this, ev, fn);\n\n if (ev === 'data') {\n // Start flowing on next tick if stream isn't explicitly paused\n if (this._readableState.flowing !== false) this.resume();\n } else if (ev === 'readable') {\n var state = this._readableState;\n if (!state.endEmitted && !state.readableListening) {\n state.readableListening = state.needReadable = true;\n state.emittedReadable = false;\n if (!state.reading) {\n processNextTick(nReadingNextTick, this);\n } else if (state.length) {\n emitReadable(this);\n }\n }\n }\n\n return res;\n};\nReadable.prototype.addListener = Readable.prototype.on;\n\nfunction nReadingNextTick(self) {\n debug('readable nexttick read 0');\n self.read(0);\n}\n\n// pause() and resume() are remnants of the legacy readable stream API\n// If the user uses them, then switch into old mode.\nReadable.prototype.resume = function () {\n var state = this._readableState;\n if (!state.flowing) {\n debug('resume');\n state.flowing = true;\n resume(this, state);\n }\n return this;\n};\n\nfunction resume(stream, state) {\n if (!state.resumeScheduled) {\n state.resumeScheduled = true;\n processNextTick(resume_, stream, state);\n }\n}\n\nfunction resume_(stream, state) {\n if (!state.reading) {\n debug('resume read 0');\n stream.read(0);\n }\n\n state.resumeScheduled = false;\n state.awaitDrain = 0;\n stream.emit('resume');\n flow(stream);\n if (state.flowing && !state.reading) stream.read(0);\n}\n\nReadable.prototype.pause = function () {\n debug('call pause flowing=%j', this._readableState.flowing);\n if (false !== this._readableState.flowing) {\n debug('pause');\n this._readableState.flowing = false;\n this.emit('pause');\n }\n return this;\n};\n\nfunction flow(stream) {\n var state = stream._readableState;\n debug('flow', state.flowing);\n while (state.flowing && stream.read() !== null) {}\n}\n\n// wrap an old-style stream as the async data source.\n// This is *not* part of the readable stream interface.\n// It is an ugly unfortunate mess of history.\nReadable.prototype.wrap = function (stream) {\n var _this = this;\n\n var state = this._readableState;\n var paused = false;\n\n stream.on('end', function () {\n debug('wrapped end');\n if (state.decoder && !state.ended) {\n var chunk = state.decoder.end();\n if (chunk && chunk.length) _this.push(chunk);\n }\n\n _this.push(null);\n });\n\n stream.on('data', function (chunk) {\n debug('wrapped data');\n if (state.decoder) chunk = state.decoder.write(chunk);\n\n // don't skip over falsy values in objectMode\n if (state.objectMode && (chunk === null || chunk === undefined)) return;else if (!state.objectMode && (!chunk || !chunk.length)) return;\n\n var ret = _this.push(chunk);\n if (!ret) {\n paused = true;\n stream.pause();\n }\n });\n\n // proxy all the other methods.\n // important when wrapping filters and duplexes.\n for (var i in stream) {\n if (this[i] === undefined && typeof stream[i] === 'function') {\n this[i] = function (method) {\n return function () {\n return stream[method].apply(stream, arguments);\n };\n }(i);\n }\n }\n\n // proxy certain important events.\n for (var n = 0; n < kProxyEvents.length; n++) {\n stream.on(kProxyEvents[n], this.emit.bind(this, kProxyEvents[n]));\n }\n\n // when we try to consume some more bytes, simply unpause the\n // underlying stream.\n this._read = function (n) {\n debug('wrapped _read', n);\n if (paused) {\n paused = false;\n stream.resume();\n }\n };\n\n return this;\n};\n\n// exposed for testing purposes only.\nReadable._fromList = fromList;\n\n// Pluck off n bytes from an array of buffers.\n// Length is the combined lengths of all the buffers in the list.\n// This function is designed to be inlinable, so please take care when making\n// changes to the function body.\nfunction fromList(n, state) {\n // nothing buffered\n if (state.length === 0) return null;\n\n var ret;\n if (state.objectMode) ret = state.buffer.shift();else if (!n || n >= state.length) {\n // read it all, truncate the list\n if (state.decoder) ret = state.buffer.join('');else if (state.buffer.length === 1) ret = state.buffer.head.data;else ret = state.buffer.concat(state.length);\n state.buffer.clear();\n } else {\n // read part of list\n ret = fromListPartial(n, state.buffer, state.decoder);\n }\n\n return ret;\n}\n\n// Extracts only enough buffered data to satisfy the amount requested.\n// This function is designed to be inlinable, so please take care when making\n// changes to the function body.\nfunction fromListPartial(n, list, hasStrings) {\n var ret;\n if (n < list.head.data.length) {\n // slice is the same for buffers and strings\n ret = list.head.data.slice(0, n);\n list.head.data = list.head.data.slice(n);\n } else if (n === list.head.data.length) {\n // first chunk is a perfect match\n ret = list.shift();\n } else {\n // result spans more than one buffer\n ret = hasStrings ? copyFromBufferString(n, list) : copyFromBuffer(n, list);\n }\n return ret;\n}\n\n// Copies a specified amount of characters from the list of buffered data\n// chunks.\n// This function is designed to be inlinable, so please take care when making\n// changes to the function body.\nfunction copyFromBufferString(n, list) {\n var p = list.head;\n var c = 1;\n var ret = p.data;\n n -= ret.length;\n while (p = p.next) {\n var str = p.data;\n var nb = n > str.length ? str.length : n;\n if (nb === str.length) ret += str;else ret += str.slice(0, n);\n n -= nb;\n if (n === 0) {\n if (nb === str.length) {\n ++c;\n if (p.next) list.head = p.next;else list.head = list.tail = null;\n } else {\n list.head = p;\n p.data = str.slice(nb);\n }\n break;\n }\n ++c;\n }\n list.length -= c;\n return ret;\n}\n\n// Copies a specified amount of bytes from the list of buffered data chunks.\n// This function is designed to be inlinable, so please take care when making\n// changes to the function body.\nfunction copyFromBuffer(n, list) {\n var ret = Buffer.allocUnsafe(n);\n var p = list.head;\n var c = 1;\n p.data.copy(ret);\n n -= p.data.length;\n while (p = p.next) {\n var buf = p.data;\n var nb = n > buf.length ? buf.length : n;\n buf.copy(ret, ret.length - n, 0, nb);\n n -= nb;\n if (n === 0) {\n if (nb === buf.length) {\n ++c;\n if (p.next) list.head = p.next;else list.head = list.tail = null;\n } else {\n list.head = p;\n p.data = buf.slice(nb);\n }\n break;\n }\n ++c;\n }\n list.length -= c;\n return ret;\n}\n\nfunction endReadable(stream) {\n var state = stream._readableState;\n\n // If we get here before consuming all the bytes, then that is a\n // bug in node. Should never happen.\n if (state.length > 0) throw new Error('\"endReadable()\" called on non-empty stream');\n\n if (!state.endEmitted) {\n state.ended = true;\n processNextTick(endReadableNT, state, stream);\n }\n}\n\nfunction endReadableNT(state, stream) {\n // Check that we didn't get one last unshift.\n if (!state.endEmitted && state.length === 0) {\n state.endEmitted = true;\n stream.readable = false;\n stream.emit('end');\n }\n}\n\nfunction forEach(xs, f) {\n for (var i = 0, l = xs.length; i < l; i++) {\n f(xs[i], i);\n }\n}\n\nfunction indexOf(xs, x) {\n for (var i = 0, l = xs.length; i < l; i++) {\n if (xs[i] === x) return i;\n }\n return -1;\n}","/*\n * This file is used by module bundlers (browserify/webpack/etc) when\n * including a stream implementation. We use \"readable-stream\" to get a\n * consistent behavior between nodejs versions but bundlers often have a shim\n * for \"stream\". Using this shim greatly improve the compatibility and greatly\n * reduce the final size of the bundle (only one stream implementation, not\n * two).\n */\nmodule.exports = require(\"stream\");\n","var toString = {}.toString;\n\nmodule.exports = Array.isArray || function (arr) {\n return toString.call(arr) == '[object Array]';\n};\n","module.exports.id = 'ace/mode/javascript_worker';\nmodule.exports.src = \"\\\"no use strict\\\";!function(window){function resolveModuleId(id,paths){for(var testPath=id,tail=\\\"\\\";testPath;){var alias=paths[testPath];if(\\\"string\\\"==typeof alias)return alias+tail;if(alias)return alias.location.replace(/\\\\/*$/,\\\"/\\\")+(tail||alias.main||alias.name);if(alias===!1)return\\\"\\\";var i=testPath.lastIndexOf(\\\"/\\\");if(-1===i)break;tail=testPath.substr(i)+tail,testPath=testPath.slice(0,i)}return id}if(!(void 0!==window.window&&window.document||window.acequire&&window.define)){window.console||(window.console=function(){var msgs=Array.prototype.slice.call(arguments,0);postMessage({type:\\\"log\\\",data:msgs})},window.console.error=window.console.warn=window.console.log=window.console.trace=window.console),window.window=window,window.ace=window,window.onerror=function(message,file,line,col,err){postMessage({type:\\\"error\\\",data:{message:message,data:err.data,file:file,line:line,col:col,stack:err.stack}})},window.normalizeModule=function(parentId,moduleName){if(-1!==moduleName.indexOf(\\\"!\\\")){var chunks=moduleName.split(\\\"!\\\");return window.normalizeModule(parentId,chunks[0])+\\\"!\\\"+window.normalizeModule(parentId,chunks[1])}if(\\\".\\\"==moduleName.charAt(0)){var base=parentId.split(\\\"/\\\").slice(0,-1).join(\\\"/\\\");for(moduleName=(base?base+\\\"/\\\":\\\"\\\")+moduleName;-1!==moduleName.indexOf(\\\".\\\")&&previous!=moduleName;){var previous=moduleName;moduleName=moduleName.replace(/^\\\\.\\\\//,\\\"\\\").replace(/\\\\/\\\\.\\\\//,\\\"/\\\").replace(/[^\\\\/]+\\\\/\\\\.\\\\.\\\\//,\\\"\\\")}}return moduleName},window.acequire=function acequire(parentId,id){if(id||(id=parentId,parentId=null),!id.charAt)throw Error(\\\"worker.js acequire() accepts only (parentId, id) as arguments\\\");id=window.normalizeModule(parentId,id);var module=window.acequire.modules[id];if(module)return module.initialized||(module.initialized=!0,module.exports=module.factory().exports),module.exports;if(!window.acequire.tlns)return console.log(\\\"unable to load \\\"+id);var path=resolveModuleId(id,window.acequire.tlns);return\\\".js\\\"!=path.slice(-3)&&(path+=\\\".js\\\"),window.acequire.id=id,window.acequire.modules[id]={},importScripts(path),window.acequire(parentId,id)},window.acequire.modules={},window.acequire.tlns={},window.define=function(id,deps,factory){if(2==arguments.length?(factory=deps,\\\"string\\\"!=typeof id&&(deps=id,id=window.acequire.id)):1==arguments.length&&(factory=id,deps=[],id=window.acequire.id),\\\"function\\\"!=typeof factory)return window.acequire.modules[id]={exports:factory,initialized:!0},void 0;deps.length||(deps=[\\\"require\\\",\\\"exports\\\",\\\"module\\\"]);var req=function(childId){return window.acequire(id,childId)};window.acequire.modules[id]={exports:{},factory:function(){var module=this,returnExports=factory.apply(this,deps.map(function(dep){switch(dep){case\\\"require\\\":return req;case\\\"exports\\\":return module.exports;case\\\"module\\\":return module;default:return req(dep)}}));return returnExports&&(module.exports=returnExports),module}}},window.define.amd={},acequire.tlns={},window.initBaseUrls=function(topLevelNamespaces){for(var i in topLevelNamespaces)acequire.tlns[i]=topLevelNamespaces[i]},window.initSender=function(){var EventEmitter=window.acequire(\\\"ace/lib/event_emitter\\\").EventEmitter,oop=window.acequire(\\\"ace/lib/oop\\\"),Sender=function(){};return function(){oop.implement(this,EventEmitter),this.callback=function(data,callbackId){postMessage({type:\\\"call\\\",id:callbackId,data:data})},this.emit=function(name,data){postMessage({type:\\\"event\\\",name:name,data:data})}}.call(Sender.prototype),new Sender};var main=window.main=null,sender=window.sender=null;window.onmessage=function(e){var msg=e.data;if(msg.event&&sender)sender._signal(msg.event,msg.data);else if(msg.command)if(main[msg.command])main[msg.command].apply(main,msg.args);else{if(!window[msg.command])throw Error(\\\"Unknown command:\\\"+msg.command);window[msg.command].apply(window,msg.args)}else if(msg.init){window.initBaseUrls(msg.tlns),acequire(\\\"ace/lib/es5-shim\\\"),sender=window.sender=window.initSender();var clazz=acequire(msg.module)[msg.classname];main=window.main=new clazz(sender)}}}}(this),ace.define(\\\"ace/lib/oop\\\",[\\\"require\\\",\\\"exports\\\",\\\"module\\\"],function(acequire,exports){\\\"use strict\\\";exports.inherits=function(ctor,superCtor){ctor.super_=superCtor,ctor.prototype=Object.create(superCtor.prototype,{constructor:{value:ctor,enumerable:!1,writable:!0,configurable:!0}})},exports.mixin=function(obj,mixin){for(var key in mixin)obj[key]=mixin[key];return obj},exports.implement=function(proto,mixin){exports.mixin(proto,mixin)}}),ace.define(\\\"ace/range\\\",[\\\"require\\\",\\\"exports\\\",\\\"module\\\"],function(acequire,exports){\\\"use strict\\\";var comparePoints=function(p1,p2){return p1.row-p2.row||p1.column-p2.column},Range=function(startRow,startColumn,endRow,endColumn){this.start={row:startRow,column:startColumn},this.end={row:endRow,column:endColumn}};(function(){this.isEqual=function(range){return this.start.row===range.start.row&&this.end.row===range.end.row&&this.start.column===range.start.column&&this.end.column===range.end.column},this.toString=function(){return\\\"Range: [\\\"+this.start.row+\\\"/\\\"+this.start.column+\\\"] -> [\\\"+this.end.row+\\\"/\\\"+this.end.column+\\\"]\\\"},this.contains=function(row,column){return 0==this.compare(row,column)},this.compareRange=function(range){var cmp,end=range.end,start=range.start;return cmp=this.compare(end.row,end.column),1==cmp?(cmp=this.compare(start.row,start.column),1==cmp?2:0==cmp?1:0):-1==cmp?-2:(cmp=this.compare(start.row,start.column),-1==cmp?-1:1==cmp?42:0)},this.comparePoint=function(p){return this.compare(p.row,p.column)},this.containsRange=function(range){return 0==this.comparePoint(range.start)&&0==this.comparePoint(range.end)},this.intersects=function(range){var cmp=this.compareRange(range);return-1==cmp||0==cmp||1==cmp},this.isEnd=function(row,column){return this.end.row==row&&this.end.column==column},this.isStart=function(row,column){return this.start.row==row&&this.start.column==column},this.setStart=function(row,column){\\\"object\\\"==typeof row?(this.start.column=row.column,this.start.row=row.row):(this.start.row=row,this.start.column=column)},this.setEnd=function(row,column){\\\"object\\\"==typeof row?(this.end.column=row.column,this.end.row=row.row):(this.end.row=row,this.end.column=column)},this.inside=function(row,column){return 0==this.compare(row,column)?this.isEnd(row,column)||this.isStart(row,column)?!1:!0:!1},this.insideStart=function(row,column){return 0==this.compare(row,column)?this.isEnd(row,column)?!1:!0:!1},this.insideEnd=function(row,column){return 0==this.compare(row,column)?this.isStart(row,column)?!1:!0:!1},this.compare=function(row,column){return this.isMultiLine()||row!==this.start.row?this.start.row>row?-1:row>this.end.row?1:this.start.row===row?column>=this.start.column?0:-1:this.end.row===row?this.end.column>=column?0:1:0:this.start.column>column?-1:column>this.end.column?1:0},this.compareStart=function(row,column){return this.start.row==row&&this.start.column==column?-1:this.compare(row,column)},this.compareEnd=function(row,column){return this.end.row==row&&this.end.column==column?1:this.compare(row,column)},this.compareInside=function(row,column){return this.end.row==row&&this.end.column==column?1:this.start.row==row&&this.start.column==column?-1:this.compare(row,column)},this.clipRows=function(firstRow,lastRow){if(this.end.row>lastRow)var end={row:lastRow+1,column:0};else if(firstRow>this.end.row)var end={row:firstRow,column:0};if(this.start.row>lastRow)var start={row:lastRow+1,column:0};else if(firstRow>this.start.row)var start={row:firstRow,column:0};return Range.fromPoints(start||this.start,end||this.end)},this.extend=function(row,column){var cmp=this.compare(row,column);if(0==cmp)return this;if(-1==cmp)var start={row:row,column:column};else var end={row:row,column:column};return Range.fromPoints(start||this.start,end||this.end)},this.isEmpty=function(){return this.start.row===this.end.row&&this.start.column===this.end.column},this.isMultiLine=function(){return this.start.row!==this.end.row},this.clone=function(){return Range.fromPoints(this.start,this.end)},this.collapseRows=function(){return 0==this.end.column?new Range(this.start.row,0,Math.max(this.start.row,this.end.row-1),0):new Range(this.start.row,0,this.end.row,0)},this.toScreenRange=function(session){var screenPosStart=session.documentToScreenPosition(this.start),screenPosEnd=session.documentToScreenPosition(this.end);return new Range(screenPosStart.row,screenPosStart.column,screenPosEnd.row,screenPosEnd.column)},this.moveBy=function(row,column){this.start.row+=row,this.start.column+=column,this.end.row+=row,this.end.column+=column}}).call(Range.prototype),Range.fromPoints=function(start,end){return new Range(start.row,start.column,end.row,end.column)},Range.comparePoints=comparePoints,Range.comparePoints=function(p1,p2){return p1.row-p2.row||p1.column-p2.column},exports.Range=Range}),ace.define(\\\"ace/apply_delta\\\",[\\\"require\\\",\\\"exports\\\",\\\"module\\\"],function(acequire,exports){\\\"use strict\\\";exports.applyDelta=function(docLines,delta){var row=delta.start.row,startColumn=delta.start.column,line=docLines[row]||\\\"\\\";switch(delta.action){case\\\"insert\\\":var lines=delta.lines;if(1===lines.length)docLines[row]=line.substring(0,startColumn)+delta.lines[0]+line.substring(startColumn);else{var args=[row,1].concat(delta.lines);docLines.splice.apply(docLines,args),docLines[row]=line.substring(0,startColumn)+docLines[row],docLines[row+delta.lines.length-1]+=line.substring(startColumn)}break;case\\\"remove\\\":var endColumn=delta.end.column,endRow=delta.end.row;row===endRow?docLines[row]=line.substring(0,startColumn)+line.substring(endColumn):docLines.splice(row,endRow-row+1,line.substring(0,startColumn)+docLines[endRow].substring(endColumn))}}}),ace.define(\\\"ace/lib/event_emitter\\\",[\\\"require\\\",\\\"exports\\\",\\\"module\\\"],function(acequire,exports){\\\"use strict\\\";var EventEmitter={},stopPropagation=function(){this.propagationStopped=!0},preventDefault=function(){this.defaultPrevented=!0};EventEmitter._emit=EventEmitter._dispatchEvent=function(eventName,e){this._eventRegistry||(this._eventRegistry={}),this._defaultHandlers||(this._defaultHandlers={});var listeners=this._eventRegistry[eventName]||[],defaultHandler=this._defaultHandlers[eventName];if(listeners.length||defaultHandler){\\\"object\\\"==typeof e&&e||(e={}),e.type||(e.type=eventName),e.stopPropagation||(e.stopPropagation=stopPropagation),e.preventDefault||(e.preventDefault=preventDefault),listeners=listeners.slice();for(var i=0;listeners.length>i&&(listeners[i](e,this),!e.propagationStopped);i++);return defaultHandler&&!e.defaultPrevented?defaultHandler(e,this):void 0}},EventEmitter._signal=function(eventName,e){var listeners=(this._eventRegistry||{})[eventName];if(listeners){listeners=listeners.slice();for(var i=0;listeners.length>i;i++)listeners[i](e,this)}},EventEmitter.once=function(eventName,callback){var _self=this;callback&&this.addEventListener(eventName,function newCallback(){_self.removeEventListener(eventName,newCallback),callback.apply(null,arguments)})},EventEmitter.setDefaultHandler=function(eventName,callback){var handlers=this._defaultHandlers;if(handlers||(handlers=this._defaultHandlers={_disabled_:{}}),handlers[eventName]){var old=handlers[eventName],disabled=handlers._disabled_[eventName];disabled||(handlers._disabled_[eventName]=disabled=[]),disabled.push(old);var i=disabled.indexOf(callback);-1!=i&&disabled.splice(i,1)}handlers[eventName]=callback},EventEmitter.removeDefaultHandler=function(eventName,callback){var handlers=this._defaultHandlers;if(handlers){var disabled=handlers._disabled_[eventName];if(handlers[eventName]==callback)handlers[eventName],disabled&&this.setDefaultHandler(eventName,disabled.pop());else if(disabled){var i=disabled.indexOf(callback);-1!=i&&disabled.splice(i,1)}}},EventEmitter.on=EventEmitter.addEventListener=function(eventName,callback,capturing){this._eventRegistry=this._eventRegistry||{};var listeners=this._eventRegistry[eventName];return listeners||(listeners=this._eventRegistry[eventName]=[]),-1==listeners.indexOf(callback)&&listeners[capturing?\\\"unshift\\\":\\\"push\\\"](callback),callback},EventEmitter.off=EventEmitter.removeListener=EventEmitter.removeEventListener=function(eventName,callback){this._eventRegistry=this._eventRegistry||{};var listeners=this._eventRegistry[eventName];if(listeners){var index=listeners.indexOf(callback);-1!==index&&listeners.splice(index,1)}},EventEmitter.removeAllListeners=function(eventName){this._eventRegistry&&(this._eventRegistry[eventName]=[])},exports.EventEmitter=EventEmitter}),ace.define(\\\"ace/anchor\\\",[\\\"require\\\",\\\"exports\\\",\\\"module\\\",\\\"ace/lib/oop\\\",\\\"ace/lib/event_emitter\\\"],function(acequire,exports){\\\"use strict\\\";var oop=acequire(\\\"./lib/oop\\\"),EventEmitter=acequire(\\\"./lib/event_emitter\\\").EventEmitter,Anchor=exports.Anchor=function(doc,row,column){this.$onChange=this.onChange.bind(this),this.attach(doc),column===void 0?this.setPosition(row.row,row.column):this.setPosition(row,column)};(function(){function $pointsInOrder(point1,point2,equalPointsInOrder){var bColIsAfter=equalPointsInOrder?point1.column<=point2.column:point1.column<point2.column;return point1.row<point2.row||point1.row==point2.row&&bColIsAfter}function $getTransformedPoint(delta,point,moveIfEqual){var deltaIsInsert=\\\"insert\\\"==delta.action,deltaRowShift=(deltaIsInsert?1:-1)*(delta.end.row-delta.start.row),deltaColShift=(deltaIsInsert?1:-1)*(delta.end.column-delta.start.column),deltaStart=delta.start,deltaEnd=deltaIsInsert?deltaStart:delta.end;return $pointsInOrder(point,deltaStart,moveIfEqual)?{row:point.row,column:point.column}:$pointsInOrder(deltaEnd,point,!moveIfEqual)?{row:point.row+deltaRowShift,column:point.column+(point.row==deltaEnd.row?deltaColShift:0)}:{row:deltaStart.row,column:deltaStart.column}}oop.implement(this,EventEmitter),this.getPosition=function(){return this.$clipPositionToDocument(this.row,this.column)},this.getDocument=function(){return this.document},this.$insertRight=!1,this.onChange=function(delta){if(!(delta.start.row==delta.end.row&&delta.start.row!=this.row||delta.start.row>this.row)){var point=$getTransformedPoint(delta,{row:this.row,column:this.column},this.$insertRight);this.setPosition(point.row,point.column,!0)}},this.setPosition=function(row,column,noClip){var pos;if(pos=noClip?{row:row,column:column}:this.$clipPositionToDocument(row,column),this.row!=pos.row||this.column!=pos.column){var old={row:this.row,column:this.column};this.row=pos.row,this.column=pos.column,this._signal(\\\"change\\\",{old:old,value:pos})}},this.detach=function(){this.document.removeEventListener(\\\"change\\\",this.$onChange)},this.attach=function(doc){this.document=doc||this.document,this.document.on(\\\"change\\\",this.$onChange)},this.$clipPositionToDocument=function(row,column){var pos={};return row>=this.document.getLength()?(pos.row=Math.max(0,this.document.getLength()-1),pos.column=this.document.getLine(pos.row).length):0>row?(pos.row=0,pos.column=0):(pos.row=row,pos.column=Math.min(this.document.getLine(pos.row).length,Math.max(0,column))),0>column&&(pos.column=0),pos}}).call(Anchor.prototype)}),ace.define(\\\"ace/document\\\",[\\\"require\\\",\\\"exports\\\",\\\"module\\\",\\\"ace/lib/oop\\\",\\\"ace/apply_delta\\\",\\\"ace/lib/event_emitter\\\",\\\"ace/range\\\",\\\"ace/anchor\\\"],function(acequire,exports){\\\"use strict\\\";var oop=acequire(\\\"./lib/oop\\\"),applyDelta=acequire(\\\"./apply_delta\\\").applyDelta,EventEmitter=acequire(\\\"./lib/event_emitter\\\").EventEmitter,Range=acequire(\\\"./range\\\").Range,Anchor=acequire(\\\"./anchor\\\").Anchor,Document=function(textOrLines){this.$lines=[\\\"\\\"],0===textOrLines.length?this.$lines=[\\\"\\\"]:Array.isArray(textOrLines)?this.insertMergedLines({row:0,column:0},textOrLines):this.insert({row:0,column:0},textOrLines)};(function(){oop.implement(this,EventEmitter),this.setValue=function(text){var len=this.getLength()-1;this.remove(new Range(0,0,len,this.getLine(len).length)),this.insert({row:0,column:0},text)},this.getValue=function(){return this.getAllLines().join(this.getNewLineCharacter())},this.createAnchor=function(row,column){return new Anchor(this,row,column)},this.$split=0===\\\"aaa\\\".split(/a/).length?function(text){return text.replace(/\\\\r\\\\n|\\\\r/g,\\\"\\\\n\\\").split(\\\"\\\\n\\\")}:function(text){return text.split(/\\\\r\\\\n|\\\\r|\\\\n/)},this.$detectNewLine=function(text){var match=text.match(/^.*?(\\\\r\\\\n|\\\\r|\\\\n)/m);this.$autoNewLine=match?match[1]:\\\"\\\\n\\\",this._signal(\\\"changeNewLineMode\\\")},this.getNewLineCharacter=function(){switch(this.$newLineMode){case\\\"windows\\\":return\\\"\\\\r\\\\n\\\";case\\\"unix\\\":return\\\"\\\\n\\\";default:return this.$autoNewLine||\\\"\\\\n\\\"}},this.$autoNewLine=\\\"\\\",this.$newLineMode=\\\"auto\\\",this.setNewLineMode=function(newLineMode){this.$newLineMode!==newLineMode&&(this.$newLineMode=newLineMode,this._signal(\\\"changeNewLineMode\\\"))},this.getNewLineMode=function(){return this.$newLineMode},this.isNewLine=function(text){return\\\"\\\\r\\\\n\\\"==text||\\\"\\\\r\\\"==text||\\\"\\\\n\\\"==text},this.getLine=function(row){return this.$lines[row]||\\\"\\\"},this.getLines=function(firstRow,lastRow){return this.$lines.slice(firstRow,lastRow+1)},this.getAllLines=function(){return this.getLines(0,this.getLength())},this.getLength=function(){return this.$lines.length},this.getTextRange=function(range){return this.getLinesForRange(range).join(this.getNewLineCharacter())},this.getLinesForRange=function(range){var lines;if(range.start.row===range.end.row)lines=[this.getLine(range.start.row).substring(range.start.column,range.end.column)];else{lines=this.getLines(range.start.row,range.end.row),lines[0]=(lines[0]||\\\"\\\").substring(range.start.column);var l=lines.length-1;range.end.row-range.start.row==l&&(lines[l]=lines[l].substring(0,range.end.column))}return lines},this.insertLines=function(row,lines){return console.warn(\\\"Use of document.insertLines is deprecated. Use the insertFullLines method instead.\\\"),this.insertFullLines(row,lines)},this.removeLines=function(firstRow,lastRow){return console.warn(\\\"Use of document.removeLines is deprecated. Use the removeFullLines method instead.\\\"),this.removeFullLines(firstRow,lastRow)},this.insertNewLine=function(position){return console.warn(\\\"Use of document.insertNewLine is deprecated. Use insertMergedLines(position, ['', '']) instead.\\\"),this.insertMergedLines(position,[\\\"\\\",\\\"\\\"])},this.insert=function(position,text){return 1>=this.getLength()&&this.$detectNewLine(text),this.insertMergedLines(position,this.$split(text))},this.insertInLine=function(position,text){var start=this.clippedPos(position.row,position.column),end=this.pos(position.row,position.column+text.length);return this.applyDelta({start:start,end:end,action:\\\"insert\\\",lines:[text]},!0),this.clonePos(end)},this.clippedPos=function(row,column){var length=this.getLength();void 0===row?row=length:0>row?row=0:row>=length&&(row=length-1,column=void 0);var line=this.getLine(row);return void 0==column&&(column=line.length),column=Math.min(Math.max(column,0),line.length),{row:row,column:column}},this.clonePos=function(pos){return{row:pos.row,column:pos.column}},this.pos=function(row,column){return{row:row,column:column}},this.$clipPosition=function(position){var length=this.getLength();return position.row>=length?(position.row=Math.max(0,length-1),position.column=this.getLine(length-1).length):(position.row=Math.max(0,position.row),position.column=Math.min(Math.max(position.column,0),this.getLine(position.row).length)),position},this.insertFullLines=function(row,lines){row=Math.min(Math.max(row,0),this.getLength());var column=0;this.getLength()>row?(lines=lines.concat([\\\"\\\"]),column=0):(lines=[\\\"\\\"].concat(lines),row--,column=this.$lines[row].length),this.insertMergedLines({row:row,column:column},lines)},this.insertMergedLines=function(position,lines){var start=this.clippedPos(position.row,position.column),end={row:start.row+lines.length-1,column:(1==lines.length?start.column:0)+lines[lines.length-1].length};return this.applyDelta({start:start,end:end,action:\\\"insert\\\",lines:lines}),this.clonePos(end)},this.remove=function(range){var start=this.clippedPos(range.start.row,range.start.column),end=this.clippedPos(range.end.row,range.end.column);return this.applyDelta({start:start,end:end,action:\\\"remove\\\",lines:this.getLinesForRange({start:start,end:end})}),this.clonePos(start)},this.removeInLine=function(row,startColumn,endColumn){var start=this.clippedPos(row,startColumn),end=this.clippedPos(row,endColumn);return this.applyDelta({start:start,end:end,action:\\\"remove\\\",lines:this.getLinesForRange({start:start,end:end})},!0),this.clonePos(start)},this.removeFullLines=function(firstRow,lastRow){firstRow=Math.min(Math.max(0,firstRow),this.getLength()-1),lastRow=Math.min(Math.max(0,lastRow),this.getLength()-1);var deleteFirstNewLine=lastRow==this.getLength()-1&&firstRow>0,deleteLastNewLine=this.getLength()-1>lastRow,startRow=deleteFirstNewLine?firstRow-1:firstRow,startCol=deleteFirstNewLine?this.getLine(startRow).length:0,endRow=deleteLastNewLine?lastRow+1:lastRow,endCol=deleteLastNewLine?0:this.getLine(endRow).length,range=new Range(startRow,startCol,endRow,endCol),deletedLines=this.$lines.slice(firstRow,lastRow+1);return this.applyDelta({start:range.start,end:range.end,action:\\\"remove\\\",lines:this.getLinesForRange(range)}),deletedLines},this.removeNewLine=function(row){this.getLength()-1>row&&row>=0&&this.applyDelta({start:this.pos(row,this.getLine(row).length),end:this.pos(row+1,0),action:\\\"remove\\\",lines:[\\\"\\\",\\\"\\\"]})},this.replace=function(range,text){if(range instanceof Range||(range=Range.fromPoints(range.start,range.end)),0===text.length&&range.isEmpty())return range.start;if(text==this.getTextRange(range))return range.end;this.remove(range);var end;return end=text?this.insert(range.start,text):range.start},this.applyDeltas=function(deltas){for(var i=0;deltas.length>i;i++)this.applyDelta(deltas[i])},this.revertDeltas=function(deltas){for(var i=deltas.length-1;i>=0;i--)this.revertDelta(deltas[i])},this.applyDelta=function(delta,doNotValidate){var isInsert=\\\"insert\\\"==delta.action;(isInsert?1>=delta.lines.length&&!delta.lines[0]:!Range.comparePoints(delta.start,delta.end))||(isInsert&&delta.lines.length>2e4&&this.$splitAndapplyLargeDelta(delta,2e4),applyDelta(this.$lines,delta,doNotValidate),this._signal(\\\"change\\\",delta))},this.$splitAndapplyLargeDelta=function(delta,MAX){for(var lines=delta.lines,l=lines.length,row=delta.start.row,column=delta.start.column,from=0,to=0;;){from=to,to+=MAX-1;var chunk=lines.slice(from,to);if(to>l){delta.lines=chunk,delta.start.row=row+from,delta.start.column=column;break}chunk.push(\\\"\\\"),this.applyDelta({start:this.pos(row+from,column),end:this.pos(row+to,column=0),action:delta.action,lines:chunk},!0)}},this.revertDelta=function(delta){this.applyDelta({start:this.clonePos(delta.start),end:this.clonePos(delta.end),action:\\\"insert\\\"==delta.action?\\\"remove\\\":\\\"insert\\\",lines:delta.lines.slice()})},this.indexToPosition=function(index,startRow){for(var lines=this.$lines||this.getAllLines(),newlineLength=this.getNewLineCharacter().length,i=startRow||0,l=lines.length;l>i;i++)if(index-=lines[i].length+newlineLength,0>index)return{row:i,column:index+lines[i].length+newlineLength};return{row:l-1,column:lines[l-1].length}},this.positionToIndex=function(pos,startRow){for(var lines=this.$lines||this.getAllLines(),newlineLength=this.getNewLineCharacter().length,index=0,row=Math.min(pos.row,lines.length),i=startRow||0;row>i;++i)index+=lines[i].length+newlineLength;return index+pos.column}}).call(Document.prototype),exports.Document=Document}),ace.define(\\\"ace/lib/lang\\\",[\\\"require\\\",\\\"exports\\\",\\\"module\\\"],function(acequire,exports){\\\"use strict\\\";exports.last=function(a){return a[a.length-1]},exports.stringReverse=function(string){return string.split(\\\"\\\").reverse().join(\\\"\\\")},exports.stringRepeat=function(string,count){for(var result=\\\"\\\";count>0;)1&count&&(result+=string),(count>>=1)&&(string+=string);return result};var trimBeginRegexp=/^\\\\s\\\\s*/,trimEndRegexp=/\\\\s\\\\s*$/;exports.stringTrimLeft=function(string){return string.replace(trimBeginRegexp,\\\"\\\")},exports.stringTrimRight=function(string){return string.replace(trimEndRegexp,\\\"\\\")},exports.copyObject=function(obj){var copy={};for(var key in obj)copy[key]=obj[key];return copy},exports.copyArray=function(array){for(var copy=[],i=0,l=array.length;l>i;i++)copy[i]=array[i]&&\\\"object\\\"==typeof array[i]?this.copyObject(array[i]):array[i];return copy},exports.deepCopy=function deepCopy(obj){if(\\\"object\\\"!=typeof obj||!obj)return obj;var copy;if(Array.isArray(obj)){copy=[];for(var key=0;obj.length>key;key++)copy[key]=deepCopy(obj[key]);return copy}if(\\\"[object Object]\\\"!==Object.prototype.toString.call(obj))return obj;copy={};for(var key in obj)copy[key]=deepCopy(obj[key]);return copy},exports.arrayToMap=function(arr){for(var map={},i=0;arr.length>i;i++)map[arr[i]]=1;return map},exports.createMap=function(props){var map=Object.create(null);for(var i in props)map[i]=props[i];return map},exports.arrayRemove=function(array,value){for(var i=0;array.length>=i;i++)value===array[i]&&array.splice(i,1)},exports.escapeRegExp=function(str){return str.replace(/([.*+?^${}()|[\\\\]\\\\/\\\\\\\\])/g,\\\"\\\\\\\\$1\\\")},exports.escapeHTML=function(str){return str.replace(/&/g,\\\"&#38;\\\").replace(/\\\"/g,\\\"&#34;\\\").replace(/'/g,\\\"&#39;\\\").replace(/</g,\\\"&#60;\\\")},exports.getMatchOffsets=function(string,regExp){var matches=[];return string.replace(regExp,function(str){matches.push({offset:arguments[arguments.length-2],length:str.length})}),matches},exports.deferredCall=function(fcn){var timer=null,callback=function(){timer=null,fcn()},deferred=function(timeout){return deferred.cancel(),timer=setTimeout(callback,timeout||0),deferred};return deferred.schedule=deferred,deferred.call=function(){return this.cancel(),fcn(),deferred},deferred.cancel=function(){return clearTimeout(timer),timer=null,deferred},deferred.isPending=function(){return timer},deferred},exports.delayedCall=function(fcn,defaultTimeout){var timer=null,callback=function(){timer=null,fcn()},_self=function(timeout){null==timer&&(timer=setTimeout(callback,timeout||defaultTimeout))};return _self.delay=function(timeout){timer&&clearTimeout(timer),timer=setTimeout(callback,timeout||defaultTimeout)},_self.schedule=_self,_self.call=function(){this.cancel(),fcn()},_self.cancel=function(){timer&&clearTimeout(timer),timer=null},_self.isPending=function(){return timer},_self}}),ace.define(\\\"ace/worker/mirror\\\",[\\\"require\\\",\\\"exports\\\",\\\"module\\\",\\\"ace/range\\\",\\\"ace/document\\\",\\\"ace/lib/lang\\\"],function(acequire,exports){\\\"use strict\\\";acequire(\\\"../range\\\").Range;var Document=acequire(\\\"../document\\\").Document,lang=acequire(\\\"../lib/lang\\\"),Mirror=exports.Mirror=function(sender){this.sender=sender;var doc=this.doc=new Document(\\\"\\\"),deferredUpdate=this.deferredUpdate=lang.delayedCall(this.onUpdate.bind(this)),_self=this;sender.on(\\\"change\\\",function(e){var data=e.data;if(data[0].start)doc.applyDeltas(data);else for(var i=0;data.length>i;i+=2){if(Array.isArray(data[i+1]))var d={action:\\\"insert\\\",start:data[i],lines:data[i+1]};else var d={action:\\\"remove\\\",start:data[i],end:data[i+1]};doc.applyDelta(d,!0)}return _self.$timeout?deferredUpdate.schedule(_self.$timeout):(_self.onUpdate(),void 0)})};(function(){this.$timeout=500,this.setTimeout=function(timeout){this.$timeout=timeout},this.setValue=function(value){this.doc.setValue(value),this.deferredUpdate.schedule(this.$timeout)},this.getValue=function(callbackId){this.sender.callback(this.doc.getValue(),callbackId)},this.onUpdate=function(){},this.isPending=function(){return this.deferredUpdate.isPending()}}).call(Mirror.prototype)}),ace.define(\\\"ace/mode/javascript/jshint\\\",[\\\"require\\\",\\\"exports\\\",\\\"module\\\"],function(acequire,exports,module){module.exports=function outer(modules,cache,entry){function newRequire(name,jumped){if(!cache[name]){if(!modules[name]){var currentRequire=\\\"function\\\"==typeof acequire&&acequire;if(!jumped&&currentRequire)return currentRequire(name,!0);if(previousRequire)return previousRequire(name,!0);var err=Error(\\\"Cannot find module '\\\"+name+\\\"'\\\");throw err.code=\\\"MODULE_NOT_FOUND\\\",err}var m=cache[name]={exports:{}};modules[name][0].call(m.exports,function(x){var id=modules[name][1][x];return newRequire(id?id:x)},m,m.exports,outer,modules,cache,entry)}return cache[name].exports}for(var previousRequire=\\\"function\\\"==typeof acequire&&acequire,i=0;entry.length>i;i++)newRequire(entry[i]);return newRequire(entry[0])}({\\\"/node_modules/browserify/node_modules/events/events.js\\\":[function(_dereq_,module){function EventEmitter(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function isFunction(arg){return\\\"function\\\"==typeof arg}function isNumber(arg){return\\\"number\\\"==typeof arg}function isObject(arg){return\\\"object\\\"==typeof arg&&null!==arg}function isUndefined(arg){return void 0===arg}module.exports=EventEmitter,EventEmitter.EventEmitter=EventEmitter,EventEmitter.prototype._events=void 0,EventEmitter.prototype._maxListeners=void 0,EventEmitter.defaultMaxListeners=10,EventEmitter.prototype.setMaxListeners=function(n){if(!isNumber(n)||0>n||isNaN(n))throw TypeError(\\\"n must be a positive number\\\");return this._maxListeners=n,this},EventEmitter.prototype.emit=function(type){var er,handler,len,args,i,listeners;if(this._events||(this._events={}),\\\"error\\\"===type&&(!this._events.error||isObject(this._events.error)&&!this._events.error.length)){if(er=arguments[1],er instanceof Error)throw er;throw TypeError('Uncaught, unspecified \\\"error\\\" event.')}if(handler=this._events[type],isUndefined(handler))return!1;if(isFunction(handler))switch(arguments.length){case 1:handler.call(this);break;case 2:handler.call(this,arguments[1]);break;case 3:handler.call(this,arguments[1],arguments[2]);break;default:for(len=arguments.length,args=Array(len-1),i=1;len>i;i++)args[i-1]=arguments[i];handler.apply(this,args)}else if(isObject(handler)){for(len=arguments.length,args=Array(len-1),i=1;len>i;i++)args[i-1]=arguments[i];for(listeners=handler.slice(),len=listeners.length,i=0;len>i;i++)listeners[i].apply(this,args)}return!0},EventEmitter.prototype.addListener=function(type,listener){var m;if(!isFunction(listener))throw TypeError(\\\"listener must be a function\\\");if(this._events||(this._events={}),this._events.newListener&&this.emit(\\\"newListener\\\",type,isFunction(listener.listener)?listener.listener:listener),this._events[type]?isObject(this._events[type])?this._events[type].push(listener):this._events[type]=[this._events[type],listener]:this._events[type]=listener,isObject(this._events[type])&&!this._events[type].warned){var m;m=isUndefined(this._maxListeners)?EventEmitter.defaultMaxListeners:this._maxListeners,m&&m>0&&this._events[type].length>m&&(this._events[type].warned=!0,console.error(\\\"(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.\\\",this._events[type].length),\\\"function\\\"==typeof console.trace&&console.trace())}return this},EventEmitter.prototype.on=EventEmitter.prototype.addListener,EventEmitter.prototype.once=function(type,listener){function g(){this.removeListener(type,g),fired||(fired=!0,listener.apply(this,arguments))}if(!isFunction(listener))throw TypeError(\\\"listener must be a function\\\");var fired=!1;return g.listener=listener,this.on(type,g),this},EventEmitter.prototype.removeListener=function(type,listener){var list,position,length,i;if(!isFunction(listener))throw TypeError(\\\"listener must be a function\\\");if(!this._events||!this._events[type])return this;if(list=this._events[type],length=list.length,position=-1,list===listener||isFunction(list.listener)&&list.listener===listener)delete this._events[type],this._events.removeListener&&this.emit(\\\"removeListener\\\",type,listener);else if(isObject(list)){for(i=length;i-->0;)if(list[i]===listener||list[i].listener&&list[i].listener===listener){position=i;break}if(0>position)return this;1===list.length?(list.length=0,delete this._events[type]):list.splice(position,1),this._events.removeListener&&this.emit(\\\"removeListener\\\",type,listener)}return this},EventEmitter.prototype.removeAllListeners=function(type){var key,listeners;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[type]&&delete this._events[type],this;if(0===arguments.length){for(key in this._events)\\\"removeListener\\\"!==key&&this.removeAllListeners(key);return this.removeAllListeners(\\\"removeListener\\\"),this._events={},this\\n}if(listeners=this._events[type],isFunction(listeners))this.removeListener(type,listeners);else for(;listeners.length;)this.removeListener(type,listeners[listeners.length-1]);return delete this._events[type],this},EventEmitter.prototype.listeners=function(type){var ret;return ret=this._events&&this._events[type]?isFunction(this._events[type])?[this._events[type]]:this._events[type].slice():[]},EventEmitter.listenerCount=function(emitter,type){var ret;return ret=emitter._events&&emitter._events[type]?isFunction(emitter._events[type])?1:emitter._events[type].length:0}},{}],\\\"/node_modules/jshint/data/ascii-identifier-data.js\\\":[function(_dereq_,module){for(var identifierStartTable=[],i=0;128>i;i++)identifierStartTable[i]=36===i||i>=65&&90>=i||95===i||i>=97&&122>=i;for(var identifierPartTable=[],i=0;128>i;i++)identifierPartTable[i]=identifierStartTable[i]||i>=48&&57>=i;module.exports={asciiIdentifierStartTable:identifierStartTable,asciiIdentifierPartTable:identifierPartTable}},{}],\\\"/node_modules/jshint/lodash.js\\\":[function(_dereq_,module,exports){(function(global){(function(){function baseFindIndex(array,predicate,fromRight){for(var length=array.length,index=fromRight?length:-1;fromRight?index--:length>++index;)if(predicate(array[index],index,array))return index;return-1}function baseIndexOf(array,value,fromIndex){if(value!==value)return indexOfNaN(array,fromIndex);for(var index=fromIndex-1,length=array.length;length>++index;)if(array[index]===value)return index;return-1}function baseIsFunction(value){return\\\"function\\\"==typeof value||!1}function baseToString(value){return\\\"string\\\"==typeof value?value:null==value?\\\"\\\":value+\\\"\\\"}function indexOfNaN(array,fromIndex,fromRight){for(var length=array.length,index=fromIndex+(fromRight?0:-1);fromRight?index--:length>++index;){var other=array[index];if(other!==other)return index}return-1}function isObjectLike(value){return!!value&&\\\"object\\\"==typeof value}function lodash(){}function arrayCopy(source,array){var index=-1,length=source.length;for(array||(array=Array(length));length>++index;)array[index]=source[index];return array}function arrayEach(array,iteratee){for(var index=-1,length=array.length;length>++index&&iteratee(array[index],index,array)!==!1;);return array}function arrayFilter(array,predicate){for(var index=-1,length=array.length,resIndex=-1,result=[];length>++index;){var value=array[index];predicate(value,index,array)&&(result[++resIndex]=value)}return result}function arrayMap(array,iteratee){for(var index=-1,length=array.length,result=Array(length);length>++index;)result[index]=iteratee(array[index],index,array);return result}function arrayMax(array){for(var index=-1,length=array.length,result=NEGATIVE_INFINITY;length>++index;){var value=array[index];value>result&&(result=value)}return result}function arraySome(array,predicate){for(var index=-1,length=array.length;length>++index;)if(predicate(array[index],index,array))return!0;return!1}function assignWith(object,source,customizer){var props=keys(source);push.apply(props,getSymbols(source));for(var index=-1,length=props.length;length>++index;){var key=props[index],value=object[key],result=customizer(value,source[key],key,object,source);(result===result?result===value:value!==value)&&(value!==undefined||key in object)||(object[key]=result)}return object}function baseCopy(source,props,object){object||(object={});for(var index=-1,length=props.length;length>++index;){var key=props[index];object[key]=source[key]}return object}function baseCallback(func,thisArg,argCount){var type=typeof func;return\\\"function\\\"==type?thisArg===undefined?func:bindCallback(func,thisArg,argCount):null==func?identity:\\\"object\\\"==type?baseMatches(func):thisArg===undefined?property(func):baseMatchesProperty(func,thisArg)}function baseClone(value,isDeep,customizer,key,object,stackA,stackB){var result;if(customizer&&(result=object?customizer(value,key,object):customizer(value)),result!==undefined)return result;if(!isObject(value))return value;var isArr=isArray(value);if(isArr){if(result=initCloneArray(value),!isDeep)return arrayCopy(value,result)}else{var tag=objToString.call(value),isFunc=tag==funcTag;if(tag!=objectTag&&tag!=argsTag&&(!isFunc||object))return cloneableTags[tag]?initCloneByTag(value,tag,isDeep):object?value:{};if(result=initCloneObject(isFunc?{}:value),!isDeep)return baseAssign(result,value)}stackA||(stackA=[]),stackB||(stackB=[]);for(var length=stackA.length;length--;)if(stackA[length]==value)return stackB[length];return stackA.push(value),stackB.push(result),(isArr?arrayEach:baseForOwn)(value,function(subValue,key){result[key]=baseClone(subValue,isDeep,customizer,key,value,stackA,stackB)}),result}function baseFilter(collection,predicate){var result=[];return baseEach(collection,function(value,index,collection){predicate(value,index,collection)&&result.push(value)}),result}function baseForIn(object,iteratee){return baseFor(object,iteratee,keysIn)}function baseForOwn(object,iteratee){return baseFor(object,iteratee,keys)}function baseGet(object,path,pathKey){if(null!=object){pathKey!==undefined&&pathKey in toObject(object)&&(path=[pathKey]);for(var index=-1,length=path.length;null!=object&&length>++index;)var result=object=object[path[index]];return result}}function baseIsEqual(value,other,customizer,isLoose,stackA,stackB){if(value===other)return 0!==value||1/value==1/other;var valType=typeof value,othType=typeof other;return\\\"function\\\"!=valType&&\\\"object\\\"!=valType&&\\\"function\\\"!=othType&&\\\"object\\\"!=othType||null==value||null==other?value!==value&&other!==other:baseIsEqualDeep(value,other,baseIsEqual,customizer,isLoose,stackA,stackB)}function baseIsEqualDeep(object,other,equalFunc,customizer,isLoose,stackA,stackB){var objIsArr=isArray(object),othIsArr=isArray(other),objTag=arrayTag,othTag=arrayTag;objIsArr||(objTag=objToString.call(object),objTag==argsTag?objTag=objectTag:objTag!=objectTag&&(objIsArr=isTypedArray(object))),othIsArr||(othTag=objToString.call(other),othTag==argsTag?othTag=objectTag:othTag!=objectTag&&(othIsArr=isTypedArray(other)));var objIsObj=objTag==objectTag,othIsObj=othTag==objectTag,isSameTag=objTag==othTag;if(isSameTag&&!objIsArr&&!objIsObj)return equalByTag(object,other,objTag);if(!isLoose){var valWrapped=objIsObj&&hasOwnProperty.call(object,\\\"__wrapped__\\\"),othWrapped=othIsObj&&hasOwnProperty.call(other,\\\"__wrapped__\\\");if(valWrapped||othWrapped)return equalFunc(valWrapped?object.value():object,othWrapped?other.value():other,customizer,isLoose,stackA,stackB)}if(!isSameTag)return!1;stackA||(stackA=[]),stackB||(stackB=[]);for(var length=stackA.length;length--;)if(stackA[length]==object)return stackB[length]==other;stackA.push(object),stackB.push(other);var result=(objIsArr?equalArrays:equalObjects)(object,other,equalFunc,customizer,isLoose,stackA,stackB);return stackA.pop(),stackB.pop(),result}function baseIsMatch(object,props,values,strictCompareFlags,customizer){for(var index=-1,length=props.length,noCustomizer=!customizer;length>++index;)if(noCustomizer&&strictCompareFlags[index]?values[index]!==object[props[index]]:!(props[index]in object))return!1;for(index=-1;length>++index;){var key=props[index],objValue=object[key],srcValue=values[index];if(noCustomizer&&strictCompareFlags[index])var result=objValue!==undefined||key in object;else result=customizer?customizer(objValue,srcValue,key):undefined,result===undefined&&(result=baseIsEqual(srcValue,objValue,customizer,!0));if(!result)return!1}return!0}function baseMatches(source){var props=keys(source),length=props.length;if(!length)return constant(!0);if(1==length){var key=props[0],value=source[key];if(isStrictComparable(value))return function(object){return null==object?!1:object[key]===value&&(value!==undefined||key in toObject(object))}}for(var values=Array(length),strictCompareFlags=Array(length);length--;)value=source[props[length]],values[length]=value,strictCompareFlags[length]=isStrictComparable(value);return function(object){return null!=object&&baseIsMatch(toObject(object),props,values,strictCompareFlags)}}function baseMatchesProperty(path,value){var isArr=isArray(path),isCommon=isKey(path)&&isStrictComparable(value),pathKey=path+\\\"\\\";return path=toPath(path),function(object){if(null==object)return!1;var key=pathKey;if(object=toObject(object),!(!isArr&&isCommon||key in object)){if(object=1==path.length?object:baseGet(object,baseSlice(path,0,-1)),null==object)return!1;key=last(path),object=toObject(object)}return object[key]===value?value!==undefined||key in object:baseIsEqual(value,object[key],null,!0)}}function baseMerge(object,source,customizer,stackA,stackB){if(!isObject(object))return object;var isSrcArr=isLength(source.length)&&(isArray(source)||isTypedArray(source));if(!isSrcArr){var props=keys(source);push.apply(props,getSymbols(source))}return arrayEach(props||source,function(srcValue,key){if(props&&(key=srcValue,srcValue=source[key]),isObjectLike(srcValue))stackA||(stackA=[]),stackB||(stackB=[]),baseMergeDeep(object,source,key,baseMerge,customizer,stackA,stackB);else{var value=object[key],result=customizer?customizer(value,srcValue,key,object,source):undefined,isCommon=result===undefined;isCommon&&(result=srcValue),!isSrcArr&&result===undefined||!isCommon&&(result===result?result===value:value!==value)||(object[key]=result)}}),object}function baseMergeDeep(object,source,key,mergeFunc,customizer,stackA,stackB){for(var length=stackA.length,srcValue=source[key];length--;)if(stackA[length]==srcValue)return object[key]=stackB[length],undefined;var value=object[key],result=customizer?customizer(value,srcValue,key,object,source):undefined,isCommon=result===undefined;isCommon&&(result=srcValue,isLength(srcValue.length)&&(isArray(srcValue)||isTypedArray(srcValue))?result=isArray(value)?value:getLength(value)?arrayCopy(value):[]:isPlainObject(srcValue)||isArguments(srcValue)?result=isArguments(value)?toPlainObject(value):isPlainObject(value)?value:{}:isCommon=!1),stackA.push(srcValue),stackB.push(result),isCommon?object[key]=mergeFunc(result,srcValue,customizer,stackA,stackB):(result===result?result!==value:value===value)&&(object[key]=result)}function baseProperty(key){return function(object){return null==object?undefined:object[key]}}function basePropertyDeep(path){var pathKey=path+\\\"\\\";return path=toPath(path),function(object){return baseGet(object,path,pathKey)}}function baseSlice(array,start,end){var index=-1,length=array.length;start=null==start?0:+start||0,0>start&&(start=-start>length?0:length+start),end=end===undefined||end>length?length:+end||0,0>end&&(end+=length),length=start>end?0:end-start>>>0,start>>>=0;for(var result=Array(length);length>++index;)result[index]=array[index+start];return result}function baseSome(collection,predicate){var result;return baseEach(collection,function(value,index,collection){return result=predicate(value,index,collection),!result}),!!result}function baseValues(object,props){for(var index=-1,length=props.length,result=Array(length);length>++index;)result[index]=object[props[index]];return result}function binaryIndex(array,value,retHighest){var low=0,high=array?array.length:low;if(\\\"number\\\"==typeof value&&value===value&&HALF_MAX_ARRAY_LENGTH>=high){for(;high>low;){var mid=low+high>>>1,computed=array[mid];(retHighest?value>=computed:value>computed)?low=mid+1:high=mid}return high}return binaryIndexBy(array,value,identity,retHighest)}function binaryIndexBy(array,value,iteratee,retHighest){value=iteratee(value);for(var low=0,high=array?array.length:0,valIsNaN=value!==value,valIsUndef=value===undefined;high>low;){var mid=floor((low+high)/2),computed=iteratee(array[mid]),isReflexive=computed===computed;if(valIsNaN)var setLow=isReflexive||retHighest;else setLow=valIsUndef?isReflexive&&(retHighest||computed!==undefined):retHighest?value>=computed:value>computed;setLow?low=mid+1:high=mid}return nativeMin(high,MAX_ARRAY_INDEX)}function bindCallback(func,thisArg,argCount){if(\\\"function\\\"!=typeof func)return identity;if(thisArg===undefined)return func;switch(argCount){case 1:return function(value){return func.call(thisArg,value)};case 3:return function(value,index,collection){return func.call(thisArg,value,index,collection)};case 4:return function(accumulator,value,index,collection){return func.call(thisArg,accumulator,value,index,collection)};case 5:return function(value,other,key,object,source){return func.call(thisArg,value,other,key,object,source)}}return function(){return func.apply(thisArg,arguments)}}function bufferClone(buffer){return bufferSlice.call(buffer,0)}function createAssigner(assigner){return restParam(function(object,sources){var index=-1,length=null==object?0:sources.length,customizer=length>2&&sources[length-2],guard=length>2&&sources[2],thisArg=length>1&&sources[length-1];for(\\\"function\\\"==typeof customizer?(customizer=bindCallback(customizer,thisArg,5),length-=2):(customizer=\\\"function\\\"==typeof thisArg?thisArg:null,length-=customizer?1:0),guard&&isIterateeCall(sources[0],sources[1],guard)&&(customizer=3>length?null:customizer,length=1);length>++index;){var source=sources[index];source&&assigner(object,source,customizer)}return object})}function createBaseEach(eachFunc,fromRight){return function(collection,iteratee){var length=collection?getLength(collection):0;if(!isLength(length))return eachFunc(collection,iteratee);for(var index=fromRight?length:-1,iterable=toObject(collection);(fromRight?index--:length>++index)&&iteratee(iterable[index],index,iterable)!==!1;);return collection}}function createBaseFor(fromRight){return function(object,iteratee,keysFunc){for(var iterable=toObject(object),props=keysFunc(object),length=props.length,index=fromRight?length:-1;fromRight?index--:length>++index;){var key=props[index];if(iteratee(iterable[key],key,iterable)===!1)break}return object}}function createFindIndex(fromRight){return function(array,predicate,thisArg){return array&&array.length?(predicate=getCallback(predicate,thisArg,3),baseFindIndex(array,predicate,fromRight)):-1}}function createForEach(arrayFunc,eachFunc){return function(collection,iteratee,thisArg){return\\\"function\\\"==typeof iteratee&&thisArg===undefined&&isArray(collection)?arrayFunc(collection,iteratee):eachFunc(collection,bindCallback(iteratee,thisArg,3))}}function equalArrays(array,other,equalFunc,customizer,isLoose,stackA,stackB){var index=-1,arrLength=array.length,othLength=other.length,result=!0;if(arrLength!=othLength&&!(isLoose&&othLength>arrLength))return!1;for(;result&&arrLength>++index;){var arrValue=array[index],othValue=other[index];if(result=undefined,customizer&&(result=isLoose?customizer(othValue,arrValue,index):customizer(arrValue,othValue,index)),result===undefined)if(isLoose)for(var othIndex=othLength;othIndex--&&(othValue=other[othIndex],!(result=arrValue&&arrValue===othValue||equalFunc(arrValue,othValue,customizer,isLoose,stackA,stackB))););else result=arrValue&&arrValue===othValue||equalFunc(arrValue,othValue,customizer,isLoose,stackA,stackB)}return!!result}function equalByTag(object,other,tag){switch(tag){case boolTag:case dateTag:return+object==+other;case errorTag:return object.name==other.name&&object.message==other.message;case numberTag:return object!=+object?other!=+other:0==object?1/object==1/other:object==+other;case regexpTag:case stringTag:return object==other+\\\"\\\"}return!1}function equalObjects(object,other,equalFunc,customizer,isLoose,stackA,stackB){var objProps=keys(object),objLength=objProps.length,othProps=keys(other),othLength=othProps.length;if(objLength!=othLength&&!isLoose)return!1;for(var skipCtor=isLoose,index=-1;objLength>++index;){var key=objProps[index],result=isLoose?key in other:hasOwnProperty.call(other,key);if(result){var objValue=object[key],othValue=other[key];result=undefined,customizer&&(result=isLoose?customizer(othValue,objValue,key):customizer(objValue,othValue,key)),result===undefined&&(result=objValue&&objValue===othValue||equalFunc(objValue,othValue,customizer,isLoose,stackA,stackB))}if(!result)return!1;skipCtor||(skipCtor=\\\"constructor\\\"==key)}if(!skipCtor){var objCtor=object.constructor,othCtor=other.constructor;if(objCtor!=othCtor&&\\\"constructor\\\"in object&&\\\"constructor\\\"in other&&!(\\\"function\\\"==typeof objCtor&&objCtor instanceof objCtor&&\\\"function\\\"==typeof othCtor&&othCtor instanceof othCtor))return!1}return!0}function getCallback(func,thisArg,argCount){var result=lodash.callback||callback;return result=result===callback?baseCallback:result,argCount?result(func,thisArg,argCount):result}function getIndexOf(collection,target,fromIndex){var result=lodash.indexOf||indexOf;return result=result===indexOf?baseIndexOf:result,collection?result(collection,target,fromIndex):result}function initCloneArray(array){var length=array.length,result=new array.constructor(length);return length&&\\\"string\\\"==typeof array[0]&&hasOwnProperty.call(array,\\\"index\\\")&&(result.index=array.index,result.input=array.input),result}function initCloneObject(object){var Ctor=object.constructor;return\\\"function\\\"==typeof Ctor&&Ctor instanceof Ctor||(Ctor=Object),new Ctor}function initCloneByTag(object,tag,isDeep){var Ctor=object.constructor;switch(tag){case arrayBufferTag:return bufferClone(object);case boolTag:case dateTag:return new Ctor(+object);case float32Tag:case float64Tag:case int8Tag:case int16Tag:case int32Tag:case uint8Tag:case uint8ClampedTag:case uint16Tag:case uint32Tag:var buffer=object.buffer;return new Ctor(isDeep?bufferClone(buffer):buffer,object.byteOffset,object.length);case numberTag:case stringTag:return new Ctor(object);case regexpTag:var result=new Ctor(object.source,reFlags.exec(object));result.lastIndex=object.lastIndex}return result}function isIndex(value,length){return value=+value,length=null==length?MAX_SAFE_INTEGER:length,value>-1&&0==value%1&&length>value}function isIterateeCall(value,index,object){if(!isObject(object))return!1;var type=typeof index;if(\\\"number\\\"==type)var length=getLength(object),prereq=isLength(length)&&isIndex(index,length);else prereq=\\\"string\\\"==type&&index in object;if(prereq){var other=object[index];return value===value?value===other:other!==other}return!1}function isKey(value,object){var type=typeof value;if(\\\"string\\\"==type&&reIsPlainProp.test(value)||\\\"number\\\"==type)return!0;if(isArray(value))return!1;var result=!reIsDeepProp.test(value);return result||null!=object&&value in toObject(object)}function isLength(value){return\\\"number\\\"==typeof value&&value>-1&&0==value%1&&MAX_SAFE_INTEGER>=value}function isStrictComparable(value){return value===value&&(0===value?1/value>0:!isObject(value))}function shimIsPlainObject(value){var Ctor;if(lodash.support,!isObjectLike(value)||objToString.call(value)!=objectTag||!hasOwnProperty.call(value,\\\"constructor\\\")&&(Ctor=value.constructor,\\\"function\\\"==typeof Ctor&&!(Ctor instanceof Ctor)))return!1;var result;return baseForIn(value,function(subValue,key){result=key}),result===undefined||hasOwnProperty.call(value,result)}function shimKeys(object){for(var props=keysIn(object),propsLength=props.length,length=propsLength&&object.length,support=lodash.support,allowIndexes=length&&isLength(length)&&(isArray(object)||support.nonEnumArgs&&isArguments(object)),index=-1,result=[];propsLength>++index;){var key=props[index];(allowIndexes&&isIndex(key,length)||hasOwnProperty.call(object,key))&&result.push(key)}return result}function toObject(value){return isObject(value)?value:Object(value)}function toPath(value){if(isArray(value))return value;var result=[];return baseToString(value).replace(rePropName,function(match,number,quote,string){result.push(quote?string.replace(reEscapeChar,\\\"$1\\\"):number||match)}),result}function indexOf(array,value,fromIndex){var length=array?array.length:0;if(!length)return-1;if(\\\"number\\\"==typeof fromIndex)fromIndex=0>fromIndex?nativeMax(length+fromIndex,0):fromIndex;else if(fromIndex){var index=binaryIndex(array,value),other=array[index];return(value===value?value===other:other!==other)?index:-1}return baseIndexOf(array,value,fromIndex||0)}function last(array){var length=array?array.length:0;return length?array[length-1]:undefined}function slice(array,start,end){var length=array?array.length:0;return length?(end&&\\\"number\\\"!=typeof end&&isIterateeCall(array,start,end)&&(start=0,end=length),baseSlice(array,start,end)):[]}function unzip(array){for(var index=-1,length=(array&&array.length&&arrayMax(arrayMap(array,getLength)))>>>0,result=Array(length);length>++index;)result[index]=arrayMap(array,baseProperty(index));return result}function includes(collection,target,fromIndex,guard){var length=collection?getLength(collection):0;return isLength(length)||(collection=values(collection),length=collection.length),length?(fromIndex=\\\"number\\\"!=typeof fromIndex||guard&&isIterateeCall(target,fromIndex,guard)?0:0>fromIndex?nativeMax(length+fromIndex,0):fromIndex||0,\\\"string\\\"==typeof collection||!isArray(collection)&&isString(collection)?length>fromIndex&&collection.indexOf(target,fromIndex)>-1:getIndexOf(collection,target,fromIndex)>-1):!1}function reject(collection,predicate,thisArg){var func=isArray(collection)?arrayFilter:baseFilter;return predicate=getCallback(predicate,thisArg,3),func(collection,function(value,index,collection){return!predicate(value,index,collection)})}function some(collection,predicate,thisArg){var func=isArray(collection)?arraySome:baseSome;return thisArg&&isIterateeCall(collection,predicate,thisArg)&&(predicate=null),(\\\"function\\\"!=typeof predicate||thisArg!==undefined)&&(predicate=getCallback(predicate,thisArg,3)),func(collection,predicate)}function restParam(func,start){if(\\\"function\\\"!=typeof func)throw new TypeError(FUNC_ERROR_TEXT);return start=nativeMax(start===undefined?func.length-1:+start||0,0),function(){for(var args=arguments,index=-1,length=nativeMax(args.length-start,0),rest=Array(length);length>++index;)rest[index]=args[start+index];switch(start){case 0:return func.call(this,rest);case 1:return func.call(this,args[0],rest);case 2:return func.call(this,args[0],args[1],rest)}var otherArgs=Array(start+1);for(index=-1;start>++index;)otherArgs[index]=args[index];return otherArgs[start]=rest,func.apply(this,otherArgs)}}function clone(value,isDeep,customizer,thisArg){return isDeep&&\\\"boolean\\\"!=typeof isDeep&&isIterateeCall(value,isDeep,customizer)?isDeep=!1:\\\"function\\\"==typeof isDeep&&(thisArg=customizer,customizer=isDeep,isDeep=!1),customizer=\\\"function\\\"==typeof customizer&&bindCallback(customizer,thisArg,1),baseClone(value,isDeep,customizer)}function isArguments(value){var length=isObjectLike(value)?value.length:undefined;return isLength(length)&&objToString.call(value)==argsTag}function isEmpty(value){if(null==value)return!0;var length=getLength(value);return isLength(length)&&(isArray(value)||isString(value)||isArguments(value)||isObjectLike(value)&&isFunction(value.splice))?!length:!keys(value).length}function isObject(value){var type=typeof value;return\\\"function\\\"==type||!!value&&\\\"object\\\"==type}function isNative(value){return null==value?!1:objToString.call(value)==funcTag?reIsNative.test(fnToString.call(value)):isObjectLike(value)&&reIsHostCtor.test(value)}function isNumber(value){return\\\"number\\\"==typeof value||isObjectLike(value)&&objToString.call(value)==numberTag}function isString(value){return\\\"string\\\"==typeof value||isObjectLike(value)&&objToString.call(value)==stringTag}function isTypedArray(value){return isObjectLike(value)&&isLength(value.length)&&!!typedArrayTags[objToString.call(value)]}function toPlainObject(value){return baseCopy(value,keysIn(value))}function has(object,path){if(null==object)return!1;var result=hasOwnProperty.call(object,path);return result||isKey(path)||(path=toPath(path),object=1==path.length?object:baseGet(object,baseSlice(path,0,-1)),path=last(path),result=null!=object&&hasOwnProperty.call(object,path)),result}function keysIn(object){if(null==object)return[];isObject(object)||(object=Object(object));var length=object.length;length=length&&isLength(length)&&(isArray(object)||support.nonEnumArgs&&isArguments(object))&&length||0;for(var Ctor=object.constructor,index=-1,isProto=\\\"function\\\"==typeof Ctor&&Ctor.prototype===object,result=Array(length),skipIndexes=length>0;length>++index;)result[index]=index+\\\"\\\";for(var key in object)skipIndexes&&isIndex(key,length)||\\\"constructor\\\"==key&&(isProto||!hasOwnProperty.call(object,key))||result.push(key);return result}function values(object){return baseValues(object,keys(object))}function escapeRegExp(string){return string=baseToString(string),string&&reHasRegExpChars.test(string)?string.replace(reRegExpChars,\\\"\\\\\\\\$&\\\"):string}function callback(func,thisArg,guard){return guard&&isIterateeCall(func,thisArg,guard)&&(thisArg=null),baseCallback(func,thisArg)}function constant(value){return function(){return value}}function identity(value){return value}function property(path){return isKey(path)?baseProperty(path):basePropertyDeep(path)}var undefined,VERSION=\\\"3.7.0\\\",FUNC_ERROR_TEXT=\\\"Expected a function\\\",argsTag=\\\"[object Arguments]\\\",arrayTag=\\\"[object Array]\\\",boolTag=\\\"[object Boolean]\\\",dateTag=\\\"[object Date]\\\",errorTag=\\\"[object Error]\\\",funcTag=\\\"[object Function]\\\",mapTag=\\\"[object Map]\\\",numberTag=\\\"[object Number]\\\",objectTag=\\\"[object Object]\\\",regexpTag=\\\"[object RegExp]\\\",setTag=\\\"[object Set]\\\",stringTag=\\\"[object String]\\\",weakMapTag=\\\"[object WeakMap]\\\",arrayBufferTag=\\\"[object ArrayBuffer]\\\",float32Tag=\\\"[object Float32Array]\\\",float64Tag=\\\"[object Float64Array]\\\",int8Tag=\\\"[object Int8Array]\\\",int16Tag=\\\"[object Int16Array]\\\",int32Tag=\\\"[object Int32Array]\\\",uint8Tag=\\\"[object Uint8Array]\\\",uint8ClampedTag=\\\"[object Uint8ClampedArray]\\\",uint16Tag=\\\"[object Uint16Array]\\\",uint32Tag=\\\"[object Uint32Array]\\\",reIsDeepProp=/\\\\.|\\\\[(?:[^[\\\\]]+|([\\\"'])(?:(?!\\\\1)[^\\\\n\\\\\\\\]|\\\\\\\\.)*?)\\\\1\\\\]/,reIsPlainProp=/^\\\\w*$/,rePropName=/[^.[\\\\]]+|\\\\[(?:(-?\\\\d+(?:\\\\.\\\\d+)?)|([\\\"'])((?:(?!\\\\2)[^\\\\n\\\\\\\\]|\\\\\\\\.)*?)\\\\2)\\\\]/g,reRegExpChars=/[.*+?^${}()|[\\\\]\\\\/\\\\\\\\]/g,reHasRegExpChars=RegExp(reRegExpChars.source),reEscapeChar=/\\\\\\\\(\\\\\\\\)?/g,reFlags=/\\\\w*$/,reIsHostCtor=/^\\\\[object .+?Constructor\\\\]$/,typedArrayTags={};typedArrayTags[float32Tag]=typedArrayTags[float64Tag]=typedArrayTags[int8Tag]=typedArrayTags[int16Tag]=typedArrayTags[int32Tag]=typedArrayTags[uint8Tag]=typedArrayTags[uint8ClampedTag]=typedArrayTags[uint16Tag]=typedArrayTags[uint32Tag]=!0,typedArrayTags[argsTag]=typedArrayTags[arrayTag]=typedArrayTags[arrayBufferTag]=typedArrayTags[boolTag]=typedArrayTags[dateTag]=typedArrayTags[errorTag]=typedArrayTags[funcTag]=typedArrayTags[mapTag]=typedArrayTags[numberTag]=typedArrayTags[objectTag]=typedArrayTags[regexpTag]=typedArrayTags[setTag]=typedArrayTags[stringTag]=typedArrayTags[weakMapTag]=!1;var cloneableTags={};cloneableTags[argsTag]=cloneableTags[arrayTag]=cloneableTags[arrayBufferTag]=cloneableTags[boolTag]=cloneableTags[dateTag]=cloneableTags[float32Tag]=cloneableTags[float64Tag]=cloneableTags[int8Tag]=cloneableTags[int16Tag]=cloneableTags[int32Tag]=cloneableTags[numberTag]=cloneableTags[objectTag]=cloneableTags[regexpTag]=cloneableTags[stringTag]=cloneableTags[uint8Tag]=cloneableTags[uint8ClampedTag]=cloneableTags[uint16Tag]=cloneableTags[uint32Tag]=!0,cloneableTags[errorTag]=cloneableTags[funcTag]=cloneableTags[mapTag]=cloneableTags[setTag]=cloneableTags[weakMapTag]=!1;var objectTypes={\\\"function\\\":!0,object:!0},freeExports=objectTypes[typeof exports]&&exports&&!exports.nodeType&&exports,freeModule=objectTypes[typeof module]&&module&&!module.nodeType&&module,freeGlobal=freeExports&&freeModule&&\\\"object\\\"==typeof global&&global&&global.Object&&global,freeSelf=objectTypes[typeof self]&&self&&self.Object&&self,freeWindow=objectTypes[typeof window]&&window&&window.Object&&window,moduleExports=freeModule&&freeModule.exports===freeExports&&freeExports,root=freeGlobal||freeWindow!==(this&&this.window)&&freeWindow||freeSelf||this,arrayProto=Array.prototype,objectProto=Object.prototype,fnToString=Function.prototype.toString,hasOwnProperty=objectProto.hasOwnProperty,objToString=objectProto.toString,reIsNative=RegExp(\\\"^\\\"+escapeRegExp(objToString).replace(/toString|(function).*?(?=\\\\\\\\\\\\()| for .+?(?=\\\\\\\\\\\\])/g,\\\"$1.*?\\\")+\\\"$\\\"),ArrayBuffer=isNative(ArrayBuffer=root.ArrayBuffer)&&ArrayBuffer,bufferSlice=isNative(bufferSlice=ArrayBuffer&&new ArrayBuffer(0).slice)&&bufferSlice,floor=Math.floor,getOwnPropertySymbols=isNative(getOwnPropertySymbols=Object.getOwnPropertySymbols)&&getOwnPropertySymbols,getPrototypeOf=isNative(getPrototypeOf=Object.getPrototypeOf)&&getPrototypeOf,push=arrayProto.push,preventExtensions=isNative(Object.preventExtensions=Object.preventExtensions)&&preventExtensions,propertyIsEnumerable=objectProto.propertyIsEnumerable,Uint8Array=isNative(Uint8Array=root.Uint8Array)&&Uint8Array,Float64Array=function(){try{var func=isNative(func=root.Float64Array)&&func,result=new func(new ArrayBuffer(10),0,1)&&func}catch(e){}return result}(),nativeAssign=function(){var object={1:0},func=preventExtensions&&isNative(func=Object.assign)&&func;try{func(preventExtensions(object),\\\"xo\\\")}catch(e){}return!object[1]&&func}(),nativeIsArray=isNative(nativeIsArray=Array.isArray)&&nativeIsArray,nativeKeys=isNative(nativeKeys=Object.keys)&&nativeKeys,nativeMax=Math.max,nativeMin=Math.min,NEGATIVE_INFINITY=Number.NEGATIVE_INFINITY,MAX_ARRAY_LENGTH=Math.pow(2,32)-1,MAX_ARRAY_INDEX=MAX_ARRAY_LENGTH-1,HALF_MAX_ARRAY_LENGTH=MAX_ARRAY_LENGTH>>>1,FLOAT64_BYTES_PER_ELEMENT=Float64Array?Float64Array.BYTES_PER_ELEMENT:0,MAX_SAFE_INTEGER=Math.pow(2,53)-1,support=lodash.support={};(function(x){var Ctor=function(){this.x=x},props=[];Ctor.prototype={valueOf:x,y:x};for(var key in new Ctor)props.push(key);support.funcDecomp=/\\\\bthis\\\\b/.test(function(){return this}),support.funcNames=\\\"string\\\"==typeof Function.name;try{support.nonEnumArgs=!propertyIsEnumerable.call(arguments,1)}catch(e){support.nonEnumArgs=!0}})(1,0);var baseAssign=nativeAssign||function(object,source){return null==source?object:baseCopy(source,getSymbols(source),baseCopy(source,keys(source),object))},baseEach=createBaseEach(baseForOwn),baseFor=createBaseFor();bufferSlice||(bufferClone=ArrayBuffer&&Uint8Array?function(buffer){var byteLength=buffer.byteLength,floatLength=Float64Array?floor(byteLength/FLOAT64_BYTES_PER_ELEMENT):0,offset=floatLength*FLOAT64_BYTES_PER_ELEMENT,result=new ArrayBuffer(byteLength);if(floatLength){var view=new Float64Array(result,0,floatLength);view.set(new Float64Array(buffer,0,floatLength))}return byteLength!=offset&&(view=new Uint8Array(result,offset),view.set(new Uint8Array(buffer,offset))),result}:constant(null));var getLength=baseProperty(\\\"length\\\"),getSymbols=getOwnPropertySymbols?function(object){return getOwnPropertySymbols(toObject(object))}:constant([]),findLastIndex=createFindIndex(!0),zip=restParam(unzip),forEach=createForEach(arrayEach,baseEach),isArray=nativeIsArray||function(value){return isObjectLike(value)&&isLength(value.length)&&objToString.call(value)==arrayTag},isFunction=baseIsFunction(/x/)||Uint8Array&&!baseIsFunction(Uint8Array)?function(value){return objToString.call(value)==funcTag}:baseIsFunction,isPlainObject=getPrototypeOf?function(value){if(!value||objToString.call(value)!=objectTag)return!1;var valueOf=value.valueOf,objProto=isNative(valueOf)&&(objProto=getPrototypeOf(valueOf))&&getPrototypeOf(objProto);return objProto?value==objProto||getPrototypeOf(value)==objProto:shimIsPlainObject(value)}:shimIsPlainObject,assign=createAssigner(function(object,source,customizer){return customizer?assignWith(object,source,customizer):baseAssign(object,source)}),keys=nativeKeys?function(object){if(object)var Ctor=object.constructor,length=object.length;return\\\"function\\\"==typeof Ctor&&Ctor.prototype===object||\\\"function\\\"!=typeof object&&isLength(length)?shimKeys(object):isObject(object)?nativeKeys(object):[]}:shimKeys,merge=createAssigner(baseMerge);lodash.assign=assign,lodash.callback=callback,lodash.constant=constant,lodash.forEach=forEach,lodash.keys=keys,lodash.keysIn=keysIn,lodash.merge=merge,lodash.property=property,lodash.reject=reject,lodash.restParam=restParam,lodash.slice=slice,lodash.toPlainObject=toPlainObject,lodash.unzip=unzip,lodash.values=values,lodash.zip=zip,lodash.each=forEach,lodash.extend=assign,lodash.iteratee=callback,lodash.clone=clone,lodash.escapeRegExp=escapeRegExp,lodash.findLastIndex=findLastIndex,lodash.has=has,lodash.identity=identity,lodash.includes=includes,lodash.indexOf=indexOf,lodash.isArguments=isArguments,lodash.isArray=isArray,lodash.isEmpty=isEmpty,lodash.isFunction=isFunction,lodash.isNative=isNative,lodash.isNumber=isNumber,lodash.isObject=isObject,lodash.isPlainObject=isPlainObject,lodash.isString=isString,lodash.isTypedArray=isTypedArray,lodash.last=last,lodash.some=some,lodash.any=some,lodash.contains=includes,lodash.include=includes,lodash.VERSION=VERSION,freeExports&&freeModule?moduleExports?(freeModule.exports=lodash)._=lodash:freeExports._=lodash:root._=lodash\\n}).call(this)}).call(this,\\\"undefined\\\"!=typeof global?global:\\\"undefined\\\"!=typeof self?self:\\\"undefined\\\"!=typeof window?window:{})},{}],\\\"/node_modules/jshint/src/jshint.js\\\":[function(_dereq_,module,exports){var _=_dereq_(\\\"../lodash\\\"),events=_dereq_(\\\"events\\\"),vars=_dereq_(\\\"./vars.js\\\"),messages=_dereq_(\\\"./messages.js\\\"),Lexer=_dereq_(\\\"./lex.js\\\").Lexer,reg=_dereq_(\\\"./reg.js\\\"),state=_dereq_(\\\"./state.js\\\").state,style=_dereq_(\\\"./style.js\\\"),options=_dereq_(\\\"./options.js\\\"),scopeManager=_dereq_(\\\"./scope-manager.js\\\"),JSHINT=function(){\\\"use strict\\\";function checkOption(name,t){return name=name.trim(),/^[+-]W\\\\d{3}$/g.test(name)?!0:-1!==options.validNames.indexOf(name)||\\\"jslint\\\"===t.type||_.has(options.removed,name)?!0:(error(\\\"E001\\\",t,name),!1)}function isString(obj){return\\\"[object String]\\\"===Object.prototype.toString.call(obj)}function isIdentifier(tkn,value){return tkn?tkn.identifier&&tkn.value===value?!0:!1:!1}function isReserved(token){if(!token.reserved)return!1;var meta=token.meta;if(meta&&meta.isFutureReservedWord&&state.inES5()){if(!meta.es5)return!1;if(meta.strictOnly&&!state.option.strict&&!state.isStrict())return!1;if(token.isProperty)return!1}return!0}function supplant(str,data){return str.replace(/\\\\{([^{}]*)\\\\}/g,function(a,b){var r=data[b];return\\\"string\\\"==typeof r||\\\"number\\\"==typeof r?r:a})}function combine(dest,src){Object.keys(src).forEach(function(name){_.has(JSHINT.blacklist,name)||(dest[name]=src[name])})}function processenforceall(){if(state.option.enforceall){for(var enforceopt in options.bool.enforcing)void 0!==state.option[enforceopt]||options.noenforceall[enforceopt]||(state.option[enforceopt]=!0);for(var relaxopt in options.bool.relaxing)void 0===state.option[relaxopt]&&(state.option[relaxopt]=!1)}}function assume(){processenforceall(),state.option.esversion||state.option.moz||(state.option.esversion=state.option.es3?3:state.option.esnext?6:5),state.inES5()&&combine(predefined,vars.ecmaIdentifiers[5]),state.inES6()&&combine(predefined,vars.ecmaIdentifiers[6]),state.option.module&&(state.option.strict===!0&&(state.option.strict=\\\"global\\\"),state.inES6()||warning(\\\"W134\\\",state.tokens.next,\\\"module\\\",6)),state.option.couch&&combine(predefined,vars.couch),state.option.qunit&&combine(predefined,vars.qunit),state.option.rhino&&combine(predefined,vars.rhino),state.option.shelljs&&(combine(predefined,vars.shelljs),combine(predefined,vars.node)),state.option.typed&&combine(predefined,vars.typed),state.option.phantom&&(combine(predefined,vars.phantom),state.option.strict===!0&&(state.option.strict=\\\"global\\\")),state.option.prototypejs&&combine(predefined,vars.prototypejs),state.option.node&&(combine(predefined,vars.node),combine(predefined,vars.typed),state.option.strict===!0&&(state.option.strict=\\\"global\\\")),state.option.devel&&combine(predefined,vars.devel),state.option.dojo&&combine(predefined,vars.dojo),state.option.browser&&(combine(predefined,vars.browser),combine(predefined,vars.typed)),state.option.browserify&&(combine(predefined,vars.browser),combine(predefined,vars.typed),combine(predefined,vars.browserify),state.option.strict===!0&&(state.option.strict=\\\"global\\\")),state.option.nonstandard&&combine(predefined,vars.nonstandard),state.option.jasmine&&combine(predefined,vars.jasmine),state.option.jquery&&combine(predefined,vars.jquery),state.option.mootools&&combine(predefined,vars.mootools),state.option.worker&&combine(predefined,vars.worker),state.option.wsh&&combine(predefined,vars.wsh),state.option.globalstrict&&state.option.strict!==!1&&(state.option.strict=\\\"global\\\"),state.option.yui&&combine(predefined,vars.yui),state.option.mocha&&combine(predefined,vars.mocha)}function quit(code,line,chr){var percentage=Math.floor(100*(line/state.lines.length)),message=messages.errors[code].desc;throw{name:\\\"JSHintError\\\",line:line,character:chr,message:message+\\\" (\\\"+percentage+\\\"% scanned).\\\",raw:message,code:code}}function removeIgnoredMessages(){var ignored=state.ignoredLines;_.isEmpty(ignored)||(JSHINT.errors=_.reject(JSHINT.errors,function(err){return ignored[err.line]}))}function warning(code,t,a,b,c,d){var ch,l,w,msg;if(/^W\\\\d{3}$/.test(code)){if(state.ignored[code])return;msg=messages.warnings[code]}else/E\\\\d{3}/.test(code)?msg=messages.errors[code]:/I\\\\d{3}/.test(code)&&(msg=messages.info[code]);return t=t||state.tokens.next||{},\\\"(end)\\\"===t.id&&(t=state.tokens.curr),l=t.line||0,ch=t.from||0,w={id:\\\"(error)\\\",raw:msg.desc,code:msg.code,evidence:state.lines[l-1]||\\\"\\\",line:l,character:ch,scope:JSHINT.scope,a:a,b:b,c:c,d:d},w.reason=supplant(msg.desc,w),JSHINT.errors.push(w),removeIgnoredMessages(),JSHINT.errors.length>=state.option.maxerr&&quit(\\\"E043\\\",l,ch),w}function warningAt(m,l,ch,a,b,c,d){return warning(m,{line:l,from:ch},a,b,c,d)}function error(m,t,a,b,c,d){warning(m,t,a,b,c,d)}function errorAt(m,l,ch,a,b,c,d){return error(m,{line:l,from:ch},a,b,c,d)}function addInternalSrc(elem,src){var i;return i={id:\\\"(internal)\\\",elem:elem,value:src},JSHINT.internals.push(i),i}function doOption(){var nt=state.tokens.next,body=nt.body.match(/(-\\\\s+)?[^\\\\s,:]+(?:\\\\s*:\\\\s*(-\\\\s+)?[^\\\\s,]+)?/g)||[],predef={};if(\\\"globals\\\"===nt.type){body.forEach(function(g,idx){g=g.split(\\\":\\\");var key=(g[0]||\\\"\\\").trim(),val=(g[1]||\\\"\\\").trim();if(\\\"-\\\"===key||!key.length){if(idx>0&&idx===body.length-1)return;return error(\\\"E002\\\",nt),void 0}\\\"-\\\"===key.charAt(0)?(key=key.slice(1),val=!1,JSHINT.blacklist[key]=key,delete predefined[key]):predef[key]=\\\"true\\\"===val}),combine(predefined,predef);for(var key in predef)_.has(predef,key)&&(declared[key]=nt)}\\\"exported\\\"===nt.type&&body.forEach(function(e,idx){if(!e.length){if(idx>0&&idx===body.length-1)return;return error(\\\"E002\\\",nt),void 0}state.funct[\\\"(scope)\\\"].addExported(e)}),\\\"members\\\"===nt.type&&(membersOnly=membersOnly||{},body.forEach(function(m){var ch1=m.charAt(0),ch2=m.charAt(m.length-1);ch1!==ch2||'\\\"'!==ch1&&\\\"'\\\"!==ch1||(m=m.substr(1,m.length-2).replace('\\\\\\\\\\\"','\\\"')),membersOnly[m]=!1}));var numvals=[\\\"maxstatements\\\",\\\"maxparams\\\",\\\"maxdepth\\\",\\\"maxcomplexity\\\",\\\"maxerr\\\",\\\"maxlen\\\",\\\"indent\\\"];(\\\"jshint\\\"===nt.type||\\\"jslint\\\"===nt.type)&&(body.forEach(function(g){g=g.split(\\\":\\\");var key=(g[0]||\\\"\\\").trim(),val=(g[1]||\\\"\\\").trim();if(checkOption(key,nt))if(numvals.indexOf(key)>=0)if(\\\"false\\\"!==val){if(val=+val,\\\"number\\\"!=typeof val||!isFinite(val)||0>=val||Math.floor(val)!==val)return error(\\\"E032\\\",nt,g[1].trim()),void 0;state.option[key]=val}else state.option[key]=\\\"indent\\\"===key?4:!1;else{if(\\\"validthis\\\"===key)return state.funct[\\\"(global)\\\"]?void error(\\\"E009\\\"):\\\"true\\\"!==val&&\\\"false\\\"!==val?void error(\\\"E002\\\",nt):(state.option.validthis=\\\"true\\\"===val,void 0);if(\\\"quotmark\\\"!==key)if(\\\"shadow\\\"!==key)if(\\\"unused\\\"!==key)if(\\\"latedef\\\"!==key)if(\\\"ignore\\\"!==key)if(\\\"strict\\\"!==key){\\\"module\\\"===key&&(hasParsedCode(state.funct)||error(\\\"E055\\\",state.tokens.next,\\\"module\\\"));var esversions={es3:3,es5:5,esnext:6};if(!_.has(esversions,key)){if(\\\"esversion\\\"===key){switch(val){case\\\"5\\\":state.inES5(!0)&&warning(\\\"I003\\\");case\\\"3\\\":case\\\"6\\\":state.option.moz=!1,state.option.esversion=+val;break;case\\\"2015\\\":state.option.moz=!1,state.option.esversion=6;break;default:error(\\\"E002\\\",nt)}return hasParsedCode(state.funct)||error(\\\"E055\\\",state.tokens.next,\\\"esversion\\\"),void 0}var match=/^([+-])(W\\\\d{3})$/g.exec(key);if(match)return state.ignored[match[2]]=\\\"-\\\"===match[1],void 0;var tn;return\\\"true\\\"===val||\\\"false\\\"===val?(\\\"jslint\\\"===nt.type?(tn=options.renamed[key]||key,state.option[tn]=\\\"true\\\"===val,void 0!==options.inverted[tn]&&(state.option[tn]=!state.option[tn])):state.option[key]=\\\"true\\\"===val,\\\"newcap\\\"===key&&(state.option[\\\"(explicitNewcap)\\\"]=!0),void 0):(error(\\\"E002\\\",nt),void 0)}switch(val){case\\\"true\\\":state.option.moz=!1,state.option.esversion=esversions[key];break;case\\\"false\\\":state.option.moz||(state.option.esversion=5);break;default:error(\\\"E002\\\",nt)}}else switch(val){case\\\"true\\\":state.option.strict=!0;break;case\\\"false\\\":state.option.strict=!1;break;case\\\"func\\\":case\\\"global\\\":case\\\"implied\\\":state.option.strict=val;break;default:error(\\\"E002\\\",nt)}else switch(val){case\\\"line\\\":state.ignoredLines[nt.line]=!0,removeIgnoredMessages();break;default:error(\\\"E002\\\",nt)}else switch(val){case\\\"true\\\":state.option.latedef=!0;break;case\\\"false\\\":state.option.latedef=!1;break;case\\\"nofunc\\\":state.option.latedef=\\\"nofunc\\\";break;default:error(\\\"E002\\\",nt)}else switch(val){case\\\"true\\\":state.option.unused=!0;break;case\\\"false\\\":state.option.unused=!1;break;case\\\"vars\\\":case\\\"strict\\\":state.option.unused=val;break;default:error(\\\"E002\\\",nt)}else switch(val){case\\\"true\\\":state.option.shadow=!0;break;case\\\"outer\\\":state.option.shadow=\\\"outer\\\";break;case\\\"false\\\":case\\\"inner\\\":state.option.shadow=\\\"inner\\\";break;default:error(\\\"E002\\\",nt)}else switch(val){case\\\"true\\\":case\\\"false\\\":state.option.quotmark=\\\"true\\\"===val;break;case\\\"double\\\":case\\\"single\\\":state.option.quotmark=val;break;default:error(\\\"E002\\\",nt)}}}),assume())}function peek(p){var t,i=p||0,j=lookahead.length;if(j>i)return lookahead[i];for(;i>=j;)t=lookahead[j],t||(t=lookahead[j]=lex.token()),j+=1;return t||\\\"(end)\\\"!==state.tokens.next.id?t:state.tokens.next}function peekIgnoreEOL(){var t,i=0;do t=peek(i++);while(\\\"(endline)\\\"===t.id);return t}function advance(id,t){switch(state.tokens.curr.id){case\\\"(number)\\\":\\\".\\\"===state.tokens.next.id&&warning(\\\"W005\\\",state.tokens.curr);break;case\\\"-\\\":(\\\"-\\\"===state.tokens.next.id||\\\"--\\\"===state.tokens.next.id)&&warning(\\\"W006\\\");break;case\\\"+\\\":(\\\"+\\\"===state.tokens.next.id||\\\"++\\\"===state.tokens.next.id)&&warning(\\\"W007\\\")}for(id&&state.tokens.next.id!==id&&(t?\\\"(end)\\\"===state.tokens.next.id?error(\\\"E019\\\",t,t.id):error(\\\"E020\\\",state.tokens.next,id,t.id,t.line,state.tokens.next.value):(\\\"(identifier)\\\"!==state.tokens.next.type||state.tokens.next.value!==id)&&warning(\\\"W116\\\",state.tokens.next,id,state.tokens.next.value)),state.tokens.prev=state.tokens.curr,state.tokens.curr=state.tokens.next;;){if(state.tokens.next=lookahead.shift()||lex.token(),state.tokens.next||quit(\\\"E041\\\",state.tokens.curr.line),\\\"(end)\\\"===state.tokens.next.id||\\\"(error)\\\"===state.tokens.next.id)return;if(state.tokens.next.check&&state.tokens.next.check(),state.tokens.next.isSpecial)\\\"falls through\\\"===state.tokens.next.type?state.tokens.curr.caseFallsThrough=!0:doOption();else if(\\\"(endline)\\\"!==state.tokens.next.id)break}}function isInfix(token){return token.infix||!token.identifier&&!token.template&&!!token.led}function isEndOfExpr(){var curr=state.tokens.curr,next=state.tokens.next;return\\\";\\\"===next.id||\\\"}\\\"===next.id||\\\":\\\"===next.id?!0:isInfix(next)===isInfix(curr)||\\\"yield\\\"===curr.id&&state.inMoz()?curr.line!==startLine(next):!1}function isBeginOfExpr(prev){return!prev.left&&\\\"unary\\\"!==prev.arity}function expression(rbp,initial){var left,isArray=!1,isObject=!1,isLetExpr=!1;state.nameStack.push(),initial||\\\"let\\\"!==state.tokens.next.value||\\\"(\\\"!==peek(0).value||(state.inMoz()||warning(\\\"W118\\\",state.tokens.next,\\\"let expressions\\\"),isLetExpr=!0,state.funct[\\\"(scope)\\\"].stack(),advance(\\\"let\\\"),advance(\\\"(\\\"),state.tokens.prev.fud(),advance(\\\")\\\")),\\\"(end)\\\"===state.tokens.next.id&&error(\\\"E006\\\",state.tokens.curr);var isDangerous=state.option.asi&&state.tokens.prev.line!==startLine(state.tokens.curr)&&_.contains([\\\"]\\\",\\\")\\\"],state.tokens.prev.id)&&_.contains([\\\"[\\\",\\\"(\\\"],state.tokens.curr.id);if(isDangerous&&warning(\\\"W014\\\",state.tokens.curr,state.tokens.curr.id),advance(),initial&&(state.funct[\\\"(verb)\\\"]=state.tokens.curr.value,state.tokens.curr.beginsStmt=!0),initial===!0&&state.tokens.curr.fud)left=state.tokens.curr.fud();else for(state.tokens.curr.nud?left=state.tokens.curr.nud():error(\\\"E030\\\",state.tokens.curr,state.tokens.curr.id);(state.tokens.next.lbp>rbp||\\\"(template)\\\"===state.tokens.next.type)&&!isEndOfExpr();)isArray=\\\"Array\\\"===state.tokens.curr.value,isObject=\\\"Object\\\"===state.tokens.curr.value,left&&(left.value||left.first&&left.first.value)&&(\\\"new\\\"!==left.value||left.first&&left.first.value&&\\\".\\\"===left.first.value)&&(isArray=!1,left.value!==state.tokens.curr.value&&(isObject=!1)),advance(),isArray&&\\\"(\\\"===state.tokens.curr.id&&\\\")\\\"===state.tokens.next.id&&warning(\\\"W009\\\",state.tokens.curr),isObject&&\\\"(\\\"===state.tokens.curr.id&&\\\")\\\"===state.tokens.next.id&&warning(\\\"W010\\\",state.tokens.curr),left&&state.tokens.curr.led?left=state.tokens.curr.led(left):error(\\\"E033\\\",state.tokens.curr,state.tokens.curr.id);return isLetExpr&&state.funct[\\\"(scope)\\\"].unstack(),state.nameStack.pop(),left}function startLine(token){return token.startLine||token.line}function nobreaknonadjacent(left,right){left=left||state.tokens.curr,right=right||state.tokens.next,state.option.laxbreak||left.line===startLine(right)||warning(\\\"W014\\\",right,right.value)}function nolinebreak(t){t=t||state.tokens.curr,t.line!==startLine(state.tokens.next)&&warning(\\\"E022\\\",t,t.value)}function nobreakcomma(left,right){left.line!==startLine(right)&&(state.option.laxcomma||(comma.first&&(warning(\\\"I001\\\"),comma.first=!1),warning(\\\"W014\\\",left,right.value)))}function comma(opts){if(opts=opts||{},opts.peek?nobreakcomma(state.tokens.prev,state.tokens.curr):(nobreakcomma(state.tokens.curr,state.tokens.next),advance(\\\",\\\")),state.tokens.next.identifier&&(!opts.property||!state.inES5()))switch(state.tokens.next.value){case\\\"break\\\":case\\\"case\\\":case\\\"catch\\\":case\\\"continue\\\":case\\\"default\\\":case\\\"do\\\":case\\\"else\\\":case\\\"finally\\\":case\\\"for\\\":case\\\"if\\\":case\\\"in\\\":case\\\"instanceof\\\":case\\\"return\\\":case\\\"switch\\\":case\\\"throw\\\":case\\\"try\\\":case\\\"var\\\":case\\\"let\\\":case\\\"while\\\":case\\\"with\\\":return error(\\\"E024\\\",state.tokens.next,state.tokens.next.value),!1}if(\\\"(punctuator)\\\"===state.tokens.next.type)switch(state.tokens.next.value){case\\\"}\\\":case\\\"]\\\":case\\\",\\\":if(opts.allowTrailing)return!0;case\\\")\\\":return error(\\\"E024\\\",state.tokens.next,state.tokens.next.value),!1}return!0}function symbol(s,p){var x=state.syntax[s];return x&&\\\"object\\\"==typeof x||(state.syntax[s]=x={id:s,lbp:p,value:s}),x}function delim(s){var x=symbol(s,0);return x.delim=!0,x}function stmt(s,f){var x=delim(s);return x.identifier=x.reserved=!0,x.fud=f,x}function blockstmt(s,f){var x=stmt(s,f);return x.block=!0,x}function reserveName(x){var c=x.id.charAt(0);return(c>=\\\"a\\\"&&\\\"z\\\">=c||c>=\\\"A\\\"&&\\\"Z\\\">=c)&&(x.identifier=x.reserved=!0),x}function prefix(s,f){var x=symbol(s,150);return reserveName(x),x.nud=\\\"function\\\"==typeof f?f:function(){return this.arity=\\\"unary\\\",this.right=expression(150),(\\\"++\\\"===this.id||\\\"--\\\"===this.id)&&(state.option.plusplus?warning(\\\"W016\\\",this,this.id):!this.right||this.right.identifier&&!isReserved(this.right)||\\\".\\\"===this.right.id||\\\"[\\\"===this.right.id||warning(\\\"W017\\\",this),this.right&&this.right.isMetaProperty?error(\\\"E031\\\",this):this.right&&this.right.identifier&&state.funct[\\\"(scope)\\\"].block.modify(this.right.value,this)),this},x}function type(s,f){var x=delim(s);return x.type=s,x.nud=f,x}function reserve(name,func){var x=type(name,func);return x.identifier=!0,x.reserved=!0,x}function FutureReservedWord(name,meta){var x=type(name,meta&&meta.nud||function(){return this});return meta=meta||{},meta.isFutureReservedWord=!0,x.value=name,x.identifier=!0,x.reserved=!0,x.meta=meta,x}function reservevar(s,v){return reserve(s,function(){return\\\"function\\\"==typeof v&&v(this),this})}function infix(s,f,p,w){var x=symbol(s,p);return reserveName(x),x.infix=!0,x.led=function(left){return w||nobreaknonadjacent(state.tokens.prev,state.tokens.curr),\\\"in\\\"!==s&&\\\"instanceof\\\"!==s||\\\"!\\\"!==left.id||warning(\\\"W018\\\",left,\\\"!\\\"),\\\"function\\\"==typeof f?f(left,this):(this.left=left,this.right=expression(p),this)},x}function application(s){var x=symbol(s,42);return x.led=function(left){return nobreaknonadjacent(state.tokens.prev,state.tokens.curr),this.left=left,this.right=doFunction({type:\\\"arrow\\\",loneArg:left}),this},x}function relation(s,f){var x=symbol(s,100);return x.led=function(left){nobreaknonadjacent(state.tokens.prev,state.tokens.curr),this.left=left;var right=this.right=expression(100);return isIdentifier(left,\\\"NaN\\\")||isIdentifier(right,\\\"NaN\\\")?warning(\\\"W019\\\",this):f&&f.apply(this,[left,right]),left&&right||quit(\\\"E041\\\",state.tokens.curr.line),\\\"!\\\"===left.id&&warning(\\\"W018\\\",left,\\\"!\\\"),\\\"!\\\"===right.id&&warning(\\\"W018\\\",right,\\\"!\\\"),this},x}function isPoorRelation(node){return node&&(\\\"(number)\\\"===node.type&&0===+node.value||\\\"(string)\\\"===node.type&&\\\"\\\"===node.value||\\\"null\\\"===node.type&&!state.option.eqnull||\\\"true\\\"===node.type||\\\"false\\\"===node.type||\\\"undefined\\\"===node.type)}function isTypoTypeof(left,right,state){var values;return state.option.notypeof?!1:left&&right?(values=state.inES6()?typeofValues.es6:typeofValues.es3,\\\"(identifier)\\\"===right.type&&\\\"typeof\\\"===right.value&&\\\"(string)\\\"===left.type?!_.contains(values,left.value):!1):!1}function isGlobalEval(left,state){var isGlobal=!1;return\\\"this\\\"===left.type&&null===state.funct[\\\"(context)\\\"]?isGlobal=!0:\\\"(identifier)\\\"===left.type&&(state.option.node&&\\\"global\\\"===left.value?isGlobal=!0:!state.option.browser||\\\"window\\\"!==left.value&&\\\"document\\\"!==left.value||(isGlobal=!0)),isGlobal}function findNativePrototype(left){function walkPrototype(obj){return\\\"object\\\"==typeof obj?\\\"prototype\\\"===obj.right?obj:walkPrototype(obj.left):void 0}function walkNative(obj){for(;!obj.identifier&&\\\"object\\\"==typeof obj.left;)obj=obj.left;return obj.identifier&&natives.indexOf(obj.value)>=0?obj.value:void 0}var natives=[\\\"Array\\\",\\\"ArrayBuffer\\\",\\\"Boolean\\\",\\\"Collator\\\",\\\"DataView\\\",\\\"Date\\\",\\\"DateTimeFormat\\\",\\\"Error\\\",\\\"EvalError\\\",\\\"Float32Array\\\",\\\"Float64Array\\\",\\\"Function\\\",\\\"Infinity\\\",\\\"Intl\\\",\\\"Int16Array\\\",\\\"Int32Array\\\",\\\"Int8Array\\\",\\\"Iterator\\\",\\\"Number\\\",\\\"NumberFormat\\\",\\\"Object\\\",\\\"RangeError\\\",\\\"ReferenceError\\\",\\\"RegExp\\\",\\\"StopIteration\\\",\\\"String\\\",\\\"SyntaxError\\\",\\\"TypeError\\\",\\\"Uint16Array\\\",\\\"Uint32Array\\\",\\\"Uint8Array\\\",\\\"Uint8ClampedArray\\\",\\\"URIError\\\"],prototype=walkPrototype(left);return prototype?walkNative(prototype):void 0}function checkLeftSideAssign(left,assignToken,options){var allowDestructuring=options&&options.allowDestructuring;if(assignToken=assignToken||left,state.option.freeze){var nativeObject=findNativePrototype(left);nativeObject&&warning(\\\"W121\\\",left,nativeObject)}return left.identifier&&!left.isMetaProperty&&state.funct[\\\"(scope)\\\"].block.reassign(left.value,left),\\\".\\\"===left.id?((!left.left||\\\"arguments\\\"===left.left.value&&!state.isStrict())&&warning(\\\"E031\\\",assignToken),state.nameStack.set(state.tokens.prev),!0):\\\"{\\\"===left.id||\\\"[\\\"===left.id?(allowDestructuring&&state.tokens.curr.left.destructAssign?state.tokens.curr.left.destructAssign.forEach(function(t){t.id&&state.funct[\\\"(scope)\\\"].block.modify(t.id,t.token)}):\\\"{\\\"!==left.id&&left.left?\\\"arguments\\\"!==left.left.value||state.isStrict()||warning(\\\"E031\\\",assignToken):warning(\\\"E031\\\",assignToken),\\\"[\\\"===left.id&&state.nameStack.set(left.right),!0):left.isMetaProperty?(error(\\\"E031\\\",assignToken),!0):left.identifier&&!isReserved(left)?(\\\"exception\\\"===state.funct[\\\"(scope)\\\"].labeltype(left.value)&&warning(\\\"W022\\\",left),state.nameStack.set(left),!0):(left===state.syntax[\\\"function\\\"]&&warning(\\\"W023\\\",state.tokens.curr),!1)}function assignop(s,f,p){var x=infix(s,\\\"function\\\"==typeof f?f:function(left,that){return that.left=left,left&&checkLeftSideAssign(left,that,{allowDestructuring:!0})?(that.right=expression(10),that):(error(\\\"E031\\\",that),void 0)},p);return x.exps=!0,x.assign=!0,x}function bitwise(s,f,p){var x=symbol(s,p);return reserveName(x),x.led=\\\"function\\\"==typeof f?f:function(left){return state.option.bitwise&&warning(\\\"W016\\\",this,this.id),this.left=left,this.right=expression(p),this},x}function bitwiseassignop(s){return assignop(s,function(left,that){return state.option.bitwise&&warning(\\\"W016\\\",that,that.id),left&&checkLeftSideAssign(left,that)?(that.right=expression(10),that):(error(\\\"E031\\\",that),void 0)},20)}function suffix(s){var x=symbol(s,150);return x.led=function(left){return state.option.plusplus?warning(\\\"W016\\\",this,this.id):left.identifier&&!isReserved(left)||\\\".\\\"===left.id||\\\"[\\\"===left.id||warning(\\\"W017\\\",this),left.isMetaProperty?error(\\\"E031\\\",this):left&&left.identifier&&state.funct[\\\"(scope)\\\"].block.modify(left.value,left),this.left=left,this},x}function optionalidentifier(fnparam,prop,preserve){if(state.tokens.next.identifier){preserve||advance();var curr=state.tokens.curr,val=state.tokens.curr.value;return isReserved(curr)?prop&&state.inES5()?val:fnparam&&\\\"undefined\\\"===val?val:(warning(\\\"W024\\\",state.tokens.curr,state.tokens.curr.id),val):val}}function identifier(fnparam,prop){var i=optionalidentifier(fnparam,prop,!1);if(i)return i;if(\\\"...\\\"===state.tokens.next.value){if(state.inES6(!0)||warning(\\\"W119\\\",state.tokens.next,\\\"spread/rest operator\\\",\\\"6\\\"),advance(),checkPunctuator(state.tokens.next,\\\"...\\\"))for(warning(\\\"E024\\\",state.tokens.next,\\\"...\\\");checkPunctuator(state.tokens.next,\\\"...\\\");)advance();return state.tokens.next.identifier?identifier(fnparam,prop):(warning(\\\"E024\\\",state.tokens.curr,\\\"...\\\"),void 0)}error(\\\"E030\\\",state.tokens.next,state.tokens.next.value),\\\";\\\"!==state.tokens.next.id&&advance()}function reachable(controlToken){var t,i=0;if(\\\";\\\"===state.tokens.next.id&&!controlToken.inBracelessBlock)for(;;){do t=peek(i),i+=1;while(\\\"(end)\\\"!==t.id&&\\\"(comment)\\\"===t.id);if(t.reach)return;if(\\\"(endline)\\\"!==t.id){if(\\\"function\\\"===t.id){state.option.latedef===!0&&warning(\\\"W026\\\",t);break}warning(\\\"W027\\\",t,t.value,controlToken.value);break}}}function parseFinalSemicolon(){if(\\\";\\\"!==state.tokens.next.id){if(state.tokens.next.isUnclosed)return advance();var sameLine=startLine(state.tokens.next)===state.tokens.curr.line&&\\\"(end)\\\"!==state.tokens.next.id,blockEnd=checkPunctuator(state.tokens.next,\\\"}\\\");sameLine&&!blockEnd?errorAt(\\\"E058\\\",state.tokens.curr.line,state.tokens.curr.character):state.option.asi||(blockEnd&&!state.option.lastsemic||!sameLine)&&warningAt(\\\"W033\\\",state.tokens.curr.line,state.tokens.curr.character)}else advance(\\\";\\\")}function statement(){var r,i=indent,t=state.tokens.next,hasOwnScope=!1;if(\\\";\\\"===t.id)return advance(\\\";\\\"),void 0;var res=isReserved(t);if(res&&t.meta&&t.meta.isFutureReservedWord&&\\\":\\\"===peek().id&&(warning(\\\"W024\\\",t,t.id),res=!1),t.identifier&&!res&&\\\":\\\"===peek().id&&(advance(),advance(\\\":\\\"),hasOwnScope=!0,state.funct[\\\"(scope)\\\"].stack(),state.funct[\\\"(scope)\\\"].block.addBreakLabel(t.value,{token:state.tokens.curr}),state.tokens.next.labelled||\\\"{\\\"===state.tokens.next.value||warning(\\\"W028\\\",state.tokens.next,t.value,state.tokens.next.value),state.tokens.next.label=t.value,t=state.tokens.next),\\\"{\\\"===t.id){var iscase=\\\"case\\\"===state.funct[\\\"(verb)\\\"]&&\\\":\\\"===state.tokens.curr.value;return block(!0,!0,!1,!1,iscase),void 0}return r=expression(0,!0),!r||r.identifier&&\\\"function\\\"===r.value||\\\"(punctuator)\\\"===r.type&&r.left&&r.left.identifier&&\\\"function\\\"===r.left.value||state.isStrict()||\\\"global\\\"!==state.option.strict||warning(\\\"E007\\\"),t.block||(state.option.expr||r&&r.exps?state.option.nonew&&r&&r.left&&\\\"(\\\"===r.id&&\\\"new\\\"===r.left.id&&warning(\\\"W031\\\",t):warning(\\\"W030\\\",state.tokens.curr),parseFinalSemicolon()),indent=i,hasOwnScope&&state.funct[\\\"(scope)\\\"].unstack(),r}function statements(){for(var p,a=[];!state.tokens.next.reach&&\\\"(end)\\\"!==state.tokens.next.id;)\\\";\\\"===state.tokens.next.id?(p=peek(),(!p||\\\"(\\\"!==p.id&&\\\"[\\\"!==p.id)&&warning(\\\"W032\\\"),advance(\\\";\\\")):a.push(statement());return a}function directives(){for(var i,p,pn;\\\"(string)\\\"===state.tokens.next.id;){if(p=peek(0),\\\"(endline)\\\"===p.id){i=1;do pn=peek(i++);while(\\\"(endline)\\\"===pn.id);if(\\\";\\\"===pn.id)p=pn;else{if(\\\"[\\\"===pn.value||\\\".\\\"===pn.value)break;state.option.asi&&\\\"(\\\"!==pn.value||warning(\\\"W033\\\",state.tokens.next)}}else{if(\\\".\\\"===p.id||\\\"[\\\"===p.id)break;\\\";\\\"!==p.id&&warning(\\\"W033\\\",p)}advance();var directive=state.tokens.curr.value;(state.directive[directive]||\\\"use strict\\\"===directive&&\\\"implied\\\"===state.option.strict)&&warning(\\\"W034\\\",state.tokens.curr,directive),state.directive[directive]=!0,\\\";\\\"===p.id&&advance(\\\";\\\")}state.isStrict()&&(state.option[\\\"(explicitNewcap)\\\"]||(state.option.newcap=!0),state.option.undef=!0)}function block(ordinary,stmt,isfunc,isfatarrow,iscase){var a,m,t,line,d,b=inblock,old_indent=indent;inblock=ordinary,t=state.tokens.next;var metrics=state.funct[\\\"(metrics)\\\"];if(metrics.nestedBlockDepth+=1,metrics.verifyMaxNestedBlockDepthPerFunction(),\\\"{\\\"===state.tokens.next.id){if(advance(\\\"{\\\"),state.funct[\\\"(scope)\\\"].stack(),line=state.tokens.curr.line,\\\"}\\\"!==state.tokens.next.id){for(indent+=state.option.indent;!ordinary&&state.tokens.next.from>indent;)indent+=state.option.indent;if(isfunc){m={};for(d in state.directive)_.has(state.directive,d)&&(m[d]=state.directive[d]);directives(),state.option.strict&&state.funct[\\\"(context)\\\"][\\\"(global)\\\"]&&(m[\\\"use strict\\\"]||state.isStrict()||warning(\\\"E007\\\"))}a=statements(),metrics.statementCount+=a.length,indent-=state.option.indent}advance(\\\"}\\\",t),isfunc&&(state.funct[\\\"(scope)\\\"].validateParams(),m&&(state.directive=m)),state.funct[\\\"(scope)\\\"].unstack(),indent=old_indent}else if(ordinary)state.funct[\\\"(noblockscopedvar)\\\"]=\\\"for\\\"!==state.tokens.next.id,state.funct[\\\"(scope)\\\"].stack(),(!stmt||state.option.curly)&&warning(\\\"W116\\\",state.tokens.next,\\\"{\\\",state.tokens.next.value),state.tokens.next.inBracelessBlock=!0,indent+=state.option.indent,a=[statement()],indent-=state.option.indent,state.funct[\\\"(scope)\\\"].unstack(),delete state.funct[\\\"(noblockscopedvar)\\\"];else if(isfunc){if(state.funct[\\\"(scope)\\\"].stack(),m={},!stmt||isfatarrow||state.inMoz()||error(\\\"W118\\\",state.tokens.curr,\\\"function closure expressions\\\"),!stmt)for(d in state.directive)_.has(state.directive,d)&&(m[d]=state.directive[d]);expression(10),state.option.strict&&state.funct[\\\"(context)\\\"][\\\"(global)\\\"]&&(m[\\\"use strict\\\"]||state.isStrict()||warning(\\\"E007\\\")),state.funct[\\\"(scope)\\\"].unstack()}else error(\\\"E021\\\",state.tokens.next,\\\"{\\\",state.tokens.next.value);switch(state.funct[\\\"(verb)\\\"]){case\\\"break\\\":case\\\"continue\\\":case\\\"return\\\":case\\\"throw\\\":if(iscase)break;default:state.funct[\\\"(verb)\\\"]=null}return inblock=b,!ordinary||!state.option.noempty||a&&0!==a.length||warning(\\\"W035\\\",state.tokens.prev),metrics.nestedBlockDepth-=1,a}function countMember(m){membersOnly&&\\\"boolean\\\"!=typeof membersOnly[m]&&warning(\\\"W036\\\",state.tokens.curr,m),\\\"number\\\"==typeof member[m]?member[m]+=1:member[m]=1}function comprehensiveArrayExpression(){var res={};res.exps=!0,state.funct[\\\"(comparray)\\\"].stack();var reversed=!1;return\\\"for\\\"!==state.tokens.next.value&&(reversed=!0,state.inMoz()||warning(\\\"W116\\\",state.tokens.next,\\\"for\\\",state.tokens.next.value),state.funct[\\\"(comparray)\\\"].setState(\\\"use\\\"),res.right=expression(10)),advance(\\\"for\\\"),\\\"each\\\"===state.tokens.next.value&&(advance(\\\"each\\\"),state.inMoz()||warning(\\\"W118\\\",state.tokens.curr,\\\"for each\\\")),advance(\\\"(\\\"),state.funct[\\\"(comparray)\\\"].setState(\\\"define\\\"),res.left=expression(130),_.contains([\\\"in\\\",\\\"of\\\"],state.tokens.next.value)?advance():error(\\\"E045\\\",state.tokens.curr),state.funct[\\\"(comparray)\\\"].setState(\\\"generate\\\"),expression(10),advance(\\\")\\\"),\\\"if\\\"===state.tokens.next.value&&(advance(\\\"if\\\"),advance(\\\"(\\\"),state.funct[\\\"(comparray)\\\"].setState(\\\"filter\\\"),res.filter=expression(10),advance(\\\")\\\")),reversed||(state.funct[\\\"(comparray)\\\"].setState(\\\"use\\\"),res.right=expression(10)),advance(\\\"]\\\"),state.funct[\\\"(comparray)\\\"].unstack(),res}function isMethod(){return state.funct[\\\"(statement)\\\"]&&\\\"class\\\"===state.funct[\\\"(statement)\\\"].type||state.funct[\\\"(context)\\\"]&&\\\"class\\\"===state.funct[\\\"(context)\\\"][\\\"(verb)\\\"]}function isPropertyName(token){return token.identifier||\\\"(string)\\\"===token.id||\\\"(number)\\\"===token.id}function propertyName(preserveOrToken){var id,preserve=!0;return\\\"object\\\"==typeof preserveOrToken?id=preserveOrToken:(preserve=preserveOrToken,id=optionalidentifier(!1,!0,preserve)),id?\\\"object\\\"==typeof id&&(\\\"(string)\\\"===id.id||\\\"(identifier)\\\"===id.id?id=id.value:\\\"(number)\\\"===id.id&&(id=\\\"\\\"+id.value)):\\\"(string)\\\"===state.tokens.next.id?(id=state.tokens.next.value,preserve||advance()):\\\"(number)\\\"===state.tokens.next.id&&(id=\\\"\\\"+state.tokens.next.value,preserve||advance()),\\\"hasOwnProperty\\\"===id&&warning(\\\"W001\\\"),id}function functionparams(options){function addParam(addParamArgs){state.funct[\\\"(scope)\\\"].addParam.apply(state.funct[\\\"(scope)\\\"],addParamArgs)}var next,ident,t,paramsIds=[],tokens=[],pastDefault=!1,pastRest=!1,arity=0,loneArg=options&&options.loneArg;if(loneArg&&loneArg.identifier===!0)return state.funct[\\\"(scope)\\\"].addParam(loneArg.value,loneArg),{arity:1,params:[loneArg.value]};if(next=state.tokens.next,options&&options.parsedOpening||advance(\\\"(\\\"),\\\")\\\"===state.tokens.next.id)return advance(\\\")\\\"),void 0;for(;;){arity++;var currentParams=[];if(_.contains([\\\"{\\\",\\\"[\\\"],state.tokens.next.id)){tokens=destructuringPattern();for(t in tokens)t=tokens[t],t.id&&(paramsIds.push(t.id),currentParams.push([t.id,t.token]))}else if(checkPunctuator(state.tokens.next,\\\"...\\\")&&(pastRest=!0),ident=identifier(!0))paramsIds.push(ident),currentParams.push([ident,state.tokens.curr]);else for(;!checkPunctuators(state.tokens.next,[\\\",\\\",\\\")\\\"]);)advance();if(pastDefault&&\\\"=\\\"!==state.tokens.next.id&&error(\\\"W138\\\",state.tokens.current),\\\"=\\\"===state.tokens.next.id&&(state.inES6()||warning(\\\"W119\\\",state.tokens.next,\\\"default parameters\\\",\\\"6\\\"),advance(\\\"=\\\"),pastDefault=!0,expression(10)),currentParams.forEach(addParam),\\\",\\\"!==state.tokens.next.id)return advance(\\\")\\\",next),{arity:arity,params:paramsIds};pastRest&&warning(\\\"W131\\\",state.tokens.next),comma()}}function functor(name,token,overwrites){var funct={\\\"(name)\\\":name,\\\"(breakage)\\\":0,\\\"(loopage)\\\":0,\\\"(tokens)\\\":{},\\\"(properties)\\\":{},\\\"(catch)\\\":!1,\\\"(global)\\\":!1,\\\"(line)\\\":null,\\\"(character)\\\":null,\\\"(metrics)\\\":null,\\\"(statement)\\\":null,\\\"(context)\\\":null,\\\"(scope)\\\":null,\\\"(comparray)\\\":null,\\\"(generator)\\\":null,\\\"(arrow)\\\":null,\\\"(params)\\\":null};return token&&_.extend(funct,{\\\"(line)\\\":token.line,\\\"(character)\\\":token.character,\\\"(metrics)\\\":createMetrics(token)}),_.extend(funct,overwrites),funct[\\\"(context)\\\"]&&(funct[\\\"(scope)\\\"]=funct[\\\"(context)\\\"][\\\"(scope)\\\"],funct[\\\"(comparray)\\\"]=funct[\\\"(context)\\\"][\\\"(comparray)\\\"]),funct}function isFunctor(token){return\\\"(scope)\\\"in token}function hasParsedCode(funct){return funct[\\\"(global)\\\"]&&!funct[\\\"(verb)\\\"]}function doTemplateLiteral(left){function end(){if(state.tokens.curr.template&&state.tokens.curr.tail&&state.tokens.curr.context===ctx)return!0;var complete=state.tokens.next.template&&state.tokens.next.tail&&state.tokens.next.context===ctx;return complete&&advance(),complete||state.tokens.next.isUnclosed}var ctx=this.context,noSubst=this.noSubst,depth=this.depth;if(!noSubst)for(;!end();)!state.tokens.next.template||state.tokens.next.depth>depth?expression(0):advance();return{id:\\\"(template)\\\",type:\\\"(template)\\\",tag:left}}function doFunction(options){var f,token,name,statement,classExprBinding,isGenerator,isArrow,ignoreLoopFunc,oldOption=state.option,oldIgnored=state.ignored;options&&(name=options.name,statement=options.statement,classExprBinding=options.classExprBinding,isGenerator=\\\"generator\\\"===options.type,isArrow=\\\"arrow\\\"===options.type,ignoreLoopFunc=options.ignoreLoopFunc),state.option=Object.create(state.option),state.ignored=Object.create(state.ignored),state.funct=functor(name||state.nameStack.infer(),state.tokens.next,{\\\"(statement)\\\":statement,\\\"(context)\\\":state.funct,\\\"(arrow)\\\":isArrow,\\\"(generator)\\\":isGenerator}),f=state.funct,token=state.tokens.curr,token.funct=state.funct,functions.push(state.funct),state.funct[\\\"(scope)\\\"].stack(\\\"functionouter\\\");var internallyAccessibleName=name||classExprBinding;internallyAccessibleName&&state.funct[\\\"(scope)\\\"].block.add(internallyAccessibleName,classExprBinding?\\\"class\\\":\\\"function\\\",state.tokens.curr,!1),state.funct[\\\"(scope)\\\"].stack(\\\"functionparams\\\");var paramsInfo=functionparams(options);return paramsInfo?(state.funct[\\\"(params)\\\"]=paramsInfo.params,state.funct[\\\"(metrics)\\\"].arity=paramsInfo.arity,state.funct[\\\"(metrics)\\\"].verifyMaxParametersPerFunction()):state.funct[\\\"(metrics)\\\"].arity=0,isArrow&&(state.inES6(!0)||warning(\\\"W119\\\",state.tokens.curr,\\\"arrow function syntax (=>)\\\",\\\"6\\\"),options.loneArg||advance(\\\"=>\\\")),block(!1,!0,!0,isArrow),!state.option.noyield&&isGenerator&&\\\"yielded\\\"!==state.funct[\\\"(generator)\\\"]&&warning(\\\"W124\\\",state.tokens.curr),state.funct[\\\"(metrics)\\\"].verifyMaxStatementsPerFunction(),state.funct[\\\"(metrics)\\\"].verifyMaxComplexityPerFunction(),state.funct[\\\"(unusedOption)\\\"]=state.option.unused,state.option=oldOption,state.ignored=oldIgnored,state.funct[\\\"(last)\\\"]=state.tokens.curr.line,state.funct[\\\"(lastcharacter)\\\"]=state.tokens.curr.character,state.funct[\\\"(scope)\\\"].unstack(),state.funct[\\\"(scope)\\\"].unstack(),state.funct=state.funct[\\\"(context)\\\"],ignoreLoopFunc||state.option.loopfunc||!state.funct[\\\"(loopage)\\\"]||f[\\\"(isCapturing)\\\"]&&warning(\\\"W083\\\",token),f}function createMetrics(functionStartToken){return{statementCount:0,nestedBlockDepth:-1,ComplexityCount:1,arity:0,verifyMaxStatementsPerFunction:function(){state.option.maxstatements&&this.statementCount>state.option.maxstatements&&warning(\\\"W071\\\",functionStartToken,this.statementCount)\\n},verifyMaxParametersPerFunction:function(){_.isNumber(state.option.maxparams)&&this.arity>state.option.maxparams&&warning(\\\"W072\\\",functionStartToken,this.arity)},verifyMaxNestedBlockDepthPerFunction:function(){state.option.maxdepth&&this.nestedBlockDepth>0&&this.nestedBlockDepth===state.option.maxdepth+1&&warning(\\\"W073\\\",null,this.nestedBlockDepth)},verifyMaxComplexityPerFunction:function(){var max=state.option.maxcomplexity,cc=this.ComplexityCount;max&&cc>max&&warning(\\\"W074\\\",functionStartToken,cc)}}}function increaseComplexityCount(){state.funct[\\\"(metrics)\\\"].ComplexityCount+=1}function checkCondAssignment(expr){var id,paren;switch(expr&&(id=expr.id,paren=expr.paren,\\\",\\\"===id&&(expr=expr.exprs[expr.exprs.length-1])&&(id=expr.id,paren=paren||expr.paren)),id){case\\\"=\\\":case\\\"+=\\\":case\\\"-=\\\":case\\\"*=\\\":case\\\"%=\\\":case\\\"&=\\\":case\\\"|=\\\":case\\\"^=\\\":case\\\"/=\\\":paren||state.option.boss||warning(\\\"W084\\\")}}function checkProperties(props){if(state.inES5())for(var name in props)props[name]&&props[name].setterToken&&!props[name].getterToken&&warning(\\\"W078\\\",props[name].setterToken)}function metaProperty(name,c){if(checkPunctuator(state.tokens.next,\\\".\\\")){var left=state.tokens.curr.id;advance(\\\".\\\");var id=identifier();return state.tokens.curr.isMetaProperty=!0,name!==id?error(\\\"E057\\\",state.tokens.prev,left,id):c(),state.tokens.curr}}function destructuringPattern(options){var isAssignment=options&&options.assignment;return state.inES6()||warning(\\\"W104\\\",state.tokens.curr,isAssignment?\\\"destructuring assignment\\\":\\\"destructuring binding\\\",\\\"6\\\"),destructuringPatternRecursive(options)}function destructuringPatternRecursive(options){var ids,identifiers=[],openingParsed=options&&options.openingParsed,isAssignment=options&&options.assignment,recursiveOptions=isAssignment?{assignment:isAssignment}:null,firstToken=openingParsed?state.tokens.curr:state.tokens.next,nextInnerDE=function(){var ident;if(checkPunctuators(state.tokens.next,[\\\"[\\\",\\\"{\\\"])){ids=destructuringPatternRecursive(recursiveOptions);for(var id in ids)id=ids[id],identifiers.push({id:id.id,token:id.token})}else if(checkPunctuator(state.tokens.next,\\\",\\\"))identifiers.push({id:null,token:state.tokens.curr});else{if(!checkPunctuator(state.tokens.next,\\\"(\\\")){var is_rest=checkPunctuator(state.tokens.next,\\\"...\\\");if(isAssignment){var identifierToken=is_rest?peek(0):state.tokens.next;identifierToken.identifier||warning(\\\"E030\\\",identifierToken,identifierToken.value);var assignTarget=expression(155);assignTarget&&(checkLeftSideAssign(assignTarget),assignTarget.identifier&&(ident=assignTarget.value))}else ident=identifier();return ident&&identifiers.push({id:ident,token:state.tokens.curr}),is_rest}advance(\\\"(\\\"),nextInnerDE(),advance(\\\")\\\")}return!1},assignmentProperty=function(){var id;checkPunctuator(state.tokens.next,\\\"[\\\")?(advance(\\\"[\\\"),expression(10),advance(\\\"]\\\"),advance(\\\":\\\"),nextInnerDE()):\\\"(string)\\\"===state.tokens.next.id||\\\"(number)\\\"===state.tokens.next.id?(advance(),advance(\\\":\\\"),nextInnerDE()):(id=identifier(),checkPunctuator(state.tokens.next,\\\":\\\")?(advance(\\\":\\\"),nextInnerDE()):id&&(isAssignment&&checkLeftSideAssign(state.tokens.curr),identifiers.push({id:id,token:state.tokens.curr})))};if(checkPunctuator(firstToken,\\\"[\\\")){openingParsed||advance(\\\"[\\\"),checkPunctuator(state.tokens.next,\\\"]\\\")&&warning(\\\"W137\\\",state.tokens.curr);for(var element_after_rest=!1;!checkPunctuator(state.tokens.next,\\\"]\\\");)nextInnerDE()&&!element_after_rest&&checkPunctuator(state.tokens.next,\\\",\\\")&&(warning(\\\"W130\\\",state.tokens.next),element_after_rest=!0),checkPunctuator(state.tokens.next,\\\"=\\\")&&(checkPunctuator(state.tokens.prev,\\\"...\\\")?advance(\\\"]\\\"):advance(\\\"=\\\"),\\\"undefined\\\"===state.tokens.next.id&&warning(\\\"W080\\\",state.tokens.prev,state.tokens.prev.value),expression(10)),checkPunctuator(state.tokens.next,\\\"]\\\")||advance(\\\",\\\");advance(\\\"]\\\")}else if(checkPunctuator(firstToken,\\\"{\\\")){for(openingParsed||advance(\\\"{\\\"),checkPunctuator(state.tokens.next,\\\"}\\\")&&warning(\\\"W137\\\",state.tokens.curr);!checkPunctuator(state.tokens.next,\\\"}\\\")&&(assignmentProperty(),checkPunctuator(state.tokens.next,\\\"=\\\")&&(advance(\\\"=\\\"),\\\"undefined\\\"===state.tokens.next.id&&warning(\\\"W080\\\",state.tokens.prev,state.tokens.prev.value),expression(10)),checkPunctuator(state.tokens.next,\\\"}\\\")||(advance(\\\",\\\"),!checkPunctuator(state.tokens.next,\\\"}\\\"))););advance(\\\"}\\\")}return identifiers}function destructuringPatternMatch(tokens,value){var first=value.first;first&&_.zip(tokens,Array.isArray(first)?first:[first]).forEach(function(val){var token=val[0],value=val[1];token&&value?token.first=value:token&&token.first&&!value&&warning(\\\"W080\\\",token.first,token.first.value)})}function blockVariableStatement(type,statement,context){var tokens,lone,value,letblock,prefix=context&&context.prefix,inexport=context&&context.inexport,isLet=\\\"let\\\"===type,isConst=\\\"const\\\"===type;for(state.inES6()||warning(\\\"W104\\\",state.tokens.curr,type,\\\"6\\\"),isLet&&\\\"(\\\"===state.tokens.next.value?(state.inMoz()||warning(\\\"W118\\\",state.tokens.next,\\\"let block\\\"),advance(\\\"(\\\"),state.funct[\\\"(scope)\\\"].stack(),letblock=!0):state.funct[\\\"(noblockscopedvar)\\\"]&&error(\\\"E048\\\",state.tokens.curr,isConst?\\\"Const\\\":\\\"Let\\\"),statement.first=[];;){var names=[];_.contains([\\\"{\\\",\\\"[\\\"],state.tokens.next.value)?(tokens=destructuringPattern(),lone=!1):(tokens=[{id:identifier(),token:state.tokens.curr}],lone=!0),!prefix&&isConst&&\\\"=\\\"!==state.tokens.next.id&&warning(\\\"E012\\\",state.tokens.curr,state.tokens.curr.value);for(var t in tokens)tokens.hasOwnProperty(t)&&(t=tokens[t],state.funct[\\\"(scope)\\\"].block.isGlobal()&&predefined[t.id]===!1&&warning(\\\"W079\\\",t.token,t.id),t.id&&!state.funct[\\\"(noblockscopedvar)\\\"]&&(state.funct[\\\"(scope)\\\"].addlabel(t.id,{type:type,token:t.token}),names.push(t.token),lone&&inexport&&state.funct[\\\"(scope)\\\"].setExported(t.token.value,t.token)));if(\\\"=\\\"===state.tokens.next.id&&(advance(\\\"=\\\"),prefix||\\\"undefined\\\"!==state.tokens.next.id||warning(\\\"W080\\\",state.tokens.prev,state.tokens.prev.value),!prefix&&\\\"=\\\"===peek(0).id&&state.tokens.next.identifier&&warning(\\\"W120\\\",state.tokens.next,state.tokens.next.value),value=expression(prefix?120:10),lone?tokens[0].first=value:destructuringPatternMatch(names,value)),statement.first=statement.first.concat(names),\\\",\\\"!==state.tokens.next.id)break;comma()}return letblock&&(advance(\\\")\\\"),block(!0,!0),statement.block=!0,state.funct[\\\"(scope)\\\"].unstack()),statement}function classdef(isStatement){return state.inES6()||warning(\\\"W104\\\",state.tokens.curr,\\\"class\\\",\\\"6\\\"),isStatement?(this.name=identifier(),state.funct[\\\"(scope)\\\"].addlabel(this.name,{type:\\\"class\\\",token:state.tokens.curr})):state.tokens.next.identifier&&\\\"extends\\\"!==state.tokens.next.value?(this.name=identifier(),this.namedExpr=!0):this.name=state.nameStack.infer(),classtail(this),this}function classtail(c){var wasInClassBody=state.inClassBody;\\\"extends\\\"===state.tokens.next.value&&(advance(\\\"extends\\\"),c.heritage=expression(10)),state.inClassBody=!0,advance(\\\"{\\\"),c.body=classbody(c),advance(\\\"}\\\"),state.inClassBody=wasInClassBody}function classbody(c){for(var name,isStatic,isGenerator,getset,computed,props=Object.create(null),staticProps=Object.create(null),i=0;\\\"}\\\"!==state.tokens.next.id;++i)if(name=state.tokens.next,isStatic=!1,isGenerator=!1,getset=null,\\\";\\\"!==name.id){if(\\\"*\\\"===name.id&&(isGenerator=!0,advance(\\\"*\\\"),name=state.tokens.next),\\\"[\\\"===name.id)name=computedPropertyName(),computed=!0;else{if(!isPropertyName(name)){warning(\\\"W052\\\",state.tokens.next,state.tokens.next.value||state.tokens.next.type),advance();continue}advance(),computed=!1,name.identifier&&\\\"static\\\"===name.value&&(checkPunctuator(state.tokens.next,\\\"*\\\")&&(isGenerator=!0,advance(\\\"*\\\")),(isPropertyName(state.tokens.next)||\\\"[\\\"===state.tokens.next.id)&&(computed=\\\"[\\\"===state.tokens.next.id,isStatic=!0,name=state.tokens.next,\\\"[\\\"===state.tokens.next.id?name=computedPropertyName():advance())),!name.identifier||\\\"get\\\"!==name.value&&\\\"set\\\"!==name.value||(isPropertyName(state.tokens.next)||\\\"[\\\"===state.tokens.next.id)&&(computed=\\\"[\\\"===state.tokens.next.id,getset=name,name=state.tokens.next,\\\"[\\\"===state.tokens.next.id?name=computedPropertyName():advance())}if(!checkPunctuator(state.tokens.next,\\\"(\\\")){for(error(\\\"E054\\\",state.tokens.next,state.tokens.next.value);\\\"}\\\"!==state.tokens.next.id&&!checkPunctuator(state.tokens.next,\\\"(\\\");)advance();\\\"(\\\"!==state.tokens.next.value&&doFunction({statement:c})}if(computed||(getset?saveAccessor(getset.value,isStatic?staticProps:props,name.value,name,!0,isStatic):(\\\"constructor\\\"===name.value?state.nameStack.set(c):state.nameStack.set(name),saveProperty(isStatic?staticProps:props,name.value,name,!0,isStatic))),getset&&\\\"constructor\\\"===name.value){var propDesc=\\\"get\\\"===getset.value?\\\"class getter method\\\":\\\"class setter method\\\";error(\\\"E049\\\",name,propDesc,\\\"constructor\\\")}else\\\"prototype\\\"===name.value&&error(\\\"E049\\\",name,\\\"class method\\\",\\\"prototype\\\");propertyName(name),doFunction({statement:c,type:isGenerator?\\\"generator\\\":null,classExprBinding:c.namedExpr?c.name:null})}else warning(\\\"W032\\\"),advance(\\\";\\\");checkProperties(props)}function saveProperty(props,name,tkn,isClass,isStatic){var msg=[\\\"key\\\",\\\"class method\\\",\\\"static class method\\\"];msg=msg[(isClass||!1)+(isStatic||!1)],tkn.identifier&&(name=tkn.value),props[name]&&\\\"__proto__\\\"!==name?warning(\\\"W075\\\",state.tokens.next,msg,name):props[name]=Object.create(null),props[name].basic=!0,props[name].basictkn=tkn}function saveAccessor(accessorType,props,name,tkn,isClass,isStatic){var flagName=\\\"get\\\"===accessorType?\\\"getterToken\\\":\\\"setterToken\\\",msg=\\\"\\\";isClass?(isStatic&&(msg+=\\\"static \\\"),msg+=accessorType+\\\"ter method\\\"):msg=\\\"key\\\",state.tokens.curr.accessorType=accessorType,state.nameStack.set(tkn),props[name]?(props[name].basic||props[name][flagName])&&\\\"__proto__\\\"!==name&&warning(\\\"W075\\\",state.tokens.next,msg,name):props[name]=Object.create(null),props[name][flagName]=tkn}function computedPropertyName(){advance(\\\"[\\\"),state.inES6()||warning(\\\"W119\\\",state.tokens.curr,\\\"computed property names\\\",\\\"6\\\");var value=expression(10);return advance(\\\"]\\\"),value}function checkPunctuators(token,values){return\\\"(punctuator)\\\"===token.type?_.contains(values,token.value):!1}function checkPunctuator(token,value){return\\\"(punctuator)\\\"===token.type&&token.value===value}function destructuringAssignOrJsonValue(){var block=lookupBlockType();block.notJson?(!state.inES6()&&block.isDestAssign&&warning(\\\"W104\\\",state.tokens.curr,\\\"destructuring assignment\\\",\\\"6\\\"),statements()):(state.option.laxbreak=!0,state.jsonMode=!0,jsonValue())}function jsonValue(){function jsonObject(){var o={},t=state.tokens.next;if(advance(\\\"{\\\"),\\\"}\\\"!==state.tokens.next.id)for(;;){if(\\\"(end)\\\"===state.tokens.next.id)error(\\\"E026\\\",state.tokens.next,t.line);else{if(\\\"}\\\"===state.tokens.next.id){warning(\\\"W094\\\",state.tokens.curr);break}\\\",\\\"===state.tokens.next.id?error(\\\"E028\\\",state.tokens.next):\\\"(string)\\\"!==state.tokens.next.id&&warning(\\\"W095\\\",state.tokens.next,state.tokens.next.value)}if(o[state.tokens.next.value]===!0?warning(\\\"W075\\\",state.tokens.next,\\\"key\\\",state.tokens.next.value):\\\"__proto__\\\"===state.tokens.next.value&&!state.option.proto||\\\"__iterator__\\\"===state.tokens.next.value&&!state.option.iterator?warning(\\\"W096\\\",state.tokens.next,state.tokens.next.value):o[state.tokens.next.value]=!0,advance(),advance(\\\":\\\"),jsonValue(),\\\",\\\"!==state.tokens.next.id)break;advance(\\\",\\\")}advance(\\\"}\\\")}function jsonArray(){var t=state.tokens.next;if(advance(\\\"[\\\"),\\\"]\\\"!==state.tokens.next.id)for(;;){if(\\\"(end)\\\"===state.tokens.next.id)error(\\\"E027\\\",state.tokens.next,t.line);else{if(\\\"]\\\"===state.tokens.next.id){warning(\\\"W094\\\",state.tokens.curr);break}\\\",\\\"===state.tokens.next.id&&error(\\\"E028\\\",state.tokens.next)}if(jsonValue(),\\\",\\\"!==state.tokens.next.id)break;advance(\\\",\\\")}advance(\\\"]\\\")}switch(state.tokens.next.id){case\\\"{\\\":jsonObject();break;case\\\"[\\\":jsonArray();break;case\\\"true\\\":case\\\"false\\\":case\\\"null\\\":case\\\"(number)\\\":case\\\"(string)\\\":advance();break;case\\\"-\\\":advance(\\\"-\\\"),advance(\\\"(number)\\\");break;default:error(\\\"E003\\\",state.tokens.next)}}var api,declared,functions,inblock,indent,lookahead,lex,member,membersOnly,predefined,stack,urls,bang={\\\"<\\\":!0,\\\"<=\\\":!0,\\\"==\\\":!0,\\\"===\\\":!0,\\\"!==\\\":!0,\\\"!=\\\":!0,\\\">\\\":!0,\\\">=\\\":!0,\\\"+\\\":!0,\\\"-\\\":!0,\\\"*\\\":!0,\\\"/\\\":!0,\\\"%\\\":!0},functionicity=[\\\"closure\\\",\\\"exception\\\",\\\"global\\\",\\\"label\\\",\\\"outer\\\",\\\"unused\\\",\\\"var\\\"],extraModules=[],emitter=new events.EventEmitter,typeofValues={};typeofValues.legacy=[\\\"xml\\\",\\\"unknown\\\"],typeofValues.es3=[\\\"undefined\\\",\\\"boolean\\\",\\\"number\\\",\\\"string\\\",\\\"function\\\",\\\"object\\\"],typeofValues.es3=typeofValues.es3.concat(typeofValues.legacy),typeofValues.es6=typeofValues.es3.concat(\\\"symbol\\\"),type(\\\"(number)\\\",function(){return this}),type(\\\"(string)\\\",function(){return this}),state.syntax[\\\"(identifier)\\\"]={type:\\\"(identifier)\\\",lbp:0,identifier:!0,nud:function(){var v=this.value;return\\\"=>\\\"===state.tokens.next.id?this:(state.funct[\\\"(comparray)\\\"].check(v)||state.funct[\\\"(scope)\\\"].block.use(v,state.tokens.curr),this)},led:function(){error(\\\"E033\\\",state.tokens.next,state.tokens.next.value)}};var baseTemplateSyntax={lbp:0,identifier:!1,template:!0};state.syntax[\\\"(template)\\\"]=_.extend({type:\\\"(template)\\\",nud:doTemplateLiteral,led:doTemplateLiteral,noSubst:!1},baseTemplateSyntax),state.syntax[\\\"(template middle)\\\"]=_.extend({type:\\\"(template middle)\\\",middle:!0,noSubst:!1},baseTemplateSyntax),state.syntax[\\\"(template tail)\\\"]=_.extend({type:\\\"(template tail)\\\",tail:!0,noSubst:!1},baseTemplateSyntax),state.syntax[\\\"(no subst template)\\\"]=_.extend({type:\\\"(template)\\\",nud:doTemplateLiteral,led:doTemplateLiteral,noSubst:!0,tail:!0},baseTemplateSyntax),type(\\\"(regexp)\\\",function(){return this}),delim(\\\"(endline)\\\"),delim(\\\"(begin)\\\"),delim(\\\"(end)\\\").reach=!0,delim(\\\"(error)\\\").reach=!0,delim(\\\"}\\\").reach=!0,delim(\\\")\\\"),delim(\\\"]\\\"),delim('\\\"').reach=!0,delim(\\\"'\\\").reach=!0,delim(\\\";\\\"),delim(\\\":\\\").reach=!0,delim(\\\"#\\\"),reserve(\\\"else\\\"),reserve(\\\"case\\\").reach=!0,reserve(\\\"catch\\\"),reserve(\\\"default\\\").reach=!0,reserve(\\\"finally\\\"),reservevar(\\\"arguments\\\",function(x){state.isStrict()&&state.funct[\\\"(global)\\\"]&&warning(\\\"E008\\\",x)}),reservevar(\\\"eval\\\"),reservevar(\\\"false\\\"),reservevar(\\\"Infinity\\\"),reservevar(\\\"null\\\"),reservevar(\\\"this\\\",function(x){state.isStrict()&&!isMethod()&&!state.option.validthis&&(state.funct[\\\"(statement)\\\"]&&state.funct[\\\"(name)\\\"].charAt(0)>\\\"Z\\\"||state.funct[\\\"(global)\\\"])&&warning(\\\"W040\\\",x)}),reservevar(\\\"true\\\"),reservevar(\\\"undefined\\\"),assignop(\\\"=\\\",\\\"assign\\\",20),assignop(\\\"+=\\\",\\\"assignadd\\\",20),assignop(\\\"-=\\\",\\\"assignsub\\\",20),assignop(\\\"*=\\\",\\\"assignmult\\\",20),assignop(\\\"/=\\\",\\\"assigndiv\\\",20).nud=function(){error(\\\"E014\\\")},assignop(\\\"%=\\\",\\\"assignmod\\\",20),bitwiseassignop(\\\"&=\\\"),bitwiseassignop(\\\"|=\\\"),bitwiseassignop(\\\"^=\\\"),bitwiseassignop(\\\"<<=\\\"),bitwiseassignop(\\\">>=\\\"),bitwiseassignop(\\\">>>=\\\"),infix(\\\",\\\",function(left,that){var expr;if(that.exprs=[left],state.option.nocomma&&warning(\\\"W127\\\"),!comma({peek:!0}))return that;for(;;){if(!(expr=expression(10)))break;if(that.exprs.push(expr),\\\",\\\"!==state.tokens.next.value||!comma())break}return that},10,!0),infix(\\\"?\\\",function(left,that){return increaseComplexityCount(),that.left=left,that.right=expression(10),advance(\\\":\\\"),that[\\\"else\\\"]=expression(10),that},30);var orPrecendence=40;infix(\\\"||\\\",function(left,that){return increaseComplexityCount(),that.left=left,that.right=expression(orPrecendence),that},orPrecendence),infix(\\\"&&\\\",\\\"and\\\",50),bitwise(\\\"|\\\",\\\"bitor\\\",70),bitwise(\\\"^\\\",\\\"bitxor\\\",80),bitwise(\\\"&\\\",\\\"bitand\\\",90),relation(\\\"==\\\",function(left,right){var eqnull=state.option.eqnull&&(\\\"null\\\"===(left&&left.value)||\\\"null\\\"===(right&&right.value));switch(!0){case!eqnull&&state.option.eqeqeq:this.from=this.character,warning(\\\"W116\\\",this,\\\"===\\\",\\\"==\\\");break;case isPoorRelation(left):warning(\\\"W041\\\",this,\\\"===\\\",left.value);break;case isPoorRelation(right):warning(\\\"W041\\\",this,\\\"===\\\",right.value);break;case isTypoTypeof(right,left,state):warning(\\\"W122\\\",this,right.value);break;case isTypoTypeof(left,right,state):warning(\\\"W122\\\",this,left.value)}return this}),relation(\\\"===\\\",function(left,right){return isTypoTypeof(right,left,state)?warning(\\\"W122\\\",this,right.value):isTypoTypeof(left,right,state)&&warning(\\\"W122\\\",this,left.value),this}),relation(\\\"!=\\\",function(left,right){var eqnull=state.option.eqnull&&(\\\"null\\\"===(left&&left.value)||\\\"null\\\"===(right&&right.value));return!eqnull&&state.option.eqeqeq?(this.from=this.character,warning(\\\"W116\\\",this,\\\"!==\\\",\\\"!=\\\")):isPoorRelation(left)?warning(\\\"W041\\\",this,\\\"!==\\\",left.value):isPoorRelation(right)?warning(\\\"W041\\\",this,\\\"!==\\\",right.value):isTypoTypeof(right,left,state)?warning(\\\"W122\\\",this,right.value):isTypoTypeof(left,right,state)&&warning(\\\"W122\\\",this,left.value),this}),relation(\\\"!==\\\",function(left,right){return isTypoTypeof(right,left,state)?warning(\\\"W122\\\",this,right.value):isTypoTypeof(left,right,state)&&warning(\\\"W122\\\",this,left.value),this}),relation(\\\"<\\\"),relation(\\\">\\\"),relation(\\\"<=\\\"),relation(\\\">=\\\"),bitwise(\\\"<<\\\",\\\"shiftleft\\\",120),bitwise(\\\">>\\\",\\\"shiftright\\\",120),bitwise(\\\">>>\\\",\\\"shiftrightunsigned\\\",120),infix(\\\"in\\\",\\\"in\\\",120),infix(\\\"instanceof\\\",\\\"instanceof\\\",120),infix(\\\"+\\\",function(left,that){var right;return that.left=left,that.right=right=expression(130),left&&right&&\\\"(string)\\\"===left.id&&\\\"(string)\\\"===right.id?(left.value+=right.value,left.character=right.character,!state.option.scripturl&&reg.javascriptURL.test(left.value)&&warning(\\\"W050\\\",left),left):that},130),prefix(\\\"+\\\",\\\"num\\\"),prefix(\\\"+++\\\",function(){return warning(\\\"W007\\\"),this.arity=\\\"unary\\\",this.right=expression(150),this}),infix(\\\"+++\\\",function(left){return warning(\\\"W007\\\"),this.left=left,this.right=expression(130),this},130),infix(\\\"-\\\",\\\"sub\\\",130),prefix(\\\"-\\\",\\\"neg\\\"),prefix(\\\"---\\\",function(){return warning(\\\"W006\\\"),this.arity=\\\"unary\\\",this.right=expression(150),this}),infix(\\\"---\\\",function(left){return warning(\\\"W006\\\"),this.left=left,this.right=expression(130),this},130),infix(\\\"*\\\",\\\"mult\\\",140),infix(\\\"/\\\",\\\"div\\\",140),infix(\\\"%\\\",\\\"mod\\\",140),suffix(\\\"++\\\"),prefix(\\\"++\\\",\\\"preinc\\\"),state.syntax[\\\"++\\\"].exps=!0,suffix(\\\"--\\\"),prefix(\\\"--\\\",\\\"predec\\\"),state.syntax[\\\"--\\\"].exps=!0,prefix(\\\"delete\\\",function(){var p=expression(10);return p?(\\\".\\\"!==p.id&&\\\"[\\\"!==p.id&&warning(\\\"W051\\\"),this.first=p,p.identifier&&!state.isStrict()&&(p.forgiveUndef=!0),this):this}).exps=!0,prefix(\\\"~\\\",function(){return state.option.bitwise&&warning(\\\"W016\\\",this,\\\"~\\\"),this.arity=\\\"unary\\\",this.right=expression(150),this}),prefix(\\\"...\\\",function(){return state.inES6(!0)||warning(\\\"W119\\\",this,\\\"spread/rest operator\\\",\\\"6\\\"),state.tokens.next.identifier||\\\"(string)\\\"===state.tokens.next.type||checkPunctuators(state.tokens.next,[\\\"[\\\",\\\"(\\\"])||error(\\\"E030\\\",state.tokens.next,state.tokens.next.value),expression(150),this}),prefix(\\\"!\\\",function(){return this.arity=\\\"unary\\\",this.right=expression(150),this.right||quit(\\\"E041\\\",this.line||0),bang[this.right.id]===!0&&warning(\\\"W018\\\",this,\\\"!\\\"),this}),prefix(\\\"typeof\\\",function(){var p=expression(150);return this.first=this.right=p,p||quit(\\\"E041\\\",this.line||0,this.character||0),p.identifier&&(p.forgiveUndef=!0),this}),prefix(\\\"new\\\",function(){var mp=metaProperty(\\\"target\\\",function(){state.inES6(!0)||warning(\\\"W119\\\",state.tokens.prev,\\\"new.target\\\",\\\"6\\\");for(var inFunction,c=state.funct;c&&(inFunction=!c[\\\"(global)\\\"],c[\\\"(arrow)\\\"]);)c=c[\\\"(context)\\\"];inFunction||warning(\\\"W136\\\",state.tokens.prev,\\\"new.target\\\")});if(mp)return mp;var i,c=expression(155);if(c&&\\\"function\\\"!==c.id)if(c.identifier)switch(c[\\\"new\\\"]=!0,c.value){case\\\"Number\\\":case\\\"String\\\":case\\\"Boolean\\\":case\\\"Math\\\":case\\\"JSON\\\":warning(\\\"W053\\\",state.tokens.prev,c.value);break;case\\\"Symbol\\\":state.inES6()&&warning(\\\"W053\\\",state.tokens.prev,c.value);break;case\\\"Function\\\":state.option.evil||warning(\\\"W054\\\");break;case\\\"Date\\\":case\\\"RegExp\\\":case\\\"this\\\":break;default:\\\"function\\\"!==c.id&&(i=c.value.substr(0,1),state.option.newcap&&(\\\"A\\\">i||i>\\\"Z\\\")&&!state.funct[\\\"(scope)\\\"].isPredefined(c.value)&&warning(\\\"W055\\\",state.tokens.curr))}else\\\".\\\"!==c.id&&\\\"[\\\"!==c.id&&\\\"(\\\"!==c.id&&warning(\\\"W056\\\",state.tokens.curr);else state.option.supernew||warning(\\\"W057\\\",this);return\\\"(\\\"===state.tokens.next.id||state.option.supernew||warning(\\\"W058\\\",state.tokens.curr,state.tokens.curr.value),this.first=this.right=c,this}),state.syntax[\\\"new\\\"].exps=!0,prefix(\\\"void\\\").exps=!0,infix(\\\".\\\",function(left,that){var m=identifier(!1,!0);return\\\"string\\\"==typeof m&&countMember(m),that.left=left,that.right=m,m&&\\\"hasOwnProperty\\\"===m&&\\\"=\\\"===state.tokens.next.value&&warning(\\\"W001\\\"),!left||\\\"arguments\\\"!==left.value||\\\"callee\\\"!==m&&\\\"caller\\\"!==m?state.option.evil||!left||\\\"document\\\"!==left.value||\\\"write\\\"!==m&&\\\"writeln\\\"!==m||warning(\\\"W060\\\",left):state.option.noarg?warning(\\\"W059\\\",left,m):state.isStrict()&&error(\\\"E008\\\"),state.option.evil||\\\"eval\\\"!==m&&\\\"execScript\\\"!==m||isGlobalEval(left,state)&&warning(\\\"W061\\\"),that},160,!0),infix(\\\"(\\\",function(left,that){state.option.immed&&left&&!left.immed&&\\\"function\\\"===left.id&&warning(\\\"W062\\\");var n=0,p=[];if(left&&\\\"(identifier)\\\"===left.type&&left.value.match(/^[A-Z]([A-Z0-9_$]*[a-z][A-Za-z0-9_$]*)?$/)&&-1===\\\"Array Number String Boolean Date Object Error Symbol\\\".indexOf(left.value)&&(\\\"Math\\\"===left.value?warning(\\\"W063\\\",left):state.option.newcap&&warning(\\\"W064\\\",left)),\\\")\\\"!==state.tokens.next.id)for(;p[p.length]=expression(10),n+=1,\\\",\\\"===state.tokens.next.id;)comma();return advance(\\\")\\\"),\\\"object\\\"==typeof left&&(state.inES5()||\\\"parseInt\\\"!==left.value||1!==n||warning(\\\"W065\\\",state.tokens.curr),state.option.evil||(\\\"eval\\\"===left.value||\\\"Function\\\"===left.value||\\\"execScript\\\"===left.value?(warning(\\\"W061\\\",left),p[0]&&\\\"(string)\\\"===[0].id&&addInternalSrc(left,p[0].value)):!p[0]||\\\"(string)\\\"!==p[0].id||\\\"setTimeout\\\"!==left.value&&\\\"setInterval\\\"!==left.value?!p[0]||\\\"(string)\\\"!==p[0].id||\\\".\\\"!==left.value||\\\"window\\\"!==left.left.value||\\\"setTimeout\\\"!==left.right&&\\\"setInterval\\\"!==left.right||(warning(\\\"W066\\\",left),addInternalSrc(left,p[0].value)):(warning(\\\"W066\\\",left),addInternalSrc(left,p[0].value))),left.identifier||\\\".\\\"===left.id||\\\"[\\\"===left.id||\\\"=>\\\"===left.id||\\\"(\\\"===left.id||\\\"&&\\\"===left.id||\\\"||\\\"===left.id||\\\"?\\\"===left.id||state.inES6()&&left[\\\"(name)\\\"]||warning(\\\"W067\\\",that)),that.left=left,that},155,!0).exps=!0,prefix(\\\"(\\\",function(){var pn1,ret,triggerFnExpr,first,last,pn=state.tokens.next,i=-1,parens=1,opening=state.tokens.curr,preceeding=state.tokens.prev,isNecessary=!state.option.singleGroups;do\\\"(\\\"===pn.value?parens+=1:\\\")\\\"===pn.value&&(parens-=1),i+=1,pn1=pn,pn=peek(i);while((0!==parens||\\\")\\\"!==pn1.value)&&\\\";\\\"!==pn.value&&\\\"(end)\\\"!==pn.type);if(\\\"function\\\"===state.tokens.next.id&&(triggerFnExpr=state.tokens.next.immed=!0),\\\"=>\\\"===pn.value)return doFunction({type:\\\"arrow\\\",parsedOpening:!0});var exprs=[];if(\\\")\\\"!==state.tokens.next.id)for(;exprs.push(expression(10)),\\\",\\\"===state.tokens.next.id;)state.option.nocomma&&warning(\\\"W127\\\"),comma();return advance(\\\")\\\",this),state.option.immed&&exprs[0]&&\\\"function\\\"===exprs[0].id&&\\\"(\\\"!==state.tokens.next.id&&\\\".\\\"!==state.tokens.next.id&&\\\"[\\\"!==state.tokens.next.id&&warning(\\\"W068\\\",this),exprs.length?(exprs.length>1?(ret=Object.create(state.syntax[\\\",\\\"]),ret.exprs=exprs,first=exprs[0],last=exprs[exprs.length-1],isNecessary||(isNecessary=preceeding.assign||preceeding.delim)):(ret=first=last=exprs[0],isNecessary||(isNecessary=opening.beginsStmt&&(\\\"{\\\"===ret.id||triggerFnExpr||isFunctor(ret))||triggerFnExpr&&(!isEndOfExpr()||\\\"}\\\"!==state.tokens.prev.id)||isFunctor(ret)&&!isEndOfExpr()||\\\"{\\\"===ret.id&&\\\"=>\\\"===preceeding.id||\\\"(number)\\\"===ret.type&&checkPunctuator(pn,\\\".\\\")&&/^\\\\d+$/.test(ret.value))),ret&&(!isNecessary&&(first.left||first.right||ret.exprs)&&(isNecessary=!isBeginOfExpr(preceeding)&&first.lbp<=preceeding.lbp||!isEndOfExpr()&&last.lbp<state.tokens.next.lbp),isNecessary||warning(\\\"W126\\\",opening),ret.paren=!0),ret):void 0}),application(\\\"=>\\\"),infix(\\\"[\\\",function(left,that){var s,e=expression(10);return e&&\\\"(string)\\\"===e.type&&(state.option.evil||\\\"eval\\\"!==e.value&&\\\"execScript\\\"!==e.value||isGlobalEval(left,state)&&warning(\\\"W061\\\"),countMember(e.value),!state.option.sub&&reg.identifier.test(e.value)&&(s=state.syntax[e.value],s&&isReserved(s)||warning(\\\"W069\\\",state.tokens.prev,e.value))),advance(\\\"]\\\",that),e&&\\\"hasOwnProperty\\\"===e.value&&\\\"=\\\"===state.tokens.next.value&&warning(\\\"W001\\\"),that.left=left,that.right=e,that},160,!0),prefix(\\\"[\\\",function(){var blocktype=lookupBlockType();if(blocktype.isCompArray)return state.option.esnext||state.inMoz()||warning(\\\"W118\\\",state.tokens.curr,\\\"array comprehension\\\"),comprehensiveArrayExpression();if(blocktype.isDestAssign)return this.destructAssign=destructuringPattern({openingParsed:!0,assignment:!0}),this;var b=state.tokens.curr.line!==startLine(state.tokens.next);for(this.first=[],b&&(indent+=state.option.indent,state.tokens.next.from===indent+state.option.indent&&(indent+=state.option.indent));\\\"(end)\\\"!==state.tokens.next.id;){for(;\\\",\\\"===state.tokens.next.id;){if(!state.option.elision){if(state.inES5()){warning(\\\"W128\\\");do advance(\\\",\\\");while(\\\",\\\"===state.tokens.next.id);continue}warning(\\\"W070\\\")}advance(\\\",\\\")}if(\\\"]\\\"===state.tokens.next.id)break;if(this.first.push(expression(10)),\\\",\\\"!==state.tokens.next.id)break;if(comma({allowTrailing:!0}),\\\"]\\\"===state.tokens.next.id&&!state.inES5()){warning(\\\"W070\\\",state.tokens.curr);break}}return b&&(indent-=state.option.indent),advance(\\\"]\\\",this),this}),function(x){x.nud=function(){var b,f,i,p,t,nextVal,isGeneratorMethod=!1,props=Object.create(null);b=state.tokens.curr.line!==startLine(state.tokens.next),b&&(indent+=state.option.indent,state.tokens.next.from===indent+state.option.indent&&(indent+=state.option.indent));var blocktype=lookupBlockType();if(blocktype.isDestAssign)return this.destructAssign=destructuringPattern({openingParsed:!0,assignment:!0}),this;for(;\\\"}\\\"!==state.tokens.next.id;){if(nextVal=state.tokens.next.value,!state.tokens.next.identifier||\\\",\\\"!==peekIgnoreEOL().id&&\\\"}\\\"!==peekIgnoreEOL().id)if(\\\":\\\"===peek().id||\\\"get\\\"!==nextVal&&\\\"set\\\"!==nextVal){if(\\\"*\\\"===state.tokens.next.value&&\\\"(punctuator)\\\"===state.tokens.next.type?(state.inES6()||warning(\\\"W104\\\",state.tokens.next,\\\"generator functions\\\",\\\"6\\\"),advance(\\\"*\\\"),isGeneratorMethod=!0):isGeneratorMethod=!1,\\\"[\\\"===state.tokens.next.id)i=computedPropertyName(),state.nameStack.set(i);else if(state.nameStack.set(state.tokens.next),i=propertyName(),saveProperty(props,i,state.tokens.next),\\\"string\\\"!=typeof i)break;\\\"(\\\"===state.tokens.next.value?(state.inES6()||warning(\\\"W104\\\",state.tokens.curr,\\\"concise methods\\\",\\\"6\\\"),doFunction({type:isGeneratorMethod?\\\"generator\\\":null})):(advance(\\\":\\\"),expression(10))}else advance(nextVal),state.inES5()||error(\\\"E034\\\"),i=propertyName(),i||state.inES6()||error(\\\"E035\\\"),i&&saveAccessor(nextVal,props,i,state.tokens.curr),t=state.tokens.next,f=doFunction(),p=f[\\\"(params)\\\"],\\\"get\\\"===nextVal&&i&&p?warning(\\\"W076\\\",t,p[0],i):\\\"set\\\"!==nextVal||!i||p&&1===p.length||warning(\\\"W077\\\",t,i);else state.inES6()||warning(\\\"W104\\\",state.tokens.next,\\\"object short notation\\\",\\\"6\\\"),i=propertyName(!0),saveProperty(props,i,state.tokens.next),expression(10);if(countMember(i),\\\",\\\"!==state.tokens.next.id)break;comma({allowTrailing:!0,property:!0}),\\\",\\\"===state.tokens.next.id?warning(\\\"W070\\\",state.tokens.curr):\\\"}\\\"!==state.tokens.next.id||state.inES5()||warning(\\\"W070\\\",state.tokens.curr)}return b&&(indent-=state.option.indent),advance(\\\"}\\\",this),checkProperties(props),this},x.fud=function(){error(\\\"E036\\\",state.tokens.curr)}}(delim(\\\"{\\\"));var conststatement=stmt(\\\"const\\\",function(context){return blockVariableStatement(\\\"const\\\",this,context)});conststatement.exps=!0;var letstatement=stmt(\\\"let\\\",function(context){return blockVariableStatement(\\\"let\\\",this,context)});letstatement.exps=!0;var varstatement=stmt(\\\"var\\\",function(context){var tokens,lone,value,prefix=context&&context.prefix,inexport=context&&context.inexport,implied=context&&context.implied,report=!(context&&context.ignore);for(this.first=[];;){var names=[];_.contains([\\\"{\\\",\\\"[\\\"],state.tokens.next.value)?(tokens=destructuringPattern(),lone=!1):(tokens=[{id:identifier(),token:state.tokens.curr}],lone=!0),prefix&&implied||!report||!state.option.varstmt||warning(\\\"W132\\\",this),this.first=this.first.concat(names);for(var t in tokens)tokens.hasOwnProperty(t)&&(t=tokens[t],!implied&&state.funct[\\\"(global)\\\"]&&(predefined[t.id]===!1?warning(\\\"W079\\\",t.token,t.id):state.option.futurehostile===!1&&(!state.inES5()&&vars.ecmaIdentifiers[5][t.id]===!1||!state.inES6()&&vars.ecmaIdentifiers[6][t.id]===!1)&&warning(\\\"W129\\\",t.token,t.id)),t.id&&(\\\"for\\\"===implied?(state.funct[\\\"(scope)\\\"].has(t.id)||report&&warning(\\\"W088\\\",t.token,t.id),state.funct[\\\"(scope)\\\"].block.use(t.id,t.token)):(state.funct[\\\"(scope)\\\"].addlabel(t.id,{type:\\\"var\\\",token:t.token}),lone&&inexport&&state.funct[\\\"(scope)\\\"].setExported(t.id,t.token)),names.push(t.token)));if(\\\"=\\\"===state.tokens.next.id&&(state.nameStack.set(state.tokens.curr),advance(\\\"=\\\"),prefix||!report||state.funct[\\\"(loopage)\\\"]||\\\"undefined\\\"!==state.tokens.next.id||warning(\\\"W080\\\",state.tokens.prev,state.tokens.prev.value),\\\"=\\\"===peek(0).id&&state.tokens.next.identifier&&(!prefix&&report&&!state.funct[\\\"(params)\\\"]||-1===state.funct[\\\"(params)\\\"].indexOf(state.tokens.next.value))&&warning(\\\"W120\\\",state.tokens.next,state.tokens.next.value),value=expression(prefix?120:10),lone?tokens[0].first=value:destructuringPatternMatch(names,value)),\\\",\\\"!==state.tokens.next.id)break;comma()}return this});varstatement.exps=!0,blockstmt(\\\"class\\\",function(){return classdef.call(this,!0)}),blockstmt(\\\"function\\\",function(context){var inexport=context&&context.inexport,generator=!1;\\\"*\\\"===state.tokens.next.value&&(advance(\\\"*\\\"),state.inES6({strict:!0})?generator=!0:warning(\\\"W119\\\",state.tokens.curr,\\\"function*\\\",\\\"6\\\")),inblock&&warning(\\\"W082\\\",state.tokens.curr);var i=optionalidentifier();return state.funct[\\\"(scope)\\\"].addlabel(i,{type:\\\"function\\\",token:state.tokens.curr}),void 0===i?warning(\\\"W025\\\"):inexport&&state.funct[\\\"(scope)\\\"].setExported(i,state.tokens.prev),doFunction({name:i,statement:this,type:generator?\\\"generator\\\":null,ignoreLoopFunc:inblock}),\\\"(\\\"===state.tokens.next.id&&state.tokens.next.line===state.tokens.curr.line&&error(\\\"E039\\\"),this}),prefix(\\\"function\\\",function(){var generator=!1;\\\"*\\\"===state.tokens.next.value&&(state.inES6()||warning(\\\"W119\\\",state.tokens.curr,\\\"function*\\\",\\\"6\\\"),advance(\\\"*\\\"),generator=!0);var i=optionalidentifier();return doFunction({name:i,type:generator?\\\"generator\\\":null}),this}),blockstmt(\\\"if\\\",function(){var t=state.tokens.next;increaseComplexityCount(),state.condition=!0,advance(\\\"(\\\");var expr=expression(0);checkCondAssignment(expr);var forinifcheck=null;state.option.forin&&state.forinifcheckneeded&&(state.forinifcheckneeded=!1,forinifcheck=state.forinifchecks[state.forinifchecks.length-1],forinifcheck.type=\\\"(punctuator)\\\"===expr.type&&\\\"!\\\"===expr.value?\\\"(negative)\\\":\\\"(positive)\\\"),advance(\\\")\\\",t),state.condition=!1;var s=block(!0,!0);return forinifcheck&&\\\"(negative)\\\"===forinifcheck.type&&s&&s[0]&&\\\"(identifier)\\\"===s[0].type&&\\\"continue\\\"===s[0].value&&(forinifcheck.type=\\\"(negative-with-continue)\\\"),\\\"else\\\"===state.tokens.next.id&&(advance(\\\"else\\\"),\\\"if\\\"===state.tokens.next.id||\\\"switch\\\"===state.tokens.next.id?statement():block(!0,!0)),this}),blockstmt(\\\"try\\\",function(){function doCatch(){if(advance(\\\"catch\\\"),advance(\\\"(\\\"),state.funct[\\\"(scope)\\\"].stack(\\\"catchparams\\\"),checkPunctuators(state.tokens.next,[\\\"[\\\",\\\"{\\\"])){var tokens=destructuringPattern();_.each(tokens,function(token){token.id&&state.funct[\\\"(scope)\\\"].addParam(token.id,token,\\\"exception\\\")})}else\\\"(identifier)\\\"!==state.tokens.next.type?warning(\\\"E030\\\",state.tokens.next,state.tokens.next.value):state.funct[\\\"(scope)\\\"].addParam(identifier(),state.tokens.curr,\\\"exception\\\");\\\"if\\\"===state.tokens.next.value&&(state.inMoz()||warning(\\\"W118\\\",state.tokens.curr,\\\"catch filter\\\"),advance(\\\"if\\\"),expression(0)),advance(\\\")\\\"),block(!1),state.funct[\\\"(scope)\\\"].unstack()}var b;for(block(!0);\\\"catch\\\"===state.tokens.next.id;)increaseComplexityCount(),b&&!state.inMoz()&&warning(\\\"W118\\\",state.tokens.next,\\\"multiple catch blocks\\\"),doCatch(),b=!0;return\\\"finally\\\"===state.tokens.next.id?(advance(\\\"finally\\\"),block(!0),void 0):(b||error(\\\"E021\\\",state.tokens.next,\\\"catch\\\",state.tokens.next.value),this)}),blockstmt(\\\"while\\\",function(){var t=state.tokens.next;return state.funct[\\\"(breakage)\\\"]+=1,state.funct[\\\"(loopage)\\\"]+=1,increaseComplexityCount(),advance(\\\"(\\\"),checkCondAssignment(expression(0)),advance(\\\")\\\",t),block(!0,!0),state.funct[\\\"(breakage)\\\"]-=1,state.funct[\\\"(loopage)\\\"]-=1,this}).labelled=!0,blockstmt(\\\"with\\\",function(){var t=state.tokens.next;return state.isStrict()?error(\\\"E010\\\",state.tokens.curr):state.option.withstmt||warning(\\\"W085\\\",state.tokens.curr),advance(\\\"(\\\"),expression(0),advance(\\\")\\\",t),block(!0,!0),this}),blockstmt(\\\"switch\\\",function(){var t=state.tokens.next,g=!1,noindent=!1;\\nfor(state.funct[\\\"(breakage)\\\"]+=1,advance(\\\"(\\\"),checkCondAssignment(expression(0)),advance(\\\")\\\",t),t=state.tokens.next,advance(\\\"{\\\"),state.tokens.next.from===indent&&(noindent=!0),noindent||(indent+=state.option.indent),this.cases=[];;)switch(state.tokens.next.id){case\\\"case\\\":switch(state.funct[\\\"(verb)\\\"]){case\\\"yield\\\":case\\\"break\\\":case\\\"case\\\":case\\\"continue\\\":case\\\"return\\\":case\\\"switch\\\":case\\\"throw\\\":break;default:state.tokens.curr.caseFallsThrough||warning(\\\"W086\\\",state.tokens.curr,\\\"case\\\")}advance(\\\"case\\\"),this.cases.push(expression(0)),increaseComplexityCount(),g=!0,advance(\\\":\\\"),state.funct[\\\"(verb)\\\"]=\\\"case\\\";break;case\\\"default\\\":switch(state.funct[\\\"(verb)\\\"]){case\\\"yield\\\":case\\\"break\\\":case\\\"continue\\\":case\\\"return\\\":case\\\"throw\\\":break;default:this.cases.length&&(state.tokens.curr.caseFallsThrough||warning(\\\"W086\\\",state.tokens.curr,\\\"default\\\"))}advance(\\\"default\\\"),g=!0,advance(\\\":\\\");break;case\\\"}\\\":return noindent||(indent-=state.option.indent),advance(\\\"}\\\",t),state.funct[\\\"(breakage)\\\"]-=1,state.funct[\\\"(verb)\\\"]=void 0,void 0;case\\\"(end)\\\":return error(\\\"E023\\\",state.tokens.next,\\\"}\\\"),void 0;default:if(indent+=state.option.indent,g)switch(state.tokens.curr.id){case\\\",\\\":return error(\\\"E040\\\"),void 0;case\\\":\\\":g=!1,statements();break;default:return error(\\\"E025\\\",state.tokens.curr),void 0}else{if(\\\":\\\"!==state.tokens.curr.id)return error(\\\"E021\\\",state.tokens.next,\\\"case\\\",state.tokens.next.value),void 0;advance(\\\":\\\"),error(\\\"E024\\\",state.tokens.curr,\\\":\\\"),statements()}indent-=state.option.indent}return this}).labelled=!0,stmt(\\\"debugger\\\",function(){return state.option.debug||warning(\\\"W087\\\",this),this}).exps=!0,function(){var x=stmt(\\\"do\\\",function(){state.funct[\\\"(breakage)\\\"]+=1,state.funct[\\\"(loopage)\\\"]+=1,increaseComplexityCount(),this.first=block(!0,!0),advance(\\\"while\\\");var t=state.tokens.next;return advance(\\\"(\\\"),checkCondAssignment(expression(0)),advance(\\\")\\\",t),state.funct[\\\"(breakage)\\\"]-=1,state.funct[\\\"(loopage)\\\"]-=1,this});x.labelled=!0,x.exps=!0}(),blockstmt(\\\"for\\\",function(){var s,t=state.tokens.next,letscope=!1,foreachtok=null;\\\"each\\\"===t.value&&(foreachtok=t,advance(\\\"each\\\"),state.inMoz()||warning(\\\"W118\\\",state.tokens.curr,\\\"for each\\\")),increaseComplexityCount(),advance(\\\"(\\\");var nextop,comma,initializer,i=0,inof=[\\\"in\\\",\\\"of\\\"],level=0;checkPunctuators(state.tokens.next,[\\\"{\\\",\\\"[\\\"])&&++level;do{if(nextop=peek(i),++i,checkPunctuators(nextop,[\\\"{\\\",\\\"[\\\"])?++level:checkPunctuators(nextop,[\\\"}\\\",\\\"]\\\"])&&--level,0>level)break;0===level&&(!comma&&checkPunctuator(nextop,\\\",\\\")?comma=nextop:!initializer&&checkPunctuator(nextop,\\\"=\\\")&&(initializer=nextop))}while(level>0||!_.contains(inof,nextop.value)&&\\\";\\\"!==nextop.value&&\\\"(end)\\\"!==nextop.type);if(_.contains(inof,nextop.value)){state.inES6()||\\\"of\\\"!==nextop.value||warning(\\\"W104\\\",nextop,\\\"for of\\\",\\\"6\\\");var ok=!(initializer||comma);if(initializer&&error(\\\"W133\\\",comma,nextop.value,\\\"initializer is forbidden\\\"),comma&&error(\\\"W133\\\",comma,nextop.value,\\\"more than one ForBinding\\\"),\\\"var\\\"===state.tokens.next.id?(advance(\\\"var\\\"),state.tokens.curr.fud({prefix:!0})):\\\"let\\\"===state.tokens.next.id||\\\"const\\\"===state.tokens.next.id?(advance(state.tokens.next.id),letscope=!0,state.funct[\\\"(scope)\\\"].stack(),state.tokens.curr.fud({prefix:!0})):Object.create(varstatement).fud({prefix:!0,implied:\\\"for\\\",ignore:!ok}),advance(nextop.value),expression(20),advance(\\\")\\\",t),\\\"in\\\"===nextop.value&&state.option.forin&&(state.forinifcheckneeded=!0,void 0===state.forinifchecks&&(state.forinifchecks=[]),state.forinifchecks.push({type:\\\"(none)\\\"})),state.funct[\\\"(breakage)\\\"]+=1,state.funct[\\\"(loopage)\\\"]+=1,s=block(!0,!0),\\\"in\\\"===nextop.value&&state.option.forin){if(state.forinifchecks&&state.forinifchecks.length>0){var check=state.forinifchecks.pop();(s&&s.length>0&&(\\\"object\\\"!=typeof s[0]||\\\"if\\\"!==s[0].value)||\\\"(positive)\\\"===check.type&&s.length>1||\\\"(negative)\\\"===check.type)&&warning(\\\"W089\\\",this)}state.forinifcheckneeded=!1}state.funct[\\\"(breakage)\\\"]-=1,state.funct[\\\"(loopage)\\\"]-=1}else{if(foreachtok&&error(\\\"E045\\\",foreachtok),\\\";\\\"!==state.tokens.next.id)if(\\\"var\\\"===state.tokens.next.id)advance(\\\"var\\\"),state.tokens.curr.fud();else if(\\\"let\\\"===state.tokens.next.id)advance(\\\"let\\\"),letscope=!0,state.funct[\\\"(scope)\\\"].stack(),state.tokens.curr.fud();else for(;expression(0,\\\"for\\\"),\\\",\\\"===state.tokens.next.id;)comma();if(nolinebreak(state.tokens.curr),advance(\\\";\\\"),state.funct[\\\"(loopage)\\\"]+=1,\\\";\\\"!==state.tokens.next.id&&checkCondAssignment(expression(0)),nolinebreak(state.tokens.curr),advance(\\\";\\\"),\\\";\\\"===state.tokens.next.id&&error(\\\"E021\\\",state.tokens.next,\\\")\\\",\\\";\\\"),\\\")\\\"!==state.tokens.next.id)for(;expression(0,\\\"for\\\"),\\\",\\\"===state.tokens.next.id;)comma();advance(\\\")\\\",t),state.funct[\\\"(breakage)\\\"]+=1,block(!0,!0),state.funct[\\\"(breakage)\\\"]-=1,state.funct[\\\"(loopage)\\\"]-=1}return letscope&&state.funct[\\\"(scope)\\\"].unstack(),this}).labelled=!0,stmt(\\\"break\\\",function(){var v=state.tokens.next.value;return state.option.asi||nolinebreak(this),\\\";\\\"===state.tokens.next.id||state.tokens.next.reach||state.tokens.curr.line!==startLine(state.tokens.next)?0===state.funct[\\\"(breakage)\\\"]&&warning(\\\"W052\\\",state.tokens.next,this.value):(state.funct[\\\"(scope)\\\"].funct.hasBreakLabel(v)||warning(\\\"W090\\\",state.tokens.next,v),this.first=state.tokens.next,advance()),reachable(this),this}).exps=!0,stmt(\\\"continue\\\",function(){var v=state.tokens.next.value;return 0===state.funct[\\\"(breakage)\\\"]&&warning(\\\"W052\\\",state.tokens.next,this.value),state.funct[\\\"(loopage)\\\"]||warning(\\\"W052\\\",state.tokens.next,this.value),state.option.asi||nolinebreak(this),\\\";\\\"===state.tokens.next.id||state.tokens.next.reach||state.tokens.curr.line===startLine(state.tokens.next)&&(state.funct[\\\"(scope)\\\"].funct.hasBreakLabel(v)||warning(\\\"W090\\\",state.tokens.next,v),this.first=state.tokens.next,advance()),reachable(this),this}).exps=!0,stmt(\\\"return\\\",function(){return this.line===startLine(state.tokens.next)?\\\";\\\"===state.tokens.next.id||state.tokens.next.reach||(this.first=expression(0),!this.first||\\\"(punctuator)\\\"!==this.first.type||\\\"=\\\"!==this.first.value||this.first.paren||state.option.boss||warningAt(\\\"W093\\\",this.first.line,this.first.character)):\\\"(punctuator)\\\"===state.tokens.next.type&&[\\\"[\\\",\\\"{\\\",\\\"+\\\",\\\"-\\\"].indexOf(state.tokens.next.value)>-1&&nolinebreak(this),reachable(this),this}).exps=!0,function(x){x.exps=!0,x.lbp=25}(prefix(\\\"yield\\\",function(){var prev=state.tokens.prev;state.inES6(!0)&&!state.funct[\\\"(generator)\\\"]?\\\"(catch)\\\"===state.funct[\\\"(name)\\\"]&&state.funct[\\\"(context)\\\"][\\\"(generator)\\\"]||error(\\\"E046\\\",state.tokens.curr,\\\"yield\\\"):state.inES6()||warning(\\\"W104\\\",state.tokens.curr,\\\"yield\\\",\\\"6\\\"),state.funct[\\\"(generator)\\\"]=\\\"yielded\\\";var delegatingYield=!1;return\\\"*\\\"===state.tokens.next.value&&(delegatingYield=!0,advance(\\\"*\\\")),this.line!==startLine(state.tokens.next)&&state.inMoz()?state.option.asi||nolinebreak(this):((delegatingYield||\\\";\\\"!==state.tokens.next.id&&!state.option.asi&&!state.tokens.next.reach&&state.tokens.next.nud)&&(nobreaknonadjacent(state.tokens.curr,state.tokens.next),this.first=expression(10),\\\"(punctuator)\\\"!==this.first.type||\\\"=\\\"!==this.first.value||this.first.paren||state.option.boss||warningAt(\\\"W093\\\",this.first.line,this.first.character)),state.inMoz()&&\\\")\\\"!==state.tokens.next.id&&(prev.lbp>30||!prev.assign&&!isEndOfExpr()||\\\"yield\\\"===prev.id)&&error(\\\"E050\\\",this)),this})),stmt(\\\"throw\\\",function(){return nolinebreak(this),this.first=expression(20),reachable(this),this}).exps=!0,stmt(\\\"import\\\",function(){if(state.inES6()||warning(\\\"W119\\\",state.tokens.curr,\\\"import\\\",\\\"6\\\"),\\\"(string)\\\"===state.tokens.next.type)return advance(\\\"(string)\\\"),this;if(state.tokens.next.identifier){if(this.name=identifier(),state.funct[\\\"(scope)\\\"].addlabel(this.name,{type:\\\"const\\\",token:state.tokens.curr}),\\\",\\\"!==state.tokens.next.value)return advance(\\\"from\\\"),advance(\\\"(string)\\\"),this;advance(\\\",\\\")}if(\\\"*\\\"===state.tokens.next.id)advance(\\\"*\\\"),advance(\\\"as\\\"),state.tokens.next.identifier&&(this.name=identifier(),state.funct[\\\"(scope)\\\"].addlabel(this.name,{type:\\\"const\\\",token:state.tokens.curr}));else for(advance(\\\"{\\\");;){if(\\\"}\\\"===state.tokens.next.value){advance(\\\"}\\\");break}var importName;if(\\\"default\\\"===state.tokens.next.type?(importName=\\\"default\\\",advance(\\\"default\\\")):importName=identifier(),\\\"as\\\"===state.tokens.next.value&&(advance(\\\"as\\\"),importName=identifier()),state.funct[\\\"(scope)\\\"].addlabel(importName,{type:\\\"const\\\",token:state.tokens.curr}),\\\",\\\"!==state.tokens.next.value){if(\\\"}\\\"===state.tokens.next.value){advance(\\\"}\\\");break}error(\\\"E024\\\",state.tokens.next,state.tokens.next.value);break}advance(\\\",\\\")}return advance(\\\"from\\\"),advance(\\\"(string)\\\"),this}).exps=!0,stmt(\\\"export\\\",function(){var token,identifier,ok=!0;if(state.inES6()||(warning(\\\"W119\\\",state.tokens.curr,\\\"export\\\",\\\"6\\\"),ok=!1),state.funct[\\\"(scope)\\\"].block.isGlobal()||(error(\\\"E053\\\",state.tokens.curr),ok=!1),\\\"*\\\"===state.tokens.next.value)return advance(\\\"*\\\"),advance(\\\"from\\\"),advance(\\\"(string)\\\"),this;if(\\\"default\\\"===state.tokens.next.type){state.nameStack.set(state.tokens.next),advance(\\\"default\\\");var exportType=state.tokens.next.id;return(\\\"function\\\"===exportType||\\\"class\\\"===exportType)&&(this.block=!0),token=peek(),expression(10),identifier=token.value,this.block&&(state.funct[\\\"(scope)\\\"].addlabel(identifier,{type:exportType,token:token}),state.funct[\\\"(scope)\\\"].setExported(identifier,token)),this}if(\\\"{\\\"===state.tokens.next.value){advance(\\\"{\\\");for(var exportedTokens=[];;){if(state.tokens.next.identifier||error(\\\"E030\\\",state.tokens.next,state.tokens.next.value),advance(),exportedTokens.push(state.tokens.curr),\\\"as\\\"===state.tokens.next.value&&(advance(\\\"as\\\"),state.tokens.next.identifier||error(\\\"E030\\\",state.tokens.next,state.tokens.next.value),advance()),\\\",\\\"!==state.tokens.next.value){if(\\\"}\\\"===state.tokens.next.value){advance(\\\"}\\\");break}error(\\\"E024\\\",state.tokens.next,state.tokens.next.value);break}advance(\\\",\\\")}return\\\"from\\\"===state.tokens.next.value?(advance(\\\"from\\\"),advance(\\\"(string)\\\")):ok&&exportedTokens.forEach(function(token){state.funct[\\\"(scope)\\\"].setExported(token.value,token)}),this}if(\\\"var\\\"===state.tokens.next.id)advance(\\\"var\\\"),state.tokens.curr.fud({inexport:!0});else if(\\\"let\\\"===state.tokens.next.id)advance(\\\"let\\\"),state.tokens.curr.fud({inexport:!0});else if(\\\"const\\\"===state.tokens.next.id)advance(\\\"const\\\"),state.tokens.curr.fud({inexport:!0});else if(\\\"function\\\"===state.tokens.next.id)this.block=!0,advance(\\\"function\\\"),state.syntax[\\\"function\\\"].fud({inexport:!0});else if(\\\"class\\\"===state.tokens.next.id){this.block=!0,advance(\\\"class\\\");var classNameToken=state.tokens.next;state.syntax[\\\"class\\\"].fud(),state.funct[\\\"(scope)\\\"].setExported(classNameToken.value,classNameToken)}else error(\\\"E024\\\",state.tokens.next,state.tokens.next.value);return this}).exps=!0,FutureReservedWord(\\\"abstract\\\"),FutureReservedWord(\\\"boolean\\\"),FutureReservedWord(\\\"byte\\\"),FutureReservedWord(\\\"char\\\"),FutureReservedWord(\\\"class\\\",{es5:!0,nud:classdef}),FutureReservedWord(\\\"double\\\"),FutureReservedWord(\\\"enum\\\",{es5:!0}),FutureReservedWord(\\\"export\\\",{es5:!0}),FutureReservedWord(\\\"extends\\\",{es5:!0}),FutureReservedWord(\\\"final\\\"),FutureReservedWord(\\\"float\\\"),FutureReservedWord(\\\"goto\\\"),FutureReservedWord(\\\"implements\\\",{es5:!0,strictOnly:!0}),FutureReservedWord(\\\"import\\\",{es5:!0}),FutureReservedWord(\\\"int\\\"),FutureReservedWord(\\\"interface\\\",{es5:!0,strictOnly:!0}),FutureReservedWord(\\\"long\\\"),FutureReservedWord(\\\"native\\\"),FutureReservedWord(\\\"package\\\",{es5:!0,strictOnly:!0}),FutureReservedWord(\\\"private\\\",{es5:!0,strictOnly:!0}),FutureReservedWord(\\\"protected\\\",{es5:!0,strictOnly:!0}),FutureReservedWord(\\\"public\\\",{es5:!0,strictOnly:!0}),FutureReservedWord(\\\"short\\\"),FutureReservedWord(\\\"static\\\",{es5:!0,strictOnly:!0}),FutureReservedWord(\\\"super\\\",{es5:!0}),FutureReservedWord(\\\"synchronized\\\"),FutureReservedWord(\\\"transient\\\"),FutureReservedWord(\\\"volatile\\\");var lookupBlockType=function(){var pn,pn1,prev,i=-1,bracketStack=0,ret={};checkPunctuators(state.tokens.curr,[\\\"[\\\",\\\"{\\\"])&&(bracketStack+=1);do{if(prev=-1===i?state.tokens.curr:pn,pn=-1===i?state.tokens.next:peek(i),pn1=peek(i+1),i+=1,checkPunctuators(pn,[\\\"[\\\",\\\"{\\\"])?bracketStack+=1:checkPunctuators(pn,[\\\"]\\\",\\\"}\\\"])&&(bracketStack-=1),1===bracketStack&&pn.identifier&&\\\"for\\\"===pn.value&&!checkPunctuator(prev,\\\".\\\")){ret.isCompArray=!0,ret.notJson=!0;break}if(0===bracketStack&&checkPunctuators(pn,[\\\"}\\\",\\\"]\\\"])){if(\\\"=\\\"===pn1.value){ret.isDestAssign=!0,ret.notJson=!0;break}if(\\\".\\\"===pn1.value){ret.notJson=!0;break}}checkPunctuator(pn,\\\";\\\")&&(ret.isBlock=!0,ret.notJson=!0)}while(bracketStack>0&&\\\"(end)\\\"!==pn.id);return ret},arrayComprehension=function(){function declare(v){var l=_current.variables.filter(function(elt){return elt.value===v?(elt.undef=!1,v):void 0}).length;return 0!==l}function use(v){var l=_current.variables.filter(function(elt){return elt.value!==v||elt.undef?void 0:(elt.unused===!0&&(elt.unused=!1),v)}).length;return 0===l}var _current,CompArray=function(){this.mode=\\\"use\\\",this.variables=[]},_carrays=[];return{stack:function(){_current=new CompArray,_carrays.push(_current)},unstack:function(){_current.variables.filter(function(v){v.unused&&warning(\\\"W098\\\",v.token,v.raw_text||v.value),v.undef&&state.funct[\\\"(scope)\\\"].block.use(v.value,v.token)}),_carrays.splice(-1,1),_current=_carrays[_carrays.length-1]},setState:function(s){_.contains([\\\"use\\\",\\\"define\\\",\\\"generate\\\",\\\"filter\\\"],s)&&(_current.mode=s)},check:function(v){return _current?_current&&\\\"use\\\"===_current.mode?(use(v)&&_current.variables.push({funct:state.funct,token:state.tokens.curr,value:v,undef:!0,unused:!1}),!0):_current&&\\\"define\\\"===_current.mode?(declare(v)||_current.variables.push({funct:state.funct,token:state.tokens.curr,value:v,undef:!1,unused:!0}),!0):_current&&\\\"generate\\\"===_current.mode?(state.funct[\\\"(scope)\\\"].block.use(v,state.tokens.curr),!0):_current&&\\\"filter\\\"===_current.mode?(use(v)&&state.funct[\\\"(scope)\\\"].block.use(v,state.tokens.curr),!0):!1:void 0}}},escapeRegex=function(str){return str.replace(/[-\\\\/\\\\\\\\^$*+?.()|[\\\\]{}]/g,\\\"\\\\\\\\$&\\\")},itself=function(s,o,g){function each(obj,cb){obj&&(Array.isArray(obj)||\\\"object\\\"!=typeof obj||(obj=Object.keys(obj)),obj.forEach(cb))}var i,k,x,reIgnoreStr,reIgnore,optionKeys,newOptionObj={},newIgnoredObj={};o=_.clone(o),state.reset(),o&&o.scope?JSHINT.scope=o.scope:(JSHINT.errors=[],JSHINT.undefs=[],JSHINT.internals=[],JSHINT.blacklist={},JSHINT.scope=\\\"(main)\\\"),predefined=Object.create(null),combine(predefined,vars.ecmaIdentifiers[3]),combine(predefined,vars.reservedVars),combine(predefined,g||{}),declared=Object.create(null);var exported=Object.create(null);if(o)for(each(o.predef||null,function(item){var slice,prop;\\\"-\\\"===item[0]?(slice=item.slice(1),JSHINT.blacklist[slice]=slice,delete predefined[slice]):(prop=Object.getOwnPropertyDescriptor(o.predef,item),predefined[item]=prop?prop.value:!1)}),each(o.exported||null,function(item){exported[item]=!0}),delete o.predef,delete o.exported,optionKeys=Object.keys(o),x=0;optionKeys.length>x;x++)if(/^-W\\\\d{3}$/g.test(optionKeys[x]))newIgnoredObj[optionKeys[x].slice(1)]=!0;else{var optionKey=optionKeys[x];newOptionObj[optionKey]=o[optionKey],(\\\"esversion\\\"===optionKey&&5===o[optionKey]||\\\"es5\\\"===optionKey&&o[optionKey])&&warning(\\\"I003\\\"),\\\"newcap\\\"===optionKeys[x]&&o[optionKey]===!1&&(newOptionObj[\\\"(explicitNewcap)\\\"]=!0)}state.option=newOptionObj,state.ignored=newIgnoredObj,state.option.indent=state.option.indent||4,state.option.maxerr=state.option.maxerr||50,indent=1;var scopeManagerInst=scopeManager(state,predefined,exported,declared);if(scopeManagerInst.on(\\\"warning\\\",function(ev){warning.apply(null,[ev.code,ev.token].concat(ev.data))}),scopeManagerInst.on(\\\"error\\\",function(ev){error.apply(null,[ev.code,ev.token].concat(ev.data))}),state.funct=functor(\\\"(global)\\\",null,{\\\"(global)\\\":!0,\\\"(scope)\\\":scopeManagerInst,\\\"(comparray)\\\":arrayComprehension(),\\\"(metrics)\\\":createMetrics(state.tokens.next)}),functions=[state.funct],urls=[],stack=null,member={},membersOnly=null,inblock=!1,lookahead=[],!isString(s)&&!Array.isArray(s))return errorAt(\\\"E004\\\",0),!1;api={get isJSON(){return state.jsonMode},getOption:function(name){return state.option[name]||null},getCache:function(name){return state.cache[name]},setCache:function(name,value){state.cache[name]=value},warn:function(code,data){warningAt.apply(null,[code,data.line,data.char].concat(data.data))},on:function(names,listener){names.split(\\\" \\\").forEach(function(name){emitter.on(name,listener)}.bind(this))}},emitter.removeAllListeners(),(extraModules||[]).forEach(function(func){func(api)}),state.tokens.prev=state.tokens.curr=state.tokens.next=state.syntax[\\\"(begin)\\\"],o&&o.ignoreDelimiters&&(Array.isArray(o.ignoreDelimiters)||(o.ignoreDelimiters=[o.ignoreDelimiters]),o.ignoreDelimiters.forEach(function(delimiterPair){delimiterPair.start&&delimiterPair.end&&(reIgnoreStr=escapeRegex(delimiterPair.start)+\\\"[\\\\\\\\s\\\\\\\\S]*?\\\"+escapeRegex(delimiterPair.end),reIgnore=RegExp(reIgnoreStr,\\\"ig\\\"),s=s.replace(reIgnore,function(match){return match.replace(/./g,\\\" \\\")}))})),lex=new Lexer(s),lex.on(\\\"warning\\\",function(ev){warningAt.apply(null,[ev.code,ev.line,ev.character].concat(ev.data))}),lex.on(\\\"error\\\",function(ev){errorAt.apply(null,[ev.code,ev.line,ev.character].concat(ev.data))}),lex.on(\\\"fatal\\\",function(ev){quit(\\\"E041\\\",ev.line,ev.from)}),lex.on(\\\"Identifier\\\",function(ev){emitter.emit(\\\"Identifier\\\",ev)}),lex.on(\\\"String\\\",function(ev){emitter.emit(\\\"String\\\",ev)}),lex.on(\\\"Number\\\",function(ev){emitter.emit(\\\"Number\\\",ev)}),lex.start();for(var name in o)_.has(o,name)&&checkOption(name,state.tokens.curr);assume(),combine(predefined,g||{}),comma.first=!0;try{switch(advance(),state.tokens.next.id){case\\\"{\\\":case\\\"[\\\":destructuringAssignOrJsonValue();break;default:directives(),state.directive[\\\"use strict\\\"]&&\\\"global\\\"!==state.option.strict&&warning(\\\"W097\\\",state.tokens.prev),statements()}\\\"(end)\\\"!==state.tokens.next.id&&quit(\\\"E041\\\",state.tokens.curr.line),state.funct[\\\"(scope)\\\"].unstack()}catch(err){if(!err||\\\"JSHintError\\\"!==err.name)throw err;var nt=state.tokens.next||{};JSHINT.errors.push({scope:\\\"(main)\\\",raw:err.raw,code:err.code,reason:err.message,line:err.line||nt.line,character:err.character||nt.from},null)}if(\\\"(main)\\\"===JSHINT.scope)for(o=o||{},i=0;JSHINT.internals.length>i;i+=1)k=JSHINT.internals[i],o.scope=k.elem,itself(k.value,o,g);return 0===JSHINT.errors.length};return itself.addModule=function(func){extraModules.push(func)},itself.addModule(style.register),itself.data=function(){var fu,f,i,j,n,globals,data={functions:[],options:state.option};itself.errors.length&&(data.errors=itself.errors),state.jsonMode&&(data.json=!0);var impliedGlobals=state.funct[\\\"(scope)\\\"].getImpliedGlobals();for(impliedGlobals.length>0&&(data.implieds=impliedGlobals),urls.length>0&&(data.urls=urls),globals=state.funct[\\\"(scope)\\\"].getUsedOrDefinedGlobals(),globals.length>0&&(data.globals=globals),i=1;functions.length>i;i+=1){for(f=functions[i],fu={},j=0;functionicity.length>j;j+=1)fu[functionicity[j]]=[];for(j=0;functionicity.length>j;j+=1)0===fu[functionicity[j]].length&&delete fu[functionicity[j]];fu.name=f[\\\"(name)\\\"],fu.param=f[\\\"(params)\\\"],fu.line=f[\\\"(line)\\\"],fu.character=f[\\\"(character)\\\"],fu.last=f[\\\"(last)\\\"],fu.lastcharacter=f[\\\"(lastcharacter)\\\"],fu.metrics={complexity:f[\\\"(metrics)\\\"].ComplexityCount,parameters:f[\\\"(metrics)\\\"].arity,statements:f[\\\"(metrics)\\\"].statementCount},data.functions.push(fu)}var unuseds=state.funct[\\\"(scope)\\\"].getUnuseds();unuseds.length>0&&(data.unused=unuseds);for(n in member)if(\\\"number\\\"==typeof member[n]){data.member=member;break}return data},itself.jshint=itself,itself}();\\\"object\\\"==typeof exports&&exports&&(exports.JSHINT=JSHINT)},{\\\"../lodash\\\":\\\"/node_modules/jshint/lodash.js\\\",\\\"./lex.js\\\":\\\"/node_modules/jshint/src/lex.js\\\",\\\"./messages.js\\\":\\\"/node_modules/jshint/src/messages.js\\\",\\\"./options.js\\\":\\\"/node_modules/jshint/src/options.js\\\",\\\"./reg.js\\\":\\\"/node_modules/jshint/src/reg.js\\\",\\\"./scope-manager.js\\\":\\\"/node_modules/jshint/src/scope-manager.js\\\",\\\"./state.js\\\":\\\"/node_modules/jshint/src/state.js\\\",\\\"./style.js\\\":\\\"/node_modules/jshint/src/style.js\\\",\\\"./vars.js\\\":\\\"/node_modules/jshint/src/vars.js\\\",events:\\\"/node_modules/browserify/node_modules/events/events.js\\\"}],\\\"/node_modules/jshint/src/lex.js\\\":[function(_dereq_,module,exports){\\\"use strict\\\";function asyncTrigger(){var _checks=[];return{push:function(fn){_checks.push(fn)},check:function(){for(var check=0;_checks.length>check;++check)_checks[check]();_checks.splice(0,_checks.length)}}}function Lexer(source){var lines=source;\\\"string\\\"==typeof lines&&(lines=lines.replace(/\\\\r\\\\n/g,\\\"\\\\n\\\").replace(/\\\\r/g,\\\"\\\\n\\\").split(\\\"\\\\n\\\")),lines[0]&&\\\"#!\\\"===lines[0].substr(0,2)&&(-1!==lines[0].indexOf(\\\"node\\\")&&(state.option.node=!0),lines[0]=\\\"\\\"),this.emitter=new events.EventEmitter,this.source=source,this.setLines(lines),this.prereg=!0,this.line=0,this.char=1,this.from=1,this.input=\\\"\\\",this.inComment=!1,this.context=[],this.templateStarts=[];for(var i=0;state.option.indent>i;i+=1)state.tab+=\\\" \\\";this.ignoreLinterErrors=!1}var _=_dereq_(\\\"../lodash\\\"),events=_dereq_(\\\"events\\\"),reg=_dereq_(\\\"./reg.js\\\"),state=_dereq_(\\\"./state.js\\\").state,unicodeData=_dereq_(\\\"../data/ascii-identifier-data.js\\\"),asciiIdentifierStartTable=unicodeData.asciiIdentifierStartTable,asciiIdentifierPartTable=unicodeData.asciiIdentifierPartTable,Token={Identifier:1,Punctuator:2,NumericLiteral:3,StringLiteral:4,Comment:5,Keyword:6,NullLiteral:7,BooleanLiteral:8,RegExp:9,TemplateHead:10,TemplateMiddle:11,TemplateTail:12,NoSubstTemplate:13},Context={Block:1,Template:2};Lexer.prototype={_lines:[],inContext:function(ctxType){return this.context.length>0&&this.context[this.context.length-1].type===ctxType},pushContext:function(ctxType){this.context.push({type:ctxType})},popContext:function(){return this.context.pop()},isContext:function(context){return this.context.length>0&&this.context[this.context.length-1]===context},currentContext:function(){return this.context.length>0&&this.context[this.context.length-1]},getLines:function(){return this._lines=state.lines,this._lines},setLines:function(val){this._lines=val,state.lines=this._lines},peek:function(i){return this.input.charAt(i||0)},skip:function(i){i=i||1,this.char+=i,this.input=this.input.slice(i)},on:function(names,listener){names.split(\\\" \\\").forEach(function(name){this.emitter.on(name,listener)}.bind(this))},trigger:function(){this.emitter.emit.apply(this.emitter,Array.prototype.slice.call(arguments))},triggerAsync:function(type,args,checks,fn){checks.push(function(){fn()&&this.trigger(type,args)}.bind(this))},scanPunctuator:function(){var ch2,ch3,ch4,ch1=this.peek();switch(ch1){case\\\".\\\":if(/^[0-9]$/.test(this.peek(1)))return null;if(\\\".\\\"===this.peek(1)&&\\\".\\\"===this.peek(2))return{type:Token.Punctuator,value:\\\"...\\\"};case\\\"(\\\":case\\\")\\\":case\\\";\\\":case\\\",\\\":case\\\"[\\\":case\\\"]\\\":case\\\":\\\":case\\\"~\\\":case\\\"?\\\":return{type:Token.Punctuator,value:ch1};case\\\"{\\\":return this.pushContext(Context.Block),{type:Token.Punctuator,value:ch1};case\\\"}\\\":return this.inContext(Context.Block)&&this.popContext(),{type:Token.Punctuator,value:ch1};case\\\"#\\\":return{type:Token.Punctuator,value:ch1};case\\\"\\\":return null}return ch2=this.peek(1),ch3=this.peek(2),ch4=this.peek(3),\\\">\\\"===ch1&&\\\">\\\"===ch2&&\\\">\\\"===ch3&&\\\"=\\\"===ch4?{type:Token.Punctuator,value:\\\">>>=\\\"}:\\\"=\\\"===ch1&&\\\"=\\\"===ch2&&\\\"=\\\"===ch3?{type:Token.Punctuator,value:\\\"===\\\"}:\\\"!\\\"===ch1&&\\\"=\\\"===ch2&&\\\"=\\\"===ch3?{type:Token.Punctuator,value:\\\"!==\\\"}:\\\">\\\"===ch1&&\\\">\\\"===ch2&&\\\">\\\"===ch3?{type:Token.Punctuator,value:\\\">>>\\\"}:\\\"<\\\"===ch1&&\\\"<\\\"===ch2&&\\\"=\\\"===ch3?{type:Token.Punctuator,value:\\\"<<=\\\"}:\\\">\\\"===ch1&&\\\">\\\"===ch2&&\\\"=\\\"===ch3?{type:Token.Punctuator,value:\\\">>=\\\"}:\\\"=\\\"===ch1&&\\\">\\\"===ch2?{type:Token.Punctuator,value:ch1+ch2}:ch1===ch2&&\\\"+-<>&|\\\".indexOf(ch1)>=0?{type:Token.Punctuator,value:ch1+ch2}:\\\"<>=!+-*%&|^\\\".indexOf(ch1)>=0?\\\"=\\\"===ch2?{type:Token.Punctuator,value:ch1+ch2}:{type:Token.Punctuator,value:ch1}:\\\"/\\\"===ch1?\\\"=\\\"===ch2?{type:Token.Punctuator,value:\\\"/=\\\"}:{type:Token.Punctuator,value:\\\"/\\\"}:null},scanComments:function(){function commentToken(label,body,opt){var special=[\\\"jshint\\\",\\\"jslint\\\",\\\"members\\\",\\\"member\\\",\\\"globals\\\",\\\"global\\\",\\\"exported\\\"],isSpecial=!1,value=label+body,commentType=\\\"plain\\\";return opt=opt||{},opt.isMultiline&&(value+=\\\"*/\\\"),body=body.replace(/\\\\n/g,\\\" \\\"),\\\"/*\\\"===label&&reg.fallsThrough.test(body)&&(isSpecial=!0,commentType=\\\"falls through\\\"),special.forEach(function(str){if(!isSpecial&&(\\\"//\\\"!==label||\\\"jshint\\\"===str)&&(\\\" \\\"===body.charAt(str.length)&&body.substr(0,str.length)===str&&(isSpecial=!0,label+=str,body=body.substr(str.length)),isSpecial||\\\" \\\"!==body.charAt(0)||\\\" \\\"!==body.charAt(str.length+1)||body.substr(1,str.length)!==str||(isSpecial=!0,label=label+\\\" \\\"+str,body=body.substr(str.length+1)),isSpecial))switch(str){case\\\"member\\\":commentType=\\\"members\\\";break;case\\\"global\\\":commentType=\\\"globals\\\";break;default:var options=body.split(\\\":\\\").map(function(v){return v.replace(/^\\\\s+/,\\\"\\\").replace(/\\\\s+$/,\\\"\\\")});if(2===options.length)switch(options[0]){case\\\"ignore\\\":switch(options[1]){case\\\"start\\\":self.ignoringLinterErrors=!0,isSpecial=!1;break;case\\\"end\\\":self.ignoringLinterErrors=!1,isSpecial=!1}}commentType=str}}),{type:Token.Comment,commentType:commentType,value:value,body:body,isSpecial:isSpecial,isMultiline:opt.isMultiline||!1,isMalformed:opt.isMalformed||!1}}var ch1=this.peek(),ch2=this.peek(1),rest=this.input.substr(2),startLine=this.line,startChar=this.char,self=this;if(\\\"*\\\"===ch1&&\\\"/\\\"===ch2)return this.trigger(\\\"error\\\",{code:\\\"E018\\\",line:startLine,character:startChar}),this.skip(2),null;if(\\\"/\\\"!==ch1||\\\"*\\\"!==ch2&&\\\"/\\\"!==ch2)return null;if(\\\"/\\\"===ch2)return this.skip(this.input.length),commentToken(\\\"//\\\",rest);var body=\\\"\\\";if(\\\"*\\\"===ch2){for(this.inComment=!0,this.skip(2);\\\"*\\\"!==this.peek()||\\\"/\\\"!==this.peek(1);)if(\\\"\\\"===this.peek()){if(body+=\\\"\\\\n\\\",!this.nextLine())return this.trigger(\\\"error\\\",{code:\\\"E017\\\",line:startLine,character:startChar}),this.inComment=!1,commentToken(\\\"/*\\\",body,{isMultiline:!0,isMalformed:!0})}else body+=this.peek(),this.skip();return this.skip(2),this.inComment=!1,commentToken(\\\"/*\\\",body,{isMultiline:!0})}},scanKeyword:function(){var result=/^[a-zA-Z_$][a-zA-Z0-9_$]*/.exec(this.input),keywords=[\\\"if\\\",\\\"in\\\",\\\"do\\\",\\\"var\\\",\\\"for\\\",\\\"new\\\",\\\"try\\\",\\\"let\\\",\\\"this\\\",\\\"else\\\",\\\"case\\\",\\\"void\\\",\\\"with\\\",\\\"enum\\\",\\\"while\\\",\\\"break\\\",\\\"catch\\\",\\\"throw\\\",\\\"const\\\",\\\"yield\\\",\\\"class\\\",\\\"super\\\",\\\"return\\\",\\\"typeof\\\",\\\"delete\\\",\\\"switch\\\",\\\"export\\\",\\\"import\\\",\\\"default\\\",\\\"finally\\\",\\\"extends\\\",\\\"function\\\",\\\"continue\\\",\\\"debugger\\\",\\\"instanceof\\\"];return result&&keywords.indexOf(result[0])>=0?{type:Token.Keyword,value:result[0]}:null},scanIdentifier:function(){function isNonAsciiIdentifierStart(code){return code>256}function isNonAsciiIdentifierPart(code){return code>256}function isHexDigit(str){return/^[0-9a-fA-F]$/.test(str)}function removeEscapeSequences(id){return id.replace(/\\\\\\\\u([0-9a-fA-F]{4})/g,function(m0,codepoint){return String.fromCharCode(parseInt(codepoint,16))})}var type,char,id=\\\"\\\",index=0,readUnicodeEscapeSequence=function(){if(index+=1,\\\"u\\\"!==this.peek(index))return null;var code,ch1=this.peek(index+1),ch2=this.peek(index+2),ch3=this.peek(index+3),ch4=this.peek(index+4);return isHexDigit(ch1)&&isHexDigit(ch2)&&isHexDigit(ch3)&&isHexDigit(ch4)?(code=parseInt(ch1+ch2+ch3+ch4,16),asciiIdentifierPartTable[code]||isNonAsciiIdentifierPart(code)?(index+=5,\\\"\\\\\\\\u\\\"+ch1+ch2+ch3+ch4):null):null}.bind(this),getIdentifierStart=function(){var chr=this.peek(index),code=chr.charCodeAt(0);return 92===code?readUnicodeEscapeSequence():128>code?asciiIdentifierStartTable[code]?(index+=1,chr):null:isNonAsciiIdentifierStart(code)?(index+=1,chr):null}.bind(this),getIdentifierPart=function(){var chr=this.peek(index),code=chr.charCodeAt(0);return 92===code?readUnicodeEscapeSequence():128>code?asciiIdentifierPartTable[code]?(index+=1,chr):null:isNonAsciiIdentifierPart(code)?(index+=1,chr):null}.bind(this);if(char=getIdentifierStart(),null===char)return null;for(id=char;char=getIdentifierPart(),null!==char;)id+=char;switch(id){case\\\"true\\\":case\\\"false\\\":type=Token.BooleanLiteral;break;case\\\"null\\\":type=Token.NullLiteral;break;default:type=Token.Identifier}return{type:type,value:removeEscapeSequences(id),text:id,tokenLength:id.length}},scanNumericLiteral:function(){function isDecimalDigit(str){return/^[0-9]$/.test(str)}function isOctalDigit(str){return/^[0-7]$/.test(str)}function isBinaryDigit(str){return/^[01]$/.test(str)}function isHexDigit(str){return/^[0-9a-fA-F]$/.test(str)}function isIdentifierStart(ch){return\\\"$\\\"===ch||\\\"_\\\"===ch||\\\"\\\\\\\\\\\"===ch||ch>=\\\"a\\\"&&\\\"z\\\">=ch||ch>=\\\"A\\\"&&\\\"Z\\\">=ch}var bad,index=0,value=\\\"\\\",length=this.input.length,char=this.peek(index),isAllowedDigit=isDecimalDigit,base=10,isLegacy=!1;if(\\\".\\\"!==char&&!isDecimalDigit(char))return null;if(\\\".\\\"!==char){for(value=this.peek(index),index+=1,char=this.peek(index),\\\"0\\\"===value&&((\\\"x\\\"===char||\\\"X\\\"===char)&&(isAllowedDigit=isHexDigit,base=16,index+=1,value+=char),(\\\"o\\\"===char||\\\"O\\\"===char)&&(isAllowedDigit=isOctalDigit,base=8,state.inES6(!0)||this.trigger(\\\"warning\\\",{code:\\\"W119\\\",line:this.line,character:this.char,data:[\\\"Octal integer literal\\\",\\\"6\\\"]}),index+=1,value+=char),(\\\"b\\\"===char||\\\"B\\\"===char)&&(isAllowedDigit=isBinaryDigit,base=2,state.inES6(!0)||this.trigger(\\\"warning\\\",{code:\\\"W119\\\",line:this.line,character:this.char,data:[\\\"Binary integer literal\\\",\\\"6\\\"]}),index+=1,value+=char),isOctalDigit(char)&&(isAllowedDigit=isOctalDigit,base=8,isLegacy=!0,bad=!1,index+=1,value+=char),!isOctalDigit(char)&&isDecimalDigit(char)&&(index+=1,value+=char));length>index;){if(char=this.peek(index),isLegacy&&isDecimalDigit(char))bad=!0;else if(!isAllowedDigit(char))break;value+=char,index+=1}if(isAllowedDigit!==isDecimalDigit)return!isLegacy&&2>=value.length?{type:Token.NumericLiteral,value:value,isMalformed:!0}:length>index&&(char=this.peek(index),isIdentifierStart(char))?null:{type:Token.NumericLiteral,value:value,base:base,isLegacy:isLegacy,isMalformed:!1}}if(\\\".\\\"===char)for(value+=char,index+=1;length>index&&(char=this.peek(index),isDecimalDigit(char));)value+=char,index+=1;if(\\\"e\\\"===char||\\\"E\\\"===char){if(value+=char,index+=1,char=this.peek(index),(\\\"+\\\"===char||\\\"-\\\"===char)&&(value+=this.peek(index),index+=1),char=this.peek(index),!isDecimalDigit(char))return null;for(value+=char,index+=1;length>index&&(char=this.peek(index),isDecimalDigit(char));)value+=char,index+=1}return length>index&&(char=this.peek(index),isIdentifierStart(char))?null:{type:Token.NumericLiteral,value:value,base:base,isMalformed:!isFinite(value)}},scanEscapeSequence:function(checks){var allowNewLine=!1,jump=1;this.skip();var char=this.peek();switch(char){case\\\"'\\\":this.triggerAsync(\\\"warning\\\",{code:\\\"W114\\\",line:this.line,character:this.char,data:[\\\"\\\\\\\\'\\\"]},checks,function(){return state.jsonMode});break;case\\\"b\\\":char=\\\"\\\\\\\\b\\\";break;case\\\"f\\\":char=\\\"\\\\\\\\f\\\";break;case\\\"n\\\":char=\\\"\\\\\\\\n\\\";break;case\\\"r\\\":char=\\\"\\\\\\\\r\\\";break;case\\\"t\\\":char=\\\"\\\\\\\\t\\\";break;case\\\"0\\\":char=\\\"\\\\\\\\0\\\";var n=parseInt(this.peek(1),10);this.triggerAsync(\\\"warning\\\",{code:\\\"W115\\\",line:this.line,character:this.char},checks,function(){return n>=0&&7>=n&&state.isStrict()});break;case\\\"u\\\":var hexCode=this.input.substr(1,4),code=parseInt(hexCode,16);isNaN(code)&&this.trigger(\\\"warning\\\",{code:\\\"W052\\\",line:this.line,character:this.char,data:[\\\"u\\\"+hexCode]}),char=String.fromCharCode(code),jump=5;break;case\\\"v\\\":this.triggerAsync(\\\"warning\\\",{code:\\\"W114\\\",line:this.line,character:this.char,data:[\\\"\\\\\\\\v\\\"]},checks,function(){return state.jsonMode}),char=\\\"\\u000b\\\";break;case\\\"x\\\":var x=parseInt(this.input.substr(1,2),16);this.triggerAsync(\\\"warning\\\",{code:\\\"W114\\\",line:this.line,character:this.char,data:[\\\"\\\\\\\\x-\\\"]},checks,function(){return state.jsonMode}),char=String.fromCharCode(x),jump=3;break;case\\\"\\\\\\\\\\\":char=\\\"\\\\\\\\\\\\\\\\\\\";break;case'\\\"':char='\\\\\\\\\\\"';break;case\\\"/\\\":break;case\\\"\\\":allowNewLine=!0,char=\\\"\\\"}return{\\\"char\\\":char,jump:jump,allowNewLine:allowNewLine}},scanTemplateLiteral:function(checks){var tokenType,ch,value=\\\"\\\",startLine=this.line,startChar=this.char,depth=this.templateStarts.length;if(!state.inES6(!0))return null;if(\\\"`\\\"===this.peek())tokenType=Token.TemplateHead,this.templateStarts.push({line:this.line,\\\"char\\\":this.char}),depth=this.templateStarts.length,this.skip(1),this.pushContext(Context.Template);else{if(!this.inContext(Context.Template)||\\\"}\\\"!==this.peek())return null;tokenType=Token.TemplateMiddle}for(;\\\"`\\\"!==this.peek();){for(;\\\"\\\"===(ch=this.peek());)if(value+=\\\"\\\\n\\\",!this.nextLine()){var startPos=this.templateStarts.pop();return this.trigger(\\\"error\\\",{code:\\\"E052\\\",line:startPos.line,character:startPos.char}),{type:tokenType,value:value,startLine:startLine,startChar:startChar,isUnclosed:!0,depth:depth,context:this.popContext()}}if(\\\"$\\\"===ch&&\\\"{\\\"===this.peek(1))return value+=\\\"${\\\",this.skip(2),{type:tokenType,value:value,startLine:startLine,startChar:startChar,isUnclosed:!1,depth:depth,context:this.currentContext()};\\nif(\\\"\\\\\\\\\\\"===ch){var escape=this.scanEscapeSequence(checks);value+=escape.char,this.skip(escape.jump)}else\\\"`\\\"!==ch&&(value+=ch,this.skip(1))}return tokenType=tokenType===Token.TemplateHead?Token.NoSubstTemplate:Token.TemplateTail,this.skip(1),this.templateStarts.pop(),{type:tokenType,value:value,startLine:startLine,startChar:startChar,isUnclosed:!1,depth:depth,context:this.popContext()}},scanStringLiteral:function(checks){var quote=this.peek();if('\\\"'!==quote&&\\\"'\\\"!==quote)return null;this.triggerAsync(\\\"warning\\\",{code:\\\"W108\\\",line:this.line,character:this.char},checks,function(){return state.jsonMode&&'\\\"'!==quote});var value=\\\"\\\",startLine=this.line,startChar=this.char,allowNewLine=!1;for(this.skip();this.peek()!==quote;)if(\\\"\\\"===this.peek()){if(allowNewLine?(allowNewLine=!1,this.triggerAsync(\\\"warning\\\",{code:\\\"W043\\\",line:this.line,character:this.char},checks,function(){return!state.option.multistr}),this.triggerAsync(\\\"warning\\\",{code:\\\"W042\\\",line:this.line,character:this.char},checks,function(){return state.jsonMode&&state.option.multistr})):this.trigger(\\\"warning\\\",{code:\\\"W112\\\",line:this.line,character:this.char}),!this.nextLine())return this.trigger(\\\"error\\\",{code:\\\"E029\\\",line:startLine,character:startChar}),{type:Token.StringLiteral,value:value,startLine:startLine,startChar:startChar,isUnclosed:!0,quote:quote}}else{allowNewLine=!1;var char=this.peek(),jump=1;if(\\\" \\\">char&&this.trigger(\\\"warning\\\",{code:\\\"W113\\\",line:this.line,character:this.char,data:[\\\"<non-printable>\\\"]}),\\\"\\\\\\\\\\\"===char){var parsed=this.scanEscapeSequence(checks);char=parsed.char,jump=parsed.jump,allowNewLine=parsed.allowNewLine}value+=char,this.skip(jump)}return this.skip(),{type:Token.StringLiteral,value:value,startLine:startLine,startChar:startChar,isUnclosed:!1,quote:quote}},scanRegExp:function(){var terminated,index=0,length=this.input.length,char=this.peek(),value=char,body=\\\"\\\",flags=[],malformed=!1,isCharSet=!1,scanUnexpectedChars=function(){\\\" \\\">char&&(malformed=!0,this.trigger(\\\"warning\\\",{code:\\\"W048\\\",line:this.line,character:this.char})),\\\"<\\\"===char&&(malformed=!0,this.trigger(\\\"warning\\\",{code:\\\"W049\\\",line:this.line,character:this.char,data:[char]}))}.bind(this);if(!this.prereg||\\\"/\\\"!==char)return null;for(index+=1,terminated=!1;length>index;)if(char=this.peek(index),value+=char,body+=char,isCharSet)\\\"]\\\"===char&&(\\\"\\\\\\\\\\\"!==this.peek(index-1)||\\\"\\\\\\\\\\\"===this.peek(index-2))&&(isCharSet=!1),\\\"\\\\\\\\\\\"===char&&(index+=1,char=this.peek(index),body+=char,value+=char,scanUnexpectedChars()),index+=1;else{if(\\\"\\\\\\\\\\\"===char){if(index+=1,char=this.peek(index),body+=char,value+=char,scanUnexpectedChars(),\\\"/\\\"===char){index+=1;continue}if(\\\"[\\\"===char){index+=1;continue}}if(\\\"[\\\"!==char){if(\\\"/\\\"===char){body=body.substr(0,body.length-1),terminated=!0,index+=1;break}index+=1}else isCharSet=!0,index+=1}if(!terminated)return this.trigger(\\\"error\\\",{code:\\\"E015\\\",line:this.line,character:this.from}),void this.trigger(\\\"fatal\\\",{line:this.line,from:this.from});for(;length>index&&(char=this.peek(index),/[gim]/.test(char));)flags.push(char),value+=char,index+=1;try{RegExp(body,flags.join(\\\"\\\"))}catch(err){malformed=!0,this.trigger(\\\"error\\\",{code:\\\"E016\\\",line:this.line,character:this.char,data:[err.message]})}return{type:Token.RegExp,value:value,flags:flags,isMalformed:malformed}},scanNonBreakingSpaces:function(){return state.option.nonbsp?this.input.search(/(\\\\u00A0)/):-1},scanUnsafeChars:function(){return this.input.search(reg.unsafeChars)},next:function(checks){this.from=this.char;var start;if(/\\\\s/.test(this.peek()))for(start=this.char;/\\\\s/.test(this.peek());)this.from+=1,this.skip();var match=this.scanComments()||this.scanStringLiteral(checks)||this.scanTemplateLiteral(checks);return match?match:(match=this.scanRegExp()||this.scanPunctuator()||this.scanKeyword()||this.scanIdentifier()||this.scanNumericLiteral(),match?(this.skip(match.tokenLength||match.value.length),match):null)},nextLine:function(){var char;if(this.line>=this.getLines().length)return!1;this.input=this.getLines()[this.line],this.line+=1,this.char=1,this.from=1;var inputTrimmed=this.input.trim(),startsWith=function(){return _.some(arguments,function(prefix){return 0===inputTrimmed.indexOf(prefix)})},endsWith=function(){return _.some(arguments,function(suffix){return-1!==inputTrimmed.indexOf(suffix,inputTrimmed.length-suffix.length)})};if(this.ignoringLinterErrors===!0&&(startsWith(\\\"/*\\\",\\\"//\\\")||this.inComment&&endsWith(\\\"*/\\\")||(this.input=\\\"\\\")),char=this.scanNonBreakingSpaces(),char>=0&&this.trigger(\\\"warning\\\",{code:\\\"W125\\\",line:this.line,character:char+1}),this.input=this.input.replace(/\\\\t/g,state.tab),char=this.scanUnsafeChars(),char>=0&&this.trigger(\\\"warning\\\",{code:\\\"W100\\\",line:this.line,character:char}),!this.ignoringLinterErrors&&state.option.maxlen&&state.option.maxlen<this.input.length){var inComment=this.inComment||startsWith.call(inputTrimmed,\\\"//\\\")||startsWith.call(inputTrimmed,\\\"/*\\\"),shouldTriggerError=!inComment||!reg.maxlenException.test(inputTrimmed);shouldTriggerError&&this.trigger(\\\"warning\\\",{code:\\\"W101\\\",line:this.line,character:this.input.length})}return!0},start:function(){this.nextLine()},token:function(){function isReserved(token,isProperty){if(!token.reserved)return!1;var meta=token.meta;if(meta&&meta.isFutureReservedWord&&state.inES5()){if(!meta.es5)return!1;if(meta.strictOnly&&!state.option.strict&&!state.isStrict())return!1;if(isProperty)return!1}return!0}for(var token,checks=asyncTrigger(),create=function(type,value,isProperty,token){var obj;if(\\\"(endline)\\\"!==type&&\\\"(end)\\\"!==type&&(this.prereg=!1),\\\"(punctuator)\\\"===type){switch(value){case\\\".\\\":case\\\")\\\":case\\\"~\\\":case\\\"#\\\":case\\\"]\\\":case\\\"++\\\":case\\\"--\\\":this.prereg=!1;break;default:this.prereg=!0}obj=Object.create(state.syntax[value]||state.syntax[\\\"(error)\\\"])}return\\\"(identifier)\\\"===type&&((\\\"return\\\"===value||\\\"case\\\"===value||\\\"typeof\\\"===value)&&(this.prereg=!0),_.has(state.syntax,value)&&(obj=Object.create(state.syntax[value]||state.syntax[\\\"(error)\\\"]),isReserved(obj,isProperty&&\\\"(identifier)\\\"===type)||(obj=null))),obj||(obj=Object.create(state.syntax[type])),obj.identifier=\\\"(identifier)\\\"===type,obj.type=obj.type||type,obj.value=value,obj.line=this.line,obj.character=this.char,obj.from=this.from,obj.identifier&&token&&(obj.raw_text=token.text||token.value),token&&token.startLine&&token.startLine!==this.line&&(obj.startLine=token.startLine),token&&token.context&&(obj.context=token.context),token&&token.depth&&(obj.depth=token.depth),token&&token.isUnclosed&&(obj.isUnclosed=token.isUnclosed),isProperty&&obj.identifier&&(obj.isProperty=isProperty),obj.check=checks.check,obj}.bind(this);;){if(!this.input.length)return this.nextLine()?create(\\\"(endline)\\\",\\\"\\\"):this.exhausted?null:(this.exhausted=!0,create(\\\"(end)\\\",\\\"\\\"));if(token=this.next(checks))switch(token.type){case Token.StringLiteral:return this.triggerAsync(\\\"String\\\",{line:this.line,\\\"char\\\":this.char,from:this.from,startLine:token.startLine,startChar:token.startChar,value:token.value,quote:token.quote},checks,function(){return!0}),create(\\\"(string)\\\",token.value,null,token);case Token.TemplateHead:return this.trigger(\\\"TemplateHead\\\",{line:this.line,\\\"char\\\":this.char,from:this.from,startLine:token.startLine,startChar:token.startChar,value:token.value}),create(\\\"(template)\\\",token.value,null,token);case Token.TemplateMiddle:return this.trigger(\\\"TemplateMiddle\\\",{line:this.line,\\\"char\\\":this.char,from:this.from,startLine:token.startLine,startChar:token.startChar,value:token.value}),create(\\\"(template middle)\\\",token.value,null,token);case Token.TemplateTail:return this.trigger(\\\"TemplateTail\\\",{line:this.line,\\\"char\\\":this.char,from:this.from,startLine:token.startLine,startChar:token.startChar,value:token.value}),create(\\\"(template tail)\\\",token.value,null,token);case Token.NoSubstTemplate:return this.trigger(\\\"NoSubstTemplate\\\",{line:this.line,\\\"char\\\":this.char,from:this.from,startLine:token.startLine,startChar:token.startChar,value:token.value}),create(\\\"(no subst template)\\\",token.value,null,token);case Token.Identifier:this.triggerAsync(\\\"Identifier\\\",{line:this.line,\\\"char\\\":this.char,from:this.form,name:token.value,raw_name:token.text,isProperty:\\\".\\\"===state.tokens.curr.id},checks,function(){return!0});case Token.Keyword:case Token.NullLiteral:case Token.BooleanLiteral:return create(\\\"(identifier)\\\",token.value,\\\".\\\"===state.tokens.curr.id,token);case Token.NumericLiteral:return token.isMalformed&&this.trigger(\\\"warning\\\",{code:\\\"W045\\\",line:this.line,character:this.char,data:[token.value]}),this.triggerAsync(\\\"warning\\\",{code:\\\"W114\\\",line:this.line,character:this.char,data:[\\\"0x-\\\"]},checks,function(){return 16===token.base&&state.jsonMode}),this.triggerAsync(\\\"warning\\\",{code:\\\"W115\\\",line:this.line,character:this.char},checks,function(){return state.isStrict()&&8===token.base&&token.isLegacy}),this.trigger(\\\"Number\\\",{line:this.line,\\\"char\\\":this.char,from:this.from,value:token.value,base:token.base,isMalformed:token.malformed}),create(\\\"(number)\\\",token.value);case Token.RegExp:return create(\\\"(regexp)\\\",token.value);case Token.Comment:if(state.tokens.curr.comment=!0,token.isSpecial)return{id:\\\"(comment)\\\",value:token.value,body:token.body,type:token.commentType,isSpecial:token.isSpecial,line:this.line,character:this.char,from:this.from};break;case\\\"\\\":break;default:return create(\\\"(punctuator)\\\",token.value)}else this.input.length&&(this.trigger(\\\"error\\\",{code:\\\"E024\\\",line:this.line,character:this.char,data:[this.peek()]}),this.input=\\\"\\\")}}},exports.Lexer=Lexer,exports.Context=Context},{\\\"../data/ascii-identifier-data.js\\\":\\\"/node_modules/jshint/data/ascii-identifier-data.js\\\",\\\"../lodash\\\":\\\"/node_modules/jshint/lodash.js\\\",\\\"./reg.js\\\":\\\"/node_modules/jshint/src/reg.js\\\",\\\"./state.js\\\":\\\"/node_modules/jshint/src/state.js\\\",events:\\\"/node_modules/browserify/node_modules/events/events.js\\\"}],\\\"/node_modules/jshint/src/messages.js\\\":[function(_dereq_,module,exports){\\\"use strict\\\";var _=_dereq_(\\\"../lodash\\\"),errors={E001:\\\"Bad option: '{a}'.\\\",E002:\\\"Bad option value.\\\",E003:\\\"Expected a JSON value.\\\",E004:\\\"Input is neither a string nor an array of strings.\\\",E005:\\\"Input is empty.\\\",E006:\\\"Unexpected early end of program.\\\",E007:'Missing \\\"use strict\\\" statement.',E008:\\\"Strict violation.\\\",E009:\\\"Option 'validthis' can't be used in a global scope.\\\",E010:\\\"'with' is not allowed in strict mode.\\\",E011:\\\"'{a}' has already been declared.\\\",E012:\\\"const '{a}' is initialized to 'undefined'.\\\",E013:\\\"Attempting to override '{a}' which is a constant.\\\",E014:\\\"A regular expression literal can be confused with '/='.\\\",E015:\\\"Unclosed regular expression.\\\",E016:\\\"Invalid regular expression.\\\",E017:\\\"Unclosed comment.\\\",E018:\\\"Unbegun comment.\\\",E019:\\\"Unmatched '{a}'.\\\",E020:\\\"Expected '{a}' to match '{b}' from line {c} and instead saw '{d}'.\\\",E021:\\\"Expected '{a}' and instead saw '{b}'.\\\",E022:\\\"Line breaking error '{a}'.\\\",E023:\\\"Missing '{a}'.\\\",E024:\\\"Unexpected '{a}'.\\\",E025:\\\"Missing ':' on a case clause.\\\",E026:\\\"Missing '}' to match '{' from line {a}.\\\",E027:\\\"Missing ']' to match '[' from line {a}.\\\",E028:\\\"Illegal comma.\\\",E029:\\\"Unclosed string.\\\",E030:\\\"Expected an identifier and instead saw '{a}'.\\\",E031:\\\"Bad assignment.\\\",E032:\\\"Expected a small integer or 'false' and instead saw '{a}'.\\\",E033:\\\"Expected an operator and instead saw '{a}'.\\\",E034:\\\"get/set are ES5 features.\\\",E035:\\\"Missing property name.\\\",E036:\\\"Expected to see a statement and instead saw a block.\\\",E037:null,E038:null,E039:\\\"Function declarations are not invocable. Wrap the whole function invocation in parens.\\\",E040:\\\"Each value should have its own case label.\\\",E041:\\\"Unrecoverable syntax error.\\\",E042:\\\"Stopping.\\\",E043:\\\"Too many errors.\\\",E044:null,E045:\\\"Invalid for each loop.\\\",E046:\\\"A yield statement shall be within a generator function (with syntax: `function*`)\\\",E047:null,E048:\\\"{a} declaration not directly within block.\\\",E049:\\\"A {a} cannot be named '{b}'.\\\",E050:\\\"Mozilla acequires the yield expression to be parenthesized here.\\\",E051:null,E052:\\\"Unclosed template literal.\\\",E053:\\\"Export declaration must be in global scope.\\\",E054:\\\"Class properties must be methods. Expected '(' but instead saw '{a}'.\\\",E055:\\\"The '{a}' option cannot be set after any executable code.\\\",E056:\\\"'{a}' was used before it was declared, which is illegal for '{b}' variables.\\\",E057:\\\"Invalid meta property: '{a}.{b}'.\\\",E058:\\\"Missing semicolon.\\\"},warnings={W001:\\\"'hasOwnProperty' is a really bad name.\\\",W002:\\\"Value of '{a}' may be overwritten in IE 8 and earlier.\\\",W003:\\\"'{a}' was used before it was defined.\\\",W004:\\\"'{a}' is already defined.\\\",W005:\\\"A dot following a number can be confused with a decimal point.\\\",W006:\\\"Confusing minuses.\\\",W007:\\\"Confusing plusses.\\\",W008:\\\"A leading decimal point can be confused with a dot: '{a}'.\\\",W009:\\\"The array literal notation [] is preferable.\\\",W010:\\\"The object literal notation {} is preferable.\\\",W011:null,W012:null,W013:null,W014:\\\"Bad line breaking before '{a}'.\\\",W015:null,W016:\\\"Unexpected use of '{a}'.\\\",W017:\\\"Bad operand.\\\",W018:\\\"Confusing use of '{a}'.\\\",W019:\\\"Use the isNaN function to compare with NaN.\\\",W020:\\\"Read only.\\\",W021:\\\"Reassignment of '{a}', which is is a {b}. Use 'var' or 'let' to declare bindings that may change.\\\",W022:\\\"Do not assign to the exception parameter.\\\",W023:\\\"Expected an identifier in an assignment and instead saw a function invocation.\\\",W024:\\\"Expected an identifier and instead saw '{a}' (a reserved word).\\\",W025:\\\"Missing name in function declaration.\\\",W026:\\\"Inner functions should be listed at the top of the outer function.\\\",W027:\\\"Unreachable '{a}' after '{b}'.\\\",W028:\\\"Label '{a}' on {b} statement.\\\",W030:\\\"Expected an assignment or function call and instead saw an expression.\\\",W031:\\\"Do not use 'new' for side effects.\\\",W032:\\\"Unnecessary semicolon.\\\",W033:\\\"Missing semicolon.\\\",W034:'Unnecessary directive \\\"{a}\\\".',W035:\\\"Empty block.\\\",W036:\\\"Unexpected /*member '{a}'.\\\",W037:\\\"'{a}' is a statement label.\\\",W038:\\\"'{a}' used out of scope.\\\",W039:\\\"'{a}' is not allowed.\\\",W040:\\\"Possible strict violation.\\\",W041:\\\"Use '{a}' to compare with '{b}'.\\\",W042:\\\"Avoid EOL escaping.\\\",W043:\\\"Bad escaping of EOL. Use option multistr if needed.\\\",W044:\\\"Bad or unnecessary escaping.\\\",W045:\\\"Bad number '{a}'.\\\",W046:\\\"Don't use extra leading zeros '{a}'.\\\",W047:\\\"A trailing decimal point can be confused with a dot: '{a}'.\\\",W048:\\\"Unexpected control character in regular expression.\\\",W049:\\\"Unexpected escaped character '{a}' in regular expression.\\\",W050:\\\"JavaScript URL.\\\",W051:\\\"Variables should not be deleted.\\\",W052:\\\"Unexpected '{a}'.\\\",W053:\\\"Do not use {a} as a constructor.\\\",W054:\\\"The Function constructor is a form of eval.\\\",W055:\\\"A constructor name should start with an uppercase letter.\\\",W056:\\\"Bad constructor.\\\",W057:\\\"Weird construction. Is 'new' necessary?\\\",W058:\\\"Missing '()' invoking a constructor.\\\",W059:\\\"Avoid arguments.{a}.\\\",W060:\\\"document.write can be a form of eval.\\\",W061:\\\"eval can be harmful.\\\",W062:\\\"Wrap an immediate function invocation in parens to assist the reader in understanding that the expression is the result of a function, and not the function itself.\\\",W063:\\\"Math is not a function.\\\",W064:\\\"Missing 'new' prefix when invoking a constructor.\\\",W065:\\\"Missing radix parameter.\\\",W066:\\\"Implied eval. Consider passing a function instead of a string.\\\",W067:\\\"Bad invocation.\\\",W068:\\\"Wrapping non-IIFE function literals in parens is unnecessary.\\\",W069:\\\"['{a}'] is better written in dot notation.\\\",W070:\\\"Extra comma. (it breaks older versions of IE)\\\",W071:\\\"This function has too many statements. ({a})\\\",W072:\\\"This function has too many parameters. ({a})\\\",W073:\\\"Blocks are nested too deeply. ({a})\\\",W074:\\\"This function's cyclomatic complexity is too high. ({a})\\\",W075:\\\"Duplicate {a} '{b}'.\\\",W076:\\\"Unexpected parameter '{a}' in get {b} function.\\\",W077:\\\"Expected a single parameter in set {a} function.\\\",W078:\\\"Setter is defined without getter.\\\",W079:\\\"Redefinition of '{a}'.\\\",W080:\\\"It's not necessary to initialize '{a}' to 'undefined'.\\\",W081:null,W082:\\\"Function declarations should not be placed in blocks. Use a function expression or move the statement to the top of the outer function.\\\",W083:\\\"Don't make functions within a loop.\\\",W084:\\\"Assignment in conditional expression\\\",W085:\\\"Don't use 'with'.\\\",W086:\\\"Expected a 'break' statement before '{a}'.\\\",W087:\\\"Forgotten 'debugger' statement?\\\",W088:\\\"Creating global 'for' variable. Should be 'for (var {a} ...'.\\\",W089:\\\"The body of a for in should be wrapped in an if statement to filter unwanted properties from the prototype.\\\",W090:\\\"'{a}' is not a statement label.\\\",W091:null,W093:\\\"Did you mean to return a conditional instead of an assignment?\\\",W094:\\\"Unexpected comma.\\\",W095:\\\"Expected a string and instead saw {a}.\\\",W096:\\\"The '{a}' key may produce unexpected results.\\\",W097:'Use the function form of \\\"use strict\\\".',W098:\\\"'{a}' is defined but never used.\\\",W099:null,W100:\\\"This character may get silently deleted by one or more browsers.\\\",W101:\\\"Line is too long.\\\",W102:null,W103:\\\"The '{a}' property is deprecated.\\\",W104:\\\"'{a}' is available in ES{b} (use 'esversion: {b}') or Mozilla JS extensions (use moz).\\\",W105:\\\"Unexpected {a} in '{b}'.\\\",W106:\\\"Identifier '{a}' is not in camel case.\\\",W107:\\\"Script URL.\\\",W108:\\\"Strings must use doublequote.\\\",W109:\\\"Strings must use singlequote.\\\",W110:\\\"Mixed double and single quotes.\\\",W112:\\\"Unclosed string.\\\",W113:\\\"Control character in string: {a}.\\\",W114:\\\"Avoid {a}.\\\",W115:\\\"Octal literals are not allowed in strict mode.\\\",W116:\\\"Expected '{a}' and instead saw '{b}'.\\\",W117:\\\"'{a}' is not defined.\\\",W118:\\\"'{a}' is only available in Mozilla JavaScript extensions (use moz option).\\\",W119:\\\"'{a}' is only available in ES{b} (use 'esversion: {b}').\\\",W120:\\\"You might be leaking a variable ({a}) here.\\\",W121:\\\"Extending prototype of native object: '{a}'.\\\",W122:\\\"Invalid typeof value '{a}'\\\",W123:\\\"'{a}' is already defined in outer scope.\\\",W124:\\\"A generator function shall contain a yield statement.\\\",W125:\\\"This line contains non-breaking spaces: http://jshint.com/doc/options/#nonbsp\\\",W126:\\\"Unnecessary grouping operator.\\\",W127:\\\"Unexpected use of a comma operator.\\\",W128:\\\"Empty array elements acequire elision=true.\\\",W129:\\\"'{a}' is defined in a future version of JavaScript. Use a different variable name to avoid migration issues.\\\",W130:\\\"Invalid element after rest element.\\\",W131:\\\"Invalid parameter after rest parameter.\\\",W132:\\\"`var` declarations are forbidden. Use `let` or `const` instead.\\\",W133:\\\"Invalid for-{a} loop left-hand-side: {b}.\\\",W134:\\\"The '{a}' option is only available when linting ECMAScript {b} code.\\\",W135:\\\"{a} may not be supported by non-browser environments.\\\",W136:\\\"'{a}' must be in function scope.\\\",W137:\\\"Empty destructuring.\\\",W138:\\\"Regular parameters should not come after default parameters.\\\"},info={I001:\\\"Comma warnings can be turned off with 'laxcomma'.\\\",I002:null,I003:\\\"ES5 option is now set per default\\\"};exports.errors={},exports.warnings={},exports.info={},_.each(errors,function(desc,code){exports.errors[code]={code:code,desc:desc}}),_.each(warnings,function(desc,code){exports.warnings[code]={code:code,desc:desc}}),_.each(info,function(desc,code){exports.info[code]={code:code,desc:desc}})},{\\\"../lodash\\\":\\\"/node_modules/jshint/lodash.js\\\"}],\\\"/node_modules/jshint/src/name-stack.js\\\":[function(_dereq_,module){\\\"use strict\\\";function NameStack(){this._stack=[]}Object.defineProperty(NameStack.prototype,\\\"length\\\",{get:function(){return this._stack.length}}),NameStack.prototype.push=function(){this._stack.push(null)},NameStack.prototype.pop=function(){this._stack.pop()},NameStack.prototype.set=function(token){this._stack[this.length-1]=token},NameStack.prototype.infer=function(){var type,nameToken=this._stack[this.length-1],prefix=\\\"\\\";return nameToken&&\\\"class\\\"!==nameToken.type||(nameToken=this._stack[this.length-2]),nameToken?(type=nameToken.type,\\\"(string)\\\"!==type&&\\\"(number)\\\"!==type&&\\\"(identifier)\\\"!==type&&\\\"default\\\"!==type?\\\"(expression)\\\":(nameToken.accessorType&&(prefix=nameToken.accessorType+\\\" \\\"),prefix+nameToken.value)):\\\"(empty)\\\"},module.exports=NameStack},{}],\\\"/node_modules/jshint/src/options.js\\\":[function(_dereq_,module,exports){\\\"use strict\\\";exports.bool={enforcing:{bitwise:!0,freeze:!0,camelcase:!0,curly:!0,eqeqeq:!0,futurehostile:!0,notypeof:!0,es3:!0,es5:!0,forin:!0,funcscope:!0,immed:!0,iterator:!0,newcap:!0,noarg:!0,nocomma:!0,noempty:!0,nonbsp:!0,nonew:!0,undef:!0,singleGroups:!1,varstmt:!1,enforceall:!1},relaxing:{asi:!0,multistr:!0,debug:!0,boss:!0,evil:!0,globalstrict:!0,plusplus:!0,proto:!0,scripturl:!0,sub:!0,supernew:!0,laxbreak:!0,laxcomma:!0,validthis:!0,withstmt:!0,moz:!0,noyield:!0,eqnull:!0,lastsemic:!0,loopfunc:!0,expr:!0,esnext:!0,elision:!0},environments:{mootools:!0,couch:!0,jasmine:!0,jquery:!0,node:!0,qunit:!0,rhino:!0,shelljs:!0,prototypejs:!0,yui:!0,mocha:!0,module:!0,wsh:!0,worker:!0,nonstandard:!0,browser:!0,browserify:!0,devel:!0,dojo:!0,typed:!0,phantom:!0},obsolete:{onecase:!0,regexp:!0,regexdash:!0}},exports.val={maxlen:!1,indent:!1,maxerr:!1,predef:!1,globals:!1,quotmark:!1,scope:!1,maxstatements:!1,maxdepth:!1,maxparams:!1,maxcomplexity:!1,shadow:!1,strict:!0,unused:!0,latedef:!1,ignore:!1,ignoreDelimiters:!1,esversion:5},exports.inverted={bitwise:!0,forin:!0,newcap:!0,plusplus:!0,regexp:!0,undef:!0,eqeqeq:!0,strict:!0},exports.validNames=Object.keys(exports.val).concat(Object.keys(exports.bool.relaxing)).concat(Object.keys(exports.bool.enforcing)).concat(Object.keys(exports.bool.obsolete)).concat(Object.keys(exports.bool.environments)),exports.renamed={eqeq:\\\"eqeqeq\\\",windows:\\\"wsh\\\",sloppy:\\\"strict\\\"},exports.removed={nomen:!0,onevar:!0,passfail:!0,white:!0,gcl:!0,smarttabs:!0,trailing:!0},exports.noenforceall={varstmt:!0,strict:!0}},{}],\\\"/node_modules/jshint/src/reg.js\\\":[function(_dereq_,module,exports){\\\"use strict\\\";exports.unsafeString=/@cc|<\\\\/?|script|\\\\]\\\\s*\\\\]|<\\\\s*!|&lt/i,exports.unsafeChars=/[\\\\u0000-\\\\u001f\\\\u007f-\\\\u009f\\\\u00ad\\\\u0600-\\\\u0604\\\\u070f\\\\u17b4\\\\u17b5\\\\u200c-\\\\u200f\\\\u2028-\\\\u202f\\\\u2060-\\\\u206f\\\\ufeff\\\\ufff0-\\\\uffff]/,exports.needEsc=/[\\\\u0000-\\\\u001f&<\\\"\\\\/\\\\\\\\\\\\u007f-\\\\u009f\\\\u00ad\\\\u0600-\\\\u0604\\\\u070f\\\\u17b4\\\\u17b5\\\\u200c-\\\\u200f\\\\u2028-\\\\u202f\\\\u2060-\\\\u206f\\\\ufeff\\\\ufff0-\\\\uffff]/,exports.needEscGlobal=/[\\\\u0000-\\\\u001f&<\\\"\\\\/\\\\\\\\\\\\u007f-\\\\u009f\\\\u00ad\\\\u0600-\\\\u0604\\\\u070f\\\\u17b4\\\\u17b5\\\\u200c-\\\\u200f\\\\u2028-\\\\u202f\\\\u2060-\\\\u206f\\\\ufeff\\\\ufff0-\\\\uffff]/g,exports.starSlash=/\\\\*\\\\//,exports.identifier=/^([a-zA-Z_$][a-zA-Z0-9_$]*)$/,exports.javascriptURL=/^(?:javascript|jscript|ecmascript|vbscript|livescript)\\\\s*:/i,exports.fallsThrough=/^\\\\s*falls?\\\\sthrough\\\\s*$/,exports.maxlenException=/^(?:(?:\\\\/\\\\/|\\\\/\\\\*|\\\\*) ?)?[^ ]+$/},{}],\\\"/node_modules/jshint/src/scope-manager.js\\\":[function(_dereq_,module){\\\"use strict\\\";var _=_dereq_(\\\"../lodash\\\"),events=_dereq_(\\\"events\\\"),marker={},scopeManager=function(state,predefined,exported,declared){function _newScope(type){_current={\\\"(labels)\\\":Object.create(null),\\\"(usages)\\\":Object.create(null),\\\"(breakLabels)\\\":Object.create(null),\\\"(parent)\\\":_current,\\\"(type)\\\":type,\\\"(params)\\\":\\\"functionparams\\\"===type||\\\"catchparams\\\"===type?[]:null},_scopeStack.push(_current)}function warning(code,token){emitter.emit(\\\"warning\\\",{code:code,token:token,data:_.slice(arguments,2)})}function error(code,token){emitter.emit(\\\"warning\\\",{code:code,token:token,data:_.slice(arguments,2)})}function _setupUsages(labelName){_current[\\\"(usages)\\\"][labelName]||(_current[\\\"(usages)\\\"][labelName]={\\\"(modified)\\\":[],\\\"(reassigned)\\\":[],\\\"(tokens)\\\":[]})}function _checkForUnused(){if(\\\"functionparams\\\"===_current[\\\"(type)\\\"])return _checkParams(),void 0;var curentLabels=_current[\\\"(labels)\\\"];for(var labelName in curentLabels)curentLabels[labelName]&&\\\"exception\\\"!==curentLabels[labelName][\\\"(type)\\\"]&&curentLabels[labelName][\\\"(unused)\\\"]&&_warnUnused(labelName,curentLabels[labelName][\\\"(token)\\\"],\\\"var\\\")}function _checkParams(){var params=_current[\\\"(params)\\\"];if(params)for(var unused_opt,param=params.pop();param;){var label=_current[\\\"(labels)\\\"][param];if(unused_opt=_getUnusedOption(state.funct[\\\"(unusedOption)\\\"]),\\\"undefined\\\"===param)return;if(label[\\\"(unused)\\\"])_warnUnused(param,label[\\\"(token)\\\"],\\\"param\\\",state.funct[\\\"(unusedOption)\\\"]);else if(\\\"last-param\\\"===unused_opt)return;param=params.pop()}}function _getLabel(labelName){for(var i=_scopeStack.length-1;i>=0;--i){var scopeLabels=_scopeStack[i][\\\"(labels)\\\"];if(scopeLabels[labelName])return scopeLabels}}function usedSoFarInCurrentFunction(labelName){for(var i=_scopeStack.length-1;i>=0;i--){var current=_scopeStack[i];if(current[\\\"(usages)\\\"][labelName])return current[\\\"(usages)\\\"][labelName];if(current===_currentFunctBody)break}return!1}function _checkOuterShadow(labelName,token){if(\\\"outer\\\"===state.option.shadow)for(var isGlobal=\\\"global\\\"===_currentFunctBody[\\\"(type)\\\"],isNewFunction=\\\"functionparams\\\"===_current[\\\"(type)\\\"],outsideCurrentFunction=!isGlobal,i=0;_scopeStack.length>i;i++){var stackItem=_scopeStack[i];isNewFunction||_scopeStack[i+1]!==_currentFunctBody||(outsideCurrentFunction=!1),outsideCurrentFunction&&stackItem[\\\"(labels)\\\"][labelName]&&warning(\\\"W123\\\",token,labelName),stackItem[\\\"(breakLabels)\\\"][labelName]&&warning(\\\"W123\\\",token,labelName)}}function _latedefWarning(type,labelName,token){state.option.latedef&&(state.option.latedef===!0&&\\\"function\\\"===type||\\\"function\\\"!==type)&&warning(\\\"W003\\\",token,labelName)}var _current,_scopeStack=[];_newScope(\\\"global\\\"),_current[\\\"(predefined)\\\"]=predefined;var _currentFunctBody=_current,usedPredefinedAndGlobals=Object.create(null),impliedGlobals=Object.create(null),unuseds=[],emitter=new events.EventEmitter,_getUnusedOption=function(unused_opt){return void 0===unused_opt&&(unused_opt=state.option.unused),unused_opt===!0&&(unused_opt=\\\"last-param\\\"),unused_opt},_warnUnused=function(name,tkn,type,unused_opt){var line=tkn.line,chr=tkn.from,raw_name=tkn.raw_text||name;unused_opt=_getUnusedOption(unused_opt);var warnable_types={vars:[\\\"var\\\"],\\\"last-param\\\":[\\\"var\\\",\\\"param\\\"],strict:[\\\"var\\\",\\\"param\\\",\\\"last-param\\\"]};unused_opt&&warnable_types[unused_opt]&&-1!==warnable_types[unused_opt].indexOf(type)&&warning(\\\"W098\\\",{line:line,from:chr},raw_name),(unused_opt||\\\"var\\\"===type)&&unuseds.push({name:name,line:line,character:chr})},scopeManagerInst={on:function(names,listener){names.split(\\\" \\\").forEach(function(name){emitter.on(name,listener)})},isPredefined:function(labelName){return!this.has(labelName)&&_.has(_scopeStack[0][\\\"(predefined)\\\"],labelName)},stack:function(type){var previousScope=_current;_newScope(type),type||\\\"functionparams\\\"!==previousScope[\\\"(type)\\\"]||(_current[\\\"(isFuncBody)\\\"]=!0,_current[\\\"(context)\\\"]=_currentFunctBody,_currentFunctBody=_current)},unstack:function(){var i,j,subScope=_scopeStack.length>1?_scopeStack[_scopeStack.length-2]:null,isUnstackingFunctionBody=_current===_currentFunctBody,isUnstackingFunctionParams=\\\"functionparams\\\"===_current[\\\"(type)\\\"],isUnstackingFunctionOuter=\\\"functionouter\\\"===_current[\\\"(type)\\\"],currentUsages=_current[\\\"(usages)\\\"],currentLabels=_current[\\\"(labels)\\\"],usedLabelNameList=Object.keys(currentUsages);for(currentUsages.__proto__&&-1===usedLabelNameList.indexOf(\\\"__proto__\\\")&&usedLabelNameList.push(\\\"__proto__\\\"),i=0;usedLabelNameList.length>i;i++){var usedLabelName=usedLabelNameList[i],usage=currentUsages[usedLabelName],usedLabel=currentLabels[usedLabelName];if(usedLabel){var usedLabelType=usedLabel[\\\"(type)\\\"];if(usedLabel[\\\"(useOutsideOfScope)\\\"]&&!state.option.funcscope){var usedTokens=usage[\\\"(tokens)\\\"];if(usedTokens)for(j=0;usedTokens.length>j;j++)usedLabel[\\\"(function)\\\"]===usedTokens[j][\\\"(function)\\\"]&&error(\\\"W038\\\",usedTokens[j],usedLabelName)}if(_current[\\\"(labels)\\\"][usedLabelName][\\\"(unused)\\\"]=!1,\\\"const\\\"===usedLabelType&&usage[\\\"(modified)\\\"])for(j=0;usage[\\\"(modified)\\\"].length>j;j++)error(\\\"E013\\\",usage[\\\"(modified)\\\"][j],usedLabelName);if((\\\"function\\\"===usedLabelType||\\\"class\\\"===usedLabelType)&&usage[\\\"(reassigned)\\\"])for(j=0;usage[\\\"(reassigned)\\\"].length>j;j++)error(\\\"W021\\\",usage[\\\"(reassigned)\\\"][j],usedLabelName,usedLabelType)}else if(isUnstackingFunctionOuter&&(state.funct[\\\"(isCapturing)\\\"]=!0),subScope)if(subScope[\\\"(usages)\\\"][usedLabelName]){var subScopeUsage=subScope[\\\"(usages)\\\"][usedLabelName];subScopeUsage[\\\"(modified)\\\"]=subScopeUsage[\\\"(modified)\\\"].concat(usage[\\\"(modified)\\\"]),subScopeUsage[\\\"(tokens)\\\"]=subScopeUsage[\\\"(tokens)\\\"].concat(usage[\\\"(tokens)\\\"]),subScopeUsage[\\\"(reassigned)\\\"]=subScopeUsage[\\\"(reassigned)\\\"].concat(usage[\\\"(reassigned)\\\"]),subScopeUsage[\\\"(onlyUsedSubFunction)\\\"]=!1}else subScope[\\\"(usages)\\\"][usedLabelName]=usage,isUnstackingFunctionBody&&(subScope[\\\"(usages)\\\"][usedLabelName][\\\"(onlyUsedSubFunction)\\\"]=!0);else if(\\\"boolean\\\"==typeof _current[\\\"(predefined)\\\"][usedLabelName]){if(delete declared[usedLabelName],usedPredefinedAndGlobals[usedLabelName]=marker,_current[\\\"(predefined)\\\"][usedLabelName]===!1&&usage[\\\"(reassigned)\\\"])for(j=0;usage[\\\"(reassigned)\\\"].length>j;j++)warning(\\\"W020\\\",usage[\\\"(reassigned)\\\"][j])}else if(usage[\\\"(tokens)\\\"])for(j=0;usage[\\\"(tokens)\\\"].length>j;j++){var undefinedToken=usage[\\\"(tokens)\\\"][j];undefinedToken.forgiveUndef||(state.option.undef&&!undefinedToken.ignoreUndef&&warning(\\\"W117\\\",undefinedToken,usedLabelName),impliedGlobals[usedLabelName]?impliedGlobals[usedLabelName].line.push(undefinedToken.line):impliedGlobals[usedLabelName]={name:usedLabelName,line:[undefinedToken.line]})}}if(subScope||Object.keys(declared).forEach(function(labelNotUsed){_warnUnused(labelNotUsed,declared[labelNotUsed],\\\"var\\\")}),subScope&&!isUnstackingFunctionBody&&!isUnstackingFunctionParams&&!isUnstackingFunctionOuter){var labelNames=Object.keys(currentLabels);for(i=0;labelNames.length>i;i++){var defLabelName=labelNames[i];currentLabels[defLabelName][\\\"(blockscoped)\\\"]||\\\"exception\\\"===currentLabels[defLabelName][\\\"(type)\\\"]||this.funct.has(defLabelName,{excludeCurrent:!0})||(subScope[\\\"(labels)\\\"][defLabelName]=currentLabels[defLabelName],\\\"global\\\"!==_currentFunctBody[\\\"(type)\\\"]&&(subScope[\\\"(labels)\\\"][defLabelName][\\\"(useOutsideOfScope)\\\"]=!0),delete currentLabels[defLabelName])}}_checkForUnused(),_scopeStack.pop(),isUnstackingFunctionBody&&(_currentFunctBody=_scopeStack[_.findLastIndex(_scopeStack,function(scope){return scope[\\\"(isFuncBody)\\\"]||\\\"global\\\"===scope[\\\"(type)\\\"]})]),_current=subScope},addParam:function(labelName,token,type){if(type=type||\\\"param\\\",\\\"exception\\\"===type){var previouslyDefinedLabelType=this.funct.labeltype(labelName);previouslyDefinedLabelType&&\\\"exception\\\"!==previouslyDefinedLabelType&&(state.option.node||warning(\\\"W002\\\",state.tokens.next,labelName))}if(_.has(_current[\\\"(labels)\\\"],labelName)?_current[\\\"(labels)\\\"][labelName].duplicated=!0:(_checkOuterShadow(labelName,token,type),_current[\\\"(labels)\\\"][labelName]={\\\"(type)\\\":type,\\\"(token)\\\":token,\\\"(unused)\\\":!0},_current[\\\"(params)\\\"].push(labelName)),_.has(_current[\\\"(usages)\\\"],labelName)){var usage=_current[\\\"(usages)\\\"][labelName];usage[\\\"(onlyUsedSubFunction)\\\"]?_latedefWarning(type,labelName,token):warning(\\\"E056\\\",token,labelName,type)}},validateParams:function(){if(\\\"global\\\"!==_currentFunctBody[\\\"(type)\\\"]){var isStrict=state.isStrict(),currentFunctParamScope=_currentFunctBody[\\\"(parent)\\\"];currentFunctParamScope[\\\"(params)\\\"]&&currentFunctParamScope[\\\"(params)\\\"].forEach(function(labelName){var label=currentFunctParamScope[\\\"(labels)\\\"][labelName];label&&label.duplicated&&(isStrict?warning(\\\"E011\\\",label[\\\"(token)\\\"],labelName):state.option.shadow!==!0&&warning(\\\"W004\\\",label[\\\"(token)\\\"],labelName))})}},getUsedOrDefinedGlobals:function(){var list=Object.keys(usedPredefinedAndGlobals);return usedPredefinedAndGlobals.__proto__===marker&&-1===list.indexOf(\\\"__proto__\\\")&&list.push(\\\"__proto__\\\"),list},getImpliedGlobals:function(){var values=_.values(impliedGlobals),hasProto=!1;return impliedGlobals.__proto__&&(hasProto=values.some(function(value){return\\\"__proto__\\\"===value.name}),hasProto||values.push(impliedGlobals.__proto__)),values},getUnuseds:function(){return unuseds},has:function(labelName){return Boolean(_getLabel(labelName))},labeltype:function(labelName){var scopeLabels=_getLabel(labelName);return scopeLabels?scopeLabels[labelName][\\\"(type)\\\"]:null},addExported:function(labelName){var globalLabels=_scopeStack[0][\\\"(labels)\\\"];if(_.has(declared,labelName))delete declared[labelName];else if(_.has(globalLabels,labelName))globalLabels[labelName][\\\"(unused)\\\"]=!1;else{for(var i=1;_scopeStack.length>i;i++){var scope=_scopeStack[i];if(scope[\\\"(type)\\\"])break;if(_.has(scope[\\\"(labels)\\\"],labelName)&&!scope[\\\"(labels)\\\"][labelName][\\\"(blockscoped)\\\"])return scope[\\\"(labels)\\\"][labelName][\\\"(unused)\\\"]=!1,void 0}exported[labelName]=!0}},setExported:function(labelName,token){this.block.use(labelName,token)\\n},addlabel:function(labelName,opts){var type=opts.type,token=opts.token,isblockscoped=\\\"let\\\"===type||\\\"const\\\"===type||\\\"class\\\"===type,isexported=\\\"global\\\"===(isblockscoped?_current:_currentFunctBody)[\\\"(type)\\\"]&&_.has(exported,labelName);if(_checkOuterShadow(labelName,token,type),isblockscoped){var declaredInCurrentScope=_current[\\\"(labels)\\\"][labelName];if(declaredInCurrentScope||_current!==_currentFunctBody||\\\"global\\\"===_current[\\\"(type)\\\"]||(declaredInCurrentScope=!!_currentFunctBody[\\\"(parent)\\\"][\\\"(labels)\\\"][labelName]),!declaredInCurrentScope&&_current[\\\"(usages)\\\"][labelName]){var usage=_current[\\\"(usages)\\\"][labelName];usage[\\\"(onlyUsedSubFunction)\\\"]?_latedefWarning(type,labelName,token):warning(\\\"E056\\\",token,labelName,type)}declaredInCurrentScope?warning(\\\"E011\\\",token,labelName):\\\"outer\\\"===state.option.shadow&&scopeManagerInst.funct.has(labelName)&&warning(\\\"W004\\\",token,labelName),scopeManagerInst.block.add(labelName,type,token,!isexported)}else{var declaredInCurrentFunctionScope=scopeManagerInst.funct.has(labelName);!declaredInCurrentFunctionScope&&usedSoFarInCurrentFunction(labelName)&&_latedefWarning(type,labelName,token),scopeManagerInst.funct.has(labelName,{onlyBlockscoped:!0})?warning(\\\"E011\\\",token,labelName):state.option.shadow!==!0&&declaredInCurrentFunctionScope&&\\\"__proto__\\\"!==labelName&&\\\"global\\\"!==_currentFunctBody[\\\"(type)\\\"]&&warning(\\\"W004\\\",token,labelName),scopeManagerInst.funct.add(labelName,type,token,!isexported),\\\"global\\\"===_currentFunctBody[\\\"(type)\\\"]&&(usedPredefinedAndGlobals[labelName]=marker)}},funct:{labeltype:function(labelName,options){for(var onlyBlockscoped=options&&options.onlyBlockscoped,excludeParams=options&&options.excludeParams,currentScopeIndex=_scopeStack.length-(options&&options.excludeCurrent?2:1),i=currentScopeIndex;i>=0;i--){var current=_scopeStack[i];if(current[\\\"(labels)\\\"][labelName]&&(!onlyBlockscoped||current[\\\"(labels)\\\"][labelName][\\\"(blockscoped)\\\"]))return current[\\\"(labels)\\\"][labelName][\\\"(type)\\\"];var scopeCheck=excludeParams?_scopeStack[i-1]:current;if(scopeCheck&&\\\"functionparams\\\"===scopeCheck[\\\"(type)\\\"])return null}return null},hasBreakLabel:function(labelName){for(var i=_scopeStack.length-1;i>=0;i--){var current=_scopeStack[i];if(current[\\\"(breakLabels)\\\"][labelName])return!0;if(\\\"functionparams\\\"===current[\\\"(type)\\\"])return!1}return!1},has:function(labelName,options){return Boolean(this.labeltype(labelName,options))},add:function(labelName,type,tok,unused){_current[\\\"(labels)\\\"][labelName]={\\\"(type)\\\":type,\\\"(token)\\\":tok,\\\"(blockscoped)\\\":!1,\\\"(function)\\\":_currentFunctBody,\\\"(unused)\\\":unused}}},block:{isGlobal:function(){return\\\"global\\\"===_current[\\\"(type)\\\"]},use:function(labelName,token){var paramScope=_currentFunctBody[\\\"(parent)\\\"];paramScope&&paramScope[\\\"(labels)\\\"][labelName]&&\\\"param\\\"===paramScope[\\\"(labels)\\\"][labelName][\\\"(type)\\\"]&&(scopeManagerInst.funct.has(labelName,{excludeParams:!0,onlyBlockscoped:!0})||(paramScope[\\\"(labels)\\\"][labelName][\\\"(unused)\\\"]=!1)),token&&(state.ignored.W117||state.option.undef===!1)&&(token.ignoreUndef=!0),_setupUsages(labelName),token&&(token[\\\"(function)\\\"]=_currentFunctBody,_current[\\\"(usages)\\\"][labelName][\\\"(tokens)\\\"].push(token))},reassign:function(labelName,token){this.modify(labelName,token),_current[\\\"(usages)\\\"][labelName][\\\"(reassigned)\\\"].push(token)},modify:function(labelName,token){_setupUsages(labelName),_current[\\\"(usages)\\\"][labelName][\\\"(modified)\\\"].push(token)},add:function(labelName,type,tok,unused){_current[\\\"(labels)\\\"][labelName]={\\\"(type)\\\":type,\\\"(token)\\\":tok,\\\"(blockscoped)\\\":!0,\\\"(unused)\\\":unused}},addBreakLabel:function(labelName,opts){var token=opts.token;scopeManagerInst.funct.hasBreakLabel(labelName)?warning(\\\"E011\\\",token,labelName):\\\"outer\\\"===state.option.shadow&&(scopeManagerInst.funct.has(labelName)?warning(\\\"W004\\\",token,labelName):_checkOuterShadow(labelName,token)),_current[\\\"(breakLabels)\\\"][labelName]=token}}};return scopeManagerInst};module.exports=scopeManager},{\\\"../lodash\\\":\\\"/node_modules/jshint/lodash.js\\\",events:\\\"/node_modules/browserify/node_modules/events/events.js\\\"}],\\\"/node_modules/jshint/src/state.js\\\":[function(_dereq_,module,exports){\\\"use strict\\\";var NameStack=_dereq_(\\\"./name-stack.js\\\"),state={syntax:{},isStrict:function(){return this.directive[\\\"use strict\\\"]||this.inClassBody||this.option.module||\\\"implied\\\"===this.option.strict},inMoz:function(){return this.option.moz},inES6:function(){return this.option.moz||this.option.esversion>=6},inES5:function(strict){return strict?!(this.option.esversion&&5!==this.option.esversion||this.option.moz):!this.option.esversion||this.option.esversion>=5||this.option.moz},reset:function(){this.tokens={prev:null,next:null,curr:null},this.option={},this.funct=null,this.ignored={},this.directive={},this.jsonMode=!1,this.jsonWarnings=[],this.lines=[],this.tab=\\\"\\\",this.cache={},this.ignoredLines={},this.forinifcheckneeded=!1,this.nameStack=new NameStack,this.inClassBody=!1}};exports.state=state},{\\\"./name-stack.js\\\":\\\"/node_modules/jshint/src/name-stack.js\\\"}],\\\"/node_modules/jshint/src/style.js\\\":[function(_dereq_,module,exports){\\\"use strict\\\";exports.register=function(linter){linter.on(\\\"Identifier\\\",function(data){linter.getOption(\\\"proto\\\")||\\\"__proto__\\\"===data.name&&linter.warn(\\\"W103\\\",{line:data.line,\\\"char\\\":data.char,data:[data.name,\\\"6\\\"]})}),linter.on(\\\"Identifier\\\",function(data){linter.getOption(\\\"iterator\\\")||\\\"__iterator__\\\"===data.name&&linter.warn(\\\"W103\\\",{line:data.line,\\\"char\\\":data.char,data:[data.name]})}),linter.on(\\\"Identifier\\\",function(data){linter.getOption(\\\"camelcase\\\")&&data.name.replace(/^_+|_+$/g,\\\"\\\").indexOf(\\\"_\\\")>-1&&!data.name.match(/^[A-Z0-9_]*$/)&&linter.warn(\\\"W106\\\",{line:data.line,\\\"char\\\":data.from,data:[data.name]})}),linter.on(\\\"String\\\",function(data){var code,quotmark=linter.getOption(\\\"quotmark\\\");quotmark&&(\\\"single\\\"===quotmark&&\\\"'\\\"!==data.quote&&(code=\\\"W109\\\"),\\\"double\\\"===quotmark&&'\\\"'!==data.quote&&(code=\\\"W108\\\"),quotmark===!0&&(linter.getCache(\\\"quotmark\\\")||linter.setCache(\\\"quotmark\\\",data.quote),linter.getCache(\\\"quotmark\\\")!==data.quote&&(code=\\\"W110\\\")),code&&linter.warn(code,{line:data.line,\\\"char\\\":data.char}))}),linter.on(\\\"Number\\\",function(data){\\\".\\\"===data.value.charAt(0)&&linter.warn(\\\"W008\\\",{line:data.line,\\\"char\\\":data.char,data:[data.value]}),\\\".\\\"===data.value.substr(data.value.length-1)&&linter.warn(\\\"W047\\\",{line:data.line,\\\"char\\\":data.char,data:[data.value]}),/^00+/.test(data.value)&&linter.warn(\\\"W046\\\",{line:data.line,\\\"char\\\":data.char,data:[data.value]})}),linter.on(\\\"String\\\",function(data){var re=/^(?:javascript|jscript|ecmascript|vbscript|livescript)\\\\s*:/i;linter.getOption(\\\"scripturl\\\")||re.test(data.value)&&linter.warn(\\\"W107\\\",{line:data.line,\\\"char\\\":data.char})})}},{}],\\\"/node_modules/jshint/src/vars.js\\\":[function(_dereq_,module,exports){\\\"use strict\\\";exports.reservedVars={arguments:!1,NaN:!1},exports.ecmaIdentifiers={3:{Array:!1,Boolean:!1,Date:!1,decodeURI:!1,decodeURIComponent:!1,encodeURI:!1,encodeURIComponent:!1,Error:!1,eval:!1,EvalError:!1,Function:!1,hasOwnProperty:!1,isFinite:!1,isNaN:!1,Math:!1,Number:!1,Object:!1,parseInt:!1,parseFloat:!1,RangeError:!1,ReferenceError:!1,RegExp:!1,String:!1,SyntaxError:!1,TypeError:!1,URIError:!1},5:{JSON:!1},6:{Map:!1,Promise:!1,Proxy:!1,Reflect:!1,Set:!1,Symbol:!1,WeakMap:!1,WeakSet:!1}},exports.browser={Audio:!1,Blob:!1,addEventListener:!1,applicationCache:!1,atob:!1,blur:!1,btoa:!1,cancelAnimationFrame:!1,CanvasGradient:!1,CanvasPattern:!1,CanvasRenderingContext2D:!1,CSS:!1,clearInterval:!1,clearTimeout:!1,close:!1,closed:!1,Comment:!1,CustomEvent:!1,DOMParser:!1,defaultStatus:!1,Document:!1,document:!1,DocumentFragment:!1,Element:!1,ElementTimeControl:!1,Event:!1,event:!1,fetch:!1,FileReader:!1,FormData:!1,focus:!1,frames:!1,getComputedStyle:!1,HTMLElement:!1,HTMLAnchorElement:!1,HTMLBaseElement:!1,HTMLBlockquoteElement:!1,HTMLBodyElement:!1,HTMLBRElement:!1,HTMLButtonElement:!1,HTMLCanvasElement:!1,HTMLCollection:!1,HTMLDirectoryElement:!1,HTMLDivElement:!1,HTMLDListElement:!1,HTMLFieldSetElement:!1,HTMLFontElement:!1,HTMLFormElement:!1,HTMLFrameElement:!1,HTMLFrameSetElement:!1,HTMLHeadElement:!1,HTMLHeadingElement:!1,HTMLHRElement:!1,HTMLHtmlElement:!1,HTMLIFrameElement:!1,HTMLImageElement:!1,HTMLInputElement:!1,HTMLIsIndexElement:!1,HTMLLabelElement:!1,HTMLLayerElement:!1,HTMLLegendElement:!1,HTMLLIElement:!1,HTMLLinkElement:!1,HTMLMapElement:!1,HTMLMenuElement:!1,HTMLMetaElement:!1,HTMLModElement:!1,HTMLObjectElement:!1,HTMLOListElement:!1,HTMLOptGroupElement:!1,HTMLOptionElement:!1,HTMLParagraphElement:!1,HTMLParamElement:!1,HTMLPreElement:!1,HTMLQuoteElement:!1,HTMLScriptElement:!1,HTMLSelectElement:!1,HTMLStyleElement:!1,HTMLTableCaptionElement:!1,HTMLTableCellElement:!1,HTMLTableColElement:!1,HTMLTableElement:!1,HTMLTableRowElement:!1,HTMLTableSectionElement:!1,HTMLTemplateElement:!1,HTMLTextAreaElement:!1,HTMLTitleElement:!1,HTMLUListElement:!1,HTMLVideoElement:!1,history:!1,Image:!1,Intl:!1,length:!1,localStorage:!1,location:!1,matchMedia:!1,MessageChannel:!1,MessageEvent:!1,MessagePort:!1,MouseEvent:!1,moveBy:!1,moveTo:!1,MutationObserver:!1,name:!1,Node:!1,NodeFilter:!1,NodeList:!1,Notification:!1,navigator:!1,onbeforeunload:!0,onblur:!0,onerror:!0,onfocus:!0,onload:!0,onresize:!0,onunload:!0,open:!1,openDatabase:!1,opener:!1,Option:!1,parent:!1,performance:!1,print:!1,Range:!1,requestAnimationFrame:!1,removeEventListener:!1,resizeBy:!1,resizeTo:!1,screen:!1,scroll:!1,scrollBy:!1,scrollTo:!1,sessionStorage:!1,setInterval:!1,setTimeout:!1,SharedWorker:!1,status:!1,SVGAElement:!1,SVGAltGlyphDefElement:!1,SVGAltGlyphElement:!1,SVGAltGlyphItemElement:!1,SVGAngle:!1,SVGAnimateColorElement:!1,SVGAnimateElement:!1,SVGAnimateMotionElement:!1,SVGAnimateTransformElement:!1,SVGAnimatedAngle:!1,SVGAnimatedBoolean:!1,SVGAnimatedEnumeration:!1,SVGAnimatedInteger:!1,SVGAnimatedLength:!1,SVGAnimatedLengthList:!1,SVGAnimatedNumber:!1,SVGAnimatedNumberList:!1,SVGAnimatedPathData:!1,SVGAnimatedPoints:!1,SVGAnimatedPreserveAspectRatio:!1,SVGAnimatedRect:!1,SVGAnimatedString:!1,SVGAnimatedTransformList:!1,SVGAnimationElement:!1,SVGCSSRule:!1,SVGCircleElement:!1,SVGClipPathElement:!1,SVGColor:!1,SVGColorProfileElement:!1,SVGColorProfileRule:!1,SVGComponentTransferFunctionElement:!1,SVGCursorElement:!1,SVGDefsElement:!1,SVGDescElement:!1,SVGDocument:!1,SVGElement:!1,SVGElementInstance:!1,SVGElementInstanceList:!1,SVGEllipseElement:!1,SVGExternalResourcesRequired:!1,SVGFEBlendElement:!1,SVGFEColorMatrixElement:!1,SVGFEComponentTransferElement:!1,SVGFECompositeElement:!1,SVGFEConvolveMatrixElement:!1,SVGFEDiffuseLightingElement:!1,SVGFEDisplacementMapElement:!1,SVGFEDistantLightElement:!1,SVGFEFloodElement:!1,SVGFEFuncAElement:!1,SVGFEFuncBElement:!1,SVGFEFuncGElement:!1,SVGFEFuncRElement:!1,SVGFEGaussianBlurElement:!1,SVGFEImageElement:!1,SVGFEMergeElement:!1,SVGFEMergeNodeElement:!1,SVGFEMorphologyElement:!1,SVGFEOffsetElement:!1,SVGFEPointLightElement:!1,SVGFESpecularLightingElement:!1,SVGFESpotLightElement:!1,SVGFETileElement:!1,SVGFETurbulenceElement:!1,SVGFilterElement:!1,SVGFilterPrimitiveStandardAttributes:!1,SVGFitToViewBox:!1,SVGFontElement:!1,SVGFontFaceElement:!1,SVGFontFaceFormatElement:!1,SVGFontFaceNameElement:!1,SVGFontFaceSrcElement:!1,SVGFontFaceUriElement:!1,SVGForeignObjectElement:!1,SVGGElement:!1,SVGGlyphElement:!1,SVGGlyphRefElement:!1,SVGGradientElement:!1,SVGHKernElement:!1,SVGICCColor:!1,SVGImageElement:!1,SVGLangSpace:!1,SVGLength:!1,SVGLengthList:!1,SVGLineElement:!1,SVGLinearGradientElement:!1,SVGLocatable:!1,SVGMPathElement:!1,SVGMarkerElement:!1,SVGMaskElement:!1,SVGMatrix:!1,SVGMetadataElement:!1,SVGMissingGlyphElement:!1,SVGNumber:!1,SVGNumberList:!1,SVGPaint:!1,SVGPathElement:!1,SVGPathSeg:!1,SVGPathSegArcAbs:!1,SVGPathSegArcRel:!1,SVGPathSegClosePath:!1,SVGPathSegCurvetoCubicAbs:!1,SVGPathSegCurvetoCubicRel:!1,SVGPathSegCurvetoCubicSmoothAbs:!1,SVGPathSegCurvetoCubicSmoothRel:!1,SVGPathSegCurvetoQuadraticAbs:!1,SVGPathSegCurvetoQuadraticRel:!1,SVGPathSegCurvetoQuadraticSmoothAbs:!1,SVGPathSegCurvetoQuadraticSmoothRel:!1,SVGPathSegLinetoAbs:!1,SVGPathSegLinetoHorizontalAbs:!1,SVGPathSegLinetoHorizontalRel:!1,SVGPathSegLinetoRel:!1,SVGPathSegLinetoVerticalAbs:!1,SVGPathSegLinetoVerticalRel:!1,SVGPathSegList:!1,SVGPathSegMovetoAbs:!1,SVGPathSegMovetoRel:!1,SVGPatternElement:!1,SVGPoint:!1,SVGPointList:!1,SVGPolygonElement:!1,SVGPolylineElement:!1,SVGPreserveAspectRatio:!1,SVGRadialGradientElement:!1,SVGRect:!1,SVGRectElement:!1,SVGRenderingIntent:!1,SVGSVGElement:!1,SVGScriptElement:!1,SVGSetElement:!1,SVGStopElement:!1,SVGStringList:!1,SVGStylable:!1,SVGStyleElement:!1,SVGSwitchElement:!1,SVGSymbolElement:!1,SVGTRefElement:!1,SVGTSpanElement:!1,SVGTests:!1,SVGTextContentElement:!1,SVGTextElement:!1,SVGTextPathElement:!1,SVGTextPositioningElement:!1,SVGTitleElement:!1,SVGTransform:!1,SVGTransformList:!1,SVGTransformable:!1,SVGURIReference:!1,SVGUnitTypes:!1,SVGUseElement:!1,SVGVKernElement:!1,SVGViewElement:!1,SVGViewSpec:!1,SVGZoomAndPan:!1,Text:!1,TextDecoder:!1,TextEncoder:!1,TimeEvent:!1,top:!1,URL:!1,WebGLActiveInfo:!1,WebGLBuffer:!1,WebGLContextEvent:!1,WebGLFramebuffer:!1,WebGLProgram:!1,WebGLRenderbuffer:!1,WebGLRenderingContext:!1,WebGLShader:!1,WebGLShaderPrecisionFormat:!1,WebGLTexture:!1,WebGLUniformLocation:!1,WebSocket:!1,window:!1,Window:!1,Worker:!1,XDomainRequest:!1,XMLHttpRequest:!1,XMLSerializer:!1,XPathEvaluator:!1,XPathException:!1,XPathExpression:!1,XPathNamespace:!1,XPathNSResolver:!1,XPathResult:!1},exports.devel={alert:!1,confirm:!1,console:!1,Debug:!1,opera:!1,prompt:!1},exports.worker={importScripts:!0,postMessage:!0,self:!0,FileReaderSync:!0},exports.nonstandard={escape:!1,unescape:!1},exports.couch={require:!1,respond:!1,getRow:!1,emit:!1,send:!1,start:!1,sum:!1,log:!1,exports:!1,module:!1,provides:!1},exports.node={__filename:!1,__dirname:!1,GLOBAL:!1,global:!1,module:!1,acequire:!1,Buffer:!0,console:!0,exports:!0,process:!0,setTimeout:!0,clearTimeout:!0,setInterval:!0,clearInterval:!0,setImmediate:!0,clearImmediate:!0},exports.browserify={__filename:!1,__dirname:!1,global:!1,module:!1,acequire:!1,Buffer:!0,exports:!0,process:!0},exports.phantom={phantom:!0,acequire:!0,WebPage:!0,console:!0,exports:!0},exports.qunit={asyncTest:!1,deepEqual:!1,equal:!1,expect:!1,module:!1,notDeepEqual:!1,notEqual:!1,notPropEqual:!1,notStrictEqual:!1,ok:!1,propEqual:!1,QUnit:!1,raises:!1,start:!1,stop:!1,strictEqual:!1,test:!1,\\\"throws\\\":!1},exports.rhino={defineClass:!1,deserialize:!1,gc:!1,help:!1,importClass:!1,importPackage:!1,java:!1,load:!1,loadClass:!1,Packages:!1,print:!1,quit:!1,readFile:!1,readUrl:!1,runCommand:!1,seal:!1,serialize:!1,spawn:!1,sync:!1,toint32:!1,version:!1},exports.shelljs={target:!1,echo:!1,exit:!1,cd:!1,pwd:!1,ls:!1,find:!1,cp:!1,rm:!1,mv:!1,mkdir:!1,test:!1,cat:!1,sed:!1,grep:!1,which:!1,dirs:!1,pushd:!1,popd:!1,env:!1,exec:!1,chmod:!1,config:!1,error:!1,tempdir:!1},exports.typed={ArrayBuffer:!1,ArrayBufferView:!1,DataView:!1,Float32Array:!1,Float64Array:!1,Int16Array:!1,Int32Array:!1,Int8Array:!1,Uint16Array:!1,Uint32Array:!1,Uint8Array:!1,Uint8ClampedArray:!1},exports.wsh={ActiveXObject:!0,Enumerator:!0,GetObject:!0,ScriptEngine:!0,ScriptEngineBuildVersion:!0,ScriptEngineMajorVersion:!0,ScriptEngineMinorVersion:!0,VBArray:!0,WSH:!0,WScript:!0,XDomainRequest:!0},exports.dojo={dojo:!1,dijit:!1,dojox:!1,define:!1,require:!1},exports.jquery={$:!1,jQuery:!1},exports.mootools={$:!1,$$:!1,Asset:!1,Browser:!1,Chain:!1,Class:!1,Color:!1,Cookie:!1,Core:!1,Document:!1,DomReady:!1,DOMEvent:!1,DOMReady:!1,Drag:!1,Element:!1,Elements:!1,Event:!1,Events:!1,Fx:!1,Group:!1,Hash:!1,HtmlTable:!1,IFrame:!1,IframeShim:!1,InputValidator:!1,instanceOf:!1,Keyboard:!1,Locale:!1,Mask:!1,MooTools:!1,Native:!1,Options:!1,OverText:!1,Request:!1,Scroller:!1,Slick:!1,Slider:!1,Sortables:!1,Spinner:!1,Swiff:!1,Tips:!1,Type:!1,typeOf:!1,URI:!1,Window:!1},exports.prototypejs={$:!1,$$:!1,$A:!1,$F:!1,$H:!1,$R:!1,$break:!1,$continue:!1,$w:!1,Abstract:!1,Ajax:!1,Class:!1,Enumerable:!1,Element:!1,Event:!1,Field:!1,Form:!1,Hash:!1,Insertion:!1,ObjectRange:!1,PeriodicalExecuter:!1,Position:!1,Prototype:!1,Selector:!1,Template:!1,Toggle:!1,Try:!1,Autocompleter:!1,Builder:!1,Control:!1,Draggable:!1,Draggables:!1,Droppables:!1,Effect:!1,Sortable:!1,SortableObserver:!1,Sound:!1,Scriptaculous:!1},exports.yui={YUI:!1,Y:!1,YUI_config:!1},exports.mocha={mocha:!1,describe:!1,xdescribe:!1,it:!1,xit:!1,context:!1,xcontext:!1,before:!1,after:!1,beforeEach:!1,afterEach:!1,suite:!1,test:!1,setup:!1,teardown:!1,suiteSetup:!1,suiteTeardown:!1},exports.jasmine={jasmine:!1,describe:!1,xdescribe:!1,it:!1,xit:!1,beforeEach:!1,afterEach:!1,setFixtures:!1,loadFixtures:!1,spyOn:!1,expect:!1,runs:!1,waitsFor:!1,waits:!1,beforeAll:!1,afterAll:!1,fail:!1,fdescribe:!1,fit:!1,pending:!1}},{}]},{},[\\\"/node_modules/jshint/src/jshint.js\\\"])}),ace.define(\\\"ace/mode/javascript_worker\\\",[\\\"require\\\",\\\"exports\\\",\\\"module\\\",\\\"ace/lib/oop\\\",\\\"ace/worker/mirror\\\",\\\"ace/mode/javascript/jshint\\\"],function(acequire,exports,module){\\\"use strict\\\";function startRegex(arr){return RegExp(\\\"^(\\\"+arr.join(\\\"|\\\")+\\\")\\\")}var oop=acequire(\\\"../lib/oop\\\"),Mirror=acequire(\\\"../worker/mirror\\\").Mirror,lint=acequire(\\\"./javascript/jshint\\\").JSHINT,disabledWarningsRe=startRegex([\\\"Bad for in variable '(.+)'.\\\",'Missing \\\"use strict\\\"']),errorsRe=startRegex([\\\"Unexpected\\\",\\\"Expected \\\",\\\"Confusing (plus|minus)\\\",\\\"\\\\\\\\{a\\\\\\\\} unterminated regular expression\\\",\\\"Unclosed \\\",\\\"Unmatched \\\",\\\"Unbegun comment\\\",\\\"Bad invocation\\\",\\\"Missing space after\\\",\\\"Missing operator at\\\"]),infoRe=startRegex([\\\"Expected an assignment\\\",\\\"Bad escapement of EOL\\\",\\\"Unexpected comma\\\",\\\"Unexpected space\\\",\\\"Missing radix parameter.\\\",\\\"A leading decimal point can\\\",\\\"\\\\\\\\['{a}'\\\\\\\\] is better written in dot notation.\\\",\\\"'{a}' used out of scope\\\"]),JavaScriptWorker=exports.JavaScriptWorker=function(sender){Mirror.call(this,sender),this.setTimeout(500),this.setOptions()};oop.inherits(JavaScriptWorker,Mirror),function(){this.setOptions=function(options){this.options=options||{esnext:!0,moz:!0,devel:!0,browser:!0,node:!0,laxcomma:!0,laxbreak:!0,lastsemic:!0,onevar:!1,passfail:!1,maxerr:100,expr:!0,multistr:!0,globalstrict:!0},this.doc.getValue()&&this.deferredUpdate.schedule(100)},this.changeOptions=function(newOptions){oop.mixin(this.options,newOptions),this.doc.getValue()&&this.deferredUpdate.schedule(100)},this.isValidJS=function(str){try{eval(\\\"throw 0;\\\"+str)}catch(e){if(0===e)return!0}return!1},this.onUpdate=function(){var value=this.doc.getValue();if(value=value.replace(/^#!.*\\\\n/,\\\"\\\\n\\\"),!value)return this.sender.emit(\\\"annotate\\\",[]);var errors=[],maxErrorLevel=this.isValidJS(value)?\\\"warning\\\":\\\"error\\\";lint(value,this.options,this.options.globals);for(var results=lint.errors,errorAdded=!1,i=0;results.length>i;i++){var error=results[i];if(error){var raw=error.raw,type=\\\"warning\\\";if(\\\"Missing semicolon.\\\"==raw){var str=error.evidence.substr(error.character);str=str.charAt(str.search(/\\\\S/)),\\\"error\\\"==maxErrorLevel&&str&&/[\\\\w\\\\d{(['\\\"]/.test(str)?(error.reason='Missing \\\";\\\" before statement',type=\\\"error\\\"):type=\\\"info\\\"}else{if(disabledWarningsRe.test(raw))continue;infoRe.test(raw)?type=\\\"info\\\":errorsRe.test(raw)?(errorAdded=!0,type=maxErrorLevel):\\\"'{a}' is not defined.\\\"==raw?type=\\\"warning\\\":\\\"'{a}' is defined but never used.\\\"==raw&&(type=\\\"info\\\")}errors.push({row:error.line-1,column:error.character-1,text:error.reason,type:type,raw:raw})}}this.sender.emit(\\\"annotate\\\",errors)}}.call(JavaScriptWorker.prototype)}),ace.define(\\\"ace/lib/es5-shim\\\",[\\\"require\\\",\\\"exports\\\",\\\"module\\\"],function(){function Empty(){}function doesDefinePropertyWork(object){try{return Object.defineProperty(object,\\\"sentinel\\\",{}),\\\"sentinel\\\"in object}catch(exception){}}function toInteger(n){return n=+n,n!==n?n=0:0!==n&&n!==1/0&&n!==-(1/0)&&(n=(n>0||-1)*Math.floor(Math.abs(n))),n}Function.prototype.bind||(Function.prototype.bind=function(that){var target=this;if(\\\"function\\\"!=typeof target)throw new TypeError(\\\"Function.prototype.bind called on incompatible \\\"+target);var args=slice.call(arguments,1),bound=function(){if(this instanceof bound){var result=target.apply(this,args.concat(slice.call(arguments)));return Object(result)===result?result:this}return target.apply(that,args.concat(slice.call(arguments)))};return target.prototype&&(Empty.prototype=target.prototype,bound.prototype=new Empty,Empty.prototype=null),bound});var defineGetter,defineSetter,lookupGetter,lookupSetter,supportsAccessors,call=Function.prototype.call,prototypeOfArray=Array.prototype,prototypeOfObject=Object.prototype,slice=prototypeOfArray.slice,_toString=call.bind(prototypeOfObject.toString),owns=call.bind(prototypeOfObject.hasOwnProperty);if((supportsAccessors=owns(prototypeOfObject,\\\"__defineGetter__\\\"))&&(defineGetter=call.bind(prototypeOfObject.__defineGetter__),defineSetter=call.bind(prototypeOfObject.__defineSetter__),lookupGetter=call.bind(prototypeOfObject.__lookupGetter__),lookupSetter=call.bind(prototypeOfObject.__lookupSetter__)),2!=[1,2].splice(0).length)if(function(){function makeArray(l){var a=Array(l+2);return a[0]=a[1]=0,a}var lengthBefore,array=[];return array.splice.apply(array,makeArray(20)),array.splice.apply(array,makeArray(26)),lengthBefore=array.length,array.splice(5,0,\\\"XXX\\\"),lengthBefore+1==array.length,lengthBefore+1==array.length?!0:void 0}()){var array_splice=Array.prototype.splice;Array.prototype.splice=function(start,deleteCount){return arguments.length?array_splice.apply(this,[void 0===start?0:start,void 0===deleteCount?this.length-start:deleteCount].concat(slice.call(arguments,2))):[]}}else Array.prototype.splice=function(pos,removeCount){var length=this.length;pos>0?pos>length&&(pos=length):void 0==pos?pos=0:0>pos&&(pos=Math.max(length+pos,0)),length>pos+removeCount||(removeCount=length-pos);var removed=this.slice(pos,pos+removeCount),insert=slice.call(arguments,2),add=insert.length;if(pos===length)add&&this.push.apply(this,insert);else{var remove=Math.min(removeCount,length-pos),tailOldPos=pos+remove,tailNewPos=tailOldPos+add-remove,tailCount=length-tailOldPos,lengthAfterRemove=length-remove;if(tailOldPos>tailNewPos)for(var i=0;tailCount>i;++i)this[tailNewPos+i]=this[tailOldPos+i];else if(tailNewPos>tailOldPos)for(i=tailCount;i--;)this[tailNewPos+i]=this[tailOldPos+i];if(add&&pos===lengthAfterRemove)this.length=lengthAfterRemove,this.push.apply(this,insert);else for(this.length=lengthAfterRemove+add,i=0;add>i;++i)this[pos+i]=insert[i]}return removed};Array.isArray||(Array.isArray=function(obj){return\\\"[object Array]\\\"==_toString(obj)});var boxedString=Object(\\\"a\\\"),splitString=\\\"a\\\"!=boxedString[0]||!(0 in boxedString);if(Array.prototype.forEach||(Array.prototype.forEach=function(fun){var object=toObject(this),self=splitString&&\\\"[object String]\\\"==_toString(this)?this.split(\\\"\\\"):object,thisp=arguments[1],i=-1,length=self.length>>>0;if(\\\"[object Function]\\\"!=_toString(fun))throw new TypeError;for(;length>++i;)i in self&&fun.call(thisp,self[i],i,object)}),Array.prototype.map||(Array.prototype.map=function(fun){var object=toObject(this),self=splitString&&\\\"[object String]\\\"==_toString(this)?this.split(\\\"\\\"):object,length=self.length>>>0,result=Array(length),thisp=arguments[1];if(\\\"[object Function]\\\"!=_toString(fun))throw new TypeError(fun+\\\" is not a function\\\");for(var i=0;length>i;i++)i in self&&(result[i]=fun.call(thisp,self[i],i,object));return result}),Array.prototype.filter||(Array.prototype.filter=function(fun){var value,object=toObject(this),self=splitString&&\\\"[object String]\\\"==_toString(this)?this.split(\\\"\\\"):object,length=self.length>>>0,result=[],thisp=arguments[1];if(\\\"[object Function]\\\"!=_toString(fun))throw new TypeError(fun+\\\" is not a function\\\");for(var i=0;length>i;i++)i in self&&(value=self[i],fun.call(thisp,value,i,object)&&result.push(value));return result}),Array.prototype.every||(Array.prototype.every=function(fun){var object=toObject(this),self=splitString&&\\\"[object String]\\\"==_toString(this)?this.split(\\\"\\\"):object,length=self.length>>>0,thisp=arguments[1];if(\\\"[object Function]\\\"!=_toString(fun))throw new TypeError(fun+\\\" is not a function\\\");for(var i=0;length>i;i++)if(i in self&&!fun.call(thisp,self[i],i,object))return!1;return!0}),Array.prototype.some||(Array.prototype.some=function(fun){var object=toObject(this),self=splitString&&\\\"[object String]\\\"==_toString(this)?this.split(\\\"\\\"):object,length=self.length>>>0,thisp=arguments[1];if(\\\"[object Function]\\\"!=_toString(fun))throw new TypeError(fun+\\\" is not a function\\\");for(var i=0;length>i;i++)if(i in self&&fun.call(thisp,self[i],i,object))return!0;return!1}),Array.prototype.reduce||(Array.prototype.reduce=function(fun){var object=toObject(this),self=splitString&&\\\"[object String]\\\"==_toString(this)?this.split(\\\"\\\"):object,length=self.length>>>0;if(\\\"[object Function]\\\"!=_toString(fun))throw new TypeError(fun+\\\" is not a function\\\");if(!length&&1==arguments.length)throw new TypeError(\\\"reduce of empty array with no initial value\\\");var result,i=0;if(arguments.length>=2)result=arguments[1];else for(;;){if(i in self){result=self[i++];break}if(++i>=length)throw new TypeError(\\\"reduce of empty array with no initial value\\\")}for(;length>i;i++)i in self&&(result=fun.call(void 0,result,self[i],i,object));return result}),Array.prototype.reduceRight||(Array.prototype.reduceRight=function(fun){var object=toObject(this),self=splitString&&\\\"[object String]\\\"==_toString(this)?this.split(\\\"\\\"):object,length=self.length>>>0;if(\\\"[object Function]\\\"!=_toString(fun))throw new TypeError(fun+\\\" is not a function\\\");if(!length&&1==arguments.length)throw new TypeError(\\\"reduceRight of empty array with no initial value\\\");var result,i=length-1;if(arguments.length>=2)result=arguments[1];else for(;;){if(i in self){result=self[i--];break}if(0>--i)throw new TypeError(\\\"reduceRight of empty array with no initial value\\\")}do i in this&&(result=fun.call(void 0,result,self[i],i,object));while(i--);return result}),Array.prototype.indexOf&&-1==[0,1].indexOf(1,2)||(Array.prototype.indexOf=function(sought){var self=splitString&&\\\"[object String]\\\"==_toString(this)?this.split(\\\"\\\"):toObject(this),length=self.length>>>0;if(!length)return-1;var i=0;for(arguments.length>1&&(i=toInteger(arguments[1])),i=i>=0?i:Math.max(0,length+i);length>i;i++)if(i in self&&self[i]===sought)return i;return-1}),Array.prototype.lastIndexOf&&-1==[0,1].lastIndexOf(0,-3)||(Array.prototype.lastIndexOf=function(sought){var self=splitString&&\\\"[object String]\\\"==_toString(this)?this.split(\\\"\\\"):toObject(this),length=self.length>>>0;if(!length)return-1;var i=length-1;for(arguments.length>1&&(i=Math.min(i,toInteger(arguments[1]))),i=i>=0?i:length-Math.abs(i);i>=0;i--)if(i in self&&sought===self[i])return i;return-1}),Object.getPrototypeOf||(Object.getPrototypeOf=function(object){return object.__proto__||(object.constructor?object.constructor.prototype:prototypeOfObject)}),!Object.getOwnPropertyDescriptor){var ERR_NON_OBJECT=\\\"Object.getOwnPropertyDescriptor called on a non-object: \\\";Object.getOwnPropertyDescriptor=function(object,property){if(\\\"object\\\"!=typeof object&&\\\"function\\\"!=typeof object||null===object)throw new TypeError(ERR_NON_OBJECT+object);if(owns(object,property)){var descriptor,getter,setter;if(descriptor={enumerable:!0,configurable:!0},supportsAccessors){var prototype=object.__proto__;object.__proto__=prototypeOfObject;var getter=lookupGetter(object,property),setter=lookupSetter(object,property);if(object.__proto__=prototype,getter||setter)return getter&&(descriptor.get=getter),setter&&(descriptor.set=setter),descriptor}return descriptor.value=object[property],descriptor}}}if(Object.getOwnPropertyNames||(Object.getOwnPropertyNames=function(object){return Object.keys(object)}),!Object.create){var createEmpty;createEmpty=null===Object.prototype.__proto__?function(){return{__proto__:null}}:function(){var empty={};for(var i in empty)empty[i]=null;return empty.constructor=empty.hasOwnProperty=empty.propertyIsEnumerable=empty.isPrototypeOf=empty.toLocaleString=empty.toString=empty.valueOf=empty.__proto__=null,empty},Object.create=function(prototype,properties){var object;if(null===prototype)object=createEmpty();else{if(\\\"object\\\"!=typeof prototype)throw new TypeError(\\\"typeof prototype[\\\"+typeof prototype+\\\"] != 'object'\\\");var Type=function(){};Type.prototype=prototype,object=new Type,object.__proto__=prototype}return void 0!==properties&&Object.defineProperties(object,properties),object}}if(Object.defineProperty){var definePropertyWorksOnObject=doesDefinePropertyWork({}),definePropertyWorksOnDom=\\\"undefined\\\"==typeof document||doesDefinePropertyWork(document.createElement(\\\"div\\\"));if(!definePropertyWorksOnObject||!definePropertyWorksOnDom)var definePropertyFallback=Object.defineProperty}if(!Object.defineProperty||definePropertyFallback){var ERR_NON_OBJECT_DESCRIPTOR=\\\"Property description must be an object: \\\",ERR_NON_OBJECT_TARGET=\\\"Object.defineProperty called on non-object: \\\",ERR_ACCESSORS_NOT_SUPPORTED=\\\"getters & setters can not be defined on this javascript engine\\\";Object.defineProperty=function(object,property,descriptor){if(\\\"object\\\"!=typeof object&&\\\"function\\\"!=typeof object||null===object)throw new TypeError(ERR_NON_OBJECT_TARGET+object);if(\\\"object\\\"!=typeof descriptor&&\\\"function\\\"!=typeof descriptor||null===descriptor)throw new TypeError(ERR_NON_OBJECT_DESCRIPTOR+descriptor);if(definePropertyFallback)try{return definePropertyFallback.call(Object,object,property,descriptor)}catch(exception){}if(owns(descriptor,\\\"value\\\"))if(supportsAccessors&&(lookupGetter(object,property)||lookupSetter(object,property))){var prototype=object.__proto__;object.__proto__=prototypeOfObject,delete object[property],object[property]=descriptor.value,object.__proto__=prototype}else object[property]=descriptor.value;else{if(!supportsAccessors)throw new TypeError(ERR_ACCESSORS_NOT_SUPPORTED);owns(descriptor,\\\"get\\\")&&defineGetter(object,property,descriptor.get),owns(descriptor,\\\"set\\\")&&defineSetter(object,property,descriptor.set)}return object}}Object.defineProperties||(Object.defineProperties=function(object,properties){for(var property in properties)owns(properties,property)&&Object.defineProperty(object,property,properties[property]);return object}),Object.seal||(Object.seal=function(object){return object}),Object.freeze||(Object.freeze=function(object){return object});try{Object.freeze(function(){})}catch(exception){Object.freeze=function(freezeObject){return function(object){return\\\"function\\\"==typeof object?object:freezeObject(object)}}(Object.freeze)}if(Object.preventExtensions||(Object.preventExtensions=function(object){return object}),Object.isSealed||(Object.isSealed=function(){return!1}),Object.isFrozen||(Object.isFrozen=function(){return!1}),Object.isExtensible||(Object.isExtensible=function(object){if(Object(object)===object)throw new TypeError;for(var name=\\\"\\\";owns(object,name);)name+=\\\"?\\\";object[name]=!0;var returnValue=owns(object,name);return delete object[name],returnValue}),!Object.keys){var hasDontEnumBug=!0,dontEnums=[\\\"toString\\\",\\\"toLocaleString\\\",\\\"valueOf\\\",\\\"hasOwnProperty\\\",\\\"isPrototypeOf\\\",\\\"propertyIsEnumerable\\\",\\\"constructor\\\"],dontEnumsLength=dontEnums.length;for(var key in{toString:null})hasDontEnumBug=!1;Object.keys=function(object){if(\\\"object\\\"!=typeof object&&\\\"function\\\"!=typeof object||null===object)throw new TypeError(\\\"Object.keys called on a non-object\\\");var keys=[];for(var name in object)owns(object,name)&&keys.push(name);if(hasDontEnumBug)for(var i=0,ii=dontEnumsLength;ii>i;i++){var dontEnum=dontEnums[i];owns(object,dontEnum)&&keys.push(dontEnum)}return keys}}Date.now||(Date.now=function(){return(new Date).getTime()});var ws=\\\"\\t\\\\n\\u000b\\\\f\\\\r    \\\\u2028\\\\u2029\\\";if(!String.prototype.trim||ws.trim()){ws=\\\"[\\\"+ws+\\\"]\\\";var trimBeginRegexp=RegExp(\\\"^\\\"+ws+ws+\\\"*\\\"),trimEndRegexp=RegExp(ws+ws+\\\"*$\\\");String.prototype.trim=function(){return(this+\\\"\\\").replace(trimBeginRegexp,\\\"\\\").replace(trimEndRegexp,\\\"\\\")}}var toObject=function(o){if(null==o)throw new TypeError(\\\"can't convert \\\"+o+\\\" to object\\\");return Object(o)}});\";","var rng = require('./lib/rng');\nvar bytesToUuid = require('./lib/bytesToUuid');\n\nfunction v4(options, buf, offset) {\n var i = buf && offset || 0;\n\n if (typeof(options) == 'string') {\n buf = options === 'binary' ? new Array(16) : null;\n options = null;\n }\n options = options || {};\n\n var rnds = options.random || (options.rng || rng)();\n\n // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`\n rnds[6] = (rnds[6] & 0x0f) | 0x40;\n rnds[8] = (rnds[8] & 0x3f) | 0x80;\n\n // Copy bytes to buffer, if provided\n if (buf) {\n for (var ii = 0; ii < 16; ++ii) {\n buf[i + ii] = rnds[ii];\n }\n }\n\n return buf || bytesToUuid(rnds);\n}\n\nmodule.exports = v4;\n","import {Faction, joinFaction} from \"../src/Faction.js\";\r\nimport {Engine} from \"../src/engine.js\";\r\nimport {Player} from \"../src/Player.js\";\r\nimport {clearEventListeners} from \"./HelperFunctions.js\";\r\n\r\n/* Faction Invitation Pop-up box */\r\nfunction factionInvitationBoxClose() {\r\n var factionInvitationBox = document.getElementById(\"faction-invitation-box-container\");\r\n factionInvitationBox.style.display = \"none\";\r\n}\r\n\r\nfunction factionInvitationBoxOpen() {\r\n var factionInvitationBox = document.getElementById(\"faction-invitation-box-container\");\r\n factionInvitationBox.style.display = \"block\";\r\n}\r\n\r\nfunction factionInvitationSetText(txt) {\r\n var textBox = document.getElementById(\"faction-invitation-box-text\");\r\n textBox.innerHTML = txt;\r\n}\r\n\r\nfunction factionInvitationSetMessage(msg) {\r\n var msgBox = document.getElementById(\"faction-invitation-box-message\");\r\n msgBox.innerHTML = msg;\r\n}\r\n\r\n//ram argument is in GB\r\nfunction factionInvitationBoxCreate(faction) {\r\n factionInvitationSetText(\"You have received a faction invitation from \" + faction.name);\r\n faction.alreadyInvited = true;\r\n Player.factionInvitations.push(faction.name);\r\n\r\n if (Engine.currentPage === Engine.Page.Factions) {\r\n Engine.loadFactionsContent();\r\n }\r\n\r\n var newYesButton = clearEventListeners(\"faction-invitation-box-yes\");\r\n newYesButton.addEventListener(\"click\", function() {\r\n //Remove from invited factions\r\n var i = Player.factionInvitations.findIndex((facName)=>{return facName === faction.name});\r\n if (i === -1) {\r\n console.log(\"ERROR: Could not find faction in Player.factionInvitations\");\r\n } else {\r\n Player.factionInvitations.splice(i, 1);\r\n }\r\n joinFaction(faction);\r\n factionInvitationBoxClose();\r\n if (Engine.currentPage === Engine.Page.Factions) {\r\n Engine.loadFactionsContent();\r\n }\r\n return false;\r\n });\r\n\r\n var noButton = clearEventListeners(\"faction-invitation-box-no\");\r\n noButton.addEventListener(\"click\", function() {\r\n factionInvitationBoxClose();\r\n return false;\r\n });\r\n\r\n factionInvitationBoxOpen();\r\n}\r\n\r\nexport {factionInvitationBoxCreate};\r\n","import {BitNodeMultipliers} from \"../src/BitNode.js\";\r\nimport {CONSTANTS} from \"../src/Constants.js\";\r\nimport {Factions, Faction} from \"../src/Faction.js\";\r\nimport {Player} from \"../src/Player.js\";\r\nimport {dialogBoxCreate} from \"./DialogBox.js\";\r\nimport {clearEventListeners} from \"./HelperFunctions.js\";\r\nimport {formatNumber} from \"./StringHelperFunctions.js\";\r\n\r\n/* InfiltrationBox.js */\r\nfunction infiltrationBoxClose() {\r\n var box = document.getElementById(\"infiltration-box-container\");\r\n box.style.display = \"none\";\r\n}\r\n\r\nfunction infiltrationBoxOpen() {\r\n var box = document.getElementById(\"infiltration-box-container\");\r\n box.style.display = \"block\";\r\n}\r\n\r\nfunction infiltrationSetText(txt) {\r\n var textBox = document.getElementById(\"infiltration-box-text\");\r\n textBox.innerHTML = txt;\r\n}\r\n\r\n//ram argument is in GB\r\nfunction infiltrationBoxCreate(inst) {\r\n //Gain exp\r\n var expMultiplier = 2 * inst.clearanceLevel / inst.maxClearanceLevel;\r\n Player.gainHackingExp(inst.hackingExpGained * expMultiplier);\r\n Player.gainStrengthExp(inst.strExpGained * expMultiplier);\r\n Player.gainDefenseExp(inst.defExpGained * expMultiplier);\r\n Player.gainDexterityExp(inst.dexExpGained * expMultiplier);\r\n Player.gainAgilityExp(inst.agiExpGained * expMultiplier);\r\n Player.gainCharismaExp(inst.chaExpGained * expMultiplier);\r\n Player.gainIntelligenceExp(inst.intExpGained * expMultiplier);\r\n\r\n var totalValue = 0;\r\n for (var i = 0; i < inst.secretsStolen.length; ++i) {\r\n totalValue += inst.secretsStolen[i];\r\n }\r\n if (totalValue == 0) {\r\n dialogBoxCreate(\"You successfully escaped the facility but you did not steal \" +\r\n \"anything of worth when infiltrating.<br><br>\" +\r\n \"You gained:<br>\" +\r\n formatNumber(inst.hackingExpGained, 3) + \" hacking exp<br>\" +\r\n formatNumber(inst.strExpGained, 3) + \" str exp<br>\" +\r\n formatNumber(inst.defExpGained, 3) + \" def exp<br>\" +\r\n formatNumber(inst.dexExpGained, 3) + \" dex exp<br>\" +\r\n formatNumber(inst.agiExpGained, 3) + \" agi exp<br>\" +\r\n formatNumber(inst.chaExpGained, 3) + \" cha exp<br>\");\r\n return;\r\n }\r\n var facValue = totalValue * Player.faction_rep_mult *\r\n CONSTANTS.InfiltrationRepValue * BitNodeMultipliers.InfiltrationRep;\r\n var moneyValue = totalValue * CONSTANTS.InfiltrationMoneyValue * BitNodeMultipliers.InfiltrationMoney;\r\n infiltrationSetText(\"You can sell the classified documents and secrets \" +\r\n \"you stole from \" + inst.companyName + \" for $\" +\r\n formatNumber(moneyValue, 2) + \" on the black market or you can give it \" +\r\n \"to a faction to gain \" + formatNumber(facValue, 3) + \" reputation with \" +\r\n \"that faction.\");\r\n var selector = document.getElementById(\"infiltration-faction-select\");\r\n selector.innerHTML = \"\";\r\n for (var i = 0; i < Player.factions.length; ++i) {\r\n if (Player.factions[i] === \"Bladeburners\") {continue;}\r\n selector.innerHTML += \"<option value='\" + Player.factions[i] +\r\n \"'>\" + Player.factions[i] + \"</option>\";\r\n }\r\n\r\n var sellButton = clearEventListeners(\"infiltration-box-sell\");\r\n setTimeout(function() {\r\n sellButton.addEventListener(\"click\", function() {\r\n Player.gainMoney(moneyValue);\r\n dialogBoxCreate(\"You sold the classified information you stole from \" + inst.companyName +\r\n \" for $\" + moneyValue + \" on the black market!<br><br>\" +\r\n \"You gained:<br>\" +\r\n formatNumber(inst.hackingExpGained, 3) + \" hacking exp<br>\" +\r\n formatNumber(inst.strExpGained, 3) + \" str exp<br>\" +\r\n formatNumber(inst.defExpGained, 3) + \" def exp<br>\" +\r\n formatNumber(inst.dexExpGained, 3) + \" dex exp<br>\" +\r\n formatNumber(inst.agiExpGained, 3) + \" agi exp<br>\" +\r\n formatNumber(inst.chaExpGained, 3) + \" cha exp<br>\");\r\n infiltrationBoxClose();\r\n return false;\r\n });\r\n }, 750);\r\n\r\n var factionButton = clearEventListeners(\"infiltration-box-faction\");\r\n setTimeout(function() {\r\n factionButton.addEventListener(\"click\", function() {\r\n var facName = selector.options[selector.selectedIndex].value;\r\n var faction = Factions[facName];\r\n if (faction == null) {\r\n dialogBoxCreate(\"Error finding faction. This is a bug please report to developer\");\r\n return false;\r\n }\r\n faction.playerReputation += facValue;\r\n dialogBoxCreate(\"You gave the classified information you stole from \" + inst.companyName +\r\n \" to \" + facName + \" and gained \" + formatNumber(facValue, 3) + \" reputation with the faction. <br><br>\" +\r\n \"You gained:<br>\" +\r\n formatNumber(inst.hackingExpGained, 3) + \" hacking exp<br>\" +\r\n formatNumber(inst.strExpGained, 3) + \" str exp<br>\" +\r\n formatNumber(inst.defExpGained, 3) + \" def exp<br>\" +\r\n formatNumber(inst.dexExpGained, 3) + \" dex exp<br>\" +\r\n formatNumber(inst.agiExpGained, 3) + \" agi exp<br>\" +\r\n formatNumber(inst.chaExpGained, 3) + \" cha exp<br>\");\r\n infiltrationBoxClose();\r\n return false;\r\n });\r\n }, 750);\r\n infiltrationBoxOpen();\r\n}\r\n\r\nexport {infiltrationBoxCreate};\r\n","import {BitNodeMultipliers} from \"./BitNode.js\";\r\nimport {CONSTANTS} from \"./Constants.js\";\r\nimport {Engine} from \"./engine.js\";\r\nimport {Player} from \"./Player.js\";\r\nimport {dialogBoxCreate} from \"../utils/DialogBox.js\";\r\nimport {clearEventListeners, getRandomInt} from \"../utils/HelperFunctions.js\";\r\nimport {infiltrationBoxCreate} from \"../utils/InfiltrationBox.js\";\r\nimport {formatNumber} from \"../utils/StringHelperFunctions.js\";\r\n\r\n/* Infiltration.js\r\n *\r\n * Kill\r\n * Knockout (nonlethal)\r\n * Stealth Knockout (nonlethal)\r\n * Assassinate\r\n *\r\n * Hack Security\r\n * Destroy Security\r\n * Sneak past Security\r\n *\r\n * Pick the locked door\r\n *\r\n * Bribe security\r\n *\r\n * Escape\r\n */\r\n\r\nlet InfiltrationScenarios = {\r\n Guards: \"You see an armed security guard patrolling the area.\",\r\n TechOnly: \"The area is equipped with a state-of-the-art security system: cameras, laser tripwires, and sentry turrets.\",\r\n TechOrLockedDoor: \"The area is equipped with a state-of-the-art security system. There is a locked door on the side of the \" +\r\n \"room that can be used to bypass security.\",\r\n Bots: \"You see a few security bots patrolling the area.\",\r\n}\r\n\r\nfunction InfiltrationInstance(companyName, startLevel, val, maxClearance, diff) {\r\n this.companyName = companyName;\r\n this.clearanceLevel = 0;\r\n this.maxClearanceLevel = maxClearance;\r\n this.securityLevel = startLevel;\r\n this.difficulty = diff; //Affects how much security level increases. Represents a percentage\r\n this.baseValue = val; //Base value of company secrets\r\n this.secretsStolen = []; //Numbers representing value of stolen secrets\r\n\r\n this.hackingExpGained = 0;\r\n this.strExpGained = 0;\r\n this.defExpGained = 0;\r\n this.dexExpGained = 0;\r\n this.agiExpGained = 0;\r\n this.chaExpGained = 0;\r\n this.intExpGained = 0;\r\n}\r\n\r\nInfiltrationInstance.prototype.gainHackingExp = function(amt) {\r\n if (isNaN(amt)) {return;}\r\n this.hackingExpGained += amt;\r\n}\r\n\r\nInfiltrationInstance.prototype.gainStrengthExp = function(amt) {\r\n if (isNaN(amt)) {return;}\r\n this.strExpGained += amt;\r\n}\r\n\r\nInfiltrationInstance.prototype.gainDefenseExp = function(amt) {\r\n if (isNaN(amt)) {return;}\r\n this.defExpGained += amt;\r\n}\r\n\r\nInfiltrationInstance.prototype.gainDexterityExp = function(amt) {\r\n if (isNaN(amt)) {return;}\r\n this.dexExpGained += amt;\r\n}\r\n\r\nInfiltrationInstance.prototype.gainAgilityExp = function(amt) {\r\n if (isNaN(amt)) {return;}\r\n this.agiExpGained += amt;\r\n}\r\n\r\nInfiltrationInstance.prototype.gainCharismaExp = function(amt) {\r\n if (isNaN(amt)) {return;}\r\n this.chaExpGained += amt;\r\n}\r\n\r\nInfiltrationInstance.prototype.gainIntelligenceExp = function(amt) {\r\n if (isNaN(amt)) {return;}\r\n this.intExpGained += amt;\r\n}\r\n\r\nfunction beginInfiltration(companyName, startLevel, val, maxClearance, diff) {\r\n var inst = new InfiltrationInstance(companyName, startLevel, val, maxClearance, diff);\r\n clearInfiltrationStatusText();\r\n nextInfiltrationLevel(inst);\r\n}\r\n\r\nfunction endInfiltration(inst, success) {\r\n if (success) {infiltrationBoxCreate(inst);}\r\n\r\n clearEventListeners(\"infiltration-kill\");\r\n clearEventListeners(\"infiltration-knockout\");\r\n clearEventListeners(\"infiltration-stealthknockout\");\r\n clearEventListeners(\"infiltration-assassinate\");\r\n clearEventListeners(\"infiltration-hacksecurity\");\r\n clearEventListeners(\"infiltration-destroysecurity\");\r\n clearEventListeners(\"infiltration-sneak\");\r\n clearEventListeners(\"infiltration-pickdoor\");\r\n clearEventListeners(\"infiltration-bribe\");\r\n clearEventListeners(\"infiltration-escape\");\r\n\r\n Engine.loadWorldContent();\r\n}\r\n\r\nfunction nextInfiltrationLevel(inst) {\r\n ++inst.clearanceLevel;\r\n updateInfiltrationLevelText(inst);\r\n\r\n //Buttons\r\n var killButton = clearEventListeners(\"infiltration-kill\");\r\n var knockoutButton = clearEventListeners(\"infiltration-knockout\");\r\n var stealthKnockoutButton = clearEventListeners(\"infiltration-stealthknockout\");\r\n var assassinateButton = clearEventListeners(\"infiltration-assassinate\");\r\n var hackSecurityButton = clearEventListeners(\"infiltration-hacksecurity\");\r\n var destroySecurityButton = clearEventListeners(\"infiltration-destroysecurity\");\r\n var sneakButton = clearEventListeners(\"infiltration-sneak\");\r\n var pickdoorButton = clearEventListeners(\"infiltration-pickdoor\");\r\n var bribeButton = clearEventListeners(\"infiltration-bribe\");\r\n var escapeButton = clearEventListeners(\"infiltration-escape\");\r\n\r\n killButton.style.display = \"none\";\r\n knockoutButton.style.display = \"none\";\r\n stealthKnockoutButton.style.display = \"none\";\r\n assassinateButton.style.display = \"none\";\r\n hackSecurityButton.style.display = \"none\";\r\n destroySecurityButton.style.display = \"none\";\r\n sneakButton.style.display = \"none\";\r\n pickdoorButton.style.display = \"none\";\r\n bribeButton.style.display = \"none\";\r\n escapeButton.style.display = \"none\";\r\n\r\n var rand = getRandomInt(0, 5); //This needs to change if more scenarios are added\r\n var scenario = null;\r\n switch (rand) {\r\n case 1:\r\n scenario = InfiltrationScenarios.TechOnly;\r\n hackSecurityButton.style.display = \"block\";\r\n destroySecurityButton.style.display = \"block\";\r\n sneakButton.style.display = \"block\";\r\n escapeButton.style.display = \"block\";\r\n break;\r\n case 2:\r\n scenario = InfiltrationScenarios.TechOrLockedDoor;\r\n hackSecurityButton.style.display = \"block\";\r\n destroySecurityButton.style.display = \"block\";\r\n sneakButton.style.display = \"block\";\r\n pickdoorButton.style.display = \"block\";\r\n escapeButton.style.display = \"block\";\r\n break;\r\n case 3:\r\n scenario = InfiltrationScenarios.Bots;\r\n killButton.style.display = \"block\";\r\n killButton.addEventListener(\"click\", function() {\r\n var res = attemptInfiltrationKill(inst);\r\n if (res[0]) {\r\n writeInfiltrationStatusText(\"You SUCCESSFULLY killed the security bots! Unfortunately you alerted the \" +\r\n \"rest of the facility's security. The facility's security \" +\r\n \"level increased by \" + formatNumber((res[1]*100)-100, 2).toString() + \"%\");\r\n Player.karma -= 1;\r\n endInfiltrationLevel(inst);\r\n return false;\r\n } else {\r\n var dmgTaken = Math.max(1, Math.round(1.5 * inst.securityLevel / Player.defense));\r\n writeInfiltrationStatusText(\"You FAILED to kill the security bots. The bots fight back \" +\r\n \"and raise the alarm! You take \" + dmgTaken + \" damage and \" +\r\n \"the facility's security level increases by \" +\r\n formatNumber((res[1]*100)-100, 2).toString() + \"%\");\r\n if (Player.takeDamage(dmgTaken)) {\r\n endInfiltration(inst, false);\r\n }\r\n }\r\n updateInfiltrationButtons(inst, scenario);\r\n updateInfiltrationLevelText(inst);\r\n });\r\n assassinateButton.style.display = \"block\";\r\n assassinateButton.addEventListener(\"click\", function() {\r\n var res = attemptInfiltrationAssassinate(inst);\r\n if (res[0]) {\r\n writeInfiltrationStatusText(\"You SUCCESSFULLY assassinated the security bots without being detected!\");\r\n Player.karma -= 1;\r\n endInfiltrationLevel(inst);\r\n return false;\r\n } else {\r\n writeInfiltrationStatusText(\"You FAILED to assassinate the security bots. The bots have not detected \" +\r\n \"you but are now more alert for an intruder. The facility's security level \" +\r\n \"has increased by \" + formatNumber((res[1]*100)-100, 2).toString() + \"%\");\r\n }\r\n updateInfiltrationButtons(inst, scenario);\r\n updateInfiltrationLevelText(inst);\r\n });\r\n hackSecurityButton.style.display = \"block\";\r\n sneakButton.style.display = \"block\";\r\n escapeButton.style.display = \"block\";\r\n break;\r\n default: //0, 4-5\r\n scenario = InfiltrationScenarios.Guards;\r\n killButton.style.display = \"block\";\r\n killButton.addEventListener(\"click\", function() {\r\n var res = attemptInfiltrationKill(inst);\r\n if (res[0]) {\r\n writeInfiltrationStatusText(\"You SUCCESSFULLY killed the security guard! Unfortunately you alerted the \" +\r\n \"rest of the facility's security. The facility's security \" +\r\n \"level has increased by \" + formatNumber((res[1]*100)-100, 2).toString() + \"%\");\r\n Player.karma -= 3;\r\n ++Player.numPeopleKilled;\r\n endInfiltrationLevel(inst);\r\n return false;\r\n } else {\r\n var dmgTaken = Math.max(1, Math.round(inst.securityLevel / Player.defense));\r\n writeInfiltrationStatusText(\"You FAILED to kill the security guard. The guard fights back \" +\r\n \"and raises the alarm! You take \" + dmgTaken + \" damage and \" +\r\n \"the facility's security level has increased by \" +\r\n formatNumber((res[1]*100)-100, 2).toString() + \"%\");\r\n if (Player.takeDamage(dmgTaken)) {\r\n endInfiltration(inst, false);\r\n }\r\n }\r\n updateInfiltrationButtons(inst, scenario);\r\n updateInfiltrationLevelText(inst);\r\n });\r\n knockoutButton.style.display = \"block\";\r\n stealthKnockoutButton.style.display = \"block\";\r\n assassinateButton.style.display = \"block\";\r\n assassinateButton.addEventListener(\"click\", function() {\r\n var res = attemptInfiltrationAssassinate(inst);\r\n if (res[0]) {\r\n writeInfiltrationStatusText(\"You SUCCESSFULLY assassinated the security guard without being detected!\");\r\n Player.karma -= 3;\r\n ++Player.numPeopleKilled;\r\n endInfiltrationLevel(inst);\r\n return false;\r\n } else {\r\n writeInfiltrationStatusText(\"You FAILED to assassinate the security guard. The guard has not detected \" +\r\n \"you but is now more alert for an intruder. The facility's security level \" +\r\n \"has increased by \" + formatNumber((res[1]*100)-100, 2).toString() + \"%\");\r\n }\r\n updateInfiltrationButtons(inst, scenario);\r\n updateInfiltrationLevelText(inst);\r\n });\r\n sneakButton.style.display = \"block\";\r\n bribeButton.style.display = \"block\";\r\n escapeButton.style.display = \"block\";\r\n break;\r\n }\r\n\r\n knockoutButton.addEventListener(\"click\", function() {\r\n var res = attemptInfiltrationKnockout(inst);\r\n if (res[0]) {\r\n writeInfiltrationStatusText(\"You SUCCESSFULLY knocked out the security guard! \" +\r\n \"Unfortunately you made a lot of noise and alerted other security.\");\r\n writeInfiltrationStatusText(\"The facility's security level increased by \" + formatNumber((res[1]*100)-100, 2).toString() + \"%\");\r\n endInfiltrationLevel(inst);\r\n return false;\r\n } else {\r\n var dmgTaken = Math.max(1, Math.round(inst.securityLevel / Player.defense));\r\n writeInfiltrationStatusText(\"You FAILED to knockout the security guard. The guard \" +\r\n \"raises the alarm and fights back! You take \" + dmgTaken + \" damage and \" +\r\n \"the facility's security level increases by \" + formatNumber((res[1]*100)-100, 2).toString() + \"%\");\r\n if (Player.takeDamage(dmgTaken)) {\r\n endInfiltration(inst, false);\r\n }\r\n }\r\n updateInfiltrationButtons(inst, scenario);\r\n updateInfiltrationLevelText(inst);\r\n return false;\r\n });\r\n\r\n stealthKnockoutButton.addEventListener(\"click\", function() {\r\n var res = attemptInfiltrationStealthKnockout(inst);\r\n if (res[0]) {\r\n writeInfiltrationStatusText(\"You SUCCESSFULLY knocked out the security guard without making \" +\r\n \"any noise!\");\r\n endInfiltrationLevel(inst);\r\n return false;\r\n } else {\r\n var dmgTaken = Math.max(1, Math.round(inst.securityLevel / Player.defense));\r\n writeInfiltrationStatusText(\"You FAILED to stealthily knockout the security guard. The guard \" +\r\n \"raises the alarm and fights back! You take \" + dmgTaken + \" damage and \" +\r\n \"the facility's security level increases by \" + formatNumber((res[1]*100)-100, 2).toString() + \"%\");\r\n if (Player.takeDamage(dmgTaken)) {\r\n endInfiltration(inst, false);\r\n }\r\n }\r\n updateInfiltrationButtons(inst, scenario);\r\n updateInfiltrationLevelText(inst);\r\n return false;\r\n });\r\n\r\n hackSecurityButton.addEventListener(\"click\", function() {\r\n var res = attemptInfiltrationHack(inst);\r\n if (res[0]) {\r\n writeInfiltrationStatusText(\"You SUCCESSFULLY hacked and disabled the security system!\");\r\n writeInfiltrationStatusText(\"The facility's security level increased by \" + ((res[1]*100) - 100).toString() + \"%\");\r\n endInfiltrationLevel(inst);\r\n return false;\r\n } else {\r\n writeInfiltrationStatusText(\"You FAILED to hack the security system. The facility's \" +\r\n \"security level increased by \" + formatNumber((res[1]*100)-100, 2).toString() + \"%\");\r\n }\r\n updateInfiltrationButtons(inst, scenario);\r\n updateInfiltrationLevelText(inst);\r\n return false;\r\n });\r\n\r\n destroySecurityButton.addEventListener(\"click\", function() {\r\n var res = attemptInfiltrationDestroySecurity(inst);\r\n if (res[0]) {\r\n writeInfiltrationStatusText(\"You SUCCESSFULLY and violently destroy the security system!\");\r\n writeInfiltrationStatusText(\"The facility's security level increased by \" + formatNumber((res[1]*100)-100, 2).toString() + \"%\");\r\n endInfiltrationLevel(inst);\r\n return false;\r\n } else {\r\n writeInfiltrationStatusText(\"You FAILED to destroy the security system. The facility's \" +\r\n \"security level increased by \" + formatNumber((res[1]*100)-100, 2).toString() + \"%\");\r\n }\r\n updateInfiltrationButtons(inst, scenario);\r\n updateInfiltrationLevelText(inst);\r\n return false;\r\n });\r\n\r\n sneakButton.addEventListener(\"click\", function() {\r\n var res = attemptInfiltrationSneak(inst);\r\n if (res[0]) {\r\n writeInfiltrationStatusText(\"You SUCCESSFULLY sneak past the security undetected!\");\r\n endInfiltrationLevel(inst);\r\n return false;\r\n } else {\r\n writeInfiltrationStatusText(\"You FAILED and were detected while trying to sneak past security! The facility's \" +\r\n \"security level increased by \" + formatNumber((res[1]*100)-100, 2).toString() + \"%\");\r\n }\r\n updateInfiltrationButtons(inst, scenario);\r\n updateInfiltrationLevelText(inst);\r\n return false;\r\n });\r\n\r\n pickdoorButton.addEventListener(\"click\", function() {\r\n var res = attemptInfiltrationPickLockedDoor(inst);\r\n if (res[0]) {\r\n writeInfiltrationStatusText(\"You SUCCESSFULLY pick the locked door!\");\r\n writeInfiltrationStatusText(\"The facility's security level increased by \" + formatNumber((res[1]*100)-100, 2).toString() + \"%\");\r\n endInfiltrationLevel(inst);\r\n return false;\r\n } else {\r\n writeInfiltrationStatusText(\"You FAILED to pick the locked door. The facility's security level \" +\r\n \"increased by \" + formatNumber((res[1]*100)-100, 2).toString() + \"%\");\r\n }\r\n updateInfiltrationButtons(inst, scenario);\r\n updateInfiltrationLevelText(inst);\r\n return false;\r\n });\r\n\r\n bribeButton.addEventListener(\"click\", function() {\r\n var bribeAmt = CONSTANTS.InfiltrationBribeBaseAmount * inst.clearanceLevel;\r\n if (Player.money.lt(bribeAmt)) {\r\n writeInfiltrationStatusText(\"You do not have enough money to bribe the guard. \" +\r\n \"You need $\" + bribeAmt);\r\n return false;\r\n }\r\n var res = attemptInfiltrationBribe(inst);\r\n if (res[0]) {\r\n writeInfiltrationStatusText(\"You SUCCESSFULLY bribed a guard to let you through \" +\r\n \"to the next clearance level for $\" + bribeAmt);\r\n Player.loseMoney(bribeAmt);\r\n endInfiltrationLevel(inst);\r\n return false;\r\n } else {\r\n writeInfiltrationStatusText(\"You FAILED to bribe a guard! The guard is alerting \" +\r\n \"other security guards about your presence! The facility's \" +\r\n \"security level increased by \" + formatNumber((res[1]*100)-100, 2).toString() + \"%\");\r\n }\r\n updateInfiltrationButtons(inst, scenario);\r\n updateInfiltrationLevelText(inst);\r\n return false;\r\n });\r\n\r\n escapeButton.addEventListener(\"click\", function() {\r\n var res = attemptInfiltrationEscape(inst);\r\n if (res[0]) {\r\n writeInfiltrationStatusText(\"You SUCCESSFULLY escape from the facility with the stolen classified \" +\r\n \"documents and company secrets!\");\r\n endInfiltration(inst, true);\r\n return false;\r\n } else {\r\n writeInfiltrationStatusText(\"You FAILED to escape from the facility. You took 1 damage. The facility's \" +\r\n \"security level increased by \" + formatNumber((res[1]*100)-100, 2).toString() + \"%\");\r\n if (Player.takeDamage(1)) {\r\n endInfiltration(inst, false);\r\n }\r\n }\r\n updateInfiltrationButtons(inst, scenario);\r\n updateInfiltrationLevelText(inst);\r\n return false;\r\n });\r\n\r\n updateInfiltrationButtons(inst, scenario);\r\n writeInfiltrationStatusText(\"\");\r\n writeInfiltrationStatusText(\"You are now on clearance level \" + inst.clearanceLevel + \".<br>\" +\r\n scenario);\r\n}\r\n\r\n\r\nfunction endInfiltrationLevel(inst) {\r\n //Check if you gained any secrets\r\n if (inst.clearanceLevel % 5 == 0) {\r\n var baseSecretValue = inst.baseValue * inst.clearanceLevel / 2;\r\n var secretValue = baseSecretValue * Player.faction_rep_mult *\r\n CONSTANTS.InfiltrationRepValue * BitNodeMultipliers.InfiltrationRep;\r\n var secretMoneyValue = baseSecretValue * CONSTANTS.InfiltrationMoneyValue *\r\n BitNodeMultipliers.InfiltrationMoney;\r\n inst.secretsStolen.push(baseSecretValue);\r\n dialogBoxCreate(\"You found and stole a set of classified documents from the company. \" +\r\n \"These classified secrets could probably be sold for money ($\" +\r\n formatNumber(secretMoneyValue, 2) + \"), or they \" +\r\n \"could be given to factions for reputation (\" + formatNumber(secretValue, 3) + \" rep)\");\r\n }\r\n\r\n //Increase security level based on difficulty\r\n inst.securityLevel *= (1 + (inst.difficulty / 100));\r\n writeInfiltrationStatusText(\"You move on to the facility's next clearance level. This \" +\r\n \"clearance level has \" + inst.difficulty + \"% higher security\");\r\n\r\n //If this is max level, force endInfiltration\r\n if (inst.clearanceLevel >= inst.maxClearanceLevel) {\r\n endInfiltration(inst, true);\r\n } else {\r\n nextInfiltrationLevel(inst);\r\n }\r\n}\r\n\r\nfunction writeInfiltrationStatusText(txt) {\r\n var statusTxt = document.getElementById(\"infiltration-status-text\");\r\n statusTxt.innerHTML += (txt + \"<br>\");\r\n statusTxt.parentElement.scrollTop = statusTxt.scrollHeight;\r\n}\r\n\r\nfunction clearInfiltrationStatusText() {\r\n document.getElementById(\"infiltration-status-text\").innerHTML = \"\";\r\n}\r\n\r\nfunction updateInfiltrationLevelText(inst) {\r\n var totalValue = 0;\r\n var totalMoneyValue = 0;\r\n for (var i = 0; i < inst.secretsStolen.length; ++i) {\r\n totalValue += (inst.secretsStolen[i] * Player.faction_rep_mult *\r\n CONSTANTS.InfiltrationRepValue * BitNodeMultipliers.InfiltrationRep);\r\n totalMoneyValue += inst.secretsStolen[i] * CONSTANTS.InfiltrationMoneyValue *\r\n BitNodeMultipliers.InfiltrationMoney;\r\n }\r\n\r\n var expMultiplier = 2 * inst.clearanceLevel / inst.maxClearanceLevel;\r\n document.getElementById(\"infiltration-level-text\").innerHTML =\r\n \"Facility name: \" + inst.companyName + \"<br>\" +\r\n \"Clearance Level: \" + inst.clearanceLevel + \"<br>\" +\r\n \"Security Level: \" + formatNumber(inst.securityLevel, 3) + \"<br><br>\" +\r\n \"Total reputation value of secrets stolen: \" + formatNumber(totalValue, 3) + \"<br>\" +\r\n \"Total monetary value of secrets stolen: $\" + formatNumber(totalMoneyValue, 2) + \"<br><br>\" +\r\n \"Hack exp gained: \" + formatNumber(inst.hackingExpGained * expMultiplier, 3) + \"<br>\" +\r\n \"Str exp gained: \" + formatNumber(inst.strExpGained * expMultiplier, 3) + \"<br>\" +\r\n \"Def exp gained: \" + formatNumber(inst.defExpGained * expMultiplier, 3) + \"<br>\" +\r\n \"Dex exp gained: \" + formatNumber(inst.dexExpGained * expMultiplier, 3) + \"<br>\" +\r\n \"Agi exp gained: \" + formatNumber(inst.agiExpGained * expMultiplier, 3) + \"<br>\" +\r\n \"Cha exp gained: \" + formatNumber(inst.chaExpGained * expMultiplier, 3);\r\n}\r\n\r\nfunction updateInfiltrationButtons(inst, scenario) {\r\n var killChance = getInfiltrationKillChance(inst);\r\n var knockoutChance = getInfiltrationKnockoutChance(inst);\r\n var stealthKnockoutChance = getInfiltrationStealthKnockoutChance(inst);\r\n var assassinateChance = getInfiltrationAssassinateChance(inst);\r\n var destroySecurityChance = getInfiltrationDestroySecurityChance(inst);\r\n var hackChance = getInfiltrationHackChance(inst);\r\n var sneakChance = getInfiltrationSneakChance(inst);\r\n var lockpickChance = getInfiltrationPickLockedDoorChance(inst);\r\n var bribeChance = getInfiltrationBribeChance(inst);\r\n var escapeChance = getInfiltrationEscapeChance(inst);\r\n\r\n document.getElementById(\"infiltration-escape\").innerHTML = \"Escape\" +\r\n \"<span class='tooltiptext'>\" +\r\n \"Attempt to escape the facility with the classified secrets and \" +\r\n \"documents you have stolen. You have a \" +\r\n formatNumber(escapeChance*100, 2) + \"% chance of success. If you fail, \" +\r\n \"the security level will increase by 5%.</span>\";\r\n\r\n switch(scenario) {\r\n case InfiltrationScenarios.TechOrLockedDoor:\r\n document.getElementById(\"infiltration-pickdoor\").innerHTML = \"Lockpick\" +\r\n \"<span class='tooltiptext'>\" +\r\n \"Attempt to pick the locked door. You have a \" +\r\n formatNumber(lockpickChance*100, 2) + \"% chance of success. \" +\r\n \"If you succeed, the security level will increased by 1%. If you fail, the \" +\r\n \"security level will increase by 3%.</span>\";\r\n case InfiltrationScenarios.TechOnly:\r\n document.getElementById(\"infiltration-hacksecurity\").innerHTML = \"Hack\" +\r\n \"<span class='tooltiptext'>\" +\r\n \"Attempt to hack and disable the security system. You have a \" +\r\n formatNumber(hackChance*100, 2) + \"% chance of success. \" +\r\n \"If you succeed, the security level will increase by 3%. If you fail, \" +\r\n \"the security level will increase by 5%.</span>\";\r\n\r\n document.getElementById(\"infiltration-destroysecurity\").innerHTML = \"Destroy security\" +\r\n \"<span class='tooltiptext'>\" +\r\n \"Attempt to violently destroy the security system. You have a \" +\r\n formatNumber(destroySecurityChance*100, 2) + \"% chance of success. \" +\r\n \"If you succeed, the security level will increase by 5%. If you fail, the \" +\r\n \"security level will increase by 10%. </span>\";\r\n\r\n document.getElementById(\"infiltration-sneak\").innerHTML = \"Sneak\" +\r\n \"<span class='tooltiptext'>\" +\r\n \"Attempt to sneak past the security system. You have a \" +\r\n formatNumber(sneakChance*100, 2) + \"% chance of success. \" +\r\n \"If you fail, the security level will increase by 8%. </span>\";\r\n break;\r\n case InfiltrationScenarios.Bots:\r\n document.getElementById(\"infiltration-kill\").innerHTML = \"Destroy bots\" +\r\n \"<span class='tooltiptext'>\" +\r\n \"Attempt to destroy the security bots through combat. You have a \" +\r\n formatNumber(killChance*100, 2) + \"% chance of success. \" +\r\n \"If you succeed, the security level will increase by 5%. If you fail, \" +\r\n \"the security level will increase by 10%. </span>\";\r\n\r\n document.getElementById(\"infiltration-assassinate\").innerHTML = \"Assassinate bots\" +\r\n \"<span class='tooltiptext'>\" +\r\n \"Attempt to stealthily destroy the security bots through assassination. You have a \" +\r\n formatNumber(assassinateChance*100, 2) + \"% chance of success. \" +\r\n \"If you fail, the security level will increase by 10%. </span>\";\r\n\r\n document.getElementById(\"infiltration-hacksecurity\").innerHTML = \"Hack bots\" +\r\n \"<span class='tooltiptext'>\" +\r\n \"Attempt to disable the security bots by hacking them. You have a \" +\r\n formatNumber(hackChance*100, 2) + \"% chance of success. \" +\r\n \"If you succeed, the security level will increase by 3%. If you fail, \" +\r\n \"the security level will increase by 5%. </span>\";\r\n\r\n document.getElementById(\"infiltration-sneak\").innerHTML = \"Sneak\" +\r\n \"<span class='tooltiptext'>\" +\r\n \"Attempt to sneak past the security bots. You have a \" +\r\n formatNumber(sneakChance*100, 2) + \"% chance of success. \" +\r\n \"If you fail, the security level will increase by 8%. </span>\";\r\n break;\r\n\r\n case InfiltrationScenarios.Guards:\r\n default:\r\n document.getElementById(\"infiltration-kill\").innerHTML = \"Kill\" +\r\n \"<span class='tooltiptext'>\" +\r\n \"Attempt to kill the security guard. You have a \" +\r\n formatNumber(killChance*100, 2) + \"% chance of success. \" +\r\n \"If you succeed, the security level will increase by 5%. If you fail, \" +\r\n \"the security level will decrease by 10%. </span>\";\r\n\r\n document.getElementById(\"infiltration-knockout\").innerHTML = \"Knockout\" +\r\n \"<span class='tooltiptext'>\" +\r\n \"Attempt to knockout the security guard. You have a \" +\r\n formatNumber(knockoutChance*100, 2) + \"% chance of success. \" +\r\n \"If you succeed, the security level will increase by 3%. If you fail, the \" +\r\n \"security level will increase by 10%. </span>\";\r\n\r\n document.getElementById(\"infiltration-stealthknockout\").innerHTML = \"Stealth Knockout\" +\r\n \"<span class='tooltiptext'>\" +\r\n \"Attempt to stealthily knockout the security guard. You have a \" +\r\n formatNumber(stealthKnockoutChance*100, 2) + \"% chance of success. \" +\r\n \"If you fail, the security level will increase by 10%. </span>\";\r\n\r\n document.getElementById(\"infiltration-assassinate\").innerHTML = \"Assassinate\" +\r\n \"<span class='tooltiptext'>\" +\r\n \"Attempt to assassinate the security guard. You have a \" +\r\n formatNumber(assassinateChance*100, 2) + \"% chance of success. \" +\r\n \"If you fail, the security level will increase by 5%. </span>\";\r\n\r\n document.getElementById(\"infiltration-sneak\").innerHTML = \"Sneak\" +\r\n \"<span class='tooltiptext'>\" +\r\n \"Attempt to sneak past the security guard. You have a \" +\r\n formatNumber(sneakChance*100, 2) + \"% chance of success. \" +\r\n \"If you fail, the security level will increase by 8%. </span>\";\r\n\r\n document.getElementById(\"infiltration-bribe\").innerHTML = \"Bribe\" +\r\n \"<span class='tooltiptext'>\" +\r\n \"Attempt to bribe the security guard. You have a \" +\r\n formatNumber(bribeChance*100, 2) + \"% chance of success. \" +\r\n \"If you fail, the security level will increase by 15%. </span>\";\r\n break;\r\n }\r\n}\r\n\r\nlet intWgt = CONSTANTS.IntelligenceInfiltrationWeight;\r\n\r\n//Kill\r\n//Success: 5%, Failure 10%, -Karma\r\nfunction attemptInfiltrationKill(inst) {\r\n var chance = getInfiltrationKillChance(inst);\r\n inst.gainStrengthExp(inst.securityLevel / 85) * Player.strength_exp_mult;\r\n inst.gainDefenseExp(inst.securityLevel / 85) * Player.defense_exp_mult;\r\n inst.gainDexterityExp(inst.securityLevel / 85) * Player.dexterity_exp_mult;\r\n inst.gainAgilityExp(inst.securityLevel / 85) * Player.agility_exp_mult;\r\n if (Math.random() <= chance) {\r\n inst.securityLevel *= 1.05;\r\n return [true, 1.05];\r\n } else {\r\n inst.securityLevel *= 1.1;\r\n return [false, 1.1];\r\n }\r\n}\r\n\r\nfunction getInfiltrationKillChance(inst) {\r\n var lvl = inst.securityLevel;\r\n return Math.min(0.95,\r\n (Player.strength +\r\n Player.dexterity +\r\n Player.agility) / (1.45 * lvl));\r\n}\r\n\r\n\r\n//Knockout\r\n//Success: 3%, Failure: 10%\r\nfunction attemptInfiltrationKnockout(inst) {\r\n var chance = getInfiltrationKnockoutChance(inst);\r\n inst.gainStrengthExp(inst.securityLevel / 80) * Player.strength_exp_mult;\r\n inst.gainDefenseExp(inst.securityLevel / 80) * Player.defense_exp_mult;\r\n inst.gainDexterityExp(inst.securityLevel / 80) * Player.dexterity_exp_mult;\r\n inst.gainAgilityExp(inst.securityLevel / 80) * Player.agility_exp_mult;\r\n if (Math.random() <= chance) {\r\n inst.securityLevel *= 1.03;\r\n return [true, 1.03];\r\n } else {\r\n inst.securityLevel *= 1.1;\r\n return [false, 1.1];\r\n }\r\n}\r\n\r\nfunction getInfiltrationKnockoutChance(inst) {\r\n var lvl = inst.securityLevel;\r\n return Math.min(0.95,\r\n (Player.strength +\r\n Player.dexterity +\r\n Player.agility) / (1.7 * lvl));\r\n}\r\n\r\n//Stealth knockout\r\n//Success: 0%, Failure: 10%\r\nfunction attemptInfiltrationStealthKnockout(inst) {\r\n var chance = getInfiltrationStealthKnockoutChance(inst);\r\n inst.gainStrengthExp(inst.securityLevel / 85) * Player.strength_exp_mult;\r\n inst.gainDexterityExp(inst.securityLevel / 65) * Player.dexterity_exp_mult;\r\n inst.gainAgilityExp(inst.securityLevel / 65) * Player.agility_exp_mult;\r\n if (Math.random() <= chance) {\r\n return [true, 1];\r\n } else {\r\n inst.securityLevel *= 1.1;\r\n return [false, 1.1];\r\n }\r\n}\r\n\r\nfunction getInfiltrationStealthKnockoutChance(inst) {\r\n var lvl = inst.securityLevel;\r\n return Math.min(0.95,\r\n (0.55 * Player.strength +\r\n 2 * Player.dexterity +\r\n 2 * Player.agility +\r\n intWgt * Player.intelligence) / (3 * lvl));\r\n}\r\n\r\n//Assassination\r\n//Success: 0%, Failure: 5%, -Karma\r\nfunction attemptInfiltrationAssassinate(inst) {\r\n var chance = getInfiltrationAssassinateChance(inst);\r\n inst.gainStrengthExp(inst.securityLevel / 85) * Player.strength_exp_mult;\r\n inst.gainDexterityExp(inst.securityLevel / 65) * Player.dexterity_exp_mult;\r\n inst.gainAgilityExp(inst.securityLevel / 65) * Player.agility_exp_mult;\r\n if (Math.random() <= chance) {\r\n return [true, 1];\r\n } else {\r\n inst.securityLevel *= 1.05;\r\n return [false, 1.05];\r\n }\r\n}\r\n\r\nfunction getInfiltrationAssassinateChance(inst) {\r\n var lvl = inst.securityLevel;\r\n return Math.min(0.95,\r\n (Player.dexterity +\r\n 0.5 * Player.agility +\r\n intWgt * Player.intelligence) / (2 * lvl));\r\n}\r\n\r\n\r\n//Destroy security\r\n//Success: 5%, Failure: 10%\r\nfunction attemptInfiltrationDestroySecurity(inst) {\r\n var chance = getInfiltrationDestroySecurityChance(inst);\r\n inst.gainStrengthExp(inst.securityLevel / 85) * Player.strength_exp_mult;\r\n inst.gainDefenseExp(inst.securityLevel / 85) * Player.defense_exp_mult;\r\n inst.gainDexterityExp(inst.securityLevel / 85) * Player.dexterity_exp_mult;\r\n inst.gainAgilityExp(inst.securityLevel / 85) * Player.agility_exp_mult;\r\n if (Math.random() <= chance) {\r\n inst.securityLevel *= 1.05;\r\n return [true, 1.05];\r\n } else {\r\n inst.securityLevel *= 1.1;\r\n return [false, 1.1];\r\n }\r\n\r\n}\r\n\r\nfunction getInfiltrationDestroySecurityChance(inst) {\r\n var lvl = inst.securityLevel;\r\n return Math.min(0.95,\r\n (Player.strength +\r\n Player.dexterity +\r\n Player.agility) / (2 * lvl));\r\n}\r\n\r\n\r\n//Hack security\r\n//Success: 3%, Failure: 5%\r\nfunction attemptInfiltrationHack(inst) {\r\n var chance = getInfiltrationHackChance(inst);\r\n inst.gainHackingExp(inst.securityLevel / 40) * Player.hacking_exp_mult;\r\n inst.gainIntelligenceExp(inst.securityLevel / 690);\r\n if (Math.random() <= chance) {\r\n inst.securityLevel *= 1.03;\r\n return [true, 1.03];\r\n } else {\r\n inst.securityLevel *= 1.05;\r\n return [false, 1.05];\r\n }\r\n\r\n}\r\n\r\nfunction getInfiltrationHackChance(inst) {\r\n var lvl = inst.securityLevel;\r\n return Math.min(0.95,\r\n (Player.hacking_skill +\r\n (intWgt * Player.intelligence)) / lvl);\r\n}\r\n\r\n//Sneak past security\r\n//Success: 0%, Failure: 8%\r\nfunction attemptInfiltrationSneak(inst) {\r\n var chance = getInfiltrationSneakChance(inst);\r\n inst.gainAgilityExp(inst.securityLevel / 40) * Player.agility_exp_mult;\r\n if (Math.random() <= chance) {\r\n return [true, 1];\r\n } else {\r\n inst.securityLevel *= 1.08;\r\n return [false, 1.08];\r\n }\r\n}\r\n\r\nfunction getInfiltrationSneakChance(inst) {\r\n var lvl = inst.securityLevel;\r\n return Math.min(0.95,\r\n (Player.agility +\r\n 0.5 * Player.dexterity +\r\n intWgt * Player.intelligence) / (2 * lvl));\r\n}\r\n\r\n//Pick locked door\r\n//Success: 1%, Failure: 3%\r\nfunction attemptInfiltrationPickLockedDoor(inst) {\r\n var chance = getInfiltrationPickLockedDoorChance(inst);\r\n inst.gainDexterityExp(inst.securityLevel / 30) * Player.dexterity_exp_mult;\r\n if (Math.random() <= chance) {\r\n inst.securityLevel *= 1.01;\r\n return [true, 1.01];\r\n } else {\r\n inst.securityLevel *= 1.03;\r\n return [false, 1.03];\r\n }\r\n}\r\n\r\nfunction getInfiltrationPickLockedDoorChance(inst) {\r\n var lvl = inst.securityLevel;\r\n return Math.min(0.95,\r\n (Player.dexterity +\r\n intWgt * Player.intelligence) / lvl);\r\n}\r\n\r\n//Bribe\r\n//Success: 0%, Failure: 15%,\r\nfunction attemptInfiltrationBribe(inst) {\r\n var chance = getInfiltrationBribeChance(inst);\r\n inst.gainCharismaExp(inst.securityLevel / 10) * Player.charisma_exp_mult;\r\n if (Math.random() <= chance) {\r\n return [true, 1];\r\n } else {\r\n inst.securityLevel *= 1.15;\r\n return [false, 1.15];\r\n }\r\n}\r\n\r\nfunction getInfiltrationBribeChance(inst) {\r\n var lvl = inst.securityLevel;\r\n return Math.min(0.95,\r\n (Player.charisma) / lvl);\r\n}\r\n\r\n//Escape\r\n//Failure: 5%\r\nfunction attemptInfiltrationEscape(inst) {\r\n var chance = getInfiltrationEscapeChance(inst);\r\n inst.gainAgilityExp(inst.securityLevel / 35) * Player.agility_exp_mult;\r\n inst.gainDexterityExp(inst.securityLevel / 35) * Player.dexterity_exp_mult;\r\n if (Math.random() <= chance) {\r\n return [true, 1];\r\n } else {\r\n inst.securityLevel *= 1.05;\r\n return [false, 1.05];\r\n }\r\n}\r\n\r\nfunction getInfiltrationEscapeChance(inst) {\r\n var lvl = inst.securityLevel;\r\n return Math.min(0.95,\r\n (2 * Player.agility +\r\n Player.dexterity +\r\n intWgt * Player.intelligence) / lvl);\r\n}\r\n\r\nexport {beginInfiltration};\r\n","/* FileSaver.js\n * A saveAs() FileSaver implementation.\n * 1.3.2\n * 2016-06-16 18:25:19\n *\n * By Eli Grey, http://eligrey.com\n * License: MIT\n * See https://github.com/eligrey/FileSaver.js/blob/master/LICENSE.md\n */\n\n/*global self */\n/*jslint bitwise: true, indent: 4, laxbreak: true, laxcomma: true, smarttabs: true, plusplus: true */\n\n/*! @source http://purl.eligrey.com/github/FileSaver.js/blob/master/FileSaver.js */\n\nvar saveAs = saveAs || (function(view) {\n\t\"use strict\";\n\t// IE <10 is explicitly unsupported\n\tif (typeof view === \"undefined\" || typeof navigator !== \"undefined\" && /MSIE [1-9]\\./.test(navigator.userAgent)) {\n\t\treturn;\n\t}\n\tvar\n\t\t doc = view.document\n\t\t // only get URL when necessary in case Blob.js hasn't overridden it yet\n\t\t, get_URL = function() {\n\t\t\treturn view.URL || view.webkitURL || view;\n\t\t}\n\t\t, save_link = doc.createElementNS(\"http://www.w3.org/1999/xhtml\", \"a\")\n\t\t, can_use_save_link = \"download\" in save_link\n\t\t, click = function(node) {\n\t\t\tvar event = new MouseEvent(\"click\");\n\t\t\tnode.dispatchEvent(event);\n\t\t}\n\t\t, is_safari = /constructor/i.test(view.HTMLElement) || view.safari\n\t\t, is_chrome_ios =/CriOS\\/[\\d]+/.test(navigator.userAgent)\n\t\t, throw_outside = function(ex) {\n\t\t\t(view.setImmediate || view.setTimeout)(function() {\n\t\t\t\tthrow ex;\n\t\t\t}, 0);\n\t\t}\n\t\t, force_saveable_type = \"application/octet-stream\"\n\t\t// the Blob API is fundamentally broken as there is no \"downloadfinished\" event to subscribe to\n\t\t, arbitrary_revoke_timeout = 1000 * 40 // in ms\n\t\t, revoke = function(file) {\n\t\t\tvar revoker = function() {\n\t\t\t\tif (typeof file === \"string\") { // file is an object URL\n\t\t\t\t\tget_URL().revokeObjectURL(file);\n\t\t\t\t} else { // file is a File\n\t\t\t\t\tfile.remove();\n\t\t\t\t}\n\t\t\t};\n\t\t\tsetTimeout(revoker, arbitrary_revoke_timeout);\n\t\t}\n\t\t, dispatch = function(filesaver, event_types, event) {\n\t\t\tevent_types = [].concat(event_types);\n\t\t\tvar i = event_types.length;\n\t\t\twhile (i--) {\n\t\t\t\tvar listener = filesaver[\"on\" + event_types[i]];\n\t\t\t\tif (typeof listener === \"function\") {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tlistener.call(filesaver, event || filesaver);\n\t\t\t\t\t} catch (ex) {\n\t\t\t\t\t\tthrow_outside(ex);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t, auto_bom = function(blob) {\n\t\t\t// prepend BOM for UTF-8 XML and text/* types (including HTML)\n\t\t\t// note: your browser will automatically convert UTF-16 U+FEFF to EF BB BF\n\t\t\tif (/^\\s*(?:text\\/\\S*|application\\/xml|\\S*\\/\\S*\\+xml)\\s*;.*charset\\s*=\\s*utf-8/i.test(blob.type)) {\n\t\t\t\treturn new Blob([String.fromCharCode(0xFEFF), blob], {type: blob.type});\n\t\t\t}\n\t\t\treturn blob;\n\t\t}\n\t\t, FileSaver = function(blob, name, no_auto_bom) {\n\t\t\tif (!no_auto_bom) {\n\t\t\t\tblob = auto_bom(blob);\n\t\t\t}\n\t\t\t// First try a.download, then web filesystem, then object URLs\n\t\t\tvar\n\t\t\t\t filesaver = this\n\t\t\t\t, type = blob.type\n\t\t\t\t, force = type === force_saveable_type\n\t\t\t\t, object_url\n\t\t\t\t, dispatch_all = function() {\n\t\t\t\t\tdispatch(filesaver, \"writestart progress write writeend\".split(\" \"));\n\t\t\t\t}\n\t\t\t\t// on any filesys errors revert to saving with object URLs\n\t\t\t\t, fs_error = function() {\n\t\t\t\t\tif ((is_chrome_ios || (force && is_safari)) && view.FileReader) {\n\t\t\t\t\t\t// Safari doesn't allow downloading of blob urls\n\t\t\t\t\t\tvar reader = new FileReader();\n\t\t\t\t\t\treader.onloadend = function() {\n\t\t\t\t\t\t\tvar url = is_chrome_ios ? reader.result : reader.result.replace(/^data:[^;]*;/, 'data:attachment/file;');\n\t\t\t\t\t\t\tvar popup = view.open(url, '_blank');\n\t\t\t\t\t\t\tif(!popup) view.location.href = url;\n\t\t\t\t\t\t\turl=undefined; // release reference before dispatching\n\t\t\t\t\t\t\tfilesaver.readyState = filesaver.DONE;\n\t\t\t\t\t\t\tdispatch_all();\n\t\t\t\t\t\t};\n\t\t\t\t\t\treader.readAsDataURL(blob);\n\t\t\t\t\t\tfilesaver.readyState = filesaver.INIT;\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\t// don't create more object URLs than needed\n\t\t\t\t\tif (!object_url) {\n\t\t\t\t\t\tobject_url = get_URL().createObjectURL(blob);\n\t\t\t\t\t}\n\t\t\t\t\tif (force) {\n\t\t\t\t\t\tview.location.href = object_url;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tvar opened = view.open(object_url, \"_blank\");\n\t\t\t\t\t\tif (!opened) {\n\t\t\t\t\t\t\t// Apple does not allow window.open, see https://developer.apple.com/library/safari/documentation/Tools/Conceptual/SafariExtensionGuide/WorkingwithWindowsandTabs/WorkingwithWindowsandTabs.html\n\t\t\t\t\t\t\tview.location.href = object_url;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tfilesaver.readyState = filesaver.DONE;\n\t\t\t\t\tdispatch_all();\n\t\t\t\t\trevoke(object_url);\n\t\t\t\t}\n\t\t\t;\n\t\t\tfilesaver.readyState = filesaver.INIT;\n\n\t\t\tif (can_use_save_link) {\n\t\t\t\tobject_url = get_URL().createObjectURL(blob);\n\t\t\t\tsetTimeout(function() {\n\t\t\t\t\tsave_link.href = object_url;\n\t\t\t\t\tsave_link.download = name;\n\t\t\t\t\tclick(save_link);\n\t\t\t\t\tdispatch_all();\n\t\t\t\t\trevoke(object_url);\n\t\t\t\t\tfilesaver.readyState = filesaver.DONE;\n\t\t\t\t});\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tfs_error();\n\t\t}\n\t\t, FS_proto = FileSaver.prototype\n\t\t, saveAs = function(blob, name, no_auto_bom) {\n\t\t\treturn new FileSaver(blob, name || blob.name || \"download\", no_auto_bom);\n\t\t}\n\t;\n\t// IE 10+ (native saveAs)\n\tif (typeof navigator !== \"undefined\" && navigator.msSaveOrOpenBlob) {\n\t\treturn function(blob, name, no_auto_bom) {\n\t\t\tname = name || blob.name || \"download\";\n\n\t\t\tif (!no_auto_bom) {\n\t\t\t\tblob = auto_bom(blob);\n\t\t\t}\n\t\t\treturn navigator.msSaveOrOpenBlob(blob, name);\n\t\t};\n\t}\n\n\tFS_proto.abort = function(){};\n\tFS_proto.readyState = FS_proto.INIT = 0;\n\tFS_proto.WRITING = 1;\n\tFS_proto.DONE = 2;\n\n\tFS_proto.error =\n\tFS_proto.onwritestart =\n\tFS_proto.onprogress =\n\tFS_proto.onwrite =\n\tFS_proto.onabort =\n\tFS_proto.onerror =\n\tFS_proto.onwriteend =\n\t\tnull;\n\n\treturn saveAs;\n}(\n\t typeof self !== \"undefined\" && self\n\t|| typeof window !== \"undefined\" && window\n\t|| this.content\n));\n// `self` is undefined in Firefox for Android content script context\n// while `this` is nsIContentFrameMessageManager\n// with an attribute `content` that corresponds to the window\n\nif (typeof module !== \"undefined\" && module.exports) {\n module.exports.saveAs = saveAs;\n} else if ((typeof define !== \"undefined\" && define !== null) && (define.amd !== null)) {\n define(\"FileSaver.js\", function() {\n return saveAs;\n });\n}\n","'use strict';\n\n/**\n * Representation a of zip file in js\n * @constructor\n */\nfunction JSZip() {\n // if this constructor is used without `new`, it adds `new` before itself:\n if(!(this instanceof JSZip)) {\n return new JSZip();\n }\n\n if(arguments.length) {\n throw new Error(\"The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.\");\n }\n\n // object containing the files :\n // {\n // \"folder/\" : {...},\n // \"folder/data.txt\" : {...}\n // }\n this.files = {};\n\n this.comment = null;\n\n // Where we are in the hierarchy\n this.root = \"\";\n this.clone = function() {\n var newObj = new JSZip();\n for (var i in this) {\n if (typeof this[i] !== \"function\") {\n newObj[i] = this[i];\n }\n }\n return newObj;\n };\n}\nJSZip.prototype = require('./object');\nJSZip.prototype.loadAsync = require('./load');\nJSZip.support = require('./support');\nJSZip.defaults = require('./defaults');\n\n// TODO find a better way to handle this version,\n// a require('package.json').version doesn't work with webpack, see #327\nJSZip.version = \"3.1.5\";\n\nJSZip.loadAsync = function (content, options) {\n return new JSZip().loadAsync(content, options);\n};\n\nJSZip.external = require(\"./external\");\nmodule.exports = JSZip;\n","var config = require('../config');\nvar flag = require('./flag');\nvar getProperties = require('./getProperties');\nvar isProxyEnabled = require('./isProxyEnabled');\n\n/*!\n * Chai - proxify utility\n * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>\n * MIT Licensed\n */\n\n/**\n * ### .proxify(object)\n *\n * Return a proxy of given object that throws an error when a non-existent\n * property is read. By default, the root cause is assumed to be a misspelled\n * property, and thus an attempt is made to offer a reasonable suggestion from\n * the list of existing properties. However, if a nonChainableMethodName is\n * provided, then the root cause is instead a failure to invoke a non-chainable\n * method prior to reading the non-existent property.\n * \n * If proxies are unsupported or disabled via the user's Chai config, then\n * return object without modification.\n *\n * @param {Object} obj\n * @param {String} nonChainableMethodName\n * @namespace Utils\n * @name proxify\n */\n\nvar builtins = ['__flags', '__methods', '_obj', 'assert'];\n\nmodule.exports = function proxify(obj, nonChainableMethodName) {\n if (!isProxyEnabled()) return obj;\n\n return new Proxy(obj, {\n get: function proxyGetter(target, property) {\n // This check is here because we should not throw errors on Symbol properties\n // such as `Symbol.toStringTag`.\n // The values for which an error should be thrown can be configured using\n // the `config.proxyExcludedKeys` setting.\n if (typeof property === 'string' &&\n config.proxyExcludedKeys.indexOf(property) === -1 &&\n !Reflect.has(target, property)) {\n // Special message for invalid property access of non-chainable methods.\n if (nonChainableMethodName) {\n throw Error('Invalid Chai property: ' + nonChainableMethodName + '.' +\n property + '. See docs for proper usage of \"' +\n nonChainableMethodName + '\".');\n }\n\n var orderedProperties = getProperties(target).filter(function(property) {\n return !Object.prototype.hasOwnProperty(property) &&\n builtins.indexOf(property) === -1;\n }).sort(function(a, b) {\n return stringDistance(property, a) - stringDistance(property, b);\n });\n\n if (orderedProperties.length &&\n stringDistance(orderedProperties[0], property) < 4) {\n // If the property is reasonably close to an existing Chai property,\n // suggest that property to the user.\n throw Error('Invalid Chai property: ' + property +\n '. Did you mean \"' + orderedProperties[0] + '\"?');\n } else {\n throw Error('Invalid Chai property: ' + property);\n }\n }\n\n // Use this proxy getter as the starting point for removing implementation\n // frames from the stack trace of a failed assertion. For property\n // assertions, this prevents the proxy getter from showing up in the stack\n // trace since it's invoked before the property getter. For method and\n // chainable method assertions, this flag will end up getting changed to\n // the method wrapper, which is good since this frame will no longer be in\n // the stack once the method is invoked. Note that Chai builtin assertion\n // properties such as `__flags` are skipped since this is only meant to\n // capture the starting point of an assertion. This step is also skipped\n // if the `lockSsfi` flag is set, thus indicating that this assertion is\n // being called from within another assertion. In that case, the `ssfi`\n // flag is already set to the outer assertion's starting point.\n if (builtins.indexOf(property) === -1 && !flag(target, 'lockSsfi')) {\n flag(target, 'ssfi', proxyGetter);\n }\n\n return Reflect.get(target, property);\n }\n });\n};\n\n/**\n * # stringDistance(strA, strB)\n * Return the Levenshtein distance between two strings.\n * @param {string} strA\n * @param {string} strB\n * @return {number} the string distance between strA and strB\n * @api private\n */\n\nfunction stringDistance(strA, strB, memo) {\n if (!memo) {\n // `memo` is a two-dimensional array containing a cache of distances\n // memo[i][j] is the distance between strA.slice(0, i) and\n // strB.slice(0, j).\n memo = [];\n for (var i = 0; i <= strA.length; i++) {\n memo[i] = [];\n }\n }\n\n if (!memo[strA.length] || !memo[strA.length][strB.length]) {\n if (strA.length === 0 || strB.length === 0) {\n memo[strA.length][strB.length] = Math.max(strA.length, strB.length);\n } else {\n memo[strA.length][strB.length] = Math.min(\n stringDistance(strA.slice(0, -1), strB, memo) + 1,\n stringDistance(strA, strB.slice(0, -1), memo) + 1,\n stringDistance(strA.slice(0, -1), strB.slice(0, -1), memo) +\n (strA.slice(-1) === strB.slice(-1) ? 0 : 1)\n );\n }\n }\n\n return memo[strA.length][strB.length];\n}\n","var config = require('../config');\n\nvar fnLengthDesc = Object.getOwnPropertyDescriptor(function () {}, 'length');\n\n/*!\n * Chai - addLengthGuard utility\n * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>\n * MIT Licensed\n */\n\n/**\n * ### .addLengthGuard(fn, assertionName, isChainable)\n *\n * Define `length` as a getter on the given uninvoked method assertion. The\n * getter acts as a guard against chaining `length` directly off of an uninvoked\n * method assertion, which is a problem because it references `function`'s\n * built-in `length` property instead of Chai's `length` assertion. When the\n * getter catches the user making this mistake, it throws an error with a\n * helpful message.\n *\n * There are two ways in which this mistake can be made. The first way is by\n * chaining the `length` assertion directly off of an uninvoked chainable\n * method. In this case, Chai suggests that the user use `lengthOf` instead. The\n * second way is by chaining the `length` assertion directly off of an uninvoked\n * non-chainable method. Non-chainable methods must be invoked prior to\n * chaining. In this case, Chai suggests that the user consult the docs for the\n * given assertion.\n *\n * If the `length` property of functions is unconfigurable, then return `fn`\n * without modification.\n *\n * Note that in ES6, the function's `length` property is configurable, so once\n * support for legacy environments is dropped, Chai's `length` property can\n * replace the built-in function's `length` property, and this length guard will\n * no longer be necessary. In the mean time, maintaining consistency across all\n * environments is the priority.\n *\n * @param {Function} fn\n * @param {String} assertionName\n * @param {Boolean} isChainable\n * @namespace Utils\n * @name addLengthGuard\n */\n\nmodule.exports = function addLengthGuard (fn, assertionName, isChainable) {\n if (!fnLengthDesc.configurable) return fn;\n\n Object.defineProperty(fn, 'length', {\n get: function () {\n if (isChainable) {\n throw Error('Invalid Chai property: ' + assertionName + '.length. Due' +\n ' to a compatibility issue, \"length\" cannot directly follow \"' +\n assertionName + '\". Use \"' + assertionName + '.lengthOf\" instead.');\n }\n\n throw Error('Invalid Chai property: ' + assertionName + '.length. See' +\n ' docs for proper usage of \"' + assertionName + '\".');\n }\n });\n\n return fn;\n};\n","var config = require('../config');\n\n/*!\n * Chai - isProxyEnabled helper\n * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>\n * MIT Licensed\n */\n\n/**\n * ### .isProxyEnabled()\n *\n * Helper function to check if Chai's proxy protection feature is enabled. If\n * proxies are unsupported or disabled via the user's Chai config, then return\n * false. Otherwise, return true.\n *\n * @namespace Utils\n * @name isProxyEnabled\n */\n\nmodule.exports = function isProxyEnabled() {\n return config.useProxy && \n typeof Proxy !== 'undefined' &&\n typeof Reflect !== 'undefined';\n};\n","// This is (almost) directly from Node.js utils\n// https://github.com/joyent/node/blob/f8c335d0caf47f16d31413f89aa28eda3878e3aa/lib/util.js\n\nvar getName = require('get-func-name');\nvar getProperties = require('./getProperties');\nvar getEnumerableProperties = require('./getEnumerableProperties');\nvar config = require('../config');\n\nmodule.exports = inspect;\n\n/**\n * ### .inspect(obj, [showHidden], [depth], [colors])\n *\n * Echoes the value of a value. Tries to print the value out\n * in the best way possible given the different types.\n *\n * @param {Object} obj The object to print out.\n * @param {Boolean} showHidden Flag that shows hidden (not enumerable)\n * properties of objects. Default is false.\n * @param {Number} depth Depth in which to descend in object. Default is 2.\n * @param {Boolean} colors Flag to turn on ANSI escape codes to color the\n * output. Default is false (no coloring).\n * @namespace Utils\n * @name inspect\n */\nfunction inspect(obj, showHidden, depth, colors) {\n var ctx = {\n showHidden: showHidden,\n seen: [],\n stylize: function (str) { return str; }\n };\n return formatValue(ctx, obj, (typeof depth === 'undefined' ? 2 : depth));\n}\n\n// Returns true if object is a DOM element.\nvar isDOMElement = function (object) {\n if (typeof HTMLElement === 'object') {\n return object instanceof HTMLElement;\n } else {\n return object &&\n typeof object === 'object' &&\n 'nodeType' in object &&\n object.nodeType === 1 &&\n typeof object.nodeName === 'string';\n }\n};\n\nfunction formatValue(ctx, value, recurseTimes) {\n // Provide a hook for user-specified inspect functions.\n // Check that value is an object with an inspect function on it\n if (value && typeof value.inspect === 'function' &&\n // Filter out the util module, it's inspect function is special\n value.inspect !== exports.inspect &&\n // Also filter out any prototype objects using the circular check.\n !(value.constructor && value.constructor.prototype === value)) {\n var ret = value.inspect(recurseTimes, ctx);\n if (typeof ret !== 'string') {\n ret = formatValue(ctx, ret, recurseTimes);\n }\n return ret;\n }\n\n // Primitive types cannot have properties\n var primitive = formatPrimitive(ctx, value);\n if (primitive) {\n return primitive;\n }\n\n // If this is a DOM element, try to get the outer HTML.\n if (isDOMElement(value)) {\n if ('outerHTML' in value) {\n return value.outerHTML;\n // This value does not have an outerHTML attribute,\n // it could still be an XML element\n } else {\n // Attempt to serialize it\n try {\n if (document.xmlVersion) {\n var xmlSerializer = new XMLSerializer();\n return xmlSerializer.serializeToString(value);\n } else {\n // Firefox 11- do not support outerHTML\n // It does, however, support innerHTML\n // Use the following to render the element\n var ns = \"http://www.w3.org/1999/xhtml\";\n var container = document.createElementNS(ns, '_');\n\n container.appendChild(value.cloneNode(false));\n var html = container.innerHTML\n .replace('><', '>' + value.innerHTML + '<');\n container.innerHTML = '';\n return html;\n }\n } catch (err) {\n // This could be a non-native DOM implementation,\n // continue with the normal flow:\n // printing the element as if it is an object.\n }\n }\n }\n\n // Look up the keys of the object.\n var visibleKeys = getEnumerableProperties(value);\n var keys = ctx.showHidden ? getProperties(value) : visibleKeys;\n\n var name, nameSuffix;\n\n // Some type of object without properties can be shortcutted.\n // In IE, errors have a single `stack` property, or if they are vanilla `Error`,\n // a `stack` plus `description` property; ignore those for consistency.\n if (keys.length === 0 || (isError(value) && (\n (keys.length === 1 && keys[0] === 'stack') ||\n (keys.length === 2 && keys[0] === 'description' && keys[1] === 'stack')\n ))) {\n if (typeof value === 'function') {\n name = getName(value);\n nameSuffix = name ? ': ' + name : '';\n return ctx.stylize('[Function' + nameSuffix + ']', 'special');\n }\n if (isRegExp(value)) {\n return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');\n }\n if (isDate(value)) {\n return ctx.stylize(Date.prototype.toUTCString.call(value), 'date');\n }\n if (isError(value)) {\n return formatError(value);\n }\n }\n\n var base = ''\n , array = false\n , typedArray = false\n , braces = ['{', '}'];\n\n if (isTypedArray(value)) {\n typedArray = true;\n braces = ['[', ']'];\n }\n\n // Make Array say that they are Array\n if (isArray(value)) {\n array = true;\n braces = ['[', ']'];\n }\n\n // Make functions say that they are functions\n if (typeof value === 'function') {\n name = getName(value);\n nameSuffix = name ? ': ' + name : '';\n base = ' [Function' + nameSuffix + ']';\n }\n\n // Make RegExps say that they are RegExps\n if (isRegExp(value)) {\n base = ' ' + RegExp.prototype.toString.call(value);\n }\n\n // Make dates with properties first say the date\n if (isDate(value)) {\n base = ' ' + Date.prototype.toUTCString.call(value);\n }\n\n // Make error with message first say the error\n if (isError(value)) {\n return formatError(value);\n }\n\n if (keys.length === 0 && (!array || value.length == 0)) {\n return braces[0] + base + braces[1];\n }\n\n if (recurseTimes < 0) {\n if (isRegExp(value)) {\n return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');\n } else {\n return ctx.stylize('[Object]', 'special');\n }\n }\n\n ctx.seen.push(value);\n\n var output;\n if (array) {\n output = formatArray(ctx, value, recurseTimes, visibleKeys, keys);\n } else if (typedArray) {\n return formatTypedArray(value);\n } else {\n output = keys.map(function(key) {\n return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array);\n });\n }\n\n ctx.seen.pop();\n\n return reduceToSingleString(output, base, braces);\n}\n\n\nfunction formatPrimitive(ctx, value) {\n switch (typeof value) {\n case 'undefined':\n return ctx.stylize('undefined', 'undefined');\n\n case 'string':\n var simple = '\\'' + JSON.stringify(value).replace(/^\"|\"$/g, '')\n .replace(/'/g, \"\\\\'\")\n .replace(/\\\\\"/g, '\"') + '\\'';\n return ctx.stylize(simple, 'string');\n\n case 'number':\n if (value === 0 && (1/value) === -Infinity) {\n return ctx.stylize('-0', 'number');\n }\n return ctx.stylize('' + value, 'number');\n\n case 'boolean':\n return ctx.stylize('' + value, 'boolean');\n\n case 'symbol':\n return ctx.stylize(value.toString(), 'symbol');\n }\n // For some reason typeof null is \"object\", so special case here.\n if (value === null) {\n return ctx.stylize('null', 'null');\n }\n}\n\n\nfunction formatError(value) {\n return '[' + Error.prototype.toString.call(value) + ']';\n}\n\n\nfunction formatArray(ctx, value, recurseTimes, visibleKeys, keys) {\n var output = [];\n for (var i = 0, l = value.length; i < l; ++i) {\n if (Object.prototype.hasOwnProperty.call(value, String(i))) {\n output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,\n String(i), true));\n } else {\n output.push('');\n }\n }\n\n keys.forEach(function(key) {\n if (!key.match(/^\\d+$/)) {\n output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,\n key, true));\n }\n });\n return output;\n}\n\nfunction formatTypedArray(value) {\n var str = '[ ';\n\n for (var i = 0; i < value.length; ++i) {\n if (str.length >= config.truncateThreshold - 7) {\n str += '...';\n break;\n }\n str += value[i] + ', ';\n }\n str += ' ]';\n\n // Removing trailing `, ` if the array was not truncated\n if (str.indexOf(', ]') !== -1) {\n str = str.replace(', ]', ' ]');\n }\n\n return str;\n}\n\nfunction formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {\n var name;\n var propDescriptor = Object.getOwnPropertyDescriptor(value, key);\n var str;\n\n if (propDescriptor) {\n if (propDescriptor.get) {\n if (propDescriptor.set) {\n str = ctx.stylize('[Getter/Setter]', 'special');\n } else {\n str = ctx.stylize('[Getter]', 'special');\n }\n } else {\n if (propDescriptor.set) {\n str = ctx.stylize('[Setter]', 'special');\n }\n }\n }\n if (visibleKeys.indexOf(key) < 0) {\n name = '[' + key + ']';\n }\n if (!str) {\n if (ctx.seen.indexOf(value[key]) < 0) {\n if (recurseTimes === null) {\n str = formatValue(ctx, value[key], null);\n } else {\n str = formatValue(ctx, value[key], recurseTimes - 1);\n }\n if (str.indexOf('\\n') > -1) {\n if (array) {\n str = str.split('\\n').map(function(line) {\n return ' ' + line;\n }).join('\\n').substr(2);\n } else {\n str = '\\n' + str.split('\\n').map(function(line) {\n return ' ' + line;\n }).join('\\n');\n }\n }\n } else {\n str = ctx.stylize('[Circular]', 'special');\n }\n }\n if (typeof name === 'undefined') {\n if (array && key.match(/^\\d+$/)) {\n return str;\n }\n name = JSON.stringify('' + key);\n if (name.match(/^\"([a-zA-Z_][a-zA-Z_0-9]*)\"$/)) {\n name = name.substr(1, name.length - 2);\n name = ctx.stylize(name, 'name');\n } else {\n name = name.replace(/'/g, \"\\\\'\")\n .replace(/\\\\\"/g, '\"')\n .replace(/(^\"|\"$)/g, \"'\");\n name = ctx.stylize(name, 'string');\n }\n }\n\n return name + ': ' + str;\n}\n\n\nfunction reduceToSingleString(output, base, braces) {\n var numLinesEst = 0;\n var length = output.reduce(function(prev, cur) {\n numLinesEst++;\n if (cur.indexOf('\\n') >= 0) numLinesEst++;\n return prev + cur.length + 1;\n }, 0);\n\n if (length > 60) {\n return braces[0] +\n (base === '' ? '' : base + '\\n ') +\n ' ' +\n output.join(',\\n ') +\n ' ' +\n braces[1];\n }\n\n return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1];\n}\n\nfunction isTypedArray(ar) {\n // Unfortunately there's no way to check if an object is a TypedArray\n // We have to check if it's one of these types\n return (typeof ar === 'object' && /\\w+Array]$/.test(objectToString(ar)));\n}\n\nfunction isArray(ar) {\n return Array.isArray(ar) ||\n (typeof ar === 'object' && objectToString(ar) === '[object Array]');\n}\n\nfunction isRegExp(re) {\n return typeof re === 'object' && objectToString(re) === '[object RegExp]';\n}\n\nfunction isDate(d) {\n return typeof d === 'object' && objectToString(d) === '[object Date]';\n}\n\nfunction isError(e) {\n return typeof e === 'object' && objectToString(e) === '[object Error]';\n}\n\nfunction objectToString(o) {\n return Object.prototype.toString.call(o);\n}\n","(function (global, factory) {\n\ttypeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :\n\ttypeof define === 'function' && define.amd ? define(factory) :\n\t(global.typeDetect = factory());\n}(this, (function () { 'use strict';\n\n/* !\n * type-detect\n * Copyright(c) 2013 jake luer <jake@alogicalparadox.com>\n * MIT Licensed\n */\nvar promiseExists = typeof Promise === 'function';\n\n/* eslint-disable no-undef */\nvar globalObject = typeof self === 'object' ? self : global; // eslint-disable-line id-blacklist\n\nvar symbolExists = typeof Symbol !== 'undefined';\nvar mapExists = typeof Map !== 'undefined';\nvar setExists = typeof Set !== 'undefined';\nvar weakMapExists = typeof WeakMap !== 'undefined';\nvar weakSetExists = typeof WeakSet !== 'undefined';\nvar dataViewExists = typeof DataView !== 'undefined';\nvar symbolIteratorExists = symbolExists && typeof Symbol.iterator !== 'undefined';\nvar symbolToStringTagExists = symbolExists && typeof Symbol.toStringTag !== 'undefined';\nvar setEntriesExists = setExists && typeof Set.prototype.entries === 'function';\nvar mapEntriesExists = mapExists && typeof Map.prototype.entries === 'function';\nvar setIteratorPrototype = setEntriesExists && Object.getPrototypeOf(new Set().entries());\nvar mapIteratorPrototype = mapEntriesExists && Object.getPrototypeOf(new Map().entries());\nvar arrayIteratorExists = symbolIteratorExists && typeof Array.prototype[Symbol.iterator] === 'function';\nvar arrayIteratorPrototype = arrayIteratorExists && Object.getPrototypeOf([][Symbol.iterator]());\nvar stringIteratorExists = symbolIteratorExists && typeof String.prototype[Symbol.iterator] === 'function';\nvar stringIteratorPrototype = stringIteratorExists && Object.getPrototypeOf(''[Symbol.iterator]());\nvar toStringLeftSliceLength = 8;\nvar toStringRightSliceLength = -1;\n/**\n * ### typeOf (obj)\n *\n * Uses `Object.prototype.toString` to determine the type of an object,\n * normalising behaviour across engine versions & well optimised.\n *\n * @param {Mixed} object\n * @return {String} object type\n * @api public\n */\nfunction typeDetect(obj) {\n /* ! Speed optimisation\n * Pre:\n * string literal x 3,039,035 ops/sec ±1.62% (78 runs sampled)\n * boolean literal x 1,424,138 ops/sec ±4.54% (75 runs sampled)\n * number literal x 1,653,153 ops/sec ±1.91% (82 runs sampled)\n * undefined x 9,978,660 ops/sec ±1.92% (75 runs sampled)\n * function x 2,556,769 ops/sec ±1.73% (77 runs sampled)\n * Post:\n * string literal x 38,564,796 ops/sec ±1.15% (79 runs sampled)\n * boolean literal x 31,148,940 ops/sec ±1.10% (79 runs sampled)\n * number literal x 32,679,330 ops/sec ±1.90% (78 runs sampled)\n * undefined x 32,363,368 ops/sec ±1.07% (82 runs sampled)\n * function x 31,296,870 ops/sec ±0.96% (83 runs sampled)\n */\n var typeofObj = typeof obj;\n if (typeofObj !== 'object') {\n return typeofObj;\n }\n\n /* ! Speed optimisation\n * Pre:\n * null x 28,645,765 ops/sec ±1.17% (82 runs sampled)\n * Post:\n * null x 36,428,962 ops/sec ±1.37% (84 runs sampled)\n */\n if (obj === null) {\n return 'null';\n }\n\n /* ! Spec Conformance\n * Test: `Object.prototype.toString.call(window)``\n * - Node === \"[object global]\"\n * - Chrome === \"[object global]\"\n * - Firefox === \"[object Window]\"\n * - PhantomJS === \"[object Window]\"\n * - Safari === \"[object Window]\"\n * - IE 11 === \"[object Window]\"\n * - IE Edge === \"[object Window]\"\n * Test: `Object.prototype.toString.call(this)``\n * - Chrome Worker === \"[object global]\"\n * - Firefox Worker === \"[object DedicatedWorkerGlobalScope]\"\n * - Safari Worker === \"[object DedicatedWorkerGlobalScope]\"\n * - IE 11 Worker === \"[object WorkerGlobalScope]\"\n * - IE Edge Worker === \"[object WorkerGlobalScope]\"\n */\n if (obj === globalObject) {\n return 'global';\n }\n\n /* ! Speed optimisation\n * Pre:\n * array literal x 2,888,352 ops/sec ±0.67% (82 runs sampled)\n * Post:\n * array literal x 22,479,650 ops/sec ±0.96% (81 runs sampled)\n */\n if (\n Array.isArray(obj) &&\n (symbolToStringTagExists === false || !(Symbol.toStringTag in obj))\n ) {\n return 'Array';\n }\n\n // Not caching existence of `window` and related properties due to potential\n // for `window` to be unset before tests in quasi-browser environments.\n if (typeof window === 'object' && window !== null) {\n /* ! Spec Conformance\n * (https://html.spec.whatwg.org/multipage/browsers.html#location)\n * WhatWG HTML$7.7.3 - The `Location` interface\n * Test: `Object.prototype.toString.call(window.location)``\n * - IE <=11 === \"[object Object]\"\n * - IE Edge <=13 === \"[object Object]\"\n */\n if (typeof window.location === 'object' && obj === window.location) {\n return 'Location';\n }\n\n /* ! Spec Conformance\n * (https://html.spec.whatwg.org/#document)\n * WhatWG HTML$3.1.1 - The `Document` object\n * Note: Most browsers currently adher to the W3C DOM Level 2 spec\n * (https://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-26809268)\n * which suggests that browsers should use HTMLTableCellElement for\n * both TD and TH elements. WhatWG separates these.\n * WhatWG HTML states:\n * > For historical reasons, Window objects must also have a\n * > writable, configurable, non-enumerable property named\n * > HTMLDocument whose value is the Document interface object.\n * Test: `Object.prototype.toString.call(document)``\n * - Chrome === \"[object HTMLDocument]\"\n * - Firefox === \"[object HTMLDocument]\"\n * - Safari === \"[object HTMLDocument]\"\n * - IE <=10 === \"[object Document]\"\n * - IE 11 === \"[object HTMLDocument]\"\n * - IE Edge <=13 === \"[object HTMLDocument]\"\n */\n if (typeof window.document === 'object' && obj === window.document) {\n return 'Document';\n }\n\n if (typeof window.navigator === 'object') {\n /* ! Spec Conformance\n * (https://html.spec.whatwg.org/multipage/webappapis.html#mimetypearray)\n * WhatWG HTML$8.6.1.5 - Plugins - Interface MimeTypeArray\n * Test: `Object.prototype.toString.call(navigator.mimeTypes)``\n * - IE <=10 === \"[object MSMimeTypesCollection]\"\n */\n if (typeof window.navigator.mimeTypes === 'object' &&\n obj === window.navigator.mimeTypes) {\n return 'MimeTypeArray';\n }\n\n /* ! Spec Conformance\n * (https://html.spec.whatwg.org/multipage/webappapis.html#pluginarray)\n * WhatWG HTML$8.6.1.5 - Plugins - Interface PluginArray\n * Test: `Object.prototype.toString.call(navigator.plugins)``\n * - IE <=10 === \"[object MSPluginsCollection]\"\n */\n if (typeof window.navigator.plugins === 'object' &&\n obj === window.navigator.plugins) {\n return 'PluginArray';\n }\n }\n\n if ((typeof window.HTMLElement === 'function' ||\n typeof window.HTMLElement === 'object') &&\n obj instanceof window.HTMLElement) {\n /* ! Spec Conformance\n * (https://html.spec.whatwg.org/multipage/webappapis.html#pluginarray)\n * WhatWG HTML$4.4.4 - The `blockquote` element - Interface `HTMLQuoteElement`\n * Test: `Object.prototype.toString.call(document.createElement('blockquote'))``\n * - IE <=10 === \"[object HTMLBlockElement]\"\n */\n if (obj.tagName === 'BLOCKQUOTE') {\n return 'HTMLQuoteElement';\n }\n\n /* ! Spec Conformance\n * (https://html.spec.whatwg.org/#htmltabledatacellelement)\n * WhatWG HTML$4.9.9 - The `td` element - Interface `HTMLTableDataCellElement`\n * Note: Most browsers currently adher to the W3C DOM Level 2 spec\n * (https://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-82915075)\n * which suggests that browsers should use HTMLTableCellElement for\n * both TD and TH elements. WhatWG separates these.\n * Test: Object.prototype.toString.call(document.createElement('td'))\n * - Chrome === \"[object HTMLTableCellElement]\"\n * - Firefox === \"[object HTMLTableCellElement]\"\n * - Safari === \"[object HTMLTableCellElement]\"\n */\n if (obj.tagName === 'TD') {\n return 'HTMLTableDataCellElement';\n }\n\n /* ! Spec Conformance\n * (https://html.spec.whatwg.org/#htmltableheadercellelement)\n * WhatWG HTML$4.9.9 - The `td` element - Interface `HTMLTableHeaderCellElement`\n * Note: Most browsers currently adher to the W3C DOM Level 2 spec\n * (https://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-82915075)\n * which suggests that browsers should use HTMLTableCellElement for\n * both TD and TH elements. WhatWG separates these.\n * Test: Object.prototype.toString.call(document.createElement('th'))\n * - Chrome === \"[object HTMLTableCellElement]\"\n * - Firefox === \"[object HTMLTableCellElement]\"\n * - Safari === \"[object HTMLTableCellElement]\"\n */\n if (obj.tagName === 'TH') {\n return 'HTMLTableHeaderCellElement';\n }\n }\n }\n\n /* ! Speed optimisation\n * Pre:\n * Float64Array x 625,644 ops/sec ±1.58% (80 runs sampled)\n * Float32Array x 1,279,852 ops/sec ±2.91% (77 runs sampled)\n * Uint32Array x 1,178,185 ops/sec ±1.95% (83 runs sampled)\n * Uint16Array x 1,008,380 ops/sec ±2.25% (80 runs sampled)\n * Uint8Array x 1,128,040 ops/sec ±2.11% (81 runs sampled)\n * Int32Array x 1,170,119 ops/sec ±2.88% (80 runs sampled)\n * Int16Array x 1,176,348 ops/sec ±5.79% (86 runs sampled)\n * Int8Array x 1,058,707 ops/sec ±4.94% (77 runs sampled)\n * Uint8ClampedArray x 1,110,633 ops/sec ±4.20% (80 runs sampled)\n * Post:\n * Float64Array x 7,105,671 ops/sec ±13.47% (64 runs sampled)\n * Float32Array x 5,887,912 ops/sec ±1.46% (82 runs sampled)\n * Uint32Array x 6,491,661 ops/sec ±1.76% (79 runs sampled)\n * Uint16Array x 6,559,795 ops/sec ±1.67% (82 runs sampled)\n * Uint8Array x 6,463,966 ops/sec ±1.43% (85 runs sampled)\n * Int32Array x 5,641,841 ops/sec ±3.49% (81 runs sampled)\n * Int16Array x 6,583,511 ops/sec ±1.98% (80 runs sampled)\n * Int8Array x 6,606,078 ops/sec ±1.74% (81 runs sampled)\n * Uint8ClampedArray x 6,602,224 ops/sec ±1.77% (83 runs sampled)\n */\n var stringTag = (symbolToStringTagExists && obj[Symbol.toStringTag]);\n if (typeof stringTag === 'string') {\n return stringTag;\n }\n\n var objPrototype = Object.getPrototypeOf(obj);\n /* ! Speed optimisation\n * Pre:\n * regex literal x 1,772,385 ops/sec ±1.85% (77 runs sampled)\n * regex constructor x 2,143,634 ops/sec ±2.46% (78 runs sampled)\n * Post:\n * regex literal x 3,928,009 ops/sec ±0.65% (78 runs sampled)\n * regex constructor x 3,931,108 ops/sec ±0.58% (84 runs sampled)\n */\n if (objPrototype === RegExp.prototype) {\n return 'RegExp';\n }\n\n /* ! Speed optimisation\n * Pre:\n * date x 2,130,074 ops/sec ±4.42% (68 runs sampled)\n * Post:\n * date x 3,953,779 ops/sec ±1.35% (77 runs sampled)\n */\n if (objPrototype === Date.prototype) {\n return 'Date';\n }\n\n /* ! Spec Conformance\n * (http://www.ecma-international.org/ecma-262/6.0/index.html#sec-promise.prototype-@@tostringtag)\n * ES6$25.4.5.4 - Promise.prototype[@@toStringTag] should be \"Promise\":\n * Test: `Object.prototype.toString.call(Promise.resolve())``\n * - Chrome <=47 === \"[object Object]\"\n * - Edge <=20 === \"[object Object]\"\n * - Firefox 29-Latest === \"[object Promise]\"\n * - Safari 7.1-Latest === \"[object Promise]\"\n */\n if (promiseExists && objPrototype === Promise.prototype) {\n return 'Promise';\n }\n\n /* ! Speed optimisation\n * Pre:\n * set x 2,222,186 ops/sec ±1.31% (82 runs sampled)\n * Post:\n * set x 4,545,879 ops/sec ±1.13% (83 runs sampled)\n */\n if (setExists && objPrototype === Set.prototype) {\n return 'Set';\n }\n\n /* ! Speed optimisation\n * Pre:\n * map x 2,396,842 ops/sec ±1.59% (81 runs sampled)\n * Post:\n * map x 4,183,945 ops/sec ±6.59% (82 runs sampled)\n */\n if (mapExists && objPrototype === Map.prototype) {\n return 'Map';\n }\n\n /* ! Speed optimisation\n * Pre:\n * weakset x 1,323,220 ops/sec ±2.17% (76 runs sampled)\n * Post:\n * weakset x 4,237,510 ops/sec ±2.01% (77 runs sampled)\n */\n if (weakSetExists && objPrototype === WeakSet.prototype) {\n return 'WeakSet';\n }\n\n /* ! Speed optimisation\n * Pre:\n * weakmap x 1,500,260 ops/sec ±2.02% (78 runs sampled)\n * Post:\n * weakmap x 3,881,384 ops/sec ±1.45% (82 runs sampled)\n */\n if (weakMapExists && objPrototype === WeakMap.prototype) {\n return 'WeakMap';\n }\n\n /* ! Spec Conformance\n * (http://www.ecma-international.org/ecma-262/6.0/index.html#sec-dataview.prototype-@@tostringtag)\n * ES6$24.2.4.21 - DataView.prototype[@@toStringTag] should be \"DataView\":\n * Test: `Object.prototype.toString.call(new DataView(new ArrayBuffer(1)))``\n * - Edge <=13 === \"[object Object]\"\n */\n if (dataViewExists && objPrototype === DataView.prototype) {\n return 'DataView';\n }\n\n /* ! Spec Conformance\n * (http://www.ecma-international.org/ecma-262/6.0/index.html#sec-%mapiteratorprototype%-@@tostringtag)\n * ES6$23.1.5.2.2 - %MapIteratorPrototype%[@@toStringTag] should be \"Map Iterator\":\n * Test: `Object.prototype.toString.call(new Map().entries())``\n * - Edge <=13 === \"[object Object]\"\n */\n if (mapExists && objPrototype === mapIteratorPrototype) {\n return 'Map Iterator';\n }\n\n /* ! Spec Conformance\n * (http://www.ecma-international.org/ecma-262/6.0/index.html#sec-%setiteratorprototype%-@@tostringtag)\n * ES6$23.2.5.2.2 - %SetIteratorPrototype%[@@toStringTag] should be \"Set Iterator\":\n * Test: `Object.prototype.toString.call(new Set().entries())``\n * - Edge <=13 === \"[object Object]\"\n */\n if (setExists && objPrototype === setIteratorPrototype) {\n return 'Set Iterator';\n }\n\n /* ! Spec Conformance\n * (http://www.ecma-international.org/ecma-262/6.0/index.html#sec-%arrayiteratorprototype%-@@tostringtag)\n * ES6$22.1.5.2.2 - %ArrayIteratorPrototype%[@@toStringTag] should be \"Array Iterator\":\n * Test: `Object.prototype.toString.call([][Symbol.iterator]())``\n * - Edge <=13 === \"[object Object]\"\n */\n if (arrayIteratorExists && objPrototype === arrayIteratorPrototype) {\n return 'Array Iterator';\n }\n\n /* ! Spec Conformance\n * (http://www.ecma-international.org/ecma-262/6.0/index.html#sec-%stringiteratorprototype%-@@tostringtag)\n * ES6$21.1.5.2.2 - %StringIteratorPrototype%[@@toStringTag] should be \"String Iterator\":\n * Test: `Object.prototype.toString.call(''[Symbol.iterator]())``\n * - Edge <=13 === \"[object Object]\"\n */\n if (stringIteratorExists && objPrototype === stringIteratorPrototype) {\n return 'String Iterator';\n }\n\n /* ! Speed optimisation\n * Pre:\n * object from null x 2,424,320 ops/sec ±1.67% (76 runs sampled)\n * Post:\n * object from null x 5,838,000 ops/sec ±0.99% (84 runs sampled)\n */\n if (objPrototype === null) {\n return 'Object';\n }\n\n return Object\n .prototype\n .toString\n .call(obj)\n .slice(toStringLeftSliceLength, toStringRightSliceLength);\n}\n\nreturn typeDetect;\n\n})));\n","/**\n * Convert array of 16 byte values to UUID string format of the form:\n * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX\n */\nvar byteToHex = [];\nfor (var i = 0; i < 256; ++i) {\n byteToHex[i] = (i + 0x100).toString(16).substr(1);\n}\n\nfunction bytesToUuid(buf, offset) {\n var i = offset || 0;\n var bth = byteToHex;\n return bth[buf[i++]] + bth[buf[i++]] +\n bth[buf[i++]] + bth[buf[i++]] + '-' +\n bth[buf[i++]] + bth[buf[i++]] + '-' +\n bth[buf[i++]] + bth[buf[i++]] + '-' +\n bth[buf[i++]] + bth[buf[i++]] + '-' +\n bth[buf[i++]] + bth[buf[i++]] +\n bth[buf[i++]] + bth[buf[i++]] +\n bth[buf[i++]] + bth[buf[i++]];\n}\n\nmodule.exports = bytesToUuid;\n","// Unique ID creation requires a high quality random # generator. In the\n// browser this is a little complicated due to unknown quality of Math.random()\n// and inconsistent support for the `crypto` API. We do the best we can via\n// feature-detection\n\n// getRandomValues needs to be invoked in a context where \"this\" is a Crypto implementation.\nvar getRandomValues = (typeof(crypto) != 'undefined' && crypto.getRandomValues.bind(crypto)) ||\n (typeof(msCrypto) != 'undefined' && msCrypto.getRandomValues.bind(msCrypto));\nif (getRandomValues) {\n // WHATWG crypto RNG - http://wiki.whatwg.org/wiki/Crypto\n var rnds8 = new Uint8Array(16); // eslint-disable-line no-undef\n\n module.exports = function whatwgRNG() {\n getRandomValues(rnds8);\n return rnds8;\n };\n} else {\n // Math.random()-based (RNG)\n //\n // If all else fails, use Math.random(). It's fast, but is of unspecified\n // quality.\n var rnds = new Array(16);\n\n module.exports = function mathRNG() {\n for (var i = 0, r; i < 16; i++) {\n if ((i & 0x03) === 0) r = Math.random() * 0x100000000;\n rnds[i] = r >>> ((i & 0x03) << 3) & 0xff;\n }\n\n return rnds;\n };\n}\n","// A utility function that adds a preamble to each Netscript JS\r\n// script. This preamble will set all the global functions and\r\n// variables appropriately for the module.\r\n//\r\n// One caveat is that we don't allow the variables in the preable\r\n// to change. Unlike in normal Javascript, this would not change\r\n// properties of self. It would instead just change the variable\r\n// within the given module -- not good! Users should not really\r\n// need to do this anyway.\r\n\r\nimport uuidv4 from \"uuid/v4\";\r\nimport {sprintf} from \"sprintf-js\";\r\n\r\nwindow.__NSJS__environments = {};\r\n\r\n// Returns the UUID for the env.\r\nexport function registerEnv(env) {\r\n const uuid = uuidv4();\r\n window.__NSJS__environments[uuid] = env;\r\n return uuid;\r\n}\r\n\r\nexport function unregisterEnv(uuid) {\r\n delete window.__NSJS__environments[uuid];\r\n}\r\n\r\nexport function makeEnvHeader(uuid) {\r\n if (!(uuid in window.__NSJS__environments)) throw new Error(\"uuid is not in the environment\" + uuid);\r\n\r\n const env = window.__NSJS__environments[uuid];\r\n var envLines = [];\r\n for (const prop in env) {\r\n envLines.push(\"const \", prop, \" = \", \"__NSJS_ENV[\\\"\", prop, \"\\\"];\\n\");\r\n }\r\n\r\n return sprintf(`\r\n 'use strict';\r\n const __NSJS_ENV = window.__NSJS__environments['%s'];\r\n // The global variable assignments (hack, weaken, etc.).\r\n %s\r\n `, uuid, envLines.join(\"\"));\r\n}","/* @preserve\n * The MIT License (MIT)\n * \n * Copyright (c) 2013-2017 Petka Antonov\n * \n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n * \n */\n/**\n * bluebird build version 3.5.1\n * Features enabled: core, race, call_get, generators, map, nodeify, promisify, props, reduce, settle, some, using, timers, filter, any, each\n*/\n!function(e){if(\"object\"==typeof exports&&\"undefined\"!=typeof module)module.exports=e();else if(\"function\"==typeof define&&define.amd)define([],e);else{var f;\"undefined\"!=typeof window?f=window:\"undefined\"!=typeof global?f=global:\"undefined\"!=typeof self&&(f=self),f.Promise=e()}}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof _dereq_==\"function\"&&_dereq_;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 _dereq_==\"function\"&&_dereq_;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){\n\"use strict\";\nmodule.exports = function(Promise) {\nvar SomePromiseArray = Promise._SomePromiseArray;\nfunction any(promises) {\n var ret = new SomePromiseArray(promises);\n var promise = ret.promise();\n ret.setHowMany(1);\n ret.setUnwrap();\n ret.init();\n return promise;\n}\n\nPromise.any = function (promises) {\n return any(promises);\n};\n\nPromise.prototype.any = function () {\n return any(this);\n};\n\n};\n\n},{}],2:[function(_dereq_,module,exports){\n\"use strict\";\nvar firstLineError;\ntry {throw new Error(); } catch (e) {firstLineError = e;}\nvar schedule = _dereq_(\"./schedule\");\nvar Queue = _dereq_(\"./queue\");\nvar util = _dereq_(\"./util\");\n\nfunction Async() {\n this._customScheduler = false;\n this._isTickUsed = false;\n this._lateQueue = new Queue(16);\n this._normalQueue = new Queue(16);\n this._haveDrainedQueues = false;\n this._trampolineEnabled = true;\n var self = this;\n this.drainQueues = function () {\n self._drainQueues();\n };\n this._schedule = schedule;\n}\n\nAsync.prototype.setScheduler = function(fn) {\n var prev = this._schedule;\n this._schedule = fn;\n this._customScheduler = true;\n return prev;\n};\n\nAsync.prototype.hasCustomScheduler = function() {\n return this._customScheduler;\n};\n\nAsync.prototype.enableTrampoline = function() {\n this._trampolineEnabled = true;\n};\n\nAsync.prototype.disableTrampolineIfNecessary = function() {\n if (util.hasDevTools) {\n this._trampolineEnabled = false;\n }\n};\n\nAsync.prototype.haveItemsQueued = function () {\n return this._isTickUsed || this._haveDrainedQueues;\n};\n\n\nAsync.prototype.fatalError = function(e, isNode) {\n if (isNode) {\n process.stderr.write(\"Fatal \" + (e instanceof Error ? e.stack : e) +\n \"\\n\");\n process.exit(2);\n } else {\n this.throwLater(e);\n }\n};\n\nAsync.prototype.throwLater = function(fn, arg) {\n if (arguments.length === 1) {\n arg = fn;\n fn = function () { throw arg; };\n }\n if (typeof setTimeout !== \"undefined\") {\n setTimeout(function() {\n fn(arg);\n }, 0);\n } else try {\n this._schedule(function() {\n fn(arg);\n });\n } catch (e) {\n throw new Error(\"No async scheduler available\\u000a\\u000a See http://goo.gl/MqrFmX\\u000a\");\n }\n};\n\nfunction AsyncInvokeLater(fn, receiver, arg) {\n this._lateQueue.push(fn, receiver, arg);\n this._queueTick();\n}\n\nfunction AsyncInvoke(fn, receiver, arg) {\n this._normalQueue.push(fn, receiver, arg);\n this._queueTick();\n}\n\nfunction AsyncSettlePromises(promise) {\n this._normalQueue._pushOne(promise);\n this._queueTick();\n}\n\nif (!util.hasDevTools) {\n Async.prototype.invokeLater = AsyncInvokeLater;\n Async.prototype.invoke = AsyncInvoke;\n Async.prototype.settlePromises = AsyncSettlePromises;\n} else {\n Async.prototype.invokeLater = function (fn, receiver, arg) {\n if (this._trampolineEnabled) {\n AsyncInvokeLater.call(this, fn, receiver, arg);\n } else {\n this._schedule(function() {\n setTimeout(function() {\n fn.call(receiver, arg);\n }, 100);\n });\n }\n };\n\n Async.prototype.invoke = function (fn, receiver, arg) {\n if (this._trampolineEnabled) {\n AsyncInvoke.call(this, fn, receiver, arg);\n } else {\n this._schedule(function() {\n fn.call(receiver, arg);\n });\n }\n };\n\n Async.prototype.settlePromises = function(promise) {\n if (this._trampolineEnabled) {\n AsyncSettlePromises.call(this, promise);\n } else {\n this._schedule(function() {\n promise._settlePromises();\n });\n }\n };\n}\n\nAsync.prototype._drainQueue = function(queue) {\n while (queue.length() > 0) {\n var fn = queue.shift();\n if (typeof fn !== \"function\") {\n fn._settlePromises();\n continue;\n }\n var receiver = queue.shift();\n var arg = queue.shift();\n fn.call(receiver, arg);\n }\n};\n\nAsync.prototype._drainQueues = function () {\n this._drainQueue(this._normalQueue);\n this._reset();\n this._haveDrainedQueues = true;\n this._drainQueue(this._lateQueue);\n};\n\nAsync.prototype._queueTick = function () {\n if (!this._isTickUsed) {\n this._isTickUsed = true;\n this._schedule(this.drainQueues);\n }\n};\n\nAsync.prototype._reset = function () {\n this._isTickUsed = false;\n};\n\nmodule.exports = Async;\nmodule.exports.firstLineError = firstLineError;\n\n},{\"./queue\":26,\"./schedule\":29,\"./util\":36}],3:[function(_dereq_,module,exports){\n\"use strict\";\nmodule.exports = function(Promise, INTERNAL, tryConvertToPromise, debug) {\nvar calledBind = false;\nvar rejectThis = function(_, e) {\n this._reject(e);\n};\n\nvar targetRejected = function(e, context) {\n context.promiseRejectionQueued = true;\n context.bindingPromise._then(rejectThis, rejectThis, null, this, e);\n};\n\nvar bindingResolved = function(thisArg, context) {\n if (((this._bitField & 50397184) === 0)) {\n this._resolveCallback(context.target);\n }\n};\n\nvar bindingRejected = function(e, context) {\n if (!context.promiseRejectionQueued) this._reject(e);\n};\n\nPromise.prototype.bind = function (thisArg) {\n if (!calledBind) {\n calledBind = true;\n Promise.prototype._propagateFrom = debug.propagateFromFunction();\n Promise.prototype._boundValue = debug.boundValueFunction();\n }\n var maybePromise = tryConvertToPromise(thisArg);\n var ret = new Promise(INTERNAL);\n ret._propagateFrom(this, 1);\n var target = this._target();\n ret._setBoundTo(maybePromise);\n if (maybePromise instanceof Promise) {\n var context = {\n promiseRejectionQueued: false,\n promise: ret,\n target: target,\n bindingPromise: maybePromise\n };\n target._then(INTERNAL, targetRejected, undefined, ret, context);\n maybePromise._then(\n bindingResolved, bindingRejected, undefined, ret, context);\n ret._setOnCancel(maybePromise);\n } else {\n ret._resolveCallback(target);\n }\n return ret;\n};\n\nPromise.prototype._setBoundTo = function (obj) {\n if (obj !== undefined) {\n this._bitField = this._bitField | 2097152;\n this._boundTo = obj;\n } else {\n this._bitField = this._bitField & (~2097152);\n }\n};\n\nPromise.prototype._isBound = function () {\n return (this._bitField & 2097152) === 2097152;\n};\n\nPromise.bind = function (thisArg, value) {\n return Promise.resolve(value).bind(thisArg);\n};\n};\n\n},{}],4:[function(_dereq_,module,exports){\n\"use strict\";\nvar old;\nif (typeof Promise !== \"undefined\") old = Promise;\nfunction noConflict() {\n try { if (Promise === bluebird) Promise = old; }\n catch (e) {}\n return bluebird;\n}\nvar bluebird = _dereq_(\"./promise\")();\nbluebird.noConflict = noConflict;\nmodule.exports = bluebird;\n\n},{\"./promise\":22}],5:[function(_dereq_,module,exports){\n\"use strict\";\nvar cr = Object.create;\nif (cr) {\n var callerCache = cr(null);\n var getterCache = cr(null);\n callerCache[\" size\"] = getterCache[\" size\"] = 0;\n}\n\nmodule.exports = function(Promise) {\nvar util = _dereq_(\"./util\");\nvar canEvaluate = util.canEvaluate;\nvar isIdentifier = util.isIdentifier;\n\nvar getMethodCaller;\nvar getGetter;\nif (!true) {\nvar makeMethodCaller = function (methodName) {\n return new Function(\"ensureMethod\", \" \\n\\\n return function(obj) { \\n\\\n 'use strict' \\n\\\n var len = this.length; \\n\\\n ensureMethod(obj, 'methodName'); \\n\\\n switch(len) { \\n\\\n case 1: return obj.methodName(this[0]); \\n\\\n case 2: return obj.methodName(this[0], this[1]); \\n\\\n case 3: return obj.methodName(this[0], this[1], this[2]); \\n\\\n case 0: return obj.methodName(); \\n\\\n default: \\n\\\n return obj.methodName.apply(obj, this); \\n\\\n } \\n\\\n }; \\n\\\n \".replace(/methodName/g, methodName))(ensureMethod);\n};\n\nvar makeGetter = function (propertyName) {\n return new Function(\"obj\", \" \\n\\\n 'use strict'; \\n\\\n return obj.propertyName; \\n\\\n \".replace(\"propertyName\", propertyName));\n};\n\nvar getCompiled = function(name, compiler, cache) {\n var ret = cache[name];\n if (typeof ret !== \"function\") {\n if (!isIdentifier(name)) {\n return null;\n }\n ret = compiler(name);\n cache[name] = ret;\n cache[\" size\"]++;\n if (cache[\" size\"] > 512) {\n var keys = Object.keys(cache);\n for (var i = 0; i < 256; ++i) delete cache[keys[i]];\n cache[\" size\"] = keys.length - 256;\n }\n }\n return ret;\n};\n\ngetMethodCaller = function(name) {\n return getCompiled(name, makeMethodCaller, callerCache);\n};\n\ngetGetter = function(name) {\n return getCompiled(name, makeGetter, getterCache);\n};\n}\n\nfunction ensureMethod(obj, methodName) {\n var fn;\n if (obj != null) fn = obj[methodName];\n if (typeof fn !== \"function\") {\n var message = \"Object \" + util.classString(obj) + \" has no method '\" +\n util.toString(methodName) + \"'\";\n throw new Promise.TypeError(message);\n }\n return fn;\n}\n\nfunction caller(obj) {\n var methodName = this.pop();\n var fn = ensureMethod(obj, methodName);\n return fn.apply(obj, this);\n}\nPromise.prototype.call = function (methodName) {\n var args = [].slice.call(arguments, 1);;\n if (!true) {\n if (canEvaluate) {\n var maybeCaller = getMethodCaller(methodName);\n if (maybeCaller !== null) {\n return this._then(\n maybeCaller, undefined, undefined, args, undefined);\n }\n }\n }\n args.push(methodName);\n return this._then(caller, undefined, undefined, args, undefined);\n};\n\nfunction namedGetter(obj) {\n return obj[this];\n}\nfunction indexedGetter(obj) {\n var index = +this;\n if (index < 0) index = Math.max(0, index + obj.length);\n return obj[index];\n}\nPromise.prototype.get = function (propertyName) {\n var isIndex = (typeof propertyName === \"number\");\n var getter;\n if (!isIndex) {\n if (canEvaluate) {\n var maybeGetter = getGetter(propertyName);\n getter = maybeGetter !== null ? maybeGetter : namedGetter;\n } else {\n getter = namedGetter;\n }\n } else {\n getter = indexedGetter;\n }\n return this._then(getter, undefined, undefined, propertyName, undefined);\n};\n};\n\n},{\"./util\":36}],6:[function(_dereq_,module,exports){\n\"use strict\";\nmodule.exports = function(Promise, PromiseArray, apiRejection, debug) {\nvar util = _dereq_(\"./util\");\nvar tryCatch = util.tryCatch;\nvar errorObj = util.errorObj;\nvar async = Promise._async;\n\nPromise.prototype[\"break\"] = Promise.prototype.cancel = function() {\n if (!debug.cancellation()) return this._warn(\"cancellation is disabled\");\n\n var promise = this;\n var child = promise;\n while (promise._isCancellable()) {\n if (!promise._cancelBy(child)) {\n if (child._isFollowing()) {\n child._followee().cancel();\n } else {\n child._cancelBranched();\n }\n break;\n }\n\n var parent = promise._cancellationParent;\n if (parent == null || !parent._isCancellable()) {\n if (promise._isFollowing()) {\n promise._followee().cancel();\n } else {\n promise._cancelBranched();\n }\n break;\n } else {\n if (promise._isFollowing()) promise._followee().cancel();\n promise._setWillBeCancelled();\n child = promise;\n promise = parent;\n }\n }\n};\n\nPromise.prototype._branchHasCancelled = function() {\n this._branchesRemainingToCancel--;\n};\n\nPromise.prototype._enoughBranchesHaveCancelled = function() {\n return this._branchesRemainingToCancel === undefined ||\n this._branchesRemainingToCancel <= 0;\n};\n\nPromise.prototype._cancelBy = function(canceller) {\n if (canceller === this) {\n this._branchesRemainingToCancel = 0;\n this._invokeOnCancel();\n return true;\n } else {\n this._branchHasCancelled();\n if (this._enoughBranchesHaveCancelled()) {\n this._invokeOnCancel();\n return true;\n }\n }\n return false;\n};\n\nPromise.prototype._cancelBranched = function() {\n if (this._enoughBranchesHaveCancelled()) {\n this._cancel();\n }\n};\n\nPromise.prototype._cancel = function() {\n if (!this._isCancellable()) return;\n this._setCancelled();\n async.invoke(this._cancelPromises, this, undefined);\n};\n\nPromise.prototype._cancelPromises = function() {\n if (this._length() > 0) this._settlePromises();\n};\n\nPromise.prototype._unsetOnCancel = function() {\n this._onCancelField = undefined;\n};\n\nPromise.prototype._isCancellable = function() {\n return this.isPending() && !this._isCancelled();\n};\n\nPromise.prototype.isCancellable = function() {\n return this.isPending() && !this.isCancelled();\n};\n\nPromise.prototype._doInvokeOnCancel = function(onCancelCallback, internalOnly) {\n if (util.isArray(onCancelCallback)) {\n for (var i = 0; i < onCancelCallback.length; ++i) {\n this._doInvokeOnCancel(onCancelCallback[i], internalOnly);\n }\n } else if (onCancelCallback !== undefined) {\n if (typeof onCancelCallback === \"function\") {\n if (!internalOnly) {\n var e = tryCatch(onCancelCallback).call(this._boundValue());\n if (e === errorObj) {\n this._attachExtraTrace(e.e);\n async.throwLater(e.e);\n }\n }\n } else {\n onCancelCallback._resultCancelled(this);\n }\n }\n};\n\nPromise.prototype._invokeOnCancel = function() {\n var onCancelCallback = this._onCancel();\n this._unsetOnCancel();\n async.invoke(this._doInvokeOnCancel, this, onCancelCallback);\n};\n\nPromise.prototype._invokeInternalOnCancel = function() {\n if (this._isCancellable()) {\n this._doInvokeOnCancel(this._onCancel(), true);\n this._unsetOnCancel();\n }\n};\n\nPromise.prototype._resultCancelled = function() {\n this.cancel();\n};\n\n};\n\n},{\"./util\":36}],7:[function(_dereq_,module,exports){\n\"use strict\";\nmodule.exports = function(NEXT_FILTER) {\nvar util = _dereq_(\"./util\");\nvar getKeys = _dereq_(\"./es5\").keys;\nvar tryCatch = util.tryCatch;\nvar errorObj = util.errorObj;\n\nfunction catchFilter(instances, cb, promise) {\n return function(e) {\n var boundTo = promise._boundValue();\n predicateLoop: for (var i = 0; i < instances.length; ++i) {\n var item = instances[i];\n\n if (item === Error ||\n (item != null && item.prototype instanceof Error)) {\n if (e instanceof item) {\n return tryCatch(cb).call(boundTo, e);\n }\n } else if (typeof item === \"function\") {\n var matchesPredicate = tryCatch(item).call(boundTo, e);\n if (matchesPredicate === errorObj) {\n return matchesPredicate;\n } else if (matchesPredicate) {\n return tryCatch(cb).call(boundTo, e);\n }\n } else if (util.isObject(e)) {\n var keys = getKeys(item);\n for (var j = 0; j < keys.length; ++j) {\n var key = keys[j];\n if (item[key] != e[key]) {\n continue predicateLoop;\n }\n }\n return tryCatch(cb).call(boundTo, e);\n }\n }\n return NEXT_FILTER;\n };\n}\n\nreturn catchFilter;\n};\n\n},{\"./es5\":13,\"./util\":36}],8:[function(_dereq_,module,exports){\n\"use strict\";\nmodule.exports = function(Promise) {\nvar longStackTraces = false;\nvar contextStack = [];\n\nPromise.prototype._promiseCreated = function() {};\nPromise.prototype._pushContext = function() {};\nPromise.prototype._popContext = function() {return null;};\nPromise._peekContext = Promise.prototype._peekContext = function() {};\n\nfunction Context() {\n this._trace = new Context.CapturedTrace(peekContext());\n}\nContext.prototype._pushContext = function () {\n if (this._trace !== undefined) {\n this._trace._promiseCreated = null;\n contextStack.push(this._trace);\n }\n};\n\nContext.prototype._popContext = function () {\n if (this._trace !== undefined) {\n var trace = contextStack.pop();\n var ret = trace._promiseCreated;\n trace._promiseCreated = null;\n return ret;\n }\n return null;\n};\n\nfunction createContext() {\n if (longStackTraces) return new Context();\n}\n\nfunction peekContext() {\n var lastIndex = contextStack.length - 1;\n if (lastIndex >= 0) {\n return contextStack[lastIndex];\n }\n return undefined;\n}\nContext.CapturedTrace = null;\nContext.create = createContext;\nContext.deactivateLongStackTraces = function() {};\nContext.activateLongStackTraces = function() {\n var Promise_pushContext = Promise.prototype._pushContext;\n var Promise_popContext = Promise.prototype._popContext;\n var Promise_PeekContext = Promise._peekContext;\n var Promise_peekContext = Promise.prototype._peekContext;\n var Promise_promiseCreated = Promise.prototype._promiseCreated;\n Context.deactivateLongStackTraces = function() {\n Promise.prototype._pushContext = Promise_pushContext;\n Promise.prototype._popContext = Promise_popContext;\n Promise._peekContext = Promise_PeekContext;\n Promise.prototype._peekContext = Promise_peekContext;\n Promise.prototype._promiseCreated = Promise_promiseCreated;\n longStackTraces = false;\n };\n longStackTraces = true;\n Promise.prototype._pushContext = Context.prototype._pushContext;\n Promise.prototype._popContext = Context.prototype._popContext;\n Promise._peekContext = Promise.prototype._peekContext = peekContext;\n Promise.prototype._promiseCreated = function() {\n var ctx = this._peekContext();\n if (ctx && ctx._promiseCreated == null) ctx._promiseCreated = this;\n };\n};\nreturn Context;\n};\n\n},{}],9:[function(_dereq_,module,exports){\n\"use strict\";\nmodule.exports = function(Promise, Context) {\nvar getDomain = Promise._getDomain;\nvar async = Promise._async;\nvar Warning = _dereq_(\"./errors\").Warning;\nvar util = _dereq_(\"./util\");\nvar canAttachTrace = util.canAttachTrace;\nvar unhandledRejectionHandled;\nvar possiblyUnhandledRejection;\nvar bluebirdFramePattern =\n /[\\\\\\/]bluebird[\\\\\\/]js[\\\\\\/](release|debug|instrumented)/;\nvar nodeFramePattern = /\\((?:timers\\.js):\\d+:\\d+\\)/;\nvar parseLinePattern = /[\\/<\\(](.+?):(\\d+):(\\d+)\\)?\\s*$/;\nvar stackFramePattern = null;\nvar formatStack = null;\nvar indentStackFrames = false;\nvar printWarning;\nvar debugging = !!(util.env(\"BLUEBIRD_DEBUG\") != 0 &&\n (true ||\n util.env(\"BLUEBIRD_DEBUG\") ||\n util.env(\"NODE_ENV\") === \"development\"));\n\nvar warnings = !!(util.env(\"BLUEBIRD_WARNINGS\") != 0 &&\n (debugging || util.env(\"BLUEBIRD_WARNINGS\")));\n\nvar longStackTraces = !!(util.env(\"BLUEBIRD_LONG_STACK_TRACES\") != 0 &&\n (debugging || util.env(\"BLUEBIRD_LONG_STACK_TRACES\")));\n\nvar wForgottenReturn = util.env(\"BLUEBIRD_W_FORGOTTEN_RETURN\") != 0 &&\n (warnings || !!util.env(\"BLUEBIRD_W_FORGOTTEN_RETURN\"));\n\nPromise.prototype.suppressUnhandledRejections = function() {\n var target = this._target();\n target._bitField = ((target._bitField & (~1048576)) |\n 524288);\n};\n\nPromise.prototype._ensurePossibleRejectionHandled = function () {\n if ((this._bitField & 524288) !== 0) return;\n this._setRejectionIsUnhandled();\n var self = this;\n setTimeout(function() {\n self._notifyUnhandledRejection();\n }, 1);\n};\n\nPromise.prototype._notifyUnhandledRejectionIsHandled = function () {\n fireRejectionEvent(\"rejectionHandled\",\n unhandledRejectionHandled, undefined, this);\n};\n\nPromise.prototype._setReturnedNonUndefined = function() {\n this._bitField = this._bitField | 268435456;\n};\n\nPromise.prototype._returnedNonUndefined = function() {\n return (this._bitField & 268435456) !== 0;\n};\n\nPromise.prototype._notifyUnhandledRejection = function () {\n if (this._isRejectionUnhandled()) {\n var reason = this._settledValue();\n this._setUnhandledRejectionIsNotified();\n fireRejectionEvent(\"unhandledRejection\",\n possiblyUnhandledRejection, reason, this);\n }\n};\n\nPromise.prototype._setUnhandledRejectionIsNotified = function () {\n this._bitField = this._bitField | 262144;\n};\n\nPromise.prototype._unsetUnhandledRejectionIsNotified = function () {\n this._bitField = this._bitField & (~262144);\n};\n\nPromise.prototype._isUnhandledRejectionNotified = function () {\n return (this._bitField & 262144) > 0;\n};\n\nPromise.prototype._setRejectionIsUnhandled = function () {\n this._bitField = this._bitField | 1048576;\n};\n\nPromise.prototype._unsetRejectionIsUnhandled = function () {\n this._bitField = this._bitField & (~1048576);\n if (this._isUnhandledRejectionNotified()) {\n this._unsetUnhandledRejectionIsNotified();\n this._notifyUnhandledRejectionIsHandled();\n }\n};\n\nPromise.prototype._isRejectionUnhandled = function () {\n return (this._bitField & 1048576) > 0;\n};\n\nPromise.prototype._warn = function(message, shouldUseOwnTrace, promise) {\n return warn(message, shouldUseOwnTrace, promise || this);\n};\n\nPromise.onPossiblyUnhandledRejection = function (fn) {\n var domain = getDomain();\n possiblyUnhandledRejection =\n typeof fn === \"function\" ? (domain === null ?\n fn : util.domainBind(domain, fn))\n : undefined;\n};\n\nPromise.onUnhandledRejectionHandled = function (fn) {\n var domain = getDomain();\n unhandledRejectionHandled =\n typeof fn === \"function\" ? (domain === null ?\n fn : util.domainBind(domain, fn))\n : undefined;\n};\n\nvar disableLongStackTraces = function() {};\nPromise.longStackTraces = function () {\n if (async.haveItemsQueued() && !config.longStackTraces) {\n throw new Error(\"cannot enable long stack traces after promises have been created\\u000a\\u000a See http://goo.gl/MqrFmX\\u000a\");\n }\n if (!config.longStackTraces && longStackTracesIsSupported()) {\n var Promise_captureStackTrace = Promise.prototype._captureStackTrace;\n var Promise_attachExtraTrace = Promise.prototype._attachExtraTrace;\n config.longStackTraces = true;\n disableLongStackTraces = function() {\n if (async.haveItemsQueued() && !config.longStackTraces) {\n throw new Error(\"cannot enable long stack traces after promises have been created\\u000a\\u000a See http://goo.gl/MqrFmX\\u000a\");\n }\n Promise.prototype._captureStackTrace = Promise_captureStackTrace;\n Promise.prototype._attachExtraTrace = Promise_attachExtraTrace;\n Context.deactivateLongStackTraces();\n async.enableTrampoline();\n config.longStackTraces = false;\n };\n Promise.prototype._captureStackTrace = longStackTracesCaptureStackTrace;\n Promise.prototype._attachExtraTrace = longStackTracesAttachExtraTrace;\n Context.activateLongStackTraces();\n async.disableTrampolineIfNecessary();\n }\n};\n\nPromise.hasLongStackTraces = function () {\n return config.longStackTraces && longStackTracesIsSupported();\n};\n\nvar fireDomEvent = (function() {\n try {\n if (typeof CustomEvent === \"function\") {\n var event = new CustomEvent(\"CustomEvent\");\n util.global.dispatchEvent(event);\n return function(name, event) {\n var domEvent = new CustomEvent(name.toLowerCase(), {\n detail: event,\n cancelable: true\n });\n return !util.global.dispatchEvent(domEvent);\n };\n } else if (typeof Event === \"function\") {\n var event = new Event(\"CustomEvent\");\n util.global.dispatchEvent(event);\n return function(name, event) {\n var domEvent = new Event(name.toLowerCase(), {\n cancelable: true\n });\n domEvent.detail = event;\n return !util.global.dispatchEvent(domEvent);\n };\n } else {\n var event = document.createEvent(\"CustomEvent\");\n event.initCustomEvent(\"testingtheevent\", false, true, {});\n util.global.dispatchEvent(event);\n return function(name, event) {\n var domEvent = document.createEvent(\"CustomEvent\");\n domEvent.initCustomEvent(name.toLowerCase(), false, true,\n event);\n return !util.global.dispatchEvent(domEvent);\n };\n }\n } catch (e) {}\n return function() {\n return false;\n };\n})();\n\nvar fireGlobalEvent = (function() {\n if (util.isNode) {\n return function() {\n return process.emit.apply(process, arguments);\n };\n } else {\n if (!util.global) {\n return function() {\n return false;\n };\n }\n return function(name) {\n var methodName = \"on\" + name.toLowerCase();\n var method = util.global[methodName];\n if (!method) return false;\n method.apply(util.global, [].slice.call(arguments, 1));\n return true;\n };\n }\n})();\n\nfunction generatePromiseLifecycleEventObject(name, promise) {\n return {promise: promise};\n}\n\nvar eventToObjectGenerator = {\n promiseCreated: generatePromiseLifecycleEventObject,\n promiseFulfilled: generatePromiseLifecycleEventObject,\n promiseRejected: generatePromiseLifecycleEventObject,\n promiseResolved: generatePromiseLifecycleEventObject,\n promiseCancelled: generatePromiseLifecycleEventObject,\n promiseChained: function(name, promise, child) {\n return {promise: promise, child: child};\n },\n warning: function(name, warning) {\n return {warning: warning};\n },\n unhandledRejection: function (name, reason, promise) {\n return {reason: reason, promise: promise};\n },\n rejectionHandled: generatePromiseLifecycleEventObject\n};\n\nvar activeFireEvent = function (name) {\n var globalEventFired = false;\n try {\n globalEventFired = fireGlobalEvent.apply(null, arguments);\n } catch (e) {\n async.throwLater(e);\n globalEventFired = true;\n }\n\n var domEventFired = false;\n try {\n domEventFired = fireDomEvent(name,\n eventToObjectGenerator[name].apply(null, arguments));\n } catch (e) {\n async.throwLater(e);\n domEventFired = true;\n }\n\n return domEventFired || globalEventFired;\n};\n\nPromise.config = function(opts) {\n opts = Object(opts);\n if (\"longStackTraces\" in opts) {\n if (opts.longStackTraces) {\n Promise.longStackTraces();\n } else if (!opts.longStackTraces && Promise.hasLongStackTraces()) {\n disableLongStackTraces();\n }\n }\n if (\"warnings\" in opts) {\n var warningsOption = opts.warnings;\n config.warnings = !!warningsOption;\n wForgottenReturn = config.warnings;\n\n if (util.isObject(warningsOption)) {\n if (\"wForgottenReturn\" in warningsOption) {\n wForgottenReturn = !!warningsOption.wForgottenReturn;\n }\n }\n }\n if (\"cancellation\" in opts && opts.cancellation && !config.cancellation) {\n if (async.haveItemsQueued()) {\n throw new Error(\n \"cannot enable cancellation after promises are in use\");\n }\n Promise.prototype._clearCancellationData =\n cancellationClearCancellationData;\n Promise.prototype._propagateFrom = cancellationPropagateFrom;\n Promise.prototype._onCancel = cancellationOnCancel;\n Promise.prototype._setOnCancel = cancellationSetOnCancel;\n Promise.prototype._attachCancellationCallback =\n cancellationAttachCancellationCallback;\n Promise.prototype._execute = cancellationExecute;\n propagateFromFunction = cancellationPropagateFrom;\n config.cancellation = true;\n }\n if (\"monitoring\" in opts) {\n if (opts.monitoring && !config.monitoring) {\n config.monitoring = true;\n Promise.prototype._fireEvent = activeFireEvent;\n } else if (!opts.monitoring && config.monitoring) {\n config.monitoring = false;\n Promise.prototype._fireEvent = defaultFireEvent;\n }\n }\n return Promise;\n};\n\nfunction defaultFireEvent() { return false; }\n\nPromise.prototype._fireEvent = defaultFireEvent;\nPromise.prototype._execute = function(executor, resolve, reject) {\n try {\n executor(resolve, reject);\n } catch (e) {\n return e;\n }\n};\nPromise.prototype._onCancel = function () {};\nPromise.prototype._setOnCancel = function (handler) { ; };\nPromise.prototype._attachCancellationCallback = function(onCancel) {\n ;\n};\nPromise.prototype._captureStackTrace = function () {};\nPromise.prototype._attachExtraTrace = function () {};\nPromise.prototype._clearCancellationData = function() {};\nPromise.prototype._propagateFrom = function (parent, flags) {\n ;\n ;\n};\n\nfunction cancellationExecute(executor, resolve, reject) {\n var promise = this;\n try {\n executor(resolve, reject, function(onCancel) {\n if (typeof onCancel !== \"function\") {\n throw new TypeError(\"onCancel must be a function, got: \" +\n util.toString(onCancel));\n }\n promise._attachCancellationCallback(onCancel);\n });\n } catch (e) {\n return e;\n }\n}\n\nfunction cancellationAttachCancellationCallback(onCancel) {\n if (!this._isCancellable()) return this;\n\n var previousOnCancel = this._onCancel();\n if (previousOnCancel !== undefined) {\n if (util.isArray(previousOnCancel)) {\n previousOnCancel.push(onCancel);\n } else {\n this._setOnCancel([previousOnCancel, onCancel]);\n }\n } else {\n this._setOnCancel(onCancel);\n }\n}\n\nfunction cancellationOnCancel() {\n return this._onCancelField;\n}\n\nfunction cancellationSetOnCancel(onCancel) {\n this._onCancelField = onCancel;\n}\n\nfunction cancellationClearCancellationData() {\n this._cancellationParent = undefined;\n this._onCancelField = undefined;\n}\n\nfunction cancellationPropagateFrom(parent, flags) {\n if ((flags & 1) !== 0) {\n this._cancellationParent = parent;\n var branchesRemainingToCancel = parent._branchesRemainingToCancel;\n if (branchesRemainingToCancel === undefined) {\n branchesRemainingToCancel = 0;\n }\n parent._branchesRemainingToCancel = branchesRemainingToCancel + 1;\n }\n if ((flags & 2) !== 0 && parent._isBound()) {\n this._setBoundTo(parent._boundTo);\n }\n}\n\nfunction bindingPropagateFrom(parent, flags) {\n if ((flags & 2) !== 0 && parent._isBound()) {\n this._setBoundTo(parent._boundTo);\n }\n}\nvar propagateFromFunction = bindingPropagateFrom;\n\nfunction boundValueFunction() {\n var ret = this._boundTo;\n if (ret !== undefined) {\n if (ret instanceof Promise) {\n if (ret.isFulfilled()) {\n return ret.value();\n } else {\n return undefined;\n }\n }\n }\n return ret;\n}\n\nfunction longStackTracesCaptureStackTrace() {\n this._trace = new CapturedTrace(this._peekContext());\n}\n\nfunction longStackTracesAttachExtraTrace(error, ignoreSelf) {\n if (canAttachTrace(error)) {\n var trace = this._trace;\n if (trace !== undefined) {\n if (ignoreSelf) trace = trace._parent;\n }\n if (trace !== undefined) {\n trace.attachExtraTrace(error);\n } else if (!error.__stackCleaned__) {\n var parsed = parseStackAndMessage(error);\n util.notEnumerableProp(error, \"stack\",\n parsed.message + \"\\n\" + parsed.stack.join(\"\\n\"));\n util.notEnumerableProp(error, \"__stackCleaned__\", true);\n }\n }\n}\n\nfunction checkForgottenReturns(returnValue, promiseCreated, name, promise,\n parent) {\n if (returnValue === undefined && promiseCreated !== null &&\n wForgottenReturn) {\n if (parent !== undefined && parent._returnedNonUndefined()) return;\n if ((promise._bitField & 65535) === 0) return;\n\n if (name) name = name + \" \";\n var handlerLine = \"\";\n var creatorLine = \"\";\n if (promiseCreated._trace) {\n var traceLines = promiseCreated._trace.stack.split(\"\\n\");\n var stack = cleanStack(traceLines);\n for (var i = stack.length - 1; i >= 0; --i) {\n var line = stack[i];\n if (!nodeFramePattern.test(line)) {\n var lineMatches = line.match(parseLinePattern);\n if (lineMatches) {\n handlerLine = \"at \" + lineMatches[1] +\n \":\" + lineMatches[2] + \":\" + lineMatches[3] + \" \";\n }\n break;\n }\n }\n\n if (stack.length > 0) {\n var firstUserLine = stack[0];\n for (var i = 0; i < traceLines.length; ++i) {\n\n if (traceLines[i] === firstUserLine) {\n if (i > 0) {\n creatorLine = \"\\n\" + traceLines[i - 1];\n }\n break;\n }\n }\n\n }\n }\n var msg = \"a promise was created in a \" + name +\n \"handler \" + handlerLine + \"but was not returned from it, \" +\n \"see http://goo.gl/rRqMUw\" +\n creatorLine;\n promise._warn(msg, true, promiseCreated);\n }\n}\n\nfunction deprecated(name, replacement) {\n var message = name +\n \" is deprecated and will be removed in a future version.\";\n if (replacement) message += \" Use \" + replacement + \" instead.\";\n return warn(message);\n}\n\nfunction warn(message, shouldUseOwnTrace, promise) {\n if (!config.warnings) return;\n var warning = new Warning(message);\n var ctx;\n if (shouldUseOwnTrace) {\n promise._attachExtraTrace(warning);\n } else if (config.longStackTraces && (ctx = Promise._peekContext())) {\n ctx.attachExtraTrace(warning);\n } else {\n var parsed = parseStackAndMessage(warning);\n warning.stack = parsed.message + \"\\n\" + parsed.stack.join(\"\\n\");\n }\n\n if (!activeFireEvent(\"warning\", warning)) {\n formatAndLogError(warning, \"\", true);\n }\n}\n\nfunction reconstructStack(message, stacks) {\n for (var i = 0; i < stacks.length - 1; ++i) {\n stacks[i].push(\"From previous event:\");\n stacks[i] = stacks[i].join(\"\\n\");\n }\n if (i < stacks.length) {\n stacks[i] = stacks[i].join(\"\\n\");\n }\n return message + \"\\n\" + stacks.join(\"\\n\");\n}\n\nfunction removeDuplicateOrEmptyJumps(stacks) {\n for (var i = 0; i < stacks.length; ++i) {\n if (stacks[i].length === 0 ||\n ((i + 1 < stacks.length) && stacks[i][0] === stacks[i+1][0])) {\n stacks.splice(i, 1);\n i--;\n }\n }\n}\n\nfunction removeCommonRoots(stacks) {\n var current = stacks[0];\n for (var i = 1; i < stacks.length; ++i) {\n var prev = stacks[i];\n var currentLastIndex = current.length - 1;\n var currentLastLine = current[currentLastIndex];\n var commonRootMeetPoint = -1;\n\n for (var j = prev.length - 1; j >= 0; --j) {\n if (prev[j] === currentLastLine) {\n commonRootMeetPoint = j;\n break;\n }\n }\n\n for (var j = commonRootMeetPoint; j >= 0; --j) {\n var line = prev[j];\n if (current[currentLastIndex] === line) {\n current.pop();\n currentLastIndex--;\n } else {\n break;\n }\n }\n current = prev;\n }\n}\n\nfunction cleanStack(stack) {\n var ret = [];\n for (var i = 0; i < stack.length; ++i) {\n var line = stack[i];\n var isTraceLine = \" (No stack trace)\" === line ||\n stackFramePattern.test(line);\n var isInternalFrame = isTraceLine && shouldIgnore(line);\n if (isTraceLine && !isInternalFrame) {\n if (indentStackFrames && line.charAt(0) !== \" \") {\n line = \" \" + line;\n }\n ret.push(line);\n }\n }\n return ret;\n}\n\nfunction stackFramesAsArray(error) {\n var stack = error.stack.replace(/\\s+$/g, \"\").split(\"\\n\");\n for (var i = 0; i < stack.length; ++i) {\n var line = stack[i];\n if (\" (No stack trace)\" === line || stackFramePattern.test(line)) {\n break;\n }\n }\n if (i > 0 && error.name != \"SyntaxError\") {\n stack = stack.slice(i);\n }\n return stack;\n}\n\nfunction parseStackAndMessage(error) {\n var stack = error.stack;\n var message = error.toString();\n stack = typeof stack === \"string\" && stack.length > 0\n ? stackFramesAsArray(error) : [\" (No stack trace)\"];\n return {\n message: message,\n stack: error.name == \"SyntaxError\" ? stack : cleanStack(stack)\n };\n}\n\nfunction formatAndLogError(error, title, isSoft) {\n if (typeof console !== \"undefined\") {\n var message;\n if (util.isObject(error)) {\n var stack = error.stack;\n message = title + formatStack(stack, error);\n } else {\n message = title + String(error);\n }\n if (typeof printWarning === \"function\") {\n printWarning(message, isSoft);\n } else if (typeof console.log === \"function\" ||\n typeof console.log === \"object\") {\n console.log(message);\n }\n }\n}\n\nfunction fireRejectionEvent(name, localHandler, reason, promise) {\n var localEventFired = false;\n try {\n if (typeof localHandler === \"function\") {\n localEventFired = true;\n if (name === \"rejectionHandled\") {\n localHandler(promise);\n } else {\n localHandler(reason, promise);\n }\n }\n } catch (e) {\n async.throwLater(e);\n }\n\n if (name === \"unhandledRejection\") {\n if (!activeFireEvent(name, reason, promise) && !localEventFired) {\n formatAndLogError(reason, \"Unhandled rejection \");\n }\n } else {\n activeFireEvent(name, promise);\n }\n}\n\nfunction formatNonError(obj) {\n var str;\n if (typeof obj === \"function\") {\n str = \"[function \" +\n (obj.name || \"anonymous\") +\n \"]\";\n } else {\n str = obj && typeof obj.toString === \"function\"\n ? obj.toString() : util.toString(obj);\n var ruselessToString = /\\[object [a-zA-Z0-9$_]+\\]/;\n if (ruselessToString.test(str)) {\n try {\n var newStr = JSON.stringify(obj);\n str = newStr;\n }\n catch(e) {\n\n }\n }\n if (str.length === 0) {\n str = \"(empty array)\";\n }\n }\n return (\"(<\" + snip(str) + \">, no stack trace)\");\n}\n\nfunction snip(str) {\n var maxChars = 41;\n if (str.length < maxChars) {\n return str;\n }\n return str.substr(0, maxChars - 3) + \"...\";\n}\n\nfunction longStackTracesIsSupported() {\n return typeof captureStackTrace === \"function\";\n}\n\nvar shouldIgnore = function() { return false; };\nvar parseLineInfoRegex = /[\\/<\\(]([^:\\/]+):(\\d+):(?:\\d+)\\)?\\s*$/;\nfunction parseLineInfo(line) {\n var matches = line.match(parseLineInfoRegex);\n if (matches) {\n return {\n fileName: matches[1],\n line: parseInt(matches[2], 10)\n };\n }\n}\n\nfunction setBounds(firstLineError, lastLineError) {\n if (!longStackTracesIsSupported()) return;\n var firstStackLines = firstLineError.stack.split(\"\\n\");\n var lastStackLines = lastLineError.stack.split(\"\\n\");\n var firstIndex = -1;\n var lastIndex = -1;\n var firstFileName;\n var lastFileName;\n for (var i = 0; i < firstStackLines.length; ++i) {\n var result = parseLineInfo(firstStackLines[i]);\n if (result) {\n firstFileName = result.fileName;\n firstIndex = result.line;\n break;\n }\n }\n for (var i = 0; i < lastStackLines.length; ++i) {\n var result = parseLineInfo(lastStackLines[i]);\n if (result) {\n lastFileName = result.fileName;\n lastIndex = result.line;\n break;\n }\n }\n if (firstIndex < 0 || lastIndex < 0 || !firstFileName || !lastFileName ||\n firstFileName !== lastFileName || firstIndex >= lastIndex) {\n return;\n }\n\n shouldIgnore = function(line) {\n if (bluebirdFramePattern.test(line)) return true;\n var info = parseLineInfo(line);\n if (info) {\n if (info.fileName === firstFileName &&\n (firstIndex <= info.line && info.line <= lastIndex)) {\n return true;\n }\n }\n return false;\n };\n}\n\nfunction CapturedTrace(parent) {\n this._parent = parent;\n this._promisesCreated = 0;\n var length = this._length = 1 + (parent === undefined ? 0 : parent._length);\n captureStackTrace(this, CapturedTrace);\n if (length > 32) this.uncycle();\n}\nutil.inherits(CapturedTrace, Error);\nContext.CapturedTrace = CapturedTrace;\n\nCapturedTrace.prototype.uncycle = function() {\n var length = this._length;\n if (length < 2) return;\n var nodes = [];\n var stackToIndex = {};\n\n for (var i = 0, node = this; node !== undefined; ++i) {\n nodes.push(node);\n node = node._parent;\n }\n length = this._length = i;\n for (var i = length - 1; i >= 0; --i) {\n var stack = nodes[i].stack;\n if (stackToIndex[stack] === undefined) {\n stackToIndex[stack] = i;\n }\n }\n for (var i = 0; i < length; ++i) {\n var currentStack = nodes[i].stack;\n var index = stackToIndex[currentStack];\n if (index !== undefined && index !== i) {\n if (index > 0) {\n nodes[index - 1]._parent = undefined;\n nodes[index - 1]._length = 1;\n }\n nodes[i]._parent = undefined;\n nodes[i]._length = 1;\n var cycleEdgeNode = i > 0 ? nodes[i - 1] : this;\n\n if (index < length - 1) {\n cycleEdgeNode._parent = nodes[index + 1];\n cycleEdgeNode._parent.uncycle();\n cycleEdgeNode._length =\n cycleEdgeNode._parent._length + 1;\n } else {\n cycleEdgeNode._parent = undefined;\n cycleEdgeNode._length = 1;\n }\n var currentChildLength = cycleEdgeNode._length + 1;\n for (var j = i - 2; j >= 0; --j) {\n nodes[j]._length = currentChildLength;\n currentChildLength++;\n }\n return;\n }\n }\n};\n\nCapturedTrace.prototype.attachExtraTrace = function(error) {\n if (error.__stackCleaned__) return;\n this.uncycle();\n var parsed = parseStackAndMessage(error);\n var message = parsed.message;\n var stacks = [parsed.stack];\n\n var trace = this;\n while (trace !== undefined) {\n stacks.push(cleanStack(trace.stack.split(\"\\n\")));\n trace = trace._parent;\n }\n removeCommonRoots(stacks);\n removeDuplicateOrEmptyJumps(stacks);\n util.notEnumerableProp(error, \"stack\", reconstructStack(message, stacks));\n util.notEnumerableProp(error, \"__stackCleaned__\", true);\n};\n\nvar captureStackTrace = (function stackDetection() {\n var v8stackFramePattern = /^\\s*at\\s*/;\n var v8stackFormatter = function(stack, error) {\n if (typeof stack === \"string\") return stack;\n\n if (error.name !== undefined &&\n error.message !== undefined) {\n return error.toString();\n }\n return formatNonError(error);\n };\n\n if (typeof Error.stackTraceLimit === \"number\" &&\n typeof Error.captureStackTrace === \"function\") {\n Error.stackTraceLimit += 6;\n stackFramePattern = v8stackFramePattern;\n formatStack = v8stackFormatter;\n var captureStackTrace = Error.captureStackTrace;\n\n shouldIgnore = function(line) {\n return bluebirdFramePattern.test(line);\n };\n return function(receiver, ignoreUntil) {\n Error.stackTraceLimit += 6;\n captureStackTrace(receiver, ignoreUntil);\n Error.stackTraceLimit -= 6;\n };\n }\n var err = new Error();\n\n if (typeof err.stack === \"string\" &&\n err.stack.split(\"\\n\")[0].indexOf(\"stackDetection@\") >= 0) {\n stackFramePattern = /@/;\n formatStack = v8stackFormatter;\n indentStackFrames = true;\n return function captureStackTrace(o) {\n o.stack = new Error().stack;\n };\n }\n\n var hasStackAfterThrow;\n try { throw new Error(); }\n catch(e) {\n hasStackAfterThrow = (\"stack\" in e);\n }\n if (!(\"stack\" in err) && hasStackAfterThrow &&\n typeof Error.stackTraceLimit === \"number\") {\n stackFramePattern = v8stackFramePattern;\n formatStack = v8stackFormatter;\n return function captureStackTrace(o) {\n Error.stackTraceLimit += 6;\n try { throw new Error(); }\n catch(e) { o.stack = e.stack; }\n Error.stackTraceLimit -= 6;\n };\n }\n\n formatStack = function(stack, error) {\n if (typeof stack === \"string\") return stack;\n\n if ((typeof error === \"object\" ||\n typeof error === \"function\") &&\n error.name !== undefined &&\n error.message !== undefined) {\n return error.toString();\n }\n return formatNonError(error);\n };\n\n return null;\n\n})([]);\n\nif (typeof console !== \"undefined\" && typeof console.warn !== \"undefined\") {\n printWarning = function (message) {\n console.warn(message);\n };\n if (util.isNode && process.stderr.isTTY) {\n printWarning = function(message, isSoft) {\n var color = isSoft ? \"\\u001b[33m\" : \"\\u001b[31m\";\n console.warn(color + message + \"\\u001b[0m\\n\");\n };\n } else if (!util.isNode && typeof (new Error().stack) === \"string\") {\n printWarning = function(message, isSoft) {\n console.warn(\"%c\" + message,\n isSoft ? \"color: darkorange\" : \"color: red\");\n };\n }\n}\n\nvar config = {\n warnings: warnings,\n longStackTraces: false,\n cancellation: false,\n monitoring: false\n};\n\nif (longStackTraces) Promise.longStackTraces();\n\nreturn {\n longStackTraces: function() {\n return config.longStackTraces;\n },\n warnings: function() {\n return config.warnings;\n },\n cancellation: function() {\n return config.cancellation;\n },\n monitoring: function() {\n return config.monitoring;\n },\n propagateFromFunction: function() {\n return propagateFromFunction;\n },\n boundValueFunction: function() {\n return boundValueFunction;\n },\n checkForgottenReturns: checkForgottenReturns,\n setBounds: setBounds,\n warn: warn,\n deprecated: deprecated,\n CapturedTrace: CapturedTrace,\n fireDomEvent: fireDomEvent,\n fireGlobalEvent: fireGlobalEvent\n};\n};\n\n},{\"./errors\":12,\"./util\":36}],10:[function(_dereq_,module,exports){\n\"use strict\";\nmodule.exports = function(Promise) {\nfunction returner() {\n return this.value;\n}\nfunction thrower() {\n throw this.reason;\n}\n\nPromise.prototype[\"return\"] =\nPromise.prototype.thenReturn = function (value) {\n if (value instanceof Promise) value.suppressUnhandledRejections();\n return this._then(\n returner, undefined, undefined, {value: value}, undefined);\n};\n\nPromise.prototype[\"throw\"] =\nPromise.prototype.thenThrow = function (reason) {\n return this._then(\n thrower, undefined, undefined, {reason: reason}, undefined);\n};\n\nPromise.prototype.catchThrow = function (reason) {\n if (arguments.length <= 1) {\n return this._then(\n undefined, thrower, undefined, {reason: reason}, undefined);\n } else {\n var _reason = arguments[1];\n var handler = function() {throw _reason;};\n return this.caught(reason, handler);\n }\n};\n\nPromise.prototype.catchReturn = function (value) {\n if (arguments.length <= 1) {\n if (value instanceof Promise) value.suppressUnhandledRejections();\n return this._then(\n undefined, returner, undefined, {value: value}, undefined);\n } else {\n var _value = arguments[1];\n if (_value instanceof Promise) _value.suppressUnhandledRejections();\n var handler = function() {return _value;};\n return this.caught(value, handler);\n }\n};\n};\n\n},{}],11:[function(_dereq_,module,exports){\n\"use strict\";\nmodule.exports = function(Promise, INTERNAL) {\nvar PromiseReduce = Promise.reduce;\nvar PromiseAll = Promise.all;\n\nfunction promiseAllThis() {\n return PromiseAll(this);\n}\n\nfunction PromiseMapSeries(promises, fn) {\n return PromiseReduce(promises, fn, INTERNAL, INTERNAL);\n}\n\nPromise.prototype.each = function (fn) {\n return PromiseReduce(this, fn, INTERNAL, 0)\n ._then(promiseAllThis, undefined, undefined, this, undefined);\n};\n\nPromise.prototype.mapSeries = function (fn) {\n return PromiseReduce(this, fn, INTERNAL, INTERNAL);\n};\n\nPromise.each = function (promises, fn) {\n return PromiseReduce(promises, fn, INTERNAL, 0)\n ._then(promiseAllThis, undefined, undefined, promises, undefined);\n};\n\nPromise.mapSeries = PromiseMapSeries;\n};\n\n\n},{}],12:[function(_dereq_,module,exports){\n\"use strict\";\nvar es5 = _dereq_(\"./es5\");\nvar Objectfreeze = es5.freeze;\nvar util = _dereq_(\"./util\");\nvar inherits = util.inherits;\nvar notEnumerableProp = util.notEnumerableProp;\n\nfunction subError(nameProperty, defaultMessage) {\n function SubError(message) {\n if (!(this instanceof SubError)) return new SubError(message);\n notEnumerableProp(this, \"message\",\n typeof message === \"string\" ? message : defaultMessage);\n notEnumerableProp(this, \"name\", nameProperty);\n if (Error.captureStackTrace) {\n Error.captureStackTrace(this, this.constructor);\n } else {\n Error.call(this);\n }\n }\n inherits(SubError, Error);\n return SubError;\n}\n\nvar _TypeError, _RangeError;\nvar Warning = subError(\"Warning\", \"warning\");\nvar CancellationError = subError(\"CancellationError\", \"cancellation error\");\nvar TimeoutError = subError(\"TimeoutError\", \"timeout error\");\nvar AggregateError = subError(\"AggregateError\", \"aggregate error\");\ntry {\n _TypeError = TypeError;\n _RangeError = RangeError;\n} catch(e) {\n _TypeError = subError(\"TypeError\", \"type error\");\n _RangeError = subError(\"RangeError\", \"range error\");\n}\n\nvar methods = (\"join pop push shift unshift slice filter forEach some \" +\n \"every map indexOf lastIndexOf reduce reduceRight sort reverse\").split(\" \");\n\nfor (var i = 0; i < methods.length; ++i) {\n if (typeof Array.prototype[methods[i]] === \"function\") {\n AggregateError.prototype[methods[i]] = Array.prototype[methods[i]];\n }\n}\n\nes5.defineProperty(AggregateError.prototype, \"length\", {\n value: 0,\n configurable: false,\n writable: true,\n enumerable: true\n});\nAggregateError.prototype[\"isOperational\"] = true;\nvar level = 0;\nAggregateError.prototype.toString = function() {\n var indent = Array(level * 4 + 1).join(\" \");\n var ret = \"\\n\" + indent + \"AggregateError of:\" + \"\\n\";\n level++;\n indent = Array(level * 4 + 1).join(\" \");\n for (var i = 0; i < this.length; ++i) {\n var str = this[i] === this ? \"[Circular AggregateError]\" : this[i] + \"\";\n var lines = str.split(\"\\n\");\n for (var j = 0; j < lines.length; ++j) {\n lines[j] = indent + lines[j];\n }\n str = lines.join(\"\\n\");\n ret += str + \"\\n\";\n }\n level--;\n return ret;\n};\n\nfunction OperationalError(message) {\n if (!(this instanceof OperationalError))\n return new OperationalError(message);\n notEnumerableProp(this, \"name\", \"OperationalError\");\n notEnumerableProp(this, \"message\", message);\n this.cause = message;\n this[\"isOperational\"] = true;\n\n if (message instanceof Error) {\n notEnumerableProp(this, \"message\", message.message);\n notEnumerableProp(this, \"stack\", message.stack);\n } else if (Error.captureStackTrace) {\n Error.captureStackTrace(this, this.constructor);\n }\n\n}\ninherits(OperationalError, Error);\n\nvar errorTypes = Error[\"__BluebirdErrorTypes__\"];\nif (!errorTypes) {\n errorTypes = Objectfreeze({\n CancellationError: CancellationError,\n TimeoutError: TimeoutError,\n OperationalError: OperationalError,\n RejectionError: OperationalError,\n AggregateError: AggregateError\n });\n es5.defineProperty(Error, \"__BluebirdErrorTypes__\", {\n value: errorTypes,\n writable: false,\n enumerable: false,\n configurable: false\n });\n}\n\nmodule.exports = {\n Error: Error,\n TypeError: _TypeError,\n RangeError: _RangeError,\n CancellationError: errorTypes.CancellationError,\n OperationalError: errorTypes.OperationalError,\n TimeoutError: errorTypes.TimeoutError,\n AggregateError: errorTypes.AggregateError,\n Warning: Warning\n};\n\n},{\"./es5\":13,\"./util\":36}],13:[function(_dereq_,module,exports){\nvar isES5 = (function(){\n \"use strict\";\n return this === undefined;\n})();\n\nif (isES5) {\n module.exports = {\n freeze: Object.freeze,\n defineProperty: Object.defineProperty,\n getDescriptor: Object.getOwnPropertyDescriptor,\n keys: Object.keys,\n names: Object.getOwnPropertyNames,\n getPrototypeOf: Object.getPrototypeOf,\n isArray: Array.isArray,\n isES5: isES5,\n propertyIsWritable: function(obj, prop) {\n var descriptor = Object.getOwnPropertyDescriptor(obj, prop);\n return !!(!descriptor || descriptor.writable || descriptor.set);\n }\n };\n} else {\n var has = {}.hasOwnProperty;\n var str = {}.toString;\n var proto = {}.constructor.prototype;\n\n var ObjectKeys = function (o) {\n var ret = [];\n for (var key in o) {\n if (has.call(o, key)) {\n ret.push(key);\n }\n }\n return ret;\n };\n\n var ObjectGetDescriptor = function(o, key) {\n return {value: o[key]};\n };\n\n var ObjectDefineProperty = function (o, key, desc) {\n o[key] = desc.value;\n return o;\n };\n\n var ObjectFreeze = function (obj) {\n return obj;\n };\n\n var ObjectGetPrototypeOf = function (obj) {\n try {\n return Object(obj).constructor.prototype;\n }\n catch (e) {\n return proto;\n }\n };\n\n var ArrayIsArray = function (obj) {\n try {\n return str.call(obj) === \"[object Array]\";\n }\n catch(e) {\n return false;\n }\n };\n\n module.exports = {\n isArray: ArrayIsArray,\n keys: ObjectKeys,\n names: ObjectKeys,\n defineProperty: ObjectDefineProperty,\n getDescriptor: ObjectGetDescriptor,\n freeze: ObjectFreeze,\n getPrototypeOf: ObjectGetPrototypeOf,\n isES5: isES5,\n propertyIsWritable: function() {\n return true;\n }\n };\n}\n\n},{}],14:[function(_dereq_,module,exports){\n\"use strict\";\nmodule.exports = function(Promise, INTERNAL) {\nvar PromiseMap = Promise.map;\n\nPromise.prototype.filter = function (fn, options) {\n return PromiseMap(this, fn, options, INTERNAL);\n};\n\nPromise.filter = function (promises, fn, options) {\n return PromiseMap(promises, fn, options, INTERNAL);\n};\n};\n\n},{}],15:[function(_dereq_,module,exports){\n\"use strict\";\nmodule.exports = function(Promise, tryConvertToPromise, NEXT_FILTER) {\nvar util = _dereq_(\"./util\");\nvar CancellationError = Promise.CancellationError;\nvar errorObj = util.errorObj;\nvar catchFilter = _dereq_(\"./catch_filter\")(NEXT_FILTER);\n\nfunction PassThroughHandlerContext(promise, type, handler) {\n this.promise = promise;\n this.type = type;\n this.handler = handler;\n this.called = false;\n this.cancelPromise = null;\n}\n\nPassThroughHandlerContext.prototype.isFinallyHandler = function() {\n return this.type === 0;\n};\n\nfunction FinallyHandlerCancelReaction(finallyHandler) {\n this.finallyHandler = finallyHandler;\n}\n\nFinallyHandlerCancelReaction.prototype._resultCancelled = function() {\n checkCancel(this.finallyHandler);\n};\n\nfunction checkCancel(ctx, reason) {\n if (ctx.cancelPromise != null) {\n if (arguments.length > 1) {\n ctx.cancelPromise._reject(reason);\n } else {\n ctx.cancelPromise._cancel();\n }\n ctx.cancelPromise = null;\n return true;\n }\n return false;\n}\n\nfunction succeed() {\n return finallyHandler.call(this, this.promise._target()._settledValue());\n}\nfunction fail(reason) {\n if (checkCancel(this, reason)) return;\n errorObj.e = reason;\n return errorObj;\n}\nfunction finallyHandler(reasonOrValue) {\n var promise = this.promise;\n var handler = this.handler;\n\n if (!this.called) {\n this.called = true;\n var ret = this.isFinallyHandler()\n ? handler.call(promise._boundValue())\n : handler.call(promise._boundValue(), reasonOrValue);\n if (ret === NEXT_FILTER) {\n return ret;\n } else if (ret !== undefined) {\n promise._setReturnedNonUndefined();\n var maybePromise = tryConvertToPromise(ret, promise);\n if (maybePromise instanceof Promise) {\n if (this.cancelPromise != null) {\n if (maybePromise._isCancelled()) {\n var reason =\n new CancellationError(\"late cancellation observer\");\n promise._attachExtraTrace(reason);\n errorObj.e = reason;\n return errorObj;\n } else if (maybePromise.isPending()) {\n maybePromise._attachCancellationCallback(\n new FinallyHandlerCancelReaction(this));\n }\n }\n return maybePromise._then(\n succeed, fail, undefined, this, undefined);\n }\n }\n }\n\n if (promise.isRejected()) {\n checkCancel(this);\n errorObj.e = reasonOrValue;\n return errorObj;\n } else {\n checkCancel(this);\n return reasonOrValue;\n }\n}\n\nPromise.prototype._passThrough = function(handler, type, success, fail) {\n if (typeof handler !== \"function\") return this.then();\n return this._then(success,\n fail,\n undefined,\n new PassThroughHandlerContext(this, type, handler),\n undefined);\n};\n\nPromise.prototype.lastly =\nPromise.prototype[\"finally\"] = function (handler) {\n return this._passThrough(handler,\n 0,\n finallyHandler,\n finallyHandler);\n};\n\n\nPromise.prototype.tap = function (handler) {\n return this._passThrough(handler, 1, finallyHandler);\n};\n\nPromise.prototype.tapCatch = function (handlerOrPredicate) {\n var len = arguments.length;\n if(len === 1) {\n return this._passThrough(handlerOrPredicate,\n 1,\n undefined,\n finallyHandler);\n } else {\n var catchInstances = new Array(len - 1),\n j = 0, i;\n for (i = 0; i < len - 1; ++i) {\n var item = arguments[i];\n if (util.isObject(item)) {\n catchInstances[j++] = item;\n } else {\n return Promise.reject(new TypeError(\n \"tapCatch statement predicate: \"\n + \"expecting an object but got \" + util.classString(item)\n ));\n }\n }\n catchInstances.length = j;\n var handler = arguments[i];\n return this._passThrough(catchFilter(catchInstances, handler, this),\n 1,\n undefined,\n finallyHandler);\n }\n\n};\n\nreturn PassThroughHandlerContext;\n};\n\n},{\"./catch_filter\":7,\"./util\":36}],16:[function(_dereq_,module,exports){\n\"use strict\";\nmodule.exports = function(Promise,\n apiRejection,\n INTERNAL,\n tryConvertToPromise,\n Proxyable,\n debug) {\nvar errors = _dereq_(\"./errors\");\nvar TypeError = errors.TypeError;\nvar util = _dereq_(\"./util\");\nvar errorObj = util.errorObj;\nvar tryCatch = util.tryCatch;\nvar yieldHandlers = [];\n\nfunction promiseFromYieldHandler(value, yieldHandlers, traceParent) {\n for (var i = 0; i < yieldHandlers.length; ++i) {\n traceParent._pushContext();\n var result = tryCatch(yieldHandlers[i])(value);\n traceParent._popContext();\n if (result === errorObj) {\n traceParent._pushContext();\n var ret = Promise.reject(errorObj.e);\n traceParent._popContext();\n return ret;\n }\n var maybePromise = tryConvertToPromise(result, traceParent);\n if (maybePromise instanceof Promise) return maybePromise;\n }\n return null;\n}\n\nfunction PromiseSpawn(generatorFunction, receiver, yieldHandler, stack) {\n if (debug.cancellation()) {\n var internal = new Promise(INTERNAL);\n var _finallyPromise = this._finallyPromise = new Promise(INTERNAL);\n this._promise = internal.lastly(function() {\n return _finallyPromise;\n });\n internal._captureStackTrace();\n internal._setOnCancel(this);\n } else {\n var promise = this._promise = new Promise(INTERNAL);\n promise._captureStackTrace();\n }\n this._stack = stack;\n this._generatorFunction = generatorFunction;\n this._receiver = receiver;\n this._generator = undefined;\n this._yieldHandlers = typeof yieldHandler === \"function\"\n ? [yieldHandler].concat(yieldHandlers)\n : yieldHandlers;\n this._yieldedPromise = null;\n this._cancellationPhase = false;\n}\nutil.inherits(PromiseSpawn, Proxyable);\n\nPromiseSpawn.prototype._isResolved = function() {\n return this._promise === null;\n};\n\nPromiseSpawn.prototype._cleanup = function() {\n this._promise = this._generator = null;\n if (debug.cancellation() && this._finallyPromise !== null) {\n this._finallyPromise._fulfill();\n this._finallyPromise = null;\n }\n};\n\nPromiseSpawn.prototype._promiseCancelled = function() {\n if (this._isResolved()) return;\n var implementsReturn = typeof this._generator[\"return\"] !== \"undefined\";\n\n var result;\n if (!implementsReturn) {\n var reason = new Promise.CancellationError(\n \"generator .return() sentinel\");\n Promise.coroutine.returnSentinel = reason;\n this._promise._attachExtraTrace(reason);\n this._promise._pushContext();\n result = tryCatch(this._generator[\"throw\"]).call(this._generator,\n reason);\n this._promise._popContext();\n } else {\n this._promise._pushContext();\n result = tryCatch(this._generator[\"return\"]).call(this._generator,\n undefined);\n this._promise._popContext();\n }\n this._cancellationPhase = true;\n this._yieldedPromise = null;\n this._continue(result);\n};\n\nPromiseSpawn.prototype._promiseFulfilled = function(value) {\n this._yieldedPromise = null;\n this._promise._pushContext();\n var result = tryCatch(this._generator.next).call(this._generator, value);\n this._promise._popContext();\n this._continue(result);\n};\n\nPromiseSpawn.prototype._promiseRejected = function(reason) {\n this._yieldedPromise = null;\n this._promise._attachExtraTrace(reason);\n this._promise._pushContext();\n var result = tryCatch(this._generator[\"throw\"])\n .call(this._generator, reason);\n this._promise._popContext();\n this._continue(result);\n};\n\nPromiseSpawn.prototype._resultCancelled = function() {\n if (this._yieldedPromise instanceof Promise) {\n var promise = this._yieldedPromise;\n this._yieldedPromise = null;\n promise.cancel();\n }\n};\n\nPromiseSpawn.prototype.promise = function () {\n return this._promise;\n};\n\nPromiseSpawn.prototype._run = function () {\n this._generator = this._generatorFunction.call(this._receiver);\n this._receiver =\n this._generatorFunction = undefined;\n this._promiseFulfilled(undefined);\n};\n\nPromiseSpawn.prototype._continue = function (result) {\n var promise = this._promise;\n if (result === errorObj) {\n this._cleanup();\n if (this._cancellationPhase) {\n return promise.cancel();\n } else {\n return promise._rejectCallback(result.e, false);\n }\n }\n\n var value = result.value;\n if (result.done === true) {\n this._cleanup();\n if (this._cancellationPhase) {\n return promise.cancel();\n } else {\n return promise._resolveCallback(value);\n }\n } else {\n var maybePromise = tryConvertToPromise(value, this._promise);\n if (!(maybePromise instanceof Promise)) {\n maybePromise =\n promiseFromYieldHandler(maybePromise,\n this._yieldHandlers,\n this._promise);\n if (maybePromise === null) {\n this._promiseRejected(\n new TypeError(\n \"A value %s was yielded that could not be treated as a promise\\u000a\\u000a See http://goo.gl/MqrFmX\\u000a\\u000a\".replace(\"%s\", String(value)) +\n \"From coroutine:\\u000a\" +\n this._stack.split(\"\\n\").slice(1, -7).join(\"\\n\")\n )\n );\n return;\n }\n }\n maybePromise = maybePromise._target();\n var bitField = maybePromise._bitField;\n ;\n if (((bitField & 50397184) === 0)) {\n this._yieldedPromise = maybePromise;\n maybePromise._proxy(this, null);\n } else if (((bitField & 33554432) !== 0)) {\n Promise._async.invoke(\n this._promiseFulfilled, this, maybePromise._value()\n );\n } else if (((bitField & 16777216) !== 0)) {\n Promise._async.invoke(\n this._promiseRejected, this, maybePromise._reason()\n );\n } else {\n this._promiseCancelled();\n }\n }\n};\n\nPromise.coroutine = function (generatorFunction, options) {\n if (typeof generatorFunction !== \"function\") {\n throw new TypeError(\"generatorFunction must be a function\\u000a\\u000a See http://goo.gl/MqrFmX\\u000a\");\n }\n var yieldHandler = Object(options).yieldHandler;\n var PromiseSpawn$ = PromiseSpawn;\n var stack = new Error().stack;\n return function () {\n var generator = generatorFunction.apply(this, arguments);\n var spawn = new PromiseSpawn$(undefined, undefined, yieldHandler,\n stack);\n var ret = spawn.promise();\n spawn._generator = generator;\n spawn._promiseFulfilled(undefined);\n return ret;\n };\n};\n\nPromise.coroutine.addYieldHandler = function(fn) {\n if (typeof fn !== \"function\") {\n throw new TypeError(\"expecting a function but got \" + util.classString(fn));\n }\n yieldHandlers.push(fn);\n};\n\nPromise.spawn = function (generatorFunction) {\n debug.deprecated(\"Promise.spawn()\", \"Promise.coroutine()\");\n if (typeof generatorFunction !== \"function\") {\n return apiRejection(\"generatorFunction must be a function\\u000a\\u000a See http://goo.gl/MqrFmX\\u000a\");\n }\n var spawn = new PromiseSpawn(generatorFunction, this);\n var ret = spawn.promise();\n spawn._run(Promise.spawn);\n return ret;\n};\n};\n\n},{\"./errors\":12,\"./util\":36}],17:[function(_dereq_,module,exports){\n\"use strict\";\nmodule.exports =\nfunction(Promise, PromiseArray, tryConvertToPromise, INTERNAL, async,\n getDomain) {\nvar util = _dereq_(\"./util\");\nvar canEvaluate = util.canEvaluate;\nvar tryCatch = util.tryCatch;\nvar errorObj = util.errorObj;\nvar reject;\n\nif (!true) {\nif (canEvaluate) {\n var thenCallback = function(i) {\n return new Function(\"value\", \"holder\", \" \\n\\\n 'use strict'; \\n\\\n holder.pIndex = value; \\n\\\n holder.checkFulfillment(this); \\n\\\n \".replace(/Index/g, i));\n };\n\n var promiseSetter = function(i) {\n return new Function(\"promise\", \"holder\", \" \\n\\\n 'use strict'; \\n\\\n holder.pIndex = promise; \\n\\\n \".replace(/Index/g, i));\n };\n\n var generateHolderClass = function(total) {\n var props = new Array(total);\n for (var i = 0; i < props.length; ++i) {\n props[i] = \"this.p\" + (i+1);\n }\n var assignment = props.join(\" = \") + \" = null;\";\n var cancellationCode= \"var promise;\\n\" + props.map(function(prop) {\n return \" \\n\\\n promise = \" + prop + \"; \\n\\\n if (promise instanceof Promise) { \\n\\\n promise.cancel(); \\n\\\n } \\n\\\n \";\n }).join(\"\\n\");\n var passedArguments = props.join(\", \");\n var name = \"Holder$\" + total;\n\n\n var code = \"return function(tryCatch, errorObj, Promise, async) { \\n\\\n 'use strict'; \\n\\\n function [TheName](fn) { \\n\\\n [TheProperties] \\n\\\n this.fn = fn; \\n\\\n this.asyncNeeded = true; \\n\\\n this.now = 0; \\n\\\n } \\n\\\n \\n\\\n [TheName].prototype._callFunction = function(promise) { \\n\\\n promise._pushContext(); \\n\\\n var ret = tryCatch(this.fn)([ThePassedArguments]); \\n\\\n promise._popContext(); \\n\\\n if (ret === errorObj) { \\n\\\n promise._rejectCallback(ret.e, false); \\n\\\n } else { \\n\\\n promise._resolveCallback(ret); \\n\\\n } \\n\\\n }; \\n\\\n \\n\\\n [TheName].prototype.checkFulfillment = function(promise) { \\n\\\n var now = ++this.now; \\n\\\n if (now === [TheTotal]) { \\n\\\n if (this.asyncNeeded) { \\n\\\n async.invoke(this._callFunction, this, promise); \\n\\\n } else { \\n\\\n this._callFunction(promise); \\n\\\n } \\n\\\n \\n\\\n } \\n\\\n }; \\n\\\n \\n\\\n [TheName].prototype._resultCancelled = function() { \\n\\\n [CancellationCode] \\n\\\n }; \\n\\\n \\n\\\n return [TheName]; \\n\\\n }(tryCatch, errorObj, Promise, async); \\n\\\n \";\n\n code = code.replace(/\\[TheName\\]/g, name)\n .replace(/\\[TheTotal\\]/g, total)\n .replace(/\\[ThePassedArguments\\]/g, passedArguments)\n .replace(/\\[TheProperties\\]/g, assignment)\n .replace(/\\[CancellationCode\\]/g, cancellationCode);\n\n return new Function(\"tryCatch\", \"errorObj\", \"Promise\", \"async\", code)\n (tryCatch, errorObj, Promise, async);\n };\n\n var holderClasses = [];\n var thenCallbacks = [];\n var promiseSetters = [];\n\n for (var i = 0; i < 8; ++i) {\n holderClasses.push(generateHolderClass(i + 1));\n thenCallbacks.push(thenCallback(i + 1));\n promiseSetters.push(promiseSetter(i + 1));\n }\n\n reject = function (reason) {\n this._reject(reason);\n };\n}}\n\nPromise.join = function () {\n var last = arguments.length - 1;\n var fn;\n if (last > 0 && typeof arguments[last] === \"function\") {\n fn = arguments[last];\n if (!true) {\n if (last <= 8 && canEvaluate) {\n var ret = new Promise(INTERNAL);\n ret._captureStackTrace();\n var HolderClass = holderClasses[last - 1];\n var holder = new HolderClass(fn);\n var callbacks = thenCallbacks;\n\n for (var i = 0; i < last; ++i) {\n var maybePromise = tryConvertToPromise(arguments[i], ret);\n if (maybePromise instanceof Promise) {\n maybePromise = maybePromise._target();\n var bitField = maybePromise._bitField;\n ;\n if (((bitField & 50397184) === 0)) {\n maybePromise._then(callbacks[i], reject,\n undefined, ret, holder);\n promiseSetters[i](maybePromise, holder);\n holder.asyncNeeded = false;\n } else if (((bitField & 33554432) !== 0)) {\n callbacks[i].call(ret,\n maybePromise._value(), holder);\n } else if (((bitField & 16777216) !== 0)) {\n ret._reject(maybePromise._reason());\n } else {\n ret._cancel();\n }\n } else {\n callbacks[i].call(ret, maybePromise, holder);\n }\n }\n\n if (!ret._isFateSealed()) {\n if (holder.asyncNeeded) {\n var domain = getDomain();\n if (domain !== null) {\n holder.fn = util.domainBind(domain, holder.fn);\n }\n }\n ret._setAsyncGuaranteed();\n ret._setOnCancel(holder);\n }\n return ret;\n }\n }\n }\n var args = [].slice.call(arguments);;\n if (fn) args.pop();\n var ret = new PromiseArray(args).promise();\n return fn !== undefined ? ret.spread(fn) : ret;\n};\n\n};\n\n},{\"./util\":36}],18:[function(_dereq_,module,exports){\n\"use strict\";\nmodule.exports = function(Promise,\n PromiseArray,\n apiRejection,\n tryConvertToPromise,\n INTERNAL,\n debug) {\nvar getDomain = Promise._getDomain;\nvar util = _dereq_(\"./util\");\nvar tryCatch = util.tryCatch;\nvar errorObj = util.errorObj;\nvar async = Promise._async;\n\nfunction MappingPromiseArray(promises, fn, limit, _filter) {\n this.constructor$(promises);\n this._promise._captureStackTrace();\n var domain = getDomain();\n this._callback = domain === null ? fn : util.domainBind(domain, fn);\n this._preservedValues = _filter === INTERNAL\n ? new Array(this.length())\n : null;\n this._limit = limit;\n this._inFlight = 0;\n this._queue = [];\n async.invoke(this._asyncInit, this, undefined);\n}\nutil.inherits(MappingPromiseArray, PromiseArray);\n\nMappingPromiseArray.prototype._asyncInit = function() {\n this._init$(undefined, -2);\n};\n\nMappingPromiseArray.prototype._init = function () {};\n\nMappingPromiseArray.prototype._promiseFulfilled = function (value, index) {\n var values = this._values;\n var length = this.length();\n var preservedValues = this._preservedValues;\n var limit = this._limit;\n\n if (index < 0) {\n index = (index * -1) - 1;\n values[index] = value;\n if (limit >= 1) {\n this._inFlight--;\n this._drainQueue();\n if (this._isResolved()) return true;\n }\n } else {\n if (limit >= 1 && this._inFlight >= limit) {\n values[index] = value;\n this._queue.push(index);\n return false;\n }\n if (preservedValues !== null) preservedValues[index] = value;\n\n var promise = this._promise;\n var callback = this._callback;\n var receiver = promise._boundValue();\n promise._pushContext();\n var ret = tryCatch(callback).call(receiver, value, index, length);\n var promiseCreated = promise._popContext();\n debug.checkForgottenReturns(\n ret,\n promiseCreated,\n preservedValues !== null ? \"Promise.filter\" : \"Promise.map\",\n promise\n );\n if (ret === errorObj) {\n this._reject(ret.e);\n return true;\n }\n\n var maybePromise = tryConvertToPromise(ret, this._promise);\n if (maybePromise instanceof Promise) {\n maybePromise = maybePromise._target();\n var bitField = maybePromise._bitField;\n ;\n if (((bitField & 50397184) === 0)) {\n if (limit >= 1) this._inFlight++;\n values[index] = maybePromise;\n maybePromise._proxy(this, (index + 1) * -1);\n return false;\n } else if (((bitField & 33554432) !== 0)) {\n ret = maybePromise._value();\n } else if (((bitField & 16777216) !== 0)) {\n this._reject(maybePromise._reason());\n return true;\n } else {\n this._cancel();\n return true;\n }\n }\n values[index] = ret;\n }\n var totalResolved = ++this._totalResolved;\n if (totalResolved >= length) {\n if (preservedValues !== null) {\n this._filter(values, preservedValues);\n } else {\n this._resolve(values);\n }\n return true;\n }\n return false;\n};\n\nMappingPromiseArray.prototype._drainQueue = function () {\n var queue = this._queue;\n var limit = this._limit;\n var values = this._values;\n while (queue.length > 0 && this._inFlight < limit) {\n if (this._isResolved()) return;\n var index = queue.pop();\n this._promiseFulfilled(values[index], index);\n }\n};\n\nMappingPromiseArray.prototype._filter = function (booleans, values) {\n var len = values.length;\n var ret = new Array(len);\n var j = 0;\n for (var i = 0; i < len; ++i) {\n if (booleans[i]) ret[j++] = values[i];\n }\n ret.length = j;\n this._resolve(ret);\n};\n\nMappingPromiseArray.prototype.preservedValues = function () {\n return this._preservedValues;\n};\n\nfunction map(promises, fn, options, _filter) {\n if (typeof fn !== \"function\") {\n return apiRejection(\"expecting a function but got \" + util.classString(fn));\n }\n\n var limit = 0;\n if (options !== undefined) {\n if (typeof options === \"object\" && options !== null) {\n if (typeof options.concurrency !== \"number\") {\n return Promise.reject(\n new TypeError(\"'concurrency' must be a number but it is \" +\n util.classString(options.concurrency)));\n }\n limit = options.concurrency;\n } else {\n return Promise.reject(new TypeError(\n \"options argument must be an object but it is \" +\n util.classString(options)));\n }\n }\n limit = typeof limit === \"number\" &&\n isFinite(limit) && limit >= 1 ? limit : 0;\n return new MappingPromiseArray(promises, fn, limit, _filter).promise();\n}\n\nPromise.prototype.map = function (fn, options) {\n return map(this, fn, options, null);\n};\n\nPromise.map = function (promises, fn, options, _filter) {\n return map(promises, fn, options, _filter);\n};\n\n\n};\n\n},{\"./util\":36}],19:[function(_dereq_,module,exports){\n\"use strict\";\nmodule.exports =\nfunction(Promise, INTERNAL, tryConvertToPromise, apiRejection, debug) {\nvar util = _dereq_(\"./util\");\nvar tryCatch = util.tryCatch;\n\nPromise.method = function (fn) {\n if (typeof fn !== \"function\") {\n throw new Promise.TypeError(\"expecting a function but got \" + util.classString(fn));\n }\n return function () {\n var ret = new Promise(INTERNAL);\n ret._captureStackTrace();\n ret._pushContext();\n var value = tryCatch(fn).apply(this, arguments);\n var promiseCreated = ret._popContext();\n debug.checkForgottenReturns(\n value, promiseCreated, \"Promise.method\", ret);\n ret._resolveFromSyncValue(value);\n return ret;\n };\n};\n\nPromise.attempt = Promise[\"try\"] = function (fn) {\n if (typeof fn !== \"function\") {\n return apiRejection(\"expecting a function but got \" + util.classString(fn));\n }\n var ret = new Promise(INTERNAL);\n ret._captureStackTrace();\n ret._pushContext();\n var value;\n if (arguments.length > 1) {\n debug.deprecated(\"calling Promise.try with more than 1 argument\");\n var arg = arguments[1];\n var ctx = arguments[2];\n value = util.isArray(arg) ? tryCatch(fn).apply(ctx, arg)\n : tryCatch(fn).call(ctx, arg);\n } else {\n value = tryCatch(fn)();\n }\n var promiseCreated = ret._popContext();\n debug.checkForgottenReturns(\n value, promiseCreated, \"Promise.try\", ret);\n ret._resolveFromSyncValue(value);\n return ret;\n};\n\nPromise.prototype._resolveFromSyncValue = function (value) {\n if (value === util.errorObj) {\n this._rejectCallback(value.e, false);\n } else {\n this._resolveCallback(value, true);\n }\n};\n};\n\n},{\"./util\":36}],20:[function(_dereq_,module,exports){\n\"use strict\";\nvar util = _dereq_(\"./util\");\nvar maybeWrapAsError = util.maybeWrapAsError;\nvar errors = _dereq_(\"./errors\");\nvar OperationalError = errors.OperationalError;\nvar es5 = _dereq_(\"./es5\");\n\nfunction isUntypedError(obj) {\n return obj instanceof Error &&\n es5.getPrototypeOf(obj) === Error.prototype;\n}\n\nvar rErrorKey = /^(?:name|message|stack|cause)$/;\nfunction wrapAsOperationalError(obj) {\n var ret;\n if (isUntypedError(obj)) {\n ret = new OperationalError(obj);\n ret.name = obj.name;\n ret.message = obj.message;\n ret.stack = obj.stack;\n var keys = es5.keys(obj);\n for (var i = 0; i < keys.length; ++i) {\n var key = keys[i];\n if (!rErrorKey.test(key)) {\n ret[key] = obj[key];\n }\n }\n return ret;\n }\n util.markAsOriginatingFromRejection(obj);\n return obj;\n}\n\nfunction nodebackForPromise(promise, multiArgs) {\n return function(err, value) {\n if (promise === null) return;\n if (err) {\n var wrapped = wrapAsOperationalError(maybeWrapAsError(err));\n promise._attachExtraTrace(wrapped);\n promise._reject(wrapped);\n } else if (!multiArgs) {\n promise._fulfill(value);\n } else {\n var args = [].slice.call(arguments, 1);;\n promise._fulfill(args);\n }\n promise = null;\n };\n}\n\nmodule.exports = nodebackForPromise;\n\n},{\"./errors\":12,\"./es5\":13,\"./util\":36}],21:[function(_dereq_,module,exports){\n\"use strict\";\nmodule.exports = function(Promise) {\nvar util = _dereq_(\"./util\");\nvar async = Promise._async;\nvar tryCatch = util.tryCatch;\nvar errorObj = util.errorObj;\n\nfunction spreadAdapter(val, nodeback) {\n var promise = this;\n if (!util.isArray(val)) return successAdapter.call(promise, val, nodeback);\n var ret =\n tryCatch(nodeback).apply(promise._boundValue(), [null].concat(val));\n if (ret === errorObj) {\n async.throwLater(ret.e);\n }\n}\n\nfunction successAdapter(val, nodeback) {\n var promise = this;\n var receiver = promise._boundValue();\n var ret = val === undefined\n ? tryCatch(nodeback).call(receiver, null)\n : tryCatch(nodeback).call(receiver, null, val);\n if (ret === errorObj) {\n async.throwLater(ret.e);\n }\n}\nfunction errorAdapter(reason, nodeback) {\n var promise = this;\n if (!reason) {\n var newReason = new Error(reason + \"\");\n newReason.cause = reason;\n reason = newReason;\n }\n var ret = tryCatch(nodeback).call(promise._boundValue(), reason);\n if (ret === errorObj) {\n async.throwLater(ret.e);\n }\n}\n\nPromise.prototype.asCallback = Promise.prototype.nodeify = function (nodeback,\n options) {\n if (typeof nodeback == \"function\") {\n var adapter = successAdapter;\n if (options !== undefined && Object(options).spread) {\n adapter = spreadAdapter;\n }\n this._then(\n adapter,\n errorAdapter,\n undefined,\n this,\n nodeback\n );\n }\n return this;\n};\n};\n\n},{\"./util\":36}],22:[function(_dereq_,module,exports){\n\"use strict\";\nmodule.exports = function() {\nvar makeSelfResolutionError = function () {\n return new TypeError(\"circular promise resolution chain\\u000a\\u000a See http://goo.gl/MqrFmX\\u000a\");\n};\nvar reflectHandler = function() {\n return new Promise.PromiseInspection(this._target());\n};\nvar apiRejection = function(msg) {\n return Promise.reject(new TypeError(msg));\n};\nfunction Proxyable() {}\nvar UNDEFINED_BINDING = {};\nvar util = _dereq_(\"./util\");\n\nvar getDomain;\nif (util.isNode) {\n getDomain = function() {\n var ret = process.domain;\n if (ret === undefined) ret = null;\n return ret;\n };\n} else {\n getDomain = function() {\n return null;\n };\n}\nutil.notEnumerableProp(Promise, \"_getDomain\", getDomain);\n\nvar es5 = _dereq_(\"./es5\");\nvar Async = _dereq_(\"./async\");\nvar async = new Async();\nes5.defineProperty(Promise, \"_async\", {value: async});\nvar errors = _dereq_(\"./errors\");\nvar TypeError = Promise.TypeError = errors.TypeError;\nPromise.RangeError = errors.RangeError;\nvar CancellationError = Promise.CancellationError = errors.CancellationError;\nPromise.TimeoutError = errors.TimeoutError;\nPromise.OperationalError = errors.OperationalError;\nPromise.RejectionError = errors.OperationalError;\nPromise.AggregateError = errors.AggregateError;\nvar INTERNAL = function(){};\nvar APPLY = {};\nvar NEXT_FILTER = {};\nvar tryConvertToPromise = _dereq_(\"./thenables\")(Promise, INTERNAL);\nvar PromiseArray =\n _dereq_(\"./promise_array\")(Promise, INTERNAL,\n tryConvertToPromise, apiRejection, Proxyable);\nvar Context = _dereq_(\"./context\")(Promise);\n /*jshint unused:false*/\nvar createContext = Context.create;\nvar debug = _dereq_(\"./debuggability\")(Promise, Context);\nvar CapturedTrace = debug.CapturedTrace;\nvar PassThroughHandlerContext =\n _dereq_(\"./finally\")(Promise, tryConvertToPromise, NEXT_FILTER);\nvar catchFilter = _dereq_(\"./catch_filter\")(NEXT_FILTER);\nvar nodebackForPromise = _dereq_(\"./nodeback\");\nvar errorObj = util.errorObj;\nvar tryCatch = util.tryCatch;\nfunction check(self, executor) {\n if (self == null || self.constructor !== Promise) {\n throw new TypeError(\"the promise constructor cannot be invoked directly\\u000a\\u000a See http://goo.gl/MqrFmX\\u000a\");\n }\n if (typeof executor !== \"function\") {\n throw new TypeError(\"expecting a function but got \" + util.classString(executor));\n }\n\n}\n\nfunction Promise(executor) {\n if (executor !== INTERNAL) {\n check(this, executor);\n }\n this._bitField = 0;\n this._fulfillmentHandler0 = undefined;\n this._rejectionHandler0 = undefined;\n this._promise0 = undefined;\n this._receiver0 = undefined;\n this._resolveFromExecutor(executor);\n this._promiseCreated();\n this._fireEvent(\"promiseCreated\", this);\n}\n\nPromise.prototype.toString = function () {\n return \"[object Promise]\";\n};\n\nPromise.prototype.caught = Promise.prototype[\"catch\"] = function (fn) {\n var len = arguments.length;\n if (len > 1) {\n var catchInstances = new Array(len - 1),\n j = 0, i;\n for (i = 0; i < len - 1; ++i) {\n var item = arguments[i];\n if (util.isObject(item)) {\n catchInstances[j++] = item;\n } else {\n return apiRejection(\"Catch statement predicate: \" +\n \"expecting an object but got \" + util.classString(item));\n }\n }\n catchInstances.length = j;\n fn = arguments[i];\n return this.then(undefined, catchFilter(catchInstances, fn, this));\n }\n return this.then(undefined, fn);\n};\n\nPromise.prototype.reflect = function () {\n return this._then(reflectHandler,\n reflectHandler, undefined, this, undefined);\n};\n\nPromise.prototype.then = function (didFulfill, didReject) {\n if (debug.warnings() && arguments.length > 0 &&\n typeof didFulfill !== \"function\" &&\n typeof didReject !== \"function\") {\n var msg = \".then() only accepts functions but was passed: \" +\n util.classString(didFulfill);\n if (arguments.length > 1) {\n msg += \", \" + util.classString(didReject);\n }\n this._warn(msg);\n }\n return this._then(didFulfill, didReject, undefined, undefined, undefined);\n};\n\nPromise.prototype.done = function (didFulfill, didReject) {\n var promise =\n this._then(didFulfill, didReject, undefined, undefined, undefined);\n promise._setIsFinal();\n};\n\nPromise.prototype.spread = function (fn) {\n if (typeof fn !== \"function\") {\n return apiRejection(\"expecting a function but got \" + util.classString(fn));\n }\n return this.all()._then(fn, undefined, undefined, APPLY, undefined);\n};\n\nPromise.prototype.toJSON = function () {\n var ret = {\n isFulfilled: false,\n isRejected: false,\n fulfillmentValue: undefined,\n rejectionReason: undefined\n };\n if (this.isFulfilled()) {\n ret.fulfillmentValue = this.value();\n ret.isFulfilled = true;\n } else if (this.isRejected()) {\n ret.rejectionReason = this.reason();\n ret.isRejected = true;\n }\n return ret;\n};\n\nPromise.prototype.all = function () {\n if (arguments.length > 0) {\n this._warn(\".all() was passed arguments but it does not take any\");\n }\n return new PromiseArray(this).promise();\n};\n\nPromise.prototype.error = function (fn) {\n return this.caught(util.originatesFromRejection, fn);\n};\n\nPromise.getNewLibraryCopy = module.exports;\n\nPromise.is = function (val) {\n return val instanceof Promise;\n};\n\nPromise.fromNode = Promise.fromCallback = function(fn) {\n var ret = new Promise(INTERNAL);\n ret._captureStackTrace();\n var multiArgs = arguments.length > 1 ? !!Object(arguments[1]).multiArgs\n : false;\n var result = tryCatch(fn)(nodebackForPromise(ret, multiArgs));\n if (result === errorObj) {\n ret._rejectCallback(result.e, true);\n }\n if (!ret._isFateSealed()) ret._setAsyncGuaranteed();\n return ret;\n};\n\nPromise.all = function (promises) {\n return new PromiseArray(promises).promise();\n};\n\nPromise.cast = function (obj) {\n var ret = tryConvertToPromise(obj);\n if (!(ret instanceof Promise)) {\n ret = new Promise(INTERNAL);\n ret._captureStackTrace();\n ret._setFulfilled();\n ret._rejectionHandler0 = obj;\n }\n return ret;\n};\n\nPromise.resolve = Promise.fulfilled = Promise.cast;\n\nPromise.reject = Promise.rejected = function (reason) {\n var ret = new Promise(INTERNAL);\n ret._captureStackTrace();\n ret._rejectCallback(reason, true);\n return ret;\n};\n\nPromise.setScheduler = function(fn) {\n if (typeof fn !== \"function\") {\n throw new TypeError(\"expecting a function but got \" + util.classString(fn));\n }\n return async.setScheduler(fn);\n};\n\nPromise.prototype._then = function (\n didFulfill,\n didReject,\n _, receiver,\n internalData\n) {\n var haveInternalData = internalData !== undefined;\n var promise = haveInternalData ? internalData : new Promise(INTERNAL);\n var target = this._target();\n var bitField = target._bitField;\n\n if (!haveInternalData) {\n promise._propagateFrom(this, 3);\n promise._captureStackTrace();\n if (receiver === undefined &&\n ((this._bitField & 2097152) !== 0)) {\n if (!((bitField & 50397184) === 0)) {\n receiver = this._boundValue();\n } else {\n receiver = target === this ? undefined : this._boundTo;\n }\n }\n this._fireEvent(\"promiseChained\", this, promise);\n }\n\n var domain = getDomain();\n if (!((bitField & 50397184) === 0)) {\n var handler, value, settler = target._settlePromiseCtx;\n if (((bitField & 33554432) !== 0)) {\n value = target._rejectionHandler0;\n handler = didFulfill;\n } else if (((bitField & 16777216) !== 0)) {\n value = target._fulfillmentHandler0;\n handler = didReject;\n target._unsetRejectionIsUnhandled();\n } else {\n settler = target._settlePromiseLateCancellationObserver;\n value = new CancellationError(\"late cancellation observer\");\n target._attachExtraTrace(value);\n handler = didReject;\n }\n\n async.invoke(settler, target, {\n handler: domain === null ? handler\n : (typeof handler === \"function\" &&\n util.domainBind(domain, handler)),\n promise: promise,\n receiver: receiver,\n value: value\n });\n } else {\n target._addCallbacks(didFulfill, didReject, promise, receiver, domain);\n }\n\n return promise;\n};\n\nPromise.prototype._length = function () {\n return this._bitField & 65535;\n};\n\nPromise.prototype._isFateSealed = function () {\n return (this._bitField & 117506048) !== 0;\n};\n\nPromise.prototype._isFollowing = function () {\n return (this._bitField & 67108864) === 67108864;\n};\n\nPromise.prototype._setLength = function (len) {\n this._bitField = (this._bitField & -65536) |\n (len & 65535);\n};\n\nPromise.prototype._setFulfilled = function () {\n this._bitField = this._bitField | 33554432;\n this._fireEvent(\"promiseFulfilled\", this);\n};\n\nPromise.prototype._setRejected = function () {\n this._bitField = this._bitField | 16777216;\n this._fireEvent(\"promiseRejected\", this);\n};\n\nPromise.prototype._setFollowing = function () {\n this._bitField = this._bitField | 67108864;\n this._fireEvent(\"promiseResolved\", this);\n};\n\nPromise.prototype._setIsFinal = function () {\n this._bitField = this._bitField | 4194304;\n};\n\nPromise.prototype._isFinal = function () {\n return (this._bitField & 4194304) > 0;\n};\n\nPromise.prototype._unsetCancelled = function() {\n this._bitField = this._bitField & (~65536);\n};\n\nPromise.prototype._setCancelled = function() {\n this._bitField = this._bitField | 65536;\n this._fireEvent(\"promiseCancelled\", this);\n};\n\nPromise.prototype._setWillBeCancelled = function() {\n this._bitField = this._bitField | 8388608;\n};\n\nPromise.prototype._setAsyncGuaranteed = function() {\n if (async.hasCustomScheduler()) return;\n this._bitField = this._bitField | 134217728;\n};\n\nPromise.prototype._receiverAt = function (index) {\n var ret = index === 0 ? this._receiver0 : this[\n index * 4 - 4 + 3];\n if (ret === UNDEFINED_BINDING) {\n return undefined;\n } else if (ret === undefined && this._isBound()) {\n return this._boundValue();\n }\n return ret;\n};\n\nPromise.prototype._promiseAt = function (index) {\n return this[\n index * 4 - 4 + 2];\n};\n\nPromise.prototype._fulfillmentHandlerAt = function (index) {\n return this[\n index * 4 - 4 + 0];\n};\n\nPromise.prototype._rejectionHandlerAt = function (index) {\n return this[\n index * 4 - 4 + 1];\n};\n\nPromise.prototype._boundValue = function() {};\n\nPromise.prototype._migrateCallback0 = function (follower) {\n var bitField = follower._bitField;\n var fulfill = follower._fulfillmentHandler0;\n var reject = follower._rejectionHandler0;\n var promise = follower._promise0;\n var receiver = follower._receiverAt(0);\n if (receiver === undefined) receiver = UNDEFINED_BINDING;\n this._addCallbacks(fulfill, reject, promise, receiver, null);\n};\n\nPromise.prototype._migrateCallbackAt = function (follower, index) {\n var fulfill = follower._fulfillmentHandlerAt(index);\n var reject = follower._rejectionHandlerAt(index);\n var promise = follower._promiseAt(index);\n var receiver = follower._receiverAt(index);\n if (receiver === undefined) receiver = UNDEFINED_BINDING;\n this._addCallbacks(fulfill, reject, promise, receiver, null);\n};\n\nPromise.prototype._addCallbacks = function (\n fulfill,\n reject,\n promise,\n receiver,\n domain\n) {\n var index = this._length();\n\n if (index >= 65535 - 4) {\n index = 0;\n this._setLength(0);\n }\n\n if (index === 0) {\n this._promise0 = promise;\n this._receiver0 = receiver;\n if (typeof fulfill === \"function\") {\n this._fulfillmentHandler0 =\n domain === null ? fulfill : util.domainBind(domain, fulfill);\n }\n if (typeof reject === \"function\") {\n this._rejectionHandler0 =\n domain === null ? reject : util.domainBind(domain, reject);\n }\n } else {\n var base = index * 4 - 4;\n this[base + 2] = promise;\n this[base + 3] = receiver;\n if (typeof fulfill === \"function\") {\n this[base + 0] =\n domain === null ? fulfill : util.domainBind(domain, fulfill);\n }\n if (typeof reject === \"function\") {\n this[base + 1] =\n domain === null ? reject : util.domainBind(domain, reject);\n }\n }\n this._setLength(index + 1);\n return index;\n};\n\nPromise.prototype._proxy = function (proxyable, arg) {\n this._addCallbacks(undefined, undefined, arg, proxyable, null);\n};\n\nPromise.prototype._resolveCallback = function(value, shouldBind) {\n if (((this._bitField & 117506048) !== 0)) return;\n if (value === this)\n return this._rejectCallback(makeSelfResolutionError(), false);\n var maybePromise = tryConvertToPromise(value, this);\n if (!(maybePromise instanceof Promise)) return this._fulfill(value);\n\n if (shouldBind) this._propagateFrom(maybePromise, 2);\n\n var promise = maybePromise._target();\n\n if (promise === this) {\n this._reject(makeSelfResolutionError());\n return;\n }\n\n var bitField = promise._bitField;\n if (((bitField & 50397184) === 0)) {\n var len = this._length();\n if (len > 0) promise._migrateCallback0(this);\n for (var i = 1; i < len; ++i) {\n promise._migrateCallbackAt(this, i);\n }\n this._setFollowing();\n this._setLength(0);\n this._setFollowee(promise);\n } else if (((bitField & 33554432) !== 0)) {\n this._fulfill(promise._value());\n } else if (((bitField & 16777216) !== 0)) {\n this._reject(promise._reason());\n } else {\n var reason = new CancellationError(\"late cancellation observer\");\n promise._attachExtraTrace(reason);\n this._reject(reason);\n }\n};\n\nPromise.prototype._rejectCallback =\nfunction(reason, synchronous, ignoreNonErrorWarnings) {\n var trace = util.ensureErrorObject(reason);\n var hasStack = trace === reason;\n if (!hasStack && !ignoreNonErrorWarnings && debug.warnings()) {\n var message = \"a promise was rejected with a non-error: \" +\n util.classString(reason);\n this._warn(message, true);\n }\n this._attachExtraTrace(trace, synchronous ? hasStack : false);\n this._reject(reason);\n};\n\nPromise.prototype._resolveFromExecutor = function (executor) {\n if (executor === INTERNAL) return;\n var promise = this;\n this._captureStackTrace();\n this._pushContext();\n var synchronous = true;\n var r = this._execute(executor, function(value) {\n promise._resolveCallback(value);\n }, function (reason) {\n promise._rejectCallback(reason, synchronous);\n });\n synchronous = false;\n this._popContext();\n\n if (r !== undefined) {\n promise._rejectCallback(r, true);\n }\n};\n\nPromise.prototype._settlePromiseFromHandler = function (\n handler, receiver, value, promise\n) {\n var bitField = promise._bitField;\n if (((bitField & 65536) !== 0)) return;\n promise._pushContext();\n var x;\n if (receiver === APPLY) {\n if (!value || typeof value.length !== \"number\") {\n x = errorObj;\n x.e = new TypeError(\"cannot .spread() a non-array: \" +\n util.classString(value));\n } else {\n x = tryCatch(handler).apply(this._boundValue(), value);\n }\n } else {\n x = tryCatch(handler).call(receiver, value);\n }\n var promiseCreated = promise._popContext();\n bitField = promise._bitField;\n if (((bitField & 65536) !== 0)) return;\n\n if (x === NEXT_FILTER) {\n promise._reject(value);\n } else if (x === errorObj) {\n promise._rejectCallback(x.e, false);\n } else {\n debug.checkForgottenReturns(x, promiseCreated, \"\", promise, this);\n promise._resolveCallback(x);\n }\n};\n\nPromise.prototype._target = function() {\n var ret = this;\n while (ret._isFollowing()) ret = ret._followee();\n return ret;\n};\n\nPromise.prototype._followee = function() {\n return this._rejectionHandler0;\n};\n\nPromise.prototype._setFollowee = function(promise) {\n this._rejectionHandler0 = promise;\n};\n\nPromise.prototype._settlePromise = function(promise, handler, receiver, value) {\n var isPromise = promise instanceof Promise;\n var bitField = this._bitField;\n var asyncGuaranteed = ((bitField & 134217728) !== 0);\n if (((bitField & 65536) !== 0)) {\n if (isPromise) promise._invokeInternalOnCancel();\n\n if (receiver instanceof PassThroughHandlerContext &&\n receiver.isFinallyHandler()) {\n receiver.cancelPromise = promise;\n if (tryCatch(handler).call(receiver, value) === errorObj) {\n promise._reject(errorObj.e);\n }\n } else if (handler === reflectHandler) {\n promise._fulfill(reflectHandler.call(receiver));\n } else if (receiver instanceof Proxyable) {\n receiver._promiseCancelled(promise);\n } else if (isPromise || promise instanceof PromiseArray) {\n promise._cancel();\n } else {\n receiver.cancel();\n }\n } else if (typeof handler === \"function\") {\n if (!isPromise) {\n handler.call(receiver, value, promise);\n } else {\n if (asyncGuaranteed) promise._setAsyncGuaranteed();\n this._settlePromiseFromHandler(handler, receiver, value, promise);\n }\n } else if (receiver instanceof Proxyable) {\n if (!receiver._isResolved()) {\n if (((bitField & 33554432) !== 0)) {\n receiver._promiseFulfilled(value, promise);\n } else {\n receiver._promiseRejected(value, promise);\n }\n }\n } else if (isPromise) {\n if (asyncGuaranteed) promise._setAsyncGuaranteed();\n if (((bitField & 33554432) !== 0)) {\n promise._fulfill(value);\n } else {\n promise._reject(value);\n }\n }\n};\n\nPromise.prototype._settlePromiseLateCancellationObserver = function(ctx) {\n var handler = ctx.handler;\n var promise = ctx.promise;\n var receiver = ctx.receiver;\n var value = ctx.value;\n if (typeof handler === \"function\") {\n if (!(promise instanceof Promise)) {\n handler.call(receiver, value, promise);\n } else {\n this._settlePromiseFromHandler(handler, receiver, value, promise);\n }\n } else if (promise instanceof Promise) {\n promise._reject(value);\n }\n};\n\nPromise.prototype._settlePromiseCtx = function(ctx) {\n this._settlePromise(ctx.promise, ctx.handler, ctx.receiver, ctx.value);\n};\n\nPromise.prototype._settlePromise0 = function(handler, value, bitField) {\n var promise = this._promise0;\n var receiver = this._receiverAt(0);\n this._promise0 = undefined;\n this._receiver0 = undefined;\n this._settlePromise(promise, handler, receiver, value);\n};\n\nPromise.prototype._clearCallbackDataAtIndex = function(index) {\n var base = index * 4 - 4;\n this[base + 2] =\n this[base + 3] =\n this[base + 0] =\n this[base + 1] = undefined;\n};\n\nPromise.prototype._fulfill = function (value) {\n var bitField = this._bitField;\n if (((bitField & 117506048) >>> 16)) return;\n if (value === this) {\n var err = makeSelfResolutionError();\n this._attachExtraTrace(err);\n return this._reject(err);\n }\n this._setFulfilled();\n this._rejectionHandler0 = value;\n\n if ((bitField & 65535) > 0) {\n if (((bitField & 134217728) !== 0)) {\n this._settlePromises();\n } else {\n async.settlePromises(this);\n }\n }\n};\n\nPromise.prototype._reject = function (reason) {\n var bitField = this._bitField;\n if (((bitField & 117506048) >>> 16)) return;\n this._setRejected();\n this._fulfillmentHandler0 = reason;\n\n if (this._isFinal()) {\n return async.fatalError(reason, util.isNode);\n }\n\n if ((bitField & 65535) > 0) {\n async.settlePromises(this);\n } else {\n this._ensurePossibleRejectionHandled();\n }\n};\n\nPromise.prototype._fulfillPromises = function (len, value) {\n for (var i = 1; i < len; i++) {\n var handler = this._fulfillmentHandlerAt(i);\n var promise = this._promiseAt(i);\n var receiver = this._receiverAt(i);\n this._clearCallbackDataAtIndex(i);\n this._settlePromise(promise, handler, receiver, value);\n }\n};\n\nPromise.prototype._rejectPromises = function (len, reason) {\n for (var i = 1; i < len; i++) {\n var handler = this._rejectionHandlerAt(i);\n var promise = this._promiseAt(i);\n var receiver = this._receiverAt(i);\n this._clearCallbackDataAtIndex(i);\n this._settlePromise(promise, handler, receiver, reason);\n }\n};\n\nPromise.prototype._settlePromises = function () {\n var bitField = this._bitField;\n var len = (bitField & 65535);\n\n if (len > 0) {\n if (((bitField & 16842752) !== 0)) {\n var reason = this._fulfillmentHandler0;\n this._settlePromise0(this._rejectionHandler0, reason, bitField);\n this._rejectPromises(len, reason);\n } else {\n var value = this._rejectionHandler0;\n this._settlePromise0(this._fulfillmentHandler0, value, bitField);\n this._fulfillPromises(len, value);\n }\n this._setLength(0);\n }\n this._clearCancellationData();\n};\n\nPromise.prototype._settledValue = function() {\n var bitField = this._bitField;\n if (((bitField & 33554432) !== 0)) {\n return this._rejectionHandler0;\n } else if (((bitField & 16777216) !== 0)) {\n return this._fulfillmentHandler0;\n }\n};\n\nfunction deferResolve(v) {this.promise._resolveCallback(v);}\nfunction deferReject(v) {this.promise._rejectCallback(v, false);}\n\nPromise.defer = Promise.pending = function() {\n debug.deprecated(\"Promise.defer\", \"new Promise\");\n var promise = new Promise(INTERNAL);\n return {\n promise: promise,\n resolve: deferResolve,\n reject: deferReject\n };\n};\n\nutil.notEnumerableProp(Promise,\n \"_makeSelfResolutionError\",\n makeSelfResolutionError);\n\n_dereq_(\"./method\")(Promise, INTERNAL, tryConvertToPromise, apiRejection,\n debug);\n_dereq_(\"./bind\")(Promise, INTERNAL, tryConvertToPromise, debug);\n_dereq_(\"./cancel\")(Promise, PromiseArray, apiRejection, debug);\n_dereq_(\"./direct_resolve\")(Promise);\n_dereq_(\"./synchronous_inspection\")(Promise);\n_dereq_(\"./join\")(\n Promise, PromiseArray, tryConvertToPromise, INTERNAL, async, getDomain);\nPromise.Promise = Promise;\nPromise.version = \"3.5.1\";\n_dereq_('./map.js')(Promise, PromiseArray, apiRejection, tryConvertToPromise, INTERNAL, debug);\n_dereq_('./call_get.js')(Promise);\n_dereq_('./using.js')(Promise, apiRejection, tryConvertToPromise, createContext, INTERNAL, debug);\n_dereq_('./timers.js')(Promise, INTERNAL, debug);\n_dereq_('./generators.js')(Promise, apiRejection, INTERNAL, tryConvertToPromise, Proxyable, debug);\n_dereq_('./nodeify.js')(Promise);\n_dereq_('./promisify.js')(Promise, INTERNAL);\n_dereq_('./props.js')(Promise, PromiseArray, tryConvertToPromise, apiRejection);\n_dereq_('./race.js')(Promise, INTERNAL, tryConvertToPromise, apiRejection);\n_dereq_('./reduce.js')(Promise, PromiseArray, apiRejection, tryConvertToPromise, INTERNAL, debug);\n_dereq_('./settle.js')(Promise, PromiseArray, debug);\n_dereq_('./some.js')(Promise, PromiseArray, apiRejection);\n_dereq_('./filter.js')(Promise, INTERNAL);\n_dereq_('./each.js')(Promise, INTERNAL);\n_dereq_('./any.js')(Promise);\n \n util.toFastProperties(Promise); \n util.toFastProperties(Promise.prototype); \n function fillTypes(value) { \n var p = new Promise(INTERNAL); \n p._fulfillmentHandler0 = value; \n p._rejectionHandler0 = value; \n p._promise0 = value; \n p._receiver0 = value; \n } \n // Complete slack tracking, opt out of field-type tracking and \n // stabilize map \n fillTypes({a: 1}); \n fillTypes({b: 2}); \n fillTypes({c: 3}); \n fillTypes(1); \n fillTypes(function(){}); \n fillTypes(undefined); \n fillTypes(false); \n fillTypes(new Promise(INTERNAL)); \n debug.setBounds(Async.firstLineError, util.lastLineError); \n return Promise; \n\n};\n\n},{\"./any.js\":1,\"./async\":2,\"./bind\":3,\"./call_get.js\":5,\"./cancel\":6,\"./catch_filter\":7,\"./context\":8,\"./debuggability\":9,\"./direct_resolve\":10,\"./each.js\":11,\"./errors\":12,\"./es5\":13,\"./filter.js\":14,\"./finally\":15,\"./generators.js\":16,\"./join\":17,\"./map.js\":18,\"./method\":19,\"./nodeback\":20,\"./nodeify.js\":21,\"./promise_array\":23,\"./promisify.js\":24,\"./props.js\":25,\"./race.js\":27,\"./reduce.js\":28,\"./settle.js\":30,\"./some.js\":31,\"./synchronous_inspection\":32,\"./thenables\":33,\"./timers.js\":34,\"./using.js\":35,\"./util\":36}],23:[function(_dereq_,module,exports){\n\"use strict\";\nmodule.exports = function(Promise, INTERNAL, tryConvertToPromise,\n apiRejection, Proxyable) {\nvar util = _dereq_(\"./util\");\nvar isArray = util.isArray;\n\nfunction toResolutionValue(val) {\n switch(val) {\n case -2: return [];\n case -3: return {};\n case -6: return new Map();\n }\n}\n\nfunction PromiseArray(values) {\n var promise = this._promise = new Promise(INTERNAL);\n if (values instanceof Promise) {\n promise._propagateFrom(values, 3);\n }\n promise._setOnCancel(this);\n this._values = values;\n this._length = 0;\n this._totalResolved = 0;\n this._init(undefined, -2);\n}\nutil.inherits(PromiseArray, Proxyable);\n\nPromiseArray.prototype.length = function () {\n return this._length;\n};\n\nPromiseArray.prototype.promise = function () {\n return this._promise;\n};\n\nPromiseArray.prototype._init = function init(_, resolveValueIfEmpty) {\n var values = tryConvertToPromise(this._values, this._promise);\n if (values instanceof Promise) {\n values = values._target();\n var bitField = values._bitField;\n ;\n this._values = values;\n\n if (((bitField & 50397184) === 0)) {\n this._promise._setAsyncGuaranteed();\n return values._then(\n init,\n this._reject,\n undefined,\n this,\n resolveValueIfEmpty\n );\n } else if (((bitField & 33554432) !== 0)) {\n values = values._value();\n } else if (((bitField & 16777216) !== 0)) {\n return this._reject(values._reason());\n } else {\n return this._cancel();\n }\n }\n values = util.asArray(values);\n if (values === null) {\n var err = apiRejection(\n \"expecting an array or an iterable object but got \" + util.classString(values)).reason();\n this._promise._rejectCallback(err, false);\n return;\n }\n\n if (values.length === 0) {\n if (resolveValueIfEmpty === -5) {\n this._resolveEmptyArray();\n }\n else {\n this._resolve(toResolutionValue(resolveValueIfEmpty));\n }\n return;\n }\n this._iterate(values);\n};\n\nPromiseArray.prototype._iterate = function(values) {\n var len = this.getActualLength(values.length);\n this._length = len;\n this._values = this.shouldCopyValues() ? new Array(len) : this._values;\n var result = this._promise;\n var isResolved = false;\n var bitField = null;\n for (var i = 0; i < len; ++i) {\n var maybePromise = tryConvertToPromise(values[i], result);\n\n if (maybePromise instanceof Promise) {\n maybePromise = maybePromise._target();\n bitField = maybePromise._bitField;\n } else {\n bitField = null;\n }\n\n if (isResolved) {\n if (bitField !== null) {\n maybePromise.suppressUnhandledRejections();\n }\n } else if (bitField !== null) {\n if (((bitField & 50397184) === 0)) {\n maybePromise._proxy(this, i);\n this._values[i] = maybePromise;\n } else if (((bitField & 33554432) !== 0)) {\n isResolved = this._promiseFulfilled(maybePromise._value(), i);\n } else if (((bitField & 16777216) !== 0)) {\n isResolved = this._promiseRejected(maybePromise._reason(), i);\n } else {\n isResolved = this._promiseCancelled(i);\n }\n } else {\n isResolved = this._promiseFulfilled(maybePromise, i);\n }\n }\n if (!isResolved) result._setAsyncGuaranteed();\n};\n\nPromiseArray.prototype._isResolved = function () {\n return this._values === null;\n};\n\nPromiseArray.prototype._resolve = function (value) {\n this._values = null;\n this._promise._fulfill(value);\n};\n\nPromiseArray.prototype._cancel = function() {\n if (this._isResolved() || !this._promise._isCancellable()) return;\n this._values = null;\n this._promise._cancel();\n};\n\nPromiseArray.prototype._reject = function (reason) {\n this._values = null;\n this._promise._rejectCallback(reason, false);\n};\n\nPromiseArray.prototype._promiseFulfilled = function (value, index) {\n this._values[index] = value;\n var totalResolved = ++this._totalResolved;\n if (totalResolved >= this._length) {\n this._resolve(this._values);\n return true;\n }\n return false;\n};\n\nPromiseArray.prototype._promiseCancelled = function() {\n this._cancel();\n return true;\n};\n\nPromiseArray.prototype._promiseRejected = function (reason) {\n this._totalResolved++;\n this._reject(reason);\n return true;\n};\n\nPromiseArray.prototype._resultCancelled = function() {\n if (this._isResolved()) return;\n var values = this._values;\n this._cancel();\n if (values instanceof Promise) {\n values.cancel();\n } else {\n for (var i = 0; i < values.length; ++i) {\n if (values[i] instanceof Promise) {\n values[i].cancel();\n }\n }\n }\n};\n\nPromiseArray.prototype.shouldCopyValues = function () {\n return true;\n};\n\nPromiseArray.prototype.getActualLength = function (len) {\n return len;\n};\n\nreturn PromiseArray;\n};\n\n},{\"./util\":36}],24:[function(_dereq_,module,exports){\n\"use strict\";\nmodule.exports = function(Promise, INTERNAL) {\nvar THIS = {};\nvar util = _dereq_(\"./util\");\nvar nodebackForPromise = _dereq_(\"./nodeback\");\nvar withAppended = util.withAppended;\nvar maybeWrapAsError = util.maybeWrapAsError;\nvar canEvaluate = util.canEvaluate;\nvar TypeError = _dereq_(\"./errors\").TypeError;\nvar defaultSuffix = \"Async\";\nvar defaultPromisified = {__isPromisified__: true};\nvar noCopyProps = [\n \"arity\", \"length\",\n \"name\",\n \"arguments\",\n \"caller\",\n \"callee\",\n \"prototype\",\n \"__isPromisified__\"\n];\nvar noCopyPropsPattern = new RegExp(\"^(?:\" + noCopyProps.join(\"|\") + \")$\");\n\nvar defaultFilter = function(name) {\n return util.isIdentifier(name) &&\n name.charAt(0) !== \"_\" &&\n name !== \"constructor\";\n};\n\nfunction propsFilter(key) {\n return !noCopyPropsPattern.test(key);\n}\n\nfunction isPromisified(fn) {\n try {\n return fn.__isPromisified__ === true;\n }\n catch (e) {\n return false;\n }\n}\n\nfunction hasPromisified(obj, key, suffix) {\n var val = util.getDataPropertyOrDefault(obj, key + suffix,\n defaultPromisified);\n return val ? isPromisified(val) : false;\n}\nfunction checkValid(ret, suffix, suffixRegexp) {\n for (var i = 0; i < ret.length; i += 2) {\n var key = ret[i];\n if (suffixRegexp.test(key)) {\n var keyWithoutAsyncSuffix = key.replace(suffixRegexp, \"\");\n for (var j = 0; j < ret.length; j += 2) {\n if (ret[j] === keyWithoutAsyncSuffix) {\n throw new TypeError(\"Cannot promisify an API that has normal methods with '%s'-suffix\\u000a\\u000a See http://goo.gl/MqrFmX\\u000a\"\n .replace(\"%s\", suffix));\n }\n }\n }\n }\n}\n\nfunction promisifiableMethods(obj, suffix, suffixRegexp, filter) {\n var keys = util.inheritedDataKeys(obj);\n var ret = [];\n for (var i = 0; i < keys.length; ++i) {\n var key = keys[i];\n var value = obj[key];\n var passesDefaultFilter = filter === defaultFilter\n ? true : defaultFilter(key, value, obj);\n if (typeof value === \"function\" &&\n !isPromisified(value) &&\n !hasPromisified(obj, key, suffix) &&\n filter(key, value, obj, passesDefaultFilter)) {\n ret.push(key, value);\n }\n }\n checkValid(ret, suffix, suffixRegexp);\n return ret;\n}\n\nvar escapeIdentRegex = function(str) {\n return str.replace(/([$])/, \"\\\\$\");\n};\n\nvar makeNodePromisifiedEval;\nif (!true) {\nvar switchCaseArgumentOrder = function(likelyArgumentCount) {\n var ret = [likelyArgumentCount];\n var min = Math.max(0, likelyArgumentCount - 1 - 3);\n for(var i = likelyArgumentCount - 1; i >= min; --i) {\n ret.push(i);\n }\n for(var i = likelyArgumentCount + 1; i <= 3; ++i) {\n ret.push(i);\n }\n return ret;\n};\n\nvar argumentSequence = function(argumentCount) {\n return util.filledRange(argumentCount, \"_arg\", \"\");\n};\n\nvar parameterDeclaration = function(parameterCount) {\n return util.filledRange(\n Math.max(parameterCount, 3), \"_arg\", \"\");\n};\n\nvar parameterCount = function(fn) {\n if (typeof fn.length === \"number\") {\n return Math.max(Math.min(fn.length, 1023 + 1), 0);\n }\n return 0;\n};\n\nmakeNodePromisifiedEval =\nfunction(callback, receiver, originalName, fn, _, multiArgs) {\n var newParameterCount = Math.max(0, parameterCount(fn) - 1);\n var argumentOrder = switchCaseArgumentOrder(newParameterCount);\n var shouldProxyThis = typeof callback === \"string\" || receiver === THIS;\n\n function generateCallForArgumentCount(count) {\n var args = argumentSequence(count).join(\", \");\n var comma = count > 0 ? \", \" : \"\";\n var ret;\n if (shouldProxyThis) {\n ret = \"ret = callback.call(this, {{args}}, nodeback); break;\\n\";\n } else {\n ret = receiver === undefined\n ? \"ret = callback({{args}}, nodeback); break;\\n\"\n : \"ret = callback.call(receiver, {{args}}, nodeback); break;\\n\";\n }\n return ret.replace(\"{{args}}\", args).replace(\", \", comma);\n }\n\n function generateArgumentSwitchCase() {\n var ret = \"\";\n for (var i = 0; i < argumentOrder.length; ++i) {\n ret += \"case \" + argumentOrder[i] +\":\" +\n generateCallForArgumentCount(argumentOrder[i]);\n }\n\n ret += \" \\n\\\n default: \\n\\\n var args = new Array(len + 1); \\n\\\n var i = 0; \\n\\\n for (var i = 0; i < len; ++i) { \\n\\\n args[i] = arguments[i]; \\n\\\n } \\n\\\n args[i] = nodeback; \\n\\\n [CodeForCall] \\n\\\n break; \\n\\\n \".replace(\"[CodeForCall]\", (shouldProxyThis\n ? \"ret = callback.apply(this, args);\\n\"\n : \"ret = callback.apply(receiver, args);\\n\"));\n return ret;\n }\n\n var getFunctionCode = typeof callback === \"string\"\n ? (\"this != null ? this['\"+callback+\"'] : fn\")\n : \"fn\";\n var body = \"'use strict'; \\n\\\n var ret = function (Parameters) { \\n\\\n 'use strict'; \\n\\\n var len = arguments.length; \\n\\\n var promise = new Promise(INTERNAL); \\n\\\n promise._captureStackTrace(); \\n\\\n var nodeback = nodebackForPromise(promise, \" + multiArgs + \"); \\n\\\n var ret; \\n\\\n var callback = tryCatch([GetFunctionCode]); \\n\\\n switch(len) { \\n\\\n [CodeForSwitchCase] \\n\\\n } \\n\\\n if (ret === errorObj) { \\n\\\n promise._rejectCallback(maybeWrapAsError(ret.e), true, true);\\n\\\n } \\n\\\n if (!promise._isFateSealed()) promise._setAsyncGuaranteed(); \\n\\\n return promise; \\n\\\n }; \\n\\\n notEnumerableProp(ret, '__isPromisified__', true); \\n\\\n return ret; \\n\\\n \".replace(\"[CodeForSwitchCase]\", generateArgumentSwitchCase())\n .replace(\"[GetFunctionCode]\", getFunctionCode);\n body = body.replace(\"Parameters\", parameterDeclaration(newParameterCount));\n return new Function(\"Promise\",\n \"fn\",\n \"receiver\",\n \"withAppended\",\n \"maybeWrapAsError\",\n \"nodebackForPromise\",\n \"tryCatch\",\n \"errorObj\",\n \"notEnumerableProp\",\n \"INTERNAL\",\n body)(\n Promise,\n fn,\n receiver,\n withAppended,\n maybeWrapAsError,\n nodebackForPromise,\n util.tryCatch,\n util.errorObj,\n util.notEnumerableProp,\n INTERNAL);\n};\n}\n\nfunction makeNodePromisifiedClosure(callback, receiver, _, fn, __, multiArgs) {\n var defaultThis = (function() {return this;})();\n var method = callback;\n if (typeof method === \"string\") {\n callback = fn;\n }\n function promisified() {\n var _receiver = receiver;\n if (receiver === THIS) _receiver = this;\n var promise = new Promise(INTERNAL);\n promise._captureStackTrace();\n var cb = typeof method === \"string\" && this !== defaultThis\n ? this[method] : callback;\n var fn = nodebackForPromise(promise, multiArgs);\n try {\n cb.apply(_receiver, withAppended(arguments, fn));\n } catch(e) {\n promise._rejectCallback(maybeWrapAsError(e), true, true);\n }\n if (!promise._isFateSealed()) promise._setAsyncGuaranteed();\n return promise;\n }\n util.notEnumerableProp(promisified, \"__isPromisified__\", true);\n return promisified;\n}\n\nvar makeNodePromisified = canEvaluate\n ? makeNodePromisifiedEval\n : makeNodePromisifiedClosure;\n\nfunction promisifyAll(obj, suffix, filter, promisifier, multiArgs) {\n var suffixRegexp = new RegExp(escapeIdentRegex(suffix) + \"$\");\n var methods =\n promisifiableMethods(obj, suffix, suffixRegexp, filter);\n\n for (var i = 0, len = methods.length; i < len; i+= 2) {\n var key = methods[i];\n var fn = methods[i+1];\n var promisifiedKey = key + suffix;\n if (promisifier === makeNodePromisified) {\n obj[promisifiedKey] =\n makeNodePromisified(key, THIS, key, fn, suffix, multiArgs);\n } else {\n var promisified = promisifier(fn, function() {\n return makeNodePromisified(key, THIS, key,\n fn, suffix, multiArgs);\n });\n util.notEnumerableProp(promisified, \"__isPromisified__\", true);\n obj[promisifiedKey] = promisified;\n }\n }\n util.toFastProperties(obj);\n return obj;\n}\n\nfunction promisify(callback, receiver, multiArgs) {\n return makeNodePromisified(callback, receiver, undefined,\n callback, null, multiArgs);\n}\n\nPromise.promisify = function (fn, options) {\n if (typeof fn !== \"function\") {\n throw new TypeError(\"expecting a function but got \" + util.classString(fn));\n }\n if (isPromisified(fn)) {\n return fn;\n }\n options = Object(options);\n var receiver = options.context === undefined ? THIS : options.context;\n var multiArgs = !!options.multiArgs;\n var ret = promisify(fn, receiver, multiArgs);\n util.copyDescriptors(fn, ret, propsFilter);\n return ret;\n};\n\nPromise.promisifyAll = function (target, options) {\n if (typeof target !== \"function\" && typeof target !== \"object\") {\n throw new TypeError(\"the target of promisifyAll must be an object or a function\\u000a\\u000a See http://goo.gl/MqrFmX\\u000a\");\n }\n options = Object(options);\n var multiArgs = !!options.multiArgs;\n var suffix = options.suffix;\n if (typeof suffix !== \"string\") suffix = defaultSuffix;\n var filter = options.filter;\n if (typeof filter !== \"function\") filter = defaultFilter;\n var promisifier = options.promisifier;\n if (typeof promisifier !== \"function\") promisifier = makeNodePromisified;\n\n if (!util.isIdentifier(suffix)) {\n throw new RangeError(\"suffix must be a valid identifier\\u000a\\u000a See http://goo.gl/MqrFmX\\u000a\");\n }\n\n var keys = util.inheritedDataKeys(target);\n for (var i = 0; i < keys.length; ++i) {\n var value = target[keys[i]];\n if (keys[i] !== \"constructor\" &&\n util.isClass(value)) {\n promisifyAll(value.prototype, suffix, filter, promisifier,\n multiArgs);\n promisifyAll(value, suffix, filter, promisifier, multiArgs);\n }\n }\n\n return promisifyAll(target, suffix, filter, promisifier, multiArgs);\n};\n};\n\n\n},{\"./errors\":12,\"./nodeback\":20,\"./util\":36}],25:[function(_dereq_,module,exports){\n\"use strict\";\nmodule.exports = function(\n Promise, PromiseArray, tryConvertToPromise, apiRejection) {\nvar util = _dereq_(\"./util\");\nvar isObject = util.isObject;\nvar es5 = _dereq_(\"./es5\");\nvar Es6Map;\nif (typeof Map === \"function\") Es6Map = Map;\n\nvar mapToEntries = (function() {\n var index = 0;\n var size = 0;\n\n function extractEntry(value, key) {\n this[index] = value;\n this[index + size] = key;\n index++;\n }\n\n return function mapToEntries(map) {\n size = map.size;\n index = 0;\n var ret = new Array(map.size * 2);\n map.forEach(extractEntry, ret);\n return ret;\n };\n})();\n\nvar entriesToMap = function(entries) {\n var ret = new Es6Map();\n var length = entries.length / 2 | 0;\n for (var i = 0; i < length; ++i) {\n var key = entries[length + i];\n var value = entries[i];\n ret.set(key, value);\n }\n return ret;\n};\n\nfunction PropertiesPromiseArray(obj) {\n var isMap = false;\n var entries;\n if (Es6Map !== undefined && obj instanceof Es6Map) {\n entries = mapToEntries(obj);\n isMap = true;\n } else {\n var keys = es5.keys(obj);\n var len = keys.length;\n entries = new Array(len * 2);\n for (var i = 0; i < len; ++i) {\n var key = keys[i];\n entries[i] = obj[key];\n entries[i + len] = key;\n }\n }\n this.constructor$(entries);\n this._isMap = isMap;\n this._init$(undefined, isMap ? -6 : -3);\n}\nutil.inherits(PropertiesPromiseArray, PromiseArray);\n\nPropertiesPromiseArray.prototype._init = function () {};\n\nPropertiesPromiseArray.prototype._promiseFulfilled = function (value, index) {\n this._values[index] = value;\n var totalResolved = ++this._totalResolved;\n if (totalResolved >= this._length) {\n var val;\n if (this._isMap) {\n val = entriesToMap(this._values);\n } else {\n val = {};\n var keyOffset = this.length();\n for (var i = 0, len = this.length(); i < len; ++i) {\n val[this._values[i + keyOffset]] = this._values[i];\n }\n }\n this._resolve(val);\n return true;\n }\n return false;\n};\n\nPropertiesPromiseArray.prototype.shouldCopyValues = function () {\n return false;\n};\n\nPropertiesPromiseArray.prototype.getActualLength = function (len) {\n return len >> 1;\n};\n\nfunction props(promises) {\n var ret;\n var castValue = tryConvertToPromise(promises);\n\n if (!isObject(castValue)) {\n return apiRejection(\"cannot await properties of a non-object\\u000a\\u000a See http://goo.gl/MqrFmX\\u000a\");\n } else if (castValue instanceof Promise) {\n ret = castValue._then(\n Promise.props, undefined, undefined, undefined, undefined);\n } else {\n ret = new PropertiesPromiseArray(castValue).promise();\n }\n\n if (castValue instanceof Promise) {\n ret._propagateFrom(castValue, 2);\n }\n return ret;\n}\n\nPromise.prototype.props = function () {\n return props(this);\n};\n\nPromise.props = function (promises) {\n return props(promises);\n};\n};\n\n},{\"./es5\":13,\"./util\":36}],26:[function(_dereq_,module,exports){\n\"use strict\";\nfunction arrayMove(src, srcIndex, dst, dstIndex, len) {\n for (var j = 0; j < len; ++j) {\n dst[j + dstIndex] = src[j + srcIndex];\n src[j + srcIndex] = void 0;\n }\n}\n\nfunction Queue(capacity) {\n this._capacity = capacity;\n this._length = 0;\n this._front = 0;\n}\n\nQueue.prototype._willBeOverCapacity = function (size) {\n return this._capacity < size;\n};\n\nQueue.prototype._pushOne = function (arg) {\n var length = this.length();\n this._checkCapacity(length + 1);\n var i = (this._front + length) & (this._capacity - 1);\n this[i] = arg;\n this._length = length + 1;\n};\n\nQueue.prototype.push = function (fn, receiver, arg) {\n var length = this.length() + 3;\n if (this._willBeOverCapacity(length)) {\n this._pushOne(fn);\n this._pushOne(receiver);\n this._pushOne(arg);\n return;\n }\n var j = this._front + length - 3;\n this._checkCapacity(length);\n var wrapMask = this._capacity - 1;\n this[(j + 0) & wrapMask] = fn;\n this[(j + 1) & wrapMask] = receiver;\n this[(j + 2) & wrapMask] = arg;\n this._length = length;\n};\n\nQueue.prototype.shift = function () {\n var front = this._front,\n ret = this[front];\n\n this[front] = undefined;\n this._front = (front + 1) & (this._capacity - 1);\n this._length--;\n return ret;\n};\n\nQueue.prototype.length = function () {\n return this._length;\n};\n\nQueue.prototype._checkCapacity = function (size) {\n if (this._capacity < size) {\n this._resizeTo(this._capacity << 1);\n }\n};\n\nQueue.prototype._resizeTo = function (capacity) {\n var oldCapacity = this._capacity;\n this._capacity = capacity;\n var front = this._front;\n var length = this._length;\n var moveItemsCount = (front + length) & (oldCapacity - 1);\n arrayMove(this, 0, this, oldCapacity, moveItemsCount);\n};\n\nmodule.exports = Queue;\n\n},{}],27:[function(_dereq_,module,exports){\n\"use strict\";\nmodule.exports = function(\n Promise, INTERNAL, tryConvertToPromise, apiRejection) {\nvar util = _dereq_(\"./util\");\n\nvar raceLater = function (promise) {\n return promise.then(function(array) {\n return race(array, promise);\n });\n};\n\nfunction race(promises, parent) {\n var maybePromise = tryConvertToPromise(promises);\n\n if (maybePromise instanceof Promise) {\n return raceLater(maybePromise);\n } else {\n promises = util.asArray(promises);\n if (promises === null)\n return apiRejection(\"expecting an array or an iterable object but got \" + util.classString(promises));\n }\n\n var ret = new Promise(INTERNAL);\n if (parent !== undefined) {\n ret._propagateFrom(parent, 3);\n }\n var fulfill = ret._fulfill;\n var reject = ret._reject;\n for (var i = 0, len = promises.length; i < len; ++i) {\n var val = promises[i];\n\n if (val === undefined && !(i in promises)) {\n continue;\n }\n\n Promise.cast(val)._then(fulfill, reject, undefined, ret, null);\n }\n return ret;\n}\n\nPromise.race = function (promises) {\n return race(promises, undefined);\n};\n\nPromise.prototype.race = function () {\n return race(this, undefined);\n};\n\n};\n\n},{\"./util\":36}],28:[function(_dereq_,module,exports){\n\"use strict\";\nmodule.exports = function(Promise,\n PromiseArray,\n apiRejection,\n tryConvertToPromise,\n INTERNAL,\n debug) {\nvar getDomain = Promise._getDomain;\nvar util = _dereq_(\"./util\");\nvar tryCatch = util.tryCatch;\n\nfunction ReductionPromiseArray(promises, fn, initialValue, _each) {\n this.constructor$(promises);\n var domain = getDomain();\n this._fn = domain === null ? fn : util.domainBind(domain, fn);\n if (initialValue !== undefined) {\n initialValue = Promise.resolve(initialValue);\n initialValue._attachCancellationCallback(this);\n }\n this._initialValue = initialValue;\n this._currentCancellable = null;\n if(_each === INTERNAL) {\n this._eachValues = Array(this._length);\n } else if (_each === 0) {\n this._eachValues = null;\n } else {\n this._eachValues = undefined;\n }\n this._promise._captureStackTrace();\n this._init$(undefined, -5);\n}\nutil.inherits(ReductionPromiseArray, PromiseArray);\n\nReductionPromiseArray.prototype._gotAccum = function(accum) {\n if (this._eachValues !== undefined && \n this._eachValues !== null && \n accum !== INTERNAL) {\n this._eachValues.push(accum);\n }\n};\n\nReductionPromiseArray.prototype._eachComplete = function(value) {\n if (this._eachValues !== null) {\n this._eachValues.push(value);\n }\n return this._eachValues;\n};\n\nReductionPromiseArray.prototype._init = function() {};\n\nReductionPromiseArray.prototype._resolveEmptyArray = function() {\n this._resolve(this._eachValues !== undefined ? this._eachValues\n : this._initialValue);\n};\n\nReductionPromiseArray.prototype.shouldCopyValues = function () {\n return false;\n};\n\nReductionPromiseArray.prototype._resolve = function(value) {\n this._promise._resolveCallback(value);\n this._values = null;\n};\n\nReductionPromiseArray.prototype._resultCancelled = function(sender) {\n if (sender === this._initialValue) return this._cancel();\n if (this._isResolved()) return;\n this._resultCancelled$();\n if (this._currentCancellable instanceof Promise) {\n this._currentCancellable.cancel();\n }\n if (this._initialValue instanceof Promise) {\n this._initialValue.cancel();\n }\n};\n\nReductionPromiseArray.prototype._iterate = function (values) {\n this._values = values;\n var value;\n var i;\n var length = values.length;\n if (this._initialValue !== undefined) {\n value = this._initialValue;\n i = 0;\n } else {\n value = Promise.resolve(values[0]);\n i = 1;\n }\n\n this._currentCancellable = value;\n\n if (!value.isRejected()) {\n for (; i < length; ++i) {\n var ctx = {\n accum: null,\n value: values[i],\n index: i,\n length: length,\n array: this\n };\n value = value._then(gotAccum, undefined, undefined, ctx, undefined);\n }\n }\n\n if (this._eachValues !== undefined) {\n value = value\n ._then(this._eachComplete, undefined, undefined, this, undefined);\n }\n value._then(completed, completed, undefined, value, this);\n};\n\nPromise.prototype.reduce = function (fn, initialValue) {\n return reduce(this, fn, initialValue, null);\n};\n\nPromise.reduce = function (promises, fn, initialValue, _each) {\n return reduce(promises, fn, initialValue, _each);\n};\n\nfunction completed(valueOrReason, array) {\n if (this.isFulfilled()) {\n array._resolve(valueOrReason);\n } else {\n array._reject(valueOrReason);\n }\n}\n\nfunction reduce(promises, fn, initialValue, _each) {\n if (typeof fn !== \"function\") {\n return apiRejection(\"expecting a function but got \" + util.classString(fn));\n }\n var array = new ReductionPromiseArray(promises, fn, initialValue, _each);\n return array.promise();\n}\n\nfunction gotAccum(accum) {\n this.accum = accum;\n this.array._gotAccum(accum);\n var value = tryConvertToPromise(this.value, this.array._promise);\n if (value instanceof Promise) {\n this.array._currentCancellable = value;\n return value._then(gotValue, undefined, undefined, this, undefined);\n } else {\n return gotValue.call(this, value);\n }\n}\n\nfunction gotValue(value) {\n var array = this.array;\n var promise = array._promise;\n var fn = tryCatch(array._fn);\n promise._pushContext();\n var ret;\n if (array._eachValues !== undefined) {\n ret = fn.call(promise._boundValue(), value, this.index, this.length);\n } else {\n ret = fn.call(promise._boundValue(),\n this.accum, value, this.index, this.length);\n }\n if (ret instanceof Promise) {\n array._currentCancellable = ret;\n }\n var promiseCreated = promise._popContext();\n debug.checkForgottenReturns(\n ret,\n promiseCreated,\n array._eachValues !== undefined ? \"Promise.each\" : \"Promise.reduce\",\n promise\n );\n return ret;\n}\n};\n\n},{\"./util\":36}],29:[function(_dereq_,module,exports){\n\"use strict\";\nvar util = _dereq_(\"./util\");\nvar schedule;\nvar noAsyncScheduler = function() {\n throw new Error(\"No async scheduler available\\u000a\\u000a See http://goo.gl/MqrFmX\\u000a\");\n};\nvar NativePromise = util.getNativePromise();\nif (util.isNode && typeof MutationObserver === \"undefined\") {\n var GlobalSetImmediate = global.setImmediate;\n var ProcessNextTick = process.nextTick;\n schedule = util.isRecentNode\n ? function(fn) { GlobalSetImmediate.call(global, fn); }\n : function(fn) { ProcessNextTick.call(process, fn); };\n} else if (typeof NativePromise === \"function\" &&\n typeof NativePromise.resolve === \"function\") {\n var nativePromise = NativePromise.resolve();\n schedule = function(fn) {\n nativePromise.then(fn);\n };\n} else if ((typeof MutationObserver !== \"undefined\") &&\n !(typeof window !== \"undefined\" &&\n window.navigator &&\n (window.navigator.standalone || window.cordova))) {\n schedule = (function() {\n var div = document.createElement(\"div\");\n var opts = {attributes: true};\n var toggleScheduled = false;\n var div2 = document.createElement(\"div\");\n var o2 = new MutationObserver(function() {\n div.classList.toggle(\"foo\");\n toggleScheduled = false;\n });\n o2.observe(div2, opts);\n\n var scheduleToggle = function() {\n if (toggleScheduled) return;\n toggleScheduled = true;\n div2.classList.toggle(\"foo\");\n };\n\n return function schedule(fn) {\n var o = new MutationObserver(function() {\n o.disconnect();\n fn();\n });\n o.observe(div, opts);\n scheduleToggle();\n };\n })();\n} else if (typeof setImmediate !== \"undefined\") {\n schedule = function (fn) {\n setImmediate(fn);\n };\n} else if (typeof setTimeout !== \"undefined\") {\n schedule = function (fn) {\n setTimeout(fn, 0);\n };\n} else {\n schedule = noAsyncScheduler;\n}\nmodule.exports = schedule;\n\n},{\"./util\":36}],30:[function(_dereq_,module,exports){\n\"use strict\";\nmodule.exports =\n function(Promise, PromiseArray, debug) {\nvar PromiseInspection = Promise.PromiseInspection;\nvar util = _dereq_(\"./util\");\n\nfunction SettledPromiseArray(values) {\n this.constructor$(values);\n}\nutil.inherits(SettledPromiseArray, PromiseArray);\n\nSettledPromiseArray.prototype._promiseResolved = function (index, inspection) {\n this._values[index] = inspection;\n var totalResolved = ++this._totalResolved;\n if (totalResolved >= this._length) {\n this._resolve(this._values);\n return true;\n }\n return false;\n};\n\nSettledPromiseArray.prototype._promiseFulfilled = function (value, index) {\n var ret = new PromiseInspection();\n ret._bitField = 33554432;\n ret._settledValueField = value;\n return this._promiseResolved(index, ret);\n};\nSettledPromiseArray.prototype._promiseRejected = function (reason, index) {\n var ret = new PromiseInspection();\n ret._bitField = 16777216;\n ret._settledValueField = reason;\n return this._promiseResolved(index, ret);\n};\n\nPromise.settle = function (promises) {\n debug.deprecated(\".settle()\", \".reflect()\");\n return new SettledPromiseArray(promises).promise();\n};\n\nPromise.prototype.settle = function () {\n return Promise.settle(this);\n};\n};\n\n},{\"./util\":36}],31:[function(_dereq_,module,exports){\n\"use strict\";\nmodule.exports =\nfunction(Promise, PromiseArray, apiRejection) {\nvar util = _dereq_(\"./util\");\nvar RangeError = _dereq_(\"./errors\").RangeError;\nvar AggregateError = _dereq_(\"./errors\").AggregateError;\nvar isArray = util.isArray;\nvar CANCELLATION = {};\n\n\nfunction SomePromiseArray(values) {\n this.constructor$(values);\n this._howMany = 0;\n this._unwrap = false;\n this._initialized = false;\n}\nutil.inherits(SomePromiseArray, PromiseArray);\n\nSomePromiseArray.prototype._init = function () {\n if (!this._initialized) {\n return;\n }\n if (this._howMany === 0) {\n this._resolve([]);\n return;\n }\n this._init$(undefined, -5);\n var isArrayResolved = isArray(this._values);\n if (!this._isResolved() &&\n isArrayResolved &&\n this._howMany > this._canPossiblyFulfill()) {\n this._reject(this._getRangeError(this.length()));\n }\n};\n\nSomePromiseArray.prototype.init = function () {\n this._initialized = true;\n this._init();\n};\n\nSomePromiseArray.prototype.setUnwrap = function () {\n this._unwrap = true;\n};\n\nSomePromiseArray.prototype.howMany = function () {\n return this._howMany;\n};\n\nSomePromiseArray.prototype.setHowMany = function (count) {\n this._howMany = count;\n};\n\nSomePromiseArray.prototype._promiseFulfilled = function (value) {\n this._addFulfilled(value);\n if (this._fulfilled() === this.howMany()) {\n this._values.length = this.howMany();\n if (this.howMany() === 1 && this._unwrap) {\n this._resolve(this._values[0]);\n } else {\n this._resolve(this._values);\n }\n return true;\n }\n return false;\n\n};\nSomePromiseArray.prototype._promiseRejected = function (reason) {\n this._addRejected(reason);\n return this._checkOutcome();\n};\n\nSomePromiseArray.prototype._promiseCancelled = function () {\n if (this._values instanceof Promise || this._values == null) {\n return this._cancel();\n }\n this._addRejected(CANCELLATION);\n return this._checkOutcome();\n};\n\nSomePromiseArray.prototype._checkOutcome = function() {\n if (this.howMany() > this._canPossiblyFulfill()) {\n var e = new AggregateError();\n for (var i = this.length(); i < this._values.length; ++i) {\n if (this._values[i] !== CANCELLATION) {\n e.push(this._values[i]);\n }\n }\n if (e.length > 0) {\n this._reject(e);\n } else {\n this._cancel();\n }\n return true;\n }\n return false;\n};\n\nSomePromiseArray.prototype._fulfilled = function () {\n return this._totalResolved;\n};\n\nSomePromiseArray.prototype._rejected = function () {\n return this._values.length - this.length();\n};\n\nSomePromiseArray.prototype._addRejected = function (reason) {\n this._values.push(reason);\n};\n\nSomePromiseArray.prototype._addFulfilled = function (value) {\n this._values[this._totalResolved++] = value;\n};\n\nSomePromiseArray.prototype._canPossiblyFulfill = function () {\n return this.length() - this._rejected();\n};\n\nSomePromiseArray.prototype._getRangeError = function (count) {\n var message = \"Input array must contain at least \" +\n this._howMany + \" items but contains only \" + count + \" items\";\n return new RangeError(message);\n};\n\nSomePromiseArray.prototype._resolveEmptyArray = function () {\n this._reject(this._getRangeError(0));\n};\n\nfunction some(promises, howMany) {\n if ((howMany | 0) !== howMany || howMany < 0) {\n return apiRejection(\"expecting a positive integer\\u000a\\u000a See http://goo.gl/MqrFmX\\u000a\");\n }\n var ret = new SomePromiseArray(promises);\n var promise = ret.promise();\n ret.setHowMany(howMany);\n ret.init();\n return promise;\n}\n\nPromise.some = function (promises, howMany) {\n return some(promises, howMany);\n};\n\nPromise.prototype.some = function (howMany) {\n return some(this, howMany);\n};\n\nPromise._SomePromiseArray = SomePromiseArray;\n};\n\n},{\"./errors\":12,\"./util\":36}],32:[function(_dereq_,module,exports){\n\"use strict\";\nmodule.exports = function(Promise) {\nfunction PromiseInspection(promise) {\n if (promise !== undefined) {\n promise = promise._target();\n this._bitField = promise._bitField;\n this._settledValueField = promise._isFateSealed()\n ? promise._settledValue() : undefined;\n }\n else {\n this._bitField = 0;\n this._settledValueField = undefined;\n }\n}\n\nPromiseInspection.prototype._settledValue = function() {\n return this._settledValueField;\n};\n\nvar value = PromiseInspection.prototype.value = function () {\n if (!this.isFulfilled()) {\n throw new TypeError(\"cannot get fulfillment value of a non-fulfilled promise\\u000a\\u000a See http://goo.gl/MqrFmX\\u000a\");\n }\n return this._settledValue();\n};\n\nvar reason = PromiseInspection.prototype.error =\nPromiseInspection.prototype.reason = function () {\n if (!this.isRejected()) {\n throw new TypeError(\"cannot get rejection reason of a non-rejected promise\\u000a\\u000a See http://goo.gl/MqrFmX\\u000a\");\n }\n return this._settledValue();\n};\n\nvar isFulfilled = PromiseInspection.prototype.isFulfilled = function() {\n return (this._bitField & 33554432) !== 0;\n};\n\nvar isRejected = PromiseInspection.prototype.isRejected = function () {\n return (this._bitField & 16777216) !== 0;\n};\n\nvar isPending = PromiseInspection.prototype.isPending = function () {\n return (this._bitField & 50397184) === 0;\n};\n\nvar isResolved = PromiseInspection.prototype.isResolved = function () {\n return (this._bitField & 50331648) !== 0;\n};\n\nPromiseInspection.prototype.isCancelled = function() {\n return (this._bitField & 8454144) !== 0;\n};\n\nPromise.prototype.__isCancelled = function() {\n return (this._bitField & 65536) === 65536;\n};\n\nPromise.prototype._isCancelled = function() {\n return this._target().__isCancelled();\n};\n\nPromise.prototype.isCancelled = function() {\n return (this._target()._bitField & 8454144) !== 0;\n};\n\nPromise.prototype.isPending = function() {\n return isPending.call(this._target());\n};\n\nPromise.prototype.isRejected = function() {\n return isRejected.call(this._target());\n};\n\nPromise.prototype.isFulfilled = function() {\n return isFulfilled.call(this._target());\n};\n\nPromise.prototype.isResolved = function() {\n return isResolved.call(this._target());\n};\n\nPromise.prototype.value = function() {\n return value.call(this._target());\n};\n\nPromise.prototype.reason = function() {\n var target = this._target();\n target._unsetRejectionIsUnhandled();\n return reason.call(target);\n};\n\nPromise.prototype._value = function() {\n return this._settledValue();\n};\n\nPromise.prototype._reason = function() {\n this._unsetRejectionIsUnhandled();\n return this._settledValue();\n};\n\nPromise.PromiseInspection = PromiseInspection;\n};\n\n},{}],33:[function(_dereq_,module,exports){\n\"use strict\";\nmodule.exports = function(Promise, INTERNAL) {\nvar util = _dereq_(\"./util\");\nvar errorObj = util.errorObj;\nvar isObject = util.isObject;\n\nfunction tryConvertToPromise(obj, context) {\n if (isObject(obj)) {\n if (obj instanceof Promise) return obj;\n var then = getThen(obj);\n if (then === errorObj) {\n if (context) context._pushContext();\n var ret = Promise.reject(then.e);\n if (context) context._popContext();\n return ret;\n } else if (typeof then === \"function\") {\n if (isAnyBluebirdPromise(obj)) {\n var ret = new Promise(INTERNAL);\n obj._then(\n ret._fulfill,\n ret._reject,\n undefined,\n ret,\n null\n );\n return ret;\n }\n return doThenable(obj, then, context);\n }\n }\n return obj;\n}\n\nfunction doGetThen(obj) {\n return obj.then;\n}\n\nfunction getThen(obj) {\n try {\n return doGetThen(obj);\n } catch (e) {\n errorObj.e = e;\n return errorObj;\n }\n}\n\nvar hasProp = {}.hasOwnProperty;\nfunction isAnyBluebirdPromise(obj) {\n try {\n return hasProp.call(obj, \"_promise0\");\n } catch (e) {\n return false;\n }\n}\n\nfunction doThenable(x, then, context) {\n var promise = new Promise(INTERNAL);\n var ret = promise;\n if (context) context._pushContext();\n promise._captureStackTrace();\n if (context) context._popContext();\n var synchronous = true;\n var result = util.tryCatch(then).call(x, resolve, reject);\n synchronous = false;\n\n if (promise && result === errorObj) {\n promise._rejectCallback(result.e, true, true);\n promise = null;\n }\n\n function resolve(value) {\n if (!promise) return;\n promise._resolveCallback(value);\n promise = null;\n }\n\n function reject(reason) {\n if (!promise) return;\n promise._rejectCallback(reason, synchronous, true);\n promise = null;\n }\n return ret;\n}\n\nreturn tryConvertToPromise;\n};\n\n},{\"./util\":36}],34:[function(_dereq_,module,exports){\n\"use strict\";\nmodule.exports = function(Promise, INTERNAL, debug) {\nvar util = _dereq_(\"./util\");\nvar TimeoutError = Promise.TimeoutError;\n\nfunction HandleWrapper(handle) {\n this.handle = handle;\n}\n\nHandleWrapper.prototype._resultCancelled = function() {\n clearTimeout(this.handle);\n};\n\nvar afterValue = function(value) { return delay(+this).thenReturn(value); };\nvar delay = Promise.delay = function (ms, value) {\n var ret;\n var handle;\n if (value !== undefined) {\n ret = Promise.resolve(value)\n ._then(afterValue, null, null, ms, undefined);\n if (debug.cancellation() && value instanceof Promise) {\n ret._setOnCancel(value);\n }\n } else {\n ret = new Promise(INTERNAL);\n handle = setTimeout(function() { ret._fulfill(); }, +ms);\n if (debug.cancellation()) {\n ret._setOnCancel(new HandleWrapper(handle));\n }\n ret._captureStackTrace();\n }\n ret._setAsyncGuaranteed();\n return ret;\n};\n\nPromise.prototype.delay = function (ms) {\n return delay(ms, this);\n};\n\nvar afterTimeout = function (promise, message, parent) {\n var err;\n if (typeof message !== \"string\") {\n if (message instanceof Error) {\n err = message;\n } else {\n err = new TimeoutError(\"operation timed out\");\n }\n } else {\n err = new TimeoutError(message);\n }\n util.markAsOriginatingFromRejection(err);\n promise._attachExtraTrace(err);\n promise._reject(err);\n\n if (parent != null) {\n parent.cancel();\n }\n};\n\nfunction successClear(value) {\n clearTimeout(this.handle);\n return value;\n}\n\nfunction failureClear(reason) {\n clearTimeout(this.handle);\n throw reason;\n}\n\nPromise.prototype.timeout = function (ms, message) {\n ms = +ms;\n var ret, parent;\n\n var handleWrapper = new HandleWrapper(setTimeout(function timeoutTimeout() {\n if (ret.isPending()) {\n afterTimeout(ret, message, parent);\n }\n }, ms));\n\n if (debug.cancellation()) {\n parent = this.then();\n ret = parent._then(successClear, failureClear,\n undefined, handleWrapper, undefined);\n ret._setOnCancel(handleWrapper);\n } else {\n ret = this._then(successClear, failureClear,\n undefined, handleWrapper, undefined);\n }\n\n return ret;\n};\n\n};\n\n},{\"./util\":36}],35:[function(_dereq_,module,exports){\n\"use strict\";\nmodule.exports = function (Promise, apiRejection, tryConvertToPromise,\n createContext, INTERNAL, debug) {\n var util = _dereq_(\"./util\");\n var TypeError = _dereq_(\"./errors\").TypeError;\n var inherits = _dereq_(\"./util\").inherits;\n var errorObj = util.errorObj;\n var tryCatch = util.tryCatch;\n var NULL = {};\n\n function thrower(e) {\n setTimeout(function(){throw e;}, 0);\n }\n\n function castPreservingDisposable(thenable) {\n var maybePromise = tryConvertToPromise(thenable);\n if (maybePromise !== thenable &&\n typeof thenable._isDisposable === \"function\" &&\n typeof thenable._getDisposer === \"function\" &&\n thenable._isDisposable()) {\n maybePromise._setDisposable(thenable._getDisposer());\n }\n return maybePromise;\n }\n function dispose(resources, inspection) {\n var i = 0;\n var len = resources.length;\n var ret = new Promise(INTERNAL);\n function iterator() {\n if (i >= len) return ret._fulfill();\n var maybePromise = castPreservingDisposable(resources[i++]);\n if (maybePromise instanceof Promise &&\n maybePromise._isDisposable()) {\n try {\n maybePromise = tryConvertToPromise(\n maybePromise._getDisposer().tryDispose(inspection),\n resources.promise);\n } catch (e) {\n return thrower(e);\n }\n if (maybePromise instanceof Promise) {\n return maybePromise._then(iterator, thrower,\n null, null, null);\n }\n }\n iterator();\n }\n iterator();\n return ret;\n }\n\n function Disposer(data, promise, context) {\n this._data = data;\n this._promise = promise;\n this._context = context;\n }\n\n Disposer.prototype.data = function () {\n return this._data;\n };\n\n Disposer.prototype.promise = function () {\n return this._promise;\n };\n\n Disposer.prototype.resource = function () {\n if (this.promise().isFulfilled()) {\n return this.promise().value();\n }\n return NULL;\n };\n\n Disposer.prototype.tryDispose = function(inspection) {\n var resource = this.resource();\n var context = this._context;\n if (context !== undefined) context._pushContext();\n var ret = resource !== NULL\n ? this.doDispose(resource, inspection) : null;\n if (context !== undefined) context._popContext();\n this._promise._unsetDisposable();\n this._data = null;\n return ret;\n };\n\n Disposer.isDisposer = function (d) {\n return (d != null &&\n typeof d.resource === \"function\" &&\n typeof d.tryDispose === \"function\");\n };\n\n function FunctionDisposer(fn, promise, context) {\n this.constructor$(fn, promise, context);\n }\n inherits(FunctionDisposer, Disposer);\n\n FunctionDisposer.prototype.doDispose = function (resource, inspection) {\n var fn = this.data();\n return fn.call(resource, resource, inspection);\n };\n\n function maybeUnwrapDisposer(value) {\n if (Disposer.isDisposer(value)) {\n this.resources[this.index]._setDisposable(value);\n return value.promise();\n }\n return value;\n }\n\n function ResourceList(length) {\n this.length = length;\n this.promise = null;\n this[length-1] = null;\n }\n\n ResourceList.prototype._resultCancelled = function() {\n var len = this.length;\n for (var i = 0; i < len; ++i) {\n var item = this[i];\n if (item instanceof Promise) {\n item.cancel();\n }\n }\n };\n\n Promise.using = function () {\n var len = arguments.length;\n if (len < 2) return apiRejection(\n \"you must pass at least 2 arguments to Promise.using\");\n var fn = arguments[len - 1];\n if (typeof fn !== \"function\") {\n return apiRejection(\"expecting a function but got \" + util.classString(fn));\n }\n var input;\n var spreadArgs = true;\n if (len === 2 && Array.isArray(arguments[0])) {\n input = arguments[0];\n len = input.length;\n spreadArgs = false;\n } else {\n input = arguments;\n len--;\n }\n var resources = new ResourceList(len);\n for (var i = 0; i < len; ++i) {\n var resource = input[i];\n if (Disposer.isDisposer(resource)) {\n var disposer = resource;\n resource = resource.promise();\n resource._setDisposable(disposer);\n } else {\n var maybePromise = tryConvertToPromise(resource);\n if (maybePromise instanceof Promise) {\n resource =\n maybePromise._then(maybeUnwrapDisposer, null, null, {\n resources: resources,\n index: i\n }, undefined);\n }\n }\n resources[i] = resource;\n }\n\n var reflectedResources = new Array(resources.length);\n for (var i = 0; i < reflectedResources.length; ++i) {\n reflectedResources[i] = Promise.resolve(resources[i]).reflect();\n }\n\n var resultPromise = Promise.all(reflectedResources)\n .then(function(inspections) {\n for (var i = 0; i < inspections.length; ++i) {\n var inspection = inspections[i];\n if (inspection.isRejected()) {\n errorObj.e = inspection.error();\n return errorObj;\n } else if (!inspection.isFulfilled()) {\n resultPromise.cancel();\n return;\n }\n inspections[i] = inspection.value();\n }\n promise._pushContext();\n\n fn = tryCatch(fn);\n var ret = spreadArgs\n ? fn.apply(undefined, inspections) : fn(inspections);\n var promiseCreated = promise._popContext();\n debug.checkForgottenReturns(\n ret, promiseCreated, \"Promise.using\", promise);\n return ret;\n });\n\n var promise = resultPromise.lastly(function() {\n var inspection = new Promise.PromiseInspection(resultPromise);\n return dispose(resources, inspection);\n });\n resources.promise = promise;\n promise._setOnCancel(resources);\n return promise;\n };\n\n Promise.prototype._setDisposable = function (disposer) {\n this._bitField = this._bitField | 131072;\n this._disposer = disposer;\n };\n\n Promise.prototype._isDisposable = function () {\n return (this._bitField & 131072) > 0;\n };\n\n Promise.prototype._getDisposer = function () {\n return this._disposer;\n };\n\n Promise.prototype._unsetDisposable = function () {\n this._bitField = this._bitField & (~131072);\n this._disposer = undefined;\n };\n\n Promise.prototype.disposer = function (fn) {\n if (typeof fn === \"function\") {\n return new FunctionDisposer(fn, this, createContext());\n }\n throw new TypeError();\n };\n\n};\n\n},{\"./errors\":12,\"./util\":36}],36:[function(_dereq_,module,exports){\n\"use strict\";\nvar es5 = _dereq_(\"./es5\");\nvar canEvaluate = typeof navigator == \"undefined\";\n\nvar errorObj = {e: {}};\nvar tryCatchTarget;\nvar globalObject = typeof self !== \"undefined\" ? self :\n typeof window !== \"undefined\" ? window :\n typeof global !== \"undefined\" ? global :\n this !== undefined ? this : null;\n\nfunction tryCatcher() {\n try {\n var target = tryCatchTarget;\n tryCatchTarget = null;\n return target.apply(this, arguments);\n } catch (e) {\n errorObj.e = e;\n return errorObj;\n }\n}\nfunction tryCatch(fn) {\n tryCatchTarget = fn;\n return tryCatcher;\n}\n\nvar inherits = function(Child, Parent) {\n var hasProp = {}.hasOwnProperty;\n\n function T() {\n this.constructor = Child;\n this.constructor$ = Parent;\n for (var propertyName in Parent.prototype) {\n if (hasProp.call(Parent.prototype, propertyName) &&\n propertyName.charAt(propertyName.length-1) !== \"$\"\n ) {\n this[propertyName + \"$\"] = Parent.prototype[propertyName];\n }\n }\n }\n T.prototype = Parent.prototype;\n Child.prototype = new T();\n return Child.prototype;\n};\n\n\nfunction isPrimitive(val) {\n return val == null || val === true || val === false ||\n typeof val === \"string\" || typeof val === \"number\";\n\n}\n\nfunction isObject(value) {\n return typeof value === \"function\" ||\n typeof value === \"object\" && value !== null;\n}\n\nfunction maybeWrapAsError(maybeError) {\n if (!isPrimitive(maybeError)) return maybeError;\n\n return new Error(safeToString(maybeError));\n}\n\nfunction withAppended(target, appendee) {\n var len = target.length;\n var ret = new Array(len + 1);\n var i;\n for (i = 0; i < len; ++i) {\n ret[i] = target[i];\n }\n ret[i] = appendee;\n return ret;\n}\n\nfunction getDataPropertyOrDefault(obj, key, defaultValue) {\n if (es5.isES5) {\n var desc = Object.getOwnPropertyDescriptor(obj, key);\n\n if (desc != null) {\n return desc.get == null && desc.set == null\n ? desc.value\n : defaultValue;\n }\n } else {\n return {}.hasOwnProperty.call(obj, key) ? obj[key] : undefined;\n }\n}\n\nfunction notEnumerableProp(obj, name, value) {\n if (isPrimitive(obj)) return obj;\n var descriptor = {\n value: value,\n configurable: true,\n enumerable: false,\n writable: true\n };\n es5.defineProperty(obj, name, descriptor);\n return obj;\n}\n\nfunction thrower(r) {\n throw r;\n}\n\nvar inheritedDataKeys = (function() {\n var excludedPrototypes = [\n Array.prototype,\n Object.prototype,\n Function.prototype\n ];\n\n var isExcludedProto = function(val) {\n for (var i = 0; i < excludedPrototypes.length; ++i) {\n if (excludedPrototypes[i] === val) {\n return true;\n }\n }\n return false;\n };\n\n if (es5.isES5) {\n var getKeys = Object.getOwnPropertyNames;\n return function(obj) {\n var ret = [];\n var visitedKeys = Object.create(null);\n while (obj != null && !isExcludedProto(obj)) {\n var keys;\n try {\n keys = getKeys(obj);\n } catch (e) {\n return ret;\n }\n for (var i = 0; i < keys.length; ++i) {\n var key = keys[i];\n if (visitedKeys[key]) continue;\n visitedKeys[key] = true;\n var desc = Object.getOwnPropertyDescriptor(obj, key);\n if (desc != null && desc.get == null && desc.set == null) {\n ret.push(key);\n }\n }\n obj = es5.getPrototypeOf(obj);\n }\n return ret;\n };\n } else {\n var hasProp = {}.hasOwnProperty;\n return function(obj) {\n if (isExcludedProto(obj)) return [];\n var ret = [];\n\n /*jshint forin:false */\n enumeration: for (var key in obj) {\n if (hasProp.call(obj, key)) {\n ret.push(key);\n } else {\n for (var i = 0; i < excludedPrototypes.length; ++i) {\n if (hasProp.call(excludedPrototypes[i], key)) {\n continue enumeration;\n }\n }\n ret.push(key);\n }\n }\n return ret;\n };\n }\n\n})();\n\nvar thisAssignmentPattern = /this\\s*\\.\\s*\\S+\\s*=/;\nfunction isClass(fn) {\n try {\n if (typeof fn === \"function\") {\n var keys = es5.names(fn.prototype);\n\n var hasMethods = es5.isES5 && keys.length > 1;\n var hasMethodsOtherThanConstructor = keys.length > 0 &&\n !(keys.length === 1 && keys[0] === \"constructor\");\n var hasThisAssignmentAndStaticMethods =\n thisAssignmentPattern.test(fn + \"\") && es5.names(fn).length > 0;\n\n if (hasMethods || hasMethodsOtherThanConstructor ||\n hasThisAssignmentAndStaticMethods) {\n return true;\n }\n }\n return false;\n } catch (e) {\n return false;\n }\n}\n\nfunction toFastProperties(obj) {\n /*jshint -W027,-W055,-W031*/\n function FakeConstructor() {}\n FakeConstructor.prototype = obj;\n var l = 8;\n while (l--) new FakeConstructor();\n return obj;\n eval(obj);\n}\n\nvar rident = /^[a-z$_][a-z$_0-9]*$/i;\nfunction isIdentifier(str) {\n return rident.test(str);\n}\n\nfunction filledRange(count, prefix, suffix) {\n var ret = new Array(count);\n for(var i = 0; i < count; ++i) {\n ret[i] = prefix + i + suffix;\n }\n return ret;\n}\n\nfunction safeToString(obj) {\n try {\n return obj + \"\";\n } catch (e) {\n return \"[no string representation]\";\n }\n}\n\nfunction isError(obj) {\n return obj instanceof Error ||\n (obj !== null &&\n typeof obj === \"object\" &&\n typeof obj.message === \"string\" &&\n typeof obj.name === \"string\");\n}\n\nfunction markAsOriginatingFromRejection(e) {\n try {\n notEnumerableProp(e, \"isOperational\", true);\n }\n catch(ignore) {}\n}\n\nfunction originatesFromRejection(e) {\n if (e == null) return false;\n return ((e instanceof Error[\"__BluebirdErrorTypes__\"].OperationalError) ||\n e[\"isOperational\"] === true);\n}\n\nfunction canAttachTrace(obj) {\n return isError(obj) && es5.propertyIsWritable(obj, \"stack\");\n}\n\nvar ensureErrorObject = (function() {\n if (!(\"stack\" in new Error())) {\n return function(value) {\n if (canAttachTrace(value)) return value;\n try {throw new Error(safeToString(value));}\n catch(err) {return err;}\n };\n } else {\n return function(value) {\n if (canAttachTrace(value)) return value;\n return new Error(safeToString(value));\n };\n }\n})();\n\nfunction classString(obj) {\n return {}.toString.call(obj);\n}\n\nfunction copyDescriptors(from, to, filter) {\n var keys = es5.names(from);\n for (var i = 0; i < keys.length; ++i) {\n var key = keys[i];\n if (filter(key)) {\n try {\n es5.defineProperty(to, key, es5.getDescriptor(from, key));\n } catch (ignore) {}\n }\n }\n}\n\nvar asArray = function(v) {\n if (es5.isArray(v)) {\n return v;\n }\n return null;\n};\n\nif (typeof Symbol !== \"undefined\" && Symbol.iterator) {\n var ArrayFrom = typeof Array.from === \"function\" ? function(v) {\n return Array.from(v);\n } : function(v) {\n var ret = [];\n var it = v[Symbol.iterator]();\n var itResult;\n while (!((itResult = it.next()).done)) {\n ret.push(itResult.value);\n }\n return ret;\n };\n\n asArray = function(v) {\n if (es5.isArray(v)) {\n return v;\n } else if (v != null && typeof v[Symbol.iterator] === \"function\") {\n return ArrayFrom(v);\n }\n return null;\n };\n}\n\nvar isNode = typeof process !== \"undefined\" &&\n classString(process).toLowerCase() === \"[object process]\";\n\nvar hasEnvVariables = typeof process !== \"undefined\" &&\n typeof process.env !== \"undefined\";\n\nfunction env(key) {\n return hasEnvVariables ? process.env[key] : undefined;\n}\n\nfunction getNativePromise() {\n if (typeof Promise === \"function\") {\n try {\n var promise = new Promise(function(){});\n if ({}.toString.call(promise) === \"[object Promise]\") {\n return Promise;\n }\n } catch (e) {}\n }\n}\n\nfunction domainBind(self, cb) {\n return self.bind(cb);\n}\n\nvar ret = {\n isClass: isClass,\n isIdentifier: isIdentifier,\n inheritedDataKeys: inheritedDataKeys,\n getDataPropertyOrDefault: getDataPropertyOrDefault,\n thrower: thrower,\n isArray: es5.isArray,\n asArray: asArray,\n notEnumerableProp: notEnumerableProp,\n isPrimitive: isPrimitive,\n isObject: isObject,\n isError: isError,\n canEvaluate: canEvaluate,\n errorObj: errorObj,\n tryCatch: tryCatch,\n inherits: inherits,\n withAppended: withAppended,\n maybeWrapAsError: maybeWrapAsError,\n toFastProperties: toFastProperties,\n filledRange: filledRange,\n toString: safeToString,\n canAttachTrace: canAttachTrace,\n ensureErrorObject: ensureErrorObject,\n originatesFromRejection: originatesFromRejection,\n markAsOriginatingFromRejection: markAsOriginatingFromRejection,\n classString: classString,\n copyDescriptors: copyDescriptors,\n hasDevTools: typeof chrome !== \"undefined\" && chrome &&\n typeof chrome.loadTimes === \"function\",\n isNode: isNode,\n hasEnvVariables: hasEnvVariables,\n env: env,\n global: globalObject,\n getNativePromise: getNativePromise,\n domainBind: domainBind\n};\nret.isRecentNode = ret.isNode && (function() {\n var version = process.versions.node.split(\".\").map(Number);\n return (version[0] === 0 && version[1] > 10) || (version[0] > 0);\n})();\n\nif (ret.isNode) ret.toFastProperties(process);\n\ntry {throw new Error(); } catch (e) {ret.lastLineError = e;}\nmodule.exports = ret;\n\n},{\"./es5\":13}]},{},[4])(4)\n}); ;if (typeof window !== 'undefined' && window !== null) { window.P = window.Promise; } else if (typeof self !== 'undefined' && self !== null) { self.P = self.Promise; }","/* globals __webpack_amd_options__ */\r\nmodule.exports = __webpack_amd_options__;\r\n","'use strict';\nvar readerFor = require('./reader/readerFor');\nvar utils = require('./utils');\nvar CompressedObject = require('./compressedObject');\nvar crc32fn = require('./crc32');\nvar utf8 = require('./utf8');\nvar compressions = require('./compressions');\nvar support = require('./support');\n\nvar MADE_BY_DOS = 0x00;\nvar MADE_BY_UNIX = 0x03;\n\n/**\n * Find a compression registered in JSZip.\n * @param {string} compressionMethod the method magic to find.\n * @return {Object|null} the JSZip compression object, null if none found.\n */\nvar findCompression = function(compressionMethod) {\n for (var method in compressions) {\n if (!compressions.hasOwnProperty(method)) {\n continue;\n }\n if (compressions[method].magic === compressionMethod) {\n return compressions[method];\n }\n }\n return null;\n};\n\n// class ZipEntry {{{\n/**\n * An entry in the zip file.\n * @constructor\n * @param {Object} options Options of the current file.\n * @param {Object} loadOptions Options for loading the stream.\n */\nfunction ZipEntry(options, loadOptions) {\n this.options = options;\n this.loadOptions = loadOptions;\n}\nZipEntry.prototype = {\n /**\n * say if the file is encrypted.\n * @return {boolean} true if the file is encrypted, false otherwise.\n */\n isEncrypted: function() {\n // bit 1 is set\n return (this.bitFlag & 0x0001) === 0x0001;\n },\n /**\n * say if the file has utf-8 filename/comment.\n * @return {boolean} true if the filename/comment is in utf-8, false otherwise.\n */\n useUTF8: function() {\n // bit 11 is set\n return (this.bitFlag & 0x0800) === 0x0800;\n },\n /**\n * Read the local part of a zip file and add the info in this object.\n * @param {DataReader} reader the reader to use.\n */\n readLocalPart: function(reader) {\n var compression, localExtraFieldsLength;\n\n // we already know everything from the central dir !\n // If the central dir data are false, we are doomed.\n // On the bright side, the local part is scary : zip64, data descriptors, both, etc.\n // The less data we get here, the more reliable this should be.\n // Let's skip the whole header and dash to the data !\n reader.skip(22);\n // in some zip created on windows, the filename stored in the central dir contains \\ instead of /.\n // Strangely, the filename here is OK.\n // I would love to treat these zip files as corrupted (see http://www.info-zip.org/FAQ.html#backslashes\n // or APPNOTE#4.4.17.1, \"All slashes MUST be forward slashes '/'\") but there are a lot of bad zip generators...\n // Search \"unzip mismatching \"local\" filename continuing with \"central\" filename version\" on\n // the internet.\n //\n // I think I see the logic here : the central directory is used to display\n // content and the local directory is used to extract the files. Mixing / and \\\n // may be used to display \\ to windows users and use / when extracting the files.\n // Unfortunately, this lead also to some issues : http://seclists.org/fulldisclosure/2009/Sep/394\n this.fileNameLength = reader.readInt(2);\n localExtraFieldsLength = reader.readInt(2); // can't be sure this will be the same as the central dir\n // the fileName is stored as binary data, the handleUTF8 method will take care of the encoding.\n this.fileName = reader.readData(this.fileNameLength);\n reader.skip(localExtraFieldsLength);\n\n if (this.compressedSize === -1 || this.uncompressedSize === -1) {\n throw new Error(\"Bug or corrupted zip : didn't get enough informations from the central directory \" + \"(compressedSize === -1 || uncompressedSize === -1)\");\n }\n\n compression = findCompression(this.compressionMethod);\n if (compression === null) { // no compression found\n throw new Error(\"Corrupted zip : compression \" + utils.pretty(this.compressionMethod) + \" unknown (inner file : \" + utils.transformTo(\"string\", this.fileName) + \")\");\n }\n this.decompressed = new CompressedObject(this.compressedSize, this.uncompressedSize, this.crc32, compression, reader.readData(this.compressedSize));\n },\n\n /**\n * Read the central part of a zip file and add the info in this object.\n * @param {DataReader} reader the reader to use.\n */\n readCentralPart: function(reader) {\n this.versionMadeBy = reader.readInt(2);\n reader.skip(2);\n // this.versionNeeded = reader.readInt(2);\n this.bitFlag = reader.readInt(2);\n this.compressionMethod = reader.readString(2);\n this.date = reader.readDate();\n this.crc32 = reader.readInt(4);\n this.compressedSize = reader.readInt(4);\n this.uncompressedSize = reader.readInt(4);\n var fileNameLength = reader.readInt(2);\n this.extraFieldsLength = reader.readInt(2);\n this.fileCommentLength = reader.readInt(2);\n this.diskNumberStart = reader.readInt(2);\n this.internalFileAttributes = reader.readInt(2);\n this.externalFileAttributes = reader.readInt(4);\n this.localHeaderOffset = reader.readInt(4);\n\n if (this.isEncrypted()) {\n throw new Error(\"Encrypted zip are not supported\");\n }\n\n // will be read in the local part, see the comments there\n reader.skip(fileNameLength);\n this.readExtraFields(reader);\n this.parseZIP64ExtraField(reader);\n this.fileComment = reader.readData(this.fileCommentLength);\n },\n\n /**\n * Parse the external file attributes and get the unix/dos permissions.\n */\n processAttributes: function () {\n this.unixPermissions = null;\n this.dosPermissions = null;\n var madeBy = this.versionMadeBy >> 8;\n\n // Check if we have the DOS directory flag set.\n // We look for it in the DOS and UNIX permissions\n // but some unknown platform could set it as a compatibility flag.\n this.dir = this.externalFileAttributes & 0x0010 ? true : false;\n\n if(madeBy === MADE_BY_DOS) {\n // first 6 bits (0 to 5)\n this.dosPermissions = this.externalFileAttributes & 0x3F;\n }\n\n if(madeBy === MADE_BY_UNIX) {\n this.unixPermissions = (this.externalFileAttributes >> 16) & 0xFFFF;\n // the octal permissions are in (this.unixPermissions & 0x01FF).toString(8);\n }\n\n // fail safe : if the name ends with a / it probably means a folder\n if (!this.dir && this.fileNameStr.slice(-1) === '/') {\n this.dir = true;\n }\n },\n\n /**\n * Parse the ZIP64 extra field and merge the info in the current ZipEntry.\n * @param {DataReader} reader the reader to use.\n */\n parseZIP64ExtraField: function(reader) {\n\n if (!this.extraFields[0x0001]) {\n return;\n }\n\n // should be something, preparing the extra reader\n var extraReader = readerFor(this.extraFields[0x0001].value);\n\n // I really hope that these 64bits integer can fit in 32 bits integer, because js\n // won't let us have more.\n if (this.uncompressedSize === utils.MAX_VALUE_32BITS) {\n this.uncompressedSize = extraReader.readInt(8);\n }\n if (this.compressedSize === utils.MAX_VALUE_32BITS) {\n this.compressedSize = extraReader.readInt(8);\n }\n if (this.localHeaderOffset === utils.MAX_VALUE_32BITS) {\n this.localHeaderOffset = extraReader.readInt(8);\n }\n if (this.diskNumberStart === utils.MAX_VALUE_32BITS) {\n this.diskNumberStart = extraReader.readInt(4);\n }\n },\n /**\n * Read the central part of a zip file and add the info in this object.\n * @param {DataReader} reader the reader to use.\n */\n readExtraFields: function(reader) {\n var end = reader.index + this.extraFieldsLength,\n extraFieldId,\n extraFieldLength,\n extraFieldValue;\n\n if (!this.extraFields) {\n this.extraFields = {};\n }\n\n while (reader.index < end) {\n extraFieldId = reader.readInt(2);\n extraFieldLength = reader.readInt(2);\n extraFieldValue = reader.readData(extraFieldLength);\n\n this.extraFields[extraFieldId] = {\n id: extraFieldId,\n length: extraFieldLength,\n value: extraFieldValue\n };\n }\n },\n /**\n * Apply an UTF8 transformation if needed.\n */\n handleUTF8: function() {\n var decodeParamType = support.uint8array ? \"uint8array\" : \"array\";\n if (this.useUTF8()) {\n this.fileNameStr = utf8.utf8decode(this.fileName);\n this.fileCommentStr = utf8.utf8decode(this.fileComment);\n } else {\n var upath = this.findExtraFieldUnicodePath();\n if (upath !== null) {\n this.fileNameStr = upath;\n } else {\n // ASCII text or unsupported code page\n var fileNameByteArray = utils.transformTo(decodeParamType, this.fileName);\n this.fileNameStr = this.loadOptions.decodeFileName(fileNameByteArray);\n }\n\n var ucomment = this.findExtraFieldUnicodeComment();\n if (ucomment !== null) {\n this.fileCommentStr = ucomment;\n } else {\n // ASCII text or unsupported code page\n var commentByteArray = utils.transformTo(decodeParamType, this.fileComment);\n this.fileCommentStr = this.loadOptions.decodeFileName(commentByteArray);\n }\n }\n },\n\n /**\n * Find the unicode path declared in the extra field, if any.\n * @return {String} the unicode path, null otherwise.\n */\n findExtraFieldUnicodePath: function() {\n var upathField = this.extraFields[0x7075];\n if (upathField) {\n var extraReader = readerFor(upathField.value);\n\n // wrong version\n if (extraReader.readInt(1) !== 1) {\n return null;\n }\n\n // the crc of the filename changed, this field is out of date.\n if (crc32fn(this.fileName) !== extraReader.readInt(4)) {\n return null;\n }\n\n return utf8.utf8decode(extraReader.readData(upathField.length - 5));\n }\n return null;\n },\n\n /**\n * Find the unicode comment declared in the extra field, if any.\n * @return {String} the unicode comment, null otherwise.\n */\n findExtraFieldUnicodeComment: function() {\n var ucommentField = this.extraFields[0x6375];\n if (ucommentField) {\n var extraReader = readerFor(ucommentField.value);\n\n // wrong version\n if (extraReader.readInt(1) !== 1) {\n return null;\n }\n\n // the crc of the comment changed, this field is out of date.\n if (crc32fn(this.fileComment) !== extraReader.readInt(4)) {\n return null;\n }\n\n return utf8.utf8decode(extraReader.readData(ucommentField.length - 5));\n }\n return null;\n }\n};\nmodule.exports = ZipEntry;\n","'use strict';\nvar Uint8ArrayReader = require('./Uint8ArrayReader');\nvar utils = require('../utils');\n\nfunction NodeBufferReader(data) {\n Uint8ArrayReader.call(this, data);\n}\nutils.inherits(NodeBufferReader, Uint8ArrayReader);\n\n/**\n * @see DataReader.readData\n */\nNodeBufferReader.prototype.readData = function(size) {\n this.checkOffset(size);\n var result = this.data.slice(this.zero + this.index, this.zero + this.index + size);\n this.index += size;\n return result;\n};\nmodule.exports = NodeBufferReader;\n","'use strict';\nvar DataReader = require('./DataReader');\nvar utils = require('../utils');\n\nfunction StringReader(data) {\n DataReader.call(this, data);\n}\nutils.inherits(StringReader, DataReader);\n/**\n * @see DataReader.byteAt\n */\nStringReader.prototype.byteAt = function(i) {\n return this.data.charCodeAt(this.zero + i);\n};\n/**\n * @see DataReader.lastIndexOfSignature\n */\nStringReader.prototype.lastIndexOfSignature = function(sig) {\n return this.data.lastIndexOf(sig) - this.zero;\n};\n/**\n * @see DataReader.readAndCheckSignature\n */\nStringReader.prototype.readAndCheckSignature = function (sig) {\n var data = this.readData(4);\n return sig === data;\n};\n/**\n * @see DataReader.readData\n */\nStringReader.prototype.readData = function(size) {\n this.checkOffset(size);\n // this will work because the constructor applied the \"& 0xff\" mask.\n var result = this.data.slice(this.zero + this.index, this.zero + this.index + size);\n this.index += size;\n return result;\n};\nmodule.exports = StringReader;\n","'use strict';\nvar readerFor = require('./reader/readerFor');\nvar utils = require('./utils');\nvar sig = require('./signature');\nvar ZipEntry = require('./zipEntry');\nvar utf8 = require('./utf8');\nvar support = require('./support');\n// class ZipEntries {{{\n/**\n * All the entries in the zip file.\n * @constructor\n * @param {Object} loadOptions Options for loading the stream.\n */\nfunction ZipEntries(loadOptions) {\n this.files = [];\n this.loadOptions = loadOptions;\n}\nZipEntries.prototype = {\n /**\n * Check that the reader is on the specified signature.\n * @param {string} expectedSignature the expected signature.\n * @throws {Error} if it is an other signature.\n */\n checkSignature: function(expectedSignature) {\n if (!this.reader.readAndCheckSignature(expectedSignature)) {\n this.reader.index -= 4;\n var signature = this.reader.readString(4);\n throw new Error(\"Corrupted zip or bug: unexpected signature \" + \"(\" + utils.pretty(signature) + \", expected \" + utils.pretty(expectedSignature) + \")\");\n }\n },\n /**\n * Check if the given signature is at the given index.\n * @param {number} askedIndex the index to check.\n * @param {string} expectedSignature the signature to expect.\n * @return {boolean} true if the signature is here, false otherwise.\n */\n isSignature: function(askedIndex, expectedSignature) {\n var currentIndex = this.reader.index;\n this.reader.setIndex(askedIndex);\n var signature = this.reader.readString(4);\n var result = signature === expectedSignature;\n this.reader.setIndex(currentIndex);\n return result;\n },\n /**\n * Read the end of the central directory.\n */\n readBlockEndOfCentral: function() {\n this.diskNumber = this.reader.readInt(2);\n this.diskWithCentralDirStart = this.reader.readInt(2);\n this.centralDirRecordsOnThisDisk = this.reader.readInt(2);\n this.centralDirRecords = this.reader.readInt(2);\n this.centralDirSize = this.reader.readInt(4);\n this.centralDirOffset = this.reader.readInt(4);\n\n this.zipCommentLength = this.reader.readInt(2);\n // warning : the encoding depends of the system locale\n // On a linux machine with LANG=en_US.utf8, this field is utf8 encoded.\n // On a windows machine, this field is encoded with the localized windows code page.\n var zipComment = this.reader.readData(this.zipCommentLength);\n var decodeParamType = support.uint8array ? \"uint8array\" : \"array\";\n // To get consistent behavior with the generation part, we will assume that\n // this is utf8 encoded unless specified otherwise.\n var decodeContent = utils.transformTo(decodeParamType, zipComment);\n this.zipComment = this.loadOptions.decodeFileName(decodeContent);\n },\n /**\n * Read the end of the Zip 64 central directory.\n * Not merged with the method readEndOfCentral :\n * The end of central can coexist with its Zip64 brother,\n * I don't want to read the wrong number of bytes !\n */\n readBlockZip64EndOfCentral: function() {\n this.zip64EndOfCentralSize = this.reader.readInt(8);\n this.reader.skip(4);\n // this.versionMadeBy = this.reader.readString(2);\n // this.versionNeeded = this.reader.readInt(2);\n this.diskNumber = this.reader.readInt(4);\n this.diskWithCentralDirStart = this.reader.readInt(4);\n this.centralDirRecordsOnThisDisk = this.reader.readInt(8);\n this.centralDirRecords = this.reader.readInt(8);\n this.centralDirSize = this.reader.readInt(8);\n this.centralDirOffset = this.reader.readInt(8);\n\n this.zip64ExtensibleData = {};\n var extraDataSize = this.zip64EndOfCentralSize - 44,\n index = 0,\n extraFieldId,\n extraFieldLength,\n extraFieldValue;\n while (index < extraDataSize) {\n extraFieldId = this.reader.readInt(2);\n extraFieldLength = this.reader.readInt(4);\n extraFieldValue = this.reader.readData(extraFieldLength);\n this.zip64ExtensibleData[extraFieldId] = {\n id: extraFieldId,\n length: extraFieldLength,\n value: extraFieldValue\n };\n }\n },\n /**\n * Read the end of the Zip 64 central directory locator.\n */\n readBlockZip64EndOfCentralLocator: function() {\n this.diskWithZip64CentralDirStart = this.reader.readInt(4);\n this.relativeOffsetEndOfZip64CentralDir = this.reader.readInt(8);\n this.disksCount = this.reader.readInt(4);\n if (this.disksCount > 1) {\n throw new Error(\"Multi-volumes zip are not supported\");\n }\n },\n /**\n * Read the local files, based on the offset read in the central part.\n */\n readLocalFiles: function() {\n var i, file;\n for (i = 0; i < this.files.length; i++) {\n file = this.files[i];\n this.reader.setIndex(file.localHeaderOffset);\n this.checkSignature(sig.LOCAL_FILE_HEADER);\n file.readLocalPart(this.reader);\n file.handleUTF8();\n file.processAttributes();\n }\n },\n /**\n * Read the central directory.\n */\n readCentralDir: function() {\n var file;\n\n this.reader.setIndex(this.centralDirOffset);\n while (this.reader.readAndCheckSignature(sig.CENTRAL_FILE_HEADER)) {\n file = new ZipEntry({\n zip64: this.zip64\n }, this.loadOptions);\n file.readCentralPart(this.reader);\n this.files.push(file);\n }\n\n if (this.centralDirRecords !== this.files.length) {\n if (this.centralDirRecords !== 0 && this.files.length === 0) {\n // We expected some records but couldn't find ANY.\n // This is really suspicious, as if something went wrong.\n throw new Error(\"Corrupted zip or bug: expected \" + this.centralDirRecords + \" records in central dir, got \" + this.files.length);\n } else {\n // We found some records but not all.\n // Something is wrong but we got something for the user: no error here.\n // console.warn(\"expected\", this.centralDirRecords, \"records in central dir, got\", this.files.length);\n }\n }\n },\n /**\n * Read the end of central directory.\n */\n readEndOfCentral: function() {\n var offset = this.reader.lastIndexOfSignature(sig.CENTRAL_DIRECTORY_END);\n if (offset < 0) {\n // Check if the content is a truncated zip or complete garbage.\n // A \"LOCAL_FILE_HEADER\" is not required at the beginning (auto\n // extractible zip for example) but it can give a good hint.\n // If an ajax request was used without responseType, we will also\n // get unreadable data.\n var isGarbage = !this.isSignature(0, sig.LOCAL_FILE_HEADER);\n\n if (isGarbage) {\n throw new Error(\"Can't find end of central directory : is this a zip file ? \" +\n \"If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html\");\n } else {\n throw new Error(\"Corrupted zip: can't find end of central directory\");\n }\n\n }\n this.reader.setIndex(offset);\n var endOfCentralDirOffset = offset;\n this.checkSignature(sig.CENTRAL_DIRECTORY_END);\n this.readBlockEndOfCentral();\n\n\n /* extract from the zip spec :\n 4) If one of the fields in the end of central directory\n record is too small to hold required data, the field\n should be set to -1 (0xFFFF or 0xFFFFFFFF) and the\n ZIP64 format record should be created.\n 5) The end of central directory record and the\n Zip64 end of central directory locator record must\n reside on the same disk when splitting or spanning\n an archive.\n */\n if (this.diskNumber === utils.MAX_VALUE_16BITS || this.diskWithCentralDirStart === utils.MAX_VALUE_16BITS || this.centralDirRecordsOnThisDisk === utils.MAX_VALUE_16BITS || this.centralDirRecords === utils.MAX_VALUE_16BITS || this.centralDirSize === utils.MAX_VALUE_32BITS || this.centralDirOffset === utils.MAX_VALUE_32BITS) {\n this.zip64 = true;\n\n /*\n Warning : the zip64 extension is supported, but ONLY if the 64bits integer read from\n the zip file can fit into a 32bits integer. This cannot be solved : JavaScript represents\n all numbers as 64-bit double precision IEEE 754 floating point numbers.\n So, we have 53bits for integers and bitwise operations treat everything as 32bits.\n see https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Operators/Bitwise_Operators\n and http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-262.pdf section 8.5\n */\n\n // should look for a zip64 EOCD locator\n offset = this.reader.lastIndexOfSignature(sig.ZIP64_CENTRAL_DIRECTORY_LOCATOR);\n if (offset < 0) {\n throw new Error(\"Corrupted zip: can't find the ZIP64 end of central directory locator\");\n }\n this.reader.setIndex(offset);\n this.checkSignature(sig.ZIP64_CENTRAL_DIRECTORY_LOCATOR);\n this.readBlockZip64EndOfCentralLocator();\n\n // now the zip64 EOCD record\n if (!this.isSignature(this.relativeOffsetEndOfZip64CentralDir, sig.ZIP64_CENTRAL_DIRECTORY_END)) {\n // console.warn(\"ZIP64 end of central directory not where expected.\");\n this.relativeOffsetEndOfZip64CentralDir = this.reader.lastIndexOfSignature(sig.ZIP64_CENTRAL_DIRECTORY_END);\n if (this.relativeOffsetEndOfZip64CentralDir < 0) {\n throw new Error(\"Corrupted zip: can't find the ZIP64 end of central directory\");\n }\n }\n this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir);\n this.checkSignature(sig.ZIP64_CENTRAL_DIRECTORY_END);\n this.readBlockZip64EndOfCentral();\n }\n\n var expectedEndOfCentralDirOffset = this.centralDirOffset + this.centralDirSize;\n if (this.zip64) {\n expectedEndOfCentralDirOffset += 20; // end of central dir 64 locator\n expectedEndOfCentralDirOffset += 12 /* should not include the leading 12 bytes */ + this.zip64EndOfCentralSize;\n }\n\n var extraBytes = endOfCentralDirOffset - expectedEndOfCentralDirOffset;\n\n if (extraBytes > 0) {\n // console.warn(extraBytes, \"extra bytes at beginning or within zipfile\");\n if (this.isSignature(endOfCentralDirOffset, sig.CENTRAL_FILE_HEADER)) {\n // The offsets seem wrong, but we have something at the specified offset.\n // So… we keep it.\n } else {\n // the offset is wrong, update the \"zero\" of the reader\n // this happens if data has been prepended (crx files for example)\n this.reader.zero = extraBytes;\n }\n } else if (extraBytes < 0) {\n throw new Error(\"Corrupted zip: missing \" + Math.abs(extraBytes) + \" bytes.\");\n }\n },\n prepareReader: function(data) {\n this.reader = readerFor(data);\n },\n /**\n * Read a zip file and create ZipEntries.\n * @param {String|ArrayBuffer|Uint8Array|Buffer} data the binary string representing a zip file.\n */\n load: function(data) {\n this.prepareReader(data);\n this.readEndOfCentral();\n this.readCentralDir();\n this.readLocalFiles();\n }\n};\n// }}} end of ZipEntries\nmodule.exports = ZipEntries;\n","'use strict';\nvar utils = require('./utils');\nvar external = require(\"./external\");\nvar utf8 = require('./utf8');\nvar utils = require('./utils');\nvar ZipEntries = require('./zipEntries');\nvar Crc32Probe = require('./stream/Crc32Probe');\nvar nodejsUtils = require(\"./nodejsUtils\");\n\n/**\n * Check the CRC32 of an entry.\n * @param {ZipEntry} zipEntry the zip entry to check.\n * @return {Promise} the result.\n */\nfunction checkEntryCRC32(zipEntry) {\n return new external.Promise(function (resolve, reject) {\n var worker = zipEntry.decompressed.getContentWorker().pipe(new Crc32Probe());\n worker.on(\"error\", function (e) {\n reject(e);\n })\n .on(\"end\", function () {\n if (worker.streamInfo.crc32 !== zipEntry.decompressed.crc32) {\n reject(new Error(\"Corrupted zip : CRC32 mismatch\"));\n } else {\n resolve();\n }\n })\n .resume();\n });\n}\n\nmodule.exports = function(data, options) {\n var zip = this;\n options = utils.extend(options || {}, {\n base64: false,\n checkCRC32: false,\n optimizedBinaryString: false,\n createFolders: false,\n decodeFileName: utf8.utf8decode\n });\n\n if (nodejsUtils.isNode && nodejsUtils.isStream(data)) {\n return external.Promise.reject(new Error(\"JSZip can't accept a stream when loading a zip file.\"));\n }\n\n return utils.prepareContent(\"the loaded zip file\", data, true, options.optimizedBinaryString, options.base64)\n .then(function(data) {\n var zipEntries = new ZipEntries(options);\n zipEntries.load(data);\n return zipEntries;\n }).then(function checkCRC32(zipEntries) {\n var promises = [external.Promise.resolve(zipEntries)];\n var files = zipEntries.files;\n if (options.checkCRC32) {\n for (var i = 0; i < files.length; i++) {\n promises.push(checkEntryCRC32(files[i]));\n }\n }\n return external.Promise.all(promises);\n }).then(function addFiles(results) {\n var zipEntries = results.shift();\n var files = zipEntries.files;\n for (var i = 0; i < files.length; i++) {\n var input = files[i];\n zip.file(input.fileNameStr, input.decompressed, {\n binary: true,\n optimizedBinaryString: true,\n date: input.date,\n dir: input.dir,\n comment : input.fileCommentStr.length ? input.fileCommentStr : null,\n unixPermissions : input.unixPermissions,\n dosPermissions : input.dosPermissions,\n createFolders: options.createFolders\n });\n }\n if (zipEntries.zipComment.length) {\n zip.comment = zipEntries.zipComment;\n }\n\n return zip;\n });\n};\n","\"use strict\";\n\nvar utils = require('../utils');\nvar GenericWorker = require('../stream/GenericWorker');\n\n/**\n * A worker that use a nodejs stream as source.\n * @constructor\n * @param {String} filename the name of the file entry for this stream.\n * @param {Readable} stream the nodejs stream.\n */\nfunction NodejsStreamInputAdapter(filename, stream) {\n GenericWorker.call(this, \"Nodejs stream input adapter for \" + filename);\n this._upstreamEnded = false;\n this._bindStream(stream);\n}\n\nutils.inherits(NodejsStreamInputAdapter, GenericWorker);\n\n/**\n * Prepare the stream and bind the callbacks on it.\n * Do this ASAP on node 0.10 ! A lazy binding doesn't always work.\n * @param {Stream} stream the nodejs stream to use.\n */\nNodejsStreamInputAdapter.prototype._bindStream = function (stream) {\n var self = this;\n this._stream = stream;\n stream.pause();\n stream\n .on(\"data\", function (chunk) {\n self.push({\n data: chunk,\n meta : {\n percent : 0\n }\n });\n })\n .on(\"error\", function (e) {\n if(self.isPaused) {\n this.generatedError = e;\n } else {\n self.error(e);\n }\n })\n .on(\"end\", function () {\n if(self.isPaused) {\n self._upstreamEnded = true;\n } else {\n self.end();\n }\n });\n};\nNodejsStreamInputAdapter.prototype.pause = function () {\n if(!GenericWorker.prototype.pause.call(this)) {\n return false;\n }\n this._stream.pause();\n return true;\n};\nNodejsStreamInputAdapter.prototype.resume = function () {\n if(!GenericWorker.prototype.resume.call(this)) {\n return false;\n }\n\n if(this._upstreamEnded) {\n this.end();\n } else {\n this._stream.resume();\n }\n\n return true;\n};\n\nmodule.exports = NodejsStreamInputAdapter;\n","'use strict';\n\nvar utils = require('../utils');\nvar GenericWorker = require('../stream/GenericWorker');\nvar utf8 = require('../utf8');\nvar crc32 = require('../crc32');\nvar signature = require('../signature');\n\n/**\n * Transform an integer into a string in hexadecimal.\n * @private\n * @param {number} dec the number to convert.\n * @param {number} bytes the number of bytes to generate.\n * @returns {string} the result.\n */\nvar decToHex = function(dec, bytes) {\n var hex = \"\", i;\n for (i = 0; i < bytes; i++) {\n hex += String.fromCharCode(dec & 0xff);\n dec = dec >>> 8;\n }\n return hex;\n};\n\n/**\n * Generate the UNIX part of the external file attributes.\n * @param {Object} unixPermissions the unix permissions or null.\n * @param {Boolean} isDir true if the entry is a directory, false otherwise.\n * @return {Number} a 32 bit integer.\n *\n * adapted from http://unix.stackexchange.com/questions/14705/the-zip-formats-external-file-attribute :\n *\n * TTTTsstrwxrwxrwx0000000000ADVSHR\n * ^^^^____________________________ file type, see zipinfo.c (UNX_*)\n * ^^^_________________________ setuid, setgid, sticky\n * ^^^^^^^^^________________ permissions\n * ^^^^^^^^^^______ not used ?\n * ^^^^^^ DOS attribute bits : Archive, Directory, Volume label, System file, Hidden, Read only\n */\nvar generateUnixExternalFileAttr = function (unixPermissions, isDir) {\n\n var result = unixPermissions;\n if (!unixPermissions) {\n // I can't use octal values in strict mode, hence the hexa.\n // 040775 => 0x41fd\n // 0100664 => 0x81b4\n result = isDir ? 0x41fd : 0x81b4;\n }\n return (result & 0xFFFF) << 16;\n};\n\n/**\n * Generate the DOS part of the external file attributes.\n * @param {Object} dosPermissions the dos permissions or null.\n * @param {Boolean} isDir true if the entry is a directory, false otherwise.\n * @return {Number} a 32 bit integer.\n *\n * Bit 0 Read-Only\n * Bit 1 Hidden\n * Bit 2 System\n * Bit 3 Volume Label\n * Bit 4 Directory\n * Bit 5 Archive\n */\nvar generateDosExternalFileAttr = function (dosPermissions, isDir) {\n\n // the dir flag is already set for compatibility\n return (dosPermissions || 0) & 0x3F;\n};\n\n/**\n * Generate the various parts used in the construction of the final zip file.\n * @param {Object} streamInfo the hash with informations about the compressed file.\n * @param {Boolean} streamedContent is the content streamed ?\n * @param {Boolean} streamingEnded is the stream finished ?\n * @param {number} offset the current offset from the start of the zip file.\n * @param {String} platform let's pretend we are this platform (change platform dependents fields)\n * @param {Function} encodeFileName the function to encode the file name / comment.\n * @return {Object} the zip parts.\n */\nvar generateZipParts = function(streamInfo, streamedContent, streamingEnded, offset, platform, encodeFileName) {\n var file = streamInfo['file'],\n compression = streamInfo['compression'],\n useCustomEncoding = encodeFileName !== utf8.utf8encode,\n encodedFileName = utils.transformTo(\"string\", encodeFileName(file.name)),\n utfEncodedFileName = utils.transformTo(\"string\", utf8.utf8encode(file.name)),\n comment = file.comment,\n encodedComment = utils.transformTo(\"string\", encodeFileName(comment)),\n utfEncodedComment = utils.transformTo(\"string\", utf8.utf8encode(comment)),\n useUTF8ForFileName = utfEncodedFileName.length !== file.name.length,\n useUTF8ForComment = utfEncodedComment.length !== comment.length,\n dosTime,\n dosDate,\n extraFields = \"\",\n unicodePathExtraField = \"\",\n unicodeCommentExtraField = \"\",\n dir = file.dir,\n date = file.date;\n\n\n var dataInfo = {\n crc32 : 0,\n compressedSize : 0,\n uncompressedSize : 0\n };\n\n // if the content is streamed, the sizes/crc32 are only available AFTER\n // the end of the stream.\n if (!streamedContent || streamingEnded) {\n dataInfo.crc32 = streamInfo['crc32'];\n dataInfo.compressedSize = streamInfo['compressedSize'];\n dataInfo.uncompressedSize = streamInfo['uncompressedSize'];\n }\n\n var bitflag = 0;\n if (streamedContent) {\n // Bit 3: the sizes/crc32 are set to zero in the local header.\n // The correct values are put in the data descriptor immediately\n // following the compressed data.\n bitflag |= 0x0008;\n }\n if (!useCustomEncoding && (useUTF8ForFileName || useUTF8ForComment)) {\n // Bit 11: Language encoding flag (EFS).\n bitflag |= 0x0800;\n }\n\n\n var extFileAttr = 0;\n var versionMadeBy = 0;\n if (dir) {\n // dos or unix, we set the dos dir flag\n extFileAttr |= 0x00010;\n }\n if(platform === \"UNIX\") {\n versionMadeBy = 0x031E; // UNIX, version 3.0\n extFileAttr |= generateUnixExternalFileAttr(file.unixPermissions, dir);\n } else { // DOS or other, fallback to DOS\n versionMadeBy = 0x0014; // DOS, version 2.0\n extFileAttr |= generateDosExternalFileAttr(file.dosPermissions, dir);\n }\n\n // date\n // @see http://www.delorie.com/djgpp/doc/rbinter/it/52/13.html\n // @see http://www.delorie.com/djgpp/doc/rbinter/it/65/16.html\n // @see http://www.delorie.com/djgpp/doc/rbinter/it/66/16.html\n\n dosTime = date.getUTCHours();\n dosTime = dosTime << 6;\n dosTime = dosTime | date.getUTCMinutes();\n dosTime = dosTime << 5;\n dosTime = dosTime | date.getUTCSeconds() / 2;\n\n dosDate = date.getUTCFullYear() - 1980;\n dosDate = dosDate << 4;\n dosDate = dosDate | (date.getUTCMonth() + 1);\n dosDate = dosDate << 5;\n dosDate = dosDate | date.getUTCDate();\n\n if (useUTF8ForFileName) {\n // set the unicode path extra field. unzip needs at least one extra\n // field to correctly handle unicode path, so using the path is as good\n // as any other information. This could improve the situation with\n // other archive managers too.\n // This field is usually used without the utf8 flag, with a non\n // unicode path in the header (winrar, winzip). This helps (a bit)\n // with the messy Windows' default compressed folders feature but\n // breaks on p7zip which doesn't seek the unicode path extra field.\n // So for now, UTF-8 everywhere !\n unicodePathExtraField =\n // Version\n decToHex(1, 1) +\n // NameCRC32\n decToHex(crc32(encodedFileName), 4) +\n // UnicodeName\n utfEncodedFileName;\n\n extraFields +=\n // Info-ZIP Unicode Path Extra Field\n \"\\x75\\x70\" +\n // size\n decToHex(unicodePathExtraField.length, 2) +\n // content\n unicodePathExtraField;\n }\n\n if(useUTF8ForComment) {\n\n unicodeCommentExtraField =\n // Version\n decToHex(1, 1) +\n // CommentCRC32\n decToHex(crc32(encodedComment), 4) +\n // UnicodeName\n utfEncodedComment;\n\n extraFields +=\n // Info-ZIP Unicode Path Extra Field\n \"\\x75\\x63\" +\n // size\n decToHex(unicodeCommentExtraField.length, 2) +\n // content\n unicodeCommentExtraField;\n }\n\n var header = \"\";\n\n // version needed to extract\n header += \"\\x0A\\x00\";\n // general purpose bit flag\n header += decToHex(bitflag, 2);\n // compression method\n header += compression.magic;\n // last mod file time\n header += decToHex(dosTime, 2);\n // last mod file date\n header += decToHex(dosDate, 2);\n // crc-32\n header += decToHex(dataInfo.crc32, 4);\n // compressed size\n header += decToHex(dataInfo.compressedSize, 4);\n // uncompressed size\n header += decToHex(dataInfo.uncompressedSize, 4);\n // file name length\n header += decToHex(encodedFileName.length, 2);\n // extra field length\n header += decToHex(extraFields.length, 2);\n\n\n var fileRecord = signature.LOCAL_FILE_HEADER + header + encodedFileName + extraFields;\n\n var dirRecord = signature.CENTRAL_FILE_HEADER +\n // version made by (00: DOS)\n decToHex(versionMadeBy, 2) +\n // file header (common to file and central directory)\n header +\n // file comment length\n decToHex(encodedComment.length, 2) +\n // disk number start\n \"\\x00\\x00\" +\n // internal file attributes TODO\n \"\\x00\\x00\" +\n // external file attributes\n decToHex(extFileAttr, 4) +\n // relative offset of local header\n decToHex(offset, 4) +\n // file name\n encodedFileName +\n // extra field\n extraFields +\n // file comment\n encodedComment;\n\n return {\n fileRecord: fileRecord,\n dirRecord: dirRecord\n };\n};\n\n/**\n * Generate the EOCD record.\n * @param {Number} entriesCount the number of entries in the zip file.\n * @param {Number} centralDirLength the length (in bytes) of the central dir.\n * @param {Number} localDirLength the length (in bytes) of the local dir.\n * @param {String} comment the zip file comment as a binary string.\n * @param {Function} encodeFileName the function to encode the comment.\n * @return {String} the EOCD record.\n */\nvar generateCentralDirectoryEnd = function (entriesCount, centralDirLength, localDirLength, comment, encodeFileName) {\n var dirEnd = \"\";\n var encodedComment = utils.transformTo(\"string\", encodeFileName(comment));\n\n // end of central dir signature\n dirEnd = signature.CENTRAL_DIRECTORY_END +\n // number of this disk\n \"\\x00\\x00\" +\n // number of the disk with the start of the central directory\n \"\\x00\\x00\" +\n // total number of entries in the central directory on this disk\n decToHex(entriesCount, 2) +\n // total number of entries in the central directory\n decToHex(entriesCount, 2) +\n // size of the central directory 4 bytes\n decToHex(centralDirLength, 4) +\n // offset of start of central directory with respect to the starting disk number\n decToHex(localDirLength, 4) +\n // .ZIP file comment length\n decToHex(encodedComment.length, 2) +\n // .ZIP file comment\n encodedComment;\n\n return dirEnd;\n};\n\n/**\n * Generate data descriptors for a file entry.\n * @param {Object} streamInfo the hash generated by a worker, containing informations\n * on the file entry.\n * @return {String} the data descriptors.\n */\nvar generateDataDescriptors = function (streamInfo) {\n var descriptor = \"\";\n descriptor = signature.DATA_DESCRIPTOR +\n // crc-32 4 bytes\n decToHex(streamInfo['crc32'], 4) +\n // compressed size 4 bytes\n decToHex(streamInfo['compressedSize'], 4) +\n // uncompressed size 4 bytes\n decToHex(streamInfo['uncompressedSize'], 4);\n\n return descriptor;\n};\n\n\n/**\n * A worker to concatenate other workers to create a zip file.\n * @param {Boolean} streamFiles `true` to stream the content of the files,\n * `false` to accumulate it.\n * @param {String} comment the comment to use.\n * @param {String} platform the platform to use, \"UNIX\" or \"DOS\".\n * @param {Function} encodeFileName the function to encode file names and comments.\n */\nfunction ZipFileWorker(streamFiles, comment, platform, encodeFileName) {\n GenericWorker.call(this, \"ZipFileWorker\");\n // The number of bytes written so far. This doesn't count accumulated chunks.\n this.bytesWritten = 0;\n // The comment of the zip file\n this.zipComment = comment;\n // The platform \"generating\" the zip file.\n this.zipPlatform = platform;\n // the function to encode file names and comments.\n this.encodeFileName = encodeFileName;\n // Should we stream the content of the files ?\n this.streamFiles = streamFiles;\n // If `streamFiles` is false, we will need to accumulate the content of the\n // files to calculate sizes / crc32 (and write them *before* the content).\n // This boolean indicates if we are accumulating chunks (it will change a lot\n // during the lifetime of this worker).\n this.accumulate = false;\n // The buffer receiving chunks when accumulating content.\n this.contentBuffer = [];\n // The list of generated directory records.\n this.dirRecords = [];\n // The offset (in bytes) from the beginning of the zip file for the current source.\n this.currentSourceOffset = 0;\n // The total number of entries in this zip file.\n this.entriesCount = 0;\n // the name of the file currently being added, null when handling the end of the zip file.\n // Used for the emited metadata.\n this.currentFile = null;\n\n\n\n this._sources = [];\n}\nutils.inherits(ZipFileWorker, GenericWorker);\n\n/**\n * @see GenericWorker.push\n */\nZipFileWorker.prototype.push = function (chunk) {\n\n var currentFilePercent = chunk.meta.percent || 0;\n var entriesCount = this.entriesCount;\n var remainingFiles = this._sources.length;\n\n if(this.accumulate) {\n this.contentBuffer.push(chunk);\n } else {\n this.bytesWritten += chunk.data.length;\n\n GenericWorker.prototype.push.call(this, {\n data : chunk.data,\n meta : {\n currentFile : this.currentFile,\n percent : entriesCount ? (currentFilePercent + 100 * (entriesCount - remainingFiles - 1)) / entriesCount : 100\n }\n });\n }\n};\n\n/**\n * The worker started a new source (an other worker).\n * @param {Object} streamInfo the streamInfo object from the new source.\n */\nZipFileWorker.prototype.openedSource = function (streamInfo) {\n this.currentSourceOffset = this.bytesWritten;\n this.currentFile = streamInfo['file'].name;\n\n var streamedContent = this.streamFiles && !streamInfo['file'].dir;\n\n // don't stream folders (because they don't have any content)\n if(streamedContent) {\n var record = generateZipParts(streamInfo, streamedContent, false, this.currentSourceOffset, this.zipPlatform, this.encodeFileName);\n this.push({\n data : record.fileRecord,\n meta : {percent:0}\n });\n } else {\n // we need to wait for the whole file before pushing anything\n this.accumulate = true;\n }\n};\n\n/**\n * The worker finished a source (an other worker).\n * @param {Object} streamInfo the streamInfo object from the finished source.\n */\nZipFileWorker.prototype.closedSource = function (streamInfo) {\n this.accumulate = false;\n var streamedContent = this.streamFiles && !streamInfo['file'].dir;\n var record = generateZipParts(streamInfo, streamedContent, true, this.currentSourceOffset, this.zipPlatform, this.encodeFileName);\n\n this.dirRecords.push(record.dirRecord);\n if(streamedContent) {\n // after the streamed file, we put data descriptors\n this.push({\n data : generateDataDescriptors(streamInfo),\n meta : {percent:100}\n });\n } else {\n // the content wasn't streamed, we need to push everything now\n // first the file record, then the content\n this.push({\n data : record.fileRecord,\n meta : {percent:0}\n });\n while(this.contentBuffer.length) {\n this.push(this.contentBuffer.shift());\n }\n }\n this.currentFile = null;\n};\n\n/**\n * @see GenericWorker.flush\n */\nZipFileWorker.prototype.flush = function () {\n\n var localDirLength = this.bytesWritten;\n for(var i = 0; i < this.dirRecords.length; i++) {\n this.push({\n data : this.dirRecords[i],\n meta : {percent:100}\n });\n }\n var centralDirLength = this.bytesWritten - localDirLength;\n\n var dirEnd = generateCentralDirectoryEnd(this.dirRecords.length, centralDirLength, localDirLength, this.zipComment, this.encodeFileName);\n\n this.push({\n data : dirEnd,\n meta : {percent:100}\n });\n};\n\n/**\n * Prepare the next source to be read.\n */\nZipFileWorker.prototype.prepareNextSource = function () {\n this.previous = this._sources.shift();\n this.openedSource(this.previous.streamInfo);\n if (this.isPaused) {\n this.previous.pause();\n } else {\n this.previous.resume();\n }\n};\n\n/**\n * @see GenericWorker.registerPrevious\n */\nZipFileWorker.prototype.registerPrevious = function (previous) {\n this._sources.push(previous);\n var self = this;\n\n previous.on('data', function (chunk) {\n self.processChunk(chunk);\n });\n previous.on('end', function () {\n self.closedSource(self.previous.streamInfo);\n if(self._sources.length) {\n self.prepareNextSource();\n } else {\n self.end();\n }\n });\n previous.on('error', function (e) {\n self.error(e);\n });\n return this;\n};\n\n/**\n * @see GenericWorker.resume\n */\nZipFileWorker.prototype.resume = function () {\n if(!GenericWorker.prototype.resume.call(this)) {\n return false;\n }\n\n if (!this.previous && this._sources.length) {\n this.prepareNextSource();\n return true;\n }\n if (!this.previous && !this._sources.length && !this.generatedError) {\n this.end();\n return true;\n }\n};\n\n/**\n * @see GenericWorker.error\n */\nZipFileWorker.prototype.error = function (e) {\n var sources = this._sources;\n if(!GenericWorker.prototype.error.call(this, e)) {\n return false;\n }\n for(var i = 0; i < sources.length; i++) {\n try {\n sources[i].error(e);\n } catch(e) {\n // the `error` exploded, nothing to do\n }\n }\n return true;\n};\n\n/**\n * @see GenericWorker.lock\n */\nZipFileWorker.prototype.lock = function () {\n GenericWorker.prototype.lock.call(this);\n var sources = this._sources;\n for(var i = 0; i < sources.length; i++) {\n sources[i].lock();\n }\n};\n\nmodule.exports = ZipFileWorker;\n","'use strict';\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\nfunction GZheader() {\n /* true if compressed data believed to be text */\n this.text = 0;\n /* modification time */\n this.time = 0;\n /* extra flags (not used when writing a gzip file) */\n this.xflags = 0;\n /* operating system */\n this.os = 0;\n /* pointer to extra field or Z_NULL if none */\n this.extra = null;\n /* extra field length (valid if extra != Z_NULL) */\n this.extra_len = 0; // Actually, we don't need it in JS,\n // but leave for few code modifications\n\n //\n // Setup limits is not necessary because in js we should not preallocate memory\n // for inflate use constant limit in 65536 bytes\n //\n\n /* space at extra (only when reading header) */\n // this.extra_max = 0;\n /* pointer to zero-terminated file name or Z_NULL */\n this.name = '';\n /* space at name (only when reading header) */\n // this.name_max = 0;\n /* pointer to zero-terminated comment or Z_NULL */\n this.comment = '';\n /* space at comment (only when reading header) */\n // this.comm_max = 0;\n /* true if there was or will be a header crc */\n this.hcrc = 0;\n /* true when done reading gzip header (not used when writing a gzip file) */\n this.done = false;\n}\n\nmodule.exports = GZheader;\n","'use strict';\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\nvar utils = require('../utils/common');\n\nvar MAXBITS = 15;\nvar ENOUGH_LENS = 852;\nvar ENOUGH_DISTS = 592;\n//var ENOUGH = (ENOUGH_LENS+ENOUGH_DISTS);\n\nvar CODES = 0;\nvar LENS = 1;\nvar DISTS = 2;\n\nvar lbase = [ /* Length codes 257..285 base */\n 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31,\n 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0\n];\n\nvar lext = [ /* Length codes 257..285 extra */\n 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18,\n 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 72, 78\n];\n\nvar dbase = [ /* Distance codes 0..29 base */\n 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,\n 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,\n 8193, 12289, 16385, 24577, 0, 0\n];\n\nvar dext = [ /* Distance codes 0..29 extra */\n 16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22,\n 23, 23, 24, 24, 25, 25, 26, 26, 27, 27,\n 28, 28, 29, 29, 64, 64\n];\n\nmodule.exports = function inflate_table(type, lens, lens_index, codes, table, table_index, work, opts)\n{\n var bits = opts.bits;\n //here = opts.here; /* table entry for duplication */\n\n var len = 0; /* a code's length in bits */\n var sym = 0; /* index of code symbols */\n var min = 0, max = 0; /* minimum and maximum code lengths */\n var root = 0; /* number of index bits for root table */\n var curr = 0; /* number of index bits for current table */\n var drop = 0; /* code bits to drop for sub-table */\n var left = 0; /* number of prefix codes available */\n var used = 0; /* code entries in table used */\n var huff = 0; /* Huffman code */\n var incr; /* for incrementing code, index */\n var fill; /* index for replicating entries */\n var low; /* low bits for current root entry */\n var mask; /* mask for low root bits */\n var next; /* next available space in table */\n var base = null; /* base value table to use */\n var base_index = 0;\n// var shoextra; /* extra bits table to use */\n var end; /* use base and extra for symbol > end */\n var count = new utils.Buf16(MAXBITS + 1); //[MAXBITS+1]; /* number of codes of each length */\n var offs = new utils.Buf16(MAXBITS + 1); //[MAXBITS+1]; /* offsets in table for each length */\n var extra = null;\n var extra_index = 0;\n\n var here_bits, here_op, here_val;\n\n /*\n Process a set of code lengths to create a canonical Huffman code. The\n code lengths are lens[0..codes-1]. Each length corresponds to the\n symbols 0..codes-1. The Huffman code is generated by first sorting the\n symbols by length from short to long, and retaining the symbol order\n for codes with equal lengths. Then the code starts with all zero bits\n for the first code of the shortest length, and the codes are integer\n increments for the same length, and zeros are appended as the length\n increases. For the deflate format, these bits are stored backwards\n from their more natural integer increment ordering, and so when the\n decoding tables are built in the large loop below, the integer codes\n are incremented backwards.\n\n This routine assumes, but does not check, that all of the entries in\n lens[] are in the range 0..MAXBITS. The caller must assure this.\n 1..MAXBITS is interpreted as that code length. zero means that that\n symbol does not occur in this code.\n\n The codes are sorted by computing a count of codes for each length,\n creating from that a table of starting indices for each length in the\n sorted table, and then entering the symbols in order in the sorted\n table. The sorted table is work[], with that space being provided by\n the caller.\n\n The length counts are used for other purposes as well, i.e. finding\n the minimum and maximum length codes, determining if there are any\n codes at all, checking for a valid set of lengths, and looking ahead\n at length counts to determine sub-table sizes when building the\n decoding tables.\n */\n\n /* accumulate lengths for codes (assumes lens[] all in 0..MAXBITS) */\n for (len = 0; len <= MAXBITS; len++) {\n count[len] = 0;\n }\n for (sym = 0; sym < codes; sym++) {\n count[lens[lens_index + sym]]++;\n }\n\n /* bound code lengths, force root to be within code lengths */\n root = bits;\n for (max = MAXBITS; max >= 1; max--) {\n if (count[max] !== 0) { break; }\n }\n if (root > max) {\n root = max;\n }\n if (max === 0) { /* no symbols to code at all */\n //table.op[opts.table_index] = 64; //here.op = (var char)64; /* invalid code marker */\n //table.bits[opts.table_index] = 1; //here.bits = (var char)1;\n //table.val[opts.table_index++] = 0; //here.val = (var short)0;\n table[table_index++] = (1 << 24) | (64 << 16) | 0;\n\n\n //table.op[opts.table_index] = 64;\n //table.bits[opts.table_index] = 1;\n //table.val[opts.table_index++] = 0;\n table[table_index++] = (1 << 24) | (64 << 16) | 0;\n\n opts.bits = 1;\n return 0; /* no symbols, but wait for decoding to report error */\n }\n for (min = 1; min < max; min++) {\n if (count[min] !== 0) { break; }\n }\n if (root < min) {\n root = min;\n }\n\n /* check for an over-subscribed or incomplete set of lengths */\n left = 1;\n for (len = 1; len <= MAXBITS; len++) {\n left <<= 1;\n left -= count[len];\n if (left < 0) {\n return -1;\n } /* over-subscribed */\n }\n if (left > 0 && (type === CODES || max !== 1)) {\n return -1; /* incomplete set */\n }\n\n /* generate offsets into symbol table for each length for sorting */\n offs[1] = 0;\n for (len = 1; len < MAXBITS; len++) {\n offs[len + 1] = offs[len] + count[len];\n }\n\n /* sort symbols by length, by symbol order within each length */\n for (sym = 0; sym < codes; sym++) {\n if (lens[lens_index + sym] !== 0) {\n work[offs[lens[lens_index + sym]]++] = sym;\n }\n }\n\n /*\n Create and fill in decoding tables. In this loop, the table being\n filled is at next and has curr index bits. The code being used is huff\n with length len. That code is converted to an index by dropping drop\n bits off of the bottom. For codes where len is less than drop + curr,\n those top drop + curr - len bits are incremented through all values to\n fill the table with replicated entries.\n\n root is the number of index bits for the root table. When len exceeds\n root, sub-tables are created pointed to by the root entry with an index\n of the low root bits of huff. This is saved in low to check for when a\n new sub-table should be started. drop is zero when the root table is\n being filled, and drop is root when sub-tables are being filled.\n\n When a new sub-table is needed, it is necessary to look ahead in the\n code lengths to determine what size sub-table is needed. The length\n counts are used for this, and so count[] is decremented as codes are\n entered in the tables.\n\n used keeps track of how many table entries have been allocated from the\n provided *table space. It is checked for LENS and DIST tables against\n the constants ENOUGH_LENS and ENOUGH_DISTS to guard against changes in\n the initial root table size constants. See the comments in inftrees.h\n for more information.\n\n sym increments through all symbols, and the loop terminates when\n all codes of length max, i.e. all codes, have been processed. This\n routine permits incomplete codes, so another loop after this one fills\n in the rest of the decoding tables with invalid code markers.\n */\n\n /* set up for code type */\n // poor man optimization - use if-else instead of switch,\n // to avoid deopts in old v8\n if (type === CODES) {\n base = extra = work; /* dummy value--not used */\n end = 19;\n\n } else if (type === LENS) {\n base = lbase;\n base_index -= 257;\n extra = lext;\n extra_index -= 257;\n end = 256;\n\n } else { /* DISTS */\n base = dbase;\n extra = dext;\n end = -1;\n }\n\n /* initialize opts for loop */\n huff = 0; /* starting code */\n sym = 0; /* starting code symbol */\n len = min; /* starting code length */\n next = table_index; /* current table to fill in */\n curr = root; /* current table index bits */\n drop = 0; /* current bits to drop from code for index */\n low = -1; /* trigger new sub-table when len > root */\n used = 1 << root; /* use root table entries */\n mask = used - 1; /* mask for comparing low */\n\n /* check available table space */\n if ((type === LENS && used > ENOUGH_LENS) ||\n (type === DISTS && used > ENOUGH_DISTS)) {\n return 1;\n }\n\n /* process all codes and make table entries */\n for (;;) {\n /* create table entry */\n here_bits = len - drop;\n if (work[sym] < end) {\n here_op = 0;\n here_val = work[sym];\n }\n else if (work[sym] > end) {\n here_op = extra[extra_index + work[sym]];\n here_val = base[base_index + work[sym]];\n }\n else {\n here_op = 32 + 64; /* end of block */\n here_val = 0;\n }\n\n /* replicate for those indices with low len bits equal to huff */\n incr = 1 << (len - drop);\n fill = 1 << curr;\n min = fill; /* save offset to next table */\n do {\n fill -= incr;\n table[next + (huff >> drop) + fill] = (here_bits << 24) | (here_op << 16) | here_val |0;\n } while (fill !== 0);\n\n /* backwards increment the len-bit code huff */\n incr = 1 << (len - 1);\n while (huff & incr) {\n incr >>= 1;\n }\n if (incr !== 0) {\n huff &= incr - 1;\n huff += incr;\n } else {\n huff = 0;\n }\n\n /* go to next symbol, update count, len */\n sym++;\n if (--count[len] === 0) {\n if (len === max) { break; }\n len = lens[lens_index + work[sym]];\n }\n\n /* create new sub-table if needed */\n if (len > root && (huff & mask) !== low) {\n /* if first time, transition to sub-tables */\n if (drop === 0) {\n drop = root;\n }\n\n /* increment past last table */\n next += min; /* here min is 1 << curr */\n\n /* determine length of next table */\n curr = len - drop;\n left = 1 << curr;\n while (curr + drop < max) {\n left -= count[curr + drop];\n if (left <= 0) { break; }\n curr++;\n left <<= 1;\n }\n\n /* check for enough space */\n used += 1 << curr;\n if ((type === LENS && used > ENOUGH_LENS) ||\n (type === DISTS && used > ENOUGH_DISTS)) {\n return 1;\n }\n\n /* point entry in root table to sub-table */\n low = huff & mask;\n /*table.op[low] = curr;\n table.bits[low] = root;\n table.val[low] = next - opts.table_index;*/\n table[low] = (root << 24) | (curr << 16) | (next - table_index) |0;\n }\n }\n\n /* fill in remaining table entry if code is incomplete (guaranteed to have\n at most one remaining entry, since if the code is incomplete, the\n maximum code length that was allowed to get this far is one bit) */\n if (huff !== 0) {\n //table.op[next + huff] = 64; /* invalid code marker */\n //table.bits[next + huff] = len - drop;\n //table.val[next + huff] = 0;\n table[next + huff] = ((len - drop) << 24) | (64 << 16) |0;\n }\n\n /* set return parameters */\n //opts.table_index += used;\n opts.bits = root;\n return 0;\n};\n","'use strict';\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\n// See state defs from inflate.js\nvar BAD = 30; /* got a data error -- remain here until reset */\nvar TYPE = 12; /* i: waiting for type bits, including last-flag bit */\n\n/*\n Decode literal, length, and distance codes and write out the resulting\n literal and match bytes until either not enough input or output is\n available, an end-of-block is encountered, or a data error is encountered.\n When large enough input and output buffers are supplied to inflate(), for\n example, a 16K input buffer and a 64K output buffer, more than 95% of the\n inflate execution time is spent in this routine.\n\n Entry assumptions:\n\n state.mode === LEN\n strm.avail_in >= 6\n strm.avail_out >= 258\n start >= strm.avail_out\n state.bits < 8\n\n On return, state.mode is one of:\n\n LEN -- ran out of enough output space or enough available input\n TYPE -- reached end of block code, inflate() to interpret next block\n BAD -- error in block data\n\n Notes:\n\n - The maximum input bits used by a length/distance pair is 15 bits for the\n length code, 5 bits for the length extra, 15 bits for the distance code,\n and 13 bits for the distance extra. This totals 48 bits, or six bytes.\n Therefore if strm.avail_in >= 6, then there is enough input to avoid\n checking for available input while decoding.\n\n - The maximum bytes that a single length/distance pair can output is 258\n bytes, which is the maximum length that can be coded. inflate_fast()\n requires strm.avail_out >= 258 for each loop to avoid checking for\n output space.\n */\nmodule.exports = function inflate_fast(strm, start) {\n var state;\n var _in; /* local strm.input */\n var last; /* have enough input while in < last */\n var _out; /* local strm.output */\n var beg; /* inflate()'s initial strm.output */\n var end; /* while out < end, enough space available */\n//#ifdef INFLATE_STRICT\n var dmax; /* maximum distance from zlib header */\n//#endif\n var wsize; /* window size or zero if not using window */\n var whave; /* valid bytes in the window */\n var wnext; /* window write index */\n // Use `s_window` instead `window`, avoid conflict with instrumentation tools\n var s_window; /* allocated sliding window, if wsize != 0 */\n var hold; /* local strm.hold */\n var bits; /* local strm.bits */\n var lcode; /* local strm.lencode */\n var dcode; /* local strm.distcode */\n var lmask; /* mask for first level of length codes */\n var dmask; /* mask for first level of distance codes */\n var here; /* retrieved table entry */\n var op; /* code bits, operation, extra bits, or */\n /* window position, window bytes to copy */\n var len; /* match length, unused bytes */\n var dist; /* match distance */\n var from; /* where to copy match from */\n var from_source;\n\n\n var input, output; // JS specific, because we have no pointers\n\n /* copy state to local variables */\n state = strm.state;\n //here = state.here;\n _in = strm.next_in;\n input = strm.input;\n last = _in + (strm.avail_in - 5);\n _out = strm.next_out;\n output = strm.output;\n beg = _out - (start - strm.avail_out);\n end = _out + (strm.avail_out - 257);\n//#ifdef INFLATE_STRICT\n dmax = state.dmax;\n//#endif\n wsize = state.wsize;\n whave = state.whave;\n wnext = state.wnext;\n s_window = state.window;\n hold = state.hold;\n bits = state.bits;\n lcode = state.lencode;\n dcode = state.distcode;\n lmask = (1 << state.lenbits) - 1;\n dmask = (1 << state.distbits) - 1;\n\n\n /* decode literals and length/distances until end-of-block or not enough\n input data or output space */\n\n top:\n do {\n if (bits < 15) {\n hold += input[_in++] << bits;\n bits += 8;\n hold += input[_in++] << bits;\n bits += 8;\n }\n\n here = lcode[hold & lmask];\n\n dolen:\n for (;;) { // Goto emulation\n op = here >>> 24/*here.bits*/;\n hold >>>= op;\n bits -= op;\n op = (here >>> 16) & 0xff/*here.op*/;\n if (op === 0) { /* literal */\n //Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ?\n // \"inflate: literal '%c'\\n\" :\n // \"inflate: literal 0x%02x\\n\", here.val));\n output[_out++] = here & 0xffff/*here.val*/;\n }\n else if (op & 16) { /* length base */\n len = here & 0xffff/*here.val*/;\n op &= 15; /* number of extra bits */\n if (op) {\n if (bits < op) {\n hold += input[_in++] << bits;\n bits += 8;\n }\n len += hold & ((1 << op) - 1);\n hold >>>= op;\n bits -= op;\n }\n //Tracevv((stderr, \"inflate: length %u\\n\", len));\n if (bits < 15) {\n hold += input[_in++] << bits;\n bits += 8;\n hold += input[_in++] << bits;\n bits += 8;\n }\n here = dcode[hold & dmask];\n\n dodist:\n for (;;) { // goto emulation\n op = here >>> 24/*here.bits*/;\n hold >>>= op;\n bits -= op;\n op = (here >>> 16) & 0xff/*here.op*/;\n\n if (op & 16) { /* distance base */\n dist = here & 0xffff/*here.val*/;\n op &= 15; /* number of extra bits */\n if (bits < op) {\n hold += input[_in++] << bits;\n bits += 8;\n if (bits < op) {\n hold += input[_in++] << bits;\n bits += 8;\n }\n }\n dist += hold & ((1 << op) - 1);\n//#ifdef INFLATE_STRICT\n if (dist > dmax) {\n strm.msg = 'invalid distance too far back';\n state.mode = BAD;\n break top;\n }\n//#endif\n hold >>>= op;\n bits -= op;\n //Tracevv((stderr, \"inflate: distance %u\\n\", dist));\n op = _out - beg; /* max distance in output */\n if (dist > op) { /* see if copy from window */\n op = dist - op; /* distance back in window */\n if (op > whave) {\n if (state.sane) {\n strm.msg = 'invalid distance too far back';\n state.mode = BAD;\n break top;\n }\n\n// (!) This block is disabled in zlib defaults,\n// don't enable it for binary compatibility\n//#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR\n// if (len <= op - whave) {\n// do {\n// output[_out++] = 0;\n// } while (--len);\n// continue top;\n// }\n// len -= op - whave;\n// do {\n// output[_out++] = 0;\n// } while (--op > whave);\n// if (op === 0) {\n// from = _out - dist;\n// do {\n// output[_out++] = output[from++];\n// } while (--len);\n// continue top;\n// }\n//#endif\n }\n from = 0; // window index\n from_source = s_window;\n if (wnext === 0) { /* very common case */\n from += wsize - op;\n if (op < len) { /* some from window */\n len -= op;\n do {\n output[_out++] = s_window[from++];\n } while (--op);\n from = _out - dist; /* rest from output */\n from_source = output;\n }\n }\n else if (wnext < op) { /* wrap around window */\n from += wsize + wnext - op;\n op -= wnext;\n if (op < len) { /* some from end of window */\n len -= op;\n do {\n output[_out++] = s_window[from++];\n } while (--op);\n from = 0;\n if (wnext < len) { /* some from start of window */\n op = wnext;\n len -= op;\n do {\n output[_out++] = s_window[from++];\n } while (--op);\n from = _out - dist; /* rest from output */\n from_source = output;\n }\n }\n }\n else { /* contiguous in window */\n from += wnext - op;\n if (op < len) { /* some from window */\n len -= op;\n do {\n output[_out++] = s_window[from++];\n } while (--op);\n from = _out - dist; /* rest from output */\n from_source = output;\n }\n }\n while (len > 2) {\n output[_out++] = from_source[from++];\n output[_out++] = from_source[from++];\n output[_out++] = from_source[from++];\n len -= 3;\n }\n if (len) {\n output[_out++] = from_source[from++];\n if (len > 1) {\n output[_out++] = from_source[from++];\n }\n }\n }\n else {\n from = _out - dist; /* copy direct from output */\n do { /* minimum length is three */\n output[_out++] = output[from++];\n output[_out++] = output[from++];\n output[_out++] = output[from++];\n len -= 3;\n } while (len > 2);\n if (len) {\n output[_out++] = output[from++];\n if (len > 1) {\n output[_out++] = output[from++];\n }\n }\n }\n }\n else if ((op & 64) === 0) { /* 2nd level distance code */\n here = dcode[(here & 0xffff)/*here.val*/ + (hold & ((1 << op) - 1))];\n continue dodist;\n }\n else {\n strm.msg = 'invalid distance code';\n state.mode = BAD;\n break top;\n }\n\n break; // need to emulate goto via \"continue\"\n }\n }\n else if ((op & 64) === 0) { /* 2nd level length code */\n here = lcode[(here & 0xffff)/*here.val*/ + (hold & ((1 << op) - 1))];\n continue dolen;\n }\n else if (op & 32) { /* end-of-block */\n //Tracevv((stderr, \"inflate: end of block\\n\"));\n state.mode = TYPE;\n break top;\n }\n else {\n strm.msg = 'invalid literal/length code';\n state.mode = BAD;\n break top;\n }\n\n break; // need to emulate goto via \"continue\"\n }\n } while (_in < last && _out < end);\n\n /* return unused bytes (on entry, bits < 8, so in won't go too far back) */\n len = bits >> 3;\n _in -= len;\n bits -= len << 3;\n hold &= (1 << bits) - 1;\n\n /* update state and return */\n strm.next_in = _in;\n strm.next_out = _out;\n strm.avail_in = (_in < last ? 5 + (last - _in) : 5 - (_in - last));\n strm.avail_out = (_out < end ? 257 + (end - _out) : 257 - (_out - end));\n state.hold = hold;\n state.bits = bits;\n return;\n};\n","'use strict';\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\nvar utils = require('../utils/common');\nvar adler32 = require('./adler32');\nvar crc32 = require('./crc32');\nvar inflate_fast = require('./inffast');\nvar inflate_table = require('./inftrees');\n\nvar CODES = 0;\nvar LENS = 1;\nvar DISTS = 2;\n\n/* Public constants ==========================================================*/\n/* ===========================================================================*/\n\n\n/* Allowed flush values; see deflate() and inflate() below for details */\n//var Z_NO_FLUSH = 0;\n//var Z_PARTIAL_FLUSH = 1;\n//var Z_SYNC_FLUSH = 2;\n//var Z_FULL_FLUSH = 3;\nvar Z_FINISH = 4;\nvar Z_BLOCK = 5;\nvar Z_TREES = 6;\n\n\n/* Return codes for the compression/decompression functions. Negative values\n * are errors, positive values are used for special but normal events.\n */\nvar Z_OK = 0;\nvar Z_STREAM_END = 1;\nvar Z_NEED_DICT = 2;\n//var Z_ERRNO = -1;\nvar Z_STREAM_ERROR = -2;\nvar Z_DATA_ERROR = -3;\nvar Z_MEM_ERROR = -4;\nvar Z_BUF_ERROR = -5;\n//var Z_VERSION_ERROR = -6;\n\n/* The deflate compression method */\nvar Z_DEFLATED = 8;\n\n\n/* STATES ====================================================================*/\n/* ===========================================================================*/\n\n\nvar HEAD = 1; /* i: waiting for magic header */\nvar FLAGS = 2; /* i: waiting for method and flags (gzip) */\nvar TIME = 3; /* i: waiting for modification time (gzip) */\nvar OS = 4; /* i: waiting for extra flags and operating system (gzip) */\nvar EXLEN = 5; /* i: waiting for extra length (gzip) */\nvar EXTRA = 6; /* i: waiting for extra bytes (gzip) */\nvar NAME = 7; /* i: waiting for end of file name (gzip) */\nvar COMMENT = 8; /* i: waiting for end of comment (gzip) */\nvar HCRC = 9; /* i: waiting for header crc (gzip) */\nvar DICTID = 10; /* i: waiting for dictionary check value */\nvar DICT = 11; /* waiting for inflateSetDictionary() call */\nvar TYPE = 12; /* i: waiting for type bits, including last-flag bit */\nvar TYPEDO = 13; /* i: same, but skip check to exit inflate on new block */\nvar STORED = 14; /* i: waiting for stored size (length and complement) */\nvar COPY_ = 15; /* i/o: same as COPY below, but only first time in */\nvar COPY = 16; /* i/o: waiting for input or output to copy stored block */\nvar TABLE = 17; /* i: waiting for dynamic block table lengths */\nvar LENLENS = 18; /* i: waiting for code length code lengths */\nvar CODELENS = 19; /* i: waiting for length/lit and distance code lengths */\nvar LEN_ = 20; /* i: same as LEN below, but only first time in */\nvar LEN = 21; /* i: waiting for length/lit/eob code */\nvar LENEXT = 22; /* i: waiting for length extra bits */\nvar DIST = 23; /* i: waiting for distance code */\nvar DISTEXT = 24; /* i: waiting for distance extra bits */\nvar MATCH = 25; /* o: waiting for output space to copy string */\nvar LIT = 26; /* o: waiting for output space to write literal */\nvar CHECK = 27; /* i: waiting for 32-bit check value */\nvar LENGTH = 28; /* i: waiting for 32-bit length (gzip) */\nvar DONE = 29; /* finished check, done -- remain here until reset */\nvar BAD = 30; /* got a data error -- remain here until reset */\nvar MEM = 31; /* got an inflate() memory error -- remain here until reset */\nvar SYNC = 32; /* looking for synchronization bytes to restart inflate() */\n\n/* ===========================================================================*/\n\n\n\nvar ENOUGH_LENS = 852;\nvar ENOUGH_DISTS = 592;\n//var ENOUGH = (ENOUGH_LENS+ENOUGH_DISTS);\n\nvar MAX_WBITS = 15;\n/* 32K LZ77 window */\nvar DEF_WBITS = MAX_WBITS;\n\n\nfunction zswap32(q) {\n return (((q >>> 24) & 0xff) +\n ((q >>> 8) & 0xff00) +\n ((q & 0xff00) << 8) +\n ((q & 0xff) << 24));\n}\n\n\nfunction InflateState() {\n this.mode = 0; /* current inflate mode */\n this.last = false; /* true if processing last block */\n this.wrap = 0; /* bit 0 true for zlib, bit 1 true for gzip */\n this.havedict = false; /* true if dictionary provided */\n this.flags = 0; /* gzip header method and flags (0 if zlib) */\n this.dmax = 0; /* zlib header max distance (INFLATE_STRICT) */\n this.check = 0; /* protected copy of check value */\n this.total = 0; /* protected copy of output count */\n // TODO: may be {}\n this.head = null; /* where to save gzip header information */\n\n /* sliding window */\n this.wbits = 0; /* log base 2 of requested window size */\n this.wsize = 0; /* window size or zero if not using window */\n this.whave = 0; /* valid bytes in the window */\n this.wnext = 0; /* window write index */\n this.window = null; /* allocated sliding window, if needed */\n\n /* bit accumulator */\n this.hold = 0; /* input bit accumulator */\n this.bits = 0; /* number of bits in \"in\" */\n\n /* for string and stored block copying */\n this.length = 0; /* literal or length of data to copy */\n this.offset = 0; /* distance back to copy string from */\n\n /* for table and code decoding */\n this.extra = 0; /* extra bits needed */\n\n /* fixed and dynamic code tables */\n this.lencode = null; /* starting table for length/literal codes */\n this.distcode = null; /* starting table for distance codes */\n this.lenbits = 0; /* index bits for lencode */\n this.distbits = 0; /* index bits for distcode */\n\n /* dynamic table building */\n this.ncode = 0; /* number of code length code lengths */\n this.nlen = 0; /* number of length code lengths */\n this.ndist = 0; /* number of distance code lengths */\n this.have = 0; /* number of code lengths in lens[] */\n this.next = null; /* next available space in codes[] */\n\n this.lens = new utils.Buf16(320); /* temporary storage for code lengths */\n this.work = new utils.Buf16(288); /* work area for code table building */\n\n /*\n because we don't have pointers in js, we use lencode and distcode directly\n as buffers so we don't need codes\n */\n //this.codes = new utils.Buf32(ENOUGH); /* space for code tables */\n this.lendyn = null; /* dynamic table for length/literal codes (JS specific) */\n this.distdyn = null; /* dynamic table for distance codes (JS specific) */\n this.sane = 0; /* if false, allow invalid distance too far */\n this.back = 0; /* bits back of last unprocessed length/lit */\n this.was = 0; /* initial length of match */\n}\n\nfunction inflateResetKeep(strm) {\n var state;\n\n if (!strm || !strm.state) { return Z_STREAM_ERROR; }\n state = strm.state;\n strm.total_in = strm.total_out = state.total = 0;\n strm.msg = ''; /*Z_NULL*/\n if (state.wrap) { /* to support ill-conceived Java test suite */\n strm.adler = state.wrap & 1;\n }\n state.mode = HEAD;\n state.last = 0;\n state.havedict = 0;\n state.dmax = 32768;\n state.head = null/*Z_NULL*/;\n state.hold = 0;\n state.bits = 0;\n //state.lencode = state.distcode = state.next = state.codes;\n state.lencode = state.lendyn = new utils.Buf32(ENOUGH_LENS);\n state.distcode = state.distdyn = new utils.Buf32(ENOUGH_DISTS);\n\n state.sane = 1;\n state.back = -1;\n //Tracev((stderr, \"inflate: reset\\n\"));\n return Z_OK;\n}\n\nfunction inflateReset(strm) {\n var state;\n\n if (!strm || !strm.state) { return Z_STREAM_ERROR; }\n state = strm.state;\n state.wsize = 0;\n state.whave = 0;\n state.wnext = 0;\n return inflateResetKeep(strm);\n\n}\n\nfunction inflateReset2(strm, windowBits) {\n var wrap;\n var state;\n\n /* get the state */\n if (!strm || !strm.state) { return Z_STREAM_ERROR; }\n state = strm.state;\n\n /* extract wrap request from windowBits parameter */\n if (windowBits < 0) {\n wrap = 0;\n windowBits = -windowBits;\n }\n else {\n wrap = (windowBits >> 4) + 1;\n if (windowBits < 48) {\n windowBits &= 15;\n }\n }\n\n /* set number of window bits, free window if different */\n if (windowBits && (windowBits < 8 || windowBits > 15)) {\n return Z_STREAM_ERROR;\n }\n if (state.window !== null && state.wbits !== windowBits) {\n state.window = null;\n }\n\n /* update state and reset the rest of it */\n state.wrap = wrap;\n state.wbits = windowBits;\n return inflateReset(strm);\n}\n\nfunction inflateInit2(strm, windowBits) {\n var ret;\n var state;\n\n if (!strm) { return Z_STREAM_ERROR; }\n //strm.msg = Z_NULL; /* in case we return an error */\n\n state = new InflateState();\n\n //if (state === Z_NULL) return Z_MEM_ERROR;\n //Tracev((stderr, \"inflate: allocated\\n\"));\n strm.state = state;\n state.window = null/*Z_NULL*/;\n ret = inflateReset2(strm, windowBits);\n if (ret !== Z_OK) {\n strm.state = null/*Z_NULL*/;\n }\n return ret;\n}\n\nfunction inflateInit(strm) {\n return inflateInit2(strm, DEF_WBITS);\n}\n\n\n/*\n Return state with length and distance decoding tables and index sizes set to\n fixed code decoding. Normally this returns fixed tables from inffixed.h.\n If BUILDFIXED is defined, then instead this routine builds the tables the\n first time it's called, and returns those tables the first time and\n thereafter. This reduces the size of the code by about 2K bytes, in\n exchange for a little execution time. However, BUILDFIXED should not be\n used for threaded applications, since the rewriting of the tables and virgin\n may not be thread-safe.\n */\nvar virgin = true;\n\nvar lenfix, distfix; // We have no pointers in JS, so keep tables separate\n\nfunction fixedtables(state) {\n /* build fixed huffman tables if first call (may not be thread safe) */\n if (virgin) {\n var sym;\n\n lenfix = new utils.Buf32(512);\n distfix = new utils.Buf32(32);\n\n /* literal/length table */\n sym = 0;\n while (sym < 144) { state.lens[sym++] = 8; }\n while (sym < 256) { state.lens[sym++] = 9; }\n while (sym < 280) { state.lens[sym++] = 7; }\n while (sym < 288) { state.lens[sym++] = 8; }\n\n inflate_table(LENS, state.lens, 0, 288, lenfix, 0, state.work, { bits: 9 });\n\n /* distance table */\n sym = 0;\n while (sym < 32) { state.lens[sym++] = 5; }\n\n inflate_table(DISTS, state.lens, 0, 32, distfix, 0, state.work, { bits: 5 });\n\n /* do this just once */\n virgin = false;\n }\n\n state.lencode = lenfix;\n state.lenbits = 9;\n state.distcode = distfix;\n state.distbits = 5;\n}\n\n\n/*\n Update the window with the last wsize (normally 32K) bytes written before\n returning. If window does not exist yet, create it. This is only called\n when a window is already in use, or when output has been written during this\n inflate call, but the end of the deflate stream has not been reached yet.\n It is also called to create a window for dictionary data when a dictionary\n is loaded.\n\n Providing output buffers larger than 32K to inflate() should provide a speed\n advantage, since only the last 32K of output is copied to the sliding window\n upon return from inflate(), and since all distances after the first 32K of\n output will fall in the output data, making match copies simpler and faster.\n The advantage may be dependent on the size of the processor's data caches.\n */\nfunction updatewindow(strm, src, end, copy) {\n var dist;\n var state = strm.state;\n\n /* if it hasn't been done already, allocate space for the window */\n if (state.window === null) {\n state.wsize = 1 << state.wbits;\n state.wnext = 0;\n state.whave = 0;\n\n state.window = new utils.Buf8(state.wsize);\n }\n\n /* copy state->wsize or less output bytes into the circular window */\n if (copy >= state.wsize) {\n utils.arraySet(state.window, src, end - state.wsize, state.wsize, 0);\n state.wnext = 0;\n state.whave = state.wsize;\n }\n else {\n dist = state.wsize - state.wnext;\n if (dist > copy) {\n dist = copy;\n }\n //zmemcpy(state->window + state->wnext, end - copy, dist);\n utils.arraySet(state.window, src, end - copy, dist, state.wnext);\n copy -= dist;\n if (copy) {\n //zmemcpy(state->window, end - copy, copy);\n utils.arraySet(state.window, src, end - copy, copy, 0);\n state.wnext = copy;\n state.whave = state.wsize;\n }\n else {\n state.wnext += dist;\n if (state.wnext === state.wsize) { state.wnext = 0; }\n if (state.whave < state.wsize) { state.whave += dist; }\n }\n }\n return 0;\n}\n\nfunction inflate(strm, flush) {\n var state;\n var input, output; // input/output buffers\n var next; /* next input INDEX */\n var put; /* next output INDEX */\n var have, left; /* available input and output */\n var hold; /* bit buffer */\n var bits; /* bits in bit buffer */\n var _in, _out; /* save starting available input and output */\n var copy; /* number of stored or match bytes to copy */\n var from; /* where to copy match bytes from */\n var from_source;\n var here = 0; /* current decoding table entry */\n var here_bits, here_op, here_val; // paked \"here\" denormalized (JS specific)\n //var last; /* parent table entry */\n var last_bits, last_op, last_val; // paked \"last\" denormalized (JS specific)\n var len; /* length to copy for repeats, bits to drop */\n var ret; /* return code */\n var hbuf = new utils.Buf8(4); /* buffer for gzip header crc calculation */\n var opts;\n\n var n; // temporary var for NEED_BITS\n\n var order = /* permutation of code lengths */\n [ 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15 ];\n\n\n if (!strm || !strm.state || !strm.output ||\n (!strm.input && strm.avail_in !== 0)) {\n return Z_STREAM_ERROR;\n }\n\n state = strm.state;\n if (state.mode === TYPE) { state.mode = TYPEDO; } /* skip check */\n\n\n //--- LOAD() ---\n put = strm.next_out;\n output = strm.output;\n left = strm.avail_out;\n next = strm.next_in;\n input = strm.input;\n have = strm.avail_in;\n hold = state.hold;\n bits = state.bits;\n //---\n\n _in = have;\n _out = left;\n ret = Z_OK;\n\n inf_leave: // goto emulation\n for (;;) {\n switch (state.mode) {\n case HEAD:\n if (state.wrap === 0) {\n state.mode = TYPEDO;\n break;\n }\n //=== NEEDBITS(16);\n while (bits < 16) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n if ((state.wrap & 2) && hold === 0x8b1f) { /* gzip header */\n state.check = 0/*crc32(0L, Z_NULL, 0)*/;\n //=== CRC2(state.check, hold);\n hbuf[0] = hold & 0xff;\n hbuf[1] = (hold >>> 8) & 0xff;\n state.check = crc32(state.check, hbuf, 2, 0);\n //===//\n\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n state.mode = FLAGS;\n break;\n }\n state.flags = 0; /* expect zlib header */\n if (state.head) {\n state.head.done = false;\n }\n if (!(state.wrap & 1) || /* check if zlib header allowed */\n (((hold & 0xff)/*BITS(8)*/ << 8) + (hold >> 8)) % 31) {\n strm.msg = 'incorrect header check';\n state.mode = BAD;\n break;\n }\n if ((hold & 0x0f)/*BITS(4)*/ !== Z_DEFLATED) {\n strm.msg = 'unknown compression method';\n state.mode = BAD;\n break;\n }\n //--- DROPBITS(4) ---//\n hold >>>= 4;\n bits -= 4;\n //---//\n len = (hold & 0x0f)/*BITS(4)*/ + 8;\n if (state.wbits === 0) {\n state.wbits = len;\n }\n else if (len > state.wbits) {\n strm.msg = 'invalid window size';\n state.mode = BAD;\n break;\n }\n state.dmax = 1 << len;\n //Tracev((stderr, \"inflate: zlib header ok\\n\"));\n strm.adler = state.check = 1/*adler32(0L, Z_NULL, 0)*/;\n state.mode = hold & 0x200 ? DICTID : TYPE;\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n break;\n case FLAGS:\n //=== NEEDBITS(16); */\n while (bits < 16) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.flags = hold;\n if ((state.flags & 0xff) !== Z_DEFLATED) {\n strm.msg = 'unknown compression method';\n state.mode = BAD;\n break;\n }\n if (state.flags & 0xe000) {\n strm.msg = 'unknown header flags set';\n state.mode = BAD;\n break;\n }\n if (state.head) {\n state.head.text = ((hold >> 8) & 1);\n }\n if (state.flags & 0x0200) {\n //=== CRC2(state.check, hold);\n hbuf[0] = hold & 0xff;\n hbuf[1] = (hold >>> 8) & 0xff;\n state.check = crc32(state.check, hbuf, 2, 0);\n //===//\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n state.mode = TIME;\n /* falls through */\n case TIME:\n //=== NEEDBITS(32); */\n while (bits < 32) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n if (state.head) {\n state.head.time = hold;\n }\n if (state.flags & 0x0200) {\n //=== CRC4(state.check, hold)\n hbuf[0] = hold & 0xff;\n hbuf[1] = (hold >>> 8) & 0xff;\n hbuf[2] = (hold >>> 16) & 0xff;\n hbuf[3] = (hold >>> 24) & 0xff;\n state.check = crc32(state.check, hbuf, 4, 0);\n //===\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n state.mode = OS;\n /* falls through */\n case OS:\n //=== NEEDBITS(16); */\n while (bits < 16) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n if (state.head) {\n state.head.xflags = (hold & 0xff);\n state.head.os = (hold >> 8);\n }\n if (state.flags & 0x0200) {\n //=== CRC2(state.check, hold);\n hbuf[0] = hold & 0xff;\n hbuf[1] = (hold >>> 8) & 0xff;\n state.check = crc32(state.check, hbuf, 2, 0);\n //===//\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n state.mode = EXLEN;\n /* falls through */\n case EXLEN:\n if (state.flags & 0x0400) {\n //=== NEEDBITS(16); */\n while (bits < 16) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.length = hold;\n if (state.head) {\n state.head.extra_len = hold;\n }\n if (state.flags & 0x0200) {\n //=== CRC2(state.check, hold);\n hbuf[0] = hold & 0xff;\n hbuf[1] = (hold >>> 8) & 0xff;\n state.check = crc32(state.check, hbuf, 2, 0);\n //===//\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n }\n else if (state.head) {\n state.head.extra = null/*Z_NULL*/;\n }\n state.mode = EXTRA;\n /* falls through */\n case EXTRA:\n if (state.flags & 0x0400) {\n copy = state.length;\n if (copy > have) { copy = have; }\n if (copy) {\n if (state.head) {\n len = state.head.extra_len - state.length;\n if (!state.head.extra) {\n // Use untyped array for more convenient processing later\n state.head.extra = new Array(state.head.extra_len);\n }\n utils.arraySet(\n state.head.extra,\n input,\n next,\n // extra field is limited to 65536 bytes\n // - no need for additional size check\n copy,\n /*len + copy > state.head.extra_max - len ? state.head.extra_max : copy,*/\n len\n );\n //zmemcpy(state.head.extra + len, next,\n // len + copy > state.head.extra_max ?\n // state.head.extra_max - len : copy);\n }\n if (state.flags & 0x0200) {\n state.check = crc32(state.check, input, copy, next);\n }\n have -= copy;\n next += copy;\n state.length -= copy;\n }\n if (state.length) { break inf_leave; }\n }\n state.length = 0;\n state.mode = NAME;\n /* falls through */\n case NAME:\n if (state.flags & 0x0800) {\n if (have === 0) { break inf_leave; }\n copy = 0;\n do {\n // TODO: 2 or 1 bytes?\n len = input[next + copy++];\n /* use constant limit because in js we should not preallocate memory */\n if (state.head && len &&\n (state.length < 65536 /*state.head.name_max*/)) {\n state.head.name += String.fromCharCode(len);\n }\n } while (len && copy < have);\n\n if (state.flags & 0x0200) {\n state.check = crc32(state.check, input, copy, next);\n }\n have -= copy;\n next += copy;\n if (len) { break inf_leave; }\n }\n else if (state.head) {\n state.head.name = null;\n }\n state.length = 0;\n state.mode = COMMENT;\n /* falls through */\n case COMMENT:\n if (state.flags & 0x1000) {\n if (have === 0) { break inf_leave; }\n copy = 0;\n do {\n len = input[next + copy++];\n /* use constant limit because in js we should not preallocate memory */\n if (state.head && len &&\n (state.length < 65536 /*state.head.comm_max*/)) {\n state.head.comment += String.fromCharCode(len);\n }\n } while (len && copy < have);\n if (state.flags & 0x0200) {\n state.check = crc32(state.check, input, copy, next);\n }\n have -= copy;\n next += copy;\n if (len) { break inf_leave; }\n }\n else if (state.head) {\n state.head.comment = null;\n }\n state.mode = HCRC;\n /* falls through */\n case HCRC:\n if (state.flags & 0x0200) {\n //=== NEEDBITS(16); */\n while (bits < 16) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n if (hold !== (state.check & 0xffff)) {\n strm.msg = 'header crc mismatch';\n state.mode = BAD;\n break;\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n }\n if (state.head) {\n state.head.hcrc = ((state.flags >> 9) & 1);\n state.head.done = true;\n }\n strm.adler = state.check = 0;\n state.mode = TYPE;\n break;\n case DICTID:\n //=== NEEDBITS(32); */\n while (bits < 32) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n strm.adler = state.check = zswap32(hold);\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n state.mode = DICT;\n /* falls through */\n case DICT:\n if (state.havedict === 0) {\n //--- RESTORE() ---\n strm.next_out = put;\n strm.avail_out = left;\n strm.next_in = next;\n strm.avail_in = have;\n state.hold = hold;\n state.bits = bits;\n //---\n return Z_NEED_DICT;\n }\n strm.adler = state.check = 1/*adler32(0L, Z_NULL, 0)*/;\n state.mode = TYPE;\n /* falls through */\n case TYPE:\n if (flush === Z_BLOCK || flush === Z_TREES) { break inf_leave; }\n /* falls through */\n case TYPEDO:\n if (state.last) {\n //--- BYTEBITS() ---//\n hold >>>= bits & 7;\n bits -= bits & 7;\n //---//\n state.mode = CHECK;\n break;\n }\n //=== NEEDBITS(3); */\n while (bits < 3) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.last = (hold & 0x01)/*BITS(1)*/;\n //--- DROPBITS(1) ---//\n hold >>>= 1;\n bits -= 1;\n //---//\n\n switch ((hold & 0x03)/*BITS(2)*/) {\n case 0: /* stored block */\n //Tracev((stderr, \"inflate: stored block%s\\n\",\n // state.last ? \" (last)\" : \"\"));\n state.mode = STORED;\n break;\n case 1: /* fixed block */\n fixedtables(state);\n //Tracev((stderr, \"inflate: fixed codes block%s\\n\",\n // state.last ? \" (last)\" : \"\"));\n state.mode = LEN_; /* decode codes */\n if (flush === Z_TREES) {\n //--- DROPBITS(2) ---//\n hold >>>= 2;\n bits -= 2;\n //---//\n break inf_leave;\n }\n break;\n case 2: /* dynamic block */\n //Tracev((stderr, \"inflate: dynamic codes block%s\\n\",\n // state.last ? \" (last)\" : \"\"));\n state.mode = TABLE;\n break;\n case 3:\n strm.msg = 'invalid block type';\n state.mode = BAD;\n }\n //--- DROPBITS(2) ---//\n hold >>>= 2;\n bits -= 2;\n //---//\n break;\n case STORED:\n //--- BYTEBITS() ---// /* go to byte boundary */\n hold >>>= bits & 7;\n bits -= bits & 7;\n //---//\n //=== NEEDBITS(32); */\n while (bits < 32) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n if ((hold & 0xffff) !== ((hold >>> 16) ^ 0xffff)) {\n strm.msg = 'invalid stored block lengths';\n state.mode = BAD;\n break;\n }\n state.length = hold & 0xffff;\n //Tracev((stderr, \"inflate: stored length %u\\n\",\n // state.length));\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n state.mode = COPY_;\n if (flush === Z_TREES) { break inf_leave; }\n /* falls through */\n case COPY_:\n state.mode = COPY;\n /* falls through */\n case COPY:\n copy = state.length;\n if (copy) {\n if (copy > have) { copy = have; }\n if (copy > left) { copy = left; }\n if (copy === 0) { break inf_leave; }\n //--- zmemcpy(put, next, copy); ---\n utils.arraySet(output, input, next, copy, put);\n //---//\n have -= copy;\n next += copy;\n left -= copy;\n put += copy;\n state.length -= copy;\n break;\n }\n //Tracev((stderr, \"inflate: stored end\\n\"));\n state.mode = TYPE;\n break;\n case TABLE:\n //=== NEEDBITS(14); */\n while (bits < 14) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.nlen = (hold & 0x1f)/*BITS(5)*/ + 257;\n //--- DROPBITS(5) ---//\n hold >>>= 5;\n bits -= 5;\n //---//\n state.ndist = (hold & 0x1f)/*BITS(5)*/ + 1;\n //--- DROPBITS(5) ---//\n hold >>>= 5;\n bits -= 5;\n //---//\n state.ncode = (hold & 0x0f)/*BITS(4)*/ + 4;\n //--- DROPBITS(4) ---//\n hold >>>= 4;\n bits -= 4;\n //---//\n//#ifndef PKZIP_BUG_WORKAROUND\n if (state.nlen > 286 || state.ndist > 30) {\n strm.msg = 'too many length or distance symbols';\n state.mode = BAD;\n break;\n }\n//#endif\n //Tracev((stderr, \"inflate: table sizes ok\\n\"));\n state.have = 0;\n state.mode = LENLENS;\n /* falls through */\n case LENLENS:\n while (state.have < state.ncode) {\n //=== NEEDBITS(3);\n while (bits < 3) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.lens[order[state.have++]] = (hold & 0x07);//BITS(3);\n //--- DROPBITS(3) ---//\n hold >>>= 3;\n bits -= 3;\n //---//\n }\n while (state.have < 19) {\n state.lens[order[state.have++]] = 0;\n }\n // We have separate tables & no pointers. 2 commented lines below not needed.\n //state.next = state.codes;\n //state.lencode = state.next;\n // Switch to use dynamic table\n state.lencode = state.lendyn;\n state.lenbits = 7;\n\n opts = { bits: state.lenbits };\n ret = inflate_table(CODES, state.lens, 0, 19, state.lencode, 0, state.work, opts);\n state.lenbits = opts.bits;\n\n if (ret) {\n strm.msg = 'invalid code lengths set';\n state.mode = BAD;\n break;\n }\n //Tracev((stderr, \"inflate: code lengths ok\\n\"));\n state.have = 0;\n state.mode = CODELENS;\n /* falls through */\n case CODELENS:\n while (state.have < state.nlen + state.ndist) {\n for (;;) {\n here = state.lencode[hold & ((1 << state.lenbits) - 1)];/*BITS(state.lenbits)*/\n here_bits = here >>> 24;\n here_op = (here >>> 16) & 0xff;\n here_val = here & 0xffff;\n\n if ((here_bits) <= bits) { break; }\n //--- PULLBYTE() ---//\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n //---//\n }\n if (here_val < 16) {\n //--- DROPBITS(here.bits) ---//\n hold >>>= here_bits;\n bits -= here_bits;\n //---//\n state.lens[state.have++] = here_val;\n }\n else {\n if (here_val === 16) {\n //=== NEEDBITS(here.bits + 2);\n n = here_bits + 2;\n while (bits < n) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n //--- DROPBITS(here.bits) ---//\n hold >>>= here_bits;\n bits -= here_bits;\n //---//\n if (state.have === 0) {\n strm.msg = 'invalid bit length repeat';\n state.mode = BAD;\n break;\n }\n len = state.lens[state.have - 1];\n copy = 3 + (hold & 0x03);//BITS(2);\n //--- DROPBITS(2) ---//\n hold >>>= 2;\n bits -= 2;\n //---//\n }\n else if (here_val === 17) {\n //=== NEEDBITS(here.bits + 3);\n n = here_bits + 3;\n while (bits < n) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n //--- DROPBITS(here.bits) ---//\n hold >>>= here_bits;\n bits -= here_bits;\n //---//\n len = 0;\n copy = 3 + (hold & 0x07);//BITS(3);\n //--- DROPBITS(3) ---//\n hold >>>= 3;\n bits -= 3;\n //---//\n }\n else {\n //=== NEEDBITS(here.bits + 7);\n n = here_bits + 7;\n while (bits < n) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n //--- DROPBITS(here.bits) ---//\n hold >>>= here_bits;\n bits -= here_bits;\n //---//\n len = 0;\n copy = 11 + (hold & 0x7f);//BITS(7);\n //--- DROPBITS(7) ---//\n hold >>>= 7;\n bits -= 7;\n //---//\n }\n if (state.have + copy > state.nlen + state.ndist) {\n strm.msg = 'invalid bit length repeat';\n state.mode = BAD;\n break;\n }\n while (copy--) {\n state.lens[state.have++] = len;\n }\n }\n }\n\n /* handle error breaks in while */\n if (state.mode === BAD) { break; }\n\n /* check for end-of-block code (better have one) */\n if (state.lens[256] === 0) {\n strm.msg = 'invalid code -- missing end-of-block';\n state.mode = BAD;\n break;\n }\n\n /* build code tables -- note: do not change the lenbits or distbits\n values here (9 and 6) without reading the comments in inftrees.h\n concerning the ENOUGH constants, which depend on those values */\n state.lenbits = 9;\n\n opts = { bits: state.lenbits };\n ret = inflate_table(LENS, state.lens, 0, state.nlen, state.lencode, 0, state.work, opts);\n // We have separate tables & no pointers. 2 commented lines below not needed.\n // state.next_index = opts.table_index;\n state.lenbits = opts.bits;\n // state.lencode = state.next;\n\n if (ret) {\n strm.msg = 'invalid literal/lengths set';\n state.mode = BAD;\n break;\n }\n\n state.distbits = 6;\n //state.distcode.copy(state.codes);\n // Switch to use dynamic table\n state.distcode = state.distdyn;\n opts = { bits: state.distbits };\n ret = inflate_table(DISTS, state.lens, state.nlen, state.ndist, state.distcode, 0, state.work, opts);\n // We have separate tables & no pointers. 2 commented lines below not needed.\n // state.next_index = opts.table_index;\n state.distbits = opts.bits;\n // state.distcode = state.next;\n\n if (ret) {\n strm.msg = 'invalid distances set';\n state.mode = BAD;\n break;\n }\n //Tracev((stderr, 'inflate: codes ok\\n'));\n state.mode = LEN_;\n if (flush === Z_TREES) { break inf_leave; }\n /* falls through */\n case LEN_:\n state.mode = LEN;\n /* falls through */\n case LEN:\n if (have >= 6 && left >= 258) {\n //--- RESTORE() ---\n strm.next_out = put;\n strm.avail_out = left;\n strm.next_in = next;\n strm.avail_in = have;\n state.hold = hold;\n state.bits = bits;\n //---\n inflate_fast(strm, _out);\n //--- LOAD() ---\n put = strm.next_out;\n output = strm.output;\n left = strm.avail_out;\n next = strm.next_in;\n input = strm.input;\n have = strm.avail_in;\n hold = state.hold;\n bits = state.bits;\n //---\n\n if (state.mode === TYPE) {\n state.back = -1;\n }\n break;\n }\n state.back = 0;\n for (;;) {\n here = state.lencode[hold & ((1 << state.lenbits) - 1)]; /*BITS(state.lenbits)*/\n here_bits = here >>> 24;\n here_op = (here >>> 16) & 0xff;\n here_val = here & 0xffff;\n\n if (here_bits <= bits) { break; }\n //--- PULLBYTE() ---//\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n //---//\n }\n if (here_op && (here_op & 0xf0) === 0) {\n last_bits = here_bits;\n last_op = here_op;\n last_val = here_val;\n for (;;) {\n here = state.lencode[last_val +\n ((hold & ((1 << (last_bits + last_op)) - 1))/*BITS(last.bits + last.op)*/ >> last_bits)];\n here_bits = here >>> 24;\n here_op = (here >>> 16) & 0xff;\n here_val = here & 0xffff;\n\n if ((last_bits + here_bits) <= bits) { break; }\n //--- PULLBYTE() ---//\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n //---//\n }\n //--- DROPBITS(last.bits) ---//\n hold >>>= last_bits;\n bits -= last_bits;\n //---//\n state.back += last_bits;\n }\n //--- DROPBITS(here.bits) ---//\n hold >>>= here_bits;\n bits -= here_bits;\n //---//\n state.back += here_bits;\n state.length = here_val;\n if (here_op === 0) {\n //Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ?\n // \"inflate: literal '%c'\\n\" :\n // \"inflate: literal 0x%02x\\n\", here.val));\n state.mode = LIT;\n break;\n }\n if (here_op & 32) {\n //Tracevv((stderr, \"inflate: end of block\\n\"));\n state.back = -1;\n state.mode = TYPE;\n break;\n }\n if (here_op & 64) {\n strm.msg = 'invalid literal/length code';\n state.mode = BAD;\n break;\n }\n state.extra = here_op & 15;\n state.mode = LENEXT;\n /* falls through */\n case LENEXT:\n if (state.extra) {\n //=== NEEDBITS(state.extra);\n n = state.extra;\n while (bits < n) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.length += hold & ((1 << state.extra) - 1)/*BITS(state.extra)*/;\n //--- DROPBITS(state.extra) ---//\n hold >>>= state.extra;\n bits -= state.extra;\n //---//\n state.back += state.extra;\n }\n //Tracevv((stderr, \"inflate: length %u\\n\", state.length));\n state.was = state.length;\n state.mode = DIST;\n /* falls through */\n case DIST:\n for (;;) {\n here = state.distcode[hold & ((1 << state.distbits) - 1)];/*BITS(state.distbits)*/\n here_bits = here >>> 24;\n here_op = (here >>> 16) & 0xff;\n here_val = here & 0xffff;\n\n if ((here_bits) <= bits) { break; }\n //--- PULLBYTE() ---//\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n //---//\n }\n if ((here_op & 0xf0) === 0) {\n last_bits = here_bits;\n last_op = here_op;\n last_val = here_val;\n for (;;) {\n here = state.distcode[last_val +\n ((hold & ((1 << (last_bits + last_op)) - 1))/*BITS(last.bits + last.op)*/ >> last_bits)];\n here_bits = here >>> 24;\n here_op = (here >>> 16) & 0xff;\n here_val = here & 0xffff;\n\n if ((last_bits + here_bits) <= bits) { break; }\n //--- PULLBYTE() ---//\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n //---//\n }\n //--- DROPBITS(last.bits) ---//\n hold >>>= last_bits;\n bits -= last_bits;\n //---//\n state.back += last_bits;\n }\n //--- DROPBITS(here.bits) ---//\n hold >>>= here_bits;\n bits -= here_bits;\n //---//\n state.back += here_bits;\n if (here_op & 64) {\n strm.msg = 'invalid distance code';\n state.mode = BAD;\n break;\n }\n state.offset = here_val;\n state.extra = (here_op) & 15;\n state.mode = DISTEXT;\n /* falls through */\n case DISTEXT:\n if (state.extra) {\n //=== NEEDBITS(state.extra);\n n = state.extra;\n while (bits < n) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.offset += hold & ((1 << state.extra) - 1)/*BITS(state.extra)*/;\n //--- DROPBITS(state.extra) ---//\n hold >>>= state.extra;\n bits -= state.extra;\n //---//\n state.back += state.extra;\n }\n//#ifdef INFLATE_STRICT\n if (state.offset > state.dmax) {\n strm.msg = 'invalid distance too far back';\n state.mode = BAD;\n break;\n }\n//#endif\n //Tracevv((stderr, \"inflate: distance %u\\n\", state.offset));\n state.mode = MATCH;\n /* falls through */\n case MATCH:\n if (left === 0) { break inf_leave; }\n copy = _out - left;\n if (state.offset > copy) { /* copy from window */\n copy = state.offset - copy;\n if (copy > state.whave) {\n if (state.sane) {\n strm.msg = 'invalid distance too far back';\n state.mode = BAD;\n break;\n }\n// (!) This block is disabled in zlib defaults,\n// don't enable it for binary compatibility\n//#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR\n// Trace((stderr, \"inflate.c too far\\n\"));\n// copy -= state.whave;\n// if (copy > state.length) { copy = state.length; }\n// if (copy > left) { copy = left; }\n// left -= copy;\n// state.length -= copy;\n// do {\n// output[put++] = 0;\n// } while (--copy);\n// if (state.length === 0) { state.mode = LEN; }\n// break;\n//#endif\n }\n if (copy > state.wnext) {\n copy -= state.wnext;\n from = state.wsize - copy;\n }\n else {\n from = state.wnext - copy;\n }\n if (copy > state.length) { copy = state.length; }\n from_source = state.window;\n }\n else { /* copy from output */\n from_source = output;\n from = put - state.offset;\n copy = state.length;\n }\n if (copy > left) { copy = left; }\n left -= copy;\n state.length -= copy;\n do {\n output[put++] = from_source[from++];\n } while (--copy);\n if (state.length === 0) { state.mode = LEN; }\n break;\n case LIT:\n if (left === 0) { break inf_leave; }\n output[put++] = state.length;\n left--;\n state.mode = LEN;\n break;\n case CHECK:\n if (state.wrap) {\n //=== NEEDBITS(32);\n while (bits < 32) {\n if (have === 0) { break inf_leave; }\n have--;\n // Use '|' instead of '+' to make sure that result is signed\n hold |= input[next++] << bits;\n bits += 8;\n }\n //===//\n _out -= left;\n strm.total_out += _out;\n state.total += _out;\n if (_out) {\n strm.adler = state.check =\n /*UPDATE(state.check, put - _out, _out);*/\n (state.flags ? crc32(state.check, output, _out, put - _out) : adler32(state.check, output, _out, put - _out));\n\n }\n _out = left;\n // NB: crc32 stored as signed 32-bit int, zswap32 returns signed too\n if ((state.flags ? hold : zswap32(hold)) !== state.check) {\n strm.msg = 'incorrect data check';\n state.mode = BAD;\n break;\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n //Tracev((stderr, \"inflate: check matches trailer\\n\"));\n }\n state.mode = LENGTH;\n /* falls through */\n case LENGTH:\n if (state.wrap && state.flags) {\n //=== NEEDBITS(32);\n while (bits < 32) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n if (hold !== (state.total & 0xffffffff)) {\n strm.msg = 'incorrect length check';\n state.mode = BAD;\n break;\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n //Tracev((stderr, \"inflate: length matches trailer\\n\"));\n }\n state.mode = DONE;\n /* falls through */\n case DONE:\n ret = Z_STREAM_END;\n break inf_leave;\n case BAD:\n ret = Z_DATA_ERROR;\n break inf_leave;\n case MEM:\n return Z_MEM_ERROR;\n case SYNC:\n /* falls through */\n default:\n return Z_STREAM_ERROR;\n }\n }\n\n // inf_leave <- here is real place for \"goto inf_leave\", emulated via \"break inf_leave\"\n\n /*\n Return from inflate(), updating the total counts and the check value.\n If there was no progress during the inflate() call, return a buffer\n error. Call updatewindow() to create and/or update the window state.\n Note: a memory error from inflate() is non-recoverable.\n */\n\n //--- RESTORE() ---\n strm.next_out = put;\n strm.avail_out = left;\n strm.next_in = next;\n strm.avail_in = have;\n state.hold = hold;\n state.bits = bits;\n //---\n\n if (state.wsize || (_out !== strm.avail_out && state.mode < BAD &&\n (state.mode < CHECK || flush !== Z_FINISH))) {\n if (updatewindow(strm, strm.output, strm.next_out, _out - strm.avail_out)) {\n state.mode = MEM;\n return Z_MEM_ERROR;\n }\n }\n _in -= strm.avail_in;\n _out -= strm.avail_out;\n strm.total_in += _in;\n strm.total_out += _out;\n state.total += _out;\n if (state.wrap && _out) {\n strm.adler = state.check = /*UPDATE(state.check, strm.next_out - _out, _out);*/\n (state.flags ? crc32(state.check, output, _out, strm.next_out - _out) : adler32(state.check, output, _out, strm.next_out - _out));\n }\n strm.data_type = state.bits + (state.last ? 64 : 0) +\n (state.mode === TYPE ? 128 : 0) +\n (state.mode === LEN_ || state.mode === COPY_ ? 256 : 0);\n if (((_in === 0 && _out === 0) || flush === Z_FINISH) && ret === Z_OK) {\n ret = Z_BUF_ERROR;\n }\n return ret;\n}\n\nfunction inflateEnd(strm) {\n\n if (!strm || !strm.state /*|| strm->zfree == (free_func)0*/) {\n return Z_STREAM_ERROR;\n }\n\n var state = strm.state;\n if (state.window) {\n state.window = null;\n }\n strm.state = null;\n return Z_OK;\n}\n\nfunction inflateGetHeader(strm, head) {\n var state;\n\n /* check state */\n if (!strm || !strm.state) { return Z_STREAM_ERROR; }\n state = strm.state;\n if ((state.wrap & 2) === 0) { return Z_STREAM_ERROR; }\n\n /* save header structure */\n state.head = head;\n head.done = false;\n return Z_OK;\n}\n\nfunction inflateSetDictionary(strm, dictionary) {\n var dictLength = dictionary.length;\n\n var state;\n var dictid;\n var ret;\n\n /* check state */\n if (!strm /* == Z_NULL */ || !strm.state /* == Z_NULL */) { return Z_STREAM_ERROR; }\n state = strm.state;\n\n if (state.wrap !== 0 && state.mode !== DICT) {\n return Z_STREAM_ERROR;\n }\n\n /* check for correct dictionary identifier */\n if (state.mode === DICT) {\n dictid = 1; /* adler32(0, null, 0)*/\n /* dictid = adler32(dictid, dictionary, dictLength); */\n dictid = adler32(dictid, dictionary, dictLength, 0);\n if (dictid !== state.check) {\n return Z_DATA_ERROR;\n }\n }\n /* copy dictionary to window using updatewindow(), which will amend the\n existing dictionary if appropriate */\n ret = updatewindow(strm, dictionary, dictLength, dictLength);\n if (ret) {\n state.mode = MEM;\n return Z_MEM_ERROR;\n }\n state.havedict = 1;\n // Tracev((stderr, \"inflate: dictionary set\\n\"));\n return Z_OK;\n}\n\nexports.inflateReset = inflateReset;\nexports.inflateReset2 = inflateReset2;\nexports.inflateResetKeep = inflateResetKeep;\nexports.inflateInit = inflateInit;\nexports.inflateInit2 = inflateInit2;\nexports.inflate = inflate;\nexports.inflateEnd = inflateEnd;\nexports.inflateGetHeader = inflateGetHeader;\nexports.inflateSetDictionary = inflateSetDictionary;\nexports.inflateInfo = 'pako inflate (from Nodeca project)';\n\n/* Not implemented\nexports.inflateCopy = inflateCopy;\nexports.inflateGetDictionary = inflateGetDictionary;\nexports.inflateMark = inflateMark;\nexports.inflatePrime = inflatePrime;\nexports.inflateSync = inflateSync;\nexports.inflateSyncPoint = inflateSyncPoint;\nexports.inflateUndermine = inflateUndermine;\n*/\n","'use strict';\n\n\nvar zlib_inflate = require('./zlib/inflate');\nvar utils = require('./utils/common');\nvar strings = require('./utils/strings');\nvar c = require('./zlib/constants');\nvar msg = require('./zlib/messages');\nvar ZStream = require('./zlib/zstream');\nvar GZheader = require('./zlib/gzheader');\n\nvar toString = Object.prototype.toString;\n\n/**\n * class Inflate\n *\n * Generic JS-style wrapper for zlib calls. If you don't need\n * streaming behaviour - use more simple functions: [[inflate]]\n * and [[inflateRaw]].\n **/\n\n/* internal\n * inflate.chunks -> Array\n *\n * Chunks of output data, if [[Inflate#onData]] not overridden.\n **/\n\n/**\n * Inflate.result -> Uint8Array|Array|String\n *\n * Uncompressed result, generated by default [[Inflate#onData]]\n * and [[Inflate#onEnd]] handlers. Filled after you push last chunk\n * (call [[Inflate#push]] with `Z_FINISH` / `true` param) or if you\n * push a chunk with explicit flush (call [[Inflate#push]] with\n * `Z_SYNC_FLUSH` param).\n **/\n\n/**\n * Inflate.err -> Number\n *\n * Error code after inflate finished. 0 (Z_OK) on success.\n * Should be checked if broken data possible.\n **/\n\n/**\n * Inflate.msg -> String\n *\n * Error message, if [[Inflate.err]] != 0\n **/\n\n\n/**\n * new Inflate(options)\n * - options (Object): zlib inflate options.\n *\n * Creates new inflator instance with specified params. Throws exception\n * on bad params. Supported options:\n *\n * - `windowBits`\n * - `dictionary`\n *\n * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced)\n * for more information on these.\n *\n * Additional options, for internal needs:\n *\n * - `chunkSize` - size of generated data chunks (16K by default)\n * - `raw` (Boolean) - do raw inflate\n * - `to` (String) - if equal to 'string', then result will be converted\n * from utf8 to utf16 (javascript) string. When string output requested,\n * chunk length can differ from `chunkSize`, depending on content.\n *\n * By default, when no options set, autodetect deflate/gzip data format via\n * wrapper header.\n *\n * ##### Example:\n *\n * ```javascript\n * var pako = require('pako')\n * , chunk1 = Uint8Array([1,2,3,4,5,6,7,8,9])\n * , chunk2 = Uint8Array([10,11,12,13,14,15,16,17,18,19]);\n *\n * var inflate = new pako.Inflate({ level: 3});\n *\n * inflate.push(chunk1, false);\n * inflate.push(chunk2, true); // true -> last chunk\n *\n * if (inflate.err) { throw new Error(inflate.err); }\n *\n * console.log(inflate.result);\n * ```\n **/\nfunction Inflate(options) {\n if (!(this instanceof Inflate)) return new Inflate(options);\n\n this.options = utils.assign({\n chunkSize: 16384,\n windowBits: 0,\n to: ''\n }, options || {});\n\n var opt = this.options;\n\n // Force window size for `raw` data, if not set directly,\n // because we have no header for autodetect.\n if (opt.raw && (opt.windowBits >= 0) && (opt.windowBits < 16)) {\n opt.windowBits = -opt.windowBits;\n if (opt.windowBits === 0) { opt.windowBits = -15; }\n }\n\n // If `windowBits` not defined (and mode not raw) - set autodetect flag for gzip/deflate\n if ((opt.windowBits >= 0) && (opt.windowBits < 16) &&\n !(options && options.windowBits)) {\n opt.windowBits += 32;\n }\n\n // Gzip header has no info about windows size, we can do autodetect only\n // for deflate. So, if window size not set, force it to max when gzip possible\n if ((opt.windowBits > 15) && (opt.windowBits < 48)) {\n // bit 3 (16) -> gzipped data\n // bit 4 (32) -> autodetect gzip/deflate\n if ((opt.windowBits & 15) === 0) {\n opt.windowBits |= 15;\n }\n }\n\n this.err = 0; // error code, if happens (0 = Z_OK)\n this.msg = ''; // error message\n this.ended = false; // used to avoid multiple onEnd() calls\n this.chunks = []; // chunks of compressed data\n\n this.strm = new ZStream();\n this.strm.avail_out = 0;\n\n var status = zlib_inflate.inflateInit2(\n this.strm,\n opt.windowBits\n );\n\n if (status !== c.Z_OK) {\n throw new Error(msg[status]);\n }\n\n this.header = new GZheader();\n\n zlib_inflate.inflateGetHeader(this.strm, this.header);\n}\n\n/**\n * Inflate#push(data[, mode]) -> Boolean\n * - data (Uint8Array|Array|ArrayBuffer|String): input data\n * - mode (Number|Boolean): 0..6 for corresponding Z_NO_FLUSH..Z_TREE modes.\n * See constants. Skipped or `false` means Z_NO_FLUSH, `true` means Z_FINISH.\n *\n * Sends input data to inflate pipe, generating [[Inflate#onData]] calls with\n * new output chunks. Returns `true` on success. The last data block must have\n * mode Z_FINISH (or `true`). That will flush internal pending buffers and call\n * [[Inflate#onEnd]]. For interim explicit flushes (without ending the stream) you\n * can use mode Z_SYNC_FLUSH, keeping the decompression context.\n *\n * On fail call [[Inflate#onEnd]] with error code and return false.\n *\n * We strongly recommend to use `Uint8Array` on input for best speed (output\n * format is detected automatically). Also, don't skip last param and always\n * use the same type in your code (boolean or number). That will improve JS speed.\n *\n * For regular `Array`-s make sure all elements are [0..255].\n *\n * ##### Example\n *\n * ```javascript\n * push(chunk, false); // push one of data chunks\n * ...\n * push(chunk, true); // push last chunk\n * ```\n **/\nInflate.prototype.push = function (data, mode) {\n var strm = this.strm;\n var chunkSize = this.options.chunkSize;\n var dictionary = this.options.dictionary;\n var status, _mode;\n var next_out_utf8, tail, utf8str;\n var dict;\n\n // Flag to properly process Z_BUF_ERROR on testing inflate call\n // when we check that all output data was flushed.\n var allowBufError = false;\n\n if (this.ended) { return false; }\n _mode = (mode === ~~mode) ? mode : ((mode === true) ? c.Z_FINISH : c.Z_NO_FLUSH);\n\n // Convert data if needed\n if (typeof data === 'string') {\n // Only binary strings can be decompressed on practice\n strm.input = strings.binstring2buf(data);\n } else if (toString.call(data) === '[object ArrayBuffer]') {\n strm.input = new Uint8Array(data);\n } else {\n strm.input = data;\n }\n\n strm.next_in = 0;\n strm.avail_in = strm.input.length;\n\n do {\n if (strm.avail_out === 0) {\n strm.output = new utils.Buf8(chunkSize);\n strm.next_out = 0;\n strm.avail_out = chunkSize;\n }\n\n status = zlib_inflate.inflate(strm, c.Z_NO_FLUSH); /* no bad return value */\n\n if (status === c.Z_NEED_DICT && dictionary) {\n // Convert data if needed\n if (typeof dictionary === 'string') {\n dict = strings.string2buf(dictionary);\n } else if (toString.call(dictionary) === '[object ArrayBuffer]') {\n dict = new Uint8Array(dictionary);\n } else {\n dict = dictionary;\n }\n\n status = zlib_inflate.inflateSetDictionary(this.strm, dict);\n\n }\n\n if (status === c.Z_BUF_ERROR && allowBufError === true) {\n status = c.Z_OK;\n allowBufError = false;\n }\n\n if (status !== c.Z_STREAM_END && status !== c.Z_OK) {\n this.onEnd(status);\n this.ended = true;\n return false;\n }\n\n if (strm.next_out) {\n if (strm.avail_out === 0 || status === c.Z_STREAM_END || (strm.avail_in === 0 && (_mode === c.Z_FINISH || _mode === c.Z_SYNC_FLUSH))) {\n\n if (this.options.to === 'string') {\n\n next_out_utf8 = strings.utf8border(strm.output, strm.next_out);\n\n tail = strm.next_out - next_out_utf8;\n utf8str = strings.buf2string(strm.output, next_out_utf8);\n\n // move tail\n strm.next_out = tail;\n strm.avail_out = chunkSize - tail;\n if (tail) { utils.arraySet(strm.output, strm.output, next_out_utf8, tail, 0); }\n\n this.onData(utf8str);\n\n } else {\n this.onData(utils.shrinkBuf(strm.output, strm.next_out));\n }\n }\n }\n\n // When no more input data, we should check that internal inflate buffers\n // are flushed. The only way to do it when avail_out = 0 - run one more\n // inflate pass. But if output data not exists, inflate return Z_BUF_ERROR.\n // Here we set flag to process this error properly.\n //\n // NOTE. Deflate does not return error in this case and does not needs such\n // logic.\n if (strm.avail_in === 0 && strm.avail_out === 0) {\n allowBufError = true;\n }\n\n } while ((strm.avail_in > 0 || strm.avail_out === 0) && status !== c.Z_STREAM_END);\n\n if (status === c.Z_STREAM_END) {\n _mode = c.Z_FINISH;\n }\n\n // Finalize on the last chunk.\n if (_mode === c.Z_FINISH) {\n status = zlib_inflate.inflateEnd(this.strm);\n this.onEnd(status);\n this.ended = true;\n return status === c.Z_OK;\n }\n\n // callback interim results if Z_SYNC_FLUSH.\n if (_mode === c.Z_SYNC_FLUSH) {\n this.onEnd(c.Z_OK);\n strm.avail_out = 0;\n return true;\n }\n\n return true;\n};\n\n\n/**\n * Inflate#onData(chunk) -> Void\n * - chunk (Uint8Array|Array|String): output data. Type of array depends\n * on js engine support. When string output requested, each chunk\n * will be string.\n *\n * By default, stores data blocks in `chunks[]` property and glue\n * those in `onEnd`. Override this handler, if you need another behaviour.\n **/\nInflate.prototype.onData = function (chunk) {\n this.chunks.push(chunk);\n};\n\n\n/**\n * Inflate#onEnd(status) -> Void\n * - status (Number): inflate status. 0 (Z_OK) on success,\n * other if not.\n *\n * Called either after you tell inflate that the input stream is\n * complete (Z_FINISH) or should be flushed (Z_SYNC_FLUSH)\n * or if an error happened. By default - join collected chunks,\n * free memory and fill `results` / `err` properties.\n **/\nInflate.prototype.onEnd = function (status) {\n // On success - join\n if (status === c.Z_OK) {\n if (this.options.to === 'string') {\n // Glue & convert here, until we teach pako to send\n // utf8 aligned strings to onData\n this.result = this.chunks.join('');\n } else {\n this.result = utils.flattenChunks(this.chunks);\n }\n }\n this.chunks = [];\n this.err = status;\n this.msg = this.strm.msg;\n};\n\n\n/**\n * inflate(data[, options]) -> Uint8Array|Array|String\n * - data (Uint8Array|Array|String): input data to decompress.\n * - options (Object): zlib inflate options.\n *\n * Decompress `data` with inflate/ungzip and `options`. Autodetect\n * format via wrapper header by default. That's why we don't provide\n * separate `ungzip` method.\n *\n * Supported options are:\n *\n * - windowBits\n *\n * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced)\n * for more information.\n *\n * Sugar (options):\n *\n * - `raw` (Boolean) - say that we work with raw stream, if you don't wish to specify\n * negative windowBits implicitly.\n * - `to` (String) - if equal to 'string', then result will be converted\n * from utf8 to utf16 (javascript) string. When string output requested,\n * chunk length can differ from `chunkSize`, depending on content.\n *\n *\n * ##### Example:\n *\n * ```javascript\n * var pako = require('pako')\n * , input = pako.deflate([1,2,3,4,5,6,7,8,9])\n * , output;\n *\n * try {\n * output = pako.inflate(input);\n * } catch (err)\n * console.log(err);\n * }\n * ```\n **/\nfunction inflate(input, options) {\n var inflator = new Inflate(options);\n\n inflator.push(input, true);\n\n // That will never happens, if you don't cheat with options :)\n if (inflator.err) { throw inflator.msg || msg[inflator.err]; }\n\n return inflator.result;\n}\n\n\n/**\n * inflateRaw(data[, options]) -> Uint8Array|Array|String\n * - data (Uint8Array|Array|String): input data to decompress.\n * - options (Object): zlib inflate options.\n *\n * The same as [[inflate]], but creates raw data, without wrapper\n * (header and adler32 crc).\n **/\nfunction inflateRaw(input, options) {\n options = options || {};\n options.raw = true;\n return inflate(input, options);\n}\n\n\n/**\n * ungzip(data[, options]) -> Uint8Array|Array|String\n * - data (Uint8Array|Array|String): input data to decompress.\n * - options (Object): zlib inflate options.\n *\n * Just shortcut to [[inflate]], because it autodetects format\n * by header.content. Done for convenience.\n **/\n\n\nexports.Inflate = Inflate;\nexports.inflate = inflate;\nexports.inflateRaw = inflateRaw;\nexports.ungzip = inflate;\n","'use strict';\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\nvar utils = require('../utils/common');\n\n/* Public constants ==========================================================*/\n/* ===========================================================================*/\n\n\n//var Z_FILTERED = 1;\n//var Z_HUFFMAN_ONLY = 2;\n//var Z_RLE = 3;\nvar Z_FIXED = 4;\n//var Z_DEFAULT_STRATEGY = 0;\n\n/* Possible values of the data_type field (though see inflate()) */\nvar Z_BINARY = 0;\nvar Z_TEXT = 1;\n//var Z_ASCII = 1; // = Z_TEXT\nvar Z_UNKNOWN = 2;\n\n/*============================================================================*/\n\n\nfunction zero(buf) { var len = buf.length; while (--len >= 0) { buf[len] = 0; } }\n\n// From zutil.h\n\nvar STORED_BLOCK = 0;\nvar STATIC_TREES = 1;\nvar DYN_TREES = 2;\n/* The three kinds of block type */\n\nvar MIN_MATCH = 3;\nvar MAX_MATCH = 258;\n/* The minimum and maximum match lengths */\n\n// From deflate.h\n/* ===========================================================================\n * Internal compression state.\n */\n\nvar LENGTH_CODES = 29;\n/* number of length codes, not counting the special END_BLOCK code */\n\nvar LITERALS = 256;\n/* number of literal bytes 0..255 */\n\nvar L_CODES = LITERALS + 1 + LENGTH_CODES;\n/* number of Literal or Length codes, including the END_BLOCK code */\n\nvar D_CODES = 30;\n/* number of distance codes */\n\nvar BL_CODES = 19;\n/* number of codes used to transfer the bit lengths */\n\nvar HEAP_SIZE = 2 * L_CODES + 1;\n/* maximum heap size */\n\nvar MAX_BITS = 15;\n/* All codes must not exceed MAX_BITS bits */\n\nvar Buf_size = 16;\n/* size of bit buffer in bi_buf */\n\n\n/* ===========================================================================\n * Constants\n */\n\nvar MAX_BL_BITS = 7;\n/* Bit length codes must not exceed MAX_BL_BITS bits */\n\nvar END_BLOCK = 256;\n/* end of block literal code */\n\nvar REP_3_6 = 16;\n/* repeat previous bit length 3-6 times (2 bits of repeat count) */\n\nvar REPZ_3_10 = 17;\n/* repeat a zero length 3-10 times (3 bits of repeat count) */\n\nvar REPZ_11_138 = 18;\n/* repeat a zero length 11-138 times (7 bits of repeat count) */\n\n/* eslint-disable comma-spacing,array-bracket-spacing */\nvar extra_lbits = /* extra bits for each length code */\n [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];\n\nvar extra_dbits = /* extra bits for each distance code */\n [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];\n\nvar extra_blbits = /* extra bits for each bit length code */\n [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7];\n\nvar bl_order =\n [16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];\n/* eslint-enable comma-spacing,array-bracket-spacing */\n\n/* The lengths of the bit length codes are sent in order of decreasing\n * probability, to avoid transmitting the lengths for unused bit length codes.\n */\n\n/* ===========================================================================\n * Local data. These are initialized only once.\n */\n\n// We pre-fill arrays with 0 to avoid uninitialized gaps\n\nvar DIST_CODE_LEN = 512; /* see definition of array dist_code below */\n\n// !!!! Use flat array instead of structure, Freq = i*2, Len = i*2+1\nvar static_ltree = new Array((L_CODES + 2) * 2);\nzero(static_ltree);\n/* The static literal tree. Since the bit lengths are imposed, there is no\n * need for the L_CODES extra codes used during heap construction. However\n * The codes 286 and 287 are needed to build a canonical tree (see _tr_init\n * below).\n */\n\nvar static_dtree = new Array(D_CODES * 2);\nzero(static_dtree);\n/* The static distance tree. (Actually a trivial tree since all codes use\n * 5 bits.)\n */\n\nvar _dist_code = new Array(DIST_CODE_LEN);\nzero(_dist_code);\n/* Distance codes. The first 256 values correspond to the distances\n * 3 .. 258, the last 256 values correspond to the top 8 bits of\n * the 15 bit distances.\n */\n\nvar _length_code = new Array(MAX_MATCH - MIN_MATCH + 1);\nzero(_length_code);\n/* length code for each normalized match length (0 == MIN_MATCH) */\n\nvar base_length = new Array(LENGTH_CODES);\nzero(base_length);\n/* First normalized length for each code (0 = MIN_MATCH) */\n\nvar base_dist = new Array(D_CODES);\nzero(base_dist);\n/* First normalized distance for each code (0 = distance of 1) */\n\n\nfunction StaticTreeDesc(static_tree, extra_bits, extra_base, elems, max_length) {\n\n this.static_tree = static_tree; /* static tree or NULL */\n this.extra_bits = extra_bits; /* extra bits for each code or NULL */\n this.extra_base = extra_base; /* base index for extra_bits */\n this.elems = elems; /* max number of elements in the tree */\n this.max_length = max_length; /* max bit length for the codes */\n\n // show if `static_tree` has data or dummy - needed for monomorphic objects\n this.has_stree = static_tree && static_tree.length;\n}\n\n\nvar static_l_desc;\nvar static_d_desc;\nvar static_bl_desc;\n\n\nfunction TreeDesc(dyn_tree, stat_desc) {\n this.dyn_tree = dyn_tree; /* the dynamic tree */\n this.max_code = 0; /* largest code with non zero frequency */\n this.stat_desc = stat_desc; /* the corresponding static tree */\n}\n\n\n\nfunction d_code(dist) {\n return dist < 256 ? _dist_code[dist] : _dist_code[256 + (dist >>> 7)];\n}\n\n\n/* ===========================================================================\n * Output a short LSB first on the stream.\n * IN assertion: there is enough room in pendingBuf.\n */\nfunction put_short(s, w) {\n// put_byte(s, (uch)((w) & 0xff));\n// put_byte(s, (uch)((ush)(w) >> 8));\n s.pending_buf[s.pending++] = (w) & 0xff;\n s.pending_buf[s.pending++] = (w >>> 8) & 0xff;\n}\n\n\n/* ===========================================================================\n * Send a value on a given number of bits.\n * IN assertion: length <= 16 and value fits in length bits.\n */\nfunction send_bits(s, value, length) {\n if (s.bi_valid > (Buf_size - length)) {\n s.bi_buf |= (value << s.bi_valid) & 0xffff;\n put_short(s, s.bi_buf);\n s.bi_buf = value >> (Buf_size - s.bi_valid);\n s.bi_valid += length - Buf_size;\n } else {\n s.bi_buf |= (value << s.bi_valid) & 0xffff;\n s.bi_valid += length;\n }\n}\n\n\nfunction send_code(s, c, tree) {\n send_bits(s, tree[c * 2]/*.Code*/, tree[c * 2 + 1]/*.Len*/);\n}\n\n\n/* ===========================================================================\n * Reverse the first len bits of a code, using straightforward code (a faster\n * method would use a table)\n * IN assertion: 1 <= len <= 15\n */\nfunction bi_reverse(code, len) {\n var res = 0;\n do {\n res |= code & 1;\n code >>>= 1;\n res <<= 1;\n } while (--len > 0);\n return res >>> 1;\n}\n\n\n/* ===========================================================================\n * Flush the bit buffer, keeping at most 7 bits in it.\n */\nfunction bi_flush(s) {\n if (s.bi_valid === 16) {\n put_short(s, s.bi_buf);\n s.bi_buf = 0;\n s.bi_valid = 0;\n\n } else if (s.bi_valid >= 8) {\n s.pending_buf[s.pending++] = s.bi_buf & 0xff;\n s.bi_buf >>= 8;\n s.bi_valid -= 8;\n }\n}\n\n\n/* ===========================================================================\n * Compute the optimal bit lengths for a tree and update the total bit length\n * for the current block.\n * IN assertion: the fields freq and dad are set, heap[heap_max] and\n * above are the tree nodes sorted by increasing frequency.\n * OUT assertions: the field len is set to the optimal bit length, the\n * array bl_count contains the frequencies for each bit length.\n * The length opt_len is updated; static_len is also updated if stree is\n * not null.\n */\nfunction gen_bitlen(s, desc)\n// deflate_state *s;\n// tree_desc *desc; /* the tree descriptor */\n{\n var tree = desc.dyn_tree;\n var max_code = desc.max_code;\n var stree = desc.stat_desc.static_tree;\n var has_stree = desc.stat_desc.has_stree;\n var extra = desc.stat_desc.extra_bits;\n var base = desc.stat_desc.extra_base;\n var max_length = desc.stat_desc.max_length;\n var h; /* heap index */\n var n, m; /* iterate over the tree elements */\n var bits; /* bit length */\n var xbits; /* extra bits */\n var f; /* frequency */\n var overflow = 0; /* number of elements with bit length too large */\n\n for (bits = 0; bits <= MAX_BITS; bits++) {\n s.bl_count[bits] = 0;\n }\n\n /* In a first pass, compute the optimal bit lengths (which may\n * overflow in the case of the bit length tree).\n */\n tree[s.heap[s.heap_max] * 2 + 1]/*.Len*/ = 0; /* root of the heap */\n\n for (h = s.heap_max + 1; h < HEAP_SIZE; h++) {\n n = s.heap[h];\n bits = tree[tree[n * 2 + 1]/*.Dad*/ * 2 + 1]/*.Len*/ + 1;\n if (bits > max_length) {\n bits = max_length;\n overflow++;\n }\n tree[n * 2 + 1]/*.Len*/ = bits;\n /* We overwrite tree[n].Dad which is no longer needed */\n\n if (n > max_code) { continue; } /* not a leaf node */\n\n s.bl_count[bits]++;\n xbits = 0;\n if (n >= base) {\n xbits = extra[n - base];\n }\n f = tree[n * 2]/*.Freq*/;\n s.opt_len += f * (bits + xbits);\n if (has_stree) {\n s.static_len += f * (stree[n * 2 + 1]/*.Len*/ + xbits);\n }\n }\n if (overflow === 0) { return; }\n\n // Trace((stderr,\"\\nbit length overflow\\n\"));\n /* This happens for example on obj2 and pic of the Calgary corpus */\n\n /* Find the first bit length which could increase: */\n do {\n bits = max_length - 1;\n while (s.bl_count[bits] === 0) { bits--; }\n s.bl_count[bits]--; /* move one leaf down the tree */\n s.bl_count[bits + 1] += 2; /* move one overflow item as its brother */\n s.bl_count[max_length]--;\n /* The brother of the overflow item also moves one step up,\n * but this does not affect bl_count[max_length]\n */\n overflow -= 2;\n } while (overflow > 0);\n\n /* Now recompute all bit lengths, scanning in increasing frequency.\n * h is still equal to HEAP_SIZE. (It is simpler to reconstruct all\n * lengths instead of fixing only the wrong ones. This idea is taken\n * from 'ar' written by Haruhiko Okumura.)\n */\n for (bits = max_length; bits !== 0; bits--) {\n n = s.bl_count[bits];\n while (n !== 0) {\n m = s.heap[--h];\n if (m > max_code) { continue; }\n if (tree[m * 2 + 1]/*.Len*/ !== bits) {\n // Trace((stderr,\"code %d bits %d->%d\\n\", m, tree[m].Len, bits));\n s.opt_len += (bits - tree[m * 2 + 1]/*.Len*/) * tree[m * 2]/*.Freq*/;\n tree[m * 2 + 1]/*.Len*/ = bits;\n }\n n--;\n }\n }\n}\n\n\n/* ===========================================================================\n * Generate the codes for a given tree and bit counts (which need not be\n * optimal).\n * IN assertion: the array bl_count contains the bit length statistics for\n * the given tree and the field len is set for all tree elements.\n * OUT assertion: the field code is set for all tree elements of non\n * zero code length.\n */\nfunction gen_codes(tree, max_code, bl_count)\n// ct_data *tree; /* the tree to decorate */\n// int max_code; /* largest code with non zero frequency */\n// ushf *bl_count; /* number of codes at each bit length */\n{\n var next_code = new Array(MAX_BITS + 1); /* next code value for each bit length */\n var code = 0; /* running code value */\n var bits; /* bit index */\n var n; /* code index */\n\n /* The distribution counts are first used to generate the code values\n * without bit reversal.\n */\n for (bits = 1; bits <= MAX_BITS; bits++) {\n next_code[bits] = code = (code + bl_count[bits - 1]) << 1;\n }\n /* Check that the bit counts in bl_count are consistent. The last code\n * must be all ones.\n */\n //Assert (code + bl_count[MAX_BITS]-1 == (1<<MAX_BITS)-1,\n // \"inconsistent bit counts\");\n //Tracev((stderr,\"\\ngen_codes: max_code %d \", max_code));\n\n for (n = 0; n <= max_code; n++) {\n var len = tree[n * 2 + 1]/*.Len*/;\n if (len === 0) { continue; }\n /* Now reverse the bits */\n tree[n * 2]/*.Code*/ = bi_reverse(next_code[len]++, len);\n\n //Tracecv(tree != static_ltree, (stderr,\"\\nn %3d %c l %2d c %4x (%x) \",\n // n, (isgraph(n) ? n : ' '), len, tree[n].Code, next_code[len]-1));\n }\n}\n\n\n/* ===========================================================================\n * Initialize the various 'constant' tables.\n */\nfunction tr_static_init() {\n var n; /* iterates over tree elements */\n var bits; /* bit counter */\n var length; /* length value */\n var code; /* code value */\n var dist; /* distance index */\n var bl_count = new Array(MAX_BITS + 1);\n /* number of codes at each bit length for an optimal tree */\n\n // do check in _tr_init()\n //if (static_init_done) return;\n\n /* For some embedded targets, global variables are not initialized: */\n/*#ifdef NO_INIT_GLOBAL_POINTERS\n static_l_desc.static_tree = static_ltree;\n static_l_desc.extra_bits = extra_lbits;\n static_d_desc.static_tree = static_dtree;\n static_d_desc.extra_bits = extra_dbits;\n static_bl_desc.extra_bits = extra_blbits;\n#endif*/\n\n /* Initialize the mapping length (0..255) -> length code (0..28) */\n length = 0;\n for (code = 0; code < LENGTH_CODES - 1; code++) {\n base_length[code] = length;\n for (n = 0; n < (1 << extra_lbits[code]); n++) {\n _length_code[length++] = code;\n }\n }\n //Assert (length == 256, \"tr_static_init: length != 256\");\n /* Note that the length 255 (match length 258) can be represented\n * in two different ways: code 284 + 5 bits or code 285, so we\n * overwrite length_code[255] to use the best encoding:\n */\n _length_code[length - 1] = code;\n\n /* Initialize the mapping dist (0..32K) -> dist code (0..29) */\n dist = 0;\n for (code = 0; code < 16; code++) {\n base_dist[code] = dist;\n for (n = 0; n < (1 << extra_dbits[code]); n++) {\n _dist_code[dist++] = code;\n }\n }\n //Assert (dist == 256, \"tr_static_init: dist != 256\");\n dist >>= 7; /* from now on, all distances are divided by 128 */\n for (; code < D_CODES; code++) {\n base_dist[code] = dist << 7;\n for (n = 0; n < (1 << (extra_dbits[code] - 7)); n++) {\n _dist_code[256 + dist++] = code;\n }\n }\n //Assert (dist == 256, \"tr_static_init: 256+dist != 512\");\n\n /* Construct the codes of the static literal tree */\n for (bits = 0; bits <= MAX_BITS; bits++) {\n bl_count[bits] = 0;\n }\n\n n = 0;\n while (n <= 143) {\n static_ltree[n * 2 + 1]/*.Len*/ = 8;\n n++;\n bl_count[8]++;\n }\n while (n <= 255) {\n static_ltree[n * 2 + 1]/*.Len*/ = 9;\n n++;\n bl_count[9]++;\n }\n while (n <= 279) {\n static_ltree[n * 2 + 1]/*.Len*/ = 7;\n n++;\n bl_count[7]++;\n }\n while (n <= 287) {\n static_ltree[n * 2 + 1]/*.Len*/ = 8;\n n++;\n bl_count[8]++;\n }\n /* Codes 286 and 287 do not exist, but we must include them in the\n * tree construction to get a canonical Huffman tree (longest code\n * all ones)\n */\n gen_codes(static_ltree, L_CODES + 1, bl_count);\n\n /* The static distance tree is trivial: */\n for (n = 0; n < D_CODES; n++) {\n static_dtree[n * 2 + 1]/*.Len*/ = 5;\n static_dtree[n * 2]/*.Code*/ = bi_reverse(n, 5);\n }\n\n // Now data ready and we can init static trees\n static_l_desc = new StaticTreeDesc(static_ltree, extra_lbits, LITERALS + 1, L_CODES, MAX_BITS);\n static_d_desc = new StaticTreeDesc(static_dtree, extra_dbits, 0, D_CODES, MAX_BITS);\n static_bl_desc = new StaticTreeDesc(new Array(0), extra_blbits, 0, BL_CODES, MAX_BL_BITS);\n\n //static_init_done = true;\n}\n\n\n/* ===========================================================================\n * Initialize a new block.\n */\nfunction init_block(s) {\n var n; /* iterates over tree elements */\n\n /* Initialize the trees. */\n for (n = 0; n < L_CODES; n++) { s.dyn_ltree[n * 2]/*.Freq*/ = 0; }\n for (n = 0; n < D_CODES; n++) { s.dyn_dtree[n * 2]/*.Freq*/ = 0; }\n for (n = 0; n < BL_CODES; n++) { s.bl_tree[n * 2]/*.Freq*/ = 0; }\n\n s.dyn_ltree[END_BLOCK * 2]/*.Freq*/ = 1;\n s.opt_len = s.static_len = 0;\n s.last_lit = s.matches = 0;\n}\n\n\n/* ===========================================================================\n * Flush the bit buffer and align the output on a byte boundary\n */\nfunction bi_windup(s)\n{\n if (s.bi_valid > 8) {\n put_short(s, s.bi_buf);\n } else if (s.bi_valid > 0) {\n //put_byte(s, (Byte)s->bi_buf);\n s.pending_buf[s.pending++] = s.bi_buf;\n }\n s.bi_buf = 0;\n s.bi_valid = 0;\n}\n\n/* ===========================================================================\n * Copy a stored block, storing first the length and its\n * one's complement if requested.\n */\nfunction copy_block(s, buf, len, header)\n//DeflateState *s;\n//charf *buf; /* the input data */\n//unsigned len; /* its length */\n//int header; /* true if block header must be written */\n{\n bi_windup(s); /* align on byte boundary */\n\n if (header) {\n put_short(s, len);\n put_short(s, ~len);\n }\n// while (len--) {\n// put_byte(s, *buf++);\n// }\n utils.arraySet(s.pending_buf, s.window, buf, len, s.pending);\n s.pending += len;\n}\n\n/* ===========================================================================\n * Compares to subtrees, using the tree depth as tie breaker when\n * the subtrees have equal frequency. This minimizes the worst case length.\n */\nfunction smaller(tree, n, m, depth) {\n var _n2 = n * 2;\n var _m2 = m * 2;\n return (tree[_n2]/*.Freq*/ < tree[_m2]/*.Freq*/ ||\n (tree[_n2]/*.Freq*/ === tree[_m2]/*.Freq*/ && depth[n] <= depth[m]));\n}\n\n/* ===========================================================================\n * Restore the heap property by moving down the tree starting at node k,\n * exchanging a node with the smallest of its two sons if necessary, stopping\n * when the heap property is re-established (each father smaller than its\n * two sons).\n */\nfunction pqdownheap(s, tree, k)\n// deflate_state *s;\n// ct_data *tree; /* the tree to restore */\n// int k; /* node to move down */\n{\n var v = s.heap[k];\n var j = k << 1; /* left son of k */\n while (j <= s.heap_len) {\n /* Set j to the smallest of the two sons: */\n if (j < s.heap_len &&\n smaller(tree, s.heap[j + 1], s.heap[j], s.depth)) {\n j++;\n }\n /* Exit if v is smaller than both sons */\n if (smaller(tree, v, s.heap[j], s.depth)) { break; }\n\n /* Exchange v with the smallest son */\n s.heap[k] = s.heap[j];\n k = j;\n\n /* And continue down the tree, setting j to the left son of k */\n j <<= 1;\n }\n s.heap[k] = v;\n}\n\n\n// inlined manually\n// var SMALLEST = 1;\n\n/* ===========================================================================\n * Send the block data compressed using the given Huffman trees\n */\nfunction compress_block(s, ltree, dtree)\n// deflate_state *s;\n// const ct_data *ltree; /* literal tree */\n// const ct_data *dtree; /* distance tree */\n{\n var dist; /* distance of matched string */\n var lc; /* match length or unmatched char (if dist == 0) */\n var lx = 0; /* running index in l_buf */\n var code; /* the code to send */\n var extra; /* number of extra bits to send */\n\n if (s.last_lit !== 0) {\n do {\n dist = (s.pending_buf[s.d_buf + lx * 2] << 8) | (s.pending_buf[s.d_buf + lx * 2 + 1]);\n lc = s.pending_buf[s.l_buf + lx];\n lx++;\n\n if (dist === 0) {\n send_code(s, lc, ltree); /* send a literal byte */\n //Tracecv(isgraph(lc), (stderr,\" '%c' \", lc));\n } else {\n /* Here, lc is the match length - MIN_MATCH */\n code = _length_code[lc];\n send_code(s, code + LITERALS + 1, ltree); /* send the length code */\n extra = extra_lbits[code];\n if (extra !== 0) {\n lc -= base_length[code];\n send_bits(s, lc, extra); /* send the extra length bits */\n }\n dist--; /* dist is now the match distance - 1 */\n code = d_code(dist);\n //Assert (code < D_CODES, \"bad d_code\");\n\n send_code(s, code, dtree); /* send the distance code */\n extra = extra_dbits[code];\n if (extra !== 0) {\n dist -= base_dist[code];\n send_bits(s, dist, extra); /* send the extra distance bits */\n }\n } /* literal or match pair ? */\n\n /* Check that the overlay between pending_buf and d_buf+l_buf is ok: */\n //Assert((uInt)(s->pending) < s->lit_bufsize + 2*lx,\n // \"pendingBuf overflow\");\n\n } while (lx < s.last_lit);\n }\n\n send_code(s, END_BLOCK, ltree);\n}\n\n\n/* ===========================================================================\n * Construct one Huffman tree and assigns the code bit strings and lengths.\n * Update the total bit length for the current block.\n * IN assertion: the field freq is set for all tree elements.\n * OUT assertions: the fields len and code are set to the optimal bit length\n * and corresponding code. The length opt_len is updated; static_len is\n * also updated if stree is not null. The field max_code is set.\n */\nfunction build_tree(s, desc)\n// deflate_state *s;\n// tree_desc *desc; /* the tree descriptor */\n{\n var tree = desc.dyn_tree;\n var stree = desc.stat_desc.static_tree;\n var has_stree = desc.stat_desc.has_stree;\n var elems = desc.stat_desc.elems;\n var n, m; /* iterate over heap elements */\n var max_code = -1; /* largest code with non zero frequency */\n var node; /* new node being created */\n\n /* Construct the initial heap, with least frequent element in\n * heap[SMALLEST]. The sons of heap[n] are heap[2*n] and heap[2*n+1].\n * heap[0] is not used.\n */\n s.heap_len = 0;\n s.heap_max = HEAP_SIZE;\n\n for (n = 0; n < elems; n++) {\n if (tree[n * 2]/*.Freq*/ !== 0) {\n s.heap[++s.heap_len] = max_code = n;\n s.depth[n] = 0;\n\n } else {\n tree[n * 2 + 1]/*.Len*/ = 0;\n }\n }\n\n /* The pkzip format requires that at least one distance code exists,\n * and that at least one bit should be sent even if there is only one\n * possible code. So to avoid special checks later on we force at least\n * two codes of non zero frequency.\n */\n while (s.heap_len < 2) {\n node = s.heap[++s.heap_len] = (max_code < 2 ? ++max_code : 0);\n tree[node * 2]/*.Freq*/ = 1;\n s.depth[node] = 0;\n s.opt_len--;\n\n if (has_stree) {\n s.static_len -= stree[node * 2 + 1]/*.Len*/;\n }\n /* node is 0 or 1 so it does not have extra bits */\n }\n desc.max_code = max_code;\n\n /* The elements heap[heap_len/2+1 .. heap_len] are leaves of the tree,\n * establish sub-heaps of increasing lengths:\n */\n for (n = (s.heap_len >> 1/*int /2*/); n >= 1; n--) { pqdownheap(s, tree, n); }\n\n /* Construct the Huffman tree by repeatedly combining the least two\n * frequent nodes.\n */\n node = elems; /* next internal node of the tree */\n do {\n //pqremove(s, tree, n); /* n = node of least frequency */\n /*** pqremove ***/\n n = s.heap[1/*SMALLEST*/];\n s.heap[1/*SMALLEST*/] = s.heap[s.heap_len--];\n pqdownheap(s, tree, 1/*SMALLEST*/);\n /***/\n\n m = s.heap[1/*SMALLEST*/]; /* m = node of next least frequency */\n\n s.heap[--s.heap_max] = n; /* keep the nodes sorted by frequency */\n s.heap[--s.heap_max] = m;\n\n /* Create a new node father of n and m */\n tree[node * 2]/*.Freq*/ = tree[n * 2]/*.Freq*/ + tree[m * 2]/*.Freq*/;\n s.depth[node] = (s.depth[n] >= s.depth[m] ? s.depth[n] : s.depth[m]) + 1;\n tree[n * 2 + 1]/*.Dad*/ = tree[m * 2 + 1]/*.Dad*/ = node;\n\n /* and insert the new node in the heap */\n s.heap[1/*SMALLEST*/] = node++;\n pqdownheap(s, tree, 1/*SMALLEST*/);\n\n } while (s.heap_len >= 2);\n\n s.heap[--s.heap_max] = s.heap[1/*SMALLEST*/];\n\n /* At this point, the fields freq and dad are set. We can now\n * generate the bit lengths.\n */\n gen_bitlen(s, desc);\n\n /* The field len is now set, we can generate the bit codes */\n gen_codes(tree, max_code, s.bl_count);\n}\n\n\n/* ===========================================================================\n * Scan a literal or distance tree to determine the frequencies of the codes\n * in the bit length tree.\n */\nfunction scan_tree(s, tree, max_code)\n// deflate_state *s;\n// ct_data *tree; /* the tree to be scanned */\n// int max_code; /* and its largest code of non zero frequency */\n{\n var n; /* iterates over all tree elements */\n var prevlen = -1; /* last emitted length */\n var curlen; /* length of current code */\n\n var nextlen = tree[0 * 2 + 1]/*.Len*/; /* length of next code */\n\n var count = 0; /* repeat count of the current code */\n var max_count = 7; /* max repeat count */\n var min_count = 4; /* min repeat count */\n\n if (nextlen === 0) {\n max_count = 138;\n min_count = 3;\n }\n tree[(max_code + 1) * 2 + 1]/*.Len*/ = 0xffff; /* guard */\n\n for (n = 0; n <= max_code; n++) {\n curlen = nextlen;\n nextlen = tree[(n + 1) * 2 + 1]/*.Len*/;\n\n if (++count < max_count && curlen === nextlen) {\n continue;\n\n } else if (count < min_count) {\n s.bl_tree[curlen * 2]/*.Freq*/ += count;\n\n } else if (curlen !== 0) {\n\n if (curlen !== prevlen) { s.bl_tree[curlen * 2]/*.Freq*/++; }\n s.bl_tree[REP_3_6 * 2]/*.Freq*/++;\n\n } else if (count <= 10) {\n s.bl_tree[REPZ_3_10 * 2]/*.Freq*/++;\n\n } else {\n s.bl_tree[REPZ_11_138 * 2]/*.Freq*/++;\n }\n\n count = 0;\n prevlen = curlen;\n\n if (nextlen === 0) {\n max_count = 138;\n min_count = 3;\n\n } else if (curlen === nextlen) {\n max_count = 6;\n min_count = 3;\n\n } else {\n max_count = 7;\n min_count = 4;\n }\n }\n}\n\n\n/* ===========================================================================\n * Send a literal or distance tree in compressed form, using the codes in\n * bl_tree.\n */\nfunction send_tree(s, tree, max_code)\n// deflate_state *s;\n// ct_data *tree; /* the tree to be scanned */\n// int max_code; /* and its largest code of non zero frequency */\n{\n var n; /* iterates over all tree elements */\n var prevlen = -1; /* last emitted length */\n var curlen; /* length of current code */\n\n var nextlen = tree[0 * 2 + 1]/*.Len*/; /* length of next code */\n\n var count = 0; /* repeat count of the current code */\n var max_count = 7; /* max repeat count */\n var min_count = 4; /* min repeat count */\n\n /* tree[max_code+1].Len = -1; */ /* guard already set */\n if (nextlen === 0) {\n max_count = 138;\n min_count = 3;\n }\n\n for (n = 0; n <= max_code; n++) {\n curlen = nextlen;\n nextlen = tree[(n + 1) * 2 + 1]/*.Len*/;\n\n if (++count < max_count && curlen === nextlen) {\n continue;\n\n } else if (count < min_count) {\n do { send_code(s, curlen, s.bl_tree); } while (--count !== 0);\n\n } else if (curlen !== 0) {\n if (curlen !== prevlen) {\n send_code(s, curlen, s.bl_tree);\n count--;\n }\n //Assert(count >= 3 && count <= 6, \" 3_6?\");\n send_code(s, REP_3_6, s.bl_tree);\n send_bits(s, count - 3, 2);\n\n } else if (count <= 10) {\n send_code(s, REPZ_3_10, s.bl_tree);\n send_bits(s, count - 3, 3);\n\n } else {\n send_code(s, REPZ_11_138, s.bl_tree);\n send_bits(s, count - 11, 7);\n }\n\n count = 0;\n prevlen = curlen;\n if (nextlen === 0) {\n max_count = 138;\n min_count = 3;\n\n } else if (curlen === nextlen) {\n max_count = 6;\n min_count = 3;\n\n } else {\n max_count = 7;\n min_count = 4;\n }\n }\n}\n\n\n/* ===========================================================================\n * Construct the Huffman tree for the bit lengths and return the index in\n * bl_order of the last bit length code to send.\n */\nfunction build_bl_tree(s) {\n var max_blindex; /* index of last bit length code of non zero freq */\n\n /* Determine the bit length frequencies for literal and distance trees */\n scan_tree(s, s.dyn_ltree, s.l_desc.max_code);\n scan_tree(s, s.dyn_dtree, s.d_desc.max_code);\n\n /* Build the bit length tree: */\n build_tree(s, s.bl_desc);\n /* opt_len now includes the length of the tree representations, except\n * the lengths of the bit lengths codes and the 5+5+4 bits for the counts.\n */\n\n /* Determine the number of bit length codes to send. The pkzip format\n * requires that at least 4 bit length codes be sent. (appnote.txt says\n * 3 but the actual value used is 4.)\n */\n for (max_blindex = BL_CODES - 1; max_blindex >= 3; max_blindex--) {\n if (s.bl_tree[bl_order[max_blindex] * 2 + 1]/*.Len*/ !== 0) {\n break;\n }\n }\n /* Update opt_len to include the bit length tree and counts */\n s.opt_len += 3 * (max_blindex + 1) + 5 + 5 + 4;\n //Tracev((stderr, \"\\ndyn trees: dyn %ld, stat %ld\",\n // s->opt_len, s->static_len));\n\n return max_blindex;\n}\n\n\n/* ===========================================================================\n * Send the header for a block using dynamic Huffman trees: the counts, the\n * lengths of the bit length codes, the literal tree and the distance tree.\n * IN assertion: lcodes >= 257, dcodes >= 1, blcodes >= 4.\n */\nfunction send_all_trees(s, lcodes, dcodes, blcodes)\n// deflate_state *s;\n// int lcodes, dcodes, blcodes; /* number of codes for each tree */\n{\n var rank; /* index in bl_order */\n\n //Assert (lcodes >= 257 && dcodes >= 1 && blcodes >= 4, \"not enough codes\");\n //Assert (lcodes <= L_CODES && dcodes <= D_CODES && blcodes <= BL_CODES,\n // \"too many codes\");\n //Tracev((stderr, \"\\nbl counts: \"));\n send_bits(s, lcodes - 257, 5); /* not +255 as stated in appnote.txt */\n send_bits(s, dcodes - 1, 5);\n send_bits(s, blcodes - 4, 4); /* not -3 as stated in appnote.txt */\n for (rank = 0; rank < blcodes; rank++) {\n //Tracev((stderr, \"\\nbl code %2d \", bl_order[rank]));\n send_bits(s, s.bl_tree[bl_order[rank] * 2 + 1]/*.Len*/, 3);\n }\n //Tracev((stderr, \"\\nbl tree: sent %ld\", s->bits_sent));\n\n send_tree(s, s.dyn_ltree, lcodes - 1); /* literal tree */\n //Tracev((stderr, \"\\nlit tree: sent %ld\", s->bits_sent));\n\n send_tree(s, s.dyn_dtree, dcodes - 1); /* distance tree */\n //Tracev((stderr, \"\\ndist tree: sent %ld\", s->bits_sent));\n}\n\n\n/* ===========================================================================\n * Check if the data type is TEXT or BINARY, using the following algorithm:\n * - TEXT if the two conditions below are satisfied:\n * a) There are no non-portable control characters belonging to the\n * \"black list\" (0..6, 14..25, 28..31).\n * b) There is at least one printable character belonging to the\n * \"white list\" (9 {TAB}, 10 {LF}, 13 {CR}, 32..255).\n * - BINARY otherwise.\n * - The following partially-portable control characters form a\n * \"gray list\" that is ignored in this detection algorithm:\n * (7 {BEL}, 8 {BS}, 11 {VT}, 12 {FF}, 26 {SUB}, 27 {ESC}).\n * IN assertion: the fields Freq of dyn_ltree are set.\n */\nfunction detect_data_type(s) {\n /* black_mask is the bit mask of black-listed bytes\n * set bits 0..6, 14..25, and 28..31\n * 0xf3ffc07f = binary 11110011111111111100000001111111\n */\n var black_mask = 0xf3ffc07f;\n var n;\n\n /* Check for non-textual (\"black-listed\") bytes. */\n for (n = 0; n <= 31; n++, black_mask >>>= 1) {\n if ((black_mask & 1) && (s.dyn_ltree[n * 2]/*.Freq*/ !== 0)) {\n return Z_BINARY;\n }\n }\n\n /* Check for textual (\"white-listed\") bytes. */\n if (s.dyn_ltree[9 * 2]/*.Freq*/ !== 0 || s.dyn_ltree[10 * 2]/*.Freq*/ !== 0 ||\n s.dyn_ltree[13 * 2]/*.Freq*/ !== 0) {\n return Z_TEXT;\n }\n for (n = 32; n < LITERALS; n++) {\n if (s.dyn_ltree[n * 2]/*.Freq*/ !== 0) {\n return Z_TEXT;\n }\n }\n\n /* There are no \"black-listed\" or \"white-listed\" bytes:\n * this stream either is empty or has tolerated (\"gray-listed\") bytes only.\n */\n return Z_BINARY;\n}\n\n\nvar static_init_done = false;\n\n/* ===========================================================================\n * Initialize the tree data structures for a new zlib stream.\n */\nfunction _tr_init(s)\n{\n\n if (!static_init_done) {\n tr_static_init();\n static_init_done = true;\n }\n\n s.l_desc = new TreeDesc(s.dyn_ltree, static_l_desc);\n s.d_desc = new TreeDesc(s.dyn_dtree, static_d_desc);\n s.bl_desc = new TreeDesc(s.bl_tree, static_bl_desc);\n\n s.bi_buf = 0;\n s.bi_valid = 0;\n\n /* Initialize the first block of the first file: */\n init_block(s);\n}\n\n\n/* ===========================================================================\n * Send a stored block\n */\nfunction _tr_stored_block(s, buf, stored_len, last)\n//DeflateState *s;\n//charf *buf; /* input block */\n//ulg stored_len; /* length of input block */\n//int last; /* one if this is the last block for a file */\n{\n send_bits(s, (STORED_BLOCK << 1) + (last ? 1 : 0), 3); /* send block type */\n copy_block(s, buf, stored_len, true); /* with header */\n}\n\n\n/* ===========================================================================\n * Send one empty static block to give enough lookahead for inflate.\n * This takes 10 bits, of which 7 may remain in the bit buffer.\n */\nfunction _tr_align(s) {\n send_bits(s, STATIC_TREES << 1, 3);\n send_code(s, END_BLOCK, static_ltree);\n bi_flush(s);\n}\n\n\n/* ===========================================================================\n * Determine the best encoding for the current block: dynamic trees, static\n * trees or store, and output the encoded block to the zip file.\n */\nfunction _tr_flush_block(s, buf, stored_len, last)\n//DeflateState *s;\n//charf *buf; /* input block, or NULL if too old */\n//ulg stored_len; /* length of input block */\n//int last; /* one if this is the last block for a file */\n{\n var opt_lenb, static_lenb; /* opt_len and static_len in bytes */\n var max_blindex = 0; /* index of last bit length code of non zero freq */\n\n /* Build the Huffman trees unless a stored block is forced */\n if (s.level > 0) {\n\n /* Check if the file is binary or text */\n if (s.strm.data_type === Z_UNKNOWN) {\n s.strm.data_type = detect_data_type(s);\n }\n\n /* Construct the literal and distance trees */\n build_tree(s, s.l_desc);\n // Tracev((stderr, \"\\nlit data: dyn %ld, stat %ld\", s->opt_len,\n // s->static_len));\n\n build_tree(s, s.d_desc);\n // Tracev((stderr, \"\\ndist data: dyn %ld, stat %ld\", s->opt_len,\n // s->static_len));\n /* At this point, opt_len and static_len are the total bit lengths of\n * the compressed block data, excluding the tree representations.\n */\n\n /* Build the bit length tree for the above two trees, and get the index\n * in bl_order of the last bit length code to send.\n */\n max_blindex = build_bl_tree(s);\n\n /* Determine the best encoding. Compute the block lengths in bytes. */\n opt_lenb = (s.opt_len + 3 + 7) >>> 3;\n static_lenb = (s.static_len + 3 + 7) >>> 3;\n\n // Tracev((stderr, \"\\nopt %lu(%lu) stat %lu(%lu) stored %lu lit %u \",\n // opt_lenb, s->opt_len, static_lenb, s->static_len, stored_len,\n // s->last_lit));\n\n if (static_lenb <= opt_lenb) { opt_lenb = static_lenb; }\n\n } else {\n // Assert(buf != (char*)0, \"lost buf\");\n opt_lenb = static_lenb = stored_len + 5; /* force a stored block */\n }\n\n if ((stored_len + 4 <= opt_lenb) && (buf !== -1)) {\n /* 4: two words for the lengths */\n\n /* The test buf != NULL is only necessary if LIT_BUFSIZE > WSIZE.\n * Otherwise we can't have processed more than WSIZE input bytes since\n * the last block flush, because compression would have been\n * successful. If LIT_BUFSIZE <= WSIZE, it is never too late to\n * transform a block into a stored block.\n */\n _tr_stored_block(s, buf, stored_len, last);\n\n } else if (s.strategy === Z_FIXED || static_lenb === opt_lenb) {\n\n send_bits(s, (STATIC_TREES << 1) + (last ? 1 : 0), 3);\n compress_block(s, static_ltree, static_dtree);\n\n } else {\n send_bits(s, (DYN_TREES << 1) + (last ? 1 : 0), 3);\n send_all_trees(s, s.l_desc.max_code + 1, s.d_desc.max_code + 1, max_blindex + 1);\n compress_block(s, s.dyn_ltree, s.dyn_dtree);\n }\n // Assert (s->compressed_len == s->bits_sent, \"bad compressed size\");\n /* The above check is made mod 2^32, for files larger than 512 MB\n * and uLong implemented on 32 bits.\n */\n init_block(s);\n\n if (last) {\n bi_windup(s);\n }\n // Tracev((stderr,\"\\ncomprlen %lu(%lu) \", s->compressed_len>>3,\n // s->compressed_len-7*last));\n}\n\n/* ===========================================================================\n * Save the match info and tally the frequency counts. Return true if\n * the current block must be flushed.\n */\nfunction _tr_tally(s, dist, lc)\n// deflate_state *s;\n// unsigned dist; /* distance of matched string */\n// unsigned lc; /* match length-MIN_MATCH or unmatched char (if dist==0) */\n{\n //var out_length, in_length, dcode;\n\n s.pending_buf[s.d_buf + s.last_lit * 2] = (dist >>> 8) & 0xff;\n s.pending_buf[s.d_buf + s.last_lit * 2 + 1] = dist & 0xff;\n\n s.pending_buf[s.l_buf + s.last_lit] = lc & 0xff;\n s.last_lit++;\n\n if (dist === 0) {\n /* lc is the unmatched char */\n s.dyn_ltree[lc * 2]/*.Freq*/++;\n } else {\n s.matches++;\n /* Here, lc is the match length - MIN_MATCH */\n dist--; /* dist = match distance - 1 */\n //Assert((ush)dist < (ush)MAX_DIST(s) &&\n // (ush)lc <= (ush)(MAX_MATCH-MIN_MATCH) &&\n // (ush)d_code(dist) < (ush)D_CODES, \"_tr_tally: bad match\");\n\n s.dyn_ltree[(_length_code[lc] + LITERALS + 1) * 2]/*.Freq*/++;\n s.dyn_dtree[d_code(dist) * 2]/*.Freq*/++;\n }\n\n// (!) This block is disabled in zlib defaults,\n// don't enable it for binary compatibility\n\n//#ifdef TRUNCATE_BLOCK\n// /* Try to guess if it is profitable to stop the current block here */\n// if ((s.last_lit & 0x1fff) === 0 && s.level > 2) {\n// /* Compute an upper bound for the compressed length */\n// out_length = s.last_lit*8;\n// in_length = s.strstart - s.block_start;\n//\n// for (dcode = 0; dcode < D_CODES; dcode++) {\n// out_length += s.dyn_dtree[dcode*2]/*.Freq*/ * (5 + extra_dbits[dcode]);\n// }\n// out_length >>>= 3;\n// //Tracev((stderr,\"\\nlast_lit %u, in %ld, out ~%ld(%ld%%) \",\n// // s->last_lit, in_length, out_length,\n// // 100L - out_length*100L/in_length));\n// if (s.matches < (s.last_lit>>1)/*int /2*/ && out_length < (in_length>>1)/*int /2*/) {\n// return true;\n// }\n// }\n//#endif\n\n return (s.last_lit === s.lit_bufsize - 1);\n /* We avoid equality with lit_bufsize because of wraparound at 64K\n * on 16 bit machines and because stored blocks are restricted to\n * 64K-1 bytes.\n */\n}\n\nexports._tr_init = _tr_init;\nexports._tr_stored_block = _tr_stored_block;\nexports._tr_flush_block = _tr_flush_block;\nexports._tr_tally = _tr_tally;\nexports._tr_align = _tr_align;\n","'use strict';\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\nvar utils = require('../utils/common');\nvar trees = require('./trees');\nvar adler32 = require('./adler32');\nvar crc32 = require('./crc32');\nvar msg = require('./messages');\n\n/* Public constants ==========================================================*/\n/* ===========================================================================*/\n\n\n/* Allowed flush values; see deflate() and inflate() below for details */\nvar Z_NO_FLUSH = 0;\nvar Z_PARTIAL_FLUSH = 1;\n//var Z_SYNC_FLUSH = 2;\nvar Z_FULL_FLUSH = 3;\nvar Z_FINISH = 4;\nvar Z_BLOCK = 5;\n//var Z_TREES = 6;\n\n\n/* Return codes for the compression/decompression functions. Negative values\n * are errors, positive values are used for special but normal events.\n */\nvar Z_OK = 0;\nvar Z_STREAM_END = 1;\n//var Z_NEED_DICT = 2;\n//var Z_ERRNO = -1;\nvar Z_STREAM_ERROR = -2;\nvar Z_DATA_ERROR = -3;\n//var Z_MEM_ERROR = -4;\nvar Z_BUF_ERROR = -5;\n//var Z_VERSION_ERROR = -6;\n\n\n/* compression levels */\n//var Z_NO_COMPRESSION = 0;\n//var Z_BEST_SPEED = 1;\n//var Z_BEST_COMPRESSION = 9;\nvar Z_DEFAULT_COMPRESSION = -1;\n\n\nvar Z_FILTERED = 1;\nvar Z_HUFFMAN_ONLY = 2;\nvar Z_RLE = 3;\nvar Z_FIXED = 4;\nvar Z_DEFAULT_STRATEGY = 0;\n\n/* Possible values of the data_type field (though see inflate()) */\n//var Z_BINARY = 0;\n//var Z_TEXT = 1;\n//var Z_ASCII = 1; // = Z_TEXT\nvar Z_UNKNOWN = 2;\n\n\n/* The deflate compression method */\nvar Z_DEFLATED = 8;\n\n/*============================================================================*/\n\n\nvar MAX_MEM_LEVEL = 9;\n/* Maximum value for memLevel in deflateInit2 */\nvar MAX_WBITS = 15;\n/* 32K LZ77 window */\nvar DEF_MEM_LEVEL = 8;\n\n\nvar LENGTH_CODES = 29;\n/* number of length codes, not counting the special END_BLOCK code */\nvar LITERALS = 256;\n/* number of literal bytes 0..255 */\nvar L_CODES = LITERALS + 1 + LENGTH_CODES;\n/* number of Literal or Length codes, including the END_BLOCK code */\nvar D_CODES = 30;\n/* number of distance codes */\nvar BL_CODES = 19;\n/* number of codes used to transfer the bit lengths */\nvar HEAP_SIZE = 2 * L_CODES + 1;\n/* maximum heap size */\nvar MAX_BITS = 15;\n/* All codes must not exceed MAX_BITS bits */\n\nvar MIN_MATCH = 3;\nvar MAX_MATCH = 258;\nvar MIN_LOOKAHEAD = (MAX_MATCH + MIN_MATCH + 1);\n\nvar PRESET_DICT = 0x20;\n\nvar INIT_STATE = 42;\nvar EXTRA_STATE = 69;\nvar NAME_STATE = 73;\nvar COMMENT_STATE = 91;\nvar HCRC_STATE = 103;\nvar BUSY_STATE = 113;\nvar FINISH_STATE = 666;\n\nvar BS_NEED_MORE = 1; /* block not completed, need more input or more output */\nvar BS_BLOCK_DONE = 2; /* block flush performed */\nvar BS_FINISH_STARTED = 3; /* finish started, need only more output at next deflate */\nvar BS_FINISH_DONE = 4; /* finish done, accept no more input or output */\n\nvar OS_CODE = 0x03; // Unix :) . Don't detect, use this default.\n\nfunction err(strm, errorCode) {\n strm.msg = msg[errorCode];\n return errorCode;\n}\n\nfunction rank(f) {\n return ((f) << 1) - ((f) > 4 ? 9 : 0);\n}\n\nfunction zero(buf) { var len = buf.length; while (--len >= 0) { buf[len] = 0; } }\n\n\n/* =========================================================================\n * Flush as much pending output as possible. All deflate() output goes\n * through this function so some applications may wish to modify it\n * to avoid allocating a large strm->output buffer and copying into it.\n * (See also read_buf()).\n */\nfunction flush_pending(strm) {\n var s = strm.state;\n\n //_tr_flush_bits(s);\n var len = s.pending;\n if (len > strm.avail_out) {\n len = strm.avail_out;\n }\n if (len === 0) { return; }\n\n utils.arraySet(strm.output, s.pending_buf, s.pending_out, len, strm.next_out);\n strm.next_out += len;\n s.pending_out += len;\n strm.total_out += len;\n strm.avail_out -= len;\n s.pending -= len;\n if (s.pending === 0) {\n s.pending_out = 0;\n }\n}\n\n\nfunction flush_block_only(s, last) {\n trees._tr_flush_block(s, (s.block_start >= 0 ? s.block_start : -1), s.strstart - s.block_start, last);\n s.block_start = s.strstart;\n flush_pending(s.strm);\n}\n\n\nfunction put_byte(s, b) {\n s.pending_buf[s.pending++] = b;\n}\n\n\n/* =========================================================================\n * Put a short in the pending buffer. The 16-bit value is put in MSB order.\n * IN assertion: the stream state is correct and there is enough room in\n * pending_buf.\n */\nfunction putShortMSB(s, b) {\n// put_byte(s, (Byte)(b >> 8));\n// put_byte(s, (Byte)(b & 0xff));\n s.pending_buf[s.pending++] = (b >>> 8) & 0xff;\n s.pending_buf[s.pending++] = b & 0xff;\n}\n\n\n/* ===========================================================================\n * Read a new buffer from the current input stream, update the adler32\n * and total number of bytes read. All deflate() input goes through\n * this function so some applications may wish to modify it to avoid\n * allocating a large strm->input buffer and copying from it.\n * (See also flush_pending()).\n */\nfunction read_buf(strm, buf, start, size) {\n var len = strm.avail_in;\n\n if (len > size) { len = size; }\n if (len === 0) { return 0; }\n\n strm.avail_in -= len;\n\n // zmemcpy(buf, strm->next_in, len);\n utils.arraySet(buf, strm.input, strm.next_in, len, start);\n if (strm.state.wrap === 1) {\n strm.adler = adler32(strm.adler, buf, len, start);\n }\n\n else if (strm.state.wrap === 2) {\n strm.adler = crc32(strm.adler, buf, len, start);\n }\n\n strm.next_in += len;\n strm.total_in += len;\n\n return len;\n}\n\n\n/* ===========================================================================\n * Set match_start to the longest match starting at the given string and\n * return its length. Matches shorter or equal to prev_length are discarded,\n * in which case the result is equal to prev_length and match_start is\n * garbage.\n * IN assertions: cur_match is the head of the hash chain for the current\n * string (strstart) and its distance is <= MAX_DIST, and prev_length >= 1\n * OUT assertion: the match length is not greater than s->lookahead.\n */\nfunction longest_match(s, cur_match) {\n var chain_length = s.max_chain_length; /* max hash chain length */\n var scan = s.strstart; /* current string */\n var match; /* matched string */\n var len; /* length of current match */\n var best_len = s.prev_length; /* best match length so far */\n var nice_match = s.nice_match; /* stop if match long enough */\n var limit = (s.strstart > (s.w_size - MIN_LOOKAHEAD)) ?\n s.strstart - (s.w_size - MIN_LOOKAHEAD) : 0/*NIL*/;\n\n var _win = s.window; // shortcut\n\n var wmask = s.w_mask;\n var prev = s.prev;\n\n /* Stop when cur_match becomes <= limit. To simplify the code,\n * we prevent matches with the string of window index 0.\n */\n\n var strend = s.strstart + MAX_MATCH;\n var scan_end1 = _win[scan + best_len - 1];\n var scan_end = _win[scan + best_len];\n\n /* The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of 16.\n * It is easy to get rid of this optimization if necessary.\n */\n // Assert(s->hash_bits >= 8 && MAX_MATCH == 258, \"Code too clever\");\n\n /* Do not waste too much time if we already have a good match: */\n if (s.prev_length >= s.good_match) {\n chain_length >>= 2;\n }\n /* Do not look for matches beyond the end of the input. This is necessary\n * to make deflate deterministic.\n */\n if (nice_match > s.lookahead) { nice_match = s.lookahead; }\n\n // Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD, \"need lookahead\");\n\n do {\n // Assert(cur_match < s->strstart, \"no future\");\n match = cur_match;\n\n /* Skip to next match if the match length cannot increase\n * or if the match length is less than 2. Note that the checks below\n * for insufficient lookahead only occur occasionally for performance\n * reasons. Therefore uninitialized memory will be accessed, and\n * conditional jumps will be made that depend on those values.\n * However the length of the match is limited to the lookahead, so\n * the output of deflate is not affected by the uninitialized values.\n */\n\n if (_win[match + best_len] !== scan_end ||\n _win[match + best_len - 1] !== scan_end1 ||\n _win[match] !== _win[scan] ||\n _win[++match] !== _win[scan + 1]) {\n continue;\n }\n\n /* The check at best_len-1 can be removed because it will be made\n * again later. (This heuristic is not always a win.)\n * It is not necessary to compare scan[2] and match[2] since they\n * are always equal when the other bytes match, given that\n * the hash keys are equal and that HASH_BITS >= 8.\n */\n scan += 2;\n match++;\n // Assert(*scan == *match, \"match[2]?\");\n\n /* We check for insufficient lookahead only every 8th comparison;\n * the 256th check will be made at strstart+258.\n */\n do {\n /*jshint noempty:false*/\n } while (_win[++scan] === _win[++match] && _win[++scan] === _win[++match] &&\n _win[++scan] === _win[++match] && _win[++scan] === _win[++match] &&\n _win[++scan] === _win[++match] && _win[++scan] === _win[++match] &&\n _win[++scan] === _win[++match] && _win[++scan] === _win[++match] &&\n scan < strend);\n\n // Assert(scan <= s->window+(unsigned)(s->window_size-1), \"wild scan\");\n\n len = MAX_MATCH - (strend - scan);\n scan = strend - MAX_MATCH;\n\n if (len > best_len) {\n s.match_start = cur_match;\n best_len = len;\n if (len >= nice_match) {\n break;\n }\n scan_end1 = _win[scan + best_len - 1];\n scan_end = _win[scan + best_len];\n }\n } while ((cur_match = prev[cur_match & wmask]) > limit && --chain_length !== 0);\n\n if (best_len <= s.lookahead) {\n return best_len;\n }\n return s.lookahead;\n}\n\n\n/* ===========================================================================\n * Fill the window when the lookahead becomes insufficient.\n * Updates strstart and lookahead.\n *\n * IN assertion: lookahead < MIN_LOOKAHEAD\n * OUT assertions: strstart <= window_size-MIN_LOOKAHEAD\n * At least one byte has been read, or avail_in == 0; reads are\n * performed for at least two bytes (required for the zip translate_eol\n * option -- not supported here).\n */\nfunction fill_window(s) {\n var _w_size = s.w_size;\n var p, n, m, more, str;\n\n //Assert(s->lookahead < MIN_LOOKAHEAD, \"already enough lookahead\");\n\n do {\n more = s.window_size - s.lookahead - s.strstart;\n\n // JS ints have 32 bit, block below not needed\n /* Deal with !@#$% 64K limit: */\n //if (sizeof(int) <= 2) {\n // if (more == 0 && s->strstart == 0 && s->lookahead == 0) {\n // more = wsize;\n //\n // } else if (more == (unsigned)(-1)) {\n // /* Very unlikely, but possible on 16 bit machine if\n // * strstart == 0 && lookahead == 1 (input done a byte at time)\n // */\n // more--;\n // }\n //}\n\n\n /* If the window is almost full and there is insufficient lookahead,\n * move the upper half to the lower one to make room in the upper half.\n */\n if (s.strstart >= _w_size + (_w_size - MIN_LOOKAHEAD)) {\n\n utils.arraySet(s.window, s.window, _w_size, _w_size, 0);\n s.match_start -= _w_size;\n s.strstart -= _w_size;\n /* we now have strstart >= MAX_DIST */\n s.block_start -= _w_size;\n\n /* Slide the hash table (could be avoided with 32 bit values\n at the expense of memory usage). We slide even when level == 0\n to keep the hash table consistent if we switch back to level > 0\n later. (Using level 0 permanently is not an optimal usage of\n zlib, so we don't care about this pathological case.)\n */\n\n n = s.hash_size;\n p = n;\n do {\n m = s.head[--p];\n s.head[p] = (m >= _w_size ? m - _w_size : 0);\n } while (--n);\n\n n = _w_size;\n p = n;\n do {\n m = s.prev[--p];\n s.prev[p] = (m >= _w_size ? m - _w_size : 0);\n /* If n is not on any hash chain, prev[n] is garbage but\n * its value will never be used.\n */\n } while (--n);\n\n more += _w_size;\n }\n if (s.strm.avail_in === 0) {\n break;\n }\n\n /* If there was no sliding:\n * strstart <= WSIZE+MAX_DIST-1 && lookahead <= MIN_LOOKAHEAD - 1 &&\n * more == window_size - lookahead - strstart\n * => more >= window_size - (MIN_LOOKAHEAD-1 + WSIZE + MAX_DIST-1)\n * => more >= window_size - 2*WSIZE + 2\n * In the BIG_MEM or MMAP case (not yet supported),\n * window_size == input_size + MIN_LOOKAHEAD &&\n * strstart + s->lookahead <= input_size => more >= MIN_LOOKAHEAD.\n * Otherwise, window_size == 2*WSIZE so more >= 2.\n * If there was sliding, more >= WSIZE. So in all cases, more >= 2.\n */\n //Assert(more >= 2, \"more < 2\");\n n = read_buf(s.strm, s.window, s.strstart + s.lookahead, more);\n s.lookahead += n;\n\n /* Initialize the hash value now that we have some input: */\n if (s.lookahead + s.insert >= MIN_MATCH) {\n str = s.strstart - s.insert;\n s.ins_h = s.window[str];\n\n /* UPDATE_HASH(s, s->ins_h, s->window[str + 1]); */\n s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[str + 1]) & s.hash_mask;\n//#if MIN_MATCH != 3\n// Call update_hash() MIN_MATCH-3 more times\n//#endif\n while (s.insert) {\n /* UPDATE_HASH(s, s->ins_h, s->window[str + MIN_MATCH-1]); */\n s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[str + MIN_MATCH - 1]) & s.hash_mask;\n\n s.prev[str & s.w_mask] = s.head[s.ins_h];\n s.head[s.ins_h] = str;\n str++;\n s.insert--;\n if (s.lookahead + s.insert < MIN_MATCH) {\n break;\n }\n }\n }\n /* If the whole input has less than MIN_MATCH bytes, ins_h is garbage,\n * but this is not important since only literal bytes will be emitted.\n */\n\n } while (s.lookahead < MIN_LOOKAHEAD && s.strm.avail_in !== 0);\n\n /* If the WIN_INIT bytes after the end of the current data have never been\n * written, then zero those bytes in order to avoid memory check reports of\n * the use of uninitialized (or uninitialised as Julian writes) bytes by\n * the longest match routines. Update the high water mark for the next\n * time through here. WIN_INIT is set to MAX_MATCH since the longest match\n * routines allow scanning to strstart + MAX_MATCH, ignoring lookahead.\n */\n// if (s.high_water < s.window_size) {\n// var curr = s.strstart + s.lookahead;\n// var init = 0;\n//\n// if (s.high_water < curr) {\n// /* Previous high water mark below current data -- zero WIN_INIT\n// * bytes or up to end of window, whichever is less.\n// */\n// init = s.window_size - curr;\n// if (init > WIN_INIT)\n// init = WIN_INIT;\n// zmemzero(s->window + curr, (unsigned)init);\n// s->high_water = curr + init;\n// }\n// else if (s->high_water < (ulg)curr + WIN_INIT) {\n// /* High water mark at or above current data, but below current data\n// * plus WIN_INIT -- zero out to current data plus WIN_INIT, or up\n// * to end of window, whichever is less.\n// */\n// init = (ulg)curr + WIN_INIT - s->high_water;\n// if (init > s->window_size - s->high_water)\n// init = s->window_size - s->high_water;\n// zmemzero(s->window + s->high_water, (unsigned)init);\n// s->high_water += init;\n// }\n// }\n//\n// Assert((ulg)s->strstart <= s->window_size - MIN_LOOKAHEAD,\n// \"not enough room for search\");\n}\n\n/* ===========================================================================\n * Copy without compression as much as possible from the input stream, return\n * the current block state.\n * This function does not insert new strings in the dictionary since\n * uncompressible data is probably not useful. This function is used\n * only for the level=0 compression option.\n * NOTE: this function should be optimized to avoid extra copying from\n * window to pending_buf.\n */\nfunction deflate_stored(s, flush) {\n /* Stored blocks are limited to 0xffff bytes, pending_buf is limited\n * to pending_buf_size, and each stored block has a 5 byte header:\n */\n var max_block_size = 0xffff;\n\n if (max_block_size > s.pending_buf_size - 5) {\n max_block_size = s.pending_buf_size - 5;\n }\n\n /* Copy as much as possible from input to output: */\n for (;;) {\n /* Fill the window as much as possible: */\n if (s.lookahead <= 1) {\n\n //Assert(s->strstart < s->w_size+MAX_DIST(s) ||\n // s->block_start >= (long)s->w_size, \"slide too late\");\n// if (!(s.strstart < s.w_size + (s.w_size - MIN_LOOKAHEAD) ||\n// s.block_start >= s.w_size)) {\n// throw new Error(\"slide too late\");\n// }\n\n fill_window(s);\n if (s.lookahead === 0 && flush === Z_NO_FLUSH) {\n return BS_NEED_MORE;\n }\n\n if (s.lookahead === 0) {\n break;\n }\n /* flush the current block */\n }\n //Assert(s->block_start >= 0L, \"block gone\");\n// if (s.block_start < 0) throw new Error(\"block gone\");\n\n s.strstart += s.lookahead;\n s.lookahead = 0;\n\n /* Emit a stored block if pending_buf will be full: */\n var max_start = s.block_start + max_block_size;\n\n if (s.strstart === 0 || s.strstart >= max_start) {\n /* strstart == 0 is possible when wraparound on 16-bit machine */\n s.lookahead = s.strstart - max_start;\n s.strstart = max_start;\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n\n\n }\n /* Flush if we may have to slide, otherwise block_start may become\n * negative and the data will be gone:\n */\n if (s.strstart - s.block_start >= (s.w_size - MIN_LOOKAHEAD)) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n }\n\n s.insert = 0;\n\n if (flush === Z_FINISH) {\n /*** FLUSH_BLOCK(s, 1); ***/\n flush_block_only(s, true);\n if (s.strm.avail_out === 0) {\n return BS_FINISH_STARTED;\n }\n /***/\n return BS_FINISH_DONE;\n }\n\n if (s.strstart > s.block_start) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n\n return BS_NEED_MORE;\n}\n\n/* ===========================================================================\n * Compress as much as possible from the input stream, return the current\n * block state.\n * This function does not perform lazy evaluation of matches and inserts\n * new strings in the dictionary only for unmatched strings or for short\n * matches. It is used only for the fast compression options.\n */\nfunction deflate_fast(s, flush) {\n var hash_head; /* head of the hash chain */\n var bflush; /* set if current block must be flushed */\n\n for (;;) {\n /* Make sure that we always have enough lookahead, except\n * at the end of the input file. We need MAX_MATCH bytes\n * for the next match, plus MIN_MATCH bytes to insert the\n * string following the next match.\n */\n if (s.lookahead < MIN_LOOKAHEAD) {\n fill_window(s);\n if (s.lookahead < MIN_LOOKAHEAD && flush === Z_NO_FLUSH) {\n return BS_NEED_MORE;\n }\n if (s.lookahead === 0) {\n break; /* flush the current block */\n }\n }\n\n /* Insert the string window[strstart .. strstart+2] in the\n * dictionary, and set hash_head to the head of the hash chain:\n */\n hash_head = 0/*NIL*/;\n if (s.lookahead >= MIN_MATCH) {\n /*** INSERT_STRING(s, s.strstart, hash_head); ***/\n s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask;\n hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h];\n s.head[s.ins_h] = s.strstart;\n /***/\n }\n\n /* Find the longest match, discarding those <= prev_length.\n * At this point we have always match_length < MIN_MATCH\n */\n if (hash_head !== 0/*NIL*/ && ((s.strstart - hash_head) <= (s.w_size - MIN_LOOKAHEAD))) {\n /* To simplify the code, we prevent matches with the string\n * of window index 0 (in particular we have to avoid a match\n * of the string with itself at the start of the input file).\n */\n s.match_length = longest_match(s, hash_head);\n /* longest_match() sets match_start */\n }\n if (s.match_length >= MIN_MATCH) {\n // check_match(s, s.strstart, s.match_start, s.match_length); // for debug only\n\n /*** _tr_tally_dist(s, s.strstart - s.match_start,\n s.match_length - MIN_MATCH, bflush); ***/\n bflush = trees._tr_tally(s, s.strstart - s.match_start, s.match_length - MIN_MATCH);\n\n s.lookahead -= s.match_length;\n\n /* Insert new strings in the hash table only if the match length\n * is not too large. This saves time but degrades compression.\n */\n if (s.match_length <= s.max_lazy_match/*max_insert_length*/ && s.lookahead >= MIN_MATCH) {\n s.match_length--; /* string at strstart already in table */\n do {\n s.strstart++;\n /*** INSERT_STRING(s, s.strstart, hash_head); ***/\n s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask;\n hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h];\n s.head[s.ins_h] = s.strstart;\n /***/\n /* strstart never exceeds WSIZE-MAX_MATCH, so there are\n * always MIN_MATCH bytes ahead.\n */\n } while (--s.match_length !== 0);\n s.strstart++;\n } else\n {\n s.strstart += s.match_length;\n s.match_length = 0;\n s.ins_h = s.window[s.strstart];\n /* UPDATE_HASH(s, s.ins_h, s.window[s.strstart+1]); */\n s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + 1]) & s.hash_mask;\n\n//#if MIN_MATCH != 3\n// Call UPDATE_HASH() MIN_MATCH-3 more times\n//#endif\n /* If lookahead < MIN_MATCH, ins_h is garbage, but it does not\n * matter since it will be recomputed at next deflate call.\n */\n }\n } else {\n /* No match, output a literal byte */\n //Tracevv((stderr,\"%c\", s.window[s.strstart]));\n /*** _tr_tally_lit(s, s.window[s.strstart], bflush); ***/\n bflush = trees._tr_tally(s, 0, s.window[s.strstart]);\n\n s.lookahead--;\n s.strstart++;\n }\n if (bflush) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n }\n s.insert = ((s.strstart < (MIN_MATCH - 1)) ? s.strstart : MIN_MATCH - 1);\n if (flush === Z_FINISH) {\n /*** FLUSH_BLOCK(s, 1); ***/\n flush_block_only(s, true);\n if (s.strm.avail_out === 0) {\n return BS_FINISH_STARTED;\n }\n /***/\n return BS_FINISH_DONE;\n }\n if (s.last_lit) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n return BS_BLOCK_DONE;\n}\n\n/* ===========================================================================\n * Same as above, but achieves better compression. We use a lazy\n * evaluation for matches: a match is finally adopted only if there is\n * no better match at the next window position.\n */\nfunction deflate_slow(s, flush) {\n var hash_head; /* head of hash chain */\n var bflush; /* set if current block must be flushed */\n\n var max_insert;\n\n /* Process the input block. */\n for (;;) {\n /* Make sure that we always have enough lookahead, except\n * at the end of the input file. We need MAX_MATCH bytes\n * for the next match, plus MIN_MATCH bytes to insert the\n * string following the next match.\n */\n if (s.lookahead < MIN_LOOKAHEAD) {\n fill_window(s);\n if (s.lookahead < MIN_LOOKAHEAD && flush === Z_NO_FLUSH) {\n return BS_NEED_MORE;\n }\n if (s.lookahead === 0) { break; } /* flush the current block */\n }\n\n /* Insert the string window[strstart .. strstart+2] in the\n * dictionary, and set hash_head to the head of the hash chain:\n */\n hash_head = 0/*NIL*/;\n if (s.lookahead >= MIN_MATCH) {\n /*** INSERT_STRING(s, s.strstart, hash_head); ***/\n s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask;\n hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h];\n s.head[s.ins_h] = s.strstart;\n /***/\n }\n\n /* Find the longest match, discarding those <= prev_length.\n */\n s.prev_length = s.match_length;\n s.prev_match = s.match_start;\n s.match_length = MIN_MATCH - 1;\n\n if (hash_head !== 0/*NIL*/ && s.prev_length < s.max_lazy_match &&\n s.strstart - hash_head <= (s.w_size - MIN_LOOKAHEAD)/*MAX_DIST(s)*/) {\n /* To simplify the code, we prevent matches with the string\n * of window index 0 (in particular we have to avoid a match\n * of the string with itself at the start of the input file).\n */\n s.match_length = longest_match(s, hash_head);\n /* longest_match() sets match_start */\n\n if (s.match_length <= 5 &&\n (s.strategy === Z_FILTERED || (s.match_length === MIN_MATCH && s.strstart - s.match_start > 4096/*TOO_FAR*/))) {\n\n /* If prev_match is also MIN_MATCH, match_start is garbage\n * but we will ignore the current match anyway.\n */\n s.match_length = MIN_MATCH - 1;\n }\n }\n /* If there was a match at the previous step and the current\n * match is not better, output the previous match:\n */\n if (s.prev_length >= MIN_MATCH && s.match_length <= s.prev_length) {\n max_insert = s.strstart + s.lookahead - MIN_MATCH;\n /* Do not insert strings in hash table beyond this. */\n\n //check_match(s, s.strstart-1, s.prev_match, s.prev_length);\n\n /***_tr_tally_dist(s, s.strstart - 1 - s.prev_match,\n s.prev_length - MIN_MATCH, bflush);***/\n bflush = trees._tr_tally(s, s.strstart - 1 - s.prev_match, s.prev_length - MIN_MATCH);\n /* Insert in hash table all strings up to the end of the match.\n * strstart-1 and strstart are already inserted. If there is not\n * enough lookahead, the last two strings are not inserted in\n * the hash table.\n */\n s.lookahead -= s.prev_length - 1;\n s.prev_length -= 2;\n do {\n if (++s.strstart <= max_insert) {\n /*** INSERT_STRING(s, s.strstart, hash_head); ***/\n s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask;\n hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h];\n s.head[s.ins_h] = s.strstart;\n /***/\n }\n } while (--s.prev_length !== 0);\n s.match_available = 0;\n s.match_length = MIN_MATCH - 1;\n s.strstart++;\n\n if (bflush) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n\n } else if (s.match_available) {\n /* If there was no match at the previous position, output a\n * single literal. If there was a match but the current match\n * is longer, truncate the previous match to a single literal.\n */\n //Tracevv((stderr,\"%c\", s->window[s->strstart-1]));\n /*** _tr_tally_lit(s, s.window[s.strstart-1], bflush); ***/\n bflush = trees._tr_tally(s, 0, s.window[s.strstart - 1]);\n\n if (bflush) {\n /*** FLUSH_BLOCK_ONLY(s, 0) ***/\n flush_block_only(s, false);\n /***/\n }\n s.strstart++;\n s.lookahead--;\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n } else {\n /* There is no previous match to compare with, wait for\n * the next step to decide.\n */\n s.match_available = 1;\n s.strstart++;\n s.lookahead--;\n }\n }\n //Assert (flush != Z_NO_FLUSH, \"no flush?\");\n if (s.match_available) {\n //Tracevv((stderr,\"%c\", s->window[s->strstart-1]));\n /*** _tr_tally_lit(s, s.window[s.strstart-1], bflush); ***/\n bflush = trees._tr_tally(s, 0, s.window[s.strstart - 1]);\n\n s.match_available = 0;\n }\n s.insert = s.strstart < MIN_MATCH - 1 ? s.strstart : MIN_MATCH - 1;\n if (flush === Z_FINISH) {\n /*** FLUSH_BLOCK(s, 1); ***/\n flush_block_only(s, true);\n if (s.strm.avail_out === 0) {\n return BS_FINISH_STARTED;\n }\n /***/\n return BS_FINISH_DONE;\n }\n if (s.last_lit) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n\n return BS_BLOCK_DONE;\n}\n\n\n/* ===========================================================================\n * For Z_RLE, simply look for runs of bytes, generate matches only of distance\n * one. Do not maintain a hash table. (It will be regenerated if this run of\n * deflate switches away from Z_RLE.)\n */\nfunction deflate_rle(s, flush) {\n var bflush; /* set if current block must be flushed */\n var prev; /* byte at distance one to match */\n var scan, strend; /* scan goes up to strend for length of run */\n\n var _win = s.window;\n\n for (;;) {\n /* Make sure that we always have enough lookahead, except\n * at the end of the input file. We need MAX_MATCH bytes\n * for the longest run, plus one for the unrolled loop.\n */\n if (s.lookahead <= MAX_MATCH) {\n fill_window(s);\n if (s.lookahead <= MAX_MATCH && flush === Z_NO_FLUSH) {\n return BS_NEED_MORE;\n }\n if (s.lookahead === 0) { break; } /* flush the current block */\n }\n\n /* See how many times the previous byte repeats */\n s.match_length = 0;\n if (s.lookahead >= MIN_MATCH && s.strstart > 0) {\n scan = s.strstart - 1;\n prev = _win[scan];\n if (prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan]) {\n strend = s.strstart + MAX_MATCH;\n do {\n /*jshint noempty:false*/\n } while (prev === _win[++scan] && prev === _win[++scan] &&\n prev === _win[++scan] && prev === _win[++scan] &&\n prev === _win[++scan] && prev === _win[++scan] &&\n prev === _win[++scan] && prev === _win[++scan] &&\n scan < strend);\n s.match_length = MAX_MATCH - (strend - scan);\n if (s.match_length > s.lookahead) {\n s.match_length = s.lookahead;\n }\n }\n //Assert(scan <= s->window+(uInt)(s->window_size-1), \"wild scan\");\n }\n\n /* Emit match if have run of MIN_MATCH or longer, else emit literal */\n if (s.match_length >= MIN_MATCH) {\n //check_match(s, s.strstart, s.strstart - 1, s.match_length);\n\n /*** _tr_tally_dist(s, 1, s.match_length - MIN_MATCH, bflush); ***/\n bflush = trees._tr_tally(s, 1, s.match_length - MIN_MATCH);\n\n s.lookahead -= s.match_length;\n s.strstart += s.match_length;\n s.match_length = 0;\n } else {\n /* No match, output a literal byte */\n //Tracevv((stderr,\"%c\", s->window[s->strstart]));\n /*** _tr_tally_lit(s, s.window[s.strstart], bflush); ***/\n bflush = trees._tr_tally(s, 0, s.window[s.strstart]);\n\n s.lookahead--;\n s.strstart++;\n }\n if (bflush) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n }\n s.insert = 0;\n if (flush === Z_FINISH) {\n /*** FLUSH_BLOCK(s, 1); ***/\n flush_block_only(s, true);\n if (s.strm.avail_out === 0) {\n return BS_FINISH_STARTED;\n }\n /***/\n return BS_FINISH_DONE;\n }\n if (s.last_lit) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n return BS_BLOCK_DONE;\n}\n\n/* ===========================================================================\n * For Z_HUFFMAN_ONLY, do not look for matches. Do not maintain a hash table.\n * (It will be regenerated if this run of deflate switches away from Huffman.)\n */\nfunction deflate_huff(s, flush) {\n var bflush; /* set if current block must be flushed */\n\n for (;;) {\n /* Make sure that we have a literal to write. */\n if (s.lookahead === 0) {\n fill_window(s);\n if (s.lookahead === 0) {\n if (flush === Z_NO_FLUSH) {\n return BS_NEED_MORE;\n }\n break; /* flush the current block */\n }\n }\n\n /* Output a literal byte */\n s.match_length = 0;\n //Tracevv((stderr,\"%c\", s->window[s->strstart]));\n /*** _tr_tally_lit(s, s.window[s.strstart], bflush); ***/\n bflush = trees._tr_tally(s, 0, s.window[s.strstart]);\n s.lookahead--;\n s.strstart++;\n if (bflush) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n }\n s.insert = 0;\n if (flush === Z_FINISH) {\n /*** FLUSH_BLOCK(s, 1); ***/\n flush_block_only(s, true);\n if (s.strm.avail_out === 0) {\n return BS_FINISH_STARTED;\n }\n /***/\n return BS_FINISH_DONE;\n }\n if (s.last_lit) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n return BS_BLOCK_DONE;\n}\n\n/* Values for max_lazy_match, good_match and max_chain_length, depending on\n * the desired pack level (0..9). The values given below have been tuned to\n * exclude worst case performance for pathological files. Better values may be\n * found for specific files.\n */\nfunction Config(good_length, max_lazy, nice_length, max_chain, func) {\n this.good_length = good_length;\n this.max_lazy = max_lazy;\n this.nice_length = nice_length;\n this.max_chain = max_chain;\n this.func = func;\n}\n\nvar configuration_table;\n\nconfiguration_table = [\n /* good lazy nice chain */\n new Config(0, 0, 0, 0, deflate_stored), /* 0 store only */\n new Config(4, 4, 8, 4, deflate_fast), /* 1 max speed, no lazy matches */\n new Config(4, 5, 16, 8, deflate_fast), /* 2 */\n new Config(4, 6, 32, 32, deflate_fast), /* 3 */\n\n new Config(4, 4, 16, 16, deflate_slow), /* 4 lazy matches */\n new Config(8, 16, 32, 32, deflate_slow), /* 5 */\n new Config(8, 16, 128, 128, deflate_slow), /* 6 */\n new Config(8, 32, 128, 256, deflate_slow), /* 7 */\n new Config(32, 128, 258, 1024, deflate_slow), /* 8 */\n new Config(32, 258, 258, 4096, deflate_slow) /* 9 max compression */\n];\n\n\n/* ===========================================================================\n * Initialize the \"longest match\" routines for a new zlib stream\n */\nfunction lm_init(s) {\n s.window_size = 2 * s.w_size;\n\n /*** CLEAR_HASH(s); ***/\n zero(s.head); // Fill with NIL (= 0);\n\n /* Set the default configuration parameters:\n */\n s.max_lazy_match = configuration_table[s.level].max_lazy;\n s.good_match = configuration_table[s.level].good_length;\n s.nice_match = configuration_table[s.level].nice_length;\n s.max_chain_length = configuration_table[s.level].max_chain;\n\n s.strstart = 0;\n s.block_start = 0;\n s.lookahead = 0;\n s.insert = 0;\n s.match_length = s.prev_length = MIN_MATCH - 1;\n s.match_available = 0;\n s.ins_h = 0;\n}\n\n\nfunction DeflateState() {\n this.strm = null; /* pointer back to this zlib stream */\n this.status = 0; /* as the name implies */\n this.pending_buf = null; /* output still pending */\n this.pending_buf_size = 0; /* size of pending_buf */\n this.pending_out = 0; /* next pending byte to output to the stream */\n this.pending = 0; /* nb of bytes in the pending buffer */\n this.wrap = 0; /* bit 0 true for zlib, bit 1 true for gzip */\n this.gzhead = null; /* gzip header information to write */\n this.gzindex = 0; /* where in extra, name, or comment */\n this.method = Z_DEFLATED; /* can only be DEFLATED */\n this.last_flush = -1; /* value of flush param for previous deflate call */\n\n this.w_size = 0; /* LZ77 window size (32K by default) */\n this.w_bits = 0; /* log2(w_size) (8..16) */\n this.w_mask = 0; /* w_size - 1 */\n\n this.window = null;\n /* Sliding window. Input bytes are read into the second half of the window,\n * and move to the first half later to keep a dictionary of at least wSize\n * bytes. With this organization, matches are limited to a distance of\n * wSize-MAX_MATCH bytes, but this ensures that IO is always\n * performed with a length multiple of the block size.\n */\n\n this.window_size = 0;\n /* Actual size of window: 2*wSize, except when the user input buffer\n * is directly used as sliding window.\n */\n\n this.prev = null;\n /* Link to older string with same hash index. To limit the size of this\n * array to 64K, this link is maintained only for the last 32K strings.\n * An index in this array is thus a window index modulo 32K.\n */\n\n this.head = null; /* Heads of the hash chains or NIL. */\n\n this.ins_h = 0; /* hash index of string to be inserted */\n this.hash_size = 0; /* number of elements in hash table */\n this.hash_bits = 0; /* log2(hash_size) */\n this.hash_mask = 0; /* hash_size-1 */\n\n this.hash_shift = 0;\n /* Number of bits by which ins_h must be shifted at each input\n * step. It must be such that after MIN_MATCH steps, the oldest\n * byte no longer takes part in the hash key, that is:\n * hash_shift * MIN_MATCH >= hash_bits\n */\n\n this.block_start = 0;\n /* Window position at the beginning of the current output block. Gets\n * negative when the window is moved backwards.\n */\n\n this.match_length = 0; /* length of best match */\n this.prev_match = 0; /* previous match */\n this.match_available = 0; /* set if previous match exists */\n this.strstart = 0; /* start of string to insert */\n this.match_start = 0; /* start of matching string */\n this.lookahead = 0; /* number of valid bytes ahead in window */\n\n this.prev_length = 0;\n /* Length of the best match at previous step. Matches not greater than this\n * are discarded. This is used in the lazy match evaluation.\n */\n\n this.max_chain_length = 0;\n /* To speed up deflation, hash chains are never searched beyond this\n * length. A higher limit improves compression ratio but degrades the\n * speed.\n */\n\n this.max_lazy_match = 0;\n /* Attempt to find a better match only when the current match is strictly\n * smaller than this value. This mechanism is used only for compression\n * levels >= 4.\n */\n // That's alias to max_lazy_match, don't use directly\n //this.max_insert_length = 0;\n /* Insert new strings in the hash table only if the match length is not\n * greater than this length. This saves time but degrades compression.\n * max_insert_length is used only for compression levels <= 3.\n */\n\n this.level = 0; /* compression level (1..9) */\n this.strategy = 0; /* favor or force Huffman coding*/\n\n this.good_match = 0;\n /* Use a faster search when the previous match is longer than this */\n\n this.nice_match = 0; /* Stop searching when current match exceeds this */\n\n /* used by trees.c: */\n\n /* Didn't use ct_data typedef below to suppress compiler warning */\n\n // struct ct_data_s dyn_ltree[HEAP_SIZE]; /* literal and length tree */\n // struct ct_data_s dyn_dtree[2*D_CODES+1]; /* distance tree */\n // struct ct_data_s bl_tree[2*BL_CODES+1]; /* Huffman tree for bit lengths */\n\n // Use flat array of DOUBLE size, with interleaved fata,\n // because JS does not support effective\n this.dyn_ltree = new utils.Buf16(HEAP_SIZE * 2);\n this.dyn_dtree = new utils.Buf16((2 * D_CODES + 1) * 2);\n this.bl_tree = new utils.Buf16((2 * BL_CODES + 1) * 2);\n zero(this.dyn_ltree);\n zero(this.dyn_dtree);\n zero(this.bl_tree);\n\n this.l_desc = null; /* desc. for literal tree */\n this.d_desc = null; /* desc. for distance tree */\n this.bl_desc = null; /* desc. for bit length tree */\n\n //ush bl_count[MAX_BITS+1];\n this.bl_count = new utils.Buf16(MAX_BITS + 1);\n /* number of codes at each bit length for an optimal tree */\n\n //int heap[2*L_CODES+1]; /* heap used to build the Huffman trees */\n this.heap = new utils.Buf16(2 * L_CODES + 1); /* heap used to build the Huffman trees */\n zero(this.heap);\n\n this.heap_len = 0; /* number of elements in the heap */\n this.heap_max = 0; /* element of largest frequency */\n /* The sons of heap[n] are heap[2*n] and heap[2*n+1]. heap[0] is not used.\n * The same heap array is used to build all trees.\n */\n\n this.depth = new utils.Buf16(2 * L_CODES + 1); //uch depth[2*L_CODES+1];\n zero(this.depth);\n /* Depth of each subtree used as tie breaker for trees of equal frequency\n */\n\n this.l_buf = 0; /* buffer index for literals or lengths */\n\n this.lit_bufsize = 0;\n /* Size of match buffer for literals/lengths. There are 4 reasons for\n * limiting lit_bufsize to 64K:\n * - frequencies can be kept in 16 bit counters\n * - if compression is not successful for the first block, all input\n * data is still in the window so we can still emit a stored block even\n * when input comes from standard input. (This can also be done for\n * all blocks if lit_bufsize is not greater than 32K.)\n * - if compression is not successful for a file smaller than 64K, we can\n * even emit a stored file instead of a stored block (saving 5 bytes).\n * This is applicable only for zip (not gzip or zlib).\n * - creating new Huffman trees less frequently may not provide fast\n * adaptation to changes in the input data statistics. (Take for\n * example a binary file with poorly compressible code followed by\n * a highly compressible string table.) Smaller buffer sizes give\n * fast adaptation but have of course the overhead of transmitting\n * trees more frequently.\n * - I can't count above 4\n */\n\n this.last_lit = 0; /* running index in l_buf */\n\n this.d_buf = 0;\n /* Buffer index for distances. To simplify the code, d_buf and l_buf have\n * the same number of elements. To use different lengths, an extra flag\n * array would be necessary.\n */\n\n this.opt_len = 0; /* bit length of current block with optimal trees */\n this.static_len = 0; /* bit length of current block with static trees */\n this.matches = 0; /* number of string matches in current block */\n this.insert = 0; /* bytes at end of window left to insert */\n\n\n this.bi_buf = 0;\n /* Output buffer. bits are inserted starting at the bottom (least\n * significant bits).\n */\n this.bi_valid = 0;\n /* Number of valid bits in bi_buf. All bits above the last valid bit\n * are always zero.\n */\n\n // Used for window memory init. We safely ignore it for JS. That makes\n // sense only for pointers and memory check tools.\n //this.high_water = 0;\n /* High water mark offset in window for initialized bytes -- bytes above\n * this are set to zero in order to avoid memory check warnings when\n * longest match routines access bytes past the input. This is then\n * updated to the new high water mark.\n */\n}\n\n\nfunction deflateResetKeep(strm) {\n var s;\n\n if (!strm || !strm.state) {\n return err(strm, Z_STREAM_ERROR);\n }\n\n strm.total_in = strm.total_out = 0;\n strm.data_type = Z_UNKNOWN;\n\n s = strm.state;\n s.pending = 0;\n s.pending_out = 0;\n\n if (s.wrap < 0) {\n s.wrap = -s.wrap;\n /* was made negative by deflate(..., Z_FINISH); */\n }\n s.status = (s.wrap ? INIT_STATE : BUSY_STATE);\n strm.adler = (s.wrap === 2) ?\n 0 // crc32(0, Z_NULL, 0)\n :\n 1; // adler32(0, Z_NULL, 0)\n s.last_flush = Z_NO_FLUSH;\n trees._tr_init(s);\n return Z_OK;\n}\n\n\nfunction deflateReset(strm) {\n var ret = deflateResetKeep(strm);\n if (ret === Z_OK) {\n lm_init(strm.state);\n }\n return ret;\n}\n\n\nfunction deflateSetHeader(strm, head) {\n if (!strm || !strm.state) { return Z_STREAM_ERROR; }\n if (strm.state.wrap !== 2) { return Z_STREAM_ERROR; }\n strm.state.gzhead = head;\n return Z_OK;\n}\n\n\nfunction deflateInit2(strm, level, method, windowBits, memLevel, strategy) {\n if (!strm) { // === Z_NULL\n return Z_STREAM_ERROR;\n }\n var wrap = 1;\n\n if (level === Z_DEFAULT_COMPRESSION) {\n level = 6;\n }\n\n if (windowBits < 0) { /* suppress zlib wrapper */\n wrap = 0;\n windowBits = -windowBits;\n }\n\n else if (windowBits > 15) {\n wrap = 2; /* write gzip wrapper instead */\n windowBits -= 16;\n }\n\n\n if (memLevel < 1 || memLevel > MAX_MEM_LEVEL || method !== Z_DEFLATED ||\n windowBits < 8 || windowBits > 15 || level < 0 || level > 9 ||\n strategy < 0 || strategy > Z_FIXED) {\n return err(strm, Z_STREAM_ERROR);\n }\n\n\n if (windowBits === 8) {\n windowBits = 9;\n }\n /* until 256-byte window bug fixed */\n\n var s = new DeflateState();\n\n strm.state = s;\n s.strm = strm;\n\n s.wrap = wrap;\n s.gzhead = null;\n s.w_bits = windowBits;\n s.w_size = 1 << s.w_bits;\n s.w_mask = s.w_size - 1;\n\n s.hash_bits = memLevel + 7;\n s.hash_size = 1 << s.hash_bits;\n s.hash_mask = s.hash_size - 1;\n s.hash_shift = ~~((s.hash_bits + MIN_MATCH - 1) / MIN_MATCH);\n\n s.window = new utils.Buf8(s.w_size * 2);\n s.head = new utils.Buf16(s.hash_size);\n s.prev = new utils.Buf16(s.w_size);\n\n // Don't need mem init magic for JS.\n //s.high_water = 0; /* nothing written to s->window yet */\n\n s.lit_bufsize = 1 << (memLevel + 6); /* 16K elements by default */\n\n s.pending_buf_size = s.lit_bufsize * 4;\n\n //overlay = (ushf *) ZALLOC(strm, s->lit_bufsize, sizeof(ush)+2);\n //s->pending_buf = (uchf *) overlay;\n s.pending_buf = new utils.Buf8(s.pending_buf_size);\n\n // It is offset from `s.pending_buf` (size is `s.lit_bufsize * 2`)\n //s->d_buf = overlay + s->lit_bufsize/sizeof(ush);\n s.d_buf = 1 * s.lit_bufsize;\n\n //s->l_buf = s->pending_buf + (1+sizeof(ush))*s->lit_bufsize;\n s.l_buf = (1 + 2) * s.lit_bufsize;\n\n s.level = level;\n s.strategy = strategy;\n s.method = method;\n\n return deflateReset(strm);\n}\n\nfunction deflateInit(strm, level) {\n return deflateInit2(strm, level, Z_DEFLATED, MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY);\n}\n\n\nfunction deflate(strm, flush) {\n var old_flush, s;\n var beg, val; // for gzip header write only\n\n if (!strm || !strm.state ||\n flush > Z_BLOCK || flush < 0) {\n return strm ? err(strm, Z_STREAM_ERROR) : Z_STREAM_ERROR;\n }\n\n s = strm.state;\n\n if (!strm.output ||\n (!strm.input && strm.avail_in !== 0) ||\n (s.status === FINISH_STATE && flush !== Z_FINISH)) {\n return err(strm, (strm.avail_out === 0) ? Z_BUF_ERROR : Z_STREAM_ERROR);\n }\n\n s.strm = strm; /* just in case */\n old_flush = s.last_flush;\n s.last_flush = flush;\n\n /* Write the header */\n if (s.status === INIT_STATE) {\n\n if (s.wrap === 2) { // GZIP header\n strm.adler = 0; //crc32(0L, Z_NULL, 0);\n put_byte(s, 31);\n put_byte(s, 139);\n put_byte(s, 8);\n if (!s.gzhead) { // s->gzhead == Z_NULL\n put_byte(s, 0);\n put_byte(s, 0);\n put_byte(s, 0);\n put_byte(s, 0);\n put_byte(s, 0);\n put_byte(s, s.level === 9 ? 2 :\n (s.strategy >= Z_HUFFMAN_ONLY || s.level < 2 ?\n 4 : 0));\n put_byte(s, OS_CODE);\n s.status = BUSY_STATE;\n }\n else {\n put_byte(s, (s.gzhead.text ? 1 : 0) +\n (s.gzhead.hcrc ? 2 : 0) +\n (!s.gzhead.extra ? 0 : 4) +\n (!s.gzhead.name ? 0 : 8) +\n (!s.gzhead.comment ? 0 : 16)\n );\n put_byte(s, s.gzhead.time & 0xff);\n put_byte(s, (s.gzhead.time >> 8) & 0xff);\n put_byte(s, (s.gzhead.time >> 16) & 0xff);\n put_byte(s, (s.gzhead.time >> 24) & 0xff);\n put_byte(s, s.level === 9 ? 2 :\n (s.strategy >= Z_HUFFMAN_ONLY || s.level < 2 ?\n 4 : 0));\n put_byte(s, s.gzhead.os & 0xff);\n if (s.gzhead.extra && s.gzhead.extra.length) {\n put_byte(s, s.gzhead.extra.length & 0xff);\n put_byte(s, (s.gzhead.extra.length >> 8) & 0xff);\n }\n if (s.gzhead.hcrc) {\n strm.adler = crc32(strm.adler, s.pending_buf, s.pending, 0);\n }\n s.gzindex = 0;\n s.status = EXTRA_STATE;\n }\n }\n else // DEFLATE header\n {\n var header = (Z_DEFLATED + ((s.w_bits - 8) << 4)) << 8;\n var level_flags = -1;\n\n if (s.strategy >= Z_HUFFMAN_ONLY || s.level < 2) {\n level_flags = 0;\n } else if (s.level < 6) {\n level_flags = 1;\n } else if (s.level === 6) {\n level_flags = 2;\n } else {\n level_flags = 3;\n }\n header |= (level_flags << 6);\n if (s.strstart !== 0) { header |= PRESET_DICT; }\n header += 31 - (header % 31);\n\n s.status = BUSY_STATE;\n putShortMSB(s, header);\n\n /* Save the adler32 of the preset dictionary: */\n if (s.strstart !== 0) {\n putShortMSB(s, strm.adler >>> 16);\n putShortMSB(s, strm.adler & 0xffff);\n }\n strm.adler = 1; // adler32(0L, Z_NULL, 0);\n }\n }\n\n//#ifdef GZIP\n if (s.status === EXTRA_STATE) {\n if (s.gzhead.extra/* != Z_NULL*/) {\n beg = s.pending; /* start of bytes to update crc */\n\n while (s.gzindex < (s.gzhead.extra.length & 0xffff)) {\n if (s.pending === s.pending_buf_size) {\n if (s.gzhead.hcrc && s.pending > beg) {\n strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);\n }\n flush_pending(strm);\n beg = s.pending;\n if (s.pending === s.pending_buf_size) {\n break;\n }\n }\n put_byte(s, s.gzhead.extra[s.gzindex] & 0xff);\n s.gzindex++;\n }\n if (s.gzhead.hcrc && s.pending > beg) {\n strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);\n }\n if (s.gzindex === s.gzhead.extra.length) {\n s.gzindex = 0;\n s.status = NAME_STATE;\n }\n }\n else {\n s.status = NAME_STATE;\n }\n }\n if (s.status === NAME_STATE) {\n if (s.gzhead.name/* != Z_NULL*/) {\n beg = s.pending; /* start of bytes to update crc */\n //int val;\n\n do {\n if (s.pending === s.pending_buf_size) {\n if (s.gzhead.hcrc && s.pending > beg) {\n strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);\n }\n flush_pending(strm);\n beg = s.pending;\n if (s.pending === s.pending_buf_size) {\n val = 1;\n break;\n }\n }\n // JS specific: little magic to add zero terminator to end of string\n if (s.gzindex < s.gzhead.name.length) {\n val = s.gzhead.name.charCodeAt(s.gzindex++) & 0xff;\n } else {\n val = 0;\n }\n put_byte(s, val);\n } while (val !== 0);\n\n if (s.gzhead.hcrc && s.pending > beg) {\n strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);\n }\n if (val === 0) {\n s.gzindex = 0;\n s.status = COMMENT_STATE;\n }\n }\n else {\n s.status = COMMENT_STATE;\n }\n }\n if (s.status === COMMENT_STATE) {\n if (s.gzhead.comment/* != Z_NULL*/) {\n beg = s.pending; /* start of bytes to update crc */\n //int val;\n\n do {\n if (s.pending === s.pending_buf_size) {\n if (s.gzhead.hcrc && s.pending > beg) {\n strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);\n }\n flush_pending(strm);\n beg = s.pending;\n if (s.pending === s.pending_buf_size) {\n val = 1;\n break;\n }\n }\n // JS specific: little magic to add zero terminator to end of string\n if (s.gzindex < s.gzhead.comment.length) {\n val = s.gzhead.comment.charCodeAt(s.gzindex++) & 0xff;\n } else {\n val = 0;\n }\n put_byte(s, val);\n } while (val !== 0);\n\n if (s.gzhead.hcrc && s.pending > beg) {\n strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);\n }\n if (val === 0) {\n s.status = HCRC_STATE;\n }\n }\n else {\n s.status = HCRC_STATE;\n }\n }\n if (s.status === HCRC_STATE) {\n if (s.gzhead.hcrc) {\n if (s.pending + 2 > s.pending_buf_size) {\n flush_pending(strm);\n }\n if (s.pending + 2 <= s.pending_buf_size) {\n put_byte(s, strm.adler & 0xff);\n put_byte(s, (strm.adler >> 8) & 0xff);\n strm.adler = 0; //crc32(0L, Z_NULL, 0);\n s.status = BUSY_STATE;\n }\n }\n else {\n s.status = BUSY_STATE;\n }\n }\n//#endif\n\n /* Flush as much pending output as possible */\n if (s.pending !== 0) {\n flush_pending(strm);\n if (strm.avail_out === 0) {\n /* Since avail_out is 0, deflate will be called again with\n * more output space, but possibly with both pending and\n * avail_in equal to zero. There won't be anything to do,\n * but this is not an error situation so make sure we\n * return OK instead of BUF_ERROR at next call of deflate:\n */\n s.last_flush = -1;\n return Z_OK;\n }\n\n /* Make sure there is something to do and avoid duplicate consecutive\n * flushes. For repeated and useless calls with Z_FINISH, we keep\n * returning Z_STREAM_END instead of Z_BUF_ERROR.\n */\n } else if (strm.avail_in === 0 && rank(flush) <= rank(old_flush) &&\n flush !== Z_FINISH) {\n return err(strm, Z_BUF_ERROR);\n }\n\n /* User must not provide more input after the first FINISH: */\n if (s.status === FINISH_STATE && strm.avail_in !== 0) {\n return err(strm, Z_BUF_ERROR);\n }\n\n /* Start a new block or continue the current one.\n */\n if (strm.avail_in !== 0 || s.lookahead !== 0 ||\n (flush !== Z_NO_FLUSH && s.status !== FINISH_STATE)) {\n var bstate = (s.strategy === Z_HUFFMAN_ONLY) ? deflate_huff(s, flush) :\n (s.strategy === Z_RLE ? deflate_rle(s, flush) :\n configuration_table[s.level].func(s, flush));\n\n if (bstate === BS_FINISH_STARTED || bstate === BS_FINISH_DONE) {\n s.status = FINISH_STATE;\n }\n if (bstate === BS_NEED_MORE || bstate === BS_FINISH_STARTED) {\n if (strm.avail_out === 0) {\n s.last_flush = -1;\n /* avoid BUF_ERROR next call, see above */\n }\n return Z_OK;\n /* If flush != Z_NO_FLUSH && avail_out == 0, the next call\n * of deflate should use the same flush parameter to make sure\n * that the flush is complete. So we don't have to output an\n * empty block here, this will be done at next call. This also\n * ensures that for a very small output buffer, we emit at most\n * one empty block.\n */\n }\n if (bstate === BS_BLOCK_DONE) {\n if (flush === Z_PARTIAL_FLUSH) {\n trees._tr_align(s);\n }\n else if (flush !== Z_BLOCK) { /* FULL_FLUSH or SYNC_FLUSH */\n\n trees._tr_stored_block(s, 0, 0, false);\n /* For a full flush, this empty block will be recognized\n * as a special marker by inflate_sync().\n */\n if (flush === Z_FULL_FLUSH) {\n /*** CLEAR_HASH(s); ***/ /* forget history */\n zero(s.head); // Fill with NIL (= 0);\n\n if (s.lookahead === 0) {\n s.strstart = 0;\n s.block_start = 0;\n s.insert = 0;\n }\n }\n }\n flush_pending(strm);\n if (strm.avail_out === 0) {\n s.last_flush = -1; /* avoid BUF_ERROR at next call, see above */\n return Z_OK;\n }\n }\n }\n //Assert(strm->avail_out > 0, \"bug2\");\n //if (strm.avail_out <= 0) { throw new Error(\"bug2\");}\n\n if (flush !== Z_FINISH) { return Z_OK; }\n if (s.wrap <= 0) { return Z_STREAM_END; }\n\n /* Write the trailer */\n if (s.wrap === 2) {\n put_byte(s, strm.adler & 0xff);\n put_byte(s, (strm.adler >> 8) & 0xff);\n put_byte(s, (strm.adler >> 16) & 0xff);\n put_byte(s, (strm.adler >> 24) & 0xff);\n put_byte(s, strm.total_in & 0xff);\n put_byte(s, (strm.total_in >> 8) & 0xff);\n put_byte(s, (strm.total_in >> 16) & 0xff);\n put_byte(s, (strm.total_in >> 24) & 0xff);\n }\n else\n {\n putShortMSB(s, strm.adler >>> 16);\n putShortMSB(s, strm.adler & 0xffff);\n }\n\n flush_pending(strm);\n /* If avail_out is zero, the application will call deflate again\n * to flush the rest.\n */\n if (s.wrap > 0) { s.wrap = -s.wrap; }\n /* write the trailer only once! */\n return s.pending !== 0 ? Z_OK : Z_STREAM_END;\n}\n\nfunction deflateEnd(strm) {\n var status;\n\n if (!strm/*== Z_NULL*/ || !strm.state/*== Z_NULL*/) {\n return Z_STREAM_ERROR;\n }\n\n status = strm.state.status;\n if (status !== INIT_STATE &&\n status !== EXTRA_STATE &&\n status !== NAME_STATE &&\n status !== COMMENT_STATE &&\n status !== HCRC_STATE &&\n status !== BUSY_STATE &&\n status !== FINISH_STATE\n ) {\n return err(strm, Z_STREAM_ERROR);\n }\n\n strm.state = null;\n\n return status === BUSY_STATE ? err(strm, Z_DATA_ERROR) : Z_OK;\n}\n\n\n/* =========================================================================\n * Initializes the compression dictionary from the given byte\n * sequence without producing any compressed output.\n */\nfunction deflateSetDictionary(strm, dictionary) {\n var dictLength = dictionary.length;\n\n var s;\n var str, n;\n var wrap;\n var avail;\n var next;\n var input;\n var tmpDict;\n\n if (!strm/*== Z_NULL*/ || !strm.state/*== Z_NULL*/) {\n return Z_STREAM_ERROR;\n }\n\n s = strm.state;\n wrap = s.wrap;\n\n if (wrap === 2 || (wrap === 1 && s.status !== INIT_STATE) || s.lookahead) {\n return Z_STREAM_ERROR;\n }\n\n /* when using zlib wrappers, compute Adler-32 for provided dictionary */\n if (wrap === 1) {\n /* adler32(strm->adler, dictionary, dictLength); */\n strm.adler = adler32(strm.adler, dictionary, dictLength, 0);\n }\n\n s.wrap = 0; /* avoid computing Adler-32 in read_buf */\n\n /* if dictionary would fill window, just replace the history */\n if (dictLength >= s.w_size) {\n if (wrap === 0) { /* already empty otherwise */\n /*** CLEAR_HASH(s); ***/\n zero(s.head); // Fill with NIL (= 0);\n s.strstart = 0;\n s.block_start = 0;\n s.insert = 0;\n }\n /* use the tail */\n // dictionary = dictionary.slice(dictLength - s.w_size);\n tmpDict = new utils.Buf8(s.w_size);\n utils.arraySet(tmpDict, dictionary, dictLength - s.w_size, s.w_size, 0);\n dictionary = tmpDict;\n dictLength = s.w_size;\n }\n /* insert dictionary into window and hash */\n avail = strm.avail_in;\n next = strm.next_in;\n input = strm.input;\n strm.avail_in = dictLength;\n strm.next_in = 0;\n strm.input = dictionary;\n fill_window(s);\n while (s.lookahead >= MIN_MATCH) {\n str = s.strstart;\n n = s.lookahead - (MIN_MATCH - 1);\n do {\n /* UPDATE_HASH(s, s->ins_h, s->window[str + MIN_MATCH-1]); */\n s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[str + MIN_MATCH - 1]) & s.hash_mask;\n\n s.prev[str & s.w_mask] = s.head[s.ins_h];\n\n s.head[s.ins_h] = str;\n str++;\n } while (--n);\n s.strstart = str;\n s.lookahead = MIN_MATCH - 1;\n fill_window(s);\n }\n s.strstart += s.lookahead;\n s.block_start = s.strstart;\n s.insert = s.lookahead;\n s.lookahead = 0;\n s.match_length = s.prev_length = MIN_MATCH - 1;\n s.match_available = 0;\n strm.next_in = next;\n strm.input = input;\n strm.avail_in = avail;\n s.wrap = wrap;\n return Z_OK;\n}\n\n\nexports.deflateInit = deflateInit;\nexports.deflateInit2 = deflateInit2;\nexports.deflateReset = deflateReset;\nexports.deflateResetKeep = deflateResetKeep;\nexports.deflateSetHeader = deflateSetHeader;\nexports.deflate = deflate;\nexports.deflateEnd = deflateEnd;\nexports.deflateSetDictionary = deflateSetDictionary;\nexports.deflateInfo = 'pako deflate (from Nodeca project)';\n\n/* Not implemented\nexports.deflateBound = deflateBound;\nexports.deflateCopy = deflateCopy;\nexports.deflateParams = deflateParams;\nexports.deflatePending = deflatePending;\nexports.deflatePrime = deflatePrime;\nexports.deflateTune = deflateTune;\n*/\n","'use strict';\n\n\nvar zlib_deflate = require('./zlib/deflate');\nvar utils = require('./utils/common');\nvar strings = require('./utils/strings');\nvar msg = require('./zlib/messages');\nvar ZStream = require('./zlib/zstream');\n\nvar toString = Object.prototype.toString;\n\n/* Public constants ==========================================================*/\n/* ===========================================================================*/\n\nvar Z_NO_FLUSH = 0;\nvar Z_FINISH = 4;\n\nvar Z_OK = 0;\nvar Z_STREAM_END = 1;\nvar Z_SYNC_FLUSH = 2;\n\nvar Z_DEFAULT_COMPRESSION = -1;\n\nvar Z_DEFAULT_STRATEGY = 0;\n\nvar Z_DEFLATED = 8;\n\n/* ===========================================================================*/\n\n\n/**\n * class Deflate\n *\n * Generic JS-style wrapper for zlib calls. If you don't need\n * streaming behaviour - use more simple functions: [[deflate]],\n * [[deflateRaw]] and [[gzip]].\n **/\n\n/* internal\n * Deflate.chunks -> Array\n *\n * Chunks of output data, if [[Deflate#onData]] not overridden.\n **/\n\n/**\n * Deflate.result -> Uint8Array|Array\n *\n * Compressed result, generated by default [[Deflate#onData]]\n * and [[Deflate#onEnd]] handlers. Filled after you push last chunk\n * (call [[Deflate#push]] with `Z_FINISH` / `true` param) or if you\n * push a chunk with explicit flush (call [[Deflate#push]] with\n * `Z_SYNC_FLUSH` param).\n **/\n\n/**\n * Deflate.err -> Number\n *\n * Error code after deflate finished. 0 (Z_OK) on success.\n * You will not need it in real life, because deflate errors\n * are possible only on wrong options or bad `onData` / `onEnd`\n * custom handlers.\n **/\n\n/**\n * Deflate.msg -> String\n *\n * Error message, if [[Deflate.err]] != 0\n **/\n\n\n/**\n * new Deflate(options)\n * - options (Object): zlib deflate options.\n *\n * Creates new deflator instance with specified params. Throws exception\n * on bad params. Supported options:\n *\n * - `level`\n * - `windowBits`\n * - `memLevel`\n * - `strategy`\n * - `dictionary`\n *\n * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced)\n * for more information on these.\n *\n * Additional options, for internal needs:\n *\n * - `chunkSize` - size of generated data chunks (16K by default)\n * - `raw` (Boolean) - do raw deflate\n * - `gzip` (Boolean) - create gzip wrapper\n * - `to` (String) - if equal to 'string', then result will be \"binary string\"\n * (each char code [0..255])\n * - `header` (Object) - custom header for gzip\n * - `text` (Boolean) - true if compressed data believed to be text\n * - `time` (Number) - modification time, unix timestamp\n * - `os` (Number) - operation system code\n * - `extra` (Array) - array of bytes with extra data (max 65536)\n * - `name` (String) - file name (binary string)\n * - `comment` (String) - comment (binary string)\n * - `hcrc` (Boolean) - true if header crc should be added\n *\n * ##### Example:\n *\n * ```javascript\n * var pako = require('pako')\n * , chunk1 = Uint8Array([1,2,3,4,5,6,7,8,9])\n * , chunk2 = Uint8Array([10,11,12,13,14,15,16,17,18,19]);\n *\n * var deflate = new pako.Deflate({ level: 3});\n *\n * deflate.push(chunk1, false);\n * deflate.push(chunk2, true); // true -> last chunk\n *\n * if (deflate.err) { throw new Error(deflate.err); }\n *\n * console.log(deflate.result);\n * ```\n **/\nfunction Deflate(options) {\n if (!(this instanceof Deflate)) return new Deflate(options);\n\n this.options = utils.assign({\n level: Z_DEFAULT_COMPRESSION,\n method: Z_DEFLATED,\n chunkSize: 16384,\n windowBits: 15,\n memLevel: 8,\n strategy: Z_DEFAULT_STRATEGY,\n to: ''\n }, options || {});\n\n var opt = this.options;\n\n if (opt.raw && (opt.windowBits > 0)) {\n opt.windowBits = -opt.windowBits;\n }\n\n else if (opt.gzip && (opt.windowBits > 0) && (opt.windowBits < 16)) {\n opt.windowBits += 16;\n }\n\n this.err = 0; // error code, if happens (0 = Z_OK)\n this.msg = ''; // error message\n this.ended = false; // used to avoid multiple onEnd() calls\n this.chunks = []; // chunks of compressed data\n\n this.strm = new ZStream();\n this.strm.avail_out = 0;\n\n var status = zlib_deflate.deflateInit2(\n this.strm,\n opt.level,\n opt.method,\n opt.windowBits,\n opt.memLevel,\n opt.strategy\n );\n\n if (status !== Z_OK) {\n throw new Error(msg[status]);\n }\n\n if (opt.header) {\n zlib_deflate.deflateSetHeader(this.strm, opt.header);\n }\n\n if (opt.dictionary) {\n var dict;\n // Convert data if needed\n if (typeof opt.dictionary === 'string') {\n // If we need to compress text, change encoding to utf8.\n dict = strings.string2buf(opt.dictionary);\n } else if (toString.call(opt.dictionary) === '[object ArrayBuffer]') {\n dict = new Uint8Array(opt.dictionary);\n } else {\n dict = opt.dictionary;\n }\n\n status = zlib_deflate.deflateSetDictionary(this.strm, dict);\n\n if (status !== Z_OK) {\n throw new Error(msg[status]);\n }\n\n this._dict_set = true;\n }\n}\n\n/**\n * Deflate#push(data[, mode]) -> Boolean\n * - data (Uint8Array|Array|ArrayBuffer|String): input data. Strings will be\n * converted to utf8 byte sequence.\n * - mode (Number|Boolean): 0..6 for corresponding Z_NO_FLUSH..Z_TREE modes.\n * See constants. Skipped or `false` means Z_NO_FLUSH, `true` means Z_FINISH.\n *\n * Sends input data to deflate pipe, generating [[Deflate#onData]] calls with\n * new compressed chunks. Returns `true` on success. The last data block must have\n * mode Z_FINISH (or `true`). That will flush internal pending buffers and call\n * [[Deflate#onEnd]]. For interim explicit flushes (without ending the stream) you\n * can use mode Z_SYNC_FLUSH, keeping the compression context.\n *\n * On fail call [[Deflate#onEnd]] with error code and return false.\n *\n * We strongly recommend to use `Uint8Array` on input for best speed (output\n * array format is detected automatically). Also, don't skip last param and always\n * use the same type in your code (boolean or number). That will improve JS speed.\n *\n * For regular `Array`-s make sure all elements are [0..255].\n *\n * ##### Example\n *\n * ```javascript\n * push(chunk, false); // push one of data chunks\n * ...\n * push(chunk, true); // push last chunk\n * ```\n **/\nDeflate.prototype.push = function (data, mode) {\n var strm = this.strm;\n var chunkSize = this.options.chunkSize;\n var status, _mode;\n\n if (this.ended) { return false; }\n\n _mode = (mode === ~~mode) ? mode : ((mode === true) ? Z_FINISH : Z_NO_FLUSH);\n\n // Convert data if needed\n if (typeof data === 'string') {\n // If we need to compress text, change encoding to utf8.\n strm.input = strings.string2buf(data);\n } else if (toString.call(data) === '[object ArrayBuffer]') {\n strm.input = new Uint8Array(data);\n } else {\n strm.input = data;\n }\n\n strm.next_in = 0;\n strm.avail_in = strm.input.length;\n\n do {\n if (strm.avail_out === 0) {\n strm.output = new utils.Buf8(chunkSize);\n strm.next_out = 0;\n strm.avail_out = chunkSize;\n }\n status = zlib_deflate.deflate(strm, _mode); /* no bad return value */\n\n if (status !== Z_STREAM_END && status !== Z_OK) {\n this.onEnd(status);\n this.ended = true;\n return false;\n }\n if (strm.avail_out === 0 || (strm.avail_in === 0 && (_mode === Z_FINISH || _mode === Z_SYNC_FLUSH))) {\n if (this.options.to === 'string') {\n this.onData(strings.buf2binstring(utils.shrinkBuf(strm.output, strm.next_out)));\n } else {\n this.onData(utils.shrinkBuf(strm.output, strm.next_out));\n }\n }\n } while ((strm.avail_in > 0 || strm.avail_out === 0) && status !== Z_STREAM_END);\n\n // Finalize on the last chunk.\n if (_mode === Z_FINISH) {\n status = zlib_deflate.deflateEnd(this.strm);\n this.onEnd(status);\n this.ended = true;\n return status === Z_OK;\n }\n\n // callback interim results if Z_SYNC_FLUSH.\n if (_mode === Z_SYNC_FLUSH) {\n this.onEnd(Z_OK);\n strm.avail_out = 0;\n return true;\n }\n\n return true;\n};\n\n\n/**\n * Deflate#onData(chunk) -> Void\n * - chunk (Uint8Array|Array|String): output data. Type of array depends\n * on js engine support. When string output requested, each chunk\n * will be string.\n *\n * By default, stores data blocks in `chunks[]` property and glue\n * those in `onEnd`. Override this handler, if you need another behaviour.\n **/\nDeflate.prototype.onData = function (chunk) {\n this.chunks.push(chunk);\n};\n\n\n/**\n * Deflate#onEnd(status) -> Void\n * - status (Number): deflate status. 0 (Z_OK) on success,\n * other if not.\n *\n * Called once after you tell deflate that the input stream is\n * complete (Z_FINISH) or should be flushed (Z_SYNC_FLUSH)\n * or if an error happened. By default - join collected chunks,\n * free memory and fill `results` / `err` properties.\n **/\nDeflate.prototype.onEnd = function (status) {\n // On success - join\n if (status === Z_OK) {\n if (this.options.to === 'string') {\n this.result = this.chunks.join('');\n } else {\n this.result = utils.flattenChunks(this.chunks);\n }\n }\n this.chunks = [];\n this.err = status;\n this.msg = this.strm.msg;\n};\n\n\n/**\n * deflate(data[, options]) -> Uint8Array|Array|String\n * - data (Uint8Array|Array|String): input data to compress.\n * - options (Object): zlib deflate options.\n *\n * Compress `data` with deflate algorithm and `options`.\n *\n * Supported options are:\n *\n * - level\n * - windowBits\n * - memLevel\n * - strategy\n * - dictionary\n *\n * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced)\n * for more information on these.\n *\n * Sugar (options):\n *\n * - `raw` (Boolean) - say that we work with raw stream, if you don't wish to specify\n * negative windowBits implicitly.\n * - `to` (String) - if equal to 'string', then result will be \"binary string\"\n * (each char code [0..255])\n *\n * ##### Example:\n *\n * ```javascript\n * var pako = require('pako')\n * , data = Uint8Array([1,2,3,4,5,6,7,8,9]);\n *\n * console.log(pako.deflate(data));\n * ```\n **/\nfunction deflate(input, options) {\n var deflator = new Deflate(options);\n\n deflator.push(input, true);\n\n // That will never happens, if you don't cheat with options :)\n if (deflator.err) { throw deflator.msg || msg[deflator.err]; }\n\n return deflator.result;\n}\n\n\n/**\n * deflateRaw(data[, options]) -> Uint8Array|Array|String\n * - data (Uint8Array|Array|String): input data to compress.\n * - options (Object): zlib deflate options.\n *\n * The same as [[deflate]], but creates raw data, without wrapper\n * (header and adler32 crc).\n **/\nfunction deflateRaw(input, options) {\n options = options || {};\n options.raw = true;\n return deflate(input, options);\n}\n\n\n/**\n * gzip(data[, options]) -> Uint8Array|Array|String\n * - data (Uint8Array|Array|String): input data to compress.\n * - options (Object): zlib deflate options.\n *\n * The same as [[deflate]], but create gzip wrapper instead of\n * deflate one.\n **/\nfunction gzip(input, options) {\n options = options || {};\n options.gzip = true;\n return deflate(input, options);\n}\n\n\nexports.Deflate = Deflate;\nexports.deflate = deflate;\nexports.deflateRaw = deflateRaw;\nexports.gzip = gzip;\n","// Top level file is just a mixin of submodules & constants\n'use strict';\n\nvar assign = require('./lib/utils/common').assign;\n\nvar deflate = require('./lib/deflate');\nvar inflate = require('./lib/inflate');\nvar constants = require('./lib/zlib/constants');\n\nvar pako = {};\n\nassign(pako, deflate, inflate, constants);\n\nmodule.exports = pako;\n","'use strict';\nvar USE_TYPEDARRAY = (typeof Uint8Array !== 'undefined') && (typeof Uint16Array !== 'undefined') && (typeof Uint32Array !== 'undefined');\n\nvar pako = require(\"pako\");\nvar utils = require(\"./utils\");\nvar GenericWorker = require(\"./stream/GenericWorker\");\n\nvar ARRAY_TYPE = USE_TYPEDARRAY ? \"uint8array\" : \"array\";\n\nexports.magic = \"\\x08\\x00\";\n\n/**\n * Create a worker that uses pako to inflate/deflate.\n * @constructor\n * @param {String} action the name of the pako function to call : either \"Deflate\" or \"Inflate\".\n * @param {Object} options the options to use when (de)compressing.\n */\nfunction FlateWorker(action, options) {\n GenericWorker.call(this, \"FlateWorker/\" + action);\n\n this._pako = null;\n this._pakoAction = action;\n this._pakoOptions = options;\n // the `meta` object from the last chunk received\n // this allow this worker to pass around metadata\n this.meta = {};\n}\n\nutils.inherits(FlateWorker, GenericWorker);\n\n/**\n * @see GenericWorker.processChunk\n */\nFlateWorker.prototype.processChunk = function (chunk) {\n this.meta = chunk.meta;\n if (this._pako === null) {\n this._createPako();\n }\n this._pako.push(utils.transformTo(ARRAY_TYPE, chunk.data), false);\n};\n\n/**\n * @see GenericWorker.flush\n */\nFlateWorker.prototype.flush = function () {\n GenericWorker.prototype.flush.call(this);\n if (this._pako === null) {\n this._createPako();\n }\n this._pako.push([], true);\n};\n/**\n * @see GenericWorker.cleanUp\n */\nFlateWorker.prototype.cleanUp = function () {\n GenericWorker.prototype.cleanUp.call(this);\n this._pako = null;\n};\n\n/**\n * Create the _pako object.\n * TODO: lazy-loading this object isn't the best solution but it's the\n * quickest. The best solution is to lazy-load the worker list. See also the\n * issue #446.\n */\nFlateWorker.prototype._createPako = function () {\n this._pako = new pako[this._pakoAction]({\n raw: true,\n level: this._pakoOptions.level || -1 // default compression\n });\n var self = this;\n this._pako.onData = function(data) {\n self.push({\n data : data,\n meta : self.meta\n });\n };\n};\n\nexports.compressWorker = function (compressionOptions) {\n return new FlateWorker(\"Deflate\", compressionOptions);\n};\nexports.uncompressWorker = function () {\n return new FlateWorker(\"Inflate\", {});\n};\n","'use strict';\n\nvar compressions = require('../compressions');\nvar ZipFileWorker = require('./ZipFileWorker');\n\n/**\n * Find the compression to use.\n * @param {String} fileCompression the compression defined at the file level, if any.\n * @param {String} zipCompression the compression defined at the load() level.\n * @return {Object} the compression object to use.\n */\nvar getCompression = function (fileCompression, zipCompression) {\n\n var compressionName = fileCompression || zipCompression;\n var compression = compressions[compressionName];\n if (!compression) {\n throw new Error(compressionName + \" is not a valid compression method !\");\n }\n return compression;\n};\n\n/**\n * Create a worker to generate a zip file.\n * @param {JSZip} zip the JSZip instance at the right root level.\n * @param {Object} options to generate the zip file.\n * @param {String} comment the comment to use.\n */\nexports.generateWorker = function (zip, options, comment) {\n\n var zipFileWorker = new ZipFileWorker(options.streamFiles, comment, options.platform, options.encodeFileName);\n var entriesCount = 0;\n try {\n\n zip.forEach(function (relativePath, file) {\n entriesCount++;\n var compression = getCompression(file.options.compression, options.compression);\n var compressionOptions = file.options.compressionOptions || options.compressionOptions || {};\n var dir = file.dir, date = file.date;\n\n file._compressWorker(compression, compressionOptions)\n .withStreamInfo(\"file\", {\n name : relativePath,\n dir : dir,\n date : date,\n comment : file.comment || \"\",\n unixPermissions : file.unixPermissions,\n dosPermissions : file.dosPermissions\n })\n .pipe(zipFileWorker);\n });\n zipFileWorker.entriesCount = entriesCount;\n } catch (e) {\n zipFileWorker.error(e);\n }\n\n return zipFileWorker;\n};\n","'use strict';\n\nvar StreamHelper = require('./stream/StreamHelper');\nvar DataWorker = require('./stream/DataWorker');\nvar utf8 = require('./utf8');\nvar CompressedObject = require('./compressedObject');\nvar GenericWorker = require('./stream/GenericWorker');\n\n/**\n * A simple object representing a file in the zip file.\n * @constructor\n * @param {string} name the name of the file\n * @param {String|ArrayBuffer|Uint8Array|Buffer} data the data\n * @param {Object} options the options of the file\n */\nvar ZipObject = function(name, data, options) {\n this.name = name;\n this.dir = options.dir;\n this.date = options.date;\n this.comment = options.comment;\n this.unixPermissions = options.unixPermissions;\n this.dosPermissions = options.dosPermissions;\n\n this._data = data;\n this._dataBinary = options.binary;\n // keep only the compression\n this.options = {\n compression : options.compression,\n compressionOptions : options.compressionOptions\n };\n};\n\nZipObject.prototype = {\n /**\n * Create an internal stream for the content of this object.\n * @param {String} type the type of each chunk.\n * @return StreamHelper the stream.\n */\n internalStream: function (type) {\n var result = null, outputType = \"string\";\n try {\n if (!type) {\n throw new Error(\"No output type specified.\");\n }\n outputType = type.toLowerCase();\n var askUnicodeString = outputType === \"string\" || outputType === \"text\";\n if (outputType === \"binarystring\" || outputType === \"text\") {\n outputType = \"string\";\n }\n result = this._decompressWorker();\n\n var isUnicodeString = !this._dataBinary;\n\n if (isUnicodeString && !askUnicodeString) {\n result = result.pipe(new utf8.Utf8EncodeWorker());\n }\n if (!isUnicodeString && askUnicodeString) {\n result = result.pipe(new utf8.Utf8DecodeWorker());\n }\n } catch (e) {\n result = new GenericWorker(\"error\");\n result.error(e);\n }\n\n return new StreamHelper(result, outputType, \"\");\n },\n\n /**\n * Prepare the content in the asked type.\n * @param {String} type the type of the result.\n * @param {Function} onUpdate a function to call on each internal update.\n * @return Promise the promise of the result.\n */\n async: function (type, onUpdate) {\n return this.internalStream(type).accumulate(onUpdate);\n },\n\n /**\n * Prepare the content as a nodejs stream.\n * @param {String} type the type of each chunk.\n * @param {Function} onUpdate a function to call on each internal update.\n * @return Stream the stream.\n */\n nodeStream: function (type, onUpdate) {\n return this.internalStream(type || \"nodebuffer\").toNodejsStream(onUpdate);\n },\n\n /**\n * Return a worker for the compressed content.\n * @private\n * @param {Object} compression the compression object to use.\n * @param {Object} compressionOptions the options to use when compressing.\n * @return Worker the worker.\n */\n _compressWorker: function (compression, compressionOptions) {\n if (\n this._data instanceof CompressedObject &&\n this._data.compression.magic === compression.magic\n ) {\n return this._data.getCompressedWorker();\n } else {\n var result = this._decompressWorker();\n if(!this._dataBinary) {\n result = result.pipe(new utf8.Utf8EncodeWorker());\n }\n return CompressedObject.createWorkerFrom(result, compression, compressionOptions);\n }\n },\n /**\n * Return a worker for the decompressed content.\n * @private\n * @return Worker the worker.\n */\n _decompressWorker : function () {\n if (this._data instanceof CompressedObject) {\n return this._data.getContentWorker();\n } else if (this._data instanceof GenericWorker) {\n return this._data;\n } else {\n return new DataWorker(this._data);\n }\n }\n};\n\nvar removedMethods = [\"asText\", \"asBinary\", \"asNodeBuffer\", \"asUint8Array\", \"asArrayBuffer\"];\nvar removedFn = function () {\n throw new Error(\"This method has been removed in JSZip 3.0, please check the upgrade guide.\");\n};\n\nfor(var i = 0; i < removedMethods.length; i++) {\n ZipObject.prototype[removedMethods[i]] = removedFn;\n}\nmodule.exports = ZipObject;\n","'use strict';\n\nvar Readable = require('readable-stream').Readable;\n\nvar utils = require('../utils');\nutils.inherits(NodejsStreamOutputAdapter, Readable);\n\n/**\n* A nodejs stream using a worker as source.\n* @see the SourceWrapper in http://nodejs.org/api/stream.html\n* @constructor\n* @param {StreamHelper} helper the helper wrapping the worker\n* @param {Object} options the nodejs stream options\n* @param {Function} updateCb the update callback.\n*/\nfunction NodejsStreamOutputAdapter(helper, options, updateCb) {\n Readable.call(this, options);\n this._helper = helper;\n\n var self = this;\n helper.on(\"data\", function (data, meta) {\n if (!self.push(data)) {\n self._helper.pause();\n }\n if(updateCb) {\n updateCb(meta);\n }\n })\n .on(\"error\", function(e) {\n self.emit('error', e);\n })\n .on(\"end\", function () {\n self.push(null);\n });\n}\n\n\nNodejsStreamOutputAdapter.prototype._read = function() {\n this._helper.resume();\n};\n\nmodule.exports = NodejsStreamOutputAdapter;\n","'use strict';\n\nvar GenericWorker = require('./GenericWorker');\nvar utils = require('../utils');\n\n/**\n * A worker which convert chunks to a specified type.\n * @constructor\n * @param {String} destType the destination type.\n */\nfunction ConvertWorker(destType) {\n GenericWorker.call(this, \"ConvertWorker to \" + destType);\n this.destType = destType;\n}\nutils.inherits(ConvertWorker, GenericWorker);\n\n/**\n * @see GenericWorker.processChunk\n */\nConvertWorker.prototype.processChunk = function (chunk) {\n this.push({\n data : utils.transformTo(this.destType, chunk.data),\n meta : chunk.meta\n });\n};\nmodule.exports = ConvertWorker;\n","'use strict';\nvar Mutation = global.MutationObserver || global.WebKitMutationObserver;\n\nvar scheduleDrain;\n\n{\n if (Mutation) {\n var called = 0;\n var observer = new Mutation(nextTick);\n var element = global.document.createTextNode('');\n observer.observe(element, {\n characterData: true\n });\n scheduleDrain = function () {\n element.data = (called = ++called % 2);\n };\n } else if (!global.setImmediate && typeof global.MessageChannel !== 'undefined') {\n var channel = new global.MessageChannel();\n channel.port1.onmessage = nextTick;\n scheduleDrain = function () {\n channel.port2.postMessage(0);\n };\n } else if ('document' in global && 'onreadystatechange' in global.document.createElement('script')) {\n scheduleDrain = function () {\n\n // Create a <script> element; its readystatechange event will be fired asynchronously once it is inserted\n // into the document. Do so, thus queuing up the task. Remember to clean up once it's been called.\n var scriptEl = global.document.createElement('script');\n scriptEl.onreadystatechange = function () {\n nextTick();\n\n scriptEl.onreadystatechange = null;\n scriptEl.parentNode.removeChild(scriptEl);\n scriptEl = null;\n };\n global.document.documentElement.appendChild(scriptEl);\n };\n } else {\n scheduleDrain = function () {\n setTimeout(nextTick, 0);\n };\n }\n}\n\nvar draining;\nvar queue = [];\n//named nextTick for less confusing stack traces\nfunction nextTick() {\n draining = true;\n var i, oldQueue;\n var len = queue.length;\n while (len) {\n oldQueue = queue;\n queue = [];\n i = -1;\n while (++i < len) {\n oldQueue[i]();\n }\n len = queue.length;\n }\n draining = false;\n}\n\nmodule.exports = immediate;\nfunction immediate(task) {\n if (queue.push(task) === 1 && !draining) {\n scheduleDrain();\n }\n}\n","'use strict';\nvar immediate = require('immediate');\n\n/* istanbul ignore next */\nfunction INTERNAL() {}\n\nvar handlers = {};\n\nvar REJECTED = ['REJECTED'];\nvar FULFILLED = ['FULFILLED'];\nvar PENDING = ['PENDING'];\n\nmodule.exports = Promise;\n\nfunction Promise(resolver) {\n if (typeof resolver !== 'function') {\n throw new TypeError('resolver must be a function');\n }\n this.state = PENDING;\n this.queue = [];\n this.outcome = void 0;\n if (resolver !== INTERNAL) {\n safelyResolveThenable(this, resolver);\n }\n}\n\nPromise.prototype[\"catch\"] = function (onRejected) {\n return this.then(null, onRejected);\n};\nPromise.prototype.then = function (onFulfilled, onRejected) {\n if (typeof onFulfilled !== 'function' && this.state === FULFILLED ||\n typeof onRejected !== 'function' && this.state === REJECTED) {\n return this;\n }\n var promise = new this.constructor(INTERNAL);\n if (this.state !== PENDING) {\n var resolver = this.state === FULFILLED ? onFulfilled : onRejected;\n unwrap(promise, resolver, this.outcome);\n } else {\n this.queue.push(new QueueItem(promise, onFulfilled, onRejected));\n }\n\n return promise;\n};\nfunction QueueItem(promise, onFulfilled, onRejected) {\n this.promise = promise;\n if (typeof onFulfilled === 'function') {\n this.onFulfilled = onFulfilled;\n this.callFulfilled = this.otherCallFulfilled;\n }\n if (typeof onRejected === 'function') {\n this.onRejected = onRejected;\n this.callRejected = this.otherCallRejected;\n }\n}\nQueueItem.prototype.callFulfilled = function (value) {\n handlers.resolve(this.promise, value);\n};\nQueueItem.prototype.otherCallFulfilled = function (value) {\n unwrap(this.promise, this.onFulfilled, value);\n};\nQueueItem.prototype.callRejected = function (value) {\n handlers.reject(this.promise, value);\n};\nQueueItem.prototype.otherCallRejected = function (value) {\n unwrap(this.promise, this.onRejected, value);\n};\n\nfunction unwrap(promise, func, value) {\n immediate(function () {\n var returnValue;\n try {\n returnValue = func(value);\n } catch (e) {\n return handlers.reject(promise, e);\n }\n if (returnValue === promise) {\n handlers.reject(promise, new TypeError('Cannot resolve promise with itself'));\n } else {\n handlers.resolve(promise, returnValue);\n }\n });\n}\n\nhandlers.resolve = function (self, value) {\n var result = tryCatch(getThen, value);\n if (result.status === 'error') {\n return handlers.reject(self, result.value);\n }\n var thenable = result.value;\n\n if (thenable) {\n safelyResolveThenable(self, thenable);\n } else {\n self.state = FULFILLED;\n self.outcome = value;\n var i = -1;\n var len = self.queue.length;\n while (++i < len) {\n self.queue[i].callFulfilled(value);\n }\n }\n return self;\n};\nhandlers.reject = function (self, error) {\n self.state = REJECTED;\n self.outcome = error;\n var i = -1;\n var len = self.queue.length;\n while (++i < len) {\n self.queue[i].callRejected(error);\n }\n return self;\n};\n\nfunction getThen(obj) {\n // Make sure we only access the accessor once as required by the spec\n var then = obj && obj.then;\n if (obj && (typeof obj === 'object' || typeof obj === 'function') && typeof then === 'function') {\n return function appyThen() {\n then.apply(obj, arguments);\n };\n }\n}\n\nfunction safelyResolveThenable(self, thenable) {\n // Either fulfill, reject or reject with error\n var called = false;\n function onError(value) {\n if (called) {\n return;\n }\n called = true;\n handlers.reject(self, value);\n }\n\n function onSuccess(value) {\n if (called) {\n return;\n }\n called = true;\n handlers.resolve(self, value);\n }\n\n function tryToUnwrap() {\n thenable(onSuccess, onError);\n }\n\n var result = tryCatch(tryToUnwrap);\n if (result.status === 'error') {\n onError(result.value);\n }\n}\n\nfunction tryCatch(func, value) {\n var out = {};\n try {\n out.value = func(value);\n out.status = 'success';\n } catch (e) {\n out.status = 'error';\n out.value = e;\n }\n return out;\n}\n\nPromise.resolve = resolve;\nfunction resolve(value) {\n if (value instanceof this) {\n return value;\n }\n return handlers.resolve(new this(INTERNAL), value);\n}\n\nPromise.reject = reject;\nfunction reject(reason) {\n var promise = new this(INTERNAL);\n return handlers.reject(promise, reason);\n}\n\nPromise.all = all;\nfunction all(iterable) {\n var self = this;\n if (Object.prototype.toString.call(iterable) !== '[object Array]') {\n return this.reject(new TypeError('must be an array'));\n }\n\n var len = iterable.length;\n var called = false;\n if (!len) {\n return this.resolve([]);\n }\n\n var values = new Array(len);\n var resolved = 0;\n var i = -1;\n var promise = new this(INTERNAL);\n\n while (++i < len) {\n allResolver(iterable[i], i);\n }\n return promise;\n function allResolver(value, i) {\n self.resolve(value).then(resolveFromAll, function (error) {\n if (!called) {\n called = true;\n handlers.reject(promise, error);\n }\n });\n function resolveFromAll(outValue) {\n values[i] = outValue;\n if (++resolved === len && !called) {\n called = true;\n handlers.resolve(promise, values);\n }\n }\n }\n}\n\nPromise.race = race;\nfunction race(iterable) {\n var self = this;\n if (Object.prototype.toString.call(iterable) !== '[object Array]') {\n return this.reject(new TypeError('must be an array'));\n }\n\n var len = iterable.length;\n var called = false;\n if (!len) {\n return this.resolve([]);\n }\n\n var i = -1;\n var promise = new this(INTERNAL);\n\n while (++i < len) {\n resolver(iterable[i]);\n }\n return promise;\n function resolver(value) {\n self.resolve(value).then(function (response) {\n if (!called) {\n called = true;\n handlers.resolve(promise, response);\n }\n }, function (error) {\n if (!called) {\n called = true;\n handlers.reject(promise, error);\n }\n });\n }\n}\n","var toString = {}.toString;\n\nmodule.exports = function(it){\n return toString.call(it).slice(8, -1);\n};","module.exports = require('./_global').document && document.documentElement;","// fast apply, http://jsperf.lnkit.com/fast-apply/5\nmodule.exports = function(fn, args, that){\n var un = that === undefined;\n switch(args.length){\n case 0: return un ? fn()\n : fn.call(that);\n case 1: return un ? fn(args[0])\n : fn.call(that, args[0]);\n case 2: return un ? fn(args[0], args[1])\n : fn.call(that, args[0], args[1]);\n case 3: return un ? fn(args[0], args[1], args[2])\n : fn.call(that, args[0], args[1], args[2]);\n case 4: return un ? fn(args[0], args[1], args[2], args[3])\n : fn.call(that, args[0], args[1], args[2], args[3]);\n } return fn.apply(that, args);\n};","var ctx = require('./_ctx')\n , invoke = require('./_invoke')\n , html = require('./_html')\n , cel = require('./_dom-create')\n , global = require('./_global')\n , process = global.process\n , setTask = global.setImmediate\n , clearTask = global.clearImmediate\n , MessageChannel = global.MessageChannel\n , counter = 0\n , queue = {}\n , ONREADYSTATECHANGE = 'onreadystatechange'\n , defer, channel, port;\nvar run = function(){\n var id = +this;\n if(queue.hasOwnProperty(id)){\n var fn = queue[id];\n delete queue[id];\n fn();\n }\n};\nvar listener = function(event){\n run.call(event.data);\n};\n// Node.js 0.9+ & IE10+ has setImmediate, otherwise:\nif(!setTask || !clearTask){\n setTask = function setImmediate(fn){\n var args = [], i = 1;\n while(arguments.length > i)args.push(arguments[i++]);\n queue[++counter] = function(){\n invoke(typeof fn == 'function' ? fn : Function(fn), args);\n };\n defer(counter);\n return counter;\n };\n clearTask = function clearImmediate(id){\n delete queue[id];\n };\n // Node.js 0.8-\n if(require('./_cof')(process) == 'process'){\n defer = function(id){\n process.nextTick(ctx(run, id, 1));\n };\n // Browsers with MessageChannel, includes WebWorkers\n } else if(MessageChannel){\n channel = new MessageChannel;\n port = channel.port2;\n channel.port1.onmessage = listener;\n defer = ctx(port.postMessage, port, 1);\n // Browsers with postMessage, skip WebWorkers\n // IE8 has postMessage, but it's sync & typeof its postMessage is 'object'\n } else if(global.addEventListener && typeof postMessage == 'function' && !global.importScripts){\n defer = function(id){\n global.postMessage(id + '', '*');\n };\n global.addEventListener('message', listener, false);\n // IE8-\n } else if(ONREADYSTATECHANGE in cel('script')){\n defer = function(id){\n html.appendChild(cel('script'))[ONREADYSTATECHANGE] = function(){\n html.removeChild(this);\n run.call(id);\n };\n };\n // Rest old browsers\n } else {\n defer = function(id){\n setTimeout(ctx(run, id, 1), 0);\n };\n }\n}\nmodule.exports = {\n set: setTask,\n clear: clearTask\n};","module.exports = function(bitmap, value){\n return {\n enumerable : !(bitmap & 1),\n configurable: !(bitmap & 2),\n writable : !(bitmap & 4),\n value : value\n };\n};","// 7.1.1 ToPrimitive(input [, PreferredType])\nvar isObject = require('./_is-object');\n// instead of the ES6 spec version, we didn't implement @@toPrimitive case\n// and the second argument - flag - preferred type is a string\nmodule.exports = function(it, S){\n if(!isObject(it))return it;\n var fn, val;\n if(S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it)))return val;\n if(typeof (fn = it.valueOf) == 'function' && !isObject(val = fn.call(it)))return val;\n if(!S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it)))return val;\n throw TypeError(\"Can't convert object to primitive value\");\n};","module.exports = !require('./_descriptors') && !require('./_fails')(function(){\r\n return Object.defineProperty(require('./_dom-create')('div'), 'a', {get: function(){ return 7; }}).a != 7;\r\n});","var isObject = require('./_is-object');\nmodule.exports = function(it){\n if(!isObject(it))throw TypeError(it + ' is not an object!');\n return it;\n};","var anObject = require('./_an-object')\n , IE8_DOM_DEFINE = require('./_ie8-dom-define')\n , toPrimitive = require('./_to-primitive')\n , dP = Object.defineProperty;\n\nexports.f = require('./_descriptors') ? Object.defineProperty : function defineProperty(O, P, Attributes){\n anObject(O);\n P = toPrimitive(P, true);\n anObject(Attributes);\n if(IE8_DOM_DEFINE)try {\n return dP(O, P, Attributes);\n } catch(e){ /* empty */ }\n if('get' in Attributes || 'set' in Attributes)throw TypeError('Accessors not supported!');\n if('value' in Attributes)O[P] = Attributes.value;\n return O;\n};","var dP = require('./_object-dp')\n , createDesc = require('./_property-desc');\nmodule.exports = require('./_descriptors') ? function(object, key, value){\n return dP.f(object, key, createDesc(1, value));\n} : function(object, key, value){\n object[key] = value;\n return object;\n};","module.exports = function(it){\n if(typeof it != 'function')throw TypeError(it + ' is not a function!');\n return it;\n};","var global = require('./_global')\n , core = require('./_core')\n , ctx = require('./_ctx')\n , hide = require('./_hide')\n , PROTOTYPE = 'prototype';\n\nvar $export = function(type, name, source){\n var IS_FORCED = type & $export.F\n , IS_GLOBAL = type & $export.G\n , IS_STATIC = type & $export.S\n , IS_PROTO = type & $export.P\n , IS_BIND = type & $export.B\n , IS_WRAP = type & $export.W\n , exports = IS_GLOBAL ? core : core[name] || (core[name] = {})\n , expProto = exports[PROTOTYPE]\n , target = IS_GLOBAL ? global : IS_STATIC ? global[name] : (global[name] || {})[PROTOTYPE]\n , key, own, out;\n if(IS_GLOBAL)source = name;\n for(key in source){\n // contains in native\n own = !IS_FORCED && target && target[key] !== undefined;\n if(own && key in exports)continue;\n // export native or passed\n out = own ? target[key] : source[key];\n // prevent global pollution for namespaces\n exports[key] = IS_GLOBAL && typeof target[key] != 'function' ? source[key]\n // bind timers to global for call from export context\n : IS_BIND && own ? ctx(out, global)\n // wrap global constructors for prevent change them in library\n : IS_WRAP && target[key] == out ? (function(C){\n var F = function(a, b, c){\n if(this instanceof C){\n switch(arguments.length){\n case 0: return new C;\n case 1: return new C(a);\n case 2: return new C(a, b);\n } return new C(a, b, c);\n } return C.apply(this, arguments);\n };\n F[PROTOTYPE] = C[PROTOTYPE];\n return F;\n // make static versions for prototype methods\n })(out) : IS_PROTO && typeof out == 'function' ? ctx(Function.call, out) : out;\n // export proto methods to core.%CONSTRUCTOR%.methods.%NAME%\n if(IS_PROTO){\n (exports.virtual || (exports.virtual = {}))[key] = out;\n // export proto methods to core.%CONSTRUCTOR%.prototype.%NAME%\n if(type & $export.R && expProto && !expProto[key])hide(expProto, key, out);\n }\n }\n};\n// type bitmap\n$export.F = 1; // forced\n$export.G = 2; // global\n$export.S = 4; // static\n$export.P = 8; // proto\n$export.B = 16; // bind\n$export.W = 32; // wrap\n$export.U = 64; // safe\n$export.R = 128; // real proto method for `library` \nmodule.exports = $export;","var $export = require('./_export')\n , $task = require('./_task');\n$export($export.G + $export.B, {\n setImmediate: $task.set,\n clearImmediate: $task.clear\n});","require('../modules/web.immediate');\nmodule.exports = require('../modules/_core').setImmediate;","module.exports = require('./readable').PassThrough\n","module.exports = require('./readable').Transform\n","module.exports = require('./lib/_stream_duplex.js');\n","module.exports = require('./lib/_stream_writable.js');\n","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n// a passthrough stream.\n// basically just the most minimal sort of Transform stream.\n// Every written chunk gets output as-is.\n\n'use strict';\n\nmodule.exports = PassThrough;\n\nvar Transform = require('./_stream_transform');\n\n/*<replacement>*/\nvar util = require('core-util-is');\nutil.inherits = require('inherits');\n/*</replacement>*/\n\nutil.inherits(PassThrough, Transform);\n\nfunction PassThrough(options) {\n if (!(this instanceof PassThrough)) return new PassThrough(options);\n\n Transform.call(this, options);\n}\n\nPassThrough.prototype._transform = function (chunk, encoding, cb) {\n cb(null, chunk);\n};","\n/**\n * Module exports.\n */\n\nmodule.exports = deprecate;\n\n/**\n * Mark that a method should not be used.\n * Returns a modified function which warns once by default.\n *\n * If `localStorage.noDeprecation = true` is set, then it is a no-op.\n *\n * If `localStorage.throwDeprecation = true` is set, then deprecated functions\n * will throw an Error when invoked.\n *\n * If `localStorage.traceDeprecation = true` is set, then deprecated functions\n * will invoke `console.trace()` instead of `console.error()`.\n *\n * @param {Function} fn - the function to deprecate\n * @param {String} msg - the string to print to the console when `fn` is invoked\n * @returns {Function} a new \"deprecated\" version of `fn`\n * @api public\n */\n\nfunction deprecate (fn, msg) {\n if (config('noDeprecation')) {\n return fn;\n }\n\n var warned = false;\n function deprecated() {\n if (!warned) {\n if (config('throwDeprecation')) {\n throw new Error(msg);\n } else if (config('traceDeprecation')) {\n console.trace(msg);\n } else {\n console.warn(msg);\n }\n warned = true;\n }\n return fn.apply(this, arguments);\n }\n\n return deprecated;\n}\n\n/**\n * Checks `localStorage` for boolean values for the given `name`.\n *\n * @param {String} name\n * @returns {Boolean}\n * @api private\n */\n\nfunction config (name) {\n // accessing global.localStorage can trigger a DOMException in sandboxed iframes\n try {\n if (!global.localStorage) return false;\n } catch (_) {\n return false;\n }\n var val = global.localStorage[name];\n if (null == val) return false;\n return String(val).toLowerCase() === 'true';\n}\n","(function (global, undefined) {\n \"use strict\";\n\n if (global.setImmediate) {\n return;\n }\n\n var nextHandle = 1; // Spec says greater than zero\n var tasksByHandle = {};\n var currentlyRunningATask = false;\n var doc = global.document;\n var registerImmediate;\n\n function setImmediate(callback) {\n // Callback can either be a function or a string\n if (typeof callback !== \"function\") {\n callback = new Function(\"\" + callback);\n }\n // Copy function arguments\n var args = new Array(arguments.length - 1);\n for (var i = 0; i < args.length; i++) {\n args[i] = arguments[i + 1];\n }\n // Store and register the task\n var task = { callback: callback, args: args };\n tasksByHandle[nextHandle] = task;\n registerImmediate(nextHandle);\n return nextHandle++;\n }\n\n function clearImmediate(handle) {\n delete tasksByHandle[handle];\n }\n\n function run(task) {\n var callback = task.callback;\n var args = task.args;\n switch (args.length) {\n case 0:\n callback();\n break;\n case 1:\n callback(args[0]);\n break;\n case 2:\n callback(args[0], args[1]);\n break;\n case 3:\n callback(args[0], args[1], args[2]);\n break;\n default:\n callback.apply(undefined, args);\n break;\n }\n }\n\n function runIfPresent(handle) {\n // From the spec: \"Wait until any invocations of this algorithm started before this one have completed.\"\n // So if we're currently running a task, we'll need to delay this invocation.\n if (currentlyRunningATask) {\n // Delay by doing a setTimeout. setImmediate was tried instead, but in Firefox 7 it generated a\n // \"too much recursion\" error.\n setTimeout(runIfPresent, 0, handle);\n } else {\n var task = tasksByHandle[handle];\n if (task) {\n currentlyRunningATask = true;\n try {\n run(task);\n } finally {\n clearImmediate(handle);\n currentlyRunningATask = false;\n }\n }\n }\n }\n\n function installNextTickImplementation() {\n registerImmediate = function(handle) {\n process.nextTick(function () { runIfPresent(handle); });\n };\n }\n\n function canUsePostMessage() {\n // The test against `importScripts` prevents this implementation from being installed inside a web worker,\n // where `global.postMessage` means something completely different and can't be used for this purpose.\n if (global.postMessage && !global.importScripts) {\n var postMessageIsAsynchronous = true;\n var oldOnMessage = global.onmessage;\n global.onmessage = function() {\n postMessageIsAsynchronous = false;\n };\n global.postMessage(\"\", \"*\");\n global.onmessage = oldOnMessage;\n return postMessageIsAsynchronous;\n }\n }\n\n function installPostMessageImplementation() {\n // Installs an event handler on `global` for the `message` event: see\n // * https://developer.mozilla.org/en/DOM/window.postMessage\n // * http://www.whatwg.org/specs/web-apps/current-work/multipage/comms.html#crossDocumentMessages\n\n var messagePrefix = \"setImmediate$\" + Math.random() + \"$\";\n var onGlobalMessage = function(event) {\n if (event.source === global &&\n typeof event.data === \"string\" &&\n event.data.indexOf(messagePrefix) === 0) {\n runIfPresent(+event.data.slice(messagePrefix.length));\n }\n };\n\n if (global.addEventListener) {\n global.addEventListener(\"message\", onGlobalMessage, false);\n } else {\n global.attachEvent(\"onmessage\", onGlobalMessage);\n }\n\n registerImmediate = function(handle) {\n global.postMessage(messagePrefix + handle, \"*\");\n };\n }\n\n function installMessageChannelImplementation() {\n var channel = new MessageChannel();\n channel.port1.onmessage = function(event) {\n var handle = event.data;\n runIfPresent(handle);\n };\n\n registerImmediate = function(handle) {\n channel.port2.postMessage(handle);\n };\n }\n\n function installReadyStateChangeImplementation() {\n var html = doc.documentElement;\n registerImmediate = function(handle) {\n // Create a <script> element; its readystatechange event will be fired asynchronously once it is inserted\n // into the document. Do so, thus queuing up the task. Remember to clean up once it's been called.\n var script = doc.createElement(\"script\");\n script.onreadystatechange = function () {\n runIfPresent(handle);\n script.onreadystatechange = null;\n html.removeChild(script);\n script = null;\n };\n html.appendChild(script);\n };\n }\n\n function installSetTimeoutImplementation() {\n registerImmediate = function(handle) {\n setTimeout(runIfPresent, 0, handle);\n };\n }\n\n // If supported, we should attach to the prototype of global, since that is where setTimeout et al. live.\n var attachTo = Object.getPrototypeOf && Object.getPrototypeOf(global);\n attachTo = attachTo && attachTo.setTimeout ? attachTo : global;\n\n // Don't get fooled by e.g. browserify environments.\n if ({}.toString.call(global.process) === \"[object process]\") {\n // For Node.js before 0.9\n installNextTickImplementation();\n\n } else if (canUsePostMessage()) {\n // For non-IE10 modern browsers\n installPostMessageImplementation();\n\n } else if (global.MessageChannel) {\n // For web workers, where supported\n installMessageChannelImplementation();\n\n } else if (doc && \"onreadystatechange\" in doc.createElement(\"script\")) {\n // For IE 68\n installReadyStateChangeImplementation();\n\n } else {\n // For older browsers\n installSetTimeoutImplementation();\n }\n\n attachTo.setImmediate = setImmediate;\n attachTo.clearImmediate = clearImmediate;\n}(typeof self === \"undefined\" ? typeof global === \"undefined\" ? this : global : self));\n","/* (ignored) */","'use strict';\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nvar Buffer = require('safe-buffer').Buffer;\nvar util = require('util');\n\nfunction copyBuffer(src, target, offset) {\n src.copy(target, offset);\n}\n\nmodule.exports = function () {\n function BufferList() {\n _classCallCheck(this, BufferList);\n\n this.head = null;\n this.tail = null;\n this.length = 0;\n }\n\n BufferList.prototype.push = function push(v) {\n var entry = { data: v, next: null };\n if (this.length > 0) this.tail.next = entry;else this.head = entry;\n this.tail = entry;\n ++this.length;\n };\n\n BufferList.prototype.unshift = function unshift(v) {\n var entry = { data: v, next: this.head };\n if (this.length === 0) this.tail = entry;\n this.head = entry;\n ++this.length;\n };\n\n BufferList.prototype.shift = function shift() {\n if (this.length === 0) return;\n var ret = this.head.data;\n if (this.length === 1) this.head = this.tail = null;else this.head = this.head.next;\n --this.length;\n return ret;\n };\n\n BufferList.prototype.clear = function clear() {\n this.head = this.tail = null;\n this.length = 0;\n };\n\n BufferList.prototype.join = function join(s) {\n if (this.length === 0) return '';\n var p = this.head;\n var ret = '' + p.data;\n while (p = p.next) {\n ret += s + p.data;\n }return ret;\n };\n\n BufferList.prototype.concat = function concat(n) {\n if (this.length === 0) return Buffer.alloc(0);\n if (this.length === 1) return this.head.data;\n var ret = Buffer.allocUnsafe(n >>> 0);\n var p = this.head;\n var i = 0;\n while (p) {\n copyBuffer(p.data, ret, i);\n i += p.data.length;\n p = p.next;\n }\n return ret;\n };\n\n return BufferList;\n}();\n\nif (util && util.inspect && util.inspect.custom) {\n module.exports.prototype[util.inspect.custom] = function () {\n var obj = util.inspect({ length: this.length });\n return this.constructor.name + ' ' + obj;\n };\n}","/* (ignored) */","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\nmodule.exports = Stream;\n\nvar EE = require('events').EventEmitter;\nvar inherits = require('inherits');\n\ninherits(Stream, EE);\nStream.Readable = require('readable-stream/readable.js');\nStream.Writable = require('readable-stream/writable.js');\nStream.Duplex = require('readable-stream/duplex.js');\nStream.Transform = require('readable-stream/transform.js');\nStream.PassThrough = require('readable-stream/passthrough.js');\n\n// Backwards-compat with node 0.4.x\nStream.Stream = Stream;\n\n\n\n// old-style streams. Note that the pipe method (the only relevant\n// part of this class) is overridden in the Readable class.\n\nfunction Stream() {\n EE.call(this);\n}\n\nStream.prototype.pipe = function(dest, options) {\n var source = this;\n\n function ondata(chunk) {\n if (dest.writable) {\n if (false === dest.write(chunk) && source.pause) {\n source.pause();\n }\n }\n }\n\n source.on('data', ondata);\n\n function ondrain() {\n if (source.readable && source.resume) {\n source.resume();\n }\n }\n\n dest.on('drain', ondrain);\n\n // If the 'end' option is not supplied, dest.end() will be called when\n // source gets the 'end' or 'close' events. Only dest.end() once.\n if (!dest._isStdio && (!options || options.end !== false)) {\n source.on('end', onend);\n source.on('close', onclose);\n }\n\n var didOnEnd = false;\n function onend() {\n if (didOnEnd) return;\n didOnEnd = true;\n\n dest.end();\n }\n\n\n function onclose() {\n if (didOnEnd) return;\n didOnEnd = true;\n\n if (typeof dest.destroy === 'function') dest.destroy();\n }\n\n // don't leave dangling pipes when there are errors.\n function onerror(er) {\n cleanup();\n if (EE.listenerCount(this, 'error') === 0) {\n throw er; // Unhandled stream error in pipe.\n }\n }\n\n source.on('error', onerror);\n dest.on('error', onerror);\n\n // remove all the event listeners that were added.\n function cleanup() {\n source.removeListener('data', ondata);\n dest.removeListener('drain', ondrain);\n\n source.removeListener('end', onend);\n source.removeListener('close', onclose);\n\n source.removeListener('error', onerror);\n dest.removeListener('error', onerror);\n\n source.removeListener('end', cleanup);\n source.removeListener('close', cleanup);\n\n dest.removeListener('close', cleanup);\n }\n\n source.on('end', cleanup);\n source.on('close', cleanup);\n\n dest.on('close', cleanup);\n\n dest.emit('pipe', source);\n\n // Allow for unix-like usage: A.pipe(B).pipe(C)\n return dest;\n};\n","exports.read = function (buffer, offset, isLE, mLen, nBytes) {\n var e, m\n var eLen = nBytes * 8 - mLen - 1\n var eMax = (1 << eLen) - 1\n var eBias = eMax >> 1\n var nBits = -7\n var i = isLE ? (nBytes - 1) : 0\n var d = isLE ? -1 : 1\n var s = buffer[offset + i]\n\n i += d\n\n e = s & ((1 << (-nBits)) - 1)\n s >>= (-nBits)\n nBits += eLen\n for (; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8) {}\n\n m = e & ((1 << (-nBits)) - 1)\n e >>= (-nBits)\n nBits += mLen\n for (; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8) {}\n\n if (e === 0) {\n e = 1 - eBias\n } else if (e === eMax) {\n return m ? NaN : ((s ? -1 : 1) * Infinity)\n } else {\n m = m + Math.pow(2, mLen)\n e = e - eBias\n }\n return (s ? -1 : 1) * m * Math.pow(2, e - mLen)\n}\n\nexports.write = function (buffer, value, offset, isLE, mLen, nBytes) {\n var e, m, c\n var eLen = nBytes * 8 - mLen - 1\n var eMax = (1 << eLen) - 1\n var eBias = eMax >> 1\n var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)\n var i = isLE ? 0 : (nBytes - 1)\n var d = isLE ? 1 : -1\n var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0\n\n value = Math.abs(value)\n\n if (isNaN(value) || value === Infinity) {\n m = isNaN(value) ? 1 : 0\n e = eMax\n } else {\n e = Math.floor(Math.log(value) / Math.LN2)\n if (value * (c = Math.pow(2, -e)) < 1) {\n e--\n c *= 2\n }\n if (e + eBias >= 1) {\n value += rt / c\n } else {\n value += rt * Math.pow(2, 1 - eBias)\n }\n if (value * c >= 2) {\n e++\n c /= 2\n }\n\n if (e + eBias >= eMax) {\n m = 0\n e = eMax\n } else if (e + eBias >= 1) {\n m = (value * c - 1) * Math.pow(2, mLen)\n e = e + eBias\n } else {\n m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)\n e = 0\n }\n }\n\n for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}\n\n e = (e << mLen) | m\n eLen += mLen\n for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}\n\n buffer[offset + i - d] |= s * 128\n}\n","'use strict'\n\nexports.byteLength = byteLength\nexports.toByteArray = toByteArray\nexports.fromByteArray = fromByteArray\n\nvar lookup = []\nvar revLookup = []\nvar Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array\n\nvar code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'\nfor (var i = 0, len = code.length; i < len; ++i) {\n lookup[i] = code[i]\n revLookup[code.charCodeAt(i)] = i\n}\n\n// Support decoding URL-safe base64 strings, as Node.js does.\n// See: https://en.wikipedia.org/wiki/Base64#URL_applications\nrevLookup['-'.charCodeAt(0)] = 62\nrevLookup['_'.charCodeAt(0)] = 63\n\nfunction placeHoldersCount (b64) {\n var len = b64.length\n if (len % 4 > 0) {\n throw new Error('Invalid string. Length must be a multiple of 4')\n }\n\n // the number of equal signs (place holders)\n // if there are two placeholders, than the two characters before it\n // represent one byte\n // if there is only one, then the three characters before it represent 2 bytes\n // this is just a cheap hack to not do indexOf twice\n return b64[len - 2] === '=' ? 2 : b64[len - 1] === '=' ? 1 : 0\n}\n\nfunction byteLength (b64) {\n // base64 is 4/3 + up to two characters of the original data\n return (b64.length * 3 / 4) - placeHoldersCount(b64)\n}\n\nfunction toByteArray (b64) {\n var i, l, tmp, placeHolders, arr\n var len = b64.length\n placeHolders = placeHoldersCount(b64)\n\n arr = new Arr((len * 3 / 4) - placeHolders)\n\n // if there are placeholders, only get up to the last complete 4 chars\n l = placeHolders > 0 ? len - 4 : len\n\n var L = 0\n\n for (i = 0; i < l; i += 4) {\n tmp = (revLookup[b64.charCodeAt(i)] << 18) | (revLookup[b64.charCodeAt(i + 1)] << 12) | (revLookup[b64.charCodeAt(i + 2)] << 6) | revLookup[b64.charCodeAt(i + 3)]\n arr[L++] = (tmp >> 16) & 0xFF\n arr[L++] = (tmp >> 8) & 0xFF\n arr[L++] = tmp & 0xFF\n }\n\n if (placeHolders === 2) {\n tmp = (revLookup[b64.charCodeAt(i)] << 2) | (revLookup[b64.charCodeAt(i + 1)] >> 4)\n arr[L++] = tmp & 0xFF\n } else if (placeHolders === 1) {\n tmp = (revLookup[b64.charCodeAt(i)] << 10) | (revLookup[b64.charCodeAt(i + 1)] << 4) | (revLookup[b64.charCodeAt(i + 2)] >> 2)\n arr[L++] = (tmp >> 8) & 0xFF\n arr[L++] = tmp & 0xFF\n }\n\n return arr\n}\n\nfunction tripletToBase64 (num) {\n return lookup[num >> 18 & 0x3F] + lookup[num >> 12 & 0x3F] + lookup[num >> 6 & 0x3F] + lookup[num & 0x3F]\n}\n\nfunction encodeChunk (uint8, start, end) {\n var tmp\n var output = []\n for (var i = start; i < end; i += 3) {\n tmp = ((uint8[i] << 16) & 0xFF0000) + ((uint8[i + 1] << 8) & 0xFF00) + (uint8[i + 2] & 0xFF)\n output.push(tripletToBase64(tmp))\n }\n return output.join('')\n}\n\nfunction fromByteArray (uint8) {\n var tmp\n var len = uint8.length\n var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes\n var output = ''\n var parts = []\n var maxChunkLength = 16383 // must be multiple of 3\n\n // go through the array every three bytes, we'll deal with trailing stuff later\n for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {\n parts.push(encodeChunk(uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)))\n }\n\n // pad the end with zeros, but make sure to not forget the extra bytes\n if (extraBytes === 1) {\n tmp = uint8[len - 1]\n output += lookup[tmp >> 2]\n output += lookup[(tmp << 4) & 0x3F]\n output += '=='\n } else if (extraBytes === 2) {\n tmp = (uint8[len - 2] << 8) + (uint8[len - 1])\n output += lookup[tmp >> 10]\n output += lookup[(tmp >> 4) & 0x3F]\n output += lookup[(tmp << 2) & 0x3F]\n output += '='\n }\n\n parts.push(output)\n\n return parts.join('')\n}\n","'use strict';\nvar utf8 = require('./utf8');\nvar utils = require('./utils');\nvar GenericWorker = require('./stream/GenericWorker');\nvar StreamHelper = require('./stream/StreamHelper');\nvar defaults = require('./defaults');\nvar CompressedObject = require('./compressedObject');\nvar ZipObject = require('./zipObject');\nvar generate = require(\"./generate\");\nvar nodejsUtils = require(\"./nodejsUtils\");\nvar NodejsStreamInputAdapter = require(\"./nodejs/NodejsStreamInputAdapter\");\n\n\n/**\n * Add a file in the current folder.\n * @private\n * @param {string} name the name of the file\n * @param {String|ArrayBuffer|Uint8Array|Buffer} data the data of the file\n * @param {Object} originalOptions the options of the file\n * @return {Object} the new file.\n */\nvar fileAdd = function(name, data, originalOptions) {\n // be sure sub folders exist\n var dataType = utils.getTypeOf(data),\n parent;\n\n\n /*\n * Correct options.\n */\n\n var o = utils.extend(originalOptions || {}, defaults);\n o.date = o.date || new Date();\n if (o.compression !== null) {\n o.compression = o.compression.toUpperCase();\n }\n\n if (typeof o.unixPermissions === \"string\") {\n o.unixPermissions = parseInt(o.unixPermissions, 8);\n }\n\n // UNX_IFDIR 0040000 see zipinfo.c\n if (o.unixPermissions && (o.unixPermissions & 0x4000)) {\n o.dir = true;\n }\n // Bit 4 Directory\n if (o.dosPermissions && (o.dosPermissions & 0x0010)) {\n o.dir = true;\n }\n\n if (o.dir) {\n name = forceTrailingSlash(name);\n }\n if (o.createFolders && (parent = parentFolder(name))) {\n folderAdd.call(this, parent, true);\n }\n\n var isUnicodeString = dataType === \"string\" && o.binary === false && o.base64 === false;\n if (!originalOptions || typeof originalOptions.binary === \"undefined\") {\n o.binary = !isUnicodeString;\n }\n\n\n var isCompressedEmpty = (data instanceof CompressedObject) && data.uncompressedSize === 0;\n\n if (isCompressedEmpty || o.dir || !data || data.length === 0) {\n o.base64 = false;\n o.binary = true;\n data = \"\";\n o.compression = \"STORE\";\n dataType = \"string\";\n }\n\n /*\n * Convert content to fit.\n */\n\n var zipObjectContent = null;\n if (data instanceof CompressedObject || data instanceof GenericWorker) {\n zipObjectContent = data;\n } else if (nodejsUtils.isNode && nodejsUtils.isStream(data)) {\n zipObjectContent = new NodejsStreamInputAdapter(name, data);\n } else {\n zipObjectContent = utils.prepareContent(name, data, o.binary, o.optimizedBinaryString, o.base64);\n }\n\n var object = new ZipObject(name, zipObjectContent, o);\n this.files[name] = object;\n /*\n TODO: we can't throw an exception because we have async promises\n (we can have a promise of a Date() for example) but returning a\n promise is useless because file(name, data) returns the JSZip\n object for chaining. Should we break that to allow the user\n to catch the error ?\n\n return external.Promise.resolve(zipObjectContent)\n .then(function () {\n return object;\n });\n */\n};\n\n/**\n * Find the parent folder of the path.\n * @private\n * @param {string} path the path to use\n * @return {string} the parent folder, or \"\"\n */\nvar parentFolder = function (path) {\n if (path.slice(-1) === '/') {\n path = path.substring(0, path.length - 1);\n }\n var lastSlash = path.lastIndexOf('/');\n return (lastSlash > 0) ? path.substring(0, lastSlash) : \"\";\n};\n\n/**\n * Returns the path with a slash at the end.\n * @private\n * @param {String} path the path to check.\n * @return {String} the path with a trailing slash.\n */\nvar forceTrailingSlash = function(path) {\n // Check the name ends with a /\n if (path.slice(-1) !== \"/\") {\n path += \"/\"; // IE doesn't like substr(-1)\n }\n return path;\n};\n\n/**\n * Add a (sub) folder in the current folder.\n * @private\n * @param {string} name the folder's name\n * @param {boolean=} [createFolders] If true, automatically create sub\n * folders. Defaults to false.\n * @return {Object} the new folder.\n */\nvar folderAdd = function(name, createFolders) {\n createFolders = (typeof createFolders !== 'undefined') ? createFolders : defaults.createFolders;\n\n name = forceTrailingSlash(name);\n\n // Does this folder already exist?\n if (!this.files[name]) {\n fileAdd.call(this, name, null, {\n dir: true,\n createFolders: createFolders\n });\n }\n return this.files[name];\n};\n\n/**\n* Cross-window, cross-Node-context regular expression detection\n* @param {Object} object Anything\n* @return {Boolean} true if the object is a regular expression,\n* false otherwise\n*/\nfunction isRegExp(object) {\n return Object.prototype.toString.call(object) === \"[object RegExp]\";\n}\n\n// return the actual prototype of JSZip\nvar out = {\n /**\n * @see loadAsync\n */\n load: function() {\n throw new Error(\"This method has been removed in JSZip 3.0, please check the upgrade guide.\");\n },\n\n\n /**\n * Call a callback function for each entry at this folder level.\n * @param {Function} cb the callback function:\n * function (relativePath, file) {...}\n * It takes 2 arguments : the relative path and the file.\n */\n forEach: function(cb) {\n var filename, relativePath, file;\n for (filename in this.files) {\n if (!this.files.hasOwnProperty(filename)) {\n continue;\n }\n file = this.files[filename];\n relativePath = filename.slice(this.root.length, filename.length);\n if (relativePath && filename.slice(0, this.root.length) === this.root) { // the file is in the current root\n cb(relativePath, file); // TODO reverse the parameters ? need to be clean AND consistent with the filter search fn...\n }\n }\n },\n\n /**\n * Filter nested files/folders with the specified function.\n * @param {Function} search the predicate to use :\n * function (relativePath, file) {...}\n * It takes 2 arguments : the relative path and the file.\n * @return {Array} An array of matching elements.\n */\n filter: function(search) {\n var result = [];\n this.forEach(function (relativePath, entry) {\n if (search(relativePath, entry)) { // the file matches the function\n result.push(entry);\n }\n\n });\n return result;\n },\n\n /**\n * Add a file to the zip file, or search a file.\n * @param {string|RegExp} name The name of the file to add (if data is defined),\n * the name of the file to find (if no data) or a regex to match files.\n * @param {String|ArrayBuffer|Uint8Array|Buffer} data The file data, either raw or base64 encoded\n * @param {Object} o File options\n * @return {JSZip|Object|Array} this JSZip object (when adding a file),\n * a file (when searching by string) or an array of files (when searching by regex).\n */\n file: function(name, data, o) {\n if (arguments.length === 1) {\n if (isRegExp(name)) {\n var regexp = name;\n return this.filter(function(relativePath, file) {\n return !file.dir && regexp.test(relativePath);\n });\n }\n else { // text\n var obj = this.files[this.root + name];\n if (obj && !obj.dir) {\n return obj;\n } else {\n return null;\n }\n }\n }\n else { // more than one argument : we have data !\n name = this.root + name;\n fileAdd.call(this, name, data, o);\n }\n return this;\n },\n\n /**\n * Add a directory to the zip file, or search.\n * @param {String|RegExp} arg The name of the directory to add, or a regex to search folders.\n * @return {JSZip} an object with the new directory as the root, or an array containing matching folders.\n */\n folder: function(arg) {\n if (!arg) {\n return this;\n }\n\n if (isRegExp(arg)) {\n return this.filter(function(relativePath, file) {\n return file.dir && arg.test(relativePath);\n });\n }\n\n // else, name is a new folder\n var name = this.root + arg;\n var newFolder = folderAdd.call(this, name);\n\n // Allow chaining by returning a new object with this folder as the root\n var ret = this.clone();\n ret.root = newFolder.name;\n return ret;\n },\n\n /**\n * Delete a file, or a directory and all sub-files, from the zip\n * @param {string} name the name of the file to delete\n * @return {JSZip} this JSZip object\n */\n remove: function(name) {\n name = this.root + name;\n var file = this.files[name];\n if (!file) {\n // Look for any folders\n if (name.slice(-1) !== \"/\") {\n name += \"/\";\n }\n file = this.files[name];\n }\n\n if (file && !file.dir) {\n // file\n delete this.files[name];\n } else {\n // maybe a folder, delete recursively\n var kids = this.filter(function(relativePath, file) {\n return file.name.slice(0, name.length) === name;\n });\n for (var i = 0; i < kids.length; i++) {\n delete this.files[kids[i].name];\n }\n }\n\n return this;\n },\n\n /**\n * Generate the complete zip file\n * @param {Object} options the options to generate the zip file :\n * - compression, \"STORE\" by default.\n * - type, \"base64\" by default. Values are : string, base64, uint8array, arraybuffer, blob.\n * @return {String|Uint8Array|ArrayBuffer|Buffer|Blob} the zip file\n */\n generate: function(options) {\n throw new Error(\"This method has been removed in JSZip 3.0, please check the upgrade guide.\");\n },\n\n /**\n * Generate the complete zip file as an internal stream.\n * @param {Object} options the options to generate the zip file :\n * - compression, \"STORE\" by default.\n * - type, \"base64\" by default. Values are : string, base64, uint8array, arraybuffer, blob.\n * @return {StreamHelper} the streamed zip file.\n */\n generateInternalStream: function(options) {\n var worker, opts = {};\n try {\n opts = utils.extend(options || {}, {\n streamFiles: false,\n compression: \"STORE\",\n compressionOptions : null,\n type: \"\",\n platform: \"DOS\",\n comment: null,\n mimeType: 'application/zip',\n encodeFileName: utf8.utf8encode\n });\n\n opts.type = opts.type.toLowerCase();\n opts.compression = opts.compression.toUpperCase();\n\n // \"binarystring\" is prefered but the internals use \"string\".\n if(opts.type === \"binarystring\") {\n opts.type = \"string\";\n }\n\n if (!opts.type) {\n throw new Error(\"No output type specified.\");\n }\n\n utils.checkSupport(opts.type);\n\n // accept nodejs `process.platform`\n if(\n opts.platform === 'darwin' ||\n opts.platform === 'freebsd' ||\n opts.platform === 'linux' ||\n opts.platform === 'sunos'\n ) {\n opts.platform = \"UNIX\";\n }\n if (opts.platform === 'win32') {\n opts.platform = \"DOS\";\n }\n\n var comment = opts.comment || this.comment || \"\";\n worker = generate.generateWorker(this, opts, comment);\n } catch (e) {\n worker = new GenericWorker(\"error\");\n worker.error(e);\n }\n return new StreamHelper(worker, opts.type || \"string\", opts.mimeType);\n },\n /**\n * Generate the complete zip file asynchronously.\n * @see generateInternalStream\n */\n generateAsync: function(options, onUpdate) {\n return this.generateInternalStream(options).accumulate(onUpdate);\n },\n /**\n * Generate the complete zip file asynchronously.\n * @see generateInternalStream\n */\n generateNodeStream: function(options, onUpdate) {\n options = options || {};\n if (!options.type) {\n options.type = \"nodebuffer\";\n }\n return this.generateInternalStream(options).toNodejsStream(onUpdate);\n }\n};\nmodule.exports = out;\n","(function (global, factory) {\n\ttypeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :\n\ttypeof define === 'function' && define.amd ? define(['exports'], factory) :\n\t(factory((global.acorn = global.acorn || {}, global.acorn.walk = {})));\n}(this, (function (exports) { 'use strict';\n\n// AST walker module for Mozilla Parser API compatible trees\n\n// A simple walk is one where you simply specify callbacks to be\n// called on specific nodes. The last two arguments are optional. A\n// simple use would be\n//\n// walk.simple(myTree, {\n// Expression: function(node) { ... }\n// });\n//\n// to do something with all expressions. All Parser API node types\n// can be used to identify node types, as well as Expression,\n// Statement, and ScopeBody, which denote categories of nodes.\n//\n// The base argument can be used to pass a custom (recursive)\n// walker, and state can be used to give this walked an initial\n// state.\n\nfunction simple(node, visitors, base, state, override) {\n if (!base) { base = exports.base\n ; }(function c(node, st, override) {\n var type = override || node.type, found = visitors[type];\n base[type](node, st, c);\n if (found) { found(node, st); }\n })(node, state, override);\n}\n\n// An ancestor walk keeps an array of ancestor nodes (including the\n// current node) and passes them to the callback as third parameter\n// (and also as state parameter when no other state is present).\nfunction ancestor(node, visitors, base, state) {\n if (!base) { base = exports.base; }\n var ancestors = [];(function c(node, st, override) {\n var type = override || node.type, found = visitors[type];\n var isNew = node != ancestors[ancestors.length - 1];\n if (isNew) { ancestors.push(node); }\n base[type](node, st, c);\n if (found) { found(node, st || ancestors, ancestors); }\n if (isNew) { ancestors.pop(); }\n })(node, state);\n}\n\n// A recursive walk is one where your functions override the default\n// walkers. They can modify and replace the state parameter that's\n// threaded through the walk, and can opt how and whether to walk\n// their child nodes (by calling their third argument on these\n// nodes).\nfunction recursive(node, state, funcs, base, override) {\n var visitor = funcs ? exports.make(funcs, base) : base;(function c(node, st, override) {\n visitor[override || node.type](node, st, c);\n })(node, state, override);\n}\n\nfunction makeTest(test) {\n if (typeof test == \"string\")\n { return function (type) { return type == test; } }\n else if (!test)\n { return function () { return true; } }\n else\n { return test }\n}\n\nvar Found = function Found(node, state) { this.node = node; this.state = state; };\n\n// A full walk triggers the callback on each node\nfunction full(node, callback, base, state, override) {\n if (!base) { base = exports.base\n ; }(function c(node, st, override) {\n var type = override || node.type;\n base[type](node, st, c);\n if (!override) { callback(node, st, type); }\n })(node, state, override);\n}\n\n// An fullAncestor walk is like an ancestor walk, but triggers\n// the callback on each node\nfunction fullAncestor(node, callback, base, state) {\n if (!base) { base = exports.base; }\n var ancestors = [];(function c(node, st, override) {\n var type = override || node.type;\n var isNew = node != ancestors[ancestors.length - 1];\n if (isNew) { ancestors.push(node); }\n base[type](node, st, c);\n if (!override) { callback(node, st || ancestors, ancestors, type); }\n if (isNew) { ancestors.pop(); }\n })(node, state);\n}\n\n// Find a node with a given start, end, and type (all are optional,\n// null can be used as wildcard). Returns a {node, state} object, or\n// undefined when it doesn't find a matching node.\nfunction findNodeAt(node, start, end, test, base, state) {\n test = makeTest(test);\n if (!base) { base = exports.base; }\n try {\n (function c(node, st, override) {\n var type = override || node.type;\n if ((start == null || node.start <= start) &&\n (end == null || node.end >= end))\n { base[type](node, st, c); }\n if ((start == null || node.start == start) &&\n (end == null || node.end == end) &&\n test(type, node))\n { throw new Found(node, st) }\n })(node, state);\n } catch (e) {\n if (e instanceof Found) { return e }\n throw e\n }\n}\n\n// Find the innermost node of a given type that contains the given\n// position. Interface similar to findNodeAt.\nfunction findNodeAround(node, pos, test, base, state) {\n test = makeTest(test);\n if (!base) { base = exports.base; }\n try {\n (function c(node, st, override) {\n var type = override || node.type;\n if (node.start > pos || node.end < pos) { return }\n base[type](node, st, c);\n if (test(type, node)) { throw new Found(node, st) }\n })(node, state);\n } catch (e) {\n if (e instanceof Found) { return e }\n throw e\n }\n}\n\n// Find the outermost matching node after a given position.\nfunction findNodeAfter(node, pos, test, base, state) {\n test = makeTest(test);\n if (!base) { base = exports.base; }\n try {\n (function c(node, st, override) {\n if (node.end < pos) { return }\n var type = override || node.type;\n if (node.start >= pos && test(type, node)) { throw new Found(node, st) }\n base[type](node, st, c);\n })(node, state);\n } catch (e) {\n if (e instanceof Found) { return e }\n throw e\n }\n}\n\n// Find the outermost matching node before a given position.\nfunction findNodeBefore(node, pos, test, base, state) {\n test = makeTest(test);\n if (!base) { base = exports.base; }\n var max;(function c(node, st, override) {\n if (node.start > pos) { return }\n var type = override || node.type;\n if (node.end <= pos && (!max || max.node.end < node.end) && test(type, node))\n { max = new Found(node, st); }\n base[type](node, st, c);\n })(node, state);\n return max\n}\n\n// Fallback to an Object.create polyfill for older environments.\nvar create = Object.create || function(proto) {\n function Ctor() {}\n Ctor.prototype = proto;\n return new Ctor\n};\n\n// Used to create a custom walker. Will fill in all missing node\n// type properties with the defaults.\nfunction make(funcs, base) {\n if (!base) { base = exports.base; }\n var visitor = create(base);\n for (var type in funcs) { visitor[type] = funcs[type]; }\n return visitor\n}\n\nfunction skipThrough(node, st, c) { c(node, st); }\nfunction ignore(_node, _st, _c) {}\n\n// Node walkers.\n\nvar base = {};\n\nbase.Program = base.BlockStatement = function (node, st, c) {\n for (var i = 0, list = node.body; i < list.length; i += 1)\n {\n var stmt = list[i];\n\n c(stmt, st, \"Statement\");\n }\n};\nbase.Statement = skipThrough;\nbase.EmptyStatement = ignore;\nbase.ExpressionStatement = base.ParenthesizedExpression =\n function (node, st, c) { return c(node.expression, st, \"Expression\"); };\nbase.IfStatement = function (node, st, c) {\n c(node.test, st, \"Expression\");\n c(node.consequent, st, \"Statement\");\n if (node.alternate) { c(node.alternate, st, \"Statement\"); }\n};\nbase.LabeledStatement = function (node, st, c) { return c(node.body, st, \"Statement\"); };\nbase.BreakStatement = base.ContinueStatement = ignore;\nbase.WithStatement = function (node, st, c) {\n c(node.object, st, \"Expression\");\n c(node.body, st, \"Statement\");\n};\nbase.SwitchStatement = function (node, st, c) {\n c(node.discriminant, st, \"Expression\");\n for (var i = 0, list = node.cases; i < list.length; i += 1) {\n var cs = list[i];\n\n if (cs.test) { c(cs.test, st, \"Expression\"); }\n for (var i$1 = 0, list$1 = cs.consequent; i$1 < list$1.length; i$1 += 1)\n {\n var cons = list$1[i$1];\n\n c(cons, st, \"Statement\");\n }\n }\n};\nbase.SwitchCase = function (node, st, c) {\n if (node.test) { c(node.test, st, \"Expression\"); }\n for (var i = 0, list = node.consequent; i < list.length; i += 1)\n {\n var cons = list[i];\n\n c(cons, st, \"Statement\");\n }\n};\nbase.ReturnStatement = base.YieldExpression = base.AwaitExpression = function (node, st, c) {\n if (node.argument) { c(node.argument, st, \"Expression\"); }\n};\nbase.ThrowStatement = base.SpreadElement =\n function (node, st, c) { return c(node.argument, st, \"Expression\"); };\nbase.TryStatement = function (node, st, c) {\n c(node.block, st, \"Statement\");\n if (node.handler) { c(node.handler, st); }\n if (node.finalizer) { c(node.finalizer, st, \"Statement\"); }\n};\nbase.CatchClause = function (node, st, c) {\n c(node.param, st, \"Pattern\");\n c(node.body, st, \"ScopeBody\");\n};\nbase.WhileStatement = base.DoWhileStatement = function (node, st, c) {\n c(node.test, st, \"Expression\");\n c(node.body, st, \"Statement\");\n};\nbase.ForStatement = function (node, st, c) {\n if (node.init) { c(node.init, st, \"ForInit\"); }\n if (node.test) { c(node.test, st, \"Expression\"); }\n if (node.update) { c(node.update, st, \"Expression\"); }\n c(node.body, st, \"Statement\");\n};\nbase.ForInStatement = base.ForOfStatement = function (node, st, c) {\n c(node.left, st, \"ForInit\");\n c(node.right, st, \"Expression\");\n c(node.body, st, \"Statement\");\n};\nbase.ForInit = function (node, st, c) {\n if (node.type == \"VariableDeclaration\") { c(node, st); }\n else { c(node, st, \"Expression\"); }\n};\nbase.DebuggerStatement = ignore;\n\nbase.FunctionDeclaration = function (node, st, c) { return c(node, st, \"Function\"); };\nbase.VariableDeclaration = function (node, st, c) {\n for (var i = 0, list = node.declarations; i < list.length; i += 1)\n {\n var decl = list[i];\n\n c(decl, st);\n }\n};\nbase.VariableDeclarator = function (node, st, c) {\n c(node.id, st, \"Pattern\");\n if (node.init) { c(node.init, st, \"Expression\"); }\n};\n\nbase.Function = function (node, st, c) {\n if (node.id) { c(node.id, st, \"Pattern\"); }\n for (var i = 0, list = node.params; i < list.length; i += 1)\n {\n var param = list[i];\n\n c(param, st, \"Pattern\");\n }\n c(node.body, st, node.expression ? \"ScopeExpression\" : \"ScopeBody\");\n};\n// FIXME drop these node types in next major version\n// (They are awkward, and in ES6 every block can be a scope.)\nbase.ScopeBody = function (node, st, c) { return c(node, st, \"Statement\"); };\nbase.ScopeExpression = function (node, st, c) { return c(node, st, \"Expression\"); };\n\nbase.Pattern = function (node, st, c) {\n if (node.type == \"Identifier\")\n { c(node, st, \"VariablePattern\"); }\n else if (node.type == \"MemberExpression\")\n { c(node, st, \"MemberPattern\"); }\n else\n { c(node, st); }\n};\nbase.VariablePattern = ignore;\nbase.MemberPattern = skipThrough;\nbase.RestElement = function (node, st, c) { return c(node.argument, st, \"Pattern\"); };\nbase.ArrayPattern = function (node, st, c) {\n for (var i = 0, list = node.elements; i < list.length; i += 1) {\n var elt = list[i];\n\n if (elt) { c(elt, st, \"Pattern\"); }\n }\n};\nbase.ObjectPattern = function (node, st, c) {\n for (var i = 0, list = node.properties; i < list.length; i += 1)\n {\n var prop = list[i];\n\n c(prop.value, st, \"Pattern\");\n }\n};\n\nbase.Expression = skipThrough;\nbase.ThisExpression = base.Super = base.MetaProperty = ignore;\nbase.ArrayExpression = function (node, st, c) {\n for (var i = 0, list = node.elements; i < list.length; i += 1) {\n var elt = list[i];\n\n if (elt) { c(elt, st, \"Expression\"); }\n }\n};\nbase.ObjectExpression = function (node, st, c) {\n for (var i = 0, list = node.properties; i < list.length; i += 1)\n {\n var prop = list[i];\n\n c(prop, st);\n }\n};\nbase.FunctionExpression = base.ArrowFunctionExpression = base.FunctionDeclaration;\nbase.SequenceExpression = base.TemplateLiteral = function (node, st, c) {\n for (var i = 0, list = node.expressions; i < list.length; i += 1)\n {\n var expr = list[i];\n\n c(expr, st, \"Expression\");\n }\n};\nbase.UnaryExpression = base.UpdateExpression = function (node, st, c) {\n c(node.argument, st, \"Expression\");\n};\nbase.BinaryExpression = base.LogicalExpression = function (node, st, c) {\n c(node.left, st, \"Expression\");\n c(node.right, st, \"Expression\");\n};\nbase.AssignmentExpression = base.AssignmentPattern = function (node, st, c) {\n c(node.left, st, \"Pattern\");\n c(node.right, st, \"Expression\");\n};\nbase.ConditionalExpression = function (node, st, c) {\n c(node.test, st, \"Expression\");\n c(node.consequent, st, \"Expression\");\n c(node.alternate, st, \"Expression\");\n};\nbase.NewExpression = base.CallExpression = function (node, st, c) {\n c(node.callee, st, \"Expression\");\n if (node.arguments)\n { for (var i = 0, list = node.arguments; i < list.length; i += 1)\n {\n var arg = list[i];\n\n c(arg, st, \"Expression\");\n } }\n};\nbase.MemberExpression = function (node, st, c) {\n c(node.object, st, \"Expression\");\n if (node.computed) { c(node.property, st, \"Expression\"); }\n};\nbase.ExportNamedDeclaration = base.ExportDefaultDeclaration = function (node, st, c) {\n if (node.declaration)\n { c(node.declaration, st, node.type == \"ExportNamedDeclaration\" || node.declaration.id ? \"Statement\" : \"Expression\"); }\n if (node.source) { c(node.source, st, \"Expression\"); }\n};\nbase.ExportAllDeclaration = function (node, st, c) {\n c(node.source, st, \"Expression\");\n};\nbase.ImportDeclaration = function (node, st, c) {\n for (var i = 0, list = node.specifiers; i < list.length; i += 1)\n {\n var spec = list[i];\n\n c(spec, st);\n }\n c(node.source, st, \"Expression\");\n};\nbase.ImportSpecifier = base.ImportDefaultSpecifier = base.ImportNamespaceSpecifier = base.Identifier = base.Literal = ignore;\n\nbase.TaggedTemplateExpression = function (node, st, c) {\n c(node.tag, st, \"Expression\");\n c(node.quasi, st, \"Expression\");\n};\nbase.ClassDeclaration = base.ClassExpression = function (node, st, c) { return c(node, st, \"Class\"); };\nbase.Class = function (node, st, c) {\n if (node.id) { c(node.id, st, \"Pattern\"); }\n if (node.superClass) { c(node.superClass, st, \"Expression\"); }\n for (var i = 0, list = node.body.body; i < list.length; i += 1)\n {\n var item = list[i];\n\n c(item, st);\n }\n};\nbase.MethodDefinition = base.Property = function (node, st, c) {\n if (node.computed) { c(node.key, st, \"Expression\"); }\n c(node.value, st, \"Expression\");\n};\n\nexports.simple = simple;\nexports.ancestor = ancestor;\nexports.recursive = recursive;\nexports.full = full;\nexports.fullAncestor = fullAncestor;\nexports.findNodeAt = findNodeAt;\nexports.findNodeAround = findNodeAround;\nexports.findNodeAfter = findNodeAfter;\nexports.findNodeBefore = findNodeBefore;\nexports.make = make;\nexports.base = base;\n\nObject.defineProperty(exports, '__esModule', { value: true });\n\n})));\n","ace.define(\"ace/snippets\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/event_emitter\",\"ace/lib/lang\",\"ace/range\",\"ace/anchor\",\"ace/keyboard/hash_handler\",\"ace/tokenizer\",\"ace/lib/dom\",\"ace/editor\"], function(acequire, exports, module) {\n\"use strict\";\nvar oop = acequire(\"./lib/oop\");\nvar EventEmitter = acequire(\"./lib/event_emitter\").EventEmitter;\nvar lang = acequire(\"./lib/lang\");\nvar Range = acequire(\"./range\").Range;\nvar Anchor = acequire(\"./anchor\").Anchor;\nvar HashHandler = acequire(\"./keyboard/hash_handler\").HashHandler;\nvar Tokenizer = acequire(\"./tokenizer\").Tokenizer;\nvar comparePoints = Range.comparePoints;\n\nvar SnippetManager = function() {\n this.snippetMap = {};\n this.snippetNameMap = {};\n};\n\n(function() {\n oop.implement(this, EventEmitter);\n \n this.getTokenizer = function() {\n function TabstopToken(str, _, stack) {\n str = str.substr(1);\n if (/^\\d+$/.test(str) && !stack.inFormatString)\n return [{tabstopId: parseInt(str, 10)}];\n return [{text: str}];\n }\n function escape(ch) {\n return \"(?:[^\\\\\\\\\" + ch + \"]|\\\\\\\\.)\";\n }\n SnippetManager.$tokenizer = new Tokenizer({\n start: [\n {regex: /:/, onMatch: function(val, state, stack) {\n if (stack.length && stack[0].expectIf) {\n stack[0].expectIf = false;\n stack[0].elseBranch = stack[0];\n return [stack[0]];\n }\n return \":\";\n }},\n {regex: /\\\\./, onMatch: function(val, state, stack) {\n var ch = val[1];\n if (ch == \"}\" && stack.length) {\n val = ch;\n }else if (\"`$\\\\\".indexOf(ch) != -1) {\n val = ch;\n } else if (stack.inFormatString) {\n if (ch == \"n\")\n val = \"\\n\";\n else if (ch == \"t\")\n val = \"\\n\";\n else if (\"ulULE\".indexOf(ch) != -1) {\n val = {changeCase: ch, local: ch > \"a\"};\n }\n }\n\n return [val];\n }},\n {regex: /}/, onMatch: function(val, state, stack) {\n return [stack.length ? stack.shift() : val];\n }},\n {regex: /\\$(?:\\d+|\\w+)/, onMatch: TabstopToken},\n {regex: /\\$\\{[\\dA-Z_a-z]+/, onMatch: function(str, state, stack) {\n var t = TabstopToken(str.substr(1), state, stack);\n stack.unshift(t[0]);\n return t;\n }, next: \"snippetVar\"},\n {regex: /\\n/, token: \"newline\", merge: false}\n ],\n snippetVar: [\n {regex: \"\\\\|\" + escape(\"\\\\|\") + \"*\\\\|\", onMatch: function(val, state, stack) {\n stack[0].choices = val.slice(1, -1).split(\",\");\n }, next: \"start\"},\n {regex: \"/(\" + escape(\"/\") + \"+)/(?:(\" + escape(\"/\") + \"*)/)(\\\\w*):?\",\n onMatch: function(val, state, stack) {\n var ts = stack[0];\n ts.fmtString = val;\n\n val = this.splitRegex.exec(val);\n ts.guard = val[1];\n ts.fmt = val[2];\n ts.flag = val[3];\n return \"\";\n }, next: \"start\"},\n {regex: \"`\" + escape(\"`\") + \"*`\", onMatch: function(val, state, stack) {\n stack[0].code = val.splice(1, -1);\n return \"\";\n }, next: \"start\"},\n {regex: \"\\\\?\", onMatch: function(val, state, stack) {\n if (stack[0])\n stack[0].expectIf = true;\n }, next: \"start\"},\n {regex: \"([^:}\\\\\\\\]|\\\\\\\\.)*:?\", token: \"\", next: \"start\"}\n ],\n formatString: [\n {regex: \"/(\" + escape(\"/\") + \"+)/\", token: \"regex\"},\n {regex: \"\", onMatch: function(val, state, stack) {\n stack.inFormatString = true;\n }, next: \"start\"}\n ]\n });\n SnippetManager.prototype.getTokenizer = function() {\n return SnippetManager.$tokenizer;\n };\n return SnippetManager.$tokenizer;\n };\n\n this.tokenizeTmSnippet = function(str, startState) {\n return this.getTokenizer().getLineTokens(str, startState).tokens.map(function(x) {\n return x.value || x;\n });\n };\n\n this.$getDefaultValue = function(editor, name) {\n if (/^[A-Z]\\d+$/.test(name)) {\n var i = name.substr(1);\n return (this.variables[name[0] + \"__\"] || {})[i];\n }\n if (/^\\d+$/.test(name)) {\n return (this.variables.__ || {})[name];\n }\n name = name.replace(/^TM_/, \"\");\n\n if (!editor)\n return;\n var s = editor.session;\n switch(name) {\n case \"CURRENT_WORD\":\n var r = s.getWordRange();\n case \"SELECTION\":\n case \"SELECTED_TEXT\":\n return s.getTextRange(r);\n case \"CURRENT_LINE\":\n return s.getLine(editor.getCursorPosition().row);\n case \"PREV_LINE\": // not possible in textmate\n return s.getLine(editor.getCursorPosition().row - 1);\n case \"LINE_INDEX\":\n return editor.getCursorPosition().column;\n case \"LINE_NUMBER\":\n return editor.getCursorPosition().row + 1;\n case \"SOFT_TABS\":\n return s.getUseSoftTabs() ? \"YES\" : \"NO\";\n case \"TAB_SIZE\":\n return s.getTabSize();\n case \"FILENAME\":\n case \"FILEPATH\":\n return \"\";\n case \"FULLNAME\":\n return \"Ace\";\n }\n };\n this.variables = {};\n this.getVariableValue = function(editor, varName) {\n if (this.variables.hasOwnProperty(varName))\n return this.variables[varName](editor, varName) || \"\";\n return this.$getDefaultValue(editor, varName) || \"\";\n };\n this.tmStrFormat = function(str, ch, editor) {\n var flag = ch.flag || \"\";\n var re = ch.guard;\n re = new RegExp(re, flag.replace(/[^gi]/, \"\"));\n var fmtTokens = this.tokenizeTmSnippet(ch.fmt, \"formatString\");\n var _self = this;\n var formatted = str.replace(re, function() {\n _self.variables.__ = arguments;\n var fmtParts = _self.resolveVariables(fmtTokens, editor);\n var gChangeCase = \"E\";\n for (var i = 0; i < fmtParts.length; i++) {\n var ch = fmtParts[i];\n if (typeof ch == \"object\") {\n fmtParts[i] = \"\";\n if (ch.changeCase && ch.local) {\n var next = fmtParts[i + 1];\n if (next && typeof next == \"string\") {\n if (ch.changeCase == \"u\")\n fmtParts[i] = next[0].toUpperCase();\n else\n fmtParts[i] = next[0].toLowerCase();\n fmtParts[i + 1] = next.substr(1);\n }\n } else if (ch.changeCase) {\n gChangeCase = ch.changeCase;\n }\n } else if (gChangeCase == \"U\") {\n fmtParts[i] = ch.toUpperCase();\n } else if (gChangeCase == \"L\") {\n fmtParts[i] = ch.toLowerCase();\n }\n }\n return fmtParts.join(\"\");\n });\n this.variables.__ = null;\n return formatted;\n };\n\n this.resolveVariables = function(snippet, editor) {\n var result = [];\n for (var i = 0; i < snippet.length; i++) {\n var ch = snippet[i];\n if (typeof ch == \"string\") {\n result.push(ch);\n } else if (typeof ch != \"object\") {\n continue;\n } else if (ch.skip) {\n gotoNext(ch);\n } else if (ch.processed < i) {\n continue;\n } else if (ch.text) {\n var value = this.getVariableValue(editor, ch.text);\n if (value && ch.fmtString)\n value = this.tmStrFormat(value, ch);\n ch.processed = i;\n if (ch.expectIf == null) {\n if (value) {\n result.push(value);\n gotoNext(ch);\n }\n } else {\n if (value) {\n ch.skip = ch.elseBranch;\n } else\n gotoNext(ch);\n }\n } else if (ch.tabstopId != null) {\n result.push(ch);\n } else if (ch.changeCase != null) {\n result.push(ch);\n }\n }\n function gotoNext(ch) {\n var i1 = snippet.indexOf(ch, i + 1);\n if (i1 != -1)\n i = i1;\n }\n return result;\n };\n\n this.insertSnippetForSelection = function(editor, snippetText) {\n var cursor = editor.getCursorPosition();\n var line = editor.session.getLine(cursor.row);\n var tabString = editor.session.getTabString();\n var indentString = line.match(/^\\s*/)[0];\n \n if (cursor.column < indentString.length)\n indentString = indentString.slice(0, cursor.column);\n\n snippetText = snippetText.replace(/\\r/g, \"\");\n var tokens = this.tokenizeTmSnippet(snippetText);\n tokens = this.resolveVariables(tokens, editor);\n tokens = tokens.map(function(x) {\n if (x == \"\\n\")\n return x + indentString;\n if (typeof x == \"string\")\n return x.replace(/\\t/g, tabString);\n return x;\n });\n var tabstops = [];\n tokens.forEach(function(p, i) {\n if (typeof p != \"object\")\n return;\n var id = p.tabstopId;\n var ts = tabstops[id];\n if (!ts) {\n ts = tabstops[id] = [];\n ts.index = id;\n ts.value = \"\";\n }\n if (ts.indexOf(p) !== -1)\n return;\n ts.push(p);\n var i1 = tokens.indexOf(p, i + 1);\n if (i1 === -1)\n return;\n\n var value = tokens.slice(i + 1, i1);\n var isNested = value.some(function(t) {return typeof t === \"object\";});\n if (isNested && !ts.value) {\n ts.value = value;\n } else if (value.length && (!ts.value || typeof ts.value !== \"string\")) {\n ts.value = value.join(\"\");\n }\n });\n tabstops.forEach(function(ts) {ts.length = 0;});\n var expanding = {};\n function copyValue(val) {\n var copy = [];\n for (var i = 0; i < val.length; i++) {\n var p = val[i];\n if (typeof p == \"object\") {\n if (expanding[p.tabstopId])\n continue;\n var j = val.lastIndexOf(p, i - 1);\n p = copy[j] || {tabstopId: p.tabstopId};\n }\n copy[i] = p;\n }\n return copy;\n }\n for (var i = 0; i < tokens.length; i++) {\n var p = tokens[i];\n if (typeof p != \"object\")\n continue;\n var id = p.tabstopId;\n var i1 = tokens.indexOf(p, i + 1);\n if (expanding[id]) {\n if (expanding[id] === p)\n expanding[id] = null;\n continue;\n }\n \n var ts = tabstops[id];\n var arg = typeof ts.value == \"string\" ? [ts.value] : copyValue(ts.value);\n arg.unshift(i + 1, Math.max(0, i1 - i));\n arg.push(p);\n expanding[id] = p;\n tokens.splice.apply(tokens, arg);\n\n if (ts.indexOf(p) === -1)\n ts.push(p);\n }\n var row = 0, column = 0;\n var text = \"\";\n tokens.forEach(function(t) {\n if (typeof t === \"string\") {\n var lines = t.split(\"\\n\");\n if (lines.length > 1){\n column = lines[lines.length - 1].length;\n row += lines.length - 1;\n } else\n column += t.length;\n text += t;\n } else {\n if (!t.start)\n t.start = {row: row, column: column};\n else\n t.end = {row: row, column: column};\n }\n });\n var range = editor.getSelectionRange();\n var end = editor.session.replace(range, text);\n\n var tabstopManager = new TabstopManager(editor);\n var selectionId = editor.inVirtualSelectionMode && editor.selection.index;\n tabstopManager.addTabstops(tabstops, range.start, end, selectionId);\n };\n \n this.insertSnippet = function(editor, snippetText) {\n var self = this;\n if (editor.inVirtualSelectionMode)\n return self.insertSnippetForSelection(editor, snippetText);\n \n editor.forEachSelection(function() {\n self.insertSnippetForSelection(editor, snippetText);\n }, null, {keepOrder: true});\n \n if (editor.tabstopManager)\n editor.tabstopManager.tabNext();\n };\n\n this.$getScope = function(editor) {\n var scope = editor.session.$mode.$id || \"\";\n scope = scope.split(\"/\").pop();\n if (scope === \"html\" || scope === \"php\") {\n if (scope === \"php\" && !editor.session.$mode.inlinePhp) \n scope = \"html\";\n var c = editor.getCursorPosition();\n var state = editor.session.getState(c.row);\n if (typeof state === \"object\") {\n state = state[0];\n }\n if (state.substring) {\n if (state.substring(0, 3) == \"js-\")\n scope = \"javascript\";\n else if (state.substring(0, 4) == \"css-\")\n scope = \"css\";\n else if (state.substring(0, 4) == \"php-\")\n scope = \"php\";\n }\n }\n \n return scope;\n };\n\n this.getActiveScopes = function(editor) {\n var scope = this.$getScope(editor);\n var scopes = [scope];\n var snippetMap = this.snippetMap;\n if (snippetMap[scope] && snippetMap[scope].includeScopes) {\n scopes.push.apply(scopes, snippetMap[scope].includeScopes);\n }\n scopes.push(\"_\");\n return scopes;\n };\n\n this.expandWithTab = function(editor, options) {\n var self = this;\n var result = editor.forEachSelection(function() {\n return self.expandSnippetForSelection(editor, options);\n }, null, {keepOrder: true});\n if (result && editor.tabstopManager)\n editor.tabstopManager.tabNext();\n return result;\n };\n \n this.expandSnippetForSelection = function(editor, options) {\n var cursor = editor.getCursorPosition();\n var line = editor.session.getLine(cursor.row);\n var before = line.substring(0, cursor.column);\n var after = line.substr(cursor.column);\n\n var snippetMap = this.snippetMap;\n var snippet;\n this.getActiveScopes(editor).some(function(scope) {\n var snippets = snippetMap[scope];\n if (snippets)\n snippet = this.findMatchingSnippet(snippets, before, after);\n return !!snippet;\n }, this);\n if (!snippet)\n return false;\n if (options && options.dryRun)\n return true;\n editor.session.doc.removeInLine(cursor.row,\n cursor.column - snippet.replaceBefore.length,\n cursor.column + snippet.replaceAfter.length\n );\n\n this.variables.M__ = snippet.matchBefore;\n this.variables.T__ = snippet.matchAfter;\n this.insertSnippetForSelection(editor, snippet.content);\n\n this.variables.M__ = this.variables.T__ = null;\n return true;\n };\n\n this.findMatchingSnippet = function(snippetList, before, after) {\n for (var i = snippetList.length; i--;) {\n var s = snippetList[i];\n if (s.startRe && !s.startRe.test(before))\n continue;\n if (s.endRe && !s.endRe.test(after))\n continue;\n if (!s.startRe && !s.endRe)\n continue;\n\n s.matchBefore = s.startRe ? s.startRe.exec(before) : [\"\"];\n s.matchAfter = s.endRe ? s.endRe.exec(after) : [\"\"];\n s.replaceBefore = s.triggerRe ? s.triggerRe.exec(before)[0] : \"\";\n s.replaceAfter = s.endTriggerRe ? s.endTriggerRe.exec(after)[0] : \"\";\n return s;\n }\n };\n\n this.snippetMap = {};\n this.snippetNameMap = {};\n this.register = function(snippets, scope) {\n var snippetMap = this.snippetMap;\n var snippetNameMap = this.snippetNameMap;\n var self = this;\n \n if (!snippets) \n snippets = [];\n \n function wrapRegexp(src) {\n if (src && !/^\\^?\\(.*\\)\\$?$|^\\\\b$/.test(src))\n src = \"(?:\" + src + \")\";\n\n return src || \"\";\n }\n function guardedRegexp(re, guard, opening) {\n re = wrapRegexp(re);\n guard = wrapRegexp(guard);\n if (opening) {\n re = guard + re;\n if (re && re[re.length - 1] != \"$\")\n re = re + \"$\";\n } else {\n re = re + guard;\n if (re && re[0] != \"^\")\n re = \"^\" + re;\n }\n return new RegExp(re);\n }\n\n function addSnippet(s) {\n if (!s.scope)\n s.scope = scope || \"_\";\n scope = s.scope;\n if (!snippetMap[scope]) {\n snippetMap[scope] = [];\n snippetNameMap[scope] = {};\n }\n\n var map = snippetNameMap[scope];\n if (s.name) {\n var old = map[s.name];\n if (old)\n self.unregister(old);\n map[s.name] = s;\n }\n snippetMap[scope].push(s);\n\n if (s.tabTrigger && !s.trigger) {\n if (!s.guard && /^\\w/.test(s.tabTrigger))\n s.guard = \"\\\\b\";\n s.trigger = lang.escapeRegExp(s.tabTrigger);\n }\n \n if (!s.trigger && !s.guard && !s.endTrigger && !s.endGuard)\n return;\n \n s.startRe = guardedRegexp(s.trigger, s.guard, true);\n s.triggerRe = new RegExp(s.trigger, \"\", true);\n\n s.endRe = guardedRegexp(s.endTrigger, s.endGuard, true);\n s.endTriggerRe = new RegExp(s.endTrigger, \"\", true);\n }\n\n if (snippets && snippets.content)\n addSnippet(snippets);\n else if (Array.isArray(snippets))\n snippets.forEach(addSnippet);\n \n this._signal(\"registerSnippets\", {scope: scope});\n };\n this.unregister = function(snippets, scope) {\n var snippetMap = this.snippetMap;\n var snippetNameMap = this.snippetNameMap;\n\n function removeSnippet(s) {\n var nameMap = snippetNameMap[s.scope||scope];\n if (nameMap && nameMap[s.name]) {\n delete nameMap[s.name];\n var map = snippetMap[s.scope||scope];\n var i = map && map.indexOf(s);\n if (i >= 0)\n map.splice(i, 1);\n }\n }\n if (snippets.content)\n removeSnippet(snippets);\n else if (Array.isArray(snippets))\n snippets.forEach(removeSnippet);\n };\n this.parseSnippetFile = function(str) {\n str = str.replace(/\\r/g, \"\");\n var list = [], snippet = {};\n var re = /^#.*|^({[\\s\\S]*})\\s*$|^(\\S+) (.*)$|^((?:\\n*\\t.*)+)/gm;\n var m;\n while (m = re.exec(str)) {\n if (m[1]) {\n try {\n snippet = JSON.parse(m[1]);\n list.push(snippet);\n } catch (e) {}\n } if (m[4]) {\n snippet.content = m[4].replace(/^\\t/gm, \"\");\n list.push(snippet);\n snippet = {};\n } else {\n var key = m[2], val = m[3];\n if (key == \"regex\") {\n var guardRe = /\\/((?:[^\\/\\\\]|\\\\.)*)|$/g;\n snippet.guard = guardRe.exec(val)[1];\n snippet.trigger = guardRe.exec(val)[1];\n snippet.endTrigger = guardRe.exec(val)[1];\n snippet.endGuard = guardRe.exec(val)[1];\n } else if (key == \"snippet\") {\n snippet.tabTrigger = val.match(/^\\S*/)[0];\n if (!snippet.name)\n snippet.name = val;\n } else {\n snippet[key] = val;\n }\n }\n }\n return list;\n };\n this.getSnippetByName = function(name, editor) {\n var snippetMap = this.snippetNameMap;\n var snippet;\n this.getActiveScopes(editor).some(function(scope) {\n var snippets = snippetMap[scope];\n if (snippets)\n snippet = snippets[name];\n return !!snippet;\n }, this);\n return snippet;\n };\n\n}).call(SnippetManager.prototype);\n\n\nvar TabstopManager = function(editor) {\n if (editor.tabstopManager)\n return editor.tabstopManager;\n editor.tabstopManager = this;\n this.$onChange = this.onChange.bind(this);\n this.$onChangeSelection = lang.delayedCall(this.onChangeSelection.bind(this)).schedule;\n this.$onChangeSession = this.onChangeSession.bind(this);\n this.$onAfterExec = this.onAfterExec.bind(this);\n this.attach(editor);\n};\n(function() {\n this.attach = function(editor) {\n this.index = 0;\n this.ranges = [];\n this.tabstops = [];\n this.$openTabstops = null;\n this.selectedTabstop = null;\n\n this.editor = editor;\n this.editor.on(\"change\", this.$onChange);\n this.editor.on(\"changeSelection\", this.$onChangeSelection);\n this.editor.on(\"changeSession\", this.$onChangeSession);\n this.editor.commands.on(\"afterExec\", this.$onAfterExec);\n this.editor.keyBinding.addKeyboardHandler(this.keyboardHandler);\n };\n this.detach = function() {\n this.tabstops.forEach(this.removeTabstopMarkers, this);\n this.ranges = null;\n this.tabstops = null;\n this.selectedTabstop = null;\n this.editor.removeListener(\"change\", this.$onChange);\n this.editor.removeListener(\"changeSelection\", this.$onChangeSelection);\n this.editor.removeListener(\"changeSession\", this.$onChangeSession);\n this.editor.commands.removeListener(\"afterExec\", this.$onAfterExec);\n this.editor.keyBinding.removeKeyboardHandler(this.keyboardHandler);\n this.editor.tabstopManager = null;\n this.editor = null;\n };\n\n this.onChange = function(delta) {\n var changeRange = delta;\n var isRemove = delta.action[0] == \"r\";\n var start = delta.start;\n var end = delta.end;\n var startRow = start.row;\n var endRow = end.row;\n var lineDif = endRow - startRow;\n var colDiff = end.column - start.column;\n\n if (isRemove) {\n lineDif = -lineDif;\n colDiff = -colDiff;\n }\n if (!this.$inChange && isRemove) {\n var ts = this.selectedTabstop;\n var changedOutside = ts && !ts.some(function(r) {\n return comparePoints(r.start, start) <= 0 && comparePoints(r.end, end) >= 0;\n });\n if (changedOutside)\n return this.detach();\n }\n var ranges = this.ranges;\n for (var i = 0; i < ranges.length; i++) {\n var r = ranges[i];\n if (r.end.row < start.row)\n continue;\n\n if (isRemove && comparePoints(start, r.start) < 0 && comparePoints(end, r.end) > 0) {\n this.removeRange(r);\n i--;\n continue;\n }\n\n if (r.start.row == startRow && r.start.column > start.column)\n r.start.column += colDiff;\n if (r.end.row == startRow && r.end.column >= start.column)\n r.end.column += colDiff;\n if (r.start.row >= startRow)\n r.start.row += lineDif;\n if (r.end.row >= startRow)\n r.end.row += lineDif;\n\n if (comparePoints(r.start, r.end) > 0)\n this.removeRange(r);\n }\n if (!ranges.length)\n this.detach();\n };\n this.updateLinkedFields = function() {\n var ts = this.selectedTabstop;\n if (!ts || !ts.hasLinkedRanges)\n return;\n this.$inChange = true;\n var session = this.editor.session;\n var text = session.getTextRange(ts.firstNonLinked);\n for (var i = ts.length; i--;) {\n var range = ts[i];\n if (!range.linked)\n continue;\n var fmt = exports.snippetManager.tmStrFormat(text, range.original);\n session.replace(range, fmt);\n }\n this.$inChange = false;\n };\n this.onAfterExec = function(e) {\n if (e.command && !e.command.readOnly)\n this.updateLinkedFields();\n };\n this.onChangeSelection = function() {\n if (!this.editor)\n return;\n var lead = this.editor.selection.lead;\n var anchor = this.editor.selection.anchor;\n var isEmpty = this.editor.selection.isEmpty();\n for (var i = this.ranges.length; i--;) {\n if (this.ranges[i].linked)\n continue;\n var containsLead = this.ranges[i].contains(lead.row, lead.column);\n var containsAnchor = isEmpty || this.ranges[i].contains(anchor.row, anchor.column);\n if (containsLead && containsAnchor)\n return;\n }\n this.detach();\n };\n this.onChangeSession = function() {\n this.detach();\n };\n this.tabNext = function(dir) {\n var max = this.tabstops.length;\n var index = this.index + (dir || 1);\n index = Math.min(Math.max(index, 1), max);\n if (index == max)\n index = 0;\n this.selectTabstop(index);\n if (index === 0)\n this.detach();\n };\n this.selectTabstop = function(index) {\n this.$openTabstops = null;\n var ts = this.tabstops[this.index];\n if (ts)\n this.addTabstopMarkers(ts);\n this.index = index;\n ts = this.tabstops[this.index];\n if (!ts || !ts.length)\n return;\n \n this.selectedTabstop = ts;\n if (!this.editor.inVirtualSelectionMode) { \n var sel = this.editor.multiSelect;\n sel.toSingleRange(ts.firstNonLinked.clone());\n for (var i = ts.length; i--;) {\n if (ts.hasLinkedRanges && ts[i].linked)\n continue;\n sel.addRange(ts[i].clone(), true);\n }\n if (sel.ranges[0])\n sel.addRange(sel.ranges[0].clone());\n } else {\n this.editor.selection.setRange(ts.firstNonLinked);\n }\n \n this.editor.keyBinding.addKeyboardHandler(this.keyboardHandler);\n };\n this.addTabstops = function(tabstops, start, end) {\n if (!this.$openTabstops)\n this.$openTabstops = [];\n if (!tabstops[0]) {\n var p = Range.fromPoints(end, end);\n moveRelative(p.start, start);\n moveRelative(p.end, start);\n tabstops[0] = [p];\n tabstops[0].index = 0;\n }\n\n var i = this.index;\n var arg = [i + 1, 0];\n var ranges = this.ranges;\n tabstops.forEach(function(ts, index) {\n var dest = this.$openTabstops[index] || ts;\n \n for (var i = ts.length; i--;) {\n var p = ts[i];\n var range = Range.fromPoints(p.start, p.end || p.start);\n movePoint(range.start, start);\n movePoint(range.end, start);\n range.original = p;\n range.tabstop = dest;\n ranges.push(range);\n if (dest != ts)\n dest.unshift(range);\n else\n dest[i] = range;\n if (p.fmtString) {\n range.linked = true;\n dest.hasLinkedRanges = true;\n } else if (!dest.firstNonLinked)\n dest.firstNonLinked = range;\n }\n if (!dest.firstNonLinked)\n dest.hasLinkedRanges = false;\n if (dest === ts) {\n arg.push(dest);\n this.$openTabstops[index] = dest;\n }\n this.addTabstopMarkers(dest);\n }, this);\n \n if (arg.length > 2) {\n if (this.tabstops.length)\n arg.push(arg.splice(2, 1)[0]);\n this.tabstops.splice.apply(this.tabstops, arg);\n }\n };\n\n this.addTabstopMarkers = function(ts) {\n var session = this.editor.session;\n ts.forEach(function(range) {\n if (!range.markerId)\n range.markerId = session.addMarker(range, \"ace_snippet-marker\", \"text\");\n });\n };\n this.removeTabstopMarkers = function(ts) {\n var session = this.editor.session;\n ts.forEach(function(range) {\n session.removeMarker(range.markerId);\n range.markerId = null;\n });\n };\n this.removeRange = function(range) {\n var i = range.tabstop.indexOf(range);\n range.tabstop.splice(i, 1);\n i = this.ranges.indexOf(range);\n this.ranges.splice(i, 1);\n this.editor.session.removeMarker(range.markerId);\n if (!range.tabstop.length) {\n i = this.tabstops.indexOf(range.tabstop);\n if (i != -1)\n this.tabstops.splice(i, 1);\n if (!this.tabstops.length)\n this.detach();\n }\n };\n\n this.keyboardHandler = new HashHandler();\n this.keyboardHandler.bindKeys({\n \"Tab\": function(ed) {\n if (exports.snippetManager && exports.snippetManager.expandWithTab(ed)) {\n return;\n }\n\n ed.tabstopManager.tabNext(1);\n },\n \"Shift-Tab\": function(ed) {\n ed.tabstopManager.tabNext(-1);\n },\n \"Esc\": function(ed) {\n ed.tabstopManager.detach();\n },\n \"Return\": function(ed) {\n return false;\n }\n });\n}).call(TabstopManager.prototype);\n\n\n\nvar changeTracker = {};\nchangeTracker.onChange = Anchor.prototype.onChange;\nchangeTracker.setPosition = function(row, column) {\n this.pos.row = row;\n this.pos.column = column;\n};\nchangeTracker.update = function(pos, delta, $insertRight) {\n this.$insertRight = $insertRight;\n this.pos = pos; \n this.onChange(delta);\n};\n\nvar movePoint = function(point, diff) {\n if (point.row == 0)\n point.column += diff.column;\n point.row += diff.row;\n};\n\nvar moveRelative = function(point, start) {\n if (point.row == start.row)\n point.column -= start.column;\n point.row -= start.row;\n};\n\n\nacequire(\"./lib/dom\").importCssString(\"\\\n.ace_snippet-marker {\\\n -moz-box-sizing: border-box;\\\n box-sizing: border-box;\\\n background: rgba(194, 193, 208, 0.09);\\\n border: 1px dotted rgba(211, 208, 235, 0.62);\\\n position: absolute;\\\n}\");\n\nexports.snippetManager = new SnippetManager();\n\n\nvar Editor = acequire(\"./editor\").Editor;\n(function() {\n this.insertSnippet = function(content, options) {\n return exports.snippetManager.insertSnippet(this, content, options);\n };\n this.expandSnippet = function(options) {\n return exports.snippetManager.expandWithTab(this, options);\n };\n}).call(Editor.prototype);\n\n});\n\nace.define(\"ace/autocomplete/popup\",[\"require\",\"exports\",\"module\",\"ace/virtual_renderer\",\"ace/editor\",\"ace/range\",\"ace/lib/event\",\"ace/lib/lang\",\"ace/lib/dom\"], function(acequire, exports, module) {\n\"use strict\";\n\nvar Renderer = acequire(\"../virtual_renderer\").VirtualRenderer;\nvar Editor = acequire(\"../editor\").Editor;\nvar Range = acequire(\"../range\").Range;\nvar event = acequire(\"../lib/event\");\nvar lang = acequire(\"../lib/lang\");\nvar dom = acequire(\"../lib/dom\");\n\nvar $singleLineEditor = function(el) {\n var renderer = new Renderer(el);\n\n renderer.$maxLines = 4;\n\n var editor = new Editor(renderer);\n\n editor.setHighlightActiveLine(false);\n editor.setShowPrintMargin(false);\n editor.renderer.setShowGutter(false);\n editor.renderer.setHighlightGutterLine(false);\n\n editor.$mouseHandler.$focusWaitTimout = 0;\n editor.$highlightTagPending = true;\n\n return editor;\n};\n\nvar AcePopup = function(parentNode) {\n var el = dom.createElement(\"div\");\n var popup = new $singleLineEditor(el);\n\n if (parentNode)\n parentNode.appendChild(el);\n el.style.display = \"none\";\n popup.renderer.content.style.cursor = \"default\";\n popup.renderer.setStyle(\"ace_autocomplete\");\n\n popup.setOption(\"displayIndentGuides\", false);\n popup.setOption(\"dragDelay\", 150);\n\n var noop = function(){};\n\n popup.focus = noop;\n popup.$isFocused = true;\n\n popup.renderer.$cursorLayer.restartTimer = noop;\n popup.renderer.$cursorLayer.element.style.opacity = 0;\n\n popup.renderer.$maxLines = 8;\n popup.renderer.$keepTextAreaAtCursor = false;\n\n popup.setHighlightActiveLine(false);\n popup.session.highlight(\"\");\n popup.session.$searchHighlight.clazz = \"ace_highlight-marker\";\n\n popup.on(\"mousedown\", function(e) {\n var pos = e.getDocumentPosition();\n popup.selection.moveToPosition(pos);\n selectionMarker.start.row = selectionMarker.end.row = pos.row;\n e.stop();\n });\n\n var lastMouseEvent;\n var hoverMarker = new Range(-1,0,-1,Infinity);\n var selectionMarker = new Range(-1,0,-1,Infinity);\n selectionMarker.id = popup.session.addMarker(selectionMarker, \"ace_active-line\", \"fullLine\");\n popup.setSelectOnHover = function(val) {\n if (!val) {\n hoverMarker.id = popup.session.addMarker(hoverMarker, \"ace_line-hover\", \"fullLine\");\n } else if (hoverMarker.id) {\n popup.session.removeMarker(hoverMarker.id);\n hoverMarker.id = null;\n }\n };\n popup.setSelectOnHover(false);\n popup.on(\"mousemove\", function(e) {\n if (!lastMouseEvent) {\n lastMouseEvent = e;\n return;\n }\n if (lastMouseEvent.x == e.x && lastMouseEvent.y == e.y) {\n return;\n }\n lastMouseEvent = e;\n lastMouseEvent.scrollTop = popup.renderer.scrollTop;\n var row = lastMouseEvent.getDocumentPosition().row;\n if (hoverMarker.start.row != row) {\n if (!hoverMarker.id)\n popup.setRow(row);\n setHoverMarker(row);\n }\n });\n popup.renderer.on(\"beforeRender\", function() {\n if (lastMouseEvent && hoverMarker.start.row != -1) {\n lastMouseEvent.$pos = null;\n var row = lastMouseEvent.getDocumentPosition().row;\n if (!hoverMarker.id)\n popup.setRow(row);\n setHoverMarker(row, true);\n }\n });\n popup.renderer.on(\"afterRender\", function() {\n var row = popup.getRow();\n var t = popup.renderer.$textLayer;\n var selected = t.element.childNodes[row - t.config.firstRow];\n if (selected == t.selectedNode)\n return;\n if (t.selectedNode)\n dom.removeCssClass(t.selectedNode, \"ace_selected\");\n t.selectedNode = selected;\n if (selected)\n dom.addCssClass(selected, \"ace_selected\");\n });\n var hideHoverMarker = function() { setHoverMarker(-1); };\n var setHoverMarker = function(row, suppressRedraw) {\n if (row !== hoverMarker.start.row) {\n hoverMarker.start.row = hoverMarker.end.row = row;\n if (!suppressRedraw)\n popup.session._emit(\"changeBackMarker\");\n popup._emit(\"changeHoverMarker\");\n }\n };\n popup.getHoveredRow = function() {\n return hoverMarker.start.row;\n };\n\n event.addListener(popup.container, \"mouseout\", hideHoverMarker);\n popup.on(\"hide\", hideHoverMarker);\n popup.on(\"changeSelection\", hideHoverMarker);\n\n popup.session.doc.getLength = function() {\n return popup.data.length;\n };\n popup.session.doc.getLine = function(i) {\n var data = popup.data[i];\n if (typeof data == \"string\")\n return data;\n return (data && data.value) || \"\";\n };\n\n var bgTokenizer = popup.session.bgTokenizer;\n bgTokenizer.$tokenizeRow = function(row) {\n var data = popup.data[row];\n var tokens = [];\n if (!data)\n return tokens;\n if (typeof data == \"string\")\n data = {value: data};\n if (!data.caption)\n data.caption = data.value || data.name;\n\n var last = -1;\n var flag, c;\n for (var i = 0; i < data.caption.length; i++) {\n c = data.caption[i];\n flag = data.matchMask & (1 << i) ? 1 : 0;\n if (last !== flag) {\n tokens.push({type: data.className || \"\" + ( flag ? \"completion-highlight\" : \"\"), value: c});\n last = flag;\n } else {\n tokens[tokens.length - 1].value += c;\n }\n }\n\n if (data.meta) {\n var maxW = popup.renderer.$size.scrollerWidth / popup.renderer.layerConfig.characterWidth;\n var metaData = data.meta;\n if (metaData.length + data.caption.length > maxW - 2) {\n metaData = metaData.substr(0, maxW - data.caption.length - 3) + \"\\u2026\";\n }\n tokens.push({type: \"rightAlignedText\", value: metaData});\n }\n return tokens;\n };\n bgTokenizer.$updateOnChange = noop;\n bgTokenizer.start = noop;\n\n popup.session.$computeWidth = function() {\n return this.screenWidth = 0;\n };\n\n popup.$blockScrolling = Infinity;\n popup.isOpen = false;\n popup.isTopdown = false;\n popup.autoSelect = true;\n\n popup.data = [];\n popup.setData = function(list) {\n popup.setValue(lang.stringRepeat(\"\\n\", list.length), -1);\n popup.data = list || [];\n popup.setRow(0);\n };\n popup.getData = function(row) {\n return popup.data[row];\n };\n\n popup.getRow = function() {\n return selectionMarker.start.row;\n };\n popup.setRow = function(line) {\n line = Math.max(this.autoSelect ? 0 : -1, Math.min(this.data.length, line));\n if (selectionMarker.start.row != line) {\n popup.selection.clearSelection();\n selectionMarker.start.row = selectionMarker.end.row = line || 0;\n popup.session._emit(\"changeBackMarker\");\n popup.moveCursorTo(line || 0, 0);\n if (popup.isOpen)\n popup._signal(\"select\");\n }\n };\n\n popup.on(\"changeSelection\", function() {\n if (popup.isOpen)\n popup.setRow(popup.selection.lead.row);\n popup.renderer.scrollCursorIntoView();\n });\n\n popup.hide = function() {\n this.container.style.display = \"none\";\n this._signal(\"hide\");\n popup.isOpen = false;\n };\n popup.show = function(pos, lineHeight, topdownOnly) {\n var el = this.container;\n var screenHeight = window.innerHeight;\n var screenWidth = window.innerWidth;\n var renderer = this.renderer;\n var maxH = renderer.$maxLines * lineHeight * 1.4;\n var top = pos.top + this.$borderSize;\n var allowTopdown = top > screenHeight / 2 && !topdownOnly;\n if (allowTopdown && top + lineHeight + maxH > screenHeight) {\n renderer.$maxPixelHeight = top - 2 * this.$borderSize;\n el.style.top = \"\";\n el.style.bottom = screenHeight - top + \"px\";\n popup.isTopdown = false;\n } else {\n top += lineHeight;\n renderer.$maxPixelHeight = screenHeight - top - 0.2 * lineHeight;\n el.style.top = top + \"px\";\n el.style.bottom = \"\";\n popup.isTopdown = true;\n }\n\n el.style.display = \"\";\n this.renderer.$textLayer.checkForSizeChanges();\n\n var left = pos.left;\n if (left + el.offsetWidth > screenWidth)\n left = screenWidth - el.offsetWidth;\n\n el.style.left = left + \"px\";\n\n this._signal(\"show\");\n lastMouseEvent = null;\n popup.isOpen = true;\n };\n\n popup.getTextLeftOffset = function() {\n return this.$borderSize + this.renderer.$padding + this.$imageSize;\n };\n\n popup.$imageSize = 0;\n popup.$borderSize = 1;\n\n return popup;\n};\n\ndom.importCssString(\"\\\n.ace_editor.ace_autocomplete .ace_marker-layer .ace_active-line {\\\n background-color: #CAD6FA;\\\n z-index: 1;\\\n}\\\n.ace_editor.ace_autocomplete .ace_line-hover {\\\n border: 1px solid #abbffe;\\\n margin-top: -1px;\\\n background: rgba(233,233,253,0.4);\\\n}\\\n.ace_editor.ace_autocomplete .ace_line-hover {\\\n position: absolute;\\\n z-index: 2;\\\n}\\\n.ace_editor.ace_autocomplete .ace_scroller {\\\n background: none;\\\n border: none;\\\n box-shadow: none;\\\n}\\\n.ace_rightAlignedText {\\\n color: gray;\\\n display: inline-block;\\\n position: absolute;\\\n right: 4px;\\\n text-align: right;\\\n z-index: -1;\\\n}\\\n.ace_editor.ace_autocomplete .ace_completion-highlight{\\\n color: #000;\\\n text-shadow: 0 0 0.01em;\\\n}\\\n.ace_editor.ace_autocomplete {\\\n width: 280px;\\\n z-index: 200000;\\\n background: #fbfbfb;\\\n color: #444;\\\n border: 1px lightgray solid;\\\n position: fixed;\\\n box-shadow: 2px 3px 5px rgba(0,0,0,.2);\\\n line-height: 1.4;\\\n}\");\n\nexports.AcePopup = AcePopup;\n\n});\n\nace.define(\"ace/autocomplete/util\",[\"require\",\"exports\",\"module\"], function(acequire, exports, module) {\n\"use strict\";\n\nexports.parForEach = function(array, fn, callback) {\n var completed = 0;\n var arLength = array.length;\n if (arLength === 0)\n callback();\n for (var i = 0; i < arLength; i++) {\n fn(array[i], function(result, err) {\n completed++;\n if (completed === arLength)\n callback(result, err);\n });\n }\n};\n\nvar ID_REGEX = /[a-zA-Z_0-9\\$\\-\\u00A2-\\uFFFF]/;\n\nexports.retrievePrecedingIdentifier = function(text, pos, regex) {\n regex = regex || ID_REGEX;\n var buf = [];\n for (var i = pos-1; i >= 0; i--) {\n if (regex.test(text[i]))\n buf.push(text[i]);\n else\n break;\n }\n return buf.reverse().join(\"\");\n};\n\nexports.retrieveFollowingIdentifier = function(text, pos, regex) {\n regex = regex || ID_REGEX;\n var buf = [];\n for (var i = pos; i < text.length; i++) {\n if (regex.test(text[i]))\n buf.push(text[i]);\n else\n break;\n }\n return buf;\n};\n\nexports.getCompletionPrefix = function (editor) {\n var pos = editor.getCursorPosition();\n var line = editor.session.getLine(pos.row);\n var prefix;\n editor.completers.forEach(function(completer) {\n if (completer.identifierRegexps) {\n completer.identifierRegexps.forEach(function(identifierRegex) {\n if (!prefix && identifierRegex)\n prefix = this.retrievePrecedingIdentifier(line, pos.column, identifierRegex);\n }.bind(this));\n }\n }.bind(this));\n return prefix || this.retrievePrecedingIdentifier(line, pos.column);\n};\n\n});\n\nace.define(\"ace/autocomplete\",[\"require\",\"exports\",\"module\",\"ace/keyboard/hash_handler\",\"ace/autocomplete/popup\",\"ace/autocomplete/util\",\"ace/lib/event\",\"ace/lib/lang\",\"ace/lib/dom\",\"ace/snippets\"], function(acequire, exports, module) {\n\"use strict\";\n\nvar HashHandler = acequire(\"./keyboard/hash_handler\").HashHandler;\nvar AcePopup = acequire(\"./autocomplete/popup\").AcePopup;\nvar util = acequire(\"./autocomplete/util\");\nvar event = acequire(\"./lib/event\");\nvar lang = acequire(\"./lib/lang\");\nvar dom = acequire(\"./lib/dom\");\nvar snippetManager = acequire(\"./snippets\").snippetManager;\n\nvar Autocomplete = function() {\n this.autoInsert = false;\n this.autoSelect = true;\n this.exactMatch = false;\n this.gatherCompletionsId = 0;\n this.keyboardHandler = new HashHandler();\n this.keyboardHandler.bindKeys(this.commands);\n\n this.blurListener = this.blurListener.bind(this);\n this.changeListener = this.changeListener.bind(this);\n this.mousedownListener = this.mousedownListener.bind(this);\n this.mousewheelListener = this.mousewheelListener.bind(this);\n\n this.changeTimer = lang.delayedCall(function() {\n this.updateCompletions(true);\n }.bind(this));\n\n this.tooltipTimer = lang.delayedCall(this.updateDocTooltip.bind(this), 50);\n};\n\n(function() {\n\n this.$init = function() {\n this.popup = new AcePopup(document.body || document.documentElement);\n this.popup.on(\"click\", function(e) {\n this.insertMatch();\n e.stop();\n }.bind(this));\n this.popup.focus = this.editor.focus.bind(this.editor);\n this.popup.on(\"show\", this.tooltipTimer.bind(null, null));\n this.popup.on(\"select\", this.tooltipTimer.bind(null, null));\n this.popup.on(\"changeHoverMarker\", this.tooltipTimer.bind(null, null));\n return this.popup;\n };\n\n this.getPopup = function() {\n return this.popup || this.$init();\n };\n\n this.openPopup = function(editor, prefix, keepPopupPosition) {\n if (!this.popup)\n this.$init();\n\n\tthis.popup.autoSelect = this.autoSelect;\n\n this.popup.setData(this.completions.filtered);\n\n editor.keyBinding.addKeyboardHandler(this.keyboardHandler);\n \n var renderer = editor.renderer;\n this.popup.setRow(this.autoSelect ? 0 : -1);\n if (!keepPopupPosition) {\n this.popup.setTheme(editor.getTheme());\n this.popup.setFontSize(editor.getFontSize());\n\n var lineHeight = renderer.layerConfig.lineHeight;\n\n var pos = renderer.$cursorLayer.getPixelPosition(this.base, true);\n pos.left -= this.popup.getTextLeftOffset();\n\n var rect = editor.container.getBoundingClientRect();\n pos.top += rect.top - renderer.layerConfig.offset;\n pos.left += rect.left - editor.renderer.scrollLeft;\n pos.left += renderer.gutterWidth;\n\n this.popup.show(pos, lineHeight);\n } else if (keepPopupPosition && !prefix) {\n this.detach();\n }\n };\n\n this.detach = function() {\n this.editor.keyBinding.removeKeyboardHandler(this.keyboardHandler);\n this.editor.off(\"changeSelection\", this.changeListener);\n this.editor.off(\"blur\", this.blurListener);\n this.editor.off(\"mousedown\", this.mousedownListener);\n this.editor.off(\"mousewheel\", this.mousewheelListener);\n this.changeTimer.cancel();\n this.hideDocTooltip();\n\n this.gatherCompletionsId += 1;\n if (this.popup && this.popup.isOpen)\n this.popup.hide();\n\n if (this.base)\n this.base.detach();\n this.activated = false;\n this.completions = this.base = null;\n };\n\n this.changeListener = function(e) {\n var cursor = this.editor.selection.lead;\n if (cursor.row != this.base.row || cursor.column < this.base.column) {\n this.detach();\n }\n if (this.activated)\n this.changeTimer.schedule();\n else\n this.detach();\n };\n\n this.blurListener = function(e) {\n var el = document.activeElement;\n var text = this.editor.textInput.getElement();\n var fromTooltip = e.relatedTarget && this.tooltipNode && this.tooltipNode.contains(e.relatedTarget);\n var container = this.popup && this.popup.container;\n if (el != text && el.parentNode != container && !fromTooltip\n && el != this.tooltipNode && e.relatedTarget != text\n ) {\n this.detach();\n }\n };\n\n this.mousedownListener = function(e) {\n this.detach();\n };\n\n this.mousewheelListener = function(e) {\n this.detach();\n };\n\n this.goTo = function(where) {\n var row = this.popup.getRow();\n var max = this.popup.session.getLength() - 1;\n\n switch(where) {\n case \"up\": row = row <= 0 ? max : row - 1; break;\n case \"down\": row = row >= max ? -1 : row + 1; break;\n case \"start\": row = 0; break;\n case \"end\": row = max; break;\n }\n\n this.popup.setRow(row);\n };\n\n this.insertMatch = function(data, options) {\n if (!data)\n data = this.popup.getData(this.popup.getRow());\n if (!data)\n return false;\n\n if (data.completer && data.completer.insertMatch) {\n data.completer.insertMatch(this.editor, data);\n } else {\n if (this.completions.filterText) {\n var ranges = this.editor.selection.getAllRanges();\n for (var i = 0, range; range = ranges[i]; i++) {\n range.start.column -= this.completions.filterText.length;\n this.editor.session.remove(range);\n }\n }\n if (data.snippet)\n snippetManager.insertSnippet(this.editor, data.snippet);\n else\n this.editor.execCommand(\"insertstring\", data.value || data);\n }\n this.detach();\n };\n\n\n this.commands = {\n \"Up\": function(editor) { editor.completer.goTo(\"up\"); },\n \"Down\": function(editor) { editor.completer.goTo(\"down\"); },\n \"Ctrl-Up|Ctrl-Home\": function(editor) { editor.completer.goTo(\"start\"); },\n \"Ctrl-Down|Ctrl-End\": function(editor) { editor.completer.goTo(\"end\"); },\n\n \"Esc\": function(editor) { editor.completer.detach(); },\n \"Return\": function(editor) { return editor.completer.insertMatch(); },\n \"Shift-Return\": function(editor) { editor.completer.insertMatch(null, {deleteSuffix: true}); },\n \"Tab\": function(editor) {\n var result = editor.completer.insertMatch();\n if (!result && !editor.tabstopManager)\n editor.completer.goTo(\"down\");\n else\n return result;\n },\n\n \"PageUp\": function(editor) { editor.completer.popup.gotoPageUp(); },\n \"PageDown\": function(editor) { editor.completer.popup.gotoPageDown(); }\n };\n\n this.gatherCompletions = function(editor, callback) {\n var session = editor.getSession();\n var pos = editor.getCursorPosition();\n\n var prefix = util.getCompletionPrefix(editor);\n\n this.base = session.doc.createAnchor(pos.row, pos.column - prefix.length);\n this.base.$insertRight = true;\n\n var matches = [];\n var total = editor.completers.length;\n editor.completers.forEach(function(completer, i) {\n completer.getCompletions(editor, session, pos, prefix, function(err, results) {\n if (!err && results)\n matches = matches.concat(results);\n callback(null, {\n prefix: util.getCompletionPrefix(editor),\n matches: matches,\n finished: (--total === 0)\n });\n });\n });\n return true;\n };\n\n this.showPopup = function(editor) {\n if (this.editor)\n this.detach();\n\n this.activated = true;\n\n this.editor = editor;\n if (editor.completer != this) {\n if (editor.completer)\n editor.completer.detach();\n editor.completer = this;\n }\n\n editor.on(\"changeSelection\", this.changeListener);\n editor.on(\"blur\", this.blurListener);\n editor.on(\"mousedown\", this.mousedownListener);\n editor.on(\"mousewheel\", this.mousewheelListener);\n\n this.updateCompletions();\n };\n\n this.updateCompletions = function(keepPopupPosition) {\n if (keepPopupPosition && this.base && this.completions) {\n var pos = this.editor.getCursorPosition();\n var prefix = this.editor.session.getTextRange({start: this.base, end: pos});\n if (prefix == this.completions.filterText)\n return;\n this.completions.setFilter(prefix);\n if (!this.completions.filtered.length)\n return this.detach();\n if (this.completions.filtered.length == 1\n && this.completions.filtered[0].value == prefix\n && !this.completions.filtered[0].snippet)\n return this.detach();\n this.openPopup(this.editor, prefix, keepPopupPosition);\n return;\n }\n var _id = this.gatherCompletionsId;\n this.gatherCompletions(this.editor, function(err, results) {\n var detachIfFinished = function() {\n if (!results.finished) return;\n return this.detach();\n }.bind(this);\n\n var prefix = results.prefix;\n var matches = results && results.matches;\n\n if (!matches || !matches.length)\n return detachIfFinished();\n if (prefix.indexOf(results.prefix) !== 0 || _id != this.gatherCompletionsId)\n return;\n\n this.completions = new FilteredList(matches);\n\n if (this.exactMatch)\n this.completions.exactMatch = true;\n\n this.completions.setFilter(prefix);\n var filtered = this.completions.filtered;\n if (!filtered.length)\n return detachIfFinished();\n if (filtered.length == 1 && filtered[0].value == prefix && !filtered[0].snippet)\n return detachIfFinished();\n if (this.autoInsert && filtered.length == 1 && results.finished)\n return this.insertMatch(filtered[0]);\n\n this.openPopup(this.editor, prefix, keepPopupPosition);\n }.bind(this));\n };\n\n this.cancelContextMenu = function() {\n this.editor.$mouseHandler.cancelContextMenu();\n };\n\n this.updateDocTooltip = function() {\n var popup = this.popup;\n var all = popup.data;\n var selected = all && (all[popup.getHoveredRow()] || all[popup.getRow()]);\n var doc = null;\n if (!selected || !this.editor || !this.popup.isOpen)\n return this.hideDocTooltip();\n this.editor.completers.some(function(completer) {\n if (completer.getDocTooltip)\n doc = completer.getDocTooltip(selected);\n return doc;\n });\n if (!doc)\n doc = selected;\n\n if (typeof doc == \"string\")\n doc = {docText: doc};\n if (!doc || !(doc.docHTML || doc.docText))\n return this.hideDocTooltip();\n this.showDocTooltip(doc);\n };\n\n this.showDocTooltip = function(item) {\n if (!this.tooltipNode) {\n this.tooltipNode = dom.createElement(\"div\");\n this.tooltipNode.className = \"ace_tooltip ace_doc-tooltip\";\n this.tooltipNode.style.margin = 0;\n this.tooltipNode.style.pointerEvents = \"auto\";\n this.tooltipNode.tabIndex = -1;\n this.tooltipNode.onblur = this.blurListener.bind(this);\n this.tooltipNode.onclick = this.onTooltipClick.bind(this);\n }\n\n var tooltipNode = this.tooltipNode;\n if (item.docHTML) {\n tooltipNode.innerHTML = item.docHTML;\n } else if (item.docText) {\n tooltipNode.textContent = item.docText;\n }\n\n if (!tooltipNode.parentNode)\n document.body.appendChild(tooltipNode);\n var popup = this.popup;\n var rect = popup.container.getBoundingClientRect();\n tooltipNode.style.top = popup.container.style.top;\n tooltipNode.style.bottom = popup.container.style.bottom;\n\n if (window.innerWidth - rect.right < 320) {\n tooltipNode.style.right = window.innerWidth - rect.left + \"px\";\n tooltipNode.style.left = \"\";\n } else {\n tooltipNode.style.left = (rect.right + 1) + \"px\";\n tooltipNode.style.right = \"\";\n }\n tooltipNode.style.display = \"block\";\n };\n\n this.hideDocTooltip = function() {\n this.tooltipTimer.cancel();\n if (!this.tooltipNode) return;\n var el = this.tooltipNode;\n if (!this.editor.isFocused() && document.activeElement == el)\n this.editor.focus();\n this.tooltipNode = null;\n if (el.parentNode)\n el.parentNode.removeChild(el);\n };\n\n this.onTooltipClick = function(e) {\n var a = e.target;\n while (a && a != this.tooltipNode) {\n if (a.nodeName == \"A\" && a.href) {\n a.rel = \"noreferrer\";\n a.target = \"_blank\";\n break;\n }\n a = a.parentNode;\n }\n };\n\n}).call(Autocomplete.prototype);\n\nAutocomplete.startCommand = {\n name: \"startAutocomplete\",\n exec: function(editor) {\n if (!editor.completer)\n editor.completer = new Autocomplete();\n editor.completer.autoInsert = false;\n editor.completer.autoSelect = true;\n editor.completer.showPopup(editor);\n editor.completer.cancelContextMenu();\n },\n bindKey: \"Ctrl-Space|Ctrl-Shift-Space|Alt-Space\"\n};\n\nvar FilteredList = function(array, filterText) {\n this.all = array;\n this.filtered = array;\n this.filterText = filterText || \"\";\n this.exactMatch = false;\n};\n(function(){\n this.setFilter = function(str) {\n if (str.length > this.filterText && str.lastIndexOf(this.filterText, 0) === 0)\n var matches = this.filtered;\n else\n var matches = this.all;\n\n this.filterText = str;\n matches = this.filterCompletions(matches, this.filterText);\n matches = matches.sort(function(a, b) {\n return b.exactMatch - a.exactMatch || b.score - a.score;\n });\n var prev = null;\n matches = matches.filter(function(item){\n var caption = item.snippet || item.caption || item.value;\n if (caption === prev) return false;\n prev = caption;\n return true;\n });\n\n this.filtered = matches;\n };\n this.filterCompletions = function(items, needle) {\n var results = [];\n var upper = needle.toUpperCase();\n var lower = needle.toLowerCase();\n loop: for (var i = 0, item; item = items[i]; i++) {\n var caption = item.value || item.caption || item.snippet;\n if (!caption) continue;\n var lastIndex = -1;\n var matchMask = 0;\n var penalty = 0;\n var index, distance;\n\n if (this.exactMatch) {\n if (needle !== caption.substr(0, needle.length))\n continue loop;\n }else{\n for (var j = 0; j < needle.length; j++) {\n var i1 = caption.indexOf(lower[j], lastIndex + 1);\n var i2 = caption.indexOf(upper[j], lastIndex + 1);\n index = (i1 >= 0) ? ((i2 < 0 || i1 < i2) ? i1 : i2) : i2;\n if (index < 0)\n continue loop;\n distance = index - lastIndex - 1;\n if (distance > 0) {\n if (lastIndex === -1)\n penalty += 10;\n penalty += distance;\n }\n matchMask = matchMask | (1 << index);\n lastIndex = index;\n }\n }\n item.matchMask = matchMask;\n item.exactMatch = penalty ? 0 : 1;\n item.score = (item.score || 0) - penalty;\n results.push(item);\n }\n return results;\n };\n}).call(FilteredList.prototype);\n\nexports.Autocomplete = Autocomplete;\nexports.FilteredList = FilteredList;\n\n});\n\nace.define(\"ace/autocomplete/text_completer\",[\"require\",\"exports\",\"module\",\"ace/range\"], function(acequire, exports, module) {\n var Range = acequire(\"../range\").Range;\n \n var splitRegex = /[^a-zA-Z_0-9\\$\\-\\u00C0-\\u1FFF\\u2C00-\\uD7FF\\w]+/;\n\n function getWordIndex(doc, pos) {\n var textBefore = doc.getTextRange(Range.fromPoints({row: 0, column:0}, pos));\n return textBefore.split(splitRegex).length - 1;\n }\n function wordDistance(doc, pos) {\n var prefixPos = getWordIndex(doc, pos);\n var words = doc.getValue().split(splitRegex);\n var wordScores = Object.create(null);\n \n var currentWord = words[prefixPos];\n\n words.forEach(function(word, idx) {\n if (!word || word === currentWord) return;\n\n var distance = Math.abs(prefixPos - idx);\n var score = words.length - distance;\n if (wordScores[word]) {\n wordScores[word] = Math.max(score, wordScores[word]);\n } else {\n wordScores[word] = score;\n }\n });\n return wordScores;\n }\n\n exports.getCompletions = function(editor, session, pos, prefix, callback) {\n var wordScore = wordDistance(session, pos, prefix);\n var wordList = Object.keys(wordScore);\n callback(null, wordList.map(function(word) {\n return {\n caption: word,\n value: word,\n score: wordScore[word],\n meta: \"local\"\n };\n }));\n };\n});\n\nace.define(\"ace/ext/language_tools\",[\"require\",\"exports\",\"module\",\"ace/snippets\",\"ace/autocomplete\",\"ace/config\",\"ace/lib/lang\",\"ace/autocomplete/util\",\"ace/autocomplete/text_completer\",\"ace/editor\",\"ace/config\"], function(acequire, exports, module) {\n\"use strict\";\n\nvar snippetManager = acequire(\"../snippets\").snippetManager;\nvar Autocomplete = acequire(\"../autocomplete\").Autocomplete;\nvar config = acequire(\"../config\");\nvar lang = acequire(\"../lib/lang\");\nvar util = acequire(\"../autocomplete/util\");\n\nvar textCompleter = acequire(\"../autocomplete/text_completer\");\nvar keyWordCompleter = {\n getCompletions: function(editor, session, pos, prefix, callback) {\n if (session.$mode.completer) {\n return session.$mode.completer.getCompletions(editor, session, pos, prefix, callback);\n }\n var state = editor.session.getState(pos.row);\n var completions = session.$mode.getCompletions(state, session, pos, prefix);\n callback(null, completions);\n }\n};\n\nvar snippetCompleter = {\n getCompletions: function(editor, session, pos, prefix, callback) {\n var snippetMap = snippetManager.snippetMap;\n var completions = [];\n snippetManager.getActiveScopes(editor).forEach(function(scope) {\n var snippets = snippetMap[scope] || [];\n for (var i = snippets.length; i--;) {\n var s = snippets[i];\n var caption = s.name || s.tabTrigger;\n if (!caption)\n continue;\n completions.push({\n caption: caption,\n snippet: s.content,\n meta: s.tabTrigger && !s.name ? s.tabTrigger + \"\\u21E5 \" : \"snippet\",\n type: \"snippet\"\n });\n }\n }, this);\n callback(null, completions);\n },\n getDocTooltip: function(item) {\n if (item.type == \"snippet\" && !item.docHTML) {\n item.docHTML = [\n \"<b>\", lang.escapeHTML(item.caption), \"</b>\", \"<hr></hr>\",\n lang.escapeHTML(item.snippet)\n ].join(\"\");\n }\n }\n};\n\nvar completers = [snippetCompleter, textCompleter, keyWordCompleter];\nexports.setCompleters = function(val) {\n completers.length = 0;\n if (val) completers.push.apply(completers, val);\n};\nexports.addCompleter = function(completer) {\n completers.push(completer);\n};\nexports.textCompleter = textCompleter;\nexports.keyWordCompleter = keyWordCompleter;\nexports.snippetCompleter = snippetCompleter;\n\nvar expandSnippet = {\n name: \"expandSnippet\",\n exec: function(editor) {\n return snippetManager.expandWithTab(editor);\n },\n bindKey: \"Tab\"\n};\n\nvar onChangeMode = function(e, editor) {\n loadSnippetsForMode(editor.session.$mode);\n};\n\nvar loadSnippetsForMode = function(mode) {\n var id = mode.$id;\n if (!snippetManager.files)\n snippetManager.files = {};\n loadSnippetFile(id);\n if (mode.modes)\n mode.modes.forEach(loadSnippetsForMode);\n};\n\nvar loadSnippetFile = function(id) {\n if (!id || snippetManager.files[id])\n return;\n var snippetFilePath = id.replace(\"mode\", \"snippets\");\n snippetManager.files[id] = {};\n config.loadModule(snippetFilePath, function(m) {\n if (m) {\n snippetManager.files[id] = m;\n if (!m.snippets && m.snippetText)\n m.snippets = snippetManager.parseSnippetFile(m.snippetText);\n snippetManager.register(m.snippets || [], m.scope);\n if (m.includeScopes) {\n snippetManager.snippetMap[m.scope].includeScopes = m.includeScopes;\n m.includeScopes.forEach(function(x) {\n loadSnippetFile(\"ace/mode/\" + x);\n });\n }\n }\n });\n};\n\nvar doLiveAutocomplete = function(e) {\n var editor = e.editor;\n var hasCompleter = editor.completer && editor.completer.activated;\n if (e.command.name === \"backspace\") {\n if (hasCompleter && !util.getCompletionPrefix(editor))\n editor.completer.detach();\n }\n else if (e.command.name === \"insertstring\") {\n var prefix = util.getCompletionPrefix(editor);\n if (prefix && !hasCompleter) {\n if (!editor.completer) {\n editor.completer = new Autocomplete();\n }\n editor.completer.autoInsert = false;\n editor.completer.showPopup(editor);\n }\n }\n};\n\nvar Editor = acequire(\"../editor\").Editor;\nacequire(\"../config\").defineOptions(Editor.prototype, \"editor\", {\n enableBasicAutocompletion: {\n set: function(val) {\n if (val) {\n if (!this.completers)\n this.completers = Array.isArray(val)? val: completers;\n this.commands.addCommand(Autocomplete.startCommand);\n } else {\n this.commands.removeCommand(Autocomplete.startCommand);\n }\n },\n value: false\n },\n enableLiveAutocompletion: {\n set: function(val) {\n if (val) {\n if (!this.completers)\n this.completers = Array.isArray(val)? val: completers;\n this.commands.on('afterExec', doLiveAutocomplete);\n } else {\n this.commands.removeListener('afterExec', doLiveAutocomplete);\n }\n },\n value: false\n },\n enableSnippets: {\n set: function(val) {\n if (val) {\n this.commands.addCommand(expandSnippet);\n this.on(\"changeMode\", onChangeMode);\n onChangeMode(null, this);\n } else {\n this.commands.removeCommand(expandSnippet);\n this.off(\"changeMode\", onChangeMode);\n }\n },\n value: false\n }\n});\n});\n (function() {\n ace.acequire([\"ace/ext/language_tools\"], function() {});\n })();\n ","ace.define(\"ace/occur\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/range\",\"ace/search\",\"ace/edit_session\",\"ace/search_highlight\",\"ace/lib/dom\"], function(acequire, exports, module) {\n\"use strict\";\n\nvar oop = acequire(\"./lib/oop\");\nvar Range = acequire(\"./range\").Range;\nvar Search = acequire(\"./search\").Search;\nvar EditSession = acequire(\"./edit_session\").EditSession;\nvar SearchHighlight = acequire(\"./search_highlight\").SearchHighlight;\nfunction Occur() {}\n\noop.inherits(Occur, Search);\n\n(function() {\n this.enter = function(editor, options) {\n if (!options.needle) return false;\n var pos = editor.getCursorPosition();\n this.displayOccurContent(editor, options);\n var translatedPos = this.originalToOccurPosition(editor.session, pos);\n editor.moveCursorToPosition(translatedPos);\n return true;\n };\n this.exit = function(editor, options) {\n var pos = options.translatePosition && editor.getCursorPosition();\n var translatedPos = pos && this.occurToOriginalPosition(editor.session, pos);\n this.displayOriginalContent(editor);\n if (translatedPos)\n editor.moveCursorToPosition(translatedPos);\n return true;\n };\n\n this.highlight = function(sess, regexp) {\n var hl = sess.$occurHighlight = sess.$occurHighlight || sess.addDynamicMarker(\n new SearchHighlight(null, \"ace_occur-highlight\", \"text\"));\n hl.setRegexp(regexp);\n sess._emit(\"changeBackMarker\"); // force highlight layer redraw\n };\n\n this.displayOccurContent = function(editor, options) {\n this.$originalSession = editor.session;\n var found = this.matchingLines(editor.session, options);\n var lines = found.map(function(foundLine) { return foundLine.content; });\n var occurSession = new EditSession(lines.join('\\n'));\n occurSession.$occur = this;\n occurSession.$occurMatchingLines = found;\n editor.setSession(occurSession);\n this.$useEmacsStyleLineStart = this.$originalSession.$useEmacsStyleLineStart;\n occurSession.$useEmacsStyleLineStart = this.$useEmacsStyleLineStart;\n this.highlight(occurSession, options.re);\n occurSession._emit('changeBackMarker');\n };\n\n this.displayOriginalContent = function(editor) {\n editor.setSession(this.$originalSession);\n this.$originalSession.$useEmacsStyleLineStart = this.$useEmacsStyleLineStart;\n };\n this.originalToOccurPosition = function(session, pos) {\n var lines = session.$occurMatchingLines;\n var nullPos = {row: 0, column: 0};\n if (!lines) return nullPos;\n for (var i = 0; i < lines.length; i++) {\n if (lines[i].row === pos.row)\n return {row: i, column: pos.column};\n }\n return nullPos;\n };\n this.occurToOriginalPosition = function(session, pos) {\n var lines = session.$occurMatchingLines;\n if (!lines || !lines[pos.row])\n return pos;\n return {row: lines[pos.row].row, column: pos.column};\n };\n\n this.matchingLines = function(session, options) {\n options = oop.mixin({}, options);\n if (!session || !options.needle) return [];\n var search = new Search();\n search.set(options);\n return search.findAll(session).reduce(function(lines, range) {\n var row = range.start.row;\n var last = lines[lines.length-1];\n return last && last.row === row ?\n lines :\n lines.concat({row: row, content: session.getLine(row)});\n }, []);\n };\n\n}).call(Occur.prototype);\n\nvar dom = acequire('./lib/dom');\ndom.importCssString(\".ace_occur-highlight {\\n\\\n border-radius: 4px;\\n\\\n background-color: rgba(87, 255, 8, 0.25);\\n\\\n position: absolute;\\n\\\n z-index: 4;\\n\\\n -moz-box-sizing: border-box;\\n\\\n -webkit-box-sizing: border-box;\\n\\\n box-sizing: border-box;\\n\\\n box-shadow: 0 0 4px rgb(91, 255, 50);\\n\\\n}\\n\\\n.ace_dark .ace_occur-highlight {\\n\\\n background-color: rgb(80, 140, 85);\\n\\\n box-shadow: 0 0 4px rgb(60, 120, 70);\\n\\\n}\\n\", \"incremental-occur-highlighting\");\n\nexports.Occur = Occur;\n\n});\n\nace.define(\"ace/commands/occur_commands\",[\"require\",\"exports\",\"module\",\"ace/config\",\"ace/occur\",\"ace/keyboard/hash_handler\",\"ace/lib/oop\"], function(acequire, exports, module) {\n\nvar config = acequire(\"../config\"),\n Occur = acequire(\"../occur\").Occur;\nvar occurStartCommand = {\n name: \"occur\",\n exec: function(editor, options) {\n var alreadyInOccur = !!editor.session.$occur;\n var occurSessionActive = new Occur().enter(editor, options);\n if (occurSessionActive && !alreadyInOccur)\n OccurKeyboardHandler.installIn(editor);\n },\n readOnly: true\n};\n\nvar occurCommands = [{\n name: \"occurexit\",\n bindKey: 'esc|Ctrl-G',\n exec: function(editor) {\n var occur = editor.session.$occur;\n if (!occur) return;\n occur.exit(editor, {});\n if (!editor.session.$occur) OccurKeyboardHandler.uninstallFrom(editor);\n },\n readOnly: true\n}, {\n name: \"occuraccept\",\n bindKey: 'enter',\n exec: function(editor) {\n var occur = editor.session.$occur;\n if (!occur) return;\n occur.exit(editor, {translatePosition: true});\n if (!editor.session.$occur) OccurKeyboardHandler.uninstallFrom(editor);\n },\n readOnly: true\n}];\n\nvar HashHandler = acequire(\"../keyboard/hash_handler\").HashHandler;\nvar oop = acequire(\"../lib/oop\");\n\n\nfunction OccurKeyboardHandler() {}\n\noop.inherits(OccurKeyboardHandler, HashHandler);\n\n(function() {\n\n this.isOccurHandler = true;\n\n this.attach = function(editor) {\n HashHandler.call(this, occurCommands, editor.commands.platform);\n this.$editor = editor;\n };\n\n var handleKeyboard$super = this.handleKeyboard;\n this.handleKeyboard = function(data, hashId, key, keyCode) {\n var cmd = handleKeyboard$super.call(this, data, hashId, key, keyCode);\n return (cmd && cmd.command) ? cmd : undefined;\n };\n\n}).call(OccurKeyboardHandler.prototype);\n\nOccurKeyboardHandler.installIn = function(editor) {\n var handler = new this();\n editor.keyBinding.addKeyboardHandler(handler);\n editor.commands.addCommands(occurCommands);\n};\n\nOccurKeyboardHandler.uninstallFrom = function(editor) {\n editor.commands.removeCommands(occurCommands);\n var handler = editor.getKeyboardHandler();\n if (handler.isOccurHandler)\n editor.keyBinding.removeKeyboardHandler(handler);\n};\n\nexports.occurStartCommand = occurStartCommand;\n\n});\n\nace.define(\"ace/commands/incremental_search_commands\",[\"require\",\"exports\",\"module\",\"ace/config\",\"ace/lib/oop\",\"ace/keyboard/hash_handler\",\"ace/commands/occur_commands\"], function(acequire, exports, module) {\n\nvar config = acequire(\"../config\");\nvar oop = acequire(\"../lib/oop\");\nvar HashHandler = acequire(\"../keyboard/hash_handler\").HashHandler;\nvar occurStartCommand = acequire(\"./occur_commands\").occurStartCommand;\nexports.iSearchStartCommands = [{\n name: \"iSearch\",\n bindKey: {win: \"Ctrl-F\", mac: \"Command-F\"},\n exec: function(editor, options) {\n config.loadModule([\"core\", \"ace/incremental_search\"], function(e) {\n var iSearch = e.iSearch = e.iSearch || new e.IncrementalSearch();\n iSearch.activate(editor, options.backwards);\n if (options.jumpToFirstMatch) iSearch.next(options);\n });\n },\n readOnly: true\n}, {\n name: \"iSearchBackwards\",\n exec: function(editor, jumpToNext) { editor.execCommand('iSearch', {backwards: true}); },\n readOnly: true\n}, {\n name: \"iSearchAndGo\",\n bindKey: {win: \"Ctrl-K\", mac: \"Command-G\"},\n exec: function(editor, jumpToNext) { editor.execCommand('iSearch', {jumpToFirstMatch: true, useCurrentOrPrevSearch: true}); },\n readOnly: true\n}, {\n name: \"iSearchBackwardsAndGo\",\n bindKey: {win: \"Ctrl-Shift-K\", mac: \"Command-Shift-G\"},\n exec: function(editor) { editor.execCommand('iSearch', {jumpToFirstMatch: true, backwards: true, useCurrentOrPrevSearch: true}); },\n readOnly: true\n}];\nexports.iSearchCommands = [{\n name: \"restartSearch\",\n bindKey: {win: \"Ctrl-F\", mac: \"Command-F\"},\n exec: function(iSearch) {\n iSearch.cancelSearch(true);\n }\n}, {\n name: \"searchForward\",\n bindKey: {win: \"Ctrl-S|Ctrl-K\", mac: \"Ctrl-S|Command-G\"},\n exec: function(iSearch, options) {\n options.useCurrentOrPrevSearch = true;\n iSearch.next(options);\n }\n}, {\n name: \"searchBackward\",\n bindKey: {win: \"Ctrl-R|Ctrl-Shift-K\", mac: \"Ctrl-R|Command-Shift-G\"},\n exec: function(iSearch, options) {\n options.useCurrentOrPrevSearch = true;\n options.backwards = true;\n iSearch.next(options);\n }\n}, {\n name: \"extendSearchTerm\",\n exec: function(iSearch, string) {\n iSearch.addString(string);\n }\n}, {\n name: \"extendSearchTermSpace\",\n bindKey: \"space\",\n exec: function(iSearch) { iSearch.addString(' '); }\n}, {\n name: \"shrinkSearchTerm\",\n bindKey: \"backspace\",\n exec: function(iSearch) {\n iSearch.removeChar();\n }\n}, {\n name: 'confirmSearch',\n bindKey: 'return',\n exec: function(iSearch) { iSearch.deactivate(); }\n}, {\n name: 'cancelSearch',\n bindKey: 'esc|Ctrl-G',\n exec: function(iSearch) { iSearch.deactivate(true); }\n}, {\n name: 'occurisearch',\n bindKey: 'Ctrl-O',\n exec: function(iSearch) {\n var options = oop.mixin({}, iSearch.$options);\n iSearch.deactivate();\n occurStartCommand.exec(iSearch.$editor, options);\n }\n}, {\n name: \"yankNextWord\",\n bindKey: \"Ctrl-w\",\n exec: function(iSearch) {\n var ed = iSearch.$editor,\n range = ed.selection.getRangeOfMovements(function(sel) { sel.moveCursorWordRight(); }),\n string = ed.session.getTextRange(range);\n iSearch.addString(string);\n }\n}, {\n name: \"yankNextChar\",\n bindKey: \"Ctrl-Alt-y\",\n exec: function(iSearch) {\n var ed = iSearch.$editor,\n range = ed.selection.getRangeOfMovements(function(sel) { sel.moveCursorRight(); }),\n string = ed.session.getTextRange(range);\n iSearch.addString(string);\n }\n}, {\n name: 'recenterTopBottom',\n bindKey: 'Ctrl-l',\n exec: function(iSearch) { iSearch.$editor.execCommand('recenterTopBottom'); }\n}, {\n name: 'selectAllMatches',\n bindKey: 'Ctrl-space',\n exec: function(iSearch) {\n var ed = iSearch.$editor,\n hl = ed.session.$isearchHighlight,\n ranges = hl && hl.cache ? hl.cache\n .reduce(function(ranges, ea) {\n return ranges.concat(ea ? ea : []); }, []) : [];\n iSearch.deactivate(false);\n ranges.forEach(ed.selection.addRange.bind(ed.selection));\n }\n}, {\n name: 'searchAsRegExp',\n bindKey: 'Alt-r',\n exec: function(iSearch) {\n iSearch.convertNeedleToRegExp();\n }\n}].map(function(cmd) {\n cmd.readOnly = true;\n cmd.isIncrementalSearchCommand = true;\n cmd.scrollIntoView = \"animate-cursor\";\n return cmd;\n});\n\nfunction IncrementalSearchKeyboardHandler(iSearch) {\n this.$iSearch = iSearch;\n}\n\noop.inherits(IncrementalSearchKeyboardHandler, HashHandler);\n\n(function() {\n\n this.attach = function(editor) {\n var iSearch = this.$iSearch;\n HashHandler.call(this, exports.iSearchCommands, editor.commands.platform);\n this.$commandExecHandler = editor.commands.addEventListener('exec', function(e) {\n if (!e.command.isIncrementalSearchCommand)\n return iSearch.deactivate();\n e.stopPropagation();\n e.preventDefault();\n var scrollTop = editor.session.getScrollTop();\n var result = e.command.exec(iSearch, e.args || {});\n editor.renderer.scrollCursorIntoView(null, 0.5);\n editor.renderer.animateScrolling(scrollTop);\n return result;\n });\n };\n\n this.detach = function(editor) {\n if (!this.$commandExecHandler) return;\n editor.commands.removeEventListener('exec', this.$commandExecHandler);\n delete this.$commandExecHandler;\n };\n\n var handleKeyboard$super = this.handleKeyboard;\n this.handleKeyboard = function(data, hashId, key, keyCode) {\n if (((hashId === 1/*ctrl*/ || hashId === 8/*command*/) && key === 'v')\n || (hashId === 1/*ctrl*/ && key === 'y')) return null;\n var cmd = handleKeyboard$super.call(this, data, hashId, key, keyCode);\n if (cmd.command) { return cmd; }\n if (hashId == -1) {\n var extendCmd = this.commands.extendSearchTerm;\n if (extendCmd) { return {command: extendCmd, args: key}; }\n }\n return false;\n };\n\n}).call(IncrementalSearchKeyboardHandler.prototype);\n\n\nexports.IncrementalSearchKeyboardHandler = IncrementalSearchKeyboardHandler;\n\n});\n\nace.define(\"ace/incremental_search\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/range\",\"ace/search\",\"ace/search_highlight\",\"ace/commands/incremental_search_commands\",\"ace/lib/dom\",\"ace/commands/command_manager\",\"ace/editor\",\"ace/config\"], function(acequire, exports, module) {\n\"use strict\";\n\nvar oop = acequire(\"./lib/oop\");\nvar Range = acequire(\"./range\").Range;\nvar Search = acequire(\"./search\").Search;\nvar SearchHighlight = acequire(\"./search_highlight\").SearchHighlight;\nvar iSearchCommandModule = acequire(\"./commands/incremental_search_commands\");\nvar ISearchKbd = iSearchCommandModule.IncrementalSearchKeyboardHandler;\nfunction IncrementalSearch() {\n this.$options = {wrap: false, skipCurrent: false};\n this.$keyboardHandler = new ISearchKbd(this);\n}\n\noop.inherits(IncrementalSearch, Search);\n\nfunction isRegExp(obj) {\n return obj instanceof RegExp;\n}\n\nfunction regExpToObject(re) {\n var string = String(re),\n start = string.indexOf('/'),\n flagStart = string.lastIndexOf('/');\n return {\n expression: string.slice(start+1, flagStart),\n flags: string.slice(flagStart+1)\n };\n}\n\nfunction stringToRegExp(string, flags) {\n try {\n return new RegExp(string, flags);\n } catch (e) { return string; }\n}\n\nfunction objectToRegExp(obj) {\n return stringToRegExp(obj.expression, obj.flags);\n}\n\n(function() {\n\n this.activate = function(ed, backwards) {\n this.$editor = ed;\n this.$startPos = this.$currentPos = ed.getCursorPosition();\n this.$options.needle = '';\n this.$options.backwards = backwards;\n ed.keyBinding.addKeyboardHandler(this.$keyboardHandler);\n this.$originalEditorOnPaste = ed.onPaste; ed.onPaste = this.onPaste.bind(this);\n this.$mousedownHandler = ed.addEventListener('mousedown', this.onMouseDown.bind(this));\n this.selectionFix(ed);\n this.statusMessage(true);\n };\n\n this.deactivate = function(reset) {\n this.cancelSearch(reset);\n var ed = this.$editor;\n ed.keyBinding.removeKeyboardHandler(this.$keyboardHandler);\n if (this.$mousedownHandler) {\n ed.removeEventListener('mousedown', this.$mousedownHandler);\n delete this.$mousedownHandler;\n }\n ed.onPaste = this.$originalEditorOnPaste;\n this.message('');\n };\n\n this.selectionFix = function(editor) {\n if (editor.selection.isEmpty() && !editor.session.$emacsMark) {\n editor.clearSelection();\n }\n };\n\n this.highlight = function(regexp) {\n var sess = this.$editor.session,\n hl = sess.$isearchHighlight = sess.$isearchHighlight || sess.addDynamicMarker(\n new SearchHighlight(null, \"ace_isearch-result\", \"text\"));\n hl.setRegexp(regexp);\n sess._emit(\"changeBackMarker\"); // force highlight layer redraw\n };\n\n this.cancelSearch = function(reset) {\n var e = this.$editor;\n this.$prevNeedle = this.$options.needle;\n this.$options.needle = '';\n if (reset) {\n e.moveCursorToPosition(this.$startPos);\n this.$currentPos = this.$startPos;\n } else {\n e.pushEmacsMark && e.pushEmacsMark(this.$startPos, false);\n }\n this.highlight(null);\n return Range.fromPoints(this.$currentPos, this.$currentPos);\n };\n\n this.highlightAndFindWithNeedle = function(moveToNext, needleUpdateFunc) {\n if (!this.$editor) return null;\n var options = this.$options;\n if (needleUpdateFunc) {\n options.needle = needleUpdateFunc.call(this, options.needle || '') || '';\n }\n if (options.needle.length === 0) {\n this.statusMessage(true);\n return this.cancelSearch(true);\n }\n options.start = this.$currentPos;\n var session = this.$editor.session,\n found = this.find(session),\n shouldSelect = this.$editor.emacsMark ?\n !!this.$editor.emacsMark() : !this.$editor.selection.isEmpty();\n if (found) {\n if (options.backwards) found = Range.fromPoints(found.end, found.start);\n this.$editor.selection.setRange(Range.fromPoints(shouldSelect ? this.$startPos : found.end, found.end));\n if (moveToNext) this.$currentPos = found.end;\n this.highlight(options.re);\n }\n\n this.statusMessage(found);\n\n return found;\n };\n\n this.addString = function(s) {\n return this.highlightAndFindWithNeedle(false, function(needle) {\n if (!isRegExp(needle))\n return needle + s;\n var reObj = regExpToObject(needle);\n reObj.expression += s;\n return objectToRegExp(reObj);\n });\n };\n\n this.removeChar = function(c) {\n return this.highlightAndFindWithNeedle(false, function(needle) {\n if (!isRegExp(needle))\n return needle.substring(0, needle.length-1);\n var reObj = regExpToObject(needle);\n reObj.expression = reObj.expression.substring(0, reObj.expression.length-1);\n return objectToRegExp(reObj);\n });\n };\n\n this.next = function(options) {\n options = options || {};\n this.$options.backwards = !!options.backwards;\n this.$currentPos = this.$editor.getCursorPosition();\n return this.highlightAndFindWithNeedle(true, function(needle) {\n return options.useCurrentOrPrevSearch && needle.length === 0 ?\n this.$prevNeedle || '' : needle;\n });\n };\n\n this.onMouseDown = function(evt) {\n this.deactivate();\n return true;\n };\n\n this.onPaste = function(text) {\n this.addString(text);\n };\n\n this.convertNeedleToRegExp = function() {\n return this.highlightAndFindWithNeedle(false, function(needle) {\n return isRegExp(needle) ? needle : stringToRegExp(needle, 'ig');\n });\n };\n\n this.convertNeedleToString = function() {\n return this.highlightAndFindWithNeedle(false, function(needle) {\n return isRegExp(needle) ? regExpToObject(needle).expression : needle;\n });\n };\n\n this.statusMessage = function(found) {\n var options = this.$options, msg = '';\n msg += options.backwards ? 'reverse-' : '';\n msg += 'isearch: ' + options.needle;\n msg += found ? '' : ' (not found)';\n this.message(msg);\n };\n\n this.message = function(msg) {\n if (this.$editor.showCommandLine) {\n this.$editor.showCommandLine(msg);\n this.$editor.focus();\n } else {\n console.log(msg);\n }\n };\n\n}).call(IncrementalSearch.prototype);\n\n\nexports.IncrementalSearch = IncrementalSearch;\n\nvar dom = acequire('./lib/dom');\ndom.importCssString && dom.importCssString(\"\\\n.ace_marker-layer .ace_isearch-result {\\\n position: absolute;\\\n z-index: 6;\\\n -moz-box-sizing: border-box;\\\n -webkit-box-sizing: border-box;\\\n box-sizing: border-box;\\\n}\\\ndiv.ace_isearch-result {\\\n border-radius: 4px;\\\n background-color: rgba(255, 200, 0, 0.5);\\\n box-shadow: 0 0 4px rgb(255, 200, 0);\\\n}\\\n.ace_dark div.ace_isearch-result {\\\n background-color: rgb(100, 110, 160);\\\n box-shadow: 0 0 4px rgb(80, 90, 140);\\\n}\", \"incremental-search-highlighting\");\nvar commands = acequire(\"./commands/command_manager\");\n(function() {\n this.setupIncrementalSearch = function(editor, val) {\n if (this.usesIncrementalSearch == val) return;\n this.usesIncrementalSearch = val;\n var iSearchCommands = iSearchCommandModule.iSearchStartCommands;\n var method = val ? 'addCommands' : 'removeCommands';\n this[method](iSearchCommands);\n };\n}).call(commands.CommandManager.prototype);\nvar Editor = acequire(\"./editor\").Editor;\nacequire(\"./config\").defineOptions(Editor.prototype, \"editor\", {\n useIncrementalSearch: {\n set: function(val) {\n this.keyBinding.$handlers.forEach(function(handler) {\n if (handler.setupIncrementalSearch) {\n handler.setupIncrementalSearch(this, val);\n }\n });\n this._emit('incrementalSearchSettingChanged', {isEnabled: val});\n }\n }\n});\n\n});\n\nace.define(\"ace/keyboard/emacs\",[\"require\",\"exports\",\"module\",\"ace/lib/dom\",\"ace/incremental_search\",\"ace/commands/incremental_search_commands\",\"ace/keyboard/hash_handler\",\"ace/lib/keys\"], function(acequire, exports, module) {\n\"use strict\";\n\nvar dom = acequire(\"../lib/dom\");\nacequire(\"../incremental_search\");\nvar iSearchCommandModule = acequire(\"../commands/incremental_search_commands\");\n\n\nvar screenToTextBlockCoordinates = function(x, y) {\n var canvasPos = this.scroller.getBoundingClientRect();\n var offsetX = x + this.scrollLeft - canvasPos.left - this.$padding;\n\n var col = Math.floor(offsetX / this.characterWidth);\n\n var row = Math.floor(\n (y + this.scrollTop - canvasPos.top) / this.lineHeight\n );\n\n return this.session.screenToDocumentPosition(row, col, offsetX);\n};\n\nvar HashHandler = acequire(\"./hash_handler\").HashHandler;\nexports.handler = new HashHandler();\n\nexports.handler.isEmacs = true;\nexports.handler.$id = \"ace/keyboard/emacs\";\n\nvar initialized = false;\nvar $formerLongWords;\nvar $formerLineStart;\n\nexports.handler.attach = function(editor) {\n if (!initialized) {\n initialized = true;\n dom.importCssString('\\\n .emacs-mode .ace_cursor{\\\n border: 1px rgba(50,250,50,0.8) solid!important;\\\n -moz-box-sizing: border-box!important;\\\n -webkit-box-sizing: border-box!important;\\\n box-sizing: border-box!important;\\\n background-color: rgba(0,250,0,0.9);\\\n opacity: 0.5;\\\n }\\\n .emacs-mode .ace_hidden-cursors .ace_cursor{\\\n opacity: 1;\\\n background-color: transparent;\\\n }\\\n .emacs-mode .ace_overwrite-cursors .ace_cursor {\\\n opacity: 1;\\\n background-color: transparent;\\\n border-width: 0 0 2px 2px !important;\\\n }\\\n .emacs-mode .ace_text-layer {\\\n z-index: 4\\\n }\\\n .emacs-mode .ace_cursor-layer {\\\n z-index: 2\\\n }', 'emacsMode'\n );\n }\n $formerLongWords = editor.session.$selectLongWords;\n editor.session.$selectLongWords = true;\n $formerLineStart = editor.session.$useEmacsStyleLineStart;\n editor.session.$useEmacsStyleLineStart = true;\n\n editor.session.$emacsMark = null; // the active mark\n editor.session.$emacsMarkRing = editor.session.$emacsMarkRing || [];\n\n editor.emacsMark = function() {\n return this.session.$emacsMark;\n };\n\n editor.setEmacsMark = function(p) {\n this.session.$emacsMark = p;\n };\n\n editor.pushEmacsMark = function(p, activate) {\n var prevMark = this.session.$emacsMark;\n if (prevMark)\n this.session.$emacsMarkRing.push(prevMark);\n if (!p || activate) this.setEmacsMark(p);\n else this.session.$emacsMarkRing.push(p);\n };\n\n editor.popEmacsMark = function() {\n var mark = this.emacsMark();\n if (mark) { this.setEmacsMark(null); return mark; }\n return this.session.$emacsMarkRing.pop();\n };\n\n editor.getLastEmacsMark = function(p) {\n return this.session.$emacsMark || this.session.$emacsMarkRing.slice(-1)[0];\n };\n\n editor.emacsMarkForSelection = function(replacement) {\n var sel = this.selection,\n multiRangeLength = this.multiSelect ?\n this.multiSelect.getAllRanges().length : 1,\n selIndex = sel.index || 0,\n markRing = this.session.$emacsMarkRing,\n markIndex = markRing.length - (multiRangeLength - selIndex),\n lastMark = markRing[markIndex] || sel.anchor;\n if (replacement) {\n markRing.splice(markIndex, 1,\n \"row\" in replacement && \"column\" in replacement ?\n replacement : undefined);\n }\n return lastMark;\n };\n\n editor.on(\"click\", $resetMarkMode);\n editor.on(\"changeSession\", $kbSessionChange);\n editor.renderer.screenToTextCoordinates = screenToTextBlockCoordinates;\n editor.setStyle(\"emacs-mode\");\n editor.commands.addCommands(commands);\n exports.handler.platform = editor.commands.platform;\n editor.$emacsModeHandler = this;\n editor.addEventListener('copy', this.onCopy);\n editor.addEventListener('paste', this.onPaste);\n};\n\nexports.handler.detach = function(editor) {\n delete editor.renderer.screenToTextCoordinates;\n editor.session.$selectLongWords = $formerLongWords;\n editor.session.$useEmacsStyleLineStart = $formerLineStart;\n editor.removeEventListener(\"click\", $resetMarkMode);\n editor.removeEventListener(\"changeSession\", $kbSessionChange);\n editor.unsetStyle(\"emacs-mode\");\n editor.commands.removeCommands(commands);\n editor.removeEventListener('copy', this.onCopy);\n editor.removeEventListener('paste', this.onPaste);\n editor.$emacsModeHandler = null;\n};\n\nvar $kbSessionChange = function(e) {\n if (e.oldSession) {\n e.oldSession.$selectLongWords = $formerLongWords;\n e.oldSession.$useEmacsStyleLineStart = $formerLineStart;\n }\n\n $formerLongWords = e.session.$selectLongWords;\n e.session.$selectLongWords = true;\n $formerLineStart = e.session.$useEmacsStyleLineStart;\n e.session.$useEmacsStyleLineStart = true;\n\n if (!e.session.hasOwnProperty('$emacsMark'))\n e.session.$emacsMark = null;\n if (!e.session.hasOwnProperty('$emacsMarkRing'))\n e.session.$emacsMarkRing = [];\n};\n\nvar $resetMarkMode = function(e) {\n e.editor.session.$emacsMark = null;\n};\n\nvar keys = acequire(\"../lib/keys\").KEY_MODS;\nvar eMods = {C: \"ctrl\", S: \"shift\", M: \"alt\", CMD: \"command\"};\nvar combinations = [\"C-S-M-CMD\",\n \"S-M-CMD\", \"C-M-CMD\", \"C-S-CMD\", \"C-S-M\",\n \"M-CMD\", \"S-CMD\", \"S-M\", \"C-CMD\", \"C-M\", \"C-S\",\n \"CMD\", \"M\", \"S\", \"C\"];\ncombinations.forEach(function(c) {\n var hashId = 0;\n c.split(\"-\").forEach(function(c) {\n hashId = hashId | keys[eMods[c]];\n });\n eMods[hashId] = c.toLowerCase() + \"-\";\n});\n\nexports.handler.onCopy = function(e, editor) {\n if (editor.$handlesEmacsOnCopy) return;\n editor.$handlesEmacsOnCopy = true;\n exports.handler.commands.killRingSave.exec(editor);\n editor.$handlesEmacsOnCopy = false;\n};\n\nexports.handler.onPaste = function(e, editor) {\n editor.pushEmacsMark(editor.getCursorPosition());\n};\n\nexports.handler.bindKey = function(key, command) {\n if (typeof key == \"object\")\n key = key[this.platform];\n if (!key)\n return;\n\n var ckb = this.commandKeyBinding;\n key.split(\"|\").forEach(function(keyPart) {\n keyPart = keyPart.toLowerCase();\n ckb[keyPart] = command;\n var keyParts = keyPart.split(\" \").slice(0,-1);\n keyParts.reduce(function(keyMapKeys, keyPart, i) {\n var prefix = keyMapKeys[i-1] ? keyMapKeys[i-1] + ' ' : '';\n return keyMapKeys.concat([prefix + keyPart]);\n }, []).forEach(function(keyPart) {\n if (!ckb[keyPart]) ckb[keyPart] = \"null\";\n });\n }, this);\n};\n\nexports.handler.getStatusText = function(editor, data) {\n var str = \"\";\n if (data.count)\n str += data.count;\n if (data.keyChain)\n str += \" \" + data.keyChain;\n return str;\n};\n\nexports.handler.handleKeyboard = function(data, hashId, key, keyCode) {\n if (keyCode === -1) return undefined;\n\n var editor = data.editor;\n editor._signal(\"changeStatus\");\n if (hashId == -1) {\n editor.pushEmacsMark();\n if (data.count) {\n var str = new Array(data.count + 1).join(key);\n data.count = null;\n return {command: \"insertstring\", args: str};\n }\n }\n\n var modifier = eMods[hashId];\n if (modifier == \"c-\" || data.count) {\n var count = parseInt(key[key.length - 1]);\n if (typeof count === 'number' && !isNaN(count)) {\n data.count = Math.max(data.count, 0) || 0;\n data.count = 10 * data.count + count;\n return {command: \"null\"};\n }\n }\n if (modifier) key = modifier + key;\n if (data.keyChain) key = data.keyChain += \" \" + key;\n var command = this.commandKeyBinding[key];\n data.keyChain = command == \"null\" ? key : \"\";\n if (!command) return undefined;\n if (command === \"null\") return {command: \"null\"};\n\n if (command === \"universalArgument\") {\n data.count = -4;\n return {command: \"null\"};\n }\n var args;\n if (typeof command !== \"string\") {\n args = command.args;\n if (command.command) command = command.command;\n if (command === \"goorselect\") {\n command = editor.emacsMark() ? args[1] : args[0];\n args = null;\n }\n }\n\n if (typeof command === \"string\") {\n if (command === \"insertstring\" ||\n command === \"splitline\" ||\n command === \"togglecomment\") {\n editor.pushEmacsMark();\n }\n command = this.commands[command] || editor.commands.commands[command];\n if (!command) return undefined;\n }\n\n if (!command.readOnly && !command.isYank)\n data.lastCommand = null;\n\n if (!command.readOnly && editor.emacsMark())\n editor.setEmacsMark(null);\n \n if (data.count) {\n var count = data.count;\n data.count = 0;\n if (!command || !command.handlesCount) {\n return {\n args: args,\n command: {\n exec: function(editor, args) {\n for (var i = 0; i < count; i++)\n command.exec(editor, args);\n },\n multiSelectAction: command.multiSelectAction\n }\n };\n } else {\n if (!args) args = {};\n if (typeof args === 'object') args.count = count;\n }\n }\n\n return {command: command, args: args};\n};\n\nexports.emacsKeys = {\n \"Up|C-p\" : {command: \"goorselect\", args: [\"golineup\",\"selectup\"]},\n \"Down|C-n\" : {command: \"goorselect\", args: [\"golinedown\",\"selectdown\"]},\n \"Left|C-b\" : {command: \"goorselect\", args: [\"gotoleft\",\"selectleft\"]},\n \"Right|C-f\" : {command: \"goorselect\", args: [\"gotoright\",\"selectright\"]},\n \"C-Left|M-b\" : {command: \"goorselect\", args: [\"gotowordleft\",\"selectwordleft\"]},\n \"C-Right|M-f\" : {command: \"goorselect\", args: [\"gotowordright\",\"selectwordright\"]},\n \"Home|C-a\" : {command: \"goorselect\", args: [\"gotolinestart\",\"selecttolinestart\"]},\n \"End|C-e\" : {command: \"goorselect\", args: [\"gotolineend\",\"selecttolineend\"]},\n \"C-Home|S-M-,\": {command: \"goorselect\", args: [\"gotostart\",\"selecttostart\"]},\n \"C-End|S-M-.\" : {command: \"goorselect\", args: [\"gotoend\",\"selecttoend\"]},\n \"S-Up|S-C-p\" : \"selectup\",\n \"S-Down|S-C-n\" : \"selectdown\",\n \"S-Left|S-C-b\" : \"selectleft\",\n \"S-Right|S-C-f\" : \"selectright\",\n \"S-C-Left|S-M-b\" : \"selectwordleft\",\n \"S-C-Right|S-M-f\" : \"selectwordright\",\n \"S-Home|S-C-a\" : \"selecttolinestart\",\n \"S-End|S-C-e\" : \"selecttolineend\",\n \"S-C-Home\" : \"selecttostart\",\n \"S-C-End\" : \"selecttoend\",\n\n \"C-l\" : \"recenterTopBottom\",\n \"M-s\" : \"centerselection\",\n \"M-g\": \"gotoline\",\n \"C-x C-p\": \"selectall\",\n \"C-Down\": {command: \"goorselect\", args: [\"gotopagedown\",\"selectpagedown\"]},\n \"C-Up\": {command: \"goorselect\", args: [\"gotopageup\",\"selectpageup\"]},\n \"PageDown|C-v\": {command: \"goorselect\", args: [\"gotopagedown\",\"selectpagedown\"]},\n \"PageUp|M-v\": {command: \"goorselect\", args: [\"gotopageup\",\"selectpageup\"]},\n \"S-C-Down\": \"selectpagedown\",\n \"S-C-Up\": \"selectpageup\",\n\n \"C-s\": \"iSearch\",\n \"C-r\": \"iSearchBackwards\",\n\n \"M-C-s\": \"findnext\",\n \"M-C-r\": \"findprevious\",\n \"S-M-5\": \"replace\",\n \"Backspace\": \"backspace\",\n \"Delete|C-d\": \"del\",\n \"Return|C-m\": {command: \"insertstring\", args: \"\\n\"}, // \"newline\"\n \"C-o\": \"splitline\",\n\n \"M-d|C-Delete\": {command: \"killWord\", args: \"right\"},\n \"C-Backspace|M-Backspace|M-Delete\": {command: \"killWord\", args: \"left\"},\n \"C-k\": \"killLine\",\n\n \"C-y|S-Delete\": \"yank\",\n \"M-y\": \"yankRotate\",\n \"C-g\": \"keyboardQuit\",\n\n \"C-w|C-S-W\": \"killRegion\",\n \"M-w\": \"killRingSave\",\n \"C-Space\": \"setMark\",\n \"C-x C-x\": \"exchangePointAndMark\",\n\n \"C-t\": \"transposeletters\",\n \"M-u\": \"touppercase\", // Doesn't work\n \"M-l\": \"tolowercase\",\n \"M-/\": \"autocomplete\", // Doesn't work\n \"C-u\": \"universalArgument\",\n\n \"M-;\": \"togglecomment\",\n\n \"C-/|C-x u|S-C--|C-z\": \"undo\",\n \"S-C-/|S-C-x u|C--|S-C-z\": \"redo\", // infinite undo?\n \"C-x r\": \"selectRectangularRegion\",\n \"M-x\": {command: \"focusCommandLine\", args: \"M-x \"}\n};\n\n\nexports.handler.bindKeys(exports.emacsKeys);\n\nexports.handler.addCommands({\n recenterTopBottom: function(editor) {\n var renderer = editor.renderer;\n var pos = renderer.$cursorLayer.getPixelPosition();\n var h = renderer.$size.scrollerHeight - renderer.lineHeight;\n var scrollTop = renderer.scrollTop;\n if (Math.abs(pos.top - scrollTop) < 2) {\n scrollTop = pos.top - h;\n } else if (Math.abs(pos.top - scrollTop - h * 0.5) < 2) {\n scrollTop = pos.top;\n } else {\n scrollTop = pos.top - h * 0.5;\n }\n editor.session.setScrollTop(scrollTop);\n },\n selectRectangularRegion: function(editor) {\n editor.multiSelect.toggleBlockSelection();\n },\n setMark: {\n exec: function(editor, args) {\n\n if (args && args.count) {\n if (editor.inMultiSelectMode) editor.forEachSelection(moveToMark);\n else moveToMark();\n moveToMark();\n return;\n }\n\n var mark = editor.emacsMark(),\n ranges = editor.selection.getAllRanges(),\n rangePositions = ranges.map(function(r) { return {row: r.start.row, column: r.start.column}; }),\n transientMarkModeActive = true,\n hasNoSelection = ranges.every(function(range) { return range.isEmpty(); });\n if (transientMarkModeActive && (mark || !hasNoSelection)) {\n if (editor.inMultiSelectMode) editor.forEachSelection({exec: editor.clearSelection.bind(editor)});\n else editor.clearSelection();\n if (mark) editor.pushEmacsMark(null);\n return;\n }\n\n if (!mark) {\n rangePositions.forEach(function(pos) { editor.pushEmacsMark(pos); });\n editor.setEmacsMark(rangePositions[rangePositions.length-1]);\n return;\n }\n\n function moveToMark() {\n var mark = editor.popEmacsMark();\n mark && editor.moveCursorToPosition(mark);\n }\n\n },\n readOnly: true,\n handlesCount: true\n },\n exchangePointAndMark: {\n exec: function exchangePointAndMark$exec(editor, args) {\n var sel = editor.selection;\n if (!args.count && !sel.isEmpty()) { // just invert selection\n sel.setSelectionRange(sel.getRange(), !sel.isBackwards());\n return;\n }\n\n if (args.count) { // replace mark and point\n var pos = {row: sel.lead.row, column: sel.lead.column};\n sel.clearSelection();\n sel.moveCursorToPosition(editor.emacsMarkForSelection(pos));\n } else { // create selection to last mark\n sel.selectToPosition(editor.emacsMarkForSelection());\n }\n },\n readOnly: true,\n handlesCount: true,\n multiSelectAction: \"forEach\"\n },\n killWord: {\n exec: function(editor, dir) {\n editor.clearSelection();\n if (dir == \"left\")\n editor.selection.selectWordLeft();\n else\n editor.selection.selectWordRight();\n\n var range = editor.getSelectionRange();\n var text = editor.session.getTextRange(range);\n exports.killRing.add(text);\n\n editor.session.remove(range);\n editor.clearSelection();\n },\n multiSelectAction: \"forEach\"\n },\n killLine: function(editor) {\n editor.pushEmacsMark(null);\n editor.clearSelection();\n var range = editor.getSelectionRange();\n var line = editor.session.getLine(range.start.row);\n range.end.column = line.length;\n line = line.substr(range.start.column);\n \n var foldLine = editor.session.getFoldLine(range.start.row);\n if (foldLine && range.end.row != foldLine.end.row) {\n range.end.row = foldLine.end.row;\n line = \"x\";\n }\n if (/^\\s*$/.test(line)) {\n range.end.row++;\n line = editor.session.getLine(range.end.row);\n range.end.column = /^\\s*$/.test(line) ? line.length : 0;\n }\n var text = editor.session.getTextRange(range);\n if (editor.prevOp.command == this)\n exports.killRing.append(text);\n else\n exports.killRing.add(text);\n\n editor.session.remove(range);\n editor.clearSelection();\n },\n yank: function(editor) {\n editor.onPaste(exports.killRing.get() || '');\n editor.keyBinding.$data.lastCommand = \"yank\";\n },\n yankRotate: function(editor) {\n if (editor.keyBinding.$data.lastCommand != \"yank\")\n return;\n editor.undo();\n editor.session.$emacsMarkRing.pop(); // also undo recording mark\n editor.onPaste(exports.killRing.rotate());\n editor.keyBinding.$data.lastCommand = \"yank\";\n },\n killRegion: {\n exec: function(editor) {\n exports.killRing.add(editor.getCopyText());\n editor.commands.byName.cut.exec(editor);\n editor.setEmacsMark(null);\n },\n readOnly: true,\n multiSelectAction: \"forEach\"\n },\n killRingSave: {\n exec: function(editor) {\n\n editor.$handlesEmacsOnCopy = true;\n var marks = editor.session.$emacsMarkRing.slice(),\n deselectedMarks = [];\n exports.killRing.add(editor.getCopyText());\n\n setTimeout(function() {\n function deselect() {\n var sel = editor.selection, range = sel.getRange(),\n pos = sel.isBackwards() ? range.end : range.start;\n deselectedMarks.push({row: pos.row, column: pos.column});\n sel.clearSelection();\n }\n editor.$handlesEmacsOnCopy = false;\n if (editor.inMultiSelectMode) editor.forEachSelection({exec: deselect});\n else deselect();\n editor.session.$emacsMarkRing = marks.concat(deselectedMarks.reverse());\n }, 0);\n },\n readOnly: true\n },\n keyboardQuit: function(editor) {\n editor.selection.clearSelection();\n editor.setEmacsMark(null);\n editor.keyBinding.$data.count = null;\n },\n focusCommandLine: function(editor, arg) {\n if (editor.showCommandLine)\n editor.showCommandLine(arg);\n }\n});\n\nexports.handler.addCommands(iSearchCommandModule.iSearchStartCommands);\n\nvar commands = exports.handler.commands;\ncommands.yank.isYank = true;\ncommands.yankRotate.isYank = true;\n\nexports.killRing = {\n $data: [],\n add: function(str) {\n str && this.$data.push(str);\n if (this.$data.length > 30)\n this.$data.shift();\n },\n append: function(str) {\n var idx = this.$data.length - 1;\n var text = this.$data[idx] || \"\";\n if (str) text += str;\n if (text) this.$data[idx] = text;\n },\n get: function(n) {\n n = n || 1;\n return this.$data.slice(this.$data.length-n, this.$data.length).reverse().join('\\n');\n },\n pop: function() {\n if (this.$data.length > 1)\n this.$data.pop();\n return this.get();\n },\n rotate: function() {\n this.$data.unshift(this.$data.pop());\n return this.get();\n }\n};\n\n});\n","ace.define(\"ace/keyboard/vim\",[\"require\",\"exports\",\"module\",\"ace/range\",\"ace/lib/event_emitter\",\"ace/lib/dom\",\"ace/lib/oop\",\"ace/lib/keys\",\"ace/lib/event\",\"ace/search\",\"ace/lib/useragent\",\"ace/search_highlight\",\"ace/commands/multi_select_commands\",\"ace/mode/text\",\"ace/multi_select\"], function(acequire, exports, module) {\n 'use strict';\n\n function log() {\n var d = \"\";\n function format(p) {\n if (typeof p != \"object\")\n return p + \"\";\n if (\"line\" in p) {\n return p.line + \":\" + p.ch;\n }\n if (\"anchor\" in p) {\n return format(p.anchor) + \"->\" + format(p.head);\n }\n if (Array.isArray(p))\n return \"[\" + p.map(function(x) {\n return format(x);\n }) + \"]\";\n return JSON.stringify(p);\n }\n for (var i = 0; i < arguments.length; i++) {\n var p = arguments[i];\n var f = format(p);\n d += f + \" \";\n }\n console.log(d);\n }\n var Range = acequire(\"../range\").Range;\n var EventEmitter = acequire(\"../lib/event_emitter\").EventEmitter;\n var dom = acequire(\"../lib/dom\");\n var oop = acequire(\"../lib/oop\");\n var KEYS = acequire(\"../lib/keys\");\n var event = acequire(\"../lib/event\");\n var Search = acequire(\"../search\").Search;\n var useragent = acequire(\"../lib/useragent\");\n var SearchHighlight = acequire(\"../search_highlight\").SearchHighlight;\n var multiSelectCommands = acequire(\"../commands/multi_select_commands\");\n var TextModeTokenRe = acequire(\"../mode/text\").Mode.prototype.tokenRe;\n acequire(\"../multi_select\");\n\n var CodeMirror = function(ace) {\n this.ace = ace;\n this.state = {};\n this.marks = {};\n this.$uid = 0;\n this.onChange = this.onChange.bind(this);\n this.onSelectionChange = this.onSelectionChange.bind(this);\n this.onBeforeEndOperation = this.onBeforeEndOperation.bind(this);\n this.ace.on('change', this.onChange);\n this.ace.on('changeSelection', this.onSelectionChange);\n this.ace.on('beforeEndOperation', this.onBeforeEndOperation);\n };\n CodeMirror.Pos = function(line, ch) {\n if (!(this instanceof Pos)) return new Pos(line, ch);\n this.line = line; this.ch = ch;\n };\n CodeMirror.defineOption = function(name, val, setter) {};\n CodeMirror.commands = {\n redo: function(cm) { cm.ace.redo(); },\n undo: function(cm) { cm.ace.undo(); },\n newlineAndIndent: function(cm) { cm.ace.insert(\"\\n\"); }\n };\n CodeMirror.keyMap = {};\n CodeMirror.addClass = CodeMirror.rmClass =\n CodeMirror.e_stop = function() {};\n CodeMirror.keyName = function(e) {\n if (e.key) return e.key;\n var key = (KEYS[e.keyCode] || \"\");\n if (key.length == 1) key = key.toUpperCase();\n key = event.getModifierString(e).replace(/(^|-)\\w/g, function(m) {\n return m.toUpperCase();\n }) + key;\n return key;\n };\n CodeMirror.keyMap['default'] = function(key) {\n return function(cm) {\n var cmd = cm.ace.commands.commandKeyBinding[key.toLowerCase()];\n return cmd && cm.ace.execCommand(cmd) !== false;\n };\n };\n CodeMirror.lookupKey = function lookupKey(key, map, handle) {\n if (typeof map == \"string\")\n map = CodeMirror.keyMap[map];\n var found = typeof map == \"function\" ? map(key) : map[key];\n if (found === false) return \"nothing\";\n if (found === \"...\") return \"multi\";\n if (found != null && handle(found)) return \"handled\";\n\n if (map.fallthrough) {\n if (!Array.isArray(map.fallthrough))\n return lookupKey(key, map.fallthrough, handle);\n for (var i = 0; i < map.fallthrough.length; i++) {\n var result = lookupKey(key, map.fallthrough[i], handle);\n if (result) return result;\n }\n }\n };\n\n CodeMirror.signal = function(o, name, e) { return o._signal(name, e) };\n CodeMirror.on = event.addListener;\n CodeMirror.off = event.removeListener;\n CodeMirror.isWordChar = function(ch) {\n if (ch < \"\\x7f\") return /^\\w$/.test(ch);\n TextModeTokenRe.lastIndex = 0;\n return TextModeTokenRe.test(ch);\n };\n \n(function() {\n oop.implement(CodeMirror.prototype, EventEmitter);\n \n this.destroy = function() {\n this.ace.off('change', this.onChange);\n this.ace.off('changeSelection', this.onSelectionChange);\n this.ace.off('beforeEndOperation', this.onBeforeEndOperation);\n this.removeOverlay();\n };\n this.virtualSelectionMode = function() {\n return this.ace.inVirtualSelectionMode && this.ace.selection.index;\n };\n this.onChange = function(delta) {\n var change = { text: delta.action[0] == 'i' ? delta.lines : [] };\n var curOp = this.curOp = this.curOp || {};\n if (!curOp.changeHandlers)\n curOp.changeHandlers = this._eventRegistry[\"change\"] && this._eventRegistry[\"change\"].slice();\n if (this.virtualSelectionMode()) return;\n if (!curOp.lastChange) {\n curOp.lastChange = curOp.change = change;\n } else {\n curOp.lastChange.next = curOp.lastChange = change;\n }\n this.$updateMarkers(delta);\n };\n this.onSelectionChange = function() {\n var curOp = this.curOp = this.curOp || {};\n if (!curOp.cursorActivityHandlers)\n curOp.cursorActivityHandlers = this._eventRegistry[\"cursorActivity\"] && this._eventRegistry[\"cursorActivity\"].slice();\n this.curOp.cursorActivity = true;\n if (this.ace.inMultiSelectMode) {\n this.ace.keyBinding.removeKeyboardHandler(multiSelectCommands.keyboardHandler);\n }\n };\n this.operation = function(fn, force) {\n if (!force && this.curOp || force && this.curOp && this.curOp.force) {\n return fn();\n }\n if (force || !this.ace.curOp) {\n if (this.curOp)\n this.onBeforeEndOperation();\n }\n if (!this.ace.curOp) {\n var prevOp = this.ace.prevOp;\n this.ace.startOperation({\n command: { name: \"vim\", scrollIntoView: \"cursor\" }\n });\n }\n var curOp = this.curOp = this.curOp || {};\n this.curOp.force = force;\n var result = fn();\n if (this.ace.curOp && this.ace.curOp.command.name == \"vim\") {\n this.ace.endOperation();\n if (!curOp.cursorActivity && !curOp.lastChange && prevOp)\n this.ace.prevOp = prevOp;\n }\n if (force || !this.ace.curOp) {\n if (this.curOp)\n this.onBeforeEndOperation();\n }\n return result;\n };\n this.onBeforeEndOperation = function() {\n var op = this.curOp;\n if (op) {\n if (op.change) { this.signal(\"change\", op.change, op); }\n if (op && op.cursorActivity) { this.signal(\"cursorActivity\", null, op); }\n this.curOp = null;\n }\n };\n\n this.signal = function(eventName, e, handlers) {\n var listeners = handlers ? handlers[eventName + \"Handlers\"]\n : (this._eventRegistry || {})[eventName];\n if (!listeners)\n return;\n listeners = listeners.slice();\n for (var i=0; i<listeners.length; i++)\n listeners[i](this, e);\n };\n this.firstLine = function() { return 0; };\n this.lastLine = function() { return this.ace.session.getLength() - 1; };\n this.lineCount = function() { return this.ace.session.getLength(); };\n this.setCursor = function(line, ch) {\n if (typeof line === 'object') {\n ch = line.ch;\n line = line.line;\n }\n if (!this.ace.inVirtualSelectionMode)\n this.ace.exitMultiSelectMode();\n this.ace.session.unfold({row: line, column: ch});\n this.ace.selection.moveTo(line, ch);\n };\n this.getCursor = function(p) {\n var sel = this.ace.selection;\n var pos = p == 'anchor' ? (sel.isEmpty() ? sel.lead : sel.anchor) :\n p == 'head' || !p ? sel.lead : sel.getRange()[p];\n return toCmPos(pos);\n };\n this.listSelections = function(p) {\n var ranges = this.ace.multiSelect.rangeList.ranges;\n if (!ranges.length || this.ace.inVirtualSelectionMode)\n return [{anchor: this.getCursor('anchor'), head: this.getCursor('head')}];\n return ranges.map(function(r) {\n return {\n anchor: this.clipPos(toCmPos(r.cursor == r.end ? r.start : r.end)),\n head: this.clipPos(toCmPos(r.cursor))\n };\n }, this);\n };\n this.setSelections = function(p, primIndex) {\n var sel = this.ace.multiSelect;\n var ranges = p.map(function(x) {\n var anchor = toAcePos(x.anchor);\n var head = toAcePos(x.head);\n var r = Range.comparePoints(anchor, head) < 0\n ? new Range.fromPoints(anchor, head)\n : new Range.fromPoints(head, anchor);\n r.cursor = Range.comparePoints(r.start, head) ? r.end : r.start;\n return r;\n });\n \n if (this.ace.inVirtualSelectionMode) {\n this.ace.selection.fromOrientedRange(ranges[0]);\n return;\n }\n if (!primIndex) {\n ranges = ranges.reverse();\n } else if (ranges[primIndex]) {\n ranges.push(ranges.splice(primIndex, 1)[0]);\n }\n sel.toSingleRange(ranges[0].clone());\n var session = this.ace.session;\n for (var i = 0; i < ranges.length; i++) {\n var range = session.$clipRangeToDocument(ranges[i]); // todo why ace doesn't do this?\n sel.addRange(range);\n }\n };\n this.setSelection = function(a, h, options) {\n var sel = this.ace.selection;\n sel.moveTo(a.line, a.ch);\n sel.selectTo(h.line, h.ch);\n if (options && options.origin == '*mouse') {\n this.onBeforeEndOperation();\n }\n };\n this.somethingSelected = function(p) {\n return !this.ace.selection.isEmpty();\n };\n this.clipPos = function(p) {\n var pos = this.ace.session.$clipPositionToDocument(p.line, p.ch);\n return toCmPos(pos);\n };\n this.markText = function(cursor) {\n return {clear: function() {}, find: function() {}};\n };\n this.$updateMarkers = function(delta) {\n var isInsert = delta.action == \"insert\";\n var start = delta.start;\n var end = delta.end;\n var rowShift = (end.row - start.row) * (isInsert ? 1 : -1);\n var colShift = (end.column - start.column) * (isInsert ? 1 : -1);\n if (isInsert) end = start;\n \n for (var i in this.marks) {\n var point = this.marks[i];\n var cmp = Range.comparePoints(point, start);\n if (cmp < 0) {\n continue; // delta starts after the range\n }\n if (cmp === 0) {\n if (isInsert) {\n if (point.bias == 1) {\n cmp = 1;\n } else {\n point.bias == -1;\n continue;\n }\n }\n }\n var cmp2 = isInsert ? cmp : Range.comparePoints(point, end);\n if (cmp2 > 0) {\n point.row += rowShift;\n point.column += point.row == end.row ? colShift : 0;\n continue;\n }\n if (!isInsert && cmp2 <= 0) {\n point.row = start.row;\n point.column = start.column;\n if (cmp2 === 0)\n point.bias = 1;\n }\n }\n };\n var Marker = function(cm, id, row, column) {\n this.cm = cm;\n this.id = id;\n this.row = row;\n this.column = column;\n cm.marks[this.id] = this;\n };\n Marker.prototype.clear = function() { delete this.cm.marks[this.id] };\n Marker.prototype.find = function() { return toCmPos(this) };\n this.setBookmark = function(cursor, options) {\n var bm = new Marker(this, this.$uid++, cursor.line, cursor.ch);\n if (!options || !options.insertLeft)\n bm.$insertRight = true;\n this.marks[bm.id] = bm;\n return bm;\n };\n this.moveH = function(increment, unit) {\n if (unit == 'char') {\n var sel = this.ace.selection;\n sel.clearSelection();\n sel.moveCursorBy(0, increment);\n }\n };\n this.findPosV = function(start, amount, unit, goalColumn) {\n if (unit == 'page') {\n var renderer = this.ace.renderer;\n var config = renderer.layerConfig;\n amount = amount * Math.floor(config.height / config.lineHeight);\n unit = 'line';\n }\n if (unit == 'line') {\n var screenPos = this.ace.session.documentToScreenPosition(start.line, start.ch);\n if (goalColumn != null)\n screenPos.column = goalColumn;\n screenPos.row += amount;\n screenPos.row = Math.min(Math.max(0, screenPos.row), this.ace.session.getScreenLength() - 1);\n var pos = this.ace.session.screenToDocumentPosition(screenPos.row, screenPos.column);\n return toCmPos(pos);\n } else {\n debugger;\n }\n };\n this.charCoords = function(pos, mode) {\n if (mode == 'div' || !mode) {\n var sc = this.ace.session.documentToScreenPosition(pos.line, pos.ch);\n return {left: sc.column, top: sc.row};\n }if (mode == 'local') {\n var renderer = this.ace.renderer;\n var sc = this.ace.session.documentToScreenPosition(pos.line, pos.ch);\n var lh = renderer.layerConfig.lineHeight;\n var cw = renderer.layerConfig.characterWidth;\n var top = lh * sc.row;\n return {left: sc.column * cw, top: top, bottom: top + lh};\n }\n };\n this.coordsChar = function(pos, mode) {\n var renderer = this.ace.renderer;\n if (mode == 'local') {\n var row = Math.max(0, Math.floor(pos.top / renderer.lineHeight));\n var col = Math.max(0, Math.floor(pos.left / renderer.characterWidth));\n var ch = renderer.session.screenToDocumentPosition(row, col);\n return toCmPos(ch);\n } else if (mode == 'div') {\n throw \"not implemented\";\n }\n };\n this.getSearchCursor = function(query, pos, caseFold) {\n var caseSensitive = false;\n var isRegexp = false;\n if (query instanceof RegExp && !query.global) {\n caseSensitive = !query.ignoreCase;\n query = query.source;\n isRegexp = true;\n }\n var search = new Search();\n if (pos.ch == undefined) pos.ch = Number.MAX_VALUE;\n var acePos = {row: pos.line, column: pos.ch};\n var cm = this;\n var last = null;\n return {\n findNext: function() { return this.find(false) },\n findPrevious: function() {return this.find(true) },\n find: function(back) {\n search.setOptions({\n needle: query,\n caseSensitive: caseSensitive,\n wrap: false,\n backwards: back,\n regExp: isRegexp,\n start: last || acePos\n });\n var range = search.find(cm.ace.session);\n if (range && range.isEmpty()) {\n if (cm.getLine(range.start.row).length == range.start.column) {\n search.$options.start = range;\n range = search.find(cm.ace.session);\n }\n }\n last = range;\n return last;\n },\n from: function() { return last && toCmPos(last.start) },\n to: function() { return last && toCmPos(last.end) },\n replace: function(text) {\n if (last) {\n last.end = cm.ace.session.doc.replace(last, text);\n }\n }\n };\n };\n this.scrollTo = function(x, y) {\n var renderer = this.ace.renderer;\n var config = renderer.layerConfig;\n var maxHeight = config.maxHeight;\n maxHeight -= (renderer.$size.scrollerHeight - renderer.lineHeight) * renderer.$scrollPastEnd;\n if (y != null) this.ace.session.setScrollTop(Math.max(0, Math.min(y, maxHeight)));\n if (x != null) this.ace.session.setScrollLeft(Math.max(0, Math.min(x, config.width)));\n };\n this.scrollInfo = function() { return 0; };\n this.scrollIntoView = function(pos, margin) {\n if (pos) {\n var renderer = this.ace.renderer;\n var viewMargin = { \"top\": 0, \"bottom\": margin };\n renderer.scrollCursorIntoView(toAcePos(pos),\n (renderer.lineHeight * 2) / renderer.$size.scrollerHeight, viewMargin);\n }\n };\n this.getLine = function(row) { return this.ace.session.getLine(row) };\n this.getRange = function(s, e) {\n return this.ace.session.getTextRange(new Range(s.line, s.ch, e.line, e.ch));\n };\n this.replaceRange = function(text, s, e) {\n if (!e) e = s;\n return this.ace.session.replace(new Range(s.line, s.ch, e.line, e.ch), text);\n };\n this.replaceSelections = function(p) {\n var sel = this.ace.selection;\n if (this.ace.inVirtualSelectionMode) {\n this.ace.session.replace(sel.getRange(), p[0] || \"\");\n return;\n }\n sel.inVirtualSelectionMode = true;\n var ranges = sel.rangeList.ranges;\n if (!ranges.length) ranges = [this.ace.multiSelect.getRange()];\n for (var i = ranges.length; i--;)\n this.ace.session.replace(ranges[i], p[i] || \"\");\n sel.inVirtualSelectionMode = false;\n };\n this.getSelection = function() {\n return this.ace.getSelectedText();\n };\n this.getSelections = function() {\n return this.listSelections().map(function(x) {\n return this.getRange(x.anchor, x.head);\n }, this);\n };\n this.getInputField = function() {\n return this.ace.textInput.getElement();\n };\n this.getWrapperElement = function() {\n return this.ace.containter;\n };\n var optMap = {\n indentWithTabs: \"useSoftTabs\",\n indentUnit: \"tabSize\",\n tabSize: \"tabSize\",\n firstLineNumber: \"firstLineNumber\",\n readOnly: \"readOnly\"\n };\n this.setOption = function(name, val) {\n this.state[name] = val;\n switch (name) {\n case 'indentWithTabs':\n name = optMap[name];\n val = !val;\n break;\n default:\n name = optMap[name];\n }\n if (name)\n this.ace.setOption(name, val);\n };\n this.getOption = function(name, val) {\n var aceOpt = optMap[name];\n if (aceOpt)\n val = this.ace.getOption(aceOpt);\n switch (name) {\n case 'indentWithTabs':\n name = optMap[name];\n return !val;\n }\n return aceOpt ? val : this.state[name];\n };\n this.toggleOverwrite = function(on) {\n this.state.overwrite = on;\n return this.ace.setOverwrite(on);\n };\n this.addOverlay = function(o) {\n if (!this.$searchHighlight || !this.$searchHighlight.session) {\n var highlight = new SearchHighlight(null, \"ace_highlight-marker\", \"text\");\n var marker = this.ace.session.addDynamicMarker(highlight);\n highlight.id = marker.id;\n highlight.session = this.ace.session;\n highlight.destroy = function(o) {\n highlight.session.off(\"change\", highlight.updateOnChange);\n highlight.session.off(\"changeEditor\", highlight.destroy);\n highlight.session.removeMarker(highlight.id);\n highlight.session = null;\n };\n highlight.updateOnChange = function(delta) {\n var row = delta.start.row;\n if (row == delta.end.row) highlight.cache[row] = undefined;\n else highlight.cache.splice(row, highlight.cache.length);\n };\n highlight.session.on(\"changeEditor\", highlight.destroy);\n highlight.session.on(\"change\", highlight.updateOnChange);\n }\n var re = new RegExp(o.query.source, \"gmi\");\n this.$searchHighlight = o.highlight = highlight;\n this.$searchHighlight.setRegexp(re);\n this.ace.renderer.updateBackMarkers();\n };\n this.removeOverlay = function(o) {\n if (this.$searchHighlight && this.$searchHighlight.session) {\n this.$searchHighlight.destroy();\n }\n };\n this.getScrollInfo = function() {\n var renderer = this.ace.renderer;\n var config = renderer.layerConfig;\n return {\n left: renderer.scrollLeft,\n top: renderer.scrollTop,\n height: config.maxHeight,\n width: config.width,\n clientHeight: config.height,\n clientWidth: config.width\n };\n };\n this.getValue = function() {\n return this.ace.getValue();\n };\n this.setValue = function(v) {\n return this.ace.setValue(v);\n };\n this.getTokenTypeAt = function(pos) {\n var token = this.ace.session.getTokenAt(pos.line, pos.ch);\n return token && /comment|string/.test(token.type) ? \"string\" : \"\";\n };\n this.findMatchingBracket = function(pos) {\n var m = this.ace.session.findMatchingBracket(toAcePos(pos));\n return {to: m && toCmPos(m)};\n };\n this.indentLine = function(line, method) {\n if (method === true)\n this.ace.session.indentRows(line, line, \"\\t\");\n else if (method === false)\n this.ace.session.outdentRows(new Range(line, 0, line, 0));\n };\n this.indexFromPos = function(pos) {\n return this.ace.session.doc.positionToIndex(toAcePos(pos));\n };\n this.posFromIndex = function(index) {\n return toCmPos(this.ace.session.doc.indexToPosition(index));\n };\n this.focus = function(index) {\n return this.ace.focus();\n };\n this.blur = function(index) {\n return this.ace.blur();\n };\n this.defaultTextHeight = function(index) {\n return this.ace.renderer.layerConfig.lineHeight;\n };\n this.scanForBracket = function(pos, dir, _, options) {\n var re = options.bracketRegex.source;\n if (dir == 1) {\n var m = this.ace.session.$findClosingBracket(re.slice(1, 2), toAcePos(pos), /paren|text/);\n } else {\n var m = this.ace.session.$findOpeningBracket(re.slice(-2, -1), {row: pos.line, column: pos.ch + 1}, /paren|text/);\n }\n return m && {pos: toCmPos(m)};\n };\n this.refresh = function() {\n return this.ace.resize(true);\n };\n this.getMode = function() {\n return { name : this.getOption(\"mode\") };\n }\n}).call(CodeMirror.prototype);\n function toAcePos(cmPos) {\n return {row: cmPos.line, column: cmPos.ch};\n }\n function toCmPos(acePos) {\n return new Pos(acePos.row, acePos.column);\n }\n\n var StringStream = CodeMirror.StringStream = function(string, tabSize) {\n this.pos = this.start = 0;\n this.string = string;\n this.tabSize = tabSize || 8;\n this.lastColumnPos = this.lastColumnValue = 0;\n this.lineStart = 0;\n };\n\n StringStream.prototype = {\n eol: function() {return this.pos >= this.string.length;},\n sol: function() {return this.pos == this.lineStart;},\n peek: function() {return this.string.charAt(this.pos) || undefined;},\n next: function() {\n if (this.pos < this.string.length)\n return this.string.charAt(this.pos++);\n },\n eat: function(match) {\n var ch = this.string.charAt(this.pos);\n if (typeof match == \"string\") var ok = ch == match;\n else var ok = ch && (match.test ? match.test(ch) : match(ch));\n if (ok) {++this.pos; return ch;}\n },\n eatWhile: function(match) {\n var start = this.pos;\n while (this.eat(match)){}\n return this.pos > start;\n },\n eatSpace: function() {\n var start = this.pos;\n while (/[\\s\\u00a0]/.test(this.string.charAt(this.pos))) ++this.pos;\n return this.pos > start;\n },\n skipToEnd: function() {this.pos = this.string.length;},\n skipTo: function(ch) {\n var found = this.string.indexOf(ch, this.pos);\n if (found > -1) {this.pos = found; return true;}\n },\n backUp: function(n) {this.pos -= n;},\n column: function() {\n throw \"not implemented\";\n },\n indentation: function() {\n throw \"not implemented\";\n },\n match: function(pattern, consume, caseInsensitive) {\n if (typeof pattern == \"string\") {\n var cased = function(str) {return caseInsensitive ? str.toLowerCase() : str;};\n var substr = this.string.substr(this.pos, pattern.length);\n if (cased(substr) == cased(pattern)) {\n if (consume !== false) this.pos += pattern.length;\n return true;\n }\n } else {\n var match = this.string.slice(this.pos).match(pattern);\n if (match && match.index > 0) return null;\n if (match && consume !== false) this.pos += match[0].length;\n return match;\n }\n },\n current: function(){return this.string.slice(this.start, this.pos);},\n hideFirstChars: function(n, inner) {\n this.lineStart += n;\n try { return inner(); }\n finally { this.lineStart -= n; }\n }\n };\nCodeMirror.defineExtension = function(name, fn) {\n CodeMirror.prototype[name] = fn;\n};\ndom.importCssString(\".normal-mode .ace_cursor{\\\n border: 1px solid red;\\\n background-color: red;\\\n opacity: 0.5;\\\n}\\\n.normal-mode .ace_hidden-cursors .ace_cursor{\\\n background-color: transparent;\\\n}\\\n.ace_dialog {\\\n position: absolute;\\\n left: 0; right: 0;\\\n background: white;\\\n z-index: 15;\\\n padding: .1em .8em;\\\n overflow: hidden;\\\n color: #333;\\\n}\\\n.ace_dialog-top {\\\n border-bottom: 1px solid #eee;\\\n top: 0;\\\n}\\\n.ace_dialog-bottom {\\\n border-top: 1px solid #eee;\\\n bottom: 0;\\\n}\\\n.ace_dialog input {\\\n border: none;\\\n outline: none;\\\n background: transparent;\\\n width: 20em;\\\n color: inherit;\\\n font-family: monospace;\\\n}\", \"vimMode\");\n(function() {\n function dialogDiv(cm, template, bottom) {\n var wrap = cm.ace.container;\n var dialog;\n dialog = wrap.appendChild(document.createElement(\"div\"));\n if (bottom)\n dialog.className = \"ace_dialog ace_dialog-bottom\";\n else\n dialog.className = \"ace_dialog ace_dialog-top\";\n\n if (typeof template == \"string\") {\n dialog.innerHTML = template;\n } else { // Assuming it's a detached DOM element.\n dialog.appendChild(template);\n }\n return dialog;\n }\n\n function closeNotification(cm, newVal) {\n if (cm.state.currentNotificationClose)\n cm.state.currentNotificationClose();\n cm.state.currentNotificationClose = newVal;\n }\n\n CodeMirror.defineExtension(\"openDialog\", function(template, callback, options) {\n if (this.virtualSelectionMode()) return;\n if (!options) options = {};\n\n closeNotification(this, null);\n\n var dialog = dialogDiv(this, template, options.bottom);\n var closed = false, me = this;\n function close(newVal) {\n if (typeof newVal == 'string') {\n inp.value = newVal;\n } else {\n if (closed) return;\n closed = true;\n dialog.parentNode.removeChild(dialog);\n me.focus();\n\n if (options.onClose) options.onClose(dialog);\n }\n }\n\n var inp = dialog.getElementsByTagName(\"input\")[0], button;\n if (inp) {\n if (options.value) {\n inp.value = options.value;\n if (options.select !== false) inp.select();\n }\n\n if (options.onInput)\n CodeMirror.on(inp, \"input\", function(e) { options.onInput(e, inp.value, close);});\n if (options.onKeyUp)\n CodeMirror.on(inp, \"keyup\", function(e) {options.onKeyUp(e, inp.value, close);});\n\n CodeMirror.on(inp, \"keydown\", function(e) {\n if (options && options.onKeyDown && options.onKeyDown(e, inp.value, close)) { return; }\n if (e.keyCode == 27 || (options.closeOnEnter !== false && e.keyCode == 13)) {\n inp.blur();\n CodeMirror.e_stop(e);\n close();\n }\n if (e.keyCode == 13) callback(inp.value);\n });\n\n if (options.closeOnBlur !== false) CodeMirror.on(inp, \"blur\", close);\n\n inp.focus();\n } else if (button = dialog.getElementsByTagName(\"button\")[0]) {\n CodeMirror.on(button, \"click\", function() {\n close();\n me.focus();\n });\n\n if (options.closeOnBlur !== false) CodeMirror.on(button, \"blur\", close);\n\n button.focus();\n }\n return close;\n });\n\n CodeMirror.defineExtension(\"openNotification\", function(template, options) {\n if (this.virtualSelectionMode()) return;\n closeNotification(this, close);\n var dialog = dialogDiv(this, template, options && options.bottom);\n var closed = false, doneTimer;\n var duration = options && typeof options.duration !== \"undefined\" ? options.duration : 5000;\n\n function close() {\n if (closed) return;\n closed = true;\n clearTimeout(doneTimer);\n dialog.parentNode.removeChild(dialog);\n }\n\n CodeMirror.on(dialog, 'click', function(e) {\n CodeMirror.e_preventDefault(e);\n close();\n });\n\n if (duration)\n doneTimer = setTimeout(close, duration);\n\n return close;\n });\n})();\n\n \n var defaultKeymap = [\n { keys: '<Left>', type: 'keyToKey', toKeys: 'h' },\n { keys: '<Right>', type: 'keyToKey', toKeys: 'l' },\n { keys: '<Up>', type: 'keyToKey', toKeys: 'k' },\n { keys: '<Down>', type: 'keyToKey', toKeys: 'j' },\n { keys: '<Space>', type: 'keyToKey', toKeys: 'l' },\n { keys: '<BS>', type: 'keyToKey', toKeys: 'h', context: 'normal'},\n { keys: '<C-Space>', type: 'keyToKey', toKeys: 'W' },\n { keys: '<C-BS>', type: 'keyToKey', toKeys: 'B', context: 'normal' },\n { keys: '<S-Space>', type: 'keyToKey', toKeys: 'w' },\n { keys: '<S-BS>', type: 'keyToKey', toKeys: 'b', context: 'normal' },\n { keys: '<C-n>', type: 'keyToKey', toKeys: 'j' },\n { keys: '<C-p>', type: 'keyToKey', toKeys: 'k' },\n { keys: '<C-[>', type: 'keyToKey', toKeys: '<Esc>' },\n { keys: '<C-c>', type: 'keyToKey', toKeys: '<Esc>' },\n { keys: '<C-[>', type: 'keyToKey', toKeys: '<Esc>', context: 'insert' },\n { keys: '<C-c>', type: 'keyToKey', toKeys: '<Esc>', context: 'insert' },\n { keys: 's', type: 'keyToKey', toKeys: 'cl', context: 'normal' },\n { keys: 's', type: 'keyToKey', toKeys: 'c', context: 'visual'},\n { keys: 'S', type: 'keyToKey', toKeys: 'cc', context: 'normal' },\n { keys: 'S', type: 'keyToKey', toKeys: 'VdO', context: 'visual' },\n { keys: '<Home>', type: 'keyToKey', toKeys: '0' },\n { keys: '<End>', type: 'keyToKey', toKeys: '$' },\n { keys: '<PageUp>', type: 'keyToKey', toKeys: '<C-b>' },\n { keys: '<PageDown>', type: 'keyToKey', toKeys: '<C-f>' },\n { keys: '<CR>', type: 'keyToKey', toKeys: 'j^', context: 'normal' },\n { keys: 'H', type: 'motion', motion: 'moveToTopLine', motionArgs: { linewise: true, toJumplist: true }},\n { keys: 'M', type: 'motion', motion: 'moveToMiddleLine', motionArgs: { linewise: true, toJumplist: true }},\n { keys: 'L', type: 'motion', motion: 'moveToBottomLine', motionArgs: { linewise: true, toJumplist: true }},\n { keys: 'h', type: 'motion', motion: 'moveByCharacters', motionArgs: { forward: false }},\n { keys: 'l', type: 'motion', motion: 'moveByCharacters', motionArgs: { forward: true }},\n { keys: 'j', type: 'motion', motion: 'moveByLines', motionArgs: { forward: true, linewise: true }},\n { keys: 'k', type: 'motion', motion: 'moveByLines', motionArgs: { forward: false, linewise: true }},\n { keys: 'gj', type: 'motion', motion: 'moveByDisplayLines', motionArgs: { forward: true }},\n { keys: 'gk', type: 'motion', motion: 'moveByDisplayLines', motionArgs: { forward: false }},\n { keys: 'w', type: 'motion', motion: 'moveByWords', motionArgs: { forward: true, wordEnd: false }},\n { keys: 'W', type: 'motion', motion: 'moveByWords', motionArgs: { forward: true, wordEnd: false, bigWord: true }},\n { keys: 'e', type: 'motion', motion: 'moveByWords', motionArgs: { forward: true, wordEnd: true, inclusive: true }},\n { keys: 'E', type: 'motion', motion: 'moveByWords', motionArgs: { forward: true, wordEnd: true, bigWord: true, inclusive: true }},\n { keys: 'b', type: 'motion', motion: 'moveByWords', motionArgs: { forward: false, wordEnd: false }},\n { keys: 'B', type: 'motion', motion: 'moveByWords', motionArgs: { forward: false, wordEnd: false, bigWord: true }},\n { keys: 'ge', type: 'motion', motion: 'moveByWords', motionArgs: { forward: false, wordEnd: true, inclusive: true }},\n { keys: 'gE', type: 'motion', motion: 'moveByWords', motionArgs: { forward: false, wordEnd: true, bigWord: true, inclusive: true }},\n { keys: '{', type: 'motion', motion: 'moveByParagraph', motionArgs: { forward: false, toJumplist: true }},\n { keys: '}', type: 'motion', motion: 'moveByParagraph', motionArgs: { forward: true, toJumplist: true }},\n { keys: '<C-f>', type: 'motion', motion: 'moveByPage', motionArgs: { forward: true }},\n { keys: '<C-b>', type: 'motion', motion: 'moveByPage', motionArgs: { forward: false }},\n { keys: '<C-d>', type: 'motion', motion: 'moveByScroll', motionArgs: { forward: true, explicitRepeat: true }},\n { keys: '<C-u>', type: 'motion', motion: 'moveByScroll', motionArgs: { forward: false, explicitRepeat: true }},\n { keys: 'gg', type: 'motion', motion: 'moveToLineOrEdgeOfDocument', motionArgs: { forward: false, explicitRepeat: true, linewise: true, toJumplist: true }},\n { keys: 'G', type: 'motion', motion: 'moveToLineOrEdgeOfDocument', motionArgs: { forward: true, explicitRepeat: true, linewise: true, toJumplist: true }},\n { keys: '0', type: 'motion', motion: 'moveToStartOfLine' },\n { keys: '^', type: 'motion', motion: 'moveToFirstNonWhiteSpaceCharacter' },\n { keys: '+', type: 'motion', motion: 'moveByLines', motionArgs: { forward: true, toFirstChar:true }},\n { keys: '-', type: 'motion', motion: 'moveByLines', motionArgs: { forward: false, toFirstChar:true }},\n { keys: '_', type: 'motion', motion: 'moveByLines', motionArgs: { forward: true, toFirstChar:true, repeatOffset:-1 }},\n { keys: '$', type: 'motion', motion: 'moveToEol', motionArgs: { inclusive: true }},\n { keys: '%', type: 'motion', motion: 'moveToMatchedSymbol', motionArgs: { inclusive: true, toJumplist: true }},\n { keys: 'f<character>', type: 'motion', motion: 'moveToCharacter', motionArgs: { forward: true , inclusive: true }},\n { keys: 'F<character>', type: 'motion', motion: 'moveToCharacter', motionArgs: { forward: false }},\n { keys: 't<character>', type: 'motion', motion: 'moveTillCharacter', motionArgs: { forward: true, inclusive: true }},\n { keys: 'T<character>', type: 'motion', motion: 'moveTillCharacter', motionArgs: { forward: false }},\n { keys: ';', type: 'motion', motion: 'repeatLastCharacterSearch', motionArgs: { forward: true }},\n { keys: ',', type: 'motion', motion: 'repeatLastCharacterSearch', motionArgs: { forward: false }},\n { keys: '\\'<character>', type: 'motion', motion: 'goToMark', motionArgs: {toJumplist: true, linewise: true}},\n { keys: '`<character>', type: 'motion', motion: 'goToMark', motionArgs: {toJumplist: true}},\n { keys: ']`', type: 'motion', motion: 'jumpToMark', motionArgs: { forward: true } },\n { keys: '[`', type: 'motion', motion: 'jumpToMark', motionArgs: { forward: false } },\n { keys: ']\\'', type: 'motion', motion: 'jumpToMark', motionArgs: { forward: true, linewise: true } },\n { keys: '[\\'', type: 'motion', motion: 'jumpToMark', motionArgs: { forward: false, linewise: true } },\n { keys: ']p', type: 'action', action: 'paste', isEdit: true, actionArgs: { after: true, isEdit: true, matchIndent: true}},\n { keys: '[p', type: 'action', action: 'paste', isEdit: true, actionArgs: { after: false, isEdit: true, matchIndent: true}},\n { keys: ']<character>', type: 'motion', motion: 'moveToSymbol', motionArgs: { forward: true, toJumplist: true}},\n { keys: '[<character>', type: 'motion', motion: 'moveToSymbol', motionArgs: { forward: false, toJumplist: true}},\n { keys: '|', type: 'motion', motion: 'moveToColumn'},\n { keys: 'o', type: 'motion', motion: 'moveToOtherHighlightedEnd', context:'visual'},\n { keys: 'O', type: 'motion', motion: 'moveToOtherHighlightedEnd', motionArgs: {sameLine: true}, context:'visual'},\n { keys: 'd', type: 'operator', operator: 'delete' },\n { keys: 'y', type: 'operator', operator: 'yank' },\n { keys: 'c', type: 'operator', operator: 'change' },\n { keys: '>', type: 'operator', operator: 'indent', operatorArgs: { indentRight: true }},\n { keys: '<', type: 'operator', operator: 'indent', operatorArgs: { indentRight: false }},\n { keys: 'g~', type: 'operator', operator: 'changeCase' },\n { keys: 'gu', type: 'operator', operator: 'changeCase', operatorArgs: {toLower: true}, isEdit: true },\n { keys: 'gU', type: 'operator', operator: 'changeCase', operatorArgs: {toLower: false}, isEdit: true },\n { keys: 'n', type: 'motion', motion: 'findNext', motionArgs: { forward: true, toJumplist: true }},\n { keys: 'N', type: 'motion', motion: 'findNext', motionArgs: { forward: false, toJumplist: true }},\n { keys: 'x', type: 'operatorMotion', operator: 'delete', motion: 'moveByCharacters', motionArgs: { forward: true }, operatorMotionArgs: { visualLine: false }},\n { keys: 'X', type: 'operatorMotion', operator: 'delete', motion: 'moveByCharacters', motionArgs: { forward: false }, operatorMotionArgs: { visualLine: true }},\n { keys: 'D', type: 'operatorMotion', operator: 'delete', motion: 'moveToEol', motionArgs: { inclusive: true }, context: 'normal'},\n { keys: 'D', type: 'operator', operator: 'delete', operatorArgs: { linewise: true }, context: 'visual'},\n { keys: 'Y', type: 'operatorMotion', operator: 'yank', motion: 'moveToEol', motionArgs: { inclusive: true }, context: 'normal'},\n { keys: 'Y', type: 'operator', operator: 'yank', operatorArgs: { linewise: true }, context: 'visual'},\n { keys: 'C', type: 'operatorMotion', operator: 'change', motion: 'moveToEol', motionArgs: { inclusive: true }, context: 'normal'},\n { keys: 'C', type: 'operator', operator: 'change', operatorArgs: { linewise: true }, context: 'visual'},\n { keys: '~', type: 'operatorMotion', operator: 'changeCase', motion: 'moveByCharacters', motionArgs: { forward: true }, operatorArgs: { shouldMoveCursor: true }, context: 'normal'},\n { keys: '~', type: 'operator', operator: 'changeCase', context: 'visual'},\n { keys: '<C-w>', type: 'operatorMotion', operator: 'delete', motion: 'moveByWords', motionArgs: { forward: false, wordEnd: false }, context: 'insert' },\n { keys: '<C-i>', type: 'action', action: 'jumpListWalk', actionArgs: { forward: true }},\n { keys: '<C-o>', type: 'action', action: 'jumpListWalk', actionArgs: { forward: false }},\n { keys: '<C-e>', type: 'action', action: 'scroll', actionArgs: { forward: true, linewise: true }},\n { keys: '<C-y>', type: 'action', action: 'scroll', actionArgs: { forward: false, linewise: true }},\n { keys: 'a', type: 'action', action: 'enterInsertMode', isEdit: true, actionArgs: { insertAt: 'charAfter' }, context: 'normal' },\n { keys: 'A', type: 'action', action: 'enterInsertMode', isEdit: true, actionArgs: { insertAt: 'eol' }, context: 'normal' },\n { keys: 'A', type: 'action', action: 'enterInsertMode', isEdit: true, actionArgs: { insertAt: 'endOfSelectedArea' }, context: 'visual' },\n { keys: 'i', type: 'action', action: 'enterInsertMode', isEdit: true, actionArgs: { insertAt: 'inplace' }, context: 'normal' },\n { keys: 'I', type: 'action', action: 'enterInsertMode', isEdit: true, actionArgs: { insertAt: 'firstNonBlank'}, context: 'normal' },\n { keys: 'I', type: 'action', action: 'enterInsertMode', isEdit: true, actionArgs: { insertAt: 'startOfSelectedArea' }, context: 'visual' },\n { keys: 'o', type: 'action', action: 'newLineAndEnterInsertMode', isEdit: true, interlaceInsertRepeat: true, actionArgs: { after: true }, context: 'normal' },\n { keys: 'O', type: 'action', action: 'newLineAndEnterInsertMode', isEdit: true, interlaceInsertRepeat: true, actionArgs: { after: false }, context: 'normal' },\n { keys: 'v', type: 'action', action: 'toggleVisualMode' },\n { keys: 'V', type: 'action', action: 'toggleVisualMode', actionArgs: { linewise: true }},\n { keys: '<C-v>', type: 'action', action: 'toggleVisualMode', actionArgs: { blockwise: true }},\n { keys: '<C-q>', type: 'action', action: 'toggleVisualMode', actionArgs: { blockwise: true }},\n { keys: 'gv', type: 'action', action: 'reselectLastSelection' },\n { keys: 'J', type: 'action', action: 'joinLines', isEdit: true },\n { keys: 'p', type: 'action', action: 'paste', isEdit: true, actionArgs: { after: true, isEdit: true }},\n { keys: 'P', type: 'action', action: 'paste', isEdit: true, actionArgs: { after: false, isEdit: true }},\n { keys: 'r<character>', type: 'action', action: 'replace', isEdit: true },\n { keys: '@<character>', type: 'action', action: 'replayMacro' },\n { keys: 'q<character>', type: 'action', action: 'enterMacroRecordMode' },\n { keys: 'R', type: 'action', action: 'enterInsertMode', isEdit: true, actionArgs: { replace: true }},\n { keys: 'u', type: 'action', action: 'undo', context: 'normal' },\n { keys: 'u', type: 'operator', operator: 'changeCase', operatorArgs: {toLower: true}, context: 'visual', isEdit: true },\n { keys: 'U', type: 'operator', operator: 'changeCase', operatorArgs: {toLower: false}, context: 'visual', isEdit: true },\n { keys: '<C-r>', type: 'action', action: 'redo' },\n { keys: 'm<character>', type: 'action', action: 'setMark' },\n { keys: '\"<character>', type: 'action', action: 'setRegister' },\n { keys: 'zz', type: 'action', action: 'scrollToCursor', actionArgs: { position: 'center' }},\n { keys: 'z.', type: 'action', action: 'scrollToCursor', actionArgs: { position: 'center' }, motion: 'moveToFirstNonWhiteSpaceCharacter' },\n { keys: 'zt', type: 'action', action: 'scrollToCursor', actionArgs: { position: 'top' }},\n { keys: 'z<CR>', type: 'action', action: 'scrollToCursor', actionArgs: { position: 'top' }, motion: 'moveToFirstNonWhiteSpaceCharacter' },\n { keys: 'z-', type: 'action', action: 'scrollToCursor', actionArgs: { position: 'bottom' }},\n { keys: 'zb', type: 'action', action: 'scrollToCursor', actionArgs: { position: 'bottom' }, motion: 'moveToFirstNonWhiteSpaceCharacter' },\n { keys: '.', type: 'action', action: 'repeatLastEdit' },\n { keys: '<C-a>', type: 'action', action: 'incrementNumberToken', isEdit: true, actionArgs: {increase: true, backtrack: false}},\n { keys: '<C-x>', type: 'action', action: 'incrementNumberToken', isEdit: true, actionArgs: {increase: false, backtrack: false}},\n { keys: 'a<character>', type: 'motion', motion: 'textObjectManipulation' },\n { keys: 'i<character>', type: 'motion', motion: 'textObjectManipulation', motionArgs: { textObjectInner: true }},\n { keys: '/', type: 'search', searchArgs: { forward: true, querySrc: 'prompt', toJumplist: true }},\n { keys: '?', type: 'search', searchArgs: { forward: false, querySrc: 'prompt', toJumplist: true }},\n { keys: '*', type: 'search', searchArgs: { forward: true, querySrc: 'wordUnderCursor', wholeWordOnly: true, toJumplist: true }},\n { keys: '#', type: 'search', searchArgs: { forward: false, querySrc: 'wordUnderCursor', wholeWordOnly: true, toJumplist: true }},\n { keys: 'g*', type: 'search', searchArgs: { forward: true, querySrc: 'wordUnderCursor', toJumplist: true }},\n { keys: 'g#', type: 'search', searchArgs: { forward: false, querySrc: 'wordUnderCursor', toJumplist: true }},\n { keys: ':', type: 'ex' }\n ];\n var defaultExCommandMap = [\n { name: 'colorscheme', shortName: 'colo' },\n { name: 'map' },\n { name: 'imap', shortName: 'im' },\n { name: 'nmap', shortName: 'nm' },\n { name: 'vmap', shortName: 'vm' },\n { name: 'unmap' },\n { name: 'write', shortName: 'w' },\n { name: 'undo', shortName: 'u' },\n { name: 'redo', shortName: 'red' },\n { name: 'set', shortName: 'se' },\n { name: 'set', shortName: 'se' },\n { name: 'setlocal', shortName: 'setl' },\n { name: 'setglobal', shortName: 'setg' },\n { name: 'sort', shortName: 'sor' },\n { name: 'substitute', shortName: 's', possiblyAsync: true },\n { name: 'nohlsearch', shortName: 'noh' },\n { name: 'delmarks', shortName: 'delm' },\n { name: 'registers', shortName: 'reg', excludeFromCommandHistory: true },\n { name: 'global', shortName: 'g' }\n ];\n\n var Pos = CodeMirror.Pos;\n\n var Vim = function() { return vimApi; } //{\n function enterVimMode(cm) {\n cm.setOption('disableInput', true);\n cm.setOption('showCursorWhenSelecting', false);\n CodeMirror.signal(cm, \"vim-mode-change\", {mode: \"normal\"});\n cm.on('cursorActivity', onCursorActivity);\n maybeInitVimState(cm);\n CodeMirror.on(cm.getInputField(), 'paste', getOnPasteFn(cm));\n }\n\n function leaveVimMode(cm) {\n cm.setOption('disableInput', false);\n cm.off('cursorActivity', onCursorActivity);\n CodeMirror.off(cm.getInputField(), 'paste', getOnPasteFn(cm));\n cm.state.vim = null;\n }\n\n function detachVimMap(cm, next) {\n if (this == CodeMirror.keyMap.vim)\n CodeMirror.rmClass(cm.getWrapperElement(), \"cm-fat-cursor\");\n\n if (!next || next.attach != attachVimMap)\n leaveVimMode(cm, false);\n }\n function attachVimMap(cm, prev) {\n if (this == CodeMirror.keyMap.vim)\n CodeMirror.addClass(cm.getWrapperElement(), \"cm-fat-cursor\");\n\n if (!prev || prev.attach != attachVimMap)\n enterVimMode(cm);\n }\n CodeMirror.defineOption('vimMode', false, function(cm, val, prev) {\n if (val && cm.getOption(\"keyMap\") != \"vim\")\n cm.setOption(\"keyMap\", \"vim\");\n else if (!val && prev != CodeMirror.Init && /^vim/.test(cm.getOption(\"keyMap\")))\n cm.setOption(\"keyMap\", \"default\");\n });\n\n function cmKey(key, cm) {\n if (!cm) { return undefined; }\n var vimKey = cmKeyToVimKey(key);\n if (!vimKey) {\n return false;\n }\n var cmd = CodeMirror.Vim.findKey(cm, vimKey);\n if (typeof cmd == 'function') {\n CodeMirror.signal(cm, 'vim-keypress', vimKey);\n }\n return cmd;\n }\n\n var modifiers = {'Shift': 'S', 'Ctrl': 'C', 'Alt': 'A', 'Cmd': 'D', 'Mod': 'A'};\n var specialKeys = {Enter:'CR',Backspace:'BS',Delete:'Del'};\n function cmKeyToVimKey(key) {\n if (key.charAt(0) == '\\'') {\n return key.charAt(1);\n }\n var pieces = key.split(/-(?!$)/);\n var lastPiece = pieces[pieces.length - 1];\n if (pieces.length == 1 && pieces[0].length == 1) {\n return false;\n } else if (pieces.length == 2 && pieces[0] == 'Shift' && lastPiece.length == 1) {\n return false;\n }\n var hasCharacter = false;\n for (var i = 0; i < pieces.length; i++) {\n var piece = pieces[i];\n if (piece in modifiers) { pieces[i] = modifiers[piece]; }\n else { hasCharacter = true; }\n if (piece in specialKeys) { pieces[i] = specialKeys[piece]; }\n }\n if (!hasCharacter) {\n return false;\n }\n if (isUpperCase(lastPiece)) {\n pieces[pieces.length - 1] = lastPiece.toLowerCase();\n }\n return '<' + pieces.join('-') + '>';\n }\n\n function getOnPasteFn(cm) {\n var vim = cm.state.vim;\n if (!vim.onPasteFn) {\n vim.onPasteFn = function() {\n if (!vim.insertMode) {\n cm.setCursor(offsetCursor(cm.getCursor(), 0, 1));\n actions.enterInsertMode(cm, {}, vim);\n }\n };\n }\n return vim.onPasteFn;\n }\n\n var numberRegex = /[\\d]/;\n var wordCharTest = [CodeMirror.isWordChar, function(ch) {\n return ch && !CodeMirror.isWordChar(ch) && !/\\s/.test(ch);\n }], bigWordCharTest = [function(ch) {\n return /\\S/.test(ch);\n }];\n function makeKeyRange(start, size) {\n var keys = [];\n for (var i = start; i < start + size; i++) {\n keys.push(String.fromCharCode(i));\n }\n return keys;\n }\n var upperCaseAlphabet = makeKeyRange(65, 26);\n var lowerCaseAlphabet = makeKeyRange(97, 26);\n var numbers = makeKeyRange(48, 10);\n var validMarks = [].concat(upperCaseAlphabet, lowerCaseAlphabet, numbers, ['<', '>']);\n var validRegisters = [].concat(upperCaseAlphabet, lowerCaseAlphabet, numbers, ['-', '\"', '.', ':', '/']);\n\n function isLine(cm, line) {\n return line >= cm.firstLine() && line <= cm.lastLine();\n }\n function isLowerCase(k) {\n return (/^[a-z]$/).test(k);\n }\n function isMatchableSymbol(k) {\n return '()[]{}'.indexOf(k) != -1;\n }\n function isNumber(k) {\n return numberRegex.test(k);\n }\n function isUpperCase(k) {\n return (/^[A-Z]$/).test(k);\n }\n function isWhiteSpaceString(k) {\n return (/^\\s*$/).test(k);\n }\n function inArray(val, arr) {\n for (var i = 0; i < arr.length; i++) {\n if (arr[i] == val) {\n return true;\n }\n }\n return false;\n }\n\n var options = {};\n function defineOption(name, defaultValue, type, aliases, callback) {\n if (defaultValue === undefined && !callback) {\n throw Error('defaultValue is acequired unless callback is provided');\n }\n if (!type) { type = 'string'; }\n options[name] = {\n type: type,\n defaultValue: defaultValue,\n callback: callback\n };\n if (aliases) {\n for (var i = 0; i < aliases.length; i++) {\n options[aliases[i]] = options[name];\n }\n }\n if (defaultValue) {\n setOption(name, defaultValue);\n }\n }\n\n function setOption(name, value, cm, cfg) {\n var option = options[name];\n cfg = cfg || {};\n var scope = cfg.scope;\n if (!option) {\n throw Error('Unknown option: ' + name);\n }\n if (option.type == 'boolean') {\n if (value && value !== true) {\n throw Error('Invalid argument: ' + name + '=' + value);\n } else if (value !== false) {\n value = true;\n }\n }\n if (option.callback) {\n if (scope !== 'local') {\n option.callback(value, undefined);\n }\n if (scope !== 'global' && cm) {\n option.callback(value, cm);\n }\n } else {\n if (scope !== 'local') {\n option.value = option.type == 'boolean' ? !!value : value;\n }\n if (scope !== 'global' && cm) {\n cm.state.vim.options[name] = {value: value};\n }\n }\n }\n\n function getOption(name, cm, cfg) {\n var option = options[name];\n cfg = cfg || {};\n var scope = cfg.scope;\n if (!option) {\n throw Error('Unknown option: ' + name);\n }\n if (option.callback) {\n var local = cm && option.callback(undefined, cm);\n if (scope !== 'global' && local !== undefined) {\n return local;\n }\n if (scope !== 'local') {\n return option.callback();\n }\n return;\n } else {\n var local = (scope !== 'global') && (cm && cm.state.vim.options[name]);\n return (local || (scope !== 'local') && option || {}).value;\n }\n }\n\n defineOption('filetype', undefined, 'string', ['ft'], function(name, cm) {\n if (cm === undefined) {\n return;\n }\n if (name === undefined) {\n var mode = cm.getOption('mode');\n return mode == 'null' ? '' : mode;\n } else {\n var mode = name == '' ? 'null' : name;\n cm.setOption('mode', mode);\n }\n });\n\n var createCircularJumpList = function() {\n var size = 100;\n var pointer = -1;\n var head = 0;\n var tail = 0;\n var buffer = new Array(size);\n function add(cm, oldCur, newCur) {\n var current = pointer % size;\n var curMark = buffer[current];\n function useNextSlot(cursor) {\n var next = ++pointer % size;\n var trashMark = buffer[next];\n if (trashMark) {\n trashMark.clear();\n }\n buffer[next] = cm.setBookmark(cursor);\n }\n if (curMark) {\n var markPos = curMark.find();\n if (markPos && !cursorEqual(markPos, oldCur)) {\n useNextSlot(oldCur);\n }\n } else {\n useNextSlot(oldCur);\n }\n useNextSlot(newCur);\n head = pointer;\n tail = pointer - size + 1;\n if (tail < 0) {\n tail = 0;\n }\n }\n function move(cm, offset) {\n pointer += offset;\n if (pointer > head) {\n pointer = head;\n } else if (pointer < tail) {\n pointer = tail;\n }\n var mark = buffer[(size + pointer) % size];\n if (mark && !mark.find()) {\n var inc = offset > 0 ? 1 : -1;\n var newCur;\n var oldCur = cm.getCursor();\n do {\n pointer += inc;\n mark = buffer[(size + pointer) % size];\n if (mark &&\n (newCur = mark.find()) &&\n !cursorEqual(oldCur, newCur)) {\n break;\n }\n } while (pointer < head && pointer > tail);\n }\n return mark;\n }\n return {\n cachedCursor: undefined, //used for # and * jumps\n add: add,\n move: move\n };\n };\n var createInsertModeChanges = function(c) {\n if (c) {\n return {\n changes: c.changes,\n expectCursorActivityForChange: c.expectCursorActivityForChange\n };\n }\n return {\n changes: [],\n expectCursorActivityForChange: false\n };\n };\n\n function MacroModeState() {\n this.latestRegister = undefined;\n this.isPlaying = false;\n this.isRecording = false;\n this.replaySearchQueries = [];\n this.onRecordingDone = undefined;\n this.lastInsertModeChanges = createInsertModeChanges();\n }\n MacroModeState.prototype = {\n exitMacroRecordMode: function() {\n var macroModeState = vimGlobalState.macroModeState;\n if (macroModeState.onRecordingDone) {\n macroModeState.onRecordingDone(); // close dialog\n }\n macroModeState.onRecordingDone = undefined;\n macroModeState.isRecording = false;\n },\n enterMacroRecordMode: function(cm, registerName) {\n var register =\n vimGlobalState.registerController.getRegister(registerName);\n if (register) {\n register.clear();\n this.latestRegister = registerName;\n if (cm.openDialog) {\n this.onRecordingDone = cm.openDialog(\n '(recording)['+registerName+']', null, {bottom:true});\n }\n this.isRecording = true;\n }\n }\n };\n\n function maybeInitVimState(cm) {\n if (!cm.state.vim) {\n cm.state.vim = {\n inputState: new InputState(),\n lastEditInputState: undefined,\n lastEditActionCommand: undefined,\n lastHPos: -1,\n lastHSPos: -1,\n lastMotion: null,\n marks: {},\n fakeCursor: null,\n insertMode: false,\n insertModeRepeat: undefined,\n visualMode: false,\n visualLine: false,\n visualBlock: false,\n lastSelection: null,\n lastPastedText: null,\n sel: {},\n options: {}\n };\n }\n return cm.state.vim;\n }\n var vimGlobalState;\n function resetVimGlobalState() {\n vimGlobalState = {\n searchQuery: null,\n searchIsReversed: false,\n lastSubstituteReplacePart: undefined,\n jumpList: createCircularJumpList(),\n macroModeState: new MacroModeState,\n lastChararacterSearch: {increment:0, forward:true, selectedCharacter:''},\n registerController: new RegisterController({}),\n searchHistoryController: new HistoryController({}),\n exCommandHistoryController : new HistoryController({})\n };\n for (var optionName in options) {\n var option = options[optionName];\n option.value = option.defaultValue;\n }\n }\n\n var lastInsertModeKeyTimer;\n var vimApi= {\n buildKeyMap: function() {\n },\n getRegisterController: function() {\n return vimGlobalState.registerController;\n },\n resetVimGlobalState_: resetVimGlobalState,\n getVimGlobalState_: function() {\n return vimGlobalState;\n },\n maybeInitVimState_: maybeInitVimState,\n\n suppressErrorLogging: false,\n\n InsertModeKey: InsertModeKey,\n map: function(lhs, rhs, ctx) {\n exCommandDispatcher.map(lhs, rhs, ctx);\n },\n unmap: function(lhs, ctx) {\n exCommandDispatcher.unmap(lhs, ctx);\n },\n setOption: setOption,\n getOption: getOption,\n defineOption: defineOption,\n defineEx: function(name, prefix, func){\n if (!prefix) {\n prefix = name;\n } else if (name.indexOf(prefix) !== 0) {\n throw new Error('(Vim.defineEx) \"'+prefix+'\" is not a prefix of \"'+name+'\", command not registered');\n }\n exCommands[name]=func;\n exCommandDispatcher.commandMap_[prefix]={name:name, shortName:prefix, type:'api'};\n },\n handleKey: function (cm, key, origin) {\n var command = this.findKey(cm, key, origin);\n if (typeof command === 'function') {\n return command();\n }\n },\n findKey: function(cm, key, origin) {\n var vim = maybeInitVimState(cm);\n function handleMacroRecording() {\n var macroModeState = vimGlobalState.macroModeState;\n if (macroModeState.isRecording) {\n if (key == 'q') {\n macroModeState.exitMacroRecordMode();\n clearInputState(cm);\n return true;\n }\n if (origin != 'mapping') {\n logKey(macroModeState, key);\n }\n }\n }\n function handleEsc() {\n if (key == '<Esc>') {\n clearInputState(cm);\n if (vim.visualMode) {\n exitVisualMode(cm);\n } else if (vim.insertMode) {\n exitInsertMode(cm);\n }\n return true;\n }\n }\n function doKeyToKey(keys) {\n var match;\n while (keys) {\n match = (/<\\w+-.+?>|<\\w+>|./).exec(keys);\n key = match[0];\n keys = keys.substring(match.index + key.length);\n CodeMirror.Vim.handleKey(cm, key, 'mapping');\n }\n }\n\n function handleKeyInsertMode() {\n if (handleEsc()) { return true; }\n var keys = vim.inputState.keyBuffer = vim.inputState.keyBuffer + key;\n var keysAreChars = key.length == 1;\n var match = commandDispatcher.matchCommand(keys, defaultKeymap, vim.inputState, 'insert');\n while (keys.length > 1 && match.type != 'full') {\n var keys = vim.inputState.keyBuffer = keys.slice(1);\n var thisMatch = commandDispatcher.matchCommand(keys, defaultKeymap, vim.inputState, 'insert');\n if (thisMatch.type != 'none') { match = thisMatch; }\n }\n if (match.type == 'none') { clearInputState(cm); return false; }\n else if (match.type == 'partial') {\n if (lastInsertModeKeyTimer) { window.clearTimeout(lastInsertModeKeyTimer); }\n lastInsertModeKeyTimer = window.setTimeout(\n function() { if (vim.insertMode && vim.inputState.keyBuffer) { clearInputState(cm); } },\n getOption('insertModeEscKeysTimeout'));\n return !keysAreChars;\n }\n\n if (lastInsertModeKeyTimer) { window.clearTimeout(lastInsertModeKeyTimer); }\n if (keysAreChars) {\n var selections = cm.listSelections();\n for (var i = 0; i < selections.length; i++) {\n var here = selections[i].head;\n cm.replaceRange('', offsetCursor(here, 0, -(keys.length - 1)), here, '+input');\n }\n vimGlobalState.macroModeState.lastInsertModeChanges.changes.pop();\n }\n clearInputState(cm);\n return match.command;\n }\n\n function handleKeyNonInsertMode() {\n if (handleMacroRecording() || handleEsc()) { return true; }\n\n var keys = vim.inputState.keyBuffer = vim.inputState.keyBuffer + key;\n if (/^[1-9]\\d*$/.test(keys)) { return true; }\n\n var keysMatcher = /^(\\d*)(.*)$/.exec(keys);\n if (!keysMatcher) { clearInputState(cm); return false; }\n var context = vim.visualMode ? 'visual' :\n 'normal';\n var match = commandDispatcher.matchCommand(keysMatcher[2] || keysMatcher[1], defaultKeymap, vim.inputState, context);\n if (match.type == 'none') { clearInputState(cm); return false; }\n else if (match.type == 'partial') { return true; }\n\n vim.inputState.keyBuffer = '';\n var keysMatcher = /^(\\d*)(.*)$/.exec(keys);\n if (keysMatcher[1] && keysMatcher[1] != '0') {\n vim.inputState.pushRepeatDigit(keysMatcher[1]);\n }\n return match.command;\n }\n\n var command;\n if (vim.insertMode) { command = handleKeyInsertMode(); }\n else { command = handleKeyNonInsertMode(); }\n if (command === false) {\n return undefined;\n } else if (command === true) {\n return function() { return true; };\n } else {\n return function() {\n if ((command.operator || command.isEdit) && cm.getOption('readOnly'))\n return; // ace_patch\n return cm.operation(function() {\n cm.curOp.isVimOp = true;\n try {\n if (command.type == 'keyToKey') {\n doKeyToKey(command.toKeys);\n } else {\n commandDispatcher.processCommand(cm, vim, command);\n }\n } catch (e) {\n cm.state.vim = undefined;\n maybeInitVimState(cm);\n if (!CodeMirror.Vim.suppressErrorLogging) {\n console['log'](e);\n }\n throw e;\n }\n return true;\n });\n };\n }\n },\n handleEx: function(cm, input) {\n exCommandDispatcher.processCommand(cm, input);\n },\n\n defineMotion: defineMotion,\n defineAction: defineAction,\n defineOperator: defineOperator,\n mapCommand: mapCommand,\n _mapCommand: _mapCommand,\n\n defineRegister: defineRegister,\n\n exitVisualMode: exitVisualMode,\n exitInsertMode: exitInsertMode\n };\n function InputState() {\n this.prefixRepeat = [];\n this.motionRepeat = [];\n\n this.operator = null;\n this.operatorArgs = null;\n this.motion = null;\n this.motionArgs = null;\n this.keyBuffer = []; // For matching multi-key commands.\n this.registerName = null; // Defaults to the unnamed register.\n }\n InputState.prototype.pushRepeatDigit = function(n) {\n if (!this.operator) {\n this.prefixRepeat = this.prefixRepeat.concat(n);\n } else {\n this.motionRepeat = this.motionRepeat.concat(n);\n }\n };\n InputState.prototype.getRepeat = function() {\n var repeat = 0;\n if (this.prefixRepeat.length > 0 || this.motionRepeat.length > 0) {\n repeat = 1;\n if (this.prefixRepeat.length > 0) {\n repeat *= parseInt(this.prefixRepeat.join(''), 10);\n }\n if (this.motionRepeat.length > 0) {\n repeat *= parseInt(this.motionRepeat.join(''), 10);\n }\n }\n return repeat;\n };\n\n function clearInputState(cm, reason) {\n cm.state.vim.inputState = new InputState();\n CodeMirror.signal(cm, 'vim-command-done', reason);\n }\n function Register(text, linewise, blockwise) {\n this.clear();\n this.keyBuffer = [text || ''];\n this.insertModeChanges = [];\n this.searchQueries = [];\n this.linewise = !!linewise;\n this.blockwise = !!blockwise;\n }\n Register.prototype = {\n setText: function(text, linewise, blockwise) {\n this.keyBuffer = [text || ''];\n this.linewise = !!linewise;\n this.blockwise = !!blockwise;\n },\n pushText: function(text, linewise) {\n if (linewise) {\n if (!this.linewise) {\n this.keyBuffer.push('\\n');\n }\n this.linewise = true;\n }\n this.keyBuffer.push(text);\n },\n pushInsertModeChanges: function(changes) {\n this.insertModeChanges.push(createInsertModeChanges(changes));\n },\n pushSearchQuery: function(query) {\n this.searchQueries.push(query);\n },\n clear: function() {\n this.keyBuffer = [];\n this.insertModeChanges = [];\n this.searchQueries = [];\n this.linewise = false;\n },\n toString: function() {\n return this.keyBuffer.join('');\n }\n };\n function defineRegister(name, register) {\n var registers = vimGlobalState.registerController.registers[name];\n if (!name || name.length != 1) {\n throw Error('Register name must be 1 character');\n }\n registers[name] = register;\n validRegisters.push(name);\n }\n function RegisterController(registers) {\n this.registers = registers;\n this.unnamedRegister = registers['\"'] = new Register();\n registers['.'] = new Register();\n registers[':'] = new Register();\n registers['/'] = new Register();\n }\n RegisterController.prototype = {\n pushText: function(registerName, operator, text, linewise, blockwise) {\n if (linewise && text.charAt(0) == '\\n') {\n text = text.slice(1) + '\\n';\n }\n if (linewise && text.charAt(text.length - 1) !== '\\n'){\n text += '\\n';\n }\n var register = this.isValidRegister(registerName) ?\n this.getRegister(registerName) : null;\n if (!register) {\n switch (operator) {\n case 'yank':\n this.registers['0'] = new Register(text, linewise, blockwise);\n break;\n case 'delete':\n case 'change':\n if (text.indexOf('\\n') == -1) {\n this.registers['-'] = new Register(text, linewise);\n } else {\n this.shiftNumericRegisters_();\n this.registers['1'] = new Register(text, linewise);\n }\n break;\n }\n this.unnamedRegister.setText(text, linewise, blockwise);\n return;\n }\n var append = isUpperCase(registerName);\n if (append) {\n register.pushText(text, linewise);\n } else {\n register.setText(text, linewise, blockwise);\n }\n this.unnamedRegister.setText(register.toString(), linewise);\n },\n getRegister: function(name) {\n if (!this.isValidRegister(name)) {\n return this.unnamedRegister;\n }\n name = name.toLowerCase();\n if (!this.registers[name]) {\n this.registers[name] = new Register();\n }\n return this.registers[name];\n },\n isValidRegister: function(name) {\n return name && inArray(name, validRegisters);\n },\n shiftNumericRegisters_: function() {\n for (var i = 9; i >= 2; i--) {\n this.registers[i] = this.getRegister('' + (i - 1));\n }\n }\n };\n function HistoryController() {\n this.historyBuffer = [];\n this.iterator;\n this.initialPrefix = null;\n }\n HistoryController.prototype = {\n nextMatch: function (input, up) {\n var historyBuffer = this.historyBuffer;\n var dir = up ? -1 : 1;\n if (this.initialPrefix === null) this.initialPrefix = input;\n for (var i = this.iterator + dir; up ? i >= 0 : i < historyBuffer.length; i+= dir) {\n var element = historyBuffer[i];\n for (var j = 0; j <= element.length; j++) {\n if (this.initialPrefix == element.substring(0, j)) {\n this.iterator = i;\n return element;\n }\n }\n }\n if (i >= historyBuffer.length) {\n this.iterator = historyBuffer.length;\n return this.initialPrefix;\n }\n if (i < 0 ) return input;\n },\n pushInput: function(input) {\n var index = this.historyBuffer.indexOf(input);\n if (index > -1) this.historyBuffer.splice(index, 1);\n if (input.length) this.historyBuffer.push(input);\n },\n reset: function() {\n this.initialPrefix = null;\n this.iterator = this.historyBuffer.length;\n }\n };\n var commandDispatcher = {\n matchCommand: function(keys, keyMap, inputState, context) {\n var matches = commandMatches(keys, keyMap, context, inputState);\n if (!matches.full && !matches.partial) {\n return {type: 'none'};\n } else if (!matches.full && matches.partial) {\n return {type: 'partial'};\n }\n\n var bestMatch;\n for (var i = 0; i < matches.full.length; i++) {\n var match = matches.full[i];\n if (!bestMatch) {\n bestMatch = match;\n }\n }\n if (bestMatch.keys.slice(-11) == '<character>') {\n var character = lastChar(keys);\n if (/<C-.>/.test(character)) return {type: 'none'};\n inputState.selectedCharacter = character;\n }\n return {type: 'full', command: bestMatch};\n },\n processCommand: function(cm, vim, command) {\n vim.inputState.repeatOverride = command.repeatOverride;\n switch (command.type) {\n case 'motion':\n this.processMotion(cm, vim, command);\n break;\n case 'operator':\n this.processOperator(cm, vim, command);\n break;\n case 'operatorMotion':\n this.processOperatorMotion(cm, vim, command);\n break;\n case 'action':\n this.processAction(cm, vim, command);\n break;\n case 'search':\n this.processSearch(cm, vim, command);\n break;\n case 'ex':\n case 'keyToEx':\n this.processEx(cm, vim, command);\n break;\n default:\n break;\n }\n },\n processMotion: function(cm, vim, command) {\n vim.inputState.motion = command.motion;\n vim.inputState.motionArgs = copyArgs(command.motionArgs);\n this.evalInput(cm, vim);\n },\n processOperator: function(cm, vim, command) {\n var inputState = vim.inputState;\n if (inputState.operator) {\n if (inputState.operator == command.operator) {\n inputState.motion = 'expandToLine';\n inputState.motionArgs = { linewise: true };\n this.evalInput(cm, vim);\n return;\n } else {\n clearInputState(cm);\n }\n }\n inputState.operator = command.operator;\n inputState.operatorArgs = copyArgs(command.operatorArgs);\n if (vim.visualMode) {\n this.evalInput(cm, vim);\n }\n },\n processOperatorMotion: function(cm, vim, command) {\n var visualMode = vim.visualMode;\n var operatorMotionArgs = copyArgs(command.operatorMotionArgs);\n if (operatorMotionArgs) {\n if (visualMode && operatorMotionArgs.visualLine) {\n vim.visualLine = true;\n }\n }\n this.processOperator(cm, vim, command);\n if (!visualMode) {\n this.processMotion(cm, vim, command);\n }\n },\n processAction: function(cm, vim, command) {\n var inputState = vim.inputState;\n var repeat = inputState.getRepeat();\n var repeatIsExplicit = !!repeat;\n var actionArgs = copyArgs(command.actionArgs) || {};\n if (inputState.selectedCharacter) {\n actionArgs.selectedCharacter = inputState.selectedCharacter;\n }\n if (command.operator) {\n this.processOperator(cm, vim, command);\n }\n if (command.motion) {\n this.processMotion(cm, vim, command);\n }\n if (command.motion || command.operator) {\n this.evalInput(cm, vim);\n }\n actionArgs.repeat = repeat || 1;\n actionArgs.repeatIsExplicit = repeatIsExplicit;\n actionArgs.registerName = inputState.registerName;\n clearInputState(cm);\n vim.lastMotion = null;\n if (command.isEdit) {\n this.recordLastEdit(vim, inputState, command);\n }\n actions[command.action](cm, actionArgs, vim);\n },\n processSearch: function(cm, vim, command) {\n if (!cm.getSearchCursor) {\n return;\n }\n var forward = command.searchArgs.forward;\n var wholeWordOnly = command.searchArgs.wholeWordOnly;\n getSearchState(cm).setReversed(!forward);\n var promptPrefix = (forward) ? '/' : '?';\n var originalQuery = getSearchState(cm).getQuery();\n var originalScrollPos = cm.getScrollInfo();\n function handleQuery(query, ignoreCase, smartCase) {\n vimGlobalState.searchHistoryController.pushInput(query);\n vimGlobalState.searchHistoryController.reset();\n try {\n updateSearchQuery(cm, query, ignoreCase, smartCase);\n } catch (e) {\n showConfirm(cm, 'Invalid regex: ' + query);\n clearInputState(cm);\n return;\n }\n commandDispatcher.processMotion(cm, vim, {\n type: 'motion',\n motion: 'findNext',\n motionArgs: { forward: true, toJumplist: command.searchArgs.toJumplist }\n });\n }\n function onPromptClose(query) {\n cm.scrollTo(originalScrollPos.left, originalScrollPos.top);\n handleQuery(query, true /** ignoreCase */, true /** smartCase */);\n var macroModeState = vimGlobalState.macroModeState;\n if (macroModeState.isRecording) {\n logSearchQuery(macroModeState, query);\n }\n }\n function onPromptKeyUp(e, query, close) {\n var keyName = CodeMirror.keyName(e), up;\n if (keyName == 'Up' || keyName == 'Down') {\n up = keyName == 'Up' ? true : false;\n query = vimGlobalState.searchHistoryController.nextMatch(query, up) || '';\n close(query);\n } else {\n if ( keyName != 'Left' && keyName != 'Right' && keyName != 'Ctrl' && keyName != 'Alt' && keyName != 'Shift')\n vimGlobalState.searchHistoryController.reset();\n }\n var parsedQuery;\n try {\n parsedQuery = updateSearchQuery(cm, query,\n true /** ignoreCase */, true /** smartCase */);\n } catch (e) {\n }\n if (parsedQuery) {\n cm.scrollIntoView(findNext(cm, !forward, parsedQuery), 30);\n } else {\n clearSearchHighlight(cm);\n cm.scrollTo(originalScrollPos.left, originalScrollPos.top);\n }\n }\n function onPromptKeyDown(e, query, close) {\n var keyName = CodeMirror.keyName(e);\n if (keyName == 'Esc' || keyName == 'Ctrl-C' || keyName == 'Ctrl-[' ||\n (keyName == 'Backspace' && query == '')) {\n vimGlobalState.searchHistoryController.pushInput(query);\n vimGlobalState.searchHistoryController.reset();\n updateSearchQuery(cm, originalQuery);\n clearSearchHighlight(cm);\n cm.scrollTo(originalScrollPos.left, originalScrollPos.top);\n CodeMirror.e_stop(e);\n clearInputState(cm);\n close();\n cm.focus();\n } else if (keyName == 'Ctrl-U') {\n CodeMirror.e_stop(e);\n close('');\n }\n }\n switch (command.searchArgs.querySrc) {\n case 'prompt':\n var macroModeState = vimGlobalState.macroModeState;\n if (macroModeState.isPlaying) {\n var query = macroModeState.replaySearchQueries.shift();\n handleQuery(query, true /** ignoreCase */, false /** smartCase */);\n } else {\n showPrompt(cm, {\n onClose: onPromptClose,\n prefix: promptPrefix,\n desc: searchPromptDesc,\n onKeyUp: onPromptKeyUp,\n onKeyDown: onPromptKeyDown\n });\n }\n break;\n case 'wordUnderCursor':\n var word = expandWordUnderCursor(cm, false /** inclusive */,\n true /** forward */, false /** bigWord */,\n true /** noSymbol */);\n var isKeyword = true;\n if (!word) {\n word = expandWordUnderCursor(cm, false /** inclusive */,\n true /** forward */, false /** bigWord */,\n false /** noSymbol */);\n isKeyword = false;\n }\n if (!word) {\n return;\n }\n var query = cm.getLine(word.start.line).substring(word.start.ch,\n word.end.ch);\n if (isKeyword && wholeWordOnly) {\n query = '\\\\b' + query + '\\\\b';\n } else {\n query = escapeRegex(query);\n }\n vimGlobalState.jumpList.cachedCursor = cm.getCursor();\n cm.setCursor(word.start);\n\n handleQuery(query, true /** ignoreCase */, false /** smartCase */);\n break;\n }\n },\n processEx: function(cm, vim, command) {\n function onPromptClose(input) {\n vimGlobalState.exCommandHistoryController.pushInput(input);\n vimGlobalState.exCommandHistoryController.reset();\n exCommandDispatcher.processCommand(cm, input);\n }\n function onPromptKeyDown(e, input, close) {\n var keyName = CodeMirror.keyName(e), up;\n if (keyName == 'Esc' || keyName == 'Ctrl-C' || keyName == 'Ctrl-[' ||\n (keyName == 'Backspace' && input == '')) {\n vimGlobalState.exCommandHistoryController.pushInput(input);\n vimGlobalState.exCommandHistoryController.reset();\n CodeMirror.e_stop(e);\n clearInputState(cm);\n close();\n cm.focus();\n }\n if (keyName == 'Up' || keyName == 'Down') {\n up = keyName == 'Up' ? true : false;\n input = vimGlobalState.exCommandHistoryController.nextMatch(input, up) || '';\n close(input);\n } else if (keyName == 'Ctrl-U') {\n CodeMirror.e_stop(e);\n close('');\n } else {\n if ( keyName != 'Left' && keyName != 'Right' && keyName != 'Ctrl' && keyName != 'Alt' && keyName != 'Shift')\n vimGlobalState.exCommandHistoryController.reset();\n }\n }\n if (command.type == 'keyToEx') {\n exCommandDispatcher.processCommand(cm, command.exArgs.input);\n } else {\n if (vim.visualMode) {\n showPrompt(cm, { onClose: onPromptClose, prefix: ':', value: '\\'<,\\'>',\n onKeyDown: onPromptKeyDown});\n } else {\n showPrompt(cm, { onClose: onPromptClose, prefix: ':',\n onKeyDown: onPromptKeyDown});\n }\n }\n },\n evalInput: function(cm, vim) {\n var inputState = vim.inputState;\n var motion = inputState.motion;\n var motionArgs = inputState.motionArgs || {};\n var operator = inputState.operator;\n var operatorArgs = inputState.operatorArgs || {};\n var registerName = inputState.registerName;\n var sel = vim.sel;\n var origHead = copyCursor(vim.visualMode ? clipCursorToContent(cm, sel.head): cm.getCursor('head'));\n var origAnchor = copyCursor(vim.visualMode ? clipCursorToContent(cm, sel.anchor) : cm.getCursor('anchor'));\n var oldHead = copyCursor(origHead);\n var oldAnchor = copyCursor(origAnchor);\n var newHead, newAnchor;\n var repeat;\n if (operator) {\n this.recordLastEdit(vim, inputState);\n }\n if (inputState.repeatOverride !== undefined) {\n repeat = inputState.repeatOverride;\n } else {\n repeat = inputState.getRepeat();\n }\n if (repeat > 0 && motionArgs.explicitRepeat) {\n motionArgs.repeatIsExplicit = true;\n } else if (motionArgs.noRepeat ||\n (!motionArgs.explicitRepeat && repeat === 0)) {\n repeat = 1;\n motionArgs.repeatIsExplicit = false;\n }\n if (inputState.selectedCharacter) {\n motionArgs.selectedCharacter = operatorArgs.selectedCharacter =\n inputState.selectedCharacter;\n }\n motionArgs.repeat = repeat;\n clearInputState(cm);\n if (motion) {\n var motionResult = motions[motion](cm, origHead, motionArgs, vim);\n vim.lastMotion = motions[motion];\n if (!motionResult) {\n return;\n }\n if (motionArgs.toJumplist) {\n if (!operator && cm.ace.curOp != null)\n cm.ace.curOp.command.scrollIntoView = \"center-animate\"; // ace_patch\n var jumpList = vimGlobalState.jumpList;\n var cachedCursor = jumpList.cachedCursor;\n if (cachedCursor) {\n recordJumpPosition(cm, cachedCursor, motionResult);\n delete jumpList.cachedCursor;\n } else {\n recordJumpPosition(cm, origHead, motionResult);\n }\n }\n if (motionResult instanceof Array) {\n newAnchor = motionResult[0];\n newHead = motionResult[1];\n } else {\n newHead = motionResult;\n }\n if (!newHead) {\n newHead = copyCursor(origHead);\n }\n if (vim.visualMode) {\n if (!(vim.visualBlock && newHead.ch === Infinity)) {\n newHead = clipCursorToContent(cm, newHead, vim.visualBlock);\n }\n if (newAnchor) {\n newAnchor = clipCursorToContent(cm, newAnchor, true);\n }\n newAnchor = newAnchor || oldAnchor;\n sel.anchor = newAnchor;\n sel.head = newHead;\n updateCmSelection(cm);\n updateMark(cm, vim, '<',\n cursorIsBefore(newAnchor, newHead) ? newAnchor\n : newHead);\n updateMark(cm, vim, '>',\n cursorIsBefore(newAnchor, newHead) ? newHead\n : newAnchor);\n } else if (!operator) {\n newHead = clipCursorToContent(cm, newHead);\n cm.setCursor(newHead.line, newHead.ch);\n }\n }\n if (operator) {\n if (operatorArgs.lastSel) {\n newAnchor = oldAnchor;\n var lastSel = operatorArgs.lastSel;\n var lineOffset = Math.abs(lastSel.head.line - lastSel.anchor.line);\n var chOffset = Math.abs(lastSel.head.ch - lastSel.anchor.ch);\n if (lastSel.visualLine) {\n newHead = Pos(oldAnchor.line + lineOffset, oldAnchor.ch);\n } else if (lastSel.visualBlock) {\n newHead = Pos(oldAnchor.line + lineOffset, oldAnchor.ch + chOffset);\n } else if (lastSel.head.line == lastSel.anchor.line) {\n newHead = Pos(oldAnchor.line, oldAnchor.ch + chOffset);\n } else {\n newHead = Pos(oldAnchor.line + lineOffset, oldAnchor.ch);\n }\n vim.visualMode = true;\n vim.visualLine = lastSel.visualLine;\n vim.visualBlock = lastSel.visualBlock;\n sel = vim.sel = {\n anchor: newAnchor,\n head: newHead\n };\n updateCmSelection(cm);\n } else if (vim.visualMode) {\n operatorArgs.lastSel = {\n anchor: copyCursor(sel.anchor),\n head: copyCursor(sel.head),\n visualBlock: vim.visualBlock,\n visualLine: vim.visualLine\n };\n }\n var curStart, curEnd, linewise, mode;\n var cmSel;\n if (vim.visualMode) {\n curStart = cursorMin(sel.head, sel.anchor);\n curEnd = cursorMax(sel.head, sel.anchor);\n linewise = vim.visualLine || operatorArgs.linewise;\n mode = vim.visualBlock ? 'block' :\n linewise ? 'line' :\n 'char';\n cmSel = makeCmSelection(cm, {\n anchor: curStart,\n head: curEnd\n }, mode);\n if (linewise) {\n var ranges = cmSel.ranges;\n if (mode == 'block') {\n for (var i = 0; i < ranges.length; i++) {\n ranges[i].head.ch = lineLength(cm, ranges[i].head.line);\n }\n } else if (mode == 'line') {\n ranges[0].head = Pos(ranges[0].head.line + 1, 0);\n }\n }\n } else {\n curStart = copyCursor(newAnchor || oldAnchor);\n curEnd = copyCursor(newHead || oldHead);\n if (cursorIsBefore(curEnd, curStart)) {\n var tmp = curStart;\n curStart = curEnd;\n curEnd = tmp;\n }\n linewise = motionArgs.linewise || operatorArgs.linewise;\n if (linewise) {\n expandSelectionToLine(cm, curStart, curEnd);\n } else if (motionArgs.forward) {\n clipToLine(cm, curStart, curEnd);\n }\n mode = 'char';\n var exclusive = !motionArgs.inclusive || linewise;\n cmSel = makeCmSelection(cm, {\n anchor: curStart,\n head: curEnd\n }, mode, exclusive);\n }\n cm.setSelections(cmSel.ranges, cmSel.primary);\n vim.lastMotion = null;\n operatorArgs.repeat = repeat; // For indent in visual mode.\n operatorArgs.registerName = registerName;\n operatorArgs.linewise = linewise;\n var operatorMoveTo = operators[operator](\n cm, operatorArgs, cmSel.ranges, oldAnchor, newHead);\n if (vim.visualMode) {\n exitVisualMode(cm, operatorMoveTo != null);\n }\n if (operatorMoveTo) {\n cm.setCursor(operatorMoveTo);\n }\n }\n },\n recordLastEdit: function(vim, inputState, actionCommand) {\n var macroModeState = vimGlobalState.macroModeState;\n if (macroModeState.isPlaying) { return; }\n vim.lastEditInputState = inputState;\n vim.lastEditActionCommand = actionCommand;\n macroModeState.lastInsertModeChanges.changes = [];\n macroModeState.lastInsertModeChanges.expectCursorActivityForChange = false;\n }\n };\n var motions = {\n moveToTopLine: function(cm, _head, motionArgs) {\n var line = getUserVisibleLines(cm).top + motionArgs.repeat -1;\n return Pos(line, findFirstNonWhiteSpaceCharacter(cm.getLine(line)));\n },\n moveToMiddleLine: function(cm) {\n var range = getUserVisibleLines(cm);\n var line = Math.floor((range.top + range.bottom) * 0.5);\n return Pos(line, findFirstNonWhiteSpaceCharacter(cm.getLine(line)));\n },\n moveToBottomLine: function(cm, _head, motionArgs) {\n var line = getUserVisibleLines(cm).bottom - motionArgs.repeat +1;\n return Pos(line, findFirstNonWhiteSpaceCharacter(cm.getLine(line)));\n },\n expandToLine: function(_cm, head, motionArgs) {\n var cur = head;\n return Pos(cur.line + motionArgs.repeat - 1, Infinity);\n },\n findNext: function(cm, _head, motionArgs) {\n var state = getSearchState(cm);\n var query = state.getQuery();\n if (!query) {\n return;\n }\n var prev = !motionArgs.forward;\n prev = (state.isReversed()) ? !prev : prev;\n highlightSearchMatches(cm, query);\n return findNext(cm, prev/** prev */, query, motionArgs.repeat);\n },\n goToMark: function(cm, _head, motionArgs, vim) {\n var mark = vim.marks[motionArgs.selectedCharacter];\n if (mark) {\n var pos = mark.find();\n return motionArgs.linewise ? { line: pos.line, ch: findFirstNonWhiteSpaceCharacter(cm.getLine(pos.line)) } : pos;\n }\n return null;\n },\n moveToOtherHighlightedEnd: function(cm, _head, motionArgs, vim) {\n if (vim.visualBlock && motionArgs.sameLine) {\n var sel = vim.sel;\n return [\n clipCursorToContent(cm, Pos(sel.anchor.line, sel.head.ch)),\n clipCursorToContent(cm, Pos(sel.head.line, sel.anchor.ch))\n ];\n } else {\n return ([vim.sel.head, vim.sel.anchor]);\n }\n },\n jumpToMark: function(cm, head, motionArgs, vim) {\n var best = head;\n for (var i = 0; i < motionArgs.repeat; i++) {\n var cursor = best;\n for (var key in vim.marks) {\n if (!isLowerCase(key)) {\n continue;\n }\n var mark = vim.marks[key].find();\n var isWrongDirection = (motionArgs.forward) ?\n cursorIsBefore(mark, cursor) : cursorIsBefore(cursor, mark);\n\n if (isWrongDirection) {\n continue;\n }\n if (motionArgs.linewise && (mark.line == cursor.line)) {\n continue;\n }\n\n var equal = cursorEqual(cursor, best);\n var between = (motionArgs.forward) ?\n cursorIsBetween(cursor, mark, best) :\n cursorIsBetween(best, mark, cursor);\n\n if (equal || between) {\n best = mark;\n }\n }\n }\n\n if (motionArgs.linewise) {\n best = Pos(best.line, findFirstNonWhiteSpaceCharacter(cm.getLine(best.line)));\n }\n return best;\n },\n moveByCharacters: function(_cm, head, motionArgs) {\n var cur = head;\n var repeat = motionArgs.repeat;\n var ch = motionArgs.forward ? cur.ch + repeat : cur.ch - repeat;\n return Pos(cur.line, ch);\n },\n moveByLines: function(cm, head, motionArgs, vim) {\n var cur = head;\n var endCh = cur.ch;\n switch (vim.lastMotion) {\n case this.moveByLines:\n case this.moveByDisplayLines:\n case this.moveByScroll:\n case this.moveToColumn:\n case this.moveToEol:\n endCh = vim.lastHPos;\n break;\n default:\n vim.lastHPos = endCh;\n }\n var repeat = motionArgs.repeat+(motionArgs.repeatOffset||0);\n var line = motionArgs.forward ? cur.line + repeat : cur.line - repeat;\n var first = cm.firstLine();\n var last = cm.lastLine();\n if ((line < first && cur.line == first) ||\n (line > last && cur.line == last)) {\n return;\n }\n var fold = cm.ace.session.getFoldLine(line);\n if (fold) {\n if (motionArgs.forward) {\n if (line > fold.start.row)\n line = fold.end.row + 1;\n } else {\n line = fold.start.row;\n }\n }\n if (motionArgs.toFirstChar){\n endCh=findFirstNonWhiteSpaceCharacter(cm.getLine(line));\n vim.lastHPos = endCh;\n }\n vim.lastHSPos = cm.charCoords(Pos(line, endCh),'div').left;\n return Pos(line, endCh);\n },\n moveByDisplayLines: function(cm, head, motionArgs, vim) {\n var cur = head;\n switch (vim.lastMotion) {\n case this.moveByDisplayLines:\n case this.moveByScroll:\n case this.moveByLines:\n case this.moveToColumn:\n case this.moveToEol:\n break;\n default:\n vim.lastHSPos = cm.charCoords(cur,'div').left;\n }\n var repeat = motionArgs.repeat;\n var res=cm.findPosV(cur,(motionArgs.forward ? repeat : -repeat),'line',vim.lastHSPos);\n if (res.hitSide) {\n if (motionArgs.forward) {\n var lastCharCoords = cm.charCoords(res, 'div');\n var goalCoords = { top: lastCharCoords.top + 8, left: vim.lastHSPos };\n var res = cm.coordsChar(goalCoords, 'div');\n } else {\n var resCoords = cm.charCoords(Pos(cm.firstLine(), 0), 'div');\n resCoords.left = vim.lastHSPos;\n res = cm.coordsChar(resCoords, 'div');\n }\n }\n vim.lastHPos = res.ch;\n return res;\n },\n moveByPage: function(cm, head, motionArgs) {\n var curStart = head;\n var repeat = motionArgs.repeat;\n return cm.findPosV(curStart, (motionArgs.forward ? repeat : -repeat), 'page');\n },\n moveByParagraph: function(cm, head, motionArgs) {\n var dir = motionArgs.forward ? 1 : -1;\n return findParagraph(cm, head, motionArgs.repeat, dir);\n },\n moveByScroll: function(cm, head, motionArgs, vim) {\n var scrollbox = cm.getScrollInfo();\n var curEnd = null;\n var repeat = motionArgs.repeat;\n if (!repeat) {\n repeat = scrollbox.clientHeight / (2 * cm.defaultTextHeight());\n }\n var orig = cm.charCoords(head, 'local');\n motionArgs.repeat = repeat;\n var curEnd = motions.moveByDisplayLines(cm, head, motionArgs, vim);\n if (!curEnd) {\n return null;\n }\n var dest = cm.charCoords(curEnd, 'local');\n cm.scrollTo(null, scrollbox.top + dest.top - orig.top);\n return curEnd;\n },\n moveByWords: function(cm, head, motionArgs) {\n return moveToWord(cm, head, motionArgs.repeat, !!motionArgs.forward,\n !!motionArgs.wordEnd, !!motionArgs.bigWord);\n },\n moveTillCharacter: function(cm, _head, motionArgs) {\n var repeat = motionArgs.repeat;\n var curEnd = moveToCharacter(cm, repeat, motionArgs.forward,\n motionArgs.selectedCharacter);\n var increment = motionArgs.forward ? -1 : 1;\n recordLastCharacterSearch(increment, motionArgs);\n if (!curEnd) return null;\n curEnd.ch += increment;\n return curEnd;\n },\n moveToCharacter: function(cm, head, motionArgs) {\n var repeat = motionArgs.repeat;\n recordLastCharacterSearch(0, motionArgs);\n return moveToCharacter(cm, repeat, motionArgs.forward,\n motionArgs.selectedCharacter) || head;\n },\n moveToSymbol: function(cm, head, motionArgs) {\n var repeat = motionArgs.repeat;\n return findSymbol(cm, repeat, motionArgs.forward,\n motionArgs.selectedCharacter) || head;\n },\n moveToColumn: function(cm, head, motionArgs, vim) {\n var repeat = motionArgs.repeat;\n vim.lastHPos = repeat - 1;\n vim.lastHSPos = cm.charCoords(head,'div').left;\n return moveToColumn(cm, repeat);\n },\n moveToEol: function(cm, head, motionArgs, vim) {\n var cur = head;\n vim.lastHPos = Infinity;\n var retval= Pos(cur.line + motionArgs.repeat - 1, Infinity);\n var end=cm.clipPos(retval);\n end.ch--;\n vim.lastHSPos = cm.charCoords(end,'div').left;\n return retval;\n },\n moveToFirstNonWhiteSpaceCharacter: function(cm, head) {\n var cursor = head;\n return Pos(cursor.line,\n findFirstNonWhiteSpaceCharacter(cm.getLine(cursor.line)));\n },\n moveToMatchedSymbol: function(cm, head) {\n var cursor = head;\n var line = cursor.line;\n var ch = cursor.ch;\n var lineText = cm.getLine(line);\n var symbol;\n do {\n symbol = lineText.charAt(ch++);\n if (symbol && isMatchableSymbol(symbol)) {\n var style = cm.getTokenTypeAt(Pos(line, ch));\n if (style !== \"string\" && style !== \"comment\") {\n break;\n }\n }\n } while (symbol);\n if (symbol) {\n var matched = cm.findMatchingBracket(Pos(line, ch));\n return matched.to;\n } else {\n return cursor;\n }\n },\n moveToStartOfLine: function(_cm, head) {\n return Pos(head.line, 0);\n },\n moveToLineOrEdgeOfDocument: function(cm, _head, motionArgs) {\n var lineNum = motionArgs.forward ? cm.lastLine() : cm.firstLine();\n if (motionArgs.repeatIsExplicit) {\n lineNum = motionArgs.repeat - cm.getOption('firstLineNumber');\n }\n return Pos(lineNum,\n findFirstNonWhiteSpaceCharacter(cm.getLine(lineNum)));\n },\n textObjectManipulation: function(cm, head, motionArgs, vim) {\n var mirroredPairs = {'(': ')', ')': '(',\n '{': '}', '}': '{',\n '[': ']', ']': '['};\n var selfPaired = {'\\'': true, '\"': true};\n\n var character = motionArgs.selectedCharacter;\n if (character == 'b') {\n character = '(';\n } else if (character == 'B') {\n character = '{';\n }\n var inclusive = !motionArgs.textObjectInner;\n\n var tmp;\n if (mirroredPairs[character]) {\n tmp = selectCompanionObject(cm, head, character, inclusive);\n } else if (selfPaired[character]) {\n tmp = findBeginningAndEnd(cm, head, character, inclusive);\n } else if (character === 'W') {\n tmp = expandWordUnderCursor(cm, inclusive, true /** forward */,\n true /** bigWord */);\n } else if (character === 'w') {\n tmp = expandWordUnderCursor(cm, inclusive, true /** forward */,\n false /** bigWord */);\n } else if (character === 'p') {\n tmp = findParagraph(cm, head, motionArgs.repeat, 0, inclusive);\n motionArgs.linewise = true;\n if (vim.visualMode) {\n if (!vim.visualLine) { vim.visualLine = true; }\n } else {\n var operatorArgs = vim.inputState.operatorArgs;\n if (operatorArgs) { operatorArgs.linewise = true; }\n tmp.end.line--;\n }\n } else {\n return null;\n }\n\n if (!cm.state.vim.visualMode) {\n return [tmp.start, tmp.end];\n } else {\n return expandSelection(cm, tmp.start, tmp.end);\n }\n },\n\n repeatLastCharacterSearch: function(cm, head, motionArgs) {\n var lastSearch = vimGlobalState.lastChararacterSearch;\n var repeat = motionArgs.repeat;\n var forward = motionArgs.forward === lastSearch.forward;\n var increment = (lastSearch.increment ? 1 : 0) * (forward ? -1 : 1);\n cm.moveH(-increment, 'char');\n motionArgs.inclusive = forward ? true : false;\n var curEnd = moveToCharacter(cm, repeat, forward, lastSearch.selectedCharacter);\n if (!curEnd) {\n cm.moveH(increment, 'char');\n return head;\n }\n curEnd.ch += increment;\n return curEnd;\n }\n };\n\n function defineMotion(name, fn) {\n motions[name] = fn;\n }\n\n function fillArray(val, times) {\n var arr = [];\n for (var i = 0; i < times; i++) {\n arr.push(val);\n }\n return arr;\n }\n var operators = {\n change: function(cm, args, ranges) {\n var finalHead, text;\n var vim = cm.state.vim;\n vimGlobalState.macroModeState.lastInsertModeChanges.inVisualBlock = vim.visualBlock;\n if (!vim.visualMode) {\n var anchor = ranges[0].anchor,\n head = ranges[0].head;\n text = cm.getRange(anchor, head);\n var lastState = vim.lastEditInputState || {};\n if (lastState.motion == \"moveByWords\" && !isWhiteSpaceString(text)) {\n var match = (/\\s+$/).exec(text);\n if (match && lastState.motionArgs && lastState.motionArgs.forward) {\n head = offsetCursor(head, 0, - match[0].length);\n text = text.slice(0, - match[0].length);\n }\n }\n var prevLineEnd = new Pos(anchor.line - 1, Number.MAX_VALUE);\n var wasLastLine = cm.firstLine() == cm.lastLine();\n if (head.line > cm.lastLine() && args.linewise && !wasLastLine) {\n cm.replaceRange('', prevLineEnd, head);\n } else {\n cm.replaceRange('', anchor, head);\n }\n if (args.linewise) {\n if (!wasLastLine) {\n cm.setCursor(prevLineEnd);\n CodeMirror.commands.newlineAndIndent(cm);\n }\n anchor.ch = Number.MAX_VALUE;\n }\n finalHead = anchor;\n } else {\n text = cm.getSelection();\n var replacement = fillArray('', ranges.length);\n cm.replaceSelections(replacement);\n finalHead = cursorMin(ranges[0].head, ranges[0].anchor);\n }\n vimGlobalState.registerController.pushText(\n args.registerName, 'change', text,\n args.linewise, ranges.length > 1);\n actions.enterInsertMode(cm, {head: finalHead}, cm.state.vim);\n },\n 'delete': function(cm, args, ranges) {\n var finalHead, text;\n var vim = cm.state.vim;\n if (!vim.visualBlock) {\n var anchor = ranges[0].anchor,\n head = ranges[0].head;\n if (args.linewise &&\n head.line != cm.firstLine() &&\n anchor.line == cm.lastLine() &&\n anchor.line == head.line - 1) {\n if (anchor.line == cm.firstLine()) {\n anchor.ch = 0;\n } else {\n anchor = Pos(anchor.line - 1, lineLength(cm, anchor.line - 1));\n }\n }\n text = cm.getRange(anchor, head);\n cm.replaceRange('', anchor, head);\n finalHead = anchor;\n if (args.linewise) {\n finalHead = motions.moveToFirstNonWhiteSpaceCharacter(cm, anchor);\n }\n } else {\n text = cm.getSelection();\n var replacement = fillArray('', ranges.length);\n cm.replaceSelections(replacement);\n finalHead = ranges[0].anchor;\n }\n vimGlobalState.registerController.pushText(\n args.registerName, 'delete', text,\n args.linewise, vim.visualBlock);\n return clipCursorToContent(cm, finalHead);\n },\n indent: function(cm, args, ranges) {\n var vim = cm.state.vim;\n var startLine = ranges[0].anchor.line;\n var endLine = vim.visualBlock ?\n ranges[ranges.length - 1].anchor.line :\n ranges[0].head.line;\n var repeat = (vim.visualMode) ? args.repeat : 1;\n if (args.linewise) {\n endLine--;\n }\n for (var i = startLine; i <= endLine; i++) {\n for (var j = 0; j < repeat; j++) {\n cm.indentLine(i, args.indentRight);\n }\n }\n return motions.moveToFirstNonWhiteSpaceCharacter(cm, ranges[0].anchor);\n },\n changeCase: function(cm, args, ranges, oldAnchor, newHead) {\n var selections = cm.getSelections();\n var swapped = [];\n var toLower = args.toLower;\n for (var j = 0; j < selections.length; j++) {\n var toSwap = selections[j];\n var text = '';\n if (toLower === true) {\n text = toSwap.toLowerCase();\n } else if (toLower === false) {\n text = toSwap.toUpperCase();\n } else {\n for (var i = 0; i < toSwap.length; i++) {\n var character = toSwap.charAt(i);\n text += isUpperCase(character) ? character.toLowerCase() :\n character.toUpperCase();\n }\n }\n swapped.push(text);\n }\n cm.replaceSelections(swapped);\n if (args.shouldMoveCursor){\n return newHead;\n } else if (!cm.state.vim.visualMode && args.linewise && ranges[0].anchor.line + 1 == ranges[0].head.line) {\n return motions.moveToFirstNonWhiteSpaceCharacter(cm, oldAnchor);\n } else if (args.linewise){\n return oldAnchor;\n } else {\n return cursorMin(ranges[0].anchor, ranges[0].head);\n }\n },\n yank: function(cm, args, ranges, oldAnchor) {\n var vim = cm.state.vim;\n var text = cm.getSelection();\n var endPos = vim.visualMode\n ? cursorMin(vim.sel.anchor, vim.sel.head, ranges[0].head, ranges[0].anchor)\n : oldAnchor;\n vimGlobalState.registerController.pushText(\n args.registerName, 'yank',\n text, args.linewise, vim.visualBlock);\n return endPos;\n }\n };\n\n function defineOperator(name, fn) {\n operators[name] = fn;\n }\n\n var actions = {\n jumpListWalk: function(cm, actionArgs, vim) {\n if (vim.visualMode) {\n return;\n }\n var repeat = actionArgs.repeat;\n var forward = actionArgs.forward;\n var jumpList = vimGlobalState.jumpList;\n\n var mark = jumpList.move(cm, forward ? repeat : -repeat);\n var markPos = mark ? mark.find() : undefined;\n markPos = markPos ? markPos : cm.getCursor();\n cm.setCursor(markPos);\n cm.ace.curOp.command.scrollIntoView = \"center-animate\"; // ace_patch\n },\n scroll: function(cm, actionArgs, vim) {\n if (vim.visualMode) {\n return;\n }\n var repeat = actionArgs.repeat || 1;\n var lineHeight = cm.defaultTextHeight();\n var top = cm.getScrollInfo().top;\n var delta = lineHeight * repeat;\n var newPos = actionArgs.forward ? top + delta : top - delta;\n var cursor = copyCursor(cm.getCursor());\n var cursorCoords = cm.charCoords(cursor, 'local');\n if (actionArgs.forward) {\n if (newPos > cursorCoords.top) {\n cursor.line += (newPos - cursorCoords.top) / lineHeight;\n cursor.line = Math.ceil(cursor.line);\n cm.setCursor(cursor);\n cursorCoords = cm.charCoords(cursor, 'local');\n cm.scrollTo(null, cursorCoords.top);\n } else {\n cm.scrollTo(null, newPos);\n }\n } else {\n var newBottom = newPos + cm.getScrollInfo().clientHeight;\n if (newBottom < cursorCoords.bottom) {\n cursor.line -= (cursorCoords.bottom - newBottom) / lineHeight;\n cursor.line = Math.floor(cursor.line);\n cm.setCursor(cursor);\n cursorCoords = cm.charCoords(cursor, 'local');\n cm.scrollTo(\n null, cursorCoords.bottom - cm.getScrollInfo().clientHeight);\n } else {\n cm.scrollTo(null, newPos);\n }\n }\n },\n scrollToCursor: function(cm, actionArgs) {\n var lineNum = cm.getCursor().line;\n var charCoords = cm.charCoords(Pos(lineNum, 0), 'local');\n var height = cm.getScrollInfo().clientHeight;\n var y = charCoords.top;\n var lineHeight = charCoords.bottom - y;\n switch (actionArgs.position) {\n case 'center': y = y - (height / 2) + lineHeight;\n break;\n case 'bottom': y = y - height + lineHeight*1.4;\n break;\n case 'top': y = y + lineHeight*0.4;\n break;\n }\n cm.scrollTo(null, y);\n },\n replayMacro: function(cm, actionArgs, vim) {\n var registerName = actionArgs.selectedCharacter;\n var repeat = actionArgs.repeat;\n var macroModeState = vimGlobalState.macroModeState;\n if (registerName == '@') {\n registerName = macroModeState.latestRegister;\n }\n while(repeat--){\n executeMacroRegister(cm, vim, macroModeState, registerName);\n }\n },\n enterMacroRecordMode: function(cm, actionArgs) {\n var macroModeState = vimGlobalState.macroModeState;\n var registerName = actionArgs.selectedCharacter;\n macroModeState.enterMacroRecordMode(cm, registerName);\n },\n enterInsertMode: function(cm, actionArgs, vim) {\n if (cm.getOption('readOnly')) { return; }\n vim.insertMode = true;\n vim.insertModeRepeat = actionArgs && actionArgs.repeat || 1;\n var insertAt = (actionArgs) ? actionArgs.insertAt : null;\n var sel = vim.sel;\n var head = actionArgs.head || cm.getCursor('head');\n var height = cm.listSelections().length;\n if (insertAt == 'eol') {\n head = Pos(head.line, lineLength(cm, head.line));\n } else if (insertAt == 'charAfter') {\n head = offsetCursor(head, 0, 1);\n } else if (insertAt == 'firstNonBlank') {\n head = motions.moveToFirstNonWhiteSpaceCharacter(cm, head);\n } else if (insertAt == 'startOfSelectedArea') {\n if (!vim.visualBlock) {\n if (sel.head.line < sel.anchor.line) {\n head = sel.head;\n } else {\n head = Pos(sel.anchor.line, 0);\n }\n } else {\n head = Pos(\n Math.min(sel.head.line, sel.anchor.line),\n Math.min(sel.head.ch, sel.anchor.ch));\n height = Math.abs(sel.head.line - sel.anchor.line) + 1;\n }\n } else if (insertAt == 'endOfSelectedArea') {\n if (!vim.visualBlock) {\n if (sel.head.line >= sel.anchor.line) {\n head = offsetCursor(sel.head, 0, 1);\n } else {\n head = Pos(sel.anchor.line, 0);\n }\n } else {\n head = Pos(\n Math.min(sel.head.line, sel.anchor.line),\n Math.max(sel.head.ch + 1, sel.anchor.ch));\n height = Math.abs(sel.head.line - sel.anchor.line) + 1;\n }\n } else if (insertAt == 'inplace') {\n if (vim.visualMode){\n return;\n }\n }\n cm.setOption('keyMap', 'vim-insert');\n cm.setOption('disableInput', false);\n if (actionArgs && actionArgs.replace) {\n cm.toggleOverwrite(true);\n cm.setOption('keyMap', 'vim-replace');\n CodeMirror.signal(cm, \"vim-mode-change\", {mode: \"replace\"});\n } else {\n cm.setOption('keyMap', 'vim-insert');\n CodeMirror.signal(cm, \"vim-mode-change\", {mode: \"insert\"});\n }\n if (!vimGlobalState.macroModeState.isPlaying) {\n cm.on('change', onChange);\n CodeMirror.on(cm.getInputField(), 'keydown', onKeyEventTargetKeyDown);\n }\n if (vim.visualMode) {\n exitVisualMode(cm);\n }\n selectForInsert(cm, head, height);\n },\n toggleVisualMode: function(cm, actionArgs, vim) {\n var repeat = actionArgs.repeat;\n var anchor = cm.getCursor();\n var head;\n if (!vim.visualMode) {\n vim.visualMode = true;\n vim.visualLine = !!actionArgs.linewise;\n vim.visualBlock = !!actionArgs.blockwise;\n head = clipCursorToContent(\n cm, Pos(anchor.line, anchor.ch + repeat - 1),\n true /** includeLineBreak */);\n vim.sel = {\n anchor: anchor,\n head: head\n };\n CodeMirror.signal(cm, \"vim-mode-change\", {mode: \"visual\", subMode: vim.visualLine ? \"linewise\" : vim.visualBlock ? \"blockwise\" : \"\"});\n updateCmSelection(cm);\n updateMark(cm, vim, '<', cursorMin(anchor, head));\n updateMark(cm, vim, '>', cursorMax(anchor, head));\n } else if (vim.visualLine ^ actionArgs.linewise ||\n vim.visualBlock ^ actionArgs.blockwise) {\n vim.visualLine = !!actionArgs.linewise;\n vim.visualBlock = !!actionArgs.blockwise;\n CodeMirror.signal(cm, \"vim-mode-change\", {mode: \"visual\", subMode: vim.visualLine ? \"linewise\" : vim.visualBlock ? \"blockwise\" : \"\"});\n updateCmSelection(cm);\n } else {\n exitVisualMode(cm);\n }\n },\n reselectLastSelection: function(cm, _actionArgs, vim) {\n var lastSelection = vim.lastSelection;\n if (vim.visualMode) {\n updateLastSelection(cm, vim);\n }\n if (lastSelection) {\n var anchor = lastSelection.anchorMark.find();\n var head = lastSelection.headMark.find();\n if (!anchor || !head) {\n return;\n }\n vim.sel = {\n anchor: anchor,\n head: head\n };\n vim.visualMode = true;\n vim.visualLine = lastSelection.visualLine;\n vim.visualBlock = lastSelection.visualBlock;\n updateCmSelection(cm);\n updateMark(cm, vim, '<', cursorMin(anchor, head));\n updateMark(cm, vim, '>', cursorMax(anchor, head));\n CodeMirror.signal(cm, 'vim-mode-change', {\n mode: 'visual',\n subMode: vim.visualLine ? 'linewise' :\n vim.visualBlock ? 'blockwise' : ''});\n }\n },\n joinLines: function(cm, actionArgs, vim) {\n var curStart, curEnd;\n if (vim.visualMode) {\n curStart = cm.getCursor('anchor');\n curEnd = cm.getCursor('head');\n if (cursorIsBefore(curEnd, curStart)) {\n var tmp = curEnd;\n curEnd = curStart;\n curStart = tmp;\n }\n curEnd.ch = lineLength(cm, curEnd.line) - 1;\n } else {\n var repeat = Math.max(actionArgs.repeat, 2);\n curStart = cm.getCursor();\n curEnd = clipCursorToContent(cm, Pos(curStart.line + repeat - 1,\n Infinity));\n }\n var finalCh = 0;\n for (var i = curStart.line; i < curEnd.line; i++) {\n finalCh = lineLength(cm, curStart.line);\n var tmp = Pos(curStart.line + 1,\n lineLength(cm, curStart.line + 1));\n var text = cm.getRange(curStart, tmp);\n text = text.replace(/\\n\\s*/g, ' ');\n cm.replaceRange(text, curStart, tmp);\n }\n var curFinalPos = Pos(curStart.line, finalCh);\n if (vim.visualMode) {\n exitVisualMode(cm, false);\n }\n cm.setCursor(curFinalPos);\n },\n newLineAndEnterInsertMode: function(cm, actionArgs, vim) {\n vim.insertMode = true;\n var insertAt = copyCursor(cm.getCursor());\n if (insertAt.line === cm.firstLine() && !actionArgs.after) {\n cm.replaceRange('\\n', Pos(cm.firstLine(), 0));\n cm.setCursor(cm.firstLine(), 0);\n } else {\n insertAt.line = (actionArgs.after) ? insertAt.line :\n insertAt.line - 1;\n insertAt.ch = lineLength(cm, insertAt.line);\n cm.setCursor(insertAt);\n var newlineFn = CodeMirror.commands.newlineAndIndentContinueComment ||\n CodeMirror.commands.newlineAndIndent;\n newlineFn(cm);\n }\n this.enterInsertMode(cm, { repeat: actionArgs.repeat }, vim);\n },\n paste: function(cm, actionArgs, vim) {\n var cur = copyCursor(cm.getCursor());\n var register = vimGlobalState.registerController.getRegister(\n actionArgs.registerName);\n var text = register.toString();\n if (!text) {\n return;\n }\n if (actionArgs.matchIndent) {\n var tabSize = cm.getOption(\"tabSize\");\n var whitespaceLength = function(str) {\n var tabs = (str.split(\"\\t\").length - 1);\n var spaces = (str.split(\" \").length - 1);\n return tabs * tabSize + spaces * 1;\n };\n var currentLine = cm.getLine(cm.getCursor().line);\n var indent = whitespaceLength(currentLine.match(/^\\s*/)[0]);\n var chompedText = text.replace(/\\n$/, '');\n var wasChomped = text !== chompedText;\n var firstIndent = whitespaceLength(text.match(/^\\s*/)[0]);\n var text = chompedText.replace(/^\\s*/gm, function(wspace) {\n var newIndent = indent + (whitespaceLength(wspace) - firstIndent);\n if (newIndent < 0) {\n return \"\";\n }\n else if (cm.getOption(\"indentWithTabs\")) {\n var quotient = Math.floor(newIndent / tabSize);\n return Array(quotient + 1).join('\\t');\n }\n else {\n return Array(newIndent + 1).join(' ');\n }\n });\n text += wasChomped ? \"\\n\" : \"\";\n }\n if (actionArgs.repeat > 1) {\n var text = Array(actionArgs.repeat + 1).join(text);\n }\n var linewise = register.linewise;\n var blockwise = register.blockwise;\n if (linewise && !blockwise) {\n if(vim.visualMode) {\n text = vim.visualLine ? text.slice(0, -1) : '\\n' + text.slice(0, text.length - 1) + '\\n';\n } else if (actionArgs.after) {\n text = '\\n' + text.slice(0, text.length - 1);\n cur.ch = lineLength(cm, cur.line);\n } else {\n cur.ch = 0;\n }\n } else {\n if (blockwise) {\n text = text.split('\\n');\n for (var i = 0; i < text.length; i++) {\n text[i] = (text[i] == '') ? ' ' : text[i];\n }\n }\n cur.ch += actionArgs.after ? 1 : 0;\n }\n var curPosFinal;\n var idx;\n if (vim.visualMode) {\n vim.lastPastedText = text;\n var lastSelectionCurEnd;\n var selectedArea = getSelectedAreaRange(cm, vim);\n var selectionStart = selectedArea[0];\n var selectionEnd = selectedArea[1];\n var selectedText = cm.getSelection();\n var selections = cm.listSelections();\n var emptyStrings = new Array(selections.length).join('1').split('1');\n if (vim.lastSelection) {\n lastSelectionCurEnd = vim.lastSelection.headMark.find();\n }\n vimGlobalState.registerController.unnamedRegister.setText(selectedText);\n if (blockwise) {\n cm.replaceSelections(emptyStrings);\n selectionEnd = Pos(selectionStart.line + text.length-1, selectionStart.ch);\n cm.setCursor(selectionStart);\n selectBlock(cm, selectionEnd);\n cm.replaceSelections(text);\n curPosFinal = selectionStart;\n } else if (vim.visualBlock) {\n cm.replaceSelections(emptyStrings);\n cm.setCursor(selectionStart);\n cm.replaceRange(text, selectionStart, selectionStart);\n curPosFinal = selectionStart;\n } else {\n cm.replaceRange(text, selectionStart, selectionEnd);\n curPosFinal = cm.posFromIndex(cm.indexFromPos(selectionStart) + text.length - 1);\n }\n if(lastSelectionCurEnd) {\n vim.lastSelection.headMark = cm.setBookmark(lastSelectionCurEnd);\n }\n if (linewise) {\n curPosFinal.ch=0;\n }\n } else {\n if (blockwise) {\n cm.setCursor(cur);\n for (var i = 0; i < text.length; i++) {\n var line = cur.line+i;\n if (line > cm.lastLine()) {\n cm.replaceRange('\\n', Pos(line, 0));\n }\n var lastCh = lineLength(cm, line);\n if (lastCh < cur.ch) {\n extendLineToColumn(cm, line, cur.ch);\n }\n }\n cm.setCursor(cur);\n selectBlock(cm, Pos(cur.line + text.length-1, cur.ch));\n cm.replaceSelections(text);\n curPosFinal = cur;\n } else {\n cm.replaceRange(text, cur);\n if (linewise && actionArgs.after) {\n curPosFinal = Pos(\n cur.line + 1,\n findFirstNonWhiteSpaceCharacter(cm.getLine(cur.line + 1)));\n } else if (linewise && !actionArgs.after) {\n curPosFinal = Pos(\n cur.line,\n findFirstNonWhiteSpaceCharacter(cm.getLine(cur.line)));\n } else if (!linewise && actionArgs.after) {\n idx = cm.indexFromPos(cur);\n curPosFinal = cm.posFromIndex(idx + text.length - 1);\n } else {\n idx = cm.indexFromPos(cur);\n curPosFinal = cm.posFromIndex(idx + text.length);\n }\n }\n }\n if (vim.visualMode) {\n exitVisualMode(cm, false);\n }\n cm.setCursor(curPosFinal);\n },\n undo: function(cm, actionArgs) {\n cm.operation(function() {\n repeatFn(cm, CodeMirror.commands.undo, actionArgs.repeat)();\n cm.setCursor(cm.getCursor('anchor'));\n });\n },\n redo: function(cm, actionArgs) {\n repeatFn(cm, CodeMirror.commands.redo, actionArgs.repeat)();\n },\n setRegister: function(_cm, actionArgs, vim) {\n vim.inputState.registerName = actionArgs.selectedCharacter;\n },\n setMark: function(cm, actionArgs, vim) {\n var markName = actionArgs.selectedCharacter;\n updateMark(cm, vim, markName, cm.getCursor());\n },\n replace: function(cm, actionArgs, vim) {\n var replaceWith = actionArgs.selectedCharacter;\n var curStart = cm.getCursor();\n var replaceTo;\n var curEnd;\n var selections = cm.listSelections();\n if (vim.visualMode) {\n curStart = cm.getCursor('start');\n curEnd = cm.getCursor('end');\n } else {\n var line = cm.getLine(curStart.line);\n replaceTo = curStart.ch + actionArgs.repeat;\n if (replaceTo > line.length) {\n replaceTo=line.length;\n }\n curEnd = Pos(curStart.line, replaceTo);\n }\n if (replaceWith=='\\n') {\n if (!vim.visualMode) cm.replaceRange('', curStart, curEnd);\n (CodeMirror.commands.newlineAndIndentContinueComment || CodeMirror.commands.newlineAndIndent)(cm);\n } else {\n var replaceWithStr = cm.getRange(curStart, curEnd);\n replaceWithStr = replaceWithStr.replace(/[^\\n]/g, replaceWith);\n if (vim.visualBlock) {\n var spaces = new Array(cm.getOption(\"tabSize\")+1).join(' ');\n replaceWithStr = cm.getSelection();\n replaceWithStr = replaceWithStr.replace(/\\t/g, spaces).replace(/[^\\n]/g, replaceWith).split('\\n');\n cm.replaceSelections(replaceWithStr);\n } else {\n cm.replaceRange(replaceWithStr, curStart, curEnd);\n }\n if (vim.visualMode) {\n curStart = cursorIsBefore(selections[0].anchor, selections[0].head) ?\n selections[0].anchor : selections[0].head;\n cm.setCursor(curStart);\n exitVisualMode(cm, false);\n } else {\n cm.setCursor(offsetCursor(curEnd, 0, -1));\n }\n }\n },\n incrementNumberToken: function(cm, actionArgs) {\n var cur = cm.getCursor();\n var lineStr = cm.getLine(cur.line);\n var re = /-?\\d+/g;\n var match;\n var start;\n var end;\n var numberStr;\n var token;\n while ((match = re.exec(lineStr)) !== null) {\n token = match[0];\n start = match.index;\n end = start + token.length;\n if (cur.ch < end)break;\n }\n if (!actionArgs.backtrack && (end <= cur.ch))return;\n if (token) {\n var increment = actionArgs.increase ? 1 : -1;\n var number = parseInt(token) + (increment * actionArgs.repeat);\n var from = Pos(cur.line, start);\n var to = Pos(cur.line, end);\n numberStr = number.toString();\n cm.replaceRange(numberStr, from, to);\n } else {\n return;\n }\n cm.setCursor(Pos(cur.line, start + numberStr.length - 1));\n },\n repeatLastEdit: function(cm, actionArgs, vim) {\n var lastEditInputState = vim.lastEditInputState;\n if (!lastEditInputState) { return; }\n var repeat = actionArgs.repeat;\n if (repeat && actionArgs.repeatIsExplicit) {\n vim.lastEditInputState.repeatOverride = repeat;\n } else {\n repeat = vim.lastEditInputState.repeatOverride || repeat;\n }\n repeatLastEdit(cm, vim, repeat, false /** repeatForInsert */);\n },\n exitInsertMode: exitInsertMode\n };\n\n function defineAction(name, fn) {\n actions[name] = fn;\n }\n function clipCursorToContent(cm, cur, includeLineBreak) {\n var line = Math.min(Math.max(cm.firstLine(), cur.line), cm.lastLine() );\n var maxCh = lineLength(cm, line) - 1;\n maxCh = (includeLineBreak) ? maxCh + 1 : maxCh;\n var ch = Math.min(Math.max(0, cur.ch), maxCh);\n return Pos(line, ch);\n }\n function copyArgs(args) {\n var ret = {};\n for (var prop in args) {\n if (args.hasOwnProperty(prop)) {\n ret[prop] = args[prop];\n }\n }\n return ret;\n }\n function offsetCursor(cur, offsetLine, offsetCh) {\n if (typeof offsetLine === 'object') {\n offsetCh = offsetLine.ch;\n offsetLine = offsetLine.line;\n }\n return Pos(cur.line + offsetLine, cur.ch + offsetCh);\n }\n function getOffset(anchor, head) {\n return {\n line: head.line - anchor.line,\n ch: head.line - anchor.line\n };\n }\n function commandMatches(keys, keyMap, context, inputState) {\n var match, partial = [], full = [];\n for (var i = 0; i < keyMap.length; i++) {\n var command = keyMap[i];\n if (context == 'insert' && command.context != 'insert' ||\n command.context && command.context != context ||\n inputState.operator && command.type == 'action' ||\n !(match = commandMatch(keys, command.keys))) { continue; }\n if (match == 'partial') { partial.push(command); }\n if (match == 'full') { full.push(command); }\n }\n return {\n partial: partial.length && partial,\n full: full.length && full\n };\n }\n function commandMatch(pressed, mapped) {\n if (mapped.slice(-11) == '<character>') {\n var prefixLen = mapped.length - 11;\n var pressedPrefix = pressed.slice(0, prefixLen);\n var mappedPrefix = mapped.slice(0, prefixLen);\n return pressedPrefix == mappedPrefix && pressed.length > prefixLen ? 'full' :\n mappedPrefix.indexOf(pressedPrefix) == 0 ? 'partial' : false;\n } else {\n return pressed == mapped ? 'full' :\n mapped.indexOf(pressed) == 0 ? 'partial' : false;\n }\n }\n function lastChar(keys) {\n var match = /^.*(<[\\w\\-]+>)$/.exec(keys);\n var selectedCharacter = match ? match[1] : keys.slice(-1);\n if (selectedCharacter.length > 1){\n switch(selectedCharacter){\n case '<CR>':\n selectedCharacter='\\n';\n break;\n case '<Space>':\n selectedCharacter=' ';\n break;\n default:\n break;\n }\n }\n return selectedCharacter;\n }\n function repeatFn(cm, fn, repeat) {\n return function() {\n for (var i = 0; i < repeat; i++) {\n fn(cm);\n }\n };\n }\n function copyCursor(cur) {\n return Pos(cur.line, cur.ch);\n }\n function cursorEqual(cur1, cur2) {\n return cur1.ch == cur2.ch && cur1.line == cur2.line;\n }\n function cursorIsBefore(cur1, cur2) {\n if (cur1.line < cur2.line) {\n return true;\n }\n if (cur1.line == cur2.line && cur1.ch < cur2.ch) {\n return true;\n }\n return false;\n }\n function cursorMin(cur1, cur2) {\n if (arguments.length > 2) {\n cur2 = cursorMin.apply(undefined, Array.prototype.slice.call(arguments, 1));\n }\n return cursorIsBefore(cur1, cur2) ? cur1 : cur2;\n }\n function cursorMax(cur1, cur2) {\n if (arguments.length > 2) {\n cur2 = cursorMax.apply(undefined, Array.prototype.slice.call(arguments, 1));\n }\n return cursorIsBefore(cur1, cur2) ? cur2 : cur1;\n }\n function cursorIsBetween(cur1, cur2, cur3) {\n var cur1before2 = cursorIsBefore(cur1, cur2);\n var cur2before3 = cursorIsBefore(cur2, cur3);\n return cur1before2 && cur2before3;\n }\n function lineLength(cm, lineNum) {\n return cm.getLine(lineNum).length;\n }\n function trim(s) {\n if (s.trim) {\n return s.trim();\n }\n return s.replace(/^\\s+|\\s+$/g, '');\n }\n function escapeRegex(s) {\n return s.replace(/([.?*+$\\[\\]\\/\\\\(){}|\\-])/g, '\\\\$1');\n }\n function extendLineToColumn(cm, lineNum, column) {\n var endCh = lineLength(cm, lineNum);\n var spaces = new Array(column-endCh+1).join(' ');\n cm.setCursor(Pos(lineNum, endCh));\n cm.replaceRange(spaces, cm.getCursor());\n }\n function selectBlock(cm, selectionEnd) {\n var selections = [], ranges = cm.listSelections();\n var head = copyCursor(cm.clipPos(selectionEnd));\n var isClipped = !cursorEqual(selectionEnd, head);\n var curHead = cm.getCursor('head');\n var primIndex = getIndex(ranges, curHead);\n var wasClipped = cursorEqual(ranges[primIndex].head, ranges[primIndex].anchor);\n var max = ranges.length - 1;\n var index = max - primIndex > primIndex ? max : 0;\n var base = ranges[index].anchor;\n\n var firstLine = Math.min(base.line, head.line);\n var lastLine = Math.max(base.line, head.line);\n var baseCh = base.ch, headCh = head.ch;\n\n var dir = ranges[index].head.ch - baseCh;\n var newDir = headCh - baseCh;\n if (dir > 0 && newDir <= 0) {\n baseCh++;\n if (!isClipped) { headCh--; }\n } else if (dir < 0 && newDir >= 0) {\n baseCh--;\n if (!wasClipped) { headCh++; }\n } else if (dir < 0 && newDir == -1) {\n baseCh--;\n headCh++;\n }\n for (var line = firstLine; line <= lastLine; line++) {\n var range = {anchor: new Pos(line, baseCh), head: new Pos(line, headCh)};\n selections.push(range);\n }\n primIndex = head.line == lastLine ? selections.length - 1 : 0;\n cm.setSelections(selections);\n selectionEnd.ch = headCh;\n base.ch = baseCh;\n return base;\n }\n function selectForInsert(cm, head, height) {\n var sel = [];\n for (var i = 0; i < height; i++) {\n var lineHead = offsetCursor(head, i, 0);\n sel.push({anchor: lineHead, head: lineHead});\n }\n cm.setSelections(sel, 0);\n }\n function getIndex(ranges, cursor, end) {\n for (var i = 0; i < ranges.length; i++) {\n var atAnchor = end != 'head' && cursorEqual(ranges[i].anchor, cursor);\n var atHead = end != 'anchor' && cursorEqual(ranges[i].head, cursor);\n if (atAnchor || atHead) {\n return i;\n }\n }\n return -1;\n }\n function getSelectedAreaRange(cm, vim) {\n var lastSelection = vim.lastSelection;\n var getCurrentSelectedAreaRange = function() {\n var selections = cm.listSelections();\n var start = selections[0];\n var end = selections[selections.length-1];\n var selectionStart = cursorIsBefore(start.anchor, start.head) ? start.anchor : start.head;\n var selectionEnd = cursorIsBefore(end.anchor, end.head) ? end.head : end.anchor;\n return [selectionStart, selectionEnd];\n };\n var getLastSelectedAreaRange = function() {\n var selectionStart = cm.getCursor();\n var selectionEnd = cm.getCursor();\n var block = lastSelection.visualBlock;\n if (block) {\n var width = block.width;\n var height = block.height;\n selectionEnd = Pos(selectionStart.line + height, selectionStart.ch + width);\n var selections = [];\n for (var i = selectionStart.line; i < selectionEnd.line; i++) {\n var anchor = Pos(i, selectionStart.ch);\n var head = Pos(i, selectionEnd.ch);\n var range = {anchor: anchor, head: head};\n selections.push(range);\n }\n cm.setSelections(selections);\n } else {\n var start = lastSelection.anchorMark.find();\n var end = lastSelection.headMark.find();\n var line = end.line - start.line;\n var ch = end.ch - start.ch;\n selectionEnd = {line: selectionEnd.line + line, ch: line ? selectionEnd.ch : ch + selectionEnd.ch};\n if (lastSelection.visualLine) {\n selectionStart = Pos(selectionStart.line, 0);\n selectionEnd = Pos(selectionEnd.line, lineLength(cm, selectionEnd.line));\n }\n cm.setSelection(selectionStart, selectionEnd);\n }\n return [selectionStart, selectionEnd];\n };\n if (!vim.visualMode) {\n return getLastSelectedAreaRange();\n } else {\n return getCurrentSelectedAreaRange();\n }\n }\n function updateLastSelection(cm, vim) {\n var anchor = vim.sel.anchor;\n var head = vim.sel.head;\n if (vim.lastPastedText) {\n head = cm.posFromIndex(cm.indexFromPos(anchor) + vim.lastPastedText.length);\n vim.lastPastedText = null;\n }\n vim.lastSelection = {'anchorMark': cm.setBookmark(anchor),\n 'headMark': cm.setBookmark(head),\n 'anchor': copyCursor(anchor),\n 'head': copyCursor(head),\n 'visualMode': vim.visualMode,\n 'visualLine': vim.visualLine,\n 'visualBlock': vim.visualBlock};\n }\n function expandSelection(cm, start, end) {\n var sel = cm.state.vim.sel;\n var head = sel.head;\n var anchor = sel.anchor;\n var tmp;\n if (cursorIsBefore(end, start)) {\n tmp = end;\n end = start;\n start = tmp;\n }\n if (cursorIsBefore(head, anchor)) {\n head = cursorMin(start, head);\n anchor = cursorMax(anchor, end);\n } else {\n anchor = cursorMin(start, anchor);\n head = cursorMax(head, end);\n head = offsetCursor(head, 0, -1);\n if (head.ch == -1 && head.line != cm.firstLine()) {\n head = Pos(head.line - 1, lineLength(cm, head.line - 1));\n }\n }\n return [anchor, head];\n }\n function updateCmSelection(cm, sel, mode) {\n var vim = cm.state.vim;\n sel = sel || vim.sel;\n var mode = mode ||\n vim.visualLine ? 'line' : vim.visualBlock ? 'block' : 'char';\n var cmSel = makeCmSelection(cm, sel, mode);\n cm.setSelections(cmSel.ranges, cmSel.primary);\n updateFakeCursor(cm);\n }\n function makeCmSelection(cm, sel, mode, exclusive) {\n var head = copyCursor(sel.head);\n var anchor = copyCursor(sel.anchor);\n if (mode == 'char') {\n var headOffset = !exclusive && !cursorIsBefore(sel.head, sel.anchor) ? 1 : 0;\n var anchorOffset = cursorIsBefore(sel.head, sel.anchor) ? 1 : 0;\n head = offsetCursor(sel.head, 0, headOffset);\n anchor = offsetCursor(sel.anchor, 0, anchorOffset);\n return {\n ranges: [{anchor: anchor, head: head}],\n primary: 0\n };\n } else if (mode == 'line') {\n if (!cursorIsBefore(sel.head, sel.anchor)) {\n anchor.ch = 0;\n\n var lastLine = cm.lastLine();\n if (head.line > lastLine) {\n head.line = lastLine;\n }\n head.ch = lineLength(cm, head.line);\n } else {\n head.ch = 0;\n anchor.ch = lineLength(cm, anchor.line);\n }\n return {\n ranges: [{anchor: anchor, head: head}],\n primary: 0\n };\n } else if (mode == 'block') {\n var top = Math.min(anchor.line, head.line),\n left = Math.min(anchor.ch, head.ch),\n bottom = Math.max(anchor.line, head.line),\n right = Math.max(anchor.ch, head.ch) + 1;\n var height = bottom - top + 1;\n var primary = head.line == top ? 0 : height - 1;\n var ranges = [];\n for (var i = 0; i < height; i++) {\n ranges.push({\n anchor: Pos(top + i, left),\n head: Pos(top + i, right)\n });\n }\n return {\n ranges: ranges,\n primary: primary\n };\n }\n }\n function getHead(cm) {\n var cur = cm.getCursor('head');\n if (cm.getSelection().length == 1) {\n cur = cursorMin(cur, cm.getCursor('anchor'));\n }\n return cur;\n }\n function exitVisualMode(cm, moveHead) {\n var vim = cm.state.vim;\n if (moveHead !== false) {\n cm.setCursor(clipCursorToContent(cm, vim.sel.head));\n }\n updateLastSelection(cm, vim);\n vim.visualMode = false;\n vim.visualLine = false;\n vim.visualBlock = false;\n CodeMirror.signal(cm, \"vim-mode-change\", {mode: \"normal\"});\n if (vim.fakeCursor) {\n vim.fakeCursor.clear();\n }\n }\n function clipToLine(cm, curStart, curEnd) {\n var selection = cm.getRange(curStart, curEnd);\n if (/\\n\\s*$/.test(selection)) {\n var lines = selection.split('\\n');\n lines.pop();\n var line;\n for (var line = lines.pop(); lines.length > 0 && line && isWhiteSpaceString(line); line = lines.pop()) {\n curEnd.line--;\n curEnd.ch = 0;\n }\n if (line) {\n curEnd.line--;\n curEnd.ch = lineLength(cm, curEnd.line);\n } else {\n curEnd.ch = 0;\n }\n }\n }\n function expandSelectionToLine(_cm, curStart, curEnd) {\n curStart.ch = 0;\n curEnd.ch = 0;\n curEnd.line++;\n }\n\n function findFirstNonWhiteSpaceCharacter(text) {\n if (!text) {\n return 0;\n }\n var firstNonWS = text.search(/\\S/);\n return firstNonWS == -1 ? text.length : firstNonWS;\n }\n\n function expandWordUnderCursor(cm, inclusive, _forward, bigWord, noSymbol) {\n var cur = getHead(cm);\n var line = cm.getLine(cur.line);\n var idx = cur.ch;\n var test = noSymbol ? wordCharTest[0] : bigWordCharTest [0];\n while (!test(line.charAt(idx))) {\n idx++;\n if (idx >= line.length) { return null; }\n }\n\n if (bigWord) {\n test = bigWordCharTest[0];\n } else {\n test = wordCharTest[0];\n if (!test(line.charAt(idx))) {\n test = wordCharTest[1];\n }\n }\n\n var end = idx, start = idx;\n while (test(line.charAt(end)) && end < line.length) { end++; }\n while (test(line.charAt(start)) && start >= 0) { start--; }\n start++;\n\n if (inclusive) {\n var wordEnd = end;\n while (/\\s/.test(line.charAt(end)) && end < line.length) { end++; }\n if (wordEnd == end) {\n var wordStart = start;\n while (/\\s/.test(line.charAt(start - 1)) && start > 0) { start--; }\n if (!start) { start = wordStart; }\n }\n }\n return { start: Pos(cur.line, start), end: Pos(cur.line, end) };\n }\n\n function recordJumpPosition(cm, oldCur, newCur) {\n if (!cursorEqual(oldCur, newCur)) {\n vimGlobalState.jumpList.add(cm, oldCur, newCur);\n }\n }\n\n function recordLastCharacterSearch(increment, args) {\n vimGlobalState.lastChararacterSearch.increment = increment;\n vimGlobalState.lastChararacterSearch.forward = args.forward;\n vimGlobalState.lastChararacterSearch.selectedCharacter = args.selectedCharacter;\n }\n\n var symbolToMode = {\n '(': 'bracket', ')': 'bracket', '{': 'bracket', '}': 'bracket',\n '[': 'section', ']': 'section',\n '*': 'comment', '/': 'comment',\n 'm': 'method', 'M': 'method',\n '#': 'preprocess'\n };\n var findSymbolModes = {\n bracket: {\n isComplete: function(state) {\n if (state.nextCh === state.symb) {\n state.depth++;\n if (state.depth >= 1)return true;\n } else if (state.nextCh === state.reverseSymb) {\n state.depth--;\n }\n return false;\n }\n },\n section: {\n init: function(state) {\n state.curMoveThrough = true;\n state.symb = (state.forward ? ']' : '[') === state.symb ? '{' : '}';\n },\n isComplete: function(state) {\n return state.index === 0 && state.nextCh === state.symb;\n }\n },\n comment: {\n isComplete: function(state) {\n var found = state.lastCh === '*' && state.nextCh === '/';\n state.lastCh = state.nextCh;\n return found;\n }\n },\n method: {\n init: function(state) {\n state.symb = (state.symb === 'm' ? '{' : '}');\n state.reverseSymb = state.symb === '{' ? '}' : '{';\n },\n isComplete: function(state) {\n if (state.nextCh === state.symb)return true;\n return false;\n }\n },\n preprocess: {\n init: function(state) {\n state.index = 0;\n },\n isComplete: function(state) {\n if (state.nextCh === '#') {\n var token = state.lineText.match(/#(\\w+)/)[1];\n if (token === 'endif') {\n if (state.forward && state.depth === 0) {\n return true;\n }\n state.depth++;\n } else if (token === 'if') {\n if (!state.forward && state.depth === 0) {\n return true;\n }\n state.depth--;\n }\n if (token === 'else' && state.depth === 0)return true;\n }\n return false;\n }\n }\n };\n function findSymbol(cm, repeat, forward, symb) {\n var cur = copyCursor(cm.getCursor());\n var increment = forward ? 1 : -1;\n var endLine = forward ? cm.lineCount() : -1;\n var curCh = cur.ch;\n var line = cur.line;\n var lineText = cm.getLine(line);\n var state = {\n lineText: lineText,\n nextCh: lineText.charAt(curCh),\n lastCh: null,\n index: curCh,\n symb: symb,\n reverseSymb: (forward ? { ')': '(', '}': '{' } : { '(': ')', '{': '}' })[symb],\n forward: forward,\n depth: 0,\n curMoveThrough: false\n };\n var mode = symbolToMode[symb];\n if (!mode)return cur;\n var init = findSymbolModes[mode].init;\n var isComplete = findSymbolModes[mode].isComplete;\n if (init) { init(state); }\n while (line !== endLine && repeat) {\n state.index += increment;\n state.nextCh = state.lineText.charAt(state.index);\n if (!state.nextCh) {\n line += increment;\n state.lineText = cm.getLine(line) || '';\n if (increment > 0) {\n state.index = 0;\n } else {\n var lineLen = state.lineText.length;\n state.index = (lineLen > 0) ? (lineLen-1) : 0;\n }\n state.nextCh = state.lineText.charAt(state.index);\n }\n if (isComplete(state)) {\n cur.line = line;\n cur.ch = state.index;\n repeat--;\n }\n }\n if (state.nextCh || state.curMoveThrough) {\n return Pos(line, state.index);\n }\n return cur;\n }\n function findWord(cm, cur, forward, bigWord, emptyLineIsWord) {\n var lineNum = cur.line;\n var pos = cur.ch;\n var line = cm.getLine(lineNum);\n var dir = forward ? 1 : -1;\n var charTests = bigWord ? bigWordCharTest: wordCharTest;\n\n if (emptyLineIsWord && line == '') {\n lineNum += dir;\n line = cm.getLine(lineNum);\n if (!isLine(cm, lineNum)) {\n return null;\n }\n pos = (forward) ? 0 : line.length;\n }\n\n while (true) {\n if (emptyLineIsWord && line == '') {\n return { from: 0, to: 0, line: lineNum };\n }\n var stop = (dir > 0) ? line.length : -1;\n var wordStart = stop, wordEnd = stop;\n while (pos != stop) {\n var foundWord = false;\n for (var i = 0; i < charTests.length && !foundWord; ++i) {\n if (charTests[i](line.charAt(pos))) {\n wordStart = pos;\n while (pos != stop && charTests[i](line.charAt(pos))) {\n pos += dir;\n }\n wordEnd = pos;\n foundWord = wordStart != wordEnd;\n if (wordStart == cur.ch && lineNum == cur.line &&\n wordEnd == wordStart + dir) {\n continue;\n } else {\n return {\n from: Math.min(wordStart, wordEnd + 1),\n to: Math.max(wordStart, wordEnd),\n line: lineNum };\n }\n }\n }\n if (!foundWord) {\n pos += dir;\n }\n }\n lineNum += dir;\n if (!isLine(cm, lineNum)) {\n return null;\n }\n line = cm.getLine(lineNum);\n pos = (dir > 0) ? 0 : line.length;\n }\n throw new Error('The impossible happened.');\n }\n function moveToWord(cm, cur, repeat, forward, wordEnd, bigWord) {\n var curStart = copyCursor(cur);\n var words = [];\n if (forward && !wordEnd || !forward && wordEnd) {\n repeat++;\n }\n var emptyLineIsWord = !(forward && wordEnd);\n for (var i = 0; i < repeat; i++) {\n var word = findWord(cm, cur, forward, bigWord, emptyLineIsWord);\n if (!word) {\n var eodCh = lineLength(cm, cm.lastLine());\n words.push(forward\n ? {line: cm.lastLine(), from: eodCh, to: eodCh}\n : {line: 0, from: 0, to: 0});\n break;\n }\n words.push(word);\n cur = Pos(word.line, forward ? (word.to - 1) : word.from);\n }\n var shortCircuit = words.length != repeat;\n var firstWord = words[0];\n var lastWord = words.pop();\n if (forward && !wordEnd) {\n if (!shortCircuit && (firstWord.from != curStart.ch || firstWord.line != curStart.line)) {\n lastWord = words.pop();\n }\n return Pos(lastWord.line, lastWord.from);\n } else if (forward && wordEnd) {\n return Pos(lastWord.line, lastWord.to - 1);\n } else if (!forward && wordEnd) {\n if (!shortCircuit && (firstWord.to != curStart.ch || firstWord.line != curStart.line)) {\n lastWord = words.pop();\n }\n return Pos(lastWord.line, lastWord.to);\n } else {\n return Pos(lastWord.line, lastWord.from);\n }\n }\n\n function moveToCharacter(cm, repeat, forward, character) {\n var cur = cm.getCursor();\n var start = cur.ch;\n var idx;\n for (var i = 0; i < repeat; i ++) {\n var line = cm.getLine(cur.line);\n idx = charIdxInLine(start, line, character, forward, true);\n if (idx == -1) {\n return null;\n }\n start = idx;\n }\n return Pos(cm.getCursor().line, idx);\n }\n\n function moveToColumn(cm, repeat) {\n var line = cm.getCursor().line;\n return clipCursorToContent(cm, Pos(line, repeat - 1));\n }\n\n function updateMark(cm, vim, markName, pos) {\n if (!inArray(markName, validMarks)) {\n return;\n }\n if (vim.marks[markName]) {\n vim.marks[markName].clear();\n }\n vim.marks[markName] = cm.setBookmark(pos);\n }\n\n function charIdxInLine(start, line, character, forward, includeChar) {\n var idx;\n if (forward) {\n idx = line.indexOf(character, start + 1);\n if (idx != -1 && !includeChar) {\n idx -= 1;\n }\n } else {\n idx = line.lastIndexOf(character, start - 1);\n if (idx != -1 && !includeChar) {\n idx += 1;\n }\n }\n return idx;\n }\n\n function findParagraph(cm, head, repeat, dir, inclusive) {\n var line = head.line;\n var min = cm.firstLine();\n var max = cm.lastLine();\n var start, end, i = line;\n function isEmpty(i) { return !/\\S/.test(cm.getLine(i)); } // ace_patch\n function isBoundary(i, dir, any) {\n if (any) { return isEmpty(i) != isEmpty(i + dir); }\n return !isEmpty(i) && isEmpty(i + dir);\n }\n function skipFold(i) {\n dir = dir > 0 ? 1 : -1;\n var foldLine = cm.ace.session.getFoldLine(i);\n if (foldLine) {\n if (i + dir > foldLine.start.row && i + dir < foldLine.end.row)\n dir = (dir > 0 ? foldLine.end.row : foldLine.start.row) - i;\n }\n }\n if (dir) {\n while (min <= i && i <= max && repeat > 0) {\n skipFold(i);\n if (isBoundary(i, dir)) { repeat--; }\n i += dir;\n }\n return new Pos(i, 0);\n }\n\n var vim = cm.state.vim;\n if (vim.visualLine && isBoundary(line, 1, true)) {\n var anchor = vim.sel.anchor;\n if (isBoundary(anchor.line, -1, true)) {\n if (!inclusive || anchor.line != line) {\n line += 1;\n }\n }\n }\n var startState = isEmpty(line);\n for (i = line; i <= max && repeat; i++) {\n if (isBoundary(i, 1, true)) {\n if (!inclusive || isEmpty(i) != startState) {\n repeat--;\n }\n }\n }\n end = new Pos(i, 0);\n if (i > max && !startState) { startState = true; }\n else { inclusive = false; }\n for (i = line; i > min; i--) {\n if (!inclusive || isEmpty(i) == startState || i == line) {\n if (isBoundary(i, -1, true)) { break; }\n }\n }\n start = new Pos(i, 0);\n return { start: start, end: end };\n }\n function selectCompanionObject(cm, head, symb, inclusive) {\n var cur = head, start, end;\n\n var bracketRegexp = ({\n '(': /[()]/, ')': /[()]/,\n '[': /[[\\]]/, ']': /[[\\]]/,\n '{': /[{}]/, '}': /[{}]/})[symb];\n var openSym = ({\n '(': '(', ')': '(',\n '[': '[', ']': '[',\n '{': '{', '}': '{'})[symb];\n var curChar = cm.getLine(cur.line).charAt(cur.ch);\n var offset = curChar === openSym ? 1 : 0;\n\n start = cm.scanForBracket(Pos(cur.line, cur.ch + offset), -1, null, {'bracketRegex': bracketRegexp});\n end = cm.scanForBracket(Pos(cur.line, cur.ch + offset), 1, null, {'bracketRegex': bracketRegexp});\n\n if (!start || !end) {\n return { start: cur, end: cur };\n }\n\n start = start.pos;\n end = end.pos;\n\n if ((start.line == end.line && start.ch > end.ch)\n || (start.line > end.line)) {\n var tmp = start;\n start = end;\n end = tmp;\n }\n\n if (inclusive) {\n end.ch += 1;\n } else {\n start.ch += 1;\n }\n\n return { start: start, end: end };\n }\n function findBeginningAndEnd(cm, head, symb, inclusive) {\n var cur = copyCursor(head);\n var line = cm.getLine(cur.line);\n var chars = line.split('');\n var start, end, i, len;\n var firstIndex = chars.indexOf(symb);\n if (cur.ch < firstIndex) {\n cur.ch = firstIndex;\n }\n else if (firstIndex < cur.ch && chars[cur.ch] == symb) {\n end = cur.ch; // assign end to the current cursor\n --cur.ch; // make sure to look backwards\n }\n if (chars[cur.ch] == symb && !end) {\n start = cur.ch + 1; // assign start to ahead of the cursor\n } else {\n for (i = cur.ch; i > -1 && !start; i--) {\n if (chars[i] == symb) {\n start = i + 1;\n }\n }\n }\n if (start && !end) {\n for (i = start, len = chars.length; i < len && !end; i++) {\n if (chars[i] == symb) {\n end = i;\n }\n }\n }\n if (!start || !end) {\n return { start: cur, end: cur };\n }\n if (inclusive) {\n --start; ++end;\n }\n\n return {\n start: Pos(cur.line, start),\n end: Pos(cur.line, end)\n };\n }\n defineOption('pcre', true, 'boolean');\n function SearchState() {}\n SearchState.prototype = {\n getQuery: function() {\n return vimGlobalState.query;\n },\n setQuery: function(query) {\n vimGlobalState.query = query;\n },\n getOverlay: function() {\n return this.searchOverlay;\n },\n setOverlay: function(overlay) {\n this.searchOverlay = overlay;\n },\n isReversed: function() {\n return vimGlobalState.isReversed;\n },\n setReversed: function(reversed) {\n vimGlobalState.isReversed = reversed;\n },\n getScrollbarAnnotate: function() {\n return this.annotate;\n },\n setScrollbarAnnotate: function(annotate) {\n this.annotate = annotate;\n }\n };\n function getSearchState(cm) {\n var vim = cm.state.vim;\n return vim.searchState_ || (vim.searchState_ = new SearchState());\n }\n function dialog(cm, template, shortText, onClose, options) {\n if (cm.openDialog) {\n cm.openDialog(template, onClose, { bottom: true, value: options.value,\n onKeyDown: options.onKeyDown, onKeyUp: options.onKeyUp,\n selectValueOnOpen: false});\n }\n else {\n onClose(prompt(shortText, ''));\n }\n }\n function splitBySlash(argString) {\n var slashes = findUnescapedSlashes(argString) || [];\n if (!slashes.length) return [];\n var tokens = [];\n if (slashes[0] !== 0) return;\n for (var i = 0; i < slashes.length; i++) {\n if (typeof slashes[i] == 'number')\n tokens.push(argString.substring(slashes[i] + 1, slashes[i+1]));\n }\n return tokens;\n }\n\n function findUnescapedSlashes(str) {\n var escapeNextChar = false;\n var slashes = [];\n for (var i = 0; i < str.length; i++) {\n var c = str.charAt(i);\n if (!escapeNextChar && c == '/') {\n slashes.push(i);\n }\n escapeNextChar = !escapeNextChar && (c == '\\\\');\n }\n return slashes;\n }\n function translateRegex(str) {\n var specials = '|(){';\n var unescape = '}';\n var escapeNextChar = false;\n var out = [];\n for (var i = -1; i < str.length; i++) {\n var c = str.charAt(i) || '';\n var n = str.charAt(i+1) || '';\n var specialComesNext = (n && specials.indexOf(n) != -1);\n if (escapeNextChar) {\n if (c !== '\\\\' || !specialComesNext) {\n out.push(c);\n }\n escapeNextChar = false;\n } else {\n if (c === '\\\\') {\n escapeNextChar = true;\n if (n && unescape.indexOf(n) != -1) {\n specialComesNext = true;\n }\n if (!specialComesNext || n === '\\\\') {\n out.push(c);\n }\n } else {\n out.push(c);\n if (specialComesNext && n !== '\\\\') {\n out.push('\\\\');\n }\n }\n }\n }\n return out.join('');\n }\n var charUnescapes = {'\\\\n': '\\n', '\\\\r': '\\r', '\\\\t': '\\t'};\n function translateRegexReplace(str) {\n var escapeNextChar = false;\n var out = [];\n for (var i = -1; i < str.length; i++) {\n var c = str.charAt(i) || '';\n var n = str.charAt(i+1) || '';\n if (charUnescapes[c + n]) {\n out.push(charUnescapes[c+n]);\n i++;\n } else if (escapeNextChar) {\n out.push(c);\n escapeNextChar = false;\n } else {\n if (c === '\\\\') {\n escapeNextChar = true;\n if ((isNumber(n) || n === '$')) {\n out.push('$');\n } else if (n !== '/' && n !== '\\\\') {\n out.push('\\\\');\n }\n } else {\n if (c === '$') {\n out.push('$');\n }\n out.push(c);\n if (n === '/') {\n out.push('\\\\');\n }\n }\n }\n }\n return out.join('');\n }\n var unescapes = {'\\\\/': '/', '\\\\\\\\': '\\\\', '\\\\n': '\\n', '\\\\r': '\\r', '\\\\t': '\\t'};\n function unescapeRegexReplace(str) {\n var stream = new CodeMirror.StringStream(str);\n var output = [];\n while (!stream.eol()) {\n while (stream.peek() && stream.peek() != '\\\\') {\n output.push(stream.next());\n }\n var matched = false;\n for (var matcher in unescapes) {\n if (stream.match(matcher, true)) {\n matched = true;\n output.push(unescapes[matcher]);\n break;\n }\n }\n if (!matched) {\n output.push(stream.next());\n }\n }\n return output.join('');\n }\n function parseQuery(query, ignoreCase, smartCase) {\n var lastSearchRegister = vimGlobalState.registerController.getRegister('/');\n lastSearchRegister.setText(query);\n if (query instanceof RegExp) { return query; }\n var slashes = findUnescapedSlashes(query);\n var regexPart;\n var forceIgnoreCase;\n if (!slashes.length) {\n regexPart = query;\n } else {\n regexPart = query.substring(0, slashes[0]);\n var flagsPart = query.substring(slashes[0]);\n forceIgnoreCase = (flagsPart.indexOf('i') != -1);\n }\n if (!regexPart) {\n return null;\n }\n if (!getOption('pcre')) {\n regexPart = translateRegex(regexPart);\n }\n if (smartCase) {\n ignoreCase = (/^[^A-Z]*$/).test(regexPart);\n }\n var regexp = new RegExp(regexPart,\n (ignoreCase || forceIgnoreCase) ? 'i' : undefined);\n return regexp;\n }\n function showConfirm(cm, text) {\n if (cm.openNotification) {\n cm.openNotification('<span style=\"color: red\">' + text + '</span>',\n {bottom: true, duration: 5000});\n } else {\n alert(text);\n }\n }\n function makePrompt(prefix, desc) {\n var raw = '';\n if (prefix) {\n raw += '<span style=\"font-family: monospace\">' + prefix + '</span>';\n }\n raw += '<input type=\"text\"/> ' +\n '<span style=\"color: #888\">';\n if (desc) {\n raw += '<span style=\"color: #888\">';\n raw += desc;\n raw += '</span>';\n }\n return raw;\n }\n var searchPromptDesc = '(Javascript regexp)';\n function showPrompt(cm, options) {\n var shortText = (options.prefix || '') + ' ' + (options.desc || '');\n var prompt = makePrompt(options.prefix, options.desc);\n dialog(cm, prompt, shortText, options.onClose, options);\n }\n function regexEqual(r1, r2) {\n if (r1 instanceof RegExp && r2 instanceof RegExp) {\n var props = ['global', 'multiline', 'ignoreCase', 'source'];\n for (var i = 0; i < props.length; i++) {\n var prop = props[i];\n if (r1[prop] !== r2[prop]) {\n return false;\n }\n }\n return true;\n }\n return false;\n }\n function updateSearchQuery(cm, rawQuery, ignoreCase, smartCase) {\n if (!rawQuery) {\n return;\n }\n var state = getSearchState(cm);\n var query = parseQuery(rawQuery, !!ignoreCase, !!smartCase);\n if (!query) {\n return;\n }\n highlightSearchMatches(cm, query);\n if (regexEqual(query, state.getQuery())) {\n return query;\n }\n state.setQuery(query);\n return query;\n }\n function searchOverlay(query) {\n if (query.source.charAt(0) == '^') {\n var matchSol = true;\n }\n return {\n token: function(stream) {\n if (matchSol && !stream.sol()) {\n stream.skipToEnd();\n return;\n }\n var match = stream.match(query, false);\n if (match) {\n if (match[0].length == 0) {\n stream.next();\n return 'searching';\n }\n if (!stream.sol()) {\n stream.backUp(1);\n if (!query.exec(stream.next() + match[0])) {\n stream.next();\n return null;\n }\n }\n stream.match(query);\n return 'searching';\n }\n while (!stream.eol()) {\n stream.next();\n if (stream.match(query, false)) break;\n }\n },\n query: query\n };\n }\n function highlightSearchMatches(cm, query) {\n var searchState = getSearchState(cm);\n var overlay = searchState.getOverlay();\n if (!overlay || query != overlay.query) {\n if (overlay) {\n cm.removeOverlay(overlay);\n }\n overlay = searchOverlay(query);\n cm.addOverlay(overlay);\n if (cm.showMatchesOnScrollbar) {\n if (searchState.getScrollbarAnnotate()) {\n searchState.getScrollbarAnnotate().clear();\n }\n searchState.setScrollbarAnnotate(cm.showMatchesOnScrollbar(query));\n }\n searchState.setOverlay(overlay);\n }\n }\n function findNext(cm, prev, query, repeat) {\n if (repeat === undefined) { repeat = 1; }\n return cm.operation(function() {\n var pos = cm.getCursor();\n var cursor = cm.getSearchCursor(query, pos);\n for (var i = 0; i < repeat; i++) {\n var found = cursor.find(prev);\n if (i == 0 && found && cursorEqual(cursor.from(), pos)) { found = cursor.find(prev); }\n if (!found) {\n cursor = cm.getSearchCursor(query,\n (prev) ? Pos(cm.lastLine()) : Pos(cm.firstLine(), 0) );\n if (!cursor.find(prev)) {\n return;\n }\n }\n }\n return cursor.from();\n });\n }\n function clearSearchHighlight(cm) {\n var state = getSearchState(cm);\n cm.removeOverlay(getSearchState(cm).getOverlay());\n state.setOverlay(null);\n if (state.getScrollbarAnnotate()) {\n state.getScrollbarAnnotate().clear();\n state.setScrollbarAnnotate(null);\n }\n }\n function isInRange(pos, start, end) {\n if (typeof pos != 'number') {\n pos = pos.line;\n }\n if (start instanceof Array) {\n return inArray(pos, start);\n } else {\n if (end) {\n return (pos >= start && pos <= end);\n } else {\n return pos == start;\n }\n }\n }\n function getUserVisibleLines(cm) {\n var renderer = cm.ace.renderer;\n return {\n top: renderer.getFirstFullyVisibleRow(),\n bottom: renderer.getLastFullyVisibleRow()\n }\n }\n\n var ExCommandDispatcher = function() {\n this.buildCommandMap_();\n };\n ExCommandDispatcher.prototype = {\n processCommand: function(cm, input, opt_params) {\n var that = this;\n cm.operation(function () {\n cm.curOp.isVimOp = true;\n that._processCommand(cm, input, opt_params);\n });\n },\n _processCommand: function(cm, input, opt_params) {\n var vim = cm.state.vim;\n var commandHistoryRegister = vimGlobalState.registerController.getRegister(':');\n var previousCommand = commandHistoryRegister.toString();\n if (vim.visualMode) {\n exitVisualMode(cm);\n }\n var inputStream = new CodeMirror.StringStream(input);\n commandHistoryRegister.setText(input);\n var params = opt_params || {};\n params.input = input;\n try {\n this.parseInput_(cm, inputStream, params);\n } catch(e) {\n showConfirm(cm, e);\n throw e;\n }\n var command;\n var commandName;\n if (!params.commandName) {\n if (params.line !== undefined) {\n commandName = 'move';\n }\n } else {\n command = this.matchCommand_(params.commandName);\n if (command) {\n commandName = command.name;\n if (command.excludeFromCommandHistory) {\n commandHistoryRegister.setText(previousCommand);\n }\n this.parseCommandArgs_(inputStream, params, command);\n if (command.type == 'exToKey') {\n for (var i = 0; i < command.toKeys.length; i++) {\n CodeMirror.Vim.handleKey(cm, command.toKeys[i], 'mapping');\n }\n return;\n } else if (command.type == 'exToEx') {\n this.processCommand(cm, command.toInput);\n return;\n }\n }\n }\n if (!commandName) {\n showConfirm(cm, 'Not an editor command \":' + input + '\"');\n return;\n }\n try {\n exCommands[commandName](cm, params);\n if ((!command || !command.possiblyAsync) && params.callback) {\n params.callback();\n }\n } catch(e) {\n showConfirm(cm, e);\n throw e;\n }\n },\n parseInput_: function(cm, inputStream, result) {\n inputStream.eatWhile(':');\n if (inputStream.eat('%')) {\n result.line = cm.firstLine();\n result.lineEnd = cm.lastLine();\n } else {\n result.line = this.parseLineSpec_(cm, inputStream);\n if (result.line !== undefined && inputStream.eat(',')) {\n result.lineEnd = this.parseLineSpec_(cm, inputStream);\n }\n }\n var commandMatch = inputStream.match(/^(\\w+)/);\n if (commandMatch) {\n result.commandName = commandMatch[1];\n } else {\n result.commandName = inputStream.match(/.*/)[0];\n }\n\n return result;\n },\n parseLineSpec_: function(cm, inputStream) {\n var numberMatch = inputStream.match(/^(\\d+)/);\n if (numberMatch) {\n return parseInt(numberMatch[1], 10) - 1;\n }\n switch (inputStream.next()) {\n case '.':\n return cm.getCursor().line;\n case '$':\n return cm.lastLine();\n case '\\'':\n var mark = cm.state.vim.marks[inputStream.next()];\n if (mark && mark.find()) {\n return mark.find().line;\n }\n throw new Error('Mark not set');\n default:\n inputStream.backUp(1);\n return undefined;\n }\n },\n parseCommandArgs_: function(inputStream, params, command) {\n if (inputStream.eol()) {\n return;\n }\n params.argString = inputStream.match(/.*/)[0];\n var delim = command.argDelimiter || /\\s+/;\n var args = trim(params.argString).split(delim);\n if (args.length && args[0]) {\n params.args = args;\n }\n },\n matchCommand_: function(commandName) {\n for (var i = commandName.length; i > 0; i--) {\n var prefix = commandName.substring(0, i);\n if (this.commandMap_[prefix]) {\n var command = this.commandMap_[prefix];\n if (command.name.indexOf(commandName) === 0) {\n return command;\n }\n }\n }\n return null;\n },\n buildCommandMap_: function() {\n this.commandMap_ = {};\n for (var i = 0; i < defaultExCommandMap.length; i++) {\n var command = defaultExCommandMap[i];\n var key = command.shortName || command.name;\n this.commandMap_[key] = command;\n }\n },\n map: function(lhs, rhs, ctx) {\n if (lhs != ':' && lhs.charAt(0) == ':') {\n if (ctx) { throw Error('Mode not supported for ex mappings'); }\n var commandName = lhs.substring(1);\n if (rhs != ':' && rhs.charAt(0) == ':') {\n this.commandMap_[commandName] = {\n name: commandName,\n type: 'exToEx',\n toInput: rhs.substring(1),\n user: true\n };\n } else {\n this.commandMap_[commandName] = {\n name: commandName,\n type: 'exToKey',\n toKeys: rhs,\n user: true\n };\n }\n } else {\n if (rhs != ':' && rhs.charAt(0) == ':') {\n var mapping = {\n keys: lhs,\n type: 'keyToEx',\n exArgs: { input: rhs.substring(1) },\n user: true};\n if (ctx) { mapping.context = ctx; }\n defaultKeymap.unshift(mapping);\n } else {\n var mapping = {\n keys: lhs,\n type: 'keyToKey',\n toKeys: rhs,\n user: true\n };\n if (ctx) { mapping.context = ctx; }\n defaultKeymap.unshift(mapping);\n }\n }\n },\n unmap: function(lhs, ctx) {\n if (lhs != ':' && lhs.charAt(0) == ':') {\n if (ctx) { throw Error('Mode not supported for ex mappings'); }\n var commandName = lhs.substring(1);\n if (this.commandMap_[commandName] && this.commandMap_[commandName].user) {\n delete this.commandMap_[commandName];\n return;\n }\n } else {\n var keys = lhs;\n for (var i = 0; i < defaultKeymap.length; i++) {\n if (keys == defaultKeymap[i].keys\n && defaultKeymap[i].context === ctx\n && defaultKeymap[i].user) {\n defaultKeymap.splice(i, 1);\n return;\n }\n }\n }\n }\n };\n\n var exCommands = {\n colorscheme: function(cm, params) {\n if (!params.args || params.args.length < 1) {\n showConfirm(cm, cm.getOption('theme'));\n return;\n }\n cm.setOption('theme', params.args[0]);\n },\n map: function(cm, params, ctx) {\n var mapArgs = params.args;\n if (!mapArgs || mapArgs.length < 2) {\n if (cm) {\n showConfirm(cm, 'Invalid mapping: ' + params.input);\n }\n return;\n }\n exCommandDispatcher.map(mapArgs[0], mapArgs[1], ctx);\n },\n imap: function(cm, params) { this.map(cm, params, 'insert'); },\n nmap: function(cm, params) { this.map(cm, params, 'normal'); },\n vmap: function(cm, params) { this.map(cm, params, 'visual'); },\n unmap: function(cm, params, ctx) {\n var mapArgs = params.args;\n if (!mapArgs || mapArgs.length < 1) {\n if (cm) {\n showConfirm(cm, 'No such mapping: ' + params.input);\n }\n return;\n }\n exCommandDispatcher.unmap(mapArgs[0], ctx);\n },\n move: function(cm, params) {\n commandDispatcher.processCommand(cm, cm.state.vim, {\n type: 'motion',\n motion: 'moveToLineOrEdgeOfDocument',\n motionArgs: { forward: false, explicitRepeat: true,\n linewise: true },\n repeatOverride: params.line+1});\n },\n set: function(cm, params) {\n var setArgs = params.args;\n var setCfg = params.setCfg || {};\n if (!setArgs || setArgs.length < 1) {\n if (cm) {\n showConfirm(cm, 'Invalid mapping: ' + params.input);\n }\n return;\n }\n var expr = setArgs[0].split('=');\n var optionName = expr[0];\n var value = expr[1];\n var forceGet = false;\n\n if (optionName.charAt(optionName.length - 1) == '?') {\n if (value) { throw Error('Trailing characters: ' + params.argString); }\n optionName = optionName.substring(0, optionName.length - 1);\n forceGet = true;\n }\n if (value === undefined && optionName.substring(0, 2) == 'no') {\n optionName = optionName.substring(2);\n value = false;\n }\n\n var optionIsBoolean = options[optionName] && options[optionName].type == 'boolean';\n if (optionIsBoolean && value == undefined) {\n value = true;\n }\n if (!optionIsBoolean && value === undefined || forceGet) {\n var oldValue = getOption(optionName, cm, setCfg);\n if (oldValue === true || oldValue === false) {\n showConfirm(cm, ' ' + (oldValue ? '' : 'no') + optionName);\n } else {\n showConfirm(cm, ' ' + optionName + '=' + oldValue);\n }\n } else {\n setOption(optionName, value, cm, setCfg);\n }\n },\n setlocal: function (cm, params) {\n params.setCfg = {scope: 'local'};\n this.set(cm, params);\n },\n setglobal: function (cm, params) {\n params.setCfg = {scope: 'global'};\n this.set(cm, params);\n },\n registers: function(cm, params) {\n var regArgs = params.args;\n var registers = vimGlobalState.registerController.registers;\n var regInfo = '----------Registers----------<br><br>';\n if (!regArgs) {\n for (var registerName in registers) {\n var text = registers[registerName].toString();\n if (text.length) {\n regInfo += '\"' + registerName + ' ' + text + '<br>';\n }\n }\n } else {\n var registerName;\n regArgs = regArgs.join('');\n for (var i = 0; i < regArgs.length; i++) {\n registerName = regArgs.charAt(i);\n if (!vimGlobalState.registerController.isValidRegister(registerName)) {\n continue;\n }\n var register = registers[registerName] || new Register();\n regInfo += '\"' + registerName + ' ' + register.toString() + '<br>';\n }\n }\n showConfirm(cm, regInfo);\n },\n sort: function(cm, params) {\n var reverse, ignoreCase, unique, number;\n function parseArgs() {\n if (params.argString) {\n var args = new CodeMirror.StringStream(params.argString);\n if (args.eat('!')) { reverse = true; }\n if (args.eol()) { return; }\n if (!args.eatSpace()) { return 'Invalid arguments'; }\n var opts = args.match(/[a-z]+/);\n if (opts) {\n opts = opts[0];\n ignoreCase = opts.indexOf('i') != -1;\n unique = opts.indexOf('u') != -1;\n var decimal = opts.indexOf('d') != -1 && 1;\n var hex = opts.indexOf('x') != -1 && 1;\n var octal = opts.indexOf('o') != -1 && 1;\n if (decimal + hex + octal > 1) { return 'Invalid arguments'; }\n number = decimal && 'decimal' || hex && 'hex' || octal && 'octal';\n }\n if (args.match(/\\/.*\\//)) { return 'patterns not supported'; }\n }\n }\n var err = parseArgs();\n if (err) {\n showConfirm(cm, err + ': ' + params.argString);\n return;\n }\n var lineStart = params.line || cm.firstLine();\n var lineEnd = params.lineEnd || params.line || cm.lastLine();\n if (lineStart == lineEnd) { return; }\n var curStart = Pos(lineStart, 0);\n var curEnd = Pos(lineEnd, lineLength(cm, lineEnd));\n var text = cm.getRange(curStart, curEnd).split('\\n');\n var numberRegex = (number == 'decimal') ? /(-?)([\\d]+)/ :\n (number == 'hex') ? /(-?)(?:0x)?([0-9a-f]+)/i :\n (number == 'octal') ? /([0-7]+)/ : null;\n var radix = (number == 'decimal') ? 10 : (number == 'hex') ? 16 : (number == 'octal') ? 8 : null;\n var numPart = [], textPart = [];\n if (number) {\n for (var i = 0; i < text.length; i++) {\n if (numberRegex.exec(text[i])) {\n numPart.push(text[i]);\n } else {\n textPart.push(text[i]);\n }\n }\n } else {\n textPart = text;\n }\n function compareFn(a, b) {\n if (reverse) { var tmp; tmp = a; a = b; b = tmp; }\n if (ignoreCase) { a = a.toLowerCase(); b = b.toLowerCase(); }\n var anum = number && numberRegex.exec(a);\n var bnum = number && numberRegex.exec(b);\n if (!anum) { return a < b ? -1 : 1; }\n anum = parseInt((anum[1] + anum[2]).toLowerCase(), radix);\n bnum = parseInt((bnum[1] + bnum[2]).toLowerCase(), radix);\n return anum - bnum;\n }\n numPart.sort(compareFn);\n textPart.sort(compareFn);\n text = (!reverse) ? textPart.concat(numPart) : numPart.concat(textPart);\n if (unique) { // Remove duplicate lines\n var textOld = text;\n var lastLine;\n text = [];\n for (var i = 0; i < textOld.length; i++) {\n if (textOld[i] != lastLine) {\n text.push(textOld[i]);\n }\n lastLine = textOld[i];\n }\n }\n cm.replaceRange(text.join('\\n'), curStart, curEnd);\n },\n global: function(cm, params) {\n var argString = params.argString;\n if (!argString) {\n showConfirm(cm, 'Regular Expression missing from global');\n return;\n }\n var lineStart = (params.line !== undefined) ? params.line : cm.firstLine();\n var lineEnd = params.lineEnd || params.line || cm.lastLine();\n var tokens = splitBySlash(argString);\n var regexPart = argString, cmd;\n if (tokens.length) {\n regexPart = tokens[0];\n cmd = tokens.slice(1, tokens.length).join('/');\n }\n if (regexPart) {\n try {\n updateSearchQuery(cm, regexPart, true /** ignoreCase */,\n true /** smartCase */);\n } catch (e) {\n showConfirm(cm, 'Invalid regex: ' + regexPart);\n return;\n }\n }\n var query = getSearchState(cm).getQuery();\n var matchedLines = [], content = '';\n for (var i = lineStart; i <= lineEnd; i++) {\n var matched = query.test(cm.getLine(i));\n if (matched) {\n matchedLines.push(i+1);\n content+= cm.getLine(i) + '<br>';\n }\n }\n if (!cmd) {\n showConfirm(cm, content);\n return;\n }\n var index = 0;\n var nextCommand = function() {\n if (index < matchedLines.length) {\n var command = matchedLines[index] + cmd;\n exCommandDispatcher.processCommand(cm, command, {\n callback: nextCommand\n });\n }\n index++;\n };\n nextCommand();\n },\n substitute: function(cm, params) {\n if (!cm.getSearchCursor) {\n throw new Error('Search feature not available. Requires searchcursor.js or ' +\n 'any other getSearchCursor implementation.');\n }\n var argString = params.argString;\n var tokens = argString ? splitBySlash(argString) : [];\n var regexPart, replacePart = '', trailing, flagsPart, count;\n var confirm = false; // Whether to confirm each replace.\n var global = false; // True to replace all instances on a line, false to replace only 1.\n if (tokens.length) {\n regexPart = tokens[0];\n replacePart = tokens[1];\n if (replacePart !== undefined) {\n if (getOption('pcre')) {\n replacePart = unescapeRegexReplace(replacePart);\n } else {\n replacePart = translateRegexReplace(replacePart);\n }\n vimGlobalState.lastSubstituteReplacePart = replacePart;\n }\n trailing = tokens[2] ? tokens[2].split(' ') : [];\n } else {\n if (argString && argString.length) {\n showConfirm(cm, 'Substitutions should be of the form ' +\n ':s/pattern/replace/');\n return;\n }\n }\n if (trailing) {\n flagsPart = trailing[0];\n count = parseInt(trailing[1]);\n if (flagsPart) {\n if (flagsPart.indexOf('c') != -1) {\n confirm = true;\n flagsPart.replace('c', '');\n }\n if (flagsPart.indexOf('g') != -1) {\n global = true;\n flagsPart.replace('g', '');\n }\n regexPart = regexPart + '/' + flagsPart;\n }\n }\n if (regexPart) {\n try {\n updateSearchQuery(cm, regexPart, true /** ignoreCase */,\n true /** smartCase */);\n } catch (e) {\n showConfirm(cm, 'Invalid regex: ' + regexPart);\n return;\n }\n }\n replacePart = replacePart || vimGlobalState.lastSubstituteReplacePart;\n if (replacePart === undefined) {\n showConfirm(cm, 'No previous substitute regular expression');\n return;\n }\n var state = getSearchState(cm);\n var query = state.getQuery();\n var lineStart = (params.line !== undefined) ? params.line : cm.getCursor().line;\n var lineEnd = params.lineEnd || lineStart;\n if (lineStart == cm.firstLine() && lineEnd == cm.lastLine()) {\n lineEnd = Infinity;\n }\n if (count) {\n lineStart = lineEnd;\n lineEnd = lineStart + count - 1;\n }\n var startPos = clipCursorToContent(cm, Pos(lineStart, 0));\n var cursor = cm.getSearchCursor(query, startPos);\n doReplace(cm, confirm, global, lineStart, lineEnd, cursor, query, replacePart, params.callback);\n },\n redo: CodeMirror.commands.redo,\n undo: CodeMirror.commands.undo,\n write: function(cm) {\n if (CodeMirror.commands.save) {\n CodeMirror.commands.save(cm);\n } else {\n cm.save();\n }\n },\n nohlsearch: function(cm) {\n clearSearchHighlight(cm);\n },\n delmarks: function(cm, params) {\n if (!params.argString || !trim(params.argString)) {\n showConfirm(cm, 'Argument acequired');\n return;\n }\n\n var state = cm.state.vim;\n var stream = new CodeMirror.StringStream(trim(params.argString));\n while (!stream.eol()) {\n stream.eatSpace();\n var count = stream.pos;\n\n if (!stream.match(/[a-zA-Z]/, false)) {\n showConfirm(cm, 'Invalid argument: ' + params.argString.substring(count));\n return;\n }\n\n var sym = stream.next();\n if (stream.match('-', true)) {\n if (!stream.match(/[a-zA-Z]/, false)) {\n showConfirm(cm, 'Invalid argument: ' + params.argString.substring(count));\n return;\n }\n\n var startMark = sym;\n var finishMark = stream.next();\n if (isLowerCase(startMark) && isLowerCase(finishMark) ||\n isUpperCase(startMark) && isUpperCase(finishMark)) {\n var start = startMark.charCodeAt(0);\n var finish = finishMark.charCodeAt(0);\n if (start >= finish) {\n showConfirm(cm, 'Invalid argument: ' + params.argString.substring(count));\n return;\n }\n for (var j = 0; j <= finish - start; j++) {\n var mark = String.fromCharCode(start + j);\n delete state.marks[mark];\n }\n } else {\n showConfirm(cm, 'Invalid argument: ' + startMark + '-');\n return;\n }\n } else {\n delete state.marks[sym];\n }\n }\n }\n };\n\n var exCommandDispatcher = new ExCommandDispatcher();\n function doReplace(cm, confirm, global, lineStart, lineEnd, searchCursor, query,\n replaceWith, callback) {\n cm.state.vim.exMode = true;\n var done = false;\n var lastPos = searchCursor.from();\n function replaceAll() {\n cm.operation(function() {\n while (!done) {\n replace();\n next();\n }\n stop();\n });\n }\n function replace() {\n var text = cm.getRange(searchCursor.from(), searchCursor.to());\n var newText = text.replace(query, replaceWith);\n searchCursor.replace(newText);\n }\n function next() {\n while(searchCursor.findNext() &&\n isInRange(searchCursor.from(), lineStart, lineEnd)) {\n if (!global && lastPos && searchCursor.from().line == lastPos.line) {\n continue;\n }\n cm.scrollIntoView(searchCursor.from(), 30);\n cm.setSelection(searchCursor.from(), searchCursor.to());\n lastPos = searchCursor.from();\n done = false;\n return;\n }\n done = true;\n }\n function stop(close) {\n if (close) { close(); }\n cm.focus();\n if (lastPos) {\n cm.setCursor(lastPos);\n var vim = cm.state.vim;\n vim.exMode = false;\n vim.lastHPos = vim.lastHSPos = lastPos.ch;\n }\n if (callback) { callback(); }\n }\n function onPromptKeyDown(e, _value, close) {\n CodeMirror.e_stop(e);\n var keyName = CodeMirror.keyName(e);\n switch (keyName) {\n case 'Y':\n replace(); next(); break;\n case 'N':\n next(); break;\n case 'A':\n var savedCallback = callback;\n callback = undefined;\n cm.operation(replaceAll);\n callback = savedCallback;\n break;\n case 'L':\n replace();\n case 'Q':\n case 'Esc':\n case 'Ctrl-C':\n case 'Ctrl-[':\n stop(close);\n break;\n }\n if (done) { stop(close); }\n return true;\n }\n next();\n if (done) {\n showConfirm(cm, 'No matches for ' + query.source);\n return;\n }\n if (!confirm) {\n replaceAll();\n if (callback) { callback(); }\n return;\n }\n showPrompt(cm, {\n prefix: 'replace with <strong>' + replaceWith + '</strong> (y/n/a/q/l)',\n onKeyDown: onPromptKeyDown\n });\n }\n\n CodeMirror.keyMap.vim = {\n attach: attachVimMap,\n detach: detachVimMap,\n call: cmKey\n };\n\n function exitInsertMode(cm) {\n var vim = cm.state.vim;\n var macroModeState = vimGlobalState.macroModeState;\n var insertModeChangeRegister = vimGlobalState.registerController.getRegister('.');\n var isPlaying = macroModeState.isPlaying;\n var lastChange = macroModeState.lastInsertModeChanges;\n var text = [];\n if (!isPlaying) {\n var selLength = lastChange.inVisualBlock ? vim.lastSelection.visualBlock.height : 1;\n var changes = lastChange.changes;\n var text = [];\n var i = 0;\n while (i < changes.length) {\n text.push(changes[i]);\n if (changes[i] instanceof InsertModeKey) {\n i++;\n } else {\n i+= selLength;\n }\n }\n lastChange.changes = text;\n cm.off('change', onChange);\n CodeMirror.off(cm.getInputField(), 'keydown', onKeyEventTargetKeyDown);\n }\n if (!isPlaying && vim.insertModeRepeat > 1) {\n repeatLastEdit(cm, vim, vim.insertModeRepeat - 1,\n true /** repeatForInsert */);\n vim.lastEditInputState.repeatOverride = vim.insertModeRepeat;\n }\n delete vim.insertModeRepeat;\n vim.insertMode = false;\n cm.setCursor(cm.getCursor().line, cm.getCursor().ch-1);\n cm.setOption('keyMap', 'vim');\n cm.setOption('disableInput', true);\n\n lastChange.overwrite = cm.state.overwrite;\n cm.toggleOverwrite(false); // exit replace mode if we were in it.\n insertModeChangeRegister.setText(lastChange.changes.join(''));\n CodeMirror.signal(cm, \"vim-mode-change\", {mode: \"normal\"});\n if (macroModeState.isRecording) {\n logInsertModeChange(macroModeState);\n }\n }\n\n function _mapCommand(command) {\n defaultKeymap.unshift(command);\n }\n\n function mapCommand(keys, type, name, args, extra) {\n var command = {keys: keys, type: type};\n command[type] = name;\n command[type + \"Args\"] = args;\n for (var key in extra)\n command[key] = extra[key];\n _mapCommand(command);\n }\n defineOption('insertModeEscKeysTimeout', 200, 'number');\n\n CodeMirror.keyMap['vim-insert'] = {\n 'Ctrl-N': 'autocomplete',\n 'Ctrl-P': 'autocomplete',\n 'Enter': function(cm) {\n var fn = CodeMirror.commands.newlineAndIndentContinueComment ||\n CodeMirror.commands.newlineAndIndent;\n fn(cm);\n },\n fallthrough: ['default'],\n attach: attachVimMap,\n detach: detachVimMap,\n call: cmKey\n };\n\n CodeMirror.keyMap['vim-replace'] = {\n 'Backspace': 'goCharLeft',\n fallthrough: ['vim-insert'],\n attach: attachVimMap,\n detach: detachVimMap,\n call: cmKey\n };\n\n function executeMacroRegister(cm, vim, macroModeState, registerName) {\n var register = vimGlobalState.registerController.getRegister(registerName);\n if (registerName == ':') {\n if (register.keyBuffer[0]) {\n exCommandDispatcher.processCommand(cm, register.keyBuffer[0]);\n }\n macroModeState.isPlaying = false;\n return;\n }\n var keyBuffer = register.keyBuffer;\n var imc = 0;\n macroModeState.isPlaying = true;\n macroModeState.replaySearchQueries = register.searchQueries.slice(0);\n for (var i = 0; i < keyBuffer.length; i++) {\n var text = keyBuffer[i];\n var match, key;\n while (text) {\n match = (/<\\w+-.+?>|<\\w+>|./).exec(text);\n key = match[0];\n text = text.substring(match.index + key.length);\n CodeMirror.Vim.handleKey(cm, key, 'macro');\n if (vim.insertMode) {\n var changes = register.insertModeChanges[imc++].changes;\n vimGlobalState.macroModeState.lastInsertModeChanges.changes =\n changes;\n repeatInsertModeChanges(cm, changes, 1);\n exitInsertMode(cm);\n }\n }\n }\n macroModeState.isPlaying = false;\n }\n\n function logKey(macroModeState, key) {\n if (macroModeState.isPlaying) { return; }\n var registerName = macroModeState.latestRegister;\n var register = vimGlobalState.registerController.getRegister(registerName);\n if (register) {\n register.pushText(key);\n }\n }\n\n function logInsertModeChange(macroModeState) {\n if (macroModeState.isPlaying) { return; }\n var registerName = macroModeState.latestRegister;\n var register = vimGlobalState.registerController.getRegister(registerName);\n if (register && register.pushInsertModeChanges) {\n register.pushInsertModeChanges(macroModeState.lastInsertModeChanges);\n }\n }\n\n function logSearchQuery(macroModeState, query) {\n if (macroModeState.isPlaying) { return; }\n var registerName = macroModeState.latestRegister;\n var register = vimGlobalState.registerController.getRegister(registerName);\n if (register && register.pushSearchQuery) {\n register.pushSearchQuery(query);\n }\n }\n function onChange(_cm, changeObj) {\n var macroModeState = vimGlobalState.macroModeState;\n var lastChange = macroModeState.lastInsertModeChanges;\n if (!macroModeState.isPlaying) {\n while(changeObj) {\n lastChange.expectCursorActivityForChange = true;\n if (changeObj.origin == '+input' || changeObj.origin == 'paste'\n || changeObj.origin === undefined /* only in testing */) {\n var text = changeObj.text.join('\\n');\n if (lastChange.maybeReset) {\n lastChange.changes = [];\n lastChange.maybeReset = false;\n }\n lastChange.changes.push(text);\n }\n changeObj = changeObj.next;\n }\n }\n }\n function onCursorActivity(cm) {\n var vim = cm.state.vim;\n if (vim.insertMode) {\n var macroModeState = vimGlobalState.macroModeState;\n if (macroModeState.isPlaying) { return; }\n var lastChange = macroModeState.lastInsertModeChanges;\n if (lastChange.expectCursorActivityForChange) {\n lastChange.expectCursorActivityForChange = false;\n } else {\n lastChange.maybeReset = true;\n }\n } else if (!cm.curOp.isVimOp) {\n handleExternalSelection(cm, vim);\n }\n if (vim.visualMode) {\n updateFakeCursor(cm);\n }\n }\n function updateFakeCursor(cm) {\n var vim = cm.state.vim;\n var from = clipCursorToContent(cm, copyCursor(vim.sel.head));\n var to = offsetCursor(from, 0, 1);\n if (vim.fakeCursor) {\n vim.fakeCursor.clear();\n }\n vim.fakeCursor = cm.markText(from, to, {className: 'cm-animate-fat-cursor'});\n }\n function handleExternalSelection(cm, vim) {\n var anchor = cm.getCursor('anchor');\n var head = cm.getCursor('head');\n if (vim.visualMode && !cm.somethingSelected()) {\n exitVisualMode(cm, false);\n } else if (!vim.visualMode && !vim.insertMode && cm.somethingSelected()) {\n vim.visualMode = true;\n vim.visualLine = false;\n CodeMirror.signal(cm, \"vim-mode-change\", {mode: \"visual\"});\n }\n if (vim.visualMode) {\n var headOffset = !cursorIsBefore(head, anchor) ? -1 : 0;\n var anchorOffset = cursorIsBefore(head, anchor) ? -1 : 0;\n head = offsetCursor(head, 0, headOffset);\n anchor = offsetCursor(anchor, 0, anchorOffset);\n vim.sel = {\n anchor: anchor,\n head: head\n };\n updateMark(cm, vim, '<', cursorMin(head, anchor));\n updateMark(cm, vim, '>', cursorMax(head, anchor));\n } else if (!vim.insertMode) {\n vim.lastHPos = cm.getCursor().ch;\n }\n }\n function InsertModeKey(keyName) {\n this.keyName = keyName;\n }\n function onKeyEventTargetKeyDown(e) {\n var macroModeState = vimGlobalState.macroModeState;\n var lastChange = macroModeState.lastInsertModeChanges;\n var keyName = CodeMirror.keyName(e);\n if (!keyName) { return; }\n function onKeyFound() {\n if (lastChange.maybeReset) {\n lastChange.changes = [];\n lastChange.maybeReset = false;\n }\n lastChange.changes.push(new InsertModeKey(keyName));\n return true;\n }\n if (keyName.indexOf('Delete') != -1 || keyName.indexOf('Backspace') != -1) {\n CodeMirror.lookupKey(keyName, 'vim-insert', onKeyFound);\n }\n }\n function repeatLastEdit(cm, vim, repeat, repeatForInsert) {\n var macroModeState = vimGlobalState.macroModeState;\n macroModeState.isPlaying = true;\n var isAction = !!vim.lastEditActionCommand;\n var cachedInputState = vim.inputState;\n function repeatCommand() {\n if (isAction) {\n commandDispatcher.processAction(cm, vim, vim.lastEditActionCommand);\n } else {\n commandDispatcher.evalInput(cm, vim);\n }\n }\n function repeatInsert(repeat) {\n if (macroModeState.lastInsertModeChanges.changes.length > 0) {\n repeat = !vim.lastEditActionCommand ? 1 : repeat;\n var changeObject = macroModeState.lastInsertModeChanges;\n repeatInsertModeChanges(cm, changeObject.changes, repeat, changeObject.overwrite);\n }\n }\n vim.inputState = vim.lastEditInputState;\n if (isAction && vim.lastEditActionCommand.interlaceInsertRepeat) {\n for (var i = 0; i < repeat; i++) {\n repeatCommand();\n repeatInsert(1);\n }\n } else {\n if (!repeatForInsert) {\n repeatCommand();\n }\n repeatInsert(repeat);\n }\n vim.inputState = cachedInputState;\n if (vim.insertMode && !repeatForInsert) {\n exitInsertMode(cm);\n }\n macroModeState.isPlaying = false;\n }\n\n function repeatInsertModeChanges(cm, changes, repeat, overwrite) {\n function keyHandler(binding) {\n if (typeof binding == 'string') {\n CodeMirror.commands[binding](cm);\n } else {\n binding(cm);\n }\n return true;\n }\n var head = cm.getCursor('head');\n var inVisualBlock = vimGlobalState.macroModeState.lastInsertModeChanges.inVisualBlock;\n if (inVisualBlock) {\n var vim = cm.state.vim;\n var lastSel = vim.lastSelection;\n var offset = getOffset(lastSel.anchor, lastSel.head);\n selectForInsert(cm, head, offset.line + 1);\n repeat = cm.listSelections().length;\n cm.setCursor(head);\n }\n for (var i = 0; i < repeat; i++) {\n if (inVisualBlock) {\n cm.setCursor(offsetCursor(head, i, 0));\n }\n for (var j = 0; j < changes.length; j++) {\n var change = changes[j];\n if (change instanceof InsertModeKey) {\n CodeMirror.lookupKey(change.keyName, 'vim-insert', keyHandler);\n } else {\n var cur = cm.getCursor();\n var end = cur;\n if (overwrite && !/\\n/.test(change)) {\n end = offsetCursor(cur, 0, change.length);\n }\n cm.replaceRange(change, cur, end);\n }\n }\n }\n if (inVisualBlock) {\n cm.setCursor(offsetCursor(head, 0, 1));\n }\n }\n\n resetVimGlobalState();\n CodeMirror.Vim = Vim();\n\n Vim = CodeMirror.Vim;\n\n var specialKey = {'return':'CR',backspace:'BS','delete':'Del',esc:'Esc',\n left:'Left',right:'Right',up:'Up',down:'Down',space: 'Space',\n home:'Home',end:'End',pageup:'PageUp',pagedown:'PageDown', enter: 'CR'\n };\n function lookupKey(hashId, key, e) {\n if (key.length > 1 && key[0] == \"n\") {\n key = key.replace(\"numpad\", \"\");\n }\n key = specialKey[key] || key;\n var name = '';\n if (e.ctrlKey) { name += 'C-'; }\n if (e.altKey) { name += 'A-'; }\n if (e.shiftKey) { name += 'S-'; }\n\n name += key;\n if (name.length > 1) { name = '<' + name + '>'; }\n return name;\n }\n var handleKey = Vim.handleKey.bind(Vim);\n Vim.handleKey = function(cm, key, origin) {\n return cm.operation(function() {\n return handleKey(cm, key, origin);\n }, true);\n }\n function cloneVimState(state) {\n var n = new state.constructor();\n Object.keys(state).forEach(function(key) {\n var o = state[key];\n if (Array.isArray(o))\n o = o.slice();\n else if (o && typeof o == \"object\" && o.constructor != Object)\n o = cloneVimState(o);\n n[key] = o;\n });\n if (state.sel) {\n n.sel = {\n head: state.sel.head && copyCursor(state.sel.head),\n anchor: state.sel.anchor && copyCursor(state.sel.anchor)\n };\n }\n return n;\n }\n function multiSelectHandleKey(cm, key, origin) {\n var isHandled = false;\n var vim = Vim.maybeInitVimState_(cm);\n var visualBlock = vim.visualBlock || vim.wasInVisualBlock;\n if (vim.wasInVisualBlock && !cm.ace.inMultiSelectMode) {\n vim.wasInVisualBlock = false;\n } else if (cm.ace.inMultiSelectMode && vim.visualBlock) {\n vim.wasInVisualBlock = true;\n }\n \n if (key == '<Esc>' && !vim.insertMode && !vim.visualMode && cm.ace.inMultiSelectMode) {\n cm.ace.exitMultiSelectMode();\n } else if (visualBlock || !cm.ace.inMultiSelectMode || cm.ace.inVirtualSelectionMode) {\n isHandled = Vim.handleKey(cm, key, origin);\n } else {\n var old = cloneVimState(vim);\n cm.operation(function() {\n cm.ace.forEachSelection(function() {\n var sel = cm.ace.selection;\n cm.state.vim.lastHPos = sel.$desiredColumn == null ? sel.lead.column : sel.$desiredColumn;\n var head = cm.getCursor(\"head\");\n var anchor = cm.getCursor(\"anchor\");\n var headOffset = !cursorIsBefore(head, anchor) ? -1 : 0;\n var anchorOffset = cursorIsBefore(head, anchor) ? -1 : 0;\n head = offsetCursor(head, 0, headOffset);\n anchor = offsetCursor(anchor, 0, anchorOffset);\n cm.state.vim.sel.head = head;\n cm.state.vim.sel.anchor = anchor;\n \n isHandled = handleKey(cm, key, origin);\n sel.$desiredColumn = cm.state.vim.lastHPos == -1 ? null : cm.state.vim.lastHPos;\n if (cm.virtualSelectionMode()) {\n cm.state.vim = cloneVimState(old);\n }\n });\n if (cm.curOp.cursorActivity && !isHandled)\n cm.curOp.cursorActivity = false;\n }, true);\n }\n return isHandled;\n }\n exports.CodeMirror = CodeMirror;\n var getVim = Vim.maybeInitVimState_;\n exports.handler = {\n $id: \"ace/keyboard/vim\",\n drawCursor: function(style, pixelPos, config, sel, session) {\n var vim = this.state.vim || {};\n var w = config.characterWidth;\n var h = config.lineHeight;\n var top = pixelPos.top;\n var left = pixelPos.left;\n if (!vim.insertMode) {\n var isbackwards = !sel.cursor \n ? session.selection.isBackwards() || session.selection.isEmpty()\n : Range.comparePoints(sel.cursor, sel.start) <= 0;\n if (!isbackwards && left > w)\n left -= w;\n } \n if (!vim.insertMode && vim.status) {\n h = h / 2;\n top += h;\n }\n style.left = left + \"px\";\n style.top = top + \"px\";\n style.width = w + \"px\";\n style.height = h + \"px\";\n },\n handleKeyboard: function(data, hashId, key, keyCode, e) {\n var editor = data.editor;\n var cm = editor.state.cm;\n var vim = getVim(cm);\n if (keyCode == -1) return;\n \n if (key == \"c\" && hashId == 1) { // key == \"ctrl-c\"\n if (!useragent.isMac && editor.getCopyText()) {\n editor.once(\"copy\", function() {\n editor.selection.clearSelection();\n });\n return {command: \"null\", passEvent: true};\n }\n } else if (!vim.insertMode) {\n if (useragent.isMac && this.handleMacRepeat(data, hashId, key)) {\n hashId = -1;\n key = data.inputChar;\n }\n }\n \n if (hashId == -1 || hashId & 1 || hashId === 0 && key.length > 1) {\n var insertMode = vim.insertMode;\n var name = lookupKey(hashId, key, e || {});\n if (vim.status == null)\n vim.status = \"\";\n var isHandled = multiSelectHandleKey(cm, name, 'user');\n vim = getVim(cm); // may be changed by multiSelectHandleKey\n if (isHandled && vim.status != null)\n vim.status += name;\n else if (vim.status == null)\n vim.status = \"\";\n cm._signal(\"changeStatus\");\n if (!isHandled && (hashId != -1 || insertMode))\n return;\n return {command: \"null\", passEvent: !isHandled};\n }\n },\n attach: function(editor) {\n if (!editor.state) editor.state = {};\n var cm = new CodeMirror(editor);\n editor.state.cm = cm;\n editor.$vimModeHandler = this;\n CodeMirror.keyMap.vim.attach(cm);\n getVim(cm).status = null;\n cm.on('vim-command-done', function() {\n if (cm.virtualSelectionMode()) return;\n getVim(cm).status = null;\n cm.ace._signal(\"changeStatus\");\n cm.ace.session.markUndoGroup();\n });\n cm.on(\"changeStatus\", function() {\n cm.ace.renderer.updateCursor();\n cm.ace._signal(\"changeStatus\");\n });\n cm.on(\"vim-mode-change\", function() {\n if (cm.virtualSelectionMode()) return;\n cm.ace.renderer.setStyle(\"normal-mode\", !getVim(cm).insertMode);\n cm._signal(\"changeStatus\");\n });\n cm.ace.renderer.setStyle(\"normal-mode\", !getVim(cm).insertMode);\n editor.renderer.$cursorLayer.drawCursor = this.drawCursor.bind(cm);\n this.updateMacCompositionHandlers(editor, true);\n },\n detach: function(editor) {\n var cm = editor.state.cm;\n CodeMirror.keyMap.vim.detach(cm);\n cm.destroy();\n editor.state.cm = null;\n editor.$vimModeHandler = null;\n editor.renderer.$cursorLayer.drawCursor = null;\n editor.renderer.setStyle(\"normal-mode\", false);\n this.updateMacCompositionHandlers(editor, false);\n },\n getStatusText: function(editor) {\n var cm = editor.state.cm;\n var vim = getVim(cm);\n if (vim.insertMode)\n return \"INSERT\";\n var status = \"\";\n if (vim.visualMode) {\n status += \"VISUAL\";\n if (vim.visualLine)\n status += \" LINE\";\n if (vim.visualBlock)\n status += \" BLOCK\";\n }\n if (vim.status)\n status += (status ? \" \" : \"\") + vim.status;\n return status;\n },\n handleMacRepeat: function(data, hashId, key) {\n if (hashId == -1) {\n data.inputChar = key;\n data.lastEvent = \"input\";\n } else if (data.inputChar && data.$lastHash == hashId && data.$lastKey == key) {\n if (data.lastEvent == \"input\") {\n data.lastEvent = \"input1\";\n } else if (data.lastEvent == \"input1\") {\n return true;\n }\n } else {\n data.$lastHash = hashId;\n data.$lastKey = key;\n data.lastEvent = \"keypress\";\n }\n },\n updateMacCompositionHandlers: function(editor, enable) {\n var onCompositionUpdateOverride = function(text) {\n var cm = editor.state.cm;\n var vim = getVim(cm);\n if (!vim.insertMode) {\n var el = this.textInput.getElement();\n el.blur();\n el.focus();\n el.value = text;\n } else {\n this.onCompositionUpdateOrig(text);\n }\n };\n var onCompositionStartOverride = function(text) {\n var cm = editor.state.cm;\n var vim = getVim(cm);\n if (!vim.insertMode) {\n this.onCompositionStartOrig(text);\n }\n };\n if (enable) {\n if (!editor.onCompositionUpdateOrig) {\n editor.onCompositionUpdateOrig = editor.onCompositionUpdate;\n editor.onCompositionUpdate = onCompositionUpdateOverride;\n editor.onCompositionStartOrig = editor.onCompositionStart;\n editor.onCompositionStart = onCompositionStartOverride;\n }\n } else {\n if (editor.onCompositionUpdateOrig) {\n editor.onCompositionUpdate = editor.onCompositionUpdateOrig;\n editor.onCompositionUpdateOrig = null;\n editor.onCompositionStart = editor.onCompositionStartOrig;\n editor.onCompositionStartOrig = null;\n }\n }\n }\n };\n var renderVirtualNumbers = {\n getText: function(session, row) {\n return (Math.abs(session.selection.lead.row - row) || (row + 1 + (row < 9? \"\\xb7\" : \"\" ))) + \"\";\n },\n getWidth: function(session, lastLineNumber, config) {\n return session.getLength().toString().length * config.characterWidth;\n },\n update: function(e, editor) {\n editor.renderer.$loop.schedule(editor.renderer.CHANGE_GUTTER);\n },\n attach: function(editor) {\n editor.renderer.$gutterLayer.$renderer = this;\n editor.on(\"changeSelection\", this.update);\n },\n detach: function(editor) {\n editor.renderer.$gutterLayer.$renderer = null;\n editor.off(\"changeSelection\", this.update);\n }\n };\n Vim.defineOption({\n name: \"wrap\",\n set: function(value, cm) {\n if (cm) {cm.ace.setOption(\"wrap\", value)}\n },\n type: \"boolean\"\n }, false);\n Vim.defineEx('write', 'w', function() {\n console.log(':write is not implemented')\n });\n defaultKeymap.push(\n { keys: 'zc', type: 'action', action: 'fold', actionArgs: { open: false } },\n { keys: 'zC', type: 'action', action: 'fold', actionArgs: { open: false, all: true } },\n { keys: 'zo', type: 'action', action: 'fold', actionArgs: { open: true } },\n { keys: 'zO', type: 'action', action: 'fold', actionArgs: { open: true, all: true } },\n { keys: 'za', type: 'action', action: 'fold', actionArgs: { toggle: true } },\n { keys: 'zA', type: 'action', action: 'fold', actionArgs: { toggle: true, all: true } },\n { keys: 'zf', type: 'action', action: 'fold', actionArgs: { open: true, all: true } },\n { keys: 'zd', type: 'action', action: 'fold', actionArgs: { open: true, all: true } },\n \n { keys: '<C-A-k>', type: 'action', action: 'aceCommand', actionArgs: { name: \"addCursorAbove\" } },\n { keys: '<C-A-j>', type: 'action', action: 'aceCommand', actionArgs: { name: \"addCursorBelow\" } },\n { keys: '<C-A-S-k>', type: 'action', action: 'aceCommand', actionArgs: { name: \"addCursorAboveSkipCurrent\" } },\n { keys: '<C-A-S-j>', type: 'action', action: 'aceCommand', actionArgs: { name: \"addCursorBelowSkipCurrent\" } },\n { keys: '<C-A-h>', type: 'action', action: 'aceCommand', actionArgs: { name: \"selectMoreBefore\" } },\n { keys: '<C-A-l>', type: 'action', action: 'aceCommand', actionArgs: { name: \"selectMoreAfter\" } },\n { keys: '<C-A-S-h>', type: 'action', action: 'aceCommand', actionArgs: { name: \"selectNextBefore\" } },\n { keys: '<C-A-S-l>', type: 'action', action: 'aceCommand', actionArgs: { name: \"selectNextAfter\" } }\n );\n actions.aceCommand = function(cm, actionArgs, vim) {\n cm.vimCmd = actionArgs;\n if (cm.ace.inVirtualSelectionMode)\n cm.ace.on(\"beforeEndOperation\", delayedExecAceCommand);\n else\n delayedExecAceCommand(null, cm.ace);\n };\n function delayedExecAceCommand(op, ace) {\n ace.off(\"beforeEndOperation\", delayedExecAceCommand);\n var cmd = ace.state.cm.vimCmd;\n if (cmd) {\n ace.execCommand(cmd.exec ? cmd : cmd.name, cmd.args);\n }\n ace.curOp = ace.prevOp;\n }\n actions.fold = function(cm, actionArgs, vim) {\n cm.ace.execCommand(['toggleFoldWidget', 'toggleFoldWidget', 'foldOther', 'unfoldall'\n ][(actionArgs.all ? 2 : 0) + (actionArgs.open ? 1 : 0)]);\n };\n\n exports.handler.defaultKeymap = defaultKeymap;\n exports.handler.actions = actions;\n exports.Vim = Vim;\n \n Vim.map(\"Y\", \"yy\", \"normal\");\n});\n","ace.define(\"ace/theme/xcode\",[\"require\",\"exports\",\"module\",\"ace/lib/dom\"], function(acequire, exports, module) {\n\nexports.isDark = false;\nexports.cssClass = \"ace-xcode\";\nexports.cssText = \"\\\n.ace-xcode .ace_gutter {\\\nbackground: #e8e8e8;\\\ncolor: #333\\\n}\\\n.ace-xcode .ace_print-margin {\\\nwidth: 1px;\\\nbackground: #e8e8e8\\\n}\\\n.ace-xcode {\\\nbackground-color: #FFFFFF;\\\ncolor: #000000\\\n}\\\n.ace-xcode .ace_cursor {\\\ncolor: #000000\\\n}\\\n.ace-xcode .ace_marker-layer .ace_selection {\\\nbackground: #B5D5FF\\\n}\\\n.ace-xcode.ace_multiselect .ace_selection.ace_start {\\\nbox-shadow: 0 0 3px 0px #FFFFFF;\\\n}\\\n.ace-xcode .ace_marker-layer .ace_step {\\\nbackground: rgb(198, 219, 174)\\\n}\\\n.ace-xcode .ace_marker-layer .ace_bracket {\\\nmargin: -1px 0 0 -1px;\\\nborder: 1px solid #BFBFBF\\\n}\\\n.ace-xcode .ace_marker-layer .ace_active-line {\\\nbackground: rgba(0, 0, 0, 0.071)\\\n}\\\n.ace-xcode .ace_gutter-active-line {\\\nbackground-color: rgba(0, 0, 0, 0.071)\\\n}\\\n.ace-xcode .ace_marker-layer .ace_selected-word {\\\nborder: 1px solid #B5D5FF\\\n}\\\n.ace-xcode .ace_constant.ace_language,\\\n.ace-xcode .ace_keyword,\\\n.ace-xcode .ace_meta,\\\n.ace-xcode .ace_variable.ace_language {\\\ncolor: #C800A4\\\n}\\\n.ace-xcode .ace_invisible {\\\ncolor: #BFBFBF\\\n}\\\n.ace-xcode .ace_constant.ace_character,\\\n.ace-xcode .ace_constant.ace_other {\\\ncolor: #275A5E\\\n}\\\n.ace-xcode .ace_constant.ace_numeric {\\\ncolor: #3A00DC\\\n}\\\n.ace-xcode .ace_entity.ace_other.ace_attribute-name,\\\n.ace-xcode .ace_support.ace_constant,\\\n.ace-xcode .ace_support.ace_function {\\\ncolor: #450084\\\n}\\\n.ace-xcode .ace_fold {\\\nbackground-color: #C800A4;\\\nborder-color: #000000\\\n}\\\n.ace-xcode .ace_entity.ace_name.ace_tag,\\\n.ace-xcode .ace_support.ace_class,\\\n.ace-xcode .ace_support.ace_type {\\\ncolor: #790EAD\\\n}\\\n.ace-xcode .ace_storage {\\\ncolor: #C900A4\\\n}\\\n.ace-xcode .ace_string {\\\ncolor: #DF0002\\\n}\\\n.ace-xcode .ace_comment {\\\ncolor: #008E00\\\n}\\\n.ace-xcode .ace_indent-guide {\\\nbackground: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAE0lEQVQImWP4////f4bLly//BwAmVgd1/w11/gAAAABJRU5ErkJggg==) right repeat-y\\\n}\";\n\nvar dom = acequire(\"../lib/dom\");\ndom.importCssString(exports.cssText, exports.cssClass);\n});\n","ace.define(\"ace/theme/twilight\",[\"require\",\"exports\",\"module\",\"ace/lib/dom\"], function(acequire, exports, module) {\n\nexports.isDark = true;\nexports.cssClass = \"ace-twilight\";\nexports.cssText = \".ace-twilight .ace_gutter {\\\nbackground: #232323;\\\ncolor: #E2E2E2\\\n}\\\n.ace-twilight .ace_print-margin {\\\nwidth: 1px;\\\nbackground: #232323\\\n}\\\n.ace-twilight {\\\nbackground-color: #141414;\\\ncolor: #F8F8F8\\\n}\\\n.ace-twilight .ace_cursor {\\\ncolor: #A7A7A7\\\n}\\\n.ace-twilight .ace_marker-layer .ace_selection {\\\nbackground: rgba(221, 240, 255, 0.20)\\\n}\\\n.ace-twilight.ace_multiselect .ace_selection.ace_start {\\\nbox-shadow: 0 0 3px 0px #141414;\\\n}\\\n.ace-twilight .ace_marker-layer .ace_step {\\\nbackground: rgb(102, 82, 0)\\\n}\\\n.ace-twilight .ace_marker-layer .ace_bracket {\\\nmargin: -1px 0 0 -1px;\\\nborder: 1px solid rgba(255, 255, 255, 0.25)\\\n}\\\n.ace-twilight .ace_marker-layer .ace_active-line {\\\nbackground: rgba(255, 255, 255, 0.031)\\\n}\\\n.ace-twilight .ace_gutter-active-line {\\\nbackground-color: rgba(255, 255, 255, 0.031)\\\n}\\\n.ace-twilight .ace_marker-layer .ace_selected-word {\\\nborder: 1px solid rgba(221, 240, 255, 0.20)\\\n}\\\n.ace-twilight .ace_invisible {\\\ncolor: rgba(255, 255, 255, 0.25)\\\n}\\\n.ace-twilight .ace_keyword,\\\n.ace-twilight .ace_meta {\\\ncolor: #CDA869\\\n}\\\n.ace-twilight .ace_constant,\\\n.ace-twilight .ace_constant.ace_character,\\\n.ace-twilight .ace_constant.ace_character.ace_escape,\\\n.ace-twilight .ace_constant.ace_other,\\\n.ace-twilight .ace_heading,\\\n.ace-twilight .ace_markup.ace_heading,\\\n.ace-twilight .ace_support.ace_constant {\\\ncolor: #CF6A4C\\\n}\\\n.ace-twilight .ace_invalid.ace_illegal {\\\ncolor: #F8F8F8;\\\nbackground-color: rgba(86, 45, 86, 0.75)\\\n}\\\n.ace-twilight .ace_invalid.ace_deprecated {\\\ntext-decoration: underline;\\\nfont-style: italic;\\\ncolor: #D2A8A1\\\n}\\\n.ace-twilight .ace_support {\\\ncolor: #9B859D\\\n}\\\n.ace-twilight .ace_fold {\\\nbackground-color: #AC885B;\\\nborder-color: #F8F8F8\\\n}\\\n.ace-twilight .ace_support.ace_function {\\\ncolor: #DAD085\\\n}\\\n.ace-twilight .ace_list,\\\n.ace-twilight .ace_markup.ace_list,\\\n.ace-twilight .ace_storage {\\\ncolor: #F9EE98\\\n}\\\n.ace-twilight .ace_entity.ace_name.ace_function,\\\n.ace-twilight .ace_meta.ace_tag,\\\n.ace-twilight .ace_variable {\\\ncolor: #AC885B\\\n}\\\n.ace-twilight .ace_string {\\\ncolor: #8F9D6A\\\n}\\\n.ace-twilight .ace_string.ace_regexp {\\\ncolor: #E9C062\\\n}\\\n.ace-twilight .ace_comment {\\\nfont-style: italic;\\\ncolor: #5F5A60\\\n}\\\n.ace-twilight .ace_variable {\\\ncolor: #7587A6\\\n}\\\n.ace-twilight .ace_xml-pe {\\\ncolor: #494949\\\n}\\\n.ace-twilight .ace_indent-guide {\\\nbackground: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAEklEQVQImWMQERFpYLC1tf0PAAgOAnPnhxyiAAAAAElFTkSuQmCC) right repeat-y\\\n}\";\n\nvar dom = acequire(\"../lib/dom\");\ndom.importCssString(exports.cssText, exports.cssClass);\n});\n","ace.define(\"ace/theme/terminal\",[\"require\",\"exports\",\"module\",\"ace/lib/dom\"], function(acequire, exports, module) {\n\nexports.isDark = true;\nexports.cssClass = \"ace-terminal-theme\";\nexports.cssText = \".ace-terminal-theme .ace_gutter {\\\nbackground: #1a0005;\\\ncolor: steelblue\\\n}\\\n.ace-terminal-theme .ace_print-margin {\\\nwidth: 1px;\\\nbackground: #1a1a1a\\\n}\\\n.ace-terminal-theme {\\\nbackground-color: black;\\\ncolor: #DEDEDE\\\n}\\\n.ace-terminal-theme .ace_cursor {\\\ncolor: #9F9F9F\\\n}\\\n.ace-terminal-theme .ace_marker-layer .ace_selection {\\\nbackground: #424242\\\n}\\\n.ace-terminal-theme.ace_multiselect .ace_selection.ace_start {\\\nbox-shadow: 0 0 3px 0px black;\\\n}\\\n.ace-terminal-theme .ace_marker-layer .ace_step {\\\nbackground: rgb(0, 0, 0)\\\n}\\\n.ace-terminal-theme .ace_marker-layer .ace_bracket {\\\nbackground: #090;\\\n}\\\n.ace-terminal-theme .ace_marker-layer .ace_bracket-start {\\\nbackground: #090;\\\n}\\\n.ace-terminal-theme .ace_marker-layer .ace_bracket-unmatched {\\\nmargin: -1px 0 0 -1px;\\\nborder: 1px solid #900\\\n}\\\n.ace-terminal-theme .ace_marker-layer .ace_active-line {\\\nbackground: #2A2A2A\\\n}\\\n.ace-terminal-theme .ace_gutter-active-line {\\\nbackground-color: #2A112A\\\n}\\\n.ace-terminal-theme .ace_marker-layer .ace_selected-word {\\\nborder: 1px solid #424242\\\n}\\\n.ace-terminal-theme .ace_invisible {\\\ncolor: #343434\\\n}\\\n.ace-terminal-theme .ace_keyword,\\\n.ace-terminal-theme .ace_meta,\\\n.ace-terminal-theme .ace_storage,\\\n.ace-terminal-theme .ace_storage.ace_type,\\\n.ace-terminal-theme .ace_support.ace_type {\\\ncolor: tomato\\\n}\\\n.ace-terminal-theme .ace_keyword.ace_operator {\\\ncolor: deeppink\\\n}\\\n.ace-terminal-theme .ace_constant.ace_character,\\\n.ace-terminal-theme .ace_constant.ace_language,\\\n.ace-terminal-theme .ace_constant.ace_numeric,\\\n.ace-terminal-theme .ace_keyword.ace_other.ace_unit,\\\n.ace-terminal-theme .ace_support.ace_constant,\\\n.ace-terminal-theme .ace_variable.ace_parameter {\\\ncolor: #E78C45\\\n}\\\n.ace-terminal-theme .ace_constant.ace_other {\\\ncolor: gold\\\n}\\\n.ace-terminal-theme .ace_invalid {\\\ncolor: yellow;\\\nbackground-color: red\\\n}\\\n.ace-terminal-theme .ace_invalid.ace_deprecated {\\\ncolor: #CED2CF;\\\nbackground-color: #B798BF\\\n}\\\n.ace-terminal-theme .ace_fold {\\\nbackground-color: #7AA6DA;\\\nborder-color: #DEDEDE\\\n}\\\n.ace-terminal-theme .ace_entity.ace_name.ace_function,\\\n.ace-terminal-theme .ace_support.ace_function,\\\n.ace-terminal-theme .ace_variable {\\\ncolor: #7AA6DA\\\n}\\\n.ace-terminal-theme .ace_support.ace_class,\\\n.ace-terminal-theme .ace_support.ace_type {\\\ncolor: #E7C547\\\n}\\\n.ace-terminal-theme .ace_heading,\\\n.ace-terminal-theme .ace_string {\\\ncolor: #B9CA4A\\\n}\\\n.ace-terminal-theme .ace_entity.ace_name.ace_tag,\\\n.ace-terminal-theme .ace_entity.ace_other.ace_attribute-name,\\\n.ace-terminal-theme .ace_meta.ace_tag,\\\n.ace-terminal-theme .ace_string.ace_regexp,\\\n.ace-terminal-theme .ace_variable {\\\ncolor: #D54E53\\\n}\\\n.ace-terminal-theme .ace_comment {\\\ncolor: orangered\\\n}\\\n.ace-terminal-theme .ace_indent-guide {\\\nbackground: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAEklEQVQImWNgYGBgYLBWV/8PAAK4AYnhiq+xAAAAAElFTkSuQmCC) right repeat-y;\\\n}\\\n\";\n\nvar dom = acequire(\"../lib/dom\");\ndom.importCssString(exports.cssText, exports.cssClass);\n});\n","ace.define(\"ace/theme/solarized_light\",[\"require\",\"exports\",\"module\",\"ace/lib/dom\"], function(acequire, exports, module) {\n\nexports.isDark = false;\nexports.cssClass = \"ace-solarized-light\";\nexports.cssText = \".ace-solarized-light .ace_gutter {\\\nbackground: #fbf1d3;\\\ncolor: #333\\\n}\\\n.ace-solarized-light .ace_print-margin {\\\nwidth: 1px;\\\nbackground: #e8e8e8\\\n}\\\n.ace-solarized-light {\\\nbackground-color: #FDF6E3;\\\ncolor: #586E75\\\n}\\\n.ace-solarized-light .ace_cursor {\\\ncolor: #000000\\\n}\\\n.ace-solarized-light .ace_marker-layer .ace_selection {\\\nbackground: rgba(7, 54, 67, 0.09)\\\n}\\\n.ace-solarized-light.ace_multiselect .ace_selection.ace_start {\\\nbox-shadow: 0 0 3px 0px #FDF6E3;\\\n}\\\n.ace-solarized-light .ace_marker-layer .ace_step {\\\nbackground: rgb(255, 255, 0)\\\n}\\\n.ace-solarized-light .ace_marker-layer .ace_bracket {\\\nmargin: -1px 0 0 -1px;\\\nborder: 1px solid rgba(147, 161, 161, 0.50)\\\n}\\\n.ace-solarized-light .ace_marker-layer .ace_active-line {\\\nbackground: #EEE8D5\\\n}\\\n.ace-solarized-light .ace_gutter-active-line {\\\nbackground-color : #EDE5C1\\\n}\\\n.ace-solarized-light .ace_marker-layer .ace_selected-word {\\\nborder: 1px solid #073642\\\n}\\\n.ace-solarized-light .ace_invisible {\\\ncolor: rgba(147, 161, 161, 0.50)\\\n}\\\n.ace-solarized-light .ace_keyword,\\\n.ace-solarized-light .ace_meta,\\\n.ace-solarized-light .ace_support.ace_class,\\\n.ace-solarized-light .ace_support.ace_type {\\\ncolor: #859900\\\n}\\\n.ace-solarized-light .ace_constant.ace_character,\\\n.ace-solarized-light .ace_constant.ace_other {\\\ncolor: #CB4B16\\\n}\\\n.ace-solarized-light .ace_constant.ace_language {\\\ncolor: #B58900\\\n}\\\n.ace-solarized-light .ace_constant.ace_numeric {\\\ncolor: #D33682\\\n}\\\n.ace-solarized-light .ace_fold {\\\nbackground-color: #268BD2;\\\nborder-color: #586E75\\\n}\\\n.ace-solarized-light .ace_entity.ace_name.ace_function,\\\n.ace-solarized-light .ace_entity.ace_name.ace_tag,\\\n.ace-solarized-light .ace_support.ace_function,\\\n.ace-solarized-light .ace_variable,\\\n.ace-solarized-light .ace_variable.ace_language {\\\ncolor: #268BD2\\\n}\\\n.ace-solarized-light .ace_storage {\\\ncolor: #073642\\\n}\\\n.ace-solarized-light .ace_string {\\\ncolor: #2AA198\\\n}\\\n.ace-solarized-light .ace_string.ace_regexp {\\\ncolor: #D30102\\\n}\\\n.ace-solarized-light .ace_comment,\\\n.ace-solarized-light .ace_entity.ace_other.ace_attribute-name {\\\ncolor: #93A1A1\\\n}\\\n.ace-solarized-light .ace_indent-guide {\\\nbackground: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAEklEQVQImWNgYGBgYHjy8NJ/AAjgA5fzQUmBAAAAAElFTkSuQmCC) right repeat-y\\\n}\";\n\nvar dom = acequire(\"../lib/dom\");\ndom.importCssString(exports.cssText, exports.cssClass);\n});\n","ace.define(\"ace/theme/solarized_dark\",[\"require\",\"exports\",\"module\",\"ace/lib/dom\"], function(acequire, exports, module) {\n\nexports.isDark = true;\nexports.cssClass = \"ace-solarized-dark\";\nexports.cssText = \".ace-solarized-dark .ace_gutter {\\\nbackground: #01313f;\\\ncolor: #d0edf7\\\n}\\\n.ace-solarized-dark .ace_print-margin {\\\nwidth: 1px;\\\nbackground: #33555E\\\n}\\\n.ace-solarized-dark {\\\nbackground-color: #002B36;\\\ncolor: #93A1A1\\\n}\\\n.ace-solarized-dark .ace_entity.ace_other.ace_attribute-name,\\\n.ace-solarized-dark .ace_storage {\\\ncolor: #93A1A1\\\n}\\\n.ace-solarized-dark .ace_cursor,\\\n.ace-solarized-dark .ace_string.ace_regexp {\\\ncolor: #D30102\\\n}\\\n.ace-solarized-dark .ace_marker-layer .ace_active-line,\\\n.ace-solarized-dark .ace_marker-layer .ace_selection {\\\nbackground: rgba(255, 255, 255, 0.1)\\\n}\\\n.ace-solarized-dark.ace_multiselect .ace_selection.ace_start {\\\nbox-shadow: 0 0 3px 0px #002B36;\\\n}\\\n.ace-solarized-dark .ace_marker-layer .ace_step {\\\nbackground: rgb(102, 82, 0)\\\n}\\\n.ace-solarized-dark .ace_marker-layer .ace_bracket {\\\nmargin: -1px 0 0 -1px;\\\nborder: 1px solid rgba(147, 161, 161, 0.50)\\\n}\\\n.ace-solarized-dark .ace_gutter-active-line {\\\nbackground-color: #0d3440\\\n}\\\n.ace-solarized-dark .ace_marker-layer .ace_selected-word {\\\nborder: 1px solid #073642\\\n}\\\n.ace-solarized-dark .ace_invisible {\\\ncolor: rgba(147, 161, 161, 0.50)\\\n}\\\n.ace-solarized-dark .ace_keyword,\\\n.ace-solarized-dark .ace_meta,\\\n.ace-solarized-dark .ace_support.ace_class,\\\n.ace-solarized-dark .ace_support.ace_type {\\\ncolor: #859900\\\n}\\\n.ace-solarized-dark .ace_constant.ace_character,\\\n.ace-solarized-dark .ace_constant.ace_other {\\\ncolor: #CB4B16\\\n}\\\n.ace-solarized-dark .ace_constant.ace_language {\\\ncolor: #B58900\\\n}\\\n.ace-solarized-dark .ace_constant.ace_numeric {\\\ncolor: #D33682\\\n}\\\n.ace-solarized-dark .ace_fold {\\\nbackground-color: #268BD2;\\\nborder-color: #93A1A1\\\n}\\\n.ace-solarized-dark .ace_entity.ace_name.ace_function,\\\n.ace-solarized-dark .ace_entity.ace_name.ace_tag,\\\n.ace-solarized-dark .ace_support.ace_function,\\\n.ace-solarized-dark .ace_variable,\\\n.ace-solarized-dark .ace_variable.ace_language {\\\ncolor: #268BD2\\\n}\\\n.ace-solarized-dark .ace_string {\\\ncolor: #2AA198\\\n}\\\n.ace-solarized-dark .ace_comment {\\\nfont-style: italic;\\\ncolor: #657B83\\\n}\\\n.ace-solarized-dark .ace_indent-guide {\\\nbackground: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAEklEQVQImWNg0Db1ZVCxc/sPAAd4AlUHlLenAAAAAElFTkSuQmCC) right repeat-y\\\n}\";\n\nvar dom = acequire(\"../lib/dom\");\ndom.importCssString(exports.cssText, exports.cssClass);\n});\n","ace.define(\"ace/theme/monokai\",[\"require\",\"exports\",\"module\",\"ace/lib/dom\"], function(acequire, exports, module) {\n\nexports.isDark = true;\nexports.cssClass = \"ace-monokai\";\nexports.cssText = \".ace-monokai .ace_gutter {\\\nbackground: #2F3129;\\\ncolor: #8F908A\\\n}\\\n.ace-monokai .ace_print-margin {\\\nwidth: 1px;\\\nbackground: #555651\\\n}\\\n.ace-monokai {\\\nbackground-color: #272822;\\\ncolor: #F8F8F2\\\n}\\\n.ace-monokai .ace_cursor {\\\ncolor: #F8F8F0\\\n}\\\n.ace-monokai .ace_marker-layer .ace_selection {\\\nbackground: #49483E\\\n}\\\n.ace-monokai.ace_multiselect .ace_selection.ace_start {\\\nbox-shadow: 0 0 3px 0px #272822;\\\n}\\\n.ace-monokai .ace_marker-layer .ace_step {\\\nbackground: rgb(102, 82, 0)\\\n}\\\n.ace-monokai .ace_marker-layer .ace_bracket {\\\nmargin: -1px 0 0 -1px;\\\nborder: 1px solid #49483E\\\n}\\\n.ace-monokai .ace_marker-layer .ace_active-line {\\\nbackground: #202020\\\n}\\\n.ace-monokai .ace_gutter-active-line {\\\nbackground-color: #272727\\\n}\\\n.ace-monokai .ace_marker-layer .ace_selected-word {\\\nborder: 1px solid #49483E\\\n}\\\n.ace-monokai .ace_invisible {\\\ncolor: #52524d\\\n}\\\n.ace-monokai .ace_entity.ace_name.ace_tag,\\\n.ace-monokai .ace_keyword,\\\n.ace-monokai .ace_meta.ace_tag,\\\n.ace-monokai .ace_storage {\\\ncolor: #F92672\\\n}\\\n.ace-monokai .ace_punctuation,\\\n.ace-monokai .ace_punctuation.ace_tag {\\\ncolor: #fff\\\n}\\\n.ace-monokai .ace_constant.ace_character,\\\n.ace-monokai .ace_constant.ace_language,\\\n.ace-monokai .ace_constant.ace_numeric,\\\n.ace-monokai .ace_constant.ace_other {\\\ncolor: #AE81FF\\\n}\\\n.ace-monokai .ace_invalid {\\\ncolor: #F8F8F0;\\\nbackground-color: #F92672\\\n}\\\n.ace-monokai .ace_invalid.ace_deprecated {\\\ncolor: #F8F8F0;\\\nbackground-color: #AE81FF\\\n}\\\n.ace-monokai .ace_support.ace_constant,\\\n.ace-monokai .ace_support.ace_function {\\\ncolor: #66D9EF\\\n}\\\n.ace-monokai .ace_fold {\\\nbackground-color: #A6E22E;\\\nborder-color: #F8F8F2\\\n}\\\n.ace-monokai .ace_storage.ace_type,\\\n.ace-monokai .ace_support.ace_class,\\\n.ace-monokai .ace_support.ace_type {\\\nfont-style: italic;\\\ncolor: #66D9EF\\\n}\\\n.ace-monokai .ace_entity.ace_name.ace_function,\\\n.ace-monokai .ace_entity.ace_other,\\\n.ace-monokai .ace_entity.ace_other.ace_attribute-name,\\\n.ace-monokai .ace_variable {\\\ncolor: #A6E22E\\\n}\\\n.ace-monokai .ace_variable.ace_parameter {\\\nfont-style: italic;\\\ncolor: #FD971F\\\n}\\\n.ace-monokai .ace_string {\\\ncolor: #E6DB74\\\n}\\\n.ace-monokai .ace_comment {\\\ncolor: #75715E\\\n}\\\n.ace-monokai .ace_indent-guide {\\\nbackground: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAEklEQVQImWPQ0FD0ZXBzd/wPAAjVAoxeSgNeAAAAAElFTkSuQmCC) right repeat-y\\\n}\";\n\nvar dom = acequire(\"../lib/dom\");\ndom.importCssString(exports.cssText, exports.cssClass);\n});\n","ace.define(\"ace/theme/chrome\",[\"require\",\"exports\",\"module\",\"ace/lib/dom\"], function(acequire, exports, module) {\n\nexports.isDark = false;\nexports.cssClass = \"ace-chrome\";\nexports.cssText = \".ace-chrome .ace_gutter {\\\nbackground: #ebebeb;\\\ncolor: #333;\\\noverflow : hidden;\\\n}\\\n.ace-chrome .ace_print-margin {\\\nwidth: 1px;\\\nbackground: #e8e8e8;\\\n}\\\n.ace-chrome {\\\nbackground-color: #FFFFFF;\\\ncolor: black;\\\n}\\\n.ace-chrome .ace_cursor {\\\ncolor: black;\\\n}\\\n.ace-chrome .ace_invisible {\\\ncolor: rgb(191, 191, 191);\\\n}\\\n.ace-chrome .ace_constant.ace_buildin {\\\ncolor: rgb(88, 72, 246);\\\n}\\\n.ace-chrome .ace_constant.ace_language {\\\ncolor: rgb(88, 92, 246);\\\n}\\\n.ace-chrome .ace_constant.ace_library {\\\ncolor: rgb(6, 150, 14);\\\n}\\\n.ace-chrome .ace_invalid {\\\nbackground-color: rgb(153, 0, 0);\\\ncolor: white;\\\n}\\\n.ace-chrome .ace_fold {\\\n}\\\n.ace-chrome .ace_support.ace_function {\\\ncolor: rgb(60, 76, 114);\\\n}\\\n.ace-chrome .ace_support.ace_constant {\\\ncolor: rgb(6, 150, 14);\\\n}\\\n.ace-chrome .ace_support.ace_type,\\\n.ace-chrome .ace_support.ace_class\\\n.ace-chrome .ace_support.ace_other {\\\ncolor: rgb(109, 121, 222);\\\n}\\\n.ace-chrome .ace_variable.ace_parameter {\\\nfont-style:italic;\\\ncolor:#FD971F;\\\n}\\\n.ace-chrome .ace_keyword.ace_operator {\\\ncolor: rgb(104, 118, 135);\\\n}\\\n.ace-chrome .ace_comment {\\\ncolor: #236e24;\\\n}\\\n.ace-chrome .ace_comment.ace_doc {\\\ncolor: #236e24;\\\n}\\\n.ace-chrome .ace_comment.ace_doc.ace_tag {\\\ncolor: #236e24;\\\n}\\\n.ace-chrome .ace_constant.ace_numeric {\\\ncolor: rgb(0, 0, 205);\\\n}\\\n.ace-chrome .ace_variable {\\\ncolor: rgb(49, 132, 149);\\\n}\\\n.ace-chrome .ace_xml-pe {\\\ncolor: rgb(104, 104, 91);\\\n}\\\n.ace-chrome .ace_entity.ace_name.ace_function {\\\ncolor: #0000A2;\\\n}\\\n.ace-chrome .ace_heading {\\\ncolor: rgb(12, 7, 255);\\\n}\\\n.ace-chrome .ace_list {\\\ncolor:rgb(185, 6, 144);\\\n}\\\n.ace-chrome .ace_marker-layer .ace_selection {\\\nbackground: rgb(181, 213, 255);\\\n}\\\n.ace-chrome .ace_marker-layer .ace_step {\\\nbackground: rgb(252, 255, 0);\\\n}\\\n.ace-chrome .ace_marker-layer .ace_stack {\\\nbackground: rgb(164, 229, 101);\\\n}\\\n.ace-chrome .ace_marker-layer .ace_bracket {\\\nmargin: -1px 0 0 -1px;\\\nborder: 1px solid rgb(192, 192, 192);\\\n}\\\n.ace-chrome .ace_marker-layer .ace_active-line {\\\nbackground: rgba(0, 0, 0, 0.07);\\\n}\\\n.ace-chrome .ace_gutter-active-line {\\\nbackground-color : #dcdcdc;\\\n}\\\n.ace-chrome .ace_marker-layer .ace_selected-word {\\\nbackground: rgb(250, 250, 255);\\\nborder: 1px solid rgb(200, 200, 250);\\\n}\\\n.ace-chrome .ace_storage,\\\n.ace-chrome .ace_keyword,\\\n.ace-chrome .ace_meta.ace_tag {\\\ncolor: rgb(147, 15, 128);\\\n}\\\n.ace-chrome .ace_string.ace_regex {\\\ncolor: rgb(255, 0, 0)\\\n}\\\n.ace-chrome .ace_string {\\\ncolor: #1A1AA6;\\\n}\\\n.ace-chrome .ace_entity.ace_other.ace_attribute-name {\\\ncolor: #994409;\\\n}\\\n.ace-chrome .ace_indent-guide {\\\nbackground: url(\\\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAE0lEQVQImWP4////f4bLly//BwAmVgd1/w11/gAAAABJRU5ErkJggg==\\\") right repeat-y;\\\n}\\\n\";\n\nvar dom = acequire(\"../lib/dom\");\ndom.importCssString(exports.cssText, exports.cssClass);\n});\n","ace.define(\"ace/theme/chaos\",[\"require\",\"exports\",\"module\",\"ace/lib/dom\"], function(acequire, exports, module) {\n\nexports.isDark = true;\nexports.cssClass = \"ace-chaos\";\nexports.cssText = \".ace-chaos .ace_gutter {\\\nbackground: #141414;\\\ncolor: #595959;\\\nborder-right: 1px solid #282828;\\\n}\\\n.ace-chaos .ace_gutter-cell.ace_warning {\\\nbackground-image: none;\\\nbackground: #FC0;\\\nborder-left: none;\\\npadding-left: 0;\\\ncolor: #000;\\\n}\\\n.ace-chaos .ace_gutter-cell.ace_error {\\\nbackground-position: -6px center;\\\nbackground-image: none;\\\nbackground: #F10;\\\nborder-left: none;\\\npadding-left: 0;\\\ncolor: #000;\\\n}\\\n.ace-chaos .ace_print-margin {\\\nborder-left: 1px solid #555;\\\nright: 0;\\\nbackground: #1D1D1D;\\\n}\\\n.ace-chaos {\\\nbackground-color: #161616;\\\ncolor: #E6E1DC;\\\n}\\\n.ace-chaos .ace_cursor {\\\nborder-left: 2px solid #FFFFFF;\\\n}\\\n.ace-chaos .ace_cursor.ace_overwrite {\\\nborder-left: 0px;\\\nborder-bottom: 1px solid #FFFFFF;\\\n}\\\n.ace-chaos .ace_marker-layer .ace_selection {\\\nbackground: #494836;\\\n}\\\n.ace-chaos .ace_marker-layer .ace_step {\\\nbackground: rgb(198, 219, 174);\\\n}\\\n.ace-chaos .ace_marker-layer .ace_bracket {\\\nmargin: -1px 0 0 -1px;\\\nborder: 1px solid #FCE94F;\\\n}\\\n.ace-chaos .ace_marker-layer .ace_active-line {\\\nbackground: #333;\\\n}\\\n.ace-chaos .ace_gutter-active-line {\\\nbackground-color: #222;\\\n}\\\n.ace-chaos .ace_invisible {\\\ncolor: #404040;\\\n}\\\n.ace-chaos .ace_keyword {\\\ncolor:#00698F;\\\n}\\\n.ace-chaos .ace_keyword.ace_operator {\\\ncolor:#FF308F;\\\n}\\\n.ace-chaos .ace_constant {\\\ncolor:#1EDAFB;\\\n}\\\n.ace-chaos .ace_constant.ace_language {\\\ncolor:#FDC251;\\\n}\\\n.ace-chaos .ace_constant.ace_library {\\\ncolor:#8DFF0A;\\\n}\\\n.ace-chaos .ace_constant.ace_numeric {\\\ncolor:#58C554;\\\n}\\\n.ace-chaos .ace_invalid {\\\ncolor:#FFFFFF;\\\nbackground-color:#990000;\\\n}\\\n.ace-chaos .ace_invalid.ace_deprecated {\\\ncolor:#FFFFFF;\\\nbackground-color:#990000;\\\n}\\\n.ace-chaos .ace_support {\\\ncolor: #999;\\\n}\\\n.ace-chaos .ace_support.ace_function {\\\ncolor:#00AEEF;\\\n}\\\n.ace-chaos .ace_function {\\\ncolor:#00AEEF;\\\n}\\\n.ace-chaos .ace_string {\\\ncolor:#58C554;\\\n}\\\n.ace-chaos .ace_comment {\\\ncolor:#555;\\\nfont-style:italic;\\\npadding-bottom: 0px;\\\n}\\\n.ace-chaos .ace_variable {\\\ncolor:#997744;\\\n}\\\n.ace-chaos .ace_meta.ace_tag {\\\ncolor:#BE53E6;\\\n}\\\n.ace-chaos .ace_entity.ace_other.ace_attribute-name {\\\ncolor:#FFFF89;\\\n}\\\n.ace-chaos .ace_markup.ace_underline {\\\ntext-decoration: underline;\\\n}\\\n.ace-chaos .ace_fold-widget {\\\ntext-align: center;\\\n}\\\n.ace-chaos .ace_fold-widget:hover {\\\ncolor: #777;\\\n}\\\n.ace-chaos .ace_fold-widget.ace_start,\\\n.ace-chaos .ace_fold-widget.ace_end,\\\n.ace-chaos .ace_fold-widget.ace_closed{\\\nbackground: none;\\\nborder: none;\\\nbox-shadow: none;\\\n}\\\n.ace-chaos .ace_fold-widget.ace_start:after {\\\ncontent: '▾'\\\n}\\\n.ace-chaos .ace_fold-widget.ace_end:after {\\\ncontent: '▴'\\\n}\\\n.ace-chaos .ace_fold-widget.ace_closed:after {\\\ncontent: '‣'\\\n}\\\n.ace-chaos .ace_indent-guide {\\\nborder-right:1px dotted #333;\\\nmargin-right:-1px;\\\n}\\\n.ace-chaos .ace_fold { \\\nbackground: #222; \\\nborder-radius: 3px; \\\ncolor: #7AF; \\\nborder: none; \\\n}\\\n.ace-chaos .ace_fold:hover {\\\nbackground: #CCC; \\\ncolor: #000;\\\n}\\\n\";\n\nvar dom = acequire(\"../lib/dom\");\ndom.importCssString(exports.cssText, exports.cssClass);\n\n});\n","//This file should be copied into brace/mode/netscript.js\r\n\r\nace.define(\"ace/mode/doc_comment_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text_highlight_rules\"], function(acequire, exports, module) {\r\n\"use strict\";\r\n\r\nvar oop = acequire(\"../lib/oop\");\r\nvar TextHighlightRules = acequire(\"./text_highlight_rules\").TextHighlightRules;\r\n\r\nvar DocCommentHighlightRules = function() {\r\n this.$rules = {\r\n \"start\" : [ {\r\n token : \"comment.doc.tag\",\r\n regex : \"@[\\\\w\\\\d_]+\" // TODO: fix email addresses\r\n },\r\n DocCommentHighlightRules.getTagRule(),\r\n {\r\n defaultToken : \"comment.doc\",\r\n caseInsensitive: true\r\n }]\r\n };\r\n};\r\n\r\noop.inherits(DocCommentHighlightRules, TextHighlightRules);\r\n\r\nDocCommentHighlightRules.getTagRule = function(start) {\r\n return {\r\n token : \"comment.doc.tag.storage.type\",\r\n regex : \"\\\\b(?:TODO|FIXME|XXX|HACK)\\\\b\"\r\n };\r\n}\r\n\r\nDocCommentHighlightRules.getStartRule = function(start) {\r\n return {\r\n token : \"comment.doc\", // doc comment\r\n regex : \"\\\\/\\\\*(?=\\\\*)\",\r\n next : start\r\n };\r\n};\r\n\r\nDocCommentHighlightRules.getEndRule = function (start) {\r\n return {\r\n token : \"comment.doc\", // closing comment\r\n regex : \"\\\\*\\\\/\",\r\n next : start\r\n };\r\n};\r\n\r\n\r\nexports.DocCommentHighlightRules = DocCommentHighlightRules;\r\n\r\n});\r\n\r\nace.define(\"ace/mode/netscript_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/doc_comment_highlight_rules\",\"ace/mode/text_highlight_rules\"], function(acequire, exports, module) {\r\n\"use strict\";\r\n\r\nvar oop = acequire(\"../lib/oop\");\r\nvar DocCommentHighlightRules = acequire(\"./doc_comment_highlight_rules\").DocCommentHighlightRules;\r\nvar TextHighlightRules = acequire(\"./text_highlight_rules\").TextHighlightRules;\r\nvar identifierRe = \"[a-zA-Z\\\\$_\\u00a1-\\uffff][a-zA-Z\\\\d\\\\$_\\u00a1-\\uffff]*\";\r\n\r\nlet NetscriptFunctions =\r\n \"hack|sleep|grow|weaken|print|tprint|scan|nuke|brutessh|ftpcrack|\" + //Netscript functions\r\n \"clearLog|disableLog|enableLog|\" +\r\n \"relaysmtp|httpworm|sqlinject|run|exec|spawn|kill|killall|exit|\" +\r\n \"scp|ls|hasRootAccess|\" +\r\n \"getIp|getHackingMultipliers|getBitNodeMultipliers|getStats|isBusy|\" +\r\n \"getHacknetMultipliers|\" +\r\n \"getHostname|getHackingLevel|getServerMoneyAvailable|getServerMaxMoney|\" +\r\n \"getServerGrowth|getServerSecurityLevel|getServerBaseSecurityLevel|\" +\r\n \"getServerMinSecurityLevel|\" +\r\n \"getServerRequiredHackingLevel|getServerNumPortsRequired|getServerRam|\" +\r\n \"serverExists|fileExists|isRunning|getNextHacknetNodeCost|\" +\r\n \"purchaseHacknetNode|deleteServer|getPurchasedServers|\" +\r\n \"purchaseServer|round|write|read|peek|clear|rm|getPortHandle|\" +\r\n \"scriptRunning|scriptKill|getScriptName|getScriptRam|\" +\r\n \"getHackTime|getGrowTime|getWeakenTime|getScriptIncome|getScriptExpGain|\" +\r\n \"getTimeSinceLastAug|prompt|\" +\r\n \"universityCourse|getCharacterInformation|\" +\r\n \"gymWorkout|travelToCity|purchaseTor|purchaseProgram|upgradeHomeRam|\" +\r\n \"getUpgradeHomeRamCost|workForCompany|applyToCompany|getCompanyRep|\" +\r\n \"getCompanyFavor|stopAction|getFactionFavor|\" +\r\n \"checkFactionInvitations|joinFaction|workForFaction|getFactionRep|\" +\r\n \"createProgram|commitCrime|getCrimeChance|getOwnedAugmentations|\" +\r\n \"getAugmentationsFromFaction|\" +\r\n \"getAugmentationCost|purchaseAugmentation|\" +\r\n \"installAugmentations|hacknetnodes|upgradeLevel|upgradeRam|upgradeCore|\" +\r\n \"getLevelUpgradeCost|getRamUpgradeCost|getCoreUpgradeCost|\" +\r\n \"getStockPrice|getStockPosition|buyStock|sellStock|shortStock|sellShort|\" +\r\n \"placeOrder|cancelOrder\";\r\n\r\nvar NetscriptHighlightRules = function(options) {\r\n var keywordMapper = this.createKeywordMapper({\r\n \"variable.language\":\r\n \"Array|Boolean|Date|Function|Iterator|Number|Object|RegExp|String|Proxy|\" + // Constructors\r\n \"Namespace|QName|XML|XMLList|\" + // E4X\r\n \"ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|\" +\r\n \"Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray|\" +\r\n \"Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|\" + // Errors\r\n \"SyntaxError|TypeError|URIError|\" +\r\n \"decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|eval|isFinite|\" + // Non-constructor functions\r\n \"isNaN|parseFloat|parseInt|\" +\r\n \"ns|\" + NetscriptFunctions +\"|\" +\r\n \"JSON|Math|\" + // Other\r\n \"this|arguments|prototype|window|document\" , // Pseudo\r\n \"keyword\":\r\n \"const|yield|import|get|set|async|await|\" +\r\n \"break|case|catch|continue|default|delete|do|else|finally|for|function|\" +\r\n \"if|in|of|instanceof|new|return|switch|throw|try|typeof|let|var|while|with|debugger|\" +\r\n \"__parent__|__count__|escape|unescape|with|__proto__|\" +\r\n \"class|enum|extends|super|export|implements|private|public|interface|package|protected|static\",\r\n \"storage.type\":\r\n \"const|let|var|function\",\r\n \"constant.language\":\r\n \"null|Infinity|NaN|undefined\",\r\n \"support.function\":\r\n \"alert\",\r\n \"constant.language.boolean\": \"true|false\"\r\n }, \"identifier\");\r\n var kwBeforeRe = \"case|do|else|finally|in|instanceof|return|throw|try|typeof|yield|void\";\r\n\r\n var escapedRe = \"\\\\\\\\(?:x[0-9a-fA-F]{2}|\" + // hex\r\n \"u[0-9a-fA-F]{4}|\" + // unicode\r\n \"u{[0-9a-fA-F]{1,6}}|\" + // es6 unicode\r\n \"[0-2][0-7]{0,2}|\" + // oct\r\n \"3[0-7][0-7]?|\" + // oct\r\n \"[4-7][0-7]?|\" + //oct\r\n \".)\";\r\n\r\n this.$rules = {\r\n \"no_regex\" : [\r\n DocCommentHighlightRules.getStartRule(\"doc-start\"),\r\n comments(\"no_regex\"),\r\n {\r\n token : \"string\",\r\n regex : \"'(?=.)\",\r\n next : \"qstring\"\r\n }, {\r\n token : \"string\",\r\n regex : '\"(?=.)',\r\n next : \"qqstring\"\r\n }, {\r\n token : \"constant.numeric\", // hex\r\n regex : /0(?:[xX][0-9a-fA-F]+|[bB][01]+)\\b/\r\n }, {\r\n token : \"constant.numeric\", // float\r\n regex : /[+-]?\\d[\\d_]*(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b/\r\n }, {\r\n token : [\r\n \"storage.type\", \"punctuation.operator\", \"support.function\",\r\n \"punctuation.operator\", \"entity.name.function\", \"text\",\"keyword.operator\"\r\n ],\r\n regex : \"(\" + identifierRe + \")(\\\\.)(prototype)(\\\\.)(\" + identifierRe +\")(\\\\s*)(=)\",\r\n next: \"function_arguments\"\r\n }, {\r\n token : [\r\n \"storage.type\", \"punctuation.operator\", \"entity.name.function\", \"text\",\r\n \"keyword.operator\", \"text\", \"storage.type\", \"text\", \"paren.lparen\"\r\n ],\r\n regex : \"(\" + identifierRe + \")(\\\\.)(\" + identifierRe +\")(\\\\s*)(=)(\\\\s*)(function)(\\\\s*)(\\\\()\",\r\n next: \"function_arguments\"\r\n }, {\r\n token : [\r\n \"entity.name.function\", \"text\", \"keyword.operator\", \"text\", \"storage.type\",\r\n \"text\", \"paren.lparen\"\r\n ],\r\n regex : \"(\" + identifierRe +\")(\\\\s*)(=)(\\\\s*)(function)(\\\\s*)(\\\\()\",\r\n next: \"function_arguments\"\r\n }, {\r\n token : [\r\n \"storage.type\", \"punctuation.operator\", \"entity.name.function\", \"text\",\r\n \"keyword.operator\", \"text\",\r\n \"storage.type\", \"text\", \"entity.name.function\", \"text\", \"paren.lparen\"\r\n ],\r\n regex : \"(\" + identifierRe + \")(\\\\.)(\" + identifierRe +\")(\\\\s*)(=)(\\\\s*)(function)(\\\\s+)(\\\\w+)(\\\\s*)(\\\\()\",\r\n next: \"function_arguments\"\r\n }, {\r\n token : [\r\n \"storage.type\", \"text\", \"entity.name.function\", \"text\", \"paren.lparen\"\r\n ],\r\n regex : \"(function)(\\\\s+)(\" + identifierRe + \")(\\\\s*)(\\\\()\",\r\n next: \"function_arguments\"\r\n }, {\r\n token : [\r\n \"entity.name.function\", \"text\", \"punctuation.operator\",\r\n \"text\", \"storage.type\", \"text\", \"paren.lparen\"\r\n ],\r\n regex : \"(\" + identifierRe + \")(\\\\s*)(:)(\\\\s*)(function)(\\\\s*)(\\\\()\",\r\n next: \"function_arguments\"\r\n }, {\r\n token : [\r\n \"text\", \"text\", \"storage.type\", \"text\", \"paren.lparen\"\r\n ],\r\n regex : \"(:)(\\\\s*)(function)(\\\\s*)(\\\\()\",\r\n next: \"function_arguments\"\r\n }, {\r\n token : \"keyword\",\r\n regex : \"(?:\" + kwBeforeRe + \")\\\\b\",\r\n next : \"start\"\r\n }, {\r\n token : [\"support.constant\"],\r\n regex : /that\\b/\r\n }, {\r\n token : [\"storage.type\", \"punctuation.operator\", \"support.function.firebug\"],\r\n regex : /(console)(\\.)(warn|info|log|error|time|trace|timeEnd|assert)\\b/\r\n }, {\r\n token : keywordMapper,\r\n regex : identifierRe\r\n }, {\r\n token : \"punctuation.operator\",\r\n regex : /[.](?![.])/,\r\n next : \"property\"\r\n }, {\r\n token : \"keyword.operator\",\r\n regex : /--|\\+\\+|\\.{3}|===|==|=|!=|!==|<+=?|>+=?|!|&&|\\|\\||\\?:|[!$%&*+\\-~\\/^]=?/,\r\n next : \"start\"\r\n }, {\r\n token : \"punctuation.operator\",\r\n regex : /[?:,;.]/,\r\n next : \"start\"\r\n }, {\r\n token : \"paren.lparen\",\r\n regex : /[\\[({]/,\r\n next : \"start\"\r\n }, {\r\n token : \"paren.rparen\",\r\n regex : /[\\])}]/\r\n }, {\r\n token: \"comment\",\r\n regex: /^#!.*$/\r\n }\r\n ],\r\n property: [{\r\n token : \"text\",\r\n regex : \"\\\\s+\"\r\n }, {\r\n token : [\r\n \"storage.type\", \"punctuation.operator\", \"entity.name.function\", \"text\",\r\n \"keyword.operator\", \"text\",\r\n \"storage.type\", \"text\", \"entity.name.function\", \"text\", \"paren.lparen\"\r\n ],\r\n regex : \"(\" + identifierRe + \")(\\\\.)(\" + identifierRe +\")(\\\\s*)(=)(\\\\s*)(function)(?:(\\\\s+)(\\\\w+))?(\\\\s*)(\\\\()\",\r\n next: \"function_arguments\"\r\n }, {\r\n token : \"punctuation.operator\",\r\n regex : /[.](?![.])/\r\n }, {\r\n token : \"support.function\",\r\n regex : \"/|\" + NetscriptFunctions + \"|/\"\r\n }, {\r\n token : \"support.function\",\r\n regex : /(s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\\b(?=\\()/\r\n }, {\r\n token : \"support.function.dom\",\r\n regex : /(s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName|ClassName)|ById)|Attribute(?:Node)?)|blur)\\b(?=\\()/\r\n }, {\r\n token : \"support.constant\",\r\n regex : /(s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\\b/\r\n }, {\r\n token : \"identifier\",\r\n regex : identifierRe\r\n }, {\r\n regex: \"\",\r\n token: \"empty\",\r\n next: \"no_regex\"\r\n }\r\n ],\r\n \"start\": [\r\n DocCommentHighlightRules.getStartRule(\"doc-start\"),\r\n comments(\"start\"),\r\n {\r\n token: \"string.regexp\",\r\n regex: \"\\\\/\",\r\n next: \"regex\"\r\n }, {\r\n token : \"text\",\r\n regex : \"\\\\s+|^$\",\r\n next : \"start\"\r\n }, {\r\n token: \"empty\",\r\n regex: \"\",\r\n next: \"no_regex\"\r\n }\r\n ],\r\n \"regex\": [\r\n {\r\n token: \"regexp.keyword.operator\",\r\n regex: \"\\\\\\\\(?:u[\\\\da-fA-F]{4}|x[\\\\da-fA-F]{2}|.)\"\r\n }, {\r\n token: \"string.regexp\",\r\n regex: \"/[sxngimy]*\",\r\n next: \"no_regex\"\r\n }, {\r\n token : \"invalid\",\r\n regex: /\\{\\d+\\b,?\\d*\\}[+*]|[+*$^?][+*]|[$^][?]|\\?{3,}/\r\n }, {\r\n token : \"constant.language.escape\",\r\n regex: /\\(\\?[:=!]|\\)|\\{\\d+\\b,?\\d*\\}|[+*]\\?|[()$^+*?.]/\r\n }, {\r\n token : \"constant.language.delimiter\",\r\n regex: /\\|/\r\n }, {\r\n token: \"constant.language.escape\",\r\n regex: /\\[\\^?/,\r\n next: \"regex_character_class\"\r\n }, {\r\n token: \"empty\",\r\n regex: \"$\",\r\n next: \"no_regex\"\r\n }, {\r\n defaultToken: \"string.regexp\"\r\n }\r\n ],\r\n \"regex_character_class\": [\r\n {\r\n token: \"regexp.charclass.keyword.operator\",\r\n regex: \"\\\\\\\\(?:u[\\\\da-fA-F]{4}|x[\\\\da-fA-F]{2}|.)\"\r\n }, {\r\n token: \"constant.language.escape\",\r\n regex: \"]\",\r\n next: \"regex\"\r\n }, {\r\n token: \"constant.language.escape\",\r\n regex: \"-\"\r\n }, {\r\n token: \"empty\",\r\n regex: \"$\",\r\n next: \"no_regex\"\r\n }, {\r\n defaultToken: \"string.regexp.charachterclass\"\r\n }\r\n ],\r\n \"function_arguments\": [\r\n {\r\n token: \"variable.parameter\",\r\n regex: identifierRe\r\n }, {\r\n token: \"punctuation.operator\",\r\n regex: \"[, ]+\"\r\n }, {\r\n token: \"punctuation.operator\",\r\n regex: \"$\"\r\n }, {\r\n token: \"empty\",\r\n regex: \"\",\r\n next: \"no_regex\"\r\n }\r\n ],\r\n \"qqstring\" : [\r\n {\r\n token : \"constant.language.escape\",\r\n regex : escapedRe\r\n }, {\r\n token : \"string\",\r\n regex : \"\\\\\\\\$\",\r\n next : \"qqstring\"\r\n }, {\r\n token : \"string\",\r\n regex : '\"|$',\r\n next : \"no_regex\"\r\n }, {\r\n defaultToken: \"string\"\r\n }\r\n ],\r\n \"qstring\" : [\r\n {\r\n token : \"constant.language.escape\",\r\n regex : escapedRe\r\n }, {\r\n token : \"string\",\r\n regex : \"\\\\\\\\$\",\r\n next : \"qstring\"\r\n }, {\r\n token : \"string\",\r\n regex : \"'|$\",\r\n next : \"no_regex\"\r\n }, {\r\n defaultToken: \"string\"\r\n }\r\n ]\r\n };\r\n\r\n\r\n if (!options || !options.noES6) {\r\n this.$rules.no_regex.unshift({\r\n regex: \"[{}]\", onMatch: function(val, state, stack) {\r\n this.next = val == \"{\" ? this.nextState : \"\";\r\n if (val == \"{\" && stack.length) {\r\n stack.unshift(\"start\", state);\r\n }\r\n else if (val == \"}\" && stack.length) {\r\n stack.shift();\r\n this.next = stack.shift();\r\n if (this.next.indexOf(\"string\") != -1 || this.next.indexOf(\"jsx\") != -1)\r\n return \"paren.quasi.end\";\r\n }\r\n return val == \"{\" ? \"paren.lparen\" : \"paren.rparen\";\r\n },\r\n nextState: \"start\"\r\n }, {\r\n token : \"string.quasi.start\",\r\n regex : /`/,\r\n push : [{\r\n token : \"constant.language.escape\",\r\n regex : escapedRe\r\n }, {\r\n token : \"paren.quasi.start\",\r\n regex : /\\${/,\r\n push : \"start\"\r\n }, {\r\n token : \"string.quasi.end\",\r\n regex : /`/,\r\n next : \"pop\"\r\n }, {\r\n defaultToken: \"string.quasi\"\r\n }]\r\n });\r\n\r\n if (!options || options.jsx != false)\r\n JSX.call(this);\r\n }\r\n\r\n this.embedRules(DocCommentHighlightRules, \"doc-\",\r\n [ DocCommentHighlightRules.getEndRule(\"no_regex\") ]);\r\n\r\n this.normalizeRules();\r\n};\r\n\r\noop.inherits(NetscriptHighlightRules, TextHighlightRules);\r\n\r\nfunction JSX() {\r\n var tagRegex = identifierRe.replace(\"\\\\d\", \"\\\\d\\\\-\");\r\n var jsxTag = {\r\n onMatch : function(val, state, stack) {\r\n var offset = val.charAt(1) == \"/\" ? 2 : 1;\r\n if (offset == 1) {\r\n if (state != this.nextState)\r\n stack.unshift(this.next, this.nextState, 0);\r\n else\r\n stack.unshift(this.next);\r\n stack[2]++;\r\n } else if (offset == 2) {\r\n if (state == this.nextState) {\r\n stack[1]--;\r\n if (!stack[1] || stack[1] < 0) {\r\n stack.shift();\r\n stack.shift();\r\n }\r\n }\r\n }\r\n return [{\r\n type: \"meta.tag.punctuation.\" + (offset == 1 ? \"\" : \"end-\") + \"tag-open.xml\",\r\n value: val.slice(0, offset)\r\n }, {\r\n type: \"meta.tag.tag-name.xml\",\r\n value: val.substr(offset)\r\n }];\r\n },\r\n regex : \"</?\" + tagRegex + \"\",\r\n next: \"jsxAttributes\",\r\n nextState: \"jsx\"\r\n };\r\n this.$rules.start.unshift(jsxTag);\r\n var jsxJsRule = {\r\n regex: \"{\",\r\n token: \"paren.quasi.start\",\r\n push: \"start\"\r\n };\r\n this.$rules.jsx = [\r\n jsxJsRule,\r\n jsxTag,\r\n {include : \"reference\"},\r\n {defaultToken: \"string\"}\r\n ];\r\n this.$rules.jsxAttributes = [{\r\n token : \"meta.tag.punctuation.tag-close.xml\",\r\n regex : \"/?>\",\r\n onMatch : function(value, currentState, stack) {\r\n if (currentState == stack[0])\r\n stack.shift();\r\n if (value.length == 2) {\r\n if (stack[0] == this.nextState)\r\n stack[1]--;\r\n if (!stack[1] || stack[1] < 0) {\r\n stack.splice(0, 2);\r\n }\r\n }\r\n this.next = stack[0] || \"start\";\r\n return [{type: this.token, value: value}];\r\n },\r\n nextState: \"jsx\"\r\n },\r\n jsxJsRule,\r\n comments(\"jsxAttributes\"),\r\n {\r\n token : \"entity.other.attribute-name.xml\",\r\n regex : tagRegex\r\n }, {\r\n token : \"keyword.operator.attribute-equals.xml\",\r\n regex : \"=\"\r\n }, {\r\n token : \"text.tag-whitespace.xml\",\r\n regex : \"\\\\s+\"\r\n }, {\r\n token : \"string.attribute-value.xml\",\r\n regex : \"'\",\r\n stateName : \"jsx_attr_q\",\r\n push : [\r\n {token : \"string.attribute-value.xml\", regex: \"'\", next: \"pop\"},\r\n {include : \"reference\"},\r\n {defaultToken : \"string.attribute-value.xml\"}\r\n ]\r\n }, {\r\n token : \"string.attribute-value.xml\",\r\n regex : '\"',\r\n stateName : \"jsx_attr_qq\",\r\n push : [\r\n {token : \"string.attribute-value.xml\", regex: '\"', next: \"pop\"},\r\n {include : \"reference\"},\r\n {defaultToken : \"string.attribute-value.xml\"}\r\n ]\r\n },\r\n jsxTag\r\n ];\r\n this.$rules.reference = [{\r\n token : \"constant.language.escape.reference.xml\",\r\n regex : \"(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\\\.-]+;)\"\r\n }];\r\n}\r\n\r\nfunction comments(next) {\r\n return [\r\n {\r\n token : \"comment\", // multi line comment\r\n regex : /\\/\\*/,\r\n next: [\r\n DocCommentHighlightRules.getTagRule(),\r\n {token : \"comment\", regex : \"\\\\*\\\\/\", next : next || \"pop\"},\r\n {defaultToken : \"comment\", caseInsensitive: true}\r\n ]\r\n }, {\r\n token : \"comment\",\r\n regex : \"\\\\/\\\\/\",\r\n next: [\r\n DocCommentHighlightRules.getTagRule(),\r\n {token : \"comment\", regex : \"$|^\", next : next || \"pop\"},\r\n {defaultToken : \"comment\", caseInsensitive: true}\r\n ]\r\n }\r\n ];\r\n}\r\nexports.NetscriptHighlightRules = NetscriptHighlightRules;\r\n});\r\n\r\nace.define(\"ace/mode/matching_brace_outdent\",[\"require\",\"exports\",\"module\",\"ace/range\"], function(acequire, exports, module) {\r\n\"use strict\";\r\n\r\nvar Range = acequire(\"../range\").Range;\r\n\r\nvar MatchingBraceOutdent = function() {};\r\n\r\n(function() {\r\n\r\n this.checkOutdent = function(line, input) {\r\n if (! /^\\s+$/.test(line))\r\n return false;\r\n\r\n return /^\\s*\\}/.test(input);\r\n };\r\n\r\n this.autoOutdent = function(doc, row) {\r\n var line = doc.getLine(row);\r\n var match = line.match(/^(\\s*\\})/);\r\n\r\n if (!match) return 0;\r\n\r\n var column = match[1].length;\r\n var openBracePos = doc.findMatchingBracket({row: row, column: column});\r\n\r\n if (!openBracePos || openBracePos.row == row) return 0;\r\n\r\n var indent = this.$getIndent(doc.getLine(openBracePos.row));\r\n doc.replace(new Range(row, 0, row, column-1), indent);\r\n };\r\n\r\n this.$getIndent = function(line) {\r\n return line.match(/^\\s*/)[0];\r\n };\r\n\r\n}).call(MatchingBraceOutdent.prototype);\r\n\r\nexports.MatchingBraceOutdent = MatchingBraceOutdent;\r\n});\r\n\r\nace.define(\"ace/mode/folding/cstyle\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/range\",\"ace/mode/folding/fold_mode\"], function(acequire, exports, module) {\r\n\"use strict\";\r\n\r\nvar oop = acequire(\"../../lib/oop\");\r\nvar Range = acequire(\"../../range\").Range;\r\nvar BaseFoldMode = acequire(\"./fold_mode\").FoldMode;\r\n\r\nvar FoldMode = exports.FoldMode = function(commentRegex) {\r\n if (commentRegex) {\r\n this.foldingStartMarker = new RegExp(\r\n this.foldingStartMarker.source.replace(/\\|[^|]*?$/, \"|\" + commentRegex.start)\r\n );\r\n this.foldingStopMarker = new RegExp(\r\n this.foldingStopMarker.source.replace(/\\|[^|]*?$/, \"|\" + commentRegex.end)\r\n );\r\n }\r\n};\r\noop.inherits(FoldMode, BaseFoldMode);\r\n\r\n(function() {\r\n\r\n this.foldingStartMarker = /(\\{|\\[)[^\\}\\]]*$|^\\s*(\\/\\*)/;\r\n this.foldingStopMarker = /^[^\\[\\{]*(\\}|\\])|^[\\s\\*]*(\\*\\/)/;\r\n this.singleLineBlockCommentRe= /^\\s*(\\/\\*).*\\*\\/\\s*$/;\r\n this.tripleStarBlockCommentRe = /^\\s*(\\/\\*\\*\\*).*\\*\\/\\s*$/;\r\n this.startRegionRe = /^\\s*(\\/\\*|\\/\\/)#?region\\b/;\r\n this._getFoldWidgetBase = this.getFoldWidget;\r\n this.getFoldWidget = function(session, foldStyle, row) {\r\n var line = session.getLine(row);\r\n\r\n if (this.singleLineBlockCommentRe.test(line)) {\r\n if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line))\r\n return \"\";\r\n }\r\n\r\n var fw = this._getFoldWidgetBase(session, foldStyle, row);\r\n\r\n if (!fw && this.startRegionRe.test(line))\r\n return \"start\"; // lineCommentRegionStart\r\n\r\n return fw;\r\n };\r\n\r\n this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) {\r\n var line = session.getLine(row);\r\n\r\n if (this.startRegionRe.test(line))\r\n return this.getCommentRegionBlock(session, line, row);\r\n\r\n var match = line.match(this.foldingStartMarker);\r\n if (match) {\r\n var i = match.index;\r\n\r\n if (match[1])\r\n return this.openingBracketBlock(session, match[1], row, i);\r\n\r\n var range = session.getCommentFoldRange(row, i + match[0].length, 1);\r\n\r\n if (range && !range.isMultiLine()) {\r\n if (forceMultiline) {\r\n range = this.getSectionRange(session, row);\r\n } else if (foldStyle != \"all\")\r\n range = null;\r\n }\r\n\r\n return range;\r\n }\r\n\r\n if (foldStyle === \"markbegin\")\r\n return;\r\n\r\n var match = line.match(this.foldingStopMarker);\r\n if (match) {\r\n var i = match.index + match[0].length;\r\n\r\n if (match[1])\r\n return this.closingBracketBlock(session, match[1], row, i);\r\n\r\n return session.getCommentFoldRange(row, i, -1);\r\n }\r\n };\r\n\r\n this.getSectionRange = function(session, row) {\r\n var line = session.getLine(row);\r\n var startIndent = line.search(/\\S/);\r\n var startRow = row;\r\n var startColumn = line.length;\r\n row = row + 1;\r\n var endRow = row;\r\n var maxRow = session.getLength();\r\n while (++row < maxRow) {\r\n line = session.getLine(row);\r\n var indent = line.search(/\\S/);\r\n if (indent === -1)\r\n continue;\r\n if (startIndent > indent)\r\n break;\r\n var subRange = this.getFoldWidgetRange(session, \"all\", row);\r\n\r\n if (subRange) {\r\n if (subRange.start.row <= startRow) {\r\n break;\r\n } else if (subRange.isMultiLine()) {\r\n row = subRange.end.row;\r\n } else if (startIndent == indent) {\r\n break;\r\n }\r\n }\r\n endRow = row;\r\n }\r\n\r\n return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);\r\n };\r\n this.getCommentRegionBlock = function(session, line, row) {\r\n var startColumn = line.search(/\\s*$/);\r\n var maxRow = session.getLength();\r\n var startRow = row;\r\n\r\n var re = /^\\s*(?:\\/\\*|\\/\\/|--)#?(end)?region\\b/;\r\n var depth = 1;\r\n while (++row < maxRow) {\r\n line = session.getLine(row);\r\n var m = re.exec(line);\r\n if (!m) continue;\r\n if (m[1]) depth--;\r\n else depth++;\r\n\r\n if (!depth) break;\r\n }\r\n\r\n var endRow = row;\r\n if (endRow > startRow) {\r\n return new Range(startRow, startColumn, endRow, line.length);\r\n }\r\n };\r\n\r\n}).call(FoldMode.prototype);\r\n\r\n});\r\n\r\nace.define(\"ace/mode/netscript\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text\",\"ace/mode/netscript_highlight_rules\",\"ace/mode/matching_brace_outdent\",\"ace/worker/worker_client\",\"ace/mode/behaviour/cstyle\",\"ace/mode/folding/cstyle\"], function(acequire, exports, module) {\r\n\"use strict\";\r\n\r\nvar oop = acequire(\"../lib/oop\");\r\nvar TextMode = acequire(\"./text\").Mode;\r\nvar NetscriptHighlightRules = acequire(\"./netscript_highlight_rules\").NetscriptHighlightRules;\r\nvar MatchingBraceOutdent = acequire(\"./matching_brace_outdent\").MatchingBraceOutdent;\r\nvar WorkerClient = acequire(\"../worker/worker_client\").WorkerClient;\r\nvar CstyleBehaviour = acequire(\"./behaviour/cstyle\").CstyleBehaviour;\r\nvar CStyleFoldMode = acequire(\"./folding/cstyle\").FoldMode;\r\n\r\nvar Mode = function() {\r\n this.HighlightRules = NetscriptHighlightRules;\r\n\r\n this.$outdent = new MatchingBraceOutdent();\r\n this.$behaviour = new CstyleBehaviour();\r\n this.foldingRules = new CStyleFoldMode();\r\n};\r\noop.inherits(Mode, TextMode);\r\n\r\n(function() {\r\n\r\n this.lineCommentStart = \"//\";\r\n this.blockComment = {start: \"/*\", end: \"*/\"};\r\n\r\n this.getNextLineIndent = function(state, line, tab) {\r\n var indent = this.$getIndent(line);\r\n\r\n var tokenizedLine = this.getTokenizer().getLineTokens(line, state);\r\n var tokens = tokenizedLine.tokens;\r\n var endState = tokenizedLine.state;\r\n\r\n if (tokens.length && tokens[tokens.length-1].type == \"comment\") {\r\n return indent;\r\n }\r\n\r\n if (state == \"start\" || state == \"no_regex\") {\r\n var match = line.match(/^.*(?:\\bcase\\b.*:|[\\{\\(\\[])\\s*$/);\r\n if (match) {\r\n indent += tab;\r\n }\r\n } else if (state == \"doc-start\") {\r\n if (endState == \"start\" || endState == \"no_regex\") {\r\n return \"\";\r\n }\r\n var match = line.match(/^\\s*(\\/?)\\*/);\r\n if (match) {\r\n if (match[1]) {\r\n indent += \" \";\r\n }\r\n indent += \"* \";\r\n }\r\n }\r\n\r\n return indent;\r\n };\r\n\r\n this.checkOutdent = function(state, line, input) {\r\n return this.$outdent.checkOutdent(line, input);\r\n };\r\n\r\n this.autoOutdent = function(state, doc, row) {\r\n this.$outdent.autoOutdent(doc, row);\r\n };\r\n\r\n this.createWorker = function(session) {\r\n var worker = new WorkerClient([\"ace\"], require(\"brace/worker/javascript\"), \"JavaScriptWorker\");\r\n worker.attachToDocument(session.getDocument());\r\n\r\n worker.on(\"annotate\", function(results) {\r\n session.setAnnotations(results.data);\r\n });\r\n\r\n worker.on(\"terminate\", function() {\r\n session.clearAnnotations();\r\n });\r\n\r\n return worker;\r\n };\r\n\r\n this.$id = \"ace/mode/netscript\";\r\n}).call(Mode.prototype);\r\n\r\nexports.Mode = Mode;\r\n});\r\n","ace.define(\"ace/mode/doc_comment_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text_highlight_rules\"], function(acequire, exports, module) {\n\"use strict\";\n\nvar oop = acequire(\"../lib/oop\");\nvar TextHighlightRules = acequire(\"./text_highlight_rules\").TextHighlightRules;\n\nvar DocCommentHighlightRules = function() {\n this.$rules = {\n \"start\" : [ {\n token : \"comment.doc.tag\",\n regex : \"@[\\\\w\\\\d_]+\" // TODO: fix email addresses\n }, \n DocCommentHighlightRules.getTagRule(),\n {\n defaultToken : \"comment.doc\",\n caseInsensitive: true\n }]\n };\n};\n\noop.inherits(DocCommentHighlightRules, TextHighlightRules);\n\nDocCommentHighlightRules.getTagRule = function(start) {\n return {\n token : \"comment.doc.tag.storage.type\",\n regex : \"\\\\b(?:TODO|FIXME|XXX|HACK)\\\\b\"\n };\n};\n\nDocCommentHighlightRules.getStartRule = function(start) {\n return {\n token : \"comment.doc\", // doc comment\n regex : \"\\\\/\\\\*(?=\\\\*)\",\n next : start\n };\n};\n\nDocCommentHighlightRules.getEndRule = function (start) {\n return {\n token : \"comment.doc\", // closing comment\n regex : \"\\\\*\\\\/\",\n next : start\n };\n};\n\n\nexports.DocCommentHighlightRules = DocCommentHighlightRules;\n\n});\n\nace.define(\"ace/mode/javascript_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/doc_comment_highlight_rules\",\"ace/mode/text_highlight_rules\"], function(acequire, exports, module) {\n\"use strict\";\n\nvar oop = acequire(\"../lib/oop\");\nvar DocCommentHighlightRules = acequire(\"./doc_comment_highlight_rules\").DocCommentHighlightRules;\nvar TextHighlightRules = acequire(\"./text_highlight_rules\").TextHighlightRules;\nvar identifierRe = \"[a-zA-Z\\\\$_\\u00a1-\\uffff][a-zA-Z\\\\d\\\\$_\\u00a1-\\uffff]*\";\n\nvar JavaScriptHighlightRules = function(options) {\n var keywordMapper = this.createKeywordMapper({\n \"variable.language\":\n \"Array|Boolean|Date|Function|Iterator|Number|Object|RegExp|String|Proxy|\" + // Constructors\n \"Namespace|QName|XML|XMLList|\" + // E4X\n \"ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|\" +\n \"Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray|\" +\n \"Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|\" + // Errors\n \"SyntaxError|TypeError|URIError|\" +\n \"decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|eval|isFinite|\" + // Non-constructor functions\n \"isNaN|parseFloat|parseInt|\" +\n \"JSON|Math|\" + // Other\n \"this|arguments|prototype|window|document\" , // Pseudo\n \"keyword\":\n \"const|yield|import|get|set|async|await|\" +\n \"break|case|catch|continue|default|delete|do|else|finally|for|function|\" +\n \"if|in|of|instanceof|new|return|switch|throw|try|typeof|let|var|while|with|debugger|\" +\n \"__parent__|__count__|escape|unescape|with|__proto__|\" +\n \"class|enum|extends|super|export|implements|private|public|interface|package|protected|static\",\n \"storage.type\":\n \"const|let|var|function\",\n \"constant.language\":\n \"null|Infinity|NaN|undefined\",\n \"support.function\":\n \"alert\",\n \"constant.language.boolean\": \"true|false\"\n }, \"identifier\");\n var kwBeforeRe = \"case|do|else|finally|in|instanceof|return|throw|try|typeof|yield|void\";\n\n var escapedRe = \"\\\\\\\\(?:x[0-9a-fA-F]{2}|\" + // hex\n \"u[0-9a-fA-F]{4}|\" + // unicode\n \"u{[0-9a-fA-F]{1,6}}|\" + // es6 unicode\n \"[0-2][0-7]{0,2}|\" + // oct\n \"3[0-7][0-7]?|\" + // oct\n \"[4-7][0-7]?|\" + //oct\n \".)\";\n\n this.$rules = {\n \"no_regex\" : [\n DocCommentHighlightRules.getStartRule(\"doc-start\"),\n comments(\"no_regex\"),\n {\n token : \"string\",\n regex : \"'(?=.)\",\n next : \"qstring\"\n }, {\n token : \"string\",\n regex : '\"(?=.)',\n next : \"qqstring\"\n }, {\n token : \"constant.numeric\", // hexadecimal, octal and binary\n regex : /0(?:[xX][0-9a-fA-F]+|[oO][0-7]+|[bB][01]+)\\b/\n }, {\n token : \"constant.numeric\", // decimal integers and floats\n regex : /(?:\\d\\d*(?:\\.\\d*)?|\\.\\d+)(?:[eE][+-]?\\d+\\b)?/\n }, {\n token : [\n \"storage.type\", \"punctuation.operator\", \"support.function\",\n \"punctuation.operator\", \"entity.name.function\", \"text\",\"keyword.operator\"\n ],\n regex : \"(\" + identifierRe + \")(\\\\.)(prototype)(\\\\.)(\" + identifierRe +\")(\\\\s*)(=)\",\n next: \"function_arguments\"\n }, {\n token : [\n \"storage.type\", \"punctuation.operator\", \"entity.name.function\", \"text\",\n \"keyword.operator\", \"text\", \"storage.type\", \"text\", \"paren.lparen\"\n ],\n regex : \"(\" + identifierRe + \")(\\\\.)(\" + identifierRe +\")(\\\\s*)(=)(\\\\s*)(function)(\\\\s*)(\\\\()\",\n next: \"function_arguments\"\n }, {\n token : [\n \"entity.name.function\", \"text\", \"keyword.operator\", \"text\", \"storage.type\",\n \"text\", \"paren.lparen\"\n ],\n regex : \"(\" + identifierRe +\")(\\\\s*)(=)(\\\\s*)(function)(\\\\s*)(\\\\()\",\n next: \"function_arguments\"\n }, {\n token : [\n \"storage.type\", \"punctuation.operator\", \"entity.name.function\", \"text\",\n \"keyword.operator\", \"text\",\n \"storage.type\", \"text\", \"entity.name.function\", \"text\", \"paren.lparen\"\n ],\n regex : \"(\" + identifierRe + \")(\\\\.)(\" + identifierRe +\")(\\\\s*)(=)(\\\\s*)(function)(\\\\s+)(\\\\w+)(\\\\s*)(\\\\()\",\n next: \"function_arguments\"\n }, {\n token : [\n \"storage.type\", \"text\", \"entity.name.function\", \"text\", \"paren.lparen\"\n ],\n regex : \"(function)(\\\\s+)(\" + identifierRe + \")(\\\\s*)(\\\\()\",\n next: \"function_arguments\"\n }, {\n token : [\n \"entity.name.function\", \"text\", \"punctuation.operator\",\n \"text\", \"storage.type\", \"text\", \"paren.lparen\"\n ],\n regex : \"(\" + identifierRe + \")(\\\\s*)(:)(\\\\s*)(function)(\\\\s*)(\\\\()\",\n next: \"function_arguments\"\n }, {\n token : [\n \"text\", \"text\", \"storage.type\", \"text\", \"paren.lparen\"\n ],\n regex : \"(:)(\\\\s*)(function)(\\\\s*)(\\\\()\",\n next: \"function_arguments\"\n }, {\n token : \"keyword\",\n regex : \"from(?=\\\\s*('|\\\"))\"\n }, {\n token : \"keyword\",\n regex : \"(?:\" + kwBeforeRe + \")\\\\b\",\n next : \"start\"\n }, {\n token : [\"support.constant\"],\n regex : /that\\b/\n }, {\n token : [\"storage.type\", \"punctuation.operator\", \"support.function.firebug\"],\n regex : /(console)(\\.)(warn|info|log|error|time|trace|timeEnd|assert)\\b/\n }, {\n token : keywordMapper,\n regex : identifierRe\n }, {\n token : \"punctuation.operator\",\n regex : /[.](?![.])/,\n next : \"property\"\n }, {\n token : \"storage.type\",\n regex : /=>/\n }, {\n token : \"keyword.operator\",\n regex : /--|\\+\\+|\\.{3}|===|==|=|!=|!==|<+=?|>+=?|!|&&|\\|\\||\\?:|[!$%&*+\\-~\\/^]=?/,\n next : \"start\"\n }, {\n token : \"punctuation.operator\",\n regex : /[?:,;.]/,\n next : \"start\"\n }, {\n token : \"paren.lparen\",\n regex : /[\\[({]/,\n next : \"start\"\n }, {\n token : \"paren.rparen\",\n regex : /[\\])}]/\n }, {\n token: \"comment\",\n regex: /^#!.*$/\n }\n ],\n property: [{\n token : \"text\",\n regex : \"\\\\s+\"\n }, {\n token : [\n \"storage.type\", \"punctuation.operator\", \"entity.name.function\", \"text\",\n \"keyword.operator\", \"text\",\n \"storage.type\", \"text\", \"entity.name.function\", \"text\", \"paren.lparen\"\n ],\n regex : \"(\" + identifierRe + \")(\\\\.)(\" + identifierRe +\")(\\\\s*)(=)(\\\\s*)(function)(?:(\\\\s+)(\\\\w+))?(\\\\s*)(\\\\()\",\n next: \"function_arguments\"\n }, {\n token : \"punctuation.operator\",\n regex : /[.](?![.])/\n }, {\n token : \"support.function\",\n regex : /(s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\\b(?=\\()/\n }, {\n token : \"support.function.dom\",\n regex : /(s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName|ClassName)|ById)|Attribute(?:Node)?)|blur)\\b(?=\\()/\n }, {\n token : \"support.constant\",\n regex : /(s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\\b/\n }, {\n token : \"identifier\",\n regex : identifierRe\n }, {\n regex: \"\",\n token: \"empty\",\n next: \"no_regex\"\n }\n ],\n \"start\": [\n DocCommentHighlightRules.getStartRule(\"doc-start\"),\n comments(\"start\"),\n {\n token: \"string.regexp\",\n regex: \"\\\\/\",\n next: \"regex\"\n }, {\n token : \"text\",\n regex : \"\\\\s+|^$\",\n next : \"start\"\n }, {\n token: \"empty\",\n regex: \"\",\n next: \"no_regex\"\n }\n ],\n \"regex\": [\n {\n token: \"regexp.keyword.operator\",\n regex: \"\\\\\\\\(?:u[\\\\da-fA-F]{4}|x[\\\\da-fA-F]{2}|.)\"\n }, {\n token: \"string.regexp\",\n regex: \"/[sxngimy]*\",\n next: \"no_regex\"\n }, {\n token : \"invalid\",\n regex: /\\{\\d+\\b,?\\d*\\}[+*]|[+*$^?][+*]|[$^][?]|\\?{3,}/\n }, {\n token : \"constant.language.escape\",\n regex: /\\(\\?[:=!]|\\)|\\{\\d+\\b,?\\d*\\}|[+*]\\?|[()$^+*?.]/\n }, {\n token : \"constant.language.delimiter\",\n regex: /\\|/\n }, {\n token: \"constant.language.escape\",\n regex: /\\[\\^?/,\n next: \"regex_character_class\"\n }, {\n token: \"empty\",\n regex: \"$\",\n next: \"no_regex\"\n }, {\n defaultToken: \"string.regexp\"\n }\n ],\n \"regex_character_class\": [\n {\n token: \"regexp.charclass.keyword.operator\",\n regex: \"\\\\\\\\(?:u[\\\\da-fA-F]{4}|x[\\\\da-fA-F]{2}|.)\"\n }, {\n token: \"constant.language.escape\",\n regex: \"]\",\n next: \"regex\"\n }, {\n token: \"constant.language.escape\",\n regex: \"-\"\n }, {\n token: \"empty\",\n regex: \"$\",\n next: \"no_regex\"\n }, {\n defaultToken: \"string.regexp.charachterclass\"\n }\n ],\n \"function_arguments\": [\n {\n token: \"variable.parameter\",\n regex: identifierRe\n }, {\n token: \"punctuation.operator\",\n regex: \"[, ]+\"\n }, {\n token: \"punctuation.operator\",\n regex: \"$\"\n }, {\n token: \"empty\",\n regex: \"\",\n next: \"no_regex\"\n }\n ],\n \"qqstring\" : [\n {\n token : \"constant.language.escape\",\n regex : escapedRe\n }, {\n token : \"string\",\n regex : \"\\\\\\\\$\",\n consumeLineEnd : true\n }, {\n token : \"string\",\n regex : '\"|$',\n next : \"no_regex\"\n }, {\n defaultToken: \"string\"\n }\n ],\n \"qstring\" : [\n {\n token : \"constant.language.escape\",\n regex : escapedRe\n }, {\n token : \"string\",\n regex : \"\\\\\\\\$\",\n consumeLineEnd : true\n }, {\n token : \"string\",\n regex : \"'|$\",\n next : \"no_regex\"\n }, {\n defaultToken: \"string\"\n }\n ]\n };\n\n\n if (!options || !options.noES6) {\n this.$rules.no_regex.unshift({\n regex: \"[{}]\", onMatch: function(val, state, stack) {\n this.next = val == \"{\" ? this.nextState : \"\";\n if (val == \"{\" && stack.length) {\n stack.unshift(\"start\", state);\n }\n else if (val == \"}\" && stack.length) {\n stack.shift();\n this.next = stack.shift();\n if (this.next.indexOf(\"string\") != -1 || this.next.indexOf(\"jsx\") != -1)\n return \"paren.quasi.end\";\n }\n return val == \"{\" ? \"paren.lparen\" : \"paren.rparen\";\n },\n nextState: \"start\"\n }, {\n token : \"string.quasi.start\",\n regex : /`/,\n push : [{\n token : \"constant.language.escape\",\n regex : escapedRe\n }, {\n token : \"paren.quasi.start\",\n regex : /\\${/,\n push : \"start\"\n }, {\n token : \"string.quasi.end\",\n regex : /`/,\n next : \"pop\"\n }, {\n defaultToken: \"string.quasi\"\n }]\n });\n\n if (!options || options.jsx != false)\n JSX.call(this);\n }\n\n this.embedRules(DocCommentHighlightRules, \"doc-\",\n [ DocCommentHighlightRules.getEndRule(\"no_regex\") ]);\n\n this.normalizeRules();\n};\n\noop.inherits(JavaScriptHighlightRules, TextHighlightRules);\n\nfunction JSX() {\n var tagRegex = identifierRe.replace(\"\\\\d\", \"\\\\d\\\\-\");\n var jsxTag = {\n onMatch : function(val, state, stack) {\n var offset = val.charAt(1) == \"/\" ? 2 : 1;\n if (offset == 1) {\n if (state != this.nextState)\n stack.unshift(this.next, this.nextState, 0);\n else\n stack.unshift(this.next);\n stack[2]++;\n } else if (offset == 2) {\n if (state == this.nextState) {\n stack[1]--;\n if (!stack[1] || stack[1] < 0) {\n stack.shift();\n stack.shift();\n }\n }\n }\n return [{\n type: \"meta.tag.punctuation.\" + (offset == 1 ? \"\" : \"end-\") + \"tag-open.xml\",\n value: val.slice(0, offset)\n }, {\n type: \"meta.tag.tag-name.xml\",\n value: val.substr(offset)\n }];\n },\n regex : \"</?\" + tagRegex + \"\",\n next: \"jsxAttributes\",\n nextState: \"jsx\"\n };\n this.$rules.start.unshift(jsxTag);\n var jsxJsRule = {\n regex: \"{\",\n token: \"paren.quasi.start\",\n push: \"start\"\n };\n this.$rules.jsx = [\n jsxJsRule,\n jsxTag,\n {include : \"reference\"},\n {defaultToken: \"string\"}\n ];\n this.$rules.jsxAttributes = [{\n token : \"meta.tag.punctuation.tag-close.xml\",\n regex : \"/?>\",\n onMatch : function(value, currentState, stack) {\n if (currentState == stack[0])\n stack.shift();\n if (value.length == 2) {\n if (stack[0] == this.nextState)\n stack[1]--;\n if (!stack[1] || stack[1] < 0) {\n stack.splice(0, 2);\n }\n }\n this.next = stack[0] || \"start\";\n return [{type: this.token, value: value}];\n },\n nextState: \"jsx\"\n },\n jsxJsRule,\n comments(\"jsxAttributes\"),\n {\n token : \"entity.other.attribute-name.xml\",\n regex : tagRegex\n }, {\n token : \"keyword.operator.attribute-equals.xml\",\n regex : \"=\"\n }, {\n token : \"text.tag-whitespace.xml\",\n regex : \"\\\\s+\"\n }, {\n token : \"string.attribute-value.xml\",\n regex : \"'\",\n stateName : \"jsx_attr_q\",\n push : [\n {token : \"string.attribute-value.xml\", regex: \"'\", next: \"pop\"},\n {include : \"reference\"},\n {defaultToken : \"string.attribute-value.xml\"}\n ]\n }, {\n token : \"string.attribute-value.xml\",\n regex : '\"',\n stateName : \"jsx_attr_qq\",\n push : [\n {token : \"string.attribute-value.xml\", regex: '\"', next: \"pop\"},\n {include : \"reference\"},\n {defaultToken : \"string.attribute-value.xml\"}\n ]\n },\n jsxTag\n ];\n this.$rules.reference = [{\n token : \"constant.language.escape.reference.xml\",\n regex : \"(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\\\.-]+;)\"\n }];\n}\n\nfunction comments(next) {\n return [\n {\n token : \"comment\", // multi line comment\n regex : /\\/\\*/,\n next: [\n DocCommentHighlightRules.getTagRule(),\n {token : \"comment\", regex : \"\\\\*\\\\/\", next : next || \"pop\"},\n {defaultToken : \"comment\", caseInsensitive: true}\n ]\n }, {\n token : \"comment\",\n regex : \"\\\\/\\\\/\",\n next: [\n DocCommentHighlightRules.getTagRule(),\n {token : \"comment\", regex : \"$|^\", next : next || \"pop\"},\n {defaultToken : \"comment\", caseInsensitive: true}\n ]\n }\n ];\n}\nexports.JavaScriptHighlightRules = JavaScriptHighlightRules;\n});\n\nace.define(\"ace/mode/matching_brace_outdent\",[\"require\",\"exports\",\"module\",\"ace/range\"], function(acequire, exports, module) {\n\"use strict\";\n\nvar Range = acequire(\"../range\").Range;\n\nvar MatchingBraceOutdent = function() {};\n\n(function() {\n\n this.checkOutdent = function(line, input) {\n if (! /^\\s+$/.test(line))\n return false;\n\n return /^\\s*\\}/.test(input);\n };\n\n this.autoOutdent = function(doc, row) {\n var line = doc.getLine(row);\n var match = line.match(/^(\\s*\\})/);\n\n if (!match) return 0;\n\n var column = match[1].length;\n var openBracePos = doc.findMatchingBracket({row: row, column: column});\n\n if (!openBracePos || openBracePos.row == row) return 0;\n\n var indent = this.$getIndent(doc.getLine(openBracePos.row));\n doc.replace(new Range(row, 0, row, column-1), indent);\n };\n\n this.$getIndent = function(line) {\n return line.match(/^\\s*/)[0];\n };\n\n}).call(MatchingBraceOutdent.prototype);\n\nexports.MatchingBraceOutdent = MatchingBraceOutdent;\n});\n\nace.define(\"ace/mode/folding/cstyle\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/range\",\"ace/mode/folding/fold_mode\"], function(acequire, exports, module) {\n\"use strict\";\n\nvar oop = acequire(\"../../lib/oop\");\nvar Range = acequire(\"../../range\").Range;\nvar BaseFoldMode = acequire(\"./fold_mode\").FoldMode;\n\nvar FoldMode = exports.FoldMode = function(commentRegex) {\n if (commentRegex) {\n this.foldingStartMarker = new RegExp(\n this.foldingStartMarker.source.replace(/\\|[^|]*?$/, \"|\" + commentRegex.start)\n );\n this.foldingStopMarker = new RegExp(\n this.foldingStopMarker.source.replace(/\\|[^|]*?$/, \"|\" + commentRegex.end)\n );\n }\n};\noop.inherits(FoldMode, BaseFoldMode);\n\n(function() {\n \n this.foldingStartMarker = /([\\{\\[\\(])[^\\}\\]\\)]*$|^\\s*(\\/\\*)/;\n this.foldingStopMarker = /^[^\\[\\{\\(]*([\\}\\]\\)])|^[\\s\\*]*(\\*\\/)/;\n this.singleLineBlockCommentRe= /^\\s*(\\/\\*).*\\*\\/\\s*$/;\n this.tripleStarBlockCommentRe = /^\\s*(\\/\\*\\*\\*).*\\*\\/\\s*$/;\n this.startRegionRe = /^\\s*(\\/\\*|\\/\\/)#?region\\b/;\n this._getFoldWidgetBase = this.getFoldWidget;\n this.getFoldWidget = function(session, foldStyle, row) {\n var line = session.getLine(row);\n \n if (this.singleLineBlockCommentRe.test(line)) {\n if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line))\n return \"\";\n }\n \n var fw = this._getFoldWidgetBase(session, foldStyle, row);\n \n if (!fw && this.startRegionRe.test(line))\n return \"start\"; // lineCommentRegionStart\n \n return fw;\n };\n\n this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) {\n var line = session.getLine(row);\n \n if (this.startRegionRe.test(line))\n return this.getCommentRegionBlock(session, line, row);\n \n var match = line.match(this.foldingStartMarker);\n if (match) {\n var i = match.index;\n\n if (match[1])\n return this.openingBracketBlock(session, match[1], row, i);\n \n var range = session.getCommentFoldRange(row, i + match[0].length, 1);\n \n if (range && !range.isMultiLine()) {\n if (forceMultiline) {\n range = this.getSectionRange(session, row);\n } else if (foldStyle != \"all\")\n range = null;\n }\n \n return range;\n }\n\n if (foldStyle === \"markbegin\")\n return;\n\n var match = line.match(this.foldingStopMarker);\n if (match) {\n var i = match.index + match[0].length;\n\n if (match[1])\n return this.closingBracketBlock(session, match[1], row, i);\n\n return session.getCommentFoldRange(row, i, -1);\n }\n };\n \n this.getSectionRange = function(session, row) {\n var line = session.getLine(row);\n var startIndent = line.search(/\\S/);\n var startRow = row;\n var startColumn = line.length;\n row = row + 1;\n var endRow = row;\n var maxRow = session.getLength();\n while (++row < maxRow) {\n line = session.getLine(row);\n var indent = line.search(/\\S/);\n if (indent === -1)\n continue;\n if (startIndent > indent)\n break;\n var subRange = this.getFoldWidgetRange(session, \"all\", row);\n \n if (subRange) {\n if (subRange.start.row <= startRow) {\n break;\n } else if (subRange.isMultiLine()) {\n row = subRange.end.row;\n } else if (startIndent == indent) {\n break;\n }\n }\n endRow = row;\n }\n \n return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);\n };\n this.getCommentRegionBlock = function(session, line, row) {\n var startColumn = line.search(/\\s*$/);\n var maxRow = session.getLength();\n var startRow = row;\n \n var re = /^\\s*(?:\\/\\*|\\/\\/|--)#?(end)?region\\b/;\n var depth = 1;\n while (++row < maxRow) {\n line = session.getLine(row);\n var m = re.exec(line);\n if (!m) continue;\n if (m[1]) depth--;\n else depth++;\n\n if (!depth) break;\n }\n\n var endRow = row;\n if (endRow > startRow) {\n return new Range(startRow, startColumn, endRow, line.length);\n }\n };\n\n}).call(FoldMode.prototype);\n\n});\n\nace.define(\"ace/mode/javascript\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text\",\"ace/mode/javascript_highlight_rules\",\"ace/mode/matching_brace_outdent\",\"ace/worker/worker_client\",\"ace/mode/behaviour/cstyle\",\"ace/mode/folding/cstyle\"], function(acequire, exports, module) {\n\"use strict\";\n\nvar oop = acequire(\"../lib/oop\");\nvar TextMode = acequire(\"./text\").Mode;\nvar JavaScriptHighlightRules = acequire(\"./javascript_highlight_rules\").JavaScriptHighlightRules;\nvar MatchingBraceOutdent = acequire(\"./matching_brace_outdent\").MatchingBraceOutdent;\nvar WorkerClient = acequire(\"../worker/worker_client\").WorkerClient;\nvar CstyleBehaviour = acequire(\"./behaviour/cstyle\").CstyleBehaviour;\nvar CStyleFoldMode = acequire(\"./folding/cstyle\").FoldMode;\n\nvar Mode = function() {\n this.HighlightRules = JavaScriptHighlightRules;\n \n this.$outdent = new MatchingBraceOutdent();\n this.$behaviour = new CstyleBehaviour();\n this.foldingRules = new CStyleFoldMode();\n};\noop.inherits(Mode, TextMode);\n\n(function() {\n\n this.lineCommentStart = \"//\";\n this.blockComment = {start: \"/*\", end: \"*/\"};\n this.$quotes = {'\"': '\"', \"'\": \"'\", \"`\": \"`\"};\n\n this.getNextLineIndent = function(state, line, tab) {\n var indent = this.$getIndent(line);\n\n var tokenizedLine = this.getTokenizer().getLineTokens(line, state);\n var tokens = tokenizedLine.tokens;\n var endState = tokenizedLine.state;\n\n if (tokens.length && tokens[tokens.length-1].type == \"comment\") {\n return indent;\n }\n\n if (state == \"start\" || state == \"no_regex\") {\n var match = line.match(/^.*(?:\\bcase\\b.*:|[\\{\\(\\[])\\s*$/);\n if (match) {\n indent += tab;\n }\n } else if (state == \"doc-start\") {\n if (endState == \"start\" || endState == \"no_regex\") {\n return \"\";\n }\n var match = line.match(/^\\s*(\\/?)\\*/);\n if (match) {\n if (match[1]) {\n indent += \" \";\n }\n indent += \"* \";\n }\n }\n\n return indent;\n };\n\n this.checkOutdent = function(state, line, input) {\n return this.$outdent.checkOutdent(line, input);\n };\n\n this.autoOutdent = function(state, doc, row) {\n this.$outdent.autoOutdent(doc, row);\n };\n\n this.createWorker = function(session) {\n var worker = new WorkerClient([\"ace\"], require(\"../worker/javascript\"), \"JavaScriptWorker\");\n worker.attachToDocument(session.getDocument());\n\n worker.on(\"annotate\", function(results) {\n session.setAnnotations(results.data);\n });\n\n worker.on(\"terminate\", function() {\n session.clearAnnotations();\n });\n\n return worker;\n };\n\n this.$id = \"ace/mode/javascript\";\n}).call(Mode.prototype);\n\nexports.Mode = Mode;\n});\n","/* ***** BEGIN LICENSE BLOCK *****\n * Distributed under the BSD license:\n *\n * Copyright (c) 2010, Ajax.org B.V.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright\n * notice, this list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright\n * notice, this list of conditions and the following disclaimer in the\n * documentation and/or other materials provided with the distribution.\n * * Neither the name of Ajax.org B.V. nor the\n * names of its contributors may be used to endorse or promote products\n * derived from this software without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\n * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY\n * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\n * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\n * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n *\n * ***** END LICENSE BLOCK ***** */\n\n/**\n * Define a module along with a payload\n * @param module a name for the payload\n * @param payload a function to call with (acequire, exports, module) params\n */\n\n(function() {\n\nvar ACE_NAMESPACE = \"ace\";\n\nvar global = (function() { return this; })();\nif (!global && typeof window != \"undefined\") global = window; // strict mode\n\n\nif (!ACE_NAMESPACE && typeof acequirejs !== \"undefined\")\n return;\n\n\nvar define = function(module, deps, payload) {\n if (typeof module !== \"string\") {\n if (define.original)\n define.original.apply(this, arguments);\n else {\n console.error(\"dropping module because define wasn\\'t a string.\");\n console.trace();\n }\n return;\n }\n if (arguments.length == 2)\n payload = deps;\n if (!define.modules[module]) {\n define.payloads[module] = payload;\n define.modules[module] = null;\n }\n};\n\ndefine.modules = {};\ndefine.payloads = {};\n\n/**\n * Get at functionality define()ed using the function above\n */\nvar _acequire = function(parentId, module, callback) {\n if (typeof module === \"string\") {\n var payload = lookup(parentId, module);\n if (payload != undefined) {\n callback && callback();\n return payload;\n }\n } else if (Object.prototype.toString.call(module) === \"[object Array]\") {\n var params = [];\n for (var i = 0, l = module.length; i < l; ++i) {\n var dep = lookup(parentId, module[i]);\n if (dep == undefined && acequire.original)\n return;\n params.push(dep);\n }\n return callback && callback.apply(null, params) || true;\n }\n};\n\nvar acequire = function(module, callback) {\n var packagedModule = _acequire(\"\", module, callback);\n if (packagedModule == undefined && acequire.original)\n return acequire.original.apply(this, arguments);\n return packagedModule;\n};\n\nvar normalizeModule = function(parentId, moduleName) {\n // normalize plugin acequires\n if (moduleName.indexOf(\"!\") !== -1) {\n var chunks = moduleName.split(\"!\");\n return normalizeModule(parentId, chunks[0]) + \"!\" + normalizeModule(parentId, chunks[1]);\n }\n // normalize relative acequires\n if (moduleName.charAt(0) == \".\") {\n var base = parentId.split(\"/\").slice(0, -1).join(\"/\");\n moduleName = base + \"/\" + moduleName;\n\n while(moduleName.indexOf(\".\") !== -1 && previous != moduleName) {\n var previous = moduleName;\n moduleName = moduleName.replace(/\\/\\.\\//, \"/\").replace(/[^\\/]+\\/\\.\\.\\//, \"\");\n }\n }\n return moduleName;\n};\n\n/**\n * Internal function to lookup moduleNames and resolve them by calling the\n * definition function if needed.\n */\nvar lookup = function(parentId, moduleName) {\n moduleName = normalizeModule(parentId, moduleName);\n\n var module = define.modules[moduleName];\n if (!module) {\n module = define.payloads[moduleName];\n if (typeof module === 'function') {\n var exports = {};\n var mod = {\n id: moduleName,\n uri: '',\n exports: exports,\n packaged: true\n };\n\n var req = function(module, callback) {\n return _acequire(moduleName, module, callback);\n };\n\n var returnValue = module(req, exports, mod);\n exports = returnValue || mod.exports;\n define.modules[moduleName] = exports;\n delete define.payloads[moduleName];\n }\n module = define.modules[moduleName] = exports || module;\n }\n return module;\n};\n\nfunction exportAce(ns) {\n var root = global;\n if (ns) {\n if (!global[ns])\n global[ns] = {};\n root = global[ns];\n }\n\n if (!root.define || !root.define.packaged) {\n define.original = root.define;\n root.define = define;\n root.define.packaged = true;\n }\n\n if (!root.acequire || !root.acequire.packaged) {\n acequire.original = root.acequire;\n root.acequire = acequire;\n root.acequire.packaged = true;\n }\n}\n\nexportAce(ACE_NAMESPACE);\n\n})();\n\nace.define(\"ace/lib/regexp\",[\"require\",\"exports\",\"module\"], function(acequire, exports, module) {\n\"use strict\";\n\n var real = {\n exec: RegExp.prototype.exec,\n test: RegExp.prototype.test,\n match: String.prototype.match,\n replace: String.prototype.replace,\n split: String.prototype.split\n },\n compliantExecNpcg = real.exec.call(/()??/, \"\")[1] === undefined, // check `exec` handling of nonparticipating capturing groups\n compliantLastIndexIncrement = function () {\n var x = /^/g;\n real.test.call(x, \"\");\n return !x.lastIndex;\n }();\n\n if (compliantLastIndexIncrement && compliantExecNpcg)\n return;\n RegExp.prototype.exec = function (str) {\n var match = real.exec.apply(this, arguments),\n name, r2;\n if ( typeof(str) == 'string' && match) {\n if (!compliantExecNpcg && match.length > 1 && indexOf(match, \"\") > -1) {\n r2 = RegExp(this.source, real.replace.call(getNativeFlags(this), \"g\", \"\"));\n real.replace.call(str.slice(match.index), r2, function () {\n for (var i = 1; i < arguments.length - 2; i++) {\n if (arguments[i] === undefined)\n match[i] = undefined;\n }\n });\n }\n if (this._xregexp && this._xregexp.captureNames) {\n for (var i = 1; i < match.length; i++) {\n name = this._xregexp.captureNames[i - 1];\n if (name)\n match[name] = match[i];\n }\n }\n if (!compliantLastIndexIncrement && this.global && !match[0].length && (this.lastIndex > match.index))\n this.lastIndex--;\n }\n return match;\n };\n if (!compliantLastIndexIncrement) {\n RegExp.prototype.test = function (str) {\n var match = real.exec.call(this, str);\n if (match && this.global && !match[0].length && (this.lastIndex > match.index))\n this.lastIndex--;\n return !!match;\n };\n }\n\n function getNativeFlags (regex) {\n return (regex.global ? \"g\" : \"\") +\n (regex.ignoreCase ? \"i\" : \"\") +\n (regex.multiline ? \"m\" : \"\") +\n (regex.extended ? \"x\" : \"\") + // Proposed for ES4; included in AS3\n (regex.sticky ? \"y\" : \"\");\n }\n\n function indexOf (array, item, from) {\n if (Array.prototype.indexOf) // Use the native array method if available\n return array.indexOf(item, from);\n for (var i = from || 0; i < array.length; i++) {\n if (array[i] === item)\n return i;\n }\n return -1;\n }\n\n});\n\nace.define(\"ace/lib/es5-shim\",[\"require\",\"exports\",\"module\"], function(acequire, exports, module) {\n\nfunction Empty() {}\n\nif (!Function.prototype.bind) {\n Function.prototype.bind = function bind(that) { // .length is 1\n var target = this;\n if (typeof target != \"function\") {\n throw new TypeError(\"Function.prototype.bind called on incompatible \" + target);\n }\n var args = slice.call(arguments, 1); // for normal call\n var bound = function () {\n\n if (this instanceof bound) {\n\n var result = target.apply(\n this,\n args.concat(slice.call(arguments))\n );\n if (Object(result) === result) {\n return result;\n }\n return this;\n\n } else {\n return target.apply(\n that,\n args.concat(slice.call(arguments))\n );\n\n }\n\n };\n if(target.prototype) {\n Empty.prototype = target.prototype;\n bound.prototype = new Empty();\n Empty.prototype = null;\n }\n return bound;\n };\n}\nvar call = Function.prototype.call;\nvar prototypeOfArray = Array.prototype;\nvar prototypeOfObject = Object.prototype;\nvar slice = prototypeOfArray.slice;\nvar _toString = call.bind(prototypeOfObject.toString);\nvar owns = call.bind(prototypeOfObject.hasOwnProperty);\nvar defineGetter;\nvar defineSetter;\nvar lookupGetter;\nvar lookupSetter;\nvar supportsAccessors;\nif ((supportsAccessors = owns(prototypeOfObject, \"__defineGetter__\"))) {\n defineGetter = call.bind(prototypeOfObject.__defineGetter__);\n defineSetter = call.bind(prototypeOfObject.__defineSetter__);\n lookupGetter = call.bind(prototypeOfObject.__lookupGetter__);\n lookupSetter = call.bind(prototypeOfObject.__lookupSetter__);\n}\nif ([1,2].splice(0).length != 2) {\n if(function() { // test IE < 9 to splice bug - see issue #138\n function makeArray(l) {\n var a = new Array(l+2);\n a[0] = a[1] = 0;\n return a;\n }\n var array = [], lengthBefore;\n \n array.splice.apply(array, makeArray(20));\n array.splice.apply(array, makeArray(26));\n\n lengthBefore = array.length; //46\n array.splice(5, 0, \"XXX\"); // add one element\n\n lengthBefore + 1 == array.length\n\n if (lengthBefore + 1 == array.length) {\n return true;// has right splice implementation without bugs\n }\n }()) {//IE 6/7\n var array_splice = Array.prototype.splice;\n Array.prototype.splice = function(start, deleteCount) {\n if (!arguments.length) {\n return [];\n } else {\n return array_splice.apply(this, [\n start === void 0 ? 0 : start,\n deleteCount === void 0 ? (this.length - start) : deleteCount\n ].concat(slice.call(arguments, 2)))\n }\n };\n } else {//IE8\n Array.prototype.splice = function(pos, removeCount){\n var length = this.length;\n if (pos > 0) {\n if (pos > length)\n pos = length;\n } else if (pos == void 0) {\n pos = 0;\n } else if (pos < 0) {\n pos = Math.max(length + pos, 0);\n }\n\n if (!(pos+removeCount < length))\n removeCount = length - pos;\n\n var removed = this.slice(pos, pos+removeCount);\n var insert = slice.call(arguments, 2);\n var add = insert.length; \n if (pos === length) {\n if (add) {\n this.push.apply(this, insert);\n }\n } else {\n var remove = Math.min(removeCount, length - pos);\n var tailOldPos = pos + remove;\n var tailNewPos = tailOldPos + add - remove;\n var tailCount = length - tailOldPos;\n var lengthAfterRemove = length - remove;\n\n if (tailNewPos < tailOldPos) { // case A\n for (var i = 0; i < tailCount; ++i) {\n this[tailNewPos+i] = this[tailOldPos+i];\n }\n } else if (tailNewPos > tailOldPos) { // case B\n for (i = tailCount; i--; ) {\n this[tailNewPos+i] = this[tailOldPos+i];\n }\n } // else, add == remove (nothing to do)\n\n if (add && pos === lengthAfterRemove) {\n this.length = lengthAfterRemove; // truncate array\n this.push.apply(this, insert);\n } else {\n this.length = lengthAfterRemove + add; // reserves space\n for (i = 0; i < add; ++i) {\n this[pos+i] = insert[i];\n }\n }\n }\n return removed;\n };\n }\n}\nif (!Array.isArray) {\n Array.isArray = function isArray(obj) {\n return _toString(obj) == \"[object Array]\";\n };\n}\nvar boxedString = Object(\"a\"),\n splitString = boxedString[0] != \"a\" || !(0 in boxedString);\n\nif (!Array.prototype.forEach) {\n Array.prototype.forEach = function forEach(fun /*, thisp*/) {\n var object = toObject(this),\n self = splitString && _toString(this) == \"[object String]\" ?\n this.split(\"\") :\n object,\n thisp = arguments[1],\n i = -1,\n length = self.length >>> 0;\n if (_toString(fun) != \"[object Function]\") {\n throw new TypeError(); // TODO message\n }\n\n while (++i < length) {\n if (i in self) {\n fun.call(thisp, self[i], i, object);\n }\n }\n };\n}\nif (!Array.prototype.map) {\n Array.prototype.map = function map(fun /*, thisp*/) {\n var object = toObject(this),\n self = splitString && _toString(this) == \"[object String]\" ?\n this.split(\"\") :\n object,\n length = self.length >>> 0,\n result = Array(length),\n thisp = arguments[1];\n if (_toString(fun) != \"[object Function]\") {\n throw new TypeError(fun + \" is not a function\");\n }\n\n for (var i = 0; i < length; i++) {\n if (i in self)\n result[i] = fun.call(thisp, self[i], i, object);\n }\n return result;\n };\n}\nif (!Array.prototype.filter) {\n Array.prototype.filter = function filter(fun /*, thisp */) {\n var object = toObject(this),\n self = splitString && _toString(this) == \"[object String]\" ?\n this.split(\"\") :\n object,\n length = self.length >>> 0,\n result = [],\n value,\n thisp = arguments[1];\n if (_toString(fun) != \"[object Function]\") {\n throw new TypeError(fun + \" is not a function\");\n }\n\n for (var i = 0; i < length; i++) {\n if (i in self) {\n value = self[i];\n if (fun.call(thisp, value, i, object)) {\n result.push(value);\n }\n }\n }\n return result;\n };\n}\nif (!Array.prototype.every) {\n Array.prototype.every = function every(fun /*, thisp */) {\n var object = toObject(this),\n self = splitString && _toString(this) == \"[object String]\" ?\n this.split(\"\") :\n object,\n length = self.length >>> 0,\n thisp = arguments[1];\n if (_toString(fun) != \"[object Function]\") {\n throw new TypeError(fun + \" is not a function\");\n }\n\n for (var i = 0; i < length; i++) {\n if (i in self && !fun.call(thisp, self[i], i, object)) {\n return false;\n }\n }\n return true;\n };\n}\nif (!Array.prototype.some) {\n Array.prototype.some = function some(fun /*, thisp */) {\n var object = toObject(this),\n self = splitString && _toString(this) == \"[object String]\" ?\n this.split(\"\") :\n object,\n length = self.length >>> 0,\n thisp = arguments[1];\n if (_toString(fun) != \"[object Function]\") {\n throw new TypeError(fun + \" is not a function\");\n }\n\n for (var i = 0; i < length; i++) {\n if (i in self && fun.call(thisp, self[i], i, object)) {\n return true;\n }\n }\n return false;\n };\n}\nif (!Array.prototype.reduce) {\n Array.prototype.reduce = function reduce(fun /*, initial*/) {\n var object = toObject(this),\n self = splitString && _toString(this) == \"[object String]\" ?\n this.split(\"\") :\n object,\n length = self.length >>> 0;\n if (_toString(fun) != \"[object Function]\") {\n throw new TypeError(fun + \" is not a function\");\n }\n if (!length && arguments.length == 1) {\n throw new TypeError(\"reduce of empty array with no initial value\");\n }\n\n var i = 0;\n var result;\n if (arguments.length >= 2) {\n result = arguments[1];\n } else {\n do {\n if (i in self) {\n result = self[i++];\n break;\n }\n if (++i >= length) {\n throw new TypeError(\"reduce of empty array with no initial value\");\n }\n } while (true);\n }\n\n for (; i < length; i++) {\n if (i in self) {\n result = fun.call(void 0, result, self[i], i, object);\n }\n }\n\n return result;\n };\n}\nif (!Array.prototype.reduceRight) {\n Array.prototype.reduceRight = function reduceRight(fun /*, initial*/) {\n var object = toObject(this),\n self = splitString && _toString(this) == \"[object String]\" ?\n this.split(\"\") :\n object,\n length = self.length >>> 0;\n if (_toString(fun) != \"[object Function]\") {\n throw new TypeError(fun + \" is not a function\");\n }\n if (!length && arguments.length == 1) {\n throw new TypeError(\"reduceRight of empty array with no initial value\");\n }\n\n var result, i = length - 1;\n if (arguments.length >= 2) {\n result = arguments[1];\n } else {\n do {\n if (i in self) {\n result = self[i--];\n break;\n }\n if (--i < 0) {\n throw new TypeError(\"reduceRight of empty array with no initial value\");\n }\n } while (true);\n }\n\n do {\n if (i in this) {\n result = fun.call(void 0, result, self[i], i, object);\n }\n } while (i--);\n\n return result;\n };\n}\nif (!Array.prototype.indexOf || ([0, 1].indexOf(1, 2) != -1)) {\n Array.prototype.indexOf = function indexOf(sought /*, fromIndex */ ) {\n var self = splitString && _toString(this) == \"[object String]\" ?\n this.split(\"\") :\n toObject(this),\n length = self.length >>> 0;\n\n if (!length) {\n return -1;\n }\n\n var i = 0;\n if (arguments.length > 1) {\n i = toInteger(arguments[1]);\n }\n i = i >= 0 ? i : Math.max(0, length + i);\n for (; i < length; i++) {\n if (i in self && self[i] === sought) {\n return i;\n }\n }\n return -1;\n };\n}\nif (!Array.prototype.lastIndexOf || ([0, 1].lastIndexOf(0, -3) != -1)) {\n Array.prototype.lastIndexOf = function lastIndexOf(sought /*, fromIndex */) {\n var self = splitString && _toString(this) == \"[object String]\" ?\n this.split(\"\") :\n toObject(this),\n length = self.length >>> 0;\n\n if (!length) {\n return -1;\n }\n var i = length - 1;\n if (arguments.length > 1) {\n i = Math.min(i, toInteger(arguments[1]));\n }\n i = i >= 0 ? i : length - Math.abs(i);\n for (; i >= 0; i--) {\n if (i in self && sought === self[i]) {\n return i;\n }\n }\n return -1;\n };\n}\nif (!Object.getPrototypeOf) {\n Object.getPrototypeOf = function getPrototypeOf(object) {\n return object.__proto__ || (\n object.constructor ?\n object.constructor.prototype :\n prototypeOfObject\n );\n };\n}\nif (!Object.getOwnPropertyDescriptor) {\n var ERR_NON_OBJECT = \"Object.getOwnPropertyDescriptor called on a \" +\n \"non-object: \";\n Object.getOwnPropertyDescriptor = function getOwnPropertyDescriptor(object, property) {\n if ((typeof object != \"object\" && typeof object != \"function\") || object === null)\n throw new TypeError(ERR_NON_OBJECT + object);\n if (!owns(object, property))\n return;\n\n var descriptor, getter, setter;\n descriptor = { enumerable: true, configurable: true };\n if (supportsAccessors) {\n var prototype = object.__proto__;\n object.__proto__ = prototypeOfObject;\n\n var getter = lookupGetter(object, property);\n var setter = lookupSetter(object, property);\n object.__proto__ = prototype;\n\n if (getter || setter) {\n if (getter) descriptor.get = getter;\n if (setter) descriptor.set = setter;\n return descriptor;\n }\n }\n descriptor.value = object[property];\n return descriptor;\n };\n}\nif (!Object.getOwnPropertyNames) {\n Object.getOwnPropertyNames = function getOwnPropertyNames(object) {\n return Object.keys(object);\n };\n}\nif (!Object.create) {\n var createEmpty;\n if (Object.prototype.__proto__ === null) {\n createEmpty = function () {\n return { \"__proto__\": null };\n };\n } else {\n createEmpty = function () {\n var empty = {};\n for (var i in empty)\n empty[i] = null;\n empty.constructor =\n empty.hasOwnProperty =\n empty.propertyIsEnumerable =\n empty.isPrototypeOf =\n empty.toLocaleString =\n empty.toString =\n empty.valueOf =\n empty.__proto__ = null;\n return empty;\n }\n }\n\n Object.create = function create(prototype, properties) {\n var object;\n if (prototype === null) {\n object = createEmpty();\n } else {\n if (typeof prototype != \"object\")\n throw new TypeError(\"typeof prototype[\"+(typeof prototype)+\"] != 'object'\");\n var Type = function () {};\n Type.prototype = prototype;\n object = new Type();\n object.__proto__ = prototype;\n }\n if (properties !== void 0)\n Object.defineProperties(object, properties);\n return object;\n };\n}\n\nfunction doesDefinePropertyWork(object) {\n try {\n Object.defineProperty(object, \"sentinel\", {});\n return \"sentinel\" in object;\n } catch (exception) {\n }\n}\nif (Object.defineProperty) {\n var definePropertyWorksOnObject = doesDefinePropertyWork({});\n var definePropertyWorksOnDom = typeof document == \"undefined\" ||\n doesDefinePropertyWork(document.createElement(\"div\"));\n if (!definePropertyWorksOnObject || !definePropertyWorksOnDom) {\n var definePropertyFallback = Object.defineProperty;\n }\n}\n\nif (!Object.defineProperty || definePropertyFallback) {\n var ERR_NON_OBJECT_DESCRIPTOR = \"Property description must be an object: \";\n var ERR_NON_OBJECT_TARGET = \"Object.defineProperty called on non-object: \"\n var ERR_ACCESSORS_NOT_SUPPORTED = \"getters & setters can not be defined \" +\n \"on this javascript engine\";\n\n Object.defineProperty = function defineProperty(object, property, descriptor) {\n if ((typeof object != \"object\" && typeof object != \"function\") || object === null)\n throw new TypeError(ERR_NON_OBJECT_TARGET + object);\n if ((typeof descriptor != \"object\" && typeof descriptor != \"function\") || descriptor === null)\n throw new TypeError(ERR_NON_OBJECT_DESCRIPTOR + descriptor);\n if (definePropertyFallback) {\n try {\n return definePropertyFallback.call(Object, object, property, descriptor);\n } catch (exception) {\n }\n }\n if (owns(descriptor, \"value\")) {\n\n if (supportsAccessors && (lookupGetter(object, property) ||\n lookupSetter(object, property)))\n {\n var prototype = object.__proto__;\n object.__proto__ = prototypeOfObject;\n delete object[property];\n object[property] = descriptor.value;\n object.__proto__ = prototype;\n } else {\n object[property] = descriptor.value;\n }\n } else {\n if (!supportsAccessors)\n throw new TypeError(ERR_ACCESSORS_NOT_SUPPORTED);\n if (owns(descriptor, \"get\"))\n defineGetter(object, property, descriptor.get);\n if (owns(descriptor, \"set\"))\n defineSetter(object, property, descriptor.set);\n }\n\n return object;\n };\n}\nif (!Object.defineProperties) {\n Object.defineProperties = function defineProperties(object, properties) {\n for (var property in properties) {\n if (owns(properties, property))\n Object.defineProperty(object, property, properties[property]);\n }\n return object;\n };\n}\nif (!Object.seal) {\n Object.seal = function seal(object) {\n return object;\n };\n}\nif (!Object.freeze) {\n Object.freeze = function freeze(object) {\n return object;\n };\n}\ntry {\n Object.freeze(function () {});\n} catch (exception) {\n Object.freeze = (function freeze(freezeObject) {\n return function freeze(object) {\n if (typeof object == \"function\") {\n return object;\n } else {\n return freezeObject(object);\n }\n };\n })(Object.freeze);\n}\nif (!Object.preventExtensions) {\n Object.preventExtensions = function preventExtensions(object) {\n return object;\n };\n}\nif (!Object.isSealed) {\n Object.isSealed = function isSealed(object) {\n return false;\n };\n}\nif (!Object.isFrozen) {\n Object.isFrozen = function isFrozen(object) {\n return false;\n };\n}\nif (!Object.isExtensible) {\n Object.isExtensible = function isExtensible(object) {\n if (Object(object) === object) {\n throw new TypeError(); // TODO message\n }\n var name = '';\n while (owns(object, name)) {\n name += '?';\n }\n object[name] = true;\n var returnValue = owns(object, name);\n delete object[name];\n return returnValue;\n };\n}\nif (!Object.keys) {\n var hasDontEnumBug = true,\n dontEnums = [\n \"toString\",\n \"toLocaleString\",\n \"valueOf\",\n \"hasOwnProperty\",\n \"isPrototypeOf\",\n \"propertyIsEnumerable\",\n \"constructor\"\n ],\n dontEnumsLength = dontEnums.length;\n\n for (var key in {\"toString\": null}) {\n hasDontEnumBug = false;\n }\n\n Object.keys = function keys(object) {\n\n if (\n (typeof object != \"object\" && typeof object != \"function\") ||\n object === null\n ) {\n throw new TypeError(\"Object.keys called on a non-object\");\n }\n\n var keys = [];\n for (var name in object) {\n if (owns(object, name)) {\n keys.push(name);\n }\n }\n\n if (hasDontEnumBug) {\n for (var i = 0, ii = dontEnumsLength; i < ii; i++) {\n var dontEnum = dontEnums[i];\n if (owns(object, dontEnum)) {\n keys.push(dontEnum);\n }\n }\n }\n return keys;\n };\n\n}\nif (!Date.now) {\n Date.now = function now() {\n return new Date().getTime();\n };\n}\nvar ws = \"\\x09\\x0A\\x0B\\x0C\\x0D\\x20\\xA0\\u1680\\u180E\\u2000\\u2001\\u2002\\u2003\" +\n \"\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200A\\u202F\\u205F\\u3000\\u2028\" +\n \"\\u2029\\uFEFF\";\nif (!String.prototype.trim || ws.trim()) {\n ws = \"[\" + ws + \"]\";\n var trimBeginRegexp = new RegExp(\"^\" + ws + ws + \"*\"),\n trimEndRegexp = new RegExp(ws + ws + \"*$\");\n String.prototype.trim = function trim() {\n return String(this).replace(trimBeginRegexp, \"\").replace(trimEndRegexp, \"\");\n };\n}\n\nfunction toInteger(n) {\n n = +n;\n if (n !== n) { // isNaN\n n = 0;\n } else if (n !== 0 && n !== (1/0) && n !== -(1/0)) {\n n = (n > 0 || -1) * Math.floor(Math.abs(n));\n }\n return n;\n}\n\nfunction isPrimitive(input) {\n var type = typeof input;\n return (\n input === null ||\n type === \"undefined\" ||\n type === \"boolean\" ||\n type === \"number\" ||\n type === \"string\"\n );\n}\n\nfunction toPrimitive(input) {\n var val, valueOf, toString;\n if (isPrimitive(input)) {\n return input;\n }\n valueOf = input.valueOf;\n if (typeof valueOf === \"function\") {\n val = valueOf.call(input);\n if (isPrimitive(val)) {\n return val;\n }\n }\n toString = input.toString;\n if (typeof toString === \"function\") {\n val = toString.call(input);\n if (isPrimitive(val)) {\n return val;\n }\n }\n throw new TypeError();\n}\nvar toObject = function (o) {\n if (o == null) { // this matches both null and undefined\n throw new TypeError(\"can't convert \"+o+\" to object\");\n }\n return Object(o);\n};\n\n});\n\nace.define(\"ace/lib/fixoldbrowsers\",[\"require\",\"exports\",\"module\",\"ace/lib/regexp\",\"ace/lib/es5-shim\"], function(acequire, exports, module) {\n\"use strict\";\n\nacequire(\"./regexp\");\nacequire(\"./es5-shim\");\n\n});\n\nace.define(\"ace/lib/dom\",[\"require\",\"exports\",\"module\"], function(acequire, exports, module) {\n\"use strict\";\n\nvar XHTML_NS = \"http://www.w3.org/1999/xhtml\";\n\nexports.getDocumentHead = function(doc) {\n if (!doc)\n doc = document;\n return doc.head || doc.getElementsByTagName(\"head\")[0] || doc.documentElement;\n};\n\nexports.createElement = function(tag, ns) {\n return document.createElementNS ?\n document.createElementNS(ns || XHTML_NS, tag) :\n document.createElement(tag);\n};\n\nexports.hasCssClass = function(el, name) {\n var classes = (el.className + \"\").split(/\\s+/g);\n return classes.indexOf(name) !== -1;\n};\nexports.addCssClass = function(el, name) {\n if (!exports.hasCssClass(el, name)) {\n el.className += \" \" + name;\n }\n};\nexports.removeCssClass = function(el, name) {\n var classes = el.className.split(/\\s+/g);\n while (true) {\n var index = classes.indexOf(name);\n if (index == -1) {\n break;\n }\n classes.splice(index, 1);\n }\n el.className = classes.join(\" \");\n};\n\nexports.toggleCssClass = function(el, name) {\n var classes = el.className.split(/\\s+/g), add = true;\n while (true) {\n var index = classes.indexOf(name);\n if (index == -1) {\n break;\n }\n add = false;\n classes.splice(index, 1);\n }\n if (add)\n classes.push(name);\n\n el.className = classes.join(\" \");\n return add;\n};\nexports.setCssClass = function(node, className, include) {\n if (include) {\n exports.addCssClass(node, className);\n } else {\n exports.removeCssClass(node, className);\n }\n};\n\nexports.hasCssString = function(id, doc) {\n var index = 0, sheets;\n doc = doc || document;\n\n if (doc.createStyleSheet && (sheets = doc.styleSheets)) {\n while (index < sheets.length)\n if (sheets[index++].owningElement.id === id) return true;\n } else if ((sheets = doc.getElementsByTagName(\"style\"))) {\n while (index < sheets.length)\n if (sheets[index++].id === id) return true;\n }\n\n return false;\n};\n\nexports.importCssString = function importCssString(cssText, id, doc) {\n doc = doc || document;\n if (id && exports.hasCssString(id, doc))\n return null;\n \n var style;\n \n if (id)\n cssText += \"\\n/*# sourceURL=ace/css/\" + id + \" */\";\n \n if (doc.createStyleSheet) {\n style = doc.createStyleSheet();\n style.cssText = cssText;\n if (id)\n style.owningElement.id = id;\n } else {\n style = exports.createElement(\"style\");\n style.appendChild(doc.createTextNode(cssText));\n if (id)\n style.id = id;\n\n exports.getDocumentHead(doc).appendChild(style);\n }\n};\n\nexports.importCssStylsheet = function(uri, doc) {\n if (doc.createStyleSheet) {\n doc.createStyleSheet(uri);\n } else {\n var link = exports.createElement('link');\n link.rel = 'stylesheet';\n link.href = uri;\n\n exports.getDocumentHead(doc).appendChild(link);\n }\n};\n\nexports.getInnerWidth = function(element) {\n return (\n parseInt(exports.computedStyle(element, \"paddingLeft\"), 10) +\n parseInt(exports.computedStyle(element, \"paddingRight\"), 10) + \n element.clientWidth\n );\n};\n\nexports.getInnerHeight = function(element) {\n return (\n parseInt(exports.computedStyle(element, \"paddingTop\"), 10) +\n parseInt(exports.computedStyle(element, \"paddingBottom\"), 10) +\n element.clientHeight\n );\n};\n\nexports.scrollbarWidth = function(document) {\n var inner = exports.createElement(\"ace_inner\");\n inner.style.width = \"100%\";\n inner.style.minWidth = \"0px\";\n inner.style.height = \"200px\";\n inner.style.display = \"block\";\n\n var outer = exports.createElement(\"ace_outer\");\n var style = outer.style;\n\n style.position = \"absolute\";\n style.left = \"-10000px\";\n style.overflow = \"hidden\";\n style.width = \"200px\";\n style.minWidth = \"0px\";\n style.height = \"150px\";\n style.display = \"block\";\n\n outer.appendChild(inner);\n\n var body = document.documentElement;\n body.appendChild(outer);\n\n var noScrollbar = inner.offsetWidth;\n\n style.overflow = \"scroll\";\n var withScrollbar = inner.offsetWidth;\n\n if (noScrollbar == withScrollbar) {\n withScrollbar = outer.clientWidth;\n }\n\n body.removeChild(outer);\n\n return noScrollbar-withScrollbar;\n};\n\nif (typeof document == \"undefined\") {\n exports.importCssString = function() {};\n return;\n}\n\nif (window.pageYOffset !== undefined) {\n exports.getPageScrollTop = function() {\n return window.pageYOffset;\n };\n\n exports.getPageScrollLeft = function() {\n return window.pageXOffset;\n };\n}\nelse {\n exports.getPageScrollTop = function() {\n return document.body.scrollTop;\n };\n\n exports.getPageScrollLeft = function() {\n return document.body.scrollLeft;\n };\n}\n\nif (window.getComputedStyle)\n exports.computedStyle = function(element, style) {\n if (style)\n return (window.getComputedStyle(element, \"\") || {})[style] || \"\";\n return window.getComputedStyle(element, \"\") || {};\n };\nelse\n exports.computedStyle = function(element, style) {\n if (style)\n return element.currentStyle[style];\n return element.currentStyle;\n };\nexports.setInnerHtml = function(el, innerHtml) {\n var element = el.cloneNode(false);//document.createElement(\"div\");\n element.innerHTML = innerHtml;\n el.parentNode.replaceChild(element, el);\n return element;\n};\n\nif (\"textContent\" in document.documentElement) {\n exports.setInnerText = function(el, innerText) {\n el.textContent = innerText;\n };\n\n exports.getInnerText = function(el) {\n return el.textContent;\n };\n}\nelse {\n exports.setInnerText = function(el, innerText) {\n el.innerText = innerText;\n };\n\n exports.getInnerText = function(el) {\n return el.innerText;\n };\n}\n\nexports.getParentWindow = function(document) {\n return document.defaultView || document.parentWindow;\n};\n\n});\n\nace.define(\"ace/lib/oop\",[\"require\",\"exports\",\"module\"], function(acequire, exports, module) {\n\"use strict\";\n\nexports.inherits = function(ctor, superCtor) {\n ctor.super_ = superCtor;\n ctor.prototype = Object.create(superCtor.prototype, {\n constructor: {\n value: ctor,\n enumerable: false,\n writable: true,\n configurable: true\n }\n });\n};\n\nexports.mixin = function(obj, mixin) {\n for (var key in mixin) {\n obj[key] = mixin[key];\n }\n return obj;\n};\n\nexports.implement = function(proto, mixin) {\n exports.mixin(proto, mixin);\n};\n\n});\n\nace.define(\"ace/lib/keys\",[\"require\",\"exports\",\"module\",\"ace/lib/fixoldbrowsers\",\"ace/lib/oop\"], function(acequire, exports, module) {\n\"use strict\";\n\nacequire(\"./fixoldbrowsers\");\n\nvar oop = acequire(\"./oop\");\nvar Keys = (function() {\n var ret = {\n MODIFIER_KEYS: {\n 16: 'Shift', 17: 'Ctrl', 18: 'Alt', 224: 'Meta'\n },\n\n KEY_MODS: {\n \"ctrl\": 1, \"alt\": 2, \"option\" : 2, \"shift\": 4,\n \"super\": 8, \"meta\": 8, \"command\": 8, \"cmd\": 8\n },\n\n FUNCTION_KEYS : {\n 8 : \"Backspace\",\n 9 : \"Tab\",\n 13 : \"Return\",\n 19 : \"Pause\",\n 27 : \"Esc\",\n 32 : \"Space\",\n 33 : \"PageUp\",\n 34 : \"PageDown\",\n 35 : \"End\",\n 36 : \"Home\",\n 37 : \"Left\",\n 38 : \"Up\",\n 39 : \"Right\",\n 40 : \"Down\",\n 44 : \"Print\",\n 45 : \"Insert\",\n 46 : \"Delete\",\n 96 : \"Numpad0\",\n 97 : \"Numpad1\",\n 98 : \"Numpad2\",\n 99 : \"Numpad3\",\n 100: \"Numpad4\",\n 101: \"Numpad5\",\n 102: \"Numpad6\",\n 103: \"Numpad7\",\n 104: \"Numpad8\",\n 105: \"Numpad9\",\n '-13': \"NumpadEnter\",\n 112: \"F1\",\n 113: \"F2\",\n 114: \"F3\",\n 115: \"F4\",\n 116: \"F5\",\n 117: \"F6\",\n 118: \"F7\",\n 119: \"F8\",\n 120: \"F9\",\n 121: \"F10\",\n 122: \"F11\",\n 123: \"F12\",\n 144: \"Numlock\",\n 145: \"Scrolllock\"\n },\n\n PRINTABLE_KEYS: {\n 32: ' ', 48: '0', 49: '1', 50: '2', 51: '3', 52: '4', 53: '5',\n 54: '6', 55: '7', 56: '8', 57: '9', 59: ';', 61: '=', 65: 'a',\n 66: 'b', 67: 'c', 68: 'd', 69: 'e', 70: 'f', 71: 'g', 72: 'h',\n 73: 'i', 74: 'j', 75: 'k', 76: 'l', 77: 'm', 78: 'n', 79: 'o',\n 80: 'p', 81: 'q', 82: 'r', 83: 's', 84: 't', 85: 'u', 86: 'v',\n 87: 'w', 88: 'x', 89: 'y', 90: 'z', 107: '+', 109: '-', 110: '.',\n 186: ';', 187: '=', 188: ',', 189: '-', 190: '.', 191: '/', 192: '`',\n 219: '[', 220: '\\\\',221: ']', 222: \"'\", 111: '/', 106: '*'\n }\n };\n var name, i;\n for (i in ret.FUNCTION_KEYS) {\n name = ret.FUNCTION_KEYS[i].toLowerCase();\n ret[name] = parseInt(i, 10);\n }\n for (i in ret.PRINTABLE_KEYS) {\n name = ret.PRINTABLE_KEYS[i].toLowerCase();\n ret[name] = parseInt(i, 10);\n }\n oop.mixin(ret, ret.MODIFIER_KEYS);\n oop.mixin(ret, ret.PRINTABLE_KEYS);\n oop.mixin(ret, ret.FUNCTION_KEYS);\n ret.enter = ret[\"return\"];\n ret.escape = ret.esc;\n ret.del = ret[\"delete\"];\n ret[173] = '-';\n \n (function() {\n var mods = [\"cmd\", \"ctrl\", \"alt\", \"shift\"];\n for (var i = Math.pow(2, mods.length); i--;) { \n ret.KEY_MODS[i] = mods.filter(function(x) {\n return i & ret.KEY_MODS[x];\n }).join(\"-\") + \"-\";\n }\n })();\n\n ret.KEY_MODS[0] = \"\";\n ret.KEY_MODS[-1] = \"input-\";\n\n return ret;\n})();\noop.mixin(exports, Keys);\n\nexports.keyCodeToString = function(keyCode) {\n var keyString = Keys[keyCode];\n if (typeof keyString != \"string\")\n keyString = String.fromCharCode(keyCode);\n return keyString.toLowerCase();\n};\n\n});\n\nace.define(\"ace/lib/useragent\",[\"require\",\"exports\",\"module\"], function(acequire, exports, module) {\n\"use strict\";\nexports.OS = {\n LINUX: \"LINUX\",\n MAC: \"MAC\",\n WINDOWS: \"WINDOWS\"\n};\nexports.getOS = function() {\n if (exports.isMac) {\n return exports.OS.MAC;\n } else if (exports.isLinux) {\n return exports.OS.LINUX;\n } else {\n return exports.OS.WINDOWS;\n }\n};\nif (typeof navigator != \"object\")\n return;\n\nvar os = (navigator.platform.match(/mac|win|linux/i) || [\"other\"])[0].toLowerCase();\nvar ua = navigator.userAgent;\nexports.isWin = (os == \"win\");\nexports.isMac = (os == \"mac\");\nexports.isLinux = (os == \"linux\");\nexports.isIE = \n (navigator.appName == \"Microsoft Internet Explorer\" || navigator.appName.indexOf(\"MSAppHost\") >= 0)\n ? parseFloat((ua.match(/(?:MSIE |Trident\\/[0-9]+[\\.0-9]+;.*rv:)([0-9]+[\\.0-9]+)/)||[])[1])\n : parseFloat((ua.match(/(?:Trident\\/[0-9]+[\\.0-9]+;.*rv:)([0-9]+[\\.0-9]+)/)||[])[1]); // for ie\n \nexports.isOldIE = exports.isIE && exports.isIE < 9;\nexports.isGecko = exports.isMozilla = (window.Controllers || window.controllers) && window.navigator.product === \"Gecko\";\nexports.isOldGecko = exports.isGecko && parseInt((ua.match(/rv:(\\d+)/)||[])[1], 10) < 4;\nexports.isOpera = window.opera && Object.prototype.toString.call(window.opera) == \"[object Opera]\";\nexports.isWebKit = parseFloat(ua.split(\"WebKit/\")[1]) || undefined;\n\nexports.isChrome = parseFloat(ua.split(\" Chrome/\")[1]) || undefined;\n\nexports.isAIR = ua.indexOf(\"AdobeAIR\") >= 0;\n\nexports.isIPad = ua.indexOf(\"iPad\") >= 0;\n\nexports.isChromeOS = ua.indexOf(\" CrOS \") >= 0;\n\nexports.isIOS = /iPad|iPhone|iPod/.test(ua) && !window.MSStream;\n\nif (exports.isIOS) exports.isMac = true;\n\n});\n\nace.define(\"ace/lib/event\",[\"require\",\"exports\",\"module\",\"ace/lib/keys\",\"ace/lib/useragent\"], function(acequire, exports, module) {\n\"use strict\";\n\nvar keys = acequire(\"./keys\");\nvar useragent = acequire(\"./useragent\");\n\nvar pressedKeys = null;\nvar ts = 0;\n\nexports.addListener = function(elem, type, callback) {\n if (elem.addEventListener) {\n return elem.addEventListener(type, callback, false);\n }\n if (elem.attachEvent) {\n var wrapper = function() {\n callback.call(elem, window.event);\n };\n callback._wrapper = wrapper;\n elem.attachEvent(\"on\" + type, wrapper);\n }\n};\n\nexports.removeListener = function(elem, type, callback) {\n if (elem.removeEventListener) {\n return elem.removeEventListener(type, callback, false);\n }\n if (elem.detachEvent) {\n elem.detachEvent(\"on\" + type, callback._wrapper || callback);\n }\n};\nexports.stopEvent = function(e) {\n exports.stopPropagation(e);\n exports.preventDefault(e);\n return false;\n};\n\nexports.stopPropagation = function(e) {\n if (e.stopPropagation)\n e.stopPropagation();\n else\n e.cancelBubble = true;\n};\n\nexports.preventDefault = function(e) {\n if (e.preventDefault)\n e.preventDefault();\n else\n e.returnValue = false;\n};\nexports.getButton = function(e) {\n if (e.type == \"dblclick\")\n return 0;\n if (e.type == \"contextmenu\" || (useragent.isMac && (e.ctrlKey && !e.altKey && !e.shiftKey)))\n return 2;\n if (e.preventDefault) {\n return e.button;\n }\n else {\n return {1:0, 2:2, 4:1}[e.button];\n }\n};\n\nexports.capture = function(el, eventHandler, releaseCaptureHandler) {\n function onMouseUp(e) {\n eventHandler && eventHandler(e);\n releaseCaptureHandler && releaseCaptureHandler(e);\n\n exports.removeListener(document, \"mousemove\", eventHandler, true);\n exports.removeListener(document, \"mouseup\", onMouseUp, true);\n exports.removeListener(document, \"dragstart\", onMouseUp, true);\n }\n\n exports.addListener(document, \"mousemove\", eventHandler, true);\n exports.addListener(document, \"mouseup\", onMouseUp, true);\n exports.addListener(document, \"dragstart\", onMouseUp, true);\n \n return onMouseUp;\n};\n\nexports.addTouchMoveListener = function (el, callback) {\n var startx, starty;\n exports.addListener(el, \"touchstart\", function (e) {\n var touches = e.touches;\n var touchObj = touches[0];\n startx = touchObj.clientX;\n starty = touchObj.clientY;\n });\n exports.addListener(el, \"touchmove\", function (e) {\n var touches = e.touches;\n if (touches.length > 1) return;\n\n var touchObj = touches[0];\n\n e.wheelX = startx - touchObj.clientX;\n e.wheelY = starty - touchObj.clientY;\n\n startx = touchObj.clientX;\n starty = touchObj.clientY;\n\n callback(e);\n });\n};\n\nexports.addMouseWheelListener = function(el, callback) {\n if (\"onmousewheel\" in el) {\n exports.addListener(el, \"mousewheel\", function(e) {\n var factor = 8;\n if (e.wheelDeltaX !== undefined) {\n e.wheelX = -e.wheelDeltaX / factor;\n e.wheelY = -e.wheelDeltaY / factor;\n } else {\n e.wheelX = 0;\n e.wheelY = -e.wheelDelta / factor;\n }\n callback(e);\n });\n } else if (\"onwheel\" in el) {\n exports.addListener(el, \"wheel\", function(e) {\n var factor = 0.35;\n switch (e.deltaMode) {\n case e.DOM_DELTA_PIXEL:\n e.wheelX = e.deltaX * factor || 0;\n e.wheelY = e.deltaY * factor || 0;\n break;\n case e.DOM_DELTA_LINE:\n case e.DOM_DELTA_PAGE:\n e.wheelX = (e.deltaX || 0) * 5;\n e.wheelY = (e.deltaY || 0) * 5;\n break;\n }\n \n callback(e);\n });\n } else {\n exports.addListener(el, \"DOMMouseScroll\", function(e) {\n if (e.axis && e.axis == e.HORIZONTAL_AXIS) {\n e.wheelX = (e.detail || 0) * 5;\n e.wheelY = 0;\n } else {\n e.wheelX = 0;\n e.wheelY = (e.detail || 0) * 5;\n }\n callback(e);\n });\n }\n};\n\nexports.addMultiMouseDownListener = function(elements, timeouts, eventHandler, callbackName) {\n var clicks = 0;\n var startX, startY, timer; \n var eventNames = {\n 2: \"dblclick\",\n 3: \"tripleclick\",\n 4: \"quadclick\"\n };\n\n function onMousedown(e) {\n if (exports.getButton(e) !== 0) {\n clicks = 0;\n } else if (e.detail > 1) {\n clicks++;\n if (clicks > 4)\n clicks = 1;\n } else {\n clicks = 1;\n }\n if (useragent.isIE) {\n var isNewClick = Math.abs(e.clientX - startX) > 5 || Math.abs(e.clientY - startY) > 5;\n if (!timer || isNewClick)\n clicks = 1;\n if (timer)\n clearTimeout(timer);\n timer = setTimeout(function() {timer = null;}, timeouts[clicks - 1] || 600);\n\n if (clicks == 1) {\n startX = e.clientX;\n startY = e.clientY;\n }\n }\n \n e._clicks = clicks;\n\n eventHandler[callbackName](\"mousedown\", e);\n\n if (clicks > 4)\n clicks = 0;\n else if (clicks > 1)\n return eventHandler[callbackName](eventNames[clicks], e);\n }\n function onDblclick(e) {\n clicks = 2;\n if (timer)\n clearTimeout(timer);\n timer = setTimeout(function() {timer = null;}, timeouts[clicks - 1] || 600);\n eventHandler[callbackName](\"mousedown\", e);\n eventHandler[callbackName](eventNames[clicks], e);\n }\n if (!Array.isArray(elements))\n elements = [elements];\n elements.forEach(function(el) {\n exports.addListener(el, \"mousedown\", onMousedown);\n if (useragent.isOldIE)\n exports.addListener(el, \"dblclick\", onDblclick);\n });\n};\n\nvar getModifierHash = useragent.isMac && useragent.isOpera && !(\"KeyboardEvent\" in window)\n ? function(e) {\n return 0 | (e.metaKey ? 1 : 0) | (e.altKey ? 2 : 0) | (e.shiftKey ? 4 : 0) | (e.ctrlKey ? 8 : 0);\n }\n : function(e) {\n return 0 | (e.ctrlKey ? 1 : 0) | (e.altKey ? 2 : 0) | (e.shiftKey ? 4 : 0) | (e.metaKey ? 8 : 0);\n };\n\nexports.getModifierString = function(e) {\n return keys.KEY_MODS[getModifierHash(e)];\n};\n\nfunction normalizeCommandKeys(callback, e, keyCode) {\n var hashId = getModifierHash(e);\n\n if (!useragent.isMac && pressedKeys) {\n if (e.getModifierState && (e.getModifierState(\"OS\") || e.getModifierState(\"Win\")))\n hashId |= 8;\n if (pressedKeys.altGr) {\n if ((3 & hashId) != 3)\n pressedKeys.altGr = 0;\n else\n return;\n }\n if (keyCode === 18 || keyCode === 17) {\n var location = \"location\" in e ? e.location : e.keyLocation;\n if (keyCode === 17 && location === 1) {\n if (pressedKeys[keyCode] == 1)\n ts = e.timeStamp;\n } else if (keyCode === 18 && hashId === 3 && location === 2) {\n var dt = e.timeStamp - ts;\n if (dt < 50)\n pressedKeys.altGr = true;\n }\n }\n }\n \n if (keyCode in keys.MODIFIER_KEYS) {\n keyCode = -1;\n }\n if (hashId & 8 && (keyCode >= 91 && keyCode <= 93)) {\n keyCode = -1;\n }\n \n if (!hashId && keyCode === 13) {\n var location = \"location\" in e ? e.location : e.keyLocation;\n if (location === 3) {\n callback(e, hashId, -keyCode);\n if (e.defaultPrevented)\n return;\n }\n }\n \n if (useragent.isChromeOS && hashId & 8) {\n callback(e, hashId, keyCode);\n if (e.defaultPrevented)\n return;\n else\n hashId &= ~8;\n }\n if (!hashId && !(keyCode in keys.FUNCTION_KEYS) && !(keyCode in keys.PRINTABLE_KEYS)) {\n return false;\n }\n \n return callback(e, hashId, keyCode);\n}\n\n\nexports.addCommandKeyListener = function(el, callback) {\n var addListener = exports.addListener;\n if (useragent.isOldGecko || (useragent.isOpera && !(\"KeyboardEvent\" in window))) {\n var lastKeyDownKeyCode = null;\n addListener(el, \"keydown\", function(e) {\n lastKeyDownKeyCode = e.keyCode;\n });\n addListener(el, \"keypress\", function(e) {\n return normalizeCommandKeys(callback, e, lastKeyDownKeyCode);\n });\n } else {\n var lastDefaultPrevented = null;\n\n addListener(el, \"keydown\", function(e) {\n pressedKeys[e.keyCode] = (pressedKeys[e.keyCode] || 0) + 1;\n var result = normalizeCommandKeys(callback, e, e.keyCode);\n lastDefaultPrevented = e.defaultPrevented;\n return result;\n });\n\n addListener(el, \"keypress\", function(e) {\n if (lastDefaultPrevented && (e.ctrlKey || e.altKey || e.shiftKey || e.metaKey)) {\n exports.stopEvent(e);\n lastDefaultPrevented = null;\n }\n });\n\n addListener(el, \"keyup\", function(e) {\n pressedKeys[e.keyCode] = null;\n });\n\n if (!pressedKeys) {\n resetPressedKeys();\n addListener(window, \"focus\", resetPressedKeys);\n }\n }\n};\nfunction resetPressedKeys() {\n pressedKeys = Object.create(null);\n}\n\nif (typeof window == \"object\" && window.postMessage && !useragent.isOldIE) {\n var postMessageId = 1;\n exports.nextTick = function(callback, win) {\n win = win || window;\n var messageName = \"zero-timeout-message-\" + postMessageId;\n exports.addListener(win, \"message\", function listener(e) {\n if (e.data == messageName) {\n exports.stopPropagation(e);\n exports.removeListener(win, \"message\", listener);\n callback();\n }\n });\n win.postMessage(messageName, \"*\");\n };\n}\n\n\nexports.nextFrame = typeof window == \"object\" && (window.requestAnimationFrame\n || window.mozRequestAnimationFrame\n || window.webkitRequestAnimationFrame\n || window.msRequestAnimationFrame\n || window.oRequestAnimationFrame);\n\nif (exports.nextFrame)\n exports.nextFrame = exports.nextFrame.bind(window);\nelse\n exports.nextFrame = function(callback) {\n setTimeout(callback, 17);\n };\n});\n\nace.define(\"ace/lib/lang\",[\"require\",\"exports\",\"module\"], function(acequire, exports, module) {\n\"use strict\";\n\nexports.last = function(a) {\n return a[a.length - 1];\n};\n\nexports.stringReverse = function(string) {\n return string.split(\"\").reverse().join(\"\");\n};\n\nexports.stringRepeat = function (string, count) {\n var result = '';\n while (count > 0) {\n if (count & 1)\n result += string;\n\n if (count >>= 1)\n string += string;\n }\n return result;\n};\n\nvar trimBeginRegexp = /^\\s\\s*/;\nvar trimEndRegexp = /\\s\\s*$/;\n\nexports.stringTrimLeft = function (string) {\n return string.replace(trimBeginRegexp, '');\n};\n\nexports.stringTrimRight = function (string) {\n return string.replace(trimEndRegexp, '');\n};\n\nexports.copyObject = function(obj) {\n var copy = {};\n for (var key in obj) {\n copy[key] = obj[key];\n }\n return copy;\n};\n\nexports.copyArray = function(array){\n var copy = [];\n for (var i=0, l=array.length; i<l; i++) {\n if (array[i] && typeof array[i] == \"object\")\n copy[i] = this.copyObject(array[i]);\n else \n copy[i] = array[i];\n }\n return copy;\n};\n\nexports.deepCopy = function deepCopy(obj) {\n if (typeof obj !== \"object\" || !obj)\n return obj;\n var copy;\n if (Array.isArray(obj)) {\n copy = [];\n for (var key = 0; key < obj.length; key++) {\n copy[key] = deepCopy(obj[key]);\n }\n return copy;\n }\n if (Object.prototype.toString.call(obj) !== \"[object Object]\")\n return obj;\n \n copy = {};\n for (var key in obj)\n copy[key] = deepCopy(obj[key]);\n return copy;\n};\n\nexports.arrayToMap = function(arr) {\n var map = {};\n for (var i=0; i<arr.length; i++) {\n map[arr[i]] = 1;\n }\n return map;\n\n};\n\nexports.createMap = function(props) {\n var map = Object.create(null);\n for (var i in props) {\n map[i] = props[i];\n }\n return map;\n};\nexports.arrayRemove = function(array, value) {\n for (var i = 0; i <= array.length; i++) {\n if (value === array[i]) {\n array.splice(i, 1);\n }\n }\n};\n\nexports.escapeRegExp = function(str) {\n return str.replace(/([.*+?^${}()|[\\]\\/\\\\])/g, '\\\\$1');\n};\n\nexports.escapeHTML = function(str) {\n return str.replace(/&/g, \"&#38;\").replace(/\"/g, \"&#34;\").replace(/'/g, \"&#39;\").replace(/</g, \"&#60;\");\n};\n\nexports.getMatchOffsets = function(string, regExp) {\n var matches = [];\n\n string.replace(regExp, function(str) {\n matches.push({\n offset: arguments[arguments.length-2],\n length: str.length\n });\n });\n\n return matches;\n};\nexports.deferredCall = function(fcn) {\n var timer = null;\n var callback = function() {\n timer = null;\n fcn();\n };\n\n var deferred = function(timeout) {\n deferred.cancel();\n timer = setTimeout(callback, timeout || 0);\n return deferred;\n };\n\n deferred.schedule = deferred;\n\n deferred.call = function() {\n this.cancel();\n fcn();\n return deferred;\n };\n\n deferred.cancel = function() {\n clearTimeout(timer);\n timer = null;\n return deferred;\n };\n \n deferred.isPending = function() {\n return timer;\n };\n\n return deferred;\n};\n\n\nexports.delayedCall = function(fcn, defaultTimeout) {\n var timer = null;\n var callback = function() {\n timer = null;\n fcn();\n };\n\n var _self = function(timeout) {\n if (timer == null)\n timer = setTimeout(callback, timeout || defaultTimeout);\n };\n\n _self.delay = function(timeout) {\n timer && clearTimeout(timer);\n timer = setTimeout(callback, timeout || defaultTimeout);\n };\n _self.schedule = _self;\n\n _self.call = function() {\n this.cancel();\n fcn();\n };\n\n _self.cancel = function() {\n timer && clearTimeout(timer);\n timer = null;\n };\n\n _self.isPending = function() {\n return timer;\n };\n\n return _self;\n};\n});\n\nace.define(\"ace/keyboard/textinput_ios\",[\"require\",\"exports\",\"module\",\"ace/lib/event\",\"ace/lib/useragent\",\"ace/lib/dom\",\"ace/lib/lang\",\"ace/lib/keys\"], function(acequire, exports, module) {\n\"use strict\";\n\nvar event = acequire(\"../lib/event\");\nvar useragent = acequire(\"../lib/useragent\");\nvar dom = acequire(\"../lib/dom\");\nvar lang = acequire(\"../lib/lang\");\nvar KEYS = acequire(\"../lib/keys\");\nvar MODS = KEYS.KEY_MODS;\nvar BROKEN_SETDATA = useragent.isChrome < 18;\nvar USE_IE_MIME_TYPE = useragent.isIE;\n\nvar TextInput = function(parentNode, host) {\n var self = this;\n var text = dom.createElement(\"textarea\");\n text.className = useragent.isIOS ? \"ace_text-input ace_text-input-ios\" : \"ace_text-input\";\n\n if (useragent.isTouchPad)\n text.setAttribute(\"x-palm-disable-auto-cap\", true);\n\n text.setAttribute(\"wrap\", \"off\");\n text.setAttribute(\"autocorrect\", \"off\");\n text.setAttribute(\"autocapitalize\", \"off\");\n text.setAttribute(\"spellcheck\", false);\n\n text.style.opacity = \"0\";\n parentNode.insertBefore(text, parentNode.firstChild);\n\n var PLACEHOLDER = \"\\n aaaa a\\n\";\n\n var copied = false;\n var cut = false;\n var pasted = false;\n var inComposition = false;\n var tempStyle = '';\n var isSelectionEmpty = true;\n try { var isFocused = document.activeElement === text; } catch(e) {}\n\n event.addListener(text, \"blur\", function(e) {\n host.onBlur(e);\n isFocused = false;\n });\n event.addListener(text, \"focus\", function(e) {\n isFocused = true;\n host.onFocus(e);\n resetSelection();\n });\n this.focus = function() {\n if (tempStyle) return text.focus();\n text.style.position = \"fixed\";\n text.focus();\n };\n this.blur = function() {\n text.blur();\n };\n this.isFocused = function() {\n return isFocused;\n };\n var syncSelection = lang.delayedCall(function() {\n isFocused && resetSelection(isSelectionEmpty);\n });\n var syncValue = lang.delayedCall(function() {\n if (!inComposition) {\n text.value = PLACEHOLDER;\n isFocused && resetSelection();\n }\n });\n\n function resetSelection(isEmpty) {\n if (inComposition)\n return;\n inComposition = true;\n\n if (inputHandler) {\n selectionStart = 0;\n selectionEnd = isEmpty ? 0 : text.value.length - 1;\n } else {\n var selectionStart = 4;\n var selectionEnd = 5;\n }\n try {\n text.setSelectionRange(selectionStart, selectionEnd);\n } catch(e) {}\n\n inComposition = false;\n }\n\n function resetValue() {\n if (inComposition)\n return;\n text.value = PLACEHOLDER;\n if (useragent.isWebKit)\n syncValue.schedule();\n }\n\n useragent.isWebKit || host.addEventListener('changeSelection', function() {\n if (host.selection.isEmpty() != isSelectionEmpty) {\n isSelectionEmpty = !isSelectionEmpty;\n syncSelection.schedule();\n }\n });\n\n resetValue();\n if (isFocused)\n host.onFocus();\n\n\n var isAllSelected = function(text) {\n return text.selectionStart === 0 && text.selectionEnd === text.value.length;\n };\n\n var onSelect = function(e) {\n if (isAllSelected(text)) {\n host.selectAll();\n resetSelection();\n } else if (inputHandler) {\n resetSelection(host.selection.isEmpty());\n }\n };\n\n var inputHandler = null;\n this.setInputHandler = function(cb) {inputHandler = cb;};\n this.getInputHandler = function() {return inputHandler;};\n var afterContextMenu = false;\n\n var sendText = function(data) {\n if (text.selectionStart === 4 && text.selectionEnd === 5) {\n return;\n }\n if (inputHandler) {\n data = inputHandler(data);\n inputHandler = null;\n }\n if (pasted) {\n resetSelection();\n if (data)\n host.onPaste(data);\n pasted = false;\n } else if (data == PLACEHOLDER.substr(0) && text.selectionStart === 4) {\n if (afterContextMenu)\n host.execCommand(\"del\", {source: \"ace\"});\n else // some versions of android do not fire keydown when pressing backspace\n host.execCommand(\"backspace\", {source: \"ace\"});\n } else if (!copied) {\n if (data.substring(0, 9) == PLACEHOLDER && data.length > PLACEHOLDER.length)\n data = data.substr(9);\n else if (data.substr(0, 4) == PLACEHOLDER.substr(0, 4))\n data = data.substr(4, data.length - PLACEHOLDER.length + 1);\n else if (data.charAt(data.length - 1) == PLACEHOLDER.charAt(0))\n data = data.slice(0, -1);\n if (data == PLACEHOLDER.charAt(0)) {\n } else if (data.charAt(data.length - 1) == PLACEHOLDER.charAt(0))\n data = data.slice(0, -1);\n\n if (data)\n host.onTextInput(data);\n }\n if (copied) {\n copied = false;\n }\n if (afterContextMenu)\n afterContextMenu = false;\n };\n var onInput = function(e) {\n if (inComposition)\n return;\n var data = text.value;\n sendText(data);\n resetValue();\n };\n\n var handleClipboardData = function(e, data, forceIEMime) {\n var clipboardData = e.clipboardData || window.clipboardData;\n if (!clipboardData || BROKEN_SETDATA)\n return;\n var mime = USE_IE_MIME_TYPE || forceIEMime ? \"Text\" : \"text/plain\";\n try {\n if (data) {\n return clipboardData.setData(mime, data) !== false;\n } else {\n return clipboardData.getData(mime);\n }\n } catch(e) {\n if (!forceIEMime)\n return handleClipboardData(e, data, true);\n }\n };\n\n var doCopy = function(e, isCut) {\n var data = host.getCopyText();\n if (!data)\n return event.preventDefault(e);\n\n if (handleClipboardData(e, data)) {\n if (useragent.isIOS) {\n cut = isCut;\n text.value = \"\\n aa\" + data + \"a a\\n\";\n text.setSelectionRange(4, 4 + data.length);\n copied = {\n value: data\n };\n }\n isCut ? host.onCut() : host.onCopy();\n if (!useragent.isIOS) event.preventDefault(e);\n } else {\n copied = true;\n text.value = data;\n text.select();\n setTimeout(function(){\n copied = false;\n resetValue();\n resetSelection();\n isCut ? host.onCut() : host.onCopy();\n });\n }\n };\n\n var onCut = function(e) {\n doCopy(e, true);\n };\n\n var onCopy = function(e) {\n doCopy(e, false);\n };\n\n var onPaste = function(e) {\n var data = handleClipboardData(e);\n if (typeof data == \"string\") {\n if (data)\n host.onPaste(data, e);\n if (useragent.isIE)\n setTimeout(resetSelection);\n event.preventDefault(e);\n }\n else {\n text.value = \"\";\n pasted = true;\n }\n };\n\n event.addCommandKeyListener(text, host.onCommandKey.bind(host));\n\n event.addListener(text, \"select\", onSelect);\n\n event.addListener(text, \"input\", onInput);\n\n event.addListener(text, \"cut\", onCut);\n event.addListener(text, \"copy\", onCopy);\n event.addListener(text, \"paste\", onPaste);\n var onCompositionStart = function(e) {\n if (inComposition || !host.onCompositionStart || host.$readOnly)\n return;\n inComposition = {};\n inComposition.canUndo = host.session.$undoManager;\n host.onCompositionStart();\n setTimeout(onCompositionUpdate, 0);\n host.on(\"mousedown\", onCompositionEnd);\n if (inComposition.canUndo && !host.selection.isEmpty()) {\n host.insert(\"\");\n host.session.markUndoGroup();\n host.selection.clearSelection();\n }\n host.session.markUndoGroup();\n };\n\n var onCompositionUpdate = function() {\n if (!inComposition || !host.onCompositionUpdate || host.$readOnly)\n return;\n var val = text.value.replace(/\\x01/g, \"\");\n if (inComposition.lastValue === val) return;\n\n host.onCompositionUpdate(val);\n if (inComposition.lastValue)\n host.undo();\n if (inComposition.canUndo)\n inComposition.lastValue = val;\n if (inComposition.lastValue) {\n var r = host.selection.getRange();\n host.insert(inComposition.lastValue);\n host.session.markUndoGroup();\n inComposition.range = host.selection.getRange();\n host.selection.setRange(r);\n host.selection.clearSelection();\n }\n };\n\n var onCompositionEnd = function(e) {\n if (!host.onCompositionEnd || host.$readOnly) return;\n var c = inComposition;\n inComposition = false;\n var timer = setTimeout(function() {\n timer = null;\n var str = text.value.replace(/\\x01/g, \"\");\n if (inComposition)\n return;\n else if (str == c.lastValue)\n resetValue();\n else if (!c.lastValue && str) {\n resetValue();\n sendText(str);\n }\n });\n inputHandler = function compositionInputHandler(str) {\n if (timer)\n clearTimeout(timer);\n str = str.replace(/\\x01/g, \"\");\n if (str == c.lastValue)\n return \"\";\n if (c.lastValue && timer)\n host.undo();\n return str;\n };\n host.onCompositionEnd();\n host.removeListener(\"mousedown\", onCompositionEnd);\n if (e.type == \"compositionend\" && c.range) {\n host.selection.setRange(c.range);\n }\n var needsOnInput =\n (!!useragent.isChrome && useragent.isChrome >= 53) ||\n (!!useragent.isWebKit && useragent.isWebKit >= 603);\n\n if (needsOnInput) {\n onInput();\n }\n };\n\n\n\n var syncComposition = lang.delayedCall(onCompositionUpdate, 50);\n\n event.addListener(text, \"compositionstart\", onCompositionStart);\n if (useragent.isGecko) {\n event.addListener(text, \"text\", function(){syncComposition.schedule();});\n } else {\n event.addListener(text, \"keyup\", function(){syncComposition.schedule();});\n event.addListener(text, \"keydown\", function(){syncComposition.schedule();});\n }\n event.addListener(text, \"compositionend\", onCompositionEnd);\n\n this.getElement = function() {\n return text;\n };\n\n this.setReadOnly = function(readOnly) {\n text.readOnly = readOnly;\n };\n\n this.onContextMenu = function(e) {\n afterContextMenu = true;\n resetSelection(host.selection.isEmpty());\n host._emit(\"nativecontextmenu\", {target: host, domEvent: e});\n this.moveToMouse(e, true);\n };\n\n this.moveToMouse = function(e, bringToFront) {\n if (!tempStyle)\n tempStyle = text.style.cssText;\n text.style.cssText = (bringToFront ? \"z-index:100000;\" : \"\")\n + \"height:\" + text.style.height + \";\"\n + (useragent.isIE ? \"opacity:0.1;\" : \"\");\n\n var rect = host.container.getBoundingClientRect();\n var style = dom.computedStyle(host.container);\n var top = rect.top + (parseInt(style.borderTopWidth) || 0);\n var left = rect.left + (parseInt(rect.borderLeftWidth) || 0);\n var maxTop = rect.bottom - top - text.clientHeight -2;\n var move = function(e) {\n text.style.left = e.clientX - left - 2 + \"px\";\n text.style.top = Math.min(e.clientY - top - 2, maxTop) + \"px\";\n };\n move(e);\n\n if (e.type != \"mousedown\")\n return;\n\n if (host.renderer.$keepTextAreaAtCursor)\n host.renderer.$keepTextAreaAtCursor = null;\n\n clearTimeout(closeTimeout);\n if (useragent.isWin)\n event.capture(host.container, move, onContextMenuClose);\n };\n\n this.onContextMenuClose = onContextMenuClose;\n var closeTimeout;\n function onContextMenuClose() {\n clearTimeout(closeTimeout);\n closeTimeout = setTimeout(function () {\n if (tempStyle) {\n text.style.cssText = tempStyle;\n tempStyle = '';\n }\n if (host.renderer.$keepTextAreaAtCursor == null) {\n host.renderer.$keepTextAreaAtCursor = true;\n host.renderer.$moveTextAreaToCursor();\n }\n }, 0);\n }\n\n var onContextMenu = function(e) {\n host.textInput.onContextMenu(e);\n onContextMenuClose();\n };\n event.addListener(text, \"mouseup\", onContextMenu);\n event.addListener(text, \"mousedown\", function(e) {\n e.preventDefault();\n onContextMenuClose();\n });\n event.addListener(host.renderer.scroller, \"contextmenu\", onContextMenu);\n event.addListener(text, \"contextmenu\", onContextMenu);\n\n if (useragent.isIOS) {\n var typingResetTimeout = null;\n var typing = false;\n\n parentNode.addEventListener(\"keydown\", function (e) {\n if (typingResetTimeout) clearTimeout(typingResetTimeout);\n typing = true;\n });\n\n parentNode.addEventListener(\"keyup\", function (e) {\n typingResetTimeout = setTimeout(function () {\n typing = false;\n }, 100);\n });\n var detectArrowKeys = function(e) {\n if (document.activeElement !== text) return;\n if (typing) return;\n\n if (cut) {\n return setTimeout(function () {\n cut = false;\n }, 100);\n }\n var selectionStart = text.selectionStart;\n var selectionEnd = text.selectionEnd;\n text.setSelectionRange(4, 5);\n if (selectionStart == selectionEnd) {\n switch (selectionStart) {\n case 0: host.onCommandKey(null, 0, KEYS.up); break;\n case 1: host.onCommandKey(null, 0, KEYS.home); break;\n case 2: host.onCommandKey(null, MODS.option, KEYS.left); break;\n case 4: host.onCommandKey(null, 0, KEYS.left); break;\n case 5: host.onCommandKey(null, 0, KEYS.right); break;\n case 7: host.onCommandKey(null, MODS.option, KEYS.right); break;\n case 8: host.onCommandKey(null, 0, KEYS.end); break;\n case 9: host.onCommandKey(null, 0, KEYS.down); break;\n }\n } else {\n switch (selectionEnd) {\n case 6: host.onCommandKey(null, MODS.shift, KEYS.right); break;\n case 7: host.onCommandKey(null, MODS.shift | MODS.option, KEYS.right); break;\n case 8: host.onCommandKey(null, MODS.shift, KEYS.end); break;\n case 9: host.onCommandKey(null, MODS.shift, KEYS.down); break;\n }\n switch (selectionStart) {\n case 0: host.onCommandKey(null, MODS.shift, KEYS.up); break;\n case 1: host.onCommandKey(null, MODS.shift, KEYS.home); break;\n case 2: host.onCommandKey(null, MODS.shift | MODS.option, KEYS.left); break;\n case 3: host.onCommandKey(null, MODS.shift, KEYS.left); break;\n }\n }\n };\n document.addEventListener(\"selectionchange\", detectArrowKeys);\n host.on(\"destroy\", function() {\n document.removeEventListener(\"selectionchange\", detectArrowKeys);\n });\n }\n};\n\nexports.TextInput = TextInput;\n});\n\nace.define(\"ace/keyboard/textinput\",[\"require\",\"exports\",\"module\",\"ace/lib/event\",\"ace/lib/useragent\",\"ace/lib/dom\",\"ace/lib/lang\",\"ace/keyboard/textinput_ios\"], function(acequire, exports, module) {\n\"use strict\";\n\nvar event = acequire(\"../lib/event\");\nvar useragent = acequire(\"../lib/useragent\");\nvar dom = acequire(\"../lib/dom\");\nvar lang = acequire(\"../lib/lang\");\nvar BROKEN_SETDATA = useragent.isChrome < 18;\nvar USE_IE_MIME_TYPE = useragent.isIE;\n\nvar TextInputIOS = acequire(\"./textinput_ios\").TextInput;\nvar TextInput = function(parentNode, host) {\n if (useragent.isIOS)\n return TextInputIOS.call(this, parentNode, host);\n\n var text = dom.createElement(\"textarea\");\n text.className = \"ace_text-input\";\n\n text.setAttribute(\"wrap\", \"off\");\n text.setAttribute(\"autocorrect\", \"off\");\n text.setAttribute(\"autocapitalize\", \"off\");\n text.setAttribute(\"spellcheck\", false);\n\n text.style.opacity = \"0\";\n parentNode.insertBefore(text, parentNode.firstChild);\n\n var PLACEHOLDER = \"\\u2028\\u2028\";\n\n var copied = false;\n var pasted = false;\n var inComposition = false;\n var tempStyle = '';\n var isSelectionEmpty = true;\n try { var isFocused = document.activeElement === text; } catch(e) {}\n \n event.addListener(text, \"blur\", function(e) {\n host.onBlur(e);\n isFocused = false;\n });\n event.addListener(text, \"focus\", function(e) {\n isFocused = true;\n host.onFocus(e);\n resetSelection();\n });\n this.focus = function() {\n if (tempStyle) return text.focus();\n var top = text.style.top;\n text.style.position = \"fixed\";\n text.style.top = \"0px\";\n text.focus();\n setTimeout(function() {\n text.style.position = \"\";\n if (text.style.top == \"0px\")\n text.style.top = top;\n }, 0);\n };\n this.blur = function() {\n text.blur();\n };\n this.isFocused = function() {\n return isFocused;\n };\n var syncSelection = lang.delayedCall(function() {\n isFocused && resetSelection(isSelectionEmpty);\n });\n var syncValue = lang.delayedCall(function() {\n if (!inComposition) {\n text.value = PLACEHOLDER;\n isFocused && resetSelection();\n }\n });\n\n function resetSelection(isEmpty) {\n if (inComposition)\n return;\n inComposition = true;\n \n if (inputHandler) {\n var selectionStart = 0;\n var selectionEnd = isEmpty ? 0 : text.value.length - 1;\n } else {\n var selectionStart = isEmpty ? 2 : 1;\n var selectionEnd = 2;\n }\n try {\n text.setSelectionRange(selectionStart, selectionEnd);\n } catch(e){}\n \n inComposition = false;\n }\n\n function resetValue() {\n if (inComposition)\n return;\n text.value = PLACEHOLDER;\n if (useragent.isWebKit)\n syncValue.schedule();\n }\n\n useragent.isWebKit || host.addEventListener('changeSelection', function() {\n if (host.selection.isEmpty() != isSelectionEmpty) {\n isSelectionEmpty = !isSelectionEmpty;\n syncSelection.schedule();\n }\n });\n\n resetValue();\n if (isFocused)\n host.onFocus();\n\n\n var isAllSelected = function(text) {\n return text.selectionStart === 0 && text.selectionEnd === text.value.length;\n };\n\n var onSelect = function(e) {\n if (copied) {\n copied = false;\n } else if (isAllSelected(text)) {\n host.selectAll();\n resetSelection();\n } else if (inputHandler) {\n resetSelection(host.selection.isEmpty());\n }\n };\n\n var inputHandler = null;\n this.setInputHandler = function(cb) {inputHandler = cb;};\n this.getInputHandler = function() {return inputHandler;};\n var afterContextMenu = false;\n \n var sendText = function(data) {\n if (inputHandler) {\n data = inputHandler(data);\n inputHandler = null;\n }\n if (pasted) {\n resetSelection();\n if (data)\n host.onPaste(data);\n pasted = false;\n } else if (data == PLACEHOLDER.charAt(0)) {\n if (afterContextMenu)\n host.execCommand(\"del\", {source: \"ace\"});\n else // some versions of android do not fire keydown when pressing backspace\n host.execCommand(\"backspace\", {source: \"ace\"});\n } else {\n if (data.substring(0, 2) == PLACEHOLDER)\n data = data.substr(2);\n else if (data.charAt(0) == PLACEHOLDER.charAt(0))\n data = data.substr(1);\n else if (data.charAt(data.length - 1) == PLACEHOLDER.charAt(0))\n data = data.slice(0, -1);\n if (data.charAt(data.length - 1) == PLACEHOLDER.charAt(0))\n data = data.slice(0, -1);\n \n if (data)\n host.onTextInput(data);\n }\n if (afterContextMenu)\n afterContextMenu = false;\n };\n var onInput = function(e) {\n if (inComposition)\n return;\n var data = text.value;\n sendText(data);\n resetValue();\n };\n \n var handleClipboardData = function(e, data, forceIEMime) {\n var clipboardData = e.clipboardData || window.clipboardData;\n if (!clipboardData || BROKEN_SETDATA)\n return;\n var mime = USE_IE_MIME_TYPE || forceIEMime ? \"Text\" : \"text/plain\";\n try {\n if (data) {\n return clipboardData.setData(mime, data) !== false;\n } else {\n return clipboardData.getData(mime);\n }\n } catch(e) {\n if (!forceIEMime)\n return handleClipboardData(e, data, true);\n }\n };\n\n var doCopy = function(e, isCut) {\n var data = host.getCopyText();\n if (!data)\n return event.preventDefault(e);\n\n if (handleClipboardData(e, data)) {\n isCut ? host.onCut() : host.onCopy();\n event.preventDefault(e);\n } else {\n copied = true;\n text.value = data;\n text.select();\n setTimeout(function(){\n copied = false;\n resetValue();\n resetSelection();\n isCut ? host.onCut() : host.onCopy();\n });\n }\n };\n \n var onCut = function(e) {\n doCopy(e, true);\n };\n \n var onCopy = function(e) {\n doCopy(e, false);\n };\n \n var onPaste = function(e) {\n var data = handleClipboardData(e);\n if (typeof data == \"string\") {\n if (data)\n host.onPaste(data, e);\n if (useragent.isIE)\n setTimeout(resetSelection);\n event.preventDefault(e);\n }\n else {\n text.value = \"\";\n pasted = true;\n }\n };\n\n event.addCommandKeyListener(text, host.onCommandKey.bind(host));\n\n event.addListener(text, \"select\", onSelect);\n\n event.addListener(text, \"input\", onInput);\n\n event.addListener(text, \"cut\", onCut);\n event.addListener(text, \"copy\", onCopy);\n event.addListener(text, \"paste\", onPaste);\n if (!('oncut' in text) || !('oncopy' in text) || !('onpaste' in text)) {\n event.addListener(parentNode, \"keydown\", function(e) {\n if ((useragent.isMac && !e.metaKey) || !e.ctrlKey)\n return;\n\n switch (e.keyCode) {\n case 67:\n onCopy(e);\n break;\n case 86:\n onPaste(e);\n break;\n case 88:\n onCut(e);\n break;\n }\n });\n }\n var onCompositionStart = function(e) {\n if (inComposition || !host.onCompositionStart || host.$readOnly) \n return;\n inComposition = {};\n inComposition.canUndo = host.session.$undoManager;\n host.onCompositionStart();\n setTimeout(onCompositionUpdate, 0);\n host.on(\"mousedown\", onCompositionEnd);\n if (inComposition.canUndo && !host.selection.isEmpty()) {\n host.insert(\"\");\n host.session.markUndoGroup();\n host.selection.clearSelection();\n }\n host.session.markUndoGroup();\n };\n\n var onCompositionUpdate = function() {\n if (!inComposition || !host.onCompositionUpdate || host.$readOnly)\n return;\n var val = text.value.replace(/\\u2028/g, \"\");\n if (inComposition.lastValue === val) return;\n \n host.onCompositionUpdate(val);\n if (inComposition.lastValue)\n host.undo();\n if (inComposition.canUndo)\n inComposition.lastValue = val;\n if (inComposition.lastValue) {\n var r = host.selection.getRange();\n host.insert(inComposition.lastValue);\n host.session.markUndoGroup();\n inComposition.range = host.selection.getRange();\n host.selection.setRange(r);\n host.selection.clearSelection();\n }\n };\n\n var onCompositionEnd = function(e) {\n if (!host.onCompositionEnd || host.$readOnly) return;\n var c = inComposition;\n inComposition = false;\n var timer = setTimeout(function() {\n timer = null;\n var str = text.value.replace(/\\u2028/g, \"\");\n if (inComposition)\n return;\n else if (str == c.lastValue)\n resetValue();\n else if (!c.lastValue && str) {\n resetValue();\n sendText(str);\n }\n });\n inputHandler = function compositionInputHandler(str) {\n if (timer)\n clearTimeout(timer);\n str = str.replace(/\\u2028/g, \"\");\n if (str == c.lastValue)\n return \"\";\n if (c.lastValue && timer)\n host.undo();\n return str;\n };\n host.onCompositionEnd();\n host.removeListener(\"mousedown\", onCompositionEnd);\n if (e.type == \"compositionend\" && c.range) {\n host.selection.setRange(c.range);\n }\n var needsOnInput =\n (!!useragent.isChrome && useragent.isChrome >= 53) ||\n (!!useragent.isWebKit && useragent.isWebKit >= 603);\n\n if (needsOnInput) {\n onInput();\n }\n };\n \n \n\n var syncComposition = lang.delayedCall(onCompositionUpdate, 50);\n\n event.addListener(text, \"compositionstart\", onCompositionStart);\n if (useragent.isGecko) {\n event.addListener(text, \"text\", function(){syncComposition.schedule();});\n } else {\n event.addListener(text, \"keyup\", function(){syncComposition.schedule();});\n event.addListener(text, \"keydown\", function(){syncComposition.schedule();});\n }\n event.addListener(text, \"compositionend\", onCompositionEnd);\n\n this.getElement = function() {\n return text;\n };\n\n this.setReadOnly = function(readOnly) {\n text.readOnly = readOnly;\n };\n\n this.onContextMenu = function(e) {\n afterContextMenu = true;\n resetSelection(host.selection.isEmpty());\n host._emit(\"nativecontextmenu\", {target: host, domEvent: e});\n this.moveToMouse(e, true);\n };\n \n this.moveToMouse = function(e, bringToFront) {\n if (!tempStyle)\n tempStyle = text.style.cssText;\n text.style.cssText = (bringToFront ? \"z-index:100000;\" : \"\")\n + \"height:\" + text.style.height + \";\"\n + (useragent.isIE ? \"opacity:0.1;\" : \"\");\n\n var rect = host.container.getBoundingClientRect();\n var style = dom.computedStyle(host.container);\n var top = rect.top + (parseInt(style.borderTopWidth) || 0);\n var left = rect.left + (parseInt(rect.borderLeftWidth) || 0);\n var maxTop = rect.bottom - top - text.clientHeight -2;\n var move = function(e) {\n text.style.left = e.clientX - left - 2 + \"px\";\n text.style.top = Math.min(e.clientY - top - 2, maxTop) + \"px\";\n }; \n move(e);\n\n if (e.type != \"mousedown\")\n return;\n\n if (host.renderer.$keepTextAreaAtCursor)\n host.renderer.$keepTextAreaAtCursor = null;\n\n clearTimeout(closeTimeout);\n if (useragent.isWin)\n event.capture(host.container, move, onContextMenuClose);\n };\n\n this.onContextMenuClose = onContextMenuClose;\n var closeTimeout;\n function onContextMenuClose() {\n clearTimeout(closeTimeout);\n closeTimeout = setTimeout(function () {\n if (tempStyle) {\n text.style.cssText = tempStyle;\n tempStyle = '';\n }\n if (host.renderer.$keepTextAreaAtCursor == null) {\n host.renderer.$keepTextAreaAtCursor = true;\n host.renderer.$moveTextAreaToCursor();\n }\n }, 0);\n }\n\n var onContextMenu = function(e) {\n host.textInput.onContextMenu(e);\n onContextMenuClose();\n };\n event.addListener(text, \"mouseup\", onContextMenu);\n event.addListener(text, \"mousedown\", function(e) {\n e.preventDefault();\n onContextMenuClose();\n });\n event.addListener(host.renderer.scroller, \"contextmenu\", onContextMenu);\n event.addListener(text, \"contextmenu\", onContextMenu);\n};\n\nexports.TextInput = TextInput;\n});\n\nace.define(\"ace/mouse/default_handlers\",[\"require\",\"exports\",\"module\",\"ace/lib/dom\",\"ace/lib/event\",\"ace/lib/useragent\"], function(acequire, exports, module) {\n\"use strict\";\n\nvar dom = acequire(\"../lib/dom\");\nvar event = acequire(\"../lib/event\");\nvar useragent = acequire(\"../lib/useragent\");\n\nvar DRAG_OFFSET = 0; // pixels\nvar SCROLL_COOLDOWN_T = 250; // milliseconds\n\nfunction DefaultHandlers(mouseHandler) {\n mouseHandler.$clickSelection = null;\n\n var editor = mouseHandler.editor;\n editor.setDefaultHandler(\"mousedown\", this.onMouseDown.bind(mouseHandler));\n editor.setDefaultHandler(\"dblclick\", this.onDoubleClick.bind(mouseHandler));\n editor.setDefaultHandler(\"tripleclick\", this.onTripleClick.bind(mouseHandler));\n editor.setDefaultHandler(\"quadclick\", this.onQuadClick.bind(mouseHandler));\n editor.setDefaultHandler(\"mousewheel\", this.onMouseWheel.bind(mouseHandler));\n editor.setDefaultHandler(\"touchmove\", this.onTouchMove.bind(mouseHandler));\n\n var exports = [\"select\", \"startSelect\", \"selectEnd\", \"selectAllEnd\", \"selectByWordsEnd\",\n \"selectByLinesEnd\", \"dragWait\", \"dragWaitEnd\", \"focusWait\"];\n\n exports.forEach(function(x) {\n mouseHandler[x] = this[x];\n }, this);\n\n mouseHandler.selectByLines = this.extendSelectionBy.bind(mouseHandler, \"getLineRange\");\n mouseHandler.selectByWords = this.extendSelectionBy.bind(mouseHandler, \"getWordRange\");\n}\n\n(function() {\n\n this.onMouseDown = function(ev) {\n var inSelection = ev.inSelection();\n var pos = ev.getDocumentPosition();\n this.mousedownEvent = ev;\n var editor = this.editor;\n\n var button = ev.getButton();\n if (button !== 0) {\n var selectionRange = editor.getSelectionRange();\n var selectionEmpty = selectionRange.isEmpty();\n editor.$blockScrolling++;\n if (selectionEmpty || button == 1)\n editor.selection.moveToPosition(pos);\n editor.$blockScrolling--;\n if (button == 2) {\n editor.textInput.onContextMenu(ev.domEvent);\n if (!useragent.isMozilla)\n ev.preventDefault();\n }\n return;\n }\n\n this.mousedownEvent.time = Date.now();\n if (inSelection && !editor.isFocused()) {\n editor.focus();\n if (this.$focusTimout && !this.$clickSelection && !editor.inMultiSelectMode) {\n this.setState(\"focusWait\");\n this.captureMouse(ev);\n return;\n }\n }\n\n this.captureMouse(ev);\n this.startSelect(pos, ev.domEvent._clicks > 1);\n return ev.preventDefault();\n };\n\n this.startSelect = function(pos, waitForClickSelection) {\n pos = pos || this.editor.renderer.screenToTextCoordinates(this.x, this.y);\n var editor = this.editor;\n editor.$blockScrolling++;\n if (this.mousedownEvent.getShiftKey())\n editor.selection.selectToPosition(pos);\n else if (!waitForClickSelection)\n editor.selection.moveToPosition(pos);\n if (!waitForClickSelection)\n this.select();\n if (editor.renderer.scroller.setCapture) {\n editor.renderer.scroller.setCapture();\n }\n editor.setStyle(\"ace_selecting\");\n this.setState(\"select\");\n editor.$blockScrolling--;\n };\n\n this.select = function() {\n var anchor, editor = this.editor;\n var cursor = editor.renderer.screenToTextCoordinates(this.x, this.y);\n editor.$blockScrolling++;\n if (this.$clickSelection) {\n var cmp = this.$clickSelection.comparePoint(cursor);\n\n if (cmp == -1) {\n anchor = this.$clickSelection.end;\n } else if (cmp == 1) {\n anchor = this.$clickSelection.start;\n } else {\n var orientedRange = calcRangeOrientation(this.$clickSelection, cursor);\n cursor = orientedRange.cursor;\n anchor = orientedRange.anchor;\n }\n editor.selection.setSelectionAnchor(anchor.row, anchor.column);\n }\n editor.selection.selectToPosition(cursor);\n editor.$blockScrolling--;\n editor.renderer.scrollCursorIntoView();\n };\n\n this.extendSelectionBy = function(unitName) {\n var anchor, editor = this.editor;\n var cursor = editor.renderer.screenToTextCoordinates(this.x, this.y);\n var range = editor.selection[unitName](cursor.row, cursor.column);\n editor.$blockScrolling++;\n if (this.$clickSelection) {\n var cmpStart = this.$clickSelection.comparePoint(range.start);\n var cmpEnd = this.$clickSelection.comparePoint(range.end);\n\n if (cmpStart == -1 && cmpEnd <= 0) {\n anchor = this.$clickSelection.end;\n if (range.end.row != cursor.row || range.end.column != cursor.column)\n cursor = range.start;\n } else if (cmpEnd == 1 && cmpStart >= 0) {\n anchor = this.$clickSelection.start;\n if (range.start.row != cursor.row || range.start.column != cursor.column)\n cursor = range.end;\n } else if (cmpStart == -1 && cmpEnd == 1) {\n cursor = range.end;\n anchor = range.start;\n } else {\n var orientedRange = calcRangeOrientation(this.$clickSelection, cursor);\n cursor = orientedRange.cursor;\n anchor = orientedRange.anchor;\n }\n editor.selection.setSelectionAnchor(anchor.row, anchor.column);\n }\n editor.selection.selectToPosition(cursor);\n editor.$blockScrolling--;\n editor.renderer.scrollCursorIntoView();\n };\n\n this.selectEnd =\n this.selectAllEnd =\n this.selectByWordsEnd =\n this.selectByLinesEnd = function() {\n this.$clickSelection = null;\n this.editor.unsetStyle(\"ace_selecting\");\n if (this.editor.renderer.scroller.releaseCapture) {\n this.editor.renderer.scroller.releaseCapture();\n }\n };\n\n this.focusWait = function() {\n var distance = calcDistance(this.mousedownEvent.x, this.mousedownEvent.y, this.x, this.y);\n var time = Date.now();\n\n if (distance > DRAG_OFFSET || time - this.mousedownEvent.time > this.$focusTimout)\n this.startSelect(this.mousedownEvent.getDocumentPosition());\n };\n\n this.onDoubleClick = function(ev) {\n var pos = ev.getDocumentPosition();\n var editor = this.editor;\n var session = editor.session;\n\n var range = session.getBracketRange(pos);\n if (range) {\n if (range.isEmpty()) {\n range.start.column--;\n range.end.column++;\n }\n this.setState(\"select\");\n } else {\n range = editor.selection.getWordRange(pos.row, pos.column);\n this.setState(\"selectByWords\");\n }\n this.$clickSelection = range;\n this.select();\n };\n\n this.onTripleClick = function(ev) {\n var pos = ev.getDocumentPosition();\n var editor = this.editor;\n\n this.setState(\"selectByLines\");\n var range = editor.getSelectionRange();\n if (range.isMultiLine() && range.contains(pos.row, pos.column)) {\n this.$clickSelection = editor.selection.getLineRange(range.start.row);\n this.$clickSelection.end = editor.selection.getLineRange(range.end.row).end;\n } else {\n this.$clickSelection = editor.selection.getLineRange(pos.row);\n }\n this.select();\n };\n\n this.onQuadClick = function(ev) {\n var editor = this.editor;\n\n editor.selectAll();\n this.$clickSelection = editor.getSelectionRange();\n this.setState(\"selectAll\");\n };\n\n this.onMouseWheel = function(ev) {\n if (ev.getAccelKey())\n return;\n if (ev.getShiftKey() && ev.wheelY && !ev.wheelX) {\n ev.wheelX = ev.wheelY;\n ev.wheelY = 0;\n }\n \n var editor = this.editor;\n\n if (!this.$lastScroll)\n this.$lastScroll = { t: 0, vx: 0, vy: 0, allowed: 0 };\n\n var prevScroll = this.$lastScroll;\n var t = ev.domEvent.timeStamp;\n var dt = t - prevScroll.t;\n var vx = ev.wheelX / dt;\n var vy = ev.wheelY / dt;\n if (dt < SCROLL_COOLDOWN_T) {\n vx = (vx + prevScroll.vx) / 2;\n vy = (vy + prevScroll.vy) / 2;\n }\n\n var direction = Math.abs(vx / vy);\n\n var canScroll = false;\n if (direction >= 1 && editor.renderer.isScrollableBy(ev.wheelX * ev.speed, 0))\n canScroll = true;\n if (direction <= 1 && editor.renderer.isScrollableBy(0, ev.wheelY * ev.speed))\n canScroll = true;\n\n if (canScroll) {\n prevScroll.allowed = t;\n } else if (t - prevScroll.allowed < SCROLL_COOLDOWN_T) {\n var isSlower = Math.abs(vx) <= 1.1 * Math.abs(prevScroll.vx)\n && Math.abs(vy) <= 1.1 * Math.abs(prevScroll.vy);\n if (isSlower) {\n canScroll = true;\n prevScroll.allowed = t;\n }\n else {\n prevScroll.allowed = 0;\n }\n }\n\n prevScroll.t = t;\n prevScroll.vx = vx;\n prevScroll.vy = vy;\n\n if (canScroll) {\n editor.renderer.scrollBy(ev.wheelX * ev.speed, ev.wheelY * ev.speed);\n return ev.stop();\n }\n };\n\n this.onTouchMove = function(ev) {\n this.editor._emit(\"mousewheel\", ev);\n };\n\n}).call(DefaultHandlers.prototype);\n\nexports.DefaultHandlers = DefaultHandlers;\n\nfunction calcDistance(ax, ay, bx, by) {\n return Math.sqrt(Math.pow(bx - ax, 2) + Math.pow(by - ay, 2));\n}\n\nfunction calcRangeOrientation(range, cursor) {\n if (range.start.row == range.end.row)\n var cmp = 2 * cursor.column - range.start.column - range.end.column;\n else if (range.start.row == range.end.row - 1 && !range.start.column && !range.end.column)\n var cmp = cursor.column - 4;\n else\n var cmp = 2 * cursor.row - range.start.row - range.end.row;\n\n if (cmp < 0)\n return {cursor: range.start, anchor: range.end};\n else\n return {cursor: range.end, anchor: range.start};\n}\n\n});\n\nace.define(\"ace/tooltip\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/dom\"], function(acequire, exports, module) {\n\"use strict\";\n\nvar oop = acequire(\"./lib/oop\");\nvar dom = acequire(\"./lib/dom\");\nfunction Tooltip (parentNode) {\n this.isOpen = false;\n this.$element = null;\n this.$parentNode = parentNode;\n}\n\n(function() {\n this.$init = function() {\n this.$element = dom.createElement(\"div\");\n this.$element.className = \"ace_tooltip\";\n this.$element.style.display = \"none\";\n this.$parentNode.appendChild(this.$element);\n return this.$element;\n };\n this.getElement = function() {\n return this.$element || this.$init();\n };\n this.setText = function(text) {\n dom.setInnerText(this.getElement(), text);\n };\n this.setHtml = function(html) {\n this.getElement().innerHTML = html;\n };\n this.setPosition = function(x, y) {\n this.getElement().style.left = x + \"px\";\n this.getElement().style.top = y + \"px\";\n };\n this.setClassName = function(className) {\n dom.addCssClass(this.getElement(), className);\n };\n this.show = function(text, x, y) {\n if (text != null)\n this.setText(text);\n if (x != null && y != null)\n this.setPosition(x, y);\n if (!this.isOpen) {\n this.getElement().style.display = \"block\";\n this.isOpen = true;\n }\n };\n\n this.hide = function() {\n if (this.isOpen) {\n this.getElement().style.display = \"none\";\n this.isOpen = false;\n }\n };\n this.getHeight = function() {\n return this.getElement().offsetHeight;\n };\n this.getWidth = function() {\n return this.getElement().offsetWidth;\n };\n\n this.destroy = function() {\n this.isOpen = false;\n if (this.$element && this.$element.parentNode) {\n this.$element.parentNode.removeChild(this.$element);\n }\n };\n\n}).call(Tooltip.prototype);\n\nexports.Tooltip = Tooltip;\n});\n\nace.define(\"ace/mouse/default_gutter_handler\",[\"require\",\"exports\",\"module\",\"ace/lib/dom\",\"ace/lib/oop\",\"ace/lib/event\",\"ace/tooltip\"], function(acequire, exports, module) {\n\"use strict\";\nvar dom = acequire(\"../lib/dom\");\nvar oop = acequire(\"../lib/oop\");\nvar event = acequire(\"../lib/event\");\nvar Tooltip = acequire(\"../tooltip\").Tooltip;\n\nfunction GutterHandler(mouseHandler) {\n var editor = mouseHandler.editor;\n var gutter = editor.renderer.$gutterLayer;\n var tooltip = new GutterTooltip(editor.container);\n\n mouseHandler.editor.setDefaultHandler(\"guttermousedown\", function(e) {\n if (!editor.isFocused() || e.getButton() != 0)\n return;\n var gutterRegion = gutter.getRegion(e);\n\n if (gutterRegion == \"foldWidgets\")\n return;\n\n var row = e.getDocumentPosition().row;\n var selection = editor.session.selection;\n\n if (e.getShiftKey())\n selection.selectTo(row, 0);\n else {\n if (e.domEvent.detail == 2) {\n editor.selectAll();\n return e.preventDefault();\n }\n mouseHandler.$clickSelection = editor.selection.getLineRange(row);\n }\n mouseHandler.setState(\"selectByLines\");\n mouseHandler.captureMouse(e);\n return e.preventDefault();\n });\n\n\n var tooltipTimeout, mouseEvent, tooltipAnnotation;\n\n function showTooltip() {\n var row = mouseEvent.getDocumentPosition().row;\n var annotation = gutter.$annotations[row];\n if (!annotation)\n return hideTooltip();\n\n var maxRow = editor.session.getLength();\n if (row == maxRow) {\n var screenRow = editor.renderer.pixelToScreenCoordinates(0, mouseEvent.y).row;\n var pos = mouseEvent.$pos;\n if (screenRow > editor.session.documentToScreenRow(pos.row, pos.column))\n return hideTooltip();\n }\n\n if (tooltipAnnotation == annotation)\n return;\n tooltipAnnotation = annotation.text.join(\"<br/>\");\n\n tooltip.setHtml(tooltipAnnotation);\n tooltip.show();\n editor._signal(\"showGutterTooltip\", tooltip);\n editor.on(\"mousewheel\", hideTooltip);\n\n if (mouseHandler.$tooltipFollowsMouse) {\n moveTooltip(mouseEvent);\n } else {\n var gutterElement = mouseEvent.domEvent.target;\n var rect = gutterElement.getBoundingClientRect();\n var style = tooltip.getElement().style;\n style.left = rect.right + \"px\";\n style.top = rect.bottom + \"px\";\n }\n }\n\n function hideTooltip() {\n if (tooltipTimeout)\n tooltipTimeout = clearTimeout(tooltipTimeout);\n if (tooltipAnnotation) {\n tooltip.hide();\n tooltipAnnotation = null;\n editor._signal(\"hideGutterTooltip\", tooltip);\n editor.removeEventListener(\"mousewheel\", hideTooltip);\n }\n }\n\n function moveTooltip(e) {\n tooltip.setPosition(e.x, e.y);\n }\n\n mouseHandler.editor.setDefaultHandler(\"guttermousemove\", function(e) {\n var target = e.domEvent.target || e.domEvent.srcElement;\n if (dom.hasCssClass(target, \"ace_fold-widget\"))\n return hideTooltip();\n\n if (tooltipAnnotation && mouseHandler.$tooltipFollowsMouse)\n moveTooltip(e);\n\n mouseEvent = e;\n if (tooltipTimeout)\n return;\n tooltipTimeout = setTimeout(function() {\n tooltipTimeout = null;\n if (mouseEvent && !mouseHandler.isMousePressed)\n showTooltip();\n else\n hideTooltip();\n }, 50);\n });\n\n event.addListener(editor.renderer.$gutter, \"mouseout\", function(e) {\n mouseEvent = null;\n if (!tooltipAnnotation || tooltipTimeout)\n return;\n\n tooltipTimeout = setTimeout(function() {\n tooltipTimeout = null;\n hideTooltip();\n }, 50);\n });\n \n editor.on(\"changeSession\", hideTooltip);\n}\n\nfunction GutterTooltip(parentNode) {\n Tooltip.call(this, parentNode);\n}\n\noop.inherits(GutterTooltip, Tooltip);\n\n(function(){\n this.setPosition = function(x, y) {\n var windowWidth = window.innerWidth || document.documentElement.clientWidth;\n var windowHeight = window.innerHeight || document.documentElement.clientHeight;\n var width = this.getWidth();\n var height = this.getHeight();\n x += 15;\n y += 15;\n if (x + width > windowWidth) {\n x -= (x + width) - windowWidth;\n }\n if (y + height > windowHeight) {\n y -= 20 + height;\n }\n Tooltip.prototype.setPosition.call(this, x, y);\n };\n\n}).call(GutterTooltip.prototype);\n\n\n\nexports.GutterHandler = GutterHandler;\n\n});\n\nace.define(\"ace/mouse/mouse_event\",[\"require\",\"exports\",\"module\",\"ace/lib/event\",\"ace/lib/useragent\"], function(acequire, exports, module) {\n\"use strict\";\n\nvar event = acequire(\"../lib/event\");\nvar useragent = acequire(\"../lib/useragent\");\nvar MouseEvent = exports.MouseEvent = function(domEvent, editor) {\n this.domEvent = domEvent;\n this.editor = editor;\n \n this.x = this.clientX = domEvent.clientX;\n this.y = this.clientY = domEvent.clientY;\n\n this.$pos = null;\n this.$inSelection = null;\n \n this.propagationStopped = false;\n this.defaultPrevented = false;\n};\n\n(function() { \n \n this.stopPropagation = function() {\n event.stopPropagation(this.domEvent);\n this.propagationStopped = true;\n };\n \n this.preventDefault = function() {\n event.preventDefault(this.domEvent);\n this.defaultPrevented = true;\n };\n \n this.stop = function() {\n this.stopPropagation();\n this.preventDefault();\n };\n this.getDocumentPosition = function() {\n if (this.$pos)\n return this.$pos;\n \n this.$pos = this.editor.renderer.screenToTextCoordinates(this.clientX, this.clientY);\n return this.$pos;\n };\n this.inSelection = function() {\n if (this.$inSelection !== null)\n return this.$inSelection;\n \n var editor = this.editor;\n \n\n var selectionRange = editor.getSelectionRange();\n if (selectionRange.isEmpty())\n this.$inSelection = false;\n else {\n var pos = this.getDocumentPosition();\n this.$inSelection = selectionRange.contains(pos.row, pos.column);\n }\n\n return this.$inSelection;\n };\n this.getButton = function() {\n return event.getButton(this.domEvent);\n };\n this.getShiftKey = function() {\n return this.domEvent.shiftKey;\n };\n \n this.getAccelKey = useragent.isMac\n ? function() { return this.domEvent.metaKey; }\n : function() { return this.domEvent.ctrlKey; };\n \n}).call(MouseEvent.prototype);\n\n});\n\nace.define(\"ace/mouse/dragdrop_handler\",[\"require\",\"exports\",\"module\",\"ace/lib/dom\",\"ace/lib/event\",\"ace/lib/useragent\"], function(acequire, exports, module) {\n\"use strict\";\n\nvar dom = acequire(\"../lib/dom\");\nvar event = acequire(\"../lib/event\");\nvar useragent = acequire(\"../lib/useragent\");\n\nvar AUTOSCROLL_DELAY = 200;\nvar SCROLL_CURSOR_DELAY = 200;\nvar SCROLL_CURSOR_HYSTERESIS = 5;\n\nfunction DragdropHandler(mouseHandler) {\n\n var editor = mouseHandler.editor;\n\n var blankImage = dom.createElement(\"img\");\n blankImage.src = \"data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==\";\n if (useragent.isOpera)\n blankImage.style.cssText = \"width:1px;height:1px;position:fixed;top:0;left:0;z-index:2147483647;opacity:0;\";\n\n var exports = [\"dragWait\", \"dragWaitEnd\", \"startDrag\", \"dragReadyEnd\", \"onMouseDrag\"];\n\n exports.forEach(function(x) {\n mouseHandler[x] = this[x];\n }, this);\n editor.addEventListener(\"mousedown\", this.onMouseDown.bind(mouseHandler));\n\n\n var mouseTarget = editor.container;\n var dragSelectionMarker, x, y;\n var timerId, range;\n var dragCursor, counter = 0;\n var dragOperation;\n var isInternal;\n var autoScrollStartTime;\n var cursorMovedTime;\n var cursorPointOnCaretMoved;\n\n this.onDragStart = function(e) {\n if (this.cancelDrag || !mouseTarget.draggable) {\n var self = this;\n setTimeout(function(){\n self.startSelect();\n self.captureMouse(e);\n }, 0);\n return e.preventDefault();\n }\n range = editor.getSelectionRange();\n\n var dataTransfer = e.dataTransfer;\n dataTransfer.effectAllowed = editor.getReadOnly() ? \"copy\" : \"copyMove\";\n if (useragent.isOpera) {\n editor.container.appendChild(blankImage);\n blankImage.scrollTop = 0;\n }\n dataTransfer.setDragImage && dataTransfer.setDragImage(blankImage, 0, 0);\n if (useragent.isOpera) {\n editor.container.removeChild(blankImage);\n }\n dataTransfer.clearData();\n dataTransfer.setData(\"Text\", editor.session.getTextRange());\n\n isInternal = true;\n this.setState(\"drag\");\n };\n\n this.onDragEnd = function(e) {\n mouseTarget.draggable = false;\n isInternal = false;\n this.setState(null);\n if (!editor.getReadOnly()) {\n var dropEffect = e.dataTransfer.dropEffect;\n if (!dragOperation && dropEffect == \"move\")\n editor.session.remove(editor.getSelectionRange());\n editor.renderer.$cursorLayer.setBlinking(true);\n }\n this.editor.unsetStyle(\"ace_dragging\");\n this.editor.renderer.setCursorStyle(\"\");\n };\n\n this.onDragEnter = function(e) {\n if (editor.getReadOnly() || !canAccept(e.dataTransfer))\n return;\n x = e.clientX;\n y = e.clientY;\n if (!dragSelectionMarker)\n addDragMarker();\n counter++;\n e.dataTransfer.dropEffect = dragOperation = getDropEffect(e);\n return event.preventDefault(e);\n };\n\n this.onDragOver = function(e) {\n if (editor.getReadOnly() || !canAccept(e.dataTransfer))\n return;\n x = e.clientX;\n y = e.clientY;\n if (!dragSelectionMarker) {\n addDragMarker();\n counter++;\n }\n if (onMouseMoveTimer !== null)\n onMouseMoveTimer = null;\n\n e.dataTransfer.dropEffect = dragOperation = getDropEffect(e);\n return event.preventDefault(e);\n };\n\n this.onDragLeave = function(e) {\n counter--;\n if (counter <= 0 && dragSelectionMarker) {\n clearDragMarker();\n dragOperation = null;\n return event.preventDefault(e);\n }\n };\n\n this.onDrop = function(e) {\n if (!dragCursor)\n return;\n var dataTransfer = e.dataTransfer;\n if (isInternal) {\n switch (dragOperation) {\n case \"move\":\n if (range.contains(dragCursor.row, dragCursor.column)) {\n range = {\n start: dragCursor,\n end: dragCursor\n };\n } else {\n range = editor.moveText(range, dragCursor);\n }\n break;\n case \"copy\":\n range = editor.moveText(range, dragCursor, true);\n break;\n }\n } else {\n var dropData = dataTransfer.getData('Text');\n range = {\n start: dragCursor,\n end: editor.session.insert(dragCursor, dropData)\n };\n editor.focus();\n dragOperation = null;\n }\n clearDragMarker();\n return event.preventDefault(e);\n };\n\n event.addListener(mouseTarget, \"dragstart\", this.onDragStart.bind(mouseHandler));\n event.addListener(mouseTarget, \"dragend\", this.onDragEnd.bind(mouseHandler));\n event.addListener(mouseTarget, \"dragenter\", this.onDragEnter.bind(mouseHandler));\n event.addListener(mouseTarget, \"dragover\", this.onDragOver.bind(mouseHandler));\n event.addListener(mouseTarget, \"dragleave\", this.onDragLeave.bind(mouseHandler));\n event.addListener(mouseTarget, \"drop\", this.onDrop.bind(mouseHandler));\n\n function scrollCursorIntoView(cursor, prevCursor) {\n var now = Date.now();\n var vMovement = !prevCursor || cursor.row != prevCursor.row;\n var hMovement = !prevCursor || cursor.column != prevCursor.column;\n if (!cursorMovedTime || vMovement || hMovement) {\n editor.$blockScrolling += 1;\n editor.moveCursorToPosition(cursor);\n editor.$blockScrolling -= 1;\n cursorMovedTime = now;\n cursorPointOnCaretMoved = {x: x, y: y};\n } else {\n var distance = calcDistance(cursorPointOnCaretMoved.x, cursorPointOnCaretMoved.y, x, y);\n if (distance > SCROLL_CURSOR_HYSTERESIS) {\n cursorMovedTime = null;\n } else if (now - cursorMovedTime >= SCROLL_CURSOR_DELAY) {\n editor.renderer.scrollCursorIntoView();\n cursorMovedTime = null;\n }\n }\n }\n\n function autoScroll(cursor, prevCursor) {\n var now = Date.now();\n var lineHeight = editor.renderer.layerConfig.lineHeight;\n var characterWidth = editor.renderer.layerConfig.characterWidth;\n var editorRect = editor.renderer.scroller.getBoundingClientRect();\n var offsets = {\n x: {\n left: x - editorRect.left,\n right: editorRect.right - x\n },\n y: {\n top: y - editorRect.top,\n bottom: editorRect.bottom - y\n }\n };\n var nearestXOffset = Math.min(offsets.x.left, offsets.x.right);\n var nearestYOffset = Math.min(offsets.y.top, offsets.y.bottom);\n var scrollCursor = {row: cursor.row, column: cursor.column};\n if (nearestXOffset / characterWidth <= 2) {\n scrollCursor.column += (offsets.x.left < offsets.x.right ? -3 : +2);\n }\n if (nearestYOffset / lineHeight <= 1) {\n scrollCursor.row += (offsets.y.top < offsets.y.bottom ? -1 : +1);\n }\n var vScroll = cursor.row != scrollCursor.row;\n var hScroll = cursor.column != scrollCursor.column;\n var vMovement = !prevCursor || cursor.row != prevCursor.row;\n if (vScroll || (hScroll && !vMovement)) {\n if (!autoScrollStartTime)\n autoScrollStartTime = now;\n else if (now - autoScrollStartTime >= AUTOSCROLL_DELAY)\n editor.renderer.scrollCursorIntoView(scrollCursor);\n } else {\n autoScrollStartTime = null;\n }\n }\n\n function onDragInterval() {\n var prevCursor = dragCursor;\n dragCursor = editor.renderer.screenToTextCoordinates(x, y);\n scrollCursorIntoView(dragCursor, prevCursor);\n autoScroll(dragCursor, prevCursor);\n }\n\n function addDragMarker() {\n range = editor.selection.toOrientedRange();\n dragSelectionMarker = editor.session.addMarker(range, \"ace_selection\", editor.getSelectionStyle());\n editor.clearSelection();\n if (editor.isFocused())\n editor.renderer.$cursorLayer.setBlinking(false);\n clearInterval(timerId);\n onDragInterval();\n timerId = setInterval(onDragInterval, 20);\n counter = 0;\n event.addListener(document, \"mousemove\", onMouseMove);\n }\n\n function clearDragMarker() {\n clearInterval(timerId);\n editor.session.removeMarker(dragSelectionMarker);\n dragSelectionMarker = null;\n editor.$blockScrolling += 1;\n editor.selection.fromOrientedRange(range);\n editor.$blockScrolling -= 1;\n if (editor.isFocused() && !isInternal)\n editor.renderer.$cursorLayer.setBlinking(!editor.getReadOnly());\n range = null;\n dragCursor = null;\n counter = 0;\n autoScrollStartTime = null;\n cursorMovedTime = null;\n event.removeListener(document, \"mousemove\", onMouseMove);\n }\n var onMouseMoveTimer = null;\n function onMouseMove() {\n if (onMouseMoveTimer == null) {\n onMouseMoveTimer = setTimeout(function() {\n if (onMouseMoveTimer != null && dragSelectionMarker)\n clearDragMarker();\n }, 20);\n }\n }\n\n function canAccept(dataTransfer) {\n var types = dataTransfer.types;\n return !types || Array.prototype.some.call(types, function(type) {\n return type == 'text/plain' || type == 'Text';\n });\n }\n\n function getDropEffect(e) {\n var copyAllowed = ['copy', 'copymove', 'all', 'uninitialized'];\n var moveAllowed = ['move', 'copymove', 'linkmove', 'all', 'uninitialized'];\n\n var copyModifierState = useragent.isMac ? e.altKey : e.ctrlKey;\n var effectAllowed = \"uninitialized\";\n try {\n effectAllowed = e.dataTransfer.effectAllowed.toLowerCase();\n } catch (e) {}\n var dropEffect = \"none\";\n\n if (copyModifierState && copyAllowed.indexOf(effectAllowed) >= 0)\n dropEffect = \"copy\";\n else if (moveAllowed.indexOf(effectAllowed) >= 0)\n dropEffect = \"move\";\n else if (copyAllowed.indexOf(effectAllowed) >= 0)\n dropEffect = \"copy\";\n\n return dropEffect;\n }\n}\n\n(function() {\n\n this.dragWait = function() {\n var interval = Date.now() - this.mousedownEvent.time;\n if (interval > this.editor.getDragDelay())\n this.startDrag();\n };\n\n this.dragWaitEnd = function() {\n var target = this.editor.container;\n target.draggable = false;\n this.startSelect(this.mousedownEvent.getDocumentPosition());\n this.selectEnd();\n };\n\n this.dragReadyEnd = function(e) {\n this.editor.renderer.$cursorLayer.setBlinking(!this.editor.getReadOnly());\n this.editor.unsetStyle(\"ace_dragging\");\n this.editor.renderer.setCursorStyle(\"\");\n this.dragWaitEnd();\n };\n\n this.startDrag = function(){\n this.cancelDrag = false;\n var editor = this.editor;\n var target = editor.container;\n target.draggable = true;\n editor.renderer.$cursorLayer.setBlinking(false);\n editor.setStyle(\"ace_dragging\");\n var cursorStyle = useragent.isWin ? \"default\" : \"move\";\n editor.renderer.setCursorStyle(cursorStyle);\n this.setState(\"dragReady\");\n };\n\n this.onMouseDrag = function(e) {\n var target = this.editor.container;\n if (useragent.isIE && this.state == \"dragReady\") {\n var distance = calcDistance(this.mousedownEvent.x, this.mousedownEvent.y, this.x, this.y);\n if (distance > 3)\n target.dragDrop();\n }\n if (this.state === \"dragWait\") {\n var distance = calcDistance(this.mousedownEvent.x, this.mousedownEvent.y, this.x, this.y);\n if (distance > 0) {\n target.draggable = false;\n this.startSelect(this.mousedownEvent.getDocumentPosition());\n }\n }\n };\n\n this.onMouseDown = function(e) {\n if (!this.$dragEnabled)\n return;\n this.mousedownEvent = e;\n var editor = this.editor;\n\n var inSelection = e.inSelection();\n var button = e.getButton();\n var clickCount = e.domEvent.detail || 1;\n if (clickCount === 1 && button === 0 && inSelection) {\n if (e.editor.inMultiSelectMode && (e.getAccelKey() || e.getShiftKey()))\n return;\n this.mousedownEvent.time = Date.now();\n var eventTarget = e.domEvent.target || e.domEvent.srcElement;\n if (\"unselectable\" in eventTarget)\n eventTarget.unselectable = \"on\";\n if (editor.getDragDelay()) {\n if (useragent.isWebKit) {\n this.cancelDrag = true;\n var mouseTarget = editor.container;\n mouseTarget.draggable = true;\n }\n this.setState(\"dragWait\");\n } else {\n this.startDrag();\n }\n this.captureMouse(e, this.onMouseDrag.bind(this));\n e.defaultPrevented = true;\n }\n };\n\n}).call(DragdropHandler.prototype);\n\n\nfunction calcDistance(ax, ay, bx, by) {\n return Math.sqrt(Math.pow(bx - ax, 2) + Math.pow(by - ay, 2));\n}\n\nexports.DragdropHandler = DragdropHandler;\n\n});\n\nace.define(\"ace/lib/net\",[\"require\",\"exports\",\"module\",\"ace/lib/dom\"], function(acequire, exports, module) {\n\"use strict\";\nvar dom = acequire(\"./dom\");\n\nexports.get = function (url, callback) {\n var xhr = new XMLHttpRequest();\n xhr.open('GET', url, true);\n xhr.onreadystatechange = function () {\n if (xhr.readyState === 4) {\n callback(xhr.responseText);\n }\n };\n xhr.send(null);\n};\n\nexports.loadScript = function(path, callback) {\n var head = dom.getDocumentHead();\n var s = document.createElement('script');\n\n s.src = path;\n head.appendChild(s);\n\n s.onload = s.onreadystatechange = function(_, isAbort) {\n if (isAbort || !s.readyState || s.readyState == \"loaded\" || s.readyState == \"complete\") {\n s = s.onload = s.onreadystatechange = null;\n if (!isAbort)\n callback();\n }\n };\n};\nexports.qualifyURL = function(url) {\n var a = document.createElement('a');\n a.href = url;\n return a.href;\n};\n\n});\n\nace.define(\"ace/lib/event_emitter\",[\"require\",\"exports\",\"module\"], function(acequire, exports, module) {\n\"use strict\";\n\nvar EventEmitter = {};\nvar stopPropagation = function() { this.propagationStopped = true; };\nvar preventDefault = function() { this.defaultPrevented = true; };\n\nEventEmitter._emit =\nEventEmitter._dispatchEvent = function(eventName, e) {\n this._eventRegistry || (this._eventRegistry = {});\n this._defaultHandlers || (this._defaultHandlers = {});\n\n var listeners = this._eventRegistry[eventName] || [];\n var defaultHandler = this._defaultHandlers[eventName];\n if (!listeners.length && !defaultHandler)\n return;\n\n if (typeof e != \"object\" || !e)\n e = {};\n\n if (!e.type)\n e.type = eventName;\n if (!e.stopPropagation)\n e.stopPropagation = stopPropagation;\n if (!e.preventDefault)\n e.preventDefault = preventDefault;\n\n listeners = listeners.slice();\n for (var i=0; i<listeners.length; i++) {\n listeners[i](e, this);\n if (e.propagationStopped)\n break;\n }\n \n if (defaultHandler && !e.defaultPrevented)\n return defaultHandler(e, this);\n};\n\n\nEventEmitter._signal = function(eventName, e) {\n var listeners = (this._eventRegistry || {})[eventName];\n if (!listeners)\n return;\n listeners = listeners.slice();\n for (var i=0; i<listeners.length; i++)\n listeners[i](e, this);\n};\n\nEventEmitter.once = function(eventName, callback) {\n var _self = this;\n callback && this.addEventListener(eventName, function newCallback() {\n _self.removeEventListener(eventName, newCallback);\n callback.apply(null, arguments);\n });\n};\n\n\nEventEmitter.setDefaultHandler = function(eventName, callback) {\n var handlers = this._defaultHandlers;\n if (!handlers)\n handlers = this._defaultHandlers = {_disabled_: {}};\n \n if (handlers[eventName]) {\n var old = handlers[eventName];\n var disabled = handlers._disabled_[eventName];\n if (!disabled)\n handlers._disabled_[eventName] = disabled = [];\n disabled.push(old);\n var i = disabled.indexOf(callback);\n if (i != -1) \n disabled.splice(i, 1);\n }\n handlers[eventName] = callback;\n};\nEventEmitter.removeDefaultHandler = function(eventName, callback) {\n var handlers = this._defaultHandlers;\n if (!handlers)\n return;\n var disabled = handlers._disabled_[eventName];\n \n if (handlers[eventName] == callback) {\n var old = handlers[eventName];\n if (disabled)\n this.setDefaultHandler(eventName, disabled.pop());\n } else if (disabled) {\n var i = disabled.indexOf(callback);\n if (i != -1)\n disabled.splice(i, 1);\n }\n};\n\nEventEmitter.on =\nEventEmitter.addEventListener = function(eventName, callback, capturing) {\n this._eventRegistry = this._eventRegistry || {};\n\n var listeners = this._eventRegistry[eventName];\n if (!listeners)\n listeners = this._eventRegistry[eventName] = [];\n\n if (listeners.indexOf(callback) == -1)\n listeners[capturing ? \"unshift\" : \"push\"](callback);\n return callback;\n};\n\nEventEmitter.off =\nEventEmitter.removeListener =\nEventEmitter.removeEventListener = function(eventName, callback) {\n this._eventRegistry = this._eventRegistry || {};\n\n var listeners = this._eventRegistry[eventName];\n if (!listeners)\n return;\n\n var index = listeners.indexOf(callback);\n if (index !== -1)\n listeners.splice(index, 1);\n};\n\nEventEmitter.removeAllListeners = function(eventName) {\n if (this._eventRegistry) this._eventRegistry[eventName] = [];\n};\n\nexports.EventEmitter = EventEmitter;\n\n});\n\nace.define(\"ace/lib/app_config\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/event_emitter\"], function(acequire, exports, module) {\n\"no use strict\";\n\nvar oop = acequire(\"./oop\");\nvar EventEmitter = acequire(\"./event_emitter\").EventEmitter;\n\nvar optionsProvider = {\n setOptions: function(optList) {\n Object.keys(optList).forEach(function(key) {\n this.setOption(key, optList[key]);\n }, this);\n },\n getOptions: function(optionNames) {\n var result = {};\n if (!optionNames) {\n optionNames = Object.keys(this.$options);\n } else if (!Array.isArray(optionNames)) {\n result = optionNames;\n optionNames = Object.keys(result);\n }\n optionNames.forEach(function(key) {\n result[key] = this.getOption(key);\n }, this);\n return result;\n },\n setOption: function(name, value) {\n if (this[\"$\" + name] === value)\n return;\n var opt = this.$options[name];\n if (!opt) {\n return warn('misspelled option \"' + name + '\"');\n }\n if (opt.forwardTo)\n return this[opt.forwardTo] && this[opt.forwardTo].setOption(name, value);\n\n if (!opt.handlesSet)\n this[\"$\" + name] = value;\n if (opt && opt.set)\n opt.set.call(this, value);\n },\n getOption: function(name) {\n var opt = this.$options[name];\n if (!opt) {\n return warn('misspelled option \"' + name + '\"');\n }\n if (opt.forwardTo)\n return this[opt.forwardTo] && this[opt.forwardTo].getOption(name);\n return opt && opt.get ? opt.get.call(this) : this[\"$\" + name];\n }\n};\n\nfunction warn(message) {\n if (typeof console != \"undefined\" && console.warn)\n console.warn.apply(console, arguments);\n}\n\nfunction reportError(msg, data) {\n var e = new Error(msg);\n e.data = data;\n if (typeof console == \"object\" && console.error)\n console.error(e);\n setTimeout(function() { throw e; });\n}\n\nvar AppConfig = function() {\n this.$defaultOptions = {};\n};\n\n(function() {\n oop.implement(this, EventEmitter);\n this.defineOptions = function(obj, path, options) {\n if (!obj.$options)\n this.$defaultOptions[path] = obj.$options = {};\n\n Object.keys(options).forEach(function(key) {\n var opt = options[key];\n if (typeof opt == \"string\")\n opt = {forwardTo: opt};\n\n opt.name || (opt.name = key);\n obj.$options[opt.name] = opt;\n if (\"initialValue\" in opt)\n obj[\"$\" + opt.name] = opt.initialValue;\n });\n oop.implement(obj, optionsProvider);\n\n return this;\n };\n\n this.resetOptions = function(obj) {\n Object.keys(obj.$options).forEach(function(key) {\n var opt = obj.$options[key];\n if (\"value\" in opt)\n obj.setOption(key, opt.value);\n });\n };\n\n this.setDefaultValue = function(path, name, value) {\n var opts = this.$defaultOptions[path] || (this.$defaultOptions[path] = {});\n if (opts[name]) {\n if (opts.forwardTo)\n this.setDefaultValue(opts.forwardTo, name, value);\n else\n opts[name].value = value;\n }\n };\n\n this.setDefaultValues = function(path, optionHash) {\n Object.keys(optionHash).forEach(function(key) {\n this.setDefaultValue(path, key, optionHash[key]);\n }, this);\n };\n \n this.warn = warn;\n this.reportError = reportError;\n \n}).call(AppConfig.prototype);\n\nexports.AppConfig = AppConfig;\n\n});\n\nace.define(\"ace/config\",[\"require\",\"exports\",\"module\",\"ace/lib/lang\",\"ace/lib/oop\",\"ace/lib/net\",\"ace/lib/app_config\"], function(acequire, exports, module) {\n\"no use strict\";\n\nvar lang = acequire(\"./lib/lang\");\nvar oop = acequire(\"./lib/oop\");\nvar net = acequire(\"./lib/net\");\nvar AppConfig = acequire(\"./lib/app_config\").AppConfig;\n\nmodule.exports = exports = new AppConfig();\n\nvar global = (function() {\n return this || typeof window != \"undefined\" && window;\n})();\n\nvar options = {\n packaged: false,\n workerPath: null,\n modePath: null,\n themePath: null,\n basePath: \"\",\n suffix: \".js\",\n $moduleUrls: {}\n};\n\nexports.get = function(key) {\n if (!options.hasOwnProperty(key))\n throw new Error(\"Unknown config key: \" + key);\n\n return options[key];\n};\n\nexports.set = function(key, value) {\n if (!options.hasOwnProperty(key))\n throw new Error(\"Unknown config key: \" + key);\n\n options[key] = value;\n};\n\nexports.all = function() {\n return lang.copyObject(options);\n};\nexports.moduleUrl = function(name, component) {\n if (options.$moduleUrls[name])\n return options.$moduleUrls[name];\n\n var parts = name.split(\"/\");\n component = component || parts[parts.length - 2] || \"\";\n var sep = component == \"snippets\" ? \"/\" : \"-\";\n var base = parts[parts.length - 1];\n if (component == \"worker\" && sep == \"-\") {\n var re = new RegExp(\"^\" + component + \"[\\\\-_]|[\\\\-_]\" + component + \"$\", \"g\");\n base = base.replace(re, \"\");\n }\n\n if ((!base || base == component) && parts.length > 1)\n base = parts[parts.length - 2];\n var path = options[component + \"Path\"];\n if (path == null) {\n path = options.basePath;\n } else if (sep == \"/\") {\n component = sep = \"\";\n }\n if (path && path.slice(-1) != \"/\")\n path += \"/\";\n return path + component + sep + base + this.get(\"suffix\");\n};\n\nexports.setModuleUrl = function(name, subst) {\n return options.$moduleUrls[name] = subst;\n};\n\nexports.$loading = {};\nexports.loadModule = function(moduleName, onLoad) {\n var module, moduleType;\n if (Array.isArray(moduleName)) {\n moduleType = moduleName[0];\n moduleName = moduleName[1];\n }\n\n try {\n module = acequire(moduleName);\n } catch (e) {}\n if (module && !exports.$loading[moduleName])\n return onLoad && onLoad(module);\n\n if (!exports.$loading[moduleName])\n exports.$loading[moduleName] = [];\n\n exports.$loading[moduleName].push(onLoad);\n\n if (exports.$loading[moduleName].length > 1)\n return;\n\n var afterLoad = function() {\n acequire([moduleName], function(module) {\n exports._emit(\"load.module\", {name: moduleName, module: module});\n var listeners = exports.$loading[moduleName];\n exports.$loading[moduleName] = null;\n listeners.forEach(function(onLoad) {\n onLoad && onLoad(module);\n });\n });\n };\n\n if (!exports.get(\"packaged\"))\n return afterLoad();\n net.loadScript(exports.moduleUrl(moduleName, moduleType), afterLoad);\n};\ninit(true);function init(packaged) {\n\n if (!global || !global.document)\n return;\n \n options.packaged = packaged || acequire.packaged || module.packaged || (global.define && define.packaged);\n\n var scriptOptions = {};\n var scriptUrl = \"\";\n var currentScript = (document.currentScript || document._currentScript ); // native or polyfill\n var currentDocument = currentScript && currentScript.ownerDocument || document;\n \n var scripts = currentDocument.getElementsByTagName(\"script\");\n for (var i=0; i<scripts.length; i++) {\n var script = scripts[i];\n\n var src = script.src || script.getAttribute(\"src\");\n if (!src)\n continue;\n\n var attributes = script.attributes;\n for (var j=0, l=attributes.length; j < l; j++) {\n var attr = attributes[j];\n if (attr.name.indexOf(\"data-ace-\") === 0) {\n scriptOptions[deHyphenate(attr.name.replace(/^data-ace-/, \"\"))] = attr.value;\n }\n }\n\n var m = src.match(/^(.*)\\/ace(\\-\\w+)?\\.js(\\?|$)/);\n if (m)\n scriptUrl = m[1];\n }\n\n if (scriptUrl) {\n scriptOptions.base = scriptOptions.base || scriptUrl;\n scriptOptions.packaged = true;\n }\n\n scriptOptions.basePath = scriptOptions.base;\n scriptOptions.workerPath = scriptOptions.workerPath || scriptOptions.base;\n scriptOptions.modePath = scriptOptions.modePath || scriptOptions.base;\n scriptOptions.themePath = scriptOptions.themePath || scriptOptions.base;\n delete scriptOptions.base;\n\n for (var key in scriptOptions)\n if (typeof scriptOptions[key] !== \"undefined\")\n exports.set(key, scriptOptions[key]);\n}\n\nexports.init = init;\n\nfunction deHyphenate(str) {\n return str.replace(/-(.)/g, function(m, m1) { return m1.toUpperCase(); });\n}\n\n});\n\nace.define(\"ace/mouse/mouse_handler\",[\"require\",\"exports\",\"module\",\"ace/lib/event\",\"ace/lib/useragent\",\"ace/mouse/default_handlers\",\"ace/mouse/default_gutter_handler\",\"ace/mouse/mouse_event\",\"ace/mouse/dragdrop_handler\",\"ace/config\"], function(acequire, exports, module) {\n\"use strict\";\n\nvar event = acequire(\"../lib/event\");\nvar useragent = acequire(\"../lib/useragent\");\nvar DefaultHandlers = acequire(\"./default_handlers\").DefaultHandlers;\nvar DefaultGutterHandler = acequire(\"./default_gutter_handler\").GutterHandler;\nvar MouseEvent = acequire(\"./mouse_event\").MouseEvent;\nvar DragdropHandler = acequire(\"./dragdrop_handler\").DragdropHandler;\nvar config = acequire(\"../config\");\n\nvar MouseHandler = function(editor) {\n var _self = this;\n this.editor = editor;\n\n new DefaultHandlers(this);\n new DefaultGutterHandler(this);\n new DragdropHandler(this);\n\n var focusEditor = function(e) {\n var windowBlurred = !document.hasFocus || !document.hasFocus()\n || !editor.isFocused() && document.activeElement == (editor.textInput && editor.textInput.getElement());\n if (windowBlurred)\n window.focus();\n editor.focus();\n };\n\n var mouseTarget = editor.renderer.getMouseEventTarget();\n event.addListener(mouseTarget, \"click\", this.onMouseEvent.bind(this, \"click\"));\n event.addListener(mouseTarget, \"mousemove\", this.onMouseMove.bind(this, \"mousemove\"));\n event.addMultiMouseDownListener([\n mouseTarget,\n editor.renderer.scrollBarV && editor.renderer.scrollBarV.inner,\n editor.renderer.scrollBarH && editor.renderer.scrollBarH.inner,\n editor.textInput && editor.textInput.getElement()\n ].filter(Boolean), [400, 300, 250], this, \"onMouseEvent\");\n event.addMouseWheelListener(editor.container, this.onMouseWheel.bind(this, \"mousewheel\"));\n event.addTouchMoveListener(editor.container, this.onTouchMove.bind(this, \"touchmove\"));\n\n var gutterEl = editor.renderer.$gutter;\n event.addListener(gutterEl, \"mousedown\", this.onMouseEvent.bind(this, \"guttermousedown\"));\n event.addListener(gutterEl, \"click\", this.onMouseEvent.bind(this, \"gutterclick\"));\n event.addListener(gutterEl, \"dblclick\", this.onMouseEvent.bind(this, \"gutterdblclick\"));\n event.addListener(gutterEl, \"mousemove\", this.onMouseEvent.bind(this, \"guttermousemove\"));\n\n event.addListener(mouseTarget, \"mousedown\", focusEditor);\n event.addListener(gutterEl, \"mousedown\", focusEditor);\n if (useragent.isIE && editor.renderer.scrollBarV) {\n event.addListener(editor.renderer.scrollBarV.element, \"mousedown\", focusEditor);\n event.addListener(editor.renderer.scrollBarH.element, \"mousedown\", focusEditor);\n }\n\n editor.on(\"mousemove\", function(e){\n if (_self.state || _self.$dragDelay || !_self.$dragEnabled)\n return;\n\n var character = editor.renderer.screenToTextCoordinates(e.x, e.y);\n var range = editor.session.selection.getRange();\n var renderer = editor.renderer;\n\n if (!range.isEmpty() && range.insideStart(character.row, character.column)) {\n renderer.setCursorStyle(\"default\");\n } else {\n renderer.setCursorStyle(\"\");\n }\n });\n};\n\n(function() {\n this.onMouseEvent = function(name, e) {\n this.editor._emit(name, new MouseEvent(e, this.editor));\n };\n\n this.onMouseMove = function(name, e) {\n var listeners = this.editor._eventRegistry && this.editor._eventRegistry.mousemove;\n if (!listeners || !listeners.length)\n return;\n\n this.editor._emit(name, new MouseEvent(e, this.editor));\n };\n\n this.onMouseWheel = function(name, e) {\n var mouseEvent = new MouseEvent(e, this.editor);\n mouseEvent.speed = this.$scrollSpeed * 2;\n mouseEvent.wheelX = e.wheelX;\n mouseEvent.wheelY = e.wheelY;\n\n this.editor._emit(name, mouseEvent);\n };\n \n this.onTouchMove = function (name, e) {\n var mouseEvent = new MouseEvent(e, this.editor);\n mouseEvent.speed = 1;//this.$scrollSpeed * 2;\n mouseEvent.wheelX = e.wheelX;\n mouseEvent.wheelY = e.wheelY;\n this.editor._emit(name, mouseEvent);\n };\n\n this.setState = function(state) {\n this.state = state;\n };\n\n this.captureMouse = function(ev, mouseMoveHandler) {\n this.x = ev.x;\n this.y = ev.y;\n\n this.isMousePressed = true;\n var renderer = this.editor.renderer;\n if (renderer.$keepTextAreaAtCursor)\n renderer.$keepTextAreaAtCursor = null;\n\n var self = this;\n var onMouseMove = function(e) {\n if (!e) return;\n if (useragent.isWebKit && !e.which && self.releaseMouse)\n return self.releaseMouse();\n\n self.x = e.clientX;\n self.y = e.clientY;\n mouseMoveHandler && mouseMoveHandler(e);\n self.mouseEvent = new MouseEvent(e, self.editor);\n self.$mouseMoved = true;\n };\n\n var onCaptureEnd = function(e) {\n clearInterval(timerId);\n onCaptureInterval();\n self[self.state + \"End\"] && self[self.state + \"End\"](e);\n self.state = \"\";\n if (renderer.$keepTextAreaAtCursor == null) {\n renderer.$keepTextAreaAtCursor = true;\n renderer.$moveTextAreaToCursor();\n }\n self.isMousePressed = false;\n self.$onCaptureMouseMove = self.releaseMouse = null;\n e && self.onMouseEvent(\"mouseup\", e);\n };\n\n var onCaptureInterval = function() {\n self[self.state] && self[self.state]();\n self.$mouseMoved = false;\n };\n\n if (useragent.isOldIE && ev.domEvent.type == \"dblclick\") {\n return setTimeout(function() {onCaptureEnd(ev);});\n }\n\n self.$onCaptureMouseMove = onMouseMove;\n self.releaseMouse = event.capture(this.editor.container, onMouseMove, onCaptureEnd);\n var timerId = setInterval(onCaptureInterval, 20);\n };\n this.releaseMouse = null;\n this.cancelContextMenu = function() {\n var stop = function(e) {\n if (e && e.domEvent && e.domEvent.type != \"contextmenu\")\n return;\n this.editor.off(\"nativecontextmenu\", stop);\n if (e && e.domEvent)\n event.stopEvent(e.domEvent);\n }.bind(this);\n setTimeout(stop, 10);\n this.editor.on(\"nativecontextmenu\", stop);\n };\n}).call(MouseHandler.prototype);\n\nconfig.defineOptions(MouseHandler.prototype, \"mouseHandler\", {\n scrollSpeed: {initialValue: 2},\n dragDelay: {initialValue: (useragent.isMac ? 150 : 0)},\n dragEnabled: {initialValue: true},\n focusTimout: {initialValue: 0},\n tooltipFollowsMouse: {initialValue: true}\n});\n\n\nexports.MouseHandler = MouseHandler;\n});\n\nace.define(\"ace/mouse/fold_handler\",[\"require\",\"exports\",\"module\"], function(acequire, exports, module) {\n\"use strict\";\n\nfunction FoldHandler(editor) {\n\n editor.on(\"click\", function(e) {\n var position = e.getDocumentPosition();\n var session = editor.session;\n var fold = session.getFoldAt(position.row, position.column, 1);\n if (fold) {\n if (e.getAccelKey())\n session.removeFold(fold);\n else\n session.expandFold(fold);\n\n e.stop();\n }\n });\n\n editor.on(\"gutterclick\", function(e) {\n var gutterRegion = editor.renderer.$gutterLayer.getRegion(e);\n\n if (gutterRegion == \"foldWidgets\") {\n var row = e.getDocumentPosition().row;\n var session = editor.session;\n if (session.foldWidgets && session.foldWidgets[row])\n editor.session.onFoldWidgetClick(row, e);\n if (!editor.isFocused())\n editor.focus();\n e.stop();\n }\n });\n\n editor.on(\"gutterdblclick\", function(e) {\n var gutterRegion = editor.renderer.$gutterLayer.getRegion(e);\n\n if (gutterRegion == \"foldWidgets\") {\n var row = e.getDocumentPosition().row;\n var session = editor.session;\n var data = session.getParentFoldRangeData(row, true);\n var range = data.range || data.firstRange;\n\n if (range) {\n row = range.start.row;\n var fold = session.getFoldAt(row, session.getLine(row).length, 1);\n\n if (fold) {\n session.removeFold(fold);\n } else {\n session.addFold(\"...\", range);\n editor.renderer.scrollCursorIntoView({row: range.start.row, column: 0});\n }\n }\n e.stop();\n }\n });\n}\n\nexports.FoldHandler = FoldHandler;\n\n});\n\nace.define(\"ace/keyboard/keybinding\",[\"require\",\"exports\",\"module\",\"ace/lib/keys\",\"ace/lib/event\"], function(acequire, exports, module) {\n\"use strict\";\n\nvar keyUtil = acequire(\"../lib/keys\");\nvar event = acequire(\"../lib/event\");\n\nvar KeyBinding = function(editor) {\n this.$editor = editor;\n this.$data = {editor: editor};\n this.$handlers = [];\n this.setDefaultHandler(editor.commands);\n};\n\n(function() {\n this.setDefaultHandler = function(kb) {\n this.removeKeyboardHandler(this.$defaultHandler);\n this.$defaultHandler = kb;\n this.addKeyboardHandler(kb, 0);\n };\n\n this.setKeyboardHandler = function(kb) {\n var h = this.$handlers;\n if (h[h.length - 1] == kb)\n return;\n\n while (h[h.length - 1] && h[h.length - 1] != this.$defaultHandler)\n this.removeKeyboardHandler(h[h.length - 1]);\n\n this.addKeyboardHandler(kb, 1);\n };\n\n this.addKeyboardHandler = function(kb, pos) {\n if (!kb)\n return;\n if (typeof kb == \"function\" && !kb.handleKeyboard)\n kb.handleKeyboard = kb;\n var i = this.$handlers.indexOf(kb);\n if (i != -1)\n this.$handlers.splice(i, 1);\n\n if (pos == undefined)\n this.$handlers.push(kb);\n else\n this.$handlers.splice(pos, 0, kb);\n\n if (i == -1 && kb.attach)\n kb.attach(this.$editor);\n };\n\n this.removeKeyboardHandler = function(kb) {\n var i = this.$handlers.indexOf(kb);\n if (i == -1)\n return false;\n this.$handlers.splice(i, 1);\n kb.detach && kb.detach(this.$editor);\n return true;\n };\n\n this.getKeyboardHandler = function() {\n return this.$handlers[this.$handlers.length - 1];\n };\n \n this.getStatusText = function() {\n var data = this.$data;\n var editor = data.editor;\n return this.$handlers.map(function(h) {\n return h.getStatusText && h.getStatusText(editor, data) || \"\";\n }).filter(Boolean).join(\" \");\n };\n\n this.$callKeyboardHandlers = function(hashId, keyString, keyCode, e) {\n var toExecute;\n var success = false;\n var commands = this.$editor.commands;\n\n for (var i = this.$handlers.length; i--;) {\n toExecute = this.$handlers[i].handleKeyboard(\n this.$data, hashId, keyString, keyCode, e\n );\n if (!toExecute || !toExecute.command)\n continue;\n if (toExecute.command == \"null\") {\n success = true;\n } else {\n success = commands.exec(toExecute.command, this.$editor, toExecute.args, e);\n }\n if (success && e && hashId != -1 && \n toExecute.passEvent != true && toExecute.command.passEvent != true\n ) {\n event.stopEvent(e);\n }\n if (success)\n break;\n }\n \n if (!success && hashId == -1) {\n toExecute = {command: \"insertstring\"};\n success = commands.exec(\"insertstring\", this.$editor, keyString);\n }\n \n if (success && this.$editor._signal)\n this.$editor._signal(\"keyboardActivity\", toExecute);\n \n return success;\n };\n\n this.onCommandKey = function(e, hashId, keyCode) {\n var keyString = keyUtil.keyCodeToString(keyCode);\n this.$callKeyboardHandlers(hashId, keyString, keyCode, e);\n };\n\n this.onTextInput = function(text) {\n this.$callKeyboardHandlers(-1, text);\n };\n\n}).call(KeyBinding.prototype);\n\nexports.KeyBinding = KeyBinding;\n});\n\nace.define(\"ace/lib/bidiutil\",[\"require\",\"exports\",\"module\"], function(acequire, exports, module) {\n\"use strict\";\n\nvar ArabicAlefBetIntervalsBegine = ['\\u0621', '\\u0641'];\nvar ArabicAlefBetIntervalsEnd = ['\\u063A', '\\u064a'];\nvar dir = 0, hiLevel = 0;\nvar lastArabic = false, hasUBAT_AL = false, hasUBAT_B = false, hasUBAT_S = false, hasBlockSep = false, hasSegSep = false;\n\nvar impTab_LTR = [\t[\t0,\t\t3,\t\t0,\t\t1,\t\t0,\t\t0,\t\t0\t],\t[\t0,\t\t3,\t\t0,\t\t1,\t\t2,\t\t2,\t\t0\t],\t[\t0,\t\t3,\t\t0,\t\t0x11,\t\t2,\t\t0,\t\t1\t],\t[\t0,\t\t3,\t\t5,\t\t5,\t\t4,\t\t1,\t\t0\t],\t[\t0,\t\t3,\t\t0x15,\t\t0x15,\t\t4,\t\t0,\t\t1\t],\t[\t0,\t\t3,\t\t5,\t\t5,\t\t4,\t\t2,\t\t0\t]\n];\n\nvar impTab_RTL = [\t[\t2,\t\t0,\t\t1,\t\t1,\t\t0,\t\t1,\t\t0\t],\t[\t2,\t\t0,\t\t1,\t\t1,\t\t0,\t\t2,\t\t0\t],\t[\t2,\t\t0,\t\t2,\t\t1,\t\t3,\t\t2,\t\t0\t],\t[\t2,\t\t0,\t\t2,\t\t0x21,\t\t3,\t\t1,\t\t1\t]\n];\n\nvar LTR = 0, RTL = 1;\n\nvar L = 0;\nvar R = 1;\nvar EN = 2;\nvar AN = 3;\nvar ON = 4;\nvar B = 5;\nvar S = 6;\nvar AL = 7;\nvar WS = 8;\nvar CS = 9;\nvar ES = 10;\nvar ET = 11;\nvar NSM = 12;\nvar LRE = 13;\nvar RLE = 14;\nvar PDF = 15;\nvar LRO = 16;\nvar RLO = 17;\nvar BN = 18;\n\nvar UnicodeTBL00 = [\nBN,BN,BN,BN,BN,BN,BN,BN,BN,S,B,S,WS,B,BN,BN,\nBN,BN,BN,BN,BN,BN,BN,BN,BN,BN,BN,BN,B,B,B,S,\nWS,ON,ON,ET,ET,ET,ON,ON,ON,ON,ON,ES,CS,ES,CS,CS,\nEN,EN,EN,EN,EN,EN,EN,EN,EN,EN,CS,ON,ON,ON,ON,ON,\nON,L,L,L,L,L,L,L,L,L,L,L,L,L,L,L,\nL,L,L,L,L,L,L,L,L,L,L,ON,ON,ON,ON,ON,\nON,L,L,L,L,L,L,L,L,L,L,L,L,L,L,L,\nL,L,L,L,L,L,L,L,L,L,L,ON,ON,ON,ON,BN,\nBN,BN,BN,BN,BN,B,BN,BN,BN,BN,BN,BN,BN,BN,BN,BN,\nBN,BN,BN,BN,BN,BN,BN,BN,BN,BN,BN,BN,BN,BN,BN,BN,\nCS,ON,ET,ET,ET,ET,ON,ON,ON,ON,L,ON,ON,BN,ON,ON,\nET,ET,EN,EN,ON,L,ON,ON,ON,EN,L,ON,ON,ON,ON,ON\n];\n\nvar UnicodeTBL20 = [\nWS,WS,WS,WS,WS,WS,WS,WS,WS,WS,WS,BN,BN,BN,L,R\t,\nON,ON,ON,ON,ON,ON,ON,ON,ON,ON,ON,ON,ON,ON,ON,ON,\nON,ON,ON,ON,ON,ON,ON,ON,WS,B,LRE,RLE,PDF,LRO,RLO,CS,\nET,ET,ET,ET,ET,ON,ON,ON,ON,ON,ON,ON,ON,ON,ON,ON,\nON,ON,ON,ON,CS,ON,ON,ON,ON,ON,ON,ON,ON,ON,ON,ON,\nON,ON,ON,ON,ON,ON,ON,ON,ON,ON,ON,ON,ON,ON,ON,WS\n];\n\nfunction _computeLevels(chars, levels, len, charTypes) {\n\tvar impTab = dir ? impTab_RTL : impTab_LTR\n\t\t, prevState = null, newClass = null, newLevel = null, newState = 0\n\t\t, action = null, cond = null, condPos = -1, i = null, ix = null, classes = [];\n\n\tif (!charTypes) {\n\t\tfor (i = 0, charTypes = []; i < len; i++) {\n\t\t\tcharTypes[i] = _getCharacterType(chars[i]);\n\t\t}\n\t}\n\thiLevel = dir;\n\tlastArabic = false;\n\thasUBAT_AL = false;\n\thasUBAT_B = false;\n\thasUBAT_S = false;\n\tfor (ix = 0; ix < len; ix++){\n\t\tprevState = newState;\n\t\tclasses[ix] = newClass = _getCharClass(chars, charTypes, classes, ix);\n\t\tnewState = impTab[prevState][newClass];\n\t\taction = newState & 0xF0;\n\t\tnewState &= 0x0F;\n\t\tlevels[ix] = newLevel = impTab[newState][5];\n\t\tif (action > 0){\n\t\t\tif (action == 0x10){\n\t\t\t\tfor(i = condPos; i < ix; i++){\n\t\t\t\t\tlevels[i] = 1;\n\t\t\t\t}\n\t\t\t\tcondPos = -1;\n\t\t\t} else {\n\t\t\t\tcondPos = -1;\n\t\t\t}\n\t\t}\n\t\tcond = impTab[newState][6];\n\t\tif (cond){\n\t\t\tif(condPos == -1){\n\t\t\t\tcondPos = ix;\n\t\t\t}\n\t\t}else{\n\t\t\tif (condPos > -1){\n\t\t\t\tfor(i = condPos; i < ix; i++){\n\t\t\t\t\tlevels[i] = newLevel;\n\t\t\t\t}\n\t\t\t\tcondPos = -1;\n\t\t\t}\n\t\t}\n\t\tif (charTypes[ix] == B){\n\t\t\tlevels[ix] = 0;\n\t\t}\n\t\thiLevel |= newLevel;\n\t}\n\tif (hasUBAT_S){\n\t\tfor(i = 0; i < len; i++){\n\t\t\tif(charTypes[i] == S){\n\t\t\t\tlevels[i] = dir;\n\t\t\t\tfor(var j = i - 1; j >= 0; j--){\n\t\t\t\t\tif(charTypes[j] == WS){\n\t\t\t\t\t\tlevels[j] = dir;\n\t\t\t\t\t}else{\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n\nfunction _invertLevel(lev, levels, _array) {\n\tif (hiLevel < lev){\n\t\treturn;\n\t}\n\tif (lev == 1 && dir == RTL && !hasUBAT_B){\n\t\t_array.reverse();\n\t\treturn;\n\t}\n\tvar len = _array.length, start = 0, end, lo, hi, tmp;\n\twhile(start < len){\n\t\tif (levels[start] >= lev){\n\t\t\tend = start + 1;\n\t\twhile(end < len && levels[end] >= lev){\n\t\t\tend++;\n\t\t}\n\t\tfor(lo = start, hi = end - 1 ; lo < hi; lo++, hi--){\n\t\t\ttmp = _array[lo];\n\t\t\t_array[lo] = _array[hi];\n\t\t\t_array[hi] = tmp;\n\t\t}\n\t\tstart = end;\n\t}\n\tstart++;\n\t}\n}\n\nfunction _getCharClass(chars, types, classes, ix) {\n\tvar cType = types[ix], wType, nType, len, i;\n\tswitch(cType){\n\t\tcase L:\n\t\tcase R:\n\t\t\tlastArabic = false;\n\t\tcase ON:\n\t\tcase AN:\n\t\t\treturn cType;\n\t\tcase EN:\n\t\t\treturn lastArabic ? AN : EN;\n\t\tcase AL:\n\t\t\tlastArabic = true;\n\t\t\thasUBAT_AL = true;\n\t\t\treturn R;\n\t\tcase WS:\n\t\t\treturn ON;\n\t\tcase CS:\n\t\t\tif (ix < 1 || (ix + 1) >= types.length ||\n\t\t\t\t((wType = classes[ix - 1]) != EN && wType != AN) ||\n\t\t\t\t((nType = types[ix + 1]) != EN && nType != AN)){\n\t\t\t\treturn ON;\n\t\t\t}\n\t\t\tif (lastArabic){nType = AN;}\n\t\t\treturn nType == wType ? nType : ON;\n\t\tcase ES:\n\t\t\twType = ix > 0 ? classes[ix - 1] : B;\n\t\t\tif (wType == EN && (ix + 1) < types.length && types[ix + 1] == EN){\n\t\t\t\treturn EN;\n\t\t\t}\n\t\t\treturn ON;\n\t\tcase ET:\n\t\t\tif (ix > 0 && classes[ix - 1] == EN){\n\t\t\t\treturn EN;\n\t\t\t}\n\t\t\tif (lastArabic){\n\t\t\t\treturn ON;\n\t\t\t}\n\t\t\ti = ix + 1;\n\t\t\tlen = types.length;\n\t\t\twhile (i < len && types[i] == ET){\n\t\t\t\ti++;\n\t\t\t}\n\t\t\tif (i < len && types[i] == EN){\n\t\t\t\treturn EN;\n\t\t\t}\n\t\t\treturn ON;\n\t\tcase NSM:\n\t\t\tlen = types.length;\n\t\t\ti = ix + 1;\n\t\t\twhile (i < len && types[i] == NSM){\n\t\t\t\ti++;\n\t\t\t}\n\t\t\tif (i < len){\n\t\t\t\tvar c = chars[ix], rtlCandidate = (c >= 0x0591 && c <= 0x08FF) || c == 0xFB1E;\n\n\t\t\t\twType = types[i];\n\t\t\t\tif (rtlCandidate && (wType == R || wType == AL)){\n\t\t\t\t\treturn R;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (ix < 1 || (wType = types[ix - 1]) == B){\n\t\t\t\treturn ON;\n\t\t\t}\n\t\t\treturn classes[ix - 1];\n\t\tcase B:\n\t\t\tlastArabic = false;\n\t\t\thasUBAT_B = true;\n\t\t\treturn dir;\n\t\tcase S:\n\t\t\thasUBAT_S = true;\n\t\t\treturn ON;\n\t\tcase LRE:\n\t\tcase RLE:\n\t\tcase LRO:\n\t\tcase RLO:\n\t\tcase PDF:\n\t\t\tlastArabic = false;\n\t\tcase BN:\n\t\t\treturn ON;\n\t}\n}\n\nfunction _getCharacterType( ch ) {\n\tvar uc = ch.charCodeAt(0), hi = uc >> 8;\n\n\tif (hi == 0) {\n\t\treturn ((uc > 0x00BF) ? L : UnicodeTBL00[uc]);\n\t} else if (hi == 5) {\n\t\treturn (/[\\u0591-\\u05f4]/.test(ch) ? R : L);\n\t} else if (hi == 6) {\n\t\tif (/[\\u0610-\\u061a\\u064b-\\u065f\\u06d6-\\u06e4\\u06e7-\\u06ed]/.test(ch))\n\t\t\treturn NSM;\n\t\telse if (/[\\u0660-\\u0669\\u066b-\\u066c]/.test(ch))\n\t\t\treturn AN;\n\t\telse if (uc == 0x066A)\n\t\t\treturn ET;\n\t\telse if (/[\\u06f0-\\u06f9]/.test(ch))\n\t\t\treturn EN;\n\t\telse\n\t\t\treturn AL;\n\t} else if (hi == 0x20 && uc <= 0x205F) {\n\t\treturn UnicodeTBL20[uc & 0xFF];\n\t} else if (hi == 0xFE) {\n\t\treturn (uc >= 0xFE70 ? AL : ON);\n\t}\n\treturn ON;\n}\n\nfunction _isArabicDiacritics( ch ) {\n\treturn (ch >= '\\u064b' && ch <= '\\u0655');\n}\nexports.L = L;\nexports.R = R;\nexports.EN = EN;\nexports.ON_R = 3;\nexports.AN = 4;\nexports.R_H = 5;\nexports.B = 6;\n\nexports.DOT = \"\\xB7\";\nexports.doBidiReorder = function(text, textCharTypes, isRtl) {\n\tif (text.length < 2)\n\t\treturn {};\n\n\tvar chars = text.split(\"\"), logicalFromVisual = new Array(chars.length),\n\t\tbidiLevels = new Array(chars.length), levels = [];\n\n\tdir = isRtl ? RTL : LTR;\n\n\t_computeLevels(chars, levels, chars.length, textCharTypes);\n\n\tfor (var i = 0; i < logicalFromVisual.length; logicalFromVisual[i] = i, i++);\n\n\t_invertLevel(2, levels, logicalFromVisual);\n\t_invertLevel(1, levels, logicalFromVisual);\n\n\tfor (var i = 0; i < logicalFromVisual.length - 1; i++) { //fix levels to reflect character width\n\t\tif (textCharTypes[i] === AN) {\n\t\t\tlevels[i] = exports.AN;\n\t\t} else if (levels[i] === R && ((textCharTypes[i] > AL && textCharTypes[i] < LRE)\n\t\t\t|| textCharTypes[i] === ON || textCharTypes[i] === BN)) {\n\t\t\tlevels[i] = exports.ON_R;\n\t\t} else if ((i > 0 && chars[i - 1] === '\\u0644') && /\\u0622|\\u0623|\\u0625|\\u0627/.test(chars[i])) {\n\t\t\tlevels[i - 1] = levels[i] = exports.R_H;\n\t\t\ti++;\n\t\t}\n\t}\n\tif (chars[chars.length - 1] === exports.DOT)\n\t\tlevels[chars.length - 1] = exports.B;\n\n\tfor (var i = 0; i < logicalFromVisual.length; i++) {\n\t\tbidiLevels[i] = levels[logicalFromVisual[i]];\n\t}\n\n\treturn {'logicalFromVisual': logicalFromVisual, 'bidiLevels': bidiLevels};\n};\nexports.hasBidiCharacters = function(text, textCharTypes){\n\tvar ret = false;\n\tfor (var i = 0; i < text.length; i++){\n\t\ttextCharTypes[i] = _getCharacterType(text.charAt(i));\n\t\tif (!ret && (textCharTypes[i] == R || textCharTypes[i] == AL))\n\t\t\tret = true;\n\t}\n\treturn ret;\n};\nexports.getVisualFromLogicalIdx = function(logIdx, rowMap) {\n\tfor (var i = 0; i < rowMap.logicalFromVisual.length; i++) {\n\t\tif (rowMap.logicalFromVisual[i] == logIdx)\n\t\t\treturn i;\n\t}\n\treturn 0;\n};\n\n});\n\nace.define(\"ace/bidihandler\",[\"require\",\"exports\",\"module\",\"ace/lib/bidiutil\",\"ace/lib/lang\",\"ace/lib/useragent\"], function(acequire, exports, module) {\n\"use strict\";\n\nvar bidiUtil = acequire(\"./lib/bidiutil\");\nvar lang = acequire(\"./lib/lang\");\nvar useragent = acequire(\"./lib/useragent\");\nvar bidiRE = /[\\u0590-\\u05f4\\u0600-\\u06ff\\u0700-\\u08ac]/;\nvar BidiHandler = function(session) {\n this.session = session;\n this.bidiMap = {};\n this.currentRow = null;\n this.bidiUtil = bidiUtil;\n this.charWidths = [];\n this.EOL = \"\\xAC\";\n this.showInvisibles = true;\n this.isRtlDir = false;\n this.line = \"\";\n this.wrapIndent = 0;\n this.isLastRow = false;\n this.EOF = \"\\xB6\";\n this.seenBidi = false;\n};\n\n(function() {\n this.isBidiRow = function(screenRow, docRow, splitIndex) {\n if (!this.seenBidi)\n return false;\n if (screenRow !== this.currentRow) {\n this.currentRow = screenRow;\n this.updateRowLine(docRow, splitIndex);\n this.updateBidiMap();\n }\n return this.bidiMap.bidiLevels;\n };\n\n this.onChange = function(delta) {\n if (!this.seenBidi) {\n if (delta.action == \"insert\" && bidiRE.test(delta.lines.join(\"\\n\"))) {\n this.seenBidi = true;\n this.currentRow = null;\n }\n }\n else {\n this.currentRow = null;\n }\n };\n\n this.getDocumentRow = function() {\n var docRow = 0;\n var rowCache = this.session.$screenRowCache;\n if (rowCache.length) {\n var index = this.session.$getRowCacheIndex(rowCache, this.currentRow);\n if (index >= 0)\n docRow = this.session.$docRowCache[index];\n }\n\n return docRow;\n };\n\n this.getSplitIndex = function() {\n var splitIndex = 0;\n var rowCache = this.session.$screenRowCache;\n if (rowCache.length) {\n var currentIndex, prevIndex = this.session.$getRowCacheIndex(rowCache, this.currentRow);\n while (this.currentRow - splitIndex > 0) {\n currentIndex = this.session.$getRowCacheIndex(rowCache, this.currentRow - splitIndex - 1);\n if (currentIndex !== prevIndex)\n break;\n\n prevIndex = currentIndex;\n splitIndex++;\n }\n }\n\n return splitIndex;\n };\n\n this.updateRowLine = function(docRow, splitIndex) {\n if (docRow === undefined)\n docRow = this.getDocumentRow();\n\n this.wrapIndent = 0;\n this.isLastRow = (docRow === this.session.getLength() - 1);\n this.line = this.session.getLine(docRow);\n if (this.session.$useWrapMode) {\n var splits = this.session.$wrapData[docRow];\n if (splits) {\n if (splitIndex === undefined)\n splitIndex = this.getSplitIndex();\n\n if(splitIndex > 0 && splits.length) {\n this.wrapIndent = splits.indent;\n this.line = (splitIndex < splits.length) ?\n this.line.substring(splits[splitIndex - 1], splits[splits.length - 1]) :\n this.line.substring(splits[splits.length - 1]);\n } else {\n this.line = this.line.substring(0, splits[splitIndex]);\n }\n }\n }\n var session = this.session, shift = 0, size;\n this.line = this.line.replace(/\\t|[\\u1100-\\u2029, \\u202F-\\uFFE6]/g, function(ch, i){\n if (ch === '\\t' || session.isFullWidth(ch.charCodeAt(0))) {\n size = (ch === '\\t') ? session.getScreenTabSize(i + shift) : 2;\n shift += size - 1;\n return lang.stringRepeat(bidiUtil.DOT, size);\n }\n return ch;\n });\n };\n\n this.updateBidiMap = function() {\n var textCharTypes = [], endOfLine = this.isLastRow ? this.EOF : this.EOL;\n var line = this.line + (this.showInvisibles ? endOfLine : bidiUtil.DOT);\n if (bidiUtil.hasBidiCharacters(line, textCharTypes)) {\n this.bidiMap = bidiUtil.doBidiReorder(line, textCharTypes, this.isRtlDir);\n } else {\n this.bidiMap = {};\n }\n };\n this.markAsDirty = function() {\n this.currentRow = null;\n };\n this.updateCharacterWidths = function(fontMetrics) {\n if (!this.seenBidi)\n return;\n if (this.characterWidth === fontMetrics.$characterSize.width)\n return;\n\n var characterWidth = this.characterWidth = fontMetrics.$characterSize.width;\n var bidiCharWidth = fontMetrics.$measureCharWidth(\"\\u05d4\");\n\n this.charWidths[bidiUtil.L] = this.charWidths[bidiUtil.EN] = this.charWidths[bidiUtil.ON_R] = characterWidth;\n this.charWidths[bidiUtil.R] = this.charWidths[bidiUtil.AN] = bidiCharWidth;\n this.charWidths[bidiUtil.R_H] = useragent.isChrome ? bidiCharWidth : bidiCharWidth * 0.45;\n this.charWidths[bidiUtil.B] = 0;\n\n this.currentRow = null;\n };\n\n this.getShowInvisibles = function() {\n return this.showInvisibles;\n };\n\n this.setShowInvisibles = function(showInvisibles) {\n this.showInvisibles = showInvisibles;\n this.currentRow = null;\n };\n\n this.setEolChar = function(eolChar) {\n this.EOL = eolChar;\n };\n\n this.setTextDir = function(isRtlDir) {\n this.isRtlDir = isRtlDir;\n };\n this.getPosLeft = function(col) {\n col -= this.wrapIndent;\n var visualIdx = bidiUtil.getVisualFromLogicalIdx(col > 0 ? col - 1 : 0, this.bidiMap),\n levels = this.bidiMap.bidiLevels, left = 0;\n\n if (col === 0 && levels[visualIdx] % 2 !== 0)\n visualIdx++;\n\n for (var i = 0; i < visualIdx; i++) {\n left += this.charWidths[levels[i]];\n }\n\n if (col !== 0 && levels[visualIdx] % 2 === 0)\n left += this.charWidths[levels[visualIdx]];\n\n if (this.wrapIndent)\n left += this.wrapIndent * this.charWidths[bidiUtil.L];\n\n return left;\n };\n this.getSelections = function(startCol, endCol) {\n var map = this.bidiMap, levels = map.bidiLevels, level, offset = this.wrapIndent * this.charWidths[bidiUtil.L], selections = [],\n selColMin = Math.min(startCol, endCol) - this.wrapIndent, selColMax = Math.max(startCol, endCol) - this.wrapIndent,\n isSelected = false, isSelectedPrev = false, selectionStart = 0;\n\n for (var logIdx, visIdx = 0; visIdx < levels.length; visIdx++) {\n logIdx = map.logicalFromVisual[visIdx];\n level = levels[visIdx];\n isSelected = (logIdx >= selColMin) && (logIdx < selColMax);\n if (isSelected && !isSelectedPrev) {\n selectionStart = offset;\n } else if (!isSelected && isSelectedPrev) {\n selections.push({left: selectionStart, width: offset - selectionStart});\n }\n offset += this.charWidths[level];\n isSelectedPrev = isSelected;\n }\n\n if (isSelected && (visIdx === levels.length)) {\n selections.push({left: selectionStart, width: offset - selectionStart});\n }\n\n return selections;\n };\n this.offsetToCol = function(posX) {\n var logicalIdx = 0, posX = Math.max(posX, 0),\n offset = 0, visualIdx = 0, levels = this.bidiMap.bidiLevels,\n charWidth = this.charWidths[levels[visualIdx]];\n\n if (this.wrapIndent) {\n posX -= this.wrapIndent * this.charWidths[bidiUtil.L];\n }\n\n while(posX > offset + charWidth/2) {\n offset += charWidth;\n if(visualIdx === levels.length - 1) {\n charWidth = 0;\n break;\n }\n charWidth = this.charWidths[levels[++visualIdx]];\n }\n\n if (visualIdx > 0 && (levels[visualIdx - 1] % 2 !== 0) && (levels[visualIdx] % 2 === 0)){\n if(posX < offset)\n visualIdx--;\n logicalIdx = this.bidiMap.logicalFromVisual[visualIdx];\n\n } else if (visualIdx > 0 && (levels[visualIdx - 1] % 2 === 0) && (levels[visualIdx] % 2 !== 0)){\n logicalIdx = 1 + ((posX > offset) ? this.bidiMap.logicalFromVisual[visualIdx]\n : this.bidiMap.logicalFromVisual[visualIdx - 1]);\n\n } else if ((this.isRtlDir && visualIdx === levels.length - 1 && charWidth === 0 && (levels[visualIdx - 1] % 2 === 0))\n || (!this.isRtlDir && visualIdx === 0 && (levels[visualIdx] % 2 !== 0))){\n logicalIdx = 1 + this.bidiMap.logicalFromVisual[visualIdx];\n } else {\n if (visualIdx > 0 && (levels[visualIdx - 1] % 2 !== 0) && charWidth !== 0)\n visualIdx--;\n logicalIdx = this.bidiMap.logicalFromVisual[visualIdx];\n }\n\n return (logicalIdx + this.wrapIndent);\n };\n\n}).call(BidiHandler.prototype);\n\nexports.BidiHandler = BidiHandler;\n});\n\nace.define(\"ace/range\",[\"require\",\"exports\",\"module\"], function(acequire, exports, module) {\n\"use strict\";\nvar comparePoints = function(p1, p2) {\n return p1.row - p2.row || p1.column - p2.column;\n};\nvar Range = function(startRow, startColumn, endRow, endColumn) {\n this.start = {\n row: startRow,\n column: startColumn\n };\n\n this.end = {\n row: endRow,\n column: endColumn\n };\n};\n\n(function() {\n this.isEqual = function(range) {\n return this.start.row === range.start.row &&\n this.end.row === range.end.row &&\n this.start.column === range.start.column &&\n this.end.column === range.end.column;\n };\n this.toString = function() {\n return (\"Range: [\" + this.start.row + \"/\" + this.start.column +\n \"] -> [\" + this.end.row + \"/\" + this.end.column + \"]\");\n };\n\n this.contains = function(row, column) {\n return this.compare(row, column) == 0;\n };\n this.compareRange = function(range) {\n var cmp,\n end = range.end,\n start = range.start;\n\n cmp = this.compare(end.row, end.column);\n if (cmp == 1) {\n cmp = this.compare(start.row, start.column);\n if (cmp == 1) {\n return 2;\n } else if (cmp == 0) {\n return 1;\n } else {\n return 0;\n }\n } else if (cmp == -1) {\n return -2;\n } else {\n cmp = this.compare(start.row, start.column);\n if (cmp == -1) {\n return -1;\n } else if (cmp == 1) {\n return 42;\n } else {\n return 0;\n }\n }\n };\n this.comparePoint = function(p) {\n return this.compare(p.row, p.column);\n };\n this.containsRange = function(range) {\n return this.comparePoint(range.start) == 0 && this.comparePoint(range.end) == 0;\n };\n this.intersects = function(range) {\n var cmp = this.compareRange(range);\n return (cmp == -1 || cmp == 0 || cmp == 1);\n };\n this.isEnd = function(row, column) {\n return this.end.row == row && this.end.column == column;\n };\n this.isStart = function(row, column) {\n return this.start.row == row && this.start.column == column;\n };\n this.setStart = function(row, column) {\n if (typeof row == \"object\") {\n this.start.column = row.column;\n this.start.row = row.row;\n } else {\n this.start.row = row;\n this.start.column = column;\n }\n };\n this.setEnd = function(row, column) {\n if (typeof row == \"object\") {\n this.end.column = row.column;\n this.end.row = row.row;\n } else {\n this.end.row = row;\n this.end.column = column;\n }\n };\n this.inside = function(row, column) {\n if (this.compare(row, column) == 0) {\n if (this.isEnd(row, column) || this.isStart(row, column)) {\n return false;\n } else {\n return true;\n }\n }\n return false;\n };\n this.insideStart = function(row, column) {\n if (this.compare(row, column) == 0) {\n if (this.isEnd(row, column)) {\n return false;\n } else {\n return true;\n }\n }\n return false;\n };\n this.insideEnd = function(row, column) {\n if (this.compare(row, column) == 0) {\n if (this.isStart(row, column)) {\n return false;\n } else {\n return true;\n }\n }\n return false;\n };\n this.compare = function(row, column) {\n if (!this.isMultiLine()) {\n if (row === this.start.row) {\n return column < this.start.column ? -1 : (column > this.end.column ? 1 : 0);\n }\n }\n\n if (row < this.start.row)\n return -1;\n\n if (row > this.end.row)\n return 1;\n\n if (this.start.row === row)\n return column >= this.start.column ? 0 : -1;\n\n if (this.end.row === row)\n return column <= this.end.column ? 0 : 1;\n\n return 0;\n };\n this.compareStart = function(row, column) {\n if (this.start.row == row && this.start.column == column) {\n return -1;\n } else {\n return this.compare(row, column);\n }\n };\n this.compareEnd = function(row, column) {\n if (this.end.row == row && this.end.column == column) {\n return 1;\n } else {\n return this.compare(row, column);\n }\n };\n this.compareInside = function(row, column) {\n if (this.end.row == row && this.end.column == column) {\n return 1;\n } else if (this.start.row == row && this.start.column == column) {\n return -1;\n } else {\n return this.compare(row, column);\n }\n };\n this.clipRows = function(firstRow, lastRow) {\n if (this.end.row > lastRow)\n var end = {row: lastRow + 1, column: 0};\n else if (this.end.row < firstRow)\n var end = {row: firstRow, column: 0};\n\n if (this.start.row > lastRow)\n var start = {row: lastRow + 1, column: 0};\n else if (this.start.row < firstRow)\n var start = {row: firstRow, column: 0};\n\n return Range.fromPoints(start || this.start, end || this.end);\n };\n this.extend = function(row, column) {\n var cmp = this.compare(row, column);\n\n if (cmp == 0)\n return this;\n else if (cmp == -1)\n var start = {row: row, column: column};\n else\n var end = {row: row, column: column};\n\n return Range.fromPoints(start || this.start, end || this.end);\n };\n\n this.isEmpty = function() {\n return (this.start.row === this.end.row && this.start.column === this.end.column);\n };\n this.isMultiLine = function() {\n return (this.start.row !== this.end.row);\n };\n this.clone = function() {\n return Range.fromPoints(this.start, this.end);\n };\n this.collapseRows = function() {\n if (this.end.column == 0)\n return new Range(this.start.row, 0, Math.max(this.start.row, this.end.row-1), 0);\n else\n return new Range(this.start.row, 0, this.end.row, 0);\n };\n this.toScreenRange = function(session) {\n var screenPosStart = session.documentToScreenPosition(this.start);\n var screenPosEnd = session.documentToScreenPosition(this.end);\n\n return new Range(\n screenPosStart.row, screenPosStart.column,\n screenPosEnd.row, screenPosEnd.column\n );\n };\n this.moveBy = function(row, column) {\n this.start.row += row;\n this.start.column += column;\n this.end.row += row;\n this.end.column += column;\n };\n\n}).call(Range.prototype);\nRange.fromPoints = function(start, end) {\n return new Range(start.row, start.column, end.row, end.column);\n};\nRange.comparePoints = comparePoints;\n\nRange.comparePoints = function(p1, p2) {\n return p1.row - p2.row || p1.column - p2.column;\n};\n\n\nexports.Range = Range;\n});\n\nace.define(\"ace/selection\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/lang\",\"ace/lib/event_emitter\",\"ace/range\"], function(acequire, exports, module) {\n\"use strict\";\n\nvar oop = acequire(\"./lib/oop\");\nvar lang = acequire(\"./lib/lang\");\nvar EventEmitter = acequire(\"./lib/event_emitter\").EventEmitter;\nvar Range = acequire(\"./range\").Range;\nvar Selection = function(session) {\n this.session = session;\n this.doc = session.getDocument();\n\n this.clearSelection();\n this.lead = this.selectionLead = this.doc.createAnchor(0, 0);\n this.anchor = this.selectionAnchor = this.doc.createAnchor(0, 0);\n\n var self = this;\n this.lead.on(\"change\", function(e) {\n self._emit(\"changeCursor\");\n if (!self.$isEmpty)\n self._emit(\"changeSelection\");\n if (!self.$keepDesiredColumnOnChange && e.old.column != e.value.column)\n self.$desiredColumn = null;\n });\n\n this.selectionAnchor.on(\"change\", function() {\n if (!self.$isEmpty)\n self._emit(\"changeSelection\");\n });\n};\n\n(function() {\n\n oop.implement(this, EventEmitter);\n this.isEmpty = function() {\n return (this.$isEmpty || (\n this.anchor.row == this.lead.row &&\n this.anchor.column == this.lead.column\n ));\n };\n this.isMultiLine = function() {\n if (this.isEmpty()) {\n return false;\n }\n\n return this.getRange().isMultiLine();\n };\n this.getCursor = function() {\n return this.lead.getPosition();\n };\n this.setSelectionAnchor = function(row, column) {\n this.anchor.setPosition(row, column);\n\n if (this.$isEmpty) {\n this.$isEmpty = false;\n this._emit(\"changeSelection\");\n }\n };\n this.getSelectionAnchor = function() {\n if (this.$isEmpty)\n return this.getSelectionLead();\n else\n return this.anchor.getPosition();\n };\n this.getSelectionLead = function() {\n return this.lead.getPosition();\n };\n this.shiftSelection = function(columns) {\n if (this.$isEmpty) {\n this.moveCursorTo(this.lead.row, this.lead.column + columns);\n return;\n }\n\n var anchor = this.getSelectionAnchor();\n var lead = this.getSelectionLead();\n\n var isBackwards = this.isBackwards();\n\n if (!isBackwards || anchor.column !== 0)\n this.setSelectionAnchor(anchor.row, anchor.column + columns);\n\n if (isBackwards || lead.column !== 0) {\n this.$moveSelection(function() {\n this.moveCursorTo(lead.row, lead.column + columns);\n });\n }\n };\n this.isBackwards = function() {\n var anchor = this.anchor;\n var lead = this.lead;\n return (anchor.row > lead.row || (anchor.row == lead.row && anchor.column > lead.column));\n };\n this.getRange = function() {\n var anchor = this.anchor;\n var lead = this.lead;\n\n if (this.isEmpty())\n return Range.fromPoints(lead, lead);\n\n if (this.isBackwards()) {\n return Range.fromPoints(lead, anchor);\n }\n else {\n return Range.fromPoints(anchor, lead);\n }\n };\n this.clearSelection = function() {\n if (!this.$isEmpty) {\n this.$isEmpty = true;\n this._emit(\"changeSelection\");\n }\n };\n this.selectAll = function() {\n var lastRow = this.doc.getLength() - 1;\n this.setSelectionAnchor(0, 0);\n this.moveCursorTo(lastRow, this.doc.getLine(lastRow).length);\n };\n this.setRange =\n this.setSelectionRange = function(range, reverse) {\n if (reverse) {\n this.setSelectionAnchor(range.end.row, range.end.column);\n this.selectTo(range.start.row, range.start.column);\n } else {\n this.setSelectionAnchor(range.start.row, range.start.column);\n this.selectTo(range.end.row, range.end.column);\n }\n if (this.getRange().isEmpty())\n this.$isEmpty = true;\n this.$desiredColumn = null;\n };\n\n this.$moveSelection = function(mover) {\n var lead = this.lead;\n if (this.$isEmpty)\n this.setSelectionAnchor(lead.row, lead.column);\n\n mover.call(this);\n };\n this.selectTo = function(row, column) {\n this.$moveSelection(function() {\n this.moveCursorTo(row, column);\n });\n };\n this.selectToPosition = function(pos) {\n this.$moveSelection(function() {\n this.moveCursorToPosition(pos);\n });\n };\n this.moveTo = function(row, column) {\n this.clearSelection();\n this.moveCursorTo(row, column);\n };\n this.moveToPosition = function(pos) {\n this.clearSelection();\n this.moveCursorToPosition(pos);\n };\n this.selectUp = function() {\n this.$moveSelection(this.moveCursorUp);\n };\n this.selectDown = function() {\n this.$moveSelection(this.moveCursorDown);\n };\n this.selectRight = function() {\n this.$moveSelection(this.moveCursorRight);\n };\n this.selectLeft = function() {\n this.$moveSelection(this.moveCursorLeft);\n };\n this.selectLineStart = function() {\n this.$moveSelection(this.moveCursorLineStart);\n };\n this.selectLineEnd = function() {\n this.$moveSelection(this.moveCursorLineEnd);\n };\n this.selectFileEnd = function() {\n this.$moveSelection(this.moveCursorFileEnd);\n };\n this.selectFileStart = function() {\n this.$moveSelection(this.moveCursorFileStart);\n };\n this.selectWordRight = function() {\n this.$moveSelection(this.moveCursorWordRight);\n };\n this.selectWordLeft = function() {\n this.$moveSelection(this.moveCursorWordLeft);\n };\n this.getWordRange = function(row, column) {\n if (typeof column == \"undefined\") {\n var cursor = row || this.lead;\n row = cursor.row;\n column = cursor.column;\n }\n return this.session.getWordRange(row, column);\n };\n this.selectWord = function() {\n this.setSelectionRange(this.getWordRange());\n };\n this.selectAWord = function() {\n var cursor = this.getCursor();\n var range = this.session.getAWordRange(cursor.row, cursor.column);\n this.setSelectionRange(range);\n };\n\n this.getLineRange = function(row, excludeLastChar) {\n var rowStart = typeof row == \"number\" ? row : this.lead.row;\n var rowEnd;\n\n var foldLine = this.session.getFoldLine(rowStart);\n if (foldLine) {\n rowStart = foldLine.start.row;\n rowEnd = foldLine.end.row;\n } else {\n rowEnd = rowStart;\n }\n if (excludeLastChar === true)\n return new Range(rowStart, 0, rowEnd, this.session.getLine(rowEnd).length);\n else\n return new Range(rowStart, 0, rowEnd + 1, 0);\n };\n this.selectLine = function() {\n this.setSelectionRange(this.getLineRange());\n };\n this.moveCursorUp = function() {\n this.moveCursorBy(-1, 0);\n };\n this.moveCursorDown = function() {\n this.moveCursorBy(1, 0);\n };\n this.wouldMoveIntoSoftTab = function(cursor, tabSize, direction) {\n var start = cursor.column;\n var end = cursor.column + tabSize;\n\n if (direction < 0) {\n start = cursor.column - tabSize;\n end = cursor.column;\n }\n return this.session.isTabStop(cursor) && this.doc.getLine(cursor.row).slice(start, end).split(\" \").length-1 == tabSize;\n };\n this.moveCursorLeft = function() {\n var cursor = this.lead.getPosition(),\n fold;\n\n if (fold = this.session.getFoldAt(cursor.row, cursor.column, -1)) {\n this.moveCursorTo(fold.start.row, fold.start.column);\n } else if (cursor.column === 0) {\n if (cursor.row > 0) {\n this.moveCursorTo(cursor.row - 1, this.doc.getLine(cursor.row - 1).length);\n }\n }\n else {\n var tabSize = this.session.getTabSize();\n if (this.wouldMoveIntoSoftTab(cursor, tabSize, -1) && !this.session.getNavigateWithinSoftTabs()) {\n this.moveCursorBy(0, -tabSize);\n } else {\n this.moveCursorBy(0, -1);\n }\n }\n };\n this.moveCursorRight = function() {\n var cursor = this.lead.getPosition(),\n fold;\n if (fold = this.session.getFoldAt(cursor.row, cursor.column, 1)) {\n this.moveCursorTo(fold.end.row, fold.end.column);\n }\n else if (this.lead.column == this.doc.getLine(this.lead.row).length) {\n if (this.lead.row < this.doc.getLength() - 1) {\n this.moveCursorTo(this.lead.row + 1, 0);\n }\n }\n else {\n var tabSize = this.session.getTabSize();\n var cursor = this.lead;\n if (this.wouldMoveIntoSoftTab(cursor, tabSize, 1) && !this.session.getNavigateWithinSoftTabs()) {\n this.moveCursorBy(0, tabSize);\n } else {\n this.moveCursorBy(0, 1);\n }\n }\n };\n this.moveCursorLineStart = function() {\n var row = this.lead.row;\n var column = this.lead.column;\n var screenRow = this.session.documentToScreenRow(row, column);\n var firstColumnPosition = this.session.screenToDocumentPosition(screenRow, 0);\n var beforeCursor = this.session.getDisplayLine(\n row, null, firstColumnPosition.row,\n firstColumnPosition.column\n );\n\n var leadingSpace = beforeCursor.match(/^\\s*/);\n if (leadingSpace[0].length != column && !this.session.$useEmacsStyleLineStart)\n firstColumnPosition.column += leadingSpace[0].length;\n this.moveCursorToPosition(firstColumnPosition);\n };\n this.moveCursorLineEnd = function() {\n var lead = this.lead;\n var lineEnd = this.session.getDocumentLastRowColumnPosition(lead.row, lead.column);\n if (this.lead.column == lineEnd.column) {\n var line = this.session.getLine(lineEnd.row);\n if (lineEnd.column == line.length) {\n var textEnd = line.search(/\\s+$/);\n if (textEnd > 0)\n lineEnd.column = textEnd;\n }\n }\n\n this.moveCursorTo(lineEnd.row, lineEnd.column);\n };\n this.moveCursorFileEnd = function() {\n var row = this.doc.getLength() - 1;\n var column = this.doc.getLine(row).length;\n this.moveCursorTo(row, column);\n };\n this.moveCursorFileStart = function() {\n this.moveCursorTo(0, 0);\n };\n this.moveCursorLongWordRight = function() {\n var row = this.lead.row;\n var column = this.lead.column;\n var line = this.doc.getLine(row);\n var rightOfCursor = line.substring(column);\n\n var match;\n this.session.nonTokenRe.lastIndex = 0;\n this.session.tokenRe.lastIndex = 0;\n var fold = this.session.getFoldAt(row, column, 1);\n if (fold) {\n this.moveCursorTo(fold.end.row, fold.end.column);\n return;\n }\n if (match = this.session.nonTokenRe.exec(rightOfCursor)) {\n column += this.session.nonTokenRe.lastIndex;\n this.session.nonTokenRe.lastIndex = 0;\n rightOfCursor = line.substring(column);\n }\n if (column >= line.length) {\n this.moveCursorTo(row, line.length);\n this.moveCursorRight();\n if (row < this.doc.getLength() - 1)\n this.moveCursorWordRight();\n return;\n }\n if (match = this.session.tokenRe.exec(rightOfCursor)) {\n column += this.session.tokenRe.lastIndex;\n this.session.tokenRe.lastIndex = 0;\n }\n\n this.moveCursorTo(row, column);\n };\n this.moveCursorLongWordLeft = function() {\n var row = this.lead.row;\n var column = this.lead.column;\n var fold;\n if (fold = this.session.getFoldAt(row, column, -1)) {\n this.moveCursorTo(fold.start.row, fold.start.column);\n return;\n }\n\n var str = this.session.getFoldStringAt(row, column, -1);\n if (str == null) {\n str = this.doc.getLine(row).substring(0, column);\n }\n\n var leftOfCursor = lang.stringReverse(str);\n var match;\n this.session.nonTokenRe.lastIndex = 0;\n this.session.tokenRe.lastIndex = 0;\n if (match = this.session.nonTokenRe.exec(leftOfCursor)) {\n column -= this.session.nonTokenRe.lastIndex;\n leftOfCursor = leftOfCursor.slice(this.session.nonTokenRe.lastIndex);\n this.session.nonTokenRe.lastIndex = 0;\n }\n if (column <= 0) {\n this.moveCursorTo(row, 0);\n this.moveCursorLeft();\n if (row > 0)\n this.moveCursorWordLeft();\n return;\n }\n if (match = this.session.tokenRe.exec(leftOfCursor)) {\n column -= this.session.tokenRe.lastIndex;\n this.session.tokenRe.lastIndex = 0;\n }\n\n this.moveCursorTo(row, column);\n };\n\n this.$shortWordEndIndex = function(rightOfCursor) {\n var match, index = 0, ch;\n var whitespaceRe = /\\s/;\n var tokenRe = this.session.tokenRe;\n\n tokenRe.lastIndex = 0;\n if (match = this.session.tokenRe.exec(rightOfCursor)) {\n index = this.session.tokenRe.lastIndex;\n } else {\n while ((ch = rightOfCursor[index]) && whitespaceRe.test(ch))\n index ++;\n\n if (index < 1) {\n tokenRe.lastIndex = 0;\n while ((ch = rightOfCursor[index]) && !tokenRe.test(ch)) {\n tokenRe.lastIndex = 0;\n index ++;\n if (whitespaceRe.test(ch)) {\n if (index > 2) {\n index--;\n break;\n } else {\n while ((ch = rightOfCursor[index]) && whitespaceRe.test(ch))\n index ++;\n if (index > 2)\n break;\n }\n }\n }\n }\n }\n tokenRe.lastIndex = 0;\n\n return index;\n };\n\n this.moveCursorShortWordRight = function() {\n var row = this.lead.row;\n var column = this.lead.column;\n var line = this.doc.getLine(row);\n var rightOfCursor = line.substring(column);\n\n var fold = this.session.getFoldAt(row, column, 1);\n if (fold)\n return this.moveCursorTo(fold.end.row, fold.end.column);\n\n if (column == line.length) {\n var l = this.doc.getLength();\n do {\n row++;\n rightOfCursor = this.doc.getLine(row);\n } while (row < l && /^\\s*$/.test(rightOfCursor));\n\n if (!/^\\s+/.test(rightOfCursor))\n rightOfCursor = \"\";\n column = 0;\n }\n\n var index = this.$shortWordEndIndex(rightOfCursor);\n\n this.moveCursorTo(row, column + index);\n };\n\n this.moveCursorShortWordLeft = function() {\n var row = this.lead.row;\n var column = this.lead.column;\n\n var fold;\n if (fold = this.session.getFoldAt(row, column, -1))\n return this.moveCursorTo(fold.start.row, fold.start.column);\n\n var line = this.session.getLine(row).substring(0, column);\n if (column === 0) {\n do {\n row--;\n line = this.doc.getLine(row);\n } while (row > 0 && /^\\s*$/.test(line));\n\n column = line.length;\n if (!/\\s+$/.test(line))\n line = \"\";\n }\n\n var leftOfCursor = lang.stringReverse(line);\n var index = this.$shortWordEndIndex(leftOfCursor);\n\n return this.moveCursorTo(row, column - index);\n };\n\n this.moveCursorWordRight = function() {\n if (this.session.$selectLongWords)\n this.moveCursorLongWordRight();\n else\n this.moveCursorShortWordRight();\n };\n\n this.moveCursorWordLeft = function() {\n if (this.session.$selectLongWords)\n this.moveCursorLongWordLeft();\n else\n this.moveCursorShortWordLeft();\n };\n this.moveCursorBy = function(rows, chars) {\n var screenPos = this.session.documentToScreenPosition(\n this.lead.row,\n this.lead.column\n );\n\n var offsetX;\n\n if (chars === 0) {\n if (rows !== 0) {\n if (this.session.$bidiHandler.isBidiRow(screenPos.row, this.lead.row)) {\n offsetX = this.session.$bidiHandler.getPosLeft(screenPos.column);\n screenPos.column = Math.round(offsetX / this.session.$bidiHandler.charWidths[0]);\n } else {\n offsetX = screenPos.column * this.session.$bidiHandler.charWidths[0];\n }\n }\n\n if (this.$desiredColumn)\n screenPos.column = this.$desiredColumn;\n else\n this.$desiredColumn = screenPos.column;\n }\n\n var docPos = this.session.screenToDocumentPosition(screenPos.row + rows, screenPos.column, offsetX);\n \n if (rows !== 0 && chars === 0 && docPos.row === this.lead.row && docPos.column === this.lead.column) {\n if (this.session.lineWidgets && this.session.lineWidgets[docPos.row]) {\n if (docPos.row > 0 || rows > 0)\n docPos.row++;\n }\n }\n this.moveCursorTo(docPos.row, docPos.column + chars, chars === 0);\n };\n this.moveCursorToPosition = function(position) {\n this.moveCursorTo(position.row, position.column);\n };\n this.moveCursorTo = function(row, column, keepDesiredColumn) {\n var fold = this.session.getFoldAt(row, column, 1);\n if (fold) {\n row = fold.start.row;\n column = fold.start.column;\n }\n\n this.$keepDesiredColumnOnChange = true;\n var line = this.session.getLine(row);\n if (/[\\uDC00-\\uDFFF]/.test(line.charAt(column)) && line.charAt(column - 1)) {\n if (this.lead.row == row && this.lead.column == column + 1)\n column = column - 1;\n else\n column = column + 1;\n }\n this.lead.setPosition(row, column);\n this.$keepDesiredColumnOnChange = false;\n\n if (!keepDesiredColumn)\n this.$desiredColumn = null;\n };\n this.moveCursorToScreen = function(row, column, keepDesiredColumn) {\n var pos = this.session.screenToDocumentPosition(row, column);\n this.moveCursorTo(pos.row, pos.column, keepDesiredColumn);\n };\n this.detach = function() {\n this.lead.detach();\n this.anchor.detach();\n this.session = this.doc = null;\n };\n\n this.fromOrientedRange = function(range) {\n this.setSelectionRange(range, range.cursor == range.start);\n this.$desiredColumn = range.desiredColumn || this.$desiredColumn;\n };\n\n this.toOrientedRange = function(range) {\n var r = this.getRange();\n if (range) {\n range.start.column = r.start.column;\n range.start.row = r.start.row;\n range.end.column = r.end.column;\n range.end.row = r.end.row;\n } else {\n range = r;\n }\n\n range.cursor = this.isBackwards() ? range.start : range.end;\n range.desiredColumn = this.$desiredColumn;\n return range;\n };\n this.getRangeOfMovements = function(func) {\n var start = this.getCursor();\n try {\n func(this);\n var end = this.getCursor();\n return Range.fromPoints(start,end);\n } catch(e) {\n return Range.fromPoints(start,start);\n } finally {\n this.moveCursorToPosition(start);\n }\n };\n\n this.toJSON = function() {\n if (this.rangeCount) {\n var data = this.ranges.map(function(r) {\n var r1 = r.clone();\n r1.isBackwards = r.cursor == r.start;\n return r1;\n });\n } else {\n var data = this.getRange();\n data.isBackwards = this.isBackwards();\n }\n return data;\n };\n\n this.fromJSON = function(data) {\n if (data.start == undefined) {\n if (this.rangeList) {\n this.toSingleRange(data[0]);\n for (var i = data.length; i--; ) {\n var r = Range.fromPoints(data[i].start, data[i].end);\n if (data[i].isBackwards)\n r.cursor = r.start;\n this.addRange(r, true);\n }\n return;\n } else\n data = data[0];\n }\n if (this.rangeList)\n this.toSingleRange(data);\n this.setSelectionRange(data, data.isBackwards);\n };\n\n this.isEqual = function(data) {\n if ((data.length || this.rangeCount) && data.length != this.rangeCount)\n return false;\n if (!data.length || !this.ranges)\n return this.getRange().isEqual(data);\n\n for (var i = this.ranges.length; i--; ) {\n if (!this.ranges[i].isEqual(data[i]))\n return false;\n }\n return true;\n };\n\n}).call(Selection.prototype);\n\nexports.Selection = Selection;\n});\n\nace.define(\"ace/tokenizer\",[\"require\",\"exports\",\"module\",\"ace/config\"], function(acequire, exports, module) {\n\"use strict\";\n\nvar config = acequire(\"./config\");\nvar MAX_TOKEN_COUNT = 2000;\nvar Tokenizer = function(rules) {\n this.states = rules;\n\n this.regExps = {};\n this.matchMappings = {};\n for (var key in this.states) {\n var state = this.states[key];\n var ruleRegExps = [];\n var matchTotal = 0;\n var mapping = this.matchMappings[key] = {defaultToken: \"text\"};\n var flag = \"g\";\n\n var splitterRurles = [];\n for (var i = 0; i < state.length; i++) {\n var rule = state[i];\n if (rule.defaultToken)\n mapping.defaultToken = rule.defaultToken;\n if (rule.caseInsensitive)\n flag = \"gi\";\n if (rule.regex == null)\n continue;\n\n if (rule.regex instanceof RegExp)\n rule.regex = rule.regex.toString().slice(1, -1);\n var adjustedregex = rule.regex;\n var matchcount = new RegExp(\"(?:(\" + adjustedregex + \")|(.))\").exec(\"a\").length - 2;\n if (Array.isArray(rule.token)) {\n if (rule.token.length == 1 || matchcount == 1) {\n rule.token = rule.token[0];\n } else if (matchcount - 1 != rule.token.length) {\n this.reportError(\"number of classes and regexp groups doesn't match\", { \n rule: rule,\n groupCount: matchcount - 1\n });\n rule.token = rule.token[0];\n } else {\n rule.tokenArray = rule.token;\n rule.token = null;\n rule.onMatch = this.$arrayTokens;\n }\n } else if (typeof rule.token == \"function\" && !rule.onMatch) {\n if (matchcount > 1)\n rule.onMatch = this.$applyToken;\n else\n rule.onMatch = rule.token;\n }\n\n if (matchcount > 1) {\n if (/\\\\\\d/.test(rule.regex)) {\n adjustedregex = rule.regex.replace(/\\\\([0-9]+)/g, function(match, digit) {\n return \"\\\\\" + (parseInt(digit, 10) + matchTotal + 1);\n });\n } else {\n matchcount = 1;\n adjustedregex = this.removeCapturingGroups(rule.regex);\n }\n if (!rule.splitRegex && typeof rule.token != \"string\")\n splitterRurles.push(rule); // flag will be known only at the very end\n }\n\n mapping[matchTotal] = i;\n matchTotal += matchcount;\n\n ruleRegExps.push(adjustedregex);\n if (!rule.onMatch)\n rule.onMatch = null;\n }\n \n if (!ruleRegExps.length) {\n mapping[0] = 0;\n ruleRegExps.push(\"$\");\n }\n \n splitterRurles.forEach(function(rule) {\n rule.splitRegex = this.createSplitterRegexp(rule.regex, flag);\n }, this);\n\n this.regExps[key] = new RegExp(\"(\" + ruleRegExps.join(\")|(\") + \")|($)\", flag);\n }\n};\n\n(function() {\n this.$setMaxTokenCount = function(m) {\n MAX_TOKEN_COUNT = m | 0;\n };\n \n this.$applyToken = function(str) {\n var values = this.splitRegex.exec(str).slice(1);\n var types = this.token.apply(this, values);\n if (typeof types === \"string\")\n return [{type: types, value: str}];\n\n var tokens = [];\n for (var i = 0, l = types.length; i < l; i++) {\n if (values[i])\n tokens[tokens.length] = {\n type: types[i],\n value: values[i]\n };\n }\n return tokens;\n };\n\n this.$arrayTokens = function(str) {\n if (!str)\n return [];\n var values = this.splitRegex.exec(str);\n if (!values)\n return \"text\";\n var tokens = [];\n var types = this.tokenArray;\n for (var i = 0, l = types.length; i < l; i++) {\n if (values[i + 1])\n tokens[tokens.length] = {\n type: types[i],\n value: values[i + 1]\n };\n }\n return tokens;\n };\n\n this.removeCapturingGroups = function(src) {\n var r = src.replace(\n /\\[(?:\\\\.|[^\\]])*?\\]|\\\\.|\\(\\?[:=!]|(\\()/g,\n function(x, y) {return y ? \"(?:\" : x;}\n );\n return r;\n };\n\n this.createSplitterRegexp = function(src, flag) {\n if (src.indexOf(\"(?=\") != -1) {\n var stack = 0;\n var inChClass = false;\n var lastCapture = {};\n src.replace(/(\\\\.)|(\\((?:\\?[=!])?)|(\\))|([\\[\\]])/g, function(\n m, esc, parenOpen, parenClose, square, index\n ) {\n if (inChClass) {\n inChClass = square != \"]\";\n } else if (square) {\n inChClass = true;\n } else if (parenClose) {\n if (stack == lastCapture.stack) {\n lastCapture.end = index+1;\n lastCapture.stack = -1;\n }\n stack--;\n } else if (parenOpen) {\n stack++;\n if (parenOpen.length != 1) {\n lastCapture.stack = stack;\n lastCapture.start = index;\n }\n }\n return m;\n });\n\n if (lastCapture.end != null && /^\\)*$/.test(src.substr(lastCapture.end)))\n src = src.substring(0, lastCapture.start) + src.substr(lastCapture.end);\n }\n if (src.charAt(0) != \"^\") src = \"^\" + src;\n if (src.charAt(src.length - 1) != \"$\") src += \"$\";\n \n return new RegExp(src, (flag||\"\").replace(\"g\", \"\"));\n };\n this.getLineTokens = function(line, startState) {\n if (startState && typeof startState != \"string\") {\n var stack = startState.slice(0);\n startState = stack[0];\n if (startState === \"#tmp\") {\n stack.shift();\n startState = stack.shift();\n }\n } else\n var stack = [];\n\n var currentState = startState || \"start\";\n var state = this.states[currentState];\n if (!state) {\n currentState = \"start\";\n state = this.states[currentState];\n }\n var mapping = this.matchMappings[currentState];\n var re = this.regExps[currentState];\n re.lastIndex = 0;\n\n var match, tokens = [];\n var lastIndex = 0;\n var matchAttempts = 0;\n\n var token = {type: null, value: \"\"};\n\n while (match = re.exec(line)) {\n var type = mapping.defaultToken;\n var rule = null;\n var value = match[0];\n var index = re.lastIndex;\n\n if (index - value.length > lastIndex) {\n var skipped = line.substring(lastIndex, index - value.length);\n if (token.type == type) {\n token.value += skipped;\n } else {\n if (token.type)\n tokens.push(token);\n token = {type: type, value: skipped};\n }\n }\n\n for (var i = 0; i < match.length-2; i++) {\n if (match[i + 1] === undefined)\n continue;\n\n rule = state[mapping[i]];\n\n if (rule.onMatch)\n type = rule.onMatch(value, currentState, stack, line);\n else\n type = rule.token;\n\n if (rule.next) {\n if (typeof rule.next == \"string\") {\n currentState = rule.next;\n } else {\n currentState = rule.next(currentState, stack);\n }\n \n state = this.states[currentState];\n if (!state) {\n this.reportError(\"state doesn't exist\", currentState);\n currentState = \"start\";\n state = this.states[currentState];\n }\n mapping = this.matchMappings[currentState];\n lastIndex = index;\n re = this.regExps[currentState];\n re.lastIndex = index;\n }\n if (rule.consumeLineEnd)\n lastIndex = index;\n break;\n }\n\n if (value) {\n if (typeof type === \"string\") {\n if ((!rule || rule.merge !== false) && token.type === type) {\n token.value += value;\n } else {\n if (token.type)\n tokens.push(token);\n token = {type: type, value: value};\n }\n } else if (type) {\n if (token.type)\n tokens.push(token);\n token = {type: null, value: \"\"};\n for (var i = 0; i < type.length; i++)\n tokens.push(type[i]);\n }\n }\n\n if (lastIndex == line.length)\n break;\n\n lastIndex = index;\n\n if (matchAttempts++ > MAX_TOKEN_COUNT) {\n if (matchAttempts > 2 * line.length) {\n this.reportError(\"infinite loop with in ace tokenizer\", {\n startState: startState,\n line: line\n });\n }\n while (lastIndex < line.length) {\n if (token.type)\n tokens.push(token);\n token = {\n value: line.substring(lastIndex, lastIndex += 2000),\n type: \"overflow\"\n };\n }\n currentState = \"start\";\n stack = [];\n break;\n }\n }\n\n if (token.type)\n tokens.push(token);\n \n if (stack.length > 1) {\n if (stack[0] !== currentState)\n stack.unshift(\"#tmp\", currentState);\n }\n return {\n tokens : tokens,\n state : stack.length ? stack : currentState\n };\n };\n \n this.reportError = config.reportError;\n \n}).call(Tokenizer.prototype);\n\nexports.Tokenizer = Tokenizer;\n});\n\nace.define(\"ace/mode/text_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/lang\"], function(acequire, exports, module) {\n\"use strict\";\n\nvar lang = acequire(\"../lib/lang\");\n\nvar TextHighlightRules = function() {\n\n this.$rules = {\n \"start\" : [{\n token : \"empty_line\",\n regex : '^$'\n }, {\n defaultToken : \"text\"\n }]\n };\n};\n\n(function() {\n\n this.addRules = function(rules, prefix) {\n if (!prefix) {\n for (var key in rules)\n this.$rules[key] = rules[key];\n return;\n }\n for (var key in rules) {\n var state = rules[key];\n for (var i = 0; i < state.length; i++) {\n var rule = state[i];\n if (rule.next || rule.onMatch) {\n if (typeof rule.next == \"string\") {\n if (rule.next.indexOf(prefix) !== 0)\n rule.next = prefix + rule.next;\n }\n if (rule.nextState && rule.nextState.indexOf(prefix) !== 0)\n rule.nextState = prefix + rule.nextState;\n }\n }\n this.$rules[prefix + key] = state;\n }\n };\n\n this.getRules = function() {\n return this.$rules;\n };\n\n this.embedRules = function (HighlightRules, prefix, escapeRules, states, append) {\n var embedRules = typeof HighlightRules == \"function\"\n ? new HighlightRules().getRules()\n : HighlightRules;\n if (states) {\n for (var i = 0; i < states.length; i++)\n states[i] = prefix + states[i];\n } else {\n states = [];\n for (var key in embedRules)\n states.push(prefix + key);\n }\n\n this.addRules(embedRules, prefix);\n\n if (escapeRules) {\n var addRules = Array.prototype[append ? \"push\" : \"unshift\"];\n for (var i = 0; i < states.length; i++)\n addRules.apply(this.$rules[states[i]], lang.deepCopy(escapeRules));\n }\n\n if (!this.$embeds)\n this.$embeds = [];\n this.$embeds.push(prefix);\n };\n\n this.getEmbeds = function() {\n return this.$embeds;\n };\n\n var pushState = function(currentState, stack) {\n if (currentState != \"start\" || stack.length)\n stack.unshift(this.nextState, currentState);\n return this.nextState;\n };\n var popState = function(currentState, stack) {\n stack.shift();\n return stack.shift() || \"start\";\n };\n\n this.normalizeRules = function() {\n var id = 0;\n var rules = this.$rules;\n function processState(key) {\n var state = rules[key];\n state.processed = true;\n for (var i = 0; i < state.length; i++) {\n var rule = state[i];\n var toInsert = null;\n if (Array.isArray(rule)) {\n toInsert = rule;\n rule = {};\n }\n if (!rule.regex && rule.start) {\n rule.regex = rule.start;\n if (!rule.next)\n rule.next = [];\n rule.next.push({\n defaultToken: rule.token\n }, {\n token: rule.token + \".end\",\n regex: rule.end || rule.start,\n next: \"pop\"\n });\n rule.token = rule.token + \".start\";\n rule.push = true;\n }\n var next = rule.next || rule.push;\n if (next && Array.isArray(next)) {\n var stateName = rule.stateName;\n if (!stateName) {\n stateName = rule.token;\n if (typeof stateName != \"string\")\n stateName = stateName[0] || \"\";\n if (rules[stateName])\n stateName += id++;\n }\n rules[stateName] = next;\n rule.next = stateName;\n processState(stateName);\n } else if (next == \"pop\") {\n rule.next = popState;\n }\n\n if (rule.push) {\n rule.nextState = rule.next || rule.push;\n rule.next = pushState;\n delete rule.push;\n }\n\n if (rule.rules) {\n for (var r in rule.rules) {\n if (rules[r]) {\n if (rules[r].push)\n rules[r].push.apply(rules[r], rule.rules[r]);\n } else {\n rules[r] = rule.rules[r];\n }\n }\n }\n var includeName = typeof rule == \"string\" ? rule : rule.include;\n if (includeName) {\n if (Array.isArray(includeName))\n toInsert = includeName.map(function(x) { return rules[x]; });\n else\n toInsert = rules[includeName];\n }\n\n if (toInsert) {\n var args = [i, 1].concat(toInsert);\n if (rule.noEscape)\n args = args.filter(function(x) {return !x.next;});\n state.splice.apply(state, args);\n i--;\n }\n \n if (rule.keywordMap) {\n rule.token = this.createKeywordMapper(\n rule.keywordMap, rule.defaultToken || \"text\", rule.caseInsensitive\n );\n delete rule.defaultToken;\n }\n }\n }\n Object.keys(rules).forEach(processState, this);\n };\n\n this.createKeywordMapper = function(map, defaultToken, ignoreCase, splitChar) {\n var keywords = Object.create(null);\n Object.keys(map).forEach(function(className) {\n var a = map[className];\n if (ignoreCase)\n a = a.toLowerCase();\n var list = a.split(splitChar || \"|\");\n for (var i = list.length; i--; )\n keywords[list[i]] = className;\n });\n if (Object.getPrototypeOf(keywords)) {\n keywords.__proto__ = null;\n }\n this.$keywordList = Object.keys(keywords);\n map = null;\n return ignoreCase\n ? function(value) {return keywords[value.toLowerCase()] || defaultToken; }\n : function(value) {return keywords[value] || defaultToken; };\n };\n\n this.getKeywords = function() {\n return this.$keywords;\n };\n\n}).call(TextHighlightRules.prototype);\n\nexports.TextHighlightRules = TextHighlightRules;\n});\n\nace.define(\"ace/mode/behaviour\",[\"require\",\"exports\",\"module\"], function(acequire, exports, module) {\n\"use strict\";\n\nvar Behaviour = function() {\n this.$behaviours = {};\n};\n\n(function () {\n\n this.add = function (name, action, callback) {\n switch (undefined) {\n case this.$behaviours:\n this.$behaviours = {};\n case this.$behaviours[name]:\n this.$behaviours[name] = {};\n }\n this.$behaviours[name][action] = callback;\n };\n \n this.addBehaviours = function (behaviours) {\n for (var key in behaviours) {\n for (var action in behaviours[key]) {\n this.add(key, action, behaviours[key][action]);\n }\n }\n };\n \n this.remove = function (name) {\n if (this.$behaviours && this.$behaviours[name]) {\n delete this.$behaviours[name];\n }\n };\n \n this.inherit = function (mode, filter) {\n if (typeof mode === \"function\") {\n var behaviours = new mode().getBehaviours(filter);\n } else {\n var behaviours = mode.getBehaviours(filter);\n }\n this.addBehaviours(behaviours);\n };\n \n this.getBehaviours = function (filter) {\n if (!filter) {\n return this.$behaviours;\n } else {\n var ret = {};\n for (var i = 0; i < filter.length; i++) {\n if (this.$behaviours[filter[i]]) {\n ret[filter[i]] = this.$behaviours[filter[i]];\n }\n }\n return ret;\n }\n };\n\n}).call(Behaviour.prototype);\n\nexports.Behaviour = Behaviour;\n});\n\nace.define(\"ace/token_iterator\",[\"require\",\"exports\",\"module\",\"ace/range\"], function(acequire, exports, module) {\n\"use strict\";\n\nvar Range = acequire(\"./range\").Range;\nvar TokenIterator = function(session, initialRow, initialColumn) {\n this.$session = session;\n this.$row = initialRow;\n this.$rowTokens = session.getTokens(initialRow);\n\n var token = session.getTokenAt(initialRow, initialColumn);\n this.$tokenIndex = token ? token.index : -1;\n};\n\n(function() { \n this.stepBackward = function() {\n this.$tokenIndex -= 1;\n \n while (this.$tokenIndex < 0) {\n this.$row -= 1;\n if (this.$row < 0) {\n this.$row = 0;\n return null;\n }\n \n this.$rowTokens = this.$session.getTokens(this.$row);\n this.$tokenIndex = this.$rowTokens.length - 1;\n }\n \n return this.$rowTokens[this.$tokenIndex];\n }; \n this.stepForward = function() {\n this.$tokenIndex += 1;\n var rowCount;\n while (this.$tokenIndex >= this.$rowTokens.length) {\n this.$row += 1;\n if (!rowCount)\n rowCount = this.$session.getLength();\n if (this.$row >= rowCount) {\n this.$row = rowCount - 1;\n return null;\n }\n\n this.$rowTokens = this.$session.getTokens(this.$row);\n this.$tokenIndex = 0;\n }\n \n return this.$rowTokens[this.$tokenIndex];\n }; \n this.getCurrentToken = function () {\n return this.$rowTokens[this.$tokenIndex];\n }; \n this.getCurrentTokenRow = function () {\n return this.$row;\n }; \n this.getCurrentTokenColumn = function() {\n var rowTokens = this.$rowTokens;\n var tokenIndex = this.$tokenIndex;\n var column = rowTokens[tokenIndex].start;\n if (column !== undefined)\n return column;\n \n column = 0;\n while (tokenIndex > 0) {\n tokenIndex -= 1;\n column += rowTokens[tokenIndex].value.length;\n }\n \n return column; \n };\n this.getCurrentTokenPosition = function() {\n return {row: this.$row, column: this.getCurrentTokenColumn()};\n };\n this.getCurrentTokenRange = function() {\n var token = this.$rowTokens[this.$tokenIndex];\n var column = this.getCurrentTokenColumn();\n return new Range(this.$row, column, this.$row, column + token.value.length);\n };\n\n}).call(TokenIterator.prototype);\n\nexports.TokenIterator = TokenIterator;\n});\n\nace.define(\"ace/mode/behaviour/cstyle\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/behaviour\",\"ace/token_iterator\",\"ace/lib/lang\"], function(acequire, exports, module) {\n\"use strict\";\n\nvar oop = acequire(\"../../lib/oop\");\nvar Behaviour = acequire(\"../behaviour\").Behaviour;\nvar TokenIterator = acequire(\"../../token_iterator\").TokenIterator;\nvar lang = acequire(\"../../lib/lang\");\n\nvar SAFE_INSERT_IN_TOKENS =\n [\"text\", \"paren.rparen\", \"punctuation.operator\"];\nvar SAFE_INSERT_BEFORE_TOKENS =\n [\"text\", \"paren.rparen\", \"punctuation.operator\", \"comment\"];\n\nvar context;\nvar contextCache = {};\nvar defaultQuotes = {'\"' : '\"', \"'\" : \"'\"};\n\nvar initContext = function(editor) {\n var id = -1;\n if (editor.multiSelect) {\n id = editor.selection.index;\n if (contextCache.rangeCount != editor.multiSelect.rangeCount)\n contextCache = {rangeCount: editor.multiSelect.rangeCount};\n }\n if (contextCache[id])\n return context = contextCache[id];\n context = contextCache[id] = {\n autoInsertedBrackets: 0,\n autoInsertedRow: -1,\n autoInsertedLineEnd: \"\",\n maybeInsertedBrackets: 0,\n maybeInsertedRow: -1,\n maybeInsertedLineStart: \"\",\n maybeInsertedLineEnd: \"\"\n };\n};\n\nvar getWrapped = function(selection, selected, opening, closing) {\n var rowDiff = selection.end.row - selection.start.row;\n return {\n text: opening + selected + closing,\n selection: [\n 0,\n selection.start.column + 1,\n rowDiff,\n selection.end.column + (rowDiff ? 0 : 1)\n ]\n };\n};\n\nvar CstyleBehaviour = function(options) {\n this.add(\"braces\", \"insertion\", function(state, action, editor, session, text) {\n var cursor = editor.getCursorPosition();\n var line = session.doc.getLine(cursor.row);\n if (text == '{') {\n initContext(editor);\n var selection = editor.getSelectionRange();\n var selected = session.doc.getTextRange(selection);\n if (selected !== \"\" && selected !== \"{\" && editor.getWrapBehavioursEnabled()) {\n return getWrapped(selection, selected, '{', '}');\n } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {\n if (/[\\]\\}\\)]/.test(line[cursor.column]) || editor.inMultiSelectMode || options && options.braces) {\n CstyleBehaviour.recordAutoInsert(editor, session, \"}\");\n return {\n text: '{}',\n selection: [1, 1]\n };\n } else {\n CstyleBehaviour.recordMaybeInsert(editor, session, \"{\");\n return {\n text: '{',\n selection: [1, 1]\n };\n }\n }\n } else if (text == '}') {\n initContext(editor);\n var rightChar = line.substring(cursor.column, cursor.column + 1);\n if (rightChar == '}') {\n var matching = session.$findOpeningBracket('}', {column: cursor.column + 1, row: cursor.row});\n if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {\n CstyleBehaviour.popAutoInsertedClosing();\n return {\n text: '',\n selection: [1, 1]\n };\n }\n }\n } else if (text == \"\\n\" || text == \"\\r\\n\") {\n initContext(editor);\n var closing = \"\";\n if (CstyleBehaviour.isMaybeInsertedClosing(cursor, line)) {\n closing = lang.stringRepeat(\"}\", context.maybeInsertedBrackets);\n CstyleBehaviour.clearMaybeInsertedClosing();\n }\n var rightChar = line.substring(cursor.column, cursor.column + 1);\n if (rightChar === '}') {\n var openBracePos = session.findMatchingBracket({row: cursor.row, column: cursor.column+1}, '}');\n if (!openBracePos)\n return null;\n var next_indent = this.$getIndent(session.getLine(openBracePos.row));\n } else if (closing) {\n var next_indent = this.$getIndent(line);\n } else {\n CstyleBehaviour.clearMaybeInsertedClosing();\n return;\n }\n var indent = next_indent + session.getTabString();\n\n return {\n text: '\\n' + indent + '\\n' + next_indent + closing,\n selection: [1, indent.length, 1, indent.length]\n };\n } else {\n CstyleBehaviour.clearMaybeInsertedClosing();\n }\n });\n\n this.add(\"braces\", \"deletion\", function(state, action, editor, session, range) {\n var selected = session.doc.getTextRange(range);\n if (!range.isMultiLine() && selected == '{') {\n initContext(editor);\n var line = session.doc.getLine(range.start.row);\n var rightChar = line.substring(range.end.column, range.end.column + 1);\n if (rightChar == '}') {\n range.end.column++;\n return range;\n } else {\n context.maybeInsertedBrackets--;\n }\n }\n });\n\n this.add(\"parens\", \"insertion\", function(state, action, editor, session, text) {\n if (text == '(') {\n initContext(editor);\n var selection = editor.getSelectionRange();\n var selected = session.doc.getTextRange(selection);\n if (selected !== \"\" && editor.getWrapBehavioursEnabled()) {\n return getWrapped(selection, selected, '(', ')');\n } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {\n CstyleBehaviour.recordAutoInsert(editor, session, \")\");\n return {\n text: '()',\n selection: [1, 1]\n };\n }\n } else if (text == ')') {\n initContext(editor);\n var cursor = editor.getCursorPosition();\n var line = session.doc.getLine(cursor.row);\n var rightChar = line.substring(cursor.column, cursor.column + 1);\n if (rightChar == ')') {\n var matching = session.$findOpeningBracket(')', {column: cursor.column + 1, row: cursor.row});\n if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {\n CstyleBehaviour.popAutoInsertedClosing();\n return {\n text: '',\n selection: [1, 1]\n };\n }\n }\n }\n });\n\n this.add(\"parens\", \"deletion\", function(state, action, editor, session, range) {\n var selected = session.doc.getTextRange(range);\n if (!range.isMultiLine() && selected == '(') {\n initContext(editor);\n var line = session.doc.getLine(range.start.row);\n var rightChar = line.substring(range.start.column + 1, range.start.column + 2);\n if (rightChar == ')') {\n range.end.column++;\n return range;\n }\n }\n });\n\n this.add(\"brackets\", \"insertion\", function(state, action, editor, session, text) {\n if (text == '[') {\n initContext(editor);\n var selection = editor.getSelectionRange();\n var selected = session.doc.getTextRange(selection);\n if (selected !== \"\" && editor.getWrapBehavioursEnabled()) {\n return getWrapped(selection, selected, '[', ']');\n } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {\n CstyleBehaviour.recordAutoInsert(editor, session, \"]\");\n return {\n text: '[]',\n selection: [1, 1]\n };\n }\n } else if (text == ']') {\n initContext(editor);\n var cursor = editor.getCursorPosition();\n var line = session.doc.getLine(cursor.row);\n var rightChar = line.substring(cursor.column, cursor.column + 1);\n if (rightChar == ']') {\n var matching = session.$findOpeningBracket(']', {column: cursor.column + 1, row: cursor.row});\n if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {\n CstyleBehaviour.popAutoInsertedClosing();\n return {\n text: '',\n selection: [1, 1]\n };\n }\n }\n }\n });\n\n this.add(\"brackets\", \"deletion\", function(state, action, editor, session, range) {\n var selected = session.doc.getTextRange(range);\n if (!range.isMultiLine() && selected == '[') {\n initContext(editor);\n var line = session.doc.getLine(range.start.row);\n var rightChar = line.substring(range.start.column + 1, range.start.column + 2);\n if (rightChar == ']') {\n range.end.column++;\n return range;\n }\n }\n });\n\n this.add(\"string_dquotes\", \"insertion\", function(state, action, editor, session, text) {\n var quotes = session.$mode.$quotes || defaultQuotes;\n if (text.length == 1 && quotes[text]) {\n if (this.lineCommentStart && this.lineCommentStart.indexOf(text) != -1)\n return;\n initContext(editor);\n var quote = text;\n var selection = editor.getSelectionRange();\n var selected = session.doc.getTextRange(selection);\n if (selected !== \"\" && (selected.length != 1 || !quotes[selected]) && editor.getWrapBehavioursEnabled()) {\n return getWrapped(selection, selected, quote, quote);\n } else if (!selected) {\n var cursor = editor.getCursorPosition();\n var line = session.doc.getLine(cursor.row);\n var leftChar = line.substring(cursor.column-1, cursor.column);\n var rightChar = line.substring(cursor.column, cursor.column + 1);\n\n var token = session.getTokenAt(cursor.row, cursor.column);\n var rightToken = session.getTokenAt(cursor.row, cursor.column + 1);\n if (leftChar == \"\\\\\" && token && /escape/.test(token.type))\n return null;\n\n var stringBefore = token && /string|escape/.test(token.type);\n var stringAfter = !rightToken || /string|escape/.test(rightToken.type);\n\n var pair;\n if (rightChar == quote) {\n pair = stringBefore !== stringAfter;\n if (pair && /string\\.end/.test(rightToken.type))\n pair = false;\n } else {\n if (stringBefore && !stringAfter)\n return null; // wrap string with different quote\n if (stringBefore && stringAfter)\n return null; // do not pair quotes inside strings\n var wordRe = session.$mode.tokenRe;\n wordRe.lastIndex = 0;\n var isWordBefore = wordRe.test(leftChar);\n wordRe.lastIndex = 0;\n var isWordAfter = wordRe.test(leftChar);\n if (isWordBefore || isWordAfter)\n return null; // before or after alphanumeric\n if (rightChar && !/[\\s;,.})\\]\\\\]/.test(rightChar))\n return null; // there is rightChar and it isn't closing\n pair = true;\n }\n return {\n text: pair ? quote + quote : \"\",\n selection: [1,1]\n };\n }\n }\n });\n\n this.add(\"string_dquotes\", \"deletion\", function(state, action, editor, session, range) {\n var selected = session.doc.getTextRange(range);\n if (!range.isMultiLine() && (selected == '\"' || selected == \"'\")) {\n initContext(editor);\n var line = session.doc.getLine(range.start.row);\n var rightChar = line.substring(range.start.column + 1, range.start.column + 2);\n if (rightChar == selected) {\n range.end.column++;\n return range;\n }\n }\n });\n\n};\n\n\nCstyleBehaviour.isSaneInsertion = function(editor, session) {\n var cursor = editor.getCursorPosition();\n var iterator = new TokenIterator(session, cursor.row, cursor.column);\n if (!this.$matchTokenType(iterator.getCurrentToken() || \"text\", SAFE_INSERT_IN_TOKENS)) {\n var iterator2 = new TokenIterator(session, cursor.row, cursor.column + 1);\n if (!this.$matchTokenType(iterator2.getCurrentToken() || \"text\", SAFE_INSERT_IN_TOKENS))\n return false;\n }\n iterator.stepForward();\n return iterator.getCurrentTokenRow() !== cursor.row ||\n this.$matchTokenType(iterator.getCurrentToken() || \"text\", SAFE_INSERT_BEFORE_TOKENS);\n};\n\nCstyleBehaviour.$matchTokenType = function(token, types) {\n return types.indexOf(token.type || token) > -1;\n};\n\nCstyleBehaviour.recordAutoInsert = function(editor, session, bracket) {\n var cursor = editor.getCursorPosition();\n var line = session.doc.getLine(cursor.row);\n if (!this.isAutoInsertedClosing(cursor, line, context.autoInsertedLineEnd[0]))\n context.autoInsertedBrackets = 0;\n context.autoInsertedRow = cursor.row;\n context.autoInsertedLineEnd = bracket + line.substr(cursor.column);\n context.autoInsertedBrackets++;\n};\n\nCstyleBehaviour.recordMaybeInsert = function(editor, session, bracket) {\n var cursor = editor.getCursorPosition();\n var line = session.doc.getLine(cursor.row);\n if (!this.isMaybeInsertedClosing(cursor, line))\n context.maybeInsertedBrackets = 0;\n context.maybeInsertedRow = cursor.row;\n context.maybeInsertedLineStart = line.substr(0, cursor.column) + bracket;\n context.maybeInsertedLineEnd = line.substr(cursor.column);\n context.maybeInsertedBrackets++;\n};\n\nCstyleBehaviour.isAutoInsertedClosing = function(cursor, line, bracket) {\n return context.autoInsertedBrackets > 0 &&\n cursor.row === context.autoInsertedRow &&\n bracket === context.autoInsertedLineEnd[0] &&\n line.substr(cursor.column) === context.autoInsertedLineEnd;\n};\n\nCstyleBehaviour.isMaybeInsertedClosing = function(cursor, line) {\n return context.maybeInsertedBrackets > 0 &&\n cursor.row === context.maybeInsertedRow &&\n line.substr(cursor.column) === context.maybeInsertedLineEnd &&\n line.substr(0, cursor.column) == context.maybeInsertedLineStart;\n};\n\nCstyleBehaviour.popAutoInsertedClosing = function() {\n context.autoInsertedLineEnd = context.autoInsertedLineEnd.substr(1);\n context.autoInsertedBrackets--;\n};\n\nCstyleBehaviour.clearMaybeInsertedClosing = function() {\n if (context) {\n context.maybeInsertedBrackets = 0;\n context.maybeInsertedRow = -1;\n }\n};\n\n\n\noop.inherits(CstyleBehaviour, Behaviour);\n\nexports.CstyleBehaviour = CstyleBehaviour;\n});\n\nace.define(\"ace/unicode\",[\"require\",\"exports\",\"module\"], function(acequire, exports, module) {\n\"use strict\";\nexports.packages = {};\n\naddUnicodePackage({\n L: \"0041-005A0061-007A00AA00B500BA00C0-00D600D8-00F600F8-02C102C6-02D102E0-02E402EC02EE0370-037403760377037A-037D03860388-038A038C038E-03A103A3-03F503F7-0481048A-05250531-055605590561-058705D0-05EA05F0-05F20621-064A066E066F0671-06D306D506E506E606EE06EF06FA-06FC06FF07100712-072F074D-07A507B107CA-07EA07F407F507FA0800-0815081A082408280904-0939093D09500958-0961097109720979-097F0985-098C098F09900993-09A809AA-09B009B209B6-09B909BD09CE09DC09DD09DF-09E109F009F10A05-0A0A0A0F0A100A13-0A280A2A-0A300A320A330A350A360A380A390A59-0A5C0A5E0A72-0A740A85-0A8D0A8F-0A910A93-0AA80AAA-0AB00AB20AB30AB5-0AB90ABD0AD00AE00AE10B05-0B0C0B0F0B100B13-0B280B2A-0B300B320B330B35-0B390B3D0B5C0B5D0B5F-0B610B710B830B85-0B8A0B8E-0B900B92-0B950B990B9A0B9C0B9E0B9F0BA30BA40BA8-0BAA0BAE-0BB90BD00C05-0C0C0C0E-0C100C12-0C280C2A-0C330C35-0C390C3D0C580C590C600C610C85-0C8C0C8E-0C900C92-0CA80CAA-0CB30CB5-0CB90CBD0CDE0CE00CE10D05-0D0C0D0E-0D100D12-0D280D2A-0D390D3D0D600D610D7A-0D7F0D85-0D960D9A-0DB10DB3-0DBB0DBD0DC0-0DC60E01-0E300E320E330E40-0E460E810E820E840E870E880E8A0E8D0E94-0E970E99-0E9F0EA1-0EA30EA50EA70EAA0EAB0EAD-0EB00EB20EB30EBD0EC0-0EC40EC60EDC0EDD0F000F40-0F470F49-0F6C0F88-0F8B1000-102A103F1050-1055105A-105D106110651066106E-10701075-1081108E10A0-10C510D0-10FA10FC1100-1248124A-124D1250-12561258125A-125D1260-1288128A-128D1290-12B012B2-12B512B8-12BE12C012C2-12C512C8-12D612D8-13101312-13151318-135A1380-138F13A0-13F41401-166C166F-167F1681-169A16A0-16EA1700-170C170E-17111720-17311740-17511760-176C176E-17701780-17B317D717DC1820-18771880-18A818AA18B0-18F51900-191C1950-196D1970-19741980-19AB19C1-19C71A00-1A161A20-1A541AA71B05-1B331B45-1B4B1B83-1BA01BAE1BAF1C00-1C231C4D-1C4F1C5A-1C7D1CE9-1CEC1CEE-1CF11D00-1DBF1E00-1F151F18-1F1D1F20-1F451F48-1F4D1F50-1F571F591F5B1F5D1F5F-1F7D1F80-1FB41FB6-1FBC1FBE1FC2-1FC41FC6-1FCC1FD0-1FD31FD6-1FDB1FE0-1FEC1FF2-1FF41FF6-1FFC2071207F2090-209421022107210A-211321152119-211D212421262128212A-212D212F-2139213C-213F2145-2149214E218321842C00-2C2E2C30-2C5E2C60-2CE42CEB-2CEE2D00-2D252D30-2D652D6F2D80-2D962DA0-2DA62DA8-2DAE2DB0-2DB62DB8-2DBE2DC0-2DC62DC8-2DCE2DD0-2DD62DD8-2DDE2E2F300530063031-3035303B303C3041-3096309D-309F30A1-30FA30FC-30FF3105-312D3131-318E31A0-31B731F0-31FF3400-4DB54E00-9FCBA000-A48CA4D0-A4FDA500-A60CA610-A61FA62AA62BA640-A65FA662-A66EA67F-A697A6A0-A6E5A717-A71FA722-A788A78BA78CA7FB-A801A803-A805A807-A80AA80C-A822A840-A873A882-A8B3A8F2-A8F7A8FBA90A-A925A930-A946A960-A97CA984-A9B2A9CFAA00-AA28AA40-AA42AA44-AA4BAA60-AA76AA7AAA80-AAAFAAB1AAB5AAB6AAB9-AABDAAC0AAC2AADB-AADDABC0-ABE2AC00-D7A3D7B0-D7C6D7CB-D7FBF900-FA2DFA30-FA6DFA70-FAD9FB00-FB06FB13-FB17FB1DFB1F-FB28FB2A-FB36FB38-FB3CFB3EFB40FB41FB43FB44FB46-FBB1FBD3-FD3DFD50-FD8FFD92-FDC7FDF0-FDFBFE70-FE74FE76-FEFCFF21-FF3AFF41-FF5AFF66-FFBEFFC2-FFC7FFCA-FFCFFFD2-FFD7FFDA-FFDC\",\n Ll: \"0061-007A00AA00B500BA00DF-00F600F8-00FF01010103010501070109010B010D010F01110113011501170119011B011D011F01210123012501270129012B012D012F01310133013501370138013A013C013E014001420144014601480149014B014D014F01510153015501570159015B015D015F01610163016501670169016B016D016F0171017301750177017A017C017E-0180018301850188018C018D019201950199-019B019E01A101A301A501A801AA01AB01AD01B001B401B601B901BA01BD-01BF01C601C901CC01CE01D001D201D401D601D801DA01DC01DD01DF01E101E301E501E701E901EB01ED01EF01F001F301F501F901FB01FD01FF02010203020502070209020B020D020F02110213021502170219021B021D021F02210223022502270229022B022D022F02310233-0239023C023F0240024202470249024B024D024F-02930295-02AF037103730377037B-037D039003AC-03CE03D003D103D5-03D703D903DB03DD03DF03E103E303E503E703E903EB03ED03EF-03F303F503F803FB03FC0430-045F04610463046504670469046B046D046F04710473047504770479047B047D047F0481048B048D048F04910493049504970499049B049D049F04A104A304A504A704A904AB04AD04AF04B104B304B504B704B904BB04BD04BF04C204C404C604C804CA04CC04CE04CF04D104D304D504D704D904DB04DD04DF04E104E304E504E704E904EB04ED04EF04F104F304F504F704F904FB04FD04FF05010503050505070509050B050D050F05110513051505170519051B051D051F0521052305250561-05871D00-1D2B1D62-1D771D79-1D9A1E011E031E051E071E091E0B1E0D1E0F1E111E131E151E171E191E1B1E1D1E1F1E211E231E251E271E291E2B1E2D1E2F1E311E331E351E371E391E3B1E3D1E3F1E411E431E451E471E491E4B1E4D1E4F1E511E531E551E571E591E5B1E5D1E5F1E611E631E651E671E691E6B1E6D1E6F1E711E731E751E771E791E7B1E7D1E7F1E811E831E851E871E891E8B1E8D1E8F1E911E931E95-1E9D1E9F1EA11EA31EA51EA71EA91EAB1EAD1EAF1EB11EB31EB51EB71EB91EBB1EBD1EBF1EC11EC31EC51EC71EC91ECB1ECD1ECF1ED11ED31ED51ED71ED91EDB1EDD1EDF1EE11EE31EE51EE71EE91EEB1EED1EEF1EF11EF31EF51EF71EF91EFB1EFD1EFF-1F071F10-1F151F20-1F271F30-1F371F40-1F451F50-1F571F60-1F671F70-1F7D1F80-1F871F90-1F971FA0-1FA71FB0-1FB41FB61FB71FBE1FC2-1FC41FC61FC71FD0-1FD31FD61FD71FE0-1FE71FF2-1FF41FF61FF7210A210E210F2113212F21342139213C213D2146-2149214E21842C30-2C5E2C612C652C662C682C6A2C6C2C712C732C742C76-2C7C2C812C832C852C872C892C8B2C8D2C8F2C912C932C952C972C992C9B2C9D2C9F2CA12CA32CA52CA72CA92CAB2CAD2CAF2CB12CB32CB52CB72CB92CBB2CBD2CBF2CC12CC32CC52CC72CC92CCB2CCD2CCF2CD12CD32CD52CD72CD92CDB2CDD2CDF2CE12CE32CE42CEC2CEE2D00-2D25A641A643A645A647A649A64BA64DA64FA651A653A655A657A659A65BA65DA65FA663A665A667A669A66BA66DA681A683A685A687A689A68BA68DA68FA691A693A695A697A723A725A727A729A72BA72DA72F-A731A733A735A737A739A73BA73DA73FA741A743A745A747A749A74BA74DA74FA751A753A755A757A759A75BA75DA75FA761A763A765A767A769A76BA76DA76FA771-A778A77AA77CA77FA781A783A785A787A78CFB00-FB06FB13-FB17FF41-FF5A\",\n Lu: \"0041-005A00C0-00D600D8-00DE01000102010401060108010A010C010E01100112011401160118011A011C011E01200122012401260128012A012C012E01300132013401360139013B013D013F0141014301450147014A014C014E01500152015401560158015A015C015E01600162016401660168016A016C016E017001720174017601780179017B017D018101820184018601870189-018B018E-0191019301940196-0198019C019D019F01A001A201A401A601A701A901AC01AE01AF01B1-01B301B501B701B801BC01C401C701CA01CD01CF01D101D301D501D701D901DB01DE01E001E201E401E601E801EA01EC01EE01F101F401F6-01F801FA01FC01FE02000202020402060208020A020C020E02100212021402160218021A021C021E02200222022402260228022A022C022E02300232023A023B023D023E02410243-02460248024A024C024E03700372037603860388-038A038C038E038F0391-03A103A3-03AB03CF03D2-03D403D803DA03DC03DE03E003E203E403E603E803EA03EC03EE03F403F703F903FA03FD-042F04600462046404660468046A046C046E04700472047404760478047A047C047E0480048A048C048E04900492049404960498049A049C049E04A004A204A404A604A804AA04AC04AE04B004B204B404B604B804BA04BC04BE04C004C104C304C504C704C904CB04CD04D004D204D404D604D804DA04DC04DE04E004E204E404E604E804EA04EC04EE04F004F204F404F604F804FA04FC04FE05000502050405060508050A050C050E05100512051405160518051A051C051E0520052205240531-055610A0-10C51E001E021E041E061E081E0A1E0C1E0E1E101E121E141E161E181E1A1E1C1E1E1E201E221E241E261E281E2A1E2C1E2E1E301E321E341E361E381E3A1E3C1E3E1E401E421E441E461E481E4A1E4C1E4E1E501E521E541E561E581E5A1E5C1E5E1E601E621E641E661E681E6A1E6C1E6E1E701E721E741E761E781E7A1E7C1E7E1E801E821E841E861E881E8A1E8C1E8E1E901E921E941E9E1EA01EA21EA41EA61EA81EAA1EAC1EAE1EB01EB21EB41EB61EB81EBA1EBC1EBE1EC01EC21EC41EC61EC81ECA1ECC1ECE1ED01ED21ED41ED61ED81EDA1EDC1EDE1EE01EE21EE41EE61EE81EEA1EEC1EEE1EF01EF21EF41EF61EF81EFA1EFC1EFE1F08-1F0F1F18-1F1D1F28-1F2F1F38-1F3F1F48-1F4D1F591F5B1F5D1F5F1F68-1F6F1FB8-1FBB1FC8-1FCB1FD8-1FDB1FE8-1FEC1FF8-1FFB21022107210B-210D2110-211221152119-211D212421262128212A-212D2130-2133213E213F214521832C00-2C2E2C602C62-2C642C672C692C6B2C6D-2C702C722C752C7E-2C802C822C842C862C882C8A2C8C2C8E2C902C922C942C962C982C9A2C9C2C9E2CA02CA22CA42CA62CA82CAA2CAC2CAE2CB02CB22CB42CB62CB82CBA2CBC2CBE2CC02CC22CC42CC62CC82CCA2CCC2CCE2CD02CD22CD42CD62CD82CDA2CDC2CDE2CE02CE22CEB2CEDA640A642A644A646A648A64AA64CA64EA650A652A654A656A658A65AA65CA65EA662A664A666A668A66AA66CA680A682A684A686A688A68AA68CA68EA690A692A694A696A722A724A726A728A72AA72CA72EA732A734A736A738A73AA73CA73EA740A742A744A746A748A74AA74CA74EA750A752A754A756A758A75AA75CA75EA760A762A764A766A768A76AA76CA76EA779A77BA77DA77EA780A782A784A786A78BFF21-FF3A\",\n Lt: \"01C501C801CB01F21F88-1F8F1F98-1F9F1FA8-1FAF1FBC1FCC1FFC\",\n Lm: \"02B0-02C102C6-02D102E0-02E402EC02EE0374037A0559064006E506E607F407F507FA081A0824082809710E460EC610FC17D718431AA71C78-1C7D1D2C-1D611D781D9B-1DBF2071207F2090-20942C7D2D6F2E2F30053031-3035303B309D309E30FC-30FEA015A4F8-A4FDA60CA67FA717-A71FA770A788A9CFAA70AADDFF70FF9EFF9F\",\n Lo: \"01BB01C0-01C3029405D0-05EA05F0-05F20621-063F0641-064A066E066F0671-06D306D506EE06EF06FA-06FC06FF07100712-072F074D-07A507B107CA-07EA0800-08150904-0939093D09500958-096109720979-097F0985-098C098F09900993-09A809AA-09B009B209B6-09B909BD09CE09DC09DD09DF-09E109F009F10A05-0A0A0A0F0A100A13-0A280A2A-0A300A320A330A350A360A380A390A59-0A5C0A5E0A72-0A740A85-0A8D0A8F-0A910A93-0AA80AAA-0AB00AB20AB30AB5-0AB90ABD0AD00AE00AE10B05-0B0C0B0F0B100B13-0B280B2A-0B300B320B330B35-0B390B3D0B5C0B5D0B5F-0B610B710B830B85-0B8A0B8E-0B900B92-0B950B990B9A0B9C0B9E0B9F0BA30BA40BA8-0BAA0BAE-0BB90BD00C05-0C0C0C0E-0C100C12-0C280C2A-0C330C35-0C390C3D0C580C590C600C610C85-0C8C0C8E-0C900C92-0CA80CAA-0CB30CB5-0CB90CBD0CDE0CE00CE10D05-0D0C0D0E-0D100D12-0D280D2A-0D390D3D0D600D610D7A-0D7F0D85-0D960D9A-0DB10DB3-0DBB0DBD0DC0-0DC60E01-0E300E320E330E40-0E450E810E820E840E870E880E8A0E8D0E94-0E970E99-0E9F0EA1-0EA30EA50EA70EAA0EAB0EAD-0EB00EB20EB30EBD0EC0-0EC40EDC0EDD0F000F40-0F470F49-0F6C0F88-0F8B1000-102A103F1050-1055105A-105D106110651066106E-10701075-1081108E10D0-10FA1100-1248124A-124D1250-12561258125A-125D1260-1288128A-128D1290-12B012B2-12B512B8-12BE12C012C2-12C512C8-12D612D8-13101312-13151318-135A1380-138F13A0-13F41401-166C166F-167F1681-169A16A0-16EA1700-170C170E-17111720-17311740-17511760-176C176E-17701780-17B317DC1820-18421844-18771880-18A818AA18B0-18F51900-191C1950-196D1970-19741980-19AB19C1-19C71A00-1A161A20-1A541B05-1B331B45-1B4B1B83-1BA01BAE1BAF1C00-1C231C4D-1C4F1C5A-1C771CE9-1CEC1CEE-1CF12135-21382D30-2D652D80-2D962DA0-2DA62DA8-2DAE2DB0-2DB62DB8-2DBE2DC0-2DC62DC8-2DCE2DD0-2DD62DD8-2DDE3006303C3041-3096309F30A1-30FA30FF3105-312D3131-318E31A0-31B731F0-31FF3400-4DB54E00-9FCBA000-A014A016-A48CA4D0-A4F7A500-A60BA610-A61FA62AA62BA66EA6A0-A6E5A7FB-A801A803-A805A807-A80AA80C-A822A840-A873A882-A8B3A8F2-A8F7A8FBA90A-A925A930-A946A960-A97CA984-A9B2AA00-AA28AA40-AA42AA44-AA4BAA60-AA6FAA71-AA76AA7AAA80-AAAFAAB1AAB5AAB6AAB9-AABDAAC0AAC2AADBAADCABC0-ABE2AC00-D7A3D7B0-D7C6D7CB-D7FBF900-FA2DFA30-FA6DFA70-FAD9FB1DFB1F-FB28FB2A-FB36FB38-FB3CFB3EFB40FB41FB43FB44FB46-FBB1FBD3-FD3DFD50-FD8FFD92-FDC7FDF0-FDFBFE70-FE74FE76-FEFCFF66-FF6FFF71-FF9DFFA0-FFBEFFC2-FFC7FFCA-FFCFFFD2-FFD7FFDA-FFDC\",\n M: \"0300-036F0483-04890591-05BD05BF05C105C205C405C505C70610-061A064B-065E067006D6-06DC06DE-06E406E706E806EA-06ED07110730-074A07A6-07B007EB-07F30816-0819081B-08230825-08270829-082D0900-0903093C093E-094E0951-0955096209630981-098309BC09BE-09C409C709C809CB-09CD09D709E209E30A01-0A030A3C0A3E-0A420A470A480A4B-0A4D0A510A700A710A750A81-0A830ABC0ABE-0AC50AC7-0AC90ACB-0ACD0AE20AE30B01-0B030B3C0B3E-0B440B470B480B4B-0B4D0B560B570B620B630B820BBE-0BC20BC6-0BC80BCA-0BCD0BD70C01-0C030C3E-0C440C46-0C480C4A-0C4D0C550C560C620C630C820C830CBC0CBE-0CC40CC6-0CC80CCA-0CCD0CD50CD60CE20CE30D020D030D3E-0D440D46-0D480D4A-0D4D0D570D620D630D820D830DCA0DCF-0DD40DD60DD8-0DDF0DF20DF30E310E34-0E3A0E47-0E4E0EB10EB4-0EB90EBB0EBC0EC8-0ECD0F180F190F350F370F390F3E0F3F0F71-0F840F860F870F90-0F970F99-0FBC0FC6102B-103E1056-1059105E-10601062-10641067-106D1071-10741082-108D108F109A-109D135F1712-17141732-1734175217531772177317B6-17D317DD180B-180D18A91920-192B1930-193B19B0-19C019C819C91A17-1A1B1A55-1A5E1A60-1A7C1A7F1B00-1B041B34-1B441B6B-1B731B80-1B821BA1-1BAA1C24-1C371CD0-1CD21CD4-1CE81CED1CF21DC0-1DE61DFD-1DFF20D0-20F02CEF-2CF12DE0-2DFF302A-302F3099309AA66F-A672A67CA67DA6F0A6F1A802A806A80BA823-A827A880A881A8B4-A8C4A8E0-A8F1A926-A92DA947-A953A980-A983A9B3-A9C0AA29-AA36AA43AA4CAA4DAA7BAAB0AAB2-AAB4AAB7AAB8AABEAABFAAC1ABE3-ABEAABECABEDFB1EFE00-FE0FFE20-FE26\",\n Mn: \"0300-036F0483-04870591-05BD05BF05C105C205C405C505C70610-061A064B-065E067006D6-06DC06DF-06E406E706E806EA-06ED07110730-074A07A6-07B007EB-07F30816-0819081B-08230825-08270829-082D0900-0902093C0941-0948094D0951-095509620963098109BC09C1-09C409CD09E209E30A010A020A3C0A410A420A470A480A4B-0A4D0A510A700A710A750A810A820ABC0AC1-0AC50AC70AC80ACD0AE20AE30B010B3C0B3F0B41-0B440B4D0B560B620B630B820BC00BCD0C3E-0C400C46-0C480C4A-0C4D0C550C560C620C630CBC0CBF0CC60CCC0CCD0CE20CE30D41-0D440D4D0D620D630DCA0DD2-0DD40DD60E310E34-0E3A0E47-0E4E0EB10EB4-0EB90EBB0EBC0EC8-0ECD0F180F190F350F370F390F71-0F7E0F80-0F840F860F870F90-0F970F99-0FBC0FC6102D-10301032-10371039103A103D103E10581059105E-10601071-1074108210851086108D109D135F1712-17141732-1734175217531772177317B7-17BD17C617C9-17D317DD180B-180D18A91920-19221927192819321939-193B1A171A181A561A58-1A5E1A601A621A65-1A6C1A73-1A7C1A7F1B00-1B031B341B36-1B3A1B3C1B421B6B-1B731B801B811BA2-1BA51BA81BA91C2C-1C331C361C371CD0-1CD21CD4-1CE01CE2-1CE81CED1DC0-1DE61DFD-1DFF20D0-20DC20E120E5-20F02CEF-2CF12DE0-2DFF302A-302F3099309AA66FA67CA67DA6F0A6F1A802A806A80BA825A826A8C4A8E0-A8F1A926-A92DA947-A951A980-A982A9B3A9B6-A9B9A9BCAA29-AA2EAA31AA32AA35AA36AA43AA4CAAB0AAB2-AAB4AAB7AAB8AABEAABFAAC1ABE5ABE8ABEDFB1EFE00-FE0FFE20-FE26\",\n Mc: \"0903093E-09400949-094C094E0982098309BE-09C009C709C809CB09CC09D70A030A3E-0A400A830ABE-0AC00AC90ACB0ACC0B020B030B3E0B400B470B480B4B0B4C0B570BBE0BBF0BC10BC20BC6-0BC80BCA-0BCC0BD70C01-0C030C41-0C440C820C830CBE0CC0-0CC40CC70CC80CCA0CCB0CD50CD60D020D030D3E-0D400D46-0D480D4A-0D4C0D570D820D830DCF-0DD10DD8-0DDF0DF20DF30F3E0F3F0F7F102B102C10311038103B103C105610571062-10641067-106D108310841087-108C108F109A-109C17B617BE-17C517C717C81923-19261929-192B193019311933-193819B0-19C019C819C91A19-1A1B1A551A571A611A631A641A6D-1A721B041B351B3B1B3D-1B411B431B441B821BA11BA61BA71BAA1C24-1C2B1C341C351CE11CF2A823A824A827A880A881A8B4-A8C3A952A953A983A9B4A9B5A9BAA9BBA9BD-A9C0AA2FAA30AA33AA34AA4DAA7BABE3ABE4ABE6ABE7ABE9ABEAABEC\",\n Me: \"0488048906DE20DD-20E020E2-20E4A670-A672\",\n N: \"0030-003900B200B300B900BC-00BE0660-066906F0-06F907C0-07C90966-096F09E6-09EF09F4-09F90A66-0A6F0AE6-0AEF0B66-0B6F0BE6-0BF20C66-0C6F0C78-0C7E0CE6-0CEF0D66-0D750E50-0E590ED0-0ED90F20-0F331040-10491090-10991369-137C16EE-16F017E0-17E917F0-17F91810-18191946-194F19D0-19DA1A80-1A891A90-1A991B50-1B591BB0-1BB91C40-1C491C50-1C5920702074-20792080-20892150-21822185-21892460-249B24EA-24FF2776-27932CFD30073021-30293038-303A3192-31953220-32293251-325F3280-328932B1-32BFA620-A629A6E6-A6EFA830-A835A8D0-A8D9A900-A909A9D0-A9D9AA50-AA59ABF0-ABF9FF10-FF19\",\n Nd: \"0030-00390660-066906F0-06F907C0-07C90966-096F09E6-09EF0A66-0A6F0AE6-0AEF0B66-0B6F0BE6-0BEF0C66-0C6F0CE6-0CEF0D66-0D6F0E50-0E590ED0-0ED90F20-0F291040-10491090-109917E0-17E91810-18191946-194F19D0-19DA1A80-1A891A90-1A991B50-1B591BB0-1BB91C40-1C491C50-1C59A620-A629A8D0-A8D9A900-A909A9D0-A9D9AA50-AA59ABF0-ABF9FF10-FF19\",\n Nl: \"16EE-16F02160-21822185-218830073021-30293038-303AA6E6-A6EF\",\n No: \"00B200B300B900BC-00BE09F4-09F90BF0-0BF20C78-0C7E0D70-0D750F2A-0F331369-137C17F0-17F920702074-20792080-20892150-215F21892460-249B24EA-24FF2776-27932CFD3192-31953220-32293251-325F3280-328932B1-32BFA830-A835\",\n P: \"0021-00230025-002A002C-002F003A003B003F0040005B-005D005F007B007D00A100AB00B700BB00BF037E0387055A-055F0589058A05BE05C005C305C605F305F40609060A060C060D061B061E061F066A-066D06D40700-070D07F7-07F90830-083E0964096509700DF40E4F0E5A0E5B0F04-0F120F3A-0F3D0F850FD0-0FD4104A-104F10FB1361-13681400166D166E169B169C16EB-16ED1735173617D4-17D617D8-17DA1800-180A1944194519DE19DF1A1E1A1F1AA0-1AA61AA8-1AAD1B5A-1B601C3B-1C3F1C7E1C7F1CD32010-20272030-20432045-20512053-205E207D207E208D208E2329232A2768-277527C527C627E6-27EF2983-299829D8-29DB29FC29FD2CF9-2CFC2CFE2CFF2E00-2E2E2E302E313001-30033008-30113014-301F3030303D30A030FBA4FEA4FFA60D-A60FA673A67EA6F2-A6F7A874-A877A8CEA8CFA8F8-A8FAA92EA92FA95FA9C1-A9CDA9DEA9DFAA5C-AA5FAADEAADFABEBFD3EFD3FFE10-FE19FE30-FE52FE54-FE61FE63FE68FE6AFE6BFF01-FF03FF05-FF0AFF0C-FF0FFF1AFF1BFF1FFF20FF3B-FF3DFF3FFF5BFF5DFF5F-FF65\",\n Pd: \"002D058A05BE140018062010-20152E172E1A301C303030A0FE31FE32FE58FE63FF0D\",\n Ps: \"0028005B007B0F3A0F3C169B201A201E2045207D208D23292768276A276C276E27702772277427C527E627E827EA27EC27EE2983298529872989298B298D298F299129932995299729D829DA29FC2E222E242E262E283008300A300C300E3010301430163018301A301DFD3EFE17FE35FE37FE39FE3BFE3DFE3FFE41FE43FE47FE59FE5BFE5DFF08FF3BFF5BFF5FFF62\",\n Pe: \"0029005D007D0F3B0F3D169C2046207E208E232A2769276B276D276F27712773277527C627E727E927EB27ED27EF298429862988298A298C298E2990299229942996299829D929DB29FD2E232E252E272E293009300B300D300F3011301530173019301B301E301FFD3FFE18FE36FE38FE3AFE3CFE3EFE40FE42FE44FE48FE5AFE5CFE5EFF09FF3DFF5DFF60FF63\",\n Pi: \"00AB2018201B201C201F20392E022E042E092E0C2E1C2E20\",\n Pf: \"00BB2019201D203A2E032E052E0A2E0D2E1D2E21\",\n Pc: \"005F203F20402054FE33FE34FE4D-FE4FFF3F\",\n Po: \"0021-00230025-0027002A002C002E002F003A003B003F0040005C00A100B700BF037E0387055A-055F058905C005C305C605F305F40609060A060C060D061B061E061F066A-066D06D40700-070D07F7-07F90830-083E0964096509700DF40E4F0E5A0E5B0F04-0F120F850FD0-0FD4104A-104F10FB1361-1368166D166E16EB-16ED1735173617D4-17D617D8-17DA1800-18051807-180A1944194519DE19DF1A1E1A1F1AA0-1AA61AA8-1AAD1B5A-1B601C3B-1C3F1C7E1C7F1CD3201620172020-20272030-2038203B-203E2041-20432047-205120532055-205E2CF9-2CFC2CFE2CFF2E002E012E06-2E082E0B2E0E-2E162E182E192E1B2E1E2E1F2E2A-2E2E2E302E313001-3003303D30FBA4FEA4FFA60D-A60FA673A67EA6F2-A6F7A874-A877A8CEA8CFA8F8-A8FAA92EA92FA95FA9C1-A9CDA9DEA9DFAA5C-AA5FAADEAADFABEBFE10-FE16FE19FE30FE45FE46FE49-FE4CFE50-FE52FE54-FE57FE5F-FE61FE68FE6AFE6BFF01-FF03FF05-FF07FF0AFF0CFF0EFF0FFF1AFF1BFF1FFF20FF3CFF61FF64FF65\",\n S: \"0024002B003C-003E005E0060007C007E00A2-00A900AC00AE-00B100B400B600B800D700F702C2-02C502D2-02DF02E5-02EB02ED02EF-02FF03750384038503F604820606-0608060B060E060F06E906FD06FE07F609F209F309FA09FB0AF10B700BF3-0BFA0C7F0CF10CF20D790E3F0F01-0F030F13-0F170F1A-0F1F0F340F360F380FBE-0FC50FC7-0FCC0FCE0FCF0FD5-0FD8109E109F13601390-139917DB194019E0-19FF1B61-1B6A1B74-1B7C1FBD1FBF-1FC11FCD-1FCF1FDD-1FDF1FED-1FEF1FFD1FFE20442052207A-207C208A-208C20A0-20B8210021012103-21062108210921142116-2118211E-2123212521272129212E213A213B2140-2144214A-214D214F2190-2328232B-23E82400-24262440-244A249C-24E92500-26CD26CF-26E126E326E8-26FF2701-27042706-2709270C-27272729-274B274D274F-27522756-275E2761-276727942798-27AF27B1-27BE27C0-27C427C7-27CA27CC27D0-27E527F0-29822999-29D729DC-29FB29FE-2B4C2B50-2B592CE5-2CEA2E80-2E992E9B-2EF32F00-2FD52FF0-2FFB300430123013302030363037303E303F309B309C319031913196-319F31C0-31E33200-321E322A-32503260-327F328A-32B032C0-32FE3300-33FF4DC0-4DFFA490-A4C6A700-A716A720A721A789A78AA828-A82BA836-A839AA77-AA79FB29FDFCFDFDFE62FE64-FE66FE69FF04FF0BFF1C-FF1EFF3EFF40FF5CFF5EFFE0-FFE6FFE8-FFEEFFFCFFFD\",\n Sm: \"002B003C-003E007C007E00AC00B100D700F703F60606-060820442052207A-207C208A-208C2140-2144214B2190-2194219A219B21A021A321A621AE21CE21CF21D221D421F4-22FF2308-230B23202321237C239B-23B323DC-23E125B725C125F8-25FF266F27C0-27C427C7-27CA27CC27D0-27E527F0-27FF2900-29822999-29D729DC-29FB29FE-2AFF2B30-2B442B47-2B4CFB29FE62FE64-FE66FF0BFF1C-FF1EFF5CFF5EFFE2FFE9-FFEC\",\n Sc: \"002400A2-00A5060B09F209F309FB0AF10BF90E3F17DB20A0-20B8A838FDFCFE69FF04FFE0FFE1FFE5FFE6\",\n Sk: \"005E006000A800AF00B400B802C2-02C502D2-02DF02E5-02EB02ED02EF-02FF0375038403851FBD1FBF-1FC11FCD-1FCF1FDD-1FDF1FED-1FEF1FFD1FFE309B309CA700-A716A720A721A789A78AFF3EFF40FFE3\",\n So: \"00A600A700A900AE00B000B60482060E060F06E906FD06FE07F609FA0B700BF3-0BF80BFA0C7F0CF10CF20D790F01-0F030F13-0F170F1A-0F1F0F340F360F380FBE-0FC50FC7-0FCC0FCE0FCF0FD5-0FD8109E109F13601390-1399194019E0-19FF1B61-1B6A1B74-1B7C210021012103-21062108210921142116-2118211E-2123212521272129212E213A213B214A214C214D214F2195-2199219C-219F21A121A221A421A521A7-21AD21AF-21CD21D021D121D321D5-21F32300-2307230C-231F2322-2328232B-237B237D-239A23B4-23DB23E2-23E82400-24262440-244A249C-24E92500-25B625B8-25C025C2-25F72600-266E2670-26CD26CF-26E126E326E8-26FF2701-27042706-2709270C-27272729-274B274D274F-27522756-275E2761-276727942798-27AF27B1-27BE2800-28FF2B00-2B2F2B452B462B50-2B592CE5-2CEA2E80-2E992E9B-2EF32F00-2FD52FF0-2FFB300430123013302030363037303E303F319031913196-319F31C0-31E33200-321E322A-32503260-327F328A-32B032C0-32FE3300-33FF4DC0-4DFFA490-A4C6A828-A82BA836A837A839AA77-AA79FDFDFFE4FFE8FFEDFFEEFFFCFFFD\",\n Z: \"002000A01680180E2000-200A20282029202F205F3000\",\n Zs: \"002000A01680180E2000-200A202F205F3000\",\n Zl: \"2028\",\n Zp: \"2029\",\n C: \"0000-001F007F-009F00AD03780379037F-0383038B038D03A20526-05300557055805600588058B-059005C8-05CF05EB-05EF05F5-0605061C061D0620065F06DD070E070F074B074C07B2-07BF07FB-07FF082E082F083F-08FF093A093B094F095609570973-097809800984098D098E0991099209A909B109B3-09B509BA09BB09C509C609C909CA09CF-09D609D8-09DB09DE09E409E509FC-0A000A040A0B-0A0E0A110A120A290A310A340A370A3A0A3B0A3D0A43-0A460A490A4A0A4E-0A500A52-0A580A5D0A5F-0A650A76-0A800A840A8E0A920AA90AB10AB40ABA0ABB0AC60ACA0ACE0ACF0AD1-0ADF0AE40AE50AF00AF2-0B000B040B0D0B0E0B110B120B290B310B340B3A0B3B0B450B460B490B4A0B4E-0B550B58-0B5B0B5E0B640B650B72-0B810B840B8B-0B8D0B910B96-0B980B9B0B9D0BA0-0BA20BA5-0BA70BAB-0BAD0BBA-0BBD0BC3-0BC50BC90BCE0BCF0BD1-0BD60BD8-0BE50BFB-0C000C040C0D0C110C290C340C3A-0C3C0C450C490C4E-0C540C570C5A-0C5F0C640C650C70-0C770C800C810C840C8D0C910CA90CB40CBA0CBB0CC50CC90CCE-0CD40CD7-0CDD0CDF0CE40CE50CF00CF3-0D010D040D0D0D110D290D3A-0D3C0D450D490D4E-0D560D58-0D5F0D640D650D76-0D780D800D810D840D97-0D990DB20DBC0DBE0DBF0DC7-0DC90DCB-0DCE0DD50DD70DE0-0DF10DF5-0E000E3B-0E3E0E5C-0E800E830E850E860E890E8B0E8C0E8E-0E930E980EA00EA40EA60EA80EA90EAC0EBA0EBE0EBF0EC50EC70ECE0ECF0EDA0EDB0EDE-0EFF0F480F6D-0F700F8C-0F8F0F980FBD0FCD0FD9-0FFF10C6-10CF10FD-10FF1249124E124F12571259125E125F1289128E128F12B112B612B712BF12C112C612C712D7131113161317135B-135E137D-137F139A-139F13F5-13FF169D-169F16F1-16FF170D1715-171F1737-173F1754-175F176D17711774-177F17B417B517DE17DF17EA-17EF17FA-17FF180F181A-181F1878-187F18AB-18AF18F6-18FF191D-191F192C-192F193C-193F1941-1943196E196F1975-197F19AC-19AF19CA-19CF19DB-19DD1A1C1A1D1A5F1A7D1A7E1A8A-1A8F1A9A-1A9F1AAE-1AFF1B4C-1B4F1B7D-1B7F1BAB-1BAD1BBA-1BFF1C38-1C3A1C4A-1C4C1C80-1CCF1CF3-1CFF1DE7-1DFC1F161F171F1E1F1F1F461F471F4E1F4F1F581F5A1F5C1F5E1F7E1F7F1FB51FC51FD41FD51FDC1FF01FF11FF51FFF200B-200F202A-202E2060-206F20722073208F2095-209F20B9-20CF20F1-20FF218A-218F23E9-23FF2427-243F244B-245F26CE26E226E4-26E727002705270A270B2728274C274E2753-2755275F27602795-279727B027BF27CB27CD-27CF2B4D-2B4F2B5A-2BFF2C2F2C5F2CF2-2CF82D26-2D2F2D66-2D6E2D70-2D7F2D97-2D9F2DA72DAF2DB72DBF2DC72DCF2DD72DDF2E32-2E7F2E9A2EF4-2EFF2FD6-2FEF2FFC-2FFF3040309730983100-3104312E-3130318F31B8-31BF31E4-31EF321F32FF4DB6-4DBF9FCC-9FFFA48D-A48FA4C7-A4CFA62C-A63FA660A661A674-A67BA698-A69FA6F8-A6FFA78D-A7FAA82C-A82FA83A-A83FA878-A87FA8C5-A8CDA8DA-A8DFA8FC-A8FFA954-A95EA97D-A97FA9CEA9DA-A9DDA9E0-A9FFAA37-AA3FAA4EAA4FAA5AAA5BAA7C-AA7FAAC3-AADAAAE0-ABBFABEEABEFABFA-ABFFD7A4-D7AFD7C7-D7CAD7FC-F8FFFA2EFA2FFA6EFA6FFADA-FAFFFB07-FB12FB18-FB1CFB37FB3DFB3FFB42FB45FBB2-FBD2FD40-FD4FFD90FD91FDC8-FDEFFDFEFDFFFE1A-FE1FFE27-FE2FFE53FE67FE6C-FE6FFE75FEFD-FF00FFBF-FFC1FFC8FFC9FFD0FFD1FFD8FFD9FFDD-FFDFFFE7FFEF-FFFBFFFEFFFF\",\n Cc: \"0000-001F007F-009F\",\n Cf: \"00AD0600-060306DD070F17B417B5200B-200F202A-202E2060-2064206A-206FFEFFFFF9-FFFB\",\n Co: \"E000-F8FF\",\n Cs: \"D800-DFFF\",\n Cn: \"03780379037F-0383038B038D03A20526-05300557055805600588058B-059005C8-05CF05EB-05EF05F5-05FF06040605061C061D0620065F070E074B074C07B2-07BF07FB-07FF082E082F083F-08FF093A093B094F095609570973-097809800984098D098E0991099209A909B109B3-09B509BA09BB09C509C609C909CA09CF-09D609D8-09DB09DE09E409E509FC-0A000A040A0B-0A0E0A110A120A290A310A340A370A3A0A3B0A3D0A43-0A460A490A4A0A4E-0A500A52-0A580A5D0A5F-0A650A76-0A800A840A8E0A920AA90AB10AB40ABA0ABB0AC60ACA0ACE0ACF0AD1-0ADF0AE40AE50AF00AF2-0B000B040B0D0B0E0B110B120B290B310B340B3A0B3B0B450B460B490B4A0B4E-0B550B58-0B5B0B5E0B640B650B72-0B810B840B8B-0B8D0B910B96-0B980B9B0B9D0BA0-0BA20BA5-0BA70BAB-0BAD0BBA-0BBD0BC3-0BC50BC90BCE0BCF0BD1-0BD60BD8-0BE50BFB-0C000C040C0D0C110C290C340C3A-0C3C0C450C490C4E-0C540C570C5A-0C5F0C640C650C70-0C770C800C810C840C8D0C910CA90CB40CBA0CBB0CC50CC90CCE-0CD40CD7-0CDD0CDF0CE40CE50CF00CF3-0D010D040D0D0D110D290D3A-0D3C0D450D490D4E-0D560D58-0D5F0D640D650D76-0D780D800D810D840D97-0D990DB20DBC0DBE0DBF0DC7-0DC90DCB-0DCE0DD50DD70DE0-0DF10DF5-0E000E3B-0E3E0E5C-0E800E830E850E860E890E8B0E8C0E8E-0E930E980EA00EA40EA60EA80EA90EAC0EBA0EBE0EBF0EC50EC70ECE0ECF0EDA0EDB0EDE-0EFF0F480F6D-0F700F8C-0F8F0F980FBD0FCD0FD9-0FFF10C6-10CF10FD-10FF1249124E124F12571259125E125F1289128E128F12B112B612B712BF12C112C612C712D7131113161317135B-135E137D-137F139A-139F13F5-13FF169D-169F16F1-16FF170D1715-171F1737-173F1754-175F176D17711774-177F17DE17DF17EA-17EF17FA-17FF180F181A-181F1878-187F18AB-18AF18F6-18FF191D-191F192C-192F193C-193F1941-1943196E196F1975-197F19AC-19AF19CA-19CF19DB-19DD1A1C1A1D1A5F1A7D1A7E1A8A-1A8F1A9A-1A9F1AAE-1AFF1B4C-1B4F1B7D-1B7F1BAB-1BAD1BBA-1BFF1C38-1C3A1C4A-1C4C1C80-1CCF1CF3-1CFF1DE7-1DFC1F161F171F1E1F1F1F461F471F4E1F4F1F581F5A1F5C1F5E1F7E1F7F1FB51FC51FD41FD51FDC1FF01FF11FF51FFF2065-206920722073208F2095-209F20B9-20CF20F1-20FF218A-218F23E9-23FF2427-243F244B-245F26CE26E226E4-26E727002705270A270B2728274C274E2753-2755275F27602795-279727B027BF27CB27CD-27CF2B4D-2B4F2B5A-2BFF2C2F2C5F2CF2-2CF82D26-2D2F2D66-2D6E2D70-2D7F2D97-2D9F2DA72DAF2DB72DBF2DC72DCF2DD72DDF2E32-2E7F2E9A2EF4-2EFF2FD6-2FEF2FFC-2FFF3040309730983100-3104312E-3130318F31B8-31BF31E4-31EF321F32FF4DB6-4DBF9FCC-9FFFA48D-A48FA4C7-A4CFA62C-A63FA660A661A674-A67BA698-A69FA6F8-A6FFA78D-A7FAA82C-A82FA83A-A83FA878-A87FA8C5-A8CDA8DA-A8DFA8FC-A8FFA954-A95EA97D-A97FA9CEA9DA-A9DDA9E0-A9FFAA37-AA3FAA4EAA4FAA5AAA5BAA7C-AA7FAAC3-AADAAAE0-ABBFABEEABEFABFA-ABFFD7A4-D7AFD7C7-D7CAD7FC-D7FFFA2EFA2FFA6EFA6FFADA-FAFFFB07-FB12FB18-FB1CFB37FB3DFB3FFB42FB45FBB2-FBD2FD40-FD4FFD90FD91FDC8-FDEFFDFEFDFFFE1A-FE1FFE27-FE2FFE53FE67FE6C-FE6FFE75FEFDFEFEFF00FFBF-FFC1FFC8FFC9FFD0FFD1FFD8FFD9FFDD-FFDFFFE7FFEF-FFF8FFFEFFFF\"\n});\n\nfunction addUnicodePackage (pack) {\n var codePoint = /\\w{4}/g;\n for (var name in pack)\n exports.packages[name] = pack[name].replace(codePoint, \"\\\\u$&\");\n}\n\n});\n\nace.define(\"ace/mode/text\",[\"require\",\"exports\",\"module\",\"ace/tokenizer\",\"ace/mode/text_highlight_rules\",\"ace/mode/behaviour/cstyle\",\"ace/unicode\",\"ace/lib/lang\",\"ace/token_iterator\",\"ace/range\"], function(acequire, exports, module) {\n\"use strict\";\n\nvar Tokenizer = acequire(\"../tokenizer\").Tokenizer;\nvar TextHighlightRules = acequire(\"./text_highlight_rules\").TextHighlightRules;\nvar CstyleBehaviour = acequire(\"./behaviour/cstyle\").CstyleBehaviour;\nvar unicode = acequire(\"../unicode\");\nvar lang = acequire(\"../lib/lang\");\nvar TokenIterator = acequire(\"../token_iterator\").TokenIterator;\nvar Range = acequire(\"../range\").Range;\n\nvar Mode = function() {\n this.HighlightRules = TextHighlightRules;\n};\n\n(function() {\n this.$defaultBehaviour = new CstyleBehaviour();\n\n this.tokenRe = new RegExp(\"^[\"\n + unicode.packages.L\n + unicode.packages.Mn + unicode.packages.Mc\n + unicode.packages.Nd\n + unicode.packages.Pc + \"\\\\$_]+\", \"g\"\n );\n\n this.nonTokenRe = new RegExp(\"^(?:[^\"\n + unicode.packages.L\n + unicode.packages.Mn + unicode.packages.Mc\n + unicode.packages.Nd\n + unicode.packages.Pc + \"\\\\$_]|\\\\s])+\", \"g\"\n );\n\n this.getTokenizer = function() {\n if (!this.$tokenizer) {\n this.$highlightRules = this.$highlightRules || new this.HighlightRules(this.$highlightRuleConfig);\n this.$tokenizer = new Tokenizer(this.$highlightRules.getRules());\n }\n return this.$tokenizer;\n };\n\n this.lineCommentStart = \"\";\n this.blockComment = \"\";\n\n this.toggleCommentLines = function(state, session, startRow, endRow) {\n var doc = session.doc;\n\n var ignoreBlankLines = true;\n var shouldRemove = true;\n var minIndent = Infinity;\n var tabSize = session.getTabSize();\n var insertAtTabStop = false;\n\n if (!this.lineCommentStart) {\n if (!this.blockComment)\n return false;\n var lineCommentStart = this.blockComment.start;\n var lineCommentEnd = this.blockComment.end;\n var regexpStart = new RegExp(\"^(\\\\s*)(?:\" + lang.escapeRegExp(lineCommentStart) + \")\");\n var regexpEnd = new RegExp(\"(?:\" + lang.escapeRegExp(lineCommentEnd) + \")\\\\s*$\");\n\n var comment = function(line, i) {\n if (testRemove(line, i))\n return;\n if (!ignoreBlankLines || /\\S/.test(line)) {\n doc.insertInLine({row: i, column: line.length}, lineCommentEnd);\n doc.insertInLine({row: i, column: minIndent}, lineCommentStart);\n }\n };\n\n var uncomment = function(line, i) {\n var m;\n if (m = line.match(regexpEnd))\n doc.removeInLine(i, line.length - m[0].length, line.length);\n if (m = line.match(regexpStart))\n doc.removeInLine(i, m[1].length, m[0].length);\n };\n\n var testRemove = function(line, row) {\n if (regexpStart.test(line))\n return true;\n var tokens = session.getTokens(row);\n for (var i = 0; i < tokens.length; i++) {\n if (tokens[i].type === \"comment\")\n return true;\n }\n };\n } else {\n if (Array.isArray(this.lineCommentStart)) {\n var regexpStart = this.lineCommentStart.map(lang.escapeRegExp).join(\"|\");\n var lineCommentStart = this.lineCommentStart[0];\n } else {\n var regexpStart = lang.escapeRegExp(this.lineCommentStart);\n var lineCommentStart = this.lineCommentStart;\n }\n regexpStart = new RegExp(\"^(\\\\s*)(?:\" + regexpStart + \") ?\");\n \n insertAtTabStop = session.getUseSoftTabs();\n\n var uncomment = function(line, i) {\n var m = line.match(regexpStart);\n if (!m) return;\n var start = m[1].length, end = m[0].length;\n if (!shouldInsertSpace(line, start, end) && m[0][end - 1] == \" \")\n end--;\n doc.removeInLine(i, start, end);\n };\n var commentWithSpace = lineCommentStart + \" \";\n var comment = function(line, i) {\n if (!ignoreBlankLines || /\\S/.test(line)) {\n if (shouldInsertSpace(line, minIndent, minIndent))\n doc.insertInLine({row: i, column: minIndent}, commentWithSpace);\n else\n doc.insertInLine({row: i, column: minIndent}, lineCommentStart);\n }\n };\n var testRemove = function(line, i) {\n return regexpStart.test(line);\n };\n \n var shouldInsertSpace = function(line, before, after) {\n var spaces = 0;\n while (before-- && line.charAt(before) == \" \")\n spaces++;\n if (spaces % tabSize != 0)\n return false;\n var spaces = 0;\n while (line.charAt(after++) == \" \")\n spaces++;\n if (tabSize > 2)\n return spaces % tabSize != tabSize - 1;\n else\n return spaces % tabSize == 0;\n return true;\n };\n }\n\n function iter(fun) {\n for (var i = startRow; i <= endRow; i++)\n fun(doc.getLine(i), i);\n }\n\n\n var minEmptyLength = Infinity;\n iter(function(line, i) {\n var indent = line.search(/\\S/);\n if (indent !== -1) {\n if (indent < minIndent)\n minIndent = indent;\n if (shouldRemove && !testRemove(line, i))\n shouldRemove = false;\n } else if (minEmptyLength > line.length) {\n minEmptyLength = line.length;\n }\n });\n\n if (minIndent == Infinity) {\n minIndent = minEmptyLength;\n ignoreBlankLines = false;\n shouldRemove = false;\n }\n\n if (insertAtTabStop && minIndent % tabSize != 0)\n minIndent = Math.floor(minIndent / tabSize) * tabSize;\n\n iter(shouldRemove ? uncomment : comment);\n };\n\n this.toggleBlockComment = function(state, session, range, cursor) {\n var comment = this.blockComment;\n if (!comment)\n return;\n if (!comment.start && comment[0])\n comment = comment[0];\n\n var iterator = new TokenIterator(session, cursor.row, cursor.column);\n var token = iterator.getCurrentToken();\n\n var sel = session.selection;\n var initialRange = session.selection.toOrientedRange();\n var startRow, colDiff;\n\n if (token && /comment/.test(token.type)) {\n var startRange, endRange;\n while (token && /comment/.test(token.type)) {\n var i = token.value.indexOf(comment.start);\n if (i != -1) {\n var row = iterator.getCurrentTokenRow();\n var column = iterator.getCurrentTokenColumn() + i;\n startRange = new Range(row, column, row, column + comment.start.length);\n break;\n }\n token = iterator.stepBackward();\n }\n\n var iterator = new TokenIterator(session, cursor.row, cursor.column);\n var token = iterator.getCurrentToken();\n while (token && /comment/.test(token.type)) {\n var i = token.value.indexOf(comment.end);\n if (i != -1) {\n var row = iterator.getCurrentTokenRow();\n var column = iterator.getCurrentTokenColumn() + i;\n endRange = new Range(row, column, row, column + comment.end.length);\n break;\n }\n token = iterator.stepForward();\n }\n if (endRange)\n session.remove(endRange);\n if (startRange) {\n session.remove(startRange);\n startRow = startRange.start.row;\n colDiff = -comment.start.length;\n }\n } else {\n colDiff = comment.start.length;\n startRow = range.start.row;\n session.insert(range.end, comment.end);\n session.insert(range.start, comment.start);\n }\n if (initialRange.start.row == startRow)\n initialRange.start.column += colDiff;\n if (initialRange.end.row == startRow)\n initialRange.end.column += colDiff;\n session.selection.fromOrientedRange(initialRange);\n };\n\n this.getNextLineIndent = function(state, line, tab) {\n return this.$getIndent(line);\n };\n\n this.checkOutdent = function(state, line, input) {\n return false;\n };\n\n this.autoOutdent = function(state, doc, row) {\n };\n\n this.$getIndent = function(line) {\n return line.match(/^\\s*/)[0];\n };\n\n this.createWorker = function(session) {\n return null;\n };\n\n this.createModeDelegates = function (mapping) {\n this.$embeds = [];\n this.$modes = {};\n for (var i in mapping) {\n if (mapping[i]) {\n this.$embeds.push(i);\n this.$modes[i] = new mapping[i]();\n }\n }\n\n var delegations = [\"toggleBlockComment\", \"toggleCommentLines\", \"getNextLineIndent\", \n \"checkOutdent\", \"autoOutdent\", \"transformAction\", \"getCompletions\"];\n\n for (var i = 0; i < delegations.length; i++) {\n (function(scope) {\n var functionName = delegations[i];\n var defaultHandler = scope[functionName];\n scope[delegations[i]] = function() {\n return this.$delegator(functionName, arguments, defaultHandler);\n };\n }(this));\n }\n };\n\n this.$delegator = function(method, args, defaultHandler) {\n var state = args[0];\n if (typeof state != \"string\")\n state = state[0];\n for (var i = 0; i < this.$embeds.length; i++) {\n if (!this.$modes[this.$embeds[i]]) continue;\n\n var split = state.split(this.$embeds[i]);\n if (!split[0] && split[1]) {\n args[0] = split[1];\n var mode = this.$modes[this.$embeds[i]];\n return mode[method].apply(mode, args);\n }\n }\n var ret = defaultHandler.apply(this, args);\n return defaultHandler ? ret : undefined;\n };\n\n this.transformAction = function(state, action, editor, session, param) {\n if (this.$behaviour) {\n var behaviours = this.$behaviour.getBehaviours();\n for (var key in behaviours) {\n if (behaviours[key][action]) {\n var ret = behaviours[key][action].apply(this, arguments);\n if (ret) {\n return ret;\n }\n }\n }\n }\n };\n \n this.getKeywords = function(append) {\n if (!this.completionKeywords) {\n var rules = this.$tokenizer.rules;\n var completionKeywords = [];\n for (var rule in rules) {\n var ruleItr = rules[rule];\n for (var r = 0, l = ruleItr.length; r < l; r++) {\n if (typeof ruleItr[r].token === \"string\") {\n if (/keyword|support|storage/.test(ruleItr[r].token))\n completionKeywords.push(ruleItr[r].regex);\n }\n else if (typeof ruleItr[r].token === \"object\") {\n for (var a = 0, aLength = ruleItr[r].token.length; a < aLength; a++) { \n if (/keyword|support|storage/.test(ruleItr[r].token[a])) {\n var rule = ruleItr[r].regex.match(/\\(.+?\\)/g)[a];\n completionKeywords.push(rule.substr(1, rule.length - 2));\n }\n }\n }\n }\n }\n this.completionKeywords = completionKeywords;\n }\n if (!append)\n return this.$keywordList;\n return completionKeywords.concat(this.$keywordList || []);\n };\n \n this.$createKeywordList = function() {\n if (!this.$highlightRules)\n this.getTokenizer();\n return this.$keywordList = this.$highlightRules.$keywordList || [];\n };\n\n this.getCompletions = function(state, session, pos, prefix) {\n var keywords = this.$keywordList || this.$createKeywordList();\n return keywords.map(function(word) {\n return {\n name: word,\n value: word,\n score: 0,\n meta: \"keyword\"\n };\n });\n };\n\n this.$id = \"ace/mode/text\";\n}).call(Mode.prototype);\n\nexports.Mode = Mode;\n});\n\nace.define(\"ace/apply_delta\",[\"require\",\"exports\",\"module\"], function(acequire, exports, module) {\n\"use strict\";\n\nfunction throwDeltaError(delta, errorText){\n console.log(\"Invalid Delta:\", delta);\n throw \"Invalid Delta: \" + errorText;\n}\n\nfunction positionInDocument(docLines, position) {\n return position.row >= 0 && position.row < docLines.length &&\n position.column >= 0 && position.column <= docLines[position.row].length;\n}\n\nfunction validateDelta(docLines, delta) {\n if (delta.action != \"insert\" && delta.action != \"remove\")\n throwDeltaError(delta, \"delta.action must be 'insert' or 'remove'\");\n if (!(delta.lines instanceof Array))\n throwDeltaError(delta, \"delta.lines must be an Array\");\n if (!delta.start || !delta.end)\n throwDeltaError(delta, \"delta.start/end must be an present\");\n var start = delta.start;\n if (!positionInDocument(docLines, delta.start))\n throwDeltaError(delta, \"delta.start must be contained in document\");\n var end = delta.end;\n if (delta.action == \"remove\" && !positionInDocument(docLines, end))\n throwDeltaError(delta, \"delta.end must contained in document for 'remove' actions\");\n var numRangeRows = end.row - start.row;\n var numRangeLastLineChars = (end.column - (numRangeRows == 0 ? start.column : 0));\n if (numRangeRows != delta.lines.length - 1 || delta.lines[numRangeRows].length != numRangeLastLineChars)\n throwDeltaError(delta, \"delta.range must match delta lines\");\n}\n\nexports.applyDelta = function(docLines, delta, doNotValidate) {\n \n var row = delta.start.row;\n var startColumn = delta.start.column;\n var line = docLines[row] || \"\";\n switch (delta.action) {\n case \"insert\":\n var lines = delta.lines;\n if (lines.length === 1) {\n docLines[row] = line.substring(0, startColumn) + delta.lines[0] + line.substring(startColumn);\n } else {\n var args = [row, 1].concat(delta.lines);\n docLines.splice.apply(docLines, args);\n docLines[row] = line.substring(0, startColumn) + docLines[row];\n docLines[row + delta.lines.length - 1] += line.substring(startColumn);\n }\n break;\n case \"remove\":\n var endColumn = delta.end.column;\n var endRow = delta.end.row;\n if (row === endRow) {\n docLines[row] = line.substring(0, startColumn) + line.substring(endColumn);\n } else {\n docLines.splice(\n row, endRow - row + 1,\n line.substring(0, startColumn) + docLines[endRow].substring(endColumn)\n );\n }\n break;\n }\n};\n});\n\nace.define(\"ace/anchor\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/event_emitter\"], function(acequire, exports, module) {\n\"use strict\";\n\nvar oop = acequire(\"./lib/oop\");\nvar EventEmitter = acequire(\"./lib/event_emitter\").EventEmitter;\n\nvar Anchor = exports.Anchor = function(doc, row, column) {\n this.$onChange = this.onChange.bind(this);\n this.attach(doc);\n \n if (typeof column == \"undefined\")\n this.setPosition(row.row, row.column);\n else\n this.setPosition(row, column);\n};\n\n(function() {\n\n oop.implement(this, EventEmitter);\n this.getPosition = function() {\n return this.$clipPositionToDocument(this.row, this.column);\n };\n this.getDocument = function() {\n return this.document;\n };\n this.$insertRight = false;\n this.onChange = function(delta) {\n if (delta.start.row == delta.end.row && delta.start.row != this.row)\n return;\n\n if (delta.start.row > this.row)\n return;\n \n var point = $getTransformedPoint(delta, {row: this.row, column: this.column}, this.$insertRight);\n this.setPosition(point.row, point.column, true);\n };\n \n function $pointsInOrder(point1, point2, equalPointsInOrder) {\n var bColIsAfter = equalPointsInOrder ? point1.column <= point2.column : point1.column < point2.column;\n return (point1.row < point2.row) || (point1.row == point2.row && bColIsAfter);\n }\n \n function $getTransformedPoint(delta, point, moveIfEqual) {\n var deltaIsInsert = delta.action == \"insert\";\n var deltaRowShift = (deltaIsInsert ? 1 : -1) * (delta.end.row - delta.start.row);\n var deltaColShift = (deltaIsInsert ? 1 : -1) * (delta.end.column - delta.start.column);\n var deltaStart = delta.start;\n var deltaEnd = deltaIsInsert ? deltaStart : delta.end; // Collapse insert range.\n if ($pointsInOrder(point, deltaStart, moveIfEqual)) {\n return {\n row: point.row,\n column: point.column\n };\n }\n if ($pointsInOrder(deltaEnd, point, !moveIfEqual)) {\n return {\n row: point.row + deltaRowShift,\n column: point.column + (point.row == deltaEnd.row ? deltaColShift : 0)\n };\n }\n \n return {\n row: deltaStart.row,\n column: deltaStart.column\n };\n }\n this.setPosition = function(row, column, noClip) {\n var pos;\n if (noClip) {\n pos = {\n row: row,\n column: column\n };\n } else {\n pos = this.$clipPositionToDocument(row, column);\n }\n\n if (this.row == pos.row && this.column == pos.column)\n return;\n\n var old = {\n row: this.row,\n column: this.column\n };\n\n this.row = pos.row;\n this.column = pos.column;\n this._signal(\"change\", {\n old: old,\n value: pos\n });\n };\n this.detach = function() {\n this.document.removeEventListener(\"change\", this.$onChange);\n };\n this.attach = function(doc) {\n this.document = doc || this.document;\n this.document.on(\"change\", this.$onChange);\n };\n this.$clipPositionToDocument = function(row, column) {\n var pos = {};\n\n if (row >= this.document.getLength()) {\n pos.row = Math.max(0, this.document.getLength() - 1);\n pos.column = this.document.getLine(pos.row).length;\n }\n else if (row < 0) {\n pos.row = 0;\n pos.column = 0;\n }\n else {\n pos.row = row;\n pos.column = Math.min(this.document.getLine(pos.row).length, Math.max(0, column));\n }\n\n if (column < 0)\n pos.column = 0;\n\n return pos;\n };\n\n}).call(Anchor.prototype);\n\n});\n\nace.define(\"ace/document\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/apply_delta\",\"ace/lib/event_emitter\",\"ace/range\",\"ace/anchor\"], function(acequire, exports, module) {\n\"use strict\";\n\nvar oop = acequire(\"./lib/oop\");\nvar applyDelta = acequire(\"./apply_delta\").applyDelta;\nvar EventEmitter = acequire(\"./lib/event_emitter\").EventEmitter;\nvar Range = acequire(\"./range\").Range;\nvar Anchor = acequire(\"./anchor\").Anchor;\n\nvar Document = function(textOrLines) {\n this.$lines = [\"\"];\n if (textOrLines.length === 0) {\n this.$lines = [\"\"];\n } else if (Array.isArray(textOrLines)) {\n this.insertMergedLines({row: 0, column: 0}, textOrLines);\n } else {\n this.insert({row: 0, column:0}, textOrLines);\n }\n};\n\n(function() {\n\n oop.implement(this, EventEmitter);\n this.setValue = function(text) {\n var len = this.getLength() - 1;\n this.remove(new Range(0, 0, len, this.getLine(len).length));\n this.insert({row: 0, column: 0}, text);\n };\n this.getValue = function() {\n return this.getAllLines().join(this.getNewLineCharacter());\n };\n this.createAnchor = function(row, column) {\n return new Anchor(this, row, column);\n };\n if (\"aaa\".split(/a/).length === 0) {\n this.$split = function(text) {\n return text.replace(/\\r\\n|\\r/g, \"\\n\").split(\"\\n\");\n };\n } else {\n this.$split = function(text) {\n return text.split(/\\r\\n|\\r|\\n/);\n };\n }\n\n\n this.$detectNewLine = function(text) {\n var match = text.match(/^.*?(\\r\\n|\\r|\\n)/m);\n this.$autoNewLine = match ? match[1] : \"\\n\";\n this._signal(\"changeNewLineMode\");\n };\n this.getNewLineCharacter = function() {\n switch (this.$newLineMode) {\n case \"windows\":\n return \"\\r\\n\";\n case \"unix\":\n return \"\\n\";\n default:\n return this.$autoNewLine || \"\\n\";\n }\n };\n\n this.$autoNewLine = \"\";\n this.$newLineMode = \"auto\";\n this.setNewLineMode = function(newLineMode) {\n if (this.$newLineMode === newLineMode)\n return;\n\n this.$newLineMode = newLineMode;\n this._signal(\"changeNewLineMode\");\n };\n this.getNewLineMode = function() {\n return this.$newLineMode;\n };\n this.isNewLine = function(text) {\n return (text == \"\\r\\n\" || text == \"\\r\" || text == \"\\n\");\n };\n this.getLine = function(row) {\n return this.$lines[row] || \"\";\n };\n this.getLines = function(firstRow, lastRow) {\n return this.$lines.slice(firstRow, lastRow + 1);\n };\n this.getAllLines = function() {\n return this.getLines(0, this.getLength());\n };\n this.getLength = function() {\n return this.$lines.length;\n };\n this.getTextRange = function(range) {\n return this.getLinesForRange(range).join(this.getNewLineCharacter());\n };\n this.getLinesForRange = function(range) {\n var lines;\n if (range.start.row === range.end.row) {\n lines = [this.getLine(range.start.row).substring(range.start.column, range.end.column)];\n } else {\n lines = this.getLines(range.start.row, range.end.row);\n lines[0] = (lines[0] || \"\").substring(range.start.column);\n var l = lines.length - 1;\n if (range.end.row - range.start.row == l)\n lines[l] = lines[l].substring(0, range.end.column);\n }\n return lines;\n };\n this.insertLines = function(row, lines) {\n console.warn(\"Use of document.insertLines is deprecated. Use the insertFullLines method instead.\");\n return this.insertFullLines(row, lines);\n };\n this.removeLines = function(firstRow, lastRow) {\n console.warn(\"Use of document.removeLines is deprecated. Use the removeFullLines method instead.\");\n return this.removeFullLines(firstRow, lastRow);\n };\n this.insertNewLine = function(position) {\n console.warn(\"Use of document.insertNewLine is deprecated. Use insertMergedLines(position, ['', '']) instead.\");\n return this.insertMergedLines(position, [\"\", \"\"]);\n };\n this.insert = function(position, text) {\n if (this.getLength() <= 1)\n this.$detectNewLine(text);\n \n return this.insertMergedLines(position, this.$split(text));\n };\n this.insertInLine = function(position, text) {\n var start = this.clippedPos(position.row, position.column);\n var end = this.pos(position.row, position.column + text.length);\n \n this.applyDelta({\n start: start,\n end: end,\n action: \"insert\",\n lines: [text]\n }, true);\n \n return this.clonePos(end);\n };\n \n this.clippedPos = function(row, column) {\n var length = this.getLength();\n if (row === undefined) {\n row = length;\n } else if (row < 0) {\n row = 0;\n } else if (row >= length) {\n row = length - 1;\n column = undefined;\n }\n var line = this.getLine(row);\n if (column == undefined)\n column = line.length;\n column = Math.min(Math.max(column, 0), line.length);\n return {row: row, column: column};\n };\n \n this.clonePos = function(pos) {\n return {row: pos.row, column: pos.column};\n };\n \n this.pos = function(row, column) {\n return {row: row, column: column};\n };\n \n this.$clipPosition = function(position) {\n var length = this.getLength();\n if (position.row >= length) {\n position.row = Math.max(0, length - 1);\n position.column = this.getLine(length - 1).length;\n } else {\n position.row = Math.max(0, position.row);\n position.column = Math.min(Math.max(position.column, 0), this.getLine(position.row).length);\n }\n return position;\n };\n this.insertFullLines = function(row, lines) {\n row = Math.min(Math.max(row, 0), this.getLength());\n var column = 0;\n if (row < this.getLength()) {\n lines = lines.concat([\"\"]);\n column = 0;\n } else {\n lines = [\"\"].concat(lines);\n row--;\n column = this.$lines[row].length;\n }\n this.insertMergedLines({row: row, column: column}, lines);\n }; \n this.insertMergedLines = function(position, lines) {\n var start = this.clippedPos(position.row, position.column);\n var end = {\n row: start.row + lines.length - 1,\n column: (lines.length == 1 ? start.column : 0) + lines[lines.length - 1].length\n };\n \n this.applyDelta({\n start: start,\n end: end,\n action: \"insert\",\n lines: lines\n });\n \n return this.clonePos(end);\n };\n this.remove = function(range) {\n var start = this.clippedPos(range.start.row, range.start.column);\n var end = this.clippedPos(range.end.row, range.end.column);\n this.applyDelta({\n start: start,\n end: end,\n action: \"remove\",\n lines: this.getLinesForRange({start: start, end: end})\n });\n return this.clonePos(start);\n };\n this.removeInLine = function(row, startColumn, endColumn) {\n var start = this.clippedPos(row, startColumn);\n var end = this.clippedPos(row, endColumn);\n \n this.applyDelta({\n start: start,\n end: end,\n action: \"remove\",\n lines: this.getLinesForRange({start: start, end: end})\n }, true);\n \n return this.clonePos(start);\n };\n this.removeFullLines = function(firstRow, lastRow) {\n firstRow = Math.min(Math.max(0, firstRow), this.getLength() - 1);\n lastRow = Math.min(Math.max(0, lastRow ), this.getLength() - 1);\n var deleteFirstNewLine = lastRow == this.getLength() - 1 && firstRow > 0;\n var deleteLastNewLine = lastRow < this.getLength() - 1;\n var startRow = ( deleteFirstNewLine ? firstRow - 1 : firstRow );\n var startCol = ( deleteFirstNewLine ? this.getLine(startRow).length : 0 );\n var endRow = ( deleteLastNewLine ? lastRow + 1 : lastRow );\n var endCol = ( deleteLastNewLine ? 0 : this.getLine(endRow).length ); \n var range = new Range(startRow, startCol, endRow, endCol);\n var deletedLines = this.$lines.slice(firstRow, lastRow + 1);\n \n this.applyDelta({\n start: range.start,\n end: range.end,\n action: \"remove\",\n lines: this.getLinesForRange(range)\n });\n return deletedLines;\n };\n this.removeNewLine = function(row) {\n if (row < this.getLength() - 1 && row >= 0) {\n this.applyDelta({\n start: this.pos(row, this.getLine(row).length),\n end: this.pos(row + 1, 0),\n action: \"remove\",\n lines: [\"\", \"\"]\n });\n }\n };\n this.replace = function(range, text) {\n if (!(range instanceof Range))\n range = Range.fromPoints(range.start, range.end);\n if (text.length === 0 && range.isEmpty())\n return range.start;\n if (text == this.getTextRange(range))\n return range.end;\n\n this.remove(range);\n var end;\n if (text) {\n end = this.insert(range.start, text);\n }\n else {\n end = range.start;\n }\n \n return end;\n };\n this.applyDeltas = function(deltas) {\n for (var i=0; i<deltas.length; i++) {\n this.applyDelta(deltas[i]);\n }\n };\n this.revertDeltas = function(deltas) {\n for (var i=deltas.length-1; i>=0; i--) {\n this.revertDelta(deltas[i]);\n }\n };\n this.applyDelta = function(delta, doNotValidate) {\n var isInsert = delta.action == \"insert\";\n if (isInsert ? delta.lines.length <= 1 && !delta.lines[0]\n : !Range.comparePoints(delta.start, delta.end)) {\n return;\n }\n \n if (isInsert && delta.lines.length > 20000)\n this.$splitAndapplyLargeDelta(delta, 20000);\n applyDelta(this.$lines, delta, doNotValidate);\n this._signal(\"change\", delta);\n };\n \n this.$splitAndapplyLargeDelta = function(delta, MAX) {\n var lines = delta.lines;\n var l = lines.length;\n var row = delta.start.row; \n var column = delta.start.column;\n var from = 0, to = 0;\n do {\n from = to;\n to += MAX - 1;\n var chunk = lines.slice(from, to);\n if (to > l) {\n delta.lines = chunk;\n delta.start.row = row + from;\n delta.start.column = column;\n break;\n }\n chunk.push(\"\");\n this.applyDelta({\n start: this.pos(row + from, column),\n end: this.pos(row + to, column = 0),\n action: delta.action,\n lines: chunk\n }, true);\n } while(true);\n };\n this.revertDelta = function(delta) {\n this.applyDelta({\n start: this.clonePos(delta.start),\n end: this.clonePos(delta.end),\n action: (delta.action == \"insert\" ? \"remove\" : \"insert\"),\n lines: delta.lines.slice()\n });\n };\n this.indexToPosition = function(index, startRow) {\n var lines = this.$lines || this.getAllLines();\n var newlineLength = this.getNewLineCharacter().length;\n for (var i = startRow || 0, l = lines.length; i < l; i++) {\n index -= lines[i].length + newlineLength;\n if (index < 0)\n return {row: i, column: index + lines[i].length + newlineLength};\n }\n return {row: l-1, column: lines[l-1].length};\n };\n this.positionToIndex = function(pos, startRow) {\n var lines = this.$lines || this.getAllLines();\n var newlineLength = this.getNewLineCharacter().length;\n var index = 0;\n var row = Math.min(pos.row, lines.length);\n for (var i = startRow || 0; i < row; ++i)\n index += lines[i].length + newlineLength;\n\n return index + pos.column;\n };\n\n}).call(Document.prototype);\n\nexports.Document = Document;\n});\n\nace.define(\"ace/background_tokenizer\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/event_emitter\"], function(acequire, exports, module) {\n\"use strict\";\n\nvar oop = acequire(\"./lib/oop\");\nvar EventEmitter = acequire(\"./lib/event_emitter\").EventEmitter;\n\nvar BackgroundTokenizer = function(tokenizer, editor) {\n this.running = false;\n this.lines = [];\n this.states = [];\n this.currentLine = 0;\n this.tokenizer = tokenizer;\n\n var self = this;\n\n this.$worker = function() {\n if (!self.running) { return; }\n\n var workerStart = new Date();\n var currentLine = self.currentLine;\n var endLine = -1;\n var doc = self.doc;\n\n var startLine = currentLine;\n while (self.lines[currentLine])\n currentLine++;\n \n var len = doc.getLength();\n var processedLines = 0;\n self.running = false;\n while (currentLine < len) {\n self.$tokenizeRow(currentLine);\n endLine = currentLine;\n do {\n currentLine++;\n } while (self.lines[currentLine]);\n processedLines ++;\n if ((processedLines % 5 === 0) && (new Date() - workerStart) > 20) { \n self.running = setTimeout(self.$worker, 20);\n break;\n }\n }\n self.currentLine = currentLine;\n \n if (endLine == -1)\n endLine = currentLine;\n\n if (startLine <= endLine)\n self.fireUpdateEvent(startLine, endLine);\n };\n};\n\n(function(){\n\n oop.implement(this, EventEmitter);\n this.setTokenizer = function(tokenizer) {\n this.tokenizer = tokenizer;\n this.lines = [];\n this.states = [];\n\n this.start(0);\n };\n this.setDocument = function(doc) {\n this.doc = doc;\n this.lines = [];\n this.states = [];\n\n this.stop();\n };\n this.fireUpdateEvent = function(firstRow, lastRow) {\n var data = {\n first: firstRow,\n last: lastRow\n };\n this._signal(\"update\", {data: data});\n };\n this.start = function(startRow) {\n this.currentLine = Math.min(startRow || 0, this.currentLine, this.doc.getLength());\n this.lines.splice(this.currentLine, this.lines.length);\n this.states.splice(this.currentLine, this.states.length);\n\n this.stop();\n this.running = setTimeout(this.$worker, 700);\n };\n \n this.scheduleStart = function() {\n if (!this.running)\n this.running = setTimeout(this.$worker, 700);\n };\n\n this.$updateOnChange = function(delta) {\n var startRow = delta.start.row;\n var len = delta.end.row - startRow;\n\n if (len === 0) {\n this.lines[startRow] = null;\n } else if (delta.action == \"remove\") {\n this.lines.splice(startRow, len + 1, null);\n this.states.splice(startRow, len + 1, null);\n } else {\n var args = Array(len + 1);\n args.unshift(startRow, 1);\n this.lines.splice.apply(this.lines, args);\n this.states.splice.apply(this.states, args);\n }\n\n this.currentLine = Math.min(startRow, this.currentLine, this.doc.getLength());\n\n this.stop();\n };\n this.stop = function() {\n if (this.running)\n clearTimeout(this.running);\n this.running = false;\n };\n this.getTokens = function(row) {\n return this.lines[row] || this.$tokenizeRow(row);\n };\n this.getState = function(row) {\n if (this.currentLine == row)\n this.$tokenizeRow(row);\n return this.states[row] || \"start\";\n };\n\n this.$tokenizeRow = function(row) {\n var line = this.doc.getLine(row);\n var state = this.states[row - 1];\n\n var data = this.tokenizer.getLineTokens(line, state, row);\n\n if (this.states[row] + \"\" !== data.state + \"\") {\n this.states[row] = data.state;\n this.lines[row + 1] = null;\n if (this.currentLine > row + 1)\n this.currentLine = row + 1;\n } else if (this.currentLine == row) {\n this.currentLine = row + 1;\n }\n\n return this.lines[row] = data.tokens;\n };\n\n}).call(BackgroundTokenizer.prototype);\n\nexports.BackgroundTokenizer = BackgroundTokenizer;\n});\n\nace.define(\"ace/search_highlight\",[\"require\",\"exports\",\"module\",\"ace/lib/lang\",\"ace/lib/oop\",\"ace/range\"], function(acequire, exports, module) {\n\"use strict\";\n\nvar lang = acequire(\"./lib/lang\");\nvar oop = acequire(\"./lib/oop\");\nvar Range = acequire(\"./range\").Range;\n\nvar SearchHighlight = function(regExp, clazz, type) {\n this.setRegexp(regExp);\n this.clazz = clazz;\n this.type = type || \"text\";\n};\n\n(function() {\n this.MAX_RANGES = 500;\n \n this.setRegexp = function(regExp) {\n if (this.regExp+\"\" == regExp+\"\")\n return;\n this.regExp = regExp;\n this.cache = [];\n };\n\n this.update = function(html, markerLayer, session, config) {\n if (!this.regExp)\n return;\n var start = config.firstRow, end = config.lastRow;\n\n for (var i = start; i <= end; i++) {\n var ranges = this.cache[i];\n if (ranges == null) {\n ranges = lang.getMatchOffsets(session.getLine(i), this.regExp);\n if (ranges.length > this.MAX_RANGES)\n ranges = ranges.slice(0, this.MAX_RANGES);\n ranges = ranges.map(function(match) {\n return new Range(i, match.offset, i, match.offset + match.length);\n });\n this.cache[i] = ranges.length ? ranges : \"\";\n }\n\n for (var j = ranges.length; j --; ) {\n markerLayer.drawSingleLineMarker(\n html, ranges[j].toScreenRange(session), this.clazz, config);\n }\n }\n };\n\n}).call(SearchHighlight.prototype);\n\nexports.SearchHighlight = SearchHighlight;\n});\n\nace.define(\"ace/edit_session/fold_line\",[\"require\",\"exports\",\"module\",\"ace/range\"], function(acequire, exports, module) {\n\"use strict\";\n\nvar Range = acequire(\"../range\").Range;\nfunction FoldLine(foldData, folds) {\n this.foldData = foldData;\n if (Array.isArray(folds)) {\n this.folds = folds;\n } else {\n folds = this.folds = [ folds ];\n }\n\n var last = folds[folds.length - 1];\n this.range = new Range(folds[0].start.row, folds[0].start.column,\n last.end.row, last.end.column);\n this.start = this.range.start;\n this.end = this.range.end;\n\n this.folds.forEach(function(fold) {\n fold.setFoldLine(this);\n }, this);\n}\n\n(function() {\n this.shiftRow = function(shift) {\n this.start.row += shift;\n this.end.row += shift;\n this.folds.forEach(function(fold) {\n fold.start.row += shift;\n fold.end.row += shift;\n });\n };\n\n this.addFold = function(fold) {\n if (fold.sameRow) {\n if (fold.start.row < this.startRow || fold.endRow > this.endRow) {\n throw new Error(\"Can't add a fold to this FoldLine as it has no connection\");\n }\n this.folds.push(fold);\n this.folds.sort(function(a, b) {\n return -a.range.compareEnd(b.start.row, b.start.column);\n });\n if (this.range.compareEnd(fold.start.row, fold.start.column) > 0) {\n this.end.row = fold.end.row;\n this.end.column = fold.end.column;\n } else if (this.range.compareStart(fold.end.row, fold.end.column) < 0) {\n this.start.row = fold.start.row;\n this.start.column = fold.start.column;\n }\n } else if (fold.start.row == this.end.row) {\n this.folds.push(fold);\n this.end.row = fold.end.row;\n this.end.column = fold.end.column;\n } else if (fold.end.row == this.start.row) {\n this.folds.unshift(fold);\n this.start.row = fold.start.row;\n this.start.column = fold.start.column;\n } else {\n throw new Error(\"Trying to add fold to FoldRow that doesn't have a matching row\");\n }\n fold.foldLine = this;\n };\n\n this.containsRow = function(row) {\n return row >= this.start.row && row <= this.end.row;\n };\n\n this.walk = function(callback, endRow, endColumn) {\n var lastEnd = 0,\n folds = this.folds,\n fold,\n cmp, stop, isNewRow = true;\n\n if (endRow == null) {\n endRow = this.end.row;\n endColumn = this.end.column;\n }\n\n for (var i = 0; i < folds.length; i++) {\n fold = folds[i];\n\n cmp = fold.range.compareStart(endRow, endColumn);\n if (cmp == -1) {\n callback(null, endRow, endColumn, lastEnd, isNewRow);\n return;\n }\n\n stop = callback(null, fold.start.row, fold.start.column, lastEnd, isNewRow);\n stop = !stop && callback(fold.placeholder, fold.start.row, fold.start.column, lastEnd);\n if (stop || cmp === 0) {\n return;\n }\n isNewRow = !fold.sameRow;\n lastEnd = fold.end.column;\n }\n callback(null, endRow, endColumn, lastEnd, isNewRow);\n };\n\n this.getNextFoldTo = function(row, column) {\n var fold, cmp;\n for (var i = 0; i < this.folds.length; i++) {\n fold = this.folds[i];\n cmp = fold.range.compareEnd(row, column);\n if (cmp == -1) {\n return {\n fold: fold,\n kind: \"after\"\n };\n } else if (cmp === 0) {\n return {\n fold: fold,\n kind: \"inside\"\n };\n }\n }\n return null;\n };\n\n this.addRemoveChars = function(row, column, len) {\n var ret = this.getNextFoldTo(row, column),\n fold, folds;\n if (ret) {\n fold = ret.fold;\n if (ret.kind == \"inside\"\n && fold.start.column != column\n && fold.start.row != row)\n {\n window.console && window.console.log(row, column, fold);\n } else if (fold.start.row == row) {\n folds = this.folds;\n var i = folds.indexOf(fold);\n if (i === 0) {\n this.start.column += len;\n }\n for (i; i < folds.length; i++) {\n fold = folds[i];\n fold.start.column += len;\n if (!fold.sameRow) {\n return;\n }\n fold.end.column += len;\n }\n this.end.column += len;\n }\n }\n };\n\n this.split = function(row, column) {\n var pos = this.getNextFoldTo(row, column);\n \n if (!pos || pos.kind == \"inside\")\n return null;\n \n var fold = pos.fold;\n var folds = this.folds;\n var foldData = this.foldData;\n \n var i = folds.indexOf(fold);\n var foldBefore = folds[i - 1];\n this.end.row = foldBefore.end.row;\n this.end.column = foldBefore.end.column;\n folds = folds.splice(i, folds.length - i);\n\n var newFoldLine = new FoldLine(foldData, folds);\n foldData.splice(foldData.indexOf(this) + 1, 0, newFoldLine);\n return newFoldLine;\n };\n\n this.merge = function(foldLineNext) {\n var folds = foldLineNext.folds;\n for (var i = 0; i < folds.length; i++) {\n this.addFold(folds[i]);\n }\n var foldData = this.foldData;\n foldData.splice(foldData.indexOf(foldLineNext), 1);\n };\n\n this.toString = function() {\n var ret = [this.range.toString() + \": [\" ];\n\n this.folds.forEach(function(fold) {\n ret.push(\" \" + fold.toString());\n });\n ret.push(\"]\");\n return ret.join(\"\\n\");\n };\n\n this.idxToPosition = function(idx) {\n var lastFoldEndColumn = 0;\n\n for (var i = 0; i < this.folds.length; i++) {\n var fold = this.folds[i];\n\n idx -= fold.start.column - lastFoldEndColumn;\n if (idx < 0) {\n return {\n row: fold.start.row,\n column: fold.start.column + idx\n };\n }\n\n idx -= fold.placeholder.length;\n if (idx < 0) {\n return fold.start;\n }\n\n lastFoldEndColumn = fold.end.column;\n }\n\n return {\n row: this.end.row,\n column: this.end.column + idx\n };\n };\n}).call(FoldLine.prototype);\n\nexports.FoldLine = FoldLine;\n});\n\nace.define(\"ace/range_list\",[\"require\",\"exports\",\"module\",\"ace/range\"], function(acequire, exports, module) {\n\"use strict\";\nvar Range = acequire(\"./range\").Range;\nvar comparePoints = Range.comparePoints;\n\nvar RangeList = function() {\n this.ranges = [];\n};\n\n(function() {\n this.comparePoints = comparePoints;\n\n this.pointIndex = function(pos, excludeEdges, startIndex) {\n var list = this.ranges;\n\n for (var i = startIndex || 0; i < list.length; i++) {\n var range = list[i];\n var cmpEnd = comparePoints(pos, range.end);\n if (cmpEnd > 0)\n continue;\n var cmpStart = comparePoints(pos, range.start);\n if (cmpEnd === 0)\n return excludeEdges && cmpStart !== 0 ? -i-2 : i;\n if (cmpStart > 0 || (cmpStart === 0 && !excludeEdges))\n return i;\n\n return -i-1;\n }\n return -i - 1;\n };\n\n this.add = function(range) {\n var excludeEdges = !range.isEmpty();\n var startIndex = this.pointIndex(range.start, excludeEdges);\n if (startIndex < 0)\n startIndex = -startIndex - 1;\n\n var endIndex = this.pointIndex(range.end, excludeEdges, startIndex);\n\n if (endIndex < 0)\n endIndex = -endIndex - 1;\n else\n endIndex++;\n return this.ranges.splice(startIndex, endIndex - startIndex, range);\n };\n\n this.addList = function(list) {\n var removed = [];\n for (var i = list.length; i--; ) {\n removed.push.apply(removed, this.add(list[i]));\n }\n return removed;\n };\n\n this.substractPoint = function(pos) {\n var i = this.pointIndex(pos);\n\n if (i >= 0)\n return this.ranges.splice(i, 1);\n };\n this.merge = function() {\n var removed = [];\n var list = this.ranges;\n \n list = list.sort(function(a, b) {\n return comparePoints(a.start, b.start);\n });\n \n var next = list[0], range;\n for (var i = 1; i < list.length; i++) {\n range = next;\n next = list[i];\n var cmp = comparePoints(range.end, next.start);\n if (cmp < 0)\n continue;\n\n if (cmp == 0 && !range.isEmpty() && !next.isEmpty())\n continue;\n\n if (comparePoints(range.end, next.end) < 0) {\n range.end.row = next.end.row;\n range.end.column = next.end.column;\n }\n\n list.splice(i, 1);\n removed.push(next);\n next = range;\n i--;\n }\n \n this.ranges = list;\n\n return removed;\n };\n\n this.contains = function(row, column) {\n return this.pointIndex({row: row, column: column}) >= 0;\n };\n\n this.containsPoint = function(pos) {\n return this.pointIndex(pos) >= 0;\n };\n\n this.rangeAtPoint = function(pos) {\n var i = this.pointIndex(pos);\n if (i >= 0)\n return this.ranges[i];\n };\n\n\n this.clipRows = function(startRow, endRow) {\n var list = this.ranges;\n if (list[0].start.row > endRow || list[list.length - 1].start.row < startRow)\n return [];\n\n var startIndex = this.pointIndex({row: startRow, column: 0});\n if (startIndex < 0)\n startIndex = -startIndex - 1;\n var endIndex = this.pointIndex({row: endRow, column: 0}, startIndex);\n if (endIndex < 0)\n endIndex = -endIndex - 1;\n\n var clipped = [];\n for (var i = startIndex; i < endIndex; i++) {\n clipped.push(list[i]);\n }\n return clipped;\n };\n\n this.removeAll = function() {\n return this.ranges.splice(0, this.ranges.length);\n };\n\n this.attach = function(session) {\n if (this.session)\n this.detach();\n\n this.session = session;\n this.onChange = this.$onChange.bind(this);\n\n this.session.on('change', this.onChange);\n };\n\n this.detach = function() {\n if (!this.session)\n return;\n this.session.removeListener('change', this.onChange);\n this.session = null;\n };\n\n this.$onChange = function(delta) {\n if (delta.action == \"insert\"){\n var start = delta.start;\n var end = delta.end;\n } else {\n var end = delta.start;\n var start = delta.end;\n }\n var startRow = start.row;\n var endRow = end.row;\n var lineDif = endRow - startRow;\n\n var colDiff = -start.column + end.column;\n var ranges = this.ranges;\n\n for (var i = 0, n = ranges.length; i < n; i++) {\n var r = ranges[i];\n if (r.end.row < startRow)\n continue;\n if (r.start.row > startRow)\n break;\n\n if (r.start.row == startRow && r.start.column >= start.column ) {\n if (r.start.column == start.column && this.$insertRight) {\n } else {\n r.start.column += colDiff;\n r.start.row += lineDif;\n }\n }\n if (r.end.row == startRow && r.end.column >= start.column) {\n if (r.end.column == start.column && this.$insertRight) {\n continue;\n }\n if (r.end.column == start.column && colDiff > 0 && i < n - 1) { \n if (r.end.column > r.start.column && r.end.column == ranges[i+1].start.column)\n r.end.column -= colDiff;\n }\n r.end.column += colDiff;\n r.end.row += lineDif;\n }\n }\n\n if (lineDif != 0 && i < n) {\n for (; i < n; i++) {\n var r = ranges[i];\n r.start.row += lineDif;\n r.end.row += lineDif;\n }\n }\n };\n\n}).call(RangeList.prototype);\n\nexports.RangeList = RangeList;\n});\n\nace.define(\"ace/edit_session/fold\",[\"require\",\"exports\",\"module\",\"ace/range\",\"ace/range_list\",\"ace/lib/oop\"], function(acequire, exports, module) {\n\"use strict\";\n\nvar Range = acequire(\"../range\").Range;\nvar RangeList = acequire(\"../range_list\").RangeList;\nvar oop = acequire(\"../lib/oop\");\nvar Fold = exports.Fold = function(range, placeholder) {\n this.foldLine = null;\n this.placeholder = placeholder;\n this.range = range;\n this.start = range.start;\n this.end = range.end;\n\n this.sameRow = range.start.row == range.end.row;\n this.subFolds = this.ranges = [];\n};\n\noop.inherits(Fold, RangeList);\n\n(function() {\n\n this.toString = function() {\n return '\"' + this.placeholder + '\" ' + this.range.toString();\n };\n\n this.setFoldLine = function(foldLine) {\n this.foldLine = foldLine;\n this.subFolds.forEach(function(fold) {\n fold.setFoldLine(foldLine);\n });\n };\n\n this.clone = function() {\n var range = this.range.clone();\n var fold = new Fold(range, this.placeholder);\n this.subFolds.forEach(function(subFold) {\n fold.subFolds.push(subFold.clone());\n });\n fold.collapseChildren = this.collapseChildren;\n return fold;\n };\n\n this.addSubFold = function(fold) {\n if (this.range.isEqual(fold))\n return;\n\n if (!this.range.containsRange(fold))\n throw new Error(\"A fold can't intersect already existing fold\" + fold.range + this.range);\n consumeRange(fold, this.start);\n\n var row = fold.start.row, column = fold.start.column;\n for (var i = 0, cmp = -1; i < this.subFolds.length; i++) {\n cmp = this.subFolds[i].range.compare(row, column);\n if (cmp != 1)\n break;\n }\n var afterStart = this.subFolds[i];\n\n if (cmp == 0)\n return afterStart.addSubFold(fold);\n var row = fold.range.end.row, column = fold.range.end.column;\n for (var j = i, cmp = -1; j < this.subFolds.length; j++) {\n cmp = this.subFolds[j].range.compare(row, column);\n if (cmp != 1)\n break;\n }\n var afterEnd = this.subFolds[j];\n\n if (cmp == 0)\n throw new Error(\"A fold can't intersect already existing fold\" + fold.range + this.range);\n\n var consumedFolds = this.subFolds.splice(i, j - i, fold);\n fold.setFoldLine(this.foldLine);\n\n return fold;\n };\n \n this.restoreRange = function(range) {\n return restoreRange(range, this.start);\n };\n\n}).call(Fold.prototype);\n\nfunction consumePoint(point, anchor) {\n point.row -= anchor.row;\n if (point.row == 0)\n point.column -= anchor.column;\n}\nfunction consumeRange(range, anchor) {\n consumePoint(range.start, anchor);\n consumePoint(range.end, anchor);\n}\nfunction restorePoint(point, anchor) {\n if (point.row == 0)\n point.column += anchor.column;\n point.row += anchor.row;\n}\nfunction restoreRange(range, anchor) {\n restorePoint(range.start, anchor);\n restorePoint(range.end, anchor);\n}\n\n});\n\nace.define(\"ace/edit_session/folding\",[\"require\",\"exports\",\"module\",\"ace/range\",\"ace/edit_session/fold_line\",\"ace/edit_session/fold\",\"ace/token_iterator\"], function(acequire, exports, module) {\n\"use strict\";\n\nvar Range = acequire(\"../range\").Range;\nvar FoldLine = acequire(\"./fold_line\").FoldLine;\nvar Fold = acequire(\"./fold\").Fold;\nvar TokenIterator = acequire(\"../token_iterator\").TokenIterator;\n\nfunction Folding() {\n this.getFoldAt = function(row, column, side) {\n var foldLine = this.getFoldLine(row);\n if (!foldLine)\n return null;\n\n var folds = foldLine.folds;\n for (var i = 0; i < folds.length; i++) {\n var fold = folds[i];\n if (fold.range.contains(row, column)) {\n if (side == 1 && fold.range.isEnd(row, column)) {\n continue;\n } else if (side == -1 && fold.range.isStart(row, column)) {\n continue;\n }\n return fold;\n }\n }\n };\n this.getFoldsInRange = function(range) {\n var start = range.start;\n var end = range.end;\n var foldLines = this.$foldData;\n var foundFolds = [];\n\n start.column += 1;\n end.column -= 1;\n\n for (var i = 0; i < foldLines.length; i++) {\n var cmp = foldLines[i].range.compareRange(range);\n if (cmp == 2) {\n continue;\n }\n else if (cmp == -2) {\n break;\n }\n\n var folds = foldLines[i].folds;\n for (var j = 0; j < folds.length; j++) {\n var fold = folds[j];\n cmp = fold.range.compareRange(range);\n if (cmp == -2) {\n break;\n } else if (cmp == 2) {\n continue;\n } else\n if (cmp == 42) {\n break;\n }\n foundFolds.push(fold);\n }\n }\n start.column -= 1;\n end.column += 1;\n\n return foundFolds;\n };\n\n this.getFoldsInRangeList = function(ranges) {\n if (Array.isArray(ranges)) {\n var folds = [];\n ranges.forEach(function(range) {\n folds = folds.concat(this.getFoldsInRange(range));\n }, this);\n } else {\n var folds = this.getFoldsInRange(ranges);\n }\n return folds;\n };\n this.getAllFolds = function() {\n var folds = [];\n var foldLines = this.$foldData;\n \n for (var i = 0; i < foldLines.length; i++)\n for (var j = 0; j < foldLines[i].folds.length; j++)\n folds.push(foldLines[i].folds[j]);\n\n return folds;\n };\n this.getFoldStringAt = function(row, column, trim, foldLine) {\n foldLine = foldLine || this.getFoldLine(row);\n if (!foldLine)\n return null;\n\n var lastFold = {\n end: { column: 0 }\n };\n var str, fold;\n for (var i = 0; i < foldLine.folds.length; i++) {\n fold = foldLine.folds[i];\n var cmp = fold.range.compareEnd(row, column);\n if (cmp == -1) {\n str = this\n .getLine(fold.start.row)\n .substring(lastFold.end.column, fold.start.column);\n break;\n }\n else if (cmp === 0) {\n return null;\n }\n lastFold = fold;\n }\n if (!str)\n str = this.getLine(fold.start.row).substring(lastFold.end.column);\n\n if (trim == -1)\n return str.substring(0, column - lastFold.end.column);\n else if (trim == 1)\n return str.substring(column - lastFold.end.column);\n else\n return str;\n };\n\n this.getFoldLine = function(docRow, startFoldLine) {\n var foldData = this.$foldData;\n var i = 0;\n if (startFoldLine)\n i = foldData.indexOf(startFoldLine);\n if (i == -1)\n i = 0;\n for (i; i < foldData.length; i++) {\n var foldLine = foldData[i];\n if (foldLine.start.row <= docRow && foldLine.end.row >= docRow) {\n return foldLine;\n } else if (foldLine.end.row > docRow) {\n return null;\n }\n }\n return null;\n };\n this.getNextFoldLine = function(docRow, startFoldLine) {\n var foldData = this.$foldData;\n var i = 0;\n if (startFoldLine)\n i = foldData.indexOf(startFoldLine);\n if (i == -1)\n i = 0;\n for (i; i < foldData.length; i++) {\n var foldLine = foldData[i];\n if (foldLine.end.row >= docRow) {\n return foldLine;\n }\n }\n return null;\n };\n\n this.getFoldedRowCount = function(first, last) {\n var foldData = this.$foldData, rowCount = last-first+1;\n for (var i = 0; i < foldData.length; i++) {\n var foldLine = foldData[i],\n end = foldLine.end.row,\n start = foldLine.start.row;\n if (end >= last) {\n if (start < last) {\n if (start >= first)\n rowCount -= last-start;\n else\n rowCount = 0; // in one fold\n }\n break;\n } else if (end >= first){\n if (start >= first) // fold inside range\n rowCount -= end-start;\n else\n rowCount -= end-first+1;\n }\n }\n return rowCount;\n };\n\n this.$addFoldLine = function(foldLine) {\n this.$foldData.push(foldLine);\n this.$foldData.sort(function(a, b) {\n return a.start.row - b.start.row;\n });\n return foldLine;\n };\n this.addFold = function(placeholder, range) {\n var foldData = this.$foldData;\n var added = false;\n var fold;\n \n if (placeholder instanceof Fold)\n fold = placeholder;\n else {\n fold = new Fold(range, placeholder);\n fold.collapseChildren = range.collapseChildren;\n }\n this.$clipRangeToDocument(fold.range);\n\n var startRow = fold.start.row;\n var startColumn = fold.start.column;\n var endRow = fold.end.row;\n var endColumn = fold.end.column;\n if (!(startRow < endRow || \n startRow == endRow && startColumn <= endColumn - 2))\n throw new Error(\"The range has to be at least 2 characters width\");\n\n var startFold = this.getFoldAt(startRow, startColumn, 1);\n var endFold = this.getFoldAt(endRow, endColumn, -1);\n if (startFold && endFold == startFold)\n return startFold.addSubFold(fold);\n\n if (startFold && !startFold.range.isStart(startRow, startColumn))\n this.removeFold(startFold);\n \n if (endFold && !endFold.range.isEnd(endRow, endColumn))\n this.removeFold(endFold);\n var folds = this.getFoldsInRange(fold.range);\n if (folds.length > 0) {\n this.removeFolds(folds);\n folds.forEach(function(subFold) {\n fold.addSubFold(subFold);\n });\n }\n\n for (var i = 0; i < foldData.length; i++) {\n var foldLine = foldData[i];\n if (endRow == foldLine.start.row) {\n foldLine.addFold(fold);\n added = true;\n break;\n } else if (startRow == foldLine.end.row) {\n foldLine.addFold(fold);\n added = true;\n if (!fold.sameRow) {\n var foldLineNext = foldData[i + 1];\n if (foldLineNext && foldLineNext.start.row == endRow) {\n foldLine.merge(foldLineNext);\n break;\n }\n }\n break;\n } else if (endRow <= foldLine.start.row) {\n break;\n }\n }\n\n if (!added)\n foldLine = this.$addFoldLine(new FoldLine(this.$foldData, fold));\n\n if (this.$useWrapMode)\n this.$updateWrapData(foldLine.start.row, foldLine.start.row);\n else\n this.$updateRowLengthCache(foldLine.start.row, foldLine.start.row);\n this.$modified = true;\n this._signal(\"changeFold\", { data: fold, action: \"add\" });\n\n return fold;\n };\n\n this.addFolds = function(folds) {\n folds.forEach(function(fold) {\n this.addFold(fold);\n }, this);\n };\n\n this.removeFold = function(fold) {\n var foldLine = fold.foldLine;\n var startRow = foldLine.start.row;\n var endRow = foldLine.end.row;\n\n var foldLines = this.$foldData;\n var folds = foldLine.folds;\n if (folds.length == 1) {\n foldLines.splice(foldLines.indexOf(foldLine), 1);\n } else\n if (foldLine.range.isEnd(fold.end.row, fold.end.column)) {\n folds.pop();\n foldLine.end.row = folds[folds.length - 1].end.row;\n foldLine.end.column = folds[folds.length - 1].end.column;\n } else\n if (foldLine.range.isStart(fold.start.row, fold.start.column)) {\n folds.shift();\n foldLine.start.row = folds[0].start.row;\n foldLine.start.column = folds[0].start.column;\n } else\n if (fold.sameRow) {\n folds.splice(folds.indexOf(fold), 1);\n } else\n {\n var newFoldLine = foldLine.split(fold.start.row, fold.start.column);\n folds = newFoldLine.folds;\n folds.shift();\n newFoldLine.start.row = folds[0].start.row;\n newFoldLine.start.column = folds[0].start.column;\n }\n\n if (!this.$updating) {\n if (this.$useWrapMode)\n this.$updateWrapData(startRow, endRow);\n else\n this.$updateRowLengthCache(startRow, endRow);\n }\n this.$modified = true;\n this._signal(\"changeFold\", { data: fold, action: \"remove\" });\n };\n\n this.removeFolds = function(folds) {\n var cloneFolds = [];\n for (var i = 0; i < folds.length; i++) {\n cloneFolds.push(folds[i]);\n }\n\n cloneFolds.forEach(function(fold) {\n this.removeFold(fold);\n }, this);\n this.$modified = true;\n };\n\n this.expandFold = function(fold) {\n this.removeFold(fold);\n fold.subFolds.forEach(function(subFold) {\n fold.restoreRange(subFold);\n this.addFold(subFold);\n }, this);\n if (fold.collapseChildren > 0) {\n this.foldAll(fold.start.row+1, fold.end.row, fold.collapseChildren-1);\n }\n fold.subFolds = [];\n };\n\n this.expandFolds = function(folds) {\n folds.forEach(function(fold) {\n this.expandFold(fold);\n }, this);\n };\n\n this.unfold = function(location, expandInner) {\n var range, folds;\n if (location == null) {\n range = new Range(0, 0, this.getLength(), 0);\n expandInner = true;\n } else if (typeof location == \"number\")\n range = new Range(location, 0, location, this.getLine(location).length);\n else if (\"row\" in location)\n range = Range.fromPoints(location, location);\n else\n range = location;\n \n folds = this.getFoldsInRangeList(range);\n if (expandInner) {\n this.removeFolds(folds);\n } else {\n var subFolds = folds;\n while (subFolds.length) {\n this.expandFolds(subFolds);\n subFolds = this.getFoldsInRangeList(range);\n }\n }\n if (folds.length)\n return folds;\n };\n this.isRowFolded = function(docRow, startFoldRow) {\n return !!this.getFoldLine(docRow, startFoldRow);\n };\n\n this.getRowFoldEnd = function(docRow, startFoldRow) {\n var foldLine = this.getFoldLine(docRow, startFoldRow);\n return foldLine ? foldLine.end.row : docRow;\n };\n\n this.getRowFoldStart = function(docRow, startFoldRow) {\n var foldLine = this.getFoldLine(docRow, startFoldRow);\n return foldLine ? foldLine.start.row : docRow;\n };\n\n this.getFoldDisplayLine = function(foldLine, endRow, endColumn, startRow, startColumn) {\n if (startRow == null)\n startRow = foldLine.start.row;\n if (startColumn == null)\n startColumn = 0;\n if (endRow == null)\n endRow = foldLine.end.row;\n if (endColumn == null)\n endColumn = this.getLine(endRow).length;\n var doc = this.doc;\n var textLine = \"\";\n\n foldLine.walk(function(placeholder, row, column, lastColumn) {\n if (row < startRow)\n return;\n if (row == startRow) {\n if (column < startColumn)\n return;\n lastColumn = Math.max(startColumn, lastColumn);\n }\n\n if (placeholder != null) {\n textLine += placeholder;\n } else {\n textLine += doc.getLine(row).substring(lastColumn, column);\n }\n }, endRow, endColumn);\n return textLine;\n };\n\n this.getDisplayLine = function(row, endColumn, startRow, startColumn) {\n var foldLine = this.getFoldLine(row);\n\n if (!foldLine) {\n var line;\n line = this.doc.getLine(row);\n return line.substring(startColumn || 0, endColumn || line.length);\n } else {\n return this.getFoldDisplayLine(\n foldLine, row, endColumn, startRow, startColumn);\n }\n };\n\n this.$cloneFoldData = function() {\n var fd = [];\n fd = this.$foldData.map(function(foldLine) {\n var folds = foldLine.folds.map(function(fold) {\n return fold.clone();\n });\n return new FoldLine(fd, folds);\n });\n\n return fd;\n };\n\n this.toggleFold = function(tryToUnfold) {\n var selection = this.selection;\n var range = selection.getRange();\n var fold;\n var bracketPos;\n\n if (range.isEmpty()) {\n var cursor = range.start;\n fold = this.getFoldAt(cursor.row, cursor.column);\n\n if (fold) {\n this.expandFold(fold);\n return;\n } else if (bracketPos = this.findMatchingBracket(cursor)) {\n if (range.comparePoint(bracketPos) == 1) {\n range.end = bracketPos;\n } else {\n range.start = bracketPos;\n range.start.column++;\n range.end.column--;\n }\n } else if (bracketPos = this.findMatchingBracket({row: cursor.row, column: cursor.column + 1})) {\n if (range.comparePoint(bracketPos) == 1)\n range.end = bracketPos;\n else\n range.start = bracketPos;\n\n range.start.column++;\n } else {\n range = this.getCommentFoldRange(cursor.row, cursor.column) || range;\n }\n } else {\n var folds = this.getFoldsInRange(range);\n if (tryToUnfold && folds.length) {\n this.expandFolds(folds);\n return;\n } else if (folds.length == 1 ) {\n fold = folds[0];\n }\n }\n\n if (!fold)\n fold = this.getFoldAt(range.start.row, range.start.column);\n\n if (fold && fold.range.toString() == range.toString()) {\n this.expandFold(fold);\n return;\n }\n\n var placeholder = \"...\";\n if (!range.isMultiLine()) {\n placeholder = this.getTextRange(range);\n if (placeholder.length < 4)\n return;\n placeholder = placeholder.trim().substring(0, 2) + \"..\";\n }\n\n this.addFold(placeholder, range);\n };\n\n this.getCommentFoldRange = function(row, column, dir) {\n var iterator = new TokenIterator(this, row, column);\n var token = iterator.getCurrentToken();\n var type = token.type;\n if (token && /^comment|string/.test(type)) {\n type = type.match(/comment|string/)[0];\n if (type == \"comment\")\n type += \"|doc-start\";\n var re = new RegExp(type);\n var range = new Range();\n if (dir != 1) {\n do {\n token = iterator.stepBackward();\n } while (token && re.test(token.type));\n iterator.stepForward();\n }\n \n range.start.row = iterator.getCurrentTokenRow();\n range.start.column = iterator.getCurrentTokenColumn() + 2;\n\n iterator = new TokenIterator(this, row, column);\n \n if (dir != -1) {\n var lastRow = -1;\n do {\n token = iterator.stepForward();\n if (lastRow == -1) {\n var state = this.getState(iterator.$row);\n if (!re.test(state))\n lastRow = iterator.$row;\n } else if (iterator.$row > lastRow) {\n break;\n }\n } while (token && re.test(token.type));\n token = iterator.stepBackward();\n } else\n token = iterator.getCurrentToken();\n\n range.end.row = iterator.getCurrentTokenRow();\n range.end.column = iterator.getCurrentTokenColumn() + token.value.length - 2;\n return range;\n }\n };\n\n this.foldAll = function(startRow, endRow, depth) {\n if (depth == undefined)\n depth = 100000; // JSON.stringify doesn't hanle Infinity\n var foldWidgets = this.foldWidgets;\n if (!foldWidgets)\n return; // mode doesn't support folding\n endRow = endRow || this.getLength();\n startRow = startRow || 0;\n for (var row = startRow; row < endRow; row++) {\n if (foldWidgets[row] == null)\n foldWidgets[row] = this.getFoldWidget(row);\n if (foldWidgets[row] != \"start\")\n continue;\n\n var range = this.getFoldWidgetRange(row);\n if (range && range.isMultiLine()\n && range.end.row <= endRow\n && range.start.row >= startRow\n ) {\n row = range.end.row;\n try {\n var fold = this.addFold(\"...\", range);\n if (fold)\n fold.collapseChildren = depth;\n } catch(e) {}\n }\n }\n };\n this.$foldStyles = {\n \"manual\": 1,\n \"markbegin\": 1,\n \"markbeginend\": 1\n };\n this.$foldStyle = \"markbegin\";\n this.setFoldStyle = function(style) {\n if (!this.$foldStyles[style])\n throw new Error(\"invalid fold style: \" + style + \"[\" + Object.keys(this.$foldStyles).join(\", \") + \"]\");\n \n if (this.$foldStyle == style)\n return;\n\n this.$foldStyle = style;\n \n if (style == \"manual\")\n this.unfold();\n var mode = this.$foldMode;\n this.$setFolding(null);\n this.$setFolding(mode);\n };\n\n this.$setFolding = function(foldMode) {\n if (this.$foldMode == foldMode)\n return;\n \n this.$foldMode = foldMode;\n \n this.off('change', this.$updateFoldWidgets);\n this.off('tokenizerUpdate', this.$tokenizerUpdateFoldWidgets);\n this._signal(\"changeAnnotation\");\n \n if (!foldMode || this.$foldStyle == \"manual\") {\n this.foldWidgets = null;\n return;\n }\n \n this.foldWidgets = [];\n this.getFoldWidget = foldMode.getFoldWidget.bind(foldMode, this, this.$foldStyle);\n this.getFoldWidgetRange = foldMode.getFoldWidgetRange.bind(foldMode, this, this.$foldStyle);\n \n this.$updateFoldWidgets = this.updateFoldWidgets.bind(this);\n this.$tokenizerUpdateFoldWidgets = this.tokenizerUpdateFoldWidgets.bind(this);\n this.on('change', this.$updateFoldWidgets);\n this.on('tokenizerUpdate', this.$tokenizerUpdateFoldWidgets);\n };\n\n this.getParentFoldRangeData = function (row, ignoreCurrent) {\n var fw = this.foldWidgets;\n if (!fw || (ignoreCurrent && fw[row]))\n return {};\n\n var i = row - 1, firstRange;\n while (i >= 0) {\n var c = fw[i];\n if (c == null)\n c = fw[i] = this.getFoldWidget(i);\n\n if (c == \"start\") {\n var range = this.getFoldWidgetRange(i);\n if (!firstRange)\n firstRange = range;\n if (range && range.end.row >= row)\n break;\n }\n i--;\n }\n\n return {\n range: i !== -1 && range,\n firstRange: firstRange\n };\n };\n\n this.onFoldWidgetClick = function(row, e) {\n e = e.domEvent;\n var options = {\n children: e.shiftKey,\n all: e.ctrlKey || e.metaKey,\n siblings: e.altKey\n };\n \n var range = this.$toggleFoldWidget(row, options);\n if (!range) {\n var el = (e.target || e.srcElement);\n if (el && /ace_fold-widget/.test(el.className))\n el.className += \" ace_invalid\";\n }\n };\n \n this.$toggleFoldWidget = function(row, options) {\n if (!this.getFoldWidget)\n return;\n var type = this.getFoldWidget(row);\n var line = this.getLine(row);\n\n var dir = type === \"end\" ? -1 : 1;\n var fold = this.getFoldAt(row, dir === -1 ? 0 : line.length, dir);\n\n if (fold) {\n if (options.children || options.all)\n this.removeFold(fold);\n else\n this.expandFold(fold);\n return fold;\n }\n\n var range = this.getFoldWidgetRange(row, true);\n if (range && !range.isMultiLine()) {\n fold = this.getFoldAt(range.start.row, range.start.column, 1);\n if (fold && range.isEqual(fold.range)) {\n this.removeFold(fold);\n return fold;\n }\n }\n \n if (options.siblings) {\n var data = this.getParentFoldRangeData(row);\n if (data.range) {\n var startRow = data.range.start.row + 1;\n var endRow = data.range.end.row;\n }\n this.foldAll(startRow, endRow, options.all ? 10000 : 0);\n } else if (options.children) {\n endRow = range ? range.end.row : this.getLength();\n this.foldAll(row + 1, endRow, options.all ? 10000 : 0);\n } else if (range) {\n if (options.all) \n range.collapseChildren = 10000;\n this.addFold(\"...\", range);\n }\n \n return range;\n };\n \n \n \n this.toggleFoldWidget = function(toggleParent) {\n var row = this.selection.getCursor().row;\n row = this.getRowFoldStart(row);\n var range = this.$toggleFoldWidget(row, {});\n \n if (range)\n return;\n var data = this.getParentFoldRangeData(row, true);\n range = data.range || data.firstRange;\n \n if (range) {\n row = range.start.row;\n var fold = this.getFoldAt(row, this.getLine(row).length, 1);\n\n if (fold) {\n this.removeFold(fold);\n } else {\n this.addFold(\"...\", range);\n }\n }\n };\n\n this.updateFoldWidgets = function(delta) {\n var firstRow = delta.start.row;\n var len = delta.end.row - firstRow;\n\n if (len === 0) {\n this.foldWidgets[firstRow] = null;\n } else if (delta.action == 'remove') {\n this.foldWidgets.splice(firstRow, len + 1, null);\n } else {\n var args = Array(len + 1);\n args.unshift(firstRow, 1);\n this.foldWidgets.splice.apply(this.foldWidgets, args);\n }\n };\n this.tokenizerUpdateFoldWidgets = function(e) {\n var rows = e.data;\n if (rows.first != rows.last) {\n if (this.foldWidgets.length > rows.first)\n this.foldWidgets.splice(rows.first, this.foldWidgets.length);\n }\n };\n}\n\nexports.Folding = Folding;\n\n});\n\nace.define(\"ace/edit_session/bracket_match\",[\"require\",\"exports\",\"module\",\"ace/token_iterator\",\"ace/range\"], function(acequire, exports, module) {\n\"use strict\";\n\nvar TokenIterator = acequire(\"../token_iterator\").TokenIterator;\nvar Range = acequire(\"../range\").Range;\n\n\nfunction BracketMatch() {\n\n this.findMatchingBracket = function(position, chr) {\n if (position.column == 0) return null;\n\n var charBeforeCursor = chr || this.getLine(position.row).charAt(position.column-1);\n if (charBeforeCursor == \"\") return null;\n\n var match = charBeforeCursor.match(/([\\(\\[\\{])|([\\)\\]\\}])/);\n if (!match)\n return null;\n\n if (match[1])\n return this.$findClosingBracket(match[1], position);\n else\n return this.$findOpeningBracket(match[2], position);\n };\n \n this.getBracketRange = function(pos) {\n var line = this.getLine(pos.row);\n var before = true, range;\n\n var chr = line.charAt(pos.column-1);\n var match = chr && chr.match(/([\\(\\[\\{])|([\\)\\]\\}])/);\n if (!match) {\n chr = line.charAt(pos.column);\n pos = {row: pos.row, column: pos.column + 1};\n match = chr && chr.match(/([\\(\\[\\{])|([\\)\\]\\}])/);\n before = false;\n }\n if (!match)\n return null;\n\n if (match[1]) {\n var bracketPos = this.$findClosingBracket(match[1], pos);\n if (!bracketPos)\n return null;\n range = Range.fromPoints(pos, bracketPos);\n if (!before) {\n range.end.column++;\n range.start.column--;\n }\n range.cursor = range.end;\n } else {\n var bracketPos = this.$findOpeningBracket(match[2], pos);\n if (!bracketPos)\n return null;\n range = Range.fromPoints(bracketPos, pos);\n if (!before) {\n range.start.column++;\n range.end.column--;\n }\n range.cursor = range.start;\n }\n \n return range;\n };\n\n this.$brackets = {\n \")\": \"(\",\n \"(\": \")\",\n \"]\": \"[\",\n \"[\": \"]\",\n \"{\": \"}\",\n \"}\": \"{\"\n };\n\n this.$findOpeningBracket = function(bracket, position, typeRe) {\n var openBracket = this.$brackets[bracket];\n var depth = 1;\n\n var iterator = new TokenIterator(this, position.row, position.column);\n var token = iterator.getCurrentToken();\n if (!token)\n token = iterator.stepForward();\n if (!token)\n return;\n \n if (!typeRe){\n typeRe = new RegExp(\n \"(\\\\.?\" +\n token.type.replace(\".\", \"\\\\.\").replace(\"rparen\", \".paren\")\n .replace(/\\b(?:end)\\b/, \"(?:start|begin|end)\")\n + \")+\"\n );\n }\n var valueIndex = position.column - iterator.getCurrentTokenColumn() - 2;\n var value = token.value;\n \n while (true) {\n \n while (valueIndex >= 0) {\n var chr = value.charAt(valueIndex);\n if (chr == openBracket) {\n depth -= 1;\n if (depth == 0) {\n return {row: iterator.getCurrentTokenRow(),\n column: valueIndex + iterator.getCurrentTokenColumn()};\n }\n }\n else if (chr == bracket) {\n depth += 1;\n }\n valueIndex -= 1;\n }\n do {\n token = iterator.stepBackward();\n } while (token && !typeRe.test(token.type));\n\n if (token == null)\n break;\n \n value = token.value;\n valueIndex = value.length - 1;\n }\n \n return null;\n };\n\n this.$findClosingBracket = function(bracket, position, typeRe) {\n var closingBracket = this.$brackets[bracket];\n var depth = 1;\n\n var iterator = new TokenIterator(this, position.row, position.column);\n var token = iterator.getCurrentToken();\n if (!token)\n token = iterator.stepForward();\n if (!token)\n return;\n\n if (!typeRe){\n typeRe = new RegExp(\n \"(\\\\.?\" +\n token.type.replace(\".\", \"\\\\.\").replace(\"lparen\", \".paren\")\n .replace(/\\b(?:start|begin)\\b/, \"(?:start|begin|end)\")\n + \")+\"\n );\n }\n var valueIndex = position.column - iterator.getCurrentTokenColumn();\n\n while (true) {\n\n var value = token.value;\n var valueLength = value.length;\n while (valueIndex < valueLength) {\n var chr = value.charAt(valueIndex);\n if (chr == closingBracket) {\n depth -= 1;\n if (depth == 0) {\n return {row: iterator.getCurrentTokenRow(),\n column: valueIndex + iterator.getCurrentTokenColumn()};\n }\n }\n else if (chr == bracket) {\n depth += 1;\n }\n valueIndex += 1;\n }\n do {\n token = iterator.stepForward();\n } while (token && !typeRe.test(token.type));\n\n if (token == null)\n break;\n\n valueIndex = 0;\n }\n \n return null;\n };\n}\nexports.BracketMatch = BracketMatch;\n\n});\n\nace.define(\"ace/edit_session\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/lang\",\"ace/bidihandler\",\"ace/config\",\"ace/lib/event_emitter\",\"ace/selection\",\"ace/mode/text\",\"ace/range\",\"ace/document\",\"ace/background_tokenizer\",\"ace/search_highlight\",\"ace/edit_session/folding\",\"ace/edit_session/bracket_match\"], function(acequire, exports, module) {\n\"use strict\";\n\nvar oop = acequire(\"./lib/oop\");\nvar lang = acequire(\"./lib/lang\");\nvar BidiHandler = acequire(\"./bidihandler\").BidiHandler;\nvar config = acequire(\"./config\");\nvar EventEmitter = acequire(\"./lib/event_emitter\").EventEmitter;\nvar Selection = acequire(\"./selection\").Selection;\nvar TextMode = acequire(\"./mode/text\").Mode;\nvar Range = acequire(\"./range\").Range;\nvar Document = acequire(\"./document\").Document;\nvar BackgroundTokenizer = acequire(\"./background_tokenizer\").BackgroundTokenizer;\nvar SearchHighlight = acequire(\"./search_highlight\").SearchHighlight;\n\nvar EditSession = function(text, mode) {\n this.$breakpoints = [];\n this.$decorations = [];\n this.$frontMarkers = {};\n this.$backMarkers = {};\n this.$markerId = 1;\n this.$undoSelect = true;\n\n this.$foldData = [];\n this.id = \"session\" + (++EditSession.$uid);\n this.$foldData.toString = function() {\n return this.join(\"\\n\");\n };\n this.on(\"changeFold\", this.onChangeFold.bind(this));\n this.$onChange = this.onChange.bind(this);\n\n if (typeof text != \"object\" || !text.getLine)\n text = new Document(text);\n\n this.$bidiHandler = new BidiHandler(this);\n this.setDocument(text);\n this.selection = new Selection(this);\n\n config.resetOptions(this);\n this.setMode(mode);\n config._signal(\"session\", this);\n};\n\n\nEditSession.$uid = 0;\n\n(function() {\n\n oop.implement(this, EventEmitter);\n this.setDocument = function(doc) {\n if (this.doc)\n this.doc.removeListener(\"change\", this.$onChange);\n\n this.doc = doc;\n doc.on(\"change\", this.$onChange);\n\n if (this.bgTokenizer)\n this.bgTokenizer.setDocument(this.getDocument());\n\n this.resetCaches();\n };\n this.getDocument = function() {\n return this.doc;\n };\n this.$resetRowCache = function(docRow) {\n if (!docRow) {\n this.$docRowCache = [];\n this.$screenRowCache = [];\n return;\n }\n var l = this.$docRowCache.length;\n var i = this.$getRowCacheIndex(this.$docRowCache, docRow) + 1;\n if (l > i) {\n this.$docRowCache.splice(i, l);\n this.$screenRowCache.splice(i, l);\n }\n };\n\n this.$getRowCacheIndex = function(cacheArray, val) {\n var low = 0;\n var hi = cacheArray.length - 1;\n\n while (low <= hi) {\n var mid = (low + hi) >> 1;\n var c = cacheArray[mid];\n\n if (val > c)\n low = mid + 1;\n else if (val < c)\n hi = mid - 1;\n else\n return mid;\n }\n\n return low -1;\n };\n\n this.resetCaches = function() {\n this.$modified = true;\n this.$wrapData = [];\n this.$rowLengthCache = [];\n this.$resetRowCache(0);\n if (this.bgTokenizer)\n this.bgTokenizer.start(0);\n };\n\n this.onChangeFold = function(e) {\n var fold = e.data;\n this.$resetRowCache(fold.start.row);\n };\n\n this.onChange = function(delta) {\n this.$modified = true;\n this.$bidiHandler.onChange(delta);\n this.$resetRowCache(delta.start.row);\n\n var removedFolds = this.$updateInternalDataOnChange(delta);\n if (!this.$fromUndo && this.$undoManager && !delta.ignore) {\n this.$deltasDoc.push(delta);\n if (removedFolds && removedFolds.length != 0) {\n this.$deltasFold.push({\n action: \"removeFolds\",\n folds: removedFolds\n });\n }\n\n this.$informUndoManager.schedule();\n }\n\n this.bgTokenizer && this.bgTokenizer.$updateOnChange(delta);\n this._signal(\"change\", delta);\n };\n this.setValue = function(text) {\n this.doc.setValue(text);\n this.selection.moveTo(0, 0);\n\n this.$resetRowCache(0);\n this.$deltas = [];\n this.$deltasDoc = [];\n this.$deltasFold = [];\n this.setUndoManager(this.$undoManager);\n this.getUndoManager().reset();\n };\n this.getValue =\n this.toString = function() {\n return this.doc.getValue();\n };\n this.getSelection = function() {\n return this.selection;\n };\n this.getState = function(row) {\n return this.bgTokenizer.getState(row);\n };\n this.getTokens = function(row) {\n return this.bgTokenizer.getTokens(row);\n };\n this.getTokenAt = function(row, column) {\n var tokens = this.bgTokenizer.getTokens(row);\n var token, c = 0;\n if (column == null) {\n var i = tokens.length - 1;\n c = this.getLine(row).length;\n } else {\n for (var i = 0; i < tokens.length; i++) {\n c += tokens[i].value.length;\n if (c >= column)\n break;\n }\n }\n token = tokens[i];\n if (!token)\n return null;\n token.index = i;\n token.start = c - token.value.length;\n return token;\n };\n this.setUndoManager = function(undoManager) {\n this.$undoManager = undoManager;\n this.$deltas = [];\n this.$deltasDoc = [];\n this.$deltasFold = [];\n\n if (this.$informUndoManager)\n this.$informUndoManager.cancel();\n\n if (undoManager) {\n var self = this;\n\n this.$syncInformUndoManager = function() {\n self.$informUndoManager.cancel();\n\n if (self.$deltasFold.length) {\n self.$deltas.push({\n group: \"fold\",\n deltas: self.$deltasFold\n });\n self.$deltasFold = [];\n }\n\n if (self.$deltasDoc.length) {\n self.$deltas.push({\n group: \"doc\",\n deltas: self.$deltasDoc\n });\n self.$deltasDoc = [];\n }\n\n if (self.$deltas.length > 0) {\n undoManager.execute({\n action: \"aceupdate\",\n args: [self.$deltas, self],\n merge: self.mergeUndoDeltas\n });\n }\n self.mergeUndoDeltas = false;\n self.$deltas = [];\n };\n this.$informUndoManager = lang.delayedCall(this.$syncInformUndoManager);\n }\n };\n this.markUndoGroup = function() {\n if (this.$syncInformUndoManager)\n this.$syncInformUndoManager();\n };\n \n this.$defaultUndoManager = {\n undo: function() {},\n redo: function() {},\n reset: function() {}\n };\n this.getUndoManager = function() {\n return this.$undoManager || this.$defaultUndoManager;\n };\n this.getTabString = function() {\n if (this.getUseSoftTabs()) {\n return lang.stringRepeat(\" \", this.getTabSize());\n } else {\n return \"\\t\";\n }\n };\n this.setUseSoftTabs = function(val) {\n this.setOption(\"useSoftTabs\", val);\n };\n this.getUseSoftTabs = function() {\n return this.$useSoftTabs && !this.$mode.$indentWithTabs;\n };\n this.setTabSize = function(tabSize) {\n this.setOption(\"tabSize\", tabSize);\n };\n this.getTabSize = function() {\n return this.$tabSize;\n };\n this.isTabStop = function(position) {\n return this.$useSoftTabs && (position.column % this.$tabSize === 0);\n };\n this.setNavigateWithinSoftTabs = function (navigateWithinSoftTabs) {\n this.setOption(\"navigateWithinSoftTabs\", navigateWithinSoftTabs);\n };\n this.getNavigateWithinSoftTabs = function() {\n return this.$navigateWithinSoftTabs;\n };\n\n this.$overwrite = false;\n this.setOverwrite = function(overwrite) {\n this.setOption(\"overwrite\", overwrite);\n };\n this.getOverwrite = function() {\n return this.$overwrite;\n };\n this.toggleOverwrite = function() {\n this.setOverwrite(!this.$overwrite);\n };\n this.addGutterDecoration = function(row, className) {\n if (!this.$decorations[row])\n this.$decorations[row] = \"\";\n this.$decorations[row] += \" \" + className;\n this._signal(\"changeBreakpoint\", {});\n };\n this.removeGutterDecoration = function(row, className) {\n this.$decorations[row] = (this.$decorations[row] || \"\").replace(\" \" + className, \"\");\n this._signal(\"changeBreakpoint\", {});\n };\n this.getBreakpoints = function() {\n return this.$breakpoints;\n };\n this.setBreakpoints = function(rows) {\n this.$breakpoints = [];\n for (var i=0; i<rows.length; i++) {\n this.$breakpoints[rows[i]] = \"ace_breakpoint\";\n }\n this._signal(\"changeBreakpoint\", {});\n };\n this.clearBreakpoints = function() {\n this.$breakpoints = [];\n this._signal(\"changeBreakpoint\", {});\n };\n this.setBreakpoint = function(row, className) {\n if (className === undefined)\n className = \"ace_breakpoint\";\n if (className)\n this.$breakpoints[row] = className;\n else\n delete this.$breakpoints[row];\n this._signal(\"changeBreakpoint\", {});\n };\n this.clearBreakpoint = function(row) {\n delete this.$breakpoints[row];\n this._signal(\"changeBreakpoint\", {});\n };\n this.addMarker = function(range, clazz, type, inFront) {\n var id = this.$markerId++;\n\n var marker = {\n range : range,\n type : type || \"line\",\n renderer: typeof type == \"function\" ? type : null,\n clazz : clazz,\n inFront: !!inFront,\n id: id\n };\n\n if (inFront) {\n this.$frontMarkers[id] = marker;\n this._signal(\"changeFrontMarker\");\n } else {\n this.$backMarkers[id] = marker;\n this._signal(\"changeBackMarker\");\n }\n\n return id;\n };\n this.addDynamicMarker = function(marker, inFront) {\n if (!marker.update)\n return;\n var id = this.$markerId++;\n marker.id = id;\n marker.inFront = !!inFront;\n\n if (inFront) {\n this.$frontMarkers[id] = marker;\n this._signal(\"changeFrontMarker\");\n } else {\n this.$backMarkers[id] = marker;\n this._signal(\"changeBackMarker\");\n }\n\n return marker;\n };\n this.removeMarker = function(markerId) {\n var marker = this.$frontMarkers[markerId] || this.$backMarkers[markerId];\n if (!marker)\n return;\n\n var markers = marker.inFront ? this.$frontMarkers : this.$backMarkers;\n if (marker) {\n delete (markers[markerId]);\n this._signal(marker.inFront ? \"changeFrontMarker\" : \"changeBackMarker\");\n }\n };\n this.getMarkers = function(inFront) {\n return inFront ? this.$frontMarkers : this.$backMarkers;\n };\n\n this.highlight = function(re) {\n if (!this.$searchHighlight) {\n var highlight = new SearchHighlight(null, \"ace_selected-word\", \"text\");\n this.$searchHighlight = this.addDynamicMarker(highlight);\n }\n this.$searchHighlight.setRegexp(re);\n };\n this.highlightLines = function(startRow, endRow, clazz, inFront) {\n if (typeof endRow != \"number\") {\n clazz = endRow;\n endRow = startRow;\n }\n if (!clazz)\n clazz = \"ace_step\";\n\n var range = new Range(startRow, 0, endRow, Infinity);\n range.id = this.addMarker(range, clazz, \"fullLine\", inFront);\n return range;\n };\n this.setAnnotations = function(annotations) {\n this.$annotations = annotations;\n this._signal(\"changeAnnotation\", {});\n };\n this.getAnnotations = function() {\n return this.$annotations || [];\n };\n this.clearAnnotations = function() {\n this.setAnnotations([]);\n };\n this.$detectNewLine = function(text) {\n var match = text.match(/^.*?(\\r?\\n)/m);\n if (match) {\n this.$autoNewLine = match[1];\n } else {\n this.$autoNewLine = \"\\n\";\n }\n };\n this.getWordRange = function(row, column) {\n var line = this.getLine(row);\n\n var inToken = false;\n if (column > 0)\n inToken = !!line.charAt(column - 1).match(this.tokenRe);\n\n if (!inToken)\n inToken = !!line.charAt(column).match(this.tokenRe);\n\n if (inToken)\n var re = this.tokenRe;\n else if (/^\\s+$/.test(line.slice(column-1, column+1)))\n var re = /\\s/;\n else\n var re = this.nonTokenRe;\n\n var start = column;\n if (start > 0) {\n do {\n start--;\n }\n while (start >= 0 && line.charAt(start).match(re));\n start++;\n }\n\n var end = column;\n while (end < line.length && line.charAt(end).match(re)) {\n end++;\n }\n\n return new Range(row, start, row, end);\n };\n this.getAWordRange = function(row, column) {\n var wordRange = this.getWordRange(row, column);\n var line = this.getLine(wordRange.end.row);\n\n while (line.charAt(wordRange.end.column).match(/[ \\t]/)) {\n wordRange.end.column += 1;\n }\n return wordRange;\n };\n this.setNewLineMode = function(newLineMode) {\n this.doc.setNewLineMode(newLineMode);\n };\n this.getNewLineMode = function() {\n return this.doc.getNewLineMode();\n };\n this.setUseWorker = function(useWorker) { this.setOption(\"useWorker\", useWorker); };\n this.getUseWorker = function() { return this.$useWorker; };\n this.onReloadTokenizer = function(e) {\n var rows = e.data;\n this.bgTokenizer.start(rows.first);\n this._signal(\"tokenizerUpdate\", e);\n };\n\n this.$modes = {};\n this.$mode = null;\n this.$modeId = null;\n this.setMode = function(mode, cb) {\n if (mode && typeof mode === \"object\") {\n if (mode.getTokenizer)\n return this.$onChangeMode(mode);\n var options = mode;\n var path = options.path;\n } else {\n path = mode || \"ace/mode/text\";\n }\n if (!this.$modes[\"ace/mode/text\"])\n this.$modes[\"ace/mode/text\"] = new TextMode();\n\n if (this.$modes[path] && !options) {\n this.$onChangeMode(this.$modes[path]);\n cb && cb();\n return;\n }\n this.$modeId = path;\n config.loadModule([\"mode\", path], function(m) {\n if (this.$modeId !== path)\n return cb && cb();\n if (this.$modes[path] && !options) {\n this.$onChangeMode(this.$modes[path]);\n } else if (m && m.Mode) {\n m = new m.Mode(options);\n if (!options) {\n this.$modes[path] = m;\n m.$id = path;\n }\n this.$onChangeMode(m);\n }\n cb && cb();\n }.bind(this));\n if (!this.$mode)\n this.$onChangeMode(this.$modes[\"ace/mode/text\"], true);\n };\n\n this.$onChangeMode = function(mode, $isPlaceholder) {\n if (!$isPlaceholder)\n this.$modeId = mode.$id;\n if (this.$mode === mode) \n return;\n\n this.$mode = mode;\n\n this.$stopWorker();\n\n if (this.$useWorker)\n this.$startWorker();\n\n var tokenizer = mode.getTokenizer();\n\n if(tokenizer.addEventListener !== undefined) {\n var onReloadTokenizer = this.onReloadTokenizer.bind(this);\n tokenizer.addEventListener(\"update\", onReloadTokenizer);\n }\n\n if (!this.bgTokenizer) {\n this.bgTokenizer = new BackgroundTokenizer(tokenizer);\n var _self = this;\n this.bgTokenizer.addEventListener(\"update\", function(e) {\n _self._signal(\"tokenizerUpdate\", e);\n });\n } else {\n this.bgTokenizer.setTokenizer(tokenizer);\n }\n\n this.bgTokenizer.setDocument(this.getDocument());\n\n this.tokenRe = mode.tokenRe;\n this.nonTokenRe = mode.nonTokenRe;\n\n \n if (!$isPlaceholder) {\n if (mode.attachToSession)\n mode.attachToSession(this);\n this.$options.wrapMethod.set.call(this, this.$wrapMethod);\n this.$setFolding(mode.foldingRules);\n this.bgTokenizer.start(0);\n this._emit(\"changeMode\");\n }\n };\n\n this.$stopWorker = function() {\n if (this.$worker) {\n this.$worker.terminate();\n this.$worker = null;\n }\n };\n\n this.$startWorker = function() {\n try {\n this.$worker = this.$mode.createWorker(this);\n } catch (e) {\n config.warn(\"Could not load worker\", e);\n this.$worker = null;\n }\n };\n this.getMode = function() {\n return this.$mode;\n };\n\n this.$scrollTop = 0;\n this.setScrollTop = function(scrollTop) {\n if (this.$scrollTop === scrollTop || isNaN(scrollTop))\n return;\n\n this.$scrollTop = scrollTop;\n this._signal(\"changeScrollTop\", scrollTop);\n };\n this.getScrollTop = function() {\n return this.$scrollTop;\n };\n\n this.$scrollLeft = 0;\n this.setScrollLeft = function(scrollLeft) {\n if (this.$scrollLeft === scrollLeft || isNaN(scrollLeft))\n return;\n\n this.$scrollLeft = scrollLeft;\n this._signal(\"changeScrollLeft\", scrollLeft);\n };\n this.getScrollLeft = function() {\n return this.$scrollLeft;\n };\n this.getScreenWidth = function() {\n this.$computeWidth();\n if (this.lineWidgets) \n return Math.max(this.getLineWidgetMaxWidth(), this.screenWidth);\n return this.screenWidth;\n };\n \n this.getLineWidgetMaxWidth = function() {\n if (this.lineWidgetsWidth != null) return this.lineWidgetsWidth;\n var width = 0;\n this.lineWidgets.forEach(function(w) {\n if (w && w.screenWidth > width)\n width = w.screenWidth;\n });\n return this.lineWidgetWidth = width;\n };\n\n this.$computeWidth = function(force) {\n if (this.$modified || force) {\n this.$modified = false;\n\n if (this.$useWrapMode)\n return this.screenWidth = this.$wrapLimit;\n\n var lines = this.doc.getAllLines();\n var cache = this.$rowLengthCache;\n var longestScreenLine = 0;\n var foldIndex = 0;\n var foldLine = this.$foldData[foldIndex];\n var foldStart = foldLine ? foldLine.start.row : Infinity;\n var len = lines.length;\n\n for (var i = 0; i < len; i++) {\n if (i > foldStart) {\n i = foldLine.end.row + 1;\n if (i >= len)\n break;\n foldLine = this.$foldData[foldIndex++];\n foldStart = foldLine ? foldLine.start.row : Infinity;\n }\n\n if (cache[i] == null)\n cache[i] = this.$getStringScreenWidth(lines[i])[0];\n\n if (cache[i] > longestScreenLine)\n longestScreenLine = cache[i];\n }\n this.screenWidth = longestScreenLine;\n }\n };\n this.getLine = function(row) {\n return this.doc.getLine(row);\n };\n this.getLines = function(firstRow, lastRow) {\n return this.doc.getLines(firstRow, lastRow);\n };\n this.getLength = function() {\n return this.doc.getLength();\n };\n this.getTextRange = function(range) {\n return this.doc.getTextRange(range || this.selection.getRange());\n };\n this.insert = function(position, text) {\n return this.doc.insert(position, text);\n };\n this.remove = function(range) {\n return this.doc.remove(range);\n };\n this.removeFullLines = function(firstRow, lastRow){\n return this.doc.removeFullLines(firstRow, lastRow);\n };\n this.undoChanges = function(deltas, dontSelect) {\n if (!deltas.length)\n return;\n\n this.$fromUndo = true;\n var lastUndoRange = null;\n for (var i = deltas.length - 1; i != -1; i--) {\n var delta = deltas[i];\n if (delta.group == \"doc\") {\n this.doc.revertDeltas(delta.deltas);\n lastUndoRange =\n this.$getUndoSelection(delta.deltas, true, lastUndoRange);\n } else {\n delta.deltas.forEach(function(foldDelta) {\n this.addFolds(foldDelta.folds);\n }, this);\n }\n }\n this.$fromUndo = false;\n lastUndoRange &&\n this.$undoSelect &&\n !dontSelect &&\n this.selection.setSelectionRange(lastUndoRange);\n return lastUndoRange;\n };\n this.redoChanges = function(deltas, dontSelect) {\n if (!deltas.length)\n return;\n\n this.$fromUndo = true;\n var lastUndoRange = null;\n for (var i = 0; i < deltas.length; i++) {\n var delta = deltas[i];\n if (delta.group == \"doc\") {\n this.doc.applyDeltas(delta.deltas);\n lastUndoRange =\n this.$getUndoSelection(delta.deltas, false, lastUndoRange);\n }\n }\n this.$fromUndo = false;\n lastUndoRange &&\n this.$undoSelect &&\n !dontSelect &&\n this.selection.setSelectionRange(lastUndoRange);\n return lastUndoRange;\n };\n this.setUndoSelect = function(enable) {\n this.$undoSelect = enable;\n };\n\n this.$getUndoSelection = function(deltas, isUndo, lastUndoRange) {\n function isInsert(delta) {\n return isUndo ? delta.action !== \"insert\" : delta.action === \"insert\";\n }\n\n var delta = deltas[0];\n var range, point;\n var lastDeltaIsInsert = false;\n if (isInsert(delta)) {\n range = Range.fromPoints(delta.start, delta.end);\n lastDeltaIsInsert = true;\n } else {\n range = Range.fromPoints(delta.start, delta.start);\n lastDeltaIsInsert = false;\n }\n\n for (var i = 1; i < deltas.length; i++) {\n delta = deltas[i];\n if (isInsert(delta)) {\n point = delta.start;\n if (range.compare(point.row, point.column) == -1) {\n range.setStart(point);\n }\n point = delta.end;\n if (range.compare(point.row, point.column) == 1) {\n range.setEnd(point);\n }\n lastDeltaIsInsert = true;\n } else {\n point = delta.start;\n if (range.compare(point.row, point.column) == -1) {\n range = Range.fromPoints(delta.start, delta.start);\n }\n lastDeltaIsInsert = false;\n }\n }\n if (lastUndoRange != null) {\n if (Range.comparePoints(lastUndoRange.start, range.start) === 0) {\n lastUndoRange.start.column += range.end.column - range.start.column;\n lastUndoRange.end.column += range.end.column - range.start.column;\n }\n\n var cmp = lastUndoRange.compareRange(range);\n if (cmp == 1) {\n range.setStart(lastUndoRange.start);\n } else if (cmp == -1) {\n range.setEnd(lastUndoRange.end);\n }\n }\n\n return range;\n };\n this.replace = function(range, text) {\n return this.doc.replace(range, text);\n };\n this.moveText = function(fromRange, toPosition, copy) {\n var text = this.getTextRange(fromRange);\n var folds = this.getFoldsInRange(fromRange);\n\n var toRange = Range.fromPoints(toPosition, toPosition);\n if (!copy) {\n this.remove(fromRange);\n var rowDiff = fromRange.start.row - fromRange.end.row;\n var collDiff = rowDiff ? -fromRange.end.column : fromRange.start.column - fromRange.end.column;\n if (collDiff) {\n if (toRange.start.row == fromRange.end.row && toRange.start.column > fromRange.end.column)\n toRange.start.column += collDiff;\n if (toRange.end.row == fromRange.end.row && toRange.end.column > fromRange.end.column)\n toRange.end.column += collDiff;\n }\n if (rowDiff && toRange.start.row >= fromRange.end.row) {\n toRange.start.row += rowDiff;\n toRange.end.row += rowDiff;\n }\n }\n\n toRange.end = this.insert(toRange.start, text);\n if (folds.length) {\n var oldStart = fromRange.start;\n var newStart = toRange.start;\n var rowDiff = newStart.row - oldStart.row;\n var collDiff = newStart.column - oldStart.column;\n this.addFolds(folds.map(function(x) {\n x = x.clone();\n if (x.start.row == oldStart.row)\n x.start.column += collDiff;\n if (x.end.row == oldStart.row)\n x.end.column += collDiff;\n x.start.row += rowDiff;\n x.end.row += rowDiff;\n return x;\n }));\n }\n\n return toRange;\n };\n this.indentRows = function(startRow, endRow, indentString) {\n indentString = indentString.replace(/\\t/g, this.getTabString());\n for (var row=startRow; row<=endRow; row++)\n this.doc.insertInLine({row: row, column: 0}, indentString);\n };\n this.outdentRows = function (range) {\n var rowRange = range.collapseRows();\n var deleteRange = new Range(0, 0, 0, 0);\n var size = this.getTabSize();\n\n for (var i = rowRange.start.row; i <= rowRange.end.row; ++i) {\n var line = this.getLine(i);\n\n deleteRange.start.row = i;\n deleteRange.end.row = i;\n for (var j = 0; j < size; ++j)\n if (line.charAt(j) != ' ')\n break;\n if (j < size && line.charAt(j) == '\\t') {\n deleteRange.start.column = j;\n deleteRange.end.column = j + 1;\n } else {\n deleteRange.start.column = 0;\n deleteRange.end.column = j;\n }\n this.remove(deleteRange);\n }\n };\n\n this.$moveLines = function(firstRow, lastRow, dir) {\n firstRow = this.getRowFoldStart(firstRow);\n lastRow = this.getRowFoldEnd(lastRow);\n if (dir < 0) {\n var row = this.getRowFoldStart(firstRow + dir);\n if (row < 0) return 0;\n var diff = row-firstRow;\n } else if (dir > 0) {\n var row = this.getRowFoldEnd(lastRow + dir);\n if (row > this.doc.getLength()-1) return 0;\n var diff = row-lastRow;\n } else {\n firstRow = this.$clipRowToDocument(firstRow);\n lastRow = this.$clipRowToDocument(lastRow);\n var diff = lastRow - firstRow + 1;\n }\n\n var range = new Range(firstRow, 0, lastRow, Number.MAX_VALUE);\n var folds = this.getFoldsInRange(range).map(function(x){\n x = x.clone();\n x.start.row += diff;\n x.end.row += diff;\n return x;\n });\n \n var lines = dir == 0\n ? this.doc.getLines(firstRow, lastRow)\n : this.doc.removeFullLines(firstRow, lastRow);\n this.doc.insertFullLines(firstRow+diff, lines);\n folds.length && this.addFolds(folds);\n return diff;\n };\n this.moveLinesUp = function(firstRow, lastRow) {\n return this.$moveLines(firstRow, lastRow, -1);\n };\n this.moveLinesDown = function(firstRow, lastRow) {\n return this.$moveLines(firstRow, lastRow, 1);\n };\n this.duplicateLines = function(firstRow, lastRow) {\n return this.$moveLines(firstRow, lastRow, 0);\n };\n\n\n this.$clipRowToDocument = function(row) {\n return Math.max(0, Math.min(row, this.doc.getLength()-1));\n };\n\n this.$clipColumnToRow = function(row, column) {\n if (column < 0)\n return 0;\n return Math.min(this.doc.getLine(row).length, column);\n };\n\n\n this.$clipPositionToDocument = function(row, column) {\n column = Math.max(0, column);\n\n if (row < 0) {\n row = 0;\n column = 0;\n } else {\n var len = this.doc.getLength();\n if (row >= len) {\n row = len - 1;\n column = this.doc.getLine(len-1).length;\n } else {\n column = Math.min(this.doc.getLine(row).length, column);\n }\n }\n\n return {\n row: row,\n column: column\n };\n };\n\n this.$clipRangeToDocument = function(range) {\n if (range.start.row < 0) {\n range.start.row = 0;\n range.start.column = 0;\n } else {\n range.start.column = this.$clipColumnToRow(\n range.start.row,\n range.start.column\n );\n }\n\n var len = this.doc.getLength() - 1;\n if (range.end.row > len) {\n range.end.row = len;\n range.end.column = this.doc.getLine(len).length;\n } else {\n range.end.column = this.$clipColumnToRow(\n range.end.row,\n range.end.column\n );\n }\n return range;\n };\n this.$wrapLimit = 80;\n this.$useWrapMode = false;\n this.$wrapLimitRange = {\n min : null,\n max : null\n };\n this.setUseWrapMode = function(useWrapMode) {\n if (useWrapMode != this.$useWrapMode) {\n this.$useWrapMode = useWrapMode;\n this.$modified = true;\n this.$resetRowCache(0);\n if (useWrapMode) {\n var len = this.getLength();\n this.$wrapData = Array(len);\n this.$updateWrapData(0, len - 1);\n }\n\n this._signal(\"changeWrapMode\");\n }\n };\n this.getUseWrapMode = function() {\n return this.$useWrapMode;\n };\n this.setWrapLimitRange = function(min, max) {\n if (this.$wrapLimitRange.min !== min || this.$wrapLimitRange.max !== max) {\n this.$wrapLimitRange = { min: min, max: max };\n this.$modified = true;\n this.$bidiHandler.markAsDirty();\n if (this.$useWrapMode)\n this._signal(\"changeWrapMode\");\n }\n };\n this.adjustWrapLimit = function(desiredLimit, $printMargin) {\n var limits = this.$wrapLimitRange;\n if (limits.max < 0)\n limits = {min: $printMargin, max: $printMargin};\n var wrapLimit = this.$constrainWrapLimit(desiredLimit, limits.min, limits.max);\n if (wrapLimit != this.$wrapLimit && wrapLimit > 1) {\n this.$wrapLimit = wrapLimit;\n this.$modified = true;\n if (this.$useWrapMode) {\n this.$updateWrapData(0, this.getLength() - 1);\n this.$resetRowCache(0);\n this._signal(\"changeWrapLimit\");\n }\n return true;\n }\n return false;\n };\n\n this.$constrainWrapLimit = function(wrapLimit, min, max) {\n if (min)\n wrapLimit = Math.max(min, wrapLimit);\n\n if (max)\n wrapLimit = Math.min(max, wrapLimit);\n\n return wrapLimit;\n };\n this.getWrapLimit = function() {\n return this.$wrapLimit;\n };\n this.setWrapLimit = function (limit) {\n this.setWrapLimitRange(limit, limit);\n };\n this.getWrapLimitRange = function() {\n return {\n min : this.$wrapLimitRange.min,\n max : this.$wrapLimitRange.max\n };\n };\n\n this.$updateInternalDataOnChange = function(delta) {\n var useWrapMode = this.$useWrapMode;\n var action = delta.action;\n var start = delta.start;\n var end = delta.end;\n var firstRow = start.row;\n var lastRow = end.row;\n var len = lastRow - firstRow;\n var removedFolds = null;\n \n this.$updating = true;\n if (len != 0) {\n if (action === \"remove\") {\n this[useWrapMode ? \"$wrapData\" : \"$rowLengthCache\"].splice(firstRow, len);\n\n var foldLines = this.$foldData;\n removedFolds = this.getFoldsInRange(delta);\n this.removeFolds(removedFolds);\n\n var foldLine = this.getFoldLine(end.row);\n var idx = 0;\n if (foldLine) {\n foldLine.addRemoveChars(end.row, end.column, start.column - end.column);\n foldLine.shiftRow(-len);\n\n var foldLineBefore = this.getFoldLine(firstRow);\n if (foldLineBefore && foldLineBefore !== foldLine) {\n foldLineBefore.merge(foldLine);\n foldLine = foldLineBefore;\n }\n idx = foldLines.indexOf(foldLine) + 1;\n }\n\n for (idx; idx < foldLines.length; idx++) {\n var foldLine = foldLines[idx];\n if (foldLine.start.row >= end.row) {\n foldLine.shiftRow(-len);\n }\n }\n\n lastRow = firstRow;\n } else {\n var args = Array(len);\n args.unshift(firstRow, 0);\n var arr = useWrapMode ? this.$wrapData : this.$rowLengthCache;\n arr.splice.apply(arr, args);\n var foldLines = this.$foldData;\n var foldLine = this.getFoldLine(firstRow);\n var idx = 0;\n if (foldLine) {\n var cmp = foldLine.range.compareInside(start.row, start.column);\n if (cmp == 0) {\n foldLine = foldLine.split(start.row, start.column);\n if (foldLine) {\n foldLine.shiftRow(len);\n foldLine.addRemoveChars(lastRow, 0, end.column - start.column);\n }\n } else\n if (cmp == -1) {\n foldLine.addRemoveChars(firstRow, 0, end.column - start.column);\n foldLine.shiftRow(len);\n }\n idx = foldLines.indexOf(foldLine) + 1;\n }\n\n for (idx; idx < foldLines.length; idx++) {\n var foldLine = foldLines[idx];\n if (foldLine.start.row >= firstRow) {\n foldLine.shiftRow(len);\n }\n }\n }\n } else {\n len = Math.abs(delta.start.column - delta.end.column);\n if (action === \"remove\") {\n removedFolds = this.getFoldsInRange(delta);\n this.removeFolds(removedFolds);\n\n len = -len;\n }\n var foldLine = this.getFoldLine(firstRow);\n if (foldLine) {\n foldLine.addRemoveChars(firstRow, start.column, len);\n }\n }\n\n if (useWrapMode && this.$wrapData.length != this.doc.getLength()) {\n console.error(\"doc.getLength() and $wrapData.length have to be the same!\");\n }\n this.$updating = false;\n\n if (useWrapMode)\n this.$updateWrapData(firstRow, lastRow);\n else\n this.$updateRowLengthCache(firstRow, lastRow);\n\n return removedFolds;\n };\n\n this.$updateRowLengthCache = function(firstRow, lastRow, b) {\n this.$rowLengthCache[firstRow] = null;\n this.$rowLengthCache[lastRow] = null;\n };\n\n this.$updateWrapData = function(firstRow, lastRow) {\n var lines = this.doc.getAllLines();\n var tabSize = this.getTabSize();\n var wrapData = this.$wrapData;\n var wrapLimit = this.$wrapLimit;\n var tokens;\n var foldLine;\n\n var row = firstRow;\n lastRow = Math.min(lastRow, lines.length - 1);\n while (row <= lastRow) {\n foldLine = this.getFoldLine(row, foldLine);\n if (!foldLine) {\n tokens = this.$getDisplayTokens(lines[row]);\n wrapData[row] = this.$computeWrapSplits(tokens, wrapLimit, tabSize);\n row ++;\n } else {\n tokens = [];\n foldLine.walk(function(placeholder, row, column, lastColumn) {\n var walkTokens;\n if (placeholder != null) {\n walkTokens = this.$getDisplayTokens(\n placeholder, tokens.length);\n walkTokens[0] = PLACEHOLDER_START;\n for (var i = 1; i < walkTokens.length; i++) {\n walkTokens[i] = PLACEHOLDER_BODY;\n }\n } else {\n walkTokens = this.$getDisplayTokens(\n lines[row].substring(lastColumn, column),\n tokens.length);\n }\n tokens = tokens.concat(walkTokens);\n }.bind(this),\n foldLine.end.row,\n lines[foldLine.end.row].length + 1\n );\n\n wrapData[foldLine.start.row] = this.$computeWrapSplits(tokens, wrapLimit, tabSize);\n row = foldLine.end.row + 1;\n }\n }\n };\n var CHAR = 1,\n CHAR_EXT = 2,\n PLACEHOLDER_START = 3,\n PLACEHOLDER_BODY = 4,\n PUNCTUATION = 9,\n SPACE = 10,\n TAB = 11,\n TAB_SPACE = 12;\n\n\n this.$computeWrapSplits = function(tokens, wrapLimit, tabSize) {\n if (tokens.length == 0) {\n return [];\n }\n\n var splits = [];\n var displayLength = tokens.length;\n var lastSplit = 0, lastDocSplit = 0;\n\n var isCode = this.$wrapAsCode;\n\n var indentedSoftWrap = this.$indentedSoftWrap;\n var maxIndent = wrapLimit <= Math.max(2 * tabSize, 8)\n || indentedSoftWrap === false ? 0 : Math.floor(wrapLimit / 2);\n\n function getWrapIndent() {\n var indentation = 0;\n if (maxIndent === 0)\n return indentation;\n if (indentedSoftWrap) {\n for (var i = 0; i < tokens.length; i++) {\n var token = tokens[i];\n if (token == SPACE)\n indentation += 1;\n else if (token == TAB)\n indentation += tabSize;\n else if (token == TAB_SPACE)\n continue;\n else\n break;\n }\n }\n if (isCode && indentedSoftWrap !== false)\n indentation += tabSize;\n return Math.min(indentation, maxIndent);\n }\n function addSplit(screenPos) {\n var displayed = tokens.slice(lastSplit, screenPos);\n var len = displayed.length;\n displayed.join(\"\")\n .replace(/12/g, function() {\n len -= 1;\n })\n .replace(/2/g, function() {\n len -= 1;\n });\n\n if (!splits.length) {\n indent = getWrapIndent();\n splits.indent = indent;\n }\n lastDocSplit += len;\n splits.push(lastDocSplit);\n lastSplit = screenPos;\n }\n var indent = 0;\n while (displayLength - lastSplit > wrapLimit - indent) {\n var split = lastSplit + wrapLimit - indent;\n if (tokens[split - 1] >= SPACE && tokens[split] >= SPACE) {\n addSplit(split);\n continue;\n }\n if (tokens[split] == PLACEHOLDER_START || tokens[split] == PLACEHOLDER_BODY) {\n for (split; split != lastSplit - 1; split--) {\n if (tokens[split] == PLACEHOLDER_START) {\n break;\n }\n }\n if (split > lastSplit) {\n addSplit(split);\n continue;\n }\n split = lastSplit + wrapLimit;\n for (split; split < tokens.length; split++) {\n if (tokens[split] != PLACEHOLDER_BODY) {\n break;\n }\n }\n if (split == tokens.length) {\n break; // Breaks the while-loop.\n }\n addSplit(split);\n continue;\n }\n var minSplit = Math.max(split - (wrapLimit -(wrapLimit>>2)), lastSplit - 1);\n while (split > minSplit && tokens[split] < PLACEHOLDER_START) {\n split --;\n }\n if (isCode) {\n while (split > minSplit && tokens[split] < PLACEHOLDER_START) {\n split --;\n }\n while (split > minSplit && tokens[split] == PUNCTUATION) {\n split --;\n }\n } else {\n while (split > minSplit && tokens[split] < SPACE) {\n split --;\n }\n }\n if (split > minSplit) {\n addSplit(++split);\n continue;\n }\n split = lastSplit + wrapLimit;\n if (tokens[split] == CHAR_EXT)\n split--;\n addSplit(split - indent);\n }\n return splits;\n };\n this.$getDisplayTokens = function(str, offset) {\n var arr = [];\n var tabSize;\n offset = offset || 0;\n\n for (var i = 0; i < str.length; i++) {\n var c = str.charCodeAt(i);\n if (c == 9) {\n tabSize = this.getScreenTabSize(arr.length + offset);\n arr.push(TAB);\n for (var n = 1; n < tabSize; n++) {\n arr.push(TAB_SPACE);\n }\n }\n else if (c == 32) {\n arr.push(SPACE);\n } else if((c > 39 && c < 48) || (c > 57 && c < 64)) {\n arr.push(PUNCTUATION);\n }\n else if (c >= 0x1100 && isFullWidth(c)) {\n arr.push(CHAR, CHAR_EXT);\n } else {\n arr.push(CHAR);\n }\n }\n return arr;\n };\n this.$getStringScreenWidth = function(str, maxScreenColumn, screenColumn) {\n if (maxScreenColumn == 0)\n return [0, 0];\n if (maxScreenColumn == null)\n maxScreenColumn = Infinity;\n screenColumn = screenColumn || 0;\n\n var c, column;\n for (column = 0; column < str.length; column++) {\n c = str.charCodeAt(column);\n if (c == 9) {\n screenColumn += this.getScreenTabSize(screenColumn);\n }\n else if (c >= 0x1100 && isFullWidth(c)) {\n screenColumn += 2;\n } else {\n screenColumn += 1;\n }\n if (screenColumn > maxScreenColumn) {\n break;\n }\n }\n\n return [screenColumn, column];\n };\n\n this.lineWidgets = null;\n this.getRowLength = function(row) {\n if (this.lineWidgets)\n var h = this.lineWidgets[row] && this.lineWidgets[row].rowCount || 0;\n else \n h = 0;\n if (!this.$useWrapMode || !this.$wrapData[row]) {\n return 1 + h;\n } else {\n return this.$wrapData[row].length + 1 + h;\n }\n };\n this.getRowLineCount = function(row) {\n if (!this.$useWrapMode || !this.$wrapData[row]) {\n return 1;\n } else {\n return this.$wrapData[row].length + 1;\n }\n };\n\n this.getRowWrapIndent = function(screenRow) {\n if (this.$useWrapMode) {\n var pos = this.screenToDocumentPosition(screenRow, Number.MAX_VALUE);\n var splits = this.$wrapData[pos.row];\n return splits.length && splits[0] < pos.column ? splits.indent : 0;\n } else {\n return 0;\n }\n };\n this.getScreenLastRowColumn = function(screenRow) {\n var pos = this.screenToDocumentPosition(screenRow, Number.MAX_VALUE);\n return this.documentToScreenColumn(pos.row, pos.column);\n };\n this.getDocumentLastRowColumn = function(docRow, docColumn) {\n var screenRow = this.documentToScreenRow(docRow, docColumn);\n return this.getScreenLastRowColumn(screenRow);\n };\n this.getDocumentLastRowColumnPosition = function(docRow, docColumn) {\n var screenRow = this.documentToScreenRow(docRow, docColumn);\n return this.screenToDocumentPosition(screenRow, Number.MAX_VALUE / 10);\n };\n this.getRowSplitData = function(row) {\n if (!this.$useWrapMode) {\n return undefined;\n } else {\n return this.$wrapData[row];\n }\n };\n this.getScreenTabSize = function(screenColumn) {\n return this.$tabSize - screenColumn % this.$tabSize;\n };\n\n\n this.screenToDocumentRow = function(screenRow, screenColumn) {\n return this.screenToDocumentPosition(screenRow, screenColumn).row;\n };\n\n\n this.screenToDocumentColumn = function(screenRow, screenColumn) {\n return this.screenToDocumentPosition(screenRow, screenColumn).column;\n };\n this.screenToDocumentPosition = function(screenRow, screenColumn, offsetX) {\n if (screenRow < 0)\n return {row: 0, column: 0};\n\n var line;\n var docRow = 0;\n var docColumn = 0;\n var column;\n var row = 0;\n var rowLength = 0;\n\n var rowCache = this.$screenRowCache;\n var i = this.$getRowCacheIndex(rowCache, screenRow);\n var l = rowCache.length;\n if (l && i >= 0) {\n var row = rowCache[i];\n var docRow = this.$docRowCache[i];\n var doCache = screenRow > rowCache[l - 1];\n } else {\n var doCache = !l;\n }\n\n var maxRow = this.getLength() - 1;\n var foldLine = this.getNextFoldLine(docRow);\n var foldStart = foldLine ? foldLine.start.row : Infinity;\n\n while (row <= screenRow) {\n rowLength = this.getRowLength(docRow);\n if (row + rowLength > screenRow || docRow >= maxRow) {\n break;\n } else {\n row += rowLength;\n docRow++;\n if (docRow > foldStart) {\n docRow = foldLine.end.row+1;\n foldLine = this.getNextFoldLine(docRow, foldLine);\n foldStart = foldLine ? foldLine.start.row : Infinity;\n }\n }\n\n if (doCache) {\n this.$docRowCache.push(docRow);\n this.$screenRowCache.push(row);\n }\n }\n\n if (foldLine && foldLine.start.row <= docRow) {\n line = this.getFoldDisplayLine(foldLine);\n docRow = foldLine.start.row;\n } else if (row + rowLength <= screenRow || docRow > maxRow) {\n return {\n row: maxRow,\n column: this.getLine(maxRow).length\n };\n } else {\n line = this.getLine(docRow);\n foldLine = null;\n }\n var wrapIndent = 0, splitIndex = Math.floor(screenRow - row);\n if (this.$useWrapMode) {\n var splits = this.$wrapData[docRow];\n if (splits) {\n column = splits[splitIndex];\n if(splitIndex > 0 && splits.length) {\n wrapIndent = splits.indent;\n docColumn = splits[splitIndex - 1] || splits[splits.length - 1];\n line = line.substring(docColumn);\n }\n }\n }\n\n if (offsetX !== undefined && this.$bidiHandler.isBidiRow(row + splitIndex, docRow, splitIndex))\n screenColumn = this.$bidiHandler.offsetToCol(offsetX);\n\n docColumn += this.$getStringScreenWidth(line, screenColumn - wrapIndent)[1];\n if (this.$useWrapMode && docColumn >= column)\n docColumn = column - 1;\n\n if (foldLine)\n return foldLine.idxToPosition(docColumn);\n\n return {row: docRow, column: docColumn};\n };\n this.documentToScreenPosition = function(docRow, docColumn) {\n if (typeof docColumn === \"undefined\")\n var pos = this.$clipPositionToDocument(docRow.row, docRow.column);\n else\n pos = this.$clipPositionToDocument(docRow, docColumn);\n\n docRow = pos.row;\n docColumn = pos.column;\n\n var screenRow = 0;\n var foldStartRow = null;\n var fold = null;\n fold = this.getFoldAt(docRow, docColumn, 1);\n if (fold) {\n docRow = fold.start.row;\n docColumn = fold.start.column;\n }\n\n var rowEnd, row = 0;\n\n\n var rowCache = this.$docRowCache;\n var i = this.$getRowCacheIndex(rowCache, docRow);\n var l = rowCache.length;\n if (l && i >= 0) {\n var row = rowCache[i];\n var screenRow = this.$screenRowCache[i];\n var doCache = docRow > rowCache[l - 1];\n } else {\n var doCache = !l;\n }\n\n var foldLine = this.getNextFoldLine(row);\n var foldStart = foldLine ?foldLine.start.row :Infinity;\n\n while (row < docRow) {\n if (row >= foldStart) {\n rowEnd = foldLine.end.row + 1;\n if (rowEnd > docRow)\n break;\n foldLine = this.getNextFoldLine(rowEnd, foldLine);\n foldStart = foldLine ?foldLine.start.row :Infinity;\n }\n else {\n rowEnd = row + 1;\n }\n\n screenRow += this.getRowLength(row);\n row = rowEnd;\n\n if (doCache) {\n this.$docRowCache.push(row);\n this.$screenRowCache.push(screenRow);\n }\n }\n var textLine = \"\";\n if (foldLine && row >= foldStart) {\n textLine = this.getFoldDisplayLine(foldLine, docRow, docColumn);\n foldStartRow = foldLine.start.row;\n } else {\n textLine = this.getLine(docRow).substring(0, docColumn);\n foldStartRow = docRow;\n }\n var wrapIndent = 0;\n if (this.$useWrapMode) {\n var wrapRow = this.$wrapData[foldStartRow];\n if (wrapRow) {\n var screenRowOffset = 0;\n while (textLine.length >= wrapRow[screenRowOffset]) {\n screenRow ++;\n screenRowOffset++;\n }\n textLine = textLine.substring(\n wrapRow[screenRowOffset - 1] || 0, textLine.length\n );\n wrapIndent = screenRowOffset > 0 ? wrapRow.indent : 0;\n }\n }\n\n return {\n row: screenRow,\n column: wrapIndent + this.$getStringScreenWidth(textLine)[0]\n };\n };\n this.documentToScreenColumn = function(row, docColumn) {\n return this.documentToScreenPosition(row, docColumn).column;\n };\n this.documentToScreenRow = function(docRow, docColumn) {\n return this.documentToScreenPosition(docRow, docColumn).row;\n };\n this.getScreenLength = function() {\n var screenRows = 0;\n var fold = null;\n if (!this.$useWrapMode) {\n screenRows = this.getLength();\n var foldData = this.$foldData;\n for (var i = 0; i < foldData.length; i++) {\n fold = foldData[i];\n screenRows -= fold.end.row - fold.start.row;\n }\n } else {\n var lastRow = this.$wrapData.length;\n var row = 0, i = 0;\n var fold = this.$foldData[i++];\n var foldStart = fold ? fold.start.row :Infinity;\n\n while (row < lastRow) {\n var splits = this.$wrapData[row];\n screenRows += splits ? splits.length + 1 : 1;\n row ++;\n if (row > foldStart) {\n row = fold.end.row+1;\n fold = this.$foldData[i++];\n foldStart = fold ?fold.start.row :Infinity;\n }\n }\n }\n if (this.lineWidgets)\n screenRows += this.$getWidgetScreenLength();\n\n return screenRows;\n };\n this.$setFontMetrics = function(fm) {\n if (!this.$enableVarChar) return;\n this.$getStringScreenWidth = function(str, maxScreenColumn, screenColumn) {\n if (maxScreenColumn === 0)\n return [0, 0];\n if (!maxScreenColumn)\n maxScreenColumn = Infinity;\n screenColumn = screenColumn || 0;\n \n var c, column;\n for (column = 0; column < str.length; column++) {\n c = str.charAt(column);\n if (c === \"\\t\") {\n screenColumn += this.getScreenTabSize(screenColumn);\n } else {\n screenColumn += fm.getCharacterWidth(c);\n }\n if (screenColumn > maxScreenColumn) {\n break;\n }\n }\n \n return [screenColumn, column];\n };\n };\n \n this.destroy = function() {\n if (this.bgTokenizer) {\n this.bgTokenizer.setDocument(null);\n this.bgTokenizer = null;\n }\n this.$stopWorker();\n };\n\n this.isFullWidth = isFullWidth;\n function isFullWidth(c) {\n if (c < 0x1100)\n return false;\n return c >= 0x1100 && c <= 0x115F ||\n c >= 0x11A3 && c <= 0x11A7 ||\n c >= 0x11FA && c <= 0x11FF ||\n c >= 0x2329 && c <= 0x232A ||\n c >= 0x2E80 && c <= 0x2E99 ||\n c >= 0x2E9B && c <= 0x2EF3 ||\n c >= 0x2F00 && c <= 0x2FD5 ||\n c >= 0x2FF0 && c <= 0x2FFB ||\n c >= 0x3000 && c <= 0x303E ||\n c >= 0x3041 && c <= 0x3096 ||\n c >= 0x3099 && c <= 0x30FF ||\n c >= 0x3105 && c <= 0x312D ||\n c >= 0x3131 && c <= 0x318E ||\n c >= 0x3190 && c <= 0x31BA ||\n c >= 0x31C0 && c <= 0x31E3 ||\n c >= 0x31F0 && c <= 0x321E ||\n c >= 0x3220 && c <= 0x3247 ||\n c >= 0x3250 && c <= 0x32FE ||\n c >= 0x3300 && c <= 0x4DBF ||\n c >= 0x4E00 && c <= 0xA48C ||\n c >= 0xA490 && c <= 0xA4C6 ||\n c >= 0xA960 && c <= 0xA97C ||\n c >= 0xAC00 && c <= 0xD7A3 ||\n c >= 0xD7B0 && c <= 0xD7C6 ||\n c >= 0xD7CB && c <= 0xD7FB ||\n c >= 0xF900 && c <= 0xFAFF ||\n c >= 0xFE10 && c <= 0xFE19 ||\n c >= 0xFE30 && c <= 0xFE52 ||\n c >= 0xFE54 && c <= 0xFE66 ||\n c >= 0xFE68 && c <= 0xFE6B ||\n c >= 0xFF01 && c <= 0xFF60 ||\n c >= 0xFFE0 && c <= 0xFFE6;\n }\n\n}).call(EditSession.prototype);\n\nacequire(\"./edit_session/folding\").Folding.call(EditSession.prototype);\nacequire(\"./edit_session/bracket_match\").BracketMatch.call(EditSession.prototype);\n\n\nconfig.defineOptions(EditSession.prototype, \"session\", {\n wrap: {\n set: function(value) {\n if (!value || value == \"off\")\n value = false;\n else if (value == \"free\")\n value = true;\n else if (value == \"printMargin\")\n value = -1;\n else if (typeof value == \"string\")\n value = parseInt(value, 10) || false;\n\n if (this.$wrap == value)\n return;\n this.$wrap = value;\n if (!value) {\n this.setUseWrapMode(false);\n } else {\n var col = typeof value == \"number\" ? value : null;\n this.setWrapLimitRange(col, col);\n this.setUseWrapMode(true);\n }\n },\n get: function() {\n if (this.getUseWrapMode()) {\n if (this.$wrap == -1)\n return \"printMargin\";\n if (!this.getWrapLimitRange().min)\n return \"free\";\n return this.$wrap;\n }\n return \"off\";\n },\n handlesSet: true\n }, \n wrapMethod: {\n set: function(val) {\n val = val == \"auto\"\n ? this.$mode.type != \"text\"\n : val != \"text\";\n if (val != this.$wrapAsCode) {\n this.$wrapAsCode = val;\n if (this.$useWrapMode) {\n this.$modified = true;\n this.$resetRowCache(0);\n this.$updateWrapData(0, this.getLength() - 1);\n }\n }\n },\n initialValue: \"auto\"\n },\n indentedSoftWrap: { initialValue: true },\n firstLineNumber: {\n set: function() {this._signal(\"changeBreakpoint\");},\n initialValue: 1\n },\n useWorker: {\n set: function(useWorker) {\n this.$useWorker = useWorker;\n\n this.$stopWorker();\n if (useWorker)\n this.$startWorker();\n },\n initialValue: true\n },\n useSoftTabs: {initialValue: true},\n tabSize: {\n set: function(tabSize) {\n if (isNaN(tabSize) || this.$tabSize === tabSize) return;\n\n this.$modified = true;\n this.$rowLengthCache = [];\n this.$tabSize = tabSize;\n this._signal(\"changeTabSize\");\n },\n initialValue: 4,\n handlesSet: true\n },\n navigateWithinSoftTabs: {initialValue: false},\n overwrite: {\n set: function(val) {this._signal(\"changeOverwrite\");},\n initialValue: false\n },\n newLineMode: {\n set: function(val) {this.doc.setNewLineMode(val);},\n get: function() {return this.doc.getNewLineMode();},\n handlesSet: true\n },\n mode: {\n set: function(val) { this.setMode(val); },\n get: function() { return this.$modeId; }\n }\n});\n\nexports.EditSession = EditSession;\n});\n\nace.define(\"ace/search\",[\"require\",\"exports\",\"module\",\"ace/lib/lang\",\"ace/lib/oop\",\"ace/range\"], function(acequire, exports, module) {\n\"use strict\";\n\nvar lang = acequire(\"./lib/lang\");\nvar oop = acequire(\"./lib/oop\");\nvar Range = acequire(\"./range\").Range;\n\nvar Search = function() {\n this.$options = {};\n};\n\n(function() {\n this.set = function(options) {\n oop.mixin(this.$options, options);\n return this;\n };\n this.getOptions = function() {\n return lang.copyObject(this.$options);\n };\n this.setOptions = function(options) {\n this.$options = options;\n };\n this.find = function(session) {\n var options = this.$options;\n var iterator = this.$matchIterator(session, options);\n if (!iterator)\n return false;\n\n var firstRange = null;\n iterator.forEach(function(sr, sc, er, ec) {\n firstRange = new Range(sr, sc, er, ec);\n if (sc == ec && options.start && options.start.start\n && options.skipCurrent != false && firstRange.isEqual(options.start)\n ) {\n firstRange = null;\n return false;\n }\n\n return true;\n });\n\n return firstRange;\n };\n this.findAll = function(session) {\n var options = this.$options;\n if (!options.needle)\n return [];\n this.$assembleRegExp(options);\n\n var range = options.range;\n var lines = range\n ? session.getLines(range.start.row, range.end.row)\n : session.doc.getAllLines();\n\n var ranges = [];\n var re = options.re;\n if (options.$isMultiLine) {\n var len = re.length;\n var maxRow = lines.length - len;\n var prevRange;\n outer: for (var row = re.offset || 0; row <= maxRow; row++) {\n for (var j = 0; j < len; j++)\n if (lines[row + j].search(re[j]) == -1)\n continue outer;\n \n var startLine = lines[row];\n var line = lines[row + len - 1];\n var startIndex = startLine.length - startLine.match(re[0])[0].length;\n var endIndex = line.match(re[len - 1])[0].length;\n \n if (prevRange && prevRange.end.row === row &&\n prevRange.end.column > startIndex\n ) {\n continue;\n }\n ranges.push(prevRange = new Range(\n row, startIndex, row + len - 1, endIndex\n ));\n if (len > 2)\n row = row + len - 2;\n }\n } else {\n for (var i = 0; i < lines.length; i++) {\n var matches = lang.getMatchOffsets(lines[i], re);\n for (var j = 0; j < matches.length; j++) {\n var match = matches[j];\n ranges.push(new Range(i, match.offset, i, match.offset + match.length));\n }\n }\n }\n\n if (range) {\n var startColumn = range.start.column;\n var endColumn = range.start.column;\n var i = 0, j = ranges.length - 1;\n while (i < j && ranges[i].start.column < startColumn && ranges[i].start.row == range.start.row)\n i++;\n\n while (i < j && ranges[j].end.column > endColumn && ranges[j].end.row == range.end.row)\n j--;\n \n ranges = ranges.slice(i, j + 1);\n for (i = 0, j = ranges.length; i < j; i++) {\n ranges[i].start.row += range.start.row;\n ranges[i].end.row += range.start.row;\n }\n }\n\n return ranges;\n };\n this.replace = function(input, replacement) {\n var options = this.$options;\n\n var re = this.$assembleRegExp(options);\n if (options.$isMultiLine)\n return replacement;\n\n if (!re)\n return;\n\n var match = re.exec(input);\n if (!match || match[0].length != input.length)\n return null;\n \n replacement = input.replace(re, replacement);\n if (options.preserveCase) {\n replacement = replacement.split(\"\");\n for (var i = Math.min(input.length, input.length); i--; ) {\n var ch = input[i];\n if (ch && ch.toLowerCase() != ch)\n replacement[i] = replacement[i].toUpperCase();\n else\n replacement[i] = replacement[i].toLowerCase();\n }\n replacement = replacement.join(\"\");\n }\n \n return replacement;\n };\n\n this.$assembleRegExp = function(options, $disableFakeMultiline) {\n if (options.needle instanceof RegExp)\n return options.re = options.needle;\n\n var needle = options.needle;\n\n if (!options.needle)\n return options.re = false;\n\n if (!options.regExp)\n needle = lang.escapeRegExp(needle);\n\n if (options.wholeWord)\n needle = addWordBoundary(needle, options);\n\n var modifier = options.caseSensitive ? \"gm\" : \"gmi\";\n\n options.$isMultiLine = !$disableFakeMultiline && /[\\n\\r]/.test(needle);\n if (options.$isMultiLine)\n return options.re = this.$assembleMultilineRegExp(needle, modifier);\n\n try {\n var re = new RegExp(needle, modifier);\n } catch(e) {\n re = false;\n }\n return options.re = re;\n };\n\n this.$assembleMultilineRegExp = function(needle, modifier) {\n var parts = needle.replace(/\\r\\n|\\r|\\n/g, \"$\\n^\").split(\"\\n\");\n var re = [];\n for (var i = 0; i < parts.length; i++) try {\n re.push(new RegExp(parts[i], modifier));\n } catch(e) {\n return false;\n }\n return re;\n };\n\n this.$matchIterator = function(session, options) {\n var re = this.$assembleRegExp(options);\n if (!re)\n return false;\n var backwards = options.backwards == true;\n var skipCurrent = options.skipCurrent != false;\n\n var range = options.range;\n var start = options.start;\n if (!start)\n start = range ? range[backwards ? \"end\" : \"start\"] : session.selection.getRange();\n \n if (start.start)\n start = start[skipCurrent != backwards ? \"end\" : \"start\"];\n\n var firstRow = range ? range.start.row : 0;\n var lastRow = range ? range.end.row : session.getLength() - 1;\n\n if (backwards) {\n var forEach = function(callback) {\n var row = start.row;\n if (forEachInLine(row, start.column, callback))\n return;\n for (row--; row >= firstRow; row--)\n if (forEachInLine(row, Number.MAX_VALUE, callback))\n return;\n if (options.wrap == false)\n return;\n for (row = lastRow, firstRow = start.row; row >= firstRow; row--)\n if (forEachInLine(row, Number.MAX_VALUE, callback))\n return;\n };\n }\n else {\n var forEach = function(callback) {\n var row = start.row;\n if (forEachInLine(row, start.column, callback))\n return;\n for (row = row + 1; row <= lastRow; row++)\n if (forEachInLine(row, 0, callback))\n return;\n if (options.wrap == false)\n return;\n for (row = firstRow, lastRow = start.row; row <= lastRow; row++)\n if (forEachInLine(row, 0, callback))\n return;\n };\n }\n \n if (options.$isMultiLine) {\n var len = re.length;\n var forEachInLine = function(row, offset, callback) {\n var startRow = backwards ? row - len + 1 : row;\n if (startRow < 0) return;\n var line = session.getLine(startRow);\n var startIndex = line.search(re[0]);\n if (!backwards && startIndex < offset || startIndex === -1) return;\n for (var i = 1; i < len; i++) {\n line = session.getLine(startRow + i);\n if (line.search(re[i]) == -1)\n return;\n }\n var endIndex = line.match(re[len - 1])[0].length;\n if (backwards && endIndex > offset) return;\n if (callback(startRow, startIndex, startRow + len - 1, endIndex))\n return true;\n };\n }\n else if (backwards) {\n var forEachInLine = function(row, endIndex, callback) {\n var line = session.getLine(row);\n var matches = [];\n var m, last = 0;\n re.lastIndex = 0;\n while((m = re.exec(line))) {\n var length = m[0].length;\n last = m.index;\n if (!length) {\n if (last >= line.length) break;\n re.lastIndex = last += 1;\n }\n if (m.index + length > endIndex)\n break;\n matches.push(m.index, length);\n }\n for (var i = matches.length - 1; i >= 0; i -= 2) {\n var column = matches[i - 1];\n var length = matches[i];\n if (callback(row, column, row, column + length))\n return true;\n }\n };\n }\n else {\n var forEachInLine = function(row, startIndex, callback) {\n var line = session.getLine(row);\n var m;\n var last = startIndex;\n re.lastIndex = startIndex;\n while((m = re.exec(line))) {\n var length = m[0].length;\n last = m.index;\n if (callback(row, last, row,last + length))\n return true;\n if (!length) {\n re.lastIndex = last += 1;\n if (last >= line.length) return false;\n }\n }\n };\n }\n return {forEach: forEach};\n };\n\n}).call(Search.prototype);\n\nfunction addWordBoundary(needle, options) {\n function wordBoundary(c) {\n if (/\\w/.test(c) || options.regExp) return \"\\\\b\";\n return \"\";\n }\n return wordBoundary(needle[0]) + needle\n + wordBoundary(needle[needle.length - 1]);\n}\n\nexports.Search = Search;\n});\n\nace.define(\"ace/keyboard/hash_handler\",[\"require\",\"exports\",\"module\",\"ace/lib/keys\",\"ace/lib/useragent\"], function(acequire, exports, module) {\n\"use strict\";\n\nvar keyUtil = acequire(\"../lib/keys\");\nvar useragent = acequire(\"../lib/useragent\");\nvar KEY_MODS = keyUtil.KEY_MODS;\n\nfunction HashHandler(config, platform) {\n this.platform = platform || (useragent.isMac ? \"mac\" : \"win\");\n this.commands = {};\n this.commandKeyBinding = {};\n this.addCommands(config);\n this.$singleCommand = true;\n}\n\nfunction MultiHashHandler(config, platform) {\n HashHandler.call(this, config, platform);\n this.$singleCommand = false;\n}\n\nMultiHashHandler.prototype = HashHandler.prototype;\n\n(function() {\n \n\n this.addCommand = function(command) {\n if (this.commands[command.name])\n this.removeCommand(command);\n\n this.commands[command.name] = command;\n\n if (command.bindKey)\n this._buildKeyHash(command);\n };\n\n this.removeCommand = function(command, keepCommand) {\n var name = command && (typeof command === 'string' ? command : command.name);\n command = this.commands[name];\n if (!keepCommand)\n delete this.commands[name];\n var ckb = this.commandKeyBinding;\n for (var keyId in ckb) {\n var cmdGroup = ckb[keyId];\n if (cmdGroup == command) {\n delete ckb[keyId];\n } else if (Array.isArray(cmdGroup)) {\n var i = cmdGroup.indexOf(command);\n if (i != -1) {\n cmdGroup.splice(i, 1);\n if (cmdGroup.length == 1)\n ckb[keyId] = cmdGroup[0];\n }\n }\n }\n };\n\n this.bindKey = function(key, command, position) {\n if (typeof key == \"object\" && key) {\n if (position == undefined)\n position = key.position;\n key = key[this.platform];\n }\n if (!key)\n return;\n if (typeof command == \"function\")\n return this.addCommand({exec: command, bindKey: key, name: command.name || key});\n \n key.split(\"|\").forEach(function(keyPart) {\n var chain = \"\";\n if (keyPart.indexOf(\" \") != -1) {\n var parts = keyPart.split(/\\s+/);\n keyPart = parts.pop();\n parts.forEach(function(keyPart) {\n var binding = this.parseKeys(keyPart);\n var id = KEY_MODS[binding.hashId] + binding.key;\n chain += (chain ? \" \" : \"\") + id;\n this._addCommandToBinding(chain, \"chainKeys\");\n }, this);\n chain += \" \";\n }\n var binding = this.parseKeys(keyPart);\n var id = KEY_MODS[binding.hashId] + binding.key;\n this._addCommandToBinding(chain + id, command, position);\n }, this);\n };\n \n function getPosition(command) {\n return typeof command == \"object\" && command.bindKey\n && command.bindKey.position\n || (command.isDefault ? -100 : 0);\n }\n this._addCommandToBinding = function(keyId, command, position) {\n var ckb = this.commandKeyBinding, i;\n if (!command) {\n delete ckb[keyId];\n } else if (!ckb[keyId] || this.$singleCommand) {\n ckb[keyId] = command;\n } else {\n if (!Array.isArray(ckb[keyId])) {\n ckb[keyId] = [ckb[keyId]];\n } else if ((i = ckb[keyId].indexOf(command)) != -1) {\n ckb[keyId].splice(i, 1);\n }\n\n if (typeof position != \"number\") {\n position = getPosition(command);\n }\n\n var commands = ckb[keyId];\n for (i = 0; i < commands.length; i++) {\n var other = commands[i];\n var otherPos = getPosition(other);\n if (otherPos > position)\n break;\n }\n commands.splice(i, 0, command);\n }\n };\n\n this.addCommands = function(commands) {\n commands && Object.keys(commands).forEach(function(name) {\n var command = commands[name];\n if (!command)\n return;\n \n if (typeof command === \"string\")\n return this.bindKey(command, name);\n\n if (typeof command === \"function\")\n command = { exec: command };\n\n if (typeof command !== \"object\")\n return;\n\n if (!command.name)\n command.name = name;\n\n this.addCommand(command);\n }, this);\n };\n\n this.removeCommands = function(commands) {\n Object.keys(commands).forEach(function(name) {\n this.removeCommand(commands[name]);\n }, this);\n };\n\n this.bindKeys = function(keyList) {\n Object.keys(keyList).forEach(function(key) {\n this.bindKey(key, keyList[key]);\n }, this);\n };\n\n this._buildKeyHash = function(command) {\n this.bindKey(command.bindKey, command);\n };\n this.parseKeys = function(keys) {\n var parts = keys.toLowerCase().split(/[\\-\\+]([\\-\\+])?/).filter(function(x){return x;});\n var key = parts.pop();\n\n var keyCode = keyUtil[key];\n if (keyUtil.FUNCTION_KEYS[keyCode])\n key = keyUtil.FUNCTION_KEYS[keyCode].toLowerCase();\n else if (!parts.length)\n return {key: key, hashId: -1};\n else if (parts.length == 1 && parts[0] == \"shift\")\n return {key: key.toUpperCase(), hashId: -1};\n\n var hashId = 0;\n for (var i = parts.length; i--;) {\n var modifier = keyUtil.KEY_MODS[parts[i]];\n if (modifier == null) {\n if (typeof console != \"undefined\")\n console.error(\"invalid modifier \" + parts[i] + \" in \" + keys);\n return false;\n }\n hashId |= modifier;\n }\n return {key: key, hashId: hashId};\n };\n\n this.findKeyCommand = function findKeyCommand(hashId, keyString) {\n var key = KEY_MODS[hashId] + keyString;\n return this.commandKeyBinding[key];\n };\n\n this.handleKeyboard = function(data, hashId, keyString, keyCode) {\n if (keyCode < 0) return;\n var key = KEY_MODS[hashId] + keyString;\n var command = this.commandKeyBinding[key];\n if (data.$keyChain) {\n data.$keyChain += \" \" + key;\n command = this.commandKeyBinding[data.$keyChain] || command;\n }\n \n if (command) {\n if (command == \"chainKeys\" || command[command.length - 1] == \"chainKeys\") {\n data.$keyChain = data.$keyChain || key;\n return {command: \"null\"};\n }\n }\n \n if (data.$keyChain) {\n if ((!hashId || hashId == 4) && keyString.length == 1)\n data.$keyChain = data.$keyChain.slice(0, -key.length - 1); // wait for input\n else if (hashId == -1 || keyCode > 0)\n data.$keyChain = \"\"; // reset keyChain\n }\n return {command: command};\n };\n \n this.getStatusText = function(editor, data) {\n return data.$keyChain || \"\";\n };\n\n}).call(HashHandler.prototype);\n\nexports.HashHandler = HashHandler;\nexports.MultiHashHandler = MultiHashHandler;\n});\n\nace.define(\"ace/commands/command_manager\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/keyboard/hash_handler\",\"ace/lib/event_emitter\"], function(acequire, exports, module) {\n\"use strict\";\n\nvar oop = acequire(\"../lib/oop\");\nvar MultiHashHandler = acequire(\"../keyboard/hash_handler\").MultiHashHandler;\nvar EventEmitter = acequire(\"../lib/event_emitter\").EventEmitter;\n\nvar CommandManager = function(platform, commands) {\n MultiHashHandler.call(this, commands, platform);\n this.byName = this.commands;\n this.setDefaultHandler(\"exec\", function(e) {\n return e.command.exec(e.editor, e.args || {});\n });\n};\n\noop.inherits(CommandManager, MultiHashHandler);\n\n(function() {\n\n oop.implement(this, EventEmitter);\n\n this.exec = function(command, editor, args) {\n if (Array.isArray(command)) {\n for (var i = command.length; i--; ) {\n if (this.exec(command[i], editor, args)) return true;\n }\n return false;\n }\n\n if (typeof command === \"string\")\n command = this.commands[command];\n\n if (!command)\n return false;\n\n if (editor && editor.$readOnly && !command.readOnly)\n return false;\n\n if (command.isAvailable && !command.isAvailable(editor))\n return false;\n\n var e = {editor: editor, command: command, args: args};\n e.returnValue = this._emit(\"exec\", e);\n this._signal(\"afterExec\", e);\n\n return e.returnValue === false ? false : true;\n };\n\n this.toggleRecording = function(editor) {\n if (this.$inReplay)\n return;\n\n editor && editor._emit(\"changeStatus\");\n if (this.recording) {\n this.macro.pop();\n this.removeEventListener(\"exec\", this.$addCommandToMacro);\n\n if (!this.macro.length)\n this.macro = this.oldMacro;\n\n return this.recording = false;\n }\n if (!this.$addCommandToMacro) {\n this.$addCommandToMacro = function(e) {\n this.macro.push([e.command, e.args]);\n }.bind(this);\n }\n\n this.oldMacro = this.macro;\n this.macro = [];\n this.on(\"exec\", this.$addCommandToMacro);\n return this.recording = true;\n };\n\n this.replay = function(editor) {\n if (this.$inReplay || !this.macro)\n return;\n\n if (this.recording)\n return this.toggleRecording(editor);\n\n try {\n this.$inReplay = true;\n this.macro.forEach(function(x) {\n if (typeof x == \"string\")\n this.exec(x, editor);\n else\n this.exec(x[0], editor, x[1]);\n }, this);\n } finally {\n this.$inReplay = false;\n }\n };\n\n this.trimMacro = function(m) {\n return m.map(function(x){\n if (typeof x[0] != \"string\")\n x[0] = x[0].name;\n if (!x[1])\n x = x[0];\n return x;\n });\n };\n\n}).call(CommandManager.prototype);\n\nexports.CommandManager = CommandManager;\n\n});\n\nace.define(\"ace/commands/default_commands\",[\"require\",\"exports\",\"module\",\"ace/lib/lang\",\"ace/config\",\"ace/range\"], function(acequire, exports, module) {\n\"use strict\";\n\nvar lang = acequire(\"../lib/lang\");\nvar config = acequire(\"../config\");\nvar Range = acequire(\"../range\").Range;\n\nfunction bindKey(win, mac) {\n return {win: win, mac: mac};\n}\nexports.commands = [{\n name: \"showSettingsMenu\",\n bindKey: bindKey(\"Ctrl-,\", \"Command-,\"),\n exec: function(editor) {\n config.loadModule(\"ace/ext/settings_menu\", function(module) {\n module.init(editor);\n editor.showSettingsMenu();\n });\n },\n readOnly: true\n}, {\n name: \"goToNextError\",\n bindKey: bindKey(\"Alt-E\", \"F4\"),\n exec: function(editor) {\n config.loadModule(\"ace/ext/error_marker\", function(module) {\n module.showErrorMarker(editor, 1);\n });\n },\n scrollIntoView: \"animate\",\n readOnly: true\n}, {\n name: \"goToPreviousError\",\n bindKey: bindKey(\"Alt-Shift-E\", \"Shift-F4\"),\n exec: function(editor) {\n config.loadModule(\"ace/ext/error_marker\", function(module) {\n module.showErrorMarker(editor, -1);\n });\n },\n scrollIntoView: \"animate\",\n readOnly: true\n}, {\n name: \"selectall\",\n bindKey: bindKey(\"Ctrl-A\", \"Command-A\"),\n exec: function(editor) { editor.selectAll(); },\n readOnly: true\n}, {\n name: \"centerselection\",\n bindKey: bindKey(null, \"Ctrl-L\"),\n exec: function(editor) { editor.centerSelection(); },\n readOnly: true\n}, {\n name: \"gotoline\",\n bindKey: bindKey(\"Ctrl-L\", \"Command-L\"),\n exec: function(editor) {\n var line = parseInt(prompt(\"Enter line number:\"), 10);\n if (!isNaN(line)) {\n editor.gotoLine(line);\n }\n },\n readOnly: true\n}, {\n name: \"fold\",\n bindKey: bindKey(\"Alt-L|Ctrl-F1\", \"Command-Alt-L|Command-F1\"),\n exec: function(editor) { editor.session.toggleFold(false); },\n multiSelectAction: \"forEach\",\n scrollIntoView: \"center\",\n readOnly: true\n}, {\n name: \"unfold\",\n bindKey: bindKey(\"Alt-Shift-L|Ctrl-Shift-F1\", \"Command-Alt-Shift-L|Command-Shift-F1\"),\n exec: function(editor) { editor.session.toggleFold(true); },\n multiSelectAction: \"forEach\",\n scrollIntoView: \"center\",\n readOnly: true\n}, {\n name: \"toggleFoldWidget\",\n bindKey: bindKey(\"F2\", \"F2\"),\n exec: function(editor) { editor.session.toggleFoldWidget(); },\n multiSelectAction: \"forEach\",\n scrollIntoView: \"center\",\n readOnly: true\n}, {\n name: \"toggleParentFoldWidget\",\n bindKey: bindKey(\"Alt-F2\", \"Alt-F2\"),\n exec: function(editor) { editor.session.toggleFoldWidget(true); },\n multiSelectAction: \"forEach\",\n scrollIntoView: \"center\",\n readOnly: true\n}, {\n name: \"foldall\",\n bindKey: bindKey(null, \"Ctrl-Command-Option-0\"),\n exec: function(editor) { editor.session.foldAll(); },\n scrollIntoView: \"center\",\n readOnly: true\n}, {\n name: \"foldOther\",\n bindKey: bindKey(\"Alt-0\", \"Command-Option-0\"),\n exec: function(editor) { \n editor.session.foldAll();\n editor.session.unfold(editor.selection.getAllRanges());\n },\n scrollIntoView: \"center\",\n readOnly: true\n}, {\n name: \"unfoldall\",\n bindKey: bindKey(\"Alt-Shift-0\", \"Command-Option-Shift-0\"),\n exec: function(editor) { editor.session.unfold(); },\n scrollIntoView: \"center\",\n readOnly: true\n}, {\n name: \"findnext\",\n bindKey: bindKey(\"Ctrl-K\", \"Command-G\"),\n exec: function(editor) { editor.findNext(); },\n multiSelectAction: \"forEach\",\n scrollIntoView: \"center\",\n readOnly: true\n}, {\n name: \"findprevious\",\n bindKey: bindKey(\"Ctrl-Shift-K\", \"Command-Shift-G\"),\n exec: function(editor) { editor.findPrevious(); },\n multiSelectAction: \"forEach\",\n scrollIntoView: \"center\",\n readOnly: true\n}, {\n name: \"selectOrFindNext\",\n bindKey: bindKey(\"Alt-K\", \"Ctrl-G\"),\n exec: function(editor) {\n if (editor.selection.isEmpty())\n editor.selection.selectWord();\n else\n editor.findNext(); \n },\n readOnly: true\n}, {\n name: \"selectOrFindPrevious\",\n bindKey: bindKey(\"Alt-Shift-K\", \"Ctrl-Shift-G\"),\n exec: function(editor) { \n if (editor.selection.isEmpty())\n editor.selection.selectWord();\n else\n editor.findPrevious();\n },\n readOnly: true\n}, {\n name: \"find\",\n bindKey: bindKey(\"Ctrl-F\", \"Command-F\"),\n exec: function(editor) {\n config.loadModule(\"ace/ext/searchbox\", function(e) {e.Search(editor);});\n },\n readOnly: true\n}, {\n name: \"overwrite\",\n bindKey: \"Insert\",\n exec: function(editor) { editor.toggleOverwrite(); },\n readOnly: true\n}, {\n name: \"selecttostart\",\n bindKey: bindKey(\"Ctrl-Shift-Home\", \"Command-Shift-Home|Command-Shift-Up\"),\n exec: function(editor) { editor.getSelection().selectFileStart(); },\n multiSelectAction: \"forEach\",\n readOnly: true,\n scrollIntoView: \"animate\",\n aceCommandGroup: \"fileJump\"\n}, {\n name: \"gotostart\",\n bindKey: bindKey(\"Ctrl-Home\", \"Command-Home|Command-Up\"),\n exec: function(editor) { editor.navigateFileStart(); },\n multiSelectAction: \"forEach\",\n readOnly: true,\n scrollIntoView: \"animate\",\n aceCommandGroup: \"fileJump\"\n}, {\n name: \"selectup\",\n bindKey: bindKey(\"Shift-Up\", \"Shift-Up|Ctrl-Shift-P\"),\n exec: function(editor) { editor.getSelection().selectUp(); },\n multiSelectAction: \"forEach\",\n scrollIntoView: \"cursor\",\n readOnly: true\n}, {\n name: \"golineup\",\n bindKey: bindKey(\"Up\", \"Up|Ctrl-P\"),\n exec: function(editor, args) { editor.navigateUp(args.times); },\n multiSelectAction: \"forEach\",\n scrollIntoView: \"cursor\",\n readOnly: true\n}, {\n name: \"selecttoend\",\n bindKey: bindKey(\"Ctrl-Shift-End\", \"Command-Shift-End|Command-Shift-Down\"),\n exec: function(editor) { editor.getSelection().selectFileEnd(); },\n multiSelectAction: \"forEach\",\n readOnly: true,\n scrollIntoView: \"animate\",\n aceCommandGroup: \"fileJump\"\n}, {\n name: \"gotoend\",\n bindKey: bindKey(\"Ctrl-End\", \"Command-End|Command-Down\"),\n exec: function(editor) { editor.navigateFileEnd(); },\n multiSelectAction: \"forEach\",\n readOnly: true,\n scrollIntoView: \"animate\",\n aceCommandGroup: \"fileJump\"\n}, {\n name: \"selectdown\",\n bindKey: bindKey(\"Shift-Down\", \"Shift-Down|Ctrl-Shift-N\"),\n exec: function(editor) { editor.getSelection().selectDown(); },\n multiSelectAction: \"forEach\",\n scrollIntoView: \"cursor\",\n readOnly: true\n}, {\n name: \"golinedown\",\n bindKey: bindKey(\"Down\", \"Down|Ctrl-N\"),\n exec: function(editor, args) { editor.navigateDown(args.times); },\n multiSelectAction: \"forEach\",\n scrollIntoView: \"cursor\",\n readOnly: true\n}, {\n name: \"selectwordleft\",\n bindKey: bindKey(\"Ctrl-Shift-Left\", \"Option-Shift-Left\"),\n exec: function(editor) { editor.getSelection().selectWordLeft(); },\n multiSelectAction: \"forEach\",\n scrollIntoView: \"cursor\",\n readOnly: true\n}, {\n name: \"gotowordleft\",\n bindKey: bindKey(\"Ctrl-Left\", \"Option-Left\"),\n exec: function(editor) { editor.navigateWordLeft(); },\n multiSelectAction: \"forEach\",\n scrollIntoView: \"cursor\",\n readOnly: true\n}, {\n name: \"selecttolinestart\",\n bindKey: bindKey(\"Alt-Shift-Left\", \"Command-Shift-Left|Ctrl-Shift-A\"),\n exec: function(editor) { editor.getSelection().selectLineStart(); },\n multiSelectAction: \"forEach\",\n scrollIntoView: \"cursor\",\n readOnly: true\n}, {\n name: \"gotolinestart\",\n bindKey: bindKey(\"Alt-Left|Home\", \"Command-Left|Home|Ctrl-A\"),\n exec: function(editor) { editor.navigateLineStart(); },\n multiSelectAction: \"forEach\",\n scrollIntoView: \"cursor\",\n readOnly: true\n}, {\n name: \"selectleft\",\n bindKey: bindKey(\"Shift-Left\", \"Shift-Left|Ctrl-Shift-B\"),\n exec: function(editor) { editor.getSelection().selectLeft(); },\n multiSelectAction: \"forEach\",\n scrollIntoView: \"cursor\",\n readOnly: true\n}, {\n name: \"gotoleft\",\n bindKey: bindKey(\"Left\", \"Left|Ctrl-B\"),\n exec: function(editor, args) { editor.navigateLeft(args.times); },\n multiSelectAction: \"forEach\",\n scrollIntoView: \"cursor\",\n readOnly: true\n}, {\n name: \"selectwordright\",\n bindKey: bindKey(\"Ctrl-Shift-Right\", \"Option-Shift-Right\"),\n exec: function(editor) { editor.getSelection().selectWordRight(); },\n multiSelectAction: \"forEach\",\n scrollIntoView: \"cursor\",\n readOnly: true\n}, {\n name: \"gotowordright\",\n bindKey: bindKey(\"Ctrl-Right\", \"Option-Right\"),\n exec: function(editor) { editor.navigateWordRight(); },\n multiSelectAction: \"forEach\",\n scrollIntoView: \"cursor\",\n readOnly: true\n}, {\n name: \"selecttolineend\",\n bindKey: bindKey(\"Alt-Shift-Right\", \"Command-Shift-Right|Shift-End|Ctrl-Shift-E\"),\n exec: function(editor) { editor.getSelection().selectLineEnd(); },\n multiSelectAction: \"forEach\",\n scrollIntoView: \"cursor\",\n readOnly: true\n}, {\n name: \"gotolineend\",\n bindKey: bindKey(\"Alt-Right|End\", \"Command-Right|End|Ctrl-E\"),\n exec: function(editor) { editor.navigateLineEnd(); },\n multiSelectAction: \"forEach\",\n scrollIntoView: \"cursor\",\n readOnly: true\n}, {\n name: \"selectright\",\n bindKey: bindKey(\"Shift-Right\", \"Shift-Right\"),\n exec: function(editor) { editor.getSelection().selectRight(); },\n multiSelectAction: \"forEach\",\n scrollIntoView: \"cursor\",\n readOnly: true\n}, {\n name: \"gotoright\",\n bindKey: bindKey(\"Right\", \"Right|Ctrl-F\"),\n exec: function(editor, args) { editor.navigateRight(args.times); },\n multiSelectAction: \"forEach\",\n scrollIntoView: \"cursor\",\n readOnly: true\n}, {\n name: \"selectpagedown\",\n bindKey: \"Shift-PageDown\",\n exec: function(editor) { editor.selectPageDown(); },\n readOnly: true\n}, {\n name: \"pagedown\",\n bindKey: bindKey(null, \"Option-PageDown\"),\n exec: function(editor) { editor.scrollPageDown(); },\n readOnly: true\n}, {\n name: \"gotopagedown\",\n bindKey: bindKey(\"PageDown\", \"PageDown|Ctrl-V\"),\n exec: function(editor) { editor.gotoPageDown(); },\n readOnly: true\n}, {\n name: \"selectpageup\",\n bindKey: \"Shift-PageUp\",\n exec: function(editor) { editor.selectPageUp(); },\n readOnly: true\n}, {\n name: \"pageup\",\n bindKey: bindKey(null, \"Option-PageUp\"),\n exec: function(editor) { editor.scrollPageUp(); },\n readOnly: true\n}, {\n name: \"gotopageup\",\n bindKey: \"PageUp\",\n exec: function(editor) { editor.gotoPageUp(); },\n readOnly: true\n}, {\n name: \"scrollup\",\n bindKey: bindKey(\"Ctrl-Up\", null),\n exec: function(e) { e.renderer.scrollBy(0, -2 * e.renderer.layerConfig.lineHeight); },\n readOnly: true\n}, {\n name: \"scrolldown\",\n bindKey: bindKey(\"Ctrl-Down\", null),\n exec: function(e) { e.renderer.scrollBy(0, 2 * e.renderer.layerConfig.lineHeight); },\n readOnly: true\n}, {\n name: \"selectlinestart\",\n bindKey: \"Shift-Home\",\n exec: function(editor) { editor.getSelection().selectLineStart(); },\n multiSelectAction: \"forEach\",\n scrollIntoView: \"cursor\",\n readOnly: true\n}, {\n name: \"selectlineend\",\n bindKey: \"Shift-End\",\n exec: function(editor) { editor.getSelection().selectLineEnd(); },\n multiSelectAction: \"forEach\",\n scrollIntoView: \"cursor\",\n readOnly: true\n}, {\n name: \"togglerecording\",\n bindKey: bindKey(\"Ctrl-Alt-E\", \"Command-Option-E\"),\n exec: function(editor) { editor.commands.toggleRecording(editor); },\n readOnly: true\n}, {\n name: \"replaymacro\",\n bindKey: bindKey(\"Ctrl-Shift-E\", \"Command-Shift-E\"),\n exec: function(editor) { editor.commands.replay(editor); },\n readOnly: true\n}, {\n name: \"jumptomatching\",\n bindKey: bindKey(\"Ctrl-P\", \"Ctrl-P\"),\n exec: function(editor) { editor.jumpToMatching(); },\n multiSelectAction: \"forEach\",\n scrollIntoView: \"animate\",\n readOnly: true\n}, {\n name: \"selecttomatching\",\n bindKey: bindKey(\"Ctrl-Shift-P\", \"Ctrl-Shift-P\"),\n exec: function(editor) { editor.jumpToMatching(true); },\n multiSelectAction: \"forEach\",\n scrollIntoView: \"animate\",\n readOnly: true\n}, {\n name: \"expandToMatching\",\n bindKey: bindKey(\"Ctrl-Shift-M\", \"Ctrl-Shift-M\"),\n exec: function(editor) { editor.jumpToMatching(true, true); },\n multiSelectAction: \"forEach\",\n scrollIntoView: \"animate\",\n readOnly: true\n}, {\n name: \"passKeysToBrowser\",\n bindKey: bindKey(null, null),\n exec: function() {},\n passEvent: true,\n readOnly: true\n}, {\n name: \"copy\",\n exec: function(editor) {\n },\n readOnly: true\n},\n{\n name: \"cut\",\n exec: function(editor) {\n var range = editor.getSelectionRange();\n editor._emit(\"cut\", range);\n\n if (!editor.selection.isEmpty()) {\n editor.session.remove(range);\n editor.clearSelection();\n }\n },\n scrollIntoView: \"cursor\",\n multiSelectAction: \"forEach\"\n}, {\n name: \"paste\",\n exec: function(editor, args) {\n editor.$handlePaste(args);\n },\n scrollIntoView: \"cursor\"\n}, {\n name: \"removeline\",\n bindKey: bindKey(\"Ctrl-D\", \"Command-D\"),\n exec: function(editor) { editor.removeLines(); },\n scrollIntoView: \"cursor\",\n multiSelectAction: \"forEachLine\"\n}, {\n name: \"duplicateSelection\",\n bindKey: bindKey(\"Ctrl-Shift-D\", \"Command-Shift-D\"),\n exec: function(editor) { editor.duplicateSelection(); },\n scrollIntoView: \"cursor\",\n multiSelectAction: \"forEach\"\n}, {\n name: \"sortlines\",\n bindKey: bindKey(\"Ctrl-Alt-S\", \"Command-Alt-S\"),\n exec: function(editor) { editor.sortLines(); },\n scrollIntoView: \"selection\",\n multiSelectAction: \"forEachLine\"\n}, {\n name: \"togglecomment\",\n bindKey: bindKey(\"Ctrl-/\", \"Command-/\"),\n exec: function(editor) { editor.toggleCommentLines(); },\n multiSelectAction: \"forEachLine\",\n scrollIntoView: \"selectionPart\"\n}, {\n name: \"toggleBlockComment\",\n bindKey: bindKey(\"Ctrl-Shift-/\", \"Command-Shift-/\"),\n exec: function(editor) { editor.toggleBlockComment(); },\n multiSelectAction: \"forEach\",\n scrollIntoView: \"selectionPart\"\n}, {\n name: \"modifyNumberUp\",\n bindKey: bindKey(\"Ctrl-Shift-Up\", \"Alt-Shift-Up\"),\n exec: function(editor) { editor.modifyNumber(1); },\n scrollIntoView: \"cursor\",\n multiSelectAction: \"forEach\"\n}, {\n name: \"modifyNumberDown\",\n bindKey: bindKey(\"Ctrl-Shift-Down\", \"Alt-Shift-Down\"),\n exec: function(editor) { editor.modifyNumber(-1); },\n scrollIntoView: \"cursor\",\n multiSelectAction: \"forEach\"\n}, {\n name: \"replace\",\n bindKey: bindKey(\"Ctrl-H\", \"Command-Option-F\"),\n exec: function(editor) {\n config.loadModule(\"ace/ext/searchbox\", function(e) {e.Search(editor, true);});\n }\n}, {\n name: \"undo\",\n bindKey: bindKey(\"Ctrl-Z\", \"Command-Z\"),\n exec: function(editor) { editor.undo(); }\n}, {\n name: \"redo\",\n bindKey: bindKey(\"Ctrl-Shift-Z|Ctrl-Y\", \"Command-Shift-Z|Command-Y\"),\n exec: function(editor) { editor.redo(); }\n}, {\n name: \"copylinesup\",\n bindKey: bindKey(\"Alt-Shift-Up\", \"Command-Option-Up\"),\n exec: function(editor) { editor.copyLinesUp(); },\n scrollIntoView: \"cursor\"\n}, {\n name: \"movelinesup\",\n bindKey: bindKey(\"Alt-Up\", \"Option-Up\"),\n exec: function(editor) { editor.moveLinesUp(); },\n scrollIntoView: \"cursor\"\n}, {\n name: \"copylinesdown\",\n bindKey: bindKey(\"Alt-Shift-Down\", \"Command-Option-Down\"),\n exec: function(editor) { editor.copyLinesDown(); },\n scrollIntoView: \"cursor\"\n}, {\n name: \"movelinesdown\",\n bindKey: bindKey(\"Alt-Down\", \"Option-Down\"),\n exec: function(editor) { editor.moveLinesDown(); },\n scrollIntoView: \"cursor\"\n}, {\n name: \"del\",\n bindKey: bindKey(\"Delete\", \"Delete|Ctrl-D|Shift-Delete\"),\n exec: function(editor) { editor.remove(\"right\"); },\n multiSelectAction: \"forEach\",\n scrollIntoView: \"cursor\"\n}, {\n name: \"backspace\",\n bindKey: bindKey(\n \"Shift-Backspace|Backspace\",\n \"Ctrl-Backspace|Shift-Backspace|Backspace|Ctrl-H\"\n ),\n exec: function(editor) { editor.remove(\"left\"); },\n multiSelectAction: \"forEach\",\n scrollIntoView: \"cursor\"\n}, {\n name: \"cut_or_delete\",\n bindKey: bindKey(\"Shift-Delete\", null),\n exec: function(editor) { \n if (editor.selection.isEmpty()) {\n editor.remove(\"left\");\n } else {\n return false;\n }\n },\n multiSelectAction: \"forEach\",\n scrollIntoView: \"cursor\"\n}, {\n name: \"removetolinestart\",\n bindKey: bindKey(\"Alt-Backspace\", \"Command-Backspace\"),\n exec: function(editor) { editor.removeToLineStart(); },\n multiSelectAction: \"forEach\",\n scrollIntoView: \"cursor\"\n}, {\n name: \"removetolineend\",\n bindKey: bindKey(\"Alt-Delete\", \"Ctrl-K|Command-Delete\"),\n exec: function(editor) { editor.removeToLineEnd(); },\n multiSelectAction: \"forEach\",\n scrollIntoView: \"cursor\"\n}, {\n name: \"removetolinestarthard\",\n bindKey: bindKey(\"Ctrl-Shift-Backspace\", null),\n exec: function(editor) {\n var range = editor.selection.getRange();\n range.start.column = 0;\n editor.session.remove(range);\n },\n multiSelectAction: \"forEach\",\n scrollIntoView: \"cursor\"\n}, {\n name: \"removetolineendhard\",\n bindKey: bindKey(\"Ctrl-Shift-Delete\", null),\n exec: function(editor) {\n var range = editor.selection.getRange();\n range.end.column = Number.MAX_VALUE;\n editor.session.remove(range);\n },\n multiSelectAction: \"forEach\",\n scrollIntoView: \"cursor\"\n}, {\n name: \"removewordleft\",\n bindKey: bindKey(\"Ctrl-Backspace\", \"Alt-Backspace|Ctrl-Alt-Backspace\"),\n exec: function(editor) { editor.removeWordLeft(); },\n multiSelectAction: \"forEach\",\n scrollIntoView: \"cursor\"\n}, {\n name: \"removewordright\",\n bindKey: bindKey(\"Ctrl-Delete\", \"Alt-Delete\"),\n exec: function(editor) { editor.removeWordRight(); },\n multiSelectAction: \"forEach\",\n scrollIntoView: \"cursor\"\n}, {\n name: \"outdent\",\n bindKey: bindKey(\"Shift-Tab\", \"Shift-Tab\"),\n exec: function(editor) { editor.blockOutdent(); },\n multiSelectAction: \"forEach\",\n scrollIntoView: \"selectionPart\"\n}, {\n name: \"indent\",\n bindKey: bindKey(\"Tab\", \"Tab\"),\n exec: function(editor) { editor.indent(); },\n multiSelectAction: \"forEach\",\n scrollIntoView: \"selectionPart\"\n}, {\n name: \"blockoutdent\",\n bindKey: bindKey(\"Ctrl-[\", \"Ctrl-[\"),\n exec: function(editor) { editor.blockOutdent(); },\n multiSelectAction: \"forEachLine\",\n scrollIntoView: \"selectionPart\"\n}, {\n name: \"blockindent\",\n bindKey: bindKey(\"Ctrl-]\", \"Ctrl-]\"),\n exec: function(editor) { editor.blockIndent(); },\n multiSelectAction: \"forEachLine\",\n scrollIntoView: \"selectionPart\"\n}, {\n name: \"insertstring\",\n exec: function(editor, str) { editor.insert(str); },\n multiSelectAction: \"forEach\",\n scrollIntoView: \"cursor\"\n}, {\n name: \"inserttext\",\n exec: function(editor, args) {\n editor.insert(lang.stringRepeat(args.text || \"\", args.times || 1));\n },\n multiSelectAction: \"forEach\",\n scrollIntoView: \"cursor\"\n}, {\n name: \"splitline\",\n bindKey: bindKey(null, \"Ctrl-O\"),\n exec: function(editor) { editor.splitLine(); },\n multiSelectAction: \"forEach\",\n scrollIntoView: \"cursor\"\n}, {\n name: \"transposeletters\",\n bindKey: bindKey(\"Alt-Shift-X\", \"Ctrl-T\"),\n exec: function(editor) { editor.transposeLetters(); },\n multiSelectAction: function(editor) {editor.transposeSelections(1); },\n scrollIntoView: \"cursor\"\n}, {\n name: \"touppercase\",\n bindKey: bindKey(\"Ctrl-U\", \"Ctrl-U\"),\n exec: function(editor) { editor.toUpperCase(); },\n multiSelectAction: \"forEach\",\n scrollIntoView: \"cursor\"\n}, {\n name: \"tolowercase\",\n bindKey: bindKey(\"Ctrl-Shift-U\", \"Ctrl-Shift-U\"),\n exec: function(editor) { editor.toLowerCase(); },\n multiSelectAction: \"forEach\",\n scrollIntoView: \"cursor\"\n}, {\n name: \"expandtoline\",\n bindKey: bindKey(\"Ctrl-Shift-L\", \"Command-Shift-L\"),\n exec: function(editor) {\n var range = editor.selection.getRange();\n\n range.start.column = range.end.column = 0;\n range.end.row++;\n editor.selection.setRange(range, false);\n },\n multiSelectAction: \"forEach\",\n scrollIntoView: \"cursor\",\n readOnly: true\n}, {\n name: \"joinlines\",\n bindKey: bindKey(null, null),\n exec: function(editor) {\n var isBackwards = editor.selection.isBackwards();\n var selectionStart = isBackwards ? editor.selection.getSelectionLead() : editor.selection.getSelectionAnchor();\n var selectionEnd = isBackwards ? editor.selection.getSelectionAnchor() : editor.selection.getSelectionLead();\n var firstLineEndCol = editor.session.doc.getLine(selectionStart.row).length;\n var selectedText = editor.session.doc.getTextRange(editor.selection.getRange());\n var selectedCount = selectedText.replace(/\\n\\s*/, \" \").length;\n var insertLine = editor.session.doc.getLine(selectionStart.row);\n\n for (var i = selectionStart.row + 1; i <= selectionEnd.row + 1; i++) {\n var curLine = lang.stringTrimLeft(lang.stringTrimRight(editor.session.doc.getLine(i)));\n if (curLine.length !== 0) {\n curLine = \" \" + curLine;\n }\n insertLine += curLine;\n }\n\n if (selectionEnd.row + 1 < (editor.session.doc.getLength() - 1)) {\n insertLine += editor.session.doc.getNewLineCharacter();\n }\n\n editor.clearSelection();\n editor.session.doc.replace(new Range(selectionStart.row, 0, selectionEnd.row + 2, 0), insertLine);\n\n if (selectedCount > 0) {\n editor.selection.moveCursorTo(selectionStart.row, selectionStart.column);\n editor.selection.selectTo(selectionStart.row, selectionStart.column + selectedCount);\n } else {\n firstLineEndCol = editor.session.doc.getLine(selectionStart.row).length > firstLineEndCol ? (firstLineEndCol + 1) : firstLineEndCol;\n editor.selection.moveCursorTo(selectionStart.row, firstLineEndCol);\n }\n },\n multiSelectAction: \"forEach\",\n readOnly: true\n}, {\n name: \"invertSelection\",\n bindKey: bindKey(null, null),\n exec: function(editor) {\n var endRow = editor.session.doc.getLength() - 1;\n var endCol = editor.session.doc.getLine(endRow).length;\n var ranges = editor.selection.rangeList.ranges;\n var newRanges = [];\n if (ranges.length < 1) {\n ranges = [editor.selection.getRange()];\n }\n\n for (var i = 0; i < ranges.length; i++) {\n if (i == (ranges.length - 1)) {\n if (!(ranges[i].end.row === endRow && ranges[i].end.column === endCol)) {\n newRanges.push(new Range(ranges[i].end.row, ranges[i].end.column, endRow, endCol));\n }\n }\n\n if (i === 0) {\n if (!(ranges[i].start.row === 0 && ranges[i].start.column === 0)) {\n newRanges.push(new Range(0, 0, ranges[i].start.row, ranges[i].start.column));\n }\n } else {\n newRanges.push(new Range(ranges[i-1].end.row, ranges[i-1].end.column, ranges[i].start.row, ranges[i].start.column));\n }\n }\n\n editor.exitMultiSelectMode();\n editor.clearSelection();\n\n for(var i = 0; i < newRanges.length; i++) {\n editor.selection.addRange(newRanges[i], false);\n }\n },\n readOnly: true,\n scrollIntoView: \"none\"\n}];\n\n});\n\nace.define(\"ace/editor\",[\"require\",\"exports\",\"module\",\"ace/lib/fixoldbrowsers\",\"ace/lib/oop\",\"ace/lib/dom\",\"ace/lib/lang\",\"ace/lib/useragent\",\"ace/keyboard/textinput\",\"ace/mouse/mouse_handler\",\"ace/mouse/fold_handler\",\"ace/keyboard/keybinding\",\"ace/edit_session\",\"ace/search\",\"ace/range\",\"ace/lib/event_emitter\",\"ace/commands/command_manager\",\"ace/commands/default_commands\",\"ace/config\",\"ace/token_iterator\"], function(acequire, exports, module) {\n\"use strict\";\n\nacequire(\"./lib/fixoldbrowsers\");\n\nvar oop = acequire(\"./lib/oop\");\nvar dom = acequire(\"./lib/dom\");\nvar lang = acequire(\"./lib/lang\");\nvar useragent = acequire(\"./lib/useragent\");\nvar TextInput = acequire(\"./keyboard/textinput\").TextInput;\nvar MouseHandler = acequire(\"./mouse/mouse_handler\").MouseHandler;\nvar FoldHandler = acequire(\"./mouse/fold_handler\").FoldHandler;\nvar KeyBinding = acequire(\"./keyboard/keybinding\").KeyBinding;\nvar EditSession = acequire(\"./edit_session\").EditSession;\nvar Search = acequire(\"./search\").Search;\nvar Range = acequire(\"./range\").Range;\nvar EventEmitter = acequire(\"./lib/event_emitter\").EventEmitter;\nvar CommandManager = acequire(\"./commands/command_manager\").CommandManager;\nvar defaultCommands = acequire(\"./commands/default_commands\").commands;\nvar config = acequire(\"./config\");\nvar TokenIterator = acequire(\"./token_iterator\").TokenIterator;\nvar Editor = function(renderer, session) {\n var container = renderer.getContainerElement();\n this.container = container;\n this.renderer = renderer;\n this.id = \"editor\" + (++Editor.$uid);\n\n this.commands = new CommandManager(useragent.isMac ? \"mac\" : \"win\", defaultCommands);\n if (typeof document == \"object\") {\n this.textInput = new TextInput(renderer.getTextAreaContainer(), this);\n this.renderer.textarea = this.textInput.getElement();\n this.$mouseHandler = new MouseHandler(this);\n new FoldHandler(this);\n }\n\n this.keyBinding = new KeyBinding(this);\n\n this.$blockScrolling = 0;\n this.$search = new Search().set({\n wrap: true\n });\n\n this.$historyTracker = this.$historyTracker.bind(this);\n this.commands.on(\"exec\", this.$historyTracker);\n\n this.$initOperationListeners();\n \n this._$emitInputEvent = lang.delayedCall(function() {\n this._signal(\"input\", {});\n if (this.session && this.session.bgTokenizer)\n this.session.bgTokenizer.scheduleStart();\n }.bind(this));\n \n this.on(\"change\", function(_, _self) {\n _self._$emitInputEvent.schedule(31);\n });\n\n this.setSession(session || new EditSession(\"\"));\n config.resetOptions(this);\n config._signal(\"editor\", this);\n};\n\nEditor.$uid = 0;\n\n(function(){\n\n oop.implement(this, EventEmitter);\n\n this.$initOperationListeners = function() {\n function last(a) {return a[a.length - 1];}\n\n this.selections = [];\n this.commands.on(\"exec\", this.startOperation.bind(this), true);\n this.commands.on(\"afterExec\", this.endOperation.bind(this), true);\n\n this.$opResetTimer = lang.delayedCall(this.endOperation.bind(this));\n\n this.on(\"change\", function() {\n this.curOp || this.startOperation();\n this.curOp.docChanged = true;\n }.bind(this), true);\n\n this.on(\"changeSelection\", function() {\n this.curOp || this.startOperation();\n this.curOp.selectionChanged = true;\n }.bind(this), true);\n };\n\n this.curOp = null;\n this.prevOp = {};\n this.startOperation = function(commadEvent) {\n if (this.curOp) {\n if (!commadEvent || this.curOp.command)\n return;\n this.prevOp = this.curOp;\n }\n if (!commadEvent) {\n this.previousCommand = null;\n commadEvent = {};\n }\n\n this.$opResetTimer.schedule();\n this.curOp = {\n command: commadEvent.command || {},\n args: commadEvent.args,\n scrollTop: this.renderer.scrollTop\n };\n if (this.curOp.command.name && this.curOp.command.scrollIntoView !== undefined)\n this.$blockScrolling++;\n };\n\n this.endOperation = function(e) {\n if (this.curOp) {\n if (e && e.returnValue === false)\n return this.curOp = null;\n this._signal(\"beforeEndOperation\");\n var command = this.curOp.command;\n if (command.name && this.$blockScrolling > 0)\n this.$blockScrolling--;\n var scrollIntoView = command && command.scrollIntoView;\n if (scrollIntoView) {\n switch (scrollIntoView) {\n case \"center-animate\":\n scrollIntoView = \"animate\";\n case \"center\":\n this.renderer.scrollCursorIntoView(null, 0.5);\n break;\n case \"animate\":\n case \"cursor\":\n this.renderer.scrollCursorIntoView();\n break;\n case \"selectionPart\":\n var range = this.selection.getRange();\n var config = this.renderer.layerConfig;\n if (range.start.row >= config.lastRow || range.end.row <= config.firstRow) {\n this.renderer.scrollSelectionIntoView(this.selection.anchor, this.selection.lead);\n }\n break;\n default:\n break;\n }\n if (scrollIntoView == \"animate\")\n this.renderer.animateScrolling(this.curOp.scrollTop);\n }\n \n this.prevOp = this.curOp;\n this.curOp = null;\n }\n };\n this.$mergeableCommands = [\"backspace\", \"del\", \"insertstring\"];\n this.$historyTracker = function(e) {\n if (!this.$mergeUndoDeltas)\n return;\n\n var prev = this.prevOp;\n var mergeableCommands = this.$mergeableCommands;\n var shouldMerge = prev.command && (e.command.name == prev.command.name);\n if (e.command.name == \"insertstring\") {\n var text = e.args;\n if (this.mergeNextCommand === undefined)\n this.mergeNextCommand = true;\n\n shouldMerge = shouldMerge\n && this.mergeNextCommand // previous command allows to coalesce with\n && (!/\\s/.test(text) || /\\s/.test(prev.args)); // previous insertion was of same type\n\n this.mergeNextCommand = true;\n } else {\n shouldMerge = shouldMerge\n && mergeableCommands.indexOf(e.command.name) !== -1; // the command is mergeable\n }\n\n if (\n this.$mergeUndoDeltas != \"always\"\n && Date.now() - this.sequenceStartTime > 2000\n ) {\n shouldMerge = false; // the sequence is too long\n }\n\n if (shouldMerge)\n this.session.mergeUndoDeltas = true;\n else if (mergeableCommands.indexOf(e.command.name) !== -1)\n this.sequenceStartTime = Date.now();\n };\n this.setKeyboardHandler = function(keyboardHandler, cb) {\n if (keyboardHandler && typeof keyboardHandler === \"string\") {\n this.$keybindingId = keyboardHandler;\n var _self = this;\n config.loadModule([\"keybinding\", keyboardHandler], function(module) {\n if (_self.$keybindingId == keyboardHandler)\n _self.keyBinding.setKeyboardHandler(module && module.handler);\n cb && cb();\n });\n } else {\n this.$keybindingId = null;\n this.keyBinding.setKeyboardHandler(keyboardHandler);\n cb && cb();\n }\n };\n this.getKeyboardHandler = function() {\n return this.keyBinding.getKeyboardHandler();\n };\n this.setSession = function(session) {\n if (this.session == session)\n return;\n if (this.curOp) this.endOperation();\n this.curOp = {};\n\n var oldSession = this.session;\n if (oldSession) {\n this.session.off(\"change\", this.$onDocumentChange);\n this.session.off(\"changeMode\", this.$onChangeMode);\n this.session.off(\"tokenizerUpdate\", this.$onTokenizerUpdate);\n this.session.off(\"changeTabSize\", this.$onChangeTabSize);\n this.session.off(\"changeWrapLimit\", this.$onChangeWrapLimit);\n this.session.off(\"changeWrapMode\", this.$onChangeWrapMode);\n this.session.off(\"changeFold\", this.$onChangeFold);\n this.session.off(\"changeFrontMarker\", this.$onChangeFrontMarker);\n this.session.off(\"changeBackMarker\", this.$onChangeBackMarker);\n this.session.off(\"changeBreakpoint\", this.$onChangeBreakpoint);\n this.session.off(\"changeAnnotation\", this.$onChangeAnnotation);\n this.session.off(\"changeOverwrite\", this.$onCursorChange);\n this.session.off(\"changeScrollTop\", this.$onScrollTopChange);\n this.session.off(\"changeScrollLeft\", this.$onScrollLeftChange);\n\n var selection = this.session.getSelection();\n selection.off(\"changeCursor\", this.$onCursorChange);\n selection.off(\"changeSelection\", this.$onSelectionChange);\n }\n\n this.session = session;\n if (session) {\n this.$onDocumentChange = this.onDocumentChange.bind(this);\n session.on(\"change\", this.$onDocumentChange);\n this.renderer.setSession(session);\n \n this.$onChangeMode = this.onChangeMode.bind(this);\n session.on(\"changeMode\", this.$onChangeMode);\n \n this.$onTokenizerUpdate = this.onTokenizerUpdate.bind(this);\n session.on(\"tokenizerUpdate\", this.$onTokenizerUpdate);\n \n this.$onChangeTabSize = this.renderer.onChangeTabSize.bind(this.renderer);\n session.on(\"changeTabSize\", this.$onChangeTabSize);\n \n this.$onChangeWrapLimit = this.onChangeWrapLimit.bind(this);\n session.on(\"changeWrapLimit\", this.$onChangeWrapLimit);\n \n this.$onChangeWrapMode = this.onChangeWrapMode.bind(this);\n session.on(\"changeWrapMode\", this.$onChangeWrapMode);\n \n this.$onChangeFold = this.onChangeFold.bind(this);\n session.on(\"changeFold\", this.$onChangeFold);\n \n this.$onChangeFrontMarker = this.onChangeFrontMarker.bind(this);\n this.session.on(\"changeFrontMarker\", this.$onChangeFrontMarker);\n \n this.$onChangeBackMarker = this.onChangeBackMarker.bind(this);\n this.session.on(\"changeBackMarker\", this.$onChangeBackMarker);\n \n this.$onChangeBreakpoint = this.onChangeBreakpoint.bind(this);\n this.session.on(\"changeBreakpoint\", this.$onChangeBreakpoint);\n \n this.$onChangeAnnotation = this.onChangeAnnotation.bind(this);\n this.session.on(\"changeAnnotation\", this.$onChangeAnnotation);\n \n this.$onCursorChange = this.onCursorChange.bind(this);\n this.session.on(\"changeOverwrite\", this.$onCursorChange);\n \n this.$onScrollTopChange = this.onScrollTopChange.bind(this);\n this.session.on(\"changeScrollTop\", this.$onScrollTopChange);\n \n this.$onScrollLeftChange = this.onScrollLeftChange.bind(this);\n this.session.on(\"changeScrollLeft\", this.$onScrollLeftChange);\n \n this.selection = session.getSelection();\n this.selection.on(\"changeCursor\", this.$onCursorChange);\n \n this.$onSelectionChange = this.onSelectionChange.bind(this);\n this.selection.on(\"changeSelection\", this.$onSelectionChange);\n \n this.onChangeMode();\n \n this.$blockScrolling += 1;\n this.onCursorChange();\n this.$blockScrolling -= 1;\n \n this.onScrollTopChange();\n this.onScrollLeftChange();\n this.onSelectionChange();\n this.onChangeFrontMarker();\n this.onChangeBackMarker();\n this.onChangeBreakpoint();\n this.onChangeAnnotation();\n this.session.getUseWrapMode() && this.renderer.adjustWrapLimit();\n this.renderer.updateFull();\n } else {\n this.selection = null;\n this.renderer.setSession(session);\n }\n\n this._signal(\"changeSession\", {\n session: session,\n oldSession: oldSession\n });\n \n this.curOp = null;\n \n oldSession && oldSession._signal(\"changeEditor\", {oldEditor: this});\n session && session._signal(\"changeEditor\", {editor: this});\n\n if (session && session.bgTokenizer)\n session.bgTokenizer.scheduleStart();\n };\n this.getSession = function() {\n return this.session;\n };\n this.setValue = function(val, cursorPos) {\n this.session.doc.setValue(val);\n\n if (!cursorPos)\n this.selectAll();\n else if (cursorPos == 1)\n this.navigateFileEnd();\n else if (cursorPos == -1)\n this.navigateFileStart();\n\n return val;\n };\n this.getValue = function() {\n return this.session.getValue();\n };\n this.getSelection = function() {\n return this.selection;\n };\n this.resize = function(force) {\n this.renderer.onResize(force);\n };\n this.setTheme = function(theme, cb) {\n this.renderer.setTheme(theme, cb);\n };\n this.getTheme = function() {\n return this.renderer.getTheme();\n };\n this.setStyle = function(style) {\n this.renderer.setStyle(style);\n };\n this.unsetStyle = function(style) {\n this.renderer.unsetStyle(style);\n };\n this.getFontSize = function () {\n return this.getOption(\"fontSize\") ||\n dom.computedStyle(this.container, \"fontSize\");\n };\n this.setFontSize = function(size) {\n this.setOption(\"fontSize\", size);\n };\n\n this.$highlightBrackets = function() {\n if (this.session.$bracketHighlight) {\n this.session.removeMarker(this.session.$bracketHighlight);\n this.session.$bracketHighlight = null;\n }\n\n if (this.$highlightPending) {\n return;\n }\n var self = this;\n this.$highlightPending = true;\n setTimeout(function() {\n self.$highlightPending = false;\n var session = self.session;\n if (!session || !session.bgTokenizer) return;\n var pos = session.findMatchingBracket(self.getCursorPosition());\n if (pos) {\n var range = new Range(pos.row, pos.column, pos.row, pos.column + 1);\n } else if (session.$mode.getMatching) {\n var range = session.$mode.getMatching(self.session);\n }\n if (range)\n session.$bracketHighlight = session.addMarker(range, \"ace_bracket\", \"text\");\n }, 50);\n };\n this.$highlightTags = function() {\n if (this.$highlightTagPending)\n return;\n var self = this;\n this.$highlightTagPending = true;\n setTimeout(function() {\n self.$highlightTagPending = false;\n \n var session = self.session;\n if (!session || !session.bgTokenizer) return;\n \n var pos = self.getCursorPosition();\n var iterator = new TokenIterator(self.session, pos.row, pos.column);\n var token = iterator.getCurrentToken();\n \n if (!token || !/\\b(?:tag-open|tag-name)/.test(token.type)) {\n session.removeMarker(session.$tagHighlight);\n session.$tagHighlight = null;\n return;\n }\n \n if (token.type.indexOf(\"tag-open\") != -1) {\n token = iterator.stepForward();\n if (!token)\n return;\n }\n \n var tag = token.value;\n var depth = 0;\n var prevToken = iterator.stepBackward();\n \n if (prevToken.value == '<'){\n do {\n prevToken = token;\n token = iterator.stepForward();\n \n if (token && token.value === tag && token.type.indexOf('tag-name') !== -1) {\n if (prevToken.value === '<'){\n depth++;\n } else if (prevToken.value === '</'){\n depth--;\n }\n }\n \n } while (token && depth >= 0);\n } else {\n do {\n token = prevToken;\n prevToken = iterator.stepBackward();\n \n if (token && token.value === tag && token.type.indexOf('tag-name') !== -1) {\n if (prevToken.value === '<') {\n depth++;\n } else if (prevToken.value === '</') {\n depth--;\n }\n }\n } while (prevToken && depth <= 0);\n iterator.stepForward();\n }\n \n if (!token) {\n session.removeMarker(session.$tagHighlight);\n session.$tagHighlight = null;\n return;\n }\n \n var row = iterator.getCurrentTokenRow();\n var column = iterator.getCurrentTokenColumn();\n var range = new Range(row, column, row, column+token.value.length);\n var sbm = session.$backMarkers[session.$tagHighlight];\n if (session.$tagHighlight && sbm != undefined && range.compareRange(sbm.range) !== 0) {\n session.removeMarker(session.$tagHighlight);\n session.$tagHighlight = null;\n }\n \n if (range && !session.$tagHighlight)\n session.$tagHighlight = session.addMarker(range, \"ace_bracket\", \"text\");\n }, 50);\n };\n this.focus = function() {\n var _self = this;\n setTimeout(function() {\n _self.textInput.focus();\n });\n this.textInput.focus();\n };\n this.isFocused = function() {\n return this.textInput.isFocused();\n };\n this.blur = function() {\n this.textInput.blur();\n };\n this.onFocus = function(e) {\n if (this.$isFocused)\n return;\n this.$isFocused = true;\n this.renderer.showCursor();\n this.renderer.visualizeFocus();\n this._emit(\"focus\", e);\n };\n this.onBlur = function(e) {\n if (!this.$isFocused)\n return;\n this.$isFocused = false;\n this.renderer.hideCursor();\n this.renderer.visualizeBlur();\n this._emit(\"blur\", e);\n };\n\n this.$cursorChange = function() {\n this.renderer.updateCursor();\n };\n this.onDocumentChange = function(delta) {\n var wrap = this.session.$useWrapMode;\n var lastRow = (delta.start.row == delta.end.row ? delta.end.row : Infinity);\n this.renderer.updateLines(delta.start.row, lastRow, wrap);\n\n this._signal(\"change\", delta);\n this.$cursorChange();\n this.$updateHighlightActiveLine();\n };\n\n this.onTokenizerUpdate = function(e) {\n var rows = e.data;\n this.renderer.updateLines(rows.first, rows.last);\n };\n\n\n this.onScrollTopChange = function() {\n this.renderer.scrollToY(this.session.getScrollTop());\n };\n\n this.onScrollLeftChange = function() {\n this.renderer.scrollToX(this.session.getScrollLeft());\n };\n this.onCursorChange = function() {\n this.$cursorChange();\n\n if (!this.$blockScrolling) {\n config.warn(\"Automatically scrolling cursor into view after selection change\",\n \"this will be disabled in the next version\",\n \"set editor.$blockScrolling = Infinity to disable this message\"\n );\n this.renderer.scrollCursorIntoView();\n }\n\n this.$highlightBrackets();\n this.$highlightTags();\n this.$updateHighlightActiveLine();\n this._signal(\"changeSelection\");\n };\n\n this.$updateHighlightActiveLine = function() {\n var session = this.getSession();\n\n var highlight;\n if (this.$highlightActiveLine) {\n if ((this.$selectionStyle != \"line\" || !this.selection.isMultiLine()))\n highlight = this.getCursorPosition();\n if (this.renderer.$maxLines && this.session.getLength() === 1 && !(this.renderer.$minLines > 1))\n highlight = false;\n }\n\n if (session.$highlightLineMarker && !highlight) {\n session.removeMarker(session.$highlightLineMarker.id);\n session.$highlightLineMarker = null;\n } else if (!session.$highlightLineMarker && highlight) {\n var range = new Range(highlight.row, highlight.column, highlight.row, Infinity);\n range.id = session.addMarker(range, \"ace_active-line\", \"screenLine\");\n session.$highlightLineMarker = range;\n } else if (highlight) {\n session.$highlightLineMarker.start.row = highlight.row;\n session.$highlightLineMarker.end.row = highlight.row;\n session.$highlightLineMarker.start.column = highlight.column;\n session._signal(\"changeBackMarker\");\n }\n };\n\n this.onSelectionChange = function(e) {\n var session = this.session;\n\n if (session.$selectionMarker) {\n session.removeMarker(session.$selectionMarker);\n }\n session.$selectionMarker = null;\n\n if (!this.selection.isEmpty()) {\n var range = this.selection.getRange();\n var style = this.getSelectionStyle();\n session.$selectionMarker = session.addMarker(range, \"ace_selection\", style);\n } else {\n this.$updateHighlightActiveLine();\n }\n\n var re = this.$highlightSelectedWord && this.$getSelectionHighLightRegexp();\n this.session.highlight(re);\n\n this._signal(\"changeSelection\");\n };\n\n this.$getSelectionHighLightRegexp = function() {\n var session = this.session;\n\n var selection = this.getSelectionRange();\n if (selection.isEmpty() || selection.isMultiLine())\n return;\n\n var startOuter = selection.start.column - 1;\n var endOuter = selection.end.column + 1;\n var line = session.getLine(selection.start.row);\n var lineCols = line.length;\n var needle = line.substring(Math.max(startOuter, 0),\n Math.min(endOuter, lineCols));\n if ((startOuter >= 0 && /^[\\w\\d]/.test(needle)) ||\n (endOuter <= lineCols && /[\\w\\d]$/.test(needle)))\n return;\n\n needle = line.substring(selection.start.column, selection.end.column);\n if (!/^[\\w\\d]+$/.test(needle))\n return;\n\n var re = this.$search.$assembleRegExp({\n wholeWord: true,\n caseSensitive: true,\n needle: needle\n });\n\n return re;\n };\n\n\n this.onChangeFrontMarker = function() {\n this.renderer.updateFrontMarkers();\n };\n\n this.onChangeBackMarker = function() {\n this.renderer.updateBackMarkers();\n };\n\n\n this.onChangeBreakpoint = function() {\n this.renderer.updateBreakpoints();\n };\n\n this.onChangeAnnotation = function() {\n this.renderer.setAnnotations(this.session.getAnnotations());\n };\n\n\n this.onChangeMode = function(e) {\n this.renderer.updateText();\n this._emit(\"changeMode\", e);\n };\n\n\n this.onChangeWrapLimit = function() {\n this.renderer.updateFull();\n };\n\n this.onChangeWrapMode = function() {\n this.renderer.onResize(true);\n };\n\n\n this.onChangeFold = function() {\n this.$updateHighlightActiveLine();\n this.renderer.updateFull();\n };\n this.getSelectedText = function() {\n return this.session.getTextRange(this.getSelectionRange());\n };\n this.getCopyText = function() {\n var text = this.getSelectedText();\n this._signal(\"copy\", text);\n return text;\n };\n this.onCopy = function() {\n this.commands.exec(\"copy\", this);\n };\n this.onCut = function() {\n this.commands.exec(\"cut\", this);\n };\n this.onPaste = function(text, event) {\n var e = {text: text, event: event};\n this.commands.exec(\"paste\", this, e);\n };\n \n this.$handlePaste = function(e) {\n if (typeof e == \"string\") \n e = {text: e};\n this._signal(\"paste\", e);\n var text = e.text;\n if (!this.inMultiSelectMode || this.inVirtualSelectionMode) {\n this.insert(text);\n } else {\n var lines = text.split(/\\r\\n|\\r|\\n/);\n var ranges = this.selection.rangeList.ranges;\n \n if (lines.length > ranges.length || lines.length < 2 || !lines[1])\n return this.commands.exec(\"insertstring\", this, text);\n \n for (var i = ranges.length; i--;) {\n var range = ranges[i];\n if (!range.isEmpty())\n this.session.remove(range);\n \n this.session.insert(range.start, lines[i]);\n }\n }\n };\n\n this.execCommand = function(command, args) {\n return this.commands.exec(command, this, args);\n };\n this.insert = function(text, pasted) {\n var session = this.session;\n var mode = session.getMode();\n var cursor = this.getCursorPosition();\n\n if (this.getBehavioursEnabled() && !pasted) {\n var transform = mode.transformAction(session.getState(cursor.row), 'insertion', this, session, text);\n if (transform) {\n if (text !== transform.text) {\n this.session.mergeUndoDeltas = false;\n this.$mergeNextCommand = false;\n }\n text = transform.text;\n\n }\n }\n \n if (text == \"\\t\")\n text = this.session.getTabString();\n if (!this.selection.isEmpty()) {\n var range = this.getSelectionRange();\n cursor = this.session.remove(range);\n this.clearSelection();\n }\n else if (this.session.getOverwrite() && text.indexOf(\"\\n\") == -1) {\n var range = new Range.fromPoints(cursor, cursor);\n range.end.column += text.length;\n this.session.remove(range);\n }\n\n if (text == \"\\n\" || text == \"\\r\\n\") {\n var line = session.getLine(cursor.row);\n if (cursor.column > line.search(/\\S|$/)) {\n var d = line.substr(cursor.column).search(/\\S|$/);\n session.doc.removeInLine(cursor.row, cursor.column, cursor.column + d);\n }\n }\n this.clearSelection();\n\n var start = cursor.column;\n var lineState = session.getState(cursor.row);\n var line = session.getLine(cursor.row);\n var shouldOutdent = mode.checkOutdent(lineState, line, text);\n var end = session.insert(cursor, text);\n\n if (transform && transform.selection) {\n if (transform.selection.length == 2) { // Transform relative to the current column\n this.selection.setSelectionRange(\n new Range(cursor.row, start + transform.selection[0],\n cursor.row, start + transform.selection[1]));\n } else { // Transform relative to the current row.\n this.selection.setSelectionRange(\n new Range(cursor.row + transform.selection[0],\n transform.selection[1],\n cursor.row + transform.selection[2],\n transform.selection[3]));\n }\n }\n\n if (session.getDocument().isNewLine(text)) {\n var lineIndent = mode.getNextLineIndent(lineState, line.slice(0, cursor.column), session.getTabString());\n\n session.insert({row: cursor.row+1, column: 0}, lineIndent);\n }\n if (shouldOutdent)\n mode.autoOutdent(lineState, session, cursor.row);\n };\n\n this.onTextInput = function(text) {\n this.keyBinding.onTextInput(text);\n };\n\n this.onCommandKey = function(e, hashId, keyCode) {\n this.keyBinding.onCommandKey(e, hashId, keyCode);\n };\n this.setOverwrite = function(overwrite) {\n this.session.setOverwrite(overwrite);\n };\n this.getOverwrite = function() {\n return this.session.getOverwrite();\n };\n this.toggleOverwrite = function() {\n this.session.toggleOverwrite();\n };\n this.setScrollSpeed = function(speed) {\n this.setOption(\"scrollSpeed\", speed);\n };\n this.getScrollSpeed = function() {\n return this.getOption(\"scrollSpeed\");\n };\n this.setDragDelay = function(dragDelay) {\n this.setOption(\"dragDelay\", dragDelay);\n };\n this.getDragDelay = function() {\n return this.getOption(\"dragDelay\");\n };\n this.setSelectionStyle = function(val) {\n this.setOption(\"selectionStyle\", val);\n };\n this.getSelectionStyle = function() {\n return this.getOption(\"selectionStyle\");\n };\n this.setHighlightActiveLine = function(shouldHighlight) {\n this.setOption(\"highlightActiveLine\", shouldHighlight);\n };\n this.getHighlightActiveLine = function() {\n return this.getOption(\"highlightActiveLine\");\n };\n this.setHighlightGutterLine = function(shouldHighlight) {\n this.setOption(\"highlightGutterLine\", shouldHighlight);\n };\n\n this.getHighlightGutterLine = function() {\n return this.getOption(\"highlightGutterLine\");\n };\n this.setHighlightSelectedWord = function(shouldHighlight) {\n this.setOption(\"highlightSelectedWord\", shouldHighlight);\n };\n this.getHighlightSelectedWord = function() {\n return this.$highlightSelectedWord;\n };\n\n this.setAnimatedScroll = function(shouldAnimate){\n this.renderer.setAnimatedScroll(shouldAnimate);\n };\n\n this.getAnimatedScroll = function(){\n return this.renderer.getAnimatedScroll();\n };\n this.setShowInvisibles = function(showInvisibles) {\n this.renderer.setShowInvisibles(showInvisibles);\n };\n this.getShowInvisibles = function() {\n return this.renderer.getShowInvisibles();\n };\n\n this.setDisplayIndentGuides = function(display) {\n this.renderer.setDisplayIndentGuides(display);\n };\n\n this.getDisplayIndentGuides = function() {\n return this.renderer.getDisplayIndentGuides();\n };\n this.setShowPrintMargin = function(showPrintMargin) {\n this.renderer.setShowPrintMargin(showPrintMargin);\n };\n this.getShowPrintMargin = function() {\n return this.renderer.getShowPrintMargin();\n };\n this.setPrintMarginColumn = function(showPrintMargin) {\n this.renderer.setPrintMarginColumn(showPrintMargin);\n };\n this.getPrintMarginColumn = function() {\n return this.renderer.getPrintMarginColumn();\n };\n this.setReadOnly = function(readOnly) {\n this.setOption(\"readOnly\", readOnly);\n };\n this.getReadOnly = function() {\n return this.getOption(\"readOnly\");\n };\n this.setBehavioursEnabled = function (enabled) {\n this.setOption(\"behavioursEnabled\", enabled);\n };\n this.getBehavioursEnabled = function () {\n return this.getOption(\"behavioursEnabled\");\n };\n this.setWrapBehavioursEnabled = function (enabled) {\n this.setOption(\"wrapBehavioursEnabled\", enabled);\n };\n this.getWrapBehavioursEnabled = function () {\n return this.getOption(\"wrapBehavioursEnabled\");\n };\n this.setShowFoldWidgets = function(show) {\n this.setOption(\"showFoldWidgets\", show);\n\n };\n this.getShowFoldWidgets = function() {\n return this.getOption(\"showFoldWidgets\");\n };\n\n this.setFadeFoldWidgets = function(fade) {\n this.setOption(\"fadeFoldWidgets\", fade);\n };\n\n this.getFadeFoldWidgets = function() {\n return this.getOption(\"fadeFoldWidgets\");\n };\n this.remove = function(dir) {\n if (this.selection.isEmpty()){\n if (dir == \"left\")\n this.selection.selectLeft();\n else\n this.selection.selectRight();\n }\n\n var range = this.getSelectionRange();\n if (this.getBehavioursEnabled()) {\n var session = this.session;\n var state = session.getState(range.start.row);\n var new_range = session.getMode().transformAction(state, 'deletion', this, session, range);\n\n if (range.end.column === 0) {\n var text = session.getTextRange(range);\n if (text[text.length - 1] == \"\\n\") {\n var line = session.getLine(range.end.row);\n if (/^\\s+$/.test(line)) {\n range.end.column = line.length;\n }\n }\n }\n if (new_range)\n range = new_range;\n }\n\n this.session.remove(range);\n this.clearSelection();\n };\n this.removeWordRight = function() {\n if (this.selection.isEmpty())\n this.selection.selectWordRight();\n\n this.session.remove(this.getSelectionRange());\n this.clearSelection();\n };\n this.removeWordLeft = function() {\n if (this.selection.isEmpty())\n this.selection.selectWordLeft();\n\n this.session.remove(this.getSelectionRange());\n this.clearSelection();\n };\n this.removeToLineStart = function() {\n if (this.selection.isEmpty())\n this.selection.selectLineStart();\n\n this.session.remove(this.getSelectionRange());\n this.clearSelection();\n };\n this.removeToLineEnd = function() {\n if (this.selection.isEmpty())\n this.selection.selectLineEnd();\n\n var range = this.getSelectionRange();\n if (range.start.column == range.end.column && range.start.row == range.end.row) {\n range.end.column = 0;\n range.end.row++;\n }\n\n this.session.remove(range);\n this.clearSelection();\n };\n this.splitLine = function() {\n if (!this.selection.isEmpty()) {\n this.session.remove(this.getSelectionRange());\n this.clearSelection();\n }\n\n var cursor = this.getCursorPosition();\n this.insert(\"\\n\");\n this.moveCursorToPosition(cursor);\n };\n this.transposeLetters = function() {\n if (!this.selection.isEmpty()) {\n return;\n }\n\n var cursor = this.getCursorPosition();\n var column = cursor.column;\n if (column === 0)\n return;\n\n var line = this.session.getLine(cursor.row);\n var swap, range;\n if (column < line.length) {\n swap = line.charAt(column) + line.charAt(column-1);\n range = new Range(cursor.row, column-1, cursor.row, column+1);\n }\n else {\n swap = line.charAt(column-1) + line.charAt(column-2);\n range = new Range(cursor.row, column-2, cursor.row, column);\n }\n this.session.replace(range, swap);\n this.session.selection.moveToPosition(range.end);\n };\n this.toLowerCase = function() {\n var originalRange = this.getSelectionRange();\n if (this.selection.isEmpty()) {\n this.selection.selectWord();\n }\n\n var range = this.getSelectionRange();\n var text = this.session.getTextRange(range);\n this.session.replace(range, text.toLowerCase());\n this.selection.setSelectionRange(originalRange);\n };\n this.toUpperCase = function() {\n var originalRange = this.getSelectionRange();\n if (this.selection.isEmpty()) {\n this.selection.selectWord();\n }\n\n var range = this.getSelectionRange();\n var text = this.session.getTextRange(range);\n this.session.replace(range, text.toUpperCase());\n this.selection.setSelectionRange(originalRange);\n };\n this.indent = function() {\n var session = this.session;\n var range = this.getSelectionRange();\n\n if (range.start.row < range.end.row) {\n var rows = this.$getSelectedRows();\n session.indentRows(rows.first, rows.last, \"\\t\");\n return;\n } else if (range.start.column < range.end.column) {\n var text = session.getTextRange(range);\n if (!/^\\s+$/.test(text)) {\n var rows = this.$getSelectedRows();\n session.indentRows(rows.first, rows.last, \"\\t\");\n return;\n }\n }\n \n var line = session.getLine(range.start.row);\n var position = range.start;\n var size = session.getTabSize();\n var column = session.documentToScreenColumn(position.row, position.column);\n\n if (this.session.getUseSoftTabs()) {\n var count = (size - column % size);\n var indentString = lang.stringRepeat(\" \", count);\n } else {\n var count = column % size;\n while (line[range.start.column - 1] == \" \" && count) {\n range.start.column--;\n count--;\n }\n this.selection.setSelectionRange(range);\n indentString = \"\\t\";\n }\n return this.insert(indentString);\n };\n this.blockIndent = function() {\n var rows = this.$getSelectedRows();\n this.session.indentRows(rows.first, rows.last, \"\\t\");\n };\n this.blockOutdent = function() {\n var selection = this.session.getSelection();\n this.session.outdentRows(selection.getRange());\n };\n this.sortLines = function() {\n var rows = this.$getSelectedRows();\n var session = this.session;\n\n var lines = [];\n for (var i = rows.first; i <= rows.last; i++)\n lines.push(session.getLine(i));\n\n lines.sort(function(a, b) {\n if (a.toLowerCase() < b.toLowerCase()) return -1;\n if (a.toLowerCase() > b.toLowerCase()) return 1;\n return 0;\n });\n\n var deleteRange = new Range(0, 0, 0, 0);\n for (var i = rows.first; i <= rows.last; i++) {\n var line = session.getLine(i);\n deleteRange.start.row = i;\n deleteRange.end.row = i;\n deleteRange.end.column = line.length;\n session.replace(deleteRange, lines[i-rows.first]);\n }\n };\n this.toggleCommentLines = function() {\n var state = this.session.getState(this.getCursorPosition().row);\n var rows = this.$getSelectedRows();\n this.session.getMode().toggleCommentLines(state, this.session, rows.first, rows.last);\n };\n\n this.toggleBlockComment = function() {\n var cursor = this.getCursorPosition();\n var state = this.session.getState(cursor.row);\n var range = this.getSelectionRange();\n this.session.getMode().toggleBlockComment(state, this.session, range, cursor);\n };\n this.getNumberAt = function(row, column) {\n var _numberRx = /[\\-]?[0-9]+(?:\\.[0-9]+)?/g;\n _numberRx.lastIndex = 0;\n\n var s = this.session.getLine(row);\n while (_numberRx.lastIndex < column) {\n var m = _numberRx.exec(s);\n if(m.index <= column && m.index+m[0].length >= column){\n var number = {\n value: m[0],\n start: m.index,\n end: m.index+m[0].length\n };\n return number;\n }\n }\n return null;\n };\n this.modifyNumber = function(amount) {\n var row = this.selection.getCursor().row;\n var column = this.selection.getCursor().column;\n var charRange = new Range(row, column-1, row, column);\n\n var c = this.session.getTextRange(charRange);\n if (!isNaN(parseFloat(c)) && isFinite(c)) {\n var nr = this.getNumberAt(row, column);\n if (nr) {\n var fp = nr.value.indexOf(\".\") >= 0 ? nr.start + nr.value.indexOf(\".\") + 1 : nr.end;\n var decimals = nr.start + nr.value.length - fp;\n\n var t = parseFloat(nr.value);\n t *= Math.pow(10, decimals);\n\n\n if(fp !== nr.end && column < fp){\n amount *= Math.pow(10, nr.end - column - 1);\n } else {\n amount *= Math.pow(10, nr.end - column);\n }\n\n t += amount;\n t /= Math.pow(10, decimals);\n var nnr = t.toFixed(decimals);\n var replaceRange = new Range(row, nr.start, row, nr.end);\n this.session.replace(replaceRange, nnr);\n this.moveCursorTo(row, Math.max(nr.start +1, column + nnr.length - nr.value.length));\n\n }\n }\n };\n this.removeLines = function() {\n var rows = this.$getSelectedRows();\n this.session.removeFullLines(rows.first, rows.last);\n this.clearSelection();\n };\n\n this.duplicateSelection = function() {\n var sel = this.selection;\n var doc = this.session;\n var range = sel.getRange();\n var reverse = sel.isBackwards();\n if (range.isEmpty()) {\n var row = range.start.row;\n doc.duplicateLines(row, row);\n } else {\n var point = reverse ? range.start : range.end;\n var endPoint = doc.insert(point, doc.getTextRange(range), false);\n range.start = point;\n range.end = endPoint;\n\n sel.setSelectionRange(range, reverse);\n }\n };\n this.moveLinesDown = function() {\n this.$moveLines(1, false);\n };\n this.moveLinesUp = function() {\n this.$moveLines(-1, false);\n };\n this.moveText = function(range, toPosition, copy) {\n return this.session.moveText(range, toPosition, copy);\n };\n this.copyLinesUp = function() {\n this.$moveLines(-1, true);\n };\n this.copyLinesDown = function() {\n this.$moveLines(1, true);\n };\n this.$moveLines = function(dir, copy) {\n var rows, moved;\n var selection = this.selection;\n if (!selection.inMultiSelectMode || this.inVirtualSelectionMode) {\n var range = selection.toOrientedRange();\n rows = this.$getSelectedRows(range);\n moved = this.session.$moveLines(rows.first, rows.last, copy ? 0 : dir);\n if (copy && dir == -1) moved = 0;\n range.moveBy(moved, 0);\n selection.fromOrientedRange(range);\n } else {\n var ranges = selection.rangeList.ranges;\n selection.rangeList.detach(this.session);\n this.inVirtualSelectionMode = true;\n \n var diff = 0;\n var totalDiff = 0;\n var l = ranges.length;\n for (var i = 0; i < l; i++) {\n var rangeIndex = i;\n ranges[i].moveBy(diff, 0);\n rows = this.$getSelectedRows(ranges[i]);\n var first = rows.first;\n var last = rows.last;\n while (++i < l) {\n if (totalDiff) ranges[i].moveBy(totalDiff, 0);\n var subRows = this.$getSelectedRows(ranges[i]);\n if (copy && subRows.first != last)\n break;\n else if (!copy && subRows.first > last + 1)\n break;\n last = subRows.last;\n }\n i--;\n diff = this.session.$moveLines(first, last, copy ? 0 : dir);\n if (copy && dir == -1) rangeIndex = i + 1;\n while (rangeIndex <= i) {\n ranges[rangeIndex].moveBy(diff, 0);\n rangeIndex++;\n }\n if (!copy) diff = 0;\n totalDiff += diff;\n }\n \n selection.fromOrientedRange(selection.ranges[0]);\n selection.rangeList.attach(this.session);\n this.inVirtualSelectionMode = false;\n }\n };\n this.$getSelectedRows = function(range) {\n range = (range || this.getSelectionRange()).collapseRows();\n\n return {\n first: this.session.getRowFoldStart(range.start.row),\n last: this.session.getRowFoldEnd(range.end.row)\n };\n };\n\n this.onCompositionStart = function(text) {\n this.renderer.showComposition(this.getCursorPosition());\n };\n\n this.onCompositionUpdate = function(text) {\n this.renderer.setCompositionText(text);\n };\n\n this.onCompositionEnd = function() {\n this.renderer.hideComposition();\n };\n this.getFirstVisibleRow = function() {\n return this.renderer.getFirstVisibleRow();\n };\n this.getLastVisibleRow = function() {\n return this.renderer.getLastVisibleRow();\n };\n this.isRowVisible = function(row) {\n return (row >= this.getFirstVisibleRow() && row <= this.getLastVisibleRow());\n };\n this.isRowFullyVisible = function(row) {\n return (row >= this.renderer.getFirstFullyVisibleRow() && row <= this.renderer.getLastFullyVisibleRow());\n };\n this.$getVisibleRowCount = function() {\n return this.renderer.getScrollBottomRow() - this.renderer.getScrollTopRow() + 1;\n };\n\n this.$moveByPage = function(dir, select) {\n var renderer = this.renderer;\n var config = this.renderer.layerConfig;\n var rows = dir * Math.floor(config.height / config.lineHeight);\n\n this.$blockScrolling++;\n if (select === true) {\n this.selection.$moveSelection(function(){\n this.moveCursorBy(rows, 0);\n });\n } else if (select === false) {\n this.selection.moveCursorBy(rows, 0);\n this.selection.clearSelection();\n }\n this.$blockScrolling--;\n\n var scrollTop = renderer.scrollTop;\n\n renderer.scrollBy(0, rows * config.lineHeight);\n if (select != null)\n renderer.scrollCursorIntoView(null, 0.5);\n\n renderer.animateScrolling(scrollTop);\n };\n this.selectPageDown = function() {\n this.$moveByPage(1, true);\n };\n this.selectPageUp = function() {\n this.$moveByPage(-1, true);\n };\n this.gotoPageDown = function() {\n this.$moveByPage(1, false);\n };\n this.gotoPageUp = function() {\n this.$moveByPage(-1, false);\n };\n this.scrollPageDown = function() {\n this.$moveByPage(1);\n };\n this.scrollPageUp = function() {\n this.$moveByPage(-1);\n };\n this.scrollToRow = function(row) {\n this.renderer.scrollToRow(row);\n };\n this.scrollToLine = function(line, center, animate, callback) {\n this.renderer.scrollToLine(line, center, animate, callback);\n };\n this.centerSelection = function() {\n var range = this.getSelectionRange();\n var pos = {\n row: Math.floor(range.start.row + (range.end.row - range.start.row) / 2),\n column: Math.floor(range.start.column + (range.end.column - range.start.column) / 2)\n };\n this.renderer.alignCursor(pos, 0.5);\n };\n this.getCursorPosition = function() {\n return this.selection.getCursor();\n };\n this.getCursorPositionScreen = function() {\n return this.session.documentToScreenPosition(this.getCursorPosition());\n };\n this.getSelectionRange = function() {\n return this.selection.getRange();\n };\n this.selectAll = function() {\n this.$blockScrolling += 1;\n this.selection.selectAll();\n this.$blockScrolling -= 1;\n };\n this.clearSelection = function() {\n this.selection.clearSelection();\n };\n this.moveCursorTo = function(row, column) {\n this.selection.moveCursorTo(row, column);\n };\n this.moveCursorToPosition = function(pos) {\n this.selection.moveCursorToPosition(pos);\n };\n this.jumpToMatching = function(select, expand) {\n var cursor = this.getCursorPosition();\n var iterator = new TokenIterator(this.session, cursor.row, cursor.column);\n var prevToken = iterator.getCurrentToken();\n var token = prevToken || iterator.stepForward();\n\n if (!token) return;\n var matchType;\n var found = false;\n var depth = {};\n var i = cursor.column - token.start;\n var bracketType;\n var brackets = {\n \")\": \"(\",\n \"(\": \"(\",\n \"]\": \"[\",\n \"[\": \"[\",\n \"{\": \"{\",\n \"}\": \"{\"\n };\n \n do {\n if (token.value.match(/[{}()\\[\\]]/g)) {\n for (; i < token.value.length && !found; i++) {\n if (!brackets[token.value[i]]) {\n continue;\n }\n\n bracketType = brackets[token.value[i]] + '.' + token.type.replace(\"rparen\", \"lparen\");\n\n if (isNaN(depth[bracketType])) {\n depth[bracketType] = 0;\n }\n\n switch (token.value[i]) {\n case '(':\n case '[':\n case '{':\n depth[bracketType]++;\n break;\n case ')':\n case ']':\n case '}':\n depth[bracketType]--;\n\n if (depth[bracketType] === -1) {\n matchType = 'bracket';\n found = true;\n }\n break;\n }\n }\n }\n else if (token && token.type.indexOf('tag-name') !== -1) {\n if (isNaN(depth[token.value])) {\n depth[token.value] = 0;\n }\n \n if (prevToken.value === '<') {\n depth[token.value]++;\n }\n else if (prevToken.value === '</') {\n depth[token.value]--;\n }\n \n if (depth[token.value] === -1) {\n matchType = 'tag';\n found = true;\n }\n }\n\n if (!found) {\n prevToken = token;\n token = iterator.stepForward();\n i = 0;\n }\n } while (token && !found);\n if (!matchType)\n return;\n\n var range, pos;\n if (matchType === 'bracket') {\n range = this.session.getBracketRange(cursor);\n if (!range) {\n range = new Range(\n iterator.getCurrentTokenRow(),\n iterator.getCurrentTokenColumn() + i - 1,\n iterator.getCurrentTokenRow(),\n iterator.getCurrentTokenColumn() + i - 1\n );\n pos = range.start;\n if (expand || pos.row === cursor.row && Math.abs(pos.column - cursor.column) < 2)\n range = this.session.getBracketRange(pos);\n }\n }\n else if (matchType === 'tag') {\n if (token && token.type.indexOf('tag-name') !== -1) \n var tag = token.value;\n else\n return;\n\n range = new Range(\n iterator.getCurrentTokenRow(),\n iterator.getCurrentTokenColumn() - 2,\n iterator.getCurrentTokenRow(),\n iterator.getCurrentTokenColumn() - 2\n );\n if (range.compare(cursor.row, cursor.column) === 0) {\n found = false;\n do {\n token = prevToken;\n prevToken = iterator.stepBackward();\n \n if (prevToken) {\n if (prevToken.type.indexOf('tag-close') !== -1) {\n range.setEnd(iterator.getCurrentTokenRow(), iterator.getCurrentTokenColumn() + 1);\n }\n\n if (token.value === tag && token.type.indexOf('tag-name') !== -1) {\n if (prevToken.value === '<') {\n depth[tag]++;\n }\n else if (prevToken.value === '</') {\n depth[tag]--;\n }\n \n if (depth[tag] === 0)\n found = true;\n }\n }\n } while (prevToken && !found);\n }\n if (token && token.type.indexOf('tag-name')) {\n pos = range.start;\n if (pos.row == cursor.row && Math.abs(pos.column - cursor.column) < 2)\n pos = range.end;\n }\n }\n\n pos = range && range.cursor || pos;\n if (pos) {\n if (select) {\n if (range && expand) {\n this.selection.setRange(range);\n } else if (range && range.isEqual(this.getSelectionRange())) {\n this.clearSelection();\n } else {\n this.selection.selectTo(pos.row, pos.column);\n }\n } else {\n this.selection.moveTo(pos.row, pos.column);\n }\n }\n };\n this.gotoLine = function(lineNumber, column, animate) {\n this.selection.clearSelection();\n this.session.unfold({row: lineNumber - 1, column: column || 0});\n\n this.$blockScrolling += 1;\n this.exitMultiSelectMode && this.exitMultiSelectMode();\n this.moveCursorTo(lineNumber - 1, column || 0);\n this.$blockScrolling -= 1;\n\n if (!this.isRowFullyVisible(lineNumber - 1))\n this.scrollToLine(lineNumber - 1, true, animate);\n };\n this.navigateTo = function(row, column) {\n this.selection.moveTo(row, column);\n };\n this.navigateUp = function(times) {\n if (this.selection.isMultiLine() && !this.selection.isBackwards()) {\n var selectionStart = this.selection.anchor.getPosition();\n return this.moveCursorToPosition(selectionStart);\n }\n this.selection.clearSelection();\n this.selection.moveCursorBy(-times || -1, 0);\n };\n this.navigateDown = function(times) {\n if (this.selection.isMultiLine() && this.selection.isBackwards()) {\n var selectionEnd = this.selection.anchor.getPosition();\n return this.moveCursorToPosition(selectionEnd);\n }\n this.selection.clearSelection();\n this.selection.moveCursorBy(times || 1, 0);\n };\n this.navigateLeft = function(times) {\n if (!this.selection.isEmpty()) {\n var selectionStart = this.getSelectionRange().start;\n this.moveCursorToPosition(selectionStart);\n }\n else {\n times = times || 1;\n while (times--) {\n this.selection.moveCursorLeft();\n }\n }\n this.clearSelection();\n };\n this.navigateRight = function(times) {\n if (!this.selection.isEmpty()) {\n var selectionEnd = this.getSelectionRange().end;\n this.moveCursorToPosition(selectionEnd);\n }\n else {\n times = times || 1;\n while (times--) {\n this.selection.moveCursorRight();\n }\n }\n this.clearSelection();\n };\n this.navigateLineStart = function() {\n this.selection.moveCursorLineStart();\n this.clearSelection();\n };\n this.navigateLineEnd = function() {\n this.selection.moveCursorLineEnd();\n this.clearSelection();\n };\n this.navigateFileEnd = function() {\n this.selection.moveCursorFileEnd();\n this.clearSelection();\n };\n this.navigateFileStart = function() {\n this.selection.moveCursorFileStart();\n this.clearSelection();\n };\n this.navigateWordRight = function() {\n this.selection.moveCursorWordRight();\n this.clearSelection();\n };\n this.navigateWordLeft = function() {\n this.selection.moveCursorWordLeft();\n this.clearSelection();\n };\n this.replace = function(replacement, options) {\n if (options)\n this.$search.set(options);\n\n var range = this.$search.find(this.session);\n var replaced = 0;\n if (!range)\n return replaced;\n\n if (this.$tryReplace(range, replacement)) {\n replaced = 1;\n }\n if (range !== null) {\n this.selection.setSelectionRange(range);\n this.renderer.scrollSelectionIntoView(range.start, range.end);\n }\n\n return replaced;\n };\n this.replaceAll = function(replacement, options) {\n if (options) {\n this.$search.set(options);\n }\n\n var ranges = this.$search.findAll(this.session);\n var replaced = 0;\n if (!ranges.length)\n return replaced;\n\n this.$blockScrolling += 1;\n\n var selection = this.getSelectionRange();\n this.selection.moveTo(0, 0);\n\n for (var i = ranges.length - 1; i >= 0; --i) {\n if(this.$tryReplace(ranges[i], replacement)) {\n replaced++;\n }\n }\n\n this.selection.setSelectionRange(selection);\n this.$blockScrolling -= 1;\n\n return replaced;\n };\n\n this.$tryReplace = function(range, replacement) {\n var input = this.session.getTextRange(range);\n replacement = this.$search.replace(input, replacement);\n if (replacement !== null) {\n range.end = this.session.replace(range, replacement);\n return range;\n } else {\n return null;\n }\n };\n this.getLastSearchOptions = function() {\n return this.$search.getOptions();\n };\n this.find = function(needle, options, animate) {\n if (!options)\n options = {};\n\n if (typeof needle == \"string\" || needle instanceof RegExp)\n options.needle = needle;\n else if (typeof needle == \"object\")\n oop.mixin(options, needle);\n\n var range = this.selection.getRange();\n if (options.needle == null) {\n needle = this.session.getTextRange(range)\n || this.$search.$options.needle;\n if (!needle) {\n range = this.session.getWordRange(range.start.row, range.start.column);\n needle = this.session.getTextRange(range);\n }\n this.$search.set({needle: needle});\n }\n\n this.$search.set(options);\n if (!options.start)\n this.$search.set({start: range});\n\n var newRange = this.$search.find(this.session);\n if (options.preventScroll)\n return newRange;\n if (newRange) {\n this.revealRange(newRange, animate);\n return newRange;\n }\n if (options.backwards)\n range.start = range.end;\n else\n range.end = range.start;\n this.selection.setRange(range);\n };\n this.findNext = function(options, animate) {\n this.find({skipCurrent: true, backwards: false}, options, animate);\n };\n this.findPrevious = function(options, animate) {\n this.find(options, {skipCurrent: true, backwards: true}, animate);\n };\n\n this.revealRange = function(range, animate) {\n this.$blockScrolling += 1;\n this.session.unfold(range);\n this.selection.setSelectionRange(range);\n this.$blockScrolling -= 1;\n\n var scrollTop = this.renderer.scrollTop;\n this.renderer.scrollSelectionIntoView(range.start, range.end, 0.5);\n if (animate !== false)\n this.renderer.animateScrolling(scrollTop);\n };\n this.undo = function() {\n this.$blockScrolling++;\n this.session.getUndoManager().undo();\n this.$blockScrolling--;\n this.renderer.scrollCursorIntoView(null, 0.5);\n };\n this.redo = function() {\n this.$blockScrolling++;\n this.session.getUndoManager().redo();\n this.$blockScrolling--;\n this.renderer.scrollCursorIntoView(null, 0.5);\n };\n this.destroy = function() {\n this.renderer.destroy();\n this._signal(\"destroy\", this);\n if (this.session) {\n this.session.destroy();\n }\n };\n this.setAutoScrollEditorIntoView = function(enable) {\n if (!enable)\n return;\n var rect;\n var self = this;\n var shouldScroll = false;\n if (!this.$scrollAnchor)\n this.$scrollAnchor = document.createElement(\"div\");\n var scrollAnchor = this.$scrollAnchor;\n scrollAnchor.style.cssText = \"position:absolute\";\n this.container.insertBefore(scrollAnchor, this.container.firstChild);\n var onChangeSelection = this.on(\"changeSelection\", function() {\n shouldScroll = true;\n });\n var onBeforeRender = this.renderer.on(\"beforeRender\", function() {\n if (shouldScroll)\n rect = self.renderer.container.getBoundingClientRect();\n });\n var onAfterRender = this.renderer.on(\"afterRender\", function() {\n if (shouldScroll && rect && (self.isFocused()\n || self.searchBox && self.searchBox.isFocused())\n ) {\n var renderer = self.renderer;\n var pos = renderer.$cursorLayer.$pixelPos;\n var config = renderer.layerConfig;\n var top = pos.top - config.offset;\n if (pos.top >= 0 && top + rect.top < 0) {\n shouldScroll = true;\n } else if (pos.top < config.height &&\n pos.top + rect.top + config.lineHeight > window.innerHeight) {\n shouldScroll = false;\n } else {\n shouldScroll = null;\n }\n if (shouldScroll != null) {\n scrollAnchor.style.top = top + \"px\";\n scrollAnchor.style.left = pos.left + \"px\";\n scrollAnchor.style.height = config.lineHeight + \"px\";\n scrollAnchor.scrollIntoView(shouldScroll);\n }\n shouldScroll = rect = null;\n }\n });\n this.setAutoScrollEditorIntoView = function(enable) {\n if (enable)\n return;\n delete this.setAutoScrollEditorIntoView;\n this.off(\"changeSelection\", onChangeSelection);\n this.renderer.off(\"afterRender\", onAfterRender);\n this.renderer.off(\"beforeRender\", onBeforeRender);\n };\n };\n\n\n this.$resetCursorStyle = function() {\n var style = this.$cursorStyle || \"ace\";\n var cursorLayer = this.renderer.$cursorLayer;\n if (!cursorLayer)\n return;\n cursorLayer.setSmoothBlinking(/smooth/.test(style));\n cursorLayer.isBlinking = !this.$readOnly && style != \"wide\";\n dom.setCssClass(cursorLayer.element, \"ace_slim-cursors\", /slim/.test(style));\n };\n\n}).call(Editor.prototype);\n\n\n\nconfig.defineOptions(Editor.prototype, \"editor\", {\n selectionStyle: {\n set: function(style) {\n this.onSelectionChange();\n this._signal(\"changeSelectionStyle\", {data: style});\n },\n initialValue: \"line\"\n },\n highlightActiveLine: {\n set: function() {this.$updateHighlightActiveLine();},\n initialValue: true\n },\n highlightSelectedWord: {\n set: function(shouldHighlight) {this.$onSelectionChange();},\n initialValue: true\n },\n readOnly: {\n set: function(readOnly) {\n this.$resetCursorStyle(); \n },\n initialValue: false\n },\n cursorStyle: {\n set: function(val) { this.$resetCursorStyle(); },\n values: [\"ace\", \"slim\", \"smooth\", \"wide\"],\n initialValue: \"ace\"\n },\n mergeUndoDeltas: {\n values: [false, true, \"always\"],\n initialValue: true\n },\n behavioursEnabled: {initialValue: true},\n wrapBehavioursEnabled: {initialValue: true},\n autoScrollEditorIntoView: {\n set: function(val) {this.setAutoScrollEditorIntoView(val);}\n },\n keyboardHandler: {\n set: function(val) { this.setKeyboardHandler(val); },\n get: function() { return this.keybindingId; },\n handlesSet: true\n },\n\n hScrollBarAlwaysVisible: \"renderer\",\n vScrollBarAlwaysVisible: \"renderer\",\n highlightGutterLine: \"renderer\",\n animatedScroll: \"renderer\",\n showInvisibles: \"renderer\",\n showPrintMargin: \"renderer\",\n printMarginColumn: \"renderer\",\n printMargin: \"renderer\",\n fadeFoldWidgets: \"renderer\",\n showFoldWidgets: \"renderer\",\n showLineNumbers: \"renderer\",\n showGutter: \"renderer\",\n displayIndentGuides: \"renderer\",\n fontSize: \"renderer\",\n fontFamily: \"renderer\",\n maxLines: \"renderer\",\n minLines: \"renderer\",\n scrollPastEnd: \"renderer\",\n fixedWidthGutter: \"renderer\",\n theme: \"renderer\",\n\n scrollSpeed: \"$mouseHandler\",\n dragDelay: \"$mouseHandler\",\n dragEnabled: \"$mouseHandler\",\n focusTimout: \"$mouseHandler\",\n tooltipFollowsMouse: \"$mouseHandler\",\n\n firstLineNumber: \"session\",\n overwrite: \"session\",\n newLineMode: \"session\",\n useWorker: \"session\",\n useSoftTabs: \"session\",\n tabSize: \"session\",\n wrap: \"session\",\n indentedSoftWrap: \"session\",\n foldStyle: \"session\",\n mode: \"session\"\n});\n\nexports.Editor = Editor;\n});\n\nace.define(\"ace/undomanager\",[\"require\",\"exports\",\"module\"], function(acequire, exports, module) {\n\"use strict\";\nvar UndoManager = function() {\n this.reset();\n};\n\n(function() {\n this.execute = function(options) {\n var deltaSets = options.args[0];\n this.$doc = options.args[1];\n if (options.merge && this.hasUndo()){\n this.dirtyCounter--;\n deltaSets = this.$undoStack.pop().concat(deltaSets);\n }\n this.$undoStack.push(deltaSets);\n this.$redoStack = [];\n if (this.dirtyCounter < 0) {\n this.dirtyCounter = NaN;\n }\n this.dirtyCounter++;\n };\n this.undo = function(dontSelect) {\n var deltaSets = this.$undoStack.pop();\n var undoSelectionRange = null;\n if (deltaSets) {\n undoSelectionRange = this.$doc.undoChanges(deltaSets, dontSelect);\n this.$redoStack.push(deltaSets);\n this.dirtyCounter--;\n }\n\n return undoSelectionRange;\n };\n this.redo = function(dontSelect) {\n var deltaSets = this.$redoStack.pop();\n var redoSelectionRange = null;\n if (deltaSets) {\n redoSelectionRange =\n this.$doc.redoChanges(this.$deserializeDeltas(deltaSets), dontSelect);\n this.$undoStack.push(deltaSets);\n this.dirtyCounter++;\n }\n return redoSelectionRange;\n };\n this.reset = function() {\n this.$undoStack = [];\n this.$redoStack = [];\n this.dirtyCounter = 0;\n };\n this.hasUndo = function() {\n return this.$undoStack.length > 0;\n };\n this.hasRedo = function() {\n return this.$redoStack.length > 0;\n };\n this.markClean = function() {\n this.dirtyCounter = 0;\n };\n this.isClean = function() {\n return this.dirtyCounter === 0;\n };\n this.$serializeDeltas = function(deltaSets) {\n return cloneDeltaSetsObj(deltaSets, $serializeDelta);\n };\n this.$deserializeDeltas = function(deltaSets) {\n return cloneDeltaSetsObj(deltaSets, $deserializeDelta);\n };\n \n function $serializeDelta(delta){\n return {\n action: delta.action,\n start: delta.start,\n end: delta.end,\n lines: delta.lines.length == 1 ? null : delta.lines,\n text: delta.lines.length == 1 ? delta.lines[0] : null\n };\n }\n \n function $deserializeDelta(delta) {\n return {\n action: delta.action,\n start: delta.start,\n end: delta.end,\n lines: delta.lines || [delta.text]\n };\n }\n \n function cloneDeltaSetsObj(deltaSets_old, fnGetModifiedDelta) {\n var deltaSets_new = new Array(deltaSets_old.length);\n for (var i = 0; i < deltaSets_old.length; i++) {\n var deltaSet_old = deltaSets_old[i];\n var deltaSet_new = { group: deltaSet_old.group, deltas: new Array(deltaSet_old.length)};\n \n for (var j = 0; j < deltaSet_old.deltas.length; j++) {\n var delta_old = deltaSet_old.deltas[j];\n deltaSet_new.deltas[j] = fnGetModifiedDelta(delta_old);\n }\n \n deltaSets_new[i] = deltaSet_new;\n }\n return deltaSets_new;\n }\n \n}).call(UndoManager.prototype);\n\nexports.UndoManager = UndoManager;\n});\n\nace.define(\"ace/layer/gutter\",[\"require\",\"exports\",\"module\",\"ace/lib/dom\",\"ace/lib/oop\",\"ace/lib/lang\",\"ace/lib/event_emitter\"], function(acequire, exports, module) {\n\"use strict\";\n\nvar dom = acequire(\"../lib/dom\");\nvar oop = acequire(\"../lib/oop\");\nvar lang = acequire(\"../lib/lang\");\nvar EventEmitter = acequire(\"../lib/event_emitter\").EventEmitter;\n\nvar Gutter = function(parentEl) {\n this.element = dom.createElement(\"div\");\n this.element.className = \"ace_layer ace_gutter-layer\";\n parentEl.appendChild(this.element);\n this.setShowFoldWidgets(this.$showFoldWidgets);\n \n this.gutterWidth = 0;\n\n this.$annotations = [];\n this.$updateAnnotations = this.$updateAnnotations.bind(this);\n\n this.$cells = [];\n};\n\n(function() {\n\n oop.implement(this, EventEmitter);\n\n this.setSession = function(session) {\n if (this.session)\n this.session.removeEventListener(\"change\", this.$updateAnnotations);\n this.session = session;\n if (session)\n session.on(\"change\", this.$updateAnnotations);\n };\n\n this.addGutterDecoration = function(row, className){\n if (window.console)\n console.warn && console.warn(\"deprecated use session.addGutterDecoration\");\n this.session.addGutterDecoration(row, className);\n };\n\n this.removeGutterDecoration = function(row, className){\n if (window.console)\n console.warn && console.warn(\"deprecated use session.removeGutterDecoration\");\n this.session.removeGutterDecoration(row, className);\n };\n\n this.setAnnotations = function(annotations) {\n this.$annotations = [];\n for (var i = 0; i < annotations.length; i++) {\n var annotation = annotations[i];\n var row = annotation.row;\n var rowInfo = this.$annotations[row];\n if (!rowInfo)\n rowInfo = this.$annotations[row] = {text: []};\n \n var annoText = annotation.text;\n annoText = annoText ? lang.escapeHTML(annoText) : annotation.html || \"\";\n\n if (rowInfo.text.indexOf(annoText) === -1)\n rowInfo.text.push(annoText);\n\n var type = annotation.type;\n if (type == \"error\")\n rowInfo.className = \" ace_error\";\n else if (type == \"warning\" && rowInfo.className != \" ace_error\")\n rowInfo.className = \" ace_warning\";\n else if (type == \"info\" && (!rowInfo.className))\n rowInfo.className = \" ace_info\";\n }\n };\n\n this.$updateAnnotations = function (delta) {\n if (!this.$annotations.length)\n return;\n var firstRow = delta.start.row;\n var len = delta.end.row - firstRow;\n if (len === 0) {\n } else if (delta.action == 'remove') {\n this.$annotations.splice(firstRow, len + 1, null);\n } else {\n var args = new Array(len + 1);\n args.unshift(firstRow, 1);\n this.$annotations.splice.apply(this.$annotations, args);\n }\n };\n\n this.update = function(config) {\n var session = this.session;\n var firstRow = config.firstRow;\n var lastRow = Math.min(config.lastRow + config.gutterOffset, // needed to compensate for hor scollbar\n session.getLength() - 1);\n var fold = session.getNextFoldLine(firstRow);\n var foldStart = fold ? fold.start.row : Infinity;\n var foldWidgets = this.$showFoldWidgets && session.foldWidgets;\n var breakpoints = session.$breakpoints;\n var decorations = session.$decorations;\n var firstLineNumber = session.$firstLineNumber;\n var lastLineNumber = 0;\n \n var gutterRenderer = session.gutterRenderer || this.$renderer;\n\n var cell = null;\n var index = -1;\n var row = firstRow;\n while (true) {\n if (row > foldStart) {\n row = fold.end.row + 1;\n fold = session.getNextFoldLine(row, fold);\n foldStart = fold ? fold.start.row : Infinity;\n }\n if (row > lastRow) {\n while (this.$cells.length > index + 1) {\n cell = this.$cells.pop();\n this.element.removeChild(cell.element);\n }\n break;\n }\n\n cell = this.$cells[++index];\n if (!cell) {\n cell = {element: null, textNode: null, foldWidget: null};\n cell.element = dom.createElement(\"div\");\n cell.textNode = document.createTextNode('');\n cell.element.appendChild(cell.textNode);\n this.element.appendChild(cell.element);\n this.$cells[index] = cell;\n }\n\n var className = \"ace_gutter-cell \";\n if (breakpoints[row])\n className += breakpoints[row];\n if (decorations[row])\n className += decorations[row];\n if (this.$annotations[row])\n className += this.$annotations[row].className;\n if (cell.element.className != className)\n cell.element.className = className;\n\n var height = session.getRowLength(row) * config.lineHeight + \"px\";\n if (height != cell.element.style.height)\n cell.element.style.height = height;\n\n if (foldWidgets) {\n var c = foldWidgets[row];\n if (c == null)\n c = foldWidgets[row] = session.getFoldWidget(row);\n }\n\n if (c) {\n if (!cell.foldWidget) {\n cell.foldWidget = dom.createElement(\"span\");\n cell.element.appendChild(cell.foldWidget);\n }\n var className = \"ace_fold-widget ace_\" + c;\n if (c == \"start\" && row == foldStart && row < fold.end.row)\n className += \" ace_closed\";\n else\n className += \" ace_open\";\n if (cell.foldWidget.className != className)\n cell.foldWidget.className = className;\n\n var height = config.lineHeight + \"px\";\n if (cell.foldWidget.style.height != height)\n cell.foldWidget.style.height = height;\n } else {\n if (cell.foldWidget) {\n cell.element.removeChild(cell.foldWidget);\n cell.foldWidget = null;\n }\n }\n \n var text = lastLineNumber = gutterRenderer\n ? gutterRenderer.getText(session, row)\n : row + firstLineNumber;\n if (text !== cell.textNode.data)\n cell.textNode.data = text;\n\n row++;\n }\n\n this.element.style.height = config.minHeight + \"px\";\n\n if (this.$fixedWidth || session.$useWrapMode)\n lastLineNumber = session.getLength() + firstLineNumber;\n\n var gutterWidth = gutterRenderer \n ? gutterRenderer.getWidth(session, lastLineNumber, config)\n : lastLineNumber.toString().length * config.characterWidth;\n \n var padding = this.$padding || this.$computePadding();\n gutterWidth += padding.left + padding.right;\n if (gutterWidth !== this.gutterWidth && !isNaN(gutterWidth)) {\n this.gutterWidth = gutterWidth;\n this.element.style.width = Math.ceil(this.gutterWidth) + \"px\";\n this._emit(\"changeGutterWidth\", gutterWidth);\n }\n };\n\n this.$fixedWidth = false;\n \n this.$showLineNumbers = true;\n this.$renderer = \"\";\n this.setShowLineNumbers = function(show) {\n this.$renderer = !show && {\n getWidth: function() {return \"\";},\n getText: function() {return \"\";}\n };\n };\n \n this.getShowLineNumbers = function() {\n return this.$showLineNumbers;\n };\n \n this.$showFoldWidgets = true;\n this.setShowFoldWidgets = function(show) {\n if (show)\n dom.addCssClass(this.element, \"ace_folding-enabled\");\n else\n dom.removeCssClass(this.element, \"ace_folding-enabled\");\n\n this.$showFoldWidgets = show;\n this.$padding = null;\n };\n \n this.getShowFoldWidgets = function() {\n return this.$showFoldWidgets;\n };\n\n this.$computePadding = function() {\n if (!this.element.firstChild)\n return {left: 0, right: 0};\n var style = dom.computedStyle(this.element.firstChild);\n this.$padding = {};\n this.$padding.left = parseInt(style.paddingLeft) + 1 || 0;\n this.$padding.right = parseInt(style.paddingRight) || 0;\n return this.$padding;\n };\n\n this.getRegion = function(point) {\n var padding = this.$padding || this.$computePadding();\n var rect = this.element.getBoundingClientRect();\n if (point.x < padding.left + rect.left)\n return \"markers\";\n if (this.$showFoldWidgets && point.x > rect.right - padding.right)\n return \"foldWidgets\";\n };\n\n}).call(Gutter.prototype);\n\nexports.Gutter = Gutter;\n\n});\n\nace.define(\"ace/layer/marker\",[\"require\",\"exports\",\"module\",\"ace/range\",\"ace/lib/dom\"], function(acequire, exports, module) {\n\"use strict\";\n\nvar Range = acequire(\"../range\").Range;\nvar dom = acequire(\"../lib/dom\");\n\nvar Marker = function(parentEl) {\n this.element = dom.createElement(\"div\");\n this.element.className = \"ace_layer ace_marker-layer\";\n parentEl.appendChild(this.element);\n};\n\n(function() {\n\n this.$padding = 0;\n\n this.setPadding = function(padding) {\n this.$padding = padding;\n };\n this.setSession = function(session) {\n this.session = session;\n };\n \n this.setMarkers = function(markers) {\n this.markers = markers;\n };\n\n this.update = function(config) {\n if (!config) return;\n\n this.config = config;\n\n\n var html = [];\n for (var key in this.markers) {\n var marker = this.markers[key];\n\n if (!marker.range) {\n marker.update(html, this, this.session, config);\n continue;\n }\n\n var range = marker.range.clipRows(config.firstRow, config.lastRow);\n if (range.isEmpty()) continue;\n\n range = range.toScreenRange(this.session);\n if (marker.renderer) {\n var top = this.$getTop(range.start.row, config);\n var left = this.$padding + (this.session.$bidiHandler.isBidiRow(range.start.row)\n ? this.session.$bidiHandler.getPosLeft(range.start.column)\n : range.start.column * config.characterWidth);\n marker.renderer(html, range, left, top, config);\n } else if (marker.type == \"fullLine\") {\n this.drawFullLineMarker(html, range, marker.clazz, config);\n } else if (marker.type == \"screenLine\") {\n this.drawScreenLineMarker(html, range, marker.clazz, config);\n } else if (range.isMultiLine()) {\n if (marker.type == \"text\")\n this.drawTextMarker(html, range, marker.clazz, config);\n else\n this.drawMultiLineMarker(html, range, marker.clazz, config);\n } else {\n if (this.session.$bidiHandler.isBidiRow(range.start.row)) {\n this.drawBidiSingleLineMarker(html, range, marker.clazz + \" ace_start\" + \" ace_br15\", config);\n } else {\n this.drawSingleLineMarker(html, range, marker.clazz + \" ace_start\" + \" ace_br15\", config);\n }\n }\n }\n this.element.innerHTML = html.join(\"\");\n };\n\n this.$getTop = function(row, layerConfig) {\n return (row - layerConfig.firstRowScreen) * layerConfig.lineHeight;\n };\n\n function getBorderClass(tl, tr, br, bl) {\n return (tl ? 1 : 0) | (tr ? 2 : 0) | (br ? 4 : 0) | (bl ? 8 : 0);\n }\n this.drawTextMarker = function(stringBuilder, range, clazz, layerConfig, extraStyle) {\n var session = this.session;\n var start = range.start.row;\n var end = range.end.row;\n var row = start;\n var prev = 0; \n var curr = 0;\n var next = session.getScreenLastRowColumn(row);\n var clazzModified = null;\n var lineRange = new Range(row, range.start.column, row, curr);\n for (; row <= end; row++) {\n lineRange.start.row = lineRange.end.row = row;\n lineRange.start.column = row == start ? range.start.column : session.getRowWrapIndent(row);\n lineRange.end.column = next;\n prev = curr;\n curr = next;\n next = row + 1 < end ? session.getScreenLastRowColumn(row + 1) : row == end ? 0 : range.end.column;\n clazzModified = clazz + (row == start ? \" ace_start\" : \"\") + \" ace_br\"\n + getBorderClass(row == start || row == start + 1 && range.start.column, prev < curr, curr > next, row == end);\n\n if (this.session.$bidiHandler.isBidiRow(row)) {\n this.drawBidiSingleLineMarker(stringBuilder, lineRange, clazzModified,\n layerConfig, row == end ? 0 : 1, extraStyle);\n } else {\n this.drawSingleLineMarker(stringBuilder, lineRange, clazzModified,\n layerConfig, row == end ? 0 : 1, extraStyle);\n }\n }\n };\n this.drawMultiLineMarker = function(stringBuilder, range, clazz, config, extraStyle) {\n var padding = this.$padding;\n var height, top, left;\n extraStyle = extraStyle || \"\";\n if (this.session.$bidiHandler.isBidiRow(range.start.row)) {\n var range1 = range.clone();\n range1.end.row = range1.start.row;\n range1.end.column = this.session.getLine(range1.start.row).length;\n this.drawBidiSingleLineMarker(stringBuilder, range1, clazz + \" ace_br1 ace_start\", config, null, extraStyle);\n } else {\n height = config.lineHeight;\n top = this.$getTop(range.start.row, config);\n left = padding + range.start.column * config.characterWidth;\n stringBuilder.push(\n \"<div class='\", clazz, \" ace_br1 ace_start' style='\",\n \"height:\", height, \"px;\",\n \"right:0;\",\n \"top:\", top, \"px;\",\n \"left:\", left, \"px;\", extraStyle, \"'></div>\"\n );\n }\n if (this.session.$bidiHandler.isBidiRow(range.end.row)) {\n var range1 = range.clone();\n range1.start.row = range1.end.row;\n range1.start.column = 0;\n this.drawBidiSingleLineMarker(stringBuilder, range1, clazz + \" ace_br12\", config, null, extraStyle);\n } else {\n var width = range.end.column * config.characterWidth;\n height = config.lineHeight;\n top = this.$getTop(range.end.row, config);\n stringBuilder.push(\n \"<div class='\", clazz, \" ace_br12' style='\",\n \"height:\", height, \"px;\",\n \"width:\", width, \"px;\",\n \"top:\", top, \"px;\",\n \"left:\", padding, \"px;\", extraStyle, \"'></div>\"\n );\n }\n height = (range.end.row - range.start.row - 1) * config.lineHeight;\n if (height <= 0)\n return;\n top = this.$getTop(range.start.row + 1, config);\n \n var radiusClass = (range.start.column ? 1 : 0) | (range.end.column ? 0 : 8);\n\n stringBuilder.push(\n \"<div class='\", clazz, (radiusClass ? \" ace_br\" + radiusClass : \"\"), \"' style='\",\n \"height:\", height, \"px;\",\n \"right:0;\",\n \"top:\", top, \"px;\",\n \"left:\", padding, \"px;\", extraStyle, \"'></div>\"\n );\n };\n this.drawSingleLineMarker = function(stringBuilder, range, clazz, config, extraLength, extraStyle) {\n var height = config.lineHeight;\n var width = (range.end.column + (extraLength || 0) - range.start.column) * config.characterWidth;\n\n var top = this.$getTop(range.start.row, config);\n var left = this.$padding + range.start.column * config.characterWidth;\n\n stringBuilder.push(\n \"<div class='\", clazz, \"' style='\",\n \"height:\", height, \"px;\",\n \"width:\", width, \"px;\",\n \"top:\", top, \"px;\",\n \"left:\", left, \"px;\", extraStyle || \"\", \"'></div>\"\n );\n };\n this.drawBidiSingleLineMarker = function(stringBuilder, range, clazz, config, extraLength, extraStyle) {\n var height = config.lineHeight, top = this.$getTop(range.start.row, config), padding = this.$padding;\n var selections = this.session.$bidiHandler.getSelections(range.start.column, range.end.column);\n\n selections.forEach(function(selection) {\n stringBuilder.push(\n \"<div class='\", clazz, \"' style='\",\n \"height:\", height, \"px;\",\n \"width:\", selection.width + (extraLength || 0), \"px;\",\n \"top:\", top, \"px;\",\n \"left:\", padding + selection.left, \"px;\", extraStyle || \"\", \"'></div>\"\n );\n });\n };\n\n this.drawFullLineMarker = function(stringBuilder, range, clazz, config, extraStyle) {\n var top = this.$getTop(range.start.row, config);\n var height = config.lineHeight;\n if (range.start.row != range.end.row)\n height += this.$getTop(range.end.row, config) - top;\n\n stringBuilder.push(\n \"<div class='\", clazz, \"' style='\",\n \"height:\", height, \"px;\",\n \"top:\", top, \"px;\",\n \"left:0;right:0;\", extraStyle || \"\", \"'></div>\"\n );\n };\n \n this.drawScreenLineMarker = function(stringBuilder, range, clazz, config, extraStyle) {\n var top = this.$getTop(range.start.row, config);\n var height = config.lineHeight;\n\n stringBuilder.push(\n \"<div class='\", clazz, \"' style='\",\n \"height:\", height, \"px;\",\n \"top:\", top, \"px;\",\n \"left:0;right:0;\", extraStyle || \"\", \"'></div>\"\n );\n };\n\n}).call(Marker.prototype);\n\nexports.Marker = Marker;\n\n});\n\nace.define(\"ace/layer/text\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/dom\",\"ace/lib/lang\",\"ace/lib/useragent\",\"ace/lib/event_emitter\"], function(acequire, exports, module) {\n\"use strict\";\n\nvar oop = acequire(\"../lib/oop\");\nvar dom = acequire(\"../lib/dom\");\nvar lang = acequire(\"../lib/lang\");\nvar useragent = acequire(\"../lib/useragent\");\nvar EventEmitter = acequire(\"../lib/event_emitter\").EventEmitter;\n\nvar Text = function(parentEl) {\n this.element = dom.createElement(\"div\");\n this.element.className = \"ace_layer ace_text-layer\";\n parentEl.appendChild(this.element);\n this.$updateEolChar = this.$updateEolChar.bind(this);\n};\n\n(function() {\n\n oop.implement(this, EventEmitter);\n\n this.EOF_CHAR = \"\\xB6\";\n this.EOL_CHAR_LF = \"\\xAC\";\n this.EOL_CHAR_CRLF = \"\\xa4\";\n this.EOL_CHAR = this.EOL_CHAR_LF;\n this.TAB_CHAR = \"\\u2014\"; //\"\\u21E5\";\n this.SPACE_CHAR = \"\\xB7\";\n this.$padding = 0;\n\n this.$updateEolChar = function() {\n var EOL_CHAR = this.session.doc.getNewLineCharacter() == \"\\n\"\n ? this.EOL_CHAR_LF\n : this.EOL_CHAR_CRLF;\n if (this.EOL_CHAR != EOL_CHAR) {\n this.EOL_CHAR = EOL_CHAR;\n return true;\n }\n };\n\n this.setPadding = function(padding) {\n this.$padding = padding;\n this.element.style.padding = \"0 \" + padding + \"px\";\n };\n\n this.getLineHeight = function() {\n return this.$fontMetrics.$characterSize.height || 0;\n };\n\n this.getCharacterWidth = function() {\n return this.$fontMetrics.$characterSize.width || 0;\n };\n \n this.$setFontMetrics = function(measure) {\n this.$fontMetrics = measure;\n this.$fontMetrics.on(\"changeCharacterSize\", function(e) {\n this._signal(\"changeCharacterSize\", e);\n }.bind(this));\n this.$pollSizeChanges();\n };\n\n this.checkForSizeChanges = function() {\n this.$fontMetrics.checkForSizeChanges();\n };\n this.$pollSizeChanges = function() {\n return this.$pollSizeChangesTimer = this.$fontMetrics.$pollSizeChanges();\n };\n this.setSession = function(session) {\n this.session = session;\n if (session)\n this.$computeTabString();\n };\n\n this.showInvisibles = false;\n this.setShowInvisibles = function(showInvisibles) {\n if (this.showInvisibles == showInvisibles)\n return false;\n\n this.showInvisibles = showInvisibles;\n this.$computeTabString();\n return true;\n };\n\n this.displayIndentGuides = true;\n this.setDisplayIndentGuides = function(display) {\n if (this.displayIndentGuides == display)\n return false;\n\n this.displayIndentGuides = display;\n this.$computeTabString();\n return true;\n };\n\n this.$tabStrings = [];\n this.onChangeTabSize =\n this.$computeTabString = function() {\n var tabSize = this.session.getTabSize();\n this.tabSize = tabSize;\n var tabStr = this.$tabStrings = [0];\n for (var i = 1; i < tabSize + 1; i++) {\n if (this.showInvisibles) {\n tabStr.push(\"<span class='ace_invisible ace_invisible_tab'>\"\n + lang.stringRepeat(this.TAB_CHAR, i)\n + \"</span>\");\n } else {\n tabStr.push(lang.stringRepeat(\" \", i));\n }\n }\n if (this.displayIndentGuides) {\n this.$indentGuideRe = /\\s\\S| \\t|\\t |\\s$/;\n var className = \"ace_indent-guide\";\n var spaceClass = \"\";\n var tabClass = \"\";\n if (this.showInvisibles) {\n className += \" ace_invisible\";\n spaceClass = \" ace_invisible_space\";\n tabClass = \" ace_invisible_tab\";\n var spaceContent = lang.stringRepeat(this.SPACE_CHAR, this.tabSize);\n var tabContent = lang.stringRepeat(this.TAB_CHAR, this.tabSize);\n } else{\n var spaceContent = lang.stringRepeat(\" \", this.tabSize);\n var tabContent = spaceContent;\n }\n\n this.$tabStrings[\" \"] = \"<span class='\" + className + spaceClass + \"'>\" + spaceContent + \"</span>\";\n this.$tabStrings[\"\\t\"] = \"<span class='\" + className + tabClass + \"'>\" + tabContent + \"</span>\";\n }\n };\n\n this.updateLines = function(config, firstRow, lastRow) {\n if (this.config.lastRow != config.lastRow ||\n this.config.firstRow != config.firstRow) {\n this.scrollLines(config);\n }\n this.config = config;\n\n var first = Math.max(firstRow, config.firstRow);\n var last = Math.min(lastRow, config.lastRow);\n\n var lineElements = this.element.childNodes;\n var lineElementsIdx = 0;\n\n for (var row = config.firstRow; row < first; row++) {\n var foldLine = this.session.getFoldLine(row);\n if (foldLine) {\n if (foldLine.containsRow(first)) {\n first = foldLine.start.row;\n break;\n } else {\n row = foldLine.end.row;\n }\n }\n lineElementsIdx ++;\n }\n\n var row = first;\n var foldLine = this.session.getNextFoldLine(row);\n var foldStart = foldLine ? foldLine.start.row : Infinity;\n\n while (true) {\n if (row > foldStart) {\n row = foldLine.end.row+1;\n foldLine = this.session.getNextFoldLine(row, foldLine);\n foldStart = foldLine ? foldLine.start.row :Infinity;\n }\n if (row > last)\n break;\n\n var lineElement = lineElements[lineElementsIdx++];\n if (lineElement) {\n var html = [];\n this.$renderLine(\n html, row, !this.$useLineGroups(), row == foldStart ? foldLine : false\n );\n lineElement.style.height = config.lineHeight * this.session.getRowLength(row) + \"px\";\n lineElement.innerHTML = html.join(\"\");\n }\n row++;\n }\n };\n\n this.scrollLines = function(config) {\n var oldConfig = this.config;\n this.config = config;\n\n if (!oldConfig || oldConfig.lastRow < config.firstRow)\n return this.update(config);\n\n if (config.lastRow < oldConfig.firstRow)\n return this.update(config);\n\n var el = this.element;\n if (oldConfig.firstRow < config.firstRow)\n for (var row=this.session.getFoldedRowCount(oldConfig.firstRow, config.firstRow - 1); row>0; row--)\n el.removeChild(el.firstChild);\n\n if (oldConfig.lastRow > config.lastRow)\n for (var row=this.session.getFoldedRowCount(config.lastRow + 1, oldConfig.lastRow); row>0; row--)\n el.removeChild(el.lastChild);\n\n if (config.firstRow < oldConfig.firstRow) {\n var fragment = this.$renderLinesFragment(config, config.firstRow, oldConfig.firstRow - 1);\n if (el.firstChild)\n el.insertBefore(fragment, el.firstChild);\n else\n el.appendChild(fragment);\n }\n\n if (config.lastRow > oldConfig.lastRow) {\n var fragment = this.$renderLinesFragment(config, oldConfig.lastRow + 1, config.lastRow);\n el.appendChild(fragment);\n }\n };\n\n this.$renderLinesFragment = function(config, firstRow, lastRow) {\n var fragment = this.element.ownerDocument.createDocumentFragment();\n var row = firstRow;\n var foldLine = this.session.getNextFoldLine(row);\n var foldStart = foldLine ? foldLine.start.row : Infinity;\n\n while (true) {\n if (row > foldStart) {\n row = foldLine.end.row+1;\n foldLine = this.session.getNextFoldLine(row, foldLine);\n foldStart = foldLine ? foldLine.start.row : Infinity;\n }\n if (row > lastRow)\n break;\n\n var container = dom.createElement(\"div\");\n\n var html = [];\n this.$renderLine(html, row, false, row == foldStart ? foldLine : false);\n container.innerHTML = html.join(\"\");\n if (this.$useLineGroups()) {\n container.className = 'ace_line_group';\n fragment.appendChild(container);\n container.style.height = config.lineHeight * this.session.getRowLength(row) + \"px\";\n\n } else {\n while(container.firstChild)\n fragment.appendChild(container.firstChild);\n }\n\n row++;\n }\n return fragment;\n };\n\n this.update = function(config) {\n this.config = config;\n\n var html = [];\n var firstRow = config.firstRow, lastRow = config.lastRow;\n\n var row = firstRow;\n var foldLine = this.session.getNextFoldLine(row);\n var foldStart = foldLine ? foldLine.start.row : Infinity;\n\n while (true) {\n if (row > foldStart) {\n row = foldLine.end.row+1;\n foldLine = this.session.getNextFoldLine(row, foldLine);\n foldStart = foldLine ? foldLine.start.row :Infinity;\n }\n if (row > lastRow)\n break;\n\n if (this.$useLineGroups())\n html.push(\"<div class='ace_line_group' style='height:\", config.lineHeight*this.session.getRowLength(row), \"px'>\");\n\n this.$renderLine(html, row, false, row == foldStart ? foldLine : false);\n\n if (this.$useLineGroups())\n html.push(\"</div>\"); // end the line group\n\n row++;\n }\n this.element.innerHTML = html.join(\"\");\n };\n\n this.$textToken = {\n \"text\": true,\n \"rparen\": true,\n \"lparen\": true\n };\n\n this.$renderToken = function(stringBuilder, screenColumn, token, value) {\n var self = this;\n var replaceReg = /\\t|&|<|>|( +)|([\\x00-\\x1f\\x80-\\xa0\\xad\\u1680\\u180E\\u2000-\\u200f\\u2028\\u2029\\u202F\\u205F\\u3000\\uFEFF\\uFFF9-\\uFFFC])|[\\u1100-\\u115F\\u11A3-\\u11A7\\u11FA-\\u11FF\\u2329-\\u232A\\u2E80-\\u2E99\\u2E9B-\\u2EF3\\u2F00-\\u2FD5\\u2FF0-\\u2FFB\\u3000-\\u303E\\u3041-\\u3096\\u3099-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u3190-\\u31BA\\u31C0-\\u31E3\\u31F0-\\u321E\\u3220-\\u3247\\u3250-\\u32FE\\u3300-\\u4DBF\\u4E00-\\uA48C\\uA490-\\uA4C6\\uA960-\\uA97C\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFAFF\\uFE10-\\uFE19\\uFE30-\\uFE52\\uFE54-\\uFE66\\uFE68-\\uFE6B\\uFF01-\\uFF60\\uFFE0-\\uFFE6]|[\\uD800-\\uDBFF][\\uDC00-\\uDFFF]/g;\n var replaceFunc = function(c, a, b, tabIdx, idx4) {\n if (a) {\n return self.showInvisibles\n ? \"<span class='ace_invisible ace_invisible_space'>\" + lang.stringRepeat(self.SPACE_CHAR, c.length) + \"</span>\"\n : c;\n } else if (c == \"&\") {\n return \"&#38;\";\n } else if (c == \"<\") {\n return \"&#60;\";\n } else if (c == \">\") {\n return \"&#62;\";\n } else if (c == \"\\t\") {\n var tabSize = self.session.getScreenTabSize(screenColumn + tabIdx);\n screenColumn += tabSize - 1;\n return self.$tabStrings[tabSize];\n } else if (c == \"\\u3000\") {\n var classToUse = self.showInvisibles ? \"ace_cjk ace_invisible ace_invisible_space\" : \"ace_cjk\";\n var space = self.showInvisibles ? self.SPACE_CHAR : \"\";\n screenColumn += 1;\n return \"<span class='\" + classToUse + \"' style='width:\" +\n (self.config.characterWidth * 2) +\n \"px'>\" + space + \"</span>\";\n } else if (b) {\n return \"<span class='ace_invisible ace_invisible_space ace_invalid'>\" + self.SPACE_CHAR + \"</span>\";\n } else {\n screenColumn += 1;\n return \"<span class='ace_cjk' style='width:\" +\n (self.config.characterWidth * 2) +\n \"px'>\" + c + \"</span>\";\n }\n };\n\n var output = value.replace(replaceReg, replaceFunc);\n\n if (!this.$textToken[token.type]) {\n var classes = \"ace_\" + token.type.replace(/\\./g, \" ace_\");\n var style = \"\";\n if (token.type == \"fold\")\n style = \" style='width:\" + (token.value.length * this.config.characterWidth) + \"px;' \";\n stringBuilder.push(\"<span class='\", classes, \"'\", style, \">\", output, \"</span>\");\n }\n else {\n stringBuilder.push(output);\n }\n return screenColumn + value.length;\n };\n\n this.renderIndentGuide = function(stringBuilder, value, max) {\n var cols = value.search(this.$indentGuideRe);\n if (cols <= 0 || cols >= max)\n return value;\n if (value[0] == \" \") {\n cols -= cols % this.tabSize;\n stringBuilder.push(lang.stringRepeat(this.$tabStrings[\" \"], cols/this.tabSize));\n return value.substr(cols);\n } else if (value[0] == \"\\t\") {\n stringBuilder.push(lang.stringRepeat(this.$tabStrings[\"\\t\"], cols));\n return value.substr(cols);\n }\n return value;\n };\n\n this.$renderWrappedLine = function(stringBuilder, tokens, splits, onlyContents) {\n var chars = 0;\n var split = 0;\n var splitChars = splits[0];\n var screenColumn = 0;\n\n for (var i = 0; i < tokens.length; i++) {\n var token = tokens[i];\n var value = token.value;\n if (i == 0 && this.displayIndentGuides) {\n chars = value.length;\n value = this.renderIndentGuide(stringBuilder, value, splitChars);\n if (!value)\n continue;\n chars -= value.length;\n }\n\n if (chars + value.length < splitChars) {\n screenColumn = this.$renderToken(stringBuilder, screenColumn, token, value);\n chars += value.length;\n } else {\n while (chars + value.length >= splitChars) {\n screenColumn = this.$renderToken(\n stringBuilder, screenColumn,\n token, value.substring(0, splitChars - chars)\n );\n value = value.substring(splitChars - chars);\n chars = splitChars;\n\n if (!onlyContents) {\n stringBuilder.push(\"</div>\",\n \"<div class='ace_line' style='height:\",\n this.config.lineHeight, \"px'>\"\n );\n }\n\n stringBuilder.push(lang.stringRepeat(\"\\xa0\", splits.indent));\n\n split ++;\n screenColumn = 0;\n splitChars = splits[split] || Number.MAX_VALUE;\n }\n if (value.length != 0) {\n chars += value.length;\n screenColumn = this.$renderToken(\n stringBuilder, screenColumn, token, value\n );\n }\n }\n }\n };\n\n this.$renderSimpleLine = function(stringBuilder, tokens) {\n var screenColumn = 0;\n var token = tokens[0];\n var value = token.value;\n if (this.displayIndentGuides)\n value = this.renderIndentGuide(stringBuilder, value);\n if (value)\n screenColumn = this.$renderToken(stringBuilder, screenColumn, token, value);\n for (var i = 1; i < tokens.length; i++) {\n token = tokens[i];\n value = token.value;\n screenColumn = this.$renderToken(stringBuilder, screenColumn, token, value);\n }\n };\n this.$renderLine = function(stringBuilder, row, onlyContents, foldLine) {\n if (!foldLine && foldLine != false)\n foldLine = this.session.getFoldLine(row);\n\n if (foldLine)\n var tokens = this.$getFoldLineTokens(row, foldLine);\n else\n var tokens = this.session.getTokens(row);\n\n\n if (!onlyContents) {\n stringBuilder.push(\n \"<div class='ace_line' style='height:\", \n this.config.lineHeight * (\n this.$useLineGroups() ? 1 :this.session.getRowLength(row)\n ), \"px'>\"\n );\n }\n\n if (tokens.length) {\n var splits = this.session.getRowSplitData(row);\n if (splits && splits.length)\n this.$renderWrappedLine(stringBuilder, tokens, splits, onlyContents);\n else\n this.$renderSimpleLine(stringBuilder, tokens);\n }\n\n if (this.showInvisibles) {\n if (foldLine)\n row = foldLine.end.row;\n\n stringBuilder.push(\n \"<span class='ace_invisible ace_invisible_eol'>\",\n row == this.session.getLength() - 1 ? this.EOF_CHAR : this.EOL_CHAR,\n \"</span>\"\n );\n }\n if (!onlyContents)\n stringBuilder.push(\"</div>\");\n };\n\n this.$getFoldLineTokens = function(row, foldLine) {\n var session = this.session;\n var renderTokens = [];\n\n function addTokens(tokens, from, to) {\n var idx = 0, col = 0;\n while ((col + tokens[idx].value.length) < from) {\n col += tokens[idx].value.length;\n idx++;\n\n if (idx == tokens.length)\n return;\n }\n if (col != from) {\n var value = tokens[idx].value.substring(from - col);\n if (value.length > (to - from))\n value = value.substring(0, to - from);\n\n renderTokens.push({\n type: tokens[idx].type,\n value: value\n });\n\n col = from + value.length;\n idx += 1;\n }\n\n while (col < to && idx < tokens.length) {\n var value = tokens[idx].value;\n if (value.length + col > to) {\n renderTokens.push({\n type: tokens[idx].type,\n value: value.substring(0, to - col)\n });\n } else\n renderTokens.push(tokens[idx]);\n col += value.length;\n idx += 1;\n }\n }\n\n var tokens = session.getTokens(row);\n foldLine.walk(function(placeholder, row, column, lastColumn, isNewRow) {\n if (placeholder != null) {\n renderTokens.push({\n type: \"fold\",\n value: placeholder\n });\n } else {\n if (isNewRow)\n tokens = session.getTokens(row);\n\n if (tokens.length)\n addTokens(tokens, lastColumn, column);\n }\n }, foldLine.end.row, this.session.getLine(foldLine.end.row).length);\n\n return renderTokens;\n };\n\n this.$useLineGroups = function() {\n return this.session.getUseWrapMode();\n };\n\n this.destroy = function() {\n clearInterval(this.$pollSizeChangesTimer);\n if (this.$measureNode)\n this.$measureNode.parentNode.removeChild(this.$measureNode);\n delete this.$measureNode;\n };\n\n}).call(Text.prototype);\n\nexports.Text = Text;\n\n});\n\nace.define(\"ace/layer/cursor\",[\"require\",\"exports\",\"module\",\"ace/lib/dom\"], function(acequire, exports, module) {\n\"use strict\";\n\nvar dom = acequire(\"../lib/dom\");\nvar isIE8;\n\nvar Cursor = function(parentEl) {\n this.element = dom.createElement(\"div\");\n this.element.className = \"ace_layer ace_cursor-layer\";\n parentEl.appendChild(this.element);\n \n if (isIE8 === undefined)\n isIE8 = !(\"opacity\" in this.element.style);\n\n this.isVisible = false;\n this.isBlinking = true;\n this.blinkInterval = 1000;\n this.smoothBlinking = false;\n\n this.cursors = [];\n this.cursor = this.addCursor();\n dom.addCssClass(this.element, \"ace_hidden-cursors\");\n this.$updateCursors = (isIE8\n ? this.$updateVisibility\n : this.$updateOpacity).bind(this);\n};\n\n(function() {\n \n this.$updateVisibility = function(val) {\n var cursors = this.cursors;\n for (var i = cursors.length; i--; )\n cursors[i].style.visibility = val ? \"\" : \"hidden\";\n };\n this.$updateOpacity = function(val) {\n var cursors = this.cursors;\n for (var i = cursors.length; i--; )\n cursors[i].style.opacity = val ? \"\" : \"0\";\n };\n \n\n this.$padding = 0;\n this.setPadding = function(padding) {\n this.$padding = padding;\n };\n\n this.setSession = function(session) {\n this.session = session;\n };\n\n this.setBlinking = function(blinking) {\n if (blinking != this.isBlinking){\n this.isBlinking = blinking;\n this.restartTimer();\n }\n };\n\n this.setBlinkInterval = function(blinkInterval) {\n if (blinkInterval != this.blinkInterval){\n this.blinkInterval = blinkInterval;\n this.restartTimer();\n }\n };\n\n this.setSmoothBlinking = function(smoothBlinking) {\n if (smoothBlinking != this.smoothBlinking && !isIE8) {\n this.smoothBlinking = smoothBlinking;\n dom.setCssClass(this.element, \"ace_smooth-blinking\", smoothBlinking);\n this.$updateCursors(true);\n this.$updateCursors = (this.$updateOpacity).bind(this);\n this.restartTimer();\n }\n };\n\n this.addCursor = function() {\n var el = dom.createElement(\"div\");\n el.className = \"ace_cursor\";\n this.element.appendChild(el);\n this.cursors.push(el);\n return el;\n };\n\n this.removeCursor = function() {\n if (this.cursors.length > 1) {\n var el = this.cursors.pop();\n el.parentNode.removeChild(el);\n return el;\n }\n };\n\n this.hideCursor = function() {\n this.isVisible = false;\n dom.addCssClass(this.element, \"ace_hidden-cursors\");\n this.restartTimer();\n };\n\n this.showCursor = function() {\n this.isVisible = true;\n dom.removeCssClass(this.element, \"ace_hidden-cursors\");\n this.restartTimer();\n };\n\n this.restartTimer = function() {\n var update = this.$updateCursors;\n clearInterval(this.intervalId);\n clearTimeout(this.timeoutId);\n if (this.smoothBlinking) {\n dom.removeCssClass(this.element, \"ace_smooth-blinking\");\n }\n \n update(true);\n\n if (!this.isBlinking || !this.blinkInterval || !this.isVisible)\n return;\n\n if (this.smoothBlinking) {\n setTimeout(function(){\n dom.addCssClass(this.element, \"ace_smooth-blinking\");\n }.bind(this));\n }\n \n var blink = function(){\n this.timeoutId = setTimeout(function() {\n update(false);\n }, 0.6 * this.blinkInterval);\n }.bind(this);\n\n this.intervalId = setInterval(function() {\n update(true);\n blink();\n }, this.blinkInterval);\n\n blink();\n };\n\n this.getPixelPosition = function(position, onScreen) {\n if (!this.config || !this.session)\n return {left : 0, top : 0};\n\n if (!position)\n position = this.session.selection.getCursor();\n var pos = this.session.documentToScreenPosition(position);\n var cursorLeft = this.$padding + (this.session.$bidiHandler.isBidiRow(pos.row, position.row)\n ? this.session.$bidiHandler.getPosLeft(pos.column)\n : pos.column * this.config.characterWidth);\n\n var cursorTop = (pos.row - (onScreen ? this.config.firstRowScreen : 0)) *\n this.config.lineHeight;\n\n return {left : cursorLeft, top : cursorTop};\n };\n\n this.update = function(config) {\n this.config = config;\n\n var selections = this.session.$selectionMarkers;\n var i = 0, cursorIndex = 0;\n\n if (selections === undefined || selections.length === 0){\n selections = [{cursor: null}];\n }\n\n for (var i = 0, n = selections.length; i < n; i++) {\n var pixelPos = this.getPixelPosition(selections[i].cursor, true);\n if ((pixelPos.top > config.height + config.offset ||\n pixelPos.top < 0) && i > 1) {\n continue;\n }\n\n var style = (this.cursors[cursorIndex++] || this.addCursor()).style;\n \n if (!this.drawCursor) {\n style.left = pixelPos.left + \"px\";\n style.top = pixelPos.top + \"px\";\n style.width = config.characterWidth + \"px\";\n style.height = config.lineHeight + \"px\";\n } else {\n this.drawCursor(style, pixelPos, config, selections[i], this.session);\n }\n }\n while (this.cursors.length > cursorIndex)\n this.removeCursor();\n\n var overwrite = this.session.getOverwrite();\n this.$setOverwrite(overwrite);\n this.$pixelPos = pixelPos;\n this.restartTimer();\n };\n \n this.drawCursor = null;\n\n this.$setOverwrite = function(overwrite) {\n if (overwrite != this.overwrite) {\n this.overwrite = overwrite;\n if (overwrite)\n dom.addCssClass(this.element, \"ace_overwrite-cursors\");\n else\n dom.removeCssClass(this.element, \"ace_overwrite-cursors\");\n }\n };\n\n this.destroy = function() {\n clearInterval(this.intervalId);\n clearTimeout(this.timeoutId);\n };\n\n}).call(Cursor.prototype);\n\nexports.Cursor = Cursor;\n\n});\n\nace.define(\"ace/scrollbar\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/dom\",\"ace/lib/event\",\"ace/lib/event_emitter\"], function(acequire, exports, module) {\n\"use strict\";\n\nvar oop = acequire(\"./lib/oop\");\nvar dom = acequire(\"./lib/dom\");\nvar event = acequire(\"./lib/event\");\nvar EventEmitter = acequire(\"./lib/event_emitter\").EventEmitter;\nvar MAX_SCROLL_H = 0x8000;\nvar ScrollBar = function(parent) {\n this.element = dom.createElement(\"div\");\n this.element.className = \"ace_scrollbar ace_scrollbar\" + this.classSuffix;\n\n this.inner = dom.createElement(\"div\");\n this.inner.className = \"ace_scrollbar-inner\";\n this.element.appendChild(this.inner);\n\n parent.appendChild(this.element);\n\n this.setVisible(false);\n this.skipEvent = false;\n\n event.addListener(this.element, \"scroll\", this.onScroll.bind(this));\n event.addListener(this.element, \"mousedown\", event.preventDefault);\n};\n\n(function() {\n oop.implement(this, EventEmitter);\n\n this.setVisible = function(isVisible) {\n this.element.style.display = isVisible ? \"\" : \"none\";\n this.isVisible = isVisible;\n this.coeff = 1;\n };\n}).call(ScrollBar.prototype);\nvar VScrollBar = function(parent, renderer) {\n ScrollBar.call(this, parent);\n this.scrollTop = 0;\n this.scrollHeight = 0;\n renderer.$scrollbarWidth = \n this.width = dom.scrollbarWidth(parent.ownerDocument);\n this.inner.style.width =\n this.element.style.width = (this.width || 15) + 5 + \"px\";\n this.$minWidth = 0;\n};\n\noop.inherits(VScrollBar, ScrollBar);\n\n(function() {\n\n this.classSuffix = '-v';\n this.onScroll = function() {\n if (!this.skipEvent) {\n this.scrollTop = this.element.scrollTop;\n if (this.coeff != 1) {\n var h = this.element.clientHeight / this.scrollHeight;\n this.scrollTop = this.scrollTop * (1 - h) / (this.coeff - h);\n }\n this._emit(\"scroll\", {data: this.scrollTop});\n }\n this.skipEvent = false;\n };\n this.getWidth = function() {\n return Math.max(this.isVisible ? this.width : 0, this.$minWidth || 0);\n };\n this.setHeight = function(height) {\n this.element.style.height = height + \"px\";\n };\n this.setInnerHeight =\n this.setScrollHeight = function(height) {\n this.scrollHeight = height;\n if (height > MAX_SCROLL_H) {\n this.coeff = MAX_SCROLL_H / height;\n height = MAX_SCROLL_H;\n } else if (this.coeff != 1) {\n this.coeff = 1;\n }\n this.inner.style.height = height + \"px\";\n };\n this.setScrollTop = function(scrollTop) {\n if (this.scrollTop != scrollTop) {\n this.skipEvent = true;\n this.scrollTop = scrollTop;\n this.element.scrollTop = scrollTop * this.coeff;\n }\n };\n\n}).call(VScrollBar.prototype);\nvar HScrollBar = function(parent, renderer) {\n ScrollBar.call(this, parent);\n this.scrollLeft = 0;\n this.height = renderer.$scrollbarWidth;\n this.inner.style.height =\n this.element.style.height = (this.height || 15) + 5 + \"px\";\n};\n\noop.inherits(HScrollBar, ScrollBar);\n\n(function() {\n\n this.classSuffix = '-h';\n this.onScroll = function() {\n if (!this.skipEvent) {\n this.scrollLeft = this.element.scrollLeft;\n this._emit(\"scroll\", {data: this.scrollLeft});\n }\n this.skipEvent = false;\n };\n this.getHeight = function() {\n return this.isVisible ? this.height : 0;\n };\n this.setWidth = function(width) {\n this.element.style.width = width + \"px\";\n };\n this.setInnerWidth = function(width) {\n this.inner.style.width = width + \"px\";\n };\n this.setScrollWidth = function(width) {\n this.inner.style.width = width + \"px\";\n };\n this.setScrollLeft = function(scrollLeft) {\n if (this.scrollLeft != scrollLeft) {\n this.skipEvent = true;\n this.scrollLeft = this.element.scrollLeft = scrollLeft;\n }\n };\n\n}).call(HScrollBar.prototype);\n\n\nexports.ScrollBar = VScrollBar; // backward compatibility\nexports.ScrollBarV = VScrollBar; // backward compatibility\nexports.ScrollBarH = HScrollBar; // backward compatibility\n\nexports.VScrollBar = VScrollBar;\nexports.HScrollBar = HScrollBar;\n});\n\nace.define(\"ace/renderloop\",[\"require\",\"exports\",\"module\",\"ace/lib/event\"], function(acequire, exports, module) {\n\"use strict\";\n\nvar event = acequire(\"./lib/event\");\n\n\nvar RenderLoop = function(onRender, win) {\n this.onRender = onRender;\n this.pending = false;\n this.changes = 0;\n this.window = win || window;\n};\n\n(function() {\n\n\n this.schedule = function(change) {\n this.changes = this.changes | change;\n if (!this.pending && this.changes) {\n this.pending = true;\n var _self = this;\n event.nextFrame(function() {\n _self.pending = false;\n var changes;\n while (changes = _self.changes) {\n _self.changes = 0;\n _self.onRender(changes);\n }\n }, this.window);\n }\n };\n\n}).call(RenderLoop.prototype);\n\nexports.RenderLoop = RenderLoop;\n});\n\nace.define(\"ace/layer/font_metrics\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/dom\",\"ace/lib/lang\",\"ace/lib/useragent\",\"ace/lib/event_emitter\"], function(acequire, exports, module) {\n\nvar oop = acequire(\"../lib/oop\");\nvar dom = acequire(\"../lib/dom\");\nvar lang = acequire(\"../lib/lang\");\nvar useragent = acequire(\"../lib/useragent\");\nvar EventEmitter = acequire(\"../lib/event_emitter\").EventEmitter;\n\nvar CHAR_COUNT = 0;\n\nvar FontMetrics = exports.FontMetrics = function(parentEl) {\n this.el = dom.createElement(\"div\");\n this.$setMeasureNodeStyles(this.el.style, true);\n \n this.$main = dom.createElement(\"div\");\n this.$setMeasureNodeStyles(this.$main.style);\n \n this.$measureNode = dom.createElement(\"div\");\n this.$setMeasureNodeStyles(this.$measureNode.style);\n \n \n this.el.appendChild(this.$main);\n this.el.appendChild(this.$measureNode);\n parentEl.appendChild(this.el);\n \n if (!CHAR_COUNT)\n this.$testFractionalRect();\n this.$measureNode.innerHTML = lang.stringRepeat(\"X\", CHAR_COUNT);\n \n this.$characterSize = {width: 0, height: 0};\n this.checkForSizeChanges();\n};\n\n(function() {\n\n oop.implement(this, EventEmitter);\n \n this.$characterSize = {width: 0, height: 0};\n \n this.$testFractionalRect = function() {\n var el = dom.createElement(\"div\");\n this.$setMeasureNodeStyles(el.style);\n el.style.width = \"0.2px\";\n document.documentElement.appendChild(el);\n var w = el.getBoundingClientRect().width;\n if (w > 0 && w < 1)\n CHAR_COUNT = 50;\n else\n CHAR_COUNT = 100;\n el.parentNode.removeChild(el);\n };\n \n this.$setMeasureNodeStyles = function(style, isRoot) {\n style.width = style.height = \"auto\";\n style.left = style.top = \"0px\";\n style.visibility = \"hidden\";\n style.position = \"absolute\";\n style.whiteSpace = \"pre\";\n\n if (useragent.isIE < 8) {\n style[\"font-family\"] = \"inherit\";\n } else {\n style.font = \"inherit\";\n }\n style.overflow = isRoot ? \"hidden\" : \"visible\";\n };\n\n this.checkForSizeChanges = function() {\n var size = this.$measureSizes();\n if (size && (this.$characterSize.width !== size.width || this.$characterSize.height !== size.height)) {\n this.$measureNode.style.fontWeight = \"bold\";\n var boldSize = this.$measureSizes();\n this.$measureNode.style.fontWeight = \"\";\n this.$characterSize = size;\n this.charSizes = Object.create(null);\n this.allowBoldFonts = boldSize && boldSize.width === size.width && boldSize.height === size.height;\n this._emit(\"changeCharacterSize\", {data: size});\n }\n };\n\n this.$pollSizeChanges = function() {\n if (this.$pollSizeChangesTimer)\n return this.$pollSizeChangesTimer;\n var self = this;\n return this.$pollSizeChangesTimer = setInterval(function() {\n self.checkForSizeChanges();\n }, 500);\n };\n \n this.setPolling = function(val) {\n if (val) {\n this.$pollSizeChanges();\n } else if (this.$pollSizeChangesTimer) {\n clearInterval(this.$pollSizeChangesTimer);\n this.$pollSizeChangesTimer = 0;\n }\n };\n\n this.$measureSizes = function() {\n if (CHAR_COUNT === 50) {\n var rect = null;\n try { \n rect = this.$measureNode.getBoundingClientRect();\n } catch(e) {\n rect = {width: 0, height:0 };\n }\n var size = {\n height: rect.height,\n width: rect.width / CHAR_COUNT\n };\n } else {\n var size = {\n height: this.$measureNode.clientHeight,\n width: this.$measureNode.clientWidth / CHAR_COUNT\n };\n }\n if (size.width === 0 || size.height === 0)\n return null;\n return size;\n };\n\n this.$measureCharWidth = function(ch) {\n this.$main.innerHTML = lang.stringRepeat(ch, CHAR_COUNT);\n var rect = this.$main.getBoundingClientRect();\n return rect.width / CHAR_COUNT;\n };\n \n this.getCharacterWidth = function(ch) {\n var w = this.charSizes[ch];\n if (w === undefined) {\n w = this.charSizes[ch] = this.$measureCharWidth(ch) / this.$characterSize.width;\n }\n return w;\n };\n\n this.destroy = function() {\n clearInterval(this.$pollSizeChangesTimer);\n if (this.el && this.el.parentNode)\n this.el.parentNode.removeChild(this.el);\n };\n\n}).call(FontMetrics.prototype);\n\n});\n\nace.define(\"ace/virtual_renderer\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/dom\",\"ace/config\",\"ace/lib/useragent\",\"ace/layer/gutter\",\"ace/layer/marker\",\"ace/layer/text\",\"ace/layer/cursor\",\"ace/scrollbar\",\"ace/scrollbar\",\"ace/renderloop\",\"ace/layer/font_metrics\",\"ace/lib/event_emitter\"], function(acequire, exports, module) {\n\"use strict\";\n\nvar oop = acequire(\"./lib/oop\");\nvar dom = acequire(\"./lib/dom\");\nvar config = acequire(\"./config\");\nvar useragent = acequire(\"./lib/useragent\");\nvar GutterLayer = acequire(\"./layer/gutter\").Gutter;\nvar MarkerLayer = acequire(\"./layer/marker\").Marker;\nvar TextLayer = acequire(\"./layer/text\").Text;\nvar CursorLayer = acequire(\"./layer/cursor\").Cursor;\nvar HScrollBar = acequire(\"./scrollbar\").HScrollBar;\nvar VScrollBar = acequire(\"./scrollbar\").VScrollBar;\nvar RenderLoop = acequire(\"./renderloop\").RenderLoop;\nvar FontMetrics = acequire(\"./layer/font_metrics\").FontMetrics;\nvar EventEmitter = acequire(\"./lib/event_emitter\").EventEmitter;\nvar editorCss = \".ace_editor {\\\nposition: relative;\\\noverflow: hidden;\\\nfont: 12px/normal 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', 'source-code-pro', monospace;\\\ndirection: ltr;\\\ntext-align: left;\\\n-webkit-tap-highlight-color: rgba(0, 0, 0, 0);\\\n}\\\n.ace_scroller {\\\nposition: absolute;\\\noverflow: hidden;\\\ntop: 0;\\\nbottom: 0;\\\nbackground-color: inherit;\\\n-ms-user-select: none;\\\n-moz-user-select: none;\\\n-webkit-user-select: none;\\\nuser-select: none;\\\ncursor: text;\\\n}\\\n.ace_content {\\\nposition: absolute;\\\n-moz-box-sizing: border-box;\\\n-webkit-box-sizing: border-box;\\\nbox-sizing: border-box;\\\nmin-width: 100%;\\\n}\\\n.ace_dragging .ace_scroller:before{\\\nposition: absolute;\\\ntop: 0;\\\nleft: 0;\\\nright: 0;\\\nbottom: 0;\\\ncontent: '';\\\nbackground: rgba(250, 250, 250, 0.01);\\\nz-index: 1000;\\\n}\\\n.ace_dragging.ace_dark .ace_scroller:before{\\\nbackground: rgba(0, 0, 0, 0.01);\\\n}\\\n.ace_selecting, .ace_selecting * {\\\ncursor: text !important;\\\n}\\\n.ace_gutter {\\\nposition: absolute;\\\noverflow : hidden;\\\nwidth: auto;\\\ntop: 0;\\\nbottom: 0;\\\nleft: 0;\\\ncursor: default;\\\nz-index: 4;\\\n-ms-user-select: none;\\\n-moz-user-select: none;\\\n-webkit-user-select: none;\\\nuser-select: none;\\\n}\\\n.ace_gutter-active-line {\\\nposition: absolute;\\\nleft: 0;\\\nright: 0;\\\n}\\\n.ace_scroller.ace_scroll-left {\\\nbox-shadow: 17px 0 16px -16px rgba(0, 0, 0, 0.4) inset;\\\n}\\\n.ace_gutter-cell {\\\npadding-left: 19px;\\\npadding-right: 6px;\\\nbackground-repeat: no-repeat;\\\n}\\\n.ace_gutter-cell.ace_error {\\\nbackground-image: url(\\\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAABOFBMVEX/////////QRswFAb/Ui4wFAYwFAYwFAaWGAfDRymzOSH/PxswFAb/SiUwFAYwFAbUPRvjQiDllog5HhHdRybsTi3/Tyv9Tir+Syj/UC3////XurebMBIwFAb/RSHbPx/gUzfdwL3kzMivKBAwFAbbvbnhPx66NhowFAYwFAaZJg8wFAaxKBDZurf/RB6mMxb/SCMwFAYwFAbxQB3+RB4wFAb/Qhy4Oh+4QifbNRcwFAYwFAYwFAb/QRzdNhgwFAYwFAbav7v/Uy7oaE68MBK5LxLewr/r2NXewLswFAaxJw4wFAbkPRy2PyYwFAaxKhLm1tMwFAazPiQwFAaUGAb/QBrfOx3bvrv/VC/maE4wFAbRPBq6MRO8Qynew8Dp2tjfwb0wFAbx6eju5+by6uns4uH9/f36+vr/GkHjAAAAYnRSTlMAGt+64rnWu/bo8eAA4InH3+DwoN7j4eLi4xP99Nfg4+b+/u9B/eDs1MD1mO7+4PHg2MXa347g7vDizMLN4eG+Pv7i5evs/v79yu7S3/DV7/498Yv24eH+4ufQ3Ozu/v7+y13sRqwAAADLSURBVHjaZc/XDsFgGIBhtDrshlitmk2IrbHFqL2pvXf/+78DPokj7+Fz9qpU/9UXJIlhmPaTaQ6QPaz0mm+5gwkgovcV6GZzd5JtCQwgsxoHOvJO15kleRLAnMgHFIESUEPmawB9ngmelTtipwwfASilxOLyiV5UVUyVAfbG0cCPHig+GBkzAENHS0AstVF6bacZIOzgLmxsHbt2OecNgJC83JERmePUYq8ARGkJx6XtFsdddBQgZE2nPR6CICZhawjA4Fb/chv+399kfR+MMMDGOQAAAABJRU5ErkJggg==\\\");\\\nbackground-repeat: no-repeat;\\\nbackground-position: 2px center;\\\n}\\\n.ace_gutter-cell.ace_warning {\\\nbackground-image: url(\\\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAmVBMVEX///8AAAD///8AAAAAAABPSzb/5sAAAAB/blH/73z/ulkAAAAAAAD85pkAAAAAAAACAgP/vGz/rkDerGbGrV7/pkQICAf////e0IsAAAD/oED/qTvhrnUAAAD/yHD/njcAAADuv2r/nz//oTj/p064oGf/zHAAAAA9Nir/tFIAAAD/tlTiuWf/tkIAAACynXEAAAAAAAAtIRW7zBpBAAAAM3RSTlMAABR1m7RXO8Ln31Z36zT+neXe5OzooRDfn+TZ4p3h2hTf4t3k3ucyrN1K5+Xaks52Sfs9CXgrAAAAjklEQVR42o3PbQ+CIBQFYEwboPhSYgoYunIqqLn6/z8uYdH8Vmdnu9vz4WwXgN/xTPRD2+sgOcZjsge/whXZgUaYYvT8QnuJaUrjrHUQreGczuEafQCO/SJTufTbroWsPgsllVhq3wJEk2jUSzX3CUEDJC84707djRc5MTAQxoLgupWRwW6UB5fS++NV8AbOZgnsC7BpEAAAAABJRU5ErkJggg==\\\");\\\nbackground-position: 2px center;\\\n}\\\n.ace_gutter-cell.ace_info {\\\nbackground-image: url(\\\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAAAAAA6mKC9AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAAJ0Uk5TAAB2k804AAAAPklEQVQY02NgIB68QuO3tiLznjAwpKTgNyDbMegwisCHZUETUZV0ZqOquBpXj2rtnpSJT1AEnnRmL2OgGgAAIKkRQap2htgAAAAASUVORK5CYII=\\\");\\\nbackground-position: 2px center;\\\n}\\\n.ace_dark .ace_gutter-cell.ace_info {\\\nbackground-image: url(\\\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQBAMAAADt3eJSAAAAJFBMVEUAAAChoaGAgIAqKiq+vr6tra1ZWVmUlJSbm5s8PDxubm56enrdgzg3AAAAAXRSTlMAQObYZgAAAClJREFUeNpjYMAPdsMYHegyJZFQBlsUlMFVCWUYKkAZMxZAGdxlDMQBAG+TBP4B6RyJAAAAAElFTkSuQmCC\\\");\\\n}\\\n.ace_scrollbar {\\\nposition: absolute;\\\nright: 0;\\\nbottom: 0;\\\nz-index: 6;\\\n}\\\n.ace_scrollbar-inner {\\\nposition: absolute;\\\ncursor: text;\\\nleft: 0;\\\ntop: 0;\\\n}\\\n.ace_scrollbar-v{\\\noverflow-x: hidden;\\\noverflow-y: scroll;\\\ntop: 0;\\\n}\\\n.ace_scrollbar-h {\\\noverflow-x: scroll;\\\noverflow-y: hidden;\\\nleft: 0;\\\n}\\\n.ace_print-margin {\\\nposition: absolute;\\\nheight: 100%;\\\n}\\\n.ace_text-input {\\\nposition: absolute;\\\nz-index: 0;\\\nwidth: 0.5em;\\\nheight: 1em;\\\nopacity: 0;\\\nbackground: transparent;\\\n-moz-appearance: none;\\\nappearance: none;\\\nborder: none;\\\nresize: none;\\\noutline: none;\\\noverflow: hidden;\\\nfont: inherit;\\\npadding: 0 1px;\\\nmargin: 0 -1px;\\\ntext-indent: -1em;\\\n-ms-user-select: text;\\\n-moz-user-select: text;\\\n-webkit-user-select: text;\\\nuser-select: text;\\\nwhite-space: pre!important;\\\n}\\\n.ace_text-input.ace_composition {\\\nbackground: inherit;\\\ncolor: inherit;\\\nz-index: 1000;\\\nopacity: 1;\\\ntext-indent: 0;\\\n}\\\n.ace_layer {\\\nz-index: 1;\\\nposition: absolute;\\\noverflow: hidden;\\\nword-wrap: normal;\\\nwhite-space: pre;\\\nheight: 100%;\\\nwidth: 100%;\\\n-moz-box-sizing: border-box;\\\n-webkit-box-sizing: border-box;\\\nbox-sizing: border-box;\\\npointer-events: none;\\\n}\\\n.ace_gutter-layer {\\\nposition: relative;\\\nwidth: auto;\\\ntext-align: right;\\\npointer-events: auto;\\\n}\\\n.ace_text-layer {\\\nfont: inherit !important;\\\n}\\\n.ace_cjk {\\\ndisplay: inline-block;\\\ntext-align: center;\\\n}\\\n.ace_cursor-layer {\\\nz-index: 4;\\\n}\\\n.ace_cursor {\\\nz-index: 4;\\\nposition: absolute;\\\n-moz-box-sizing: border-box;\\\n-webkit-box-sizing: border-box;\\\nbox-sizing: border-box;\\\nborder-left: 2px solid;\\\ntransform: translatez(0);\\\n}\\\n.ace_multiselect .ace_cursor {\\\nborder-left-width: 1px;\\\n}\\\n.ace_slim-cursors .ace_cursor {\\\nborder-left-width: 1px;\\\n}\\\n.ace_overwrite-cursors .ace_cursor {\\\nborder-left-width: 0;\\\nborder-bottom: 1px solid;\\\n}\\\n.ace_hidden-cursors .ace_cursor {\\\nopacity: 0.2;\\\n}\\\n.ace_smooth-blinking .ace_cursor {\\\n-webkit-transition: opacity 0.18s;\\\ntransition: opacity 0.18s;\\\n}\\\n.ace_marker-layer .ace_step, .ace_marker-layer .ace_stack {\\\nposition: absolute;\\\nz-index: 3;\\\n}\\\n.ace_marker-layer .ace_selection {\\\nposition: absolute;\\\nz-index: 5;\\\n}\\\n.ace_marker-layer .ace_bracket {\\\nposition: absolute;\\\nz-index: 6;\\\n}\\\n.ace_marker-layer .ace_active-line {\\\nposition: absolute;\\\nz-index: 2;\\\n}\\\n.ace_marker-layer .ace_selected-word {\\\nposition: absolute;\\\nz-index: 4;\\\n-moz-box-sizing: border-box;\\\n-webkit-box-sizing: border-box;\\\nbox-sizing: border-box;\\\n}\\\n.ace_line .ace_fold {\\\n-moz-box-sizing: border-box;\\\n-webkit-box-sizing: border-box;\\\nbox-sizing: border-box;\\\ndisplay: inline-block;\\\nheight: 11px;\\\nmargin-top: -2px;\\\nvertical-align: middle;\\\nbackground-image:\\\nurl(\\\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABEAAAAJCAYAAADU6McMAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAJpJREFUeNpi/P//PwOlgAXGYGRklAVSokD8GmjwY1wasKljQpYACtpCFeADcHVQfQyMQAwzwAZI3wJKvCLkfKBaMSClBlR7BOQikCFGQEErIH0VqkabiGCAqwUadAzZJRxQr/0gwiXIal8zQQPnNVTgJ1TdawL0T5gBIP1MUJNhBv2HKoQHHjqNrA4WO4zY0glyNKLT2KIfIMAAQsdgGiXvgnYAAAAASUVORK5CYII=\\\"),\\\nurl(\\\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAA3CAYAAADNNiA5AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAACJJREFUeNpi+P//fxgTAwPDBxDxD078RSX+YeEyDFMCIMAAI3INmXiwf2YAAAAASUVORK5CYII=\\\");\\\nbackground-repeat: no-repeat, repeat-x;\\\nbackground-position: center center, top left;\\\ncolor: transparent;\\\nborder: 1px solid black;\\\nborder-radius: 2px;\\\ncursor: pointer;\\\npointer-events: auto;\\\n}\\\n.ace_dark .ace_fold {\\\n}\\\n.ace_fold:hover{\\\nbackground-image:\\\nurl(\\\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABEAAAAJCAYAAADU6McMAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAJpJREFUeNpi/P//PwOlgAXGYGRklAVSokD8GmjwY1wasKljQpYACtpCFeADcHVQfQyMQAwzwAZI3wJKvCLkfKBaMSClBlR7BOQikCFGQEErIH0VqkabiGCAqwUadAzZJRxQr/0gwiXIal8zQQPnNVTgJ1TdawL0T5gBIP1MUJNhBv2HKoQHHjqNrA4WO4zY0glyNKLT2KIfIMAAQsdgGiXvgnYAAAAASUVORK5CYII=\\\"),\\\nurl(\\\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAA3CAYAAADNNiA5AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAACBJREFUeNpi+P//fz4TAwPDZxDxD5X4i5fLMEwJgAADAEPVDbjNw87ZAAAAAElFTkSuQmCC\\\");\\\n}\\\n.ace_tooltip {\\\nbackground-color: #FFF;\\\nbackground-image: -webkit-linear-gradient(top, transparent, rgba(0, 0, 0, 0.1));\\\nbackground-image: linear-gradient(to bottom, transparent, rgba(0, 0, 0, 0.1));\\\nborder: 1px solid gray;\\\nborder-radius: 1px;\\\nbox-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);\\\ncolor: black;\\\nmax-width: 100%;\\\npadding: 3px 4px;\\\nposition: fixed;\\\nz-index: 999999;\\\n-moz-box-sizing: border-box;\\\n-webkit-box-sizing: border-box;\\\nbox-sizing: border-box;\\\ncursor: default;\\\nwhite-space: pre;\\\nword-wrap: break-word;\\\nline-height: normal;\\\nfont-style: normal;\\\nfont-weight: normal;\\\nletter-spacing: normal;\\\npointer-events: none;\\\n}\\\n.ace_folding-enabled > .ace_gutter-cell {\\\npadding-right: 13px;\\\n}\\\n.ace_fold-widget {\\\n-moz-box-sizing: border-box;\\\n-webkit-box-sizing: border-box;\\\nbox-sizing: border-box;\\\nmargin: 0 -12px 0 1px;\\\ndisplay: none;\\\nwidth: 11px;\\\nvertical-align: top;\\\nbackground-image: url(\\\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAANElEQVR42mWKsQ0AMAzC8ixLlrzQjzmBiEjp0A6WwBCSPgKAXoLkqSot7nN3yMwR7pZ32NzpKkVoDBUxKAAAAABJRU5ErkJggg==\\\");\\\nbackground-repeat: no-repeat;\\\nbackground-position: center;\\\nborder-radius: 3px;\\\nborder: 1px solid transparent;\\\ncursor: pointer;\\\n}\\\n.ace_folding-enabled .ace_fold-widget {\\\ndisplay: inline-block; \\\n}\\\n.ace_fold-widget.ace_end {\\\nbackground-image: url(\\\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAANElEQVR42m3HwQkAMAhD0YzsRchFKI7sAikeWkrxwScEB0nh5e7KTPWimZki4tYfVbX+MNl4pyZXejUO1QAAAABJRU5ErkJggg==\\\");\\\n}\\\n.ace_fold-widget.ace_closed {\\\nbackground-image: url(\\\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAMAAAAGCAYAAAAG5SQMAAAAOUlEQVR42jXKwQkAMAgDwKwqKD4EwQ26sSOkVWjgIIHAzPiCgaqiqnJHZnKICBERHN194O5b9vbLuAVRL+l0YWnZAAAAAElFTkSuQmCCXA==\\\");\\\n}\\\n.ace_fold-widget:hover {\\\nborder: 1px solid rgba(0, 0, 0, 0.3);\\\nbackground-color: rgba(255, 255, 255, 0.2);\\\nbox-shadow: 0 1px 1px rgba(255, 255, 255, 0.7);\\\n}\\\n.ace_fold-widget:active {\\\nborder: 1px solid rgba(0, 0, 0, 0.4);\\\nbackground-color: rgba(0, 0, 0, 0.05);\\\nbox-shadow: 0 1px 1px rgba(255, 255, 255, 0.8);\\\n}\\\n.ace_dark .ace_fold-widget {\\\nbackground-image: url(\\\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHklEQVQIW2P4//8/AzoGEQ7oGCaLLAhWiSwB146BAQCSTPYocqT0AAAAAElFTkSuQmCC\\\");\\\n}\\\n.ace_dark .ace_fold-widget.ace_end {\\\nbackground-image: url(\\\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAH0lEQVQIW2P4//8/AxQ7wNjIAjDMgC4AxjCVKBirIAAF0kz2rlhxpAAAAABJRU5ErkJggg==\\\");\\\n}\\\n.ace_dark .ace_fold-widget.ace_closed {\\\nbackground-image: url(\\\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAMAAAAFCAYAAACAcVaiAAAAHElEQVQIW2P4//+/AxAzgDADlOOAznHAKgPWAwARji8UIDTfQQAAAABJRU5ErkJggg==\\\");\\\n}\\\n.ace_dark .ace_fold-widget:hover {\\\nbox-shadow: 0 1px 1px rgba(255, 255, 255, 0.2);\\\nbackground-color: rgba(255, 255, 255, 0.1);\\\n}\\\n.ace_dark .ace_fold-widget:active {\\\nbox-shadow: 0 1px 1px rgba(255, 255, 255, 0.2);\\\n}\\\n.ace_fold-widget.ace_invalid {\\\nbackground-color: #FFB4B4;\\\nborder-color: #DE5555;\\\n}\\\n.ace_fade-fold-widgets .ace_fold-widget {\\\n-webkit-transition: opacity 0.4s ease 0.05s;\\\ntransition: opacity 0.4s ease 0.05s;\\\nopacity: 0;\\\n}\\\n.ace_fade-fold-widgets:hover .ace_fold-widget {\\\n-webkit-transition: opacity 0.05s ease 0.05s;\\\ntransition: opacity 0.05s ease 0.05s;\\\nopacity:1;\\\n}\\\n.ace_underline {\\\ntext-decoration: underline;\\\n}\\\n.ace_bold {\\\nfont-weight: bold;\\\n}\\\n.ace_nobold .ace_bold {\\\nfont-weight: normal;\\\n}\\\n.ace_italic {\\\nfont-style: italic;\\\n}\\\n.ace_error-marker {\\\nbackground-color: rgba(255, 0, 0,0.2);\\\nposition: absolute;\\\nz-index: 9;\\\n}\\\n.ace_highlight-marker {\\\nbackground-color: rgba(255, 255, 0,0.2);\\\nposition: absolute;\\\nz-index: 8;\\\n}\\\n.ace_br1 {border-top-left-radius : 3px;}\\\n.ace_br2 {border-top-right-radius : 3px;}\\\n.ace_br3 {border-top-left-radius : 3px; border-top-right-radius: 3px;}\\\n.ace_br4 {border-bottom-right-radius: 3px;}\\\n.ace_br5 {border-top-left-radius : 3px; border-bottom-right-radius: 3px;}\\\n.ace_br6 {border-top-right-radius : 3px; border-bottom-right-radius: 3px;}\\\n.ace_br7 {border-top-left-radius : 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px;}\\\n.ace_br8 {border-bottom-left-radius : 3px;}\\\n.ace_br9 {border-top-left-radius : 3px; border-bottom-left-radius: 3px;}\\\n.ace_br10{border-top-right-radius : 3px; border-bottom-left-radius: 3px;}\\\n.ace_br11{border-top-left-radius : 3px; border-top-right-radius: 3px; border-bottom-left-radius: 3px;}\\\n.ace_br12{border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;}\\\n.ace_br13{border-top-left-radius : 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;}\\\n.ace_br14{border-top-right-radius : 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;}\\\n.ace_br15{border-top-left-radius : 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;}\\\n.ace_text-input-ios {\\\nposition: absolute !important;\\\ntop: -100000px !important;\\\nleft: -100000px !important;\\\n}\\\n\";\n\ndom.importCssString(editorCss, \"ace_editor.css\");\n\nvar VirtualRenderer = function(container, theme) {\n var _self = this;\n\n this.container = container || dom.createElement(\"div\");\n this.$keepTextAreaAtCursor = !useragent.isOldIE;\n\n dom.addCssClass(this.container, \"ace_editor\");\n\n this.setTheme(theme);\n\n this.$gutter = dom.createElement(\"div\");\n this.$gutter.className = \"ace_gutter\";\n this.container.appendChild(this.$gutter);\n this.$gutter.setAttribute(\"aria-hidden\", true);\n\n this.scroller = dom.createElement(\"div\");\n this.scroller.className = \"ace_scroller\";\n this.container.appendChild(this.scroller);\n\n this.content = dom.createElement(\"div\");\n this.content.className = \"ace_content\";\n this.scroller.appendChild(this.content);\n\n this.$gutterLayer = new GutterLayer(this.$gutter);\n this.$gutterLayer.on(\"changeGutterWidth\", this.onGutterResize.bind(this));\n\n this.$markerBack = new MarkerLayer(this.content);\n\n var textLayer = this.$textLayer = new TextLayer(this.content);\n this.canvas = textLayer.element;\n\n this.$markerFront = new MarkerLayer(this.content);\n\n this.$cursorLayer = new CursorLayer(this.content);\n this.$horizScroll = false;\n this.$vScroll = false;\n\n this.scrollBar = \n this.scrollBarV = new VScrollBar(this.container, this);\n this.scrollBarH = new HScrollBar(this.container, this);\n this.scrollBarV.addEventListener(\"scroll\", function(e) {\n if (!_self.$scrollAnimation)\n _self.session.setScrollTop(e.data - _self.scrollMargin.top);\n });\n this.scrollBarH.addEventListener(\"scroll\", function(e) {\n if (!_self.$scrollAnimation)\n _self.session.setScrollLeft(e.data - _self.scrollMargin.left);\n });\n\n this.scrollTop = 0;\n this.scrollLeft = 0;\n\n this.cursorPos = {\n row : 0,\n column : 0\n };\n\n this.$fontMetrics = new FontMetrics(this.container);\n this.$textLayer.$setFontMetrics(this.$fontMetrics);\n this.$textLayer.addEventListener(\"changeCharacterSize\", function(e) {\n _self.updateCharacterSize();\n _self.onResize(true, _self.gutterWidth, _self.$size.width, _self.$size.height);\n _self._signal(\"changeCharacterSize\", e);\n });\n\n this.$size = {\n width: 0,\n height: 0,\n scrollerHeight: 0,\n scrollerWidth: 0,\n $dirty: true\n };\n\n this.layerConfig = {\n width : 1,\n padding : 0,\n firstRow : 0,\n firstRowScreen: 0,\n lastRow : 0,\n lineHeight : 0,\n characterWidth : 0,\n minHeight : 1,\n maxHeight : 1,\n offset : 0,\n height : 1,\n gutterOffset: 1\n };\n \n this.scrollMargin = {\n left: 0,\n right: 0,\n top: 0,\n bottom: 0,\n v: 0,\n h: 0\n };\n\n this.$loop = new RenderLoop(\n this.$renderChanges.bind(this),\n this.container.ownerDocument.defaultView\n );\n this.$loop.schedule(this.CHANGE_FULL);\n\n this.updateCharacterSize();\n this.setPadding(4);\n config.resetOptions(this);\n config._emit(\"renderer\", this);\n};\n\n(function() {\n\n this.CHANGE_CURSOR = 1;\n this.CHANGE_MARKER = 2;\n this.CHANGE_GUTTER = 4;\n this.CHANGE_SCROLL = 8;\n this.CHANGE_LINES = 16;\n this.CHANGE_TEXT = 32;\n this.CHANGE_SIZE = 64;\n this.CHANGE_MARKER_BACK = 128;\n this.CHANGE_MARKER_FRONT = 256;\n this.CHANGE_FULL = 512;\n this.CHANGE_H_SCROLL = 1024;\n\n oop.implement(this, EventEmitter);\n\n this.updateCharacterSize = function() {\n if (this.$textLayer.allowBoldFonts != this.$allowBoldFonts) {\n this.$allowBoldFonts = this.$textLayer.allowBoldFonts;\n this.setStyle(\"ace_nobold\", !this.$allowBoldFonts);\n }\n\n this.layerConfig.characterWidth =\n this.characterWidth = this.$textLayer.getCharacterWidth();\n this.layerConfig.lineHeight =\n this.lineHeight = this.$textLayer.getLineHeight();\n this.$updatePrintMargin();\n };\n this.setSession = function(session) {\n if (this.session)\n this.session.doc.off(\"changeNewLineMode\", this.onChangeNewLineMode);\n \n this.session = session;\n if (session && this.scrollMargin.top && session.getScrollTop() <= 0)\n session.setScrollTop(-this.scrollMargin.top);\n\n this.$cursorLayer.setSession(session);\n this.$markerBack.setSession(session);\n this.$markerFront.setSession(session);\n this.$gutterLayer.setSession(session);\n this.$textLayer.setSession(session);\n if (!session)\n return;\n \n this.$loop.schedule(this.CHANGE_FULL);\n this.session.$setFontMetrics(this.$fontMetrics);\n this.scrollBarH.scrollLeft = this.scrollBarV.scrollTop = null;\n \n this.onChangeNewLineMode = this.onChangeNewLineMode.bind(this);\n this.onChangeNewLineMode();\n this.session.doc.on(\"changeNewLineMode\", this.onChangeNewLineMode);\n };\n this.updateLines = function(firstRow, lastRow, force) {\n if (lastRow === undefined)\n lastRow = Infinity;\n\n if (!this.$changedLines) {\n this.$changedLines = {\n firstRow: firstRow,\n lastRow: lastRow\n };\n }\n else {\n if (this.$changedLines.firstRow > firstRow)\n this.$changedLines.firstRow = firstRow;\n\n if (this.$changedLines.lastRow < lastRow)\n this.$changedLines.lastRow = lastRow;\n }\n if (this.$changedLines.lastRow < this.layerConfig.firstRow) {\n if (force)\n this.$changedLines.lastRow = this.layerConfig.lastRow;\n else\n return;\n }\n if (this.$changedLines.firstRow > this.layerConfig.lastRow)\n return;\n this.$loop.schedule(this.CHANGE_LINES);\n };\n\n this.onChangeNewLineMode = function() {\n this.$loop.schedule(this.CHANGE_TEXT);\n this.$textLayer.$updateEolChar();\n this.session.$bidiHandler.setEolChar(this.$textLayer.EOL_CHAR);\n };\n \n this.onChangeTabSize = function() {\n this.$loop.schedule(this.CHANGE_TEXT | this.CHANGE_MARKER);\n this.$textLayer.onChangeTabSize();\n };\n this.updateText = function() {\n this.$loop.schedule(this.CHANGE_TEXT);\n };\n this.updateFull = function(force) {\n if (force)\n this.$renderChanges(this.CHANGE_FULL, true);\n else\n this.$loop.schedule(this.CHANGE_FULL);\n };\n this.updateFontSize = function() {\n this.$textLayer.checkForSizeChanges();\n };\n\n this.$changes = 0;\n this.$updateSizeAsync = function() {\n if (this.$loop.pending)\n this.$size.$dirty = true;\n else\n this.onResize();\n };\n this.onResize = function(force, gutterWidth, width, height) {\n if (this.resizing > 2)\n return;\n else if (this.resizing > 0)\n this.resizing++;\n else\n this.resizing = force ? 1 : 0;\n var el = this.container;\n if (!height)\n height = el.clientHeight || el.scrollHeight;\n if (!width)\n width = el.clientWidth || el.scrollWidth;\n var changes = this.$updateCachedSize(force, gutterWidth, width, height);\n\n \n if (!this.$size.scrollerHeight || (!width && !height))\n return this.resizing = 0;\n\n if (force)\n this.$gutterLayer.$padding = null;\n\n if (force)\n this.$renderChanges(changes | this.$changes, true);\n else\n this.$loop.schedule(changes | this.$changes);\n\n if (this.resizing)\n this.resizing = 0;\n this.scrollBarV.scrollLeft = this.scrollBarV.scrollTop = null;\n };\n \n this.$updateCachedSize = function(force, gutterWidth, width, height) {\n height -= (this.$extraHeight || 0);\n var changes = 0;\n var size = this.$size;\n var oldSize = {\n width: size.width,\n height: size.height,\n scrollerHeight: size.scrollerHeight,\n scrollerWidth: size.scrollerWidth\n };\n if (height && (force || size.height != height)) {\n size.height = height;\n changes |= this.CHANGE_SIZE;\n\n size.scrollerHeight = size.height;\n if (this.$horizScroll)\n size.scrollerHeight -= this.scrollBarH.getHeight();\n this.scrollBarV.element.style.bottom = this.scrollBarH.getHeight() + \"px\";\n\n changes = changes | this.CHANGE_SCROLL;\n }\n\n if (width && (force || size.width != width)) {\n changes |= this.CHANGE_SIZE;\n size.width = width;\n \n if (gutterWidth == null)\n gutterWidth = this.$showGutter ? this.$gutter.offsetWidth : 0;\n \n this.gutterWidth = gutterWidth;\n \n this.scrollBarH.element.style.left = \n this.scroller.style.left = gutterWidth + \"px\";\n size.scrollerWidth = Math.max(0, width - gutterWidth - this.scrollBarV.getWidth()); \n \n this.scrollBarH.element.style.right = \n this.scroller.style.right = this.scrollBarV.getWidth() + \"px\";\n this.scroller.style.bottom = this.scrollBarH.getHeight() + \"px\";\n\n if (this.session && this.session.getUseWrapMode() && this.adjustWrapLimit() || force)\n changes |= this.CHANGE_FULL;\n }\n \n size.$dirty = !width || !height;\n\n if (changes)\n this._signal(\"resize\", oldSize);\n\n return changes;\n };\n\n this.onGutterResize = function() {\n var gutterWidth = this.$showGutter ? this.$gutter.offsetWidth : 0;\n if (gutterWidth != this.gutterWidth)\n this.$changes |= this.$updateCachedSize(true, gutterWidth, this.$size.width, this.$size.height);\n\n if (this.session.getUseWrapMode() && this.adjustWrapLimit()) {\n this.$loop.schedule(this.CHANGE_FULL);\n } else if (this.$size.$dirty) {\n this.$loop.schedule(this.CHANGE_FULL);\n } else {\n this.$computeLayerConfig();\n this.$loop.schedule(this.CHANGE_MARKER);\n }\n };\n this.adjustWrapLimit = function() {\n var availableWidth = this.$size.scrollerWidth - this.$padding * 2;\n var limit = Math.floor(availableWidth / this.characterWidth);\n return this.session.adjustWrapLimit(limit, this.$showPrintMargin && this.$printMarginColumn);\n };\n this.setAnimatedScroll = function(shouldAnimate){\n this.setOption(\"animatedScroll\", shouldAnimate);\n };\n this.getAnimatedScroll = function() {\n return this.$animatedScroll;\n };\n this.setShowInvisibles = function(showInvisibles) {\n this.setOption(\"showInvisibles\", showInvisibles);\n this.session.$bidiHandler.setShowInvisibles(showInvisibles);\n };\n this.getShowInvisibles = function() {\n return this.getOption(\"showInvisibles\");\n };\n this.getDisplayIndentGuides = function() {\n return this.getOption(\"displayIndentGuides\");\n };\n\n this.setDisplayIndentGuides = function(display) {\n this.setOption(\"displayIndentGuides\", display);\n };\n this.setShowPrintMargin = function(showPrintMargin) {\n this.setOption(\"showPrintMargin\", showPrintMargin);\n };\n this.getShowPrintMargin = function() {\n return this.getOption(\"showPrintMargin\");\n };\n this.setPrintMarginColumn = function(showPrintMargin) {\n this.setOption(\"printMarginColumn\", showPrintMargin);\n };\n this.getPrintMarginColumn = function() {\n return this.getOption(\"printMarginColumn\");\n };\n this.getShowGutter = function(){\n return this.getOption(\"showGutter\");\n };\n this.setShowGutter = function(show){\n return this.setOption(\"showGutter\", show);\n };\n\n this.getFadeFoldWidgets = function(){\n return this.getOption(\"fadeFoldWidgets\");\n };\n\n this.setFadeFoldWidgets = function(show) {\n this.setOption(\"fadeFoldWidgets\", show);\n };\n\n this.setHighlightGutterLine = function(shouldHighlight) {\n this.setOption(\"highlightGutterLine\", shouldHighlight);\n };\n\n this.getHighlightGutterLine = function() {\n return this.getOption(\"highlightGutterLine\");\n };\n\n this.$updateGutterLineHighlight = function() {\n var pos = this.$cursorLayer.$pixelPos;\n var height = this.layerConfig.lineHeight;\n if (this.session.getUseWrapMode()) {\n var cursor = this.session.selection.getCursor();\n cursor.column = 0;\n pos = this.$cursorLayer.getPixelPosition(cursor, true);\n height *= this.session.getRowLength(cursor.row);\n }\n this.$gutterLineHighlight.style.top = pos.top - this.layerConfig.offset + \"px\";\n this.$gutterLineHighlight.style.height = height + \"px\";\n };\n\n this.$updatePrintMargin = function() {\n if (!this.$showPrintMargin && !this.$printMarginEl)\n return;\n\n if (!this.$printMarginEl) {\n var containerEl = dom.createElement(\"div\");\n containerEl.className = \"ace_layer ace_print-margin-layer\";\n this.$printMarginEl = dom.createElement(\"div\");\n this.$printMarginEl.className = \"ace_print-margin\";\n containerEl.appendChild(this.$printMarginEl);\n this.content.insertBefore(containerEl, this.content.firstChild);\n }\n\n var style = this.$printMarginEl.style;\n style.left = ((this.characterWidth * this.$printMarginColumn) + this.$padding) + \"px\";\n style.visibility = this.$showPrintMargin ? \"visible\" : \"hidden\";\n \n if (this.session && this.session.$wrap == -1)\n this.adjustWrapLimit();\n };\n this.getContainerElement = function() {\n return this.container;\n };\n this.getMouseEventTarget = function() {\n return this.scroller;\n };\n this.getTextAreaContainer = function() {\n return this.container;\n };\n this.$moveTextAreaToCursor = function() {\n if (!this.$keepTextAreaAtCursor)\n return;\n var config = this.layerConfig;\n var posTop = this.$cursorLayer.$pixelPos.top;\n var posLeft = this.$cursorLayer.$pixelPos.left;\n posTop -= config.offset;\n\n var style = this.textarea.style;\n var h = this.lineHeight;\n if (posTop < 0 || posTop > config.height - h) {\n style.top = style.left = \"0\";\n return;\n }\n\n var w = this.characterWidth;\n if (this.$composition) {\n var val = this.textarea.value.replace(/^\\x01+/, \"\");\n w *= (this.session.$getStringScreenWidth(val)[0]+2);\n h += 2;\n }\n posLeft -= this.scrollLeft;\n if (posLeft > this.$size.scrollerWidth - w)\n posLeft = this.$size.scrollerWidth - w;\n\n posLeft += this.gutterWidth;\n style.height = h + \"px\";\n style.width = w + \"px\";\n style.left = Math.min(posLeft, this.$size.scrollerWidth - w) + \"px\";\n style.top = Math.min(posTop, this.$size.height - h) + \"px\";\n };\n this.getFirstVisibleRow = function() {\n return this.layerConfig.firstRow;\n };\n this.getFirstFullyVisibleRow = function() {\n return this.layerConfig.firstRow + (this.layerConfig.offset === 0 ? 0 : 1);\n };\n this.getLastFullyVisibleRow = function() {\n var config = this.layerConfig;\n var lastRow = config.lastRow;\n var top = this.session.documentToScreenRow(lastRow, 0) * config.lineHeight;\n if (top - this.session.getScrollTop() > config.height - config.lineHeight)\n return lastRow - 1;\n return lastRow;\n };\n this.getLastVisibleRow = function() {\n return this.layerConfig.lastRow;\n };\n\n this.$padding = null;\n this.setPadding = function(padding) {\n this.$padding = padding;\n this.$textLayer.setPadding(padding);\n this.$cursorLayer.setPadding(padding);\n this.$markerFront.setPadding(padding);\n this.$markerBack.setPadding(padding);\n this.$loop.schedule(this.CHANGE_FULL);\n this.$updatePrintMargin();\n };\n \n this.setScrollMargin = function(top, bottom, left, right) {\n var sm = this.scrollMargin;\n sm.top = top|0;\n sm.bottom = bottom|0;\n sm.right = right|0;\n sm.left = left|0;\n sm.v = sm.top + sm.bottom;\n sm.h = sm.left + sm.right;\n if (sm.top && this.scrollTop <= 0 && this.session)\n this.session.setScrollTop(-sm.top);\n this.updateFull();\n };\n this.getHScrollBarAlwaysVisible = function() {\n return this.$hScrollBarAlwaysVisible;\n };\n this.setHScrollBarAlwaysVisible = function(alwaysVisible) {\n this.setOption(\"hScrollBarAlwaysVisible\", alwaysVisible);\n };\n this.getVScrollBarAlwaysVisible = function() {\n return this.$vScrollBarAlwaysVisible;\n };\n this.setVScrollBarAlwaysVisible = function(alwaysVisible) {\n this.setOption(\"vScrollBarAlwaysVisible\", alwaysVisible);\n };\n\n this.$updateScrollBarV = function() {\n var scrollHeight = this.layerConfig.maxHeight;\n var scrollerHeight = this.$size.scrollerHeight;\n if (!this.$maxLines && this.$scrollPastEnd) {\n scrollHeight -= (scrollerHeight - this.lineHeight) * this.$scrollPastEnd;\n if (this.scrollTop > scrollHeight - scrollerHeight) {\n scrollHeight = this.scrollTop + scrollerHeight;\n this.scrollBarV.scrollTop = null;\n }\n }\n this.scrollBarV.setScrollHeight(scrollHeight + this.scrollMargin.v);\n this.scrollBarV.setScrollTop(this.scrollTop + this.scrollMargin.top);\n };\n this.$updateScrollBarH = function() {\n this.scrollBarH.setScrollWidth(this.layerConfig.width + 2 * this.$padding + this.scrollMargin.h);\n this.scrollBarH.setScrollLeft(this.scrollLeft + this.scrollMargin.left);\n };\n \n this.$frozen = false;\n this.freeze = function() {\n this.$frozen = true;\n };\n \n this.unfreeze = function() {\n this.$frozen = false;\n };\n\n this.$renderChanges = function(changes, force) {\n if (this.$changes) {\n changes |= this.$changes;\n this.$changes = 0;\n }\n if ((!this.session || !this.container.offsetWidth || this.$frozen) || (!changes && !force)) {\n this.$changes |= changes;\n return; \n } \n if (this.$size.$dirty) {\n this.$changes |= changes;\n return this.onResize(true);\n }\n if (!this.lineHeight) {\n this.$textLayer.checkForSizeChanges();\n }\n \n this._signal(\"beforeRender\");\n\n if (this.session && this.session.$bidiHandler)\n this.session.$bidiHandler.updateCharacterWidths(this.$fontMetrics);\n\n var config = this.layerConfig;\n if (changes & this.CHANGE_FULL ||\n changes & this.CHANGE_SIZE ||\n changes & this.CHANGE_TEXT ||\n changes & this.CHANGE_LINES ||\n changes & this.CHANGE_SCROLL ||\n changes & this.CHANGE_H_SCROLL\n ) {\n changes |= this.$computeLayerConfig();\n if (config.firstRow != this.layerConfig.firstRow && config.firstRowScreen == this.layerConfig.firstRowScreen) {\n var st = this.scrollTop + (config.firstRow - this.layerConfig.firstRow) * this.lineHeight;\n if (st > 0) {\n this.scrollTop = st;\n changes = changes | this.CHANGE_SCROLL;\n changes |= this.$computeLayerConfig();\n }\n }\n config = this.layerConfig;\n this.$updateScrollBarV();\n if (changes & this.CHANGE_H_SCROLL)\n this.$updateScrollBarH();\n this.$gutterLayer.element.style.marginTop = (-config.offset) + \"px\";\n this.content.style.marginTop = (-config.offset) + \"px\";\n this.content.style.width = config.width + 2 * this.$padding + \"px\";\n this.content.style.height = config.minHeight + \"px\";\n }\n if (changes & this.CHANGE_H_SCROLL) {\n this.content.style.marginLeft = -this.scrollLeft + \"px\";\n this.scroller.className = this.scrollLeft <= 0 ? \"ace_scroller\" : \"ace_scroller ace_scroll-left\";\n }\n if (changes & this.CHANGE_FULL) {\n this.$textLayer.update(config);\n if (this.$showGutter)\n this.$gutterLayer.update(config);\n this.$markerBack.update(config);\n this.$markerFront.update(config);\n this.$cursorLayer.update(config);\n this.$moveTextAreaToCursor();\n this.$highlightGutterLine && this.$updateGutterLineHighlight();\n this._signal(\"afterRender\");\n return;\n }\n if (changes & this.CHANGE_SCROLL) {\n if (changes & this.CHANGE_TEXT || changes & this.CHANGE_LINES)\n this.$textLayer.update(config);\n else\n this.$textLayer.scrollLines(config);\n\n if (this.$showGutter)\n this.$gutterLayer.update(config);\n this.$markerBack.update(config);\n this.$markerFront.update(config);\n this.$cursorLayer.update(config);\n this.$highlightGutterLine && this.$updateGutterLineHighlight();\n this.$moveTextAreaToCursor();\n this._signal(\"afterRender\");\n return;\n }\n\n if (changes & this.CHANGE_TEXT) {\n this.$textLayer.update(config);\n if (this.$showGutter)\n this.$gutterLayer.update(config);\n }\n else if (changes & this.CHANGE_LINES) {\n if (this.$updateLines() || (changes & this.CHANGE_GUTTER) && this.$showGutter)\n this.$gutterLayer.update(config);\n }\n else if (changes & this.CHANGE_TEXT || changes & this.CHANGE_GUTTER) {\n if (this.$showGutter)\n this.$gutterLayer.update(config);\n }\n\n if (changes & this.CHANGE_CURSOR) {\n this.$cursorLayer.update(config);\n this.$moveTextAreaToCursor();\n this.$highlightGutterLine && this.$updateGutterLineHighlight();\n }\n\n if (changes & (this.CHANGE_MARKER | this.CHANGE_MARKER_FRONT)) {\n this.$markerFront.update(config);\n }\n\n if (changes & (this.CHANGE_MARKER | this.CHANGE_MARKER_BACK)) {\n this.$markerBack.update(config);\n }\n\n this._signal(\"afterRender\");\n };\n\n \n this.$autosize = function() {\n var height = this.session.getScreenLength() * this.lineHeight;\n var maxHeight = this.$maxLines * this.lineHeight;\n var desiredHeight = Math.min(maxHeight,\n Math.max((this.$minLines || 1) * this.lineHeight, height)\n ) + this.scrollMargin.v + (this.$extraHeight || 0);\n if (this.$horizScroll)\n desiredHeight += this.scrollBarH.getHeight();\n if (this.$maxPixelHeight && desiredHeight > this.$maxPixelHeight)\n desiredHeight = this.$maxPixelHeight;\n var vScroll = height > maxHeight;\n \n if (desiredHeight != this.desiredHeight ||\n this.$size.height != this.desiredHeight || vScroll != this.$vScroll) {\n if (vScroll != this.$vScroll) {\n this.$vScroll = vScroll;\n this.scrollBarV.setVisible(vScroll);\n }\n \n var w = this.container.clientWidth;\n this.container.style.height = desiredHeight + \"px\";\n this.$updateCachedSize(true, this.$gutterWidth, w, desiredHeight);\n this.desiredHeight = desiredHeight;\n \n this._signal(\"autosize\");\n }\n };\n \n this.$computeLayerConfig = function() {\n var session = this.session;\n var size = this.$size;\n \n var hideScrollbars = size.height <= 2 * this.lineHeight;\n var screenLines = this.session.getScreenLength();\n var maxHeight = screenLines * this.lineHeight;\n\n var longestLine = this.$getLongestLine();\n \n var horizScroll = !hideScrollbars && (this.$hScrollBarAlwaysVisible ||\n size.scrollerWidth - longestLine - 2 * this.$padding < 0);\n\n var hScrollChanged = this.$horizScroll !== horizScroll;\n if (hScrollChanged) {\n this.$horizScroll = horizScroll;\n this.scrollBarH.setVisible(horizScroll);\n }\n var vScrollBefore = this.$vScroll; // autosize can change vscroll value in which case we need to update longestLine\n if (this.$maxLines && this.lineHeight > 1)\n this.$autosize();\n\n var offset = this.scrollTop % this.lineHeight;\n var minHeight = size.scrollerHeight + this.lineHeight;\n \n var scrollPastEnd = !this.$maxLines && this.$scrollPastEnd\n ? (size.scrollerHeight - this.lineHeight) * this.$scrollPastEnd\n : 0;\n maxHeight += scrollPastEnd;\n \n var sm = this.scrollMargin;\n this.session.setScrollTop(Math.max(-sm.top,\n Math.min(this.scrollTop, maxHeight - size.scrollerHeight + sm.bottom)));\n\n this.session.setScrollLeft(Math.max(-sm.left, Math.min(this.scrollLeft, \n longestLine + 2 * this.$padding - size.scrollerWidth + sm.right)));\n \n var vScroll = !hideScrollbars && (this.$vScrollBarAlwaysVisible ||\n size.scrollerHeight - maxHeight + scrollPastEnd < 0 || this.scrollTop > sm.top);\n var vScrollChanged = vScrollBefore !== vScroll;\n if (vScrollChanged) {\n this.$vScroll = vScroll;\n this.scrollBarV.setVisible(vScroll);\n }\n\n var lineCount = Math.ceil(minHeight / this.lineHeight) - 1;\n var firstRow = Math.max(0, Math.round((this.scrollTop - offset) / this.lineHeight));\n var lastRow = firstRow + lineCount;\n var firstRowScreen, firstRowHeight;\n var lineHeight = this.lineHeight;\n firstRow = session.screenToDocumentRow(firstRow, 0);\n var foldLine = session.getFoldLine(firstRow);\n if (foldLine) {\n firstRow = foldLine.start.row;\n }\n\n firstRowScreen = session.documentToScreenRow(firstRow, 0);\n firstRowHeight = session.getRowLength(firstRow) * lineHeight;\n\n lastRow = Math.min(session.screenToDocumentRow(lastRow, 0), session.getLength() - 1);\n minHeight = size.scrollerHeight + session.getRowLength(lastRow) * lineHeight +\n firstRowHeight;\n\n offset = this.scrollTop - firstRowScreen * lineHeight;\n\n var changes = 0;\n if (this.layerConfig.width != longestLine) \n changes = this.CHANGE_H_SCROLL;\n if (hScrollChanged || vScrollChanged) {\n changes = this.$updateCachedSize(true, this.gutterWidth, size.width, size.height);\n this._signal(\"scrollbarVisibilityChanged\");\n if (vScrollChanged)\n longestLine = this.$getLongestLine();\n }\n \n this.layerConfig = {\n width : longestLine,\n padding : this.$padding,\n firstRow : firstRow,\n firstRowScreen: firstRowScreen,\n lastRow : lastRow,\n lineHeight : lineHeight,\n characterWidth : this.characterWidth,\n minHeight : minHeight,\n maxHeight : maxHeight,\n offset : offset,\n gutterOffset : lineHeight ? Math.max(0, Math.ceil((offset + size.height - size.scrollerHeight) / lineHeight)) : 0,\n height : this.$size.scrollerHeight\n };\n\n return changes;\n };\n\n this.$updateLines = function() {\n if (!this.$changedLines) return;\n var firstRow = this.$changedLines.firstRow;\n var lastRow = this.$changedLines.lastRow;\n this.$changedLines = null;\n\n var layerConfig = this.layerConfig;\n\n if (firstRow > layerConfig.lastRow + 1) { return; }\n if (lastRow < layerConfig.firstRow) { return; }\n if (lastRow === Infinity) {\n if (this.$showGutter)\n this.$gutterLayer.update(layerConfig);\n this.$textLayer.update(layerConfig);\n return;\n }\n this.$textLayer.updateLines(layerConfig, firstRow, lastRow);\n return true;\n };\n\n this.$getLongestLine = function() {\n var charCount = this.session.getScreenWidth();\n if (this.showInvisibles && !this.session.$useWrapMode)\n charCount += 1;\n\n return Math.max(this.$size.scrollerWidth - 2 * this.$padding, Math.round(charCount * this.characterWidth));\n };\n this.updateFrontMarkers = function() {\n this.$markerFront.setMarkers(this.session.getMarkers(true));\n this.$loop.schedule(this.CHANGE_MARKER_FRONT);\n };\n this.updateBackMarkers = function() {\n this.$markerBack.setMarkers(this.session.getMarkers());\n this.$loop.schedule(this.CHANGE_MARKER_BACK);\n };\n this.addGutterDecoration = function(row, className){\n this.$gutterLayer.addGutterDecoration(row, className);\n };\n this.removeGutterDecoration = function(row, className){\n this.$gutterLayer.removeGutterDecoration(row, className);\n };\n this.updateBreakpoints = function(rows) {\n this.$loop.schedule(this.CHANGE_GUTTER);\n };\n this.setAnnotations = function(annotations) {\n this.$gutterLayer.setAnnotations(annotations);\n this.$loop.schedule(this.CHANGE_GUTTER);\n };\n this.updateCursor = function() {\n this.$loop.schedule(this.CHANGE_CURSOR);\n };\n this.hideCursor = function() {\n this.$cursorLayer.hideCursor();\n };\n this.showCursor = function() {\n this.$cursorLayer.showCursor();\n };\n\n this.scrollSelectionIntoView = function(anchor, lead, offset) {\n this.scrollCursorIntoView(anchor, offset);\n this.scrollCursorIntoView(lead, offset);\n };\n this.scrollCursorIntoView = function(cursor, offset, $viewMargin) {\n if (this.$size.scrollerHeight === 0)\n return;\n\n var pos = this.$cursorLayer.getPixelPosition(cursor);\n\n var left = pos.left;\n var top = pos.top;\n \n var topMargin = $viewMargin && $viewMargin.top || 0;\n var bottomMargin = $viewMargin && $viewMargin.bottom || 0;\n \n var scrollTop = this.$scrollAnimation ? this.session.getScrollTop() : this.scrollTop;\n \n if (scrollTop + topMargin > top) {\n if (offset && scrollTop + topMargin > top + this.lineHeight)\n top -= offset * this.$size.scrollerHeight;\n if (top === 0)\n top = -this.scrollMargin.top;\n this.session.setScrollTop(top);\n } else if (scrollTop + this.$size.scrollerHeight - bottomMargin < top + this.lineHeight) {\n if (offset && scrollTop + this.$size.scrollerHeight - bottomMargin < top - this.lineHeight)\n top += offset * this.$size.scrollerHeight;\n this.session.setScrollTop(top + this.lineHeight - this.$size.scrollerHeight);\n }\n\n var scrollLeft = this.scrollLeft;\n\n if (scrollLeft > left) {\n if (left < this.$padding + 2 * this.layerConfig.characterWidth)\n left = -this.scrollMargin.left;\n this.session.setScrollLeft(left);\n } else if (scrollLeft + this.$size.scrollerWidth < left + this.characterWidth) {\n this.session.setScrollLeft(Math.round(left + this.characterWidth - this.$size.scrollerWidth));\n } else if (scrollLeft <= this.$padding && left - scrollLeft < this.characterWidth) {\n this.session.setScrollLeft(0);\n }\n };\n this.getScrollTop = function() {\n return this.session.getScrollTop();\n };\n this.getScrollLeft = function() {\n return this.session.getScrollLeft();\n };\n this.getScrollTopRow = function() {\n return this.scrollTop / this.lineHeight;\n };\n this.getScrollBottomRow = function() {\n return Math.max(0, Math.floor((this.scrollTop + this.$size.scrollerHeight) / this.lineHeight) - 1);\n };\n this.scrollToRow = function(row) {\n this.session.setScrollTop(row * this.lineHeight);\n };\n\n this.alignCursor = function(cursor, alignment) {\n if (typeof cursor == \"number\")\n cursor = {row: cursor, column: 0};\n\n var pos = this.$cursorLayer.getPixelPosition(cursor);\n var h = this.$size.scrollerHeight - this.lineHeight;\n var offset = pos.top - h * (alignment || 0);\n\n this.session.setScrollTop(offset);\n return offset;\n };\n\n this.STEPS = 8;\n this.$calcSteps = function(fromValue, toValue){\n var i = 0;\n var l = this.STEPS;\n var steps = [];\n\n var func = function(t, x_min, dx) {\n return dx * (Math.pow(t - 1, 3) + 1) + x_min;\n };\n\n for (i = 0; i < l; ++i)\n steps.push(func(i / this.STEPS, fromValue, toValue - fromValue));\n\n return steps;\n };\n this.scrollToLine = function(line, center, animate, callback) {\n var pos = this.$cursorLayer.getPixelPosition({row: line, column: 0});\n var offset = pos.top;\n if (center)\n offset -= this.$size.scrollerHeight / 2;\n\n var initialScroll = this.scrollTop;\n this.session.setScrollTop(offset);\n if (animate !== false)\n this.animateScrolling(initialScroll, callback);\n };\n\n this.animateScrolling = function(fromValue, callback) {\n var toValue = this.scrollTop;\n if (!this.$animatedScroll)\n return;\n var _self = this;\n \n if (fromValue == toValue)\n return;\n \n if (this.$scrollAnimation) {\n var oldSteps = this.$scrollAnimation.steps;\n if (oldSteps.length) {\n fromValue = oldSteps[0];\n if (fromValue == toValue)\n return;\n }\n }\n \n var steps = _self.$calcSteps(fromValue, toValue);\n this.$scrollAnimation = {from: fromValue, to: toValue, steps: steps};\n\n clearInterval(this.$timer);\n\n _self.session.setScrollTop(steps.shift());\n _self.session.$scrollTop = toValue;\n this.$timer = setInterval(function() {\n if (steps.length) {\n _self.session.setScrollTop(steps.shift());\n _self.session.$scrollTop = toValue;\n } else if (toValue != null) {\n _self.session.$scrollTop = -1;\n _self.session.setScrollTop(toValue);\n toValue = null;\n } else {\n _self.$timer = clearInterval(_self.$timer);\n _self.$scrollAnimation = null;\n callback && callback();\n }\n }, 10);\n };\n this.scrollToY = function(scrollTop) {\n if (this.scrollTop !== scrollTop) {\n this.$loop.schedule(this.CHANGE_SCROLL);\n this.scrollTop = scrollTop;\n }\n };\n this.scrollToX = function(scrollLeft) {\n if (this.scrollLeft !== scrollLeft)\n this.scrollLeft = scrollLeft;\n this.$loop.schedule(this.CHANGE_H_SCROLL);\n };\n this.scrollTo = function(x, y) {\n this.session.setScrollTop(y);\n this.session.setScrollLeft(y);\n };\n this.scrollBy = function(deltaX, deltaY) {\n deltaY && this.session.setScrollTop(this.session.getScrollTop() + deltaY);\n deltaX && this.session.setScrollLeft(this.session.getScrollLeft() + deltaX);\n };\n this.isScrollableBy = function(deltaX, deltaY) {\n if (deltaY < 0 && this.session.getScrollTop() >= 1 - this.scrollMargin.top)\n return true;\n if (deltaY > 0 && this.session.getScrollTop() + this.$size.scrollerHeight\n - this.layerConfig.maxHeight < -1 + this.scrollMargin.bottom)\n return true;\n if (deltaX < 0 && this.session.getScrollLeft() >= 1 - this.scrollMargin.left)\n return true;\n if (deltaX > 0 && this.session.getScrollLeft() + this.$size.scrollerWidth\n - this.layerConfig.width < -1 + this.scrollMargin.right)\n return true;\n };\n\n this.pixelToScreenCoordinates = function(x, y) {\n var canvasPos = this.scroller.getBoundingClientRect();\n\n var offsetX = x + this.scrollLeft - canvasPos.left - this.$padding;\n var offset = offsetX / this.characterWidth;\n var row = Math.floor((y + this.scrollTop - canvasPos.top) / this.lineHeight);\n var col = Math.round(offset);\n\n return {row: row, column: col, side: offset - col > 0 ? 1 : -1, offsetX: offsetX};\n };\n\n this.screenToTextCoordinates = function(x, y) {\n var canvasPos = this.scroller.getBoundingClientRect();\n var offsetX = x + this.scrollLeft - canvasPos.left - this.$padding;\n\n var col = Math.round(offsetX / this.characterWidth);\n\n var row = (y + this.scrollTop - canvasPos.top) / this.lineHeight;\n\n return this.session.screenToDocumentPosition(row, Math.max(col, 0), offsetX);\n };\n this.textToScreenCoordinates = function(row, column) {\n var canvasPos = this.scroller.getBoundingClientRect();\n var pos = this.session.documentToScreenPosition(row, column);\n\n var x = this.$padding + (this.session.$bidiHandler.isBidiRow(pos.row, row)\n ? this.session.$bidiHandler.getPosLeft(pos.column)\n : Math.round(pos.column * this.characterWidth));\n\n var y = pos.row * this.lineHeight;\n\n return {\n pageX: canvasPos.left + x - this.scrollLeft,\n pageY: canvasPos.top + y - this.scrollTop\n };\n };\n this.visualizeFocus = function() {\n dom.addCssClass(this.container, \"ace_focus\");\n };\n this.visualizeBlur = function() {\n dom.removeCssClass(this.container, \"ace_focus\");\n };\n this.showComposition = function(position) {\n if (!this.$composition)\n this.$composition = {\n keepTextAreaAtCursor: this.$keepTextAreaAtCursor,\n cssText: this.textarea.style.cssText\n };\n\n this.$keepTextAreaAtCursor = true;\n dom.addCssClass(this.textarea, \"ace_composition\");\n this.textarea.style.cssText = \"\";\n this.$moveTextAreaToCursor();\n };\n this.setCompositionText = function(text) {\n this.$moveTextAreaToCursor();\n };\n this.hideComposition = function() {\n if (!this.$composition)\n return;\n\n dom.removeCssClass(this.textarea, \"ace_composition\");\n this.$keepTextAreaAtCursor = this.$composition.keepTextAreaAtCursor;\n this.textarea.style.cssText = this.$composition.cssText;\n this.$composition = null;\n };\n this.setTheme = function(theme, cb) {\n var _self = this;\n this.$themeId = theme;\n _self._dispatchEvent('themeChange',{theme:theme});\n\n if (!theme || typeof theme == \"string\") {\n var moduleName = theme || this.$options.theme.initialValue;\n config.loadModule([\"theme\", moduleName], afterLoad);\n } else {\n afterLoad(theme);\n }\n\n function afterLoad(module) {\n if (_self.$themeId != theme)\n return cb && cb();\n if (!module || !module.cssClass)\n throw new Error(\"couldn't load module \" + theme + \" or it didn't call define\");\n dom.importCssString(\n module.cssText,\n module.cssClass,\n _self.container.ownerDocument\n );\n\n if (_self.theme)\n dom.removeCssClass(_self.container, _self.theme.cssClass);\n\n var padding = \"padding\" in module ? module.padding \n : \"padding\" in (_self.theme || {}) ? 4 : _self.$padding;\n if (_self.$padding && padding != _self.$padding)\n _self.setPadding(padding);\n _self.$theme = module.cssClass;\n\n _self.theme = module;\n dom.addCssClass(_self.container, module.cssClass);\n dom.setCssClass(_self.container, \"ace_dark\", module.isDark);\n if (_self.$size) {\n _self.$size.width = 0;\n _self.$updateSizeAsync();\n }\n\n _self._dispatchEvent('themeLoaded', {theme:module});\n cb && cb();\n }\n };\n this.getTheme = function() {\n return this.$themeId;\n };\n this.setStyle = function(style, include) {\n dom.setCssClass(this.container, style, include !== false);\n };\n this.unsetStyle = function(style) {\n dom.removeCssClass(this.container, style);\n };\n \n this.setCursorStyle = function(style) {\n if (this.scroller.style.cursor != style)\n this.scroller.style.cursor = style;\n };\n this.setMouseCursor = function(cursorStyle) {\n this.scroller.style.cursor = cursorStyle;\n };\n this.destroy = function() {\n this.$textLayer.destroy();\n this.$cursorLayer.destroy();\n };\n\n}).call(VirtualRenderer.prototype);\n\n\nconfig.defineOptions(VirtualRenderer.prototype, \"renderer\", {\n animatedScroll: {initialValue: false},\n showInvisibles: {\n set: function(value) {\n if (this.$textLayer.setShowInvisibles(value))\n this.$loop.schedule(this.CHANGE_TEXT);\n },\n initialValue: false\n },\n showPrintMargin: {\n set: function() { this.$updatePrintMargin(); },\n initialValue: true\n },\n printMarginColumn: {\n set: function() { this.$updatePrintMargin(); },\n initialValue: 80\n },\n printMargin: {\n set: function(val) {\n if (typeof val == \"number\")\n this.$printMarginColumn = val;\n this.$showPrintMargin = !!val;\n this.$updatePrintMargin();\n },\n get: function() {\n return this.$showPrintMargin && this.$printMarginColumn; \n }\n },\n showGutter: {\n set: function(show){\n this.$gutter.style.display = show ? \"block\" : \"none\";\n this.$loop.schedule(this.CHANGE_FULL);\n this.onGutterResize();\n },\n initialValue: true\n },\n fadeFoldWidgets: {\n set: function(show) {\n dom.setCssClass(this.$gutter, \"ace_fade-fold-widgets\", show);\n },\n initialValue: false\n },\n showFoldWidgets: {\n set: function(show) {this.$gutterLayer.setShowFoldWidgets(show);},\n initialValue: true\n },\n showLineNumbers: {\n set: function(show) {\n this.$gutterLayer.setShowLineNumbers(show);\n this.$loop.schedule(this.CHANGE_GUTTER);\n },\n initialValue: true\n },\n displayIndentGuides: {\n set: function(show) {\n if (this.$textLayer.setDisplayIndentGuides(show))\n this.$loop.schedule(this.CHANGE_TEXT);\n },\n initialValue: true\n },\n highlightGutterLine: {\n set: function(shouldHighlight) {\n if (!this.$gutterLineHighlight) {\n this.$gutterLineHighlight = dom.createElement(\"div\");\n this.$gutterLineHighlight.className = \"ace_gutter-active-line\";\n this.$gutter.appendChild(this.$gutterLineHighlight);\n return;\n }\n\n this.$gutterLineHighlight.style.display = shouldHighlight ? \"\" : \"none\";\n if (this.$cursorLayer.$pixelPos)\n this.$updateGutterLineHighlight();\n },\n initialValue: false,\n value: true\n },\n hScrollBarAlwaysVisible: {\n set: function(val) {\n if (!this.$hScrollBarAlwaysVisible || !this.$horizScroll)\n this.$loop.schedule(this.CHANGE_SCROLL);\n },\n initialValue: false\n },\n vScrollBarAlwaysVisible: {\n set: function(val) {\n if (!this.$vScrollBarAlwaysVisible || !this.$vScroll)\n this.$loop.schedule(this.CHANGE_SCROLL);\n },\n initialValue: false\n },\n fontSize: {\n set: function(size) {\n if (typeof size == \"number\")\n size = size + \"px\";\n this.container.style.fontSize = size;\n this.updateFontSize();\n },\n initialValue: 12\n },\n fontFamily: {\n set: function(name) {\n this.container.style.fontFamily = name;\n this.updateFontSize();\n }\n },\n maxLines: {\n set: function(val) {\n this.updateFull();\n }\n },\n minLines: {\n set: function(val) {\n this.updateFull();\n }\n },\n maxPixelHeight: {\n set: function(val) {\n this.updateFull();\n },\n initialValue: 0\n },\n scrollPastEnd: {\n set: function(val) {\n val = +val || 0;\n if (this.$scrollPastEnd == val)\n return;\n this.$scrollPastEnd = val;\n this.$loop.schedule(this.CHANGE_SCROLL);\n },\n initialValue: 0,\n handlesSet: true\n },\n fixedWidthGutter: {\n set: function(val) {\n this.$gutterLayer.$fixedWidth = !!val;\n this.$loop.schedule(this.CHANGE_GUTTER);\n }\n },\n theme: {\n set: function(val) { this.setTheme(val); },\n get: function() { return this.$themeId || this.theme; },\n initialValue: \"./theme/textmate\",\n handlesSet: true\n }\n});\n\nexports.VirtualRenderer = VirtualRenderer;\n});\n\nace.define(\"ace/worker/worker_client\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/net\",\"ace/lib/event_emitter\",\"ace/config\"], function(acequire, exports, module) {\n\"use strict\";\n\nvar oop = acequire(\"../lib/oop\");\nvar net = acequire(\"../lib/net\");\nvar EventEmitter = acequire(\"../lib/event_emitter\").EventEmitter;\nvar config = acequire(\"../config\");\n\nfunction $workerBlob(workerUrl, mod) {\n var script = mod.src;\"importScripts('\" + net.qualifyURL(workerUrl) + \"');\";\n try {\n return new Blob([script], {\"type\": \"application/javascript\"});\n } catch (e) { // Backwards-compatibility\n var BlobBuilder = window.BlobBuilder || window.WebKitBlobBuilder || window.MozBlobBuilder;\n var blobBuilder = new BlobBuilder();\n blobBuilder.append(script);\n return blobBuilder.getBlob(\"application/javascript\");\n }\n}\n\nfunction createWorker(workerUrl, mod) {\n var blob = $workerBlob(workerUrl, mod);\n var URL = window.URL || window.webkitURL;\n var blobURL = URL.createObjectURL(blob);\n return new Worker(blobURL);\n}\n\nvar WorkerClient = function(topLevelNamespaces, mod, classname, workerUrl, importScripts) {\n this.$sendDeltaQueue = this.$sendDeltaQueue.bind(this);\n this.changeListener = this.changeListener.bind(this);\n this.onMessage = this.onMessage.bind(this);\n if (acequire.nameToUrl && !acequire.toUrl)\n acequire.toUrl = acequire.nameToUrl;\n \n if (config.get(\"packaged\") || !acequire.toUrl) {\n workerUrl = workerUrl || config.moduleUrl(mod.id, \"worker\");\n } else {\n var normalizePath = this.$normalizePath;\n workerUrl = workerUrl || normalizePath(acequire.toUrl(\"ace/worker/worker.js\", null, \"_\"));\n\n var tlns = {};\n topLevelNamespaces.forEach(function(ns) {\n tlns[ns] = normalizePath(acequire.toUrl(ns, null, \"_\").replace(/(\\.js)?(\\?.*)?$/, \"\"));\n });\n }\n\n this.$worker = createWorker(workerUrl, mod);\n if (importScripts) {\n this.send(\"importScripts\", importScripts);\n }\n this.$worker.postMessage({\n init : true,\n tlns : tlns,\n module : mod.id,\n classname : classname\n });\n\n this.callbackId = 1;\n this.callbacks = {};\n\n this.$worker.onmessage = this.onMessage;\n};\n\n(function(){\n\n oop.implement(this, EventEmitter);\n\n this.onMessage = function(e) {\n var msg = e.data;\n switch (msg.type) {\n case \"event\":\n this._signal(msg.name, {data: msg.data});\n break;\n case \"call\":\n var callback = this.callbacks[msg.id];\n if (callback) {\n callback(msg.data);\n delete this.callbacks[msg.id];\n }\n break;\n case \"error\":\n this.reportError(msg.data);\n break;\n case \"log\":\n window.console && console.log && console.log.apply(console, msg.data);\n break;\n }\n };\n \n this.reportError = function(err) {\n window.console && console.error && console.error(err);\n };\n\n this.$normalizePath = function(path) {\n return net.qualifyURL(path);\n };\n\n this.terminate = function() {\n this._signal(\"terminate\", {});\n this.deltaQueue = null;\n this.$worker.terminate();\n this.$worker = null;\n if (this.$doc)\n this.$doc.off(\"change\", this.changeListener);\n this.$doc = null;\n };\n\n this.send = function(cmd, args) {\n this.$worker.postMessage({command: cmd, args: args});\n };\n\n this.call = function(cmd, args, callback) {\n if (callback) {\n var id = this.callbackId++;\n this.callbacks[id] = callback;\n args.push(id);\n }\n this.send(cmd, args);\n };\n\n this.emit = function(event, data) {\n try {\n this.$worker.postMessage({event: event, data: {data: data.data}});\n }\n catch(ex) {\n console.error(ex.stack);\n }\n };\n\n this.attachToDocument = function(doc) {\n if (this.$doc)\n this.terminate();\n\n this.$doc = doc;\n this.call(\"setValue\", [doc.getValue()]);\n doc.on(\"change\", this.changeListener);\n };\n\n this.changeListener = function(delta) {\n if (!this.deltaQueue) {\n this.deltaQueue = [];\n setTimeout(this.$sendDeltaQueue, 0);\n }\n if (delta.action == \"insert\")\n this.deltaQueue.push(delta.start, delta.lines);\n else\n this.deltaQueue.push(delta.start, delta.end);\n };\n\n this.$sendDeltaQueue = function() {\n var q = this.deltaQueue;\n if (!q) return;\n this.deltaQueue = null;\n if (q.length > 50 && q.length > this.$doc.getLength() >> 1) {\n this.call(\"setValue\", [this.$doc.getValue()]);\n } else\n this.emit(\"change\", {data: q});\n };\n\n}).call(WorkerClient.prototype);\n\n\nvar UIWorkerClient = function(topLevelNamespaces, mod, classname) {\n this.$sendDeltaQueue = this.$sendDeltaQueue.bind(this);\n this.changeListener = this.changeListener.bind(this);\n this.callbackId = 1;\n this.callbacks = {};\n this.messageBuffer = [];\n\n var main = null;\n var emitSync = false;\n var sender = Object.create(EventEmitter);\n var _self = this;\n\n this.$worker = {};\n this.$worker.terminate = function() {};\n this.$worker.postMessage = function(e) {\n _self.messageBuffer.push(e);\n if (main) {\n if (emitSync)\n setTimeout(processNext);\n else\n processNext();\n }\n };\n this.setEmitSync = function(val) { emitSync = val; };\n\n var processNext = function() {\n var msg = _self.messageBuffer.shift();\n if (msg.command)\n main[msg.command].apply(main, msg.args);\n else if (msg.event)\n sender._signal(msg.event, msg.data);\n };\n\n sender.postMessage = function(msg) {\n _self.onMessage({data: msg});\n };\n sender.callback = function(data, callbackId) {\n this.postMessage({type: \"call\", id: callbackId, data: data});\n };\n sender.emit = function(name, data) {\n this.postMessage({type: \"event\", name: name, data: data});\n };\n\n config.loadModule([\"worker\", mod], function(Main) {\n main = new Main[classname](sender);\n while (_self.messageBuffer.length)\n processNext();\n });\n};\n\nUIWorkerClient.prototype = WorkerClient.prototype;\n\nexports.UIWorkerClient = UIWorkerClient;\nexports.WorkerClient = WorkerClient;\nexports.createWorker = createWorker;\n\n\n});\n\nace.define(\"ace/placeholder\",[\"require\",\"exports\",\"module\",\"ace/range\",\"ace/lib/event_emitter\",\"ace/lib/oop\"], function(acequire, exports, module) {\n\"use strict\";\n\nvar Range = acequire(\"./range\").Range;\nvar EventEmitter = acequire(\"./lib/event_emitter\").EventEmitter;\nvar oop = acequire(\"./lib/oop\");\n\nvar PlaceHolder = function(session, length, pos, others, mainClass, othersClass) {\n var _self = this;\n this.length = length;\n this.session = session;\n this.doc = session.getDocument();\n this.mainClass = mainClass;\n this.othersClass = othersClass;\n this.$onUpdate = this.onUpdate.bind(this);\n this.doc.on(\"change\", this.$onUpdate);\n this.$others = others;\n \n this.$onCursorChange = function() {\n setTimeout(function() {\n _self.onCursorChange();\n });\n };\n \n this.$pos = pos;\n var undoStack = session.getUndoManager().$undoStack || session.getUndoManager().$undostack || {length: -1};\n this.$undoStackDepth = undoStack.length;\n this.setup();\n\n session.selection.on(\"changeCursor\", this.$onCursorChange);\n};\n\n(function() {\n\n oop.implement(this, EventEmitter);\n this.setup = function() {\n var _self = this;\n var doc = this.doc;\n var session = this.session;\n \n this.selectionBefore = session.selection.toJSON();\n if (session.selection.inMultiSelectMode)\n session.selection.toSingleRange();\n\n this.pos = doc.createAnchor(this.$pos.row, this.$pos.column);\n var pos = this.pos;\n pos.$insertRight = true;\n pos.detach();\n pos.markerId = session.addMarker(new Range(pos.row, pos.column, pos.row, pos.column + this.length), this.mainClass, null, false);\n this.others = [];\n this.$others.forEach(function(other) {\n var anchor = doc.createAnchor(other.row, other.column);\n anchor.$insertRight = true;\n anchor.detach();\n _self.others.push(anchor);\n });\n session.setUndoSelect(false);\n };\n this.showOtherMarkers = function() {\n if (this.othersActive) return;\n var session = this.session;\n var _self = this;\n this.othersActive = true;\n this.others.forEach(function(anchor) {\n anchor.markerId = session.addMarker(new Range(anchor.row, anchor.column, anchor.row, anchor.column+_self.length), _self.othersClass, null, false);\n });\n };\n this.hideOtherMarkers = function() {\n if (!this.othersActive) return;\n this.othersActive = false;\n for (var i = 0; i < this.others.length; i++) {\n this.session.removeMarker(this.others[i].markerId);\n }\n };\n this.onUpdate = function(delta) {\n if (this.$updating)\n return this.updateAnchors(delta);\n \n var range = delta;\n if (range.start.row !== range.end.row) return;\n if (range.start.row !== this.pos.row) return;\n this.$updating = true;\n var lengthDiff = delta.action === \"insert\" ? range.end.column - range.start.column : range.start.column - range.end.column;\n var inMainRange = range.start.column >= this.pos.column && range.start.column <= this.pos.column + this.length + 1;\n var distanceFromStart = range.start.column - this.pos.column;\n \n this.updateAnchors(delta);\n \n if (inMainRange)\n this.length += lengthDiff;\n\n if (inMainRange && !this.session.$fromUndo) {\n if (delta.action === 'insert') {\n for (var i = this.others.length - 1; i >= 0; i--) {\n var otherPos = this.others[i];\n var newPos = {row: otherPos.row, column: otherPos.column + distanceFromStart};\n this.doc.insertMergedLines(newPos, delta.lines);\n }\n } else if (delta.action === 'remove') {\n for (var i = this.others.length - 1; i >= 0; i--) {\n var otherPos = this.others[i];\n var newPos = {row: otherPos.row, column: otherPos.column + distanceFromStart};\n this.doc.remove(new Range(newPos.row, newPos.column, newPos.row, newPos.column - lengthDiff));\n }\n }\n }\n \n this.$updating = false;\n this.updateMarkers();\n };\n \n this.updateAnchors = function(delta) {\n this.pos.onChange(delta);\n for (var i = this.others.length; i--;)\n this.others[i].onChange(delta);\n this.updateMarkers();\n };\n \n this.updateMarkers = function() {\n if (this.$updating)\n return;\n var _self = this;\n var session = this.session;\n var updateMarker = function(pos, className) {\n session.removeMarker(pos.markerId);\n pos.markerId = session.addMarker(new Range(pos.row, pos.column, pos.row, pos.column+_self.length), className, null, false);\n };\n updateMarker(this.pos, this.mainClass);\n for (var i = this.others.length; i--;)\n updateMarker(this.others[i], this.othersClass);\n };\n\n this.onCursorChange = function(event) {\n if (this.$updating || !this.session) return;\n var pos = this.session.selection.getCursor();\n if (pos.row === this.pos.row && pos.column >= this.pos.column && pos.column <= this.pos.column + this.length) {\n this.showOtherMarkers();\n this._emit(\"cursorEnter\", event);\n } else {\n this.hideOtherMarkers();\n this._emit(\"cursorLeave\", event);\n }\n }; \n this.detach = function() {\n this.session.removeMarker(this.pos && this.pos.markerId);\n this.hideOtherMarkers();\n this.doc.removeEventListener(\"change\", this.$onUpdate);\n this.session.selection.removeEventListener(\"changeCursor\", this.$onCursorChange);\n this.session.setUndoSelect(true);\n this.session = null;\n };\n this.cancel = function() {\n if (this.$undoStackDepth === -1)\n return;\n var undoManager = this.session.getUndoManager();\n var undosRequired = (undoManager.$undoStack || undoManager.$undostack).length - this.$undoStackDepth;\n for (var i = 0; i < undosRequired; i++) {\n undoManager.undo(true);\n }\n if (this.selectionBefore)\n this.session.selection.fromJSON(this.selectionBefore);\n };\n}).call(PlaceHolder.prototype);\n\n\nexports.PlaceHolder = PlaceHolder;\n});\n\nace.define(\"ace/mouse/multi_select_handler\",[\"require\",\"exports\",\"module\",\"ace/lib/event\",\"ace/lib/useragent\"], function(acequire, exports, module) {\n\nvar event = acequire(\"../lib/event\");\nvar useragent = acequire(\"../lib/useragent\");\nfunction isSamePoint(p1, p2) {\n return p1.row == p2.row && p1.column == p2.column;\n}\n\nfunction onMouseDown(e) {\n var ev = e.domEvent;\n var alt = ev.altKey;\n var shift = ev.shiftKey;\n var ctrl = ev.ctrlKey;\n var accel = e.getAccelKey();\n var button = e.getButton();\n \n if (ctrl && useragent.isMac)\n button = ev.button;\n\n if (e.editor.inMultiSelectMode && button == 2) {\n e.editor.textInput.onContextMenu(e.domEvent);\n return;\n }\n \n if (!ctrl && !alt && !accel) {\n if (button === 0 && e.editor.inMultiSelectMode)\n e.editor.exitMultiSelectMode();\n return;\n }\n \n if (button !== 0)\n return;\n\n var editor = e.editor;\n var selection = editor.selection;\n var isMultiSelect = editor.inMultiSelectMode;\n var pos = e.getDocumentPosition();\n var cursor = selection.getCursor();\n var inSelection = e.inSelection() || (selection.isEmpty() && isSamePoint(pos, cursor));\n\n var mouseX = e.x, mouseY = e.y;\n var onMouseSelection = function(e) {\n mouseX = e.clientX;\n mouseY = e.clientY;\n };\n \n var session = editor.session;\n var screenAnchor = editor.renderer.pixelToScreenCoordinates(mouseX, mouseY);\n var screenCursor = screenAnchor;\n \n var selectionMode;\n if (editor.$mouseHandler.$enableJumpToDef) {\n if (ctrl && alt || accel && alt)\n selectionMode = shift ? \"block\" : \"add\";\n else if (alt && editor.$blockSelectEnabled)\n selectionMode = \"block\";\n } else {\n if (accel && !alt) {\n selectionMode = \"add\";\n if (!isMultiSelect && shift)\n return;\n } else if (alt && editor.$blockSelectEnabled) {\n selectionMode = \"block\";\n }\n }\n \n if (selectionMode && useragent.isMac && ev.ctrlKey) {\n editor.$mouseHandler.cancelContextMenu();\n }\n\n if (selectionMode == \"add\") {\n if (!isMultiSelect && inSelection)\n return; // dragging\n\n if (!isMultiSelect) {\n var range = selection.toOrientedRange();\n editor.addSelectionMarker(range);\n }\n\n var oldRange = selection.rangeList.rangeAtPoint(pos);\n \n \n editor.$blockScrolling++;\n editor.inVirtualSelectionMode = true;\n \n if (shift) {\n oldRange = null;\n range = selection.ranges[0] || range;\n editor.removeSelectionMarker(range);\n }\n editor.once(\"mouseup\", function() {\n var tmpSel = selection.toOrientedRange();\n\n if (oldRange && tmpSel.isEmpty() && isSamePoint(oldRange.cursor, tmpSel.cursor))\n selection.substractPoint(tmpSel.cursor);\n else {\n if (shift) {\n selection.substractPoint(range.cursor);\n } else if (range) {\n editor.removeSelectionMarker(range);\n selection.addRange(range);\n }\n selection.addRange(tmpSel);\n }\n editor.$blockScrolling--;\n editor.inVirtualSelectionMode = false;\n });\n\n } else if (selectionMode == \"block\") {\n e.stop();\n editor.inVirtualSelectionMode = true; \n var initialRange;\n var rectSel = [];\n var blockSelect = function() {\n var newCursor = editor.renderer.pixelToScreenCoordinates(mouseX, mouseY);\n var cursor = session.screenToDocumentPosition(newCursor.row, newCursor.column, newCursor.offsetX);\n\n if (isSamePoint(screenCursor, newCursor) && isSamePoint(cursor, selection.lead))\n return;\n screenCursor = newCursor;\n \n editor.$blockScrolling++;\n editor.selection.moveToPosition(cursor);\n editor.renderer.scrollCursorIntoView();\n\n editor.removeSelectionMarkers(rectSel);\n rectSel = selection.rectangularRangeBlock(screenCursor, screenAnchor);\n if (editor.$mouseHandler.$clickSelection && rectSel.length == 1 && rectSel[0].isEmpty())\n rectSel[0] = editor.$mouseHandler.$clickSelection.clone();\n rectSel.forEach(editor.addSelectionMarker, editor);\n editor.updateSelectionMarkers();\n editor.$blockScrolling--;\n };\n editor.$blockScrolling++;\n if (isMultiSelect && !accel) {\n selection.toSingleRange();\n } else if (!isMultiSelect && accel) {\n initialRange = selection.toOrientedRange();\n editor.addSelectionMarker(initialRange);\n }\n \n if (shift)\n screenAnchor = session.documentToScreenPosition(selection.lead); \n else\n selection.moveToPosition(pos);\n editor.$blockScrolling--;\n \n screenCursor = {row: -1, column: -1};\n\n var onMouseSelectionEnd = function(e) {\n clearInterval(timerId);\n editor.removeSelectionMarkers(rectSel);\n if (!rectSel.length)\n rectSel = [selection.toOrientedRange()];\n editor.$blockScrolling++;\n if (initialRange) {\n editor.removeSelectionMarker(initialRange);\n selection.toSingleRange(initialRange);\n }\n for (var i = 0; i < rectSel.length; i++)\n selection.addRange(rectSel[i]);\n editor.inVirtualSelectionMode = false;\n editor.$mouseHandler.$clickSelection = null;\n editor.$blockScrolling--;\n };\n\n var onSelectionInterval = blockSelect;\n\n event.capture(editor.container, onMouseSelection, onMouseSelectionEnd);\n var timerId = setInterval(function() {onSelectionInterval();}, 20);\n\n return e.preventDefault();\n }\n}\n\n\nexports.onMouseDown = onMouseDown;\n\n});\n\nace.define(\"ace/commands/multi_select_commands\",[\"require\",\"exports\",\"module\",\"ace/keyboard/hash_handler\"], function(acequire, exports, module) {\nexports.defaultCommands = [{\n name: \"addCursorAbove\",\n exec: function(editor) { editor.selectMoreLines(-1); },\n bindKey: {win: \"Ctrl-Alt-Up\", mac: \"Ctrl-Alt-Up\"},\n scrollIntoView: \"cursor\",\n readOnly: true\n}, {\n name: \"addCursorBelow\",\n exec: function(editor) { editor.selectMoreLines(1); },\n bindKey: {win: \"Ctrl-Alt-Down\", mac: \"Ctrl-Alt-Down\"},\n scrollIntoView: \"cursor\",\n readOnly: true\n}, {\n name: \"addCursorAboveSkipCurrent\",\n exec: function(editor) { editor.selectMoreLines(-1, true); },\n bindKey: {win: \"Ctrl-Alt-Shift-Up\", mac: \"Ctrl-Alt-Shift-Up\"},\n scrollIntoView: \"cursor\",\n readOnly: true\n}, {\n name: \"addCursorBelowSkipCurrent\",\n exec: function(editor) { editor.selectMoreLines(1, true); },\n bindKey: {win: \"Ctrl-Alt-Shift-Down\", mac: \"Ctrl-Alt-Shift-Down\"},\n scrollIntoView: \"cursor\",\n readOnly: true\n}, {\n name: \"selectMoreBefore\",\n exec: function(editor) { editor.selectMore(-1); },\n bindKey: {win: \"Ctrl-Alt-Left\", mac: \"Ctrl-Alt-Left\"},\n scrollIntoView: \"cursor\",\n readOnly: true\n}, {\n name: \"selectMoreAfter\",\n exec: function(editor) { editor.selectMore(1); },\n bindKey: {win: \"Ctrl-Alt-Right\", mac: \"Ctrl-Alt-Right\"},\n scrollIntoView: \"cursor\",\n readOnly: true\n}, {\n name: \"selectNextBefore\",\n exec: function(editor) { editor.selectMore(-1, true); },\n bindKey: {win: \"Ctrl-Alt-Shift-Left\", mac: \"Ctrl-Alt-Shift-Left\"},\n scrollIntoView: \"cursor\",\n readOnly: true\n}, {\n name: \"selectNextAfter\",\n exec: function(editor) { editor.selectMore(1, true); },\n bindKey: {win: \"Ctrl-Alt-Shift-Right\", mac: \"Ctrl-Alt-Shift-Right\"},\n scrollIntoView: \"cursor\",\n readOnly: true\n}, {\n name: \"splitIntoLines\",\n exec: function(editor) { editor.multiSelect.splitIntoLines(); },\n bindKey: {win: \"Ctrl-Alt-L\", mac: \"Ctrl-Alt-L\"},\n readOnly: true\n}, {\n name: \"alignCursors\",\n exec: function(editor) { editor.alignCursors(); },\n bindKey: {win: \"Ctrl-Alt-A\", mac: \"Ctrl-Alt-A\"},\n scrollIntoView: \"cursor\"\n}, {\n name: \"findAll\",\n exec: function(editor) { editor.findAll(); },\n bindKey: {win: \"Ctrl-Alt-K\", mac: \"Ctrl-Alt-G\"},\n scrollIntoView: \"cursor\",\n readOnly: true\n}];\nexports.multiSelectCommands = [{\n name: \"singleSelection\",\n bindKey: \"esc\",\n exec: function(editor) { editor.exitMultiSelectMode(); },\n scrollIntoView: \"cursor\",\n readOnly: true,\n isAvailable: function(editor) {return editor && editor.inMultiSelectMode;}\n}];\n\nvar HashHandler = acequire(\"../keyboard/hash_handler\").HashHandler;\nexports.keyboardHandler = new HashHandler(exports.multiSelectCommands);\n\n});\n\nace.define(\"ace/multi_select\",[\"require\",\"exports\",\"module\",\"ace/range_list\",\"ace/range\",\"ace/selection\",\"ace/mouse/multi_select_handler\",\"ace/lib/event\",\"ace/lib/lang\",\"ace/commands/multi_select_commands\",\"ace/search\",\"ace/edit_session\",\"ace/editor\",\"ace/config\"], function(acequire, exports, module) {\n\nvar RangeList = acequire(\"./range_list\").RangeList;\nvar Range = acequire(\"./range\").Range;\nvar Selection = acequire(\"./selection\").Selection;\nvar onMouseDown = acequire(\"./mouse/multi_select_handler\").onMouseDown;\nvar event = acequire(\"./lib/event\");\nvar lang = acequire(\"./lib/lang\");\nvar commands = acequire(\"./commands/multi_select_commands\");\nexports.commands = commands.defaultCommands.concat(commands.multiSelectCommands);\nvar Search = acequire(\"./search\").Search;\nvar search = new Search();\n\nfunction find(session, needle, dir) {\n search.$options.wrap = true;\n search.$options.needle = needle;\n search.$options.backwards = dir == -1;\n return search.find(session);\n}\nvar EditSession = acequire(\"./edit_session\").EditSession;\n(function() {\n this.getSelectionMarkers = function() {\n return this.$selectionMarkers;\n };\n}).call(EditSession.prototype);\n(function() {\n this.ranges = null;\n this.rangeList = null;\n this.addRange = function(range, $blockChangeEvents) {\n if (!range)\n return;\n\n if (!this.inMultiSelectMode && this.rangeCount === 0) {\n var oldRange = this.toOrientedRange();\n this.rangeList.add(oldRange);\n this.rangeList.add(range);\n if (this.rangeList.ranges.length != 2) {\n this.rangeList.removeAll();\n return $blockChangeEvents || this.fromOrientedRange(range);\n }\n this.rangeList.removeAll();\n this.rangeList.add(oldRange);\n this.$onAddRange(oldRange);\n }\n\n if (!range.cursor)\n range.cursor = range.end;\n\n var removed = this.rangeList.add(range);\n\n this.$onAddRange(range);\n\n if (removed.length)\n this.$onRemoveRange(removed);\n\n if (this.rangeCount > 1 && !this.inMultiSelectMode) {\n this._signal(\"multiSelect\");\n this.inMultiSelectMode = true;\n this.session.$undoSelect = false;\n this.rangeList.attach(this.session);\n }\n\n return $blockChangeEvents || this.fromOrientedRange(range);\n };\n\n this.toSingleRange = function(range) {\n range = range || this.ranges[0];\n var removed = this.rangeList.removeAll();\n if (removed.length)\n this.$onRemoveRange(removed);\n\n range && this.fromOrientedRange(range);\n };\n this.substractPoint = function(pos) {\n var removed = this.rangeList.substractPoint(pos);\n if (removed) {\n this.$onRemoveRange(removed);\n return removed[0];\n }\n };\n this.mergeOverlappingRanges = function() {\n var removed = this.rangeList.merge();\n if (removed.length)\n this.$onRemoveRange(removed);\n else if(this.ranges[0])\n this.fromOrientedRange(this.ranges[0]);\n };\n\n this.$onAddRange = function(range) {\n this.rangeCount = this.rangeList.ranges.length;\n this.ranges.unshift(range);\n this._signal(\"addRange\", {range: range});\n };\n\n this.$onRemoveRange = function(removed) {\n this.rangeCount = this.rangeList.ranges.length;\n if (this.rangeCount == 1 && this.inMultiSelectMode) {\n var lastRange = this.rangeList.ranges.pop();\n removed.push(lastRange);\n this.rangeCount = 0;\n }\n\n for (var i = removed.length; i--; ) {\n var index = this.ranges.indexOf(removed[i]);\n this.ranges.splice(index, 1);\n }\n\n this._signal(\"removeRange\", {ranges: removed});\n\n if (this.rangeCount === 0 && this.inMultiSelectMode) {\n this.inMultiSelectMode = false;\n this._signal(\"singleSelect\");\n this.session.$undoSelect = true;\n this.rangeList.detach(this.session);\n }\n\n lastRange = lastRange || this.ranges[0];\n if (lastRange && !lastRange.isEqual(this.getRange()))\n this.fromOrientedRange(lastRange);\n };\n this.$initRangeList = function() {\n if (this.rangeList)\n return;\n\n this.rangeList = new RangeList();\n this.ranges = [];\n this.rangeCount = 0;\n };\n this.getAllRanges = function() {\n return this.rangeCount ? this.rangeList.ranges.concat() : [this.getRange()];\n };\n\n this.splitIntoLines = function () {\n if (this.rangeCount > 1) {\n var ranges = this.rangeList.ranges;\n var lastRange = ranges[ranges.length - 1];\n var range = Range.fromPoints(ranges[0].start, lastRange.end);\n\n this.toSingleRange();\n this.setSelectionRange(range, lastRange.cursor == lastRange.start);\n } else {\n var range = this.getRange();\n var isBackwards = this.isBackwards();\n var startRow = range.start.row;\n var endRow = range.end.row;\n if (startRow == endRow) {\n if (isBackwards)\n var start = range.end, end = range.start;\n else\n var start = range.start, end = range.end;\n \n this.addRange(Range.fromPoints(end, end));\n this.addRange(Range.fromPoints(start, start));\n return;\n }\n\n var rectSel = [];\n var r = this.getLineRange(startRow, true);\n r.start.column = range.start.column;\n rectSel.push(r);\n\n for (var i = startRow + 1; i < endRow; i++)\n rectSel.push(this.getLineRange(i, true));\n\n r = this.getLineRange(endRow, true);\n r.end.column = range.end.column;\n rectSel.push(r);\n\n rectSel.forEach(this.addRange, this);\n }\n };\n this.toggleBlockSelection = function () {\n if (this.rangeCount > 1) {\n var ranges = this.rangeList.ranges;\n var lastRange = ranges[ranges.length - 1];\n var range = Range.fromPoints(ranges[0].start, lastRange.end);\n\n this.toSingleRange();\n this.setSelectionRange(range, lastRange.cursor == lastRange.start);\n } else {\n var cursor = this.session.documentToScreenPosition(this.selectionLead);\n var anchor = this.session.documentToScreenPosition(this.selectionAnchor);\n\n var rectSel = this.rectangularRangeBlock(cursor, anchor);\n rectSel.forEach(this.addRange, this);\n }\n };\n this.rectangularRangeBlock = function(screenCursor, screenAnchor, includeEmptyLines) {\n var rectSel = [];\n\n var xBackwards = screenCursor.column < screenAnchor.column;\n if (xBackwards) {\n var startColumn = screenCursor.column;\n var endColumn = screenAnchor.column;\n var startOffsetX = screenCursor.offsetX;\n var endOffsetX = screenAnchor.offsetX;\n } else {\n var startColumn = screenAnchor.column;\n var endColumn = screenCursor.column;\n var startOffsetX = screenAnchor.offsetX;\n var endOffsetX = screenCursor.offsetX;\n }\n\n var yBackwards = screenCursor.row < screenAnchor.row;\n if (yBackwards) {\n var startRow = screenCursor.row;\n var endRow = screenAnchor.row;\n } else {\n var startRow = screenAnchor.row;\n var endRow = screenCursor.row;\n }\n\n if (startColumn < 0)\n startColumn = 0;\n if (startRow < 0)\n startRow = 0;\n\n if (startRow == endRow)\n includeEmptyLines = true;\n\n for (var row = startRow; row <= endRow; row++) {\n var range = Range.fromPoints(\n this.session.screenToDocumentPosition(row, startColumn, startOffsetX),\n this.session.screenToDocumentPosition(row, endColumn, endOffsetX)\n );\n if (range.isEmpty()) {\n if (docEnd && isSamePoint(range.end, docEnd))\n break;\n var docEnd = range.end;\n }\n range.cursor = xBackwards ? range.start : range.end;\n rectSel.push(range);\n }\n\n if (yBackwards)\n rectSel.reverse();\n\n if (!includeEmptyLines) {\n var end = rectSel.length - 1;\n while (rectSel[end].isEmpty() && end > 0)\n end--;\n if (end > 0) {\n var start = 0;\n while (rectSel[start].isEmpty())\n start++;\n }\n for (var i = end; i >= start; i--) {\n if (rectSel[i].isEmpty())\n rectSel.splice(i, 1);\n }\n }\n\n return rectSel;\n };\n}).call(Selection.prototype);\nvar Editor = acequire(\"./editor\").Editor;\n(function() {\n this.updateSelectionMarkers = function() {\n this.renderer.updateCursor();\n this.renderer.updateBackMarkers();\n };\n this.addSelectionMarker = function(orientedRange) {\n if (!orientedRange.cursor)\n orientedRange.cursor = orientedRange.end;\n\n var style = this.getSelectionStyle();\n orientedRange.marker = this.session.addMarker(orientedRange, \"ace_selection\", style);\n\n this.session.$selectionMarkers.push(orientedRange);\n this.session.selectionMarkerCount = this.session.$selectionMarkers.length;\n return orientedRange;\n };\n this.removeSelectionMarker = function(range) {\n if (!range.marker)\n return;\n this.session.removeMarker(range.marker);\n var index = this.session.$selectionMarkers.indexOf(range);\n if (index != -1)\n this.session.$selectionMarkers.splice(index, 1);\n this.session.selectionMarkerCount = this.session.$selectionMarkers.length;\n };\n\n this.removeSelectionMarkers = function(ranges) {\n var markerList = this.session.$selectionMarkers;\n for (var i = ranges.length; i--; ) {\n var range = ranges[i];\n if (!range.marker)\n continue;\n this.session.removeMarker(range.marker);\n var index = markerList.indexOf(range);\n if (index != -1)\n markerList.splice(index, 1);\n }\n this.session.selectionMarkerCount = markerList.length;\n };\n\n this.$onAddRange = function(e) {\n this.addSelectionMarker(e.range);\n this.renderer.updateCursor();\n this.renderer.updateBackMarkers();\n };\n\n this.$onRemoveRange = function(e) {\n this.removeSelectionMarkers(e.ranges);\n this.renderer.updateCursor();\n this.renderer.updateBackMarkers();\n };\n\n this.$onMultiSelect = function(e) {\n if (this.inMultiSelectMode)\n return;\n this.inMultiSelectMode = true;\n\n this.setStyle(\"ace_multiselect\");\n this.keyBinding.addKeyboardHandler(commands.keyboardHandler);\n this.commands.setDefaultHandler(\"exec\", this.$onMultiSelectExec);\n\n this.renderer.updateCursor();\n this.renderer.updateBackMarkers();\n };\n\n this.$onSingleSelect = function(e) {\n if (this.session.multiSelect.inVirtualMode)\n return;\n this.inMultiSelectMode = false;\n\n this.unsetStyle(\"ace_multiselect\");\n this.keyBinding.removeKeyboardHandler(commands.keyboardHandler);\n\n this.commands.removeDefaultHandler(\"exec\", this.$onMultiSelectExec);\n this.renderer.updateCursor();\n this.renderer.updateBackMarkers();\n this._emit(\"changeSelection\");\n };\n\n this.$onMultiSelectExec = function(e) {\n var command = e.command;\n var editor = e.editor;\n if (!editor.multiSelect)\n return;\n if (!command.multiSelectAction) {\n var result = command.exec(editor, e.args || {});\n editor.multiSelect.addRange(editor.multiSelect.toOrientedRange());\n editor.multiSelect.mergeOverlappingRanges();\n } else if (command.multiSelectAction == \"forEach\") {\n result = editor.forEachSelection(command, e.args);\n } else if (command.multiSelectAction == \"forEachLine\") {\n result = editor.forEachSelection(command, e.args, true);\n } else if (command.multiSelectAction == \"single\") {\n editor.exitMultiSelectMode();\n result = command.exec(editor, e.args || {});\n } else {\n result = command.multiSelectAction(editor, e.args || {});\n }\n return result;\n }; \n this.forEachSelection = function(cmd, args, options) {\n if (this.inVirtualSelectionMode)\n return;\n var keepOrder = options && options.keepOrder;\n var $byLines = options == true || options && options.$byLines;\n var session = this.session;\n var selection = this.selection;\n var rangeList = selection.rangeList;\n var ranges = (keepOrder ? selection : rangeList).ranges;\n var result;\n \n if (!ranges.length)\n return cmd.exec ? cmd.exec(this, args || {}) : cmd(this, args || {});\n \n var reg = selection._eventRegistry;\n selection._eventRegistry = {};\n\n var tmpSel = new Selection(session);\n this.inVirtualSelectionMode = true;\n for (var i = ranges.length; i--;) {\n if ($byLines) {\n while (i > 0 && ranges[i].start.row == ranges[i - 1].end.row)\n i--;\n }\n tmpSel.fromOrientedRange(ranges[i]);\n tmpSel.index = i;\n this.selection = session.selection = tmpSel;\n var cmdResult = cmd.exec ? cmd.exec(this, args || {}) : cmd(this, args || {});\n if (!result && cmdResult !== undefined)\n result = cmdResult;\n tmpSel.toOrientedRange(ranges[i]);\n }\n tmpSel.detach();\n\n this.selection = session.selection = selection;\n this.inVirtualSelectionMode = false;\n selection._eventRegistry = reg;\n selection.mergeOverlappingRanges();\n \n var anim = this.renderer.$scrollAnimation;\n this.onCursorChange();\n this.onSelectionChange();\n if (anim && anim.from == anim.to)\n this.renderer.animateScrolling(anim.from);\n \n return result;\n };\n this.exitMultiSelectMode = function() {\n if (!this.inMultiSelectMode || this.inVirtualSelectionMode)\n return;\n this.multiSelect.toSingleRange();\n };\n\n this.getSelectedText = function() {\n var text = \"\";\n if (this.inMultiSelectMode && !this.inVirtualSelectionMode) {\n var ranges = this.multiSelect.rangeList.ranges;\n var buf = [];\n for (var i = 0; i < ranges.length; i++) {\n buf.push(this.session.getTextRange(ranges[i]));\n }\n var nl = this.session.getDocument().getNewLineCharacter();\n text = buf.join(nl);\n if (text.length == (buf.length - 1) * nl.length)\n text = \"\";\n } else if (!this.selection.isEmpty()) {\n text = this.session.getTextRange(this.getSelectionRange());\n }\n return text;\n };\n \n this.$checkMultiselectChange = function(e, anchor) {\n if (this.inMultiSelectMode && !this.inVirtualSelectionMode) {\n var range = this.multiSelect.ranges[0];\n if (this.multiSelect.isEmpty() && anchor == this.multiSelect.anchor)\n return;\n var pos = anchor == this.multiSelect.anchor\n ? range.cursor == range.start ? range.end : range.start\n : range.cursor;\n if (pos.row != anchor.row \n || this.session.$clipPositionToDocument(pos.row, pos.column).column != anchor.column)\n this.multiSelect.toSingleRange(this.multiSelect.toOrientedRange());\n }\n };\n this.findAll = function(needle, options, additive) {\n options = options || {};\n options.needle = needle || options.needle;\n if (options.needle == undefined) {\n var range = this.selection.isEmpty()\n ? this.selection.getWordRange()\n : this.selection.getRange();\n options.needle = this.session.getTextRange(range);\n } \n this.$search.set(options);\n \n var ranges = this.$search.findAll(this.session);\n if (!ranges.length)\n return 0;\n\n this.$blockScrolling += 1;\n var selection = this.multiSelect;\n\n if (!additive)\n selection.toSingleRange(ranges[0]);\n\n for (var i = ranges.length; i--; )\n selection.addRange(ranges[i], true);\n if (range && selection.rangeList.rangeAtPoint(range.start))\n selection.addRange(range, true);\n \n this.$blockScrolling -= 1;\n\n return ranges.length;\n };\n this.selectMoreLines = function(dir, skip) {\n var range = this.selection.toOrientedRange();\n var isBackwards = range.cursor == range.end;\n\n var screenLead = this.session.documentToScreenPosition(range.cursor);\n if (this.selection.$desiredColumn)\n screenLead.column = this.selection.$desiredColumn;\n\n var lead = this.session.screenToDocumentPosition(screenLead.row + dir, screenLead.column);\n\n if (!range.isEmpty()) {\n var screenAnchor = this.session.documentToScreenPosition(isBackwards ? range.end : range.start);\n var anchor = this.session.screenToDocumentPosition(screenAnchor.row + dir, screenAnchor.column);\n } else {\n var anchor = lead;\n }\n\n if (isBackwards) {\n var newRange = Range.fromPoints(lead, anchor);\n newRange.cursor = newRange.start;\n } else {\n var newRange = Range.fromPoints(anchor, lead);\n newRange.cursor = newRange.end;\n }\n\n newRange.desiredColumn = screenLead.column;\n if (!this.selection.inMultiSelectMode) {\n this.selection.addRange(range);\n } else {\n if (skip)\n var toRemove = range.cursor;\n }\n\n this.selection.addRange(newRange);\n if (toRemove)\n this.selection.substractPoint(toRemove);\n };\n this.transposeSelections = function(dir) {\n var session = this.session;\n var sel = session.multiSelect;\n var all = sel.ranges;\n\n for (var i = all.length; i--; ) {\n var range = all[i];\n if (range.isEmpty()) {\n var tmp = session.getWordRange(range.start.row, range.start.column);\n range.start.row = tmp.start.row;\n range.start.column = tmp.start.column;\n range.end.row = tmp.end.row;\n range.end.column = tmp.end.column;\n }\n }\n sel.mergeOverlappingRanges();\n\n var words = [];\n for (var i = all.length; i--; ) {\n var range = all[i];\n words.unshift(session.getTextRange(range));\n }\n\n if (dir < 0)\n words.unshift(words.pop());\n else\n words.push(words.shift());\n\n for (var i = all.length; i--; ) {\n var range = all[i];\n var tmp = range.clone();\n session.replace(range, words[i]);\n range.start.row = tmp.start.row;\n range.start.column = tmp.start.column;\n }\n };\n this.selectMore = function(dir, skip, stopAtFirst) {\n var session = this.session;\n var sel = session.multiSelect;\n\n var range = sel.toOrientedRange();\n if (range.isEmpty()) {\n range = session.getWordRange(range.start.row, range.start.column);\n range.cursor = dir == -1 ? range.start : range.end;\n this.multiSelect.addRange(range);\n if (stopAtFirst)\n return;\n }\n var needle = session.getTextRange(range);\n\n var newRange = find(session, needle, dir);\n if (newRange) {\n newRange.cursor = dir == -1 ? newRange.start : newRange.end;\n this.$blockScrolling += 1;\n this.session.unfold(newRange);\n this.multiSelect.addRange(newRange);\n this.$blockScrolling -= 1;\n this.renderer.scrollCursorIntoView(null, 0.5);\n }\n if (skip)\n this.multiSelect.substractPoint(range.cursor);\n };\n this.alignCursors = function() {\n var session = this.session;\n var sel = session.multiSelect;\n var ranges = sel.ranges;\n var row = -1;\n var sameRowRanges = ranges.filter(function(r) {\n if (r.cursor.row == row)\n return true;\n row = r.cursor.row;\n });\n \n if (!ranges.length || sameRowRanges.length == ranges.length - 1) {\n var range = this.selection.getRange();\n var fr = range.start.row, lr = range.end.row;\n var guessRange = fr == lr;\n if (guessRange) {\n var max = this.session.getLength();\n var line;\n do {\n line = this.session.getLine(lr);\n } while (/[=:]/.test(line) && ++lr < max);\n do {\n line = this.session.getLine(fr);\n } while (/[=:]/.test(line) && --fr > 0);\n \n if (fr < 0) fr = 0;\n if (lr >= max) lr = max - 1;\n }\n var lines = this.session.removeFullLines(fr, lr);\n lines = this.$reAlignText(lines, guessRange);\n this.session.insert({row: fr, column: 0}, lines.join(\"\\n\") + \"\\n\");\n if (!guessRange) {\n range.start.column = 0;\n range.end.column = lines[lines.length - 1].length;\n }\n this.selection.setRange(range);\n } else {\n sameRowRanges.forEach(function(r) {\n sel.substractPoint(r.cursor);\n });\n\n var maxCol = 0;\n var minSpace = Infinity;\n var spaceOffsets = ranges.map(function(r) {\n var p = r.cursor;\n var line = session.getLine(p.row);\n var spaceOffset = line.substr(p.column).search(/\\S/g);\n if (spaceOffset == -1)\n spaceOffset = 0;\n\n if (p.column > maxCol)\n maxCol = p.column;\n if (spaceOffset < minSpace)\n minSpace = spaceOffset;\n return spaceOffset;\n });\n ranges.forEach(function(r, i) {\n var p = r.cursor;\n var l = maxCol - p.column;\n var d = spaceOffsets[i] - minSpace;\n if (l > d)\n session.insert(p, lang.stringRepeat(\" \", l - d));\n else\n session.remove(new Range(p.row, p.column, p.row, p.column - l + d));\n\n r.start.column = r.end.column = maxCol;\n r.start.row = r.end.row = p.row;\n r.cursor = r.end;\n });\n sel.fromOrientedRange(ranges[0]);\n this.renderer.updateCursor();\n this.renderer.updateBackMarkers();\n }\n };\n\n this.$reAlignText = function(lines, forceLeft) {\n var isLeftAligned = true, isRightAligned = true;\n var startW, textW, endW;\n\n return lines.map(function(line) {\n var m = line.match(/(\\s*)(.*?)(\\s*)([=:].*)/);\n if (!m)\n return [line];\n\n if (startW == null) {\n startW = m[1].length;\n textW = m[2].length;\n endW = m[3].length;\n return m;\n }\n\n if (startW + textW + endW != m[1].length + m[2].length + m[3].length)\n isRightAligned = false;\n if (startW != m[1].length)\n isLeftAligned = false;\n\n if (startW > m[1].length)\n startW = m[1].length;\n if (textW < m[2].length)\n textW = m[2].length;\n if (endW > m[3].length)\n endW = m[3].length;\n\n return m;\n }).map(forceLeft ? alignLeft :\n isLeftAligned ? isRightAligned ? alignRight : alignLeft : unAlign);\n\n function spaces(n) {\n return lang.stringRepeat(\" \", n);\n }\n\n function alignLeft(m) {\n return !m[2] ? m[0] : spaces(startW) + m[2]\n + spaces(textW - m[2].length + endW)\n + m[4].replace(/^([=:])\\s+/, \"$1 \");\n }\n function alignRight(m) {\n return !m[2] ? m[0] : spaces(startW + textW - m[2].length) + m[2]\n + spaces(endW, \" \")\n + m[4].replace(/^([=:])\\s+/, \"$1 \");\n }\n function unAlign(m) {\n return !m[2] ? m[0] : spaces(startW) + m[2]\n + spaces(endW)\n + m[4].replace(/^([=:])\\s+/, \"$1 \");\n }\n };\n}).call(Editor.prototype);\n\n\nfunction isSamePoint(p1, p2) {\n return p1.row == p2.row && p1.column == p2.column;\n}\nexports.onSessionChange = function(e) {\n var session = e.session;\n if (session && !session.multiSelect) {\n session.$selectionMarkers = [];\n session.selection.$initRangeList();\n session.multiSelect = session.selection;\n }\n this.multiSelect = session && session.multiSelect;\n\n var oldSession = e.oldSession;\n if (oldSession) {\n oldSession.multiSelect.off(\"addRange\", this.$onAddRange);\n oldSession.multiSelect.off(\"removeRange\", this.$onRemoveRange);\n oldSession.multiSelect.off(\"multiSelect\", this.$onMultiSelect);\n oldSession.multiSelect.off(\"singleSelect\", this.$onSingleSelect);\n oldSession.multiSelect.lead.off(\"change\", this.$checkMultiselectChange);\n oldSession.multiSelect.anchor.off(\"change\", this.$checkMultiselectChange);\n }\n\n if (session) {\n session.multiSelect.on(\"addRange\", this.$onAddRange);\n session.multiSelect.on(\"removeRange\", this.$onRemoveRange);\n session.multiSelect.on(\"multiSelect\", this.$onMultiSelect);\n session.multiSelect.on(\"singleSelect\", this.$onSingleSelect);\n session.multiSelect.lead.on(\"change\", this.$checkMultiselectChange);\n session.multiSelect.anchor.on(\"change\", this.$checkMultiselectChange);\n }\n\n if (session && this.inMultiSelectMode != session.selection.inMultiSelectMode) {\n if (session.selection.inMultiSelectMode)\n this.$onMultiSelect();\n else\n this.$onSingleSelect();\n }\n};\nfunction MultiSelect(editor) {\n if (editor.$multiselectOnSessionChange)\n return;\n editor.$onAddRange = editor.$onAddRange.bind(editor);\n editor.$onRemoveRange = editor.$onRemoveRange.bind(editor);\n editor.$onMultiSelect = editor.$onMultiSelect.bind(editor);\n editor.$onSingleSelect = editor.$onSingleSelect.bind(editor);\n editor.$multiselectOnSessionChange = exports.onSessionChange.bind(editor);\n editor.$checkMultiselectChange = editor.$checkMultiselectChange.bind(editor);\n\n editor.$multiselectOnSessionChange(editor);\n editor.on(\"changeSession\", editor.$multiselectOnSessionChange);\n\n editor.on(\"mousedown\", onMouseDown);\n editor.commands.addCommands(commands.defaultCommands);\n\n addAltCursorListeners(editor);\n}\n\nfunction addAltCursorListeners(editor){\n var el = editor.textInput.getElement();\n var altCursor = false;\n event.addListener(el, \"keydown\", function(e) {\n var altDown = e.keyCode == 18 && !(e.ctrlKey || e.shiftKey || e.metaKey);\n if (editor.$blockSelectEnabled && altDown) {\n if (!altCursor) {\n editor.renderer.setMouseCursor(\"crosshair\");\n altCursor = true;\n }\n } else if (altCursor) {\n reset();\n }\n });\n\n event.addListener(el, \"keyup\", reset);\n event.addListener(el, \"blur\", reset);\n function reset(e) {\n if (altCursor) {\n editor.renderer.setMouseCursor(\"\");\n altCursor = false;\n }\n }\n}\n\nexports.MultiSelect = MultiSelect;\n\n\nacequire(\"./config\").defineOptions(Editor.prototype, \"editor\", {\n enableMultiselect: {\n set: function(val) {\n MultiSelect(this);\n if (val) {\n this.on(\"changeSession\", this.$multiselectOnSessionChange);\n this.on(\"mousedown\", onMouseDown);\n } else {\n this.off(\"changeSession\", this.$multiselectOnSessionChange);\n this.off(\"mousedown\", onMouseDown);\n }\n },\n value: true\n },\n enableBlockSelect: {\n set: function(val) {\n this.$blockSelectEnabled = val;\n },\n value: true\n }\n});\n\n\n\n});\n\nace.define(\"ace/mode/folding/fold_mode\",[\"require\",\"exports\",\"module\",\"ace/range\"], function(acequire, exports, module) {\n\"use strict\";\n\nvar Range = acequire(\"../../range\").Range;\n\nvar FoldMode = exports.FoldMode = function() {};\n\n(function() {\n\n this.foldingStartMarker = null;\n this.foldingStopMarker = null;\n this.getFoldWidget = function(session, foldStyle, row) {\n var line = session.getLine(row);\n if (this.foldingStartMarker.test(line))\n return \"start\";\n if (foldStyle == \"markbeginend\"\n && this.foldingStopMarker\n && this.foldingStopMarker.test(line))\n return \"end\";\n return \"\";\n };\n\n this.getFoldWidgetRange = function(session, foldStyle, row) {\n return null;\n };\n\n this.indentationBlock = function(session, row, column) {\n var re = /\\S/;\n var line = session.getLine(row);\n var startLevel = line.search(re);\n if (startLevel == -1)\n return;\n\n var startColumn = column || line.length;\n var maxRow = session.getLength();\n var startRow = row;\n var endRow = row;\n\n while (++row < maxRow) {\n var level = session.getLine(row).search(re);\n\n if (level == -1)\n continue;\n\n if (level <= startLevel)\n break;\n\n endRow = row;\n }\n\n if (endRow > startRow) {\n var endColumn = session.getLine(endRow).length;\n return new Range(startRow, startColumn, endRow, endColumn);\n }\n };\n\n this.openingBracketBlock = function(session, bracket, row, column, typeRe) {\n var start = {row: row, column: column + 1};\n var end = session.$findClosingBracket(bracket, start, typeRe);\n if (!end)\n return;\n\n var fw = session.foldWidgets[end.row];\n if (fw == null)\n fw = session.getFoldWidget(end.row);\n\n if (fw == \"start\" && end.row > start.row) {\n end.row --;\n end.column = session.getLine(end.row).length;\n }\n return Range.fromPoints(start, end);\n };\n\n this.closingBracketBlock = function(session, bracket, row, column, typeRe) {\n var end = {row: row, column: column};\n var start = session.$findOpeningBracket(bracket, end);\n\n if (!start)\n return;\n\n start.column++;\n end.column--;\n\n return Range.fromPoints(start, end);\n };\n}).call(FoldMode.prototype);\n\n});\n\nace.define(\"ace/theme/textmate\",[\"require\",\"exports\",\"module\",\"ace/lib/dom\"], function(acequire, exports, module) {\n\"use strict\";\n\nexports.isDark = false;\nexports.cssClass = \"ace-tm\";\nexports.cssText = \".ace-tm .ace_gutter {\\\nbackground: #f0f0f0;\\\ncolor: #333;\\\n}\\\n.ace-tm .ace_print-margin {\\\nwidth: 1px;\\\nbackground: #e8e8e8;\\\n}\\\n.ace-tm .ace_fold {\\\nbackground-color: #6B72E6;\\\n}\\\n.ace-tm {\\\nbackground-color: #FFFFFF;\\\ncolor: black;\\\n}\\\n.ace-tm .ace_cursor {\\\ncolor: black;\\\n}\\\n.ace-tm .ace_invisible {\\\ncolor: rgb(191, 191, 191);\\\n}\\\n.ace-tm .ace_storage,\\\n.ace-tm .ace_keyword {\\\ncolor: blue;\\\n}\\\n.ace-tm .ace_constant {\\\ncolor: rgb(197, 6, 11);\\\n}\\\n.ace-tm .ace_constant.ace_buildin {\\\ncolor: rgb(88, 72, 246);\\\n}\\\n.ace-tm .ace_constant.ace_language {\\\ncolor: rgb(88, 92, 246);\\\n}\\\n.ace-tm .ace_constant.ace_library {\\\ncolor: rgb(6, 150, 14);\\\n}\\\n.ace-tm .ace_invalid {\\\nbackground-color: rgba(255, 0, 0, 0.1);\\\ncolor: red;\\\n}\\\n.ace-tm .ace_support.ace_function {\\\ncolor: rgb(60, 76, 114);\\\n}\\\n.ace-tm .ace_support.ace_constant {\\\ncolor: rgb(6, 150, 14);\\\n}\\\n.ace-tm .ace_support.ace_type,\\\n.ace-tm .ace_support.ace_class {\\\ncolor: rgb(109, 121, 222);\\\n}\\\n.ace-tm .ace_keyword.ace_operator {\\\ncolor: rgb(104, 118, 135);\\\n}\\\n.ace-tm .ace_string {\\\ncolor: rgb(3, 106, 7);\\\n}\\\n.ace-tm .ace_comment {\\\ncolor: rgb(76, 136, 107);\\\n}\\\n.ace-tm .ace_comment.ace_doc {\\\ncolor: rgb(0, 102, 255);\\\n}\\\n.ace-tm .ace_comment.ace_doc.ace_tag {\\\ncolor: rgb(128, 159, 191);\\\n}\\\n.ace-tm .ace_constant.ace_numeric {\\\ncolor: rgb(0, 0, 205);\\\n}\\\n.ace-tm .ace_variable {\\\ncolor: rgb(49, 132, 149);\\\n}\\\n.ace-tm .ace_xml-pe {\\\ncolor: rgb(104, 104, 91);\\\n}\\\n.ace-tm .ace_entity.ace_name.ace_function {\\\ncolor: #0000A2;\\\n}\\\n.ace-tm .ace_heading {\\\ncolor: rgb(12, 7, 255);\\\n}\\\n.ace-tm .ace_list {\\\ncolor:rgb(185, 6, 144);\\\n}\\\n.ace-tm .ace_meta.ace_tag {\\\ncolor:rgb(0, 22, 142);\\\n}\\\n.ace-tm .ace_string.ace_regex {\\\ncolor: rgb(255, 0, 0)\\\n}\\\n.ace-tm .ace_marker-layer .ace_selection {\\\nbackground: rgb(181, 213, 255);\\\n}\\\n.ace-tm.ace_multiselect .ace_selection.ace_start {\\\nbox-shadow: 0 0 3px 0px white;\\\n}\\\n.ace-tm .ace_marker-layer .ace_step {\\\nbackground: rgb(252, 255, 0);\\\n}\\\n.ace-tm .ace_marker-layer .ace_stack {\\\nbackground: rgb(164, 229, 101);\\\n}\\\n.ace-tm .ace_marker-layer .ace_bracket {\\\nmargin: -1px 0 0 -1px;\\\nborder: 1px solid rgb(192, 192, 192);\\\n}\\\n.ace-tm .ace_marker-layer .ace_active-line {\\\nbackground: rgba(0, 0, 0, 0.07);\\\n}\\\n.ace-tm .ace_gutter-active-line {\\\nbackground-color : #dcdcdc;\\\n}\\\n.ace-tm .ace_marker-layer .ace_selected-word {\\\nbackground: rgb(250, 250, 255);\\\nborder: 1px solid rgb(200, 200, 250);\\\n}\\\n.ace-tm .ace_indent-guide {\\\nbackground: url(\\\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAE0lEQVQImWP4////f4bLly//BwAmVgd1/w11/gAAAABJRU5ErkJggg==\\\") right repeat-y;\\\n}\\\n\";\n\nvar dom = acequire(\"../lib/dom\");\ndom.importCssString(exports.cssText, exports.cssClass);\n});\n\nace.define(\"ace/line_widgets\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/dom\",\"ace/range\"], function(acequire, exports, module) {\n\"use strict\";\n\nvar oop = acequire(\"./lib/oop\");\nvar dom = acequire(\"./lib/dom\");\nvar Range = acequire(\"./range\").Range;\n\n\nfunction LineWidgets(session) {\n this.session = session;\n this.session.widgetManager = this;\n this.session.getRowLength = this.getRowLength;\n this.session.$getWidgetScreenLength = this.$getWidgetScreenLength;\n this.updateOnChange = this.updateOnChange.bind(this);\n this.renderWidgets = this.renderWidgets.bind(this);\n this.measureWidgets = this.measureWidgets.bind(this);\n this.session._changedWidgets = [];\n this.$onChangeEditor = this.$onChangeEditor.bind(this);\n \n this.session.on(\"change\", this.updateOnChange);\n this.session.on(\"changeFold\", this.updateOnFold);\n this.session.on(\"changeEditor\", this.$onChangeEditor);\n}\n\n(function() {\n this.getRowLength = function(row) {\n var h;\n if (this.lineWidgets)\n h = this.lineWidgets[row] && this.lineWidgets[row].rowCount || 0;\n else \n h = 0;\n if (!this.$useWrapMode || !this.$wrapData[row]) {\n return 1 + h;\n } else {\n return this.$wrapData[row].length + 1 + h;\n }\n };\n\n this.$getWidgetScreenLength = function() {\n var screenRows = 0;\n this.lineWidgets.forEach(function(w){\n if (w && w.rowCount && !w.hidden)\n screenRows += w.rowCount;\n });\n return screenRows;\n }; \n \n this.$onChangeEditor = function(e) {\n this.attach(e.editor);\n };\n \n this.attach = function(editor) {\n if (editor && editor.widgetManager && editor.widgetManager != this)\n editor.widgetManager.detach();\n\n if (this.editor == editor)\n return;\n\n this.detach();\n this.editor = editor;\n \n if (editor) {\n editor.widgetManager = this;\n editor.renderer.on(\"beforeRender\", this.measureWidgets);\n editor.renderer.on(\"afterRender\", this.renderWidgets);\n }\n };\n this.detach = function(e) {\n var editor = this.editor;\n if (!editor)\n return;\n \n this.editor = null;\n editor.widgetManager = null;\n \n editor.renderer.off(\"beforeRender\", this.measureWidgets);\n editor.renderer.off(\"afterRender\", this.renderWidgets);\n var lineWidgets = this.session.lineWidgets;\n lineWidgets && lineWidgets.forEach(function(w) {\n if (w && w.el && w.el.parentNode) {\n w._inDocument = false;\n w.el.parentNode.removeChild(w.el);\n }\n });\n };\n\n this.updateOnFold = function(e, session) {\n var lineWidgets = session.lineWidgets;\n if (!lineWidgets || !e.action)\n return;\n var fold = e.data;\n var start = fold.start.row;\n var end = fold.end.row;\n var hide = e.action == \"add\";\n for (var i = start + 1; i < end; i++) {\n if (lineWidgets[i])\n lineWidgets[i].hidden = hide;\n }\n if (lineWidgets[end]) {\n if (hide) {\n if (!lineWidgets[start])\n lineWidgets[start] = lineWidgets[end];\n else\n lineWidgets[end].hidden = hide;\n } else {\n if (lineWidgets[start] == lineWidgets[end])\n lineWidgets[start] = undefined;\n lineWidgets[end].hidden = hide;\n }\n }\n };\n \n this.updateOnChange = function(delta) {\n var lineWidgets = this.session.lineWidgets;\n if (!lineWidgets) return;\n \n var startRow = delta.start.row;\n var len = delta.end.row - startRow;\n\n if (len === 0) {\n } else if (delta.action == 'remove') {\n var removed = lineWidgets.splice(startRow + 1, len);\n removed.forEach(function(w) {\n w && this.removeLineWidget(w);\n }, this);\n this.$updateRows();\n } else {\n var args = new Array(len);\n args.unshift(startRow, 0);\n lineWidgets.splice.apply(lineWidgets, args);\n this.$updateRows();\n }\n };\n \n this.$updateRows = function() {\n var lineWidgets = this.session.lineWidgets;\n if (!lineWidgets) return;\n var noWidgets = true;\n lineWidgets.forEach(function(w, i) {\n if (w) {\n noWidgets = false;\n w.row = i;\n while (w.$oldWidget) {\n w.$oldWidget.row = i;\n w = w.$oldWidget;\n }\n }\n });\n if (noWidgets)\n this.session.lineWidgets = null;\n };\n\n this.addLineWidget = function(w) {\n if (!this.session.lineWidgets)\n this.session.lineWidgets = new Array(this.session.getLength());\n \n var old = this.session.lineWidgets[w.row];\n if (old) {\n w.$oldWidget = old;\n if (old.el && old.el.parentNode) {\n old.el.parentNode.removeChild(old.el);\n old._inDocument = false;\n }\n }\n \n this.session.lineWidgets[w.row] = w;\n \n w.session = this.session;\n \n var renderer = this.editor.renderer;\n if (w.html && !w.el) {\n w.el = dom.createElement(\"div\");\n w.el.innerHTML = w.html;\n }\n if (w.el) {\n dom.addCssClass(w.el, \"ace_lineWidgetContainer\");\n w.el.style.position = \"absolute\";\n w.el.style.zIndex = 5;\n renderer.container.appendChild(w.el);\n w._inDocument = true;\n }\n \n if (!w.coverGutter) {\n w.el.style.zIndex = 3;\n }\n if (w.pixelHeight == null) {\n w.pixelHeight = w.el.offsetHeight;\n }\n if (w.rowCount == null) {\n w.rowCount = w.pixelHeight / renderer.layerConfig.lineHeight;\n }\n \n var fold = this.session.getFoldAt(w.row, 0);\n w.$fold = fold;\n if (fold) {\n var lineWidgets = this.session.lineWidgets;\n if (w.row == fold.end.row && !lineWidgets[fold.start.row])\n lineWidgets[fold.start.row] = w;\n else\n w.hidden = true;\n }\n \n this.session._emit(\"changeFold\", {data:{start:{row: w.row}}});\n \n this.$updateRows();\n this.renderWidgets(null, renderer);\n this.onWidgetChanged(w);\n return w;\n };\n \n this.removeLineWidget = function(w) {\n w._inDocument = false;\n w.session = null;\n if (w.el && w.el.parentNode)\n w.el.parentNode.removeChild(w.el);\n if (w.editor && w.editor.destroy) try {\n w.editor.destroy();\n } catch(e){}\n if (this.session.lineWidgets) {\n var w1 = this.session.lineWidgets[w.row];\n if (w1 == w) {\n this.session.lineWidgets[w.row] = w.$oldWidget;\n if (w.$oldWidget)\n this.onWidgetChanged(w.$oldWidget);\n } else {\n while (w1) {\n if (w1.$oldWidget == w) {\n w1.$oldWidget = w.$oldWidget;\n break;\n }\n w1 = w1.$oldWidget;\n }\n }\n }\n this.session._emit(\"changeFold\", {data:{start:{row: w.row}}});\n this.$updateRows();\n };\n \n this.getWidgetsAtRow = function(row) {\n var lineWidgets = this.session.lineWidgets;\n var w = lineWidgets && lineWidgets[row];\n var list = [];\n while (w) {\n list.push(w);\n w = w.$oldWidget;\n }\n return list;\n };\n \n this.onWidgetChanged = function(w) {\n this.session._changedWidgets.push(w);\n this.editor && this.editor.renderer.updateFull();\n };\n \n this.measureWidgets = function(e, renderer) {\n var changedWidgets = this.session._changedWidgets;\n var config = renderer.layerConfig;\n \n if (!changedWidgets || !changedWidgets.length) return;\n var min = Infinity;\n for (var i = 0; i < changedWidgets.length; i++) {\n var w = changedWidgets[i];\n if (!w || !w.el) continue;\n if (w.session != this.session) continue;\n if (!w._inDocument) {\n if (this.session.lineWidgets[w.row] != w)\n continue;\n w._inDocument = true;\n renderer.container.appendChild(w.el);\n }\n \n w.h = w.el.offsetHeight;\n \n if (!w.fixedWidth) {\n w.w = w.el.offsetWidth;\n w.screenWidth = Math.ceil(w.w / config.characterWidth);\n }\n \n var rowCount = w.h / config.lineHeight;\n if (w.coverLine) {\n rowCount -= this.session.getRowLineCount(w.row);\n if (rowCount < 0)\n rowCount = 0;\n }\n if (w.rowCount != rowCount) {\n w.rowCount = rowCount;\n if (w.row < min)\n min = w.row;\n }\n }\n if (min != Infinity) {\n this.session._emit(\"changeFold\", {data:{start:{row: min}}});\n this.session.lineWidgetWidth = null;\n }\n this.session._changedWidgets = [];\n };\n \n this.renderWidgets = function(e, renderer) {\n var config = renderer.layerConfig;\n var lineWidgets = this.session.lineWidgets;\n if (!lineWidgets)\n return;\n var first = Math.min(this.firstRow, config.firstRow);\n var last = Math.max(this.lastRow, config.lastRow, lineWidgets.length);\n \n while (first > 0 && !lineWidgets[first])\n first--;\n \n this.firstRow = config.firstRow;\n this.lastRow = config.lastRow;\n\n renderer.$cursorLayer.config = config;\n for (var i = first; i <= last; i++) {\n var w = lineWidgets[i];\n if (!w || !w.el) continue;\n if (w.hidden) {\n w.el.style.top = -100 - (w.pixelHeight || 0) + \"px\";\n continue;\n }\n if (!w._inDocument) {\n w._inDocument = true;\n renderer.container.appendChild(w.el);\n }\n var top = renderer.$cursorLayer.getPixelPosition({row: i, column:0}, true).top;\n if (!w.coverLine)\n top += config.lineHeight * this.session.getRowLineCount(w.row);\n w.el.style.top = top - config.offset + \"px\";\n \n var left = w.coverGutter ? 0 : renderer.gutterWidth;\n if (!w.fixedWidth)\n left -= renderer.scrollLeft;\n w.el.style.left = left + \"px\";\n \n if (w.fullWidth && w.screenWidth) {\n w.el.style.minWidth = config.width + 2 * config.padding + \"px\";\n }\n \n if (w.fixedWidth) {\n w.el.style.right = renderer.scrollBar.getWidth() + \"px\";\n } else {\n w.el.style.right = \"\";\n }\n }\n };\n \n}).call(LineWidgets.prototype);\n\n\nexports.LineWidgets = LineWidgets;\n\n});\n\nace.define(\"ace/ext/error_marker\",[\"require\",\"exports\",\"module\",\"ace/line_widgets\",\"ace/lib/dom\",\"ace/range\"], function(acequire, exports, module) {\n\"use strict\";\nvar LineWidgets = acequire(\"../line_widgets\").LineWidgets;\nvar dom = acequire(\"../lib/dom\");\nvar Range = acequire(\"../range\").Range;\n\nfunction binarySearch(array, needle, comparator) {\n var first = 0;\n var last = array.length - 1;\n\n while (first <= last) {\n var mid = (first + last) >> 1;\n var c = comparator(needle, array[mid]);\n if (c > 0)\n first = mid + 1;\n else if (c < 0)\n last = mid - 1;\n else\n return mid;\n }\n return -(first + 1);\n}\n\nfunction findAnnotations(session, row, dir) {\n var annotations = session.getAnnotations().sort(Range.comparePoints);\n if (!annotations.length)\n return;\n \n var i = binarySearch(annotations, {row: row, column: -1}, Range.comparePoints);\n if (i < 0)\n i = -i - 1;\n \n if (i >= annotations.length)\n i = dir > 0 ? 0 : annotations.length - 1;\n else if (i === 0 && dir < 0)\n i = annotations.length - 1;\n \n var annotation = annotations[i];\n if (!annotation || !dir)\n return;\n\n if (annotation.row === row) {\n do {\n annotation = annotations[i += dir];\n } while (annotation && annotation.row === row);\n if (!annotation)\n return annotations.slice();\n }\n \n \n var matched = [];\n row = annotation.row;\n do {\n matched[dir < 0 ? \"unshift\" : \"push\"](annotation);\n annotation = annotations[i += dir];\n } while (annotation && annotation.row == row);\n return matched.length && matched;\n}\n\nexports.showErrorMarker = function(editor, dir) {\n var session = editor.session;\n if (!session.widgetManager) {\n session.widgetManager = new LineWidgets(session);\n session.widgetManager.attach(editor);\n }\n \n var pos = editor.getCursorPosition();\n var row = pos.row;\n var oldWidget = session.widgetManager.getWidgetsAtRow(row).filter(function(w) {\n return w.type == \"errorMarker\";\n })[0];\n if (oldWidget) {\n oldWidget.destroy();\n } else {\n row -= dir;\n }\n var annotations = findAnnotations(session, row, dir);\n var gutterAnno;\n if (annotations) {\n var annotation = annotations[0];\n pos.column = (annotation.pos && typeof annotation.column != \"number\"\n ? annotation.pos.sc\n : annotation.column) || 0;\n pos.row = annotation.row;\n gutterAnno = editor.renderer.$gutterLayer.$annotations[pos.row];\n } else if (oldWidget) {\n return;\n } else {\n gutterAnno = {\n text: [\"Looks good!\"],\n className: \"ace_ok\"\n };\n }\n editor.session.unfold(pos.row);\n editor.selection.moveToPosition(pos);\n \n var w = {\n row: pos.row, \n fixedWidth: true,\n coverGutter: true,\n el: dom.createElement(\"div\"),\n type: \"errorMarker\"\n };\n var el = w.el.appendChild(dom.createElement(\"div\"));\n var arrow = w.el.appendChild(dom.createElement(\"div\"));\n arrow.className = \"error_widget_arrow \" + gutterAnno.className;\n \n var left = editor.renderer.$cursorLayer\n .getPixelPosition(pos).left;\n arrow.style.left = left + editor.renderer.gutterWidth - 5 + \"px\";\n \n w.el.className = \"error_widget_wrapper\";\n el.className = \"error_widget \" + gutterAnno.className;\n el.innerHTML = gutterAnno.text.join(\"<br>\");\n \n el.appendChild(dom.createElement(\"div\"));\n \n var kb = function(_, hashId, keyString) {\n if (hashId === 0 && (keyString === \"esc\" || keyString === \"return\")) {\n w.destroy();\n return {command: \"null\"};\n }\n };\n \n w.destroy = function() {\n if (editor.$mouseHandler.isMousePressed)\n return;\n editor.keyBinding.removeKeyboardHandler(kb);\n session.widgetManager.removeLineWidget(w);\n editor.off(\"changeSelection\", w.destroy);\n editor.off(\"changeSession\", w.destroy);\n editor.off(\"mouseup\", w.destroy);\n editor.off(\"change\", w.destroy);\n };\n \n editor.keyBinding.addKeyboardHandler(kb);\n editor.on(\"changeSelection\", w.destroy);\n editor.on(\"changeSession\", w.destroy);\n editor.on(\"mouseup\", w.destroy);\n editor.on(\"change\", w.destroy);\n \n editor.session.widgetManager.addLineWidget(w);\n \n w.el.onmousedown = editor.focus.bind(editor);\n \n editor.renderer.scrollCursorIntoView(null, 0.5, {bottom: w.el.offsetHeight});\n};\n\n\ndom.importCssString(\"\\\n .error_widget_wrapper {\\\n background: inherit;\\\n color: inherit;\\\n border:none\\\n }\\\n .error_widget {\\\n border-top: solid 2px;\\\n border-bottom: solid 2px;\\\n margin: 5px 0;\\\n padding: 10px 40px;\\\n white-space: pre-wrap;\\\n }\\\n .error_widget.ace_error, .error_widget_arrow.ace_error{\\\n border-color: #ff5a5a\\\n }\\\n .error_widget.ace_warning, .error_widget_arrow.ace_warning{\\\n border-color: #F1D817\\\n }\\\n .error_widget.ace_info, .error_widget_arrow.ace_info{\\\n border-color: #5a5a5a\\\n }\\\n .error_widget.ace_ok, .error_widget_arrow.ace_ok{\\\n border-color: #5aaa5a\\\n }\\\n .error_widget_arrow {\\\n position: absolute;\\\n border: solid 5px;\\\n border-top-color: transparent!important;\\\n border-right-color: transparent!important;\\\n border-left-color: transparent!important;\\\n top: -5px;\\\n }\\\n\", \"\");\n\n});\n\nace.define(\"ace/ace\",[\"require\",\"exports\",\"module\",\"ace/lib/fixoldbrowsers\",\"ace/lib/dom\",\"ace/lib/event\",\"ace/editor\",\"ace/edit_session\",\"ace/undomanager\",\"ace/virtual_renderer\",\"ace/worker/worker_client\",\"ace/keyboard/hash_handler\",\"ace/placeholder\",\"ace/multi_select\",\"ace/mode/folding/fold_mode\",\"ace/theme/textmate\",\"ace/ext/error_marker\",\"ace/config\"], function(acequire, exports, module) {\n\"use strict\";\n\nacequire(\"./lib/fixoldbrowsers\");\n\nvar dom = acequire(\"./lib/dom\");\nvar event = acequire(\"./lib/event\");\n\nvar Editor = acequire(\"./editor\").Editor;\nvar EditSession = acequire(\"./edit_session\").EditSession;\nvar UndoManager = acequire(\"./undomanager\").UndoManager;\nvar Renderer = acequire(\"./virtual_renderer\").VirtualRenderer;\nacequire(\"./worker/worker_client\");\nacequire(\"./keyboard/hash_handler\");\nacequire(\"./placeholder\");\nacequire(\"./multi_select\");\nacequire(\"./mode/folding/fold_mode\");\nacequire(\"./theme/textmate\");\nacequire(\"./ext/error_marker\");\n\nexports.config = acequire(\"./config\");\nexports.acequire = acequire;\n\nif (typeof define === \"function\")\n exports.define = define;\nexports.edit = function(el) {\n if (typeof el == \"string\") {\n var _id = el;\n el = document.getElementById(_id);\n if (!el)\n throw new Error(\"ace.edit can't find div #\" + _id);\n }\n\n if (el && el.env && el.env.editor instanceof Editor)\n return el.env.editor;\n\n var value = \"\";\n if (el && /input|textarea/i.test(el.tagName)) {\n var oldNode = el;\n value = oldNode.value;\n el = dom.createElement(\"pre\");\n oldNode.parentNode.replaceChild(el, oldNode);\n } else if (el) {\n value = dom.getInnerText(el);\n el.innerHTML = \"\";\n }\n\n var doc = exports.createEditSession(value);\n\n var editor = new Editor(new Renderer(el));\n editor.setSession(doc);\n\n var env = {\n document: doc,\n editor: editor,\n onResize: editor.resize.bind(editor, null)\n };\n if (oldNode) env.textarea = oldNode;\n event.addListener(window, \"resize\", env.onResize);\n editor.on(\"destroy\", function() {\n event.removeListener(window, \"resize\", env.onResize);\n env.editor.container.env = null; // prevent memory leak on old ie\n });\n editor.container.env = editor.env = env;\n return editor;\n};\nexports.createEditSession = function(text, mode) {\n var doc = new EditSession(text, mode);\n doc.setUndoManager(new UndoManager());\n return doc;\n};\nexports.EditSession = EditSession;\nexports.UndoManager = UndoManager;\nexports.version = \"1.2.9\";\n});\n (function() {\n ace.acequire([\"ace/ace\"], function(a) {\n if (a) {\n a.config.init(true);\n a.define = ace.define;\n }\n if (!window.ace)\n window.ace = a;\n for (var key in a) if (a.hasOwnProperty(key))\n window.ace[key] = a[key];\n });\n })();\n \nmodule.exports = window.ace.acequire(\"ace/ace\");","/**\n * jsBezier\n *\n * Copyright (c) 2010 - 2017 jsPlumb (hello@jsplumbtoolkit.com)\n *\n * licensed under the MIT license.\n *\n * a set of Bezier curve functions that deal with Beziers, used by jsPlumb, and perhaps useful for other people. These functions work with Bezier\n * curves of arbitrary degree.\n *\n * - functions are all in the 'jsBezier' namespace.\n *\n * - all input points should be in the format {x:.., y:..}. all output points are in this format too.\n *\n * - all input curves should be in the format [ {x:.., y:..}, {x:.., y:..}, {x:.., y:..}, {x:.., y:..} ]\n *\n * - 'location' as used as an input here refers to a decimal in the range 0-1 inclusive, which indicates a point some proportion along the length\n * of the curve. location as output has the same format and meaning.\n *\n *\n * Function List:\n * --------------\n *\n * distanceFromCurve(point, curve)\n *\n * \tCalculates the distance that the given point lies from the given Bezier. Note that it is computed relative to the center of the Bezier,\n * so if you have stroked the curve with a wide pen you may wish to take that into account! The distance returned is relative to the values\n * of the curve and the point - it will most likely be pixels.\n *\n * gradientAtPoint(curve, location)\n *\n * \tCalculates the gradient to the curve at the given location, as a decimal between 0 and 1 inclusive.\n *\n * gradientAtPointAlongCurveFrom (curve, location)\n *\n *\tCalculates the gradient at the point on the given curve that is 'distance' units from location.\n *\n * nearestPointOnCurve(point, curve)\n *\n *\tCalculates the nearest point to the given point on the given curve. The return value of this is a JS object literal, containing both the\n *point's coordinates and also the 'location' of the point (see above), for example: { point:{x:551,y:150}, location:0.263365 }.\n *\n * pointOnCurve(curve, location)\n *\n * \tCalculates the coordinates of the point on the given Bezier curve at the given location.\n *\n * pointAlongCurveFrom(curve, location, distance)\n *\n * \tCalculates the coordinates of the point on the given curve that is 'distance' units from location. 'distance' should be in the same coordinate\n * space as that used to construct the Bezier curve. For an HTML Canvas usage, for example, distance would be a measure of pixels.\n *\n * locationAlongCurveFrom(curve, location, distance)\n *\n * \tCalculates the location on the given curve that is 'distance' units from location. 'distance' should be in the same coordinate\n * space as that used to construct the Bezier curve. For an HTML Canvas usage, for example, distance would be a measure of pixels.\n *\n * perpendicularToCurveAt(curve, location, length, distance)\n *\n * \tCalculates the perpendicular to the given curve at the given location. length is the length of the line you wish for (it will be centered\n * on the point at 'location'). distance is optional, and allows you to specify a point along the path from the given location as the center of\n * the perpendicular returned. The return value of this is an array of two points: [ {x:...,y:...}, {x:...,y:...} ].\n *\n *\n */\n\n(function() {\n\n var root = this;\n\n if(typeof Math.sgn == \"undefined\") {\n Math.sgn = function(x) { return x == 0 ? 0 : x > 0 ? 1 :-1; };\n }\n\n var Vectors = {\n subtract \t: \tfunction(v1, v2) { return {x:v1.x - v2.x, y:v1.y - v2.y }; },\n dotProduct\t: \tfunction(v1, v2) { return (v1.x * v2.x) + (v1.y * v2.y); },\n square\t\t:\tfunction(v) { return Math.sqrt((v.x * v.x) + (v.y * v.y)); },\n scale\t\t:\tfunction(v, s) { return {x:v.x * s, y:v.y * s }; }\n },\n\n maxRecursion = 64,\n flatnessTolerance = Math.pow(2.0,-maxRecursion-1);\n\n /**\n * Calculates the distance that the point lies from the curve.\n *\n * @param point a point in the form {x:567, y:3342}\n * @param curve a Bezier curve in the form [{x:..., y:...}, {x:..., y:...}, {x:..., y:...}, {x:..., y:...}]. note that this is currently\n * hardcoded to assume cubiz beziers, but would be better off supporting any degree.\n * @return a JS object literal containing location and distance, for example: {location:0.35, distance:10}. Location is analogous to the location\n * argument you pass to the pointOnPath function: it is a ratio of distance travelled along the curve. Distance is the distance in pixels from\n * the point to the curve.\n */\n var _distanceFromCurve = function(point, curve) {\n var candidates = [],\n w = _convertToBezier(point, curve),\n degree = curve.length - 1, higherDegree = (2 * degree) - 1,\n numSolutions = _findRoots(w, higherDegree, candidates, 0),\n v = Vectors.subtract(point, curve[0]), dist = Vectors.square(v), t = 0.0;\n\n for (var i = 0; i < numSolutions; i++) {\n v = Vectors.subtract(point, _bezier(curve, degree, candidates[i], null, null));\n var newDist = Vectors.square(v);\n if (newDist < dist) {\n dist = newDist;\n t = candidates[i];\n }\n }\n v = Vectors.subtract(point, curve[degree]);\n newDist = Vectors.square(v);\n if (newDist < dist) {\n dist = newDist;\n t = 1.0;\n }\n return {location:t, distance:dist};\n };\n /**\n * finds the nearest point on the curve to the given point.\n */\n var _nearestPointOnCurve = function(point, curve) {\n var td = _distanceFromCurve(point, curve);\n return {point:_bezier(curve, curve.length - 1, td.location, null, null), location:td.location};\n };\n var _convertToBezier = function(point, curve) {\n var degree = curve.length - 1, higherDegree = (2 * degree) - 1,\n c = [], d = [], cdTable = [], w = [],\n z = [ [1.0, 0.6, 0.3, 0.1], [0.4, 0.6, 0.6, 0.4], [0.1, 0.3, 0.6, 1.0] ];\n\n for (var i = 0; i <= degree; i++) c[i] = Vectors.subtract(curve[i], point);\n for (var i = 0; i <= degree - 1; i++) {\n d[i] = Vectors.subtract(curve[i+1], curve[i]);\n d[i] = Vectors.scale(d[i], 3.0);\n }\n for (var row = 0; row <= degree - 1; row++) {\n for (var column = 0; column <= degree; column++) {\n if (!cdTable[row]) cdTable[row] = [];\n cdTable[row][column] = Vectors.dotProduct(d[row], c[column]);\n }\n }\n for (i = 0; i <= higherDegree; i++) {\n if (!w[i]) w[i] = [];\n w[i].y = 0.0;\n w[i].x = parseFloat(i) / higherDegree;\n }\n var n = degree, m = degree-1;\n for (var k = 0; k <= n + m; k++) {\n var lb = Math.max(0, k - m),\n ub = Math.min(k, n);\n for (i = lb; i <= ub; i++) {\n j = k - i;\n w[i+j].y += cdTable[j][i] * z[j][i];\n }\n }\n return w;\n };\n /**\n * counts how many roots there are.\n */\n var _findRoots = function(w, degree, t, depth) {\n var left = [], right = [],\n left_count, right_count,\n left_t = [], right_t = [];\n\n switch (_getCrossingCount(w, degree)) {\n case 0 : {\n return 0;\n }\n case 1 : {\n if (depth >= maxRecursion) {\n t[0] = (w[0].x + w[degree].x) / 2.0;\n return 1;\n }\n if (_isFlatEnough(w, degree)) {\n t[0] = _computeXIntercept(w, degree);\n return 1;\n }\n break;\n }\n }\n _bezier(w, degree, 0.5, left, right);\n left_count = _findRoots(left, degree, left_t, depth+1);\n right_count = _findRoots(right, degree, right_t, depth+1);\n for (var i = 0; i < left_count; i++) t[i] = left_t[i];\n for (var i = 0; i < right_count; i++) t[i+left_count] = right_t[i];\n return (left_count+right_count);\n };\n var _getCrossingCount = function(curve, degree) {\n var n_crossings = 0, sign, old_sign;\n sign = old_sign = Math.sgn(curve[0].y);\n for (var i = 1; i <= degree; i++) {\n sign = Math.sgn(curve[i].y);\n if (sign != old_sign) n_crossings++;\n old_sign = sign;\n }\n return n_crossings;\n };\n var _isFlatEnough = function(curve, degree) {\n var error,\n intercept_1, intercept_2, left_intercept, right_intercept,\n a, b, c, det, dInv, a1, b1, c1, a2, b2, c2;\n a = curve[0].y - curve[degree].y;\n b = curve[degree].x - curve[0].x;\n c = curve[0].x * curve[degree].y - curve[degree].x * curve[0].y;\n\n var max_distance_above = max_distance_below = 0.0;\n\n for (var i = 1; i < degree; i++) {\n var value = a * curve[i].x + b * curve[i].y + c;\n if (value > max_distance_above)\n max_distance_above = value;\n else if (value < max_distance_below)\n max_distance_below = value;\n }\n\n a1 = 0.0; b1 = 1.0; c1 = 0.0; a2 = a; b2 = b;\n c2 = c - max_distance_above;\n det = a1 * b2 - a2 * b1;\n dInv = 1.0/det;\n intercept_1 = (b1 * c2 - b2 * c1) * dInv;\n a2 = a; b2 = b; c2 = c - max_distance_below;\n det = a1 * b2 - a2 * b1;\n dInv = 1.0/det;\n intercept_2 = (b1 * c2 - b2 * c1) * dInv;\n left_intercept = Math.min(intercept_1, intercept_2);\n right_intercept = Math.max(intercept_1, intercept_2);\n error = right_intercept - left_intercept;\n return (error < flatnessTolerance)? 1 : 0;\n };\n var _computeXIntercept = function(curve, degree) {\n var XLK = 1.0, YLK = 0.0,\n XNM = curve[degree].x - curve[0].x, YNM = curve[degree].y - curve[0].y,\n XMK = curve[0].x - 0.0, YMK = curve[0].y - 0.0,\n det = XNM*YLK - YNM*XLK, detInv = 1.0/det,\n S = (XNM*YMK - YNM*XMK) * detInv;\n return 0.0 + XLK * S;\n };\n var _bezier = function(curve, degree, t, left, right) {\n var temp = [[]];\n for (var j =0; j <= degree; j++) temp[0][j] = curve[j];\n for (var i = 1; i <= degree; i++) {\n for (var j =0 ; j <= degree - i; j++) {\n if (!temp[i]) temp[i] = [];\n if (!temp[i][j]) temp[i][j] = {};\n temp[i][j].x = (1.0 - t) * temp[i-1][j].x + t * temp[i-1][j+1].x;\n temp[i][j].y = (1.0 - t) * temp[i-1][j].y + t * temp[i-1][j+1].y;\n }\n }\n if (left != null)\n for (j = 0; j <= degree; j++) left[j] = temp[j][0];\n if (right != null)\n for (j = 0; j <= degree; j++) right[j] = temp[degree-j][j];\n\n return (temp[degree][0]);\n };\n\n var _curveFunctionCache = {};\n var _getCurveFunctions = function(order) {\n var fns = _curveFunctionCache[order];\n if (!fns) {\n fns = [];\n var f_term = function() { return function(t) { return Math.pow(t, order); }; },\n l_term = function() { return function(t) { return Math.pow((1-t), order); }; },\n c_term = function(c) { return function(t) { return c; }; },\n t_term = function() { return function(t) { return t; }; },\n one_minus_t_term = function() { return function(t) { return 1-t; }; },\n _termFunc = function(terms) {\n return function(t) {\n var p = 1;\n for (var i = 0; i < terms.length; i++) p = p * terms[i](t);\n return p;\n };\n };\n\n fns.push(new f_term()); // first is t to the power of the curve order\n for (var i = 1; i < order; i++) {\n var terms = [new c_term(order)];\n for (var j = 0 ; j < (order - i); j++) terms.push(new t_term());\n for (var j = 0 ; j < i; j++) terms.push(new one_minus_t_term());\n fns.push(new _termFunc(terms));\n }\n fns.push(new l_term()); // last is (1-t) to the power of the curve order\n\n _curveFunctionCache[order] = fns;\n }\n\n return fns;\n };\n\n\n /**\n * calculates a point on the curve, for a Bezier of arbitrary order.\n * @param curve an array of control points, eg [{x:10,y:20}, {x:50,y:50}, {x:100,y:100}, {x:120,y:100}]. For a cubic bezier this should have four points.\n * @param location a decimal indicating the distance along the curve the point should be located at. this is the distance along the curve as it travels, taking the way it bends into account. should be a number from 0 to 1, inclusive.\n */\n var _pointOnPath = function(curve, location) {\n var cc = _getCurveFunctions(curve.length - 1),\n _x = 0, _y = 0;\n for (var i = 0; i < curve.length ; i++) {\n _x = _x + (curve[i].x * cc[i](location));\n _y = _y + (curve[i].y * cc[i](location));\n }\n\n return {x:_x, y:_y};\n };\n\n var _dist = function(p1,p2) {\n return Math.sqrt(Math.pow(p1.x - p2.x, 2) + Math.pow(p1.y - p2.y, 2));\n };\n\n var _isPoint = function(curve) {\n return curve[0].x == curve[1].x && curve[0].y == curve[1].y;\n };\n\n /**\n * finds the point that is 'distance' along the path from 'location'. this method returns both the x,y location of the point and also\n * its 'location' (proportion of travel along the path); the method below - _pointAlongPathFrom - calls this method and just returns the\n * point.\n */\n var _pointAlongPath = function(curve, location, distance) {\n\n if (_isPoint(curve)) {\n return {\n point:curve[0],\n location:location\n };\n }\n\n var prev = _pointOnPath(curve, location),\n tally = 0,\n curLoc = location,\n direction = distance > 0 ? 1 : -1,\n cur = null;\n\n while (tally < Math.abs(distance)) {\n curLoc += (0.005 * direction);\n cur = _pointOnPath(curve, curLoc);\n tally += _dist(cur, prev);\n prev = cur;\n }\n return {point:cur, location:curLoc};\n };\n\n var _length = function(curve) {\n if (_isPoint(curve)) return 0;\n\n var prev = _pointOnPath(curve, 0),\n tally = 0,\n curLoc = 0,\n direction = 1,\n cur = null;\n\n while (curLoc < 1) {\n curLoc += (0.005 * direction);\n cur = _pointOnPath(curve, curLoc);\n tally += _dist(cur, prev);\n prev = cur;\n }\n return tally;\n };\n\n /**\n * finds the point that is 'distance' along the path from 'location'.\n */\n var _pointAlongPathFrom = function(curve, location, distance) {\n return _pointAlongPath(curve, location, distance).point;\n };\n\n /**\n * finds the location that is 'distance' along the path from 'location'.\n */\n var _locationAlongPathFrom = function(curve, location, distance) {\n return _pointAlongPath(curve, location, distance).location;\n };\n\n /**\n * returns the gradient of the curve at the given location, which is a decimal between 0 and 1 inclusive.\n *\n * thanks // http://bimixual.org/AnimationLibrary/beziertangents.html\n */\n var _gradientAtPoint = function(curve, location) {\n var p1 = _pointOnPath(curve, location),\n p2 = _pointOnPath(curve.slice(0, curve.length - 1), location),\n dy = p2.y - p1.y, dx = p2.x - p1.x;\n return dy == 0 ? Infinity : Math.atan(dy / dx);\n };\n\n /**\n returns the gradient of the curve at the point which is 'distance' from the given location.\n if this point is greater than location 1, the gradient at location 1 is returned.\n if this point is less than location 0, the gradient at location 0 is returned.\n */\n var _gradientAtPointAlongPathFrom = function(curve, location, distance) {\n var p = _pointAlongPath(curve, location, distance);\n if (p.location > 1) p.location = 1;\n if (p.location < 0) p.location = 0;\n return _gradientAtPoint(curve, p.location);\n };\n\n /**\n * calculates a line that is 'length' pixels long, perpendicular to, and centered on, the path at 'distance' pixels from the given location.\n * if distance is not supplied, the perpendicular for the given location is computed (ie. we set distance to zero).\n */\n var _perpendicularToPathAt = function(curve, location, length, distance) {\n distance = distance == null ? 0 : distance;\n var p = _pointAlongPath(curve, location, distance),\n m = _gradientAtPoint(curve, p.location),\n _theta2 = Math.atan(-1 / m),\n y = length / 2 * Math.sin(_theta2),\n x = length / 2 * Math.cos(_theta2);\n return [{x:p.point.x + x, y:p.point.y + y}, {x:p.point.x - x, y:p.point.y - y}];\n };\n\n var jsBezier = this.jsBezier = {\n distanceFromCurve : _distanceFromCurve,\n gradientAtPoint : _gradientAtPoint,\n gradientAtPointAlongCurveFrom : _gradientAtPointAlongPathFrom,\n nearestPointOnCurve : _nearestPointOnCurve,\n pointOnCurve : _pointOnPath,\n pointAlongCurveFrom : _pointAlongPathFrom,\n perpendicularToCurveAt : _perpendicularToPathAt,\n locationAlongCurveFrom:_locationAlongPathFrom,\n getLength:_length,\n version:\"0.9.0\"\n };\n\n if (typeof exports !== \"undefined\") {\n exports.jsBezier = jsBezier;\n }\n\n}).call(typeof window !== 'undefined' ? window : this);\n\n/**\n * Biltong v0.4.0\n *\n * Various geometry functions written as part of jsPlumb and perhaps useful for others.\n *\n * Copyright (c) 2017 jsPlumb\n * https://jsplumbtoolkit.com\n *\n * Permission is hereby granted, free of charge, to any person\n * obtaining a copy of this software and associated documentation\n * files (the \"Software\"), to deal in the Software without\n * restriction, including without limitation the rights to use,\n * copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following\n * conditions:\n *\n * The above copyright notice and this permission notice shall be\n * included in all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES\n * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\n * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\n * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR\n * OTHER DEALINGS IN THE SOFTWARE.\n */\n;(function() {\n\n \"use strict\";\n var root = this;\n\n var Biltong = root.Biltong = {\n version:\"0.4.0\"\n };\n\n if (typeof exports !== \"undefined\") {\n exports.Biltong = Biltong;\n }\n\n var _isa = function(a) { return Object.prototype.toString.call(a) === \"[object Array]\"; },\n _pointHelper = function(p1, p2, fn) {\n p1 = _isa(p1) ? p1 : [p1.x, p1.y];\n p2 = _isa(p2) ? p2 : [p2.x, p2.y];\n return fn(p1, p2);\n },\n /**\n * @name Biltong.gradient\n * @function\n * @desc Calculates the gradient of a line between the two points.\n * @param {Point} p1 First point, either as a 2 entry array or object with `left` and `top` properties.\n * @param {Point} p2 Second point, either as a 2 entry array or object with `left` and `top` properties.\n * @return {Float} The gradient of a line between the two points.\n */\n _gradient = Biltong.gradient = function(p1, p2) {\n return _pointHelper(p1, p2, function(_p1, _p2) {\n if (_p2[0] == _p1[0])\n return _p2[1] > _p1[1] ? Infinity : -Infinity;\n else if (_p2[1] == _p1[1])\n return _p2[0] > _p1[0] ? 0 : -0;\n else\n return (_p2[1] - _p1[1]) / (_p2[0] - _p1[0]);\n });\n },\n /**\n * @name Biltong.normal\n * @function\n * @desc Calculates the gradient of a normal to a line between the two points.\n * @param {Point} p1 First point, either as a 2 entry array or object with `left` and `top` properties.\n * @param {Point} p2 Second point, either as a 2 entry array or object with `left` and `top` properties.\n * @return {Float} The gradient of a normal to a line between the two points.\n */\n _normal = Biltong.normal = function(p1, p2) {\n return -1 / _gradient(p1, p2);\n },\n /**\n * @name Biltong.lineLength\n * @function\n * @desc Calculates the length of a line between the two points.\n * @param {Point} p1 First point, either as a 2 entry array or object with `left` and `top` properties.\n * @param {Point} p2 Second point, either as a 2 entry array or object with `left` and `top` properties.\n * @return {Float} The length of a line between the two points.\n */\n _lineLength = Biltong.lineLength = function(p1, p2) {\n return _pointHelper(p1, p2, function(_p1, _p2) {\n return Math.sqrt(Math.pow(_p2[1] - _p1[1], 2) + Math.pow(_p2[0] - _p1[0], 2));\n });\n },\n /**\n * @name Biltong.quadrant\n * @function\n * @desc Calculates the quadrant in which the angle between the two points lies.\n * @param {Point} p1 First point, either as a 2 entry array or object with `left` and `top` properties.\n * @param {Point} p2 Second point, either as a 2 entry array or object with `left` and `top` properties.\n * @return {Integer} The quadrant - 1 for upper right, 2 for lower right, 3 for lower left, 4 for upper left.\n */\n _quadrant = Biltong.quadrant = function(p1, p2) {\n return _pointHelper(p1, p2, function(_p1, _p2) {\n if (_p2[0] > _p1[0]) {\n return (_p2[1] > _p1[1]) ? 2 : 1;\n }\n else if (_p2[0] == _p1[0]) {\n return _p2[1] > _p1[1] ? 2 : 1;\n }\n else {\n return (_p2[1] > _p1[1]) ? 3 : 4;\n }\n });\n },\n /**\n * @name Biltong.theta\n * @function\n * @desc Calculates the angle between the two points.\n * @param {Point} p1 First point, either as a 2 entry array or object with `left` and `top` properties.\n * @param {Point} p2 Second point, either as a 2 entry array or object with `left` and `top` properties.\n * @return {Float} The angle between the two points.\n */\n _theta = Biltong.theta = function(p1, p2) {\n return _pointHelper(p1, p2, function(_p1, _p2) {\n var m = _gradient(_p1, _p2),\n t = Math.atan(m),\n s = _quadrant(_p1, _p2);\n if ((s == 4 || s== 3)) t += Math.PI;\n if (t < 0) t += (2 * Math.PI);\n\n return t;\n });\n },\n /**\n * @name Biltong.intersects\n * @function\n * @desc Calculates whether or not the two rectangles intersect.\n * @param {Rectangle} r1 First rectangle, as a js object in the form `{x:.., y:.., w:.., h:..}`\n * @param {Rectangle} r2 Second rectangle, as a js object in the form `{x:.., y:.., w:.., h:..}`\n * @return {Boolean} True if the rectangles intersect, false otherwise.\n */\n _intersects = Biltong.intersects = function(r1, r2) {\n var x1 = r1.x, x2 = r1.x + r1.w, y1 = r1.y, y2 = r1.y + r1.h,\n a1 = r2.x, a2 = r2.x + r2.w, b1 = r2.y, b2 = r2.y + r2.h;\n\n return ( (x1 <= a1 && a1 <= x2) && (y1 <= b1 && b1 <= y2) ) ||\n ( (x1 <= a2 && a2 <= x2) && (y1 <= b1 && b1 <= y2) ) ||\n ( (x1 <= a1 && a1 <= x2) && (y1 <= b2 && b2 <= y2) ) ||\n ( (x1 <= a2 && a1 <= x2) && (y1 <= b2 && b2 <= y2) ) ||\n ( (a1 <= x1 && x1 <= a2) && (b1 <= y1 && y1 <= b2) ) ||\n ( (a1 <= x2 && x2 <= a2) && (b1 <= y1 && y1 <= b2) ) ||\n ( (a1 <= x1 && x1 <= a2) && (b1 <= y2 && y2 <= b2) ) ||\n ( (a1 <= x2 && x1 <= a2) && (b1 <= y2 && y2 <= b2) );\n },\n /**\n * @name Biltong.encloses\n * @function\n * @desc Calculates whether or not r2 is completely enclosed by r1.\n * @param {Rectangle} r1 First rectangle, as a js object in the form `{x:.., y:.., w:.., h:..}`\n * @param {Rectangle} r2 Second rectangle, as a js object in the form `{x:.., y:.., w:.., h:..}`\n * @param {Boolean} [allowSharedEdges=false] If true, the concept of enclosure allows for one or more edges to be shared by the two rectangles.\n * @return {Boolean} True if r1 encloses r2, false otherwise.\n */\n _encloses = Biltong.encloses = function(r1, r2, allowSharedEdges) {\n var x1 = r1.x, x2 = r1.x + r1.w, y1 = r1.y, y2 = r1.y + r1.h,\n a1 = r2.x, a2 = r2.x + r2.w, b1 = r2.y, b2 = r2.y + r2.h,\n c = function(v1, v2, v3, v4) { return allowSharedEdges ? v1 <= v2 && v3>= v4 : v1 < v2 && v3 > v4; };\n\n return c(x1,a1,x2,a2) && c(y1,b1,y2,b2);\n },\n _segmentMultipliers = [null, [1, -1], [1, 1], [-1, 1], [-1, -1] ],\n _inverseSegmentMultipliers = [null, [-1, -1], [-1, 1], [1, 1], [1, -1] ],\n /**\n * @name Biltong.pointOnLine\n * @function\n * @desc Calculates a point on the line from `fromPoint` to `toPoint` that is `distance` units along the length of the line.\n * @param {Point} p1 First point, either as a 2 entry array or object with `left` and `top` properties.\n * @param {Point} p2 Second point, either as a 2 entry array or object with `left` and `top` properties.\n * @return {Point} Point on the line, in the form `{ x:..., y:... }`.\n */\n _pointOnLine = Biltong.pointOnLine = function(fromPoint, toPoint, distance) {\n var m = _gradient(fromPoint, toPoint),\n s = _quadrant(fromPoint, toPoint),\n segmentMultiplier = distance > 0 ? _segmentMultipliers[s] : _inverseSegmentMultipliers[s],\n theta = Math.atan(m),\n y = Math.abs(distance * Math.sin(theta)) * segmentMultiplier[1],\n x = Math.abs(distance * Math.cos(theta)) * segmentMultiplier[0];\n return { x:fromPoint.x + x, y:fromPoint.y + y };\n },\n /**\n * @name Biltong.perpendicularLineTo\n * @function\n * @desc Calculates a line of length `length` that is perpendicular to the line from `fromPoint` to `toPoint` and passes through `toPoint`.\n * @param {Point} p1 First point, either as a 2 entry array or object with `left` and `top` properties.\n * @param {Point} p2 Second point, either as a 2 entry array or object with `left` and `top` properties.\n * @return {Line} Perpendicular line, in the form `[ { x:..., y:... }, { x:..., y:... } ]`.\n */\n _perpendicularLineTo = Biltong.perpendicularLineTo = function(fromPoint, toPoint, length) {\n var m = _gradient(fromPoint, toPoint),\n theta2 = Math.atan(-1 / m),\n y = length / 2 * Math.sin(theta2),\n x = length / 2 * Math.cos(theta2);\n return [{x:toPoint.x + x, y:toPoint.y + y}, {x:toPoint.x - x, y:toPoint.y - y}];\n };\n}).call(typeof window !== 'undefined' ? window : this);\n;\n(function () {\n\n \"use strict\";\n\n var root = this,\n Sniff = {\n android: navigator.userAgent.toLowerCase().indexOf(\"android\") > -1\n },\n matchesSelector = function (el, selector, ctx) {\n ctx = ctx || el.parentNode;\n var possibles = ctx.querySelectorAll(selector);\n for (var i = 0; i < possibles.length; i++) {\n if (possibles[i] === el) {\n return true;\n }\n }\n return false;\n },\n _gel = function (el) {\n return (typeof el == \"string\" || el.constructor === String) ? document.getElementById(el) : el;\n },\n _t = function (e) {\n return e.srcElement || e.target;\n },\n //\n // gets path info for the given event - the path from target to obj, in the event's bubble chain. if doCompute\n // is false we just return target for the path.\n //\n _pi = function(e, target, obj, doCompute) {\n if (!doCompute) return { path:[target], end:1 };\n else if (typeof e.path !== \"undefined\" && e.path.indexOf) {\n return { path: e.path, end: e.path.indexOf(obj) };\n } else {\n var out = { path:[], end:-1 }, _one = function(el) {\n out.path.push(el);\n if (el === obj) {\n out.end = out.path.length - 1;\n }\n else if (el.parentNode != null) {\n _one(el.parentNode)\n }\n };\n _one(target);\n return out;\n }\n },\n _d = function (l, fn) {\n for (var i = 0, j = l.length; i < j; i++) {\n if (l[i] == fn) break;\n }\n if (i < l.length) l.splice(i, 1);\n },\n guid = 1,\n //\n // this function generates a guid for every handler, sets it on the handler, then adds\n // it to the associated object's map of handlers for the given event. this is what enables us\n // to unbind all events of some type, or all events (the second of which can be requested by the user,\n // but it also used by Mottle when an element is removed.)\n _store = function (obj, event, fn) {\n var g = guid++;\n obj.__ta = obj.__ta || {};\n obj.__ta[event] = obj.__ta[event] || {};\n // store each handler with a unique guid.\n obj.__ta[event][g] = fn;\n // set the guid on the handler.\n fn.__tauid = g;\n return g;\n },\n _unstore = function (obj, event, fn) {\n obj.__ta && obj.__ta[event] && delete obj.__ta[event][fn.__tauid];\n // a handler might have attached extra functions, so we unbind those too.\n if (fn.__taExtra) {\n for (var i = 0; i < fn.__taExtra.length; i++) {\n _unbind(obj, fn.__taExtra[i][0], fn.__taExtra[i][1]);\n }\n fn.__taExtra.length = 0;\n }\n // a handler might have attached an unstore callback\n fn.__taUnstore && fn.__taUnstore();\n },\n _curryChildFilter = function (children, obj, fn, evt) {\n if (children == null) return fn;\n else {\n var c = children.split(\",\"),\n _fn = function (e) {\n _fn.__tauid = fn.__tauid;\n var t = _t(e), target = t; // t is the target element on which the event occurred. it is the\n // element we will wish to pass to any callbacks.\n var pathInfo = _pi(e, t, obj, children != null)\n if (pathInfo.end != -1) {\n for (var p = 0; p < pathInfo.end; p++) {\n target = pathInfo.path[p];\n for (var i = 0; i < c.length; i++) {\n if (matchesSelector(target, c[i], obj)) {\n fn.apply(target, arguments);\n }\n }\n }\n }\n };\n registerExtraFunction(fn, evt, _fn);\n return _fn;\n }\n },\n //\n // registers an 'extra' function on some event listener function we were given - a function that we\n // created and bound to the element as part of our housekeeping, and which we want to unbind and remove\n // whenever the given function is unbound.\n registerExtraFunction = function (fn, evt, newFn) {\n fn.__taExtra = fn.__taExtra || [];\n fn.__taExtra.push([evt, newFn]);\n },\n DefaultHandler = function (obj, evt, fn, children) {\n if (isTouchDevice && touchMap[evt]) {\n var tfn = _curryChildFilter(children, obj, fn, touchMap[evt]);\n _bind(obj, touchMap[evt], tfn , fn);\n }\n if (evt === \"focus\" && obj.getAttribute(\"tabindex\") == null) {\n obj.setAttribute(\"tabindex\", \"1\");\n }\n _bind(obj, evt, _curryChildFilter(children, obj, fn, evt), fn);\n },\n SmartClickHandler = function (obj, evt, fn, children) {\n if (obj.__taSmartClicks == null) {\n var down = function (e) {\n obj.__tad = _pageLocation(e);\n },\n up = function (e) {\n obj.__tau = _pageLocation(e);\n },\n click = function (e) {\n if (obj.__tad && obj.__tau && obj.__tad[0] === obj.__tau[0] && obj.__tad[1] === obj.__tau[1]) {\n for (var i = 0; i < obj.__taSmartClicks.length; i++)\n obj.__taSmartClicks[i].apply(_t(e), [ e ]);\n }\n };\n DefaultHandler(obj, \"mousedown\", down, children);\n DefaultHandler(obj, \"mouseup\", up, children);\n DefaultHandler(obj, \"click\", click, children);\n obj.__taSmartClicks = [];\n }\n\n // store in the list of callbacks\n obj.__taSmartClicks.push(fn);\n // the unstore function removes this function from the object's listener list for this type.\n fn.__taUnstore = function () {\n _d(obj.__taSmartClicks, fn);\n };\n },\n _tapProfiles = {\n \"tap\": {touches: 1, taps: 1},\n \"dbltap\": {touches: 1, taps: 2},\n \"contextmenu\": {touches: 2, taps: 1}\n },\n TapHandler = function (clickThreshold, dblClickThreshold) {\n return function (obj, evt, fn, children) {\n // if event is contextmenu, for devices which are mouse only, we want to\n // use the default bind.\n if (evt == \"contextmenu\" && isMouseDevice)\n DefaultHandler(obj, evt, fn, children);\n else {\n // the issue here is that this down handler gets registered only for the\n // child nodes in the first registration. in fact it should be registered with\n // no child selector and then on down we should cycle through the registered\n // functions to see if one of them matches. on mouseup we should execute ALL of\n // the functions whose children are either null or match the element.\n if (obj.__taTapHandler == null) {\n var tt = obj.__taTapHandler = {\n tap: [],\n dbltap: [],\n contextmenu: [],\n down: false,\n taps: 0,\n downSelectors: []\n };\n var down = function (e) {\n var target = _t(e), pathInfo = _pi(e, target, obj, children != null), finished = false;\n for (var p = 0; p < pathInfo.end; p++) {\n if (finished) return;\n target = pathInfo.path[p];\n for (var i = 0; i < tt.downSelectors.length; i++) {\n if (tt.downSelectors[i] == null || matchesSelector(target, tt.downSelectors[i], obj)) {\n tt.down = true;\n setTimeout(clearSingle, clickThreshold);\n setTimeout(clearDouble, dblClickThreshold);\n finished = true;\n break; // we only need one match on mousedown\n }\n }\n }\n },\n up = function (e) {\n if (tt.down) {\n var target = _t(e), currentTarget, pathInfo;\n tt.taps++;\n var tc = _touchCount(e);\n for (var eventId in _tapProfiles) {\n if (_tapProfiles.hasOwnProperty(eventId)) {\n var p = _tapProfiles[eventId];\n if (p.touches === tc && (p.taps === 1 || p.taps === tt.taps)) {\n for (var i = 0; i < tt[eventId].length; i++) {\n pathInfo = _pi(e, target, obj, tt[eventId][i][1] != null);\n for (var pLoop = 0; pLoop < pathInfo.end; pLoop++) {\n currentTarget = pathInfo.path[pLoop];\n // this is a single event registration handler.\n if (tt[eventId][i][1] == null || matchesSelector(currentTarget, tt[eventId][i][1], obj)) {\n tt[eventId][i][0].apply(currentTarget, [ e ]);\n break;\n }\n }\n }\n }\n }\n }\n }\n },\n clearSingle = function () {\n tt.down = false;\n },\n clearDouble = function () {\n tt.taps = 0;\n };\n\n DefaultHandler(obj, \"mousedown\", down);\n DefaultHandler(obj, \"mouseup\", up);\n }\n // add this child selector (it can be null, that's fine).\n obj.__taTapHandler.downSelectors.push(children);\n\n obj.__taTapHandler[evt].push([fn, children]);\n // the unstore function removes this function from the object's listener list for this type.\n fn.__taUnstore = function () {\n _d(obj.__taTapHandler[evt], fn);\n };\n }\n };\n },\n meeHelper = function (type, evt, obj, target) {\n for (var i in obj.__tamee[type]) {\n if (obj.__tamee[type].hasOwnProperty(i)) {\n obj.__tamee[type][i].apply(target, [ evt ]);\n }\n }\n },\n MouseEnterExitHandler = function () {\n var activeElements = [];\n return function (obj, evt, fn, children) {\n if (!obj.__tamee) {\n // __tamee holds a flag saying whether the mouse is currently \"in\" the element, and a list of\n // both mouseenter and mouseexit functions.\n obj.__tamee = { over: false, mouseenter: [], mouseexit: [] };\n // register over and out functions\n var over = function (e) {\n var t = _t(e);\n if ((children == null && (t == obj && !obj.__tamee.over)) || (matchesSelector(t, children, obj) && (t.__tamee == null || !t.__tamee.over))) {\n meeHelper(\"mouseenter\", e, obj, t);\n t.__tamee = t.__tamee || {};\n t.__tamee.over = true;\n activeElements.push(t);\n }\n },\n out = function (e) {\n var t = _t(e);\n // is the current target one of the activeElements? and is the\n // related target NOT a descendant of it?\n for (var i = 0; i < activeElements.length; i++) {\n if (t == activeElements[i] && !matchesSelector((e.relatedTarget || e.toElement), \"*\", t)) {\n t.__tamee.over = false;\n activeElements.splice(i, 1);\n meeHelper(\"mouseexit\", e, obj, t);\n }\n }\n };\n\n _bind(obj, \"mouseover\", _curryChildFilter(children, obj, over, \"mouseover\"), over);\n _bind(obj, \"mouseout\", _curryChildFilter(children, obj, out, \"mouseout\"), out);\n }\n\n fn.__taUnstore = function () {\n delete obj.__tamee[evt][fn.__tauid];\n };\n\n _store(obj, evt, fn);\n obj.__tamee[evt][fn.__tauid] = fn;\n };\n },\n isTouchDevice = \"ontouchstart\" in document.documentElement,\n isMouseDevice = \"onmousedown\" in document.documentElement,\n touchMap = { \"mousedown\": \"touchstart\", \"mouseup\": \"touchend\", \"mousemove\": \"touchmove\" },\n touchstart = \"touchstart\", touchend = \"touchend\", touchmove = \"touchmove\",\n iev = (function () {\n var rv = -1;\n if (navigator.appName == 'Microsoft Internet Explorer') {\n var ua = navigator.userAgent,\n re = new RegExp(\"MSIE ([0-9]{1,}[\\.0-9]{0,})\");\n if (re.exec(ua) != null)\n rv = parseFloat(RegExp.$1);\n }\n return rv;\n })(),\n isIELT9 = iev > -1 && iev < 9,\n _genLoc = function (e, prefix) {\n if (e == null) return [ 0, 0 ];\n var ts = _touches(e), t = _getTouch(ts, 0);\n return [t[prefix + \"X\"], t[prefix + \"Y\"]];\n },\n _pageLocation = function (e) {\n if (e == null) return [ 0, 0 ];\n if (isIELT9) {\n return [ e.clientX + document.documentElement.scrollLeft, e.clientY + document.documentElement.scrollTop ];\n }\n else {\n return _genLoc(e, \"page\");\n }\n },\n _screenLocation = function (e) {\n return _genLoc(e, \"screen\");\n },\n _clientLocation = function (e) {\n return _genLoc(e, \"client\");\n },\n _getTouch = function (touches, idx) {\n return touches.item ? touches.item(idx) : touches[idx];\n },\n _touches = function (e) {\n return e.touches && e.touches.length > 0 ? e.touches :\n e.changedTouches && e.changedTouches.length > 0 ? e.changedTouches :\n e.targetTouches && e.targetTouches.length > 0 ? e.targetTouches :\n [ e ];\n },\n _touchCount = function (e) {\n return _touches(e).length;\n },\n //http://www.quirksmode.org/blog/archives/2005/10/_and_the_winner_1.html\n _bind = function (obj, type, fn, originalFn) {\n _store(obj, type, fn);\n originalFn.__tauid = fn.__tauid;\n if (obj.addEventListener)\n obj.addEventListener(type, fn, false);\n else if (obj.attachEvent) {\n var key = type + fn.__tauid;\n obj[\"e\" + key] = fn;\n // TODO look at replacing with .call(..)\n obj[key] = function () {\n obj[\"e\" + key] && obj[\"e\" + key](window.event);\n };\n obj.attachEvent(\"on\" + type, obj[key]);\n }\n },\n _unbind = function (obj, type, fn) {\n if (fn == null) return;\n _each(obj, function () {\n var _el = _gel(this);\n _unstore(_el, type, fn);\n // it has been bound if there is a tauid. otherwise it was not bound and we can ignore it.\n if (fn.__tauid != null) {\n if (_el.removeEventListener) {\n _el.removeEventListener(type, fn, false);\n if (isTouchDevice && touchMap[type]) _el.removeEventListener(touchMap[type], fn, false);\n }\n else if (this.detachEvent) {\n var key = type + fn.__tauid;\n _el[key] && _el.detachEvent(\"on\" + type, _el[key]);\n _el[key] = null;\n _el[\"e\" + key] = null;\n }\n }\n\n // if a touch event was also registered, deregister now.\n if (fn.__taTouchProxy) {\n _unbind(obj, fn.__taTouchProxy[1], fn.__taTouchProxy[0]);\n }\n });\n },\n _each = function (obj, fn) {\n if (obj == null) return;\n // if a list (or list-like), use it. if a string, get a list\n // by running the string through querySelectorAll. else, assume\n // it's an Element.\n // obj.top is \"unknown\" in IE8.\n obj = (typeof Window !== \"undefined\" && (typeof obj.top !== \"unknown\" && obj == obj.top)) ? [ obj ] :\n (typeof obj !== \"string\") && (obj.tagName == null && obj.length != null) ? obj :\n typeof obj === \"string\" ? document.querySelectorAll(obj)\n : [ obj ];\n\n for (var i = 0; i < obj.length; i++)\n fn.apply(obj[i]);\n };\n\n /**\n * Mottle offers support for abstracting out the differences\n * between touch and mouse devices, plus \"smart click\" functionality\n * (don't fire click if the mouse has moved between mousedown and mouseup),\n * and synthesized click/tap events.\n * @class Mottle\n * @constructor\n * @param {Object} params Constructor params\n * @param {Number} [params.clickThreshold=250] Threshold, in milliseconds beyond which a touchstart followed by a touchend is not considered to be a click.\n * @param {Number} [params.dblClickThreshold=450] Threshold, in milliseconds beyond which two successive tap events are not considered to be a click.\n * @param {Boolean} [params.smartClicks=false] If true, won't fire click events if the mouse has moved between mousedown and mouseup. Note that this functionality\n * requires that Mottle consume the mousedown event, and so may not be viable in all use cases.\n */\n root.Mottle = function (params) {\n params = params || {};\n var clickThreshold = params.clickThreshold || 250,\n dblClickThreshold = params.dblClickThreshold || 450,\n mouseEnterExitHandler = new MouseEnterExitHandler(),\n tapHandler = new TapHandler(clickThreshold, dblClickThreshold),\n _smartClicks = params.smartClicks,\n _doBind = function (obj, evt, fn, children) {\n if (fn == null) return;\n _each(obj, function () {\n var _el = _gel(this);\n if (_smartClicks && evt === \"click\")\n SmartClickHandler(_el, evt, fn, children);\n else if (evt === \"tap\" || evt === \"dbltap\" || evt === \"contextmenu\") {\n tapHandler(_el, evt, fn, children);\n }\n else if (evt === \"mouseenter\" || evt == \"mouseexit\")\n mouseEnterExitHandler(_el, evt, fn, children);\n else\n DefaultHandler(_el, evt, fn, children);\n });\n };\n\n /**\n * Removes an element from the DOM, and deregisters all event handlers for it. You should use this\n * to ensure you don't leak memory.\n * @method remove\n * @param {String|Element} el Element, or id of the element, to remove.\n * @return {Mottle} The current Mottle instance; you can chain this method.\n */\n this.remove = function (el) {\n _each(el, function () {\n var _el = _gel(this);\n if (_el.__ta) {\n for (var evt in _el.__ta) {\n if (_el.__ta.hasOwnProperty(evt)) {\n for (var h in _el.__ta[evt]) {\n if (_el.__ta[evt].hasOwnProperty(h))\n _unbind(_el, evt, _el.__ta[evt][h]);\n }\n }\n }\n }\n _el.parentNode && _el.parentNode.removeChild(_el);\n });\n return this;\n };\n\n /**\n * Register an event handler, optionally as a delegate for some set of descendant elements. Note\n * that this method takes either 3 or 4 arguments - if you supply 3 arguments it is assumed you have\n * omitted the `children` parameter, and that the event handler should be bound directly to the given element.\n * @method on\n * @param {Element[]|Element|String} el Either an Element, or a CSS spec for a list of elements, or an array of Elements.\n * @param {String} [children] Comma-delimited list of selectors identifying allowed children.\n * @param {String} event Event ID.\n * @param {Function} fn Event handler function.\n * @return {Mottle} The current Mottle instance; you can chain this method.\n */\n this.on = function (el, event, children, fn) {\n var _el = arguments[0],\n _c = arguments.length == 4 ? arguments[2] : null,\n _e = arguments[1],\n _f = arguments[arguments.length - 1];\n\n _doBind(_el, _e, _f, _c);\n return this;\n };\n\n /**\n * Cancel delegate event handling for the given function. Note that unlike with 'on' you do not supply\n * a list of child selectors here: it removes event delegation from all of the child selectors for which the\n * given function was registered (if any).\n * @method off\n * @param {Element[]|Element|String} el Element - or ID of element - from which to remove event listener.\n * @param {String} event Event ID.\n * @param {Function} fn Event handler function.\n * @return {Mottle} The current Mottle instance; you can chain this method.\n */\n this.off = function (el, event, fn) {\n _unbind(el, event, fn);\n return this;\n };\n\n /**\n * Triggers some event for a given element.\n * @method trigger\n * @param {Element} el Element for which to trigger the event.\n * @param {String} event Event ID.\n * @param {Event} originalEvent The original event. Should be optional of course, but currently is not, due\n * to the jsPlumb use case that caused this method to be added.\n * @param {Object} [payload] Optional object to set as `payload` on the generated event; useful for message passing.\n * @return {Mottle} The current Mottle instance; you can chain this method.\n */\n this.trigger = function (el, event, originalEvent, payload) {\n // MouseEvent undefined in old IE; that's how we know it's a mouse event. A fine Microsoft paradox.\n var originalIsMouse = isMouseDevice && (typeof MouseEvent === \"undefined\" || originalEvent == null || originalEvent.constructor === MouseEvent);\n\n var eventToBind = (isTouchDevice && !isMouseDevice && touchMap[event]) ? touchMap[event] : event,\n bindingAMouseEvent = !(isTouchDevice && !isMouseDevice && touchMap[event]);\n\n var pl = _pageLocation(originalEvent), sl = _screenLocation(originalEvent), cl = _clientLocation(originalEvent);\n _each(el, function () {\n var _el = _gel(this), evt;\n originalEvent = originalEvent || {\n screenX: sl[0],\n screenY: sl[1],\n clientX: cl[0],\n clientY: cl[1]\n };\n\n var _decorate = function (_evt) {\n if (payload) _evt.payload = payload;\n };\n\n var eventGenerators = {\n \"TouchEvent\": function (evt) {\n var touch = document.createTouch(window, _el, 0, pl[0], pl[1],\n sl[0], sl[1],\n cl[0], cl[1],\n 0, 0, 0, 0);\n\n // https://gist.github.com/sstephenson/448808\n var touches = document.createTouchList(touch);\n var targetTouches = document.createTouchList(touch);\n var changedTouches = document.createTouchList(touch);\n evt.initTouchEvent(eventToBind, true, true, window, null, sl[0], sl[1],\n cl[0], cl[1], false, false, false, false,\n touches, targetTouches, changedTouches, 1, 0);\n },\n \"MouseEvents\": function (evt) {\n evt.initMouseEvent(eventToBind, true, true, window, 0,\n sl[0], sl[1],\n cl[0], cl[1],\n false, false, false, false, 1, _el);\n\n if (Sniff.android) {\n // Android's touch events are not standard.\n var t = document.createTouch(window, _el, 0, pl[0], pl[1],\n sl[0], sl[1],\n cl[0], cl[1],\n 0, 0, 0, 0);\n\n evt.touches = evt.targetTouches = evt.changedTouches = document.createTouchList(t);\n }\n }\n };\n\n if (document.createEvent) {\n\n var ite = !bindingAMouseEvent && !originalIsMouse && (isTouchDevice && touchMap[event] && !Sniff.android),\n evtName = ite ? \"TouchEvent\" : \"MouseEvents\";\n\n evt = document.createEvent(evtName);\n eventGenerators[evtName](evt);\n _decorate(evt);\n _el.dispatchEvent(evt);\n }\n else if (document.createEventObject) {\n evt = document.createEventObject();\n evt.eventType = evt.eventName = eventToBind;\n evt.screenX = sl[0];\n evt.screenY = sl[1];\n evt.clientX = cl[0];\n evt.clientY = cl[1];\n _decorate(evt);\n _el.fireEvent('on' + eventToBind, evt);\n }\n });\n return this;\n }\n };\n\n /**\n * Static method to assist in 'consuming' an element: uses `stopPropagation` where available, or sets\n * `e.returnValue=false` where it is not.\n * @method Mottle.consume\n * @param {Event} e Event to consume\n * @param {Boolean} [doNotPreventDefault=false] If true, does not call `preventDefault()` on the event.\n */\n root.Mottle.consume = function (e, doNotPreventDefault) {\n if (e.stopPropagation)\n e.stopPropagation();\n else\n e.returnValue = false;\n\n if (!doNotPreventDefault && e.preventDefault)\n e.preventDefault();\n };\n\n /**\n * Gets the page location corresponding to the given event. For touch events this means get the page location of the first touch.\n * @method Mottle.pageLocation\n * @param {Event} e Event to get page location for.\n * @return {Number[]} [left, top] for the given event.\n */\n root.Mottle.pageLocation = _pageLocation;\n\n /**\n * Forces touch events to be turned \"on\". Useful for testing: even if you don't have a touch device, you can still\n * trigger a touch event when this is switched on and it will be captured and acted on.\n * @method setForceTouchEvents\n * @param {Boolean} value If true, force touch events to be on.\n */\n root.Mottle.setForceTouchEvents = function (value) {\n isTouchDevice = value;\n };\n\n /**\n * Forces mouse events to be turned \"on\". Useful for testing: even if you don't have a mouse, you can still\n * trigger a mouse event when this is switched on and it will be captured and acted on.\n * @method setForceMouseEvents\n * @param {Boolean} value If true, force mouse events to be on.\n */\n root.Mottle.setForceMouseEvents = function (value) {\n isMouseDevice = value;\n };\n\n root.Mottle.version = \"0.8.0\";\n\n if (typeof exports !== \"undefined\") {\n exports.Mottle = root.Mottle;\n }\n\n}).call(typeof window === \"undefined\" ? this : window);\n\n/**\n drag/drop functionality for use with jsPlumb but with\n no knowledge of jsPlumb. supports multiple scopes (separated by whitespace), dragging\n multiple elements, constrain to parent, drop filters, drag start filters, custom\n css classes.\n\n a lot of the functionality of this script is expected to be plugged in:\n\n addClass\n removeClass\n\n addEvent\n removeEvent\n\n getPosition\n setPosition\n getSize\n\n indexOf\n intersects\n\n the name came from here:\n\n http://mrsharpoblunto.github.io/foswig.js/\n\n copyright 2016 jsPlumb\n */\n\n;(function() {\n\n \"use strict\";\n var root = this;\n\n var _suggest = function(list, item, head) {\n if (list.indexOf(item) === -1) {\n head ? list.unshift(item) : list.push(item);\n return true;\n }\n return false;\n };\n\n var _vanquish = function(list, item) {\n var idx = list.indexOf(item);\n if (idx !== -1) list.splice(idx, 1);\n };\n\n var _difference = function(l1, l2) {\n var d = [];\n for (var i = 0; i < l1.length; i++) {\n if (l2.indexOf(l1[i]) === -1)\n d.push(l1[i]);\n }\n return d;\n };\n\n var _isString = function(f) {\n return f == null ? false : (typeof f === \"string\" || f.constructor === String);\n };\n\n var getOffsetRect = function (elem) {\n // (1)\n var box = elem.getBoundingClientRect(),\n body = document.body,\n docElem = document.documentElement,\n // (2)\n scrollTop = window.pageYOffset || docElem.scrollTop || body.scrollTop,\n scrollLeft = window.pageXOffset || docElem.scrollLeft || body.scrollLeft,\n // (3)\n clientTop = docElem.clientTop || body.clientTop || 0,\n clientLeft = docElem.clientLeft || body.clientLeft || 0,\n // (4)\n top = box.top + scrollTop - clientTop,\n left = box.left + scrollLeft - clientLeft;\n\n return { top: Math.round(top), left: Math.round(left) };\n };\n\n var matchesSelector = function(el, selector, ctx) {\n ctx = ctx || el.parentNode;\n var possibles = ctx.querySelectorAll(selector);\n for (var i = 0; i < possibles.length; i++) {\n if (possibles[i] === el)\n return true;\n }\n return false;\n };\n\n var iev = (function() {\n var rv = -1;\n if (navigator.appName === 'Microsoft Internet Explorer') {\n var ua = navigator.userAgent,\n re = new RegExp(\"MSIE ([0-9]{1,}[\\.0-9]{0,})\");\n if (re.exec(ua) != null)\n rv = parseFloat(RegExp.$1);\n }\n return rv;\n })(),\n DEFAULT_GRID_X = 10,\n DEFAULT_GRID_Y = 10,\n isIELT9 = iev > -1 && iev < 9,\n isIE9 = iev === 9,\n _pl = function(e) {\n if (isIELT9) {\n return [ e.clientX + document.documentElement.scrollLeft, e.clientY + document.documentElement.scrollTop ];\n }\n else {\n var ts = _touches(e), t = _getTouch(ts, 0);\n // for IE9 pageX might be null if the event was synthesized. We try for pageX/pageY first,\n // falling back to clientX/clientY if necessary. In every other browser we want to use pageX/pageY.\n return isIE9 ? [t.pageX || t.clientX, t.pageY || t.clientY] : [t.pageX, t.pageY];\n }\n },\n _getTouch = function(touches, idx) { return touches.item ? touches.item(idx) : touches[idx]; },\n _touches = function(e) {\n return e.touches && e.touches.length > 0 ? e.touches :\n e.changedTouches && e.changedTouches.length > 0 ? e.changedTouches :\n e.targetTouches && e.targetTouches.length > 0 ? e.targetTouches :\n [ e ];\n },\n _classes = {\n draggable:\"katavorio-draggable\", // draggable elements\n droppable:\"katavorio-droppable\", // droppable elements\n drag : \"katavorio-drag\", // elements currently being dragged\n selected:\"katavorio-drag-selected\", // elements in current drag selection\n active : \"katavorio-drag-active\", // droppables that are targets of a currently dragged element\n hover : \"katavorio-drag-hover\", // droppables over which a matching drag element is hovering\n noSelect : \"katavorio-drag-no-select\", // added to the body to provide a hook to suppress text selection\n ghostProxy:\"katavorio-ghost-proxy\", // added to a ghost proxy element in use when a drag has exited the bounds of its parent.\n clonedDrag:\"katavorio-clone-drag\" // added to a node that is a clone of an element created at the start of a drag\n },\n _defaultScope = \"katavorio-drag-scope\",\n _events = [ \"stop\", \"start\", \"drag\", \"drop\", \"over\", \"out\", \"beforeStart\" ],\n _devNull = function() {},\n _true = function() { return true; },\n _foreach = function(l, fn, from) {\n for (var i = 0; i < l.length; i++) {\n if (l[i] != from)\n fn(l[i]);\n }\n },\n _setDroppablesActive = function(dd, val, andHover, drag) {\n _foreach(dd, function(e) {\n e.setActive(val);\n if (val) e.updatePosition();\n if (andHover) e.setHover(drag, val);\n });\n },\n _each = function(obj, fn) {\n if (obj == null) return;\n obj = !_isString(obj) && (obj.tagName == null && obj.length != null) ? obj : [ obj ];\n for (var i = 0; i < obj.length; i++)\n fn.apply(obj[i], [ obj[i] ]);\n },\n _consume = function(e) {\n if (e.stopPropagation) {\n e.stopPropagation();\n e.preventDefault();\n }\n else {\n e.returnValue = false;\n }\n },\n _defaultInputFilterSelector = \"input,textarea,select,button,option\",\n //\n // filters out events on all input elements, like textarea, checkbox, input, select.\n _inputFilter = function(e, el, _katavorio) {\n var t = e.srcElement || e.target;\n return !matchesSelector(t, _katavorio.getInputFilterSelector(), el);\n };\n\n var Super = function(el, params, css, scope) {\n this.params = params || {};\n this.el = el;\n this.params.addClass(this.el, this._class);\n this.uuid = _uuid();\n var enabled = true;\n this.setEnabled = function(e) { enabled = e; };\n this.isEnabled = function() { return enabled; };\n this.toggleEnabled = function() { enabled = !enabled; };\n this.setScope = function(scopes) {\n this.scopes = scopes ? scopes.split(/\\s+/) : [ scope ];\n };\n this.addScope = function(scopes) {\n var m = {};\n _each(this.scopes, function(s) { m[s] = true;});\n _each(scopes ? scopes.split(/\\s+/) : [], function(s) { m[s] = true;});\n this.scopes = [];\n for (var i in m) this.scopes.push(i);\n };\n this.removeScope = function(scopes) {\n var m = {};\n _each(this.scopes, function(s) { m[s] = true;});\n _each(scopes ? scopes.split(/\\s+/) : [], function(s) { delete m[s];});\n this.scopes = [];\n for (var i in m) this.scopes.push(i);\n };\n this.toggleScope = function(scopes) {\n var m = {};\n _each(this.scopes, function(s) { m[s] = true;});\n _each(scopes ? scopes.split(/\\s+/) : [], function(s) {\n if (m[s]) delete m[s];\n else m[s] = true;\n });\n this.scopes = [];\n for (var i in m) this.scopes.push(i);\n };\n this.setScope(params.scope);\n this.k = params.katavorio;\n return params.katavorio;\n };\n\n var TRUE = function() { return true; };\n var FALSE = function() { return false; };\n\n var Drag = function(el, params, css, scope) {\n this._class = css.draggable;\n var k = Super.apply(this, arguments);\n this.rightButtonCanDrag = this.params.rightButtonCanDrag;\n var downAt = [0,0], posAtDown = null, pagePosAtDown = null, pageDelta = [0,0], moving = false,\n consumeStartEvent = this.params.consumeStartEvent !== false,\n dragEl = this.el,\n clone = this.params.clone,\n scroll = this.params.scroll,\n _multipleDrop = params.multipleDrop !== false,\n isConstrained = false,\n useGhostProxy = params.ghostProxy === true ? TRUE : params.ghostProxy && typeof params.ghostProxy === \"function\" ? params.ghostProxy : FALSE,\n ghostProxy = function(el) { return el.cloneNode(true); };\n\n var snapThreshold = params.snapThreshold,\n _snap = function(pos, gridX, gridY, thresholdX, thresholdY) {\n var _dx = Math.floor(pos[0] / gridX),\n _dxl = gridX * _dx,\n _dxt = _dxl + gridX,\n _x = Math.abs(pos[0] - _dxl) <= thresholdX ? _dxl : Math.abs(_dxt - pos[0]) <= thresholdX ? _dxt : pos[0];\n\n var _dy = Math.floor(pos[1] / gridY),\n _dyl = gridY * _dy,\n _dyt = _dyl + gridY,\n _y = Math.abs(pos[1] - _dyl) <= thresholdY ? _dyl : Math.abs(_dyt - pos[1]) <= thresholdY ? _dyt : pos[1];\n\n return [ _x, _y];\n };\n\n this.posses = [];\n this.posseRoles = {};\n\n this.toGrid = function(pos) {\n if (this.params.grid == null) {\n return pos;\n }\n else {\n var tx = this.params.grid ? this.params.grid[0] / 2 : snapThreshold ? snapThreshold : DEFAULT_GRID_X / 2,\n ty = this.params.grid ? this.params.grid[1] / 2 : snapThreshold ? snapThreshold : DEFAULT_GRID_Y / 2;\n\n return _snap(pos, this.params.grid[0], this.params.grid[1], tx, ty);\n }\n };\n\n this.snap = function(x, y) {\n if (dragEl == null) return;\n x = x || (this.params.grid ? this.params.grid[0] : DEFAULT_GRID_X);\n y = y || (this.params.grid ? this.params.grid[1] : DEFAULT_GRID_Y);\n var p = this.params.getPosition(dragEl),\n tx = this.params.grid ? this.params.grid[0] / 2 : snapThreshold,\n ty = this.params.grid ? this.params.grid[1] / 2 : snapThreshold;\n\n this.params.setPosition(dragEl, _snap(p, x, y, tx, ty));\n };\n\n this.setUseGhostProxy = function(val) {\n useGhostProxy = val ? TRUE : FALSE;\n };\n\n var constrain;\n var negativeFilter = function(pos) {\n return (params.allowNegative === false) ? [ Math.max (0, pos[0]), Math.max(0, pos[1]) ] : pos;\n };\n\n var _setConstrain = function(value) {\n constrain = typeof value === \"function\" ? value : value ? function(pos) {\n return negativeFilter([\n Math.max(0, Math.min(constrainRect.w - this.size[0], pos[0])),\n Math.max(0, Math.min(constrainRect.h - this.size[1], pos[1]))\n ]);\n }.bind(this) : function(pos) { return negativeFilter(pos); };\n }.bind(this);\n\n _setConstrain(typeof this.params.constrain === \"function\" ? this.params.constrain : (this.params.constrain || this.params.containment));\n\n\n /**\n * Sets whether or not the Drag is constrained. A value of 'true' means constrain to parent bounds; a function\n * will be executed and returns true if the position is allowed.\n * @param value\n */\n this.setConstrain = function(value) {\n _setConstrain(value);\n };\n\n var revertFunction;\n /**\n * Sets a function to call on drag stop, which, if it returns true, indicates that the given element should\n * revert to its position before the previous drag.\n * @param fn\n */\n this.setRevert = function(fn) {\n revertFunction = fn;\n };\n\n var _assignId = function(obj) {\n if (typeof obj === \"function\") {\n obj._katavorioId = _uuid();\n return obj._katavorioId;\n } else {\n return obj;\n }\n },\n // a map of { spec -> [ fn, exclusion ] } entries.\n _filters = {},\n _testFilter = function(e) {\n for (var key in _filters) {\n var f = _filters[key];\n var rv = f[0](e);\n if (f[1]) rv = !rv;\n if (!rv) return false;\n }\n return true;\n },\n _setFilter = this.setFilter = function(f, _exclude) {\n if (f) {\n var key = _assignId(f);\n _filters[key] = [\n function(e) {\n var t = e.srcElement || e.target, m;\n if (_isString(f)) {\n m = matchesSelector(t, f, el);\n }\n else if (typeof f === \"function\") {\n m = f(e, el);\n }\n return m;\n },\n _exclude !== false\n ];\n\n }\n },\n _addFilter = this.addFilter = _setFilter,\n _removeFilter = this.removeFilter = function(f) {\n var key = typeof f === \"function\" ? f._katavorioId : f;\n delete _filters[key];\n };\n\n this.clearAllFilters = function() {\n _filters = {};\n };\n\n this.canDrag = this.params.canDrag || _true;\n\n var constrainRect,\n matchingDroppables = [], intersectingDroppables = [];\n\n this.downListener = function(e) {\n var isNotRightClick = this.rightButtonCanDrag || (e.which !== 3 && e.button !== 2);\n if (isNotRightClick && this.isEnabled() && this.canDrag()) {\n var _f = _testFilter(e) && _inputFilter(e, this.el, this.k);\n if (_f) {\n if (!clone)\n dragEl = this.el;\n else {\n dragEl = this.el.cloneNode(true);\n dragEl.setAttribute(\"id\", null);\n dragEl.style.position = \"absolute\";\n // the clone node is added to the body; getOffsetRect gives us a value\n // relative to the body.\n var b = getOffsetRect(this.el);\n dragEl.style.left = b.left + \"px\";\n dragEl.style.top = b.top + \"px\";\n this.params.addClass(dragEl, _classes.clonedDrag);\n document.body.appendChild(dragEl);\n }\n consumeStartEvent && _consume(e);\n downAt = _pl(e);\n //\n this.params.bind(document, \"mousemove\", this.moveListener);\n this.params.bind(document, \"mouseup\", this.upListener);\n k.markSelection(this);\n k.markPosses(this);\n this.params.addClass(document.body, css.noSelect);\n _dispatch(\"beforeStart\", {el:this.el, pos:posAtDown, e:e, drag:this});\n }\n else if (this.params.consumeFilteredEvents) {\n _consume(e);\n }\n }\n }.bind(this);\n\n this.moveListener = function(e) {\n if (downAt) {\n if (!moving) {\n var _continue = _dispatch(\"start\", {el:this.el, pos:posAtDown, e:e, drag:this});\n if (_continue !== false) {\n if (!downAt) {\n return;\n }\n this.mark(true);\n moving = true;\n } else {\n this.abort();\n }\n }\n\n // it is possible that the start event caused the drag to be aborted. So we check\n // again that we are currently dragging.\n if (downAt) {\n intersectingDroppables.length = 0;\n var pos = _pl(e), dx = pos[0] - downAt[0], dy = pos[1] - downAt[1],\n z = this.params.ignoreZoom ? 1 : k.getZoom();\n dx /= z;\n dy /= z;\n this.moveBy(dx, dy, e);\n k.updateSelection(dx, dy, this);\n k.updatePosses(dx, dy, this);\n }\n }\n }.bind(this);\n\n this.upListener = function(e) {\n if (downAt) {\n downAt = null;\n this.params.unbind(document, \"mousemove\", this.moveListener);\n this.params.unbind(document, \"mouseup\", this.upListener);\n this.params.removeClass(document.body, css.noSelect);\n this.unmark(e);\n k.unmarkSelection(this, e);\n k.unmarkPosses(this, e);\n this.stop(e);\n k.notifySelectionDragStop(this, e);\n k.notifyPosseDragStop(this, e);\n moving = false;\n if (clone) {\n dragEl && dragEl.parentNode && dragEl.parentNode.removeChild(dragEl);\n dragEl = null;\n }\n\n intersectingDroppables.length = 0;\n\n if (revertFunction && revertFunction(this.el, this.params.getPosition(this.el)) === true) {\n this.params.setPosition(this.el, posAtDown);\n _dispatch(\"revert\", this.el);\n }\n }\n }.bind(this);\n\n this.getFilters = function() { return _filters; };\n\n this.abort = function() {\n if (downAt != null)\n this.upListener();\n };\n\n this.getDragElement = function() {\n return dragEl || this.el;\n };\n\n var listeners = {\"start\":[], \"drag\":[], \"stop\":[], \"over\":[], \"out\":[], \"beforeStart\":[], \"revert\":[] };\n if (params.events.start) listeners.start.push(params.events.start);\n if (params.events.beforeStart) listeners.beforeStart.push(params.events.beforeStart);\n if (params.events.stop) listeners.stop.push(params.events.stop);\n if (params.events.drag) listeners.drag.push(params.events.drag);\n if (params.events.revert) listeners.revert.push(params.events.revert);\n\n this.on = function(evt, fn) {\n if (listeners[evt]) listeners[evt].push(fn);\n };\n\n this.off = function(evt, fn) {\n if (listeners[evt]) {\n var l = [];\n for (var i = 0; i < listeners[evt].length; i++) {\n if (listeners[evt][i] !== fn) l.push(listeners[evt][i]);\n }\n listeners[evt] = l;\n }\n };\n\n var _dispatch = function(evt, value) {\n var result = null;\n if (listeners[evt]) {\n for (var i = 0; i < listeners[evt].length; i++) {\n try {\n var v = listeners[evt][i](value);\n if (v != null) {\n result = v;\n }\n }\n catch (e) { }\n }\n }\n return result;\n };\n\n this.notifyStart = function(e) {\n _dispatch(\"start\", {el:this.el, pos:this.params.getPosition(dragEl), e:e, drag:this});\n };\n\n this.stop = function(e, force) {\n if (force || moving) {\n var positions = [],\n sel = k.getSelection(),\n dPos = this.params.getPosition(dragEl);\n\n if (sel.length > 1) {\n for (var i = 0; i < sel.length; i++) {\n var p = this.params.getPosition(sel[i].el);\n positions.push([ sel[i].el, { left: p[0], top: p[1] }, sel[i] ]);\n }\n }\n else {\n positions.push([ dragEl, {left:dPos[0], top:dPos[1]}, this ]);\n }\n\n _dispatch(\"stop\", {\n el: dragEl,\n pos: ghostProxyOffsets || dPos,\n finalPos:dPos,\n e: e,\n drag: this,\n selection:positions\n });\n }\n };\n\n this.mark = function(andNotify) {\n posAtDown = this.params.getPosition(dragEl);\n pagePosAtDown = this.params.getPosition(dragEl, true);\n pageDelta = [pagePosAtDown[0] - posAtDown[0], pagePosAtDown[1] - posAtDown[1]];\n this.size = this.params.getSize(dragEl);\n matchingDroppables = k.getMatchingDroppables(this);\n _setDroppablesActive(matchingDroppables, true, false, this);\n this.params.addClass(dragEl, this.params.dragClass || css.drag);\n\n var cs;\n if (this.params.getConstrainingRectangle) {\n cs = this.params.getConstrainingRectangle(dragEl)\n } else {\n cs = this.params.getSize(dragEl.parentNode);\n }\n constrainRect = {w: cs[0], h: cs[1]};\n\n if (andNotify) {\n k.notifySelectionDragStart(this);\n }\n };\n var ghostProxyOffsets;\n this.unmark = function(e, doNotCheckDroppables) {\n _setDroppablesActive(matchingDroppables, false, true, this);\n\n if (isConstrained && useGhostProxy(this.el)) {\n ghostProxyOffsets = [dragEl.offsetLeft, dragEl.offsetTop];\n this.el.parentNode.removeChild(dragEl);\n dragEl = this.el;\n }\n else {\n ghostProxyOffsets = null;\n }\n\n this.params.removeClass(dragEl, this.params.dragClass || css.drag);\n matchingDroppables.length = 0;\n isConstrained = false;\n if (!doNotCheckDroppables) {\n if (intersectingDroppables.length > 0 && ghostProxyOffsets) {\n params.setPosition(this.el, ghostProxyOffsets);\n }\n intersectingDroppables.sort(_rankSort);\n for (var i = 0; i < intersectingDroppables.length; i++) {\n var retVal = intersectingDroppables[i].drop(this, e);\n if (retVal === true) break;\n }\n }\n };\n this.moveBy = function(dx, dy, e) {\n intersectingDroppables.length = 0;\n var desiredLoc = this.toGrid([posAtDown[0] + dx, posAtDown[1] + dy]),\n cPos = constrain(desiredLoc, dragEl);\n\n if (useGhostProxy(this.el)) {\n if (desiredLoc[0] !== cPos[0] || desiredLoc[1] !== cPos[1]) {\n if (!isConstrained) {\n var gp = ghostProxy(this.el);\n params.addClass(gp, _classes.ghostProxy);\n this.el.parentNode.appendChild(gp);\n dragEl = gp;\n isConstrained = true;\n }\n cPos = desiredLoc;\n }\n else {\n if (isConstrained) {\n this.el.parentNode.removeChild(dragEl);\n dragEl = this.el;\n isConstrained = false;\n }\n }\n }\n\n var rect = { x:cPos[0], y:cPos[1], w:this.size[0], h:this.size[1]},\n pageRect = { x:rect.x + pageDelta[0], y:rect.y + pageDelta[1], w:rect.w, h:rect.h},\n focusDropElement = null;\n\n\n\n this.params.setPosition(dragEl, cPos);\n for (var i = 0; i < matchingDroppables.length; i++) {\n var r2 = { x:matchingDroppables[i].pagePosition[0], y:matchingDroppables[i].pagePosition[1], w:matchingDroppables[i].size[0], h:matchingDroppables[i].size[1]};\n if (this.params.intersects(pageRect, r2) && (_multipleDrop || focusDropElement == null || focusDropElement === matchingDroppables[i].el) && matchingDroppables[i].canDrop(this)) {\n if (!focusDropElement) focusDropElement = matchingDroppables[i].el;\n intersectingDroppables.push(matchingDroppables[i]);\n matchingDroppables[i].setHover(this, true, e);\n }\n else if (matchingDroppables[i].isHover()) {\n matchingDroppables[i].setHover(this, false, e);\n }\n }\n\n _dispatch(\"drag\", {el:this.el, pos:cPos, e:e, drag:this});\n\n /* test to see if the parent needs to be scrolled (future)\n if (scroll) {\n var pnsl = dragEl.parentNode.scrollLeft, pnst = dragEl.parentNode.scrollTop;\n console.log(\"scroll!\", pnsl, pnst);\n }*/\n };\n this.destroy = function() {\n this.params.unbind(this.el, \"mousedown\", this.downListener);\n this.params.unbind(document, \"mousemove\", this.moveListener);\n this.params.unbind(document, \"mouseup\", this.upListener);\n this.downListener = null;\n this.upListener = null;\n this.moveListener = null;\n };\n\n // init:register mousedown, and perhaps set a filter\n this.params.bind(this.el, \"mousedown\", this.downListener);\n\n // if handle provded, use that. otherwise, try to set a filter.\n // note that a `handle` selector always results in filterExclude being set to false, ie.\n // the selector defines the handle element(s).\n if (this.params.handle)\n _setFilter(this.params.handle, false);\n else\n _setFilter(this.params.filter, this.params.filterExclude);\n };\n\n var Drop = function(el, params, css, scope) {\n this._class = css.droppable;\n this.params = params || {};\n this.rank = params.rank || 0;\n this._activeClass = this.params.activeClass || css.active;\n this._hoverClass = this.params.hoverClass || css.hover;\n Super.apply(this, arguments);\n var hover = false;\n this.allowLoopback = this.params.allowLoopback !== false;\n\n this.setActive = function(val) {\n this.params[val ? \"addClass\" : \"removeClass\"](this.el, this._activeClass);\n };\n\n this.updatePosition = function() {\n this.position = this.params.getPosition(this.el);\n this.pagePosition = this.params.getPosition(this.el, true);\n this.size = this.params.getSize(this.el);\n };\n\n this.canDrop = this.params.canDrop || function(drag) {\n return true;\n };\n\n this.isHover = function() { return hover; };\n\n this.setHover = function(drag, val, e) {\n // if turning off hover but this was not the drag that caused the hover, ignore.\n if (val || this.el._katavorioDragHover == null || this.el._katavorioDragHover === drag.el._katavorio) {\n this.params[val ? \"addClass\" : \"removeClass\"](this.el, this._hoverClass);\n //this.el._katavorioDragHover = val ? drag.el._katavorio : null;\n this.el._katavorioDragHover = val ? drag.el._katavorio : null;\n if (hover !== val)\n this.params.events[val ? \"over\" : \"out\"]({el:this.el, e:e, drag:drag, drop:this});\n hover = val;\n }\n };\n\n this.drop = function(drag, event) {\n return this.params.events[\"drop\"]({ drag:drag, e:event, drop:this });\n };\n\n this.destroy = function() {\n this._class = null;\n this._activeClass = null;\n this._hoverClass = null;\n //this.params = null;\n hover = null;\n //this.el = null;\n };\n };\n\n var _uuid = function() {\n return ('xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {\n var r = Math.random()*16|0, v = c === 'x' ? r : (r&0x3|0x8);\n return v.toString(16);\n }));\n };\n\n var _rankSort = function(a,b) {\n return a.rank < b.rank ? 1 : a.rank > b.rank ? -1 : 0;\n };\n\n var _gel = function(el) {\n if (el == null) return null;\n el = (typeof el === \"string\" || el.constructor === String) ? document.getElementById(el) : el;\n if (el == null) return null;\n el._katavorio = el._katavorio || _uuid();\n return el;\n };\n\n root.Katavorio = function(katavorioParams) {\n\n var _selection = [],\n _selectionMap = {};\n\n this._dragsByScope = {};\n this._dropsByScope = {};\n var _zoom = 1,\n _reg = function(obj, map) {\n _each(obj, function(_obj) {\n for(var i = 0; i < _obj.scopes.length; i++) {\n map[_obj.scopes[i]] = map[_obj.scopes[i]] || [];\n map[_obj.scopes[i]].push(_obj);\n }\n });\n },\n _unreg = function(obj, map) {\n var c = 0;\n _each(obj, function(_obj) {\n for(var i = 0; i < _obj.scopes.length; i++) {\n if (map[_obj.scopes[i]]) {\n var idx = katavorioParams.indexOf(map[_obj.scopes[i]], _obj);\n if (idx !== -1) {\n map[_obj.scopes[i]].splice(idx, 1);\n c++;\n }\n }\n }\n });\n\n return c > 0 ;\n },\n _getMatchingDroppables = this.getMatchingDroppables = function(drag) {\n var dd = [], _m = {};\n for (var i = 0; i < drag.scopes.length; i++) {\n var _dd = this._dropsByScope[drag.scopes[i]];\n if (_dd) {\n for (var j = 0; j < _dd.length; j++) {\n if (_dd[j].canDrop(drag) && !_m[_dd[j].uuid] && (_dd[j].allowLoopback || _dd[j].el !== drag.el)) {\n _m[_dd[j].uuid] = true;\n dd.push(_dd[j]);\n }\n }\n }\n }\n dd.sort(_rankSort);\n return dd;\n },\n _prepareParams = function(p) {\n p = p || {};\n var _p = {\n events:{}\n }, i;\n for (i in katavorioParams) _p[i] = katavorioParams[i];\n for (i in p) _p[i] = p[i];\n // events\n\n for (i = 0; i < _events.length; i++) {\n _p.events[_events[i]] = p[_events[i]] || _devNull;\n }\n _p.katavorio = this;\n return _p;\n }.bind(this),\n _mistletoe = function(existingDrag, params) {\n for (var i = 0; i < _events.length; i++) {\n if (params[_events[i]]) {\n existingDrag.on(_events[i], params[_events[i]]);\n }\n }\n }.bind(this),\n _css = {},\n overrideCss = katavorioParams.css || {},\n _scope = katavorioParams.scope || _defaultScope;\n\n // prepare map of css classes based on defaults frst, then optional overrides\n for (var i in _classes) _css[i] = _classes[i];\n for (var i in overrideCss) _css[i] = overrideCss[i];\n\n var inputFilterSelector = katavorioParams.inputFilterSelector || _defaultInputFilterSelector;\n /**\n * Gets the selector identifying which input elements to filter from drag events.\n * @method getInputFilterSelector\n * @return {String} Current input filter selector.\n */\n this.getInputFilterSelector = function() { return inputFilterSelector; };\n\n /**\n * Sets the selector identifying which input elements to filter from drag events.\n * @method setInputFilterSelector\n * @param {String} selector Input filter selector to set.\n * @return {Katavorio} Current instance; method may be chained.\n */\n this.setInputFilterSelector = function(selector) {\n inputFilterSelector = selector;\n return this;\n };\n\n this.draggable = function(el, params) {\n var o = [];\n _each(el, function(_el) {\n _el = _gel(_el);\n if (_el != null) {\n if (_el._katavorioDrag == null) {\n var p = _prepareParams(params);\n _el._katavorioDrag = new Drag(_el, p, _css, _scope);\n _reg(_el._katavorioDrag, this._dragsByScope);\n o.push(_el._katavorioDrag);\n katavorioParams.addClass(_el, _css.draggable);\n }\n else {\n _mistletoe(_el._katavorioDrag, params);\n }\n }\n }.bind(this));\n return o;\n\n };\n\n this.droppable = function(el, params) {\n var o = [];\n _each(el, function(_el) {\n _el = _gel(_el);\n if (_el != null) {\n var drop = new Drop(_el, _prepareParams(params), _css, _scope);\n _el._katavorioDrop = _el._katavorioDrop || [];\n _el._katavorioDrop.push(drop);\n _reg(drop, this._dropsByScope);\n o.push(drop);\n katavorioParams.addClass(_el, _css.droppable);\n }\n }.bind(this));\n return o;\n };\n\n /**\n * @name Katavorio#select\n * @function\n * @desc Adds an element to the current selection (for multiple node drag)\n * @param {Element|String} DOM element - or id of the element - to add.\n */\n this.select = function(el) {\n _each(el, function() {\n var _el = _gel(this);\n if (_el && _el._katavorioDrag) {\n if (!_selectionMap[_el._katavorio]) {\n _selection.push(_el._katavorioDrag);\n _selectionMap[_el._katavorio] = [ _el, _selection.length - 1 ];\n katavorioParams.addClass(_el, _css.selected);\n }\n }\n });\n return this;\n };\n\n /**\n * @name Katavorio#deselect\n * @function\n * @desc Removes an element from the current selection (for multiple node drag)\n * @param {Element|String} DOM element - or id of the element - to remove.\n */\n this.deselect = function(el) {\n _each(el, function() {\n var _el = _gel(this);\n if (_el && _el._katavorio) {\n var e = _selectionMap[_el._katavorio];\n if (e) {\n var _s = [];\n for (var i = 0; i < _selection.length; i++)\n if (_selection[i].el !== _el) _s.push(_selection[i]);\n _selection = _s;\n delete _selectionMap[_el._katavorio];\n katavorioParams.removeClass(_el, _css.selected);\n }\n }\n });\n return this;\n };\n\n this.deselectAll = function() {\n for (var i in _selectionMap) {\n var d = _selectionMap[i];\n katavorioParams.removeClass(d[0], _css.selected);\n }\n\n _selection.length = 0;\n _selectionMap = {};\n };\n\n this.markSelection = function(drag) {\n _foreach(_selection, function(e) { e.mark(); }, drag);\n };\n\n this.markPosses = function(drag) {\n if (drag.posses) {\n _each(drag.posses, function(p) {\n if (drag.posseRoles[p] && _posses[p]) {\n _foreach(_posses[p].members, function (d) {\n d.mark();\n }, drag);\n }\n })\n }\n };\n\n this.unmarkSelection = function(drag, event) {\n _foreach(_selection, function(e) { e.unmark(event); }, drag);\n };\n\n this.unmarkPosses = function(drag, event) {\n if (drag.posses) {\n _each(drag.posses, function(p) {\n if (drag.posseRoles[p] && _posses[p]) {\n _foreach(_posses[p].members, function (d) {\n d.unmark(event, true);\n }, drag);\n }\n });\n }\n };\n\n this.getSelection = function() { return _selection.slice(0); };\n\n this.updateSelection = function(dx, dy, drag) {\n _foreach(_selection, function(e) { e.moveBy(dx, dy); }, drag);\n };\n\n var _posseAction = function(fn, drag) {\n if (drag.posses) {\n _each(drag.posses, function(p) {\n if (drag.posseRoles[p] && _posses[p]) {\n _foreach(_posses[p].members, function (e) {\n fn(e);\n }, drag);\n }\n });\n }\n };\n\n this.updatePosses = function(dx, dy, drag) {\n _posseAction(function(e) { e.moveBy(dx, dy); }, drag);\n };\n\n this.notifyPosseDragStop = function(drag, evt) {\n _posseAction(function(e) { e.stop(evt, true); }, drag);\n };\n\n this.notifySelectionDragStop = function(drag, evt) {\n _foreach(_selection, function(e) { e.stop(evt, true); }, drag);\n };\n\n this.notifySelectionDragStart = function(drag, evt) {\n _foreach(_selection, function(e) { e.notifyStart(evt);}, drag);\n };\n\n this.setZoom = function(z) { _zoom = z; };\n this.getZoom = function() { return _zoom; };\n\n // does the work of changing scopes\n var _scopeManip = function(kObj, scopes, map, fn) {\n _each(kObj, function(_kObj) {\n _unreg(_kObj, map); // deregister existing scopes\n _kObj[fn](scopes); // set scopes\n _reg(_kObj, map); // register new ones\n });\n };\n\n _each([ \"set\", \"add\", \"remove\", \"toggle\"], function(v) {\n this[v + \"Scope\"] = function(el, scopes) {\n _scopeManip(el._katavorioDrag, scopes, this._dragsByScope, v + \"Scope\");\n _scopeManip(el._katavorioDrop, scopes, this._dropsByScope, v + \"Scope\");\n }.bind(this);\n this[v + \"DragScope\"] = function(el, scopes) {\n _scopeManip(el.constructor === Drag ? el : el._katavorioDrag, scopes, this._dragsByScope, v + \"Scope\");\n }.bind(this);\n this[v + \"DropScope\"] = function(el, scopes) {\n _scopeManip(el.constructor === Drop ? el : el._katavorioDrop, scopes, this._dropsByScope, v + \"Scope\");\n }.bind(this);\n }.bind(this));\n\n this.snapToGrid = function(x, y) {\n for (var s in this._dragsByScope) {\n _foreach(this._dragsByScope[s], function(d) { d.snap(x, y); });\n }\n };\n\n this.getDragsForScope = function(s) { return this._dragsByScope[s]; };\n this.getDropsForScope = function(s) { return this._dropsByScope[s]; };\n\n var _destroy = function(el, type, map) {\n el = _gel(el);\n if (el[type]) {\n\n // remove from selection, if present.\n var selIdx = _selection.indexOf(el[type]);\n if (selIdx >= 0) {\n _selection.splice(selIdx, 1);\n }\n\n if (_unreg(el[type], map)) {\n _each(el[type], function(kObj) { kObj.destroy() });\n }\n\n delete el[type];\n }\n };\n\n var _removeListener = function(el, type, evt, fn) {\n el = _gel(el);\n if (el[type]) {\n el[type].off(evt, fn);\n }\n };\n\n this.elementRemoved = function(el) {\n this.destroyDraggable(el);\n this.destroyDroppable(el);\n };\n\n /**\n * Either completely remove drag functionality from the given element, or remove a specific event handler. If you\n * call this method with a single argument - the element - all drag functionality is removed from it. Otherwise, if\n * you provide an event name and listener function, this function is de-registered (if found).\n * @param el Element to update\n * @param {string} [evt] Optional event name to unsubscribe\n * @param {Function} [fn] Optional function to unsubscribe\n */\n this.destroyDraggable = function(el, evt, fn) {\n if (arguments.length === 1) {\n _destroy(el, \"_katavorioDrag\", this._dragsByScope);\n } else {\n _removeListener(el, \"_katavorioDrag\", evt, fn);\n }\n };\n\n /**\n * Either completely remove drop functionality from the given element, or remove a specific event handler. If you\n * call this method with a single argument - the element - all drop functionality is removed from it. Otherwise, if\n * you provide an event name and listener function, this function is de-registered (if found).\n * @param el Element to update\n * @param {string} [evt] Optional event name to unsubscribe\n * @param {Function} [fn] Optional function to unsubscribe\n */\n this.destroyDroppable = function(el, evt, fn) {\n if (arguments.length === 1) {\n _destroy(el, \"_katavorioDrop\", this._dropsByScope);\n } else {\n _removeListener(el, \"_katavorioDrop\", evt, fn);\n }\n };\n\n this.reset = function() {\n this._dragsByScope = {};\n this._dropsByScope = {};\n _selection = [];\n _selectionMap = {};\n _posses = {};\n };\n\n // ----- groups\n var _posses = {};\n\n var _processOneSpec = function(el, _spec, dontAddExisting) {\n var posseId = _isString(_spec) ? _spec : _spec.id;\n var active = _isString(_spec) ? true : _spec.active !== false;\n var posse = _posses[posseId] || (function() {\n var g = {name:posseId, members:[]};\n _posses[posseId] = g;\n return g;\n })();\n _each(el, function(_el) {\n if (_el._katavorioDrag) {\n\n if (dontAddExisting && _el._katavorioDrag.posseRoles[posse.name] != null) return;\n\n _suggest(posse.members, _el._katavorioDrag);\n _suggest(_el._katavorioDrag.posses, posse.name);\n _el._katavorioDrag.posseRoles[posse.name] = active;\n }\n });\n return posse;\n };\n\n /**\n * Add the given element to the posse with the given id, creating the group if it at first does not exist.\n * @method addToPosse\n * @param {Element} el Element to add.\n * @param {String...|Object...} spec Variable args parameters. Each argument can be a either a String, indicating\n * the ID of a Posse to which the element should be added as an active participant, or an Object containing\n * `{ id:\"posseId\", active:false/true}`. In the latter case, if `active` is not provided it is assumed to be\n * true.\n * @returns {Posse|Posse[]} The Posse(s) to which the element(s) was/were added.\n */\n this.addToPosse = function(el, spec) {\n\n var posses = [];\n\n for (var i = 1; i < arguments.length; i++) {\n posses.push(_processOneSpec(el, arguments[i]));\n }\n\n return posses.length === 1 ? posses[0] : posses;\n };\n\n /**\n * Sets the posse(s) for the element with the given id, creating those that do not yet exist, and removing from\n * the element any current Posses that are not specified by this method call. This method will not change the\n * active/passive state if it is given a posse in which the element is already a member.\n * @method setPosse\n * @param {Element} el Element to set posse(s) on.\n * @param {String...|Object...} spec Variable args parameters. Each argument can be a either a String, indicating\n * the ID of a Posse to which the element should be added as an active participant, or an Object containing\n * `{ id:\"posseId\", active:false/true}`. In the latter case, if `active` is not provided it is assumed to be\n * true.\n * @returns {Posse|Posse[]} The Posse(s) to which the element(s) now belongs.\n */\n this.setPosse = function(el, spec) {\n\n var posses = [];\n\n for (var i = 1; i < arguments.length; i++) {\n posses.push(_processOneSpec(el, arguments[i], true).name);\n }\n\n _each(el, function(_el) {\n if (_el._katavorioDrag) {\n var diff = _difference(_el._katavorioDrag.posses, posses);\n var p = [];\n Array.prototype.push.apply(p, _el._katavorioDrag.posses);\n for (var i = 0; i < diff.length; i++) {\n this.removeFromPosse(_el, diff[i]);\n }\n }\n }.bind(this));\n\n return posses.length === 1 ? posses[0] : posses;\n };\n\n /**\n * Remove the given element from the given posse(s).\n * @method removeFromPosse\n * @param {Element} el Element to remove.\n * @param {String...} posseId Varargs parameter: one value for each posse to remove the element from.\n */\n this.removeFromPosse = function(el, posseId) {\n if (arguments.length < 2) throw new TypeError(\"No posse id provided for remove operation\");\n for(var i = 1; i < arguments.length; i++) {\n posseId = arguments[i];\n _each(el, function (_el) {\n if (_el._katavorioDrag && _el._katavorioDrag.posses) {\n var d = _el._katavorioDrag;\n _each(posseId, function (p) {\n _vanquish(_posses[p].members, d);\n _vanquish(d.posses, p);\n delete d.posseRoles[p];\n });\n }\n });\n }\n };\n\n /**\n * Remove the given element from all Posses to which it belongs.\n * @method removeFromAllPosses\n * @param {Element|Element[]} el Element to remove from Posses.\n */\n this.removeFromAllPosses = function(el) {\n _each(el, function(_el) {\n if (_el._katavorioDrag && _el._katavorioDrag.posses) {\n var d = _el._katavorioDrag;\n _each(d.posses, function(p) {\n _vanquish(_posses[p].members, d);\n });\n d.posses.length = 0;\n d.posseRoles = {};\n }\n });\n };\n\n /**\n * Changes the participation state for the element in the Posse with the given ID.\n * @param {Element|Element[]} el Element(s) to change state for.\n * @param {String} posseId ID of the Posse to change element state for.\n * @param {Boolean} state True to make active, false to make passive.\n */\n this.setPosseState = function(el, posseId, state) {\n var posse = _posses[posseId];\n if (posse) {\n _each(el, function(_el) {\n if (_el._katavorioDrag && _el._katavorioDrag.posses) {\n _el._katavorioDrag.posseRoles[posse.name] = state;\n }\n });\n }\n };\n\n };\n\n root.Katavorio.version = \"0.23.0\";\n\n if (typeof exports !== \"undefined\") {\n exports.Katavorio = root.Katavorio;\n }\n\n}).call(typeof window !== 'undefined' ? window : this);\n\n/*\n * This file contains utility functions that run in both browsers and headless.\n *\n * Copyright (c) 2010 - 2018 jsPlumb (hello@jsplumbtoolkit.com)\n *\n * https://jsplumbtoolkit.com\n * https://github.com/jsplumb/jsplumb\n *\n * Dual licensed under the MIT and GPL2 licenses.\n */\n\n;\n(function () {\n\n var _isa = function (a) {\n return Object.prototype.toString.call(a) === \"[object Array]\";\n },\n _isnum = function (n) {\n return Object.prototype.toString.call(n) === \"[object Number]\";\n },\n _iss = function (s) {\n return typeof s === \"string\";\n },\n _isb = function (s) {\n return typeof s === \"boolean\";\n },\n _isnull = function (s) {\n return s == null;\n },\n _iso = function (o) {\n return o == null ? false : Object.prototype.toString.call(o) === \"[object Object]\";\n },\n _isd = function (o) {\n return Object.prototype.toString.call(o) === \"[object Date]\";\n },\n _isf = function (o) {\n return Object.prototype.toString.call(o) === \"[object Function]\";\n },\n _isNamedFunction = function(o) {\n return _isf(o) && o.name != null && o.name.length > 0;\n },\n _ise = function (o) {\n for (var i in o) {\n if (o.hasOwnProperty(i)) {\n return false;\n }\n }\n return true;\n };\n\n var root = this;\n root.jsPlumbUtil = {\n isArray: _isa,\n isString: _iss,\n isBoolean: _isb,\n isNull: _isnull,\n isObject: _iso,\n isDate: _isd,\n isFunction: _isf,\n isEmpty: _ise,\n isNumber: _isnum,\n clone: function (a) {\n if (_iss(a)) {\n return \"\" + a;\n }\n else if (_isb(a)) {\n return !!a;\n }\n else if (_isd(a)) {\n return new Date(a.getTime());\n }\n else if (_isf(a)) {\n return a;\n }\n else if (_isa(a)) {\n var b = [];\n for (var i = 0; i < a.length; i++) {\n b.push(this.clone(a[i]));\n }\n return b;\n }\n else if (_iso(a)) {\n var c = {};\n for (var j in a) {\n c[j] = this.clone(a[j]);\n }\n return c;\n }\n else {\n return a;\n }\n },\n merge: function (a, b, collations) {\n // first change the collations array - if present - into a lookup table, because its faster.\n var cMap = {}, ar, i;\n collations = collations || [];\n for (i = 0; i < collations.length; i++) {\n cMap[collations[i]] = true;\n }\n\n var c = this.clone(a);\n for (i in b) {\n if (c[i] == null) {\n c[i] = b[i];\n }\n else if (_iss(b[i]) || _isb(b[i])) {\n if (!cMap[i]) {\n c[i] = b[i]; // if we dont want to collate, just copy it in.\n }\n else {\n ar = [];\n // if c's object is also an array we can keep its values.\n ar.push.apply(ar, _isa(c[i]) ? c[i] : [ c[i] ]);\n ar.push.apply(ar, _isa(b[i]) ? b[i] : [ b[i] ]);\n c[i] = ar;\n }\n }\n else {\n if (_isa(b[i])) {\n ar = [];\n // if c's object is also an array we can keep its values.\n if (_isa(c[i])) {\n ar.push.apply(ar, c[i]);\n }\n ar.push.apply(ar, b[i]);\n c[i] = ar;\n }\n else if (_iso(b[i])) {\n // overwite c's value with an object if it is not already one.\n if (!_iso(c[i])) {\n c[i] = {};\n }\n for (var j in b[i]) {\n c[i][j] = b[i][j];\n }\n }\n }\n\n }\n return c;\n },\n replace: function (inObj, path, value) {\n if (inObj == null) {\n return;\n }\n var q = inObj, t = q;\n path.replace(/([^\\.])+/g, function (term, lc, pos, str) {\n var array = term.match(/([^\\[0-9]+){1}(\\[)([0-9+])/),\n last = pos + term.length >= str.length,\n _getArray = function () {\n return t[array[1]] || (function () {\n t[array[1]] = [];\n return t[array[1]];\n })();\n };\n\n if (last) {\n // set term = value on current t, creating term as array if necessary.\n if (array) {\n _getArray()[array[3]] = value;\n }\n else {\n t[term] = value;\n }\n }\n else {\n // set to current t[term], creating t[term] if necessary.\n if (array) {\n var a = _getArray();\n t = a[array[3]] || (function () {\n a[array[3]] = {};\n return a[array[3]];\n })();\n }\n else {\n t = t[term] || (function () {\n t[term] = {};\n return t[term];\n })();\n }\n }\n });\n\n return inObj;\n },\n //\n // chain a list of functions, supplied by [ object, method name, args ], and return on the first\n // one that returns the failValue. if none return the failValue, return the successValue.\n //\n functionChain: function (successValue, failValue, fns) {\n for (var i = 0; i < fns.length; i++) {\n var o = fns[i][0][fns[i][1]].apply(fns[i][0], fns[i][2]);\n if (o === failValue) {\n return o;\n }\n }\n return successValue;\n },\n // take the given model and expand out any parameters.\n // 'functionPrefix' is optional, and if present, helps jsplumb figure out what to do if a value is a Function.\n // if you do not provide it, jsplumb will run the given values through any functions it finds, and use the function's\n // output as the value in the result. if you do provide the prefix, only functions that are named and have this prefix\n // will be executed; other functions will be passed as values to the output.\n populate: function (model, values, functionPrefix) {\n // for a string, see if it has parameter matches, and if so, try to make the substitutions.\n var getValue = function (fromString) {\n var matches = fromString.match(/(\\${.*?})/g);\n if (matches != null) {\n for (var i = 0; i < matches.length; i++) {\n var val = values[matches[i].substring(2, matches[i].length - 1)] || \"\";\n if (val != null) {\n fromString = fromString.replace(matches[i], val);\n }\n }\n }\n return fromString;\n },\n // process one entry.\n _one = function (d) {\n if (d != null) {\n if (_iss(d)) {\n return getValue(d);\n }\n else if (_isf(d) && (functionPrefix == null || (d.name || \"\").indexOf(functionPrefix) === 0)) {\n return d(values);\n }\n else if (_isa(d)) {\n var r = [];\n for (var i = 0; i < d.length; i++) {\n r.push(_one(d[i]));\n }\n return r;\n }\n else if (_iso(d)) {\n var s = {};\n for (var j in d) {\n s[j] = _one(d[j]);\n }\n return s;\n }\n else {\n return d;\n }\n }\n };\n\n return _one(model);\n },\n findWithFunction: function (a, f) {\n // CONVERTED\n if (a) {\n for (var i = 0; i < a.length; i++) {\n if (f(a[i])) {\n return i;\n }\n }\n }\n return -1;\n },\n removeWithFunction: function (a, f) {\n // CONVERTED\n var idx = root.jsPlumbUtil.findWithFunction(a, f);\n if (idx > -1) {\n a.splice(idx, 1);\n }\n return idx !== -1;\n },\n remove: function (l, v) {\n // CONVERTED\n var idx = l.indexOf(v);\n if (idx > -1) {\n l.splice(idx, 1);\n }\n return idx !== -1;\n },\n // TODO support insert index\n addWithFunction: function (list, item, hashFunction) {\n if (root.jsPlumbUtil.findWithFunction(list, hashFunction) === -1) {\n list.push(item);\n }\n },\n addToList: function (map, key, value, insertAtStart) {\n var l = map[key];\n if (l == null) {\n l = [];\n map[key] = l;\n }\n l[insertAtStart ? \"unshift\" : \"push\"](value);\n return l;\n },\n suggest : function(list, item, insertAtHead) {\n if (list.indexOf(item) === -1) {\n if (insertAtHead) {\n list.unshift(item);\n } else {\n list.push(item);\n }\n return true;\n }\n return false;\n },\n //\n // extends the given obj (which can be an array) with the given constructor function, prototype functions, and\n // class members, any of which may be null.\n //\n extend: function (child, parent, _protoFn) {\n var i;\n parent = _isa(parent) ? parent : [ parent ];\n\n for (i = 0; i < parent.length; i++) {\n for (var j in parent[i].prototype) {\n if (parent[i].prototype.hasOwnProperty(j)) {\n child.prototype[j] = parent[i].prototype[j];\n }\n }\n }\n\n var _makeFn = function (name, protoFn) {\n return function () {\n for (i = 0; i < parent.length; i++) {\n if (parent[i].prototype[name]) {\n parent[i].prototype[name].apply(this, arguments);\n }\n }\n return protoFn.apply(this, arguments);\n };\n };\n\n var _oneSet = function (fns) {\n for (var k in fns) {\n child.prototype[k] = _makeFn(k, fns[k]);\n }\n };\n\n if (arguments.length > 2) {\n for (i = 2; i < arguments.length; i++) {\n _oneSet(arguments[i]);\n }\n }\n\n return child;\n },\n uuid: function () {\n return ('xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {\n var r = Math.random() * 16 | 0, v = c === 'x' ? r : (r & 0x3 | 0x8);\n return v.toString(16);\n }));\n },\n logEnabled: true,\n log: function () {\n if (root.jsPlumbUtil.logEnabled && typeof console !== \"undefined\") {\n try {\n var msg = arguments[arguments.length - 1];\n console.log(msg);\n }\n catch (e) {\n }\n }\n },\n\n /**\n * Wraps one function with another, creating a placeholder for the\n * wrapped function if it was null. this is used to wrap the various\n * drag/drop event functions - to allow jsPlumb to be notified of\n * important lifecycle events without imposing itself on the user's\n * drag/drop functionality.\n * @method jsPlumbUtil.wrap\n * @param {Function} wrappedFunction original function to wrap; may be null.\n * @param {Function} newFunction function to wrap the original with.\n * @param {Object} [returnOnThisValue] Optional. Indicates that the wrappedFunction should\n * not be executed if the newFunction returns a value matching 'returnOnThisValue'.\n * note that this is a simple comparison and only works for primitives right now.\n */\n wrap: function (wrappedFunction, newFunction, returnOnThisValue) {\n return function () {\n var r = null;\n try {\n if (newFunction != null) {\n r = newFunction.apply(this, arguments);\n }\n } catch (e) {\n root.jsPlumbUtil.log(\"jsPlumb function failed : \" + e);\n }\n if ((wrappedFunction != null) && (returnOnThisValue == null || (r !== returnOnThisValue))) {\n try {\n r = wrappedFunction.apply(this, arguments);\n } catch (e) {\n root.jsPlumbUtil.log(\"wrapped function failed : \" + e);\n }\n }\n return r;\n };\n }\n };\n\n root.jsPlumbUtil.EventGenerator = function () {\n var _listeners = {},\n eventsSuspended = false,\n tick = false,\n // this is a list of events that should re-throw any errors that occur during their dispatch. it is current private.\n eventsToDieOn = { \"ready\": true },\n queue = [];\n\n this.bind = function (event, listener, insertAtStart) {\n var _one = function(evt) {\n root.jsPlumbUtil.addToList(_listeners, evt, listener, insertAtStart);\n listener.__jsPlumb = listener.__jsPlumb || {};\n listener.__jsPlumb[root.jsPlumbUtil.uuid()] = evt;\n };\n\n if (typeof event === \"string\") {\n _one(event);\n }\n else if (event.length != null) {\n for (var i = 0; i < event.length; i++) {\n _one(event[i]);\n }\n }\n\n return this;\n };\n\n this.fire = function (event, value, originalEvent) {\n if (!tick) {\n tick = true;\n if (!eventsSuspended && _listeners[event]) {\n var l = _listeners[event].length, i = 0, _gone = false, ret = null;\n if (!this.shouldFireEvent || this.shouldFireEvent(event, value, originalEvent)) {\n while (!_gone && i < l && ret !== false) {\n // doing it this way rather than catching and then possibly re-throwing means that an error propagated by this\n // method will have the whole call stack available in the debugger.\n if (eventsToDieOn[event]) {\n _listeners[event][i].apply(this, [value, originalEvent]);\n }\n else {\n try {\n ret = _listeners[event][i].apply(this, [value, originalEvent]);\n } catch (e) {\n root.jsPlumbUtil.log(\"jsPlumb: fire failed for event \" + event + \" : \" + e);\n }\n }\n i++;\n if (_listeners == null || _listeners[event] == null) {\n _gone = true;\n }\n }\n }\n }\n tick = false;\n _drain();\n } else {\n queue.unshift(arguments);\n }\n return this;\n };\n\n var _drain = function() {\n var n = queue.pop();\n if (n) {\n this.fire.apply(this, n);\n }\n }.bind(this);\n\n this.unbind = function (eventOrListener, listener) {\n\n if (arguments.length === 0) {\n _listeners = {};\n }\n else if (arguments.length === 1) {\n if (typeof eventOrListener === \"string\") {\n delete _listeners[eventOrListener];\n }\n else if (eventOrListener.__jsPlumb) {\n var evt;\n for (var i in eventOrListener.__jsPlumb) {\n evt = eventOrListener.__jsPlumb[i];\n root.jsPlumbUtil.remove(_listeners[evt] || [], eventOrListener);\n }\n }\n }\n else if (arguments.length === 2) {\n root.jsPlumbUtil.remove(_listeners[eventOrListener] || [], listener);\n }\n\n return this;\n };\n\n this.getListener = function (forEvent) {\n return _listeners[forEvent];\n };\n this.setSuspendEvents = function (val) {\n eventsSuspended = val;\n };\n this.isSuspendEvents = function () {\n return eventsSuspended;\n };\n this.silently = function(fn) {\n this.setSuspendEvents(true);\n try {\n fn();\n }\n catch (e) {\n root.jsPlumbUtil.log(\"Cannot execute silent function \" + e);\n }\n this.setSuspendEvents(false);\n };\n this.cleanupListeners = function () {\n for (var i in _listeners) {\n _listeners[i] = null;\n }\n };\n };\n\n root.jsPlumbUtil.EventGenerator.prototype = {\n cleanup: function () {\n this.cleanupListeners();\n }\n };\n\n if (typeof exports !== \"undefined\") {\n exports.jsPlumbUtil = root.jsPlumbUtil;\n }\n\n}).call(typeof window !== 'undefined' ? window : this);\n\n/*\n * This file contains utility functions that run in browsers only.\n *\n * Copyright (c) 2010 - 2018 jsPlumb (hello@jsplumbtoolkit.com)\n *\n * https://jsplumbtoolkit.com\n * https://github.com/jsplumb/jsplumb\n *\n * Dual licensed under the MIT and GPL2 licenses.\n */\n ;(function() {\n\n \"use strict\";\n\n var root = this;\n\n root.jsPlumbUtil.matchesSelector = function(el, selector, ctx) {\n ctx = ctx || el.parentNode;\n var possibles = ctx.querySelectorAll(selector);\n for (var i = 0; i < possibles.length; i++) {\n if (possibles[i] === el) {\n return true;\n }\n }\n return false;\n };\n\n root.jsPlumbUtil.consume = function(e, doNotPreventDefault) {\n if (e.stopPropagation) {\n e.stopPropagation();\n }\n else {\n e.returnValue = false;\n }\n\n if (!doNotPreventDefault && e.preventDefault){\n e.preventDefault();\n }\n };\n\n /*\n * Function: sizeElement\n * Helper to size and position an element. You would typically use\n * this when writing your own Connector or Endpoint implementation.\n *\n * Parameters:\n * x - [int] x position for the element origin\n * y - [int] y position for the element origin\n * w - [int] width of the element\n * h - [int] height of the element\n *\n */\n root.jsPlumbUtil.sizeElement = function(el, x, y, w, h) {\n if (el) {\n el.style.height = h + \"px\";\n el.height = h;\n el.style.width = w + \"px\";\n el.width = w;\n el.style.left = x + \"px\";\n el.style.top = y + \"px\";\n }\n };\n\n }).call(typeof window !== 'undefined' ? window : this);\n\n/*\n * This file contains the core code.\n *\n * Copyright (c) 2010 - 2018 jsPlumb (hello@jsplumbtoolkit.com)\n *\n * https://jsplumbtoolkit.com\n * https://github.com/jsplumb/jsplumb\n *\n * Dual licensed under the MIT and GPL2 licenses.\n */\n;(function () {\n\n \"use strict\";\n\n var root = this;\n\n var _ju = root.jsPlumbUtil,\n\n /**\n * creates a timestamp, using milliseconds since 1970, but as a string.\n */\n _timestamp = function () {\n return \"\" + (new Date()).getTime();\n },\n\n // helper method to update the hover style whenever it, or paintStyle, changes.\n // we use paintStyle as the foundation and merge hoverPaintStyle over the\n // top.\n _updateHoverStyle = function (component) {\n if (component._jsPlumb.paintStyle && component._jsPlumb.hoverPaintStyle) {\n var mergedHoverStyle = {};\n jsPlumb.extend(mergedHoverStyle, component._jsPlumb.paintStyle);\n jsPlumb.extend(mergedHoverStyle, component._jsPlumb.hoverPaintStyle);\n delete component._jsPlumb.hoverPaintStyle;\n // we want the fill of paintStyle to override a gradient, if possible.\n if (mergedHoverStyle.gradient && component._jsPlumb.paintStyle.fill) {\n delete mergedHoverStyle.gradient;\n }\n component._jsPlumb.hoverPaintStyle = mergedHoverStyle;\n }\n },\n events = [\"tap\", \"dbltap\", \"click\", \"dblclick\", \"mouseover\", \"mouseout\", \"mousemove\", \"mousedown\", \"mouseup\", \"contextmenu\" ],\n eventFilters = { \"mouseout\": \"mouseleave\", \"mouseexit\": \"mouseleave\" },\n _updateAttachedElements = function (component, state, timestamp, sourceElement) {\n var affectedElements = component.getAttachedElements();\n if (affectedElements) {\n for (var i = 0, j = affectedElements.length; i < j; i++) {\n if (!sourceElement || sourceElement !== affectedElements[i]) {\n affectedElements[i].setHover(state, true, timestamp);\t\t\t// tell the attached elements not to inform their own attached elements.\n }\n }\n }\n },\n _splitType = function (t) {\n return t == null ? null : t.split(\" \");\n },\n _mapType = function(map, obj, typeId) {\n for (var i in obj) {\n map[i] = typeId;\n }\n },\n _each = function(fn, obj) {\n obj = _ju.isArray(obj) || (obj.length != null && !_ju.isString(obj)) ? obj : [ obj ];\n for (var i = 0; i < obj.length; i++) {\n try {\n fn.apply(obj[i], [ obj[i] ]);\n }\n catch (e) {\n _ju.log(\".each iteration failed : \" + e);\n }\n }\n },\n _applyTypes = function (component, params, doNotRepaint) {\n if (component.getDefaultType) {\n var td = component.getTypeDescriptor(), map = {};\n var defType = component.getDefaultType();\n var o = _ju.merge({}, defType);\n _mapType(map, defType, \"__default\");\n for (var i = 0, j = component._jsPlumb.types.length; i < j; i++) {\n var tid = component._jsPlumb.types[i];\n if (tid !== \"__default\") {\n var _t = component._jsPlumb.instance.getType(tid, td);\n if (_t != null) {\n o = _ju.merge(o, _t, [ \"cssClass\" ]);\n _mapType(map, _t, tid);\n }\n }\n }\n\n if (params) {\n o = _ju.populate(o, params, \"_\");\n }\n\n component.applyType(o, doNotRepaint, map);\n if (!doNotRepaint) {\n component.repaint();\n }\n }\n },\n\n// ------------------------------ BEGIN jsPlumbUIComponent --------------------------------------------\n\n jsPlumbUIComponent = root.jsPlumbUIComponent = function (params) {\n\n _ju.EventGenerator.apply(this, arguments);\n\n var self = this,\n a = arguments,\n idPrefix = self.idPrefix,\n id = idPrefix + (new Date()).getTime();\n\n this._jsPlumb = {\n instance: params._jsPlumb,\n parameters: params.parameters || {},\n paintStyle: null,\n hoverPaintStyle: null,\n paintStyleInUse: null,\n hover: false,\n beforeDetach: params.beforeDetach,\n beforeDrop: params.beforeDrop,\n overlayPlacements: [],\n hoverClass: params.hoverClass || params._jsPlumb.Defaults.HoverClass,\n types: [],\n typeCache:{}\n };\n\n this.cacheTypeItem = function(key, item, typeId) {\n this._jsPlumb.typeCache[typeId] = this._jsPlumb.typeCache[typeId] || {};\n this._jsPlumb.typeCache[typeId][key] = item;\n };\n this.getCachedTypeItem = function(key, typeId) {\n return this._jsPlumb.typeCache[typeId] ? this._jsPlumb.typeCache[typeId][key] : null;\n };\n\n this.getId = function () {\n return id;\n };\n\n// ----------------------------- default type --------------------------------------------\n\n\n var o = params.overlays || [], oo = {};\n if (this.defaultOverlayKeys) {\n for (var i = 0; i < this.defaultOverlayKeys.length; i++) {\n Array.prototype.push.apply(o, this._jsPlumb.instance.Defaults[this.defaultOverlayKeys[i]] || []);\n }\n\n for (i = 0; i < o.length; i++) {\n // if a string, convert to object representation so that we can store the typeid on it.\n // also assign an id.\n var fo = jsPlumb.convertToFullOverlaySpec(o[i]);\n oo[fo[1].id] = fo;\n }\n }\n\n var _defaultType = {\n overlays:oo,\n parameters: params.parameters || {},\n scope: params.scope || this._jsPlumb.instance.getDefaultScope()\n };\n this.getDefaultType = function() {\n return _defaultType;\n };\n this.appendToDefaultType = function(obj) {\n for (var i in obj) {\n _defaultType[i] = obj[i];\n }\n };\n\n// ----------------------------- end default type --------------------------------------------\n\n // all components can generate events\n\n if (params.events) {\n for (var evtName in params.events) {\n self.bind(evtName, params.events[evtName]);\n }\n }\n\n // all components get this clone function.\n // TODO issue 116 showed a problem with this - it seems 'a' that is in\n // the clone function's scope is shared by all invocations of it, the classic\n // JS closure problem. for now, jsPlumb does a version of this inline where\n // it used to call clone. but it would be nice to find some time to look\n // further at this.\n this.clone = function () {\n var o = Object.create(this.constructor.prototype);\n this.constructor.apply(o, a);\n return o;\n }.bind(this);\n\n // user can supply a beforeDetach callback, which will be executed before a detach\n // is performed; returning false prevents the detach.\n this.isDetachAllowed = function (connection) {\n var r = true;\n if (this._jsPlumb.beforeDetach) {\n try {\n r = this._jsPlumb.beforeDetach(connection);\n }\n catch (e) {\n _ju.log(\"jsPlumb: beforeDetach callback failed\", e);\n }\n }\n return r;\n };\n\n // user can supply a beforeDrop callback, which will be executed before a dropped\n // connection is confirmed. user can return false to reject connection.\n this.isDropAllowed = function (sourceId, targetId, scope, connection, dropEndpoint, source, target) {\n var r = this._jsPlumb.instance.checkCondition(\"beforeDrop\", {\n sourceId: sourceId,\n targetId: targetId,\n scope: scope,\n connection: connection,\n dropEndpoint: dropEndpoint,\n source: source, target: target\n });\n if (this._jsPlumb.beforeDrop) {\n try {\n r = this._jsPlumb.beforeDrop({\n sourceId: sourceId,\n targetId: targetId,\n scope: scope,\n connection: connection,\n dropEndpoint: dropEndpoint,\n source: source, target: target\n });\n }\n catch (e) {\n _ju.log(\"jsPlumb: beforeDrop callback failed\", e);\n }\n }\n return r;\n };\n\n var domListeners = [];\n\n // sets the component associated with listener events. for instance, an overlay delegates\n // its events back to a connector. but if the connector is swapped on the underlying connection,\n // then this component must be changed. This is called by setConnector in the Connection class.\n this.setListenerComponent = function (c) {\n for (var i = 0; i < domListeners.length; i++) {\n domListeners[i][3] = c;\n }\n };\n\n\n };\n\n var _removeTypeCssHelper = function (component, typeIndex) {\n var typeId = component._jsPlumb.types[typeIndex],\n type = component._jsPlumb.instance.getType(typeId, component.getTypeDescriptor());\n\n if (type != null && type.cssClass && component.canvas) {\n component._jsPlumb.instance.removeClass(component.canvas, type.cssClass);\n }\n };\n\n _ju.extend(root.jsPlumbUIComponent, _ju.EventGenerator, {\n\n getParameter: function (name) {\n return this._jsPlumb.parameters[name];\n },\n\n setParameter: function (name, value) {\n this._jsPlumb.parameters[name] = value;\n },\n\n getParameters: function () {\n return this._jsPlumb.parameters;\n },\n\n setParameters: function (p) {\n this._jsPlumb.parameters = p;\n },\n\n getClass:function() {\n return jsPlumb.getClass(this.canvas);\n },\n\n hasClass:function(clazz) {\n return jsPlumb.hasClass(this.canvas, clazz);\n },\n\n addClass: function (clazz) {\n jsPlumb.addClass(this.canvas, clazz);\n },\n\n removeClass: function (clazz) {\n jsPlumb.removeClass(this.canvas, clazz);\n },\n\n updateClasses: function (classesToAdd, classesToRemove) {\n jsPlumb.updateClasses(this.canvas, classesToAdd, classesToRemove);\n },\n\n setType: function (typeId, params, doNotRepaint) {\n this.clearTypes();\n this._jsPlumb.types = _splitType(typeId) || [];\n _applyTypes(this, params, doNotRepaint);\n },\n\n getType: function () {\n return this._jsPlumb.types;\n },\n\n reapplyTypes: function (params, doNotRepaint) {\n _applyTypes(this, params, doNotRepaint);\n },\n\n hasType: function (typeId) {\n return this._jsPlumb.types.indexOf(typeId) !== -1;\n },\n\n addType: function (typeId, params, doNotRepaint) {\n var t = _splitType(typeId), _cont = false;\n if (t != null) {\n for (var i = 0, j = t.length; i < j; i++) {\n if (!this.hasType(t[i])) {\n this._jsPlumb.types.push(t[i]);\n _cont = true;\n }\n }\n if (_cont) {\n _applyTypes(this, params, doNotRepaint);\n }\n }\n },\n\n removeType: function (typeId, params, doNotRepaint) {\n var t = _splitType(typeId), _cont = false, _one = function (tt) {\n var idx = this._jsPlumb.types.indexOf(tt);\n if (idx !== -1) {\n // remove css class if necessary\n _removeTypeCssHelper(this, idx);\n this._jsPlumb.types.splice(idx, 1);\n return true;\n }\n return false;\n }.bind(this);\n\n if (t != null) {\n for (var i = 0, j = t.length; i < j; i++) {\n _cont = _one(t[i]) || _cont;\n }\n if (_cont) {\n _applyTypes(this, params, doNotRepaint);\n }\n }\n },\n clearTypes: function (params, doNotRepaint) {\n var i = this._jsPlumb.types.length;\n for (var j = 0; j < i; j++) {\n _removeTypeCssHelper(this, 0);\n this._jsPlumb.types.splice(0, 1);\n }\n _applyTypes(this, params, doNotRepaint);\n },\n\n toggleType: function (typeId, params, doNotRepaint) {\n var t = _splitType(typeId);\n if (t != null) {\n for (var i = 0, j = t.length; i < j; i++) {\n var idx = this._jsPlumb.types.indexOf(t[i]);\n if (idx !== -1) {\n _removeTypeCssHelper(this, idx);\n this._jsPlumb.types.splice(idx, 1);\n }\n else {\n this._jsPlumb.types.push(t[i]);\n }\n }\n\n _applyTypes(this, params, doNotRepaint);\n }\n },\n applyType: function (t, doNotRepaint) {\n this.setPaintStyle(t.paintStyle, doNotRepaint);\n this.setHoverPaintStyle(t.hoverPaintStyle, doNotRepaint);\n if (t.parameters) {\n for (var i in t.parameters) {\n this.setParameter(i, t.parameters[i]);\n }\n }\n this._jsPlumb.paintStyleInUse = this.getPaintStyle();\n },\n setPaintStyle: function (style, doNotRepaint) {\n // this._jsPlumb.paintStyle = jsPlumb.extend({}, style);\n // TODO figure out if we want components to clone paintStyle so as not to share it.\n this._jsPlumb.paintStyle = style;\n this._jsPlumb.paintStyleInUse = this._jsPlumb.paintStyle;\n _updateHoverStyle(this);\n if (!doNotRepaint) {\n this.repaint();\n }\n },\n getPaintStyle: function () {\n return this._jsPlumb.paintStyle;\n },\n setHoverPaintStyle: function (style, doNotRepaint) {\n //this._jsPlumb.hoverPaintStyle = jsPlumb.extend({}, style);\n // TODO figure out if we want components to clone paintStyle so as not to share it.\n this._jsPlumb.hoverPaintStyle = style;\n _updateHoverStyle(this);\n if (!doNotRepaint) {\n this.repaint();\n }\n },\n getHoverPaintStyle: function () {\n return this._jsPlumb.hoverPaintStyle;\n },\n destroy: function (force) {\n if (force || this.typeId == null) {\n this.cleanupListeners(); // this is on EventGenerator\n this.clone = null;\n this._jsPlumb = null;\n }\n },\n\n isHover: function () {\n return this._jsPlumb.hover;\n },\n\n setHover: function (hover, ignoreAttachedElements, timestamp) {\n // while dragging, we ignore these events. this keeps the UI from flashing and\n // swishing and whatevering.\n if (this._jsPlumb && !this._jsPlumb.instance.currentlyDragging && !this._jsPlumb.instance.isHoverSuspended()) {\n\n this._jsPlumb.hover = hover;\n var method = hover ? \"addClass\" : \"removeClass\";\n\n if (this.canvas != null) {\n if (this._jsPlumb.instance.hoverClass != null) {\n this._jsPlumb.instance[method](this.canvas, this._jsPlumb.instance.hoverClass);\n }\n if (this._jsPlumb.hoverClass != null) {\n this._jsPlumb.instance[method](this.canvas, this._jsPlumb.hoverClass);\n }\n }\n if (this._jsPlumb.hoverPaintStyle != null) {\n this._jsPlumb.paintStyleInUse = hover ? this._jsPlumb.hoverPaintStyle : this._jsPlumb.paintStyle;\n if (!this._jsPlumb.instance.isSuspendDrawing()) {\n timestamp = timestamp || _timestamp();\n this.repaint({timestamp: timestamp, recalc: false});\n }\n }\n // get the list of other affected elements, if supported by this component.\n // for a connection, its the endpoints. for an endpoint, its the connections! surprise.\n if (this.getAttachedElements && !ignoreAttachedElements) {\n _updateAttachedElements(this, hover, _timestamp(), this);\n }\n }\n }\n });\n\n// ------------------------------ END jsPlumbUIComponent --------------------------------------------\n\n var _jsPlumbInstanceIndex = 0,\n getInstanceIndex = function () {\n var i = _jsPlumbInstanceIndex + 1;\n _jsPlumbInstanceIndex++;\n return i;\n };\n\n var jsPlumbInstance = root.jsPlumbInstance = function (_defaults) {\n\n this.version = \"2.6.8\";\n\n if (_defaults) {\n jsPlumb.extend(this.Defaults, _defaults);\n }\n\n this.logEnabled = this.Defaults.LogEnabled;\n this._connectionTypes = {};\n this._endpointTypes = {};\n\n _ju.EventGenerator.apply(this);\n\n var _currentInstance = this,\n _instanceIndex = getInstanceIndex(),\n _bb = _currentInstance.bind,\n _initialDefaults = {},\n _zoom = 1,\n _info = function (el) {\n if (el == null) {\n return null;\n }\n else if (el.nodeType === 3 || el.nodeType === 8) {\n return { el:el, text:true };\n }\n else {\n var _el = _currentInstance.getElement(el);\n return { el: _el, id: (_ju.isString(el) && _el == null) ? el : _getId(_el) };\n }\n };\n\n this.getInstanceIndex = function () {\n return _instanceIndex;\n };\n\n // CONVERTED\n this.setZoom = function (z, repaintEverything) {\n _zoom = z;\n _currentInstance.fire(\"zoom\", _zoom);\n if (repaintEverything) {\n _currentInstance.repaintEverything();\n }\n return true;\n };\n // CONVERTED\n this.getZoom = function () {\n return _zoom;\n };\n\n for (var i in this.Defaults) {\n _initialDefaults[i] = this.Defaults[i];\n }\n\n var _container, _containerDelegations = [];\n this.unbindContainer = function() {\n if (_container != null && _containerDelegations.length > 0) {\n for (var i = 0; i < _containerDelegations.length; i++) {\n _currentInstance.off(_container, _containerDelegations[i][0], _containerDelegations[i][1]);\n }\n }\n };\n this.setContainer = function (c) {\n\n this.unbindContainer();\n\n // get container as dom element.\n c = this.getElement(c);\n // move existing connections and endpoints, if any.\n this.select().each(function (conn) {\n conn.moveParent(c);\n });\n this.selectEndpoints().each(function (ep) {\n ep.moveParent(c);\n });\n\n // set container.\n var previousContainer = _container;\n _container = c;\n _containerDelegations.length = 0;\n var eventAliases = {\n \"endpointclick\":\"endpointClick\",\n \"endpointdblclick\":\"endpointDblClick\"\n };\n\n var _oneDelegateHandler = function (id, e, componentType) {\n var t = e.srcElement || e.target,\n jp = (t && t.parentNode ? t.parentNode._jsPlumb : null) || (t ? t._jsPlumb : null) || (t && t.parentNode && t.parentNode.parentNode ? t.parentNode.parentNode._jsPlumb : null);\n if (jp) {\n jp.fire(id, jp, e);\n var alias = componentType ? eventAliases[componentType + id] || id : id;\n // jsplumb also fires every event coming from components/overlays. That's what the test for `jp.component` is for.\n _currentInstance.fire(alias, jp.component || jp, e);\n }\n };\n\n var _addOneDelegate = function(eventId, selector, fn) {\n _containerDelegations.push([eventId, fn]);\n _currentInstance.on(_container, eventId, selector, fn);\n };\n\n // delegate one event on the container to jsplumb elements. it might be possible to\n // abstract this out: each of endpoint, connection and overlay could register themselves with\n // jsplumb as \"component types\" or whatever, and provide a suitable selector. this would be\n // done by the renderer (although admittedly from 2.0 onwards we're not supporting vml anymore)\n var _oneDelegate = function (id) {\n // connections.\n _addOneDelegate(id, \".jtk-connector\", function (e) {\n _oneDelegateHandler(id, e);\n });\n // endpoints. note they can have an enclosing div, or not.\n _addOneDelegate(id, \".jtk-endpoint\", function (e) {\n _oneDelegateHandler(id, e, \"endpoint\");\n });\n // overlays\n _addOneDelegate(id, \".jtk-overlay\", function (e) {\n _oneDelegateHandler(id, e);\n });\n };\n\n for (var i = 0; i < events.length; i++) {\n _oneDelegate(events[i]);\n }\n\n // managed elements\n for (var elId in managedElements) {\n var el = managedElements[elId].el;\n if (el.parentNode === previousContainer) {\n previousContainer.removeChild(el);\n _container.appendChild(el);\n }\n }\n\n };\n this.getContainer = function () {\n return _container;\n };\n\n this.bind = function (event, fn) {\n if (\"ready\" === event && initialized) {\n fn();\n }\n else {\n _bb.apply(_currentInstance, [event, fn]);\n }\n };\n\n _currentInstance.importDefaults = function (d) {\n for (var i in d) {\n _currentInstance.Defaults[i] = d[i];\n }\n if (d.Container) {\n _currentInstance.setContainer(d.Container);\n }\n\n return _currentInstance;\n };\n\n _currentInstance.restoreDefaults = function () {\n _currentInstance.Defaults = jsPlumb.extend({}, _initialDefaults);\n return _currentInstance;\n };\n\n var log = null,\n initialized = false,\n // TODO remove from window scope\n connections = [],\n // map of element id -> endpoint lists. an element can have an arbitrary\n // number of endpoints on it, and not all of them have to be connected\n // to anything.\n endpointsByElement = {},\n endpointsByUUID = {},\n managedElements = {},\n offsets = {},\n offsetTimestamps = {},\n draggableStates = {},\n connectionBeingDragged = false,\n sizes = [],\n _suspendDrawing = false,\n _suspendedAt = null,\n DEFAULT_SCOPE = this.Defaults.Scope,\n _curIdStamp = 1,\n _idstamp = function () {\n return \"\" + _curIdStamp++;\n },\n\n //\n // appends an element to some other element, which is calculated as follows:\n //\n // 1. if Container exists, use that element.\n // 2. if the 'parent' parameter exists, use that.\n // 3. otherwise just use the root element.\n //\n //\n _appendElement = function (el, parent) {\n if (_container) {\n _container.appendChild(el);\n }\n else if (!parent) {\n this.appendToRoot(el);\n }\n else {\n this.getElement(parent).appendChild(el);\n }\n }.bind(this),\n\n //\n // Draws an endpoint and its connections. this is the main entry point into drawing connections as well\n // as endpoints, since jsPlumb is endpoint-centric under the hood.\n //\n // @param element element to draw (of type library specific element object)\n // @param ui UI object from current library's event system. optional.\n // @param timestamp timestamp for this paint cycle. used to speed things up a little by cutting down the amount of offset calculations we do.\n // @param clearEdits defaults to false; indicates that mouse edits for connectors should be cleared\n ///\n _draw = function (element, ui, timestamp, clearEdits) {\n\n if (!_suspendDrawing) {\n var id = _getId(element),\n repaintEls,\n dm = _currentInstance.getDragManager();\n\n if (dm) {\n repaintEls = dm.getElementsForDraggable(id);\n }\n\n if (timestamp == null) {\n timestamp = _timestamp();\n }\n\n // update the offset of everything _before_ we try to draw anything.\n var o = _updateOffset({ elId: id, offset: ui, recalc: false, timestamp: timestamp });\n\n if (repaintEls && o && o.o) {\n for (var i in repaintEls) {\n _updateOffset({\n elId: repaintEls[i].id,\n offset: {\n left: o.o.left + repaintEls[i].offset.left,\n top: o.o.top + repaintEls[i].offset.top\n },\n recalc: false,\n timestamp: timestamp\n });\n }\n }\n\n _currentInstance.anchorManager.redraw(id, ui, timestamp, null, clearEdits);\n\n if (repaintEls) {\n for (var j in repaintEls) {\n _currentInstance.anchorManager.redraw(repaintEls[j].id, ui, timestamp, repaintEls[j].offset, clearEdits, true);\n }\n }\n }\n },\n\n //\n // gets an Endpoint by uuid.\n //\n _getEndpoint = function (uuid) {\n return endpointsByUUID[uuid];\n },\n\n /**\n * inits a draggable if it's not already initialised.\n * TODO: somehow abstract this to the adapter, because the concept of \"draggable\" has no\n * place on the server.\n */\n _initDraggableIfNecessary = function (element, isDraggable, dragOptions, id, fireEvent) {\n // move to DragManager?\n if (!jsPlumb.headless) {\n var _draggable = isDraggable == null ? false : isDraggable;\n if (_draggable) {\n if (jsPlumb.isDragSupported(element, _currentInstance)) {\n var options = dragOptions || _currentInstance.Defaults.DragOptions;\n options = jsPlumb.extend({}, options); // make a copy.\n if (!jsPlumb.isAlreadyDraggable(element, _currentInstance)) {\n var dragEvent = jsPlumb.dragEvents.drag,\n stopEvent = jsPlumb.dragEvents.stop,\n startEvent = jsPlumb.dragEvents.start,\n _started = false;\n\n _manage(id, element);\n\n options[startEvent] = _ju.wrap(options[startEvent], function () {\n _currentInstance.setHoverSuspended(true);\n _currentInstance.select({source: element}).addClass(_currentInstance.elementDraggingClass + \" \" + _currentInstance.sourceElementDraggingClass, true);\n _currentInstance.select({target: element}).addClass(_currentInstance.elementDraggingClass + \" \" + _currentInstance.targetElementDraggingClass, true);\n _currentInstance.setConnectionBeingDragged(true);\n if (options.canDrag) {\n return dragOptions.canDrag();\n }\n }, false);\n\n options[dragEvent] = _ju.wrap(options[dragEvent], function () {\n var ui = _currentInstance.getUIPosition(arguments, _currentInstance.getZoom());\n if (ui != null) {\n _draw(element, ui, null, true);\n if (_started) {\n _currentInstance.addClass(element, \"jtk-dragged\");\n }\n _started = true;\n }\n });\n options[stopEvent] = _ju.wrap(options[stopEvent], function () {\n var elements = arguments[0].selection, uip;\n\n var _one = function (_e) {\n if (_e[1] != null) {\n // run the reported offset through the code that takes parent containers\n // into account, to adjust if necessary (issue 554)\n uip = _currentInstance.getUIPosition([{\n el:_e[2].el,\n pos:[_e[1].left, _e[1].top]\n }]);\n _draw(_e[2].el, uip);\n }\n _currentInstance.removeClass(_e[0], \"jtk-dragged\");\n _currentInstance.select({source: _e[2].el}).removeClass(_currentInstance.elementDraggingClass + \" \" + _currentInstance.sourceElementDraggingClass, true);\n _currentInstance.select({target: _e[2].el}).removeClass(_currentInstance.elementDraggingClass + \" \" + _currentInstance.targetElementDraggingClass, true);\n _currentInstance.getDragManager().dragEnded(_e[2].el);\n };\n\n for (var i = 0; i < elements.length; i++) {\n _one(elements[i]);\n }\n\n _started = false;\n _currentInstance.setHoverSuspended(false);\n _currentInstance.setConnectionBeingDragged(false);\n });\n var elId = _getId(element); // need ID\n draggableStates[elId] = true;\n var draggable = draggableStates[elId];\n options.disabled = draggable == null ? false : !draggable;\n _currentInstance.initDraggable(element, options);\n _currentInstance.getDragManager().register(element);\n if (fireEvent) {\n _currentInstance.fire(\"elementDraggable\", {el:element, options:options});\n }\n }\n else {\n // already draggable. attach any start, drag or stop listeners to the current Drag.\n if (dragOptions.force) {\n _currentInstance.initDraggable(element, options);\n }\n }\n }\n }\n }\n },\n\n _scopeMatch = function (e1, e2) {\n var s1 = e1.scope.split(/\\s/), s2 = e2.scope.split(/\\s/);\n for (var i = 0; i < s1.length; i++) {\n for (var j = 0; j < s2.length; j++) {\n if (s2[j] === s1[i]) {\n return true;\n }\n }\n }\n\n return false;\n },\n\n _mergeOverrides = function (def, values) {\n var m = jsPlumb.extend({}, def);\n for (var i in values) {\n if (values[i]) {\n m[i] = values[i];\n }\n }\n return m;\n },\n\n /*\n * prepares a final params object that can be passed to _newConnection, taking into account defaults, events, etc.\n */\n _prepareConnectionParams = function (params, referenceParams) {\n var _p = jsPlumb.extend({ }, params);\n if (referenceParams) {\n jsPlumb.extend(_p, referenceParams);\n }\n\n // hotwire endpoints passed as source or target to sourceEndpoint/targetEndpoint, respectively.\n if (_p.source) {\n if (_p.source.endpoint) {\n _p.sourceEndpoint = _p.source;\n }\n else {\n _p.source = _currentInstance.getElement(_p.source);\n }\n }\n if (_p.target) {\n if (_p.target.endpoint) {\n _p.targetEndpoint = _p.target;\n }\n else {\n _p.target = _currentInstance.getElement(_p.target);\n }\n }\n\n // test for endpoint uuids to connect\n if (params.uuids) {\n _p.sourceEndpoint = _getEndpoint(params.uuids[0]);\n _p.targetEndpoint = _getEndpoint(params.uuids[1]);\n }\n\n // now ensure that if we do have Endpoints already, they're not full.\n // source:\n if (_p.sourceEndpoint && _p.sourceEndpoint.isFull()) {\n _ju.log(_currentInstance, \"could not add connection; source endpoint is full\");\n return;\n }\n\n // target:\n if (_p.targetEndpoint && _p.targetEndpoint.isFull()) {\n _ju.log(_currentInstance, \"could not add connection; target endpoint is full\");\n return;\n }\n\n // if source endpoint mandates connection type and nothing specified in our params, use it.\n if (!_p.type && _p.sourceEndpoint) {\n _p.type = _p.sourceEndpoint.connectionType;\n }\n\n // copy in any connectorOverlays that were specified on the source endpoint.\n // it doesnt copy target endpoint overlays. i'm not sure if we want it to or not.\n if (_p.sourceEndpoint && _p.sourceEndpoint.connectorOverlays) {\n _p.overlays = _p.overlays || [];\n for (var i = 0, j = _p.sourceEndpoint.connectorOverlays.length; i < j; i++) {\n _p.overlays.push(_p.sourceEndpoint.connectorOverlays[i]);\n }\n }\n\n // scope\n if (_p.sourceEndpoint && _p.sourceEndpoint.scope) {\n _p.scope = _p.sourceEndpoint.scope;\n }\n\n // pointer events\n if (!_p[\"pointer-events\"] && _p.sourceEndpoint && _p.sourceEndpoint.connectorPointerEvents) {\n _p[\"pointer-events\"] = _p.sourceEndpoint.connectorPointerEvents;\n }\n\n\n var _addEndpoint = function (el, def, idx) {\n return _currentInstance.addEndpoint(el, _mergeOverrides(def, {\n anchor: _p.anchors ? _p.anchors[idx] : _p.anchor,\n endpoint: _p.endpoints ? _p.endpoints[idx] : _p.endpoint,\n paintStyle: _p.endpointStyles ? _p.endpointStyles[idx] : _p.endpointStyle,\n hoverPaintStyle: _p.endpointHoverStyles ? _p.endpointHoverStyles[idx] : _p.endpointHoverStyle\n }));\n };\n\n // check for makeSource/makeTarget specs.\n\n var _oneElementDef = function (type, idx, defs, matchType) {\n if (_p[type] && !_p[type].endpoint && !_p[type + \"Endpoint\"] && !_p.newConnection) {\n var tid = _getId(_p[type]), tep = defs[tid];\n\n tep = tep ? tep[matchType] : null;\n\n if (tep) {\n // if not enabled, return.\n if (!tep.enabled) {\n return false;\n }\n var newEndpoint = tep.endpoint != null && tep.endpoint._jsPlumb ? tep.endpoint : _addEndpoint(_p[type], tep.def, idx);\n if (newEndpoint.isFull()) {\n return false;\n }\n _p[type + \"Endpoint\"] = newEndpoint;\n if (!_p.scope && tep.def.scope) {\n _p.scope = tep.def.scope;\n } // provide scope if not already provided and endpoint def has one.\n if (tep.uniqueEndpoint) {\n if (!tep.endpoint) {\n tep.endpoint = newEndpoint;\n newEndpoint.setDeleteOnEmpty(false);\n }\n else {\n newEndpoint.finalEndpoint = tep.endpoint;\n }\n } else {\n newEndpoint.setDeleteOnEmpty(true);\n }\n\n //\n // copy in connector overlays if present on the source definition.\n //\n if (idx === 0 && tep.def.connectorOverlays) {\n _p.overlays = _p.overlays || [];\n Array.prototype.push.apply(_p.overlays, tep.def.connectorOverlays);\n }\n }\n }\n };\n\n if (_oneElementDef(\"source\", 0, this.sourceEndpointDefinitions, _p.type || \"default\") === false) {\n return;\n }\n if (_oneElementDef(\"target\", 1, this.targetEndpointDefinitions, _p.type || \"default\") === false) {\n return;\n }\n\n // last, ensure scopes match\n if (_p.sourceEndpoint && _p.targetEndpoint) {\n if (!_scopeMatch(_p.sourceEndpoint, _p.targetEndpoint)) {\n _p = null;\n }\n }\n\n return _p;\n }.bind(_currentInstance),\n\n _newConnection = function (params) {\n var connectionFunc = _currentInstance.Defaults.ConnectionType || _currentInstance.getDefaultConnectionType();\n\n params._jsPlumb = _currentInstance;\n params.newConnection = _newConnection;\n params.newEndpoint = _newEndpoint;\n params.endpointsByUUID = endpointsByUUID;\n params.endpointsByElement = endpointsByElement;\n params.finaliseConnection = _finaliseConnection;\n params.id = \"con_\" + _idstamp();\n var con = new connectionFunc(params);\n\n // if the connection is draggable, then maybe we need to tell the target endpoint to init the\n // dragging code. it won't run again if it already configured to be draggable.\n if (con.isDetachable()) {\n con.endpoints[0].initDraggable(\"_jsPlumbSource\");\n con.endpoints[1].initDraggable(\"_jsPlumbTarget\");\n }\n\n return con;\n },\n\n //\n // adds the connection to the backing model, fires an event if necessary and then redraws\n //\n _finaliseConnection = _currentInstance.finaliseConnection = function (jpc, params, originalEvent, doInformAnchorManager) {\n params = params || {};\n // add to list of connections (by scope).\n if (!jpc.suspendedEndpoint) {\n connections.push(jpc);\n }\n\n jpc.pending = null;\n\n // turn off isTemporarySource on the source endpoint (only viable on first draw)\n jpc.endpoints[0].isTemporarySource = false;\n\n // always inform the anchor manager\n // except that if jpc has a suspended endpoint it's not true to say the\n // connection is new; it has just (possibly) moved. the question is whether\n // to make that call here or in the anchor manager. i think perhaps here.\n if (doInformAnchorManager !== false) {\n _currentInstance.anchorManager.newConnection(jpc);\n }\n\n // force a paint\n _draw(jpc.source);\n\n // fire an event\n if (!params.doNotFireConnectionEvent && params.fireEvent !== false) {\n\n var eventArgs = {\n connection: jpc,\n source: jpc.source, target: jpc.target,\n sourceId: jpc.sourceId, targetId: jpc.targetId,\n sourceEndpoint: jpc.endpoints[0], targetEndpoint: jpc.endpoints[1]\n };\n\n _currentInstance.fire(\"connection\", eventArgs, originalEvent);\n }\n },\n\n /*\n factory method to prepare a new endpoint. this should always be used instead of creating Endpoints\n manually, since this method attaches event listeners and an id.\n */\n _newEndpoint = function (params, id) {\n var endpointFunc = _currentInstance.Defaults.EndpointType || jsPlumb.Endpoint;\n var _p = jsPlumb.extend({}, params);\n _p._jsPlumb = _currentInstance;\n _p.newConnection = _newConnection;\n _p.newEndpoint = _newEndpoint;\n _p.endpointsByUUID = endpointsByUUID;\n _p.endpointsByElement = endpointsByElement;\n _p.fireDetachEvent = fireDetachEvent;\n _p.elementId = id || _getId(_p.source);\n var ep = new endpointFunc(_p);\n ep.id = \"ep_\" + _idstamp();\n _manage(_p.elementId, _p.source);\n\n if (!jsPlumb.headless) {\n _currentInstance.getDragManager().endpointAdded(_p.source, id);\n }\n\n return ep;\n },\n\n /*\n * performs the given function operation on all the connections found\n * for the given element id; this means we find all the endpoints for\n * the given element, and then for each endpoint find the connectors\n * connected to it. then we pass each connection in to the given\n * function.\n */\n _operation = function (elId, func, endpointFunc) {\n var endpoints = endpointsByElement[elId];\n if (endpoints && endpoints.length) {\n for (var i = 0, ii = endpoints.length; i < ii; i++) {\n for (var j = 0, jj = endpoints[i].connections.length; j < jj; j++) {\n var retVal = func(endpoints[i].connections[j]);\n // if the function passed in returns true, we exit.\n // most functions return false.\n if (retVal) {\n return;\n }\n }\n if (endpointFunc) {\n endpointFunc(endpoints[i]);\n }\n }\n }\n },\n\n _setDraggable = function (element, draggable) {\n return jsPlumb.each(element, function (el) {\n if (_currentInstance.isDragSupported(el)) {\n draggableStates[_currentInstance.getAttribute(el, \"id\")] = draggable;\n _currentInstance.setElementDraggable(el, draggable);\n }\n });\n },\n /*\n * private method to do the business of hiding/showing.\n *\n * @param el\n * either Id of the element in question or a library specific\n * object for the element.\n * @param state\n * String specifying a value for the css 'display' property\n * ('block' or 'none').\n */\n _setVisible = function (el, state, alsoChangeEndpoints) {\n state = state === \"block\";\n var endpointFunc = null;\n if (alsoChangeEndpoints) {\n endpointFunc = function (ep) {\n ep.setVisible(state, true, true);\n };\n }\n var info = _info(el);\n _operation(info.id, function (jpc) {\n if (state && alsoChangeEndpoints) {\n // this test is necessary because this functionality is new, and i wanted to maintain backwards compatibility.\n // this block will only set a connection to be visible if the other endpoint in the connection is also visible.\n var oidx = jpc.sourceId === info.id ? 1 : 0;\n if (jpc.endpoints[oidx].isVisible()) {\n jpc.setVisible(true);\n }\n }\n else { // the default behaviour for show, and what always happens for hide, is to just set the visibility without getting clever.\n jpc.setVisible(state);\n }\n }, endpointFunc);\n },\n /*\n * toggles the draggable state of the given element(s).\n * el is either an id, or an element object, or a list of ids/element objects.\n */\n _toggleDraggable = function (el) {\n var state;\n jsPlumb.each(el, function (el) {\n var elId = _currentInstance.getAttribute(el, \"id\");\n state = draggableStates[elId] == null ? false : draggableStates[elId];\n state = !state;\n draggableStates[elId] = state;\n _currentInstance.setDraggable(el, state);\n return state;\n }.bind(this));\n return state;\n },\n /**\n * private method to do the business of toggling hiding/showing.\n */\n _toggleVisible = function (elId, changeEndpoints) {\n var endpointFunc = null;\n if (changeEndpoints) {\n endpointFunc = function (ep) {\n var state = ep.isVisible();\n ep.setVisible(!state);\n };\n }\n _operation(elId, function (jpc) {\n var state = jpc.isVisible();\n jpc.setVisible(!state);\n }, endpointFunc);\n },\n\n // TODO comparison performance\n _getCachedData = function (elId) {\n var o = offsets[elId];\n if (!o) {\n return _updateOffset({elId: elId});\n }\n else {\n return {o: o, s: sizes[elId]};\n }\n },\n\n /**\n * gets an id for the given element, creating and setting one if\n * necessary. the id is of the form\n *\n * jsPlumb_<instance index>_<index in instance>\n *\n * where \"index in instance\" is a monotonically increasing integer that starts at 0,\n * for each instance. this method is used not only to assign ids to elements that do not\n * have them but also to connections and endpoints.\n */\n _getId = function (element, uuid, doNotCreateIfNotFound) {\n if (_ju.isString(element)) {\n return element;\n }\n if (element == null) {\n return null;\n }\n var id = _currentInstance.getAttribute(element, \"id\");\n if (!id || id === \"undefined\") {\n // check if fixed uuid parameter is given\n if (arguments.length === 2 && arguments[1] !== undefined) {\n id = uuid;\n }\n else if (arguments.length === 1 || (arguments.length === 3 && !arguments[2])) {\n id = \"jsPlumb_\" + _instanceIndex + \"_\" + _idstamp();\n }\n\n if (!doNotCreateIfNotFound) {\n _currentInstance.setAttribute(element, \"id\", id);\n }\n }\n return id;\n };\n\n this.setConnectionBeingDragged = function (v) {\n connectionBeingDragged = v;\n };\n this.isConnectionBeingDragged = function () {\n return connectionBeingDragged;\n };\n\n /**\n * Returns a map of all the elements this jsPlumbInstance is currently managing.\n * @returns {Object} Map of [id-> {el, endpoint[], connection, position}] information.\n */\n this.getManagedElements = function() {\n return managedElements;\n };\n\n this.connectorClass = \"jtk-connector\";\n this.connectorOutlineClass = \"jtk-connector-outline\";\n this.editableConnectorClass = \"jtk-connector-editable\";\n this.connectedClass = \"jtk-connected\";\n this.hoverClass = \"jtk-hover\";\n this.endpointClass = \"jtk-endpoint\";\n this.endpointConnectedClass = \"jtk-endpoint-connected\";\n this.endpointFullClass = \"jtk-endpoint-full\";\n this.endpointDropAllowedClass = \"jtk-endpoint-drop-allowed\";\n this.endpointDropForbiddenClass = \"jtk-endpoint-drop-forbidden\";\n this.overlayClass = \"jtk-overlay\";\n this.draggingClass = \"jtk-dragging\";// CONVERTED\n this.elementDraggingClass = \"jtk-element-dragging\";// CONVERTED\n this.sourceElementDraggingClass = \"jtk-source-element-dragging\"; // CONVERTED\n this.targetElementDraggingClass = \"jtk-target-element-dragging\";// CONVERTED\n this.endpointAnchorClassPrefix = \"jtk-endpoint-anchor\";\n this.hoverSourceClass = \"jtk-source-hover\";\n this.hoverTargetClass = \"jtk-target-hover\";\n this.dragSelectClass = \"jtk-drag-select\";\n\n this.Anchors = {};\n this.Connectors = { \"svg\": {} };\n this.Endpoints = { \"svg\": {} };\n this.Overlays = { \"svg\": {} } ;\n this.ConnectorRenderers = {};\n this.SVG = \"svg\";\n\n// --------------------------- jsPlumbInstance public API ---------------------------------------------------------\n\n\n this.addEndpoint = function (el, params, referenceParams) {\n referenceParams = referenceParams || {};\n var p = jsPlumb.extend({}, referenceParams);\n jsPlumb.extend(p, params);\n p.endpoint = p.endpoint || _currentInstance.Defaults.Endpoint;\n p.paintStyle = p.paintStyle || _currentInstance.Defaults.EndpointStyle;\n\n var results = [],\n inputs = (_ju.isArray(el) || (el.length != null && !_ju.isString(el))) ? el : [ el ];\n\n for (var i = 0, j = inputs.length; i < j; i++) {\n p.source = _currentInstance.getElement(inputs[i]);\n _ensureContainer(p.source);\n\n var id = _getId(p.source), e = _newEndpoint(p, id);\n\n // ensure element is managed.\n var myOffset = _manage(id, p.source).info.o;\n _ju.addToList(endpointsByElement, id, e);\n\n if (!_suspendDrawing) {\n e.paint({\n anchorLoc: e.anchor.compute({ xy: [ myOffset.left, myOffset.top ], wh: sizes[id], element: e, timestamp: _suspendedAt }),\n timestamp: _suspendedAt\n });\n }\n\n results.push(e);\n }\n\n return results.length === 1 ? results[0] : results;\n };\n\n this.addEndpoints = function (el, endpoints, referenceParams) {\n var results = [];\n for (var i = 0, j = endpoints.length; i < j; i++) {\n var e = _currentInstance.addEndpoint(el, endpoints[i], referenceParams);\n if (_ju.isArray(e)) {\n Array.prototype.push.apply(results, e);\n }\n else {\n results.push(e);\n }\n }\n return results;\n };\n\n this.animate = function (el, properties, options) {\n if (!this.animationSupported) {\n return false;\n }\n\n options = options || {};\n var del = _currentInstance.getElement(el),\n id = _getId(del),\n stepFunction = jsPlumb.animEvents.step,\n completeFunction = jsPlumb.animEvents.complete;\n\n options[stepFunction] = _ju.wrap(options[stepFunction], function () {\n _currentInstance.revalidate(id);\n });\n\n // onComplete repaints, just to make sure everything looks good at the end of the animation.\n options[completeFunction] = _ju.wrap(options[completeFunction], function () {\n _currentInstance.revalidate(id);\n });\n\n _currentInstance.doAnimate(del, properties, options);\n };\n\n /**\n * checks for a listener for the given condition, executing it if found, passing in the given value.\n * condition listeners would have been attached using \"bind\" (which is, you could argue, now overloaded, since\n * firing click events etc is a bit different to what this does). i thought about adding a \"bindCondition\"\n * or something, but decided against it, for the sake of simplicity. jsPlumb will never fire one of these\n * condition events anyway.\n */\n this.checkCondition = function (conditionName, args) {\n var l = _currentInstance.getListener(conditionName),\n r = true;\n\n if (l && l.length > 0) {\n var values = Array.prototype.slice.call(arguments, 1);\n try {\n for (var i = 0, j = l.length; i < j; i++) {\n r = r && l[i].apply(l[i], values);\n }\n }\n catch (e) {\n _ju.log(_currentInstance, \"cannot check condition [\" + conditionName + \"]\" + e);\n }\n }\n return r;\n };\n\n this.connect = function (params, referenceParams) {\n // prepare a final set of parameters to create connection with\n var _p = _prepareConnectionParams(params, referenceParams), jpc;\n // TODO probably a nicer return value if the connection was not made. _prepareConnectionParams\n // will return null (and log something) if either endpoint was full. what would be nicer is to\n // create a dedicated 'error' object.\n if (_p) {\n if (_p.source == null && _p.sourceEndpoint == null) {\n _ju.log(\"Cannot establish connection - source does not exist\");\n return;\n }\n if (_p.target == null && _p.targetEndpoint == null) {\n _ju.log(\"Cannot establish connection - target does not exist\");\n return;\n }\n _ensureContainer(_p.source);\n // create the connection. it is not yet registered\n jpc = _newConnection(_p);\n // now add it the model, fire an event, and redraw\n _finaliseConnection(jpc, _p);\n }\n return jpc;\n };\n\n var stTypes = [\n { el: \"source\", elId: \"sourceId\", epDefs: \"sourceEndpointDefinitions\" },\n { el: \"target\", elId: \"targetId\", epDefs: \"targetEndpointDefinitions\" }\n ];\n\n var _set = function (c, el, idx, doNotRepaint) {\n var ep, _st = stTypes[idx], cId = c[_st.elId], cEl = c[_st.el], sid, sep,\n oldEndpoint = c.endpoints[idx];\n\n var evtParams = {\n index: idx,\n originalSourceId: idx === 0 ? cId : c.sourceId,\n newSourceId: c.sourceId,\n originalTargetId: idx === 1 ? cId : c.targetId,\n newTargetId: c.targetId,\n connection: c\n };\n\n if (el.constructor === jsPlumb.Endpoint) {\n ep = el;\n ep.addConnection(c);\n el = ep.element;\n }\n else {\n sid = _getId(el);\n sep = this[_st.epDefs][sid];\n\n if (sid === c[_st.elId]) {\n ep = null; // dont change source/target if the element is already the one given.\n }\n else if (sep) {\n for (var t in sep) {\n if (!sep[t].enabled) {\n return;\n }\n ep = sep[t].endpoint != null && sep[t].endpoint._jsPlumb ? sep[t].endpoint : this.addEndpoint(el, sep[t].def);\n if (sep[t].uniqueEndpoint) {\n sep[t].endpoint = ep;\n }\n ep.addConnection(c);\n }\n }\n else {\n ep = c.makeEndpoint(idx === 0, el, sid);\n }\n }\n\n if (ep != null) {\n oldEndpoint.detachFromConnection(c);\n c.endpoints[idx] = ep;\n c[_st.el] = ep.element;\n c[_st.elId] = ep.elementId;\n evtParams[idx === 0 ? \"newSourceId\" : \"newTargetId\"] = ep.elementId;\n\n fireMoveEvent(evtParams);\n\n if (!doNotRepaint) {\n c.repaint();\n }\n }\n\n evtParams.element = el;\n return evtParams;\n\n }.bind(this);\n\n this.setSource = function (connection, el, doNotRepaint) {\n var p = _set(connection, el, 0, doNotRepaint);\n this.anchorManager.sourceChanged(p.originalSourceId, p.newSourceId, connection, p.el);\n };\n this.setTarget = function (connection, el, doNotRepaint) {\n var p = _set(connection, el, 1, doNotRepaint);\n this.anchorManager.updateOtherEndpoint(p.originalSourceId, p.originalTargetId, p.newTargetId, connection);\n };\n\n this.deleteEndpoint = function (object, dontUpdateHover, deleteAttachedObjects) {\n var endpoint = (typeof object === \"string\") ? endpointsByUUID[object] : object;\n if (endpoint) {\n _currentInstance.deleteObject({ endpoint: endpoint, dontUpdateHover: dontUpdateHover, deleteAttachedObjects:deleteAttachedObjects });\n }\n return _currentInstance;\n };\n\n this.deleteEveryEndpoint = function () {\n var _is = _currentInstance.setSuspendDrawing(true);\n for (var id in endpointsByElement) {\n var endpoints = endpointsByElement[id];\n if (endpoints && endpoints.length) {\n for (var i = 0, j = endpoints.length; i < j; i++) {\n _currentInstance.deleteEndpoint(endpoints[i], true);\n }\n }\n }\n endpointsByElement = {};\n managedElements = {};\n endpointsByUUID = {};\n offsets = {};\n offsetTimestamps = {};\n _currentInstance.anchorManager.reset();\n var dm = _currentInstance.getDragManager();\n if (dm) {\n dm.reset();\n }\n if (!_is) {\n _currentInstance.setSuspendDrawing(false);\n }\n return _currentInstance;\n };\n\n var fireDetachEvent = function (jpc, doFireEvent, originalEvent) {\n // may have been given a connection, or in special cases, an object\n var connType = _currentInstance.Defaults.ConnectionType || _currentInstance.getDefaultConnectionType(),\n argIsConnection = jpc.constructor === connType,\n params = argIsConnection ? {\n connection: jpc,\n source: jpc.source, target: jpc.target,\n sourceId: jpc.sourceId, targetId: jpc.targetId,\n sourceEndpoint: jpc.endpoints[0], targetEndpoint: jpc.endpoints[1]\n } : jpc;\n\n if (doFireEvent) {\n _currentInstance.fire(\"connectionDetached\", params, originalEvent);\n }\n\n // always fire this. used by internal jsplumb stuff.\n _currentInstance.fire(\"internal.connectionDetached\", params, originalEvent);\n\n _currentInstance.anchorManager.connectionDetached(params);\n };\n\n var fireMoveEvent = _currentInstance.fireMoveEvent = function (params, evt) {\n _currentInstance.fire(\"connectionMoved\", params, evt);\n };\n\n this.unregisterEndpoint = function (endpoint) {\n if (endpoint._jsPlumb.uuid) {\n endpointsByUUID[endpoint._jsPlumb.uuid] = null;\n }\n _currentInstance.anchorManager.deleteEndpoint(endpoint);\n // TODO at least replace this with a removeWithFunction call.\n for (var e in endpointsByElement) {\n var endpoints = endpointsByElement[e];\n if (endpoints) {\n var newEndpoints = [];\n for (var i = 0, j = endpoints.length; i < j; i++) {\n if (endpoints[i] !== endpoint) {\n newEndpoints.push(endpoints[i]);\n }\n }\n\n endpointsByElement[e] = newEndpoints;\n }\n if (endpointsByElement[e].length < 1) {\n delete endpointsByElement[e];\n }\n }\n };\n\n var IS_DETACH_ALLOWED = \"isDetachAllowed\";\n var BEFORE_DETACH = \"beforeDetach\";\n var CHECK_CONDITION = \"checkCondition\";\n\n /**\n * Deletes a Connection.\n * @method deleteConnection\n * @param connection Connection to delete\n * @param {Object} [params] Optional delete parameters\n * @param {Boolean} [params.doNotFireEvent=false] If true, a connection detached event will not be fired. Otherwise one will.\n * @param {Boolean} [params.force=false] If true, the connection will be deleted even if a beforeDetach interceptor tries to stop the deletion.\n * @returns {Boolean} True if the connection was deleted, false otherwise.\n */\n this.deleteConnection = function(connection, params) {\n\n if (connection != null) {\n params = params || {};\n\n if (params.force || _ju.functionChain(true, false, [\n [ connection.endpoints[0], IS_DETACH_ALLOWED, [ connection ] ],\n [ connection.endpoints[1], IS_DETACH_ALLOWED, [ connection ] ],\n [ connection, IS_DETACH_ALLOWED, [ connection ] ],\n [ _currentInstance, CHECK_CONDITION, [ BEFORE_DETACH, connection ] ]\n ])) {\n\n connection.setHover(false);\n fireDetachEvent(connection, !connection.pending && params.fireEvent !== false, params.originalEvent);\n\n connection.endpoints[0].detachFromConnection(connection);\n connection.endpoints[1].detachFromConnection(connection);\n _ju.removeWithFunction(connections, function (_c) {\n return connection.id === _c.id;\n });\n\n connection.cleanup();\n connection.destroy();\n return true;\n }\n }\n return false;\n };\n\n /**\n * Remove all Connections from all elements, but leaves Endpoints in place ((unless a connection is set to auto delete its Endpoints).\n * @method deleteEveryConnection\n * @param {Object} [params] optional params object for the call\n * @param {Boolean} [params.fireEvent=true] Whether or not to fire detach events\n * @param {Boolean} [params.forceDetach=false] If true, this call will ignore any `beforeDetach` interceptors.\n * @returns {Number} The number of connections that were deleted.\n */\n this.deleteEveryConnection = function (params) {\n params = params || {};\n var count = connections.length, deletedCount = 0;\n _currentInstance.batch(function () {\n for (var i = 0; i < count; i++) {\n deletedCount += _currentInstance.deleteConnection(connections[0], params) ? 1 : 0;\n }\n });\n return deletedCount;\n };\n\n /**\n * Removes all an element's Connections.\n * @method deleteConnectionsForElement\n * @param {Object} el Either the id of the element, or a selector for the element.\n * @param {Object} [params] Optional parameters.\n * @param {Boolean} [params.fireEvent=true] Whether or not to fire the detach event.\n * @param {Boolean} [params.forceDetach=false] If true, this call will ignore any `beforeDetach` interceptors.\n * @return {jsPlumbInstance} The current jsPlumb instance.\n */\n this.deleteConnectionsForElement = function (el, params) {\n params = params || {};\n el = _currentInstance.getElement(el);\n var id = _getId(el), endpoints = endpointsByElement[id];\n if (endpoints && endpoints.length) {\n for (var i = 0, j = endpoints.length; i < j; i++) {\n endpoints[i].deleteEveryConnection(params);\n }\n }\n return _currentInstance;\n };\n\n /// not public. but of course its exposed. how to change this.\n this.deleteObject = function (params) {\n var result = {\n endpoints: {},\n connections: {},\n endpointCount: 0,\n connectionCount: 0\n },\n deleteAttachedObjects = params.deleteAttachedObjects !== false;\n\n var unravelConnection = function (connection) {\n if (connection != null && result.connections[connection.id] == null) {\n if (!params.dontUpdateHover && connection._jsPlumb != null) {\n connection.setHover(false);\n }\n result.connections[connection.id] = connection;\n result.connectionCount++;\n }\n };\n var unravelEndpoint = function (endpoint) {\n if (endpoint != null && result.endpoints[endpoint.id] == null) {\n if (!params.dontUpdateHover && endpoint._jsPlumb != null) {\n endpoint.setHover(false);\n }\n result.endpoints[endpoint.id] = endpoint;\n result.endpointCount++;\n\n if (deleteAttachedObjects) {\n for (var i = 0; i < endpoint.connections.length; i++) {\n var c = endpoint.connections[i];\n unravelConnection(c);\n }\n }\n }\n };\n\n if (params.connection) {\n unravelConnection(params.connection);\n }\n else {\n unravelEndpoint(params.endpoint);\n }\n\n // loop through connections\n for (var i in result.connections) {\n var c = result.connections[i];\n if (c._jsPlumb) {\n _ju.removeWithFunction(connections, function (_c) {\n return c.id === _c.id;\n });\n\n fireDetachEvent(c, params.fireEvent === false ? false : !c.pending, params.originalEvent);\n var doNotCleanup = params.deleteAttachedObjects == null ? null : !params.deleteAttachedObjects;\n\n c.endpoints[0].detachFromConnection(c, null, doNotCleanup);\n c.endpoints[1].detachFromConnection(c, null, doNotCleanup);\n\n c.cleanup(true);\n c.destroy(true);\n }\n }\n\n // loop through endpoints\n for (var j in result.endpoints) {\n var e = result.endpoints[j];\n if (e._jsPlumb) {\n _currentInstance.unregisterEndpoint(e);\n // FIRE some endpoint deleted event?\n e.cleanup(true);\n e.destroy(true);\n }\n }\n\n return result;\n };\n\n this.draggable = function (el, options) {\n var info;\n _each(function(_el) {\n info = _info(_el);\n if (info.el) {\n _initDraggableIfNecessary(info.el, true, options, info.id, true);\n }\n }, el);\n return _currentInstance;\n };\n\n this.droppable = function(el, options) {\n var info;\n options = options || {};\n options.allowLoopback = false;\n _each(function(_el) {\n info = _info(_el);\n if (info.el) {\n _currentInstance.initDroppable(info.el, options);\n }\n }, el);\n return _currentInstance;\n };\n\n // helpers for select/selectEndpoints\n var _setOperation = function (list, func, args, selector) {\n for (var i = 0, j = list.length; i < j; i++) {\n list[i][func].apply(list[i], args);\n }\n return selector(list);\n },\n _getOperation = function (list, func, args) {\n var out = [];\n for (var i = 0, j = list.length; i < j; i++) {\n out.push([ list[i][func].apply(list[i], args), list[i] ]);\n }\n return out;\n },\n setter = function (list, func, selector) {\n return function () {\n return _setOperation(list, func, arguments, selector);\n };\n },\n getter = function (list, func) {\n return function () {\n return _getOperation(list, func, arguments);\n };\n },\n prepareList = function (input, doNotGetIds) {\n var r = [];\n if (input) {\n if (typeof input === 'string') {\n if (input === \"*\") {\n return input;\n }\n r.push(input);\n }\n else {\n if (doNotGetIds) {\n r = input;\n }\n else {\n if (input.length) {\n for (var i = 0, j = input.length; i < j; i++) {\n r.push(_info(input[i]).id);\n }\n }\n else {\n r.push(_info(input).id);\n }\n }\n }\n }\n return r;\n },\n filterList = function (list, value, missingIsFalse) {\n if (list === \"*\") {\n return true;\n }\n return list.length > 0 ? list.indexOf(value) !== -1 : !missingIsFalse;\n };\n\n // get some connections, specifying source/target/scope\n this.getConnections = function (options, flat) {\n if (!options) {\n options = {};\n } else if (options.constructor === String) {\n options = { \"scope\": options };\n }\n var scope = options.scope || _currentInstance.getDefaultScope(),\n scopes = prepareList(scope, true),\n sources = prepareList(options.source),\n targets = prepareList(options.target),\n results = (!flat && scopes.length > 1) ? {} : [],\n _addOne = function (scope, obj) {\n if (!flat && scopes.length > 1) {\n var ss = results[scope];\n if (ss == null) {\n ss = results[scope] = [];\n }\n ss.push(obj);\n } else {\n results.push(obj);\n }\n };\n\n for (var j = 0, jj = connections.length; j < jj; j++) {\n var c = connections[j],\n sourceId = c.proxies && c.proxies[0] ? c.proxies[0].originalEp.elementId : c.sourceId,\n targetId = c.proxies && c.proxies[1] ? c.proxies[1].originalEp.elementId : c.targetId;\n\n if (filterList(scopes, c.scope) && filterList(sources, sourceId) && filterList(targets, targetId)) {\n _addOne(c.scope, c);\n }\n }\n\n return results;\n };\n\n var _curryEach = function (list, executor) {\n return function (f) {\n for (var i = 0, ii = list.length; i < ii; i++) {\n f(list[i]);\n }\n return executor(list);\n };\n },\n _curryGet = function (list) {\n return function (idx) {\n return list[idx];\n };\n };\n\n var _makeCommonSelectHandler = function (list, executor) {\n var out = {\n length: list.length,\n each: _curryEach(list, executor),\n get: _curryGet(list)\n },\n setters = [\"setHover\", \"removeAllOverlays\", \"setLabel\", \"addClass\", \"addOverlay\", \"removeOverlay\",\n \"removeOverlays\", \"showOverlay\", \"hideOverlay\", \"showOverlays\", \"hideOverlays\", \"setPaintStyle\",\n \"setHoverPaintStyle\", \"setSuspendEvents\", \"setParameter\", \"setParameters\", \"setVisible\",\n \"repaint\", \"addType\", \"toggleType\", \"removeType\", \"removeClass\", \"setType\", \"bind\", \"unbind\" ],\n\n getters = [\"getLabel\", \"getOverlay\", \"isHover\", \"getParameter\", \"getParameters\", \"getPaintStyle\",\n \"getHoverPaintStyle\", \"isVisible\", \"hasType\", \"getType\", \"isSuspendEvents\" ],\n i, ii;\n\n for (i = 0, ii = setters.length; i < ii; i++) {\n out[setters[i]] = setter(list, setters[i], executor);\n }\n\n for (i = 0, ii = getters.length; i < ii; i++) {\n out[getters[i]] = getter(list, getters[i]);\n }\n\n return out;\n };\n\n var _makeConnectionSelectHandler = function (list) {\n var common = _makeCommonSelectHandler(list, _makeConnectionSelectHandler);\n return jsPlumb.extend(common, {\n // setters\n setDetachable: setter(list, \"setDetachable\", _makeConnectionSelectHandler),\n setReattach: setter(list, \"setReattach\", _makeConnectionSelectHandler),\n setConnector: setter(list, \"setConnector\", _makeConnectionSelectHandler),\n delete: function () {\n for (var i = 0, ii = list.length; i < ii; i++) {\n _currentInstance.deleteConnection(list[i]);\n }\n },\n // getters\n isDetachable: getter(list, \"isDetachable\"),\n isReattach: getter(list, \"isReattach\")\n });\n };\n\n var _makeEndpointSelectHandler = function (list) {\n var common = _makeCommonSelectHandler(list, _makeEndpointSelectHandler);\n return jsPlumb.extend(common, {\n setEnabled: setter(list, \"setEnabled\", _makeEndpointSelectHandler),\n setAnchor: setter(list, \"setAnchor\", _makeEndpointSelectHandler),\n isEnabled: getter(list, \"isEnabled\"),\n deleteEveryConnection: function () {\n for (var i = 0, ii = list.length; i < ii; i++) {\n list[i].deleteEveryConnection();\n }\n },\n \"delete\": function () {\n for (var i = 0, ii = list.length; i < ii; i++) {\n _currentInstance.deleteEndpoint(list[i]);\n }\n }\n });\n };\n\n this.select = function (params) {\n params = params || {};\n params.scope = params.scope || \"*\";\n return _makeConnectionSelectHandler(params.connections || _currentInstance.getConnections(params, true));\n };\n\n this.selectEndpoints = function (params) {\n params = params || {};\n params.scope = params.scope || \"*\";\n var noElementFilters = !params.element && !params.source && !params.target,\n elements = noElementFilters ? \"*\" : prepareList(params.element),\n sources = noElementFilters ? \"*\" : prepareList(params.source),\n targets = noElementFilters ? \"*\" : prepareList(params.target),\n scopes = prepareList(params.scope, true);\n\n var ep = [];\n\n for (var el in endpointsByElement) {\n var either = filterList(elements, el, true),\n source = filterList(sources, el, true),\n sourceMatchExact = sources !== \"*\",\n target = filterList(targets, el, true),\n targetMatchExact = targets !== \"*\";\n\n // if they requested 'either' then just match scope. otherwise if they requested 'source' (not as a wildcard) then we have to match only endpoints that have isSource set to to true, and the same thing with isTarget.\n if (either || source || target) {\n inner:\n for (var i = 0, ii = endpointsByElement[el].length; i < ii; i++) {\n var _ep = endpointsByElement[el][i];\n if (filterList(scopes, _ep.scope, true)) {\n\n var noMatchSource = (sourceMatchExact && sources.length > 0 && !_ep.isSource),\n noMatchTarget = (targetMatchExact && targets.length > 0 && !_ep.isTarget);\n\n if (noMatchSource || noMatchTarget) {\n continue inner;\n }\n\n ep.push(_ep);\n }\n }\n }\n }\n\n return _makeEndpointSelectHandler(ep);\n };\n\n // get all connections managed by the instance of jsplumb.\n this.getAllConnections = function () {\n return connections;\n };\n this.getDefaultScope = function () {\n return DEFAULT_SCOPE;\n };\n // get an endpoint by uuid.\n this.getEndpoint = _getEndpoint;\n /**\n * Gets the list of Endpoints for a given element.\n * @method getEndpoints\n * @param {String|Element|Selector} el The element to get endpoints for.\n * @return {Endpoint[]} An array of Endpoints for the specified element.\n */\n this.getEndpoints = function (el) {\n return endpointsByElement[_info(el).id] || [];\n };\n // gets the default endpoint type. used when subclassing. see wiki.\n this.getDefaultEndpointType = function () {\n return jsPlumb.Endpoint;\n };\n // gets the default connection type. used when subclassing. see wiki.\n this.getDefaultConnectionType = function () {\n return jsPlumb.Connection;\n };\n /*\n * Gets an element's id, creating one if necessary. really only exposed\n * for the lib-specific functionality to access; would be better to pass\n * the current instance into the lib-specific code (even though this is\n * a static call. i just don't want to expose it to the public API).\n */\n this.getId = _getId;\n\n this.appendElement = _appendElement;\n\n var _hoverSuspended = false;\n this.isHoverSuspended = function () {\n return _hoverSuspended;\n };\n this.setHoverSuspended = function (s) {\n _hoverSuspended = s;\n };\n\n // set an element's connections to be hidden\n this.hide = function (el, changeEndpoints) {\n _setVisible(el, \"none\", changeEndpoints);\n return _currentInstance;\n };\n\n // exposed for other objects to use to get a unique id.\n this.idstamp = _idstamp;\n\n // this.connectorsInitialized = false;\n // this.registerConnectorType = function (connector, name) {\n // connectorTypes.push([connector, name]);\n // };\n\n // ensure that, if the current container exists, it is a DOM element and not a selector.\n // if it does not exist and `candidate` is supplied, the offset parent of that element will be set as the Container.\n // this is used to do a better default behaviour for the case that the user has not set a container:\n // addEndpoint, makeSource, makeTarget and connect all call this method with the offsetParent of the\n // element in question (for connect it is the source element). So if no container is set, it is inferred\n // to be the offsetParent of the first element the user tries to connect.\n var _ensureContainer = function (candidate) {\n if (!_container && candidate) {\n var can = _currentInstance.getElement(candidate);\n if (can.offsetParent) {\n _currentInstance.setContainer(can.offsetParent);\n }\n }\n };\n\n var _getContainerFromDefaults = function () {\n if (_currentInstance.Defaults.Container) {\n _currentInstance.setContainer(_currentInstance.Defaults.Container);\n }\n };\n\n // check if a given element is managed or not. if not, add to our map. if drawing is not suspended then\n // we'll also stash its dimensions; otherwise we'll do this in a lazy way through updateOffset.\n var _manage = _currentInstance.manage = function (id, element, _transient) {\n if (!managedElements[id]) {\n managedElements[id] = {\n el: element,\n endpoints: [],\n connections: []\n };\n\n managedElements[id].info = _updateOffset({ elId: id, timestamp: _suspendedAt });\n if (!_transient) {\n _currentInstance.fire(\"manageElement\", { id:id, info:managedElements[id].info, el:element });\n }\n }\n\n return managedElements[id];\n };\n\n var _unmanage = function(id) {\n if (managedElements[id]) {\n delete managedElements[id];\n _currentInstance.fire(\"unmanageElement\", id);\n }\n };\n\n /**\n * updates the offset and size for a given element, and stores the\n * values. if 'offset' is not null we use that (it would have been\n * passed in from a drag call) because it's faster; but if it is null,\n * or if 'recalc' is true in order to force a recalculation, we get the current values.\n */\n var _updateOffset = this.updateOffset = function (params) {\n\n var timestamp = params.timestamp, recalc = params.recalc, offset = params.offset, elId = params.elId, s;\n if (_suspendDrawing && !timestamp) {\n timestamp = _suspendedAt;\n }\n if (!recalc) {\n if (timestamp && timestamp === offsetTimestamps[elId]) {\n return {o: params.offset || offsets[elId], s: sizes[elId]};\n }\n }\n if (recalc || (!offset && offsets[elId] == null)) { // if forced repaint or no offset available, we recalculate.\n\n // get the current size and offset, and store them\n s = managedElements[elId] ? managedElements[elId].el : null;\n if (s != null) {\n sizes[elId] = _currentInstance.getSize(s);\n offsets[elId] = _currentInstance.getOffset(s);\n offsetTimestamps[elId] = timestamp;\n }\n } else {\n offsets[elId] = offset || offsets[elId];\n if (sizes[elId] == null) {\n s = managedElements[elId].el;\n if (s != null) {\n sizes[elId] = _currentInstance.getSize(s);\n }\n }\n offsetTimestamps[elId] = timestamp;\n }\n\n if (offsets[elId] && !offsets[elId].right) {\n offsets[elId].right = offsets[elId].left + sizes[elId][0];\n offsets[elId].bottom = offsets[elId].top + sizes[elId][1];\n offsets[elId].width = sizes[elId][0];\n offsets[elId].height = sizes[elId][1];\n offsets[elId].centerx = offsets[elId].left + (offsets[elId].width / 2);\n offsets[elId].centery = offsets[elId].top + (offsets[elId].height / 2);\n }\n\n return {o: offsets[elId], s: sizes[elId]};\n };\n\n /**\n * callback from the current library to tell us to prepare ourselves (attach\n * mouse listeners etc; can't do that until the library has provided a bind method)\n */\n this.init = function () {\n if (!initialized) {\n _getContainerFromDefaults();\n _currentInstance.anchorManager = new root.jsPlumb.AnchorManager({jsPlumbInstance: _currentInstance});\n initialized = true;\n _currentInstance.fire(\"ready\", _currentInstance);\n }\n }.bind(this);\n\n this.log = log;\n this.jsPlumbUIComponent = jsPlumbUIComponent;\n\n /*\n * Creates an anchor with the given params.\n *\n *\n * Returns: The newly created Anchor.\n * Throws: an error if a named anchor was not found.\n */\n this.makeAnchor = function () {\n var pp, _a = function (t, p) {\n if (root.jsPlumb.Anchors[t]) {\n return new root.jsPlumb.Anchors[t](p);\n }\n if (!_currentInstance.Defaults.DoNotThrowErrors) {\n throw { msg: \"jsPlumb: unknown anchor type '\" + t + \"'\" };\n }\n };\n if (arguments.length === 0) {\n return null;\n }\n var specimen = arguments[0], elementId = arguments[1], jsPlumbInstance = arguments[2], newAnchor = null;\n // if it appears to be an anchor already...\n if (specimen.compute && specimen.getOrientation) {\n return specimen;\n } //TODO hazy here about whether it should be added or is already added somehow.\n // is it the name of an anchor type?\n else if (typeof specimen === \"string\") {\n newAnchor = _a(arguments[0], {elementId: elementId, jsPlumbInstance: _currentInstance});\n }\n // is it an array? it will be one of:\n // an array of [spec, params] - this defines a single anchor, which may be dynamic, but has parameters.\n // an array of arrays - this defines some dynamic anchors\n // an array of numbers - this defines a single anchor.\n else if (_ju.isArray(specimen)) {\n if (_ju.isArray(specimen[0]) || _ju.isString(specimen[0])) {\n // if [spec, params] format\n if (specimen.length === 2 && _ju.isObject(specimen[1])) {\n // if first arg is a string, its a named anchor with params\n if (_ju.isString(specimen[0])) {\n pp = root.jsPlumb.extend({elementId: elementId, jsPlumbInstance: _currentInstance}, specimen[1]);\n newAnchor = _a(specimen[0], pp);\n }\n // otherwise first arg is array, second is params. we treat as a dynamic anchor, which is fine\n // even if the first arg has only one entry. you could argue all anchors should be implicitly dynamic in fact.\n else {\n pp = root.jsPlumb.extend({elementId: elementId, jsPlumbInstance: _currentInstance, anchors: specimen[0]}, specimen[1]);\n newAnchor = new root.jsPlumb.DynamicAnchor(pp);\n }\n }\n else {\n newAnchor = new jsPlumb.DynamicAnchor({anchors: specimen, selector: null, elementId: elementId, jsPlumbInstance: _currentInstance});\n }\n\n }\n else {\n var anchorParams = {\n x: specimen[0], y: specimen[1],\n orientation: (specimen.length >= 4) ? [ specimen[2], specimen[3] ] : [0, 0],\n offsets: (specimen.length >= 6) ? [ specimen[4], specimen[5] ] : [ 0, 0 ],\n elementId: elementId,\n jsPlumbInstance: _currentInstance,\n cssClass: specimen.length === 7 ? specimen[6] : null\n };\n newAnchor = new root.jsPlumb.Anchor(anchorParams);\n newAnchor.clone = function () {\n return new root.jsPlumb.Anchor(anchorParams);\n };\n }\n }\n\n if (!newAnchor.id) {\n newAnchor.id = \"anchor_\" + _idstamp();\n }\n return newAnchor;\n };\n\n /**\n * makes a list of anchors from the given list of types or coords, eg\n * [\"TopCenter\", \"RightMiddle\", \"BottomCenter\", [0, 1, -1, -1] ]\n */\n this.makeAnchors = function (types, elementId, jsPlumbInstance) {\n var r = [];\n for (var i = 0, ii = types.length; i < ii; i++) {\n if (typeof types[i] === \"string\") {\n r.push(root.jsPlumb.Anchors[types[i]]({elementId: elementId, jsPlumbInstance: jsPlumbInstance}));\n }\n else if (_ju.isArray(types[i])) {\n r.push(_currentInstance.makeAnchor(types[i], elementId, jsPlumbInstance));\n }\n }\n return r;\n };\n\n /**\n * Makes a dynamic anchor from the given list of anchors (which may be in shorthand notation as strings or dimension arrays, or Anchor\n * objects themselves) and the given, optional, anchorSelector function (jsPlumb uses a default if this is not provided; most people will\n * not need to provide this - i think).\n */\n this.makeDynamicAnchor = function (anchors, anchorSelector) {\n return new root.jsPlumb.DynamicAnchor({anchors: anchors, selector: anchorSelector, elementId: null, jsPlumbInstance: _currentInstance});\n };\n\n// --------------------- makeSource/makeTarget ---------------------------------------------- \n\n this.targetEndpointDefinitions = {};\n this.sourceEndpointDefinitions = {};\n\n var selectorFilter = function (evt, _el, selector, _instance, negate) {\n var t = evt.target || evt.srcElement, ok = false,\n sel = _instance.getSelector(_el, selector);\n for (var j = 0; j < sel.length; j++) {\n if (sel[j] === t) {\n ok = true;\n break;\n }\n }\n return negate ? !ok : ok;\n };\n\n var _makeElementDropHandler = function (elInfo, p, dropOptions, isSource, isTarget) {\n var proxyComponent = new jsPlumbUIComponent(p);\n var _drop = p._jsPlumb.EndpointDropHandler({\n jsPlumb: _currentInstance,\n enabled: function () {\n return elInfo.def.enabled;\n },\n isFull: function () {\n var targetCount = _currentInstance.select({target: elInfo.id}).length;\n return elInfo.def.maxConnections > 0 && targetCount >= elInfo.def.maxConnections;\n },\n element: elInfo.el,\n elementId: elInfo.id,\n isSource: isSource,\n isTarget: isTarget,\n addClass: function (clazz) {\n _currentInstance.addClass(elInfo.el, clazz);\n },\n removeClass: function (clazz) {\n _currentInstance.removeClass(elInfo.el, clazz);\n },\n onDrop: function (jpc) {\n var source = jpc.endpoints[0];\n source.anchor.locked = false;\n },\n isDropAllowed: function () {\n return proxyComponent.isDropAllowed.apply(proxyComponent, arguments);\n },\n isRedrop:function(jpc) {\n return (jpc.suspendedElement != null && jpc.suspendedEndpoint != null && jpc.suspendedEndpoint.element === elInfo.el);\n },\n getEndpoint: function (jpc) {\n\n // make a new Endpoint for the target, or get it from the cache if uniqueEndpoint\n // is set. if its a redrop the new endpoint will be immediately cleaned up.\n\n var newEndpoint = elInfo.def.endpoint;\n\n // if no cached endpoint, or there was one but it has been cleaned up\n // (ie. detached), create a new one\n if (newEndpoint == null || newEndpoint._jsPlumb == null) {\n var eps = _currentInstance.deriveEndpointAndAnchorSpec(jpc.getType().join(\" \"), true);\n var pp = eps.endpoints ? root.jsPlumb.extend(p, {\n endpoint:elInfo.def.def.endpoint || eps.endpoints[1]\n }) :p;\n if (eps.anchors) {\n pp = root.jsPlumb.extend(pp, {\n anchor:elInfo.def.def.anchor || eps.anchors[1]\n });\n }\n newEndpoint = _currentInstance.addEndpoint(elInfo.el, pp);\n newEndpoint._mtNew = true;\n }\n\n if (p.uniqueEndpoint) {\n elInfo.def.endpoint = newEndpoint;\n }\n\n newEndpoint.setDeleteOnEmpty(true);\n\n // if connection is detachable, init the new endpoint to be draggable, to support that happening.\n if (jpc.isDetachable()) {\n newEndpoint.initDraggable();\n }\n\n // if the anchor has a 'positionFinder' set, then delegate to that function to find\n // out where to locate the anchor.\n if (newEndpoint.anchor.positionFinder != null) {\n var dropPosition = _currentInstance.getUIPosition(arguments, _currentInstance.getZoom()),\n elPosition = _currentInstance.getOffset(elInfo.el),\n elSize = _currentInstance.getSize(elInfo.el),\n ap = dropPosition == null ? [0,0] : newEndpoint.anchor.positionFinder(dropPosition, elPosition, elSize, newEndpoint.anchor.constructorParams);\n\n newEndpoint.anchor.x = ap[0];\n newEndpoint.anchor.y = ap[1];\n // now figure an orientation for it..kind of hard to know what to do actually. probably the best thing i can do is to\n // support specifying an orientation in the anchor's spec. if one is not supplied then i will make the orientation\n // be what will cause the most natural link to the source: it will be pointing at the source, but it needs to be\n // specified in one axis only, and so how to make that choice? i think i will use whichever axis is the one in which\n // the target is furthest away from the source.\n }\n\n return newEndpoint;\n },\n maybeCleanup: function (ep) {\n if (ep._mtNew && ep.connections.length === 0) {\n _currentInstance.deleteObject({endpoint: ep});\n }\n else {\n delete ep._mtNew;\n }\n }\n });\n\n // wrap drop events as needed and initialise droppable\n var dropEvent = root.jsPlumb.dragEvents.drop;\n dropOptions.scope = dropOptions.scope || (p.scope || _currentInstance.Defaults.Scope);\n dropOptions[dropEvent] = _ju.wrap(dropOptions[dropEvent], _drop, true);\n\n // if target, return true from the over event. this will cause katavorio to stop setting drops to hover\n // if multipleDrop is set to false.\n if (isTarget) {\n dropOptions[root.jsPlumb.dragEvents.over] = function () { return true; };\n }\n\n // vanilla jsplumb only\n if (p.allowLoopback === false) {\n dropOptions.canDrop = function (_drag) {\n var de = _drag.getDragElement()._jsPlumbRelatedElement;\n return de !== elInfo.el;\n };\n }\n _currentInstance.initDroppable(elInfo.el, dropOptions, \"internal\");\n\n return _drop;\n\n };\n\n // see API docs\n this.makeTarget = function (el, params, referenceParams) {\n\n // put jsplumb ref into params without altering the params passed in\n var p = root.jsPlumb.extend({_jsPlumb: this}, referenceParams);\n root.jsPlumb.extend(p, params);\n\n var maxConnections = p.maxConnections || -1,\n\n _doOne = function (el) {\n\n // get the element's id and store the endpoint definition for it. jsPlumb.connect calls will look for one of these,\n // and use the endpoint definition if found.\n // decode the info for this element (id and element)\n var elInfo = _info(el),\n elid = elInfo.id,\n dropOptions = root.jsPlumb.extend({}, p.dropOptions || {}),\n type = p.connectionType || \"default\";\n\n this.targetEndpointDefinitions[elid] = this.targetEndpointDefinitions[elid] || {};\n\n _ensureContainer(elid);\n\n // if this is a group and the user has not mandated a rank, set to -1 so that Nodes takes\n // precedence.\n if (elInfo.el._isJsPlumbGroup && dropOptions.rank == null) {\n dropOptions.rank = -1;\n }\n\n // store the definition\n var _def = {\n def: root.jsPlumb.extend({}, p),\n uniqueEndpoint: p.uniqueEndpoint,\n maxConnections: maxConnections,\n enabled: true\n };\n\n if (p.createEndpoint) {\n _def.uniqueEndpoint = true;\n _def.endpoint = _currentInstance.addEndpoint(el, _def.def);\n _def.endpoint.setDeleteOnEmpty(false);\n }\n\n elInfo.def = _def;\n this.targetEndpointDefinitions[elid][type] = _def;\n _makeElementDropHandler(elInfo, p, dropOptions, p.isSource === true, true);\n // stash the definition on the drop\n elInfo.el._katavorioDrop[elInfo.el._katavorioDrop.length - 1].targetDef = _def;\n\n }.bind(this);\n\n // make an array if only given one element\n var inputs = el.length && el.constructor !== String ? el : [ el ];\n\n // register each one in the list.\n for (var i = 0, ii = inputs.length; i < ii; i++) {\n _doOne(inputs[i]);\n }\n\n return this;\n };\n\n // see api docs\n this.unmakeTarget = function (el, doNotClearArrays) {\n var info = _info(el);\n _currentInstance.destroyDroppable(info.el, \"internal\");\n if (!doNotClearArrays) {\n delete this.targetEndpointDefinitions[info.id];\n }\n\n return this;\n };\n\n // see api docs\n this.makeSource = function (el, params, referenceParams) {\n var p = root.jsPlumb.extend({_jsPlumb: this}, referenceParams);\n root.jsPlumb.extend(p, params);\n var type = p.connectionType || \"default\";\n var aae = _currentInstance.deriveEndpointAndAnchorSpec(type);\n p.endpoint = p.endpoint || aae.endpoints[0];\n p.anchor = p.anchor || aae.anchors[0];\n var maxConnections = p.maxConnections || -1,\n onMaxConnections = p.onMaxConnections,\n _doOne = function (elInfo) {\n // get the element's id and store the endpoint definition for it. jsPlumb.connect calls will look for one of these,\n // and use the endpoint definition if found.\n var elid = elInfo.id,\n _del = this.getElement(elInfo.el);\n\n this.sourceEndpointDefinitions[elid] = this.sourceEndpointDefinitions[elid] || {};\n _ensureContainer(elid);\n\n var _def = {\n def:root.jsPlumb.extend({}, p),\n uniqueEndpoint: p.uniqueEndpoint,\n maxConnections: maxConnections,\n enabled: true\n };\n\n if (p.createEndpoint) {\n _def.uniqueEndpoint = true;\n _def.endpoint = _currentInstance.addEndpoint(el, _def.def);\n _def.endpoint.setDeleteOnEmpty(false);\n }\n\n this.sourceEndpointDefinitions[elid][type] = _def;\n elInfo.def = _def;\n\n var stopEvent = root.jsPlumb.dragEvents.stop,\n dragEvent = root.jsPlumb.dragEvents.drag,\n dragOptions = root.jsPlumb.extend({ }, p.dragOptions || {}),\n existingDrag = dragOptions.drag,\n existingStop = dragOptions.stop,\n ep = null,\n endpointAddedButNoDragYet = false;\n\n // set scope if its not set in dragOptions but was passed in in params\n dragOptions.scope = dragOptions.scope || p.scope;\n\n dragOptions[dragEvent] = _ju.wrap(dragOptions[dragEvent], function () {\n if (existingDrag) {\n existingDrag.apply(this, arguments);\n }\n endpointAddedButNoDragYet = false;\n });\n\n dragOptions[stopEvent] = _ju.wrap(dragOptions[stopEvent], function () {\n\n if (existingStop) {\n existingStop.apply(this, arguments);\n }\n this.currentlyDragging = false;\n if (ep._jsPlumb != null) { // if not cleaned up...\n\n // reset the anchor to the anchor that was initially provided. the one we were using to drag\n // the connection was just a placeholder that was located at the place the user pressed the\n // mouse button to initiate the drag.\n var anchorDef = p.anchor || this.Defaults.Anchor,\n oldAnchor = ep.anchor,\n oldConnection = ep.connections[0];\n\n var newAnchor = this.makeAnchor(anchorDef, elid, this),\n _el = ep.element;\n\n // if the anchor has a 'positionFinder' set, then delegate to that function to find\n // out where to locate the anchor. issue 117.\n if (newAnchor.positionFinder != null) {\n var elPosition = _currentInstance.getOffset(_el),\n elSize = this.getSize(_el),\n dropPosition = { left: elPosition.left + (oldAnchor.x * elSize[0]), top: elPosition.top + (oldAnchor.y * elSize[1]) },\n ap = newAnchor.positionFinder(dropPosition, elPosition, elSize, newAnchor.constructorParams);\n\n newAnchor.x = ap[0];\n newAnchor.y = ap[1];\n }\n\n ep.setAnchor(newAnchor, true);\n ep.repaint();\n this.repaint(ep.elementId);\n if (oldConnection != null) {\n this.repaint(oldConnection.targetId);\n }\n }\n }.bind(this));\n\n // when the user presses the mouse, add an Endpoint, if we are enabled.\n var mouseDownListener = function (e) {\n // on right mouse button, abort.\n if (e.which === 3 || e.button === 2) {\n return;\n }\n\n // TODO store def on element.\n var def = this.sourceEndpointDefinitions[elid][type];\n\n // if disabled, return.\n if (!def.enabled) {\n return;\n }\n\n elid = this.getId(this.getElement(elInfo.el)); // elid might have changed since this method was called to configure the element.\n\n // if a filter was given, run it, and return if it says no.\n if (p.filter) {\n var r = _ju.isString(p.filter) ? selectorFilter(e, elInfo.el, p.filter, this, p.filterExclude) : p.filter(e, elInfo.el);\n if (r === false) {\n return;\n }\n }\n\n // if maxConnections reached\n var sourceCount = this.select({source: elid}).length;\n if (def.maxConnections >= 0 && (sourceCount >= def.maxConnections)) {\n if (onMaxConnections) {\n onMaxConnections({\n element: elInfo.el,\n maxConnections: maxConnections\n }, e);\n }\n return false;\n }\n\n // find the position on the element at which the mouse was pressed; this is where the endpoint\n // will be located.\n var elxy = root.jsPlumb.getPositionOnElement(e, _del, _zoom);\n\n // we need to override the anchor in here, and force 'isSource', but we don't want to mess with\n // the params passed in, because after a connection is established we're going to reset the endpoint\n // to have the anchor we were given.\n var tempEndpointParams = {};\n root.jsPlumb.extend(tempEndpointParams, p);\n tempEndpointParams.isTemporarySource = true;\n tempEndpointParams.anchor = [ elxy[0], elxy[1] , 0, 0];\n tempEndpointParams.dragOptions = dragOptions;\n\n if (def.def.scope) {\n tempEndpointParams.scope = def.def.scope;\n }\n\n ep = this.addEndpoint(elid, tempEndpointParams);\n endpointAddedButNoDragYet = true;\n ep.setDeleteOnEmpty(true);\n\n // if unique endpoint and it's already been created, push it onto the endpoint we create. at the end\n // of a successful connection we'll switch to that endpoint.\n // TODO this is the same code as the programmatic endpoints create on line 1050 ish\n if (def.uniqueEndpoint) {\n if (!def.endpoint) {\n def.endpoint = ep;\n ep.setDeleteOnEmpty(false);\n }\n else {\n ep.finalEndpoint = def.endpoint;\n }\n }\n\n var _delTempEndpoint = function () {\n // this mouseup event is fired only if no dragging occurred, by jquery and yui, but for mootools\n // it is fired even if dragging has occurred, in which case we would blow away a perfectly\n // legitimate endpoint, were it not for this check. the flag is set after adding an\n // endpoint and cleared in a drag listener we set in the dragOptions above.\n _currentInstance.off(ep.canvas, \"mouseup\", _delTempEndpoint);\n _currentInstance.off(elInfo.el, \"mouseup\", _delTempEndpoint);\n if (endpointAddedButNoDragYet) {\n endpointAddedButNoDragYet = false;\n _currentInstance.deleteEndpoint(ep);\n }\n };\n\n _currentInstance.on(ep.canvas, \"mouseup\", _delTempEndpoint);\n _currentInstance.on(elInfo.el, \"mouseup\", _delTempEndpoint);\n\n // optionally check for attributes to extract from the source element\n var payload = {};\n if (def.def.extract) {\n for (var att in def.def.extract) {\n var v = (e.srcElement || e.target).getAttribute(att);\n if (v) {\n payload[def.def.extract[att]] = v;\n }\n }\n }\n\n // and then trigger its mousedown event, which will kick off a drag, which will start dragging\n // a new connection from this endpoint.\n _currentInstance.trigger(ep.canvas, \"mousedown\", e, payload);\n\n _ju.consume(e);\n\n }.bind(this);\n\n this.on(elInfo.el, \"mousedown\", mouseDownListener);\n _def.trigger = mouseDownListener;\n\n // if a filter was provided, set it as a dragFilter on the element,\n // to prevent the element drag function from kicking in when we want to\n // drag a new connection\n if (p.filter && (_ju.isString(p.filter) || _ju.isFunction(p.filter))) {\n _currentInstance.setDragFilter(elInfo.el, p.filter);\n }\n\n var dropOptions = root.jsPlumb.extend({}, p.dropOptions || {});\n\n _makeElementDropHandler(elInfo, p, dropOptions, true, p.isTarget === true);\n\n }.bind(this);\n\n var inputs = el.length && el.constructor !== String ? el : [ el ];\n for (var i = 0, ii = inputs.length; i < ii; i++) {\n _doOne(_info(inputs[i]));\n }\n\n return this;\n };\n\n // see api docs\n this.unmakeSource = function (el, connectionType, doNotClearArrays) {\n var info = _info(el);\n _currentInstance.destroyDroppable(info.el, \"internal\");\n var eldefs = this.sourceEndpointDefinitions[info.id];\n if (eldefs) {\n for (var def in eldefs) {\n if (connectionType == null || connectionType === def) {\n var mouseDownListener = eldefs[def].trigger;\n if (mouseDownListener) {\n _currentInstance.off(info.el, \"mousedown\", mouseDownListener);\n }\n if (!doNotClearArrays) {\n delete this.sourceEndpointDefinitions[info.id][def];\n }\n }\n }\n }\n\n return this;\n };\n\n // see api docs\n this.unmakeEverySource = function () {\n for (var i in this.sourceEndpointDefinitions) {\n _currentInstance.unmakeSource(i, null, true);\n }\n\n this.sourceEndpointDefinitions = {};\n return this;\n };\n\n var _getScope = function (el, types, connectionType) {\n types = _ju.isArray(types) ? types : [ types ];\n var id = _getId(el);\n connectionType = connectionType || \"default\";\n for (var i = 0; i < types.length; i++) {\n var eldefs = this[types[i]][id];\n if (eldefs && eldefs[connectionType]) {\n return eldefs[connectionType].def.scope || this.Defaults.Scope;\n }\n }\n }.bind(this);\n\n var _setScope = function (el, scope, types, connectionType) {\n types = _ju.isArray(types) ? types : [ types ];\n var id = _getId(el);\n connectionType = connectionType || \"default\";\n for (var i = 0; i < types.length; i++) {\n var eldefs = this[types[i]][id];\n if (eldefs && eldefs[connectionType]) {\n eldefs[connectionType].def.scope = scope;\n }\n }\n\n }.bind(this);\n\n this.getScope = function (el, scope) {\n return _getScope(el, [ \"sourceEndpointDefinitions\", \"targetEndpointDefinitions\" ]);\n };\n this.getSourceScope = function (el) {\n return _getScope(el, \"sourceEndpointDefinitions\");\n };\n this.getTargetScope = function (el) {\n return _getScope(el, \"targetEndpointDefinitions\");\n };\n this.setScope = function (el, scope, connectionType) {\n this.setSourceScope(el, scope, connectionType);\n this.setTargetScope(el, scope, connectionType);\n };\n this.setSourceScope = function (el, scope, connectionType) {\n _setScope(el, scope, \"sourceEndpointDefinitions\", connectionType);\n // we get the source scope during the mousedown event, but we also want to set this.\n this.setDragScope(el, scope);\n };\n this.setTargetScope = function (el, scope, connectionType) {\n _setScope(el, scope, \"targetEndpointDefinitions\", connectionType);\n this.setDropScope(el, scope);\n };\n\n // see api docs\n this.unmakeEveryTarget = function () {\n for (var i in this.targetEndpointDefinitions) {\n _currentInstance.unmakeTarget(i, true);\n }\n\n this.targetEndpointDefinitions = {};\n return this;\n };\n\n // does the work of setting a source enabled or disabled.\n var _setEnabled = function (type, el, state, toggle, connectionType) {\n var a = type === \"source\" ? this.sourceEndpointDefinitions : this.targetEndpointDefinitions,\n originalState, info, newState;\n\n connectionType = connectionType || \"default\";\n\n // a selector or an array\n if (el.length && !_ju.isString(el)) {\n originalState = [];\n for (var i = 0, ii = el.length; i < ii; i++) {\n info = _info(el[i]);\n if (a[info.id] && a[info.id][connectionType]) {\n originalState[i] = a[info.id][connectionType].enabled;\n newState = toggle ? !originalState[i] : state;\n a[info.id][connectionType].enabled = newState;\n _currentInstance[newState ? \"removeClass\" : \"addClass\"](info.el, \"jtk-\" + type + \"-disabled\");\n }\n }\n }\n // otherwise a DOM element or a String ID.\n else {\n info = _info(el);\n var id = info.id;\n if (a[id] && a[id][connectionType]) {\n originalState = a[id][connectionType].enabled;\n newState = toggle ? !originalState : state;\n a[id][connectionType].enabled = newState;\n _currentInstance[newState ? \"removeClass\" : \"addClass\"](info.el, \"jtk-\" + type + \"-disabled\");\n }\n }\n return originalState;\n }.bind(this);\n\n var _first = function (el, fn) {\n if (_ju.isString(el) || !el.length) {\n return fn.apply(this, [ el ]);\n }\n else if (el.length) {\n return fn.apply(this, [ el[0] ]);\n }\n\n }.bind(this);\n\n this.toggleSourceEnabled = function (el, connectionType) {\n _setEnabled(\"source\", el, null, true, connectionType);\n return this.isSourceEnabled(el, connectionType);\n };\n\n this.setSourceEnabled = function (el, state, connectionType) {\n return _setEnabled(\"source\", el, state, null, connectionType);\n };\n this.isSource = function (el, connectionType) {\n connectionType = connectionType || \"default\";\n return _first(el, function (_el) {\n var eldefs = this.sourceEndpointDefinitions[_info(_el).id];\n return eldefs != null && eldefs[connectionType] != null;\n }.bind(this));\n };\n this.isSourceEnabled = function (el, connectionType) {\n connectionType = connectionType || \"default\";\n return _first(el, function (_el) {\n var sep = this.sourceEndpointDefinitions[_info(_el).id];\n return sep && sep[connectionType] && sep[connectionType].enabled === true;\n }.bind(this));\n };\n\n this.toggleTargetEnabled = function (el, connectionType) {\n _setEnabled(\"target\", el, null, true, connectionType);\n return this.isTargetEnabled(el, connectionType);\n };\n\n this.isTarget = function (el, connectionType) {\n connectionType = connectionType || \"default\";\n return _first(el, function (_el) {\n var eldefs = this.targetEndpointDefinitions[_info(_el).id];\n return eldefs != null && eldefs[connectionType] != null;\n }.bind(this));\n };\n this.isTargetEnabled = function (el, connectionType) {\n connectionType = connectionType || \"default\";\n return _first(el, function (_el) {\n var tep = this.targetEndpointDefinitions[_info(_el).id];\n return tep && tep[connectionType] && tep[connectionType].enabled === true;\n }.bind(this));\n };\n this.setTargetEnabled = function (el, state, connectionType) {\n return _setEnabled(\"target\", el, state, null, connectionType);\n };\n\n// --------------------- end makeSource/makeTarget ----------------------------------------------\n\n this.ready = function (fn) {\n _currentInstance.bind(\"ready\", fn);\n };\n\n var _elEach = function(el, fn) {\n // support both lists...\n if (typeof el === 'object' && el.length) {\n for (var i = 0, ii = el.length; i < ii; i++) {\n fn(el[i]);\n }\n }\n else {// ...and single strings or elements.\n fn(el);\n }\n\n return _currentInstance;\n };\n\n // repaint some element's endpoints and connections\n this.repaint = function (el, ui, timestamp) {\n return _elEach(el, function(_el) {\n _draw(_el, ui, timestamp);\n });\n };\n\n this.revalidate = function (el, timestamp, isIdAlready) {\n return _elEach(el, function(_el) {\n var elId = isIdAlready ? _el : _currentInstance.getId(_el);\n _currentInstance.updateOffset({ elId: elId, recalc: true, timestamp:timestamp });\n var dm = _currentInstance.getDragManager();\n if (dm) {\n dm.updateOffsets(elId);\n }\n _currentInstance.repaint(_el);\n });\n };\n\n // repaint every endpoint and connection.\n this.repaintEverything = function () {\n // TODO this timestamp causes continuous anchors to not repaint properly.\n // fix this. do not just take out the timestamp. it runs a lot faster with\n // the timestamp included.\n var timestamp = _timestamp(), elId;\n\n for (elId in endpointsByElement) {\n _currentInstance.updateOffset({ elId: elId, recalc: true, timestamp: timestamp });\n }\n\n for (elId in endpointsByElement) {\n _draw(elId, null, timestamp);\n }\n\n return this;\n };\n\n this.removeAllEndpoints = function (el, recurse, affectedElements) {\n affectedElements = affectedElements || [];\n var _one = function (_el) {\n var info = _info(_el),\n ebe = endpointsByElement[info.id],\n i, ii;\n\n if (ebe) {\n affectedElements.push(info);\n for (i = 0, ii = ebe.length; i < ii; i++) {\n _currentInstance.deleteEndpoint(ebe[i], false);\n }\n }\n delete endpointsByElement[info.id];\n\n if (recurse) {\n if (info.el && info.el.nodeType !== 3 && info.el.nodeType !== 8) {\n for (i = 0, ii = info.el.childNodes.length; i < ii; i++) {\n _one(info.el.childNodes[i]);\n }\n }\n }\n\n };\n _one(el);\n return this;\n };\n\n var _doRemove = function(info, affectedElements) {\n _currentInstance.removeAllEndpoints(info.id, true, affectedElements);\n var dm = _currentInstance.getDragManager();\n var _one = function(_info) {\n\n if (dm) {\n dm.elementRemoved(_info.id);\n }\n _currentInstance.anchorManager.clearFor(_info.id);\n _currentInstance.anchorManager.removeFloatingConnection(_info.id);\n\n if (_currentInstance.isSource(_info.el)) {\n _currentInstance.unmakeSource(_info.el);\n }\n if (_currentInstance.isTarget(_info.el)) {\n _currentInstance.unmakeTarget(_info.el);\n }\n _currentInstance.destroyDraggable(_info.el);\n _currentInstance.destroyDroppable(_info.el);\n\n\n delete _currentInstance.floatingConnections[_info.id];\n delete managedElements[_info.id];\n delete offsets[_info.id];\n if (_info.el) {\n _currentInstance.removeElement(_info.el);\n _info.el._jsPlumb = null;\n }\n };\n\n // remove all affected child elements\n for (var ae = 1; ae < affectedElements.length; ae++) {\n _one(affectedElements[ae]);\n }\n // and always remove the requested one from the dom.\n _one(info);\n };\n\n /**\n * Remove the given element, including cleaning up all endpoints registered for it.\n * This is exposed in the public API but also used internally by jsPlumb when removing the\n * element associated with a connection drag.\n */\n this.remove = function (el, doNotRepaint) {\n var info = _info(el), affectedElements = [];\n if (info.text) {\n info.el.parentNode.removeChild(info.el);\n }\n else if (info.id) {\n _currentInstance.batch(function () {\n _doRemove(info, affectedElements);\n }, doNotRepaint === false);\n }\n return _currentInstance;\n };\n\n this.empty = function (el, doNotRepaint) {\n var affectedElements = [];\n var _one = function(el, dontRemoveFocus) {\n var info = _info(el);\n if (info.text) {\n info.el.parentNode.removeChild(info.el);\n }\n else if (info.el) {\n while(info.el.childNodes.length > 0) {\n _one(info.el.childNodes[0]);\n }\n if (!dontRemoveFocus) {\n _doRemove(info, affectedElements);\n }\n }\n };\n\n _currentInstance.batch(function() {\n _one(el, true);\n }, doNotRepaint === false);\n\n return _currentInstance;\n };\n\n this.reset = function (doNotUnbindInstanceEventListeners) {\n _currentInstance.silently(function() {\n _hoverSuspended = false;\n _currentInstance.removeAllGroups();\n _currentInstance.removeGroupManager();\n _currentInstance.deleteEveryEndpoint();\n if (!doNotUnbindInstanceEventListeners) {\n _currentInstance.unbind();\n }\n this.targetEndpointDefinitions = {};\n this.sourceEndpointDefinitions = {};\n connections.length = 0;\n if (this.doReset) {\n this.doReset();\n }\n }.bind(this));\n };\n\n var _clearObject = function (obj) {\n if (obj.canvas && obj.canvas.parentNode) {\n obj.canvas.parentNode.removeChild(obj.canvas);\n }\n obj.cleanup();\n obj.destroy();\n };\n\n this.clear = function () {\n _currentInstance.select().each(_clearObject);\n _currentInstance.selectEndpoints().each(_clearObject);\n\n endpointsByElement = {};\n endpointsByUUID = {};\n };\n\n this.setDefaultScope = function (scope) {\n DEFAULT_SCOPE = scope;\n return _currentInstance;\n };\n\n // sets whether or not some element should be currently draggable.\n this.setDraggable = _setDraggable;\n\n this.deriveEndpointAndAnchorSpec = function(type, dontPrependDefault) {\n var bits = ((dontPrependDefault ? \"\" : \"default \") + type).split(/[\\s]/), eps = null, ep = null, a = null, as = null;\n for (var i = 0; i < bits.length; i++) {\n var _t = _currentInstance.getType(bits[i], \"connection\");\n if (_t) {\n if (_t.endpoints) {\n eps = _t.endpoints;\n }\n if (_t.endpoint) {\n ep = _t.endpoint;\n }\n if (_t.anchors) {\n as = _t.anchors;\n }\n if (_t.anchor) {\n a = _t.anchor;\n }\n }\n }\n return { endpoints: eps ? eps : [ ep, ep ], anchors: as ? as : [a, a ]};\n };\n\n // sets the id of some element, changing whatever we need to to keep track.\n this.setId = function (el, newId, doNotSetAttribute) {\n //\n var id;\n\n if (_ju.isString(el)) {\n id = el;\n }\n else {\n el = this.getElement(el);\n id = this.getId(el);\n }\n\n var sConns = this.getConnections({source: id, scope: '*'}, true),\n tConns = this.getConnections({target: id, scope: '*'}, true);\n\n newId = \"\" + newId;\n\n if (!doNotSetAttribute) {\n el = this.getElement(id);\n this.setAttribute(el, \"id\", newId);\n }\n else {\n el = this.getElement(newId);\n }\n\n endpointsByElement[newId] = endpointsByElement[id] || [];\n for (var i = 0, ii = endpointsByElement[newId].length; i < ii; i++) {\n endpointsByElement[newId][i].setElementId(newId);\n endpointsByElement[newId][i].setReferenceElement(el);\n }\n delete endpointsByElement[id];\n\n this.sourceEndpointDefinitions[newId] = this.sourceEndpointDefinitions[id];\n delete this.sourceEndpointDefinitions[id];\n this.targetEndpointDefinitions[newId] = this.targetEndpointDefinitions[id];\n delete this.targetEndpointDefinitions[id];\n\n this.anchorManager.changeId(id, newId);\n var dm = this.getDragManager();\n if (dm) {\n dm.changeId(id, newId);\n }\n managedElements[newId] = managedElements[id];\n delete managedElements[id];\n\n var _conns = function (list, epIdx, type) {\n for (var i = 0, ii = list.length; i < ii; i++) {\n list[i].endpoints[epIdx].setElementId(newId);\n list[i].endpoints[epIdx].setReferenceElement(el);\n list[i][type + \"Id\"] = newId;\n list[i][type] = el;\n }\n };\n _conns(sConns, 0, \"source\");\n _conns(tConns, 1, \"target\");\n\n this.repaint(newId);\n };\n\n this.setDebugLog = function (debugLog) {\n log = debugLog;\n };\n\n this.setSuspendDrawing = function (val, repaintAfterwards) {\n var curVal = _suspendDrawing;\n _suspendDrawing = val;\n if (val) {\n _suspendedAt = new Date().getTime();\n } else {\n _suspendedAt = null;\n }\n if (repaintAfterwards) {\n this.repaintEverything();\n }\n return curVal;\n };\n\n // returns whether or not drawing is currently suspended.\n this.isSuspendDrawing = function () {\n return _suspendDrawing;\n };\n\n // return timestamp for when drawing was suspended.\n this.getSuspendedAt = function () {\n return _suspendedAt;\n };\n\n this.batch = function (fn, doNotRepaintAfterwards) {\n var _wasSuspended = this.isSuspendDrawing();\n if (!_wasSuspended) {\n this.setSuspendDrawing(true);\n }\n try {\n fn();\n }\n catch (e) {\n _ju.log(\"Function run while suspended failed\", e);\n }\n if (!_wasSuspended) {\n this.setSuspendDrawing(false, !doNotRepaintAfterwards);\n }\n };\n\n this.doWhileSuspended = this.batch;\n\n this.getCachedData = _getCachedData;\n this.timestamp = _timestamp;\n this.show = function (el, changeEndpoints) {\n _setVisible(el, \"block\", changeEndpoints);\n return _currentInstance;\n };\n\n // TODO: update this method to return the current state.\n this.toggleVisible = _toggleVisible;\n this.toggleDraggable = _toggleDraggable;\n this.addListener = this.bind;\n\n var floatingConnections = [];\n this.registerFloatingConnection = function(info, conn, ep) {\n floatingConnections[info.id] = conn;\n // only register for the target endpoint; we will not be dragging the source at any time\n // before this connection is either discarded or made into a permanent connection.\n _ju.addToList(endpointsByElement, info.id, ep);\n };\n this.getFloatingConnectionFor = function(id) {\n return floatingConnections[id];\n };\n };\n\n _ju.extend(root.jsPlumbInstance, _ju.EventGenerator, {\n setAttribute: function (el, a, v) {\n this.setAttribute(el, a, v);\n },\n getAttribute: function (el, a) {\n return this.getAttribute(root.jsPlumb.getElement(el), a);\n },\n convertToFullOverlaySpec: function(spec) {\n if (_ju.isString(spec)) {\n spec = [ spec, { } ];\n }\n spec[1].id = spec[1].id || _ju.uuid();\n return spec;\n },\n registerConnectionType: function (id, type) {\n this._connectionTypes[id] = root.jsPlumb.extend({}, type);\n if (type.overlays) {\n var to = {};\n for (var i = 0; i < type.overlays.length; i++) {\n // if a string, convert to object representation so that we can store the typeid on it.\n // also assign an id.\n var fo = this.convertToFullOverlaySpec(type.overlays[i]);\n to[fo[1].id] = fo;\n }\n this._connectionTypes[id].overlays = to;\n }\n },\n registerConnectionTypes: function (types) {\n for (var i in types) {\n this.registerConnectionType(i, types[i]);\n }\n },\n registerEndpointType: function (id, type) {\n this._endpointTypes[id] = root.jsPlumb.extend({}, type);\n if (type.overlays) {\n var to = {};\n for (var i = 0; i < type.overlays.length; i++) {\n // if a string, convert to object representation so that we can store the typeid on it.\n // also assign an id.\n var fo = this.convertToFullOverlaySpec(type.overlays[i]);\n to[fo[1].id] = fo;\n }\n this._endpointTypes[id].overlays = to;\n }\n },\n registerEndpointTypes: function (types) {\n for (var i in types) {\n this.registerEndpointType(i, types[i]);\n }\n },\n getType: function (id, typeDescriptor) {\n return typeDescriptor === \"connection\" ? this._connectionTypes[id] : this._endpointTypes[id];\n },\n setIdChanged: function (oldId, newId) {\n this.setId(oldId, newId, true);\n },\n // set parent: change the parent for some node and update all the registrations we need to.\n setParent: function (el, newParent) {\n var _dom = this.getElement(el),\n _id = this.getId(_dom),\n _pdom = this.getElement(newParent),\n _pid = this.getId(_pdom),\n dm = this.getDragManager();\n\n _dom.parentNode.removeChild(_dom);\n _pdom.appendChild(_dom);\n if (dm) {\n dm.setParent(_dom, _id, _pdom, _pid);\n }\n },\n extend: function (o1, o2, names) {\n var i;\n if (names) {\n for (i = 0; i < names.length; i++) {\n o1[names[i]] = o2[names[i]];\n }\n }\n else {\n for (i in o2) {\n o1[i] = o2[i];\n }\n }\n\n return o1;\n },\n floatingConnections: {},\n getFloatingAnchorIndex: function (jpc) {\n return jpc.endpoints[0].isFloating() ? 0 : jpc.endpoints[1].isFloating() ? 1 : -1;\n }\n });\n\n jsPlumbInstance.prototype.Defaults = {\n Anchor: \"Bottom\",\n Anchors: [ null, null ],\n ConnectionsDetachable: true,\n ConnectionOverlays: [ ],\n Connector: \"Bezier\",\n Container: null,\n DoNotThrowErrors: false,\n DragOptions: { },\n DropOptions: { },\n Endpoint: \"Dot\",\n EndpointOverlays: [ ],\n Endpoints: [ null, null ],\n EndpointStyle: { fill: \"#456\" },\n EndpointStyles: [ null, null ],\n EndpointHoverStyle: null,\n EndpointHoverStyles: [ null, null ],\n HoverPaintStyle: null,\n LabelStyle: { color: \"black\" },\n LogEnabled: false,\n Overlays: [ ],\n MaxConnections: 1,\n PaintStyle: { \"stroke-width\": 4, stroke: \"#456\" },\n ReattachConnections: false,\n RenderMode: \"svg\",\n Scope: \"jsPlumb_DefaultScope\"\n };\n\n// --------------------- static instance + module registration -------------------------------------------\n\n// create static instance and assign to window if window exists.\t\n var jsPlumb = new jsPlumbInstance();\n // register on 'root' (lets us run on server or browser)\n root.jsPlumb = jsPlumb;\n // add 'getInstance' method to static instance\n jsPlumb.getInstance = function (_defaults, overrideFns) {\n var j = new jsPlumbInstance(_defaults);\n if (overrideFns) {\n for (var ovf in overrideFns) {\n j[ovf] = overrideFns[ovf];\n }\n }\n j.init();\n return j;\n };\n jsPlumb.each = function (spec, fn) {\n if (spec == null) {\n return;\n }\n if (typeof spec === \"string\") {\n fn(jsPlumb.getElement(spec));\n }\n else if (spec.length != null) {\n for (var i = 0; i < spec.length; i++) {\n fn(jsPlumb.getElement(spec[i]));\n }\n }\n else {\n fn(spec);\n } // assume it's an element.\n };\n\n // CommonJS\n if (typeof exports !== 'undefined') {\n exports.jsPlumb = jsPlumb;\n }\n\n// --------------------- end static instance + AMD registration -------------------------------------------\t\t\n\n}).call(typeof window !== 'undefined' ? window : this);\n\n/*\n * This file contains the base functionality for DOM type adapters.\n *\n * Copyright (c) 2010 - 2018 jsPlumb (hello@jsplumbtoolkit.com)\n *\n * https://jsplumbtoolkit.com\n * https://github.com/jsplumb/jsplumb\n *\n * Dual licensed under the MIT and GPL2 licenses.\n */\n;\n(function () {\n\n var root = this, _ju = root.jsPlumbUtil;\n\n var _genLoc = function (prefix, e) {\n if (e == null) {\n return [ 0, 0 ];\n }\n var ts = _touches(e), t = _getTouch(ts, 0);\n return [t[prefix + \"X\"], t[prefix + \"Y\"]];\n },\n _pageLocation = _genLoc.bind(this, \"page\"),\n _screenLocation = _genLoc.bind(this, \"screen\"),\n _clientLocation = _genLoc.bind(this, \"client\"),\n _getTouch = function (touches, idx) {\n return touches.item ? touches.item(idx) : touches[idx];\n },\n _touches = function (e) {\n return e.touches && e.touches.length > 0 ? e.touches :\n e.changedTouches && e.changedTouches.length > 0 ? e.changedTouches :\n e.targetTouches && e.targetTouches.length > 0 ? e.targetTouches :\n [ e ];\n };\n\n /**\n Manages dragging for some instance of jsPlumb.\n\n TODO instead of this being accessed directly, it should subscribe to events on the jsPlumb instance: every method\n in here is called directly by jsPlumb. But what should happen is that we have unpublished events that this listens\n to. The only trick is getting one of these instantiated with every jsPlumb instance: it needs to have a hook somehow.\n Basically the general idea is to pull ALL the drag code out (prototype method registrations plus this) into a\n dedicated drag script), that does not necessarily need to be included.\n\n\n */\n var DragManager = function (_currentInstance) {\n var _draggables = {}, _dlist = [], _delements = {}, _elementsWithEndpoints = {},\n // elementids mapped to the draggable to which they belong.\n _draggablesForElements = {};\n\n /**\n register some element as draggable. right now the drag init stuff is done elsewhere, and it is\n possible that will continue to be the case.\n */\n this.register = function (el) {\n var id = _currentInstance.getId(el),\n parentOffset = _currentInstance.getOffset(el);\n\n if (!_draggables[id]) {\n _draggables[id] = el;\n _dlist.push(el);\n _delements[id] = {};\n }\n\n // look for child elements that have endpoints and register them against this draggable.\n var _oneLevel = function (p) {\n if (p) {\n for (var i = 0; i < p.childNodes.length; i++) {\n if (p.childNodes[i].nodeType !== 3 && p.childNodes[i].nodeType !== 8) {\n var cEl = jsPlumb.getElement(p.childNodes[i]),\n cid = _currentInstance.getId(p.childNodes[i], null, true);\n if (cid && _elementsWithEndpoints[cid] && _elementsWithEndpoints[cid] > 0) {\n var cOff = _currentInstance.getOffset(cEl);\n _delements[id][cid] = {\n id: cid,\n offset: {\n left: cOff.left - parentOffset.left,\n top: cOff.top - parentOffset.top\n }\n };\n _draggablesForElements[cid] = id;\n }\n _oneLevel(p.childNodes[i]);\n }\n }\n }\n };\n\n _oneLevel(el);\n };\n\n // refresh the offsets for child elements of this element.\n this.updateOffsets = function (elId, childOffsetOverrides) {\n if (elId != null) {\n childOffsetOverrides = childOffsetOverrides || {};\n var domEl = jsPlumb.getElement(elId),\n id = _currentInstance.getId(domEl),\n children = _delements[id],\n parentOffset = _currentInstance.getOffset(domEl);\n\n if (children) {\n for (var i in children) {\n if (children.hasOwnProperty(i)) {\n var cel = jsPlumb.getElement(i),\n cOff = childOffsetOverrides[i] || _currentInstance.getOffset(cel);\n\n // do not update if we have a value already and we'd just be writing 0,0\n if (cel.offsetParent == null && _delements[id][i] != null) {\n continue;\n }\n\n _delements[id][i] = {\n id: i,\n offset: {\n left: cOff.left - parentOffset.left,\n top: cOff.top - parentOffset.top\n }\n };\n _draggablesForElements[i] = id;\n }\n }\n }\n }\n };\n\n /**\n notification that an endpoint was added to the given el. we go up from that el's parent\n node, looking for a parent that has been registered as a draggable. if we find one, we add this\n el to that parent's list of elements to update on drag (if it is not there already)\n */\n this.endpointAdded = function (el, id) {\n\n id = id || _currentInstance.getId(el);\n\n var b = document.body,\n p = el.parentNode;\n\n _elementsWithEndpoints[id] = _elementsWithEndpoints[id] ? _elementsWithEndpoints[id] + 1 : 1;\n\n while (p != null && p !== b) {\n var pid = _currentInstance.getId(p, null, true);\n if (pid && _draggables[pid]) {\n var pLoc = _currentInstance.getOffset(p);\n\n if (_delements[pid][id] == null) {\n var cLoc = _currentInstance.getOffset(el);\n _delements[pid][id] = {\n id: id,\n offset: {\n left: cLoc.left - pLoc.left,\n top: cLoc.top - pLoc.top\n }\n };\n _draggablesForElements[id] = pid;\n }\n break;\n }\n p = p.parentNode;\n }\n };\n\n this.endpointDeleted = function (endpoint) {\n if (_elementsWithEndpoints[endpoint.elementId]) {\n _elementsWithEndpoints[endpoint.elementId]--;\n if (_elementsWithEndpoints[endpoint.elementId] <= 0) {\n for (var i in _delements) {\n if (_delements.hasOwnProperty(i) && _delements[i]) {\n delete _delements[i][endpoint.elementId];\n delete _draggablesForElements[endpoint.elementId];\n }\n }\n }\n }\n };\n\n this.changeId = function (oldId, newId) {\n _delements[newId] = _delements[oldId];\n _delements[oldId] = {};\n _draggablesForElements[newId] = _draggablesForElements[oldId];\n _draggablesForElements[oldId] = null;\n };\n\n this.getElementsForDraggable = function (id) {\n return _delements[id];\n };\n\n this.elementRemoved = function (elementId) {\n var elId = _draggablesForElements[elementId];\n if (elId) {\n delete _delements[elId][elementId];\n delete _draggablesForElements[elementId];\n }\n };\n\n this.reset = function () {\n _draggables = {};\n _dlist = [];\n _delements = {};\n _elementsWithEndpoints = {};\n };\n\n //\n // notification drag ended. We check automatically if need to update some\n // ancestor's offsets.\n //\n this.dragEnded = function (el) {\n if (el.offsetParent != null) {\n var id = _currentInstance.getId(el),\n ancestor = _draggablesForElements[id];\n\n if (ancestor) {\n this.updateOffsets(ancestor);\n }\n }\n };\n\n this.setParent = function (el, elId, p, pId, currentChildLocation) {\n var current = _draggablesForElements[elId];\n if (!_delements[pId]) {\n _delements[pId] = {};\n }\n var pLoc = _currentInstance.getOffset(p),\n cLoc = currentChildLocation || _currentInstance.getOffset(el);\n\n if (current && _delements[current]) {\n delete _delements[current][elId];\n }\n\n _delements[pId][elId] = {\n id:elId,\n offset : {\n left: cLoc.left - pLoc.left,\n top: cLoc.top - pLoc.top\n }\n };\n _draggablesForElements[elId] = pId;\n };\n\n this.clearParent = function(el, elId) {\n var current = _draggablesForElements[elId];\n if (current) {\n delete _delements[current][elId];\n delete _draggablesForElements[elId];\n }\n };\n\n this.revalidateParent = function(el, elId, childOffset) {\n var current = _draggablesForElements[elId];\n if (current) {\n var co = {};\n co[elId] = childOffset;\n this.updateOffsets(current, co);\n _currentInstance.revalidate(current);\n }\n };\n\n this.getDragAncestor = function (el) {\n var de = jsPlumb.getElement(el),\n id = _currentInstance.getId(de),\n aid = _draggablesForElements[id];\n\n if (aid) {\n return jsPlumb.getElement(aid);\n }\n else {\n return null;\n }\n };\n\n };\n\n var trim = function (str) {\n return str == null ? null : (str.replace(/^\\s\\s*/, '').replace(/\\s\\s*$/, ''));\n },\n _setClassName = function (el, cn, classList) {\n cn = trim(cn);\n if (typeof el.className.baseVal !== \"undefined\") {\n el.className.baseVal = cn;\n }\n else {\n el.className = cn;\n }\n\n // recent (i currently have 61.0.3163.100) version of chrome do not update classList when you set the base val\n // of an svg element's className. in the long run we'd like to move to just using classList anyway\n try {\n var cl = el.classList;\n while (cl.length > 0) {\n cl.remove(cl.item(0));\n }\n for (var i = 0; i < classList.length; i++) {\n if (classList[i]) {\n cl.add(classList[i]);\n }\n }\n }\n catch(e) {\n // not fatal\n console.log(\"JSPLUMB: cannot set class list\", e);\n }\n },\n _getClassName = function (el) {\n return (typeof el.className.baseVal === \"undefined\") ? el.className : el.className.baseVal;\n },\n _classManip = function (el, classesToAdd, classesToRemove) {\n classesToAdd = classesToAdd == null ? [] : _ju.isArray(classesToAdd) ? classesToAdd : classesToAdd.split(/\\s+/);\n classesToRemove = classesToRemove == null ? [] : _ju.isArray(classesToRemove) ? classesToRemove : classesToRemove.split(/\\s+/);\n\n var className = _getClassName(el),\n curClasses = className.split(/\\s+/);\n\n var _oneSet = function (add, classes) {\n for (var i = 0; i < classes.length; i++) {\n if (add) {\n if (curClasses.indexOf(classes[i]) === -1) {\n curClasses.push(classes[i]);\n }\n }\n else {\n var idx = curClasses.indexOf(classes[i]);\n if (idx !== -1) {\n curClasses.splice(idx, 1);\n }\n }\n }\n };\n\n _oneSet(true, classesToAdd);\n _oneSet(false, classesToRemove);\n\n _setClassName(el, curClasses.join(\" \"), curClasses);\n };\n\n root.jsPlumb.extend(root.jsPlumbInstance.prototype, {\n\n headless: false,\n\n pageLocation: _pageLocation,\n screenLocation: _screenLocation,\n clientLocation: _clientLocation,\n\n getDragManager:function() {\n if (this.dragManager == null) {\n this.dragManager = new DragManager(this);\n }\n\n return this.dragManager;\n },\n\n // NEVER CALLED IN THE CURRENT JS\n recalculateOffsets:function(elId) {\n this.getDragManager().updateOffsets(elId);\n },\n\n // CONVERTED\n createElement:function(tag, style, clazz, atts) {\n return this.createElementNS(null, tag, style, clazz, atts);\n },\n\n // CONVERTED\n createElementNS:function(ns, tag, style, clazz, atts) {\n var e = ns == null ? document.createElement(tag) : document.createElementNS(ns, tag);\n var i;\n style = style || {};\n for (i in style) {\n e.style[i] = style[i];\n }\n\n if (clazz) {\n e.className = clazz;\n }\n\n atts = atts || {};\n for (i in atts) {\n e.setAttribute(i, \"\" + atts[i]);\n }\n\n return e;\n },\n\n // CONVERTED\n getAttribute: function (el, attName) {\n return el.getAttribute != null ? el.getAttribute(attName) : null;\n },\n\n // CONVERTED\n setAttribute: function (el, a, v) {\n if (el.setAttribute != null) {\n el.setAttribute(a, v);\n }\n },\n\n // CONVERTED\n setAttributes: function (el, atts) {\n for (var i in atts) {\n if (atts.hasOwnProperty(i)) {\n el.setAttribute(i, atts[i]);\n }\n }\n },\n appendToRoot: function (node) {\n document.body.appendChild(node);\n },\n // NOT CONVERTING\n getRenderModes: function () {\n return [ \"svg\" ];\n },\n // CONVERTED\n getClass:_getClassName,\n // CONVERTED\n addClass: function (el, clazz) {\n jsPlumb.each(el, function (e) {\n _classManip(e, clazz);\n });\n },\n // CONVERTED\n hasClass: function (el, clazz) {\n el = jsPlumb.getElement(el);\n if (el.classList) {\n return el.classList.contains(clazz);\n }\n else {\n return _getClassName(el).indexOf(clazz) !== -1;\n }\n },\n // CONVERTED\n removeClass: function (el, clazz) {\n jsPlumb.each(el, function (e) {\n _classManip(e, null, clazz);\n });\n },\n // CONVERTED\n updateClasses: function (el, toAdd, toRemove) {\n jsPlumb.each(el, function (e) {\n _classManip(e, toAdd, toRemove);\n });\n },\n // CONVERTED\n setClass: function (el, clazz) {\n if (clazz != null) {\n jsPlumb.each(el, function (e) {\n _setClassName(e, clazz, clazz.split(/\\s+/));\n });\n }\n },\n // CONVERTED\n setPosition: function (el, p) {\n el.style.left = p.left + \"px\";\n el.style.top = p.top + \"px\";\n },\n // CONVERTED\n getPosition: function (el) {\n var _one = function (prop) {\n var v = el.style[prop];\n return v ? v.substring(0, v.length - 2) : 0;\n };\n return {\n left: _one(\"left\"),\n top: _one(\"top\")\n };\n },\n // CONVERTED\n getStyle:function(el, prop) {\n if (typeof window.getComputedStyle !== 'undefined') {\n return getComputedStyle(el, null).getPropertyValue(prop);\n } else {\n return el.currentStyle[prop];\n }\n },\n // CONVERTED\n getSelector: function (ctx, spec) {\n var sel = null;\n if (arguments.length === 1) {\n sel = ctx.nodeType != null ? ctx : document.querySelectorAll(ctx);\n }\n else {\n sel = ctx.querySelectorAll(spec);\n }\n\n return sel;\n },\n // CONVERTED\n getOffset:function(el, relativeToRoot, container) {\n el = jsPlumb.getElement(el);\n container = container || this.getContainer();\n var out = {\n left: el.offsetLeft,\n top: el.offsetTop\n },\n op = (relativeToRoot || (container != null && (el !== container && el.offsetParent !== container))) ? el.offsetParent : null,\n _maybeAdjustScroll = function(offsetParent) {\n if (offsetParent != null && offsetParent !== document.body && (offsetParent.scrollTop > 0 || offsetParent.scrollLeft > 0)) {\n out.left -= offsetParent.scrollLeft;\n out.top -= offsetParent.scrollTop;\n }\n }.bind(this);\n\n while (op != null) {\n out.left += op.offsetLeft;\n out.top += op.offsetTop;\n _maybeAdjustScroll(op);\n op = relativeToRoot ? op.offsetParent :\n op.offsetParent === container ? null : op.offsetParent;\n }\n\n // if container is scrolled and the element (or its offset parent) is not absolute or fixed, adjust accordingly.\n if (container != null && !relativeToRoot && (container.scrollTop > 0 || container.scrollLeft > 0)) {\n var pp = el.offsetParent != null ? this.getStyle(el.offsetParent, \"position\") : \"static\",\n p = this.getStyle(el, \"position\");\n if (p !== \"absolute\" && p !== \"fixed\" && pp !== \"absolute\" && pp !== \"fixed\") {\n out.left -= container.scrollLeft;\n out.top -= container.scrollTop;\n }\n }\n return out;\n },\n //\n // return x+y proportion of the given element's size corresponding to the location of the given event.\n //\n getPositionOnElement: function (evt, el, zoom) {\n var box = typeof el.getBoundingClientRect !== \"undefined\" ? el.getBoundingClientRect() : { left: 0, top: 0, width: 0, height: 0 },\n body = document.body,\n docElem = document.documentElement,\n scrollTop = window.pageYOffset || docElem.scrollTop || body.scrollTop,\n scrollLeft = window.pageXOffset || docElem.scrollLeft || body.scrollLeft,\n clientTop = docElem.clientTop || body.clientTop || 0,\n clientLeft = docElem.clientLeft || body.clientLeft || 0,\n pst = 0,\n psl = 0,\n top = box.top + scrollTop - clientTop + (pst * zoom),\n left = box.left + scrollLeft - clientLeft + (psl * zoom),\n cl = jsPlumb.pageLocation(evt),\n w = box.width || (el.offsetWidth * zoom),\n h = box.height || (el.offsetHeight * zoom),\n x = (cl[0] - left) / w,\n y = (cl[1] - top) / h;\n\n return [ x, y ];\n },\n\n /**\n * Gets the absolute position of some element as read from the left/top properties in its style.\n * @method getAbsolutePosition\n * @param {Element} el The element to retrieve the absolute coordinates from. **Note** this is a DOM element, not a selector from the underlying library.\n * @return {Number[]} [left, top] pixel values.\n */\n getAbsolutePosition: function (el) {\n var _one = function (s) {\n var ss = el.style[s];\n if (ss) {\n return parseFloat(ss.substring(0, ss.length - 2));\n }\n };\n return [ _one(\"left\"), _one(\"top\") ];\n },\n\n /**\n * Sets the absolute position of some element by setting the left/top properties in its style.\n * @method setAbsolutePosition\n * @param {Element} el The element to set the absolute coordinates on. **Note** this is a DOM element, not a selector from the underlying library.\n * @param {Number[]} xy x and y coordinates\n * @param {Number[]} [animateFrom] Optional previous xy to animate from.\n * @param {Object} [animateOptions] Options for the animation.\n */\n setAbsolutePosition: function (el, xy, animateFrom, animateOptions) {\n if (animateFrom) {\n this.animate(el, {\n left: \"+=\" + (xy[0] - animateFrom[0]),\n top: \"+=\" + (xy[1] - animateFrom[1])\n }, animateOptions);\n }\n else {\n el.style.left = xy[0] + \"px\";\n el.style.top = xy[1] + \"px\";\n }\n },\n /**\n * gets the size for the element, in an array : [ width, height ].\n */\n // CONVERTED\n getSize: function (el) {\n return [ el.offsetWidth, el.offsetHeight ];\n },\n // CONVERTED\n getWidth: function (el) {\n return el.offsetWidth;\n },\n // CONVERTED\n getHeight: function (el) {\n return el.offsetHeight;\n },\n getRenderMode : function() { return \"svg\"; }\n\n });\n}).call(typeof window !== 'undefined' ? window : this);\n\n/*\n * 2010 - 2018 jsPlumb (hello@jsplumbtoolkit.com)\n *\n * https://jsplumbtoolkit.com\n * https://github.com/jsplumb/jsplumb\n *\n * Dual licensed under the MIT and GPL2 licenses.\n */\n;(function() {\n\n \"use strict\";\n var root = this, _jp = root.jsPlumb, _ju = root.jsPlumbUtil;\n\n // ------------------------------ BEGIN OverlayCapablejsPlumbUIComponent --------------------------------------------\n\n var _internalLabelOverlayId = \"__label\",\n // this is a shortcut helper method to let people add a label as\n // overlay.\n _makeLabelOverlay = function (component, params) {\n\n var _params = {\n cssClass: params.cssClass,\n labelStyle: component.labelStyle,\n id: _internalLabelOverlayId,\n component: component,\n _jsPlumb: component._jsPlumb.instance // TODO not necessary, since the instance can be accessed through the component.\n },\n mergedParams = _jp.extend(_params, params);\n\n return new _jp.Overlays[component._jsPlumb.instance.getRenderMode()].Label(mergedParams);\n },\n _processOverlay = function (component, o) {\n var _newOverlay = null;\n if (_ju.isArray(o)) {\t// this is for the shorthand [\"Arrow\", { width:50 }] syntax\n // there's also a three arg version:\n // [\"Arrow\", { width:50 }, {location:0.7}]\n // which merges the 3rd arg into the 2nd.\n var type = o[0],\n // make a copy of the object so as not to mess up anyone else's reference...\n p = _jp.extend({component: component, _jsPlumb: component._jsPlumb.instance}, o[1]);\n if (o.length === 3) {\n _jp.extend(p, o[2]);\n }\n _newOverlay = new _jp.Overlays[component._jsPlumb.instance.getRenderMode()][type](p);\n } else if (o.constructor === String) {\n _newOverlay = new _jp.Overlays[component._jsPlumb.instance.getRenderMode()][o]({component: component, _jsPlumb: component._jsPlumb.instance});\n } else {\n _newOverlay = o;\n }\n\n _newOverlay.id = _newOverlay.id || _ju.uuid();\n component.cacheTypeItem(\"overlay\", _newOverlay, _newOverlay.id);\n component._jsPlumb.overlays[_newOverlay.id] = _newOverlay;\n\n return _newOverlay;\n };\n\n _jp.OverlayCapableJsPlumbUIComponent = function (params) {\n\n root.jsPlumbUIComponent.apply(this, arguments);\n this._jsPlumb.overlays = {};\n this._jsPlumb.overlayPositions = {};\n\n if (params.label) {\n this.getDefaultType().overlays[_internalLabelOverlayId] = [\"Label\", {\n label: params.label,\n location: params.labelLocation || this.defaultLabelLocation || 0.5,\n labelStyle: params.labelStyle || this._jsPlumb.instance.Defaults.LabelStyle,\n id:_internalLabelOverlayId\n }];\n }\n\n this.setListenerComponent = function (c) {\n if (this._jsPlumb) {\n for (var i in this._jsPlumb.overlays) {\n this._jsPlumb.overlays[i].setListenerComponent(c);\n }\n }\n };\n };\n\n _jp.OverlayCapableJsPlumbUIComponent.applyType = function (component, t) {\n if (t.overlays) {\n // loop through the ones in the type. if already present on the component,\n // dont remove or re-add.\n var keep = {}, i;\n\n for (i in t.overlays) {\n\n var existing = component._jsPlumb.overlays[t.overlays[i][1].id];\n if (existing) {\n // maybe update from data, if there were parameterised values for instance.\n existing.updateFrom(t.overlays[i][1]);\n keep[t.overlays[i][1].id] = true;\n }\n else {\n var c = component.getCachedTypeItem(\"overlay\", t.overlays[i][1].id);\n if (c != null) {\n c.reattach(component._jsPlumb.instance, component);\n c.setVisible(true);\n // maybe update from data, if there were parameterised values for instance.\n c.updateFrom(t.overlays[i][1]);\n component._jsPlumb.overlays[c.id] = c;\n }\n else {\n c = component.addOverlay(t.overlays[i], true);\n }\n keep[c.id] = true;\n }\n }\n\n // now loop through the full overlays and remove those that we dont want to keep\n for (i in component._jsPlumb.overlays) {\n if (keep[component._jsPlumb.overlays[i].id] == null) {\n component.removeOverlay(component._jsPlumb.overlays[i].id, true); // remove overlay but dont clean it up.\n // that would remove event listeners etc; overlays are never discarded by the types stuff, they are\n // just detached/reattached.\n }\n }\n }\n };\n\n _ju.extend(_jp.OverlayCapableJsPlumbUIComponent, root.jsPlumbUIComponent, {\n\n setHover: function (hover, ignoreAttachedElements) {\n if (this._jsPlumb && !this._jsPlumb.instance.isConnectionBeingDragged()) {\n for (var i in this._jsPlumb.overlays) {\n this._jsPlumb.overlays[i][hover ? \"addClass\" : \"removeClass\"](this._jsPlumb.instance.hoverClass);\n }\n }\n },\n addOverlay: function (overlay, doNotRepaint) {\n var o = _processOverlay(this, overlay);\n if (!doNotRepaint) {\n this.repaint();\n }\n return o;\n },\n getOverlay: function (id) {\n return this._jsPlumb.overlays[id];\n },\n getOverlays: function () {\n return this._jsPlumb.overlays;\n },\n hideOverlay: function (id) {\n var o = this.getOverlay(id);\n if (o) {\n o.hide();\n }\n },\n hideOverlays: function () {\n for (var i in this._jsPlumb.overlays) {\n this._jsPlumb.overlays[i].hide();\n }\n },\n showOverlay: function (id) {\n var o = this.getOverlay(id);\n if (o) {\n o.show();\n }\n },\n showOverlays: function () {\n for (var i in this._jsPlumb.overlays) {\n this._jsPlumb.overlays[i].show();\n }\n },\n removeAllOverlays: function (doNotRepaint) {\n for (var i in this._jsPlumb.overlays) {\n if (this._jsPlumb.overlays[i].cleanup) {\n this._jsPlumb.overlays[i].cleanup();\n }\n }\n\n this._jsPlumb.overlays = {};\n this._jsPlumb.overlayPositions = null;\n if (!doNotRepaint) {\n this.repaint();\n }\n },\n removeOverlay: function (overlayId, dontCleanup) {\n var o = this._jsPlumb.overlays[overlayId];\n if (o) {\n o.setVisible(false);\n if (!dontCleanup && o.cleanup) {\n o.cleanup();\n }\n delete this._jsPlumb.overlays[overlayId];\n if (this._jsPlumb.overlayPositions) {\n delete this._jsPlumb.overlayPositions[overlayId];\n }\n }\n },\n removeOverlays: function () {\n for (var i = 0, j = arguments.length; i < j; i++) {\n this.removeOverlay(arguments[i]);\n }\n },\n moveParent: function (newParent) {\n if (this.bgCanvas) {\n this.bgCanvas.parentNode.removeChild(this.bgCanvas);\n newParent.appendChild(this.bgCanvas);\n }\n\n if (this.canvas && this.canvas.parentNode) {\n this.canvas.parentNode.removeChild(this.canvas);\n newParent.appendChild(this.canvas);\n\n for (var i in this._jsPlumb.overlays) {\n if (this._jsPlumb.overlays[i].isAppendedAtTopLevel) {\n var el = this._jsPlumb.overlays[i].getElement();\n el.parentNode.removeChild(el);\n newParent.appendChild(el);\n }\n }\n }\n },\n getLabel: function () {\n var lo = this.getOverlay(_internalLabelOverlayId);\n return lo != null ? lo.getLabel() : null;\n },\n getLabelOverlay: function () {\n return this.getOverlay(_internalLabelOverlayId);\n },\n setLabel: function (l) {\n var lo = this.getOverlay(_internalLabelOverlayId);\n if (!lo) {\n var params = l.constructor === String || l.constructor === Function ? { label: l } : l;\n lo = _makeLabelOverlay(this, params);\n this._jsPlumb.overlays[_internalLabelOverlayId] = lo;\n }\n else {\n if (l.constructor === String || l.constructor === Function) {\n lo.setLabel(l);\n }\n else {\n if (l.label) {\n lo.setLabel(l.label);\n }\n if (l.location) {\n lo.setLocation(l.location);\n }\n }\n }\n\n if (!this._jsPlumb.instance.isSuspendDrawing()) {\n this.repaint();\n }\n },\n cleanup: function (force) {\n for (var i in this._jsPlumb.overlays) {\n this._jsPlumb.overlays[i].cleanup(force);\n this._jsPlumb.overlays[i].destroy(force);\n }\n if (force) {\n this._jsPlumb.overlays = {};\n this._jsPlumb.overlayPositions = null;\n }\n },\n setVisible: function (v) {\n this[v ? \"showOverlays\" : \"hideOverlays\"]();\n },\n setAbsoluteOverlayPosition: function (overlay, xy) {\n this._jsPlumb.overlayPositions[overlay.id] = xy;\n },\n getAbsoluteOverlayPosition: function (overlay) {\n return this._jsPlumb.overlayPositions ? this._jsPlumb.overlayPositions[overlay.id] : null;\n },\n _clazzManip:function(action, clazz, dontUpdateOverlays) {\n if (!dontUpdateOverlays) {\n for (var i in this._jsPlumb.overlays) {\n this._jsPlumb.overlays[i][action + \"Class\"](clazz);\n }\n }\n },\n addClass:function(clazz, dontUpdateOverlays) {\n this._clazzManip(\"add\", clazz, dontUpdateOverlays);\n },\n removeClass:function(clazz, dontUpdateOverlays) {\n this._clazzManip(\"remove\", clazz, dontUpdateOverlays);\n }\n });\n\n// ------------------------------ END OverlayCapablejsPlumbUIComponent --------------------------------------------\n\n}).call(typeof window !== 'undefined' ? window : this);\n\n/*\n * This file contains the code for Endpoints.\n *\n * Copyright (c) 2010 - 2018 jsPlumb (hello@jsplumbtoolkit.com)\n * \n * https://jsplumbtoolkit.com\n * https://github.com/jsplumb/jsplumb\n * \n * Dual licensed under the MIT and GPL2 licenses.\n */\n;(function () {\n\n \"use strict\";\n var root = this, _jp = root.jsPlumb, _ju = root.jsPlumbUtil;\n\n // create the drag handler for a connection\n var _makeConnectionDragHandler = function (endpoint, placeholder, _jsPlumb) {\n var stopped = false;\n return {\n drag: function () {\n if (stopped) {\n stopped = false;\n return true;\n }\n\n if (placeholder.element) {\n var _ui = _jsPlumb.getUIPosition(arguments, _jsPlumb.getZoom());\n if (_ui != null) {\n _jsPlumb.setPosition(placeholder.element, _ui);\n }\n _jsPlumb.repaint(placeholder.element, _ui);\n // always repaint the source endpoint, because only continuous/dynamic anchors cause the endpoint\n // to be repainted, so static anchors need to be told (or the endpoint gets dragged around)\n endpoint.paint({anchorPoint:endpoint.anchor.getCurrentLocation({element:endpoint})});\n }\n },\n stopDrag: function () {\n stopped = true;\n }\n };\n };\n\n // creates a placeholder div for dragging purposes, adds it, and pre-computes its offset.\n var _makeDraggablePlaceholder = function (placeholder, _jsPlumb, ipco, ips) {\n var n = _jsPlumb.createElement(\"div\", { position : \"absolute\" });\n _jsPlumb.appendElement(n);\n var id = _jsPlumb.getId(n);\n _jsPlumb.setPosition(n, ipco);\n n.style.width = ips[0] + \"px\";\n n.style.height = ips[1] + \"px\";\n _jsPlumb.manage(id, n, true); // TRANSIENT MANAGE\n // create and assign an id, and initialize the offset.\n placeholder.id = id;\n placeholder.element = n;\n };\n\n // create a floating endpoint (for drag connections)\n var _makeFloatingEndpoint = function (paintStyle, referenceAnchor, endpoint, referenceCanvas, sourceElement, _jsPlumb, _newEndpoint, scope) {\n var floatingAnchor = new _jp.FloatingAnchor({ reference: referenceAnchor, referenceCanvas: referenceCanvas, jsPlumbInstance: _jsPlumb });\n //setting the scope here should not be the way to fix that mootools issue. it should be fixed by not\n // adding the floating endpoint as a droppable. that makes more sense anyway!\n // TRANSIENT MANAGE\n return _newEndpoint({\n paintStyle: paintStyle,\n endpoint: endpoint,\n anchor: floatingAnchor,\n source: sourceElement,\n scope: scope\n });\n };\n\n var typeParameters = [ \"connectorStyle\", \"connectorHoverStyle\", \"connectorOverlays\",\n \"connector\", \"connectionType\", \"connectorClass\", \"connectorHoverClass\" ];\n\n // a helper function that tries to find a connection to the given element, and returns it if so. if elementWithPrecedence is null,\n // or no connection to it is found, we return the first connection in our list.\n var findConnectionToUseForDynamicAnchor = function (ep, elementWithPrecedence) {\n var idx = 0;\n if (elementWithPrecedence != null) {\n for (var i = 0; i < ep.connections.length; i++) {\n if (ep.connections[i].sourceId === elementWithPrecedence || ep.connections[i].targetId === elementWithPrecedence) {\n idx = i;\n break;\n }\n }\n }\n\n return ep.connections[idx];\n };\n\n _jp.Endpoint = function (params) {\n var _jsPlumb = params._jsPlumb,\n _newConnection = params.newConnection,\n _newEndpoint = params.newEndpoint;\n\n this.idPrefix = \"_jsplumb_e_\";\n this.defaultLabelLocation = [ 0.5, 0.5 ];\n this.defaultOverlayKeys = [\"Overlays\", \"EndpointOverlays\"];\n _jp.OverlayCapableJsPlumbUIComponent.apply(this, arguments);\n\n// TYPE\n\n this.appendToDefaultType({\n connectionType:params.connectionType,\n maxConnections: params.maxConnections == null ? this._jsPlumb.instance.Defaults.MaxConnections : params.maxConnections, // maximum number of connections this endpoint can be the source of.,\n paintStyle: params.endpointStyle || params.paintStyle || params.style || this._jsPlumb.instance.Defaults.EndpointStyle || _jp.Defaults.EndpointStyle,\n hoverPaintStyle: params.endpointHoverStyle || params.hoverPaintStyle || this._jsPlumb.instance.Defaults.EndpointHoverStyle || _jp.Defaults.EndpointHoverStyle,\n connectorStyle: params.connectorStyle,\n connectorHoverStyle: params.connectorHoverStyle,\n connectorClass: params.connectorClass,\n connectorHoverClass: params.connectorHoverClass,\n connectorOverlays: params.connectorOverlays,\n connector: params.connector,\n connectorTooltip: params.connectorTooltip\n });\n\n// END TYPE\n\n this._jsPlumb.enabled = !(params.enabled === false);\n this._jsPlumb.visible = true;\n this.element = _jp.getElement(params.source);\n this._jsPlumb.uuid = params.uuid;\n this._jsPlumb.floatingEndpoint = null;\n var inPlaceCopy = null;\n if (this._jsPlumb.uuid) {\n params.endpointsByUUID[this._jsPlumb.uuid] = this;\n }\n this.elementId = params.elementId;\n this.dragProxy = params.dragProxy;\n\n this._jsPlumb.connectionCost = params.connectionCost;\n this._jsPlumb.connectionsDirected = params.connectionsDirected;\n this._jsPlumb.currentAnchorClass = \"\";\n this._jsPlumb.events = {};\n\n var deleteOnEmpty = params.deleteOnEmpty === true;\n this.setDeleteOnEmpty = function(d) {\n deleteOnEmpty = d;\n };\n\n var _updateAnchorClass = function () {\n // stash old, get new\n var oldAnchorClass = _jsPlumb.endpointAnchorClassPrefix + \"-\" + this._jsPlumb.currentAnchorClass;\n this._jsPlumb.currentAnchorClass = this.anchor.getCssClass();\n var anchorClass = _jsPlumb.endpointAnchorClassPrefix + (this._jsPlumb.currentAnchorClass ? \"-\" + this._jsPlumb.currentAnchorClass : \"\");\n\n this.removeClass(oldAnchorClass);\n this.addClass(anchorClass);\n // add and remove at the same time to reduce the number of reflows.\n _jp.updateClasses(this.element, anchorClass, oldAnchorClass);\n }.bind(this);\n\n this.prepareAnchor = function(anchorParams) {\n var a = this._jsPlumb.instance.makeAnchor(anchorParams, this.elementId, _jsPlumb);\n a.bind(\"anchorChanged\", function (currentAnchor) {\n this.fire(\"anchorChanged\", {endpoint: this, anchor: currentAnchor});\n _updateAnchorClass();\n }.bind(this));\n return a;\n };\n\n this.setPreparedAnchor = function(anchor, doNotRepaint) {\n this._jsPlumb.instance.continuousAnchorFactory.clear(this.elementId);\n this.anchor = anchor;\n _updateAnchorClass();\n\n if (!doNotRepaint) {\n this._jsPlumb.instance.repaint(this.elementId);\n }\n\n return this;\n };\n\n this.setAnchor = function (anchorParams, doNotRepaint) {\n var a = this.prepareAnchor(anchorParams);\n this.setPreparedAnchor(a, doNotRepaint);\n return this;\n };\n\n var internalHover = function (state) {\n if (this.connections.length > 0) {\n for (var i = 0; i < this.connections.length; i++) {\n this.connections[i].setHover(state, false);\n }\n }\n else {\n this.setHover(state);\n }\n }.bind(this);\n\n this.bind(\"mouseover\", function () {\n internalHover(true);\n });\n this.bind(\"mouseout\", function () {\n internalHover(false);\n });\n\n // ANCHOR MANAGER\n if (!params._transient) { // in place copies, for example, are transient. they will never need to be retrieved during a paint cycle, because they dont move, and then they are deleted.\n this._jsPlumb.instance.anchorManager.add(this, this.elementId);\n }\n\n this.prepareEndpoint = function(ep, typeId) {\n var _e = function (t, p) {\n var rm = _jsPlumb.getRenderMode();\n if (_jp.Endpoints[rm][t]) {\n return new _jp.Endpoints[rm][t](p);\n }\n if (!_jsPlumb.Defaults.DoNotThrowErrors) {\n throw { msg: \"jsPlumb: unknown endpoint type '\" + t + \"'\" };\n }\n };\n\n var endpointArgs = {\n _jsPlumb: this._jsPlumb.instance,\n cssClass: params.cssClass,\n container: params.container,\n tooltip: params.tooltip,\n connectorTooltip: params.connectorTooltip,\n endpoint: this\n };\n\n var endpoint;\n\n if (_ju.isString(ep)) {\n endpoint = _e(ep, endpointArgs);\n }\n else if (_ju.isArray(ep)) {\n endpointArgs = _ju.merge(ep[1], endpointArgs);\n endpoint = _e(ep[0], endpointArgs);\n }\n else {\n endpoint = ep.clone();\n }\n\n // assign a clone function using a copy of endpointArgs. this is used when a drag starts: the endpoint that was dragged is cloned,\n // and the clone is left in its place while the original one goes off on a magical journey.\n // the copy is to get around a closure problem, in which endpointArgs ends up getting shared by\n // the whole world.\n //var argsForClone = jsPlumb.extend({}, endpointArgs);\n endpoint.clone = function () {\n // TODO this, and the code above, can be refactored to be more dry.\n if (_ju.isString(ep)) {\n return _e(ep, endpointArgs);\n }\n else if (_ju.isArray(ep)) {\n endpointArgs = _ju.merge(ep[1], endpointArgs);\n return _e(ep[0], endpointArgs);\n }\n }.bind(this);\n\n endpoint.typeId = typeId;\n return endpoint;\n };\n\n this.setEndpoint = function(ep, doNotRepaint) {\n var _ep = this.prepareEndpoint(ep);\n this.setPreparedEndpoint(_ep, true);\n };\n\n this.setPreparedEndpoint = function (ep, doNotRepaint) {\n if (this.endpoint != null) {\n this.endpoint.cleanup();\n this.endpoint.destroy();\n }\n this.endpoint = ep;\n this.type = this.endpoint.type;\n this.canvas = this.endpoint.canvas;\n };\n\n _jp.extend(this, params, typeParameters);\n\n this.isSource = params.isSource || false;\n this.isTemporarySource = params.isTemporarySource || false;\n this.isTarget = params.isTarget || false;\n\n this.connections = params.connections || [];\n this.connectorPointerEvents = params[\"connector-pointer-events\"];\n\n this.scope = params.scope || _jsPlumb.getDefaultScope();\n this.timestamp = null;\n this.reattachConnections = params.reattach || _jsPlumb.Defaults.ReattachConnections;\n this.connectionsDetachable = _jsPlumb.Defaults.ConnectionsDetachable;\n if (params.connectionsDetachable === false || params.detachable === false) {\n this.connectionsDetachable = false;\n }\n this.dragAllowedWhenFull = params.dragAllowedWhenFull !== false;\n\n if (params.onMaxConnections) {\n this.bind(\"maxConnections\", params.onMaxConnections);\n }\n\n //\n // add a connection. not part of public API.\n //\n this.addConnection = function (connection) {\n this.connections.push(connection);\n this[(this.connections.length > 0 ? \"add\" : \"remove\") + \"Class\"](_jsPlumb.endpointConnectedClass);\n this[(this.isFull() ? \"add\" : \"remove\") + \"Class\"](_jsPlumb.endpointFullClass);\n };\n\n this.detachFromConnection = function (connection, idx, doNotCleanup) {\n idx = idx == null ? this.connections.indexOf(connection) : idx;\n if (idx >= 0) {\n this.connections.splice(idx, 1);\n this[(this.connections.length > 0 ? \"add\" : \"remove\") + \"Class\"](_jsPlumb.endpointConnectedClass);\n this[(this.isFull() ? \"add\" : \"remove\") + \"Class\"](_jsPlumb.endpointFullClass);\n }\n\n if (!doNotCleanup && deleteOnEmpty && this.connections.length === 0) {\n _jsPlumb.deleteObject({\n endpoint: this,\n fireEvent: false,\n deleteAttachedObjects: doNotCleanup !== true\n });\n }\n };\n\n this.deleteEveryConnection = function(params) {\n var c = this.connections.length;\n for (var i = 0; i < c; i++) {\n _jsPlumb.deleteConnection(this.connections[0], params);\n }\n };\n\n this.detachFrom = function (targetEndpoint, fireEvent, originalEvent) {\n var c = [];\n for (var i = 0; i < this.connections.length; i++) {\n if (this.connections[i].endpoints[1] === targetEndpoint || this.connections[i].endpoints[0] === targetEndpoint) {\n c.push(this.connections[i]);\n }\n }\n for (var j = 0, count = c.length; j < count; j++) {\n _jsPlumb.deleteConnection(c[0]);\n }\n return this;\n };\n\n this.getElement = function () {\n return this.element;\n };\n\n this.setElement = function (el) {\n var parentId = this._jsPlumb.instance.getId(el),\n curId = this.elementId;\n // remove the endpoint from the list for the current endpoint's element\n _ju.removeWithFunction(params.endpointsByElement[this.elementId], function (e) {\n return e.id === this.id;\n }.bind(this));\n this.element = _jp.getElement(el);\n this.elementId = _jsPlumb.getId(this.element);\n _jsPlumb.anchorManager.rehomeEndpoint(this, curId, this.element);\n _jsPlumb.dragManager.endpointAdded(this.element);\n _ju.addToList(params.endpointsByElement, parentId, this);\n return this;\n };\n\n /**\n * private but must be exposed.\n */\n this.makeInPlaceCopy = function () {\n var loc = this.anchor.getCurrentLocation({element: this}),\n o = this.anchor.getOrientation(this),\n acc = this.anchor.getCssClass(),\n inPlaceAnchor = {\n bind: function () {\n },\n compute: function () {\n return [ loc[0], loc[1] ];\n },\n getCurrentLocation: function () {\n return [ loc[0], loc[1] ];\n },\n getOrientation: function () {\n return o;\n },\n getCssClass: function () {\n return acc;\n }\n };\n\n return _newEndpoint({\n dropOptions: params.dropOptions,\n anchor: inPlaceAnchor,\n source: this.element,\n paintStyle: this.getPaintStyle(),\n endpoint: params.hideOnDrag ? \"Blank\" : this.endpoint,\n _transient: true,\n scope: this.scope,\n reference:this\n });\n };\n\n /**\n * returns a connection from the pool; used when dragging starts. just gets the head of the array if it can.\n */\n this.connectorSelector = function () {\n return this.connections[0];\n };\n\n this.setStyle = this.setPaintStyle;\n\n this.paint = function (params) {\n params = params || {};\n var timestamp = params.timestamp, recalc = !(params.recalc === false);\n if (!timestamp || this.timestamp !== timestamp) {\n\n var info = _jsPlumb.updateOffset({ elId: this.elementId, timestamp: timestamp });\n\n var xy = params.offset ? params.offset.o : info.o;\n if (xy != null) {\n var ap = params.anchorPoint, connectorPaintStyle = params.connectorPaintStyle;\n if (ap == null) {\n var wh = params.dimensions || info.s,\n anchorParams = { xy: [ xy.left, xy.top ], wh: wh, element: this, timestamp: timestamp };\n if (recalc && this.anchor.isDynamic && this.connections.length > 0) {\n var c = findConnectionToUseForDynamicAnchor(this, params.elementWithPrecedence),\n oIdx = c.endpoints[0] === this ? 1 : 0,\n oId = oIdx === 0 ? c.sourceId : c.targetId,\n oInfo = _jsPlumb.getCachedData(oId),\n oOffset = oInfo.o, oWH = oInfo.s;\n\n anchorParams.index = oIdx === 0 ? 1 : 0;\n anchorParams.connection = c;\n anchorParams.txy = [ oOffset.left, oOffset.top ];\n anchorParams.twh = oWH;\n anchorParams.tElement = c.endpoints[oIdx];\n } else if (this.connections.length > 0) {\n anchorParams.connection = this.connections[0];\n }\n ap = this.anchor.compute(anchorParams);\n }\n\n this.endpoint.compute(ap, this.anchor.getOrientation(this), this._jsPlumb.paintStyleInUse, connectorPaintStyle || this.paintStyleInUse);\n this.endpoint.paint(this._jsPlumb.paintStyleInUse, this.anchor);\n this.timestamp = timestamp;\n\n // paint overlays\n for (var i in this._jsPlumb.overlays) {\n if (this._jsPlumb.overlays.hasOwnProperty(i)) {\n var o = this._jsPlumb.overlays[i];\n if (o.isVisible()) {\n this._jsPlumb.overlayPlacements[i] = o.draw(this.endpoint, this._jsPlumb.paintStyleInUse);\n o.paint(this._jsPlumb.overlayPlacements[i]);\n }\n }\n }\n }\n }\n };\n\n this.getTypeDescriptor = function () {\n return \"endpoint\";\n };\n this.isVisible = function () {\n return this._jsPlumb.visible;\n };\n\n this.repaint = this.paint;\n\n var draggingInitialised = false;\n this.initDraggable = function () {\n\n // is this a connection source? we make it draggable and have the\n // drag listener maintain a connection with a floating endpoint.\n if (!draggingInitialised && _jp.isDragSupported(this.element)) {\n var placeholderInfo = { id: null, element: null },\n jpc = null,\n existingJpc = false,\n existingJpcParams = null,\n _dragHandler = _makeConnectionDragHandler(this, placeholderInfo, _jsPlumb),\n dragOptions = params.dragOptions || {},\n defaultOpts = {},\n startEvent = _jp.dragEvents.start,\n stopEvent = _jp.dragEvents.stop,\n dragEvent = _jp.dragEvents.drag,\n beforeStartEvent = _jp.dragEvents.beforeStart,\n payload;\n\n // respond to beforeStart from katavorio; this will have, optionally, a payload of attribute values\n // that were placed there by the makeSource mousedown listener.\n var beforeStart = function(beforeStartParams) {\n payload = beforeStartParams.e.payload || {};\n };\n\n var start = function (startParams) {\n\n// ------------- first, get a connection to drag. this may be null, in which case we are dragging a new one.\n\n jpc = this.connectorSelector();\n\n// -------------------------------- now a bunch of tests about whether or not to proceed -------------------------\n\n var _continue = true;\n // if not enabled, return\n if (!this.isEnabled()) {\n _continue = false;\n }\n // if no connection and we're not a source - or temporarily a source, as is the case with makeSource - return.\n if (jpc == null && !this.isSource && !this.isTemporarySource) {\n _continue = false;\n }\n // otherwise if we're full and not allowed to drag, also return false.\n if (this.isSource && this.isFull() && !(jpc != null && this.dragAllowedWhenFull)) {\n _continue = false;\n }\n // if the connection was setup as not detachable or one of its endpoints\n // was setup as connectionsDetachable = false, or Defaults.ConnectionsDetachable\n // is set to false...\n if (jpc != null && !jpc.isDetachable(this)) {\n _continue = false;\n }\n\n var beforeDrag = _jsPlumb.checkCondition(jpc == null ? \"beforeDrag\" : \"beforeStartDetach\", {\n endpoint:this,\n source:this.element,\n sourceId:this.elementId,\n connection:jpc\n });\n if (beforeDrag === false) {\n _continue = false;\n }\n // else we might have been given some data. we'll pass it in to a new connection as 'data'.\n // here we also merge in the optional payload we were given on mousedown.\n else if (typeof beforeDrag === \"object\") {\n _jp.extend(beforeDrag, payload || {});\n }\n else {\n // or if no beforeDrag data, maybe use the payload on its own.\n beforeDrag = payload || {};\n }\n\n if (_continue === false) {\n // this is for mootools and yui. returning false from this causes jquery to stop drag.\n // the events are wrapped in both mootools and yui anyway, but i don't think returning\n // false from the start callback would stop a drag.\n if (_jsPlumb.stopDrag) {\n _jsPlumb.stopDrag(this.canvas);\n }\n _dragHandler.stopDrag();\n return false;\n }\n\n// ---------------------------------------------------------------------------------------------------------------------\n\n // ok to proceed.\n\n // clear hover for all connections for this endpoint before continuing.\n for (var i = 0; i < this.connections.length; i++) {\n this.connections[i].setHover(false);\n }\n\n this.addClass(\"endpointDrag\");\n _jsPlumb.setConnectionBeingDragged(true);\n\n // if we're not full but there was a connection, make it null. we'll create a new one.\n if (jpc && !this.isFull() && this.isSource) {\n jpc = null;\n }\n\n _jsPlumb.updateOffset({ elId: this.elementId });\n\n// ---------------- make the element we will drag around, and position it -----------------------------\n\n var ipco = this._jsPlumb.instance.getOffset(this.canvas),\n canvasElement = this.canvas,\n ips = this._jsPlumb.instance.getSize(this.canvas);\n\n _makeDraggablePlaceholder(placeholderInfo, _jsPlumb, ipco, ips);\n\n // store the id of the dragging div and the source element. the drop function will pick these up. \n _jsPlumb.setAttributes(this.canvas, {\n \"dragId\": placeholderInfo.id,\n \"elId\": this.elementId\n });\n\n// ------------------- create an endpoint that will be our floating endpoint ------------------------------------\n\n var endpointToFloat = this.dragProxy || this.endpoint;\n if (this.dragProxy == null && this.connectionType != null) {\n var aae = this._jsPlumb.instance.deriveEndpointAndAnchorSpec(this.connectionType);\n if (aae.endpoints[1]) {\n endpointToFloat = aae.endpoints[1];\n }\n }\n var centerAnchor = this._jsPlumb.instance.makeAnchor(\"Center\");\n centerAnchor.isFloating = true;\n this._jsPlumb.floatingEndpoint = _makeFloatingEndpoint(this.getPaintStyle(), centerAnchor, endpointToFloat, this.canvas, placeholderInfo.element, _jsPlumb, _newEndpoint, this.scope);\n var _savedAnchor = this._jsPlumb.floatingEndpoint.anchor;\n\n\n if (jpc == null) {\n\n this.setHover(false, false);\n // create a connection. one end is this endpoint, the other is a floating endpoint. \n jpc = _newConnection({\n sourceEndpoint: this,\n targetEndpoint: this._jsPlumb.floatingEndpoint,\n source: this.element, // for makeSource with parent option. ensure source element is represented correctly.\n target: placeholderInfo.element,\n anchors: [ this.anchor, this._jsPlumb.floatingEndpoint.anchor ],\n paintStyle: params.connectorStyle, // this can be null. Connection will use the default.\n hoverPaintStyle: params.connectorHoverStyle,\n connector: params.connector, // this can also be null. Connection will use the default.\n overlays: params.connectorOverlays,\n type: this.connectionType,\n cssClass: this.connectorClass,\n hoverClass: this.connectorHoverClass,\n scope:params.scope,\n data:beforeDrag\n });\n jpc.pending = true;\n jpc.addClass(_jsPlumb.draggingClass);\n this._jsPlumb.floatingEndpoint.addClass(_jsPlumb.draggingClass);\n this._jsPlumb.floatingEndpoint.anchor = _savedAnchor;\n // fire an event that informs that a connection is being dragged\n _jsPlumb.fire(\"connectionDrag\", jpc);\n\n // register the new connection on the drag manager. This connection, at this point, is 'pending',\n // and has as its target a temporary element (the 'placeholder'). If the connection subsequently\n // becomes established, the anchor manager is informed that the target of the connection has\n // changed.\n\n _jsPlumb.anchorManager.newConnection(jpc);\n\n } else {\n existingJpc = true;\n jpc.setHover(false);\n // new anchor idx\n var anchorIdx = jpc.endpoints[0].id === this.id ? 0 : 1;\n this.detachFromConnection(jpc, null, true); // detach from the connection while dragging is occurring. but dont cleanup automatically.\n\n // store the original scope (issue 57)\n var dragScope = _jsPlumb.getDragScope(canvasElement);\n _jsPlumb.setAttribute(this.canvas, \"originalScope\", dragScope);\n\n // fire an event that informs that a connection is being dragged. we do this before\n // replacing the original target with the floating element info.\n _jsPlumb.fire(\"connectionDrag\", jpc);\n\n // now we replace ourselves with the temporary div we created above:\n if (anchorIdx === 0) {\n existingJpcParams = [ jpc.source, jpc.sourceId, canvasElement, dragScope ];\n _jsPlumb.anchorManager.sourceChanged(jpc.endpoints[anchorIdx].elementId, placeholderInfo.id, jpc, placeholderInfo.element);\n\n } else {\n existingJpcParams = [ jpc.target, jpc.targetId, canvasElement, dragScope ];\n jpc.target = placeholderInfo.element;\n jpc.targetId = placeholderInfo.id;\n\n _jsPlumb.anchorManager.updateOtherEndpoint(jpc.sourceId, jpc.endpoints[anchorIdx].elementId, jpc.targetId, jpc);\n }\n\n // store the original endpoint and assign the new floating endpoint for the drag.\n jpc.suspendedEndpoint = jpc.endpoints[anchorIdx];\n\n // PROVIDE THE SUSPENDED ELEMENT, BE IT A SOURCE OR TARGET (ISSUE 39)\n jpc.suspendedElement = jpc.endpoints[anchorIdx].getElement();\n jpc.suspendedElementId = jpc.endpoints[anchorIdx].elementId;\n jpc.suspendedElementType = anchorIdx === 0 ? \"source\" : \"target\";\n\n jpc.suspendedEndpoint.setHover(false);\n this._jsPlumb.floatingEndpoint.referenceEndpoint = jpc.suspendedEndpoint;\n jpc.endpoints[anchorIdx] = this._jsPlumb.floatingEndpoint;\n\n jpc.addClass(_jsPlumb.draggingClass);\n this._jsPlumb.floatingEndpoint.addClass(_jsPlumb.draggingClass);\n }\n\n _jsPlumb.registerFloatingConnection(placeholderInfo, jpc, this._jsPlumb.floatingEndpoint);\n\n // // register it and register connection on it.\n // _jsPlumb.floatingConnections[placeholderInfo.id] = jpc;\n //\n // // only register for the target endpoint; we will not be dragging the source at any time\n // // before this connection is either discarded or made into a permanent connection.\n // _ju.addToList(params.endpointsByElement, placeholderInfo.id, this._jsPlumb.floatingEndpoint);\n\n\n // tell jsplumb about it\n _jsPlumb.currentlyDragging = true;\n }.bind(this);\n\n var stop = function () {\n _jsPlumb.setConnectionBeingDragged(false);\n\n if (jpc && jpc.endpoints != null) {\n // get the actual drop event (decode from library args to stop function)\n var originalEvent = _jsPlumb.getDropEvent(arguments);\n // unlock the other endpoint (if it is dynamic, it would have been locked at drag start)\n var idx = _jsPlumb.getFloatingAnchorIndex(jpc);\n jpc.endpoints[idx === 0 ? 1 : 0].anchor.locked = false;\n // TODO: Dont want to know about css classes inside jsplumb, ideally.\n jpc.removeClass(_jsPlumb.draggingClass);\n\n // if we have the floating endpoint then the connection has not been dropped\n // on another endpoint. If it is a new connection we throw it away. If it is an\n // existing connection we check to see if we should reattach it, throwing it away\n // if not.\n if (this._jsPlumb && (jpc.deleteConnectionNow || jpc.endpoints[idx] === this._jsPlumb.floatingEndpoint)) {\n // 6a. if the connection was an existing one...\n if (existingJpc && jpc.suspendedEndpoint) {\n // fix for issue35, thanks Sylvain Gizard: when firing the detach event make sure the\n // floating endpoint has been replaced.\n if (idx === 0) {\n jpc.floatingElement = jpc.source;\n jpc.floatingId = jpc.sourceId;\n jpc.floatingEndpoint = jpc.endpoints[0];\n jpc.floatingIndex = 0;\n jpc.source = existingJpcParams[0];\n jpc.sourceId = existingJpcParams[1];\n } else {\n // keep a copy of the floating element; the anchor manager will want to clean up.\n jpc.floatingElement = jpc.target;\n jpc.floatingId = jpc.targetId;\n jpc.floatingEndpoint = jpc.endpoints[1];\n jpc.floatingIndex = 1;\n jpc.target = existingJpcParams[0];\n jpc.targetId = existingJpcParams[1];\n }\n\n var fe = this._jsPlumb.floatingEndpoint; // store for later removal.\n // restore the original scope (issue 57)\n _jsPlumb.setDragScope(existingJpcParams[2], existingJpcParams[3]);\n jpc.endpoints[idx] = jpc.suspendedEndpoint;\n // if the connection should be reattached, or the other endpoint refuses detach, then\n // reset the connection to its original state\n if (jpc.isReattach() || jpc._forceReattach || jpc._forceDetach || !_jsPlumb.deleteConnection(jpc, {originalEvent: originalEvent})) {\n\n jpc.setHover(false);\n jpc._forceDetach = null;\n jpc._forceReattach = null;\n this._jsPlumb.floatingEndpoint.detachFromConnection(jpc);\n jpc.suspendedEndpoint.addConnection(jpc);\n\n // TODO this code is duplicated in lots of places...and there is nothing external\n // in the code; it all refers to the connection itself. we could add a\n // `checkSanity(connection)` method to anchorManager that did this.\n if (idx === 1) {\n _jsPlumb.anchorManager.updateOtherEndpoint(jpc.sourceId, jpc.floatingId, jpc.targetId, jpc);\n }\n else {\n _jsPlumb.anchorManager.sourceChanged(jpc.floatingId, jpc.sourceId, jpc, jpc.source);\n }\n\n _jsPlumb.repaint(existingJpcParams[1]);\n }\n else {\n _jsPlumb.deleteObject({endpoint: fe});\n }\n }\n }\n\n // makeTargets sets this flag, to tell us we have been replaced and should delete this object.\n if (this.deleteAfterDragStop) {\n _jsPlumb.deleteObject({endpoint: this});\n }\n else {\n if (this._jsPlumb) {\n this.paint({recalc: false});\n }\n }\n\n // although the connection is no longer valid, there are use cases where this is useful.\n _jsPlumb.fire(\"connectionDragStop\", jpc, originalEvent);\n // fire this event to give people more fine-grained control (connectionDragStop fires a lot)\n if (jpc.pending) {\n _jsPlumb.fire(\"connectionAborted\", jpc, originalEvent);\n }\n // tell jsplumb that dragging is finished.\n _jsPlumb.currentlyDragging = false;\n jpc.suspendedElement = null;\n jpc.suspendedEndpoint = null;\n jpc = null;\n }\n\n // if no endpoints, jpc already cleaned up. but still we want to ensure we're reset properly.\n // remove the element associated with the floating endpoint\n // (and its associated floating endpoint and visual artefacts)\n if (placeholderInfo && placeholderInfo.element) {\n _jsPlumb.remove(placeholderInfo.element, false, false);\n }\n // remove the inplace copy\n if (inPlaceCopy) {\n _jsPlumb.deleteObject({endpoint: inPlaceCopy});\n }\n\n if (this._jsPlumb) {\n // make our canvas visible (TODO: hand off to library; we should not know about DOM)\n this.canvas.style.visibility = \"visible\";\n // unlock our anchor\n this.anchor.locked = false;\n // clear floating anchor.\n this._jsPlumb.floatingEndpoint = null;\n }\n\n }.bind(this);\n\n dragOptions = _jp.extend(defaultOpts, dragOptions);\n dragOptions.scope = this.scope || dragOptions.scope;\n dragOptions[beforeStartEvent] = _ju.wrap(dragOptions[beforeStartEvent], beforeStart, false);\n dragOptions[startEvent] = _ju.wrap(dragOptions[startEvent], start, false);\n // extracted drag handler function so can be used by makeSource\n dragOptions[dragEvent] = _ju.wrap(dragOptions[dragEvent], _dragHandler.drag);\n dragOptions[stopEvent] = _ju.wrap(dragOptions[stopEvent], stop);\n dragOptions.multipleDrop = false;\n\n dragOptions.canDrag = function () {\n return this.isSource || this.isTemporarySource || /*(this.isTarget && */this.connections.length > 0/*)*/;\n }.bind(this);\n\n _jsPlumb.initDraggable(this.canvas, dragOptions, \"internal\");\n\n this.canvas._jsPlumbRelatedElement = this.element;\n\n draggingInitialised = true;\n }\n };\n\n var ep = params.endpoint || this._jsPlumb.instance.Defaults.Endpoint || _jp.Defaults.Endpoint;\n this.setEndpoint(ep, true);\n var anchorParamsToUse = params.anchor ? params.anchor : params.anchors ? params.anchors : (_jsPlumb.Defaults.Anchor || \"Top\");\n this.setAnchor(anchorParamsToUse, true);\n\n // finally, set type if it was provided\n var type = [ \"default\", (params.type || \"\")].join(\" \");\n this.addType(type, params.data, true);\n this.canvas = this.endpoint.canvas;\n this.canvas._jsPlumb = this;\n\n this.initDraggable();\n\n // pulled this out into a function so we can reuse it for the inPlaceCopy canvas; you can now drop detached connections\n // back onto the endpoint you detached it from.\n var _initDropTarget = function (canvas, isTransient, endpoint, referenceEndpoint) {\n\n if (_jp.isDropSupported(this.element)) {\n var dropOptions = params.dropOptions || _jsPlumb.Defaults.DropOptions || _jp.Defaults.DropOptions;\n dropOptions = _jp.extend({}, dropOptions);\n dropOptions.scope = dropOptions.scope || this.scope;\n var dropEvent = _jp.dragEvents.drop,\n overEvent = _jp.dragEvents.over,\n outEvent = _jp.dragEvents.out,\n _ep = this,\n drop = _jsPlumb.EndpointDropHandler({\n getEndpoint: function () {\n return _ep;\n },\n jsPlumb: _jsPlumb,\n enabled: function () {\n return endpoint != null ? endpoint.isEnabled() : true;\n },\n isFull: function () {\n return endpoint.isFull();\n },\n element: this.element,\n elementId: this.elementId,\n isSource: this.isSource,\n isTarget: this.isTarget,\n addClass: function (clazz) {\n _ep.addClass(clazz);\n },\n removeClass: function (clazz) {\n _ep.removeClass(clazz);\n },\n isDropAllowed: function () {\n return _ep.isDropAllowed.apply(_ep, arguments);\n },\n reference:referenceEndpoint,\n isRedrop:function(jpc, dhParams) {\n return jpc.suspendedEndpoint && dhParams.reference && (jpc.suspendedEndpoint.id === dhParams.reference.id);\n }\n });\n\n dropOptions[dropEvent] = _ju.wrap(dropOptions[dropEvent], drop, true);\n dropOptions[overEvent] = _ju.wrap(dropOptions[overEvent], function () {\n var draggable = _jp.getDragObject(arguments),\n id = _jsPlumb.getAttribute(_jp.getElement(draggable), \"dragId\"),\n _jpc = _jsPlumb.getFloatingConnectionFor(id);//_jsPlumb.floatingConnections[id];\n\n if (_jpc != null) {\n var idx = _jsPlumb.getFloatingAnchorIndex(_jpc);\n // here we should fire the 'over' event if we are a target and this is a new connection,\n // or we are the same as the floating endpoint.\n var _cont = (this.isTarget && idx !== 0) || (_jpc.suspendedEndpoint && this.referenceEndpoint && this.referenceEndpoint.id === _jpc.suspendedEndpoint.id);\n if (_cont) {\n var bb = _jsPlumb.checkCondition(\"checkDropAllowed\", {\n sourceEndpoint: _jpc.endpoints[idx],\n targetEndpoint: this,\n connection: _jpc\n });\n this[(bb ? \"add\" : \"remove\") + \"Class\"](_jsPlumb.endpointDropAllowedClass);\n this[(bb ? \"remove\" : \"add\") + \"Class\"](_jsPlumb.endpointDropForbiddenClass);\n _jpc.endpoints[idx].anchor.over(this.anchor, this);\n }\n }\n }.bind(this));\n\n dropOptions[outEvent] = _ju.wrap(dropOptions[outEvent], function () {\n var draggable = _jp.getDragObject(arguments),\n id = draggable == null ? null : _jsPlumb.getAttribute(_jp.getElement(draggable), \"dragId\"),\n _jpc = id ? _jsPlumb.getFloatingConnectionFor(id) : null;\n\n if (_jpc != null) {\n var idx = _jsPlumb.getFloatingAnchorIndex(_jpc);\n var _cont = (this.isTarget && idx !== 0) || (_jpc.suspendedEndpoint && this.referenceEndpoint && this.referenceEndpoint.id === _jpc.suspendedEndpoint.id);\n if (_cont) {\n this.removeClass(_jsPlumb.endpointDropAllowedClass);\n this.removeClass(_jsPlumb.endpointDropForbiddenClass);\n _jpc.endpoints[idx].anchor.out();\n }\n }\n }.bind(this));\n\n _jsPlumb.initDroppable(canvas, dropOptions, \"internal\", isTransient);\n }\n }.bind(this);\n\n // Initialise the endpoint's canvas as a drop target. The drop handler will take care of the logic of whether\n // something can actually be dropped.\n if (!this.anchor.isFloating) {\n _initDropTarget(this.canvas, !(params._transient || this.anchor.isFloating), this, params.reference);\n }\n\n return this;\n };\n\n _ju.extend(_jp.Endpoint, _jp.OverlayCapableJsPlumbUIComponent, {\n\n setVisible: function (v, doNotChangeConnections, doNotNotifyOtherEndpoint) {\n this._jsPlumb.visible = v;\n if (this.canvas) {\n this.canvas.style.display = v ? \"block\" : \"none\";\n }\n this[v ? \"showOverlays\" : \"hideOverlays\"]();\n if (!doNotChangeConnections) {\n for (var i = 0; i < this.connections.length; i++) {\n this.connections[i].setVisible(v);\n if (!doNotNotifyOtherEndpoint) {\n var oIdx = this === this.connections[i].endpoints[0] ? 1 : 0;\n // only change the other endpoint if this is its only connection.\n if (this.connections[i].endpoints[oIdx].connections.length === 1) {\n this.connections[i].endpoints[oIdx].setVisible(v, true, true);\n }\n }\n }\n }\n },\n getAttachedElements: function () {\n return this.connections;\n },\n applyType: function (t, doNotRepaint) {\n this.setPaintStyle(t.endpointStyle || t.paintStyle, doNotRepaint);\n this.setHoverPaintStyle(t.endpointHoverStyle || t.hoverPaintStyle, doNotRepaint);\n if (t.maxConnections != null) {\n this._jsPlumb.maxConnections = t.maxConnections;\n }\n if (t.scope) {\n this.scope = t.scope;\n }\n _jp.extend(this, t, typeParameters);\n if (t.cssClass != null && this.canvas) {\n this._jsPlumb.instance.addClass(this.canvas, t.cssClass);\n }\n _jp.OverlayCapableJsPlumbUIComponent.applyType(this, t);\n },\n isEnabled: function () {\n return this._jsPlumb.enabled;\n },\n setEnabled: function (e) {\n this._jsPlumb.enabled = e;\n },\n cleanup: function () {\n var anchorClass = this._jsPlumb.instance.endpointAnchorClassPrefix + (this._jsPlumb.currentAnchorClass ? \"-\" + this._jsPlumb.currentAnchorClass : \"\");\n _jp.removeClass(this.element, anchorClass);\n this.anchor = null;\n this.endpoint.cleanup(true);\n this.endpoint.destroy();\n this.endpoint = null;\n // drag/drop\n this._jsPlumb.instance.destroyDraggable(this.canvas, \"internal\");\n this._jsPlumb.instance.destroyDroppable(this.canvas, \"internal\");\n },\n setHover: function (h) {\n if (this.endpoint && this._jsPlumb && !this._jsPlumb.instance.isConnectionBeingDragged()) {\n this.endpoint.setHover(h);\n }\n },\n isFull: function () {\n return this._jsPlumb.maxConnections === 0 ? true : !(this.isFloating() || this._jsPlumb.maxConnections < 0 || this.connections.length < this._jsPlumb.maxConnections);\n },\n /**\n * private but needs to be exposed.\n */\n isFloating: function () {\n return this.anchor != null && this.anchor.isFloating;\n },\n isConnectedTo: function (endpoint) {\n var found = false;\n if (endpoint) {\n for (var i = 0; i < this.connections.length; i++) {\n if (this.connections[i].endpoints[1] === endpoint || this.connections[i].endpoints[0] === endpoint) {\n found = true;\n break;\n }\n }\n }\n return found;\n },\n getConnectionCost: function () {\n return this._jsPlumb.connectionCost;\n },\n setConnectionCost: function (c) {\n this._jsPlumb.connectionCost = c;\n },\n areConnectionsDirected: function () {\n return this._jsPlumb.connectionsDirected;\n },\n setConnectionsDirected: function (b) {\n this._jsPlumb.connectionsDirected = b;\n },\n setElementId: function (_elId) {\n this.elementId = _elId;\n this.anchor.elementId = _elId;\n },\n setReferenceElement: function (_el) {\n this.element = _jp.getElement(_el);\n },\n setDragAllowedWhenFull: function (allowed) {\n this.dragAllowedWhenFull = allowed;\n },\n equals: function (endpoint) {\n return this.anchor.equals(endpoint.anchor);\n },\n getUuid: function () {\n return this._jsPlumb.uuid;\n },\n computeAnchor: function (params) {\n return this.anchor.compute(params);\n }\n });\n\n root.jsPlumbInstance.prototype.EndpointDropHandler = function (dhParams) {\n return function (e) {\n\n var _jsPlumb = dhParams.jsPlumb;\n\n // remove the classes that are added dynamically. drop is neither forbidden nor allowed now that\n // the drop is finishing.\n dhParams.removeClass(_jsPlumb.endpointDropAllowedClass);\n dhParams.removeClass(_jsPlumb.endpointDropForbiddenClass);\n\n var originalEvent = _jsPlumb.getDropEvent(arguments),\n draggable = _jsPlumb.getDragObject(arguments),\n id = _jsPlumb.getAttribute(draggable, \"dragId\"),\n elId = _jsPlumb.getAttribute(draggable, \"elId\"),\n scope = _jsPlumb.getAttribute(draggable, \"originalScope\"),\n jpc = _jsPlumb.getFloatingConnectionFor(id);\n\n // if no active connection, bail.\n if (jpc == null) {\n return;\n }\n\n // calculate if this is an existing connection.\n var existingConnection = jpc.suspendedEndpoint != null;\n\n // if suspended endpoint exists but has been cleaned up, bail. This means it's an existing connection\n // that has been detached and will shortly be discarded.\n if (existingConnection && jpc.suspendedEndpoint._jsPlumb == null) {\n return;\n }\n\n // get the drop endpoint. for a normal connection this is just the one that would replace the currently\n // floating endpoint. for a makeTarget this is a new endpoint that is created on drop. But we leave that to\n // the handler to figure out.\n var _ep = dhParams.getEndpoint(jpc);\n\n // If we're not given an endpoint to use, bail.\n if (_ep == null) {\n return;\n }\n\n // if this is a drop back where the connection came from, mark it force reattach and\n // return; the stop handler will reattach. without firing an event.\n if (dhParams.isRedrop(jpc, dhParams)) {\n jpc._forceReattach = true;\n jpc.setHover(false);\n if (dhParams.maybeCleanup) {\n dhParams.maybeCleanup(_ep);\n }\n return;\n }\n\n // ensure we dont bother trying to drop sources on non-source eps, and same for target.\n var idx = _jsPlumb.getFloatingAnchorIndex(jpc);\n if ((idx === 0 && !dhParams.isSource)|| (idx === 1 && !dhParams.isTarget)){\n if (dhParams.maybeCleanup) {\n dhParams.maybeCleanup(_ep);\n }\n return;\n }\n\n if (dhParams.onDrop) {\n dhParams.onDrop(jpc);\n }\n\n // restore the original scope if necessary (issue 57)\n if (scope) {\n _jsPlumb.setDragScope(draggable, scope);\n }\n\n // if the target of the drop is full, fire an event (we abort below)\n // makeTarget: keep.\n var isFull = dhParams.isFull(e);\n if (isFull) {\n _ep.fire(\"maxConnections\", {\n endpoint: this,\n connection: jpc,\n maxConnections: _ep._jsPlumb.maxConnections\n }, originalEvent);\n }\n //\n // if endpoint enabled, not full, and matches the index of the floating endpoint...\n if (!isFull && dhParams.enabled()) {\n var _doContinue = true;\n\n // before testing for beforeDrop, reset the connection's source/target to be the actual DOM elements\n // involved (that is, stash any temporary stuff used for dragging. but we need to keep it around in\n // order that the anchor manager can clean things up properly).\n if (idx === 0) {\n jpc.floatingElement = jpc.source;\n jpc.floatingId = jpc.sourceId;\n jpc.floatingEndpoint = jpc.endpoints[0];\n jpc.floatingIndex = 0;\n jpc.source = dhParams.element;\n jpc.sourceId = dhParams.elementId;\n } else {\n jpc.floatingElement = jpc.target;\n jpc.floatingId = jpc.targetId;\n jpc.floatingEndpoint = jpc.endpoints[1];\n jpc.floatingIndex = 1;\n jpc.target = dhParams.element;\n jpc.targetId = dhParams.elementId;\n }\n\n // if this is an existing connection and detach is not allowed we won't continue. The connection's\n // endpoints have been reinstated; everything is back to how it was.\n if (existingConnection && jpc.suspendedEndpoint.id !== _ep.id) {\n if (!jpc.isDetachAllowed(jpc) || !jpc.endpoints[idx].isDetachAllowed(jpc) || !jpc.suspendedEndpoint.isDetachAllowed(jpc) || !_jsPlumb.checkCondition(\"beforeDetach\", jpc)) {\n _doContinue = false;\n }\n }\n\n// ------------ wrap the execution path in a function so we can support asynchronous beforeDrop\n\n var continueFunction = function (optionalData) {\n // remove this jpc from the current endpoint, which is a floating endpoint that we will\n // subsequently discard.\n jpc.endpoints[idx].detachFromConnection(jpc);\n\n // if there's a suspended endpoint, detach it from the connection.\n if (jpc.suspendedEndpoint) {\n jpc.suspendedEndpoint.detachFromConnection(jpc);\n }\n\n jpc.endpoints[idx] = _ep;\n _ep.addConnection(jpc);\n\n // copy our parameters in to the connection:\n var params = _ep.getParameters();\n for (var aParam in params) {\n jpc.setParameter(aParam, params[aParam]);\n }\n\n if (!existingConnection) {\n // if not an existing connection and\n if (params.draggable) {\n _jsPlumb.initDraggable(this.element, dhParams.dragOptions, \"internal\", _jsPlumb);\n }\n }\n else {\n var suspendedElementId = jpc.suspendedEndpoint.elementId;\n _jsPlumb.fireMoveEvent({\n index: idx,\n originalSourceId: idx === 0 ? suspendedElementId : jpc.sourceId,\n newSourceId: idx === 0 ? _ep.elementId : jpc.sourceId,\n originalTargetId: idx === 1 ? suspendedElementId : jpc.targetId,\n newTargetId: idx === 1 ? _ep.elementId : jpc.targetId,\n originalSourceEndpoint: idx === 0 ? jpc.suspendedEndpoint : jpc.endpoints[0],\n newSourceEndpoint: idx === 0 ? _ep : jpc.endpoints[0],\n originalTargetEndpoint: idx === 1 ? jpc.suspendedEndpoint : jpc.endpoints[1],\n newTargetEndpoint: idx === 1 ? _ep : jpc.endpoints[1],\n connection: jpc\n }, originalEvent);\n }\n\n if (idx === 1) {\n _jsPlumb.anchorManager.updateOtherEndpoint(jpc.sourceId, jpc.floatingId, jpc.targetId, jpc);\n }\n else {\n _jsPlumb.anchorManager.sourceChanged(jpc.floatingId, jpc.sourceId, jpc, jpc.source);\n }\n\n // when makeSource has uniqueEndpoint:true, we want to create connections with new endpoints\n // that are subsequently deleted. So makeSource sets `finalEndpoint`, which is the Endpoint to\n // which the connection should be attached. The `detachFromConnection` call below results in the\n // temporary endpoint being cleaned up.\n if (jpc.endpoints[0].finalEndpoint) {\n var _toDelete = jpc.endpoints[0];\n _toDelete.detachFromConnection(jpc);\n jpc.endpoints[0] = jpc.endpoints[0].finalEndpoint;\n jpc.endpoints[0].addConnection(jpc);\n }\n\n // if optionalData was given, merge it onto the connection's data.\n if (_ju.isObject(optionalData)) {\n jpc.mergeData(optionalData);\n }\n // finalise will inform the anchor manager and also add to\n // connectionsByScope if necessary.\n _jsPlumb.finaliseConnection(jpc, null, originalEvent, false);\n jpc.setHover(false);\n\n }.bind(this);\n\n var dontContinueFunction = function () {\n // otherwise just put it back on the endpoint it was on before the drag.\n if (jpc.suspendedEndpoint) {\n jpc.endpoints[idx] = jpc.suspendedEndpoint;\n jpc.setHover(false);\n jpc._forceDetach = true;\n if (idx === 0) {\n jpc.source = jpc.suspendedEndpoint.element;\n jpc.sourceId = jpc.suspendedEndpoint.elementId;\n } else {\n jpc.target = jpc.suspendedEndpoint.element;\n jpc.targetId = jpc.suspendedEndpoint.elementId;\n }\n jpc.suspendedEndpoint.addConnection(jpc);\n\n // TODO checkSanity\n if (idx === 1) {\n _jsPlumb.anchorManager.updateOtherEndpoint(jpc.sourceId, jpc.floatingId, jpc.targetId, jpc);\n }\n else {\n _jsPlumb.anchorManager.sourceChanged(jpc.floatingId, jpc.sourceId, jpc, jpc.source);\n }\n\n _jsPlumb.repaint(jpc.sourceId);\n jpc._forceDetach = false;\n }\n };\n\n// --------------------------------------\n // now check beforeDrop. this will be available only on Endpoints that are setup to\n // have a beforeDrop condition (although, secretly, under the hood all Endpoints and\n // the Connection have them, because they are on jsPlumbUIComponent. shhh!), because\n // it only makes sense to have it on a target endpoint.\n _doContinue = _doContinue && dhParams.isDropAllowed(jpc.sourceId, jpc.targetId, jpc.scope, jpc, _ep);// && jpc.pending;\n\n if (_doContinue) {\n continueFunction(_doContinue);\n return true;\n }\n else {\n dontContinueFunction();\n }\n }\n\n if (dhParams.maybeCleanup) {\n dhParams.maybeCleanup(_ep);\n }\n\n _jsPlumb.currentlyDragging = false;\n };\n };\n}).call(typeof window !== 'undefined' ? window : this);\n\n/*\n * This file contains the code for Connections.\n *\n * Copyright (c) 2010 - 2018 jsPlumb (hello@jsplumbtoolkit.com)\n *\n * https://jsplumbtoolkit.com\n * https://github.com/jsplumb/jsplumb\n *\n * Dual licensed under the MIT and GPL2 licenses.\n */\n;\n(function () {\n\n \"use strict\";\n var root = this,\n _jp = root.jsPlumb,\n _ju = root.jsPlumbUtil;\n\n var makeConnector = function (_jsPlumb, renderMode, connectorName, connectorArgs, forComponent) {\n if (!_jsPlumb.Defaults.DoNotThrowErrors && _jp.Connectors[renderMode][connectorName] == null) {\n throw { msg: \"jsPlumb: unknown connector type '\" + connectorName + \"'\" };\n }\n\n return new _jp.Connectors[renderMode][connectorName](connectorArgs, forComponent);\n },\n _makeAnchor = function (anchorParams, elementId, _jsPlumb) {\n return (anchorParams) ? _jsPlumb.makeAnchor(anchorParams, elementId, _jsPlumb) : null;\n },\n _updateConnectedClass = function (conn, element, _jsPlumb, remove) {\n if (element != null) {\n element._jsPlumbConnections = element._jsPlumbConnections || {};\n if (remove) {\n delete element._jsPlumbConnections[conn.id];\n }\n else {\n element._jsPlumbConnections[conn.id] = true;\n }\n\n if (_ju.isEmpty(element._jsPlumbConnections)) {\n _jsPlumb.removeClass(element, _jsPlumb.connectedClass);\n }\n else {\n _jsPlumb.addClass(element, _jsPlumb.connectedClass);\n }\n }\n };\n\n _jp.Connection = function (params) {\n var _newEndpoint = params.newEndpoint;\n\n this.id = params.id;\n this.connector = null;\n this.idPrefix = \"_jsplumb_c_\";\n this.defaultLabelLocation = 0.5;\n this.defaultOverlayKeys = [\"Overlays\", \"ConnectionOverlays\"];\n // if a new connection is the result of moving some existing connection, params.previousConnection\n // will have that Connection in it. listeners for the jsPlumbConnection event can look for that\n // member and take action if they need to.\n this.previousConnection = params.previousConnection;\n this.source = _jp.getElement(params.source);\n this.target = _jp.getElement(params.target);\n\n\n _jp.OverlayCapableJsPlumbUIComponent.apply(this, arguments);\n\n // sourceEndpoint and targetEndpoint override source/target, if they are present. but \n // source is not overridden if the Endpoint has declared it is not the final target of a connection;\n // instead we use the source that the Endpoint declares will be the final source element.\n if (params.sourceEndpoint) {\n this.source = params.sourceEndpoint.getElement();\n this.sourceId = params.sourceEndpoint.elementId;\n } else {\n this.sourceId = this._jsPlumb.instance.getId(this.source);\n }\n\n if (params.targetEndpoint) {\n this.target = params.targetEndpoint.getElement();\n this.targetId = params.targetEndpoint.elementId;\n } else {\n this.targetId = this._jsPlumb.instance.getId(this.target);\n }\n\n\n this.scope = params.scope; // scope may have been passed in to the connect call. if it wasn't, we will pull it from the source endpoint, after having initialised the endpoints. \n this.endpoints = [];\n this.endpointStyles = [];\n\n var _jsPlumb = this._jsPlumb.instance;\n\n _jsPlumb.manage(this.sourceId, this.source);\n _jsPlumb.manage(this.targetId, this.target);\n\n this._jsPlumb.visible = true;\n this._jsPlumb.editable = params.editable === true;\n this._jsPlumb.params = {\n cssClass: params.cssClass,\n container: params.container,\n \"pointer-events\": params[\"pointer-events\"],\n editorParams: params.editorParams,\n overlays: params.overlays\n };\n this._jsPlumb.lastPaintedAt = null;\n\n // listen to mouseover and mouseout events passed from the container delegate.\n this.bind(\"mouseover\", function () {\n this.setHover(true);\n }.bind(this));\n this.bind(\"mouseout\", function () {\n this.setHover(false);\n }.bind(this));\n\n this.editableRequested = params.editable !== false;\n this.setEditable = function(e) {\n return this.connector ? this.connector.setEditable(e) : false;\n };\n this.isEditable = function() { return this.connector ? this.connector.isEditable() : false; };\n this.isEditing = function() { return this.connector ? this.connector.isEditing() : false; };\n\n// INITIALISATION CODE\n\n this.makeEndpoint = function (isSource, el, elId, ep) {\n elId = elId || this._jsPlumb.instance.getId(el);\n return this.prepareEndpoint(_jsPlumb, _newEndpoint, this, ep, isSource ? 0 : 1, params, el, elId);\n };\n\n // if type given, get the endpoint definitions mapping to that type from the jsplumb instance, and use those.\n // we apply types at the end of this constructor but endpoints are only honoured in a type definition at\n // create time.\n if (params.type) {\n params.endpoints = params.endpoints || this._jsPlumb.instance.deriveEndpointAndAnchorSpec(params.type).endpoints;\n }\n\n var eS = this.makeEndpoint(true, this.source, this.sourceId, params.sourceEndpoint),\n eT = this.makeEndpoint(false, this.target, this.targetId, params.targetEndpoint);\n\n if (eS) {\n _ju.addToList(params.endpointsByElement, this.sourceId, eS);\n }\n if (eT) {\n _ju.addToList(params.endpointsByElement, this.targetId, eT);\n }\n // if scope not set, set it to be the scope for the source endpoint.\n if (!this.scope) {\n this.scope = this.endpoints[0].scope;\n }\n\n // if explicitly told to (or not to) delete endpoints when empty, override endpoint's preferences\n if (params.deleteEndpointsOnEmpty != null) {\n this.endpoints[0].setDeleteOnEmpty(params.deleteEndpointsOnEmpty);\n this.endpoints[1].setDeleteOnEmpty(params.deleteEndpointsOnEmpty);\n }\n\n// -------------------------- DEFAULT TYPE ---------------------------------------------\n\n // DETACHABLE\n var _detachable = _jsPlumb.Defaults.ConnectionsDetachable;\n if (params.detachable === false) {\n _detachable = false;\n }\n if (this.endpoints[0].connectionsDetachable === false) {\n _detachable = false;\n }\n if (this.endpoints[1].connectionsDetachable === false) {\n _detachable = false;\n }\n // REATTACH\n var _reattach = params.reattach || this.endpoints[0].reattachConnections || this.endpoints[1].reattachConnections || _jsPlumb.Defaults.ReattachConnections;\n\n this.appendToDefaultType({\n detachable: _detachable,\n reattach: _reattach,\n paintStyle:this.endpoints[0].connectorStyle || this.endpoints[1].connectorStyle || params.paintStyle || _jsPlumb.Defaults.PaintStyle || _jp.Defaults.PaintStyle,\n hoverPaintStyle:this.endpoints[0].connectorHoverStyle || this.endpoints[1].connectorHoverStyle || params.hoverPaintStyle || _jsPlumb.Defaults.HoverPaintStyle || _jp.Defaults.HoverPaintStyle\n });\n\n var _suspendedAt = _jsPlumb.getSuspendedAt();\n if (!_jsPlumb.isSuspendDrawing()) {\n // paint the endpoints\n var myInfo = _jsPlumb.getCachedData(this.sourceId),\n myOffset = myInfo.o, myWH = myInfo.s,\n otherInfo = _jsPlumb.getCachedData(this.targetId),\n otherOffset = otherInfo.o,\n otherWH = otherInfo.s,\n initialTimestamp = _suspendedAt || _jsPlumb.timestamp(),\n anchorLoc = this.endpoints[0].anchor.compute({\n xy: [ myOffset.left, myOffset.top ], wh: myWH, element: this.endpoints[0],\n elementId: this.endpoints[0].elementId,\n txy: [ otherOffset.left, otherOffset.top ], twh: otherWH, tElement: this.endpoints[1],\n timestamp: initialTimestamp\n });\n\n this.endpoints[0].paint({ anchorLoc: anchorLoc, timestamp: initialTimestamp });\n\n anchorLoc = this.endpoints[1].anchor.compute({\n xy: [ otherOffset.left, otherOffset.top ], wh: otherWH, element: this.endpoints[1],\n elementId: this.endpoints[1].elementId,\n txy: [ myOffset.left, myOffset.top ], twh: myWH, tElement: this.endpoints[0],\n timestamp: initialTimestamp\n });\n this.endpoints[1].paint({ anchorLoc: anchorLoc, timestamp: initialTimestamp });\n }\n\n this.getTypeDescriptor = function () {\n return \"connection\";\n };\n this.getAttachedElements = function () {\n return this.endpoints;\n };\n\n this.isDetachable = function () {\n return this._jsPlumb.detachable === true;\n };\n this.setDetachable = function (detachable) {\n this._jsPlumb.detachable = detachable === true;\n };\n this.isReattach = function () {\n return this._jsPlumb.reattach === true || this.endpoints[0].reattachConnections === true || this.endpoints[1].reattachConnections === true;\n };\n this.setReattach = function (reattach) {\n this._jsPlumb.reattach = reattach === true;\n };\n\n// END INITIALISATION CODE\n\n\n// COST + DIRECTIONALITY\n // if cost not supplied, try to inherit from source endpoint\n this._jsPlumb.cost = params.cost || this.endpoints[0].getConnectionCost();\n this._jsPlumb.directed = params.directed;\n // inherit directed flag if set no source endpoint\n if (params.directed == null) {\n this._jsPlumb.directed = this.endpoints[0].areConnectionsDirected();\n }\n// END COST + DIRECTIONALITY\n\n// PARAMETERS\n // merge all the parameters objects into the connection. parameters set\n // on the connection take precedence; then source endpoint params, then\n // finally target endpoint params.\n var _p = _jp.extend({}, this.endpoints[1].getParameters());\n _jp.extend(_p, this.endpoints[0].getParameters());\n _jp.extend(_p, this.getParameters());\n this.setParameters(_p);\n// END PARAMETERS\n\n// PAINTING\n\n this.setConnector(this.endpoints[0].connector || this.endpoints[1].connector || params.connector || _jsPlumb.Defaults.Connector || _jp.Defaults.Connector, true);\n if (params.geometry) {\n this.connector.setGeometry(params.geometry);\n }\n var data = params.data == null || !_ju.isObject(params.data) ? {} : params.data;\n this.getData = function() { return data; };\n this.setData = function(d) { data = d || {}; };\n this.mergeData = function(d) { data = _jp.extend(data, d); };\n\n // the very last thing we do is apply types, if there are any.\n var _types = [ \"default\", this.endpoints[0].connectionType, this.endpoints[1].connectionType, params.type ].join(\" \");\n if (/[^\\s]/.test(_types)) {\n this.addType(_types, params.data, true);\n }\n\n this.updateConnectedClass();\n\n// END PAINTING \n };\n\n _ju.extend(_jp.Connection, _jp.OverlayCapableJsPlumbUIComponent, {\n applyType: function (t, doNotRepaint, typeMap) {\n\n var _connector = null;\n if (t.connector != null) {\n _connector = this.getCachedTypeItem(\"connector\", typeMap.connector);\n if (_connector == null) {\n _connector = this.prepareConnector(t.connector, typeMap.connector);\n this.cacheTypeItem(\"connector\", _connector, typeMap.connector);\n }\n this.setPreparedConnector(_connector);\n }\n\n // none of these things result in the creation of objects so can be ignored.\n if (t.detachable != null) {\n this.setDetachable(t.detachable);\n }\n if (t.reattach != null) {\n this.setReattach(t.reattach);\n }\n if (t.scope) {\n this.scope = t.scope;\n }\n\n if (t.cssClass != null && this.canvas) {\n this._jsPlumb.instance.addClass(this.canvas, t.cssClass);\n }\n\n var _anchors = null;\n // this also results in the creation of objects.\n if (t.anchor) {\n // note that even if the param was anchor, we store `anchors`.\n _anchors = this.getCachedTypeItem(\"anchors\", typeMap.anchor);\n if (_anchors == null) {\n _anchors = [ this._jsPlumb.instance.makeAnchor(t.anchor), this._jsPlumb.instance.makeAnchor(t.anchor) ];\n this.cacheTypeItem(\"anchors\", _anchors, typeMap.anchor);\n }\n }\n else if (t.anchors) {\n _anchors = this.getCachedTypeItem(\"anchors\", typeMap.anchors);\n if (_anchors == null) {\n _anchors = [\n this._jsPlumb.instance.makeAnchor(t.anchors[0]),\n this._jsPlumb.instance.makeAnchor(t.anchors[1])\n ];\n this.cacheTypeItem(\"anchors\", _anchors, typeMap.anchors);\n }\n }\n if (_anchors != null) {\n this.endpoints[0].anchor = _anchors[0];\n this.endpoints[1].anchor = _anchors[1];\n if (this.endpoints[1].anchor.isDynamic) {\n this._jsPlumb.instance.repaint(this.endpoints[1].elementId);\n }\n }\n\n _jp.OverlayCapableJsPlumbUIComponent.applyType(this, t);\n },\n addClass: function (c, informEndpoints) {\n if (informEndpoints) {\n this.endpoints[0].addClass(c);\n this.endpoints[1].addClass(c);\n if (this.suspendedEndpoint) {\n this.suspendedEndpoint.addClass(c);\n }\n }\n if (this.connector) {\n this.connector.addClass(c);\n }\n },\n removeClass: function (c, informEndpoints) {\n if (informEndpoints) {\n this.endpoints[0].removeClass(c);\n this.endpoints[1].removeClass(c);\n if (this.suspendedEndpoint) {\n this.suspendedEndpoint.removeClass(c);\n }\n }\n if (this.connector) {\n this.connector.removeClass(c);\n }\n },\n isVisible: function () {\n return this._jsPlumb.visible;\n },\n setVisible: function (v) {\n this._jsPlumb.visible = v;\n if (this.connector) {\n this.connector.setVisible(v);\n }\n this.repaint();\n },\n cleanup: function () {\n this.updateConnectedClass(true);\n this.endpoints = null;\n this.source = null;\n this.target = null;\n if (this.connector != null) {\n this.connector.cleanup(true);\n this.connector.destroy(true);\n }\n this.connector = null;\n },\n updateConnectedClass:function(remove) {\n if (this._jsPlumb) {\n _updateConnectedClass(this, this.source, this._jsPlumb.instance, remove);\n _updateConnectedClass(this, this.target, this._jsPlumb.instance, remove);\n }\n },\n setHover: function (state) {\n if (this.connector && this._jsPlumb && !this._jsPlumb.instance.isConnectionBeingDragged()) {\n this.connector.setHover(state);\n root.jsPlumb[state ? \"addClass\" : \"removeClass\"](this.source, this._jsPlumb.instance.hoverSourceClass);\n root.jsPlumb[state ? \"addClass\" : \"removeClass\"](this.target, this._jsPlumb.instance.hoverTargetClass);\n }\n },\n getUuids:function() {\n return [ this.endpoints[0].getUuid(), this.endpoints[1].getUuid() ];\n },\n getCost: function () {\n return this._jsPlumb ? this._jsPlumb.cost : -Infinity;\n },\n setCost: function (c) {\n this._jsPlumb.cost = c;\n },\n isDirected: function () {\n return this._jsPlumb.directed;\n },\n getConnector: function () {\n return this.connector;\n },\n getGeometry : function() {\n return this.connector ? this.connector.getGeometry() : null;\n },\n setGeometry : function(g) {\n if (this.connector) {\n this.connector.setGeometry(g);\n }\n },\n prepareConnector:function(connectorSpec, typeId) {\n var connectorArgs = {\n _jsPlumb: this._jsPlumb.instance,\n cssClass: (this._jsPlumb.params.cssClass || \"\") + (this.isEditable() ? this._jsPlumb.instance.editableConnectorClass : \"\"),\n container: this._jsPlumb.params.container,\n \"pointer-events\": this._jsPlumb.params[\"pointer-events\"],\n editable:this.editableRequested\n },\n renderMode = this._jsPlumb.instance.getRenderMode(),\n connector;\n\n if (_ju.isString(connectorSpec)) {\n connector = makeConnector(this._jsPlumb.instance, renderMode, connectorSpec, connectorArgs, this);\n } // lets you use a string as shorthand.\n else if (_ju.isArray(connectorSpec)) {\n if (connectorSpec.length === 1) {\n connector = makeConnector(this._jsPlumb.instance, renderMode, connectorSpec[0], connectorArgs, this);\n }\n else {\n connector = makeConnector(this._jsPlumb.instance, renderMode, connectorSpec[0], _ju.merge(connectorSpec[1], connectorArgs), this);\n }\n }\n if (typeId != null) {\n connector.typeId = typeId;\n }\n return connector;\n },\n setPreparedConnector: function(connector, doNotRepaint, doNotChangeListenerComponent, typeId) {\n\n if (this.connector !== connector) {\n\n var previous, previousClasses = \"\";\n // the connector will not be cleaned up if it was set as part of a type, because `typeId` will be set on it\n // and we havent passed in `true` for \"force\" here.\n if (this.connector != null) {\n previous = this.connector;\n previousClasses = previous.getClass();\n this.connector.cleanup();\n this.connector.destroy();\n }\n\n this.connector = connector;\n if (typeId) {\n this.cacheTypeItem(\"connector\", connector, typeId);\n }\n\n this.canvas = this.connector.canvas;\n this.bgCanvas = this.connector.bgCanvas;\n\n // put classes from prior connector onto the canvas\n this.addClass(previousClasses);\n\n // new: instead of binding listeners per connector, we now just have one delegate on the container.\n // so for that handler we set the connection as the '_jsPlumb' member of the canvas element, and\n // bgCanvas, if it exists, which it does right now in the VML renderer, so it won't from v 2.0.0 onwards.\n if (this.canvas) {\n this.canvas._jsPlumb = this;\n }\n if (this.bgCanvas) {\n this.bgCanvas._jsPlumb = this;\n }\n\n if (previous != null) {\n var o = this.getOverlays();\n for (var i = 0; i < o.length; i++) {\n if (o[i].transfer) {\n o[i].transfer(this.connector);\n }\n }\n }\n\n if (!doNotChangeListenerComponent) {\n this.setListenerComponent(this.connector);\n }\n if (!doNotRepaint) {\n this.repaint();\n }\n }\n },\n setConnector: function (connectorSpec, doNotRepaint, doNotChangeListenerComponent, typeId) {\n var connector = this.prepareConnector(connectorSpec, typeId);\n this.setPreparedConnector(connector, doNotRepaint, doNotChangeListenerComponent, typeId);\n },\n paint: function (params) {\n\n if (!this._jsPlumb.instance.isSuspendDrawing() && this._jsPlumb.visible) {\n params = params || {};\n var timestamp = params.timestamp,\n // if the moving object is not the source we must transpose the two references.\n swap = false,\n tId = swap ? this.sourceId : this.targetId, sId = swap ? this.targetId : this.sourceId,\n tIdx = swap ? 0 : 1, sIdx = swap ? 1 : 0;\n\n if (timestamp == null || timestamp !== this._jsPlumb.lastPaintedAt) {\n var sourceInfo = this._jsPlumb.instance.updateOffset({elId:sId}).o,\n targetInfo = this._jsPlumb.instance.updateOffset({elId:tId}).o,\n sE = this.endpoints[sIdx], tE = this.endpoints[tIdx];\n\n var sAnchorP = sE.anchor.getCurrentLocation({xy: [sourceInfo.left, sourceInfo.top], wh: [sourceInfo.width, sourceInfo.height], element: sE, timestamp: timestamp}),\n tAnchorP = tE.anchor.getCurrentLocation({xy: [targetInfo.left, targetInfo.top], wh: [targetInfo.width, targetInfo.height], element: tE, timestamp: timestamp});\n\n this.connector.resetBounds();\n\n this.connector.compute({\n sourcePos: sAnchorP,\n targetPos: tAnchorP,\n sourceEndpoint: this.endpoints[sIdx],\n targetEndpoint: this.endpoints[tIdx],\n \"stroke-width\": this._jsPlumb.paintStyleInUse.strokeWidth,\n sourceInfo: sourceInfo,\n targetInfo: targetInfo\n });\n\n var overlayExtents = { minX: Infinity, minY: Infinity, maxX: -Infinity, maxY: -Infinity };\n\n // compute overlays. we do this first so we can get their placements, and adjust the\n // container if needs be (if an overlay would be clipped)\n for (var i in this._jsPlumb.overlays) {\n if (this._jsPlumb.overlays.hasOwnProperty(i)) {\n var o = this._jsPlumb.overlays[i];\n if (o.isVisible()) {\n this._jsPlumb.overlayPlacements[i] = o.draw(this.connector, this._jsPlumb.paintStyleInUse, this.getAbsoluteOverlayPosition(o));\n overlayExtents.minX = Math.min(overlayExtents.minX, this._jsPlumb.overlayPlacements[i].minX);\n overlayExtents.maxX = Math.max(overlayExtents.maxX, this._jsPlumb.overlayPlacements[i].maxX);\n overlayExtents.minY = Math.min(overlayExtents.minY, this._jsPlumb.overlayPlacements[i].minY);\n overlayExtents.maxY = Math.max(overlayExtents.maxY, this._jsPlumb.overlayPlacements[i].maxY);\n }\n }\n }\n\n var lineWidth = parseFloat(this._jsPlumb.paintStyleInUse.strokeWidth || 1) / 2,\n outlineWidth = parseFloat(this._jsPlumb.paintStyleInUse.strokeWidth || 0),\n extents = {\n xmin: Math.min(this.connector.bounds.minX - (lineWidth + outlineWidth), overlayExtents.minX),\n ymin: Math.min(this.connector.bounds.minY - (lineWidth + outlineWidth), overlayExtents.minY),\n xmax: Math.max(this.connector.bounds.maxX + (lineWidth + outlineWidth), overlayExtents.maxX),\n ymax: Math.max(this.connector.bounds.maxY + (lineWidth + outlineWidth), overlayExtents.maxY)\n };\n // paint the connector.\n this.connector.paint(this._jsPlumb.paintStyleInUse, null, extents);\n // and then the overlays\n for (var j in this._jsPlumb.overlays) {\n if (this._jsPlumb.overlays.hasOwnProperty(j)) {\n var p = this._jsPlumb.overlays[j];\n if (p.isVisible()) {\n p.paint(this._jsPlumb.overlayPlacements[j], extents);\n }\n }\n }\n }\n this._jsPlumb.lastPaintedAt = timestamp;\n }\n },\n repaint: function (params) {\n params = params || {};\n this.paint({ elId: this.sourceId, recalc: !(params.recalc === false), timestamp: params.timestamp});\n },\n prepareEndpoint: function (_jsPlumb, _newEndpoint, conn, existing, index, params, element, elementId) {\n var e;\n if (existing) {\n conn.endpoints[index] = existing;\n existing.addConnection(conn);\n } else {\n if (!params.endpoints) {\n params.endpoints = [ null, null ];\n }\n var ep = params.endpoints[index] || params.endpoint || _jsPlumb.Defaults.Endpoints[index] || _jp.Defaults.Endpoints[index] || _jsPlumb.Defaults.Endpoint || _jp.Defaults.Endpoint;\n if (!params.endpointStyles) {\n params.endpointStyles = [ null, null ];\n }\n if (!params.endpointHoverStyles) {\n params.endpointHoverStyles = [ null, null ];\n }\n var es = params.endpointStyles[index] || params.endpointStyle || _jsPlumb.Defaults.EndpointStyles[index] || _jp.Defaults.EndpointStyles[index] || _jsPlumb.Defaults.EndpointStyle || _jp.Defaults.EndpointStyle;\n // Endpoints derive their fill from the connector's stroke, if no fill was specified.\n if (es.fill == null && params.paintStyle != null) {\n es.fill = params.paintStyle.stroke;\n }\n\n if (es.outlineStroke == null && params.paintStyle != null) {\n es.outlineStroke = params.paintStyle.outlineStroke;\n }\n if (es.outlineWidth == null && params.paintStyle != null) {\n es.outlineWidth = params.paintStyle.outlineWidth;\n }\n\n var ehs = params.endpointHoverStyles[index] || params.endpointHoverStyle || _jsPlumb.Defaults.EndpointHoverStyles[index] || _jp.Defaults.EndpointHoverStyles[index] || _jsPlumb.Defaults.EndpointHoverStyle || _jp.Defaults.EndpointHoverStyle;\n // endpoint hover fill style is derived from connector's hover stroke style\n if (params.hoverPaintStyle != null) {\n if (ehs == null) {\n ehs = {};\n }\n if (ehs.fill == null) {\n ehs.fill = params.hoverPaintStyle.stroke;\n }\n }\n var a = params.anchors ? params.anchors[index] :\n params.anchor ? params.anchor :\n _makeAnchor(_jsPlumb.Defaults.Anchors[index], elementId, _jsPlumb) ||\n _makeAnchor(_jp.Defaults.Anchors[index], elementId, _jsPlumb) ||\n _makeAnchor(_jsPlumb.Defaults.Anchor, elementId, _jsPlumb) ||\n _makeAnchor(_jp.Defaults.Anchor, elementId, _jsPlumb),\n u = params.uuids ? params.uuids[index] : null;\n\n e = _newEndpoint({\n paintStyle: es, hoverPaintStyle: ehs, endpoint: ep, connections: [ conn ],\n uuid: u, anchor: a, source: element, scope: params.scope,\n reattach: params.reattach || _jsPlumb.Defaults.ReattachConnections,\n detachable: params.detachable || _jsPlumb.Defaults.ConnectionsDetachable\n });\n if (existing == null) {\n e.setDeleteOnEmpty(true);\n }\n conn.endpoints[index] = e;\n\n if (params.drawEndpoints === false) {\n e.setVisible(false, true, true);\n }\n\n }\n return e;\n }\n\n }); // END Connection class \n}).call(typeof window !== 'undefined' ? window : this);\n\n/*\n * This file contains the code for creating and manipulating anchors.\n *\n * Copyright (c) 2010 - 2018 jsPlumb (hello@jsplumbtoolkit.com)\n *\n * https://jsplumbtoolkit.com\n * https://github.com/jsplumb/jsplumb\n *\n * Dual licensed under the MIT and GPL2 licenses.\n */\n;\n(function () {\n\n \"use strict\";\n\n var root = this,\n _ju = root.jsPlumbUtil,\n _jp = root.jsPlumb;\n\n //\n // manages anchors for all elements.\n //\n _jp.AnchorManager = function (params) {\n var _amEndpoints = {},\n continuousAnchorLocations = {},\n userDefinedContinuousAnchorLocations = {},\n continuousAnchorOrientations = {},\n Orientation = { HORIZONTAL: \"horizontal\", VERTICAL: \"vertical\", DIAGONAL: \"diagonal\", IDENTITY: \"identity\" },\n axes = [\"left\", \"top\", \"right\", \"bottom\"],\n connectionsByElementId = {},\n self = this,\n anchorLists = {},\n jsPlumbInstance = params.jsPlumbInstance,\n floatingConnections = {},\n calculateOrientation = function (sourceId, targetId, sd, td, sourceAnchor, targetAnchor) {\n\n if (sourceId === targetId) {\n return {\n orientation: Orientation.IDENTITY,\n a: [\"top\", \"top\"]\n };\n }\n\n var theta = Math.atan2((td.centery - sd.centery), (td.centerx - sd.centerx)),\n theta2 = Math.atan2((sd.centery - td.centery), (sd.centerx - td.centerx));\n\n// --------------------------------------------------------------------------------------\n\n // improved face calculation. get midpoints of each face for source and target, then put in an array with all combinations of\n // source/target faces. sort this array by distance between midpoints. the entry at index 0 is our preferred option. we can\n // go through the array one by one until we find an entry in which each requested face is supported.\n var candidates = [], midpoints = { };\n (function (types, dim) {\n for (var i = 0; i < types.length; i++) {\n midpoints[types[i]] = {\n \"left\": [ dim[i].left, dim[i].centery ],\n \"right\": [ dim[i].right, dim[i].centery ],\n \"top\": [ dim[i].centerx, dim[i].top ],\n \"bottom\": [ dim[i].centerx , dim[i].bottom]\n };\n }\n })([ \"source\", \"target\" ], [ sd, td ]);\n\n for (var sf = 0; sf < axes.length; sf++) {\n for (var tf = 0; tf < axes.length; tf++) {\n candidates.push({\n source: axes[sf],\n target: axes[tf],\n dist: Biltong.lineLength(midpoints.source[axes[sf]], midpoints.target[axes[tf]])\n });\n }\n }\n\n candidates.sort(function (a, b) {\n return a.dist < b.dist ? -1 : a.dist > b.dist ? 1 : 0;\n });\n\n // now go through this list and try to get an entry that satisfies both (there will be one, unless one of the anchors\n // declares no available faces)\n var sourceEdge = candidates[0].source, targetEdge = candidates[0].target;\n for (var i = 0; i < candidates.length; i++) {\n\n if (!sourceAnchor.isContinuous || sourceAnchor.isEdgeSupported(candidates[i].source)) {\n sourceEdge = candidates[i].source;\n }\n else {\n sourceEdge = null;\n }\n\n if (!targetAnchor.isContinuous || targetAnchor.isEdgeSupported(candidates[i].target)) {\n targetEdge = candidates[i].target;\n }\n else {\n targetEdge = null;\n }\n\n if (sourceEdge != null && targetEdge != null) {\n break;\n }\n }\n\n if (sourceAnchor.isContinuous) {\n sourceAnchor.setCurrentFace(sourceEdge);\n }\n\n if (targetAnchor.isContinuous) {\n targetAnchor.setCurrentFace(targetEdge);\n }\n\n// --------------------------------------------------------------------------------------\n\n return {\n a: [ sourceEdge, targetEdge ],\n theta: theta,\n theta2: theta2\n };\n },\n // used by placeAnchors function\n placeAnchorsOnLine = function (desc, elementDimensions, elementPosition, connections, horizontal, otherMultiplier, reverse) {\n var a = [], step = elementDimensions[horizontal ? 0 : 1] / (connections.length + 1);\n\n for (var i = 0; i < connections.length; i++) {\n var val = (i + 1) * step, other = otherMultiplier * elementDimensions[horizontal ? 1 : 0];\n if (reverse) {\n val = elementDimensions[horizontal ? 0 : 1] - val;\n }\n\n var dx = (horizontal ? val : other), x = elementPosition[0] + dx, xp = dx / elementDimensions[0],\n dy = (horizontal ? other : val), y = elementPosition[1] + dy, yp = dy / elementDimensions[1];\n\n a.push([ x, y, xp, yp, connections[i][1], connections[i][2] ]);\n }\n\n return a;\n },\n // used by edgeSortFunctions\n currySort = function (reverseAngles) {\n return function (a, b) {\n var r = true;\n if (reverseAngles) {\n r = a[0][0] < b[0][0];\n }\n else {\n r = a[0][0] > b[0][0];\n }\n return r === false ? -1 : 1;\n };\n },\n // used by edgeSortFunctions\n leftSort = function (a, b) {\n // first get adjusted values\n var p1 = a[0][0] < 0 ? -Math.PI - a[0][0] : Math.PI - a[0][0],\n p2 = b[0][0] < 0 ? -Math.PI - b[0][0] : Math.PI - b[0][0];\n if (p1 > p2) {\n return 1;\n }\n else {\n return -1;\n }\n },\n // used by placeAnchors\n edgeSortFunctions = {\n \"top\": function (a, b) {\n return a[0] > b[0] ? 1 : -1;\n },\n \"right\": currySort(true),\n \"bottom\": currySort(true),\n \"left\": leftSort\n },\n // used by placeAnchors\n _sortHelper = function (_array, _fn) {\n return _array.sort(_fn);\n },\n // used by AnchorManager.redraw\n placeAnchors = function (elementId, _anchorLists) {\n var cd = jsPlumbInstance.getCachedData(elementId), sS = cd.s, sO = cd.o,\n placeSomeAnchors = function (desc, elementDimensions, elementPosition, unsortedConnections, isHorizontal, otherMultiplier, orientation) {\n if (unsortedConnections.length > 0) {\n var sc = _sortHelper(unsortedConnections, edgeSortFunctions[desc]), // puts them in order based on the target element's pos on screen\n reverse = desc === \"right\" || desc === \"top\",\n anchors = placeAnchorsOnLine(desc, elementDimensions,\n elementPosition, sc,\n isHorizontal, otherMultiplier, reverse);\n\n // takes a computed anchor position and adjusts it for parent offset and scroll, then stores it.\n var _setAnchorLocation = function (endpoint, anchorPos) {\n continuousAnchorLocations[endpoint.id] = [ anchorPos[0], anchorPos[1], anchorPos[2], anchorPos[3] ];\n continuousAnchorOrientations[endpoint.id] = orientation;\n };\n\n for (var i = 0; i < anchors.length; i++) {\n var c = anchors[i][4], weAreSource = c.endpoints[0].elementId === elementId, weAreTarget = c.endpoints[1].elementId === elementId;\n if (weAreSource) {\n _setAnchorLocation(c.endpoints[0], anchors[i]);\n }\n if (weAreTarget) {\n _setAnchorLocation(c.endpoints[1], anchors[i]);\n }\n }\n }\n };\n\n placeSomeAnchors(\"bottom\", sS, [sO.left, sO.top], _anchorLists.bottom, true, 1, [0, 1]);\n placeSomeAnchors(\"top\", sS, [sO.left, sO.top], _anchorLists.top, true, 0, [0, -1]);\n placeSomeAnchors(\"left\", sS, [sO.left, sO.top], _anchorLists.left, false, 0, [-1, 0]);\n placeSomeAnchors(\"right\", sS, [sO.left, sO.top], _anchorLists.right, false, 1, [1, 0]);\n };\n\n this.reset = function () {\n _amEndpoints = {};\n connectionsByElementId = {};\n anchorLists = {};\n };\n this.addFloatingConnection = function (key, conn) {\n floatingConnections[key] = conn;\n };\n this.removeFloatingConnection = function (key) {\n delete floatingConnections[key];\n };\n this.newConnection = function (conn) {\n var sourceId = conn.sourceId, targetId = conn.targetId,\n ep = conn.endpoints,\n doRegisterTarget = true,\n registerConnection = function (otherIndex, otherEndpoint, otherAnchor, elId, c) {\n if ((sourceId === targetId) && otherAnchor.isContinuous) {\n // remove the target endpoint's canvas. we dont need it.\n conn._jsPlumb.instance.removeElement(ep[1].canvas);\n doRegisterTarget = false;\n }\n _ju.addToList(connectionsByElementId, elId, [c, otherEndpoint, otherAnchor.constructor === _jp.DynamicAnchor]);\n };\n\n registerConnection(0, ep[0], ep[0].anchor, targetId, conn);\n if (doRegisterTarget) {\n registerConnection(1, ep[1], ep[1].anchor, sourceId, conn);\n }\n };\n var removeEndpointFromAnchorLists = function (endpoint) {\n (function (list, eId) {\n if (list) { // transient anchors dont get entries in this list.\n var f = function (e) {\n return e[4] === eId;\n };\n _ju.removeWithFunction(list.top, f);\n _ju.removeWithFunction(list.left, f);\n _ju.removeWithFunction(list.bottom, f);\n _ju.removeWithFunction(list.right, f);\n }\n })(anchorLists[endpoint.elementId], endpoint.id);\n };\n this.connectionDetached = function (connInfo, doNotRedraw) {\n var connection = connInfo.connection || connInfo,\n sourceId = connInfo.sourceId,\n targetId = connInfo.targetId,\n ep = connection.endpoints,\n removeConnection = function (otherIndex, otherEndpoint, otherAnchor, elId, c) {\n _ju.removeWithFunction(connectionsByElementId[elId], function (_c) {\n return _c[0].id === c.id;\n });\n };\n\n removeConnection(1, ep[1], ep[1].anchor, sourceId, connection);\n removeConnection(0, ep[0], ep[0].anchor, targetId, connection);\n if (connection.floatingId) {\n removeConnection(connection.floatingIndex, connection.floatingEndpoint, connection.floatingEndpoint.anchor, connection.floatingId, connection);\n removeEndpointFromAnchorLists(connection.floatingEndpoint);\n }\n\n // remove from anchorLists \n removeEndpointFromAnchorLists(connection.endpoints[0]);\n removeEndpointFromAnchorLists(connection.endpoints[1]);\n\n if (!doNotRedraw) {\n self.redraw(connection.sourceId);\n if (connection.targetId !== connection.sourceId) {\n self.redraw(connection.targetId);\n }\n }\n };\n this.add = function (endpoint, elementId) {\n _ju.addToList(_amEndpoints, elementId, endpoint);\n };\n this.changeId = function (oldId, newId) {\n connectionsByElementId[newId] = connectionsByElementId[oldId];\n _amEndpoints[newId] = _amEndpoints[oldId];\n delete connectionsByElementId[oldId];\n delete _amEndpoints[oldId];\n };\n this.getConnectionsFor = function (elementId) {\n return connectionsByElementId[elementId] || [];\n };\n this.getEndpointsFor = function (elementId) {\n return _amEndpoints[elementId] || [];\n };\n this.deleteEndpoint = function (endpoint) {\n _ju.removeWithFunction(_amEndpoints[endpoint.elementId], function (e) {\n return e.id === endpoint.id;\n });\n removeEndpointFromAnchorLists(endpoint);\n };\n this.clearFor = function (elementId) {\n delete _amEndpoints[elementId];\n _amEndpoints[elementId] = [];\n };\n // updates the given anchor list by either updating an existing anchor's info, or adding it. this function\n // also removes the anchor from its previous list, if the edge it is on has changed.\n // all connections found along the way (those that are connected to one of the faces this function\n // operates on) are added to the connsToPaint list, as are their endpoints. in this way we know to repaint\n // them wthout having to calculate anything else about them.\n var _updateAnchorList = function (lists, theta, order, conn, aBoolean, otherElId, idx, reverse, edgeId, elId, connsToPaint, endpointsToPaint) {\n // first try to find the exact match, but keep track of the first index of a matching element id along the way.s\n var exactIdx = -1,\n firstMatchingElIdx = -1,\n endpoint = conn.endpoints[idx],\n endpointId = endpoint.id,\n oIdx = [1, 0][idx],\n values = [\n [ theta, order ],\n conn,\n aBoolean,\n otherElId,\n endpointId\n ],\n listToAddTo = lists[edgeId],\n listToRemoveFrom = endpoint._continuousAnchorEdge ? lists[endpoint._continuousAnchorEdge] : null,\n i,\n candidate;\n\n if (listToRemoveFrom) {\n var rIdx = _ju.findWithFunction(listToRemoveFrom, function (e) {\n return e[4] === endpointId;\n });\n if (rIdx !== -1) {\n listToRemoveFrom.splice(rIdx, 1);\n // get all connections from this list\n for (i = 0; i < listToRemoveFrom.length; i++) {\n candidate = listToRemoveFrom[i][1];\n _ju.addWithFunction(connsToPaint, candidate, function (c) {\n return c.id === candidate.id;\n });\n _ju.addWithFunction(endpointsToPaint, listToRemoveFrom[i][1].endpoints[idx], function (e) {\n return e.id === candidate.endpoints[idx].id;\n });\n _ju.addWithFunction(endpointsToPaint, listToRemoveFrom[i][1].endpoints[oIdx], function (e) {\n return e.id === candidate.endpoints[oIdx].id;\n });\n }\n }\n }\n\n for (i = 0; i < listToAddTo.length; i++) {\n candidate = listToAddTo[i][1];\n if (params.idx === 1 && listToAddTo[i][3] === otherElId && firstMatchingElIdx === -1) {\n firstMatchingElIdx = i;\n }\n _ju.addWithFunction(connsToPaint, candidate, function (c) {\n return c.id === candidate.id;\n });\n _ju.addWithFunction(endpointsToPaint, listToAddTo[i][1].endpoints[idx], function (e) {\n return e.id === candidate.endpoints[idx].id;\n });\n _ju.addWithFunction(endpointsToPaint, listToAddTo[i][1].endpoints[oIdx], function (e) {\n return e.id === candidate.endpoints[oIdx].id;\n });\n }\n if (exactIdx !== -1) {\n listToAddTo[exactIdx] = values;\n }\n else {\n var insertIdx = reverse ? firstMatchingElIdx !== -1 ? firstMatchingElIdx : 0 : listToAddTo.length; // of course we will get this from having looked through the array shortly.\n listToAddTo.splice(insertIdx, 0, values);\n }\n\n // store this for next time.\n endpoint._continuousAnchorEdge = edgeId;\n };\n\n //\n // find the entry in an endpoint's list for this connection and update its target endpoint\n // with the current target in the connection.\n // This method and sourceChanged need to be folder into one.\n //\n this.updateOtherEndpoint = function (sourceElId, oldTargetId, newTargetId, connection) {\n var sIndex = _ju.findWithFunction(connectionsByElementId[sourceElId], function (i) {\n return i[0].id === connection.id;\n }),\n tIndex = _ju.findWithFunction(connectionsByElementId[oldTargetId], function (i) {\n return i[0].id === connection.id;\n });\n\n // update or add data for source\n if (sIndex !== -1) {\n connectionsByElementId[sourceElId][sIndex][0] = connection;\n connectionsByElementId[sourceElId][sIndex][1] = connection.endpoints[1];\n connectionsByElementId[sourceElId][sIndex][2] = connection.endpoints[1].anchor.constructor === _jp.DynamicAnchor;\n }\n\n // remove entry for previous target (if there)\n if (tIndex > -1) {\n connectionsByElementId[oldTargetId].splice(tIndex, 1);\n // add entry for new target\n _ju.addToList(connectionsByElementId, newTargetId, [connection, connection.endpoints[0], connection.endpoints[0].anchor.constructor === _jp.DynamicAnchor]);\n }\n\n connection.updateConnectedClass();\n };\n\n //\n // notification that the connection given has changed source from the originalId to the newId.\n // This involves:\n // 1. removing the connection from the list of connections stored for the originalId\n // 2. updating the source information for the target of the connection\n // 3. re-registering the connection in connectionsByElementId with the newId\n //\n this.sourceChanged = function (originalId, newId, connection, newElement) {\n if (originalId !== newId) {\n\n connection.sourceId = newId;\n connection.source = newElement;\n\n // remove the entry that points from the old source to the target\n _ju.removeWithFunction(connectionsByElementId[originalId], function (info) {\n return info[0].id === connection.id;\n });\n // find entry for target and update it\n var tIdx = _ju.findWithFunction(connectionsByElementId[connection.targetId], function (i) {\n return i[0].id === connection.id;\n });\n if (tIdx > -1) {\n connectionsByElementId[connection.targetId][tIdx][0] = connection;\n connectionsByElementId[connection.targetId][tIdx][1] = connection.endpoints[0];\n connectionsByElementId[connection.targetId][tIdx][2] = connection.endpoints[0].anchor.constructor === _jp.DynamicAnchor;\n }\n // add entry for new source\n _ju.addToList(connectionsByElementId, newId, [connection, connection.endpoints[1], connection.endpoints[1].anchor.constructor === _jp.DynamicAnchor]);\n\n // TODO SP not final on this yet. when a user drags an existing connection and it turns into a self\n // loop, then this code hides the target endpoint (by removing it from the DOM) But I think this should\n // occur only if the anchor is Continuous\n if (connection.endpoints[1].anchor.isContinuous) {\n if (connection.source === connection.target) {\n connection._jsPlumb.instance.removeElement(connection.endpoints[1].canvas);\n }\n else {\n if (connection.endpoints[1].canvas.parentNode == null) {\n connection._jsPlumb.instance.appendElement(connection.endpoints[1].canvas);\n }\n }\n }\n\n connection.updateConnectedClass();\n }\n };\n\n //\n // moves the given endpoint from `currentId` to `element`.\n // This involves:\n //\n // 1. changing the key in _amEndpoints under which the endpoint is stored\n // 2. changing the source or target values in all of the endpoint's connections\n // 3. changing the array in connectionsByElementId in which the endpoint's connections\n // are stored (done by either sourceChanged or updateOtherEndpoint)\n //\n this.rehomeEndpoint = function (ep, currentId, element) {\n var eps = _amEndpoints[currentId] || [],\n elementId = jsPlumbInstance.getId(element);\n\n if (elementId !== currentId) {\n var idx = eps.indexOf(ep);\n if (idx > -1) {\n var _ep = eps.splice(idx, 1)[0];\n self.add(_ep, elementId);\n }\n }\n\n for (var i = 0; i < ep.connections.length; i++) {\n if (ep.connections[i].sourceId === currentId) {\n self.sourceChanged(currentId, ep.elementId, ep.connections[i], ep.element);\n }\n else if (ep.connections[i].targetId === currentId) {\n ep.connections[i].targetId = ep.elementId;\n ep.connections[i].target = ep.element;\n self.updateOtherEndpoint(ep.connections[i].sourceId, currentId, ep.elementId, ep.connections[i]);\n }\n }\n };\n\n this.redraw = function (elementId, ui, timestamp, offsetToUI, clearEdits, doNotRecalcEndpoint) {\n\n if (!jsPlumbInstance.isSuspendDrawing()) {\n // get all the endpoints for this element\n var ep = _amEndpoints[elementId] || [],\n endpointConnections = connectionsByElementId[elementId] || [],\n connectionsToPaint = [],\n endpointsToPaint = [],\n anchorsToUpdate = [];\n\n timestamp = timestamp || jsPlumbInstance.timestamp();\n // offsetToUI are values that would have been calculated in the dragManager when registering\n // an endpoint for an element that had a parent (somewhere in the hierarchy) that had been\n // registered as draggable.\n offsetToUI = offsetToUI || {left: 0, top: 0};\n if (ui) {\n ui = {\n left: ui.left + offsetToUI.left,\n top: ui.top + offsetToUI.top\n };\n }\n\n // valid for one paint cycle.\n var myOffset = jsPlumbInstance.updateOffset({ elId: elementId, offset: ui, recalc: false, timestamp: timestamp }),\n orientationCache = {};\n\n // actually, first we should compute the orientation of this element to all other elements to which\n // this element is connected with a continuous anchor (whether both ends of the connection have\n // a continuous anchor or just one)\n\n for (var i = 0; i < endpointConnections.length; i++) {\n var conn = endpointConnections[i][0],\n sourceId = conn.sourceId,\n targetId = conn.targetId,\n sourceContinuous = conn.endpoints[0].anchor.isContinuous,\n targetContinuous = conn.endpoints[1].anchor.isContinuous;\n\n if (sourceContinuous || targetContinuous) {\n var oKey = sourceId + \"_\" + targetId,\n o = orientationCache[oKey],\n oIdx = conn.sourceId === elementId ? 1 : 0;\n\n if (sourceContinuous && !anchorLists[sourceId]) {\n anchorLists[sourceId] = { top: [], right: [], bottom: [], left: [] };\n }\n if (targetContinuous && !anchorLists[targetId]) {\n anchorLists[targetId] = { top: [], right: [], bottom: [], left: [] };\n }\n\n if (elementId !== targetId) {\n jsPlumbInstance.updateOffset({ elId: targetId, timestamp: timestamp });\n }\n if (elementId !== sourceId) {\n jsPlumbInstance.updateOffset({ elId: sourceId, timestamp: timestamp });\n }\n\n var td = jsPlumbInstance.getCachedData(targetId),\n sd = jsPlumbInstance.getCachedData(sourceId);\n\n if (targetId === sourceId && (sourceContinuous || targetContinuous)) {\n // here we may want to improve this by somehow determining the face we'd like\n // to put the connector on. ideally, when drawing, the face should be calculated\n // by determining which face is closest to the point at which the mouse button\n // was released. for now, we're putting it on the top face.\n _updateAnchorList( anchorLists[sourceId], -Math.PI / 2, 0, conn, false, targetId, 0, false, \"top\", sourceId, connectionsToPaint, endpointsToPaint);\n _updateAnchorList( anchorLists[targetId], -Math.PI / 2, 0, conn, false, sourceId, 1, false, \"top\", targetId, connectionsToPaint, endpointsToPaint);\n }\n else {\n if (!o) {\n o = calculateOrientation(sourceId, targetId, sd.o, td.o, conn.endpoints[0].anchor, conn.endpoints[1].anchor);\n orientationCache[oKey] = o;\n // this would be a performance enhancement, but the computed angles need to be clamped to\n //the (-PI/2 -> PI/2) range in order for the sorting to work properly.\n /* orientationCache[oKey2] = {\n orientation:o.orientation,\n a:[o.a[1], o.a[0]],\n theta:o.theta + Math.PI,\n theta2:o.theta2 + Math.PI\n };*/\n }\n if (sourceContinuous) {\n _updateAnchorList(anchorLists[sourceId], o.theta, 0, conn, false, targetId, 0, false, o.a[0], sourceId, connectionsToPaint, endpointsToPaint);\n }\n if (targetContinuous) {\n _updateAnchorList(anchorLists[targetId], o.theta2, -1, conn, true, sourceId, 1, true, o.a[1], targetId, connectionsToPaint, endpointsToPaint);\n }\n }\n\n if (sourceContinuous) {\n _ju.addWithFunction(anchorsToUpdate, sourceId, function (a) {\n return a === sourceId;\n });\n }\n if (targetContinuous) {\n _ju.addWithFunction(anchorsToUpdate, targetId, function (a) {\n return a === targetId;\n });\n }\n _ju.addWithFunction(connectionsToPaint, conn, function (c) {\n return c.id === conn.id;\n });\n if ((sourceContinuous && oIdx === 0) || (targetContinuous && oIdx === 1)) {\n _ju.addWithFunction(endpointsToPaint, conn.endpoints[oIdx], function (e) {\n return e.id === conn.endpoints[oIdx].id;\n });\n }\n }\n }\n\n // place Endpoints whose anchors are continuous but have no Connections\n for (i = 0; i < ep.length; i++) {\n if (ep[i].connections.length === 0 && ep[i].anchor.isContinuous) {\n if (!anchorLists[elementId]) {\n anchorLists[elementId] = { top: [], right: [], bottom: [], left: [] };\n }\n _updateAnchorList(anchorLists[elementId], -Math.PI / 2, 0, {endpoints: [ep[i], ep[i]], paint: function () {\n }}, false, elementId, 0, false, ep[i].anchor.getDefaultFace(), elementId, connectionsToPaint, endpointsToPaint);\n _ju.addWithFunction(anchorsToUpdate, elementId, function (a) {\n return a === elementId;\n });\n }\n }\n\n // now place all the continuous anchors we need to;\n for (i = 0; i < anchorsToUpdate.length; i++) {\n placeAnchors(anchorsToUpdate[i], anchorLists[anchorsToUpdate[i]]);\n }\n\n // now that continuous anchors have been placed, paint all the endpoints for this element\n // TODO performance: add the endpoint ids to a temp array, and then when iterating in the next\n // loop, check that we didn't just paint that endpoint. we can probably shave off a few more milliseconds this way.\n for (i = 0; i < ep.length; i++) {\n ep[i].paint({ timestamp: timestamp, offset: myOffset, dimensions: myOffset.s, recalc: doNotRecalcEndpoint !== true });\n }\n\n // ... and any other endpoints we came across as a result of the continuous anchors.\n for (i = 0; i < endpointsToPaint.length; i++) {\n var cd = jsPlumbInstance.getCachedData(endpointsToPaint[i].elementId);\n endpointsToPaint[i].paint({ timestamp: timestamp, offset: cd, dimensions: cd.s });\n }\n\n // paint all the standard and \"dynamic connections\", which are connections whose other anchor is\n // static and therefore does need to be recomputed; we make sure that happens only one time.\n\n // TODO we could have compiled a list of these in the first pass through connections; might save some time.\n for (i = 0; i < endpointConnections.length; i++) {\n var otherEndpoint = endpointConnections[i][1];\n if (otherEndpoint.anchor.constructor === _jp.DynamicAnchor) {\n otherEndpoint.paint({ elementWithPrecedence: elementId, timestamp: timestamp });\n _ju.addWithFunction(connectionsToPaint, endpointConnections[i][0], function (c) {\n return c.id === endpointConnections[i][0].id;\n });\n // all the connections for the other endpoint now need to be repainted\n for (var k = 0; k < otherEndpoint.connections.length; k++) {\n if (otherEndpoint.connections[k] !== endpointConnections[i][0]) {\n _ju.addWithFunction(connectionsToPaint, otherEndpoint.connections[k], function (c) {\n return c.id === otherEndpoint.connections[k].id;\n });\n }\n }\n } else {\n _ju.addWithFunction(connectionsToPaint, endpointConnections[i][0], function (c) {\n return c.id === endpointConnections[i][0].id;\n });\n }\n }\n\n // paint current floating connection for this element, if there is one.\n var fc = floatingConnections[elementId];\n if (fc) {\n fc.paint({timestamp: timestamp, recalc: false, elId: elementId});\n }\n\n // paint all the connections\n for (i = 0; i < connectionsToPaint.length; i++) {\n connectionsToPaint[i].paint({elId: elementId, timestamp: timestamp, recalc: false, clearEdits: clearEdits});\n }\n }\n };\n\n var ContinuousAnchor = function (anchorParams) {\n _ju.EventGenerator.apply(this);\n this.type = \"Continuous\";\n this.isDynamic = true;\n this.isContinuous = true;\n var faces = anchorParams.faces || [\"top\", \"right\", \"bottom\", \"left\"],\n clockwise = !(anchorParams.clockwise === false),\n availableFaces = { },\n opposites = { \"top\": \"bottom\", \"right\": \"left\", \"left\": \"right\", \"bottom\": \"top\" },\n clockwiseOptions = { \"top\": \"right\", \"right\": \"bottom\", \"left\": \"top\", \"bottom\": \"left\" },\n antiClockwiseOptions = { \"top\": \"left\", \"right\": \"top\", \"left\": \"bottom\", \"bottom\": \"right\" },\n secondBest = clockwise ? clockwiseOptions : antiClockwiseOptions,\n lastChoice = clockwise ? antiClockwiseOptions : clockwiseOptions,\n cssClass = anchorParams.cssClass || \"\",\n _currentFace = null, _lockedFace = null, X_AXIS_FACES = [\"left\", \"right\"], Y_AXIS_FACES = [\"top\", \"bottom\"],\n _lockedAxis = null;\n\n for (var i = 0; i < faces.length; i++) {\n availableFaces[faces[i]] = true;\n }\n\n this.getDefaultFace = function () {\n return faces.length === 0 ? \"top\" : faces[0];\n };\n\n // if the given edge is supported, returns it. otherwise looks for a substitute that _is_\n // supported. if none supported we also return the request edge.\n this.verifyEdge = function (edge) {\n if (availableFaces[edge]) {\n return edge;\n }\n else if (availableFaces[opposites[edge]]) {\n return opposites[edge];\n }\n else if (availableFaces[secondBest[edge]]) {\n return secondBest[edge];\n }\n else if (availableFaces[lastChoice[edge]]) {\n return lastChoice[edge];\n }\n return edge; // we have to give them something.\n };\n\n this.isEdgeSupported = function (edge) {\n return _lockedAxis == null ?\n\n (_lockedFace == null ? availableFaces[edge] === true : _lockedFace === edge)\n\n : _lockedAxis.indexOf(edge) !== -1;\n };\n\n this.setCurrentFace = function(face) {\n _currentFace = face;\n };\n\n this.getCurrentFace = function() { return _currentFace; };\n\n this.lockCurrentFace = function() {\n _lockedFace = _currentFace;\n };\n\n this.unlockCurrentFace = function() { _lockedFace = null; };\n\n this.lockCurrentAxis = function() {\n if (_currentFace != null) {\n _lockedAxis = (_currentFace === \"left\" || _currentFace === \"right\") ? X_AXIS_FACES : Y_AXIS_FACES;\n }\n };\n\n this.unlockCurrentAxis = function() {\n _lockedAxis = null;\n };\n\n this.compute = function (params) {\n return userDefinedContinuousAnchorLocations[params.element.id] || continuousAnchorLocations[params.element.id] || [0, 0];\n };\n this.getCurrentLocation = function (params) {\n return userDefinedContinuousAnchorLocations[params.element.id] || continuousAnchorLocations[params.element.id] || [0, 0];\n };\n this.getOrientation = function (endpoint) {\n return continuousAnchorOrientations[endpoint.id] || [0, 0];\n };\n this.clearUserDefinedLocation = function () {\n delete userDefinedContinuousAnchorLocations[anchorParams.elementId];\n };\n this.setUserDefinedLocation = function (loc) {\n userDefinedContinuousAnchorLocations[anchorParams.elementId] = loc;\n };\n this.getCssClass = function () {\n return cssClass;\n };\n };\n\n // continuous anchors\n jsPlumbInstance.continuousAnchorFactory = {\n get: function (params) {\n return new ContinuousAnchor(params);\n },\n clear: function (elementId) {\n delete userDefinedContinuousAnchorLocations[elementId];\n delete continuousAnchorLocations[elementId];\n }\n };\n };\n\n /**\n * Anchors model a position on some element at which an Endpoint may be located. They began as a first class citizen of jsPlumb, ie. a user\n * was required to create these themselves, but over time this has been replaced by the concept of referring to them either by name (eg. \"TopMiddle\"),\n * or by an array describing their coordinates (eg. [ 0, 0.5, 0, -1 ], which is the same as \"TopMiddle\"). jsPlumb now handles all of the\n * creation of Anchors without user intervention.\n */\n _jp.Anchor = function (params) {\n this.x = params.x || 0;\n this.y = params.y || 0;\n this.elementId = params.elementId;\n this.cssClass = params.cssClass || \"\";\n this.userDefinedLocation = null;\n this.orientation = params.orientation || [ 0, 0 ];\n this.lastReturnValue = null;\n this.offsets = params.offsets || [ 0, 0 ];\n this.timestamp = null;\n\n _ju.EventGenerator.apply(this);\n\n this.compute = function (params) {\n\n var xy = params.xy, wh = params.wh, timestamp = params.timestamp;\n\n if (params.clearUserDefinedLocation) {\n this.userDefinedLocation = null;\n }\n\n if (timestamp && timestamp === this.timestamp) {\n return this.lastReturnValue;\n }\n\n if (this.userDefinedLocation != null) {\n this.lastReturnValue = this.userDefinedLocation;\n }\n else {\n this.lastReturnValue = [ xy[0] + (this.x * wh[0]) + this.offsets[0], xy[1] + (this.y * wh[1]) + this.offsets[1] ];\n }\n\n this.timestamp = timestamp;\n return this.lastReturnValue;\n };\n\n this.getCurrentLocation = function (params) {\n params = params || {};\n return (this.lastReturnValue == null || (params.timestamp != null && this.timestamp !== params.timestamp)) ? this.compute(params) : this.lastReturnValue;\n };\n };\n _ju.extend(_jp.Anchor, _ju.EventGenerator, {\n equals: function (anchor) {\n if (!anchor) {\n return false;\n }\n var ao = anchor.getOrientation(),\n o = this.getOrientation();\n return this.x === anchor.x && this.y === anchor.y && this.offsets[0] === anchor.offsets[0] && this.offsets[1] === anchor.offsets[1] && o[0] === ao[0] && o[1] === ao[1];\n },\n getUserDefinedLocation: function () {\n return this.userDefinedLocation;\n },\n setUserDefinedLocation: function (l) {\n this.userDefinedLocation = l;\n },\n clearUserDefinedLocation: function () {\n this.userDefinedLocation = null;\n },\n getOrientation: function () {\n return this.orientation;\n },\n getCssClass: function () {\n return this.cssClass;\n }\n });\n\n /**\n * An Anchor that floats. its orientation is computed dynamically from\n * its position relative to the anchor it is floating relative to. It is used when creating\n * a connection through drag and drop.\n *\n * TODO FloatingAnchor could totally be refactored to extend Anchor just slightly.\n */\n _jp.FloatingAnchor = function (params) {\n\n _jp.Anchor.apply(this, arguments);\n\n // this is the anchor that this floating anchor is referenced to for\n // purposes of calculating the orientation.\n var ref = params.reference,\n // the canvas this refers to.\n refCanvas = params.referenceCanvas,\n size = _jp.getSize(refCanvas),\n // these are used to store the current relative position of our\n // anchor wrt the reference anchor. they only indicate\n // direction, so have a value of 1 or -1 (or, very rarely, 0). these\n // values are written by the compute method, and read\n // by the getOrientation method.\n xDir = 0, yDir = 0,\n // temporary member used to store an orientation when the floating\n // anchor is hovering over another anchor.\n orientation = null,\n _lastResult = null;\n\n // clear from parent. we want floating anchor orientation to always be computed.\n this.orientation = null;\n\n // set these to 0 each; they are used by certain types of connectors in the loopback case,\n // when the connector is trying to clear the element it is on. but for floating anchor it's not\n // very important.\n this.x = 0;\n this.y = 0;\n\n this.isFloating = true;\n\n this.compute = function (params) {\n var xy = params.xy,\n result = [ xy[0] + (size[0] / 2), xy[1] + (size[1] / 2) ]; // return origin of the element. we may wish to improve this so that any object can be the drag proxy.\n _lastResult = result;\n return result;\n };\n\n this.getOrientation = function (_endpoint) {\n if (orientation) {\n return orientation;\n }\n else {\n var o = ref.getOrientation(_endpoint);\n // here we take into account the orientation of the other\n // anchor: if it declares zero for some direction, we declare zero too. this might not be the most awesome. perhaps we can come\n // up with a better way. it's just so that the line we draw looks like it makes sense. maybe this wont make sense.\n return [ Math.abs(o[0]) * xDir * -1,\n Math.abs(o[1]) * yDir * -1 ];\n }\n };\n\n /**\n * notification the endpoint associated with this anchor is hovering\n * over another anchor; we want to assume that anchor's orientation\n * for the duration of the hover.\n */\n this.over = function (anchor, endpoint) {\n orientation = anchor.getOrientation(endpoint);\n };\n\n /**\n * notification the endpoint associated with this anchor is no\n * longer hovering over another anchor; we should resume calculating\n * orientation as we normally do.\n */\n this.out = function () {\n orientation = null;\n };\n\n this.getCurrentLocation = function (params) {\n return _lastResult == null ? this.compute(params) : _lastResult;\n };\n };\n _ju.extend(_jp.FloatingAnchor, _jp.Anchor);\n\n var _convertAnchor = function (anchor, jsPlumbInstance, elementId) {\n return anchor.constructor === _jp.Anchor ? anchor : jsPlumbInstance.makeAnchor(anchor, elementId, jsPlumbInstance);\n };\n\n /* \n * A DynamicAnchor is an Anchor that contains a list of other Anchors, which it cycles\n * through at compute time to find the one that is located closest to\n * the center of the target element, and returns that Anchor's compute\n * method result. this causes endpoints to follow each other with\n * respect to the orientation of their target elements, which is a useful\n * feature for some applications.\n * \n */\n _jp.DynamicAnchor = function (params) {\n _jp.Anchor.apply(this, arguments);\n\n this.isDynamic = true;\n this.anchors = [];\n this.elementId = params.elementId;\n this.jsPlumbInstance = params.jsPlumbInstance;\n\n for (var i = 0; i < params.anchors.length; i++) {\n this.anchors[i] = _convertAnchor(params.anchors[i], this.jsPlumbInstance, this.elementId);\n }\n\n this.getAnchors = function () {\n return this.anchors;\n };\n this.locked = false;\n var _curAnchor = this.anchors.length > 0 ? this.anchors[0] : null,\n _lastAnchor = _curAnchor,\n self = this,\n\n // helper method to calculate the distance between the centers of the two elements.\n _distance = function (anchor, cx, cy, xy, wh) {\n var ax = xy[0] + (anchor.x * wh[0]), ay = xy[1] + (anchor.y * wh[1]),\n acx = xy[0] + (wh[0] / 2), acy = xy[1] + (wh[1] / 2);\n return (Math.sqrt(Math.pow(cx - ax, 2) + Math.pow(cy - ay, 2)) +\n Math.sqrt(Math.pow(acx - ax, 2) + Math.pow(acy - ay, 2)));\n },\n // default method uses distance between element centers. you can provide your own method in the dynamic anchor\n // constructor (and also to jsPlumb.makeDynamicAnchor). the arguments to it are four arrays:\n // xy - xy loc of the anchor's element\n // wh - anchor's element's dimensions\n // txy - xy loc of the element of the other anchor in the connection\n // twh - dimensions of the element of the other anchor in the connection.\n // anchors - the list of selectable anchors\n _anchorSelector = params.selector || function (xy, wh, txy, twh, anchors) {\n var cx = txy[0] + (twh[0] / 2), cy = txy[1] + (twh[1] / 2);\n var minIdx = -1, minDist = Infinity;\n for (var i = 0; i < anchors.length; i++) {\n var d = _distance(anchors[i], cx, cy, xy, wh);\n if (d < minDist) {\n minIdx = i + 0;\n minDist = d;\n }\n }\n return anchors[minIdx];\n };\n\n this.compute = function (params) {\n var xy = params.xy, wh = params.wh, txy = params.txy, twh = params.twh;\n\n this.timestamp = params.timestamp;\n\n var udl = self.getUserDefinedLocation();\n if (udl != null) {\n return udl;\n }\n\n // if anchor is locked or an opposite element was not given, we\n // maintain our state. anchor will be locked\n // if it is the source of a drag and drop.\n if (this.locked || txy == null || twh == null) {\n return _curAnchor.compute(params);\n }\n else {\n params.timestamp = null; // otherwise clear this, i think. we want the anchor to compute.\n }\n\n _curAnchor = _anchorSelector(xy, wh, txy, twh, this.anchors);\n this.x = _curAnchor.x;\n this.y = _curAnchor.y;\n\n if (_curAnchor !== _lastAnchor) {\n this.fire(\"anchorChanged\", _curAnchor);\n }\n\n _lastAnchor = _curAnchor;\n\n return _curAnchor.compute(params);\n };\n\n this.getCurrentLocation = function (params) {\n return this.getUserDefinedLocation() || (_curAnchor != null ? _curAnchor.getCurrentLocation(params) : null);\n };\n\n this.getOrientation = function (_endpoint) {\n return _curAnchor != null ? _curAnchor.getOrientation(_endpoint) : [ 0, 0 ];\n };\n this.over = function (anchor, endpoint) {\n if (_curAnchor != null) {\n _curAnchor.over(anchor, endpoint);\n }\n };\n this.out = function () {\n if (_curAnchor != null) {\n _curAnchor.out();\n }\n };\n\n this.getCssClass = function () {\n return (_curAnchor && _curAnchor.getCssClass()) || \"\";\n };\n };\n _ju.extend(_jp.DynamicAnchor, _jp.Anchor);\n\n// -------- basic anchors ------------------ \n var _curryAnchor = function (x, y, ox, oy, type, fnInit) {\n _jp.Anchors[type] = function (params) {\n var a = params.jsPlumbInstance.makeAnchor([ x, y, ox, oy, 0, 0 ], params.elementId, params.jsPlumbInstance);\n a.type = type;\n if (fnInit) {\n fnInit(a, params);\n }\n return a;\n };\n };\n\n _curryAnchor(0.5, 0, 0, -1, \"TopCenter\");\n _curryAnchor(0.5, 1, 0, 1, \"BottomCenter\");\n _curryAnchor(0, 0.5, -1, 0, \"LeftMiddle\");\n _curryAnchor(1, 0.5, 1, 0, \"RightMiddle\");\n\n _curryAnchor(0.5, 0, 0, -1, \"Top\");\n _curryAnchor(0.5, 1, 0, 1, \"Bottom\");\n _curryAnchor(0, 0.5, -1, 0, \"Left\");\n _curryAnchor(1, 0.5, 1, 0, \"Right\");\n _curryAnchor(0.5, 0.5, 0, 0, \"Center\");\n _curryAnchor(1, 0, 0, -1, \"TopRight\");\n _curryAnchor(1, 1, 0, 1, \"BottomRight\");\n _curryAnchor(0, 0, 0, -1, \"TopLeft\");\n _curryAnchor(0, 1, 0, 1, \"BottomLeft\");\n\n// ------- dynamic anchors ------------------- \n\n // default dynamic anchors chooses from Top, Right, Bottom, Left\n _jp.Defaults.DynamicAnchors = function (params) {\n return params.jsPlumbInstance.makeAnchors([\"TopCenter\", \"RightMiddle\", \"BottomCenter\", \"LeftMiddle\"], params.elementId, params.jsPlumbInstance);\n };\n\n // default dynamic anchors bound to name 'AutoDefault'\n _jp.Anchors.AutoDefault = function (params) {\n var a = params.jsPlumbInstance.makeDynamicAnchor(_jp.Defaults.DynamicAnchors(params));\n a.type = \"AutoDefault\";\n return a;\n };\n\n// ------- continuous anchors ------------------- \n\n var _curryContinuousAnchor = function (type, faces) {\n _jp.Anchors[type] = function (params) {\n var a = params.jsPlumbInstance.makeAnchor([\"Continuous\", { faces: faces }], params.elementId, params.jsPlumbInstance);\n a.type = type;\n return a;\n };\n };\n\n _jp.Anchors.Continuous = function (params) {\n return params.jsPlumbInstance.continuousAnchorFactory.get(params);\n };\n\n _curryContinuousAnchor(\"ContinuousLeft\", [\"left\"]);\n _curryContinuousAnchor(\"ContinuousTop\", [\"top\"]);\n _curryContinuousAnchor(\"ContinuousBottom\", [\"bottom\"]);\n _curryContinuousAnchor(\"ContinuousRight\", [\"right\"]);\n\n// ------- position assign anchors ------------------- \n\n // this anchor type lets you assign the position at connection time.\n _curryAnchor(0, 0, 0, 0, \"Assign\", function (anchor, params) {\n // find what to use as the \"position finder\". the user may have supplied a String which represents\n // the id of a position finder in jsPlumb.AnchorPositionFinders, or the user may have supplied the\n // position finder as a function. we find out what to use and then set it on the anchor.\n var pf = params.position || \"Fixed\";\n anchor.positionFinder = pf.constructor === String ? params.jsPlumbInstance.AnchorPositionFinders[pf] : pf;\n // always set the constructor params; the position finder might need them later (the Grid one does,\n // for example)\n anchor.constructorParams = params;\n });\n\n // these are the default anchor positions finders, which are used by the makeTarget function. supplying\n // a position finder argument to that function allows you to specify where the resulting anchor will\n // be located\n root.jsPlumbInstance.prototype.AnchorPositionFinders = {\n \"Fixed\": function (dp, ep, es) {\n return [ (dp.left - ep.left) / es[0], (dp.top - ep.top) / es[1] ];\n },\n \"Grid\": function (dp, ep, es, params) {\n var dx = dp.left - ep.left, dy = dp.top - ep.top,\n gx = es[0] / (params.grid[0]), gy = es[1] / (params.grid[1]),\n mx = Math.floor(dx / gx), my = Math.floor(dy / gy);\n return [ ((mx * gx) + (gx / 2)) / es[0], ((my * gy) + (gy / 2)) / es[1] ];\n }\n };\n\n// ------- perimeter anchors ------------------- \n\n _jp.Anchors.Perimeter = function (params) {\n params = params || {};\n var anchorCount = params.anchorCount || 60,\n shape = params.shape;\n\n if (!shape) {\n throw new Error(\"no shape supplied to Perimeter Anchor type\");\n }\n\n var _circle = function () {\n var r = 0.5, step = Math.PI * 2 / anchorCount, current = 0, a = [];\n for (var i = 0; i < anchorCount; i++) {\n var x = r + (r * Math.sin(current)),\n y = r + (r * Math.cos(current));\n a.push([ x, y, 0, 0 ]);\n current += step;\n }\n return a;\n },\n _path = function (segments) {\n var anchorsPerFace = anchorCount / segments.length, a = [],\n _computeFace = function (x1, y1, x2, y2, fractionalLength) {\n anchorsPerFace = anchorCount * fractionalLength;\n var dx = (x2 - x1) / anchorsPerFace, dy = (y2 - y1) / anchorsPerFace;\n for (var i = 0; i < anchorsPerFace; i++) {\n a.push([\n x1 + (dx * i),\n y1 + (dy * i),\n 0,\n 0\n ]);\n }\n };\n\n for (var i = 0; i < segments.length; i++) {\n _computeFace.apply(null, segments[i]);\n }\n\n return a;\n },\n _shape = function (faces) {\n var s = [];\n for (var i = 0; i < faces.length; i++) {\n s.push([faces[i][0], faces[i][1], faces[i][2], faces[i][3], 1 / faces.length]);\n }\n return _path(s);\n },\n _rectangle = function () {\n return _shape([\n [ 0, 0, 1, 0 ],\n [ 1, 0, 1, 1 ],\n [ 1, 1, 0, 1 ],\n [ 0, 1, 0, 0 ]\n ]);\n };\n\n var _shapes = {\n \"Circle\": _circle,\n \"Ellipse\": _circle,\n \"Diamond\": function () {\n return _shape([\n [ 0.5, 0, 1, 0.5 ],\n [ 1, 0.5, 0.5, 1 ],\n [ 0.5, 1, 0, 0.5 ],\n [ 0, 0.5, 0.5, 0 ]\n ]);\n },\n \"Rectangle\": _rectangle,\n \"Square\": _rectangle,\n \"Triangle\": function () {\n return _shape([\n [ 0.5, 0, 1, 1 ],\n [ 1, 1, 0, 1 ],\n [ 0, 1, 0.5, 0]\n ]);\n },\n \"Path\": function (params) {\n var points = params.points, p = [], tl = 0;\n for (var i = 0; i < points.length - 1; i++) {\n var l = Math.sqrt(Math.pow(points[i][2] - points[i][0]) + Math.pow(points[i][3] - points[i][1]));\n tl += l;\n p.push([points[i][0], points[i][1], points[i + 1][0], points[i + 1][1], l]);\n }\n for (var j = 0; j < p.length; j++) {\n p[j][4] = p[j][4] / tl;\n }\n return _path(p);\n }\n },\n _rotate = function (points, amountInDegrees) {\n var o = [], theta = amountInDegrees / 180 * Math.PI;\n for (var i = 0; i < points.length; i++) {\n var _x = points[i][0] - 0.5,\n _y = points[i][1] - 0.5;\n\n o.push([\n 0.5 + ((_x * Math.cos(theta)) - (_y * Math.sin(theta))),\n 0.5 + ((_x * Math.sin(theta)) + (_y * Math.cos(theta))),\n points[i][2],\n points[i][3]\n ]);\n }\n return o;\n };\n\n if (!_shapes[shape]) {\n throw new Error(\"Shape [\" + shape + \"] is unknown by Perimeter Anchor type\");\n }\n\n var da = _shapes[shape](params);\n if (params.rotation) {\n da = _rotate(da, params.rotation);\n }\n var a = params.jsPlumbInstance.makeDynamicAnchor(da);\n a.type = \"Perimeter\";\n return a;\n };\n}).call(typeof window !== 'undefined' ? window : this);\n/*\n * This file contains the default Connectors, Endpoint and Overlay definitions.\n *\n * Copyright (c) 2010 - 2018 jsPlumb (hello@jsplumbtoolkit.com)\n * \n * https://jsplumbtoolkit.com\n * https://github.com/jsplumb/jsplumb\n * \n * Dual licensed under the MIT and GPL2 licenses.\n */\n;\n(function () {\n\n \"use strict\";\n var root = this, _jp = root.jsPlumb, _ju = root.jsPlumbUtil, _jg = root.Biltong;\n\n _jp.Segments = {\n\n /*\n * Class: AbstractSegment\n * A Connector is made up of 1..N Segments, each of which has a Type, such as 'Straight', 'Arc',\n * 'Bezier'. This is new from 1.4.2, and gives us a lot more flexibility when drawing connections: things such\n * as rounded corners for flowchart connectors, for example, or a straight line stub for Bezier connections, are\n * much easier to do now.\n *\n * A Segment is responsible for providing coordinates for painting it, and also must be able to report its length.\n * \n */\n AbstractSegment: function (params) {\n this.params = params;\n\n /**\n * Function: findClosestPointOnPath\n * Finds the closest point on this segment to the given [x, y],\n * returning both the x and y of the point plus its distance from\n * the supplied point, and its location along the length of the\n * path inscribed by the segment. This implementation returns\n * Infinity for distance and null values for everything else;\n * subclasses are expected to override.\n */\n this.findClosestPointOnPath = function (x, y) {\n return {\n d: Infinity,\n x: null,\n y: null,\n l: null\n };\n };\n\n this.getBounds = function () {\n return {\n minX: Math.min(params.x1, params.x2),\n minY: Math.min(params.y1, params.y2),\n maxX: Math.max(params.x1, params.x2),\n maxY: Math.max(params.y1, params.y2)\n };\n };\n },\n Straight: function (params) {\n var _super = _jp.Segments.AbstractSegment.apply(this, arguments),\n length, m, m2, x1, x2, y1, y2,\n _recalc = function () {\n length = Math.sqrt(Math.pow(x2 - x1, 2) + Math.pow(y2 - y1, 2));\n m = _jg.gradient({x: x1, y: y1}, {x: x2, y: y2});\n m2 = -1 / m;\n };\n\n this.type = \"Straight\";\n\n this.getLength = function () {\n return length;\n };\n this.getGradient = function () {\n return m;\n };\n\n this.getCoordinates = function () {\n return { x1: x1, y1: y1, x2: x2, y2: y2 };\n };\n this.setCoordinates = function (coords) {\n x1 = coords.x1;\n y1 = coords.y1;\n x2 = coords.x2;\n y2 = coords.y2;\n _recalc();\n };\n this.setCoordinates({x1: params.x1, y1: params.y1, x2: params.x2, y2: params.y2});\n\n this.getBounds = function () {\n return {\n minX: Math.min(x1, x2),\n minY: Math.min(y1, y2),\n maxX: Math.max(x1, x2),\n maxY: Math.max(y1, y2)\n };\n };\n\n /**\n * returns the point on the segment's path that is 'location' along the length of the path, where 'location' is a decimal from\n * 0 to 1 inclusive. for the straight line segment this is simple maths.\n */\n this.pointOnPath = function (location, absolute) {\n if (location === 0 && !absolute) {\n return { x: x1, y: y1 };\n }\n else if (location === 1 && !absolute) {\n return { x: x2, y: y2 };\n }\n else {\n var l = absolute ? location > 0 ? location : length + location : location * length;\n return _jg.pointOnLine({x: x1, y: y1}, {x: x2, y: y2}, l);\n }\n };\n\n /**\n * returns the gradient of the segment at the given point - which for us is constant.\n */\n this.gradientAtPoint = function (_) {\n return m;\n };\n\n /**\n * returns the point on the segment's path that is 'distance' along the length of the path from 'location', where\n * 'location' is a decimal from 0 to 1 inclusive, and 'distance' is a number of pixels.\n * this hands off to jsPlumbUtil to do the maths, supplying two points and the distance.\n */\n this.pointAlongPathFrom = function (location, distance, absolute) {\n var p = this.pointOnPath(location, absolute),\n farAwayPoint = distance <= 0 ? {x: x1, y: y1} : {x: x2, y: y2 };\n\n /*\n location == 1 ? {\n x:x1 + ((x2 - x1) * 10),\n y:y1 + ((y1 - y2) * 10)\n } :\n */\n\n if (distance <= 0 && Math.abs(distance) > 1) {\n distance *= -1;\n }\n\n return _jg.pointOnLine(p, farAwayPoint, distance);\n };\n\n // is c between a and b?\n var within = function (a, b, c) {\n return c >= Math.min(a, b) && c <= Math.max(a, b);\n };\n // find which of a and b is closest to c\n var closest = function (a, b, c) {\n return Math.abs(c - a) < Math.abs(c - b) ? a : b;\n };\n\n /**\n Function: findClosestPointOnPath\n Finds the closest point on this segment to [x,y]. See\n notes on this method in AbstractSegment.\n */\n this.findClosestPointOnPath = function (x, y) {\n var out = {\n d: Infinity,\n x: null,\n y: null,\n l: null,\n x1: x1,\n x2: x2,\n y1: y1,\n y2: y2\n };\n\n if (m === 0) {\n out.y = y1;\n out.x = within(x1, x2, x) ? x : closest(x1, x2, x);\n }\n else if (m === Infinity || m === -Infinity) {\n out.x = x1;\n out.y = within(y1, y2, y) ? y : closest(y1, y2, y);\n }\n else {\n // closest point lies on normal from given point to this line. \n var b = y1 - (m * x1),\n b2 = y - (m2 * x),\n // y1 = m.x1 + b and y1 = m2.x1 + b2\n // so m.x1 + b = m2.x1 + b2\n // x1(m - m2) = b2 - b\n // x1 = (b2 - b) / (m - m2)\n _x1 = (b2 - b) / (m - m2),\n _y1 = (m * _x1) + b;\n\n out.x = within(x1, x2, _x1) ? _x1 : closest(x1, x2, _x1);//_x1;\n out.y = within(y1, y2, _y1) ? _y1 : closest(y1, y2, _y1);//_y1;\n }\n\n var fractionInSegment = _jg.lineLength([ out.x, out.y ], [ x1, y1 ]);\n out.d = _jg.lineLength([x, y], [out.x, out.y]);\n out.l = fractionInSegment / length;\n return out;\n };\n },\n\n /*\n Arc Segment. You need to supply:\n\n r - radius\n cx - center x for the arc\n cy - center y for the arc\n ac - whether the arc is anticlockwise or not. default is clockwise.\n\n and then either:\n\n startAngle - startAngle for the arc.\n endAngle - endAngle for the arc.\n\n or:\n\n x1 - x for start point\n y1 - y for start point\n x2 - x for end point\n y2 - y for end point\n\n */\n Arc: function (params) {\n var _super = _jp.Segments.AbstractSegment.apply(this, arguments),\n _calcAngle = function (_x, _y) {\n return _jg.theta([params.cx, params.cy], [_x, _y]);\n },\n _calcAngleForLocation = function (segment, location) {\n if (segment.anticlockwise) {\n var sa = segment.startAngle < segment.endAngle ? segment.startAngle + TWO_PI : segment.startAngle,\n s = Math.abs(sa - segment.endAngle);\n return sa - (s * location);\n }\n else {\n var ea = segment.endAngle < segment.startAngle ? segment.endAngle + TWO_PI : segment.endAngle,\n ss = Math.abs(ea - segment.startAngle);\n\n return segment.startAngle + (ss * location);\n }\n },\n TWO_PI = 2 * Math.PI;\n\n this.radius = params.r;\n this.anticlockwise = params.ac;\n this.type = \"Arc\";\n\n if (params.startAngle && params.endAngle) {\n this.startAngle = params.startAngle;\n this.endAngle = params.endAngle;\n this.x1 = params.cx + (this.radius * Math.cos(params.startAngle));\n this.y1 = params.cy + (this.radius * Math.sin(params.startAngle));\n this.x2 = params.cx + (this.radius * Math.cos(params.endAngle));\n this.y2 = params.cy + (this.radius * Math.sin(params.endAngle));\n }\n else {\n this.startAngle = _calcAngle(params.x1, params.y1);\n this.endAngle = _calcAngle(params.x2, params.y2);\n this.x1 = params.x1;\n this.y1 = params.y1;\n this.x2 = params.x2;\n this.y2 = params.y2;\n }\n\n if (this.endAngle < 0) {\n this.endAngle += TWO_PI;\n }\n if (this.startAngle < 0) {\n this.startAngle += TWO_PI;\n }\n\n // segment is used by vml \n //this.segment = _jg.quadrant([this.x1, this.y1], [this.x2, this.y2]);\n\n // we now have startAngle and endAngle as positive numbers, meaning the\n // absolute difference (|d|) between them is the sweep (s) of this arc, unless the\n // arc is 'anticlockwise' in which case 's' is given by 2PI - |d|.\n\n var ea = this.endAngle < this.startAngle ? this.endAngle + TWO_PI : this.endAngle;\n this.sweep = Math.abs(ea - this.startAngle);\n if (this.anticlockwise) {\n this.sweep = TWO_PI - this.sweep;\n }\n var circumference = 2 * Math.PI * this.radius,\n frac = this.sweep / TWO_PI,\n length = circumference * frac;\n\n this.getLength = function () {\n return length;\n };\n\n this.getBounds = function () {\n return {\n minX: params.cx - params.r,\n maxX: params.cx + params.r,\n minY: params.cy - params.r,\n maxY: params.cy + params.r\n };\n };\n\n var VERY_SMALL_VALUE = 0.0000000001,\n gentleRound = function (n) {\n var f = Math.floor(n), r = Math.ceil(n);\n if (n - f < VERY_SMALL_VALUE) {\n return f;\n }\n else if (r - n < VERY_SMALL_VALUE) {\n return r;\n }\n return n;\n };\n\n /**\n * returns the point on the segment's path that is 'location' along the length of the path, where 'location' is a decimal from\n * 0 to 1 inclusive.\n */\n this.pointOnPath = function (location, absolute) {\n\n if (location === 0) {\n return { x: this.x1, y: this.y1, theta: this.startAngle };\n }\n else if (location === 1) {\n return { x: this.x2, y: this.y2, theta: this.endAngle };\n }\n\n if (absolute) {\n location = location / length;\n }\n\n var angle = _calcAngleForLocation(this, location),\n _x = params.cx + (params.r * Math.cos(angle)),\n _y = params.cy + (params.r * Math.sin(angle));\n\n return { x: gentleRound(_x), y: gentleRound(_y), theta: angle };\n };\n\n /**\n * returns the gradient of the segment at the given point.\n */\n this.gradientAtPoint = function (location, absolute) {\n var p = this.pointOnPath(location, absolute);\n var m = _jg.normal([ params.cx, params.cy ], [p.x, p.y ]);\n if (!this.anticlockwise && (m === Infinity || m === -Infinity)) {\n m *= -1;\n }\n return m;\n };\n\n this.pointAlongPathFrom = function (location, distance, absolute) {\n var p = this.pointOnPath(location, absolute),\n arcSpan = distance / circumference * 2 * Math.PI,\n dir = this.anticlockwise ? -1 : 1,\n startAngle = p.theta + (dir * arcSpan),\n startX = params.cx + (this.radius * Math.cos(startAngle)),\n startY = params.cy + (this.radius * Math.sin(startAngle));\n\n return {x: startX, y: startY};\n };\n },\n\n Bezier: function (params) {\n this.curve = [\n { x: params.x1, y: params.y1},\n { x: params.cp1x, y: params.cp1y },\n { x: params.cp2x, y: params.cp2y },\n { x: params.x2, y: params.y2 }\n ];\n\n var _super = _jp.Segments.AbstractSegment.apply(this, arguments);\n // although this is not a strictly rigorous determination of bounds\n // of a bezier curve, it works for the types of curves that this segment\n // type produces.\n this.bounds = {\n minX: Math.min(params.x1, params.x2, params.cp1x, params.cp2x),\n minY: Math.min(params.y1, params.y2, params.cp1y, params.cp2y),\n maxX: Math.max(params.x1, params.x2, params.cp1x, params.cp2x),\n maxY: Math.max(params.y1, params.y2, params.cp1y, params.cp2y)\n };\n\n this.type = \"Bezier\";\n\n var _translateLocation = function (_curve, location, absolute) {\n if (absolute) {\n location = root.jsBezier.locationAlongCurveFrom(_curve, location > 0 ? 0 : 1, location);\n }\n\n return location;\n };\n\n /**\n * returns the point on the segment's path that is 'location' along the length of the path, where 'location' is a decimal from\n * 0 to 1 inclusive.\n */\n this.pointOnPath = function (location, absolute) {\n location = _translateLocation(this.curve, location, absolute);\n return root.jsBezier.pointOnCurve(this.curve, location);\n };\n\n /**\n * returns the gradient of the segment at the given point.\n */\n this.gradientAtPoint = function (location, absolute) {\n location = _translateLocation(this.curve, location, absolute);\n return root.jsBezier.gradientAtPoint(this.curve, location);\n };\n\n this.pointAlongPathFrom = function (location, distance, absolute) {\n location = _translateLocation(this.curve, location, absolute);\n return root.jsBezier.pointAlongCurveFrom(this.curve, location, distance);\n };\n\n this.getLength = function () {\n return root.jsBezier.getLength(this.curve);\n };\n\n this.getBounds = function () {\n return this.bounds;\n };\n }\n };\n\n _jp.SegmentRenderer = {\n getPath: function (segment) {\n return ({\n \"Straight\": function () {\n var d = segment.getCoordinates();\n return \"M \" + d.x1 + \" \" + d.y1 + \" L \" + d.x2 + \" \" + d.y2;\n },\n \"Bezier\": function () {\n var d = segment.params;\n return \"M \" + d.x1 + \" \" + d.y1 +\n \" C \" + d.cp1x + \" \" + d.cp1y + \" \" + d.cp2x + \" \" + d.cp2y + \" \" + d.x2 + \" \" + d.y2;\n },\n \"Arc\": function () {\n var d = segment.params,\n laf = segment.sweep > Math.PI ? 1 : 0,\n sf = segment.anticlockwise ? 0 : 1;\n\n return \"M\" + segment.x1 + \" \" + segment.y1 + \" A \" + segment.radius + \" \" + d.r + \" 0 \" + laf + \",\" + sf + \" \" + segment.x2 + \" \" + segment.y2;\n }\n })[segment.type]();\n }\n };\n\n /*\n Class: UIComponent\n Superclass for Connector and AbstractEndpoint.\n */\n var AbstractComponent = function () {\n this.resetBounds = function () {\n this.bounds = { minX: Infinity, minY: Infinity, maxX: -Infinity, maxY: -Infinity };\n };\n this.resetBounds();\n };\n\n /*\n * Class: Connector\n * Superclass for all Connectors; here is where Segments are managed. This is exposed on jsPlumb just so it\n * can be accessed from other files. You should not try to instantiate one of these directly.\n *\n * When this class is asked for a pointOnPath, or gradient etc, it must first figure out which segment to dispatch\n * that request to. This is done by keeping track of the total connector length as segments are added, and also\n * their cumulative ratios to the total length. Then when the right segment is found it is a simple case of dispatching\n * the request to it (and adjusting 'location' so that it is relative to the beginning of that segment.)\n */\n _jp.Connectors.AbstractConnector = function (params) {\n\n AbstractComponent.apply(this, arguments);\n\n var segments = [],\n totalLength = 0,\n segmentProportions = [],\n segmentProportionalLengths = [],\n stub = params.stub || 0,\n sourceStub = _ju.isArray(stub) ? stub[0] : stub,\n targetStub = _ju.isArray(stub) ? stub[1] : stub,\n gap = params.gap || 0,\n sourceGap = _ju.isArray(gap) ? gap[0] : gap,\n targetGap = _ju.isArray(gap) ? gap[1] : gap,\n userProvidedSegments = null,\n edited = false,\n paintInfo = null,\n geometry = null,\n editable = params.editable !== false && _jp.ConnectorEditors != null && _jp.ConnectorEditors[this.type] != null;\n\n var _setGeometry = this.setGeometry = function(g, internallyComputed) {\n edited = (!internallyComputed);\n geometry = g;\n };\n var _getGeometry = this.getGeometry = function() {\n return geometry;\n };\n\n this.getPathData = function() {\n var p = \"\";\n for (var i = 0; i < segments.length; i++) {\n p += _jp.SegmentRenderer.getPath(segments[i]);\n p += \" \";\n }\n return p;\n };\n\n this.hasBeenEdited = function() { return edited; };\n this.isEditing = function() { return this.editor != null && this.editor.isActive(); };\n this.setEditable = function(e) {\n // if this connector has an editor already, or\n // if an editor for this connector's type is available, or\n // if the child declares an overrideSetEditable and it does not return false, editable is true.\n if (e && _jp.ConnectorEditors != null && _jp.ConnectorEditors[this.type] != null && (this.overrideSetEditable == null || this.overrideSetEditable())) {\n editable = e;\n } else {\n editable = false;\n }\n return editable;\n };\n this.isEditable = function() { return editable; };\n\n /**\n * Function: findSegmentForPoint\n * Returns the segment that is closest to the given [x,y],\n * null if nothing found. This function returns a JS\n * object with:\n *\n * d - distance from segment\n * l - proportional location in segment\n * x - x point on the segment\n * y - y point on the segment\n * s - the segment itself.\n */\n this.findSegmentForPoint = function (x, y) {\n var out = { d: Infinity, s: null, x: null, y: null, l: null };\n for (var i = 0; i < segments.length; i++) {\n var _s = segments[i].findClosestPointOnPath(x, y);\n if (_s.d < out.d) {\n out.d = _s.d;\n out.l = _s.l;\n out.x = _s.x;\n out.y = _s.y;\n out.s = segments[i];\n out.x1 = _s.x1;\n out.x2 = _s.x2;\n out.y1 = _s.y1;\n out.y2 = _s.y2;\n out.index = i;\n }\n }\n\n return out;\n };\n\n var _updateSegmentProportions = function () {\n var curLoc = 0;\n for (var i = 0; i < segments.length; i++) {\n var sl = segments[i].getLength();\n segmentProportionalLengths[i] = sl / totalLength;\n segmentProportions[i] = [curLoc, (curLoc += (sl / totalLength)) ];\n }\n },\n\n /**\n * returns [segment, proportion of travel in segment, segment index] for the segment\n * that contains the point which is 'location' distance along the entire path, where\n * 'location' is a decimal between 0 and 1 inclusive. in this connector type, paths\n * are made up of a list of segments, each of which contributes some fraction to\n * the total length.\n * From 1.3.10 this also supports the 'absolute' property, which lets us specify a location\n * as the absolute distance in pixels, rather than a proportion of the total path.\n */\n _findSegmentForLocation = function (location, absolute) {\n if (absolute) {\n location = location > 0 ? location / totalLength : (totalLength + location) / totalLength;\n }\n var idx = segmentProportions.length - 1, inSegmentProportion = 1;\n for (var i = 0; i < segmentProportions.length; i++) {\n if (segmentProportions[i][1] >= location) {\n idx = i;\n // todo is this correct for all connector path types?\n inSegmentProportion = location === 1 ? 1 : location === 0 ? 0 : (location - segmentProportions[i][0]) / segmentProportionalLengths[i];\n break;\n }\n }\n return { segment: segments[idx], proportion: inSegmentProportion, index: idx };\n },\n _addSegment = function (conn, type, params) {\n if (params.x1 === params.x2 && params.y1 === params.y2) {\n return;\n }\n var s = new _jp.Segments[type](params);\n segments.push(s);\n totalLength += s.getLength();\n conn.updateBounds(s);\n },\n _clearSegments = function () {\n totalLength = segments.length = segmentProportions.length = segmentProportionalLengths.length = 0;\n };\n\n this.setSegments = function (_segs) {\n userProvidedSegments = [];\n totalLength = 0;\n for (var i = 0; i < _segs.length; i++) {\n userProvidedSegments.push(_segs[i]);\n totalLength += _segs[i].getLength();\n }\n };\n\n this.getLength = function() {\n return totalLength;\n };\n\n var _prepareCompute = function (params) {\n this.strokeWidth = params.strokeWidth;\n var segment = _jg.quadrant(params.sourcePos, params.targetPos),\n swapX = params.targetPos[0] < params.sourcePos[0],\n swapY = params.targetPos[1] < params.sourcePos[1],\n lw = params.strokeWidth || 1,\n so = params.sourceEndpoint.anchor.getOrientation(params.sourceEndpoint),\n to = params.targetEndpoint.anchor.getOrientation(params.targetEndpoint),\n x = swapX ? params.targetPos[0] : params.sourcePos[0],\n y = swapY ? params.targetPos[1] : params.sourcePos[1],\n w = Math.abs(params.targetPos[0] - params.sourcePos[0]),\n h = Math.abs(params.targetPos[1] - params.sourcePos[1]);\n\n // if either anchor does not have an orientation set, we derive one from their relative\n // positions. we fix the axis to be the one in which the two elements are further apart, and\n // point each anchor at the other element. this is also used when dragging a new connection.\n if (so[0] === 0 && so[1] === 0 || to[0] === 0 && to[1] === 0) {\n var index = w > h ? 0 : 1, oIndex = [1, 0][index];\n so = [];\n to = [];\n so[index] = params.sourcePos[index] > params.targetPos[index] ? -1 : 1;\n to[index] = params.sourcePos[index] > params.targetPos[index] ? 1 : -1;\n so[oIndex] = 0;\n to[oIndex] = 0;\n }\n\n var sx = swapX ? w + (sourceGap * so[0]) : sourceGap * so[0],\n sy = swapY ? h + (sourceGap * so[1]) : sourceGap * so[1],\n tx = swapX ? targetGap * to[0] : w + (targetGap * to[0]),\n ty = swapY ? targetGap * to[1] : h + (targetGap * to[1]),\n oProduct = ((so[0] * to[0]) + (so[1] * to[1]));\n\n var result = {\n sx: sx, sy: sy, tx: tx, ty: ty, lw: lw,\n xSpan: Math.abs(tx - sx),\n ySpan: Math.abs(ty - sy),\n mx: (sx + tx) / 2,\n my: (sy + ty) / 2,\n so: so, to: to, x: x, y: y, w: w, h: h,\n segment: segment,\n startStubX: sx + (so[0] * sourceStub),\n startStubY: sy + (so[1] * sourceStub),\n endStubX: tx + (to[0] * targetStub),\n endStubY: ty + (to[1] * targetStub),\n isXGreaterThanStubTimes2: Math.abs(sx - tx) > (sourceStub + targetStub),\n isYGreaterThanStubTimes2: Math.abs(sy - ty) > (sourceStub + targetStub),\n opposite: oProduct === -1,\n perpendicular: oProduct === 0,\n orthogonal: oProduct === 1,\n sourceAxis: so[0] === 0 ? \"y\" : \"x\",\n points: [x, y, w, h, sx, sy, tx, ty ],\n stubs:[sourceStub, targetStub]\n };\n result.anchorOrientation = result.opposite ? \"opposite\" : result.orthogonal ? \"orthogonal\" : \"perpendicular\";\n return result;\n };\n\n this.getSegments = function () {\n return segments;\n };\n\n this.updateBounds = function (segment) {\n var segBounds = segment.getBounds();\n this.bounds.minX = Math.min(this.bounds.minX, segBounds.minX);\n this.bounds.maxX = Math.max(this.bounds.maxX, segBounds.maxX);\n this.bounds.minY = Math.min(this.bounds.minY, segBounds.minY);\n this.bounds.maxY = Math.max(this.bounds.maxY, segBounds.maxY);\n };\n\n var dumpSegmentsToConsole = function () {\n console.log(\"SEGMENTS:\");\n for (var i = 0; i < segments.length; i++) {\n console.log(segments[i].type, segments[i].getLength(), segmentProportions[i]);\n }\n };\n\n this.pointOnPath = function (location, absolute) {\n var seg = _findSegmentForLocation(location, absolute);\n return seg.segment && seg.segment.pointOnPath(seg.proportion, false) || [0, 0];\n };\n\n this.gradientAtPoint = function (location, absolute) {\n var seg = _findSegmentForLocation(location, absolute);\n return seg.segment && seg.segment.gradientAtPoint(seg.proportion, false) || 0;\n };\n\n this.pointAlongPathFrom = function (location, distance, absolute) {\n var seg = _findSegmentForLocation(location, absolute);\n // TODO what happens if this crosses to the next segment?\n return seg.segment && seg.segment.pointAlongPathFrom(seg.proportion, distance, false) || [0, 0];\n };\n\n this.compute = function (params) {\n paintInfo = _prepareCompute.call(this, params);\n\n _clearSegments();\n this._compute(paintInfo, params);\n this.x = paintInfo.points[0];\n this.y = paintInfo.points[1];\n this.w = paintInfo.points[2];\n this.h = paintInfo.points[3];\n this.segment = paintInfo.segment;\n _updateSegmentProportions();\n };\n\n return {\n addSegment: _addSegment,\n prepareCompute: _prepareCompute,\n sourceStub: sourceStub,\n targetStub: targetStub,\n maxStub: Math.max(sourceStub, targetStub),\n sourceGap: sourceGap,\n targetGap: targetGap,\n maxGap: Math.max(sourceGap, targetGap),\n setGeometry:_setGeometry,\n getGeometry:_getGeometry\n };\n };\n _ju.extend(_jp.Connectors.AbstractConnector, AbstractComponent);\n\n\n // ********************************* END OF CONNECTOR TYPES *******************************************************************\n\n // ********************************* ENDPOINT TYPES *******************************************************************\n\n _jp.Endpoints.AbstractEndpoint = function (params) {\n AbstractComponent.apply(this, arguments);\n var compute = this.compute = function (anchorPoint, orientation, endpointStyle, connectorPaintStyle) {\n var out = this._compute.apply(this, arguments);\n this.x = out[0];\n this.y = out[1];\n this.w = out[2];\n this.h = out[3];\n this.bounds.minX = this.x;\n this.bounds.minY = this.y;\n this.bounds.maxX = this.x + this.w;\n this.bounds.maxY = this.y + this.h;\n return out;\n };\n return {\n compute: compute,\n cssClass: params.cssClass\n };\n };\n _ju.extend(_jp.Endpoints.AbstractEndpoint, AbstractComponent);\n\n /**\n * Class: Endpoints.Dot\n * A round endpoint, with default radius 10 pixels.\n */\n\n /**\n * Function: Constructor\n *\n * Parameters:\n *\n * radius - radius of the endpoint. defaults to 10 pixels.\n */\n _jp.Endpoints.Dot = function (params) {\n this.type = \"Dot\";\n var _super = _jp.Endpoints.AbstractEndpoint.apply(this, arguments);\n params = params || {};\n this.radius = params.radius || 10;\n this.defaultOffset = 0.5 * this.radius;\n this.defaultInnerRadius = this.radius / 3;\n\n this._compute = function (anchorPoint, orientation, endpointStyle, connectorPaintStyle) {\n this.radius = endpointStyle.radius || this.radius;\n var x = anchorPoint[0] - this.radius,\n y = anchorPoint[1] - this.radius,\n w = this.radius * 2,\n h = this.radius * 2;\n\n if (endpointStyle.stroke) {\n var lw = endpointStyle.strokeWidth || 1;\n x -= lw;\n y -= lw;\n w += (lw * 2);\n h += (lw * 2);\n }\n return [ x, y, w, h, this.radius ];\n };\n };\n _ju.extend(_jp.Endpoints.Dot, _jp.Endpoints.AbstractEndpoint);\n\n _jp.Endpoints.Rectangle = function (params) {\n this.type = \"Rectangle\";\n var _super = _jp.Endpoints.AbstractEndpoint.apply(this, arguments);\n params = params || {};\n this.width = params.width || 20;\n this.height = params.height || 20;\n\n this._compute = function (anchorPoint, orientation, endpointStyle, connectorPaintStyle) {\n var width = endpointStyle.width || this.width,\n height = endpointStyle.height || this.height,\n x = anchorPoint[0] - (width / 2),\n y = anchorPoint[1] - (height / 2);\n\n return [ x, y, width, height];\n };\n };\n _ju.extend(_jp.Endpoints.Rectangle, _jp.Endpoints.AbstractEndpoint);\n\n var DOMElementEndpoint = function (params) {\n _jp.jsPlumbUIComponent.apply(this, arguments);\n this._jsPlumb.displayElements = [];\n };\n _ju.extend(DOMElementEndpoint, _jp.jsPlumbUIComponent, {\n getDisplayElements: function () {\n return this._jsPlumb.displayElements;\n },\n appendDisplayElement: function (el) {\n this._jsPlumb.displayElements.push(el);\n }\n });\n\n /**\n * Class: Endpoints.Image\n * Draws an image as the Endpoint.\n */\n /**\n * Function: Constructor\n *\n * Parameters:\n *\n * src - location of the image to use.\n\n TODO: multiple references to self. not sure quite how to get rid of them entirely. perhaps self = null in the cleanup\n function will suffice\n\n TODO this class still might leak memory.\n\n */\n _jp.Endpoints.Image = function (params) {\n\n this.type = \"Image\";\n DOMElementEndpoint.apply(this, arguments);\n _jp.Endpoints.AbstractEndpoint.apply(this, arguments);\n\n var _onload = params.onload,\n src = params.src || params.url,\n clazz = params.cssClass ? \" \" + params.cssClass : \"\";\n\n this._jsPlumb.img = new Image();\n this._jsPlumb.ready = false;\n this._jsPlumb.initialized = false;\n this._jsPlumb.deleted = false;\n this._jsPlumb.widthToUse = params.width;\n this._jsPlumb.heightToUse = params.height;\n this._jsPlumb.endpoint = params.endpoint;\n\n this._jsPlumb.img.onload = function () {\n if (this._jsPlumb != null) {\n this._jsPlumb.ready = true;\n this._jsPlumb.widthToUse = this._jsPlumb.widthToUse || this._jsPlumb.img.width;\n this._jsPlumb.heightToUse = this._jsPlumb.heightToUse || this._jsPlumb.img.height;\n if (_onload) {\n _onload(this);\n }\n }\n }.bind(this);\n\n /*\n Function: setImage\n Sets the Image to use in this Endpoint.\n\n Parameters:\n img - may be a URL or an Image object\n onload - optional; a callback to execute once the image has loaded.\n */\n this._jsPlumb.endpoint.setImage = function (_img, onload) {\n var s = _img.constructor === String ? _img : _img.src;\n _onload = onload;\n this._jsPlumb.img.src = s;\n\n if (this.canvas != null) {\n this.canvas.setAttribute(\"src\", this._jsPlumb.img.src);\n }\n }.bind(this);\n\n this._jsPlumb.endpoint.setImage(src, _onload);\n this._compute = function (anchorPoint, orientation, endpointStyle, connectorPaintStyle) {\n this.anchorPoint = anchorPoint;\n if (this._jsPlumb.ready) {\n return [anchorPoint[0] - this._jsPlumb.widthToUse / 2, anchorPoint[1] - this._jsPlumb.heightToUse / 2,\n this._jsPlumb.widthToUse, this._jsPlumb.heightToUse];\n }\n else {\n return [0, 0, 0, 0];\n }\n };\n\n this.canvas = _jp.createElement(\"img\", {\n position:\"absolute\",\n margin:0,\n padding:0,\n outline:0\n }, this._jsPlumb.instance.endpointClass + clazz);\n\n if (this._jsPlumb.widthToUse) {\n this.canvas.setAttribute(\"width\", this._jsPlumb.widthToUse);\n }\n if (this._jsPlumb.heightToUse) {\n this.canvas.setAttribute(\"height\", this._jsPlumb.heightToUse);\n }\n this._jsPlumb.instance.appendElement(this.canvas);\n\n this.actuallyPaint = function (d, style, anchor) {\n if (!this._jsPlumb.deleted) {\n if (!this._jsPlumb.initialized) {\n this.canvas.setAttribute(\"src\", this._jsPlumb.img.src);\n this.appendDisplayElement(this.canvas);\n this._jsPlumb.initialized = true;\n }\n var x = this.anchorPoint[0] - (this._jsPlumb.widthToUse / 2),\n y = this.anchorPoint[1] - (this._jsPlumb.heightToUse / 2);\n _ju.sizeElement(this.canvas, x, y, this._jsPlumb.widthToUse, this._jsPlumb.heightToUse);\n }\n };\n\n this.paint = function (style, anchor) {\n if (this._jsPlumb != null) { // may have been deleted\n if (this._jsPlumb.ready) {\n this.actuallyPaint(style, anchor);\n }\n else {\n root.setTimeout(function () {\n this.paint(style, anchor);\n }.bind(this), 200);\n }\n }\n };\n };\n _ju.extend(_jp.Endpoints.Image, [ DOMElementEndpoint, _jp.Endpoints.AbstractEndpoint ], {\n cleanup: function (force) {\n if (force) {\n this._jsPlumb.deleted = true;\n if (this.canvas) {\n this.canvas.parentNode.removeChild(this.canvas);\n }\n this.canvas = null;\n }\n }\n });\n\n /*\n * Class: Endpoints.Blank\n * An Endpoint that paints nothing (visible) on the screen. Supports cssClass and hoverClass parameters like all Endpoints.\n */\n _jp.Endpoints.Blank = function (params) {\n var _super = _jp.Endpoints.AbstractEndpoint.apply(this, arguments);\n this.type = \"Blank\";\n DOMElementEndpoint.apply(this, arguments);\n this._compute = function (anchorPoint, orientation, endpointStyle, connectorPaintStyle) {\n return [anchorPoint[0], anchorPoint[1], 10, 0];\n };\n\n var clazz = params.cssClass ? \" \" + params.cssClass : \"\";\n\n this.canvas = _jp.createElement(\"div\", {\n display: \"block\",\n width: \"1px\",\n height: \"1px\",\n background: \"transparent\",\n position: \"absolute\"\n }, this._jsPlumb.instance.endpointClass + clazz);\n\n this._jsPlumb.instance.appendElement(this.canvas);\n\n this.paint = function (style, anchor) {\n _ju.sizeElement(this.canvas, this.x, this.y, this.w, this.h);\n };\n };\n _ju.extend(_jp.Endpoints.Blank, [_jp.Endpoints.AbstractEndpoint, DOMElementEndpoint], {\n cleanup: function () {\n if (this.canvas && this.canvas.parentNode) {\n this.canvas.parentNode.removeChild(this.canvas);\n }\n }\n });\n\n /*\n * Class: Endpoints.Triangle\n * A triangular Endpoint.\n */\n /*\n * Function: Constructor\n *\n * Parameters:\n *\n * width width of the triangle's base. defaults to 55 pixels.\n * height height of the triangle from base to apex. defaults to 55 pixels.\n */\n _jp.Endpoints.Triangle = function (params) {\n this.type = \"Triangle\";\n _jp.Endpoints.AbstractEndpoint.apply(this, arguments);\n var self = this;\n params = params || { };\n params.width = params.width || 55;\n params.height = params.height || 55;\n this.width = params.width;\n this.height = params.height;\n this._compute = function (anchorPoint, orientation, endpointStyle, connectorPaintStyle) {\n var width = endpointStyle.width || self.width,\n height = endpointStyle.height || self.height,\n x = anchorPoint[0] - (width / 2),\n y = anchorPoint[1] - (height / 2);\n return [ x, y, width, height ];\n };\n };\n// ********************************* END OF ENDPOINT TYPES *******************************************************************\n\n\n// ********************************* OVERLAY DEFINITIONS *********************************************************************** \n\n var AbstractOverlay = _jp.Overlays.AbstractOverlay = function (params) {\n this.visible = true;\n this.isAppendedAtTopLevel = true;\n this.component = params.component;\n this.loc = params.location == null ? 0.5 : params.location;\n this.endpointLoc = params.endpointLocation == null ? [ 0.5, 0.5] : params.endpointLocation;\n this.visible = params.visible !== false;\n };\n AbstractOverlay.prototype = {\n cleanup: function (force) {\n if (force) {\n this.component = null;\n this.canvas = null;\n this.endpointLoc = null;\n }\n },\n reattach:function(instance, component) { },\n setVisible: function (val) {\n this.visible = val;\n this.component.repaint();\n },\n isVisible: function () {\n return this.visible;\n },\n hide: function () {\n this.setVisible(false);\n },\n show: function () {\n this.setVisible(true);\n },\n incrementLocation: function (amount) {\n this.loc += amount;\n this.component.repaint();\n },\n setLocation: function (l) {\n this.loc = l;\n this.component.repaint();\n },\n getLocation: function () {\n return this.loc;\n },\n updateFrom:function() { }\n };\n\n\n /*\n * Class: Overlays.Arrow\n *\n * An arrow overlay, defined by four points: the head, the two sides of the tail, and a 'foldback' point at some distance along the length\n * of the arrow that lines from each tail point converge into. The foldback point is defined using a decimal that indicates some fraction\n * of the length of the arrow and has a default value of 0.623. A foldback point value of 1 would mean that the arrow had a straight line\n * across the tail.\n */\n /*\n * @constructor\n *\n * @param {Object} params Constructor params.\n * @param {Number} [params.length] Distance in pixels from head to tail baseline. default 20.\n * @param {Number} [params.width] Width in pixels of the tail baseline. default 20.\n * @param {String} [params.fill] Style to use when filling the arrow. defaults to \"black\".\n * @param {String} [params.stroke] Style to use when stroking the arrow. defaults to null, which means the arrow is not stroked.\n * @param {Number} [params.stroke-width] Line width to use when stroking the arrow. defaults to 1, but only used if stroke is not null.\n * @param {Number} [params.foldback] Distance (as a decimal from 0 to 1 inclusive) along the length of the arrow marking the point the tail points should fold back to. defaults to 0.623.\n * @param {Number} [params.location] Distance (as a decimal from 0 to 1 inclusive) marking where the arrow should sit on the connector. defaults to 0.5.\n * @param {NUmber} [params.direction] Indicates the direction the arrow points in. valid values are -1 and 1; 1 is default.\n */\n _jp.Overlays.Arrow = function (params) {\n this.type = \"Arrow\";\n AbstractOverlay.apply(this, arguments);\n this.isAppendedAtTopLevel = false;\n params = params || {};\n var self = this;\n\n this.length = params.length || 20;\n this.width = params.width || 20;\n this.id = params.id;\n var direction = (params.direction || 1) < 0 ? -1 : 1,\n paintStyle = params.paintStyle || { \"stroke-width\": 1 },\n // how far along the arrow the lines folding back in come to. default is 62.3%.\n foldback = params.foldback || 0.623;\n\n this.computeMaxSize = function () {\n return self.width * 1.5;\n };\n\n this.elementCreated = function(p, component) {\n this.path = p;\n if (params.events) {\n for (var i in params.events) {\n _jp.on(p, i, params.events[i]);\n }\n }\n };\n\n this.draw = function (component, currentConnectionPaintStyle) {\n\n var hxy, mid, txy, tail, cxy;\n if (component.pointAlongPathFrom) {\n\n if (_ju.isString(this.loc) || this.loc > 1 || this.loc < 0) {\n var l = parseInt(this.loc, 10),\n fromLoc = this.loc < 0 ? 1 : 0;\n hxy = component.pointAlongPathFrom(fromLoc, l, false);\n mid = component.pointAlongPathFrom(fromLoc, l - (direction * this.length / 2), false);\n txy = _jg.pointOnLine(hxy, mid, this.length);\n }\n else if (this.loc === 1) {\n hxy = component.pointOnPath(this.loc);\n mid = component.pointAlongPathFrom(this.loc, -(this.length));\n txy = _jg.pointOnLine(hxy, mid, this.length);\n\n if (direction === -1) {\n var _ = txy;\n txy = hxy;\n hxy = _;\n }\n }\n else if (this.loc === 0) {\n txy = component.pointOnPath(this.loc);\n mid = component.pointAlongPathFrom(this.loc, this.length);\n hxy = _jg.pointOnLine(txy, mid, this.length);\n if (direction === -1) {\n var __ = txy;\n txy = hxy;\n hxy = __;\n }\n }\n else {\n hxy = component.pointAlongPathFrom(this.loc, direction * this.length / 2);\n mid = component.pointOnPath(this.loc);\n txy = _jg.pointOnLine(hxy, mid, this.length);\n }\n\n tail = _jg.perpendicularLineTo(hxy, txy, this.width);\n cxy = _jg.pointOnLine(hxy, txy, foldback * this.length);\n\n var d = { hxy: hxy, tail: tail, cxy: cxy },\n stroke = paintStyle.stroke || currentConnectionPaintStyle.stroke,\n fill = paintStyle.fill || currentConnectionPaintStyle.stroke,\n lineWidth = paintStyle.strokeWidth || currentConnectionPaintStyle.strokeWidth;\n\n return {\n component: component,\n d: d,\n \"stroke-width\": lineWidth,\n stroke: stroke,\n fill: fill,\n minX: Math.min(hxy.x, tail[0].x, tail[1].x),\n maxX: Math.max(hxy.x, tail[0].x, tail[1].x),\n minY: Math.min(hxy.y, tail[0].y, tail[1].y),\n maxY: Math.max(hxy.y, tail[0].y, tail[1].y)\n };\n }\n else {\n return {component: component, minX: 0, maxX: 0, minY: 0, maxY: 0};\n }\n };\n };\n _ju.extend(_jp.Overlays.Arrow, AbstractOverlay, {\n updateFrom:function(d) {\n this.length = d.length || this.length;\n this.width = d.width|| this.width;\n this.direction = d.direction != null ? d.direction : this.direction;\n this.foldback = d.foldback|| this.foldback;\n }\n });\n\n /*\n * Class: Overlays.PlainArrow\n *\n * A basic arrow. This is in fact just one instance of the more generic case in which the tail folds back on itself to some\n * point along the length of the arrow: in this case, that foldback point is the full length of the arrow. so it just does\n * a 'call' to Arrow with foldback set appropriately.\n */\n /*\n * Function: Constructor\n * See <Overlays.Arrow> for allowed parameters for this overlay.\n */\n _jp.Overlays.PlainArrow = function (params) {\n params = params || {};\n var p = _jp.extend(params, {foldback: 1});\n _jp.Overlays.Arrow.call(this, p);\n this.type = \"PlainArrow\";\n };\n _ju.extend(_jp.Overlays.PlainArrow, _jp.Overlays.Arrow);\n\n /*\n * Class: Overlays.Diamond\n * \n * A diamond. Like PlainArrow, this is a concrete case of the more generic case of the tail points converging on some point...it just\n * happens that in this case, that point is greater than the length of the the arrow.\n *\n * this could probably do with some help with positioning...due to the way it reuses the Arrow paint code, what Arrow thinks is the\n * center is actually 1/4 of the way along for this guy. but we don't have any knowledge of pixels at this point, so we're kind of\n * stuck when it comes to helping out the Arrow class. possibly we could pass in a 'transpose' parameter or something. the value\n * would be -l/4 in this case - move along one quarter of the total length.\n */\n /*\n * Function: Constructor\n * See <Overlays.Arrow> for allowed parameters for this overlay.\n */\n _jp.Overlays.Diamond = function (params) {\n params = params || {};\n var l = params.length || 40,\n p = _jp.extend(params, {length: l / 2, foldback: 2});\n _jp.Overlays.Arrow.call(this, p);\n this.type = \"Diamond\";\n };\n _ju.extend(_jp.Overlays.Diamond, _jp.Overlays.Arrow);\n\n var _getDimensions = function (component, forceRefresh) {\n if (component._jsPlumb.cachedDimensions == null || forceRefresh) {\n component._jsPlumb.cachedDimensions = component.getDimensions();\n }\n return component._jsPlumb.cachedDimensions;\n };\n\n // abstract superclass for overlays that add an element to the DOM.\n var AbstractDOMOverlay = function (params) {\n _jp.jsPlumbUIComponent.apply(this, arguments);\n AbstractOverlay.apply(this, arguments);\n\n // hand off fired events to associated component.\n var _f = this.fire;\n this.fire = function () {\n _f.apply(this, arguments);\n if (this.component) {\n this.component.fire.apply(this.component, arguments);\n }\n };\n\n this.detached=false;\n this.id = params.id;\n this._jsPlumb.div = null;\n this._jsPlumb.initialised = false;\n this._jsPlumb.component = params.component;\n this._jsPlumb.cachedDimensions = null;\n this._jsPlumb.create = params.create;\n this._jsPlumb.initiallyInvisible = params.visible === false;\n\n this.getElement = function () {\n if (this._jsPlumb.div == null) {\n var div = this._jsPlumb.div = _jp.getElement(this._jsPlumb.create(this._jsPlumb.component));\n div.style.position = \"absolute\";\n div.className = this._jsPlumb.instance.overlayClass + \" \" +\n (this.cssClass ? this.cssClass :\n params.cssClass ? params.cssClass : \"\");\n this._jsPlumb.instance.appendElement(div);\n this._jsPlumb.instance.getId(div);\n this.canvas = div;\n\n // in IE the top left corner is what it placed at the desired location. This will not\n // be fixed. IE8 is not going to be supported for much longer.\n var ts = \"translate(-50%, -50%)\";\n div.style.webkitTransform = ts;\n div.style.mozTransform = ts;\n div.style.msTransform = ts;\n div.style.oTransform = ts;\n div.style.transform = ts;\n\n // write the related component into the created element\n div._jsPlumb = this;\n\n if (params.visible === false) {\n div.style.display = \"none\";\n }\n }\n return this._jsPlumb.div;\n };\n\n this.draw = function (component, currentConnectionPaintStyle, absolutePosition) {\n var td = _getDimensions(this);\n if (td != null && td.length === 2) {\n var cxy = { x: 0, y: 0 };\n\n // absolutePosition would have been set by a call to connection.setAbsoluteOverlayPosition.\n if (absolutePosition) {\n cxy = { x: absolutePosition[0], y: absolutePosition[1] };\n }\n else if (component.pointOnPath) {\n var loc = this.loc, absolute = false;\n if (_ju.isString(this.loc) || this.loc < 0 || this.loc > 1) {\n loc = parseInt(this.loc, 10);\n absolute = true;\n }\n cxy = component.pointOnPath(loc, absolute); // a connection\n }\n else {\n var locToUse = this.loc.constructor === Array ? this.loc : this.endpointLoc;\n cxy = { x: locToUse[0] * component.w,\n y: locToUse[1] * component.h };\n }\n\n var minx = cxy.x - (td[0] / 2),\n miny = cxy.y - (td[1] / 2);\n\n return {\n component: component,\n d: { minx: minx, miny: miny, td: td, cxy: cxy },\n minX: minx,\n maxX: minx + td[0],\n minY: miny,\n maxY: miny + td[1]\n };\n }\n else {\n return {minX: 0, maxX: 0, minY: 0, maxY: 0};\n }\n };\n };\n _ju.extend(AbstractDOMOverlay, [_jp.jsPlumbUIComponent, AbstractOverlay], {\n getDimensions: function () {\n return [1,1];\n },\n setVisible: function (state) {\n if (this._jsPlumb.div) {\n this._jsPlumb.div.style.display = state ? \"block\" : \"none\";\n // if initially invisible, dimensions are 0,0 and never get updated\n if (state && this._jsPlumb.initiallyInvisible) {\n _getDimensions(this, true);\n this.component.repaint();\n this._jsPlumb.initiallyInvisible = false;\n }\n }\n },\n /*\n * Function: clearCachedDimensions\n * Clears the cached dimensions for the label. As a performance enhancement, label dimensions are\n * cached from 1.3.12 onwards. The cache is cleared when you change the label text, of course, but\n * there are other reasons why the text dimensions might change - if you make a change through CSS, for\n * example, you might change the font size. in that case you should explicitly call this method.\n */\n clearCachedDimensions: function () {\n this._jsPlumb.cachedDimensions = null;\n },\n cleanup: function (force) {\n if (force) {\n if (this._jsPlumb.div != null) {\n this._jsPlumb.div._jsPlumb = null;\n this._jsPlumb.instance.removeElement(this._jsPlumb.div);\n }\n }\n else {\n // if not a forced cleanup, just detach child from parent for now.\n if (this._jsPlumb && this._jsPlumb.div && this._jsPlumb.div.parentNode) {\n this._jsPlumb.div.parentNode.removeChild(this._jsPlumb.div);\n }\n this.detached = true;\n }\n\n },\n reattach:function(instance, component) {\n if (this._jsPlumb.div != null) {\n instance.getContainer().appendChild(this._jsPlumb.div);\n }\n this.detached = false;\n },\n computeMaxSize: function () {\n var td = _getDimensions(this);\n return Math.max(td[0], td[1]);\n },\n paint: function (p, containerExtents) {\n if (!this._jsPlumb.initialised) {\n this.getElement();\n p.component.appendDisplayElement(this._jsPlumb.div);\n this._jsPlumb.initialised = true;\n if (this.detached) {\n this._jsPlumb.div.parentNode.removeChild(this._jsPlumb.div);\n }\n }\n this._jsPlumb.div.style.left = (p.component.x + p.d.minx) + \"px\";\n this._jsPlumb.div.style.top = (p.component.y + p.d.miny) + \"px\";\n }\n });\n\n /*\n * Class: Overlays.Custom\n * A Custom overlay. You supply a 'create' function which returns some DOM element, and jsPlumb positions it.\n * The 'create' function is passed a Connection or Endpoint.\n */\n /*\n * Function: Constructor\n * \n * Parameters:\n * create - function for jsPlumb to call that returns a DOM element.\n * location - distance (as a decimal from 0 to 1 inclusive) marking where the label should sit on the connector. defaults to 0.5.\n * id - optional id to use for later retrieval of this overlay.\n *\n */\n _jp.Overlays.Custom = function (params) {\n this.type = \"Custom\";\n AbstractDOMOverlay.apply(this, arguments);\n };\n _ju.extend(_jp.Overlays.Custom, AbstractDOMOverlay);\n\n _jp.Overlays.GuideLines = function () {\n var self = this;\n self.length = 50;\n self.strokeWidth = 5;\n this.type = \"GuideLines\";\n AbstractOverlay.apply(this, arguments);\n _jp.jsPlumbUIComponent.apply(this, arguments);\n this.draw = function (connector, currentConnectionPaintStyle) {\n\n var head = connector.pointAlongPathFrom(self.loc, self.length / 2),\n mid = connector.pointOnPath(self.loc),\n tail = _jg.pointOnLine(head, mid, self.length),\n tailLine = _jg.perpendicularLineTo(head, tail, 40),\n headLine = _jg.perpendicularLineTo(tail, head, 20);\n\n return {\n connector: connector,\n head: head,\n tail: tail,\n headLine: headLine,\n tailLine: tailLine,\n minX: Math.min(head.x, tail.x, headLine[0].x, headLine[1].x),\n minY: Math.min(head.y, tail.y, headLine[0].y, headLine[1].y),\n maxX: Math.max(head.x, tail.x, headLine[0].x, headLine[1].x),\n maxY: Math.max(head.y, tail.y, headLine[0].y, headLine[1].y)\n };\n };\n\n // this.cleanup = function() { }; // nothing to clean up for GuideLines\n };\n\n /*\n * Class: Overlays.Label\n\n */\n /*\n * Function: Constructor\n * \n * Parameters:\n * cssClass - optional css class string to append to css class. This string is appended \"as-is\", so you can of course have multiple classes\n * defined. This parameter is preferred to using labelStyle, borderWidth and borderStyle.\n * label - the label to paint. May be a string or a function that returns a string. Nothing will be painted if your label is null or your\n * label function returns null. empty strings _will_ be painted.\n * location - distance (as a decimal from 0 to 1 inclusive) marking where the label should sit on the connector. defaults to 0.5.\n * id - optional id to use for later retrieval of this overlay.\n * \n *\n */\n _jp.Overlays.Label = function (params) {\n this.labelStyle = params.labelStyle;\n\n var labelWidth = null, labelHeight = null, labelText = null, labelPadding = null;\n this.cssClass = this.labelStyle != null ? this.labelStyle.cssClass : null;\n var p = _jp.extend({\n create: function () {\n return _jp.createElement(\"div\");\n }}, params);\n _jp.Overlays.Custom.call(this, p);\n this.type = \"Label\";\n this.label = params.label || \"\";\n this.labelText = null;\n if (this.labelStyle) {\n var el = this.getElement();\n this.labelStyle.font = this.labelStyle.font || \"12px sans-serif\";\n el.style.font = this.labelStyle.font;\n el.style.color = this.labelStyle.color || \"black\";\n if (this.labelStyle.fill) {\n el.style.background = this.labelStyle.fill;\n }\n if (this.labelStyle.borderWidth > 0) {\n var dStyle = this.labelStyle.borderStyle ? this.labelStyle.borderStyle : \"black\";\n el.style.border = this.labelStyle.borderWidth + \"px solid \" + dStyle;\n }\n if (this.labelStyle.padding) {\n el.style.padding = this.labelStyle.padding;\n }\n }\n\n };\n _ju.extend(_jp.Overlays.Label, _jp.Overlays.Custom, {\n cleanup: function (force) {\n if (force) {\n this.div = null;\n this.label = null;\n this.labelText = null;\n this.cssClass = null;\n this.labelStyle = null;\n }\n },\n getLabel: function () {\n return this.label;\n },\n /*\n * Function: setLabel\n * sets the label's, um, label. you would think i'd call this function\n * 'setText', but you can pass either a Function or a String to this, so\n * it makes more sense as 'setLabel'. This uses innerHTML on the label div, so keep\n * that in mind if you need escaped HTML.\n */\n setLabel: function (l) {\n this.label = l;\n this.labelText = null;\n this.clearCachedDimensions();\n this.update();\n this.component.repaint();\n },\n getDimensions: function () {\n this.update();\n return AbstractDOMOverlay.prototype.getDimensions.apply(this, arguments);\n },\n update: function () {\n if (typeof this.label === \"function\") {\n var lt = this.label(this);\n this.getElement().innerHTML = lt.replace(/\\r\\n/g, \"<br/>\");\n }\n else {\n if (this.labelText == null) {\n this.labelText = this.label;\n this.getElement().innerHTML = this.labelText.replace(/\\r\\n/g, \"<br/>\");\n }\n }\n },\n updateFrom:function(d) {\n if(d.label != null){\n this.setLabel(d.label);\n }\n }\n });\n\n // ********************************* END OF OVERLAY DEFINITIONS ***********************************************************************\n\n}).call(typeof window !== 'undefined' ? window : this);\n\n/*\n * This file contains the base class for library adapters.\n *\n * Copyright (c) 2010 - 2018 jsPlumb (hello@jsplumbtoolkit.com)\n *\n * https://jsplumbtoolkit.com\n * https://github.com/jsplumb/jsplumb\n *\n * Dual licensed under the MIT and GPL2 licenses.\n */\n;(function() {\n \"use strict\";\n var root = this,\n _jp = root.jsPlumb;\n\n var _getEventManager = function(instance) {\n var e = instance._mottle;\n if (!e) {\n e = instance._mottle = new root.Mottle();\n }\n return e;\n };\n\n _jp.extend(root.jsPlumbInstance.prototype, {\n getEventManager:function() {\n return _getEventManager(this);\n },\n on : function(el, event, callback) {\n // TODO: here we would like to map the tap event if we know its\n // an internal bind to a click. we have to know its internal because only\n // then can we be sure that the UP event wont be consumed (tap is a synthesized\n // event from a mousedown followed by a mouseup).\n //event = { \"click\":\"tap\", \"dblclick\":\"dbltap\"}[event] || event;\n this.getEventManager().on.apply(this, arguments);\n return this;\n },\n off : function(el, event, callback) {\n this.getEventManager().off.apply(this, arguments);\n return this;\n }\n });\n\n\n}).call(typeof window !== 'undefined' ? window : this);\n/*\n * Copyright (c) 2010 - 2018 jsPlumb (hello@jsplumbtoolkit.com)\n *\n * https://jsplumbtoolkit.com\n * https://github.com/jsplumb/jsplumb\n *\n * Dual licensed under the MIT and GPL2 licenses.\n */\n;(function() {\n \"use strict\";\n\n var root = this,\n _ju = root.jsPlumbUtil,\n _jpi = root.jsPlumbInstance;\n\n var GROUP_COLLAPSED_CLASS = \"jtk-group-collapsed\";\n var GROUP_EXPANDED_CLASS = \"jtk-group-expanded\";\n var GROUP_CONTAINER_SELECTOR = \"[jtk-group-content]\";\n var ELEMENT_DRAGGABLE_EVENT = \"elementDraggable\";\n var STOP = \"stop\";\n var REVERT = \"revert\";\n var GROUP_MANAGER = \"_groupManager\";\n var GROUP = \"_jsPlumbGroup\";\n var GROUP_DRAG_SCOPE = \"_jsPlumbGroupDrag\";\n var EVT_CHILD_ADDED = \"group:addMember\";\n var EVT_CHILD_REMOVED = \"group:removeMember\";\n var EVT_GROUP_ADDED = \"group:add\";\n var EVT_GROUP_REMOVED = \"group:remove\";\n var EVT_EXPAND = \"group:expand\";\n var EVT_COLLAPSE = \"group:collapse\";\n var EVT_GROUP_DRAG_STOP = \"groupDragStop\";\n var EVT_CONNECTION_MOVED = \"connectionMoved\";\n var EVT_INTERNAL_CONNECTION_DETACHED = \"internal.connectionDetached\";\n\n var CMD_REMOVE_ALL = \"removeAll\";\n var CMD_ORPHAN_ALL = \"orphanAll\";\n var CMD_SHOW = \"show\";\n var CMD_HIDE = \"hide\";\n\n var GroupManager = function(_jsPlumb) {\n var _managedGroups = {}, _connectionSourceMap = {}, _connectionTargetMap = {}, self = this;\n\n _jsPlumb.bind(\"connection\", function(p) {\n if (p.source[GROUP] != null && p.target[GROUP] != null && p.source[GROUP] === p.target[GROUP]) {\n _connectionSourceMap[p.connection.id] = p.source[GROUP];\n _connectionTargetMap[p.connection.id] = p.source[GROUP];\n }\n else {\n if (p.source[GROUP] != null) {\n _ju.suggest(p.source[GROUP].connections.source, p.connection);\n _connectionSourceMap[p.connection.id] = p.source[GROUP];\n }\n if (p.target[GROUP] != null) {\n _ju.suggest(p.target[GROUP].connections.target, p.connection);\n _connectionTargetMap[p.connection.id] = p.target[GROUP];\n }\n }\n });\n\n function _cleanupDetachedConnection(conn) {\n delete conn.proxies;\n var group = _connectionSourceMap[conn.id], f;\n if (group != null) {\n f = function(c) { return c.id === conn.id; };\n _ju.removeWithFunction(group.connections.source, f);\n _ju.removeWithFunction(group.connections.target, f);\n delete _connectionSourceMap[conn.id];\n }\n\n group = _connectionTargetMap[conn.id];\n if (group != null) {\n f = function(c) { return c.id === conn.id; };\n _ju.removeWithFunction(group.connections.source, f);\n _ju.removeWithFunction(group.connections.target, f);\n delete _connectionTargetMap[conn.id];\n }\n }\n\n _jsPlumb.bind(EVT_INTERNAL_CONNECTION_DETACHED, function(p) {\n _cleanupDetachedConnection(p.connection);\n });\n\n _jsPlumb.bind(EVT_CONNECTION_MOVED, function(p) {\n var connMap = p.index === 0 ? _connectionSourceMap : _connectionTargetMap;\n var group = connMap[p.connection.id];\n if (group) {\n var list = group.connections[p.index === 0 ? \"source\" : \"target\"];\n var idx = list.indexOf(p.connection);\n if (idx !== -1) {\n list.splice(idx, 1);\n }\n }\n });\n\n this.addGroup = function(group) {\n _jsPlumb.addClass(group.getEl(), GROUP_EXPANDED_CLASS);\n _managedGroups[group.id] = group;\n group.manager = this;\n _updateConnectionsForGroup(group);\n _jsPlumb.fire(EVT_GROUP_ADDED, { group:group });\n };\n\n this.addToGroup = function(group, el, doNotFireEvent) {\n group = this.getGroup(group);\n if (group) {\n //group.add(el, doNotFireEvent);\n var groupEl = group.getEl();\n\n if (el._isJsPlumbGroup) {\n return;\n }\n var currentGroup = el._jsPlumbGroup;\n // if already a member of this group, do nothing\n if (currentGroup !== group) {\n var elpos = _jsPlumb.getOffset(el, true);\n var cpos = group.collapsed ? _jsPlumb.getOffset(groupEl, true) : _jsPlumb.getOffset(group.getDragArea(), true);\n\n // otherwise, transfer to this group.\n if (currentGroup != null) {\n currentGroup.remove(el, doNotFireEvent);\n self.updateConnectionsForGroup(currentGroup);\n }\n group.add(el, doNotFireEvent);\n\n var handleDroppedConnections = function (list, index) {\n var oidx = index === 0 ? 1 : 0;\n list.each(function (c) {\n c.setVisible(false);\n if (c.endpoints[oidx].element._jsPlumbGroup === group) {\n c.endpoints[oidx].setVisible(false);\n self.expandConnection(c, oidx, group);\n }\n else {\n c.endpoints[index].setVisible(false);\n self.collapseConnection(c, index, group);\n }\n });\n };\n\n if (group.collapsed) {\n handleDroppedConnections(_jsPlumb.select({source: el}), 0);\n handleDroppedConnections(_jsPlumb.select({target: el}), 1);\n }\n\n var elId = _jsPlumb.getId(el);\n _jsPlumb.dragManager.setParent(el, elId, groupEl, _jsPlumb.getId(groupEl), elpos);\n\n var newPosition = { left: elpos.left - cpos.left, top: elpos.top - cpos.top };\n\n _jsPlumb.setPosition(el, newPosition);\n\n _jsPlumb.dragManager.revalidateParent(el, elId, elpos);\n\n self.updateConnectionsForGroup(group);\n\n _jsPlumb.revalidate(elId);\n\n setTimeout(function () {\n _jsPlumb.fire(EVT_CHILD_ADDED, {group: group, el: el});\n }, 0);\n }\n }\n };\n\n this.removeFromGroup = function(group, el, doNotFireEvent) {\n group = this.getGroup(group);\n if (group) {\n group.remove(el, null, doNotFireEvent);\n }\n };\n\n this.getGroup = function(groupId) {\n var group = groupId;\n if (_ju.isString(groupId)) {\n group = _managedGroups[groupId];\n if (group == null) {\n throw new TypeError(\"No such group [\" + groupId + \"]\");\n }\n }\n return group;\n };\n\n this.getGroups = function() {\n var o = [];\n for (var g in _managedGroups) {\n o.push(_managedGroups[g]);\n }\n return o;\n };\n\n this.removeGroup = function(group, deleteMembers, manipulateDOM, doNotFireEvent) {\n group = this.getGroup(group);\n this.expandGroup(group, true); // this reinstates any original connections and removes all proxies, but does not fire an event.\n group[deleteMembers ? CMD_REMOVE_ALL : CMD_ORPHAN_ALL](manipulateDOM, doNotFireEvent);\n _jsPlumb.remove(group.getEl());\n delete _managedGroups[group.id];\n delete _jsPlumb._groups[group.id];\n _jsPlumb.fire(EVT_GROUP_REMOVED, { group:group });\n };\n\n this.removeAllGroups = function(deleteMembers, manipulateDOM, doNotFireEvent) {\n for (var g in _managedGroups) {\n this.removeGroup(_managedGroups[g], deleteMembers, manipulateDOM, doNotFireEvent);\n }\n };\n\n function _setVisible(group, state) {\n var m = group.getMembers();\n for (var i = 0; i < m.length; i++) {\n _jsPlumb[state ? CMD_SHOW : CMD_HIDE](m[i], true);\n }\n }\n\n var _collapseConnection = this.collapseConnection = function(c, index, group) {\n\n var proxyEp, groupEl = group.getEl(), groupElId = _jsPlumb.getId(groupEl),\n originalElementId = c.endpoints[index].elementId;\n\n var otherEl = c.endpoints[index === 0 ? 1 : 0].element;\n if (otherEl[GROUP] && (!otherEl[GROUP].shouldProxy() && otherEl[GROUP].collapsed)) {\n return;\n }\n\n c.proxies = c.proxies || [];\n if(c.proxies[index]) {\n proxyEp = c.proxies[index].ep;\n }else {\n proxyEp = _jsPlumb.addEndpoint(groupEl, {\n endpoint:group.getEndpoint(c, index),\n anchor:group.getAnchor(c, index),\n parameters:{\n isProxyEndpoint:true\n }\n });\n }\n proxyEp.setDeleteOnEmpty(true);\n\n // for this index, stash proxy info: the new EP, the original EP.\n c.proxies[index] = { ep:proxyEp, originalEp: c.endpoints[index] };\n\n // and advise the anchor manager\n if (index === 0) {\n // TODO why are there two differently named methods? Why is there not one method that says \"some end of this\n // connection changed (you give the index), and here's the new element and element id.\"\n _jsPlumb.anchorManager.sourceChanged(originalElementId, groupElId, c, groupEl);\n }\n else {\n _jsPlumb.anchorManager.updateOtherEndpoint(c.endpoints[0].elementId, originalElementId, groupElId, c);\n c.target = groupEl;\n c.targetId = groupElId;\n }\n\n\n // detach the original EP from the connection.\n c.proxies[index].originalEp.detachFromConnection(c, null, true);\n\n // set the proxy as the new ep\n proxyEp.connections = [ c ];\n c.endpoints[index] = proxyEp;\n\n c.setVisible(true);\n };\n\n this.collapseGroup = function(group) {\n group = this.getGroup(group);\n if (group == null || group.collapsed) {\n return;\n }\n var groupEl = group.getEl();\n\n // todo remove old proxy endpoints first, just in case?\n //group.proxies.length = 0;\n\n // hide all connections\n _setVisible(group, false);\n\n if (group.shouldProxy()) {\n // collapses all connections in a group.\n var _collapseSet = function (conns, index) {\n for (var i = 0; i < conns.length; i++) {\n var c = conns[i];\n _collapseConnection(c, index, group);\n }\n };\n\n // setup proxies for sources and targets\n _collapseSet(group.connections.source, 0);\n _collapseSet(group.connections.target, 1);\n }\n\n group.collapsed = true;\n _jsPlumb.removeClass(groupEl, GROUP_EXPANDED_CLASS);\n _jsPlumb.addClass(groupEl, GROUP_COLLAPSED_CLASS);\n _jsPlumb.revalidate(groupEl);\n _jsPlumb.fire(EVT_COLLAPSE, { group:group });\n };\n\n var _expandConnection = this.expandConnection = function(c, index, group) {\n\n // if no proxies or none for this end of the connection, abort.\n if (c.proxies == null || c.proxies[index] == null) {\n return;\n }\n\n var groupElId = _jsPlumb.getId(group.getEl()),\n originalElement = c.proxies[index].originalEp.element,\n originalElementId = c.proxies[index].originalEp.elementId;\n\n c.endpoints[index] = c.proxies[index].originalEp;\n // and advise the anchor manager\n if (index === 0) {\n // TODO why are there two differently named methods? Why is there not one method that says \"some end of this\n // connection changed (you give the index), and here's the new element and element id.\"\n _jsPlumb.anchorManager.sourceChanged(groupElId, originalElementId, c, originalElement);\n }\n else {\n _jsPlumb.anchorManager.updateOtherEndpoint(c.endpoints[0].elementId, groupElId, originalElementId, c);\n c.target = originalElement;\n c.targetId = originalElementId;\n }\n\n // detach the proxy EP from the connection (which will cause it to be removed as we no longer need it)\n c.proxies[index].ep.detachFromConnection(c, null);\n\n c.proxies[index].originalEp.addConnection(c);\n\n // cleanup\n delete c.proxies[index];\n };\n\n this.expandGroup = function(group, doNotFireEvent) {\n\n group = this.getGroup(group);\n\n if (group == null || !group.collapsed) {\n return;\n }\n var groupEl = group.getEl();\n\n _setVisible(group, true);\n\n if (group.shouldProxy()) {\n // collapses all connections in a group.\n var _expandSet = function (conns, index) {\n for (var i = 0; i < conns.length; i++) {\n var c = conns[i];\n _expandConnection(c, index, group);\n }\n };\n\n // setup proxies for sources and targets\n _expandSet(group.connections.source, 0);\n _expandSet(group.connections.target, 1);\n }\n\n group.collapsed = false;\n _jsPlumb.addClass(groupEl, GROUP_EXPANDED_CLASS);\n _jsPlumb.removeClass(groupEl, GROUP_COLLAPSED_CLASS);\n _jsPlumb.revalidate(groupEl);\n this.repaintGroup(group);\n if (!doNotFireEvent) {\n _jsPlumb.fire(EVT_EXPAND, { group: group});\n }\n };\n\n this.repaintGroup = function(group) {\n group = this.getGroup(group);\n var m = group.getMembers();\n for (var i = 0; i < m.length; i++) {\n _jsPlumb.revalidate(m[i]);\n }\n };\n\n // TODO refactor this with the code that responds to `connection` events.\n function _updateConnectionsForGroup(group) {\n var members = group.getMembers();\n var c1 = _jsPlumb.getConnections({source:members, scope:\"*\"}, true);\n var c2 = _jsPlumb.getConnections({target:members, scope:\"*\"}, true);\n var processed = {};\n group.connections.source.length = 0;\n group.connections.target.length = 0;\n var oneSet = function(c) {\n for (var i = 0; i < c.length; i++) {\n if (processed[c[i].id]) {\n continue;\n }\n processed[c[i].id] = true;\n if (c[i].source._jsPlumbGroup === group) {\n if (c[i].target._jsPlumbGroup !== group) {\n group.connections.source.push(c[i]);\n }\n _connectionSourceMap[c[i].id] = group;\n }\n else if (c[i].target._jsPlumbGroup === group) {\n group.connections.target.push(c[i]);\n _connectionTargetMap[c[i].id] = group;\n }\n }\n };\n oneSet(c1); oneSet(c2);\n }\n\n this.updateConnectionsForGroup = _updateConnectionsForGroup;\n this.refreshAllGroups = function() {\n for (var g in _managedGroups) {\n _updateConnectionsForGroup(_managedGroups[g]);\n _jsPlumb.dragManager.updateOffsets(_jsPlumb.getId(_managedGroups[g].getEl()));\n }\n };\n };\n\n /**\n *\n * @param {jsPlumbInstance} _jsPlumb Associated jsPlumb instance.\n * @param {Object} params\n * @param {Element} params.el The DOM element representing the Group.\n * @param {String} [params.id] Optional ID for the Group. A UUID will be assigned as the Group's ID if you do not provide one.\n * @param {Boolean} [params.constrain=false] If true, child elements will not be able to be dragged outside of the Group container.\n * @param {Boolean} [params.revert=true] By default, child elements revert to the container if dragged outside. You can change this by setting `revert:false`. This behaviour is also overridden if you set `orphan` or `prune`.\n * @param {Boolean} [params.orphan=false] If true, child elements dropped outside of the Group container will be removed from the Group (but not from the DOM).\n * @param {Boolean} [params.prune=false] If true, child elements dropped outside of the Group container will be removed from the Group and also from the DOM.\n * @param {Boolean} [params.dropOverride=false] If true, a child element that has been dropped onto some other Group will not be subject to the controls imposed by `prune`, `revert` or `orphan`.\n * @constructor\n */\n var Group = function(_jsPlumb, params) {\n var self = this;\n var el = params.el;\n this.getEl = function() { return el; };\n this.id = params.id || _ju.uuid();\n el._isJsPlumbGroup = true;\n\n var getDragArea = this.getDragArea = function() {\n var da = _jsPlumb.getSelector(el, GROUP_CONTAINER_SELECTOR);\n return da && da.length > 0 ? da[0] : el;\n };\n\n var ghost = params.ghost === true;\n var constrain = ghost || (params.constrain === true);\n var revert = params.revert !== false;\n var orphan = params.orphan === true;\n var prune = params.prune === true;\n var dropOverride = params.dropOverride === true;\n var proxied = params.proxied !== false;\n var elements = [];\n this.connections = { source:[], target:[], internal:[] };\n\n // this function, and getEndpoint below, are stubs for a future setup in which we can choose endpoint\n // and anchor based upon the connection and the index (source/target) of the endpoint to be proxied.\n this.getAnchor = function(conn, endpointIndex) {\n return params.anchor || \"Continuous\";\n };\n\n this.getEndpoint = function(conn, endpointIndex) {\n return params.endpoint || [ \"Dot\", { radius:10 }];\n };\n\n this.collapsed = false;\n if (params.draggable !== false) {\n var opts = {\n stop:function(params) {\n _jsPlumb.fire(EVT_GROUP_DRAG_STOP, jsPlumb.extend(params, {group:self}));\n },\n scope:GROUP_DRAG_SCOPE\n };\n if (params.dragOptions) {\n root.jsPlumb.extend(opts, params.dragOptions);\n }\n _jsPlumb.draggable(params.el, opts);\n }\n if (params.droppable !== false) {\n _jsPlumb.droppable(params.el, {\n drop:function(p) {\n var el = p.drag.el;\n if (el._isJsPlumbGroup) {\n return;\n }\n var currentGroup = el._jsPlumbGroup;\n if (currentGroup !== self) {\n if (currentGroup != null) {\n if (currentGroup.overrideDrop(el, self)) {\n return;\n }\n }\n _jsPlumb.getGroupManager().addToGroup(self, el, false);\n }\n\n }\n });\n }\n var _each = function(_el, fn) {\n var els = _el.nodeType == null ? _el : [ _el ];\n for (var i = 0; i < els.length; i++) {\n fn(els[i]);\n }\n };\n\n this.overrideDrop = function(_el, targetGroup) {\n return dropOverride && (revert || prune || orphan);\n };\n\n this.add = function(_el, doNotFireEvent) {\n var dragArea = getDragArea();\n _each(_el, function(__el) {\n\n if (__el._jsPlumbGroup != null) {\n if (__el._jsPlumbGroup === self) {\n return;\n } else {\n __el._jsPlumbGroup.remove(__el, true, doNotFireEvent, false);\n }\n }\n\n __el._jsPlumbGroup = self;\n elements.push(__el);\n // test if draggable and add handlers if so.\n if (_jsPlumb.isAlreadyDraggable(__el)) {\n _bindDragHandlers(__el);\n }\n\n if (__el.parentNode !== dragArea) {\n dragArea.appendChild(__el);\n }\n\n if (!doNotFireEvent) {\n _jsPlumb.fire(EVT_CHILD_ADDED, {group: self, el: __el});\n }\n });\n\n _jsPlumb.getGroupManager().updateConnectionsForGroup(self);\n };\n\n this.remove = function(el, manipulateDOM, doNotFireEvent, doNotUpdateConnections) {\n\n _each(el, function(__el) {\n delete __el._jsPlumbGroup;\n _ju.removeWithFunction(elements, function(e) {\n return e === __el;\n });\n\n if (manipulateDOM) {\n try { self.getDragArea().removeChild(__el); }\n catch (e) {\n jsPlumbUtil.log(\"Could not remove element from Group \" + e);\n }\n }\n _unbindDragHandlers(__el);\n if (!doNotFireEvent) {\n _jsPlumb.fire(EVT_CHILD_REMOVED, {group: self, el: __el});\n }\n });\n if (!doNotUpdateConnections) {\n _jsPlumb.getGroupManager().updateConnectionsForGroup(self);\n }\n };\n this.removeAll = function(manipulateDOM, doNotFireEvent) {\n for (var i = 0, l = elements.length; i < l; i++) {\n self.remove(elements[0], manipulateDOM, doNotFireEvent, true);\n }\n elements.length = 0;\n _jsPlumb.getGroupManager().updateConnectionsForGroup(self);\n };\n this.orphanAll = function() {\n for (var i = 0; i < elements.length; i++) {\n _orphan(elements[i]);\n }\n elements.length = 0;\n };\n this.getMembers = function() { return elements; };\n\n el[GROUP] = this;\n\n _jsPlumb.bind(ELEMENT_DRAGGABLE_EVENT, function(dragParams) {\n // if its for the current group,\n if (dragParams.el._jsPlumbGroup === this) {\n _bindDragHandlers(dragParams.el);\n }\n }.bind(this));\n\n function _findParent(_el) {\n return _el.offsetParent;\n }\n\n function _isInsideParent(_el, pos) {\n var p = _findParent(_el),\n s = _jsPlumb.getSize(p),\n ss = _jsPlumb.getSize(_el),\n leftEdge = pos[0],\n rightEdge = leftEdge + ss[0],\n topEdge = pos[1],\n bottomEdge = topEdge + ss[1];\n\n return rightEdge > 0 && leftEdge < s[0] && bottomEdge > 0 && topEdge < s[1];\n }\n\n //\n // orphaning an element means taking it out of the group and adding it to the main jsplumb container.\n //\n function _orphan(_el) {\n var id = _jsPlumb.getId(_el);\n var pos = _jsPlumb.getOffset(_el);\n _el.parentNode.removeChild(_el);\n _jsPlumb.getContainer().appendChild(_el);\n _jsPlumb.setPosition(_el, pos);\n delete _el._jsPlumbGroup;\n _unbindDragHandlers(_el);\n _jsPlumb.dragManager.clearParent(_el, id);\n }\n\n //\n // remove an element from the group, then either prune it from the jsplumb instance, or just orphan it.\n //\n function _pruneOrOrphan(p) {\n if (!_isInsideParent(p.el, p.pos)) {\n var group = p.el._jsPlumbGroup;\n if (prune) {\n _jsPlumb.remove(p.el);\n } else {\n _orphan(p.el);\n }\n\n group.remove(p.el);\n }\n }\n\n //\n // redraws the element\n //\n function _revalidate(_el) {\n var id = _jsPlumb.getId(_el);\n _jsPlumb.revalidate(_el);\n _jsPlumb.dragManager.revalidateParent(_el, id);\n }\n\n //\n // unbind the group specific drag/revert handlers.\n //\n function _unbindDragHandlers(_el) {\n if (!_el._katavorioDrag) {\n return;\n }\n if (prune || orphan) {\n _el._katavorioDrag.off(STOP, _pruneOrOrphan);\n }\n if (!prune && !orphan && revert) {\n _el._katavorioDrag.off(REVERT, _revalidate);\n _el._katavorioDrag.setRevert(null);\n }\n }\n\n function _bindDragHandlers(_el) {\n if (!_el._katavorioDrag) {\n return;\n }\n if (prune || orphan) {\n _el._katavorioDrag.on(STOP, _pruneOrOrphan);\n }\n\n if (constrain) {\n _el._katavorioDrag.setConstrain(true);\n }\n\n if (ghost) {\n _el._katavorioDrag.setUseGhostProxy(true);\n }\n\n if (!prune && !orphan && revert) {\n _el._katavorioDrag.on(REVERT, _revalidate);\n _el._katavorioDrag.setRevert(function(__el, pos) {\n return !_isInsideParent(__el, pos);\n });\n }\n }\n\n this.shouldProxy = function() {\n return proxied;\n };\n\n _jsPlumb.getGroupManager().addGroup(this);\n };\n\n /**\n * Adds a group to the jsPlumb instance.\n * @method addGroup\n * @param {Object} params\n * @return {Group} The newly created Group.\n */\n _jpi.prototype.addGroup = function(params) {\n var j = this;\n j._groups = j._groups || {};\n if (j._groups[params.id] != null) {\n throw new TypeError(\"cannot create Group [\" + params.id + \"]; a Group with that ID exists\");\n }\n if (params.el[GROUP] != null) {\n throw new TypeError(\"cannot create Group [\" + params.id + \"]; the given element is already a Group\");\n }\n var group = new Group(j, params);\n j._groups[group.id] = group;\n if (params.collapsed) {\n this.collapseGroup(group);\n }\n return group;\n };\n\n /**\n * Add an element to a group.\n * @method addToGroup\n * @param {String} group Group, or ID of the group, to add the element to.\n * @param {Element} el Element to add to the group.\n */\n _jpi.prototype.addToGroup = function(group, el, doNotFireEvent) {\n\n var _one = function(_el) {\n var id = this.getId(_el);\n this.manage(id, _el);\n this.getGroupManager().addToGroup(group, _el, doNotFireEvent);\n }.bind(this);\n\n if (Array.isArray(el)) {\n for (var i = 0; i < el.length; i++) {\n _one(el[i]);\n }\n } else {\n _one(el);\n }\n };\n\n /**\n * Remove an element from a group.\n * @method removeFromGroup\n * @param {String} group Group, or ID of the group, to remove the element from.\n * @param {Element} el Element to add to the group.\n */\n _jpi.prototype.removeFromGroup = function(group, el, doNotFireEvent) {\n this.getGroupManager().removeFromGroup(group, el, doNotFireEvent);\n };\n\n /**\n * Remove a group, and optionally remove its members from the jsPlumb instance.\n * @method removeGroup\n * @param {String|Group} group Group to delete, or ID of Group to delete.\n * @param {Boolean} [deleteMembers=false] If true, group members will be removed along with the group. Otherwise they will\n * just be 'orphaned' (returned to the main container).\n */\n _jpi.prototype.removeGroup = function(group, deleteMembers, manipulateDOM, doNotFireEvent) {\n this.getGroupManager().removeGroup(group, deleteMembers, manipulateDOM, doNotFireEvent);\n };\n\n /**\n * Remove all groups, and optionally remove their members from the jsPlumb instance.\n * @method removeAllGroup\n * @param {Boolean} [deleteMembers=false] If true, group members will be removed along with the groups. Otherwise they will\n * just be 'orphaned' (returned to the main container).\n */\n _jpi.prototype.removeAllGroups = function(deleteMembers, manipulateDOM, doNotFireEvent) {\n this.getGroupManager().removeAllGroups(deleteMembers, manipulateDOM, doNotFireEvent);\n };\n\n /**\n * Get a Group\n * @method getGroup\n * @param {String} groupId ID of the group to get\n * @return {Group} Group with the given ID, null if not found.\n */\n _jpi.prototype.getGroup = function(groupId) {\n return this.getGroupManager().getGroup(groupId);\n };\n\n /**\n * Gets all the Groups managed by the jsPlumb instance.\n * @returns {Group[]} List of Groups. Empty if none.\n */\n _jpi.prototype.getGroups = function() {\n return this.getGroupManager().getGroups();\n };\n\n /**\n * Expands a group element. jsPlumb doesn't do \"everything\" for you here, because what it means to expand a Group\n * will vary from application to application. jsPlumb does these things:\n *\n * - Hides any connections that are internal to the group (connections between members, and connections from member of\n * the group to the group itself)\n * - Proxies all connections for which the source or target is a member of the group.\n * - Hides the proxied connections.\n * - Adds the jtk-group-expanded class to the group's element\n * - Removes the jtk-group-collapsed class from the group's element.\n *\n * @method expandGroup\n * @param {String|Group} group Group to expand, or ID of Group to expand.\n */\n _jpi.prototype.expandGroup = function(group) {\n this.getGroupManager().expandGroup(group);\n };\n\n /**\n * Collapses a group element. jsPlumb doesn't do \"everything\" for you here, because what it means to collapse a Group\n * will vary from application to application. jsPlumb does these things:\n *\n * - Shows any connections that are internal to the group (connections between members, and connections from member of\n * the group to the group itself)\n * - Removes proxies for all connections for which the source or target is a member of the group.\n * - Shows the previously proxied connections.\n * - Adds the jtk-group-collapsed class to the group's element\n * - Removes the jtk-group-expanded class from the group's element.\n *\n * @method expandGroup\n * @param {String|Group} group Group to expand, or ID of Group to expand.\n */\n _jpi.prototype.collapseGroup = function(groupId) {\n this.getGroupManager().collapseGroup(groupId);\n };\n\n\n _jpi.prototype.repaintGroup = function(group) {\n this.getGroupManager().repaintGroup(group);\n };\n\n /**\n * Collapses or expands a group element depending on its current state. See notes in the collapseGroup and expandGroup method.\n *\n * @method toggleGroup\n * @param {String|Group} group Group to expand/collapse, or ID of Group to expand/collapse.\n */\n _jpi.prototype.toggleGroup = function(group) {\n group = this.getGroupManager().getGroup(group);\n if (group != null) {\n this.getGroupManager()[group.collapsed ? \"expandGroup\" : \"collapseGroup\"](group);\n }\n };\n\n //\n // lazy init a group manager for the given jsplumb instance.\n //\n _jpi.prototype.getGroupManager = function() {\n var mgr = this[GROUP_MANAGER];\n if (mgr == null) {\n mgr = this[GROUP_MANAGER] = new GroupManager(this);\n }\n return mgr;\n };\n\n _jpi.prototype.removeGroupManager = function() {\n delete this[GROUP_MANAGER];\n };\n\n /**\n * Gets the Group that the given element belongs to, null if none.\n * @method getGroupFor\n * @param {String|Element} el Element, or element ID.\n * @returns {Group} A Group, if found, or null.\n */\n _jpi.prototype.getGroupFor = function(el) {\n el = this.getElement(el);\n if (el) {\n return el[GROUP];\n }\n };\n\n}).call(typeof window !== 'undefined' ? window : this);\n\n\n/*\n * This file contains the 'flowchart' connectors, consisting of vertical and horizontal line segments.\n *\n * Copyright (c) 2010 - 2018 jsPlumb (hello@jsplumbtoolkit.com)\n *\n * https://jsplumbtoolkit.com\n * https://github.com/jsplumb/jsplumb\n *\n * Dual licensed under the MIT and GPL2 licenses.\n */\n;\n(function () {\n\n \"use strict\";\n var root = this, _jp = root.jsPlumb, _ju = root.jsPlumbUtil;\n var STRAIGHT = \"Straight\";\n var ARC = \"Arc\";\n\n var Flowchart = function (params) {\n this.type = \"Flowchart\";\n params = params || {};\n params.stub = params.stub == null ? 30 : params.stub;\n var segments,\n _super = _jp.Connectors.AbstractConnector.apply(this, arguments),\n midpoint = params.midpoint == null ? 0.5 : params.midpoint,\n alwaysRespectStubs = params.alwaysRespectStubs === true,\n lastx = null, lasty = null, lastOrientation,\n cornerRadius = params.cornerRadius != null ? params.cornerRadius : 0,\n\n // TODO now common between this and AbstractBezierEditor; refactor into superclass?\n loopbackRadius = params.loopbackRadius || 25,\n isLoopbackCurrently = false,\n\n sgn = function (n) {\n return n < 0 ? -1 : n === 0 ? 0 : 1;\n },\n segmentDirections = function(segment) {\n return [\n sgn( segment[2] - segment[0] ),\n sgn( segment[3] - segment[1] )\n ];\n },\n /**\n * helper method to add a segment.\n */\n addSegment = function (segments, x, y, paintInfo) {\n if (lastx === x && lasty === y) {\n return;\n }\n var lx = lastx == null ? paintInfo.sx : lastx,\n ly = lasty == null ? paintInfo.sy : lasty,\n o = lx === x ? \"v\" : \"h\";\n\n lastx = x;\n lasty = y;\n segments.push([ lx, ly, x, y, o ]);\n },\n segLength = function (s) {\n return Math.sqrt(Math.pow(s[0] - s[2], 2) + Math.pow(s[1] - s[3], 2));\n },\n _cloneArray = function (a) {\n var _a = [];\n _a.push.apply(_a, a);\n return _a;\n },\n writeSegments = function (conn, segments, paintInfo) {\n var current = null, next, currentDirection, nextDirection;\n for (var i = 0; i < segments.length - 1; i++) {\n\n current = current || _cloneArray(segments[i]);\n next = _cloneArray(segments[i + 1]);\n\n currentDirection = segmentDirections(current);\n nextDirection = segmentDirections(next);\n\n if (cornerRadius > 0 && current[4] !== next[4]) {\n var radiusToUse = Math.min(cornerRadius, segLength(current), segLength(next));\n\n current[2] -= currentDirection[0] * radiusToUse;\n current[3] -= currentDirection[1] * radiusToUse;\n next[0] += nextDirection[0] * radiusToUse;\n next[1] += nextDirection[1] * radiusToUse;\n\n var ac = (currentDirection[1] === nextDirection[0] && nextDirection[0] === 1) ||\n ((currentDirection[1] === nextDirection[0] && nextDirection[0] === 0) && currentDirection[0] !== nextDirection[1]) ||\n (currentDirection[1] === nextDirection[0] && nextDirection[0] === -1),\n sgny = next[1] > current[3] ? 1 : -1,\n sgnx = next[0] > current[2] ? 1 : -1,\n sgnEqual = sgny === sgnx,\n cx = (sgnEqual && ac || (!sgnEqual && !ac)) ? next[0] : current[2],\n cy = (sgnEqual && ac || (!sgnEqual && !ac)) ? current[3] : next[1];\n\n _super.addSegment(conn, STRAIGHT, {\n x1: current[0], y1: current[1], x2: current[2], y2: current[3]\n });\n\n _super.addSegment(conn, ARC, {\n r: radiusToUse,\n x1: current[2],\n y1: current[3],\n x2: next[0],\n y2: next[1],\n cx: cx,\n cy: cy,\n ac: ac\n });\n }\n else {\n // dx + dy are used to adjust for line width.\n var dx = (current[2] === current[0]) ? 0 : (current[2] > current[0]) ? (paintInfo.lw / 2) : -(paintInfo.lw / 2),\n dy = (current[3] === current[1]) ? 0 : (current[3] > current[1]) ? (paintInfo.lw / 2) : -(paintInfo.lw / 2);\n\n _super.addSegment(conn, STRAIGHT, {\n x1: current[0] - dx, y1: current[1] - dy, x2: current[2] + dx, y2: current[3] + dy\n });\n }\n current = next;\n }\n if (next != null) {\n // last segment\n _super.addSegment(conn, STRAIGHT, {\n x1: next[0], y1: next[1], x2: next[2], y2: next[3]\n });\n }\n };\n\n this._compute = function (paintInfo, params) {\n\n segments = [];\n lastx = null;\n lasty = null;\n lastOrientation = null;\n\n var geometry = this.getGeometry(),\n sp = [ paintInfo.x, paintInfo.y ],\n tp = [ paintInfo.x + paintInfo.w, paintInfo.y + paintInfo.h ];\n\n if ((this.hasBeenEdited() || this.isEditing()) && geometry != null && geometry.segments != null && geometry.segments.length > 0) {\n segments = geometry.segments;\n\n _super.setGeometry({\n segments:segments,\n sourcePos:sp,\n targetPos:tp\n });\n\n } else {\n\n var commonStubCalculator = function () {\n return [paintInfo.startStubX, paintInfo.startStubY, paintInfo.endStubX, paintInfo.endStubY];\n },\n stubCalculators = {\n perpendicular: commonStubCalculator,\n orthogonal: commonStubCalculator,\n opposite: function (axis) {\n var pi = paintInfo,\n idx = axis === \"x\" ? 0 : 1,\n areInProximity = {\n \"x\": function () {\n return ( (pi.so[idx] === 1 && (\n ( (pi.startStubX > pi.endStubX) && (pi.tx > pi.startStubX) ) ||\n ( (pi.sx > pi.endStubX) && (pi.tx > pi.sx))))) ||\n\n ( (pi.so[idx] === -1 && (\n ( (pi.startStubX < pi.endStubX) && (pi.tx < pi.startStubX) ) ||\n ( (pi.sx < pi.endStubX) && (pi.tx < pi.sx)))));\n },\n \"y\": function () {\n return ( (pi.so[idx] === 1 && (\n ( (pi.startStubY > pi.endStubY) && (pi.ty > pi.startStubY) ) ||\n ( (pi.sy > pi.endStubY) && (pi.ty > pi.sy))))) ||\n\n ( (pi.so[idx] === -1 && (\n ( (pi.startStubY < pi.endStubY) && (pi.ty < pi.startStubY) ) ||\n ( (pi.sy < pi.endStubY) && (pi.ty < pi.sy)))));\n }\n };\n\n if (!alwaysRespectStubs && areInProximity[axis]()) {\n return {\n \"x\": [(paintInfo.sx + paintInfo.tx) / 2, paintInfo.startStubY, (paintInfo.sx + paintInfo.tx) / 2, paintInfo.endStubY],\n \"y\": [paintInfo.startStubX, (paintInfo.sy + paintInfo.ty) / 2, paintInfo.endStubX, (paintInfo.sy + paintInfo.ty) / 2]\n }[axis];\n }\n else {\n return [paintInfo.startStubX, paintInfo.startStubY, paintInfo.endStubX, paintInfo.endStubY];\n }\n }\n };\n\n // calculate Stubs.\n var stubs = stubCalculators[paintInfo.anchorOrientation](paintInfo.sourceAxis),\n idx = paintInfo.sourceAxis === \"x\" ? 0 : 1,\n oidx = paintInfo.sourceAxis === \"x\" ? 1 : 0,\n ss = stubs[idx],\n oss = stubs[oidx],\n es = stubs[idx + 2],\n oes = stubs[oidx + 2];\n\n // add the start stub segment. use stubs for loopback as it will look better, with the loop spaced\n // away from the element.\n addSegment(segments, stubs[0], stubs[1], paintInfo);\n\n // if its a loopback and we should treat it differently.\n // if (false && params.sourcePos[0] === params.targetPos[0] && params.sourcePos[1] === params.targetPos[1]) {\n //\n // // we use loopbackRadius here, as statemachine connectors do.\n // // so we go radius to the left from stubs[0], then upwards by 2*radius, to the right by 2*radius,\n // // down by 2*radius, left by radius.\n // addSegment(segments, stubs[0] - loopbackRadius, stubs[1], paintInfo);\n // addSegment(segments, stubs[0] - loopbackRadius, stubs[1] - (2 * loopbackRadius), paintInfo);\n // addSegment(segments, stubs[0] + loopbackRadius, stubs[1] - (2 * loopbackRadius), paintInfo);\n // addSegment(segments, stubs[0] + loopbackRadius, stubs[1], paintInfo);\n // addSegment(segments, stubs[0], stubs[1], paintInfo);\n //\n // }\n // else {\n\n\n var midx = paintInfo.startStubX + ((paintInfo.endStubX - paintInfo.startStubX) * midpoint),\n midy = paintInfo.startStubY + ((paintInfo.endStubY - paintInfo.startStubY) * midpoint);\n\n var orientations = {x: [0, 1], y: [1, 0]},\n lineCalculators = {\n perpendicular: function (axis) {\n var pi = paintInfo,\n sis = {\n x: [\n [[1, 2, 3, 4], null, [2, 1, 4, 3]],\n null,\n [[4, 3, 2, 1], null, [3, 4, 1, 2]]\n ],\n y: [\n [[3, 2, 1, 4], null, [2, 3, 4, 1]],\n null,\n [[4, 1, 2, 3], null, [1, 4, 3, 2]]\n ]\n },\n stubs = {\n x: [[pi.startStubX, pi.endStubX], null, [pi.endStubX, pi.startStubX]],\n y: [[pi.startStubY, pi.endStubY], null, [pi.endStubY, pi.startStubY]]\n },\n midLines = {\n x: [[midx, pi.startStubY], [midx, pi.endStubY]],\n y: [[pi.startStubX, midy], [pi.endStubX, midy]]\n },\n linesToEnd = {\n x: [[pi.endStubX, pi.startStubY]],\n y: [[pi.startStubX, pi.endStubY]]\n },\n startToEnd = {\n x: [[pi.startStubX, pi.endStubY], [pi.endStubX, pi.endStubY]],\n y: [[pi.endStubX, pi.startStubY], [pi.endStubX, pi.endStubY]]\n },\n startToMidToEnd = {\n x: [[pi.startStubX, midy], [pi.endStubX, midy], [pi.endStubX, pi.endStubY]],\n y: [[midx, pi.startStubY], [midx, pi.endStubY], [pi.endStubX, pi.endStubY]]\n },\n otherStubs = {\n x: [pi.startStubY, pi.endStubY],\n y: [pi.startStubX, pi.endStubX]\n },\n soIdx = orientations[axis][0], toIdx = orientations[axis][1],\n _so = pi.so[soIdx] + 1,\n _to = pi.to[toIdx] + 1,\n otherFlipped = (pi.to[toIdx] === -1 && (otherStubs[axis][1] < otherStubs[axis][0])) || (pi.to[toIdx] === 1 && (otherStubs[axis][1] > otherStubs[axis][0])),\n stub1 = stubs[axis][_so][0],\n stub2 = stubs[axis][_so][1],\n segmentIndexes = sis[axis][_so][_to];\n\n if (pi.segment === segmentIndexes[3] || (pi.segment === segmentIndexes[2] && otherFlipped)) {\n return midLines[axis];\n }\n else if (pi.segment === segmentIndexes[2] && stub2 < stub1) {\n return linesToEnd[axis];\n }\n else if ((pi.segment === segmentIndexes[2] && stub2 >= stub1) || (pi.segment === segmentIndexes[1] && !otherFlipped)) {\n return startToMidToEnd[axis];\n }\n else if (pi.segment === segmentIndexes[0] || (pi.segment === segmentIndexes[1] && otherFlipped)) {\n return startToEnd[axis];\n }\n },\n orthogonal: function (axis, startStub, otherStartStub, endStub, otherEndStub) {\n var pi = paintInfo,\n extent = {\n \"x\": pi.so[0] === -1 ? Math.min(startStub, endStub) : Math.max(startStub, endStub),\n \"y\": pi.so[1] === -1 ? Math.min(startStub, endStub) : Math.max(startStub, endStub)\n }[axis];\n\n return {\n \"x\": [\n [extent, otherStartStub],\n [extent, otherEndStub],\n [endStub, otherEndStub]\n ],\n \"y\": [\n [otherStartStub, extent],\n [otherEndStub, extent],\n [otherEndStub, endStub]\n ]\n }[axis];\n },\n opposite: function (axis, ss, oss, es) {\n var pi = paintInfo,\n otherAxis = {\"x\": \"y\", \"y\": \"x\"}[axis],\n dim = {\"x\": \"height\", \"y\": \"width\"}[axis],\n comparator = pi[\"is\" + axis.toUpperCase() + \"GreaterThanStubTimes2\"];\n\n if (params.sourceEndpoint.elementId === params.targetEndpoint.elementId) {\n var _val = oss + ((1 - params.sourceEndpoint.anchor[otherAxis]) * params.sourceInfo[dim]) + _super.maxStub;\n return {\n \"x\": [\n [ss, _val],\n [es, _val]\n ],\n \"y\": [\n [_val, ss],\n [_val, es]\n ]\n }[axis];\n\n }\n else if (!comparator || (pi.so[idx] === 1 && ss > es) || (pi.so[idx] === -1 && ss < es)) {\n return {\n \"x\": [\n [ss, midy],\n [es, midy]\n ],\n \"y\": [\n [midx, ss],\n [midx, es]\n ]\n }[axis];\n }\n else if ((pi.so[idx] === 1 && ss < es) || (pi.so[idx] === -1 && ss > es)) {\n return {\n \"x\": [\n [midx, pi.sy],\n [midx, pi.ty]\n ],\n \"y\": [\n [pi.sx, midy],\n [pi.tx, midy]\n ]\n }[axis];\n }\n }\n };\n\n // compute the rest of the line\n var p = lineCalculators[paintInfo.anchorOrientation](paintInfo.sourceAxis, ss, oss, es, oes);\n if (p) {\n for (var i = 0; i < p.length; i++) {\n addSegment(segments, p[i][0], p[i][1], paintInfo);\n }\n }\n\n // line to end stub\n addSegment(segments, stubs[2], stubs[3], paintInfo);\n\n //}\n\n // end stub to end (common)\n addSegment(segments, paintInfo.tx, paintInfo.ty, paintInfo);\n\n _super.setGeometry({\n segments:segments,\n sourcePos:sp,\n targetPos:tp\n }, true);\n }\n\n // write out the segments.\n writeSegments(this, segments, paintInfo);\n\n };\n };\n\n _jp.Connectors.Flowchart = Flowchart;\n _ju.extend(_jp.Connectors.Flowchart, _jp.Connectors.AbstractConnector);\n\n}).call(typeof window !== 'undefined' ? window : this);\n/*\n * This file contains the code for the Bezier connector type.\n *\n * Copyright (c) 2010 - 2018 jsPlumb (hello@jsplumbtoolkit.com)\n *\n * https://jsplumbtoolkit.com\n * https://github.com/jsplumb/jsplumb\n *\n * Dual licensed under the MIT and GPL2 licenses.\n */\n;\n(function () {\n\n \"use strict\";\n var root = this, _jp = root.jsPlumb, _ju = root.jsPlumbUtil;\n\n _jp.Connectors.AbstractBezierConnector = function(params) {\n params = params || {};\n var showLoopback = params.showLoopback !== false,\n curviness = params.curviness || 10,\n margin = params.margin || 5,\n proximityLimit = params.proximityLimit || 80,\n clockwise = params.orientation && params.orientation === \"clockwise\",\n loopbackRadius = params.loopbackRadius || 25,\n isLoopbackCurrently = false,\n _super;\n\n this.overrideSetEditable = function() { return !isLoopbackCurrently; };\n\n this._compute = function (paintInfo, p) {\n\n var sp = p.sourcePos,\n tp = p.targetPos,\n _w = Math.abs(sp[0] - tp[0]),\n _h = Math.abs(sp[1] - tp[1]);\n\n if (!showLoopback || (p.sourceEndpoint.elementId !== p.targetEndpoint.elementId)) {\n isLoopbackCurrently = false;\n this._computeBezier(paintInfo, p, sp, tp, _w, _h);\n } else {\n isLoopbackCurrently = true;\n // a loopback connector. draw an arc from one anchor to the other.\n var x1 = p.sourcePos[0], y1 = p.sourcePos[1] - margin,\n cx = x1, cy = y1 - loopbackRadius,\n // canvas sizing stuff, to ensure the whole painted area is visible.\n _x = cx - loopbackRadius,\n _y = cy - loopbackRadius;\n\n _w = 2 * loopbackRadius;\n _h = 2 * loopbackRadius;\n\n paintInfo.points[0] = _x;\n paintInfo.points[1] = _y;\n paintInfo.points[2] = _w;\n paintInfo.points[3] = _h;\n\n // ADD AN ARC SEGMENT.\n _super.addSegment(this, \"Arc\", {\n loopback: true,\n x1: (x1 - _x) + 4,\n y1: y1 - _y,\n startAngle: 0,\n endAngle: 2 * Math.PI,\n r: loopbackRadius,\n ac: !clockwise,\n x2: (x1 - _x) - 4,\n y2: y1 - _y,\n cx: cx - _x,\n cy: cy - _y\n });\n }\n };\n\n _super = _jp.Connectors.AbstractConnector.apply(this, arguments);\n return _super;\n };\n _ju.extend(_jp.Connectors.AbstractBezierConnector, _jp.Connectors.AbstractConnector);\n\n var Bezier = function (params) {\n params = params || {};\n this.type = \"Bezier\";\n\n var _super = _jp.Connectors.AbstractBezierConnector.apply(this, arguments),\n majorAnchor = params.curviness || 150,\n minorAnchor = 10;\n\n this.getCurviness = function () {\n return majorAnchor;\n };\n\n this._findControlPoint = function (point, sourceAnchorPosition, targetAnchorPosition, sourceEndpoint, targetEndpoint, soo, too) {\n // determine if the two anchors are perpendicular to each other in their orientation. we swap the control\n // points around if so (code could be tightened up)\n var perpendicular = soo[0] !== too[0] || soo[1] === too[1],\n p = [];\n\n if (!perpendicular) {\n if (soo[0] === 0) {\n p.push(sourceAnchorPosition[0] < targetAnchorPosition[0] ? point[0] + minorAnchor : point[0] - minorAnchor);\n }\n else {\n p.push(point[0] - (majorAnchor * soo[0]));\n }\n\n if (soo[1] === 0) {\n p.push(sourceAnchorPosition[1] < targetAnchorPosition[1] ? point[1] + minorAnchor : point[1] - minorAnchor);\n }\n else {\n p.push(point[1] + (majorAnchor * too[1]));\n }\n }\n else {\n if (too[0] === 0) {\n p.push(targetAnchorPosition[0] < sourceAnchorPosition[0] ? point[0] + minorAnchor : point[0] - minorAnchor);\n }\n else {\n p.push(point[0] + (majorAnchor * too[0]));\n }\n\n if (too[1] === 0) {\n p.push(targetAnchorPosition[1] < sourceAnchorPosition[1] ? point[1] + minorAnchor : point[1] - minorAnchor);\n }\n else {\n p.push(point[1] + (majorAnchor * soo[1]));\n }\n }\n\n return p;\n };\n\n this._computeBezier = function (paintInfo, p, sp, tp, _w, _h) {\n\n var geometry = this.getGeometry(), _CP, _CP2,\n _sx = sp[0] < tp[0] ? _w : 0,\n _sy = sp[1] < tp[1] ? _h : 0,\n _tx = sp[0] < tp[0] ? 0 : _w,\n _ty = sp[1] < tp[1] ? 0 : _h;\n\n if ((this.hasBeenEdited() || this.isEditing()) && geometry != null && geometry.controlPoints != null && geometry.controlPoints[0] != null && geometry.controlPoints[1] != null) {\n _CP = geometry.controlPoints[0];\n _CP2 = geometry.controlPoints[1];\n }\n else {\n _CP = this._findControlPoint([_sx, _sy], sp, tp, p.sourceEndpoint, p.targetEndpoint, paintInfo.so, paintInfo.to);\n _CP2 = this._findControlPoint([_tx, _ty], tp, sp, p.targetEndpoint, p.sourceEndpoint, paintInfo.to, paintInfo.so);\n }\n\n _super.setGeometry({\n controlPoints:[_CP, _CP2],\n sourcePos:sp,\n targetPos:tp\n }, true);\n\n _super.addSegment(this, \"Bezier\", {\n x1: _sx, y1: _sy, x2: _tx, y2: _ty,\n cp1x: _CP[0], cp1y: _CP[1], cp2x: _CP2[0], cp2y: _CP2[1]\n });\n };\n\n\n };\n\n _jp.Connectors.Bezier = Bezier;\n _ju.extend(Bezier, _jp.Connectors.AbstractBezierConnector);\n\n}).call(typeof window !== 'undefined' ? window : this);\n/*\n * This file contains the state machine connectors, which extend AbstractBezierConnector.\n *\n * Copyright (c) 2010 - 2018 jsPlumb (hello@jsplumbtoolkit.com)\n *\n * https://jsplumbtoolkit.com\n * https://github.com/jsplumb/jsplumb\n * \n * Dual licensed under the MIT and GPL2 licenses.\n */\n;\n(function () {\n\n \"use strict\";\n var root = this, _jp = root.jsPlumb, _ju = root.jsPlumbUtil;\n\n var _segment = function (x1, y1, x2, y2) {\n if (x1 <= x2 && y2 <= y1) {\n return 1;\n }\n else if (x1 <= x2 && y1 <= y2) {\n return 2;\n }\n else if (x2 <= x1 && y2 >= y1) {\n return 3;\n }\n return 4;\n },\n\n // the control point we will use depends on the faces to which each end of the connection is assigned, specifically whether or not the\n // two faces are parallel or perpendicular. if they are parallel then the control point lies on the midpoint of the axis in which they\n // are parellel and varies only in the other axis; this variation is proportional to the distance that the anchor points lie from the\n // center of that face. if the two faces are perpendicular then the control point is at some distance from both the midpoints; the amount and\n // direction are dependent on the orientation of the two elements. 'seg', passed in to this method, tells you which segment the target element\n // lies in with respect to the source: 1 is top right, 2 is bottom right, 3 is bottom left, 4 is top left.\n //\n // sourcePos and targetPos are arrays of info about where on the source and target each anchor is located. their contents are:\n //\n // 0 - absolute x\n // 1 - absolute y\n // 2 - proportional x in element (0 is left edge, 1 is right edge)\n // 3 - proportional y in element (0 is top edge, 1 is bottom edge)\n //\n _findControlPoint = function (midx, midy, segment, sourceEdge, targetEdge, dx, dy, distance, proximityLimit) {\n // TODO (maybe)\n // - if anchor pos is 0.5, make the control point take into account the relative position of the elements.\n if (distance <= proximityLimit) {\n return [midx, midy];\n }\n\n if (segment === 1) {\n if (sourceEdge[3] <= 0 && targetEdge[3] >= 1) {\n return [ midx + (sourceEdge[2] < 0.5 ? -1 * dx : dx), midy ];\n }\n else if (sourceEdge[2] >= 1 && targetEdge[2] <= 0) {\n return [ midx, midy + (sourceEdge[3] < 0.5 ? -1 * dy : dy) ];\n }\n else {\n return [ midx + (-1 * dx) , midy + (-1 * dy) ];\n }\n }\n else if (segment === 2) {\n if (sourceEdge[3] >= 1 && targetEdge[3] <= 0) {\n return [ midx + (sourceEdge[2] < 0.5 ? -1 * dx : dx), midy ];\n }\n else if (sourceEdge[2] >= 1 && targetEdge[2] <= 0) {\n return [ midx, midy + (sourceEdge[3] < 0.5 ? -1 * dy : dy) ];\n }\n else {\n return [ midx + dx, midy + (-1 * dy) ];\n }\n }\n else if (segment === 3) {\n if (sourceEdge[3] >= 1 && targetEdge[3] <= 0) {\n return [ midx + (sourceEdge[2] < 0.5 ? -1 * dx : dx), midy ];\n }\n else if (sourceEdge[2] <= 0 && targetEdge[2] >= 1) {\n return [ midx, midy + (sourceEdge[3] < 0.5 ? -1 * dy : dy) ];\n }\n else {\n return [ midx + (-1 * dx) , midy + (-1 * dy) ];\n }\n }\n else if (segment === 4) {\n if (sourceEdge[3] <= 0 && targetEdge[3] >= 1) {\n return [ midx + (sourceEdge[2] < 0.5 ? -1 * dx : dx), midy ];\n }\n else if (sourceEdge[2] <= 0 && targetEdge[2] >= 1) {\n return [ midx, midy + (sourceEdge[3] < 0.5 ? -1 * dy : dy) ];\n }\n else {\n return [ midx + dx , midy + (-1 * dy) ];\n }\n }\n\n };\n\n var StateMachine = function (params) {\n params = params || {};\n this.type = \"StateMachine\";\n\n var _super = _jp.Connectors.AbstractBezierConnector.apply(this, arguments),\n curviness = params.curviness || 10,\n margin = params.margin || 5,\n proximityLimit = params.proximityLimit || 80,\n clockwise = params.orientation && params.orientation === \"clockwise\",\n _controlPoint;\n\n this._computeBezier = function(paintInfo, params, sp, tp, w, h) {\n var _sx = params.sourcePos[0] < params.targetPos[0] ? 0 : w,\n _sy = params.sourcePos[1] < params.targetPos[1] ? 0 : h,\n _tx = params.sourcePos[0] < params.targetPos[0] ? w : 0,\n _ty = params.sourcePos[1] < params.targetPos[1] ? h : 0;\n\n // now adjust for the margin\n if (params.sourcePos[2] === 0) {\n _sx -= margin;\n }\n if (params.sourcePos[2] === 1) {\n _sx += margin;\n }\n if (params.sourcePos[3] === 0) {\n _sy -= margin;\n }\n if (params.sourcePos[3] === 1) {\n _sy += margin;\n }\n if (params.targetPos[2] === 0) {\n _tx -= margin;\n }\n if (params.targetPos[2] === 1) {\n _tx += margin;\n }\n if (params.targetPos[3] === 0) {\n _ty -= margin;\n }\n if (params.targetPos[3] === 1) {\n _ty += margin;\n }\n\n //\n // these connectors are quadratic bezier curves, having a single control point. if both anchors\n // are located at 0.5 on their respective faces, the control point is set to the midpoint and you\n // get a straight line. this is also the case if the two anchors are within 'proximityLimit', since\n // it seems to make good aesthetic sense to do that. outside of that, the control point is positioned\n // at 'curviness' pixels away along the normal to the straight line connecting the two anchors.\n //\n // there may be two improvements to this. firstly, we might actually support the notion of avoiding nodes\n // in the UI, or at least making a good effort at doing so. if a connection would pass underneath some node,\n // for example, we might increase the distance the control point is away from the midpoint in a bid to\n // steer it around that node. this will work within limits, but i think those limits would also be the likely\n // limits for, once again, aesthetic good sense in the layout of a chart using these connectors.\n //\n // the second possible change is actually two possible changes: firstly, it is possible we should gradually\n // decrease the 'curviness' as the distance between the anchors decreases; start tailing it off to 0 at some\n // point (which should be configurable). secondly, we might slightly increase the 'curviness' for connectors\n // with respect to how far their anchor is from the center of its respective face. this could either look cool,\n // or stupid, and may indeed work only in a way that is so subtle as to have been a waste of time.\n //\n\n var _midx = (_sx + _tx) / 2,\n _midy = (_sy + _ty) / 2,\n segment = _segment(_sx, _sy, _tx, _ty),\n distance = Math.sqrt(Math.pow(_tx - _sx, 2) + Math.pow(_ty - _sy, 2)),\n cp1x, cp2x, cp1y, cp2y,\n geometry = _super.getGeometry();\n\n if ((this.hasBeenEdited() || this.isEditing()) && geometry != null) {\n cp1x = geometry.controlPoints[0][0];\n cp1y = geometry.controlPoints[0][1];\n cp2x = geometry.controlPoints[1][0];\n cp2y = geometry.controlPoints[1][1];\n }\n else {\n // calculate the control point. this code will be where we'll put in a rudimentary element avoidance scheme; it\n // will work by extending the control point to force the curve to be, um, curvier.\n _controlPoint = _findControlPoint(_midx,\n _midy,\n segment,\n params.sourcePos,\n params.targetPos,\n curviness, curviness,\n distance,\n proximityLimit);\n\n cp1x = _controlPoint[0];\n cp2x = _controlPoint[0];\n cp1y = _controlPoint[1];\n cp2y = _controlPoint[1];\n\n _super.setGeometry({\n controlPoints:[_controlPoint, _controlPoint],\n sourcePos:sp,\n targetPos:tp,\n quadrant:segment,\n curviness:curviness\n }, true);\n }\n\n _super.addSegment(this, \"Bezier\", {\n x1: _tx, y1: _ty, x2: _sx, y2: _sy,\n cp1x: cp1x, cp1y: cp1y,\n cp2x: cp2x, cp2y: cp2y\n });\n };\n };\n\n _jp.Connectors.StateMachine = StateMachine;\n _ju.extend(StateMachine, _jp.Connectors.AbstractBezierConnector);\n\n}).call(typeof window !== 'undefined' ? window : this);\n/*\n * This file contains the 'flowchart' connectors, consisting of vertical and horizontal line segments.\n *\n * Copyright (c) 2010 - 2018 jsPlumb (hello@jsplumbtoolkit.com)\n *\n * https://jsplumbtoolkit.com\n * https://github.com/jsplumb/jsplumb\n *\n * Dual licensed under the MIT and GPL2 licenses.\n */\n;\n(function () {\n\n \"use strict\";\n var root = this, _jp = root.jsPlumb, _ju = root.jsPlumbUtil;\n var STRAIGHT = \"Straight\";\n\n var Straight = function (params) {\n this.type = STRAIGHT;\n var _super = _jp.Connectors.AbstractConnector.apply(this, arguments);\n\n this._compute = function (paintInfo, _) {\n _super.addSegment(this, STRAIGHT, {x1: paintInfo.sx, y1: paintInfo.sy, x2: paintInfo.startStubX, y2: paintInfo.startStubY});\n _super.addSegment(this, STRAIGHT, {x1: paintInfo.startStubX, y1: paintInfo.startStubY, x2: paintInfo.endStubX, y2: paintInfo.endStubY});\n _super.addSegment(this, STRAIGHT, {x1: paintInfo.endStubX, y1: paintInfo.endStubY, x2: paintInfo.tx, y2: paintInfo.ty});\n };\n };\n\n _jp.Connectors.Straight = Straight;\n _ju.extend(Straight, _jp.Connectors.AbstractConnector);\n\n}).call(typeof window !== 'undefined' ? window : this);\n/*\n * This file contains the SVG renderers.\n *\n * Copyright (c) 2010 - 2018 jsPlumb (hello@jsplumbtoolkit.com)\n * \n * https://jsplumbtoolkit.com\n * https://github.com/jsplumb/jsplumb\n * \n * Dual licensed under the MIT and GPL2 licenses.\n */\n;\n(function () {\n\n// ************************** SVG utility methods ********************************************\t\n\n \"use strict\";\n var root = this, _jp = root.jsPlumb, _ju = root.jsPlumbUtil;\n\n var svgAttributeMap = {\n \"stroke-linejoin\": \"stroke-linejoin\",\n \"stroke-dashoffset\": \"stroke-dashoffset\",\n \"stroke-linecap\": \"stroke-linecap\"\n },\n STROKE_DASHARRAY = \"stroke-dasharray\",\n DASHSTYLE = \"dashstyle\",\n LINEAR_GRADIENT = \"linearGradient\",\n RADIAL_GRADIENT = \"radialGradient\",\n DEFS = \"defs\",\n FILL = \"fill\",\n STOP = \"stop\",\n STROKE = \"stroke\",\n STROKE_WIDTH = \"stroke-width\",\n STYLE = \"style\",\n NONE = \"none\",\n JSPLUMB_GRADIENT = \"jsplumb_gradient_\",\n LINE_WIDTH = \"strokeWidth\",\n ns = {\n svg: \"http://www.w3.org/2000/svg\"\n },\n _attr = function (node, attributes) {\n for (var i in attributes) {\n node.setAttribute(i, \"\" + attributes[i]);\n }\n },\n _node = function (name, attributes) {\n attributes = attributes || {};\n attributes.version = \"1.1\";\n attributes.xmlns = ns.svg;\n return _jp.createElementNS(ns.svg, name, null, null, attributes);\n },\n _pos = function (d) {\n return \"position:absolute;left:\" + d[0] + \"px;top:\" + d[1] + \"px\";\n },\n _clearGradient = function (parent) {\n var els = parent.querySelectorAll(\" defs,linearGradient,radialGradient\");\n for (var i = 0; i < els.length; i++) {\n els[i].parentNode.removeChild(els[i]);\n }\n },\n _updateGradient = function (parent, node, style, dimensions, uiComponent) {\n var id = JSPLUMB_GRADIENT + uiComponent._jsPlumb.instance.idstamp();\n // first clear out any existing gradient\n _clearGradient(parent);\n // this checks for an 'offset' property in the gradient, and in the absence of it, assumes\n // we want a linear gradient. if it's there, we create a radial gradient.\n // it is possible that a more explicit means of defining the gradient type would be\n // better. relying on 'offset' means that we can never have a radial gradient that uses\n // some default offset, for instance.\n // issue 244 suggested the 'gradientUnits' attribute; without this, straight/flowchart connectors with gradients would\n // not show gradients when the line was perfectly horizontal or vertical.\n var g;\n if (!style.gradient.offset) {\n g = _node(LINEAR_GRADIENT, {id: id, gradientUnits: \"userSpaceOnUse\"});\n }\n else {\n g = _node(RADIAL_GRADIENT, { id: id });\n }\n\n var defs = _node(DEFS);\n parent.appendChild(defs);\n defs.appendChild(g);\n\n // the svg radial gradient seems to treat stops in the reverse\n // order to how canvas does it. so we want to keep all the maths the same, but\n // iterate the actual style declarations in reverse order, if the x indexes are not in order.\n for (var i = 0; i < style.gradient.stops.length; i++) {\n var styleToUse = uiComponent.segment === 1 || uiComponent.segment === 2 ? i : style.gradient.stops.length - 1 - i,\n stopColor = style.gradient.stops[styleToUse][1],\n s = _node(STOP, {\"offset\": Math.floor(style.gradient.stops[i][0] * 100) + \"%\", \"stop-color\": stopColor});\n\n g.appendChild(s);\n }\n var applyGradientTo = style.stroke ? STROKE : FILL;\n node.setAttribute(applyGradientTo, \"url(#\" + id + \")\");\n },\n _applyStyles = function (parent, node, style, dimensions, uiComponent) {\n\n node.setAttribute(FILL, style.fill ? style.fill : NONE);\n node.setAttribute(STROKE, style.stroke ? style.stroke : NONE);\n\n if (style.gradient) {\n _updateGradient(parent, node, style, dimensions, uiComponent);\n }\n else {\n // make sure we clear any existing gradient\n _clearGradient(parent);\n node.setAttribute(STYLE, \"\");\n }\n\n if (style.strokeWidth) {\n node.setAttribute(STROKE_WIDTH, style.strokeWidth);\n }\n\n // in SVG there is a stroke-dasharray attribute we can set, and its syntax looks like\n // the syntax in VML but is actually kind of nasty: values are given in the pixel\n // coordinate space, whereas in VML they are multiples of the width of the stroked\n // line, which makes a lot more sense. for that reason, jsPlumb is supporting both\n // the native svg 'stroke-dasharray' attribute, and also the 'dashstyle' concept from\n // VML, which will be the preferred method. the code below this converts a dashstyle\n // attribute given in terms of stroke width into a pixel representation, by using the\n // stroke's lineWidth.\n if (style[DASHSTYLE] && style[LINE_WIDTH] && !style[STROKE_DASHARRAY]) {\n var sep = style[DASHSTYLE].indexOf(\",\") === -1 ? \" \" : \",\",\n parts = style[DASHSTYLE].split(sep),\n styleToUse = \"\";\n parts.forEach(function (p) {\n styleToUse += (Math.floor(p * style.strokeWidth) + sep);\n });\n node.setAttribute(STROKE_DASHARRAY, styleToUse);\n }\n else if (style[STROKE_DASHARRAY]) {\n node.setAttribute(STROKE_DASHARRAY, style[STROKE_DASHARRAY]);\n }\n\n // extra attributes such as join type, dash offset.\n for (var i in svgAttributeMap) {\n if (style[i]) {\n node.setAttribute(svgAttributeMap[i], style[i]);\n }\n }\n },\n _appendAtIndex = function (svg, path, idx) {\n if (svg.childNodes.length > idx) {\n svg.insertBefore(path, svg.childNodes[idx]);\n }\n else {\n svg.appendChild(path);\n }\n };\n\n /**\n utility methods for other objects to use.\n */\n _ju.svg = {\n node: _node,\n attr: _attr,\n pos: _pos\n };\n\n // ************************** / SVG utility methods ********************************************\n\n /*\n * Base class for SVG components.\n */\n var SvgComponent = function (params) {\n var pointerEventsSpec = params.pointerEventsSpec || \"all\", renderer = {};\n\n _jp.jsPlumbUIComponent.apply(this, params.originalArgs);\n this.canvas = null;\n this.path = null;\n this.svg = null;\n this.bgCanvas = null;\n\n var clazz = params.cssClass + \" \" + (params.originalArgs[0].cssClass || \"\"),\n svgParams = {\n \"style\": \"\",\n \"width\": 0,\n \"height\": 0,\n \"pointer-events\": pointerEventsSpec,\n \"position\": \"absolute\"\n };\n\n this.svg = _node(\"svg\", svgParams);\n\n if (params.useDivWrapper) {\n this.canvas = _jp.createElement(\"div\", { position : \"absolute\" });\n _ju.sizeElement(this.canvas, 0, 0, 1, 1);\n this.canvas.className = clazz;\n }\n else {\n _attr(this.svg, { \"class\": clazz });\n this.canvas = this.svg;\n }\n\n params._jsPlumb.appendElement(this.canvas, params.originalArgs[0].parent);\n if (params.useDivWrapper) {\n this.canvas.appendChild(this.svg);\n }\n\n var displayElements = [ this.canvas ];\n this.getDisplayElements = function () {\n return displayElements;\n };\n\n this.appendDisplayElement = function (el) {\n displayElements.push(el);\n };\n\n this.paint = function (style, anchor, extents) {\n if (style != null) {\n\n var xy = [ this.x, this.y ], wh = [ this.w, this.h ], p;\n if (extents != null) {\n if (extents.xmin < 0) {\n xy[0] += extents.xmin;\n }\n if (extents.ymin < 0) {\n xy[1] += extents.ymin;\n }\n wh[0] = extents.xmax + ((extents.xmin < 0) ? -extents.xmin : 0);\n wh[1] = extents.ymax + ((extents.ymin < 0) ? -extents.ymin : 0);\n }\n\n if (params.useDivWrapper) {\n _ju.sizeElement(this.canvas, xy[0], xy[1], wh[0], wh[1]);\n xy[0] = 0;\n xy[1] = 0;\n p = _pos([ 0, 0 ]);\n }\n else {\n p = _pos([ xy[0], xy[1] ]);\n }\n\n renderer.paint.apply(this, arguments);\n\n _attr(this.svg, {\n \"style\": p,\n \"width\": wh[0] || 0,\n \"height\": wh[1] || 0\n });\n }\n };\n\n return {\n renderer: renderer\n };\n };\n\n _ju.extend(SvgComponent, _jp.jsPlumbUIComponent, {\n cleanup: function (force) {\n if (force || this.typeId == null) {\n if (this.canvas) {\n this.canvas._jsPlumb = null;\n }\n if (this.svg) {\n this.svg._jsPlumb = null;\n }\n if (this.bgCanvas) {\n this.bgCanvas._jsPlumb = null;\n }\n\n if (this.canvas && this.canvas.parentNode) {\n this.canvas.parentNode.removeChild(this.canvas);\n }\n if (this.bgCanvas && this.bgCanvas.parentNode) {\n this.canvas.parentNode.removeChild(this.canvas);\n }\n\n this.svg = null;\n this.canvas = null;\n this.path = null;\n this.group = null;\n }\n else {\n // if not a forced cleanup, just detach from DOM for now.\n if (this.canvas && this.canvas.parentNode) {\n this.canvas.parentNode.removeChild(this.canvas);\n }\n if (this.bgCanvas && this.bgCanvas.parentNode) {\n this.bgCanvas.parentNode.removeChild(this.bgCanvas);\n }\n }\n },\n reattach:function(instance) {\n var c = instance.getContainer();\n if (this.canvas && this.canvas.parentNode == null) {\n c.appendChild(this.canvas);\n }\n if (this.bgCanvas && this.bgCanvas.parentNode == null) {\n c.appendChild(this.bgCanvas);\n }\n },\n setVisible: function (v) {\n if (this.canvas) {\n this.canvas.style.display = v ? \"block\" : \"none\";\n }\n }\n });\n\n /*\n * Base class for SVG connectors.\n */\n _jp.ConnectorRenderers.svg = function (params) {\n var self = this,\n _super = SvgComponent.apply(this, [\n {\n cssClass: params._jsPlumb.connectorClass + (this.isEditable() ? \" \" + params._jsPlumb.editableConnectorClass : \"\"),\n originalArgs: arguments,\n pointerEventsSpec: \"none\",\n _jsPlumb: params._jsPlumb\n }\n ]);\n\n var _superSetEditable = this.setEditable;\n this.setEditable = function(e) {\n var result = _superSetEditable.apply(this, [e]);\n _jp[result ? \"addClass\" : \"removeClass\"](this.canvas, this._jsPlumb.instance.editableConnectorClass);\n };\n\n _super.renderer.paint = function (style, anchor, extents) {\n\n var segments = self.getSegments(), p = \"\", offset = [0, 0];\n if (extents.xmin < 0) {\n offset[0] = -extents.xmin;\n }\n if (extents.ymin < 0) {\n offset[1] = -extents.ymin;\n }\n\n if (segments.length > 0) {\n\n p = self.getPathData();\n\n var a = {\n d: p,\n transform: \"translate(\" + offset[0] + \",\" + offset[1] + \")\",\n \"pointer-events\": params[\"pointer-events\"] || \"visibleStroke\"\n },\n outlineStyle = null,\n d = [self.x, self.y, self.w, self.h];\n\n // outline style. actually means drawing an svg object underneath the main one.\n if (style.outlineStroke) {\n var outlineWidth = style.outlineWidth || 1,\n outlineStrokeWidth = style.strokeWidth + (2 * outlineWidth);\n outlineStyle = _jp.extend({}, style);\n delete outlineStyle.gradient;\n outlineStyle.stroke = style.outlineStroke;\n outlineStyle.strokeWidth = outlineStrokeWidth;\n\n if (self.bgPath == null) {\n self.bgPath = _node(\"path\", a);\n _jp.addClass(self.bgPath, _jp.connectorOutlineClass);\n _appendAtIndex(self.svg, self.bgPath, 0);\n }\n else {\n _attr(self.bgPath, a);\n }\n\n _applyStyles(self.svg, self.bgPath, outlineStyle, d, self);\n }\n\n if (self.path == null) {\n self.path = _node(\"path\", a);\n _appendAtIndex(self.svg, self.path, style.outlineStroke ? 1 : 0);\n }\n else {\n _attr(self.path, a);\n }\n\n _applyStyles(self.svg, self.path, style, d, self);\n }\n };\n };\n _ju.extend(_jp.ConnectorRenderers.svg, SvgComponent);\n\n// ******************************* svg segment renderer *****************************************************\t\n\n\n// ******************************* /svg segments *****************************************************\n\n /*\n * Base class for SVG endpoints.\n */\n var SvgEndpoint = _jp.SvgEndpoint = function (params) {\n var _super = SvgComponent.apply(this, [\n {\n cssClass: params._jsPlumb.endpointClass,\n originalArgs: arguments,\n pointerEventsSpec: \"all\",\n useDivWrapper: true,\n _jsPlumb: params._jsPlumb\n }\n ]);\n\n _super.renderer.paint = function (style) {\n var s = _jp.extend({}, style);\n if (s.outlineStroke) {\n s.stroke = s.outlineStroke;\n }\n\n if (this.node == null) {\n this.node = this.makeNode(s);\n this.svg.appendChild(this.node);\n }\n else if (this.updateNode != null) {\n this.updateNode(this.node);\n }\n _applyStyles(this.svg, this.node, s, [ this.x, this.y, this.w, this.h ], this);\n _pos(this.node, [ this.x, this.y ]);\n }.bind(this);\n\n };\n _ju.extend(SvgEndpoint, SvgComponent);\n\n /*\n * SVG Dot Endpoint\n */\n _jp.Endpoints.svg.Dot = function () {\n _jp.Endpoints.Dot.apply(this, arguments);\n SvgEndpoint.apply(this, arguments);\n this.makeNode = function (style) {\n return _node(\"circle\", {\n \"cx\": this.w / 2,\n \"cy\": this.h / 2,\n \"r\": this.radius\n });\n };\n this.updateNode = function (node) {\n _attr(node, {\n \"cx\": this.w / 2,\n \"cy\": this.h / 2,\n \"r\": this.radius\n });\n };\n };\n _ju.extend(_jp.Endpoints.svg.Dot, [_jp.Endpoints.Dot, SvgEndpoint]);\n\n /*\n * SVG Rectangle Endpoint\n */\n _jp.Endpoints.svg.Rectangle = function () {\n _jp.Endpoints.Rectangle.apply(this, arguments);\n SvgEndpoint.apply(this, arguments);\n this.makeNode = function (style) {\n return _node(\"rect\", {\n \"width\": this.w,\n \"height\": this.h\n });\n };\n this.updateNode = function (node) {\n _attr(node, {\n \"width\": this.w,\n \"height\": this.h\n });\n };\n };\n _ju.extend(_jp.Endpoints.svg.Rectangle, [_jp.Endpoints.Rectangle, SvgEndpoint]);\n\n// ---------------------------------- Connectors ------------------------------------------------------------\n\n\n _jp.Connectors.svg.Flowchart = function() {\n _jp.Connectors.Flowchart.apply(this, arguments);\n _jp.ConnectorRenderers.svg.apply(this, arguments);\n };\n\n _ju.extend(_jp.Connectors.svg.Flowchart, [ _jp.Connectors.Flowchart, _jp.ConnectorRenderers.svg]);\n\n\n\n _jp.Connectors.svg.Bezier = function() {\n _jp.Connectors.Bezier.apply(this, arguments);\n _jp.ConnectorRenderers.svg.apply(this, arguments);\n };\n\n _ju.extend(_jp.Connectors.svg.Bezier, [ _jp.Connectors.Bezier, _jp.ConnectorRenderers.svg]);\n\n _jp.Connectors.svg.Straight = function() {\n _jp.Connectors.Straight.apply(this, arguments);\n _jp.ConnectorRenderers.svg.apply(this, arguments);\n };\n\n _ju.extend(_jp.Connectors.svg.Straight, [ _jp.Connectors.Straight, _jp.ConnectorRenderers.svg]);\n\n\n _jp.Connectors.svg.StateMachine = function() {\n _jp.Connectors.StateMachine.apply(this, arguments);\n _jp.ConnectorRenderers.svg.apply(this, arguments);\n };\n\n _ju.extend(_jp.Connectors.svg.StateMachine, [ _jp.Connectors.StateMachine, _jp.ConnectorRenderers.svg]);\n\n\n// ------------------------------------------ / Connectors -----------------------------------------\n\n /*\n * SVG Image Endpoint is the default image endpoint.\n */\n _jp.Endpoints.svg.Image = _jp.Endpoints.Image;\n /*\n * Blank endpoint in svg renderer is the default Blank endpoint.\n */\n _jp.Endpoints.svg.Blank = _jp.Endpoints.Blank;\n /*\n * Label overlay in svg renderer is the default Label overlay.\n */\n _jp.Overlays.svg.Label = _jp.Overlays.Label;\n /*\n * Custom overlay in svg renderer is the default Custom overlay.\n */\n _jp.Overlays.svg.Custom = _jp.Overlays.Custom;\n\n var AbstractSvgArrowOverlay = function (superclass, originalArgs) {\n superclass.apply(this, originalArgs);\n _jp.jsPlumbUIComponent.apply(this, originalArgs);\n this.isAppendedAtTopLevel = false;\n var self = this;\n this.path = null;\n this.paint = function (params, containerExtents) {\n // only draws on connections, not endpoints.\n if (params.component.svg && containerExtents) {\n if (this.path == null) {\n this.path = _node(\"path\", {\n \"pointer-events\": \"all\"\n });\n params.component.svg.appendChild(this.path);\n if (this.elementCreated) {\n this.elementCreated(this.path, params.component);\n }\n\n this.canvas = params.component.svg; // for the sake of completeness; this behaves the same as other overlays\n }\n var clazz = originalArgs && (originalArgs.length === 1) ? (originalArgs[0].cssClass || \"\") : \"\",\n offset = [0, 0];\n\n if (containerExtents.xmin < 0) {\n offset[0] = -containerExtents.xmin;\n }\n if (containerExtents.ymin < 0) {\n offset[1] = -containerExtents.ymin;\n }\n\n _attr(this.path, {\n \"d\": makePath(params.d),\n \"class\": clazz,\n stroke: params.stroke ? params.stroke : null,\n fill: params.fill ? params.fill : null,\n transform: \"translate(\" + offset[0] + \",\" + offset[1] + \")\"\n });\n }\n };\n var makePath = function (d) {\n return (isNaN(d.cxy.x) || isNaN(d.cxy.y)) ? \"\" : \"M\" + d.hxy.x + \",\" + d.hxy.y +\n \" L\" + d.tail[0].x + \",\" + d.tail[0].y +\n \" L\" + d.cxy.x + \",\" + d.cxy.y +\n \" L\" + d.tail[1].x + \",\" + d.tail[1].y +\n \" L\" + d.hxy.x + \",\" + d.hxy.y;\n };\n this.transfer = function(target) {\n if (target.canvas && this.path && this.path.parentNode) {\n this.path.parentNode.removeChild(this.path);\n target.canvas.appendChild(this.path);\n }\n };\n };\n _ju.extend(AbstractSvgArrowOverlay, [_jp.jsPlumbUIComponent, _jp.Overlays.AbstractOverlay], {\n cleanup: function (force) {\n if (this.path != null) {\n if (force) {\n this._jsPlumb.instance.removeElement(this.path);\n }\n else {\n if (this.path.parentNode) {\n this.path.parentNode.removeChild(this.path);\n }\n }\n }\n },\n reattach:function(instance, component) {\n if (this.path && component.canvas) {\n component.canvas.appendChild(this.path);\n }\n },\n setVisible: function (v) {\n if (this.path != null) {\n (this.path.style.display = (v ? \"block\" : \"none\"));\n }\n }\n });\n\n _jp.Overlays.svg.Arrow = function () {\n AbstractSvgArrowOverlay.apply(this, [_jp.Overlays.Arrow, arguments]);\n };\n _ju.extend(_jp.Overlays.svg.Arrow, [ _jp.Overlays.Arrow, AbstractSvgArrowOverlay ]);\n\n _jp.Overlays.svg.PlainArrow = function () {\n AbstractSvgArrowOverlay.apply(this, [_jp.Overlays.PlainArrow, arguments]);\n };\n _ju.extend(_jp.Overlays.svg.PlainArrow, [ _jp.Overlays.PlainArrow, AbstractSvgArrowOverlay ]);\n\n _jp.Overlays.svg.Diamond = function () {\n AbstractSvgArrowOverlay.apply(this, [_jp.Overlays.Diamond, arguments]);\n };\n _ju.extend(_jp.Overlays.svg.Diamond, [ _jp.Overlays.Diamond, AbstractSvgArrowOverlay ]);\n\n // a test\n _jp.Overlays.svg.GuideLines = function () {\n var path = null, self = this, p1_1, p1_2;\n _jp.Overlays.GuideLines.apply(this, arguments);\n this.paint = function (params, containerExtents) {\n if (path == null) {\n path = _node(\"path\");\n params.connector.svg.appendChild(path);\n self.attachListeners(path, params.connector);\n self.attachListeners(path, self);\n\n p1_1 = _node(\"path\");\n params.connector.svg.appendChild(p1_1);\n self.attachListeners(p1_1, params.connector);\n self.attachListeners(p1_1, self);\n\n p1_2 = _node(\"path\");\n params.connector.svg.appendChild(p1_2);\n self.attachListeners(p1_2, params.connector);\n self.attachListeners(p1_2, self);\n }\n\n var offset = [0, 0];\n if (containerExtents.xmin < 0) {\n offset[0] = -containerExtents.xmin;\n }\n if (containerExtents.ymin < 0) {\n offset[1] = -containerExtents.ymin;\n }\n\n _attr(path, {\n \"d\": makePath(params.head, params.tail),\n stroke: \"red\",\n fill: null,\n transform: \"translate(\" + offset[0] + \",\" + offset[1] + \")\"\n });\n\n _attr(p1_1, {\n \"d\": makePath(params.tailLine[0], params.tailLine[1]),\n stroke: \"blue\",\n fill: null,\n transform: \"translate(\" + offset[0] + \",\" + offset[1] + \")\"\n });\n\n _attr(p1_2, {\n \"d\": makePath(params.headLine[0], params.headLine[1]),\n stroke: \"green\",\n fill: null,\n transform: \"translate(\" + offset[0] + \",\" + offset[1] + \")\"\n });\n };\n\n var makePath = function (d1, d2) {\n return \"M \" + d1.x + \",\" + d1.y +\n \" L\" + d2.x + \",\" + d2.y;\n };\n };\n _ju.extend(_jp.Overlays.svg.GuideLines, _jp.Overlays.GuideLines);\n}).call(typeof window !== 'undefined' ? window : this);\n\n/*\n * This file contains the 'vanilla' adapter - having no external dependencies other than bundled libs.\n *\n * Copyright (c) 2010 - 2018 jsPlumb (hello@jsplumbtoolkit.com)\n * \n * https://jsplumbtoolkit.com\n * https://github.com/jsplumb/jsplumb\n * \n * Dual licensed under the MIT and GPL2 licenses.\n */\n;\n(function () {\n\n \"use strict\";\n var root = this, _jp = root.jsPlumb, _ju = root.jsPlumbUtil,\n _jk = root.Katavorio, _jg = root.Biltong;\n\n var _getDragManager = function (instance, category) {\n\n category = category || \"main\";\n var key = \"_katavorio_\" + category;\n var k = instance[key],\n e = instance.getEventManager();\n\n if (!k) {\n k = new _jk({\n bind: e.on,\n unbind: e.off,\n getSize: _jp.getSize,\n getConstrainingRectangle:function(el) {\n return [ el.parentNode.scrollWidth, el.parentNode.scrollHeight ];\n },\n getPosition: function (el, relativeToRoot) {\n // if this is a nested draggable then compute the offset against its own offsetParent, otherwise\n // compute against the Container's origin. see also the getUIPosition method below.\n var o = instance.getOffset(el, relativeToRoot, el._katavorioDrag ? el.offsetParent : null);\n return [o.left, o.top];\n },\n setPosition: function (el, xy) {\n el.style.left = xy[0] + \"px\";\n el.style.top = xy[1] + \"px\";\n },\n addClass: _jp.addClass,\n removeClass: _jp.removeClass,\n intersects: _jg.intersects,\n indexOf: function(l, i) { return l.indexOf(i); },\n scope:instance.getDefaultScope(),\n css: {\n noSelect: instance.dragSelectClass,\n droppable: \"jtk-droppable\",\n draggable: \"jtk-draggable\",\n drag: \"jtk-drag\",\n selected: \"jtk-drag-selected\",\n active: \"jtk-drag-active\",\n hover: \"jtk-drag-hover\",\n ghostProxy:\"jtk-ghost-proxy\"\n }\n });\n k.setZoom(instance.getZoom());\n instance[key] = k;\n instance.bind(\"zoom\", k.setZoom);\n }\n return k;\n };\n\n var _animProps = function (o, p) {\n var _one = function (pName) {\n if (p[pName] != null) {\n if (_ju.isString(p[pName])) {\n var m = p[pName].match(/-=/) ? -1 : 1,\n v = p[pName].substring(2);\n return o[pName] + (m * v);\n }\n else {\n return p[pName];\n }\n }\n else {\n return o[pName];\n }\n };\n return [ _one(\"left\"), _one(\"top\") ];\n };\n\n _jp.extend(root.jsPlumbInstance.prototype, {\n\n animationSupported:true,\n getElement: function (el) {\n if (el == null) {\n return null;\n }\n // here we pluck the first entry if el was a list of entries.\n // this is not my favourite thing to do, but previous versions of\n // jsplumb supported jquery selectors, and it is possible a selector\n // will be passed in here.\n el = typeof el === \"string\" ? el : el.length != null && el.enctype == null ? el[0] : el;\n return typeof el === \"string\" ? document.getElementById(el) : el;\n },\n removeElement: function (element) {\n _getDragManager(this).elementRemoved(element);\n this.getEventManager().remove(element);\n },\n //\n // this adapter supports a rudimentary animation function. no easing is supported. only\n // left/top properties are supported. property delta args are expected to be in the form\n //\n // +=x.xxxx\n //\n // or\n //\n // -=x.xxxx\n //\n doAnimate: function (el, properties, options) {\n options = options || {};\n var o = this.getOffset(el),\n ap = _animProps(o, properties),\n ldist = ap[0] - o.left,\n tdist = ap[1] - o.top,\n d = options.duration || 250,\n step = 15, steps = d / step,\n linc = (step / d) * ldist,\n tinc = (step / d) * tdist,\n idx = 0,\n _int = setInterval(function () {\n _jp.setPosition(el, {\n left: o.left + (linc * (idx + 1)),\n top: o.top + (tinc * (idx + 1))\n });\n if (options.step != null) {\n options.step(idx, Math.ceil(steps));\n }\n idx++;\n if (idx >= steps) {\n window.clearInterval(_int);\n if (options.complete != null) {\n options.complete();\n }\n }\n }, step);\n },\n // DRAG/DROP\n destroyDraggable: function (el, category) {\n _getDragManager(this, category).destroyDraggable(el);\n },\n unbindDraggable: function (el, evt, fn, category) {\n _getDragManager(this, category).destroyDraggable(el, evt, fn);\n },\n destroyDroppable: function (el, category) {\n _getDragManager(this, category).destroyDroppable(el);\n },\n unbindDroppable: function (el, evt, fn, category) {\n _getDragManager(this, category).destroyDroppable(el, evt, fn);\n },\n initDraggable: function (el, options, category) {\n _getDragManager(this, category).draggable(el, options);\n },\n initDroppable: function (el, options, category) {\n _getDragManager(this, category).droppable(el, options);\n },\n isAlreadyDraggable: function (el) {\n return el._katavorioDrag != null;\n },\n isDragSupported: function (el, options) {\n return true;\n },\n isDropSupported: function (el, options) {\n return true;\n },\n isElementDraggable: function (el) {\n el = _jp.getElement(el);\n return el._katavorioDrag && el._katavorioDrag.isEnabled();\n },\n getDragObject: function (eventArgs) {\n return eventArgs[0].drag.getDragElement();\n },\n getDragScope: function (el) {\n return el._katavorioDrag && el._katavorioDrag.scopes.join(\" \") || \"\";\n },\n getDropEvent: function (args) {\n return args[0].e;\n },\n getUIPosition: function (eventArgs, zoom) {\n // here the position reported to us by Katavorio is relative to the element's offsetParent. For top\n // level nodes that is fine, but if we have a nested draggable then its offsetParent is actually\n // not going to be the jsplumb container; it's going to be some child of that element. In that case\n // we want to adjust the UI position to account for the offsetParent's position relative to the Container\n // origin.\n var el = eventArgs[0].el;\n if (el.offsetParent == null) {\n return null;\n }\n var finalPos = eventArgs[0].finalPos || eventArgs[0].pos;\n var p = { left:finalPos[0], top:finalPos[1] };\n if (el._katavorioDrag && el.offsetParent !== this.getContainer()) {\n var oc = this.getOffset(el.offsetParent);\n p.left += oc.left;\n p.top += oc.top;\n }\n return p;\n },\n setDragFilter: function (el, filter, _exclude) {\n if (el._katavorioDrag) {\n el._katavorioDrag.setFilter(filter, _exclude);\n }\n },\n setElementDraggable: function (el, draggable) {\n el = _jp.getElement(el);\n if (el._katavorioDrag) {\n el._katavorioDrag.setEnabled(draggable);\n }\n },\n setDragScope: function (el, scope) {\n if (el._katavorioDrag) {\n el._katavorioDrag.k.setDragScope(el, scope);\n }\n },\n setDropScope:function(el, scope) {\n if (el._katavorioDrop && el._katavorioDrop.length > 0) {\n el._katavorioDrop[0].k.setDropScope(el, scope);\n }\n },\n addToPosse:function(el, spec) {\n var specs = Array.prototype.slice.call(arguments, 1);\n var dm = _getDragManager(this);\n _jp.each(el, function(_el) {\n _el = [ _jp.getElement(_el) ];\n _el.push.apply(_el, specs );\n dm.addToPosse.apply(dm, _el);\n });\n },\n setPosse:function(el, spec) {\n var specs = Array.prototype.slice.call(arguments, 1);\n var dm = _getDragManager(this);\n _jp.each(el, function(_el) {\n _el = [ _jp.getElement(_el) ];\n _el.push.apply(_el, specs );\n dm.setPosse.apply(dm, _el);\n });\n },\n removeFromPosse:function(el, posseId) {\n var specs = Array.prototype.slice.call(arguments, 1);\n var dm = _getDragManager(this);\n _jp.each(el, function(_el) {\n _el = [ _jp.getElement(_el) ];\n _el.push.apply(_el, specs );\n dm.removeFromPosse.apply(dm, _el);\n });\n },\n removeFromAllPosses:function(el) {\n var dm = _getDragManager(this);\n _jp.each(el, function(_el) { dm.removeFromAllPosses(_jp.getElement(_el)); });\n },\n setPosseState:function(el, posseId, state) {\n var dm = _getDragManager(this);\n _jp.each(el, function(_el) { dm.setPosseState(_jp.getElement(_el), posseId, state); });\n },\n dragEvents: {\n 'start': 'start', 'stop': 'stop', 'drag': 'drag', 'step': 'step',\n 'over': 'over', 'out': 'out', 'drop': 'drop', 'complete': 'complete',\n 'beforeStart':'beforeStart'\n },\n animEvents: {\n 'step': \"step\", 'complete': 'complete'\n },\n stopDrag: function (el) {\n if (el._katavorioDrag) {\n el._katavorioDrag.abort();\n }\n },\n addToDragSelection: function (spec) {\n _getDragManager(this).select(spec);\n },\n removeFromDragSelection: function (spec) {\n _getDragManager(this).deselect(spec);\n },\n clearDragSelection: function () {\n _getDragManager(this).deselectAll();\n },\n trigger: function (el, event, originalEvent, payload) {\n this.getEventManager().trigger(el, event, originalEvent, payload);\n },\n doReset:function() {\n // look for katavorio instances and reset each one if found.\n for (var key in this) {\n if (key.indexOf(\"_katavorio_\") === 0) {\n this[key].reset();\n }\n }\n }\n });\n\n var ready = function (f) {\n var _do = function () {\n if (/complete|loaded|interactive/.test(document.readyState) && typeof(document.body) !== \"undefined\" && document.body != null) {\n f();\n }\n else {\n setTimeout(_do, 9);\n }\n };\n\n _do();\n };\n ready(_jp.init);\n\n}).call(typeof window !== 'undefined' ? window : this);\n","'use strict';\n\n/* !\n * Chai - checkError utility\n * Copyright(c) 2012-2016 Jake Luer <jake@alogicalparadox.com>\n * MIT Licensed\n */\n\n/**\n * ### .checkError\n *\n * Checks that an error conforms to a given set of criteria and/or retrieves information about it.\n *\n * @api public\n */\n\n/**\n * ### .compatibleInstance(thrown, errorLike)\n *\n * Checks if two instances are compatible (strict equal).\n * Returns false if errorLike is not an instance of Error, because instances\n * can only be compatible if they're both error instances.\n *\n * @name compatibleInstance\n * @param {Error} thrown error\n * @param {Error|ErrorConstructor} errorLike object to compare against\n * @namespace Utils\n * @api public\n */\n\nfunction compatibleInstance(thrown, errorLike) {\n return errorLike instanceof Error && thrown === errorLike;\n}\n\n/**\n * ### .compatibleConstructor(thrown, errorLike)\n *\n * Checks if two constructors are compatible.\n * This function can receive either an error constructor or\n * an error instance as the `errorLike` argument.\n * Constructors are compatible if they're the same or if one is\n * an instance of another.\n *\n * @name compatibleConstructor\n * @param {Error} thrown error\n * @param {Error|ErrorConstructor} errorLike object to compare against\n * @namespace Utils\n * @api public\n */\n\nfunction compatibleConstructor(thrown, errorLike) {\n if (errorLike instanceof Error) {\n // If `errorLike` is an instance of any error we compare their constructors\n return thrown.constructor === errorLike.constructor || thrown instanceof errorLike.constructor;\n } else if (errorLike.prototype instanceof Error || errorLike === Error) {\n // If `errorLike` is a constructor that inherits from Error, we compare `thrown` to `errorLike` directly\n return thrown.constructor === errorLike || thrown instanceof errorLike;\n }\n\n return false;\n}\n\n/**\n * ### .compatibleMessage(thrown, errMatcher)\n *\n * Checks if an error's message is compatible with a matcher (String or RegExp).\n * If the message contains the String or passes the RegExp test,\n * it is considered compatible.\n *\n * @name compatibleMessage\n * @param {Error} thrown error\n * @param {String|RegExp} errMatcher to look for into the message\n * @namespace Utils\n * @api public\n */\n\nfunction compatibleMessage(thrown, errMatcher) {\n var comparisonString = typeof thrown === 'string' ? thrown : thrown.message;\n if (errMatcher instanceof RegExp) {\n return errMatcher.test(comparisonString);\n } else if (typeof errMatcher === 'string') {\n return comparisonString.indexOf(errMatcher) !== -1; // eslint-disable-line no-magic-numbers\n }\n\n return false;\n}\n\n/**\n * ### .getFunctionName(constructorFn)\n *\n * Returns the name of a function.\n * This also includes a polyfill function if `constructorFn.name` is not defined.\n *\n * @name getFunctionName\n * @param {Function} constructorFn\n * @namespace Utils\n * @api private\n */\n\nvar functionNameMatch = /\\s*function(?:\\s|\\s*\\/\\*[^(?:*\\/)]+\\*\\/\\s*)*([^\\(\\/]+)/;\nfunction getFunctionName(constructorFn) {\n var name = '';\n if (typeof constructorFn.name === 'undefined') {\n // Here we run a polyfill if constructorFn.name is not defined\n var match = String(constructorFn).match(functionNameMatch);\n if (match) {\n name = match[1];\n }\n } else {\n name = constructorFn.name;\n }\n\n return name;\n}\n\n/**\n * ### .getConstructorName(errorLike)\n *\n * Gets the constructor name for an Error instance or constructor itself.\n *\n * @name getConstructorName\n * @param {Error|ErrorConstructor} errorLike\n * @namespace Utils\n * @api public\n */\n\nfunction getConstructorName(errorLike) {\n var constructorName = errorLike;\n if (errorLike instanceof Error) {\n constructorName = getFunctionName(errorLike.constructor);\n } else if (typeof errorLike === 'function') {\n // If `err` is not an instance of Error it is an error constructor itself or another function.\n // If we've got a common function we get its name, otherwise we may need to create a new instance\n // of the error just in case it's a poorly-constructed error. Please see chaijs/chai/issues/45 to know more.\n constructorName = getFunctionName(errorLike).trim() ||\n getFunctionName(new errorLike()); // eslint-disable-line new-cap\n }\n\n return constructorName;\n}\n\n/**\n * ### .getMessage(errorLike)\n *\n * Gets the error message from an error.\n * If `err` is a String itself, we return it.\n * If the error has no message, we return an empty string.\n *\n * @name getMessage\n * @param {Error|String} errorLike\n * @namespace Utils\n * @api public\n */\n\nfunction getMessage(errorLike) {\n var msg = '';\n if (errorLike && errorLike.message) {\n msg = errorLike.message;\n } else if (typeof errorLike === 'string') {\n msg = errorLike;\n }\n\n return msg;\n}\n\nmodule.exports = {\n compatibleInstance: compatibleInstance,\n compatibleConstructor: compatibleConstructor,\n compatibleMessage: compatibleMessage,\n getMessage: getMessage,\n getConstructorName: getConstructorName,\n};\n","/*!\n * Chai - getOwnEnumerablePropertySymbols utility\n * Copyright(c) 2011-2016 Jake Luer <jake@alogicalparadox.com>\n * MIT Licensed\n */\n\n/**\n * ### .getOwnEnumerablePropertySymbols(object)\n *\n * This allows the retrieval of directly-owned enumerable property symbols of an\n * object. This function is necessary because Object.getOwnPropertySymbols\n * returns both enumerable and non-enumerable property symbols.\n *\n * @param {Object} object\n * @returns {Array}\n * @namespace Utils\n * @name getOwnEnumerablePropertySymbols\n * @api public\n */\n\nmodule.exports = function getOwnEnumerablePropertySymbols(obj) {\n if (typeof Object.getOwnPropertySymbols !== 'function') return [];\n\n return Object.getOwnPropertySymbols(obj).filter(function (sym) {\n return Object.getOwnPropertyDescriptor(obj, sym).enumerable;\n });\n};\n","/*!\n * Chai - flag utility\n * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>\n * MIT Licensed\n */\n\n/*!\n * Module dependancies\n */\n\nvar inspect = require('./inspect');\nvar config = require('../config');\n\n/**\n * ### .objDisplay(object)\n *\n * Determines if an object or an array matches\n * criteria to be inspected in-line for error\n * messages or should be truncated.\n *\n * @param {Mixed} javascript object to inspect\n * @name objDisplay\n * @namespace Utils\n * @api public\n */\n\nmodule.exports = function objDisplay(obj) {\n var str = inspect(obj)\n , type = Object.prototype.toString.call(obj);\n\n if (config.truncateThreshold && str.length >= config.truncateThreshold) {\n if (type === '[object Function]') {\n return !obj.name || obj.name === ''\n ? '[Function]'\n : '[Function: ' + obj.name + ']';\n } else if (type === '[object Array]') {\n return '[ Array(' + obj.length + ') ]';\n } else if (type === '[object Object]') {\n var keys = Object.keys(obj)\n , kstr = keys.length > 2\n ? keys.splice(0, 2).join(', ') + ', ...'\n : keys.join(', ');\n return '{ Object (' + kstr + ') }';\n } else {\n return str;\n }\n } else {\n return str;\n }\n};\n","/*!\n * Chai - getProperties utility\n * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>\n * MIT Licensed\n */\n\n/**\n * ### .getProperties(object)\n *\n * This allows the retrieval of property names of an object, enumerable or not,\n * inherited or not.\n *\n * @param {Object} object\n * @returns {Array}\n * @namespace Utils\n * @name getProperties\n * @api public\n */\n\nmodule.exports = function getProperties(object) {\n var result = Object.getOwnPropertyNames(object);\n\n function addProperty(property) {\n if (result.indexOf(property) === -1) {\n result.push(property);\n }\n }\n\n var proto = Object.getPrototypeOf(object);\n while (proto !== null) {\n Object.getOwnPropertyNames(proto).forEach(addProperty);\n proto = Object.getPrototypeOf(proto);\n }\n\n return result;\n};\n","'use strict';\n\n/* !\n * Chai - getFuncName utility\n * Copyright(c) 2012-2016 Jake Luer <jake@alogicalparadox.com>\n * MIT Licensed\n */\n\n/**\n * ### .getFuncName(constructorFn)\n *\n * Returns the name of a function.\n * When a non-function instance is passed, returns `null`.\n * This also includes a polyfill function if `aFunc.name` is not defined.\n *\n * @name getFuncName\n * @param {Function} funct\n * @namespace Utils\n * @api public\n */\n\nvar toString = Function.prototype.toString;\nvar functionNameMatch = /\\s*function(?:\\s|\\s*\\/\\*[^(?:*\\/)]+\\*\\/\\s*)*([^\\s\\(\\/]+)/;\nfunction getFuncName(aFunc) {\n if (typeof aFunc !== 'function') {\n return null;\n }\n\n var name = '';\n if (typeof Function.prototype.name === 'undefined' && typeof aFunc.name === 'undefined') {\n // Here we run a polyfill if Function does not support the `name` property and if aFunc.name is not defined\n var match = toString.call(aFunc).match(functionNameMatch);\n if (match) {\n name = match[1];\n }\n } else {\n // If we've got a `name` property we just use it\n name = aFunc.name;\n }\n\n return name;\n}\n\nmodule.exports = getFuncName;\n","/*!\n * Chai - getActual utility\n * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>\n * MIT Licensed\n */\n\n/**\n * ### .getActual(object, [actual])\n *\n * Returns the `actual` value for an Assertion.\n *\n * @param {Object} object (constructed Assertion)\n * @param {Arguments} chai.Assertion.prototype.assert arguments\n * @namespace Utils\n * @name getActual\n */\n\nmodule.exports = function getActual(obj, args) {\n return args.length > 4 ? args[4] : obj._obj;\n};\n","/*!\n * assertion-error\n * Copyright(c) 2013 Jake Luer <jake@qualiancy.com>\n * MIT Licensed\n */\n\n/*!\n * Return a function that will copy properties from\n * one object to another excluding any originally\n * listed. Returned function will create a new `{}`.\n *\n * @param {String} excluded properties ...\n * @return {Function}\n */\n\nfunction exclude () {\n var excludes = [].slice.call(arguments);\n\n function excludeProps (res, obj) {\n Object.keys(obj).forEach(function (key) {\n if (!~excludes.indexOf(key)) res[key] = obj[key];\n });\n }\n\n return function extendExclude () {\n var args = [].slice.call(arguments)\n , i = 0\n , res = {};\n\n for (; i < args.length; i++) {\n excludeProps(res, args[i]);\n }\n\n return res;\n };\n};\n\n/*!\n * Primary Exports\n */\n\nmodule.exports = AssertionError;\n\n/**\n * ### AssertionError\n *\n * An extension of the JavaScript `Error` constructor for\n * assertion and validation scenarios.\n *\n * @param {String} message\n * @param {Object} properties to include (optional)\n * @param {callee} start stack function (optional)\n */\n\nfunction AssertionError (message, _props, ssf) {\n var extend = exclude('name', 'message', 'stack', 'constructor', 'toJSON')\n , props = extend(_props || {});\n\n // default values\n this.message = message || 'Unspecified AssertionError';\n this.showDiff = false;\n\n // copy from properties\n for (var key in props) {\n this[key] = props[key];\n }\n\n // capture stack trace\n ssf = ssf || AssertionError;\n if (Error.captureStackTrace) {\n Error.captureStackTrace(this, ssf);\n } else {\n try {\n throw new Error();\n } catch(e) {\n this.stack = e.stack;\n }\n }\n}\n\n/*!\n * Inherit from Error.prototype\n */\n\nAssertionError.prototype = Object.create(Error.prototype);\n\n/*!\n * Statically set name\n */\n\nAssertionError.prototype.name = 'AssertionError';\n\n/*!\n * Ensure correct constructor\n */\n\nAssertionError.prototype.constructor = AssertionError;\n\n/**\n * Allow errors to be converted to JSON for static transfer.\n *\n * @param {Boolean} include stack (default: `true`)\n * @return {Object} object that can be `JSON.stringify`\n */\n\nAssertionError.prototype.toJSON = function (stack) {\n var extend = exclude('constructor', 'toJSON', 'stack')\n , props = extend({ name: this.name }, this);\n\n // include stack if exists and not turned off\n if (false !== stack && this.stack) {\n props.stack = this.stack;\n }\n\n return props;\n};\n","\"use strict\";\n/* eslint-disable no-invalid-this */\nlet checkError = require(\"check-error\");\n\nmodule.exports = (chai, utils) => {\n const Assertion = chai.Assertion;\n const assert = chai.assert;\n const proxify = utils.proxify;\n\n // If we are using a version of Chai that has checkError on it,\n // we want to use that version to be consistent. Otherwise, we use\n // what was passed to the factory.\n if (utils.checkError) {\n checkError = utils.checkError;\n }\n\n function isLegacyJQueryPromise(thenable) {\n // jQuery promises are Promises/A+-compatible since 3.0.0. jQuery 3.0.0 is also the first version\n // to define the catch method.\n return typeof thenable.catch !== \"function\" &&\n typeof thenable.always === \"function\" &&\n typeof thenable.done === \"function\" &&\n typeof thenable.fail === \"function\" &&\n typeof thenable.pipe === \"function\" &&\n typeof thenable.progress === \"function\" &&\n typeof thenable.state === \"function\";\n }\n\n function assertIsAboutPromise(assertion) {\n if (typeof assertion._obj.then !== \"function\") {\n throw new TypeError(utils.inspect(assertion._obj) + \" is not a thenable.\");\n }\n if (isLegacyJQueryPromise(assertion._obj)) {\n throw new TypeError(\"Chai as Promised is incompatible with thenables of jQuery<3.0.0, sorry! Please \" +\n \"upgrade jQuery or use another Promises/A+ compatible library (see \" +\n \"http://promisesaplus.com/).\");\n }\n }\n\n function proxifyIfSupported(assertion) {\n return proxify === undefined ? assertion : proxify(assertion);\n }\n\n function method(name, asserter) {\n utils.addMethod(Assertion.prototype, name, function () {\n assertIsAboutPromise(this);\n return asserter.apply(this, arguments);\n });\n }\n\n function property(name, asserter) {\n utils.addProperty(Assertion.prototype, name, function () {\n assertIsAboutPromise(this);\n return proxifyIfSupported(asserter.apply(this, arguments));\n });\n }\n\n function doNotify(promise, done) {\n promise.then(() => done(), done);\n }\n\n // These are for clarity and to bypass Chai refusing to allow `undefined` as actual when used with `assert`.\n function assertIfNegated(assertion, message, extra) {\n assertion.assert(true, null, message, extra.expected, extra.actual);\n }\n\n function assertIfNotNegated(assertion, message, extra) {\n assertion.assert(false, message, null, extra.expected, extra.actual);\n }\n\n function getBasePromise(assertion) {\n // We need to chain subsequent asserters on top of ones in the chain already (consider\n // `eventually.have.property(\"foo\").that.equals(\"bar\")`), only running them after the existing ones pass.\n // So the first base-promise is `assertion._obj`, but after that we use the assertions themselves, i.e.\n // previously derived promises, to chain off of.\n return typeof assertion.then === \"function\" ? assertion : assertion._obj;\n }\n\n function getReasonName(reason) {\n return reason instanceof Error ? reason.toString() : checkError.getConstructorName(reason);\n }\n\n // Grab these first, before we modify `Assertion.prototype`.\n\n const propertyNames = Object.getOwnPropertyNames(Assertion.prototype);\n\n const propertyDescs = {};\n for (const name of propertyNames) {\n propertyDescs[name] = Object.getOwnPropertyDescriptor(Assertion.prototype, name);\n }\n\n property(\"fulfilled\", function () {\n const derivedPromise = getBasePromise(this).then(\n value => {\n assertIfNegated(this,\n \"expected promise not to be fulfilled but it was fulfilled with #{act}\",\n { actual: value });\n return value;\n },\n reason => {\n assertIfNotNegated(this,\n \"expected promise to be fulfilled but it was rejected with #{act}\",\n { actual: getReasonName(reason) });\n return reason;\n }\n );\n\n module.exports.transferPromiseness(this, derivedPromise);\n return this;\n });\n\n property(\"rejected\", function () {\n const derivedPromise = getBasePromise(this).then(\n value => {\n assertIfNotNegated(this,\n \"expected promise to be rejected but it was fulfilled with #{act}\",\n { actual: value });\n return value;\n },\n reason => {\n assertIfNegated(this,\n \"expected promise not to be rejected but it was rejected with #{act}\",\n { actual: getReasonName(reason) });\n\n // Return the reason, transforming this into a fulfillment, to allow further assertions, e.g.\n // `promise.should.be.rejected.and.eventually.equal(\"reason\")`.\n return reason;\n }\n );\n\n module.exports.transferPromiseness(this, derivedPromise);\n return this;\n });\n\n method(\"rejectedWith\", function (errorLike, errMsgMatcher, message) {\n let errorLikeName = null;\n const negate = utils.flag(this, \"negate\") || false;\n\n // rejectedWith with that is called without arguments is\n // the same as a plain \".rejected\" use.\n if (errorLike === undefined && errMsgMatcher === undefined &&\n message === undefined) {\n /* eslint-disable no-unused-expressions */\n return this.rejected;\n /* eslint-enable no-unused-expressions */\n }\n\n if (message !== undefined) {\n utils.flag(this, \"message\", message);\n }\n\n if (errorLike instanceof RegExp || typeof errorLike === \"string\") {\n errMsgMatcher = errorLike;\n errorLike = null;\n } else if (errorLike && errorLike instanceof Error) {\n errorLikeName = errorLike.toString();\n } else if (typeof errorLike === \"function\") {\n errorLikeName = checkError.getConstructorName(errorLike);\n } else {\n errorLike = null;\n }\n const everyArgIsDefined = Boolean(errorLike && errMsgMatcher);\n\n let matcherRelation = \"including\";\n if (errMsgMatcher instanceof RegExp) {\n matcherRelation = \"matching\";\n }\n\n const derivedPromise = getBasePromise(this).then(\n value => {\n let assertionMessage = null;\n let expected = null;\n\n if (errorLike) {\n assertionMessage = \"expected promise to be rejected with #{exp} but it was fulfilled with #{act}\";\n expected = errorLikeName;\n } else if (errMsgMatcher) {\n assertionMessage = `expected promise to be rejected with an error ${matcherRelation} #{exp} but ` +\n `it was fulfilled with #{act}`;\n expected = errMsgMatcher;\n }\n\n assertIfNotNegated(this, assertionMessage, { expected, actual: value });\n return value;\n },\n reason => {\n const errorLikeCompatible = errorLike && (errorLike instanceof Error ?\n checkError.compatibleInstance(reason, errorLike) :\n checkError.compatibleConstructor(reason, errorLike));\n\n const errMsgMatcherCompatible = errMsgMatcher && checkError.compatibleMessage(reason, errMsgMatcher);\n\n const reasonName = getReasonName(reason);\n\n if (negate && everyArgIsDefined) {\n if (errorLikeCompatible && errMsgMatcherCompatible) {\n this.assert(true,\n null,\n \"expected promise not to be rejected with #{exp} but it was rejected \" +\n \"with #{act}\",\n errorLikeName,\n reasonName);\n }\n } else {\n if (errorLike) {\n this.assert(errorLikeCompatible,\n \"expected promise to be rejected with #{exp} but it was rejected with #{act}\",\n \"expected promise not to be rejected with #{exp} but it was rejected \" +\n \"with #{act}\",\n errorLikeName,\n reasonName);\n }\n\n if (errMsgMatcher) {\n this.assert(errMsgMatcherCompatible,\n `expected promise to be rejected with an error ${matcherRelation} #{exp} but got ` +\n `#{act}`,\n `expected promise not to be rejected with an error ${matcherRelation} #{exp}`,\n errMsgMatcher,\n checkError.getMessage(reason));\n }\n }\n\n return reason;\n }\n );\n\n module.exports.transferPromiseness(this, derivedPromise);\n return this;\n });\n\n property(\"eventually\", function () {\n utils.flag(this, \"eventually\", true);\n return this;\n });\n\n method(\"notify\", function (done) {\n doNotify(getBasePromise(this), done);\n return this;\n });\n\n method(\"become\", function (value, message) {\n return this.eventually.deep.equal(value, message);\n });\n\n // ### `eventually`\n\n // We need to be careful not to trigger any getters, thus `Object.getOwnPropertyDescriptor` usage.\n const methodNames = propertyNames.filter(name => {\n return name !== \"assert\" && typeof propertyDescs[name].value === \"function\";\n });\n\n methodNames.forEach(methodName => {\n Assertion.overwriteMethod(methodName, originalMethod => function () {\n return doAsserterAsyncAndAddThen(originalMethod, this, arguments);\n });\n });\n\n const getterNames = propertyNames.filter(name => {\n return name !== \"_obj\" && typeof propertyDescs[name].get === \"function\";\n });\n\n getterNames.forEach(getterName => {\n // Chainable methods are things like `an`, which can work both for `.should.be.an.instanceOf` and as\n // `should.be.an(\"object\")`. We need to handle those specially.\n const isChainableMethod = Assertion.prototype.__methods.hasOwnProperty(getterName);\n\n if (isChainableMethod) {\n Assertion.overwriteChainableMethod(\n getterName,\n originalMethod => function () {\n return doAsserterAsyncAndAddThen(originalMethod, this, arguments);\n },\n originalGetter => function () {\n return doAsserterAsyncAndAddThen(originalGetter, this);\n }\n );\n } else {\n Assertion.overwriteProperty(getterName, originalGetter => function () {\n return proxifyIfSupported(doAsserterAsyncAndAddThen(originalGetter, this));\n });\n }\n });\n\n function doAsserterAsyncAndAddThen(asserter, assertion, args) {\n // Since we're intercepting all methods/properties, we need to just pass through if they don't want\n // `eventually`, or if we've already fulfilled the promise (see below).\n if (!utils.flag(assertion, \"eventually\")) {\n asserter.apply(assertion, args);\n return assertion;\n }\n\n const derivedPromise = getBasePromise(assertion).then(value => {\n // Set up the environment for the asserter to actually run: `_obj` should be the fulfillment value, and\n // now that we have the value, we're no longer in \"eventually\" mode, so we won't run any of this code,\n // just the base Chai code that we get to via the short-circuit above.\n assertion._obj = value;\n utils.flag(assertion, \"eventually\", false);\n\n return args ? module.exports.transformAsserterArgs(args) : args;\n }).then(newArgs => {\n asserter.apply(assertion, newArgs);\n\n // Because asserters, for example `property`, can change the value of `_obj` (i.e. change the \"object\"\n // flag), we need to communicate this value change to subsequent chained asserters. Since we build a\n // promise chain paralleling the asserter chain, we can use it to communicate such changes.\n return assertion._obj;\n });\n\n module.exports.transferPromiseness(assertion, derivedPromise);\n return assertion;\n }\n\n // ### Now use the `Assertion` framework to build an `assert` interface.\n const originalAssertMethods = Object.getOwnPropertyNames(assert).filter(propName => {\n return typeof assert[propName] === \"function\";\n });\n\n assert.isFulfilled = (promise, message) => (new Assertion(promise, message)).to.be.fulfilled;\n\n assert.isRejected = (promise, errorLike, errMsgMatcher, message) => {\n const assertion = new Assertion(promise, message);\n return assertion.to.be.rejectedWith(errorLike, errMsgMatcher, message);\n };\n\n assert.becomes = (promise, value, message) => assert.eventually.deepEqual(promise, value, message);\n\n assert.doesNotBecome = (promise, value, message) => assert.eventually.notDeepEqual(promise, value, message);\n\n assert.eventually = {};\n originalAssertMethods.forEach(assertMethodName => {\n assert.eventually[assertMethodName] = function (promise) {\n const otherArgs = Array.prototype.slice.call(arguments, 1);\n\n let customRejectionHandler;\n const message = arguments[assert[assertMethodName].length - 1];\n if (typeof message === \"string\") {\n customRejectionHandler = reason => {\n throw new chai.AssertionError(`${message}\\n\\nOriginal reason: ${utils.inspect(reason)}`);\n };\n }\n\n const returnedPromise = promise.then(\n fulfillmentValue => assert[assertMethodName].apply(assert, [fulfillmentValue].concat(otherArgs)),\n customRejectionHandler\n );\n\n returnedPromise.notify = done => {\n doNotify(returnedPromise, done);\n };\n\n return returnedPromise;\n };\n });\n};\n\nmodule.exports.transferPromiseness = (assertion, promise) => {\n assertion.then = promise.then.bind(promise);\n};\n\nmodule.exports.transformAsserterArgs = values => values;\n","/*!\n * chai\n * Copyright(c) 2011-2014 Jake Luer <jake@alogicalparadox.com>\n * MIT Licensed\n */\n\n\nmodule.exports = function (chai, util) {\n\n /*!\n * Chai dependencies.\n */\n\n var Assertion = chai.Assertion\n , flag = util.flag;\n\n /*!\n * Module export.\n */\n\n /**\n * ### assert(expression, message)\n *\n * Write your own test expressions.\n *\n * assert('foo' !== 'bar', 'foo is not bar');\n * assert(Array.isArray([]), 'empty arrays are arrays');\n *\n * @param {Mixed} expression to test for truthiness\n * @param {String} message to display on error\n * @name assert\n * @namespace Assert\n * @api public\n */\n\n var assert = chai.assert = function (express, errmsg) {\n var test = new Assertion(null, null, chai.assert, true);\n test.assert(\n express\n , errmsg\n , '[ negation message unavailable ]'\n );\n };\n\n /**\n * ### .fail(actual, expected, [message], [operator])\n *\n * Throw a failure. Node.js `assert` module-compatible.\n *\n * @name fail\n * @param {Mixed} actual\n * @param {Mixed} expected\n * @param {String} message\n * @param {String} operator\n * @namespace Assert\n * @api public\n */\n\n assert.fail = function (actual, expected, message, operator) {\n message = message || 'assert.fail()';\n throw new chai.AssertionError(message, {\n actual: actual\n , expected: expected\n , operator: operator\n }, assert.fail);\n };\n\n /**\n * ### .isOk(object, [message])\n *\n * Asserts that `object` is truthy.\n *\n * assert.isOk('everything', 'everything is ok');\n * assert.isOk(false, 'this will fail');\n *\n * @name isOk\n * @alias ok\n * @param {Mixed} object to test\n * @param {String} message\n * @namespace Assert\n * @api public\n */\n\n assert.isOk = function (val, msg) {\n new Assertion(val, msg, assert.isOk, true).is.ok;\n };\n\n /**\n * ### .isNotOk(object, [message])\n *\n * Asserts that `object` is falsy.\n *\n * assert.isNotOk('everything', 'this will fail');\n * assert.isNotOk(false, 'this will pass');\n *\n * @name isNotOk\n * @alias notOk\n * @param {Mixed} object to test\n * @param {String} message\n * @namespace Assert\n * @api public\n */\n\n assert.isNotOk = function (val, msg) {\n new Assertion(val, msg, assert.isNotOk, true).is.not.ok;\n };\n\n /**\n * ### .equal(actual, expected, [message])\n *\n * Asserts non-strict equality (`==`) of `actual` and `expected`.\n *\n * assert.equal(3, '3', '== coerces values to strings');\n *\n * @name equal\n * @param {Mixed} actual\n * @param {Mixed} expected\n * @param {String} message\n * @namespace Assert\n * @api public\n */\n\n assert.equal = function (act, exp, msg) {\n var test = new Assertion(act, msg, assert.equal, true);\n\n test.assert(\n exp == flag(test, 'object')\n , 'expected #{this} to equal #{exp}'\n , 'expected #{this} to not equal #{act}'\n , exp\n , act\n , true\n );\n };\n\n /**\n * ### .notEqual(actual, expected, [message])\n *\n * Asserts non-strict inequality (`!=`) of `actual` and `expected`.\n *\n * assert.notEqual(3, 4, 'these numbers are not equal');\n *\n * @name notEqual\n * @param {Mixed} actual\n * @param {Mixed} expected\n * @param {String} message\n * @namespace Assert\n * @api public\n */\n\n assert.notEqual = function (act, exp, msg) {\n var test = new Assertion(act, msg, assert.notEqual, true);\n\n test.assert(\n exp != flag(test, 'object')\n , 'expected #{this} to not equal #{exp}'\n , 'expected #{this} to equal #{act}'\n , exp\n , act\n , true\n );\n };\n\n /**\n * ### .strictEqual(actual, expected, [message])\n *\n * Asserts strict equality (`===`) of `actual` and `expected`.\n *\n * assert.strictEqual(true, true, 'these booleans are strictly equal');\n *\n * @name strictEqual\n * @param {Mixed} actual\n * @param {Mixed} expected\n * @param {String} message\n * @namespace Assert\n * @api public\n */\n\n assert.strictEqual = function (act, exp, msg) {\n new Assertion(act, msg, assert.strictEqual, true).to.equal(exp);\n };\n\n /**\n * ### .notStrictEqual(actual, expected, [message])\n *\n * Asserts strict inequality (`!==`) of `actual` and `expected`.\n *\n * assert.notStrictEqual(3, '3', 'no coercion for strict equality');\n *\n * @name notStrictEqual\n * @param {Mixed} actual\n * @param {Mixed} expected\n * @param {String} message\n * @namespace Assert\n * @api public\n */\n\n assert.notStrictEqual = function (act, exp, msg) {\n new Assertion(act, msg, assert.notStrictEqual, true).to.not.equal(exp);\n };\n\n /**\n * ### .deepEqual(actual, expected, [message])\n *\n * Asserts that `actual` is deeply equal to `expected`.\n *\n * assert.deepEqual({ tea: 'green' }, { tea: 'green' });\n *\n * @name deepEqual\n * @param {Mixed} actual\n * @param {Mixed} expected\n * @param {String} message\n * @alias deepStrictEqual\n * @namespace Assert\n * @api public\n */\n\n assert.deepEqual = assert.deepStrictEqual = function (act, exp, msg) {\n new Assertion(act, msg, assert.deepEqual, true).to.eql(exp);\n };\n\n /**\n * ### .notDeepEqual(actual, expected, [message])\n *\n * Assert that `actual` is not deeply equal to `expected`.\n *\n * assert.notDeepEqual({ tea: 'green' }, { tea: 'jasmine' });\n *\n * @name notDeepEqual\n * @param {Mixed} actual\n * @param {Mixed} expected\n * @param {String} message\n * @namespace Assert\n * @api public\n */\n\n assert.notDeepEqual = function (act, exp, msg) {\n new Assertion(act, msg, assert.notDeepEqual, true).to.not.eql(exp);\n };\n\n /**\n * ### .isAbove(valueToCheck, valueToBeAbove, [message])\n *\n * Asserts `valueToCheck` is strictly greater than (>) `valueToBeAbove`.\n *\n * assert.isAbove(5, 2, '5 is strictly greater than 2');\n *\n * @name isAbove\n * @param {Mixed} valueToCheck\n * @param {Mixed} valueToBeAbove\n * @param {String} message\n * @namespace Assert\n * @api public\n */\n\n assert.isAbove = function (val, abv, msg) {\n new Assertion(val, msg, assert.isAbove, true).to.be.above(abv);\n };\n\n /**\n * ### .isAtLeast(valueToCheck, valueToBeAtLeast, [message])\n *\n * Asserts `valueToCheck` is greater than or equal to (>=) `valueToBeAtLeast`.\n *\n * assert.isAtLeast(5, 2, '5 is greater or equal to 2');\n * assert.isAtLeast(3, 3, '3 is greater or equal to 3');\n *\n * @name isAtLeast\n * @param {Mixed} valueToCheck\n * @param {Mixed} valueToBeAtLeast\n * @param {String} message\n * @namespace Assert\n * @api public\n */\n\n assert.isAtLeast = function (val, atlst, msg) {\n new Assertion(val, msg, assert.isAtLeast, true).to.be.least(atlst);\n };\n\n /**\n * ### .isBelow(valueToCheck, valueToBeBelow, [message])\n *\n * Asserts `valueToCheck` is strictly less than (<) `valueToBeBelow`.\n *\n * assert.isBelow(3, 6, '3 is strictly less than 6');\n *\n * @name isBelow\n * @param {Mixed} valueToCheck\n * @param {Mixed} valueToBeBelow\n * @param {String} message\n * @namespace Assert\n * @api public\n */\n\n assert.isBelow = function (val, blw, msg) {\n new Assertion(val, msg, assert.isBelow, true).to.be.below(blw);\n };\n\n /**\n * ### .isAtMost(valueToCheck, valueToBeAtMost, [message])\n *\n * Asserts `valueToCheck` is less than or equal to (<=) `valueToBeAtMost`.\n *\n * assert.isAtMost(3, 6, '3 is less than or equal to 6');\n * assert.isAtMost(4, 4, '4 is less than or equal to 4');\n *\n * @name isAtMost\n * @param {Mixed} valueToCheck\n * @param {Mixed} valueToBeAtMost\n * @param {String} message\n * @namespace Assert\n * @api public\n */\n\n assert.isAtMost = function (val, atmst, msg) {\n new Assertion(val, msg, assert.isAtMost, true).to.be.most(atmst);\n };\n\n /**\n * ### .isTrue(value, [message])\n *\n * Asserts that `value` is true.\n *\n * var teaServed = true;\n * assert.isTrue(teaServed, 'the tea has been served');\n *\n * @name isTrue\n * @param {Mixed} value\n * @param {String} message\n * @namespace Assert\n * @api public\n */\n\n assert.isTrue = function (val, msg) {\n new Assertion(val, msg, assert.isTrue, true).is['true'];\n };\n\n /**\n * ### .isNotTrue(value, [message])\n *\n * Asserts that `value` is not true.\n *\n * var tea = 'tasty chai';\n * assert.isNotTrue(tea, 'great, time for tea!');\n *\n * @name isNotTrue\n * @param {Mixed} value\n * @param {String} message\n * @namespace Assert\n * @api public\n */\n\n assert.isNotTrue = function (val, msg) {\n new Assertion(val, msg, assert.isNotTrue, true).to.not.equal(true);\n };\n\n /**\n * ### .isFalse(value, [message])\n *\n * Asserts that `value` is false.\n *\n * var teaServed = false;\n * assert.isFalse(teaServed, 'no tea yet? hmm...');\n *\n * @name isFalse\n * @param {Mixed} value\n * @param {String} message\n * @namespace Assert\n * @api public\n */\n\n assert.isFalse = function (val, msg) {\n new Assertion(val, msg, assert.isFalse, true).is['false'];\n };\n\n /**\n * ### .isNotFalse(value, [message])\n *\n * Asserts that `value` is not false.\n *\n * var tea = 'tasty chai';\n * assert.isNotFalse(tea, 'great, time for tea!');\n *\n * @name isNotFalse\n * @param {Mixed} value\n * @param {String} message\n * @namespace Assert\n * @api public\n */\n\n assert.isNotFalse = function (val, msg) {\n new Assertion(val, msg, assert.isNotFalse, true).to.not.equal(false);\n };\n\n /**\n * ### .isNull(value, [message])\n *\n * Asserts that `value` is null.\n *\n * assert.isNull(err, 'there was no error');\n *\n * @name isNull\n * @param {Mixed} value\n * @param {String} message\n * @namespace Assert\n * @api public\n */\n\n assert.isNull = function (val, msg) {\n new Assertion(val, msg, assert.isNull, true).to.equal(null);\n };\n\n /**\n * ### .isNotNull(value, [message])\n *\n * Asserts that `value` is not null.\n *\n * var tea = 'tasty chai';\n * assert.isNotNull(tea, 'great, time for tea!');\n *\n * @name isNotNull\n * @param {Mixed} value\n * @param {String} message\n * @namespace Assert\n * @api public\n */\n\n assert.isNotNull = function (val, msg) {\n new Assertion(val, msg, assert.isNotNull, true).to.not.equal(null);\n };\n\n /**\n * ### .isNaN\n *\n * Asserts that value is NaN.\n *\n * assert.isNaN(NaN, 'NaN is NaN');\n *\n * @name isNaN\n * @param {Mixed} value\n * @param {String} message\n * @namespace Assert\n * @api public\n */\n\n assert.isNaN = function (val, msg) {\n new Assertion(val, msg, assert.isNaN, true).to.be.NaN;\n };\n\n /**\n * ### .isNotNaN\n *\n * Asserts that value is not NaN.\n *\n * assert.isNotNaN(4, '4 is not NaN');\n *\n * @name isNotNaN\n * @param {Mixed} value\n * @param {String} message\n * @namespace Assert\n * @api public\n */\n assert.isNotNaN = function (val, msg) {\n new Assertion(val, msg, assert.isNotNaN, true).not.to.be.NaN;\n };\n\n /**\n * ### .exists\n *\n * Asserts that the target is neither `null` nor `undefined`.\n *\n * var foo = 'hi';\n *\n * assert.exists(foo, 'foo is neither `null` nor `undefined`');\n *\n * @name exists\n * @param {Mixed} value\n * @param {String} message\n * @namespace Assert\n * @api public\n */\n\n assert.exists = function (val, msg) {\n new Assertion(val, msg, assert.exists, true).to.exist;\n };\n\n /**\n * ### .notExists\n *\n * Asserts that the target is either `null` or `undefined`.\n *\n * var bar = null\n * , baz;\n *\n * assert.notExists(bar);\n * assert.notExists(baz, 'baz is either null or undefined');\n *\n * @name notExists\n * @param {Mixed} value\n * @param {String} message\n * @namespace Assert\n * @api public\n */\n\n assert.notExists = function (val, msg) {\n new Assertion(val, msg, assert.notExists, true).to.not.exist;\n };\n\n /**\n * ### .isUndefined(value, [message])\n *\n * Asserts that `value` is `undefined`.\n *\n * var tea;\n * assert.isUndefined(tea, 'no tea defined');\n *\n * @name isUndefined\n * @param {Mixed} value\n * @param {String} message\n * @namespace Assert\n * @api public\n */\n\n assert.isUndefined = function (val, msg) {\n new Assertion(val, msg, assert.isUndefined, true).to.equal(undefined);\n };\n\n /**\n * ### .isDefined(value, [message])\n *\n * Asserts that `value` is not `undefined`.\n *\n * var tea = 'cup of chai';\n * assert.isDefined(tea, 'tea has been defined');\n *\n * @name isDefined\n * @param {Mixed} value\n * @param {String} message\n * @namespace Assert\n * @api public\n */\n\n assert.isDefined = function (val, msg) {\n new Assertion(val, msg, assert.isDefined, true).to.not.equal(undefined);\n };\n\n /**\n * ### .isFunction(value, [message])\n *\n * Asserts that `value` is a function.\n *\n * function serveTea() { return 'cup of tea'; };\n * assert.isFunction(serveTea, 'great, we can have tea now');\n *\n * @name isFunction\n * @param {Mixed} value\n * @param {String} message\n * @namespace Assert\n * @api public\n */\n\n assert.isFunction = function (val, msg) {\n new Assertion(val, msg, assert.isFunction, true).to.be.a('function');\n };\n\n /**\n * ### .isNotFunction(value, [message])\n *\n * Asserts that `value` is _not_ a function.\n *\n * var serveTea = [ 'heat', 'pour', 'sip' ];\n * assert.isNotFunction(serveTea, 'great, we have listed the steps');\n *\n * @name isNotFunction\n * @param {Mixed} value\n * @param {String} message\n * @namespace Assert\n * @api public\n */\n\n assert.isNotFunction = function (val, msg) {\n new Assertion(val, msg, assert.isNotFunction, true).to.not.be.a('function');\n };\n\n /**\n * ### .isObject(value, [message])\n *\n * Asserts that `value` is an object of type 'Object' (as revealed by `Object.prototype.toString`).\n * _The assertion does not match subclassed objects._\n *\n * var selection = { name: 'Chai', serve: 'with spices' };\n * assert.isObject(selection, 'tea selection is an object');\n *\n * @name isObject\n * @param {Mixed} value\n * @param {String} message\n * @namespace Assert\n * @api public\n */\n\n assert.isObject = function (val, msg) {\n new Assertion(val, msg, assert.isObject, true).to.be.a('object');\n };\n\n /**\n * ### .isNotObject(value, [message])\n *\n * Asserts that `value` is _not_ an object of type 'Object' (as revealed by `Object.prototype.toString`).\n *\n * var selection = 'chai'\n * assert.isNotObject(selection, 'tea selection is not an object');\n * assert.isNotObject(null, 'null is not an object');\n *\n * @name isNotObject\n * @param {Mixed} value\n * @param {String} message\n * @namespace Assert\n * @api public\n */\n\n assert.isNotObject = function (val, msg) {\n new Assertion(val, msg, assert.isNotObject, true).to.not.be.a('object');\n };\n\n /**\n * ### .isArray(value, [message])\n *\n * Asserts that `value` is an array.\n *\n * var menu = [ 'green', 'chai', 'oolong' ];\n * assert.isArray(menu, 'what kind of tea do we want?');\n *\n * @name isArray\n * @param {Mixed} value\n * @param {String} message\n * @namespace Assert\n * @api public\n */\n\n assert.isArray = function (val, msg) {\n new Assertion(val, msg, assert.isArray, true).to.be.an('array');\n };\n\n /**\n * ### .isNotArray(value, [message])\n *\n * Asserts that `value` is _not_ an array.\n *\n * var menu = 'green|chai|oolong';\n * assert.isNotArray(menu, 'what kind of tea do we want?');\n *\n * @name isNotArray\n * @param {Mixed} value\n * @param {String} message\n * @namespace Assert\n * @api public\n */\n\n assert.isNotArray = function (val, msg) {\n new Assertion(val, msg, assert.isNotArray, true).to.not.be.an('array');\n };\n\n /**\n * ### .isString(value, [message])\n *\n * Asserts that `value` is a string.\n *\n * var teaOrder = 'chai';\n * assert.isString(teaOrder, 'order placed');\n *\n * @name isString\n * @param {Mixed} value\n * @param {String} message\n * @namespace Assert\n * @api public\n */\n\n assert.isString = function (val, msg) {\n new Assertion(val, msg, assert.isString, true).to.be.a('string');\n };\n\n /**\n * ### .isNotString(value, [message])\n *\n * Asserts that `value` is _not_ a string.\n *\n * var teaOrder = 4;\n * assert.isNotString(teaOrder, 'order placed');\n *\n * @name isNotString\n * @param {Mixed} value\n * @param {String} message\n * @namespace Assert\n * @api public\n */\n\n assert.isNotString = function (val, msg) {\n new Assertion(val, msg, assert.isNotString, true).to.not.be.a('string');\n };\n\n /**\n * ### .isNumber(value, [message])\n *\n * Asserts that `value` is a number.\n *\n * var cups = 2;\n * assert.isNumber(cups, 'how many cups');\n *\n * @name isNumber\n * @param {Number} value\n * @param {String} message\n * @namespace Assert\n * @api public\n */\n\n assert.isNumber = function (val, msg) {\n new Assertion(val, msg, assert.isNumber, true).to.be.a('number');\n };\n\n /**\n * ### .isNotNumber(value, [message])\n *\n * Asserts that `value` is _not_ a number.\n *\n * var cups = '2 cups please';\n * assert.isNotNumber(cups, 'how many cups');\n *\n * @name isNotNumber\n * @param {Mixed} value\n * @param {String} message\n * @namespace Assert\n * @api public\n */\n\n assert.isNotNumber = function (val, msg) {\n new Assertion(val, msg, assert.isNotNumber, true).to.not.be.a('number');\n };\n\n /**\n * ### .isFinite(value, [message])\n *\n * Asserts that `value` is a finite number. Unlike `.isNumber`, this will fail for `NaN` and `Infinity`.\n *\n * var cups = 2;\n * assert.isFinite(cups, 'how many cups');\n *\n * assert.isFinite(NaN); // throws\n *\n * @name isFinite\n * @param {Number} value\n * @param {String} message\n * @namespace Assert\n * @api public\n */\n\n assert.isFinite = function (val, msg) {\n new Assertion(val, msg, assert.isFinite, true).to.be.finite;\n };\n\n /**\n * ### .isBoolean(value, [message])\n *\n * Asserts that `value` is a boolean.\n *\n * var teaReady = true\n * , teaServed = false;\n *\n * assert.isBoolean(teaReady, 'is the tea ready');\n * assert.isBoolean(teaServed, 'has tea been served');\n *\n * @name isBoolean\n * @param {Mixed} value\n * @param {String} message\n * @namespace Assert\n * @api public\n */\n\n assert.isBoolean = function (val, msg) {\n new Assertion(val, msg, assert.isBoolean, true).to.be.a('boolean');\n };\n\n /**\n * ### .isNotBoolean(value, [message])\n *\n * Asserts that `value` is _not_ a boolean.\n *\n * var teaReady = 'yep'\n * , teaServed = 'nope';\n *\n * assert.isNotBoolean(teaReady, 'is the tea ready');\n * assert.isNotBoolean(teaServed, 'has tea been served');\n *\n * @name isNotBoolean\n * @param {Mixed} value\n * @param {String} message\n * @namespace Assert\n * @api public\n */\n\n assert.isNotBoolean = function (val, msg) {\n new Assertion(val, msg, assert.isNotBoolean, true).to.not.be.a('boolean');\n };\n\n /**\n * ### .typeOf(value, name, [message])\n *\n * Asserts that `value`'s type is `name`, as determined by\n * `Object.prototype.toString`.\n *\n * assert.typeOf({ tea: 'chai' }, 'object', 'we have an object');\n * assert.typeOf(['chai', 'jasmine'], 'array', 'we have an array');\n * assert.typeOf('tea', 'string', 'we have a string');\n * assert.typeOf(/tea/, 'regexp', 'we have a regular expression');\n * assert.typeOf(null, 'null', 'we have a null');\n * assert.typeOf(undefined, 'undefined', 'we have an undefined');\n *\n * @name typeOf\n * @param {Mixed} value\n * @param {String} name\n * @param {String} message\n * @namespace Assert\n * @api public\n */\n\n assert.typeOf = function (val, type, msg) {\n new Assertion(val, msg, assert.typeOf, true).to.be.a(type);\n };\n\n /**\n * ### .notTypeOf(value, name, [message])\n *\n * Asserts that `value`'s type is _not_ `name`, as determined by\n * `Object.prototype.toString`.\n *\n * assert.notTypeOf('tea', 'number', 'strings are not numbers');\n *\n * @name notTypeOf\n * @param {Mixed} value\n * @param {String} typeof name\n * @param {String} message\n * @namespace Assert\n * @api public\n */\n\n assert.notTypeOf = function (val, type, msg) {\n new Assertion(val, msg, assert.notTypeOf, true).to.not.be.a(type);\n };\n\n /**\n * ### .instanceOf(object, constructor, [message])\n *\n * Asserts that `value` is an instance of `constructor`.\n *\n * var Tea = function (name) { this.name = name; }\n * , chai = new Tea('chai');\n *\n * assert.instanceOf(chai, Tea, 'chai is an instance of tea');\n *\n * @name instanceOf\n * @param {Object} object\n * @param {Constructor} constructor\n * @param {String} message\n * @namespace Assert\n * @api public\n */\n\n assert.instanceOf = function (val, type, msg) {\n new Assertion(val, msg, assert.instanceOf, true).to.be.instanceOf(type);\n };\n\n /**\n * ### .notInstanceOf(object, constructor, [message])\n *\n * Asserts `value` is not an instance of `constructor`.\n *\n * var Tea = function (name) { this.name = name; }\n * , chai = new String('chai');\n *\n * assert.notInstanceOf(chai, Tea, 'chai is not an instance of tea');\n *\n * @name notInstanceOf\n * @param {Object} object\n * @param {Constructor} constructor\n * @param {String} message\n * @namespace Assert\n * @api public\n */\n\n assert.notInstanceOf = function (val, type, msg) {\n new Assertion(val, msg, assert.notInstanceOf, true)\n .to.not.be.instanceOf(type);\n };\n\n /**\n * ### .include(haystack, needle, [message])\n *\n * Asserts that `haystack` includes `needle`. Can be used to assert the\n * inclusion of a value in an array, a substring in a string, or a subset of\n * properties in an object.\n *\n * assert.include([1,2,3], 2, 'array contains value');\n * assert.include('foobar', 'foo', 'string contains substring');\n * assert.include({ foo: 'bar', hello: 'universe' }, { foo: 'bar' }, 'object contains property');\n *\n * Strict equality (===) is used. When asserting the inclusion of a value in\n * an array, the array is searched for an element that's strictly equal to the\n * given value. When asserting a subset of properties in an object, the object\n * is searched for the given property keys, checking that each one is present\n * and stricty equal to the given property value. For instance:\n *\n * var obj1 = {a: 1}\n * , obj2 = {b: 2};\n * assert.include([obj1, obj2], obj1);\n * assert.include({foo: obj1, bar: obj2}, {foo: obj1});\n * assert.include({foo: obj1, bar: obj2}, {foo: obj1, bar: obj2});\n *\n * @name include\n * @param {Array|String} haystack\n * @param {Mixed} needle\n * @param {String} message\n * @namespace Assert\n * @api public\n */\n\n assert.include = function (exp, inc, msg) {\n new Assertion(exp, msg, assert.include, true).include(inc);\n };\n\n /**\n * ### .notInclude(haystack, needle, [message])\n *\n * Asserts that `haystack` does not include `needle`. Can be used to assert\n * the absence of a value in an array, a substring in a string, or a subset of\n * properties in an object.\n *\n * assert.notInclude([1,2,3], 4, 'array doesn't contain value');\n * assert.notInclude('foobar', 'baz', 'string doesn't contain substring');\n * assert.notInclude({ foo: 'bar', hello: 'universe' }, { foo: 'baz' }, 'object doesn't contain property');\n *\n * Strict equality (===) is used. When asserting the absence of a value in an\n * array, the array is searched to confirm the absence of an element that's\n * strictly equal to the given value. When asserting a subset of properties in\n * an object, the object is searched to confirm that at least one of the given\n * property keys is either not present or not strictly equal to the given\n * property value. For instance:\n *\n * var obj1 = {a: 1}\n * , obj2 = {b: 2};\n * assert.notInclude([obj1, obj2], {a: 1});\n * assert.notInclude({foo: obj1, bar: obj2}, {foo: {a: 1}});\n * assert.notInclude({foo: obj1, bar: obj2}, {foo: obj1, bar: {b: 2}});\n *\n * @name notInclude\n * @param {Array|String} haystack\n * @param {Mixed} needle\n * @param {String} message\n * @namespace Assert\n * @api public\n */\n\n assert.notInclude = function (exp, inc, msg) {\n new Assertion(exp, msg, assert.notInclude, true).not.include(inc);\n };\n\n /**\n * ### .deepInclude(haystack, needle, [message])\n *\n * Asserts that `haystack` includes `needle`. Can be used to assert the\n * inclusion of a value in an array or a subset of properties in an object.\n * Deep equality is used.\n *\n * var obj1 = {a: 1}\n * , obj2 = {b: 2};\n * assert.deepInclude([obj1, obj2], {a: 1});\n * assert.deepInclude({foo: obj1, bar: obj2}, {foo: {a: 1}});\n * assert.deepInclude({foo: obj1, bar: obj2}, {foo: {a: 1}, bar: {b: 2}});\n *\n * @name deepInclude\n * @param {Array|String} haystack\n * @param {Mixed} needle\n * @param {String} message\n * @namespace Assert\n * @api public\n */\n\n assert.deepInclude = function (exp, inc, msg) {\n new Assertion(exp, msg, assert.deepInclude, true).deep.include(inc);\n };\n\n /**\n * ### .notDeepInclude(haystack, needle, [message])\n *\n * Asserts that `haystack` does not include `needle`. Can be used to assert\n * the absence of a value in an array or a subset of properties in an object.\n * Deep equality is used.\n *\n * var obj1 = {a: 1}\n * , obj2 = {b: 2};\n * assert.notDeepInclude([obj1, obj2], {a: 9});\n * assert.notDeepInclude({foo: obj1, bar: obj2}, {foo: {a: 9}});\n * assert.notDeepInclude({foo: obj1, bar: obj2}, {foo: {a: 1}, bar: {b: 9}});\n *\n * @name notDeepInclude\n * @param {Array|String} haystack\n * @param {Mixed} needle\n * @param {String} message\n * @namespace Assert\n * @api public\n */\n\n assert.notDeepInclude = function (exp, inc, msg) {\n new Assertion(exp, msg, assert.notDeepInclude, true).not.deep.include(inc);\n };\n\n /**\n * ### .nestedInclude(haystack, needle, [message])\n * \n * Asserts that 'haystack' includes 'needle'. \n * Can be used to assert the inclusion of a subset of properties in an \n * object.\n * Enables the use of dot- and bracket-notation for referencing nested \n * properties.\n * '[]' and '.' in property names can be escaped using double backslashes.\n * \n * assert.nestedInclude({'.a': {'b': 'x'}}, {'\\\\.a.[b]': 'x'});\n * assert.nestedInclude({'a': {'[b]': 'x'}}, {'a.\\\\[b\\\\]': 'x'});\n * \n * @name nestedInclude\n * @param {Object} haystack\n * @param {Object} needle\n * @param {String} message\n * @namespace Assert\n * @api public \n */ \n\n assert.nestedInclude = function (exp, inc, msg) {\n new Assertion(exp, msg, assert.nestedInclude, true).nested.include(inc);\n };\n\n /**\n * ### .notNestedInclude(haystack, needle, [message])\n * \n * Asserts that 'haystack' does not include 'needle'. \n * Can be used to assert the absence of a subset of properties in an \n * object.\n * Enables the use of dot- and bracket-notation for referencing nested \n * properties. \n * '[]' and '.' in property names can be escaped using double backslashes.\n * \n * assert.notNestedInclude({'.a': {'b': 'x'}}, {'\\\\.a.b': 'y'});\n * assert.notNestedInclude({'a': {'[b]': 'x'}}, {'a.\\\\[b\\\\]': 'y'});\n * \n * @name notNestedInclude\n * @param {Object} haystack\n * @param {Object} needle\n * @param {String} message\n * @namespace Assert\n * @api public \n */ \n\n assert.notNestedInclude = function (exp, inc, msg) {\n new Assertion(exp, msg, assert.notNestedInclude, true)\n .not.nested.include(inc);\n };\n\n /**\n * ### .deepNestedInclude(haystack, needle, [message])\n * \n * Asserts that 'haystack' includes 'needle'.\n * Can be used to assert the inclusion of a subset of properties in an \n * object while checking for deep equality.\n * Enables the use of dot- and bracket-notation for referencing nested \n * properties.\n * '[]' and '.' in property names can be escaped using double backslashes.\n * \n * assert.deepNestedInclude({a: {b: [{x: 1}]}}, {'a.b[0]': {x: 1}});\n * assert.deepNestedInclude({'.a': {'[b]': {x: 1}}}, {'\\\\.a.\\\\[b\\\\]': {x: 1}});\n * \n * @name deepNestedInclude\n * @param {Object} haystack\n * @param {Object} needle\n * @param {String} message\n * @namespace Assert\n * @api public \n */\n\n assert.deepNestedInclude = function(exp, inc, msg) {\n new Assertion(exp, msg, assert.deepNestedInclude, true)\n .deep.nested.include(inc);\n };\n\n /**\n * ### .notDeepNestedInclude(haystack, needle, [message])\n * \n * Asserts that 'haystack' does not include 'needle'.\n * Can be used to assert the absence of a subset of properties in an \n * object while checking for deep equality.\n * Enables the use of dot- and bracket-notation for referencing nested \n * properties.\n * '[]' and '.' in property names can be escaped using double backslashes.\n * \n * assert.notDeepNestedInclude({a: {b: [{x: 1}]}}, {'a.b[0]': {y: 1}})\n * assert.notDeepNestedInclude({'.a': {'[b]': {x: 1}}}, {'\\\\.a.\\\\[b\\\\]': {y: 2}});\n * \n * @name notDeepNestedInclude\n * @param {Object} haystack\n * @param {Object} needle\n * @param {String} message\n * @namespace Assert\n * @api public \n */\n\n assert.notDeepNestedInclude = function(exp, inc, msg) {\n new Assertion(exp, msg, assert.notDeepNestedInclude, true)\n .not.deep.nested.include(inc);\n };\n\n /**\n * ### .ownInclude(haystack, needle, [message])\n * \n * Asserts that 'haystack' includes 'needle'.\n * Can be used to assert the inclusion of a subset of properties in an \n * object while ignoring inherited properties.\n * \n * assert.ownInclude({ a: 1 }, { a: 1 });\n * \n * @name ownInclude\n * @param {Object} haystack\n * @param {Object} needle\n * @param {String} message\n * @namespace Assert\n * @api public\n */\n\n assert.ownInclude = function(exp, inc, msg) {\n new Assertion(exp, msg, assert.ownInclude, true).own.include(inc);\n };\n\n /**\n * ### .notOwnInclude(haystack, needle, [message])\n * \n * Asserts that 'haystack' includes 'needle'.\n * Can be used to assert the absence of a subset of properties in an \n * object while ignoring inherited properties.\n * \n * Object.prototype.b = 2;\n * \n * assert.notOwnInclude({ a: 1 }, { b: 2 });\n * \n * @name notOwnInclude\n * @param {Object} haystack\n * @param {Object} needle\n * @param {String} message\n * @namespace Assert\n * @api public\n */\n\n assert.notOwnInclude = function(exp, inc, msg) {\n new Assertion(exp, msg, assert.notOwnInclude, true).not.own.include(inc);\n };\n\n /**\n * ### .deepOwnInclude(haystack, needle, [message])\n * \n * Asserts that 'haystack' includes 'needle'.\n * Can be used to assert the inclusion of a subset of properties in an \n * object while ignoring inherited properties and checking for deep equality.\n * \n * assert.deepOwnInclude({a: {b: 2}}, {a: {b: 2}});\n * \n * @name deepOwnInclude\n * @param {Object} haystack\n * @param {Object} needle\n * @param {String} message\n * @namespace Assert\n * @api public\n */\n\n assert.deepOwnInclude = function(exp, inc, msg) {\n new Assertion(exp, msg, assert.deepOwnInclude, true)\n .deep.own.include(inc);\n };\n\n /**\n * ### .notDeepOwnInclude(haystack, needle, [message])\n * \n * Asserts that 'haystack' includes 'needle'.\n * Can be used to assert the absence of a subset of properties in an \n * object while ignoring inherited properties and checking for deep equality.\n * \n * assert.notDeepOwnInclude({a: {b: 2}}, {a: {c: 3}});\n * \n * @name notDeepOwnInclude\n * @param {Object} haystack\n * @param {Object} needle\n * @param {String} message\n * @namespace Assert\n * @api public\n */\n\n assert.notDeepOwnInclude = function(exp, inc, msg) {\n new Assertion(exp, msg, assert.notDeepOwnInclude, true)\n .not.deep.own.include(inc);\n };\n\n /**\n * ### .match(value, regexp, [message])\n *\n * Asserts that `value` matches the regular expression `regexp`.\n *\n * assert.match('foobar', /^foo/, 'regexp matches');\n *\n * @name match\n * @param {Mixed} value\n * @param {RegExp} regexp\n * @param {String} message\n * @namespace Assert\n * @api public\n */\n\n assert.match = function (exp, re, msg) {\n new Assertion(exp, msg, assert.match, true).to.match(re);\n };\n\n /**\n * ### .notMatch(value, regexp, [message])\n *\n * Asserts that `value` does not match the regular expression `regexp`.\n *\n * assert.notMatch('foobar', /^foo/, 'regexp does not match');\n *\n * @name notMatch\n * @param {Mixed} value\n * @param {RegExp} regexp\n * @param {String} message\n * @namespace Assert\n * @api public\n */\n\n assert.notMatch = function (exp, re, msg) {\n new Assertion(exp, msg, assert.notMatch, true).to.not.match(re);\n };\n\n /**\n * ### .property(object, property, [message])\n *\n * Asserts that `object` has a direct or inherited property named by\n * `property`.\n *\n * assert.property({ tea: { green: 'matcha' }}, 'tea');\n * assert.property({ tea: { green: 'matcha' }}, 'toString');\n *\n * @name property\n * @param {Object} object\n * @param {String} property\n * @param {String} message\n * @namespace Assert\n * @api public\n */\n\n assert.property = function (obj, prop, msg) {\n new Assertion(obj, msg, assert.property, true).to.have.property(prop);\n };\n\n /**\n * ### .notProperty(object, property, [message])\n *\n * Asserts that `object` does _not_ have a direct or inherited property named\n * by `property`.\n *\n * assert.notProperty({ tea: { green: 'matcha' }}, 'coffee');\n *\n * @name notProperty\n * @param {Object} object\n * @param {String} property\n * @param {String} message\n * @namespace Assert\n * @api public\n */\n\n assert.notProperty = function (obj, prop, msg) {\n new Assertion(obj, msg, assert.notProperty, true)\n .to.not.have.property(prop);\n };\n\n /**\n * ### .propertyVal(object, property, value, [message])\n *\n * Asserts that `object` has a direct or inherited property named by\n * `property` with a value given by `value`. Uses a strict equality check\n * (===).\n *\n * assert.propertyVal({ tea: 'is good' }, 'tea', 'is good');\n *\n * @name propertyVal\n * @param {Object} object\n * @param {String} property\n * @param {Mixed} value\n * @param {String} message\n * @namespace Assert\n * @api public\n */\n\n assert.propertyVal = function (obj, prop, val, msg) {\n new Assertion(obj, msg, assert.propertyVal, true)\n .to.have.property(prop, val);\n };\n\n /**\n * ### .notPropertyVal(object, property, value, [message])\n *\n * Asserts that `object` does _not_ have a direct or inherited property named\n * by `property` with value given by `value`. Uses a strict equality check\n * (===).\n *\n * assert.notPropertyVal({ tea: 'is good' }, 'tea', 'is bad');\n * assert.notPropertyVal({ tea: 'is good' }, 'coffee', 'is good');\n *\n * @name notPropertyVal\n * @param {Object} object\n * @param {String} property\n * @param {Mixed} value\n * @param {String} message\n * @namespace Assert\n * @api public\n */\n\n assert.notPropertyVal = function (obj, prop, val, msg) {\n new Assertion(obj, msg, assert.notPropertyVal, true)\n .to.not.have.property(prop, val);\n };\n\n /**\n * ### .deepPropertyVal(object, property, value, [message])\n *\n * Asserts that `object` has a direct or inherited property named by\n * `property` with a value given by `value`. Uses a deep equality check.\n *\n * assert.deepPropertyVal({ tea: { green: 'matcha' } }, 'tea', { green: 'matcha' });\n *\n * @name deepPropertyVal\n * @param {Object} object\n * @param {String} property\n * @param {Mixed} value\n * @param {String} message\n * @namespace Assert\n * @api public\n */\n\n assert.deepPropertyVal = function (obj, prop, val, msg) {\n new Assertion(obj, msg, assert.deepPropertyVal, true)\n .to.have.deep.property(prop, val);\n };\n\n /**\n * ### .notDeepPropertyVal(object, property, value, [message])\n *\n * Asserts that `object` does _not_ have a direct or inherited property named\n * by `property` with value given by `value`. Uses a deep equality check.\n *\n * assert.notDeepPropertyVal({ tea: { green: 'matcha' } }, 'tea', { black: 'matcha' });\n * assert.notDeepPropertyVal({ tea: { green: 'matcha' } }, 'tea', { green: 'oolong' });\n * assert.notDeepPropertyVal({ tea: { green: 'matcha' } }, 'coffee', { green: 'matcha' });\n *\n * @name notDeepPropertyVal\n * @param {Object} object\n * @param {String} property\n * @param {Mixed} value\n * @param {String} message\n * @namespace Assert\n * @api public\n */\n\n assert.notDeepPropertyVal = function (obj, prop, val, msg) {\n new Assertion(obj, msg, assert.notDeepPropertyVal, true)\n .to.not.have.deep.property(prop, val);\n };\n\n /**\n * ### .ownProperty(object, property, [message])\n *\n * Asserts that `object` has a direct property named by `property`. Inherited\n * properties aren't checked.\n *\n * assert.ownProperty({ tea: { green: 'matcha' }}, 'tea');\n *\n * @name ownProperty\n * @param {Object} object\n * @param {String} property\n * @param {String} message\n * @api public\n */\n\n assert.ownProperty = function (obj, prop, msg) {\n new Assertion(obj, msg, assert.ownProperty, true)\n .to.have.own.property(prop);\n };\n\n /**\n * ### .notOwnProperty(object, property, [message])\n *\n * Asserts that `object` does _not_ have a direct property named by\n * `property`. Inherited properties aren't checked.\n *\n * assert.notOwnProperty({ tea: { green: 'matcha' }}, 'coffee');\n * assert.notOwnProperty({}, 'toString');\n *\n * @name notOwnProperty\n * @param {Object} object\n * @param {String} property\n * @param {String} message\n * @api public\n */\n\n assert.notOwnProperty = function (obj, prop, msg) {\n new Assertion(obj, msg, assert.notOwnProperty, true)\n .to.not.have.own.property(prop);\n };\n\n /**\n * ### .ownPropertyVal(object, property, value, [message])\n *\n * Asserts that `object` has a direct property named by `property` and a value\n * equal to the provided `value`. Uses a strict equality check (===).\n * Inherited properties aren't checked.\n *\n * assert.ownPropertyVal({ coffee: 'is good'}, 'coffee', 'is good');\n *\n * @name ownPropertyVal\n * @param {Object} object\n * @param {String} property\n * @param {Mixed} value\n * @param {String} message\n * @api public\n */\n\n assert.ownPropertyVal = function (obj, prop, value, msg) {\n new Assertion(obj, msg, assert.ownPropertyVal, true)\n .to.have.own.property(prop, value);\n };\n\n /**\n * ### .notOwnPropertyVal(object, property, value, [message])\n *\n * Asserts that `object` does _not_ have a direct property named by `property`\n * with a value equal to the provided `value`. Uses a strict equality check\n * (===). Inherited properties aren't checked.\n *\n * assert.notOwnPropertyVal({ tea: 'is better'}, 'tea', 'is worse');\n * assert.notOwnPropertyVal({}, 'toString', Object.prototype.toString);\n *\n * @name notOwnPropertyVal\n * @param {Object} object\n * @param {String} property\n * @param {Mixed} value\n * @param {String} message\n * @api public\n */\n\n assert.notOwnPropertyVal = function (obj, prop, value, msg) {\n new Assertion(obj, msg, assert.notOwnPropertyVal, true)\n .to.not.have.own.property(prop, value);\n };\n\n /**\n * ### .deepOwnPropertyVal(object, property, value, [message])\n *\n * Asserts that `object` has a direct property named by `property` and a value\n * equal to the provided `value`. Uses a deep equality check. Inherited\n * properties aren't checked.\n *\n * assert.deepOwnPropertyVal({ tea: { green: 'matcha' } }, 'tea', { green: 'matcha' });\n *\n * @name deepOwnPropertyVal\n * @param {Object} object\n * @param {String} property\n * @param {Mixed} value\n * @param {String} message\n * @api public\n */\n\n assert.deepOwnPropertyVal = function (obj, prop, value, msg) {\n new Assertion(obj, msg, assert.deepOwnPropertyVal, true)\n .to.have.deep.own.property(prop, value);\n };\n\n /**\n * ### .notDeepOwnPropertyVal(object, property, value, [message])\n *\n * Asserts that `object` does _not_ have a direct property named by `property`\n * with a value equal to the provided `value`. Uses a deep equality check.\n * Inherited properties aren't checked.\n *\n * assert.notDeepOwnPropertyVal({ tea: { green: 'matcha' } }, 'tea', { black: 'matcha' });\n * assert.notDeepOwnPropertyVal({ tea: { green: 'matcha' } }, 'tea', { green: 'oolong' });\n * assert.notDeepOwnPropertyVal({ tea: { green: 'matcha' } }, 'coffee', { green: 'matcha' });\n * assert.notDeepOwnPropertyVal({}, 'toString', Object.prototype.toString);\n *\n * @name notDeepOwnPropertyVal\n * @param {Object} object\n * @param {String} property\n * @param {Mixed} value\n * @param {String} message\n * @api public\n */\n\n assert.notDeepOwnPropertyVal = function (obj, prop, value, msg) {\n new Assertion(obj, msg, assert.notDeepOwnPropertyVal, true)\n .to.not.have.deep.own.property(prop, value);\n };\n\n /**\n * ### .nestedProperty(object, property, [message])\n *\n * Asserts that `object` has a direct or inherited property named by\n * `property`, which can be a string using dot- and bracket-notation for\n * nested reference.\n *\n * assert.nestedProperty({ tea: { green: 'matcha' }}, 'tea.green');\n *\n * @name nestedProperty\n * @param {Object} object\n * @param {String} property\n * @param {String} message\n * @namespace Assert\n * @api public\n */\n\n assert.nestedProperty = function (obj, prop, msg) {\n new Assertion(obj, msg, assert.nestedProperty, true)\n .to.have.nested.property(prop);\n };\n\n /**\n * ### .notNestedProperty(object, property, [message])\n *\n * Asserts that `object` does _not_ have a property named by `property`, which\n * can be a string using dot- and bracket-notation for nested reference. The\n * property cannot exist on the object nor anywhere in its prototype chain.\n *\n * assert.notNestedProperty({ tea: { green: 'matcha' }}, 'tea.oolong');\n *\n * @name notNestedProperty\n * @param {Object} object\n * @param {String} property\n * @param {String} message\n * @namespace Assert\n * @api public\n */\n\n assert.notNestedProperty = function (obj, prop, msg) {\n new Assertion(obj, msg, assert.notNestedProperty, true)\n .to.not.have.nested.property(prop);\n };\n\n /**\n * ### .nestedPropertyVal(object, property, value, [message])\n *\n * Asserts that `object` has a property named by `property` with value given\n * by `value`. `property` can use dot- and bracket-notation for nested\n * reference. Uses a strict equality check (===).\n *\n * assert.nestedPropertyVal({ tea: { green: 'matcha' }}, 'tea.green', 'matcha');\n *\n * @name nestedPropertyVal\n * @param {Object} object\n * @param {String} property\n * @param {Mixed} value\n * @param {String} message\n * @namespace Assert\n * @api public\n */\n\n assert.nestedPropertyVal = function (obj, prop, val, msg) {\n new Assertion(obj, msg, assert.nestedPropertyVal, true)\n .to.have.nested.property(prop, val);\n };\n\n /**\n * ### .notNestedPropertyVal(object, property, value, [message])\n *\n * Asserts that `object` does _not_ have a property named by `property` with\n * value given by `value`. `property` can use dot- and bracket-notation for\n * nested reference. Uses a strict equality check (===).\n *\n * assert.notNestedPropertyVal({ tea: { green: 'matcha' }}, 'tea.green', 'konacha');\n * assert.notNestedPropertyVal({ tea: { green: 'matcha' }}, 'coffee.green', 'matcha');\n *\n * @name notNestedPropertyVal\n * @param {Object} object\n * @param {String} property\n * @param {Mixed} value\n * @param {String} message\n * @namespace Assert\n * @api public\n */\n\n assert.notNestedPropertyVal = function (obj, prop, val, msg) {\n new Assertion(obj, msg, assert.notNestedPropertyVal, true)\n .to.not.have.nested.property(prop, val);\n };\n\n /**\n * ### .deepNestedPropertyVal(object, property, value, [message])\n *\n * Asserts that `object` has a property named by `property` with a value given\n * by `value`. `property` can use dot- and bracket-notation for nested\n * reference. Uses a deep equality check.\n *\n * assert.deepNestedPropertyVal({ tea: { green: { matcha: 'yum' } } }, 'tea.green', { matcha: 'yum' });\n *\n * @name deepNestedPropertyVal\n * @param {Object} object\n * @param {String} property\n * @param {Mixed} value\n * @param {String} message\n * @namespace Assert\n * @api public\n */\n\n assert.deepNestedPropertyVal = function (obj, prop, val, msg) {\n new Assertion(obj, msg, assert.deepNestedPropertyVal, true)\n .to.have.deep.nested.property(prop, val);\n };\n\n /**\n * ### .notDeepNestedPropertyVal(object, property, value, [message])\n *\n * Asserts that `object` does _not_ have a property named by `property` with\n * value given by `value`. `property` can use dot- and bracket-notation for\n * nested reference. Uses a deep equality check.\n *\n * assert.notDeepNestedPropertyVal({ tea: { green: { matcha: 'yum' } } }, 'tea.green', { oolong: 'yum' });\n * assert.notDeepNestedPropertyVal({ tea: { green: { matcha: 'yum' } } }, 'tea.green', { matcha: 'yuck' });\n * assert.notDeepNestedPropertyVal({ tea: { green: { matcha: 'yum' } } }, 'tea.black', { matcha: 'yum' });\n *\n * @name notDeepNestedPropertyVal\n * @param {Object} object\n * @param {String} property\n * @param {Mixed} value\n * @param {String} message\n * @namespace Assert\n * @api public\n */\n\n assert.notDeepNestedPropertyVal = function (obj, prop, val, msg) {\n new Assertion(obj, msg, assert.notDeepNestedPropertyVal, true)\n .to.not.have.deep.nested.property(prop, val);\n }\n\n /**\n * ### .lengthOf(object, length, [message])\n *\n * Asserts that `object` has a `length` property with the expected value.\n *\n * assert.lengthOf([1,2,3], 3, 'array has length of 3');\n * assert.lengthOf('foobar', 6, 'string has length of 6');\n *\n * @name lengthOf\n * @param {Mixed} object\n * @param {Number} length\n * @param {String} message\n * @namespace Assert\n * @api public\n */\n\n assert.lengthOf = function (exp, len, msg) {\n new Assertion(exp, msg, assert.lengthOf, true).to.have.lengthOf(len);\n };\n\n /**\n * ### .hasAnyKeys(object, [keys], [message])\n *\n * Asserts that `object` has at least one of the `keys` provided.\n * You can also provide a single object instead of a `keys` array and its keys\n * will be used as the expected set of keys.\n *\n * assert.hasAnyKeys({foo: 1, bar: 2, baz: 3}, ['foo', 'iDontExist', 'baz']);\n * assert.hasAnyKeys({foo: 1, bar: 2, baz: 3}, {foo: 30, iDontExist: 99, baz: 1337});\n * assert.hasAnyKeys(new Map([[{foo: 1}, 'bar'], ['key', 'value']]), [{foo: 1}, 'key']);\n * assert.hasAnyKeys(new Set([{foo: 'bar'}, 'anotherKey']), [{foo: 'bar'}, 'anotherKey']);\n *\n * @name hasAnyKeys\n * @param {Mixed} object\n * @param {Array|Object} keys\n * @param {String} message\n * @namespace Assert\n * @api public\n */\n\n assert.hasAnyKeys = function (obj, keys, msg) {\n new Assertion(obj, msg, assert.hasAnyKeys, true).to.have.any.keys(keys);\n }\n\n /**\n * ### .hasAllKeys(object, [keys], [message])\n *\n * Asserts that `object` has all and only all of the `keys` provided.\n * You can also provide a single object instead of a `keys` array and its keys\n * will be used as the expected set of keys.\n *\n * assert.hasAllKeys({foo: 1, bar: 2, baz: 3}, ['foo', 'bar', 'baz']);\n * assert.hasAllKeys({foo: 1, bar: 2, baz: 3}, {foo: 30, bar: 99, baz: 1337]);\n * assert.hasAllKeys(new Map([[{foo: 1}, 'bar'], ['key', 'value']]), [{foo: 1}, 'key']);\n * assert.hasAllKeys(new Set([{foo: 'bar'}, 'anotherKey'], [{foo: 'bar'}, 'anotherKey']);\n *\n * @name hasAllKeys\n * @param {Mixed} object\n * @param {String[]} keys\n * @param {String} message\n * @namespace Assert\n * @api public\n */\n\n assert.hasAllKeys = function (obj, keys, msg) {\n new Assertion(obj, msg, assert.hasAllKeys, true).to.have.all.keys(keys);\n }\n\n /**\n * ### .containsAllKeys(object, [keys], [message])\n *\n * Asserts that `object` has all of the `keys` provided but may have more keys not listed.\n * You can also provide a single object instead of a `keys` array and its keys\n * will be used as the expected set of keys.\n *\n * assert.containsAllKeys({foo: 1, bar: 2, baz: 3}, ['foo', 'baz']);\n * assert.containsAllKeys({foo: 1, bar: 2, baz: 3}, ['foo', 'bar', 'baz']);\n * assert.containsAllKeys({foo: 1, bar: 2, baz: 3}, {foo: 30, baz: 1337});\n * assert.containsAllKeys({foo: 1, bar: 2, baz: 3}, {foo: 30, bar: 99, baz: 1337});\n * assert.containsAllKeys(new Map([[{foo: 1}, 'bar'], ['key', 'value']]), [{foo: 1}]);\n * assert.containsAllKeys(new Map([[{foo: 1}, 'bar'], ['key', 'value']]), [{foo: 1}, 'key']);\n * assert.containsAllKeys(new Set([{foo: 'bar'}, 'anotherKey'], [{foo: 'bar'}]);\n * assert.containsAllKeys(new Set([{foo: 'bar'}, 'anotherKey'], [{foo: 'bar'}, 'anotherKey']);\n *\n * @name containsAllKeys\n * @param {Mixed} object\n * @param {String[]} keys\n * @param {String} message\n * @namespace Assert\n * @api public\n */\n\n assert.containsAllKeys = function (obj, keys, msg) {\n new Assertion(obj, msg, assert.containsAllKeys, true)\n .to.contain.all.keys(keys);\n }\n\n /**\n * ### .doesNotHaveAnyKeys(object, [keys], [message])\n *\n * Asserts that `object` has none of the `keys` provided.\n * You can also provide a single object instead of a `keys` array and its keys\n * will be used as the expected set of keys.\n *\n * assert.doesNotHaveAnyKeys({foo: 1, bar: 2, baz: 3}, ['one', 'two', 'example']);\n * assert.doesNotHaveAnyKeys({foo: 1, bar: 2, baz: 3}, {one: 1, two: 2, example: 'foo'});\n * assert.doesNotHaveAnyKeys(new Map([[{foo: 1}, 'bar'], ['key', 'value']]), [{one: 'two'}, 'example']);\n * assert.doesNotHaveAnyKeys(new Set([{foo: 'bar'}, 'anotherKey'], [{one: 'two'}, 'example']);\n *\n * @name doesNotHaveAnyKeys\n * @param {Mixed} object\n * @param {String[]} keys\n * @param {String} message\n * @namespace Assert\n * @api public\n */\n\n assert.doesNotHaveAnyKeys = function (obj, keys, msg) {\n new Assertion(obj, msg, assert.doesNotHaveAnyKeys, true)\n .to.not.have.any.keys(keys);\n }\n\n /**\n * ### .doesNotHaveAllKeys(object, [keys], [message])\n *\n * Asserts that `object` does not have at least one of the `keys` provided.\n * You can also provide a single object instead of a `keys` array and its keys\n * will be used as the expected set of keys.\n *\n * assert.doesNotHaveAllKeys({foo: 1, bar: 2, baz: 3}, ['one', 'two', 'example']);\n * assert.doesNotHaveAllKeys({foo: 1, bar: 2, baz: 3}, {one: 1, two: 2, example: 'foo'});\n * assert.doesNotHaveAllKeys(new Map([[{foo: 1}, 'bar'], ['key', 'value']]), [{one: 'two'}, 'example']);\n * assert.doesNotHaveAllKeys(new Set([{foo: 'bar'}, 'anotherKey'], [{one: 'two'}, 'example']);\n *\n * @name doesNotHaveAllKeys\n * @param {Mixed} object\n * @param {String[]} keys\n * @param {String} message\n * @namespace Assert\n * @api public\n */\n\n assert.doesNotHaveAllKeys = function (obj, keys, msg) {\n new Assertion(obj, msg, assert.doesNotHaveAllKeys, true)\n .to.not.have.all.keys(keys);\n }\n\n /**\n * ### .hasAnyDeepKeys(object, [keys], [message])\n *\n * Asserts that `object` has at least one of the `keys` provided.\n * Since Sets and Maps can have objects as keys you can use this assertion to perform\n * a deep comparison.\n * You can also provide a single object instead of a `keys` array and its keys\n * will be used as the expected set of keys.\n *\n * assert.hasAnyDeepKeys(new Map([[{one: 'one'}, 'valueOne'], [1, 2]]), {one: 'one'});\n * assert.hasAnyDeepKeys(new Map([[{one: 'one'}, 'valueOne'], [1, 2]]), [{one: 'one'}, {two: 'two'}]);\n * assert.hasAnyDeepKeys(new Map([[{one: 'one'}, 'valueOne'], [{two: 'two'}, 'valueTwo']]), [{one: 'one'}, {two: 'two'}]);\n * assert.hasAnyDeepKeys(new Set([{one: 'one'}, {two: 'two'}]), {one: 'one'});\n * assert.hasAnyDeepKeys(new Set([{one: 'one'}, {two: 'two'}]), [{one: 'one'}, {three: 'three'}]);\n * assert.hasAnyDeepKeys(new Set([{one: 'one'}, {two: 'two'}]), [{one: 'one'}, {two: 'two'}]);\n *\n * @name doesNotHaveAllKeys\n * @param {Mixed} object\n * @param {Array|Object} keys\n * @param {String} message\n * @namespace Assert\n * @api public\n */\n\n assert.hasAnyDeepKeys = function (obj, keys, msg) {\n new Assertion(obj, msg, assert.hasAnyDeepKeys, true)\n .to.have.any.deep.keys(keys);\n }\n\n /**\n * ### .hasAllDeepKeys(object, [keys], [message])\n *\n * Asserts that `object` has all and only all of the `keys` provided.\n * Since Sets and Maps can have objects as keys you can use this assertion to perform\n * a deep comparison.\n * You can also provide a single object instead of a `keys` array and its keys\n * will be used as the expected set of keys.\n *\n * assert.hasAllDeepKeys(new Map([[{one: 'one'}, 'valueOne']]), {one: 'one'});\n * assert.hasAllDeepKeys(new Map([[{one: 'one'}, 'valueOne'], [{two: 'two'}, 'valueTwo']]), [{one: 'one'}, {two: 'two'}]);\n * assert.hasAllDeepKeys(new Set([{one: 'one'}]), {one: 'one'});\n * assert.hasAllDeepKeys(new Set([{one: 'one'}, {two: 'two'}]), [{one: 'one'}, {two: 'two'}]);\n *\n * @name hasAllDeepKeys\n * @param {Mixed} object\n * @param {Array|Object} keys\n * @param {String} message\n * @namespace Assert\n * @api public\n */\n\n assert.hasAllDeepKeys = function (obj, keys, msg) {\n new Assertion(obj, msg, assert.hasAllDeepKeys, true)\n .to.have.all.deep.keys(keys);\n }\n\n /**\n * ### .containsAllDeepKeys(object, [keys], [message])\n *\n * Asserts that `object` contains all of the `keys` provided.\n * Since Sets and Maps can have objects as keys you can use this assertion to perform\n * a deep comparison.\n * You can also provide a single object instead of a `keys` array and its keys\n * will be used as the expected set of keys.\n *\n * assert.containsAllDeepKeys(new Map([[{one: 'one'}, 'valueOne'], [1, 2]]), {one: 'one'});\n * assert.containsAllDeepKeys(new Map([[{one: 'one'}, 'valueOne'], [{two: 'two'}, 'valueTwo']]), [{one: 'one'}, {two: 'two'}]);\n * assert.containsAllDeepKeys(new Set([{one: 'one'}, {two: 'two'}]), {one: 'one'});\n * assert.containsAllDeepKeys(new Set([{one: 'one'}, {two: 'two'}]), [{one: 'one'}, {two: 'two'}]);\n *\n * @name containsAllDeepKeys\n * @param {Mixed} object\n * @param {Array|Object} keys\n * @param {String} message\n * @namespace Assert\n * @api public\n */\n\n assert.containsAllDeepKeys = function (obj, keys, msg) {\n new Assertion(obj, msg, assert.containsAllDeepKeys, true)\n .to.contain.all.deep.keys(keys);\n }\n\n /**\n * ### .doesNotHaveAnyDeepKeys(object, [keys], [message])\n *\n * Asserts that `object` has none of the `keys` provided.\n * Since Sets and Maps can have objects as keys you can use this assertion to perform\n * a deep comparison.\n * You can also provide a single object instead of a `keys` array and its keys\n * will be used as the expected set of keys.\n *\n * assert.doesNotHaveAnyDeepKeys(new Map([[{one: 'one'}, 'valueOne'], [1, 2]]), {thisDoesNot: 'exist'});\n * assert.doesNotHaveAnyDeepKeys(new Map([[{one: 'one'}, 'valueOne'], [{two: 'two'}, 'valueTwo']]), [{twenty: 'twenty'}, {fifty: 'fifty'}]);\n * assert.doesNotHaveAnyDeepKeys(new Set([{one: 'one'}, {two: 'two'}]), {twenty: 'twenty'});\n * assert.doesNotHaveAnyDeepKeys(new Set([{one: 'one'}, {two: 'two'}]), [{twenty: 'twenty'}, {fifty: 'fifty'}]);\n *\n * @name doesNotHaveAnyDeepKeys\n * @param {Mixed} object\n * @param {Array|Object} keys\n * @param {String} message\n * @namespace Assert\n * @api public\n */\n\n assert.doesNotHaveAnyDeepKeys = function (obj, keys, msg) {\n new Assertion(obj, msg, assert.doesNotHaveAnyDeepKeys, true)\n .to.not.have.any.deep.keys(keys);\n }\n\n /**\n * ### .doesNotHaveAllDeepKeys(object, [keys], [message])\n *\n * Asserts that `object` does not have at least one of the `keys` provided.\n * Since Sets and Maps can have objects as keys you can use this assertion to perform\n * a deep comparison.\n * You can also provide a single object instead of a `keys` array and its keys\n * will be used as the expected set of keys.\n *\n * assert.doesNotHaveAllDeepKeys(new Map([[{one: 'one'}, 'valueOne'], [1, 2]]), {thisDoesNot: 'exist'});\n * assert.doesNotHaveAllDeepKeys(new Map([[{one: 'one'}, 'valueOne'], [{two: 'two'}, 'valueTwo']]), [{twenty: 'twenty'}, {one: 'one'}]);\n * assert.doesNotHaveAllDeepKeys(new Set([{one: 'one'}, {two: 'two'}]), {twenty: 'twenty'});\n * assert.doesNotHaveAllDeepKeys(new Set([{one: 'one'}, {two: 'two'}]), [{one: 'one'}, {fifty: 'fifty'}]);\n *\n * @name doesNotHaveAllDeepKeys\n * @param {Mixed} object\n * @param {Array|Object} keys\n * @param {String} message\n * @namespace Assert\n * @api public\n */\n\n assert.doesNotHaveAllDeepKeys = function (obj, keys, msg) {\n new Assertion(obj, msg, assert.doesNotHaveAllDeepKeys, true)\n .to.not.have.all.deep.keys(keys);\n }\n\n /**\n * ### .throws(fn, [errorLike/string/regexp], [string/regexp], [message])\n *\n * If `errorLike` is an `Error` constructor, asserts that `fn` will throw an error that is an\n * instance of `errorLike`.\n * If `errorLike` is an `Error` instance, asserts that the error thrown is the same\n * instance as `errorLike`.\n * If `errMsgMatcher` is provided, it also asserts that the error thrown will have a\n * message matching `errMsgMatcher`.\n *\n * assert.throws(fn, 'function throws a reference error');\n * assert.throws(fn, /function throws a reference error/);\n * assert.throws(fn, ReferenceError);\n * assert.throws(fn, errorInstance);\n * assert.throws(fn, ReferenceError, 'Error thrown must be a ReferenceError and have this msg');\n * assert.throws(fn, errorInstance, 'Error thrown must be the same errorInstance and have this msg');\n * assert.throws(fn, ReferenceError, /Error thrown must be a ReferenceError and match this/);\n * assert.throws(fn, errorInstance, /Error thrown must be the same errorInstance and match this/);\n *\n * @name throws\n * @alias throw\n * @alias Throw\n * @param {Function} fn\n * @param {ErrorConstructor|Error} errorLike\n * @param {RegExp|String} errMsgMatcher\n * @param {String} message\n * @see https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Error#Error_types\n * @namespace Assert\n * @api public\n */\n\n assert.throws = function (fn, errorLike, errMsgMatcher, msg) {\n if ('string' === typeof errorLike || errorLike instanceof RegExp) {\n errMsgMatcher = errorLike;\n errorLike = null;\n }\n\n var assertErr = new Assertion(fn, msg, assert.throws, true)\n .to.throw(errorLike, errMsgMatcher);\n return flag(assertErr, 'object');\n };\n\n /**\n * ### .doesNotThrow(fn, [errorLike/string/regexp], [string/regexp], [message])\n *\n * If `errorLike` is an `Error` constructor, asserts that `fn` will _not_ throw an error that is an\n * instance of `errorLike`.\n * If `errorLike` is an `Error` instance, asserts that the error thrown is _not_ the same\n * instance as `errorLike`.\n * If `errMsgMatcher` is provided, it also asserts that the error thrown will _not_ have a\n * message matching `errMsgMatcher`.\n *\n * assert.doesNotThrow(fn, 'Any Error thrown must not have this message');\n * assert.doesNotThrow(fn, /Any Error thrown must not match this/);\n * assert.doesNotThrow(fn, Error);\n * assert.doesNotThrow(fn, errorInstance);\n * assert.doesNotThrow(fn, Error, 'Error must not have this message');\n * assert.doesNotThrow(fn, errorInstance, 'Error must not have this message');\n * assert.doesNotThrow(fn, Error, /Error must not match this/);\n * assert.doesNotThrow(fn, errorInstance, /Error must not match this/);\n *\n * @name doesNotThrow\n * @param {Function} fn\n * @param {ErrorConstructor} errorLike\n * @param {RegExp|String} errMsgMatcher\n * @param {String} message\n * @see https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Error#Error_types\n * @namespace Assert\n * @api public\n */\n\n assert.doesNotThrow = function (fn, errorLike, errMsgMatcher, msg) {\n if ('string' === typeof errorLike || errorLike instanceof RegExp) {\n errMsgMatcher = errorLike;\n errorLike = null;\n }\n\n new Assertion(fn, msg, assert.doesNotThrow, true)\n .to.not.throw(errorLike, errMsgMatcher);\n };\n\n /**\n * ### .operator(val1, operator, val2, [message])\n *\n * Compares two values using `operator`.\n *\n * assert.operator(1, '<', 2, 'everything is ok');\n * assert.operator(1, '>', 2, 'this will fail');\n *\n * @name operator\n * @param {Mixed} val1\n * @param {String} operator\n * @param {Mixed} val2\n * @param {String} message\n * @namespace Assert\n * @api public\n */\n\n assert.operator = function (val, operator, val2, msg) {\n var ok;\n switch(operator) {\n case '==':\n ok = val == val2;\n break;\n case '===':\n ok = val === val2;\n break;\n case '>':\n ok = val > val2;\n break;\n case '>=':\n ok = val >= val2;\n break;\n case '<':\n ok = val < val2;\n break;\n case '<=':\n ok = val <= val2;\n break;\n case '!=':\n ok = val != val2;\n break;\n case '!==':\n ok = val !== val2;\n break;\n default:\n msg = msg ? msg + ': ' : msg;\n throw new chai.AssertionError(\n msg + 'Invalid operator \"' + operator + '\"',\n undefined,\n assert.operator\n );\n }\n var test = new Assertion(ok, msg, assert.operator, true);\n test.assert(\n true === flag(test, 'object')\n , 'expected ' + util.inspect(val) + ' to be ' + operator + ' ' + util.inspect(val2)\n , 'expected ' + util.inspect(val) + ' to not be ' + operator + ' ' + util.inspect(val2) );\n };\n\n /**\n * ### .closeTo(actual, expected, delta, [message])\n *\n * Asserts that the target is equal `expected`, to within a +/- `delta` range.\n *\n * assert.closeTo(1.5, 1, 0.5, 'numbers are close');\n *\n * @name closeTo\n * @param {Number} actual\n * @param {Number} expected\n * @param {Number} delta\n * @param {String} message\n * @namespace Assert\n * @api public\n */\n\n assert.closeTo = function (act, exp, delta, msg) {\n new Assertion(act, msg, assert.closeTo, true).to.be.closeTo(exp, delta);\n };\n\n /**\n * ### .approximately(actual, expected, delta, [message])\n *\n * Asserts that the target is equal `expected`, to within a +/- `delta` range.\n *\n * assert.approximately(1.5, 1, 0.5, 'numbers are close');\n *\n * @name approximately\n * @param {Number} actual\n * @param {Number} expected\n * @param {Number} delta\n * @param {String} message\n * @namespace Assert\n * @api public\n */\n\n assert.approximately = function (act, exp, delta, msg) {\n new Assertion(act, msg, assert.approximately, true)\n .to.be.approximately(exp, delta);\n };\n\n /**\n * ### .sameMembers(set1, set2, [message])\n *\n * Asserts that `set1` and `set2` have the same members in any order. Uses a\n * strict equality check (===).\n *\n * assert.sameMembers([ 1, 2, 3 ], [ 2, 1, 3 ], 'same members');\n *\n * @name sameMembers\n * @param {Array} set1\n * @param {Array} set2\n * @param {String} message\n * @namespace Assert\n * @api public\n */\n\n assert.sameMembers = function (set1, set2, msg) {\n new Assertion(set1, msg, assert.sameMembers, true)\n .to.have.same.members(set2);\n }\n\n /**\n * ### .notSameMembers(set1, set2, [message])\n *\n * Asserts that `set1` and `set2` don't have the same members in any order.\n * Uses a strict equality check (===).\n *\n * assert.notSameMembers([ 1, 2, 3 ], [ 5, 1, 3 ], 'not same members');\n *\n * @name notSameMembers\n * @param {Array} set1\n * @param {Array} set2\n * @param {String} message\n * @namespace Assert\n * @api public\n */\n\n assert.notSameMembers = function (set1, set2, msg) {\n new Assertion(set1, msg, assert.notSameMembers, true)\n .to.not.have.same.members(set2);\n }\n\n /**\n * ### .sameDeepMembers(set1, set2, [message])\n *\n * Asserts that `set1` and `set2` have the same members in any order. Uses a\n * deep equality check.\n *\n * assert.sameDeepMembers([ { a: 1 }, { b: 2 }, { c: 3 } ], [{ b: 2 }, { a: 1 }, { c: 3 }], 'same deep members');\n *\n * @name sameDeepMembers\n * @param {Array} set1\n * @param {Array} set2\n * @param {String} message\n * @namespace Assert\n * @api public\n */\n\n assert.sameDeepMembers = function (set1, set2, msg) {\n new Assertion(set1, msg, assert.sameDeepMembers, true)\n .to.have.same.deep.members(set2);\n }\n\n /**\n * ### .notSameDeepMembers(set1, set2, [message])\n *\n * Asserts that `set1` and `set2` don't have the same members in any order.\n * Uses a deep equality check.\n *\n * assert.notSameDeepMembers([ { a: 1 }, { b: 2 }, { c: 3 } ], [{ b: 2 }, { a: 1 }, { f: 5 }], 'not same deep members');\n *\n * @name notSameDeepMembers\n * @param {Array} set1\n * @param {Array} set2\n * @param {String} message\n * @namespace Assert\n * @api public\n */\n\n assert.notSameDeepMembers = function (set1, set2, msg) {\n new Assertion(set1, msg, assert.notSameDeepMembers, true)\n .to.not.have.same.deep.members(set2);\n }\n\n /**\n * ### .sameOrderedMembers(set1, set2, [message])\n *\n * Asserts that `set1` and `set2` have the same members in the same order.\n * Uses a strict equality check (===).\n *\n * assert.sameOrderedMembers([ 1, 2, 3 ], [ 1, 2, 3 ], 'same ordered members');\n *\n * @name sameOrderedMembers\n * @param {Array} set1\n * @param {Array} set2\n * @param {String} message\n * @namespace Assert\n * @api public\n */\n\n assert.sameOrderedMembers = function (set1, set2, msg) {\n new Assertion(set1, msg, assert.sameOrderedMembers, true)\n .to.have.same.ordered.members(set2);\n }\n\n /**\n * ### .notSameOrderedMembers(set1, set2, [message])\n *\n * Asserts that `set1` and `set2` don't have the same members in the same\n * order. Uses a strict equality check (===).\n *\n * assert.notSameOrderedMembers([ 1, 2, 3 ], [ 2, 1, 3 ], 'not same ordered members');\n *\n * @name notSameOrderedMembers\n * @param {Array} set1\n * @param {Array} set2\n * @param {String} message\n * @namespace Assert\n * @api public\n */\n\n assert.notSameOrderedMembers = function (set1, set2, msg) {\n new Assertion(set1, msg, assert.notSameOrderedMembers, true)\n .to.not.have.same.ordered.members(set2);\n }\n\n /**\n * ### .sameDeepOrderedMembers(set1, set2, [message])\n *\n * Asserts that `set1` and `set2` have the same members in the same order.\n * Uses a deep equality check.\n *\n * assert.sameDeepOrderedMembers([ { a: 1 }, { b: 2 }, { c: 3 } ], [ { a: 1 }, { b: 2 }, { c: 3 } ], 'same deep ordered members');\n *\n * @name sameDeepOrderedMembers\n * @param {Array} set1\n * @param {Array} set2\n * @param {String} message\n * @namespace Assert\n * @api public\n */\n\n assert.sameDeepOrderedMembers = function (set1, set2, msg) {\n new Assertion(set1, msg, assert.sameDeepOrderedMembers, true)\n .to.have.same.deep.ordered.members(set2);\n }\n\n /**\n * ### .notSameDeepOrderedMembers(set1, set2, [message])\n *\n * Asserts that `set1` and `set2` don't have the same members in the same\n * order. Uses a deep equality check.\n *\n * assert.notSameDeepOrderedMembers([ { a: 1 }, { b: 2 }, { c: 3 } ], [ { a: 1 }, { b: 2 }, { z: 5 } ], 'not same deep ordered members');\n * assert.notSameDeepOrderedMembers([ { a: 1 }, { b: 2 }, { c: 3 } ], [ { b: 2 }, { a: 1 }, { c: 3 } ], 'not same deep ordered members');\n *\n * @name notSameDeepOrderedMembers\n * @param {Array} set1\n * @param {Array} set2\n * @param {String} message\n * @namespace Assert\n * @api public\n */\n\n assert.notSameDeepOrderedMembers = function (set1, set2, msg) {\n new Assertion(set1, msg, assert.notSameDeepOrderedMembers, true)\n .to.not.have.same.deep.ordered.members(set2);\n }\n\n /**\n * ### .includeMembers(superset, subset, [message])\n *\n * Asserts that `subset` is included in `superset` in any order. Uses a\n * strict equality check (===). Duplicates are ignored.\n *\n * assert.includeMembers([ 1, 2, 3 ], [ 2, 1, 2 ], 'include members');\n *\n * @name includeMembers\n * @param {Array} superset\n * @param {Array} subset\n * @param {String} message\n * @namespace Assert\n * @api public\n */\n\n assert.includeMembers = function (superset, subset, msg) {\n new Assertion(superset, msg, assert.includeMembers, true)\n .to.include.members(subset);\n }\n\n /**\n * ### .notIncludeMembers(superset, subset, [message])\n *\n * Asserts that `subset` isn't included in `superset` in any order. Uses a\n * strict equality check (===). Duplicates are ignored.\n *\n * assert.notIncludeMembers([ 1, 2, 3 ], [ 5, 1 ], 'not include members');\n *\n * @name notIncludeMembers\n * @param {Array} superset\n * @param {Array} subset\n * @param {String} message\n * @namespace Assert\n * @api public\n */\n\n assert.notIncludeMembers = function (superset, subset, msg) {\n new Assertion(superset, msg, assert.notIncludeMembers, true)\n .to.not.include.members(subset);\n }\n\n /**\n * ### .includeDeepMembers(superset, subset, [message])\n *\n * Asserts that `subset` is included in `superset` in any order. Uses a deep\n * equality check. Duplicates are ignored.\n *\n * assert.includeDeepMembers([ { a: 1 }, { b: 2 }, { c: 3 } ], [ { b: 2 }, { a: 1 }, { b: 2 } ], 'include deep members');\n *\n * @name includeDeepMembers\n * @param {Array} superset\n * @param {Array} subset\n * @param {String} message\n * @namespace Assert\n * @api public\n */\n\n assert.includeDeepMembers = function (superset, subset, msg) {\n new Assertion(superset, msg, assert.includeDeepMembers, true)\n .to.include.deep.members(subset);\n }\n\n /**\n * ### .notIncludeDeepMembers(superset, subset, [message])\n *\n * Asserts that `subset` isn't included in `superset` in any order. Uses a\n * deep equality check. Duplicates are ignored.\n *\n * assert.notIncludeDeepMembers([ { a: 1 }, { b: 2 }, { c: 3 } ], [ { b: 2 }, { f: 5 } ], 'not include deep members');\n *\n * @name notIncludeDeepMembers\n * @param {Array} superset\n * @param {Array} subset\n * @param {String} message\n * @namespace Assert\n * @api public\n */\n\n assert.notIncludeDeepMembers = function (superset, subset, msg) {\n new Assertion(superset, msg, assert.notIncludeDeepMembers, true)\n .to.not.include.deep.members(subset);\n }\n\n /**\n * ### .includeOrderedMembers(superset, subset, [message])\n *\n * Asserts that `subset` is included in `superset` in the same order\n * beginning with the first element in `superset`. Uses a strict equality\n * check (===).\n *\n * assert.includeOrderedMembers([ 1, 2, 3 ], [ 1, 2 ], 'include ordered members');\n *\n * @name includeOrderedMembers\n * @param {Array} superset\n * @param {Array} subset\n * @param {String} message\n * @namespace Assert\n * @api public\n */\n\n assert.includeOrderedMembers = function (superset, subset, msg) {\n new Assertion(superset, msg, assert.includeOrderedMembers, true)\n .to.include.ordered.members(subset);\n }\n\n /**\n * ### .notIncludeOrderedMembers(superset, subset, [message])\n *\n * Asserts that `subset` isn't included in `superset` in the same order\n * beginning with the first element in `superset`. Uses a strict equality\n * check (===).\n *\n * assert.notIncludeOrderedMembers([ 1, 2, 3 ], [ 2, 1 ], 'not include ordered members');\n * assert.notIncludeOrderedMembers([ 1, 2, 3 ], [ 2, 3 ], 'not include ordered members');\n *\n * @name notIncludeOrderedMembers\n * @param {Array} superset\n * @param {Array} subset\n * @param {String} message\n * @namespace Assert\n * @api public\n */\n\n assert.notIncludeOrderedMembers = function (superset, subset, msg) {\n new Assertion(superset, msg, assert.notIncludeOrderedMembers, true)\n .to.not.include.ordered.members(subset);\n }\n\n /**\n * ### .includeDeepOrderedMembers(superset, subset, [message])\n *\n * Asserts that `subset` is included in `superset` in the same order\n * beginning with the first element in `superset`. Uses a deep equality\n * check.\n *\n * assert.includeDeepOrderedMembers([ { a: 1 }, { b: 2 }, { c: 3 } ], [ { a: 1 }, { b: 2 } ], 'include deep ordered members');\n *\n * @name includeDeepOrderedMembers\n * @param {Array} superset\n * @param {Array} subset\n * @param {String} message\n * @namespace Assert\n * @api public\n */\n\n assert.includeDeepOrderedMembers = function (superset, subset, msg) {\n new Assertion(superset, msg, assert.includeDeepOrderedMembers, true)\n .to.include.deep.ordered.members(subset);\n }\n\n /**\n * ### .notIncludeDeepOrderedMembers(superset, subset, [message])\n *\n * Asserts that `subset` isn't included in `superset` in the same order\n * beginning with the first element in `superset`. Uses a deep equality\n * check.\n *\n * assert.notIncludeDeepOrderedMembers([ { a: 1 }, { b: 2 }, { c: 3 } ], [ { a: 1 }, { f: 5 } ], 'not include deep ordered members');\n * assert.notIncludeDeepOrderedMembers([ { a: 1 }, { b: 2 }, { c: 3 } ], [ { b: 2 }, { a: 1 } ], 'not include deep ordered members');\n * assert.notIncludeDeepOrderedMembers([ { a: 1 }, { b: 2 }, { c: 3 } ], [ { b: 2 }, { c: 3 } ], 'not include deep ordered members');\n *\n * @name notIncludeDeepOrderedMembers\n * @param {Array} superset\n * @param {Array} subset\n * @param {String} message\n * @namespace Assert\n * @api public\n */\n\n assert.notIncludeDeepOrderedMembers = function (superset, subset, msg) {\n new Assertion(superset, msg, assert.notIncludeDeepOrderedMembers, true)\n .to.not.include.deep.ordered.members(subset);\n }\n\n /**\n * ### .oneOf(inList, list, [message])\n *\n * Asserts that non-object, non-array value `inList` appears in the flat array `list`.\n *\n * assert.oneOf(1, [ 2, 1 ], 'Not found in list');\n *\n * @name oneOf\n * @param {*} inList\n * @param {Array<*>} list\n * @param {String} message\n * @namespace Assert\n * @api public\n */\n\n assert.oneOf = function (inList, list, msg) {\n new Assertion(inList, msg, assert.oneOf, true).to.be.oneOf(list);\n }\n\n /**\n * ### .changes(function, object, property, [message])\n *\n * Asserts that a function changes the value of a property.\n *\n * var obj = { val: 10 };\n * var fn = function() { obj.val = 22 };\n * assert.changes(fn, obj, 'val');\n *\n * @name changes\n * @param {Function} modifier function\n * @param {Object} object or getter function\n * @param {String} property name _optional_\n * @param {String} message _optional_\n * @namespace Assert\n * @api public\n */\n\n assert.changes = function (fn, obj, prop, msg) {\n if (arguments.length === 3 && typeof obj === 'function') {\n msg = prop;\n prop = null;\n }\n\n new Assertion(fn, msg, assert.changes, true).to.change(obj, prop);\n }\n\n /**\n * ### .changesBy(function, object, property, delta, [message])\n *\n * Asserts that a function changes the value of a property by an amount (delta).\n *\n * var obj = { val: 10 };\n * var fn = function() { obj.val += 2 };\n * assert.changesBy(fn, obj, 'val', 2);\n *\n * @name changesBy\n * @param {Function} modifier function\n * @param {Object} object or getter function\n * @param {String} property name _optional_\n * @param {Number} change amount (delta)\n * @param {String} message _optional_\n * @namespace Assert\n * @api public\n */\n\n assert.changesBy = function (fn, obj, prop, delta, msg) {\n if (arguments.length === 4 && typeof obj === 'function') {\n var tmpMsg = delta;\n delta = prop;\n msg = tmpMsg;\n } else if (arguments.length === 3) {\n delta = prop;\n prop = null;\n }\n\n new Assertion(fn, msg, assert.changesBy, true)\n .to.change(obj, prop).by(delta);\n }\n\n /**\n * ### .doesNotChange(function, object, property, [message])\n *\n * Asserts that a function does not change the value of a property.\n *\n * var obj = { val: 10 };\n * var fn = function() { console.log('foo'); };\n * assert.doesNotChange(fn, obj, 'val');\n *\n * @name doesNotChange\n * @param {Function} modifier function\n * @param {Object} object or getter function\n * @param {String} property name _optional_\n * @param {String} message _optional_\n * @namespace Assert\n * @api public\n */\n\n assert.doesNotChange = function (fn, obj, prop, msg) {\n if (arguments.length === 3 && typeof obj === 'function') {\n msg = prop;\n prop = null;\n }\n\n return new Assertion(fn, msg, assert.doesNotChange, true)\n .to.not.change(obj, prop);\n }\n\n /**\n * ### .changesButNotBy(function, object, property, delta, [message])\n *\n * Asserts that a function does not change the value of a property or of a function's return value by an amount (delta)\n *\n * var obj = { val: 10 };\n * var fn = function() { obj.val += 10 };\n * assert.changesButNotBy(fn, obj, 'val', 5);\n *\n * @name changesButNotBy\n * @param {Function} modifier function\n * @param {Object} object or getter function\n * @param {String} property name _optional_\n * @param {Number} change amount (delta)\n * @param {String} message _optional_\n * @namespace Assert\n * @api public\n */\n\n assert.changesButNotBy = function (fn, obj, prop, delta, msg) {\n if (arguments.length === 4 && typeof obj === 'function') {\n var tmpMsg = delta;\n delta = prop;\n msg = tmpMsg;\n } else if (arguments.length === 3) {\n delta = prop;\n prop = null;\n }\n\n new Assertion(fn, msg, assert.changesButNotBy, true)\n .to.change(obj, prop).but.not.by(delta);\n }\n\n /**\n * ### .increases(function, object, property, [message])\n *\n * Asserts that a function increases a numeric object property.\n *\n * var obj = { val: 10 };\n * var fn = function() { obj.val = 13 };\n * assert.increases(fn, obj, 'val');\n *\n * @name increases\n * @param {Function} modifier function\n * @param {Object} object or getter function\n * @param {String} property name _optional_\n * @param {String} message _optional_\n * @namespace Assert\n * @api public\n */\n\n assert.increases = function (fn, obj, prop, msg) {\n if (arguments.length === 3 && typeof obj === 'function') {\n msg = prop;\n prop = null;\n }\n\n return new Assertion(fn, msg, assert.increases, true)\n .to.increase(obj, prop);\n }\n\n /**\n * ### .increasesBy(function, object, property, delta, [message])\n *\n * Asserts that a function increases a numeric object property or a function's return value by an amount (delta).\n *\n * var obj = { val: 10 };\n * var fn = function() { obj.val += 10 };\n * assert.increasesBy(fn, obj, 'val', 10);\n *\n * @name increasesBy\n * @param {Function} modifier function\n * @param {Object} object or getter function\n * @param {String} property name _optional_\n * @param {Number} change amount (delta)\n * @param {String} message _optional_\n * @namespace Assert\n * @api public\n */\n\n assert.increasesBy = function (fn, obj, prop, delta, msg) {\n if (arguments.length === 4 && typeof obj === 'function') {\n var tmpMsg = delta;\n delta = prop;\n msg = tmpMsg;\n } else if (arguments.length === 3) {\n delta = prop;\n prop = null;\n }\n\n new Assertion(fn, msg, assert.increasesBy, true)\n .to.increase(obj, prop).by(delta);\n }\n\n /**\n * ### .doesNotIncrease(function, object, property, [message])\n *\n * Asserts that a function does not increase a numeric object property.\n *\n * var obj = { val: 10 };\n * var fn = function() { obj.val = 8 };\n * assert.doesNotIncrease(fn, obj, 'val');\n *\n * @name doesNotIncrease\n * @param {Function} modifier function\n * @param {Object} object or getter function\n * @param {String} property name _optional_\n * @param {String} message _optional_\n * @namespace Assert\n * @api public\n */\n\n assert.doesNotIncrease = function (fn, obj, prop, msg) {\n if (arguments.length === 3 && typeof obj === 'function') {\n msg = prop;\n prop = null;\n }\n\n return new Assertion(fn, msg, assert.doesNotIncrease, true)\n .to.not.increase(obj, prop);\n }\n\n /**\n * ### .increasesButNotBy(function, object, property, [message])\n *\n * Asserts that a function does not increase a numeric object property or function's return value by an amount (delta).\n *\n * var obj = { val: 10 };\n * var fn = function() { obj.val = 15 };\n * assert.increasesButNotBy(fn, obj, 'val', 10);\n *\n * @name increasesButNotBy\n * @param {Function} modifier function\n * @param {Object} object or getter function\n * @param {String} property name _optional_\n * @param {Number} change amount (delta)\n * @param {String} message _optional_\n * @namespace Assert\n * @api public\n */\n\n assert.increasesButNotBy = function (fn, obj, prop, delta, msg) {\n if (arguments.length === 4 && typeof obj === 'function') {\n var tmpMsg = delta;\n delta = prop;\n msg = tmpMsg;\n } else if (arguments.length === 3) {\n delta = prop;\n prop = null;\n }\n\n new Assertion(fn, msg, assert.increasesButNotBy, true)\n .to.increase(obj, prop).but.not.by(delta);\n }\n\n /**\n * ### .decreases(function, object, property, [message])\n *\n * Asserts that a function decreases a numeric object property.\n *\n * var obj = { val: 10 };\n * var fn = function() { obj.val = 5 };\n * assert.decreases(fn, obj, 'val');\n *\n * @name decreases\n * @param {Function} modifier function\n * @param {Object} object or getter function\n * @param {String} property name _optional_\n * @param {String} message _optional_\n * @namespace Assert\n * @api public\n */\n\n assert.decreases = function (fn, obj, prop, msg) {\n if (arguments.length === 3 && typeof obj === 'function') {\n msg = prop;\n prop = null;\n }\n\n return new Assertion(fn, msg, assert.decreases, true)\n .to.decrease(obj, prop);\n }\n\n /**\n * ### .decreasesBy(function, object, property, delta, [message])\n *\n * Asserts that a function decreases a numeric object property or a function's return value by an amount (delta)\n *\n * var obj = { val: 10 };\n * var fn = function() { obj.val -= 5 };\n * assert.decreasesBy(fn, obj, 'val', 5);\n *\n * @name decreasesBy\n * @param {Function} modifier function\n * @param {Object} object or getter function\n * @param {String} property name _optional_\n * @param {Number} change amount (delta)\n * @param {String} message _optional_\n * @namespace Assert\n * @api public\n */\n\n assert.decreasesBy = function (fn, obj, prop, delta, msg) {\n if (arguments.length === 4 && typeof obj === 'function') {\n var tmpMsg = delta;\n delta = prop;\n msg = tmpMsg;\n } else if (arguments.length === 3) {\n delta = prop;\n prop = null;\n }\n\n new Assertion(fn, msg, assert.decreasesBy, true)\n .to.decrease(obj, prop).by(delta);\n }\n\n /**\n * ### .doesNotDecrease(function, object, property, [message])\n *\n * Asserts that a function does not decreases a numeric object property.\n *\n * var obj = { val: 10 };\n * var fn = function() { obj.val = 15 };\n * assert.doesNotDecrease(fn, obj, 'val');\n *\n * @name doesNotDecrease\n * @param {Function} modifier function\n * @param {Object} object or getter function\n * @param {String} property name _optional_\n * @param {String} message _optional_\n * @namespace Assert\n * @api public\n */\n\n assert.doesNotDecrease = function (fn, obj, prop, msg) {\n if (arguments.length === 3 && typeof obj === 'function') {\n msg = prop;\n prop = null;\n }\n\n return new Assertion(fn, msg, assert.doesNotDecrease, true)\n .to.not.decrease(obj, prop);\n }\n\n /**\n * ### .doesNotDecreaseBy(function, object, property, delta, [message])\n *\n * Asserts that a function does not decreases a numeric object property or a function's return value by an amount (delta)\n *\n * var obj = { val: 10 };\n * var fn = function() { obj.val = 5 };\n * assert.doesNotDecreaseBy(fn, obj, 'val', 1);\n *\n * @name doesNotDecrease\n * @param {Function} modifier function\n * @param {Object} object or getter function\n * @param {String} property name _optional_\n * @param {Number} change amount (delta)\n * @param {String} message _optional_\n * @namespace Assert\n * @api public\n */\n\n assert.doesNotDecreaseBy = function (fn, obj, prop, delta, msg) {\n if (arguments.length === 4 && typeof obj === 'function') {\n var tmpMsg = delta;\n delta = prop;\n msg = tmpMsg;\n } else if (arguments.length === 3) {\n delta = prop;\n prop = null;\n }\n\n return new Assertion(fn, msg, assert.doesNotDecreaseBy, true)\n .to.not.decrease(obj, prop).by(delta);\n }\n\n /**\n * ### .decreasesButNotBy(function, object, property, delta, [message])\n *\n * Asserts that a function does not decreases a numeric object property or a function's return value by an amount (delta)\n *\n * var obj = { val: 10 };\n * var fn = function() { obj.val = 5 };\n * assert.decreasesButNotBy(fn, obj, 'val', 1);\n *\n * @name decreasesButNotBy\n * @param {Function} modifier function\n * @param {Object} object or getter function\n * @param {String} property name _optional_\n * @param {Number} change amount (delta)\n * @param {String} message _optional_\n * @namespace Assert\n * @api public\n */\n\n assert.decreasesButNotBy = function (fn, obj, prop, delta, msg) {\n if (arguments.length === 4 && typeof obj === 'function') {\n var tmpMsg = delta;\n delta = prop;\n msg = tmpMsg;\n } else if (arguments.length === 3) {\n delta = prop;\n prop = null;\n }\n\n new Assertion(fn, msg, assert.decreasesButNotBy, true)\n .to.decrease(obj, prop).but.not.by(delta);\n }\n\n /*!\n * ### .ifError(object)\n *\n * Asserts if value is not a false value, and throws if it is a true value.\n * This is added to allow for chai to be a drop-in replacement for Node's\n * assert class.\n *\n * var err = new Error('I am a custom error');\n * assert.ifError(err); // Rethrows err!\n *\n * @name ifError\n * @param {Object} object\n * @namespace Assert\n * @api public\n */\n\n assert.ifError = function (val) {\n if (val) {\n throw(val);\n }\n };\n\n /**\n * ### .isExtensible(object)\n *\n * Asserts that `object` is extensible (can have new properties added to it).\n *\n * assert.isExtensible({});\n *\n * @name isExtensible\n * @alias extensible\n * @param {Object} object\n * @param {String} message _optional_\n * @namespace Assert\n * @api public\n */\n\n assert.isExtensible = function (obj, msg) {\n new Assertion(obj, msg, assert.isExtensible, true).to.be.extensible;\n };\n\n /**\n * ### .isNotExtensible(object)\n *\n * Asserts that `object` is _not_ extensible.\n *\n * var nonExtensibleObject = Object.preventExtensions({});\n * var sealedObject = Object.seal({});\n * var frozenObject = Object.freeze({});\n *\n * assert.isNotExtensible(nonExtensibleObject);\n * assert.isNotExtensible(sealedObject);\n * assert.isNotExtensible(frozenObject);\n *\n * @name isNotExtensible\n * @alias notExtensible\n * @param {Object} object\n * @param {String} message _optional_\n * @namespace Assert\n * @api public\n */\n\n assert.isNotExtensible = function (obj, msg) {\n new Assertion(obj, msg, assert.isNotExtensible, true).to.not.be.extensible;\n };\n\n /**\n * ### .isSealed(object)\n *\n * Asserts that `object` is sealed (cannot have new properties added to it\n * and its existing properties cannot be removed).\n *\n * var sealedObject = Object.seal({});\n * var frozenObject = Object.seal({});\n *\n * assert.isSealed(sealedObject);\n * assert.isSealed(frozenObject);\n *\n * @name isSealed\n * @alias sealed\n * @param {Object} object\n * @param {String} message _optional_\n * @namespace Assert\n * @api public\n */\n\n assert.isSealed = function (obj, msg) {\n new Assertion(obj, msg, assert.isSealed, true).to.be.sealed;\n };\n\n /**\n * ### .isNotSealed(object)\n *\n * Asserts that `object` is _not_ sealed.\n *\n * assert.isNotSealed({});\n *\n * @name isNotSealed\n * @alias notSealed\n * @param {Object} object\n * @param {String} message _optional_\n * @namespace Assert\n * @api public\n */\n\n assert.isNotSealed = function (obj, msg) {\n new Assertion(obj, msg, assert.isNotSealed, true).to.not.be.sealed;\n };\n\n /**\n * ### .isFrozen(object)\n *\n * Asserts that `object` is frozen (cannot have new properties added to it\n * and its existing properties cannot be modified).\n *\n * var frozenObject = Object.freeze({});\n * assert.frozen(frozenObject);\n *\n * @name isFrozen\n * @alias frozen\n * @param {Object} object\n * @param {String} message _optional_\n * @namespace Assert\n * @api public\n */\n\n assert.isFrozen = function (obj, msg) {\n new Assertion(obj, msg, assert.isFrozen, true).to.be.frozen;\n };\n\n /**\n * ### .isNotFrozen(object)\n *\n * Asserts that `object` is _not_ frozen.\n *\n * assert.isNotFrozen({});\n *\n * @name isNotFrozen\n * @alias notFrozen\n * @param {Object} object\n * @param {String} message _optional_\n * @namespace Assert\n * @api public\n */\n\n assert.isNotFrozen = function (obj, msg) {\n new Assertion(obj, msg, assert.isNotFrozen, true).to.not.be.frozen;\n };\n\n /**\n * ### .isEmpty(target)\n *\n * Asserts that the target does not contain any values.\n * For arrays and strings, it checks the `length` property.\n * For `Map` and `Set` instances, it checks the `size` property.\n * For non-function objects, it gets the count of own\n * enumerable string keys.\n *\n * assert.isEmpty([]);\n * assert.isEmpty('');\n * assert.isEmpty(new Map);\n * assert.isEmpty({});\n *\n * @name isEmpty\n * @alias empty\n * @param {Object|Array|String|Map|Set} target\n * @param {String} message _optional_\n * @namespace Assert\n * @api public\n */\n\n assert.isEmpty = function(val, msg) {\n new Assertion(val, msg, assert.isEmpty, true).to.be.empty;\n };\n\n /**\n * ### .isNotEmpty(target)\n *\n * Asserts that the target contains values.\n * For arrays and strings, it checks the `length` property.\n * For `Map` and `Set` instances, it checks the `size` property.\n * For non-function objects, it gets the count of own\n * enumerable string keys.\n *\n * assert.isNotEmpty([1, 2]);\n * assert.isNotEmpty('34');\n * assert.isNotEmpty(new Set([5, 6]));\n * assert.isNotEmpty({ key: 7 });\n *\n * @name isNotEmpty\n * @alias notEmpty\n * @param {Object|Array|String|Map|Set} target\n * @param {String} message _optional_\n * @namespace Assert\n * @api public\n */\n\n assert.isNotEmpty = function(val, msg) {\n new Assertion(val, msg, assert.isNotEmpty, true).to.not.be.empty;\n };\n\n /*!\n * Aliases.\n */\n\n (function alias(name, as){\n assert[as] = assert[name];\n return alias;\n })\n ('isOk', 'ok')\n ('isNotOk', 'notOk')\n ('throws', 'throw')\n ('throws', 'Throw')\n ('isExtensible', 'extensible')\n ('isNotExtensible', 'notExtensible')\n ('isSealed', 'sealed')\n ('isNotSealed', 'notSealed')\n ('isFrozen', 'frozen')\n ('isNotFrozen', 'notFrozen')\n ('isEmpty', 'empty')\n ('isNotEmpty', 'notEmpty');\n};\n","/*!\n * chai\n * Copyright(c) 2011-2014 Jake Luer <jake@alogicalparadox.com>\n * MIT Licensed\n */\n\nmodule.exports = function (chai, util) {\n var Assertion = chai.Assertion;\n\n function loadShould () {\n // explicitly define this method as function as to have it's name to include as `ssfi`\n function shouldGetter() {\n if (this instanceof String\n || this instanceof Number\n || this instanceof Boolean\n || typeof Symbol === 'function' && this instanceof Symbol) {\n return new Assertion(this.valueOf(), null, shouldGetter);\n }\n return new Assertion(this, null, shouldGetter);\n }\n function shouldSetter(value) {\n // See https://github.com/chaijs/chai/issues/86: this makes\n // `whatever.should = someValue` actually set `someValue`, which is\n // especially useful for `global.should = require('chai').should()`.\n //\n // Note that we have to use [[DefineProperty]] instead of [[Put]]\n // since otherwise we would trigger this very setter!\n Object.defineProperty(this, 'should', {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n }\n // modify Object.prototype to have `should`\n Object.defineProperty(Object.prototype, 'should', {\n set: shouldSetter\n , get: shouldGetter\n , configurable: true\n });\n\n var should = {};\n\n /**\n * ### .fail(actual, expected, [message], [operator])\n *\n * Throw a failure.\n *\n * @name fail\n * @param {Mixed} actual\n * @param {Mixed} expected\n * @param {String} message\n * @param {String} operator\n * @namespace BDD\n * @api public\n */\n\n should.fail = function (actual, expected, message, operator) {\n message = message || 'should.fail()';\n throw new chai.AssertionError(message, {\n actual: actual\n , expected: expected\n , operator: operator\n }, should.fail);\n };\n\n /**\n * ### .equal(actual, expected, [message])\n *\n * Asserts non-strict equality (`==`) of `actual` and `expected`.\n *\n * should.equal(3, '3', '== coerces values to strings');\n *\n * @name equal\n * @param {Mixed} actual\n * @param {Mixed} expected\n * @param {String} message\n * @namespace Should\n * @api public\n */\n\n should.equal = function (val1, val2, msg) {\n new Assertion(val1, msg).to.equal(val2);\n };\n\n /**\n * ### .throw(function, [constructor/string/regexp], [string/regexp], [message])\n *\n * Asserts that `function` will throw an error that is an instance of\n * `constructor`, or alternately that it will throw an error with message\n * matching `regexp`.\n *\n * should.throw(fn, 'function throws a reference error');\n * should.throw(fn, /function throws a reference error/);\n * should.throw(fn, ReferenceError);\n * should.throw(fn, ReferenceError, 'function throws a reference error');\n * should.throw(fn, ReferenceError, /function throws a reference error/);\n *\n * @name throw\n * @alias Throw\n * @param {Function} function\n * @param {ErrorConstructor} constructor\n * @param {RegExp} regexp\n * @param {String} message\n * @see https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Error#Error_types\n * @namespace Should\n * @api public\n */\n\n should.Throw = function (fn, errt, errs, msg) {\n new Assertion(fn, msg).to.Throw(errt, errs);\n };\n\n /**\n * ### .exist\n *\n * Asserts that the target is neither `null` nor `undefined`.\n *\n * var foo = 'hi';\n *\n * should.exist(foo, 'foo exists');\n *\n * @name exist\n * @namespace Should\n * @api public\n */\n\n should.exist = function (val, msg) {\n new Assertion(val, msg).to.exist;\n }\n\n // negation\n should.not = {}\n\n /**\n * ### .not.equal(actual, expected, [message])\n *\n * Asserts non-strict inequality (`!=`) of `actual` and `expected`.\n *\n * should.not.equal(3, 4, 'these numbers are not equal');\n *\n * @name not.equal\n * @param {Mixed} actual\n * @param {Mixed} expected\n * @param {String} message\n * @namespace Should\n * @api public\n */\n\n should.not.equal = function (val1, val2, msg) {\n new Assertion(val1, msg).to.not.equal(val2);\n };\n\n /**\n * ### .throw(function, [constructor/regexp], [message])\n *\n * Asserts that `function` will _not_ throw an error that is an instance of\n * `constructor`, or alternately that it will not throw an error with message\n * matching `regexp`.\n *\n * should.not.throw(fn, Error, 'function does not throw');\n *\n * @name not.throw\n * @alias not.Throw\n * @param {Function} function\n * @param {ErrorConstructor} constructor\n * @param {RegExp} regexp\n * @param {String} message\n * @see https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Error#Error_types\n * @namespace Should\n * @api public\n */\n\n should.not.Throw = function (fn, errt, errs, msg) {\n new Assertion(fn, msg).to.not.Throw(errt, errs);\n };\n\n /**\n * ### .not.exist\n *\n * Asserts that the target is neither `null` nor `undefined`.\n *\n * var bar = null;\n *\n * should.not.exist(bar, 'bar does not exist');\n *\n * @name not.exist\n * @namespace Should\n * @api public\n */\n\n should.not.exist = function (val, msg) {\n new Assertion(val, msg).to.not.exist;\n }\n\n should['throw'] = should['Throw'];\n should.not['throw'] = should.not['Throw'];\n\n return should;\n };\n\n chai.should = loadShould;\n chai.Should = loadShould;\n};\n","/*!\n * chai\n * Copyright(c) 2011-2014 Jake Luer <jake@alogicalparadox.com>\n * MIT Licensed\n */\n\nmodule.exports = function (chai, util) {\n chai.expect = function (val, message) {\n return new chai.Assertion(val, message);\n };\n\n /**\n * ### .fail(actual, expected, [message], [operator])\n *\n * Throw a failure.\n *\n * @name fail\n * @param {Mixed} actual\n * @param {Mixed} expected\n * @param {String} message\n * @param {String} operator\n * @namespace BDD\n * @api public\n */\n\n chai.expect.fail = function (actual, expected, message, operator) {\n message = message || 'expect.fail()';\n throw new chai.AssertionError(message, {\n actual: actual\n , expected: expected\n , operator: operator\n }, chai.expect.fail);\n };\n};\n","/*!\n * chai\n * http://chaijs.com\n * Copyright(c) 2011-2014 Jake Luer <jake@alogicalparadox.com>\n * MIT Licensed\n */\n\nmodule.exports = function (chai, _) {\n var Assertion = chai.Assertion\n , AssertionError = chai.AssertionError\n , flag = _.flag;\n\n /**\n * ### Language Chains\n *\n * The following are provided as chainable getters to improve the readability\n * of your assertions.\n *\n * **Chains**\n *\n * - to\n * - be\n * - been\n * - is\n * - that\n * - which\n * - and\n * - has\n * - have\n * - with\n * - at\n * - of\n * - same\n * - but\n * - does\n *\n * @name language chains\n * @namespace BDD\n * @api public\n */\n\n [ 'to', 'be', 'been'\n , 'is', 'and', 'has', 'have'\n , 'with', 'that', 'which', 'at'\n , 'of', 'same', 'but', 'does' ].forEach(function (chain) {\n Assertion.addProperty(chain);\n });\n\n /**\n * ### .not\n *\n * Negates all assertions that follow in the chain.\n *\n * expect(function () {}).to.not.throw();\n * expect({a: 1}).to.not.have.property('b');\n * expect([1, 2]).to.be.an('array').that.does.not.include(3);\n *\n * Just because you can negate any assertion with `.not` doesn't mean you\n * should. With great power comes great responsibility. It's often best to\n * assert that the one expected output was produced, rather than asserting\n * that one of countless unexpected outputs wasn't produced. See individual\n * assertions for specific guidance.\n *\n * expect(2).to.equal(2); // Recommended\n * expect(2).to.not.equal(1); // Not recommended\n *\n * @name not\n * @namespace BDD\n * @api public\n */\n\n Assertion.addProperty('not', function () {\n flag(this, 'negate', true);\n });\n\n /**\n * ### .deep\n *\n * Causes all `.equal`, `.include`, `.members`, `.keys`, and `.property`\n * assertions that follow in the chain to use deep equality instead of strict\n * (`===`) equality. See the `deep-eql` project page for info on the deep\n * equality algorithm: https://github.com/chaijs/deep-eql.\n *\n * // Target object deeply (but not strictly) equals `{a: 1}`\n * expect({a: 1}).to.deep.equal({a: 1});\n * expect({a: 1}).to.not.equal({a: 1});\n *\n * // Target array deeply (but not strictly) includes `{a: 1}`\n * expect([{a: 1}]).to.deep.include({a: 1});\n * expect([{a: 1}]).to.not.include({a: 1});\n *\n * // Target object deeply (but not strictly) includes `x: {a: 1}`\n * expect({x: {a: 1}}).to.deep.include({x: {a: 1}});\n * expect({x: {a: 1}}).to.not.include({x: {a: 1}});\n *\n * // Target array deeply (but not strictly) has member `{a: 1}`\n * expect([{a: 1}]).to.have.deep.members([{a: 1}]);\n * expect([{a: 1}]).to.not.have.members([{a: 1}]);\n *\n * // Target set deeply (but not strictly) has key `{a: 1}`\n * expect(new Set([{a: 1}])).to.have.deep.keys([{a: 1}]);\n * expect(new Set([{a: 1}])).to.not.have.keys([{a: 1}]);\n *\n * // Target object deeply (but not strictly) has property `x: {a: 1}`\n * expect({x: {a: 1}}).to.have.deep.property('x', {a: 1});\n * expect({x: {a: 1}}).to.not.have.property('x', {a: 1});\n *\n * @name deep\n * @namespace BDD\n * @api public\n */\n\n Assertion.addProperty('deep', function () {\n flag(this, 'deep', true);\n });\n\n /**\n * ### .nested\n *\n * Enables dot- and bracket-notation in all `.property` and `.include`\n * assertions that follow in the chain.\n *\n * expect({a: {b: ['x', 'y']}}).to.have.nested.property('a.b[1]');\n * expect({a: {b: ['x', 'y']}}).to.nested.include({'a.b[1]': 'y'});\n *\n * If `.` or `[]` are part of an actual property name, they can be escaped by\n * adding two backslashes before them.\n *\n * expect({'.a': {'[b]': 'x'}}).to.have.nested.property('\\\\.a.\\\\[b\\\\]');\n * expect({'.a': {'[b]': 'x'}}).to.nested.include({'\\\\.a.\\\\[b\\\\]': 'x'});\n *\n * `.nested` cannot be combined with `.own`.\n *\n * @name nested\n * @namespace BDD\n * @api public\n */\n\n Assertion.addProperty('nested', function () {\n flag(this, 'nested', true);\n });\n\n /**\n * ### .own\n *\n * Causes all `.property` and `.include` assertions that follow in the chain\n * to ignore inherited properties.\n *\n * Object.prototype.b = 2;\n *\n * expect({a: 1}).to.have.own.property('a');\n * expect({a: 1}).to.have.property('b').but.not.own.property('b'); \n *\n * expect({a: 1}).to.own.include({a: 1});\n * expect({a: 1}).to.include({b: 2}).but.not.own.include({b: 2});\n *\n * `.own` cannot be combined with `.nested`.\n *\n * @name own\n * @namespace BDD\n * @api public\n */\n\n Assertion.addProperty('own', function () {\n flag(this, 'own', true);\n });\n\n /**\n * ### .ordered\n *\n * Causes all `.members` assertions that follow in the chain to require that\n * members be in the same order.\n *\n * expect([1, 2]).to.have.ordered.members([1, 2])\n * .but.not.have.ordered.members([2, 1]);\n *\n * When `.include` and `.ordered` are combined, the ordering begins at the\n * start of both arrays.\n *\n * expect([1, 2, 3]).to.include.ordered.members([1, 2])\n * .but.not.include.ordered.members([2, 3]);\n *\n * @name ordered\n * @namespace BDD\n * @api public\n */\n\n Assertion.addProperty('ordered', function () {\n flag(this, 'ordered', true);\n });\n\n /**\n * ### .any\n *\n * Causes all `.keys` assertions that follow in the chain to only require that\n * the target have at least one of the given keys. This is the opposite of\n * `.all`, which requires that the target have all of the given keys.\n *\n * expect({a: 1, b: 2}).to.not.have.any.keys('c', 'd');\n *\n * See the `.keys` doc for guidance on when to use `.any` or `.all`.\n *\n * @name any\n * @namespace BDD\n * @api public\n */\n\n Assertion.addProperty('any', function () {\n flag(this, 'any', true);\n flag(this, 'all', false);\n });\n\n\n /**\n * ### .all\n *\n * Causes all `.keys` assertions that follow in the chain to require that the\n * target have all of the given keys. This is the opposite of `.any`, which\n * only requires that the target have at least one of the given keys.\n *\n * expect({a: 1, b: 2}).to.have.all.keys('a', 'b');\n *\n * Note that `.all` is used by default when neither `.all` nor `.any` are\n * added earlier in the chain. However, it's often best to add `.all` anyway\n * because it improves readability.\n *\n * See the `.keys` doc for guidance on when to use `.any` or `.all`.\n *\n * @name all\n * @namespace BDD\n * @api public\n */\n\n Assertion.addProperty('all', function () {\n flag(this, 'all', true);\n flag(this, 'any', false);\n });\n\n /**\n * ### .a(type[, msg])\n *\n * Asserts that the target's type is equal to the given string `type`. Types\n * are case insensitive. See the `type-detect` project page for info on the\n * type detection algorithm: https://github.com/chaijs/type-detect.\n *\n * expect('foo').to.be.a('string');\n * expect({a: 1}).to.be.an('object');\n * expect(null).to.be.a('null');\n * expect(undefined).to.be.an('undefined');\n * expect(new Error).to.be.an('error');\n * expect(Promise.resolve()).to.be.a('promise');\n * expect(new Float32Array).to.be.a('float32array');\n * expect(Symbol()).to.be.a('symbol');\n *\n * `.a` supports objects that have a custom type set via `Symbol.toStringTag`.\n *\n * var myObj = {\n * [Symbol.toStringTag]: 'myCustomType'\n * };\n *\n * expect(myObj).to.be.a('myCustomType').but.not.an('object');\n *\n * It's often best to use `.a` to check a target's type before making more\n * assertions on the same target. That way, you avoid unexpected behavior from\n * any assertion that does different things based on the target's type.\n *\n * expect([1, 2, 3]).to.be.an('array').that.includes(2);\n * expect([]).to.be.an('array').that.is.empty;\n *\n * Add `.not` earlier in the chain to negate `.a`. However, it's often best to\n * assert that the target is the expected type, rather than asserting that it\n * isn't one of many unexpected types.\n *\n * expect('foo').to.be.a('string'); // Recommended\n * expect('foo').to.not.be.an('array'); // Not recommended\n *\n * `.a` accepts an optional `msg` argument which is a custom error message to\n * show when the assertion fails. The message can also be given as the second\n * argument to `expect`.\n *\n * expect(1).to.be.a('string', 'nooo why fail??');\n * expect(1, 'nooo why fail??').to.be.a('string');\n *\n * `.a` can also be used as a language chain to improve the readability of\n * your assertions. \n *\n * expect({b: 2}).to.have.a.property('b');\n *\n * The alias `.an` can be used interchangeably with `.a`.\n *\n * @name a\n * @alias an\n * @param {String} type\n * @param {String} msg _optional_\n * @namespace BDD\n * @api public\n */\n\n function an (type, msg) {\n if (msg) flag(this, 'message', msg);\n type = type.toLowerCase();\n var obj = flag(this, 'object')\n , article = ~[ 'a', 'e', 'i', 'o', 'u' ].indexOf(type.charAt(0)) ? 'an ' : 'a ';\n\n this.assert(\n type === _.type(obj).toLowerCase()\n , 'expected #{this} to be ' + article + type\n , 'expected #{this} not to be ' + article + type\n );\n }\n\n Assertion.addChainableMethod('an', an);\n Assertion.addChainableMethod('a', an);\n\n /**\n * ### .include(val[, msg])\n *\n * When the target is a string, `.include` asserts that the given string `val`\n * is a substring of the target.\n *\n * expect('foobar').to.include('foo');\n *\n * When the target is an array, `.include` asserts that the given `val` is a\n * member of the target.\n *\n * expect([1, 2, 3]).to.include(2);\n *\n * When the target is an object, `.include` asserts that the given object\n * `val`'s properties are a subset of the target's properties.\n *\n * expect({a: 1, b: 2, c: 3}).to.include({a: 1, b: 2});\n *\n * When the target is a Set or WeakSet, `.include` asserts that the given `val` is a\n * member of the target. SameValueZero equality algorithm is used.\n *\n * expect(new Set([1, 2])).to.include(2);\n *\n * When the target is a Map, `.include` asserts that the given `val` is one of\n * the values of the target. SameValueZero equality algorithm is used.\n *\n * expect(new Map([['a', 1], ['b', 2]])).to.include(2);\n *\n * Because `.include` does different things based on the target's type, it's\n * important to check the target's type before using `.include`. See the `.a`\n * doc for info on testing a target's type.\n *\n * expect([1, 2, 3]).to.be.an('array').that.includes(2);\n *\n * By default, strict (`===`) equality is used to compare array members and\n * object properties. Add `.deep` earlier in the chain to use deep equality\n * instead (WeakSet targets are not supported). See the `deep-eql` project\n * page for info on the deep equality algorithm: https://github.com/chaijs/deep-eql.\n *\n * // Target array deeply (but not strictly) includes `{a: 1}`\n * expect([{a: 1}]).to.deep.include({a: 1});\n * expect([{a: 1}]).to.not.include({a: 1});\n *\n * // Target object deeply (but not strictly) includes `x: {a: 1}`\n * expect({x: {a: 1}}).to.deep.include({x: {a: 1}});\n * expect({x: {a: 1}}).to.not.include({x: {a: 1}});\n *\n * By default, all of the target's properties are searched when working with\n * objects. This includes properties that are inherited and/or non-enumerable.\n * Add `.own` earlier in the chain to exclude the target's inherited\n * properties from the search.\n *\n * Object.prototype.b = 2;\n *\n * expect({a: 1}).to.own.include({a: 1});\n * expect({a: 1}).to.include({b: 2}).but.not.own.include({b: 2});\n *\n * Note that a target object is always only searched for `val`'s own\n * enumerable properties.\n *\n * `.deep` and `.own` can be combined.\n *\n * expect({a: {b: 2}}).to.deep.own.include({a: {b: 2}});\n *\n * Add `.nested` earlier in the chain to enable dot- and bracket-notation when\n * referencing nested properties.\n *\n * expect({a: {b: ['x', 'y']}}).to.nested.include({'a.b[1]': 'y'});\n *\n * If `.` or `[]` are part of an actual property name, they can be escaped by\n * adding two backslashes before them.\n *\n * expect({'.a': {'[b]': 2}}).to.nested.include({'\\\\.a.\\\\[b\\\\]': 2});\n *\n * `.deep` and `.nested` can be combined.\n *\n * expect({a: {b: [{c: 3}]}}).to.deep.nested.include({'a.b[0]': {c: 3}});\n *\n * `.own` and `.nested` cannot be combined.\n *\n * Add `.not` earlier in the chain to negate `.include`.\n *\n * expect('foobar').to.not.include('taco');\n * expect([1, 2, 3]).to.not.include(4);\n * \n * However, it's dangerous to negate `.include` when the target is an object.\n * The problem is that it creates uncertain expectations by asserting that the\n * target object doesn't have all of `val`'s key/value pairs but may or may\n * not have some of them. It's often best to identify the exact output that's\n * expected, and then write an assertion that only accepts that exact output.\n *\n * When the target object isn't even expected to have `val`'s keys, it's\n * often best to assert exactly that.\n *\n * expect({c: 3}).to.not.have.any.keys('a', 'b'); // Recommended\n * expect({c: 3}).to.not.include({a: 1, b: 2}); // Not recommended\n *\n * When the target object is expected to have `val`'s keys, it's often best to\n * assert that each of the properties has its expected value, rather than\n * asserting that each property doesn't have one of many unexpected values.\n *\n * expect({a: 3, b: 4}).to.include({a: 3, b: 4}); // Recommended\n * expect({a: 3, b: 4}).to.not.include({a: 1, b: 2}); // Not recommended\n *\n * `.include` accepts an optional `msg` argument which is a custom error\n * message to show when the assertion fails. The message can also be given as\n * the second argument to `expect`.\n *\n * expect([1, 2, 3]).to.include(4, 'nooo why fail??');\n * expect([1, 2, 3], 'nooo why fail??').to.include(4);\n *\n * `.include` can also be used as a language chain, causing all `.members` and\n * `.keys` assertions that follow in the chain to require the target to be a\n * superset of the expected set, rather than an identical set. Note that\n * `.members` ignores duplicates in the subset when `.include` is added.\n *\n * // Target object's keys are a superset of ['a', 'b'] but not identical\n * expect({a: 1, b: 2, c: 3}).to.include.all.keys('a', 'b');\n * expect({a: 1, b: 2, c: 3}).to.not.have.all.keys('a', 'b');\n *\n * // Target array is a superset of [1, 2] but not identical\n * expect([1, 2, 3]).to.include.members([1, 2]);\n * expect([1, 2, 3]).to.not.have.members([1, 2]);\n *\n * // Duplicates in the subset are ignored\n * expect([1, 2, 3]).to.include.members([1, 2, 2, 2]);\n *\n * Note that adding `.any` earlier in the chain causes the `.keys` assertion\n * to ignore `.include`.\n *\n * // Both assertions are identical\n * expect({a: 1}).to.include.any.keys('a', 'b');\n * expect({a: 1}).to.have.any.keys('a', 'b');\n *\n * The aliases `.includes`, `.contain`, and `.contains` can be used\n * interchangeably with `.include`.\n *\n * @name include\n * @alias contain\n * @alias includes\n * @alias contains\n * @param {Mixed} val\n * @param {String} msg _optional_\n * @namespace BDD\n * @api public\n */\n\n function SameValueZero(a, b) {\n return (_.isNaN(a) && _.isNaN(b)) || a === b;\n }\n\n function includeChainingBehavior () {\n flag(this, 'contains', true);\n }\n\n function include (val, msg) {\n if (msg) flag(this, 'message', msg);\n \n var obj = flag(this, 'object')\n , objType = _.type(obj).toLowerCase()\n , flagMsg = flag(this, 'message')\n , negate = flag(this, 'negate')\n , ssfi = flag(this, 'ssfi')\n , isDeep = flag(this, 'deep')\n , descriptor = isDeep ? 'deep ' : '';\n\n flagMsg = flagMsg ? flagMsg + ': ' : '';\n\n var included = false;\n\n switch (objType) {\n case 'string':\n included = obj.indexOf(val) !== -1;\n break;\n\n case 'weakset':\n if (isDeep) {\n throw new AssertionError(\n flagMsg + 'unable to use .deep.include with WeakSet',\n undefined,\n ssfi\n );\n }\n\n included = obj.has(val);\n break;\n\n case 'map':\n var isEql = isDeep ? _.eql : SameValueZero;\n obj.forEach(function (item) {\n included = included || isEql(item, val);\n });\n break;\n\n case 'set':\n if (isDeep) {\n obj.forEach(function (item) {\n included = included || _.eql(item, val);\n });\n } else {\n included = obj.has(val);\n }\n break;\n\n case 'array':\n if (isDeep) {\n included = obj.some(function (item) {\n return _.eql(item, val);\n })\n } else {\n included = obj.indexOf(val) !== -1;\n }\n break;\n\n default:\n // This block is for asserting a subset of properties in an object.\n // `_.expectTypes` isn't used here because `.include` should work with\n // objects with a custom `@@toStringTag`.\n if (val !== Object(val)) {\n throw new AssertionError(\n flagMsg + 'object tested must be an array, a map, an object,'\n + ' a set, a string, or a weakset, but ' + objType + ' given',\n undefined,\n ssfi\n );\n }\n\n var props = Object.keys(val)\n , firstErr = null\n , numErrs = 0;\n \n props.forEach(function (prop) {\n var propAssertion = new Assertion(obj);\n _.transferFlags(this, propAssertion, true);\n flag(propAssertion, 'lockSsfi', true);\n \n if (!negate || props.length === 1) {\n propAssertion.property(prop, val[prop]);\n return;\n }\n \n try {\n propAssertion.property(prop, val[prop]);\n } catch (err) {\n if (!_.checkError.compatibleConstructor(err, AssertionError)) {\n throw err;\n }\n if (firstErr === null) firstErr = err;\n numErrs++;\n }\n }, this);\n \n // When validating .not.include with multiple properties, we only want\n // to throw an assertion error if all of the properties are included,\n // in which case we throw the first property assertion error that we\n // encountered.\n if (negate && props.length > 1 && numErrs === props.length) {\n throw firstErr;\n }\n return;\n }\n\n // Assert inclusion in collection or substring in a string.\n this.assert(\n included\n , 'expected #{this} to ' + descriptor + 'include ' + _.inspect(val)\n , 'expected #{this} to not ' + descriptor + 'include ' + _.inspect(val));\n }\n\n Assertion.addChainableMethod('include', include, includeChainingBehavior);\n Assertion.addChainableMethod('contain', include, includeChainingBehavior);\n Assertion.addChainableMethod('contains', include, includeChainingBehavior);\n Assertion.addChainableMethod('includes', include, includeChainingBehavior);\n\n /**\n * ### .ok\n *\n * Asserts that the target is loosely (`==`) equal to `true`. However, it's\n * often best to assert that the target is strictly (`===`) or deeply equal to\n * its expected value.\n *\n * expect(1).to.equal(1); // Recommended\n * expect(1).to.be.ok; // Not recommended\n *\n * expect(true).to.be.true; // Recommended\n * expect(true).to.be.ok; // Not recommended\n *\n * Add `.not` earlier in the chain to negate `.ok`.\n *\n * expect(0).to.equal(0); // Recommended\n * expect(0).to.not.be.ok; // Not recommended\n *\n * expect(false).to.be.false; // Recommended\n * expect(false).to.not.be.ok; // Not recommended\n *\n * expect(null).to.be.null; // Recommended\n * expect(null).to.not.be.ok; // Not recommended\n *\n * expect(undefined).to.be.undefined; // Recommended\n * expect(undefined).to.not.be.ok; // Not recommended\n *\n * A custom error message can be given as the second argument to `expect`.\n *\n * expect(false, 'nooo why fail??').to.be.ok;\n *\n * @name ok\n * @namespace BDD\n * @api public\n */\n\n Assertion.addProperty('ok', function () {\n this.assert(\n flag(this, 'object')\n , 'expected #{this} to be truthy'\n , 'expected #{this} to be falsy');\n });\n\n /**\n * ### .true\n *\n * Asserts that the target is strictly (`===`) equal to `true`.\n *\n * expect(true).to.be.true;\n *\n * Add `.not` earlier in the chain to negate `.true`. However, it's often best\n * to assert that the target is equal to its expected value, rather than not\n * equal to `true`.\n *\n * expect(false).to.be.false; // Recommended\n * expect(false).to.not.be.true; // Not recommended\n *\n * expect(1).to.equal(1); // Recommended\n * expect(1).to.not.be.true; // Not recommended\n *\n * A custom error message can be given as the second argument to `expect`.\n *\n * expect(false, 'nooo why fail??').to.be.true;\n *\n * @name true\n * @namespace BDD\n * @api public\n */\n\n Assertion.addProperty('true', function () {\n this.assert(\n true === flag(this, 'object')\n , 'expected #{this} to be true'\n , 'expected #{this} to be false'\n , flag(this, 'negate') ? false : true\n );\n });\n\n /**\n * ### .false\n *\n * Asserts that the target is strictly (`===`) equal to `false`.\n *\n * expect(false).to.be.false;\n *\n * Add `.not` earlier in the chain to negate `.false`. However, it's often\n * best to assert that the target is equal to its expected value, rather than\n * not equal to `false`.\n *\n * expect(true).to.be.true; // Recommended\n * expect(true).to.not.be.false; // Not recommended\n *\n * expect(1).to.equal(1); // Recommended\n * expect(1).to.not.be.false; // Not recommended\n *\n * A custom error message can be given as the second argument to `expect`.\n *\n * expect(true, 'nooo why fail??').to.be.false;\n *\n * @name false\n * @namespace BDD\n * @api public\n */\n\n Assertion.addProperty('false', function () {\n this.assert(\n false === flag(this, 'object')\n , 'expected #{this} to be false'\n , 'expected #{this} to be true'\n , flag(this, 'negate') ? true : false\n );\n });\n\n /**\n * ### .null\n *\n * Asserts that the target is strictly (`===`) equal to `null`.\n *\n * expect(null).to.be.null;\n *\n * Add `.not` earlier in the chain to negate `.null`. However, it's often best\n * to assert that the target is equal to its expected value, rather than not\n * equal to `null`.\n *\n * expect(1).to.equal(1); // Recommended\n * expect(1).to.not.be.null; // Not recommended\n *\n * A custom error message can be given as the second argument to `expect`.\n *\n * expect(42, 'nooo why fail??').to.be.null;\n *\n * @name null\n * @namespace BDD\n * @api public\n */\n\n Assertion.addProperty('null', function () {\n this.assert(\n null === flag(this, 'object')\n , 'expected #{this} to be null'\n , 'expected #{this} not to be null'\n );\n });\n\n /**\n * ### .undefined\n *\n * Asserts that the target is strictly (`===`) equal to `undefined`.\n *\n * expect(undefined).to.be.undefined;\n *\n * Add `.not` earlier in the chain to negate `.undefined`. However, it's often\n * best to assert that the target is equal to its expected value, rather than\n * not equal to `undefined`.\n *\n * expect(1).to.equal(1); // Recommended\n * expect(1).to.not.be.undefined; // Not recommended\n *\n * A custom error message can be given as the second argument to `expect`.\n *\n * expect(42, 'nooo why fail??').to.be.undefined;\n *\n * @name undefined\n * @namespace BDD\n * @api public\n */\n\n Assertion.addProperty('undefined', function () {\n this.assert(\n undefined === flag(this, 'object')\n , 'expected #{this} to be undefined'\n , 'expected #{this} not to be undefined'\n );\n });\n\n /**\n * ### .NaN\n *\n * Asserts that the target is exactly `NaN`.\n *\n * expect(NaN).to.be.NaN;\n *\n * Add `.not` earlier in the chain to negate `.NaN`. However, it's often best\n * to assert that the target is equal to its expected value, rather than not\n * equal to `NaN`.\n *\n * expect('foo').to.equal('foo'); // Recommended\n * expect('foo').to.not.be.NaN; // Not recommended\n *\n * A custom error message can be given as the second argument to `expect`.\n *\n * expect(42, 'nooo why fail??').to.be.NaN;\n *\n * @name NaN\n * @namespace BDD\n * @api public\n */\n\n Assertion.addProperty('NaN', function () {\n this.assert(\n _.isNaN(flag(this, 'object'))\n , 'expected #{this} to be NaN'\n , 'expected #{this} not to be NaN'\n );\n });\n\n /**\n * ### .exist\n *\n * Asserts that the target is not strictly (`===`) equal to either `null` or\n * `undefined`. However, it's often best to assert that the target is equal to\n * its expected value.\n *\n * expect(1).to.equal(1); // Recommended\n * expect(1).to.exist; // Not recommended\n *\n * expect(0).to.equal(0); // Recommended\n * expect(0).to.exist; // Not recommended\n *\n * Add `.not` earlier in the chain to negate `.exist`.\n *\n * expect(null).to.be.null; // Recommended\n * expect(null).to.not.exist; // Not recommended\n *\n * expect(undefined).to.be.undefined; // Recommended\n * expect(undefined).to.not.exist; // Not recommended\n *\n * A custom error message can be given as the second argument to `expect`.\n *\n * expect(null, 'nooo why fail??').to.exist;\n *\n * @name exist\n * @namespace BDD\n * @api public\n */\n\n Assertion.addProperty('exist', function () {\n var val = flag(this, 'object');\n this.assert(\n val !== null && val !== undefined\n , 'expected #{this} to exist'\n , 'expected #{this} to not exist'\n );\n });\n\n /**\n * ### .empty\n *\n * When the target is a string or array, `.empty` asserts that the target's\n * `length` property is strictly (`===`) equal to `0`.\n *\n * expect([]).to.be.empty;\n * expect('').to.be.empty;\n *\n * When the target is a map or set, `.empty` asserts that the target's `size`\n * property is strictly equal to `0`.\n *\n * expect(new Set()).to.be.empty;\n * expect(new Map()).to.be.empty;\n *\n * When the target is a non-function object, `.empty` asserts that the target\n * doesn't have any own enumerable properties. Properties with Symbol-based\n * keys are excluded from the count.\n *\n * expect({}).to.be.empty;\n *\n * Because `.empty` does different things based on the target's type, it's\n * important to check the target's type before using `.empty`. See the `.a`\n * doc for info on testing a target's type.\n *\n * expect([]).to.be.an('array').that.is.empty;\n *\n * Add `.not` earlier in the chain to negate `.empty`. However, it's often\n * best to assert that the target contains its expected number of values,\n * rather than asserting that it's not empty.\n *\n * expect([1, 2, 3]).to.have.lengthOf(3); // Recommended\n * expect([1, 2, 3]).to.not.be.empty; // Not recommended\n *\n * expect(new Set([1, 2, 3])).to.have.property('size', 3); // Recommended\n * expect(new Set([1, 2, 3])).to.not.be.empty; // Not recommended\n *\n * expect(Object.keys({a: 1})).to.have.lengthOf(1); // Recommended\n * expect({a: 1}).to.not.be.empty; // Not recommended\n *\n * A custom error message can be given as the second argument to `expect`.\n *\n * expect([1, 2, 3], 'nooo why fail??').to.be.empty;\n *\n * @name empty\n * @namespace BDD\n * @api public\n */\n\n Assertion.addProperty('empty', function () {\n var val = flag(this, 'object')\n , ssfi = flag(this, 'ssfi')\n , flagMsg = flag(this, 'message')\n , itemsCount;\n\n flagMsg = flagMsg ? flagMsg + ': ' : '';\n\n switch (_.type(val).toLowerCase()) {\n case 'array':\n case 'string':\n itemsCount = val.length;\n break;\n case 'map':\n case 'set':\n itemsCount = val.size;\n break;\n case 'weakmap':\n case 'weakset':\n throw new AssertionError(\n flagMsg + '.empty was passed a weak collection',\n undefined,\n ssfi\n );\n case 'function':\n var msg = flagMsg + '.empty was passed a function ' + _.getName(val);\n throw new AssertionError(msg.trim(), undefined, ssfi);\n default:\n if (val !== Object(val)) {\n throw new AssertionError(\n flagMsg + '.empty was passed non-string primitive ' + _.inspect(val),\n undefined,\n ssfi\n );\n }\n itemsCount = Object.keys(val).length;\n }\n\n this.assert(\n 0 === itemsCount\n , 'expected #{this} to be empty'\n , 'expected #{this} not to be empty'\n );\n });\n\n /**\n * ### .arguments\n *\n * Asserts that the target is an `arguments` object.\n *\n * function test () {\n * expect(arguments).to.be.arguments;\n * }\n *\n * test();\n *\n * Add `.not` earlier in the chain to negate `.arguments`. However, it's often\n * best to assert which type the target is expected to be, rather than\n * asserting that its not an `arguments` object.\n *\n * expect('foo').to.be.a('string'); // Recommended\n * expect('foo').to.not.be.arguments; // Not recommended\n *\n * A custom error message can be given as the second argument to `expect`.\n *\n * expect({}, 'nooo why fail??').to.be.arguments;\n *\n * The alias `.Arguments` can be used interchangeably with `.arguments`.\n *\n * @name arguments\n * @alias Arguments\n * @namespace BDD\n * @api public\n */\n\n function checkArguments () {\n var obj = flag(this, 'object')\n , type = _.type(obj);\n this.assert(\n 'Arguments' === type\n , 'expected #{this} to be arguments but got ' + type\n , 'expected #{this} to not be arguments'\n );\n }\n\n Assertion.addProperty('arguments', checkArguments);\n Assertion.addProperty('Arguments', checkArguments);\n\n /**\n * ### .equal(val[, msg])\n *\n * Asserts that the target is strictly (`===`) equal to the given `val`.\n *\n * expect(1).to.equal(1);\n * expect('foo').to.equal('foo');\n * \n * Add `.deep` earlier in the chain to use deep equality instead. See the\n * `deep-eql` project page for info on the deep equality algorithm:\n * https://github.com/chaijs/deep-eql.\n *\n * // Target object deeply (but not strictly) equals `{a: 1}`\n * expect({a: 1}).to.deep.equal({a: 1});\n * expect({a: 1}).to.not.equal({a: 1});\n *\n * // Target array deeply (but not strictly) equals `[1, 2]`\n * expect([1, 2]).to.deep.equal([1, 2]);\n * expect([1, 2]).to.not.equal([1, 2]);\n *\n * Add `.not` earlier in the chain to negate `.equal`. However, it's often\n * best to assert that the target is equal to its expected value, rather than\n * not equal to one of countless unexpected values.\n *\n * expect(1).to.equal(1); // Recommended\n * expect(1).to.not.equal(2); // Not recommended\n *\n * `.equal` accepts an optional `msg` argument which is a custom error message\n * to show when the assertion fails. The message can also be given as the\n * second argument to `expect`.\n *\n * expect(1).to.equal(2, 'nooo why fail??');\n * expect(1, 'nooo why fail??').to.equal(2);\n *\n * The aliases `.equals` and `eq` can be used interchangeably with `.equal`.\n *\n * @name equal\n * @alias equals\n * @alias eq\n * @param {Mixed} val\n * @param {String} msg _optional_\n * @namespace BDD\n * @api public\n */\n\n function assertEqual (val, msg) {\n if (msg) flag(this, 'message', msg);\n var obj = flag(this, 'object');\n if (flag(this, 'deep')) {\n return this.eql(val);\n } else {\n this.assert(\n val === obj\n , 'expected #{this} to equal #{exp}'\n , 'expected #{this} to not equal #{exp}'\n , val\n , this._obj\n , true\n );\n }\n }\n\n Assertion.addMethod('equal', assertEqual);\n Assertion.addMethod('equals', assertEqual);\n Assertion.addMethod('eq', assertEqual);\n\n /**\n * ### .eql(obj[, msg])\n *\n * Asserts that the target is deeply equal to the given `obj`. See the\n * `deep-eql` project page for info on the deep equality algorithm:\n * https://github.com/chaijs/deep-eql.\n *\n * // Target object is deeply (but not strictly) equal to {a: 1}\n * expect({a: 1}).to.eql({a: 1}).but.not.equal({a: 1});\n *\n * // Target array is deeply (but not strictly) equal to [1, 2]\n * expect([1, 2]).to.eql([1, 2]).but.not.equal([1, 2]);\n *\n * Add `.not` earlier in the chain to negate `.eql`. However, it's often best\n * to assert that the target is deeply equal to its expected value, rather\n * than not deeply equal to one of countless unexpected values.\n *\n * expect({a: 1}).to.eql({a: 1}); // Recommended\n * expect({a: 1}).to.not.eql({b: 2}); // Not recommended\n *\n * `.eql` accepts an optional `msg` argument which is a custom error message\n * to show when the assertion fails. The message can also be given as the\n * second argument to `expect`.\n *\n * expect({a: 1}).to.eql({b: 2}, 'nooo why fail??');\n * expect({a: 1}, 'nooo why fail??').to.eql({b: 2});\n *\n * The alias `.eqls` can be used interchangeably with `.eql`.\n *\n * The `.deep.equal` assertion is almost identical to `.eql` but with one\n * difference: `.deep.equal` causes deep equality comparisons to also be used\n * for any other assertions that follow in the chain.\n *\n * @name eql\n * @alias eqls\n * @param {Mixed} obj\n * @param {String} msg _optional_\n * @namespace BDD\n * @api public\n */\n\n function assertEql(obj, msg) {\n if (msg) flag(this, 'message', msg);\n this.assert(\n _.eql(obj, flag(this, 'object'))\n , 'expected #{this} to deeply equal #{exp}'\n , 'expected #{this} to not deeply equal #{exp}'\n , obj\n , this._obj\n , true\n );\n }\n\n Assertion.addMethod('eql', assertEql);\n Assertion.addMethod('eqls', assertEql);\n\n /**\n * ### .above(n[, msg])\n *\n * Asserts that the target is a number or a date greater than the given number or date `n` respectively.\n * However, it's often best to assert that the target is equal to its expected\n * value.\n *\n * expect(2).to.equal(2); // Recommended\n * expect(2).to.be.above(1); // Not recommended\n *\n * Add `.lengthOf` earlier in the chain to assert that the value of the\n * target's `length` property is greater than the given number `n`.\n *\n * expect('foo').to.have.lengthOf(3); // Recommended\n * expect('foo').to.have.lengthOf.above(2); // Not recommended\n *\n * expect([1, 2, 3]).to.have.lengthOf(3); // Recommended\n * expect([1, 2, 3]).to.have.lengthOf.above(2); // Not recommended\n *\n * Add `.not` earlier in the chain to negate `.above`.\n *\n * expect(2).to.equal(2); // Recommended\n * expect(1).to.not.be.above(2); // Not recommended\n *\n * `.above` accepts an optional `msg` argument which is a custom error message\n * to show when the assertion fails. The message can also be given as the\n * second argument to `expect`.\n *\n * expect(1).to.be.above(2, 'nooo why fail??');\n * expect(1, 'nooo why fail??').to.be.above(2);\n *\n * The aliases `.gt` and `.greaterThan` can be used interchangeably with\n * `.above`.\n *\n * @name above\n * @alias gt\n * @alias greaterThan\n * @param {Number} n\n * @param {String} msg _optional_\n * @namespace BDD\n * @api public\n */\n\n function assertAbove (n, msg) {\n if (msg) flag(this, 'message', msg);\n var obj = flag(this, 'object')\n , doLength = flag(this, 'doLength')\n , flagMsg = flag(this, 'message')\n , msgPrefix = ((flagMsg) ? flagMsg + ': ' : '')\n , ssfi = flag(this, 'ssfi')\n , objType = _.type(obj).toLowerCase()\n , nType = _.type(n).toLowerCase()\n , shouldThrow = true;\n\n if (doLength) {\n new Assertion(obj, flagMsg, ssfi, true).to.have.property('length');\n }\n \n if (!doLength && (objType === 'date' && nType !== 'date')) {\n errorMessage = msgPrefix + 'the argument to above must be a date';\n } else if (nType !== 'number' && (doLength || objType === 'number')) {\n errorMessage = msgPrefix + 'the argument to above must be a number';\n } else if (!doLength && (objType !== 'date' && objType !== 'number')) {\n var printObj = (objType === 'string') ? \"'\" + obj + \"'\" : obj;\n errorMessage = msgPrefix + 'expected ' + printObj + ' to be a number or a date';\n } else {\n shouldThrow = false;\n }\n\n if (shouldThrow) {\n throw new AssertionError(errorMessage, undefined, ssfi);\n }\n\n if (doLength) {\n var len = obj.length;\n this.assert(\n len > n\n , 'expected #{this} to have a length above #{exp} but got #{act}'\n , 'expected #{this} to not have a length above #{exp}'\n , n\n , len\n );\n } else {\n this.assert(\n obj > n\n , 'expected #{this} to be above #{exp}'\n , 'expected #{this} to be at most #{exp}'\n , n\n );\n }\n }\n\n Assertion.addMethod('above', assertAbove);\n Assertion.addMethod('gt', assertAbove);\n Assertion.addMethod('greaterThan', assertAbove);\n\n /**\n * ### .least(n[, msg])\n *\n * Asserts that the target is a number or a date greater than or equal to the given\n * number or date `n` respectively. However, it's often best to assert that the target is equal to\n * its expected value.\n *\n * expect(2).to.equal(2); // Recommended\n * expect(2).to.be.at.least(1); // Not recommended\n * expect(2).to.be.at.least(2); // Not recommended\n *\n * Add `.lengthOf` earlier in the chain to assert that the value of the\n * target's `length` property is greater than or equal to the given number\n * `n`.\n *\n * expect('foo').to.have.lengthOf(3); // Recommended\n * expect('foo').to.have.lengthOf.at.least(2); // Not recommended\n *\n * expect([1, 2, 3]).to.have.lengthOf(3); // Recommended\n * expect([1, 2, 3]).to.have.lengthOf.at.least(2); // Not recommended\n *\n * Add `.not` earlier in the chain to negate `.least`.\n *\n * expect(1).to.equal(1); // Recommended\n * expect(1).to.not.be.at.least(2); // Not recommended\n *\n * `.least` accepts an optional `msg` argument which is a custom error message\n * to show when the assertion fails. The message can also be given as the\n * second argument to `expect`.\n *\n * expect(1).to.be.at.least(2, 'nooo why fail??');\n * expect(1, 'nooo why fail??').to.be.at.least(2);\n *\n * The alias `.gte` can be used interchangeably with `.least`.\n *\n * @name least\n * @alias gte\n * @param {Number} n\n * @param {String} msg _optional_\n * @namespace BDD\n * @api public\n */\n\n function assertLeast (n, msg) {\n if (msg) flag(this, 'message', msg);\n var obj = flag(this, 'object')\n , doLength = flag(this, 'doLength')\n , flagMsg = flag(this, 'message')\n , msgPrefix = ((flagMsg) ? flagMsg + ': ' : '')\n , ssfi = flag(this, 'ssfi')\n , objType = _.type(obj).toLowerCase()\n , nType = _.type(n).toLowerCase()\n , shouldThrow = true;\n\n if (doLength) {\n new Assertion(obj, flagMsg, ssfi, true).to.have.property('length');\n }\n\n if (!doLength && (objType === 'date' && nType !== 'date')) {\n errorMessage = msgPrefix + 'the argument to least must be a date';\n } else if (nType !== 'number' && (doLength || objType === 'number')) {\n errorMessage = msgPrefix + 'the argument to least must be a number';\n } else if (!doLength && (objType !== 'date' && objType !== 'number')) {\n var printObj = (objType === 'string') ? \"'\" + obj + \"'\" : obj;\n errorMessage = msgPrefix + 'expected ' + printObj + ' to be a number or a date';\n } else {\n shouldThrow = false;\n }\n\n if (shouldThrow) {\n throw new AssertionError(errorMessage, undefined, ssfi);\n }\n\n if (doLength) {\n var len = obj.length;\n this.assert(\n len >= n\n , 'expected #{this} to have a length at least #{exp} but got #{act}'\n , 'expected #{this} to have a length below #{exp}'\n , n\n , len\n );\n } else {\n this.assert(\n obj >= n\n , 'expected #{this} to be at least #{exp}'\n , 'expected #{this} to be below #{exp}'\n , n\n );\n }\n }\n\n Assertion.addMethod('least', assertLeast);\n Assertion.addMethod('gte', assertLeast);\n\n /**\n * ### .below(n[, msg])\n *\n * Asserts that the target is a number or a date less than the given number or date `n` respectively.\n * However, it's often best to assert that the target is equal to its expected\n * value.\n *\n * expect(1).to.equal(1); // Recommended\n * expect(1).to.be.below(2); // Not recommended\n *\n * Add `.lengthOf` earlier in the chain to assert that the value of the\n * target's `length` property is less than the given number `n`.\n *\n * expect('foo').to.have.lengthOf(3); // Recommended\n * expect('foo').to.have.lengthOf.below(4); // Not recommended\n *\n * expect([1, 2, 3]).to.have.length(3); // Recommended\n * expect([1, 2, 3]).to.have.lengthOf.below(4); // Not recommended\n *\n * Add `.not` earlier in the chain to negate `.below`.\n *\n * expect(2).to.equal(2); // Recommended\n * expect(2).to.not.be.below(1); // Not recommended\n *\n * `.below` accepts an optional `msg` argument which is a custom error message\n * to show when the assertion fails. The message can also be given as the\n * second argument to `expect`.\n *\n * expect(2).to.be.below(1, 'nooo why fail??');\n * expect(2, 'nooo why fail??').to.be.below(1);\n *\n * The aliases `.lt` and `.lessThan` can be used interchangeably with\n * `.below`.\n *\n * @name below\n * @alias lt\n * @alias lessThan\n * @param {Number} n\n * @param {String} msg _optional_\n * @namespace BDD\n * @api public\n */\n\n function assertBelow (n, msg) {\n if (msg) flag(this, 'message', msg);\n var obj = flag(this, 'object')\n , doLength = flag(this, 'doLength')\n , flagMsg = flag(this, 'message')\n , msgPrefix = ((flagMsg) ? flagMsg + ': ' : '')\n , ssfi = flag(this, 'ssfi')\n , objType = _.type(obj).toLowerCase()\n , nType = _.type(n).toLowerCase()\n , shouldThrow = true;\n\n if (doLength) {\n new Assertion(obj, flagMsg, ssfi, true).to.have.property('length');\n }\n\n if (!doLength && (objType === 'date' && nType !== 'date')) {\n errorMessage = msgPrefix + 'the argument to below must be a date';\n } else if (nType !== 'number' && (doLength || objType === 'number')) {\n errorMessage = msgPrefix + 'the argument to below must be a number';\n } else if (!doLength && (objType !== 'date' && objType !== 'number')) {\n var printObj = (objType === 'string') ? \"'\" + obj + \"'\" : obj;\n errorMessage = msgPrefix + 'expected ' + printObj + ' to be a number or a date';\n } else {\n shouldThrow = false;\n }\n\n if (shouldThrow) {\n throw new AssertionError(errorMessage, undefined, ssfi);\n }\n\n if (doLength) {\n var len = obj.length;\n this.assert(\n len < n\n , 'expected #{this} to have a length below #{exp} but got #{act}'\n , 'expected #{this} to not have a length below #{exp}'\n , n\n , len\n );\n } else {\n this.assert(\n obj < n\n , 'expected #{this} to be below #{exp}'\n , 'expected #{this} to be at least #{exp}'\n , n\n );\n }\n }\n\n Assertion.addMethod('below', assertBelow);\n Assertion.addMethod('lt', assertBelow);\n Assertion.addMethod('lessThan', assertBelow);\n\n /**\n * ### .most(n[, msg])\n *\n * Asserts that the target is a number or a date less than or equal to the given number\n * or date `n` respectively. However, it's often best to assert that the target is equal to its\n * expected value.\n *\n * expect(1).to.equal(1); // Recommended\n * expect(1).to.be.at.most(2); // Not recommended\n * expect(1).to.be.at.most(1); // Not recommended\n *\n * Add `.lengthOf` earlier in the chain to assert that the value of the\n * target's `length` property is less than or equal to the given number `n`.\n *\n * expect('foo').to.have.lengthOf(3); // Recommended\n * expect('foo').to.have.lengthOf.at.most(4); // Not recommended\n *\n * expect([1, 2, 3]).to.have.lengthOf(3); // Recommended\n * expect([1, 2, 3]).to.have.lengthOf.at.most(4); // Not recommended\n *\n * Add `.not` earlier in the chain to negate `.most`.\n *\n * expect(2).to.equal(2); // Recommended\n * expect(2).to.not.be.at.most(1); // Not recommended\n *\n * `.most` accepts an optional `msg` argument which is a custom error message\n * to show when the assertion fails. The message can also be given as the\n * second argument to `expect`.\n *\n * expect(2).to.be.at.most(1, 'nooo why fail??');\n * expect(2, 'nooo why fail??').to.be.at.most(1);\n *\n * The alias `.lte` can be used interchangeably with `.most`.\n *\n * @name most\n * @alias lte\n * @param {Number} n\n * @param {String} msg _optional_\n * @namespace BDD\n * @api public\n */\n\n function assertMost (n, msg) {\n if (msg) flag(this, 'message', msg);\n var obj = flag(this, 'object')\n , doLength = flag(this, 'doLength')\n , flagMsg = flag(this, 'message')\n , msgPrefix = ((flagMsg) ? flagMsg + ': ' : '')\n , ssfi = flag(this, 'ssfi')\n , objType = _.type(obj).toLowerCase()\n , nType = _.type(n).toLowerCase()\n , shouldThrow = true;\n\n if (doLength) {\n new Assertion(obj, flagMsg, ssfi, true).to.have.property('length');\n }\n \n if (!doLength && (objType === 'date' && nType !== 'date')) {\n errorMessage = msgPrefix + 'the argument to most must be a date';\n } else if (nType !== 'number' && (doLength || objType === 'number')) {\n errorMessage = msgPrefix + 'the argument to most must be a number';\n } else if (!doLength && (objType !== 'date' && objType !== 'number')) {\n var printObj = (objType === 'string') ? \"'\" + obj + \"'\" : obj;\n errorMessage = msgPrefix + 'expected ' + printObj + ' to be a number or a date';\n } else {\n shouldThrow = false;\n }\n\n if (shouldThrow) {\n throw new AssertionError(errorMessage, undefined, ssfi);\n }\n\n if (doLength) {\n var len = obj.length;\n this.assert(\n len <= n\n , 'expected #{this} to have a length at most #{exp} but got #{act}'\n , 'expected #{this} to have a length above #{exp}'\n , n\n , len\n );\n } else {\n this.assert(\n obj <= n\n , 'expected #{this} to be at most #{exp}'\n , 'expected #{this} to be above #{exp}'\n , n\n );\n }\n }\n\n Assertion.addMethod('most', assertMost);\n Assertion.addMethod('lte', assertMost);\n\n /**\n * ### .within(start, finish[, msg])\n *\n * Asserts that the target is a number or a date greater than or equal to the given\n * number or date `start`, and less than or equal to the given number or date `finish` respectively.\n * However, it's often best to assert that the target is equal to its expected\n * value.\n *\n * expect(2).to.equal(2); // Recommended\n * expect(2).to.be.within(1, 3); // Not recommended\n * expect(2).to.be.within(2, 3); // Not recommended\n * expect(2).to.be.within(1, 2); // Not recommended\n *\n * Add `.lengthOf` earlier in the chain to assert that the value of the\n * target's `length` property is greater than or equal to the given number\n * `start`, and less than or equal to the given number `finish`.\n *\n * expect('foo').to.have.lengthOf(3); // Recommended\n * expect('foo').to.have.lengthOf.within(2, 4); // Not recommended\n *\n * expect([1, 2, 3]).to.have.lengthOf(3); // Recommended\n * expect([1, 2, 3]).to.have.lengthOf.within(2, 4); // Not recommended\n *\n * Add `.not` earlier in the chain to negate `.within`.\n *\n * expect(1).to.equal(1); // Recommended\n * expect(1).to.not.be.within(2, 4); // Not recommended\n *\n * `.within` accepts an optional `msg` argument which is a custom error\n * message to show when the assertion fails. The message can also be given as\n * the second argument to `expect`.\n *\n * expect(4).to.be.within(1, 3, 'nooo why fail??');\n * expect(4, 'nooo why fail??').to.be.within(1, 3);\n *\n * @name within\n * @param {Number} start lower bound inclusive\n * @param {Number} finish upper bound inclusive\n * @param {String} msg _optional_\n * @namespace BDD\n * @api public\n */\n\n Assertion.addMethod('within', function (start, finish, msg) {\n if (msg) flag(this, 'message', msg);\n var obj = flag(this, 'object')\n , doLength = flag(this, 'doLength')\n , flagMsg = flag(this, 'message')\n , msgPrefix = ((flagMsg) ? flagMsg + ': ' : '')\n , ssfi = flag(this, 'ssfi')\n , objType = _.type(obj).toLowerCase()\n , startType = _.type(start).toLowerCase()\n , finishType = _.type(finish).toLowerCase()\n , shouldThrow = true\n , range = (startType === 'date' && finishType === 'date')\n ? start.toUTCString() + '..' + finish.toUTCString()\n : start + '..' + finish;\n\n if (doLength) {\n new Assertion(obj, flagMsg, ssfi, true).to.have.property('length');\n }\n\n if (!doLength && (objType === 'date' && (startType !== 'date' || finishType !== 'date'))) {\n errorMessage = msgPrefix + 'the arguments to within must be dates';\n } else if ((startType !== 'number' || finishType !== 'number') && (doLength || objType === 'number')) {\n errorMessage = msgPrefix + 'the arguments to within must be numbers';\n } else if (!doLength && (objType !== 'date' && objType !== 'number')) {\n var printObj = (objType === 'string') ? \"'\" + obj + \"'\" : obj;\n errorMessage = msgPrefix + 'expected ' + printObj + ' to be a number or a date';\n } else {\n shouldThrow = false;\n }\n\n if (shouldThrow) {\n throw new AssertionError(errorMessage, undefined, ssfi);\n }\n\n if (doLength) {\n var len = obj.length;\n this.assert(\n len >= start && len <= finish\n , 'expected #{this} to have a length within ' + range\n , 'expected #{this} to not have a length within ' + range\n );\n } else {\n this.assert(\n obj >= start && obj <= finish\n , 'expected #{this} to be within ' + range\n , 'expected #{this} to not be within ' + range\n );\n }\n });\n\n /**\n * ### .instanceof(constructor[, msg])\n *\n * Asserts that the target is an instance of the given `constructor`.\n *\n * function Cat () { }\n *\n * expect(new Cat()).to.be.an.instanceof(Cat);\n * expect([1, 2]).to.be.an.instanceof(Array);\n *\n * Add `.not` earlier in the chain to negate `.instanceof`.\n *\n * expect({a: 1}).to.not.be.an.instanceof(Array);\n *\n * `.instanceof` accepts an optional `msg` argument which is a custom error\n * message to show when the assertion fails. The message can also be given as\n * the second argument to `expect`.\n *\n * expect(1).to.be.an.instanceof(Array, 'nooo why fail??');\n * expect(1, 'nooo why fail??').to.be.an.instanceof(Array);\n *\n * Due to limitations in ES5, `.instanceof` may not always work as expected\n * when using a transpiler such as Babel or TypeScript. In particular, it may\n * produce unexpected results when subclassing built-in object such as\n * `Array`, `Error`, and `Map`. See your transpiler's docs for details:\n *\n * - ([Babel](https://babeljs.io/docs/usage/caveats/#classes))\n * - ([TypeScript](https://github.com/Microsoft/TypeScript/wiki/Breaking-Changes#extending-built-ins-like-error-array-and-map-may-no-longer-work))\n *\n * The alias `.instanceOf` can be used interchangeably with `.instanceof`.\n *\n * @name instanceof\n * @param {Constructor} constructor\n * @param {String} msg _optional_\n * @alias instanceOf\n * @namespace BDD\n * @api public\n */\n\n function assertInstanceOf (constructor, msg) {\n if (msg) flag(this, 'message', msg);\n\n var target = flag(this, 'object')\n var ssfi = flag(this, 'ssfi');\n var flagMsg = flag(this, 'message');\n\n try {\n var isInstanceOf = target instanceof constructor;\n } catch (err) {\n if (err instanceof TypeError) {\n flagMsg = flagMsg ? flagMsg + ': ' : '';\n throw new AssertionError(\n flagMsg + 'The instanceof assertion needs a constructor but '\n + _.type(constructor) + ' was given.',\n undefined,\n ssfi\n );\n }\n throw err;\n }\n\n var name = _.getName(constructor);\n if (name === null) {\n name = 'an unnamed constructor';\n }\n\n this.assert(\n isInstanceOf\n , 'expected #{this} to be an instance of ' + name\n , 'expected #{this} to not be an instance of ' + name\n );\n };\n\n Assertion.addMethod('instanceof', assertInstanceOf);\n Assertion.addMethod('instanceOf', assertInstanceOf);\n\n /**\n * ### .property(name[, val[, msg]])\n *\n * Asserts that the target has a property with the given key `name`.\n *\n * expect({a: 1}).to.have.property('a');\n *\n * When `val` is provided, `.property` also asserts that the property's value\n * is equal to the given `val`.\n *\n * expect({a: 1}).to.have.property('a', 1);\n *\n * By default, strict (`===`) equality is used. Add `.deep` earlier in the\n * chain to use deep equality instead. See the `deep-eql` project page for\n * info on the deep equality algorithm: https://github.com/chaijs/deep-eql.\n *\n * // Target object deeply (but not strictly) has property `x: {a: 1}`\n * expect({x: {a: 1}}).to.have.deep.property('x', {a: 1});\n * expect({x: {a: 1}}).to.not.have.property('x', {a: 1});\n *\n * The target's enumerable and non-enumerable properties are always included\n * in the search. By default, both own and inherited properties are included.\n * Add `.own` earlier in the chain to exclude inherited properties from the\n * search.\n *\n * Object.prototype.b = 2;\n *\n * expect({a: 1}).to.have.own.property('a');\n * expect({a: 1}).to.have.own.property('a', 1);\n * expect({a: 1}).to.have.property('b').but.not.own.property('b'); \n *\n * `.deep` and `.own` can be combined.\n *\n * expect({x: {a: 1}}).to.have.deep.own.property('x', {a: 1});\n *\n * Add `.nested` earlier in the chain to enable dot- and bracket-notation when\n * referencing nested properties.\n *\n * expect({a: {b: ['x', 'y']}}).to.have.nested.property('a.b[1]');\n * expect({a: {b: ['x', 'y']}}).to.have.nested.property('a.b[1]', 'y');\n *\n * If `.` or `[]` are part of an actual property name, they can be escaped by\n * adding two backslashes before them.\n *\n * expect({'.a': {'[b]': 'x'}}).to.have.nested.property('\\\\.a.\\\\[b\\\\]');\n *\n * `.deep` and `.nested` can be combined.\n *\n * expect({a: {b: [{c: 3}]}})\n * .to.have.deep.nested.property('a.b[0]', {c: 3});\n *\n * `.own` and `.nested` cannot be combined.\n *\n * Add `.not` earlier in the chain to negate `.property`.\n *\n * expect({a: 1}).to.not.have.property('b');\n * \n * However, it's dangerous to negate `.property` when providing `val`. The\n * problem is that it creates uncertain expectations by asserting that the\n * target either doesn't have a property with the given key `name`, or that it\n * does have a property with the given key `name` but its value isn't equal to\n * the given `val`. It's often best to identify the exact output that's\n * expected, and then write an assertion that only accepts that exact output.\n *\n * When the target isn't expected to have a property with the given key\n * `name`, it's often best to assert exactly that.\n *\n * expect({b: 2}).to.not.have.property('a'); // Recommended\n * expect({b: 2}).to.not.have.property('a', 1); // Not recommended\n *\n * When the target is expected to have a property with the given key `name`,\n * it's often best to assert that the property has its expected value, rather\n * than asserting that it doesn't have one of many unexpected values.\n *\n * expect({a: 3}).to.have.property('a', 3); // Recommended\n * expect({a: 3}).to.not.have.property('a', 1); // Not recommended\n *\n * `.property` changes the target of any assertions that follow in the chain\n * to be the value of the property from the original target object.\n *\n * expect({a: 1}).to.have.property('a').that.is.a('number');\n *\n * `.property` accepts an optional `msg` argument which is a custom error\n * message to show when the assertion fails. The message can also be given as\n * the second argument to `expect`. When not providing `val`, only use the\n * second form.\n *\n * // Recommended\n * expect({a: 1}).to.have.property('a', 2, 'nooo why fail??');\n * expect({a: 1}, 'nooo why fail??').to.have.property('a', 2);\n * expect({a: 1}, 'nooo why fail??').to.have.property('b');\n *\n * // Not recommended\n * expect({a: 1}).to.have.property('b', undefined, 'nooo why fail??');\n * \n * The above assertion isn't the same thing as not providing `val`. Instead,\n * it's asserting that the target object has a `b` property that's equal to\n * `undefined`.\n *\n * The assertions `.ownProperty` and `.haveOwnProperty` can be used\n * interchangeably with `.own.property`.\n *\n * @name property\n * @param {String} name\n * @param {Mixed} val (optional)\n * @param {String} msg _optional_\n * @returns value of property for chaining\n * @namespace BDD\n * @api public\n */\n\n function assertProperty (name, val, msg) {\n if (msg) flag(this, 'message', msg);\n\n var isNested = flag(this, 'nested')\n , isOwn = flag(this, 'own')\n , flagMsg = flag(this, 'message')\n , obj = flag(this, 'object')\n , ssfi = flag(this, 'ssfi');\n\n if (isNested && isOwn) {\n flagMsg = flagMsg ? flagMsg + ': ' : '';\n throw new AssertionError(\n flagMsg + 'The \"nested\" and \"own\" flags cannot be combined.',\n undefined,\n ssfi\n );\n }\n\n if (obj === null || obj === undefined) {\n flagMsg = flagMsg ? flagMsg + ': ' : '';\n throw new AssertionError(\n flagMsg + 'Target cannot be null or undefined.',\n undefined,\n ssfi\n );\n }\n\n var isDeep = flag(this, 'deep')\n , negate = flag(this, 'negate')\n , pathInfo = isNested ? _.getPathInfo(obj, name) : null\n , value = isNested ? pathInfo.value : obj[name];\n\n var descriptor = '';\n if (isDeep) descriptor += 'deep ';\n if (isOwn) descriptor += 'own ';\n if (isNested) descriptor += 'nested ';\n descriptor += 'property ';\n\n var hasProperty;\n if (isOwn) hasProperty = Object.prototype.hasOwnProperty.call(obj, name);\n else if (isNested) hasProperty = pathInfo.exists;\n else hasProperty = _.hasProperty(obj, name);\n\n // When performing a negated assertion for both name and val, merely having\n // a property with the given name isn't enough to cause the assertion to\n // fail. It must both have a property with the given name, and the value of\n // that property must equal the given val. Therefore, skip this assertion in\n // favor of the next.\n if (!negate || arguments.length === 1) {\n this.assert(\n hasProperty\n , 'expected #{this} to have ' + descriptor + _.inspect(name)\n , 'expected #{this} to not have ' + descriptor + _.inspect(name));\n }\n\n if (arguments.length > 1) {\n this.assert(\n hasProperty && (isDeep ? _.eql(val, value) : val === value)\n , 'expected #{this} to have ' + descriptor + _.inspect(name) + ' of #{exp}, but got #{act}'\n , 'expected #{this} to not have ' + descriptor + _.inspect(name) + ' of #{act}'\n , val\n , value\n );\n }\n\n flag(this, 'object', value);\n }\n\n Assertion.addMethod('property', assertProperty);\n\n function assertOwnProperty (name, value, msg) {\n flag(this, 'own', true);\n assertProperty.apply(this, arguments);\n }\n\n Assertion.addMethod('ownProperty', assertOwnProperty);\n Assertion.addMethod('haveOwnProperty', assertOwnProperty);\n\n /**\n * ### .ownPropertyDescriptor(name[, descriptor[, msg]])\n *\n * Asserts that the target has its own property descriptor with the given key\n * `name`. Enumerable and non-enumerable properties are included in the\n * search.\n *\n * expect({a: 1}).to.have.ownPropertyDescriptor('a');\n *\n * When `descriptor` is provided, `.ownPropertyDescriptor` also asserts that\n * the property's descriptor is deeply equal to the given `descriptor`. See\n * the `deep-eql` project page for info on the deep equality algorithm:\n * https://github.com/chaijs/deep-eql.\n *\n * expect({a: 1}).to.have.ownPropertyDescriptor('a', {\n * configurable: true,\n * enumerable: true,\n * writable: true,\n * value: 1,\n * });\n *\n * Add `.not` earlier in the chain to negate `.ownPropertyDescriptor`.\n *\n * expect({a: 1}).to.not.have.ownPropertyDescriptor('b');\n * \n * However, it's dangerous to negate `.ownPropertyDescriptor` when providing\n * a `descriptor`. The problem is that it creates uncertain expectations by\n * asserting that the target either doesn't have a property descriptor with\n * the given key `name`, or that it does have a property descriptor with the\n * given key `name` but its not deeply equal to the given `descriptor`. It's\n * often best to identify the exact output that's expected, and then write an\n * assertion that only accepts that exact output.\n *\n * When the target isn't expected to have a property descriptor with the given\n * key `name`, it's often best to assert exactly that.\n *\n * // Recommended\n * expect({b: 2}).to.not.have.ownPropertyDescriptor('a');\n *\n * // Not recommended\n * expect({b: 2}).to.not.have.ownPropertyDescriptor('a', {\n * configurable: true,\n * enumerable: true,\n * writable: true,\n * value: 1,\n * });\n *\n * When the target is expected to have a property descriptor with the given\n * key `name`, it's often best to assert that the property has its expected\n * descriptor, rather than asserting that it doesn't have one of many\n * unexpected descriptors.\n *\n * // Recommended\n * expect({a: 3}).to.have.ownPropertyDescriptor('a', {\n * configurable: true,\n * enumerable: true,\n * writable: true,\n * value: 3,\n * });\n *\n * // Not recommended\n * expect({a: 3}).to.not.have.ownPropertyDescriptor('a', {\n * configurable: true,\n * enumerable: true,\n * writable: true,\n * value: 1,\n * });\n *\n * `.ownPropertyDescriptor` changes the target of any assertions that follow\n * in the chain to be the value of the property descriptor from the original\n * target object.\n *\n * expect({a: 1}).to.have.ownPropertyDescriptor('a')\n * .that.has.property('enumerable', true);\n *\n * `.ownPropertyDescriptor` accepts an optional `msg` argument which is a\n * custom error message to show when the assertion fails. The message can also\n * be given as the second argument to `expect`. When not providing\n * `descriptor`, only use the second form.\n *\n * // Recommended\n * expect({a: 1}).to.have.ownPropertyDescriptor('a', {\n * configurable: true,\n * enumerable: true,\n * writable: true,\n * value: 2,\n * }, 'nooo why fail??');\n *\n * // Recommended\n * expect({a: 1}, 'nooo why fail??').to.have.ownPropertyDescriptor('a', {\n * configurable: true,\n * enumerable: true,\n * writable: true,\n * value: 2,\n * });\n * \n * // Recommended\n * expect({a: 1}, 'nooo why fail??').to.have.ownPropertyDescriptor('b');\n *\n * // Not recommended\n * expect({a: 1})\n * .to.have.ownPropertyDescriptor('b', undefined, 'nooo why fail??');\n *\n * The above assertion isn't the same thing as not providing `descriptor`.\n * Instead, it's asserting that the target object has a `b` property\n * descriptor that's deeply equal to `undefined`.\n *\n * The alias `.haveOwnPropertyDescriptor` can be used interchangeably with\n * `.ownPropertyDescriptor`.\n *\n * @name ownPropertyDescriptor\n * @alias haveOwnPropertyDescriptor\n * @param {String} name\n * @param {Object} descriptor _optional_\n * @param {String} msg _optional_\n * @namespace BDD\n * @api public\n */\n\n function assertOwnPropertyDescriptor (name, descriptor, msg) {\n if (typeof descriptor === 'string') {\n msg = descriptor;\n descriptor = null;\n }\n if (msg) flag(this, 'message', msg);\n var obj = flag(this, 'object');\n var actualDescriptor = Object.getOwnPropertyDescriptor(Object(obj), name);\n if (actualDescriptor && descriptor) {\n this.assert(\n _.eql(descriptor, actualDescriptor)\n , 'expected the own property descriptor for ' + _.inspect(name) + ' on #{this} to match ' + _.inspect(descriptor) + ', got ' + _.inspect(actualDescriptor)\n , 'expected the own property descriptor for ' + _.inspect(name) + ' on #{this} to not match ' + _.inspect(descriptor)\n , descriptor\n , actualDescriptor\n , true\n );\n } else {\n this.assert(\n actualDescriptor\n , 'expected #{this} to have an own property descriptor for ' + _.inspect(name)\n , 'expected #{this} to not have an own property descriptor for ' + _.inspect(name)\n );\n }\n flag(this, 'object', actualDescriptor);\n }\n\n Assertion.addMethod('ownPropertyDescriptor', assertOwnPropertyDescriptor);\n Assertion.addMethod('haveOwnPropertyDescriptor', assertOwnPropertyDescriptor);\n\n /**\n * ### .lengthOf(n[, msg])\n *\n * Asserts that the target's `length` property is equal to the given number\n * `n`.\n *\n * expect([1, 2, 3]).to.have.lengthOf(3);\n * expect('foo').to.have.lengthOf(3);\n *\n * Add `.not` earlier in the chain to negate `.lengthOf`. However, it's often\n * best to assert that the target's `length` property is equal to its expected\n * value, rather than not equal to one of many unexpected values.\n *\n * expect('foo').to.have.lengthOf(3); // Recommended\n * expect('foo').to.not.have.lengthOf(4); // Not recommended\n *\n * `.lengthOf` accepts an optional `msg` argument which is a custom error\n * message to show when the assertion fails. The message can also be given as\n * the second argument to `expect`.\n *\n * expect([1, 2, 3]).to.have.lengthOf(2, 'nooo why fail??');\n * expect([1, 2, 3], 'nooo why fail??').to.have.lengthOf(2);\n *\n * `.lengthOf` can also be used as a language chain, causing all `.above`,\n * `.below`, `.least`, `.most`, and `.within` assertions that follow in the\n * chain to use the target's `length` property as the target. However, it's\n * often best to assert that the target's `length` property is equal to its\n * expected length, rather than asserting that its `length` property falls\n * within some range of values.\n *\n * // Recommended\n * expect([1, 2, 3]).to.have.lengthOf(3);\n *\n * // Not recommended\n * expect([1, 2, 3]).to.have.lengthOf.above(2);\n * expect([1, 2, 3]).to.have.lengthOf.below(4);\n * expect([1, 2, 3]).to.have.lengthOf.at.least(3);\n * expect([1, 2, 3]).to.have.lengthOf.at.most(3);\n * expect([1, 2, 3]).to.have.lengthOf.within(2,4);\n *\n * Due to a compatibility issue, the alias `.length` can't be chained directly\n * off of an uninvoked method such as `.a`. Therefore, `.length` can't be used\n * interchangeably with `.lengthOf` in every situation. It's recommended to\n * always use `.lengthOf` instead of `.length`.\n *\n * expect([1, 2, 3]).to.have.a.length(3); // incompatible; throws error\n * expect([1, 2, 3]).to.have.a.lengthOf(3); // passes as expected\n *\n * @name lengthOf\n * @alias length\n * @param {Number} n\n * @param {String} msg _optional_\n * @namespace BDD\n * @api public\n */\n\n function assertLengthChain () {\n flag(this, 'doLength', true);\n }\n\n function assertLength (n, msg) {\n if (msg) flag(this, 'message', msg);\n var obj = flag(this, 'object')\n , flagMsg = flag(this, 'message')\n , ssfi = flag(this, 'ssfi');\n new Assertion(obj, flagMsg, ssfi, true).to.have.property('length');\n var len = obj.length;\n\n this.assert(\n len == n\n , 'expected #{this} to have a length of #{exp} but got #{act}'\n , 'expected #{this} to not have a length of #{act}'\n , n\n , len\n );\n }\n\n Assertion.addChainableMethod('length', assertLength, assertLengthChain);\n Assertion.addChainableMethod('lengthOf', assertLength, assertLengthChain);\n\n /**\n * ### .match(re[, msg])\n *\n * Asserts that the target matches the given regular expression `re`.\n *\n * expect('foobar').to.match(/^foo/);\n *\n * Add `.not` earlier in the chain to negate `.match`.\n *\n * expect('foobar').to.not.match(/taco/);\n *\n * `.match` accepts an optional `msg` argument which is a custom error message\n * to show when the assertion fails. The message can also be given as the\n * second argument to `expect`.\n *\n * expect('foobar').to.match(/taco/, 'nooo why fail??');\n * expect('foobar', 'nooo why fail??').to.match(/taco/);\n *\n * The alias `.matches` can be used interchangeably with `.match`.\n *\n * @name match\n * @alias matches\n * @param {RegExp} re\n * @param {String} msg _optional_\n * @namespace BDD\n * @api public\n */\n function assertMatch(re, msg) {\n if (msg) flag(this, 'message', msg);\n var obj = flag(this, 'object');\n this.assert(\n re.exec(obj)\n , 'expected #{this} to match ' + re\n , 'expected #{this} not to match ' + re\n );\n }\n\n Assertion.addMethod('match', assertMatch);\n Assertion.addMethod('matches', assertMatch);\n\n /**\n * ### .string(str[, msg])\n *\n * Asserts that the target string contains the given substring `str`.\n *\n * expect('foobar').to.have.string('bar');\n *\n * Add `.not` earlier in the chain to negate `.string`.\n *\n * expect('foobar').to.not.have.string('taco');\n *\n * `.string` accepts an optional `msg` argument which is a custom error\n * message to show when the assertion fails. The message can also be given as\n * the second argument to `expect`.\n *\n * expect('foobar').to.have.string(/taco/, 'nooo why fail??');\n * expect('foobar', 'nooo why fail??').to.have.string(/taco/);\n *\n * @name string\n * @param {String} str\n * @param {String} msg _optional_\n * @namespace BDD\n * @api public\n */\n\n Assertion.addMethod('string', function (str, msg) {\n if (msg) flag(this, 'message', msg);\n var obj = flag(this, 'object')\n , flagMsg = flag(this, 'message')\n , ssfi = flag(this, 'ssfi');\n new Assertion(obj, flagMsg, ssfi, true).is.a('string');\n\n this.assert(\n ~obj.indexOf(str)\n , 'expected #{this} to contain ' + _.inspect(str)\n , 'expected #{this} to not contain ' + _.inspect(str)\n );\n });\n\n /**\n * ### .keys(key1[, key2[, ...]])\n *\n * Asserts that the target object, array, map, or set has the given keys. Only\n * the target's own inherited properties are included in the search. \n *\n * When the target is an object or array, keys can be provided as one or more\n * string arguments, a single array argument, or a single object argument. In\n * the latter case, only the keys in the given object matter; the values are\n * ignored.\n *\n * expect({a: 1, b: 2}).to.have.all.keys('a', 'b');\n * expect(['x', 'y']).to.have.all.keys(0, 1);\n *\n * expect({a: 1, b: 2}).to.have.all.keys(['a', 'b']);\n * expect(['x', 'y']).to.have.all.keys([0, 1]);\n *\n * expect({a: 1, b: 2}).to.have.all.keys({a: 4, b: 5}); // ignore 4 and 5\n * expect(['x', 'y']).to.have.all.keys({0: 4, 1: 5}); // ignore 4 and 5\n *\n * When the target is a map or set, each key must be provided as a separate\n * argument.\n *\n * expect(new Map([['a', 1], ['b', 2]])).to.have.all.keys('a', 'b');\n * expect(new Set(['a', 'b'])).to.have.all.keys('a', 'b');\n *\n * Because `.keys` does different things based on the target's type, it's\n * important to check the target's type before using `.keys`. See the `.a` doc\n * for info on testing a target's type.\n *\n * expect({a: 1, b: 2}).to.be.an('object').that.has.all.keys('a', 'b');\n *\n * By default, strict (`===`) equality is used to compare keys of maps and\n * sets. Add `.deep` earlier in the chain to use deep equality instead. See\n * the `deep-eql` project page for info on the deep equality algorithm:\n * https://github.com/chaijs/deep-eql.\n *\n * // Target set deeply (but not strictly) has key `{a: 1}`\n * expect(new Set([{a: 1}])).to.have.all.deep.keys([{a: 1}]);\n * expect(new Set([{a: 1}])).to.not.have.all.keys([{a: 1}]);\n *\n * By default, the target must have all of the given keys and no more. Add\n * `.any` earlier in the chain to only require that the target have at least\n * one of the given keys. Also, add `.not` earlier in the chain to negate\n * `.keys`. It's often best to add `.any` when negating `.keys`, and to use\n * `.all` when asserting `.keys` without negation.\n *\n * When negating `.keys`, `.any` is preferred because `.not.any.keys` asserts\n * exactly what's expected of the output, whereas `.not.all.keys` creates\n * uncertain expectations.\n *\n * // Recommended; asserts that target doesn't have any of the given keys\n * expect({a: 1, b: 2}).to.not.have.any.keys('c', 'd');\n *\n * // Not recommended; asserts that target doesn't have all of the given\n * // keys but may or may not have some of them\n * expect({a: 1, b: 2}).to.not.have.all.keys('c', 'd');\n *\n * When asserting `.keys` without negation, `.all` is preferred because\n * `.all.keys` asserts exactly what's expected of the output, whereas\n * `.any.keys` creates uncertain expectations.\n *\n * // Recommended; asserts that target has all the given keys\n * expect({a: 1, b: 2}).to.have.all.keys('a', 'b');\n *\n * // Not recommended; asserts that target has at least one of the given\n * // keys but may or may not have more of them\n * expect({a: 1, b: 2}).to.have.any.keys('a', 'b');\n *\n * Note that `.all` is used by default when neither `.all` nor `.any` appear\n * earlier in the chain. However, it's often best to add `.all` anyway because\n * it improves readability.\n *\n * // Both assertions are identical\n * expect({a: 1, b: 2}).to.have.all.keys('a', 'b'); // Recommended\n * expect({a: 1, b: 2}).to.have.keys('a', 'b'); // Not recommended\n *\n * Add `.include` earlier in the chain to require that the target's keys be a\n * superset of the expected keys, rather than identical sets.\n *\n * // Target object's keys are a superset of ['a', 'b'] but not identical\n * expect({a: 1, b: 2, c: 3}).to.include.all.keys('a', 'b');\n * expect({a: 1, b: 2, c: 3}).to.not.have.all.keys('a', 'b');\n *\n * However, if `.any` and `.include` are combined, only the `.any` takes\n * effect. The `.include` is ignored in this case.\n *\n * // Both assertions are identical\n * expect({a: 1}).to.have.any.keys('a', 'b');\n * expect({a: 1}).to.include.any.keys('a', 'b');\n *\n * A custom error message can be given as the second argument to `expect`.\n *\n * expect({a: 1}, 'nooo why fail??').to.have.key('b');\n *\n * The alias `.key` can be used interchangeably with `.keys`.\n *\n * @name keys\n * @alias key\n * @param {...String|Array|Object} keys\n * @namespace BDD\n * @api public\n */\n\n function assertKeys (keys) {\n var obj = flag(this, 'object')\n , objType = _.type(obj)\n , keysType = _.type(keys)\n , ssfi = flag(this, 'ssfi')\n , isDeep = flag(this, 'deep')\n , str\n , deepStr = ''\n , ok = true\n , flagMsg = flag(this, 'message');\n\n flagMsg = flagMsg ? flagMsg + ': ' : '';\n var mixedArgsMsg = flagMsg + 'when testing keys against an object or an array you must give a single Array|Object|String argument or multiple String arguments';\n\n if (objType === 'Map' || objType === 'Set') {\n deepStr = isDeep ? 'deeply ' : '';\n actual = [];\n\n // Map and Set '.keys' aren't supported in IE 11. Therefore, use .forEach.\n obj.forEach(function (val, key) { actual.push(key) });\n\n if (keysType !== 'Array') {\n keys = Array.prototype.slice.call(arguments);\n }\n\n } else {\n actual = _.getOwnEnumerableProperties(obj);\n\n switch (keysType) {\n case 'Array':\n if (arguments.length > 1) {\n throw new AssertionError(mixedArgsMsg, undefined, ssfi);\n }\n break;\n case 'Object':\n if (arguments.length > 1) {\n throw new AssertionError(mixedArgsMsg, undefined, ssfi);\n }\n keys = Object.keys(keys);\n break;\n default:\n keys = Array.prototype.slice.call(arguments);\n }\n\n // Only stringify non-Symbols because Symbols would become \"Symbol()\"\n keys = keys.map(function (val) {\n return typeof val === 'symbol' ? val : String(val);\n });\n }\n\n if (!keys.length) {\n throw new AssertionError(flagMsg + 'keys required', undefined, ssfi);\n }\n\n var len = keys.length\n , any = flag(this, 'any')\n , all = flag(this, 'all')\n , expected = keys\n , actual;\n\n if (!any && !all) {\n all = true;\n }\n\n // Has any\n if (any) {\n ok = expected.some(function(expectedKey) {\n return actual.some(function(actualKey) {\n if (isDeep) {\n return _.eql(expectedKey, actualKey);\n } else {\n return expectedKey === actualKey;\n }\n });\n });\n }\n\n // Has all\n if (all) {\n ok = expected.every(function(expectedKey) {\n return actual.some(function(actualKey) {\n if (isDeep) {\n return _.eql(expectedKey, actualKey);\n } else {\n return expectedKey === actualKey;\n }\n });\n });\n\n if (!flag(this, 'contains')) {\n ok = ok && keys.length == actual.length;\n }\n }\n\n // Key string\n if (len > 1) {\n keys = keys.map(function(key) {\n return _.inspect(key);\n });\n var last = keys.pop();\n if (all) {\n str = keys.join(', ') + ', and ' + last;\n }\n if (any) {\n str = keys.join(', ') + ', or ' + last;\n }\n } else {\n str = _.inspect(keys[0]);\n }\n\n // Form\n str = (len > 1 ? 'keys ' : 'key ') + str;\n\n // Have / include\n str = (flag(this, 'contains') ? 'contain ' : 'have ') + str;\n\n // Assertion\n this.assert(\n ok\n , 'expected #{this} to ' + deepStr + str\n , 'expected #{this} to not ' + deepStr + str\n , expected.slice(0).sort(_.compareByInspect)\n , actual.sort(_.compareByInspect)\n , true\n );\n }\n\n Assertion.addMethod('keys', assertKeys);\n Assertion.addMethod('key', assertKeys);\n\n /**\n * ### .throw([errorLike], [errMsgMatcher], [msg])\n *\n * When no arguments are provided, `.throw` invokes the target function and\n * asserts that an error is thrown.\n * \n * var badFn = function () { throw new TypeError('Illegal salmon!'); };\n *\n * expect(badFn).to.throw();\n *\n * When one argument is provided, and it's an error constructor, `.throw`\n * invokes the target function and asserts that an error is thrown that's an\n * instance of that error constructor.\n *\n * var badFn = function () { throw new TypeError('Illegal salmon!'); };\n *\n * expect(badFn).to.throw(TypeError);\n *\n * When one argument is provided, and it's an error instance, `.throw` invokes\n * the target function and asserts that an error is thrown that's strictly\n * (`===`) equal to that error instance.\n *\n * var err = new TypeError('Illegal salmon!');\n * var badFn = function () { throw err; };\n *\n * expect(badFn).to.throw(err);\n *\n * When one argument is provided, and it's a string, `.throw` invokes the\n * target function and asserts that an error is thrown with a message that\n * contains that string.\n *\n * var badFn = function () { throw new TypeError('Illegal salmon!'); };\n *\n * expect(badFn).to.throw('salmon');\n *\n * When one argument is provided, and it's a regular expression, `.throw`\n * invokes the target function and asserts that an error is thrown with a\n * message that matches that regular expression.\n *\n * var badFn = function () { throw new TypeError('Illegal salmon!'); };\n *\n * expect(badFn).to.throw(/salmon/);\n *\n * When two arguments are provided, and the first is an error instance or\n * constructor, and the second is a string or regular expression, `.throw`\n * invokes the function and asserts that an error is thrown that fulfills both\n * conditions as described above.\n *\n * var err = new TypeError('Illegal salmon!');\n * var badFn = function () { throw err; };\n *\n * expect(badFn).to.throw(TypeError, 'salmon');\n * expect(badFn).to.throw(TypeError, /salmon/);\n * expect(badFn).to.throw(err, 'salmon');\n * expect(badFn).to.throw(err, /salmon/);\n *\n * Add `.not` earlier in the chain to negate `.throw`.\n * \n * var goodFn = function () {};\n *\n * expect(goodFn).to.not.throw();\n * \n * However, it's dangerous to negate `.throw` when providing any arguments.\n * The problem is that it creates uncertain expectations by asserting that the\n * target either doesn't throw an error, or that it throws an error but of a\n * different type than the given type, or that it throws an error of the given\n * type but with a message that doesn't include the given string. It's often\n * best to identify the exact output that's expected, and then write an\n * assertion that only accepts that exact output.\n *\n * When the target isn't expected to throw an error, it's often best to assert\n * exactly that.\n *\n * var goodFn = function () {};\n *\n * expect(goodFn).to.not.throw(); // Recommended\n * expect(goodFn).to.not.throw(ReferenceError, 'x'); // Not recommended\n *\n * When the target is expected to throw an error, it's often best to assert\n * that the error is of its expected type, and has a message that includes an\n * expected string, rather than asserting that it doesn't have one of many\n * unexpected types, and doesn't have a message that includes some string.\n *\n * var badFn = function () { throw new TypeError('Illegal salmon!'); };\n *\n * expect(badFn).to.throw(TypeError, 'salmon'); // Recommended\n * expect(badFn).to.not.throw(ReferenceError, 'x'); // Not recommended\n *\n * `.throw` changes the target of any assertions that follow in the chain to\n * be the error object that's thrown.\n *\n * var err = new TypeError('Illegal salmon!');\n * err.code = 42;\n * var badFn = function () { throw err; };\n *\n * expect(badFn).to.throw(TypeError).with.property('code', 42);\n *\n * `.throw` accepts an optional `msg` argument which is a custom error message\n * to show when the assertion fails. The message can also be given as the\n * second argument to `expect`. When not providing two arguments, always use\n * the second form.\n *\n * var goodFn = function () {};\n *\n * expect(goodFn).to.throw(TypeError, 'x', 'nooo why fail??');\n * expect(goodFn, 'nooo why fail??').to.throw();\n *\n * Due to limitations in ES5, `.throw` may not always work as expected when\n * using a transpiler such as Babel or TypeScript. In particular, it may\n * produce unexpected results when subclassing the built-in `Error` object and\n * then passing the subclassed constructor to `.throw`. See your transpiler's\n * docs for details:\n *\n * - ([Babel](https://babeljs.io/docs/usage/caveats/#classes))\n * - ([TypeScript](https://github.com/Microsoft/TypeScript/wiki/Breaking-Changes#extending-built-ins-like-error-array-and-map-may-no-longer-work))\n *\n * Beware of some common mistakes when using the `throw` assertion. One common\n * mistake is to accidentally invoke the function yourself instead of letting\n * the `throw` assertion invoke the function for you. For example, when\n * testing if a function named `fn` throws, provide `fn` instead of `fn()` as\n * the target for the assertion.\n *\n * expect(fn).to.throw(); // Good! Tests `fn` as desired\n * expect(fn()).to.throw(); // Bad! Tests result of `fn()`, not `fn`\n *\n * If you need to assert that your function `fn` throws when passed certain\n * arguments, then wrap a call to `fn` inside of another function.\n *\n * expect(function () { fn(42); }).to.throw(); // Function expression\n * expect(() => fn(42)).to.throw(); // ES6 arrow function\n *\n * Another common mistake is to provide an object method (or any stand-alone\n * function that relies on `this`) as the target of the assertion. Doing so is\n * problematic because the `this` context will be lost when the function is\n * invoked by `.throw`; there's no way for it to know what `this` is supposed\n * to be. There are two ways around this problem. One solution is to wrap the\n * method or function call inside of another function. Another solution is to\n * use `bind`.\n *\n * expect(function () { cat.meow(); }).to.throw(); // Function expression\n * expect(() => cat.meow()).to.throw(); // ES6 arrow function\n * expect(cat.meow.bind(cat)).to.throw(); // Bind\n *\n * Finally, it's worth mentioning that it's a best practice in JavaScript to\n * only throw `Error` and derivatives of `Error` such as `ReferenceError`,\n * `TypeError`, and user-defined objects that extend `Error`. No other type of\n * value will generate a stack trace when initialized. With that said, the\n * `throw` assertion does technically support any type of value being thrown,\n * not just `Error` and its derivatives.\n *\n * The aliases `.throws` and `.Throw` can be used interchangeably with\n * `.throw`.\n *\n * @name throw\n * @alias throws\n * @alias Throw\n * @param {Error|ErrorConstructor} errorLike\n * @param {String|RegExp} errMsgMatcher error message\n * @param {String} msg _optional_\n * @see https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Error#Error_types\n * @returns error for chaining (null if no error)\n * @namespace BDD\n * @api public\n */\n\n function assertThrows (errorLike, errMsgMatcher, msg) {\n if (msg) flag(this, 'message', msg);\n var obj = flag(this, 'object')\n , ssfi = flag(this, 'ssfi')\n , flagMsg = flag(this, 'message')\n , negate = flag(this, 'negate') || false;\n new Assertion(obj, flagMsg, ssfi, true).is.a('function');\n\n if (errorLike instanceof RegExp || typeof errorLike === 'string') {\n errMsgMatcher = errorLike;\n errorLike = null;\n }\n\n var caughtErr;\n try {\n obj();\n } catch (err) {\n caughtErr = err;\n }\n\n // If we have the negate flag enabled and at least one valid argument it means we do expect an error\n // but we want it to match a given set of criteria\n var everyArgIsUndefined = errorLike === undefined && errMsgMatcher === undefined;\n\n // If we've got the negate flag enabled and both args, we should only fail if both aren't compatible\n // See Issue #551 and PR #683@GitHub\n var everyArgIsDefined = Boolean(errorLike && errMsgMatcher);\n var errorLikeFail = false;\n var errMsgMatcherFail = false;\n\n // Checking if error was thrown\n if (everyArgIsUndefined || !everyArgIsUndefined && !negate) {\n // We need this to display results correctly according to their types\n var errorLikeString = 'an error';\n if (errorLike instanceof Error) {\n errorLikeString = '#{exp}';\n } else if (errorLike) {\n errorLikeString = _.checkError.getConstructorName(errorLike);\n }\n\n this.assert(\n caughtErr\n , 'expected #{this} to throw ' + errorLikeString\n , 'expected #{this} to not throw an error but #{act} was thrown'\n , errorLike && errorLike.toString()\n , (caughtErr instanceof Error ?\n caughtErr.toString() : (typeof caughtErr === 'string' ? caughtErr : caughtErr &&\n _.checkError.getConstructorName(caughtErr)))\n );\n }\n\n if (errorLike && caughtErr) {\n // We should compare instances only if `errorLike` is an instance of `Error`\n if (errorLike instanceof Error) {\n var isCompatibleInstance = _.checkError.compatibleInstance(caughtErr, errorLike);\n\n if (isCompatibleInstance === negate) {\n // These checks were created to ensure we won't fail too soon when we've got both args and a negate\n // See Issue #551 and PR #683@GitHub\n if (everyArgIsDefined && negate) {\n errorLikeFail = true;\n } else {\n this.assert(\n negate\n , 'expected #{this} to throw #{exp} but #{act} was thrown'\n , 'expected #{this} to not throw #{exp}' + (caughtErr && !negate ? ' but #{act} was thrown' : '')\n , errorLike.toString()\n , caughtErr.toString()\n );\n }\n }\n }\n\n var isCompatibleConstructor = _.checkError.compatibleConstructor(caughtErr, errorLike);\n if (isCompatibleConstructor === negate) {\n if (everyArgIsDefined && negate) {\n errorLikeFail = true;\n } else {\n this.assert(\n negate\n , 'expected #{this} to throw #{exp} but #{act} was thrown'\n , 'expected #{this} to not throw #{exp}' + (caughtErr ? ' but #{act} was thrown' : '')\n , (errorLike instanceof Error ? errorLike.toString() : errorLike && _.checkError.getConstructorName(errorLike))\n , (caughtErr instanceof Error ? caughtErr.toString() : caughtErr && _.checkError.getConstructorName(caughtErr))\n );\n }\n }\n }\n\n if (caughtErr && errMsgMatcher !== undefined && errMsgMatcher !== null) {\n // Here we check compatible messages\n var placeholder = 'including';\n if (errMsgMatcher instanceof RegExp) {\n placeholder = 'matching'\n }\n\n var isCompatibleMessage = _.checkError.compatibleMessage(caughtErr, errMsgMatcher);\n if (isCompatibleMessage === negate) {\n if (everyArgIsDefined && negate) {\n errMsgMatcherFail = true;\n } else {\n this.assert(\n negate\n , 'expected #{this} to throw error ' + placeholder + ' #{exp} but got #{act}'\n , 'expected #{this} to throw error not ' + placeholder + ' #{exp}'\n , errMsgMatcher\n , _.checkError.getMessage(caughtErr)\n );\n }\n }\n }\n\n // If both assertions failed and both should've matched we throw an error\n if (errorLikeFail && errMsgMatcherFail) {\n this.assert(\n negate\n , 'expected #{this} to throw #{exp} but #{act} was thrown'\n , 'expected #{this} to not throw #{exp}' + (caughtErr ? ' but #{act} was thrown' : '')\n , (errorLike instanceof Error ? errorLike.toString() : errorLike && _.checkError.getConstructorName(errorLike))\n , (caughtErr instanceof Error ? caughtErr.toString() : caughtErr && _.checkError.getConstructorName(caughtErr))\n );\n }\n\n flag(this, 'object', caughtErr);\n };\n\n Assertion.addMethod('throw', assertThrows);\n Assertion.addMethod('throws', assertThrows);\n Assertion.addMethod('Throw', assertThrows);\n\n /**\n * ### .respondTo(method[, msg])\n *\n * When the target is a non-function object, `.respondTo` asserts that the\n * target has a method with the given name `method`. The method can be own or\n * inherited, and it can be enumerable or non-enumerable.\n *\n * function Cat () {}\n * Cat.prototype.meow = function () {};\n *\n * expect(new Cat()).to.respondTo('meow');\n *\n * When the target is a function, `.respondTo` asserts that the target's\n * `prototype` property has a method with the given name `method`. Again, the\n * method can be own or inherited, and it can be enumerable or non-enumerable.\n *\n * function Cat () {}\n * Cat.prototype.meow = function () {};\n *\n * expect(Cat).to.respondTo('meow');\n *\n * Add `.itself` earlier in the chain to force `.respondTo` to treat the\n * target as a non-function object, even if it's a function. Thus, it asserts\n * that the target has a method with the given name `method`, rather than\n * asserting that the target's `prototype` property has a method with the\n * given name `method`.\n *\n * function Cat () {}\n * Cat.prototype.meow = function () {};\n * Cat.hiss = function () {};\n *\n * expect(Cat).itself.to.respondTo('hiss').but.not.respondTo('meow');\n *\n * When not adding `.itself`, it's important to check the target's type before\n * using `.respondTo`. See the `.a` doc for info on checking a target's type.\n *\n * function Cat () {}\n * Cat.prototype.meow = function () {};\n *\n * expect(new Cat()).to.be.an('object').that.respondsTo('meow');\n *\n * Add `.not` earlier in the chain to negate `.respondTo`.\n *\n * function Dog () {}\n * Dog.prototype.bark = function () {};\n *\n * expect(new Dog()).to.not.respondTo('meow');\n *\n * `.respondTo` accepts an optional `msg` argument which is a custom error\n * message to show when the assertion fails. The message can also be given as\n * the second argument to `expect`.\n *\n * expect({}).to.respondTo('meow', 'nooo why fail??');\n * expect({}, 'nooo why fail??').to.respondTo('meow');\n *\n * The alias `.respondsTo` can be used interchangeably with `.respondTo`.\n *\n * @name respondTo\n * @alias respondsTo\n * @param {String} method\n * @param {String} msg _optional_\n * @namespace BDD\n * @api public\n */\n\n function respondTo (method, msg) {\n if (msg) flag(this, 'message', msg);\n var obj = flag(this, 'object')\n , itself = flag(this, 'itself')\n , context = ('function' === typeof obj && !itself)\n ? obj.prototype[method]\n : obj[method];\n\n this.assert(\n 'function' === typeof context\n , 'expected #{this} to respond to ' + _.inspect(method)\n , 'expected #{this} to not respond to ' + _.inspect(method)\n );\n }\n\n Assertion.addMethod('respondTo', respondTo);\n Assertion.addMethod('respondsTo', respondTo);\n\n /**\n * ### .itself\n *\n * Forces all `.respondTo` assertions that follow in the chain to behave as if\n * the target is a non-function object, even if it's a function. Thus, it\n * causes `.respondTo` to assert that the target has a method with the given\n * name, rather than asserting that the target's `prototype` property has a\n * method with the given name.\n *\n * function Cat () {}\n * Cat.prototype.meow = function () {};\n * Cat.hiss = function () {};\n *\n * expect(Cat).itself.to.respondTo('hiss').but.not.respondTo('meow');\n *\n * @name itself\n * @namespace BDD\n * @api public\n */\n\n Assertion.addProperty('itself', function () {\n flag(this, 'itself', true);\n });\n\n /**\n * ### .satisfy(matcher[, msg])\n *\n * Invokes the given `matcher` function with the target being passed as the\n * first argument, and asserts that the value returned is truthy.\n *\n * expect(1).to.satisfy(function(num) {\n * return num > 0; \n * });\n *\n * Add `.not` earlier in the chain to negate `.satisfy`.\n *\n * expect(1).to.not.satisfy(function(num) {\n * return num > 2;\n * });\n *\n * `.satisfy` accepts an optional `msg` argument which is a custom error\n * message to show when the assertion fails. The message can also be given as\n * the second argument to `expect`.\n *\n * expect(1).to.satisfy(function(num) {\n * return num > 2;\n * }, 'nooo why fail??');\n *\n * expect(1, 'nooo why fail??').to.satisfy(function(num) {\n * return num > 2;\n * });\n *\n * The alias `.satisfies` can be used interchangeably with `.satisfy`.\n *\n * @name satisfy\n * @alias satisfies\n * @param {Function} matcher\n * @param {String} msg _optional_\n * @namespace BDD\n * @api public\n */\n\n function satisfy (matcher, msg) {\n if (msg) flag(this, 'message', msg);\n var obj = flag(this, 'object');\n var result = matcher(obj);\n this.assert(\n result\n , 'expected #{this} to satisfy ' + _.objDisplay(matcher)\n , 'expected #{this} to not satisfy' + _.objDisplay(matcher)\n , flag(this, 'negate') ? false : true\n , result\n );\n }\n\n Assertion.addMethod('satisfy', satisfy);\n Assertion.addMethod('satisfies', satisfy);\n\n /**\n * ### .closeTo(expected, delta[, msg])\n *\n * Asserts that the target is a number that's within a given +/- `delta` range\n * of the given number `expected`. However, it's often best to assert that the\n * target is equal to its expected value.\n *\n * // Recommended\n * expect(1.5).to.equal(1.5);\n *\n * // Not recommended\n * expect(1.5).to.be.closeTo(1, 0.5);\n * expect(1.5).to.be.closeTo(2, 0.5);\n * expect(1.5).to.be.closeTo(1, 1);\n *\n * Add `.not` earlier in the chain to negate `.closeTo`.\n *\n * expect(1.5).to.equal(1.5); // Recommended\n * expect(1.5).to.not.be.closeTo(3, 1); // Not recommended\n *\n * `.closeTo` accepts an optional `msg` argument which is a custom error\n * message to show when the assertion fails. The message can also be given as\n * the second argument to `expect`.\n *\n * expect(1.5).to.be.closeTo(3, 1, 'nooo why fail??');\n * expect(1.5, 'nooo why fail??').to.be.closeTo(3, 1);\n *\n * The alias `.approximately` can be used interchangeably with `.closeTo`.\n *\n * @name closeTo\n * @alias approximately\n * @param {Number} expected\n * @param {Number} delta\n * @param {String} msg _optional_\n * @namespace BDD\n * @api public\n */\n\n function closeTo(expected, delta, msg) {\n if (msg) flag(this, 'message', msg);\n var obj = flag(this, 'object')\n , flagMsg = flag(this, 'message')\n , ssfi = flag(this, 'ssfi');\n\n new Assertion(obj, flagMsg, ssfi, true).is.a('number');\n if (typeof expected !== 'number' || typeof delta !== 'number') {\n flagMsg = flagMsg ? flagMsg + ': ' : '';\n throw new AssertionError(\n flagMsg + 'the arguments to closeTo or approximately must be numbers',\n undefined,\n ssfi\n );\n }\n\n this.assert(\n Math.abs(obj - expected) <= delta\n , 'expected #{this} to be close to ' + expected + ' +/- ' + delta\n , 'expected #{this} not to be close to ' + expected + ' +/- ' + delta\n );\n }\n\n Assertion.addMethod('closeTo', closeTo);\n Assertion.addMethod('approximately', closeTo);\n\n // Note: Duplicates are ignored if testing for inclusion instead of sameness.\n function isSubsetOf(subset, superset, cmp, contains, ordered) {\n if (!contains) {\n if (subset.length !== superset.length) return false;\n superset = superset.slice();\n }\n\n return subset.every(function(elem, idx) {\n if (ordered) return cmp ? cmp(elem, superset[idx]) : elem === superset[idx];\n\n if (!cmp) {\n var matchIdx = superset.indexOf(elem);\n if (matchIdx === -1) return false;\n\n // Remove match from superset so not counted twice if duplicate in subset.\n if (!contains) superset.splice(matchIdx, 1);\n return true;\n }\n\n return superset.some(function(elem2, matchIdx) {\n if (!cmp(elem, elem2)) return false;\n\n // Remove match from superset so not counted twice if duplicate in subset.\n if (!contains) superset.splice(matchIdx, 1);\n return true;\n });\n });\n }\n\n /**\n * ### .members(set[, msg])\n *\n * Asserts that the target array has the same members as the given array\n * `set`.\n *\n * expect([1, 2, 3]).to.have.members([2, 1, 3]);\n * expect([1, 2, 2]).to.have.members([2, 1, 2]);\n *\n * By default, members are compared using strict (`===`) equality. Add `.deep`\n * earlier in the chain to use deep equality instead. See the `deep-eql`\n * project page for info on the deep equality algorithm:\n * https://github.com/chaijs/deep-eql.\n *\n * // Target array deeply (but not strictly) has member `{a: 1}`\n * expect([{a: 1}]).to.have.deep.members([{a: 1}]);\n * expect([{a: 1}]).to.not.have.members([{a: 1}]);\n *\n * By default, order doesn't matter. Add `.ordered` earlier in the chain to\n * require that members appear in the same order.\n *\n * expect([1, 2, 3]).to.have.ordered.members([1, 2, 3]);\n * expect([1, 2, 3]).to.have.members([2, 1, 3])\n * .but.not.ordered.members([2, 1, 3]);\n *\n * By default, both arrays must be the same size. Add `.include` earlier in\n * the chain to require that the target's members be a superset of the\n * expected members. Note that duplicates are ignored in the subset when\n * `.include` is added.\n *\n * // Target array is a superset of [1, 2] but not identical\n * expect([1, 2, 3]).to.include.members([1, 2]);\n * expect([1, 2, 3]).to.not.have.members([1, 2]);\n *\n * // Duplicates in the subset are ignored\n * expect([1, 2, 3]).to.include.members([1, 2, 2, 2]);\n *\n * `.deep`, `.ordered`, and `.include` can all be combined. However, if\n * `.include` and `.ordered` are combined, the ordering begins at the start of\n * both arrays.\n *\n * expect([{a: 1}, {b: 2}, {c: 3}])\n * .to.include.deep.ordered.members([{a: 1}, {b: 2}])\n * .but.not.include.deep.ordered.members([{b: 2}, {c: 3}]);\n *\n * Add `.not` earlier in the chain to negate `.members`. However, it's\n * dangerous to do so. The problem is that it creates uncertain expectations\n * by asserting that the target array doesn't have all of the same members as\n * the given array `set` but may or may not have some of them. It's often best\n * to identify the exact output that's expected, and then write an assertion\n * that only accepts that exact output.\n *\n * expect([1, 2]).to.not.include(3).and.not.include(4); // Recommended\n * expect([1, 2]).to.not.have.members([3, 4]); // Not recommended\n *\n * `.members` accepts an optional `msg` argument which is a custom error\n * message to show when the assertion fails. The message can also be given as\n * the second argument to `expect`.\n *\n * expect([1, 2]).to.have.members([1, 2, 3], 'nooo why fail??');\n * expect([1, 2], 'nooo why fail??').to.have.members([1, 2, 3]);\n *\n * @name members\n * @param {Array} set\n * @param {String} msg _optional_\n * @namespace BDD\n * @api public\n */\n\n Assertion.addMethod('members', function (subset, msg) {\n if (msg) flag(this, 'message', msg);\n var obj = flag(this, 'object')\n , flagMsg = flag(this, 'message')\n , ssfi = flag(this, 'ssfi');\n\n new Assertion(obj, flagMsg, ssfi, true).to.be.an('array');\n new Assertion(subset, flagMsg, ssfi, true).to.be.an('array');\n\n var contains = flag(this, 'contains');\n var ordered = flag(this, 'ordered');\n\n var subject, failMsg, failNegateMsg, lengthCheck;\n\n if (contains) {\n subject = ordered ? 'an ordered superset' : 'a superset';\n failMsg = 'expected #{this} to be ' + subject + ' of #{exp}';\n failNegateMsg = 'expected #{this} to not be ' + subject + ' of #{exp}';\n } else {\n subject = ordered ? 'ordered members' : 'members';\n failMsg = 'expected #{this} to have the same ' + subject + ' as #{exp}';\n failNegateMsg = 'expected #{this} to not have the same ' + subject + ' as #{exp}';\n }\n\n var cmp = flag(this, 'deep') ? _.eql : undefined;\n\n this.assert(\n isSubsetOf(subset, obj, cmp, contains, ordered)\n , failMsg\n , failNegateMsg\n , subset\n , obj\n , true\n );\n });\n\n /**\n * ### .oneOf(list[, msg])\n *\n * Asserts that the target is a member of the given array `list`. However,\n * it's often best to assert that the target is equal to its expected value.\n *\n * expect(1).to.equal(1); // Recommended\n * expect(1).to.be.oneOf([1, 2, 3]); // Not recommended\n *\n * Comparisons are performed using strict (`===`) equality.\n *\n * Add `.not` earlier in the chain to negate `.oneOf`.\n *\n * expect(1).to.equal(1); // Recommended\n * expect(1).to.not.be.oneOf([2, 3, 4]); // Not recommended\n *\n * `.oneOf` accepts an optional `msg` argument which is a custom error message\n * to show when the assertion fails. The message can also be given as the\n * second argument to `expect`.\n *\n * expect(1).to.be.oneOf([2, 3, 4], 'nooo why fail??');\n * expect(1, 'nooo why fail??').to.be.oneOf([2, 3, 4]);\n *\n * @name oneOf\n * @param {Array<*>} list\n * @param {String} msg _optional_\n * @namespace BDD\n * @api public\n */\n\n function oneOf (list, msg) {\n if (msg) flag(this, 'message', msg);\n var expected = flag(this, 'object')\n , flagMsg = flag(this, 'message')\n , ssfi = flag(this, 'ssfi');\n new Assertion(list, flagMsg, ssfi, true).to.be.an('array');\n\n this.assert(\n list.indexOf(expected) > -1\n , 'expected #{this} to be one of #{exp}'\n , 'expected #{this} to not be one of #{exp}'\n , list\n , expected\n );\n }\n\n Assertion.addMethod('oneOf', oneOf);\n\n\n /**\n * ### .change(subject[, prop[, msg]])\n *\n * When one argument is provided, `.change` asserts that the given function\n * `subject` returns a different value when it's invoked before the target\n * function compared to when it's invoked afterward. However, it's often best\n * to assert that `subject` is equal to its expected value.\n *\n * var dots = ''\n * , addDot = function () { dots += '.'; }\n * , getDots = function () { return dots; };\n *\n * // Recommended\n * expect(getDots()).to.equal('');\n * addDot();\n * expect(getDots()).to.equal('.');\n *\n * // Not recommended\n * expect(addDot).to.change(getDots);\n *\n * When two arguments are provided, `.change` asserts that the value of the\n * given object `subject`'s `prop` property is different before invoking the\n * target function compared to afterward.\n *\n * var myObj = {dots: ''}\n * , addDot = function () { myObj.dots += '.'; };\n *\n * // Recommended\n * expect(myObj).to.have.property('dots', '');\n * addDot();\n * expect(myObj).to.have.property('dots', '.');\n *\n * // Not recommended\n * expect(addDot).to.change(myObj, 'dots');\n *\n * Strict (`===`) equality is used to compare before and after values.\n *\n * Add `.not` earlier in the chain to negate `.change`.\n *\n * var dots = ''\n * , noop = function () {}\n * , getDots = function () { return dots; };\n *\n * expect(noop).to.not.change(getDots);\n *\n * var myObj = {dots: ''}\n * , noop = function () {};\n *\n * expect(noop).to.not.change(myObj, 'dots');\n *\n * `.change` accepts an optional `msg` argument which is a custom error\n * message to show when the assertion fails. The message can also be given as\n * the second argument to `expect`. When not providing two arguments, always\n * use the second form.\n *\n * var myObj = {dots: ''}\n * , addDot = function () { myObj.dots += '.'; };\n *\n * expect(addDot).to.not.change(myObj, 'dots', 'nooo why fail??');\n *\n * var dots = ''\n * , addDot = function () { dots += '.'; }\n * , getDots = function () { return dots; };\n *\n * expect(addDot, 'nooo why fail??').to.not.change(getDots);\n *\n * `.change` also causes all `.by` assertions that follow in the chain to\n * assert how much a numeric subject was increased or decreased by. However,\n * it's dangerous to use `.change.by`. The problem is that it creates\n * uncertain expectations by asserting that the subject either increases by\n * the given delta, or that it decreases by the given delta. It's often best\n * to identify the exact output that's expected, and then write an assertion\n * that only accepts that exact output.\n *\n * var myObj = {val: 1}\n * , addTwo = function () { myObj.val += 2; }\n * , subtractTwo = function () { myObj.val -= 2; };\n *\n * expect(addTwo).to.increase(myObj, 'val').by(2); // Recommended\n * expect(addTwo).to.change(myObj, 'val').by(2); // Not recommended\n *\n * expect(subtractTwo).to.decrease(myObj, 'val').by(2); // Recommended\n * expect(subtractTwo).to.change(myObj, 'val').by(2); // Not recommended\n *\n * The alias `.changes` can be used interchangeably with `.change`.\n *\n * @name change\n * @alias changes\n * @param {String} subject\n * @param {String} prop name _optional_\n * @param {String} msg _optional_\n * @namespace BDD\n * @api public\n */\n\n function assertChanges (subject, prop, msg) {\n if (msg) flag(this, 'message', msg);\n var fn = flag(this, 'object')\n , flagMsg = flag(this, 'message')\n , ssfi = flag(this, 'ssfi');\n new Assertion(fn, flagMsg, ssfi, true).is.a('function');\n\n var initial;\n if (!prop) {\n new Assertion(subject, flagMsg, ssfi, true).is.a('function');\n initial = subject();\n } else {\n new Assertion(subject, flagMsg, ssfi, true).to.have.property(prop);\n initial = subject[prop];\n }\n\n fn();\n\n var final = prop === undefined || prop === null ? subject() : subject[prop];\n var msgObj = prop === undefined || prop === null ? initial : '.' + prop;\n\n // This gets flagged because of the .by(delta) assertion\n flag(this, 'deltaMsgObj', msgObj);\n flag(this, 'initialDeltaValue', initial);\n flag(this, 'finalDeltaValue', final);\n flag(this, 'deltaBehavior', 'change');\n flag(this, 'realDelta', final !== initial);\n\n this.assert(\n initial !== final\n , 'expected ' + msgObj + ' to change'\n , 'expected ' + msgObj + ' to not change'\n );\n }\n\n Assertion.addMethod('change', assertChanges);\n Assertion.addMethod('changes', assertChanges);\n\n /**\n * ### .increase(subject[, prop[, msg]])\n *\n * When one argument is provided, `.increase` asserts that the given function\n * `subject` returns a greater number when it's invoked after invoking the\n * target function compared to when it's invoked beforehand. `.increase` also\n * causes all `.by` assertions that follow in the chain to assert how much\n * greater of a number is returned. It's often best to assert that the return\n * value increased by the expected amount, rather than asserting it increased\n * by any amount.\n *\n * var val = 1\n * , addTwo = function () { val += 2; }\n * , getVal = function () { return val; };\n *\n * expect(addTwo).to.increase(getVal).by(2); // Recommended\n * expect(addTwo).to.increase(getVal); // Not recommended\n *\n * When two arguments are provided, `.increase` asserts that the value of the\n * given object `subject`'s `prop` property is greater after invoking the\n * target function compared to beforehand.\n *\n * var myObj = {val: 1}\n * , addTwo = function () { myObj.val += 2; };\n *\n * expect(addTwo).to.increase(myObj, 'val').by(2); // Recommended\n * expect(addTwo).to.increase(myObj, 'val'); // Not recommended\n *\n * Add `.not` earlier in the chain to negate `.increase`. However, it's\n * dangerous to do so. The problem is that it creates uncertain expectations\n * by asserting that the subject either decreases, or that it stays the same.\n * It's often best to identify the exact output that's expected, and then\n * write an assertion that only accepts that exact output.\n *\n * When the subject is expected to decrease, it's often best to assert that it\n * decreased by the expected amount.\n *\n * var myObj = {val: 1}\n * , subtractTwo = function () { myObj.val -= 2; };\n *\n * expect(subtractTwo).to.decrease(myObj, 'val').by(2); // Recommended\n * expect(subtractTwo).to.not.increase(myObj, 'val'); // Not recommended\n * \n * When the subject is expected to stay the same, it's often best to assert\n * exactly that.\n *\n * var myObj = {val: 1}\n * , noop = function () {};\n *\n * expect(noop).to.not.change(myObj, 'val'); // Recommended\n * expect(noop).to.not.increase(myObj, 'val'); // Not recommended\n *\n * `.increase` accepts an optional `msg` argument which is a custom error\n * message to show when the assertion fails. The message can also be given as\n * the second argument to `expect`. When not providing two arguments, always\n * use the second form.\n *\n * var myObj = {val: 1}\n * , noop = function () {};\n *\n * expect(noop).to.increase(myObj, 'val', 'nooo why fail??');\n *\n * var val = 1\n * , noop = function () {}\n * , getVal = function () { return val; };\n *\n * expect(noop, 'nooo why fail??').to.increase(getVal);\n *\n * The alias `.increases` can be used interchangeably with `.increase`.\n *\n * @name increase\n * @alias increases\n * @param {String|Function} subject\n * @param {String} prop name _optional_\n * @param {String} msg _optional_\n * @namespace BDD\n * @api public\n */\n\n function assertIncreases (subject, prop, msg) {\n if (msg) flag(this, 'message', msg);\n var fn = flag(this, 'object')\n , flagMsg = flag(this, 'message')\n , ssfi = flag(this, 'ssfi');\n new Assertion(fn, flagMsg, ssfi, true).is.a('function');\n\n var initial;\n if (!prop) {\n new Assertion(subject, flagMsg, ssfi, true).is.a('function');\n initial = subject();\n } else {\n new Assertion(subject, flagMsg, ssfi, true).to.have.property(prop);\n initial = subject[prop];\n }\n\n // Make sure that the target is a number\n new Assertion(initial, flagMsg, ssfi, true).is.a('number');\n\n fn();\n\n var final = prop === undefined || prop === null ? subject() : subject[prop];\n var msgObj = prop === undefined || prop === null ? initial : '.' + prop;\n\n flag(this, 'deltaMsgObj', msgObj);\n flag(this, 'initialDeltaValue', initial);\n flag(this, 'finalDeltaValue', final);\n flag(this, 'deltaBehavior', 'increase');\n flag(this, 'realDelta', final - initial);\n\n this.assert(\n final - initial > 0\n , 'expected ' + msgObj + ' to increase'\n , 'expected ' + msgObj + ' to not increase'\n );\n }\n\n Assertion.addMethod('increase', assertIncreases);\n Assertion.addMethod('increases', assertIncreases);\n\n /**\n * ### .decrease(subject[, prop[, msg]])\n *\n * When one argument is provided, `.decrease` asserts that the given function\n * `subject` returns a lesser number when it's invoked after invoking the\n * target function compared to when it's invoked beforehand. `.decrease` also\n * causes all `.by` assertions that follow in the chain to assert how much\n * lesser of a number is returned. It's often best to assert that the return\n * value decreased by the expected amount, rather than asserting it decreased\n * by any amount.\n *\n * var val = 1\n * , subtractTwo = function () { val -= 2; }\n * , getVal = function () { return val; };\n *\n * expect(subtractTwo).to.decrease(getVal).by(2); // Recommended\n * expect(subtractTwo).to.decrease(getVal); // Not recommended\n *\n * When two arguments are provided, `.decrease` asserts that the value of the\n * given object `subject`'s `prop` property is lesser after invoking the\n * target function compared to beforehand. \n *\n * var myObj = {val: 1}\n * , subtractTwo = function () { myObj.val -= 2; };\n *\n * expect(subtractTwo).to.decrease(myObj, 'val').by(2); // Recommended\n * expect(subtractTwo).to.decrease(myObj, 'val'); // Not recommended\n *\n * Add `.not` earlier in the chain to negate `.decrease`. However, it's\n * dangerous to do so. The problem is that it creates uncertain expectations\n * by asserting that the subject either increases, or that it stays the same.\n * It's often best to identify the exact output that's expected, and then\n * write an assertion that only accepts that exact output.\n *\n * When the subject is expected to increase, it's often best to assert that it\n * increased by the expected amount.\n *\n * var myObj = {val: 1}\n * , addTwo = function () { myObj.val += 2; };\n *\n * expect(addTwo).to.increase(myObj, 'val').by(2); // Recommended\n * expect(addTwo).to.not.decrease(myObj, 'val'); // Not recommended\n * \n * When the subject is expected to stay the same, it's often best to assert\n * exactly that.\n *\n * var myObj = {val: 1}\n * , noop = function () {};\n *\n * expect(noop).to.not.change(myObj, 'val'); // Recommended\n * expect(noop).to.not.decrease(myObj, 'val'); // Not recommended\n *\n * `.decrease` accepts an optional `msg` argument which is a custom error\n * message to show when the assertion fails. The message can also be given as\n * the second argument to `expect`. When not providing two arguments, always\n * use the second form.\n *\n * var myObj = {val: 1}\n * , noop = function () {};\n *\n * expect(noop).to.decrease(myObj, 'val', 'nooo why fail??');\n *\n * var val = 1\n * , noop = function () {}\n * , getVal = function () { return val; };\n *\n * expect(noop, 'nooo why fail??').to.decrease(getVal);\n *\n * The alias `.decreases` can be used interchangeably with `.decrease`.\n *\n * @name decrease\n * @alias decreases\n * @param {String|Function} subject\n * @param {String} prop name _optional_\n * @param {String} msg _optional_\n * @namespace BDD\n * @api public\n */\n\n function assertDecreases (subject, prop, msg) {\n if (msg) flag(this, 'message', msg);\n var fn = flag(this, 'object')\n , flagMsg = flag(this, 'message')\n , ssfi = flag(this, 'ssfi');\n new Assertion(fn, flagMsg, ssfi, true).is.a('function');\n\n var initial;\n if (!prop) {\n new Assertion(subject, flagMsg, ssfi, true).is.a('function');\n initial = subject();\n } else {\n new Assertion(subject, flagMsg, ssfi, true).to.have.property(prop);\n initial = subject[prop];\n }\n\n // Make sure that the target is a number\n new Assertion(initial, flagMsg, ssfi, true).is.a('number');\n\n fn();\n\n var final = prop === undefined || prop === null ? subject() : subject[prop];\n var msgObj = prop === undefined || prop === null ? initial : '.' + prop;\n\n flag(this, 'deltaMsgObj', msgObj);\n flag(this, 'initialDeltaValue', initial);\n flag(this, 'finalDeltaValue', final);\n flag(this, 'deltaBehavior', 'decrease');\n flag(this, 'realDelta', initial - final);\n\n this.assert(\n final - initial < 0\n , 'expected ' + msgObj + ' to decrease'\n , 'expected ' + msgObj + ' to not decrease'\n );\n }\n\n Assertion.addMethod('decrease', assertDecreases);\n Assertion.addMethod('decreases', assertDecreases);\n\n /**\n * ### .by(delta[, msg])\n *\n * When following an `.increase` assertion in the chain, `.by` asserts that\n * the subject of the `.increase` assertion increased by the given `delta`.\n *\n * var myObj = {val: 1}\n * , addTwo = function () { myObj.val += 2; };\n *\n * expect(addTwo).to.increase(myObj, 'val').by(2);\n *\n * When following a `.decrease` assertion in the chain, `.by` asserts that the\n * subject of the `.decrease` assertion decreased by the given `delta`.\n *\n * var myObj = {val: 1}\n * , subtractTwo = function () { myObj.val -= 2; };\n *\n * expect(subtractTwo).to.decrease(myObj, 'val').by(2);\n *\n * When following a `.change` assertion in the chain, `.by` asserts that the\n * subject of the `.change` assertion either increased or decreased by the\n * given `delta`. However, it's dangerous to use `.change.by`. The problem is\n * that it creates uncertain expectations. It's often best to identify the\n * exact output that's expected, and then write an assertion that only accepts\n * that exact output.\n *\n * var myObj = {val: 1}\n * , addTwo = function () { myObj.val += 2; }\n * , subtractTwo = function () { myObj.val -= 2; };\n *\n * expect(addTwo).to.increase(myObj, 'val').by(2); // Recommended\n * expect(addTwo).to.change(myObj, 'val').by(2); // Not recommended\n *\n * expect(subtractTwo).to.decrease(myObj, 'val').by(2); // Recommended\n * expect(subtractTwo).to.change(myObj, 'val').by(2); // Not recommended\n *\n * Add `.not` earlier in the chain to negate `.by`. However, it's often best\n * to assert that the subject changed by its expected delta, rather than\n * asserting that it didn't change by one of countless unexpected deltas.\n *\n * var myObj = {val: 1}\n * , addTwo = function () { myObj.val += 2; };\n *\n * // Recommended\n * expect(addTwo).to.increase(myObj, 'val').by(2);\n *\n * // Not recommended\n * expect(addTwo).to.increase(myObj, 'val').but.not.by(3);\n *\n * `.by` accepts an optional `msg` argument which is a custom error message to\n * show when the assertion fails. The message can also be given as the second\n * argument to `expect`.\n *\n * var myObj = {val: 1}\n * , addTwo = function () { myObj.val += 2; };\n *\n * expect(addTwo).to.increase(myObj, 'val').by(3, 'nooo why fail??');\n * expect(addTwo, 'nooo why fail??').to.increase(myObj, 'val').by(3);\n *\n * @name by\n * @param {Number} delta\n * @param {String} msg _optional_\n * @namespace BDD\n * @api public\n */\n\n function assertDelta(delta, msg) {\n if (msg) flag(this, 'message', msg);\n\n var msgObj = flag(this, 'deltaMsgObj');\n var initial = flag(this, 'initialDeltaValue');\n var final = flag(this, 'finalDeltaValue');\n var behavior = flag(this, 'deltaBehavior');\n var realDelta = flag(this, 'realDelta');\n\n var expression;\n if (behavior === 'change') {\n expression = Math.abs(final - initial) === Math.abs(delta);\n } else {\n expression = realDelta === Math.abs(delta);\n }\n\n this.assert(\n expression\n , 'expected ' + msgObj + ' to ' + behavior + ' by ' + delta\n , 'expected ' + msgObj + ' to not ' + behavior + ' by ' + delta\n );\n }\n\n Assertion.addMethod('by', assertDelta);\n\n /**\n * ### .extensible\n *\n * Asserts that the target is extensible, which means that new properties can\n * be added to it. Primitives are never extensible.\n *\n * expect({a: 1}).to.be.extensible;\n *\n * Add `.not` earlier in the chain to negate `.extensible`.\n *\n * var nonExtensibleObject = Object.preventExtensions({})\n * , sealedObject = Object.seal({})\n * , frozenObject = Object.freeze({});\n *\n * expect(nonExtensibleObject).to.not.be.extensible;\n * expect(sealedObject).to.not.be.extensible;\n * expect(frozenObject).to.not.be.extensible;\n * expect(1).to.not.be.extensible;\n *\n * A custom error message can be given as the second argument to `expect`.\n *\n * expect(1, 'nooo why fail??').to.be.extensible;\n *\n * @name extensible\n * @namespace BDD\n * @api public\n */\n\n Assertion.addProperty('extensible', function() {\n var obj = flag(this, 'object');\n\n // In ES5, if the argument to this method is a primitive, then it will cause a TypeError.\n // In ES6, a non-object argument will be treated as if it was a non-extensible ordinary object, simply return false.\n // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/isExtensible\n // The following provides ES6 behavior for ES5 environments.\n\n var isExtensible = obj === Object(obj) && Object.isExtensible(obj);\n\n this.assert(\n isExtensible\n , 'expected #{this} to be extensible'\n , 'expected #{this} to not be extensible'\n );\n });\n\n /**\n * ### .sealed\n *\n * Asserts that the target is sealed, which means that new properties can't be\n * added to it, and its existing properties can't be reconfigured or deleted.\n * However, it's possible that its existing properties can still be reassigned\n * to different values. Primitives are always sealed.\n *\n * var sealedObject = Object.seal({});\n * var frozenObject = Object.freeze({});\n *\n * expect(sealedObject).to.be.sealed;\n * expect(frozenObject).to.be.sealed;\n * expect(1).to.be.sealed;\n *\n * Add `.not` earlier in the chain to negate `.sealed`.\n *\n * expect({a: 1}).to.not.be.sealed;\n *\n * A custom error message can be given as the second argument to `expect`.\n *\n * expect({a: 1}, 'nooo why fail??').to.be.sealed;\n *\n * @name sealed\n * @namespace BDD\n * @api public\n */\n\n Assertion.addProperty('sealed', function() {\n var obj = flag(this, 'object');\n\n // In ES5, if the argument to this method is a primitive, then it will cause a TypeError.\n // In ES6, a non-object argument will be treated as if it was a sealed ordinary object, simply return true.\n // See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/isSealed\n // The following provides ES6 behavior for ES5 environments.\n\n var isSealed = obj === Object(obj) ? Object.isSealed(obj) : true;\n\n this.assert(\n isSealed\n , 'expected #{this} to be sealed'\n , 'expected #{this} to not be sealed'\n );\n });\n\n /**\n * ### .frozen\n *\n * Asserts that the target is frozen, which means that new properties can't be\n * added to it, and its existing properties can't be reassigned to different\n * values, reconfigured, or deleted. Primitives are always frozen.\n *\n * var frozenObject = Object.freeze({});\n *\n * expect(frozenObject).to.be.frozen;\n * expect(1).to.be.frozen;\n *\n * Add `.not` earlier in the chain to negate `.frozen`.\n *\n * expect({a: 1}).to.not.be.frozen;\n *\n * A custom error message can be given as the second argument to `expect`.\n *\n * expect({a: 1}, 'nooo why fail??').to.be.frozen;\n *\n * @name frozen\n * @namespace BDD\n * @api public\n */\n\n Assertion.addProperty('frozen', function() {\n var obj = flag(this, 'object');\n\n // In ES5, if the argument to this method is a primitive, then it will cause a TypeError.\n // In ES6, a non-object argument will be treated as if it was a frozen ordinary object, simply return true.\n // See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/isFrozen\n // The following provides ES6 behavior for ES5 environments.\n\n var isFrozen = obj === Object(obj) ? Object.isFrozen(obj) : true;\n\n this.assert(\n isFrozen\n , 'expected #{this} to be frozen'\n , 'expected #{this} to not be frozen'\n );\n });\n\n /**\n * ### .finite\n *\n * Asserts that the target is a number, and isn't `NaN` or positive/negative\n * `Infinity`.\n *\n * expect(1).to.be.finite;\n *\n * Add `.not` earlier in the chain to negate `.finite`. However, it's\n * dangerous to do so. The problem is that it creates uncertain expectations\n * by asserting that the subject either isn't a number, or that it's `NaN`, or\n * that it's positive `Infinity`, or that it's negative `Infinity`. It's often\n * best to identify the exact output that's expected, and then write an\n * assertion that only accepts that exact output.\n *\n * When the target isn't expected to be a number, it's often best to assert\n * that it's the expected type, rather than asserting that it isn't one of\n * many unexpected types.\n *\n * expect('foo').to.be.a('string'); // Recommended\n * expect('foo').to.not.be.finite; // Not recommended\n *\n * When the target is expected to be `NaN`, it's often best to assert exactly\n * that.\n *\n * expect(NaN).to.be.NaN; // Recommended\n * expect(NaN).to.not.be.finite; // Not recommended\n *\n * When the target is expected to be positive infinity, it's often best to\n * assert exactly that.\n *\n * expect(Infinity).to.equal(Infinity); // Recommended\n * expect(Infinity).to.not.be.finite; // Not recommended\n *\n * When the target is expected to be negative infinity, it's often best to\n * assert exactly that.\n *\n * expect(-Infinity).to.equal(-Infinity); // Recommended\n * expect(-Infinity).to.not.be.finite; // Not recommended\n *\n * A custom error message can be given as the second argument to `expect`.\n *\n * expect('foo', 'nooo why fail??').to.be.finite;\n *\n * @name finite\n * @namespace BDD\n * @api public\n */\n\n Assertion.addProperty('finite', function(msg) {\n var obj = flag(this, 'object');\n\n this.assert(\n typeof obj === \"number\" && isFinite(obj)\n , 'expected #{this} to be a finite number'\n , 'expected #{this} to not be a finite number'\n );\n });\n};\n","/*!\n * chai\n * http://chaijs.com\n * Copyright(c) 2011-2014 Jake Luer <jake@alogicalparadox.com>\n * MIT Licensed\n */\n\nvar config = require('./config');\n\nmodule.exports = function (_chai, util) {\n /*!\n * Module dependencies.\n */\n\n var AssertionError = _chai.AssertionError\n , flag = util.flag;\n\n /*!\n * Module export.\n */\n\n _chai.Assertion = Assertion;\n\n /*!\n * Assertion Constructor\n *\n * Creates object for chaining.\n *\n * `Assertion` objects contain metadata in the form of flags. Three flags can\n * be assigned during instantiation by passing arguments to this constructor:\n *\n * - `object`: This flag contains the target of the assertion. For example, in\n * the assertion `expect(numKittens).to.equal(7);`, the `object` flag will\n * contain `numKittens` so that the `equal` assertion can reference it when\n * needed.\n *\n * - `message`: This flag contains an optional custom error message to be\n * prepended to the error message that's generated by the assertion when it\n * fails.\n *\n * - `ssfi`: This flag stands for \"start stack function indicator\". It\n * contains a function reference that serves as the starting point for\n * removing frames from the stack trace of the error that's created by the\n * assertion when it fails. The goal is to provide a cleaner stack trace to\n * end users by removing Chai's internal functions. Note that it only works\n * in environments that support `Error.captureStackTrace`, and only when\n * `Chai.config.includeStack` hasn't been set to `false`.\n *\n * - `lockSsfi`: This flag controls whether or not the given `ssfi` flag\n * should retain its current value, even as assertions are chained off of\n * this object. This is usually set to `true` when creating a new assertion\n * from within another assertion. It's also temporarily set to `true` before\n * an overwritten assertion gets called by the overwriting assertion.\n *\n * @param {Mixed} obj target of the assertion\n * @param {String} msg (optional) custom error message\n * @param {Function} ssfi (optional) starting point for removing stack frames\n * @param {Boolean} lockSsfi (optional) whether or not the ssfi flag is locked\n * @api private\n */\n\n function Assertion (obj, msg, ssfi, lockSsfi) {\n flag(this, 'ssfi', ssfi || Assertion);\n flag(this, 'lockSsfi', lockSsfi);\n flag(this, 'object', obj);\n flag(this, 'message', msg);\n\n return util.proxify(this);\n }\n\n Object.defineProperty(Assertion, 'includeStack', {\n get: function() {\n console.warn('Assertion.includeStack is deprecated, use chai.config.includeStack instead.');\n return config.includeStack;\n },\n set: function(value) {\n console.warn('Assertion.includeStack is deprecated, use chai.config.includeStack instead.');\n config.includeStack = value;\n }\n });\n\n Object.defineProperty(Assertion, 'showDiff', {\n get: function() {\n console.warn('Assertion.showDiff is deprecated, use chai.config.showDiff instead.');\n return config.showDiff;\n },\n set: function(value) {\n console.warn('Assertion.showDiff is deprecated, use chai.config.showDiff instead.');\n config.showDiff = value;\n }\n });\n\n Assertion.addProperty = function (name, fn) {\n util.addProperty(this.prototype, name, fn);\n };\n\n Assertion.addMethod = function (name, fn) {\n util.addMethod(this.prototype, name, fn);\n };\n\n Assertion.addChainableMethod = function (name, fn, chainingBehavior) {\n util.addChainableMethod(this.prototype, name, fn, chainingBehavior);\n };\n\n Assertion.overwriteProperty = function (name, fn) {\n util.overwriteProperty(this.prototype, name, fn);\n };\n\n Assertion.overwriteMethod = function (name, fn) {\n util.overwriteMethod(this.prototype, name, fn);\n };\n\n Assertion.overwriteChainableMethod = function (name, fn, chainingBehavior) {\n util.overwriteChainableMethod(this.prototype, name, fn, chainingBehavior);\n };\n\n /**\n * ### .assert(expression, message, negateMessage, expected, actual, showDiff)\n *\n * Executes an expression and check expectations. Throws AssertionError for reporting if test doesn't pass.\n *\n * @name assert\n * @param {Philosophical} expression to be tested\n * @param {String|Function} message or function that returns message to display if expression fails\n * @param {String|Function} negatedMessage or function that returns negatedMessage to display if negated expression fails\n * @param {Mixed} expected value (remember to check for negation)\n * @param {Mixed} actual (optional) will default to `this.obj`\n * @param {Boolean} showDiff (optional) when set to `true`, assert will display a diff in addition to the message if expression fails\n * @api private\n */\n\n Assertion.prototype.assert = function (expr, msg, negateMsg, expected, _actual, showDiff) {\n var ok = util.test(this, arguments);\n if (false !== showDiff) showDiff = true;\n if (undefined === expected && undefined === _actual) showDiff = false;\n if (true !== config.showDiff) showDiff = false;\n\n if (!ok) {\n msg = util.getMessage(this, arguments);\n var actual = util.getActual(this, arguments);\n throw new AssertionError(msg, {\n actual: actual\n , expected: expected\n , showDiff: showDiff\n }, (config.includeStack) ? this.assert : flag(this, 'ssfi'));\n }\n };\n\n /*!\n * ### ._obj\n *\n * Quick reference to stored `actual` value for plugin developers.\n *\n * @api private\n */\n\n Object.defineProperty(Assertion.prototype, '_obj',\n { get: function () {\n return flag(this, 'object');\n }\n , set: function (val) {\n flag(this, 'object', val);\n }\n });\n};\n","/*!\n * Chai - isNaN utility\n * Copyright(c) 2012-2015 Sakthipriyan Vairamani <thechargingvolcano@gmail.com>\n * MIT Licensed\n */\n\n/**\n * ### .isNaN(value)\n *\n * Checks if the given value is NaN or not.\n *\n * utils.isNaN(NaN); // true\n *\n * @param {Value} The value which has to be checked if it is NaN\n * @name isNaN\n * @api private\n */\n\nfunction isNaN(value) {\n // Refer http://www.ecma-international.org/ecma-262/6.0/#sec-isnan-number\n // section's NOTE.\n return value !== value;\n}\n\n// If ECMAScript 6's Number.isNaN is present, prefer that.\nmodule.exports = Number.isNaN || isNaN;\n","/*!\n * Chai - getOwnEnumerableProperties utility\n * Copyright(c) 2011-2016 Jake Luer <jake@alogicalparadox.com>\n * MIT Licensed\n */\n\n/*!\n * Module dependancies\n */\n\nvar getOwnEnumerablePropertySymbols = require('./getOwnEnumerablePropertySymbols');\n\n/**\n * ### .getOwnEnumerableProperties(object)\n *\n * This allows the retrieval of directly-owned enumerable property names and\n * symbols of an object. This function is necessary because Object.keys only\n * returns enumerable property names, not enumerable property symbols.\n *\n * @param {Object} object\n * @returns {Array}\n * @namespace Utils\n * @name getOwnEnumerableProperties\n * @api public\n */\n\nmodule.exports = function getOwnEnumerableProperties(obj) {\n return Object.keys(obj).concat(getOwnEnumerablePropertySymbols(obj));\n};\n","/*!\n * Chai - compareByInspect utility\n * Copyright(c) 2011-2016 Jake Luer <jake@alogicalparadox.com>\n * MIT Licensed\n */\n\n/*!\n * Module dependancies\n */\n\nvar inspect = require('./inspect');\n\n/**\n * ### .compareByInspect(mixed, mixed)\n *\n * To be used as a compareFunction with Array.prototype.sort. Compares elements\n * using inspect instead of default behavior of using toString so that Symbols\n * and objects with irregular/missing toString can still be sorted without a\n * TypeError.\n *\n * @param {Mixed} first element to compare\n * @param {Mixed} second element to compare\n * @returns {Number} -1 if 'a' should come before 'b'; otherwise 1 \n * @name compareByInspect\n * @namespace Utils\n * @api public\n */\n\nmodule.exports = function compareByInspect(a, b) {\n return inspect(a) < inspect(b) ? -1 : 1;\n};\n","/*!\n * Chai - overwriteChainableMethod utility\n * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>\n * MIT Licensed\n */\n\nvar chai = require('../../chai');\nvar transferFlags = require('./transferFlags');\n\n/**\n * ### .overwriteChainableMethod(ctx, name, method, chainingBehavior)\n *\n * Overwites an already existing chainable method\n * and provides access to the previous function or\n * property. Must return functions to be used for\n * name.\n *\n * utils.overwriteChainableMethod(chai.Assertion.prototype, 'lengthOf',\n * function (_super) {\n * }\n * , function (_super) {\n * }\n * );\n *\n * Can also be accessed directly from `chai.Assertion`.\n *\n * chai.Assertion.overwriteChainableMethod('foo', fn, fn);\n *\n * Then can be used as any other assertion.\n *\n * expect(myFoo).to.have.lengthOf(3);\n * expect(myFoo).to.have.lengthOf.above(3);\n *\n * @param {Object} ctx object whose method / property is to be overwritten\n * @param {String} name of method / property to overwrite\n * @param {Function} method function that returns a function to be used for name\n * @param {Function} chainingBehavior function that returns a function to be used for property\n * @namespace Utils\n * @name overwriteChainableMethod\n * @api public\n */\n\nmodule.exports = function overwriteChainableMethod(ctx, name, method, chainingBehavior) {\n var chainableBehavior = ctx.__methods[name];\n\n var _chainingBehavior = chainableBehavior.chainingBehavior;\n chainableBehavior.chainingBehavior = function overwritingChainableMethodGetter() {\n var result = chainingBehavior(_chainingBehavior).call(this);\n if (result !== undefined) {\n return result;\n }\n\n var newAssertion = new chai.Assertion();\n transferFlags(this, newAssertion);\n return newAssertion;\n };\n\n var _method = chainableBehavior.method;\n chainableBehavior.method = function overwritingChainableMethodWrapper() {\n var result = method(_method).apply(this, arguments);\n if (result !== undefined) {\n return result;\n }\n\n var newAssertion = new chai.Assertion();\n transferFlags(this, newAssertion);\n return newAssertion;\n };\n};\n","/*!\n * Chai - addChainingMethod utility\n * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>\n * MIT Licensed\n */\n\n/*!\n * Module dependencies\n */\n\nvar addLengthGuard = require('./addLengthGuard');\nvar chai = require('../../chai');\nvar flag = require('./flag');\nvar proxify = require('./proxify');\nvar transferFlags = require('./transferFlags');\n\n/*!\n * Module variables\n */\n\n// Check whether `Object.setPrototypeOf` is supported\nvar canSetPrototype = typeof Object.setPrototypeOf === 'function';\n\n// Without `Object.setPrototypeOf` support, this module will need to add properties to a function.\n// However, some of functions' own props are not configurable and should be skipped.\nvar testFn = function() {};\nvar excludeNames = Object.getOwnPropertyNames(testFn).filter(function(name) {\n var propDesc = Object.getOwnPropertyDescriptor(testFn, name);\n\n // Note: PhantomJS 1.x includes `callee` as one of `testFn`'s own properties,\n // but then returns `undefined` as the property descriptor for `callee`. As a\n // workaround, we perform an otherwise unnecessary type-check for `propDesc`,\n // and then filter it out if it's not an object as it should be.\n if (typeof propDesc !== 'object')\n return true;\n\n return !propDesc.configurable;\n});\n\n// Cache `Function` properties\nvar call = Function.prototype.call,\n apply = Function.prototype.apply;\n\n/**\n * ### .addChainableMethod(ctx, name, method, chainingBehavior)\n *\n * Adds a method to an object, such that the method can also be chained.\n *\n * utils.addChainableMethod(chai.Assertion.prototype, 'foo', function (str) {\n * var obj = utils.flag(this, 'object');\n * new chai.Assertion(obj).to.be.equal(str);\n * });\n *\n * Can also be accessed directly from `chai.Assertion`.\n *\n * chai.Assertion.addChainableMethod('foo', fn, chainingBehavior);\n *\n * The result can then be used as both a method assertion, executing both `method` and\n * `chainingBehavior`, or as a language chain, which only executes `chainingBehavior`.\n *\n * expect(fooStr).to.be.foo('bar');\n * expect(fooStr).to.be.foo.equal('foo');\n *\n * @param {Object} ctx object to which the method is added\n * @param {String} name of method to add\n * @param {Function} method function to be used for `name`, when called\n * @param {Function} chainingBehavior function to be called every time the property is accessed\n * @namespace Utils\n * @name addChainableMethod\n * @api public\n */\n\nmodule.exports = function addChainableMethod(ctx, name, method, chainingBehavior) {\n if (typeof chainingBehavior !== 'function') {\n chainingBehavior = function () { };\n }\n\n var chainableBehavior = {\n method: method\n , chainingBehavior: chainingBehavior\n };\n\n // save the methods so we can overwrite them later, if we need to.\n if (!ctx.__methods) {\n ctx.__methods = {};\n }\n ctx.__methods[name] = chainableBehavior;\n\n Object.defineProperty(ctx, name,\n { get: function chainableMethodGetter() {\n chainableBehavior.chainingBehavior.call(this);\n\n var chainableMethodWrapper = function () {\n // Setting the `ssfi` flag to `chainableMethodWrapper` causes this\n // function to be the starting point for removing implementation\n // frames from the stack trace of a failed assertion.\n //\n // However, we only want to use this function as the starting point if\n // the `lockSsfi` flag isn't set.\n //\n // If the `lockSsfi` flag is set, then this assertion is being\n // invoked from inside of another assertion. In this case, the `ssfi`\n // flag has already been set by the outer assertion.\n //\n // Note that overwriting a chainable method merely replaces the saved\n // methods in `ctx.__methods` instead of completely replacing the\n // overwritten assertion. Therefore, an overwriting assertion won't\n // set the `ssfi` or `lockSsfi` flags.\n if (!flag(this, 'lockSsfi')) {\n flag(this, 'ssfi', chainableMethodWrapper);\n }\n\n var result = chainableBehavior.method.apply(this, arguments);\n if (result !== undefined) {\n return result;\n }\n\n var newAssertion = new chai.Assertion();\n transferFlags(this, newAssertion);\n return newAssertion;\n };\n\n addLengthGuard(chainableMethodWrapper, name, true);\n\n // Use `Object.setPrototypeOf` if available\n if (canSetPrototype) {\n // Inherit all properties from the object by replacing the `Function` prototype\n var prototype = Object.create(this);\n // Restore the `call` and `apply` methods from `Function`\n prototype.call = call;\n prototype.apply = apply;\n Object.setPrototypeOf(chainableMethodWrapper, prototype);\n }\n // Otherwise, redefine all properties (slow!)\n else {\n var asserterNames = Object.getOwnPropertyNames(ctx);\n asserterNames.forEach(function (asserterName) {\n if (excludeNames.indexOf(asserterName) !== -1) {\n return;\n }\n\n var pd = Object.getOwnPropertyDescriptor(ctx, asserterName);\n Object.defineProperty(chainableMethodWrapper, asserterName, pd);\n });\n }\n\n transferFlags(this, chainableMethodWrapper);\n return proxify(chainableMethodWrapper);\n }\n , configurable: true\n });\n};\n","/*!\n * Chai - overwriteMethod utility\n * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>\n * MIT Licensed\n */\n\nvar addLengthGuard = require('./addLengthGuard');\nvar chai = require('../../chai');\nvar flag = require('./flag');\nvar proxify = require('./proxify');\nvar transferFlags = require('./transferFlags');\n\n/**\n * ### .overwriteMethod(ctx, name, fn)\n *\n * Overwites an already existing method and provides\n * access to previous function. Must return function\n * to be used for name.\n *\n * utils.overwriteMethod(chai.Assertion.prototype, 'equal', function (_super) {\n * return function (str) {\n * var obj = utils.flag(this, 'object');\n * if (obj instanceof Foo) {\n * new chai.Assertion(obj.value).to.equal(str);\n * } else {\n * _super.apply(this, arguments);\n * }\n * }\n * });\n *\n * Can also be accessed directly from `chai.Assertion`.\n *\n * chai.Assertion.overwriteMethod('foo', fn);\n *\n * Then can be used as any other assertion.\n *\n * expect(myFoo).to.equal('bar');\n *\n * @param {Object} ctx object whose method is to be overwritten\n * @param {String} name of method to overwrite\n * @param {Function} method function that returns a function to be used for name\n * @namespace Utils\n * @name overwriteMethod\n * @api public\n */\n\nmodule.exports = function overwriteMethod(ctx, name, method) {\n var _method = ctx[name]\n , _super = function () {\n throw new Error(name + ' is not a function');\n };\n\n if (_method && 'function' === typeof _method)\n _super = _method;\n\n var overwritingMethodWrapper = function () {\n // Setting the `ssfi` flag to `overwritingMethodWrapper` causes this\n // function to be the starting point for removing implementation frames from\n // the stack trace of a failed assertion.\n //\n // However, we only want to use this function as the starting point if the\n // `lockSsfi` flag isn't set.\n //\n // If the `lockSsfi` flag is set, then either this assertion has been\n // overwritten by another assertion, or this assertion is being invoked from\n // inside of another assertion. In the first case, the `ssfi` flag has\n // already been set by the overwriting assertion. In the second case, the\n // `ssfi` flag has already been set by the outer assertion.\n if (!flag(this, 'lockSsfi')) {\n flag(this, 'ssfi', overwritingMethodWrapper);\n }\n\n // Setting the `lockSsfi` flag to `true` prevents the overwritten assertion\n // from changing the `ssfi` flag. By this point, the `ssfi` flag is already\n // set to the correct starting point for this assertion.\n var origLockSsfi = flag(this, 'lockSsfi');\n flag(this, 'lockSsfi', true);\n var result = method(_super).apply(this, arguments);\n flag(this, 'lockSsfi', origLockSsfi);\n\n if (result !== undefined) {\n return result;\n }\n\n var newAssertion = new chai.Assertion();\n transferFlags(this, newAssertion);\n return newAssertion;\n }\n\n addLengthGuard(overwritingMethodWrapper, name, false);\n ctx[name] = proxify(overwritingMethodWrapper, name);\n};\n","/*!\n * Chai - overwriteProperty utility\n * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>\n * MIT Licensed\n */\n\nvar chai = require('../../chai');\nvar flag = require('./flag');\nvar isProxyEnabled = require('./isProxyEnabled');\nvar transferFlags = require('./transferFlags');\n\n/**\n * ### .overwriteProperty(ctx, name, fn)\n *\n * Overwites an already existing property getter and provides\n * access to previous value. Must return function to use as getter.\n *\n * utils.overwriteProperty(chai.Assertion.prototype, 'ok', function (_super) {\n * return function () {\n * var obj = utils.flag(this, 'object');\n * if (obj instanceof Foo) {\n * new chai.Assertion(obj.name).to.equal('bar');\n * } else {\n * _super.call(this);\n * }\n * }\n * });\n *\n *\n * Can also be accessed directly from `chai.Assertion`.\n *\n * chai.Assertion.overwriteProperty('foo', fn);\n *\n * Then can be used as any other assertion.\n *\n * expect(myFoo).to.be.ok;\n *\n * @param {Object} ctx object whose property is to be overwritten\n * @param {String} name of property to overwrite\n * @param {Function} getter function that returns a getter function to be used for name\n * @namespace Utils\n * @name overwriteProperty\n * @api public\n */\n\nmodule.exports = function overwriteProperty(ctx, name, getter) {\n var _get = Object.getOwnPropertyDescriptor(ctx, name)\n , _super = function () {};\n\n if (_get && 'function' === typeof _get.get)\n _super = _get.get\n\n Object.defineProperty(ctx, name,\n { get: function overwritingPropertyGetter() {\n // Setting the `ssfi` flag to `overwritingPropertyGetter` causes this\n // function to be the starting point for removing implementation frames\n // from the stack trace of a failed assertion.\n //\n // However, we only want to use this function as the starting point if\n // the `lockSsfi` flag isn't set and proxy protection is disabled.\n //\n // If the `lockSsfi` flag is set, then either this assertion has been\n // overwritten by another assertion, or this assertion is being invoked\n // from inside of another assertion. In the first case, the `ssfi` flag\n // has already been set by the overwriting assertion. In the second\n // case, the `ssfi` flag has already been set by the outer assertion.\n //\n // If proxy protection is enabled, then the `ssfi` flag has already been\n // set by the proxy getter.\n if (!isProxyEnabled() && !flag(this, 'lockSsfi')) {\n flag(this, 'ssfi', overwritingPropertyGetter);\n }\n\n // Setting the `lockSsfi` flag to `true` prevents the overwritten\n // assertion from changing the `ssfi` flag. By this point, the `ssfi`\n // flag is already set to the correct starting point for this assertion.\n var origLockSsfi = flag(this, 'lockSsfi');\n flag(this, 'lockSsfi', true);\n var result = getter(_super).call(this);\n flag(this, 'lockSsfi', origLockSsfi);\n\n if (result !== undefined) {\n return result;\n }\n\n var newAssertion = new chai.Assertion();\n transferFlags(this, newAssertion);\n return newAssertion;\n }\n , configurable: true\n });\n};\n","/*!\n * Chai - addMethod utility\n * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>\n * MIT Licensed\n */\n\nvar addLengthGuard = require('./addLengthGuard');\nvar chai = require('../../chai');\nvar flag = require('./flag');\nvar proxify = require('./proxify');\nvar transferFlags = require('./transferFlags');\n\n/**\n * ### .addMethod(ctx, name, method)\n *\n * Adds a method to the prototype of an object.\n *\n * utils.addMethod(chai.Assertion.prototype, 'foo', function (str) {\n * var obj = utils.flag(this, 'object');\n * new chai.Assertion(obj).to.be.equal(str);\n * });\n *\n * Can also be accessed directly from `chai.Assertion`.\n *\n * chai.Assertion.addMethod('foo', fn);\n *\n * Then can be used as any other assertion.\n *\n * expect(fooStr).to.be.foo('bar');\n *\n * @param {Object} ctx object to which the method is added\n * @param {String} name of method to add\n * @param {Function} method function to be used for name\n * @namespace Utils\n * @name addMethod\n * @api public\n */\n\nmodule.exports = function addMethod(ctx, name, method) {\n var methodWrapper = function () {\n // Setting the `ssfi` flag to `methodWrapper` causes this function to be the\n // starting point for removing implementation frames from the stack trace of\n // a failed assertion.\n //\n // However, we only want to use this function as the starting point if the\n // `lockSsfi` flag isn't set.\n //\n // If the `lockSsfi` flag is set, then either this assertion has been\n // overwritten by another assertion, or this assertion is being invoked from\n // inside of another assertion. In the first case, the `ssfi` flag has\n // already been set by the overwriting assertion. In the second case, the\n // `ssfi` flag has already been set by the outer assertion.\n if (!flag(this, 'lockSsfi')) {\n flag(this, 'ssfi', methodWrapper);\n }\n\n var result = method.apply(this, arguments);\n if (result !== undefined)\n return result;\n\n var newAssertion = new chai.Assertion();\n transferFlags(this, newAssertion);\n return newAssertion;\n };\n\n addLengthGuard(methodWrapper, name, false);\n ctx[name] = proxify(methodWrapper, name);\n};\n","/*!\n * Chai - addProperty utility\n * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>\n * MIT Licensed\n */\n\nvar chai = require('../../chai');\nvar flag = require('./flag');\nvar isProxyEnabled = require('./isProxyEnabled');\nvar transferFlags = require('./transferFlags');\n\n/**\n * ### .addProperty(ctx, name, getter)\n *\n * Adds a property to the prototype of an object.\n *\n * utils.addProperty(chai.Assertion.prototype, 'foo', function () {\n * var obj = utils.flag(this, 'object');\n * new chai.Assertion(obj).to.be.instanceof(Foo);\n * });\n *\n * Can also be accessed directly from `chai.Assertion`.\n *\n * chai.Assertion.addProperty('foo', fn);\n *\n * Then can be used as any other assertion.\n *\n * expect(myFoo).to.be.foo;\n *\n * @param {Object} ctx object to which the property is added\n * @param {String} name of property to add\n * @param {Function} getter function to be used for name\n * @namespace Utils\n * @name addProperty\n * @api public\n */\n\nmodule.exports = function addProperty(ctx, name, getter) {\n getter = getter === undefined ? function () {} : getter;\n\n Object.defineProperty(ctx, name,\n { get: function propertyGetter() {\n // Setting the `ssfi` flag to `propertyGetter` causes this function to\n // be the starting point for removing implementation frames from the\n // stack trace of a failed assertion.\n //\n // However, we only want to use this function as the starting point if\n // the `lockSsfi` flag isn't set and proxy protection is disabled.\n //\n // If the `lockSsfi` flag is set, then either this assertion has been\n // overwritten by another assertion, or this assertion is being invoked\n // from inside of another assertion. In the first case, the `ssfi` flag\n // has already been set by the overwriting assertion. In the second\n // case, the `ssfi` flag has already been set by the outer assertion.\n //\n // If proxy protection is enabled, then the `ssfi` flag has already been\n // set by the proxy getter.\n if (!isProxyEnabled() && !flag(this, 'lockSsfi')) {\n flag(this, 'ssfi', propertyGetter);\n }\n\n var result = getter.call(this);\n if (result !== undefined)\n return result;\n\n var newAssertion = new chai.Assertion();\n transferFlags(this, newAssertion);\n return newAssertion;\n }\n , configurable: true\n });\n};\n","'use strict';\n/* globals Symbol: false, Uint8Array: false, WeakMap: false */\n/*!\n * deep-eql\n * Copyright(c) 2013 Jake Luer <jake@alogicalparadox.com>\n * MIT Licensed\n */\n\nvar type = require('type-detect');\nfunction FakeMap() {\n this._key = 'chai/deep-eql__' + Math.random() + Date.now();\n}\n\nFakeMap.prototype = {\n get: function getMap(key) {\n return key[this._key];\n },\n set: function setMap(key, value) {\n if (Object.isExtensible(key)) {\n Object.defineProperty(key, this._key, {\n value: value,\n configurable: true,\n });\n }\n },\n};\n\nvar MemoizeMap = typeof WeakMap === 'function' ? WeakMap : FakeMap;\n/*!\n * Check to see if the MemoizeMap has recorded a result of the two operands\n *\n * @param {Mixed} leftHandOperand\n * @param {Mixed} rightHandOperand\n * @param {MemoizeMap} memoizeMap\n * @returns {Boolean|null} result\n*/\nfunction memoizeCompare(leftHandOperand, rightHandOperand, memoizeMap) {\n // Technically, WeakMap keys can *only* be objects, not primitives.\n if (!memoizeMap || isPrimitive(leftHandOperand) || isPrimitive(rightHandOperand)) {\n return null;\n }\n var leftHandMap = memoizeMap.get(leftHandOperand);\n if (leftHandMap) {\n var result = leftHandMap.get(rightHandOperand);\n if (typeof result === 'boolean') {\n return result;\n }\n }\n return null;\n}\n\n/*!\n * Set the result of the equality into the MemoizeMap\n *\n * @param {Mixed} leftHandOperand\n * @param {Mixed} rightHandOperand\n * @param {MemoizeMap} memoizeMap\n * @param {Boolean} result\n*/\nfunction memoizeSet(leftHandOperand, rightHandOperand, memoizeMap, result) {\n // Technically, WeakMap keys can *only* be objects, not primitives.\n if (!memoizeMap || isPrimitive(leftHandOperand) || isPrimitive(rightHandOperand)) {\n return;\n }\n var leftHandMap = memoizeMap.get(leftHandOperand);\n if (leftHandMap) {\n leftHandMap.set(rightHandOperand, result);\n } else {\n leftHandMap = new MemoizeMap();\n leftHandMap.set(rightHandOperand, result);\n memoizeMap.set(leftHandOperand, leftHandMap);\n }\n}\n\n/*!\n * Primary Export\n */\n\nmodule.exports = deepEqual;\nmodule.exports.MemoizeMap = MemoizeMap;\n\n/**\n * Assert deeply nested sameValue equality between two objects of any type.\n *\n * @param {Mixed} leftHandOperand\n * @param {Mixed} rightHandOperand\n * @param {Object} [options] (optional) Additional options\n * @param {Array} [options.comparator] (optional) Override default algorithm, determining custom equality.\n * @param {Array} [options.memoize] (optional) Provide a custom memoization object which will cache the results of\n complex objects for a speed boost. By passing `false` you can disable memoization, but this will cause circular\n references to blow the stack.\n * @return {Boolean} equal match\n */\nfunction deepEqual(leftHandOperand, rightHandOperand, options) {\n // If we have a comparator, we can't assume anything; so bail to its check first.\n if (options && options.comparator) {\n return extensiveDeepEqual(leftHandOperand, rightHandOperand, options);\n }\n\n var simpleResult = simpleEqual(leftHandOperand, rightHandOperand);\n if (simpleResult !== null) {\n return simpleResult;\n }\n\n // Deeper comparisons are pushed through to a larger function\n return extensiveDeepEqual(leftHandOperand, rightHandOperand, options);\n}\n\n/**\n * Many comparisons can be canceled out early via simple equality or primitive checks.\n * @param {Mixed} leftHandOperand\n * @param {Mixed} rightHandOperand\n * @return {Boolean|null} equal match\n */\nfunction simpleEqual(leftHandOperand, rightHandOperand) {\n // Equal references (except for Numbers) can be returned early\n if (leftHandOperand === rightHandOperand) {\n // Handle +-0 cases\n return leftHandOperand !== 0 || 1 / leftHandOperand === 1 / rightHandOperand;\n }\n\n // handle NaN cases\n if (\n leftHandOperand !== leftHandOperand && // eslint-disable-line no-self-compare\n rightHandOperand !== rightHandOperand // eslint-disable-line no-self-compare\n ) {\n return true;\n }\n\n // Anything that is not an 'object', i.e. symbols, functions, booleans, numbers,\n // strings, and undefined, can be compared by reference.\n if (isPrimitive(leftHandOperand) || isPrimitive(rightHandOperand)) {\n // Easy out b/c it would have passed the first equality check\n return false;\n }\n return null;\n}\n\n/*!\n * The main logic of the `deepEqual` function.\n *\n * @param {Mixed} leftHandOperand\n * @param {Mixed} rightHandOperand\n * @param {Object} [options] (optional) Additional options\n * @param {Array} [options.comparator] (optional) Override default algorithm, determining custom equality.\n * @param {Array} [options.memoize] (optional) Provide a custom memoization object which will cache the results of\n complex objects for a speed boost. By passing `false` you can disable memoization, but this will cause circular\n references to blow the stack.\n * @return {Boolean} equal match\n*/\nfunction extensiveDeepEqual(leftHandOperand, rightHandOperand, options) {\n options = options || {};\n options.memoize = options.memoize === false ? false : options.memoize || new MemoizeMap();\n var comparator = options && options.comparator;\n\n // Check if a memoized result exists.\n var memoizeResultLeft = memoizeCompare(leftHandOperand, rightHandOperand, options.memoize);\n if (memoizeResultLeft !== null) {\n return memoizeResultLeft;\n }\n var memoizeResultRight = memoizeCompare(rightHandOperand, leftHandOperand, options.memoize);\n if (memoizeResultRight !== null) {\n return memoizeResultRight;\n }\n\n // If a comparator is present, use it.\n if (comparator) {\n var comparatorResult = comparator(leftHandOperand, rightHandOperand);\n // Comparators may return null, in which case we want to go back to default behavior.\n if (comparatorResult === false || comparatorResult === true) {\n memoizeSet(leftHandOperand, rightHandOperand, options.memoize, comparatorResult);\n return comparatorResult;\n }\n // To allow comparators to override *any* behavior, we ran them first. Since it didn't decide\n // what to do, we need to make sure to return the basic tests first before we move on.\n var simpleResult = simpleEqual(leftHandOperand, rightHandOperand);\n if (simpleResult !== null) {\n // Don't memoize this, it takes longer to set/retrieve than to just compare.\n return simpleResult;\n }\n }\n\n var leftHandType = type(leftHandOperand);\n if (leftHandType !== type(rightHandOperand)) {\n memoizeSet(leftHandOperand, rightHandOperand, options.memoize, false);\n return false;\n }\n\n // Temporarily set the operands in the memoize object to prevent blowing the stack\n memoizeSet(leftHandOperand, rightHandOperand, options.memoize, true);\n\n var result = extensiveDeepEqualByType(leftHandOperand, rightHandOperand, leftHandType, options);\n memoizeSet(leftHandOperand, rightHandOperand, options.memoize, result);\n return result;\n}\n\nfunction extensiveDeepEqualByType(leftHandOperand, rightHandOperand, leftHandType, options) {\n switch (leftHandType) {\n case 'String':\n case 'Number':\n case 'Boolean':\n case 'Date':\n // If these types are their instance types (e.g. `new Number`) then re-deepEqual against their values\n return deepEqual(leftHandOperand.valueOf(), rightHandOperand.valueOf());\n case 'Promise':\n case 'Symbol':\n case 'function':\n case 'WeakMap':\n case 'WeakSet':\n case 'Error':\n return leftHandOperand === rightHandOperand;\n case 'Arguments':\n case 'Int8Array':\n case 'Uint8Array':\n case 'Uint8ClampedArray':\n case 'Int16Array':\n case 'Uint16Array':\n case 'Int32Array':\n case 'Uint32Array':\n case 'Float32Array':\n case 'Float64Array':\n case 'Array':\n return iterableEqual(leftHandOperand, rightHandOperand, options);\n case 'RegExp':\n return regexpEqual(leftHandOperand, rightHandOperand);\n case 'Generator':\n return generatorEqual(leftHandOperand, rightHandOperand, options);\n case 'DataView':\n return iterableEqual(new Uint8Array(leftHandOperand.buffer), new Uint8Array(rightHandOperand.buffer), options);\n case 'ArrayBuffer':\n return iterableEqual(new Uint8Array(leftHandOperand), new Uint8Array(rightHandOperand), options);\n case 'Set':\n return entriesEqual(leftHandOperand, rightHandOperand, options);\n case 'Map':\n return entriesEqual(leftHandOperand, rightHandOperand, options);\n default:\n return objectEqual(leftHandOperand, rightHandOperand, options);\n }\n}\n\n/*!\n * Compare two Regular Expressions for equality.\n *\n * @param {RegExp} leftHandOperand\n * @param {RegExp} rightHandOperand\n * @return {Boolean} result\n */\n\nfunction regexpEqual(leftHandOperand, rightHandOperand) {\n return leftHandOperand.toString() === rightHandOperand.toString();\n}\n\n/*!\n * Compare two Sets/Maps for equality. Faster than other equality functions.\n *\n * @param {Set} leftHandOperand\n * @param {Set} rightHandOperand\n * @param {Object} [options] (Optional)\n * @return {Boolean} result\n */\n\nfunction entriesEqual(leftHandOperand, rightHandOperand, options) {\n // IE11 doesn't support Set#entries or Set#@@iterator, so we need manually populate using Set#forEach\n if (leftHandOperand.size !== rightHandOperand.size) {\n return false;\n }\n if (leftHandOperand.size === 0) {\n return true;\n }\n var leftHandItems = [];\n var rightHandItems = [];\n leftHandOperand.forEach(function gatherEntries(key, value) {\n leftHandItems.push([ key, value ]);\n });\n rightHandOperand.forEach(function gatherEntries(key, value) {\n rightHandItems.push([ key, value ]);\n });\n return iterableEqual(leftHandItems.sort(), rightHandItems.sort(), options);\n}\n\n/*!\n * Simple equality for flat iterable objects such as Arrays, TypedArrays or Node.js buffers.\n *\n * @param {Iterable} leftHandOperand\n * @param {Iterable} rightHandOperand\n * @param {Object} [options] (Optional)\n * @return {Boolean} result\n */\n\nfunction iterableEqual(leftHandOperand, rightHandOperand, options) {\n var length = leftHandOperand.length;\n if (length !== rightHandOperand.length) {\n return false;\n }\n if (length === 0) {\n return true;\n }\n var index = -1;\n while (++index < length) {\n if (deepEqual(leftHandOperand[index], rightHandOperand[index], options) === false) {\n return false;\n }\n }\n return true;\n}\n\n/*!\n * Simple equality for generator objects such as those returned by generator functions.\n *\n * @param {Iterable} leftHandOperand\n * @param {Iterable} rightHandOperand\n * @param {Object} [options] (Optional)\n * @return {Boolean} result\n */\n\nfunction generatorEqual(leftHandOperand, rightHandOperand, options) {\n return iterableEqual(getGeneratorEntries(leftHandOperand), getGeneratorEntries(rightHandOperand), options);\n}\n\n/*!\n * Determine if the given object has an @@iterator function.\n *\n * @param {Object} target\n * @return {Boolean} `true` if the object has an @@iterator function.\n */\nfunction hasIteratorFunction(target) {\n return typeof Symbol !== 'undefined' &&\n typeof target === 'object' &&\n typeof Symbol.iterator !== 'undefined' &&\n typeof target[Symbol.iterator] === 'function';\n}\n\n/*!\n * Gets all iterator entries from the given Object. If the Object has no @@iterator function, returns an empty array.\n * This will consume the iterator - which could have side effects depending on the @@iterator implementation.\n *\n * @param {Object} target\n * @returns {Array} an array of entries from the @@iterator function\n */\nfunction getIteratorEntries(target) {\n if (hasIteratorFunction(target)) {\n try {\n return getGeneratorEntries(target[Symbol.iterator]());\n } catch (iteratorError) {\n return [];\n }\n }\n return [];\n}\n\n/*!\n * Gets all entries from a Generator. This will consume the generator - which could have side effects.\n *\n * @param {Generator} target\n * @returns {Array} an array of entries from the Generator.\n */\nfunction getGeneratorEntries(generator) {\n var generatorResult = generator.next();\n var accumulator = [ generatorResult.value ];\n while (generatorResult.done === false) {\n generatorResult = generator.next();\n accumulator.push(generatorResult.value);\n }\n return accumulator;\n}\n\n/*!\n * Gets all own and inherited enumerable keys from a target.\n *\n * @param {Object} target\n * @returns {Array} an array of own and inherited enumerable keys from the target.\n */\nfunction getEnumerableKeys(target) {\n var keys = [];\n for (var key in target) {\n keys.push(key);\n }\n return keys;\n}\n\n/*!\n * Determines if two objects have matching values, given a set of keys. Defers to deepEqual for the equality check of\n * each key. If any value of the given key is not equal, the function will return false (early).\n *\n * @param {Mixed} leftHandOperand\n * @param {Mixed} rightHandOperand\n * @param {Array} keys An array of keys to compare the values of leftHandOperand and rightHandOperand against\n * @param {Object} [options] (Optional)\n * @return {Boolean} result\n */\nfunction keysEqual(leftHandOperand, rightHandOperand, keys, options) {\n var length = keys.length;\n if (length === 0) {\n return true;\n }\n for (var i = 0; i < length; i += 1) {\n if (deepEqual(leftHandOperand[keys[i]], rightHandOperand[keys[i]], options) === false) {\n return false;\n }\n }\n return true;\n}\n\n/*!\n * Recursively check the equality of two Objects. Once basic sameness has been established it will defer to `deepEqual`\n * for each enumerable key in the object.\n *\n * @param {Mixed} leftHandOperand\n * @param {Mixed} rightHandOperand\n * @param {Object} [options] (Optional)\n * @return {Boolean} result\n */\n\nfunction objectEqual(leftHandOperand, rightHandOperand, options) {\n var leftHandKeys = getEnumerableKeys(leftHandOperand);\n var rightHandKeys = getEnumerableKeys(rightHandOperand);\n if (leftHandKeys.length && leftHandKeys.length === rightHandKeys.length) {\n leftHandKeys.sort();\n rightHandKeys.sort();\n if (iterableEqual(leftHandKeys, rightHandKeys) === false) {\n return false;\n }\n return keysEqual(leftHandOperand, rightHandOperand, leftHandKeys, options);\n }\n\n var leftHandEntries = getIteratorEntries(leftHandOperand);\n var rightHandEntries = getIteratorEntries(rightHandOperand);\n if (leftHandEntries.length && leftHandEntries.length === rightHandEntries.length) {\n leftHandEntries.sort();\n rightHandEntries.sort();\n return iterableEqual(leftHandEntries, rightHandEntries, options);\n }\n\n if (leftHandKeys.length === 0 &&\n leftHandEntries.length === 0 &&\n rightHandKeys.length === 0 &&\n rightHandEntries.length === 0) {\n return true;\n }\n\n return false;\n}\n\n/*!\n * Returns true if the argument is a primitive.\n *\n * This intentionally returns true for all objects that can be compared by reference,\n * including functions and symbols.\n *\n * @param {Mixed} value\n * @return {Boolean} result\n */\nfunction isPrimitive(value) {\n return value === null || typeof value !== 'object';\n}\n","/*!\n * Chai - getEnumerableProperties utility\n * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>\n * MIT Licensed\n */\n\n/**\n * ### .getEnumerableProperties(object)\n *\n * This allows the retrieval of enumerable property names of an object,\n * inherited or not.\n *\n * @param {Object} object\n * @returns {Array}\n * @namespace Utils\n * @name getEnumerableProperties\n * @api public\n */\n\nmodule.exports = function getEnumerableProperties(object) {\n var result = [];\n for (var name in object) {\n result.push(name);\n }\n return result;\n};\n","/*!\n * Chai - message composition utility\n * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>\n * MIT Licensed\n */\n\n/*!\n * Module dependancies\n */\n\nvar flag = require('./flag')\n , getActual = require('./getActual')\n , inspect = require('./inspect')\n , objDisplay = require('./objDisplay');\n\n/**\n * ### .getMessage(object, message, negateMessage)\n *\n * Construct the error message based on flags\n * and template tags. Template tags will return\n * a stringified inspection of the object referenced.\n *\n * Message template tags:\n * - `#{this}` current asserted object\n * - `#{act}` actual value\n * - `#{exp}` expected value\n *\n * @param {Object} object (constructed Assertion)\n * @param {Arguments} chai.Assertion.prototype.assert arguments\n * @namespace Utils\n * @name getMessage\n * @api public\n */\n\nmodule.exports = function getMessage(obj, args) {\n var negate = flag(obj, 'negate')\n , val = flag(obj, 'object')\n , expected = args[3]\n , actual = getActual(obj, args)\n , msg = negate ? args[2] : args[1]\n , flagMsg = flag(obj, 'message');\n\n if(typeof msg === \"function\") msg = msg();\n msg = msg || '';\n msg = msg\n .replace(/#\\{this\\}/g, function () { return objDisplay(val); })\n .replace(/#\\{act\\}/g, function () { return objDisplay(actual); })\n .replace(/#\\{exp\\}/g, function () { return objDisplay(expected); });\n\n return flagMsg ? flagMsg + ': ' + msg : msg;\n};\n","/*!\n * Chai - expectTypes utility\n * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>\n * MIT Licensed\n */\n\n/**\n * ### .expectTypes(obj, types)\n *\n * Ensures that the object being tested against is of a valid type.\n *\n * utils.expectTypes(this, ['array', 'object', 'string']);\n *\n * @param {Mixed} obj constructed Assertion\n * @param {Array} type A list of allowed types for this assertion\n * @namespace Utils\n * @name expectTypes\n * @api public\n */\n\nvar AssertionError = require('assertion-error');\nvar flag = require('./flag');\nvar type = require('type-detect');\n\nmodule.exports = function expectTypes(obj, types) {\n var flagMsg = flag(obj, 'message');\n var ssfi = flag(obj, 'ssfi');\n\n flagMsg = flagMsg ? flagMsg + ': ' : '';\n\n obj = flag(obj, 'object');\n types = types.map(function (t) { return t.toLowerCase(); });\n types.sort();\n\n // Transforms ['lorem', 'ipsum'] into 'a lorem, or an ipsum'\n var str = types.map(function (t, index) {\n var art = ~[ 'a', 'e', 'i', 'o', 'u' ].indexOf(t.charAt(0)) ? 'an' : 'a';\n var or = types.length > 1 && index === types.length - 1 ? 'or ' : '';\n return or + art + ' ' + t;\n }).join(', ');\n\n var objType = type(obj).toLowerCase();\n\n if (!types.some(function (expected) { return objType === expected; })) {\n throw new AssertionError(\n flagMsg + 'object tested must be ' + str + ', but ' + objType + ' given',\n undefined,\n ssfi\n );\n }\n};\n","/*!\n * Chai - test utility\n * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>\n * MIT Licensed\n */\n\n/*!\n * Module dependancies\n */\n\nvar flag = require('./flag');\n\n/**\n * ### .test(object, expression)\n *\n * Test and object for expression.\n *\n * @param {Object} object (constructed Assertion)\n * @param {Arguments} chai.Assertion.prototype.assert arguments\n * @namespace Utils\n * @name test\n */\n\nmodule.exports = function test(obj, args) {\n var negate = flag(obj, 'negate')\n , expr = args[0];\n return negate ? !expr : expr;\n};\n","'use strict';\n\n/* !\n * Chai - pathval utility\n * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>\n * @see https://github.com/logicalparadox/filtr\n * MIT Licensed\n */\n\n/**\n * ### .hasProperty(object, name)\n *\n * This allows checking whether an object has own\n * or inherited from prototype chain named property.\n *\n * Basically does the same thing as the `in`\n * operator but works properly with null/undefined values\n * and other primitives.\n *\n * var obj = {\n * arr: ['a', 'b', 'c']\n * , str: 'Hello'\n * }\n *\n * The following would be the results.\n *\n * hasProperty(obj, 'str'); // true\n * hasProperty(obj, 'constructor'); // true\n * hasProperty(obj, 'bar'); // false\n *\n * hasProperty(obj.str, 'length'); // true\n * hasProperty(obj.str, 1); // true\n * hasProperty(obj.str, 5); // false\n *\n * hasProperty(obj.arr, 'length'); // true\n * hasProperty(obj.arr, 2); // true\n * hasProperty(obj.arr, 3); // false\n *\n * @param {Object} object\n * @param {String|Symbol} name\n * @returns {Boolean} whether it exists\n * @namespace Utils\n * @name hasProperty\n * @api public\n */\n\nfunction hasProperty(obj, name) {\n if (typeof obj === 'undefined' || obj === null) {\n return false;\n }\n\n // The `in` operator does not work with primitives.\n return name in Object(obj);\n}\n\n/* !\n * ## parsePath(path)\n *\n * Helper function used to parse string object\n * paths. Use in conjunction with `internalGetPathValue`.\n *\n * var parsed = parsePath('myobject.property.subprop');\n *\n * ### Paths:\n *\n * * Can be infinitely deep and nested.\n * * Arrays are also valid using the formal `myobject.document[3].property`.\n * * Literal dots and brackets (not delimiter) must be backslash-escaped.\n *\n * @param {String} path\n * @returns {Object} parsed\n * @api private\n */\n\nfunction parsePath(path) {\n var str = path.replace(/([^\\\\])\\[/g, '$1.[');\n var parts = str.match(/(\\\\\\.|[^.]+?)+/g);\n return parts.map(function mapMatches(value) {\n var regexp = /^\\[(\\d+)\\]$/;\n var mArr = regexp.exec(value);\n var parsed = null;\n if (mArr) {\n parsed = { i: parseFloat(mArr[1]) };\n } else {\n parsed = { p: value.replace(/\\\\([.\\[\\]])/g, '$1') };\n }\n\n return parsed;\n });\n}\n\n/* !\n * ## internalGetPathValue(obj, parsed[, pathDepth])\n *\n * Helper companion function for `.parsePath` that returns\n * the value located at the parsed address.\n *\n * var value = getPathValue(obj, parsed);\n *\n * @param {Object} object to search against\n * @param {Object} parsed definition from `parsePath`.\n * @param {Number} depth (nesting level) of the property we want to retrieve\n * @returns {Object|Undefined} value\n * @api private\n */\n\nfunction internalGetPathValue(obj, parsed, pathDepth) {\n var temporaryValue = obj;\n var res = null;\n pathDepth = (typeof pathDepth === 'undefined' ? parsed.length : pathDepth);\n\n for (var i = 0; i < pathDepth; i++) {\n var part = parsed[i];\n if (temporaryValue) {\n if (typeof part.p === 'undefined') {\n temporaryValue = temporaryValue[part.i];\n } else {\n temporaryValue = temporaryValue[part.p];\n }\n\n if (i === (pathDepth - 1)) {\n res = temporaryValue;\n }\n }\n }\n\n return res;\n}\n\n/* !\n * ## internalSetPathValue(obj, value, parsed)\n *\n * Companion function for `parsePath` that sets\n * the value located at a parsed address.\n *\n * internalSetPathValue(obj, 'value', parsed);\n *\n * @param {Object} object to search and define on\n * @param {*} value to use upon set\n * @param {Object} parsed definition from `parsePath`\n * @api private\n */\n\nfunction internalSetPathValue(obj, val, parsed) {\n var tempObj = obj;\n var pathDepth = parsed.length;\n var part = null;\n // Here we iterate through every part of the path\n for (var i = 0; i < pathDepth; i++) {\n var propName = null;\n var propVal = null;\n part = parsed[i];\n\n // If it's the last part of the path, we set the 'propName' value with the property name\n if (i === (pathDepth - 1)) {\n propName = typeof part.p === 'undefined' ? part.i : part.p;\n // Now we set the property with the name held by 'propName' on object with the desired val\n tempObj[propName] = val;\n } else if (typeof part.p !== 'undefined' && tempObj[part.p]) {\n tempObj = tempObj[part.p];\n } else if (typeof part.i !== 'undefined' && tempObj[part.i]) {\n tempObj = tempObj[part.i];\n } else {\n // If the obj doesn't have the property we create one with that name to define it\n var next = parsed[i + 1];\n // Here we set the name of the property which will be defined\n propName = typeof part.p === 'undefined' ? part.i : part.p;\n // Here we decide if this property will be an array or a new object\n propVal = typeof next.p === 'undefined' ? [] : {};\n tempObj[propName] = propVal;\n tempObj = tempObj[propName];\n }\n }\n}\n\n/**\n * ### .getPathInfo(object, path)\n *\n * This allows the retrieval of property info in an\n * object given a string path.\n *\n * The path info consists of an object with the\n * following properties:\n *\n * * parent - The parent object of the property referenced by `path`\n * * name - The name of the final property, a number if it was an array indexer\n * * value - The value of the property, if it exists, otherwise `undefined`\n * * exists - Whether the property exists or not\n *\n * @param {Object} object\n * @param {String} path\n * @returns {Object} info\n * @namespace Utils\n * @name getPathInfo\n * @api public\n */\n\nfunction getPathInfo(obj, path) {\n var parsed = parsePath(path);\n var last = parsed[parsed.length - 1];\n var info = {\n parent: parsed.length > 1 ? internalGetPathValue(obj, parsed, parsed.length - 1) : obj,\n name: last.p || last.i,\n value: internalGetPathValue(obj, parsed),\n };\n info.exists = hasProperty(info.parent, info.name);\n\n return info;\n}\n\n/**\n * ### .getPathValue(object, path)\n *\n * This allows the retrieval of values in an\n * object given a string path.\n *\n * var obj = {\n * prop1: {\n * arr: ['a', 'b', 'c']\n * , str: 'Hello'\n * }\n * , prop2: {\n * arr: [ { nested: 'Universe' } ]\n * , str: 'Hello again!'\n * }\n * }\n *\n * The following would be the results.\n *\n * getPathValue(obj, 'prop1.str'); // Hello\n * getPathValue(obj, 'prop1.att[2]'); // b\n * getPathValue(obj, 'prop2.arr[0].nested'); // Universe\n *\n * @param {Object} object\n * @param {String} path\n * @returns {Object} value or `undefined`\n * @namespace Utils\n * @name getPathValue\n * @api public\n */\n\nfunction getPathValue(obj, path) {\n var info = getPathInfo(obj, path);\n return info.value;\n}\n\n/**\n * ### .setPathValue(object, path, value)\n *\n * Define the value in an object at a given string path.\n *\n * ```js\n * var obj = {\n * prop1: {\n * arr: ['a', 'b', 'c']\n * , str: 'Hello'\n * }\n * , prop2: {\n * arr: [ { nested: 'Universe' } ]\n * , str: 'Hello again!'\n * }\n * };\n * ```\n *\n * The following would be acceptable.\n *\n * ```js\n * var properties = require('tea-properties');\n * properties.set(obj, 'prop1.str', 'Hello Universe!');\n * properties.set(obj, 'prop1.arr[2]', 'B');\n * properties.set(obj, 'prop2.arr[0].nested.value', { hello: 'universe' });\n * ```\n *\n * @param {Object} object\n * @param {String} path\n * @param {Mixed} value\n * @api private\n */\n\nfunction setPathValue(obj, path, val) {\n var parsed = parsePath(path);\n internalSetPathValue(obj, val, parsed);\n return obj;\n}\n\nmodule.exports = {\n hasProperty: hasProperty,\n getPathInfo: getPathInfo,\n getPathValue: getPathValue,\n setPathValue: setPathValue,\n};\n","/*!\n * chai\n * Copyright(c) 2011 Jake Luer <jake@alogicalparadox.com>\n * MIT Licensed\n */\n\n/*!\n * Dependencies that are used for multiple exports are required here only once\n */\n\nvar pathval = require('pathval');\n\n/*!\n * test utility\n */\n\nexports.test = require('./test');\n\n/*!\n * type utility\n */\n\nexports.type = require('type-detect');\n\n/*!\n * expectTypes utility\n */\nexports.expectTypes = require('./expectTypes');\n\n/*!\n * message utility\n */\n\nexports.getMessage = require('./getMessage');\n\n/*!\n * actual utility\n */\n\nexports.getActual = require('./getActual');\n\n/*!\n * Inspect util\n */\n\nexports.inspect = require('./inspect');\n\n/*!\n * Object Display util\n */\n\nexports.objDisplay = require('./objDisplay');\n\n/*!\n * Flag utility\n */\n\nexports.flag = require('./flag');\n\n/*!\n * Flag transferring utility\n */\n\nexports.transferFlags = require('./transferFlags');\n\n/*!\n * Deep equal utility\n */\n\nexports.eql = require('deep-eql');\n\n/*!\n * Deep path info\n */\n\nexports.getPathInfo = pathval.getPathInfo;\n\n/*!\n * Check if a property exists\n */\n\nexports.hasProperty = pathval.hasProperty;\n\n/*!\n * Function name\n */\n\nexports.getName = require('get-func-name');\n\n/*!\n * add Property\n */\n\nexports.addProperty = require('./addProperty');\n\n/*!\n * add Method\n */\n\nexports.addMethod = require('./addMethod');\n\n/*!\n * overwrite Property\n */\n\nexports.overwriteProperty = require('./overwriteProperty');\n\n/*!\n * overwrite Method\n */\n\nexports.overwriteMethod = require('./overwriteMethod');\n\n/*!\n * Add a chainable method\n */\n\nexports.addChainableMethod = require('./addChainableMethod');\n\n/*!\n * Overwrite chainable method\n */\n\nexports.overwriteChainableMethod = require('./overwriteChainableMethod');\n\n/*!\n * Compare by inspect method\n */\n\nexports.compareByInspect = require('./compareByInspect');\n\n/*!\n * Get own enumerable property symbols method\n */\n\nexports.getOwnEnumerablePropertySymbols = require('./getOwnEnumerablePropertySymbols');\n\n/*!\n * Get own enumerable properties method\n */\n\nexports.getOwnEnumerableProperties = require('./getOwnEnumerableProperties');\n\n/*!\n * Checks error against a given set of criteria\n */\n\nexports.checkError = require('check-error');\n\n/*!\n * Proxify util\n */\n\nexports.proxify = require('./proxify');\n\n/*!\n * addLengthGuard util\n */\n\nexports.addLengthGuard = require('./addLengthGuard');\n\n/*!\n * isProxyEnabled helper\n */\n\nexports.isProxyEnabled = require('./isProxyEnabled');\n\n/*!\n * isNaN method\n */\n\nexports.isNaN = require('./isNaN');\n","module.exports = require('./lib/chai');\n","import {executeJSScript} from \"../src/NetscriptJSEvaluator.js\";\r\nimport {WorkerScript} from \"../src/NetscriptWorker.js\";\r\n\r\nconst chai = require(\"chai\");\r\nconst chaiAsPromised = require(\"chai-as-promised\");\r\nchai.should();\r\nchai.use(chaiAsPromised);\r\n\r\nconsole.info('asdf');\r\n\r\ndescribe('NSJS ScriptStore', function() {\r\n it('should run an imported function', async function() {\r\n const s = { filename: \"\", code: \"export function main() { return 2; }\", args:[]};\r\n const worker = new WorkerScript(s);\r\n chai.expect(await executeJSScript([], s)).to.equal(2);\r\n });\r\n\r\n /*\r\n it('should handle recursive imports', async function() {\r\n const s1 = { filename: \"s1.js\", code: \"export function iAmRecursiveImport(x) { return x + 2; }\" };\r\n const s2 = { filename: \"\", code: `\r\n import {iAmRecursiveImport} from \\\"s1.js\\\";\r\n export function main() { return iAmRecursiveImport(3);\r\n }`};\r\n chai.expect(await executeJSScript([s1, s2], s2)).to.equal(5);\r\n });\r\n\r\n it (`should correctly reference the passed global env`, async function() {\r\n var [x, y] = [0, 0];\r\n var env = {\r\n updateX: function(value) { x = value; },\r\n updateY: function(value) { y = value; },\r\n };\r\n const s1 = {filename: \"s1.js\", code: \"export function importedFn(x) { updateX(x); }\"};\r\n const s2 = {filename: \"s2.js\", code: `\r\n import {importedFn} from \"s1.js\";\r\n export function main() { updateY(7); importedFn(3); }\r\n `}\r\n await executeJSScript(s2, [s1, s2], env);\r\n chai.expect(y).to.equal(7);\r\n chai.expect(x).to.equal(3);\r\n });\r\n\r\n it (`should throw on circular dep`, async function() {\r\n const s1 = {filename: \"s1.js\", code: \"import \\\"s2.js\\\"\"};\r\n const s2 = {filename: \"s2.js\", code: `\r\n import * as s1 from \"s1.js\";\r\n export function main() {}\r\n `}\r\n executeJSScript(s2, [s1, s2]).should.eventually.throw();\r\n });*/\r\n});\r\n","//require(\"babel-core/register\");\r\n//require(\"babel-polyfill\");\r\nmodule.exports = require(\"./NetscriptJSTest.js\");\r\n"],"sourceRoot":""}