From 870e535600a5979c897933aa7775e0e73f92f62f Mon Sep 17 00:00:00 2001 From: Nicolas Rannou Date: Tue, 25 Oct 2016 12:46:58 +0200 Subject: [PATCH 01/19] Delete gulpfile.js --- gulpfile.js | 308 ---------------------------------------------------- 1 file changed, 308 deletions(-) delete mode 100644 gulpfile.js diff --git a/gulpfile.js b/gulpfile.js deleted file mode 100644 index a8056e248..000000000 --- a/gulpfile.js +++ /dev/null @@ -1,308 +0,0 @@ -'use strict'; - -// include gulp and tools -var gulp = require('gulp'); -var $ = require('gulp-load-plugins')(); -var exec = require('child_process').exec; -var browserSync = require('browser-sync'); -var reload = browserSync.reload; -var del = require('del'); -var runSequence = require('run-sequence'); -var es = require('event-stream'); -var browserify = require('browserify'); -var source = require('vinyl-source-stream'); -var buffer = require('vinyl-buffer'); -var sourcemaps = require('gulp-sourcemaps'); -var gutil = require('gulp-util'); -var glslify = require('glslify'); -var babelify = require('babelify'); -//var minifyify = require('minifyify'); -//var uglify = require('gulp-uglify'); -var globby = require('globby'); -var argv = require('yargs').argv; -var karma = require('karma'); -var eslint = require('gulp-eslint'); -var watchify = require('watchify'); -//var rename = require('gulp-rename'); - -var VERSION = 'v0.0.9-dev'; - -var target = 'examples/**/*.js'; - -// Clean output directories -gulp.task('clean', del.bind(null, ['gh-pages', '.tmp'])); - -// Copy (data) task -// Copy task -gulp.task('copy', function() { - var dcm = gulp.src(['data/dicom/**/*']) // dicom data used in demos - .pipe(gulp.dest('gh-pages/data/dicom')); - - var nii = gulp.src(['data/nifti/**/*']) // nifti data used in demos - .pipe(gulp.dest('gh-pages/data/nifti')); - - var nrrd = gulp.src(['data/nrrd/**/*']) // nifti data used in demos - .pipe(gulp.dest('gh-pages/data/nrrd')); - - var vtk = gulp.src(['data/vtk/**/*']) // nifti data used in demos - .pipe(gulp.dest('gh-pages/data/vtk')); - - var assets = gulp.src(['favicon.ico']) // fav icon for github page - .pipe(gulp.dest('gh-pages')); - - return es.merge(dcm, assets) - .pipe($.size({title: 'copy'})); -}); - -// HTML task -gulp.task('html', function() { - return gulp.src([ - '**/*.html', - '!bower_components{,/**}', - '!node_modules{,/**}', - '!test{,/**}', - '!gh-pages{,/**}', - '!deprecated{,/**}' - ]) - .pipe(gulp.dest('gh-pages')) - .pipe($.size({title: 'html'})); -}); - -// CSS task -gulp.task('css', function() { - return gulp.src([ - 'examples/**/*.css' - ]) - .pipe(gulp.dest('gh-pages/examples')) - .pipe($.size({title: 'css'})); -}); - -// JS examples task -gulp.task('js-examples', function(cb) { - // process files of interest - var keys = Object.keys(argv); - if(keys.length === 3){ - target = 'examples/' + Object.keys(argv)[1] + '/*.js'; - } - - globby([target], function(err, files) { - if (err) { - cb(err); - } - var tasks = files.map(function(entry) { - // to remove /app layer - var index = entry.indexOf('/'); - return browserify( - {entries: [entry], - debug: true - }) - .transform(babelify) - .transform(glslify) - .bundle() - .pipe(source(entry.substring(index + 1))) - .pipe(buffer()) - .pipe(sourcemaps.init({loadMaps: true})) - .on('error', gutil.log) - .pipe(sourcemaps.write('./')) - .pipe(gulp.dest('gh-pages/examples')); - }); - - // create a merged stream - es.merge(tasks).on('end', cb); - }); -}); - -gulp.task('js-examples-watchify', function(cb) { - // process files of interest - var keys = Object.keys(argv); - if(keys.length === 3){ - target = 'examples/' + Object.keys(argv)[1] + '/*.js'; - } - globby([target], function(err, files) { - if (err) { - cb(err); - } - var tasks = files.map(function(entry) { - // to remove /app layer - var index = entry.indexOf('/'); - - var b = browserify( - {entries: [entry], - debug: true, - cache: {}, - packageCache: {}, - plugin: [watchify] - }) - .transform(babelify) - .transform(glslify); - - b.on('update', bundle); - b.on('log', gutil.log); - - function bundle() { - return b.bundle() - .pipe(source(entry.substring(index + 1))) - .pipe(buffer()) - .pipe(sourcemaps.init({loadMaps: true})) - .on('error', gutil.log) - .pipe(sourcemaps.write('./')) - .pipe(gulp.dest('gh-pages/examples')) - .pipe(reload({stream: true, once: true}));; - } - - return bundle(); - }); - // create a merged stream - es.merge(tasks).on('end', cb); - }); -}); - -gulp.task('build', function(cb) { - // process files of interest - globby(['src/ami.js'], function(err, files) { - if (err) { - cb(err); - } - - var tasks = files.map(function(entry) { - // to remove /app layer - var index = entry.indexOf('/'); - return browserify( - {entries: [entry], - debug: true, - standalone: 'AMI' - }) - //.plugin('minifyify', { - // output: 'dist/ami.js.map', - // map: 'ami.js.map' - // }) - .transform(babelify, { - presets: ['es2015'], - ignore: ['external/**/*']}) - .transform(glslify) - .bundle() - .pipe(source(entry.substring(index + 1))) - .pipe(buffer()) - .pipe(sourcemaps.init({loadMaps: true})) - // .pipe(uglify()) - .on('error', gutil.log) - .pipe(sourcemaps.write('./')) - //.pipe(rename('ami.min.js')) - .pipe(gulp.dest('dist')); - }); - - // create a merged stream - es.merge(tasks).on('end', cb); - }); -}); - - -// Documentation task with JSDoc -gulp.task('doc', function(done) { - var cmd = ''; - if (process.platform === 'win32') { - cmd = 'node_modules\\.bin\\jsdoc -p -r -R README.md -c jsdoc.conf -t node_modules\\minami -d gh-pages\\doc src'; - }else { - cmd = 'node_modules/.bin/jsdoc -p -r -R README.md -c jsdoc.conf -t node_modules/minami -d gh-pages/doc src'; - } - exec(cmd, function(e, stdout) { - gutil.log(stdout); - done(); - }); -}); - -// Test task with Karma+Jasmine -gulp.task('test', function(done) { - var server = new karma.Server({ - configFile: __dirname + '/karma.conf.js', - reporters: ['spec'], - singleRun: true, - autoWatch: false - }, done); - - server.start(); -}); - -// Lint js -gulp.task('lint', function() { - return gulp.src([ - 'src/**/*.js', - 'examples/**/*.js', - '!src/controls/**/*', - '!src/parsers/jpx.js', - '!src/parsers/jpeg.js' - ]) - .pipe(eslint()) - .pipe(eslint.format()); - //.pipe(eslint.failAfterError()); -}); - -// no test anymore... too slow... -gulp.task('js-watch', ['lint']); -gulp.task('html-watch', ['html'], reload); -gulp.task('css-watch', ['css'], reload); - -gulp.task('browsersync', function(){ - // gh-pages mode, no route to web components - browserSync({ - server: { - baseDir: ['gh-pages'] - } - }); - - gulp.watch(['src/**/*.js', 'examples/**/*.js'], ['js-watch']); - gulp.watch(['index.html', 'examples/**/*.html'], ['html-watch']); - gulp.watch(['examples/**/*.css'], ['css-watch']); -}); - -gulp.task('lessons', function(){ - var keys = Object.keys(argv); - var lesson = ''; - if(keys.length === 3){ - lesson = Object.keys(argv)[1]; - } - - // gh-pages mode, no route to web components - browserSync({ - server: { - baseDir: ['./lessons/' + lesson, '.'] - } - }); - - gulp.watch(['src/**/*.js', 'lessons/**/*.js'], ['js-watch', browserSync.reload]); - gulp.watch(['src/**/*.js'], ['build', browserSync.reload]); - gulp.watch(['lessons/**/*.html'], ['html-watch', browserSync.reload]); - gulp.watch(['lessons/**/*.css'], ['css-watch', browserSync.reload]); -}); - -gulp.task('build-deploy', function(cb) { - runSequence( - 'default', - 'deploy-gh-pages', - cb); -}); - -// Deploy to GitHub pages gh-pages branch -gulp.task('deploy-gh-pages', function() { - return gulp.src('gh-pages/**/*') - .pipe($.ghPages()); -}); - -// examples task for devs -gulp.task('examples', ['default'], function(cb) { - runSequence( - // takes care - ['browsersync','js-examples-watchify'], - cb); -}); - -// Gh-pages task is the default task -gulp.task('default', ['clean'], function(cb) { - runSequence( - 'lint', - //'test', - 'copy', // copy the data over! - ['html', 'css', 'js-examples'], - 'doc', - cb); -}); From 16e292f41802f71095f166ec1f1c9ee71016164f Mon Sep 17 00:00:00 2001 From: Nicolas Rannou Date: Thu, 27 Oct 2016 12:25:28 +0200 Subject: [PATCH 02/19] Update README.md --- README.md | 41 ++++++++++++++++++++++++++++------------- 1 file changed, 28 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 000c80ca3..36e4f09cb 100644 --- a/README.md +++ b/README.md @@ -1,21 +1,36 @@ +

+ +

---------- +

+ + Build Status + + + Code Climate + + + NPM Version + + + NPM Downloads per Month + + + Slack + +

-**AMI Alpha** is now available for developer preview.
-Developper preview means that the API might change but we are confident you can already build cool apps with AMI.
-Please submit pull request, open issues or contact us for any question, feature request, etc. +> **AMI Alpha** is now available for developer preview.
+> Developper preview means that the API might change but we are confident you can already build cool apps with AMI.
+> Please submit pull request, open issues or contact us for any question, feature request, etc. ---------- -[![Build Status](https://travis-ci.org/FNNDSC/ami.svg)](https://travis-ci.org/FNNDSC/ami) -[![Code Climate](https://codeclimate.com/github/FNNDSC/ami/badges/gpa.svg)](https://codeclimate.com/github/FNNDSC/ami) -[![Slack](https://img.shields.io/badge/slack-join-blue.svg)](http://slack.babymri.org) -[![NPM Version](https://img.shields.io/npm/v/ami.js.svg)](https://www.npmjs.com/package/ami.js) -[![NPM Downloads per Month](https://img.shields.io/npm/dm/ami.js.svg)](https://www.npmjs.com/package/ami.js) - - -# AMI JS ToolKit (Alpha - 0.0.*) -> A* Medical Imaging (AMI) JS ToolKit for THREEJS - ### Content 1. [Lessons](#lessons) From f3f8c38aaccb8ef100621b943fde80fe17fe2692 Mon Sep 17 00:00:00 2001 From: Nicolas Rannou Date: Thu, 27 Oct 2016 12:26:09 +0200 Subject: [PATCH 03/19] Update README.md --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 36e4f09cb..23ae695cc 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@

----------- +

+---------- + > **AMI Alpha** is now available for developer preview.
> Developper preview means that the API might change but we are confident you can already build cool apps with AMI.
> Please submit pull request, open issues or contact us for any question, feature request, etc. From 0230cec3050dbe714478649a9b2c93c34fd57950 Mon Sep 17 00:00:00 2001 From: Nicolas Rannou Date: Thu, 27 Oct 2016 12:33:16 +0200 Subject: [PATCH 04/19] Update README.md --- README.md | 52 +++++++--------------------------------------------- 1 file changed, 7 insertions(+), 45 deletions(-) diff --git a/README.md b/README.md index 23ae695cc..a2ee5932b 100644 --- a/README.md +++ b/README.md @@ -189,52 +189,14 @@ Volume rendering, 2D viewer, arbitrary reslicing and more examples and advanced ## Features :white_check_mark: READY - :large_orange_diamond: IN PROGRESS OR LIMITED SUPPORT - :x: ON ROADMAP -#### Capabilities -:white_check_mark: 2D Visulization -:white_check_mark: 3D Visualization - -:white_check_mark: Volume Rendering - -:white_check_mark: Lookup Tables - -:large_orange_diamond: Label Maps - -#### Widgets - -:large_orange_diamond: Handle (2D/3D) - -:large_orange_diamond: Probe (2D/3D) - -:large_orange_diamond: Ruler (2D/3D) - -:large_orange_diamond: Angle (2D/3D) - -:large_orange_diamond: Orientation (2D/3D) - -#### Volumes - -:white_check_mark: Dicom - -:white_check_mark: NRRD - -:large_orange_diamond: Nifti - -:x: MGH/MGZ - -:x: JPEG - -#### Meshes - -:white_check_mark: VTK (THREEJS) - -:white_check_mark: STL (THREEJS) - -:large_orange_diamond: TRK - -:x: CURV - -:x: FSM +| Capabilities | Volumes | Meshes | Widgets | +|-------------------- |----------- |----------------- |------------------------ | +| ✅ 2D Visulization | ✅ Dicom | ✅ VTK (THREEJS) | 🔶 Handle (2D/3D) | +| ✅ 3D Visualization | ✅ NRRD | ✅ STL (THREEJS) | 🔶 Probe (2D/3D) | +| ✅ Volume Rendering | 🔶 Nifti | 🔶 TRK | 🔶 Ruler (2D/3D) | +| ✅ Lookup Tables | ❌ MGH/MGZ | ❌ CURV | 🔶 Angle (2D/3D) | +| 🔶 Label Maps | ❌ JPEG | ❌ FSM | 🔶 Orientation (2D/3D) | ## Pre-requisites From 36234fdb21457ae76554dd8f213bd8696444d8c5 Mon Sep 17 00:00:00 2001 From: Nicolas Rannou Date: Thu, 27 Oct 2016 12:34:25 +0200 Subject: [PATCH 05/19] Update README.md --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index a2ee5932b..45085e4f4 100644 --- a/README.md +++ b/README.md @@ -188,7 +188,9 @@ Volume rendering, 2D viewer, arbitrary reslicing and more examples and advanced demos [there](https://fnndsc.github.io/ami)! ## Features -:white_check_mark: READY - :large_orange_diamond: IN PROGRESS OR LIMITED SUPPORT - :x: ON ROADMAP + +> :white_check_mark: READY - :large_orange_diamond: IN PROGRESS OR LIMITED SUPPORT - :x: ON ROADMAP + | Capabilities | Volumes | Meshes | Widgets | |-------------------- |----------- |----------------- |------------------------ | From df272f6d9eb370681c22f7bf268859ef8aa3c190 Mon Sep 17 00:00:00 2001 From: Nicolas Rannou Date: Thu, 27 Oct 2016 12:39:31 +0200 Subject: [PATCH 06/19] Update README.md --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 45085e4f4..fc76ed3bb 100644 --- a/README.md +++ b/README.md @@ -323,3 +323,6 @@ AMI would not exist without them: ##### [Pako](https://github.com/nodeca/pako) * GZ file decompression * Author(s): [nodeca](https://github.com/nodeca) + +##### [Clipart Panda](http://www.clipartpanda.com/) +* [Baby blue dinausor png](http://www.clipartpanda.com/clipart_images/baby-blue-dinosaur-clip-art-37313455) From 3442aacc16d8ff9af4909a0fd88ddbe347738a69 Mon Sep 17 00:00:00 2001 From: Nicolas Rannou Date: Thu, 27 Oct 2016 12:39:45 +0200 Subject: [PATCH 07/19] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index fc76ed3bb..fbe38f460 100644 --- a/README.md +++ b/README.md @@ -325,4 +325,4 @@ AMI would not exist without them: * Author(s): [nodeca](https://github.com/nodeca) ##### [Clipart Panda](http://www.clipartpanda.com/) -* [Baby blue dinausor png](http://www.clipartpanda.com/clipart_images/baby-blue-dinosaur-clip-art-37313455) +* [Baby blue dinausor](http://www.clipartpanda.com/clipart_images/baby-blue-dinosaur-clip-art-37313455) From 443d1633becebf0e9f5787d6268a9d67e7bf75ba Mon Sep 17 00:00:00 2001 From: Nicolas Rannou Date: Thu, 27 Oct 2016 12:52:17 +0200 Subject: [PATCH 08/19] Update README.md --- README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index fbe38f460..c335e436a 100644 --- a/README.md +++ b/README.md @@ -40,11 +40,9 @@ 2. [Features](#features) 3. [Usage](#usage) 4. [Pre-requisites](#pre-requisites) -5. [Use with NPM](#npm) -6. [Use compiled version](#compiled) -7. [API Documentation](https://fnndsc.github.io/ami/doc) -8. [Developer corner](https://fnndsc.github.io/ami/doc) -9. [Credits](#credits) +5. [Usage](#npm) +6. [Developer corner](#developer-corner) +6. [Credits](#credits) ## Lessons @@ -291,6 +289,8 @@ Deploy dist/ to gh-pages $> npm run deploy ``` +Find out more about the [API](https://fnndsc.github.io/ami/doc). + # Credits AMI would not exist without them: From 2cecafaf8af91eb871e91ce137cbae8e0db50fe4 Mon Sep 17 00:00:00 2001 From: Nicolas Rannou Date: Thu, 27 Oct 2016 12:56:14 +0200 Subject: [PATCH 09/19] Update README.md --- README.md | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index c335e436a..bd79835e7 100644 --- a/README.md +++ b/README.md @@ -35,8 +35,7 @@ ### Content -1. [Lessons](#lessons) -2. [Sandbox](#sandbox) +1. [Hello AMI](#hello-ami) 2. [Features](#features) 3. [Usage](#usage) 4. [Pre-requisites](#pre-requisites) @@ -44,7 +43,7 @@ 6. [Developer corner](#developer-corner) 6. [Credits](#credits) -## Lessons +## Hello AMI
@@ -181,7 +180,7 @@
-## Sandbox +### (more) Advanced demos Volume rendering, 2D viewer, arbitrary reslicing and more examples and advanced demos [there](https://fnndsc.github.io/ami)! From 4baaa155c036705d7605acaccf40f50a11ce43b6 Mon Sep 17 00:00:00 2001 From: Nicolas Rannou Date: Thu, 27 Oct 2016 12:57:18 +0200 Subject: [PATCH 10/19] Update README.md --- README.md | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index bd79835e7..fc2942804 100644 --- a/README.md +++ b/README.md @@ -37,11 +37,9 @@ 1. [Hello AMI](#hello-ami) 2. [Features](#features) -3. [Usage](#usage) -4. [Pre-requisites](#pre-requisites) -5. [Usage](#npm) -6. [Developer corner](#developer-corner) -6. [Credits](#credits) +3. [Usage](#npm) +4. [Developer corner](#developer-corner) +5. [Credits](#credits) ## Hello AMI @@ -197,19 +195,19 @@ Volume rendering, 2D viewer, arbitrary reslicing and more examples and advanced | ✅ Lookup Tables | ❌ MGH/MGZ | ❌ CURV | 🔶 Angle (2D/3D) | | 🔶 Label Maps | ❌ JPEG | ❌ FSM | 🔶 Orientation (2D/3D) | -## Pre-requisites +## Usage + +### Pre-requisites -### Modern web browser +#### Modern web browser AMI relies on ES2015 promises to perform many task so consider using a polyfill if needed. -### THREEJS +#### THREEJS Make sure that you are loading THREEJS your index.html **BEFORE** AMI. ``` ``` -## Usage - ### NPM ``` $> npm install ami.js From 4d7068a4341635dc5b66630a9815f9c0a159e757 Mon Sep 17 00:00:00 2001 From: Nicolas Rannou Date: Thu, 27 Oct 2016 13:03:23 +0200 Subject: [PATCH 11/19] Update README.md --- README.md | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index fc2942804..8b630f5a2 100644 --- a/README.md +++ b/README.md @@ -26,11 +26,13 @@

---------- +```diff +**AMI Alpha** is now available for developer preview. +Please submit pull request, open issues or contact us for any question, feature request, etc. -> **AMI Alpha** is now available for developer preview.
-> Developper preview means that the API might change but we are confident you can already build cool apps with AMI.
-> Please submit pull request, open issues or contact us for any question, feature request, etc. - +- +- Developper preview means that the API might change but we are confident you can already build cool apps with AMI. +``` ---------- ### Content From 474344c26f57af799ca65906ea2e9d904a35a181 Mon Sep 17 00:00:00 2001 From: Nicolas Rannou Date: Thu, 27 Oct 2016 13:04:16 +0200 Subject: [PATCH 12/19] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 8b630f5a2..ba14b29b0 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ Please submit pull request, open issues or contact us for any question, feature request, etc. - -- Developper preview means that the API might change but we are confident you can already build cool apps with AMI. +- Developper preview means that the API might change but you can already build cool apps with AMI. ``` ---------- From 4b0ab163fe16e44f1436ba020307d88c9ba1bf67 Mon Sep 17 00:00:00 2001 From: Nicolas Rannou Date: Thu, 27 Oct 2016 13:08:22 +0200 Subject: [PATCH 13/19] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ba14b29b0..c04a90ad8 100644 --- a/README.md +++ b/README.md @@ -324,4 +324,4 @@ AMI would not exist without them: * Author(s): [nodeca](https://github.com/nodeca) ##### [Clipart Panda](http://www.clipartpanda.com/) -* [Baby blue dinausor](http://www.clipartpanda.com/clipart_images/baby-blue-dinosaur-clip-art-37313455) +* [Baby blue dinosaur](http://www.clipartpanda.com/clipart_images/baby-blue-dinosaur-clip-art-37313455) From ba6d929389b1362679efcc4af90402f1bd32a2e3 Mon Sep 17 00:00:00 2001 From: Nicolas Rannou Date: Thu, 27 Oct 2016 15:23:57 +0200 Subject: [PATCH 14/19] Update README.md --- README.md | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index c04a90ad8..a1cd61f07 100644 --- a/README.md +++ b/README.md @@ -201,11 +201,8 @@ Volume rendering, 2D viewer, arbitrary reslicing and more examples and advanced ### Pre-requisites -#### Modern web browser -AMI relies on ES2015 promises to perform many task so consider using a polyfill if needed. - -#### THREEJS -Make sure that you are loading THREEJS your index.html **BEFORE** AMI. +* ES2015 promises support: (consider using polyfills if needed) +* Load THREEJS your index.html **BEFORE** AMI. ``` ``` From faf1e586bfaa505b117162c36d23d4acee334af8 Mon Sep 17 00:00:00 2001 From: Nicolas Rannou Date: Thu, 27 Oct 2016 15:24:41 +0200 Subject: [PATCH 15/19] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a1cd61f07..f95194a18 100644 --- a/README.md +++ b/README.md @@ -201,7 +201,7 @@ Volume rendering, 2D viewer, arbitrary reslicing and more examples and advanced ### Pre-requisites -* ES2015 promises support: (consider using polyfills if needed) +* ES2015 promises support. (consider using polyfills if needed) * Load THREEJS your index.html **BEFORE** AMI. ``` From f6a492758a7af6d45788e70ffbe1e48a5640e43e Mon Sep 17 00:00:00 2001 From: Rudolph Pienaar Date: Thu, 27 Oct 2016 09:40:53 -0400 Subject: [PATCH 16/19] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f95194a18..bde39feb3 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ Please submit pull request, open issues or contact us for any question, feature request, etc. - -- Developper preview means that the API might change but you can already build cool apps with AMI. +- Developer preview means that the API might change but you can already build cool apps with AMI. ``` ---------- From ef9676a5c7089b3620797f50d87dea9cda0a307d Mon Sep 17 00:00:00 2001 From: nicolasrannou Date: Wed, 16 Nov 2016 09:33:52 +0100 Subject: [PATCH 17/19] v0.0.10-dev --- bower.json | 2 +- package.json | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/bower.json b/bower.json index 7166198fc..ca384851c 100644 --- a/bower.json +++ b/bower.json @@ -1,5 +1,5 @@ { "name": "ami.js", - "version": "v0.0.9", + "version": "v0.0.10-dev", "dependencies": {} } \ No newline at end of file diff --git a/package.json b/package.json index 6d2b8aa8a..6a7676586 100644 --- a/package.json +++ b/package.json @@ -1,8 +1,8 @@ { "name": "ami.js", - "version": "v0.0.9", - "main": "src/ami.min.js", - "keywords": ["ami", "ami.js","three.js", "webgl", "dicom", "nifti","awesome", "medical", "imaging", "xtk", "nrrd", "vtk", "stl", "trk", "labelmap", "mesh"], + "version": "v0.0.10-dev", + "main": "src/ami.js", + "keywords": ["ami", "ami.js","three.js", "webgl", "dicom", "nifti", "awesome", "medical", "imaging", "xtk", "nrrd", "vtk", "stl", "trk"], "author": { "name" : "Nicolas Rannou", "email" : "nicolas@eunate.ch", From 384c22c801a404ecf80645c09beefe8656556542 Mon Sep 17 00:00:00 2001 From: nicolasrannou Date: Wed, 16 Nov 2016 10:01:03 +0100 Subject: [PATCH 18/19] fix lesson 06 --- {examples => legacy}/vr_doublepass/vr_doublepass.css | 0 .../vr_doublepass/vr_doublepass.html | 0 {examples => legacy}/vr_doublepass/vr_doublepass.js | 0 lessons/04/demo.details | 4 ++-- lessons/04/demo.html | 1 - lessons/06/demo.details | 12 ++++++++++++ 6 files changed, 14 insertions(+), 3 deletions(-) rename {examples => legacy}/vr_doublepass/vr_doublepass.css (100%) rename {examples => legacy}/vr_doublepass/vr_doublepass.html (100%) rename {examples => legacy}/vr_doublepass/vr_doublepass.js (100%) diff --git a/examples/vr_doublepass/vr_doublepass.css b/legacy/vr_doublepass/vr_doublepass.css similarity index 100% rename from examples/vr_doublepass/vr_doublepass.css rename to legacy/vr_doublepass/vr_doublepass.css diff --git a/examples/vr_doublepass/vr_doublepass.html b/legacy/vr_doublepass/vr_doublepass.html similarity index 100% rename from examples/vr_doublepass/vr_doublepass.html rename to legacy/vr_doublepass/vr_doublepass.html diff --git a/examples/vr_doublepass/vr_doublepass.js b/legacy/vr_doublepass/vr_doublepass.js similarity index 100% rename from examples/vr_doublepass/vr_doublepass.js rename to legacy/vr_doublepass/vr_doublepass.js diff --git a/lessons/04/demo.details b/lessons/04/demo.details index 2145d54f4..3efa7f232 100644 --- a/lessons/04/demo.details +++ b/lessons/04/demo.details @@ -1,8 +1,8 @@ /* --- -name: AMI - Lesson 00 -description: Load data. +name: AMI - Lesson 04 +description: Labelmap. authors: - Nicolas Rannou (github) js_wrap: onLoad diff --git a/lessons/04/demo.html b/lessons/04/demo.html index 5fadc0c64..835d5109a 100644 --- a/lessons/04/demo.html +++ b/lessons/04/demo.html @@ -1,5 +1,4 @@ -
diff --git a/lessons/06/demo.details b/lessons/06/demo.details index e69de29bb..cb09fd302 100644 --- a/lessons/06/demo.details +++ b/lessons/06/demo.details @@ -0,0 +1,12 @@ + +/* +--- +name: AMI - Lesson 06 +description: Volume rendering. +authors: + - Nicolas Rannou (github) +js_wrap: onLoad +... +*/ + +

This demo will show you how to: add multiple Events to an Element, create custom Events and fire an Event.

From 739cfe37876b65c37f004967fe1ba9ef0e921602 Mon Sep 17 00:00:00 2001 From: nicolasrannou Date: Wed, 16 Nov 2016 10:02:40 +0100 Subject: [PATCH 19/19] v0.0.10 --- bower.json | 2 +- build/ami.js | 8 ++++---- build/ami.min.js | 10 +++++----- package.json | 2 +- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/bower.json b/bower.json index ca384851c..4ea153fb9 100644 --- a/bower.json +++ b/bower.json @@ -1,5 +1,5 @@ { "name": "ami.js", - "version": "v0.0.10-dev", + "version": "v0.0.10", "dependencies": {} } \ No newline at end of file diff --git a/build/ami.js b/build/ami.js index a642959be..2bd984ee1 100644 --- a/build/ami.js +++ b/build/ami.js @@ -31229,9 +31229,9 @@ module.exports = isString; },{}],85:[function(require,module,exports){ module.exports={ "name": "ami.js", - "version": "v0.0.9", - "main": "src/ami.min.js", - "keywords": ["ami", "ami.js","three.js", "webgl", "dicom", "nifti","awesome", "medical", "imaging", "xtk", "nrrd", "vtk", "stl", "trk", "labelmap", "mesh"], + "version": "v0.0.10", + "main": "src/ami.js", + "keywords": ["ami", "ami.js","three.js", "webgl", "dicom", "nifti", "awesome", "medical", "imaging", "xtk", "nrrd", "vtk", "stl", "trk"], "author": { "name" : "Nicolas Rannou", "email" : "nicolas@eunate.ch", @@ -43865,4 +43865,4 @@ exports.default = WidgetsVoxelProbe; },{"../../src/helpers/helpers.voxel":109}]},{},[86])(86) }); -//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5vZGVfbW9kdWxlcy9icm93c2VyaWZ5L25vZGVfbW9kdWxlcy9icm93c2VyLXBhY2svX3ByZWx1ZGUuanMiLCJleHRlcm5hbC9zY3JpcHRzL2pwZWcuanMiLCJleHRlcm5hbC9zY3JpcHRzL2pweC5qcyIsIm5vZGVfbW9kdWxlcy9hc3NlcnQvYXNzZXJ0LmpzIiwibm9kZV9tb2R1bGVzL2Jyb3dzZXItcmVzb2x2ZS9lbXB0eS5qcyIsIm5vZGVfbW9kdWxlcy9icm93c2VyaWZ5LXpsaWIvbm9kZV9tb2R1bGV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FyIHMgPSBycyAmIDE1LCByID0gcnMgPj4gNDtcbiAgICAgICAgaWYgKHMgPT09IDApIHtcbiAgICAgICAgICBpZiAociA8IDE1KSB7XG4gICAgICAgICAgICBlb2JydW4gPSByZWNlaXZlKHIpICsgKDEgPDwgcikgLSAxO1xuICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgfVxuICAgICAgICAgIGsgKz0gMTY7XG4gICAgICAgICAgY29udGludWU7XG4gICAgICAgIH1cbiAgICAgICAgayArPSByO1xuICAgICAgICB2YXIgeiA9IGRjdFppZ1phZ1trXTtcbiAgICAgICAgY29tcG9uZW50LmJsb2NrRGF0YVtvZmZzZXQgKyB6XSA9IHJlY2VpdmVBbmRFeHRlbmQocykgKiAoMSA8PCBzdWNjZXNzaXZlKTtcbiAgICAgICAgaysrO1xuICAgICAgfVxuICAgIH1cblxuICAgIHZhciBzdWNjZXNzaXZlQUNTdGF0ZSA9IDAsIHN1Y2Nlc3NpdmVBQ05leHRWYWx1ZTtcbiAgICBmdW5jdGlvbiBkZWNvZGVBQ1N1Y2Nlc3NpdmUoY29tcG9uZW50LCBvZmZzZXQpIHtcbiAgICAgIHZhciBrID0gc3BlY3RyYWxTdGFydCwgZSA9IHNwZWN0cmFsRW5kLCByID0gMDtcbiAgICAgIHdoaWxlIChrIDw9IGUpIHtcbiAgICAgICAgdmFyIHogPSBkY3RaaWdaYWdba107XG4gICAgICAgIHN3aXRjaCAoc3VjY2Vzc2l2ZUFDU3RhdGUpIHtcbiAgICAgICAgICBjYXNlIDA6IC8vIGluaXRpYWwgc3RhdGVcbiAgICAgICAgICAgIHZhciBycyA9IGRlY29kZUh1ZmZtYW4oY29tcG9uZW50Lmh1ZmZtYW5UYWJsZUFDKTtcbiAgICAgICAgICAgIHZhciBzID0gcnMgJiAxNTtcbiAgICAgICAgICAgIHIgPSBycyA+PiA0O1xuICAgICAgICAgICAgaWYgKHMgPT09IDApIHtcbiAgICAgICAgICAgICAgaWYgKHIgPCAxNSkge1xuICAgICAgICAgICAgICAgIGVvYnJ1biA9IHJlY2VpdmUocikgKyAoMSA8PCByKTtcbiAgICAgICAgICAgICAgICBzdWNjZXNzaXZlQUNTdGF0ZSA9IDQ7XG4gICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgciA9IDE2O1xuICAgICAgICAgICAgICAgIHN1Y2Nlc3NpdmVBQ1N0YXRlID0gMTtcbiAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgaWYgKHMgIT09IDEpXG4gICAgICAgICAgICAgICAgdGhyb3cgXCJpbnZhbGlkIEFDbiBlbmNvZGluZ1wiO1xuICAgICAgICAgICAgICBzdWNjZXNzaXZlQUNOZXh0VmFsdWUgPSByZWNlaXZlQW5kRXh0ZW5kKHMpO1xuICAgICAgICAgICAgICBzdWNjZXNzaXZlQUNTdGF0ZSA9IHIgPyAyIDogMztcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGNvbnRpbnVlO1xuICAgICAgICAgIGNhc2UgMTogLy8gc2tpcHBpbmcgciB6ZXJvIGl0ZW1zXG4gICAgICAgICAgY2FzZSAyOlxuICAgICAgICAgICAgaWYgKGNvbXBvbmVudC5ibG9ja0RhdGFbb2Zmc2V0ICsgel0pIHtcbiAgICAgICAgICAgICAgY29tcG9uZW50LmJsb2NrRGF0YVtvZmZzZXQgKyB6XSArPSAocmVhZEJpdCgpIDw8IHN1Y2Nlc3NpdmUpO1xuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgci0tO1xuICAgICAgICAgICAgICBpZiAociA9PT0gMClcbiAgICAgICAgICAgICAgICBzdWNjZXNzaXZlQUNTdGF0ZSA9IHN1Y2Nlc3NpdmVBQ1N0YXRlID09IDIgPyAzIDogMDtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgIGNhc2UgMzogLy8gc2V0IHZhbHVlIGZvciBhIHplcm8gaXRlbV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BpIDwgY29tcG9uZW50c0xlbmd0aDsgaSsrKSB7XG4gICAgICAgICAgICBjb21wb25lbnQgPSBjb21wb25lbnRzW2ldO1xuICAgICAgICAgICAgaCA9IGNvbXBvbmVudC5oO1xuICAgICAgICAgICAgdiA9IGNvbXBvbmVudC52O1xuICAgICAgICAgICAgZm9yIChqID0gMDsgaiA8IHY7IGorKykge1xuICAgICAgICAgICAgICBmb3IgKGsgPSAwOyBrIDwgaDsgaysrKSB7XG4gICAgICAgICAgICAgICAgZGVjb2RlTWN1KGNvbXBvbmVudCwgZGVjb2RlRm4sIG1jdSwgaiwgayk7XG4gICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgICB9XG4gICAgICAgICAgbWN1Kys7XG4gICAgICAgIH1cbiAgICAgIH1cblxuICAgICAgLy8gZmluZCBtYXJrZXJcbiAgICAgIGJpdHNDb3VudCA9IDA7XG4gICAgICBtYXJrZXIgPSAoZGF0YVtvZmZzZXRdIDw8IDgpIHwgZGF0YVtvZmZzZXQgKyAxXTtcbiAgICAgIGlmIChtYXJrZXIgPD0gMHhGRjAwKSB7XG4gICAgICAgIHRocm93IFwibWFya2VyIHdhcyBub3QgZm91bmRcIjtcbiAgICAgIH1cblxuICAgICAgaWYgKG1hcmtlciA+PSAweEZGRDAgJiYgbWFya2VyIDw9IDB4RkZENykgeyAvLyBSU1R4XG4gICAgICAgIG9mZnNldCArPSAyO1xuICAgICAgfSBlbHNlIHtcbiAgICAgICAgYnJlYWs7XG4gICAgICB9XG4gICAgfVxuXG4gICAgcmV0dXJuIG9mZnNldCAtIHN0YXJ0T2Zmc2V0O1xuICB9XG5cbiAgLy8gQSBwb3J0IG9mIHBvcHBsZXIncyBJRENUIG1ldGhvZCB3aGljaCBpbiB0dXJuIGlzIHRha2VuIGZyb206XG4gIC8vICAgQ2hyaXN0b3BoIExvZWZmbGVyLCBBZHJpYWFuIExpZ3RlbmJlcmcsIEdlb3JnZSBTLiBNb3NjaHl0eixcbiAg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WzBdID09PSAweDRBICYmIGFwcERhdGFbMV0gPT09IDB4NDYgJiYgYXBwRGF0YVsyXSA9PT0gMHg0OSAmJlxuICAgICAgICAgICAgICAgIGFwcERhdGFbM10gPT09IDB4NDYgJiYgYXBwRGF0YVs0XSA9PT0gMCkgeyAvLyAnSkZJRlxceDAwJ1xuICAgICAgICAgICAgICAgIGpmaWYgPSB7XG4gICAgICAgICAgICAgICAgICB2ZXJzaW9uOiB7bWFqb3I6IGFwcERhdGFbNV0sIG1pbm9yOiBhcHBEYXRhWzZdfSxcbiAgICAgICAgICAgICAgICAgIGRlbnNpdHlVbml0czogYXBwRGF0YVs3XSxcbiAgICAgICAgICAgICAgICAgIHhEZW5zaXR5OiAoYXBwRGF0YVs4XSA8PCA4KSB8IGFwcERhdGFbOV0sXG4gICAgICAgICAgICAgICAgICB5RGVuc2l0eTogKGFwcERhdGFbMTBdIDw8IDgpIHwgYXBwRGF0YVsxMV0sXG4gICAgICAgICAgICAgICAgICB0aHVtYldpZHRoOiBhcHBEYXRhWzEyXSxcbiAgICAgICAgICAgICAgICAgIHRodW1iSGVpZ2h0OiBhcHBEYXRhWzEzXSxcbiAgICAgICAgICAgICAgICAgIHRodW1iRGF0YTogYXBwRGF0YS5zdWJhcnJheSgxNCwgMTQgKyAzICogYXBwRGF0YVsxMl0gKiBhcHBEYXRhWzEzXSlcbiAgICAgICAgICAgICAgICB9O1xuICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICAvLyBUT0RPIEFQUDEgLSBFeGlmXG4gICAgICAgICAgICBpZiAoZmlsZU1hcmtlciA9PT0gMHhGRkVFKSB7XG4gICAgICAgICAgICAgIGlmIChhcHBEYXRhWzBdID09PSAweDQxICYmIGFwcERhdGFbMV0gPT09IDB4NjQgJiYgYXBwRGF0YVsyXSA9PT0gMHg2RiAmJlxuICAgICAgICAgICAgICAgIGFwcERhdGFbM10gPT09IDB4NjIgJiYgYXBwRGF0YVs0XSA9PT0gMHg2NSAmJiBhcHBEYXRhWzVdID09PSAwKSB7IC8vICdBZG9iZVxceDAwJ1xuICAgICAgICAgICAgICAgIGFkb2JlID0ge1xuICAgICAgICAgICAgICAgICAgdmVyc2lvbjogYXBwRGF0YVs2XSxcbiAgICAgICAgICAgICAgICAgIGZsYWdzMDogKGFwcERhdGFbN10gPDwgOCkgfCBhcHBEYXRhWzhdLFxuICAgICAgICAgICAgICAgICAgZmxhZ3MxOiAoYXBwRGF0YVs5XSA8PCA4KSB8IGFwcERhdGFbMTBdLFxuICAgICAgICAgICAgICAgICAgdHJhbnNmb3JtQ29kZTogYXBwRGF0YVsxMV1cbiAgICAgICAgICAgICAgICB9O1xuICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBicmVhaztcblxuICAgICAgICAgIGNhc2UgMHhGRkRCOiAvLyBEUVQgKERlZmluZSBRdWFudGl6YXRpb24gVGFibGVzKVxuICAgICAgICAgICAgdmFyIHF1YW50aXphdGlvblRhYmxlc0xlbmd0aCA9IHJlYWRVaW50MTYoKTtcbiAgICAgICAgICAgIHZhciBxdWFudGl6YXRpb25UYWJsZXNFbmQgPSBxdWFudGl6YXRpb25UYWJsZXNMZW5ndGggKyBvZmZzZXQgLSAyO1xuICAgICAgICAgICAgd2hpbGUgKG9mZnNldCA8IHF1YW50aXphdGlvblRhYmxlc0VuZCkge1xuICAgICAgICAgICAgICB2YXIgcXVhbnRpemF0aW9uVGFibGVTcGVjID0gZGF0YVtvZmZzZXQrK107XG4gICAgICAgICAgICAgIHZhciB0YWJsZURhdGEgPSBuZXcgSW50MzJBcnJheSg2NCk7XG4gICAgICAgICAgICAgIGlmICgocXVhbnRpemF0aW9uVGFibGVTcGVjID4+IDQpID09PSAwKSB7IC8vIDggYml0IHZhbHVlc1xuICAgICAgICAgICAgICAgIGZvciAoaiA9IDA7IGogPCA2NDsgaisrKSB7XG4gICAgICAgICAgICAgICAgICB2YXIgeiA9IGRjdFppZ1phZ1tqXTtcbiAgICAgICAgICAgICAgICAgIHRhYmxlRGF0YVt6XSA9IGRhdGFbb2Zmc2V0KytdO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgfSBlbHNlIGlmICgocXVhbnRpemF0aW9uVGFibGVTcGVjID4+IDQpID09PSAxKSB7IC8vMTYgYml0XG4gICAgICAgICAgICAgICAgZm9yIChqID0gMDsgaiA8IDY0OyBqKyspIHtcbiAgICAgICAgICAgICAgICAgIHZhciB6eiA9IGRjdFppZ1phZ1tqXTtcbiAgICAgICAgICAgICAgICAgIHRhYmxlRGF0YVt6el0gPSByZWFkVWludDE2KCk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICB9IGVsc2VcbiAgICAgICAgICAgICAgICB0aHJvdyBcIkRRVDogaW52YWxpZCB0YWJsZSBzcGVjXCI7XG4gICAgICAgICAgICAgIHF1YW50aXphdGlvblRhYmxlc1txdWFudGl6YXRpb25UYWJsZVNwZWMgJiAxNV0gPSB0YWJsZURhdGE7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBicmVhaztcblxuICAgICAgICAgIGNhc2UgMHhGRkMwOiAvLyBTT0YwIChTdGFydCBvZiBGcmFtZSwgQmFzZWxpbmUgRENUKVxuICAgICAgICAgIGNhc2UgMHhGRkMxOiAvLyBTT0YxIChTdGFydCBvZiBGcmFtZSwgRXh0ZW5kZWQgRENUKVxuICAgICAgICAgIGNhc2UgMHhGRkMyOiAvLyBTT0YyIChTdGFydCBvZiBGcmFtZSwgUHJvZ3Jlc3NpdmUgRENUKVxuICAgICAgICAgICAgaWYgKGZyYW1lKSB7XG4gICAgICAgICAgICAgIHRocm93IFwiT25seSBzaW5nbGUgZnJhbWUgSlBFR3Mgc3VwcG9ydGVkXCI7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICByZWFkVWludDE2KCk7IC8vIHNraXAgZGF0YSBsZW5ndGhcbiAgICAgICAgICAgIGZyYW1lID0ge307XG4gICAgICAgICAgICBmcmFtZS5leHRlbmRlZCA9IChmaWxlTWFya2VyID09PSAweEZGQzEpO1xuICAgICAgICAgICAgZnJhbWUucHJvZ3Jlc3NpdmUgPSAoZmlsZU1hcmtlciA9PT0gMHhGRkMyKTtcbiAgICAgICAgICAgIGZyYW1lLnByZWNpc2lvbiA9IGRhdGFbb2Zmc2V0KytdO1xuICAgICAgICAgICAgZnJhbWUuc2NhbkxpbmVzID0gcmVhZFVpbnQxNigpO1xuICAgICAgICAgICAgZnJhbWUuc2FtcGxlc1BlckxpbmUgPSByZWFkVWludDE2KCk7XG4gICAgICAgICAgICBmcmFtZS5jb21wb25lbnRzID0gW107XG4gICAgICAgICAgICBmcmFtZS5jb21wb25lbnRJZHMgPSB7fTtcbiAgICAgICAgICAgIHZhciBjb21wb25lbnRzQ291bnQgPSBkYXRhW29mZnNldCsrXSwgY29tcG9uZW50SWQ7XG4gICAgICAgICAgICB2YXIgbWF4SCA9IDAsIG1heFYgPSAwO1xuICAgICAgICAgICAgZm9yIChpID0gMDsgaSA8IGNvbXBvbmVudHNDb3VudDsgaSsrKSB7XG4gICAgICAgICAgICAgIGNvbXBvbmVudElkID0gZGF0YVtvZmZzZXRdO1xuICAgICAgICAgICAgICB2YXIgaCA9IGRhdGFbb2Zmc2V0ICsgMV0gPj4gNDtcbiAgICAgICAgICAgICAgdmFyIHYgPSBkYXRhW29mZnNldCArIDFdICYgMTU7XG4gICAgICAgICAgICAgIGlmIChtYXhIIDwgaClcbiAgICAgICAgICAgICAgICBtYXhIID0gaDtcbiAgICAgICAgICAgICAgaWYgKG1heFYgPCB2KVxuICAgICAgICAgICAgICAgIG1heFYgPSB2O1xuICAgICAgICAgICAgICB2YXIgcUlkID0gZGF0YVtvZmZzZXQgKyAyXTtcbiAgICAgICAgICAgICAgbCA9IGZyYW1lLmNvbXBvbmVudHMucHVzaCh7XG4gICAgICAgICAgICAgICAgaDogaCxcbiAgICAgICAgICAgICAgICB2OiB2LFxuICAgICAgICAgICAgICAgIHF1YW50aXphdGlvblRhYmxlOiBxdWFudGl6YXRpb25UYWJsZXNbcUlkXSxcbiAgICAgICAgICAgICAgICBxdWFudGl6YXRpb25UYWJsZUlkOiBxSWQsXG4gICAgICAgICAgICAgICAgYml0Q29udmVyc2lvbjogMjU1IC8gKCgxIDw8IGZyYW1lLnByZWNpc2lvbikgLSAxKVxuICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgICAgZnJhbWUuY29tcG9uZW50SWRzW2NvbXBvbmVudElkXSA9IGwgLSAxO1xuICAgICAgICAgICAgICBvZmZzZXQgKz0gMztcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGZyYW1lLm1heEggPSBtYXhIO1xuICAgICAgICAgICAgZnJhbWUubWF4ViA9IG1heFY7XG4gICAgICAgICAgICBwcmVwYXJlQ29tcG9uZW50cyhmcmFtZSk7XG4gICAgICAgICAgICBicmVhaztcblxuICAgICAgICAgIGNhc2UgMHhGRkM0OiAvLyBESFQgKERlZmluZSBIdWZmbWFuIFRhYmxlcylcbiAgICAgICAgICAgIHZhciBodWZmbWFuTGVuZ3RoID0gcmVhZFVpbnQxNigpO1xuICAgICAgICAgICAgZm9yIChpID0gMjsgaSA8IGh1ZmZtYW5MZW5ndGg7ICkge1xuICAgICAgICAgICAgICB2YXIgaHVmZm1hblRhYmxlU3BlYyA9IGRhdGFbb2Zmc2V0KytdO1xuICAgICAgICAgICAgICB2YXIgY29kZUxlbmd0aHMgPSBuZXcgVWludDhBcnJheSgxNik7XG4gICAgICAgICAgICAgIHZhciBjb2RlTGVuZ3RoU3VtID0gMDtcbiAgICAgICAgICAgICAgZm9yIChqID0gMDsgaiA8IDE2OyBqKyssIG9mZnNldCsrKVxuICAgICAgICAgICAgICAgIGNvZGVMZW5ndGhTdW0gKz0gKGNvZGVMZW5ndGhzW2pdID0gZGF0YVtvZmZzZXRdKTtcbiAgICAgICAgICAgICAgdmFyIGh1ZmZtYW5WYWx1ZXMgPSBuZXcgVWludDhBcnJheShjb2RlTGVuZ3RoU3VtKTtcbiAgICAgICAgICAgICAgZm9yIChqID0gMDsgaiA8IGNvZGVMZW5ndGhTdW07IGorKywgb2Zmc2V0KyspXG4gICAgICAgICAgICAgICAgaHVmZm1hblZhbHVlc1tqXSA9IGRhdGFbb2Zmc2V0XTtcbiAgICAgICAgICAgICAgaSArPSAxNyArIGNvZGVMZW5ndGhTdW07XG5cbiAgICAgICAgICAgICAgKChodWZmbWFuVGFibGVTcGVjID4+IDQpID09PSAwID9cbiAgICAgICAgICAgICAgICBodWZmbWFuVGFibGVzREMgOiBodWZmbWFuVGFibGVzQUMpW2h1ZmZtYW5UYWJsZVNwZWMgJiAxNV0gPVxuICAgICAgICAgICAgICAgIGJ1aWxkSHVmZm1hblRhYmxlKGNvZGVMZW5ndGhzLCBodWZmbWFuVmFsdWVzKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGJyZWFrO1xuXG4gICAgICAgICAgY2FzZSAweEZGREQ6IC8vIERSSSAoRGVmaW5lIFJlc3RhcnQgSW50ZXJ2YWwpXG4gICAgICAgICAgICByZWFkVWludDE2KCk7IC8vIHNraXAgZGF0YSBsZW5ndGhcbiAgICAgICAgICAgIHJlc2V0SW50ZXJ2YWwgPSByZWFkVWludDE2KCk7XG4gICAgICAgICAgICBicmVhaztcblxuICAgICAgICAgIGNhc2UgMHhGRkRBOiAvLyBTT1MgKFN0YXJ0IG9mIFNjYW4pXG4gICAgICAgICAgICB2YXIgc2Nhbkxlbmd0aCA9IHJlYWRVaW50MTYoKTtcbiAgICAgICAgICAgIHZhciBzZWxlY3RvcnNDb3VudCA9IGRhdGFbb2Zmc2V0KytdO1xuICAgICAgICAgICAgdmFyIGNvbXBvbmVudHMgPSBbXSwgY29tcG9uZW50O1xuICAgICAgICAgICAgZm9yIChpID0gMDsgaSA8IHNlbGVjdG9yc0NvdW50OyBpKyspIHtcbiAgICAgICAgICAgICAgdmFyIGNvbXBvbmVudEluZGV4ID0gZnJhbWUuY29tcG9uZW50SWRzW2RhdGFbb2Zmc2V0KytdXTtcbiAgICAgICAgICAgICAgY29tcG9uZW50ID0gZnJhbWUuY29tcG9uZW50c1tjb21wb25lbnRJbmRleF07XG4gICAgICAgICAgICAgIHZhciB0YWJsZVNwZWMgPSBkYXRhW29mZnNldCsrXTtcbiAgICAgICAgICAgICAgY29tcG9uZW50Lmh1ZmZtYW5UYWJsZURDID0gaHVmZm1hblRhYmxlc0RDW3RhYmxlU3BlYyA+PiA0XTtcbiAgICAgICAgICAgICAgY29tcG9uZW50Lmh1ZmZtYW5UYWJsZUFDID0gaHVmZm1hblRhYmxlc0FDW3RhYmxlU3BlYyAmIDE1XTtcbiAgICAgICAgICAgICAgY29tcG9uZW50cy5wdXNoKGNvbXBvbmVudCk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICB2YXIgc3BlY3RyYWxTdGFydCA9IGRhdGFbb2Zmc2V0KytdO1xuICAgICAgICAgICAgdmFyIHNwZWN0cmFsRW5kID0gZGF0YVtvZmZzZXQrK107XG4gICAgICAgICAgICB2YXIgc3VjY2Vzc2l2ZUFwcHJveGltYXRpb24gPSBkYXRhW29mZnNldCsrXTtcbiAgICAgICAgICAgIHZhciBwcm9jZXNzZWQgPSBkZWNvZGVTY2FuKGRhdGEsIG9mZnNldCxcbiAgICAgICAgICAgICAgZnJhbWUsIGNvbXBvbmVudHMsIHJlc2V0SW50ZXJ2YWwsXG4gICAgICAgICAgICAgIHNwZWN0cmFsU3RhcnQsIHNwZWN0cmFsRW5kLFxuICAgICAgICAgICAgICBzdWNjZXNzaXZlQXBwcm94aW1hdGlvbiA+PiA0LCBzdWNjZXNzaXZlQXBwcm94aW1hdGlvbiAmIDE1KTtcbiAgICAgICAgICAgIG9mZnNldCArPSBwcm9jZXNzZWQ7XG4gICAgICAgICAgICBicmVhaztcbiAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgaWYgKGRhdGFbb2Zmc2V0IC0gM10gPT0gMHhGRiAmJlxuICAgICAgICAgICAgICBkYXRhW29mZnNldCAtIDJdID49I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lIDQ6XG4gICAgICAgICAgdGhpcy5jb2xvcnNwYWNlID0gQ29sb3JTcGFjZS5DWU1LO1xuICAgICAgICAgIGJyZWFrO1xuICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgIHRoaXMuY29sb3JzcGFjZSA9IENvbG9yU3BhY2UuVW5rbm93bjtcbiAgICAgIH1cbiAgICAgIGZvciAodmFyIGkgPSAwOyBpIDwgZnJhbWUuY29tcG9uZW50cy5sZW5ndGg7IGkrKykge1xuICAgICAgICB2YXIgY29tcG9uZW50ID0gZnJhbWUuY29tcG9uZW50c1tpXTtcbiAgICAgICAgaWYgKCFjb21wb25lbnQucXVhbnRpemF0aW9uVGFibGUgJiYgY29tcG9uZW50LnF1YW50aXphdGlvblRhYmxlSWQgIT09IG51bGwpXG4gICAgICAgICAgY29tcG9uZW50LnF1YW50aXphdGlvblRhYmxlID0gcXVhbnRpemF0aW9uVGFibGVzW2NvbXBvbmVudC5xdWFudGl6YXRpb25UYWJsZUlkXTtcbiAgICAgICAgdGhpcy5jb21wb25lbnRzLnB1c2goe1xuICAgICAgICAgIG91dHB1dDogYnVpbGRDb21wb25lbnREYXRhKGZyYW1lLCBjb21wb25lbnQpLFxuICAgICAgICAgIHNjYWxlWDogY29tcG9uZW50LmggLyBmcmFtZS5tYXhILFxuICAgICAgICAgIHNjYWxlWTogY29tcG9uZW50LnYgLyBmcmFtZS5tYXhWLFxuICAgICAgICAgIGJsb2Nrc1BlckxpbmU6IGNvbXBvbmVudC5ibG9ja3NQZXJMaW5lLFxuICAgICAgICAgIGJsb2Nrc1BlckNvbHVtbjogY29tcG9uZW50LmJsb2Nrc1BlckNvbHVtbixcbiAgICAgICAgICBiaXRDb252ZXJzaW9uOiBjb21wb25lbnQuYml0Q29udmVyc2lvblxuICAgICAgICB9KTtcbiAgICAgIH1cbiAgICB9LFxuICAgIGdldERhdGExNjogZnVuY3Rpb24gZ2V0RGF0YTE2KHdpZHRoLCBoZWlnaHQpIHtcbiAgICAgIGlmICh0a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G4gICAgICAgIHZhciBibG9ja3NQZXJDb2x1bW4gPSBjb21wb25lbnQuYmxvY2tzUGVyQ29sdW1uO1xuICAgICAgICB2YXIgc2FtcGxlc1BlckxpbmUgPSBibG9ja3NQZXJMaW5lIDw8IDM7XG5cbiAgICAgICAgdmFyIGosIGssIGxsID0gMDtcbiAgICAgICAgdmFyIGxpbmVPZmZzZXQgPSAwO1xuICAgICAgICBmb3IgKHZhciBibG9ja1JvdyA9IDA7IGJsb2NrUm93IDwgYmxvY2tzUGVyQ29sdW1uOyBibG9ja1JvdysrKSB7XG4gICAgICAgICAgdmFyIHNjYW5MaW5lID0gYmxvY2tSb3cgPDwgMztcbiAgICAgICAgICBmb3IgKHZhciBibG9ja0NvbCA9IDA7IGJsb2NrQ29sIDwgYmxvY2tzUGVyTGluZTsgYmxvY2tDb2wrKykge1xuICAgICAgICAgICAgdmFyIGJ1ZmZlck9mZnNldCA9IGdldEJsb2NrQnVmZmVyT2Zmc2V0KGNvbXBvbmVudCwgYmxvY2tSb3csIGJsb2NrQ29sKTtcbiAgICAgICAgICAgIHZhciBvZmZzZXQgPSAwLCBzYW1wbGUgPSBibG9ja0NvbCA8PCAzO1xuICAgICAgICAgICAgZm9yIChqID0gMDsgaiA8IDg7IGorKykge1xuICAgICAgICAgICAgICB2YXIgbGluZU9mZnNldCA9IChzY2FuTGluZSArIGopICogc2FtcGxlc1BlckxpbmU7XG4gICAgICAgICAgICAgIGZvciAoayA9IDA7IGsgPCA4OyBrKyspIHtcbiAgICAgICAgICAgICAgICBsaW5lRGF0YVtsaW5lT2Zmc2V0ICsgc2FtcGxlICsga10gPVxuICAgICAgICAgICAgICAgICAgY29tcG9uZW50Lm91dHB1dFtidWZmZXJPZmZzZXQgKyBvZmZzZXQrK107XG4gICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICBjb21wb25lbnRTY2FsZVggPSBjb21wb25lbnQuc2NhbGVYICogc2NhbGVYO1xuICAgICAgICBjb21wb25lbnRTY2FsZVkgPSBjb21wb25lbnQuc2NhbGVZICogc2NhbGVZO1xuICAgICAgICBvZmZzZXQgPSBpO1xuXG4gICAgICAgIHZhciBjeCwgY3k7XG4gICAgICAgIHZhciBpbmRleDtcbiAgICAgICAgZm9yICh5ID0gMDsgeSA8IGhlaWdodDsgeSsrKSB7XG4gICAgICAgICAgZm9yICh4ID0gMDsgeCA8IHdpZHRoOyB4KyspIHtcbiAgICAgICAgICAgIGN5ID0gMCB8ICh5ICogY29tcG9uZW50U2NhbGVZKTtcbiAgICAgICAgICAgIGN4ID0gMCB8ICh4ICogY29tcG9uZW50U2NhbGVYKTtcbiAgICAgICAgICAgIGluZGV4ID0gY3kgKiBzYW1wbGVzUGVyTGluZSArIGN4O1xuICAgICAgICAgICAgZGF0YVtvZmZzZXRdID0gbGluZURhdGFbaW5kZXhdO1xuICAgICAgICAgICAgb2Zmc2V0ICs9IG51bUNvbXBvbmVudHM7XG4gICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICB9XG4gICAgICByZXR1cm4gZGF0YTtcbiAgICB9LFxuICAgIGdldERhdGE6IGZ1bmN0aW9uIGdldERhdGEod2lkdGgsIGhlaWdodCkge1xuICAgICAgdmFyIHNjYWxlWCA9IHRoaXMud2lkdGggLyB3aWR0aCwgc2NhbGVZID0gdGhpcy5oZWlnaHQgLyBoZWlnaHQ7XG5cbiAgICAgIHZhciBjb21wb25lbnQsIGNvbXBvbmVudFNjYWxlWCwgY29tcG9uZW50U2NhbGVZO1xuICAgICAgdmFyIHgsIHksIGk7XG4gICAgICB2YXIgb2Zmc2V0ID0gMDtcbiAgICAgIHZhciBZLCBDYiwgQ3IsIEssIEMsIE0sIFllLCBSLCBHLCBCO1xuICAgICAgdmFyIGNvbG9yVHJhbnNmb3JtO1xuICAgICAgdmFyIG51bUNvbXBvbmVudHMgPSB0aGlzLmNvbXBvbmVudHMubGVuZ3RoO1xuICAgICAgdmFyIGRhdGFMZW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PSAwOyBibG9ja0NvbCA8IGJsb2Nrc1BlckxpbmU7IGJsb2NrQ29sKyspIHtcbiAgICAgICAgICAgIHZhciBidWZmZXJPZmZzZXQgPSBnZXRCbG9ja0J1ZmZlck9mZnNldChjb21wb25lbnQsIGJsb2NrUm93LCBibG9ja0NvbCk7XG4gICAgICAgICAgICB2YXIgb2Zmc2V0ID0gMCwgc2FtcGxlID0gYmxvY2tDb2wgPDwgMztcbiAgICAgICAgICAgIGZvciAoaiA9IDA7IGogPCA4OyBqKyspIHtcbiAgICAgICAgICAgICAgdmFyIGxpbmVPZmZzZXQgPSAoc2NhbkxpbmUgKyBqKSAqIHNhbXBsZXNQZXJMaW5lO1xuICAgICAgICAgICAgICBmb3IgKGsgPSAwOyBrIDwgODsgaysrKSB7XG4gICAgICAgICAgICAgICAgbGluZURhdGFbbGluZU9mZnNldCArIHNhbXBsZSArIGtdID1cbiAgICAgICAgICAgICAgICAgIGNvbXBvbmVudC5vdXRwdXRbYnVmZmVyT2Zmc2V0ICsgb2Zmc2V0KytdICogY29tcG9uZW50LmJpdENvbnZlcnNpb247XG4gICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICBjb21wb25lbnRTY2FsZVggPSBjb21wb25lbnQuc2NhbGVYICogc2NhbGVYO1xuICAgICAgICBjb21wb25lbnRTY2FsZVkgPSBjb21wb25lbnQuc2NhbGVZICogc2NhbGVZO1xuICAgICAgICBvZmZzZXQgPSBpO1xuXG4gICAgICAgIHZhciBjeCwgY3k7XG4gICAgICAgIHZhciBpbmRleDtcbiAgICAgICAgZm9yICh5ID0gMDsgeSA8IGhlaWdodDsgeSsrKSB7XG4gICAgICAgICAgZm9yICh4ID0gMDsgeCA8IHdpZHRoOyB4KyspIHtcbiAgICAgICAgICAgIGN5ID0gMCB8ICh5ICogY29tcG9uZW50U2NhbGVZKTtcbiAgICAgICAgICAgIGN4ID0gMCB8ICh4ICogY29tcG9uZ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W5ndGg7IGkgKz0gbnVtQ29tcG9uZW50cykge1xuICAgICAgICAgICAgICBZID0gZGF0YVtpICAgIF07XG4gICAgICAgICAgICAgIENiID0gZGF0YVtpICsgMV07XG4gICAgICAgICAgICAgIENyID0gZGF0YVtpICsgMl07XG5cbiAgICAgICAgICAgICAgUiA9IGNsYW1wVG9VaW50OChZIC0gMTc5LjQ1NiArIDEuNDAyICogQ3IpO1xuICAgICAgICAgICAgICBHID0gY2xhbXBUb1VpbnQ4KFkgKyAxMzUuNDU5IC0gMC4zNDQgKiBDYiAtIDAuNzE0ICogQ3IpO1xuICAgICAgICAgICAgICBCID0gY2xhbXBUb1VpbnQ4KFkgLSAyMjYuODE2ICsgMS43NzIgKiBDYik7XG5cbiAgICAgICAgICAgICAgZGF0YVtpICAgIF0gPSBSO1xuICAgICAgICAgICAgICBkYXRhW2kgKyAxXSA9IEc7XG4gICAgICAgICAgICAgIGRhdGFbaSArIDJdID0gQjtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICB9XG4gICAgICAgICAgYnJlYWs7XG4gICAgICAgIGNhc2UgNDpcbiAgICAgICAgICBpZiAoIXRoaXMuYWRvYmUpXG4gICAgICAgICAgICB0aHJvdyAnVW5zdXBwb3J0ZWQgY29sb3IgbW9kZSAoNCBjb21wb25lbnRzKSc7XG4gICAgICAgICAgLy8gVGhlIGRlZmF1bHQgdHJhbnNmb3JtIGZvciBmb3VyIGNvbXBvbmVudHMgaXMgZmFsc2VcbiAgICAgICAgICBjb2xvclRyYW5zZm9ybSA9IGZhbHNlO1xuICAgICAgICAgIC8vIFRoZSBhZG9iZSB0cmFuc2Zvcm0gbWFya2VyIG92ZXJyaWRlcyBhbnkgcHJldmlvdXMgc2V0dGluZ1xuICAgICAgICAgIGlmICh0aGlzLmFkb2JlICYmIHRoaXMuYWRvYmUudHJhbnNmb3JtQ29kZSlcbiAgICAgICAgICAgIGNvbG9yVHJhbnNmb3JtID0gdHJ1ZTtcbiAgICAgICAgICBlbHNlIGlmICh0eXBlb2YgdGhpcy5jb2xvclRyYW5zZm9ybSAhPT0gJ3VuZGVmaW5lZCcpXG4gICAgICAgICAgICBjb2xvclRyYW5zZm9ybSA9ICEhdGhpcy5jb2xvclRyYW5zZm9ybTtcblxuICAgICAgICAgIGlmIChjb2xvclRyYW5zZm9ybSkge1xuICAgICAgICAgICAgZm9yIChpID0gMDsgaSA8IGRhdGFMZW5ndGg7IGkgKz0gbnVtQ29tcG9uZW50cykge1xuICAgICAgICAgICAgICBZID0gZGF0YVtpXTtcbiAgICAgICAgICAgICAgQ2IgPSBkYXRhW2kgKyAxXTtcbiAgICAgICAgICAgICAgQ3IgPSBkYXRhW2kgKyAyXTtcblxuICAgICAgICAgICAgICBDID0gY2xhbXBUb1VpbnQ4KDQzNC40NTYgLSBZIC0gMS40MDIgKiBDcik7XG4gICAgICAgICAgICAgIE0gPSBjbGFtcFRvVWludDgoMTE5LjU0MSAtIFkgKyAwLjM0NCAqIENiICsgMC43MTQgKiBDcik7XG4gICAgICAgICAgICAgIFkgPSBjbGFtcFRvVWludDgoNDgxLjgxNiAtIFkgLSAxLjc3MiAqIENiKTtcblxuICAgICAgICAgICAgICBkYXRhW2kgICAgXSA9IEM7XG4gICAgICAgICAgICAgIGRhdGFbaSArIDFdID0gTTtcbiAgICAgICAgICAgICAgZGF0YVtpICsgMl0gPSBZO1xuICAgICAgICAgICAgICAvLyBLIGlzIHVuY2hhbmdlZFxuICAgICAgICAgICAgfVxuICAgICAgICAgIH1cbiAgICAgICAgICBicmVhaztcbiAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICB0aHJvdyAnVW5zdXBwb3J0ZWQgY29sb3IgbW9kZSc7XG4gICAgICB9XG4gICAgICByZXR1cm4gZGF0YTtcbiAgICB9XG4gIH07XG5cbiAgcmV0dXJuIGNvbnN0cnVjdG9yO1xufSkoKTtcblxudmFyIG1vZHVsZVR5cGUgPSB0eXBlb2YgbW9kdWxlO1xuaWYgKChtb2R1bGVUeXBlICE9PSAndW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ndGgpIHtcbiAgICAgICAgdmFyIGhlYWRlclNpemUgPSA4O1xuICAgICAgICB2YXIgbGJveCA9IHJlYWRVaW50MzIoZGF0YSwgcG9zaXRpb24pO1xuICAgICAgICB2YXIgdGJveCA9IHJlYWRVaW50MzIoZGF0YSwgcG9zaXRpb24gKyA0KTtcbiAgICAgICAgcG9zaXRpb24gKz0gaGVhZGVyU2l6ZTtcbiAgICAgICAgaWYgKGxib3ggPT09IDEpIHtcbiAgICAgICAgICAvLyBYTEJveDogcmVhZCBVSW50NjQgYWNjb3JkaW5nIHRvIHNwZWMuXG4gICAgICAgICAgLy8gSmF2YVNjcmlwdCdzIGludCBwcmVjaXNpb24gb2YgNTMgYml0IHNob3VsZCBiZSBzdWZmaWNpZW50IGhlcmUuXG4gICAgICAgICAgbGJveCA9IHJlYWRVaW50MzIoZGF0YSwgcG9zaXRpb24pICogNDI5NDk2NzI5NiArXG4gICAgICAgICAgICAgICAgIHJlYWRVaW50MzIoZGF0YSwgcG9zaXRpb24gKyA0KTtcbiAgICAgICAgICBwb3NpdGlvbiArPSA4O1xuICAgICAgICAgIGhlYWRlclNpemUgKz0gODtcbiAgICAgICAgfVxuICAgICAgICBpZiAobGJveCA9PT0gMCkge1xuICAgICAgICAgIGxib3ggPSBsZW5ndGggLSBwb3NpdGlvbiArIGhlYWRlclNpemU7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKGxib3ggPCBoZWFkZXJTaXplKSB7XG4gICAgICAgICAgdGhyb3cgbmV3IEVycm9yKCdKUFggRXJyb3I6IEludmFsaWQgYm94IGZpZWxkIHNpemUnKTtcbiAgICAgICAgfVxuICAgICAgICB2YXIgZGF0YUxlbmd0aCA9IGxib3ggLSBoZWFkZXJTaXplO1xuICAgICAgICB2YXIganVtcERhdGFMZW5ndGggPSB0cnVlO1xuICAgICAgICBzd2l0Y2ggKHRib3gpIHtcbiAgICAgICAgICBjYXNlIDB4NkE3MDMyNjg6IC8vICdqcDJoJ1xuICAgICAgICAgICAganVtcERhdGFMZW5ndGggPSBmYWxzZTsgLy8gcGFyc2luZyBjaGlsZCBib3hlc1xuICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgY2FzZSAweDYzNkY2QzcyOiAvLyAnY29scidcbiAgICAgICAgICAgIC8vIENvbG9yc3BhY2VzIGFyZSBub3QgdXNlZCwgdGhlIENTIGZyb20gdGhlIFBERiBpcyB1c2VkLlxuICAgICAgICAgICAgdmFyIG1ldGhvZCA9IGRhdGFbcG9zaXRpb25dO1xuICAgICAgICAgICAgdmFyIHByZWNlZGVuY2UgPSBkYXRhW3Bvc2l0aW9uICsgMV07XG4gICAgICAgICAgICB2YXIgYXBwcm94aW1hdGlvbiA9IGRhdGFbcG9zaXRpb24gKyAyXTtcbiAgICAgICAgICAgIGlmIChtZXRob2QgPT09IDEpIHtcbiAgICAgICAgICAgICAgLy8gZW51bWVyYXRlZCBjb2xvcnNwYWNlXG4gICAgICAgICAgICAgIHZhciBjb2xvcnNwYWNlID0gcmVhZFVpbnQzMihkYXRhLCBwb3NpdGlvbiArIDMpO1xuICAgICAgICAgICAgICBzd2l0Y2ggKGNvbG9yc3BhY2UpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE2OiAvLyB0aGlzIGluZGljYXRlcyBhIHNSR0IgY29sb3JzcGFjZVxuICAgICAgICAgICAgICAgIGNhc2UgMTc6IC8vIHRoaXMgaW5kaWNhdGVzIGEgZ3JheXNjYWxlIGNvbG9yc3BhY2VcbiAgICAgICAgICAgICAgICBjYXNlIDE4OiAvLyB0aGlzIGluZGljYXRlcyBhIFlVViBjb2xvcnNwYWNlXG4gICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgd2FybignVW5rbm93biBjb2xvcnNwYWNlICcgKyBjb2xvcnNwYWNlKTtcbiAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9IGVsc2UgaWYgKG1ldGhvZCA9PT0gMikge1xuICAgICAgICAgICAgICBpbmZvKCdJQ0MgcHJvZmlsZSBub3Qgc3VwcG9ydGVkJyk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBicmVhaztcbiAgICAgICAgICBjYXNlIDB4NkE3MDMyNjM6IC8vICdqcDJjJ1xuICAgICAgICAgICAgdGhpcy5wYXJzZUNvZGVzdHJlYW0oZGF0YSwgcG9zaXRpb24sIHBvc2l0aW9uICsgZGF0YUxlbmd0aCk7XG4gICAgICAgICAgICBicmVhaztcbiAgICAgICAgICBjYXNlIDB4NkE1MDIwMjA6IC8vICdqUFxcMDI0XFwwMjQnXG4gICAgICAgICAgICBpZiAoMHgwZDBhODcwYSAhPT0gcmVhZFVpbnQzMihkYXRhLCBwb3NpdGlvbikpIHtcbiAgICAgICAgICAgICAgd2FybignSW52YWxpZCBKUDIgc2lnbmF0dXJlJyk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAvLyBUaGUgZm9sbG93aW5nIGhlYWRlciB0eXBlcyBhcmUgdmFsaWQgYnV0IGN1cnJlbnRseSBub3QgdXNlZDpcbiAgICAgICAgICBjYXNlIDB4NkE1MDFBMUE6IC8vICdqUFxcMDMyXFwwMzInXG4gICAgICAgICAgY2FzZSAweDY2NzQ3OTcwOiAvLyAnZnR5cCdcbiAgICAgICAgICBjYXNlIDB4NzI3MjY1NzE6IC8vICdycmVxJ1xuICAgICAgICAgIGNhc2UgMHg3MjY1NzMyMDogLy8gJ3JlcyAnXG4gICAgICAgICAgY2FzZSAweDY5Njg2NDcyOiAvLyAnaWhkcidcbiAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICB2YXIgaGVhZGVyVHlwZSA9IFN0cmluZy5mcm9tQ2hhckNvZGUoKHRib3ggPj4gMjQpICYgMHhGRixcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAodGJveCA+PiAxNikgJiAweEZGLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh0Ym94ID4+IDgpICYgMHhGRixcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0Ym94ICYgMHhGRik7XG4gICAgICAgICAgICB3YXJuKCdVbnN1cHBvcnRlZCBoZWFkZXIgdHlwZSAnICsgdGJveCArICcgKCcgKyBoZWFkZXJUeXBlICsgJyknKTtcbiAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICB9XG4gICAgICAgIGlmIChqdW1wRGF0YUxlbmd0aCkge1xuICAgICAgICAgIHBvc2l0aW9uICs9IGRhdGFMZW5ndGg7XG4gICAgICAgIH1cbiAgICAgIH1cbiAgICB9LFxuICAgIHBhcnNlSW1hZ2VQcm9wZXJ0aWVzOiBmdW5jdGlvbiBKcHhJbWFnZV9wYXJzZUltYWdlUHJvcGVydGllcyhzdHJlYW0pIHtcbiAgICAgIHZhciBuZXdCeXRlID0gc3RyZWFtLmdldEJ5dGUoKTtcbiAgICAgIHdoaWxlIChuZXdCeXRlID49IDApIHtcbiAgICAgICAgdmFyIG9sZEJ5dGUgPSBuZXdCeXRlO1xuICAgICAgICBuZXdCeXRlID0gc3RyZWFtLmdldEJ5dGUoKTtcbiAgICAgICAgdmFyIGNvZGUgPSAob2xkQnl0ZSA8PCA4KSB8IG5ld0J5dGU7XG4gICAgICAgIC8vIEltYWdlIGFuZCB0aWxlIHNpemUgKFNJWilcbiAgICAgICAgaWYgKGNvZGUgPT09IDB4RkY1MSkge1xuICAgICAgICAgIHN0cmVhbS5za2lwKDQpO1xuICAgICAgICAgIHZhciBYc2l6ID0gc3RyZWFtLmdldEludDMyKCkgPj4+IDA7IC8vIEJ5dGUgNFxuICAgICAgICAgIHZhciBZc2l6ID0gc3RyZWFtLmdldEludDMyKCkgPj4+IDA7IC8vIEJ5dGUgOFxuICAgICAgICAgIHZhciBYT3Npe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GosIHNxY2QsIHNwcWNkcywgc3BxY2RTaXplLCBzY2FsYXJFeHBvdW5kZWQsIHRpbGU7XG4gICAgICAgICAgc3dpdGNoIChjb2RlKSB7XG4gICAgICAgICAgICBjYXNlIDB4RkY0RjogLy8gU3RhcnQgb2YgY29kZXN0cmVhbSAoU09DKVxuICAgICAgICAgICAgICBjb250ZXh0Lm1haW5IZWFkZXIgPSB0cnVlO1xuICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIGNhc2UgMHhGRkQ5OiAvLyBFbmQgb2YgY29kZXN0cmVhbSAoRU9DKVxuICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIGNhc2UgMHhGRjUxOiAvLyBJbWFnZSBhbmQgdGlsZSBzaXplIChTSVopXG4gICAgICAgICAgICAgIGxlbmd0aCA9IHJlYWRVaW50MTYoZGF0YSwgcG9zaXRpb24pO1xuICAgICAgICAgICAgICB2YXIgc2l6ID0ge307XG4gICAgICAgICAgICAgIHNpei5Yc2l6ID0gcmVhZFVpbnQzMihkYXRhLCBwb3NpdGlvbiArIDQpO1xuICAgICAgICAgICAgICBzaXouWXNpeiA9IHJlYWRVaW50MzIoZGF0YSwgcG9zaXRpb24gKyA4KTtcbiAgICAgICAgICAgICAgc2l6LlhPc2l6ID0gcmVhZFVpbnQzMihkYXRhLCBwb3NpdGlvbiArIDEyKTtcbiAgICAgICAgICAgICAgc2l6LllPc2l6ID0gcmVhZFVpbnQzMihkYXRhLCBwb3NpdGlvbiArIDE2KTtcbiAgICAgICAgICAgICAgc2l6LlhUc2l6ID0gcmVhZFVpbnQzMihkYXRhLCBwb3NpdGlvbiArIDIwKTtcbiAgICAgICAgICAgICAgc2l6LllUc2l6ID0gcmVhZFVpbnQzMihkYXRhLCBwb3NpdGlvbiArIDI0KTtcbiAgICAgICAgICAgICAgc2l6LlhUT3NpeiA9IHJlYWRVaW50MzIoZGF0YSwgcG9zaXRpb24gKyAyOCk7XG4gICAgICAgICAgICAgIHNpei5ZVE9zaXogPSByZWFkVWludDMyKGRhdGEsIHBvc2l0aW9uICsgMzIpO1xuICAgICAgICAgICAgICB2YXIgY29tcG9uZW50c0NvdW50ID0gcmVhZFVpbnQxNihkYXRhLCBwb3NpdGlvbiArIDM2KTtcbiAgICAgICAgICAgICAgc2l6LkNzaXogPSBjb21wb25lbnRzQ291bnQ7XG4gICAgICAgICAgICAgIHZhciBjb21wb25lbnRzID0gW107XG4gICAgICAgICAgICAgIGogPSBwb3NpdGlvbiArIDM4O1xuICAgICAgICAgICAgICBmb3IgKHZhciBpID0gMDsgaSA8IGNvbXBvbmVudHNDb3VudDsgaSsrKSB7XG4gICAgICAgICAgICAgICAgdmFyIGNvbXBvbmVudCA9IHtcbiAgICAgICAgICAgICAgICAgIHByZWNpc2lvbjogKGRhdGFbal0gJiAweDdGKSArIDEsXG4gICAgICAgICAgICAgICAgICBpc1NpZ25lZDogISEoZGF0YVtqXSAmIDB4ODApLFxuICAgICAgICAgICAgICAgICAgWFJzaXo6IGRhdGFbaiArIDFdLFxuICAgICAgICAgICAgICAgICAgWVJzaXo6IGRhdGFbaiArIDFdXG4gICAgICAgICAgICAgICAgfTtcbiAgICAgICAgICAgICAgICBjYWxjdWxhdGVDb21wb25lbnREaW1lbnNpb25zKGNvbXBvbmVudCwgc2l6KTtcbiAgICAgICAgICAgICAgICBjb21wb25lbnRzLnB1c2goY29tcG9uZW50KTtcbiAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICBjb250ZXh0LlNJWiA9IHNpejtcbiAgICAgICAgICAgICAgY29udGV4dC5jb21wb25lbnRzID0gY29tcG9uZW50cztcbiAgICAgICAgICAgICAgY2FsY3VsYXRlVGlsZUdyaWRzKGNvbnRleHQsIGNvbXBvbmVudHMpO1xuICAgICAgICAgICAgICBjb250ZXh0LlFDQyA9IFtdO1xuICAgICAgICAgICAgICBjb250ZXh0LkNPQyA9IFtdO1xuICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIGNhc2UgMHhGRjVDOiAvLyBRdWFudGl6YXRpb24gZGVmYXVsdCAoUUNEKVxuICAgICAgICAgICAgICBsZW5ndGggPSByZWFkVWludDE2KGRhdGEsIHBvc2l0aW9uKTtcbiAgICAgICAgICAgICAgdmFyIHFjZCA9IHt9O1xuICAgICAgICAgICAgICBqID0gcG9zaXRpb24gKyAyO1xuICAgICAgICAgICAgICBzcWNkID0gZGF0YVtqKytdO1xuICAgICAgICAgICAgICBzd2l0Y2ggKHNxY2QgJiAweDFGKSB7XG4gICAgICAgICAgICAgICAgY2FzZSAwOlxuICAgICAgICAgICAgICAgICAgc3BxY2RTaXplID0gODtcbiAgICAgICAgICAgICAgICAgIHNjYWxhckV4cG91bmRlZCA9IHRydWU7XG4gICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICBzcHFjZFNpemUgPSAxNjtcbiAgICAgICAgICAgICAgICAgIHNjYWxhckV4cG91bmRlZCA9IGZhbHNlO1xuICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAyOlxuICAgICAgICAgICAgICAgICAgc3BxY2RTaXplID0gMTY7XG4gICAgICAgICAgICAgICAgICBzY2FsYXJFeHBvdW5kZWQgPSB0cnVlO1xuICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcignSlBYIEVycm9yOiBJbnZhbGlkIFNRY2QgdmFsdWUgJyArIHNxY2QpO1xuICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgIHFjZC5ub1F1YW50aXphdGlvbiA9IChzcHFjZFNpemUgPT09IDgpO1xuICAgICAgICAgICAgICBxY2Quc2NhbGFyRXhwb3VuZGVkID0gc2NhbGFyRXhwb3VuZGVkO1xuICAgICAgICAgICAgICBxY2QuZ3VhcmRCaXRzID0gc3FjZCA+PiA1O1xuICAgICAgICAgICAgICBzcHFjZHMgPSBbXTtcbiAgICAgICAgICAgICAgd2hpbGUgKGogPCBsZW5ndGggKyBwb3NpdGlvbikge1xuICAgICAgICAgICAgICAgIHZhciBzcHFjZCA9IHt9O1xuICAgICAgICAgICAgICAgIGlmIChzcHFjZFNpemUgPT09IDgpIHtcbiAgICAgICAgICAgICAgICAgIHNwcWNkLmVwc2lsb24gPSBkYXRhW2orK10gPj4gMztcbiAgICAgICAgICAgICAgICAgIHNwcWNkLm11ID0gMDtcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgc3BxY2QuZXBzaWxvbiA9IGRhdGFbal0gPj4gMztcbiAgICAgICAgICAgICAgICAgIHNwcWNkLm11ID0gKChkYXRhW2pdICYgMHg3KSA8PCA4KSB8IGRhdGFbaiArIDFdO1xuICAgICAgICAgICAgICAgICAgaiArPSAyO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBzcHFjZHMucHVzaChzcHFjZCk7XG4gICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgcWNkLlNQcWNkcyA9IHNwcWNkcztcbiAgICAgICAgICAgICAgaWYgKGNvbnRleHQubWFpbkhlYWRlcikge1xuICAgICAgICAgICAgICAgIGNvbnRleHQuUUNEID0gcWNkO1xuICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIGNvbnRleHQuY3VycmVudFRpbGUuUUNEID0gcWNkO1xuICAgICAgICAgICAgICAgIGNvbnRleHQuY3VycmVudFRpbGUuUUNDID0gW107XG4gICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICBjYXNlIDB4RkY1RDogLy8gUXVhbnRpemF0aW9uIGNvbXBvbmVudCAoUUNDKVxuICAgICAgICAgICAgICBsZW5ndGggPSByZWFkVWludDE2KGRhdGEsIHBvc2l0aW9uKTtcbiAgICAgICAgICAgICAgdmFyIHFjYyA9IHt9O1xuICAgICAgICAgICAgICBqID0gcG9zaXRpb24gKyAyO1xuICAgICAgICAgICAgICB2YXIgY3FjYztcbiAgICAgICAgICAgICAgaWYgKGNvbnRleHQuU0laLkNzaXogPCAyNTcpIHtcbiAgICAgICAgICAgICAgICBjcWNjID0gZGF0YVtqKytdO1xuICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIGNxY2MgPSByZWFkVWludDE2KGRhdGEsIGopO1xuICAgICAgICAgICAgICAgIGogKz0gMjtcbiAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICBzcWNkID0gZGF0YVtqKytdO1xuICAgICAgICAgICAgICBzd2l0Y2ggKHNxY2QgJiAweDFGKSB7XG4gICAgICAgICAgICAgICAgY2FzZSAwOlxuICAgICAgICAgICAgICAgICAgc3BxY2RTaXplID0gODtcbiAgICAgICAgICAgICAgICAgIHNjYWxhckV4cG91bmRlZCA9IHRydWU7XG4gICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICBzcHFjZFNpemUgPSAxNjtcbiAgICAgICAgICAgICAgICAgIHNjYWxhckV4cG91bmRlZCA9IGZhbHNlO1xuICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAyOlxuICAgICAgICAgICAgICAgICAgc3BxY2RTaXplID0gMTY7XG4gICAgICAgICAgICAgICAgICBzY2FsYXJFeHBvdW5kZWQgPSB0cnVlO1xuICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcignSlBYIEVycm9yOiBJbnZhbGlkIFNRY2QgdmFsdWUgJyArIHNxY2QpO1xuICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgIHFjYy5ub1F1YW50aXphdGlvbiA9IChzcHFjZFNpemUgPT09IDgpO1xuICAgICAgICAgICAgICBxY2Muc2NhbGFyRXhwb3VuZGVkID0gc2NhbGFyRXhwb3VuZGVkO1xuICAgICAgICAgICAgICBxY2MuZ3VhcmRCaXRzID0gc3FjZCA+PiA1O1xuICAgICAgICAgICAgICBzcHFjZHMgPSBbXTtcbiAgICAgICAgICAgICAgd2hpbGUgKGogPCAobGVuZ3RoICsgcG9zaXRpb24pKSB7XG4gICAgICAgICAgICAgICAgc3BxY2QgPSB7fTtcbiAgICAgICAgICAgICAgICBpZiAoc3BxY2RTaXplID09PSA4KSB7XG4gICAgICAgICAgICAgICAgICBzcHFjZC5lcHNpbG9uID0gZGF0YVtqKytdID4+IDM7XG4gICAgICAgICAgICAgICAgICBzcHFjZC5tdSA9IDA7XG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgIHNwcWNkLmVwc2lsb24gPSBkYXRhW2pdID4+IDM7XG4gICAgICAgICAgICAgICAgICBzcHFjZC5tdSA9ICgoZGF0YVtqXSAmIDB4NykgPDwgOCkgfCBkYXRhW2ogKyAxXTtcbiAgICAgICAgICAgICAgICAgIGogKz0gMjtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgc3BxY2RzLnB1c2goc3BxY2QpO1xuICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgIHFjYy5TUHFjZHMgPSBzcHFjZHM7XG4gICAgICAgICAgICAgIGlmIChjb250ZXh0Lm1haW5IZWFkZXIpIHtcbiAgICAgICAgICAgICAgICBjb250ZXh0LlFDQ1tjcWNjXSA9IHFjYztcbiAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICBjb250ZXh0LmN1cnJlbnRUaWxlLlFDQ1tjcWNjXSA9IHFjYztcbiAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIGNhc2UgMHhGRjUyOiAvLyBDb2Rpbmcgc3R5bGUgZGVmYXVsdCAoQ09EKVxuICAgICAgICAgICAgICBsZW5ndGggPSByZWFkVWludDE2KGRhdGEsIHBvc2l0aW9uKTtcbiAgICAgICAgICAgICAgdmFyIGNvZCA9IHt9O1xuICAgICAgICAgICAgICBqID0gcG9zaXRpb24gKyAyO1xuICAgICAgICAgICAgICB2YXIgc2NvZCA9IGRhdGFbaisrXTtcbiAgICAgICAgICAgICAgY29kLmVudHJvcHlDb2RlcldpdGhDdXN0b21QcmVjaW5jdHMgPSAhIShzY29kICYgMSk7XG4gICAgICAgICAgICAgIGNvZC5zb3BNYXJrZXJVc2VkID0gISEoc2NvZCAmIDIpO1xuICAgICAgICAgICAgICBjb2QuZXBoTWFya2VyVXNlZCA9ICEhKHNjb2QgJiA0KTtcbiAgICAgICAgICAgICAgY29kLnByb2dyZXNzaW9uT3JkZXIgPSBkYXRhW2orK107XG4gICAgICAgICAgICAgIGNvZC5sYXllcnNDb3VudCA9IHJlYWRVaW50MTYoZGF0YSwgaik7XG4gICAgICAgICAgICAgIGogKz0gMjtcbiAgICAgICAgICAgICAgY29kLm11bHRpcGxlQ29tcG9uZW50VHJhbnNmb3JtID0gZGF0YVtqKytdO1xuXG4gICAgICAgICAgICAgIGNvZC5kZWNvbXBvc2l0aW9uTGV2ZWxzQ291bnQgPSBkYXRhW2orK107XG4gICAgICAgICAgICAgIGNvZC54Y2IgPSAoZGF0YVtqKytdICYgMHhGKSArIDI7XG4gICAgICAgICAgICAgIGNvZC55Y2IgPSAoZGF0YVtqKytdICYgMHhGKSArIDI7XG4gICAgICAgICAgICAgIHZhciBibG9ja1N0eWxlID0gZGF0YVtqKytdO1xuICAgICAgICAgICAgICBjb2Quc2VsZWN0aXZlQXJpdGhtZXRpY0NvZGluZ0J5cGFzcyA9ICEhKGJsb2NrU3R5bGUgJiAxKTtcbiAgICAgICAgICAgICAgY29kLnJlc2V0Q29udGV4dFByb2JhYmlsaXRpZXMgPSAhIShibG9ja1N0eWxlICYgMik7XG4gICAgICAgICAgICAgIGNvZC50ZXJtaW5hdGlvbk9uRWFjaENvZGluZ1Bhc3MgPSAhIShibG9ja1N0eWxlICYgNCk7XG4gICAgICAgICAgICAgIGNvZC52ZXJ0aWNhbHlTdHJpcGUgPSAhIShibG9ja1N0eWxlICYgOCk7XG4gICAgICAgICAgICAgIGNvZC5wcmVkaWN0YWJsZVRlcm1pbmF0aW9uID0gISEoYmxvY2tTdHlsZSAmIDE2KTtcbiAgICAgICAgICAgICAgY29kLnNlZ21lbnRhdGlvblN5bWJvbFVzZWQgPSAhIShibG9ja1N0eWxlICYgMzIpO1xuICAgICAgICAgICAgICBjb2QucmV2ZXJzaWJsZVRyYW5zZm9ybWF0aW9uID0gZGF0YVtqKytdO1xuICAgICAgICAgICAgICBpZiAoY29kLmVudHJvcHlDb2RlcldpdGhDdXN0b21QcmVjaW5jdHMpIHtcbiAgICAgICAgICAgICAgICB2YXIgcHJlY2luY3RzU2l6ZXMgPSBbXTtcbiAgICAgICAgICAgICAgICB3aGlsZSAoaiA8IGxlbmd0aCArIHBvc2l0aW9uKSB7XG4gICAgICAgICAgICAgICAgICB2YXIgcHJlY2luY3RzU2l6ZSA9IGRhdGFbaisrXTtcbiAgICAgICAgICAgICAgICAgIHByZWNpbmN0c1NpemVzLnB1c2goe1xuICAgICAgICAgICAgICAgICAgICBQUHg6IHByZWNpbmN0c1NpemUgJiAweEYsXG4gICAgICAgICAgICAgICAgICAgIFBQeTogcHJlY2luY3RzU2l6ZSA+PiA0XG4gICAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgY29kLnByZWNpbmN0c1NpemVzID0gcHJlY2luY3RzU2l6ZXM7XG4gICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgdmFyIHVuc3VwcG9ydGVkID0gW107XG4gICAgICAgICAgICAgIGlmIChjb2Quc2VsZWN0aXZlQXJpdGhtZXRpY0NvZGluZ0J5cGFzcykge1xuICAgICAgICAgICAgICAgIHVuc3VwcG9ydGVkLnB1c2goJ3NlbGVjdGl2ZUFyaXRobWV0aWNDb2RpbmdCeXBhc3MnKTtcbiAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICBpZiAoY29kLnJlc2V0Q29udGV4dFByb2JhYmlsaXRpZXMpIHtcbiAgICAgICAgICAgICAgICB1bnN1cHBvcnRlZC5wdXNoKCdyZXNldENvbnRleHRQcm9iYWJpbGl0aWVzJyk7XG4gICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgaWYgKGNvZC50ZXJtaW5hdGlvbk9uRWFjaENvZGluZ1Bhc3MpIHtcbiAgICAgICAgICAgICAgICB1bnN1cHBvcnRlZC5wdXNoKCd0ZXJtaW5hdGlvbk9uRWFjaENvZGluZ1Bhc3MnKTtcbiAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICBpZiAoY29kLnZlcnRpY2FseVN0cmlwZSkge1xuICAgICAgICAgICAgICAgIHVuc3VwcG9ydGVkLnB1c2goJ3ZlcnRpY2FseVN0cmlwZScpO1xuICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgIGlmIChjb2QucHJlZGljdGFibGVUZXJtaW5hdGlvbikge1xuICAgICAgICAgICAgICAgIHVuc3VwcG9ydGVkLnB1c2goJ3ByZWRpY3RhYmxlVGVybWluYXRpb24nKTtcbiAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICBpZiAodW5zdXBwb3J0ZWQubGVuZ3RoID4gMCkge1xuICAgICAgICAgICAgICAgIGRvTm90UmVjb3ZlciA9IHRydWU7XG4gICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKCdKUFggRXJyb3I6IFVuc3VwcG9ydGVkIENPRCBvcHRpb25zICgnICtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdW5zdXBwb3J0ZWQuam9pbignLCAnKSArICcpJyk7XG4gICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgaWYgKGNvbnRleHQubWFpbkhlYWRlcikge1xuICAgICAgICAgICAgICAgIGNvbnRleHQuQ09EID0gY29kO1xuICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIGNvbnRleHQuY3VycmVudFRpbGUuQ09EID0gY29kO1xuICAgICAgICAgICAgICAgIGNvbnRleHQuY3VycmVudFRpbGUuQ09DID0gW107XG4gICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICBjYXNlIDB4RkY5MDogLy8gU3RhcnQgb2YgdGlsZS1wYXJ0IChTT1QpXG4gICAgICAgICAgICAgIGxlbmd0aCA9IHJlYWRVaW50MTYoZGF0YSwgcG9zaXRpb24pO1xuICAgICAgICAgICAgICB0aWxlID0ge307XG4gICAgICAgICAgICAgIHRpbGUuaW5kZXggPSByZWFkVWludDE2KGRhdGEsIHBvc2l0aW9uICsgMik7XG4gICAgICAgICAgICAgIHRpbGUubGVuZ3RoID0gcmVhZFVpbnQzMihkYXRhLCBwb3NpdGlvbiArIDQpO1xuICAgICAgICAgICAgICB0aWxlLmRhdGFFbmQgPSB0aWxlLmxlbmd0aCArIHBvc2l0aW9uIC0gMjtcbiAgICAgICAgICAgICAgdGlsZS5wYXJ0SW5kZXggPSBkYXRhW3Bvc2l0aW9uICsgOF07XG4gICAgICAgICAgICAgIHRpbGUucGFydHNDb3VudCA9IGRhdGFbcG9zaXRpb24gKyA5XTtcblxuICAgICAgICAgICAgICBjb250ZXh0Lm1haW5IZWFkZXIgPSBmYWxzZTtcbiAgICAgICAgICAgICAgaWYgKHRpbGUucGFydEluZGV4ID09PSAwKSB7XG4gICAgICAgICAgICAgICAgLy8gcmVzZXQgY29tcG9uZW50IHNwZWNpZmljIHNldHRpbmdzXG4gICAgICAgICAgICAgICAgdGlsZS5DT0QgPSBjb250ZXh0LkNPRDtcbiAgICAgICAgICAgICAgICB0aWxlLkNPQyA9IGNvbnRleHQuQ09DLnNsaWNlKDApOyAvLyBjbG9uZSBvZiB0aGUgZ2xvYmFsIENPQ1xuICAgICAgICAgICAgICAgIHRpbGUuUUNEID0gY29udGV4dC5RQ0Q7XG4gICAgICAgICAgICAgICAgdGlsZS5RQ0MgPSBjb250ZXh0LlFDQy5zbGljZSgwKTsgLy8gY2xvbmUgb2YgdGhlIGdsb2JhbCBDT0NcbiAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICBjb250ZXh0LmN1cnJlbnRUaWxlID0gdGlsZTtcbiAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICBjYXNlIDB4RkY5MzogLy8gU3RhcnQgb2YgZGF0YSAoU09EKVxuICAgICAgICAgICAgICB0aWxlID0gY29udGV4dC5jdXJyZW50VGlsZTtcbiAgICAgICAgICAgICAgaWYgKHRpbGUucGFydEluZGV4ID09PSAwKSB7XG4gICAgICAgICAgICAgICAgaW5pdGlhbGl6ZVRpbGUoY29udGV4dCwgdGlsZS5pbmRleCk7XG4gICAgICAgICAgICAgICAgYnVpbGRQYWNrZXRzKGNvbnRleHQpO1xuICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgLy8gbW92aW5nIHRvIHRoZSBlbmQgb2YgdGhlIGRhdGFcbiAgICAgICAgICAgICAgbGVuZ3RoID0gdGlsZS5kYXRhRW5kIC0gcG9zaXRpb247XG4gICAgICAgICAgICAgIHBhcnNlVGlsZVBhY2tldHMoY29udGV4dCwgZGF0YSwgcG9zaXRpb24sIGxlbmd0aCk7XG4gICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgY2FzZSAweEZGNTU6IC8vIFRpbGUtcGFydCBsZW5ndGhzLCBtYWluIGhlYWRlciAoVExNKVxuICAgICAgICAgICAgY2FzZSAweEZGNTc6IC8vIFBhY2tldCBsZW5ndGgsIG1haW4gaGVhZGVyIChQTE0pXG4gICAgICAgICAgICBjYXNlIDB4RkY1ODogLy8gUGFja2V0IGxlbmd0aCwgdGlsZS1wYXJ0IGhlYWRlciAoUExUKVxuICAgICAgICAgICAgY2FzZSAweEZGNjQ6IC8vIENvbW1lbnQgKENPTSlcbiAgICAgICAgICAgICAgbGVuZ3RoID0gcmVhZFVpbnQxNihkYXRhLCBwb3NpdGlvbik7XG4gICAgICAgICAgICAgIC8vIHNraXBwaW5nIGNvbnRlbnRcbiAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICBjYXNlIDB4RkY1MzogLy8gQ29kaW5nIHN0eWxlIGNvbXBvbmVudCAoQ09DKVxuICAgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoJ0pQWCBFcnJvcjogQ29kZXN0cmVhbSBjb2RlIDB4RkY1MyAoQ09DKSBpcyAnICtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdub3QgaW1wbGVtZW50ZWQnKTtcbiAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcignSlBYIEVycm9yOiBVbmtub3duIGNvZGVzdHJlYW0gY29kZTogJyArXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb2RlLnRvU3RyaW5nKDE2KSk7XG4gICAgICAgICAgfVxuICAgICAgICAgIHBvc2l0aW9uICs9IGxlbmd0aDtcbiAgICAgICAgfVxuICAgICAgfSBjYXRjaCAoZSkge1xuICAgICAgICBpZiAoZG9Ob3RSZWNvdmVyIHx8IHRoaXMuZmFpbE9uQ29ycnVwdGVkSW1hZ2UpIHtcbiAgICAgICAgICB0aHJvdyBlO1xuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgIHdhcm4oJ1RyeWluZyB0byByZWNvdmVyIGZyb20gJyArIGUubWVzc2FnZSk7XG4gICAgICAgIH1cbiAgICAgIH1cbiAgICAgIHRoaXMudGlsZXMgPSB0cmFuc2Zvcm1Db21wb25lbnRzKGNvbnRleHQpO1xuICAgICAgdGhpcy53aWR0aCA9IGNvbnRleHQuU0laLlhzaXogLSBjb250ZXh0LlNJWi5YT3NpejtcbiAgICAgIHRoaXMuaGVpZ2h0ID0gY29udGV4dC5TSVouWXNpeiAtIGNvbnRleHQuU0laLllPc2l6O1xuICAgICAgdGhpcy5jb21wb25lbnRzQ291bnQgPSBjb250ZXh0LlNJWi5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AgPCBudW1YdGlsZXM7IHArKykge1xuICAgICAgICB0aWxlID0ge307XG4gICAgICAgIHRpbGUudHgwID0gTWF0aC5tYXgoc2l6LlhUT3NpeiArIHAgKiBzaXouWFRzaXosIHNpei5YT3Npeik7XG4gICAgICAgIHRpbGUudHkwID0gTWF0aC5tYXgoc2l6LllUT3NpeiArIHEgKiBzaXouWVRzaXosIHNpei5ZT3Npeik7XG4gICAgICAgIHRpbGUudHgxID0gTWF0aC5taW4oc2l6LlhUT3NpeiArIChwICsgMSkgKiBzaXouWFRzaXosIHNpei5Yc2l6KTtcbiAgICAgICAgdGlsZS50eTEgPSBNYXRoLm1pbihzaXouWVRPc2l6ICsgKHEgKyAxKSAqIHNpei5ZVHNpeiwgc2l6LllzaXopO1xuICAgICAgICB0aWxlLndpZHRoID0gdGlsZS50eDEgLSB0aWxlLnR4MDtcbiAgICAgICAgdGlsZS5oZWlnaHQgPSB0aWxlLnR5MSAtIHRpbGUudHkwO1xuICAgICAgICB0aWxlLmNvbXBvbmVudHMgPSBbXTtcbiAgICAgICAgdGlsZXMucHVzaCh0aWxlKTtcbiAgICAgIH1cbiAgICB9XG4gICAgY29udGV4dC50aWxlcyA9IHRpbGVzO1xuXG4gICAgdmFyIGNvbXBvbmVudHNDb3VudCA9IHNpei5Dc2l6O1xuICAgIGZvciAodmFyIGkgPSAwLCBpaSA9IGNvbXBvbmVudHNDb3VudDsgaSA8IGlpOyBpKyspIHtcbiAgICAgIHZhciBjb21wb25lbnQgPSBjb21wb25lbnRzW2ldO1xuICAgICAgZm9yICh2YXIgaiA9IDAsIGpqID0gdGlsZXMubGVuZ3RoOyBqIDwgamo7IGorKykge1xuICAgICAgICB2YXIgdGlsZUNvbXBvbmVudCA9IHt9O1xuICAgICAgICB0aWxlID0gdGlsZXNbal07XG4gICAgICAgIHRpbGVDb21wb25lbnQudGN4MCA9IE1hdGguY2VpbCh0aWxlLnR4MCAvIGNvbXBvbmVudC5YUnNpeik7XG4gICAgICAgIHRpbGVD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YmJhbmQpO1xuICAgICAgICBwcmVjaW5jdE51bWJlciA9IHBpICsgKHBqICogcHJlY2luY3RQYXJhbWV0ZXJzLm51bXByZWNpbmN0c3dpZGUpO1xuXG4gICAgICAgIGNvZGVibG9jay5wcmVjaW5jdE51bWJlciA9IHByZWNpbmN0TnVtYmVyO1xuICAgICAgICBjb2RlYmxvY2suc3ViYmFuZFR5cGUgPSBzdWJiYW5kLnR5cGU7XG4gICAgICAgIGNvZGVibG9jay5MYmxvY2sgPSAzO1xuXG4gICAgICAgIGlmIChjb2RlYmxvY2sudGJ4MV8gPD0gY29kZWJsb2NrLnRieDBfIHx8XG4gICAgICAgICAgICBjb2RlYmxvY2sudGJ5MV8gPD0gY29kZWJsb2NrLnRieTBfKSB7XG4gICAgICAgICAgY29udGludWU7XG4gICAgICAgIH1cbiAgICAgICAgY29kZWJsb2Nrcy5wdXNoKGNvZGVibG9jayk7XG4gICAgICAgIC8vIGJ1aWxkaW5nIHByZWNpbmN0IGZvciB0aGUgc3ViLWJhbmRcbiAgICAgICAgdmFyIHByZWNpbmN0ID0gcHJlY2luY3RzW3ByZWNpbmN0TnVtYmVyXTtcbiAgICAgICAgaWYgKHByZWNpbmN0ICE9PSB1bmRlZmluZWQpIHtcbiAgICAgICAgICBpZiAoaSA8IHByZWNpbmN0LmNieE1pbikge1xuICAgICAgICAgICAgcHJlY2luY3QuY2J4TWluID0gaTtcbiAgICAgICAgICB9IGVsc2UgaWYgKGkgPiBwcmVjaW5jdC5jYnhNYXgpIHtcbiAgICAgICAgICAgIHByZWNpbmN0LmNieE1heCA9IGk7XG4gICAgICAgICAgfVxuICAgICAgICAgIGlmIChqIDwgcHJlY2luY3QuY2J5TWluKSB7XG4gICAgICAgICAgICBwcmVjaW5jdC5jYnhNaW4gPSBqO1xuICAgICAgICAgIH0gZWxzZSBpZiAoaiA+IHByZWNpbmN0LmNieU1heCkge1xuICAgICAgICAgICAgcHJlY2luY3QuY2J5TWF4ID0gajtcbiAgICAgICAgICB9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xzQ291bnQgPSBNYXRoLm1heChtYXhEZWNvbXBvc2l0aW9uTGV2ZWxzQ291bnQsXG4gICAgICAgIHRpbGUuY29tcG9uZW50c1txXS5jb2RpbmdTdHlsZVBhcmFtZXRlcnMuZGVjb21wb3NpdGlvbkxldmVsc0NvdW50KTtcbiAgICB9XG5cbiAgICB2YXIgbCA9IDAsIHIgPSAwLCBpID0gMCwgayA9IDA7XG5cbiAgICB0aGlzLm5leHRQYWNrZXQgPSBmdW5jdGlvbiBKcHhJbWFnZV9uZXh0UGFja2V0KCkge1xuICAgICAgLy8gU2VjdGlvbiBCLjEyLjEuMSBMYXllci1yZXNvbHV0aW9uLWNvbXBvbmVudC1wb3NpdGlvblxuICAgICAgZm9yICg7IGwgPCBsYXllcnNDb3VudDsgbCsrKSB7XG4gICAgICAgIGZvciAoOyByIDw9IG1heERlY29tcG9zaXRpb25MZXZlbHNDb3VudDsgcisrKSB7XG4gICAgICAgICAgZm9yICg7IGkgPCBjb21wb25lbnRzQ291bnQ7IGkrKykge1xuICAgICAgICAgICAgdmFyIGNvbXBvbmVudCA9IHRpbGUuY29tcG9uZW50c1tpXTtcbiAgICAgICAgICAgIGlmIChyID4gY29tcG9uZW50LmNvZGluZ1N0eWxlUGFyYW1ldGVycy5kZWNvbXBvc2l0aW9uTGV2ZWxzQ291bnQpIHtcbiAgICAgICAgICAgICAgY29udGludWU7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHZhciByZXNvbHV0aW9uID0gY29tcG9uZW50LnJlc29sdXRpb25zW3JdO1xuICAgICAgICAgICAgdmFyIG51bXByZWNpbmN0cyA9IHJlc29sdXRpb24ucHJlY2luY3RQYXJhbWV0ZXJzLm51bXByZWNpbmN0cztcbiAgICAgICAgICAgIGZvciAoOyBrIDwgbnVtcHJlY2luY3RzOykge1xuICAgICAgICAgICAgICB2YXIgcGFja2V0ID0gY3JlYXRlUGFja2V0KHJlc29sdXRpb24sIGssIGwpO1xuICAgICAgICAgICAgICBrKys7X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udC1wb3NpdGlvblxuICAgICAgZm9yICg7IHIgPD0gbWF4RGVjb21wb3NpdGlvbkxldmVsc0NvdW50OyByKyspIHtcbiAgICAgICAgZm9yICg7IGwgPCBsYXllcnNDb3VudDsgbCsrKSB7XG4gICAgICAgICAgZm9yICg7IGkgPCBjb21wb25lbnRzQ291bnQ7IGkrKykge1xuICAgICAgICAgICAgdmFyIGNvbXBvbmVudCA9IHRpbGUuY29tcG9uZW50c1tpXTtcbiAgICAgICAgICAgIGlmIChyID4gY29tcG9uZW50LmNvZGluZ1N0eWxlUGFyYW1ldGVycy5kZWNvbXBvc2l0aW9uTGV2ZWxzQ291bnQpIHtcbiAgICAgICAgICAgICAgY29udGludWU7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHZhciByZXNvbHV0aW9uID0gY29tcG9uZW50LnJlc29sdXRpb25zW3JdO1xuICAgICAgICAgICAgdmFyIG51bXByZWNpbmN0cyA9IHJlc29sdXRpb24ucHJlY2luY3RQYXJhbWV0ZXJzLm51bXByZWNpbmN0cztcbiAgICAgICAgICAgIGZvciAoOyBrIDwgbnVtcHJlY2luY3RzOykge1xuICAgICAgICAgICAgICB2YXIgcGFja2V0ID0gY3JlYXRlUGFja2V0KHJlc29sdXRpb24sIGssIGwpO1xuICAgICAgICAgICAgICBrKys7XG4gICAgICAgICAgICAgIHJldHVybiBwYWNrZXQ7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBrID0gMDtcbiAgICAgICAgICB9XG4gICAgICAgICAgaSA9IDA7XG4gICAgICAgIH1cbiAgICAgICAgbCA9IDA7XG4gICAgICB9XG4gICAgfTtcbiAgfVxuICBmdW5jdGlvbiBSZXNvbHV0aW9uUG9zaXRpb25Db21wb25lbnRMYXllckl0ZXJhdG9yKGNvbnRleHQpIHtcbiAgICB2YXIgc2l6ID0gY29udGV4dC5TSVo7XG4gICAgdmFyIHRpbGVJbmRleCA9IGNvbnRleHQuY3VycmVudFRpbGUuaW5kZXg7XG4gICAgdmF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NvbHV0aW9uc1tyXS5wcmVjaW5jdFBhcmFtZXRlcnMubnVtcHJlY2luY3RzKTtcbiAgICAgICAgfVxuICAgICAgfVxuICAgICAgbWF4TnVtUHJlY2luY3RzSW5MZXZlbFtyXSA9IG1heE51bVByZWNpbmN0cztcbiAgICB9XG4gICAgbCA9IDA7XG4gICAgciA9IDA7XG4gICAgYyA9IDA7XG4gICAgcCA9IDA7XG5cbiAgICB0aGlzLm5leHRQYWNrZXQgPSBmdW5jdGlvbiBKcHhJbWFnZV9uZXh0UGFja2V0KCkge1xuICAgICAgLy8gU2VjdGlvbiBCLjEyLjEuMyBSZXNvbHV0aW9uLXBvc2l0aW9uLWNvbXBvbmVudC1sYXllclxuICAgICAgZm9yICg7IHIgPD0gbWF4RGVjb21wb3NpdGlvbkxldmVsc0NvdW50OyByKyspIHtcbiAgICAgICAgZm9yICg7IHAgPCBtYXhOdW1QcmVjaW5jdHNJbkxldmVsW3JdOyBwKyspIHtcbiAgICAgICAgICBmb3IgKDsgYyA8IGNvbXBvbmVudHNDb3VudDsgYysrKSB7XG4gICAgICAgICAgICB2YXIgY29tcG9uZW50ID0gdGlsZS5jb21wb25lbnRzW2NdO1xuICAgICAgICAgICAgaWYgKHIgPiBjb21wb25lbnQuY29kaW5nU3R5bGVQYXJhbWV0ZXJzLmRlY29tcG9zaXRpb25MZXZlbHNDb3VudCkge1xuICAgICAgICAgICAgICBjb250aW51ZTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHZhciByZXNvbHV0aW9uID0gY29tcG9uZW50LnJlc29sdXRpb25zW3JdO1xuICAgICAgICAgICAgdmFyIG51bXByZWNpbmN0cyA9IHJlc29sdXRpb24ucHJlY2luY3RQYXJhbWV0ZXJzLm51bXByZWNpbmN0cztcbiAgICAgICAgICAgIGlmIChwID49IG51bXByZWNpbmN0cykge1xuICAgICAgICAgICAgICBjb250aW51ZTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGZvciAoOyBsIDwgbGF5Z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N0c0l0ZXJhdGlvblNpemVzLm1heE51bUhpZ2g7IHB5KyspIHtcbiAgICAgICAgZm9yICg7IHB4IDwgcHJlY2luY3RzSXRlcmF0aW9uU2l6ZXMubWF4TnVtV2lkZTsgcHgrKykge1xuICAgICAgICAgIGZvciAoOyBjIDwgY29tcG9uZW50c0NvdW50OyBjKyspIHtcbiAgICAgICAgICAgIHZhciBjb21wb25lbnQgPSB0aWxlLmNvbXBvbmVudHNbY107XG4gICAgICAgICAgICB2YXIgZGVjb21wb3NpdGlvbkxldmVsc0NvdW50ID1cbiAgICAgICAgICAgICAgY29tcG9uZW50LmNvZGluZ1N0eWxlUGFyYW1ldGVycy5kZWNvbXBvc2l0aW9uTGV2ZWxzQ291bnQ7XG4gICAgICAgICAgICBmb3IgKDsgciA8PSBkZWNvbXBvc2l0aW9uTGV2ZWxzQ291bnQ7IHIrKykge1xuICAgICAgICAgICAgICB2YXIgcmVzb2x1dGlvbiA9IGNvbXBvbmVudC5yZXNvbHV0aW9uc1tyXTtcbiAgICAgICAgICAgICAgdmFyIHNpemVJbkltYWdlU2NhbGUgPVxuICAgICAgICAgICAgICAgIHByZWNpbmN0c1NpemVzLmNvbXBvbmVudHNbY10ucmVzb2x1dGlvbnNbcl07XG4gICAgICAgICAgICAgIHZhciBrID0gZ2V0UHJlY2luY3RJbmRleElmRXhpc3QoXG4gICAgICAgICAgICAgICAgcHgsXG4gICAgICAgICAgICAgICAgcHksXG4gICAgICAgICAgICAgICAgc2l6ZUluSW1hZ2VTY2FsZSxcbiAgICAgICAgICAgICAgICBwcmVjaW5jdHNJdGVyYXRpb25TaXplcyxcbiAgICAgICAgICAgICAgICByZXNvbHV0aW9uKTtcbiAgICAgICAgICAgICAgaWYgKGsgPT09IG51bGwpIHtcbiAgICAgICAgICAgICAgICBjb250aW51ZTtcbiAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICBmb3IgKDsgbCA8IGxheWVyc0NvdW50Oykge1xuICAgICAgICAgICAgICAgIHZhciBwYWNrZXQgPSBjcmVhdGVQYWNrZXQocmVzb2x1dGlvbiwgaywgbCk7XG4gICAgICAgICAgICAgICAgbCsrO1xuICAgICAgICAgICAgICAgIHJldHVybiBwYWNrZXQ7XG4gICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgbCA9IDA7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICByID0gMDtcbiAgICAgICAgICB9XG4gICAgICAgICAgYyA9IDA7XG4gICAgICAgIH1cbiAgICAgICAgcHggPSAwO1xuICAgICAgfVxuICAgIH07XG4gIH1cbiAgZnVuY3Rpb24gQ29tcG9uZW50UG9zaXRpb25SZXNvbHV0aW9uTGF5ZXJJdGVyYXRvcihjb250ZXh0KSB7XG4gICAgdmFyIHNpeiA9IGNvbnRleHQuU0laO1xuICAgIHZhciB0aWxlSW5kZXggPSBjb250ZXh0LmN1cnJlbnRUaWxlLmluZGV4O1xuICAgIHZhciB0aWxlID0gY29udGV4dC50aWxlc1t0aWxlSW5kZXhdO1xuICAgIHZhciBsYXllcnNDb3VudCA9IHRpbGUuY29kaW5nU3R5bGVEZWZhdWx0UGFyYW1ldGVycy5sYXllcnNDb3VudDtcbiAgICB2YXIgY29tcG9uZW50c0NvdW50ID0gc2l6LkNzaXo7XG4gICAgdmFyIHByZWNpbmN0c1NpemVzID0gZ2V0UHJlY2luY3RTaXplc0luSW1hZ2VTY2FsZSh0aWxlKTtcbiAgICB2YXIgbCA9IDAsIHIgPSAwLCBjID0gMCwgcHggPSAwLCBweSA9IDA7XG5cbiAgICB0aGlzLm5leHRQYWNrZXQgPSBmdW5jdGlvbiBKcHhJbWFnZV9uZXh0UGFja2V0KCkge1xuICAgICAgLy8gU2VjdGlvbiBCLjEyLjEuNSBDb21wb25lbnQtcG9zaXRpb24tcmVzb2x1dGlvbi1sYXllclxuICAgICAgZm9yICg7IGMgPCBjb21wb25lbnRzQ291bnQ7ICsrYykge1xuICAgICAgICB2YXIgY29tcG9uZW50ID0gdGlsZS5jb21wb25lbnRzW2NdO1xuICAgICAgICB2YXIgcHJlY2luY3RzSXRlcmF0aW9uU2l6ZXMgPSBwcmVjaW5jdHNTaXplcy5jb21wb25lbnRzW2NdO1xuICAgICAgICB2YXIgZGVjb21wb3NpdGlvbkxldmVsc0NvdW50ID1cbiAgICAgICAgICBjb21wb25lbnQuY29kaW5nU3R5bGVQYXJhbWV0ZXJzLmRlY29tcG9zaXRpb25MZXZlbHNDb3VudDtcbiAgICAgICAgZm9yICg7IHB5IDwgcHJlY2luY3RzSXRlcmF0aW9uU2l6ZXMubWF4TnVtSGlnaDsgcHkrKykge1xuICAgICAgICAgIGZvciAoOyBweCA8IHByZWNpbmN0c0l0ZXJhdGlvblNpemVzLm1heE51bVdpZGU7IHB4KyspIHtcbiAgICAgICAgICAgIGZvciAoOyByIDw9IGRlY29tcG9zaXRpb25MZXZlbHNDb3VudDsgcisrKSB7XG4gICAgICAgICAgICAgIHZhciByZXNvbHV0aW9uID0gY29tcG9uZW50LnJlc29sdXRpb25zW3JdO1xuICAgICAgICAgICAgICB2YXIgc2l6ZUluSW1hZ2VTY2FsZSA9IHByZWNpbmN0c0l0ZXJhdGlvblNpemVzLnJlc29sdXRpb25zW3JdO1xuICAgICAgICAgICAgICB2YXIgayA9IGdldFByZWNpbmN0SW5kZXhJZkV4aXN0KFxuICAgICAgICAgICAgICAgIHB4LFxuICAgICAgICAgICAgICAgIHB5LFxuICAgICAgICAgICAgICAgIHNpemVJbkltYWdlU2NhbGUsXG4gICAgICAgICAgICAgICAgcHJlY2luY3RzSXRlcmF0aW9uU2l6ZXMsXG4gICAgICAgICAgICAgICAgcmVzb2x1dGlvbik7XG4gICAgICAgICAgICAgIGlmIChrID09PSBudWxsKSB7XG4gICAgICAgICAgICAgICAgY29udGludWU7XG4gICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgZm9yICg7IGwgPCBsYXllcnNDb3VudDspIHtcbiAgICAgICAgICAgICAgICB2YXIgcGFja2V0ID0gY3JlYXRlUGFja2V0KHJlc29sdXRpb24sIGssIGwpO1xuICAgICAgICAgICAgICAgIGwrKztcbiAgICAgICAgICAgICAgICByZXR1cm4gcGFja2V0O1xuICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgIGwgPSAwO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgciA9IDA7XG4gICAgICAgICAgfVxuICAgICAgICAgIHB4ID0gMDtcbiAgICAgICAgfVxuICAgICAgICBweSA9IDA7XG4gICAgICB9XG4gICAgfTtcbiAgfVxuICBmdW5jdGlvbiBnZXRQcmVjaW5jdEluZGV4SWZFeGlzdChcbiAgICBweEluZGV4LCBweUluZGV4LCBzaXplSW5JbWFnZVNjYWxlLCBwcmVjaW5jdEl0ZXJhdGlvblNpemVzLCByZXNvbHV0aW9uKSB7XG4gICAgdmFyIHBvc1ggPSBweEluZGV4ICogcHJlY2luY3RJdGVyYXRpb25TaXplcy5taW5XaWR0aDtcbiAgICB2YXIgcG9zWSA9IHB5SW5kZXggKiBwcmVjaW5jdEl0ZXJhdGlvblNpemVzLm1pbkhlaWdodDtcbiAgICBpZiAocG9zWCAlIHNpemVJbkltYWdlU2NhbGUud2lkdGggIT09IDAgfHxcbiAgICAgICAgcG9zWSAlIHNpemVJbkltYWdlU2NhbGUuaGVpZ2h0ICE9PSAwKSB7XG4gICAgICByZXR1cm4gbnVsbDtcbiAgICB9XG4gICAgdmFyIHN0YXJ0UHJlY2luY3RSb3dJbmRleCA9XG4gICAgICAocG9zWSAvIHNpemVJbkltYWdlU2NhbGUud2lkdGgpICpcbiAgICAgIHJlc29sdXRpb24ucHJlY2luY3RQYXJhbWV0ZXJzLm51bXByZWNpbmN0c3dpZGU7XG4gICAgcmV0dXJuIChwb3NYIC8gc2l6ZUluSW1hZ2VTY2FsZS5oZWlnaHQpICsgc3RhcnRQcmVjaW5jdFJvd0luZGV4O1xuICB9XG4gIGZ1bmN0aW9uIGdldFByZWNpbmN0U2l6ZXNJbkltYWdlU2NhbGUodGlsZSkge1xuICAgIHZhciBjb21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YXIgd2lkdGhDdXJyZW50UmVzb2x1dGlvbiA9XG4gICAgICAgICAgc2NhbGUgKiByZXNvbHV0aW9uLnByZWNpbmN0UGFyYW1ldGVycy5wcmVjaW5jdFdpZHRoO1xuICAgICAgICB2YXIgaGVpZ2h0Q3VycmVudFJlc29sdXRpb24gPVxuICAgICAgICAgIHNjYWxlICogcmVzb2x1dGlvbi5wcmVjaW5jdFBhcmFtZXRlcnMucHJlY2luY3RIZWlnaHQ7XG4gICAgICAgIG1pbldpZHRoQ3VycmVudENvbXBvbmVudCA9IE1hdGgubWluKFxuICAgICAgICAgIG1pbldpZHRoQ3VycmVudENvbXBvbmVudCxcbiAgICAgICAgICB3aWR0aEN1cnJlbnRSZXNvbHV0aW9uKTtcbiAgICAgICAgbWluSGVpZ2h0Q3VycmVudENvbXBvbmVudCA9IE1hdGgubWluKFxuICAgICAgICAgIG1pbkhlaWdodEN1cnJlbnRDb21wb25lbnQsXG4gICAgICAgICAgaGVpZ2h0Q3VycmVudFJlc29sdXRpb24pO1xuICAgICAgICBtYXhOdW1XaWRlQ3VycmVudENvbXBvbmVudCA9IE1hdGgubWF4KG1heE51bVdpZGVDdXJyZW50Q29tcG9uZW50LFxuICAgICAgICAgIHJlc29sdXRpb24ucHJlY2luY3RQYXJhbWV0ZXJzLm51bXByZWNpbmN0c3dpZGUpO1xuICAgICAgICBtYXhOdW1IaWdoQ3VycmVudENvbXBvbmVudCA9IE1hdGgubWF4KG1heE51bUhpZ2hDdXJyZW50Q29tcG9uZW50LFxuICAgICAgICAgIHJlc29sdXRpb24ucHJlY2luY3RQYXJhbWV0ZXJzLm51bXByZWNpbmN0c2hpZ2gpO1xuICAgICAgICBzaXplUGVyUmVzb2x1dGlvbltyXSA9IHtcbiAgICAgICAgICB3aWR0aDogd2lkdGhDdXJyZW50UmVzb2x1dGlvbixcbiAgICAgICAgICBoZWlnaHQ6IGhlaWdodEN1cnJlbnRSZXNvbHV0aW9uXG4gICAgICAgIH07XG4gICAgICAgIHN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NvZGVibG9ja1JvdywgbGF5ZXJOdW1iZXIpO1xuICAgICAgICAgICAgd2hpbGUgKHRydWUpIHtcbiAgICAgICAgICAgICAgaWYgKHBvc2l0aW9uID49IGRhdGEubGVuZ3RoKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgIGlmIChpbmNsdXNpb25UcmVlLmlzQWJvdmVUaHJlc2hvbGQoKSl7XG4gICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgaWYgKGluY2x1c2lvblRyZWUuaXNLbm93bigpKSB7XG4gICAgICAgICAgICAgICAgaW5jbHVzaW9uVHJlZS5uZXh0TGV2ZWwoKTtcbiAgICAgICAgICAgICAgICBjb250aW51ZTtcbiAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICBpZiAocmVhZEJpdHMoMSkpIHtcbiAgICAgICAgICAgICAgICBpbmNsdXNpb25UcmVlLnNldEtub3duKCk7XG4gICAgICAgICAgICAgICAgaWYgKGluY2x1c2lvblRyZWUuaXNMZWFmKCkpIHtcbiAgICAgICAgICAgICAgICAgIGNvZGVibG9jay5pbmNsdWRlZCA9IHRydWU7XG4gICAgICAgICAgICAgICAgICBjb2RlYmxvY2tJbmNsdWRlZCA9IGZpcnN0VGltZUluY2x1c2lvbiA9IHRydWU7XG4gICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgaW5jbHVzaW9uVHJlZS5uZXh0TGV2ZWwoKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgaW5jbHVzaW9uVHJlZS5pbmNyZW1lbnRWYWx1ZSgpO1xuICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgICAgfVxuICAgICAgICAgIGlmICghY29kZWJsb2NrSW5jbHVkZWQpIHtcbiAgICAgICAgICAgIGNvbnRpbnVlO1xuICAgICAgICAgIH1cbiAgICAgICAgICBpZiAoZmlyc3RUaW1lSW5jbHVzaW9uKSB7XG4gICAgICAgICAgICB6ZXJvQml0UGxhbmVzVHJlZSA9IHByZWNpbmN0Lnplcm9CaXRQbGFuZXNUcmVlO1xuICAgICAgICAgICAgemVyb0JpdFBsYW5lc1RyZWUucmVzZXQoY29kZWJsb2NrQ29sdW1uLCBjb2RlYmxvY2tSb3cpO1xuICAgICAgICAgICAgd2hpbGUgKHRydWUpIHtcbiAgICAgICAgICAgICAgaWYgKHBvc2l0aW9uID49IGRhdGEubGVuZ3RoKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgIGlmIChyZWFkQml0cygxKSkge1xuICAgICAgICAgICAgICAgIHZhbHVlUmVhZHkgPSAhemVyb0JpdFBsYW5lc1RyZWUubmV4dExldmVsKCk7XG4gICAgICAgICAgICAgICAgaWYgKHZhbHVlUmVhZHkpIHtcbiAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICB6ZXJvQml0UGxhbmVzVHJlZS5pbmNyZW1lbnRWYWx1ZSgpO1xuICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBjb2RlYmxvY2suemVyb0JpdFBsYW5lcyA9IHplcm9CaXRQbGFuZXNUcmVlLnZhbHVlO1xuICAgICAgICAgIH1cbiAgICAgICAgICB2YXIgY29kaW5ncGFzc2VzID0gcmVhZENvZGluZ3Bhc3NlcygpO1xuICAgICAgICAgIHdoaWxlIChyZWFkQml0cygxKSkge1xuICAgICAgICAgICAgY29kZWJsb2NrLkxibG9jaysrO1xuICAgICAgICAgIH1cbiAgICAgICAgICB2YXIgY29kaW5ncGFzc2VzTG9nMiA9IGxvZzIoY29kaW5ncGFzc2VzKTtcbiAgICAgICAgICAvLyByb3VuZGluZyBkb3duIGxvZzJcbiAgICAgICAgICB2YXIgYml0cyA9ICgoY29kaW5ncGFzc2VzIDwgKDEgPDwgY29kaW5ncGFzc2VzTG9nMikpID9cbiAgICAgICAgICAgICAgICAgICAgICBjb2RpbmdwYXNzZXNMb2cyIC0gMSA6IGNvZGluZ3Bhc3Nlc0xvZzIpICsgY29kZWJsb2NrLkxibG9jaztcbiAgICAgICAgICB2YXIgY29kZWREYXRhTGVuZ3RoID0gcmVhZEJpdHMoYml0cyk7XG4gICAgICAgICAgcXVldWUucHVzaCh7XG4gICAgICAgICAgICBjb2RlYmxvY2s6IGNvZGVibG9jayxcbiAgICAgICAgICAgIGNvZGluZ3Bhc3NlczogY29kaW5ncGFzc2VzLFxuICAgICAgICAgICAgZGF0YUxlbmd0aDogY29kZWREYXRhTGVuZ3RoXG4gICAgICAgICAgfSk7XG4gICAgICAgIH1cbiAgICAgICAgYWxpZ25Ub0J5dGUoKTtcbiAgICAgICAgaWYgKGVwaE1hcmtlclVzZWQpIHtcbiAgICAgICAgICBza2lwTWFya2VySWZFcXVhbCgweDkyKTtcbiAgICAgICAgfVxuICAgICAgICB3aGlsZSAocXVldWUubGVuZ3RoID4gMCkge1xuICAgICAgICAgIHZhciBwYWNrZXRJdGVtID0gcXVldWUuc2hpZnQoKTtcbiAgICAgICAgICBjb2RlYmxvY2sgPSBwYWNrZXRJdGVtLmNvZGVibG9jaztcbiAgICAgICAgICBpZiAoY29kZWJsb2NrWydkYXRhJ10gPT09IHVuZGVmaW5lZCkge1xuICAgICAgICAgICAgY29kZWJsb2NrLmRhdGEgPSBbXTtcbiAgICAgICAgICB9XG4gICAgICAgICAgY29kZWJsb2NrLmRhdGEucHVzaCh7XG4gICAgICAgICAgICBkYXRhOiBkYXRhLFxuICAgICAgICAgICAgc3RhcnQ6IG9mZnNldCArIHBvc2l0aW9uLFxuICAgICAgICAgICAgZW5kOiBvZmZzZXQgKyBwb3NpdGlvbiArIHBh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vciAoaiA9IDAsIGpqID0gZGF0YS5sZW5ndGg7IGogPCBqajsgaisrKSB7XG4gICAgICAgIGRhdGFJdGVtID0gZGF0YVtqXTtcbiAgICAgICAgdmFyIGNodW5rID0gZGF0YUl0ZW0uZGF0YS5zdWJhcnJheShkYXRhSXRlbS5zdGFydCwgZGF0YUl0ZW0uZW5kKTtcbiAgICAgICAgZW5jb2RlZERhdGEuc2V0KGNodW5rLCBwb3NpdGlvbik7XG4gICAgICAgIHBvc2l0aW9uICs9IGNodW5rLmxlbmd0aDtcbiAgICAgIH1cbiAgICAgIC8vIGRlY29kaW5nIHRoZSBpdGVtXG4gICAgICB2YXIgZGVjb2RlciA9IG5ldyBBcml0aG1ldGljRGVjb2RlcihlbmNvZGVkRGF0YSwgMCwgdG90YWxMZW5ndGgpO1xuICAgICAgYml0TW9kZWwuc2V0RGVjb2RlcihkZWNvZGVyKTtcblxuICAgICAgZm9yIChqID0gMDsgaiA8IGNvZGluZ3Bhc3NlczsgaisrKSB7XG4gICAgICAgIHN3aXRjaCAoY3VycmVudENvZGluZ3Bhc3NUeXBlKSB7XG4gICAgICAgICAgY2FzZSAwOlxuICAgICAgICAgICAgYml0TW9kZWwucnVuU2lnbmlmaWNhbmNlUHJvcG9nYXRpb25QYXNzKCk7XG4gICAgICAgICAgICBicmVhaztcbiAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICBiaXRNb2RlbC5ydW5NYWduaXR1ZGVSZWZpbmVtZW50UGFzcygpO1xuICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgY2FzZSAyOlxuICAgICAgICAgICAgYml0TW9kZWwucnVuQ2xlYW51cFBhc3MoKTtcbiAgICAgICAgICAgIGlmIChzZWdtZW50YXRpb25TeW1ib2xVc2VkKSB7XG4gICAgICAgICAgICAgIGJpdE1vZGVsLmNoZWNrU2VnbWVudGF0aW9uU3ltYm9sKCk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBicmVhaztcbiAgICAgICAgfVxuICA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R1ZGVbcG9zaXRpb25dO1xuICAgICAgICAgIGlmIChuICE9PSAwKSB7XG4gICAgICAgICAgICBuID0gKG4gKyBtYWduaXR1ZGVDb3JyZWN0aW9uKSAqIGRlbHRhO1xuICAgICAgICAgICAgaWYgKHNpZ25bcG9zaXRpb25dICE9PSAwKSB7XG4gICAgICAgICAgICAgIG4gPSAtbjtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIG5iID0gYml0c0RlY29kZWRbcG9zaXRpb25dO1xuICAgICAgICAgICAgdmFyIHBvcyA9IGludGVybGVhdmUgPyAobGV2ZWxPZmZzZXQgKyAob2Zmc2V0IDw8IDEpKSA6IG9mZnNldDtcbiAgICAgICAgICAgIGlmIChyZXZlcnNpYmxlICYmIChuYiA+PSBtYikpIHtcbiAgICAgICAgICAgICAgY29lZmZpY2llbnRzW3Bvc10gPSBuO1xuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgY29lZmZpY2llbnRzW3Bvc10gPSBuICogKDEgPDwgKG1iIC0gbmIpKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICB9XG4gICAgICAgICAgb2Zmc2V0Kys7XG4gICAgICAgICAgcG9zaXRpb24rKztcbiAgICAgICAgfVxuICAgICAgICBvZmZzZXQgKz0gd2lkdGggLSBibG9ja1dpZHRoO1xuICAgICAgfVxuICAgIH1cbiAgfVxuICBmdW5jdGlvbiB0cmFuc2Zvcm1UaWxlKGNvbnRleHQsIHRpbGUsIGMpIHtcbiAgICB2YXIgY29tcG9uZW50ID0gdGlsZS5jb21wb25lbnRzW2NdO1xuICAgIHZhciBjb2RpbmdTdHlsZVBhcmFtZXRlcnMgPSBjb21wb25lbnQuY29kaW5nU3R5bGVQYXJhbWV0ZXJzO1xuICAgIHZhciBxdWFudGl6YXRpb25QYXJhbWV0ZXJzID0gY29tcG9uZW50LnF1YW50aXphdGlvblBhcmFtZXRlcnM7XG4gICAgdmFyIGRlY29tcG9zaXRpb25MZXZlbHNDb3VudCA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udHJ5MDtcbiAgICAgIC8vIEFsbG9jYXRlIHNwYWNlIGZvciB0aGUgd2hvbGUgc3VibGV2ZWwuXG4gICAgICB2YXIgY29lZmZpY2llbnRzID0gbmV3IEZsb2F0MzJBcnJheSh3aWR0aCAqIGhlaWdodCk7XG5cbiAgICAgIGZvciAodmFyIGogPSAwLCBqaiA9IHJlc29sdXRpb24uc3ViYmFuZHMubGVuZ3RoOyBqIDwgamo7IGorKykge1xuICAgICAgICB2YXIgbXUsIGVwc2lsb247XG4gICAgICAgIGlmICghc2NhbGFyRXhwb3VuZGVkKSB7XG4gICAgICAgICAgLy8gZm9ybXVsYSBFLTVcbiAgICAgICAgICBtdSA9IHNwcWNkc1swXS5tdTtcbiAgICAgICAgICBlcHNpbG9uID0gc3BxY2RzWzBdLmVwc2lsb24gKyAoaSA+IDAgPyAxIC0gaSA6IDApO1xuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgIG11ID0gc3BxY2RzW2JdLm11O1xuICAgICAgICAgIGVwc2lsb24gPSBzcHFjZHNbYl0uZXBzaWxvbjtcbiAgICAgICAgICBiKys7XG4gICAgICAgIH1cblxuICAgICAgICB2YXIgc3ViYmFuZCA9IHJlc29sdXRpb24uc3ViYmFuZHNbal07XG4gICAgICAgIHZhciBnYWluTG9nMiA9IFN1YmJhbmRzR2FpbkxvZzJbc3ViYmFuZC50eXBlXTtcblxuICAgICAgICAvLyBjYWx1bGF0ZSBxdWFudGl6YXRpb24gY29lZmZpY2llbnQgKFNlY3Rpb24gRS4xLjEuMSlcbiAgICAgICAgdmFyIGRlbHRhID0gKHJldmVyc2libGUgPyAxIDpcbiAgICAgICAgICBNYXRoLnBvdygyLCBwcmVjaXNpb24gKyBnYWluTG9nMiAtIGVwc2lsb24pICogKDEgKyBtdSAvIDIwNDgpKTtcbiAgICAgICAgdmFyIG1iID0gKGd1YXJkQml0cyArIGVwc2lsb24gLSAxKTtcblxuICAgICAgICAvLyBJbiB0aGUgZmlyc3QgcmVzb2x1dGl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gICAgIC8vIGNvbXB1dGUgc2hpZnQgYW5kIG9mZnNldCBvbmx5IG9uY2UuXG4gICAgICAgIHNoaWZ0ID0gY29tcG9uZW50c1swXS5wcmVjaXNpb24gLSA4O1xuICAgICAgICBvZmZzZXQgPSAoMTI4IDw8IHNoaWZ0KSArIDAuNTtcbiAgICAgICAgbWF4ID0gMjU1ICogKDEgPDwgc2hpZnQpO1xuICAgICAgICBtYXhLID0gbWF4ICogMC41O1xuICAgICAgICBtaW4gPSAtbWF4SztcblxuICAgICAgICB2YXIgY29tcG9uZW50MCA9IHRpbGUuY29tcG9uZW50c1swXTtcbiAgICAgICAgdmFyIGFscGhhMDEgPSBjb21wb25lbnRzQ291bnQgLSAzO1xuICAgICAgICBqaiA9IHkwaXRlbXMubGVuZ3RoO1xuICAgICAgICBpZiAoIWNvbXBvbmVudDAuY29kaW5nU3R5bGVQYXJhbWV0ZXJzLnJldmVyc2libGVUcmFuc2Zvcm1hdGlvbikge1xuICAgICAgICAgIC8vIGludmVyc2UgaXJyZXZlcnNpYmxlIG11bHRpcGxlIGNvbXBvbmVudCB0cmFuc2Zvcm1cbiAgICAgICAgICBmb3IgKGogPSAwOyBqIDwgamo7IGorKywgcG9zICs9IGFscGhhMDEpIHtcbiAgICAgICAgICAgIHkwID0geTBpdGVtc1tqXSArIG9mZnNldDtcbiAgICAgICAgICAgIHkxID0geTFpdGVtc1tqXTtcbiAgICAgICAgICAgIHkyID0geTJpdGVtc1tqXTtcbiAgICAgICAgICAgIHIgPSB5MCArIDEuNDAyICogeTI7XG4gICAgICAgICAgICBnID0geTAgLSAwLjM0NDEzICogeTEgLSAwLjcxNDE0ICogeTI7XG4gICAgICAgICAgICBiID0geTAgKyAxLjc3MiAqIHkxO1xuICAgICAgICAgICAgb3V0W3BvcysrXSA9IHIgPD0gMCA/IDAgOiByID49IG1heCA/IDI1NSA6IHIgPj4gc2hpZnQ7XG4gICAgICAgICAgICBvdXRbcG9zKytdID0gZyA8PSAwID8gMCA6IGcgPj0gbWF4ID8gMjU1IDogZyA+PiBzaGlmdDtcbiAgICAgICAgICAgIG91dFtwb3MrK10gPSBiIDw9IDAgPyAwIDogYiA+PSBtYXggPyAyNTUgOiBiID4+IHNoaWZ0O1xuICAgICAgICAgIH1cbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAvLyBpbnZlcnNlIHJldmVyc2libGUgbXVsdGlwbGUgY29tcG9uZW50IHRyYW5zZm9ybVxuICAgICAgICAgIGZvciAoaiA9IDA7IGogPCBqajsgaisrLCBwb3MgKz0gYWxwaGEwMSkge1xuICAgICAgICAgICAgeTAgPSB5MGl0ZW1zW2pdICsgb2Zmc2V0O1xuICAgICAgICAgICAgeTEgPSB5MWl0ZW1zW2pdO1xuICAgICAgICAgICAgeTIgPSB5Mml0ZW1zW2pdO1xuICAgICAgICAgICAgZyA9IHkwIC0gKCh5MiArIHkxKSA+PiAyKTtcbiAgICAgICAgICAgIHIgPSBnICsgeTI7XG4gICAgICAgICAgICBiID0gZyArIHkxO1xuICAgICAgICAgICAgb3V0W3BvcysrXSA9IHIgPD0gMCA/IDAgOiByID49IG1heCA/IDI1NSA6IHIgPj4gc2hpZnQ7XG4gICAgICAgICAgICBvdXRbcG9zKytdID0gZyA8PSAwID8gMCA6IGcgPj0gbWF4ID8gMjU1IDogZyA+PiBzaGlmdDtcbiAgICAgICAgICAgIG91dFtwb3MrK10gPSBiIDw9IDAgPyAwIDogYiA+PSBtYXggPyAyNTUgOiBiID4+IHNoaWZ0O1xuICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICBpZiAoZm91ckNvbXBvbmVudHMpIHtcbiAgICAgICAgICBmb3IgKGogPSAwLCBwb3MgPSAzOyBqIDwgamo7IGorKywgcG9zICs9IDQpIHtcbiAgICAgICAgICAgIGsgPSB5M2l0ZW1zW2pdO1xuICAgICAgICAgICAgb3V0W3Bvc10gPSBrIDw9IG1pbiA/IDAgOiBrID49IG1heEsgPyAyNTUgOiAoayArIG9mZnNldCkgPj4gc2hpZnQ7XG4gICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICB9IGVsc2UgeyAvLyBubyBtdWx0aS1jb21wb25lbnQgdHJhbnNmb3JtXG4gICAgICAgIGZvciAoYyA9IDA7IGMgPCBjb21wb25lbnRzQ291bnQ7IGMrKykge1xuICAgICAgICAgIGlmIChjb21wb25lbnRzW2NdLnByZWNpc2lvbiA9PT0gOCl7XG4gICAgICAgICAgICB2YXIgaXRlbXMgPSB0cmFuc2Zvcm1lZFRpbGVzW2NdLml0ZW1zO1xuICAgICAgICAgICAgc2hpZnQgPSBjb21wb25lbnRzW2NdLnByZWNpc2lvbiAtIDg7XG4gICAgICAgICAgICBvZmZzZXQgPSAoMTI4IDw8IHNoaWZ0KSArIDAuNTtcbiAgICAgICAgICAgIG1heCA9ICgxMjcuNSAqICgxIDw8IHNoaWZ0KSk7XG4gICAgICAgICAgICBtaW4gPSAtbWF4O1xuICAgICAgICAgICAgZm9yIChwb3MgPSBjLCBqID0gMCwgamogPSBpdGVtcy5sZW5ndGg7IGogPCBqajsgaisrKSB7XG4gICAgICAgICAgICAgIHZhbCA9IGl0ZW1zW2pdO1xuICAgICAgICAgICAgICBvdXRbcG9zXSA9IHZhbCA8PSBtaW4gPyAwIDpcbiAgICAgICAgICAgICAgICAgICAgICAgICB2YWwgPj0gbWF4ID8gMjU1IDogKHZhbCArIG9mZnNldCkgPj4gc2hpZnQ7XG4gICAgICAgICAgICAgIHBvcyArPSBjb21wb25lbnRzQ291bnQ7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgfWVsc2V7XG4gICAgICAgICAgICB2YXIgaXNTaWduZWQgPSBjb21wb25lbnRzW2NdLmlzU2lnbmVkO1xuICAgICAgICAgICAgdmFyIGl0ZW1zID0gdHJhbnNmb3JtZWRUaWxlc1tjXS5pdGVtcztcblxuICAgICAgICAgICAgaWYoaXNTaWduZWQpe1xuICAgICAgICAgICAgICBmb3IgKHBvcyA9IGMsIGogPSAwLCBqaiA9IGl0ZW1zLmxlbmd0aDsgaiA8IGpqOyBqKyspIHtcbiAgICAgICAgICAgICAgICBvdXRbcG9zXSA9IGl0ZW1zW2pdO1xuICAgICAgICAgICAgICAgIHBvcyArPSBjb21wb25lbnRzQ291bnQ7XG4gICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1lbHNle1xuICAgICAgICAgICAgICBzaGlmdCA9IGNvbXBvbmVudHNbY10ucHJlY2lzaW9uIC0gODtcbiAgICAgICAgICAgICAgb2Zmc2V0ID0gKDEyOCA8PCBzaGlmdCkgKyAwLjU7XG4gICAgICAgICAgICAgIHZhciBwcmVjaXNpb25NYXggPSBNYXRoLnBvdygyLGNvbXBvbmVudHNbY10ucHJlY2lzaW9uKS0xO1xuICAgICAgICAgICAgICBmb3IgKHBvcyA9IGMsIGogPSAwLCBqaiA9IGl0ZW1zLmxlbmd0aDsgaiA8IGpqOyBqKyspIHtcbiAgICAgICAgICAgICAgICB2YWwgPSBpdGVtc1tqXTtcbiAgICAgICAgICAgICAgICBvdXRbcG9zXSA9IE1hdGgubWF4KE1hdGgubWluKCh2YWwgKyBvZmZzZXQpLHByZWNpc2lvbk1heCksMCk7XG4gICAgICAgICAgICAgICAgcG9zICs9IGNvbXBvbmVudHNDb3VudDtcbiAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgfVxuICAgICAgcmVzdWx0SW1hZ2VzLnB1c2gocmVzdWx0KTtcbiAgICB9XG4gICAgcmV0dXJuIHJlc3VsdEltYWdlcztcbiAgfVxuICBmdW5jdGlvbiBpbml0aWFsaXplVGlsZShjb250ZXh0LCB0aWxlSW5kZXgpIHtcbiAgICB2YXIgc2l6ID0gY29udGV4dC5TSVo7XG4gICAgdmFyIGNvbXBvbmVudHNDb3VudCA9IHNpei5Dc2l6O1xuICAgIHZhciB0aWxlID0gY29udGV4dC50aWxlc1t0aWxlSW5kZXhdO1xuICAgIGZvciAodmFyIGMgPSAwOyBjIDw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vQml0UGxhbmVzLCBtYikge1xuICAgICAgdGhpcy53aWR0aCA9IHdpZHRoO1xuICAgICAgdGhpcy5oZWlnaHQgPSBoZWlnaHQ7XG5cbiAgICAgIHRoaXMuY29udGV4dExhYmVsVGFibGUgPSAoc3ViYmFuZCA9PT0gJ0hIJyA/IEhIQ29udGV4dExhYmVsIDpcbiAgICAgICAgKHN1YmJhbmQgPT09ICdITCcgPyBITENvbnRleHRMYWJlbCA6IExMQW5kTEhDb250ZXh0c0xhYmVsKSk7XG5cbiAgICAgIHZhciBjb2VmZmljaWVudENvdW50ID0gd2lkdGggKiBoZWlnaHQ7XG5cbiAgICAgIC8vIGNvZWZmaWNpZW50cyBvdXRzaWRlIHRoZSBlbmNvZGluZyByZWdpb24gdHJlYXRlZCBhcyBpbnNpZ25pZmljYW50XG4gICAgICAvLyBhZGQgYm9yZGVyIHN0YXRlIGNlbGxzIGZvciBzaWduaWZpY2FuY2VTdGF0ZVxuICAgICAgdGhpcy5uZWlnaGJvcnNTaWduaWZpY2FuY2UgPSBuZXcgVWludDhBcnJheShjb2VmZmljaWVudENvdW50KTtcbiAgICAgIHRoaXMuY29lZmZpY2VudHNTaWduID0gbmV3IFVpbnQ4QXJyYXkoY29lZmZpY2llbnRDb3VudCk7XG4gICAgICB0aGlzLmNvZWZmaWNlbnRzTWFnbml0dWRlID0gbWIgPiAxNCA/IG5ldyBVaW50MzJBcnJheShjb2VmZmljaWVudENvdW50KSA6XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbWIgPiA2ID8gbmV3IFVpbnQxNkFycmF5KGNvZWZmaWNpZW50Q291bnQpIDpcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuZXcgVWludDhBcnJheShjb2VmZmljaWVudENvdW50KTtcbiAgICAgIHRoaXMucHJvY2Vzc2luZ0ZsYWdzID0gbmV3IFVpbnQ4QXJyYXkoY29lZmZpY2llbnRDb3VudCk7XG5cbiAgICAgIHZhciBiaXRzRGVjb2Rl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4dExhYmVsVGFibGU7XG4gICAgICAgIHZhciBiaXRzRGVjb2RlZCA9IHRoaXMuYml0c0RlY29kZWQ7XG4gICAgICAgIHZhciBwcm9jZXNzZWRJbnZlcnNlTWFzayA9IH4xO1xuICAgICAgICB2YXIgcHJvY2Vzc2VkTWFzayA9IDE7XG4gICAgICAgIHZhciBmaXJzdE1hZ25pdHVkZUJpdE1hc2sgPSAyO1xuXG4gICAgICAgIGZvciAodmFyIGkwID0gMDsgaTAgPCBoZWlnaHQ7IGkwICs9IDQpIHtcbiAgICAgICAgICBmb3IgKHZhciBqID0gMDsgaiA8IHdpZHRoOyBqKyspIHtcbiAgICAgICAgICAgIHZhciBpbmRleCA9IGkwICogd2lkdGggKyBqO1xuICAgICAgICAgICAgZm9yICh2YXIgaTEgPSAwOyBpMSA8IDQ7IGkxKyssIGluZGV4ICs9IHdpZHRoKSB7XG4gICAgICAgICAgICAgIHZhciBpID0gaTAgKyBpMTtcbiAgICAgICAgICAgICAgaWYgKGkgPj0gaGVpZ2h0KSB7XG4gICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgLy8gY2xlYXIgcHJvY2Vzc2VkIGZsYWcgZmlyc3RcbiAgICAgICAgICAgICAgcHJvY2Vzc2luZ0ZsYWdzW2luZGV4XSAmPSBwcm9jZXNzZWRJbnZlcnNlTWFzaztcblxuICAgICAgICAgICAgICBpZiAoY29lZmZpY2VudHNNYWduaXR1ZGVbaW5kZXhdIHx8XG4gICAgICAgICAgICAgICAgICAhbmVpZ2hib3JzU2lnbmlmaWNhbmNlW2luZGV4XSkge1xuICAgICAgICAgICAgICAgIGNvbnRpbnVlO1xuICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgdmFyIGNvbnRleHRMYWJlbCA9IGxhYmVsc1tuZWlnaGJvcnNTaWduaWZpY2FuY2VbaW5kZXhdXTtcbiAgICAgICAgICAgICAgdmFyIGRlY2lzaW9uID0gZGVjb2Rlci5yZWFkQml0KGNvbnRleHRzLCBjb250ZXh0TGFiZWwpO1xuICAgICAgICAgICAgICBpZiAoZGVjaXNpb24pIHtcbiAgICAgICAgICAgICAgICB2YXIgc2lnbiA9IHRoaXMuZGVjb2RlU2lnbkJpdChpLCBqLCBpbmRleCk7XG4gICAgICAgICAgICAgICAgY29lZmZpY2VudHNTaWduW2luZGV4XSA9IHNpZ247XG4gICAgICAgICAgICAgICAgY29lZmZpY2VudHNNYWduaXR1ZGVbaW5kZXhdID0gMTtcbiAgICAgICAgICAgICAgICB0aGlzLnNldE5laWdoYm9yc1NpZ25pZmljYW5jZShpLCBqLCBpbmRleCk7XG4gICAgICAgICAgICAgICAgcHJvY2Vzc2luZ0ZsYWdzW2luZGV4XSB8PSBmaXJzdE1hZ25pdHVkZUJpdE1hc2s7XG4gICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgYml0c0RlY29kZWRbaW5kZXhdKys7XG4gICAgICAgICAgICAgIHByb2Nlc3NpbmdGbGFnc1tpbmRleF0gfD0gcHJvY2Vzc2VkTWFzaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgIH0sXG4gICAgICBkZWNvZGVTaWduQml0OiBmdW5jdGlvbiBCaXRNb2RlbF9kZWNvZGVTaWduQml0KHJvdywgY29sdW1uLCBpbmRleCkge1xuICAgICAgICB2YXIgd2lkdGggPSB0aGlzLndpZHRoLCBoZWlnaHQgPSB0aGlzLmhlaWdodDtcbiAgICAgICAgdmFyIGNvZWZmaWNlbnRzTWFnbml0dWRlID0gdGhpcy5jb2VmZmljZW50c01hZ25pdHVkZTtcbiAgICAgICAgdmFyIGNvZWZmaWNlbnRzU2lnbiA9IHRoaXMuY29lZmZpY2VudHNTaWduO1xuICAgICAgICB2YXIgY29udHJpYnV0aW9uLCBzaWduMCwgc2lnbjEsIHNpZ25pZmljYW5jZTE7XG4gICAgICAgIHZhciBjb250ZXh0TGFiZWwsIGRlY29kZWQ7XG5cbiAgICAgICAgLy8gY2FsY3VsYXRlIGhvcml6b250YWwgY29udHJpYnV0aW9uXG4gICAgICAgIHNpZ25pZmljYW5jZTEgPSAoY29sdW1uID4gMCAmJiBjb2VmZmljZW50c01hZ25pdHVkZVtpbmRleCAtIDFdICE9PSAwKTtcbiAgICAgICAgaWYgKGNvbHVtbiArIDEgPCB3aWR0aCAmJiBjb2VmZmljZW50c01hZ25pdHVkZVtpbmRleCArIDFdICE9PSAwKSB7XG4gICAgICAgICAgc2lnbjEgPSBjb2VmZmljZW50c1NpZ25baW5kZXggKyAxXTtcbiAgICAgICAgICBpZiAoc2lnbmlmaWNhbmNlMSkge1xuICAgICAgICAgICAgc2lnbjAgPSBjb2VmZmljZW50c1NpZ25baW5kZXggLSAxXTtcbiAgICAgICAgICAgIGNvbnRyaWJ1dGlvbiA9IDEgLSBzaWduMSAtIHNpZ24wO1xuICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICBjb250cmlidXRpb24gPSAxIC0gc2lnbjEgLSBzaWduMTtcbiAgICAgICAgICB9XG4gICAgICAgIH0gZWxzZSBpZiAoc2lnbmlmaWNhbmNlMSkge1xuICAgICAgICAgIHNpZ24wID0gY29lZmZpY2VudHNTaWduW2luZGV4IC0gMV07XG4gICAgICAgICAgY29udHJpYnV0aW9uID0gMSAtIHNpZ24wIC0gc2lnbjA7XG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgY29udHJpYnV0aW9uID0gMDtcbiAgICAgICAgfVxuICAgICAgICB2YXIgaG9yaXpvbnRhbENvbnRyaWJ1dGlvbiA9IDMgKiBjb250cmlidXRpb247XG5cbiAgICAgICAgLy8gY2FsY3VsYXRlIHZlcnRpY2FsIGNvbnRyaWJ1dGlvbiBhbmQgY29tYmluZSB3aXRoIHRoZSBob3Jpem9udGFsXG4gICAgICAgIHNpZ25pZmljYW5jZTEgPSAocm93ID4gMCAmJiBjb2VmZmljZW50c01hZ25pdHVkZVtpbmRleCAtIHdpZHRoXSAhPT0gMCk7XG4gICAgICAgIGlmIChyb3cgKyAxIDwgaGVpZ2h0ICYmIGNvZWZmaWNlbnRzTWFnbml0dWRlW2luZGV4ICsgd2lkdGhdICE9PSAwKSB7XG4gICAgICAgICAgc2lnbjEgPSBjb2VmZmljZW50c1NpZ25baW5kZXggKyB3aWR0aF07XG4gICAgICAgICAgaWYgKHNpZ25pZmljYW5jZTEpIHtcbiAgICAgICAgICAgIHNpZ24wID0gY29lZmZpY2VudHNTaWduW2luZGV4IC0gd2lkdGhdO1xuICAgICAgICAgICAgY29udHJpYnV0aW9uID0gMSAtIHNpZ24xIC0gc2lnbjAgKyBob3Jpem9udGFsQ29udHJpYnV0aW9uO1xuICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICBjb250cmlidXRpb24gPSAxIC0gc2lnbjEgLSBzaWduMSArIGhvcml6b250YWxDb250cmlidXRpb247XG4gICAgICAgICAgfVxuICAgICAgICB9IGVsc2UgaWYgKHNpZ25pZmljYW5jZTEpIHtcbiAgICAgICAgICBzaWduMCA9IGNvZWZmaWNlbnRzU2lnbltpbmRleCAtIHdpZHRoXTtcbiAgICAgICAgICBjb250cmlidXRpb24gPSAxIC0gc2lnbjAgLSBzaWduMCArIGhvcml6b250YWxDb250cmlidXRpb247XG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgY29udHJpYnV0aW9uID0gaG9yaXpvbnRhbENvbnRyaWJ1dGlvbjtcbiAgICAgICAgfVxuXG4gICAgICAgIGlmIChjb250cmlidXRpb24gPj0gMCkge1xuICAgICAgICAgIGNvbnRleHRMYWJlbCA9IDkgKyBjb250cmlidXRpb247XG4gICAgICAgICAgZGVjb2RlZCA9IHRoaXMuZGVjb2Rlci5yZWFkQml0KHRoaXMuY29udGV4dHMsIGNvbnRleHRMYWJlbCk7XG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgY29udGV4dExhYmVsID0gOSAtIGNvbnRyaWJ1dGlvbjtcbiAgICAgICAgICBkZWNvZGVkID0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gd2lkdGg0KTtcbiAgICAgICAgICBmb3IgKHZhciBqID0gMDsgaiA8IHdpZHRoOyBqKyspIHtcbiAgICAgICAgICAgIGZvciAodmFyIGluZGV4ID0gaW5kZXgwICsgajsgaW5kZXggPCBpbmRleE5leHQ7IGluZGV4ICs9IHdpZHRoKSB7XG5cbiAgICAgICAgICAgICAgLy8gc2lnbmlmaWNhbnQgYnV0IG5vdCB0aG9zZSB0aGF0IGhhdmUganVzdCBiZWNvbWVcbiAgICAgICAgICAgICAgaWYgKCFjb2VmZmljZW50c01hZ25pdHVkZVtpbmRleF0gfHxcbiAgICAgICAgICAgICAgICAocHJvY2Vzc2luZ0ZsYWdzW2luZGV4XSAmIHByb2Nlc3NlZE1hc2spICE9PSAwKSB7XG4gICAgICAgICAgICAgICAgY29udGludWU7XG4gICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICB2YXIgY29udGV4dExhYmVsID0gMTY7XG4gICAgICAgICAgICAgIGlmICgocHJvY2Vzc2luZ0ZsYWdzW2luZGV4XSAmIGZpcnN0TWFnbml0dWRlQml0TWFzaykgIT09IDApIHtcbiAgICAgICAgICAgICAgICBwcm9jZXNzaW5nRmxhZ3NbaW5kZXhdIF49IGZpcnN0TWFnbml0dWRlQml0TWFzaztcbiAgICAgICAgICAgICAgICAvLyBmaXJzdCByZWZpbmVtZW50XG4gICAgICAgICAgICAgICB2YXIgc2lnbmlmaWNhbmNlID0gbmVpZ2hib3JzU2lnbmlmaWNhbmNlW2luZGV4XSAmIDEyNztcbiAgICAgICAgICAgICAgIGNvbnRleHRMYWJlbCA9IHNpZ25pZmljYW5jZSA9PT0gMCA/IDE1IDogMTQ7XG4gICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICB2YXIgYml0ID0gZGVjb2Rlci5yZWFkQml0KGNvbnRleHRzLCBjb250ZXh0TGFiZWwpO1xuICAgICAgICAgICAgICBjb2VmZmljZW50c01hZ25pdHVkZVtpbmRleF0gPVxuICAgICAgICAgICAgICAgIChj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ljYW5jZVtpbmRleDAgKyBvbmVSb3dEb3duXSA9PT0gMCAmJlxuICAgICAgICAgICAgICBuZWlnaGJvcnNTaWduaWZpY2FuY2VbaW5kZXgwICsgdHdvUm93c0Rvd25dID09PSAwICYmXG4gICAgICAgICAgICAgIG5laWdoYm9yc1NpZ25pZmljYW5jZVtpbmRleDAgKyB0aHJlZVJvd3NEb3duXSA9PT0gMCk7XG4gICAgICAgICAgICB2YXIgaTEgPSAwLCBpbmRleCA9IGluZGV4MDtcbiAgICAgICAgICAgIHZhciBpID0gaTAsIHNpZ247XG4gICAgICAgICAgICBpZiAoYWxsRW1wdHkpIHtcbiAgICAgICAgICAgICAgdmFyIGhhc1NpZ25pZmljYW50Q29lZmZpY2VudCA9XG4gICAgICAgICAgICAgICAgZGVjb2Rlci5yZWFkQml0KGNvbnRleHRzLCBSVU5MRU5HVEhfQ09OVEVYVCk7XG4gICAgICAgICAgICAgIGlmICghaGFzU2lnbmlmaWNhbnRDb2VmZmljZW50KSB7XG4gICAgICAgICAgICAgICAgYml0c0RlY29kZWRbaW5kZXgwXSsrO1xuICAgICAgICAgICAgICAgIGJpdHNEZWNvZGVkW2luZGV4MCArIG9uZVJvd0Rvd25dKys7XG4gICAgICAgICAgICAgICAgYml0c0RlY29kZWRbaW5kZXgwICsgdHdvUm93c0Rvd25dKys7XG4gICAgICAgICAgICAgICAgYml0c0RlY29kZWRbaW5kZXgwICsgdGhyZWVSb3dzRG93bl0rKztcbiAgICAgICAgICAgICAgICBjb250aW51ZTsgLy8gbmV4dCBjb2x1bW5cbiAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICBpMSA9IChkZWNvZGVyLnJlYWRCaXQoY29udGV4dHMsIFVOSUZPUk1fQ09OVEVYVCkgPDwgMSkgfFxuICAgICAgICAgICAgICAgICAgICBkZWNvZGVyLnJlYWRCaXQoY29udGV4dHMsIFVOSUZPUk1fQ09OVEVYVCk7XG4gICAgICAgICAgICAgIGlmIChpMSAhPT0gMCkge1xuICAgICAgICAgICAgICAgIGkgPSBpMCArIGkxO1xuICAgICAgICAgICAgICAgIGluZGV4ICs9IGkxICogd2lkdGg7XG4gICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICBzaWduID0gdGhpcy5kZWNvZGVTaWduQml0KGksIGosIGluZGV4KTtcbiAgICAgICAgICAgICAgY29lZmZpY2VudHNTaWduW2luZGV4XSA9IHNpZ247XG4gICAgICAgICAgICAgIGNvZWZmaWNlbnRzTWFnbml0dWRlW2luZGV4XSA9IDE7XG4gICAgICAgICAgICAgIHRoaXMuc2V0TmVpZ2hib3JzU2lnbmlmaWNhbmNlKGksIGosIGluZGV4KTtcbiAgICAgICAgICAgICAgcHJvY2Vzc2luZ0ZsYWdzW2luZGV4XSB8PSBmaXJzdE1hZ25pdHVkZUJpdE1hc2s7XG5cbiAgICAgICAgICAgICAgaW5kZXggPSBpbmRleDA7XG4gICAgICAgICAgICAgIGZvciAodmFyIGkyID0gaTA7IGkyIDw9IGk7IGkyKyssIGluZGV4ICs9IHdpZHRoKSB7XG4gICAgICAgICAgICAgICAgYml0c0RlY29kZWRbaW5kZXhdKys7XG4gICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICBpMSsrO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgZm9yIChpID0gaTAgKyBpMTsgaSA8IGlOZXh0OyBpKyssIGluZGV4ICs9IHdpZHRoKSB7XG4gICAgICAgICAgICAgIGlmIChjb2VmZmljZW50c01hZ25pdHVkZVtpbmRleF0gfHxcbiAgICAgICAgICAgICAgICAocHJvY2Vzc2luZ0ZsYWdzW2luZGV4XSAmIHByb2Nlc3NlZE1hc2spICE9PSAwKSB7XG4gICAgICAgICAgICAgICAgY29udGludWU7XG4gICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICB2YXIgY29udGV4dExhYmVsID0gbGFiZWxzW25laWdoYm9yc1NpZ25pZmljYW5jZVtpbmRleF1dO1xuICAgICAgICAgICAgICB2YXIgZGVjaXNpb24gPSBkZWNvZGVyLnJlYWRCaXQoY29udGV4dHMsIGNvbnRleHRMYWJlbCk7XG4gICAgICAgICAgICAgIGlmIChkZWNpc2lvbiA9PT0gMSkge1xuICAgICAgICAgICAgICAgIHNpZ24gPSB0aGlzLmRlY29kZVNpZ25CaXQoaSwgaiwgaW5kZXgpO1xuICAgICAgICAgICAgICAgIGNvZWZmaWNlbnRzU2lnbltpbmRleF0gPSBzaWduO1xuICAgICAgICAgICAgICAgIGNvZWZmaWNlbnRzTWFnbml0dWRlW2luZGV4XSA9IDE7XG4gICAgICAgICAgICAgICAgdGhpcy5zZXROZWlnaGJvcnNTaWduaWZpY2FuY2UoaSwgaiwgaW5kZXgpO1xuICAgICAgICAgICAgICAgIHByb2Nlc3NpbmdGbGFnc1tpbmRleF0gfD0gZmlyc3RNYWduaXR1ZGVCaXRNYXNrO1xuICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgIGJpdHNEZWNvZGVkW2luZGV4XSsrO1xuICAgICAgICAgICAgfVxuICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgfSxcbiAgICAgIGNoZWNrU2VnbWVudGF0aW9uU3ltYm9sOiBmdW5jdGlvbiBCaXRNb2RlbF9jaGVja1NlZ21lbnRhdGlvblN5bWJvbCgpIHtcbiAgICAgICAgdmFyIGRlY29kZXIgPSB0aGlzLmRlY29kZXI7XG4gICAgICAgIHZhciBjb250ZXh0cyA9IHRoaXMuY29udGV4dHM7XG4gICAgICAgIHZhciBzeW1ib2wgPSAoZGVjb2Rlci5yZWFkQml0KGNvbnRleHRzLCBVTklGT1JNX0NPTlRFWFQpIDw8IDMpIHxcbiAgICAgICAgICAgICAgICAgICAgIChkZWNvZGVyLnJlYWRCaXQoY29udGV4dHMsIFVOSUZPUk1fQ09OVEVYVCkgPDwgMikgfFxuICAgICAgICAgICAgICAgICAgICAgKGRlY29kZXIucmVhZEJpdChjb250ZXh0cywgVU5JRk9STV9DT05URVhUKSA8PCAxKSB8XG4gICAgICAgICAgICAgICA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O1xuICAgICAgICB4W2pdID0gSyAqIHhbal0gLSBjdXJyZW50IC0gbmV4dDtcbiAgICAgICAgaWYgKG4tLSkge1xuICAgICAgICAgIGogKz0gMjtcbiAgICAgICAgICBjdXJyZW50ID0gZGVsdGEgKiB4W2ogKyAxXTtcbiAgICAgICAgICB4W2pdID0gSyAqIHhbal0gLSBjdXJyZW50IC0gbmV4dDtcbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICBicmVhaztcbiAgICAgICAgfVxuICAgICAgfVxuXG4gICAgICAvLyBzdGVwIDRcbiAgICAgIGogPSBvZmZzZXQgLSAxO1xuICAgICAgY3VycmVudCA9IGdhbW1hICogeFtqIC0gMV07XG4gICAgICBmb3IgKG4gPSBsZW4gKyAyOyBuLS07IGogKz0gMikge1xuICAgICAgICBuZXh0ID0gZ2FtbWEgKiB4W2ogKyAxXTtcbiAgICAgICAgeFtqXSAtPSBjdXJyZW50ICsgbmV4dDtcbiAgICAgICAgaWYgKG4tLSkge1xuICAgICAgICAgIGogKz0gMjtcbiAgICAgICAgICBjdXJyZW50ID0gZ2FtbWEgKiB4W2ogKyAxXTtcbiAgICAgICAgICB4W2pdIC09IGN1cnJlbnQgKyBuZXh0O1xuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgIGJyZWFrO1xuICAgICAgICB9XG4gICAgICB9XG5cbiAgICAgIC8vIHN0ZXAgNVxuICAgICAgaiA9IG9mZnNldDtcbiAgICAgIGN1cnJlbnQgPSBiZXRhICogeFtqIC0gMV07XG4gICAgICBmb3IgKG4gPSBsZW4gKyAxOyBuLS07IGogKz0gMikge1xuICAgICAgICBuZXh0ID0gYmV0YSAqIHhbaiArIDFdO1xuICAgICAgICB4W2pdIC09IGN1cnJlbnQgKyBuZXh0O1xuICAgICAgICBpZiAobi0tKSB7XG4gICAgICAgICAgaiArPSAyO1xuICAgICAgICAgIGN1cnJlbnQgPSBiZXRhICogeFtqICsgMV07XG4gICAgICAgICAgeFtqXSAtPSBjdXJyZW50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0gdGhpcy5hIC0gcWVJY3g7XG5cbiAgICAgIGlmICh0aGlzLmNoaWdoIDwgcWVJY3gpIHtcbiAgICAgICAgLy8gZXhjaGFuZ2VMcHNcbiAgICAgICAgaWYgKGEgPCBxZUljeCkge1xuICAgICAgICAgIGEgPSBxZUljeDtcbiAgICAgICAgICBkID0gY3hfbXBzO1xuICAgICAgICAgIGN4X2luZGV4ID0gcWVUYWJsZUljeC5ubXBzO1xuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgIGEgPSBxZUljeDtcbiAgICAgICAgICBkID0gMSBeIGN4X21wcztcbiAgICAgICAgICBpZiAocWVUYWJsZUljeC5zd2l0Y2hGbGFnID09PSAxKSB7XG4gICAgICAgICAgICBjeF9tcHMgPSBkO1xuICAgICAgICAgIH1cbiAgICAgICAgICBjeF9pbmRleCA9IHFlVGFibGVJY3gubmxwcztcbiAgICAgICAgfVxuICAgICAgfSBlbHNlIHtcbiAgICAgICAgdGhpcy5jaGlnaCAtPSBxZUljeDtcbiAgICAgICAgaWYgKChhICYgMHg4MDAwKSAhPT0gMCkge1xuICAgICAgICAgIHRoaXMuYSA9IGE7XG4gICAgICAgICAgcmV0dXJuIGN4X21wcztcbiAgICAgICAgfVxuICAgICAgICAvLyBleGNoYW5nZU1wc1xuICAgICAgICBpZiAoYSA8IHFlSWN4KSB7XG4gICAgICAgICAgZCA9IDEgXiBjeF9tcHM7XG4gICAgICAgICAgaWYgKHFlVGFibGVJY3guc3dpdGNoRmxhZyA9PT0gMSkge1xuICAgICAgICAgICAgY3hfbXBzID0gZDtcbiAgICAgICAgICB9XG4gICAgICAgICAgY3hfaW5kZXggPSBxZVRhYmxlSWN4Lm5scHM7XG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgZCA9IGN4X21wcztcbiAgICAgICAgICBjeF9pbmRleCA9IHFlVGFibGVJY3gubm1wcztcbiAgICAgICAgfVxuICAgICAgfVxuICAgICAgLy8gQy4zLjMgcmVub3JtRDtcbiAgICAgIGR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rpb24gKHJlc29sdmUsIHJlamVjdCkge1xuICAgICAgcmVzb2x2ZUFsbCA9IHJlc29sdmU7XG4gICAgICByZWplY3RBbGwgPSByZWplY3Q7XG4gICAgfSk7XG4gICAgdmFyIHVucmVzb2x2ZWQgPSBwcm9taXNlcy5sZW5ndGg7XG4gICAgdmFyIHJlc3VsdHMgPSBbXTtcbiAgICBpZiAodW5yZXNvbHZlZCA9PT0gMCkge1xuICAgICAgcmVzb2x2ZUFsbChyZXN1bHRzKTtcbiAgICAgIHJldHVybiBkZWZlcnJlZDtcbiAgICB9XG4gICAgZnVuY3Rpb24gcmVqZWN0KHJlYXNvbikge1xuICAgICAgaWYgKGRlZmVycmVkLl9zdGF0dXMgPT09IFNUQVRVU19SRUpFQ1RFRCkge1xuICAgICAgICByZXR1cm47XG4gICAgICB9XG4gICAgICByZXN1bHRzID0gW107XG4gICAgICByZWplY3RBbGwocmVhc29uKTtcbiAgICB9XG4gICAgZm9yICh2YXIgaSA9IDAsIGlpID0gcHJvbWlzZXMubGVuZ3RoOyBpIDwgaWk7ICsraSkge1xuICAgICAgdmFyIHByb21pc2UgPSBwcm9taXNlc1tpXTtcbiAgICAgIHZhciByZXNvbHZlID0gKGZ1bmN0aW9uKGkpIHtcbiAgICAgICAgcmV0dXJuIGZ1bmN0aW9uKHZhbHVlKSB7XG4gICAgICAgICAgaWYgKGRlZmVycmVkLl9zdGF0dXMgPT09IFNUQVRVU19SRUpFQ1RFRCkge1xuICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICAgIH1cbiAgICAgICAgICByZXN1bHRzW2ldID0gdmFsdWU7XG4gICAgICAgICAgdW5yZXNvbHZlZC0tO1xuICAgICAgICAgIGlmICh1bnJlc29sdmVkID09PSAwKSB7XG4gICAgICAgICAgICByZXNvbHZlQWxsKHJlc3VsdHMpO1xuICAgICAgICAgIH1cbiAgICAgICAgfTtcbiAgICAgIH0pKGkpO1xuICAgICAgaWYgKFByb21pc2UuaXNQcm9taXNlKHByb21pc2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Npb24gbGV2ZWxzICovXG4vL3ZhciBaX05PX0NPTVBSRVNTSU9OICAgICAgPSAwO1xuLy92YXIgWl9CRVNUX1NQRUVEICAgICAgICAgID0gMTtcbi8vdmFyIFpfQkVTVF9DT01QUkVTU0lPTiAgICA9IDk7XG52YXIgWl9ERUZBVUxUX0NPTVBSRVNTSU9OID0gLTE7XG5cblxudmFyIFpfRklMVEVSRUQgICAgICAgICAgICA9IDE7XG52YXIgWl9IVUZGTUFOX09OTFkgICAgICAgID0gMjtcbnZhciBaX1JMRSAgICAgICAgICAgICAgICAgPSAzO1xudmFyIFpfRklYRUQgICAgICAgICAgICAgICA9IDQ7XG52YXIgWl9ERUZBVUxUX1NUUkFURUdZICAgID0gMDtcblxuLyogUG9zc2libGUgdmFsdWVzIG9mIHRoZSBkYXRhX3R5cGUgZmllbGQgKHRob3VnaCBzZWUgaW5mbGF0ZSgpKSAqL1xuLy92YXIgWl9CSU5BUlkgICAgICAgICAgICAgID0gMDtcbi8vdmFyIFpfVEVYVCAgICAgICAgICAgICAgICA9IDE7XG4vL3ZhciBaX0FTQ0lJICAgICAgICAgICAgICAgPSAxOyAvLyA9IFpfVEVYVFxudmFyIFpfVU5LTk9XTiAgICAgICAgICAgICA9IDI7XG5cblxuLyogVGhlIGRlZmxhdGUgY29tcHJlc3Npb24gbWV0aG9kICovXG52YXIgWl9ERUZMQVRFRCAgPSA4O1xuXG4vKj09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0qL1xuXG5cbnZhciBNQVhfTUVNX0xFVkVMID0gOTtcbi8qIE1heGltdW0gdmFsdWUgZm9yIG1lbUxldmVsIGluIGRlZmxhdGVJbml0MiAqL1xudmFyIE1BWF9XQklUUyA9IDE1O1xuLyogMzJLIExaNzcgd2luZG93ICovXG52YXIgREVGX01FTV9MRVZFTCA9IDg7XG5cblxudmFyIExFTkdUSF9DT0RFUyAgPSAyOTtcbi8qI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gICBpZiAocy5zdHJzdGFydCAtIHMuYmxvY2tfc3RhcnQgPj0gKHMud19zaXplIC0gTUlOX0xPT0tBSEVBRCkpIHtcbiAgICAgIC8qKiogRkxVU0hfQkxPQ0socywgMCk7ICoqKi9cbiAgICAgIGZsdXNoX2Jsb2NrX29ubHkocywgZmFsc2UpO1xuICAgICAgaWYgKHMuc3RybS5hdmFpbF9vdXQgPT09IDApIHtcbiAgICAgICAgcmV0dXJuIEJTX05FRURfTU9SRTtcbiAgICAgIH1cbiAgICAgIC8qKiovXG4gICAgfVxuICB9XG5cbiAgcy5pbnNlcnQgPSAwO1xuXG4gIGlmIChmbHVzaCA9PT0gWl9GSU5JU0gpIHtcbiAgICAvKioqIEZMVVNIX0JMT0NLKHMsIDEpOyAqKiovXG4gICAgZmx1c2hfYmxvY2tfb25seShzLCB0cnVlKTtcbiAgICBpZiAocy5zdHJtLmF2YWlsX291dCA9PT0gMCkge1xuICAgICAgcmV0dXJuIEJTX0ZJTklTSF9TVEFSVEVEO1xuICAgIH1cbiAgICAvKioqL1xuICAgIHJldHVybiBCU19GSU5JU0hfRE9ORTtcbiAgfVxuXG4gIGlmIChzLnN0cnN0YXJ0ID4gcy5ibG9ja19zdGFydCkge1xuICAgIC8qKiogRkxVU0hfQkxPQ0socywgMCk7ICoqKi9cbiAgICBmbHVzaF9ibG9ja19vbmx5KHMsIGZhbHNlKTtcbiAgICBpZiAocy5zdHJtLmF2YWlsX291dCA9PT0gMCkge1xuICAgICAgcmV0dXJuIEJTX05FRURfTU9SRTtcbiAgICB9XG4gICAgLyoqKi9cbiAgfVxuXG4gIHJldHVybiBCU19ORUVEX01PUkU7XG59XG5cbi8qID09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PVxuICogQ29tcHJlc3MgYXMgbXVjaCBhcyBwb3NzaWJsZSBmcm9tIHRoZSBpbnB1dCBzdHJlYW0sIHJldHVybiB0aGUgY3V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AgIHMuc3RhdHVzID0gQlVTWV9TVEFURTtcbiAgICAgIH1cbiAgICAgIGVsc2Uge1xuICAgICAgICBwdXRfYnl0ZShzLCAocy5nemhlYWQudGV4dCA/IDEgOiAwKSArXG4gICAgICAgICAgICAgICAgICAgIChzLmd6aGVhZC5oY3JjID8gMiA6IDApICtcbiAgICAgICAgICAgICAgICAgICAgKCFzLmd6aGVhZC5leHRyYSA/IDAgOiA0KSArXG4gICAgICAgICAgICAgICAgICAgICghcy5nemhlYWQubmFtZSA/IDAgOiA4KSArXG4gICAgICAgICAgICAgICAgICAgICghcy5nemhlYWQuY29tbWVudCA/IDAgOiAxNilcbiAgICAgICAgICAgICAgICApO1xuICAgICAgICBwdXRfYnl0ZShzLCBzLmd6aGVhZC50aW1lICYgMHhmZik7XG4gICAgICAgIHB1dF9ieXRlKHMsIChzLmd6aGVhZC50aW1lID4+IDgpICYgMHhmZik7XG4gICAgICAgIHB1dF9ieXRlKHMsIChzLmd6aGVhZC50aW1lID4+IDE2KSAmIDB4ZmYpO1xuICAgICAgICBwdXRfYnl0ZShzLCAocy5nemhlYWQudGltZSA+PiAyNCkgJiAweGZmKTtcbiAgICAgICAgcHV0X2J5dGUocywgcy5sZXZlbCA9PT0gOSA/IDIgOlxuICAgICAgICAgICAgICAgICAgICAocy5zdHJhdGVneSA+PSBaX0hVRkZNQU5fT05MWSB8fCBzLmxldmVsIDwgMiA/XG4gICAgICAgICAgICAgICAgICAgICA0IDogMCkpO1xuICAgICAgICBwdXRfYnl0ZShzLCBzLmd6aGVhZC5vcyAmIDB4ZmYpO1xuICAgICAgICBpZiAocy5nemhlYWQuZXh0cmEgJiYgcy5nemhlYWQuZXh0cmEubGVuZ3RoKSB7XG4gICAgICAgICAgcHV0X2J5dGUocywgcy5nemhlYWQuZXh0cmEubGVuZ3RoICYgMHhmZik7XG4gICAgICAgICAgcHV0X2J5dGUocywgKHMuZ3poZWFkLmV4dHJhLmxlbmd0aCA+PiA4KSAmIDB4ZmYpO1xu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zLmd6aGVhZC5oY3JjICYmIHMucGVuZGluZyA+IGJlZykge1xuICAgICAgICAgICAgc3RybS5hZGxlciA9IGNyYzMyKHN0cm0uYWRsZXIsIHMucGVuZGluZ19idWYsIHMucGVuZGluZyAtIGJlZywgYmVnKTtcbiAgICAgICAgICB9XG4gICAgICAgICAgZmx1c2hfcGVuZGluZyhzdHJtKTtcbiAgICAgICAgICBiZWcgPSBzLnBlbmRpbmc7XG4gICAgICAgICAgaWYgKHMucGVuZGluZyA9PT0gcy5wZW5kaW5nX2J1Zl9zaXplKSB7XG4gICAgICAgICAgICB2YWwgPSAxO1xuICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIC8vIEpTIHNwZWNpZmljOiBsaXR0bGUgbWFnaWMgdG8gYWRkIHplcm8gdGVybWluYXRvciB0byBlbmQgb2Ygc3RyaW5nXG4gICAgICAgIGlmIChzLmd6aW5kZXggPCBzLmd6aGVhZC5jb21tZW50Lmxlbmd0aCkge1xuICAgICAgICAgIHZhbCA9IHMuZ3poZWFkLmNvbW1lbnQuY2hhckNvZGVBdChzLmd6aW5kZXgrKykgJiAweGZmO1xuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgIHZhbCA9IDA7XG4gICAgICAgIH1cbiAgICAgICAgcHV0X2J5dGUocywgdmFsKTtcbiAgICAgIH0gd2hpbGUgKHZhbCAhPT0gMCk7XG5cbiAgICAgIGlmIChzLmd6aGVhZC5oY3JjICYmIHMucGVuZGluZyA+IGJlZykge1xuICAgICAgICBzdHJtLmFkbGVyID0gY3JjMzIoc3RybS5hZGxlciwgcy5wZW5kaW5nX2J1Ziwgcy5wZW5kaW5nIC0gYmVnLCBiZWcpO1xuICAgICAgfVxuICAgICAgaWYgKHZhbCA9PT0gMCkge1xuICAgICAgICBzLnN0YXR1cyA9IEhDUkNfU1RBVEU7XG4gICAgICB9XG4gICAgfVxuICAgIGVsc2Uge1xuICAgICAgcy5zdGF0dXMgPSBI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lkIGNvbmZsaWN0IHdpdGggaW5zdHJ1bWVudGF0aW9uIHRvb2xzXG4gIHZhciBzX3dpbmRvdzsgICAgICAgICAgICAgICAvKiBhbGxvY2F0ZWQgc2xpZGluZyB3aW5kb3csIGlmIHdzaXplICE9IDAgKi9cbiAgdmFyIGhvbGQ7ICAgICAgICAgICAgICAgICAgIC8qIGxvY2FsIHN0cm0uaG9sZCAqL1xuICB2YXIgYml0czsgICAgICAgICAgICAgICAgICAgLyogbG9jYWwgc3RybS5iaXRzICovXG4gIHZhciBsY29kZTsgICAgICAgICAgICAgICAgICAvKiBsb2NhbCBzdHJtLmxlbmNvZGUgKi9cbiAgdmFyIGRjb2RlOyAgICAgICAgICAgICAgICAgIC8qIGxvY2FsIHN0cm0uZGlzdGNvZGUgKi9cbiAgdmFyIGxtYXNrOyAgICAgICAgICAgICAgICAgIC8qIG1hc2sgZm9yIGZpcnN0IGxldmVsIG9mIGxlbmd0aCBjb2RlcyAqL1xuICB2YXIgZG1hc2s7ICAgICAgICAgICAgICAgICAgLyogbWFzayBmb3IgZmlyc3QgbGV2ZWwgb2YgZGlzdGFuY2UgY29kZXMgKi9cbiAgdmFyIGhlcmU7ICAgICAgICAgICAgICAgICAgIC8qIHJldHJpZXZlZCB0YWJsZSBlbnRyeSAqL1xuICB2YXIgb3A7ICAgICAgICAgICAgICAgICAgICAgLyogY29kZSBiaXRzLCBvcGVyYXRpb24sIGV4dHJhIGJpdHMsIG9yICovXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiAgd2luZG93IHBvc2l0aW9uLCB3aW5kb3cgYnl0ZXMgdG8gY29weSAqL1xuICB2YXIgbGVuOyAgICAgICAgICAgICAgICAgICAgLyogbWF0Y2ggbGVuZ3RoLCB1bnVzZWQgYnl0ZXMgKi9cbiAgdmFyIGRpc3Q7ICAgICAgICAgICAgICAgICAgIC8qIG1hdGNoIGRpc3RhbmNlICovXG4gIHZhciBmcm9tOyAgICAgICAgICAgICAgICAgICAvKiB3a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dGFuY2VzIHVudGlsIGVuZC1vZi1ibG9jayBvciBub3QgZW5vdWdoXG4gICAgIGlucHV0IGRhdGEgb3Igb3V0cHV0IHNwYWNlICovXG5cbiAgdG9wOlxuICBkbyB7XG4gICAgaWYgKGJpdHMgPCAxNSkge1xuICAgICAgaG9sZCArPSBpbnB1dFtfaW4rK10gPDwgYml0cztcbiAgICAgIGJpdHMgKz0gODtcbiAgICAgIGhvbGQgKz0gaW5wdXRbX2luKytdIDw8IGJpdHM7XG4gICAgICBiaXRzICs9IDg7XG4gICAgfVxuXG4gICAgaGVyZSA9IGxjb2RlW2hvbGQgJiBsbWFza107XG5cbiAgICBkb2xlbjpcbiAgICBmb3IgKDs7KSB7IC8vIEdvdG8gZW11bGF0aW9uXG4gICAgICBvcCA9IGhlcmUgPj4+IDI0LypoZXJlLmJpdHMqLztcbiAgICAgIGhvbGQgPj4+PSBvcDtcbiAgICAgIGJpdHMgLT0gb3A7XG4gICAgICBvcCA9IChoZXJlID4+PiAxNikgJiAweGZmLypoZXJlLm9wKi87XG4gICAgICBpZiAob3AgPT09IDApIHsgICAgICAgICAgICAgICAgICAgICAgICAgIC8qIGxpdGVyYWwgKi9cbiAgICAgICAgLy9UcmFjZXZ2KChzdGRlcnIsIGhlcmUudmFsID49IDB4MjAgJiYgaGVyZS52YWwgPCAweDdmID9cbiAgICAgICAgLy8gICAgICAgIFwiaW5mbGF0ZTogICAgICAgICBsaXRlcmFsICclYydcXG5cIiA6XG4gICAgICAgIC8vICAgICAgICBcImluZmxhdGU6ICAgICAgICAgbGl0ZXJhbCAweCUwMnhcXG5cIiwgaGVyZS52YWwpKTtcbiAgICAgICAgb3V0cHV0W19vdXQrK10gPSBoZXJlICYgMHhmZmZmLypoZXJlLnZhbCovO1xuICAgICAgfVxuICAgICAgZWxzZSBpZiAob3AgJiAxNikgeyAgICAgICAgICAgICAgICAgICAgIC8qIGxlbmd0aCBiYXNlICovXG4gICAgICAgIGxlbiA9IGhlcmUgJiAweGZmZmYvKmhlcmUudmFsKi87XG4gICAgICAgIG9wICY9IDE1OyAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qIG51bWJlciBvZiBleHRyYSBiaXRzICovXG4gICAgICAgIGlmIChvcCkge1xuICAgICAgICAgIGlmIChiaXRzIDwgb3ApIHtcbiAgICAgICAgICAgIGhvbGQgKz0gaW5wdXRbX2luKytdIDw8IGJpdHM7XG4gICAgICAgICAgICBiaXRzICs9IDg7XG4gICAgICAgICAgfVxuICAgICAgICAgIGxlbiArPSBob2xkICYgKCgxIDw8IG9wKSAtIDEpO1xuICAgICAgICAgIGhvbGQgPj4+PSBvcDtcbiAgICAgICAgICBiaXRzIC09IG9wO1xuICAgICAgICB9XG4gICAgICAgIC8vVHJhY2V2digoc3RkZXJyLCBcImluZmxhdGU6ICAgICAgICAgbGVuZ3RoICV1XFxuXCIsIGxlbikpO1xuICAgICAgICBpZiAoYml0cyA8IDE1KSB7XG4gICAgICAgICAgaG9sZCArPSBpbnB1dFtfaW4rK10gPDwgYml0cztcbiAgICAgICAgICBiaXRzICs9IDg7XG4gICAgICAgICAgaG9sZCArPSBpbnB1dFtfaW4rK10gPDwgYml0cztcbiAgICAgICAgICBiaXRzICs9IDg7XG4gICAgICAgIH1cbiAgICAgICAgaGVyZSA9IGRjb2RlW2hvbGQgJiBkbWFza107XG5cbiAgICAgICAgZG9kaXN0OlxuICAgICAgICBmb3IgKDs7KSB7IC8vIGdvdG8gZW11bGF0aW9uXG4gICAgICAgICAgb3AgPSBoZXJlID4+PiAyNC8qaGVyZS5iaXRzKi87XG4gICAgICAgICAgaG9sZCA+Pj49IG9wO1xuICAgICAgICAgIGJpdHMgLT0gb3A7XG4gICAgICAgICAgb3AgPSAoaGVyZSA+Pj4gMTYpICYgMHhmZi8qaGVyZS5vcCovO1xuXG4gICAgICAgICAgaWYgKG9wICYgMTYpIHsgICAgICAgICAgICAgICAgICAgICAgLyogZGlzdGFuY2UgYmFzZSAqL1xuICAgICAgICAgICAgZGlzdCA9IGhlcmUgJiAweGZmZmYvKmhlcmUudmFsKi87XG4gICAgICAgICAgICBvcCAmPSAxNTsgICAgICAgICAgICAgICAgICAgICAgIC8qIG51bWJlciBvZiBleHRyYSBiaXRzICovXG4gICAgICAgICAgICBpZiAoYml0cyA8IG9wKSB7XG4gICAgICAgICAgICAgIGhvbGQgKz0gaW5wdXRbX2luKytdIDw8IGJpdHM7XG4gICAgICAgICAgICAgIGJpdHMgKz0gODtcbiAgICAgICAgICAgICAgaWYgKGJpdHMgPCBvcCkge1xuICAgICAgICAgICAgICAgIGhvbGQgKz0gaW5wdXRbX2luKytdIDw8IGJpdHM7XG4gICAgICAgICAgICAgICAgYml0cyArPSA4O1xuICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBkaXN0ICs9IGhvbGQgJiAoKDEgPDwgb3ApIC0gMSk7XG4vLyNpZmRlZiBJTkZMQVRFX1NUUklDVFxuICAgICAgICAgICAgaWYgKGRpc3QgPiBkbWF4KSB7XG4gICAgICAgICAgICAgIHN0cm0ubXNnID0gJ2ludmFsaWQgZGlzdGFuY2UgdG9vIGZhciBiYWNrJztcbiAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IEJBRDtcbiAgICAgICAgICAgICAgYnJlYWsgdG9wO1xuICAgICAgICAgICAgfVxuLy8jZW5kaWZcbiAgICAgICAgICAgIGhvbGQgPj4+PSBvcDtcbiAgICAgICAgICAgIGJpdHMgLT0gb3A7XG4gICAgICAgICAgICAvL1RyYWNldnYoKHN0ZGVyciwgXCJpbmZsYXRlOiAgICAgICAgIGRpc3RhbmNlICV1XFxuXCIsIGRpc3QpKTtcbiAgICAgICAgICAgIG9wID0gX291dCAtIGJlZzsgICAgICAgICAgICAgICAgLyogbWF4IGRpc3RhbmNlIGluIG91dHB1dCAqL1xuICAgICAgICAgICAgaWYgKGRpc3QgPiBvcCkgeyAgICAgICAgICAgICAgICAvKiBzZWUgaWYgY29weSBmcm9tIHdpbmRvdyAqL1xuICAgICAgICAgICAgICBvcCA9IGRpc3QgLSBvcDsgICAgICAgICAgICAgICAvKiBkaXN0YW5jZSBiYWNrIGluIHdpbmRvdyAqL1xuICAgICAgICAgICAgICBpZiAob3AgPiB3aGF2ZSkge1xuICAgICAgICAgICAgICAgIGlmIChzdGF0ZS5zYW5lKSB7XG4gICAgICAgICAgICAgICAgICBzdHJtLm1zZyA9ICdpbnZhbGlkIGRpc3RhbmNlIHRvbyBmYXIgYmFjayc7XG4gICAgICAgICAgICAgICAgICBzdGF0ZS5tb2RlID0gQkFEO1xuICAgICAgICAgICAgICAgICAgYnJlYWsgdG9wO1xuICAgICAgICAgICAgICAgIH1cblxuLy8gKCEpIFRoaXMgYmxvY2sgaXMgZGlzYWJsZWQgaW4gemxpYiBkZWZhaWx0cyxcbi8vIGRvbid0IGVuYWJsZSBpdCBmb3IgYmluYXJ5IGNvbXBhdGliaWxpdHlcbi8vI2lmZGVmIElORkxBVEVfQUxMT1dfSU5WQUxJRF9ESVNUQU5DRV9UT09GQVJfQVJSUlxuLy8gICAgICAgICAgICAgICAgaWYgKGxlbiA8PSBvcCAtIHdoYXZlKSB7XG4vLyAgICAgICAgICAgICAgICAgIGRvIHtcbi8vICAgICAgICAgICAgICAgICAgICBvdXRwdXRbX291dCsrXSA9IDA7XG4vLyAgICAgICAgICAgICAgICAgIH0gd2hpbGUgKC0tbGVuKTtcbi8vICAgICAgICAgICAgICAgICAgY29udGludWUgdG9wO1xuLy8gICAgICAgICAgICAgICAgfVxuLy8gICAgICAgICAgICAgICAgbGVuIC09IG9wIC0gd2hhdmU7XG4vLyAgICAgICAgICAgICAgICBkbyB7XG4vLyAgICAgICAgICAgICAgICAgIG91dHB1dFtfb3V0KytdID0gMDtcbi8vICAgICAgICAgICAgICAgIH0gd2hpbGUgKC0tb3AgPiB3aGF2ZSk7XG4vLyAgICAgICAgICAgICAgICBpZiAob3AgPT09IDApIHtcbi8vICAgICAgICAgICAgICAgICAgZnJvbSA9IF9vdXQgLSBkaXN0O1xuLy8gICAgICAgICAgICAgICAgICBkbyB7XG4vLyAgICAgICAgICAgICAgICAgICAgb3V0cHV0W19vdXQrK10gPSBvdXRwdXRbZnJvbSsrXTtcbi8vICAgICAgICAgICAgICAgICAgfSB3aGlsZSAoLS1sZW4pO1xuLy8gICAgICAgICAgICAgICAgICBjb250aW51ZSB0b3A7XG4vLyAgICAgICAgICAgICAgICB9XG4vLyNlbmRpZlxuICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgIGZyb20gPSAwOyAvLyB3aW5kb3cgaW5kZXhcbiAgICAgICAgICAgICAgZnJvbV9zb3VyY2UgPSBzX3dpbmRvdztcbiAgICAgICAgICAgICAgaWYgKHduZXh0ID09PSAwKSB7ICAgICAgICAgICAvKiB2ZXJ5IGNvbW1vbiBjYXNlICovXG4gICAgICAgICAgICAgICAgZnJvbSArPSB3c2l6ZSAtIG9wO1xuICAgICAgICAgICAgICAgIGlmIChvcCA8IGxlbikgeyAgICAgICAgIC8qIHNvbWUgZnJvbSB3aW5kb3cgKi9cbiAgICAgICAgICAgICAgICAgIGxlbiAtPSBvcDtcbiAgICAgICAgICAgICAgICAgIGRvIHtcbiAgICAgICAgICAgICAgICAgICAgb3V0cHV0W19vdXQrK10gPSBzX3dpbmRvd1tmcm9tKytdO1xuICAgICAgICAgICAgICAgICAgfSB3aGlsZSAoLS1vcCk7XG4gICAgICAgICAgICAgICAgICBmcm9tID0gX291dCAtIGRpc3Q7ICAvKiByZXN0IGZyb20gb3V0cHV0ICovXG4gICAgICAgICAgICAgICAgICBmcm9tX3NvdXJjZSA9IG91dHB1dDtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgZWxzZSBpZiAod25leHQgPCBvcCkgeyAgICAgIC8qIHdyYXAgYXJvdW5kIHdpbmRvdyAqL1xuICAgICAgICAgICAgICAgIGZyb20gKz0gd3NpemUgKyB3bmV4dCAtIG9wO1xuICAgICAgICAgICAgICAgIG9wIC09IHduZXh0O1xuICAgICAgICAgICAgICAgIGlmIChvcCA8IGxlbikgeyAgICAgICAgIC8qIHNvbWUgZnJvbSBlbmQgb2Ygd2luZG93ICovXG4gICAgICAgICAgICAgICAgICBsZW4gLT0gb3A7XG4gICAgICAgICAgICAgICAgICBkbyB7XG4gICAgICAgICAgICAgICAgICAgIG91dHB1dFtfb3V0KytdID0gc193aW5kb3dbZnJvbSsrXTtcbiAgICAgICAgICAgICAgICAgIH0gd2hpbGUgKC0tb3ApO1xuICAgICAgICAgICAgICAgICAgZnJvbSA9IDA7XG4gICAgICAgICAgICAgICAgICBpZiAod25leHQgPCBsZW4pIHsgIC8qIHNvbWUgZnJvbSBzdGFydCBvZiB3aW5kb3cgKi9cbiAgICAgICAgICAgICAgICAgICAgb3AgPSB3bmV4dDtcbiAgICAgICAgICAgICAgICAgICAgbGVuIC09IG9wO1xuICAgICAgICAgICAgICAgICAgICBkbyB7XG4gICAgICAgICAgICAgICAgICAgICAgb3V0cHV0W19vdXQrK10gPSBzX3dpbmRvd1tmcm9tKytdO1xuICAgICAgICAgICAgICAgICAgICB9IHdoaWxlICgtLW9wKTtcbiAgICAgICAgICAgICAgICAgICAgZnJvbSA9IF9vdXQgLSBkaXN0OyAgICAgIC8qIHJlc3QgZnJvbSBvdXRwdXQgKi9cbiAgICAgICAgICAgICAgICAgICAgZnJvbV9zb3VyY2UgPSBvdXRwdXQ7XG4gICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgIGVsc2UgeyAgICAgICAgICAgICAgICAgICAgICAvKiBjb250aWd1b3VzIGluIHdpbmRvdyAqL1xuICAgICAgICAgICAgICAgIGZyb20gKz0gd25leHQgLSBvcDtcbiAgICAgICAgICAgICAgICBpZiAob3AgPCBsZW4pIHsgICAgICAgICAvKiBzb21lIGZyb20gd2luZG93ICovXG4gICAgICAgICAgICAgICAgICBsZW4gLT0gb3A7XG4gICAgICAgICAgICAgICAgICBkbyB7XG4gICAgICAgICAgICAgICAgICAgIG91dHB1dFtfb3V0KytdID0gc193aW5kb3dbZnJvbSsrXTtcbiAgICAgICAgICAgICAgICAgIH0gd2hpbGUgKC0tb3ApO1xuICAgICAgICAgICAgICAgICAgZnJvbSA9IF9vdXQgLSBkaXN0OyAgLyogcmVzdCBmcm9tIG91dHB1dCAqL1xuICAgICAgICAgICAgICAgICAgZnJvbV9zb3VyY2UgPSBvdXRwdXQ7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgIHdoaWxlIChsZW4gPiAyKSB7XG4gICAgICAgICAgICAgICAgb3V0cHV0W19vdXQrK10gPSBmcm9tX3NvdXJjZVtmcm9tKytdO1xuICAgICAgICAgICAgICAgIG91dHB1dFtfb3V0KytdID0gZnJvbV9zb3VyY2VbZnJvbSsrXTtcbiAgICAgICAgICAgICAgICBvdXRwdXRbX291dCsrXSA9IGZyb21fc291cmNlW2Zyb20rK107XG4gICAgICAgICAgICAgICAgbGVuIC09IDM7XG4gICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgaWYgKGxlbikge1xuICAgICAgICAgICAgICAgIG91dHB1dFtfb3V0KytdID0gZnJvbV9zb3VyY2VbZnJvbSsrXTtcbiAgICAgICAgICAgICAgICBpZiAobGVuID4gMSkge1xuICAgICAgICAgICAgICAgICAgb3V0cHV0W19vdXQrK10gPSBmcm9tX3NvdXJjZVtmcm9tKytdO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICAgIGZyb20gPSBfb3V0IC0gZGlzdDsgICAgICAgICAgLyogY29weSBkaXJlY3QgZnJvbSBvdXRwdXQgKi9cbiAgICAgICAgICAgICAgZG8geyAgICAgICAgICAgICAgICAgICAgICAgIC8qIG1pbmltdW0gbGVuZ3RoIGlzIHRocmVlICovXG4gICAgICAgICAgICAgICAgb3V0cHV0W19vdXQrK10gPSBvdXRwdXRbZnJvbSsrXTtcbiAgICAgICAgICAgICAgICBvdXRwdXRbX291dCsrXSA9IG91dHB1dFtmcm9tKytdO1xuICAgICAgICAgICAgICAgIG91dHB1dFtfb3V0KytdID0gb3V0cHV0W2Zyb20rK107XG4gICAgICAgICAgICAgICAgbGVuIC09IDM7XG4gICAgICAgICAgICAgIH0gd2hpbGUgKGxlbiA+IDIpO1xuICAgICAgICAgICAgICBpZiAobGVuKSB7XG4gICAgICAgICAgICAgICAgb3V0cHV0W19vdXQrK10gPSBvdXRwdXRbZnJvbSsrXTtcbiAgICAgICAgICAgICAgICBpZiAobGVuID4gMSkge1xuICAgICAgICAgICAgICAgICAgb3V0cHV0W19vdXQrK10gPSBvdXRwdXRbZnJvbSsrXTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgICB9XG4gICAgICAgICAgZWxzZSBpZiAoKG9wICYgNjQpID09PSAwKSB7ICAgICAgICAgIC8qIDJuZCBsZXZlbCBkaXN0YW5jZSBjb2RlICovXG4gICAgICAgICAgICBoZXJlID0gZGNvZGVbKGhlcmUgJiAweGZmZmYpLypoZXJlLnZhbCovICsgKGhvbGQgJiAoKDEgPDwgb3ApIC0gMSkpXTtcbiAgICAgICAgICAgIGNvbnRpbnVlIGRvZGlzdDtcbiAgICAgICAgICB9XG4gICAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICBzdHJtLm1zZyA9ICdpbnZhbGlkIGRpc3RhbmNlIGNvZGUnO1xuICAgICAgICAgICAgc3RhdGUubW9kZSA9IEJBRDtcbiAgICAgICAgICAgIGJyZWFrIHRvcDtcbiAgICAgICAgICB9XG5cbiAgICAgICAgICBicmVhazsgLy8gbmVlZCB0byBlbXVsYXRlIGdvdG8gdmlhIFwiY29udGludWVcIlxuICAgICAgICB9XG4gICAgICB9XG4gICAgICBlbHNlIGlmICgob3AgJiA2NCkgPT09IDApIHsgICAgICAgICA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PSAoX2luIDwgbGFzdCA/IDUgKyAobGFzdCAtIF9pbikgOiA1IC0gKF9pbiAtIGxhc3QpKTtcbiAgc3RybS5hdmFpbF9vdXQgPSAoX291dCA8IGVuZCA/IDI1NyArIChlbmQgLSBfb3V0KSA6IDI1NyAtIChfb3V0IC0gZW5kKSk7XG4gIHN0YXRlLmhvbGQgPSBob2xkO1xuICBzdGF0ZS5iaXRzID0gYml0cztcbiAgcmV0dXJuO1xufTtcbiIsIid1c2Ugc3RyaWN0JztcblxuXG52YXIgdXRpbHMgPSByZXF1aXJlKCcuLi91dGlscy9jb21tb24nKTtcbnZhciBhZGxlcjMyID0gcmVxdWlyZSgnLi9hZGxlcjMyJyk7XG52YXIgY3JjMzIgICA9IHJlcXVpcmUoJy4vY3JjMzInKTtcbnZhciBpbmZsYXRlX2Zhc3QgPSByZXF1aXJlKCcuL2luZmZhc3QnKTtcbnZhciBpbmZsYXRlX3RhYmxlID0gcmVxdWlyZSgnLi9pbmZ0cmVlcycpO1xuXG52YXIgQ09ERVMgPSAwO1xudmFyIExFTlMgPSAxO1xudmFyIERJU1RTID0gMjtcblxuLyogUHVibGljIGNvbnN0YW50cyA9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09Ki9cbi8qID09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PSovXG5cblxuLyogQWxsb3dlZCBmbHVzaCB2YWx1ZXM7IHNlZSBkZWZsYXRlKCkgYW5kIGluZmxhdGUoKSBiZWxvdyBmb3IgZGV0YWlscyAqL1xuLy92YXIgWl9OT19GTFVTSCAgICAgID0gMDtcbi8vdmFyIFpfUEFSVElBTF9GTFVTSCA9IDE7XG4vL3ZhciBaX1NZTkNfRkxVU0ggICAgPSAyO1xuLy92YXIgWl9GVUxMX0ZMVVNIICAgID0gMztcbnZhciBaX0ZJTklTSCAgICAgICAgPSA0O1xudmFyIFpfQkxPQ0sgICAgICAgICA9IDU7XG52YXIgWl9UUkVFUyAgICAgICAgID0gNjtcblxuXG4vKiBSZXR1cm4gY29kZXMgZm9yIHRoZSBjb21wcmVzc2lvbi9kZWNvbXByZXNzaW9uIGZ1bmN0aW9ucy4gTmVnYXRpdmUgdmFsdWVzXG4gKiBhcmUgZXJyb3JzLCBwb3NpdGl2ZSB2YWx1ZXMgYXJlIHVzZWQgZm9yIHNwZWNpYWwgYnV0IG5vcm1hbCBldmVudHMuXG4gKi9cbnZhciBaX09LICAgICAgICAgICAgPSAwO1xudmFyIFpfU1RSRUFNX0VORCAgICA9IDE7XG52YXIgWl9ORUVEX0RJQ1QgICAgID0gMjtcbi8vdmFyIFpfRVJSTk8gICAgICAgICA9IC0xO1xudmFyIFpfU1RSRUFNX0VSUk9SICA9IC0yO1xudmFyIFpfREFUQV9FUlJPUiAgICA9IC0zO1xudmFyIFpfTUVNX0VSUk9SICAgICA9IC00O1xudmFyIFpfQlVGX0VSUk9SICAgICA9IC01O1xuLy92YXIgWl9WRVJTSU9OX0VSUk9SID0gLTY7XG5cbi8qIFRoZSBkZWZsYXRlIGNvbXByZXNzaW9uIG1ldGhvZCAqL1xudmFyIFpfREVGTEFURUQgID0gODtcblxuXG4vKiBTVEFURVMgPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0qL1xuLyogPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09Ki9cblxuXG52YXIgICAgSEVBRCA9IDE7ICAgICAgIC8qIGk6IHdhaXRpbmcgZm9yIG1hZ2ljIGhlYWRlciAqL1xudmFyICAgIEZMQUdTID0gMjsgICAgICAvKiBpOiB3YWl0aW5nIGZvciBtZXRob2QgYW5kIGZsYWdzIChnemlwKSAqL1xudmFyICAgIFRJTUUgPSAzOyAgICAgICAvKiBpOiB3YWl0aW5nI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GxlbWVudCkgKi9cbnZhciAgICAgICAgQ09QWV8gPSAxNTsgICAgIC8qIGkvbzogc2FtZSBhcyBDT1BZIGJlbG93LCBidXQgb25seSBmaXJzdCB0aW1lIGluICovXG52YXIgICAgICAgIENPUFkgPSAxNjsgICAgICAvKiBpL286IHdhaXRpbmcgZm9yIGlucHV0IG9yIG91dHB1dCB0byBjb3B5IHN0b3JlZCBibG9jayAqL1xudmFyICAgICAgICBUQUJMRSA9IDE3OyAgICAgLyogaTogd2FpdGluZyBmb3IgZHluYW1pYyBibG9jayB0YWJsZSBsZW5ndGhzICovXG52YXIgICAgICAgIExFTkxFTlMgPSAxODsgICAvKiBpOiB3YWl0aW5nIGZvciBjb2RlIGxlbmd0aCBjb2RlIGxlbmd0aHMgKi9cbnZhciAgICAgICAgQ09ERUxFTlMgPSAxOTsgIC8qIGk6IHdhaXRpbmcgZm9yIGxlbmd0aC9saXQgYW5kIGRpc3RhbmNlIGNvZGUgbGVuZ3RocyAqL1xudmFyICAgICAgICAgICAgTEVOXyA9IDIwOyAgICAgIC8qIGk6IHNhbWUgYXMgTEVOIGJlbG93LCBidXQgb25seSBmaXJzdCB0aW1lIGluICovXG52YXIgICAgICAgICAgICBMRU4gPSAyMTsgICAgICAgLyogaTogd2FpdGluZyBmb3IgbGVuZ3RoL2xpdC9lb2IgY29kZSAqL1xudmFyICAgICAgICAgICAgTEVORVhUID0gMjI7ICAgIC8qIGk6IHdhaXRpbmcgZm9yIGxlbmd0aCBleHRyYSBiaXRzICovXG52YXIgICAgICAgICAgICBESVNUID0gMjM7ICAgICAgLyogaTogd2FpdGluZyBmb3IgZGlzdGFuY2UgY29kZSAqL1xudmFyICAgICAgICAgICAgRElTVEVYVCA9IDI0OyAgIC8qIGk6IHdhaXRpbmcgZm9yIGRpc3RhbmNlIGV4dHJhIGJpdHMgKi9cbnZhciAgICAgICAgICAgIE1BVENIID0gMjU7ICAgICAvKiBvOiB3YWl0aW5nIGZvciBvdXRwdXQgc3BhY2UgdG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gIC8vLS0tLy9cbiAgICAgIGxlbiA9IChob2xkICYgMHgwZikvKkJJVFMoNCkqLyArIDg7XG4gICAgICBpZiAoc3RhdGUud2JpdHMgPT09IDApIHtcbiAgICAgICAgc3RhdGUud2JpdHMgPSBsZW47XG4gICAgICB9XG4gICAgICBlbHNlIGlmIChsZW4gPiBzdGF0ZS53Yml0cykge1xuICAgICAgICBzdHJtLm1zZyA9ICdpbnZhbGlkIHdpbmRvdyBzaXplJztcbiAgICAgICAgc3RhdGUubW9kZSA9IEJBRDtcbiAgICAgICAgYnJlYWs7XG4gICAgICB9XG4gICAgICBzdGF0ZS5kbWF4ID0gMSA8PCBsZW47XG4gICAgICAvL1RyYWNldigoc3RkZXJyLCBcImluZmxhdGU6ICAgemxpYiBoZWFkZXIgb2tcXG5cIikpO1xuICAgICAgc3RybS5hZGxlciA9IHN0YXRlLmNoZWNrID0gMS8qYWRsZXIzMigwTCwgWl9OVUxMLCAwKSovO1xuICAgICAgc3RhdGUubW9kZSA9IGhvbGQgJiAweDIwMCA/IERJQ1RJRCA6IFRZUEU7XG4gICAgICAvLz09PSBJTklUQklUUygpO1xuICAgICAgaG9sZCA9IDA7XG4gICAgICBiaXRzID0gMDtcbiAgICAgIC8vPT09Ly9cbiAgICAgIGJyZWFrO1xuICAgIGNhc2UgRkxBR1M6XG4gICAgICAvLz09PSBORUVEQklUUygxNik7ICovXG4gICAgICB3aGlsZSAoYml0cyA8IDE2KSB7XG4gICAgICAgIGlmIChoYXZlID09PSAwKSB7IGJyZWFrIGluZl9sZWF2ZTsgfVxuICAgICAgICBoYXZlLS07XG4gICAgICAgIGhvbGQgKz0gaW5wdXRbbmV4dCsrXSA8PCBiaXRzO1xuICAgICAgICBiaXRzICs9IDg7XG4gICAgICB9XG4gICAgICAvLz09PS8vXG4gICAgICBzdGF0ZS5mbGFncyA9IGhvbGQ7XG4gICAgICBpZiAoKHN0YXRlLmZsYWdzICYgMHhmZikgIT09IFpfREVGTEFURUQpIHtcbiAgICAg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uICAgICAgICBiaXRzICs9IDg7XG4gICAgICB9XG4gICAgICAvLz09PS8vXG4gICAgICBpZiAoc3RhdGUuaGVhZCkge1xuICAgICAgICBzdGF0ZS5oZWFkLnRpbWUgPSBob2xkO1xuICAgICAgfVxuICAgICAgaWYgKHN0YXRlLmZsYWdzICYgMHgwMjAwKSB7XG4gICAgICAgIC8vPT09IENSQzQoc3RhdGUuY2hlY2ssIGhvbGQpXG4gICAgICAgIGhidWZbMF0gPSBob2xkICYgMHhmZjtcbiAgICAgICAgaGJ1ZlsxXSA9IChob2xkID4+PiA4KSAmIDB4ZmY7XG4gICAgICAgIGhidWZbMl0gPSAoaG9sZCA+Pj4gMTYpICYgMHhmZjtcbiAgICAgICAgaGJ1ZlszXSA9IChob2xkID4+PiAyNCkgJiAweGZmO1xuICAgICAgICBzdGF0ZS5jaGVjayA9IGNyYzMyKHN0YXRlLmNoZWNrLCBoYnVmLCA0LCAwKTtcbiAgICAgICAgLy89PT1cbiAgICAgIH1cbiAgICAgIC8vPT09IElOSVRCSVRTKCk7XG4gICAgICBob2xkID0gMDtcbiAgICAgIGJpdHMgPSAwO1xuICAgICAgLy89PT0vL1xuICAgICAgc3RhdGUubW9kZSA9IE9TO1xuICAgICAgLyogZmFsbHMgdGhyb3VnaCAqL1xuICAgIGNhc2UgT1M6XG4gICAgICAvLz09PSBORUVEQklUUygxNik7ICovXG4gICAgICB3aGlsZSAoYml0cyA8IDE2KSB7XG4gICAgICAgIGlmIChoYXZlID09PSAwKSB7IGJyZWFrIGluZl9sZWF2ZTsgfVxuICAgICAgICBoYXZlLS07XG4gICAgICAgIGhvbGQgKz0gaW5wdXRbbmV4dCsrXSA8PCBiaXRzO1xuICAgICAgICBiaXRzICs9IDg7XG4gICAgICB9XG4gICAgICAvLz09PS8vXG4gICAgICBpZiAoc3RhdGUuaGVhZCkge1xuICAgICAgICBzdGF0ZS5oZWFkLnhmbGFncyA9IChob2xkICYgMHhmZik7XG4gICAgICAgIHN0YXRlLmhlYW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Glscy5hcnJheVNldChcbiAgICAgICAgICAgICAgc3RhdGUuaGVhZC5leHRyYSxcbiAgICAgICAgICAgICAgaW5wdXQsXG4gICAgICAgICAgICAgIG5leHQsXG4gICAgICAgICAgICAgIC8vIGV4dHJhIGZpZWxkIGlzIGxpbWl0ZWQgdG8gNjU1MzYgYnl0ZXNcbiAgICAgICAgICAgICAgLy8gLSBubyBuZWVkIGZvciBhZGRpdGlvbmFsIHNpemUgY2hlY2tcbiAgICAgICAgICAgICAgY29weSxcbiAgICAgICAgICAgICAgLypsZW4gKyBjb3B5ID4gc3RhdGUuaGVhZC5leHRyYV9tYXggLSBsZW4gPyBzdGF0ZS5oZWFkLmV4dHJhX21heCA6IGNvcHksKi9cbiAgICAgICAgICAgICAgbGVuXG4gICAgICAgICAgICApO1xuICAgICAgICAgICAgLy96bWVtY3B5KHN0YXRlLmhlYWQuZXh0cmEgKyBsZW4sIG5leHQsXG4gICAgICAgICAgICAvLyAgICAgICAgbGVuICsgY29weSA+IHN0YXRlLmhlYWQuZXh0cmFfbWF4ID9cbiAgICAgICAgICAgIC8vICAgICAgICBzdGF0ZS5oZWFkLmV4dHJhX21heCAtIGxlbiA6IGNvcHkpO1xuICAgICAgICAgIH1cbiAgICAgICAgICBpZiAoc3RhdGUuZmxhZ3MgJiAweDAyMDApIHtcbiAgICAgICAgICAgIHN0YXRlLmNoZWNrID0gY3JjMzIoc3RhdGUuY2hlY2ssIGlucHV0LCBjb3B5LCBuZXh0KTtcbiAgICAgICAgICB9XG4gICAgICAgICAgaGF2ZSAtPSBjb3B5O1xuICAgICAgICAgIG5leHQgKz0gY29weTtcbiAgICAgICAgICBzdGF0ZS5sZW5ndGggLT0gY29weTtcbiAgICAgICAgfVxuICAgICAgICBpZiAoc3RhdGUubGVuZ3RoKSB7IGJyZWFrIGluZl9sZWF2ZTsgfVxuICAgICAgfVxuICAgICAgc3RhdGUubGVuZ3RoID0gMDtcbiAgICAgIHN0YXRlLm1vZGUgPSBOQU1FO1xuIC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BmYWxscyB0aHJvdWdoICovXG4gICAgY2FzZSBIQ1JDOlxuICAgICAgaWYgKHN0YXRlLmZsYWdzICYgMHgwMjAwKSB7XG4gICAgICAgIC8vPT09IE5FRURCSVRTKDE2KTsgKi9cbiAgICAgICAgd2hpbGUgKGJpdHMgPCAxNikge1xuICAgICAgICAgIGlmIChoYXZlID09PSAwKSB7IGJyZWFrIGluZl9sZWF2ZTsgfVxuICAgICAgICAgIGhhdmUtLTtcbiAgICAgICAgICBob2xkICs9IGlucHV0W25leHQrK10gPDwgYml0cztcbiAgICAgICAgICBiaXRzICs9IDg7XG4gICAgICAgIH1cbiAgICAgICAgLy89PT0vL1xuICAgICAgICBpZiAoaG9sZCAhPT0gKHN0YXRlLmNoZWNrICYgMHhmZmZmKSkge1xuICAgICAgICAgIHN0cm0ubXNnID0gJ2hlYWRlciBjcmMgbWlzbWF0Y2gnO1xuICAgICAgICAgIHN0YXRlLm1vZGUgPSBCQUQ7XG4gICAgICAgICAgYnJlYWs7XG4gICAgICAgIH1cbiAgICAgICAgLy89PT0gSU5JVEJJVFMoKTtcbiAgICAgICAgaG9sZCA9IDA7XG4gICAgICAgIGJpdHMgPSAwO1xuICAgICAgICAvLz09PS8vXG4gICAgICB9XG4gICAgICBpZiAoc3RhdGUuaGVhZCkge1xuICAgICAgICBzdGF0ZS5oZWFkLmhjcmMgPSAoKHN0YXRlLmZsYWdzID4+IDkpICYgMSk7XG4gICAgICAgIHN0YXRlLmhlYWQuZG9uZSA9IHRydWU7XG4gICAgICB9XG4gICAgICBzdHJtLmFkbGVyID0gc3RhdGUuY2hlY2sgPSAwIC8qY3JjMzIoMEwsIFpfTlVMTCwgMCkqLztcbiAgICAgIHN0YXRlLm1vZGUgPSBUWVBFO1xuICAgICAgYnJlYWs7XG4gICAgY2FzZSBESUNUSUQ6XG4gICAgICAvLz09PSBORUVEQklUUygzMik7ICovXG4gICAgICB3aGlsZSAoYml0cyA8IDMyKSB7XG4gICAgICAgIGlmIChoYXZlID09P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IGZhbGxzIHRocm91Z2ggKi9cbiAgICBjYXNlIFRZUEVETzpcbiAgICAgIGlmIChzdGF0ZS5sYXN0KSB7XG4gICAgICAgIC8vLS0tIEJZVEVCSVRTKCkgLS0tLy9cbiAgICAgICAgaG9sZCA+Pj49IGJpdHMgJiA3O1xuICAgICAgICBiaXRzIC09IGJpdHMgJiA3O1xuICAgICAgICAvLy0tLS8vXG4gICAgICAgIHN0YXRlLm1vZGUgPSBDSEVDSztcbiAgICAgICAgYnJlYWs7XG4gICAgICB9XG4gICAgICAvLz09PSBORUVEQklUUygzKTsgKi9cbiAgICAgIHdoaWxlIChiaXRzIDwgMykge1xuICAgICAgICBpZiAoaGF2ZSA9PT0gMCkgeyBicmVhayBpbmZfbGVhdmU7IH1cbiAgICAgICAgaGF2ZS0tO1xuICAgICAgICBob2xkICs9IGlucHV0W25leHQrK10gPDwgYml0cztcbiAgICAgICAgYml0cyArPSA4O1xuICAgICAgfVxuICAgICAgLy89PT0vL1xuICAgICAgc3RhdGUubGFzdCA9IChob2xkICYgMHgwMSkvKkJJVFMoMSkqLztcbiAgICAgIC8vLS0tIERST1BCSVRTKDEpIC0tLS8vXG4gICAgICBob2xkID4+Pj0gMTtcbiAgICAgIGJpdHMgLT0gMTtcbiAgICAgIC8vLS0tLy9cblxuICAgICAgc3dpdGNoICgoaG9sZCAmIDB4MDMpLypCSVRTKDIpKi8pIHtcbiAgICAgIGNhc2UgMDogICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qIHN0b3JlZCBibG9jayAqL1xuICAgICAgICAvL1RyYWNldigoc3RkZXJyLCBcImluZmxhdGU6ICAgICBzdG9yZWQgYmxvY2slc1xcblwiLFxuICAgICAgICAvLyAgICAgICAgc3RhdGUubGFzdCA/IFwiIChsYXN0KVwiIDogXCJcIikpO1xuICAgICAgICBzdGF0ZS5tb2RlID0gU1RPUkVEO1xuICAgICAgICBicmVhaztcbiAgICAgIGNhc2UgMTogICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qIGZpeGVkIGJsb2NrICovXG4gICAgICAgIGZpeGVkdGFibGVzKHN0YXRlKTtcbiAgICAgICAgLy9UcmFjZXYoKHN0ZGVyciwgXCJpbmZsYXRlOiAgICAgZml4ZWQgY29kZXMgYmxvY2slc1xcblwiLFxuICAgICAgICAvLyAgICAgICAgc3RhdGUubGFzdCA/IFwiIChsYXN0KVwiIDogXCJcIikpO1xuICAgICAgICBzdGF0ZS5tb2RlID0gTEVOXzsgICAgICAgICAgICAgLyogZGVjb2RlIGNvZGVzICovXG4gICAgICAgIGlmIChmbHVzaCA9PT0gWl9UUkVFUykge1xuICAgICAgICAgIC8vLS0tIERST1BCSVRTKDIpIC0tLS8vXG4gICAgICAgICAgaG9sZCA+Pj49IDI7XG4gICAgICAgICAgYml0cyAtPSAyO1xuICAgICAgICAgIC8vLS0tLy9cbiAgICAgICAgICBicmVhayBpbmZfbGVhdmU7XG4gICAgICAgIH1cbiAgICAgICAgYnJlYWs7XG4gICAgICBjYXNlIDI6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiBkeW5hbWljIGJsb2NrICovXG4gICAgICAgIC8vVHJhY2V2KChzdGRlcnIsIFwiaW5mbGF0ZTogICAgIGR5bmFtaWMgY29kZXMgYmxvY2slc1xcblwiLFxuICAgICAgICAvLyAgICAgICAgc3RhdGUubGFzdCA/IFwiIChsYXN0KVwiIDogXCJcIikpO1xuICAgICAgICBzdGF0ZS5tb2RlID0gVEFCTEU7XG4gICAgICAgIGJyZWFrO1xuICAgICAgY2FzZSAzOlxuICAgICAgICBzdHJtLm1zZyA9ICdpbnZhbGlkIGJsb2NrIHR5cGUnO1xuICAgICAgICBzdGF0ZS5tb2RlID0gQkFEO1xuICAgICAgfVxuICAgICAgLy8tLS0gRFJPUEJJVFMoMikgLS0tLy9cbiAgICAgIGhvbGQgPj4+PSAyO1xuICAgICAgYml0cyAtPSAyO1xuICAgICAgLy8tLS0vL1xuICAgICAgYnJlYWs7XG4gICAgY2FzZSBTVE9S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YXRlLm1vZGUgPSBDT1BZO1xuICAgICAgLyogZmFsbHMgdGhyb3VnaCAqL1xuICAgIGNhc2UgQ09QWTpcbiAgICAgIGNvcHkgPSBzdGF0ZS5sZW5ndGg7XG4gICAgICBpZiAoY29weSkge1xuICAgICAgICBpZiAoY29weSA+IGhhdmUpIHsgY29weSA9IGhhdmU7IH1cbiAgICAgICAgaWYgKGNvcHkgPiBsZWZ0KSB7IGNvcHkgPSBsZWZ0OyB9XG4gICAgICAgIGlmIChjb3B5ID09PSAwKSB7IGJyZWFrIGluZl9sZWF2ZTsgfVxuICAgICAgICAvLy0tLSB6bWVtY3B5KHB1dCwgbmV4dCwgY29weSk7IC0tLVxuICAgICAgICB1dGlscy5hcnJheVNldChvdXRwdXQsIGlucHV0LCBuZXh0LCBjb3B5LCBwdXQpO1xuICAgICAgICAvLy0tLS8vXG4gICAgICAgIGhhdmUgLT0gY29weTtcbiAgICAgICAgbmV4dCArPSBjb3B5O1xuICAgICAgICBsZWZ0IC09IGNvcHk7XG4gICAgICAgIHB1dCArPSBjb3B5O1xuICAgICAgICBzdGF0ZS5sZW5ndGggLT0gY29weTtcbiAgICAgICAgYnJlYWs7XG4gICAgICB9XG4gICAgICAvL1RyYWNldigoc3RkZXJyLCBcImluZmxhdGU6ICAgICAgIHN0b3JlZCBlbmRcXG5cIikpO1xuICAgICAgc3RhdGUubW9kZSA9IFRZUEU7XG4gICAgICBicmVhaztcbiAgICBjYXNlIFRBQkxFOlxuICAgICAgLy89PT0gTkVFREJJVFMoMTQpOyAqL1xuICAgICAgd2hpbGUgKGJpdHMgPCAxNCkge1xuICAgICAgICBpZiAoaGF2ZSA9PT0gMCkgeyBicmVhayBpbmZfbGVhdmU7IH1cbiAgICAgICAgaGF2ZS0tO1xuICAgICAgICBob2xkICs9IGlucHV0W25leHQrK10gPDwgYml0cztcbiAgICAgICAgYml0cyArPSA4O1xuICAgICAgfVxuICAgICAgLy89PT0vL1xuICAgICAgc3RhdGUubmxlbiA9IChob2x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ICAgICAgICBpZiAoaGVyZV92YWwgPCAxNikge1xuICAgICAgICAgIC8vLS0tIERST1BCSVRTKGhlcmUuYml0cykgLS0tLy9cbiAgICAgICAgICBob2xkID4+Pj0gaGVyZV9iaXRzO1xuICAgICAgICAgIGJpdHMgLT0gaGVyZV9iaXRzO1xuICAgICAgICAgIC8vLS0tLy9cbiAgICAgICAgICBzdGF0ZS5sZW5zW3N0YXRlLmhhdmUrK10gPSBoZXJlX3ZhbDtcbiAgICAgICAgfVxuICAgICAgICBlbHNlIHtcbiAgICAgICAgICBpZiAoaGVyZV92YWwgPT09IDE2KSB7XG4gICAgICAgICAgICAvLz09PSBORUVEQklUUyhoZXJlLmJpdHMgKyAyKTtcbiAgICAgICAgICAgIG4gPSBoZXJlX2JpdHMgKyAyO1xuICAgICAgICAgICAgd2hpbGUgKGJpdHMgPCBuKSB7XG4gICAgICAgICAgICAgIGlmIChoYXZlID09PSAwKSB7IGJyZWFrIGluZl9sZWF2ZTsgfVxuICAgICAgICAgICAgICBoYXZlLS07XG4gICAgICAgICAgICAgIGhvbGQgKz0gaW5wdXRbbmV4dCsrXSA8PCBiaXRzO1xuICAgICAgICAgICAgICBiaXRzICs9IDg7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICAvLz09PS8vXG4gICAgICAgICAgICAvLy0tLSBEUk9QQklUUyhoZXJlLmJpdHMpIC0tLS8vXG4gICAgICAgICAgICBob2xkID4+Pj0gaGVyZV9iaXRzO1xuICAgICAgICAgICAgYml0cyAtPSBoZXJlX2JpdHM7XG4gICAgICAgICAgICAvLy0tLS8vXG4gICAgICAgICAgICBpZiAoc3RhdGUuaGF2ZSA9PT0gMCkge1xuICAgICAgICAgICAgICBzdHJtLm1zZyA9ICdpbnZhbGlkIGJpdCBsZW5ndGggcmVwZWF0JztcbiAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IEJBRDtcbiAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBsZW4gPSBzdGF0ZS5sZW5zW3N0YXRlLmhhdmUgLSAxXTtcbiAgICAgICAgICAgIGNvcHkgPSAzICsgKGhvbGQgJiAweDAzKTsvL0JJVFMoMik7XG4gICAgICAgICAgICAvLy0tLSBEUk9QQklUUygyKSAtLS0vL1xuICAgICAgICAgICAgaG9sZCA+Pj49IDI7XG4gICAgICAgICAgICBiaXRzIC09IDI7XG4gICAgICAgICAgICAvLy0tLS8vXG4gICAgICAgICAgfVxuICAgICAgICAgIGVsc2UgaWYgKGhlcmVfdmFsID09PSAxNykge1xuICAgICAgICAgICAgLy89PT0gTkVFREJJVFMoaGVyZS5iaXRzICsgMyk7XG4gICAgICAgICAgICBuID0gaGVyZV9iaXRzICsgMztcbiAgICAgICAgICAgIHdoaWxlIChiaXRzIDwgbikge1xuICAgICAgICAgICAgICBpZiAoaGF2ZSA9PT0gMCkgeyBicmVhayBpbmZfbGVhdmU7IH1cbiAgICAgICAgICAgICAgaGF2ZS0tO1xuICAgICAgICAgICAgICBob2xkICs9IGlucHV0W25leHQrK10gPDwgYml0cztcbiAgICAgICAgICAgICAgYml0cyArPSA4O1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgLy89PT0vL1xuICAgICAgICAgICAgLy8tLS0gRFJPUEJJVFMoaGVyZS5iaXRzKSAtLS0vL1xuICAgICAgICAgICAgaG9sZCA+Pj49IGhlcmVfYml0cztcbiAgICAgICAgICAgIGJpdHMgLT0gaGVyZV9iaXRzO1xuICAgICAgICAgICAgLy8tLS0vL1xuICAgICAgICAgICAgbGVuID0gMDtcbiAgICAgICAgICAgIGNvcHkgPSAzICsgKGhvbGQgJiAweDA3KTsvL0JJVFMoMyk7XG4gICAgICAgICAgICAvLy0tLSBEUk9QQklUUygzKSAtLS0vL1xuICAgICAgICAgICAgaG9sZCA+Pj49IDM7XG4gICAgICAgICAgICBiaXRzIC09IDM7XG4gICAgICAgICAgICAvLy0tLS8vXG4gICAgICAgICAgfVxuICAgICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgLy89PT0gTkVFREJJVFMoaGVyZS5iaXRzICsgNyk7XG4gICAgICAgICAgICBuID0gaGVyZV9iaXRzICsgNztcbiAgICAgICAgICAgIHdoaWxlIChiaXRzIDwgbikge1xuICAgICAgICAgICAgICBpZiAoaGF2ZSA9PT0gMCkgeyBicmVhayBpbmZfbGVhdmU7IH1cbiAgICAgICAgICAgICAgaGF2ZS0tO1xuICAgICAgICAgICAgICBob2xkICs9IGlucHV0W25leHQrK10gPDwgYml0cztcbiAgICAgICAgICAgICAgYml0cyArPSA4O1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgLy89PT0vL1xuICAgICAgICAgICAgLy8tLS0gRFJPUEJJVFMoaGVyZS5iaXRzKSAtLS0vL1xuICAgICAgICAgICAgaG9sZCA+Pj49IGhlcmVfYml0cztcbiAgICAgICAgICAgIGJpdHMgLT0gaGVyZV9iaXRzO1xuICAgICAgICAgICAgLy8tLS0vL1xuICAgICAgICAgICAgbGVuID0gMDtcbiAgICAgICAgICAgIGNvcHkgPSAxMSArIChob2xkICYgMHg3Zik7Ly9CSVRTKDcpO1xuICAgICAgICAgICAgLy8tLS0gRFJPUEJJVFMoNykgLS0tLy9cbiAgICAgICAgICAgIGhvbGQgPj4+PSA3O1xuICAgICAgICAgICAgYml0cyAtPSA3O1xuICAgICAgICAgICAgLy8tLS0vL1xuICAgICAgICAgIH1cbiAgICAgICAgICBpZiAoc3RhdGUuaGF2ZSArIGNvcHkgPiBzdGF0ZS5ubGVuICsgc3RhdGUubmRpc3QpIHtcbiAgICAgICAgICAgIHN0cm0ubXNnID0gJ2ludmFsaWQgYml0IGxlbmd0aCByZXBlYXQnO1xuICAgICAgICAgICAgc3RhdGUubW9kZSA9IEJBRDtcbiAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgIH1cbiAgICAgICAgICB3aGlsZSAoY29weS0tKSB7XG4gICAgICAgICAgICBzdGF0ZS5sZW5zW3N0YXRlLmhhdmUrK10gPSBsZW47XG4gICAg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1xuICAgICAgICAvLyAgICAgICAgXCJpbmZsYXRlOiAgICAgICAgIGxpdGVyYWwgJyVjJ1xcblwiIDpcbiAgICAgICAgLy8gICAgICAgIFwiaW5mbGF0ZTogICAgICAgICBsaXRlcmFsIDB4JTAyeFxcblwiLCBoZXJlLnZhbCkpO1xuICAgICAgICBzdGF0ZS5tb2RlID0gTElUO1xuICAgICAgICBicmVhaztcbiAgICAgIH1cbiAgICAgIGlmIChoZXJlX29wICYgMzIpIHtcbiAgICAgICAgLy9UcmFjZXZ2KChzdGRlcnIsIFwiaW5mbGF0ZTogICAgICAgICBlbmQgb2YgYmxvY2tcXG5cIikpO1xuICAgICAgICBzdGF0ZS5iYWNrID0gLTE7XG4gICAgICAgIHN0YXRlLm1vZGUgPSBUWVBFO1xuICAgICAgICBicmVhaztcbiAgICAgIH1cbiAgICAgIGlmIChoZXJlX29wICYgNjQpIHtcbiAgICAgICAgc3RybS5tc2cgPSAnaW52YWxpZCBsaXRlcmFsL2xlbmd0aCBjb2RlJztcbiAgICAgICAgc3RhdGUubW9kZSA9IEJBRDtcbiAgICAgICAgYnJlYWs7XG4gICAgICB9XG4gICAgICBzdGF0ZS5leHRyYSA9IGhlcmVfb3AgJiAxNTtcbiAgICAgIHN0YXRlLm1vZGUgPSBMRU5FWFQ7XG4gICAgICAvKiBmYWxscyB0aHJvdWdoICovXG4gICAgY2FzZSBMRU5FWFQ6XG4gICAgICBpZiAoc3RhdGUuZXh0cmEpIHtcbiAgICAgICAgLy89PT0gTkVFREJJVFMoc3RhdGUuZXh0cmEpO1xuICAgICAgICBuID0gc3RhdGUuZXh0cmE7XG4gICAgICAgIHdoaWxlIChiaXRzIDwgbikge1xuICAgICAgICAgIGlmIChoYXZlID09PSAwKSB7IGJyZWFrIGluZl9sZWF2ZTsgfVxuICAgICAgICAgIGhhdmUtLTtcbiAgICAgICAgICBob2xkICs9IGlucHV0W25leHQrK10gPDwgYml0cztcbiAgICAgICAgICBiaXRzICs9IDg7XG4gICAgICA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V4dCsrXSA8PCBiaXRzO1xuICAgICAgICBiaXRzICs9IDg7XG4gICAgICAgIC8vLS0tLy9cbiAgICAgIH1cbiAgICAgIGlmICgoaGVyZV9vcCAmIDB4ZjApID09PSAwKSB7XG4gICAgICAgIGxhc3RfYml0cyA9IGhlcmVfYml0cztcbiAgICAgICAgbGFzdF9vcCA9IGhlcmVfb3A7XG4gICAgICAgIGxhc3RfdmFsID0gaGVyZV92YWw7XG4gICAgICAgIGZvciAoOzspIHtcbiAgICAgICAgICBoZXJlID0gc3RhdGUuZGlzdGNvZGVbbGFzdF92YWwgK1xuICAgICAgICAgICAgICAgICAgKChob2xkICYgKCgxIDw8IChsYXN0X2JpdHMgKyBsYXN0X29wKSkgLTEpKS8qQklUUyhsYXN0LmJpdHMgKyBsYXN0Lm9wKSovID4+IGxhc3RfYml0cyldO1xuICAgICAgICAgIGhlcmVfYml0cyA9IGhlcmUgPj4+IDI0O1xuICAgICAgICAgIGhlcmVfb3AgPSAoaGVyZSA+Pj4gMTYpICYgMHhmZjtcbiAgICAgICAgICBoZXJlX3ZhbCA9IGhlcmUgJiAweGZmZmY7XG5cbiAgICAgICAgICBpZiAoKGxhc3RfYml0cyArIGhlcmVfYml0cykgPD0gYml0cykgeyBicmVhazsgfVxuICAgICAgICAgIC8vLS0tIFBVTExCWVRFKCkgLS0tLy9cbiAgICAgICAgICBpZiAoaGF2ZSA9PT0gMCkgeyBicmVhayBpbmZfbGVhdmU7IH1cbiAgICAgICAgICBoYXZlLS07XG4gICAgICAgICAgaG9sZCArPSBpbnB1dFtuZXh0KytdIDw8IGJpdHM7XG4gICAgICAgICAgYml0cyArPSA4O1xuICAgICAgICAgIC8vLS0tLy9cbiAgICAgICAgfVxuICAgICAgICAvLy0tLSBEUk9QQklUUyhsYXN0LmJpdHMpIC0tLS8vXG4gICAgICAgIGhvbGQgPj4+PSBsYXN0X2JpdHM7XG4gICAgICAgIGJpdHMgLT0gbGFzdF9iaXRzO1xuICAgICAgICAvLy0tLS8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BzaWduZWRcbiAgICAgICAgICBob2xkIHw9IGlucHV0W25leHQrK10gPDwgYml0cztcbiAgICAgICAgICBiaXRzICs9IDg7XG4gICAgICAgIH1cbiAgICAgICAgLy89PT0vL1xuICAgICAgICBfb3V0IC09IGxlZnQ7XG4gICAgICAgIHN0cm0udG90YWxfb3V0ICs9IF9vdXQ7XG4gICAgICAgIHN0YXRlLnRvdGFsICs9IF9vdXQ7XG4gICAgICAgIGlmIChfb3V0KSB7XG4gICAgICAgICAgc3RybS5hZGxlciA9IHN0YXRlLmNoZWNrID1cbiAgICAgICAgICAgICAgLypVUERBVEUoc3RhdGUuY2hlY2ssIHB1dCAtIF9vdXQsIF9vdXQpOyovXG4gICAgICAgICAgICAgIChzdGF0ZS5mbGFncyA/IGNyYzMyKHN0YXRlLmNoZWNrLCBvdXRwdXQsIF9vdXQsIHB1dCAtIF9vdXQpIDogYWRsZXIzMihzdGF0ZS5jaGVjaywgb3V0cHV0LCBfb3V0LCBwdXQgLSBfb3V0KSk7XG5cbiAgICAgICAgfVxuICAgICAgICBfb3V0ID0gbGVmdDtcbiAgICAgICAgLy8gTkI6IGNyYzMyIHN0b3JlZCBhcyBzaWduZWQgMzItYml0IGludCwgWlNXQVAzMiByZXR1cm5zIHNpZ25lZCB0b29cbiAgICAgICAgaWYgKChzdGF0ZS5mbGFncyA/IGhvbGQgOiBaU1dBUDMyKGhvbGQpKSAhPT0gc3RhdGUuY2hlY2spIHtcbiAgICAgICAgICBzdHJtLm1zZyA9ICdpbmNvcnJlY3QgZGF0YSBjaGVjayc7XG4gICAgICAgICAgc3RhdGUubW9kZSA9IEJBRDtcbiAgICAgICAgICBicmVhaztcbiAgICAgICAgfVxuICAgICAgICAvLz09PSBJTklUQklUUygpO1xuICAgICAgICBob2xkID0gMDtcbiAgICAgICAgYml0cyA9IDA7XG4gICAgICAgIC8vPT09Ly9cbiAgICAgICAgLy9UcmFjZXYoKHN0ZGVyciwgXCJpbmZsYXRlOiAgIGNoZWNrIG1hd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GUudmFsW25leHQgKyBodWZmXSA9IDA7XG4gICAgdGFibGVbbmV4dCArIGh1ZmZdID0gKChsZW4gLSBkcm9wKSA8PCAyNCkgfCAoNjQgPDwgMTYpIHwwO1xuICB9XG5cbiAgLyogc2V0IHJldHVybiBwYXJhbWV0ZXJzICovXG4gIC8vb3B0cy50YWJsZV9pbmRleCArPSB1c2VkO1xuICBvcHRzLmJpdHMgPSByb290O1xuICByZXR1cm4gMDtcbn07XG4iLCIndXNlIHN0cmljdCc7XG5cbm1vZHVsZS5leHBvcnRzID0ge1xuICAnMic6ICAgICduZWVkIGRpY3Rpb25hcnknLCAgICAgLyogWl9ORUVEX0RJQ1QgICAgICAgMiAgKi9cbiAgJzEnOiAgICAnc3RyZWFtIGVuZCcsICAgICAgICAgIC8qIFpfU1RSRUFNX0VORCAgICAgIDEgICovXG4gICcwJzogICAgJycsICAgICAgICAgICAgICAgICAgICAvKiBaX09LICAgICAgICAgICAgICAwICAqL1xuICAnLTEnOiAgICdmaWxlIGVycm9yJywgICAgICAgICAgLyogWl9FUlJOTyAgICAgICAgICgtMSkgKi9cbiAgJy0yJzogICAnc3RyZWFtIGVycm9yJywgICAgICAgIC8qIFpfU1RSRUFNX0VSUk9SICAoLTIpICovXG4gICctMyc6ICAgJ2RhdGEgZXJyb3InLCAgICAgICAgICAvKiBaX0RBVEFfRVJST1IgICAgKC0zKSAqL1xuICAnLTQnOiAgICdpbnN1ZmZpY2llbnQgbWVtb3J5JywgLyogWl9NRU1fRVJST1IgICAgICgtNCkgKi9cbiAgJy01JzogICAnYnVmZmVyIGVycm9yJywgICAgICAgIC8qIFpfQlVGX0VSUk9SICAgICAoLTUpICovXG4gICctNic6ICAgJ2luY29tcGF0aWJsZSB2ZXJzaW9uJyAvKiBaX1ZFUlNJT05fRVJST1IgKC02KSAqL1xufTtcbiIsIid1c2Ugc3RyaWN0JztcblxuXG52YXIgdXRpbHMgPSByZXF1aXJlKCcuLi91dGlscy9jb21tb24nKTtcblxuLyogUHVibGljIGNvbnN0YW50cyA9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09Ki9cbi8qID09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PSovXG5cblxuLy92YXIgWl9GSUxURVJFRCAgICAgICAgICA9IDE7XG4vL3ZhciBaX0hVRkZNQU5fT05MWSAgICAgID0gMjtcbi8vdmFyIFpfUkxFICAgICAgICAgICAgICAgPSAzO1xudmFyIFpfRklYRUQgICAgICAgICAgICAgICA9IDQ7XG4vL3ZhciBaX0RFRkFVTFRfU1RSQVRFR1kgID0gMDtcblxuLyogUG9zc2libGUgdmFsdWVzIG9mIHRoZSBkYXRhX3R5cGUgZmllbGQgKHRob3VnaCBzZWUgaW5mbGF0ZSgpKSAqL1xudmFyIFpfQklOQVJZICAgICAgICAgICAgICA9IDA7XG52YXIgWl9URVhUICAgICAgICAgICAgICAgID0gMTtcbi8vdmFyIFpfQVNDSUkgICAgICAgICAgICAgPSAxOyAvLyA9IFpfVEVYVFxudmFyIFpfVU5LTk9XTiAgICAgICAgICAgICA9IDI7XG5cbi8qPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PSovXG5cblxuZnVuY3Rpb24gemVybyhidWYpIHsgdmFyIGxlbiA9IGJ1Zi5sZW5ndGg7IHdoaWxlICgtLWxlbiA+PSAwKSB7IGJ1ZltsZW5dID0gMDsgfSB9XG5cbi8vIEZyb20genV0aWwuaFxuXG52YXIgU1RPUkVEX0JMT0NLID0gMDtcbnZhciBTVEFUSUNfVFJFRVMgPSAxO1xudmFyIERZTl9UUkVFUyAgICA9IDI7XG4vKiBUaGUgdGhyZWUga2luZHMgb2YgYmxvY2sgdHlwZSAqL1xuXG52YXIgTUlOX01BVENIICAgID0gMztcbnZhciBNQVhfTUFUQ0ggICAgPSAy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4dHJhX2RiaXRzLCAwLCAgICAgICAgICBEX0NPREVTLCBNQVhfQklUUyk7XG4gIHN0YXRpY19ibF9kZXNjID1uZXcgU3RhdGljVHJlZURlc2MobmV3IEFycmF5KDApLCBleHRyYV9ibGJpdHMsIDAsICAgICAgICAgQkxfQ09ERVMsIE1BWF9CTF9CSVRTKTtcblxuICAvL3N0YXRpY19pbml0X2RvbmUgPSB0cnVlO1xufVxuXG5cbi8qID09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PVxuICogSW5pdGlhbGl6ZSBhIG5ldyBibG9jay5cbiAqL1xuZnVuY3Rpb24gaW5pdF9ibG9jayhzKSB7XG4gIHZhciBuOyAvKiBpdGVyYXRlcyBvdmVyIHRyZWUgZWxlbWVudHMgKi9cblxuICAvKiBJbml0aWFsaXplIHRoZSB0cmVlcy4gKi9cbiAgZm9yIChuID0gMDsgbiA8IExfQ09ERVM7ICBuKyspIHsgcy5keW5fbHRyZWVbbioyXS8qLkZyZXEqLyA9IDA7IH1cbiAgZm9yIChuID0gMDsgbiA8IERfQ09ERVM7ICBuKyspIHsgcy5keW5fZHRyZWVbbioyXS8qLkZyZXEqLyA9IDA7IH1cbiAgZm9yIChuID0gMDsgbiA8IEJMX0NPREVTOyBuKyspIHsgcy5ibF90cmVlW24qMl0vKi5GcmVxKi8gPSAwOyB9XG5cbiAgcy5keW5fbHRyZWVbRU5EX0JMT0NLKjJdLyouRnJlcSovID0gMTtcbiAgcy5vcHRfbGVuID0gcy5zdGF0aWNfbGVuID0gMDtcbiAgcy5sYXN0X2xpdCA9IHMubWF0Y2hlcyA9IDA7XG59XG5cblxuLyogPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09XG4gKiBGbHVzaCB0aGUgYml0IGJ1ZmZlciBhbmQgYWxpZ24gdGhlIG91dHB1dCBvbiBhI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luX2NvdW50KSB7XG4gICAgICBzLmJsX3RyZWVbY3VybGVuICogMl0vKi5GcmVxKi8gKz0gY291bnQ7XG5cbiAgICB9IGVsc2UgaWYgKGN1cmxlbiAhPT0gMCkge1xuXG4gICAgICBpZiAoY3VybGVuICE9PSBwcmV2bGVuKSB7IHMuYmxfdHJlZVtjdXJsZW4gKiAyXS8qLkZyZXEqLysrOyB9XG4gICAgICBzLmJsX3RyZWVbUkVQXzNfNioyXS8qLkZyZXEqLysrO1xuXG4gICAgfSBlbHNlIGlmIChjb3VudCA8PSAxMCkge1xuICAgICAgcy5ibF90cmVlW1JFUFpfM18xMCoyXS8qLkZyZXEqLysrO1xuXG4gICAgfSBlbHNlIHtcbiAgICAgIHMuYmxfdHJlZVtSRVBaXzExXzEzOCoyXS8qLkZyZXEqLysrO1xuICAgIH1cblxuICAgIGNvdW50ID0gMDtcbiAgICBwcmV2bGVuID0gY3VybGVuO1xuXG4gICAgaWYgKG5leHRsZW4gPT09IDApIHtcbiAgICAgIG1heF9jb3VudCA9IDEzODtcbiAgICAgIG1pbl9jb3VudCA9IDM7XG5cbiAgICB9IGVsc2UgaWYgKGN1cmxlbiA9PT0gbmV4dGxlbikge1xuICAgICAgbWF4X2NvdW50ID0gNjtcbiAgICAgIG1pbl9jb3VudCA9IDM7XG5cbiAgICB9IGVsc2Uge1xuICAgICAgbWF4X2NvdW50ID0gNztcbiAgICAgIG1pbl9jb3VudCA9IDQ7XG4gICAgfVxuICB9XG59XG5cblxuLyogPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09XG4gKiBTZW5kIGEgbGl0ZXJhbCBvciBkaXN0YW5jZSB0cmVlIGluIGNvbXByZXNzZWQgZm9ybSwgdXNpbmcgdGhlIGNvZGVzIGluXG4gKiBibF90cmVlLlxuICovXG5mdW5jdGlvbiBzZW5kX3RyZWUocywgdHJlZSwgbWF4X2NvZGUpXG4vLyAgICBkZ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dW50ICYmIGN1cmxlbiA9PT0gbmV4dGxlbikge1xuICAgICAgY29udGludWU7XG5cbiAgICB9IGVsc2UgaWYgKGNvdW50IDwgbWluX2NvdW50KSB7XG4gICAgICBkbyB7IHNlbmRfY29kZShzLCBjdXJsZW4sIHMuYmxfdHJlZSk7IH0gd2hpbGUgKC0tY291bnQgIT09IDApO1xuXG4gICAgfSBlbHNlIGlmIChjdXJsZW4gIT09IDApIHtcbiAgICAgIGlmIChjdXJsZW4gIT09IHByZXZsZW4pIHtcbiAgICAgICAgc2VuZF9jb2RlKHMsIGN1cmxlbiwgcy5ibF90cmVlKTtcbiAgICAgICAgY291bnQtLTtcbiAgICAgIH1cbiAgICAgIC8vQXNzZXJ0KGNvdW50ID49IDMgJiYgY291bnQgPD0gNiwgXCIgM182P1wiKTtcbiAgICAgIHNlbmRfY29kZShzLCBSRVBfM182LCBzLmJsX3RyZWUpO1xuICAgICAgc2VuZF9iaXRzKHMsIGNvdW50LTMsIDIpO1xuXG4gICAgfSBlbHNlIGlmIChjb3VudCA8PSAxMCkge1xuICAgICAgc2VuZF9jb2RlKHMsIFJFUFpfM18xMCwgcy5ibF90cmVlKTtcbiAgICAgIHNlbmRfYml0cyhzLCBjb3VudC0zLCAzKTtcblxuICAgIH0gZWxzZSB7XG4gICAgICBzZW5kX2NvZGUocywgUkVQWl8xMV8xMzgsIHMuYmxfdHJlZSk7XG4gICAgICBzZW5kX2JpdHMocywgY291bnQtMTEsIDcpO1xuICAgIH1cblxuICAgIGNvdW50ID0gMDtcbiAgICBwcmV2bGVuID0gY3VybGVuO1xuICAgIGlmIChuZXh0bGVuID09PSAwKSB7XG4gICAgICBtYXhfY291bnQgPSAxMzg7XG4gICAgICBtaW5fY291bnQgPSAzO1xuXG4gICAgfSBlbHNlIGlmIChjdXJsZW4gPT09IG5leHRsZW4pIHtcbiAgICAgIG1heF9jb3VudCA9IDY7XG4gICAgICBtaW5fY291bnQgPSAzO1xuXG4gICAgfSBlbHNlIHtcbiAgIC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9vZmZzZXQ7XG4gIHZhciBpbk9mZiA9IDA7XG5cbiAgdmFyIHNlbGYgPSB0aGlzO1xuXG4gIHZhciBhc3luYyA9IHR5cGVvZiBjYiA9PT0gJ2Z1bmN0aW9uJztcblxuICBpZiAoIWFzeW5jKSB7XG4gICAgdmFyIGJ1ZmZlcnMgPSBbXTtcbiAgICB2YXIgbnJlYWQgPSAwO1xuXG4gICAgdmFyIGVycm9yO1xuICAgIHRoaXMub24oJ2Vycm9yJywgZnVuY3Rpb24oZXIpIHtcbiAgICAgIGVycm9yID0gZXI7XG4gICAgfSk7XG5cbiAgICBkbyB7XG4gICAgICB2YXIgcmVzID0gdGhpcy5fYmluZGluZy53cml0ZVN5bmMoZmx1c2hGbGFnLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNodW5rLCAvLyBpblxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGluT2ZmLCAvLyBpbl9vZmZcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhdmFpbEluQmVmb3JlLCAvLyBpbl9sZW5cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLl9idWZmZXIsIC8vIG91dFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuX29mZnNldCwgLy9vdXRfb2ZmXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXZhaWxPdXRCZWZvcmUpOyAvLyBvdXRfbGVuXG4gICAgfSB3aGlsZSAoIXRoaXMuX2hhZEVycm9yICYmIGNhbGxiYWNrKHJlc1swXSwgcmVzWzFdKSk7XG5cbiAgICBpZiAodGhpcy5faGFkRXJyb3IpIHtcbiAgICAgIHRocm93IGVycm9yO1xuICAgIH1cblxuICAgIHZhciBidWYgPSBCdWZmZXIuY29uY2F0KGJ1ZmZlcnMsIG5yZWFkKTtcbiAgICB0aGlzLmNsb3NlKCk7XG5cbiAgICByZXR1cm4gYnVmO1xuICB9XG5cbiAgdmFyIHJlcSA9IHRoaXMuX2JpbmRpbmcud3JpdGUoZmx1c2hGbGFnLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjaHVuaywgLy8gaW5cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW5PZmYsIC8vIGluX29mZlxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhdmFpbEluQmVmb3JlLCAvLyBpbl9sZW5cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5fYnVmZmVyLCAvLyBvdXRcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5fb2Zmc2V0LCAvL291dF9vZmZcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXZhaWxPdXRCZWZvcmUpOyAvLyBvdXRfbGVuXG5cbiAgcmVxLmJ1ZmZlciA9IGNodW5rO1xuICByZXEuY2FsbGJhY2sgPSBjYWxsYmFjaztcblxuICBmdW5jdGlvbiBjYWxsYmFjayhhdmFpbEluQWZ0ZXIsIGF2YWlsT3V0QWZ0ZXIpIHtcbiAgICBpZiAoc2VsZi5faGFkRXJyb3IpXG4gICAgICByZXR1cm47XG5cbiAgICB2YXIgaGF2ZSA9IGF2YWlsT3V0QmVmb3JlIC0gYXZhaWxPdXRBZnRlcjtcbiAgICBhc3NlcnQoaGF2ZSA+PSAwLCAnaGF2ZSBzaG91bGQgbm90IGdvIGRvd24nKTtcblxuICAgIGlmIChoYXZlID4gMCkge1xuICAgICAgdmFyIG91dCA9IHNlbGYuX2J1ZmZlci5zbGljZShzZWxmLl9vZmZzZXQsIHNlbGYuX29mZnNldCArIGhhdmUpO1xuICAgICAgc2VsZi5fb2Zmc2V0ICs9IGhhdmU7XG4gICAgICAvLyBzZXJ2ZSBzb21lIG91dHB1dCB0byB0aGUgY29uc3VtZXIuXG4gICAgICBpZiAoYXN5bmMpIHtcbiAgICAgICAgc2VsZ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RmxhZyxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNodW5rLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW5PZmYsXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhdmFpbEluQmVmb3JlLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi5fYnVmZmVyLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi5fb2Zmc2V0LFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi5fY2h1bmtTaXplKTtcbiAgICAgIG5ld1JlcS5jYWxsYmFjayA9IGNhbGxiYWNrOyAvLyB0aGlzIHNhbWUgZnVuY3Rpb25cbiAgICAgIG5ld1JlcS5idWZmZXIgPSBjaHVuaztcbiAgICAgIHJldHVybjtcbiAgICB9XG5cbiAgICBpZiAoIWFzeW5jKVxuICAgICAgcmV0dXJuIGZhbHNlO1xuXG4gICAgLy8gZmluaXNoZWQgd2l0aCB0aGUgY2h1bmsuXG4gICAgY2IoKTtcbiAgfVxufTtcblxudXRpbC5pbmhlcml0cyhEZWZsYXRlLCBabGliKTtcbnV0aWwuaW5oZXJpdHMoSW5mbGF0ZSwgWmxpYik7XG51dGlsLmluaGVyaXRzKEd6aXAsIFpsaWIpO1xudXRpbC5pbmhlcml0cyhHdW56aXAsIFpsaWIpO1xudXRpbC5pbmhlcml0cyhEZWZsYXRlUmF3LCBabGliKTtcbnV0aWwuaW5oZXJpdHMoSW5mbGF0ZVJhdywgWmxpYik7XG51dGlsLmluaGVyaXRzKFVuemlwLCBabGliKTtcbiIsIid1c2Ugc3RyaWN0J1xuXG5leHBvcnRzLnRvQnl0ZUFycmF5ID0gdG9CeXRlQXJyYXlcbmV4cG9ydHMuZnJvbUJ5dGVBcnJheSA9IGZyb21CeXRlQXJyYXlcblxudmFyIGxvb2t1cCA9IFtdXG52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ZVN0cmVhbS53YXJuaW5ncztcblxuICAgICAgICAgICAgdHJ5e1xuICAgICAgICAgICAgICAgIGlmKGV4cGxpY2l0KSB7XG4gICAgICAgICAgICAgICAgICAgIGRpY29tUGFyc2VyLnBhcnNlRGljb21EYXRhU2V0RXhwbGljaXQoZGF0YVNldCwgZGF0YVNldEJ5dGVTdHJlYW0sIGRhdGFTZXRCeXRlU3RyZWFtLmJ5dGVBcnJheS5sZW5ndGgsIG9wdGlvbnMpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBlbHNlXG4gICAgICAgICAgICAgICAge1xuICAgICAgICAgICAgICAgICAgICBkaWNvbVBhcnNlci5wYXJzZURpY29tRGF0YVNldEltcGxpY2l0KGRhdGFTZXQsIGRhdGFTZXRCeXRlU3RyZWFtLCBkYXRhU2V0Qnl0ZVN0cmVhbS5ieXRlQXJyYXkubGVuZ3RoLCBvcHRpb25zKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBjYXRjaChlKSB7XG4gICAgICAgICAgICAgICAgdmFyIGV4ID0ge1xuICAgICAgICAgICAgICAgICAgICBleGNlcHRpb246IGUsXG4gICAgICAgICAgICAgICAgICAgIGRhdGFTZXQ6IGRhdGFTZXRcbiAgICAgICAgICAgICAgICB9O1xuICAgICAgICAgICAgICAgIHRocm93IGV4O1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgcmV0dXJuIGRhdGFTZXQ7XG4gICAgICAgIH1cblxuICAgICAgICAvLyBtYWluIGZ1bmN0aW9uIGhlcmVcbiAgICAgICAgZnVuY3Rpb24gcGFyc2VUaGVCeXRlU3RyZWFtKCkge1xuICAgICAgICAgICAgdmFyIG1ldGFIZWFkZXJEYXRhU2V0ID0gZGljb21QYXJzZXIucmVhZFBhcnQxMEhlYWRlcihieXRlQXJyYXksIG9wdGlvbnMpO1xuXG4gICAgICAgICAgICB2YXIgZGF0YVNldCA9IHJlYWREYXRhU2V0KG1ldGF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lbGVtZW50Lml0ZW1zLmxlbmd0aDsgaSsrKSB7XG4gICAgICAgICAgICAgICAgICAgIHNlcXVlbmNlSXRlbXMucHVzaChkaWNvbVBhcnNlci5leHBsaWNpdERhdGFTZXRUb0pTKGVsZW1lbnQuaXRlbXNbaV0uZGF0YVNldCwgb3B0aW9ucykpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICByZXN1bHRbdGFnXSA9IHNlcXVlbmNlSXRlbXM7XG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIHZhciBhc1N0cmluZztcbiAgICAgICAgICAgICAgICBhc1N0cmluZyA9IHVuZGVmaW5lZDtcbiAgICAgICAgICAgICAgICBpZihlbGVtZW50Lmxlbmd0aCA8IG9wdGlvbnMubWF4RWxlbWVudExlbmd0aCkge1xuICAgICAgICAgICAgICAgICAgICBhc1N0cmluZyA9IGRpY29tUGFyc2VyLmV4cGxpY2l0RWxlbWVudFRvU3RyaW5nKGRhdGFTZXQsIGVsZW1lbnQpO1xuICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgIGlmKGFzU3RyaW5nICE9PSB1bmRlZmluZWQpIHtcbiAgICAgICAgICAgICAgICAgICAgcmVzdWx0W3RhZ10gPSBhc1N0cmluZztcbiAgICAgICAgICAgICAgICB9ICBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgcmVzdWx0W3RhZ10gPSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBkYXRhT2Zmc2V0OiBlbGVtZW50LmRhdGFPZmZzZXQsXG4gICAgICAgICAgICAgICAgICAgICAgICBsZW5ndGggOiBlbGVtZW50Lmxlbmd0aFxuICAgICAgICAgICAgICAgICAgICB9O1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuXG4gICAgICAgIHJldHVybiByZXN1bHQ7XG4gICAgfTtcblxuXG4gICAgcmV0dXJuIGRpY29tUGFyc2VyO1xufShkaWNvbVBhc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WVudC50YWc7XG5cbiAgICAgICAgdmFyIHRleHRSZXN1bHQ7XG5cbiAgICAgICAgZnVuY3Rpb24gbXVsdGlFbGVtZW50VG9TdHJpbmcobnVtSXRlbXMsIGZ1bmMpIHtcbiAgICAgICAgICAgIHZhciByZXN1bHQgPSBcIlwiO1xuICAgICAgICAgICAgZm9yKHZhciBpPTA7IGkgPCBudW1JdGVtczsgaSsrKSB7XG4gICAgICAgICAgICAgICAgaWYoaSAhPT0gMCkge1xuICAgICAgICAgICAgICAgICAgICByZXN1bHQgKz0gJy8nO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICByZXN1bHQgKz0gZnVuYy5jYWxsKGRhdGFTZXQsIHRhZywgaSkudG9TdHJpbmcoKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHJldHVybiByZXN1bHQ7XG4gICAgICAgIH1cblxuICAgICAgICBpZihkaWNvbVBhcnNlci5pc1N0cmluZ1ZyKHZyKSA9PT0gdHJ1ZSlcbiAgICAgICAge1xuICAgICAgICAgICAgdGV4dFJlc3VsdCA9IGRhdGFTZXQuc3RyaW5nKHRhZyk7XG4gICAgICAgIH1cbiAgICAgICAgZWxzZSBpZiAodnIgPT0gJ0FUJykge1xuICAgICAgICAgICAgdmFyIG51bSA9IGRhdGFTZXQudWludDMyKHRhZyk7XG4gICAgICAgICAgICBpZihudW0gPT09IHVuZGVmaW5lZCkge1xuICAgICAgICAgICAgICAgIHJldHVybiB1bmRlZmluZWQ7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAobnVtIDwgMClcbiAgICAgICAgICAgIHtcbiAgICAgICAgICAgICAgICBudW0gPSAweEZGRkZGRkZGICsgbnVtICsgMTtcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgcmV0dXJuICd4JyArIG51bS50b1N0cmluZygxNikudG9VcHBlckNhc2UoKTtcbiAgICAgICAgfVxuICAgICAgICBlbHNlIGlmICh2ciA9PSAnVVMnKVxuICAgICAgICB7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VE0gJ1wiICsgdGltZSArIFwiJ1wiO1xuICAgICAgICB9XG4gICAgICB9XG5cbiAgICAgIHJldHVybiB7XG4gICAgICAgIGhvdXJzOiBoaCxcbiAgICAgICAgbWludXRlczogbW0sXG4gICAgICAgIHNlY29uZHM6IHNzLFxuICAgICAgICBmcmFjdGlvbmFsU2Vjb25kczogZmZmZmZmXG4gICAgICB9O1xuICAgIH1cblxuICAgIGlmKHZhbGlkYXRlKSB7XG4gICAgICB0aHJvdyBcImludmFsaWQgVE0gJ1wiICsgdGltZSArIFwiJ1wiO1xuICAgIH1cblxuICAgIHJldHVybiB1bmRlZmluZWQ7XG4gIH07XG5cbiAgcmV0dXJuIGRpY29tUGFyc2VyO1xufShkaWNvbVBhcnNlcikpO1xuLyoqXG4gKiBVdGlsaXR5IGZ1bmN0aW9ucyBmb3IgZGVhbGluZyB3aXRoIERJQ09NXG4gKi9cblxudmFyIGRpY29tUGFyc2VyID0gKGZ1bmN0aW9uIChkaWNvbVBhcnNlcilcbntcbiAgICBcInVzZSBzdHJpY3RcIjtcblxuICAgIGlmKGRpY29tUGFyc2VyID09PSB1bmRlZmluZWQpXG4gICAge1xuICAgICAgICBkaWNvbVBhcnNlciA9IHt9O1xuICAgIH1cblxuICAgIHZhciBzdHJpbmdWcnMgPSB7XG4gICAgICAgIEFFOiB0cnVlLFxuICAgICAgICBBUzogdHJ1ZSxcbiAgICAgICAgQVQ6IGZhbHNlLFxuICAgICAgICBDUzogdHJ1ZSxcbiAgICAgICAgREE6IHRydWUsXG4gICAgICAgIERTOiB0cnVlLFxuICAgICAgICBEVDogdHJ1ZSxcbiAgICAgICAgRkw6IGZhbHNlLFxuICAgICAgICBGRDogZmFsc2UsXG4gICAgICAgIElTOiB0cnVlLFxuICAgICAgICBMTzogdHJ1ZSxcbiAgICAgICAgTFQ6IHRydWUsXG4gICAgICAgIE9COiBmYWxzZSxcbiAgICAgICAgT0Q6IGZhbHNlLFxuICAgICAgICBPRjogZmFsc2UsXG4gICAgIC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gICB9XG4gICAgICAgICAgICBpZiAocG9zaXRpb24gKyAyID4gYnl0ZUFycmF5Lmxlbmd0aCkge1xuICAgICAgICAgICAgICAgIHRocm93ICdiaWdFbmRpYW5CeXRlQXJyYXlQYXJzZXIucmVhZEludDE2OiBhdHRlbXB0IHRvIHJlYWQgcGFzdCBlbmQgb2YgYnVmZmVyJztcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHZhciBpbnQxNiA9IChieXRlQXJyYXlbcG9zaXRpb25dIDw8IDgpICsgYnl0ZUFycmF5W3Bvc2l0aW9uICsgMV07XG4gICAgICAgICAgICAvLyBmaXggc2lnblxuICAgICAgICAgICAgaWYgKGludDE2ICYgMHg4MDAwKSB7XG4gICAgICAgICAgICAgICAgaW50MTYgPSBpbnQxNiAtIDB4RkZGRiAtIDE7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICByZXR1cm4gaW50MTY7XG4gICAgICAgIH0sXG5cbiAgICAgICAgLyoqXG4gICAgICAgICAqIFBhcnNlcyBhbiB1bnNpZ25lZCBpbnQgMzIgZnJvbSBhIGJpZy1lbmRpYW4gYnl0ZSBhcnJheVxuICAgICAgICAgKlxuICAgICAgICAgKiBAcGFyYW0gYnl0ZUFycmF5IHRoZSBieXRlIGFycmF5IHRvIHJlYWQgZnJvbVxuICAgICAgICAgKiBAcGFyYW0gcG9zaXRpb24gdGhlIHBvc2l0aW9uIGluIHRoZSBieXRlIGFycmF5IHRvIHJlYWQgZnJvbVxuICAgICAgICAgKiBAcmV0dXJucyB7Kn0gdGhlIHBhcnNlZCB1bnNpZ25lZCBpbnQgMzJcbiAgICAgICAgICogQHRocm93cyBlcnJvciBpZiBidWZmZXIgb3ZlcnJlYWQgd291bGQgb2NjdXJcbiAgICAgICAgICogQGFjY2VzcyBwcml2YXRlXG4gICAgICAgICAqL1xuICAgICAgICByZWFkVWludDMyOiBmdW5jdGlvbiAoYnl0ZUFycmF5LCBwb3NpdGlvbikge1xuICAgICAgICAgICAgaWYgKHBvc2l0aW9uIDwgMCkge1xuICAgICAgICAgICAgICAgIHRocm93ICdiaWdFbmRpYW5CeXRlQXJyYXlQYXJzZXIucmVhZFVpbnQzMjogcG9zaXRpb24gY2Fubm90IGJlIGxlc3MgdGhhbiAwJztcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgaWYgKHBvc2l0aW9uICsgNCA+IGJ5dGVBcnJheS5sZW5ndGgpIHtcbiAgICAgICAgICAgICAgICB0aHJvdyAnYmlnRW5kaWFuQnl0ZUFycmF5UGFyc2VyLnJlYWRVaW50MzI6IGF0dGVtcHQgdG8gcmVhZCBwYXN0IGVuZCBvZiBidWZmZXInO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICB2YXIgdWludDMyID0gKDI1NiAqICgyNTYgKiAoMjU2ICogYnl0ZUFycmF5W3Bvc2l0aW9uXSArXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnl0ZUFycmF5W3Bvc2l0aW9uICsgMV0pICtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBieXRlQXJyYXlbcG9zaXRpb24gKyAyXSkgK1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJ5dGVBcnJheVtwb3NpdGlvbiArIDNdKTtcblxuICAgICAgICAgICAgcmV0dXJuIHVpbnQzMjtcbiAgICAgICAgfSxcblxuICAgICAgICAvKipcbiAgICAgICAgICogUGFyc2VzIGEgc2lnbmVkIGludCAzMiBmcm9tIGEgYmlnLWVuZGlhbiBieXRlIGFycmF5XG4gICAgICAgICAqXG4gICAgICAgICAqIEBwYXJhbSBieXRlQXJyYXkgdGhlIGJ5dGUgYXJyYXkgdG8gcmVhZCBmcm9tXG4gICAgICAgICAqIEBwYXJhbSBwb3NpdGlvbiB0aGUgcG9zaXRpb24gaW4gdGhlIGJ5dGUgYXJyYXkgdG8gcmVhZCBmcm9tXG4gICAgICAgICAqIEByZXR1cm5zIHsqfSB0aGUgcGFyc2VkIHNpZ25lZCBpbnQgMzJcbiAgICAgICAgICogQHRocm93cyBlcnJvciBpZiBidWZmZXIgb3ZlcnJlYWQgd291bGQgb2NjdXJcbiAgICAgICAgICogQGFjY2VzcyBwcml2YXRlXG4gICAgICAgICAqL1xuICAgICAgICByZWFkSW50MzI6IGZ1bmN0aW9uIChieXRlQXJyYXksIHBvc2l0aW9uKSB7XG4gICAgICAgICAgICBpZiAocG9zaXRpb24gPCAwKSB7XG4gICAgICAgICAgICAgICAgdGhyb3cgJ2JpZ0VuZGlhbkJ5dGVBcnJheVBhcnNlci5yZWFkSW50MzI6IHBvc2l0aW9uIGNhbm5vdCBiZSBsZXNzIHRoYW4gMCc7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIGlmIChwb3NpdGlvbiArIDQgPiBieXRlQXJyYXkubGVuZ3RoKSB7XG4gICAgICAgICAgICAgICAgdGhyb3cgJ2JpZ0VuZGlhbkJ5dGVBcnJheVBhcnNlci5yZWFkSW50MzI6IGF0dGVtcHQgdG8gcmVhZCBwYXN0IGVuZCBvZiBidWZmZXInO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICB2YXIgaW50MzIgPSAoKGJ5dGVBcnJheVtwb3NpdGlvbl0gPDwgMjQpICtcbiAgICAgICAgICAgICAgICAgICAgICAgICAoYnl0ZUFycmF5W3Bvc2l0aW9uICsgMV0gPDwgMTYpICtcbiAgICAgICAgICAgICAgICAgICAgICAgICAoYnl0ZUFycmF5W3Bvc2l0aW9uICsgMl0gPDwgOCkgK1xuICAgICAgICAgICAgICAgICAgICAgICAgICBieXRlQXJyYXlbcG9zaXRpb24gKyAzXSk7XG5cbiAgICAgICAgICAgIHJldHVybiBpbnQzMjtcbiAgICAgICAgfSxcblxuICAgICAgICAvKipcbiAgICAgICAgICogUGFyc2VzIDMyLWJpdCBmbG9hdCBmcm9tIGEgYmlnLWVuZGlhbiBieXRlIGFycmF5XG4gICAgICAgICAqXG4g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Ck7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBlbHNlXG4gICAgICAgICAgICB7XG4gICAgICAgICAgICAgICAgLy8gdHJpbSB0cmFpbGluZyBzcGFjZXNcbiAgICAgICAgICAgICAgICByZXR1cm4gZml4ZWRTdHJpbmcudHJpbSgpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiB1bmRlZmluZWQ7XG4gICAgfTtcblxuICAgIC8qKlxuICAgICAqIFJldHVybnMgYSBzdHJpbmcgd2l0aCB0aGUgbGVhZGluZyBzcGFjZXMgcHJlc2VydmVkIGFuZCB0cmFpbGluZyBzcGFjZXMgcmVtb3ZlZC5cbiAgICAgKlxuICAgICAqIFVzZSB0aGlzIGZ1bmN0aW9uIHRvIGFjY2VzcyBkYXRhIGZvciBWUnMgb2YgdHlwZSBVVCwgU1QgYW5kIExUXG4gICAgICpcbiAgICAgKiBAcGFyYW0gdGFnXG4gICAgICogQHBhcmFtIGluZGV4XG4gICAgICogQHJldHVybnMgeyp9XG4gICAgICovXG4gICAgZGljb21QYXJzZXIuRGF0YVNldC5wcm90b3R5cGUudGV4dCA9IGZ1bmN0aW9uKHRhZywgaW5kZXgpXG4gICAge1xuICAgICAgICB2YXIgZWxlbWVudCA9IHRoaXMuZWxlbWVudHNbdGFnXTtcbiAgICAgICAgaWYoZWxlbWVudCAmJiBlbGVtZW50Lmxlbmd0aCA+IDApXG4gICAgICAgIHtcbiAgICAgICAgICAgIHZhciBmaXhlZFN0cmluZyA9IGRpY29tUGFyc2VyLnJlYWRGaXhlZFN0cmluZyh0aGlzLmJ5dGVBcnJheSwgZWxlbWVudC5kYXRhT2Zmc2V0LCBlbGVtZW50Lmxlbmd0aCk7XG4gICAgICAgICAgICBpZihpbmRleCA+PSAwKVxuICAgICAgICAgICAge1xuICAgICAgICAgICAgICAgIHZhciB2YWx1ZXMgPSBmaXhlZFN0cmluZy5zcGxpdCgnXFxcXCcpO1xuICAgICAgICAgICAgICAgIHJldH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gICAgIHtcbiAgICAgICAgICAgIHZhciB0YWcgPSBkaWNvbVBhcnNlci5yZWFkVGFnKGJ5dGVTdHJlYW0pO1xuICAgICAgICAgICAgdmFyIGxlbmd0aCA9IGJ5dGVTdHJlYW0ucmVhZFVpbnQzMigpO1xuICAgICAgICAgICAgaWYodGFnID09PSAneGZmZmVlMGRkJylcbiAgICAgICAgICAgIHtcbiAgICAgICAgICAgICAgICBieXRlU3RyZWFtLnNlZWsobGVuZ3RoKTtcbiAgICAgICAgICAgICAgICBlbGVtZW50Lmxlbmd0aCA9IGJ5dGVTdHJlYW0ucG9zaXRpb24gLSBlbGVtZW50LmRhdGFPZmZzZXQ7XG4gICAgICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgZWxzZSBpZih0YWcgPT09ICd4ZmZmZWUwMDAnKVxuICAgICAgICAgICAge1xuICAgICAgICAgICAgICAgIGVsZW1lbnQuZnJhZ21lbnRzLnB1c2goe1xuICAgICAgICAgICAgICAgICAgICBvZmZzZXQ6IGJ5dGVTdHJlYW0ucG9zaXRpb24gLSBiYXNlT2Zmc2V0IC0gOCxcbiAgICAgICAgICAgICAgICAgICAgcG9zaXRpb24gOiBieXRlU3RyZWFtLnBvc2l0aW9uLFxuICAgICAgICAgICAgICAgICAgICBsZW5ndGggOiBsZW5ndGhcbiAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgICAgIGlmKHdhcm5pbmdzKSB7XG4gICAgICAgICAgICAgICAgICAgIHdhcm5pbmdzLnB1c2goJ3VuZXhwZWN0ZWQgdGFnICcgKyB0YWcgKyAnIHdoaWxlIHNlYXJjaGluZyBmb3IgZW5kIG9mIHBpeGVsIGRhdGEgZWxlbWVudCB3aXRoIHVuZGVmaW5lZCBsZW5ndGgnKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgaWYobGVuZ3RoID4gYnl0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Xggc2lnblxuICAgICAgICAgICAgaWYgKGludDE2ICYgMHg4MDAwKSB7XG4gICAgICAgICAgICAgICAgaW50MTYgPSBpbnQxNiAtIDB4RkZGRiAtIDE7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICByZXR1cm4gaW50MTY7XG4gICAgICAgIH0sXG5cblxuICAgICAgICAvKipcbiAgICAgICAgICogUGFyc2VzIGFuIHVuc2lnbmVkIGludCAzMiBmcm9tIGEgbGl0dGxlLWVuZGlhbiBieXRlIGFycmF5XG4gICAgICAgICAqXG4gICAgICAgICAqIEBwYXJhbSBieXRlQXJyYXkgdGhlIGJ5dGUgYXJyYXkgdG8gcmVhZCBmcm9tXG4gICAgICAgICAqIEBwYXJhbSBwb3NpdGlvbiB0aGUgcG9zaXRpb24gaW4gdGhlIGJ5dGUgYXJyYXkgdG8gcmVhZCBmcm9tXG4gICAgICAgICAqIEByZXR1cm5zIHsqfSB0aGUgcGFyc2VkIHVuc2lnbmVkIGludCAzMlxuICAgICAgICAgKiBAdGhyb3dzIGVycm9yIGlmIGJ1ZmZlciBvdmVycmVhZCB3b3VsZCBvY2N1clxuICAgICAgICAgKiBAYWNjZXNzIHByaXZhdGVcbiAgICAgICAgICovXG4gICAgICAgIHJlYWRVaW50MzI6IGZ1bmN0aW9uIChieXRlQXJyYXksIHBvc2l0aW9uKSB7XG4gICAgICAgICAgICBpZiAocG9zaXRpb24gPCAwKSB7XG4gICAgICAgICAgICAgICAgdGhyb3cgJ2xpdHRsZUVuZGlhbkJ5dGVBcnJheVBhcnNlci5yZWFkVWludDMyOiBwb3NpdGlvbiBjYW5ub3QgYmUgbGVzcyB0aGFuIDAnO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICBpZiAocG9zaXRpb24gKyA0ID4gYnl0ZUFycmF5Lmxlbmd0aCkge1xuICAgICAgICAgICAgICAgIHRocm93ICdsaXR0bGVFbmRpYW5CeXRlQXJyYXlQYXJzZXIucmVhZFVpbnQzMjogYXR0ZW1wdCB0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IH1cbiAgICAgICAgaWYobWF4UG9zaXRpb24gPCBieXRlU3RyZWFtLnBvc2l0aW9uIHx8IG1heFBvc2l0aW9uID4gYnl0ZVN0cmVhbS5ieXRlQXJyYXkubGVuZ3RoKVxuICAgICAgICB7XG4gICAgICAgICAgICB0aHJvdyBcImRpY29tUGFyc2VyLnBhcnNlRGljb21EYXRhU2V0RXhwbGljaXQ6IGludmFsaWQgdmFsdWUgZm9yIHBhcmFtZXRlciAnbWF4UG9zaXRpb24nXCI7XG4gICAgICAgIH1cbiAgICAgICAgdmFyIGVsZW1lbnRzID0gZGF0YVNldC5lbGVtZW50cztcblxuICAgICAgICB3aGlsZShieXRlU3RyZWFtLnBvc2l0aW9uIDwgbWF4UG9zaXRpb24pXG4gICAgICAgIHtcbiAgICAgICAgICAgIHZhciBlbGVtZW50ID0gZGljb21QYXJzZXIucmVhZERpY29tRWxlbWVudEV4cGxpY2l0KGJ5dGVTdHJlYW0sIGRhdGFTZXQud2FybmluZ3MsIG9wdGlvbnMudW50aWxUYWcpO1xuICAgICAgICAgICAgZWxlbWVudHNbZWxlbWVudC50YWddID0gZWxlbWVudDtcbiAgICAgICAgICAgIGlmKGVsZW1lbnQudGFnID09PSBvcHRpb25zLnVudGlsVGFnKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIGlmKGJ5dGVTdHJlYW0ucG9zaXRpb24gPiBtYXhQb3NpdGlvbikge1xuICAgICAgICAgICAgdGhyb3cgXCJkaWNvbVBhcnNlcjpwYXJzZURpY29tRGF0YVNldEV4cGxpY2l0OiBidWZmZXIgb3ZlcnJ1blwiO1xuICAgICAgICB9XG4gICAgfTtcblxuICAgIC8qKlxuICAgICAqIHJlYWRzIGFuIGltcGxpY2l0IGRhdGEgc2V0XG4gICAgICogQHBhcmFtIGJ5dGVTdHJlYW0gdGhlIGJ5dGUgc3RyZWFtIHRvIHJlYWQgZnJvbVxuICAgICAqIEBwY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Rpb24pXG4gICAgICAgIHtcbiAgICAgICAgICAgIHZhciBlbGVtZW50ID0gZGljb21QYXJzZXIucmVhZERpY29tRWxlbWVudEltcGxpY2l0KGJ5dGVTdHJlYW0sIG9wdGlvbnMudW50aWxUYWcsIG9wdGlvbnMudnJDYWxsYmFjayk7XG4gICAgICAgICAgICBlbGVtZW50c1tlbGVtZW50LnRhZ10gPSBlbGVtZW50O1xuICAgICAgICAgICAgaWYoZWxlbWVudC50YWcgPT09IG9wdGlvbnMudW50aWxUYWcpIHtcbiAgICAgICAgICAgICAgICByZXR1cm47XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICB9O1xuXG4gICAgcmV0dXJuIGRpY29tUGFyc2VyO1xufShkaWNvbVBhcnNlcikpO1xuXG4vKipcbiAqIEludGVybmFsIGhlbHBlciBmdW5jdGlvbnMgZm9yIGZvciBwYXJzaW5nIERJQ09NIGVsZW1lbnRzXG4gKi9cblxudmFyIGRpY29tUGFyc2VyID0gKGZ1bmN0aW9uIChkaWNvbVBhcnNlcilcbntcbiAgICBcInVzZSBzdHJpY3RcIjtcblxuICAgIGlmKGRpY29tUGFyc2VyID09PSB1bmRlZmluZWQpXG4gICAge1xuICAgICAgICBkaWNvbVBhcnNlciA9IHt9O1xuICAgIH1cblxuICAgIGZ1bmN0aW9uIGdldERhdGFMZW5ndGhTaXplSW5CeXRlc0ZvclZSKHZyKVxuICAgIHtcbiAgICAgICAgaWYoIHZyID09PSAnT0InIHx8XG4gICAgICAgICAgICB2ciA9PT0gJ09XJyB8fFxuICAgICAgICAgICAgdnIgPT09ICdTUScgfHxcbiAgICAgICAgICAgIHZyID09PSAnT0YnIHx8XG4gICAgICAgICAgICB2ciA9PT0gJ1VUJyB8fFxuICAgICAgICAgICAgdnIgPT09ICdVTicpXG4gICAgICAgIHtcbiAgICAgICAgICAgIHJldHVybiA0O1xuICAgICAgICB9XG4gICAgICAgIGVsc2VcbiAgICAgICAge1xuICAgICAgICAgICAgcmV0dXJuIDI7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gICAgICAgZWxlbWVudC5sZW5ndGggPSBieXRlU3RyZWFtLnJlYWRVaW50MzIoKTtcbiAgICAgICAgICAgIGVsZW1lbnQuZGF0YU9mZnNldCA9IGJ5dGVTdHJlYW0ucG9zaXRpb247XG4gICAgICAgIH1cblxuICAgICAgICBpZihlbGVtZW50Lmxlbmd0aCA9PT0gNDI5NDk2NzI5NSlcbiAgICAgICAge1xuICAgICAgICAgICAgZWxlbWVudC5oYWRVbmRlZmluZWRMZW5ndGggPSB0cnVlO1xuICAgICAgICB9XG5cbiAgICAgICAgaWYoZWxlbWVudC50YWcgPT09IHVudGlsVGFnKSB7XG4gICAgICAgICAgICByZXR1cm4gZWxlbWVudDtcbiAgICAgICAgfVxuXG4gICAgICAgIC8vIGlmIFZSIGlzIFNRLCBwYXJzZSB0aGUgc2VxdWVuY2UgaXRlbXNcbiAgICAgICAgaWYoZWxlbWVudC52ciA9PT0gJ1NRJylcbiAgICAgICAge1xuICAgICAgICAgICAgZGljb21QYXJzZXIucmVhZFNlcXVlbmNlSXRlbXNFeHBsaWNpdChieXRlU3RyZWFtLCBlbGVtZW50LCB3YXJuaW5ncyk7XG4gICAgICAgICAgICByZXR1cm4gZWxlbWVudDtcbiAgICAgICAgfVxuXG5cbiAgICAgICAgaWYoZWxlbWVudC5sZW5ndGggPT09IDQyOTQ5NjcyOTUpXG4gICAgICAgIHtcbiAgICAgICAgICAgIGlmKGVsZW1lbnQudGFnID09PSAneDdmZTAwMDEwJykge1xuICAgICAgICAgICAgICAgIGRpY29tUGFyc2VyLmZpbmRFbmRPZkVuY2Fwc3VsYXRlZEVsZW1lbnQoYnl0ZVN0cmVhbSwgZWxlbWVudCwgd2FybmluZ3MpO1xuICAgICAgICAgICAgICAgIHJldHVybiBlbGVtZW50O1xuICAgICAgICAgICAgfSAgIGVsc2UgaWYoZWxlbWVudC52ciA9PT0gJ1VOJykge1xuICAgICAgICAgICAgICAgIGRpY29tUGFyc2VyLmZpbmRBbmRTZXRVTkVsZW1lb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iAgICAgICAgYnl0ZVN0cmVhbS53YXJuaW5ncy5wdXNoKCdlb2YgZW5jb3VudGVyZWQgYmVmb3JlIGZpbmRpbmcgc2VxdWVuY2UgaXRlbSB0YWcgb3Igc2VxdWVuY2UgZGVsaW1pdGVyIHRhZyBpbiBwZWVraW5nIHRvIGRldGVybWluZSBWUicpO1xuICAgICAgICByZXR1cm4gZmFsc2U7XG4gICAgfVxuXG4gICAgZGljb21QYXJzZXIucmVhZERpY29tRWxlbWVudEltcGxpY2l0ID0gZnVuY3Rpb24oYnl0ZVN0cmVhbSwgdW50aWxUYWcsIHZyQ2FsbGJhY2spXG4gICAge1xuICAgICAgICBpZihieXRlU3RyZWFtID09PSB1bmRlZmluZWQpXG4gICAgICAgIHtcbiAgICAgICAgICAgIHRocm93IFwiZGljb21QYXJzZXIucmVhZERpY29tRWxlbWVudEltcGxpY2l0OiBtaXNzaW5nIHJlcXVpcmVkIHBhcmFtZXRlciAnYnl0ZVN0cmVhbSdcIjtcbiAgICAgICAgfVxuXG4gICAgICAgIHZhciBlbGVtZW50ID0ge1xuICAgICAgICAgICAgdGFnIDogZGljb21QYXJzZXIucmVhZFRhZyhieXRlU3RyZWFtKSxcbiAgICAgICAgICAgIGxlbmd0aDogYnl0ZVN0cmVhbS5yZWFkVWludDMyKCksXG4gICAgICAgICAgICBkYXRhT2Zmc2V0IDogIGJ5dGVTdHJlYW0ucG9zaXRpb25cbiAgICAgICAgfTtcblxuICAgICAgICBpZihlbGVtZW50Lmxlbmd0aCA9PT0gNDI5NDk2NzI5NSkge1xuICAgICAgICAgICAgZWxlbWVudC5oYWRVbmRlZmluZWRMZW5ndGggPSB0cnVlO1xuICAgICAgICB9XG5cbiAgICAgICAgaWYoZWxlbWVudC50YWcgPT09IHVudGlsVGFnKSB7XG4gICAgICAgICAgICByZXR1cm4gZWxlbWVudDtcbiAgICAgICAgfVxuXG4gICAgICAgIGlmIChpc1NlcXVlbmNlKGVsZW1lbnQsIGJ5dGVTdHJlYW0sI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7XG4gICAgICAgICAgICBjYXNlIDB4RkZDNDogLy8gREhUXG4gICAgICAgICAgICAgICAgdGhpcy5odWZmVGFibGUucmVhZCh0aGlzLnN0cmVhbSwgdGhpcy5IdWZmVGFiKTtcbiAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIGNhc2UgMHhGRkNDOiAvLyBEQUNcbiAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoXCJQcm9ncmFtIGRvZXNuJ3Qgc3VwcG9ydCBhcml0aG1ldGljIGNvZGluZy4gKGZvcm1hdCB0aHJvdyBuZXcgSU9FeGNlcHRpb24pXCIpO1xuICAgICAgICAgICAgY2FzZSAweEZGREI6XG4gICAgICAgICAgICAgICAgdGhpcy5xdWFudFRhYmxlLnJlYWQodGhpcy5zdHJlYW0sIGpwZWcubG9zc2xlc3MuRGVjb2Rlci5UQUJMRSk7XG4gICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICBjYXNlIDB4RkZERDpcbiAgICAgICAgICAgICAgICB0aGlzLnJlc3RhcnRJbnRlcnZhbCA9IHRoaXMucmVhZE51bWJlcigpO1xuICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgY2FzZSAweEZGRTA6XG4gICAgICAgICAgICBjYXNlIDB4RkZFMTpcbiAgICAgICAgICAgIGNhc2UgMHhGRkUyOlxuICAgICAgICAgICAgY2FzZSAweEZGRTM6XG4gICAgICAgICAgICBjYXNlIDB4RkZFNDpcbiAgICAgICAgICAgIGNhc2UgMHhGRkU1OlxuICAgICAgICAgICAgY2FzZSAweEZGRTY6XG4gICAgICAgICAgICBjYXNlIDB4RkZFNzpcbiAgICAgICAgICAgIGNhc2UgMHhGRkU4OlxuICAgICAgICAgICAgY2FzZSAweEZGRTk6XG4gICAgICAgICAgICBjYXNlIDB4RkZFQTpcbiAgICAgICAgICAgIGNhc2UgMHhGRkVCOlxuICAgICAgICAgICAgY2FzZSAweEZGRUM6XG4gICAgICAgICAgICBjYXNlIDB4RkZFRDpcbiAgICAgICAgICAgIGNhc2UgMHhGRkVFOlxuICAgICAgICAgICAgY2FzZSAweEZGRUY6XG4gICAgICAgICAgICAgICAgdGhpcy5yZWFkQXBwKCk7XG4gICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICBjYXNlIDB4RkZGRTpcbiAgICAgICAgICAgICAgICB0aGlzLnJlYWRDb21tZW50KCk7XG4gICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgIGlmICgoY3VycmVudCA+PiA4KSAhPT0gMHhGRikge1xuICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoXCJFUlJPUjogZm9ybWF0IHRocm93IG5ldyBJT0V4Y2VwdGlvbiEgKGRlY29kZSlcIik7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICB9XG5cbiAgICAgICAgY3VycmVudCA9IHRoaXMuc3RyZWFtLmdldDE2KCk7XG4gICAgfVxuXG4gICAgaWYgKChjdXJyZW50IDwgMHhGRkMwKSB8fCAoY3VycmVudCA+IDB4RkZDNykpIHtcbiAgICAgICAgdGhyb3cgbmV3IEVycm9yKFwiRVJST1I6IGNvdWxkIG5vdCBoYW5kbGUgYXJpdGhtZXRpYyBjb2RlIVwiKTtcbiAgICB9XG5cbiAgICB0aGlzLmZyYW1lLnJlYWQodGhpcy5zdHJlYW0pO1xuICAgIGN1cnJlbnQgPSB0aGlzLnN0cmVhbS5nZXQxNigpO1xuXG4gICAgZG8ge1xuICAgICAgICB3aGlsZSAoY3VycmVudCAhPT0gMHgwRkZEQSkgeyAvLyBTT1NcbiAgICAgICAgICAgIHN3aXRjaCAoY3VycmVudCkge1xuICAgICAgICAgICAgICAgIGNhc2UgMHhGRkM0OiAvLyBESFRcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5odWZmVGFibGUucmVhZCh0aGlzLnN0cmVhbSwgdGhpcy5IdWZmVGFiKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAweEZGQ0M6IC8vIERBQ1xuICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoXCJQcm9ncmFtIGRvZXNuJ3Qgc3VwcG9ydCBhcml0aG1ldGljIGNvZGluZy4gKGZvcm1hdCB0aHJvdyBuZXcgSU9FeGNlcHRpb24pXCIpO1xuICAgICAgICAgICAgICAgIGNhc2UgMHhGRkRCOlxuICAgICAgICAgICAgICAgICAgICB0aGlzLnF1YW50VGFibGUucmVhZCh0aGlzLnN0cmVhbSwganBlZy5sb3NzbGVzcy5EZWNvZGVyLlRBQkxFKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAweEZGREQ6XG4gICAgICAgICAgICAgICAgICAgIHRoaXMucmVzdGFydEludGVydmFsID0gdGhpcy5yZWFkTnVtYmVyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMHhGRkUwOlxuICAgICAgICAgICAgICAgIGNhc2UgMHhGRkUxOlxuICAgICAgICAgICAgICAgIGNhc2UgMHhGRkUyOlxuICAgICAgICAgICAgICAgIGNhc2UgMHhGRkUzOlxuICAgICAgICAgICAgICAgIGNhc2UgMHhGRkU0OlxuICAgICAgICAgICAgICAgIGNhc2UgMHhGRkU1OlxuICAgICAgICAgICAgICAgIGNhc2UgMHhGRkU2OlxuICAgICAgICAgICAgICAgIGNhc2UgMHhGRkU3OlxuICAgICAgICAgICAgICAgIGNhc2UgMHhGRkU4OlxuICAgICAgICAgICAgICAgIGNhc2UgMHhGRkU5OlxuICAgICAgICAgICAgICAgIGNhc2UgMHhGRkVBOlxuICAgICAgICAgICAgICAgIGNhc2UgMHhGRkVCOlxuICAgICAgICAgICAgICAgIGNhc2UgMHhGRkVDOlxuICAgICAgICAgICAgICAgIGNhc2UgMHhGRkVEOlxuICAgICAgICAgICAgICAgIGNhc2UgMHhGRkVFOlxuICAgICAgICAgICAgICAgIGNhc2UgMHhGRkVGOlxuICAgICAgICAgICAgICAgICAgICB0aGlzLnJlYWRBcHAoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAweEZGRkU6XG4gICAgICAgICAgICAgICAgICAgIHRoaXMucmVhZENvbW1lbnQoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgaWYgKChjdXJyZW50ID4+IDgpICE9PSAweEZGKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoXCJFUlJPUjogZm9ybWF0IHRocm93IG5ldyBJT0V4Y2VwdGlvbiEgKFBhcnNlci5kZWNvZGUpXCIpO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIGN1cnJlbnQgPSB0aGlzLnN0cmVhbS5nZXQxNigpO1xuICAgICAgICB9XG5cbiAgICAgICAgdGhpcy5wcmVjaXNpb24gPSB0aGlzLmZyYW1lLnByZWNpc2lvbjtcbiAgICAgICAgdGhpcy5jb21wb25lbnRzID0gdGhpcy5mcmFtZS5jb21wb25lbnRzO1xuXG4gICAgICAgIGlmICghdGhpcy5udW1CeXRlcykge1xuICAgICAgICAgICAgdGhpcy5udW1CeXRlcyA9IHBhcnNlSW50KE1hdGguY2VpbCh0aGlzLnByZWNpc2lvbiAvIDgpKTtcbiAgICAgICAgfVxuXG4gICAgICAgIGlmICh0aGlzLm51bUJ5dGVzID09IDEpIHtcbiAgICAgICAgICAgIHRoaXMubWFzayA9IDB4RkY7XG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICB0aGlzLm1hc2sgPSAweEZGRkY7XG4gICAgICAgIH1cblxuICAgICAgICB0aGlzLnNjYW4ucmVhZCh0aGlzLnN0cmVhbSk7XG4gICAgICAgIHRoaXMubnVtQ29tcCA9IHRoaXMuc2Nhbi5udW1Db21wO1xuICAgICAgICB0aGlzLnNlbGVjdGlvbiA9IHRoaXMuc2Nhbi5zZWxlY3Rpb247XG5cbiAgICAgICAgaWYgKHRoaXMubnVtQnl0ZXMgPT09IDEpIHtcbiAgICAgICAgICAgIGlmICh0aGlzLm51bUNvbXAgPT09IDMpIHtcbiAgICAgICAgICAgICAgICB0aGlzLmdldHRlciA9IHRoaXMuZ2V0VmFsdWVSR0I7XG4gICAgICAgICAgICAgICAgdGhpcy5zZXR0ZXIgPSB0aGlzLnNldFZhbHVlUkdCO1xuICAgICAgICAgICAgICAgIHRoaXMub3V0cHV0ID0gdGhpcy5vdXRwdXRSR0I7XG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIHRoaXMuZ2V0dGVyID0gdGhpcy5nZXRWYWx1ZTg7XG4gICAgICAgICAgICAgICAgdGhpcy5zZXR0ZXIgPSB0aGlzLnNldFZhbHVlODtcbiAgICAgICAgICAgICAgICB0aGlzLm91dHB1dCA9IHRoaXMub3V0cHV0U2luZ2xlO1xuICAgICAgICAgICAgfVxuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgdGhpcy5nZXR0ZXIgPSB0aGlzLmdldFZhbHVlMTY7XG4gICAgICAgICAgICB0aGlzLnNldHRlciA9IHRoaXMuc2V0VmFsdWUxNjtcbiAgICAgICAgICAgIHRoaXMub3V0cHV0ID0gdGhpcy5vdXRwdXRTaW5nbGU7XG4gICAgICAgIH1cblxuICAgICAgICBzd2l0Y2ggKHRoaXMuc2VsZWN0aW9uKSB7XG4gICAgICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgICAgICAgdGhpcy5zZWxlY3RvciA9IHRoaXMuc2VsZWN0MjtcbiAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIGNhc2UgMzpcbiAgICAgICAgICAgICAgICB0aGlzLnNlbGVjdG9yID0gdGhpcy5zZWxlY3QzO1xuICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgY2FzZSA0OlxuICAgICAgICAgICAgICAgIHRoaXMuc2VsZWN0b3IgPSB0aGlzLnNlbGVjdDQ7XG4gICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICBjYXNlIDU6XG4gICAgICAgICAgICAgICAgdGhpcy5zZWxlY3RvciA9IHRoaXMuc2VsZWN0NTtcbiAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIGNhc2UgNjpcbiAgICAgICAgICAgICAgICB0aGlzLnNlbGVjdG9yID0gdGhpcy5zZWxlY3Q2O1xuICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgY2FzZSA3OlxuICAgICAgICAgICAgICAgIHRoaXMuc2VsZWN0b3IgPSB0aGlzLnNlbGVjdDc7XG4gICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgIHRoaXMuc2VsZWN0b3IgPSB0aGlzLnNlbGVjdDE7XG4gICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgIH1cblxuICAgICAgICB0aGlzLnNjYW5Db21wcyA9IHRoaXMuc2Nhbi5jb21wb25lbnRzO1xuICAgICAgICB0aGlzLnF1YW50VGFibGVzID0gdGhpcy5xdWFudFRhYmxlLnF1YW50VGFibGVzO1xuXG4gICAgICAgIGZvciAoaSA9IDA7IGkgPCB0aGlzLm51bUNvbXA7IGkrPTEpIHtcbiAgICAgICAgICAgIGNvbXBOID0gdGhpcy5zY2FuQ29tcHNbaV0uc2NhbkNvbXBTZWw7XG4gICAgICAgICAgICB0aGlzLnFUYWJbaV0gPSB0aGlzLnF1YW50VGFibGVzW3RoaXMuY29tcG9uZW50c1tjb21wTl0ucXVhbnRUYWJsZVNlbF07XG4gICAgICAgICAgICB0aGlzLm5CbG9ja1tpXSA9IHRoaXMuY29tcG9uZW50c1tjb21wTl0udlNhbXAgKiB0aGlzLmNvbXBvbmVudHNbY29tcE5dLmhTYW1wO1xuICAgICAgICAgICAgdGhpcy5kY1RhYltpXSA9IHRoaXMuSHVmZlRhYlt0aGlzLnNjYW5Db21wc1tpXS5kY1RhYlNlbF1bMF07XG4gICAgICAgICAgICB0aGlzLmFjVGFiW2ldID0gdGhpcy5IdWZmVGFiW3RoaXMuc2NhbkNvbXBzW2ldLmFjVGFiU2VsXVsxXTtcbiAgICAgICAgfVxuXG4gICAgICAgIHRoaXMueERpbSA9IHRoaXMuZnJhbWUuZGltWDtcbiAgICAgICAgdGhpcy55RGltID0gdGhpcy5mcmFtZS5kaW1ZO1xuICAgICAgICB0aGlzLm91dHB1dERhdGEgPSBuZXcgRGF0YVZpZXcobmV3IEFycmF5QnVmZmVyKHRoaXMueERpbSAqIHRoaXMueURpbSAqIHRoaXMubnVtQnl0ZXMgKiB0aGlzLm51bUNvbXApKTtcblxuICAgICAgICBzY2FuTnVtKz0xO1xuXG4gICAgICAgIHdoaWxlICh0cnVlKSB7IC8vIERlY29kZSBvbmUgc2NhblxuICAgICAgICAgICAgdGVtcFswXSA9IDA7XG4gICAgICAgICAgICBpbmRleFswXSA9IDA7XG5cbiAgICAgICAgICAgIGZvciAoaSA9IDA7IGkgPCAxMDsgaSs9MSkge1xuICAgICAgICAgICAgICAgIHByZWRbaV0gPSAoMSA8PCAodGhpcy5wcmVjaXNpb24gLSAxKSk7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIGlmICh0aGlzLnJlc3RhcnRJbnRlcnZhbCA9PT0gMCkge1xuICAgICAgICAgICAgICAgIGN1cnJlbnQgPSB0aGlzLmRlY29kZVVuaXQocHJlZCwgdGVtcCwgaW5kZXgpO1xuXG4gICAgICAgICAgICAgICAgd2hpbGUgKChjdXJyZW50ID09PSAwKSAmJiAoKHRoaXMueExvYyA8IHRoaXMueERpbSkgJiYgKHRoaXMueUxvYyA8IHRoaXMueURpbSkpKSB7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMub3V0cHV0KHByZWQpO1xuICAgICAgICAgICAgICAgICAgICBjdXJyZW50ID0gdGhpcy5kZWNvZGVVbml0KHByZWQsIHRlbXAsIGluZGV4KTtcbiAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICBicmVhazsgLy9jdXJyZW50PU1BUktFUlxuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICBmb3IgKG1jdU51bSA9IDA7IG1jdU51bSA8IHRoaXMucmVzdGFydEludGVydmFsOyBtY3VOdW0rPTEpIHtcbiAgICAgICAgICAgICAgICB0aGlzLnJlc3RhcnRpbmcgPSAobWN1TnVtID09IDApO1xuICAgICAgICAgICAgICAgIGN1cnJlbnQgPSB0aGlzLmRlY29kZVVuaXQocHJlZCwgdGVtcCwgaW5kZXgpO1xuICAgICAgICAgICAgICAgIHRoaXMub3V0cHV0KHByZWQpO1xuXG4gICAgICAgICAgICAgICAgaWYgKGN1cnJlbnQgIT09IDApIHtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICBpZiAoY3VycmVudCA9PT0gMCkge1xuICAgICAgICAgICAgICAgIGlmICh0aGlzLm1hcmtlckluZGV4ICE9PSAwKSB7XG4gICAgICAgICAgICAgICAgICAgIGN1cnJlbnQgPSAoMHhGRjAwIHwgdGhpcy5tYXJrZXIpO1xuICAgICAgICAgICAgICAgICAgICB0aGlzLm1hcmtlckluZGV4ID0gMDtcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICBjdXJyZW50ID0gdGhpcy5zdHJlYW0uZ2V0MTYoKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIGlmICghKChjdXJyZW50ID49IGpwZWcubG9zc2xlc3MuRGVjb2Rlci5SRVNUQVJUX01BUktFUl9CRUdJTikgJiZcbiAgICAgICAgICAgICAgICAoY3VycmVudCA8PSBqcGVnLmxvc3NsZXNzLkRlY29kZXIuUkVTVEFSVF9NQVJLRVJfRU5EKSkpIHtcbiAgICAgICAgICAgICAgICBicmVhazsgLy9jdXJyZW50PU1BUktFUlxuICAgICAgICAgICAgfVxuICAgICAgICB9XG5cbiAgICAgICAgaWYgKChjdXJyZW50ID09PSAweEZGREMpICYmIChzY2FuTnVtID09PSAxKSkgeyAvL0ROTFxuICAgICAgICAgICAgdGhpcy5yZWFkTnVtYmVyKCk7XG4gICAgICAgICAgICBjdXJyZW50ID0gdGhpcy5zdHJlYW0uZ2V0MTYoKTtcbiAgICAgICAgfVxuICAgIH0gd2hpbGUgKChjdXJyZW50ICE9PSAweEZGRDkpICYmICgodGhpcy54TG9jIDwgdGhpcy54RGltKSAmJiAodGhpcy55TG9jIDwgdGhpcy55RGltKSkgJiYgKHNjYW5OdW0gPT09IDApKTtcblxuICAgIHJldHVybiB0aGlzLm91dHB1dERhdGE7XG59O1xuXG5cblxuanBlZy5sb3NzbGVzcy5EZWNvZGVyLnByb3RvdHlwZS5kZWNvZGVVbml0ID0gZnVuY3Rpb24gKHByZXYsIHRlbXAsIGluZGV4KSB7XG4gICAgaWYgKHRoaXMubnVtQ29tcCA9PSAxKSB7XG4gICAgICAgIHJldHVybiB0aGlzLmRlY29kZVNpbmdsZShwcmV2LCB0ZW1wLCBpbmRleCk7XG4gICAgfSBlbHNlIGlmICh0aGlzLm51bUNvbXAgPT0gMykge1xuICAgICAgICByZXR1cm4gdGhpcy5kZWNvZGVSR0IocHJldiwgdGVtcCwgaW5kZXgpO1xuICAgIH0gZWxzZSB7XG4gICAgICAgIHJldHVybiAtMTtcbiAgICB9XG59O1xuXG5cblxuanBlZy5sb3NzbGVzcy5EZWNvZGVyLnByb3RvdHlwZS5zZWxlY3QxID0gZnVuY3Rpb24gKGNvbXBPZmZzZXQpIHtcbiAgICByZXR1cm4gdGhpcy5nZXRQcmV2aW91c1goY29tcE9mZnNldCk7XG59O1xuXG5cblxuanBlZy5sb3N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HZhbHVlID49IDB4RkYwMCkge1xuICAgICAgICAgICAgICAgIHJldHVybiB2YWx1ZTtcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgcHJldltjdHJDXSA9IHRoaXMuSURDVF9Tb3VyY2VbMF0gPSBwcmV2W2N0ckNdICsgdGhpcy5nZXRuKGluZGV4LCB2YWx1ZSwgdGVtcCwgaW5kZXgpO1xuICAgICAgICAgICAgdGhpcy5JRENUX1NvdXJjZVswXSAqPSBxdGFiWzBdO1xuXG4gICAgICAgICAgICBmb3IgKGogPSAxOyBqIDwgNjQ7IGorPTEpIHtcbiAgICAgICAgICAgICAgICB2YWx1ZSA9IHRoaXMuZ2V0SHVmZm1hblZhbHVlKGFjdGFiLCB0ZW1wLCBpbmRleCk7XG5cbiAgICAgICAgICAgICAgICBpZiAodmFsdWUgPj0gMHhGRjAwKSB7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiB2YWx1ZTtcbiAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICBqICs9ICh2YWx1ZSA+PiA0KTtcblxuICAgICAgICAgICAgICAgIGlmICgodmFsdWUgJiAweDBGKSA9PT0gMCkge1xuICAgICAgICAgICAgICAgICAgICBpZiAoKHZhbHVlID4+IDQpID09PSAwKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuSURDVF9Tb3VyY2VbanBlZy5sb3NzbGVzcy5EZWNvZGVyLklEQ1RfUFtqXV0gPSB0aGlzLmdldG4oaW5kZXgsIHZhbHVlICYgMHgwRiwgdGVtcCwgaW5kZXgpICogcXRhYltqXTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICB9XG5cbiAgICByZXR1cm4gMDtcbn07XG5cblxuXG5qcGVnLmxvc3NsZXNzLkRlY29kZXIucHJvdG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0gaW5kZXhbMF0pKTtcbiAgICAgICAgdGVtcFswXSA8PD0gODtcbiAgICAgICAgaW5wdXQgPSB0aGlzLnN0cmVhbS5nZXQ4KCk7XG5cbiAgICAgICAgaWYgKGlucHV0ID09PSAweEZGKSB7XG4gICAgICAgICAgICB0aGlzLm1hcmtlciA9IHRoaXMuc3RyZWFtLmdldDgoKTtcbiAgICAgICAgICAgIGlmICh0aGlzLm1hcmtlciAhPT0gMCkge1xuICAgICAgICAgICAgICAgIHRoaXMubWFya2VySW5kZXggPSA5O1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG5cbiAgICAgICAgdGVtcFswXSB8PSBpbnB1dDtcbiAgICAgICAgY29kZSA9IHRhYmxlWygoY29kZSAmIDB4RkYpICogMjU2KSArICh0ZW1wWzBdID4+IGluZGV4WzBdKV07XG4gICAgICAgIGluZGV4WzBdICs9IDg7XG4gICAgfVxuXG4gICAgaW5kZXhbMF0gKz0gOCAtIChjb2RlID4+IDgpO1xuXG4gICAgaWYgKGluZGV4WzBdIDwgMCkge1xuICAgICAgICB0aHJvdyBuZXcgRXJyb3IoXCJpbmRleD1cIiArIGluZGV4WzBdICsgXCIgdGVtcD1cIiArIHRlbXBbMF0gKyBcIiBjb2RlPVwiICsgY29kZSArIFwiIGluIEh1ZmZtYW5WYWx1ZSgpXCIpO1xuICAgIH1cblxuICAgIGlmIChpbmRleFswXSA8IHRoaXMubWFya2VySW5kZXgpIHtcbiAgICAgICAgdGhpcy5tYXJrZXJJbmRleCA9IDA7XG4gICAgICAgIHJldHVybiAweEZGMDAgfCB0aGlzLm1hcmtlcjtcbiAgICB9XG5cbiAgICB0ZW1wWzBdICY9IChtYXNrID4+ICgxNiAtIGluZGV4WzBdKSk7XG4gICAgcmV0dXJuIGNvZGUgJiAweEZGO1xufTtcblxuXG5cbmpwZWcubG9zc2xlc3MuRGVjb2Rlci5wcm90b3R5cGUuZ2V0biA9IGZ1bmN0aW9uIChQUkVELCBuLCB0ZW1wLCBpbmRleCkge1xuICAgIC8qanNsaW50IGJpdHdpc2U6IHRydWUgKi9cblxuICAgIHZhciByZXN1bHQsIG9uZSwgbl9vbmUsIG1hc2ssIGlucHV0O1xuICAgIG9uZSA9IDE7XG4gICAgbl9vbmUgPSAtMTtcbiAgICBtYXNrID0gMHhGRkZGO1xuXG4gICAgaWYgKG4gPT09IDApIHtcbiAgICAgICAgcmV0dXJuIDA7XG4gICAgfVxuXG4gICAgaWYgKG4gPT09IDE2KSB7XG4gICAgICAgIGlmIChQUkVEWzBdID49IDApIHtcbiAgICAgICAgICAgIHJldHVybiAtMzI3Njg7XG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICByZXR1cm4gMzI3Njg7XG4gICAgICAgIH1cbiAgICB9XG5cbiAgICBpbmRleFswXSAtPSBuO1xuXG4gICAgaWYgKGluZGV4WzBdID49IDApIHtcbiAgICAgICAgaWYgKChpbmRleFswXSA8IHRoaXMubWFya2VySW5kZXgpICYmICF0aGlzLmlzTGFzdFBpeGVsKCkpIHsgLy8gdGhpcyB3YXMgY29ycnVwdGluZyB0aGUgbGFzdCBwaXhlbCBpbiBzb21lIGNhc2VzXG4gICAgICAgICAgICB0aGlzLm1hcmtlckluZGV4ID0gMDtcbiAgICAgICAgICAgIHJldHVybiAoMHhGRjAwIHwgdGhpcy5tYXJrZXIpIDw8IDg7XG4gICAgICAgIH1cblxuICAgICAgICByZXN1bHQgPSB0ZW1wWzBdID4+IGluZGV4WzBdO1xuICAgICAgICB0ZW1wWzBdICY9IChtYXNrID4+ICgxNiAtIGluZGV4WzBdKSk7XG4gICAgfSBlbHNlIHtcbiAgICAgICAgdGVtcFswXSA8PD0gODtcbiAgICAgICAgaW5wdXQgPSB0aGlzLnN0cmVhbS5nZXQ4KCk7XG5cbiAgICAgICAgaWYgKGlucHV0ID09PSAweEZGKSB7XG4gICAgICAgICAgICB0aGlzLm1hcmtlciA9IHRoaXMuc3RyZWFtLmdldDgoKTtcbiAgICAgICAgICAgIGlmICh0aGlzLm1hcmtlciAhPT0gMCkge1xuICAgICAgICAgICAgICAgIHRoaXMubWFya2VySW5kZXggPSA5O1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG5cbiAgICAgICAgdGVtcFswXSB8PSBpbnB1dDtcbiAgICAgICAgaW5kZXhbMF0gKz0gODtcblxuICAgICAgICBpZiAoaW5kZXhbMF0gPCAwKSB7XG4gICAgICAgICAgICBpZiAodGhpcy5tYXJrZXJJbmRleCAhPT0gMCkge1xuICAgICAgICAgICAgICAgIHRoaXMubWFya2VySW5kZXggPSAwO1xuICAgICAgICAgICAgICAgIHJldHVybiAoMHhGRjAwIHwgdGhpcy5tYXJrZXIpIDw8IDg7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHRlbXBbMF0gPDw9IDg7XG4gICAgICAgICAgICBpbnB1dCA9IHRoaXMuc3RyZWFtLmdldDgoKTtcblxuICAgICAgICAgICAgaWYgKGlucHV0ID09PSAweEZGKSB7XG4gICAgICAgICAgICAgICAgdGhpcy5tYXJrZXIgPSB0aGlzLnN0cmVhbS5nZXQ4KCk7XG4gICAgICAgICAgICAgICAgaWYgKHRoaXMubWFya2VyICE9PSAwKSB7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMubWFya2VySW5kZXggPSA5O1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgdGVtcFswXSB8PSBpbnB1dDtcbiAgICAgICAgICAgIGluZGV4WzBdICs9IDg7XG4gICAgICAgIH1cblxuICAgICAgICBpZiAoaW5kZXhbMF0gPCAwKSB7XG4gICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoXCJpbmRleD1cIiArIGluZGV4WzBdICsgXCIgaW4gZ2V0bigpXCIpO1xuICAgICAgICB9XG5cbiAgICAgICAgaWYgKGluZGV4WzBdIDwgdGhpcy5tYXJrZXJJbmRleCkge1xuICAgICAgICAgICAgdGhpcy5tYXJrZXJJbmRleCA9IDA7XG4gICAgICAgICAgICByZXR1cm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0aGlzLnhMb2MgPj0gdGhpcy54RGltKSB7XG4gICAgICAgICAgICB0aGlzLnlMb2MrPTE7XG4gICAgICAgICAgICB0aGlzLnhMb2MgPSAwO1xuICAgICAgICB9XG4gICAgfVxufTtcblxuXG5cbmpwZWcubG9zc2xlc3MuRGVjb2Rlci5wcm90b3R5cGUub3V0cHV0UkdCID0gZnVuY3Rpb24gKFBSRUQpIHtcbiAgICB2YXIgb2Zmc2V0ID0gKCh0aGlzLnlMb2MgKiB0aGlzLnhEaW0pICsgdGhpcy54TG9jKTtcblxuICAgIGlmICgodGhpcy54TG9jIDwgdGhpcy54RGltKSAmJiAodGhpcy55TG9jIDwgdGhpcy55RGltKSkge1xuICAgICAgICB0aGlzLnNldHRlcihvZmZzZXQsIFBSRURbMF0sIDApO1xuICAgICAgICB0aGlzLnNldHRlcihvZmZzZXQsIFBSRURbMV0sIDEpO1xuICAgICAgICB0aGlzLnNldHRlcihvZmZzZXQsIFBSRURbMl0sIDIpO1xuXG4gICAgICAgIHRoaXMueExvYys9MTtcblxuICAgICAgICBpZiAodGhpcy54TG9jID49IHRoaXMueERpbSkge1xuICAgICAgICAgICAgdGhpcy55TG9jKz0xO1xuICAgICAgICAgICAgdGhpcy54TG9jID0gMDtcbiAgICAgICAgfVxuICAgIH1cbn07XG5cblxuXG5qcGVnLmxvc3NsZXNzLkRlY29kZXIucHJvdG90eXBlLnNldFZhbHVlMTYgPSBmdW5jdGlvbiAoaW5kZXgsIHZhbCkge1xuICAgIHRoaXMub3V0cHV0RGF0YS5zZXRJbnQxNihpbmRleCAqIDIsIHZhbCwgdHJ1ZSk7XG59O1xuXG5cblxuanBlZy5sb3NzbGVzcy5EZWNvZGVyLnByb3RvdHlwZS5nZXRWYWx1ZTE2ID0gZnVuY3Rpb24gKGluZGV4KSB7XG4gICAgcmV0dXJuIHRoaXMub3V0cHV0RGF0YS5nZXRJbnQxNihpbmRleCAqIDIsIHRydWUpO1xufTtcblxuXG5cbmpwZWcubG9zc2xlc3M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m9yIChpID0gMDsgaSA8IDE2OyBpKz0xKSB7XG4gICAgICAgICAgICB0aGlzLmxbdF1bY11baV0gPSBkYXRhLmdldDgoKTtcbiAgICAgICAgICAgIGNvdW50Kz0xO1xuICAgICAgICB9XG5cbiAgICAgICAgZm9yIChpID0gMDsgaSA8IDE2OyBpKz0xKSB7XG4gICAgICAgICAgICBmb3IgKGogPSAwOyBqIDwgdGhpcy5sW3RdW2NdW2ldOyBqKz0xKSB7XG4gICAgICAgICAgICAgICAgaWYgKGNvdW50ID4gbGVuZ3RoKSB7XG4gICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcihcIkVSUk9SOiBIdWZmbWFuIHRhYmxlIGZvcm1hdCBlcnJvciBbY291bnQ+TGhdXCIpO1xuICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgIHRoaXMudlt0XVtjXVtpXVtqXSA9IGRhdGEuZ2V0OCgpO1xuICAgICAgICAgICAgICAgIGNvdW50Kz0xO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgfVxuXG4gICAgaWYgKGNvdW50ICE9PSBsZW5ndGgpIHtcbiAgICAgICAgdGhyb3cgbmV3IEVycm9yKFwiRVJST1I6IEh1ZmZtYW4gdGFibGUgZm9ybWF0IGVycm9yIFtjb3VudCE9TGZdXCIpO1xuICAgIH1cblxuICAgIGZvciAoaSA9IDA7IGkgPCA0OyBpKz0xKSB7XG4gICAgICAgIGZvciAoaiA9IDA7IGogPCAyOyBqKz0xKSB7XG4gICAgICAgICAgICBpZiAodGhpcy50Y1tpXVtqXSAhPT0gMCkge1xuICAgICAgICAgICAgICAgIHRoaXMuYnVpbGRIdWZmVGFibGUoSHVmZlRhYltpXVtqXSwgdGhpcy5sW2ldW2pdLCB0aGlzLnZbaV1bal0pO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgfVxuXG4gICAgcmV0dXJuIDE7XG59O1xuXG5cblxuLy9cdEJ1aWxkX0h1ZmZUYWIoKVxu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DtcblxuICAgIGZvciAoaSA9IDg7IGkgPCAxNjsgaSs9MSkgeyAvLyBpKzEgaXMgQ29kZSBsZW5ndGhcbiAgICAgICAgZm9yIChqID0gMDsgaiA8IExbaV07IGorPTEpIHtcbiAgICAgICAgICAgIGZvciAobiA9IDA7IG4gPCAodGVtcCA+PiAoaSAtIDcpKTsgbis9MSkge1xuICAgICAgICAgICAgICAgIHRhYlsoY3VycmVudFRhYmxlICogMjU2KSArIGtdID0gVltpXVtqXSB8ICgoaSArIDEpIDw8IDgpO1xuICAgICAgICAgICAgICAgIGsrPTE7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIGlmIChrID49IDI1Nikge1xuICAgICAgICAgICAgICAgIGlmIChrID4gMjU2KSB7XG4gICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcihcIkVSUk9SOiBIdWZmbWFuIHRhYmxlIGVycm9yKDEpIVwiKTtcbiAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICBrID0gMDtcbiAgICAgICAgICAgICAgICBjdXJyZW50VGFibGUrPTE7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICB9XG59O1xuXG5cbi8qKiogRXhwb3J0cyAqKiovXG5cbnZhciBtb2R1bGVUeXBlID0gdHlwZW9mIG1vZHVsZTtcbmlmICgobW9kdWxlVHlwZSAhPT0gJ3VuZGVmaW5lZCcpICYmIG1vZHVsZS5leHBvcnRzKSB7XG4gICAgbW9kdWxlLmV4cG9ydHMgPSBqcGVnLmxvc3NsZXNzLkh1ZmZtYW5UYWJsZTtcbn1cbiIsIi8qanNsaW50IGJyb3dzZXI6IHRydWUsIG5vZGU6IHRydWUgKi9cbi8qZ2xvYmFsIHJlcXVpcmUsIG1vZHVsZSAqL1xuXG5cInVzZSBzdHJpY3RcIjtcblxuLyoqKiBJbXBvcnRzICoqKi9cbnZhciBqcGVnID0ganBlZyB8fCB7fTtcbmpwZWcubG9zc2xlc3MgPSBqcGVnLmxvc3Ns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RXJyb3IoXCJFUlJPUjogUXVhbnRpemF0aW9uIHRhYmxlIElEID4gM1wiKTtcbiAgICAgICAgfVxuXG4gICAgICAgIHRoaXMucHJlY2lzaW9uW3RdID0gdGVtcCA+PiA0O1xuXG4gICAgICAgIGlmICh0aGlzLnByZWNpc2lvblt0XSA9PT0gMCkge1xuICAgICAgICAgICAgdGhpcy5wcmVjaXNpb25bdF0gPSA4O1xuICAgICAgICB9IGVsc2UgaWYgKHRoaXMucHJlY2lzaW9uW3RdID09PSAxKSB7XG4gICAgICAgICAgICB0aGlzLnByZWNpc2lvblt0XSA9IDE2O1xuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKFwiRVJST1I6IFF1YW50aXphdGlvbiB0YWJsZSBwcmVjaXNpb24gZXJyb3JcIik7XG4gICAgICAgIH1cblxuICAgICAgICB0aGlzLnRxW3RdID0gMTtcblxuICAgICAgICBpZiAodGhpcy5wcmVjaXNpb25bdF0gPT09IDgpIHtcbiAgICAgICAgICAgIGZvciAoaSA9IDA7IGkgPCA2NDsgaSs9MSkge1xuICAgICAgICAgICAgICAgIGlmIChjb3VudCA+IGxlbmd0aCkge1xuICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoXCJFUlJPUjogUXVhbnRpemF0aW9uIHRhYmxlIGZvcm1hdCBlcnJvclwiKTtcbiAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICB0aGlzLnF1YW50VGFibGVzW3RdW2ldID0gZGF0YS5nZXQ4KCk7XG4gICAgICAgICAgICAgICAgY291bnQrPTE7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIGpwZWcubG9zc2xlc3MuUXVhbnRpemF0aW9uVGFibGUuZW5oYW5jZVF1YW50aXphdGlvblRhYmxlKHRoaXMucXVhbnRUYWJsZXNbdF0sIHRhYmxlKTtcbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgIGZvciAoaSA9IDA7IG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gLyogc3BlY2lhbCBjYXNlICovXG5cbiAgICAgICAgYSA9IDEuMCAvIE1hdGguc3FydChiICogYiArIGMgKiBjICsgZCAqIGQpO1xuICAgICAgICBiICo9IGE7XG4gICAgICAgIGMgKj0gYTtcbiAgICAgICAgZCAqPSBhOyAgICAgICAgLyogbm9ybWFsaXplIChiLGMsZCkgdmVjdG9yICovXG4gICAgICAgIGEgPSAwLjA7ICAgICAgICAgICAgICAgICAgICAgICAgLyogYSA9IDAgPT0+IDE4MCBkZWdyZWUgcm90YXRpb24gKi9cbiAgICB9IGVsc2Uge1xuXG4gICAgICAgIGEgPSBNYXRoLnNxcnQoYSk7ICAgICAgICAgICAgICAgICAgICAgLyogYW5nbGUgPSAyKmFyY2NvcyhhKSAqL1xuICAgIH1cblxuICAgIC8vIGxvYWQgcm90YXRpb24gbWF0cml4LCBpbmNsdWRpbmcgc2NhbGluZyBmYWN0b3JzIGZvciB2b3hlbCBzaXplc1xuICAgIHhkID0gKGR4ID4gMC4wKSA/IGR4IDogMS4wOyAgICAgICAvKiBtYWtlIHN1cmUgYXJlIHBvc2l0aXZlICovXG4gICAgeWQgPSAoZHkgPiAwLjApID8gZHkgOiAxLjA7XG4gICAgemQgPSAoZHogPiAwLjApID8gZHogOiAxLjA7XG5cbiAgICBpZiAocWZhYyA8IDAuMCkge1xuICAgICAgICB6ZCA9IC16ZDsgICAgICAgICAvKiBsZWZ0IGhhbmRlZG5lc3M/ICovXG4gICAgfVxuXG4gICAgUlswXVswXSA9ICAgICAgIChhICogYSArIGIgKiBiIC0gYyAqIGMgLSBkICogZCkgKiB4ZDtcbiAgICBSWzBdWzFdID0gMi4wICogKGIgKiBjIC0gYSAqIGQpICogeWQ7XG4gICAgUlswXVsyXSA9IDIuMCAqIChiICogZCArIGEgKiBjKSAqIHpkO1xuICAgIFJbMV1bMF0gPSAyLjAgKiAoYiAqIGMgKyBhICogZCkgKiB4ZDtcbiAgICBSWzFdWzFdID0gICAgICAgKGEgKiBhICsgYyAqI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uICAgIHZhbCA9IE1hdGguc3FydCh4aiAqIHhqICsgeWogKiB5aiArIHpqICogemopO1xuICAgIGlmICh2YWwgPT09IDAuMCkgeyAgLyogc3R1cGlkIGlucHV0ICovXG4gICAgICAgIHJldHVybiBudWxsO1xuICAgIH1cblxuICAgIHhqIC89IHZhbDtcbiAgICB5aiAvPSB2YWw7XG4gICAgemogLz0gdmFsO1xuXG4gICAgLyogb3J0aG9nb25hbGl6ZSBqIGF4aXMgdG8gaSBheGlzLCBpZiBuZWVkZWQgKi9cbiAgICB2YWwgPSB4aSAqIHhqICsgeWkgKiB5aiArIHppICogemo7ICAgIC8qIGRvdCBwcm9kdWN0IGJldHdlZW4gaSBhbmQgaiAqL1xuICAgIGlmIChNYXRoLmFicyh2YWwpID4gMS5FLTQpIHtcbiAgICAgICAgeGogLT0gdmFsICogeGk7XG4gICAgICAgIHlqIC09IHZhbCAqIHlpO1xuICAgICAgICB6aiAtPSB2YWwgKiB6aTtcbiAgICAgICAgdmFsID0gTWF0aC5zcXJ0KHhqICogeGogKyB5aiAqIHlqICsgemogKiB6aik7ICAvKiBtdXN0IHJlbm9ybWFsaXplICovXG4gICAgICAgIGlmICh2YWwgPT09IDAuMCkgeyAgICAgICAgICAgICAgLyogaiB3YXMgcGFyYWxsZWwgdG8gaT8gKi9cbiAgICAgICAgICAgIHJldHVybiBudWxsO1xuICAgICAgICB9XG4gICAgICAgIHhqIC89IHZhbDtcbiAgICAgICAgeWogLz0gdmFsO1xuICAgICAgICB6aiAvPSB2YWw7XG4gICAgfVxuXG4gICAgLyogbm9ybWFsaXplIGsgYXhpczsgaWYgaXQgaXMgemVybywgbWFrZSBpdCB0aGUgY3Jvc3MgcHJvZHVjdCBpIHggaiAqL1xuICAgIHZhbCA9IE1hdGguc3FydCh4ayAqIHhrICsgeWsgKiB5ayArIHprICogemspO1xuICAgIGlmICh2YWwgPT09IDAuMCkge1xuICAgICAgICB4ayA9IHlpICogemogLSB6aSAqIHlqO1xuICAgICAgICB5ayA9IHppICogeGogLSB6aiAqIHhpO1xuICAgICAgICB6ayA9IHhpICogeWogLSB5aSAqIHhqO1xuICAgIH0gZWxzZSB7XG4gICAgICAgIHhrIC89IHZhbDtcbiAgICAgICAgeWsgLz0gdmFsO1xuICAgICAgICB6ayAvPSB2YWw7XG4gICAgfVxuXG4gICAgLyogb3J0aG9nb25hbGl6ZSBrIHRvIGkgKi9cbiAgICB2YWwgPSB4aSAqIHhrICsgeWkgKiB5ayArIHppICogems7ICAgIC8qIGRvdCBwcm9kdWN0IGJldHdlZW4gaSBhbmQgayAqL1xuICAgIGlmIChNYXRoLmFicyh2YWwpID4gMS5FLTQpIHtcbiAgICAgICAgeGsgLT0gdmFsICogeGk7XG4gICAgICAgIHlrIC09IHZhbCAqIHlpO1xuICAgICAgICB6ayAtPSB2YWwgKiB6aTtcbiAgICAgICAgdmFsID0gTWF0aC5zcXJ0KHhrICogeGsgKyB5ayAqIHlrICsgemsgKiB6ayk7XG4gICAgICAgIGlmICh2YWwgPT09IDAuMCkgeyAgICAvKiBiYWQgKi9cbiAgICAgICAgICAgIHJldHVybiBudWxsO1xuICAgICAgICB9XG4gICAgICAgIHhrIC89IHZhbDtcbiAgICAgICAgeWsgLz0gdmFsO1xuICAgICAgICB6ayAvPSB2YWw7XG4gICAgfVxuXG4gICAgLyogb3J0aG9nb25hbGl6ZSBrIHRvIGogKi9cbiAgICB2YWwgPSB4aiAqIHhrICsgeWogKiB5ayArIHpqICogems7ICAgIC8qIGRvdCBwcm9kdWN0IGJldHdlZW4gaiBhbmQgayAqL1xuICAgIGlmIChNYXRoLmFicyh2YWwpID4gMS5lLTQpIHtcbiAgICAgICAgeGsgLT0gdmFsICogeGo7XG4gICAgICAgIHlrIC09IHZhbCAqIHlqO1xuICAgICAgICB6ayAtPSB2YWwgKiB6ajtcbiAgICAgICAgdmFsID0gTWF0aC5zcXJ0KHhrICogeGsgKyB5ayAqIHlrICsgemsgKiB6ayk7XG4gICAgICAgIGlmICh2YWwgPT09I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vbmx5IDMqMyozKjIqMioyID0gMjE2IHBhc3Nlcywgd2hpY2ggd2lsbCBydW4gdmVyeSBxdWlja2x5LiAqL1xuXG4gICAgdmJlc3QgPSAtNjY2LjA7XG4gICAgaWJlc3QgPSBwYmVzdCA9IHFiZXN0ID0gcmJlc3QgPSAxO1xuICAgIGpiZXN0ID0gMjtcbiAgICBrYmVzdCA9IDM7XG5cbiAgICBmb3IgKGkgPSAxOyBpIDw9IDM7IGkgKz0gMSkgeyAgICAgLyogaSA9IGNvbHVtbiBudW1iZXIgdG8gdXNlIGZvciByb3cgIzEgKi9cbiAgICAgICAgZm9yIChqID0gMTsgaiA8PSAzOyBqICs9IDEpIHsgICAgLyogaiA9IGNvbHVtbiBudW1iZXIgdG8gdXNlIGZvciByb3cgIzIgKi9cbiAgICAgICAgICAgIGlmIChpICE9PSBqKSB7XG4gICAgICAgICAgICAgICAgZm9yIChrID0gMTsgayA8PSAzOyBrICs9IDEpIHsgIC8qIGsgPSBjb2x1bW4gbnVtYmVyIHRvIHVzZSBmb3Igcm93ICMzICovXG4gICAgICAgICAgICAgICAgICAgIGlmICghKGkgPT09IGsgfHwgaiA9PT0gaykpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIFBbMF1bMF0gPSBQWzBdWzFdID0gUFswXVsyXSA9IFBbMV1bMF0gPSBQWzFdWzFdID0gUFsxXVsyXSA9IFBbMl1bMF0gPSBQWzJdWzFdID0gUFsyXVsyXSA9IDAuMDtcbiAgICAgICAgICAgICAgICAgICAgICAgIGZvciAocCA9IC0xOyBwIDw9IDE7IHAgKz0gMikgeyAgICAvKiBwLHEsciBhcmUgLTEgb3IgKzEgICAgICAqL1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAocSA9IC0xOyBxIDw9IDE7IHEgKz0gMikgeyAgIC8qIGFuZCBnbyBpbnRvIHJvd3MgIzEsMiwzICovXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAociA9IC0xOyByIDw9IDE7IHIgKz0gMikge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgUFswXVtpIC0gMV0gPSBwO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgUFsxXVtqIC0gMV0gPSBxO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgUFsyXVtrIC0gMV0gPSByO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGV0UCA9IHRoaXMubmlmdGlfbWF0MzNfZGV0ZXJtKFApOyAgICAgICAgICAgLyogc2lnbiBvZiBwZXJtdXRhdGlvbiAqL1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKChkZXRQICogZGV0USkgPiAwLjApIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBNID0gdGhpcy5uaWZ0aV9tYXQzM19tdWwoUCwgUSk7XG5cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiBhbmdsZSBvZiBNIHJvdGF0aW9uID0gMi4wKmFjb3MoMC41KnNxcnQoMS4wK3RyYWNlKE0pKSkgICAgICAgKi9cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiB3ZSB3YW50IGxhcmdlc3QgdHJhY2UoTSkgPT0gc21hbGxlc3QgYW5nbGUgPT0gTSBuZWFyZXN0IHRvIEkgKi9cblxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbCA9IE1bMF1bMF0gKyBNWzFdWzFdICsgTVsyXVsyXTsgLyogdHJhY2UgKi9cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodmFsID4gdmJlc3QpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmJlc3QgPSB2YWw7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGliZXN0ID0gaTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgamJlc3QgPSBqO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrYmVzdCA9IGs7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBiZXN0ID0gcDtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcWJlc3QgPSBxO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByYmVzdCA9IHI7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSAgLyogZG9lc24ndCBtYXRjaCBzaWduIG9mIFEgKi9cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgIH1cblxuICAgIC8qIEF0IHRoaXMgcG9pbnQgaWJlc3QgaXMgMSBvciAyIG9yIDM7IHBiZXN0IGlzIC0xIG9yICsxOyBldGMuXG5cbiAgICAgVGhlIG1hdHJpeCBQIHRoYXQgY29ycmVzcG9uZHMgaXMgdGhlIGJlc3QgcGVybXV0YXRpb24gYXBwcm94aW1hdGlvblxuICAgICB0byBRLWludmVyc2U7IHRoYXQgaXMsIFAgKGFwcHJveGltYXRlbHkpIHRha2VzICh4LHkseikgY29vcmRpbmF0ZXNcbiAgICAgdG8gdGhlIChpLGosaykgYXhlcy5cblxuICAgICBGb3IgZXhhbXBsZSwgdGhlIGZpcnN0IHJvdyBvZiBQICh3aGljaCBjb250YWlucyBwYmVzdCBpbiBjb2x1bW4gaWJlc3QpXG4gICAgIGRldGVybWluZXMgdGhlIH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SAnLSc7XG4gICAgICAgICAgICBicmVhaztcbiAgICAgICAgY2FzZSAzOiAvKmkgPSBOSUZUSV9JMlMqL1xuICAgICAgICAgICAgaUNoYXIgPSAnWic7XG4gICAgICAgICAgICBpU2Vuc2UgPSAnKyc7XG4gICAgICAgICAgICBicmVhaztcbiAgICAgICAgY2FzZSAtMzogLyppID0gTklGVElfUzJJKi9cbiAgICAgICAgICAgIGlDaGFyID0gJ1onO1xuICAgICAgICAgICAgaVNlbnNlID0gJy0nO1xuICAgICAgICAgICAgYnJlYWs7XG4gICAgfVxuXG4gICAgc3dpdGNoIChqYmVzdCAqIHFiZXN0KSB7XG4gICAgICAgIGNhc2UgMTogLypqID0gTklGVElfTDJSKi9cbiAgICAgICAgICAgIGpDaGFyID0gJ1gnO1xuICAgICAgICAgICAgalNlbnNlID0gJysnO1xuICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgIGNhc2UgLTE6IC8qaiA9IE5JRlRJX1IyTCovXG4gICAgICAgICAgICBqQ2hhciA9ICdYJztcbiAgICAgICAgICAgIGpTZW5zZSA9ICctJztcbiAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICBjYXNlIDI6IC8qaiA9IE5JRlRJX1AyQSovXG4gICAgICAgICAgICBqQ2hhciA9ICdZJztcbiAgICAgICAgICAgIGpTZW5zZSA9ICcrJztcbiAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICBjYXNlIC0yOiAvKmogPSBOSUZUSV9BMlAqL1xuICAgICAgICAgICAgakNoYXIgPSAnWSc7XG4gICAgICAgICAgICBqU2Vuc2UgPSAnLSc7XG4gICAgICAgICAgICBicmVhaztcbiAgICAgICAgY2FzZSAzOiAvKmogPSBOSUZUSV9JMlMqL1xuICAgICAgICAgICAgakNoYXIgPSAnWic7XG4gICAgICAgICAgICBqU2Vuc2UgPSAnKyc7XG4gICAgICAgICAgICBicmVhaztcbiAgICAgICAgY2FzZSAtMzogLypqID0gTklGVElfUzJJKi9cbiAgICAgICAgICAgIGpDaGFyID0gJ1onO1xuICAgICAgICAgICAgalNlbnNlID0gJy0nO1xuICAgICAgICAgICAgYnJlYWs7XG4gICAgfVxuXG4gICAgc3dpdGNoIChrYmVzdCAqIHJiZXN0KSB7XG4gICAgICAgIGNhc2UgMTogLyprID0gTklGVElfTDJSKi9cbiAgICAgICAgICAgIGtDaGFyID0gJ1gnO1xuICAgICAgICAgICAga1NlbnNlID0gJysnO1xuICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgIGNhc2UgLTE6IC8qayA9IE5JRlRJX1IyTCovXG4gICAgICAgICAgICBrQ2hhciA9ICdYJztcbiAgICAgICAgICAgIGtTZW5zZSA9ICctJztcbiAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICBjYXNlIDI6IC8qayA9IE5JRlRJX1AyQSovXG4gICAgICAgICAgICBrQ2hhciA9ICdZJztcbiAgICAgICAgICAgIGtTZW5zZSA9ICcrJztcbiAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICBjYXNlIC0yOiAvKmsgPSBOSUZUSV9BMlAqL1xuICAgICAgICAgICAga0NoYXIgPSAnWSc7XG4gICAgICAgICAgICBrU2Vuc2UgPSAnLSc7XG4gICAgICAgICAgICBicmVhaztcbiAgICAgICAgY2FzZSAzOiAvKmsgPSBOSUZUSV9JMlMqL1xuICAgICAgICAgICAga0NoYXIgPSAnWic7XG4gICAgICAgICAgICBrU2Vuc2UgPSAnKyc7XG4gICAgICAgICAgICBicmVhaztcbiAgICAgICAgY2FzZSAtMzogLyprID0gTklGVElfUzJJKi9cbiAgICAgICAgICAgIGtDaGFyID0gJ1onO1xuICAgICAgICAgICAga1NlbnNlID0gJy0nO1xuICAgICAgICAgICAgYnJlYWs7XG4gICAgfVxuXG4gICAgcmV0dXJuIChpQ2hhciArIGpDaGFyICsga0NoYXIgKyBpU2Vuc2UgKyBqU2Vuc2UgKyBrU2Vuc2UpO1xufTtcblxuXG5cbm5pZnRpLk5JRlRJMS5wcm90b3R5cGUubmlmdGlfbWF0MzNf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G4gICAgICAgIGNhc2UgXCJMQVNcIjpcbiAgICAgICAgICAgIHNwYWNlRGltZW5zaW9uID0gMztcbiAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICBjYXNlIFwibGVmdC1wb3N0ZXJpb3Itc3VwZXJpb3JcIjpcbiAgICAgICAgY2FzZSBcIkxQU1wiOlxuICAgICAgICAgICAgc3BhY2VEaW1lbnNpb24gPSAzO1xuICAgICAgICAgICAgYnJlYWs7XG4gICAgIFx0ICBjYXNlIFwicmlnaHQtYW50ZXJpb3Itc3VwZXJpb3ItdGltZVwiOlxuICAgICBcdCAgY2FzZSBcIlJBU1RcIjpcbiAgICAgXHQgICAgICBzcGFjZURpbWVuc2lvbiA9IDQ7XG4gICAgIFx0ICAgICAgYnJlYWs7XG4gICAgICAgIGNhc2UgXCJsZWZ0LWFudGVyaW9yLXN1cGVyaW9yLXRpbWVcIjpcbiAgICAgICAgY2FzZSBcIkxBU1RcIjpcbiAgICAgICAgICAgIHNwYWNlRGltZW5zaW9uID0gNDtcbiAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICBjYXNlIFwibGVmdC1wb3N0ZXJpb3Itc3VwZXJpb3ItdGltZVwiOlxuICAgICAgICBjYXNlIFwiTFBTVFwiOlxuICAgICAgICAgICAgc3BhY2VEaW1lbnNpb24gPSA0O1xuICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgIGNhc2UgXCJzY2FubmVyLXh5elwiOlxuICAgICAgICAgICAgc3BhY2VEaW1lbnNpb24gPSAzO1xuICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgIGNhc2UgXCJzY2FubmVyLXh5ei10aW1lXCI6XG4gICAgICAgICAgICBzcGFjZURpbWVuc2lvbiA9IDQ7XG4gICAgICAgICAgICBicmVhaztcbiAgICAgICAgY2FzZSBcIjNELXJpZ2h0LWhhbmRlZFwiOlxuICAgICAgICAgICAgc3BhY2VEaW1lbnNpb24gPSAzO1xuICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgIGNh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GlmIChtYXRjaFsyXSA9PSAnOiAnKSB7IC8vIEZpZWxkIHNwZWNpZmljYXRpb25cbiAgICAgICAgICAgIG1hdGNoWzFdID0gbWFwTlJSRFRvSmF2YXNjcmlwdChtYXRjaFsxXSk7XG4gICAgICAgICAgICBpZiAoIG1hdGNoWzFdID09ICdkYXRhRmlsZScgJiZcbiAgICAgICAgICAgICAgICAgKG1hdGNoMiA9IGRhdGFGaWxlTGlzdFJFLmV4ZWMobWF0Y2hbM10pKSkge1xuICAgICAgICAgICAgICAgIC8vIFRoaXMgc2hvdWxkIGJlIHRoZSBsYXN0IGZpZWxkIHNwZWNpZmljYXRpb24sXG4gICAgICAgICAgICAgICAgLy8gYW5kIHRoZSByZXN0IG9mIHRoZSBsaW5lcyBzaG91bGQgY29udGFpbiBmaWxlIG5hbWVzLlxuICAgICAgICAgICAgICAgIGlmIChtYXRjaDIubGVuZ3RoID09IDIgJiYgbWF0Y2gyWzFdKSB7IC8vIHN1YmRpbSBzcGVjaWZpY2F0aW9uXG4gICAgICAgICAgICAgICAgICAgIHJldFttYXRjaFsxXV0gPSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBmaWxlczogbGluZXMuc2xpY2UoaSsxKSxcbiAgICAgICAgICAgICAgICAgICAgICAgIHN1YmRpbTogcGFyc2VOUlJESW50ZWdlcihtYXRjaDJbMV0pXG4gICAgICAgICAgICAgICAgICAgIH07XG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgcmV0W21hdGNoWzFdXSA9IGxpbmVzLnNsaWNlKGkrMSk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGxpbmVzLmxlbmd0aCA9IGk7XG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIHJldFttYXRjaFsxXV0gPSBwYXJzZUZpZWxkKG1hdGNoWzFdLCBtYXRjaFszXSk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH0gZWxzZSBpZiAobW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ICAgICAgICAgICBjaGVja1NpemUoMSk7XG4gICAgICAgICAgICByZXR1cm4gbmV3IFVpbnQ4QXJyYXkoYnVmZmVyLnNsaWNlKDAsdG90YWxMZW4pKTtcbiAgICAgICAgY2FzZSBcImludDE2XCI6XG4gICAgICAgICAgICBjaGVja1NpemUoMik7XG4gICAgICAgICAgICByZXR1cm4gbmV3IEludDE2QXJyYXkoYnVmZmVyLnNsaWNlKDAsdG90YWxMZW4qMikpO1xuICAgICAgICBjYXNlIFwidWludDE2XCI6XG4gICAgICAgICAgICBjaGVja1NpemUoMik7XG4gICAgICAgICAgICByZXR1cm4gbmV3IFVpbnQxNkFycmF5KGJ1ZmZlci5zbGljZSgwLHRvdGFsTGVuKjIpKTtcbiAgICAgICAgY2FzZSBcImludDMyXCI6XG4gICAgICAgICAgICBjaGVja1NpemUoNCk7XG4gICAgICAgICAgICByZXR1cm4gbmV3IEludDMyQXJyYXkoYnVmZmVyLnNsaWNlKDAsdG90YWxMZW4qNCkpO1xuICAgICAgICBjYXNlIFwidWludDMyXCI6XG4gICAgICAgICAgICBjaGVja1NpemUoNCk7XG4gICAgICAgICAgICByZXR1cm4gbmV3IFVpbnQzMkFycmF5KGJ1ZmZlci5zbGljZSgwLHRvdGFsTGVuKjQpKTtcbiAgICAgICAgLy9jYXNlIFwiaW50NjRcIjpcbiAgICAgICAgLy8gICAgY2hlY2tTaXplKDgpO1xuICAgICAgICAvLyAgICByZXR1cm4gbmV3IEludDY0QXJyYXkoYnVmZmVyLnNsaWNlKDAsdG90YWxMZW4qOCkpO1xuICAgICAgICAvL2Nhc2UgXCJ1aW50NjRcIjpcbiAgICAgICAgLy8gICAgY2hlY2tTaXplKDgpO1xuICAgICAgICAvLyAgICByZXR1cm4gbmV3IFVpbnQ2NEFycmF5KGJ1ZmZlci5zbGljZSgwLHRvdGFsTGVuKjgpKTtcbiAgICAgICAgY2FzZSBcImZsb2F0XCI6XG4gICAgICAgICAgICBjaGVja1NpemUoNCk7XG4gICAgICAgIC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cuZ2V0IG1ldGhvZHMgc2hvdWxkIHRocm93IGFuIGV4Y2VwdGlvbiBpZiB3ZSByZWFkIGJleW9uZCB0aGUgYnVmZmVyLlxuICAgICAgICAgICAgYXJyID0gbmV3IEludDhBcnJheSh0b3RhbExlbik7XG4gICAgICAgICAgICBmb3IoaT0wOyBpPHRvdGFsTGVuOyBpKyspIHtcbiAgICAgICAgICAgICAgICBhcnJbaV0gPSB2aWV3LmdldEludDgoaSk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICByZXR1cm4gYXJyO1xuICAgICAgICBjYXNlIFwidWludDhcIjpcbiAgICAgICAgICAgIGFyciA9IG5ldyBVaW50OEFycmF5KHRvdGFsTGVuKTtcbiAgICAgICAgICAgIGZvcihpPTA7IGk8dG90YWxMZW47IGkrKykge1xuICAgICAgICAgICAgICAgIGFycltpXSA9IHZpZXcuZ2V0VWludDgoaSk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICByZXR1cm4gYXJyO1xuICAgICAgICBjYXNlIFwiaW50MTZcIjpcbiAgICAgICAgICAgIGFyciA9IG5ldyBJbnQxNkFycmF5KHRvdGFsTGVuKTtcbiAgICAgICAgICAgIGZvcihpPTA7IGk8dG90YWxMZW47IGkrKykge1xuICAgICAgICAgICAgICAgIGFycltpXSA9IHZpZXcuZ2V0SW50MTYoaSoyKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHJldHVybiBhcnI7XG4gICAgICAgIGNhc2UgXCJ1aW50MTZcIjpcbiAgICAgICAgICAgIGFyciA9IG5ldyBVaW50MTZBcnJheSh0b3RhbExlbik7XG4gICAgICAgICAgICBmb3IoaT0wOyBpPHRvdGFsTGVuOyBpKyspIHtcbiAgICAgICAgICAgICAgICBhcnJbaV0gPSB2aWV3LmdldFVpbnQxNihpKjIpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgcmV0dXJuIGFycjtcbiAgICAgICAgY2FzZSBcImludDMyXCI6XG4gICAgICAgICAgICBhcnIgPSBuZXcgSW50MzJBcnJheSh0b3RhbExlbik7XG4gICAgICAgICAgICBmb3IoaT0wOyBpPHRvdGFsTGVuOyBpKyspIHtcbiAgICAgICAgICAgICAgICBhcnJbaV0gPSB2aWV3LmdldEludDMyKGkqNCk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICByZXR1cm4gYXJyO1xuICAgICAgICBjYXNlIFwidWludDMyXCI6XG4gICAgICAgICAgICBhcnIgPSBuZXcgVWludDMyQXJyYXkodG90YWxMZW4pO1xuICAgICAgICAgICAgZm9yKGk9MDsgaTx0b3RhbExlbjsgaSsrKSB7XG4gICAgICAgICAgICAgICAgYXJyW2ldID0gdmlldy5nZXRVaW50MzIoaSo0KTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHJldHVybiBhcnI7XG4gICAgICAgIC8vY2FzZSBcImludDY0XCI6XG4gICAgICAgIC8vICAgIGFyciA9IG5ldyBJbnQ2NEFycmF5KHRvdGFsTGVuKTtcbiAgICAgICAgLy8gICAgZm9yKGk9MDsgaTx0b3RhbExlbjsgaSsrKSB7XG4gICAgICAgIC8vICAgICAgICBhcnJbaV0gPSB2aWV3LmdldEludDY0KGkqOCk7XG4gICAgICAgIC8vICAgIH1cbiAgICAgICAgLy8gICAgcmV0dXJuIGFycjtcbiAgICAgICAgLy9jYXNlIFwidWludDY0XCI6XG4gICAgICAgIC8vICAgIGFyciA9IG5ldyBVaW50NjRBcnJheSh0b3RhbExlbik7XG4gICAgICAgIC8vICAgIGZvcihpPTA7IGk8dG90YWxMZW47IGkrKykge1xuICAgICAgICAvLyAgICAgICAgYXJyW2ldID0gdmlldy5nZXRVaW50NjQoaSo4KTtcbiAgICAgICAgLy8gICAgfVxuICAgICAgICAvLyAgICByZXR1cm4gYXJyO1xuICAgICAgICBjYXNlIFwiZmxvYXRcIjpcbiAgICAgICAgICAgIGFyciA9IG5ldyBGbG9hdDMyQXJyYXkodG90YWxMZW4pO1xuICAgICAgICAgICAgZm9yKGk9MDsgaTx0b3R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JpbmdzICAgICAgPSByZXF1aXJlKCcuL3V0aWxzL3N0cmluZ3MnKTtcbnZhciBtc2cgICAgICAgICAgPSByZXF1aXJlKCcuL3psaWIvbWVzc2FnZXMnKTtcbnZhciBaU3RyZWFtICAgICAgPSByZXF1aXJlKCcuL3psaWIvenN0cmVhbScpO1xuXG52YXIgdG9TdHJpbmcgPSBPYmplY3QucHJvdG90eXBlLnRvU3RyaW5nO1xuXG4vKiBQdWJsaWMgY29uc3RhbnRzID09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0qL1xuLyogPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09Ki9cblxudmFyIFpfTk9fRkxVU0ggICAgICA9IDA7XG52YXIgWl9GSU5JU0ggICAgICAgID0gNDtcblxudmFyIFpfT0sgICAgICAgICAgICA9IDA7XG52YXIgWl9TVFJFQU1fRU5EICAgID0gMTtcbnZhciBaX1NZTkNfRkxVU0ggICAgPSAyO1xuXG52YXIgWl9ERUZBVUxUX0NPTVBSRVNTSU9OID0gLTE7XG5cbnZhciBaX0RFRkFVTFRfU1RSQVRFR1kgICAgPSAwO1xuXG52YXIgWl9ERUZMQVRFRCAgPSA4O1xuXG4vKiA9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0qL1xuXG5cbi8qKlxuICogY2xhc3MgRGVmbGF0ZVxuICpcbiAqIEdlbmVyaWMgSlMtc3R5bGUgd3JhcHBlciBmb3IgemxpYiBjYWxscy4gSWYgeW91IGRvbid0IG5lZWRcbiAqIHN0cmVhbWluZyBiZWhhdmlvdXIgLSB1c2UgbW9yZSBzaW1wbGUgZnVuY3Rpb25zOiBbW2RlZmxhdGVdXSxcbiAqIFtbZGVmbGF0ZVJhd11dIGFuZCBbW2d6aXBdXS5cbiAqKi9cblxuL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tNTtcbi8vdmFyIFpfVkVSU0lPTl9FUlJPUiA9IC02O1xuXG5cbi8qIGNvbXByZXNzaW9uIGxldmVscyAqL1xuLy92YXIgWl9OT19DT01QUkVTU0lPTiAgICAgID0gMDtcbi8vdmFyIFpfQkVTVF9TUEVFRCAgICAgICAgICA9IDE7XG4vL3ZhciBaX0JFU1RfQ09NUFJFU1NJT04gICAgPSA5O1xudmFyIFpfREVGQVVMVF9DT01QUkVTU0lPTiA9IC0xO1xuXG5cbnZhciBaX0ZJTFRFUkVEICAgICAgICAgICAgPSAxO1xudmFyIFpfSFVGRk1BTl9PTkxZICAgICAgICA9IDI7XG52YXIgWl9STEUgICAgICAgICAgICAgICAgID0gMztcbnZhciBaX0ZJWEVEICAgICAgICAgICAgICAgPSA0O1xudmFyIFpfREVGQVVMVF9TVFJBVEVHWSAgICA9IDA7XG5cbi8qIFBvc3NpYmxlIHZhbHVlcyBvZiB0aGUgZGF0YV90eXBlIGZpZWxkICh0aG91Z2ggc2VlIGluZmxhdGUoKSkgKi9cbi8vdmFyIFpfQklOQVJZICAgICAgICAgICAgICA9IDA7XG4vL3ZhciBaX1RFWFQgICAgICAgICAgICAgICAgPSAxO1xuLy92YXIgWl9BU0NJSSAgICAgICAgICAgICAgID0gMTsgLy8gPSBaX1RFWFRcbnZhciBaX1VOS05PV04gICAgICAgICAgICAgPSAyO1xuXG5cbi8qIFRoZSBkZWZsYXRlIGNvbXByZXNzaW9uIG1ldGhvZCAqL1xudmFyIFpfREVGTEFURUQgID0gODtcblxuLyo9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09Ki9cblxuXG52YXIgTUFYX01FTV9MRVZFTCA9IDk7XG4vKiBNYXhpbXVtIHZhbHVlIGZvciBtZW1MZXZlbCBpbiBkZWZsYXRlSW5pdDIgKi9cbnZhciBNQVhfV0JJVFMgPSAxNTtcbi8qIDMySyBMWjc3IHdpbmRvdyAqL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zaCA9PT0gWl9OT19GTFVTSCkge1xuICAgICAgICByZXR1cm4gQlNfTkVFRF9NT1JFO1xuICAgICAgfVxuICAgICAgaWYgKHMubG9va2FoZWFkID09PSAwKSB7IGJyZWFrOyB9IC8qIGZsdXNoIHRoZSBjdXJyZW50IGJsb2NrICovXG4gICAgfVxuXG4gICAgLyogU2VlIGhvdyBtYW55IHRpbWVzIHRoZSBwcmV2aW91cyBieXRlIHJlcGVhdHMgKi9cbiAgICBzLm1hdGNoX2xlbmd0aCA9IDA7XG4gICAgaWYgKHMubG9va2FoZWFkID49IE1JTl9NQVRDSCAmJiBzLnN0cnN0YXJ0ID4gMCkge1xuICAgICAgc2NhbiA9IHMuc3Ryc3RhcnQgLSAxO1xuICAgICAgcHJldiA9IF93aW5bc2Nhbl07XG4gICAgICBpZiAocHJldiA9PT0gX3dpblsrK3NjYW5dICYmIHByZXYgPT09IF93aW5bKytzY2FuXSAmJiBwcmV2ID09PSBfd2luWysrc2Nhbl0pIHtcbiAgICAgICAgc3RyZW5kID0gcy5zdHJzdGFydCArIE1BWF9NQVRDSDtcbiAgICAgICAgZG8ge1xuICAgICAgICAgIC8qanNoaW50IG5vZW1wdHk6ZmFsc2UqL1xuICAgICAgICB9IHdoaWxlIChwcmV2ID09PSBfd2luWysrc2Nhbl0gJiYgcHJldiA9PT0gX3dpblsrK3NjYW5dICYmXG4gICAgICAgICAgICAgICAgIHByZXYgPT09IF93aW5bKytzY2FuXSAmJiBwcmV2ID09PSBfd2luWysrc2Nhbl0gJiZcbiAgICAgICAgICAgICAgICAgcHJldiA9PT0gX3dpblsrK3NjYW5dICYmIHByZXYgPT09IF93aW5bKytzY2FuXSAmJlxuICAgICAgICAgICAgICAgICBwcmV2ID09PSBfd2luWysrc2Nhbl0gJiYgcHJldiA9PT0gX3dpblsrK3NjYW5dICYmXG4gICAgICAgICAgICAgICAgIHNjYW4gPCBzdHJlbmQpO1xuICAgICAgICBzLm1hdGNoX2xlbmd0aCA9IE1BWF9NQVR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k7ICoqKi9cbiAgICAgIGJmbHVzaCA9IHRyZWVzLl90cl90YWxseShzLCAwLCBzLndpbmRvd1tzLnN0cnN0YXJ0XSk7XG5cbiAgICAgIHMubG9va2FoZWFkLS07XG4gICAgICBzLnN0cnN0YXJ0Kys7XG4gICAgfVxuICAgIGlmIChiZmx1c2gpIHtcbiAgICAgIC8qKiogRkxVU0hfQkxPQ0socywgMCk7ICoqKi9cbiAgICAgIGZsdXNoX2Jsb2NrX29ubHkocywgZmFsc2UpO1xuICAgICAgaWYgKHMuc3RybS5hdmFpbF9vdXQgPT09IDApIHtcbiAgICAgICAgcmV0dXJuIEJTX05FRURfTU9SRTtcbiAgICAgIH1cbiAgICAgIC8qKiovXG4gICAgfVxuICB9XG4gIHMuaW5zZXJ0ID0gMDtcbiAgaWYgKGZsdXNoID09PSBaX0ZJTklTSCkge1xuICAgIC8qKiogRkxVU0hfQkxPQ0socywgMSk7ICoqKi9cbiAgICBmbHVzaF9ibG9ja19vbmx5KHMsIHRydWUpO1xuICAgIGlmIChzLnN0cm0uYXZhaWxfb3V0ID09PSAwKSB7XG4gICAgICByZXR1cm4gQlNfRklOSVNIX1NUQVJURUQ7XG4gICAgfVxuICAgIC8qKiovXG4gICAgcmV0dXJuIEJTX0ZJTklTSF9ET05FO1xuICB9XG4gIGlmIChzLmxhc3RfbGl0KSB7XG4gICAgLyoqKiBGTFVTSF9CTE9DSyhzLCAwKTsgKioqL1xuICAgIGZsdXNoX2Jsb2NrX29ubHkocywgZmFsc2UpO1xuICAgIGlmIChzLnN0cm0uYXZhaWxfb3V0ID09PSAwKSB7XG4gICAgICByZXR1cm4gQlNfTkVFRF9NT1JFO1xuICAgIH1cbiAgICAvKioqL1xuICB9XG4gIHJldHVybiBCU19CTE9DS19ET05FO1xufVxuXG4vKiA9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT1cbiAqIEZvciBaX0hVRkZNQU5fT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J5dGUocywgcy5sZXZlbCA9PT0gOSA/IDIgOlxuICAgICAgICAgICAgICAgICAgICAocy5zdHJhdGVneSA+PSBaX0hVRkZNQU5fT05MWSB8fCBzLmxldmVsIDwgMiA/XG4gICAgICAgICAgICAgICAgICAgICA0IDogMCkpO1xuICAgICAgICBwdXRfYnl0ZShzLCBPU19DT0RFKTtcbiAgICAgICAgcy5zdGF0dXMgPSBCVVNZX1NUQVRFO1xuICAgICAgfVxuICAgICAgZWxzZSB7XG4gICAgICAgIHB1dF9ieXRlKHMsIChzLmd6aGVhZC50ZXh0ID8gMSA6IDApICtcbiAgICAgICAgICAgICAgICAgICAgKHMuZ3poZWFkLmhjcmMgPyAyIDogMCkgK1xuICAgICAgICAgICAgICAgICAgICAoIXMuZ3poZWFkLmV4dHJhID8gMCA6IDQpICtcbiAgICAgICAgICAgICAgICAgICAgKCFzLmd6aGVhZC5uYW1lID8gMCA6IDgpICtcbiAgICAgICAgICAgICAgICAgICAgKCFzLmd6aGVhZC5jb21tZW50ID8gMCA6IDE2KVxuICAgICAgICAgICAgICAgICk7XG4gICAgICAgIHB1dF9ieXRlKHMsIHMuZ3poZWFkLnRpbWUgJiAweGZmKTtcbiAgICAgICAgcHV0X2J5dGUocywgKHMuZ3poZWFkLnRpbWUgPj4gOCkgJiAweGZmKTtcbiAgICAgICAgcHV0X2J5dGUocywgKHMuZ3poZWFkLnRpbWUgPj4gMTYpICYgMHhmZik7XG4gICAgICAgIHB1dF9ieXRlKHMsIChzLmd6aGVhZC50aW1lID4+IDI0KSAmIDB4ZmYpO1xuICAgICAgICBwdXRfYnl0ZShzLCBzLmxldmVsID09PSA5ID8gMiA6XG4gICAgICAgICAgICAgICAgICAgIChzLnN0cmF0ZWd5ID49IFpfSFVGRk1BTl9PTkxZIHx8IHMubGV2ZWwgPCAyID9cbiAgICAgICAgICAgICAgICAgICAgIDQgOiAwKSk7XG4gICAgICAgIHB1dF9ieXRlKHMsIHMuZ3poZWFkLm9zICYgMHhmZik7XG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uZGluZyAtIGJlZywgYmVnKTtcbiAgICAgICAgICB9XG4gICAgICAgICAgZmx1c2hfcGVuZGluZyhzdHJtKTtcbiAgICAgICAgICBiZWcgPSBzLnBlbmRpbmc7XG4gICAgICAgICAgaWYgKHMucGVuZGluZyA9PT0gcy5wZW5kaW5nX2J1Zl9zaXplKSB7XG4gICAgICAgICAgICB2YWwgPSAxO1xuICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIC8vIEpTIHNwZWNpZmljOiBsaXR0bGUgbWFnaWMgdG8gYWRkIHplcm8gdGVybWluYXRvciB0byBlbmQgb2Ygc3RyaW5nXG4gICAgICAgIGlmIChzLmd6aW5kZXggPCBzLmd6aGVhZC5uYW1lLmxlbmd0aCkge1xuICAgICAgICAgIHZhbCA9IHMuZ3poZWFkLm5hbWUuY2hhckNvZGVBdChzLmd6aW5kZXgrKykgJiAweGZmO1xuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgIHZhbCA9IDA7XG4gICAgICAgIH1cbiAgICAgICAgcHV0X2J5dGUocywgdmFsKTtcbiAgICAgIH0gd2hpbGUgKHZhbCAhPT0gMCk7XG5cbiAgICAgIGlmIChzLmd6aGVhZC5oY3JjICYmIHMucGVuZGluZyA+IGJlZykge1xuICAgICAgICBzdHJtLmFkbGVyID0gY3JjMzIoc3RybS5hZGxlciwgcy5wZW5kaW5nX2J1Ziwgcy5wZW5kaW5nIC0gYmVnLCBiZWcpO1xuICAgICAgfVxuICAgICAgaWYgKHZhbCA9PT0gMCkge1xuICAgICAgICBzLmd6aW5kZXggPSAwO1xuICAgICAgICBzLnN0YXR1cyA9IENPTU1FTlRfU1RBVEU7XG4gICAgICB9XG4gICAgfVxuICAgIGVsc2Uge1xuICAgICAgcy5zdGF0dXMgPSBDT01NRU5UX1NUQVRFO1xuICAgIH1cbiAgfVxuICBpZiAocy5zdGF0dXMgPT09IENPTU1FTlRfU1RBVEUpIHtcbiAgICBpZiAocy5nem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VfdGFibGUgPSByZXF1aXJlKCcuL2luZnRyZWVzJyk7XG5cbnZhciBDT0RFUyA9IDA7XG52YXIgTEVOUyA9IDE7XG52YXIgRElTVFMgPSAyO1xuXG4vKiBQdWJsaWMgY29uc3RhbnRzID09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0qL1xuLyogPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09Ki9cblxuXG4vKiBBbGxvd2VkIGZsdXNoIHZhbHVlczsgc2VlIGRlZmxhdGUoKSBhbmQgaW5mbGF0ZSgpIGJlbG93IGZvciBkZXRhaWxzICovXG4vL3ZhciBaX05PX0ZMVVNIICAgICAgPSAwO1xuLy92YXIgWl9QQVJUSUFMX0ZMVVNIID0gMTtcbi8vdmFyIFpfU1lOQ19GTFVTSCAgICA9IDI7XG4vL3ZhciBaX0ZVTExfRkxVU0ggICAgPSAzO1xudmFyIFpfRklOSVNIICAgICAgICA9IDQ7XG52YXIgWl9CTE9DSyAgICAgICAgID0gNTtcbnZhciBaX1RSRUVTICAgICAgICAgPSA2O1xuXG5cbi8qIFJldHVybiBjb2RlcyBmb3IgdGhlIGNvbXByZXNzaW9uL2RlY29tcHJlc3Npb24gZnVuY3Rpb25zLiBOZWdhdGl2ZSB2YWx1ZXNcbiAqIGFyZSBlcnJvcnMsIHBvc2l0aXZlIHZhbHVlcyBhcmUgdXNlZCBmb3Igc3BlY2lhbCBidXQgbm9ybWFsIGV2ZW50cy5cbiAqL1xudmFyIFpfT0sgICAgICAgICAgICA9IDA7XG52YXIgWl9TVFJFQU1fRU5EICAgID0gMTtcbnZhciBaX05FRURfRElDVCAgICAgPSAyO1xuLy92YXIgWl9FUlJOTyAgICAgICAgID0gLTE7XG52YXIgWl9TVFJFQU1fRVJST1IgID0gLTI7XG52YXIgWl9EQVRBX0VSUk9SICAgID0gLTM7XG52YXIgWl9NRU1fRVJST1IgICAgID0gLTQ7XG52YXIgWl9CVUZfRVJST1IgICAgID0gLTU7XG4vL3ZhciBaX1ZFUlNJT05fRVJST1IgPSAtNjtcblxuLyogVGhlIGRlZmxhdGUgY29tcHJlc3Npb24gbWV0aG9kICovXG52YXIgWl9ERUZMQVRFRCAgPSA4O1xuXG5cbi8qIFNUQVRFUyA9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PSovXG4vKiA9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0qL1xuXG5cbnZhciAgICBIRUFEID0gMTsgICAgICAgLyogaTogd2FpdGluZyBmb3IgbWFnaWMgaGVhZGVyICovXG52YXIgICAgRkxBR1MgPSAyOyAgICAgIC8qIGk6IHdhaXRpbmcgZm9yIG1ldGhvZCBhbmQgZmxhZ3MgKGd6aXApICovXG52YXIgICAgVElNRSA9IDM7ICAgICAgIC8qIGk6IHdhaXRpbmcgZm9yIG1vZGlmaWNhdGlvbiB0aW1lIChnemlwKSAqL1xudmFyICAgIE9TID0gNDsgICAgICAgICAvKiBpOiB3YWl0aW5nIGZvciBleHRyYSBmbGFncyBhbmQgb3BlcmF0aW5nIHN5c3RlbSAoZ3ppcCkgKi9cbnZhciAgICBFWExFTiA9IDU7ICAgICAgLyogaTogd2FpdGluZyBmb3IgZXh0cmEgbGVuZ3RoIChnemlwKSAqL1xudmFyICAgIEVYVFJBID0gNjsgICAgICAvKiBpOiB3YWl0aW5nIGZvciBleHRyYSBieXRlcyAoZ3ppcCkgKi9cbnZhciAgICBOQU1FID0gNzsgICAgICAgLyogaTogd2FpdGluZyBmb3IgZW5kIG9mIGZpbGUgbmFtZSAoZ3ppcCkgKi9cbnZhciAgICBDT01NRU5UID0gODsgICAgLyogaTogd2FpdGluZyBmb3IgZW5kIG9mIGNvbW1lbnQgKGd6aXApICovXG52YXIgICA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MRU47XG4gICAgICAvKiBmYWxscyB0aHJvdWdoICovXG4gICAgY2FzZSBFWExFTjpcbiAgICAgIGlmIChzdGF0ZS5mbGFncyAmIDB4MDQwMCkge1xuICAgICAgICAvLz09PSBORUVEQklUUygxNik7ICovXG4gICAgICAgIHdoaWxlIChiaXRzIDwgMTYpIHtcbiAgICAgICAgICBpZiAoaGF2ZSA9PT0gMCkgeyBicmVhayBpbmZfbGVhdmU7IH1cbiAgICAgICAgICBoYXZlLS07XG4gICAgICAgICAgaG9sZCArPSBpbnB1dFtuZXh0KytdIDw8IGJpdHM7XG4gICAgICAgICAgYml0cyArPSA4O1xuICAgICAgICB9XG4gICAgICAgIC8vPT09Ly9cbiAgICAgICAgc3RhdGUubGVuZ3RoID0gaG9sZDtcbiAgICAgICAgaWYgKHN0YXRlLmhlYWQpIHtcbiAgICAgICAgICBzdGF0ZS5oZWFkLmV4dHJhX2xlbiA9IGhvbGQ7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKHN0YXRlLmZsYWdzICYgMHgwMjAwKSB7XG4gICAgICAgICAgLy89PT0gQ1JDMihzdGF0ZS5jaGVjaywgaG9sZCk7XG4gICAgICAgICAgaGJ1ZlswXSA9IGhvbGQgJiAweGZmO1xuICAgICAgICAgIGhidWZbMV0gPSAoaG9sZCA+Pj4gOCkgJiAweGZmO1xuICAgICAgICAgIHN0YXRlLmNoZWNrID0gY3JjMzIoc3RhdGUuY2hlY2ssIGhidWYsIDIsIDApO1xuICAgICAgICAgIC8vPT09Ly9cbiAgICAgICAgfVxuICAgICAgICAvLz09PSBJTklUQklUUygpO1xuICAgICAgICBob2xkID0gMDtcbiAgICAgICAgYml0cyA9IDA7XG4gICAgICAgIC8vPT09Ly9cbiAgICAgIH1cbiAgICAgIGVsc2UgaWYgKHN0YXRlLmhlYWQpIHtcbiAgICAgICAgc3RhdGUuaGVhZC5leHRyYSA9IG51bGwvKlpfTlVMTCovO1xuICAgICAgfVxuICAgICAgc3RhdGUubW9kZSA9IEV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hdGUuaGVhZC5leHRyYSArIGxlbiwgbmV4dCxcbiAgICAgICAgICAgIC8vICAgICAgICBsZW4gKyBjb3B5ID4gc3RhdGUuaGVhZC5leHRyYV9tYXggP1xuICAgICAgICAgICAgLy8gICAgICAgIHN0YXRlLmhlYWQuZXh0cmFfbWF4IC0gbGVuIDogY29weSk7XG4gICAgICAgICAgfVxuICAgICAgICAgIGlmIChzdGF0ZS5mbGFncyAmIDB4MDIwMCkge1xuICAgICAgICAgICAgc3RhdGUuY2hlY2sgPSBjcmMzMihzdGF0ZS5jaGVjaywgaW5wdXQsIGNvcHksIG5leHQpO1xuICAgICAgICAgIH1cbiAgICAgICAgICBoYXZlIC09IGNvcHk7XG4gICAgICAgICAgbmV4dCArPSBjb3B5O1xuICAgICAgICAgIHN0YXRlLmxlbmd0aCAtPSBjb3B5O1xuICAgICAgICB9XG4gICAgICAgIGlmIChzdGF0ZS5sZW5ndGgpIHsgYnJlYWsgaW5mX2xlYXZlOyB9XG4gICAgICB9XG4gICAgICBzdGF0ZS5sZW5ndGggPSAwO1xuICAgICAgc3RhdGUubW9kZSA9IE5BTUU7XG4gICAgICAvKiBmYWxscyB0aHJvdWdoICovXG4gICAgY2FzZSBOQU1FOlxuICAgICAgaWYgKHN0YXRlLmZsYWdzICYgMHgwODAwKSB7XG4gICAgICAgIGlmIChoYXZlID09PSAwKSB7IGJyZWFrIGluZl9sZWF2ZTsgfVxuICAgICAgICBjb3B5ID0gMDtcbiAgICAgICAgZG8ge1xuICAgICAgICAgIC8vIFRPRE86IDIgb3IgMSBieXRlcz9cbiAgICAgICAgICBsZW4gPSBpbnB1dFtuZXh0ICsgY29weSsrXTtcbiAgICAgICAgICAvKiB1c2UgY29uc3RhbnQgbGltaXQgYmVjYXVzZSBpbiBqcyB3ZSBzaG91bGQgbm90IHByZWFsbG9jYXRlIG1lbW9yeSAqL1xuICAgICAgICAgIGlmIChzdGF0ZS5oZWFkICYmIGxlbiAmJlxuICAgICAgICAgICAgICAoc3Rhd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NtYXRjaCc7XG4gICAgICAgICAgc3RhdGUubW9kZSA9IEJBRDtcbiAgICAgICAgICBicmVhaztcbiAgICAgICAgfVxuICAgICAgICAvLz09PSBJTklUQklUUygpO1xuICAgICAgICBob2xkID0gMDtcbiAgICAgICAgYml0cyA9IDA7XG4gICAgICAgIC8vPT09Ly9cbiAgICAgIH1cbiAgICAgIGlmIChzdGF0ZS5oZWFkKSB7XG4gICAgICAgIHN0YXRlLmhlYWQuaGNyYyA9ICgoc3RhdGUuZmxhZ3MgPj4gOSkgJiAxKTtcbiAgICAgICAgc3RhdGUuaGVhZC5kb25lID0gdHJ1ZTtcbiAgICAgIH1cbiAgICAgIHN0cm0uYWRsZXIgPSBzdGF0ZS5jaGVjayA9IDA7XG4gICAgICBzdGF0ZS5tb2RlID0gVFlQRTtcbiAgICAgIGJyZWFrO1xuICAgIGNhc2UgRElDVElEOlxuICAgICAgLy89PT0gTkVFREJJVFMoMzIpOyAqL1xuICAgICAgd2hpbGUgKGJpdHMgPCAzMikge1xuICAgICAgICBpZiAoaGF2ZSA9PT0gMCkgeyBicmVhayBpbmZfbGVhdmU7IH1cbiAgICAgICAgaGF2ZS0tO1xuICAgICAgICBob2xkICs9IGlucHV0W25leHQrK10gPDwgYml0cztcbiAgICAgICAgYml0cyArPSA4O1xuICAgICAgfVxuICAgICAgLy89PT0vL1xuICAgICAgc3RybS5hZGxlciA9IHN0YXRlLmNoZWNrID0genN3YXAzMihob2xkKTtcbiAgICAgIC8vPT09IElOSVRCSVRTKCk7XG4gICAgICBob2xkID0gMDtcbiAgICAgIGJpdHMgPSAwO1xuICAgICAgLy89PT0vL1xuICAgICAgc3RhdGUubW9kZSA9IERJQ1Q7XG4gICAgICAvKiBmYWxscyB0aHJvdWdoICovXG4gICAgY2FzZSBESUNUOlxuICAgICAgaWYgKHN0YXRlLmhhdmVkaWN0ID09PSAwKSB7XG4gICAgICAgIC8vLS0tIFJFU1RPUkUoKSAtLS1cbiAgICAgICAgc3RybS5uZXh0X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xuICAgICAgICB9XG4gICAgICAgIGJyZWFrO1xuICAgICAgY2FzZSAyOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogZHluYW1pYyBibG9jayAqL1xuICAgICAgICAvL1RyYWNldigoc3RkZXJyLCBcImluZmxhdGU6ICAgICBkeW5hbWljIGNvZGVzIGJsb2NrJXNcXG5cIixcbiAgICAgICAgLy8gICAgICAgIHN0YXRlLmxhc3QgPyBcIiAobGFzdClcIiA6IFwiXCIpKTtcbiAgICAgICAgc3RhdGUubW9kZSA9IFRBQkxFO1xuICAgICAgICBicmVhaztcbiAgICAgIGNhc2UgMzpcbiAgICAgICAgc3RybS5tc2cgPSAnaW52YWxpZCBibG9jayB0eXBlJztcbiAgICAgICAgc3RhdGUubW9kZSA9IEJBRDtcbiAgICAgIH1cbiAgICAgIC8vLS0tIERST1BCSVRTKDIpIC0tLS8vXG4gICAgICBob2xkID4+Pj0gMjtcbiAgICAgIGJpdHMgLT0gMjtcbiAgICAgIC8vLS0tLy9cbiAgICAgIGJyZWFrO1xuICAgIGNhc2UgU1RPUkVEOlxuICAgICAgLy8tLS0gQllURUJJVFMoKSAtLS0vLyAvKiBnbyB0byBieXRlIGJvdW5kYXJ5ICovXG4gICAgICBob2xkID4+Pj0gYml0cyAmIDc7XG4gICAgICBiaXRzIC09IGJpdHMgJiA3O1xuICAgICAgLy8tLS0vL1xuICAgICAgLy89PT0gTkVFREJJVFMoMzIpOyAqL1xuICAgICAgd2hpbGUgKGJpdHMgPCAzMikge1xuICAgICAgICBpZiAoaGF2ZSA9PT0gMCkgeyBicmVhayBpbmZfbGVhdmU7IH1cbiAgICAgICAgaGF2ZS0tO1xuICAgICAgICBob2xkICs9IGlucHV0W25leHQrK10gPDwgYml0cztcbiAgICAgICAgYml0cyArPSA4O1xuICAgICAgfVxuICAgICAgLy89PT0vL1xuICAgICAgaWYgKChob2xkICYgMHhmZmZmKSAhPT0gKChob2xkID4+PiAxNikgXiAweGZmZmYpKSB7XG4gICAgICAg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B7XG4gICAgICAgICAgaGVyZSA9IHN0YXRlLmxlbmNvZGVbaG9sZCAmICgoMSA8PCBzdGF0ZS5sZW5iaXRzKSAtIDEpXTsvKkJJVFMoc3RhdGUubGVuYml0cykqL1xuICAgICAgICAgIGhlcmVfYml0cyA9IGhlcmUgPj4+IDI0O1xuICAgICAgICAgIGhlcmVfb3AgPSAoaGVyZSA+Pj4gMTYpICYgMHhmZjtcbiAgICAgICAgICBoZXJlX3ZhbCA9IGhlcmUgJiAweGZmZmY7XG5cbiAgICAgICAgICBpZiAoKGhlcmVfYml0cykgPD0gYml0cykgeyBicmVhazsgfVxuICAgICAgICAgIC8vLS0tIFBVTExCWVRFKCkgLS0tLy9cbiAgICAgICAgICBpZiAoaGF2ZSA9PT0gMCkgeyBicmVhayBpbmZfbGVhdmU7IH1cbiAgICAgICAgICBoYXZlLS07XG4gICAgICAgICAgaG9sZCArPSBpbnB1dFtuZXh0KytdIDw8IGJpdHM7XG4gICAgICAgICAgYml0cyArPSA4O1xuICAgICAgICAgIC8vLS0tLy9cbiAgICAgICAgfVxuICAgICAgICBpZiAoaGVyZV92YWwgPCAxNikge1xuICAgICAgICAgIC8vLS0tIERST1BCSVRTKGhlcmUuYml0cykgLS0tLy9cbiAgICAgICAgICBob2xkID4+Pj0gaGVyZV9iaXRzO1xuICAgICAgICAgIGJpdHMgLT0gaGVyZV9iaXRzO1xuICAgICAgICAgIC8vLS0tLy9cbiAgICAgICAgICBzdGF0ZS5sZW5zW3N0YXRlLmhhdmUrK10gPSBoZXJlX3ZhbDtcbiAgICAgICAgfVxuICAgICAgICBlbHNlIHtcbiAgICAgICAgICBpZiAoaGVyZV92YWwgPT09IDE2KSB7XG4gICAgICAgICAgICAvLz09PSBORUVEQklUUyhoZXJlLmJpdHMgKyAyKTtcbiAgICAgICAgICAgIG4gPSBoZXJlX2JpdHMgKyAyO1xuICAgICAgICAgICAgd2hpbGUgKGJpdHMgPCBuKSB7XG4gICAgICAgICAgICAgIGlmIChoYXZlID09PSAwKSB7IGJyZWFrIGluZl9sZWF2ZTsgfVxuICAgICAgICAgICAgICBoYXZlLS07XG4gICAgICAgICAgICAgIGhvbGQgKz0gaW5wdXRbbmV4dCsrXSA8PCBiaXRzO1xuICAgICAgICAgICAgICBiaXRzICs9IDg7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICAvLz09PS8vXG4gICAgICAgICAgICAvLy0tLSBEUk9QQklUUyhoZXJlLmJpdHMpIC0tLS8vXG4gICAgICAgICAgICBob2xkID4+Pj0gaGVyZV9iaXRzO1xuICAgICAgICAgICAgYml0cyAtPSBoZXJlX2JpdHM7XG4gICAgICAgICAgICAvLy0tLS8vXG4gICAgICAgICAgICBpZiAoc3RhdGUuaGF2ZSA9PT0gMCkge1xuICAgICAgICAgICAgICBzdHJtLm1zZyA9ICdpbnZhbGlkIGJpdCBsZW5ndGggcmVwZWF0JztcbiAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IEJBRDtcbiAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBsZW4gPSBzdGF0ZS5sZW5zW3N0YXRlLmhhdmUgLSAxXTtcbiAgICAgICAgICAgIGNvcHkgPSAzICsgKGhvbGQgJiAweDAzKTsvL0JJVFMoMik7XG4gICAgICAgICAgICAvLy0tLSBEUk9QQklUUygyKSAtLS0vL1xuICAgICAgICAgICAgaG9sZCA+Pj49IDI7XG4gICAgICAgICAgICBiaXRzIC09IDI7XG4gICAgICAgICAgICAvLy0tLS8vXG4gICAgICAgICAgfVxuICAgICAgICAgIGVsc2UgaWYgKGhlcmVfdmFsID09PSAxNykge1xuICAgICAgICAgICAgLy89PT0gTkVFREJJVFMoaGVyZS5iaXRzICsgMyk7XG4gICAgICAgICAgICBuID0gaGVyZV9iaXRzICsgMztcbiAgICAgICAgICAgIHdoaWxlIChiaXRzIDwgbikge1xuICAgICAgICAgICAgICBpZiAoaGF2ZSA9PT0gMCkgeyBicmVhayBpbmZfbGVhdmU7IH1cbiAgICAgICAgICAgICAgaGF2ZS0tO1xuICAgICAgICAgICAgICBob2xkICs9IGlucHV0W25leHQrK10gPDwgYml0cztcbiAgICAgICAgICAgICAgYml0cyArPSA4O1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgLy89PT0vL1xuICAgICAgICAgICAgLy8tLS0gRFJPUEJJVFMoaGVyZS5iaXRzKSAtLS0vL1xuICAgICAgICAgICAgaG9sZCA+Pj49IGhlcmVfYml0cztcbiAgICAgICAgICAgIGJpdHMgLT0gaGVyZV9iaXRzO1xuICAgICAgICAgICAgLy8tLS0vL1xuICAgICAgICAgICAgbGVuID0gMDtcbiAgICAgICAgICAgIGNvcHkgPSAzICsgKGhvbGQgJiAweDA3KTsvL0JJVFMoMyk7XG4gICAgICAgICAgICAvLy0tLSBEUk9QQklUUygzKSAtLS0vL1xuICAgICAgICAgICAgaG9sZCA+Pj49IDM7XG4gICAgICAgICAgICBiaXRzIC09IDM7XG4gICAgICAgICAgICAvLy0tLS8vXG4gICAgICAgICAgfVxuICAgICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgLy89PT0gTkVFREJJVFMoaGVyZS5iaXRzICsgNyk7XG4gICAgICAgICAgICBuID0gaGVyZV9iaXRzICsgNztcbiAgICAgICAgICAgIHdoaWxlIChiaXRzIDwgbikge1xuICAgICAgICAgICAgICBpZiAoaGF2ZSA9PT0gMCkgeyBicmVhayBpbmZfbGVhdmU7IH1cbiAgICAgICAgICAgICAgaGF2ZS0tO1xuICAgICAgICAgICAgICBob2xkICs9IGlucHV0W25leHQrK10gPDwgYml0cztcbiAgICAgICAgICAgICAgYml0cyArPSA4O1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgLy89PT0vL1xuICAgICAgICAgICAgLy8tLS0gRFJPUEJJVFMoaGVyZS5iaXRzKSAtLS0vL1xuICAgICAgICAgICAgaG9sZCA+Pj49IGhlcmVfYml0cztcbiAgICAgICAgICAgIGJpdHMgLT0gaGVyZV9iaXRzO1xuICAgICAgICAgICAgLy8tLS0vL1xuICAgICAgICAgICAgbGVuID0gMDtcbiAgICAgICAgICAgIGNvcHkgPSAxMSArIChob2xkICYgMHg3Zik7Ly9CSVRTKDcpO1xuICAgICAgICAgICAgLy8tLS0gRFJPUEJJVFMoNykgLS0tLy9cbiAgICAgICAgICAgIGhvbGQgPj4+PSA3O1xuICAgICAgICAgICAgYml0cyAtPSA3O1xuICAgICAgICAgICAgLy8tLS0vL1xuICAgICAgICAgIH1cbiAgICAgICAgICBpZiAoc3RhdGUuaGF2ZSArIGNvcHkgPiBzdGF0ZS5ubGVuICsgc3RhdGUubmRpc3QpIHtcbiAgICAgICAgICAgIHN0cm0ubXNnID0gJ2ludmFsaWQgYml0IGxlbmd0aCByZXBlYXQnO1xuICAgICAgICAgICAgc3RhdGUubW9kZSA9IEJBRDtcbiAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgIH1cbiAgICAgICAgICB3aGlsZSAoY29weS0tKSB7XG4gICAgICAgICAgICBzdGF0ZS5sZW5zW3N0YXRlLmhhdmUrK10gPSBsZW47XG4gICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICB9XG5cbiAgICAgIC8qIGhhbmRsZSBlcnJvciBicmVha3MgaW4gd2hpbGUgKi9cbiAgICAgIGlmIChzdGF0ZS5tb2RlID09PSBCQUQpIHsgYnJlYWs7IH1cblxuICAgICAgLyogY2hlY2sgZm9yIGVuZC1vZi1ibG9jayBjb2RlIChiZXR0ZXIgaGF2ZSBvbmUpICovXG4gICAgICBpZiAoc3RhdGUubGVuc1syNTZdID09PSAwKSB7XG4gICAgICAgIHN0cm0ubXNnID0gJ2ludmFsaWQgY29kZSAtLSBtaXNzaW5nIGVuZC1vZi1ibG9jayc7XG4gICAgICAgIHN0YXRlLm1vZGUgPSBCQUQ7XG4gICAgICAgIGJyZWFrO1xuICAgICAgfVxuXG4gICAgICAvKiBidWlsZCBjb2RlIHRhYmxlcyAtLSBub3RlOiBkbyBub3QgY2hhbmdlIHRoZSBsZW5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OyAvKiB0YWJsZSBlbnRyeSBmb3IgZHVwbGljYXRpb24gKi9cblxuICB2YXIgbGVuID0gMDsgICAgICAgICAgICAgICAvKiBhIGNvZGUncyBsZW5ndGggaW4gYml0cyAqL1xuICB2YXIgc3ltID0gMDsgICAgICAgICAgICAgICAvKiBpbmRleCBvZiBjb2RlIHN5bWJvbHMgKi9cbiAgdmFyIG1pbiA9IDAsIG1heCA9IDA7ICAgICAgICAgIC8qIG1pbmltdW0gYW5kIG1heGltdW0gY29kZSBsZW5ndGhzICovXG4gIHZhciByb290ID0gMDsgICAgICAgICAgICAgIC8qIG51bWJlciBvZiBpbmRleCBiaXRzIGZvciByb290IHRhYmxlICovXG4gIHZhciBjdXJyID0gMDsgICAgICAgICAgICAgIC8qIG51bWJlciBvZiBpbmRleCBiaXRzIGZvciBjdXJyZW50IHRhYmxlICovXG4gIHZhciBkcm9wID0gMDsgICAgICAgICAgICAgIC8qIGNvZGUgYml0cyB0byBkcm9wIGZvciBzdWItdGFibGUgKi9cbiAgdmFyIGxlZnQgPSAwOyAgICAgICAgICAgICAgICAgICAvKiBudW1iZXIgb2YgcHJlZml4IGNvZGVzIGF2YWlsYWJsZSAqL1xuICB2YXIgdXNlZCA9IDA7ICAgICAgICAgICAgICAvKiBjb2RlIGVudHJpZXMgaW4gdGFibGUgdXNlZCAqL1xuICB2YXIgaHVmZiA9IDA7ICAgICAgICAgICAgICAvKiBIdWZmbWFuIGNvZGUgKi9cbiAgdmFyIGluY3I7ICAgICAgICAgICAgICAvKiBmb3IgaW5jcmVtZW50aW5nIGNvZGUsIGluZGV4ICovXG4gIHZhciBmaWxsOyAgICAgICAgICAgICAgLyogaW5kZXggZm9yIHJlcGxpY2F0aW5nIGVudHJpZXMgKi9cbiAgdmFyIGxvdzsgICAgICAgICAgICAgICAvKiBsb3cgYml0cyBmb3IgY3VycmVudCByb290IGVudHJ5ICovXG4gIHZhciBtYXNrOyAgICAgICAgICAgICAgLyogbWFzayBmb3IgbG93IHJvb3Q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Q7XG4gIG9wdHMuYml0cyA9IHJvb3Q7XG4gIHJldHVybiAwO1xufTtcbiIsIid1c2Ugc3RyaWN0JztcblxubW9kdWxlLmV4cG9ydHMgPSB7XG4gIDI6ICAgICAgJ25lZWQgZGljdGlvbmFyeScsICAgICAvKiBaX05FRURfRElDVCAgICAgICAyICAqL1xuICAxOiAgICAgICdzdHJlYW0gZW5kJywgICAgICAgICAgLyogWl9TVFJFQU1fRU5EICAgICAgMSAgKi9cbiAgMDogICAgICAnJywgICAgICAgICAgICAgICAgICAgIC8qIFpfT0sgICAgICAgICAgICAgIDAgICovXG4gICctMSc6ICAgJ2ZpbGUgZXJyb3InLCAgICAgICAgICAvKiBaX0VSUk5PICAgICAgICAgKC0xKSAqL1xuICAnLTInOiAgICdzdHJlYW0gZXJyb3InLCAgICAgICAgLyogWl9TVFJFQU1fRVJST1IgICgtMikgKi9cbiAgJy0zJzogICAnZGF0YSBlcnJvcicsICAgICAgICAgIC8qIFpfREFUQV9FUlJPUiAgICAoLTMpICovXG4gICctNCc6ICAgJ2luc3VmZmljaWVudCBtZW1vcnknLCAvKiBaX01FTV9FUlJPUiAgICAgKC00KSAqL1xuICAnLTUnOiAgICdidWZmZXIgZXJyb3InLCAgICAgICAgLyogWl9CVUZfRVJST1IgICAgICgtNSkgKi9cbiAgJy02JzogICAnaW5jb21wYXRpYmxlIHZlcnNpb24nIC8qIFpfVkVSU0lPTl9FUlJPUiAoLTYpICovXG59O1xuIiwiJ3VzZSBzdHJpY3QnO1xuXG5cbnZhciB1dGlscyA9IHJlcXVpcmUoJy4uL3V0aWxzL2NvbW1vbicpO1xuXG4vKiBQdWJsaWMgY29uc3RhbnRzID09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0qL1xuLyogPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09Ki9cblxuXG4vL3ZhciBaX0ZJTFRFUkVEICAgICAgICAgID0gMTtcbi8vdmFyIFpfSFVGRk1BTl9PTkxZICAgICAgPSAyO1xuLy92YXIgWl9STEUgICAgICAgICAgICAgICA9IDM7XG52YXIgWl9GSVhFRCAgICAgICAgICAgICAgID0gNDtcbi8vdmFyIFpfREVGQVVMVF9TVFJBVEVHWSAgPSAwO1xuXG4vKiBQb3NzaWJsZSB2YWx1ZXMgb2YgdGhlIGRhdGFfdHlwZSBmaWVsZCAodGhvdWdoIHNlZSBpbmZsYXRlKCkpICovXG52YXIgWl9CSU5BUlkgICAgICAgICAgICAgID0gMDtcbnZhciBaX1RFWFQgICAgICAgICAgICAgICAgPSAxO1xuLy92YXIgWl9BU0NJSSAgICAgICAgICAgICA9IDE7IC8vID0gWl9URVhUXG52YXIgWl9VTktOT1dOICAgICAgICAgICAgID0gMjtcblxuLyo9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09Ki9cblxuXG5mdW5jdGlvbiB6ZXJvKGJ1ZikgeyB2YXIgbGVuID0gYnVmLmxlbmd0aDsgd2hpbGUgKC0tbGVuID49IDApIHsgYnVmW2xlbl0gPSAwOyB9IH1cblxuLy8gRnJvbSB6dXRpbC5oXG5cbnZhciBTVE9SRURfQkxPQ0sgPSAwO1xudmFyIFNUQVRJQ19UUkVFUyA9IDE7XG52YXIgRFlOX1RSRUVTICAgID0gMjtcbi8qIFRoZSB0aHJlZSBraW5kcyBvZiBibG9jayB0eXBlICovXG5cbnZhciBNSU5fTUFUQ0ggICAgPSAzO1xudmFyIE1BWF9NQVRDSCAgICA9IDI1ODtcbi8qIFRoZSBtaW5pbXVtIGFuZCBtYXhpbXVtIG1hdGNoIGxlbmd0aHMgKi9cblxuLy8gRnJvbSBkZWZsYXRlLmhcbi8qID09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PV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ZWVEZXNjKHN0YXRpY19kdHJlZSwgZXh0cmFfZGJpdHMsIDAsICAgICAgICAgIERfQ09ERVMsIE1BWF9CSVRTKTtcbiAgc3RhdGljX2JsX2Rlc2MgPSBuZXcgU3RhdGljVHJlZURlc2MobmV3IEFycmF5KDApLCBleHRyYV9ibGJpdHMsIDAsICAgICAgICAgQkxfQ09ERVMsIE1BWF9CTF9CSVRTKTtcblxuICAvL3N0YXRpY19pbml0X2RvbmUgPSB0cnVlO1xufVxuXG5cbi8qID09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PVxuICogSW5pdGlhbGl6ZSBhIG5ldyBibG9jay5cbiAqL1xuZnVuY3Rpb24gaW5pdF9ibG9jayhzKSB7XG4gIHZhciBuOyAvKiBpdGVyYXRlcyBvdmVyIHRyZWUgZWxlbWVudHMgKi9cblxuICAvKiBJbml0aWFsaXplIHRoZSB0cmVlcy4gKi9cbiAgZm9yIChuID0gMDsgbiA8IExfQ09ERVM7ICBuKyspIHsgcy5keW5fbHRyZWVbbiAqIDJdLyouRnJlcSovID0gMDsgfVxuICBmb3IgKG4gPSAwOyBuIDwgRF9DT0RFUzsgIG4rKykgeyBzLmR5bl9kdHJlZVtuICogMl0vKi5GcmVxKi8gPSAwOyB9XG4gIGZvciAobiA9IDA7IG4gPCBCTF9DT0RFUzsgbisrKSB7IHMuYmxfdHJlZVtuICogMl0vKi5GcmVxKi8gPSAwOyB9XG5cbiAgcy5keW5fbHRyZWVbRU5EX0JMT0NLICogMl0vKi5GcmVxKi8gPSAxO1xuICBzLm9wdF9sZW4gPSBzLnN0YXRpY19sZW4gPSAwO1xuICBzLmxhc3RfbGl0ID0gcy5tYXRjaGVzID0gMDtcbn1cblxuXG4vKiA9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT1cbiAqIEZsdXNoIHRoZSBi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iAoKytjb3VudCA8IG1heF9jb3VudCAmJiBjdXJsZW4gPT09IG5leHRsZW4pIHtcbiAgICAgIGNvbnRpbnVlO1xuXG4gICAgfSBlbHNlIGlmIChjb3VudCA8IG1pbl9jb3VudCkge1xuICAgICAgcy5ibF90cmVlW2N1cmxlbiAqIDJdLyouRnJlcSovICs9IGNvdW50O1xuXG4gICAgfSBlbHNlIGlmIChjdXJsZW4gIT09IDApIHtcblxuICAgICAgaWYgKGN1cmxlbiAhPT0gcHJldmxlbikgeyBzLmJsX3RyZWVbY3VybGVuICogMl0vKi5GcmVxKi8rKzsgfVxuICAgICAgcy5ibF90cmVlW1JFUF8zXzYgKiAyXS8qLkZyZXEqLysrO1xuXG4gICAgfSBlbHNlIGlmIChjb3VudCA8PSAxMCkge1xuICAgICAgcy5ibF90cmVlW1JFUFpfM18xMCAqIDJdLyouRnJlcSovKys7XG5cbiAgICB9IGVsc2Uge1xuICAgICAgcy5ibF90cmVlW1JFUFpfMTFfMTM4ICogMl0vKi5GcmVxKi8rKztcbiAgICB9XG5cbiAgICBjb3VudCA9IDA7XG4gICAgcHJldmxlbiA9IGN1cmxlbjtcblxuICAgIGlmIChuZXh0bGVuID09PSAwKSB7XG4gICAgICBtYXhfY291bnQgPSAxMzg7XG4gICAgICBtaW5fY291bnQgPSAzO1xuXG4gICAgfSBlbHNlIGlmIChjdXJsZW4gPT09IG5leHRsZW4pIHtcbiAgICAgIG1heF9jb3VudCA9IDY7XG4gICAgICBtaW5fY291bnQgPSAzO1xuXG4gICAgfSBlbHNlIHtcbiAgICAgIG1heF9jb3VudCA9IDc7XG4gICAgICBtaW5fY291bnQgPSA0O1xuICAgIH1cbiAgfVxufVxuXG5cbi8qID09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PVxuICogU2VuZCBhIGxpdGVyYWwgb3IgZGlzdGFuY2UgdHJlZSBpbiBjb21wcmVzc2VkIGZvcm0sI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XG4gICAgY3VybGVuID0gbmV4dGxlbjtcbiAgICBuZXh0bGVuID0gdHJlZVsobiArIDEpICogMiArIDFdLyouTGVuKi87XG5cbiAgICBpZiAoKytjb3VudCA8IG1heF9jb3VudCAmJiBjdXJsZW4gPT09IG5leHRsZW4pIHtcbiAgICAgIGNvbnRpbnVlO1xuXG4gICAgfSBlbHNlIGlmIChjb3VudCA8IG1pbl9jb3VudCkge1xuICAgICAgZG8geyBzZW5kX2NvZGUocywgY3VybGVuLCBzLmJsX3RyZWUpOyB9IHdoaWxlICgtLWNvdW50ICE9PSAwKTtcblxuICAgIH0gZWxzZSBpZiAoY3VybGVuICE9PSAwKSB7XG4gICAgICBpZiAoY3VybGVuICE9PSBwcmV2bGVuKSB7XG4gICAgICAgIHNlbmRfY29kZShzLCBjdXJsZW4sIHMuYmxfdHJlZSk7XG4gICAgICAgIGNvdW50LS07XG4gICAgICB9XG4gICAgICAvL0Fzc2VydChjb3VudCA+PSAzICYmIGNvdW50IDw9IDYsIFwiIDNfNj9cIik7XG4gICAgICBzZW5kX2NvZGUocywgUkVQXzNfNiwgcy5ibF90cmVlKTtcbiAgICAgIHNlbmRfYml0cyhzLCBjb3VudCAtIDMsIDIpO1xuXG4gICAgfSBlbHNlIGlmIChjb3VudCA8PSAxMCkge1xuICAgICAgc2VuZF9jb2RlKHMsIFJFUFpfM18xMCwgcy5ibF90cmVlKTtcbiAgICAgIHNlbmRfYml0cyhzLCBjb3VudCAtIDMsIDMpO1xuXG4gICAgfSBlbHNlIHtcbiAgICAgIHNlbmRfY29kZShzLCBSRVBaXzExXzEzOCwgcy5ibF90cmVlKTtcbiAgICAgIHNlbmRfYml0cyhzLCBjb3VudCAtIDExLCA3KTtcbiAgICB9XG5cbiAgICBjb3VudCA9IDA7XG4gICAgcHJldmxlbiA9IGN1cmxlbjtcbiAgICBpZiAobmV4dGxlbiA9PT0gMCkge1xuICAgICAgbWF4X2NvdW50ID0gMTM4O1xuICAgICAgbWluX2NvdW50ID0gMzt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IF96b29tU3RhcnQuY29weShnZXRNb3VzZU9uU2NyZWVuKGV2ZW50LnRvdWNoZXNbIDAgXS5wYWdlWCwgZXZlbnQudG91Y2hlc1sgMCBdLnBhZ2VZKSk7XG4gICAgICAgICAgICAgIF96b29tRW5kLmNvcHkoX3pvb21TdGFydCk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBicmVhaztcblxuICAgICAgICAgIGNhc2UgMjpcbiAgICAgICAgICBjYXNlIDU6XG4gICAgICAgICAgICBpZiAoZXZlbnQudG91Y2hlcy5sZW5ndGggPj0gMikge1xuICAgICAgICAgICAgICBfc3RhdGUgPSBTVEFURS5UT1VDSF9QQU47XG4gICAgICAgICAgICAgIHZhciB4ID0gKGV2ZW50LnRvdWNoZXNbIDAgXS5wYWdlWCArIGV2ZW50LnRvdWNoZXNbIDEgXS5wYWdlWCkgLyAyO1xuICAgICAgICAgICAgICB2YXIgeSA9IChldmVudC50b3VjaGVzWyAwIF0ucGFnZVkgKyBldmVudC50b3VjaGVzWyAxIF0ucGFnZVkpIC8gMjtcbiAgICAgICAgICAgICAgX3BhblN0YXJ0LmNvcHkoZ2V0TW91c2VPblNjcmVlbih4LCB5KSk7XG4gICAgICAgICAgICAgIF9wYW5FbmQuY29weShfcGFuU3RhcnQpO1xuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgX3N0YXRlID0gU1RBVEUuUEFOO1xuICAgICAgICAgICAgICBfcGFuU3RhcnQuY29weShnZXRNb3VzZU9uU2NyZWVuKGV2ZW50LnRvdWNoZXNbIDAgXS5wYWdlWCwgZXZlbnQudG91Y2hlc1sgMCBdLnBhZ2VZKSk7XG4gICAgICAgICAgICAgIF9wYW5FbmQuY29weShfcGFuU3RhcnQpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgYnJlYWs7XG5cbiAgICAgICAgICBjYXNlIDk5OlxuICAgICAgICAgICAgX3N0YXRlID0gU1RBVEUuQ1VTVE9NO1xuICAgICAgICAgICAgdmFyIHggPSAoZXZlbnQudG91Y2hlc1sgMCBdLnBhZ2VYICsgZXZlbnQudG91Y2hlc1sgMSBdLnBhZ2VYKSAvIDI7XG4gICAgICAgICAgICB2YXIgeSA9IChldmVudC50b3VjaGVzWyAwIF0ucGFnZVkgKyBldmVudC50b3VjaGVzWyAxIF0ucGFnZVkpIC8gMjtcbiAgICAgICAgICAgIF9jdXN0b21TdGFydC5jb3B5KGdldE1vdXNlT25TY3JlZW4oeCwgeSkpO1xuICAgICAgICAgICAgX2N1c3RvbUVuZC5jb3B5KF9jdXN0b21TdGFydCk7XG4gICAgICAgICAgICBicmVhaztcblxuICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICBfc3RhdGUgPSBTVEFURS5OT05FO1xuXG4gICAgICAgIH1cbiAgICAgIH1cblxuICAgICAgX3RoaXMuZGlzcGF0Y2hFdmVudChzdGFydEV2ZW50KTtcblxuICAgIH1cblxuICAgIGZ1bmN0aW9uIHRvdWNobW92ZShldmVudCkge1xuXG4gICAgICBpZiAoX3RoaXMuZW5hYmxlZCA9PT0gZmFsc2UpIHJldHVybjtcblxuICAgICAgZXZlbnQucHJldmVudERlZmF1bHQoKTtcbiAgICAgIGV2ZW50LnN0b3BQcm9wYWdhdGlvbigpO1xuXG4gICAgICBpZiAoX3RoaXMuZm9yY2VTdGF0ZSA9PT0gLTEpIHtcblxuICAgICAgICBzd2l0Y2ggKGV2ZW50LnRvdWNoZXMubGVuZ3RoKSB7XG5cbiAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICBfbW92ZVByZXYuY29weShfbW92ZUN1cnIpO1xuICAgICAgICAgICAgX21vdmVDdXJyLmNvcHkoZ2V0TW91c2VPbkNpcmNsZShldmVudC50b3VjaGVzWyAwIF0ucGFnZVgsIGV2ZW50LnRvdWNoZXNbIDAgXS5wYWdlWSkpO1xuICAgICAgICAgICAgYnJlYWs7XG5cbiAgICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgICB2YXIgZHggPSBldmVudC50b3VjaGVzWyAwIF0ucGFnZVggLSBldmVudC50b3VjaGVzWyAxIF0ucGFnZVg7XG4gICAgICAgICAgICB2YXIgZHkgPSBldmVudC50b3VjaGVzWyAwIF0ucGFnZVkgLSBldmVudC50b3VjaGVzWyAxIF0ucGFnZVk7XG4gICAgICAgICAgICBfdG91Y2hab29tRGlzdGFuY2VFbmQgPSBNYXRoLnNxcnQoZHggKiBkeCArIGR5ICogZHkpO1xuXG4gICAgICAgICAgICB2YXIgeCA9IChldmVudC50b3VjaGVzWyAwIF0ucGFnZVggKyBldmVudC50b3VjaGVzWyAxIF0ucGFnZVgpIC8gMjtcbiAgICAgICAgICAgIHZhciB5ID0gKGV2ZW50LnRvdWNoZXNbIDAgXS5wYWdlWSArIGV2ZW50LnRvdWNoZXNbIDEgXS5wYWdlWSkgLyAyO1xuICAgICAgICAgICAgX3BhbkVuZC5jb3B5KGdldE1vdXNlT25TY3JlZW4oeCwgeSkpO1xuICAgICAgICAgICAgYnJlYWs7XG5cbiAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgX3N0YXRlID0gU1RBVEUuTk9ORTtcbiAgICAgICAgfVxuXG4gICAgICB9IGVsc2Uge1xuICAgICAgICAvL3sgTk9ORTogLTEsIFJPVEFURTogMCwgWk9PTTogMSwgUEFOOiAyLCBUT1VDSF9ST1RBVEU6IDMsIFRPVUNIX1pPT01fUEFOOiA0LCBDVVNUT006IDk5IH07XG4gICAgICAgIHN3aXRjaCAoX3N0YXRlKSB7XG5cbiAgICAgICAgICBjYXNlIDA6XG4gICAgICAgICAgICBfbW92ZVByZXYuY29weShfbW92ZUN1cnIpO1xuICAgICAgICAgICAgX21vdmVDdXJyLmNvcHkoZ2V0TW91c2VPbkNpcmNsZShldmVudC50b3VjaGVzWyAwIF0ucGFnZVgsIGV2ZW50LnRvdWNoZXNbIDAgXS5wYWdlWSkpO1xuICAgICAgICAgICAgYnJlYWs7XG5cbiAgICAgICAgICBjYXNlIDE6XG4gICAgICAg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PblNjcmVlbih4LCB5KSk7XG4gICAgICAgICAgICBicmVhaztcblxuICAgICAgICAgIGNhc2UgOTk6XG4gICAgICAgICAgICB2YXIgeCA9IChldmVudC50b3VjaGVzWyAwIF0ucGFnZVggKyBldmVudC50b3VjaGVzWyAxIF0ucGFnZVgpIC8gMjtcbiAgICAgICAgICAgIHZhciB5ID0gKGV2ZW50LnRvdWNoZXNbIDAgXS5wYWdlWSArIGV2ZW50LnRvdWNoZXNbIDEgXS5wYWdlWSkgLyAyO1xuICAgICAgICAgICAgX2N1c3RvbUVuZC5jb3B5KGdldE1vdXNlT25TY3JlZW4oeCwgeSkpO1xuICAgICAgICAgICAgYnJlYWs7XG5cbiAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgX3N0YXRlID0gU1RBVEUuTk9ORTtcblxuICAgICAgICB9XG4gICAgICB9XG5cbiAgICB9XG5cbiAgICBmdW5jdGlvbiB0b3VjaGVuZChldmVudCkge1xuXG4gICAgICBpZiAoX3RoaXMuZW5hYmxlZCA9PT0gZmFsc2UpIHJldHVybjtcblxuICAgICAgaWYgKF90aGlzLmZvcmNlU3RhdGUgPT09IC0xKSB7XG4gICAgICAgIHN3aXRjaCAoZXZlbnQudG91Y2hlcy5sZW5ndGgpIHtcblxuICAgICAgICAgIGNhc2UgMTpcbiAgICAgICAgICAgIF9tb3ZlUHJldi5jb3B5KF9tb3ZlQ3Vycik7XG4gICAgICAgICAgICBfbW92ZUN1cnIuY29weShnZXRNb3VzZU9uQ2lyY2xlKGV2ZW50LnRvdWNoZXNbIDAgXS5wYWdlWCwgZXZlbnQudG91Y2hlc1sgMCBdLnBhZ2VZKSk7XG4gICAgICAgICAgICBicmVhaztcblxuICAgICAgICAgIGNhc2UgMjpcbiAgICAgICAgICAgIF90b3VjaFpvb21EaXN0YW5jZVN0YXJ0ID0gX3RvdWNoWm9vbURpc3RhbmNlRW5kID0gMDtcblxuICAgICAgICAgICAgdmFyIHggPSAoZXZlbnQudG91Y2hlc1sgMCBdLnBhZ2VYICsgZXZlbnQudG91Y2hlc1sgMSBdLnBhZ2VYKSAvIDI7XG4gICAgICAgICAgICB2YXIgeSA9IChldmVudC50b3VjaGVzWyAwIF0ucGFnZVkgKyBldmVudC50b3VjaGVzWyAxIF0ucGFnZVkpIC8gMjtcbiAgICAgICAgICAgIF9wYW5FbmQuY29weShnZXRNb3VzZU9uU2NyZWVuKHgsIHkpKTtcbiAgICAgICAgICAgIF9wYW5TdGFydC5jb3B5KF9wYW5FbmQpO1xuICAgICAgICAgICAgYnJlYWs7XG5cbiAgICAgICAgfVxuXG4gICAgICAgIF9zdGF0ZSA9IFNUQVRFLk5PTkU7XG5cbiAgICAgIH0gZWxzZSB7XG4gICAgICAgIHN3aXRjaCAoX3N0YXRlKSB7XG5cbiAgICAgICAgICBjYXNlIDA6XG4gICAgICAgICAgICBfbW92ZVByZXYuY29weShfbW92ZUN1cnIpO1xuICAgICAgICAgICAgX21vdmVDdXJyLmNvcHkoZ2V0TW91c2VPbkNpcmNsZShldmVudC50b3VjaGVzWyAwIF0ucGFnZVgsIGV2ZW50LnRvdWNoZXNbIDAgXS5wYWdlWSkpO1xuICAgICAgICAgICAgYnJlYWs7XG5cbiAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgY2FzZSAyOlxuICAgICAgICAgICAgYnJlYWs7XG5cbiAgICAgICAgICBjYXNlIDQ6XG4gICAgICAgICAgICAvLyBUT1VDSCBaT09NXG4gICAgICAgICAgICBfdG91Y2hab29tRGlzdGFuY2VTdGFydCA9IF90b3VjaFpvb21EaXN0YW5jZUVuZCA9IDA7XG4gICAgICAgICAgICBfc3RhdGUgPSBTVEFURS5aT09NO1xuICAgICAgICAgICAgYnJlYWs7XG5cbiAgICAgICAgICBjYXNlIDU6XG4gICAgICAgICAgICAvLyBUT1VDSCBaT09NXG4gICAgICAgICAgICBpZiAoZXZlbnQudG91Y2hlcy5sZW5ndGggPj0gMikge1xuICAgICAgICAgICAgICB2YXIgeCA9IChldmVudC50b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ICAgICAgICBfcGFuRW5kLmNvcHkoZ2V0TW91c2VPblNjcmVlbih4LCB5KSk7XG4gICAgICAgICAgYnJlYWs7XG5cbiAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICBfc3RhdGUgPSBTVEFURS5OT05FO1xuXG4gICAgICB9XG5cbiAgICB9XG5cbiAgICBmdW5jdGlvbiB0b3VjaGVuZChldmVudCkge1xuXG4gICAgICBpZiAoX3RoaXMuZW5hYmxlZCA9PT0gZmFsc2UpIHJldHVybjtcblxuICAgICAgc3dpdGNoIChldmVudC50b3VjaGVzLmxlbmd0aCkge1xuXG4gICAgICAgIGNhc2UgMTpcbiAgICAgICAgXG4gICAgICAgICAgYnJlYWs7XG5cbiAgICAgICAgY2FzZSAyOlxuICAgICAgICAgIF90b3VjaFpvb21EaXN0YW5jZVN0YXJ0ID0gX3RvdWNoWm9vbURpc3RhbmNlRW5kID0gMDtcblxuICAgICAgICAgIHZhciB4ID0gKGV2ZW50LnRvdWNoZXNbIDAgXS5wYWdlWCArIGV2ZW50LnRvdWNoZXNbIDEgXS5wYWdlWCkgLyAyO1xuICAgICAgICAgIHZhciB5ID0gKGV2ZW50LnRvdWNoZXNbIDAgXS5wYWdlWSArIGV2ZW50LnRvdWNoZXNbIDEgXS5wYWdlWSkgLyAyO1xuICAgICAgICAgIF9wYW5FbmQuY29weShnZXRNb3VzZU9uU2NyZWVuKHgsIHkpKTtcbiAgICAgICAgICBfcGFuU3RhcnQuY29weShfcGFuRW5kKTtcbiAgICAgICAgICBicmVhaztcblxuICAgICAgfVxuXG4gICAgICBfc3RhdGUgPSBTVEFURS5OT05FO1xuICAgICAgX3RoaXMuZGlzcGF0Y2hFdmVudChlbmRFdmVudCk7XG5cbiAgICB9XG5cbiAgICBmdW5jdGlvbiBjb250ZXh0bWVudShldmVudCkge1xuXG4gICAgICBldmVudC5wcmV2ZW50RGVmYXVsdCgpO1xuXG4gICAgfVxuXG4gICAgdGhpcy5kaXNwb3NlID0gZnVuY3Rpb24o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sIHBsYW5lQUFCQiwgYmJveCwgaW50ZXJzZWN0aW9ucyk7XG5cbiAgICAvLyBSQVlTIFNUQVJUSU5HIEZST00gVEhFIFNFQ09ORCBDT1JORVJcbiAgICAvL1xuICAgIC8vICAgICAgICAgICAgICAgK1xuICAgIC8vICAgICAgICAgICAgICAgfFxuICAgIC8vICAgICAgICAgICAgICAgfFxuICAgIC8vICAgICAgICAgICAgICAgfFxuICAgIC8vICAgICAgICAgICAgICAgK1xuICAgIC8vICAgICAgICAgICAgIC4nXG4gICAgLy8gICAgICAgICAgICsnXG5cbiAgICBsZXQgcmF5MyA9IHRoaXMucG9zZGlyKFxuICAgICAgbmV3IFRIUkVFLlZlY3RvcjMoYWFiYi5jZW50ZXIueCArIGFhYmIuaGFsZkRpbWVuc2lvbnMueCwgYWFiYi5jZW50ZXIueSAtIGFhYmIuaGFsZkRpbWVuc2lvbnMueSwgYWFiYi5jZW50ZXIueiAtIGFhYmIuaGFsZkRpbWVuc2lvbnMueiksXG4gICAgICBvcmllbnRhdGlvbi55XG4gICAgKTtcbiAgICB0aGlzLnJheVBsYW5lSW5CQm94KHJheTMsIHBsYW5lQUFCQiwgYmJveCwgaW50ZXJzZWN0aW9ucyk7XG5cbiAgICByYXkzLmRpcmVjdGlvbiA9IG9yaWVudGF0aW9uLno7XG4gICAgdGhpcy5yYXlQbGFuZUluQkJveChyYXkzLCBwbGFuZUFBQkIsIGJib3gsIGludGVyc2VjdGlvbnMpO1xuXG4gICAgLy8gUkFZUyBTVEFSVElORyBGUk9NIFRIRSBUSElSRCBDT1JORVJcbiAgICAvL1xuICAgIC8vICAgICAgListLS0tLS0tKyAgXG4gICAgLy8gICAgLidcbiAgICAvLyAgICtcbiAgICAvLyAgIFxuICAgIC8vICAgXG4gICAgLy8gICBcbiAgICAvLyAgIFxuXG4gICAgbGV0IHJheTQgPSB0aGlzLnBvc2RpcihcbiAgICAgIG5ldyBUSFJFRS5WZWN0b3IzKGFhYmIuY2VudGVyLnggLSBhYWJ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0dXJuIGludGVyc2VjdGlvbjtcblxuICB9XG5cbiAgcmV0dXJuIG51bGw7XG5cbn1cblxuICBzdGF0aWMgcmF5Qm94KHJheSwgYm94KSB7XG4gICAgLy8gc2hvdWxkIGFsc28gZG8gdGhlIHNwYWNlIHRyYW5zZm9ybXMgaGVyZVxuICAgIC8vIHJheToge3Bvc2l0aW9uLCBkaXJlY3Rpb259XG4gICAgLy8gYm94OiB7aGFsZkRpbWVuc2lvbnMsIGNlbnRlcn1cblxuICAgIGxldCBpbnRlcnNlY3Rpb25zID0gW107XG4gICAgXG4gICAgbGV0IGJib3ggPSBVdGlscy5iYm94KGJveC5jZW50ZXIsIGJveC5oYWxmRGltZW5zaW9ucyk7XG5cbiAgICAvLyB3aW5kb3cuY29uc29sZS5sb2coYmJveCk7XG5cbiAgICAvLyBYIG1pblxuICAgIGxldCBwbGFuZSA9IHRoaXMucG9zZGlyKFxuICAgICAgbmV3IFRIUkVFLlZlY3RvcjMoXG4gICAgICAgIGJib3gubWluLngsXG4gICAgICAgIGJveC5jZW50ZXIueSxcbiAgICAgICAgYm94LmNlbnRlci56KSxcbiAgICAgIG5ldyBUSFJFRS5WZWN0b3IzKC0xLCAwLCAwKVxuICAgICk7XG4gICAgdGhpcy5yYXlQbGFuZUluQkJveChyYXksIHBsYW5lLCBiYm94LCBpbnRlcnNlY3Rpb25zKTtcblxuICAgIC8vIFggbWF4XG4gICAgcGxhbmUgPSB0aGlzLnBvc2RpcihcbiAgICAgIG5ldyBUSFJFRS5WZWN0b3IzKFxuICAgICAgICBiYm94Lm1heC54LFxuICAgICAgICBib3guY2VudGVyLnksXG4gICAgICAgIGJveC5jZW50ZXIueiksXG4gICAgICBuZXcgVEhSRUUuVmVjdG9yMygxLCAwLCAwKVxuICAgICk7XG4gICAgdGhpcy5yYXlQbGFuZUluQkJveChyYXksIHBsYW5lLCBiYm94LCBpbnRlcnNlY3Rpb25zKTtcblxuICAgIC8vIFkgbWluXG4gICAgcGxhbmUgPSB0aGlzLnBvc2RpcihcbiAgICAgIG5ldyBUSFJFRS5WZWN0b3IzKFxuICAgICAgICBib3guY2VudGVyLngsXG4gICAgICAgIGJib3gubWluLnksXG4gICAgICAgIGJveC5jZW50ZXIueiksXG4gICAgICBuZXcgVEhSRUUuVmVjdG9yMygwLCAtMSwgMClcbiAgICApO1xuICAgIHRoaXMucmF5UGxhbmVJbkJCb3gocmF5LCBwbGFuZSwgYmJveCwgaW50ZXJzZWN0aW9ucyk7XG5cbiAgICAvLyBZIG1heFxuICAgIHBsYW5lID0gdGhpcy5wb3NkaXIoXG4gICAgICBuZXcgVEhSRUUuVmVjdG9yMyhcbiAgICAgICAgYm94LmNlbnRlci54LFxuICAgICAgICBiYm94Lm1heC55LFxuICAgICAgICBib3guY2VudGVyLnopLFxuICAgICAgbmV3IFRIUkVFLlZlY3RvcjMoMCwgMSwgMClcbiAgICApO1xuICAgIHRoaXMucmF5UGxhbmVJbkJCb3gocmF5LCBwbGFuZSwgYmJveCwgaW50ZXJzZWN0aW9ucyk7XG5cbiAgICAvLyBaIG1pblxuICAgIHBsYW5lID0gdGhpcy5wb3NkaXIoXG4gICAgICBuZXcgVEhSRUUuVmVjdG9yMyhcbiAgICAgICAgYm94LmNlbnRlci54LFxuICAgICAgICBib3guY2VudGVyLnksXG4gICAgICAgIGJib3gubWluLnopLFxuICAgICAgbmV3IFRIUkVFLlZlY3RvcjMoMCwgMCwgLTEpXG4gICAgKTtcbiAgICB0aGlzLnJheVBsYW5lSW5CQm94KHJheSwgcGxhbmUsIGJib3gsIGludGVyc2VjdGlvbnMpO1xuXG4gICAgLy8gWiBtYXhcbiAgICBwbGFuZSA9IHRoaXMucG9zZGlyKFxuICAgICAgbmV3IFRIUkVFLlZlY3RvcjMoXG4gICAgICAgIGJveC5jZW50ZXIueCxcbiAgICAgICAgYm94LmNlbnRlci55LFxuICAgICAgICBiYm94Lm1heC56KSxcbiAgICAgIG5ldyBUSFJFRS5WZWN0b3IzKDAsIDAsIDEpXG4gICAgK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MEZGJztcbiAgICAvLyBqdXN0IHZpc3VhbGl6YXRpb25cbiAgICAvLyB0aGlzLl9zdmdQb2ludGVyID0gJzxzdmcgd2lkdGg9XCI0MFwiIGhlaWdodD1cIjQwXCIgXFxcbiAgICAvLyAgICAgIHZpZXdCb3g9XCIwIDAgMTQwIDE0MFwiIHZlcnNpb249XCIxLjFcIiBcXFxuICAgIC8vICAgICAgeG1sbnM9XCJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2Z1wiPiBcXFxuICAgIC8vICAgXFxcbiAgICAvLyAgICAgPHBvbHlsaW5lIHBvaW50cz1cIjEwLDcwIFxcXG4gICAgLy8gICAgICAgICAgICAgICAgICAgICAgIDcwLDEwIFxcXG4gICAgLy8gICAgICAgICAgICAgICAgICAgICAgIDEzMCw3MFwiIC8+XFxcbiAgICAvLyAgIFxcXG4gICAgLy8gICA8L3N2Zz4nO1xuICAgIC8qanNoaW50IG11bHRpc3RyOiB0cnVlICovXG4gICAgdGhpcy5fc3ZnUG9pbnRlciA9ICc8c3ZnIHdpZHRoPVwiNDBcIiBoZWlnaHQ9XCI0MFwiIFxcXG4gICAgICAgICAgICAgICAgICAgICAgdmlld0JveD1cIjAgMCAxNDAgMTQwXCIgdmVyc2lvbj1cIjEuMVwiIFxcXG4gICAgICAgICAgICAgICAgICAgICAgeG1sbnM9XCJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2Z1wiPiBcXFxuICAgICAgICAgICAgICAgICAgICAgIFxcXG4gICAgICAgICAgICAgICAgICAgICAgPHBhdGggZD1cIk03MCw3MCBcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEwzMCwzMCBcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEExMCwxMCAwIDEgMSAxMCwxMFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQTEwLDEwIDAgMSAxIDMwLDMwXCIgLz5cXFxuICAgICAgICAgICAgICAgICAgICAgIFxcXG4gICAgICAgICAgIC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MpO1xuICAgIHJldHVybiBjZW50ZXI7XG5cbiAgfVxuXG4gIHdvcmxkQm91bmRpbmdCb3goKSB7XG5cbiAgICBsZXQgYmJveCA9IFtcbiAgICAgIE51bWJlci5NQVhfVkFMVUUsIE51bWJlci5NSU5fVkFMVUUsXG4gICAgICBOdW1iZXIuTUFYX1ZBTFVFLCBOdW1iZXIuTUlOX1ZBTFVFLFxuICAgICAgTnVtYmVyLk1BWF9WQUxVRSwgTnVtYmVyLk1JTl9WQUxVRVxuICAgIF07XG5cbiAgICBmb3IgKCBsZXQgaSA9IDA7IGkgPD0gdGhpcy5fZGltZW5zaW9uc0lKSy54OyBpICs9IHRoaXMuX2RpbWVuc2lvbnNJSksueCApIHtcbiAgICAgIGZvciAoIGxldCBqID0gMDsgaiA8PSB0aGlzLl9kaW1lbnNpb25zSUpLLnk7IGogKz0gdGhpcy5fZGltZW5zaW9uc0lKSy55ICkge1xuICAgICAgICBmb3IgKGxldCBrID0gMDsgayA8PSB0aGlzLl9kaW1lbnNpb25zSUpLLno7IGsgKz0gdGhpcy5fZGltZW5zaW9uc0lKSy56ICkge1xuXG4gICAgICAgICAgbGV0IHdvcmxkID0gbmV3IFRIUkVFLlZlY3RvcjMoIGksIGosIGsgKS5hcHBseU1hdHJpeDQoIHRoaXMuX2lqazJMUFMgKTtcbiAgICAgICAgICBiYm94ID0gW1xuICAgICAgICAgICAgTWF0aC5taW4oYmJveFswXSwgd29ybGQueCksIE1hdGgubWF4KGJib3hbMV0sIHdvcmxkLngpLCAvLyB4IG1pbi9tYXhcbiAgICAgICAgICAgIE1hdGgubWluKGJib3hbMl0sIHdvcmxkLnkpLCBNYXRoLm1heChiYm94WzNdLCB3b3JsZC55KSxcbiAgICAgICAgICAgIE1hdGgubWluKGJib3hbNF0sIHdvcmxkLnopLCBNYXRoLm1heChiYm94WzVdLCB3b3JsZC56KVxuICAgICAgICAgICAgXTtcblxuICAgICAgICB9XG5cbiAgICAgIH1cblxuICAgIH1cblxuICAgIHJld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ICAgbmV3QXJyYXlbaW5kZXhdID0gdGFyZ2V0QnVmZmVyW2ldICYgMHgwMDAxO1xuICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIGNhc2UgMTpcbiAgICAgICAgICAgICAgbmV3QXJyYXlbaW5kZXhdID0gdGFyZ2V0QnVmZmVyW2ldID4+PiAxICYgMHgwMDAxO1xuICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIGNhc2UgMjpcbiAgICAgICAgICAgICAgbmV3QXJyYXlbaW5kZXhdID0gdGFyZ2V0QnVmZmVyW2ldID4+PiAyICYgMHgwMDAxO1xuICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIGNhc2UgMzpcbiAgICAgICAgICAgICAgbmV3QXJyYXlbaW5kZXhdID0gdGFyZ2V0QnVmZmVyW2ldID4+PiAzICYgMHgwMDAxO1xuICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIGNhc2UgNDpcbiAgICAgICAgICAgICAgbmV3QXJyYXlbaW5kZXhdID0gdGFyZ2V0QnVmZmVyW2ldID4+PiA0ICYgMHgwMDAxO1xuICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIGNhc2UgNTpcbiAgICAgICAgICAgICAgbmV3QXJyYXlbaW5kZXhdID0gdGFyZ2V0QnVmZmVyW2ldID4+PiA1ICYgMHgwMDAxO1xuICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIGNhc2UgNjpcbiAgICAgICAgICAgICAgbmV3QXJyYXlbaW5kZXhdID0gdGFyZ2V0QnVmZmVyW2ldID4+PiA2ICYgMHgwMDAxO1xuICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIGNhc2UgNzpcbiAgICAgICAgICAgICAgbmV3QXJyYXlbaW5kZXhdID0gdGFyZ2V0QnVmZmVyW2ldID4+PiA3ICYgMHgwMDAxO1xuICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgIH1cblxuICAgICAgICAgIGJpdFN0YXJ0T2Zmc2V0Kys7XG4gICAgICAgICAgaW5kZXgrKztcbiAgICAgICAgICAvLyBpZiByZXR1cm4uLlxuICAgICAgICAgIGlmIChpbmRleCA+PSBudW1QaXhlbHMpIHtcbiAgICAgICAgICAgIHJldHVybiBuZXdBcnJheTtcbiAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgYml0U3RhcnRPZmZzZXQgPSAwO1xuXG4gICAgICB9XG4gICAgfVxuICB9XG5cbiAgX2NvbnZlcnRDb2xvclNwYWNlKHVuY29tcHJlc3NlZERhdGEpIHtcbiAgICBsZXQgcmdiRGF0YSA9IG51bGw7XG4gICAgbGV0IHBob3RvbWV0cmljSW50ZXJwcmV0YXRpb24gPSB0aGlzLnBob3RvbWV0cmljSW50ZXJwcmV0YXRpb24oKTtcbiAgICBsZXQgcGxhbmFyQ29uZmlndXJhdGlvbiA9IHRoaXMucGxhbmFyQ29uZmlndXJhdGlvbigpO1xuXG4gICAgaWYgKHBob3RvbWV0cmljSW50ZXJwcmV0YXRpb24gPT09ICdSR0InICYmXG4gICAgICAgIHBsYW5hckNvbmZpZ3VyYXRpb24gPT09IDApIHtcbiAgICAgIC8vIEFMTCBHT09ELCBBTFJFQURZIE9SREVSRURcbiAgICAgIC8vIHBsYW5hciBvciBub24gcGxhbmFyIHBsYW5hckNvbmZpZ3VyYXRpb25cbiAgICAgIHJnYkRhdGEgPSB1bmNvbXByZXNzZWREYXRhO1xuXG4gICAgfSBlbHNlIGlmIChwaG90b21ldHJpY0ludGVycHJldGF0aW9uID09PSAnUkdCJyAmJlxuICAgICAgICBwbGFuYXJDb25maWd1cmF0aW9uID09PSAxKSB7XG4gICAgICBpZiAodW5jb21wcmVzc2VkRGF0YSBpbnN0YW5jZW9mIEludDhBcnJheSkge1xuICAgICAgICByZ2JEYXRhID0gbmV3IEludDhBcnJheSh1bmNvbXByZXNzZWREYXRhLmxlbmd0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aW5kb3cuY29uc29sZS5sb2coYSk7XG4gICAgICAvLyB3aW5kb3cuY29uc29sZS5sb2coYik7XG4gICAgICAvLyB3aW5kb3cuY29uc29sZS5sb2coYyk7XG4gICAgICAvLyB3aW5kb3cuY29uc29sZS5sb2coZCk7XG5cblxuICAgICAgIHJldHVybiBbXG4gICAgICAgICAgKGEqYStiKmItYypjLWQqZCksIC8vIC1cbiAgICAgICAgICAyKihiKmMtYSpkKSwgICAgICAgLy8gLVxuICAgICAgICAgIDIqKGIqZCthKmMpLCAgICAgICAvLyAtXG4gICAgICAgICAgMiooYipjK2EqZCksXG4gICAgICAgICAgYSphK2MqYy1iKmItZCpkLFxuICAgICAgICAgIDIqKGMqZC1hKmIpXG4gICAgICAgIF07XG5cbiAgICB9ZWxzZSBpZih0aGlzLl9kYXRhU2V0LnNmb3JtX2NvZGUgPiAwKSB7ICBcblxuICAgICAgdmFyIHN4ID0gdGhpcy5fZGF0YVNldC5zcm93X3gsIHN5ID0gdGhpcy5fZGF0YVNldC5zcm93X3ksIHN6ID0gdGhpcy5fZGF0YVNldC5zcm93X3o7XG4gICAgICAvLyBmaWxsIElKS1RvUkFTXG4gICAgICAvL2dvb2cudmVjLk1hdDQuc2V0Um93VmFsdWVzKElKS1RvUkFTLCAwLCBzeFswXSwgc3hbMV0sIHN4WzJdLCBzeFszXSk7XG4gICAgICAvL2dvb2cudmVjLk1hdDQuc2V0Um93VmFsdWVzKElKS1RvUkFTLCAxLCBzeVswXSwgc3lbMV0sIHN5WzJdLCBzeVszXSk7XG4gICAgICAvL2dvb2cudmVjLk1hdDQuc2V0Um93VmFsdWVzKElKS1RvUkFTLCAyLCBzelswXSwgc3pbMV0sIHN6WzJdLCBzelszXSk7XG5cbiAgICB9XG4gICAgZWxzZSBpZih0aGlzLl9kYXRhU2V0LnFmb3JtX2NvZGUgPT09IDApIHtcblxuICAgICAgLy8gZmlsbCBJSktUb1JBU1xuICAgICAgLy9nb29nLnZlYy5NYXQ0LnNldFJvd1Z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sb2coYnVmZmVyKTtcbiAgICAvLyB9XG5cbiAgICAvLyBpcyBpdCBjb21wcmVzc2VkP1xuICAgIC8vIHllcy9ub1xuXG4gICAgLy8gICAgIHRyeSB7XG4gICAgLy8gICB2YXIgcmVzdWx0ID0gcGFrby5pbmZsYXRlKGNvbXByZXNzZWQpO1xuICAgIC8vIH0gY2F0Y2ggKGVycikge1xuICAgIC8vICAgY29uc29sZS5sb2coZXJyKTtcbiAgICAvLyB9XG5cbiAgICAvLyB3aW5kb3cuY29uc29sZS5sb2codGhpcyk7XG4gIH1cblxuICBfZGVjb21wcmVzc1VuY29tcHJlc3NlZChmcmFtZUluZGV4ID0gMCkge1xuICAgIC8vIHBhcGF5YS52b2x1bWUubmlmdGkuTklGVElfVFlQRV9VSU5UOCAgICAgICAgICAgPSAyO1xuICAgIC8vIHBhcGF5YS52b2x1bWUubmlmdGkuTklGVElfVFlQRV9JTlQxNiAgICAgICAgICAgPSA0O1xuICAgIC8vIHBhcGF5YS52b2x1bWUubmlmdGkuTklGVElfVFlQRV9JTlQzMiAgICAgICAgICAgPSA4O1xuICAgIC8vIHBhcGF5YS52b2x1bWUubmlmdGkuTklGVElfVFlQRV9GTE9BVDMyICAgICAgICA9IDE2O1xuICAgIC8vIHBhcGF5YS52b2x1bWUubmlmdGkuTklGVElfVFlQRV9DT01QTEVYNjQgICAgICA9IDMyO1xuICAgIC8vIHBhcGF5YS52b2x1bWUubmlmdGkuTklGVElfVFlQRV9GTE9BVDY0ICAgICAgICA9IDY0O1xuICAgIC8vIHBhcGF5YS52b2x1bWUubmlmdGkuTklGVElfVFlQRV9SR0IyNCAgICAgICAgID0gMTI4O1xuICAgIC8vIHBhcGF5YS52b2x1bWUubmlmdGkuTklGVElfVFlQRV9JTlQ4ICAgICAgICAgID0gMjU2O1xuICAgIC8vIHBhcGF5YS52b2x1bWUubmlmdGkuTklGVElfVFlQRV9VSU5UMTYgICAgICAgID0gNTEyO1xuICAgIC8vIHBhcGF5YS52b2x1bWUub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R5cGU6ICdpJyxcbiAgICAgICAgdmFsdWU6IDAsXG4gICAgICAgIHR5cGVHTFNMOiAnaW50J1xuICAgICAgfSxcbiAgICAgICd1THV0Jzoge1xuICAgICAgICB0eXBlOiAnaScsXG4gICAgICAgIHZhbHVlOiAwLFxuICAgICAgICB0eXBlR0xTTDogJ2ludCdcbiAgICAgIH0sXG4gICAgICAndVRleHR1cmVMVVQnOntcbiAgICAgICAgdHlwZTogJ3QnLFxuICAgICAgICB2YWx1ZTogW10sXG4gICAgICAgIHR5cGVHTFNMOiAnc2FtcGxlcjJEJ1xuICAgICAgfSxcbiAgICAgICd1UGl4ZWxUeXBlJzoge1xuICAgICAgICB0eXBlOiAnaScsXG4gICAgICAgIHZhbHVlOiAwLFxuICAgICAgICB0eXBlR0xTTDogJ2ludCdcbiAgICAgIH0sXG4gICAgICAndVBhY2tlZFBlclBpeGVsJzoge1xuICAgICAgICB0eXBlOiAnaScsXG4gICAgICAgIHZhbHVlOiAxLFxuICAgICAgICB0eXBlR0xTTDogJ2ludCdcbiAgICAgIH0sXG4gICAgICAndUludGVycG9sYXRpb24nOiB7XG4gICAgICAgIHR5cGU6ICdpJyxcbiAgICAgICAgdmFsdWU6IDEsXG4gICAgICAgIHR5cGVHTFNMOiAnaW50J1xuICAgICAgfSxcbiAgICAgICd1V29ybGRCQm94Jzoge1xuICAgICAgICB0eXBlOiAnZnYxJyxcbiAgICAgICAgdmFsdWU6IFswLjAsIDAuMCwgMC4wLCAwLjAsIDAuMCwgMC4wXSxcbiAgICAgICAgdHlwZUdMU0w6ICdmbG9hdCcsXG4gICAgICAgIGxlbmd0aDogNlxuICAgICAgfSxcbiAgICAgICd1U3RlcHMnOiB7XG4gICAgICAgIHR5cGU6ICdpJyxcbiAgICAgICAgdmFsdWU6IDI1NixcbiAgICAgICAgdHlwZUdMU0w6ICdpbnQnXG4gICAgICB9LFxuICAgICAgJ3VBbHBoYUNvcnJlY3Rpb24nOntcbiAgICAgICAgdHlwZTogJ2YnLF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gICAgbWN1RXhwZWN0ZWQgPSBtY3VzUGVyTGluZSAqIGZyYW1lLm1jdXNQZXJDb2x1bW47XG4gICAgfVxuICAgIGlmICghcmVzZXRJbnRlcnZhbCkge1xuICAgICAgcmVzZXRJbnRlcnZhbCA9IG1jdUV4cGVjdGVkO1xuICAgIH1cblxuICAgIHZhciBoLCB2O1xuICAgIHdoaWxlIChtY3UgPCBtY3VFeHBlY3RlZCkge1xuICAgICAgLy8gcmVzZXQgaW50ZXJ2YWwgc3R1ZmZcbiAgICAgIGZvciAoaSA9IDA7IGkgPCBjb21wb25lbnRzTGVuZ3RoOyBpKyspIHtcbiAgICAgICAgY29tcG9uZW50c1tpXS5wcmVkID0gMDtcbiAgICAgIH1cbiAgICAgIGVvYnJ1biA9IDA7XG5cbiAgICAgIGlmIChjb21wb25lbnRzTGVuZ3RoID09IDEpIHtcbiAgICAgICAgY29tcG9uZW50ID0gY29tcG9uZW50c1swXTtcbiAgICAgICAgZm9yIChuID0gMDsgbiA8IHJlc2V0SW50ZXJ2YWw7IG4rKykge1xuICAgICAgICAgIGRlY29kZUJsb2NrKGNvbXBvbmVudCwgZGVjb2RlRm4sIG1jdSk7XG4gICAgICAgICAgbWN1Kys7XG4gICAgICAgIH1cbiAgICAgIH0gZWxzZSB7XG4gICAgICAgIGZvciAobiA9IDA7IG4gPCByZXNldEludGVydmFsOyBuKyspIHtcbiAgICAgICAgICBmb3IgKGkgPSAwOyBpIDwgY29tcG9uZW50c0xlbmd0aDsgaSsrKSB7XG4gICAgICAgICAgICBjb21wb25lbnQgPSBjb21wb25lbnRzW2ldO1xuICAgICAgICAgICAgaCA9IGNvbXBvbmVudC5oO1xuICAgICAgICAgICAgdiA9IGNvbXBvbmVudC52O1xuICAgICAgICAgICAgZm9yIChqID0gMDsgaiA8IHY7IGorKykge1xuICAgICAgICAgICAgICBmb3IgKGsgPSAwOyBrIDwgaDsgaysrKSB7XG4gICAgICAgICAgICAgICAgZGVjb2RlTWN1KGNvbXBvbmVud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IHZhciBxdCA9IGNvbXBvbmVudC5xdWFudGl6YXRpb25UYWJsZTtcbiAgICB2YXIgdjAsIHYxLCB2MiwgdjMsIHY0LCB2NSwgdjYsIHY3LCB0O1xuICAgIHZhciBpO1xuXG4gICAgLy8gZGVxdWFudFxuICAgIGZvciAoaSA9IDA7IGkgPCA2NDsgaSsrKSB7XG4gICAgICBwW2ldID0gY29tcG9uZW50LmJsb2NrRGF0YVtibG9ja0J1ZmZlck9mZnNldCArIGldICogcXRbaV07XG4gICAgfVxuXG4gICAgLy8gaW52ZXJzZSBEQ1Qgb24gcm93c1xuICAgIGZvciAoaSA9IDA7IGkgPCA4OyArK2kpIHtcbiAgICAgIHZhciByb3cgPSA4ICogaTtcblxuICAgICAgLy8gY2hlY2sgZm9yIGFsbC16ZXJvIEFDIGNvZWZmaWNpZW50c1xuICAgICAgaWYgKHBbMSArIHJvd10gPT09IDAgJiYgcFsyICsgcm93XSA9PT0gMCAmJiBwWzMgKyByb3ddID09PSAwICYmXG4gICAgICAgIHBbNCArIHJvd10gPT09IDAgJiYgcFs1ICsgcm93XSA9PT0gMCAmJiBwWzYgKyByb3ddID09PSAwICYmXG4gICAgICAgIHBbNyArIHJvd10gPT09IDApIHtcbiAgICAgICAgdCA9IChkY3RTcXJ0MiAqIHBbMCArIHJvd10gKyA1MTIpID4+IDEwO1xuICAgICAgICBwWzAgKyByb3ddID0gdDtcbiAgICAgICAgcFsxICsgcm93XSA9IHQ7XG4gICAgICAgIHBbMiArIHJvd10gPSB0O1xuICAgICAgICBwWzMgKyByb3ddID0gdDtcbiAgICAgICAgcFs0ICsgcm93XSA9IHQ7XG4gICAgICAgIHBbNSArIHJvd10gPSB0O1xuICAgICAgICBwWzYgKyByb3ddID0gdDtcbiAgICAgICAgcFs3ICsgcm93XSA9IHQ7XG4gICAgICAgIGNvbnRpbnVlO1xuICAgICAgfVxuXG4gICAgICAvLyBzdGFnZSA0XG4gICAgICB2MCA9IChkY3RTcXJ0MiAqIHBbMCArIHJ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AgICAgICAgICAgICAgICAgIGRlbnNpdHlVbml0czogYXBwRGF0YVs3XSxcbiAgICAgICAgICAgICAgICAgIHhEZW5zaXR5OiAoYXBwRGF0YVs4XSA8PCA4KSB8IGFwcERhdGFbOV0sXG4gICAgICAgICAgICAgICAgICB5RGVuc2l0eTogKGFwcERhdGFbMTBdIDw8IDgpIHwgYXBwRGF0YVsxMV0sXG4gICAgICAgICAgICAgICAgICB0aHVtYldpZHRoOiBhcHBEYXRhWzEyXSxcbiAgICAgICAgICAgICAgICAgIHRodW1iSGVpZ2h0OiBhcHBEYXRhWzEzXSxcbiAgICAgICAgICAgICAgICAgIHRodW1iRGF0YTogYXBwRGF0YS5zdWJhcnJheSgxNCwgMTQgKyAzICogYXBwRGF0YVsxMl0gKiBhcHBEYXRhWzEzXSlcbiAgICAgICAgICAgICAgICB9O1xuICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICAvLyBUT0RPIEFQUDEgLSBFeGlmXG4gICAgICAgICAgICBpZiAoZmlsZU1hcmtlciA9PT0gMHhGRkVFKSB7XG4gICAgICAgICAgICAgIGlmIChhcHBEYXRhWzBdID09PSAweDQxICYmIGFwcERhdGFbMV0gPT09IDB4NjQgJiYgYXBwRGF0YVsyXSA9PT0gMHg2RiAmJlxuICAgICAgICAgICAgICAgIGFwcERhdGFbM10gPT09IDB4NjIgJiYgYXBwRGF0YVs0XSA9PT0gMHg2NSAmJiBhcHBEYXRhWzVdID09PSAwKSB7IC8vICdBZG9iZVxceDAwJ1xuICAgICAgICAgICAgICAgIGFkb2JlID0ge1xuICAgICAgICAgICAgICAgICAgdmVyc2lvbjogYXBwRGF0YVs2XSxcbiAgICAgICAgICAgICAgICAgIGZsYWdzMDogKGFwcERhdGFbN10gPDwgOCkgfCBhcHBEYXRhWzhdLFxuICAgICAgICAgICAgICAgICAgZmxhZ3MxOiAoYXBwRGF0YVs5XSA8PCA4KSB8IGFwcERhdGFbMTBdLFxuICAgICAgICAgICAgICAgICAgdHJhbnNmb3JtQ29kZTogYXBwRGF0YVsxMV1cbiAgICAgICAgICAgICAgICB9O1xuICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBicmVhaztcblxuICAgICAgICAgIGNhc2UgMHhGRkRCOiAvLyBEUVQgKERlZmluZSBRdWFudGl6YXRpb24gVGFibGVzKVxuICAgICAgICAgICAgdmFyIHF1YW50aXphdGlvblRhYmxlc0xlbmd0aCA9IHJlYWRVaW50MTYoKTtcbiAgICAgICAgICAgIHZhciBxdWFudGl6YXRpb25UYWJsZXNFbmQgPSBxdWFudGl6YXRpb25UYWJsZXNMZW5ndGggKyBvZmZzZXQgLSAyO1xuICAgICAgICAgICAgd2hpbGUgKG9mZnNldCA8IHF1YW50aXphdGlvblRhYmxlc0VuZCkge1xuICAgICAgICAgICAgICB2YXIgcXVhbnRpemF0aW9uVGFibGVTcGVjID0gZGF0YVtvZmZzZXQrK107XG4gICAgICAgICAgICAgIHZhciB0YWJsZURhdGEgPSBuZXcgSW50MzJBcnJheSg2NCk7XG4gICAgICAgICAgICAgIGlmICgocXVhbnRpemF0aW9uVGFibGVTcGVjID4+IDQpID09PSAwKSB7IC8vIDggYml0IHZhbHVlc1xuICAgICAgICAgICAgICAgIGZvciAoaiA9IDA7IGogPCA2NDsgaisrKSB7XG4gICAgICAgICAgICAgICAgICB2YXIgeiA9IGRjdFppZ1phZ1tqXTtcbiAgICAgICAgICAgICAgICAgIHRhYmxlRGF0YVt6XSA9IGRhdGFbb2Zmc2V0KytdO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgfSBlbHNlIGlmICgocXVhbnRpemF0aW9uVGFibGVTcGVjID4+IDQpID09PSAxKSB7IC8vMTYgYml0XG4gICAgICAgICAgICAgICAgZm9yIChqID0gMDsgaiA8IDY0OyBqKyspIHtcbiAgICAgICAgICAgICAgICAgIHZhciB6eiA9IGRjdFppZ1phZ1tqXTtcbiAgICAgICAgICAgICAgICAgIHRhYmxlRGF0YVt6el0gPSByZWFkVWludDE2KCk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICB9IGVsc2VcbiAgICAgICAgICAgICAgICB0aHJvdyBcIkRRVDogaW52YWxpZCB0YWJsZSBzcGVjXCI7XG4gICAgICAgICAgICAgIHF1YW50aXphdGlvblRhYmxlc1txdWFudGl6YXRpb25UYWJsZVNwZWMgJiAxNV0gPSB0YWJsZURhdGE7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBicmVhaztcblxuICAgICAgICAgIGNhc2UgMHhGRkMwOiAvLyBTT0YwIChTdGFydCBvZiBGcmFtZSwgQmFzZWxpbmUgRENUKVxuICAgICAgICAgIGNhc2UgMHhGRkMxOiAvLyBTT0YxIChTdGFydCBvZiBGcmFtZSwgRXh0ZW5kZWQgRENUKVxuICAgICAgICAgIGNhc2UgMHhGRkMyOiAvLyBTT0YyIChTdGFydCBvZiBGcmFtZSwgUHJvZ3Jlc3NpdmUgRENUKVxuICAgICAgICAgICAgaWYgKGZyYW1lKSB7XG4gICAgICAgICAgICAgIHRocm93IFwiT25seSBzaW5nbGUgZnJhbWUgSlBFR3Mgc3VwcG9ydGVkXCI7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICByZWFkVWludDE2KCk7IC8vIHNraXAgZGF0YSBsZW5ndGhcbiAgICAgICAgICAgIGZyYW1lID0ge307XG4gICAgICAgICAgICBmcmFtZS5leHRlbmRlZCA9IChmaWxlTWFya2VyID09PSAweEZGQzEpO1xuICAgICAgICAgICAgZnJhbWUucHJvZ3Jlc3NpdmUgPSAoZmlsZU1hcmtlciA9PT0gMHhGRkMyKTtcbiAgICAgICAgICAgIGZyYW1lLnByZWNpc2lvbiA9IGRhdGFbb2Zmc2V0KytdO1xuICAgICAgICAgICAgZnJhbWUuc2NhbkxpbmVzID0gcmVhZFVpbnQxNigpO1xuICAgICAgICAgICAgZnJhbWUuc2FtcGxlc1BlckxpbmUgPSByZWFkVWludDE2KCk7XG4gICAgICAgICAgICBmcmFtZS5jb21wb25lbnRzID0gW107XG4gICAgICAgICAgICBmcmFtZS5jb21wb25lbnRJZHMgPSB7fTtcbiAgICAgICAgICAgIHZhciBjb21wb25lbnRzQ291bnQgPSBkYXRhW29mZnNldCsrXSwgY29tcG9uZW50SWQ7XG4gICAgICAgICAgICB2YXIgbWF4SCA9IDAsIG1heFYgPSAwO1xuICAgICAgICAgICAgZm9yIChpID0gMDsgaSA8IGNvbXBvbmVudHNDb3VudDsgaSsrKSB7XG4gICAgICAgICAgICAgIGNvbXBvbmVudElkID0gZGF0YVtvZmZzZXRdO1xuICAgICAgICAgICAgICB2YXIgaCA9IGRhdGFbb2Zmc2V0ICsgMV0gPj4gNDtcbiAgICAgICAgICAgICAgdmFyIHYgPSBkYXRhW29mZnNldCArIDFdICYgMTU7XG4gICAgICAgICAgICAgIGlmIChtYXhIIDwgaClcbiAgICAgICAgICAgICAgICBtYXhIID0gaDtcbiAgICAgICAgICAgICAgaWYgKG1heFYgPCB2KVxuICAgICAgICAgICAgICAgIG1heFYgPSB2O1xuICAgICAgICAgICAgICB2YXIgcUlkID0gZGF0YVtvZmZzZXQgKyAyXTtcbiAgICAgICAgICAgICAgbCA9IGZyYW1lLmNvbXBvbmVudHMucHVzaCh7XG4gICAgICAgICAgICAgICAgaDogaCxcbiAgICAgICAgICAgICAgICB2OiB2LFxuICAgICAgICAgICAgICAgIHF1YW50aXphdGlvblRhYmxlOiBxdWFudGl6YXRpb25UYWJsZXNbcUlkXSxcbiAgICAgICAgICAgICAgICBxdWFudGl6YXRpb25UYWJsZUlkOiBxSWQsXG4gICAgICAgICAgICAgICAgYml0Q29udmVyc2lvbjogMjU1IC8gKCgxIDw8IGZyYW1lLnByZWNpc2lvbikgLSAxKVxuICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgICAgZnJhbWUuY29tcG9uZW50SWRzW2NvbXBvbmVudElkXSA9IGwgLSAxO1xuICAgICAgICAgICAgICBvZmZzZXQgKz0gMztcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGZyYW1lLm1heEggPSBtYXhIO1xuICAgICAgICAgICAgZnJhbWUubWF4ViA9IG1heFY7XG4gICAgICAgICAgICBwcmVwYXJlQ29tcG9uZW50cyhmcmFtZSk7XG4gICAgICAgICAgICBicmVhaztcblxuICAgICAgICAgIGNhc2UgMHhGRkM0OiAvLyBESFQgKERlZmluZSBIdWZmbWFuIFRhYmxlcylcbiAgICAgICAgICAgIHZhciBodWZmbWFuTGVuZ3RoID0gcmVhZFVpbnQxNigpO1xuICAgICAgICAgICAgZm9yIChpID0gMjsgaSA8IGh1ZmZtYW5MZW5ndGg7ICkge1xuICAgICAgICAgICAgICB2YXIgaHVmZm1hblRhYmxlU3BlYyA9IGRhdGFbb2Zmc2V0KytdO1xuICAgICAgICAgICAgICB2YXIgY29kZUxlbmd0aHMgPSBuZXcgVWludDhBcnJheSgxNik7XG4gICAgICAgICAgICAgIHZhciBjb2RlTGVuZ3RoU3VtID0gMDtcbiAgICAgICAgICAgICAgZm9yIChqID0gMDsgaiA8IDE2OyBqKyssIG9mZnNldCsrKVxuICAgICAgICAgICAgICAgIGNvZGVMZW5ndGhTdW0gKz0gKGNvZGVMZW5ndGhzW2pdID0gZGF0YVtvZmZzZXRdKTtcbiAgICAgICAgICAgICAgdmFyIGh1ZmZtYW5WYWx1ZXMgPSBuZXcgVWludDhBcnJheShjb2RlTGVuZ3RoU3VtKTtcbiAgICAgICAgICAgICAgZm9yIChqID0gMDsgaiA8IGNvZGVMZW5ndGhTdW07IGorKywgb2Zmc2V0KyspXG4gICAgICAgICAgICAgICAgaHVmZm1hblZhbHVlc1tqXSA9IGRhdGFbb2Zmc2V0XTtcbiAgICAgICAgICAgICAgaSArPSAxNyArIGNvZGVMZW5ndGhTdW07XG5cbiAgICAgICAgICAgICAgKChodWZmbWFuVGFibGVTcGVjID4+IDQpID09PSAwID9cbiAgICAgICAgICAgICAgICBodWZmbWFuVGFibGVzREMgOiBodWZmbWFuVGFibGVzQ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ICAgICAgICAgIHRocm93IFwidW5rbm93biBKUEVHIG1hcmtlciBcIiArIGZpbGVNYXJrZXIudG9TdHJpbmcoMTYpO1xuICAgICAgICB9XG4gICAgICAgIGZpbGVNYXJrZXIgPSByZWFkVWludDE2KCk7XG4gICAgICB9XG5cbiAgICAgIHRoaXMud2lkdGggPSBmcmFtZS5zYW1wbGVzUGVyTGluZTtcbiAgICAgIHRoaXMuaGVpZ2h0ID0gZnJhbWUuc2NhbkxpbmVzO1xuICAgICAgdGhpcy5qZmlmID0gamZpZjtcbiAgICAgIHRoaXMuYWRvYmUgPSBhZG9iZTtcbiAgICAgIHRoaXMuY29tcG9uZW50cyA9IFtdO1xuICAgICAgc3dpdGNoIChmcmFtZS5jb21wb25lbnRzLmxlbmd0aClcbiAgICAgIHtcbiAgICAgICAgY2FzZSAxOlxuICAgICAgICAgIHRoaXMuY29sb3JzcGFjZSA9IENvbG9yU3BhY2UuR3JheXNjYWxlO1xuICAgICAgICAgIGJyZWFrO1xuICAgICAgICBjYXNlIDM6XG4gICAgICAgICAgaWYgKHRoaXMuYWRvYmUpXG4gICAgICAgICAgICB0aGlzLmNvbG9yc3BhY2UgPSBDb2xvclNwYWNlLkFkb2JlUkdCO1xuICAgICAgICAgIGVsc2VcbiAgICAgICAgICAgIHRoaXMuY29sb3JzcGFjZSA9IENvbG9yU3BhY2UuUkdCO1xuICAgICAgICAgIGJyZWFrO1xuICAgICAgICBjYXNlIDQ6XG4gICAgICAgICAgdGhpcy5jb2xvcnNwYWNlID0gQ29sb3JTcGFjZS5DWU1LO1xuICAgICAgICAgIGJyZWFrO1xuICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgIHRoaXMuY29sb3JzcGFjZSA9IENvbG9yU3BhY2UuVW5rbm93bjtcbiAgICAgIH1cbiAgICAgIGZvciAodmFyIGkgPSAwOyBpIDwgZnJhbWUuY29tcG9uZW50cy5sZW5ndGg7IGkrKykge1xuICAgICAgICB2YXIgY29tcG9uZW50ID0gZnJhbWUuY29tcG9uZW50c1tpXTtcbiAgICAgICAgaWYgKCFjb21wb25lbnQucXVhbnRpemF0aW9uVGFibGUgJiYgY29tcG9uZW50LnF1YW50aXphdGlvblRhYmxlSWQgIT09IG51bGwpXG4gICAgICAgICAgY29tcG9uZW50LnF1YW50aXphdGlvblRhYmxlID0gcXVhbnRpemF0aW9uVGFibGVzW2NvbXBvbmVudC5xdWFudGl6YXRpb25UYWJsZUlkXTtcbiAgICAgICAgdGhpcy5jb21wb25lbnRzLnB1c2goe1xuICAgICAgICAgIG91dHB1dDogYnVpbGRDb21wb25lbnREYXRhKGZyYW1lLCBjb21wb25lbnQpLFxuICAgICAgICAgIHNjYWxlWDogY29tcG9uZW50LmggLyBmcmFtZS5tYXhILFxuICAgICAgICAgIHNjYWxlWTogY29tcG9uZW50LnYgLyBmcmFtZS5tYXhWLFxuICAgICAgICAgIGJsb2Nrc1BlckxpbmU6IGNvbXBvbmVudC5ibG9ja3NQZXJMaW5lLFxuICAgICAgICAgIGJsb2Nrc1BlckNvbHVtbjogY29tcG9uZW50LmJsb2Nrc1BlckNvbHVtbixcbiAgICAgICAgICBiaXRDb252ZXJzaW9uOiBjb21wb25lbnQuYml0Q29udmVyc2lvblxuICAgICAgICB9KTtcbiAgICAgIH1cbiAgICB9LFxuICAgIGdldERhdGExNjogZnVuY3Rpb24gZ2V0RGF0YTE2KHdpZHRoLCBoZWlnaHQpIHtcbiAgICAgIGlmICh0aGlzLmNvbXBvbmVudHMubGVuZ3RoICE9PSAxKVxuICAgICAgICB0aHJvdyAnVW5zdXBwb3J0ZWQgY29sb3IgbW9kZSc7XG4gICAgICB2YXIgc2NhbGVYID0gdGhpcy53aWR0aCAvIHdpZHRoLCBzY2FsZVkgPSB0aGlzLmhlaWdodCAvIGhlaWdodDtcblxuICAgICAgdmFyIGNvbXBvbmVudCwgY29tcG9uZW50U2NhbGVYLCBjb21wb25lbnRTY2FsZVk7XG4gICAgICB2YXIgeCwgeSwgaTtcbiAgICAgIHZhciBvZ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vdysrKSB7XG4gICAgICAgICAgdmFyIHNjYW5MaW5lID0gYmxvY2tSb3cgPDwgMztcbiAgICAgICAgICBmb3IgKHZhciBibG9ja0NvbCA9IDA7IGJsb2NrQ29sIDwgYmxvY2tzUGVyTGluZTsgYmxvY2tDb2wrKykge1xuICAgICAgICAgICAgdmFyIGJ1ZmZlck9mZnNldCA9IGdldEJsb2NrQnVmZmVyT2Zmc2V0KGNvbXBvbmVudCwgYmxvY2tSb3csIGJsb2NrQ29sKTtcbiAgICAgICAgICAgIHZhciBvZmZzZXQgPSAwLCBzYW1wbGUgPSBibG9ja0NvbCA8PCAzO1xuICAgICAgICAgICAgZm9yIChqID0gMDsgaiA8IDg7IGorKykge1xuICAgICAgICAgICAgICB2YXIgbGluZU9mZnNldCA9IChzY2FuTGluZSArIGopICogc2FtcGxlc1BlckxpbmU7XG4gICAgICAgICAgICAgIGZvciAoayA9IDA7IGsgPCA4OyBrKyspIHtcbiAgICAgICAgICAgICAgICBsaW5lRGF0YVtsaW5lT2Zmc2V0ICsgc2FtcGxlICsga10gPVxuICAgICAgICAgICAgICAgICAgY29tcG9uZW50Lm91dHB1dFtidWZmZXJPZmZzZXQgKyBvZmZzZXQrK107XG4gICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICBjb21wb25lbnRTY2FsZVggPSBjb21wb25lbnQuc2NhbGVYICogc2NhbGVYO1xuICAgICAgICBjb21wb25lbnRTY2FsZVkgPSBjb21wb25lbnQuc2NhbGVZICogc2NhbGVZO1xuICAgICAgICBvZmZzZXQgPSBpO1xuXG4gICAgICAgIHZhciBjeCwgY3k7XG4gICAgICAgIHZhciBpbmRleDtcbiAgICAgICAgZm9yICh5ID0gMDsgeSA8IGhlaWdodDsgeSsrKSB7XG4gICAgICAgICAgZm9yICh4ID0gMDsgeCA8IHdpZHRoOyB4KyspIHtcbiAgICAgICAgICAgIGN5ID0gMCB8ICh5ICogY29tcG9u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ICAgdmFyIGxpbmVPZmZzZXQgPSAoc2NhbkxpbmUgKyBqKSAqIHNhbXBsZXNQZXJMaW5lO1xuICAgICAgICAgICAgICBmb3IgKGsgPSAwOyBrIDwgODsgaysrKSB7XG4gICAgICAgICAgICAgICAgbGluZURhdGFbbGluZU9mZnNldCArIHNhbXBsZSArIGtdID1cbiAgICAgICAgICAgICAgICAgIGNvbXBvbmVudC5vdXRwdXRbYnVmZmVyT2Zmc2V0ICsgb2Zmc2V0KytdICogY29tcG9uZW50LmJpdENvbnZlcnNpb247XG4gICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICBjb21wb25lbnRTY2FsZVggPSBjb21wb25lbnQuc2NhbGVYICogc2NhbGVYO1xuICAgICAgICBjb21wb25lbnRTY2FsZVkgPSBjb21wb25lbnQuc2NhbGVZICogc2NhbGVZO1xuICAgICAgICBvZmZzZXQgPSBpO1xuXG4gICAgICAgIHZhciBjeCwgY3k7XG4gICAgICAgIHZhciBpbmRleDtcbiAgICAgICAgZm9yICh5ID0gMDsgeSA8IGhlaWdodDsgeSsrKSB7XG4gICAgICAgICAgZm9yICh4ID0gMDsgeCA8IHdpZHRoOyB4KyspIHtcbiAgICAgICAgICAgIGN5ID0gMCB8ICh5ICogY29tcG9uZW50U2NhbGVZKTtcbiAgICAgICAgICAgIGN4ID0gMCB8ICh4ICogY29tcG9uZW50U2NhbGVYKTtcbiAgICAgICAgICAgIGluZGV4ID0gY3kgKiBzYW1wbGVzUGVyTGluZSArIGN4O1xuICAgICAgICAgICAgZGF0YVtvZmZzZXRdID0gbGluZURhdGFbaW5kZXhdO1xuICAgICAgICAgICAgb2Zmc2V0ICs9IG51bUNvbXBvbmVudHM7XG4gICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICB9XG5cbiAgICAgIC8vIC4uLiB0aGVuIHRyYW5zZm9ybSBjb2xvcnMsIGlmIG5lY2Vzc2FyeVxuICAgICAgc3d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W5nIHRvIHNwZWMuXG4gICAgICAgICAgLy8gSmF2YVNjcmlwdCdzIGludCBwcmVjaXNpb24gb2YgNTMgYml0IHNob3VsZCBiZSBzdWZmaWNpZW50IGhlcmUuXG4gICAgICAgICAgbGJveCA9IHJlYWRVaW50MzIoZGF0YSwgcG9zaXRpb24pICogNDI5NDk2NzI5NiArXG4gICAgICAgICAgICAgICAgIHJlYWRVaW50MzIoZGF0YSwgcG9zaXRpb24gKyA0KTtcbiAgICAgICAgICBwb3NpdGlvbiArPSA4O1xuICAgICAgICAgIGhlYWRlclNpemUgKz0gODtcbiAgICAgICAgfVxuICAgICAgICBpZiAobGJveCA9PT0gMCkge1xuICAgICAgICAgIGxib3ggPSBsZW5ndGggLSBwb3NpdGlvbiArIGhlYWRlclNpemU7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKGxib3ggPCBoZWFkZXJTaXplKSB7XG4gICAgICAgICAgdGhyb3cgbmV3IEVycm9yKCdKUFggRXJyb3I6IEludmFsaWQgYm94IGZpZWxkIHNpemUnKTtcbiAgICAgICAgfVxuICAgICAgICB2YXIgZGF0YUxlbmd0aCA9IGxib3ggLSBoZWFkZXJTaXplO1xuICAgICAgICB2YXIganVtcERhdGFMZW5ndGggPSB0cnVlO1xuICAgICAgICBzd2l0Y2ggKHRib3gpIHtcbiAgICAgICAgICBjYXNlIDB4NkE3MDMyNjg6IC8vICdqcDJoJ1xuICAgICAgICAgICAganVtcERhdGFMZW5ndGggPSBmYWxzZTsgLy8gcGFyc2luZyBjaGlsZCBib3hlc1xuICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgY2FzZSAweDYzNkY2QzcyOiAvLyAnY29scidcbiAgICAgICAgICAgIC8vIENvbG9yc3BhY2VzIGFyZSBub3QgdXNlZCwgdGhlIENTIGZyb20gdGhlIFBERiBpcyB1c2VkLlxuICAgICAgICAgICAgdmFyIG1ldGhvZCA9IGRhdGFbcG9zaXRpb25dO1xuICAgICAgICAgICAgdmFyIHByZWNlZGVuY2UgPSBkYXRhW3Bvc2l0aW9uICsgMV07XG4gICAgICAgICAgICB2YXIgYXBwcm94aW1hdGlvbiA9IGRhdGFbcG9zaXRpb24gKyAyXTtcbiAgICAgICAgICAgIGlmIChtZXRob2QgPT09IDEpIHtcbiAgICAgICAgICAgICAgLy8gZW51bWVyYXRlZCBjb2xvcnNwYWNlXG4gICAgICAgICAgICAgIHZhciBjb2xvcnNwYWNlID0gcmVhZFVpbnQzMihkYXRhLCBwb3NpdGlvbiArIDMpO1xuICAgICAgICAgICAgICBzd2l0Y2ggKGNvbG9yc3BhY2UpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE2OiAvLyB0aGlzIGluZGljYXRlcyBhIHNSR0IgY29sb3JzcGFjZVxuICAgICAgICAgICAgICAgIGNhc2UgMTc6IC8vIHRoaXMgaW5kaWNhdGVzIGEgZ3JheXNjYWxlIGNvbG9yc3BhY2VcbiAgICAgICAgICAgICAgICBjYXNlIDE4OiAvLyB0aGlzIGluZGljYXRlcyBhIFlVViBjb2xvcnNwYWNlXG4gICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgd2FybignVW5rbm93biBjb2xvcnNwYWNlICcgKyBjb2xvcnNwYWNlKTtcbiAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9IGVsc2UgaWYgKG1ldGhvZCA9PT0gMikge1xuICAgICAgICAgICAgICBpbmZvKCdJQ0MgcHJvZmlsZSBub3Qgc3VwcG9ydGVkJyk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBicmVhaztcbiAgICAgICAgICBjYXNlIDB4NkE3MDMyNjM6IC8vICdqcDJjJ1xuICAgICAgICAgICAgdGhpcy5wYXJzZUNvZGVzdHJlYW0oZGF0YSwgcG9zaXRpb24sIHBvc2l0aW9uICsgZGF0YUxlbmd0aCk7XG4gICAgICAgICAgICBicmVhaztcbiAgICAgICAgICBjYXNlIDB4NkE1MDIwMjA6IC8vICdqUFxcMDI0XFwwMjQnXG4gICAgICAgICAgICBpZiAoMHgwZDBhODcwYSAhPT0gcmVhZFVpbnQzMihkYXRhLCBwb3NpdGlvbikpIHtcbiAgICAgICAgICAgICAgd2FybignSW52YWxpZCBKUDIgc2lnbmF0dXJlJyk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAvLyBUaGUgZm9sbG93aW5nIGhlYWRlciB0eXBlcyBhcmUgdmFsaWQgYnV0IGN1cnJlbnRseSBub3QgdXNlZDpcbiAgICAgICAgICBjYXNlIDB4NkE1MDFBMUE6IC8vICdqUFxcMDMyXFwwMzInXG4gICAgICAgICAgY2FzZSAweDY2NzQ3OTcwOiAvLyAnZnR5cCdcbiAgICAgICAgICBjYXNlIDB4NzI3MjY1NzE6IC8vICdycmVxJ1xuICAgICAgICAgIGNhc2UgMHg3MjY1NzMyMDogLy8gJ3JlcyAnXG4gICAgICAgICAgY2FzZSAweDY5Njg2NDcyOiAvLyAnaWhkcidcbiAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICB2YXIgaGVhZGVyVHlwZSA9IFN0cmluZy5mcm9tQ2hhckNvZGUoKHRib3ggPj4gMjQpICYgMHhGRixcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAodGJveCA+PiAxNikgJiAweEZGLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh0Ym94ID4+IDgpICYgMHhGRixcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0Ym94ICYgMHhGRik7XG4gICAgICAgICAgICB3YXJuKCdVbnN1cHBvcnRlZCBoZWFkZXIgdHlwZSAnICsgdGJveCArICcgKCcgKyBoZWFkZXJUeXBlICsgJyknKTtcbiAgICAgICAgICAgIGJyZ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ZXN0cmVhbSAoRU9DKVxuICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIGNhc2UgMHhGRjUxOiAvLyBJbWFnZSBhbmQgdGlsZSBzaXplIChTSVopXG4gICAgICAgICAgICAgIGxlbmd0aCA9IHJlYWRVaW50MTYoZGF0YSwgcG9zaXRpb24pO1xuICAgICAgICAgICAgICB2YXIgc2l6ID0ge307XG4gICAgICAgICAgICAgIHNpei5Yc2l6ID0gcmVhZFVpbnQzMihkYXRhLCBwb3NpdGlvbiArIDQpO1xuICAgICAgICAgICAgICBzaXouWXNpeiA9IHJlYWRVaW50MzIoZGF0YSwgcG9zaXRpb24gKyA4KTtcbiAgICAgICAgICAgICAgc2l6LlhPc2l6ID0gcmVhZFVpbnQzMihkYXRhLCBwb3NpdGlvbiArIDEyKTtcbiAgICAgICAgICAgICAgc2l6LllPc2l6ID0gcmVhZFVpbnQzMihkYXRhLCBwb3NpdGlvbiArIDE2KTtcbiAgICAgICAgICAgICAgc2l6LlhUc2l6ID0gcmVhZFVpbnQzMihkYXRhLCBwb3NpdGlvbiArIDIwKTtcbiAgICAgICAgICAgICAgc2l6LllUc2l6ID0gcmVhZFVpbnQzMihkYXRhLCBwb3NpdGlvbiArIDI0KTtcbiAgICAgICAgICAgICAgc2l6LlhUT3NpeiA9IHJlYWRVaW50MzIoZGF0YSwgcG9zaXRpb24gKyAyOCk7XG4gICAgICAgICAgICAgIHNpei5ZVE9zaXogPSByZWFkVWludDMyKGRhdGEsIHBvc2l0aW9uICsgMzIpO1xuICAgICAgICAgICAgICB2YXIgY29tcG9uZW50c0NvdW50ID0gcmVhZFVpbnQxNihkYXRhLCBwb3NpdGlvbiArIDM2KTtcbiAgICAgICAgICAgICAgc2l6LkNzaXogPSBjb21wb25lbnRzQ291bnQ7XG4gICAgICAgICAgICAgIHZhciBjb21wb25lbnRzID0gW107XG4gICAgICAgICAgICAgIGogPSBwb3NpdGlvbiArIDM4O1xuICAgICAgICAgICAgICBmb3IgKHZhciBpID0gMDsgaSA8IGNvbXBvbmVudHNDb3VudDsgaSsrKSB7XG4gICAgICAgICAgICAgICAgdmFyIGNvbXBvbmVudCA9IHtcbiAgICAgICAgICAgICAgICAgIHByZWNpc2lvbjogKGRhdGFbal0gJiAweDdGKSArIDEsXG4gICAgICAgICAgICAgICAgICBpc1NpZ25lZDogISEoZGF0YVtqXSAmIDB4ODApLFxuICAgICAgICAgICAgICAgICAgWFJzaXo6IGRhdGFbaiArIDFdLFxuICAgICAgICAgICAgICAgICAgWVJzaXo6IGRhdGFbaiArIDFdXG4gICAgICAgICAgICAgICAgfTtcbiAgICAgICAgICAgICAgICBjYWxjdWxhdGVDb21wb25lbnREaW1lbnNpb25zKGNvbXBvbmVudCwgc2l6KTtcbiAgICAgICAgICAgICAgICBjb21wb25lbnRzLnB1c2goY29tcG9uZW50KTtcbiAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICBjb250ZXh0LlNJWiA9IHNpejtcbiAgICAgICAgICAgICAgY29udGV4dC5jb21wb25lbnRzID0gY29tcG9uZW50cztcbiAgICAgICAgICAgICAgY2FsY3VsYXRlVGlsZUdyaWRzKGNvbnRleHQsIGNvbXBvbmVudHMpO1xuICAgICAgICAgICAgICBjb250ZXh0LlFDQyA9IFtdO1xuICAgICAgICAgICAgICBjb250ZXh0LkNPQyA9IFtdO1xuICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIGNhc2UgMHhGRjVDOiAvLyBRdWFudGl6YXRpb24gZGVmYXVsdCAoUUNEKVxuICAgICAgICAgICAgICBsZW5ndGggPSByZWFkVWludDE2KGRhdGEsIHBvc2l0aW9uKTtcbiAgICAgICAgICAgICAgdmFyIHFjZCA9IHt9O1xuICAgICAgICAgICAgICBqID0gcG9zaXRpb24gKyAyO1xuICAgICAgICAgICAgICBzcWNkID0gZGF0YVtqKytdO1xuICAgICAgICAgICAgICBzd2l0Y2ggKHNxY2QgJiAweDFGKSB7XG4gICAgICAgICAgICAgICAgY2FzZSAwOlxuICAgICAgICAgICAgICAgICAgc3BxY2RTaXplID0gODtcbiAgICAgICAgICAgICAgICAgIHNjYWxhckV4cG91bmRlZCA9IHRydWU7XG4gICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICBzcHFjZFNpemUgPSAxNjtcbiAgICAgICAgICAgICAgICAgIHNjYWxhckV4cG91bmRlZCA9IGZhbHNlO1xuICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAyOlxuICAgICAgICAgICAgICAgICAgc3BxY2RTaXplID0gMTY7XG4gICAgICAgICAgICAgICAgICBzY2FsYXJFeHBvdW5kZWQgPSB0cnVlO1xuICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcignSlBYIEVycm9yOiBJbnZhbGlkIFNRY2QgdmFsdWUgJyArIHNxY2QpO1xuICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgIHFjZC5ub1F1YW50aXphdGlvbiA9IChzcHFjZFNpemUgPT09IDgpO1xuICAgICAgICAgICAgICBxY2Quc2NhbGFyRXhwb3VuZGVkID0gc2NhbGFyRXhwb3VuZGVkO1xuICAgICAgICAgICAgICBxY2QuZ3VhcmRCaXRzID0gc3FjZCA+PiA1O1xuICAgICAgICAgICAgICBzcHFjZHMgPSBbXTtcbiAgICAgICAgICAgICAgd2hpbGUgKGogPCBsZW5ndGggKyBwb3NpdGlvbikge1xuICAgICAgICAgICAgICAgIHZhciBzcHFjZCA9IHt9O1xuICAgICAgICAgICAgICAgIGlmIChzcHFjZFNpemUgPT09IDgpIHtcbiAgICAgICAgICAgICAgICAgIHNwcWNkLmVwc2lsb24gPSBkYXRhW2orK10gPj4gMztcbiAgICAgICAgICAgICAgICAgIHNwcWNkLm11ID0gMDtcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgc3BxY2QuZXBzaWxvbiA9IGRhdGFbal0gPj4gMztcbiAgICAgICAgICAgICAgICAgIHNwcWNkLm11ID0gKChkYXRhW2pdICYgMHg3KSA8PCA4KSB8IGRhdGFbaiArIDFdO1xuICAgICAgICAgICAgICAgICAgaiArPSAyO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBzcHFjZHMucHVzaChzcHFjZCk7XG4gICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgcWNkLlNQcWNkcyA9IHNwcWNkcztcbiAgICAgICAgICAgICAgaWYgKGNvbnRleHQubWFpbkhlYWRlcikge1xuICAgICAgICAgICAgICAgIGNvbnRleHQuUUNEID0gcWNkO1xuICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIGNvbnRleHQuY3VycmVudFRpbGUuUUNEID0gcWNkO1xuICAgICAgICAgICAgICAgIGNvbnRleHQuY3VycmVudFRpbGUuUUNDID0gW107XG4gICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICBjYXNlIDB4RkY1RDogLy8gUXVhbnRpemF0aW9uIGNvbXBvbmVudCAoUUNDKVxuICAgICAgICAgICAgICBsZW5ndGggPSByZWFkVWludDE2KGRhdGEsIHBvc2l0aW9uKTtcbiAgICAgICAgICAgICAgdmFyIHFjYyA9IHt9O1xuICAgICAgICAgICAgICBqID0gcG9zaXRpb24gKyAyO1xuICAgICAgICAgICAgICB2YXIgY3FjYztcbiAgICAgICAgICAgICAgaWYgKGNvbnRleHQuU0laLkNzaXogPCAyNTcpIHtcbiAgICAgICAgICAgICAgICBjcWNjID0gZGF0YVtqKytdO1xuICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIGNxY2MgPSByZWFkVWludDE2KGRhdGEsIGopO1xuICAgICAgICAgICAgICAgIGogKz0gMjtcbiAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICBzcWNkID0gZGF0YVtqKytdO1xuICAgICAgICAgICAgICBzd2l0Y2ggKHNxY2QgJiAweDFGKSB7XG4gICAgICAgICAgICAgICAgY2FzZSAwOlxuICAgICAgICAgICAgICAgICAgc3BxY2RTaXplID0gODtcbiAgICAgICAgICAgICAgICAgIHNjYWxhckV4cG91bmRlZCA9IHRydWU7XG4gICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICBzcHFjZFNpemUgPSAxNjtcbiAgICAgICAgICAgICAgICAgIHNjYWxhckV4cG91bmRlZCA9IGZhbHNlO1xuICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAyOlxuICAgICAgICAgICAgICAgICAgc3BxY2RTaXplID0gMTY7XG4gICAgICAgICAgICAgICAgICBzY2FsYXJFeHBvdW5kZWQgPSB0cnVlO1xuICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcignSlBYIEVycm9yOiBJbnZhbGlkIFNRY2QgdmFsdWUgJyArIHNxY2QpO1xuICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgIHFjYy5ub1F1YW50aXphdGlvbiA9IChzcHFjZFNpemUgPT09IDgpO1xuICAgICAgICAgICAgICBxY2Muc2NhbGFyRXhwb3VuZGVkID0gc2NhbGFyRXhwb3VuZGVkO1xuICAgICAgICAgICAgICBxY2MuZ3VhcmRCaXRzID0gc3FjZCA+PiA1O1xuICAgICAgICAgICAgICBzcHFjZHMgPSBbXTtcbiAgICAgICAgICAgICAgd2hpbGUgKGogPCAobGVuZ3RoICsgcG9zaXRpb24pKSB7XG4gICAgICAgICAgICAgICAgc3BxY2QgPSB7fTtcbiAgICAgICAgICAgICAgICBpZiAoc3BxY2RTaXplID09PSA4KSB7XG4gICAgICAgICAgICAgICAgICBzcHFjZC5lcHNpbG9uID0gZGF0YVtqKytdID4+IDM7XG4gICAgICAgICAgICAgICAgICBzcHFjZC5tdSA9IDA7XG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgIHNwcWNkLmVwc2lsb24gPSBkYXRhW2pdID4+IDM7XG4gICAgICAgICAgICAgICAgICBzcHFjZC5tdSA9ICgoZGF0YVtqXSAmIDB4NykgPDwgOCkgfCBkYXRhW2ogKyAxXTtcbiAgICAgICAgICAgICAgICAgIGogKz0gMjtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgc3BxY2RzLnB1c2goc3BxY2QpO1xuICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgIHFjYy5TUHFjZHMgPSBzcHFjZHM7XG4gICAgICAgICAgICAgIGlmIChjb250ZXh0Lm1haW5IZWFkZXIpIHtcbiAgICAgICAgICAgICAgICBjb250ZXh0LlFDQ1tjcWNjXSA9IHFjYztcbiAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICBjb250ZXh0LmN1cnJlbnRUaWxlLlFDQ1tjcWNjXSA9IHFjYztcbiAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIGNhc2UgMHhGRjUyOiAvLyBDb2Rpbmcgc3R5bGUgZGVmYXVsdCAoQ09EKVxuICAgICAgICAgICAgICBsZW5ndGggPSByZWFkVWludDE2KGRhdGEsIHBvc2l0aW9uKTtcbiAgICAgICAgICAgICAgdmFyIGNvZCA9IHt9O1xuICAgICAgICAgICAgICBqID0gcG9zaXRpb24gKyAyO1xuICAgICAgICAgICAgICB2YXIgc2NvZCA9IGRhdGFbaisrXTtcbiAgICAgICAgICAgICAgY29kLmVudHJvcHlDb2RlcldpdGhDdXN0b21QcmVjaW5jdHMgPSAhIShzY29kICYgMSk7XG4gICAgICAgICAgICAgIGNvZC5zb3BNYXJrZXJVc2VkID0gISEoc2NvZCAmIDIpO1xuICAgICAgICAgICAgICBjb2QuZXBoTWFya2VyVXNlZCA9ICEhKHNjb2QgJiA0KTtcbiAgICAgICAgICAgICAgY29kLnByb2dyZXNzaW9uT3JkZXIgPSBkYXRhW2orK107XG4gICAgICAgICAgICAgIGNvZC5sYXllcnNDb3VudCA9IHJlYWRVaW50MTYoZGF0YSwgaik7XG4gICAgICAgICAgICAgIGogKz0gMjtcbiAgICAgICAgICAgICAgY29kLm11bHRpcGxlQ29tcG9uZW50VHJhbnNmb3JtID0gZGF0YVtqKytdO1xuXG4gICAgICAgICAgICAgIGNvZC5kZWNvbXBvc2l0aW9uTGV2ZWxzQ291bnQgPSBkYXRhW2orK107XG4gICAgICAgICAgICAgIGNvZC54Y2IgPSAoZGF0YVtqKytdICYgMHhGKSArIDI7XG4gICAgICAgICAgICAgIGNvZC55Y2IgPSAoZGF0YVtqKytdICYgMHhGKSArIDI7XG4gICAgICAgICAgICAgIHZhciBibG9ja1N0eWxlID0gZGF0YVtqKytdO1xuICAgICAgICAgICAgICBjb2Quc2VsZWN0aXZlQXJpdGhtZXRpY0NvZGluZ0J5cGFzcyA9ICEhKGJsb2NrU3R5bGUgJiAxKTtcbiAgICAgICAgICAgICAgY29kLnJlc2V0Q29udGV4dFByb2JhYmlsaXRpZXMgPSAhIShibG9ja1N0eWxlICYgMik7XG4gICAgICAgICAgICAgIGNvZC50ZXJtaW5hdGlvbk9uRWFjaENvZGluZ1Bhc3MgPSAhIShibG9ja1N0eWxlICYgNCk7XG4gICAgICAgICAgICAgIGNvZC52ZXJ0aWNhbHlTdHJpcGUgPSAhIShibG9ja1N0eWxlICYgOCk7XG4gICAgICAgICAgICAgIGNvZC5wcmVkaWN0YWJsZVRlcm1pbmF0aW9uID0gISEoYmxvY2tTdHlsZSAmIDE2KTtcbiAgICAgICAgICAgICAgY29kLnNlZ21lbnRhdGlvblN5bWJvbFVzZWQgPSAhIShibG9ja1N0eWxlICYgMzIpO1xuICAgICAgICAgICAgICBjb2QucmV2ZXJzaWJsZVRyYW5zZm9ybWF0aW9uID0gZGF0YVtqKytdO1xuICAgICAgICAgICAgICBpZiAoY29kLmVudHJvcHlDb2RlcldpdGhDdXN0b21QcmVjaW5jdHMpIHtcbiAgICAgICAgICAgICAgICB2YXIgcHJlY2luY3RzU2l6ZXMgPSBbXTtcbiAgICAgICAgICAgICAgICB3aGlsZSAoaiA8IGxlbmd0aCArIHBvc2l0aW9uKSB7XG4gICAgICAgICAgICAgICAgICB2YXIgcHJlY2luY3RzU2l6ZSA9IGRhdGFbaisrXTtcbiAgICAgICAgICAgICAgICAgIHByZWNpbmN0c1NpemVzLnB1c2goe1xuICAgICAgICAgICAgICAgICAgICBQUHg6IHByZWNpbmN0c1NpemUgJiAweEYsXG4gICAgICAgICAgICAgICAgICAgIFBQeTogcHJlY2luY3RzU2l6ZSA+PiA0XG4gICAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgY29kLnByZWNpbmN0c1NpemVzID0gcHJlY2luY3RzU2l6ZXM7XG4gICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgdmFyIHVuc3VwcG9ydGVkID0gW107XG4gICAgICAgICAgICAgIGlmIChjb2Quc2VsZWN0aXZlQXJpdGhtZXRpY0NvZGluZ0J5cGFzcykge1xuICAgICAgICAgICAgICAgIHVuc3VwcG9ydGVkLnB1c2goJ3NlbGVjdGl2ZUFyaXRobWV0aWNDb2RpbmdCeXBhc3MnKTtcbiAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICBpZiAoY29kLnJlc2V0Q29udGV4dFByb2JhYmlsaXRpZXMpIHtcbiAgICAgICAgICAgICAgICB1bnN1cHBvcnRlZC5wdXNoKCdyZXNldENvbnRleHRQcm9iYWJpbGl0aWVzJyk7XG4gICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgaWYgKGNvZC50ZXJtaW5hdGlvbk9uRWFjaENvZGluZ1Bhc3MpIHtcbiAgICAgICAgICAgICAgICB1bnN1cHBvcnRlZC5wdXNoKCd0ZXJtaW5hdGlvbk9uRWFjaENvZGluZ1Bhc3MnKTtcbiAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICBpZiAoY29kLnZlcnRpY2FseVN0cmlwZSkge1xuICAgICAgICAgICAgICAgIHVuc3VwcG9ydGVkLnB1c2goJ3ZlcnRpY2FseVN0cmlwZScpO1xuICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgIGlmIChjb2QucHJlZGljdGFibGVUZXJtaW5hdGlvbikge1xuICAgICAgICAgICAgICAgIHVuc3VwcG9ydGVkLnB1c2goJ3ByZWRpY3RhYmxlVGVybWluYXRpb24nKTtcbiAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICBpZiAodW5zdXBwb3J0ZWQubGVuZ3RoID4gMCkge1xuICAgICAgICAgICAgICAgIGRvTm90UmVjb3ZlciA9IHRydWU7XG4gICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKCdKUFggRXJyb3I6IFVuc3VwcG9ydGVkIENPRCBvcHRpb25zICgnICtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdW5zdXBwb3J0ZWQuam9pbignLCAnKSArICcpJyk7XG4gICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgaWYgKGNvbnRleHQubWFpbkhlYWRlcikge1xuICAgICAgICAgICAgICAgIGNvbnRleHQuQ09EID0gY29kO1xuICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIGNvbnRleHQuY3VycmVudFRpbGUuQ09EID0gY29kO1xuICAgICAgICAgICAgICAgIGNvbnRleHQuY3VycmVudFRpbGUuQ09DID0gW107XG4gICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICBjYXNlIDB4RkY5MDogLy8gU3RhcnQgb2YgdGlsZS1wYXJ0IChTT1QpXG4gICAgICAgICAgICAgIGxlbmd0aCA9IHJlYWRVaW50MTYoZGF0YSwgcG9zaXRpb24pO1xuICAgICAgICAgICAgICB0aWxlID0ge307XG4gICAgICAgICAgICAgIHRpbGUuaW5kZXggPSByZWFkVWludDE2KGRhdGEsIHBvc2l0aW9uICsgMik7XG4gICAgICAgICAgICAgIHRpbGUubGVuZ3RoID0gcmVhZFVpbnQzMihkYXRhLCBwb3NpdGlvbiArIDQpO1xuICAgICAgICAgICAgICB0aWxlLmRhdGFFbmQgPSB0aWxlLmxlbmd0aCArIHBvc2l0aW9uIC0gMjtcbiAgICAgICAgICAgICAgdGlsZS5wYXJ0SW5kZXggPSBkYXRhW3Bvc2l0aW9uICsgOF07XG4gICAgICAgICAgICAgIHRpbGUucGFydHNDb3VudCA9IGRhdGFbcG9zaXRpb24gKyA5XTtcblxuICAgICAgICAgICAgICBjb250ZXh0Lm1haW5IZWFkZXIgPSBmYWxzZTtcbiAgICAgICAgICAgICAgaWYgKHRpbGUucGFydEluZGV4ID09PSAwKSB7XG4gICAgICAgICAgICAgICAgLy8gcmVzZXQgY29tcG9uZW50IHNwZWNpZmljIHNldHRpbmdzXG4gICAgICAgICAgICAgICAgdGlsZS5DT0QgPSBjb250ZXh0LkNPRDtcbiAgICAgICAgICAgICAgICB0aWxlLkNPQyA9IGNvbnRleHQuQ09DLnNsaWNlKDApOyAvLyBjbG9uZSBvZiB0aGUgZ2xvYmFsIENPQ1xuICAgICAgICAgICAgICAgIHRpbGUuUUNEID0gY29udGV4dC5RQ0Q7XG4gICAgICAgICAgICAgICAgdGlsZS5RQ0MgPSBjb250ZXh0LlFDQy5zbGljZSgwKTsgLy8gY2xvbmUgb2YgdGhlIGdsb2JhbCBDT0NcbiAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICBjb250ZXh0LmN1cnJlbnRUaWxlID0gdGlsZTtcbiAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICBjYXNlIDB4RkY5MzogLy8gU3RhcnQgb2YgZGF0YSAoU09EKVxuICAgICAgICAgICAgICB0aWxlID0gY29udGV4dC5jdXJyZW50VGlsZTtcbiAgICAgICAgICAgICAgaWYgKHRpbGUucGFydEluZGV4ID09PSAwKSB7XG4gICAgICAgICAgICAgICAgaW5pdGlhbGl6ZVRpbGUoY29udGV4dCwgdGlsZS5pbmRleCk7XG4gICAgICAgICAgICAgICAgYnVpbGRQYWNrZXRzKGNvbnRleHQpO1xuICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgLy8gbW92aW5nIHRvIHRoZSBlbmQgb2YgdGhlIGRhdGFcbiAgICAgICAgICAgICAgbGVuZ3RoID0gdGlsZS5kYXRhRW5kIC0gcG9zaXRpb247XG4gICAgICAgICAgICAgIHBhcnNlVGlsZVBhY2tldHMoY29udGV4dCwgZGF0YSwgcG9zaXRpb24sIGxlbmd0aCk7XG4gICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgY2FzZSAweEZGNTU6IC8vIFRpbGUtcGFydCBsZW5ndGhzLCBtYWluIGhlYWRlciAoVExNKVxuICAgICAgICAgICAgY2FzZSAweEZGNTc6IC8vIFBhY2tldCBsZW5ndGgsIG1haW4gaGVhZGVyIChQTE0pXG4gICAgICAgICAgICBjYXNlIDB4RkY1ODogLy8gUGFja2V0IGxlbmd0aCwgdGlsZS1wYXJ0IGhlYWRlciAoUExUKVxuICAgICAgICAgICAgY2FzZSAweEZGNjQ6IC8vIENvbW1lbnQgKENPTSlcbiAgICAgICAgICAgICAgbGVuZ3RoID0gcmVhZFVpbnQxNihkYXRhLCBwb3NpdGlvbik7XG4gICAgICAgICAgICAgIC8vIHNraXBwaW5nIGNvbnRlbnRcbiAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICBjYXNlIDB4RkY1MzogLy8gQ29kaW5nIHN0eWxlIGNvbXBvbmVudCAoQ09DKVxuICAgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoJ0pQWCBFcnJvcjogQ29kZXN0cmVhbSBjb2RlIDB4RkY1MyAoQ09DKSBpcyAnICtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdub3QgaW1wbGVtZW50ZWQnKTtcbiAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcignSlBYIEVycm9yOiBVbmtub3duIGNvZGVzdHJlYW0gY29kZTogJyArXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb2RlLnRvU3RyaW5nKDE2KSk7XG4gICAgICAgICAgfVxuICAgICAgICAgIHBvc2l0aW9uICs9IGxlbmd0aDtcbiAgICAgICAgfVxuICAgICAgfSBjYXRjaCAoZSkge1xuICAgICAgICBpZiAoZG9Ob3RSZWNvdmVyIHx8IHRoaXMuZmFpbE9uQ29ycnVwdGVkSW1hZ2UpIHtcbiAgICAgICAgICB0aHJvdyBlO1xuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgIHdhcm4oJ1RyeWluZyB0byByZWNvdmVyIGZyb20gJyArIGUubWVzc2FnZSk7XG4gICAgICAgIH1cbiAgICAgIH1cbiAgICAgIHRoaXMudGlsZXMgPSB0cmFuc2Zvcm1Db21wb25lbnRzKGNvbnRleHQpO1xuICAgICAgdGhpcy53aWR0aCA9IGNvbnRleHQuU0laLlhzaXogLSBjb250ZXh0LlNJWi5YT3NpejtcbiAgICAgIHRoaXMuaGVpZ2h0ID0gY29udGV4dC5TSVouWXNpeiAtIGNvbnRleHQuU0laLllPc2l6O1xuICAgICAgdGhpcy5jb21wb25lbnRzQ291bnQgPSBjb250ZXh0LlNJWi5Dc2l6O1xuICAgIH1cbiAgfTtcbiAgZnVuY3Rpb24gY2FsY3VsYXRlQ29tcG9uZW50RGltZW5zaW9ucyhjb21wb25lbnQsIHNpeikge1xuICAgIC8vIFNlY3Rpb24gQi4yIENvbXBvbmVudCBtYXBwaW5nXG4gICAgY29tcG9uZW50LngwID0gTWF0aC5jZWlsKHNpei5YT3NpeiAvIGNvbXBvbmVudC5YUnNpeik7XG4gICAgY29tcG9uZW50LngxID0gTWF0aC5jZWlsKHNpei5Yc2l6IC8gY29tcG9uZW50LlhSc2l6KTtcbiAgICBjb21wb25lbnQueTAgPSBNYXRoLmNlaWwoc2l6LllPc2l6IC8gY29tcG9uZW50LllSc2l6KTtcbiAgICBjb21wb25lbnQueTEgPSBNYXRoLmNlaWwoc2l6LllzaXogLyBjb21wb25lbnQuWVJzaXopO1xuICAgIGNvbXBvbmVudC53aWR0aCA9IGNvbXBvbmVudC54MSAtIGNvbXBvbmVudC54MDtcbiAgICBjb21wb25lbnQuaGVpZ2h0ID0gY29tcG9uZW50LnkxIC0gY29tcG9uZW50LnkwO1xuICB9XG4gIGZ1bmN0aW9uIGNhbGN1bGF0ZVRpbGVHcmlkcyhjb250ZXh0LCBjb21wb25lbnRzKSB7XG4gICAgdmFyIHNpeiA9IGNvbnRleHQuU0laO1xuICAgIC8vIFNlY3Rpb24gQi4zIERpdmlzaW9uIGludG8gdGlsZSBhbmQgdGlsZS1jb21wb25lbnRzXG4gICAgdmFyIHRpbGUsIHRpbGVzID0gW107XG4gICAgdmFyIG51bVh0aWxlcyA9IE1hdGguY2VpbCgoc2l6LlhzaXogLSBzaXouWFRPc2l6KSAvIHNpei5YVHNpeik7XG4gICAgdmFyIG51bVl0aWxlcyA9IE1hdGguY2VpbCgoc2l6LllzaXogLSBzaXouWVRPc2l6KSAvIHNpei5ZVHNpeik7XG4gICAgZm9yICh2YXIgcSA9IDA7IHEgPCBudW1ZdGlsZXM7IHErKykge1xuICAgICAgZm9yICh2YXIgcCA9IDA7IHAgPCBudW1YdGlsZXM7IHArKykge1xuICAgICAgICB0aWxlID0ge307XG4gICAgICAgIHRpbGUudHgwID0gTWF0aC5tYXgoc2l6LlhUT3NpeiArIHAgKiBzaXouWFRzaXosIHNpei5YT3Npeik7XG4gICAgICAgIHRpbGUudHkwID0gTWF0aC5tYXgoc2l6LllUT3NpeiArIHEgKiBzaXouWVRzaXosIHNpei5ZT3Npeik7XG4gICAgICAgIHRpbGUudHgxID0gTWF0aC5taW4oc2l6LlhUT3NpeiArIChwICsgMSkgKiBzaXouWFRzaXosI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kdGggPSAxIDw8IHhjYl87XG4gICAgdmFyIGNvZGVibG9ja0hlaWdodCA9IDEgPDwgeWNiXztcbiAgICB2YXIgY2J4MCA9IHN1YmJhbmQudGJ4MCA+PiB4Y2JfO1xuICAgIHZhciBjYnkwID0gc3ViYmFuZC50YnkwID4+IHljYl87XG4gICAgdmFyIGNieDEgPSAoc3ViYmFuZC50YngxICsgY29kZWJsb2NrV2lkdGggLSAxKSA+PiB4Y2JfO1xuICAgIHZhciBjYnkxID0gKHN1YmJhbmQudGJ5MSArIGNvZGVibG9ja0hlaWdodCAtIDEpID4+IHljYl87XG4gICAgdmFyIHByZWNpbmN0UGFyYW1ldGVycyA9IHN1YmJhbmQucmVzb2x1dGlvbi5wcmVjaW5jdFBhcmFtZXRlcnM7XG4gICAgdmFyIGNvZGVibG9ja3MgPSBbXTtcbiAgICB2YXIgcHJlY2luY3RzID0gW107XG4gICAgdmFyIGksIGosIGNvZGVibG9jaywgcHJlY2luY3ROdW1iZXI7XG4gICAgZm9yIChqID0gY2J5MDsgaiA8IGNieTE7IGorKykge1xuICAgICAgZm9yIChpID0gY2J4MDsgaSA8IGNieDE7IGkrKykge1xuICAgICAgICBjb2RlYmxvY2sgPSB7XG4gICAgICAgICAgY2J4OiBpLFxuICAgICAgICAgIGNieTogaixcbiAgICAgICAgICB0YngwOiBjb2RlYmxvY2tXaWR0aCAqIGksXG4gICAgICAgICAgdGJ5MDogY29kZWJsb2NrSGVpZ2h0ICogaixcbiAgICAgICAgICB0YngxOiBjb2RlYmxvY2tXaWR0aCAqIChpICsgMSksXG4gICAgICAgICAgdGJ5MTogY29kZWJsb2NrSGVpZ2h0ICogKGogKyAxKVxuICAgICAgICB9O1xuXG4gICAgICAgIGNvZGVibG9jay50YngwXyA9IE1hdGgubWF4KHN1YmJhbmQudGJ4MCwgY29kZWJsb2NrLnRieDApO1xuICAgICAgICBjb2RlYmxvY2sudGJ5MF8gPSBNYXRoLm1heChzdWJiYW5kLnRieTAsIGNvZGVibG9j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mxvY2sudGJ4MV8gPD0gY29kZWJsb2NrLnRieDBfIHx8XG4gICAgICAgICAgICBjb2RlYmxvY2sudGJ5MV8gPD0gY29kZWJsb2NrLnRieTBfKSB7XG4gICAgICAgICAgY29udGludWU7XG4gICAgICAgIH1cbiAgICAgICAgY29kZWJsb2Nrcy5wdXNoKGNvZGVibG9jayk7XG4gICAgICAgIC8vIGJ1aWxkaW5nIHByZWNpbmN0IGZvciB0aGUgc3ViLWJhbmRcbiAgICAgICAgdmFyIHByZWNpbmN0ID0gcHJlY2luY3RzW3ByZWNpbmN0TnVtYmVyXTtcbiAgICAgICAgaWYgKHByZWNpbmN0ICE9PSB1bmRlZmluZWQpIHtcbiAgICAgICAgICBpZiAoaSA8IHByZWNpbmN0LmNieE1pbikge1xuICAgICAgICAgICAgcHJlY2luY3QuY2J4TWluID0gaTtcbiAgICAgICAgICB9IGVsc2UgaWYgKGkgPiBwcmVjaW5jdC5jYnhNYXgpIHtcbiAgICAgICAgICAgIHByZWNpbmN0LmNieE1heCA9IGk7XG4gICAgICAgICAgfVxuICAgICAgICAgIGlmIChqIDwgcHJlY2luY3QuY2J5TWluKSB7XG4gICAgICAgICAgICBwcmVjaW5jdC5jYnhNaW4gPSBqO1xuICAgICAgICAgIH0gZWxzZSBpZiAoaiA+IHByZWNpbmN0LmNieU1heCkge1xuICAgICAgICAgICAgcHJlY2luY3QuY2J5TWF4ID0gajtcbiAgICAgICAgICB9XG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgcHJlY2luY3RzW3ByZWNpbmN0TnVtYmVyXSA9IHByZWNpbmN0ID0ge1xuICAgICAgICAgICAgY2J4TWluOiBpLFxuICAgICAgICAgICAgY2J5TWluOiBqLFxuICAgICAgICAgICAgY2J4TWF4OiBpLFxuICAgICAgICAgICAgY2J5TWF4OiBqXG4gICAgICAgICAgfTtcbiAgICAgICAgfVxuICAgICAgICBjb2RlYmxvY2sucHJlY2luY3QgPSBwcmVjaW5jdDtcbiAgICAgIH1cb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xuICAgICAgLy8gU2VjdGlvbiBCLjEyLjEuMSBMYXllci1yZXNvbHV0aW9uLWNvbXBvbmVudC1wb3NpdGlvblxuICAgICAgZm9yICg7IGwgPCBsYXllcnNDb3VudDsgbCsrKSB7XG4gICAgICAgIGZvciAoOyByIDw9IG1heERlY29tcG9zaXRpb25MZXZlbHNDb3VudDsgcisrKSB7XG4gICAgICAgICAgZm9yICg7IGkgPCBjb21wb25lbnRzQ291bnQ7IGkrKykge1xuICAgICAgICAgICAgdmFyIGNvbXBvbmVudCA9IHRpbGUuY29tcG9uZW50c1tpXTtcbiAgICAgICAgICAgIGlmIChyID4gY29tcG9uZW50LmNvZGluZ1N0eWxlUGFyYW1ldGVycy5kZWNvbXBvc2l0aW9uTGV2ZWxzQ291bnQpIHtcbiAgICAgICAgICAgICAgY29udGludWU7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHZhciByZXNvbHV0aW9uID0gY29tcG9uZW50LnJlc29sdXRpb25zW3JdO1xuICAgICAgICAgICAgdmFyIG51bXByZWNpbmN0cyA9IHJlc29sdXRpb24ucHJlY2luY3RQYXJhbWV0ZXJzLm51bXByZWNpbmN0cztcbiAgICAgICAgICAgIGZvciAoOyBrIDwgbnVtcHJlY2luY3RzOykge1xuICAgICAgICAgICAgICB2YXIgcGFja2V0ID0gY3JlYXRlUGFja2V0KHJlc29sdXRpb24sIGssIGwpO1xuICAgICAgICAgICAgICBrKys7XG4gICAgICAgICAgICAgIHJldHVybiBwYWNrZXQ7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBrID0gMDtcbiAgICAgICAgICB9XG4gICAgICAgICAgaSA9IDA7XG4gICAgICAgIH1cbiAgICAgICAgciA9IDA7XG4gICAgICB9XG4gICAgfTtcbiAgfVxuICBmdW5jdGlvbiBSZXNvbHV0aW9uTGF5ZXJDb21wb25lbnRQb3NpdGlvbkl0ZXJhdG9yKGNvbnRleHQpIHtcbiAgICB2YXIgc2l6ID0gY29udGV4dC5TSVo7XG4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WxlUGFyYW1ldGVycy5kZWNvbXBvc2l0aW9uTGV2ZWxzQ291bnQpIHtcbiAgICAgICAgICAgICAgY29udGludWU7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHZhciByZXNvbHV0aW9uID0gY29tcG9uZW50LnJlc29sdXRpb25zW3JdO1xuICAgICAgICAgICAgdmFyIG51bXByZWNpbmN0cyA9IHJlc29sdXRpb24ucHJlY2luY3RQYXJhbWV0ZXJzLm51bXByZWNpbmN0cztcbiAgICAgICAgICAgIGZvciAoOyBrIDwgbnVtcHJlY2luY3RzOykge1xuICAgICAgICAgICAgICB2YXIgcGFja2V0ID0gY3JlYXRlUGFja2V0KHJlc29sdXRpb24sIGssIGwpO1xuICAgICAgICAgICAgICBrKys7XG4gICAgICAgICAgICAgIHJldHVybiBwYWNrZXQ7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBrID0gMDtcbiAgICAgICAgICB9XG4gICAgICAgICAgaSA9IDA7XG4gICAgICAgIH1cbiAgICAgICAgbCA9IDA7XG4gICAgICB9XG4gICAgfTtcbiAgfVxuICBmdW5jdGlvbiBSZXNvbHV0aW9uUG9zaXRpb25Db21wb25lbnRMYXllckl0ZXJhdG9yKGNvbnRleHQpIHtcbiAgICB2YXIgc2l6ID0gY29udGV4dC5TSVo7XG4gICAgdmFyIHRpbGVJbmRleCA9IGNvbnRleHQuY3VycmVudFRpbGUuaW5kZXg7XG4gICAgdmFyIHRpbGUgPSBjb250ZXh0LnRpbGVzW3RpbGVJbmRleF07XG4gICAgdmFyIGxheWVyc0NvdW50ID0gdGlsZS5jb2RpbmdTdHlsZURlZmF1bHRQYXJhbWV0ZXJzLmxheWVyc0NvdW50O1xuICAgIHZhciBjb21wb25lbnRzQ291bnQgPSBzaXouQ3NpejtcbiAgICB2YXIgbCwgciwgYywgcDtcbiAgICB2YXIgbWF4RGVjb21wb3NpdGlvbkxldmVsc0NvdW50ID0gMDtcbiAgICBmb3IgKGMgPSAwOyBjIDwgY29tcG9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xuICAgICAgLy8gU2VjdGlvbiBCLjEyLjEuMyBSZXNvbHV0aW9uLXBvc2l0aW9uLWNvbXBvbmVudC1sYXllclxuICAgICAgZm9yICg7IHIgPD0gbWF4RGVjb21wb3NpdGlvbkxldmVsc0NvdW50OyByKyspIHtcbiAgICAgICAgZm9yICg7IHAgPCBtYXhOdW1QcmVjaW5jdHNJbkxldmVsW3JdOyBwKyspIHtcbiAgICAgICAgICBmb3IgKDsgYyA8IGNvbXBvbmVudHNDb3VudDsgYysrKSB7XG4gICAgICAgICAgICB2YXIgY29tcG9uZW50ID0gdGlsZS5jb21wb25lbnRzW2NdO1xuICAgICAgICAgICAgaWYgKHIgPiBjb21wb25lbnQuY29kaW5nU3R5bGVQYXJhbWV0ZXJzLmRlY29tcG9zaXRpb25MZXZlbHNDb3VudCkge1xuICAgICAgICAgICAgICBjb250aW51ZTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHZhciByZXNvbHV0aW9uID0gY29tcG9uZW50LnJlc29sdXRpb25zW3JdO1xuICAgICAgICAgICAgdmFyIG51bXByZWNpbmN0cyA9IHJlc29sdXRpb24ucHJlY2luY3RQYXJhbWV0ZXJzLm51bXByZWNpbmN0cztcbiAgICAgICAgICAgIGlmIChwID49IG51bXByZWNpbmN0cykge1xuICAgICAgICAgICAgICBjb250aW51ZTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGZvciAoOyBsIDwgbGF5ZXJzQ291bnQ7KSB7XG4gICAgICAgICAgICAgIHZhciBwYWNrZXQgPSBjcmVhdGVQYWNrZXQocmVzb2x1dGlvbiwgcCwgbCk7XG4gICAgICAgICAgICAgIGwrKztcbiAgICAgICAgICAgICAgcmV0dXJuIHBhY2tldDtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGwgPSAwO1xuICAgICAgICAgIH1cbiAgICAgICAgICBjID0gMDtcbiAgICAgICAgfVxuICAgICAgICBwID0gMDtcbiAgICAgIH1cbiAgICB9O1xuICB9XG4gIGZ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ID1cbiAgICAgICAgICAgICAgY29tcG9uZW50LmNvZGluZ1N0eWxlUGFyYW1ldGVycy5kZWNvbXBvc2l0aW9uTGV2ZWxzQ291bnQ7XG4gICAgICAgICAgICBmb3IgKDsgciA8PSBkZWNvbXBvc2l0aW9uTGV2ZWxzQ291bnQ7IHIrKykge1xuICAgICAgICAgICAgICB2YXIgcmVzb2x1dGlvbiA9IGNvbXBvbmVudC5yZXNvbHV0aW9uc1tyXTtcbiAgICAgICAgICAgICAgdmFyIHNpemVJbkltYWdlU2NhbGUgPVxuICAgICAgICAgICAgICAgIHByZWNpbmN0c1NpemVzLmNvbXBvbmVudHNbY10ucmVzb2x1dGlvbnNbcl07XG4gICAgICAgICAgICAgIHZhciBrID0gZ2V0UHJlY2luY3RJbmRleElmRXhpc3QoXG4gICAgICAgICAgICAgICAgcHgsXG4gICAgICAgICAgICAgICAgcHksXG4gICAgICAgICAgICAgICAgc2l6ZUluSW1hZ2VTY2FsZSxcbiAgICAgICAgICAgICAgICBwcmVjaW5jdHNJdGVyYXRpb25TaXplcyxcbiAgICAgICAgICAgICAgICByZXNvbHV0aW9uKTtcbiAgICAgICAgICAgICAgaWYgKGsgPT09IG51bGwpIHtcbiAgICAgICAgICAgICAgICBjb250aW51ZTtcbiAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICBmb3IgKDsgbCA8IGxheWVyc0NvdW50Oykge1xuICAgICAgICAgICAgICAgIHZhciBwYWNrZXQgPSBjcmVhdGVQYWNrZXQocmVzb2x1dGlvbiwgaywgbCk7XG4gICAgICAgICAgICAgICAgbCsrO1xuICAgICAgICAgICAgICAgIHJldHVybiBwYWNrZXQ7XG4gICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgbCA9IDA7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICByID0gMDtcbiAgICAgICAgICB9XG4gICAgICAgICAgYyA9IDA7XG4gICAgICAgIH1cbiAgICAgICAgcHggPSAwO1xuICAgICAgfVxuICAgIH07XG4gIH1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VtSGlnaDsgcHkrKykge1xuICAgICAgICAgIGZvciAoOyBweCA8IHByZWNpbmN0c0l0ZXJhdGlvblNpemVzLm1heE51bVdpZGU7IHB4KyspIHtcbiAgICAgICAgICAgIGZvciAoOyByIDw9IGRlY29tcG9zaXRpb25MZXZlbHNDb3VudDsgcisrKSB7XG4gICAgICAgICAgICAgIHZhciByZXNvbHV0aW9uID0gY29tcG9uZW50LnJlc29sdXRpb25zW3JdO1xuICAgICAgICAgICAgICB2YXIgc2l6ZUluSW1hZ2VTY2FsZSA9IHByZWNpbmN0c0l0ZXJhdGlvblNpemVzLnJlc29sdXRpb25zW3JdO1xuICAgICAgICAgICAgICB2YXIgayA9IGdldFByZWNpbmN0SW5kZXhJZkV4aXN0KFxuICAgICAgICAgICAgICAgIHB4LFxuICAgICAgICAgICAgICAgIHB5LFxuICAgICAgICAgICAgICAgIHNpemVJbkltYWdlU2NhbGUsXG4gICAgICAgICAgICAgICAgcHJlY2luY3RzSXRlcmF0aW9uU2l6ZXMsXG4gICAgICAgICAgICAgICAgcmVzb2x1dGlvbik7XG4gICAgICAgICAgICAgIGlmIChrID09PSBudWxsKSB7XG4gICAgICAgICAgICAgICAgY29udGludWU7XG4gICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgZm9yICg7IGwgPCBsYXllcnNDb3VudDspIHtcbiAgICAgICAgICAgICAgICB2YXIgcGFja2V0ID0gY3JlYXRlUGFja2V0KHJlc29sdXRpb24sIGssIGwpO1xuICAgICAgICAgICAgICAgIGwrKztcbiAgICAgICAgICAgICAgICByZXR1cm4gcGFja2V0O1xuICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgIGwgPSAwO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgciA9IDA7XG4gICAgICAgICAgfVxuICAgICAgICAgIHB4ID0gMDtcbiAgICAgICAgfVxuICAgICAgICBweSA9IDA7XG4gICAgICB9XG4gICAgfTtcbiAgfVxuICBmdW5jdGlvbiBnZXRQcmVjaW5jdEluZ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E1hdGgubWluKFxuICAgICAgICAgIG1pbldpZHRoQ3VycmVudENvbXBvbmVudCxcbiAgICAgICAgICB3aWR0aEN1cnJlbnRSZXNvbHV0aW9uKTtcbiAgICAgICAgbWluSGVpZ2h0Q3VycmVudENvbXBvbmVudCA9IE1hdGgubWluKFxuICAgICAgICAgIG1pbkhlaWdodEN1cnJlbnRDb21wb25lbnQsXG4gICAgICAgICAgaGVpZ2h0Q3VycmVudFJlc29sdXRpb24pO1xuICAgICAgICBtYXhOdW1XaWRlQ3VycmVudENvbXBvbmVudCA9IE1hdGgubWF4KG1heE51bVdpZGVDdXJyZW50Q29tcG9uZW50LFxuICAgICAgICAgIHJlc29sdXRpb24ucHJlY2luY3RQYXJhbWV0ZXJzLm51bXByZWNpbmN0c3dpZGUpO1xuICAgICAgICBtYXhOdW1IaWdoQ3VycmVudENvbXBvbmVudCA9IE1hdGgubWF4KG1heE51bUhpZ2hDdXJyZW50Q29tcG9uZW50LFxuICAgICAgICAgIHJlc29sdXRpb24ucHJlY2luY3RQYXJhbWV0ZXJzLm51bXByZWNpbmN0c2hpZ2gpO1xuICAgICAgICBzaXplUGVyUmVzb2x1dGlvbltyXSA9IHtcbiAgICAgICAgICB3aWR0aDogd2lkdGhDdXJyZW50UmVzb2x1dGlvbixcbiAgICAgICAgICBoZWlnaHQ6IGhlaWdodEN1cnJlbnRSZXNvbHV0aW9uXG4gICAgICAgIH07XG4gICAgICAgIHNjYWxlIDw8PSAxO1xuICAgICAgfVxuICAgICAgbWluV2lkdGggPSBNYXRoLm1pbihtaW5XaWR0aCwgbWluV2lkdGhDdXJyZW50Q29tcG9uZW50KTtcbiAgICAgIG1pbkhlaWdodCA9IE1hdGgubWluKG1pbkhlaWdodCwgbWluSGVpZ2h0Q3VycmVudENvbXBvbmVudCk7XG4gICAgICBtYXhOdW1XaWRlID0gTWF0aC5tYXgobWF4TnVtV2lkZSwgbWF4TnVtV2lkZUN1cnJlbnRDb21wb25lbnQpO1xuICAgICAgbWF4Tn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lZSddICE9PSB1bmRlZmluZWQpIHtcbiAgICAgICAgICAgICAgaW5jbHVzaW9uVHJlZSA9IHByZWNpbmN0LmluY2x1c2lvblRyZWU7XG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAvLyBidWlsZGluZyBpbmNsdXNpb24gYW5kIHplcm8gYml0LXBsYW5lcyB0cmVlc1xuICAgICAgICAgICAgICB2YXIgd2lkdGggPSBwcmVjaW5jdC5jYnhNYXggLSBwcmVjaW5jdC5jYnhNaW4gKyAxO1xuICAgICAgICAgICAgICB2YXIgaGVpZ2h0ID0gcHJlY2luY3QuY2J5TWF4IC0gcHJlY2luY3QuY2J5TWluICsgMTtcbiAgICAgICAgICAgICAgaW5jbHVzaW9uVHJlZSA9IG5ldyBJbmNsdXNpb25UcmVlKHdpZHRoLCBoZWlnaHQpO1xuICAgICAgICAgICAgICB6ZXJvQml0UGxhbmVzVHJlZSA9IG5ldyBUYWdUcmVlKHdpZHRoLCBoZWlnaHQpO1xuICAgICAgICAgICAgICBwcmVjaW5jdC5pbmNsdXNpb25UcmVlID0gaW5jbHVzaW9uVHJlZTtcbiAgICAgICAgICAgICAgcHJlY2luY3QuemVyb0JpdFBsYW5lc1RyZWUgPSB6ZXJvQml0UGxhbmVzVHJlZTtcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgaW5jbHVzaW9uVHJlZS5yZXNldChjb2RlYmxvY2tDb2x1bW4sIGNvZGVibG9ja1JvdywgbGF5ZXJOdW1iZXIpO1xuICAgICAgICAgICAgd2hpbGUgKHRydWUpIHtcbiAgICAgICAgICAgICAgaWYgKHBvc2l0aW9uID49IGRhdGEubGVuZ3RoKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgIGlmIChpbmNsdXNpb25UcmVlLmlzQWJvdmVUaHJlc2hvbGQoKSl7XG4gICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgaWYgKGluY2x1c2lvblRyZWUuaXNLbm93bigpKSB7XG4gICAgICAgICAgICAgICAgaW5jbHVzaW9uVHJlZS5uZXh0TGV2ZWwoKTtcbiAgICAgICAgICAgICAgICBjb250aW51ZTtcbiAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICBpZiAocmVhZEJpdHMoMSkpIHtcbiAgICAgICAgICAgICAgICBpbmNsdXNpb25UcmVlLnNldEtub3duKCk7XG4gICAgICAgICAgICAgICAgaWYgKGluY2x1c2lvblRyZWUuaXNMZWFmKCkpIHtcbiAgICAgICAgICAgICAgICAgIGNvZGVibG9jay5pbmNsdWRlZCA9IHRydWU7XG4gICAgICAgICAgICAgICAgICBjb2RlYmxvY2tJbmNsdWRlZCA9IGZpcnN0VGltZUluY2x1c2lvbiA9IHRydWU7XG4gICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgaW5jbHVzaW9uVHJlZS5uZXh0TGV2ZWwoKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgaW5jbHVzaW9uVHJlZS5pbmNyZW1lbnRWYWx1ZSgpO1xuICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgICAgfVxuICAgICAgICAgIGlmICghY29kZWJsb2NrSW5jbHVkZWQpIHtcbiAgICAgICAgICAgIGNvbnRpbnVlO1xuICAgICAgICAgIH1cbiAgICAgICAgICBpZiAoZmlyc3RUaW1lSW5jbHVzaW9uKSB7XG4gICAgICAgICAgICB6ZXJvQml0UGxhbmVzVHJlZSA9IHByZWNpbmN0Lnplcm9CaXRQbGFuZXNUcmVlO1xuICAgICAgICAgICAgemVyb0JpdFBsYW5lc1RyZWUucmVzZXQoY29kZWJsb2NrQ29sdW1uLCBjb2RlYmxvY2tSb3cpO1xuICAgICAgICAgICAgd2hpbGUgKHRydWUpIHtcbiAgICAgICAgICAgICAgaWYgKHBvc2l0aW9uID49IGRhdGEubGVuZ3RoKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgIGlmIChyZWFkQml0cygxKSkge1xuICAgICAgICAgICAgICAgIHZhbHVlUmVhZHkgPSAhemVyb0JpdFBsYW5lc1RyZWUubmV4dExldmVsKCk7XG4gICAgICAgICAgICAgICAgaWYgKHZhbHVlUmVhZHkpIHtcbiAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICB6ZXJvQml0UGxhbmVzVHJlZS5pbmNyZW1lbnRWYWx1ZSgpO1xuICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBjb2RlYmxvY2suemVyb0JpdFBsYW5lcyA9IHplcm9CaXRQbGFuZXNUcmVlLnZhbHVlO1xuICAgICAgICAgIH1cbiAgICAgICAgICB2YXIgY29kaW5ncGFzc2VzID0gcmVhZENvZGluZ3Bhc3NlcygpO1xuICAgICAgICAgIHdoaWxlIChyZWFkQml0cygxKSkge1xuICAgICAgICAgICAgY29kZWJsb2NrLkxibG9jaysrO1xuICAgICAgICAgIH1cbiAgICAgICAgICB2YXIgY29kaW5ncGFzc2VzTG9nMiA9IGxvZzIoY29kaW5ncGFzc2VzKTtcbiAgICAgICAgICAvLyByb3VuZGluZyBkb3duIGxvZzJcbiAgICAgICAgICB2YXIgYml0cyA9ICgoY29kaW5ncGFzc2VzIDwgKDEgPDwgY29kaW5ncGFzc2VzTG9nMikpID9cbiAgICAgICAgICAgICAgICAgICAgICBjb2RpbmdwYXNzZXNMb2cyIC0gMSA6IGNvZGluZ3Bhc3Nlc0xvZzIpICsgY29kZWJsb2NrLkxibG9jaztcbiAgICAgICAgICB2YXIgY29kZWREYXRhTGVuZ3RoID0gcmVhZEJpdHMoYml0cyk7XG4gICAgICAgICAgcXVldWUucHVzaCh7XG4gICAgICAgICAgICBjb2RlYmxvY2s6IGNvZGVibG9jayxcbiAgICAgICAgICAgIGNvZGluZ3Bhc3NlczogY29kaW5ncGFzc2VzLFxuICAgICAgICAgICAgZGF0YUxlbmd0aDogY29kZWREYXRhTGVuZ3RoXG4gICAgICAgICAgfSk7XG4gICAgICAgIH1cbiAgICAgICAgYWxpZ25Ub0J5dGUoKTtcbiAgICAgICAgaWYgKGVwaE1hcmtlclVzZWQpIHtcbiAgICAgICAgICBza2lwTWFya2VySWZFcXVhbCgweDkyKTtcbiAgICAgICAgfVxuICAgICAgICB3aGlsZSAocXVldWUubGVuZ3RoID4gMCkge1xuICAgICAgICAgIHZhciBwYWNrZXRJdGVtID0gcXVldWUuc2hpZnQoKTtcbiAgICAgICAgICBjb2RlYmxvY2sgPSBwYWNrZXRJdGVtLmNvZGVibG9jaztcbiAgICAgICAgICBpZiAoY29kZWJsb2NrWydkYXRhJ10gPT09IHVuZGVmaW5lZCkge1xuICAgICAgICAgICAgY29kZWJsb2NrLmRhdGEgPSBbXTtcbiAgICAgICAgICB9XG4gICAgICAgICAgY29kZWJsb2NrLmRhdGEucHVzaCh7XG4gICAgICAgICAgICBkYXRhOiBkYXRhLFxuICAgICAgICAgICAgc3RhcnQ6IG9mZnNldCArIHBvc2l0aW9uLFxuICAgICAgICAgICAgZW5kOiBvZmZzZXQgKyBwb3NpdGlvbiArIHBhY2tldEl0ZW0uZGF0YUxlbmd0aCxcbiAgICAgICAgICAgIGNvZGluZ3Bhc3NlczogcGFja2V0SXRlbS5jb2RpbmdwYXNzZXNcbiAgICAgICAgICB9KTtcbiAgICAgICAgICBwb3NpdGlvbiArPSBwYWNrZXRJdGVtLmRhdGFMZW5ndGg7XG4gICAgICAgIH1cbiAgICAgIH0gY2F0Y2ggKGUpIHtcbiAgICAgICAgcmV0dXJuO1xuICAgICAgfVxuICAgIH1cbiAgICByZXR1cm4gcG9zaXRpb247XG4gIH1cbiAgZnVuY3Rpb24gY29weUNvZWZmaWNpZW50cyhjb2VmZmljaWVudHMsIGxldmVsV2lkdGgsIGxldmVsSGVpZ2h0LCBzdWJiYW5kLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRlbHRhLCBtYiwgcmV2ZXJzaWJsZSwgc2VnbWVudGF0aW9uU3ltYm9sVXNlZCkge1xuICAgIHZhciB4MCA9IHN1YmJhbmQudGJ4MDtcbiAgICB2YXIgeTAgPSBzdWJiYW5kLnRieTA7XG4gICAgdmFyIHdpZHRoID0gc3ViYmFuZC50YngxIC0gc3ViYmFuZC50YngwO1xuICAgIHZhciBjb2RlYmxvY2tzID0gc3ViYmFuZC5jb2RlYmxvY2tzO1xuICAgIHZhciByaWdodCA9IHN1YmJhbmQudHlwZS5jaGFyQXQoMCkgPT09ICdIJyA/IDEgOiAwO1xuICAgIHZhciBib3R0b20gPSBzdWJiYW5kLnR5cGUuY2hhckF0KDEpID09PSAnSCcgPyBsZXZlbFdpZHRoIDogMDtcblxuICAgIGZvciAodmFyIGkgPSAwLCBpaSA9IGNvZGVibG9ja3MubGVuZ3RoOyBpIDwgaWk7ICsraSkge1xuICAgICAgdmFyIGNvZGVibG9jayA9IGNvZGVibG9ja3NbaV07XG4gICAgICB2YXIgYmxvY2tXaWR0aCA9IGNvZGVibG9jay50YngxXyAtIGNvZGVibG9jay50YngwXztcbiAgICAgIHZhciBibG9ja0hlaWdodCA9IGNvZGVibG9jay50YnkxXyAtIGNvZGVibG9jay50YnkwXztcbiAgICAgIGlmIChibG9ja1dpZHRoID09PSAwIHx8IGJsb2NrSGVpZ2h0ID09PSAwKSB7XG4gICAgICAgIGNvbnRpbnVlO1xuICAgICAgfVxuICAgICAgaWYgKGNvZGVibG9ja1snZGF0YSddID09PSB1bmRlZmluZWQpIHtcbiAgICAgICAgY29udGludWU7XG4gICAgICB9XG5cbiAgICAgIHZhciBiaXRNb2RlbCwgY3VycmVudENvZGluZ3Bhc3NUeXBlO1xuICAgICAgYml0TW9kZW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gIH1cbiAgICAgIC8vIGRlY29kaW5nIHRoZSBpdGVtXG4gICAgICB2YXIgZGVjb2RlciA9IG5ldyBBcml0aG1ldGljRGVjb2RlcihlbmNvZGVkRGF0YSwgMCwgdG90YWxMZW5ndGgpO1xuICAgICAgYml0TW9kZWwuc2V0RGVjb2RlcihkZWNvZGVyKTtcblxuICAgICAgZm9yIChqID0gMDsgaiA8IGNvZGluZ3Bhc3NlczsgaisrKSB7XG4gICAgICAgIHN3aXRjaCAoY3VycmVudENvZGluZ3Bhc3NUeXBlKSB7XG4gICAgICAgICAgY2FzZSAwOlxuICAgICAgICAgICAgYml0TW9kZWwucnVuU2lnbmlmaWNhbmNlUHJvcG9nYXRpb25QYXNzKCk7XG4gICAgICAgICAgICBicmVhaztcbiAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICBiaXRNb2RlbC5ydW5NYWduaXR1ZGVSZWZpbmVtZW50UGFzcygpO1xuICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgY2FzZSAyOlxuICAgICAgICAgICAgYml0TW9kZWwucnVuQ2xlYW51cFBhc3MoKTtcbiAgICAgICAgICAgIGlmIChzZWdtZW50YXRpb25TeW1ib2xVc2VkKSB7XG4gICAgICAgICAgICAgIGJpdE1vZGVsLmNoZWNrU2VnbWVudGF0aW9uU3ltYm9sKCk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBicmVhaztcbiAgICAgICAgfVxuICAgICAgICBjdXJyZW50Q29kaW5ncGFzc1R5cGUgPSAoY3VycmVudENvZGluZ3Bhc3NUeXBlICsgMSkgJSAzO1xuICAgICAgfVxuXG4gICAgICB2YXIgb2Zmc2V0ID0gKGNvZGVibG9jay50YngwXyAtIHgwKSArIChjb2RlYmxvY2sudGJ5MF8gLSB5MCkgKiB3aWR0aDtcbiAgICAgIHZhciBzaWduID0gYml0TW9kZWwuY29lZmZpY2VudHNTaWduO1xuICAgICAgdmFyIG1hZ25pdHVkZSA9IGJpdE1vZGVsLmNvZWZmaWNlbnRzTWFnbml0dWRlO1xuICAgICAgdmFyIGJpdHNEZWNvZGVkID0gYml0TW9kZWwuYml0c0RlY29kZWQ7XG4gICAgICB2YXIgbWFnbml0dWRlQ29ycmVjdGlvbiA9IHJldmVyc2libGUgPyAwIDogMC41O1xuICAgICAgdmFyIGssIG4sIG5iO1xuICAgICAgcG9zaXRpb24gPSAwO1xuICAgICAgLy8gRG8gdGhlIGludGVybGVhdmluZyBvZiBTZWN0aW9uIEYuMy4zIGhlcmUsIHNvIHdlIGRvIG5vdCBuZWVkXG4gICAgICAvLyB0byBjb3B5IGxhdGVyLiBMTCBsZXZlbCBpcyBub3QgaW50ZXJsZWF2ZWQsIGp1c3QgY29waWVkLlxuICAgICAgdmFyIGludGVybGVhdmUgPSAoc3ViYmFuZC50eXBlICE9PSAnTEwnKTtcbiAgICAgIGZvciAoaiA9IDA7IGogPCBibG9ja0hlaWdodDsgaisrKSB7XG4gICAgICAgIHZhciByb3cgPSAob2Zmc2V0IC8gd2lkdGgpIHwgMDsgLy8gcm93IGluIHRoZSBub24taW50ZXJsZWF2ZWQgc3ViYmFuZFxuICAgICAgICB2YXIgbGV2ZWxPZmZzZXQgPSAyICogcm93ICogKGxldmVsV2lkdGggLSB3aWR0aCkgKyByaWdodCArIGJvdHRvbTtcbiAgICAgICAgZm9yIChrID0gMDsgayA8IGJsb2NrV2lkdGg7IGsrKykge1xuICAgICAgICAgIG4gPSBtYWduaXR1ZGVbcG9zaXRpb25dO1xuICAgICAgICAgIGlmIChuICE9PSAwKSB7XG4gICAgICAgICAgICBuID0gKG4gKyBtYWduaXR1ZGVDb3JyZWN0aW9uKSAqIGRlbHRhO1xuICAgICAgICAgICAgaWYgKHNpZ25bcG9zaXRpb25dICE9PSAwKSB7XG4gICAgICAgICAgICAgIG4gPSAtbjtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIG5iID0gYml0c0RlY29kZWRbcG9zaXRpb25dO1xuICAgICAgICAgICAgdmFyIHBvcyA9IGludGV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ZW50MCA9IHRpbGUuY29tcG9uZW50c1swXTtcbiAgICAgICAgdmFyIGFscGhhMDEgPSBjb21wb25lbnRzQ291bnQgLSAzO1xuICAgICAgICBqaiA9IHkwaXRlbXMubGVuZ3RoO1xuICAgICAgICBpZiAoIWNvbXBvbmVudDAuY29kaW5nU3R5bGVQYXJhbWV0ZXJzLnJldmVyc2libGVUcmFuc2Zvcm1hdGlvbikge1xuICAgICAgICAgIC8vIGludmVyc2UgaXJyZXZlcnNpYmxlIG11bHRpcGxlIGNvbXBvbmVudCB0cmFuc2Zvcm1cbiAgICAgICAgICBmb3IgKGogPSAwOyBqIDwgamo7IGorKywgcG9zICs9IGFscGhhMDEpIHtcbiAgICAgICAgICAgIHkwID0geTBpdGVtc1tqXSArIG9mZnNldDtcbiAgICAgICAgICAgIHkxID0geTFpdGVtc1tqXTtcbiAgICAgICAgICAgIHkyID0geTJpdGVtc1tqXTtcbiAgICAgICAgICAgIHIgPSB5MCArIDEuNDAyICogeTI7XG4gICAgICAgICAgICBnID0geTAgLSAwLjM0NDEzICogeTEgLSAwLjcxNDE0ICogeTI7XG4gICAgICAgICAgICBiID0geTAgKyAxLjc3MiAqIHkxO1xuICAgICAgICAgICAgb3V0W3BvcysrXSA9IHIgPD0gMCA/IDAgOiByID49IG1heCA/IDI1NSA6IHIgPj4gc2hpZnQ7XG4gICAgICAgICAgICBvdXRbcG9zKytdID0gZyA8PSAwID8gMCA6IGcgPj0gbWF4ID8gMjU1IDogZyA+PiBzaGlmdDtcbiAgICAgICAgICAgIG91dFtwb3MrK10gPSBiIDw9IDAgPyAwIDogYiA+PSBtYXggPyAyNTUgOiBiID4+IHNoaWZ0O1xuICAgICAgICAgIH1cbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAvLyBpbnZlcnNlIHJldmVyc2libGUgbXVsdGlwbGUgY29tcG9uZW50IHRyYW5zZm9ybVxuICAgICAgICAgIGZvciAoaiA9IDA7IGogPCBqajsgaisrLCBwb3MgKz0gYWxwaGEwMSkge1xuICAgICAgICAgICAgeTAgPSB5MGl0ZW1zW2pdICsgb2Zmc2V0O1xuICAgICAgICAgICAgeTEgPSB5MWl0ZW1zW2pdO1xuICAgICAgICAgICAgeTIgPSB5Mml0ZW1zW2pdO1xuICAgICAgICAgICAgZyA9IHkwIC0gKCh5MiArIHkxKSA+PiAyKTtcbiAgICAgICAgICAgIHIgPSBnICsgeTI7XG4gICAgICAgICAgICBiID0gZyArIHkxO1xuICAgICAgICAgICAgb3V0W3BvcysrXSA9IHIgPD0gMCA/IDAgOiByID49IG1heCA/IDI1NSA6IHIgPj4gc2hpZnQ7XG4gICAgICAgICAgICBvdXRbcG9zKytdID0gZyA8PSAwID8gMCA6IGcgPj0gbWF4ID8gMjU1IDogZyA+PiBzaGlmdDtcbiAgICAgICAgICAgIG91dFtwb3MrK10gPSBiIDw9IDAgPyAwIDogYiA+PSBtYXggPyAyNTUgOiBiID4+IHNoaWZ0O1xuICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICBpZiAoZm91ckNvbXBvbmVudHMpIHtcbiAgICAgICAgICBmb3IgKGogPSAwLCBwb3MgPSAzOyBqIDwgamo7IGorKywgcG9zICs9IDQpIHtcbiAgICAgICAgICAgIGsgPSB5M2l0ZW1zW2pdO1xuICAgICAgICAgICAgb3V0W3Bvc10gPSBrIDw9IG1pbiA/IDAgOiBrID49IG1heEsgPyAyNTUgOiAoayArIG9mZnNldCkgPj4gc2hpZnQ7XG4gICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICB9IGVsc2UgeyAvLyBubyBtdWx0aS1jb21wb25lbnQgdHJhbnNmb3JtXG4gICAgICAgIGZvciAoYyA9IDA7IGMgPCBjb21wb25lbnRzQ291bnQ7IGMrKykge1xuICAgICAgICAgIGlmIChjb21wb25lbnRzW2NdLnByZWNpc2lvbiA9PT0gOCl7XG4gICAgICAgICAgICB2YXIgaXRlbXMgPSB0cmFuc2Zvcm1lZFRpbGVzW2NdLml0ZW1zO1xuICAgICAgICAgICAgc2hpZnQgPSBjb21wb25lbnRzW2NdLnByZWNpc2lvbiAtIDg7XG4gICAgICAgICAgICBvZmZzZXQgPSAoMTI4IDw8IHNoaWZ0KSArIDAuNTtcbiAgICAgICAgICAgIG1heCA9ICgxMjcuNSAqICgxIDw8IHNoaWZ0KSk7XG4gICAgICAgICAgICBtaW4gPSAtbWF4O1xuICAgICAgICAgICAgZm9yIChwb3MgPSBjLCBqID0gMCwgamogPSBpdGVtcy5sZW5ndGg7IGogPCBqajsgaisrKSB7XG4gICAgICAgICAgICAgIHZhbCA9IGl0ZW1zW2pdO1xuICAgICAgICAgICAgICBvdXRbcG9zXSA9IHZhbCA8PSBtaW4gPyAwIDpcbiAgICAgICAgICAgICAgICAgICAgICAgICB2YWwgPj0gbWF4ID8gMjU1IDogKHZhbCArIG9mZnNldCkgPj4gc2hpZnQ7XG4gICAgICAgICAgICAgIHBvcyArPSBjb21wb25lbnRzQ291bnQ7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgfWVsc2V7XG4gICAgICAgICAgICB2YXIgaXNTaWduZWQgPSBjb21wb25lbnRzW2NdLmlzU2lnbmVkO1xuICAgICAgICAgICAgdmFyIGl0ZW1zID0gdHJhbnNmb3JtZWRUaWxlc1tjXS5pdGVtcztcblxuICAgICAgICAgICAgaWYoaXNTaWduZWQpe1xuICAgICAgICAgICAgICBmb3IgKHBvcyA9IGMsIGogPSAwLCBqaiA9IGl0ZW1zLmxlbmd0aDsgaiA8IGpqOyBqKyspIHtcbiAgICAgICAgICAgICAgICBvdXRbcG9zXSA9IGl0ZW1zW2pdO1xuICAgICAgICAgICAgICAgIHBvcyArPSBjb21wb25lbnRzQ291bnQ7XG4gICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1lbHNle1xuICAgICAgICAgICAgICBzaGlmdCA9IGNvbXBvbmVudHNbY10ucHJlY2lzaW9uIC0gODtcbiAgICAgICAgICAgICAgb2Zmc2V0ID0gKDEyOCA8PCBzaGlmdCkgKyAwLjU7XG4gICAgICAgICAgICAgIHZhciBwcmVjaXNpb25NYXggPSBNYXRoLnBvdygyLGNvbXBvbmVudHNbY10ucHJlY2lzaW9uKS0xO1xuICAgICAgICAgICAgICBmb3IgKHBvcyA9IGMsIGogPSAwLCBqaiA9IGl0ZW1zLmxlbmd0aDsgaiA8IGpqOyBqKyspIHtcbiAgICAgICAgICAgICAgICB2YWwgPSBpdGVtc1tqXTtcbiAgICAgICAgICAgICAgICBvdXRbcG9zXSA9IE1hdGgubWF4KE1hdGgubWluKCh2YWwgKyBvZmZzZXQpLHByZWNpc2lvbk1heCksMCk7XG4gICAgICAgICAgICAgICAgcG9zICs9IGNvbXBvbmVudHNDb3VudDtcbiAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgfVxuICAgICAgcmVzdWx0SW1hZ2VzLnB1c2gocmVzdWx0KTtcbiAgICB9XG4gICAgcmV0dXJuIHJlc3VsdEltYWdlcztcbiAgfVxuICBmdW5jdGlvbiBpbml0aWFsaXplVGlsZShjb250ZXh0LCB0aWxlSW5kZXgpIHtcbiAgICB2YXIgc2l6ID0gY29udGV4dC5TSVo7XG4gICAgdmFyIGNvbXBvbmVudHNDb3VudCA9IHNpei5Dc2l6O1xuICAgIHZhciB0aWxlID0gY29udGV4dC50aWxlc1t0aWxlSW5kZXhdO1xuICAgIGZvciAodmFyIGMgPSAwOyBjIDwgY29tcG9uZW50c0NvdW50OyBjKyspIHtcbiAgICAgIHZhciBjb21wb25lbnQgPSB0aWxlLmNvbXBvbmVudHNbY107XG4gICAgICB2YXIgcWNkT3JRY2MgPSAoY29udGV4dC5jdXJyZW50VGlsZS5RQ0NbY10gIT09IHVuZGVmaW5lZCA/XG4gICAgICAgIGNvbnRleHQuY3VycmVudFRpbGUuUUNDW2NdIDogY29udGV4dC5jdXJyZW50VGlsZS5RQ0QpO1xuICAgICAgY29tcG9uZW50LnF1YW50aXphdGlvblBhcmFtZXRlcnMg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ZmljaWVudENvdW50ID0gd2lkdGggKiBoZWlnaHQ7XG5cbiAgICAgIC8vIGNvZWZmaWNpZW50cyBvdXRzaWRlIHRoZSBlbmNvZGluZyByZWdpb24gdHJlYXRlZCBhcyBpbnNpZ25pZmljYW50XG4gICAgICAvLyBhZGQgYm9yZGVyIHN0YXRlIGNlbGxzIGZvciBzaWduaWZpY2FuY2VTdGF0ZVxuICAgICAgdGhpcy5uZWlnaGJvcnNTaWduaWZpY2FuY2UgPSBuZXcgVWludDhBcnJheShjb2VmZmljaWVudENvdW50KTtcbiAgICAgIHRoaXMuY29lZmZpY2VudHNTaWduID0gbmV3IFVpbnQ4QXJyYXkoY29lZmZpY2llbnRDb3VudCk7XG4gICAgICB0aGlzLmNvZWZmaWNlbnRzTWFnbml0dWRlID0gbWIgPiAxNCA/IG5ldyBVaW50MzJBcnJheShjb2VmZmljaWVudENvdW50KSA6XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbWIgPiA2ID8gbmV3IFVpbnQxNkFycmF5KGNvZWZmaWNpZW50Q291bnQpIDpcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuZXcgVWludDhBcnJheShjb2VmZmljaWVudENvdW50KTtcbiAgICAgIHRoaXMucHJvY2Vzc2luZ0ZsYWdzID0gbmV3IFVpbnQ4QXJyYXkoY29lZmZpY2llbnRDb3VudCk7XG5cbiAgICAgIHZhciBiaXRzRGVjb2RlZCA9IG5ldyBVaW50OEFycmF5KGNvZWZmaWNpZW50Q291bnQpO1xuICAgICAgaWYgKHplcm9CaXRQbGFuZXMgIT09IDApIHtcbiAgICAgICAgZm9yICh2YXIgaSA9IDA7IGkgPCBjb2VmZmljaWVudENvdW50OyBpKyspIHtcbiAgICAgICAgICBiaXRzRGVjb2RlZFtpXSA9IHplcm9CaXRQbGFuZXM7XG4gICAgICAgIH1cbiAgICAgIH1cbiAgICAgIHRoaXMuYml0c0RlY29kZWQgPSBiaXRzRGVjb2RlZDtcblxuICAgICA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hciB3aWR0aCA9IHRoaXMud2lkdGgsIGhlaWdodCA9IHRoaXMuaGVpZ2h0O1xuICAgICAgICB2YXIgbGVmdCA9IChjb2x1bW4gPiAwKTtcbiAgICAgICAgdmFyIHJpZ2h0ID0gKGNvbHVtbiArIDEgPCB3aWR0aCk7XG4gICAgICAgIHZhciBpO1xuXG4gICAgICAgIGlmIChyb3cgPiAwKSB7XG4gICAgICAgICAgaSA9IGluZGV4IC0gd2lkdGg7XG4gICAgICAgICAgaWYgKGxlZnQpIHtcbiAgICAgICAgICAgIG5laWdoYm9yc1NpZ25pZmljYW5jZVtpIC0gMV0gKz0gMHgxMDtcbiAgICAgICAgICB9XG4gICAgICAgICAgaWYgKHJpZ2h0KSB7XG4gICAgICAgICAgICBuZWlnaGJvcnNTaWduaWZpY2FuY2VbaSArIDFdICs9IDB4MTA7XG4gICAgICAgICAgfVxuICAgICAgICAgIG5laWdoYm9yc1NpZ25pZmljYW5jZVtpXSArPSAweDA0O1xuICAgICAgICB9XG5cbiAgICAgICAgaWYgKHJvdyArIDEgPCBoZWlnaHQpIHtcbiAgICAgICAgICBpID0gaW5kZXggKyB3aWR0aDtcbiAgICAgICAgICBpZiAobGVmdCkge1xuICAgICAgICAgICAgbmVpZ2hib3JzU2lnbmlmaWNhbmNlW2kgLSAxXSArPSAweDEwO1xuICAgICAgICAgIH1cbiAgICAgICAgICBpZiAocmlnaHQpIHtcbiAgICAgICAgICAgIG5laWdoYm9yc1NpZ25pZmljYW5jZVtpICsgMV0gKz0gMHgxMDtcbiAgICAgICAgICB9XG4gICAgICAgICAgbmVpZ2hib3JzU2lnbmlmaWNhbmNlW2ldICs9IDB4MDQ7XG4gICAgICAgIH1cblxuICAgICAgICBpZiAobGVmdCkge1xuICAgICAgICAgIG5laWdoYm9yc1NpZ25pZmljYW5jZVtpbmRleCAtIDFdICs9IDB4MDE7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKHJpZ2h0KSB7XG4gICAgICAgICAgbmVpZ2hib3JzU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gICBmb3IgKHZhciBqID0gMDsgaiA8IHdpZHRoOyBqKyspIHtcbiAgICAgICAgICAgIHZhciBpbmRleCA9IGkwICogd2lkdGggKyBqO1xuICAgICAgICAgICAgZm9yICh2YXIgaTEgPSAwOyBpMSA8IDQ7IGkxKyssIGluZGV4ICs9IHdpZHRoKSB7XG4gICAgICAgICAgICAgIHZhciBpID0gaTAgKyBpMTtcbiAgICAgICAgICAgICAgaWYgKGkgPj0gaGVpZ2h0KSB7XG4gICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgLy8gY2xlYXIgcHJvY2Vzc2VkIGZsYWcgZmlyc3RcbiAgICAgICAgICAgICAgcHJvY2Vzc2luZ0ZsYWdzW2luZGV4XSAmPSBwcm9jZXNzZWRJbnZlcnNlTWFzaztcblxuICAgICAgICAgICAgICBpZiAoY29lZmZpY2VudHNNYWduaXR1ZGVbaW5kZXhdIHx8XG4gICAgICAgICAgICAgICAgICAhbmVpZ2hib3JzU2lnbmlmaWNhbmNlW2luZGV4XSkge1xuICAgICAgICAgICAgICAgIGNvbnRpbnVlO1xuICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgdmFyIGNvbnRleHRMYWJlbCA9IGxhYmVsc1tuZWlnaGJvcnNTaWduaWZpY2FuY2VbaW5kZXhdXTtcbiAgICAgICAgICAgICAgdmFyIGRlY2lzaW9uID0gZGVjb2Rlci5yZWFkQml0KGNvbnRleHRzLCBjb250ZXh0TGFiZWwpO1xuICAgICAgICAgICAgICBpZiAoZGVjaXNpb24pIHtcbiAgICAgICAgICAgICAgICB2YXIgc2lnbiA9IHRoaXMuZGVjb2RlU2lnbkJpdChpLCBqLCBpbmRleCk7XG4gICAgICAgICAgICAgICAgY29lZmZpY2VudHNTaWduW2luZGV4XSA9IHNpZ247XG4gICAgICAgICAgICAgICAgY29lZmZpY2VudHNNYWduaXR1ZGVbaW5kZXhdID0gMTtcbiAgICAgICAgICAgICAgICB0aGlzLnNldE5laWdoYm9yc1NpZ25pZmljYW5jZShpLCBqLCBpbmRleCk7XG4gICAgICAgICAgICAgICAgcHJvY2Vzc2luZ0ZsYWdzW2luZGV4XSB8PSBmaXJzdE1hZ25pdHVkZUJpdE1hc2s7XG4gICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgYml0c0RlY29kZWRbaW5kZXhdKys7XG4gICAgICAgICAgICAgIHByb2Nlc3NpbmdGbGFnc1tpbmRleF0gfD0gcHJvY2Vzc2VkTWFzaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgIH0sXG4gICAgICBkZWNvZGVTaWduQml0OiBmdW5jdGlvbiBCaXRNb2RlbF9kZWNvZGVTaWduQml0KHJvdywgY29sdW1uLCBpbmRleCkge1xuICAgICAgICB2YXIgd2lkdGggPSB0aGlzLndpZHRoLCBoZWlnaHQgPSB0aGlzLmhlaWdodDtcbiAgICAgICAgdmFyIGNvZWZmaWNlbnRzTWFnbml0dWRlID0gdGhpcy5jb2VmZmljZW50c01hZ25pdHVkZTtcbiAgICAgICAgdmFyIGNvZWZmaWNlbnRzU2lnbiA9IHRoaXMuY29lZmZpY2VudHNTaWduO1xuICAgICAgICB2YXIgY29udHJpYnV0aW9uLCBzaWduMCwgc2lnbjEsIHNpZ25pZmljYW5jZTE7XG4gICAgICAgIHZhciBjb250ZXh0TGFiZWwsIGRlY29kZWQ7XG5cbiAgICAgICAgLy8gY2FsY3VsYXRlIGhvcml6b250YWwgY29udHJpYnV0aW9uXG4gICAgICAgIHNpZ25pZmljYW5jZTEgPSAoY29sdW1uID4gMCAmJiBjb2VmZmljZW50c01hZ25pdHVkZVtpbmRleCAtIDFdICE9PSAwKTtcbiAgICAgICAgaWYgKGNvbHVtbiArIDEgPCB3aWR0aCAmJiBjb2VmZmljZW50c01hZ25pdHVkZVtpbmRleCArIDFdICE9PSAwKSB7XG4gICAgICAgICAgc2lnbjEgPSBjb2VmZmljZW50c1NpZ25baW5kZXggKyAxXTtcbiAgICAgICAgICBpZiAoc2lnbmlmaWNhbmNlMSkge1xuICAgICAgICAgICAgc2lnbjAgPSBjb2VmZmljZW50c1NpZ25baW5kZXggLSAxXTtcbiAgICAgICAgICAgIGNvbnRyaWJ1dGlvbiA9IDEgLSBzaWduMSAtIHNpZ24wO1xuICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICBjb250cmlidXRpb24gPSAxIC0gc2lnbjEgLSBzaWduMTtcbiAgICAgICAgICB9XG4gICAgICAgIH0gZWxzZSBpZiAoc2lnbmlmaWNhbmNlMSkge1xuICAgICAgICAgIHNpZ24wID0gY29lZmZpY2VudHNTaWduW2luZGV4IC0gMV07XG4gICAgICAgICAgY29udHJpYnV0aW9uID0gMSAtIHNpZ24wIC0gc2lnbjA7XG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgY29udHJpYnV0aW9uID0gMDtcbiAgICAgICAgfVxuICAgICAgICB2YXIgaG9yaXpvbnRhbENvbnRyaWJ1dGlvbiA9IDMgKiBjb250cmlidXRpb247XG5cbiAgICAgICAgLy8gY2FsY3VsYXRlIHZlcnRpY2FsIGNvbnRyaWJ1dGlvbiBhbmQgY29tYmluZSB3aXRoIHRoZSBob3Jpem9udGFsXG4gICAgICAgIHNpZ25pZmljYW5jZTEgPSAocm93ID4gMCAmJiBjb2VmZmljZW50c01hZ25pdHVkZVtpbmRleCAtIHdpZHRoXSAhPT0gMCk7XG4gICAgICAgIGlmIChyb3cgKyAxIDwgaGVpZ2h0ICYmIGNvZWZmaWNlbnRzTWFnbml0dWRlW2luZGV4ICsgd2lkdGhdICE9PSAwKSB7XG4gICAgICAgICAgc2lnbjEgPSBjb2VmZmljZW50c1NpZ25baW5kZXggKyB3aWR0aF07XG4gICAgICAgICAgaWYgKHNpZ25pZmljYW5jZTEpIHtcbiAgICAgICAgICAgIHNpZ24wID0gY29lZmZpY2VudHNTaWduW2luZGV4IC0gd2lkdGhdO1xuICAgICAgICAgICAgY29udHJpYnV0aW9uID0gMSAtIHNpZ24xIC0gc2lnbjAgKyBob3Jpem9udGFsQ29udHJpYnV0aW9uO1xuICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICBjb250cmlidXRpb24gPSAxIC0gc2lnbjEgLSBzaWduMSArIGhvcml6b250YWxDb250cmlidXRpb247XG4gICAgICAgICAgfVxuICAgICAgICB9IGVsc2UgaWYgKHNpZ25pZmljYW5jZTEpIHtcbiAgICAgICAgICBzaWduMCA9IGNvZWZmaWNlbnRzU2lnbltpbmRleCAtIHdpZHRoXTtcbiAgICAgICAgICBjb250cmlidXRpb24gPSAxIC0gc2lnbjAgLSBzaWduMCArIGhvcml6b250YWxDb250cmlidXRpb247XG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgY29udHJpYnV0aW9uID0gaG9yaXpvbnRhbENvbnRyaWJ1dGlvbjtcbiAgICAgICAgfVxuXG4gICAgICAgIGlmIChjb250cmlidXRpb24gPj0gMCkge1xuICAgICAgICAgIGNvbnRleHRMYWJlbCA9IDkgKyBjb250cmlidXRpb247XG4gICAgICAgICAgZGVjb2RlZCA9IHRoaXMuZGVjb2Rlci5yZWFkQml0KHRoaXMuY29udGV4dHMsIGNvbnRleHRMYWJlbCk7XG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgY29udGV4dExhYmVsID0gOSAtIGNvbnRyaWJ1dGlvbjtcbiAgICAgICAgICBkZWNvZGVkID0gdGhpcy5kZWNvZGVyLnJlYWRCaXQodGhpcy5jb250ZXh0cywgY29udGV4dExhYmVsKSBeIDE7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIGRlY29kZWQ7XG4gICAgICB9LFxuICAgICAgcnVuTWFnbml0dWRlUmVmaW5lbWVudFBhc3M6XG4gICAgICAgIGZ1bmN0aW9uIEJpdE1vZGVsX3J1bk1hZ25pdHVkZVJlZmluZW1lbnRQYXNzKCkge1xuICAgICAgICB2YXIgZGVjb2RlciA9IHRoaXMuZGVjb2Rlcjt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25pdHVkZVtpbmRleF0gfHxcbiAgICAgICAgICAgICAgICAocHJvY2Vzc2luZ0ZsYWdzW2luZGV4XSAmIHByb2Nlc3NlZE1hc2spICE9PSAwKSB7XG4gICAgICAgICAgICAgICAgY29udGludWU7XG4gICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICB2YXIgY29udGV4dExhYmVsID0gMTY7XG4gICAgICAgICAgICAgIGlmICgocHJvY2Vzc2luZ0ZsYWdzW2luZGV4XSAmIGZpcnN0TWFnbml0dWRlQml0TWFzaykgIT09IDApIHtcbiAgICAgICAgICAgICAgICBwcm9jZXNzaW5nRmxhZ3NbaW5kZXhdIF49IGZpcnN0TWFnbml0dWRlQml0TWFzaztcbiAgICAgICAgICAgICAgICAvLyBmaXJzdCByZWZpbmVtZW50XG4gICAgICAgICAgICAgICB2YXIgc2lnbmlmaWNhbmNlID0gbmVpZ2hib3JzU2lnbmlmaWNhbmNlW2luZGV4XSAmIDEyNztcbiAgICAgICAgICAgICAgIGNvbnRleHRMYWJlbCA9IHNpZ25pZmljYW5jZSA9PT0gMCA/IDE1IDogMTQ7XG4gICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICB2YXIgYml0ID0gZGVjb2Rlci5yZWFkQml0KGNvbnRleHRzLCBjb250ZXh0TGFiZWwpO1xuICAgICAgICAgICAgICBjb2VmZmljZW50c01hZ25pdHVkZVtpbmRleF0gPVxuICAgICAgICAgICAgICAgIChjb2VmZmljZW50c01hZ25pdHVkZVtpbmRleF0gPDwgMSkgfCBiaXQ7XG4gICAgICAgICAgICAgIGJpdHNEZWNvZGVkW2luZGV4XSsrO1xuICAgICAgICAgICAgICBwcm9jZXNzaW5nRmxhZ3NbaW5kZXhdIHw9IHByb2Nlc3NlZE1hc2s7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICB9LFxuICAgICAgcnVuQ2xlYW51cFBhc3M6IGZ1bmN0aW9uIEJpdE1vZGVsX3J1bkNsZWFudXB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eSA9IGkwICsgMyA8IGhlaWdodDtcbiAgICAgICAgICBmb3IgKHZhciBqID0gMDsgaiA8IHdpZHRoOyBqKyspIHtcbiAgICAgICAgICAgIHZhciBpbmRleDAgPSBpbmRleEJhc2UgKyBqO1xuICAgICAgICAgICAgLy8gdXNpbmcgdGhlIHByb3BlcnR5OiBsYWJlbHNbbmVpZ2hib3JzU2lnbmlmaWNhbmNlW2luZGV4XV0gPT09IDBcbiAgICAgICAgICAgIC8vIHdoZW4gbmVpZ2hib3JzU2lnbmlmaWNhbmNlW2luZGV4XSA9PT0gMFxuICAgICAgICAgICAgdmFyIGFsbEVtcHR5ID0gKGNoZWNrQWxsRW1wdHkgJiZcbiAgICAgICAgICAgICAgcHJvY2Vzc2luZ0ZsYWdzW2luZGV4MF0gPT09IDAgJiZcbiAgICAgICAgICAgICAgcHJvY2Vzc2luZ0ZsYWdzW2luZGV4MCArIG9uZVJvd0Rvd25dID09PSAwICYmXG4gICAgICAgICAgICAgIHByb2Nlc3NpbmdGbGFnc1tpbmRleDAgKyB0d29Sb3dzRG93bl0gPT09IDAgJiZcbiAgICAgICAgICAgICAgcHJvY2Vzc2luZ0ZsYWdzW2luZGV4MCArIHRocmVlUm93c0Rvd25dID09PSAwICYmXG4gICAgICAgICAgICAgIG5laWdoYm9yc1NpZ25pZmljYW5jZVtpbmRleDBdID09PSAwICYmXG4gICAgICAgICAgICAgIG5laWdoYm9yc1NpZ25pZmljYW5jZVtpbmRleDAgKyBvbmVSb3dEb3duXSA9PT0gMCAmJlxuICAgICAgICAgICAgICBuZWlnaGJvcnNTaWduaWZpY2FuY2VbaW5kZXgwICsgdHdvUm93c0Rvd25dID09PSAwICYmXG4gICAgICAgICAgICAgIG5laWdoYm9yc1NpZ25pZmljYW5jZVtpbmRleDAgKyB0aHJlZVJvd3NEb3duXSA9PT0gMCk7XG4gICAgICAgICAgICB2YXIgaTEgPSAwLCBpbmRleCA9IGluZGV4MDtcbiAgICAgICAgICAgIHZhciBpID0gaTAsIHNpZ247XG4gICAgICAgICAgICBpZiAoYWxsRW1wdHkpIHtcbiAgICAgICAgICAgICAgdmFyIGhhc1NpZ25pZmljYW50Q29lZmZpY2VudCA9XG4gICAgICAgICAgICAgICAgZGVjb2Rlci5yZWFkQml0KGNvbnRleHRzLCBSVU5MRU5HVEhfQ09OVEVYVCk7XG4gICAgICAgICAgICAgIGlmICghaGFzU2lnbmlmaWNhbnRDb2VmZmljZW50KSB7XG4gICAgICAgICAgICAgICAgYml0c0RlY29kZWRbaW5kZXgwXSsrO1xuICAgICAgICAgICAgICAgIGJpdHNEZWNvZGVkW2luZGV4MCArIG9uZVJvd0Rvd25dKys7XG4gICAgICAgICAgICAgICAgYml0c0RlY29kZWRbaW5kZXgwICsgdHdvUm93c0Rvd25dKys7XG4gICAgICAgICAgICAgICAgYml0c0RlY29kZWRbaW5kZXgwICsgdGhyZWVSb3dzRG93bl0rKztcbiAgICAgICAgICAgICAgICBjb250aW51ZTsgLy8gbmV4dCBjb2x1bW5cbiAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICBpMSA9IChkZWNvZGVyLnJlYWRCaXQoY29udGV4dHMsIFVOSUZPUk1fQ09OVEVYVCkgPDwgMSkgfFxuICAgICAgICAgICAgICAgICAgICBkZWNvZGVyLnJlYWRCaXQoY29udGV4dHMsIFVOSUZPUk1fQ09OVEVYVCk7XG4gICAgICAgICAgICAgIGlmIChpMSAhPT0gMCkge1xuICAgICAgICAgICAgICAgIGkgPSBpMCArIGkxO1xuICAgICAgICAgICAgICAgIGluZGV4ICs9IGkxICogd2lkdGg7XG4gICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICBzaWduID0gdGhpcy5kZWNvZGVTaWduQml0KGksIGosIGluZGV4KTtcbiAgICAgICAgICAgICAgY29lZmZpY2VudHNTaWduW2luZGV4XSA9IHNpZ247XG4gICAgICAgICAgICAgIGNvZWZmaWNlbnRzTWFnbml0dWRlW2luZGV4XSA9IDE7XG4gICAgICAgICAgICAgIHRoaXMuc2V0TmVpZ2hib3JzU2lnbmlmaWNhbmNlKGksIGosIGluZGV4KTtcbiAgICAgICAgICAgICAgcHJvY2Vzc2luZ0ZsYWdzW2luZGV4XSB8PSBmaXJzdE1hZ25pdHVkZUJpdE1hc2s7XG5cbiAgICAgICAgICAgICAgaW5kZXggPSBpbmRleDA7XG4gICAgICAgICAgICAgIGZvciAodmFyIGkyID0gaTA7IGkyIDw9IGk7IGkyKyssIGluZGV4ICs9IHdpZHRoKSB7XG4gICAgICAgICAgICAgICAgYml0c0RlY29kZWRbaW5kZXhdKys7XG4gICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICBpMSsrO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgZm9yIChpID0gaTAgKyBpMTsgaSA8IGlOZXh0OyBpKyssIGluZGV4ICs9IHdpZHRoKSB7XG4gICAgICAgICAgICAgIGlmIChjb2VmZmljZW50c01hZ25pdHVkZVtpbmRleF0gfHxcbiAgICAgICAgICAgICAgICAocHJvY2Vzc2luZ0ZsYWdzW2luZGV4XSAmIHByb2Nlc3NlZE1hc2spICE9PSAwKSB7XG4gICAgICAgICAgICAgICAgY29udGludWU7XG4gICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICB2YXIgY29udGV4dExhYmVsID0gbGFiZWxzW25laWdoYm9yc1NpZ25pZmljYW5jZVtpbmRleF1dO1xuICAgICAgICAgICAgICB2YXIgZGVjaXNpb24gPSBkZWNvZGVyLnJlYWRCaXQoY29udGV4dHMsIGNvbnRleHRMYWJlbCk7XG4gICAgICAgICAgICAgIGlmIChkZWNpc2lvbiA9PT0gMSkge1xuICAgICAgICAgICAgICAgIHNpZ24gPSB0aGlzLmRlY29kZVNpZ25CaXQoaSwgaiwgaW5kZXgpO1xuICAgICAgICAgICAgICAgIGNvZWZmaWNlbnRzU2lnbltpbmRleF0gPSBzaWduO1xuICAgICAgICAgICAgICAgIGNvZWZmaWNlbnRzTWFnbml0dWRlW2luZGV4XSA9IDE7XG4gICAgICAgICAgICAgICAgdGhpcy5zZXROZWlnaGJvcnNTaWduaWZpY2FuY2UoaSwgaiwgaW5kZXgpO1xuICAgICAgICAgICAgICAgIHByb2Nlc3NpbmdGbGFnc1tpbmRleF0gfD0gZmlyc3RNYWduaXR1ZGVCaXRNYXNrO1xuICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgIGJpdHNEZWNvZGVkW2luZGV4XSsrO1xuICAgICAgICAgICAgfVxuICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgfSxcbiAgICAgIGNoZWNrU2VnbWVudGF0aW9uU3ltYm9sOiBmdW5jdGlvbiBCaXRNb2RlbF9jaGVja1NlZ21lbnRhdGlvblN5bWJvbCgpIHtcbiAgICAgICAgdmFyIGRlY29kZXIgPSB0aGlzLmRlY29kZXI7XG4gICAgICAgIHZhciBjb250ZXh0cyA9IHRoaXMuY29udGV4dHM7XG4gICAgICAgIHZhciBzeW1ib2wgPSAoZGVjb2Rlci5yZWFkQml0KGNvbnRleHRzLCBVTklGT1JNX0NPTlRFWFQpIDw8IDMpIHxcbiAgICAgICAgICAgICAgICAgICAgIChkZWNvZGVyLnJlYWRCaXQoY29udGV4dHMsIFVOSUZPUk1fQ09OVEVYVCkgPDwgMikgfFxuICAgICAgICAgICAgICAgICAgICAgKGRlY29kZXIucmVhZEJpdChjb250ZXh0cywgVU5JRk9STV9DT05URVhUKSA8PCAxKSB8XG4gICAgICAgICAgICAgICAgICAgICAgZGVjb2Rlci5yZWFkQml0KGNvbnRleHRzLCBVTklGT1JNX0NPTlRFWFQpO1xuICAgICAgICBpZiAoc3ltYm9sICE9PSAweEEpIHtcbiAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoJ0pQWCBFcnJvcjogSW52YWxpZCBzZWdtZW50YXRpb24gc3ltYm9sJyk7XG4gICAgICAgIH1cbiAgICAgIH1cbiAgICB9O1xuXG4gICAgcmV0dXJuIEJpdE1vZGVsO1xuICB9KSgpO1xuXG4gIC8vIFNlY3Rpb24gRi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DRcbiAgICAgIGogPSBvZmZzZXQgLSAxO1xuICAgICAgY3VycmVudCA9IGdhbW1hICogeFtqIC0gMV07XG4gICAgICBmb3IgKG4gPSBsZW4gKyAyOyBuLS07IGogKz0gMikge1xuICAgICAgICBuZXh0ID0gZ2FtbWEgKiB4W2ogKyAxXTtcbiAgICAgICAgeFtqXSAtPSBjdXJyZW50ICsgbmV4dDtcbiAgICAgICAgaWYgKG4tLSkge1xuICAgICAgICAgIGogKz0gMjtcbiAgICAgICAgICBjdXJyZW50ID0gZ2FtbWEgKiB4W2ogKyAxXTtcbiAgICAgICAgICB4W2pdIC09IGN1cnJlbnQgKyBuZXh0O1xuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgIGJyZWFrO1xuICAgICAgICB9XG4gICAgICB9XG5cbiAgICAgIC8vIHN0ZXAgNVxuICAgICAgaiA9IG9mZnNldDtcbiAgICAgIGN1cnJlbnQgPSBiZXRhICogeFtqIC0gMV07XG4gICAgICBmb3IgKG4gPSBsZW4gKyAxOyBuLS07IGogKz0gMikge1xuICAgICAgICBuZXh0ID0gYmV0YSAqIHhbaiArIDFdO1xuICAgICAgICB4W2pdIC09IGN1cnJlbnQgKyBuZXh0O1xuICAgICAgICBpZiAobi0tKSB7XG4gICAgICAgICAgaiArPSAyO1xuICAgICAgICAgIGN1cnJlbnQgPSBiZXRhICogeFtqICsgMV07XG4gICAgICAgICAgeFtqXSAtPSBjdXJyZW50ICsgbmV4dDtcbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICBicmVhaztcbiAgICAgICAgfVxuICAgICAgfVxuXG4gICAgICAvLyBzdGVwIDZcbiAgICAgIGlmIChsZW4gIT09IDApIHtcbiAgICAgICAgaiA9IG9mZnNldCArIDE7XG4gICAgICAgIGN1cnJlbnQgPSBhbHBoYSAqIHhbaiAtIDFdO1xuICAgICAgICBmb3IgKG4gPSBsZW47IG4tLTsgaiArPSAyKSB7XG4gICAgICAgICAgbmV4dCA9IGFscGhhICogeFtqICsgM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ICBkID0gMSBeIGN4X21wcztcbiAgICAgICAgICBpZiAocWVUYWJsZUljeC5zd2l0Y2hGbGFnID09PSAxKSB7XG4gICAgICAgICAgICBjeF9tcHMgPSBkO1xuICAgICAgICAgIH1cbiAgICAgICAgICBjeF9pbmRleCA9IHFlVGFibGVJY3gubmxwcztcbiAgICAgICAgfVxuICAgICAgfSBlbHNlIHtcbiAgICAgICAgdGhpcy5jaGlnaCAtPSBxZUljeDtcbiAgICAgICAgaWYgKChhICYgMHg4MDAwKSAhPT0gMCkge1xuICAgICAgICAgIHRoaXMuYSA9IGE7XG4gICAgICAgICAgcmV0dXJuIGN4X21wcztcbiAgICAgICAgfVxuICAgICAgICAvLyBleGNoYW5nZU1wc1xuICAgICAgICBpZiAoYSA8IHFlSWN4KSB7XG4gICAgICAgICAgZCA9IDEgXiBjeF9tcHM7XG4gICAgICAgICAgaWYgKHFlVGFibGVJY3guc3dpdGNoRmxhZyA9PT0gMSkge1xuICAgICAgICAgICAgY3hfbXBzID0gZDtcbiAgICAgICAgICB9XG4gICAgICAgICAgY3hfaW5kZXggPSBxZVRhYmxlSWN4Lm5scHM7XG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgZCA9IGN4X21wcztcbiAgICAgICAgICBjeF9pbmRleCA9IHFlVGFibGVJY3gubm1wcztcbiAgICAgICAgfVxuICAgICAgfVxuICAgICAgLy8gQy4zLjMgcmVub3JtRDtcbiAgICAgIGRvIHtcbiAgICAgICAgaWYgKHRoaXMuY3QgPT09IDApIHtcbiAgICAgICAgICB0aGlzLmJ5dGVJbigpO1xuICAgICAgICB9XG5cbiAgICAgICAgYSA8PD0gMTtcbiAgICAgICAgdGhpcy5jaGlnaCA9ICgodGhpcy5jaGlnaCA8PCAxKSAmIDB4RkZGRikgfCAoKHRoaXMuY2xvdyA+PiAxNSkgJiAxKTtcbiAgICAgICAgdGhpcy5jbG93ID0gKHRoaXMuY2xvdyA8PCAxKSAmIDB4RkZGRjtcbiAgICAgICAgdGhpc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gRE9NL1dvcmtlciwgY2hlY2tpbmcgcHJlc2VuY2Ugb2YgYWxsL3Jlc29sdmVcbiAgICBpZiAodHlwZW9mIGdsb2JhbFNjb3BlLlByb21pc2UuYWxsICE9PSAnZnVuY3Rpb24nKSB7XG4gICAgICBnbG9iYWxTY29wZS5Qcm9taXNlLmFsbCA9IGZ1bmN0aW9uIChpdGVyYWJsZSkge1xuICAgICAgICB2YXIgY291bnQgPSAwLCByZXN1bHRzID0gW10sIHJlc29sdmUsIHJlamVjdDtcbiAgICAgICAgdmFyIHByb21pc2UgPSBuZXcgZ2xvYmFsU2NvcGUuUHJvbWlzZShmdW5jdGlvbiAocmVzb2x2ZV8sIHJlamVjdF8pIHtcbiAgICAgICAgICByZXNvbHZlID0gcmVzb2x2ZV87XG4gICAgICAgICAgcmVqZWN0ID0gcmVqZWN0XztcbiAgICAgICAgfSk7XG4gICAgICAgIGl0ZXJhYmxlLmZvckVhY2goZnVuY3Rpb24gKHAsIGkpIHtcbiAgICAgICAgICBjb3VudCsrO1xuICAgICAgICAgIHAudGhlbihmdW5jdGlvbiAocmVzdWx0KSB7XG4gICAgICAgICAgICByZXN1bHRzW2ldID0gcmVzdWx0O1xuICAgICAgICAgICAgY291bnQtLTtcbiAgICAgICAgICAgIGlmIChjb3VudCA9PT0gMCkge1xuICAgICAgICAgICAgICByZXNvbHZlKHJlc3VsdHMpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgIH0sIHJlamVjdCk7XG4gICAgICAgIH0pO1xuICAgICAgICBpZiAoY291bnQgPT09IDApIHtcbiAgICAgICAgICByZXNvbHZlKHJlc3VsdHMpO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiBwcm9taXNlO1xuICAgICAgfTtcbiAgICB9XG4gICAgaWYgKHR5cGVvZiBnbG9iYWxTY29wZS5Qcm9taXNlLnJlc29sdmUgIT09ICdmdW5jdGlvbicpIHtcbiAgICAgIGdsb2JhbFNjb3BlLlByb21pc2UucmVzb2x2ZSA9IGZ1bm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HRoaXMucGVuZGluZ1JlamVjdGlvbkNoZWNrKSB7XG4gICAgICAgIHJldHVybjtcbiAgICAgIH1cbiAgICAgIHRoaXMucGVuZGluZ1JlamVjdGlvbkNoZWNrID0gdHJ1ZTtcbiAgICAgIHNldFRpbWVvdXQoZnVuY3Rpb24gcmVqZWN0aW9uQ2hlY2soKSB7XG4gICAgICAgIHRoaXMucGVuZGluZ1JlamVjdGlvbkNoZWNrID0gZmFsc2U7XG4gICAgICAgIHZhciBub3cgPSBEYXRlLm5vdygpO1xuICAgICAgICBmb3IgKHZhciBpID0gMDsgaSA8IHRoaXMudW5oYW5kbGVkUmVqZWN0aW9ucy5sZW5ndGg7IGkrKykge1xuICAgICAgICAgIGlmIChub3cgLSB0aGlzLnVuaGFuZGxlZFJlamVjdGlvbnNbaV0udGltZSA+IFJFSkVDVElPTl9USU1FT1VUKSB7XG4gICAgICAgICAgICB2YXIgdW5oYW5kbGVkID0gdGhpcy51bmhhbmRsZWRSZWplY3Rpb25zW2ldLnByb21pc2UuX3ZhbHVlO1xuICAgICAgICAgICAgdmFyIG1zZyA9ICdVbmhhbmRsZWQgcmVqZWN0aW9uOiAnICsgdW5oYW5kbGVkO1xuICAgICAgICAgICAgaWYgKHVuaGFuZGxlZC5zdGFjaykge1xuICAgICAgICAgICAgICBtc2cgKz0gJ1xcbicgKyB1bmhhbmRsZWQuc3RhY2s7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICB3YXJuKG1zZyk7XG4gICAgICAgICAgICB0aGlzLnVuaGFuZGxlZFJlamVjdGlvbnMuc3BsaWNlKGkpO1xuICAgICAgICAgICAgaS0tO1xuICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICBpZiAodGhpcy51bmhhbmRsZWRSZWplY3Rpb25zLmxlbmd0aCkge1xuICAgICAgICAgIHRoaXMuc2NoZWR1bGVSZWplY3Rpb25DaGVjaygpO1xuICAgICAgICB9XG4gICAgICB9LmJpbmQodGhpcyksIFJFSkVDVElPTl9USU1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tcbiAgICB9XG4gICAgZnVuY3Rpb24gcmVqZWN0KHJlYXNvbikge1xuICAgICAgaWYgKGRlZmVycmVkLl9zdGF0dXMgPT09IFNUQVRVU19SRUpFQ1RFRCkge1xuICAgICAgICByZXR1cm47XG4gICAgICB9XG4gICAgICByZXN1bHRzID0gW107XG4gICAgICByZWplY3RBbGwocmVhc29uKTtcbiAgICB9XG4gICAgZm9yICh2YXIgaSA9IDAsIGlpID0gcHJvbWlzZXMubGVuZ3RoOyBpIDwgaWk7ICsraSkge1xuICAgICAgdmFyIHByb21pc2UgPSBwcm9taXNlc1tpXTtcbiAgICAgIHZhciByZXNvbHZlID0gKGZ1bmN0aW9uKGkpIHtcbiAgICAgICAgcmV0dXJuIGZ1bmN0aW9uKHZhbHVlKSB7XG4gICAgICAgICAgaWYgKGRlZmVycmVkLl9zdGF0dXMgPT09IFNUQVRVU19SRUpFQ1RFRCkge1xuICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICAgIH1cbiAgICAgICAgICByZXN1bHRzW2ldID0gdmFsdWU7XG4gICAgICAgICAgdW5yZXNvbHZlZC0tO1xuICAgICAgICAgIGlmICh1bnJlc29sdmVkID09PSAwKSB7XG4gICAgICAgICAgICByZXNvbHZlQWxsKHJlc3VsdHMpO1xuICAgICAgICAgIH1cbiAgICAgICAgfTtcbiAgICAgIH0pKGkpO1xuICAgICAgaWYgKFByb21pc2UuaXNQcm9taXNlKHByb21pc2UpKSB7XG4gICAgICAgIHByb21pc2UudGhlbihyZXNvbHZlLCByZWplY3QpO1xuICAgICAgfSBlbHNlIHtcbiAgICAgICAgcmVzb2x2ZShwcm9taXNlKTtcbiAgICAgIH1cbiAgICB9XG4gICAgcmV0dXJuIGRlZmVycmVkO1xuICB9O1xuXG4gIC8qKlxuICAgKiBDaGVja3MgaWYgdGhlIHZhbHVlIGlzIGxpa2VseSBhIHByb21pc2UgKGhhcyBhICd0aGVuJyBmdW5jdGlvbikuXG4gICAqIEByZXR1cm4ge2Jvb2xlY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ICAgICAgICAgPSAzO1xudmFyIFpfRklYRUQgICAgICAgICAgICAgICA9IDQ7XG52YXIgWl9ERUZBVUxUX1NUUkFURUdZICAgID0gMDtcblxuLyogUG9zc2libGUgdmFsdWVzIG9mIHRoZSBkYXRhX3R5cGUgZmllbGQgKHRob3VnaCBzZWUgaW5mbGF0ZSgpKSAqL1xuLy92YXIgWl9CSU5BUlkgICAgICAgICAgICAgID0gMDtcbi8vdmFyIFpfVEVYVCAgICAgICAgICAgICAgICA9IDE7XG4vL3ZhciBaX0FTQ0lJICAgICAgICAgICAgICAgPSAxOyAvLyA9IFpfVEVYVFxudmFyIFpfVU5LTk9XTiAgICAgICAgICAgICA9IDI7XG5cblxuLyogVGhlIGRlZmxhdGUgY29tcHJlc3Npb24gbWV0aG9kICovXG52YXIgWl9ERUZMQVRFRCAgPSA4O1xuXG4vKj09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0qL1xuXG5cbnZhciBNQVhfTUVNX0xFVkVMID0gOTtcbi8qIE1heGltdW0gdmFsdWUgZm9yIG1lbUxldmVsIGluIGRlZmxhdGVJbml0MiAqL1xudmFyIE1BWF9XQklUUyA9IDE1O1xuLyogMzJLIExaNzcgd2luZG93ICovXG52YXIgREVGX01FTV9MRVZFTCA9IDg7XG5cblxudmFyIExFTkdUSF9DT0RFUyAgPSAyOTtcbi8qIG51bWJlciBvZiBsZW5ndGggY29kZXMsIG5vdCBjb3VudGluZyB0aGUgc3BlY2lhbCBFTkRfQkxPQ0sgY29kZSAqL1xudmFyIExJVEVSQUxTICAgICAgPSAyNTY7XG4vKiBudW1iZXIgb2YgbGl0ZXJhbCBieXRlcyAwLi4yNTUgKi9cbnZhciBMX0NPREVTICAgICAgID0gTElURVJBTFMgKyAxICsgTEVOR1RIX0NPREVTO1xuLyogbnVtYmVyIG9mIExpdGVyYWwgb3IgTGVuZ3RoIGNvZGVzLCBpbmNsdWRpbmc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aDtcbiAgcy5sYXN0X2ZsdXNoID0gZmx1c2g7XG5cbiAgLyogV3JpdGUgdGhlIGhlYWRlciAqL1xuICBpZiAocy5zdGF0dXMgPT09IElOSVRfU1RBVEUpIHtcblxuICAgIGlmIChzLndyYXAgPT09IDIpIHsgLy8gR1pJUCBoZWFkZXJcbiAgICAgIHN0cm0uYWRsZXIgPSAwOyAgLy9jcmMzMigwTCwgWl9OVUxMLCAwKTtcbiAgICAgIHB1dF9ieXRlKHMsIDMxKTtcbiAgICAgIHB1dF9ieXRlKHMsIDEzOSk7XG4gICAgICBwdXRfYnl0ZShzLCA4KTtcbiAgICAgIGlmICghcy5nemhlYWQpIHsgLy8gcy0+Z3poZWFkID09IFpfTlVMTFxuICAgICAgICBwdXRfYnl0ZShzLCAwKTtcbiAgICAgICAgcHV0X2J5dGUocywgMCk7XG4gICAgICAgIHB1dF9ieXRlKHMsIDApO1xuICAgICAgICBwdXRfYnl0ZShzLCAwKTtcbiAgICAgICAgcHV0X2J5dGUocywgMCk7XG4gICAgICAgIHB1dF9ieXRlKHMsIHMubGV2ZWwgPT09IDkgPyAyIDpcbiAgICAgICAgICAgICAgICAgICAgKHMuc3RyYXRlZ3kgPj0gWl9IVUZGTUFOX09OTFkgfHwgcy5sZXZlbCA8IDIgP1xuICAgICAgICAgICAgICAgICAgICAgNCA6IDApKTtcbiAgICAgICAgcHV0X2J5dGUocywgT1NfQ09ERSk7XG4gICAgICAgIHMuc3RhdHVzID0gQlVTWV9TVEFURTtcbiAgICAgIH1cbiAgICAgIGVsc2Uge1xuICAgICAgICBwdXRfYnl0ZShzLCAocy5nemhlYWQudGV4dCA/IDEgOiAwKSArXG4gICAgICAgICAgICAgICAgICAgIChzLmd6aGVhZC5oY3JjID8gMiA6IDApICtcbiAgICAgICAgICAgICAgICAgICAgKCFzLmd6aGVhZC5leHRyYSA/IDAgOiA0KSArXG4gICAgICAgICAgICAgICAgICAgICghcy5nemhlYWQubmFtZSA/IDAgOiA4KSArXG4gICAgICAgICAgICAgICAgICAgICghcy5nemhlYWQuY29tbWVudCA/IDAgOiAxNilcbiAgICAgICAgICAgICAgICApO1xuICAgICAgICBwdXRfYnl0ZShzLCBzLmd6aGVhZC50aW1lICYgMHhmZik7XG4gICAgICAgIHB1dF9ieXRlKHMsIChzLmd6aGVhZC50aW1lID4+IDgpICYgMHhmZik7XG4gICAgICAgIHB1dF9ieXRlKHMsIChzLmd6aGVhZC50aW1lID4+IDE2KSAmIDB4ZmYpO1xuICAgICAgICBwdXRfYnl0ZShzLCAocy5nemhlYWQudGltZSA+PiAyNCkgJiAweGZmKTtcbiAgICAgICAgcHV0X2J5dGUocywgcy5sZXZlbCA9PT0gOSA/IDIgOlxuICAgICAgICAgICAgICAgICAgICAocy5zdHJhdGVneSA+PSBaX0hVRkZNQU5fT05MWSB8fCBzLmxldmVsIDwgMiA/XG4gICAgICAgICAgICAgICAgICAgICA0IDogMCkpO1xuICAgICAgICBwdXRfYnl0ZShzLCBzLmd6aGVhZC5vcyAmIDB4ZmYpO1xuICAgICAgICBpZiAocy5nemhlYWQuZXh0cmEgJiYgcy5nemhlYWQuZXh0cmEubGVuZ3RoKSB7XG4gICAgICAgICAgcHV0X2J5dGUocywgcy5nemhlYWQuZXh0cmEubGVuZ3RoICYgMHhmZik7XG4gICAgICAgICAgcHV0X2J5dGUocywgKHMuZ3poZWFkLmV4dHJhLmxlbmd0aCA+PiA4KSAmIDB4ZmYpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChzLmd6aGVhZC5oY3JjKSB7XG4gICAgICAgICAgc3RybS5hZGxlciA9IGNyYzMyKHN0cm0uYWRsZXIsIHMucGVuZGluZ19idWYsIHMucGVuZGluZywgMCk7XG4gICAgICAgIH1cbiAgICAgICAgcy5nemluZGV4ID0gMDtcbiAgICAgICAgcy5zdGF0dXMgPSBFWFRSQV9TVEFURTtcbiAgICAgIH1cbiAgICB9XG4gICAgZWxzZSAvLyBERUZMQVRFIGhlYWRlclxuICAgIHtcbiAgICAgIH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uXG4gICAgaGVyZSA9IGxjb2RlW2hvbGQgJiBsbWFza107XG5cbiAgICBkb2xlbjpcbiAgICBmb3IgKDs7KSB7IC8vIEdvdG8gZW11bGF0aW9uXG4gICAgICBvcCA9IGhlcmUgPj4+IDI0LypoZXJlLmJpdHMqLztcbiAgICAgIGhvbGQgPj4+PSBvcDtcbiAgICAgIGJpdHMgLT0gb3A7XG4gICAgICBvcCA9IChoZXJlID4+PiAxNikgJiAweGZmLypoZXJlLm9wKi87XG4gICAgICBpZiAob3AgPT09IDApIHsgICAgICAgICAgICAgICAgICAgICAgICAgIC8qIGxpdGVyYWwgKi9cbiAgICAgICAgLy9UcmFjZXZ2KChzdGRlcnIsIGhlcmUudmFsID49IDB4MjAgJiYgaGVyZS52YWwgPCAweDdmID9cbiAgICAgICAgLy8gICAgICAgIFwiaW5mbGF0ZTogICAgICAgICBsaXRlcmFsICclYydcXG5cIiA6XG4gICAgICAgIC8vICAgICAgICBcImluZmxhdGU6ICAgICAgICAgbGl0ZXJhbCAweCUwMnhcXG5cIiwgaGVyZS52YWwpKTtcbiAgICAgICAgb3V0cHV0W19vdXQrK10gPSBoZXJlICYgMHhmZmZmLypoZXJlLnZhbCovO1xuICAgICAgfVxuICAgICAgZWxzZSBpZiAob3AgJiAxNikgeyAgICAgICAgICAgICAgICAgICAgIC8qIGxlbmd0aCBiYXNlICovXG4gICAgICAgIGxlbiA9IGhlcmUgJiAweGZmZmYvKmhlcmUudmFsKi87XG4gICAgICAgIG9wICY9IDE1OyAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qIG51bWJlciBvZiBleHRyYSBiaXRzICovXG4gICAgICAgIGlmIChvcCkge1xuICAgICAgICAgIGlmIChiaXRzIDwgb3ApIHtcbiAgICAgICAgICAgIGhvbGQgKz0gaW5wdXRbX2luKytdIDw8IGJpdHM7XG4gICAgICAgICAgICBiaXRzICs9IDg7XG4gICAgICAgICAgfVxuICAgICAgICAgIGxlbiArPSBob2xkICYgKCgxIDw8IG9wKSAtIDEpO1xuICAgICAgICAgIGhvbGQgPj4+PSBvcDtcbiAgICAgICAgICBiaXRzIC09IG9wO1xuICAgICAgICB9XG4gICAgICAgIC8vVHJhY2V2digoc3RkZXJyLCBcImluZmxhdGU6ICAgICAgICAgbGVuZ3RoICV1XFxuXCIsIGxlbikpO1xuICAgICAgICBpZiAoYml0cyA8IDE1KSB7XG4gICAgICAgICAgaG9sZCArPSBpbnB1dFtfaW4rK10gPDwgYml0cztcbiAgICAgICAgICBiaXRzICs9IDg7XG4gICAgICAgICAgaG9sZCArPSBpbnB1dFtfaW4rK10gPDwgYml0cztcbiAgICAgICAgICBiaXRzICs9IDg7XG4gICAgICAgIH1cbiAgICAgICAgaGVyZSA9IGRjb2RlW2hvbGQgJiBkbWFza107XG5cbiAgICAgICAgZG9kaXN0OlxuICAgICAgICBmb3IgKDs7KSB7IC8vIGdvdG8gZW11bGF0aW9uXG4gICAgICAgICAgb3AgPSBoZXJlID4+PiAyNC8qaGVyZS5iaXRzKi87XG4gICAgICAgICAgaG9sZCA+Pj49IG9wO1xuICAgICAgICAgIGJpdHMgLT0gb3A7XG4gICAgICAgICAgb3AgPSAoaGVyZSA+Pj4gMTYpICYgMHhmZi8qaGVyZS5vcCovO1xuXG4gICAgICAgICAgaWYgKG9wICYgMTYpIHsgICAgICAgICAgICAgICAgICAgICAgLyogZGlzdGFuY2UgYmFzZSAqL1xuICAgICAgICAgICAgZGlzdCA9IGhlcmUgJiAweGZmZmYvKmhlcmUudmFsKi87XG4gICAgICAgICAgICBvcCAmPSAxNTsgICAgICAgICAgICAgICAgICAgICAgIC8qIG51bWJlciBvZiBleHRyYSBiaXRzICovXG4gICAgICAgICAgICBpZiAoYml0cyA8IG9wKSB7XG4gICAgICAgICAgICAgIGhvbGQgKz0gaW5wdXRbX2luKytdIDw8IGJpdHM7XG4gICAgICAgICAgICAgIGJpdHMgKz0gODtcbiAgICAgICAgICAgICAgaWYgKGJpdHMgPCBvcCkge1xuICAgICAgICAgICAgICAgIGhvbGQgKz0gaW5wdXRbX2luKytdIDw8IGJpdHM7XG4gICAgICAgICAgICAgICAgYml0cyArPSA4O1xuICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBkaXN0ICs9IGhvbGQgJiAoKDEgPDwgb3ApIC0gMSk7XG4vLyNpZmRlZiBJTkZMQVRFX1NUUklDVFxuICAgICAgICAgICAgaWYgKGRpc3QgPiBkbWF4KSB7XG4gICAgICAgICAgICAgIHN0cm0ubXNnID0gJ2ludmFsaWQgZGlzdGFuY2UgdG9vIGZhciBiYWNrJztcbiAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IEJBRDtcbiAgICAgICAgICAgICAgYnJlYWsgdG9wO1xuICAgICAgICAgICAgfVxuLy8jZW5kaWZcbiAgICAgICAgICAgIGhvbGQgPj4+PSBvcDtcbiAgICAgICAgICAgIGJpdHMgLT0gb3A7XG4gICAgICAgICAgICAvL1RyYWNldnYoKHN0ZGVyciwgXCJpbmZsYXRlOiAgICAgICAgIGRpc3RhbmNlICV1XFxuXCIsIGRpc3QpKTtcbiAgICAgICAgICAgIG9wID0gX291dCAtIGJlZzsgICAgICAgICAgICAgICAgLyogbWF4IGRpc3RhbmNlIGluIG91dHB1dCAqL1xuICAgICAgICAgICAgaWYgKGRpc3QgPiBvcCkgeyAgICAgICAgICAgICAgICAvKiBzZWUgaWYgY29weSBmcm9tIHdpbmRvdyAqL1xuICAgICAgICAgICAgICBvcCA9IGRpc3QgLSBvcDsgICAgICAgICAgICAgICAvKiBkaXN0YW5jZSBiYWNrIGluIHdpbmRvdyAqL1xuICAgICAgICAgICAgICBpZiAob3AgPiB3aGF2ZSkge1xuICAgICAgICAgICAgICAgIGlmIChzdGF0ZS5zYW5lKSB7XG4gICAgICAgICAgICAgICAgICBzdHJtLm1zZyA9ICdpbnZhbGlkIGRpc3RhbmNlIHRvbyBmYXIgYmFjayc7XG4gICAgICAgICAgICAgICAgICBzdGF0ZS5tb2RlID0gQkFEO1xuICAgICAgICAgICAgICAgICAgYnJlYWsgdG9wO1xuICAgICAgICAgICAgICAgIH1cblxuLy8gKCEpIFRoaXMgYmxvY2sgaXMgZGlzYWJsZWQgaW4gemxpYiBkZWZhaWx0cyxcbi8vIGRvbid0IGVuYWJsZSBpdCBmb3IgYmluYXJ5IGNvbXBhdGliaWxpdHlcbi8vI2lmZGVmIElORkxBVEVfQUxMT1dfSU5WQUxJRF9ESVNUQU5DRV9UT09GQVJfQVJSUlxuLy8gICAgICAgICAgICAgICAgaWYgKGxlbiA8PSBvcCAtIHdoYXZlKSB7XG4vLyAgICAgICAgICAgICAgICAgIGRvIHtcbi8vICAgICAgICAgICAgICAgICAgICBvdXRwdXRbX291dCsrXSA9IDA7XG4vLyAgICAgICAgICAgICAgICAgIH0gd2hpbGUgKC0tbGVuKTtcbi8vICAgICAgICAgICAgICAgICAgY29udGludWUgdG9wO1xuLy8gICAgICAgICAgICAgICAgfVxuLy8gICAgICAgICAgICAgICAgbGVuIC09IG9wIC0gd2hhdmU7XG4vLyAgICAgICAgICAgICAgICBkbyB7XG4vLyAgICAgICAgICAgICAgICAgIG91dHB1dFtfb3V0KytdID0gMDtcbi8vICAgICAgICAgICAgICAgIH0gd2hpbGUgKC0tb3AgPiB3aGF2ZSk7XG4vLyAgICAgICAgICAgICAgICBpZiAob3AgPT09IDApIHtcbi8vICAgICAgICAgICAgICAgICAgZnJvbSA9IF9vdXQgLSBkaXN0O1xuLy8gICAgICAgICAgICAgICAgICBkbyB7XG4vLyAgICAgICAgICAgICAgICAgICAgb3V0cHV0W19vdXQrK10gPSBvdXRwdXRbZnJvbSsrXTtcbi8vICAgICAgICAgICAgICAgICAgfSB3aGlsZSAoLS1sZW4pO1xuLy8gICAgICAgICAgICAgICAgICBjb250aW51ZSB0b3A7XG4vLyAgICAgICAgICAgICAgICB9XG4vLyNlbmRpZlxuICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgIGZyb20gPSAwOyAvLyB3aW5kb3cgaW5kZXhcbiAgICAgICAgICAgICAgZnJvbV9zb3VyY2UgPSBzX3dpbmRvdztcbiAgICAgICAgICAgICAgaWYgKHduZXh0ID09PSAwKSB7ICAgICAgICAgICAvKiB2ZXJ5IGNvbW1vbiBjYXNlICovXG4gICAgICAgICAgICAgICAgZnJvbSArPSB3c2l6ZSAtIG9wO1xuICAgICAgICAgICAgICAgIGlmIChvcCA8IGxlbikgeyAgICAgICAgIC8qIHNvbWUgZnJvbSB3aW5kb3cgKi9cbiAgICAgICAgICAgICAgICAgIGxlbiAtPSBvcDtcbiAgICAgICAgICAgICAgICAgIGRvIHtcbiAgICAgICAgICAgICAgICAgICAgb3V0cHV0W19vdXQrK10gPSBzX3dpbmRvd1tmcm9tKytdO1xuICAgICAgICAgICAgICAgICAgfSB3aGlsZSAoLS1vcCk7XG4gICAgICAgICAgICAgICAgICBmcm9tID0gX291dCAtIGRpc3Q7ICAvKiByZXN0IGZyb20gb3V0cHV0ICovXG4gICAgICAgICAgICAgICAgICBmcm9tX3NvdXJjZSA9IG91dHB1dDtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgZWxzZSBpZiAod25leHQgPCBvcCkgeyAgICAgIC8qIHdyYXAgYXJvdW5kIHdpbmRvdyAqL1xuICAgICAgICAgICAgICAgIGZyb20gKz0gd3NpemUgKyB3bmV4dCAtIG9wO1xuICAgICAgICAgICAgICAgIG9wIC09IHduZXh0O1xuICAgICAgICAgICAgICAgIGlmIChvcCA8IGxlbikgeyAgICAgICAgIC8qIHNvbWUgZnJvbSBlbmQgb2Ygd2luZG93ICovXG4gICAgICAgICAgICAgICAgICBsZW4gLT0gb3A7XG4gICAgICAgICAgICAgICAgICBkbyB7XG4gICAgICAgICAgICAgICAgICAgIG91dHB1dFtfb3V0KytdID0gc193aW5kb3dbZnJvbSsrXTtcbiAgICAgICAgICAgICAgICAgIH0gd2hpbGUgKC0tb3ApO1xuICAgICAgICAgICAgICAgICAgZnJvbSA9IDA7XG4gICAgICAgICAgICAgICAgICBpZiAod25leHQgPCBsZW4pIHsgIC8qIHNvbWUgZnJvbSBzdGFydCBvZiB3aW5kb3cgKi9cbiAgICAgICAgICAgICAgICAgICAgb3AgPSB3bmV4dDtcbiAgICAgICAgICAgICAgICAgICAgbGVuIC09IG9wO1xuICAgICAgICAgICAgICAgICAgICBkbyB7XG4gICAgICAgICAgICAgICAgICAgICAgb3V0cHV0W19vdXQrK10gPSBzX3dpbmRvd1tmcm9tKytdO1xuICAgICAgICAgICAgICAgICAgICB9IHdoaWxlICgtLW9wKTtcbiAgICAgICAgICAgICAgICAgICAgZnJvbSA9IF9vdXQgLSBkaXN0OyAgICAgIC8qIHJlc3QgZnJvbSBvdXRwdXQgKi9cbiAgICAgICAgICAgICAgICAgICAgZnJvbV9zb3VyY2UgPSBvdXRwdXQ7XG4gICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgIGVsc2UgeyAgICAgICAgICAgICAgICAgICAgICAvKiBjb250aWd1b3VzIGluIHdpbmRvdyAqL1xuICAgICAgICAgICAgICAgIGZyb20gKz0gd25leHQgLSBvcDtcbiAgICAgICAgICAgICAgICBpZiAob3AgPCBsZW4pIHsgICAgICAgICAvKiBzb21lIGZyb20gd2luZG93ICovXG4gICAgICAgICAgICAgICAgICBsZW4gLT0gb3A7XG4gICAgICAgICAgICAgICAgICBkbyB7XG4gICAgICAgICAgICAgICAgICAgIG91dHB1dFtfb3V0KytdID0gc193aW5kb3dbZnJvbSsrXTtcbiAgICAgICAgICAgICAgICAgIH0gd2hpbGUgKC0tb3ApO1xuICAgICAgICAgICAgICAgICAgZnJvbSA9IF9vdXQgLSBkaXN0OyAgLyogcmVzdCBmcm9tIG91dHB1dCAqL1xuICAgICAgICAgICAgICAgICAgZnJvbV9zb3VyY2UgPSBvdXRwdXQ7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgIHdoaWxlIChsZW4gPiAyKSB7XG4gICAgICAgICAgICAgICAgb3V0cHV0W19vdXQrK10gPSBmcm9tX3NvdXJjZVtmcm9tKytdO1xuICAgICAgICAgICAgICAgIG91dHB1dFtfb3V0KytdID0gZnJvbV9zb3VyY2VbZnJvbSsrXTtcbiAgICAgICAgICAgICAgICBvdXRwdXRbX291dCsrXSA9IGZyb21fc291cmNlW2Zyb20rK107XG4gICAgICAgICAgICAgICAgbGVuIC09IDM7XG4gICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgaWYgKGxlbikge1xuICAgICAgICAgICAgICAgIG91dHB1dFtfb3V0KytdID0gZnJvbV9zb3VyY2VbZnJvbSsrXTtcbiAgICAgICAgICAgICAgICBpZiAobGVuID4gMSkge1xuICAgICAgICAgICAgICAgICAgb3V0cHV0W19vdXQrK10gPSBmcm9tX3NvdXJjZVtmcm9tKytdO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICAgIGZyb20gPSBfb3V0IC0gZGlzdDsgICAgICAgICAgLyogY29weSBkaXJlY3QgZnJvbSBvdXRwdXQgKi9cbiAgICAgICAgICAgICAgZG8geyAgICAgICAgICAgICAgICAgICAgICAgIC8qIG1pbmltdW0gbGVuZ3RoIGlzIHRocmVlICovXG4gICAgICAgICAgICAgICAgb3V0cHV0W19vdXQrK10gPSBvdXRwdXRbZnJvbSsrXTtcbiAgICAgICAgICAgICAgICBvdXRwdXRbX291dCsrXSA9IG91dHB1dFtmcm9tKytdO1xuICAgICAgICAgICAgICAgIG91dHB1dFtfb3V0KytdID0gb3V0cHV0W2Zyb20rK107XG4gICAgICAgICAgICAgICAgbGVuIC09IDM7XG4gICAgICAgICAgICAgIH0gd2hpbGUgKGxlbiA+IDIpO1xuICAgICAgICAgICAgICBpZiAobGVuKSB7XG4gICAgICAgICAgICAgICAgb3V0cHV0W19vdXQrK10gPSBvdXRwdXRbZnJvbSsrXTtcbiAgICAgICAgICAgICAgICBpZiAobGVuID4gMSkge1xuICAgICAgICAgICAgICAgICAgb3V0cHV0W19vdXQrK10gPSBvdXRwdXRbZnJvbSsrXTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgICB9XG4gICAgICAgICAgZWxzZSBpZiAoKG9wICYgNjQpID09PSAwKSB7ICAgICAgICAgIC8qIDJuZCBsZXZlbCBkaXN0YW5jZSBjb2RlICovXG4gICAgICAgICAgICBoZXJlID0gZGNvZGVbKGhlcmUgJiAweGZmZmYpLypoZXJlLnZhbCovICsgKGhvbGQgJiAoKDEgPDwgb3ApIC0gMSkpXTtcbiAgICAgICAgICAgIGNvbnRpbnVlIGRvZGlzdDtcbiAgICAgICAgICB9XG4gICAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICBzdHJtLm1zZyA9ICdpbnZhbGlkIGRpc3RhbmNlIGNvZGUnO1xuICAgICAgICAgICAgc3RhdGUubW9kZSA9IEJBRDtcbiAgICAgICAgICAgIGJyZWFrIHRvcDtcbiAgICAgICAgICB9XG5cbiAgICAgICAgICBicmVhazsgLy8gbmVlZCB0byBlbXVsYXRlIGdvdG8gdmlhIFwiY29udGludWVcIlxuICAgICAgICB9XG4gICAgICB9XG4gICAgICBlbHNlIGlmICgob3AgJiA2NCkgPT09IDApIHsgICAgICAgICAgICAgIC8qIDJuZCBsZXZlbCBsZW5ndGggY29kZSAqL1xuICAgICAgICBoZXJlID0gbGNvZGVbKGhlcmUgJiAweGZmZmYpLypoZXJlLnZhbCovICsgKGhvbGQgJiAoKDEgPDwgb3ApIC0gMSkpXTtcbiAgICAgICAgY29udGludWUgZG9sZW47XG4gICAgICB9XG4gICAgICBlbHNlIGlmIChvcCAmIDMyKSB7ICAgICAgICAgICAgICAgICAgICAgLyogZW5kLW9mLWJsb2NrICovXG4gICAgICAgIC8vVHJhY2V2digoc3RkZXJyLCBc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AgICAgPSAwO1xudmFyIFpfU1RSRUFNX0VORCAgICA9IDE7XG52YXIgWl9ORUVEX0RJQ1QgICAgID0gMjtcbi8vdmFyIFpfRVJSTk8gICAgICAgICA9IC0xO1xudmFyIFpfU1RSRUFNX0VSUk9SICA9IC0yO1xudmFyIFpfREFUQV9FUlJPUiAgICA9IC0zO1xudmFyIFpfTUVNX0VSUk9SICAgICA9IC00O1xudmFyIFpfQlVGX0VSUk9SICAgICA9IC01O1xuLy92YXIgWl9WRVJTSU9OX0VSUk9SID0gLTY7XG5cbi8qIFRoZSBkZWZsYXRlIGNvbXByZXNzaW9uIG1ldGhvZCAqL1xudmFyIFpfREVGTEFURUQgID0gODtcblxuXG4vKiBTVEFURVMgPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0qL1xuLyogPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09Ki9cblxuXG52YXIgICAgSEVBRCA9IDE7ICAgICAgIC8qIGk6IHdhaXRpbmcgZm9yIG1hZ2ljIGhlYWRlciAqL1xudmFyICAgIEZMQUdTID0gMjsgICAgICAvKiBpOiB3YWl0aW5nIGZvciBtZXRob2QgYW5kIGZsYWdzIChnemlwKSAqL1xudmFyICAgIFRJTUUgPSAzOyAgICAgICAvKiBpOiB3YWl0aW5nIGZvciBtb2RpZmljYXRpb24gdGltZSAoZ3ppcCkgKi9cbnZhciAgICBPUyA9IDQ7ICAgICAgICAgLyogaTogd2FpdGluZyBmb3IgZXh0cmEgZmxhZ3MgYW5kIG9wZXJhdGluZyBzeXN0ZW0gKGd6aXApICovXG52YXIgICAgRVhMRU4gPSA1OyAgICAgIC8qIGk6IHdhaXRpbmcgZm9yIGV4dHJhIGxlbmd0aCAoZ3ppcCkgKi9cbnZhciAgICBFWFRSQSA9IDY7ICAgICAgLyogaTogd2FpdGluZyBmb3IgZXh0c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hciAgICBET05FID0gMjk7ICAgICAgLyogZmluaXNoZWQgY2hlY2ssIGRvbmUgLS0gcmVtYWluIGhlcmUgdW50aWwgcmVzZXQgKi9cbnZhciAgICBCQUQgPSAzMDsgICAgICAgLyogZ290IGEgZGF0YSBlcnJvciAtLSByZW1haW4gaGVyZSB1bnRpbCByZXNldCAqL1xudmFyICAgIE1FTSA9IDMxOyAgICAgICAvKiBnb3QgYW4gaW5mbGF0ZSgpIG1lbW9yeSBlcnJvciAtLSByZW1haW4gaGVyZSB1bnRpbCByZXNldCAqL1xudmFyICAgIFNZTkMgPSAzMjsgICAgICAvKiBsb29raW5nIGZvciBzeW5jaHJvbml6YXRpb24gYnl0ZXMgdG8gcmVzdGFydCBpbmZsYXRlKCkgKi9cblxuLyogPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09Ki9cblxuXG5cbnZhciBFTk9VR0hfTEVOUyA9IDg1MjtcbnZhciBFTk9VR0hfRElTVFMgPSA1OTI7XG4vL3ZhciBFTk9VR0ggPSAgKEVOT1VHSF9MRU5TK0VOT1VHSF9ESVNUUyk7XG5cbnZhciBNQVhfV0JJVFMgPSAxNTtcbi8qIDMySyBMWjc3IHdpbmRvdyAqL1xudmFyIERFRl9XQklUUyA9IE1BWF9XQklUUztcblxuXG5mdW5jdGlvbiBaU1dBUDMyKHEpIHtcbiAgcmV0dXJuICAoKChxID4+PiAyNCkgJiAweGZmKSArXG4gICAgICAgICAgKChxID4+PiA4KSAmIDB4ZmYwMCkgK1xuICAgICAgICAgICgocSAmIDB4ZmYwMCkgPDwgOCkgK1xuICAgICAgICAgICgocSAmIDB4ZmYpIDw8IDI0KSk7XG59XG5cblxuZnVuY3Rpb24gSW5mbGF0ZVN0YXRlKCkge1xuICB0aGlzLm1vZGUgPSAwOyAgICAgICAgICAgICAvKiBjdXJyZW50IGluZmxhdGUgbW9kZSAqL1xuICB0aGlzLmxhc3QgPS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gICAgICAgYnJlYWs7XG4gICAgICB9XG4gICAgICBzdGF0ZS5mbGFncyA9IDA7ICAgICAgICAgICAvKiBleHBlY3QgemxpYiBoZWFkZXIgKi9cbiAgICAgIGlmIChzdGF0ZS5oZWFkKSB7XG4gICAgICAgIHN0YXRlLmhlYWQuZG9uZSA9IGZhbHNlO1xuICAgICAgfVxuICAgICAgaWYgKCEoc3RhdGUud3JhcCAmIDEpIHx8ICAgLyogY2hlY2sgaWYgemxpYiBoZWFkZXIgYWxsb3dlZCAqL1xuICAgICAgICAoKChob2xkICYgMHhmZikvKkJJVFMoOCkqLyA8PCA4KSArIChob2xkID4+IDgpKSAlIDMxKSB7XG4gICAgICAgIHN0cm0ubXNnID0gJ2luY29ycmVjdCBoZWFkZXIgY2hlY2snO1xuICAgICAgICBzdGF0ZS5tb2RlID0gQkFEO1xuICAgICAgICBicmVhaztcbiAgICAgIH1cbiAgICAgIGlmICgoaG9sZCAmIDB4MGYpLypCSVRTKDQpKi8gIT09IFpfREVGTEFURUQpIHtcbiAgICAgICAgc3RybS5tc2cgPSAndW5rbm93biBjb21wcmVzc2lvbiBtZXRob2QnO1xuICAgICAgICBzdGF0ZS5tb2RlID0gQkFEO1xuICAgICAgICBicmVhaztcbiAgICAgIH1cbiAgICAgIC8vLS0tIERST1BCSVRTKDQpIC0tLS8vXG4gICAgICBob2xkID4+Pj0gNDtcbiAgICAgIGJpdHMgLT0gNDtcbiAgICAgIC8vLS0tLy9cbiAgICAgIGxlbiA9IChob2xkICYgMHgwZikvKkJJVFMoNCkqLyArIDg7XG4gICAgICBpZiAoc3RhdGUud2JpdHMgPT09IDApIHtcbiAgICAgICAgc3RhdGUud2JpdHMgPSBsZW47XG4gICAgICB9XG4gICAgICBlbHNlIGlmIChsZW4gPiBzdGF0ZS53Yml0cykge1xuICAgICAgICBzdHJtLm1zZyA9ICdpbnZhbGlkIHdpbmRvdyBzaXplJztcbiAgICAgICAgc3RhdGUubW9kZSA9IEJBRDtcbiAgICAgICAgYnJlYWs7XG4gICAgICB9XG4gICAgICBzdGF0ZS5kbWF4ID0gMSA8PCBsZW47XG4gICAgICAvL1RyYWNldigoc3RkZXJyLCBcImluZmxhdGU6ICAgemxpYiBoZWFkZXIgb2tcXG5cIikpO1xuICAgICAgc3RybS5hZGxlciA9IHN0YXRlLmNoZWNrID0gMS8qYWRsZXIzMigwTCwgWl9OVUxMLCAwKSovO1xuICAgICAgc3RhdGUubW9kZSA9IGhvbGQgJiAweDIwMCA/IERJQ1RJRCA6IFRZUEU7XG4gICAgICAvLz09PSBJTklUQklUUygpO1xuICAgICAgaG9sZCA9IDA7XG4gICAgICBiaXRzID0gMDtcbiAgICAgIC8vPT09Ly9cbiAgICAgIGJyZWFrO1xuICAgIGNhc2UgRkxBR1M6XG4gICAgICAvLz09PSBORUVEQklUUygxNik7ICovXG4gICAgICB3aGlsZSAoYml0cyA8IDE2KSB7XG4gICAgICAgIGlmIChoYXZlID09PSAwKSB7IGJyZWFrIGluZl9sZWF2ZTsgfVxuICAgICAgICBoYXZlLS07XG4gICAgICAgIGhvbGQgKz0gaW5wdXRbbmV4dCsrXSA8PCBiaXRzO1xuICAgICAgICBiaXRzICs9IDg7XG4gICAgICB9XG4gICAgICAvLz09PS8vXG4gICAgICBzdGF0ZS5mbGFncyA9IGhvbGQ7XG4gICAgICBpZiAoKHN0YXRlLmZsYWdzICYgMHhmZikgIT09IFpfREVGTEFURUQpIHtcbiAgICAgICAgc3RybS5tc2cgPSAndW5rbm93biBjb21wcmVzc2lvbiBtZXRob2QnO1xuICAgICAgICBzdGF0ZS5tb2RlID0gQkFEO1xuICAgICAgICBicmVhaztcbiAgICAgIH1cbiAgICAgIGlmIChzdGF0ZS5mbGFncyAmIDB4ZTAwMCkge1xuICAgICAgICBzdHJtLm1zZyA9ICd1bmtub3duIGhlYWRlciBmbGFncyBzZXQnO1xuICAgICAgICBzdGF0ZS5tb2RlID0gQkFEO1xuICAgICAgICBicmVhaztcbiAgICAgIH1cbiAgICAgIGlm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1xuICAgICAgICAvLz09PS8vXG4gICAgICB9XG4gICAgICBlbHNlIGlmIChzdGF0ZS5oZWFkKSB7XG4gICAgICAgIHN0YXRlLmhlYWQuZXh0cmEgPSBudWxsLypaX05VTEwqLztcbiAgICAgIH1cbiAgICAgIHN0YXRlLm1vZGUgPSBFWFRSQTtcbiAgICAgIC8qIGZhbGxzIHRocm91Z2ggKi9cbiAgICBjYXNlIEVYVFJBOlxuICAgICAgaWYgKHN0YXRlLmZsYWdzICYgMHgwNDAwKSB7XG4gICAgICAgIGNvcHkgPSBzdGF0ZS5sZW5ndGg7XG4gICAgICAgIGlmIChjb3B5ID4gaGF2ZSkgeyBjb3B5ID0gaGF2ZTsgfVxuICAgICAgICBpZiAoY29weSkge1xuICAgICAgICAgIGlmIChzdGF0ZS5oZWFkKSB7XG4gICAgICAgICAgICBsZW4gPSBzdGF0ZS5oZWFkLmV4dHJhX2xlbiAtIHN0YXRlLmxlbmd0aDtcbiAgICAgICAgICAgIGlmICghc3RhdGUuaGVhZC5leHRyYSkge1xuICAgICAgICAgICAgICAvLyBVc2UgdW50eXBlZCBhcnJheSBmb3IgbW9yZSBjb252ZW5pZW5kIHByb2Nlc3NpbmcgbGF0ZXJcbiAgICAgICAgICAgICAgc3RhdGUuaGVhZC5leHRyYSA9IG5ldyBBcnJheShzdGF0ZS5oZWFkLmV4dHJhX2xlbik7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICB1dGlscy5hcnJheVNldChcbiAgICAgICAgICAgICAgc3RhdGUuaGVhZC5leHRyYSxcbiAgICAgICAgICAgICAgaW5wdXQsXG4gICAgICAgICAgICAgIG5leHQsXG4gICAgICAgICAgICAgIC8vIGV4dHJhIGZpZWxkIGlzIGxpbWl0ZWQgdG8gNjU1MzYgYnl0ZXNcbiAgICAgICAgICAgICAgLy8gLSBubyBuZWVkIGZvciBhZGRpdGlvbmFsIHNpemUgY2hlY2tcbiAgICAgICAgICAgICAgY29weSxcbiAgICAgICAgICAgICAgLypsZW4g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BORUVEQklUUygzKTsgKi9cbiAgICAgIHdoaWxlIChiaXRzIDwgMykge1xuICAgICAgICBpZiAoaGF2ZSA9PT0gMCkgeyBicmVhayBpbmZfbGVhdmU7IH1cbiAgICAgICAgaGF2ZS0tO1xuICAgICAgICBob2xkICs9IGlucHV0W25leHQrK10gPDwgYml0cztcbiAgICAgICAgYml0cyArPSA4O1xuICAgICAgfVxuICAgICAgLy89PT0vL1xuICAgICAgc3RhdGUubGFzdCA9IChob2xkICYgMHgwMSkvKkJJVFMoMSkqLztcbiAgICAgIC8vLS0tIERST1BCSVRTKDEpIC0tLS8vXG4gICAgICBob2xkID4+Pj0gMTtcbiAgICAgIGJpdHMgLT0gMTtcbiAgICAgIC8vLS0tLy9cblxuICAgICAgc3dpdGNoICgoaG9sZCAmIDB4MDMpLypCSVRTKDIpKi8pIHtcbiAgICAgIGNhc2UgMDogICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qIHN0b3JlZCBibG9jayAqL1xuICAgICAgICAvL1RyYWNldigoc3RkZXJyLCBcImluZmxhdGU6ICAgICBzdG9yZWQgYmxvY2slc1xcblwiLFxuICAgICAgICAvLyAgICAgICAgc3RhdGUubGFzdCA/IFwiIChsYXN0KVwiIDogXCJcIikpO1xuICAgICAgICBzdGF0ZS5tb2RlID0gU1RPUkVEO1xuICAgICAgICBicmVhaztcbiAgICAgIGNhc2UgMTogICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qIGZpeGVkIGJsb2NrICovXG4gICAgICAgIGZpeGVkdGFibGVzKHN0YXRlKTtcbiAgICAgICAgLy9UcmFjZXYoKHN0ZGVyciwgXCJpbmZsYXRlOiAgICAgZml4ZWQgY29kZXMgYmxvY2slc1xcblwiLFxuICAgICAgICAvLyAgICAgICAgc3RhdGUubGFzdCA/IFwiIChsYXN0KVwiIDogXCJcIikpO1xuICAgICAgICBzdGF0ZS5tb2RlID0gTEVOXzsgICAgICAgICAgICAgLyogZGVjb2RlIGNvZGVzICovXG4gICAgICAgIGlmIChmbHVzaCA9PT0gWl9UUkVFUykge1xuICAgICAgICAgIC8vLS0tIERST1BCSVRTKDIpIC0tLS8vXG4gICAgICAgICAgaG9sZCA+Pj49IDI7XG4gICAgICAgICAgYml0cyAtPSAyO1xuICAgICAgICAgIC8vLS0tLy9cbiAgICAgICAgICBicmVhayBpbmZfbGVhdmU7XG4gICAgICAgIH1cbiAgICAgICAgYnJlYWs7XG4gICAgICBjYXNlIDI6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiBkeW5hbWljIGJsb2NrICovXG4gICAgICAgIC8vVHJhY2V2KChzdGRlcnIsIFwiaW5mbGF0ZTogICAgIGR5bmFtaWMgY29kZXMgYmxvY2slc1xcblwiLFxuICAgICAgICAvLyAgICAgICAgc3RhdGUubGFzdCA/IFwiIChsYXN0KVwiIDogXCJcIikpO1xuICAgICAgICBzdGF0ZS5tb2RlID0gVEFCTEU7XG4gICAgICAgIGJyZWFrO1xuICAgICAgY2FzZSAzOlxuICAgICAgICBzdHJtLm1zZyA9ICdpbnZhbGlkIGJsb2NrIHR5cGUnO1xuICAgICAgICBzdGF0ZS5tb2RlID0gQkFEO1xuICAgICAgfVxuICAgICAgLy8tLS0gRFJPUEJJVFMoMikgLS0tLy9cbiAgICAgIGhvbGQgPj4+PSAyO1xuICAgICAgYml0cyAtPSAyO1xuICAgICAgLy8tLS0vL1xuICAgICAgYnJlYWs7XG4gICAgY2FzZSBTVE9SRUQ6XG4gICAgICAvLy0tLSBCWVRFQklUUygpIC0tLS8vIC8qIGdvIHRvIGJ5dGUgYm91bmRhcnkgKi9cbiAgICAgIGhvbGQgPj4+PSBiaXRzICYgNztcbiAgICAgIGJpdHMgLT0gYml0cyAmIDc7XG4gICAgICAvLy0tLS8vXG4gICAgICAvLz09PSBORUVEQklUUygzMik7ICovXG4gICAgICB3aGlsZSAoYml0cyA8IDMyKSB7XG4gICAgICAgIGlmIChoYXZlID09PSAwKSB7IGJyZWFrIGluZl9sZWF2ZTsgfVxuICAg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9sZWF2ZTsgfVxuICAgICAgICAvLy0tLSB6bWVtY3B5KHB1dCwgbmV4dCwgY29weSk7IC0tLVxuICAgICAgICB1dGlscy5hcnJheVNldChvdXRwdXQsIGlucHV0LCBuZXh0LCBjb3B5LCBwdXQpO1xuICAgICAgICAvLy0tLS8vXG4gICAgICAgIGhhdmUgLT0gY29weTtcbiAgICAgICAgbmV4dCArPSBjb3B5O1xuICAgICAgICBsZWZ0IC09IGNvcHk7XG4gICAgICAgIHB1dCArPSBjb3B5O1xuICAgICAgICBzdGF0ZS5sZW5ndGggLT0gY29weTtcbiAgICAgICAgYnJlYWs7XG4gICAgICB9XG4gICAgICAvL1RyYWNldigoc3RkZXJyLCBcImluZmxhdGU6ICAgICAgIHN0b3JlZCBlbmRcXG5cIikpO1xuICAgICAgc3RhdGUubW9kZSA9IFRZUEU7XG4gICAgICBicmVhaztcbiAgICBjYXNlIFRBQkxFOlxuICAgICAgLy89PT0gTkVFREJJVFMoMTQpOyAqL1xuICAgICAgd2hpbGUgKGJpdHMgPCAxNCkge1xuICAgICAgICBpZiAoaGF2ZSA9PT0gMCkgeyBicmVhayBpbmZfbGVhdmU7IH1cbiAgICAgICAgaGF2ZS0tO1xuICAgICAgICBob2xkICs9IGlucHV0W25leHQrK10gPDwgYml0cztcbiAgICAgICAgYml0cyArPSA4O1xuICAgICAgfVxuICAgICAgLy89PT0vL1xuICAgICAgc3RhdGUubmxlbiA9IChob2xkICYgMHgxZikvKkJJVFMoNSkqLyArIDI1NztcbiAgICAgIC8vLS0tIERST1BCSVRTKDUpIC0tLS8vXG4gICAgICBob2xkID4+Pj0gNTtcbiAgICAgIGJpdHMgLT0gNTtcbiAgICAgIC8vLS0tLy9cbiAgICAgIHN0YXRlLm5kaXN0ID0gKGhvbGQgJiAweDFmKS8qQklUUyg1KSovICsgMTtcbiAgICAgIC8vLS0tIERST1BCSVRTKDUpIC0tLS8vXG4gICAgICBob2xkID4+Pj0gNTtcbiAgICAgIGJpdHMgLT0gNTtc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BpZiAoaGVyZV92YWwgPT09IDE2KSB7XG4gICAgICAgICAgICAvLz09PSBORUVEQklUUyhoZXJlLmJpdHMgKyAyKTtcbiAgICAgICAgICAgIG4gPSBoZXJlX2JpdHMgKyAyO1xuICAgICAgICAgICAgd2hpbGUgKGJpdHMgPCBuKSB7XG4gICAgICAgICAgICAgIGlmIChoYXZlID09PSAwKSB7IGJyZWFrIGluZl9sZWF2ZTsgfVxuICAgICAgICAgICAgICBoYXZlLS07XG4gICAgICAgICAgICAgIGhvbGQgKz0gaW5wdXRbbmV4dCsrXSA8PCBiaXRzO1xuICAgICAgICAgICAgICBiaXRzICs9IDg7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICAvLz09PS8vXG4gICAgICAgICAgICAvLy0tLSBEUk9QQklUUyhoZXJlLmJpdHMpIC0tLS8vXG4gICAgICAgICAgICBob2xkID4+Pj0gaGVyZV9iaXRzO1xuICAgICAgICAgICAgYml0cyAtPSBoZXJlX2JpdHM7XG4gICAgICAgICAgICAvLy0tLS8vXG4gICAgICAgICAgICBpZiAoc3RhdGUuaGF2ZSA9PT0gMCkge1xuICAgICAgICAgICAgICBzdHJtLm1zZyA9ICdpbnZhbGlkIGJpdCBsZW5ndGggcmVwZWF0JztcbiAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IEJBRDtcbiAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBsZW4gPSBzdGF0ZS5sZW5zW3N0YXRlLmhhdmUgLSAxXTtcbiAgICAgICAgICAgIGNvcHkgPSAzICsgKGhvbGQgJiAweDAzKTsvL0JJVFMoMik7XG4gICAgICAgICAgICAvLy0tLSBEUk9QQklUUygyKSAtLS0vL1xuICAgICAgICAgICAgaG9sZCA+Pj49IDI7XG4gICAgICAgICAgICBiaXRzIC09IDI7XG4gICAgICAgICAgICAvLy0tLS8vXG4gICAgICAgICAgfVxuICAgICAgICAgIGVsc2UgaWYgKGhlcmVfdmFsID09PSAxNykge1xuICAgICAgICAgICAgLy89PT0gTkVFREJJVFMoaGVyZS5iaXRzICsgMyk7XG4gICAgICAgICAgICBuID0gaGVyZV9iaXRzICsgMztcbiAgICAgICAgICAgIHdoaWxlIChiaXRzIDwgbikge1xuICAgICAgICAgICAgICBpZiAoaGF2ZSA9PT0gMCkgeyBicmVhayBpbmZfbGVhdmU7IH1cbiAgICAgICAgICAgICAgaGF2ZS0tO1xuICAgICAgICAgICAgICBob2xkICs9IGlucHV0W25leHQrK10gPDwgYml0cztcbiAgICAgICAgICAgICAgYml0cyArPSA4O1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgLy89PT0vL1xuICAgICAgICAgICAgLy8tLS0gRFJPUEJJVFMoaGVyZS5iaXRzKSAtLS0vL1xuICAgICAgICAgICAgaG9sZCA+Pj49IGhlcmVfYml0cztcbiAgICAgICAgICAgIGJpdHMgLT0gaGVyZV9iaXRzO1xuICAgICAgICAgICAgLy8tLS0vL1xuICAgICAgICAgICAgbGVuID0gMDtcbiAgICAgICAgICAgIGNvcHkgPSAzICsgKGhvbGQgJiAweDA3KTsvL0JJVFMoMyk7XG4gICAgICAgICAgICAvLy0tLSBEUk9QQklUUygzKSAtLS0vL1xuICAgICAgICAgICAgaG9sZCA+Pj49IDM7XG4gICAgICAgICAgICBiaXRzIC09IDM7XG4gICAgICAgICAgICAvLy0tLS8vXG4gICAgICAgICAgfVxuICAgICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgLy89PT0gTkVFREJJVFMoaGVyZS5iaXRzICsgNyk7XG4gICAgICAgICAgICBuID0gaGVyZV9iaXRzICsgNztcbiAgICAgICAgICAgIHdoaWxlIChiaXRzIDwgbikge1xuICAgICAgICAgICAgICBpZiAoaGF2ZSA9PT0gMCkgeyBicmVhayBpbmZfbGVhdmU7IH1cbiAgICAgICAgICAgICAgaGF2ZS0tO1xuICAgICAgICAgICAgICBob2xkICs9IGlucHV0W25leHQrK10gPDwgYml0cztcbiAgICAgICAgICAgICAgYml0cyArPSA4O1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgLy89PT0vL1xuICAgICAgICAgICAgLy8tLS0gRFJPUEJJVFMoaGVyZS5iaXRzKSAtLS0vL1xuICAgICAgICAgICAgaG9sZCA+Pj49IGhlcmVfYml0cztcbiAgICAgICAgICAgIGJpdHMgLT0gaGVyZV9iaXRzO1xuICAgICAgICAgICAgLy8tLS0vL1xuICAgICAgICAgICAgbGVuID0gMDtcbiAgICAgICAgICAgIGNvcHkgPSAxMSArIChob2xkICYgMHg3Zik7Ly9CSVRTKDcpO1xuICAgICAgICAgICAgLy8tLS0gRFJPUEJJVFMoNykgLS0tLy9cbiAgICAgICAgICAgIGhvbGQgPj4+PSA3O1xuICAgICAgICAgICAgYml0cyAtPSA3O1xuICAgICAgICAgICAgLy8tLS0vL1xuICAgICAgICAgIH1cbiAgICAgICAgICBpZiAoc3RhdGUuaGF2ZSArIGNvcHkgPiBzdGF0ZS5ubGVuICsgc3RhdGUubmRpc3QpIHtcbiAgICAgICAgICAgIHN0cm0ubXNnID0gJ2ludmFsaWQgYml0IGxlbmd0aCByZXBlYXQnO1xuICAgICAgICAgICAgc3RhdGUubW9kZSA9IEJBRDtcbiAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgIH1cbiAgICAgICAgICB3aGlsZSAoY29weS0tKSB7XG4gICAgICAgICAgICBzdGF0ZS5sZW5zW3N0YXRlLmhhdmUrK10gPSBsZW47XG4gICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICB9XG5cbiAgICAgIC8qIGhhbmRsZSBlcnJvciBicmVha3MgaW4gd2hpbGUgKi9cbiAgICAgIGlmIChzdGF0ZS5tb2RlID09PSBCQUQpIHsgYnJlYWs7IH1cblxuICAgICAgLyogY2hlY2sgZm9yIGVuZC1vZi1ibG9jayBjb2RlIChiZXR0ZXIgaGF2ZSBvbmUpICovXG4gICAgICBpZiAoc3RhdGUubGVuc1syNTZdID09PSAwKSB7XG4gICAgICAgIHN0cm0ubXNnID0gJ2ludm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FwiaW5mbGF0ZTogICAgICAgICBlbmQgb2YgYmxvY2tcXG5cIikpO1xuICAgICAgICBzdGF0ZS5iYWNrID0gLTE7XG4gICAgICAgIHN0YXRlLm1vZGUgPSBUWVBFO1xuICAgICAgICBicmVhaztcbiAgICAgIH1cbiAgICAgIGlmIChoZXJlX29wICYgNjQpIHtcbiAgICAgICAgc3RybS5tc2cgPSAnaW52YWxpZCBsaXRlcmFsL2xlbmd0aCBjb2RlJztcbiAgICAgICAgc3RhdGUubW9kZSA9IEJBRDtcbiAgICAgICAgYnJlYWs7XG4gICAgICB9XG4gICAgICBzdGF0ZS5leHRyYSA9IGhlcmVfb3AgJiAxNTtcbiAgICAgIHN0YXRlLm1vZGUgPSBMRU5FWFQ7XG4gICAgICAvKiBmYWxscyB0aHJvdWdoICovXG4gICAgY2FzZSBMRU5FWFQ6XG4gICAgICBpZiAoc3RhdGUuZXh0cmEpIHtcbiAgICAgICAgLy89PT0gTkVFREJJVFMoc3RhdGUuZXh0cmEpO1xuICAgICAgICBuID0gc3RhdGUuZXh0cmE7XG4gICAgICAgIHdoaWxlIChiaXRzIDwgbikge1xuICAgICAgICAgIGlmIChoYXZlID09PSAwKSB7IGJyZWFrIGluZl9sZWF2ZTsgfVxuICAgICAgICAgIGhhdmUtLTtcbiAgICAgICAgICBob2xkICs9IGlucHV0W25leHQrK10gPDwgYml0cztcbiAgICAgICAgICBiaXRzICs9IDg7XG4gICAgICAgIH1cbiAgICAgICAgLy89PT0vL1xuICAgICAgICBzdGF0ZS5sZW5ndGggKz0gaG9sZCAmICgoMSA8PCBzdGF0ZS5leHRyYSkgLTEpLypCSVRTKHN0YXRlLmV4dHJhKSovO1xuICAgICAgICAvLy0tLSBEUk9QQklUUyhzdGF0ZS5leHRyYSkgLS0tLy9cbiAgICAgICAgaG9sZCA+Pj49IHN0YXRlLmV4dHJhO1xuICAgICAgICBiaXRzIC09IHN0YXRlLmV4dHJhO1xuICAgICAgICAvLy0tLS8vXG4gICAgICAgIHN0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dGF0ZS53aGF2ZTtcbi8vICAgICAgICAgIGlmIChjb3B5ID4gc3RhdGUubGVuZ3RoKSB7IGNvcHkgPSBzdGF0ZS5sZW5ndGg7IH1cbi8vICAgICAgICAgIGlmIChjb3B5ID4gbGVmdCkgeyBjb3B5ID0gbGVmdDsgfVxuLy8gICAgICAgICAgbGVmdCAtPSBjb3B5O1xuLy8gICAgICAgICAgc3RhdGUubGVuZ3RoIC09IGNvcHk7XG4vLyAgICAgICAgICBkbyB7XG4vLyAgICAgICAgICAgIG91dHB1dFtwdXQrK10gPSAwO1xuLy8gICAgICAgICAgfSB3aGlsZSAoLS1jb3B5KTtcbi8vICAgICAgICAgIGlmIChzdGF0ZS5sZW5ndGggPT09IDApIHsgc3RhdGUubW9kZSA9IExFTjsgfVxuLy8gICAgICAgICAgYnJlYWs7XG4vLyNlbmRpZlxuICAgICAgICB9XG4gICAgICAgIGlmIChjb3B5ID4gc3RhdGUud25leHQpIHtcbiAgICAgICAgICBjb3B5IC09IHN0YXRlLnduZXh0O1xuICAgICAgICAgIGZyb20gPSBzdGF0ZS53c2l6ZSAtIGNvcHk7XG4gICAgICAgIH1cbiAgICAgICAgZWxzZSB7XG4gICAgICAgICAgZnJvbSA9IHN0YXRlLnduZXh0IC0gY29weTtcbiAgICAgICAgfVxuICAgICAgICBpZiAoY29weSA+IHN0YXRlLmxlbmd0aCkgeyBjb3B5ID0gc3RhdGUubGVuZ3RoOyB9XG4gICAgICAgIGZyb21fc291cmNlID0gc3RhdGUud2luZG93O1xuICAgICAgfVxuICAgICAgZWxzZSB7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogY29weSBmcm9tIG91dHB1dCAqL1xuICAgICAgICBmcm9tX3NvdXJjZSA9IG91dHB1dDtcbiAgICAgICAgZnJvbSA9IHB1dCAtIHN0YXRlLm9mZnNldDtcbiAgICAgICAgY29weSA9IHN0YXRlLmxlbmd0aDtcbiAgICAgIH1cbiAgICAgIGlmIChjb3B5ID4gbGVmdCkge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1xuICAnMic6ICAgICduZWVkIGRpY3Rpb25hcnknLCAgICAgLyogWl9ORUVEX0RJQ1QgICAgICAgMiAgKi9cbiAgJzEnOiAgICAnc3RyZWFtIGVuZCcsICAgICAgICAgIC8qIFpfU1RSRUFNX0VORCAgICAgIDEgICovXG4gICcwJzogICAgJycsICAgICAgICAgICAgICAgICAgICAvKiBaX09LICAgICAgICAgICAgICAwICAqL1xuICAnLTEnOiAgICdmaWxlIGVycm9yJywgICAgICAgICAgLyogWl9FUlJOTyAgICAgICAgICgtMSkgKi9cbiAgJy0yJzogICAnc3RyZWFtIGVycm9yJywgICAgICAgIC8qIFpfU1RSRUFNX0VSUk9SICAoLTIpICovXG4gICctMyc6ICAgJ2RhdGEgZXJyb3InLCAgICAgICAgICAvKiBaX0RBVEFfRVJST1IgICAgKC0zKSAqL1xuICAnLTQnOiAgICdpbnN1ZmZpY2llbnQgbWVtb3J5JywgLyogWl9NRU1fRVJST1IgICAgICgtNCkgKi9cbiAgJy01JzogICAnYnVmZmVyIGVycm9yJywgICAgICAgIC8qIFpfQlVGX0VSUk9SICAgICAoLTUpICovXG4gICctNic6ICAgJ2luY29tcGF0aWJsZSB2ZXJzaW9uJyAvKiBaX1ZFUlNJT05fRVJST1IgKC02KSAqL1xufTtcbiIsIid1c2Ugc3RyaWN0JztcblxuXG52YXIgdXRpbHMgPSByZXF1aXJlKCcuLi91dGlscy9jb21tb24nKTtcblxuLyogUHVibGljIGNvbnN0YW50cyA9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09Ki9cbi8qID09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PSovXG5cblxuLy92YXIgWl9GSUxURVJFRCAgICAgICAgICA9IDE7XG4vL3ZhciBaX0hVRkZNQU5fT05MWSAgICAgID0gMjtcbi8vdmFyIFpfUkxFICAgICAgICAgICAgICAgPSAzO1xudmFyIFpfRklYRUQgICAgICAgICAgICAgICA9IDQ7XG4vL3ZhciBaX0RFRkFVTFRfU1RSQVRFR1kgID0gMDtcblxuLyogUG9zc2libGUgdmFsdWVzIG9mIHRoZSBkYXRhX3R5cGUgZmllbGQgKHRob3VnaCBzZWUgaW5mbGF0ZSgpKSAqL1xudmFyIFpfQklOQVJZICAgICAgICAgICAgICA9IDA7XG52YXIgWl9URVhUICAgICAgICAgICAgICAgID0gMTtcbi8vdmFyIFpfQVNDSUkgICAgICAgICAgICAgPSAxOyAvLyA9IFpfVEVYVFxudmFyIFpfVU5LTk9XTiAgICAgICAgICAgICA9IDI7XG5cbi8qPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PSovXG5cblxuZnVuY3Rpb24gemVybyhidWYpIHsgdmFyIGxlbiA9IGJ1Zi5sZW5ndGg7IHdoaWxlICgtLWxlbiA+PSAwKSB7IGJ1ZltsZW5dID0gMDsgfSB9XG5cbi8vIEZyb20genV0aWwuaFxuXG52YXIgU1RPUkVEX0JMT0NLID0gMDtcbnZhciBTVEFUSUNfVFJFRVMgPSAxO1xudmFyIERZTl9UUkVFUyAgICA9IDI7XG4vKiBUaGUgdGhyZWUga2luZHMgb2YgYmxvY2sgdHlwZSAqL1xuXG52YXIgTUlOX01BVENIICAgID0gMztcbnZhciBNQVhfTUFUQ0ggICAgPSAyNTg7XG4vKiBUaGUgbWluaW11bSBhbmQgbWF4aW11bSBtYXRjaCBsZW5ndGhzICovXG5cbi8vIEZyb20gZGVmbGF0ZS5oXG4vKiA9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT1cbiAqIEludGVybmFsIGNvbXByZXNzaW9uIHN0YXRlLlxuICovXG5cbnZhciBMRU5HVEhfQ09ERVMgID0gMjk7XG4vKiBudW1iZXIgb2YgbGVuZ3RoIGNvZGVzLC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SAxMCkge1xuICAgICAgcy5ibF90cmVlW1JFUFpfM18xMCoyXS8qLkZyZXEqLysrO1xuXG4gICAgfSBlbHNlIHtcbiAgICAgIHMuYmxfdHJlZVtSRVBaXzExXzEzOCoyXS8qLkZyZXEqLysrO1xuICAgIH1cblxuICAgIGNvdW50ID0gMDtcbiAgICBwcmV2bGVuID0gY3VybGVuO1xuXG4gICAgaWYgKG5leHRsZW4gPT09IDApIHtcbiAgICAgIG1heF9jb3VudCA9IDEzODtcbiAgICAgIG1pbl9jb3VudCA9IDM7XG5cbiAgICB9IGVsc2UgaWYgKGN1cmxlbiA9PT0gbmV4dGxlbikge1xuICAgICAgbWF4X2NvdW50ID0gNjtcbiAgICAgIG1pbl9jb3VudCA9IDM7XG5cbiAgICB9IGVsc2Uge1xuICAgICAgbWF4X2NvdW50ID0gNztcbiAgICAgIG1pbl9jb3VudCA9IDQ7XG4gICAgfVxuICB9XG59XG5cblxuLyogPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09XG4gKiBTZW5kIGEgbGl0ZXJhbCBvciBkaXN0YW5jZSB0cmVlIGluIGNvbXByZXNzZWQgZm9ybSwgdXNpbmcgdGhlIGNvZGVzIGluXG4gKiBibF90cmVlLlxuICovXG5mdW5jdGlvbiBzZW5kX3RyZWUocywgdHJlZSwgbWF4X2NvZGUpXG4vLyAgICBkZWZsYXRlX3N0YXRlICpzO1xuLy8gICAgY3RfZGF0YSAqdHJlZTsgLyogdGhlIHRyZWUgdG8gYmUgc2Nhbm5lZCAqL1xuLy8gICAgaW50IG1heF9jb2RlOyAgICAgICAvKiBhbmQgaXRzIGxhcmdlc3QgY29kZSBvZiBub24gemVybyBmcmVxdWVuY3kgKi9cbntcbiAgdmFyIG47ICAgICAgICAgICAgICAgICAgICAgLyogaXRlcmF0ZXMgb3ZlciBhbGwgdHJlZSBlbGVtZW50cyAqL1xuICB2YXIgcHJldmxlbiA9IC0xOyAgICAgICAgICAvKiBsYXN0IGVtaXR0ZWQgbGVuZ3RoICovXG4gIHZhciBjdXJsZW47ICAgICAgICAgICAgICAgIC8qIGxlbmd0aCBvZiBjdXJyZW50IGNvZGUgKi9cblxuICB2YXIgbmV4dGxlbiA9IHRyZWVbMCoyICsgMV0vKi5MZW4qLzsgLyogbGVuZ3RoIG9mIG5leHQgY29kZSAqL1xuXG4gIHZhciBjb3VudCA9IDA7ICAgICAgICAgICAgIC8qIHJlcGVhdCBjb3VudCBvZiB0aGUgY3VycmVudCBjb2RlICovXG4gIHZhciBtYXhfY291bnQgPSA3OyAgICAgICAgIC8qIG1heCByZXBlYXQgY291bnQgKi9cbiAgdmFyIG1pbl9jb3VudCA9IDQ7ICAgICAgICAgLyogbWluIHJlcGVhdCBjb3VudCAqL1xuXG4gIC8qIHRyZWVbbWF4X2NvZGUrMV0uTGVuID0gLTE7ICovICAvKiBndWFyZCBhbHJlYWR5IHNldCAqL1xuICBpZiAobmV4dGxlbiA9PT0gMCkge1xuICAgIG1heF9jb3VudCA9IDEzODtcbiAgICBtaW5fY291bnQgPSAzO1xuICB9XG5cbiAgZm9yIChuID0gMDsgbiA8PSBtYXhfY29kZTsgbisrKSB7XG4gICAgY3VybGVuID0gbmV4dGxlbjtcbiAgICBuZXh0bGVuID0gdHJlZVsobisxKSoyICsgMV0vKi5MZW4qLztcblxuICAgIGlmICgrK2NvdW50IDwgbWF4X2NvdW50ICYmIGN1cmxlbiA9PT0gbmV4dGxlbikge1xuICAgICAgY29udGludWU7XG5cbiAgICB9IGVsc2UgaWYgKGNvdW50IDwgbWluX2NvdW50KSB7XG4gICAgICBkbyB7IHNlbmRfY29kZShzLCBjdXJsZW4sIHMuYmxfdHJlZSk7IH0gd2hpbGUgKC0tY291bnQgIT09IDApO1xuXG4gICAgfSBlbHNlIGlmIChjdXJsZW4gIT09IDApIHtcbiAgICAgIGlmIChjdXJsZW4gIT09IHByZXZsZW4pIHtcbiAgICAgICAgc2VuZF9jb2RlKHMsIGN1cmxlbiwgcy5ibF90cmVlKTtcbiAgICAgICAgY291bnQtLTtcbiAgICAgIH1cbiAgICAgIC8vQXNzZXJ0KGNvdW50ID49IDMgJiYgY291bnQgPD0gNiwgXCIgM182P1wiKTtcbiAgICAgIHNlbmRfY29kZShzLCBSRVBfM182LCBzLmJsX3RyZWUpO1xuICAgICAgc2VuZF9iaXRzKHMsIGNvdW50LTMsIDIpO1xuXG4gICAgfSBlbHNlIGlmIChjb3VudCA8PSAxMCkge1xuICAgICAgc2VuZF9jb2RlKHMsIFJFUFpfM18xMCwgcy5ibF90cmVlKTtcbiAgICAgIHNlbmRfYml0cyhzLCBjb3VudC0zLCAzKTtcblxuICAgIH0gZWxzZSB7XG4gICAgICBzZW5kX2NvZGUocywgUkVQWl8xMV8xMzgsIHMuYmxfdHJlZSk7XG4gICAgICBzZW5kX2JpdHMocywgY291bnQtMTEsIDcpO1xuICAgIH1cblxuICAgIGNvdW50ID0gMDtcbiAgICBwcmV2bGVuID0gY3VybGVuO1xuICAgIGlmIChuZXh0bGVuID09PSAwKSB7XG4gICAgICBtYXhfY291bnQgPSAxMzg7XG4gICAgICBtaW5fY291bnQgPSAzO1xuXG4gICAgfSBlbHNlIGlmIChjdXJsZW4gPT09IG5leHRsZW4pIHtcbiAgICAgIG1heF9jb3VudCA9IDY7XG4gICAgICBtaW5fY291bnQgPSAzO1xuXG4gICAgfSBlbHNlIHtcbiAgICAgIG1heF9jb3VudCA9IDc7XG4gICAgICBtaW5fY291bnQgPSA0O1xuICAgIH1cbiAgfVxufVxuXG5cbi8qID09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PVxuICogQ29uc3RydWN0IHRoZSBIdWZmbWFuIHRyZWUgZm9yIHRoZSBiaXQgbGVuZ3RocyBhbmQgcmV0dXJuIHRoZSBpbmRleCBpblxuICogYmxfb3JkZXIgb2YgdGhlIGxhc3QgYml0IGxlb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0gZXI7XG4gICAgfSk7XG5cbiAgICBkbyB7XG4gICAgICB2YXIgcmVzID0gdGhpcy5fYmluZGluZy53cml0ZVN5bmMoZmx1c2hGbGFnLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNodW5rLCAvLyBpblxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGluT2ZmLCAvLyBpbl9vZmZcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhdmFpbEluQmVmb3JlLCAvLyBpbl9sZW5cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLl9idWZmZXIsIC8vIG91dFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuX29mZnNldCwgLy9vdXRfb2ZmXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXZhaWxPdXRCZWZvcmUpOyAvLyBvdXRfbGVuXG4gICAgfSB3aGlsZSAoIXRoaXMuX2hhZEVycm9yICYmIGNhbGxiYWNrKHJlc1swXSwgcmVzWzFdKSk7XG5cbiAgICBpZiAodGhpcy5faGFkRXJyb3IpIHtcbiAgICAgIHRocm93IGVycm9yO1xuICAgIH1cblxuICAgIHZhciBidWYgPSBCdWZmZXIuY29uY2F0KGJ1ZmZlcnMsIG5yZWFkKTtcbiAgICB0aGlzLmNsb3NlKCk7XG5cbiAgICByZXR1cm4gYnVmO1xuICB9XG5cbiAgdmFyIHJlcSA9IHRoaXMuX2JpbmRpbmcud3JpdGUoZmx1c2hGbGFnLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjaHVuaywgLy8gaW5cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW5PZmYsIC8vIGluX29mZlxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhdmFpbEluQmVmb3JlLCAvLyBpbl9sZW5cbiAgICAgICAgICAgICAgICAgICAgICAgIC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AgICAvLyBhbGwgb3RoZXIgdHJhbnNmZXIgc3ludGF4ZXMgYXJlIGxpdHRsZSBlbmRpYW47IG9ubHkgdGhlIHBpeGVsIGVuY29kaW5nIGRpZmZlcnNcbiAgICAgICAgICAgICAgICAvLyBtYWtlIGEgbmV3IHN0cmVhbSBzbyB0aGUgbWV0YWhlYWRlciB3YXJuaW5ncyBkb24ndCBjb21lIGFsb25nIGZvciB0aGUgcmlkZVxuICAgICAgICAgICAgICAgIHJldHVybiBuZXcgZGljb21QYXJzZXIuQnl0ZVN0cmVhbShkaWNvbVBhcnNlci5saXR0bGVFbmRpYW5CeXRlQXJyYXlQYXJzZXIsIGJ5dGVBcnJheSwgcG9zaXRpb24pO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG5cbiAgICAgICAgZnVuY3Rpb24gbWVyZ2VEYXRhU2V0cyhtZXRhSGVhZGVyRGF0YVNldCwgaW5zdGFuY2VEYXRhU2V0KVxuICAgICAgICB7XG4gICAgICAgICAgICBmb3IgKHZhciBwcm9wZXJ0eU5hbWUgaW4gbWV0YUhlYWRlckRhdGFTZXQuZWxlbWVudHMpXG4gICAgICAgICAgICB7XG4gICAgICAgICAgICAgICAgaWYobWV0YUhlYWRlckRhdGFTZXQuZWxlbWVudHMuaGFzT3duUHJvcGVydHkocHJvcGVydHlOYW1lKSlcbiAgICAgICAgICAgICAgICB7XG4gICAgICAgICAgICAgICAgICAgIGluc3RhbmNlRGF0YVNldC5lbGVtZW50c1twcm9wZXJ0eU5hbWVdID0gbWV0YUhlYWRlckRhdGFTZXQuZWxlbWVudHNbcHJvcGVydHlOYW1lXTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAobWV0YUhlYWRlckRhdGFTZXQud2FybmluZ3MgIT09IHVuZGVmaW5lZCkge1xuICAgICAgICAgICAgICAgIGluc3RhbmNlRGF0YVNldC53YXJuaW5ncyA9IG1ldGFIZWFkZXJEYXRhU2V0Lndhcm5pbm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ICBlbHNlXG4gICAgICAgICAgICAgICAge1xuICAgICAgICAgICAgICAgICAgICBkaWNvbVBhcnNlci5wYXJzZURpY29tRGF0YVNldEltcGxpY2l0KGRhdGFTZXQsIGRhdGFTZXRCeXRlU3RyZWFtLCBkYXRhU2V0Qnl0ZVN0cmVhbS5ieXRlQXJyYXkubGVuZ3RoLCBvcHRpb25zKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBjYXRjaChlKSB7XG4gICAgICAgICAgICAgICAgdmFyIGV4ID0ge1xuICAgICAgICAgICAgICAgICAgICBleGNlcHRpb246IGUsXG4gICAgICAgICAgICAgICAgICAgIGRhdGFTZXQ6IGRhdGFTZXRcbiAgICAgICAgICAgICAgICB9O1xuICAgICAgICAgICAgICAgIHRocm93IGV4O1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgcmV0dXJuIGRhdGFTZXQ7XG4gICAgICAgIH1cblxuICAgICAgICAvLyBtYWluIGZ1bmN0aW9uIGhlcmVcbiAgICAgICAgZnVuY3Rpb24gcGFyc2VUaGVCeXRlU3RyZWFtKCkge1xuICAgICAgICAgICAgdmFyIG1ldGFIZWFkZXJEYXRhU2V0ID0gZGljb21QYXJzZXIucmVhZFBhcnQxMEhlYWRlcihieXRlQXJyYXksIG9wdGlvbnMpO1xuXG4gICAgICAgICAgICB2YXIgZGF0YVNldCA9IHJlYWREYXRhU2V0KG1ldGFIZWFkZXJEYXRhU2V0KTtcblxuICAgICAgICAgICAgcmV0dXJuIG1lcmdlRGF0YVNldHMobWV0YUhlYWRlckRhdGFTZXQsIGRhdGFTZXQpO1xuICAgICAgICB9XG5cbiAgICAgICAgLy8gVGhpcyBpcyB3aGVyZSB3ZSBhY3R1YWxseSBzdGFydCBwYXJzaW5nXG4gICAgICAgIHJldHVybiBwYXJzZVRoZUJ5dGVTdHJlYW0oKTtcbiAgICB9O1xuXG4gICAgcmV0dXJuIGRpY29tUGFyc2VyO1xufSkoZGljb21QYXJ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IDEyOCAgICAgIC8vIG1heGltdW0gZWxlbWVudCBsZW5ndGggdG8gdHJ5IGFuZCBjb252ZXJ0IHRvIHN0cmluZyBmb3JtYXRcbiAgICAgICAgfTtcblxuICAgICAgICB2YXIgcmVzdWx0ID0ge1xuXG4gICAgICAgIH07XG5cbiAgICAgICAgZm9yKHZhciB0YWcgaW4gZGF0YVNldC5lbGVtZW50cykge1xuICAgICAgICAgICAgdmFyIGVsZW1lbnQgPSBkYXRhU2V0LmVsZW1lbnRzW3RhZ107XG5cbiAgICAgICAgICAgIC8vIHNraXAgdGhpcyBlbGVtZW50IGlmIGl0IGEgcHJpdmF0ZSBlbGVtZW50IGFuZCBvdXIgb3B0aW9ucyBzcGVjaWZ5IHRoYXQgd2Ugc2hvdWxkXG4gICAgICAgICAgICBpZihvcHRpb25zLm9taXRQcml2YXRlQXR0aWJ1dGVzID09PSB0cnVlICYmIGRpY29tUGFyc2VyLmlzUHJpdmF0ZVRhZyh0YWcpKVxuICAgICAgICAgICAge1xuICAgICAgICAgICAgICAgIGNvbnRpbnVlO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICBpZihlbGVtZW50Lml0ZW1zKSB7XG4gICAgICAgICAgICAgICAgLy8gaGFuZGxlIHNlcXVlbmNlc1xuICAgICAgICAgICAgICAgIHZhciBzZXF1ZW5jZUl0ZW1zID0gW107XG4gICAgICAgICAgICAgICAgZm9yKHZhciBpPTA7IGkgPCBlbGVtZW50Lml0ZW1zLmxlbmd0aDsgaSsrKSB7XG4gICAgICAgICAgICAgICAgICAgIHNlcXVlbmNlSXRlbXMucHVzaChkaWNvbVBhcnNlci5leHBsaWNpdERhdGFTZXRUb0pTKGVsZW1lbnQuaXRlbXNbaV0uZGF0YVNldCwgb3B0aW9ucykpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICByZXN1bHRbdGFnXSA9IHNlcXVlbmNlSXRlbXM7XG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIHZhciBhc1N0cmluZztcbiAgICAgICAgICAgICAgICBhc1N0cmluZyA9IHVuZGVmaW5lZDtcbiAgICAgICAgICAgICAgICBpZihlbGVtZW50Lmxlbmd0aCA8IG9wdGlvbnMubWF4RWxlbWVudExlbmd0aCkge1xuICAgICAgICAgICAgICAgICAgICBhc1N0cmluZyA9IGRpY29tUGFyc2VyLmV4cGxpY2l0RWxlbWVudFRvU3RyaW5nKGRhdGFTZXQsIGVsZW1lbnQpO1xuICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgIGlmKGFzU3RyaW5nICE9PSB1bmRlZmluZWQpIHtcbiAgICAgICAgICAgICAgICAgICAgcmVzdWx0W3RhZ10gPSBhc1N0cmluZztcbiAgICAgICAgICAgICAgICB9ICBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgcmVzdWx0W3RhZ10gPSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBkYXRhT2Zmc2V0OiBlbGVtZW50LmRhdGFPZmZzZXQsXG4gICAgICAgICAgICAgICAgICAgICAgICBsZW5ndGggOiBlbGVtZW50Lmxlbmd0aFxuICAgICAgICAgICAgICAgICAgICB9O1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuXG4gICAgICAgIHJldHVybiByZXN1bHQ7XG4gICAgfTtcblxuXG4gICAgcmV0dXJuIGRpY29tUGFyc2VyO1xufShkaWNvbVBhcnNlcikpO1xudmFyIGRpY29tUGFyc2VyID0gKGZ1bmN0aW9uIChkaWNvbVBhcnNlcikge1xuICAgIFwidXNlIHN0cmljdFwiO1xuXG4gICAgaWYgKGRpY29tUGFyc2VyID09PSB1bmRlZmluZWQpIHtcbiAgICAgICAgZGljb21QYXJzZXIgPSB7fTtcbiAgICB9XG5cbiAgICAvKipcbiAgICAgKiBDb252ZXJ0cyBhbiBleHBsaWNpdCBWUiBlbGVtZW50IHRvIGEgc3RyaW5nIG9yIHVuZGVmaW5lZCBpZiBpdCBpcy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nO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICByZXN1bHQgKz0gZnVuYy5jYWxsKGRhdGFTZXQsIHRhZywgaSkudG9TdHJpbmcoKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHJldHVybiByZXN1bHQ7XG4gICAgICAgIH1cblxuICAgICAgICBpZihkaWNvbVBhcnNlci5pc1N0cmluZ1ZyKHZyKSA9PT0gdHJ1ZSlcbiAgICAgICAge1xuICAgICAgICAgICAgdGV4dFJlc3VsdCA9IGRhdGFTZXQuc3RyaW5nKHRhZyk7XG4gICAgICAgIH1cbiAgICAgICAgZWxzZSBpZiAodnIgPT0gJ0FUJykge1xuICAgICAgICAgICAgdmFyIG51bSA9IGRhdGFTZXQudWludDMyKHRhZyk7XG4gICAgICAgICAgICBpZihudW0gPT09IHVuZGVmaW5lZCkge1xuICAgICAgICAgICAgICAgIHJldHVybiB1bmRlZmluZWQ7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAobnVtIDwgMClcbiAgICAgICAgICAgIHtcbiAgICAgICAgICAgICAgICBudW0gPSAweEZGRkZGRkZGICsgbnVtICsgMTtcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgcmV0dXJuICd4JyArIG51bS50b1N0cmluZygxNikudG9VcHBlckNhc2UoKTtcbiAgICAgICAgfVxuICAgICAgICBlbHNlIGlmICh2ciA9PSAnVVMnKVxuICAgICAgICB7XG4gICAgICAgICAgICB0ZXh0UmVzdWx0ID0gbXVsdGlFbGVtZW50VG9TdHJpbmcoZWxlbWVudC5sZW5ndGggLyAyLCBkYXRhU2V0LnVpbnQxNik7XG4gICAgICAgIH1cbiAgICAgICAgZWxzZSBpZih2ciA9PT0gJ1NTJylcbiAgICAgICAge1xuICAgICAgICAgICAgdGV4dFJlc3VsdCA9IG11bHRpRWxlbWVudFRvU3RyaW5nKGVsZW1lbnQubGVuZ3RoIC8gMiwgZGF0YVNldC5pbnQxNik7XG4gICAgICAgIH1cbi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dHJpbmcoMiwgNCksIDEwKSA6IHVuZGVmaW5lZDtcbiAgICAgIHZhciBzcyA9IHRpbWUubGVuZ3RoID49IDYgPyBwYXJzZUludCh0aW1lLnN1YnN0cmluZyg0LCA2KSwgMTApIDogdW5kZWZpbmVkO1xuICAgICAgdmFyIGZmZmZmZiA9IHRpbWUubGVuZ3RoID49IDggPyBwYXJzZUludCh0aW1lLnN1YnN0cmluZyg3LCAxMyksIDEwKSA6IHVuZGVmaW5lZDtcblxuICAgICAgaWYodmFsaWRhdGUpIHtcbiAgICAgICAgaWYoKGlzTmFOKGhoKSkgfHxcbiAgICAgICAgICAobW0gIT09IHVuZGVmaW5lZCAmJiBpc05hTihtbSkpIHx8XG4gICAgICAgICAgKHNzICE9PSB1bmRlZmluZWQgJiYgaXNOYU4oc3MpKSB8fFxuICAgICAgICAgIChmZmZmZmYgIT09IHVuZGVmaW5lZCAmJiBpc05hTihmZmZmZmYpKSB8fFxuICAgICAgICAgIChoaCA8IDAgfHwgaGggPiAyMykgfHxcbiAgICAgICAgICAobW0gJiYgKG1tIDwwIHx8IG1tID4gNTkpKSAgfHxcbiAgICAgICAgICAoc3MgJiYgKHNzIDwwIHx8IHNzID4gNTkpKSAgfHxcbiAgICAgICAgICAoZmZmZmZmICYmIChmZmZmZmYgPDAgfHwgZmZmZmZmID4gOTk5OTk5KSkpXG4gICAgICAgIHtcbiAgICAgICAgICB0aHJvdyBcImludmFsaWQgVE0gJ1wiICsgdGltZSArIFwiJ1wiO1xuICAgICAgICB9XG4gICAgICB9XG5cbiAgICAgIHJldHVybiB7XG4gICAgICAgIGhvdXJzOiBoaCxcbiAgICAgICAgbWludXRlczogbW0sXG4gICAgICAgIHNlY29uZHM6IHNzLFxuICAgICAgICBmcmFjdGlvbmFsU2Vjb25kczogZmZmZmZmXG4gICAgICB9O1xuICAgIH1cblxuICAgIGlmKHZhbGlkYXRlKSB7XG4gICAgICB0aHJvdyBcImludmFsaWQgVE0gJ1wiICsgdGltZSArIFwiJ1wiO1xuICAgIH1cblxuICAgIHJldHVybiB1bmRlZmluZWQ7XG4gIH07XG5cbiAgcmV0dXJuIGRpY29tUGFyc2VyO1xufShkaWNvbVBhcnNlcikpO1xuLyoqXG4gKiBVdGlsaXR5IGZ1bmN0aW9ucyBmb3IgZGVhbGluZyB3aXRoIERJQ09NXG4gKi9cblxudmFyIGRpY29tUGFyc2VyID0gKGZ1bmN0aW9uIChkaWNvbVBhcnNlcilcbntcbiAgICBcInVzZSBzdHJpY3RcIjtcblxuICAgIGlmKGRpY29tUGFyc2VyID09PSB1bmRlZmluZWQpXG4gICAge1xuICAgICAgICBkaWNvbVBhcnNlciA9IHt9O1xuICAgIH1cblxuICAgIHZhciBzdHJpbmdWcnMgPSB7XG4gICAgICAgIEFFOiB0cnVlLFxuICAgICAgICBBUzogdHJ1ZSxcbiAgICAgICAgQVQ6IGZhbHNlLFxuICAgICAgICBDUzogdHJ1ZSxcbiAgICAgICAgREE6IHRydWUsXG4gICAgICAgIERTOiB0cnVlLFxuICAgICAgICBEVDogdHJ1ZSxcbiAgICAgICAgRkw6IGZhbHNlLFxuICAgICAgICBGRDogZmFsc2UsXG4gICAgICAgIElTOiB0cnVlLFxuICAgICAgICBMTzogdHJ1ZSxcbiAgICAgICAgTFQ6IHRydWUsXG4gICAgICAgIE9COiBmYWxzZSxcbiAgICAgICAgT0Q6IGZhbHNlLFxuICAgICAgICBPRjogZmFsc2UsXG4gICAgICAgIE9XOiBmYWxzZSxcbiAgICAgICAgUE46IHRydWUsXG4gICAgICAgIFNIOiB0cnVlLFxuICAgICAgICBTTDogZmFsc2UsXG4gICAgICAgIFNROiBmYWxzZSxcbiAgICAgICAgU1M6IGZhbHNlLFxuICAgICAgICBTVDogdHJ1ZSxcbiAgICAgICAgVE06IHRydWUsXG4gICAgICAgIFVJOiB0cnVlLFxuICAgICAgICBVTDogZmFsc2UsXG4gICAgICAgIFVOOiB1bmRlZmluZWQsIC8vIGR1bm5vXG4gICAgICAgIFVSOiB0cnV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2l0aW9uICsgMV07XG4gICAgICAgICAgICAvLyBmaXggc2lnblxuICAgICAgICAgICAgaWYgKGludDE2ICYgMHg4MDAwKSB7XG4gICAgICAgICAgICAgICAgaW50MTYgPSBpbnQxNiAtIDB4RkZGRiAtIDE7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICByZXR1cm4gaW50MTY7XG4gICAgICAgIH0sXG5cbiAgICAgICAgLyoqXG4gICAgICAgICAqIFBhcnNlcyBhbiB1bnNpZ25lZCBpbnQgMzIgZnJvbSBhIGJpZy1lbmRpYW4gYnl0ZSBhcnJheVxuICAgICAgICAgKlxuICAgICAgICAgKiBAcGFyYW0gYnl0ZUFycmF5IHRoZSBieXRlIGFycmF5IHRvIHJlYWQgZnJvbVxuICAgICAgICAgKiBAcGFyYW0gcG9zaXRpb24gdGhlIHBvc2l0aW9uIGluIHRoZSBieXRlIGFycmF5IHRvIHJlYWQgZnJvbVxuICAgICAgICAgKiBAcmV0dXJucyB7Kn0gdGhlIHBhcnNlZCB1bnNpZ25lZCBpbnQgMzJcbiAgICAgICAgICogQHRocm93cyBlcnJvciBpZiBidWZmZXIgb3ZlcnJlYWQgd291bGQgb2NjdXJcbiAgICAgICAgICogQGFjY2VzcyBwcml2YXRlXG4gICAgICAgICAqL1xuICAgICAgICByZWFkVWludDMyOiBmdW5jdGlvbiAoYnl0ZUFycmF5LCBwb3NpdGlvbikge1xuICAgICAgICAgICAgaWYgKHBvc2l0aW9uIDwgMCkge1xuICAgICAgICAgICAgICAgIHRocm93ICdiaWdFbmRpYW5CeXRlQXJyYXlQYXJzZXIucmVhZFVpbnQzMjogcG9zaXRpb24gY2Fubm90IGJlIGxlc3MgdGhhbiAwJztcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgaWYgKHBvc2l0aW9uICsgNCA+IGJ5dGVBcnJheS5sZW5ndGgpIHtcbiAgICAgICAgICAgICAgICB0aHJvdyAnYmlnRW5kaWFuQnl0ZUFycmF5UGFyc2VyLnJlYWRVaW50MzI6IGF0dGVtcHQgdG8gcmVhZCBwYXN0IGVuZCBvZiBidWZmZXInO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICB2YXIgdWludDMyID0gKDI1NiAqICgyNTYgKiAoMjU2ICogYnl0ZUFycmF5W3Bvc2l0aW9uXSArXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnl0ZUFycmF5W3Bvc2l0aW9uICsgMV0pICtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBieXRlQXJyYXlbcG9zaXRpb24gKyAyXSkgK1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJ5dGVBcnJheVtwb3NpdGlvbiArIDNdKTtcblxuICAgICAgICAgICAgcmV0dXJuIHVpbnQzMjtcbiAgICAgICAgfSxcblxuICAgICAgICAvKipcbiAgICAgICAgICogUGFyc2VzIGEgc2lnbmVkIGludCAzMiBmcm9tIGEgYmlnLWVuZGlhbiBieXRlIGFycmF5XG4gICAgICAgICAqXG4gICAgICAgICAqIEBwYXJhbSBieXRlQXJyYXkgdGhlIGJ5dGUgYXJyYXkgdG8gcmVhZCBmcm9tXG4gICAgICAgICAqIEBwYXJhbSBwb3NpdGlvbiB0aGUgcG9zaXRpb24gaW4gdGhlIGJ5dGUgYXJyYXkgdG8gcmVhZCBmcm9tXG4gICAgICAgICAqIEByZXR1cm5zIHsqfSB0aGUgcGFyc2VkIHNpZ25lZCBpbnQgMzJcbiAgICAgICAgICogQHRocm93cyBlcnJvciBpZiBidWZmZXIgb3ZlcnJlYWQgd291bGQgb2NjdXJcbiAgICAgICAgICogQGFjY2VzcyBwcml2YXRlXG4gICAgICAgICAqL1xuICAgICAgICByZWFkSW50MzI6IGZ1bmN0aW9uIChieXRlQXJyYXksIHBvc2l0aW9uKSB7XG4gICAgICAgICAgICBpZiAocG9zaXRpb24gPCAwKSB7XG4gICAgICAgICAgICAgICAgdGhyb3cgJ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dHR0VFRUVcbiAgICAgKiBAcGFyYW0gaW5kZXggdGhlIGluZGV4IG9mIHRoZSBkZXNpcmVkIHZhbHVlIGluIGEgbXVsdGkgdmFsdWVkIHN0cmluZyBvciB1bmRlZmluZWQgZm9yIHRoZSBlbnRpcmUgc3RyaW5nXG4gICAgICogQHJldHVybnMgeyp9XG4gICAgICovXG4gICAgZGljb21QYXJzZXIuRGF0YVNldC5wcm90b3R5cGUuc3RyaW5nID0gZnVuY3Rpb24odGFnLCBpbmRleClcbiAgICB7XG4gICAgICAgIHZhciBlbGVtZW50ID0gdGhpcy5lbGVtZW50c1t0YWddO1xuICAgICAgICBpZihlbGVtZW50ICYmIGVsZW1lbnQubGVuZ3RoID4gMClcbiAgICAgICAge1xuICAgICAgICAgICAgdmFyIGZpeGVkU3RyaW5nID0gZGljb21QYXJzZXIucmVhZEZpeGVkU3RyaW5nKHRoaXMuYnl0ZUFycmF5LCBlbGVtZW50LmRhdGFPZmZzZXQsIGVsZW1lbnQubGVuZ3RoKTtcbiAgICAgICAgICAgIGlmKGluZGV4ID49IDApXG4gICAgICAgICAgICB7XG4gICAgICAgICAgICAgICAgdmFyIHZhbHVlcyA9IGZpeGVkU3RyaW5nLnNwbGl0KCdcXFxcJyk7XG4gICAgICAgICAgICAgICAgLy8gdHJpbSB0cmFpbGluZyBzcGFjZXNcbiAgICAgICAgICAgICAgICByZXR1cm4gdmFsdWVzW2luZGV4XS50cmltKCk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBlbHNlXG4gICAgICAgICAgICB7XG4gICAgICAgICAgICAgICAgLy8gdHJpbSB0cmFpbGluZyBzcGFjZXNcbiAgICAgICAgICAgICAgICByZXR1cm4gZml4ZWRTdHJpbmcudHJpbSgpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiB1bmRlZmluZWQ7XG4gICAgfTtcblxuICAgIC8qKlxuICAgICAqIFJldHVybnMgYSBzdHJpbmcgd2l0aCB0aGUgbGVhZGluZyBzcGFjZXMgcHJlc2VydmVkIGFuZCB0cmFpbGluZyBzcGFjZXMgcmVtb3ZlZC5cbiAgICAgKlxuICAgICAqIFVzZSB0aGlzIGZ1bmN0aW9uIHRvIGFjY2VzcyBkYXRhIGZvciBWUnMgb2YgdHlwZSBVVCwgU1QgYW5kIExUXG4gICAgICpcbiAgICAgKiBAcGFyYW0gdGFnXG4gICAgICogQHBhcmFtIGluZGV4XG4gICAgICogQHJldHVybnMgeyp9XG4gICAgICovXG4gICAgZGljb21QYXJzZXIuRGF0YVNldC5wcm90b3R5cGUudGV4dCA9IGZ1bmN0aW9uKHRhZywgaW5kZXgpXG4gICAge1xuICAgICAgICB2YXIgZWxlbWVudCA9IHRoaXMuZWxlbWVudHNbdGFnXTtcbiAgICAgICAgaWYoZWxlbWVudCAmJiBlbGVtZW50Lmxlbmd0aCA+IDApXG4gICAgICAgIHtcbiAgICAgICAgICAgIHZhciBmaXhlZFN0cmluZyA9IGRpY29tUGFyc2VyLnJlYWRGaXhlZFN0cmluZyh0aGlzLmJ5dGVBcnJheSwgZWxlbWVudC5kYXRhT2Zmc2V0LCBlbGVtZW50Lmxlbmd0aCk7XG4gICAgICAgICAgICBpZihpbmRleCA+PSAwKVxuICAgICAgICAgICAge1xuICAgICAgICAgICAgICAgIHZhciB2YWx1ZXMgPSBmaXhlZFN0cmluZy5zcGxpdCgnXFxcXCcpO1xuICAgICAgICAgICAgICAgIHJldHVybiB2YWx1ZXNbaW5kZXhdLnJlcGxhY2UoLyArJC8sICcnKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGVsc2VcbiAgICAgICAgICAgIHtcbiAgICAgICAgICAgICAgICByZXR1cm4gZml4ZWRTdHJpbmcucmVwbGFjZSgvICskLywgJycpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiB1bmRlZmluZWQ7XG4gICAgfTtcblxuICAgIC8qKlxuICAgICAqIFBhcnNlcyBhIHN0cmluZyB0byBhIGZ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aCA9IGJ5dGVTdHJlYW0ucG9zaXRpb24gLSBlbGVtZW50LmRhdGFPZmZzZXQ7XG4gICAgICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgZWxzZSBpZih0YWcgPT09ICd4ZmZmZWUwMDAnKVxuICAgICAgICAgICAge1xuICAgICAgICAgICAgICAgIGVsZW1lbnQuZnJhZ21lbnRzLnB1c2goe1xuICAgICAgICAgICAgICAgICAgICBvZmZzZXQ6IGJ5dGVTdHJlYW0ucG9zaXRpb24gLSBiYXNlT2Zmc2V0IC0gOCxcbiAgICAgICAgICAgICAgICAgICAgcG9zaXRpb24gOiBieXRlU3RyZWFtLnBvc2l0aW9uLFxuICAgICAgICAgICAgICAgICAgICBsZW5ndGggOiBsZW5ndGhcbiAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgICAgIGlmKHdhcm5pbmdzKSB7XG4gICAgICAgICAgICAgICAgICAgIHdhcm5pbmdzLnB1c2goJ3VuZXhwZWN0ZWQgdGFnICcgKyB0YWcgKyAnIHdoaWxlIHNlYXJjaGluZyBmb3IgZW5kIG9mIHBpeGVsIGRhdGEgZWxlbWVudCB3aXRoIHVuZGVmaW5lZCBsZW5ndGgnKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgaWYobGVuZ3RoID4gYnl0ZVN0cmVhbS5ieXRlQXJyYXkubGVuZ3RoIC0gYnl0ZVN0cmVhbS5wb3NpdGlvbilcbiAgICAgICAgICAgICAgICB7XG4gICAgICAgICAgICAgICAgICAgIC8vIGZpeCBsZW5ndGhcbiAgICAgICAgICAgICAgICAgICAgbGVuZ3RoID0gYnl0ZVN0cmVhbS5ieXRlQXJyYXkubGVuZ3RoIC0gYnl0ZVN0cmVhbS5wb3NpdGlvbjtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgZWxlbWVudC5mcmFnbWVudHMucHVzaCh7XG4gICAgICAgICAgICAgICAgICAgIG9mZnNldDogYnl0ZVN0cmVhbS5wb3NpdGlvbiAtIGJhc2VPZmZzZXQgLSA4LFxuICAgICAgICAgICAgICAgICAgICBwb3NpdGlvbiA6IGJ5dGVTdHJlYW0ucG9zaXRpb24sXG4gICAgICAgICAgICAgICAgICAgIGxlbmd0aCA6IGxlbmd0aFxuICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgICAgIGJ5dGVTdHJlYW0uc2VlayhsZW5ndGgpO1xuICAgICAgICAgICAgICAgIGVsZW1lbnQubGVuZ3RoID0gYnl0ZVN0cmVhbS5wb3NpdGlvbiAtIGVsZW1lbnQuZGF0YU9mZnNldDtcbiAgICAgICAgICAgICAgICByZXR1cm47XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIGJ5dGVTdHJlYW0uc2VlayhsZW5ndGgpO1xuICAgICAgICB9XG5cbiAgICAgICAgaWYod2FybmluZ3MpIHtcbiAgICAgICAgICAgIHdhcm5pbmdzLnB1c2goXCJwaXhlbCBkYXRhIGVsZW1lbnQgXCIgKyBlbGVtZW50LnRhZyArIFwiIG1pc3Npbmcgc2VxdWVuY2UgZGVsaW1pdGVyIHRhZyB4ZmZmZWUwZGRcIik7XG4gICAgICAgIH1cbiAgICB9O1xuXG5cbiAgICByZXR1cm4gZGljb21QYXJzZXI7XG59KGRpY29tUGFyc2VyKSk7XG4vKipcbiAqIEludGVybmFsIGhlbHBlciBmdW5jdGlvbnMgZm9yIHBhcnNpbmcgRElDT00gZWxlbWVudHNcbiAqL1xuXG52YXIgZGljb21QYXJzZXIgPSAoZnVuY3Rpb24gKGRpY29tUGFyc2VyKVxue1xuICAgIFwidXNlIHN0cmljdFwiO1xuXG4gICAgaWYoZGljb21QYXJzZXIgPT09IHVuZGVmaW5lZClcbiAgICB7XG4gICAgICAgIGRpY29tUGFyc2VyID0ge307XG4gICAgfVxuXG4gICAgLyoqXG4gICAgICogcmVhZHMgZnJvb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3RyZWFtLnJlYWRVaW50MTYoKTtcbiAgICAgICAgICAgICAgICBpZihlbGVtZW50TnVtYmVyID09PSAweGUwMGQpXG4gICAgICAgICAgICAgICAge1xuICAgICAgICAgICAgICAgICAgICAvLyBOT1RFOiBJdCB3b3VsZCBiZSBiZXR0ZXIgdG8gYWxzbyBjaGVjayBmb3IgdGhlIGxlbmd0aCB0byBiZSAwIGFzIHBhcnQgb2YgdGhlIGNoZWNrIGFib3ZlXG4gICAgICAgICAgICAgICAgICAgIC8vIGJ1dCB3ZSB3aWxsIGp1c3QgbG9nIGEgd2FybmluZyBmb3Igbm93XG4gICAgICAgICAgICAgICAgICAgIHZhciBpdGVtRGVsaW1pdGVyTGVuZ3RoID0gYnl0ZVN0cmVhbS5yZWFkVWludDMyKCk7IC8vIHRoZSBsZW5ndGhcbiAgICAgICAgICAgICAgICAgICAgaWYoaXRlbURlbGltaXRlckxlbmd0aCAhPT0gMCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgYnl0ZVN0cmVhbS53YXJuaW5ncygnZW5jb3VudGVyZWQgbm9uIHplcm8gbGVuZ3RoIGZvbGxvd2luZyBpdGVtIGRlbGltaXRlciBhdCBwb3NpdGlvbicgKyBieXRlU3RyZWFtLnBvc2l0aW9uIC0gNCArIFwiIHdoaWxlIHJlYWRpbmcgZWxlbWVudCBvZiB1bmRlZmluZWQgbGVuZ3RoIHdpdGggdGFnICcgKyBlbGVtZW50LnRhZ1wiKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICBlbGVtZW50Lmxlbmd0aCA9IGJ5dGVTdHJlYW0ucG9zaXRpb24gLSBlbGVtZW50LmRhdGFPZmZzZXQ7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICAvLyBObyBpdGVtIGRlbGltaXRhdGlvbiBpdGVtIC0gc2lsZW50bHkgc2V0IHRoZ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QgZnJvbVxuICAgICAgICAgKiBAcmV0dXJucyB7Kn0gdGhlIHBhcnNlZCB1bnNpZ25lZCBpbnQgMTZcbiAgICAgICAgICogQHRocm93cyBlcnJvciBpZiBidWZmZXIgb3ZlcnJlYWQgd291bGQgb2NjdXJcbiAgICAgICAgICogQGFjY2VzcyBwcml2YXRlXG4gICAgICAgICAqL1xuICAgICAgICByZWFkVWludDE2OiBmdW5jdGlvbiAoYnl0ZUFycmF5LCBwb3NpdGlvbikge1xuICAgICAgICAgICAgaWYgKHBvc2l0aW9uIDwgMCkge1xuICAgICAgICAgICAgICAgIHRocm93ICdsaXR0bGVFbmRpYW5CeXRlQXJyYXlQYXJzZXIucmVhZFVpbnQxNjogcG9zaXRpb24gY2Fubm90IGJlIGxlc3MgdGhhbiAwJztcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGlmIChwb3NpdGlvbiArIDIgPiBieXRlQXJyYXkubGVuZ3RoKSB7XG4gICAgICAgICAgICAgICAgdGhyb3cgJ2xpdHRsZUVuZGlhbkJ5dGVBcnJheVBhcnNlci5yZWFkVWludDE2OiBhdHRlbXB0IHRvIHJlYWQgcGFzdCBlbmQgb2YgYnVmZmVyJztcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHJldHVybiBieXRlQXJyYXlbcG9zaXRpb25dICsgKGJ5dGVBcnJheVtwb3NpdGlvbiArIDFdICogMjU2KTtcbiAgICAgICAgfSxcblxuICAgICAgICAvKipcbiAgICAgICAgICpcbiAgICAgICAgICogUGFyc2VzIGEgc2lnbmVkIGludCAxNiBmcm9tIGEgbGl0dGxlLWVuZGlhbiBieXRlIGFycmF5XG4gICAgICAgICAqXG4gICAgICAgICAqIEBwYXJhbSBieXRlQXJyYXkgdGhlIGJ5dGUgYXJyYXkgdG8gcmVhZCBmcm9tXG4gICAgICAgICAqIEBwYXJhbSBwb3NpdGlvbiB0aGUgcG9zaXRpb24gaW4gdGhlIGJ5dGUgYXJyYXkgdG8gcmVhZCBmcm9tXG4gICAgICAgICAqIEByZXR1cm5zIHsqfSB0aGUgcGFyc2VkIHNpZ25lZCBpbnQgMTZcbiAgICAgICAgICogQHRocm93cyBlcnJvciBpZiBidWZmZXIgb3ZlcnJlYWQgd291bGQgb2NjdXJcbiAgICAgICAgICogQGFjY2VzcyBwcml2YXRlXG4gICAgICAgICAqL1xuICAgICAgICByZWFkSW50MTY6IGZ1bmN0aW9uIChieXRlQXJyYXksIHBvc2l0aW9uKSB7XG4gICAgICAgICAgICBpZiAocG9zaXRpb24gPCAwKSB7XG4gICAgICAgICAgICAgICAgdGhyb3cgJ2xpdHRsZUVuZGlhbkJ5dGVBcnJheVBhcnNlci5yZWFkSW50MTY6IHBvc2l0aW9uIGNhbm5vdCBiZSBsZXNzIHRoYW4gMCc7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAocG9zaXRpb24gKyAyID4gYnl0ZUFycmF5Lmxlbmd0aCkge1xuICAgICAgICAgICAgICAgIHRocm93ICdsaXR0bGVFbmRpYW5CeXRlQXJyYXlQYXJzZXIucmVhZEludDE2OiBhdHRlbXB0IHRvIHJlYWQgcGFzdCBlbmQgb2YgYnVmZmVyJztcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHZhciBpbnQxNiA9IGJ5dGVBcnJheVtwb3NpdGlvbl0gKyAoYnl0ZUFycmF5W3Bvc2l0aW9uICsgMV0gPDwgOCk7XG4gICAgICAgICAgICAvLyBmaXggc2lnblxuICAgICAgICAgICAgaWYgKGludDE2ICYgMHg4MDAwKSB7XG4gICAgICAgICAgICAgICAgaW50MTYgPSBpbnQxNiAtIDB4RkZGRiAtIDE7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICByZXR1cm4gaW50MTY7XG4gICAgICAgIH0sXG5cblxuICAgICAgICAvKipcbiAgICAgICAgICogUGFyc2VzIGFuIHVuc2lnbmVkIGludCAzMiBmcm9tIGEgbGl0dGxlLWVuZGlhbiBieXRlIGFycmF5XG4gICAgICAgICAqXG4gICAgIC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U2ICogMjU2ICogMjU2ICkpO1xuXG4gICAgICAgICAgICByZXR1cm4gdWludDMyO1xuICAgICAgICB9LFxuXG4gICAgICAgIC8qKlxuICAgICAgICAgKiBQYXJzZXMgYSBzaWduZWQgaW50IDMyIGZyb20gYSBsaXR0bGUtZW5kaWFuIGJ5dGUgYXJyYXlcbiAgICAgICAgICpcbiAgICAgICAgICogQHBhcmFtIGJ5dGVBcnJheSB0aGUgYnl0ZSBhcnJheSB0byByZWFkIGZyb21cbiAgICAgICAgICogQHBhcmFtIHBvc2l0aW9uIHRoZSBwb3NpdGlvbiBpbiB0aGUgYnl0ZSBhcnJheSB0byByZWFkIGZyb21cbiAgICAgICAgICogQHJldHVybnMgeyp9IHRoZSBwYXJzZWQgdW5zaWduZWQgaW50IDMyXG4gICAgICAgICAqIEB0aHJvd3MgZXJyb3IgaWYgYnVmZmVyIG92ZXJyZWFkIHdvdWxkIG9jY3VyXG4gICAgICAgICAqIEBhY2Nlc3MgcHJpdmF0ZVxuICAgICAgICAgKi9cbiAgICAgICAgcmVhZEludDMyOiBmdW5jdGlvbiAoYnl0ZUFycmF5LCBwb3NpdGlvbikge1xuICAgICAgICAgICAgaWYgKHBvc2l0aW9uIDwgMCkge1xuICAgICAgICAgICAgICAgIHRocm93ICdsaXR0bGVFbmRpYW5CeXRlQXJyYXlQYXJzZXIucmVhZEludDMyOiBwb3NpdGlvbiBjYW5ub3QgYmUgbGVzcyB0aGFuIDAnO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICBpZiAocG9zaXRpb24gKyA0ID4gYnl0ZUFycmF5Lmxlbmd0aCkge1xuICAgICAgICAgICAgICAgIHRocm93ICdsaXR0bGVFbmRpYW5CeXRlQXJyYXlQYXJzZXIucmVhZEludDMyOiBhdHRlbXB0IHRvIHJlYWQgcGFzdCBlbmQgb2YgYnVmZmVyJztcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgdmFyIGludDMyID0gKGJ5dGVBcnJheVtwb3NpdGlvbl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ICAgICByZXR1cm47XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICB9O1xuXG4gICAgcmV0dXJuIGRpY29tUGFyc2VyO1xufShkaWNvbVBhcnNlcikpO1xuXG4vKipcbiAqIEludGVybmFsIGhlbHBlciBmdW5jdGlvbnMgZm9yIGZvciBwYXJzaW5nIERJQ09NIGVsZW1lbnRzXG4gKi9cblxudmFyIGRpY29tUGFyc2VyID0gKGZ1bmN0aW9uIChkaWNvbVBhcnNlcilcbntcbiAgICBcInVzZSBzdHJpY3RcIjtcblxuICAgIGlmKGRpY29tUGFyc2VyID09PSB1bmRlZmluZWQpXG4gICAge1xuICAgICAgICBkaWNvbVBhcnNlciA9IHt9O1xuICAgIH1cblxuICAgIGZ1bmN0aW9uIGdldERhdGFMZW5ndGhTaXplSW5CeXRlc0ZvclZSKHZyKVxuICAgIHtcbiAgICAgICAgaWYoIHZyID09PSAnT0InIHx8XG4gICAgICAgICAgICB2ciA9PT0gJ09XJyB8fFxuICAgICAgICAgICAgdnIgPT09ICdTUScgfHxcbiAgICAgICAgICAgIHZyID09PSAnT0YnIHx8XG4gICAgICAgICAgICB2ciA9PT0gJ1VUJyB8fFxuICAgICAgICAgICAgdnIgPT09ICdVTicpXG4gICAgICAgIHtcbiAgICAgICAgICAgIHJldHVybiA0O1xuICAgICAgICB9XG4gICAgICAgIGVsc2VcbiAgICAgICAge1xuICAgICAgICAgICAgcmV0dXJuIDI7XG4gICAgICAgIH1cbiAgICB9XG5cbiAgICBkaWNvbVBhcnNlci5yZWFkRGljb21FbGVtZW50RXhwbGljaXQgPSBmdW5jdGlvbihieXRlU3RyZWFtLCB3YXJuaW5ncywgdW50aWxUYWcpXG4gICAge1xuICAgICAgICBpZihieXRlU3RyZWFtID09PSB1bmRlZmluZWQpXG4gICAgICAgIHtcbiAgICAgICAgICAgIHRocm93IFwiZGljb21QYXJzZXIucmVhZERpY29tRWxlbWVudEV4cGxpY2l0OiBtaXNzaW5nIHJlcXVpcmVkIHBhc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ICAgaWYoZWxlbWVudC50YWcgPT09IHVudGlsVGFnKSB7XG4gICAgICAgICAgICByZXR1cm4gZWxlbWVudDtcbiAgICAgICAgfVxuXG4gICAgICAgIC8vIGlmIFZSIGlzIFNRLCBwYXJzZSB0aGUgc2VxdWVuY2UgaXRlbXNcbiAgICAgICAgaWYoZWxlbWVudC52ciA9PT0gJ1NRJylcbiAgICAgICAge1xuICAgICAgICAgICAgZGljb21QYXJzZXIucmVhZFNlcXVlbmNlSXRlbXNFeHBsaWNpdChieXRlU3RyZWFtLCBlbGVtZW50LCB3YXJuaW5ncyk7XG4gICAgICAgICAgICByZXR1cm4gZWxlbWVudDtcbiAgICAgICAgfVxuXG5cbiAgICAgICAgaWYoZWxlbWVudC5sZW5ndGggPT09IDQyOTQ5NjcyOTUpXG4gICAgICAgIHtcbiAgICAgICAgICAgIGlmKGVsZW1lbnQudGFnID09PSAneDdmZTAwMDEwJykge1xuICAgICAgICAgICAgICAgIGRpY29tUGFyc2VyLmZpbmRFbmRPZkVuY2Fwc3VsYXRlZEVsZW1lbnQoYnl0ZVN0cmVhbSwgZWxlbWVudCwgd2FybmluZ3MpO1xuICAgICAgICAgICAgICAgIHJldHVybiBlbGVtZW50O1xuICAgICAgICAgICAgfSAgIGVsc2UgaWYoZWxlbWVudC52ciA9PT0gJ1VOJykge1xuICAgICAgICAgICAgICAgIGRpY29tUGFyc2VyLmZpbmRBbmRTZXRVTkVsZW1lbnRMZW5ndGgoYnl0ZVN0cmVhbSwgZWxlbWVudCk7XG4gICAgICAgICAgICAgICAgcmV0dXJuIGVsZW1lbnQ7XG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIGRpY29tUGFyc2VyLnJlYWRTZXF1ZW5jZUl0ZW1zSW1wbGljaXQoYnl0ZVN0cmVhbSwgZWxlbWVudCk7XG4gICAgICAgICAgICAgICAgLy9kaWNvbVBhcnNlci5maW5kSXRlbURlbGltaXRhdGlvbkl0ZW1BbmRTZXRFbGVtZW50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N0cmVhbSwgdW50aWxUYWcsIHZyQ2FsbGJhY2spXG4gICAge1xuICAgICAgICBpZihieXRlU3RyZWFtID09PSB1bmRlZmluZWQpXG4gICAgICAgIHtcbiAgICAgICAgICAgIHRocm93IFwiZGljb21QYXJzZXIucmVhZERpY29tRWxlbWVudEltcGxpY2l0OiBtaXNzaW5nIHJlcXVpcmVkIHBhcmFtZXRlciAnYnl0ZVN0cmVhbSdcIjtcbiAgICAgICAgfVxuXG4gICAgICAgIHZhciBlbGVtZW50ID0ge1xuICAgICAgICAgICAgdGFnIDogZGljb21QYXJzZXIucmVhZFRhZyhieXRlU3RyZWFtKSxcbiAgICAgICAgICAgIGxlbmd0aDogYnl0ZVN0cmVhbS5yZWFkVWludDMyKCksXG4gICAgICAgICAgICBkYXRhT2Zmc2V0IDogIGJ5dGVTdHJlYW0ucG9zaXRpb25cbiAgICAgICAgfTtcblxuICAgICAgICBpZihlbGVtZW50Lmxlbmd0aCA9PT0gNDI5NDk2NzI5NSkge1xuICAgICAgICAgICAgZWxlbWVudC5oYWRVbmRlZmluZWRMZW5ndGggPSB0cnVlO1xuICAgICAgICB9XG5cbiAgICAgICAgaWYoZWxlbWVudC50YWcgPT09IHVudGlsVGFnKSB7XG4gICAgICAgICAgICByZXR1cm4gZWxlbWVudDtcbiAgICAgICAgfVxuXG4gICAgICAgIGlmIChpc1NlcXVlbmNlKGVsZW1lbnQsIGJ5dGVTdHJlYW0sIHZyQ2FsbGJhY2spKSB7XG4gICAgICAgICAgICAvLyBwYXJzZSB0aGUgc2VxdWVuY2VcbiAgICAgICAgICAgIGRpY29tUGFyc2VyLnJlYWRTZXF1ZW5jZUl0ZW1zSW1wbGljaXQoYnl0ZVN0cmVhbSwgZWxlbWVudCk7XG4gICAgICAgICAgICByZXR1cm4gZWxlbWVudDtcbiAgICAgICAgfVxuXG4gICAgICAgIC8vIGlmIGVsZW1lbnQgaXMgbm90IGEgc2VxdWVuY2UgYW5kIGhhcyB1bmRlZmluZWQgbGVuZ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Zvcm1hdCB0aHJvdyBuZXcgSU9FeGNlcHRpb24pXCIpO1xuICAgICAgICAgICAgY2FzZSAweEZGREI6XG4gICAgICAgICAgICAgICAgdGhpcy5xdWFudFRhYmxlLnJlYWQodGhpcy5zdHJlYW0sIGpwZWcubG9zc2xlc3MuRGVjb2Rlci5UQUJMRSk7XG4gICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICBjYXNlIDB4RkZERDpcbiAgICAgICAgICAgICAgICB0aGlzLnJlc3RhcnRJbnRlcnZhbCA9IHRoaXMucmVhZE51bWJlcigpO1xuICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgY2FzZSAweEZGRTA6XG4gICAgICAgICAgICBjYXNlIDB4RkZFMTpcbiAgICAgICAgICAgIGNhc2UgMHhGRkUyOlxuICAgICAgICAgICAgY2FzZSAweEZGRTM6XG4gICAgICAgICAgICBjYXNlIDB4RkZFNDpcbiAgICAgICAgICAgIGNhc2UgMHhGRkU1OlxuICAgICAgICAgICAgY2FzZSAweEZGRTY6XG4gICAgICAgICAgICBjYXNlIDB4RkZFNzpcbiAgICAgICAgICAgIGNhc2UgMHhGRkU4OlxuICAgICAgICAgICAgY2FzZSAweEZGRTk6XG4gICAgICAgICAgICBjYXNlIDB4RkZFQTpcbiAgICAgICAgICAgIGNhc2UgMHhGRkVCOlxuICAgICAgICAgICAgY2FzZSAweEZGRUM6XG4gICAgICAgICAgICBjYXNlIDB4RkZFRDpcbiAgICAgICAgICAgIGNhc2UgMHhGRkVFOlxuICAgICAgICAgICAgY2FzZSAweEZGRUY6XG4gICAgICAgICAgICAgICAgdGhpcy5yZWFkQXBwKCk7XG4gICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICBjYXNlIDB4RkZGRTpcbiAgICAgICAgICAgICAgICB0aGlzLnJlYWRDb21tZW50KCk7XG4gICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgIGlmICgoY3VycmVudCA+PiA4KSAhPT0gMHhGRikge1xuICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoXCJFUlJPUjogZm9ybWF0IHRocm93IG5ldyBJT0V4Y2VwdGlvbiEgKGRlY29kZSlcIik7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICB9XG5cbiAgICAgICAgY3VycmVudCA9IHRoaXMuc3RyZWFtLmdldDE2KCk7XG4gICAgfVxuXG4gICAgaWYgKChjdXJyZW50IDwgMHhGRkMwKSB8fCAoY3VycmVudCA+IDB4RkZDNykpIHtcbiAgICAgICAgdGhyb3cgbmV3IEVycm9yKFwiRVJST1I6IGNvdWxkIG5vdCBoYW5kbGUgYXJpdGhtZXRpYyBjb2RlIVwiKTtcbiAgICB9XG5cbiAgICB0aGlzLmZyYW1lLnJlYWQodGhpcy5zdHJlYW0pO1xuICAgIGN1cnJlbnQgPSB0aGlzLnN0cmVhbS5nZXQxNigpO1xuXG4gICAgZG8ge1xuICAgICAgICB3aGlsZSAoY3VycmVudCAhPT0gMHgwRkZEQSkgeyAvLyBTT1NcbiAgICAgICAgICAgIHN3aXRjaCAoY3VycmVudCkge1xuICAgICAgICAgICAgICAgIGNhc2UgMHhGRkM0OiAvLyBESFRcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5odWZmVGFibGUucmVhZCh0aGlzLnN0cmVhbSwgdGhpcy5IdWZmVGFiKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAweEZGQ0M6IC8vIERBQ1xuICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoXCJQcm9ncmFtIGRvZXNuJ3Qgc3VwcG9ydCBhcml0aG1ldGljIGNvZGluZy4gKGZvcm1hdCB0aHJvdyBuZXcgSU9FeGNlcHRpb24pXCIpO1xuICAgICAgICAgICAgICAgIGNhc2UgMHhGRkRCOlxuICAgICAgICAgICAgICAgICAgICB0aGlzLnF1YW50VGFibGUucmVhZCh0aGlzLnN0cmVhbSwganBlZy5sb3NzbGVzcy5EZWNvZGVyLlRBQkxFKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAweEZGREQ6XG4gICAgICAgICAgICAgICAgICAgIHRoaXMucmVzdGFydEludGVydmFsID0gdGhpcy5yZWFkTnVtYmVyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMHhGRkUwOlxuICAgICAgICAgICAgICAgIGNhc2UgMHhGRkUxOlxuICAgICAgICAgICAgICAgIGNhc2UgMHhGRkUyOlxuICAgICAgICAgICAgICAgIGNhc2UgMHhGRkUzOlxuICAgICAgICAgICAgICAgIGNhc2UgMHhGRkU0OlxuICAgICAgICAgICAgICAgIGNhc2UgMHhGRkU1OlxuICAgICAgICAgICAgICAgIGNhc2UgMHhGRkU2OlxuICAgICAgICAgICAgICAgIGNhc2UgMHhGRkU3OlxuICAgICAgICAgICAgICAgIGNhc2UgMHhGRkU4OlxuICAgICAgICAgICAgICAgIGNhc2UgMHhGRkU5OlxuICAgICAgICAgICAgICAgIGNhc2UgMHhGRkVBOlxuICAgICAgICAgICAgICAgIGNhc2UgMHhGRkVCOlxuICAgICAgICAgICAgICAgIGNhc2UgMHhGRkVDOlxuICAgICAgICAgICAgICAgIGNhc2UgMHhGRkVEOlxuICAgICAgICAgICAgICAgIGNhc2UgMHhGRkVFOlxuICAgICAgICAgICAgICAgIGNhc2UgMHhGRkVGOlxuICAgICAgICAgICAgICAgICAgICB0aGlzLnJlYWRBcHAoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAweEZGRkU6XG4gICAgICAgICAgICAgICAgICAgIHRoaXMucmVhZENvbW1lbnQoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgaWYgKChjdXJyZW50ID4+IDgpICE9PSAweEZGKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoXCJFUlJPUjogZm9ybWF0IHRocm93IG5ldyBJT0V4Y2VwdGlvbiEgKFBhcnNlci5kZWNvZGUpXCIpO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIGN1cnJlbnQgPSB0aGlzLnN0cmVhbS5nZXQxNigpO1xuICAgICAgICB9XG5cbiAgICAgICAgdGhpcy5wcmVjaXNpb24gPSB0aGlzLmZyYW1lLnByZWNpc2lvbjtcbiAgICAgICAgdGhpcy5jb21wb25lbnRzID0gdGhpcy5mcmFtZS5jb21wb25lbnRzO1xuXG4gICAgICAgIGlmICghdGhpcy5udW1CeXRlcykge1xuICAgICAgICAgICAgdGhpcy5udW1CeXRlcyA9IHBhcnNlSW50KE1hdGguY2VpbCh0aGlzLnByZWNpc2lvbiAvIDgpKTtcbiAgICAgICAgfVxuXG4gICAgICAgIGlmICh0aGlzLm51bUJ5dGVzID09IDEpIHtcbiAgICAgICAgICAgIHRoaXMubWFzayA9IDB4RkY7XG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICB0aGlzLm1hc2sgPSAweEZGRkY7XG4gICAgICAgIH1cblxuICAgICAgICB0aGlzLnNjYW4ucmVhZCh0aGlzLnN0cmVhbSk7XG4gICAgICAgIHRoaXMubnVtQ29tcCA9IHRoaXMuc2Nhbi5udW1Db21wO1xuICAgICAgICB0aGlzLnNlbGVjdGlvbiA9IHRoaXMuc2Nhbi5zZWxlY3Rpb247XG5cbiAgICAgICAgaWYgKHRoaXMubnVtQnl0ZXMgPT09IDEpIHtcbiAgICAgICAgICAgIGlmICh0aGlzLm51bUNvbXAgPT09IDMpIHtcbiAgICAgICAgICAgICAgICB0aGlzLmdldHRlciA9IHRoaXMuZ2V0VmFsdWVSR0I7XG4gICAgICAgICAgICAgICAgdGhpcy5zZXR0ZXIgPSB0aGlzLnNldFZhbHVlUkdCO1xuICAgICAgICAgICAgICAgIHRoaXMub3V0cHV0ID0gdGhpcy5vdXRwdXRSR0I7XG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIHRoaXMuZ2V0dGVyID0gdGhpcy5nZXRWYWx1ZTg7XG4gICAgICAgICAgICAgICAgdGhpcy5zZXR0ZXIgPSB0aGlzLnNldFZhbHVlODtcbiAgICAgICAgICAgICAgICB0aGlzLm91dHB1dCA9IHRoaXMub3V0cHV0U2luZ2xlO1xuICAgICAgICAgICAgfVxuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgdGhpcy5nZXR0ZXIgPSB0aGlzLmdldFZhbHVlMTY7XG4gICAgICAgICAgICB0aGlzLnNldHRlciA9IHRoaXMuc2V0VmFsdWUxNjtcbiAgICAgICAgICAgIHRoaXMub3V0cHV0ID0gdGhpcy5vdXRwdXRTaW5nbGU7XG4gICAgICAgIH1cblxuICAgICAgICBzd2l0Y2ggKHRoaXMuc2VsZWN0aW9uKSB7XG4gICAgICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgICAgICAgdGhpcy5zZWxlY3RvciA9IHRoaXMuc2VsZWN0MjtcbiAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIGNhc2UgMzpcbiAgICAgICAgICAgICAgICB0aGlzLnNlbGVjdG9yID0gdGhpcy5zZWxlY3QzO1xuICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgY2FzZSA0OlxuICAgICAgICAgICAgICAgIHRoaXMuc2VsZWN0b3IgPSB0aGlzLnNlbGVjdDQ7XG4gICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICBjYXNlIDU6XG4gICAgICAgICAgICAgICAgdGhpcy5zZWxlY3RvciA9IHRoaXMuc2VsZWN0NTtcbiAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIGNhc2UgNjpcbiAgICAgICAgIC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AgICAgdGhpcy55RGltID0gdGhpcy5mcmFtZS5kaW1ZO1xuICAgICAgICB0aGlzLm91dHB1dERhdGEgPSBuZXcgRGF0YVZpZXcobmV3IEFycmF5QnVmZmVyKHRoaXMueERpbSAqIHRoaXMueURpbSAqIHRoaXMubnVtQnl0ZXMgKiB0aGlzLm51bUNvbXApKTtcblxuICAgICAgICBzY2FuTnVtKz0xO1xuXG4gICAgICAgIHdoaWxlICh0cnVlKSB7IC8vIERlY29kZSBvbmUgc2NhblxuICAgICAgICAgICAgdGVtcFswXSA9IDA7XG4gICAgICAgICAgICBpbmRleFswXSA9IDA7XG5cbiAgICAgICAgICAgIGZvciAoaSA9IDA7IGkgPCAxMDsgaSs9MSkge1xuICAgICAgICAgICAgICAgIHByZWRbaV0gPSAoMSA8PCAodGhpcy5wcmVjaXNpb24gLSAxKSk7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIGlmICh0aGlzLnJlc3RhcnRJbnRlcnZhbCA9PT0gMCkge1xuICAgICAgICAgICAgICAgIGN1cnJlbnQgPSB0aGlzLmRlY29kZVVuaXQocHJlZCwgdGVtcCwgaW5kZXgpO1xuXG4gICAgICAgICAgICAgICAgd2hpbGUgKChjdXJyZW50ID09PSAwKSAmJiAoKHRoaXMueExvYyA8IHRoaXMueERpbSkgJiYgKHRoaXMueUxvYyA8IHRoaXMueURpbSkpKSB7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMub3V0cHV0KHByZWQpO1xuICAgICAgICAgICAgICAgICAgICBjdXJyZW50ID0gdGhpcy5kZWNvZGVVbml0KHByZWQsIHRlbXAsIGluZGV4KTtcbiAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICBicmVhazsgLy9jdXJyZW50PU1BUktFUlxuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICBmb3IgKG1jdU51bSA9IDA7IG1jdU51bSA8IHRoaXMucmVzdGFydEludGVydmFsOyBtY3VOdW0rPTEpIHtcbiAgICAgICAgICAgICAgICB0aGlzLnJlc3RhcnRpbmcgPSAobWN1TnVtID09IDApO1xuICAgICAgICAgICAgICAgIGN1cnJlbnQgPSB0aGlzLmRlY29kZVVuaXQocHJlZCwgdGVtcCwgaW5kZXgpO1xuICAgICAgICAgICAgICAgIHRoaXMub3V0cHV0KHByZWQpO1xuXG4gICAgICAgICAgICAgICAgaWYgKGN1cnJlbnQgIT09IDApIHtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICBpZiAoY3VycmVudCA9PT0gMCkge1xuICAgICAgICAgICAgICAgIGlmICh0aGlzLm1hcmtlckluZGV4ICE9PSAwKSB7XG4gICAgICAgICAgICAgICAgICAgIGN1cnJlbnQgPSAoMHhGRjAwIHwgdGhpcy5tYXJrZXIpO1xuICAgICAgICAgICAgICAgICAgICB0aGlzLm1hcmtlckluZGV4ID0gMDtcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICBjdXJyZW50ID0gdGhpcy5zdHJlYW0uZ2V0MTYoKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIGlmICghKChjdXJyZW50ID49IGpwZWcubG9zc2xlc3MuRGVjb2Rlci5SRVNUQVJUX01BUktFUl9CRUdJTikgJiZcbiAgICAgICAgICAgICAgICAoY3VycmVudCA8PSBqcGVnLmxvc3NsZXNzLkRlY29kZXIuUkVTVEFSVF9NQVJLRVJfRU5EKSkpIHtcbiAgICAgICAgICAgICAgICBicmVhazsgLy9jdXJyZW50PU1BUktFUlxuICAgICAgICAgICAgfVxuICAgICAgICB9XG5cbiAgICAgICAgaWYgKChjdXJyZW50ID09PSAweEZGREMpICYmIChzY2FuTnVtID09PSAxKSkgeyAvL0ROTFxuICAgICAgICAgICAgdGhpcy5yZWFkTnVtYmVyKCk7XG4gICAgICAgICAgICBjdXJyZW50ID0gdGhpcy5zdHJ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yBqIDwgNjQ7IGorPTEpIHtcbiAgICAgICAgICAgICAgICB2YWx1ZSA9IHRoaXMuZ2V0SHVmZm1hblZhbHVlKGFjdGFiLCB0ZW1wLCBpbmRleCk7XG5cbiAgICAgICAgICAgICAgICBpZiAodmFsdWUgPj0gMHhGRjAwKSB7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiB2YWx1ZTtcbiAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICBqICs9ICh2YWx1ZSA+PiA0KTtcblxuICAgICAgICAgICAgICAgIGlmICgodmFsdWUgJiAweDBGKSA9PT0gMCkge1xuICAgICAgICAgICAgICAgICAgICBpZiAoKHZhbHVlID4+IDQpID09PSAwKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuSURDVF9Tb3VyY2VbanBlZy5sb3NzbGVzcy5EZWNvZGVyLklEQ1RfUFtqXV0gPSB0aGlzLmdldG4oaW5kZXgsIHZhbHVlICYgMHgwRiwgdGVtcCwgaW5kZXgpICogcXRhYltqXTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICB9XG5cbiAgICByZXR1cm4gMDtcbn07XG5cblxuXG5qcGVnLmxvc3NsZXNzLkRlY29kZXIucHJvdG90eXBlLmRlY29kZVNpbmdsZSA9IGZ1bmN0aW9uIChwcmV2LCB0ZW1wLCBpbmRleCkge1xuICAgIC8qanNsaW50IGJpdHdpc2U6IHRydWUgKi9cblxuICAgIHZhciB2YWx1ZSwgaSwgbiwgblJlc3RhcnQ7XG5cbiAgICBpZiAodGhpcy5yZXN0YXJ0aW5nKSB7XG4gICAgICAgIHRoaXMucmVzdGFydGluZyA9IGZhbHNlO1xuICAgICAgICBwcmV2WzBdID0gKDEgPDwgKHRoaXMuZnJhbWUucHJlY2lzaW9uIC0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SAweEZGRkY7XG5cbiAgICBpZiAoaW5kZXhbMF0gPCA4KSB7XG4gICAgICAgIHRlbXBbMF0gPDw9IDg7XG4gICAgICAgIGlucHV0ID0gdGhpcy5zdHJlYW0uZ2V0OCgpO1xuICAgICAgICBpZiAoaW5wdXQgPT09IDB4RkYpIHtcbiAgICAgICAgICAgIHRoaXMubWFya2VyID0gdGhpcy5zdHJlYW0uZ2V0OCgpO1xuICAgICAgICAgICAgaWYgKHRoaXMubWFya2VyICE9PSAwKSB7XG4gICAgICAgICAgICAgICAgdGhpcy5tYXJrZXJJbmRleCA9IDk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgdGVtcFswXSB8PSBpbnB1dDtcbiAgICB9IGVsc2Uge1xuICAgICAgICBpbmRleFswXSAtPSA4O1xuICAgIH1cblxuICAgIGNvZGUgPSB0YWJsZVt0ZW1wWzBdID4+IGluZGV4WzBdXTtcblxuICAgIGlmICgoY29kZSAmIGpwZWcubG9zc2xlc3MuRGVjb2Rlci5NU0IpICE9PSAwKSB7XG4gICAgICAgIGlmICh0aGlzLm1hcmtlckluZGV4ICE9PSAwKSB7XG4gICAgICAgICAgICB0aGlzLm1hcmtlckluZGV4ID0gMDtcbiAgICAgICAgICAgIHJldHVybiAweEZGMDAgfCB0aGlzLm1hcmtlcjtcbiAgICAgICAgfVxuXG4gICAgICAgIHRlbXBbMF0gJj0gKG1hc2sgPj4gKDE2IC0gaW5kZXhbMF0pKTtcbiAgICAgICAgdGVtcFswXSA8PD0gODtcbiAgICAgICAgaW5wdXQgPSB0aGlzLnN0cmVhbS5nZXQ4KCk7XG5cbiAgICAgICAgaWYgKGlucHV0ID09PSAweEZGKSB7XG4gICAgICAgICAgICB0aGlzLm1hcmtlciA9IHRoaXMuc3RyZWFtLmdldDgoKTtcbiAgICAgICAgICAgIGlmICh0aGlzLm1hcmtlciAhPT0gMCkge1xuICAgICAgICAgICAgICAgIHRoaXMubWFya2VySW5kZXggPSA5O1xuICAgICAg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gICAgIHJldHVybiAtMzI3Njg7XG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICByZXR1cm4gMzI3Njg7XG4gICAgICAgIH1cbiAgICB9XG5cbiAgICBpbmRleFswXSAtPSBuO1xuXG4gICAgaWYgKGluZGV4WzBdID49IDApIHtcbiAgICAgICAgaWYgKChpbmRleFswXSA8IHRoaXMubWFya2VySW5kZXgpICYmICF0aGlzLmlzTGFzdFBpeGVsKCkpIHsgLy8gdGhpcyB3YXMgY29ycnVwdGluZyB0aGUgbGFzdCBwaXhlbCBpbiBzb21lIGNhc2VzXG4gICAgICAgICAgICB0aGlzLm1hcmtlckluZGV4ID0gMDtcbiAgICAgICAgICAgIHJldHVybiAoMHhGRjAwIHwgdGhpcy5tYXJrZXIpIDw8IDg7XG4gICAgICAgIH1cblxuICAgICAgICByZXN1bHQgPSB0ZW1wWzBdID4+IGluZGV4WzBdO1xuICAgICAgICB0ZW1wWzBdICY9IChtYXNrID4+ICgxNiAtIGluZGV4WzBdKSk7XG4gICAgfSBlbHNlIHtcbiAgICAgICAgdGVtcFswXSA8PD0gODtcbiAgICAgICAgaW5wdXQgPSB0aGlzLnN0cmVhbS5nZXQ4KCk7XG5cbiAgICAgICAgaWYgKGlucHV0ID09PSAweEZGKSB7XG4gICAgICAgICAgICB0aGlzLm1hcmtlciA9IHRoaXMuc3RyZWFtLmdldDgoKTtcbiAgICAgICAgICAgIGlmICh0aGlzLm1hcmtlciAhPT0gMCkge1xuICAgICAgICAgICAgICAgIHRoaXMubWFya2VySW5kZXggPSA5O1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG5cbiAgICAgICAgdGVtcFswXSB8PSBpbnB1dDtcbiAgICAgICAgaW5kZXhbMF0gKz0gODtcblxuICAgICAgICBpZiAoaW5kZXhbMF0gPCAwKSB7XG4gICAgICAgICAgICBpZiAodGhpcy5tYXJrZXJJbmRleCAhPT0gMCkge1xuICAgICAgICAgICAgICAgIHRoaXMubWFya2VySW5kZXggPSAwO1xuICAgICAgICAgICAgICAgIHJldHVybiAoMHhGRjAwIHwgdGhpcy5tYXJrZXIpIDw8IDg7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHRlbXBbMF0gPDw9IDg7XG4gICAgICAgICAgICBpbnB1dCA9IHRoaXMuc3RyZWFtLmdldDgoKTtcblxuICAgICAgICAgICAgaWYgKGlucHV0ID09PSAweEZGKSB7XG4gICAgICAgICAgICAgICAgdGhpcy5tYXJrZXIgPSB0aGlzLnN0cmVhbS5nZXQ4KCk7XG4gICAgICAgICAgICAgICAgaWYgKHRoaXMubWFya2VyICE9PSAwKSB7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMubWFya2VySW5kZXggPSA5O1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgdGVtcFswXSB8PSBpbnB1dDtcbiAgICAgICAgICAgIGluZGV4WzBdICs9IDg7XG4gICAgICAgIH1cblxuICAgICAgICBpZiAoaW5kZXhbMF0gPCAwKSB7XG4gICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoXCJpbmRleD1cIiArIGluZGV4WzBdICsgXCIgaW4gZ2V0bigpXCIpO1xuICAgICAgICB9XG5cbiAgICAgICAgaWYgKGluZGV4WzBdIDwgdGhpcy5tYXJrZXJJbmRleCkge1xuICAgICAgICAgICAgdGhpcy5tYXJrZXJJbmRleCA9IDA7XG4gICAgICAgICAgICByZXR1cm4gKDB4RkYwMCB8IHRoaXMubWFya2VyKSA8PCA4O1xuICAgICAgICB9XG5cbiAgICAgICAgcmVzdWx0ID0gdGVtcFswXSA+PiBpbmRleFswXTtcbiAgICAgICAgdGVtcFswXSAmPSAobWFzayA+PiAoMTYgLSBpbmRleFswXSkpO1xuICAgIH1cblxuICAgIGlmIChyZXN1bHQgPCAob25lIDw8IChuIC0gMSkpKSB7XG4gICAgICAgIHJlc3VsdCArPSAobl9vbmUgPDwgbikgKyAxO1xuICAgIH1cblxuICAgIHJldHVybiByZXN1bH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uICAgIGlmICgodGhpcy54TG9jIDwgdGhpcy54RGltKSAmJiAodGhpcy55TG9jIDwgdGhpcy55RGltKSkge1xuICAgICAgICB0aGlzLnNldHRlcihvZmZzZXQsIFBSRURbMF0sIDApO1xuICAgICAgICB0aGlzLnNldHRlcihvZmZzZXQsIFBSRURbMV0sIDEpO1xuICAgICAgICB0aGlzLnNldHRlcihvZmZzZXQsIFBSRURbMl0sIDIpO1xuXG4gICAgICAgIHRoaXMueExvYys9MTtcblxuICAgICAgICBpZiAodGhpcy54TG9jID49IHRoaXMueERpbSkge1xuICAgICAgICAgICAgdGhpcy55TG9jKz0xO1xuICAgICAgICAgICAgdGhpcy54TG9jID0gMDtcbiAgICAgICAgfVxuICAgIH1cbn07XG5cblxuXG5qcGVnLmxvc3NsZXNzLkRlY29kZXIucHJvdG90eXBlLnNldFZhbHVlMTYgPSBmdW5jdGlvbiAoaW5kZXgsIHZhbCkge1xuICAgIHRoaXMub3V0cHV0RGF0YS5zZXRJbnQxNihpbmRleCAqIDIsIHZhbCwgdHJ1ZSk7XG59O1xuXG5cblxuanBlZy5sb3NzbGVzcy5EZWNvZGVyLnByb3RvdHlwZS5nZXRWYWx1ZTE2ID0gZnVuY3Rpb24gKGluZGV4KSB7XG4gICAgcmV0dXJuIHRoaXMub3V0cHV0RGF0YS5nZXRJbnQxNihpbmRleCAqIDIsIHRydWUpO1xufTtcblxuXG5cbmpwZWcubG9zc2xlc3MuRGVjb2Rlci5wcm90b3R5cGUuc2V0VmFsdWU4ID0gZnVuY3Rpb24gKGluZGV4LCB2YWwpIHtcbiAgICB0aGlzLm91dHB1dERhdGEuc2V0SW50OChpbmRleCwgdmFsKTtcbn07XG5cblxuXG5qcGVnLmxvc3NsZXNzLkRlY29kZXIucHJvdG90eXBlLmdldFZhbHVlOCA9IGZ1bmN0aW9uIChpbmRleCkge1xuICAgIHJldHVybiB0aGlzLm91dHB1dERhdGEuZ2V0SW50OChpbmRleCk7XG59O1xuXG5cblxuanBlZy5sb3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aGlzLnByZWNpc2lvblt0XSA9IDE2O1xuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKFwiRVJST1I6IFF1YW50aXphdGlvbiB0YWJsZSBwcmVjaXNpb24gZXJyb3JcIik7XG4gICAgICAgIH1cblxuICAgICAgICB0aGlzLnRxW3RdID0gMTtcblxuICAgICAgICBpZiAodGhpcy5wcmVjaXNpb25bdF0gPT09IDgpIHtcbiAgICAgICAgICAgIGZvciAoaSA9IDA7IGkgPCA2NDsgaSs9MSkge1xuICAgICAgICAgICAgICAgIGlmIChjb3VudCA+IGxlbmd0aCkge1xuICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoXCJFUlJPUjogUXVhbnRpemF0aW9uIHRhYmxlIGZvcm1hdCBlcnJvclwiKTtcbiAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICB0aGlzLnF1YW50VGFibGVzW3RdW2ldID0gZGF0YS5nZXQ4KCk7XG4gICAgICAgICAgICAgICAgY291bnQrPTE7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIGpwZWcubG9zc2xlc3MuUXVhbnRpemF0aW9uVGFibGUuZW5oYW5jZVF1YW50aXphdGlvblRhYmxlKHRoaXMucXVhbnRUYWJsZXNbdF0sIHRhYmxlKTtcbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgIGZvciAoaSA9IDA7IGkgPCA2NDsgaSs9MSkge1xuICAgICAgICAgICAgICAgIGlmIChjb3VudCA+IGxlbmd0aCkge1xuICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoXCJFUlJPUjogUXVhbnRpemF0aW9uIHRhYmxlIGZvcm1hdCBlcnJvclwiKTtcbiAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICB0aGlzLnF1YW50VGFibGVzW3RdW2ldID0gZGF0YS5nZXQxNigpO1xuICAgICAgICAgICAgICAgIGNvdW50ICs9IDI7XG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Jlcn0gcWZhY1xuICogQHJldHVybnMge0FycmF5LjxBcnJheS48bnVtYmVyPj59XG4gKi9cbm5pZnRpLk5JRlRJMS5wcm90b3R5cGUuY29udmVydE5pZnRpUUZvcm1Ub05pZnRpU0Zvcm0gPSBmdW5jdGlvbiAocWIsIHFjLCBxZCwgcXgsIHF5LCBxeiwgZHgsIGR5LCBkeixcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHFmYWMpIHtcbiAgICB2YXIgUiA9IFtbMCwgMCwgMCwgMF0sIFswLCAwLCAwLCAwXSwgWzAsIDAsIDAsIDBdLCBbMCwgMCwgMCwgMF1dLFxuICAgICAgICBhLFxuICAgICAgICBiID0gcWIsXG4gICAgICAgIGMgPSBxYyxcbiAgICAgICAgZCA9IHFkLFxuICAgICAgICB4ZCxcbiAgICAgICAgeWQsXG4gICAgICAgIHpkO1xuXG4gICAgLy8gbGFzdCByb3cgaXMgYWx3YXlzIFsgMCAwIDAgMSBdXG4gICAgUlszXVswXSA9IFJbM11bMV0gPSBSWzNdWzJdID0gMC4wO1xuICAgIFJbM11bM10gPSAxLjA7XG5cbiAgICAvLyBjb21wdXRlIGEgcGFyYW1ldGVyIGZyb20gYixjLGRcbiAgICBhID0gMS4wIC0gKGIgKiBiICsgYyAqIGMgKyBkICogZCk7XG4gICAgaWYgKGEgPCAwLjAwMDAwMDEpIHsgICAgICAgICAgICAgICAgICAgLyogc3BlY2lhbCBjYXNlICovXG5cbiAgICAgICAgYSA9IDEuMCAvIE1hdGguc3FydChiICogYiArIGMgKiBjICsgZCAqIGQpO1xuICAgICAgICBiICo9IGE7XG4gICAgICAgIGMgKj0gYTtcbiAgICAgICAgZCAqPSBhOyAgICAgICAgLyogbm9ybWFsaXplIChiLGMsZCkgdmVjdG9yICovXG4gICAgICAgIGEgPSAwLjA7ICAgICAgICAgICAgICAgICAgICAgICAgLyogYSA9IDAgPT0+IDE4MCBkZWdyZWUgcm90YXRpb24gKi9cbiA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2FkIGNvbHVtbiB2ZWN0b3JzIGZvciBlYWNoIChpLGosaykgZGlyZWN0aW9uIGZyb20gbWF0cml4ICovXG5cbiAgICAvKi0tIGkgYXhpcyAtLSovIC8qLS0gaiBheGlzIC0tKi8gLyotLSBrIGF4aXMgLS0qL1xuXG4gICAgeGkgPSBSWzBdWzBdO1xuICAgIHhqID0gUlswXVsxXTtcbiAgICB4ayA9IFJbMF1bMl07XG5cbiAgICB5aSA9IFJbMV1bMF07XG4gICAgeWogPSBSWzFdWzFdO1xuICAgIHlrID0gUlsxXVsyXTtcblxuICAgIHppID0gUlsyXVswXTtcbiAgICB6aiA9IFJbMl1bMV07XG4gICAgemsgPSBSWzJdWzJdO1xuXG4gICAgLyogbm9ybWFsaXplIGNvbHVtbiB2ZWN0b3JzIHRvIGdldCB1bml0IHZlY3RvcnMgYWxvbmcgZWFjaCBpamstYXhpcyAqL1xuXG4gICAgLyogbm9ybWFsaXplIGkgYXhpcyAqL1xuICAgIHZhbCA9IE1hdGguc3FydCh4aSAqIHhpICsgeWkgKiB5aSArIHppICogemkpO1xuICAgIGlmICh2YWwgPT09IDAuMCkgeyAgLyogc3R1cGlkIGlucHV0ICovXG4gICAgICAgIHJldHVybiBudWxsO1xuICAgIH1cblxuICAgIHhpIC89IHZhbDtcbiAgICB5aSAvPSB2YWw7XG4gICAgemkgLz0gdmFsO1xuXG4gICAgLyogbm9ybWFsaXplIGogYXhpcyAqL1xuICAgIHZhbCA9IE1hdGguc3FydCh4aiAqIHhqICsgeWogKiB5aiArIHpqICogemopO1xuICAgIGlmICh2YWwgPT09IDAuMCkgeyAgLyogc3R1cGlkIGlucHV0ICovXG4gICAgICAgIHJldHVybiBudWxsO1xuICAgIH1cblxuICAgIHhqIC89IHZhbDtcbiAgICB5aiAvPSB2YWw7XG4gICAgemogLz0gdmFsO1xuXG4gICAgLyogb3J0aG9nb25hbGl6ZSBqIGF4aXMgdG8gaSBheGlzLCBpZiBuZWVkZWQgKi9cbiAgICB2YWwgPSB4aSAqIHhqICsgeWkgKiB5aiArIHppICogemo7ICAgIC8qIGRvdCBwcm9kdWN0IGJldHdlZW4gaSBhbmQgaiAqL1xuICAgIGlmIChNYXRoLmFicyh2YWwpID4gMS5FLTQpIHtcbiAgICAgICAgeGogLT0gdmFsICogeGk7XG4gICAgICAgIHlqIC09IHZhbCAqIHlpO1xuICAgICAgICB6aiAtPSB2YWwgKiB6aTtcbiAgICAgICAgdmFsID0gTWF0aC5zcXJ0KHhqICogeGogKyB5aiAqIHlqICsgemogKiB6aik7ICAvKiBtdXN0IHJlbm9ybWFsaXplICovXG4gICAgICAgIGlmICh2YWwgPT09IDAuMCkgeyAgICAgICAgICAgICAgLyogaiB3YXMgcGFyYWxsZWwgdG8gaT8gKi9cbiAgICAgICAgICAgIHJldHVybiBudWxsO1xuICAgICAgICB9XG4gICAgICAgIHhqIC89IHZhbDtcbiAgICAgICAgeWogLz0gdmFsO1xuICAgICAgICB6aiAvPSB2YWw7XG4gICAgfVxuXG4gICAgLyogbm9ybWFsaXplIGsgYXhpczsgaWYgaXQgaXMgemVybywgbWFrZSBpdCB0aGUgY3Jvc3MgcHJvZHVjdCBpIHggaiAqL1xuICAgIHZhbCA9IE1hdGguc3FydCh4ayAqIHhrICsgeWsgKiB5ayArIHprICogemspO1xuICAgIGlmICh2YWwgPT09IDAuMCkge1xuICAgICAgICB4ayA9IHlpICogemogLSB6aSAqIHlqO1xuICAgICAgICB5ayA9IHppICogeGogLSB6aiAqIHhpO1xuICAgICAgICB6ayA9IHhpICogeWogLSB5aSAqIHhqO1xuICAgIH0gZWxzZSB7XG4gICAgICAgIHhrIC89IHZhbDtcbiAgICAgICAgeWsgLz0gdmFsO1xuICAgICAgICB6ayAvPSB2YWw7XG4gICAgfVxuXG4gICAgLyogb3J0aG9nb25hbGl6ZSBrIHRvIGkgKi9cbiAgICB2YWwgPSB4aSAqIHhrICsgeWkgKiB5ayArIHppICogems7ICAgIC8qIGRvdCBwcm9kdWN0IGJldHdlZW4gaSBhbmQgayAqL1xuICAgIGlmIChNYXRoLmFicyh2YWwpID4gMS5FLTQpIHtcbiAgICAgICAgeGsgLT0gdmFsICogeGk7XG4gICAgICAgIHlrIC09IHZhbCAqIHlpO1xuICAgICAgICB6ayAtPSB2YWwgKiB6aTtcbiAgICAgICAgdmFsID0gTWF0aC5zcXJ0KHhrICogeGsgKyB5ayAqIHlrICsgemsgKiB6ayk7XG4gICAgICAgIGlmICh2YWwgPT09IDAuMCkgeyAgICAvKiBiYWQgKi9cbiAgICAgICAgICAgIHJldHVybiBudWxsO1xuICAgICAgICB9XG4gICAgICAgIHhrIC89IHZhbDtcbiAgICAgICAgeWsgLz0gdmFsO1xuICAgICAgICB6ayAvPSB2YWw7XG4gICAgfVxuXG4gICAgLyogb3J0aG9nb25hbGl6ZSBrIHRvIGogKi9cbiAgICB2YWwgPSB4aiAqIHhrICsgeWogKiB5ayArIHpqICogems7ICAgIC8qIGRvdCBwcm9kdWN0IGJldHdlZW4gaiBhbmQgayAqL1xuICAgIGlmIChNYXRoLmFicyh2YWwpID4gMS5lLTQpIHtcbiAgICAgICAgeGsgLT0gdmFsICogeGo7XG4gICAgICAgIHlrIC09IHZhbCAqIHlqO1xuICAgICAgICB6ayAtPSB2YWwgKiB6ajtcbiAgICAgICAgdmFsID0gTWF0aC5zcXJ0KHhrICogeGsgKyB5ayAqIHlrICsgemsgKiB6ayk7XG4gICAgICAgIGlmICh2YWwgPT09IDAuMCkgeyAgICAgLyogYmFkICovXG4gICAgICAgICAgICByZXR1cm4gbnVsbDtcbiAgICAgICAgfVxuICAgICAgICB4ayAvPSB2YWw7XG4gICAgICAgIHlrIC89IHZhbDtcbiAgICAgICAgemsgLz0gdmFsO1xuICAgIH1cblxuICAgIFFbMF1bMF0gPSB4aTtcbiAgICBRWzBdWzFdID0geGo7XG4gICAgUVswXVsyXSA9IHhrO1xuICAgIFFbMV1bMF0gPSB5aTtcbiAgICBRWzFdWzFdID0geWo7XG4gICAgUVsxXVsyXSA9IHl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XNlIGZvciByb3cgIzEgKi9cbiAgICAgICAgZm9yIChqID0gMTsgaiA8PSAzOyBqICs9IDEpIHsgICAgLyogaiA9IGNvbHVtbiBudW1iZXIgdG8gdXNlIGZvciByb3cgIzIgKi9cbiAgICAgICAgICAgIGlmIChpICE9PSBqKSB7XG4gICAgICAgICAgICAgICAgZm9yIChrID0gMTsgayA8PSAzOyBrICs9IDEpIHsgIC8qIGsgPSBjb2x1bW4gbnVtYmVyIHRvIHVzZSBmb3Igcm93ICMzICovXG4gICAgICAgICAgICAgICAgICAgIGlmICghKGkgPT09IGsgfHwgaiA9PT0gaykpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIFBbMF1bMF0gPSBQWzBdWzFdID0gUFswXVsyXSA9IFBbMV1bMF0gPSBQWzFdWzFdID0gUFsxXVsyXSA9IFBbMl1bMF0gPSBQWzJdWzFdID0gUFsyXVsyXSA9IDAuMDtcbiAgICAgICAgICAgICAgICAgICAgICAgIGZvciAocCA9IC0xOyBwIDw9IDE7IHAgKz0gMikgeyAgICAvKiBwLHEsciBhcmUgLTEgb3IgKzEgICAgICAqL1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAocSA9IC0xOyBxIDw9IDE7IHEgKz0gMikgeyAgIC8qIGFuZCBnbyBpbnRvIHJvd3MgIzEsMiwzICovXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAociA9IC0xOyByIDw9IDE7IHIgKz0gMikge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgUFswXVtpIC0gMV0gPSBwO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgUFsxXVtqIC0gMV0gPSBxO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgUFsyXVtrIC0gMV0gPSByO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGV0UCA9IHRoaXMubmlmdGlfbWF0MzNfZGV0ZXJtKFApOyAgICAgICAgICAgLyogc2lnbiBvZiBwZXJtdXRhdGlvbiAqL1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKChkZXRQICogZGV0USkgPiAwLjApIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBNID0gdGhpcy5uaWZ0aV9tYXQzM19tdWwoUCwgUSk7XG5cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiBhbmdsZSBvZiBNIHJvdGF0aW9uID0gMi4wKmFjb3MoMC41KnNxcnQoMS4wK3RyYWNlKE0pKSkgICAgICAgKi9cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiB3ZSB3YW50IGxhcmdlc3QgdHJhY2UoTSkgPT0gc21hbGxlc3QgYW5nbGUgPT0gTSBuZWFyZXN0IHRvIEkgKi9cblxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbCA9IE1bMF1bMF0gKyBNWzFdWzFdICsgTVsyXVsyXTsgLyogdHJhY2UgKi9cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodmFsID4gdmJlc3QpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmJlc3QgPSB2YWw7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGliZXN0ID0gaTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgamJlc3QgPSBqO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrYmVzdCA9IGs7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBiZXN0ID0gcDtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcWJlc3QgPSBxO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByYmVzdCA9IHI7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSAgLyogZG9lc24ndCBtYXRjaCBzaWduIG9mIFEgKi9cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgIH1cblxuICAgIC8qIEF0IHRoaXMgcG9pbnQgaWJlc3QgaXMgMSBvciAyIG9yIDM7IHBiZXN0IGlzIC0xIG9yICsxOyBldGMuXG5cbiAgICAgVGhlIG1hdHJpeCBQIHRoYXQgY29ycmVzcG9uZHMgaXMgdGhlIGJlc3QgcGVybXV0YXRpb24gYXBwcm94aW1hdGlvblxuICAgICB0byBRLWludmVyc2U7IHRoYXQgaXMsIFAgKGFwcHJveGltYXRlbHkpIHRha2VzICh4LHkseikgY29vcmRpbmF0ZXNcbiAgICAgdG8gdGhlIChpLGosaykgYXhlcy5cblxuICAgICBGb3IgZXhhbXBsZSwgdGhlIGZpcnN0IHJvdyBvZiBQICh3aGljaCBjb250YWlucyBwYmVzdCBpbiBjb2x1bW4gaWJlc3QpXG4gICAgIGRldGVybWluZXMgdGhlIHdheSB0aGUgaSBheGlzIHBvaW50cyByZWxhdGl2ZSB0byB0aGUgYW5hdG9taWNhbFxuICAgICAoeCx5LHopIGF4ZXMuICBJZiBpYmVzdCBpcyAyLCB0aGVuIHRoZSBpIGF4aXMgaXMgYWxvbmcgdGhlIHkgYXhpcyxcbiAgICAgd2hpY2ggaXMgZGlyZWN0aW9uIFAyQSAoaWYgcGJlc3QgPiAwKSBvciBBMlAgKGlmIHBiZXN0IDwgMCkuXG5cbiAgICAgU28sIHVzaW5nIGliZXN0IGFuZCBwYmVzdCwgd2UgY2FuIGFzc2lnbiB0aGUgb3V0cHV0IGNvZGUgZm9yXG4gICAgIHRoZSBpIGF4aXMuICBNdXRhdGlzIG11dGFuZGlzIGZvciB0aGUgaiBhbmQgayBheGVzLCBvZiBjb3Vyc2UuICovXG5cbiAgICBpQ2hhciA9IGpDaGFyID0ga0NoYXIgPSBpU2Vuc2UgPSBqU2Vuc2UgPSBrU2Vuc2UgPSAwO1xuXG4gICAgc3dpdGNoIChpYmVzdCAqIHBiZXN0KSB7XG4gICAgICAgIGNhc2UgMTogLyppID0gTklGVElfTDJSKi9cbiAgICAgICAgICAgIGlDaGFyID0gJ1gnO1xuICAgICAgICAgICAgaVNlbnNlID0gJysnO1xuICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgIGNhc2UgLTE6IC8qaSA9IE5JRlRJX1IyTCovXG4gICAgICAgICAgICBpQ2hhciA9ICdYJztcbiAgICAgICAgICAgIGlTZW5zZSA9ICctJztcbiAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICBjYXNlIDI6IC8qaSA9IE5JRlRJX1AyQSovXG4gICAgICAgICAgICBpQ2hhciA9ICdZJztcbiAgICAgICAgICAgIGlTZW5zZSA9ICcrJztcbiAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICBjYXNlIC0yOiAvKmkgPSBOSUZUSV9BMlAqL1xuICAgICAgICAgICAgaUNoYXIgPSAnWSc7XG4gICAgICAgICAgICBpU2Vuc2UgPSAnLSc7XG4gICAgICAgICAgICBicmVhaztcbiAgICAgICAgY2FzZSAzOiAvKmkgPSBOSUZUSV9JMlMqL1xuICAgICAgICAgICAgaUNoYXIgPSAnWic7XG4gICAgICAgICAgICBpU2Vuc2UgPSAnKyc7XG4gICAgICAgICAgICBicmVhaztcbiAgICAgICAgY2FzZSAtMzogLyppID0gTklGVElfUzJJKi9cbiAgICAgICAgICAgIGlDaGFyID0gJ1onO1xuICAgICAgICAgICAgaVNlbnNlID0gJy0nO1xuICAgICAgICAgICAgYnJlYWs7XG4gICAgfVxuXG4gICAgc3dpdGNoIChqYmVzdCAqIHFiZXN0KSB7XG4gICAgICAgIGNhc2UgMTogLypqID0gTklGVElfTDJSKi9cbiAgICAgICAgICAgIGpDaGFyID0gJ1gnO1xuICAgICAgICAgICAgalNlbnNlID0gJysnO1xuICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgIGNhc2UgLTE6IC8qaiA9IE5JRlRJX1IyTCovXG4gICAgICAgICAgICBqQ2hhciA9ICdYJztcbiAgICAgICAgICAgIGpTZW5zZSA9ICctJztcbiAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICBjYXNlIDI6IC8qaiA9IE5JRlRJX1AyQSovXG4gICAgICAgICAgICBqQ2hhciA9ICdZJztcbiAgICAgICAgICAgIGpTZW5zZSA9ICcrJztcbiAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICBjYXNlIC0yOiAvKmogPSBOSUZUSV9BMlAqL1xuICAgICAgICAgICAgakNoYXIgPSAnWSc7XG4gICAgICAgICAgICBqU2Vuc2UgPSAnLSc7XG4gICAgICAgICAgICBicmVhaztcbiAgICAgICAgY2FzZSAzOiAvKmogPSBOSUZUSV9JMlMqL1xuICAgICAgICAgICAgakNoYXIgPSAnWic7XG4gICAgICAgICAgICBqU2Vuc2UgPSAnKyc7XG4gICAgICAgICAgICBicmVhaztcbiAgICAgICAgY2FzZSAtMzogLypqID0gTklGVElfUzJJKi9cbiAgICAgICAgICAgIGpDaGFyID0gJ1onO1xuICAgICAgICAgICAgalNlbnNlID0gJy0nO1xuICAgICAgICAgICAgYnJlYWs7XG4gICAgfVxuXG4gICAgc3dpdGNoIChrYmVzdCAqIHJiZXN0KSB7XG4gICAgICAgIGNhc2UgMTogLyprID0gTklGVElfTDJSKi9cbiAgICAgICAgICAgIGtDaGFyID0gJ1gnO1xuICAgICAgICAgICAga1NlbnNlID0gJysnO1xuICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgIGNhc2UgLTE6IC8qayA9IE5JRlRJX1IyTCovXG4gICAgICAgICAgICBrQ2hhciA9ICdYJztcbiAgICAgICAgICAgIGtTZW5zZSA9ICctJztcbiAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICBjYXNlIDI6IC8qayA9IE5JRlRJX1AyQSovXG4gICAgICAgICAgICBrQ2hhciA9ICdZJztcbiAgICAgICAgICAgIGtTZW5zZSA9ICcrJztcbiAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICBjYXNlIC0yOiAvKmsgPSBOSUZUSV9BMlAqL1xuICAgICAgICAgICAga0NoYXIgPSAnWSc7XG4gICAgICAgICAgICBrU2Vuc2UgPSAnLSc7XG4gICAgICAgICAgICBicmVhaztcbiAgICAgICAgY2FzZSAzOiAvKmsgPSBOSUZUSV9JMlMqL1xuICAgICAgICAgICAga0NoYXIgPSAnWic7XG4gICAgICAgICAgICBrU2Vuc2UgPSAnKyc7XG4gICAgICAgICAgICBicmVhaztcbiAgICAgICAgY2FzZSAtMzogLyprID0gTklGVElfUzJJKi9cbiAgICAgICAgICAgIGtDaGFyID0gJ1onO1xuICAgICAgICAgICAga1NlbnNlID0gJy0nO1xuICAgICAgICAgICAgYnJlYWs7XG4gICAgfVxuXG4gICAgcmV0dXJuIChpQ2hhciArIGpDaGFyICsga0NoYXIgKyBpU2Vuc2UgKyBqU2Vuc2UgKyBrU2Vuc2UpO1xufTtcblxuXG5cbm5pZnRpLk5JRlRJMS5wcm90b3R5cGUubmlmdGlfbWF0MzNfbXVsID0gZnVuY3Rpb24gKEEsIEIpIHtcbiAgICB2YXIgQyA9IFtbMCwgMCwgMF0sIFswLCAwLCAwXSwgWzAsIDAsIDBdXSxcbiAgICAgICAgaSxcbiAgICAgICAgajtcblxuICAgIGZvciAoaSA9IDA7IGkgPCAzOyBpICs9IDEpIHtcbiAgICAgICAgZm9yIChqID0gMDsgaiA8IDM7IGogKz0gMSkge1xuICAgICAgICAgICAgQ1tpXVtqXSA9ICBBW2ldWzBdICogQlswXVtqXSAgKyBBW2ldWzFdICogQlsxXVtqXSAr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bmcgKz0gKFwiSW1hZ2UgRGltZW5zaW9uc1wiICsgXCIgKDEtOCk6IFwiICtcbiAgICAgICAgdGhpcy5kaW1zWzBdICsgXCIsIFwiICtcbiAgICAgICAgdGhpcy5kaW1zWzFdICsgXCIsIFwiICtcbiAgICAgICAgdGhpcy5kaW1zWzJdICsgXCIsIFwiICtcbiAgICAgICAgdGhpcy5kaW1zWzNdICsgXCIsIFwiICtcbiAgICAgICAgdGhpcy5kaW1zWzRdICsgXCIsIFwiICtcbiAgICAgICAgdGhpcy5kaW1zWzVdICsgXCIsIFwiICtcbiAgICAgICAgdGhpcy5kaW1zWzZdICsgXCIsIFwiICtcbiAgICAgICAgdGhpcy5kaW1zWzddICsgXCJcXG5cIik7XG5cbiAgICBzdHJpbmcgKz0gKFwiSW50ZW50IFBhcmFtZXRlcnMgKDEtMyk6IFwiICtcbiAgICAgICAgdGhpcy5pbnRlbnRfcDEgKyBcIiwgXCIgK1xuICAgICAgICB0aGlzLmludGVudF9wMiArIFwiLCBcIiArXG4gICAgICAgIHRoaXMuaW50ZW50X3AzKSArIFwiXFxuXCI7XG5cbiAgICBzdHJpbmcgKz0gKFwiVm94ZWwgRGltZW5zaW9ucyAoMS04KTogXCIgK1xuICAgICAgICBmbXQodGhpcy5waXhEaW1zWzBdKSArIFwiLCBcIiArXG4gICAgICAgIGZtdCh0aGlzLnBpeERpbXNbMV0pICsgXCIsIFwiICtcbiAgICAgICAgZm10KHRoaXMucGl4RGltc1syXSkgKyBcIiwgXCIgK1xuICAgICAgICBmbXQodGhpcy5waXhEaW1zWzNdKSArIFwiLCBcIiArXG4gICAgICAgIGZtdCh0aGlzLnBpeERpbXNbNF0pICsgXCIsIFwiICtcbiAgICAgICAgZm10KHRoaXMucGl4RGltc1s1XSkgKyBcIiwgXCIgK1xuICAgICAgICBmbXQodGhpcy5waXhEaW1zWzZdKSArIFwiLCBcIiArXG4gICAgICAgIGZtdCh0aGlzLnBpeERpbXNbN10pICsgXCJcXG5cIik7XG5c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3ItdGltZVwiOlxuICAgICBcdCAgY2FzZSBcIlJBU1RcIjpcbiAgICAgXHQgICAgICBzcGFjZURpbWVuc2lvbiA9IDQ7XG4gICAgIFx0ICAgICAgYnJlYWs7XG4gICAgICAgIGNhc2UgXCJsZWZ0LWFudGVyaW9yLXN1cGVyaW9yLXRpbWVcIjpcbiAgICAgICAgY2FzZSBcIkxBU1RcIjpcbiAgICAgICAgICAgIHNwYWNlRGltZW5zaW9uID0gNDtcbiAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICBjYXNlIFwibGVmdC1wb3N0ZXJpb3Itc3VwZXJpb3ItdGltZVwiOlxuICAgICAgICBjYXNlIFwiTFBTVFwiOlxuICAgICAgICAgICAgc3BhY2VEaW1lbnNpb24gPSA0O1xuICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgIGNhc2UgXCJzY2FubmVyLXh5elwiOlxuICAgICAgICAgICAgc3BhY2VEaW1lbnNpb24gPSAzO1xuICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgIGNhc2UgXCJzY2FubmVyLXh5ei10aW1lXCI6XG4gICAgICAgICAgICBzcGFjZURpbWVuc2lvbiA9IDQ7XG4gICAgICAgICAgICBicmVhaztcbiAgICAgICAgY2FzZSBcIjNELXJpZ2h0LWhhbmRlZFwiOlxuICAgICAgICAgICAgc3BhY2VEaW1lbnNpb24gPSAzO1xuICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgIGNhc2UgXCIzRC1sZWZ0LWhhbmRlZFwiOlxuICAgICAgICAgICAgc3BhY2VEaW1lbnNpb24gPSAzO1xuICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgIGNhc2UgXCIzRC1yaWdodC1oYW5kZWQtdGltZVwiOlxuICAgICAgICAgICAgc3BhY2VEaW1lbnNpb24gPSA0O1xuICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgIGNhc2UgXCIzRC1sZWZ0LWhhbmRlZC10aW1lXCI6XG4gICAgICAgICAgICBzcGFjZURpbWVuc2lvb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c2hvdWxkIGJlIHRoZSBsYXN0IGZpZWxkIHNwZWNpZmljYXRpb24sXG4gICAgICAgICAgICAgICAgLy8gYW5kIHRoZSByZXN0IG9mIHRoZSBsaW5lcyBzaG91bGQgY29udGFpbiBmaWxlIG5hbWVzLlxuICAgICAgICAgICAgICAgIGlmIChtYXRjaDIubGVuZ3RoID09IDIgJiYgbWF0Y2gyWzFdKSB7IC8vIHN1YmRpbSBzcGVjaWZpY2F0aW9uXG4gICAgICAgICAgICAgICAgICAgIHJldFttYXRjaFsxXV0gPSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBmaWxlczogbGluZXMuc2xpY2UoaSsxKSxcbiAgICAgICAgICAgICAgICAgICAgICAgIHN1YmRpbTogcGFyc2VOUlJESW50ZWdlcihtYXRjaDJbMV0pXG4gICAgICAgICAgICAgICAgICAgIH07XG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgcmV0W21hdGNoWzFdXSA9IGxpbmVzLnNsaWNlKGkrMSk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGxpbmVzLmxlbmd0aCA9IGk7XG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIHJldFttYXRjaFsxXV0gPSBwYXJzZUZpZWxkKG1hdGNoWzFdLCBtYXRjaFszXSk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH0gZWxzZSBpZiAobWF0Y2hbMl0gPT0gJzo9JykgeyAvLyBLZXkvdmFsdWUgcGFpclxuICAgICAgICAgICAgcmV0LmtleXNbbWF0Y2hbMV1dID0gdW5lc2NhcGVWYWx1ZShtYXRjaFszXSk7XG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoXCJMb2dpYyBlcnJvciBpbiBOUlJEIHBhcnNlci5cIik7IC8vIFRoaXMgc2hvdWxkIG5ldmVyIGhhcHBlbiAodW5sZXNzIHRoZSBOUlJEIHN5bnRhe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ZsYWc7XG4gICAgZm9yKGk9MDsgaTxzaXplcy5sZW5ndGg7IGkrKykge1xuICAgICAgICBpZiAoc2l6ZXNbaV08PTApIHRocm93IG5ldyBFcnJvcihcIlNpemVzIHNob3VsZCBiZSBhIGxpc3Qgb2YgcG9zaXRpdmUgKD4wKSBpbnRlZ2VycyFcIik7XG4gICAgICAgIHRvdGFsTGVuICo9IHNpemVzW2ldO1xuICAgIH1cbiAgICBpZiAodHlwZSA9PSAnYmxvY2snKSB7XG4gICAgICAgIC8vIERvbid0IGRvIGFueXRoaW5nIHNwZWNpYWwsIGp1c3QgcmV0dXJuIHRoZSBzbGljZSBjb250YWluaW5nIGFsbCBibG9ja3MuXG4gICAgICAgIHJldHVybiBidWZmZXIuc2xpY2UoMCx0b3RhbExlbipvcHRpb25zLmJsb2NrU2l6ZSk7XG4gICAgfSBlbHNlIGlmICh0eXBlID09ICdpbnQ4JyB8fCB0eXBlID09ICd1aW50OCcgfHwgb3B0aW9ucy5lbmRpYW4gPT0gc3lzdGVtRW5kaWFubmVzcykge1xuICAgICAgICBzd2l0Y2godHlwZSkge1xuICAgICAgICBjYXNlIFwiaW50OFwiOlxuICAgICAgICAgICAgY2hlY2tTaXplKDEpO1xuICAgICAgICAgICAgcmV0dXJuIG5ldyBJbnQ4QXJyYXkoYnVmZmVyLnNsaWNlKDAsdG90YWxMZW4pKTtcbiAgICAgICAgY2FzZSBcInVpbnQ4XCI6XG4gICAgICAgICAgICBjaGVja1NpemUoMSk7XG4gICAgICAgICAgICByZXR1cm4gbmV3IFVpbnQ4QXJyYXkoYnVmZmVyLnNsaWNlKDAsdG90YWxMZW4pKTtcbiAgICAgICAgY2FzZSBcImludDE2XCI6XG4gICAgICAgICAgICBjaGVja1NpemUoMik7XG4gICAgICAgICAgICByZXR1cm4gbmV3IEludDE2QXJyYXkoYnVmZmVyLnNsaWNlKDAsdG90YWxMZW4qMikpO1xuICAgICAgICBjYXNlIFwidWludDE2XCI6XG4gICAgICAgICAgICBjaGVja1NpemUoMik7XG4gICAgICAgICAgICByZXR1cm4gbmV3IFVpbnQxNkFycmF5KGJ1ZmZlci5zbGljZSgwLHRvdGFsTGVuKjIpKTtcbiAgICAgICAgY2FzZSBcImludDMyXCI6XG4gICAgICAgICAgICBjaGVja1NpemUoNCk7XG4gICAgICAgICAgICByZXR1cm4gbmV3IEludDMyQXJyYXkoYnVmZmVyLnNsaWNlKDAsdG90YWxMZW4qNCkpO1xuICAgICAgICBjYXNlIFwidWludDMyXCI6XG4gICAgICAgICAgICBjaGVja1NpemUoNCk7XG4gICAgICAgICAgICByZXR1cm4gbmV3IFVpbnQzMkFycmF5KGJ1ZmZlci5zbGljZSgwLHRvdGFsTGVuKjQpKTtcbiAgICAgICAgLy9jYXNlIFwiaW50NjRcIjpcbiAgICAgICAgLy8gICAgY2hlY2tTaXplKDgpO1xuICAgICAgICAvLyAgICByZXR1cm4gbmV3IEludDY0QXJyYXkoYnVmZmVyLnNsaWNlKDAsdG90YWxMZW4qOCkpO1xuICAgICAgICAvL2Nhc2UgXCJ1aW50NjRcIjpcbiAgICAgICAgLy8gICAgY2hlY2tTaXplKDgpO1xuICAgICAgICAvLyAgICByZXR1cm4gbmV3IFVpbnQ2NEFycmF5KGJ1ZmZlci5zbGljZSgwLHRvdGFsTGVuKjgpKTtcbiAgICAgICAgY2FzZSBcImZsb2F0XCI6XG4gICAgICAgICAgICBjaGVja1NpemUoNCk7XG4gICAgICAgICAgICByZXR1cm4gbmV3IEZsb2F0MzJBcnJheShidWZmZXIuc2xpY2UoMCx0b3RhbExlbio0KSk7XG4gICAgICAgIGNhc2UgXCJkb3VibGVcIjpcbiAgICAgICAgICAgIGNoZWNrU2l6ZSg4KTtcbiAgICAgICAgICAgIHJldHVybiBuZXcgRmxvYXQ2NEFycmF5KGJ1ZmZlci5zbGljZSgwLHRvdGFsTGVuKjgpKTtcbiAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgIGNvbnNvbGUud2FybihcIlVuc3VwcG9ydGVkIE5SUkQgdHlwZTogXCIgKyB0eXBlICsgXCIsIHJldHVybmluZyByYXcgYnVmZmVyLlwiKTtcbiAgICAgICAgICAgIHJldHVybiB1bmRlZmluZWQ7XG4gICAgICAgIH1cbiAgICB9IGVsc2Uge1xuICAgICAgICBzd2l0Y2gob3B0aW9ucy5lbmRpYW4pIHtcbiAgICAgICAgY2FzZSAnYmlnJzpcbiAgICAgICAgICAgIGVuZGlhbkZsYWcgPSBmYWxzZTtcbiAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICBjYXNlICdsaXR0bGUnOlxuICAgICAgICAgICAgZW5kaWFuRmxhZyA9IHRydWU7XG4gICAgICAgICAgICBicmVhaztcbiAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgIGNvbnNvbGUud2FybihcIlVuc3VwcG9ydGVkIGVuZGlhbm5lc3MgaW4gTlJSRCBmaWxlOiBcIiArIG9wdGlvbnMuZW5kaWFuKTtcbiAgICAgICAgICAgIHJldHVybiB1bmRlZmluZWQ7XG4gICAgICAgIH1cbiAgICAgICAgdmlldyA9IG5ldyBEYXRhVmlldyhidWZmZXIpO1xuICAgICAgICBzd2l0Y2godHlwZSkge1xuICAgICAgICBjYXNlIFwiaW50OFwiOiAvLyBOb3RlIHRoYXQgaGVyZSB3ZSBkbyBub3QgbmVlZCB0byBjaGVjayB0aGUgc2l6ZSBvZiB0aGUgYnVmZmVyLCBhcyB0aGUgRGF0YVZpZXcuZ2V0IG1ldGhvZHMgc2hvdWxkIHRocm93IGFuIGV4Y2VwdGlvbiBpZiB3ZSByZWFkIGJleW9uZCB0aGUgYnVmZmVyLlxuICAgICAgICAgICAgYXJyID0gbmV3IEludDhBcnJheSh0b3RhbExlbik7XG4gICAgICAgICAgICBmb3IoaT0wOyBpPHRvdGFsTGVuOyBpKyspIHtcbiAgICAgICAgICAgICAgICBhcnJbaV0gPSB2aWV3LmdldEludDgoaSk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICByZXR1cm4gYXJyO1xuICAgICAgICBjYXNlIFwidWludDhcIjpcbiAgICAgICAgICAgIGFyciA9IG5ldyBVaW50OEFycmF5KHRvdGFsTGVuKTtcbiAgICAgICAgICAgIGZvcihpPTA7IGk8dG90YWxMZW47IGkrKykge1xuICAgICAgICAgICAgICAgIGFycltpXSA9IHZpZXcuZ2V0VWludDgoaSk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICByZXR1cm4gYXJyO1xuICAgICAgICBjYXNlIFwiaW50MTZcIjpcbiAgICAgICAgICAgIGFyciA9IG5ldyBJbnQxNkFycmF5KHRvdGFsTGVuKTtcbiAgICAgICAgICAgIGZvcihpPTA7IGk8dG90YWxMZW47IGkrKykge1xuICAgICAgICAgICAgICAgIGFycltpXSA9IHZpZXcuZ2V0SW50MTYoaSoyKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHJldHVybiBhcnI7XG4gICAgICAgIGNhc2UgXCJ1aW50MTZcIjpcbiAgICAgICAgICAgIGFyciA9IG5ldyBVaW50MTZBcnJheSh0b3RhbExlbik7XG4gICAgICAgICAgICBmb3IoaT0wOyBpPHRvdGFsTGVuOyBpKyspIHtcbiAgICAgICAgICAgICAgICBhcnJbaV0gPSB2aWV3LmdldFVpbnQxNihpKjIpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgcmV0dXJuIGFycjtcbiAgICAgICAgY2FzZSBcImludDMyXCI6XG4gICAgICAgICAgICBhcnIgPSBuZXcgSW50MzJBcnJheSh0b3RhbExlbik7XG4gICAgICAgICAgICBmb3IoaT0wOyBpPHRvdGFsTGVuOyBpKyspIHtcbiAgICAgICAgICAgICAgICBhcnJbaV0gPSB2aWV3LmdldEludDMyKGkqNCk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICByZXR1cm4gYXJyO1xuICAgICAgICBjYXNlIFwidWludDMyXCI6XG4gICAgICAgICAgICBhcnIgPSBuZXcgVWludDMyQXJyYXkodG90YWxMZW4pO1xuICAgICAgICAgICAgZm9yKGk9MDsgaTx0b3RhbExlbjsgaSsrKSB7XG4gICAgICAgICAgICAgICAgYXJyW2ldID0gdmlldy5nZXRVaW50MzIoaSo0KTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHJldHVybiBhcnI7XG4gICAgICAgIC8vY2FzZSBcImludDY0XCI6XG4gICAgICAgIC8vICAgIGFyciA9IG5ldyBJbnQ2NEFycmF5KHRvdGFsTGVuKTtcbiAgICAgICAgLy8gICAgZm9yKGk9MDsgaTx0b3RhbExlbjsgaSsrKSB7XG4gICAgICAgIC8vICAgICAgICBhcnJbaV0gPSB2aWV3LmdldEludDY0KGkqOCk7XG4gICAgICAgIC8vICAgIH1cbiAgICAgICAgLy8gICAgcmV0dXJuIGFycjtcbiAgICAgICAgLy9jYXNlIFwidWludDY0XCI6XG4gICAgICAgIC8vICAgIGFyciA9IG5ldyBVaW50NjRBcnJheSh0b3RhbExlbik7XG4gICAgICAgIC8vICAgIGZvcihpPTA7IGk8dG90YWxMZW47IGkrKykge1xuICAgICAgICAvLyAgICAgICAgYXJyW2ldID0gdmlldy5nZXRVaW50NjQoaSo4KTtcbiAgICAgICAgLy8gICAgfVxuICAgICAgICAvLyAgICByZXR1cm4gYXJyO1xuICAgICAgICBjYXNlIFwiZmxvYXRcIjpcbiAgICAgICAgICAgIGFyciA9IG5ldyBGbG9hdDMyQXJyYXkodG90YWxMZW4pO1xuICAgICAgICAgICAgZm9yKGk9MDsgaTx0b3RhbExlbjsgaSsrKSB7XG4gICAgICAgICAgICAgICAgYXJyW2ldID0gdmlldy5nZXRGbG9hdDMyKGkqNCk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICByZXR1cm4gYXJyO1xuICAgICAgICBjYXNlIFwiZG91YmxlXCI6XG4gICAgICAgICAgICBhcnIgPSBuZXcgRmxvYXQ2NEFycmF5KHRvdGFsTGVuKTtcbiAgICAgICAgICAgIGZvcihpPTA7IGk8dG90YWxMZW47IGkrKykge1xuICAgICAgICAgICAgICAgIGFycltpXSA9IHZp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T09PT09PT09PT09PT09PT09PT09PT0qL1xuLyogPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09Ki9cblxudmFyIFpfTk9fRkxVU0ggICAgICA9IDA7XG52YXIgWl9GSU5JU0ggICAgICAgID0gNDtcblxudmFyIFpfT0sgICAgICAgICAgICA9IDA7XG52YXIgWl9TVFJFQU1fRU5EICAgID0gMTtcbnZhciBaX1NZTkNfRkxVU0ggICAgPSAyO1xuXG52YXIgWl9ERUZBVUxUX0NPTVBSRVNTSU9OID0gLTE7XG5cbnZhciBaX0RFRkFVTFRfU1RSQVRFR1kgICAgPSAwO1xuXG52YXIgWl9ERUZMQVRFRCAgPSA4O1xuXG4vKiA9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0qL1xuXG5cbi8qKlxuICogY2xhc3MgRGVmbGF0ZVxuICpcbiAqIEdlbmVyaWMgSlMtc3R5bGUgd3JhcHBlciBmb3IgemxpYiBjYWxscy4gSWYgeW91IGRvbid0IG5lZWRcbiAqIHN0cmVhbWluZyBiZWhhdmlvdXIgLSB1c2UgbW9yZSBzaW1wbGUgZnVuY3Rpb25zOiBbW2RlZmxhdGVdXSxcbiAqIFtbZGVmbGF0ZVJhd11dIGFuZCBbW2d6aXBdXS5cbiAqKi9cblxuLyogaW50ZXJuYWxcbiAqIERlZmxhdGUuY2h1bmtzIC0+IEFycmF5XG4gKlxuICogQ2h1bmtzIG9mIG91dHB1dCBkYXRhLCBpZiBbW0RlZmxhdGUjb25EYXRhXV0gbm90IG92ZXJyaWRlbi5cbiAqKi9cblxuLyoqXG4gKiBEZWZsYXRlLnJlc3VsdCAtPiBVaW50OEFycmF5fEFycmF5XG4gKlxuICogQ29tcHJlc3NlZCByZXN1bHQsIGdlbmVyYXRlZCBieSBkZWZhdWx0IFtbRGVmbGF0ZSNvbkRhdGFd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SAxO1xudmFyIFpfSFVGRk1BTl9PTkxZICAgICAgICA9IDI7XG52YXIgWl9STEUgICAgICAgICAgICAgICAgID0gMztcbnZhciBaX0ZJWEVEICAgICAgICAgICAgICAgPSA0O1xudmFyIFpfREVGQVVMVF9TVFJBVEVHWSAgICA9IDA7XG5cbi8qIFBvc3NpYmxlIHZhbHVlcyBvZiB0aGUgZGF0YV90eXBlIGZpZWxkICh0aG91Z2ggc2VlIGluZmxhdGUoKSkgKi9cbi8vdmFyIFpfQklOQVJZICAgICAgICAgICAgICA9IDA7XG4vL3ZhciBaX1RFWFQgICAgICAgICAgICAgICAgPSAxO1xuLy92YXIgWl9BU0NJSSAgICAgICAgICAgICAgID0gMTsgLy8gPSBaX1RFWFRcbnZhciBaX1VOS05PV04gICAgICAgICAgICAgPSAyO1xuXG5cbi8qIFRoZSBkZWZsYXRlIGNvbXByZXNzaW9uIG1ldGhvZCAqL1xudmFyIFpfREVGTEFURUQgID0gODtcblxuLyo9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09Ki9cblxuXG52YXIgTUFYX01FTV9MRVZFTCA9IDk7XG4vKiBNYXhpbXVtIHZhbHVlIGZvciBtZW1MZXZlbCBpbiBkZWZsYXRlSW5pdDIgKi9cbnZhciBNQVhfV0JJVFMgPSAxNTtcbi8qIDMySyBMWjc3IHdpbmRvdyAqL1xudmFyIERFRl9NRU1fTEVWRUwgPSA4O1xuXG5cbnZhciBMRU5HVEhfQ09ERVMgID0gMjk7XG4vKiBudW1iZXIgb2YgbGVuZ3RoIGNvZGVzLCBub3QgY291bnRpbmcgdGhlIHNwZWNpYWwgRU5EX0JMT0NLIGNvZGUgKi9cbnZhciBMSVRFUkFMUyAgICAgID0gMjU2O1xuLyogbnVtYmVyIG9mIGxpdGVyYWwgYnl0ZXMgMC4uMjU1ICovXG52YXIgTF9DT0RFUyAgICAgICA9IExJVEVSQUxTICsgMSArIExF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9va2FoZWFkID49IE1JTl9NQVRDSCAmJiBzLnN0cnN0YXJ0ID4gMCkge1xuICAgICAgc2NhbiA9IHMuc3Ryc3RhcnQgLSAxO1xuICAgICAgcHJldiA9IF93aW5bc2Nhbl07XG4gICAgICBpZiAocHJldiA9PT0gX3dpblsrK3NjYW5dICYmIHByZXYgPT09IF93aW5bKytzY2FuXSAmJiBwcmV2ID09PSBfd2luWysrc2Nhbl0pIHtcbiAgICAgICAgc3RyZW5kID0gcy5zdHJzdGFydCArIE1BWF9NQVRDSDtcbiAgICAgICAgZG8ge1xuICAgICAgICAgIC8qanNoaW50IG5vZW1wdHk6ZmFsc2UqL1xuICAgICAgICB9IHdoaWxlIChwcmV2ID09PSBfd2luWysrc2Nhbl0gJiYgcHJldiA9PT0gX3dpblsrK3NjYW5dICYmXG4gICAgICAgICAgICAgICAgIHByZXYgPT09IF93aW5bKytzY2FuXSAmJiBwcmV2ID09PSBfd2luWysrc2Nhbl0gJiZcbiAgICAgICAgICAgICAgICAgcHJldiA9PT0gX3dpblsrK3NjYW5dICYmIHByZXYgPT09IF93aW5bKytzY2FuXSAmJlxuICAgICAgICAgICAgICAgICBwcmV2ID09PSBfd2luWysrc2Nhbl0gJiYgcHJldiA9PT0gX3dpblsrK3NjYW5dICYmXG4gICAgICAgICAgICAgICAgIHNjYW4gPCBzdHJlbmQpO1xuICAgICAgICBzLm1hdGNoX2xlbmd0aCA9IE1BWF9NQVRDSCAtIChzdHJlbmQgLSBzY2FuKTtcbiAgICAgICAgaWYgKHMubWF0Y2hfbGVuZ3RoID4gcy5sb29rYWhlYWQpIHtcbiAgICAgICAgICBzLm1hdGNoX2xlbmd0aCA9IHMubG9va2FoZWFkO1xuICAgICAgICB9XG4gICAgICB9XG4gICAgICAvL0Fzc2VydChzY2FuIDw9IHMtPndpbmRvdysodUludCkocy0+d2luZG93X3NpemUtMSksIFwid2lsZCBzY2FuXCIpO1xuICAgIH1cblxuICAgIC8qIEVtaXQgbWF0Y2ggaWYgaG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GVhZC50ZXh0ID8gMSA6IDApICtcbiAgICAgICAgICAgICAgICAgICAgKHMuZ3poZWFkLmhjcmMgPyAyIDogMCkgK1xuICAgICAgICAgICAgICAgICAgICAoIXMuZ3poZWFkLmV4dHJhID8gMCA6IDQpICtcbiAgICAgICAgICAgICAgICAgICAgKCFzLmd6aGVhZC5uYW1lID8gMCA6IDgpICtcbiAgICAgICAgICAgICAgICAgICAgKCFzLmd6aGVhZC5jb21tZW50ID8gMCA6IDE2KVxuICAgICAgICAgICAgICAgICk7XG4gICAgICAgIHB1dF9ieXRlKHMsIHMuZ3poZWFkLnRpbWUgJiAweGZmKTtcbiAgICAgICAgcHV0X2J5dGUocywgKHMuZ3poZWFkLnRpbWUgPj4gOCkgJiAweGZmKTtcbiAgICAgICAgcHV0X2J5dGUocywgKHMuZ3poZWFkLnRpbWUgPj4gMTYpICYgMHhmZik7XG4gICAgICAgIHB1dF9ieXRlKHMsIChzLmd6aGVhZC50aW1lID4+IDI0KSAmIDB4ZmYpO1xuICAgICAgICBwdXRfYnl0ZShzLCBzLmxldmVsID09PSA5ID8gMiA6XG4gICAgICAgICAgICAgICAgICAgIChzLnN0cmF0ZWd5ID49IFpfSFVGRk1BTl9PTkxZIHx8IHMubGV2ZWwgPCAyID9cbiAgICAgICAgICAgICAgICAgICAgIDQgOiAwKSk7XG4gICAgICAgIHB1dF9ieXRlKHMsIHMuZ3poZWFkLm9zICYgMHhmZik7XG4gICAgICAgIGlmIChzLmd6aGVhZC5leHRyYSAmJiBzLmd6aGVhZC5leHRyYS5sZW5ndGgpIHtcbiAgICAgICAgICBwdXRfYnl0ZShzLCBzLmd6aGVhZC5leHRyYS5sZW5ndGggJiAweGZmKTtcbiAgICAgICAgICBwdXRfYnl0ZShzLCAocy5nemhlYWQuZXh0cmEubGVuZ3RoID4+IDgpICYgMHhmZik7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKHMuZ3poZWFkLmhjcmMpIHtcbiAgICAgICAgICBzdHJtLmFkbGVyID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T09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0qL1xuXG5cbnZhciAgICBIRUFEID0gMTsgICAgICAgLyogaTogd2FpdGluZyBmb3IgbWFnaWMgaGVhZGVyICovXG52YXIgICAgRkxBR1MgPSAyOyAgICAgIC8qIGk6IHdhaXRpbmcgZm9yIG1ldGhvZCBhbmQgZmxhZ3MgKGd6aXApICovXG52YXIgICAgVElNRSA9IDM7ICAgICAgIC8qIGk6IHdhaXRpbmcgZm9yIG1vZGlmaWNhdGlvbiB0aW1lIChnemlwKSAqL1xudmFyICAgIE9TID0gNDsgICAgICAgICAvKiBpOiB3YWl0aW5nIGZvciBleHRyYSBmbGFncyBhbmQgb3BlcmF0aW5nIHN5c3RlbSAoZ3ppcCkgKi9cbnZhciAgICBFWExFTiA9IDU7ICAgICAgLyogaTogd2FpdGluZyBmb3IgZXh0cmEgbGVuZ3RoIChnemlwKSAqL1xudmFyICAgIEVYVFJBID0gNjsgICAgICAvKiBpOiB3YWl0aW5nIGZvciBleHRyYSBieXRlcyAoZ3ppcCkgKi9cbnZhciAgICBOQU1FID0gNzsgICAgICAgLyogaTogd2FpdGluZyBmb3IgZW5kIG9mIGZpbGUgbmFtZSAoZ3ppcCkgKi9cbnZhciAgICBDT01NRU5UID0gODsgICAgLyogaTogd2FpdGluZyBmb3IgZW5kIG9mIGNvbW1lbnQgKGd6aXApICovXG52YXIgICAgSENSQyA9IDk7ICAgICAgIC8qIGk6IHdhaXRpbmcgZm9yIGhlYWRlciBjcmMgKGd6aXApICovXG52YXIgICAgRElDVElEID0gMTA7ICAgIC8qIGk6IHdhaXRpbmcgZm9yIGRpY3Rpb25hcnkgY2hlY2sgdmFsdWUgKi9cbnZhciAgICBESUNUID0gMTE7ICAgICAgLyogd2FpdGluZyBmb3IgaW5mbGF0ZVNldERpY3Rpb25hcnkoKSBjYWxsICovXG52YXIgICAgICAgIFRZUEUgPSAxMjsgICAgICAvKiBpOiB3YWl0aW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gKz0gODtcbiAgICAgIH1cbiAgICAgIC8vPT09Ly9cbiAgICAgIGlmICgoc3RhdGUud3JhcCAmIDIpICYmIGhvbGQgPT09IDB4OGIxZikgeyAgLyogZ3ppcCBoZWFkZXIgKi9cbiAgICAgICAgc3RhdGUuY2hlY2sgPSAwLypjcmMzMigwTCwgWl9OVUxMLCAwKSovO1xuICAgICAgICAvLz09PSBDUkMyKHN0YXRlLmNoZWNrLCBob2xkKTtcbiAgICAgICAgaGJ1ZlswXSA9IGhvbGQgJiAweGZmO1xuICAgICAgICBoYnVmWzFdID0gKGhvbGQgPj4+IDgpICYgMHhmZjtcbiAgICAgICAgc3RhdGUuY2hlY2sgPSBjcmMzMihzdGF0ZS5jaGVjaywgaGJ1ZiwgMiwgMCk7XG4gICAgICAgIC8vPT09Ly9cblxuICAgICAgICAvLz09PSBJTklUQklUUygpO1xuICAgICAgICBob2xkID0gMDtcbiAgICAgICAgYml0cyA9IDA7XG4gICAgICAgIC8vPT09Ly9cbiAgICAgICAgc3RhdGUubW9kZSA9IEZMQUdTO1xuICAgICAgICBicmVhaztcbiAgICAgIH1cbiAgICAgIHN0YXRlLmZsYWdzID0gMDsgICAgICAgICAgIC8qIGV4cGVjdCB6bGliIGhlYWRlciAqL1xuICAgICAgaWYgKHN0YXRlLmhlYWQpIHtcbiAgICAgICAgc3RhdGUuaGVhZC5kb25lID0gZmFsc2U7XG4gICAgICB9XG4gICAgICBpZiAoIShzdGF0ZS53cmFwICYgMSkgfHwgICAvKiBjaGVjayBpZiB6bGliIGhlYWRlciBhbGxvd2VkICovXG4gICAgICAgICgoKGhvbGQgJiAweGZmKS8qQklUUyg4KSovIDw8IDgpICsgKGhvbGQgPj4gOCkpICUgMzEpIHtcbiAgICAgICAgc3RybS5tc2cgPSAnaW5jb3JyZWN0IGhlYWRlciBjaGVjayc7XG4gICAgICAgIHN0YXRlLm1vZGUgPSBCQUQ7XG4gICAgICAgIGJyZWFrO1xuICAgICAgfVxuICAgICAgaWYgKChob2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RlLmhlYWQuZXh0cmFfbGVuIC0gc3RhdGUubGVuZ3RoO1xuICAgICAgICAgICAgaWYgKCFzdGF0ZS5oZWFkLmV4dHJhKSB7XG4gICAgICAgICAgICAgIC8vIFVzZSB1bnR5cGVkIGFycmF5IGZvciBtb3JlIGNvbnZlbmllbmQgcHJvY2Vzc2luZyBsYXRlclxuICAgICAgICAgICAgICBzdGF0ZS5oZWFkLmV4dHJhID0gbmV3IEFycmF5KHN0YXRlLmhlYWQuZXh0cmFfbGVuKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHV0aWxzLmFycmF5U2V0KFxuICAgICAgICAgICAgICBzdGF0ZS5oZWFkLmV4dHJhLFxuICAgICAgICAgICAgICBpbnB1dCxcbiAgICAgICAgICAgICAgbmV4dCxcbiAgICAgICAgICAgICAgLy8gZXh0cmEgZmllbGQgaXMgbGltaXRlZCB0byA2NTUzNiBieXRlc1xuICAgICAgICAgICAgICAvLyAtIG5vIG5lZWQgZm9yIGFkZGl0aW9uYWwgc2l6ZSBjaGVja1xuICAgICAgICAgICAgICBjb3B5LFxuICAgICAgICAgICAgICAvKmxlbiArIGNvcHkgPiBzdGF0ZS5oZWFkLmV4dHJhX21heCAtIGxlbiA/IHN0YXRlLmhlYWQuZXh0cmFfbWF4IDogY29weSwqL1xuICAgICAgICAgICAgICBsZW5cbiAgICAgICAgICAgICk7XG4gICAgICAgICAgICAvL3ptZW1jcHkoc3RhdGUuaGVhZC5leHRyYSArIGxlbiwgbmV4dCxcbiAgICAgICAgICAgIC8vICAgICAgICBsZW4gKyBjb3B5ID4gc3RhdGUuaGVhZC5leHRyYV9tYXggP1xuICAgICAgICAgICAgLy8gICAgICAgIHN0YXRlLmhlYWQuZXh0cmFfbWF4IC0gbGVuIDogY29weSk7XG4gICAgICAgICAgfVxuICAgICAgICAgIGlmIChzdGF0ZS5mbGFncyAmIDB4MDIwMCkge1xuICAgICAgICAgICAgc3RhdGUuY2hlY2sgPSBjcmMzMihzdGF0ZS5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AgICAgICAgc3RhdGUuaGVhZC5kb25lID0gdHJ1ZTtcbiAgICAgIH1cbiAgICAgIHN0cm0uYWRsZXIgPSBzdGF0ZS5jaGVjayA9IDA7XG4gICAgICBzdGF0ZS5tb2RlID0gVFlQRTtcbiAgICAgIGJyZWFrO1xuICAgIGNhc2UgRElDVElEOlxuICAgICAgLy89PT0gTkVFREJJVFMoMzIpOyAqL1xuICAgICAgd2hpbGUgKGJpdHMgPCAzMikge1xuICAgICAgICBpZiAoaGF2ZSA9PT0gMCkgeyBicmVhayBpbmZfbGVhdmU7IH1cbiAgICAgICAgaGF2ZS0tO1xuICAgICAgICBob2xkICs9IGlucHV0W25leHQrK10gPDwgYml0cztcbiAgICAgICAgYml0cyArPSA4O1xuICAgICAgfVxuICAgICAgLy89PT0vL1xuICAgICAgc3RybS5hZGxlciA9IHN0YXRlLmNoZWNrID0genN3YXAzMihob2xkKTtcbiAgICAgIC8vPT09IElOSVRCSVRTKCk7XG4gICAgICBob2xkID0gMDtcbiAgICAgIGJpdHMgPSAwO1xuICAgICAgLy89PT0vL1xuICAgICAgc3RhdGUubW9kZSA9IERJQ1Q7XG4gICAgICAvKiBmYWxscyB0aHJvdWdoICovXG4gICAgY2FzZSBESUNUOlxuICAgICAgaWYgKHN0YXRlLmhhdmVkaWN0ID09PSAwKSB7XG4gICAgICAgIC8vLS0tIFJFU1RPUkUoKSAtLS1cbiAgICAgICAgc3RybS5uZXh0X291dCA9IHB1dDtcbiAgICAgICAgc3RybS5hdmFpbF9vdXQgPSBsZWZ0O1xuICAgICAgICBzdHJtLm5leHRfaW4gPSBuZXh0O1xuICAgICAgICBzdHJtLmF2YWlsX2luID0gaGF2ZTtcbiAgICAgICAgc3RhdGUuaG9sZCA9IGhvbGQ7XG4gICAgICAgIHN0YXRlLmJpdHMgPSBiaXRzO1xuICAgICAgICAvLy0tLVxuICAgICAgICByZXR1cm4gWl9ORUVEX0RJQ1Q7XG4gICAgICB9XG4gICAgICBzdHJtLmFkbGVyID0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ZWQgYmxvY2sgKi9cbiAgICAgICAgLy9UcmFjZXYoKHN0ZGVyciwgXCJpbmZsYXRlOiAgICAgc3RvcmVkIGJsb2NrJXNcXG5cIixcbiAgICAgICAgLy8gICAgICAgIHN0YXRlLmxhc3QgPyBcIiAobGFzdClcIiA6IFwiXCIpKTtcbiAgICAgICAgc3RhdGUubW9kZSA9IFNUT1JFRDtcbiAgICAgICAgYnJlYWs7XG4gICAgICBjYXNlIDE6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiBmaXhlZCBibG9jayAqL1xuICAgICAgICBmaXhlZHRhYmxlcyhzdGF0ZSk7XG4gICAgICAgIC8vVHJhY2V2KChzdGRlcnIsIFwiaW5mbGF0ZTogICAgIGZpeGVkIGNvZGVzIGJsb2NrJXNcXG5cIixcbiAgICAgICAgLy8gICAgICAgIHN0YXRlLmxhc3QgPyBcIiAobGFzdClcIiA6IFwiXCIpKTtcbiAgICAgICAgc3RhdGUubW9kZSA9IExFTl87ICAgICAgICAgICAgIC8qIGRlY29kZSBjb2RlcyAqL1xuICAgICAgICBpZiAoZmx1c2ggPT09IFpfVFJFRVMpIHtcbiAgICAgICAgICAvLy0tLSBEUk9QQklUUygyKSAtLS0vL1xuICAgICAgICAgIGhvbGQgPj4+PSAyO1xuICAgICAgICAgIGJpdHMgLT0gMjtcbiAgICAgICAgICAvLy0tLS8vXG4gICAgICAgICAgYnJlYWsgaW5mX2xlYXZlO1xuICAgICAgICB9XG4gICAgICAgIGJyZWFrO1xuICAgICAgY2FzZSAyOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogZHluYW1pYyBibG9jayAqL1xuICAgICAgICAvL1RyYWNldigoc3RkZXJyLCBcImluZmxhdGU6ICAgICBkeW5hbWljIGNvZGVzIGJsb2NrJXNcXG5cIixcbiAgICAgICAgLy8gICAgICAgIHN0YXRlLmxhc3QgPyBcIiAobGFzdClcIiA6IFwiXCIpKTtcbiAgICAgICAgc3RhdGUubW9kZSA9IFRBQkxFO1xuICAgICAgICBicmVhaztcbiAgICAgIGNhc2UgMzpcbiAgICAgICAgc3RybS5tc2cgPSAnaW52YWxpZCBibG9jayB0eXBlJztcbiAgICAgICAgc3RhdGUubW9kZSA9IEJBRDtcbiAgICAgIH1cbiAgICAgIC8vLS0tIERST1BCSVRTKDIpIC0tLS8vXG4gICAgICBob2xkID4+Pj0gMjtcbiAgICAgIGJpdHMgLT0gMjtcbiAgICAgIC8vLS0tLy9cbiAgICAgIGJyZWFrO1xuICAgIGNhc2UgU1RPUkVEOlxuICAgICAgLy8tLS0gQllURUJJVFMoKSAtLS0vLyAvKiBnbyB0byBieXRlIGJvdW5kYXJ5ICovXG4gICAgICBob2xkID4+Pj0gYml0cyAmIDc7XG4gICAgICBiaXRzIC09IGJpdHMgJiA3O1xuICAgICAgLy8tLS0vL1xuICAgICAgLy89PT0gTkVFREJJVFMoMzIpOyAqL1xuICAgICAgd2hpbGUgKGJpdHMgPCAzMikge1xuICAgICAgICBpZiAoaGF2ZSA9PT0gMCkgeyBicmVhayBpbmZfbGVhdmU7IH1cbiAgICAgICAgaGF2ZS0tO1xuICAgICAgICBob2xkICs9IGlucHV0W25leHQrK10gPDwgYml0cztcbiAgICAgICAgYml0cyArPSA4O1xuICAgICAgfVxuICAgICAgLy89PT0vL1xuICAgICAgaWYgKChob2xkICYgMHhmZmZmKSAhPT0gKChob2xkID4+PiAxNikgXiAweGZmZmYpKSB7XG4gICAgICAgIHN0cm0ubXNnID0gJ2ludmFsaWQgc3RvcmVkIGJsb2NrIGxlbmd0aHMnO1xuICAgICAgICBzdGF0ZS5tb2RlID0gQkFEO1xuICAgICAgICBicmVhaztcbiAgICAgIH1cbiAgICAgIHN0YXRlLmxlbmd0aCA9IGhvbGQgJiAweGZmZmY7XG4gICAgICAvL1RyYWNldigoc3RkZXJyLCBcImluZmxhdGU6ICAgICAgIHN0b3JlZCBsZW5ndGggJXVcXG5cIixcbiAgICAgIC8vICAgICAgICBzdGF0ZS5sZW5ndGgpKTtcb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hlcmVfYml0cykgPD0gYml0cykgeyBicmVhazsgfVxuICAgICAgICAgIC8vLS0tIFBVTExCWVRFKCkgLS0tLy9cbiAgICAgICAgICBpZiAoaGF2ZSA9PT0gMCkgeyBicmVhayBpbmZfbGVhdmU7IH1cbiAgICAgICAgICBoYXZlLS07XG4gICAgICAgICAgaG9sZCArPSBpbnB1dFtuZXh0KytdIDw8IGJpdHM7XG4gICAgICAgICAgYml0cyArPSA4O1xuICAgICAgICAgIC8vLS0tLy9cbiAgICAgICAgfVxuICAgICAgICBpZiAoaGVyZV92YWwgPCAxNikge1xuICAgICAgICAgIC8vLS0tIERST1BCSVRTKGhlcmUuYml0cykgLS0tLy9cbiAgICAgICAgICBob2xkID4+Pj0gaGVyZV9iaXRzO1xuICAgICAgICAgIGJpdHMgLT0gaGVyZV9iaXRzO1xuICAgICAgICAgIC8vLS0tLy9cbiAgICAgICAgICBzdGF0ZS5sZW5zW3N0YXRlLmhhdmUrK10gPSBoZXJlX3ZhbDtcbiAgICAgICAgfVxuICAgICAgICBlbHNlIHtcbiAgICAgICAgICBpZiAoaGVyZV92YWwgPT09IDE2KSB7XG4gICAgICAgICAgICAvLz09PSBORUVEQklUUyhoZXJlLmJpdHMgKyAyKTtcbiAgICAgICAgICAgIG4gPSBoZXJlX2JpdHMgKyAyO1xuICAgICAgICAgICAgd2hpbGUgKGJpdHMgPCBuKSB7XG4gICAgICAgICAgICAgIGlmIChoYXZlID09PSAwKSB7IGJyZWFrIGluZl9sZWF2ZTsgfVxuICAgICAgICAgICAgICBoYXZlLS07XG4gICAgICAgICAgICAgIGhvbGQgKz0gaW5wdXRbbmV4dCsrXSA8PCBiaXRzO1xuICAgICAgICAgICAgICBiaXRzICs9IDg7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICAvLz09PS8vXG4gICAgICAgICAgICAvLy0tLSBEUk9QQklUUyhoZXJlLmJpdHMpIC0tLS8vXG4gICAgICAgICAgICBob2xkID4+Pj0gaGVyZV9iaXRzO1xuICAgICAgICAgICAgYml0cyAtPSBoZXJlX2JpdHM7XG4gICAgICAgICAgICAvLy0tLS8vXG4gICAgICAgICAgICBpZiAoc3RhdGUuaGF2ZSA9PT0gMCkge1xuICAgICAgICAgICAgICBzdHJtLm1zZyA9ICdpbnZhbGlkIGJpdCBsZW5ndGggcmVwZWF0JztcbiAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IEJBRDtcbiAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBsZW4gPSBzdGF0ZS5sZW5zW3N0YXRlLmhhdmUgLSAxXTtcbiAgICAgICAgICAgIGNvcHkgPSAzICsgKGhvbGQgJiAweDAzKTsvL0JJVFMoMik7XG4gICAgICAgICAgICAvLy0tLSBEUk9QQklUUygyKSAtLS0vL1xuICAgICAgICAgICAgaG9sZCA+Pj49IDI7XG4gICAgICAgICAgICBiaXRzIC09IDI7XG4gICAgICAgICAgICAvLy0tLS8vXG4gICAgICAgICAgfVxuICAgICAgICAgIGVsc2UgaWYgKGhlcmVfdmFsID09PSAxNykge1xuICAgICAgICAgICAgLy89PT0gTkVFREJJVFMoaGVyZS5iaXRzICsgMyk7XG4gICAgICAgICAgICBuID0gaGVyZV9iaXRzICsgMztcbiAgICAgICAgICAgIHdoaWxlIChiaXRzIDwgbikge1xuICAgICAgICAgICAgICBpZiAoaGF2ZSA9PT0gMCkgeyBicmVhayBpbmZfbGVhdmU7IH1cbiAgICAgICAgICAgICAgaGF2ZS0tO1xuICAgICAgICAgICAgICBob2xkICs9IGlucHV0W25leHQrK10gPDwgYml0cztcbiAgICAgICAgICAgICAgYml0cyArPSA4O1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgLy89PT0vL1xuICAgICAgICAgICAgLy8tLS0gRFJPUEJJVFMoaGVyZS5iaXRzKSAtLS0vL1xuICAgICAgICAgICAgaG9sZCA+Pj49IGhlcmVfYml0cztcbiAgICAgICAgICAgIGJpdHMgLT0gaGVyZV9iaXRzO1xuICAgICAgICAgICAgLy8tLS0vL1xuICAgICAgICAgICAgbGVuID0gMDtcbiAgICAgICAgICAgIGNvcHkgPSAzICsgKGhvbGQgJiAweDA3KTsvL0JJVFMoMyk7XG4gICAgICAgICAgICAvLy0tLSBEUk9QQklUUygzKSAtLS0vL1xuICAgICAgICAgICAgaG9sZCA+Pj49IDM7XG4gICAgICAgICAgICBiaXRzIC09IDM7XG4gICAgICAgICAgICAvLy0tLS8vXG4gICAgICAgICAgfVxuICAgICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgLy89PT0gTkVFREJJVFMoaGVyZS5iaXRzICsgNyk7XG4gICAgICAgICAgICBuID0gaGVyZV9iaXRzICsgNztcbiAgICAgICAgICAgIHdoaWxlIChiaXRzIDwgbikge1xuICAgICAgICAgICAgICBpZiAoaGF2ZSA9PT0gMCkgeyBicmVhayBpbmZfbGVhdmU7IH1cbiAgICAgICAgICAgICAgaGF2ZS0tO1xuICAgICAgICAgICAgICBob2xkICs9IGlucHV0W25leHQrK10gPDwgYml0cztcbiAgICAgICAgICAgICAgYml0cyArPSA4O1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgLy89PT0vL1xuICAgICAgICAgICAgLy8tLS0gRFJPUEJJVFMoaGVyZS5iaXRzKSAtLS0vL1xuICAgICAgICAgICAgaG9sZCA+Pj49IGhlcmVfYml0cztcbiAgICAgICAgICAgIGJpdHMgLT0gaGVyZV9iaXRzO1xuICAgICAgICAgICAgLy8tLS0vL1xuICAgICAgICAgICAgbGVuID0gMDtcbiAgICAgICAgICAgIGNvcHkgPSAxMSArIChob2xkICYgMHg3Zik7Ly9CSVRTKDcpO1xuICAgICAgICAgICAgLy8tLS0gRFJPUEJJVFMoNykgLS0tLy9cbiAgICAgICAgICAgIGhvbGQgPj4+PSA3O1xuICAgICAgICAgICAgYml0cyAtPSA3O1xuICAgICAgICAgICAgLy8tLS0vL1xuICAgICAgICAgIH1cbiAgICAgICAgICBpZiAoc3RhdGUuaGF2ZSArIGNvcHkgPi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SkgIT09IHN0YXRlLmNoZWNrKSB7XG4gICAgICAgICAgc3RybS5tc2cgPSAnaW5jb3JyZWN0IGRhdGEgY2hlY2snO1xuICAgICAgICAgIHN0YXRlLm1vZGUgPSBCQUQ7XG4gICAgICAgICAgYnJlYWs7XG4gICAgICAgIH1cbiAgICAgICAgLy89PT0gSU5JVEJJVFMoKTtcbiAgICAgICAgaG9sZCA9IDA7XG4gICAgICAgIGJpdHMgPSAwO1xuICAgICAgICAvLz09PS8vXG4gICAgICAgIC8vVHJhY2V2KChzdGRlcnIsIFwiaW5mbGF0ZTogICBjaGVjayBtYXRjaGVzIHRyYWlsZXJcXG5cIikpO1xuICAgICAgfVxuICAgICAgc3RhdGUubW9kZSA9IExFTkdUSDtcbiAgICAgIC8qIGZhbGxzIHRocm91Z2ggKi9cbiAgICBjYXNlIExFTkdUSDpcbiAgICAgIGlmIChzdGF0ZS53cmFwICYmIHN0YXRlLmZsYWdzKSB7XG4gICAgICAgIC8vPT09IE5FRURCSVRTKDMyKTtcbiAgICAgICAgd2hpbGUgKGJpdHMgPCAzMikge1xuICAgICAgICAgIGlmIChoYXZlID09PSAwKSB7IGJyZWFrIGluZl9sZWF2ZTsgfVxuICAgICAgICAgIGhhdmUtLTtcbiAgICAgICAgICBob2xkICs9IGlucHV0W25leHQrK10gPDwgYml0cztcbiAgICAgICAgICBiaXRzICs9IDg7XG4gICAgICAgIH1cbiAgICAgICAgLy89PT0vL1xuICAgICAgICBpZiAoaG9sZCAhPT0gKHN0YXRlLnRvdGFsICYgMHhmZmZmZmZmZikpIHtcbiAgICAgICAgICBzdHJtLm1zZyA9ICdpbmNvcnJlY3QgbGVuZ3RoIGNoZWNrJztcbiAgICAgICAgICBzdGF0ZS5tb2RlID0gQkFEO1xuICAgICAgICAgIGJyZWFrO1xuICAgICAgICB9XG4gICAgICAgIC8vPT09IElOSVRCSVRTKCk7XG4gICAgICAgIGhvbGQgPSAwO1xuICAgICAgICBiaXRzID0gMDtcbiAgICAgICAgLy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290ID0gMDsgICAgICAgICAgICAgIC8qIG51bWJlciBvZiBpbmRleCBiaXRzIGZvciByb290IHRhYmxlICovXG4gIHZhciBjdXJyID0gMDsgICAgICAgICAgICAgIC8qIG51bWJlciBvZiBpbmRleCBiaXRzIGZvciBjdXJyZW50IHRhYmxlICovXG4gIHZhciBkcm9wID0gMDsgICAgICAgICAgICAgIC8qIGNvZGUgYml0cyB0byBkcm9wIGZvciBzdWItdGFibGUgKi9cbiAgdmFyIGxlZnQgPSAwOyAgICAgICAgICAgICAgICAgICAvKiBudW1iZXIgb2YgcHJlZml4IGNvZGVzIGF2YWlsYWJsZSAqL1xuICB2YXIgdXNlZCA9IDA7ICAgICAgICAgICAgICAvKiBjb2RlIGVudHJpZXMgaW4gdGFibGUgdXNlZCAqL1xuICB2YXIgaHVmZiA9IDA7ICAgICAgICAgICAgICAvKiBIdWZmbWFuIGNvZGUgKi9cbiAgdmFyIGluY3I7ICAgICAgICAgICAgICAvKiBmb3IgaW5jcmVtZW50aW5nIGNvZGUsIGluZGV4ICovXG4gIHZhciBmaWxsOyAgICAgICAgICAgICAgLyogaW5kZXggZm9yIHJlcGxpY2F0aW5nIGVudHJpZXMgKi9cbiAgdmFyIGxvdzsgICAgICAgICAgICAgICAvKiBsb3cgYml0cyBmb3IgY3VycmVudCByb290IGVudHJ5ICovXG4gIHZhciBtYXNrOyAgICAgICAgICAgICAgLyogbWFzayBmb3IgbG93IHJvb3QgYml0cyAqL1xuICB2YXIgbmV4dDsgICAgICAgICAgICAgLyogbmV4dCBhdmFpbGFibGUgc3BhY2UgaW4gdGFibGUgKi9cbiAgdmFyIGJhc2UgPSBudWxsOyAgICAgLyogYmFzZSB2YWx1ZSB0YWJsZSB0byB1c2UgKi9cbiAgdmFyIGJhc2VfaW5kZXggPSAwO1xuLy8gIHZhciBzaG9leHRyYTsgICAgLyogZXh0cmEgYml0cyB0YWJsZSB0byB1c2UgKi9cbiAgdmFyIGVuZDsgICAgICAgICAgICAgICAgICAgIC8qI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fT0sgICAgICAgICAgICAgIDAgICovXG4gICctMSc6ICAgJ2ZpbGUgZXJyb3InLCAgICAgICAgICAvKiBaX0VSUk5PICAgICAgICAgKC0xKSAqL1xuICAnLTInOiAgICdzdHJlYW0gZXJyb3InLCAgICAgICAgLyogWl9TVFJFQU1fRVJST1IgICgtMikgKi9cbiAgJy0zJzogICAnZGF0YSBlcnJvcicsICAgICAgICAgIC8qIFpfREFUQV9FUlJPUiAgICAoLTMpICovXG4gICctNCc6ICAgJ2luc3VmZmljaWVudCBtZW1vcnknLCAvKiBaX01FTV9FUlJPUiAgICAgKC00KSAqL1xuICAnLTUnOiAgICdidWZmZXIgZXJyb3InLCAgICAgICAgLyogWl9CVUZfRVJST1IgICAgICgtNSkgKi9cbiAgJy02JzogICAnaW5jb21wYXRpYmxlIHZlcnNpb24nIC8qIFpfVkVSU0lPTl9FUlJPUiAoLTYpICovXG59O1xuIiwiJ3VzZSBzdHJpY3QnO1xuXG5cbnZhciB1dGlscyA9IHJlcXVpcmUoJy4uL3V0aWxzL2NvbW1vbicpO1xuXG4vKiBQdWJsaWMgY29uc3RhbnRzID09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0qL1xuLyogPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09Ki9cblxuXG4vL3ZhciBaX0ZJTFRFUkVEICAgICAgICAgID0gMTtcbi8vdmFyIFpfSFVGRk1BTl9PTkxZICAgICAgPSAyO1xuLy92YXIgWl9STEUgICAgICAgICAgICAgICA9IDM7XG52YXIgWl9GSVhFRCAgICAgICAgICAgICAgID0gNDtcbi8vdmFyIFpfREVGQVVMVF9TVFJBVEVHWSAgPSAwO1xuXG4vKiBQb3NzaWJsZSB2YWx1ZXMgb2YgdGhlIGRhdGFfdHlwZSBmaWVsZCAodGhvdWdoIHNlZSBpbmZsYXRlKCkpICovXG52YXIgWl9CSU5BUlkgICAgICAgICAgICAgID0gMDtcbnZhciBaX1RFWFQgICAgICAgICAgICAgICAgPSAxO1xuLy92YXIgWl9BU0NJSSAgICAgICAgICAgICA9IDE7IC8vID0gWl9URVhUXG52YXIgWl9VTktOT1dOICAgICAgICAgICAgID0gMjtcblxuLyo9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09Ki9cblxuXG5mdW5jdGlvbiB6ZXJvKGJ1ZikgeyB2YXIgbGVuID0gYnVmLmxlbmd0aDsgd2hpbGUgKC0tbGVuID49IDApIHsgYnVmW2xlbl0gPSAwOyB9IH1cblxuLy8gRnJvbSB6dXRpbC5oXG5cbnZhciBTVE9SRURfQkxPQ0sgPSAwO1xudmFyIFNUQVRJQ19UUkVFUyA9IDE7XG52YXIgRFlOX1RSRUVTICAgID0gMjtcbi8qIFRoZSB0aHJlZSBraW5kcyBvZiBibG9jayB0eXBlICovXG5cbnZhciBNSU5fTUFUQ0ggICAgPSAzO1xudmFyIE1BWF9NQVRDSCAgICA9IDI1ODtcbi8qIFRoZSBtaW5pbXVtIGFuZCBtYXhpbXVtIG1hdGNoIGxlbmd0aHMgKi9cblxuLy8gRnJvbSBkZWZsYXRlLmhcbi8qID09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PVxuICogSW50ZXJuYWwgY29tcHJlc3Npb24gc3RhdGUuXG4gKi9cblxudmFyIExFTkdUSF9DT0RFUyAgPSAyOTtcbi8qIG51bWJlciBvZiBsZW5ndGggY29kZXMsIG5vdCBjb3VudGluZyB0aGUgc3BlY2lhbCBFTkRfQkxPQ0sgY29kZSAqL1xuXG52YXIgTElURVJBTFMgICAgICA9IDI1Njtcbi8qIG51bWJlciBvZiBsaXRlcmFsIGJ5dGVzIDAuLjI1NSAqL1xuXG52YXIgTF9DT0RFUyAgICAgICA9IExJVEVSQU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c3RlYWQgb2YgZml4aW5nIG9ubHkgdGhlIHdyb25nIG9uZXMuIFRoaXMgaWRlYSBpcyB0YWtlblxuICAgKiBmcm9tICdhcicgd3JpdHRlbiBieSBIYXJ1aGlrbyBPa3VtdXJhLilcbiAgICovXG4gIGZvciAoYml0cyA9IG1heF9sZW5ndGg7IGJpdHMgIT09IDA7IGJpdHMtLSkge1xuICAgIG4gPSBzLmJsX2NvdW50W2JpdHNdO1xuICAgIHdoaWxlIChuICE9PSAwKSB7XG4gICAgICBtID0gcy5oZWFwWy0taF07XG4gICAgICBpZiAobSA+IG1heF9jb2RlKSB7IGNvbnRpbnVlOyB9XG4gICAgICBpZiAodHJlZVttICogMiArIDFdLyouTGVuKi8gIT09IGJpdHMpIHtcbiAgICAgICAgLy8gVHJhY2UoKHN0ZGVycixcImNvZGUgJWQgYml0cyAlZC0+JWRcXG5cIiwgbSwgdHJlZVttXS5MZW4sIGJpdHMpKTtcbiAgICAgICAgcy5vcHRfbGVuICs9IChiaXRzIC0gdHJlZVttICogMiArIDFdLyouTGVuKi8pICogdHJlZVttICogMl0vKi5GcmVxKi87XG4gICAgICAgIHRyZWVbbSAqIDIgKyAxXS8qLkxlbiovID0gYml0cztcbiAgICAgIH1cbiAgICAgIG4tLTtcbiAgICB9XG4gIH1cbn1cblxuXG4vKiA9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT1cbiAqIEdlbmVyYXRlIHRoZSBjb2RlcyBmb3IgYSBnaXZlbiB0cmVlIGFuZCBiaXQgY291bnRzICh3aGljaCBuZWVkIG5vdCBiZVxuICogb3B0aW1hbCkuXG4gKiBJTiBhc3NlcnRpb246IHRoZSBhcnJheSBibF9jb3VudCBjb250YWlucyB0aGUgYml0IGxlbmd0aCBzdGF0aXN0aWNzIGZvclxuICogdGhlIGdpdmVuIHRyZWUgYW5kIHRoZSBmaWVsZCBsZW4gaXMgc2V0IGZvciBhbGw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3MucGVuZGluZysrXSA9IHMuYmlfYnVmO1xuICB9XG4gIHMuYmlfYnVmID0gMDtcbiAgcy5iaV92YWxpZCA9IDA7XG59XG5cbi8qID09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PVxuICogQ29weSBhIHN0b3JlZCBibG9jaywgc3RvcmluZyBmaXJzdCB0aGUgbGVuZ3RoIGFuZCBpdHNcbiAqIG9uZSdzIGNvbXBsZW1lbnQgaWYgcmVxdWVzdGVkLlxuICovXG5mdW5jdGlvbiBjb3B5X2Jsb2NrKHMsIGJ1ZiwgbGVuLCBoZWFkZXIpXG4vL0RlZmxhdGVTdGF0ZSAqcztcbi8vY2hhcmYgICAgKmJ1ZjsgICAgLyogdGhlIGlucHV0IGRhdGEgKi9cbi8vdW5zaWduZWQgbGVuOyAgICAgLyogaXRzIGxlbmd0aCAqL1xuLy9pbnQgICAgICBoZWFkZXI7ICAvKiB0cnVlIGlmIGJsb2NrIGhlYWRlciBtdXN0IGJlIHdyaXR0ZW4gKi9cbntcbiAgYmlfd2luZHVwKHMpOyAgICAgICAgLyogYWxpZ24gb24gYnl0ZSBib3VuZGFyeSAqL1xuXG4gIGlmIChoZWFkZXIpIHtcbiAgICBwdXRfc2hvcnQocywgbGVuKTtcbiAgICBwdXRfc2hvcnQocywgfmxlbik7XG4gIH1cbi8vICB3aGlsZSAobGVuLS0pIHtcbi8vICAgIHB1dF9ieXRlKHMsICpidWYrKyk7XG4vLyAgfVxuICB1dGlscy5hcnJheVNldChzLnBlbmRpbmdfYnVmLCBzLndpbmRvdywgYnVmLCBsZW4sIHMucGVuZGluZyk7XG4gIHMucGVuZGluZyArPSBsZW47XG59XG5cbi8qID09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PVxuICogQ29tcGFyZXMgdG8gc3VidHJlZXMsIHVzaW5nIHRoZSB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B2YXIgcHJldmxlbiA9IC0xOyAgICAgICAgICAvKiBsYXN0IGVtaXR0ZWQgbGVuZ3RoICovXG4gIHZhciBjdXJsZW47ICAgICAgICAgICAgICAgIC8qIGxlbmd0aCBvZiBjdXJyZW50IGNvZGUgKi9cblxuICB2YXIgbmV4dGxlbiA9IHRyZWVbMCAqIDIgKyAxXS8qLkxlbiovOyAvKiBsZW5ndGggb2YgbmV4dCBjb2RlICovXG5cbiAgdmFyIGNvdW50ID0gMDsgICAgICAgICAgICAgLyogcmVwZWF0IGNvdW50IG9mIHRoZSBjdXJyZW50IGNvZGUgKi9cbiAgdmFyIG1heF9jb3VudCA9IDc7ICAgICAgICAgLyogbWF4IHJlcGVhdCBjb3VudCAqL1xuICB2YXIgbWluX2NvdW50ID0gNDsgICAgICAgICAvKiBtaW4gcmVwZWF0IGNvdW50ICovXG5cbiAgaWYgKG5leHRsZW4gPT09IDApIHtcbiAgICBtYXhfY291bnQgPSAxMzg7XG4gICAgbWluX2NvdW50ID0gMztcbiAgfVxuICB0cmVlWyhtYXhfY29kZSArIDEpICogMiArIDFdLyouTGVuKi8gPSAweGZmZmY7IC8qIGd1YXJkICovXG5cbiAgZm9yIChuID0gMDsgbiA8PSBtYXhfY29kZTsgbisrKSB7XG4gICAgY3VybGVuID0gbmV4dGxlbjtcbiAgICBuZXh0bGVuID0gdHJlZVsobiArIDEpICogMiArIDFdLyouTGVuKi87XG5cbiAgICBpZiAoKytjb3VudCA8IG1heF9jb3VudCAmJiBjdXJsZW4gPT09IG5leHRsZW4pIHtcbiAgICAgIGNvbnRpbnVlO1xuXG4gICAgfSBlbHNlIGlmIChjb3VudCA8IG1pbl9jb3VudCkge1xuICAgICAgcy5ibF90cmVlW2N1cmxlbiAqIDJdLyouRnJlcSovICs9IGNvdW50O1xuXG4gICAgfSBlbHNlIGlmIChjdXJsZW4gIT09IDApIHtcblxuICAgICAgaWYgKGN1cmxlbiAhPT0gcHJldmxlbikgeyBzLmJsX3RyZWVbY3VybGVuICogMl0vKi5GcmVxKi8rKzsgfVxuICAgICAgcy5ibF90cmVlW1JFUF8zXzYgKiAyXS8qLkZyZXEqLysrO1xuXG4gICAgfSBlbHNlIGlmIChjb3VudCA8PSAxMCkge1xuICAgICAgcy5ibF90cmVlW1JFUFpfM18xMCAqIDJdLyouRnJlcSovKys7XG5cbiAgICB9IGVsc2Uge1xuICAgICAgcy5ibF90cmVlW1JFUFpfMTFfMTM4ICogMl0vKi5GcmVxKi8rKztcbiAgICB9XG5cbiAgICBjb3VudCA9IDA7XG4gICAgcHJldmxlbiA9IGN1cmxlbjtcblxuICAgIGlmIChuZXh0bGVuID09PSAwKSB7XG4gICAgICBtYXhfY291bnQgPSAxMzg7XG4gICAgICBtaW5fY291bnQgPSAzO1xuXG4gICAgfSBlbHNlIGlmIChjdXJsZW4gPT09IG5leHRsZW4pIHtcbiAgICAgIG1heF9jb3VudCA9IDY7XG4gICAgICBtaW5fY291bnQgPSAzO1xuXG4gICAgfSBlbHNlIHtcbiAgICAgIG1heF9jb3VudCA9IDc7XG4gICAgICBtaW5fY291bnQgPSA0O1xuICAgIH1cbiAgfVxufVxuXG5cbi8qID09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PVxuICogU2VuZCBhIGxpdGVyYWwgb3IgZGlzdGFuY2UgdHJlZSBpbiBjb21wcmVzc2VkIGZvcm0sIHVzaW5nIHRoZSBjb2RlcyBpblxuICogYmxfdHJlZS5cbiAqL1xuZnVuY3Rpb24gc2VuZF90cmVlKHMsIHRyZWUsIG1heF9jb2RlKVxuLy8gICAgZGVmbGF0ZV9zdGF0ZSAqcztcbi8vICAgIGN0X2RhdGEgKnRyZWU7IC8qIHRoZSB0cmVlIHRvIGJlIHNjYW5uZWQgKi9cbi8vICAgIGludCBtYXhfY29kZTsgICAgICAgLyogYW5kIGl0cyBsYXJnZXN0IGNvZGUgb2Ygbm9uIHplcm8gZnJlcXVlbmN5ICovXG57XG4gIHZhciBuOyAgICAgICAgICAgICAgICAgICAgIC8qIGl0ZXJhdGVzIG92ZXIgYWxsIHRyZWUgZWxlbWVudHMgKi9cbiAgdmFyIHByZXZsZW4gPSAtMTsgICAgICAgICAgLyogbGFzdCBlbWl0dGVkIGxlbmd0aCAqL1xuICB2YXIgY3VybGVuOyAgICAgICAgICAgICAgICAvKiBsZW5ndGggb2YgY3VycmVudCBjb2RlICovXG5cbiAgdmFyIG5leHRsZW4gPSB0cmVlWzAgKiAyICsgMV0vKi5MZW4qLzsgLyogbGVuZ3RoIG9mIG5leHQgY29kZSAqL1xuXG4gIHZhciBjb3VudCA9IDA7ICAgICAgICAgICAgIC8qIHJlcGVhdCBjb3VudCBvZiB0aGUgY3VycmVudCBjb2RlICovXG4gIHZhciBtYXhfY291bnQgPSA3OyAgICAgICAgIC8qIG1heCByZXBlYXQgY291bnQgKi9cbiAgdmFyIG1pbl9jb3VudCA9IDQ7ICAgICAgICAgLyogbWluIHJlcGVhdCBjb3VudCAqL1xuXG4gIC8qIHRyZWVbbWF4X2NvZGUrMV0uTGVuID0gLTE7ICovICAvKiBndWFyZCBhbHJlYWR5IHNldCAqL1xuICBpZiAobmV4dGxlbiA9PT0gMCkge1xuICAgIG1heF9jb3VudCA9IDEzODtcbiAgICBtaW5fY291bnQgPSAzO1xuICB9XG5cbiAgZm9yIChuID0gMDsgbiA8PSBtYXhfY29kZTsgbisrKSB7XG4gICAgY3VybGVuID0gbmV4dGxlbjtcbiAgICBuZXh0bGVuID0gdHJlZVsobiArIDEpICogMiArIDFdLyouTGVuKi87XG5cbiAgICBpZiAoKytjb3VudCA8IG1heF9jb3VudCAmJiBjdXJsZW4gPT09IG5leHRsZW4pIHtcbiAgICAgIGNvbnRpbnVlO1xuXG4gICAgfSBlbHNlIGlmIChjb3VudCA8IG1pbl9jb3VudCkge1xuICAgICAgZG8geyBzZW5kX2NvZGUocywgY3VybGVuLCBzLmJsX3RyZWUpOyB9IHdoaWxlICgtLWNvdW50ICE9PSAwKTtcblxuICAgIH0gZWxzZSBpZiAoY3VybGVuICE9PSAwKSB7XG4gICAgICBpZiAoY3VybGVuICE9PSBwcmV2bGVuKSB7XG4gICAgICAgIHNlbmRfY29kZShzLCBjdXJsZW4sIHMuYmxfdHJlZSk7XG4gICAgICAgIGNvdW50LS07XG4gICAgICB9XG4gICAgICAvL0Fzc2VydChjb3VudCA+PSAzICYmIGNvdW50IDw9IDYsIFwiIDNfNj9cIik7XG4gICAgICBzZW5kX2NvZGUocywgUkVQXzNfNiwgcy5ibF90cmVlKTtcbiAgICAgIHNlbmRfYml0cyhzLCBjb3VudCAtIDMsIDIpO1xuXG4gICAgfSBlbHNlIGlmIChjb3VudCA8PSAxMCkge1xuICAgICAgc2VuZF9jb2RlKHMsIFJFUFpfM18xMCwgcy5ibF90cmVlKTtcbiAgICAgIHNlbmRfYml0cyhzLCBjb3VudCAtIDMsIDMpO1xuXG4gICAgfSBlbHNlIHtcbiAgICAgIHNlbmRfY29kZShzLCBSRVBaXzExXzEzOCwgcy5ibF90cmVlKTtcbiAgICAgIHNlbmRfYml0cyhzLCBjb3VudCAtIDExLCA3KTtcbiAgICB9XG5cbiAgICBjb3VudCA9IDA7XG4gICAgcHJldmxlbiA9IGN1cmxlbjtcbiAgICBpZiAobmV4dGxlbiA9PT0gMCkge1xuICAgICAgbWF4X2NvdW50ID0gMTM4O1xuICAgICAgbWluX2NvdW50ID0gMztcblxuICAgIH0gZWxzZSBpZiAoY3VybGVuID09PSBuZXh0bGVuKSB7XG4gICAgICBtYXhfY291bnQgPSA2O1xuICAgICAgbWluX2NvdW50ID0gMztcblxuICAgIH0gZWxzZSB7XG4gICAgICBtYXhfY291bnQgPSA3O1xuICAgICAgbWluX2NvdW50ID0gNDtcbiAgICB9XG4gIH1cbn1cblxuXG4vKiA9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT1cbiAqIENvbnN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dG91Y2hab29tRGlzdGFuY2VTdGFydCA9IE1hdGguc3FydChkeCAqIGR4ICsgZHkgKiBkeSk7XG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICBfc3RhdGUgPSBTVEFURS5aT09NO1xuICAgICAgICAgICAgICBfem9vbVN0YXJ0LmNvcHkoZ2V0TW91c2VPblNjcmVlbihldmVudC50b3VjaGVzWyAwIF0ucGFnZVgsIGV2ZW50LnRvdWNoZXNbIDAgXS5wYWdlWSkpO1xuICAgICAgICAgICAgICBfem9vbUVuZC5jb3B5KF96b29tU3RhcnQpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgYnJlYWs7XG5cbiAgICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgY2FzZSA1OlxuICAgICAgICAgICAgaWYgKGV2ZW50LnRvdWNoZXMubGVuZ3RoID49IDIpIHtcbiAgICAgICAgICAgICAgX3N0YXRlID0gU1RBVEUuVE9VQ0hfUEFOO1xuICAgICAgICAgICAgICB2YXIgeCA9IChldmVudC50b3VjaGVzWyAwIF0ucGFnZVggKyBldmVudC50b3VjaGVzWyAxIF0ucGFnZVgpIC8gMjtcbiAgICAgICAgICAgICAgdmFyIHkgPSAoZXZlbnQudG91Y2hlc1sgMCBdLnBhZ2VZICsgZXZlbnQudG91Y2hlc1sgMSBdLnBhZ2VZKSAvIDI7XG4gICAgICAgICAgICAgIF9wYW5TdGFydC5jb3B5KGdldE1vdXNlT25TY3JlZW4oeCwgeSkpO1xuICAgICAgICAgICAgICBfcGFuRW5kLmNvcHkoX3BhblN0YXJ0KTtcbiAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgIF9zdGF0ZSA9IFNUQVRFLlBBTjtcbiAgICAgICAgICAgICAgX3BhblN0YXJ0LmNvcHkoZ2V0TW91c2VPblNjcmVlbihldmVudC50b3VjaGVzWyAwIF0ucGFnZVgsIGV2ZW50LnRvdWNoZXNbIDAgXS5wYWdlWSkpO1xuICAgICAgICAgICAg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gICAgICAgICAgX3N0YXRlID0gU1RBVEUuWk9PTTtcbiAgICAgICAgICAgIGJyZWFrO1xuXG4gICAgICAgICAgY2FzZSA1OlxuICAgICAgICAgICAgLy8gVE9VQ0ggWk9PTVxuICAgICAgICAgICAgaWYgKGV2ZW50LnRvdWNoZXMubGVuZ3RoID49IDIpIHtcbiAgICAgICAgICAgICAgdmFyIHggPSAoZXZlbnQudG91Y2hlc1sgMCBdLnBhZ2VYICsgZXZlbnQudG91Y2hlc1sgMSBdLnBhZ2VYKSAvIDI7XG4gICAgICAgICAgICAgIHZhciB5ID0gKGV2ZW50LnRvdWNoZXNbIDAgXS5wYWdlWSArIGV2ZW50LnRvdWNoZXNbIDEgXS5wYWdlWSkgLyAyO1xuICAgICAgICAgICAgICBfcGFuRW5kLmNvcHkoZ2V0TW91c2VPblNjcmVlbih4LCB5KSk7XG4gICAgICAgICAgICAgIF9wYW5TdGFydC5jb3B5KF9wYW5FbmQpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgX3N0YXRlID0gU1RBVEUuUEFOO1xuICAgICAgICAgICAgYnJlYWs7XG5cbiAgICAgICAgICBjYXNlIDk5OlxuICAgICAgICAgICAgdmFyIHggPSAoZXZlbnQudG91Y2hlc1sgMCBdLnBhZ2VYICsgZXZlbnQudG91Y2hlc1sgMSBdLnBhZ2VYKSAvIDI7XG4gICAgICAgICAgICB2YXIgeSA9IChldmVudC50b3VjaGVzWyAwIF0ucGFnZVkgKyBldmVudC50b3VjaGVzWyAxIF0ucGFnZVkpIC8gMjtcbiAgICAgICAgICAgIF9jdXN0b21FbmQuY29weShnZXRNb3VzZU9uU2NyZWVuKHgsIHkpKTtcbiAgICAgICAgICAgIF9jdXN0b21TdGFydC5jb3B5KF9jdXN0b21FbmQpO1xuICAgICAgICAgICAgYnJlYWs7XG5cbiAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgX3N0YXRlID0gU1RBVEUuTk9ORTtcblxuICAgICAgICB9XG4gICAgICB9XG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G5cbiAgICAgICAgcmV0dXJuIHZlY3RvcjtcblxuICAgICAgfTtcblxuICAgIH0oKSk7XG5cbiAgICB0aGlzLnpvb21DYW1lcmEgPSBmdW5jdGlvbigpIHtcblxuICAgICAgaWYgKF9zdGF0ZSA9PT0gU1RBVEUuVE9VQ0hfWk9PTV9QQU4pIHtcblxuICAgICAgICB2YXIgZmFjdG9yID0gX3RvdWNoWm9vbURpc3RhbmNlRW5kIC8gX3RvdWNoWm9vbURpc3RhbmNlU3RhcnQ7XG4gICAgICAgIF90b3VjaFpvb21EaXN0YW5jZVN0YXJ0ID0gX3RvdWNoWm9vbURpc3RhbmNlRW5kO1xuXG4gICAgICAgIF90aGlzLm9iamVjdC56b29tICo9IGZhY3RvcjtcblxuICAgICAgICBfY2hhbmdlZCA9IHRydWU7XG5cbiAgICAgIH0gZWxzZSB7XG5cbiAgICAgICAgdmFyIGZhY3RvciA9IDEuMCArIChfem9vbUVuZC55IC0gX3pvb21TdGFydC55KSAqIF90aGlzLnpvb21TcGVlZDtcblxuICAgICAgICBpZiAoTWF0aC5hYnMoZmFjdG9yIC0gMS4wKSA+IEVQUyAmJiBmYWN0b3IgPiAwLjApIHtcblxuICAgICAgICAgIF90aGlzLm9iamVjdC56b29tIC89IGZhY3RvcjtcblxuICAgICAgICAgIGlmIChfdGhpcy5zdGF0aWNNb3ZpbmcpIHtcblxuICAgICAgICAgICAgX3pvb21TdGFydC5jb3B5KF96b29tRW5kKTtcblxuICAgICAgICAgIH0gZWxzZSB7XG5cbiAgICAgICAgICAgIF96b29tU3RhcnQueSArPSAoX3pvb21FbmQueSAtIF96b29tU3RhcnQueSkgKiB0aGlzLmR5bmFtaWNEYW1waW5nRmFjdG9yO1xuXG4gICAgICAgICAgfVxuXG4gICAgICAgICAgX2NoYW5nZWQgPSB0cnVlO1xuXG4gICAgICAgIH1cblxuICAgICAgfVxuXG4gICAgfTtcblxuICAgIHRoaXMucGFuQ2FtZXJhID0gKGZ1bmN0aW9uKCkge1xuXG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zKTtcblxuICAgIHJheTIuZGlyZWN0aW9uID0gb3JpZW50YXRpb24ueTtcbiAgICB0aGlzLnJheVBsYW5lSW5CQm94KHJheTIsIHBsYW5lQUFCQiwgYmJveCwgaW50ZXJzZWN0aW9ucyk7XG5cbiAgICByYXkyLmRpcmVjdGlvbiA9IG9yaWVudGF0aW9uLno7XG4gICAgdGhpcy5yYXlQbGFuZUluQkJveChyYXkyLCBwbGFuZUFBQkIsIGJib3gsIGludGVyc2VjdGlvbnMpO1xuXG4gICAgLy8gUkFZUyBTVEFSVElORyBGUk9NIFRIRSBTRUNPTkQgQ09STkVSXG4gICAgLy9cbiAgICAvLyAgICAgICAgICAgICAgICtcbiAgICAvLyAgICAgICAgICAgICAgIHxcbiAgICAvLyAgICAgICAgICAgICAgIHxcbiAgICAvLyAgICAgICAgICAgICAgIHxcbiAgICAvLyAgICAgICAgICAgICAgICtcbiAgICAvLyAgICAgICAgICAgICAuJ1xuICAgIC8vICAgICAgICAgICArJ1xuXG4gICAgbGV0IHJheTMgPSB0aGlzLnBvc2RpcihcbiAgICAgIG5ldyBUSFJFRS5WZWN0b3IzKGFhYmIuY2VudGVyLnggKyBhYWJiLmhhbGZEaW1lbnNpb25zLngsIGFhYmIuY2VudGVyLnkgLSBhYWJiLmhhbGZEaW1lbnNpb25zLnksIGFhYmIuY2VudGVyLnogLSBhYWJiLmhhbGZEaW1lbnNpb25zLnopLFxuICAgICAgb3JpZW50YXRpb24ueVxuICAgICk7XG4gICAgdGhpcy5yYXlQbGFuZUluQkJveChyYXkzLCBwbGFuZUFBQkIsIGJib3gsIGludGVyc2VjdGlvbnMpO1xuXG4gICAgcmF5My5kaXJlY3Rpb24gPSBvcmllbnRhdGlvbi56O1xuICAgIHRoaXMucmF5UGxhbmVJbkJCb3gocmF5MywgcGxhbmVBQUJCLCBiYm94LCBpbnRlcnNlY3Rpb25zKTtcblxuICAgIC8vIFJBWVMgU1RBUlRJTkcgRlJPTSBUSEUgVEhJUkQgQ09STkVSXG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gICAgYm94LmNlbnRlci55LFxuICAgICAgICBib3guY2VudGVyLnopLFxuICAgICAgbmV3IFRIUkVFLlZlY3RvcjMoMSwgMCwgMClcbiAgICApO1xuICAgIHRoaXMucmF5UGxhbmVJbkJCb3gocmF5LCBwbGFuZSwgYmJveCwgaW50ZXJzZWN0aW9ucyk7XG5cbiAgICAvLyBZIG1pblxuICAgIHBsYW5lID0gdGhpcy5wb3NkaXIoXG4gICAgICBuZXcgVEhSRUUuVmVjdG9yMyhcbiAgICAgICAgYm94LmNlbnRlci54LFxuICAgICAgICBiYm94Lm1pbi55LFxuICAgICAgICBib3guY2VudGVyLnopLFxuICAgICAgbmV3IFRIUkVFLlZlY3RvcjMoMCwgLTEsIDApXG4gICAgKTtcbiAgICB0aGlzLnJheVBsYW5lSW5CQm94KHJheSwgcGxhbmUsIGJib3gsIGludGVyc2VjdGlvbnMpO1xuXG4gICAgLy8gWSBtYXhcbiAgICBwbGFuZSA9IHRoaXMucG9zZGlyKFxuICAgICAgbmV3IFRIUkVFLlZlY3RvcjMoXG4gICAgICAgIGJveC5jZW50ZXIueCxcbiAgICAgICAgYmJveC5tYXgueSxcbiAgICAgICAgYm94LmNlbnRlci56KSxcbiAgICAgIG5ldyBUSFJFRS5WZWN0b3IzKDAsIDEsIDApXG4gICAgKTtcbiAgICB0aGlzLnJheVBsYW5lSW5CQm94KHJheSwgcGxhbmUsIGJib3gsIGludGVyc2VjdGlvbnMpO1xuXG4gICAgLy8gWiBtaW5cbiAgICBwbGFuZSA9IHRoaXMucG9zZGlyKFxuICAgICAgbmV3IFRIUkVFLlZlY3RvcjMoXG4gICAgICAgIGJveC5jZW50ZXIueCxcbiAgICAgICAgYm94LmNlbnRlci55LFxuICAgICAgICBiYm94Lm1pbi56KSxcbiAgICAgIG5ldyBUSFJFRS5WZWN0b3IzKDAsIDAsIC0xKVxuICAgICk7XG4gICAgdGhpcy5yYXlQbGFuZUluQkJveChyYXksIHBsYW5lLCBiYm94LCBpbnRlcnNlY3Rpb25zKTtcblxuICAgIC8vIFogbWF4XG4gICAgcGxhbmUgPSB0aGlzLnBvc2RpcihcbiAgICAgIG5ldyBUSFJFRS5WZWN0b3IzKFxuICAgICAgICBib3guY2VudGVyLngsXG4gICAgICAgIGJveC5jZW50ZXIueSxcbiAgICAgICAgYmJveC5tYXgueiksXG4gICAgICBuZXcgVEhSRUUuVmVjdG9yMygwLCAwLCAxKVxuICAgICk7XG4gICAgdGhpcy5yYXlQbGFuZUluQkJveChyYXksIHBsYW5lLCBiYm94LCBpbnRlcnNlY3Rpb25zKTtcblxuICAgIHJldHVybiBpbnRlcnNlY3Rpb25zO1xuICB9XG5cblxuICBzdGF0aWMgcmF5UGxhbmVJbkJCb3gocmF5LCBwbGFuZUFBQkIsIGJib3gsIGludGVyc2VjdGlvbnMpIHtcbiAgICBsZXQgaW50ZXJzZWN0aW9uID0gdGhpcy5yYXlQbGFuZShyYXksIHBsYW5lQUFCQik7XG4gICAgLy8gd2luZG93LmNvbnNvbGUubG9nKGludGVyc2VjdGlvbik7XG4gICAgaWYgKGludGVyc2VjdGlvbiAmJiB0aGlzLmluQkJveChpbnRlcnNlY3Rpb24sIGJib3gpKXtcbiAgICAgIGlmKCFpbnRlcnNlY3Rpb25zLmZpbmQodGhpcy5maW5kSW50ZXJzZWN0aW9uKGludGVyc2VjdGlvbikpKXtcbiAgICAgICAgaW50ZXJzZWN0aW9ucy5wdXNoKGludGVyc2VjdGlvbik7XG4gICAgICB9XG4gICAgfVxuICB9XG5cbiAgc3RhdGljIGZpbmRJbnRlcnNlY3Rpb24obXlpbnRlcnNlY3Rpb24pe1xuICAgIHJldHVybiBmdW5jdGlvbiBmb3VuZChlbGVtZW50LCBpbmRleCwgYXJyYXkpIHtcbiAgICAgIGlmKG15aW50ZXJzZWN0aW9uLnggPT09IGVsZW1lbnQueCAmJlxuICAgICAgICBteWludGVyc2VjdGlvbi55ID09PSBlbGVtZW50LnkgJiZcbiAgICAgICAgbXlpbnRlcnNlY3Rpb24ue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0aW9uLCBpbmRleCl7XG4gICAgbGV0IHBvc2l0aW9uID0gbmV3IFRIUkVFLlZlY3RvcjMoMCwgMCwgMCk7XG4gICAgc3dpdGNoKHRoaXMuX29yaWVudGF0aW9uKXtcbiAgICAgIGNhc2UgMDpcbiAgICAgICAgcG9zaXRpb24gPSBuZXcgVEhSRUUuVmVjdG9yMyhcbiAgICAgICAgICBNYXRoLmZsb29yKHJQb3NpdGlvbi54KSxcbiAgICAgICAgICBNYXRoLmZsb29yKHJQb3NpdGlvbi55KSxcbiAgICAgICAgICBpbmRleCk7XG4gICAgICAgIGJyZWFrO1xuICAgICAgY2FzZSAxOlxuICAgICAgICBwb3NpdGlvbiA9IG5ldyBUSFJFRS5WZWN0b3IzKFxuICAgICAgICAgIGluZGV4LFxuICAgICAgICAgIE1hdGguZmxvb3IoclBvc2l0aW9uLnkpLFxuICAgICAgICAgIE1hdGguZmxvb3IoclBvc2l0aW9uLnopKTtcbiAgICAgICAgYnJlYWs7XG4gICAgICBjYXNlIDI6XG4gICAgICAgIHBvc2l0aW9uID0gbmV3IFRIUkVFLlZlY3RvcjMoXG4gICAgICAgICAgTWF0aC5mbG9vcihyUG9zaXRpb24ueCksXG4gICAgICAgICAgaW5kZXgsXG4gICAgICAgICAgTWF0aC5mbG9vcihyUG9zaXRpb24ueikpO1xuICAgICAgICBicmVhaztcbiAgICAgIGRlZmF1bHQ6XG4gICAgICAgIC8vIGRvIG5vdGhpbmchXG4gICAgICAgIGJyZWFrO1xuICAgIH1cbiAgICByZXR1cm4gcG9zaXRpb247XG4gIH1cblxuICAvKipcbiAgICogQ29tcHV0ZSBzbGljZSBkaXJlY3Rpb24gZGVwZW5kaW5nIG9uIG9yaWVudGF0aW9uLlxuICAgKlxuICAgKiBAcGFyYW0ge251bWJlcn0gb3JpZW50YXRpb24gLSBTbGljZSBvcmllbnRhdGlvbi5cbiAgICpcbiAgICogQHJldHVybnMge1RIUkVFLlZlY3RvcjN9IFNsaWNlIGRpcmVjdGlvblx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MF0sIHdvcmxkLngpLCBNYXRoLm1heChiYm94WzFdLCB3b3JsZC54KSwgLy8geCBtaW4vbWF4XG4gICAgICAgICAgICBNYXRoLm1pbihiYm94WzJdLCB3b3JsZC55KSwgTWF0aC5tYXgoYmJveFszXSwgd29ybGQueSksXG4gICAgICAgICAgICBNYXRoLm1pbihiYm94WzRdLCB3b3JsZC56KSwgTWF0aC5tYXgoYmJveFs1XSwgd29ybGQueilcbiAgICAgICAgICAgIF07XG5cbiAgICAgICAgfVxuXG4gICAgICB9XG5cbiAgICB9XG5cbiAgICByZXR1cm4gYmJveDtcblxuICB9XG5cbiAgQUFCQm94KCkge1xuXG4gICAgbGV0IHdvcmxkMCA9IG5ldyBUSFJFRS5WZWN0b3IzKCkuYWRkU2NhbGFyKCAtMC41IClcbiAgICAgIC5hcHBseU1hdHJpeDQoIHRoaXMuX2lqazJMUFMgKVxuICAgICAgLmFwcGx5TWF0cml4NCggdGhpcy5fbHBzMkFBQkIgKTtcblxuICAgIGxldCB3b3JsZDcgPSB0aGlzLl9kaW1lbnNpb25zSUpLLmNsb25lKCkuYWRkU2NhbGFyKCAtMC41IClcbiAgICAgIC5hcHBseU1hdHJpeDQoIHRoaXMuX2lqazJMUFMgKVxuICAgICAgLmFwcGx5TWF0cml4NCggdGhpcy5fbHBzMkFBQkIgKTtcblxuICAgIGxldCBtaW5CQm94ID0gbmV3IFRIUkVFLlZlY3RvcjMoXG4gICAgICBNYXRoLmFicyggd29ybGQwLnggLSB3b3JsZDcueCApLFxuICAgICAgTWF0aC5hYnMoIHdvcmxkMC55IC0gd29ybGQ3LnkgKSxcbiAgICAgIE1hdGguYWJzKCB3b3JsZDAueiAtIHdvcmxkNy56IClcbiAgICApO1xuXG4gICAgcmV0dXJuIG1pbkJCb3g7XG5cbiAgfVxuXG4gIGNlbnRlckFBQkJveCgpIHtcblxuICAgIGxldCBjZW50ZXJCQm94ID0gdGhpcy53b3JsZENlbnRlcigpO1xuICAgIGNlbnRlckJCb3guYXBw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AgICAgYnJlYWs7XG4gICAgICAgICAgICBjYXNlIDY6XG4gICAgICAgICAgICAgIG5ld0FycmF5W2luZGV4XSA9IHRhcmdldEJ1ZmZlcltpXSA+Pj4gNiAmIDB4MDAwMTtcbiAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICBjYXNlIDc6XG4gICAgICAgICAgICAgIG5ld0FycmF5W2luZGV4XSA9IHRhcmdldEJ1ZmZlcltpXSA+Pj4gNyAmIDB4MDAwMTtcbiAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICB9XG5cbiAgICAgICAgICBiaXRTdGFydE9mZnNldCsrO1xuICAgICAgICAgIGluZGV4Kys7XG4gICAgICAgICAgLy8gaWYgcmV0dXJuLi5cbiAgICAgICAgICBpZiAoaW5kZXggPj0gbnVtUGl4ZWxzKSB7XG4gICAgICAgICAgICByZXR1cm4gbmV3QXJyYXk7XG4gICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIGJpdFN0YXJ0T2Zmc2V0ID0gMDtcblxuICAgICAgfVxuICAgIH1cbiAgfVxuXG4gIF9jb252ZXJ0Q29sb3JTcGFjZSh1bmNvbXByZXNzZWREYXRhKSB7XG4gICAgbGV0IHJnYkRhdGEgPSBudWxsO1xuICAgIGxldCBwaG90b21ldHJpY0ludGVycHJldGF0aW9uID0gdGhpcy5waG90b21ldHJpY0ludGVycHJldGF0aW9uKCk7XG4gICAgbGV0IHBsYW5hckNvbmZpZ3VyYXRpb24gPSB0aGlzLnBsYW5hckNvbmZpZ3VyYXRpb24oKTtcblxuICAgIGlmIChwaG90b21ldHJpY0ludGVycHJldGF0aW9uID09PSAnUkdCJyAmJlxuICAgICAgICBwbGFuYXJDb25maWd1cmF0aW9uID09PSAwKSB7XG4gICAgICAvLyBBTEwgR09PRCwgQUxSRUFEWSBPUkRFUkVEXG4gICAgICAvLyBwbGFuYXIgb3Igbm9uIHBs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9mQ2hhbm5lbHMudmFsdWUgPT09IDEpe1xuXG4gICAgICBzd2l0Y2goIHRoaXMuX2Jhc2UuX3VuaWZvcm1zLnVCaXRzQWxsb2NhdGVkLnZhbHVlICl7XG5cbiAgICAgICAgY2FzZSAxOlxuICAgICAgICBjYXNlIDg6XG4gICAgICAgICAgY29udGVudCA9IHRoaXMudXBhY2s4KCk7XG4gICAgICAgICAgYnJlYWs7XG5cbiAgICAgICAgY2FzZSAxNjpcbiAgICAgICAgICBjb250ZW50ID0gdGhpcy51cGFjazE2KCk7XG4gICAgICAgICAgYnJlYWs7XG5cbiAgICAgICAgY2FzZSAzMjpcbiAgICAgICAgICBjb250ZW50ID0gdGhpcy51cGFjazMyKCk7XG4gICAgICAgICAgYnJlYWs7XG5cbiAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICBjb250ZW50ID0gdGhpcy51cGFja0RlZmF1bHQoKTtcbiAgICAgICAgICBicmVhaztcblxuICAgICAgfVxuICAgIH1cbiAgICBlbHNle1xuXG4gICAgICBjb250ZW50ID0gdGhpcy51cGFja0lkZW50aXR5KCk7XG5cbiAgICB9XG5cbiAgICB0aGlzLl9kZWZpbml0aW9uID0gYFxudm9pZCAke3RoaXMuX25hbWV9KGluIHZlYzQgcGFja2VkRGF0YSwgaW4gaW50IG9mZnNldCwgb3V0IHZlYzQgdW5wYWNrZWREYXRhKXtcblxuJHtjb250ZW50fVxuXG59ICBcbiAgICBgO1xuXG4gIH1cblxuICB1cGFjazgoKXtcblxuICAgIHRoaXMuX2Jhc2UuX2Z1bmN0aW9uc1sndUludDgnXSA9IHRoaXMudUludDgoKTtcblxuICAgIHJldHVybiBgXG51SW50OChcbiAgcGFja2VkRGF0YS5yLFxuICB1bnBhY2tlZERhdGEueCk7XG4gICAgYDtcblxuICB9XG5cbiAgdXBhY2sxNigpe1xuXG4gICAgdGhpcy5fYmFzZS5fZnVuY3Rpb25zWyd1SW50MTYnXSA9IHRoaXMudUludDE2KCk7XG5cbiAgICByZXR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yBjYW4gbm90IGhhdmUgYmVlbiBjb21wdXRlZFxuICAgICAgdGhpcy5tYWluKCk7XG5cbiAgICB9XG5cbiAgICBsZXQgY29udGVudCA9ICcnO1xuICAgIGZvciAoIGxldCBwcm9wZXJ0eSBpbiB0aGlzLl9mdW5jdGlvbnMgKSB7XG4gICAgXG4gICAgICBjb250ZW50ICArPSB0aGlzLl9mdW5jdGlvbnNbcHJvcGVydHldICsgJ1xcbic7XG4gICAgXG4gICAgfVxuICAgIFxuICAgIHJldHVybiBjb250ZW50O1xuXG4gIH1cblxuICB1bmlmb3Jtcygpe1xuXG4gICAgbGV0IGNvbnRlbnQgPSAnJztcbiAgICBmb3IgKCBsZXQgcHJvcGVydHkgaW4gdGhpcy5fdW5pZm9ybXMgKSB7XG4gICAgICBcbiAgICAgIGxldCB1bmlmb3JtID0gdGhpcy5fdW5pZm9ybXNbcHJvcGVydHldO1xuICAgICAgY29udGVudCArPSBgdW5pZm9ybSAke3VuaWZvcm0udHlwZUdMU0x9ICR7cHJvcGVydHl9YDsgXG4gICAgICBcbiAgICAgIGlmKCB1bmlmb3JtICYmIHVuaWZvcm0ubGVuZ3RoICl7XG4gICAgICBcbiAgICAgICAgY29udGVudCArPSBgWyR7dW5pZm9ybS5sZW5ndGh9XWA7XG4gICAgICBcbiAgICAgIH1cbiAgICAgIFxuICAgICAgY29udGVudCArPSAnO1xcbic7XG4gICAgXG4gICAgfVxuICAgIFxuICAgIHJldHVybiBjb250ZW50O1xuXG4gIH1cblxuICBtYWluKCl7XG4gIFxuICAgIC8vIG5lZWQgdG8gcHJlLWNhbGwgbWFpbiB0byBmaWxsIHVwIHRoZSBmdW5jdGlvbnMgbGlzdFxuICAgIHRoaXMuX21haW4gPSBgXG52b2lkIG1haW4odm9pZCkge1xuXG4gIHZlYzIgdGV4YyA9IHZlYzIoKCh2UHJvamVjdGVkQ29vcmRzLnggLyB2UHJvamVjdGVkQ29vcmRzLncpICsgMS4wICkgLyAyLjAsXG4gICAgICAgICAg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RvbVNWRztcbiAgICB0aGlzLnVwZGF0ZSgpO1xuICB9XG5cbiAgZ2V0IHNob3dEb21TVkcoKSB7XG4gICAgcmV0dXJuIHRoaXMuX3Nob3dEb21TVkc7XG4gIH1cblxuICBzZXQgc2hvd0RvbU1lYXN1cmVtZW50cyhzaG93RG9tTWVhc3VyZW1lbnRzKSB7XG4gICAgdGhpcy5fc2hvd0RvbU1lYXN1cmVtZW50cyA9IHNob3dEb21NZWFzdXJlbWVudHM7XG4gICAgdGhpcy51cGRhdGUoKTtcbiAgfVxuXG4gIGdldCBzaG93RG9tTWVhc3VyZW1lbnRzKCkge1xuICAgIHJldHVybiB0aGlzLl9zaG93RG9tTWVhc3VyZW1lbnRzO1xuICB9XG59XG4iXX0= diff --git a/build/ami.min.js b/build/ami.min.js index 47c0260ae..66a2b2e46 100644 --- a/build/ami.min.js +++ b/build/ami.min.js @@ -12,11 +12,11 @@ this.affine=[[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]];this.magic=0;this.extensio totalLen*=sizes[i]}buf8=new Uint8Array(buffer);str=String.fromCharCode.apply(null,buf8);strList=str.split(whitespaceDataValueListSeparatorRE);if(strList.lengthtotalLen){if(strList[0]==="")strList=strList.slice(1);strList=strList.slice(0,totalLen)}switch(type){case"int8":return new Int8Array(strList.map(parseNRRDInteger));case"uint8":return new Uint8Array(strList.map(parseNRRDInteger));case"int16":return new Int16Array(strList.map(parseNRRDInteger));case"uint16":return new Uint16Array(strList.map(parseNRRDInteger));case"int32":return new Int32Array(strList.map(parseNRRDInteger));case"uint32":return new Uint32Array(strList.map(parseNRRDInteger));case"float":return new Float32Array(strList.map(parseNRRDFloat));case"double":return new Float64Array(strList.map(parseNRRDFloat));default:console.warn("Unsupported NRRD type: "+type+".");return undefined}}function getNRRDTypeSize(type){switch(type){case"int8":return 1;case"uint8":return 1;case"int16":return 2;case"uint16":return 2;case"int32":return 4;case"uint32":return 4;case"int64":return 8;case"uint64":return 8;case"float":return 4;case"double":return 8;default:throw new Error("Do not know the size of NRRD type: "+type)}}function checkNRRD(ret){if(ret.dimension===undefined){throw new Error("Dimension missing from NRRD file!")}else if(ret.type===undefined){throw new Error("Type missing from NRRD file!")}else if(ret.encoding===undefined){throw new Error("Encoding missing from NRRD file!")}else if(ret.sizes===undefined){throw new Error("Sizes missing from NRRD file!")}if(ret.type!="block"&&ret.type!="int8"&&ret.type!="uint8"&&ret.encoding!="ascii"&&ret.endian===undefined){throw new Error("Endianness missing from NRRD file!")}else if(ret.type=="block"&&ret.blockSize===undefined){throw new Error("Missing block size in NRRD file!")}if(ret.dimension===0){throw new Error("Zero-dimensional NRRD file?")}else if(ret.dimension!=ret.sizes.length){throw new Error("Length of 'sizes' is different from 'dimension' in an NRRD file!")}else if(ret.spacings&&ret.dimension!=ret.spacings.length){throw new Error("Length of 'spacings' is different from 'dimension' in an NRRD file!")}else if(ret.thicknesses&&ret.dimension!=ret.thicknesses.length){throw new Error("Length of 'thicknesses' is different from 'dimension' in an NRRD file!")}else if(ret.axisMins&&ret.dimension!=ret.axisMins.length){throw new Error("Length of 'axis mins' is different from 'dimension' in an NRRD file!")}else if(ret.axisMaxs&&ret.dimension!=ret.axisMaxs.length){throw new Error("Length of 'axis maxs' is different from 'dimension' in an NRRD file!")}else if(ret.centers&&ret.dimension!=ret.centers.length){throw new Error("Length of 'centers' is different from 'dimension' in an NRRD file!")}else if(ret.labels&&ret.dimension!=ret.labels.length){throw new Error("Length of 'labels' is different from 'dimension' in an NRRD file!")}else if(ret.units&&ret.dimension!=ret.units.length){throw new Error("Length of 'units' is different from 'dimension' in an NRRD file!")}else if(ret.kinds&&ret.dimension!=ret.kinds.length){throw new Error("Length of 'kinds' is different from 'dimension' in an NRRD file!")}if((ret.data===undefined||ret.data.length===0)&&(ret.buffer===undefined||ret.buffer.byteLength===0)&&ret.dataFile===undefined){throw new Error("NRRD file has neither inline or external data!")}}function castTypedArray(data,type){switch(type){case"int8":return new Int8Array(data);case"uint8":return new Uint8Array(data);case"int16":return new Int16Array(data);case"uint16":return new Uint16Array(data);case"int32":return new Int32Array(data);case"uint32":return new Uint32Array(data);case"float":return new Float32Array(data);case"double":return new Float64Array(data);default:throw new Error("Cannot cast to NRRD type: "+type)}}function serializeToBuffer(data,type,endian){var i,endianFlag,view,nativeSize=getNRRDTypeSize(type),buffer=new ArrayBuffer(data.length*nativeSize);switch(endian){case"big":endianFlag=false;break;case"little":endianFlag=true;break;default:console.warn("Unsupported endianness in NRRD file: "+endian);return undefined}view=new DataView(buffer);switch(type){case"int8":for(i=0;i0){opt.windowBits=-opt.windowBits}else if(opt.gzip&&opt.windowBits>0&&opt.windowBits<16){opt.windowBits+=16}this.err=0;this.msg="";this.ended=false;this.chunks=[];this.strm=new ZStream;this.strm.avail_out=0;var status=zlib_deflate.deflateInit2(this.strm,opt.level,opt.method,opt.windowBits,opt.memLevel,opt.strategy);if(status!==Z_OK){throw new Error(msg[status])}if(opt.header){zlib_deflate.deflateSetHeader(this.strm,opt.header)}if(opt.dictionary){var dict;if(typeof opt.dictionary==="string"){dict=strings.string2buf(opt.dictionary)}else if(toString.call(opt.dictionary)==="[object ArrayBuffer]"){dict=new Uint8Array(opt.dictionary)}else{dict=opt.dictionary}status=zlib_deflate.deflateSetDictionary(this.strm,dict);if(status!==Z_OK){throw new Error(msg[status])}this._dict_set=true}}Deflate.prototype.push=function(data,mode){var strm=this.strm;var chunkSize=this.options.chunkSize;var status,_mode;if(this.ended){return false}_mode=mode===~~mode?mode:mode===true?Z_FINISH:Z_NO_FLUSH;if(typeof data==="string"){strm.input=strings.string2buf(data)}else if(toString.call(data)==="[object ArrayBuffer]"){strm.input=new Uint8Array(data)}else{strm.input=data}strm.next_in=0;strm.avail_in=strm.input.length;do{if(strm.avail_out===0){strm.output=new utils.Buf8(chunkSize);strm.next_out=0;strm.avail_out=chunkSize}status=zlib_deflate.deflate(strm,_mode);if(status!==Z_STREAM_END&&status!==Z_OK){this.onEnd(status);this.ended=true;return false}if(strm.avail_out===0||strm.avail_in===0&&(_mode===Z_FINISH||_mode===Z_SYNC_FLUSH)){if(this.options.to==="string"){this.onData(strings.buf2binstring(utils.shrinkBuf(strm.output,strm.next_out)))}else{this.onData(utils.shrinkBuf(strm.output,strm.next_out))}}}while((strm.avail_in>0||strm.avail_out===0)&&status!==Z_STREAM_END);if(_mode===Z_FINISH){status=zlib_deflate.deflateEnd(this.strm);this.onEnd(status);this.ended=true;return status===Z_OK}if(_mode===Z_SYNC_FLUSH){this.onEnd(Z_OK);strm.avail_out=0;return true}return true};Deflate.prototype.onData=function(chunk){this.chunks.push(chunk)};Deflate.prototype.onEnd=function(status){if(status===Z_OK){if(this.options.to==="string"){this.result=this.chunks.join("")}else{this.result=utils.flattenChunks(this.chunks)}}this.chunks=[];this.err=status;this.msg=this.strm.msg};function deflate(input,options){var deflator=new Deflate(options);deflator.push(input,true);if(deflator.err){throw deflator.msg}return deflator.result}function deflateRaw(input,options){options=options||{};options.raw=true;return deflate(input,options)}function gzip(input,options){options=options||{};options.gzip=true;return deflate(input,options)}exports.Deflate=Deflate;exports.deflate=deflate;exports.deflateRaw=deflateRaw;exports.gzip=gzip},{"./utils/common":54,"./utils/strings":55,"./zlib/deflate":59,"./zlib/messages":64,"./zlib/zstream":66}],53:[function(require,module,exports){"use strict";var zlib_inflate=require("./zlib/inflate");var utils=require("./utils/common");var strings=require("./utils/strings");var c=require("./zlib/constants");var msg=require("./zlib/messages");var ZStream=require("./zlib/zstream");var GZheader=require("./zlib/gzheader");var toString=Object.prototype.toString;function Inflate(options){if(!(this instanceof Inflate))return new Inflate(options);this.options=utils.assign({chunkSize:16384,windowBits:0,to:""},options||{});var opt=this.options;if(opt.raw&&opt.windowBits>=0&&opt.windowBits<16){opt.windowBits=-opt.windowBits;if(opt.windowBits===0){opt.windowBits=-15}}if(opt.windowBits>=0&&opt.windowBits<16&&!(options&&options.windowBits)){opt.windowBits+=32}if(opt.windowBits>15&&opt.windowBits<48){if((opt.windowBits&15)===0){opt.windowBits|=15}}this.err=0;this.msg="";this.ended=false;this.chunks=[];this.strm=new ZStream;this.strm.avail_out=0;var status=zlib_inflate.inflateInit2(this.strm,opt.windowBits);if(status!==c.Z_OK){throw new Error(msg[status])}this.header=new GZheader;zlib_inflate.inflateGetHeader(this.strm,this.header)}Inflate.prototype.push=function(data,mode){var strm=this.strm;var chunkSize=this.options.chunkSize;var dictionary=this.options.dictionary;var status,_mode;var next_out_utf8,tail,utf8str;var dict;var allowBufError=false;if(this.ended){return false}_mode=mode===~~mode?mode:mode===true?c.Z_FINISH:c.Z_NO_FLUSH;if(typeof data==="string"){strm.input=strings.binstring2buf(data)}else if(toString.call(data)==="[object ArrayBuffer]"){strm.input=new Uint8Array(data)}else{strm.input=data}strm.next_in=0;strm.avail_in=strm.input.length;do{if(strm.avail_out===0){strm.output=new utils.Buf8(chunkSize);strm.next_out=0;strm.avail_out=chunkSize}status=zlib_inflate.inflate(strm,c.Z_NO_FLUSH);if(status===c.Z_NEED_DICT&&dictionary){if(typeof dictionary==="string"){dict=strings.string2buf(dictionary)}else if(toString.call(dictionary)==="[object ArrayBuffer]"){dict=new Uint8Array(dictionary)}else{dict=dictionary}status=zlib_inflate.inflateSetDictionary(this.strm,dict)}if(status===c.Z_BUF_ERROR&&allowBufError===true){status=c.Z_OK;allowBufError=false}if(status!==c.Z_STREAM_END&&status!==c.Z_OK){this.onEnd(status);this.ended=true;return false}if(strm.next_out){if(strm.avail_out===0||status===c.Z_STREAM_END||strm.avail_in===0&&(_mode===c.Z_FINISH||_mode===c.Z_SYNC_FLUSH)){if(this.options.to==="string"){next_out_utf8=strings.utf8border(strm.output,strm.next_out);tail=strm.next_out-next_out_utf8;utf8str=strings.buf2string(strm.output,next_out_utf8);strm.next_out=tail;strm.avail_out=chunkSize-tail;if(tail){utils.arraySet(strm.output,strm.output,next_out_utf8,tail,0)}this.onData(utf8str)}else{this.onData(utils.shrinkBuf(strm.output,strm.next_out))}}}if(strm.avail_in===0&&strm.avail_out===0){allowBufError=true}}while((strm.avail_in>0||strm.avail_out===0)&&status!==c.Z_STREAM_END);if(status===c.Z_STREAM_END){_mode=c.Z_FINISH}if(_mode===c.Z_FINISH){status=zlib_inflate.inflateEnd(this.strm);this.onEnd(status);this.ended=true;return status===c.Z_OK}if(_mode===c.Z_SYNC_FLUSH){this.onEnd(c.Z_OK);strm.avail_out=0;return true}return true};Inflate.prototype.onData=function(chunk){this.chunks.push(chunk)};Inflate.prototype.onEnd=function(status){if(status===c.Z_OK){if(this.options.to==="string"){this.result=this.chunks.join("")}else{this.result=utils.flattenChunks(this.chunks)}}this.chunks=[];this.err=status;this.msg=this.strm.msg};function inflate(input,options){var inflator=new Inflate(options);inflator.push(input,true);if(inflator.err){throw inflator.msg}return inflator.result}function inflateRaw(input,options){options=options||{};options.raw=true;return inflate(input,options)}exports.Inflate=Inflate;exports.inflate=inflate;exports.inflateRaw=inflateRaw;exports.ungzip=inflate},{"./utils/common":54,"./utils/strings":55,"./zlib/constants":57,"./zlib/gzheader":60,"./zlib/inflate":62,"./zlib/messages":64,"./zlib/zstream":66}],54:[function(require,module,exports){"use strict";var TYPED_OK=typeof Uint8Array!=="undefined"&&typeof Uint16Array!=="undefined"&&typeof Int32Array!=="undefined";exports.assign=function(obj){var sources=Array.prototype.slice.call(arguments,1);while(sources.length){var source=sources.shift();if(!source){continue}if(typeof source!=="object"){throw new TypeError(source+"must be non-object")}for(var p in source){if(source.hasOwnProperty(p)){obj[p]=source[p]}}}return obj};exports.shrinkBuf=function(buf,size){if(buf.length===size){return buf}if(buf.subarray){return buf.subarray(0,size)}buf.length=size;return buf};var fnTyped={arraySet:function(dest,src,src_offs,len,dest_offs){if(src.subarray&&dest.subarray){dest.set(src.subarray(src_offs,src_offs+len),dest_offs);return}for(var i=0;i=252?6:q>=248?5:q>=240?4:q>=224?3:q>=192?2:1}_utf8len[254]=_utf8len[254]=1;exports.string2buf=function(str){var buf,c,c2,m_pos,i,str_len=str.length,buf_len=0;for(m_pos=0;m_pos>>6;buf[i++]=128|c&63}else if(c<65536){buf[i++]=224|c>>>12;buf[i++]=128|c>>>6&63;buf[i++]=128|c&63}else{buf[i++]=240|c>>>18;buf[i++]=128|c>>>12&63;buf[i++]=128|c>>>6&63;buf[i++]=128|c&63}}return buf};function buf2binstring(buf,len){if(len<65537){if(buf.subarray&&STR_APPLY_UIA_OK||!buf.subarray&&STR_APPLY_OK){return String.fromCharCode.apply(null,utils.shrinkBuf(buf,len))}}var result="";for(var i=0;i4){utf16buf[out++]=65533;i+=c_len-1;continue}c&=c_len===2?31:c_len===3?15:7;while(c_len>1&&i1){utf16buf[out++]=65533;continue}if(c<65536){utf16buf[out++]=c}else{c-=65536;utf16buf[out++]=55296|c>>10&1023;utf16buf[out++]=56320|c&1023}}return buf2binstring(utf16buf,out)};exports.utf8border=function(buf,max){var pos;max=max||buf.length;if(max>buf.length){max=buf.length}pos=max-1;while(pos>=0&&(buf[pos]&192)===128){pos--}if(pos<0){return max}if(pos===0){return max}return pos+_utf8len[buf[pos]]>max?pos:max}},{"./common":54}],56:[function(require,module,exports){arguments[4][6][0].apply(exports,arguments)},{dup:6}],57:[function(require,module,exports){"use strict";module.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},{}],58:[function(require,module,exports){"use strict";function makeTable(){var c,table=[];for(var n=0;n<256;n++){c=n;for(var k=0;k<8;k++){c=c&1?3988292384^c>>>1:c>>>1}table[n]=c}return table}var crcTable=makeTable();function crc32(crc,buf,len,pos){var t=crcTable,end=pos+len;crc^=-1;for(var i=pos;i>>8^t[(crc^buf[i])&255]}return crc^-1}module.exports=crc32},{}],59:[function(require,module,exports){"use strict";var utils=require("../utils/common");var trees=require("./trees");var adler32=require("./adler32");var crc32=require("./crc32");var msg=require("./messages");var Z_NO_FLUSH=0;var Z_PARTIAL_FLUSH=1;var Z_FULL_FLUSH=3;var Z_FINISH=4;var Z_BLOCK=5;var Z_OK=0;var Z_STREAM_END=1;var Z_STREAM_ERROR=-2;var Z_DATA_ERROR=-3;var Z_BUF_ERROR=-5;var Z_DEFAULT_COMPRESSION=-1;var Z_FILTERED=1;var Z_HUFFMAN_ONLY=2;var Z_RLE=3;var Z_FIXED=4;var Z_DEFAULT_STRATEGY=0;var Z_UNKNOWN=2;var Z_DEFLATED=8;var MAX_MEM_LEVEL=9;var MAX_WBITS=15;var DEF_MEM_LEVEL=8;var LENGTH_CODES=29;var LITERALS=256;var L_CODES=LITERALS+1+LENGTH_CODES;var D_CODES=30;var BL_CODES=19;var HEAP_SIZE=2*L_CODES+1;var MAX_BITS=15;var MIN_MATCH=3;var MAX_MATCH=258;var MIN_LOOKAHEAD=MAX_MATCH+MIN_MATCH+1;var PRESET_DICT=32;var INIT_STATE=42;var EXTRA_STATE=69;var NAME_STATE=73;var COMMENT_STATE=91;var HCRC_STATE=103;var BUSY_STATE=113;var FINISH_STATE=666;var BS_NEED_MORE=1;var BS_BLOCK_DONE=2;var BS_FINISH_STARTED=3;var BS_FINISH_DONE=4;var OS_CODE=3;function err(strm,errorCode){strm.msg=msg[errorCode];return errorCode}function rank(f){return(f<<1)-(f>4?9:0)}function zero(buf){var len=buf.length;while(--len>=0){buf[len]=0}}function flush_pending(strm){var s=strm.state;var len=s.pending;if(len>strm.avail_out){len=strm.avail_out}if(len===0){return}utils.arraySet(strm.output,s.pending_buf,s.pending_out,len,strm.next_out);strm.next_out+=len;s.pending_out+=len;strm.total_out+=len;strm.avail_out-=len;s.pending-=len;if(s.pending===0){s.pending_out=0}}function flush_block_only(s,last){trees._tr_flush_block(s,s.block_start>=0?s.block_start:-1,s.strstart-s.block_start,last);s.block_start=s.strstart;flush_pending(s.strm)}function put_byte(s,b){s.pending_buf[s.pending++]=b}function putShortMSB(s,b){s.pending_buf[s.pending++]=b>>>8&255;s.pending_buf[s.pending++]=b&255}function read_buf(strm,buf,start,size){var len=strm.avail_in;if(len>size){len=size}if(len===0){return 0}strm.avail_in-=len;utils.arraySet(buf,strm.input,strm.next_in,len,start);if(strm.state.wrap===1){strm.adler=adler32(strm.adler,buf,len,start)}else if(strm.state.wrap===2){strm.adler=crc32(strm.adler,buf,len,start)}strm.next_in+=len;strm.total_in+=len;return len}function longest_match(s,cur_match){var chain_length=s.max_chain_length;var scan=s.strstart;var match;var len;var best_len=s.prev_length;var nice_match=s.nice_match;var limit=s.strstart>s.w_size-MIN_LOOKAHEAD?s.strstart-(s.w_size-MIN_LOOKAHEAD):0;var _win=s.window;var wmask=s.w_mask;var prev=s.prev;var strend=s.strstart+MAX_MATCH;var scan_end1=_win[scan+best_len-1];var scan_end=_win[scan+best_len];if(s.prev_length>=s.good_match){chain_length>>=2}if(nice_match>s.lookahead){nice_match=s.lookahead}do{match=cur_match;if(_win[match+best_len]!==scan_end||_win[match+best_len-1]!==scan_end1||_win[match]!==_win[scan]||_win[++match]!==_win[scan+1]){continue}scan+=2;match++;do{}while(_win[++scan]===_win[++match]&&_win[++scan]===_win[++match]&&_win[++scan]===_win[++match]&&_win[++scan]===_win[++match]&&_win[++scan]===_win[++match]&&_win[++scan]===_win[++match]&&_win[++scan]===_win[++match]&&_win[++scan]===_win[++match]&&scanbest_len){s.match_start=cur_match;best_len=len;if(len>=nice_match){break}scan_end1=_win[scan+best_len-1];scan_end=_win[scan+best_len]}}while((cur_match=prev[cur_match&wmask])>limit&&--chain_length!==0);if(best_len<=s.lookahead){return best_len}return s.lookahead}function fill_window(s){var _w_size=s.w_size;var p,n,m,more,str;do{more=s.window_size-s.lookahead-s.strstart;if(s.strstart>=_w_size+(_w_size-MIN_LOOKAHEAD)){utils.arraySet(s.window,s.window,_w_size,_w_size,0);s.match_start-=_w_size;s.strstart-=_w_size;s.block_start-=_w_size;n=s.hash_size;p=n;do{m=s.head[--p];s.head[p]=m>=_w_size?m-_w_size:0}while(--n);n=_w_size;p=n;do{m=s.prev[--p];s.prev[p]=m>=_w_size?m-_w_size:0}while(--n);more+=_w_size}if(s.strm.avail_in===0){break}n=read_buf(s.strm,s.window,s.strstart+s.lookahead,more);s.lookahead+=n;if(s.lookahead+s.insert>=MIN_MATCH){str=s.strstart-s.insert;s.ins_h=s.window[str];s.ins_h=(s.ins_h<s.pending_buf_size-5){max_block_size=s.pending_buf_size-5}for(;;){if(s.lookahead<=1){fill_window(s);if(s.lookahead===0&&flush===Z_NO_FLUSH){return BS_NEED_MORE}if(s.lookahead===0){break}}s.strstart+=s.lookahead;s.lookahead=0;var max_start=s.block_start+max_block_size;if(s.strstart===0||s.strstart>=max_start){s.lookahead=s.strstart-max_start;s.strstart=max_start;flush_block_only(s,false);if(s.strm.avail_out===0){return BS_NEED_MORE}}if(s.strstart-s.block_start>=s.w_size-MIN_LOOKAHEAD){flush_block_only(s,false);if(s.strm.avail_out===0){return BS_NEED_MORE}}}s.insert=0;if(flush===Z_FINISH){flush_block_only(s,true);if(s.strm.avail_out===0){return BS_FINISH_STARTED}return BS_FINISH_DONE}if(s.strstart>s.block_start){flush_block_only(s,false);if(s.strm.avail_out===0){return BS_NEED_MORE}}return BS_NEED_MORE}function deflate_fast(s,flush){var hash_head;var bflush;for(;;){if(s.lookahead=MIN_MATCH){s.ins_h=(s.ins_h<=MIN_MATCH){bflush=trees._tr_tally(s,s.strstart-s.match_start,s.match_length-MIN_MATCH);s.lookahead-=s.match_length;if(s.match_length<=s.max_lazy_match&&s.lookahead>=MIN_MATCH){s.match_length--;do{s.strstart++;s.ins_h=(s.ins_h<=MIN_MATCH){s.ins_h=(s.ins_h<4096)){s.match_length=MIN_MATCH-1}}if(s.prev_length>=MIN_MATCH&&s.match_length<=s.prev_length){max_insert=s.strstart+s.lookahead-MIN_MATCH;bflush=trees._tr_tally(s,s.strstart-1-s.prev_match,s.prev_length-MIN_MATCH);s.lookahead-=s.prev_length-1;s.prev_length-=2;do{if(++s.strstart<=max_insert){s.ins_h=(s.ins_h<=MIN_MATCH&&s.strstart>0){scan=s.strstart-1;prev=_win[scan];if(prev===_win[++scan]&&prev===_win[++scan]&&prev===_win[++scan]){strend=s.strstart+MAX_MATCH;do{}while(prev===_win[++scan]&&prev===_win[++scan]&&prev===_win[++scan]&&prev===_win[++scan]&&prev===_win[++scan]&&prev===_win[++scan]&&prev===_win[++scan]&&prev===_win[++scan]&&scans.lookahead){s.match_length=s.lookahead}}}if(s.match_length>=MIN_MATCH){bflush=trees._tr_tally(s,1,s.match_length-MIN_MATCH);s.lookahead-=s.match_length;s.strstart+=s.match_length;s.match_length=0}else{bflush=trees._tr_tally(s,0,s.window[s.strstart]);s.lookahead--;s.strstart++}if(bflush){flush_block_only(s,false);if(s.strm.avail_out===0){return BS_NEED_MORE}}}s.insert=0;if(flush===Z_FINISH){flush_block_only(s,true);if(s.strm.avail_out===0){return BS_FINISH_STARTED}return BS_FINISH_DONE}if(s.last_lit){flush_block_only(s,false);if(s.strm.avail_out===0){return BS_NEED_MORE}}return BS_BLOCK_DONE}function deflate_huff(s,flush){var bflush;for(;;){if(s.lookahead===0){fill_window(s);if(s.lookahead===0){if(flush===Z_NO_FLUSH){return BS_NEED_MORE}break}}s.match_length=0;bflush=trees._tr_tally(s,0,s.window[s.strstart]);s.lookahead--;s.strstart++;if(bflush){flush_block_only(s,false);if(s.strm.avail_out===0){return BS_NEED_MORE}}}s.insert=0;if(flush===Z_FINISH){flush_block_only(s,true);if(s.strm.avail_out===0){return BS_FINISH_STARTED}return BS_FINISH_DONE}if(s.last_lit){flush_block_only(s,false);if(s.strm.avail_out===0){return BS_NEED_MORE}}return BS_BLOCK_DONE}function Config(good_length,max_lazy,nice_length,max_chain,func){this.good_length=good_length;this.max_lazy=max_lazy;this.nice_length=nice_length;this.max_chain=max_chain;this.func=func}var configuration_table;configuration_table=[new Config(0,0,0,0,deflate_stored),new Config(4,4,8,4,deflate_fast),new Config(4,5,16,8,deflate_fast),new Config(4,6,32,32,deflate_fast),new Config(4,4,16,16,deflate_slow),new Config(8,16,32,32,deflate_slow),new Config(8,16,128,128,deflate_slow),new Config(8,32,128,256,deflate_slow),new Config(32,128,258,1024,deflate_slow),new Config(32,258,258,4096,deflate_slow)];function lm_init(s){s.window_size=2*s.w_size;zero(s.head);s.max_lazy_match=configuration_table[s.level].max_lazy;s.good_match=configuration_table[s.level].good_length;s.nice_match=configuration_table[s.level].nice_length;s.max_chain_length=configuration_table[s.level].max_chain;s.strstart=0;s.block_start=0;s.lookahead=0;s.insert=0;s.match_length=s.prev_length=MIN_MATCH-1;s.match_available=0;s.ins_h=0}function DeflateState(){this.strm=null;this.status=0;this.pending_buf=null;this.pending_buf_size=0;this.pending_out=0;this.pending=0;this.wrap=0;this.gzhead=null;this.gzindex=0;this.method=Z_DEFLATED;this.last_flush=-1;this.w_size=0;this.w_bits=0;this.w_mask=0;this.window=null;this.window_size=0;this.prev=null;this.head=null;this.ins_h=0;this.hash_size=0;this.hash_bits=0;this.hash_mask=0;this.hash_shift=0;this.block_start=0;this.match_length=0;this.prev_match=0;this.match_available=0;this.strstart=0;this.match_start=0;this.lookahead=0;this.prev_length=0;this.max_chain_length=0;this.max_lazy_match=0;this.level=0;this.strategy=0;this.good_match=0;this.nice_match=0;this.dyn_ltree=new utils.Buf16(HEAP_SIZE*2);this.dyn_dtree=new utils.Buf16((2*D_CODES+1)*2);this.bl_tree=new utils.Buf16((2*BL_CODES+1)*2);zero(this.dyn_ltree);zero(this.dyn_dtree);zero(this.bl_tree);this.l_desc=null;this.d_desc=null;this.bl_desc=null;this.bl_count=new utils.Buf16(MAX_BITS+1);this.heap=new utils.Buf16(2*L_CODES+1);zero(this.heap);this.heap_len=0;this.heap_max=0;this.depth=new utils.Buf16(2*L_CODES+1);zero(this.depth);this.l_buf=0;this.lit_bufsize=0;this.last_lit=0;this.d_buf=0;this.opt_len=0;this.static_len=0;this.matches=0;this.insert=0;this.bi_buf=0;this.bi_valid=0}function deflateResetKeep(strm){var s;if(!strm||!strm.state){return err(strm,Z_STREAM_ERROR)}strm.total_in=strm.total_out=0;strm.data_type=Z_UNKNOWN;s=strm.state;s.pending=0;s.pending_out=0;if(s.wrap<0){s.wrap=-s.wrap}s.status=s.wrap?INIT_STATE:BUSY_STATE;strm.adler=s.wrap===2?0:1;s.last_flush=Z_NO_FLUSH;trees._tr_init(s);return Z_OK}function deflateReset(strm){var ret=deflateResetKeep(strm);if(ret===Z_OK){lm_init(strm.state)}return ret}function deflateSetHeader(strm,head){if(!strm||!strm.state){return Z_STREAM_ERROR}if(strm.state.wrap!==2){return Z_STREAM_ERROR}strm.state.gzhead=head;return Z_OK}function deflateInit2(strm,level,method,windowBits,memLevel,strategy){if(!strm){return Z_STREAM_ERROR}var wrap=1;if(level===Z_DEFAULT_COMPRESSION){level=6}if(windowBits<0){wrap=0;windowBits=-windowBits}else if(windowBits>15){wrap=2;windowBits-=16}if(memLevel<1||memLevel>MAX_MEM_LEVEL||method!==Z_DEFLATED||windowBits<8||windowBits>15||level<0||level>9||strategy<0||strategy>Z_FIXED){ return err(strm,Z_STREAM_ERROR)}if(windowBits===8){windowBits=9}var s=new DeflateState;strm.state=s;s.strm=strm;s.wrap=wrap;s.gzhead=null;s.w_bits=windowBits;s.w_size=1<>1;s.l_buf=(1+2)*s.lit_bufsize;s.level=level;s.strategy=strategy;s.method=method;return deflateReset(strm)}function deflateInit(strm,level){return deflateInit2(strm,level,Z_DEFLATED,MAX_WBITS,DEF_MEM_LEVEL,Z_DEFAULT_STRATEGY)}function deflate(strm,flush){var old_flush,s;var beg,val;if(!strm||!strm.state||flush>Z_BLOCK||flush<0){return strm?err(strm,Z_STREAM_ERROR):Z_STREAM_ERROR}s=strm.state;if(!strm.output||!strm.input&&strm.avail_in!==0||s.status===FINISH_STATE&&flush!==Z_FINISH){return err(strm,strm.avail_out===0?Z_BUF_ERROR:Z_STREAM_ERROR)}s.strm=strm;old_flush=s.last_flush;s.last_flush=flush;if(s.status===INIT_STATE){if(s.wrap===2){strm.adler=0;put_byte(s,31);put_byte(s,139);put_byte(s,8);if(!s.gzhead){put_byte(s,0);put_byte(s,0);put_byte(s,0);put_byte(s,0);put_byte(s,0);put_byte(s,s.level===9?2:s.strategy>=Z_HUFFMAN_ONLY||s.level<2?4:0);put_byte(s,OS_CODE);s.status=BUSY_STATE}else{put_byte(s,(s.gzhead.text?1:0)+(s.gzhead.hcrc?2:0)+(!s.gzhead.extra?0:4)+(!s.gzhead.name?0:8)+(!s.gzhead.comment?0:16));put_byte(s,s.gzhead.time&255);put_byte(s,s.gzhead.time>>8&255);put_byte(s,s.gzhead.time>>16&255);put_byte(s,s.gzhead.time>>24&255);put_byte(s,s.level===9?2:s.strategy>=Z_HUFFMAN_ONLY||s.level<2?4:0);put_byte(s,s.gzhead.os&255);if(s.gzhead.extra&&s.gzhead.extra.length){put_byte(s,s.gzhead.extra.length&255);put_byte(s,s.gzhead.extra.length>>8&255)}if(s.gzhead.hcrc){strm.adler=crc32(strm.adler,s.pending_buf,s.pending,0)}s.gzindex=0;s.status=EXTRA_STATE}}else{var header=Z_DEFLATED+(s.w_bits-8<<4)<<8;var level_flags=-1;if(s.strategy>=Z_HUFFMAN_ONLY||s.level<2){level_flags=0}else if(s.level<6){level_flags=1}else if(s.level===6){level_flags=2}else{level_flags=3}header|=level_flags<<6;if(s.strstart!==0){header|=PRESET_DICT}header+=31-header%31;s.status=BUSY_STATE;putShortMSB(s,header);if(s.strstart!==0){putShortMSB(s,strm.adler>>>16);putShortMSB(s,strm.adler&65535)}strm.adler=1}}if(s.status===EXTRA_STATE){if(s.gzhead.extra){beg=s.pending;while(s.gzindex<(s.gzhead.extra.length&65535)){if(s.pending===s.pending_buf_size){if(s.gzhead.hcrc&&s.pending>beg){strm.adler=crc32(strm.adler,s.pending_buf,s.pending-beg,beg)}flush_pending(strm);beg=s.pending;if(s.pending===s.pending_buf_size){break}}put_byte(s,s.gzhead.extra[s.gzindex]&255);s.gzindex++}if(s.gzhead.hcrc&&s.pending>beg){strm.adler=crc32(strm.adler,s.pending_buf,s.pending-beg,beg)}if(s.gzindex===s.gzhead.extra.length){s.gzindex=0;s.status=NAME_STATE}}else{s.status=NAME_STATE}}if(s.status===NAME_STATE){if(s.gzhead.name){beg=s.pending;do{if(s.pending===s.pending_buf_size){if(s.gzhead.hcrc&&s.pending>beg){strm.adler=crc32(strm.adler,s.pending_buf,s.pending-beg,beg)}flush_pending(strm);beg=s.pending;if(s.pending===s.pending_buf_size){val=1;break}}if(s.gzindexbeg){strm.adler=crc32(strm.adler,s.pending_buf,s.pending-beg,beg)}if(val===0){s.gzindex=0;s.status=COMMENT_STATE}}else{s.status=COMMENT_STATE}}if(s.status===COMMENT_STATE){if(s.gzhead.comment){beg=s.pending;do{if(s.pending===s.pending_buf_size){if(s.gzhead.hcrc&&s.pending>beg){strm.adler=crc32(strm.adler,s.pending_buf,s.pending-beg,beg)}flush_pending(strm);beg=s.pending;if(s.pending===s.pending_buf_size){val=1;break}}if(s.gzindexbeg){strm.adler=crc32(strm.adler,s.pending_buf,s.pending-beg,beg)}if(val===0){s.status=HCRC_STATE}}else{s.status=HCRC_STATE}}if(s.status===HCRC_STATE){if(s.gzhead.hcrc){if(s.pending+2>s.pending_buf_size){flush_pending(strm)}if(s.pending+2<=s.pending_buf_size){put_byte(s,strm.adler&255);put_byte(s,strm.adler>>8&255);strm.adler=0;s.status=BUSY_STATE}}else{s.status=BUSY_STATE}}if(s.pending!==0){flush_pending(strm);if(strm.avail_out===0){s.last_flush=-1;return Z_OK}}else if(strm.avail_in===0&&rank(flush)<=rank(old_flush)&&flush!==Z_FINISH){return err(strm,Z_BUF_ERROR)}if(s.status===FINISH_STATE&&strm.avail_in!==0){return err(strm,Z_BUF_ERROR)}if(strm.avail_in!==0||s.lookahead!==0||flush!==Z_NO_FLUSH&&s.status!==FINISH_STATE){var bstate=s.strategy===Z_HUFFMAN_ONLY?deflate_huff(s,flush):s.strategy===Z_RLE?deflate_rle(s,flush):configuration_table[s.level].func(s,flush);if(bstate===BS_FINISH_STARTED||bstate===BS_FINISH_DONE){s.status=FINISH_STATE}if(bstate===BS_NEED_MORE||bstate===BS_FINISH_STARTED){if(strm.avail_out===0){s.last_flush=-1}return Z_OK}if(bstate===BS_BLOCK_DONE){if(flush===Z_PARTIAL_FLUSH){trees._tr_align(s)}else if(flush!==Z_BLOCK){trees._tr_stored_block(s,0,0,false);if(flush===Z_FULL_FLUSH){zero(s.head);if(s.lookahead===0){s.strstart=0;s.block_start=0;s.insert=0}}}flush_pending(strm);if(strm.avail_out===0){s.last_flush=-1;return Z_OK}}}if(flush!==Z_FINISH){return Z_OK}if(s.wrap<=0){return Z_STREAM_END}if(s.wrap===2){put_byte(s,strm.adler&255);put_byte(s,strm.adler>>8&255);put_byte(s,strm.adler>>16&255);put_byte(s,strm.adler>>24&255);put_byte(s,strm.total_in&255);put_byte(s,strm.total_in>>8&255);put_byte(s,strm.total_in>>16&255);put_byte(s,strm.total_in>>24&255)}else{putShortMSB(s,strm.adler>>>16);putShortMSB(s,strm.adler&65535)}flush_pending(strm);if(s.wrap>0){s.wrap=-s.wrap}return s.pending!==0?Z_OK:Z_STREAM_END}function deflateEnd(strm){var status;if(!strm||!strm.state){return Z_STREAM_ERROR}status=strm.state.status;if(status!==INIT_STATE&&status!==EXTRA_STATE&&status!==NAME_STATE&&status!==COMMENT_STATE&&status!==HCRC_STATE&&status!==BUSY_STATE&&status!==FINISH_STATE){return err(strm,Z_STREAM_ERROR)}strm.state=null;return status===BUSY_STATE?err(strm,Z_DATA_ERROR):Z_OK}function deflateSetDictionary(strm,dictionary){var dictLength=dictionary.length;var s;var str,n;var wrap;var avail;var next;var input;var tmpDict;if(!strm||!strm.state){return Z_STREAM_ERROR}s=strm.state;wrap=s.wrap;if(wrap===2||wrap===1&&s.status!==INIT_STATE||s.lookahead){return Z_STREAM_ERROR}if(wrap===1){strm.adler=adler32(strm.adler,dictionary,dictLength,0)}s.wrap=0;if(dictLength>=s.w_size){if(wrap===0){zero(s.head);s.strstart=0;s.block_start=0;s.insert=0}tmpDict=new utils.Buf8(s.w_size);utils.arraySet(tmpDict,dictionary,dictLength-s.w_size,s.w_size,0);dictionary=tmpDict;dictLength=s.w_size}avail=strm.avail_in;next=strm.next_in;input=strm.input;strm.avail_in=dictLength;strm.next_in=0;strm.input=dictionary;fill_window(s);while(s.lookahead>=MIN_MATCH){str=s.strstart;n=s.lookahead-(MIN_MATCH-1);do{s.ins_h=(s.ins_h<>>24&255)+(q>>>8&65280)+((q&65280)<<8)+((q&255)<<24)}function InflateState(){this.mode=0;this.last=false;this.wrap=0;this.havedict=false;this.flags=0;this.dmax=0;this.check=0;this.total=0;this.head=null;this.wbits=0;this.wsize=0;this.whave=0;this.wnext=0;this.window=null;this.hold=0;this.bits=0;this.length=0;this.offset=0;this.extra=0;this.lencode=null;this.distcode=null;this.lenbits=0;this.distbits=0;this.ncode=0;this.nlen=0;this.ndist=0;this.have=0;this.next=null;this.lens=new utils.Buf16(320);this.work=new utils.Buf16(288);this.lendyn=null;this.distdyn=null;this.sane=0;this.back=0;this.was=0}function inflateResetKeep(strm){var state;if(!strm||!strm.state){return Z_STREAM_ERROR}state=strm.state;strm.total_in=strm.total_out=state.total=0;strm.msg="";if(state.wrap){strm.adler=state.wrap&1}state.mode=HEAD;state.last=0;state.havedict=0;state.dmax=32768;state.head=null;state.hold=0;state.bits=0;state.lencode=state.lendyn=new utils.Buf32(ENOUGH_LENS);state.distcode=state.distdyn=new utils.Buf32(ENOUGH_DISTS);state.sane=1;state.back=-1;return Z_OK}function inflateReset(strm){var state;if(!strm||!strm.state){return Z_STREAM_ERROR}state=strm.state;state.wsize=0;state.whave=0;state.wnext=0;return inflateResetKeep(strm)}function inflateReset2(strm,windowBits){var wrap;var state;if(!strm||!strm.state){return Z_STREAM_ERROR}state=strm.state;if(windowBits<0){wrap=0;windowBits=-windowBits}else{wrap=(windowBits>>4)+1;if(windowBits<48){windowBits&=15}}if(windowBits&&(windowBits<8||windowBits>15)){return Z_STREAM_ERROR}if(state.window!==null&&state.wbits!==windowBits){state.window=null}state.wrap=wrap;state.wbits=windowBits;return inflateReset(strm)}function inflateInit2(strm,windowBits){var ret;var state;if(!strm){return Z_STREAM_ERROR}state=new InflateState;strm.state=state;state.window=null;ret=inflateReset2(strm,windowBits);if(ret!==Z_OK){strm.state=null}return ret}function inflateInit(strm){return inflateInit2(strm,DEF_WBITS)}var virgin=true;var lenfix,distfix;function fixedtables(state){if(virgin){var sym;lenfix=new utils.Buf32(512);distfix=new utils.Buf32(32);sym=0;while(sym<144){state.lens[sym++]=8}while(sym<256){state.lens[sym++]=9}while(sym<280){state.lens[sym++]=7}while(sym<288){state.lens[sym++]=8}inflate_table(LENS,state.lens,0,288,lenfix,0,state.work,{bits:9});sym=0;while(sym<32){state.lens[sym++]=5}inflate_table(DISTS,state.lens,0,32,distfix,0,state.work,{bits:5});virgin=false}state.lencode=lenfix;state.lenbits=9;state.distcode=distfix;state.distbits=5}function updatewindow(strm,src,end,copy){var dist;var state=strm.state;if(state.window===null){state.wsize=1<=state.wsize){utils.arraySet(state.window,src,end-state.wsize,state.wsize,0);state.wnext=0;state.whave=state.wsize}else{dist=state.wsize-state.wnext;if(dist>copy){dist=copy}utils.arraySet(state.window,src,end-copy,dist,state.wnext);copy-=dist;if(copy){utils.arraySet(state.window,src,end-copy,copy,0);state.wnext=copy;state.whave=state.wsize}else{state.wnext+=dist;if(state.wnext===state.wsize){state.wnext=0}if(state.whave>>8&255;state.check=crc32(state.check,hbuf,2,0);hold=0;bits=0;state.mode=FLAGS;break}state.flags=0;if(state.head){state.head.done=false}if(!(state.wrap&1)||(((hold&255)<<8)+(hold>>8))%31){strm.msg="incorrect header check";state.mode=BAD;break}if((hold&15)!==Z_DEFLATED){strm.msg="unknown compression method";state.mode=BAD;break}hold>>>=4;bits-=4;len=(hold&15)+8;if(state.wbits===0){state.wbits=len}else if(len>state.wbits){strm.msg="invalid window size";state.mode=BAD;break}state.dmax=1<>8&1}if(state.flags&512){hbuf[0]=hold&255;hbuf[1]=hold>>>8&255;state.check=crc32(state.check,hbuf,2,0)}hold=0;bits=0;state.mode=TIME;case TIME:while(bits<32){if(have===0){break inf_leave}have--;hold+=input[next++]<>>8&255;hbuf[2]=hold>>>16&255;hbuf[3]=hold>>>24&255;state.check=crc32(state.check,hbuf,4,0)}hold=0;bits=0;state.mode=OS;case OS:while(bits<16){if(have===0){break inf_leave}have--;hold+=input[next++]<>8}if(state.flags&512){hbuf[0]=hold&255;hbuf[1]=hold>>>8&255;state.check=crc32(state.check,hbuf,2,0)}hold=0;bits=0;state.mode=EXLEN;case EXLEN:if(state.flags&1024){while(bits<16){if(have===0){break inf_leave}have--;hold+=input[next++]<>>8&255;state.check=crc32(state.check,hbuf,2,0)}hold=0;bits=0}else if(state.head){state.head.extra=null}state.mode=EXTRA;case EXTRA:if(state.flags&1024){copy=state.length;if(copy>have){copy=have}if(copy){if(state.head){len=state.head.extra_len-state.length;if(!state.head.extra){state.head.extra=new Array(state.head.extra_len)}utils.arraySet(state.head.extra,input,next,copy,len)}if(state.flags&512){state.check=crc32(state.check,input,copy,next)}have-=copy;next+=copy;state.length-=copy}if(state.length){break inf_leave}}state.length=0;state.mode=NAME;case NAME:if(state.flags&2048){if(have===0){break inf_leave}copy=0;do{len=input[next+copy++];if(state.head&&len&&state.length<65536){state.head.name+=String.fromCharCode(len)}}while(len&©>9&1;state.head.done=true}strm.adler=state.check=0;state.mode=TYPE;break;case DICTID:while(bits<32){if(have===0){break inf_leave}have--;hold+=input[next++]<>>=bits&7;bits-=bits&7;state.mode=CHECK;break}while(bits<3){if(have===0){break inf_leave}have--;hold+=input[next++]<>>=1;bits-=1;switch(hold&3){case 0:state.mode=STORED;break;case 1:fixedtables(state);state.mode=LEN_;if(flush===Z_TREES){hold>>>=2;bits-=2;break inf_leave}break;case 2:state.mode=TABLE;break;case 3:strm.msg="invalid block type";state.mode=BAD}hold>>>=2;bits-=2;break;case STORED:hold>>>=bits&7;bits-=bits&7;while(bits<32){if(have===0){break inf_leave}have--;hold+=input[next++]<>>16^65535)){strm.msg="invalid stored block lengths";state.mode=BAD;break}state.length=hold&65535;hold=0;bits=0;state.mode=COPY_;if(flush===Z_TREES){break inf_leave}case COPY_:state.mode=COPY;case COPY:copy=state.length;if(copy){if(copy>have){copy=have}if(copy>left){copy=left}if(copy===0){break inf_leave}utils.arraySet(output,input,next,copy,put);have-=copy;next+=copy;left-=copy;put+=copy;state.length-=copy;break}state.mode=TYPE;break;case TABLE:while(bits<14){if(have===0){break inf_leave}have--;hold+=input[next++]<>>=5;bits-=5;state.ndist=(hold&31)+1;hold>>>=5;bits-=5;state.ncode=(hold&15)+4;hold>>>=4;bits-=4;if(state.nlen>286||state.ndist>30){strm.msg="too many length or distance symbols";state.mode=BAD;break}state.have=0;state.mode=LENLENS;case LENLENS:while(state.have>>=3;bits-=3}while(state.have<19){state.lens[order[state.have++]]=0}state.lencode=state.lendyn;state.lenbits=7;opts={bits:state.lenbits};ret=inflate_table(CODES,state.lens,0,19,state.lencode,0,state.work,opts);state.lenbits=opts.bits;if(ret){strm.msg="invalid code lengths set";state.mode=BAD;break}state.have=0;state.mode=CODELENS;case CODELENS:while(state.have>>24;here_op=here>>>16&255;here_val=here&65535;if(here_bits<=bits){break}if(have===0){break inf_leave}have--;hold+=input[next++]<>>=here_bits;bits-=here_bits;state.lens[state.have++]=here_val}else{if(here_val===16){n=here_bits+2;while(bits>>=here_bits;bits-=here_bits;if(state.have===0){strm.msg="invalid bit length repeat";state.mode=BAD;break}len=state.lens[state.have-1];copy=3+(hold&3);hold>>>=2;bits-=2}else if(here_val===17){n=here_bits+3;while(bits>>=here_bits;bits-=here_bits;len=0;copy=3+(hold&7);hold>>>=3;bits-=3}else{n=here_bits+7;while(bits>>=here_bits;bits-=here_bits;len=0;copy=11+(hold&127);hold>>>=7;bits-=7}if(state.have+copy>state.nlen+state.ndist){strm.msg="invalid bit length repeat";state.mode=BAD;break}while(copy--){state.lens[state.have++]=len}}}if(state.mode===BAD){break}if(state.lens[256]===0){strm.msg="invalid code -- missing end-of-block";state.mode=BAD;break}state.lenbits=9;opts={bits:state.lenbits};ret=inflate_table(LENS,state.lens,0,state.nlen,state.lencode,0,state.work,opts);state.lenbits=opts.bits;if(ret){strm.msg="invalid literal/lengths set";state.mode=BAD;break}state.distbits=6;state.distcode=state.distdyn;opts={bits:state.distbits};ret=inflate_table(DISTS,state.lens,state.nlen,state.ndist,state.distcode,0,state.work,opts);state.distbits=opts.bits;if(ret){strm.msg="invalid distances set";state.mode=BAD;break}state.mode=LEN_;if(flush===Z_TREES){break inf_leave}case LEN_:state.mode=LEN;case LEN:if(have>=6&&left>=258){strm.next_out=put;strm.avail_out=left;strm.next_in=next;strm.avail_in=have;state.hold=hold;state.bits=bits;inflate_fast(strm,_out);put=strm.next_out;output=strm.output;left=strm.avail_out;next=strm.next_in;input=strm.input;have=strm.avail_in;hold=state.hold;bits=state.bits;if(state.mode===TYPE){state.back=-1}break}state.back=0;for(;;){here=state.lencode[hold&(1<>>24;here_op=here>>>16&255;here_val=here&65535;if(here_bits<=bits){break}if(have===0){break inf_leave}have--;hold+=input[next++]<>last_bits)];here_bits=here>>>24;here_op=here>>>16&255;here_val=here&65535;if(last_bits+here_bits<=bits){break}if(have===0){break inf_leave}have--;hold+=input[next++]<>>=last_bits;bits-=last_bits;state.back+=last_bits}hold>>>=here_bits;bits-=here_bits;state.back+=here_bits;state.length=here_val;if(here_op===0){state.mode=LIT;break}if(here_op&32){state.back=-1;state.mode=TYPE;break}if(here_op&64){strm.msg="invalid literal/length code";state.mode=BAD;break}state.extra=here_op&15;state.mode=LENEXT;case LENEXT:if(state.extra){n=state.extra;while(bits>>=state.extra;bits-=state.extra;state.back+=state.extra}state.was=state.length;state.mode=DIST;case DIST:for(;;){here=state.distcode[hold&(1<>>24;here_op=here>>>16&255;here_val=here&65535;if(here_bits<=bits){break}if(have===0){break inf_leave}have--;hold+=input[next++]<>last_bits)];here_bits=here>>>24;here_op=here>>>16&255;here_val=here&65535;if(last_bits+here_bits<=bits){break}if(have===0){break inf_leave}have--;hold+=input[next++]<>>=last_bits;bits-=last_bits;state.back+=last_bits}hold>>>=here_bits;bits-=here_bits;state.back+=here_bits;if(here_op&64){strm.msg="invalid distance code";state.mode=BAD;break}state.offset=here_val;state.extra=here_op&15;state.mode=DISTEXT;case DISTEXT:if(state.extra){n=state.extra;while(bits>>=state.extra;bits-=state.extra;state.back+=state.extra}if(state.offset>state.dmax){strm.msg="invalid distance too far back";state.mode=BAD;break}state.mode=MATCH;case MATCH:if(left===0){break inf_leave}copy=_out-left;if(state.offset>copy){copy=state.offset-copy;if(copy>state.whave){if(state.sane){strm.msg="invalid distance too far back";state.mode=BAD;break}}if(copy>state.wnext){copy-=state.wnext;from=state.wsize-copy}else{from=state.wnext-copy}if(copy>state.length){copy=state.length}from_source=state.window}else{from_source=output;from=put-state.offset;copy=state.length}if(copy>left){copy=left}left-=copy;state.length-=copy;do{output[put++]=from_source[from++]}while(--copy);if(state.length===0){state.mode=LEN}break;case LIT:if(left===0){break inf_leave}output[put++]=state.length;left--;state.mode=LEN;break;case CHECK:if(state.wrap){while(bits<32){if(have===0){break inf_leave}have--;hold|=input[next++]<=1;max--){if(count[max]!==0){break}}if(root>max){root=max}if(max===0){table[table_index++]=1<<24|64<<16|0;table[table_index++]=1<<24|64<<16|0;opts.bits=1;return 0}for(min=1;min0&&(type===CODES||max!==1)){return-1}offs[1]=0;for(len=1;lenENOUGH_LENS||type===DISTS&&used>ENOUGH_DISTS){return 1}var i=0;for(;;){i++;here_bits=len-drop;if(work[sym]end){here_op=extra[extra_index+work[sym]];here_val=base[base_index+work[sym]]}else{here_op=32+64;here_val=0}incr=1<>drop)+fill]=here_bits<<24|here_op<<16|here_val|0}while(fill!==0);incr=1<>=1}if(incr!==0){huff&=incr-1;huff+=incr}else{huff=0}sym++;if(--count[len]===0){if(len===max){break}len=lens[lens_index+work[sym]]}if(len>root&&(huff&mask)!==low){if(drop===0){drop=root}next+=min;curr=len-drop;left=1<ENOUGH_LENS||type===DISTS&&used>ENOUGH_DISTS){return 1}low=huff&mask;table[low]=root<<24|curr<<16|next-table_index|0}}if(huff!==0){table[next+huff]=len-drop<<24|64<<16|0}opts.bits=root;return 0}},{"../utils/common":54}],64:[function(require,module,exports){"use strict";module.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},{}],65:[function(require,module,exports){"use strict";var utils=require("../utils/common");var Z_FIXED=4;var Z_BINARY=0;var Z_TEXT=1;var Z_UNKNOWN=2;function zero(buf){var len=buf.length;while(--len>=0){buf[len]=0}}var STORED_BLOCK=0;var STATIC_TREES=1;var DYN_TREES=2;var MIN_MATCH=3;var MAX_MATCH=258;var LENGTH_CODES=29;var LITERALS=256;var L_CODES=LITERALS+1+LENGTH_CODES;var D_CODES=30;var BL_CODES=19;var HEAP_SIZE=2*L_CODES+1;var MAX_BITS=15;var Buf_size=16;var MAX_BL_BITS=7;var END_BLOCK=256;var REP_3_6=16;var REPZ_3_10=17;var REPZ_11_138=18;var extra_lbits=[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];var extra_dbits=[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];var extra_blbits=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7];var bl_order=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];var DIST_CODE_LEN=512;var static_ltree=new Array((L_CODES+2)*2);zero(static_ltree);var static_dtree=new Array(D_CODES*2);zero(static_dtree);var _dist_code=new Array(DIST_CODE_LEN);zero(_dist_code);var _length_code=new Array(MAX_MATCH-MIN_MATCH+1);zero(_length_code);var base_length=new Array(LENGTH_CODES);zero(base_length);var base_dist=new Array(D_CODES);zero(base_dist);function StaticTreeDesc(static_tree,extra_bits,extra_base,elems,max_length){this.static_tree=static_tree;this.extra_bits=extra_bits;this.extra_base=extra_base;this.elems=elems;this.max_length=max_length;this.has_stree=static_tree&&static_tree.length}var static_l_desc;var static_d_desc;var static_bl_desc;function TreeDesc(dyn_tree,stat_desc){this.dyn_tree=dyn_tree;this.max_code=0;this.stat_desc=stat_desc}function d_code(dist){return dist<256?_dist_code[dist]:_dist_code[256+(dist>>>7)]; }function put_short(s,w){s.pending_buf[s.pending++]=w&255;s.pending_buf[s.pending++]=w>>>8&255}function send_bits(s,value,length){if(s.bi_valid>Buf_size-length){s.bi_buf|=value<>Buf_size-s.bi_valid;s.bi_valid+=length-Buf_size}else{s.bi_buf|=value<>>=1;res<<=1}while(--len>0);return res>>>1}function bi_flush(s){if(s.bi_valid===16){put_short(s,s.bi_buf);s.bi_buf=0;s.bi_valid=0}else if(s.bi_valid>=8){s.pending_buf[s.pending++]=s.bi_buf&255;s.bi_buf>>=8;s.bi_valid-=8}}function gen_bitlen(s,desc){var tree=desc.dyn_tree;var max_code=desc.max_code;var stree=desc.stat_desc.static_tree;var has_stree=desc.stat_desc.has_stree;var extra=desc.stat_desc.extra_bits;var base=desc.stat_desc.extra_base;var max_length=desc.stat_desc.max_length;var h;var n,m;var bits;var xbits;var f;var overflow=0;for(bits=0;bits<=MAX_BITS;bits++){s.bl_count[bits]=0}tree[s.heap[s.heap_max]*2+1]=0;for(h=s.heap_max+1;hmax_length){bits=max_length;overflow++}tree[n*2+1]=bits;if(n>max_code){continue}s.bl_count[bits]++;xbits=0;if(n>=base){xbits=extra[n-base]}f=tree[n*2];s.opt_len+=f*(bits+xbits);if(has_stree){s.static_len+=f*(stree[n*2+1]+xbits)}}if(overflow===0){return}do{bits=max_length-1;while(s.bl_count[bits]===0){bits--}s.bl_count[bits]--;s.bl_count[bits+1]+=2;s.bl_count[max_length]--;overflow-=2}while(overflow>0);for(bits=max_length;bits!==0;bits--){n=s.bl_count[bits];while(n!==0){m=s.heap[--h];if(m>max_code){continue}if(tree[m*2+1]!==bits){s.opt_len+=(bits-tree[m*2+1])*tree[m*2];tree[m*2+1]=bits}n--}}}function gen_codes(tree,max_code,bl_count){var next_code=new Array(MAX_BITS+1);var code=0;var bits;var n;for(bits=1;bits<=MAX_BITS;bits++){next_code[bits]=code=code+bl_count[bits-1]<<1}for(n=0;n<=max_code;n++){var len=tree[n*2+1];if(len===0){continue}tree[n*2]=bi_reverse(next_code[len]++,len)}}function tr_static_init(){var n;var bits;var length;var code;var dist;var bl_count=new Array(MAX_BITS+1);length=0;for(code=0;code>=7;for(;code8){put_short(s,s.bi_buf)}else if(s.bi_valid>0){s.pending_buf[s.pending++]=s.bi_buf}s.bi_buf=0;s.bi_valid=0}function copy_block(s,buf,len,header){bi_windup(s);if(header){put_short(s,len);put_short(s,~len)}utils.arraySet(s.pending_buf,s.window,buf,len,s.pending);s.pending+=len}function smaller(tree,n,m,depth){var _n2=n*2;var _m2=m*2;return tree[_n2]>1;n>=1;n--){pqdownheap(s,tree,n)}node=elems;do{n=s.heap[1];s.heap[1]=s.heap[s.heap_len--];pqdownheap(s,tree,1);m=s.heap[1];s.heap[--s.heap_max]=n;s.heap[--s.heap_max]=m;tree[node*2]=tree[n*2]+tree[m*2];s.depth[node]=(s.depth[n]>=s.depth[m]?s.depth[n]:s.depth[m])+1;tree[n*2+1]=tree[m*2+1]=node;s.heap[1]=node++;pqdownheap(s,tree,1)}while(s.heap_len>=2);s.heap[--s.heap_max]=s.heap[1];gen_bitlen(s,desc);gen_codes(tree,max_code,s.bl_count)}function scan_tree(s,tree,max_code){var n;var prevlen=-1;var curlen;var nextlen=tree[0*2+1];var count=0;var max_count=7;var min_count=4;if(nextlen===0){max_count=138;min_count=3}tree[(max_code+1)*2+1]=65535;for(n=0;n<=max_code;n++){curlen=nextlen;nextlen=tree[(n+1)*2+1];if(++count=3;max_blindex--){if(s.bl_tree[bl_order[max_blindex]*2+1]!==0){break}}s.opt_len+=3*(max_blindex+1)+5+5+4;return max_blindex}function send_all_trees(s,lcodes,dcodes,blcodes){var rank;send_bits(s,lcodes-257,5);send_bits(s,dcodes-1,5);send_bits(s,blcodes-4,4);for(rank=0;rank>>=1){if(black_mask&1&&s.dyn_ltree[n*2]!==0){return Z_BINARY}}if(s.dyn_ltree[9*2]!==0||s.dyn_ltree[10*2]!==0||s.dyn_ltree[13*2]!==0){return Z_TEXT}for(n=32;n0){if(s.strm.data_type===Z_UNKNOWN){s.strm.data_type=detect_data_type(s)}build_tree(s,s.l_desc);build_tree(s,s.d_desc);max_blindex=build_bl_tree(s);opt_lenb=s.opt_len+3+7>>>3;static_lenb=s.static_len+3+7>>>3;if(static_lenb<=opt_lenb){opt_lenb=static_lenb}}else{opt_lenb=static_lenb=stored_len+5}if(stored_len+4<=opt_lenb&&buf!==-1){_tr_stored_block(s,buf,stored_len,last)}else if(s.strategy===Z_FIXED||static_lenb===opt_lenb){send_bits(s,(STATIC_TREES<<1)+(last?1:0),3);compress_block(s,static_ltree,static_dtree)}else{send_bits(s,(DYN_TREES<<1)+(last?1:0),3);send_all_trees(s,s.l_desc.max_code+1,s.d_desc.max_code+1,max_blindex+1);compress_block(s,s.dyn_ltree,s.dyn_dtree)}init_block(s);if(last){bi_windup(s)}}function _tr_tally(s,dist,lc){s.pending_buf[s.d_buf+s.last_lit*2]=dist>>>8&255;s.pending_buf[s.d_buf+s.last_lit*2+1]=dist&255;s.pending_buf[s.l_buf+s.last_lit]=lc&255;s.last_lit++;if(dist===0){s.dyn_ltree[lc*2]++}else{s.matches++;dist--;s.dyn_ltree[(_length_code[lc]+LITERALS+1)*2]++;s.dyn_dtree[d_code(dist)*2]++}return s.last_lit===s.lit_bufsize-1}exports._tr_init=_tr_init;exports._tr_stored_block=_tr_stored_block;exports._tr_flush_block=_tr_flush_block;exports._tr_tally=_tr_tally;exports._tr_align=_tr_align},{"../utils/common":54}],66:[function(require,module,exports){arguments[4][15][0].apply(exports,arguments)},{dup:15}],67:[function(require,module,exports){(function(process){"use strict";if(!process.version||process.version.indexOf("v0.")===0||process.version.indexOf("v1.")===0&&process.version.indexOf("v1.8.")!==0){module.exports=nextTick}else{module.exports=process.nextTick}function nextTick(fn,arg1,arg2,arg3){if(typeof fn!=="function"){throw new TypeError('"callback" argument must be a function')}var len=arguments.length;var args,i;switch(len){case 0:case 1:return process.nextTick(fn);case 2:return process.nextTick(function afterTickOne(){fn.call(null,arg1)});case 3:return process.nextTick(function afterTickTwo(){fn.call(null,arg1,arg2)});case 4:return process.nextTick(function afterTickThree(){fn.call(null,arg1,arg2,arg3)});default:args=new Array(len-1);i=0;while(i1){for(var i=1;i0){if(state.ended&&!addToFront){var e=new Error("stream.push() after EOF");stream.emit("error",e)}else if(state.endEmitted&&addToFront){var _e=new Error("stream.unshift() after end event");stream.emit("error",_e)}else{var skipAdd;if(state.decoder&&!addToFront&&!encoding){chunk=state.decoder.write(chunk);skipAdd=!state.objectMode&&chunk.length===0}if(!addToFront)state.reading=false;if(!skipAdd){if(state.flowing&&state.length===0&&!state.sync){stream.emit("data",chunk);stream.read(0)}else{state.length+=state.objectMode?1:chunk.length;if(addToFront)state.buffer.unshift(chunk);else state.buffer.push(chunk);if(state.needReadable)emitReadable(stream)}}maybeReadMore(stream,state)}}else if(!addToFront){state.reading=false}return needMoreData(state)}function needMoreData(state){return!state.ended&&(state.needReadable||state.length=MAX_HWM){n=MAX_HWM}else{n--;n|=n>>>1;n|=n>>>2;n|=n>>>4;n|=n>>>8;n|=n>>>16;n++}return n}function howMuchToRead(n,state){if(state.length===0&&state.ended)return 0;if(state.objectMode)return n===0?0:1;if(n===null||isNaN(n)){if(state.flowing&&state.buffer.length)return state.buffer[0].length;else return state.length}if(n<=0)return 0;if(n>state.highWaterMark)state.highWaterMark=computeNewHighWaterMark(n);if(n>state.length){if(!state.ended){state.needReadable=true;return 0}else{return state.length}}return n}Readable.prototype.read=function(n){debug("read",n);var state=this._readableState;var nOrig=n;if(typeof n!=="number"||n>0)state.emittedReadable=false;if(n===0&&state.needReadable&&(state.length>=state.highWaterMark||state.ended)){debug("read: emitReadable",state.length,state.ended);if(state.length===0&&state.ended)endReadable(this);else emitReadable(this);return null}n=howMuchToRead(n,state);if(n===0&&state.ended){if(state.length===0)endReadable(this);return null}var doRead=state.needReadable;debug("need readable",doRead);if(state.length===0||state.length-n0)ret=fromList(n,state);else ret=null;if(ret===null){state.needReadable=true;n=0}state.length-=n;if(state.length===0&&!state.ended)state.needReadable=true;if(nOrig!==n&&state.ended&&state.length===0)endReadable(this);if(ret!==null)this.emit("data",ret);return ret};function chunkInvalid(state,chunk){var er=null;if(!Buffer.isBuffer(chunk)&&typeof chunk!=="string"&&chunk!==null&&chunk!==undefined&&!state.objectMode){er=new TypeError("Invalid non-string/buffer chunk")}return er}function onEofChunk(stream,state){if(state.ended)return;if(state.decoder){var chunk=state.decoder.end();if(chunk&&chunk.length){state.buffer.push(chunk);state.length+=state.objectMode?1:chunk.length}}state.ended=true;emitReadable(stream)}function emitReadable(stream){var state=stream._readableState;state.needReadable=false;if(!state.emittedReadable){debug("emitReadable",state.flowing);state.emittedReadable=true;if(state.sync)processNextTick(emitReadable_,stream);else emitReadable_(stream)}}function emitReadable_(stream){debug("emit readable");stream.emit("readable");flow(stream)}function maybeReadMore(stream,state){if(!state.readingMore){state.readingMore=true;processNextTick(maybeReadMore_,stream,state)}}function maybeReadMore_(stream,state){var len=state.length;while(!state.reading&&!state.flowing&&!state.ended&&state.length1&&indexOf(state.pipes,dest)!==-1)&&!cleanedUp){debug("false write response, pause",src._readableState.awaitDrain);src._readableState.awaitDrain++}src.pause()}}function onerror(er){debug("onerror",er);unpipe();dest.removeListener("error",onerror);if(EElistenerCount(dest,"error")===0)dest.emit("error",er)}prependListener(dest,"error",onerror);function onclose(){dest.removeListener("finish",onfinish);unpipe()}dest.once("close",onclose);function onfinish(){debug("onfinish");dest.removeListener("close",onclose);unpipe()}dest.once("finish",onfinish);function unpipe(){debug("unpipe");src.unpipe(dest)}dest.emit("pipe",src);if(!state.flowing){debug("pipe resume");src.resume()}return dest};function pipeOnDrain(src){return function(){var state=src._readableState;debug("pipeOnDrain",state.awaitDrain);if(state.awaitDrain)state.awaitDrain--;if(state.awaitDrain===0&&EElistenerCount(src,"data")){state.flowing=true;flow(src)}}}Readable.prototype.unpipe=function(dest){var state=this._readableState;if(state.pipesCount===0)return this;if(state.pipesCount===1){if(dest&&dest!==state.pipes)return this;if(!dest)dest=state.pipes;state.pipes=null;state.pipesCount=0;state.flowing=false;if(dest)dest.emit("unpipe",this);return this}if(!dest){var dests=state.pipes;var len=state.pipesCount;state.pipes=null;state.pipesCount=0;state.flowing=false;for(var _i=0;_i=length){if(stringMode)ret=list.join("");else if(list.length===1)ret=list[0];else ret=Buffer.concat(list,length);list.length=0}else{if(n0)throw new Error('"endReadable()" called on non-empty stream');if(!state.endEmitted){state.ended=true;processNextTick(endReadableNT,state,stream)}}function endReadableNT(state,stream){if(!state.endEmitted&&state.length===0){state.endEmitted=true;stream.readable=false;stream.emit("end")}}function forEach(xs,f){for(var i=0,l=xs.length;i-1?setImmediate:processNextTick;Writable.WritableState=WritableState;var util=require("core-util-is");util.inherits=require("inherits");var internalUtil={deprecate:require("util-deprecate")};var Stream;(function(){try{Stream=require("st"+"ream")}catch(_){}finally{if(!Stream)Stream=require("events").EventEmitter}})();var Buffer=require("buffer").Buffer;var bufferShim=require("buffer-shims");util.inherits(Writable,Stream);function nop(){}function WriteReq(chunk,encoding,cb){this.chunk=chunk;this.encoding=encoding;this.callback=cb;this.next=null}var Duplex;function WritableState(options,stream){Duplex=Duplex||require("./_stream_duplex");options=options||{};this.objectMode=!!options.objectMode;if(stream instanceof Duplex)this.objectMode=this.objectMode||!!options.writableObjectMode;var hwm=options.highWaterMark;var defaultHwm=this.objectMode?16:16*1024;this.highWaterMark=hwm||hwm===0?hwm:defaultHwm;this.highWaterMark=~~this.highWaterMark;this.needDrain=false;this.ending=false;this.ended=false;this.finished=false;var noDecode=options.decodeStrings===false; -this.decodeStrings=!noDecode;this.defaultEncoding=options.defaultEncoding||"utf8";this.length=0;this.writing=false;this.corked=0;this.sync=true;this.bufferProcessing=false;this.onwrite=function(er){onwrite(stream,er)};this.writecb=null;this.writelen=0;this.bufferedRequest=null;this.lastBufferedRequest=null;this.pendingcb=0;this.prefinished=false;this.errorEmitted=false;this.bufferedRequestCount=0;this.corkedRequestsFree=new CorkedRequest(this)}WritableState.prototype.getBuffer=function writableStateGetBuffer(){var current=this.bufferedRequest;var out=[];while(current){out.push(current);current=current.next}return out};(function(){try{Object.defineProperty(WritableState.prototype,"buffer",{get:internalUtil.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer "+"instead.")})}catch(_){}})();var Duplex;function Writable(options){Duplex=Duplex||require("./_stream_duplex");if(!(this instanceof Writable)&&!(this instanceof Duplex))return new Writable(options);this._writableState=new WritableState(options,this);this.writable=true;if(options){if(typeof options.write==="function")this._write=options.write;if(typeof options.writev==="function")this._writev=options.writev}Stream.call(this)}Writable.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))};function writeAfterEnd(stream,cb){var er=new Error("write after end");stream.emit("error",er);processNextTick(cb,er)}function validChunk(stream,state,chunk,cb){var valid=true;var er=false;if(chunk===null){er=new TypeError("May not write null values to stream")}else if(!Buffer.isBuffer(chunk)&&typeof chunk!=="string"&&chunk!==undefined&&!state.objectMode){er=new TypeError("Invalid non-string/buffer chunk")}if(er){stream.emit("error",er);processNextTick(cb,er);valid=false}return valid}Writable.prototype.write=function(chunk,encoding,cb){var state=this._writableState;var ret=false;if(typeof encoding==="function"){cb=encoding;encoding=null}if(Buffer.isBuffer(chunk))encoding="buffer";else if(!encoding)encoding=state.defaultEncoding;if(typeof cb!=="function")cb=nop;if(state.ended)writeAfterEnd(this,cb);else if(validChunk(this,state,chunk,cb)){state.pendingcb++;ret=writeOrBuffer(this,state,chunk,encoding,cb)}return ret};Writable.prototype.cork=function(){var state=this._writableState;state.corked++};Writable.prototype.uncork=function(){var state=this._writableState;if(state.corked){state.corked--;if(!state.writing&&!state.corked&&!state.finished&&!state.bufferProcessing&&state.bufferedRequest)clearBuffer(this,state)}};Writable.prototype.setDefaultEncoding=function setDefaultEncoding(encoding){if(typeof encoding==="string")encoding=encoding.toLowerCase();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);this._writableState.defaultEncoding=encoding;return this};function decodeChunk(state,chunk,encoding){if(!state.objectMode&&state.decodeStrings!==false&&typeof chunk==="string"){chunk=bufferShim.from(chunk,encoding)}return chunk}function writeOrBuffer(stream,state,chunk,encoding,cb){chunk=decodeChunk(state,chunk,encoding);if(Buffer.isBuffer(chunk))encoding="buffer";var len=state.objectMode?1:chunk.length;state.length+=len;var ret=state.length=this.charLength-this.charReceived?this.charLength-this.charReceived:buffer.length;buffer.copy(this.charBuffer,this.charReceived,0,available);this.charReceived+=available;if(this.charReceived=55296&&charCode<=56319){this.charLength+=this.surrogateSize;charStr="";continue}this.charReceived=this.charLength=0;if(buffer.length===0){return charStr}break}this.detectIncompleteChar(buffer);var end=buffer.length;if(this.charLength){buffer.copy(this.charBuffer,0,buffer.length-this.charReceived,end);end-=this.charReceived}charStr+=buffer.toString(this.encoding,0,end);var end=charStr.length-1;var charCode=charStr.charCodeAt(end);if(charCode>=55296&&charCode<=56319){var size=this.surrogateSize;this.charLength+=size;this.charReceived+=size;this.charBuffer.copy(this.charBuffer,size,0,size);buffer.copy(this.charBuffer,0,0,size);return charStr.substring(0,end)}return charStr};StringDecoder.prototype.detectIncompleteChar=function(buffer){var i=buffer.length>=3?3:buffer.length;for(;i>0;i--){var c=buffer[buffer.length-i];if(i==1&&c>>5==6){this.charLength=2;break}if(i<=2&&c>>4==14){this.charLength=3;break}if(i<=3&&c>>3==30){this.charLength=4;break}}this.charReceived=i};StringDecoder.prototype.end=function(buffer){var res="";if(buffer&&buffer.length)res=this.write(buffer);if(this.charReceived){var cr=this.charReceived;var buf=this.charBuffer;var enc=this.encoding;res+=buf.slice(0,cr).toString(enc)}return res};function passThroughWrite(buffer){return buffer.toString(this.encoding)}function utf16DetectIncompleteChar(buffer){this.charReceived=buffer.length%2;this.charLength=this.charReceived?2:0}function base64DetectIncompleteChar(buffer){this.charReceived=buffer.length%3;this.charLength=this.charReceived?3:0}},{buffer:19}],75:[function(require,module,exports){(function(global){module.exports=deprecate;function deprecate(fn,msg){if(config("noDeprecation")){return fn}var warned=false;function deprecated(){if(!warned){if(config("throwDeprecation")){throw new Error(msg)}else if(config("traceDeprecation")){console.trace(msg)}else{console.warn(msg)}warned=true}return fn.apply(this,arguments)}return deprecated}function config(name){try{if(!global.localStorage)return false}catch(_){return false}var val=global.localStorage[name];if(null==val)return false;return String(val).toLowerCase()==="true"}}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{}],76:[function(require,module,exports){module.exports=function isBuffer(arg){return arg&&typeof arg==="object"&&typeof arg.copy==="function"&&typeof arg.fill==="function"&&typeof arg.readUInt8==="function"}},{}],77:[function(require,module,exports){(function(process,global){var formatRegExp=/%[sdj%]/g;exports.format=function(f){if(!isString(f)){var objects=[];for(var i=0;i=len)return x;switch(x){case"%s":return String(args[i++]);case"%d":return Number(args[i++]);case"%j":try{return JSON.stringify(args[i++])}catch(_){return"[Circular]"}default:return x}});for(var x=args[i];i=3)ctx.depth=arguments[2];if(arguments.length>=4)ctx.colors=arguments[3];if(isBoolean(opts)){ctx.showHidden=opts}else if(opts){exports._extend(ctx,opts)}if(isUndefined(ctx.showHidden))ctx.showHidden=false;if(isUndefined(ctx.depth))ctx.depth=2;if(isUndefined(ctx.colors))ctx.colors=false;if(isUndefined(ctx.customInspect))ctx.customInspect=true;if(ctx.colors)ctx.stylize=stylizeWithColor;return formatValue(ctx,obj,ctx.depth)}exports.inspect=inspect;inspect.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]};inspect.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};function stylizeWithColor(str,styleType){var style=inspect.styles[styleType];if(style){return"["+inspect.colors[style][0]+"m"+str+"["+inspect.colors[style][1]+"m"}else{return str}}function stylizeNoColor(str,styleType){return str}function arrayToHash(array){var hash={};array.forEach(function(val,idx){hash[val]=true});return hash}function formatValue(ctx,value,recurseTimes){if(ctx.customInspect&&value&&isFunction(value.inspect)&&value.inspect!==exports.inspect&&!(value.constructor&&value.constructor.prototype===value)){var ret=value.inspect(recurseTimes,ctx);if(!isString(ret)){ret=formatValue(ctx,ret,recurseTimes)}return ret}var primitive=formatPrimitive(ctx,value);if(primitive){return primitive}var keys=Object.keys(value);var visibleKeys=arrayToHash(keys);if(ctx.showHidden){keys=Object.getOwnPropertyNames(value)}if(isError(value)&&(keys.indexOf("message")>=0||keys.indexOf("description")>=0)){return formatError(value)}if(keys.length===0){if(isFunction(value)){var name=value.name?": "+value.name:"";return ctx.stylize("[Function"+name+"]","special")}if(isRegExp(value)){return ctx.stylize(RegExp.prototype.toString.call(value),"regexp")}if(isDate(value)){return ctx.stylize(Date.prototype.toString.call(value),"date")}if(isError(value)){return formatError(value)}}var base="",array=false,braces=["{","}"];if(isArray(value)){array=true;braces=["[","]"]}if(isFunction(value)){var n=value.name?": "+value.name:"";base=" [Function"+n+"]"}if(isRegExp(value)){base=" "+RegExp.prototype.toString.call(value)}if(isDate(value)){base=" "+Date.prototype.toUTCString.call(value)}if(isError(value)){base=" "+formatError(value)}if(keys.length===0&&(!array||value.length==0)){return braces[0]+base+braces[1]}if(recurseTimes<0){if(isRegExp(value)){return ctx.stylize(RegExp.prototype.toString.call(value),"regexp")}else{return ctx.stylize("[Object]","special")}}ctx.seen.push(value);var output;if(array){output=formatArray(ctx,value,recurseTimes,visibleKeys,keys)}else{output=keys.map(function(key){return formatProperty(ctx,value,recurseTimes,visibleKeys,key,array)})}ctx.seen.pop();return reduceToSingleString(output,base,braces)}function formatPrimitive(ctx,value){if(isUndefined(value))return ctx.stylize("undefined","undefined");if(isString(value)){var simple="'"+JSON.stringify(value).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return ctx.stylize(simple,"string")}if(isNumber(value))return ctx.stylize(""+value,"number");if(isBoolean(value))return ctx.stylize(""+value,"boolean");if(isNull(value))return ctx.stylize("null","null")}function formatError(value){return"["+Error.prototype.toString.call(value)+"]"}function formatArray(ctx,value,recurseTimes,visibleKeys,keys){var output=[];for(var i=0,l=value.length;i-1){if(array){str=str.split("\n").map(function(line){return" "+line}).join("\n").substr(2)}else{str="\n"+str.split("\n").map(function(line){return" "+line}).join("\n")}}}else{str=ctx.stylize("[Circular]","special")}}if(isUndefined(name)){if(array&&key.match(/^\d+$/)){return str}name=JSON.stringify(""+key);if(name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)){name=name.substr(1,name.length-2);name=ctx.stylize(name,"name")}else{name=name.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'");name=ctx.stylize(name,"string")}}return name+": "+str}function reduceToSingleString(output,base,braces){var numLinesEst=0;var length=output.reduce(function(prev,cur){numLinesEst++;if(cur.indexOf("\n")>=0)numLinesEst++;return prev+cur.replace(/\u001b\[\d\d?m/g,"").length+1},0);if(length>60){return braces[0]+(base===""?"":base+"\n ")+" "+output.join(",\n ")+" "+braces[1]}return braces[0]+base+" "+output.join(", ")+" "+braces[1]}function isArray(ar){return Array.isArray(ar)}exports.isArray=isArray;function isBoolean(arg){return typeof arg==="boolean"}exports.isBoolean=isBoolean;function isNull(arg){return arg===null}exports.isNull=isNull;function isNullOrUndefined(arg){return arg==null}exports.isNullOrUndefined=isNullOrUndefined;function isNumber(arg){return typeof arg==="number"}exports.isNumber=isNumber;function isString(arg){return typeof arg==="string"}exports.isString=isString;function isSymbol(arg){return typeof arg==="symbol"}exports.isSymbol=isSymbol;function isUndefined(arg){return arg===void 0}exports.isUndefined=isUndefined;function isRegExp(re){return isObject(re)&&objectToString(re)==="[object RegExp]"}exports.isRegExp=isRegExp;function isObject(arg){return typeof arg==="object"&&arg!==null}exports.isObject=isObject;function isDate(d){return isObject(d)&&objectToString(d)==="[object Date]"}exports.isDate=isDate;function isError(e){return isObject(e)&&(objectToString(e)==="[object Error]"||e instanceof Error)}exports.isError=isError;function isFunction(arg){return typeof arg==="function"}exports.isFunction=isFunction;function isPrimitive(arg){return arg===null||typeof arg==="boolean"||typeof arg==="number"||typeof arg==="string"||typeof arg==="symbol"||typeof arg==="undefined"}exports.isPrimitive=isPrimitive;exports.isBuffer=require("./support/isBuffer");function objectToString(o){return Object.prototype.toString.call(o)}function pad(n){return n<10?"0"+n.toString(10):n.toString(10)}var months=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function timestamp(){var d=new Date;var time=[pad(d.getHours()),pad(d.getMinutes()),pad(d.getSeconds())].join(":");return[d.getDate(),months[d.getMonth()],time].join(" ")}exports.log=function(){console.log("%s - %s",timestamp(),exports.format.apply(exports,arguments))};exports.inherits=require("inherits");exports._extend=function(origin,add){if(!add||!isObject(add))return origin;var keys=Object.keys(add);var i=keys.length;while(i--){origin[keys[i]]=add[keys[i]]}return origin};function hasOwnProperty(obj,prop){return Object.prototype.hasOwnProperty.call(obj,prop)}}).call(this,require("_process"),typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{"./support/isBuffer":76,_process:68,inherits:27}],78:[function(require,module,exports){"use strict";var isString=require("validate.io-string-primitive");var isNonNegativeInteger=require("validate.io-nonnegative-integer");var ceil=require("math-ceil");var repeat=require("utils-repeat-string");var MAX_SAFE_INTEGER=9007199254740991;function lpad(str,len,pad){var n;var p;if(!isString(str)){throw new TypeError("invalid input argument. First argument must be a string. Value: `"+str+"`.")}if(!isNonNegativeInteger(len)){throw new TypeError("invalid input argument. Second argument must be a nonnegative integer. Value: `"+len+"`.")}if(arguments.length>2){p=pad;if(!isString(p)){throw new TypeError("invalid input argument. Third argument must be a string. Value: `"+p+"`.")}if(p.length===0){throw new RangeError("invalid input argument. Pad string must not be an empty string.")}}else{p=" "}if(len>MAX_SAFE_INTEGER){throw new RangeError("invalid input argument. Output string length exceeds maximum allowed string length.")}n=(len-str.length)/p.length;if(n<=0){return str}n=ceil(n);return repeat(p,n)+str}module.exports=lpad},{"math-ceil":41,"utils-repeat-string":79,"validate.io-nonnegative-integer":82,"validate.io-string-primitive":84}],79:[function(require,module,exports){"use strict";var isString=require("validate.io-string-primitive");var isNonNegativeInteger=require("validate.io-nonnegative-integer");var MAX_SAFE_INTEGER=9007199254740991;function repeat(str,n){var rpt;var cnt;if(!isString(str)){throw new TypeError("invalid input argument. First argument must be a string. Value: `"+str+"`.")}if(!isNonNegativeInteger(n)){throw new TypeError("invalid input argument. Second argument must be a nonnegative integer. Value: `"+n+"`.")}if(str.length===0||n===0){return""}if(str.length*n>MAX_SAFE_INTEGER){throw new RangeError("invalid input argument. Output string length exceeds maximum allowed string length.")}rpt="";cnt=n;for(;;){if((cnt&1)===1){rpt+=str}cnt>>>=1;if(cnt===0){break}str+=str}return rpt}module.exports=repeat},{"validate.io-nonnegative-integer":82,"validate.io-string-primitive":84}],80:[function(require,module,exports){"use strict";var isString=require("validate.io-string-primitive");var isNonNegativeInteger=require("validate.io-nonnegative-integer");var ceil=require("math-ceil");var repeat=require("utils-repeat-string");var MAX_SAFE_INTEGER=9007199254740991;function rpad(str,len,pad){var n;var p;if(!isString(str)){throw new TypeError("invalid input argument. First argument must be a string. Value: `"+str+"`.")}if(!isNonNegativeInteger(len)){throw new TypeError("invalid input argument. Second argument must be a nonnegative integer. Value: `"+len+"`.")}if(arguments.length>2){p=pad;if(!isString(p)){throw new TypeError("invalid input argument. Third argument must be a string. Value: `"+p+"`.")}if(p.length===0){throw new RangeError("invalid input argument. Pad string must not be an empty string.")}}else{p=" "}if(len>MAX_SAFE_INTEGER){throw new RangeError("invalid input argument. Output string length exceeds maximum allowed string length.")}n=(len-str.length)/p.length;if(n<=0){return str}n=ceil(n);return str+repeat(p,n)}module.exports=rpad},{"math-ceil":41,"utils-repeat-string":79,"validate.io-nonnegative-integer":82,"validate.io-string-primitive":84}],81:[function(require,module,exports){"use strict";var isNumber=require("validate.io-number");function isInteger(value){return isNumber(value)&&value%1===0}module.exports=isInteger},{"validate.io-number":83}],82:[function(require,module,exports){"use strict";var isInteger=require("validate.io-integer");function isNonNegativeInteger(value){return isInteger(value)&&value>=0}module.exports=isNonNegativeInteger},{"validate.io-integer":81}],83:[function(require,module,exports){"use strict";function isNumber(value){return(typeof value==="number"||Object.prototype.toString.call(value)==="[object Number]")&&value.valueOf()===value.valueOf()}module.exports=isNumber},{}],84:[function(require,module,exports){"use strict";function isString(value){return typeof value==="string"}module.exports=isString},{}],85:[function(require,module,exports){module.exports={name:"ami.js",version:"v0.0.9",main:"src/ami.min.js",keywords:["ami","ami.js","three.js","webgl","dicom","nifti","awesome","medical","imaging","xtk","nrrd","vtk","stl","trk","labelmap","mesh"],author:{name:"Nicolas Rannou",email:"nicolas@eunate.ch",url:"https://eunate.ch"},license:"Apache-2.0",repository:{type:"git",url:"https://fnndsc.github.io/ami"},config:{threeVersion:"r81",amiCDN:"https://cdn.rawgit.com/fnndsc/ami/master/build/ami.min.js",gaKey:"UA-39303022-3",transforms:"-t [babelify --presets [ es2015 ] ]"},dependencies:{"dicom-parser":"1.7.3","image-JPEG2000":"OHIF/image-JPEG2000#master","jpeg-lossless-decoder-js":"1.2.3","math-float32-to-binary-string":"^1.0.0","nrrd-js":"^0.2.1","nifti-reader-js":"v0.5.3",pako:"1.0.1"},scripts:{"dist:prepare":"node ./scripts/$npm_package_config_mode.js --dist","dist:watchAmi":"watchify -d src/ami $npm_package_config_transforms --standalone AMI -o dist/build/ami.js -v","dist:watch":"watchify $npm_package_config_target -d $npm_package_config_transforms -o dist/$npm_package_config_target -v",dist:"npm run dist:prepare --ami.js:mode=$npm_package_config_mode && (live-server dist --open=$npm_package_config_open & npm run dist:watch --ami.js:target=$npm_package_config_target)",example:"npm run clean && node ./scripts/router.js examples ",lesson:"npm run clean && mkdir dist/build && touch dist/build/ami.js && node ./scripts/router.js lessons ",demo:"node ./scripts/lessons.js --demo",lint:"eslint **/*.js --quiet","build:examples":"npm run dist:prepare --ami.js:mode=examples && find examples -name '*.js' -print0 | xargs -0 -n1 -I{} bash -c \"echo Building {}; browserify {} -d -v $npm_package_config_transforms > dist/{} \"","build:ami":"browserify src/ami.js -d -v $npm_package_config_transforms --standalone AMI > build/ami.js && uglifyjs build/ami.js -o build/ami.min.js",build:"npm run clean && cp index.html dist/index.html && npm run build:examples && npm run doc",clean:"rm -rf dist/*",test:"karma start",doc:"jsdoc -p -r -R README.md -c jsdoc.conf -d dist/doc src",ami:"npm run lint && npm run demo && npm run build:ami && npm run test",deploy:"npm run build && gh-pages -d dist"},devDependencies:{browserify:"^13.1.0","uglify-js":"^2.7.3","live-server":"^1.1.0","babel-cli":"latest",shelljs:"latest","gh-pages":"latest",eslint:"latest","babel-polyfill":"^6.13.0","babel-preset-es2015":"^6.13.2",babelify:"7.3.0",glslify:"5.1.0",jsdoc:"jsdoc3/jsdoc#master",karma:"latest",phantomjs:"latest","karma-browserify":"latest","karma-jasmine":"latest","karma-phantomjs-launcher":"latest","karma-spec-reporter":"latest","jasmine-core":"latest",watchify:"3.7.0"},engines:{node:">=6.9.0"},browserify:{transform:["babelify"]}}},{}],86:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var _cameras=require("./cameras/cameras");var _cameras2=_interopRequireDefault(_cameras);var _controls=require("./controls/controls");var _controls2=_interopRequireDefault(_controls);var _core=require("./core/core");var _core2=_interopRequireDefault(_core);var _geometries=require("./geometries/geometries");var _geometries2=_interopRequireDefault(_geometries);var _helpers=require("./helpers/helpers");var _helpers2=_interopRequireDefault(_helpers);var _loaders=require("./loaders/loaders");var _loaders2=_interopRequireDefault(_loaders);var _models=require("./models/models");var _models2=_interopRequireDefault(_models);var _parsers=require("./parsers/parsers");var _parsers2=_interopRequireDefault(_parsers);var _shaders=require("./shaders/shaders");var _shaders2=_interopRequireDefault(_shaders);var _widgets=require("./widgets/widgets");var _widgets2=_interopRequireDefault(_widgets);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}var pckg=require("../package.json");exports.default={Cameras:_cameras2.default,Controls:_controls2.default,Core:_core2.default,Geometries:_geometries2.default,Helpers:_helpers2.default,Loaders:_loaders2.default,Models:_models2.default,Parsers:_parsers2.default,Shaders:_shaders2.default,Widgets:_widgets2.default};window.console.log("AMI "+pckg.version+" ( ThreeJS "+pckg.config.threeVersion+")")},{"../package.json":85,"./cameras/cameras":87,"./controls/controls":89,"./core/core":93,"./geometries/geometries":97,"./helpers/helpers":102,"./loaders/loaders":111,"./models/models":115,"./parsers/parsers":120,"./shaders/shaders":134,"./widgets/widgets":143}],87:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var _cameras=require("./cameras.orthographic");var _cameras2=_interopRequireDefault(_cameras);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}exports.default={Orthographic:_cameras2.default}},{"./cameras.orthographic":88}],88:[function(require,module,exports){"use strict";var _typeof=typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"?function(obj){return typeof obj}:function(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol?"symbol":typeof obj};Object.defineProperty(exports,"__esModule",{value:true});var _createClass=function(){function defineProperties(target,props){for(var i=0;i0&&arguments[0]!==undefined?arguments[0]:null;this.center();var computedAngle=90;var clockwise=1;if(!this._fromFront){clockwise=-1}if(angle===null){computedAngle*=-clockwise;this._angle+=90}else{computedAngle=360-clockwise*(angle-this._angle);this._angle=angle}this._angle%=360;var rotation=(new THREE.Matrix4).makeRotationAxis(this._zCosine,computedAngle*Math.PI/180);this.up.applyMatrix4(rotation);this._updateMatrices()}},{key:"fitBox",value:function fitBox(){var direction=arguments.length>0&&arguments[0]!==undefined?arguments[0]:0;var factor=arguments.length>1&&arguments[1]!==undefined?arguments[1]:1.5;var zoom=1;switch(direction){case 0:zoom=factor*this._computeZoom(this._canvas.width,this._xCosine);break;case 1:zoom=factor*this._computeZoom(this._canvas.height,this._yCosine);break;case 2:zoom=factor*Math.min(this._computeZoom(this._canvas.width,this._xCosine),this._computeZoom(this._canvas.height,this._yCosine));break;default:break}if(!zoom){return false}this.zoom=zoom;this.center()}},{key:"_updateCanvas",value:function _updateCanvas(){var camFactor=2;this.left=-this._canvas.width/camFactor;this.right=this._canvas.width/camFactor;this.top=this._canvas.height/camFactor;this.bottom=-this._canvas.height/camFactor;this._updateMatrices();this.controls.handleResize()}},{key:"_oppositePosition",value:function _oppositePosition(position){var oppositePosition=position.clone();oppositePosition.sub(this._box.center);var rotation=(new THREE.Matrix4).makeRotationAxis(this.up,Math.PI);oppositePosition.applyMatrix4(rotation);oppositePosition.add(this._box.center);return oppositePosition}},{key:"_computeZoom",value:function _computeZoom(dimension,direction){if(!(dimension&&dimension>0)){window.console.log("Invalid dimension provided.");window.console.log(dimension);return false}var ray={position:this._box.center.clone(),direction:direction};var intersections=_core2.default.rayBox(ray,this._box);if(intersections.length<2){window.console.log("Can not adjust the camera ( < 2 intersections).");window.console.log(ray);window.console.log(this._box);return false}return dimension/intersections[0].distanceTo(intersections[1])}},{key:"_updatePositionAndTarget",value:function _updatePositionAndTarget(position,target){this.position.set(position.x,position.y,position.z);this.lookAt(target.x,target.y,target.z);this._controls.target.set(target.x,target.y,target.z)}},{key:"_updateMatrices",value:function _updateMatrices(){this._controls.update();this.updateProjectionMatrix();this.updateMatrixWorld()}},{key:"xCosine",set:function set(xCosine){this._xCosine=xCosine},get:function get(){return this._xCosine}},{key:"yCosine",set:function set(yCosine){this._yCosine=yCosine},get:function get(){return this._yCosine}},{key:"zCosine",set:function set(zCosine){this._zCosine=zCosine},get:function get(){return this._zCosine}},{key:"controls",set:function set(controls){this._controls=controls},get:function get(){return this._controls}},{key:"box",set:function set(box){this._box=box},get:function get(){return this._box}},{key:"canvas",set:function set(canvas){this._canvas=canvas;this._updateCanvas()},get:function get(){return this._canvas}},{key:"angle",set:function set(angle){this.rotate(angle)},get:function get(){return this._angle}}]);return CamerasOrthographic}(THREE.OrthographicCamera);exports.default=CamerasOrthographic},{"../core/core.intersections":92,"../core/core.validators":96}],89:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var _controls=require("./controls.trackball");var _controls2=_interopRequireDefault(_controls);var _controls3=require("./controls.trackballortho");var _controls4=_interopRequireDefault(_controls3);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}exports.default={Trackball:_controls2.default,TrackballOrtho:_controls4.default}},{"./controls.trackball":90,"./controls.trackballortho":91}],90:[function(require,module,exports){"use strict";var _typeof=typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"?function(obj){return typeof obj}:function(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol?"symbol":typeof obj};Object.defineProperty(exports,"__esModule",{value:true});function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}function _possibleConstructorReturn(self,call){if(!self){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return call&&((typeof call==="undefined"?"undefined":_typeof(call))==="object"||typeof call==="function")?call:self}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function, not "+(typeof superClass==="undefined"?"undefined":_typeof(superClass)))}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:false,writable:true,configurable:true}});if(superClass)Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass}var Trackball=function(_THREE$EventDispatche){_inherits(Trackball,_THREE$EventDispatche);function Trackball(object,domElement){_classCallCheck(this,Trackball);var _this2=_possibleConstructorReturn(this,(Trackball.__proto__||Object.getPrototypeOf(Trackball)).call(this));var _this=_this2;var STATE={NONE:-1,ROTATE:0,ZOOM:1,PAN:2,TOUCH_ROTATE:3,TOUCH_ZOOM:4,TOUCH_PAN:5,CUSTOM:99};_this2.object=object;_this2.domElement=domElement!==undefined?domElement:document;_this2.enabled=true;_this2.screen={left:0,top:0,width:0,height:0};_this2.rotateSpeed=1;_this2.zoomSpeed=1.2;_this2.panSpeed=.3;_this2.noRotate=false;_this2.noZoom=false;_this2.noPan=false;_this2.noCustom=false;_this2.forceState=-1;_this2.staticMoving=false;_this2.dynamicDampingFactor=.2;_this2.minDistance=0;_this2.maxDistance=Infinity;_this2.keys=[65,83,68];_this2.target=new THREE.Vector3;var EPS=1e-6;var lastPosition=new THREE.Vector3;var _state=STATE.NONE,_prevState=STATE.NONE,_eye=new THREE.Vector3,_movePrev=new THREE.Vector2,_moveCurr=new THREE.Vector2,_lastAxis=new THREE.Vector3,_lastAngle=0,_zoomStart=new THREE.Vector2,_zoomEnd=new THREE.Vector2,_touchZoomDistanceStart=0,_touchZoomDistanceEnd=0,_panStart=new THREE.Vector2,_panEnd=new THREE.Vector2,_customStart=new THREE.Vector2,_customEnd=new THREE.Vector2;_this2.target0=_this2.target.clone();_this2.position0=_this2.object.position.clone();_this2.up0=_this2.object.up.clone();var changeEvent={type:"change"};var startEvent={type:"start"};var endEvent={type:"end"};_this2.handleResize=function(){if(this.domElement===document){this.screen.left=0;this.screen.top=0;this.screen.width=window.innerWidth;this.screen.height=window.innerHeight}else{var box=this.domElement.getBoundingClientRect();var d=this.domElement.ownerDocument.documentElement;this.screen.left=box.left+window.pageXOffset-d.clientLeft;this.screen.top=box.top+window.pageYOffset-d.clientTop;this.screen.width=box.width;this.screen.height=box.height}};_this2.handleEvent=function(event){if(typeof this[event.type]=="function"){this[event.type](event)}};var getMouseOnScreen=function(){var vector=new THREE.Vector2;return function(pageX,pageY){vector.set((pageX-_this.screen.left)/_this.screen.width,(pageY-_this.screen.top)/_this.screen.height);return vector}}();var getMouseOnCircle=function(){var vector=new THREE.Vector2;return function(pageX,pageY){vector.set((pageX-_this.screen.width*.5-_this.screen.left)/(_this.screen.width*.5),(_this.screen.height+2*(_this.screen.top-pageY))/_this.screen.width);return vector}}();_this2.rotateCamera=function(){var axis=new THREE.Vector3,quaternion=new THREE.Quaternion,eyeDirection=new THREE.Vector3,objectUpDirection=new THREE.Vector3,objectSidewaysDirection=new THREE.Vector3,moveDirection=new THREE.Vector3,angle;return function(){moveDirection.set(_moveCurr.x-_movePrev.x,_moveCurr.y-_movePrev.y,0);angle=moveDirection.length();if(angle){_eye.copy(_this.object.position).sub(_this.target);eyeDirection.copy(_eye).normalize();objectUpDirection.copy(_this.object.up).normalize();objectSidewaysDirection.crossVectors(objectUpDirection,eyeDirection).normalize();objectUpDirection.setLength(_moveCurr.y-_movePrev.y);objectSidewaysDirection.setLength(_moveCurr.x-_movePrev.x);moveDirection.copy(objectUpDirection.add(objectSidewaysDirection));axis.crossVectors(moveDirection,_eye).normalize();angle*=_this.rotateSpeed;quaternion.setFromAxisAngle(axis,angle);_eye.applyQuaternion(quaternion);_this.object.up.applyQuaternion(quaternion);_lastAxis.copy(axis);_lastAngle=angle}else if(!_this.staticMoving&&_lastAngle){_lastAngle*=Math.sqrt(1-_this.dynamicDampingFactor);_eye.copy(_this.object.position).sub(_this.target);quaternion.setFromAxisAngle(_lastAxis,_lastAngle);_eye.applyQuaternion(quaternion);_this.object.up.applyQuaternion(quaternion)}_movePrev.copy(_moveCurr)}}();_this2.zoomCamera=function(){var factor;if(_state===STATE.TOUCH_ZOOM){factor=_touchZoomDistanceStart/_touchZoomDistanceEnd;_touchZoomDistanceStart=_touchZoomDistanceEnd;_eye.multiplyScalar(factor)}else{factor=1+(_zoomEnd.y-_zoomStart.y)*_this.zoomSpeed;if(factor!==1&&factor>0){_eye.multiplyScalar(factor);if(_this.staticMoving){_zoomStart.copy(_zoomEnd)}else{_zoomStart.y+=(_zoomEnd.y-_zoomStart.y)*this.dynamicDampingFactor}}}};_this2.panCamera=function(){var mouseChange=new THREE.Vector2,objectUp=new THREE.Vector3,pan=new THREE.Vector3;return function(){mouseChange.copy(_panEnd).sub(_panStart);if(mouseChange.lengthSq()){mouseChange.multiplyScalar(_eye.length()*_this.panSpeed);pan.copy(_eye).cross(_this.object.up).setLength(mouseChange.x);pan.add(objectUp.copy(_this.object.up).setLength(mouseChange.y));_this.object.position.add(pan);_this.target.add(pan);if(_this.staticMoving){_panStart.copy(_panEnd)}else{_panStart.add(mouseChange.subVectors(_panEnd,_panStart).multiplyScalar(_this.dynamicDampingFactor))}}}}();_this2.checkDistances=function(){if(!_this.noZoom||!_this.noPan){if(_eye.lengthSq()>_this.maxDistance*_this.maxDistance){_this.object.position.addVectors(_this.target,_eye.setLength(_this.maxDistance))}if(_eye.lengthSq()<_this.minDistance*_this.minDistance){_this.object.position.addVectors(_this.target,_eye.setLength(_this.minDistance))}}};_this2.update=function(){_eye.subVectors(_this.object.position,_this.target);if(!_this.noRotate){_this.rotateCamera()}if(!_this.noZoom){_this.zoomCamera()}if(!_this.noPan){_this.panCamera()}if(!_this.noCustom){_this.custom(_customStart,_customEnd)}_this.object.position.addVectors(_this.target,_eye);_this.checkDistances();_this.object.lookAt(_this.target);if(lastPosition.distanceToSquared(_this.object.position)>EPS){_this.dispatchEvent(changeEvent);lastPosition.copy(_this.object.position)}};_this2.reset=function(){_state=STATE.NONE;_prevState=STATE.NONE;_this.target.copy(_this.target0);_this.object.position.copy(_this.position0);_this.object.up.copy(_this.up0);_eye.subVectors(_this.object.position,_this.target);_this.object.lookAt(_this.target);_this.dispatchEvent(changeEvent);lastPosition.copy(_this.object.position)};_this2.setState=function(targetState){_this.forceState=targetState;_prevState=targetState;_state=targetState};_this2.custom=function(customStart,customEnd){};function keydown(event){if(_this.enabled===false)return;window.removeEventListener("keydown",keydown);_prevState=_state;if(_state!==STATE.NONE){return}else if(event.keyCode===_this.keys[STATE.ROTATE]&&!_this.noRotate){_state=STATE.ROTATE}else if(event.keyCode===_this.keys[STATE.ZOOM]&&!_this.noZoom){_state=STATE.ZOOM}else if(event.keyCode===_this.keys[STATE.PAN]&&!_this.noPan){_state=STATE.PAN}}function keyup(event){if(_this.enabled===false)return;_state=_prevState;window.addEventListener("keydown",keydown,false)}function mousedown(event){if(_this.enabled===false)return;event.preventDefault();event.stopPropagation();if(_state===STATE.NONE){_state=event.button}if(_state===STATE.ROTATE&&!_this.noRotate){_moveCurr.copy(getMouseOnCircle(event.pageX,event.pageY));_movePrev.copy(_moveCurr)}else if(_state===STATE.ZOOM&&!_this.noZoom){_zoomStart.copy(getMouseOnScreen(event.pageX,event.pageY));_zoomEnd.copy(_zoomStart)}else if(_state===STATE.PAN&&!_this.noPan){_panStart.copy(getMouseOnScreen(event.pageX,event.pageY));_panEnd.copy(_panStart)}else if(_state===STATE.CUSTOM&&!_this.noCustom){_customStart.copy(getMouseOnScreen(event.pageX,event.pageY));_customEnd.copy(_panStart)}document.addEventListener("mousemove",mousemove,false);document.addEventListener("mouseup",mouseup,false);_this.dispatchEvent(startEvent)}function mousemove(event){if(_this.enabled===false)return;event.preventDefault();event.stopPropagation();if(_state===STATE.ROTATE&&!_this.noRotate){_movePrev.copy(_moveCurr);_moveCurr.copy(getMouseOnCircle(event.pageX,event.pageY))}else if(_state===STATE.ZOOM&&!_this.noZoom){_zoomEnd.copy(getMouseOnScreen(event.pageX,event.pageY))}else if(_state===STATE.PAN&&!_this.noPan){_panEnd.copy(getMouseOnScreen(event.pageX,event.pageY))}else if(_state===STATE.CUSTOM&&!_this.noCustom){_customEnd.copy(getMouseOnScreen(event.pageX,event.pageY))}}function mouseup(event){if(_this.enabled===false)return;event.preventDefault();event.stopPropagation();if(_this.forceState===-1){_state=STATE.NONE}document.removeEventListener("mousemove",mousemove);document.removeEventListener("mouseup",mouseup);_this.dispatchEvent(endEvent)}function mousewheel(event){if(_this.enabled===false)return;event.preventDefault();event.stopPropagation();var delta=0;if(event.wheelDelta){delta=event.wheelDelta/40}else if(event.detail){delta=-event.detail/3}if(_state!==STATE.CUSTOM){_zoomStart.y+=delta*.01}else if(_state===STATE.CUSTOM){_customStart.y+=delta*.01}_this.dispatchEvent(startEvent);_this.dispatchEvent(endEvent)}function touchstart(event){if(_this.enabled===false)return;if(_this.forceState===-1){switch(event.touches.length){case 1:_state=STATE.TOUCH_ROTATE;_moveCurr.copy(getMouseOnCircle(event.touches[0].pageX,event.touches[0].pageY));_movePrev.copy(_moveCurr);break;case 2:_state=STATE.TOUCH_ZOOM;var dx=event.touches[0].pageX-event.touches[1].pageX;var dy=event.touches[0].pageY-event.touches[1].pageY;_touchZoomDistanceEnd=_touchZoomDistanceStart=Math.sqrt(dx*dx+dy*dy);var x=(event.touches[0].pageX+event.touches[1].pageX)/2;var y=(event.touches[0].pageY+event.touches[1].pageY)/2;_panStart.copy(getMouseOnScreen(x,y));_panEnd.copy(_panStart);break;default:_state=STATE.NONE}}else{switch(_state){case 0:_state=STATE.TOUCH_ROTATE;_moveCurr.copy(getMouseOnCircle(event.touches[0].pageX,event.touches[0].pageY));_movePrev.copy(_moveCurr);break;case 1:case 4:if(event.touches.length>=2){_state=STATE.TOUCH_ZOOM;var dx=event.touches[0].pageX-event.touches[1].pageX;var dy=event.touches[0].pageY-event.touches[1].pageY;_touchZoomDistanceEnd=_touchZoomDistanceStart=Math.sqrt(dx*dx+dy*dy)}else{_state=STATE.ZOOM;_zoomStart.copy(getMouseOnScreen(event.touches[0].pageX,event.touches[0].pageY));_zoomEnd.copy(_zoomStart)}break;case 2:case 5:if(event.touches.length>=2){_state=STATE.TOUCH_PAN;var x=(event.touches[0].pageX+event.touches[1].pageX)/2;var y=(event.touches[0].pageY+event.touches[1].pageY)/2;_panStart.copy(getMouseOnScreen(x,y));_panEnd.copy(_panStart)}else{_state=STATE.PAN;_panStart.copy(getMouseOnScreen(event.touches[0].pageX,event.touches[0].pageY));_panEnd.copy(_panStart)}break;case 99:_state=STATE.CUSTOM;var x=(event.touches[0].pageX+event.touches[1].pageX)/2;var y=(event.touches[0].pageY+event.touches[1].pageY)/2;_customStart.copy(getMouseOnScreen(x,y));_customEnd.copy(_customStart);break;default:_state=STATE.NONE}}_this.dispatchEvent(startEvent)}function touchmove(event){if(_this.enabled===false)return;event.preventDefault();event.stopPropagation();if(_this.forceState===-1){switch(event.touches.length){case 1:_movePrev.copy(_moveCurr);_moveCurr.copy(getMouseOnCircle(event.touches[0].pageX,event.touches[0].pageY));break;case 2:var dx=event.touches[0].pageX-event.touches[1].pageX;var dy=event.touches[0].pageY-event.touches[1].pageY;_touchZoomDistanceEnd=Math.sqrt(dx*dx+dy*dy);var x=(event.touches[0].pageX+event.touches[1].pageX)/2;var y=(event.touches[0].pageY+event.touches[1].pageY)/2;_panEnd.copy(getMouseOnScreen(x,y));break;default:_state=STATE.NONE}}else{switch(_state){case 0:_movePrev.copy(_moveCurr);_moveCurr.copy(getMouseOnCircle(event.touches[0].pageX,event.touches[0].pageY));break;case 1:_zoomEnd.copy(getMouseOnScreen(event.touches[0].pageX,event.touches[0].pageY));break;case 2:_panEnd.copy(getMouseOnScreen(event.touches[0].pageX,event.touches[0].pageY));break;case 4:var dx=event.touches[0].pageX-event.touches[1].pageX;var dy=event.touches[0].pageY-event.touches[1].pageY;_touchZoomDistanceEnd=Math.sqrt(dx*dx+dy*dy);break;case 5:var x=(event.touches[0].pageX+event.touches[1].pageX)/2;var y=(event.touches[0].pageY+event.touches[1].pageY)/2;_panEnd.copy(getMouseOnScreen(x,y));break;case 99:var x=(event.touches[0].pageX+event.touches[1].pageX)/2;var y=(event.touches[0].pageY+event.touches[1].pageY)/2;_customEnd.copy(getMouseOnScreen(x,y));break;default:_state=STATE.NONE}}}function touchend(event){if(_this.enabled===false)return;if(_this.forceState===-1){switch(event.touches.length){case 1:_movePrev.copy(_moveCurr);_moveCurr.copy(getMouseOnCircle(event.touches[0].pageX,event.touches[0].pageY));break;case 2:_touchZoomDistanceStart=_touchZoomDistanceEnd=0;var x=(event.touches[0].pageX+event.touches[1].pageX)/2;var y=(event.touches[0].pageY+event.touches[1].pageY)/2;_panEnd.copy(getMouseOnScreen(x,y));_panStart.copy(_panEnd);break}_state=STATE.NONE}else{switch(_state){case 0:_movePrev.copy(_moveCurr);_moveCurr.copy(getMouseOnCircle(event.touches[0].pageX,event.touches[0].pageY));break;case 1:case 2:break;case 4:_touchZoomDistanceStart=_touchZoomDistanceEnd=0;_state=STATE.ZOOM;break;case 5:if(event.touches.length>=2){var x=(event.touches[0].pageX+event.touches[1].pageX)/2;var y=(event.touches[0].pageY+event.touches[1].pageY)/2;_panEnd.copy(getMouseOnScreen(x,y));_panStart.copy(_panEnd)}_state=STATE.PAN;break;case 99:var x=(event.touches[0].pageX+event.touches[1].pageX)/2;var y=(event.touches[0].pageY+event.touches[1].pageY)/2;_customEnd.copy(getMouseOnScreen(x,y));_customStart.copy(_customEnd);break;default:_state=STATE.NONE}}_this.dispatchEvent(endEvent)}_this2.domElement.addEventListener("contextmenu",function(event){event.preventDefault()},false);_this2.domElement.addEventListener("mousedown",mousedown,false);_this2.domElement.addEventListener("mousewheel",mousewheel,false);_this2.domElement.addEventListener("DOMMouseScroll",mousewheel,false);_this2.domElement.addEventListener("touchstart",touchstart,false);_this2.domElement.addEventListener("touchend",touchend,false);_this2.domElement.addEventListener("touchmove",touchmove,false);window.addEventListener("keydown",keydown,false);window.addEventListener("keyup",keyup,false);_this2.handleResize();_this2.update();return _this2}return Trackball}(THREE.EventDispatcher);exports.default=Trackball},{}],91:[function(require,module,exports){"use strict";var _typeof=typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"?function(obj){return typeof obj}:function(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol?"symbol":typeof obj};Object.defineProperty(exports,"__esModule",{value:true});function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}function _possibleConstructorReturn(self,call){if(!self){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return call&&((typeof call==="undefined"?"undefined":_typeof(call))==="object"||typeof call==="function")?call:self}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function, not "+(typeof superClass==="undefined"?"undefined":_typeof(superClass)))}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:false,writable:true,configurable:true}});if(superClass)Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass}var Trackballortho=function(_THREE$EventDispatche){_inherits(Trackballortho,_THREE$EventDispatche);function Trackballortho(object,domElement){var state=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{NONE:-1,ROTATE:1,ZOOM:2,PAN:0,SCROLL:4,TOUCH_ROTATE:4,TOUCH_ZOOM_PAN:5};_classCallCheck(this,Trackballortho);var _this2=_possibleConstructorReturn(this,(Trackballortho.__proto__||Object.getPrototypeOf(Trackballortho)).call(this));var _this=_this2;var STATE=state;_this2.object=object;_this2.domElement=domElement!==undefined?domElement:document;_this2.enabled=true;_this2.screen={left:0,top:0,width:0,height:0};_this2.radius=0;_this2.zoomSpeed=1.2;_this2.noZoom=false;_this2.noPan=false;_this2.staticMoving=false;_this2.dynamicDampingFactor=.2;_this2.keys=[65,83,68];_this2.target=new THREE.Vector3;var EPS=1e-6;var _changed=true;var _state=STATE.NONE,_prevState=STATE.NONE,_eye=new THREE.Vector3,_zoomStart=new THREE.Vector2,_zoomEnd=new THREE.Vector2,_touchZoomDistanceStart=0,_touchZoomDistanceEnd=0,_panStart=new THREE.Vector2,_panEnd=new THREE.Vector2;_this2.target0=_this2.target.clone();_this2.position0=_this2.object.position.clone();_this2.up0=_this2.object.up.clone();_this2.left0=_this2.object.left;_this2.right0=_this2.object.right;_this2.top0=_this2.object.top;_this2.bottom0=_this2.object.bottom;var changeEvent={type:"change"};var startEvent={type:"start"};var endEvent={type:"end"};_this2.handleResize=function(){if(this.domElement===document){this.screen.left=0;this.screen.top=0;this.screen.width=window.innerWidth;this.screen.height=window.innerHeight}else{var box=this.domElement.getBoundingClientRect();var d=this.domElement.ownerDocument.documentElement;this.screen.left=box.left+window.pageXOffset-d.clientLeft;this.screen.top=box.top+window.pageYOffset-d.clientTop;this.screen.width=box.width;this.screen.height=box.height}this.radius=.5*Math.min(this.screen.width,this.screen.height);this.left0=this.object.left;this.right0=this.object.right;this.top0=this.object.top;this.bottom0=this.object.bottom};_this2.handleEvent=function(event){if(typeof this[event.type]=="function"){this[event.type](event)}};var getMouseOnScreen=function(){var vector=new THREE.Vector2;return function getMouseOnScreen(pageX,pageY){vector.set((pageX-_this.screen.left)/_this.screen.width,(pageY-_this.screen.top)/_this.screen.height);return vector}}();_this2.zoomCamera=function(){if(_state===STATE.TOUCH_ZOOM_PAN){var factor=_touchZoomDistanceEnd/_touchZoomDistanceStart;_touchZoomDistanceStart=_touchZoomDistanceEnd;_this.object.zoom*=factor;_changed=true}else{var factor=1+(_zoomEnd.y-_zoomStart.y)*_this.zoomSpeed;if(Math.abs(factor-1)>EPS&&factor>0){_this.object.zoom/=factor;if(_this.staticMoving){_zoomStart.copy(_zoomEnd)}else{_zoomStart.y+=(_zoomEnd.y-_zoomStart.y)*this.dynamicDampingFactor}_changed=true}}};_this2.panCamera=function(){var mouseChange=new THREE.Vector2,objectUp=new THREE.Vector3,pan=new THREE.Vector3;return function panCamera(){mouseChange.copy(_panEnd).sub(_panStart);if(mouseChange.lengthSq()){var scale_x=(_this.object.right-_this.object.left)/_this.object.zoom;var scale_y=(_this.object.top-_this.object.bottom)/_this.object.zoom;mouseChange.x*=scale_x;mouseChange.y*=scale_y;pan.copy(_eye).cross(_this.object.up).setLength(mouseChange.x);pan.add(objectUp.copy(_this.object.up).setLength(mouseChange.y));_this.object.position.add(pan);_this.target.add(pan);if(_this.staticMoving){_panStart.copy(_panEnd)}else{_panStart.add(mouseChange.subVectors(_panEnd,_panStart).multiplyScalar(_this.dynamicDampingFactor))}_changed=true}}}();_this2.update=function(){_eye.subVectors(_this.object.position,_this.target);if(!_this.noZoom){_this.zoomCamera();if(_changed){_this.object.updateProjectionMatrix()}}if(!_this.noPan){_this.panCamera()}_this.object.position.addVectors(_this.target,_eye);_this.object.lookAt(_this.target);if(_changed){_this.dispatchEvent(changeEvent);_changed=false}};_this2.reset=function(){_state=STATE.NONE;_prevState=STATE.NONE;_this.target.copy(_this.target0);_this.object.position.copy(_this.position0);_this.object.up.copy(_this.up0);_eye.subVectors(_this.object.position,_this.target);_this.object.left=_this.left0;_this.object.right=_this.right0;_this.object.top=_this.top0;_this.object.bottom=_this.bottom0;_this.object.lookAt(_this.target);_this.dispatchEvent(changeEvent);_changed=false};function keydown(event){if(_this.enabled===false)return;window.removeEventListener("keydown",keydown);_prevState=_state;if(_state!==STATE.NONE){return}else if(event.keyCode===_this.keys[STATE.ROTATE]&&!_this.noRotate){_state=STATE.ROTATE}else if(event.keyCode===_this.keys[STATE.ZOOM]&&!_this.noZoom){_state=STATE.ZOOM}else if(event.keyCode===_this.keys[STATE.PAN]&&!_this.noPan){_state=STATE.PAN}}function keyup(event){if(_this.enabled===false)return;_state=_prevState;window.addEventListener("keydown",keydown,false)}function mousedown(event){if(_this.enabled===false)return;event.preventDefault();event.stopPropagation();if(_state===STATE.NONE){_state=event.button}if(_state===STATE.ROTATE&&!_this.noRotate){}else if(_state===STATE.ZOOM&&!_this.noZoom){_zoomStart.copy(getMouseOnScreen(event.pageX,event.pageY));_zoomEnd.copy(_zoomStart)}else if(_state===STATE.PAN&&!_this.noPan){_panStart.copy(getMouseOnScreen(event.pageX,event.pageY));_panEnd.copy(_panStart)}document.addEventListener("mousemove",mousemove,false);document.addEventListener("mouseup",mouseup,false);_this.dispatchEvent(startEvent)}function mousemove(event){if(_this.enabled===false)return;event.preventDefault();event.stopPropagation();if(_state===STATE.ROTATE&&!_this.noRotate){}else if(_state===STATE.ZOOM&&!_this.noZoom){_zoomEnd.copy(getMouseOnScreen(event.pageX,event.pageY))}else if(_state===STATE.PAN&&!_this.noPan){_panEnd.copy(getMouseOnScreen(event.pageX,event.pageY))}}function mouseup(event){if(_this.enabled===false)return;event.preventDefault();event.stopPropagation();_state=STATE.NONE;document.removeEventListener("mousemove",mousemove);document.removeEventListener("mouseup",mouseup);_this.dispatchEvent(endEvent)}function mousewheel(event){if(_this.enabled===false)return;event.preventDefault();event.stopPropagation();var delta=0;if(event.wheelDelta){delta=event.wheelDelta/40}else if(event.detail){delta=-event.detail/3}_this.dispatchEvent({type:"OnScroll",delta:delta});_this.dispatchEvent(startEvent);_this.dispatchEvent(endEvent)}function touchstart(event){if(_this.enabled===false)return;switch(event.touches.length){case 1:_state=STATE.TOUCH_ROTATE;break;case 2:_state=STATE.TOUCH_ZOOM_PAN;var dx=event.touches[0].pageX-event.touches[1].pageX;var dy=event.touches[0].pageY-event.touches[1].pageY;_touchZoomDistanceEnd=_touchZoomDistanceStart=Math.sqrt(dx*dx+dy*dy);var x=(event.touches[0].pageX+event.touches[1].pageX)/2;var y=(event.touches[0].pageY+event.touches[1].pageY)/2;_panStart.copy(getMouseOnScreen(x,y));_panEnd.copy(_panStart);break;default:_state=STATE.NONE}_this.dispatchEvent(startEvent)}function touchmove(event){if(_this.enabled===false)return;event.preventDefault();event.stopPropagation();switch(event.touches.length){case 1:break;case 2:var dx=event.touches[0].pageX-event.touches[1].pageX;var dy=event.touches[0].pageY-event.touches[1].pageY;_touchZoomDistanceEnd=Math.sqrt(dx*dx+dy*dy);var x=(event.touches[0].pageX+event.touches[1].pageX)/2;var y=(event.touches[0].pageY+event.touches[1].pageY)/2;_panEnd.copy(getMouseOnScreen(x,y));break;default:_state=STATE.NONE}}function touchend(event){if(_this.enabled===false)return;switch(event.touches.length){case 1:break;case 2:_touchZoomDistanceStart=_touchZoomDistanceEnd=0;var x=(event.touches[0].pageX+event.touches[1].pageX)/2;var y=(event.touches[0].pageY+event.touches[1].pageY)/2;_panEnd.copy(getMouseOnScreen(x,y));_panStart.copy(_panEnd);break}_state=STATE.NONE;_this.dispatchEvent(endEvent)}function contextmenu(event){event.preventDefault()}_this2.dispose=function(){this.domElement.removeEventListener("contextmenu",contextmenu,false);this.domElement.removeEventListener("mousedown",mousedown,false);this.domElement.removeEventListener("mousewheel",mousewheel,false);this.domElement.removeEventListener("MozMousePixelScroll",mousewheel,false);this.domElement.removeEventListener("touchstart",touchstart,false);this.domElement.removeEventListener("touchend",touchend,false);this.domElement.removeEventListener("touchmove",touchmove,false);document.removeEventListener("mousemove",mousemove,false);document.removeEventListener("mouseup",mouseup,false);window.removeEventListener("keydown",keydown,false);window.removeEventListener("keyup",keyup,false)};_this2.domElement.addEventListener("contextmenu",contextmenu,false);_this2.domElement.addEventListener("mousedown",mousedown,false);_this2.domElement.addEventListener("mousewheel",mousewheel,false);_this2.domElement.addEventListener("MozMousePixelScroll",mousewheel,false);_this2.domElement.addEventListener("touchstart",touchstart,false);_this2.domElement.addEventListener("touchend",touchend,false);_this2.domElement.addEventListener("touchmove",touchmove,false);window.addEventListener("keydown",keydown,false);window.addEventListener("keyup",keyup,false);_this2.handleResize();_this2.update();return _this2}return Trackballortho}(THREE.EventDispatcher);exports.default=Trackballortho},{}],92:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var _createClass=function(){function defineProperties(target,props){for(var i=0;i=bbox.min.x-epsilon&&point.y>=bbox.min.y-epsilon&&point.z>=bbox.min.z-epsilon&&point.x<=bbox.max.x+epsilon&&point.y<=bbox.max.y+epsilon&&point.z<=bbox.max.z+epsilon){return true}return false}},{key:"posdir",value:function posdir(position,direction){return{position:position,direction:direction}}},{key:"validatePlane",value:function validatePlane(plane){if(plane===null){window.console.log("Invalid plane.");window.console.log(plane);return false}if(!_core4.default.vector3(plane.position)){window.console.log("Invalid plane.position.");window.console.log(plane.position);return false}if(!_core4.default.vector3(plane.direction)){window.console.log("Invalid plane.direction.");window.console.log(plane.direction);return false}return true}},{key:"validateAabb",value:function validateAabb(aabb){if(aabb===null){window.console.log("Invalid aabb.");window.console.log(aabb);return false}if(!_core4.default.matrix4(aabb.toAABB)){window.console.log("Invalid aabb.toAABB: ");window.console.log(aabb.toAABB);return false}if(!_core4.default.vector3(aabb.center)){window.console.log("Invalid aabb.center.");window.console.log(aabb.center);return false}if(!(_core4.default.vector3(aabb.halfDimensions)&&aabb.halfDimensions.x>=0&&aabb.halfDimensions.y>=0&&aabb.halfDimensions.z>=0)){window.console.log("Invalid aabb.halfDimensions.");window.console.log(aabb.halfDimensions);return false}return true}}]);return Intersections}();exports.default=Intersections},{"./core.utils":95,"./core.validators":96}],93:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var _core=require("./core.intersections");var _core2=_interopRequireDefault(_core);var _core3=require("./core.pack");var _core4=_interopRequireDefault(_core3);var _core5=require("./core.validators");var _core6=_interopRequireDefault(_core5);var _core7=require("./core.utils");var _core8=_interopRequireDefault(_core7);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}exports.default={Intersections:_core2.default,Utils:_core8.default,Validators:_core6.default}},{"./core.intersections":92,"./core.pack":94,"./core.utils":95,"./core.validators":96}],94:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}var Pack=function Pack(){_classCallCheck(this,Pack)};exports.default=Pack},{}],95:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var _createClass=function(){function defineProperties(target,props){for(var i=0;i=0&&halfDimensions.y>=0&&halfDimensions.z>=0)){window.console.log("halfDimensions must be >= 0.");window.console.log(halfDimensions);return false}var min=center.clone().sub(halfDimensions);var max=center.clone().add(halfDimensions);return{min:min,max:max}}},{key:"minMaxPixelData",value:function minMaxPixelData(){var pixelData=arguments.length>0&&arguments[0]!==undefined?arguments[0]:[];var minMax=[65535,-32768];var numPixels=pixelData.length;for(var index=0;index=0&&objectToTest.halfDimensions.y>=0&&objectToTest.halfDimensions.z>=0)){return false}return true}},{key:"ray",value:function ray(objectToTest){if(!(objectToTest!==null&&typeof objectToTest!=="undefined"&&objectToTest.hasOwnProperty("position")&&this.vector3(objectToTest.position)&&objectToTest.hasOwnProperty("direction")&&this.vector3(objectToTest.direction))){return false}return true}}]);return Validators}();exports.default=Validators},{}],97:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var _geometries=require("./geometries.slice");var _geometries2=_interopRequireDefault(_geometries);var _geometries3=require("./geometries.voxel");var _geometries4=_interopRequireDefault(_geometries3);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}exports.default={Slice:_geometries2.default,Voxel:_geometries4.default}},{"./geometries.slice":98,"./geometries.voxel":99}],98:[function(require,module,exports){"use strict";var _typeof=typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"?function(obj){return typeof obj}:function(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol?"symbol":typeof obj};Object.defineProperty(exports,"__esModule",{value:true});var _createClass=function(){function defineProperties(target,props){for(var i=0;i4&&arguments[4]!==undefined?arguments[4]:new THREE.Matrix4;_classCallCheck(this,GeometriesSlice);var aabb={halfDimensions:halfDimensions,center:center,toAABB:toAABB};var plane={position:position,direction:direction};var intersections=_core2.default.aabbPlane(aabb,plane);if(intersections.length<3){window.console.log("WARNING: Less than 3 intersections between AABB and Plane.");window.console.log("AABB");window.console.log(aabb);window.console.log("Plane");window.console.log(plane);window.console.log("exiting...");throw"geometries.slice has less than 3 intersections, can not create a valid geometry."}var orderedIntersections=GeometriesSlice.orderIntersections(intersections,direction);var sliceShape=GeometriesSlice.shape(orderedIntersections);var _this=_possibleConstructorReturn(this,(GeometriesSlice.__proto__||Object.getPrototypeOf(GeometriesSlice)).call(this,sliceShape));_this.type="SliceGeometry";_this.vertices=orderedIntersections;_this.verticesNeedUpdate=true;return _this}_createClass(GeometriesSlice,null,[{key:"shape",value:function shape(points){var shape=new THREE.Shape;shape.moveTo(points[0].xy.x,points[0].xy.y);for(var l=1;l1&&arguments[1]!==undefined?arguments[1]:"default";var lutO=arguments.length>2&&arguments[2]!==undefined?arguments[2]:"linear";var color=arguments.length>3&&arguments[3]!==undefined?arguments[3]:[[0,0,0,0],[1,1,1,1]];var opacity=arguments.length>4&&arguments[4]!==undefined?arguments[4]:[[0,0],[1,1]];_classCallCheck(this,HelpersLut);this._containerID=containerID;this._color=color;this._lut=lut;this._luts=_defineProperty({},lut,color);this._opacity=opacity;this._lutO=lutO;this._lutsO=_defineProperty({},lutO,opacity);this.initCanvas();this.paintCanvas()}_createClass(HelpersLut,[{key:"initCanvas",value:function initCanvas(){this._canvasContainer=this.initCanvasContainer(this._containerID);this._canvasBg=this.createCanvas();this._canvasContainer.appendChild(this._canvasBg);this._canvas=this.createCanvas();this._canvasContainer.appendChild(this._canvas)}},{key:"initCanvasContainer",value:function initCanvasContainer(canvasContainerId){var canvasContainer=document.getElementById(canvasContainerId);canvasContainer.style.width="256 px";canvasContainer.style.height="128 px";canvasContainer.style.border="1px solid #F9F9F9";return canvasContainer}},{key:"createCanvas",value:function createCanvas(){var canvas=document.createElement("canvas");canvas.height=16;canvas.width=256;return canvas}},{key:"paintCanvas",value:function paintCanvas(){var ctx=this._canvas.getContext("2d");ctx.clearRect(0,0,this._canvas.width,this._canvas.height);ctx.globalCompositeOperation="source-over";var color=ctx.createLinearGradient(0,0,this._canvas.width,this._canvas.height);for(var i=0;i0&&arguments[0]!==undefined?arguments[0]:"color";var available=[];var luts=this._luts;if(type!=="color"){luts=this._lutsO}for(var i in luts){available.push(i)}return available}},{key:"texture",get:function get(){var texture=new THREE.Texture(this._canvas);texture.mapping=THREE.UVMapping;texture.wrapS=texture.wrapT=THREE.ClampToEdgeWrapping;texture.magFilter=texture.minFilter=THREE.NearestFilter;texture.premultiplyAlpha=true;texture.needsUpdate=true;return texture}},{key:"lut",set:function set(targetLUT){ -this._color=this._luts[targetLUT];this._lut=targetLUT;this.paintCanvas()},get:function get(){return this._lut}},{key:"luts",set:function set(newLuts){this._luts=newLuts},get:function get(){return this._luts}},{key:"lutO",set:function set(targetLUTO){this._opacity=this._lutsO[targetLUTO];this._lutO=targetLUTO;this.paintCanvas()},get:function get(){return this._lutO}},{key:"lutsO",set:function set(newLutsO){this._lutsO=newLutsO},get:function get(){return this._lutsO}}],[{key:"presetLuts",value:function presetLuts(){return{default:[[0,0,0,0],[1,1,1,1]],spectrum:[[0,0,0,0],[.1,0,0,1],[.33,0,1,1],[.5,0,1,0],[.66,1,1,0],[.9,1,0,0],[1,1,1,1]],hot_and_cold:[[0,0,0,1],[.15,0,1,1],[.3,0,1,0],[.45,0,0,0],[.5,0,0,0],[.55,0,0,0],[.7,1,1,0],[.85,1,0,0],[1,1,1,1]],gold:[[0,0,0,0],[.13,.19,.03,0],[.25,.39,.12,0],[.38,.59,.26,0],[.5,.8,.46,.08],[.63,.99,.71,.21],[.75,.99,.88,.34],[.88,.99,.99,.48],[1,.9,.95,.61]],red:[[0,.75,0,0],[.5,1,.5,0],[.95,1,1,0],[1,1,1,1]],green:[[0,0,.75,0],[.5,.5,1,0],[.95,1,1,0],[1,1,1,1]],blue:[[0,0,0,1],[.5,0,.5,1],[.95,0,1,1],[1,1,1,1]],walking_dead:[[0,.1,1,1],[1,1,1,1]],random:[[0,0,0,0],[.27,.18,.18,.18],[.41,1,1,1],[.7,1,0,0],[1,1,1,1]]}}},{key:"presetLutsO",value:function presetLutsO(){return{linear:[[0,0],[1,1]],lowpass:[[0,.8],[.2,.6],[.3,.1],[1,0]],bandpass:[[0,0],[.4,.8],[.6,.8],[1,0]],highpass:[[0,0],[.7,.1],[.8,.6],[1,.8]],flat:[[0,.7],[1,1]],random:[[0,0],[.38,0],[.55,1],[.72,1],[1,.05]]}}}]);return HelpersLut}();exports.default=HelpersLut},{}],104:[function(require,module,exports){"use strict";var _typeof=typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"?function(obj){return typeof obj}:function(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol?"symbol":typeof obj};Object.defineProperty(exports,"__esModule",{value:true});var _createClass=function(){function defineProperties(target,props){for(var i=0;i0){progressContainers[0].parentNode.removeChild(progressContainers[0])}progressContainers=null;window.cancelAnimationFrame(this.requestAnimationFrameID)}},{key:"init",value:function init(){var progressContainer=this._domContainer();for(var mode in this._modes){if(this._modes.hasOwnProperty(mode)){var bar=this._domBar(this._modes[mode]);progressContainer.appendChild(bar);bar=null}}this._container.appendChild(progressContainer);progressContainer=null;this.updateUI()}},{key:"update",value:function update(value,total,mode){this._mode=mode;this._value=value;if(total===0){this._total=value;this._value=Math.random()*value}else{this._total=total}}},{key:"updateUI",value:function updateUI(){var _this=this;this.requestAnimationFrameID=requestAnimationFrame(function(){_this.updateUI()});if(!(this._modes.hasOwnProperty(this._mode)&&this._modes[this._mode].hasOwnProperty("name")&&this._modes[this._mode].hasOwnProperty("color"))){return false}var message="";var progress=Math.round(this._value/this._total*100);var color=this._modes[this._mode].color;var progressBar=this._container.getElementsByClassName("progress "+this._modes[this._mode].name);if(progressBar.length>0){progressBar[0].style.borderColor=color;progressBar[0].style.width=progress+"%"}progressBar=null}},{key:"_domContainer",value:function _domContainer(){var container=document.createElement("div");container.classList.add("progress");container.classList.add("container");container.style.width="100%";container.style.height="8px";container.style.position="absolute";container.style.backgroundColor="rgba(158, 158, 158, 0.5)";container.style.top="0";container.style.zIndex="1";return container}},{key:"_domBar",value:function _domBar(mode){if(!(mode.hasOwnProperty("name")&&mode.hasOwnProperty("color"))){window.console.log("Invalid mode provided.");window.console.log(mode);return false}var bar=document.createElement("div");bar.classList.add(mode.name);bar.classList.add("progress");bar.style.border="2px solid "+mode.color;bar.style.width="0%";return bar}}]);return HelpersProgressBar}();exports.default=HelpersProgressBar},{}],106:[function(require,module,exports){"use strict";var _typeof=typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"?function(obj){return typeof obj}:function(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol?"symbol":typeof obj};Object.defineProperty(exports,"__esModule",{value:true});var _createClass=function(){function defineProperties(target,props){for(var i=0;i1&&arguments[1]!==undefined?arguments[1]:0;var position=arguments.length>2&&arguments[2]!==undefined?arguments[2]:new THREE.Vector3(0,0,0);var direction=arguments.length>3&&arguments[3]!==undefined?arguments[3]:new THREE.Vector3(0,0,1);var aabbSpace=arguments.length>4&&arguments[4]!==undefined?arguments[4]:"IJK";_classCallCheck(this,HelpersSlice);var _this=_possibleConstructorReturn(this,(HelpersSlice.__proto__||Object.getPrototypeOf(HelpersSlice)).call(this));_this._stack=stack;_this._invert=_this._stack.invert;_this._lut="none";_this._lutTexture=null;_this._intensityAuto=true;_this._interpolation=1;_this._index=index;_this._windowWidth=null;_this._windowCenter=null;_this._rescaleSlope=null;_this._rescaleIntercept=null;_this._planePosition=position;_this._planeDirection=direction;_this._aaBBspace=aabbSpace;_this._material=null;_this._textures=[];_this._shadersFragment=_shadersData6.default;_this._shadersVertex=_shadersData4.default;_this._uniforms=_shadersData2.default.uniforms();_this._geometry=null;_this._mesh=null;_this._visible=true;_this._init();_this._create();return _this}_createClass(HelpersSlice,[{key:"_init",value:function _init(){if(!this._stack||!this._stack._prepared||!this._stack._packed){return}if(this._aaBBspace==="IJK"){this._halfDimensions=this._stack.halfDimensionsIJK;this._center=new THREE.Vector3(this._stack.halfDimensionsIJK.x-.5,this._stack.halfDimensionsIJK.y-.5,this._stack.halfDimensionsIJK.z-.5);this._toAABB=new THREE.Matrix4}else{var aaBBox=this._stack.AABBox();this._halfDimensions=aaBBox.clone().multiplyScalar(.5);this._center=this._stack.centerAABBox();this._toAABB=this._stack.lps2AABB}}},{key:"_create",value:function _create(){if(!this._stack||!this._stack.prepared||!this._stack.packed){return}try{this._geometry=new _geometries2.default(this._halfDimensions,this._center,this._planePosition,this._planeDirection,this._toAABB)}catch(e){window.console.log(e);window.console.log("invalid slice geometry - exiting...");return}if(!this._geometry.vertices){return}if(!this._material){this._uniforms.uTextureSize.value=this._stack.textureSize;this._uniforms.uDataDimensions.value=[this._stack.dimensionsIJK.x,this._stack.dimensionsIJK.y,this._stack.dimensionsIJK.z];this._uniforms.uWorldToData.value=this._stack.lps2IJK;this._uniforms.uNumberOfChannels.value=this._stack.numberOfChannels;this._uniforms.uPixelType.value=this._stack.pixelType;this._uniforms.uBitsAllocated.value=this._stack.bitsAllocated;this._uniforms.uPackedPerPixel.value=this._stack.packedPerPixel;this._prepareTexture();this._uniforms.uTextureContainer.value=this._textures;this._createMaterial({side:THREE.DoubleSide})}this.updateIntensitySettings();this.updateIntensitySettingsUniforms();this._mesh=new THREE.Mesh(this._geometry,this._material);if(this._aaBBspace==="IJK"){this._mesh.applyMatrix(this._stack.ijk2LPS)}this._mesh.visible=this._visible;this.add(this._mesh)}},{key:"updateIntensitySettings",value:function updateIntensitySettings(){if(this._intensityAuto){this.updateIntensitySetting("windowCenter");this.updateIntensitySetting("windowWidth");this.updateIntensitySetting("rescaleSlope");this.updateIntensitySetting("rescaleIntercept")}else{if(this._windowCenter===null){this._windowCenter=this._stack.windowCenter}if(this.__windowWidth===null){this._windowWidth=this._stack.windowWidth}if(this._rescaleSlope===null){this._rescaleSlope=this._stack.rescaleSlope}if(this._rescaleIntercept===null){this._rescaleIntercept=this._stack.rescaleIntercept}}}},{key:"updateIntensitySettingsUniforms",value:function updateIntensitySettingsUniforms(){this._uniforms.uRescaleSlopeIntercept.value=[this._rescaleSlope,this._rescaleIntercept];this._uniforms.uWindowCenterWidth.value=[this._windowCenter,this._windowWidth];this._uniforms.uInvert.value=this._invert===true?1:0;this._uniforms.uInterpolation.value=this._interpolation;if(this._lut==="none"){this._uniforms.uLut.value=0}else{this._uniforms.uLut.value=1;this._uniforms.uTextureLUT.value=this._lutTexture}}},{key:"updateIntensitySetting",value:function updateIntensitySetting(setting){if(this._stack.frame[this._index]&&this._stack.frame[this._index][setting]){this["_"+setting]=this._stack.frame[this._index][setting]}else{this["_"+setting]=this._stack[setting]}}},{key:"_update",value:function _update(){if(this._mesh){this.remove(this._mesh);this._mesh.geometry.dispose();this._mesh.geometry=null;this._mesh=null}this._create()}},{key:"stack",get:function get(){return this._stack},set:function set(stack){this._stack=stack}},{key:"windowWidth",get:function get(){return this._windowWidth},set:function set(windowWidth){this._windowWidth=windowWidth;this.updateIntensitySettingsUniforms()}},{key:"windowCenter",get:function get(){return this._windowCenter},set:function set(windowCenter){this._windowCenter=windowCenter;this.updateIntensitySettingsUniforms()}},{key:"rescaleSlope",get:function get(){return this._rescaleSlope},set:function set(rescaleSlope){this._rescaleSlope=rescaleSlope;this.updateIntensitySettingsUniforms()}},{key:"rescaleIntercept",get:function get(){return this._rescaleIntercept},set:function set(rescaleIntercept){this._rescaleIntercept=rescaleIntercept;this.updateIntensitySettingsUniforms()}},{key:"invert",get:function get(){return this._invert},set:function set(invert){this._invert=invert;this.updateIntensitySettingsUniforms()}},{key:"lut",get:function get(){return this._lut},set:function set(lut){this._lut=lut}},{key:"lutTexture",get:function get(){return this._lutTexture},set:function set(lutTexture){this._lutTexture=lutTexture;this.updateIntensitySettingsUniforms()}},{key:"intensityAuto",get:function get(){return this._intensityAuto},set:function set(intensityAuto){this._intensityAuto=intensityAuto;this.updateIntensitySettings();this.updateIntensitySettingsUniforms()}},{key:"interpolation",get:function get(){return this._interpolation},set:function set(interpolation){this._interpolation=interpolation;this.updateIntensitySettingsUniforms();this._updateMaterial()}},{key:"index",get:function get(){return this._index},set:function set(index){this._index=index;this._update()}},{key:"planePosition",set:function set(position){this._planePosition=position;this._update()},get:function get(){return this._planePosition}},{key:"planeDirection",set:function set(direction){this._planeDirection=direction;this._update()},get:function get(){return this._planeDirection}},{key:"halfDimensions",set:function set(halfDimensions){this._halfDimensions=halfDimensions},get:function get(){return this._halfDimensions}},{key:"center",set:function set(center){this._center=center},get:function get(){return this._center}},{key:"aabbSpace",set:function set(aabbSpace){this._aaBBspace=aabbSpace;this._init()},get:function get(){return this._aaBBspace}},{key:"mesh",set:function set(mesh){this._mesh=mesh},get:function get(){return this._mesh}},{key:"geometry",set:function set(geometry){this._geometry=geometry},get:function get(){return this._geometry}}]);return HelpersSlice}((0,_helpersMaterial2.default)(THREE.Object3D));exports.default=HelpersSlice},{"../../src/geometries/geometries.slice":98,"../../src/helpers/helpers.material.mixin":104,"../../src/shaders/shaders.data.fragment":131,"../../src/shaders/shaders.data.uniform":132,"../../src/shaders/shaders.data.vertex":133}],107:[function(require,module,exports){"use strict";var _typeof=typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"?function(obj){return typeof obj}:function(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol?"symbol":typeof obj};Object.defineProperty(exports,"__esModule",{value:true});var _createClass=function(){function defineProperties(target,props){for(var i=0;i=dimensions||this._index<0){this._outOfBounds=true}else{this._outOfBounds=false}}},{key:"_prepareStack",value:function _prepareStack(){if(!this._stack.prepared){this._stack.prepare()}if(!this._stack.packed){this._stack.pack()}}},{key:"_prepareBBox",value:function _prepareBBox(){this._bBox=new _helpers4.default(this._stack);this.add(this._bBox)}},{key:"_prepareBorder",value:function _prepareBorder(){this._border=new _helpers2.default(this._slice);this.add(this._border)}},{key:"_prepareSlice",value:function _prepareSlice(){var halfDimensionsIJK=this._stack.halfDimensionsIJK;this._index=this._prepareSliceIndex(halfDimensionsIJK);var position=this._prepareSlicePosition(halfDimensionsIJK,this._index);var direction=this._prepareDirection(this._orientation);this._slice=new _helpers6.default(this._stack,this._index,position,direction);this.add(this._slice)}},{key:"_prepareSliceIndex",value:function _prepareSliceIndex(indices){var index=0;switch(this._orientation){case 0:index=Math.floor(indices.z);break;case 1:index=Math.floor(indices.x);break;case 2:index=Math.floor(indices.y);break;default:break}return index}},{key:"_prepareSlicePosition",value:function _prepareSlicePosition(rPosition,index){var position=new THREE.Vector3(0,0,0);switch(this._orientation){case 0:position=new THREE.Vector3(Math.floor(rPosition.x),Math.floor(rPosition.y),index);break;case 1:position=new THREE.Vector3(index,Math.floor(rPosition.y),Math.floor(rPosition.z));break;case 2:position=new THREE.Vector3(Math.floor(rPosition.x),index,Math.floor(rPosition.z));break;default:break}return position}},{key:"_prepareDirection",value:function _prepareDirection(orientation){var direction=new THREE.Vector3(0,0,1);switch(orientation){case 0:direction=new THREE.Vector3(0,0,1);break;case 1:direction=new THREE.Vector3(1,0,0);break;case 2:direction=new THREE.Vector3(0,1,0);break;default:break}return direction}},{key:"stack",get:function get(){return this._stack}},{key:"bbox",get:function get(){return this._bBox}},{key:"slice",get:function get(){return this._slice}},{key:"border",get:function get(){return this._border}},{key:"index",get:function get(){return this._index},set:function set(index){this._index=index;this._slice.index=index;var halfDimensions=this._stack.halfDimensionsIJK;this._slice.planePosition=this._prepareSlicePosition(halfDimensions,this._index);this._border.helpersSlice=this._slice;this._isIndexOutOfBounds()}},{key:"orientation",set:function set(orientation){this._orientation=orientation;this._slice.planeDirection=this._prepareDirection(this._orientation);this._border.helpersSlice=this._slice},get:function get(){return this._orientation}},{key:"outOfBounds",set:function set(outOfBounds){this._outOfBounds=outOfBounds},get:function get(){return this._outOfBounds}}]);return HelpersStack}(THREE.Object3D);exports.default=HelpersStack},{"../../src/helpers/helpers.border":100,"../../src/helpers/helpers.boundingbox":101,"../../src/helpers/helpers.slice":106}],108:[function(require,module,exports){"use strict";var _typeof=typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"?function(obj){return typeof obj}:function(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol?"symbol":typeof obj};Object.defineProperty(exports,"__esModule",{value:true});var _createClass=function(){function defineProperties(target,props){for(var i=0;i0&&arguments[0]!==undefined?arguments[0]:null;var stack=arguments.length>1&&arguments[1]!==undefined?arguments[1]:null;_classCallCheck(this,HelpersVoxel);var _this=_possibleConstructorReturn(this,(HelpersVoxel.__proto__||Object.getPrototypeOf(HelpersVoxel)).call(this));_this._stack=stack;_this._worldCoordinates=worldCoordinates;_this._voxel=new _models4.default; -_this._voxel.id=_this.id;_this._voxel.worldCoordinates=_this._worldCoordinates;if(_this._stack&&_this._stack.prepared&&_this._worldCoordinates){_this.updateVoxel(_this._worldCoordinates)}_this._mesh=null;_this._geometry=null;_this._material=null;_this._selected=false;_this._active=false;_this._hover=false;_this._distance=null;_this._showVoxel=true;_this._showDomSVG=true;_this._showDomMeasurements=true;_this._color="#00B0FF";_this._svgPointer=' ';_this.createMesh();return _this}_createClass(HelpersVoxel,[{key:"updateVoxel",value:function updateVoxel(worldCoordinates){this._voxel.worldCoordinates=worldCoordinates;this._voxel.dataCoordinates=_models2.default.worldToData(this._stack,this._voxel.worldCoordinates);var value=_models2.default.value(this._stack,this._voxel.dataCoordinates);this._voxel.value=_models2.default.valueRescaleSlopeIntercept(value,this._stack.rescaleSlope,this._stack.rescaleIntercept)}},{key:"updateVoxelScreenCoordinates",value:function updateVoxelScreenCoordinates(camera,container){this._voxel.screenCoordinates=HelpersVoxel.worldToScreen(this._worldCoordinates,camera,container)}},{key:"createMesh",value:function createMesh(){var dataCoordinates=_models2.default.worldToData(this._stack,this._worldCoordinates);this._geometry=new _geometries2.default(dataCoordinates);this._material=new THREE.MeshBasicMaterial({wireframe:true,wireframeLinewidth:2});this._material.color.set(this._color);this._mesh=new THREE.Mesh(this._geometry,this._material);this._mesh.applyMatrix(this._stack.ijk2LPS);this._mesh.visible=this._showVoxel;this.add(this._mesh)}},{key:"createDom",value:function createDom(){var measurementsContainer=this._createDiv("VJSVoxelMeasurements",this.id,"VJSVoxelMeasurements");var rasContainer=this._createDiv("VJSVoxelProbeWorld",this.id,"VJSVoxelProbeWorld");measurementsContainer.appendChild(rasContainer);var ijkContainer=this._createDiv("VJSVoxelProbeData",this.id,"VJSVoxelProbeData");measurementsContainer.appendChild(ijkContainer);var valueContainer=this._createDiv("VJSVoxelProbeValue",this.id,"VJSVoxelProbeValue");measurementsContainer.appendChild(valueContainer);var svgContainer=this._createDiv("VJSVoxelProbeSVG",this.id,"VJSVoxelProbeSVG");svgContainer.innerHTML=this._svgPointer;var domElement=this._createDiv("VJSWidgetVoxelProbe",this.id,"VJSWidgetVoxelProbe");domElement.appendChild(svgContainer);domElement.appendChild(measurementsContainer);return domElement}},{key:"updateDom",value:function updateDom(container){if(document.getElementById("VJSVoxelProbeWorld"+this.id)===null){container.appendChild(this.createDom())}var rasContainer=document.getElementById("VJSVoxelProbeWorld"+this.id);var rasContent=this._voxel.worldCoordinates.x.toFixed(2)+" : "+this._voxel.worldCoordinates.y.toFixed(2)+" : "+this._voxel.worldCoordinates.z.toFixed(2);rasContainer.innerHTML="LPS: "+rasContent;var ijkContainer=document.getElementById("VJSVoxelProbeData"+this.id);var ijkContent=this._voxel.dataCoordinates.x+" : "+this._voxel.dataCoordinates.y+" : "+this._voxel.dataCoordinates.z;ijkContainer.innerHTML="IJK: "+ijkContent;var valueContainer=document.getElementById("VJSVoxelProbeValue"+this.id);var valueContent=this._voxel.value;valueContainer.innerHTML="Value: "+valueContent;var selectedElement=document.getElementById("VJSWidgetVoxelProbe"+this.id);selectedElement.style.top=this._voxel.screenCoordinates.y;selectedElement.style.left=this._voxel.screenCoordinates.x;this.updateDomClass(selectedElement)}},{key:"updateDomClass",value:function updateDomClass(){var element=document.getElementById("VJSWidgetVoxelProbe"+this.id);if(this._active===true){element.classList.add("VJSVoxelProbeActive")}else{element.classList.remove("VJSVoxelProbeActive")}if(this._hover===true){element.classList.add("VJSVoxelProbeHover")}else{element.classList.remove("VJSVoxelProbeHover")}if(this._selected===true){element.classList.add("VJSVoxelProbeSelect")}else{element.classList.remove("VJSVoxelProbeSelect")}this.updateDomElementDisplay("VJSVoxelMeasurements"+this.id,this._showDomMeasurements);this.updateDomElementDisplay("VJSVoxelProbeSVG"+this.id,this._showDomSVG)}},{key:"updateDomElementDisplay",value:function updateDomElementDisplay(id,show){if(show){document.getElementById(id).style.display="block"}else{document.getElementById(id).style.display="none"}}},{key:"removeTest",value:function removeTest(){var node=document.getElementById("VJSWidgetVoxelProbe"+this.id);if(node.parentNode){node.parentNode.removeChild(node)}this.remove(this._mesh);this._mesh.geometry.dispose();this._mesh.material.dispose();this._mesh=null}},{key:"_createDiv",value:function _createDiv(idPrefix,idSuffix,className){var divContainer=document.createElement("div");divContainer.setAttribute("id",idPrefix+idSuffix);divContainer.setAttribute("class",className);return divContainer}},{key:"color",set:function set(color){this._color=color;if(this._material){this._material.color.set(this._color)}var selectedElement=document.getElementById("VJSVoxelMeasurements"+this.id);if(selectedElement){selectedElement.style.borderColor=this._color.replace("0x","#")}selectedElement=document.querySelector("#VJSVoxelProbeSVG"+this.id+"> svg > path");if(selectedElement){selectedElement.style.stroke=this._color.replace("0x","#")}},get:function get(){return this._color}},{key:"worldCoordinates",set:function set(worldCoordinates){this._worldCoordinates=worldCoordinates;this._voxel._worldCoordinates=worldCoordinates;this.updateVoxel(this._worldCoordinates);if(this._mesh&&this._mesh.geometry){this._mesh.geometry.location=this._voxel.dataCoordinates}},get:function get(){return this._worldCoordinates}},{key:"voxel",get:function get(){return this._voxel},set:function set(voxel){this._voxel=voxel}},{key:"showVoxel",set:function set(showVoxel){this._showVoxel=showVoxel;if(this._mesh){this._mesh.visible=this._showVoxel}},get:function get(){return this._showVoxel}},{key:"showDomSVG",set:function set(showDomSVG){this._showDomSVG=showDomSVG;this.updateDomClass()},get:function get(){return this._showDomSVG}},{key:"showDomMeasurements",set:function set(showDomMeasurements){this._showDomMeasurements=showDomMeasurements;this.updateDomClass()},get:function get(){return this._showDomMeasurements}},{key:"distance",set:function set(distance){this._distance=distance},get:function get(){return this._distance}},{key:"selected",set:function set(selected){this._selected=selected},get:function get(){return this._selected}},{key:"hover",set:function set(hover){this._hover=hover},get:function get(){return this._hover}},{key:"active",set:function set(active){this._active=active},get:function get(){return this._active}}],[{key:"worldToScreen",value:function worldToScreen(worldCoordinate,camera,canvas){var screenCoordinates=worldCoordinate.clone();screenCoordinates.project(camera);screenCoordinates.x=Math.round((screenCoordinates.x+1)*canvas.offsetWidth/2);screenCoordinates.y=Math.round((-screenCoordinates.y+1)*canvas.offsetHeight/2);screenCoordinates.z=0;return screenCoordinates}}]);return HelpersVoxel}(THREE.Object3D);exports.default=HelpersVoxel},{"../../src/geometries/geometries.voxel":99,"../../src/models/models.stack":117,"../../src/models/models.voxel":118}],110:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var _createClass=function(){function defineProperties(target,props){for(var i=0;i0&&arguments[0]!==undefined?arguments[0]:document.body;var helpersProgress=arguments.length>1&&arguments[1]!==undefined?arguments[1]:_helpers2.default;_classCallCheck(this,LoadersBase);this._loaded=-1;this._totalLoaded=-1;this._parsed=-1;this._totalParsed=-1;this._container=container;this._helpersProgressBar=helpersProgress;this._progressBar=null;if(this._container&&this._helpersProgressBar){this._progressBar=new helpersProgress(this._container)}}_createClass(LoadersBase,[{key:"free",value:function free(){this._container=null;this._helpersProgressBar=null;if(this._progressBar){this._progressBar.free();this._progressBar=null}}},{key:"fetch",value:function fetch(url){var _this=this;return new Promise(function(resolve,reject){var request=new XMLHttpRequest;request.open("GET",url);request.crossOrigin=true;request.responseType="arraybuffer";request.onload=function(event){if(request.status===200){_this._loaded=event.loaded;_this._totalLoaded=event.total;if(_this._progressBar){_this._progressBar.update(_this._loaded,_this._totalLoaded,"load")}var buffer=request.response;var response={url:url,buffer:buffer};resolve(response)}else{reject(request.statusText)}};request.onerror=function(){reject(request.statusText)};request.onprogress=function(event){_this._loaded=event.loaded;_this._totalLoaded=event.total;if(_this._progressBar){_this._progressBar.update(_this._loaded,_this._totalLoaded,"load")}};request.send()})}}]);return LoadersBase}();exports.default=LoadersBase},{"../../src/helpers/helpers.progressbar":105,"../../src/models/models.frame":114,"../../src/models/models.series":116,"../../src/models/models.stack":117}],111:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var _loaders=require("./loaders.volume");var _loaders2=_interopRequireDefault(_loaders);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}exports.default={Volume:_loaders2.default}},{"./loaders.volume":112}],112:[function(require,module,exports){"use strict";var _typeof=typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"?function(obj){return typeof obj}:function(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol?"symbol":typeof obj};Object.defineProperty(exports,"__esModule",{value:true});var _createClass=function(){function defineProperties(target,props){for(var i=0;i0&&yCos.length()>0){cosines[0]=xCos;cosines[1]=yCos;cosines[2]=new THREE.Vector3(0,0,0).crossVectors(cosines[0],cosines[1]).normalize()}}else{window.console.log("No valid image orientation for frame");window.console.log(this);window.console.log("Returning default orientation.")}return cosines}},{key:"spacingXY",value:function spacingXY(){var spacingXY=[1,1];if(this.pixelSpacing){spacingXY[0]=this.pixelSpacing[0];spacingXY[1]=this.pixelSpacing[1]}else if(this.pixelAspectRatio){spacingXY[0]=1;spacingXY[1]=1*this.pixelAspectRatio[1]/this.pixelAspectRatio[0]}return spacingXY}},{key:"value",value:function value(column,row){return this.pixelData[column+this._columns*row]}},{key:"_compareArrays",value:function _compareArrays(reference,target){if(reference===target){return true}if(reference&&target&&reference.join()===target.join()){return true}return false}},{key:"rows",get:function get(){return this._rows},set:function set(rows){this._rows=rows}},{key:"columns",get:function get(){return this._columns},set:function set(columns){this._columns=columns}},{key:"spacingBetweenSlices",get:function get(){return this._spacingBetweenSlices},set:function set(spacingBetweenSlices){this._spacingBetweenSlices=spacingBetweenSlices}},{key:"sliceThickness",get:function get(){return this._sliceThickness},set:function set(sliceThickness){this._sliceThickness=sliceThickness}},{key:"imagePosition",get:function get(){return this._imagePosition},set:function set(imagePosition){this._imagePosition=imagePosition}},{key:"imageOrientation",get:function get(){return this._imageOrientation},set:function set(imageOrientation){this._imageOrientation=imageOrientation}},{key:"windowWidth",get:function get(){return this._windowWidth},set:function set(windowWidth){this._windowWidth=windowWidth}},{key:"windowCenter",get:function get(){return this._windowCenter},set:function set(windowCenter){this._windowCenter=windowCenter}},{key:"rescaleSlope",get:function get(){return this._rescaleSlope},set:function set(rescaleSlope){this._rescaleSlope=rescaleSlope}},{key:"rescaleIntercept",get:function get(){return this._rescaleIntercept},set:function set(rescaleIntercept){this._rescaleIntercept=rescaleIntercept}},{key:"bitsAllocated",get:function get(){return this._bitsAllocated},set:function set(bitsAllocated){this._bitsAllocated=bitsAllocated}},{key:"dist",get:function get(){return this._dist},set:function set(dist){this._dist=dist}},{key:"pixelSpacing",get:function get(){return this._pixelSpacing},set:function set(pixelSpacing){this._pixelSpacing=pixelSpacing}},{key:"pixelAspectRatio",get:function get(){return this._pixelAspectRatio},set:function set(pixelAspectRatio){this._pixelAspectRatio=pixelAspectRatio}},{key:"minMax",get:function get(){return this._minMax},set:function set(minMax){this._minMax=minMax}},{key:"dimensionIndexValues",get:function get(){return this._dimensionIndexValues},set:function set(dimensionIndexValues){this._dimensionIndexValues=dimensionIndexValues}},{key:"instanceNumber",get:function get(){return this._instanceNumber},set:function set(instanceNumber){this._instanceNumber=instanceNumber}},{key:"pixelData",get:function get(){return this._pixelData},set:function set(pixelData){this._pixelData=pixelData}},{key:"sopInstanceUID",set:function set(sopInstanceUID){this._sopInstanceUID=sopInstanceUID},get:function get(){return this._sopInstanceUID}},{key:"pixelType",get:function get(){return this._pixelType},set:function set(pixelType){this._pixelType=pixelType}},{key:"url",get:function get(){return this._url},set:function set(url){this._url=url}},{key:"referencedSegmentNumber",get:function get(){return this._referencedSegmentNumber},set:function set(referencedSegmentNumber){this._referencedSegmentNumber=referencedSegmentNumber}}]);return ModelsFrame}(_models2.default);exports.default=ModelsFrame},{"../../src/models/models.base":113}],115:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var _models=require("./models.frame");var _models2=_interopRequireDefault(_models);var _models3=require("./models.stack");var _models4=_interopRequireDefault(_models3);var _models5=require("./models.series");var _models6=_interopRequireDefault(_models5);var _models7=require("./models.voxel");var _models8=_interopRequireDefault(_models7);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}exports.default={Frame:_models2.default,Stack:_models4.default,Series:_models6.default,Voxel:_models8.default}},{"./models.frame":114,"./models.series":116,"./models.stack":117,"./models.voxel":118}],116:[function(require,module,exports){"use strict";var _typeof=typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"?function(obj){return typeof obj}:function(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol?"symbol":typeof obj};Object.defineProperty(exports,"__esModule",{value:true});var _createClass=function(){function defineProperties(target,props){for(var i=0;i-1))throw new TypeError("Unknown encoding: "+encoding);this._writableState.defaultEncoding=encoding;return this};function decodeChunk(state,chunk,encoding){if(!state.objectMode&&state.decodeStrings!==false&&typeof chunk==="string"){chunk=bufferShim.from(chunk,encoding)}return chunk}function writeOrBuffer(stream,state,chunk,encoding,cb){chunk=decodeChunk(state,chunk,encoding);if(Buffer.isBuffer(chunk))encoding="buffer";var len=state.objectMode?1:chunk.length;state.length+=len;var ret=state.length=this.charLength-this.charReceived?this.charLength-this.charReceived:buffer.length;buffer.copy(this.charBuffer,this.charReceived,0,available);this.charReceived+=available;if(this.charReceived=55296&&charCode<=56319){this.charLength+=this.surrogateSize;charStr="";continue}this.charReceived=this.charLength=0;if(buffer.length===0){return charStr}break}this.detectIncompleteChar(buffer);var end=buffer.length;if(this.charLength){buffer.copy(this.charBuffer,0,buffer.length-this.charReceived,end);end-=this.charReceived}charStr+=buffer.toString(this.encoding,0,end);var end=charStr.length-1;var charCode=charStr.charCodeAt(end);if(charCode>=55296&&charCode<=56319){var size=this.surrogateSize;this.charLength+=size;this.charReceived+=size;this.charBuffer.copy(this.charBuffer,size,0,size);buffer.copy(this.charBuffer,0,0,size);return charStr.substring(0,end)}return charStr};StringDecoder.prototype.detectIncompleteChar=function(buffer){var i=buffer.length>=3?3:buffer.length;for(;i>0;i--){var c=buffer[buffer.length-i];if(i==1&&c>>5==6){this.charLength=2;break}if(i<=2&&c>>4==14){this.charLength=3;break}if(i<=3&&c>>3==30){this.charLength=4;break}}this.charReceived=i};StringDecoder.prototype.end=function(buffer){var res="";if(buffer&&buffer.length)res=this.write(buffer);if(this.charReceived){var cr=this.charReceived;var buf=this.charBuffer;var enc=this.encoding;res+=buf.slice(0,cr).toString(enc)}return res};function passThroughWrite(buffer){return buffer.toString(this.encoding)}function utf16DetectIncompleteChar(buffer){this.charReceived=buffer.length%2;this.charLength=this.charReceived?2:0}function base64DetectIncompleteChar(buffer){this.charReceived=buffer.length%3;this.charLength=this.charReceived?3:0}},{buffer:19}],75:[function(require,module,exports){(function(global){module.exports=deprecate;function deprecate(fn,msg){if(config("noDeprecation")){return fn}var warned=false;function deprecated(){if(!warned){if(config("throwDeprecation")){throw new Error(msg)}else if(config("traceDeprecation")){console.trace(msg)}else{console.warn(msg)}warned=true}return fn.apply(this,arguments)}return deprecated}function config(name){try{if(!global.localStorage)return false}catch(_){return false}var val=global.localStorage[name];if(null==val)return false;return String(val).toLowerCase()==="true"}}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{}],76:[function(require,module,exports){module.exports=function isBuffer(arg){return arg&&typeof arg==="object"&&typeof arg.copy==="function"&&typeof arg.fill==="function"&&typeof arg.readUInt8==="function"}},{}],77:[function(require,module,exports){(function(process,global){var formatRegExp=/%[sdj%]/g;exports.format=function(f){if(!isString(f)){var objects=[];for(var i=0;i=len)return x;switch(x){case"%s":return String(args[i++]);case"%d":return Number(args[i++]);case"%j":try{return JSON.stringify(args[i++])}catch(_){return"[Circular]"}default:return x}});for(var x=args[i];i=3)ctx.depth=arguments[2];if(arguments.length>=4)ctx.colors=arguments[3];if(isBoolean(opts)){ctx.showHidden=opts}else if(opts){exports._extend(ctx,opts)}if(isUndefined(ctx.showHidden))ctx.showHidden=false;if(isUndefined(ctx.depth))ctx.depth=2;if(isUndefined(ctx.colors))ctx.colors=false;if(isUndefined(ctx.customInspect))ctx.customInspect=true;if(ctx.colors)ctx.stylize=stylizeWithColor;return formatValue(ctx,obj,ctx.depth)}exports.inspect=inspect;inspect.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]};inspect.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};function stylizeWithColor(str,styleType){var style=inspect.styles[styleType];if(style){return"["+inspect.colors[style][0]+"m"+str+"["+inspect.colors[style][1]+"m"}else{return str}}function stylizeNoColor(str,styleType){return str}function arrayToHash(array){var hash={};array.forEach(function(val,idx){hash[val]=true});return hash}function formatValue(ctx,value,recurseTimes){if(ctx.customInspect&&value&&isFunction(value.inspect)&&value.inspect!==exports.inspect&&!(value.constructor&&value.constructor.prototype===value)){var ret=value.inspect(recurseTimes,ctx);if(!isString(ret)){ret=formatValue(ctx,ret,recurseTimes)}return ret}var primitive=formatPrimitive(ctx,value);if(primitive){return primitive}var keys=Object.keys(value);var visibleKeys=arrayToHash(keys);if(ctx.showHidden){keys=Object.getOwnPropertyNames(value)}if(isError(value)&&(keys.indexOf("message")>=0||keys.indexOf("description")>=0)){return formatError(value)}if(keys.length===0){if(isFunction(value)){var name=value.name?": "+value.name:"";return ctx.stylize("[Function"+name+"]","special")}if(isRegExp(value)){return ctx.stylize(RegExp.prototype.toString.call(value),"regexp")}if(isDate(value)){return ctx.stylize(Date.prototype.toString.call(value),"date")}if(isError(value)){return formatError(value)}}var base="",array=false,braces=["{","}"];if(isArray(value)){array=true;braces=["[","]"]}if(isFunction(value)){var n=value.name?": "+value.name:"";base=" [Function"+n+"]"}if(isRegExp(value)){base=" "+RegExp.prototype.toString.call(value)}if(isDate(value)){base=" "+Date.prototype.toUTCString.call(value)}if(isError(value)){base=" "+formatError(value)}if(keys.length===0&&(!array||value.length==0)){return braces[0]+base+braces[1]}if(recurseTimes<0){if(isRegExp(value)){return ctx.stylize(RegExp.prototype.toString.call(value),"regexp")}else{return ctx.stylize("[Object]","special")}}ctx.seen.push(value);var output;if(array){output=formatArray(ctx,value,recurseTimes,visibleKeys,keys)}else{output=keys.map(function(key){return formatProperty(ctx,value,recurseTimes,visibleKeys,key,array)})}ctx.seen.pop();return reduceToSingleString(output,base,braces)}function formatPrimitive(ctx,value){if(isUndefined(value))return ctx.stylize("undefined","undefined");if(isString(value)){var simple="'"+JSON.stringify(value).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return ctx.stylize(simple,"string")}if(isNumber(value))return ctx.stylize(""+value,"number");if(isBoolean(value))return ctx.stylize(""+value,"boolean");if(isNull(value))return ctx.stylize("null","null")}function formatError(value){return"["+Error.prototype.toString.call(value)+"]"}function formatArray(ctx,value,recurseTimes,visibleKeys,keys){var output=[];for(var i=0,l=value.length;i-1){if(array){str=str.split("\n").map(function(line){return" "+line}).join("\n").substr(2)}else{str="\n"+str.split("\n").map(function(line){return" "+line}).join("\n")}}}else{str=ctx.stylize("[Circular]","special")}}if(isUndefined(name)){if(array&&key.match(/^\d+$/)){return str}name=JSON.stringify(""+key);if(name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)){name=name.substr(1,name.length-2);name=ctx.stylize(name,"name")}else{name=name.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'");name=ctx.stylize(name,"string")}}return name+": "+str}function reduceToSingleString(output,base,braces){var numLinesEst=0;var length=output.reduce(function(prev,cur){numLinesEst++;if(cur.indexOf("\n")>=0)numLinesEst++;return prev+cur.replace(/\u001b\[\d\d?m/g,"").length+1},0);if(length>60){return braces[0]+(base===""?"":base+"\n ")+" "+output.join(",\n ")+" "+braces[1]}return braces[0]+base+" "+output.join(", ")+" "+braces[1]}function isArray(ar){return Array.isArray(ar)}exports.isArray=isArray;function isBoolean(arg){return typeof arg==="boolean"}exports.isBoolean=isBoolean;function isNull(arg){return arg===null}exports.isNull=isNull;function isNullOrUndefined(arg){return arg==null}exports.isNullOrUndefined=isNullOrUndefined;function isNumber(arg){return typeof arg==="number"}exports.isNumber=isNumber;function isString(arg){return typeof arg==="string"}exports.isString=isString;function isSymbol(arg){return typeof arg==="symbol"}exports.isSymbol=isSymbol;function isUndefined(arg){return arg===void 0}exports.isUndefined=isUndefined;function isRegExp(re){return isObject(re)&&objectToString(re)==="[object RegExp]"}exports.isRegExp=isRegExp;function isObject(arg){return typeof arg==="object"&&arg!==null}exports.isObject=isObject;function isDate(d){return isObject(d)&&objectToString(d)==="[object Date]"}exports.isDate=isDate;function isError(e){return isObject(e)&&(objectToString(e)==="[object Error]"||e instanceof Error)}exports.isError=isError;function isFunction(arg){return typeof arg==="function"}exports.isFunction=isFunction;function isPrimitive(arg){return arg===null||typeof arg==="boolean"||typeof arg==="number"||typeof arg==="string"||typeof arg==="symbol"||typeof arg==="undefined"}exports.isPrimitive=isPrimitive;exports.isBuffer=require("./support/isBuffer");function objectToString(o){return Object.prototype.toString.call(o)}function pad(n){return n<10?"0"+n.toString(10):n.toString(10)}var months=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function timestamp(){var d=new Date;var time=[pad(d.getHours()),pad(d.getMinutes()),pad(d.getSeconds())].join(":");return[d.getDate(),months[d.getMonth()],time].join(" ")}exports.log=function(){console.log("%s - %s",timestamp(),exports.format.apply(exports,arguments))};exports.inherits=require("inherits");exports._extend=function(origin,add){if(!add||!isObject(add))return origin;var keys=Object.keys(add);var i=keys.length;while(i--){origin[keys[i]]=add[keys[i]]}return origin};function hasOwnProperty(obj,prop){return Object.prototype.hasOwnProperty.call(obj,prop)}}).call(this,require("_process"),typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{"./support/isBuffer":76,_process:68,inherits:27}],78:[function(require,module,exports){"use strict";var isString=require("validate.io-string-primitive");var isNonNegativeInteger=require("validate.io-nonnegative-integer");var ceil=require("math-ceil");var repeat=require("utils-repeat-string");var MAX_SAFE_INTEGER=9007199254740991;function lpad(str,len,pad){var n;var p;if(!isString(str)){throw new TypeError("invalid input argument. First argument must be a string. Value: `"+str+"`.")}if(!isNonNegativeInteger(len)){throw new TypeError("invalid input argument. Second argument must be a nonnegative integer. Value: `"+len+"`.")}if(arguments.length>2){p=pad;if(!isString(p)){throw new TypeError("invalid input argument. Third argument must be a string. Value: `"+p+"`.")}if(p.length===0){throw new RangeError("invalid input argument. Pad string must not be an empty string.")}}else{p=" "}if(len>MAX_SAFE_INTEGER){throw new RangeError("invalid input argument. Output string length exceeds maximum allowed string length.")}n=(len-str.length)/p.length;if(n<=0){return str}n=ceil(n);return repeat(p,n)+str}module.exports=lpad},{"math-ceil":41,"utils-repeat-string":79,"validate.io-nonnegative-integer":82,"validate.io-string-primitive":84}],79:[function(require,module,exports){"use strict";var isString=require("validate.io-string-primitive");var isNonNegativeInteger=require("validate.io-nonnegative-integer");var MAX_SAFE_INTEGER=9007199254740991;function repeat(str,n){var rpt;var cnt;if(!isString(str)){throw new TypeError("invalid input argument. First argument must be a string. Value: `"+str+"`.")}if(!isNonNegativeInteger(n)){throw new TypeError("invalid input argument. Second argument must be a nonnegative integer. Value: `"+n+"`.")}if(str.length===0||n===0){return""}if(str.length*n>MAX_SAFE_INTEGER){throw new RangeError("invalid input argument. Output string length exceeds maximum allowed string length.")}rpt="";cnt=n;for(;;){if((cnt&1)===1){rpt+=str}cnt>>>=1;if(cnt===0){break}str+=str}return rpt}module.exports=repeat},{"validate.io-nonnegative-integer":82,"validate.io-string-primitive":84}],80:[function(require,module,exports){"use strict";var isString=require("validate.io-string-primitive");var isNonNegativeInteger=require("validate.io-nonnegative-integer");var ceil=require("math-ceil");var repeat=require("utils-repeat-string");var MAX_SAFE_INTEGER=9007199254740991;function rpad(str,len,pad){var n;var p;if(!isString(str)){throw new TypeError("invalid input argument. First argument must be a string. Value: `"+str+"`.")}if(!isNonNegativeInteger(len)){throw new TypeError("invalid input argument. Second argument must be a nonnegative integer. Value: `"+len+"`.")}if(arguments.length>2){p=pad;if(!isString(p)){throw new TypeError("invalid input argument. Third argument must be a string. Value: `"+p+"`.")}if(p.length===0){throw new RangeError("invalid input argument. Pad string must not be an empty string.")}}else{p=" "}if(len>MAX_SAFE_INTEGER){throw new RangeError("invalid input argument. Output string length exceeds maximum allowed string length.")}n=(len-str.length)/p.length;if(n<=0){return str}n=ceil(n);return str+repeat(p,n)}module.exports=rpad},{"math-ceil":41,"utils-repeat-string":79,"validate.io-nonnegative-integer":82,"validate.io-string-primitive":84}],81:[function(require,module,exports){"use strict";var isNumber=require("validate.io-number");function isInteger(value){return isNumber(value)&&value%1===0}module.exports=isInteger},{"validate.io-number":83}],82:[function(require,module,exports){"use strict";var isInteger=require("validate.io-integer");function isNonNegativeInteger(value){return isInteger(value)&&value>=0}module.exports=isNonNegativeInteger},{"validate.io-integer":81}],83:[function(require,module,exports){"use strict";function isNumber(value){return(typeof value==="number"||Object.prototype.toString.call(value)==="[object Number]")&&value.valueOf()===value.valueOf()}module.exports=isNumber},{}],84:[function(require,module,exports){"use strict";function isString(value){return typeof value==="string"}module.exports=isString},{}],85:[function(require,module,exports){module.exports={name:"ami.js",version:"v0.0.10",main:"src/ami.js",keywords:["ami","ami.js","three.js","webgl","dicom","nifti","awesome","medical","imaging","xtk","nrrd","vtk","stl","trk"],author:{name:"Nicolas Rannou",email:"nicolas@eunate.ch",url:"https://eunate.ch"},license:"Apache-2.0",repository:{type:"git",url:"https://fnndsc.github.io/ami"},config:{threeVersion:"r81",amiCDN:"https://cdn.rawgit.com/fnndsc/ami/master/build/ami.min.js",gaKey:"UA-39303022-3",transforms:"-t [babelify --presets [ es2015 ] ]"},dependencies:{"dicom-parser":"1.7.3","image-JPEG2000":"OHIF/image-JPEG2000#master","jpeg-lossless-decoder-js":"1.2.3","math-float32-to-binary-string":"^1.0.0","nrrd-js":"^0.2.1","nifti-reader-js":"v0.5.3",pako:"1.0.1"},scripts:{"dist:prepare":"node ./scripts/$npm_package_config_mode.js --dist","dist:watchAmi":"watchify -d src/ami $npm_package_config_transforms --standalone AMI -o dist/build/ami.js -v","dist:watch":"watchify $npm_package_config_target -d $npm_package_config_transforms -o dist/$npm_package_config_target -v",dist:"npm run dist:prepare --ami.js:mode=$npm_package_config_mode && (live-server dist --open=$npm_package_config_open & npm run dist:watch --ami.js:target=$npm_package_config_target)",example:"npm run clean && node ./scripts/router.js examples ",lesson:"npm run clean && mkdir dist/build && touch dist/build/ami.js && node ./scripts/router.js lessons ",demo:"node ./scripts/lessons.js --demo",lint:"eslint **/*.js --quiet","build:examples":"npm run dist:prepare --ami.js:mode=examples && find examples -name '*.js' -print0 | xargs -0 -n1 -I{} bash -c \"echo Building {}; browserify {} -d -v $npm_package_config_transforms > dist/{} \"","build:ami":"browserify src/ami.js -d -v $npm_package_config_transforms --standalone AMI > build/ami.js && uglifyjs build/ami.js -o build/ami.min.js",build:"npm run clean && cp index.html dist/index.html && npm run build:examples && npm run doc",clean:"rm -rf dist/*",test:"karma start",doc:"jsdoc -p -r -R README.md -c jsdoc.conf -d dist/doc src",ami:"npm run lint && npm run demo && npm run build:ami && npm run test",deploy:"npm run build && gh-pages -d dist"},devDependencies:{browserify:"^13.1.0","uglify-js":"^2.7.3","live-server":"^1.1.0","babel-cli":"latest",shelljs:"latest","gh-pages":"latest",eslint:"latest","babel-polyfill":"^6.13.0","babel-preset-es2015":"^6.13.2",babelify:"7.3.0",glslify:"5.1.0",jsdoc:"jsdoc3/jsdoc#master",karma:"latest",phantomjs:"latest","karma-browserify":"latest","karma-jasmine":"latest","karma-phantomjs-launcher":"latest","karma-spec-reporter":"latest","jasmine-core":"latest",watchify:"3.7.0"},engines:{node:">=6.9.0"},browserify:{transform:["babelify"]}}},{}],86:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var _cameras=require("./cameras/cameras");var _cameras2=_interopRequireDefault(_cameras);var _controls=require("./controls/controls");var _controls2=_interopRequireDefault(_controls);var _core=require("./core/core");var _core2=_interopRequireDefault(_core);var _geometries=require("./geometries/geometries");var _geometries2=_interopRequireDefault(_geometries);var _helpers=require("./helpers/helpers");var _helpers2=_interopRequireDefault(_helpers);var _loaders=require("./loaders/loaders");var _loaders2=_interopRequireDefault(_loaders);var _models=require("./models/models");var _models2=_interopRequireDefault(_models);var _parsers=require("./parsers/parsers");var _parsers2=_interopRequireDefault(_parsers);var _shaders=require("./shaders/shaders");var _shaders2=_interopRequireDefault(_shaders);var _widgets=require("./widgets/widgets");var _widgets2=_interopRequireDefault(_widgets);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}var pckg=require("../package.json");exports.default={Cameras:_cameras2.default,Controls:_controls2.default,Core:_core2.default,Geometries:_geometries2.default,Helpers:_helpers2.default,Loaders:_loaders2.default,Models:_models2.default,Parsers:_parsers2.default,Shaders:_shaders2.default,Widgets:_widgets2.default};window.console.log("AMI "+pckg.version+" ( ThreeJS "+pckg.config.threeVersion+")")},{"../package.json":85,"./cameras/cameras":87,"./controls/controls":89,"./core/core":93,"./geometries/geometries":97,"./helpers/helpers":102,"./loaders/loaders":111,"./models/models":115,"./parsers/parsers":120,"./shaders/shaders":134,"./widgets/widgets":143}],87:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var _cameras=require("./cameras.orthographic");var _cameras2=_interopRequireDefault(_cameras);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}exports.default={Orthographic:_cameras2.default}},{"./cameras.orthographic":88}],88:[function(require,module,exports){"use strict";var _typeof=typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"?function(obj){return typeof obj}:function(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol?"symbol":typeof obj};Object.defineProperty(exports,"__esModule",{value:true});var _createClass=function(){function defineProperties(target,props){for(var i=0;i0&&arguments[0]!==undefined?arguments[0]:null;this.center();var computedAngle=90;var clockwise=1;if(!this._fromFront){clockwise=-1}if(angle===null){computedAngle*=-clockwise;this._angle+=90}else{computedAngle=360-clockwise*(angle-this._angle);this._angle=angle}this._angle%=360;var rotation=(new THREE.Matrix4).makeRotationAxis(this._zCosine,computedAngle*Math.PI/180);this.up.applyMatrix4(rotation);this._updateMatrices()}},{key:"fitBox",value:function fitBox(){var direction=arguments.length>0&&arguments[0]!==undefined?arguments[0]:0;var factor=arguments.length>1&&arguments[1]!==undefined?arguments[1]:1.5;var zoom=1;switch(direction){case 0:zoom=factor*this._computeZoom(this._canvas.width,this._xCosine);break;case 1:zoom=factor*this._computeZoom(this._canvas.height,this._yCosine);break;case 2:zoom=factor*Math.min(this._computeZoom(this._canvas.width,this._xCosine),this._computeZoom(this._canvas.height,this._yCosine));break;default:break}if(!zoom){return false}this.zoom=zoom;this.center()}},{key:"_updateCanvas",value:function _updateCanvas(){var camFactor=2;this.left=-this._canvas.width/camFactor;this.right=this._canvas.width/camFactor;this.top=this._canvas.height/camFactor;this.bottom=-this._canvas.height/camFactor;this._updateMatrices();this.controls.handleResize()}},{key:"_oppositePosition",value:function _oppositePosition(position){var oppositePosition=position.clone();oppositePosition.sub(this._box.center);var rotation=(new THREE.Matrix4).makeRotationAxis(this.up,Math.PI);oppositePosition.applyMatrix4(rotation);oppositePosition.add(this._box.center);return oppositePosition}},{key:"_computeZoom",value:function _computeZoom(dimension,direction){if(!(dimension&&dimension>0)){window.console.log("Invalid dimension provided.");window.console.log(dimension);return false}var ray={position:this._box.center.clone(),direction:direction};var intersections=_core2.default.rayBox(ray,this._box);if(intersections.length<2){window.console.log("Can not adjust the camera ( < 2 intersections).");window.console.log(ray);window.console.log(this._box);return false}return dimension/intersections[0].distanceTo(intersections[1])}},{key:"_updatePositionAndTarget",value:function _updatePositionAndTarget(position,target){this.position.set(position.x,position.y,position.z);this.lookAt(target.x,target.y,target.z);this._controls.target.set(target.x,target.y,target.z)}},{key:"_updateMatrices",value:function _updateMatrices(){this._controls.update();this.updateProjectionMatrix();this.updateMatrixWorld()}},{key:"xCosine",set:function set(xCosine){this._xCosine=xCosine},get:function get(){return this._xCosine}},{key:"yCosine",set:function set(yCosine){this._yCosine=yCosine},get:function get(){return this._yCosine}},{key:"zCosine",set:function set(zCosine){this._zCosine=zCosine},get:function get(){return this._zCosine}},{key:"controls",set:function set(controls){this._controls=controls},get:function get(){return this._controls}},{key:"box",set:function set(box){this._box=box},get:function get(){return this._box}},{key:"canvas",set:function set(canvas){this._canvas=canvas;this._updateCanvas()},get:function get(){return this._canvas}},{key:"angle",set:function set(angle){this.rotate(angle)},get:function get(){return this._angle}}]);return CamerasOrthographic}(THREE.OrthographicCamera);exports.default=CamerasOrthographic},{"../core/core.intersections":92,"../core/core.validators":96}],89:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var _controls=require("./controls.trackball");var _controls2=_interopRequireDefault(_controls);var _controls3=require("./controls.trackballortho");var _controls4=_interopRequireDefault(_controls3);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}exports.default={Trackball:_controls2.default,TrackballOrtho:_controls4.default}},{"./controls.trackball":90,"./controls.trackballortho":91}],90:[function(require,module,exports){"use strict";var _typeof=typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"?function(obj){return typeof obj}:function(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol?"symbol":typeof obj};Object.defineProperty(exports,"__esModule",{value:true});function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}function _possibleConstructorReturn(self,call){if(!self){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return call&&((typeof call==="undefined"?"undefined":_typeof(call))==="object"||typeof call==="function")?call:self}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function, not "+(typeof superClass==="undefined"?"undefined":_typeof(superClass)))}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:false,writable:true,configurable:true}});if(superClass)Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass}var Trackball=function(_THREE$EventDispatche){_inherits(Trackball,_THREE$EventDispatche);function Trackball(object,domElement){_classCallCheck(this,Trackball);var _this2=_possibleConstructorReturn(this,(Trackball.__proto__||Object.getPrototypeOf(Trackball)).call(this));var _this=_this2;var STATE={NONE:-1,ROTATE:0,ZOOM:1,PAN:2,TOUCH_ROTATE:3,TOUCH_ZOOM:4,TOUCH_PAN:5,CUSTOM:99};_this2.object=object;_this2.domElement=domElement!==undefined?domElement:document;_this2.enabled=true;_this2.screen={left:0,top:0,width:0,height:0};_this2.rotateSpeed=1;_this2.zoomSpeed=1.2;_this2.panSpeed=.3;_this2.noRotate=false;_this2.noZoom=false;_this2.noPan=false;_this2.noCustom=false;_this2.forceState=-1;_this2.staticMoving=false;_this2.dynamicDampingFactor=.2;_this2.minDistance=0;_this2.maxDistance=Infinity;_this2.keys=[65,83,68];_this2.target=new THREE.Vector3;var EPS=1e-6;var lastPosition=new THREE.Vector3;var _state=STATE.NONE,_prevState=STATE.NONE,_eye=new THREE.Vector3,_movePrev=new THREE.Vector2,_moveCurr=new THREE.Vector2,_lastAxis=new THREE.Vector3,_lastAngle=0,_zoomStart=new THREE.Vector2,_zoomEnd=new THREE.Vector2,_touchZoomDistanceStart=0,_touchZoomDistanceEnd=0,_panStart=new THREE.Vector2,_panEnd=new THREE.Vector2,_customStart=new THREE.Vector2,_customEnd=new THREE.Vector2;_this2.target0=_this2.target.clone();_this2.position0=_this2.object.position.clone();_this2.up0=_this2.object.up.clone();var changeEvent={type:"change"};var startEvent={type:"start"};var endEvent={type:"end"};_this2.handleResize=function(){if(this.domElement===document){this.screen.left=0;this.screen.top=0;this.screen.width=window.innerWidth;this.screen.height=window.innerHeight}else{var box=this.domElement.getBoundingClientRect();var d=this.domElement.ownerDocument.documentElement;this.screen.left=box.left+window.pageXOffset-d.clientLeft;this.screen.top=box.top+window.pageYOffset-d.clientTop;this.screen.width=box.width;this.screen.height=box.height}};_this2.handleEvent=function(event){if(typeof this[event.type]=="function"){this[event.type](event)}};var getMouseOnScreen=function(){var vector=new THREE.Vector2;return function(pageX,pageY){vector.set((pageX-_this.screen.left)/_this.screen.width,(pageY-_this.screen.top)/_this.screen.height);return vector}}();var getMouseOnCircle=function(){var vector=new THREE.Vector2;return function(pageX,pageY){vector.set((pageX-_this.screen.width*.5-_this.screen.left)/(_this.screen.width*.5),(_this.screen.height+2*(_this.screen.top-pageY))/_this.screen.width);return vector}}();_this2.rotateCamera=function(){var axis=new THREE.Vector3,quaternion=new THREE.Quaternion,eyeDirection=new THREE.Vector3,objectUpDirection=new THREE.Vector3,objectSidewaysDirection=new THREE.Vector3,moveDirection=new THREE.Vector3,angle;return function(){moveDirection.set(_moveCurr.x-_movePrev.x,_moveCurr.y-_movePrev.y,0);angle=moveDirection.length();if(angle){_eye.copy(_this.object.position).sub(_this.target);eyeDirection.copy(_eye).normalize();objectUpDirection.copy(_this.object.up).normalize();objectSidewaysDirection.crossVectors(objectUpDirection,eyeDirection).normalize();objectUpDirection.setLength(_moveCurr.y-_movePrev.y);objectSidewaysDirection.setLength(_moveCurr.x-_movePrev.x);moveDirection.copy(objectUpDirection.add(objectSidewaysDirection));axis.crossVectors(moveDirection,_eye).normalize();angle*=_this.rotateSpeed;quaternion.setFromAxisAngle(axis,angle);_eye.applyQuaternion(quaternion);_this.object.up.applyQuaternion(quaternion);_lastAxis.copy(axis);_lastAngle=angle}else if(!_this.staticMoving&&_lastAngle){_lastAngle*=Math.sqrt(1-_this.dynamicDampingFactor);_eye.copy(_this.object.position).sub(_this.target);quaternion.setFromAxisAngle(_lastAxis,_lastAngle);_eye.applyQuaternion(quaternion);_this.object.up.applyQuaternion(quaternion)}_movePrev.copy(_moveCurr)}}();_this2.zoomCamera=function(){var factor;if(_state===STATE.TOUCH_ZOOM){factor=_touchZoomDistanceStart/_touchZoomDistanceEnd;_touchZoomDistanceStart=_touchZoomDistanceEnd;_eye.multiplyScalar(factor)}else{factor=1+(_zoomEnd.y-_zoomStart.y)*_this.zoomSpeed;if(factor!==1&&factor>0){_eye.multiplyScalar(factor);if(_this.staticMoving){_zoomStart.copy(_zoomEnd)}else{_zoomStart.y+=(_zoomEnd.y-_zoomStart.y)*this.dynamicDampingFactor}}}};_this2.panCamera=function(){var mouseChange=new THREE.Vector2,objectUp=new THREE.Vector3,pan=new THREE.Vector3;return function(){mouseChange.copy(_panEnd).sub(_panStart);if(mouseChange.lengthSq()){mouseChange.multiplyScalar(_eye.length()*_this.panSpeed);pan.copy(_eye).cross(_this.object.up).setLength(mouseChange.x);pan.add(objectUp.copy(_this.object.up).setLength(mouseChange.y));_this.object.position.add(pan);_this.target.add(pan);if(_this.staticMoving){_panStart.copy(_panEnd)}else{_panStart.add(mouseChange.subVectors(_panEnd,_panStart).multiplyScalar(_this.dynamicDampingFactor))}}}}();_this2.checkDistances=function(){if(!_this.noZoom||!_this.noPan){if(_eye.lengthSq()>_this.maxDistance*_this.maxDistance){_this.object.position.addVectors(_this.target,_eye.setLength(_this.maxDistance))}if(_eye.lengthSq()<_this.minDistance*_this.minDistance){_this.object.position.addVectors(_this.target,_eye.setLength(_this.minDistance))}}};_this2.update=function(){_eye.subVectors(_this.object.position,_this.target);if(!_this.noRotate){_this.rotateCamera()}if(!_this.noZoom){_this.zoomCamera()}if(!_this.noPan){_this.panCamera()}if(!_this.noCustom){_this.custom(_customStart,_customEnd)}_this.object.position.addVectors(_this.target,_eye);_this.checkDistances();_this.object.lookAt(_this.target);if(lastPosition.distanceToSquared(_this.object.position)>EPS){_this.dispatchEvent(changeEvent);lastPosition.copy(_this.object.position)}};_this2.reset=function(){_state=STATE.NONE;_prevState=STATE.NONE;_this.target.copy(_this.target0);_this.object.position.copy(_this.position0);_this.object.up.copy(_this.up0);_eye.subVectors(_this.object.position,_this.target);_this.object.lookAt(_this.target);_this.dispatchEvent(changeEvent);lastPosition.copy(_this.object.position)};_this2.setState=function(targetState){_this.forceState=targetState;_prevState=targetState;_state=targetState};_this2.custom=function(customStart,customEnd){};function keydown(event){if(_this.enabled===false)return;window.removeEventListener("keydown",keydown);_prevState=_state;if(_state!==STATE.NONE){return}else if(event.keyCode===_this.keys[STATE.ROTATE]&&!_this.noRotate){_state=STATE.ROTATE}else if(event.keyCode===_this.keys[STATE.ZOOM]&&!_this.noZoom){_state=STATE.ZOOM}else if(event.keyCode===_this.keys[STATE.PAN]&&!_this.noPan){_state=STATE.PAN}}function keyup(event){if(_this.enabled===false)return;_state=_prevState;window.addEventListener("keydown",keydown,false)}function mousedown(event){if(_this.enabled===false)return;event.preventDefault();event.stopPropagation();if(_state===STATE.NONE){_state=event.button}if(_state===STATE.ROTATE&&!_this.noRotate){_moveCurr.copy(getMouseOnCircle(event.pageX,event.pageY));_movePrev.copy(_moveCurr)}else if(_state===STATE.ZOOM&&!_this.noZoom){_zoomStart.copy(getMouseOnScreen(event.pageX,event.pageY));_zoomEnd.copy(_zoomStart)}else if(_state===STATE.PAN&&!_this.noPan){_panStart.copy(getMouseOnScreen(event.pageX,event.pageY));_panEnd.copy(_panStart)}else if(_state===STATE.CUSTOM&&!_this.noCustom){_customStart.copy(getMouseOnScreen(event.pageX,event.pageY));_customEnd.copy(_panStart)}document.addEventListener("mousemove",mousemove,false);document.addEventListener("mouseup",mouseup,false);_this.dispatchEvent(startEvent)}function mousemove(event){if(_this.enabled===false)return;event.preventDefault();event.stopPropagation();if(_state===STATE.ROTATE&&!_this.noRotate){_movePrev.copy(_moveCurr);_moveCurr.copy(getMouseOnCircle(event.pageX,event.pageY))}else if(_state===STATE.ZOOM&&!_this.noZoom){_zoomEnd.copy(getMouseOnScreen(event.pageX,event.pageY))}else if(_state===STATE.PAN&&!_this.noPan){_panEnd.copy(getMouseOnScreen(event.pageX,event.pageY))}else if(_state===STATE.CUSTOM&&!_this.noCustom){_customEnd.copy(getMouseOnScreen(event.pageX,event.pageY))}}function mouseup(event){if(_this.enabled===false)return;event.preventDefault();event.stopPropagation();if(_this.forceState===-1){_state=STATE.NONE}document.removeEventListener("mousemove",mousemove);document.removeEventListener("mouseup",mouseup);_this.dispatchEvent(endEvent)}function mousewheel(event){if(_this.enabled===false)return;event.preventDefault();event.stopPropagation();var delta=0;if(event.wheelDelta){delta=event.wheelDelta/40}else if(event.detail){delta=-event.detail/3}if(_state!==STATE.CUSTOM){_zoomStart.y+=delta*.01}else if(_state===STATE.CUSTOM){_customStart.y+=delta*.01}_this.dispatchEvent(startEvent);_this.dispatchEvent(endEvent)}function touchstart(event){if(_this.enabled===false)return;if(_this.forceState===-1){switch(event.touches.length){case 1:_state=STATE.TOUCH_ROTATE;_moveCurr.copy(getMouseOnCircle(event.touches[0].pageX,event.touches[0].pageY));_movePrev.copy(_moveCurr);break;case 2:_state=STATE.TOUCH_ZOOM;var dx=event.touches[0].pageX-event.touches[1].pageX;var dy=event.touches[0].pageY-event.touches[1].pageY;_touchZoomDistanceEnd=_touchZoomDistanceStart=Math.sqrt(dx*dx+dy*dy);var x=(event.touches[0].pageX+event.touches[1].pageX)/2;var y=(event.touches[0].pageY+event.touches[1].pageY)/2;_panStart.copy(getMouseOnScreen(x,y));_panEnd.copy(_panStart);break;default:_state=STATE.NONE}}else{switch(_state){case 0:_state=STATE.TOUCH_ROTATE;_moveCurr.copy(getMouseOnCircle(event.touches[0].pageX,event.touches[0].pageY));_movePrev.copy(_moveCurr);break;case 1:case 4:if(event.touches.length>=2){_state=STATE.TOUCH_ZOOM;var dx=event.touches[0].pageX-event.touches[1].pageX;var dy=event.touches[0].pageY-event.touches[1].pageY;_touchZoomDistanceEnd=_touchZoomDistanceStart=Math.sqrt(dx*dx+dy*dy)}else{_state=STATE.ZOOM;_zoomStart.copy(getMouseOnScreen(event.touches[0].pageX,event.touches[0].pageY));_zoomEnd.copy(_zoomStart)}break;case 2:case 5:if(event.touches.length>=2){_state=STATE.TOUCH_PAN;var x=(event.touches[0].pageX+event.touches[1].pageX)/2;var y=(event.touches[0].pageY+event.touches[1].pageY)/2;_panStart.copy(getMouseOnScreen(x,y));_panEnd.copy(_panStart)}else{_state=STATE.PAN;_panStart.copy(getMouseOnScreen(event.touches[0].pageX,event.touches[0].pageY));_panEnd.copy(_panStart)}break;case 99:_state=STATE.CUSTOM;var x=(event.touches[0].pageX+event.touches[1].pageX)/2;var y=(event.touches[0].pageY+event.touches[1].pageY)/2;_customStart.copy(getMouseOnScreen(x,y));_customEnd.copy(_customStart);break;default:_state=STATE.NONE}}_this.dispatchEvent(startEvent)}function touchmove(event){if(_this.enabled===false)return;event.preventDefault();event.stopPropagation();if(_this.forceState===-1){switch(event.touches.length){case 1:_movePrev.copy(_moveCurr);_moveCurr.copy(getMouseOnCircle(event.touches[0].pageX,event.touches[0].pageY));break;case 2:var dx=event.touches[0].pageX-event.touches[1].pageX;var dy=event.touches[0].pageY-event.touches[1].pageY;_touchZoomDistanceEnd=Math.sqrt(dx*dx+dy*dy);var x=(event.touches[0].pageX+event.touches[1].pageX)/2;var y=(event.touches[0].pageY+event.touches[1].pageY)/2;_panEnd.copy(getMouseOnScreen(x,y));break;default:_state=STATE.NONE}}else{switch(_state){case 0:_movePrev.copy(_moveCurr);_moveCurr.copy(getMouseOnCircle(event.touches[0].pageX,event.touches[0].pageY));break;case 1:_zoomEnd.copy(getMouseOnScreen(event.touches[0].pageX,event.touches[0].pageY));break;case 2:_panEnd.copy(getMouseOnScreen(event.touches[0].pageX,event.touches[0].pageY));break;case 4:var dx=event.touches[0].pageX-event.touches[1].pageX;var dy=event.touches[0].pageY-event.touches[1].pageY;_touchZoomDistanceEnd=Math.sqrt(dx*dx+dy*dy);break;case 5:var x=(event.touches[0].pageX+event.touches[1].pageX)/2;var y=(event.touches[0].pageY+event.touches[1].pageY)/2;_panEnd.copy(getMouseOnScreen(x,y));break;case 99:var x=(event.touches[0].pageX+event.touches[1].pageX)/2;var y=(event.touches[0].pageY+event.touches[1].pageY)/2;_customEnd.copy(getMouseOnScreen(x,y));break;default:_state=STATE.NONE}}}function touchend(event){if(_this.enabled===false)return;if(_this.forceState===-1){switch(event.touches.length){case 1:_movePrev.copy(_moveCurr);_moveCurr.copy(getMouseOnCircle(event.touches[0].pageX,event.touches[0].pageY));break;case 2:_touchZoomDistanceStart=_touchZoomDistanceEnd=0;var x=(event.touches[0].pageX+event.touches[1].pageX)/2;var y=(event.touches[0].pageY+event.touches[1].pageY)/2;_panEnd.copy(getMouseOnScreen(x,y));_panStart.copy(_panEnd);break}_state=STATE.NONE}else{switch(_state){case 0:_movePrev.copy(_moveCurr);_moveCurr.copy(getMouseOnCircle(event.touches[0].pageX,event.touches[0].pageY));break;case 1:case 2:break;case 4:_touchZoomDistanceStart=_touchZoomDistanceEnd=0;_state=STATE.ZOOM;break;case 5:if(event.touches.length>=2){var x=(event.touches[0].pageX+event.touches[1].pageX)/2;var y=(event.touches[0].pageY+event.touches[1].pageY)/2;_panEnd.copy(getMouseOnScreen(x,y));_panStart.copy(_panEnd)}_state=STATE.PAN;break;case 99:var x=(event.touches[0].pageX+event.touches[1].pageX)/2;var y=(event.touches[0].pageY+event.touches[1].pageY)/2;_customEnd.copy(getMouseOnScreen(x,y));_customStart.copy(_customEnd);break;default:_state=STATE.NONE}}_this.dispatchEvent(endEvent)}_this2.domElement.addEventListener("contextmenu",function(event){event.preventDefault()},false);_this2.domElement.addEventListener("mousedown",mousedown,false);_this2.domElement.addEventListener("mousewheel",mousewheel,false);_this2.domElement.addEventListener("DOMMouseScroll",mousewheel,false);_this2.domElement.addEventListener("touchstart",touchstart,false);_this2.domElement.addEventListener("touchend",touchend,false);_this2.domElement.addEventListener("touchmove",touchmove,false);window.addEventListener("keydown",keydown,false);window.addEventListener("keyup",keyup,false);_this2.handleResize();_this2.update();return _this2}return Trackball}(THREE.EventDispatcher);exports.default=Trackball},{}],91:[function(require,module,exports){"use strict";var _typeof=typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"?function(obj){return typeof obj}:function(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol?"symbol":typeof obj};Object.defineProperty(exports,"__esModule",{value:true});function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}function _possibleConstructorReturn(self,call){if(!self){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return call&&((typeof call==="undefined"?"undefined":_typeof(call))==="object"||typeof call==="function")?call:self}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function, not "+(typeof superClass==="undefined"?"undefined":_typeof(superClass)))}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:false,writable:true,configurable:true}});if(superClass)Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass}var Trackballortho=function(_THREE$EventDispatche){_inherits(Trackballortho,_THREE$EventDispatche);function Trackballortho(object,domElement){var state=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{NONE:-1,ROTATE:1,ZOOM:2,PAN:0,SCROLL:4,TOUCH_ROTATE:4,TOUCH_ZOOM_PAN:5};_classCallCheck(this,Trackballortho);var _this2=_possibleConstructorReturn(this,(Trackballortho.__proto__||Object.getPrototypeOf(Trackballortho)).call(this));var _this=_this2;var STATE=state;_this2.object=object;_this2.domElement=domElement!==undefined?domElement:document;_this2.enabled=true;_this2.screen={left:0,top:0,width:0,height:0};_this2.radius=0;_this2.zoomSpeed=1.2;_this2.noZoom=false;_this2.noPan=false;_this2.staticMoving=false;_this2.dynamicDampingFactor=.2;_this2.keys=[65,83,68];_this2.target=new THREE.Vector3;var EPS=1e-6;var _changed=true;var _state=STATE.NONE,_prevState=STATE.NONE,_eye=new THREE.Vector3,_zoomStart=new THREE.Vector2,_zoomEnd=new THREE.Vector2,_touchZoomDistanceStart=0,_touchZoomDistanceEnd=0,_panStart=new THREE.Vector2,_panEnd=new THREE.Vector2;_this2.target0=_this2.target.clone();_this2.position0=_this2.object.position.clone();_this2.up0=_this2.object.up.clone();_this2.left0=_this2.object.left;_this2.right0=_this2.object.right;_this2.top0=_this2.object.top;_this2.bottom0=_this2.object.bottom;var changeEvent={type:"change"};var startEvent={type:"start"};var endEvent={type:"end"};_this2.handleResize=function(){if(this.domElement===document){this.screen.left=0;this.screen.top=0;this.screen.width=window.innerWidth;this.screen.height=window.innerHeight}else{var box=this.domElement.getBoundingClientRect();var d=this.domElement.ownerDocument.documentElement;this.screen.left=box.left+window.pageXOffset-d.clientLeft;this.screen.top=box.top+window.pageYOffset-d.clientTop;this.screen.width=box.width;this.screen.height=box.height}this.radius=.5*Math.min(this.screen.width,this.screen.height);this.left0=this.object.left;this.right0=this.object.right;this.top0=this.object.top;this.bottom0=this.object.bottom};_this2.handleEvent=function(event){if(typeof this[event.type]=="function"){this[event.type](event)}};var getMouseOnScreen=function(){var vector=new THREE.Vector2;return function getMouseOnScreen(pageX,pageY){vector.set((pageX-_this.screen.left)/_this.screen.width,(pageY-_this.screen.top)/_this.screen.height);return vector}}();_this2.zoomCamera=function(){if(_state===STATE.TOUCH_ZOOM_PAN){var factor=_touchZoomDistanceEnd/_touchZoomDistanceStart;_touchZoomDistanceStart=_touchZoomDistanceEnd;_this.object.zoom*=factor;_changed=true}else{var factor=1+(_zoomEnd.y-_zoomStart.y)*_this.zoomSpeed;if(Math.abs(factor-1)>EPS&&factor>0){_this.object.zoom/=factor;if(_this.staticMoving){_zoomStart.copy(_zoomEnd)}else{_zoomStart.y+=(_zoomEnd.y-_zoomStart.y)*this.dynamicDampingFactor}_changed=true}}};_this2.panCamera=function(){var mouseChange=new THREE.Vector2,objectUp=new THREE.Vector3,pan=new THREE.Vector3;return function panCamera(){mouseChange.copy(_panEnd).sub(_panStart);if(mouseChange.lengthSq()){var scale_x=(_this.object.right-_this.object.left)/_this.object.zoom;var scale_y=(_this.object.top-_this.object.bottom)/_this.object.zoom;mouseChange.x*=scale_x;mouseChange.y*=scale_y;pan.copy(_eye).cross(_this.object.up).setLength(mouseChange.x);pan.add(objectUp.copy(_this.object.up).setLength(mouseChange.y));_this.object.position.add(pan);_this.target.add(pan);if(_this.staticMoving){_panStart.copy(_panEnd)}else{_panStart.add(mouseChange.subVectors(_panEnd,_panStart).multiplyScalar(_this.dynamicDampingFactor))}_changed=true}}}();_this2.update=function(){_eye.subVectors(_this.object.position,_this.target);if(!_this.noZoom){_this.zoomCamera();if(_changed){_this.object.updateProjectionMatrix()}}if(!_this.noPan){_this.panCamera()}_this.object.position.addVectors(_this.target,_eye);_this.object.lookAt(_this.target);if(_changed){_this.dispatchEvent(changeEvent);_changed=false}};_this2.reset=function(){_state=STATE.NONE;_prevState=STATE.NONE;_this.target.copy(_this.target0);_this.object.position.copy(_this.position0);_this.object.up.copy(_this.up0);_eye.subVectors(_this.object.position,_this.target);_this.object.left=_this.left0;_this.object.right=_this.right0;_this.object.top=_this.top0;_this.object.bottom=_this.bottom0;_this.object.lookAt(_this.target);_this.dispatchEvent(changeEvent);_changed=false};function keydown(event){if(_this.enabled===false)return;window.removeEventListener("keydown",keydown);_prevState=_state;if(_state!==STATE.NONE){return}else if(event.keyCode===_this.keys[STATE.ROTATE]&&!_this.noRotate){_state=STATE.ROTATE}else if(event.keyCode===_this.keys[STATE.ZOOM]&&!_this.noZoom){_state=STATE.ZOOM}else if(event.keyCode===_this.keys[STATE.PAN]&&!_this.noPan){_state=STATE.PAN}}function keyup(event){if(_this.enabled===false)return;_state=_prevState;window.addEventListener("keydown",keydown,false)}function mousedown(event){if(_this.enabled===false)return;event.preventDefault();event.stopPropagation();if(_state===STATE.NONE){_state=event.button}if(_state===STATE.ROTATE&&!_this.noRotate){}else if(_state===STATE.ZOOM&&!_this.noZoom){_zoomStart.copy(getMouseOnScreen(event.pageX,event.pageY));_zoomEnd.copy(_zoomStart)}else if(_state===STATE.PAN&&!_this.noPan){_panStart.copy(getMouseOnScreen(event.pageX,event.pageY));_panEnd.copy(_panStart)}document.addEventListener("mousemove",mousemove,false);document.addEventListener("mouseup",mouseup,false);_this.dispatchEvent(startEvent)}function mousemove(event){if(_this.enabled===false)return;event.preventDefault();event.stopPropagation();if(_state===STATE.ROTATE&&!_this.noRotate){}else if(_state===STATE.ZOOM&&!_this.noZoom){_zoomEnd.copy(getMouseOnScreen(event.pageX,event.pageY))}else if(_state===STATE.PAN&&!_this.noPan){_panEnd.copy(getMouseOnScreen(event.pageX,event.pageY))}}function mouseup(event){if(_this.enabled===false)return;event.preventDefault();event.stopPropagation();_state=STATE.NONE;document.removeEventListener("mousemove",mousemove);document.removeEventListener("mouseup",mouseup);_this.dispatchEvent(endEvent)}function mousewheel(event){if(_this.enabled===false)return;event.preventDefault();event.stopPropagation();var delta=0;if(event.wheelDelta){delta=event.wheelDelta/40}else if(event.detail){delta=-event.detail/3}_this.dispatchEvent({type:"OnScroll",delta:delta});_this.dispatchEvent(startEvent);_this.dispatchEvent(endEvent)}function touchstart(event){if(_this.enabled===false)return;switch(event.touches.length){case 1:_state=STATE.TOUCH_ROTATE;break;case 2:_state=STATE.TOUCH_ZOOM_PAN;var dx=event.touches[0].pageX-event.touches[1].pageX;var dy=event.touches[0].pageY-event.touches[1].pageY;_touchZoomDistanceEnd=_touchZoomDistanceStart=Math.sqrt(dx*dx+dy*dy);var x=(event.touches[0].pageX+event.touches[1].pageX)/2;var y=(event.touches[0].pageY+event.touches[1].pageY)/2;_panStart.copy(getMouseOnScreen(x,y));_panEnd.copy(_panStart);break;default:_state=STATE.NONE}_this.dispatchEvent(startEvent)}function touchmove(event){if(_this.enabled===false)return;event.preventDefault();event.stopPropagation();switch(event.touches.length){case 1:break;case 2:var dx=event.touches[0].pageX-event.touches[1].pageX;var dy=event.touches[0].pageY-event.touches[1].pageY;_touchZoomDistanceEnd=Math.sqrt(dx*dx+dy*dy);var x=(event.touches[0].pageX+event.touches[1].pageX)/2;var y=(event.touches[0].pageY+event.touches[1].pageY)/2;_panEnd.copy(getMouseOnScreen(x,y));break;default:_state=STATE.NONE}}function touchend(event){if(_this.enabled===false)return;switch(event.touches.length){case 1:break;case 2:_touchZoomDistanceStart=_touchZoomDistanceEnd=0;var x=(event.touches[0].pageX+event.touches[1].pageX)/2;var y=(event.touches[0].pageY+event.touches[1].pageY)/2;_panEnd.copy(getMouseOnScreen(x,y));_panStart.copy(_panEnd);break}_state=STATE.NONE;_this.dispatchEvent(endEvent)}function contextmenu(event){event.preventDefault()}_this2.dispose=function(){this.domElement.removeEventListener("contextmenu",contextmenu,false);this.domElement.removeEventListener("mousedown",mousedown,false);this.domElement.removeEventListener("mousewheel",mousewheel,false);this.domElement.removeEventListener("MozMousePixelScroll",mousewheel,false);this.domElement.removeEventListener("touchstart",touchstart,false);this.domElement.removeEventListener("touchend",touchend,false);this.domElement.removeEventListener("touchmove",touchmove,false);document.removeEventListener("mousemove",mousemove,false);document.removeEventListener("mouseup",mouseup,false);window.removeEventListener("keydown",keydown,false);window.removeEventListener("keyup",keyup,false)};_this2.domElement.addEventListener("contextmenu",contextmenu,false);_this2.domElement.addEventListener("mousedown",mousedown,false);_this2.domElement.addEventListener("mousewheel",mousewheel,false);_this2.domElement.addEventListener("MozMousePixelScroll",mousewheel,false);_this2.domElement.addEventListener("touchstart",touchstart,false);_this2.domElement.addEventListener("touchend",touchend,false);_this2.domElement.addEventListener("touchmove",touchmove,false);window.addEventListener("keydown",keydown,false);window.addEventListener("keyup",keyup,false);_this2.handleResize();_this2.update();return _this2}return Trackballortho}(THREE.EventDispatcher);exports.default=Trackballortho},{}],92:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var _createClass=function(){function defineProperties(target,props){for(var i=0;i=bbox.min.x-epsilon&&point.y>=bbox.min.y-epsilon&&point.z>=bbox.min.z-epsilon&&point.x<=bbox.max.x+epsilon&&point.y<=bbox.max.y+epsilon&&point.z<=bbox.max.z+epsilon){return true}return false}},{key:"posdir",value:function posdir(position,direction){return{position:position,direction:direction}}},{key:"validatePlane",value:function validatePlane(plane){if(plane===null){window.console.log("Invalid plane.");window.console.log(plane);return false}if(!_core4.default.vector3(plane.position)){window.console.log("Invalid plane.position.");window.console.log(plane.position);return false}if(!_core4.default.vector3(plane.direction)){window.console.log("Invalid plane.direction.");window.console.log(plane.direction);return false}return true}},{key:"validateAabb",value:function validateAabb(aabb){if(aabb===null){window.console.log("Invalid aabb.");window.console.log(aabb);return false}if(!_core4.default.matrix4(aabb.toAABB)){window.console.log("Invalid aabb.toAABB: ");window.console.log(aabb.toAABB);return false}if(!_core4.default.vector3(aabb.center)){window.console.log("Invalid aabb.center.");window.console.log(aabb.center);return false}if(!(_core4.default.vector3(aabb.halfDimensions)&&aabb.halfDimensions.x>=0&&aabb.halfDimensions.y>=0&&aabb.halfDimensions.z>=0)){window.console.log("Invalid aabb.halfDimensions.");window.console.log(aabb.halfDimensions);return false}return true}}]);return Intersections}();exports.default=Intersections},{"./core.utils":95,"./core.validators":96}],93:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var _core=require("./core.intersections");var _core2=_interopRequireDefault(_core);var _core3=require("./core.pack");var _core4=_interopRequireDefault(_core3);var _core5=require("./core.validators");var _core6=_interopRequireDefault(_core5);var _core7=require("./core.utils");var _core8=_interopRequireDefault(_core7);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}exports.default={Intersections:_core2.default,Utils:_core8.default,Validators:_core6.default}},{"./core.intersections":92,"./core.pack":94,"./core.utils":95,"./core.validators":96}],94:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}var Pack=function Pack(){_classCallCheck(this,Pack)};exports.default=Pack},{}],95:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var _createClass=function(){function defineProperties(target,props){for(var i=0;i=0&&halfDimensions.y>=0&&halfDimensions.z>=0)){window.console.log("halfDimensions must be >= 0.");window.console.log(halfDimensions);return false}var min=center.clone().sub(halfDimensions);var max=center.clone().add(halfDimensions);return{min:min,max:max}}},{key:"minMaxPixelData",value:function minMaxPixelData(){var pixelData=arguments.length>0&&arguments[0]!==undefined?arguments[0]:[];var minMax=[65535,-32768];var numPixels=pixelData.length;for(var index=0;index=0&&objectToTest.halfDimensions.y>=0&&objectToTest.halfDimensions.z>=0)){return false}return true}},{key:"ray",value:function ray(objectToTest){if(!(objectToTest!==null&&typeof objectToTest!=="undefined"&&objectToTest.hasOwnProperty("position")&&this.vector3(objectToTest.position)&&objectToTest.hasOwnProperty("direction")&&this.vector3(objectToTest.direction))){return false}return true}}]);return Validators}();exports.default=Validators},{}],97:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var _geometries=require("./geometries.slice");var _geometries2=_interopRequireDefault(_geometries);var _geometries3=require("./geometries.voxel");var _geometries4=_interopRequireDefault(_geometries3);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}exports.default={Slice:_geometries2.default,Voxel:_geometries4.default}},{"./geometries.slice":98,"./geometries.voxel":99}],98:[function(require,module,exports){"use strict";var _typeof=typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"?function(obj){return typeof obj}:function(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol?"symbol":typeof obj};Object.defineProperty(exports,"__esModule",{value:true});var _createClass=function(){function defineProperties(target,props){for(var i=0;i4&&arguments[4]!==undefined?arguments[4]:new THREE.Matrix4;_classCallCheck(this,GeometriesSlice);var aabb={halfDimensions:halfDimensions,center:center,toAABB:toAABB};var plane={position:position,direction:direction};var intersections=_core2.default.aabbPlane(aabb,plane);if(intersections.length<3){window.console.log("WARNING: Less than 3 intersections between AABB and Plane.");window.console.log("AABB");window.console.log(aabb);window.console.log("Plane");window.console.log(plane);window.console.log("exiting...");throw"geometries.slice has less than 3 intersections, can not create a valid geometry."}var orderedIntersections=GeometriesSlice.orderIntersections(intersections,direction);var sliceShape=GeometriesSlice.shape(orderedIntersections);var _this=_possibleConstructorReturn(this,(GeometriesSlice.__proto__||Object.getPrototypeOf(GeometriesSlice)).call(this,sliceShape));_this.type="SliceGeometry";_this.vertices=orderedIntersections;_this.verticesNeedUpdate=true;return _this}_createClass(GeometriesSlice,null,[{key:"shape",value:function shape(points){var shape=new THREE.Shape;shape.moveTo(points[0].xy.x,points[0].xy.y);for(var l=1;l1&&arguments[1]!==undefined?arguments[1]:"default";var lutO=arguments.length>2&&arguments[2]!==undefined?arguments[2]:"linear";var color=arguments.length>3&&arguments[3]!==undefined?arguments[3]:[[0,0,0,0],[1,1,1,1]];var opacity=arguments.length>4&&arguments[4]!==undefined?arguments[4]:[[0,0],[1,1]];_classCallCheck(this,HelpersLut);this._containerID=containerID;this._color=color;this._lut=lut;this._luts=_defineProperty({},lut,color);this._opacity=opacity;this._lutO=lutO;this._lutsO=_defineProperty({},lutO,opacity);this.initCanvas();this.paintCanvas()}_createClass(HelpersLut,[{key:"initCanvas",value:function initCanvas(){this._canvasContainer=this.initCanvasContainer(this._containerID);this._canvasBg=this.createCanvas();this._canvasContainer.appendChild(this._canvasBg);this._canvas=this.createCanvas();this._canvasContainer.appendChild(this._canvas)}},{key:"initCanvasContainer",value:function initCanvasContainer(canvasContainerId){var canvasContainer=document.getElementById(canvasContainerId);canvasContainer.style.width="256 px";canvasContainer.style.height="128 px";canvasContainer.style.border="1px solid #F9F9F9";return canvasContainer}},{key:"createCanvas",value:function createCanvas(){var canvas=document.createElement("canvas");canvas.height=16;canvas.width=256;return canvas}},{key:"paintCanvas",value:function paintCanvas(){var ctx=this._canvas.getContext("2d");ctx.clearRect(0,0,this._canvas.width,this._canvas.height);ctx.globalCompositeOperation="source-over";var color=ctx.createLinearGradient(0,0,this._canvas.width,this._canvas.height);for(var i=0;i0&&arguments[0]!==undefined?arguments[0]:"color";var available=[];var luts=this._luts;if(type!=="color"){luts=this._lutsO}for(var i in luts){available.push(i)}return available}},{key:"texture",get:function get(){var texture=new THREE.Texture(this._canvas);texture.mapping=THREE.UVMapping;texture.wrapS=texture.wrapT=THREE.ClampToEdgeWrapping;texture.magFilter=texture.minFilter=THREE.NearestFilter;texture.premultiplyAlpha=true;texture.needsUpdate=true;return texture}},{key:"lut",set:function set(targetLUT){this._color=this._luts[targetLUT]; +this._lut=targetLUT;this.paintCanvas()},get:function get(){return this._lut}},{key:"luts",set:function set(newLuts){this._luts=newLuts},get:function get(){return this._luts}},{key:"lutO",set:function set(targetLUTO){this._opacity=this._lutsO[targetLUTO];this._lutO=targetLUTO;this.paintCanvas()},get:function get(){return this._lutO}},{key:"lutsO",set:function set(newLutsO){this._lutsO=newLutsO},get:function get(){return this._lutsO}}],[{key:"presetLuts",value:function presetLuts(){return{default:[[0,0,0,0],[1,1,1,1]],spectrum:[[0,0,0,0],[.1,0,0,1],[.33,0,1,1],[.5,0,1,0],[.66,1,1,0],[.9,1,0,0],[1,1,1,1]],hot_and_cold:[[0,0,0,1],[.15,0,1,1],[.3,0,1,0],[.45,0,0,0],[.5,0,0,0],[.55,0,0,0],[.7,1,1,0],[.85,1,0,0],[1,1,1,1]],gold:[[0,0,0,0],[.13,.19,.03,0],[.25,.39,.12,0],[.38,.59,.26,0],[.5,.8,.46,.08],[.63,.99,.71,.21],[.75,.99,.88,.34],[.88,.99,.99,.48],[1,.9,.95,.61]],red:[[0,.75,0,0],[.5,1,.5,0],[.95,1,1,0],[1,1,1,1]],green:[[0,0,.75,0],[.5,.5,1,0],[.95,1,1,0],[1,1,1,1]],blue:[[0,0,0,1],[.5,0,.5,1],[.95,0,1,1],[1,1,1,1]],walking_dead:[[0,.1,1,1],[1,1,1,1]],random:[[0,0,0,0],[.27,.18,.18,.18],[.41,1,1,1],[.7,1,0,0],[1,1,1,1]]}}},{key:"presetLutsO",value:function presetLutsO(){return{linear:[[0,0],[1,1]],lowpass:[[0,.8],[.2,.6],[.3,.1],[1,0]],bandpass:[[0,0],[.4,.8],[.6,.8],[1,0]],highpass:[[0,0],[.7,.1],[.8,.6],[1,.8]],flat:[[0,.7],[1,1]],random:[[0,0],[.38,0],[.55,1],[.72,1],[1,.05]]}}}]);return HelpersLut}();exports.default=HelpersLut},{}],104:[function(require,module,exports){"use strict";var _typeof=typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"?function(obj){return typeof obj}:function(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol?"symbol":typeof obj};Object.defineProperty(exports,"__esModule",{value:true});var _createClass=function(){function defineProperties(target,props){for(var i=0;i0){progressContainers[0].parentNode.removeChild(progressContainers[0])}progressContainers=null;window.cancelAnimationFrame(this.requestAnimationFrameID)}},{key:"init",value:function init(){var progressContainer=this._domContainer();for(var mode in this._modes){if(this._modes.hasOwnProperty(mode)){var bar=this._domBar(this._modes[mode]);progressContainer.appendChild(bar);bar=null}}this._container.appendChild(progressContainer);progressContainer=null;this.updateUI()}},{key:"update",value:function update(value,total,mode){this._mode=mode;this._value=value;if(total===0){this._total=value;this._value=Math.random()*value}else{this._total=total}}},{key:"updateUI",value:function updateUI(){var _this=this;this.requestAnimationFrameID=requestAnimationFrame(function(){_this.updateUI()});if(!(this._modes.hasOwnProperty(this._mode)&&this._modes[this._mode].hasOwnProperty("name")&&this._modes[this._mode].hasOwnProperty("color"))){return false}var message="";var progress=Math.round(this._value/this._total*100);var color=this._modes[this._mode].color;var progressBar=this._container.getElementsByClassName("progress "+this._modes[this._mode].name);if(progressBar.length>0){progressBar[0].style.borderColor=color;progressBar[0].style.width=progress+"%"}progressBar=null}},{key:"_domContainer",value:function _domContainer(){var container=document.createElement("div");container.classList.add("progress");container.classList.add("container");container.style.width="100%";container.style.height="8px";container.style.position="absolute";container.style.backgroundColor="rgba(158, 158, 158, 0.5)";container.style.top="0";container.style.zIndex="1";return container}},{key:"_domBar",value:function _domBar(mode){if(!(mode.hasOwnProperty("name")&&mode.hasOwnProperty("color"))){window.console.log("Invalid mode provided.");window.console.log(mode);return false}var bar=document.createElement("div");bar.classList.add(mode.name);bar.classList.add("progress");bar.style.border="2px solid "+mode.color;bar.style.width="0%";return bar}}]);return HelpersProgressBar}();exports.default=HelpersProgressBar},{}],106:[function(require,module,exports){"use strict";var _typeof=typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"?function(obj){return typeof obj}:function(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol?"symbol":typeof obj};Object.defineProperty(exports,"__esModule",{value:true});var _createClass=function(){function defineProperties(target,props){for(var i=0;i1&&arguments[1]!==undefined?arguments[1]:0;var position=arguments.length>2&&arguments[2]!==undefined?arguments[2]:new THREE.Vector3(0,0,0);var direction=arguments.length>3&&arguments[3]!==undefined?arguments[3]:new THREE.Vector3(0,0,1);var aabbSpace=arguments.length>4&&arguments[4]!==undefined?arguments[4]:"IJK";_classCallCheck(this,HelpersSlice);var _this=_possibleConstructorReturn(this,(HelpersSlice.__proto__||Object.getPrototypeOf(HelpersSlice)).call(this));_this._stack=stack;_this._invert=_this._stack.invert;_this._lut="none";_this._lutTexture=null;_this._intensityAuto=true;_this._interpolation=1;_this._index=index;_this._windowWidth=null;_this._windowCenter=null;_this._rescaleSlope=null;_this._rescaleIntercept=null;_this._planePosition=position;_this._planeDirection=direction;_this._aaBBspace=aabbSpace;_this._material=null;_this._textures=[];_this._shadersFragment=_shadersData6.default;_this._shadersVertex=_shadersData4.default;_this._uniforms=_shadersData2.default.uniforms();_this._geometry=null;_this._mesh=null;_this._visible=true;_this._init();_this._create();return _this}_createClass(HelpersSlice,[{key:"_init",value:function _init(){if(!this._stack||!this._stack._prepared||!this._stack._packed){return}if(this._aaBBspace==="IJK"){this._halfDimensions=this._stack.halfDimensionsIJK;this._center=new THREE.Vector3(this._stack.halfDimensionsIJK.x-.5,this._stack.halfDimensionsIJK.y-.5,this._stack.halfDimensionsIJK.z-.5);this._toAABB=new THREE.Matrix4}else{var aaBBox=this._stack.AABBox();this._halfDimensions=aaBBox.clone().multiplyScalar(.5);this._center=this._stack.centerAABBox();this._toAABB=this._stack.lps2AABB}}},{key:"_create",value:function _create(){if(!this._stack||!this._stack.prepared||!this._stack.packed){return}try{this._geometry=new _geometries2.default(this._halfDimensions,this._center,this._planePosition,this._planeDirection,this._toAABB)}catch(e){window.console.log(e);window.console.log("invalid slice geometry - exiting...");return}if(!this._geometry.vertices){return}if(!this._material){this._uniforms.uTextureSize.value=this._stack.textureSize;this._uniforms.uDataDimensions.value=[this._stack.dimensionsIJK.x,this._stack.dimensionsIJK.y,this._stack.dimensionsIJK.z];this._uniforms.uWorldToData.value=this._stack.lps2IJK;this._uniforms.uNumberOfChannels.value=this._stack.numberOfChannels;this._uniforms.uPixelType.value=this._stack.pixelType;this._uniforms.uBitsAllocated.value=this._stack.bitsAllocated;this._uniforms.uPackedPerPixel.value=this._stack.packedPerPixel;this._prepareTexture();this._uniforms.uTextureContainer.value=this._textures;this._createMaterial({side:THREE.DoubleSide})}this.updateIntensitySettings();this.updateIntensitySettingsUniforms();this._mesh=new THREE.Mesh(this._geometry,this._material);if(this._aaBBspace==="IJK"){this._mesh.applyMatrix(this._stack.ijk2LPS)}this._mesh.visible=this._visible;this.add(this._mesh)}},{key:"updateIntensitySettings",value:function updateIntensitySettings(){if(this._intensityAuto){this.updateIntensitySetting("windowCenter");this.updateIntensitySetting("windowWidth");this.updateIntensitySetting("rescaleSlope");this.updateIntensitySetting("rescaleIntercept")}else{if(this._windowCenter===null){this._windowCenter=this._stack.windowCenter}if(this.__windowWidth===null){this._windowWidth=this._stack.windowWidth}if(this._rescaleSlope===null){this._rescaleSlope=this._stack.rescaleSlope}if(this._rescaleIntercept===null){this._rescaleIntercept=this._stack.rescaleIntercept}}}},{key:"updateIntensitySettingsUniforms",value:function updateIntensitySettingsUniforms(){this._uniforms.uRescaleSlopeIntercept.value=[this._rescaleSlope,this._rescaleIntercept];this._uniforms.uWindowCenterWidth.value=[this._windowCenter,this._windowWidth];this._uniforms.uInvert.value=this._invert===true?1:0;this._uniforms.uInterpolation.value=this._interpolation;if(this._lut==="none"){this._uniforms.uLut.value=0}else{this._uniforms.uLut.value=1;this._uniforms.uTextureLUT.value=this._lutTexture}}},{key:"updateIntensitySetting",value:function updateIntensitySetting(setting){if(this._stack.frame[this._index]&&this._stack.frame[this._index][setting]){this["_"+setting]=this._stack.frame[this._index][setting]}else{this["_"+setting]=this._stack[setting]}}},{key:"_update",value:function _update(){if(this._mesh){this.remove(this._mesh);this._mesh.geometry.dispose();this._mesh.geometry=null;this._mesh=null}this._create()}},{key:"stack",get:function get(){return this._stack},set:function set(stack){this._stack=stack}},{key:"windowWidth",get:function get(){return this._windowWidth},set:function set(windowWidth){this._windowWidth=windowWidth;this.updateIntensitySettingsUniforms()}},{key:"windowCenter",get:function get(){return this._windowCenter},set:function set(windowCenter){this._windowCenter=windowCenter;this.updateIntensitySettingsUniforms()}},{key:"rescaleSlope",get:function get(){return this._rescaleSlope},set:function set(rescaleSlope){this._rescaleSlope=rescaleSlope;this.updateIntensitySettingsUniforms()}},{key:"rescaleIntercept",get:function get(){return this._rescaleIntercept},set:function set(rescaleIntercept){this._rescaleIntercept=rescaleIntercept;this.updateIntensitySettingsUniforms()}},{key:"invert",get:function get(){return this._invert},set:function set(invert){this._invert=invert;this.updateIntensitySettingsUniforms()}},{key:"lut",get:function get(){return this._lut},set:function set(lut){this._lut=lut}},{key:"lutTexture",get:function get(){return this._lutTexture},set:function set(lutTexture){this._lutTexture=lutTexture;this.updateIntensitySettingsUniforms()}},{key:"intensityAuto",get:function get(){return this._intensityAuto},set:function set(intensityAuto){this._intensityAuto=intensityAuto;this.updateIntensitySettings();this.updateIntensitySettingsUniforms()}},{key:"interpolation",get:function get(){return this._interpolation},set:function set(interpolation){this._interpolation=interpolation;this.updateIntensitySettingsUniforms();this._updateMaterial()}},{key:"index",get:function get(){return this._index},set:function set(index){this._index=index;this._update()}},{key:"planePosition",set:function set(position){this._planePosition=position;this._update()},get:function get(){return this._planePosition}},{key:"planeDirection",set:function set(direction){this._planeDirection=direction;this._update()},get:function get(){return this._planeDirection}},{key:"halfDimensions",set:function set(halfDimensions){this._halfDimensions=halfDimensions},get:function get(){return this._halfDimensions}},{key:"center",set:function set(center){this._center=center},get:function get(){return this._center}},{key:"aabbSpace",set:function set(aabbSpace){this._aaBBspace=aabbSpace;this._init()},get:function get(){return this._aaBBspace}},{key:"mesh",set:function set(mesh){this._mesh=mesh},get:function get(){return this._mesh}},{key:"geometry",set:function set(geometry){this._geometry=geometry},get:function get(){return this._geometry}}]);return HelpersSlice}((0,_helpersMaterial2.default)(THREE.Object3D));exports.default=HelpersSlice},{"../../src/geometries/geometries.slice":98,"../../src/helpers/helpers.material.mixin":104,"../../src/shaders/shaders.data.fragment":131,"../../src/shaders/shaders.data.uniform":132,"../../src/shaders/shaders.data.vertex":133}],107:[function(require,module,exports){"use strict";var _typeof=typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"?function(obj){return typeof obj}:function(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol?"symbol":typeof obj};Object.defineProperty(exports,"__esModule",{value:true});var _createClass=function(){function defineProperties(target,props){for(var i=0;i=dimensions||this._index<0){this._outOfBounds=true}else{this._outOfBounds=false}}},{key:"_prepareStack",value:function _prepareStack(){if(!this._stack.prepared){this._stack.prepare()}if(!this._stack.packed){this._stack.pack()}}},{key:"_prepareBBox",value:function _prepareBBox(){this._bBox=new _helpers4.default(this._stack);this.add(this._bBox)}},{key:"_prepareBorder",value:function _prepareBorder(){this._border=new _helpers2.default(this._slice);this.add(this._border)}},{key:"_prepareSlice",value:function _prepareSlice(){var halfDimensionsIJK=this._stack.halfDimensionsIJK;this._index=this._prepareSliceIndex(halfDimensionsIJK);var position=this._prepareSlicePosition(halfDimensionsIJK,this._index);var direction=this._prepareDirection(this._orientation);this._slice=new _helpers6.default(this._stack,this._index,position,direction);this.add(this._slice)}},{key:"_prepareSliceIndex",value:function _prepareSliceIndex(indices){var index=0;switch(this._orientation){case 0:index=Math.floor(indices.z);break;case 1:index=Math.floor(indices.x);break;case 2:index=Math.floor(indices.y);break;default:break}return index}},{key:"_prepareSlicePosition",value:function _prepareSlicePosition(rPosition,index){var position=new THREE.Vector3(0,0,0);switch(this._orientation){case 0:position=new THREE.Vector3(Math.floor(rPosition.x),Math.floor(rPosition.y),index);break;case 1:position=new THREE.Vector3(index,Math.floor(rPosition.y),Math.floor(rPosition.z));break;case 2:position=new THREE.Vector3(Math.floor(rPosition.x),index,Math.floor(rPosition.z));break;default:break}return position}},{key:"_prepareDirection",value:function _prepareDirection(orientation){var direction=new THREE.Vector3(0,0,1);switch(orientation){case 0:direction=new THREE.Vector3(0,0,1);break;case 1:direction=new THREE.Vector3(1,0,0);break;case 2:direction=new THREE.Vector3(0,1,0);break;default:break}return direction}},{key:"stack",get:function get(){return this._stack}},{key:"bbox",get:function get(){return this._bBox}},{key:"slice",get:function get(){return this._slice}},{key:"border",get:function get(){return this._border}},{key:"index",get:function get(){return this._index},set:function set(index){this._index=index;this._slice.index=index;var halfDimensions=this._stack.halfDimensionsIJK;this._slice.planePosition=this._prepareSlicePosition(halfDimensions,this._index);this._border.helpersSlice=this._slice;this._isIndexOutOfBounds()}},{key:"orientation",set:function set(orientation){this._orientation=orientation;this._slice.planeDirection=this._prepareDirection(this._orientation);this._border.helpersSlice=this._slice},get:function get(){return this._orientation}},{key:"outOfBounds",set:function set(outOfBounds){this._outOfBounds=outOfBounds},get:function get(){return this._outOfBounds}}]);return HelpersStack}(THREE.Object3D);exports.default=HelpersStack},{"../../src/helpers/helpers.border":100,"../../src/helpers/helpers.boundingbox":101,"../../src/helpers/helpers.slice":106}],108:[function(require,module,exports){"use strict";var _typeof=typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"?function(obj){return typeof obj}:function(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol?"symbol":typeof obj};Object.defineProperty(exports,"__esModule",{value:true});var _createClass=function(){function defineProperties(target,props){for(var i=0;i0&&arguments[0]!==undefined?arguments[0]:null;var stack=arguments.length>1&&arguments[1]!==undefined?arguments[1]:null;_classCallCheck(this,HelpersVoxel);var _this=_possibleConstructorReturn(this,(HelpersVoxel.__proto__||Object.getPrototypeOf(HelpersVoxel)).call(this));_this._stack=stack;_this._worldCoordinates=worldCoordinates;_this._voxel=new _models4.default;_this._voxel.id=_this.id; +_this._voxel.worldCoordinates=_this._worldCoordinates;if(_this._stack&&_this._stack.prepared&&_this._worldCoordinates){_this.updateVoxel(_this._worldCoordinates)}_this._mesh=null;_this._geometry=null;_this._material=null;_this._selected=false;_this._active=false;_this._hover=false;_this._distance=null;_this._showVoxel=true;_this._showDomSVG=true;_this._showDomMeasurements=true;_this._color="#00B0FF";_this._svgPointer=' ';_this.createMesh();return _this}_createClass(HelpersVoxel,[{key:"updateVoxel",value:function updateVoxel(worldCoordinates){this._voxel.worldCoordinates=worldCoordinates;this._voxel.dataCoordinates=_models2.default.worldToData(this._stack,this._voxel.worldCoordinates);var value=_models2.default.value(this._stack,this._voxel.dataCoordinates);this._voxel.value=_models2.default.valueRescaleSlopeIntercept(value,this._stack.rescaleSlope,this._stack.rescaleIntercept)}},{key:"updateVoxelScreenCoordinates",value:function updateVoxelScreenCoordinates(camera,container){this._voxel.screenCoordinates=HelpersVoxel.worldToScreen(this._worldCoordinates,camera,container)}},{key:"createMesh",value:function createMesh(){var dataCoordinates=_models2.default.worldToData(this._stack,this._worldCoordinates);this._geometry=new _geometries2.default(dataCoordinates);this._material=new THREE.MeshBasicMaterial({wireframe:true,wireframeLinewidth:2});this._material.color.set(this._color);this._mesh=new THREE.Mesh(this._geometry,this._material);this._mesh.applyMatrix(this._stack.ijk2LPS);this._mesh.visible=this._showVoxel;this.add(this._mesh)}},{key:"createDom",value:function createDom(){var measurementsContainer=this._createDiv("VJSVoxelMeasurements",this.id,"VJSVoxelMeasurements");var rasContainer=this._createDiv("VJSVoxelProbeWorld",this.id,"VJSVoxelProbeWorld");measurementsContainer.appendChild(rasContainer);var ijkContainer=this._createDiv("VJSVoxelProbeData",this.id,"VJSVoxelProbeData");measurementsContainer.appendChild(ijkContainer);var valueContainer=this._createDiv("VJSVoxelProbeValue",this.id,"VJSVoxelProbeValue");measurementsContainer.appendChild(valueContainer);var svgContainer=this._createDiv("VJSVoxelProbeSVG",this.id,"VJSVoxelProbeSVG");svgContainer.innerHTML=this._svgPointer;var domElement=this._createDiv("VJSWidgetVoxelProbe",this.id,"VJSWidgetVoxelProbe");domElement.appendChild(svgContainer);domElement.appendChild(measurementsContainer);return domElement}},{key:"updateDom",value:function updateDom(container){if(document.getElementById("VJSVoxelProbeWorld"+this.id)===null){container.appendChild(this.createDom())}var rasContainer=document.getElementById("VJSVoxelProbeWorld"+this.id);var rasContent=this._voxel.worldCoordinates.x.toFixed(2)+" : "+this._voxel.worldCoordinates.y.toFixed(2)+" : "+this._voxel.worldCoordinates.z.toFixed(2);rasContainer.innerHTML="LPS: "+rasContent;var ijkContainer=document.getElementById("VJSVoxelProbeData"+this.id);var ijkContent=this._voxel.dataCoordinates.x+" : "+this._voxel.dataCoordinates.y+" : "+this._voxel.dataCoordinates.z;ijkContainer.innerHTML="IJK: "+ijkContent;var valueContainer=document.getElementById("VJSVoxelProbeValue"+this.id);var valueContent=this._voxel.value;valueContainer.innerHTML="Value: "+valueContent;var selectedElement=document.getElementById("VJSWidgetVoxelProbe"+this.id);selectedElement.style.top=this._voxel.screenCoordinates.y;selectedElement.style.left=this._voxel.screenCoordinates.x;this.updateDomClass(selectedElement)}},{key:"updateDomClass",value:function updateDomClass(){var element=document.getElementById("VJSWidgetVoxelProbe"+this.id);if(this._active===true){element.classList.add("VJSVoxelProbeActive")}else{element.classList.remove("VJSVoxelProbeActive")}if(this._hover===true){element.classList.add("VJSVoxelProbeHover")}else{element.classList.remove("VJSVoxelProbeHover")}if(this._selected===true){element.classList.add("VJSVoxelProbeSelect")}else{element.classList.remove("VJSVoxelProbeSelect")}this.updateDomElementDisplay("VJSVoxelMeasurements"+this.id,this._showDomMeasurements);this.updateDomElementDisplay("VJSVoxelProbeSVG"+this.id,this._showDomSVG)}},{key:"updateDomElementDisplay",value:function updateDomElementDisplay(id,show){if(show){document.getElementById(id).style.display="block"}else{document.getElementById(id).style.display="none"}}},{key:"removeTest",value:function removeTest(){var node=document.getElementById("VJSWidgetVoxelProbe"+this.id);if(node.parentNode){node.parentNode.removeChild(node)}this.remove(this._mesh);this._mesh.geometry.dispose();this._mesh.material.dispose();this._mesh=null}},{key:"_createDiv",value:function _createDiv(idPrefix,idSuffix,className){var divContainer=document.createElement("div");divContainer.setAttribute("id",idPrefix+idSuffix);divContainer.setAttribute("class",className);return divContainer}},{key:"color",set:function set(color){this._color=color;if(this._material){this._material.color.set(this._color)}var selectedElement=document.getElementById("VJSVoxelMeasurements"+this.id);if(selectedElement){selectedElement.style.borderColor=this._color.replace("0x","#")}selectedElement=document.querySelector("#VJSVoxelProbeSVG"+this.id+"> svg > path");if(selectedElement){selectedElement.style.stroke=this._color.replace("0x","#")}},get:function get(){return this._color}},{key:"worldCoordinates",set:function set(worldCoordinates){this._worldCoordinates=worldCoordinates;this._voxel._worldCoordinates=worldCoordinates;this.updateVoxel(this._worldCoordinates);if(this._mesh&&this._mesh.geometry){this._mesh.geometry.location=this._voxel.dataCoordinates}},get:function get(){return this._worldCoordinates}},{key:"voxel",get:function get(){return this._voxel},set:function set(voxel){this._voxel=voxel}},{key:"showVoxel",set:function set(showVoxel){this._showVoxel=showVoxel;if(this._mesh){this._mesh.visible=this._showVoxel}},get:function get(){return this._showVoxel}},{key:"showDomSVG",set:function set(showDomSVG){this._showDomSVG=showDomSVG;this.updateDomClass()},get:function get(){return this._showDomSVG}},{key:"showDomMeasurements",set:function set(showDomMeasurements){this._showDomMeasurements=showDomMeasurements;this.updateDomClass()},get:function get(){return this._showDomMeasurements}},{key:"distance",set:function set(distance){this._distance=distance},get:function get(){return this._distance}},{key:"selected",set:function set(selected){this._selected=selected},get:function get(){return this._selected}},{key:"hover",set:function set(hover){this._hover=hover},get:function get(){return this._hover}},{key:"active",set:function set(active){this._active=active},get:function get(){return this._active}}],[{key:"worldToScreen",value:function worldToScreen(worldCoordinate,camera,canvas){var screenCoordinates=worldCoordinate.clone();screenCoordinates.project(camera);screenCoordinates.x=Math.round((screenCoordinates.x+1)*canvas.offsetWidth/2);screenCoordinates.y=Math.round((-screenCoordinates.y+1)*canvas.offsetHeight/2);screenCoordinates.z=0;return screenCoordinates}}]);return HelpersVoxel}(THREE.Object3D);exports.default=HelpersVoxel},{"../../src/geometries/geometries.voxel":99,"../../src/models/models.stack":117,"../../src/models/models.voxel":118}],110:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var _createClass=function(){function defineProperties(target,props){for(var i=0;i0&&arguments[0]!==undefined?arguments[0]:document.body;var helpersProgress=arguments.length>1&&arguments[1]!==undefined?arguments[1]:_helpers2.default;_classCallCheck(this,LoadersBase);this._loaded=-1;this._totalLoaded=-1;this._parsed=-1;this._totalParsed=-1;this._container=container;this._helpersProgressBar=helpersProgress;this._progressBar=null;if(this._container&&this._helpersProgressBar){this._progressBar=new helpersProgress(this._container)}}_createClass(LoadersBase,[{key:"free",value:function free(){this._container=null;this._helpersProgressBar=null;if(this._progressBar){this._progressBar.free();this._progressBar=null}}},{key:"fetch",value:function fetch(url){var _this=this;return new Promise(function(resolve,reject){var request=new XMLHttpRequest;request.open("GET",url);request.crossOrigin=true;request.responseType="arraybuffer";request.onload=function(event){if(request.status===200){_this._loaded=event.loaded;_this._totalLoaded=event.total;if(_this._progressBar){_this._progressBar.update(_this._loaded,_this._totalLoaded,"load")}var buffer=request.response;var response={url:url,buffer:buffer};resolve(response)}else{reject(request.statusText)}};request.onerror=function(){reject(request.statusText)};request.onprogress=function(event){_this._loaded=event.loaded;_this._totalLoaded=event.total;if(_this._progressBar){_this._progressBar.update(_this._loaded,_this._totalLoaded,"load")}};request.send()})}}]);return LoadersBase}();exports.default=LoadersBase},{"../../src/helpers/helpers.progressbar":105,"../../src/models/models.frame":114,"../../src/models/models.series":116,"../../src/models/models.stack":117}],111:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var _loaders=require("./loaders.volume");var _loaders2=_interopRequireDefault(_loaders);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}exports.default={Volume:_loaders2.default}},{"./loaders.volume":112}],112:[function(require,module,exports){"use strict";var _typeof=typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"?function(obj){return typeof obj}:function(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol?"symbol":typeof obj};Object.defineProperty(exports,"__esModule",{value:true});var _createClass=function(){function defineProperties(target,props){for(var i=0;i0&&yCos.length()>0){cosines[0]=xCos;cosines[1]=yCos;cosines[2]=new THREE.Vector3(0,0,0).crossVectors(cosines[0],cosines[1]).normalize()}}else{window.console.log("No valid image orientation for frame");window.console.log(this);window.console.log("Returning default orientation.")}return cosines}},{key:"spacingXY",value:function spacingXY(){var spacingXY=[1,1];if(this.pixelSpacing){spacingXY[0]=this.pixelSpacing[0];spacingXY[1]=this.pixelSpacing[1]}else if(this.pixelAspectRatio){spacingXY[0]=1;spacingXY[1]=1*this.pixelAspectRatio[1]/this.pixelAspectRatio[0]}return spacingXY}},{key:"value",value:function value(column,row){return this.pixelData[column+this._columns*row]}},{key:"_compareArrays",value:function _compareArrays(reference,target){if(reference===target){return true}if(reference&&target&&reference.join()===target.join()){return true}return false}},{key:"rows",get:function get(){return this._rows},set:function set(rows){this._rows=rows}},{key:"columns",get:function get(){return this._columns},set:function set(columns){this._columns=columns}},{key:"spacingBetweenSlices",get:function get(){return this._spacingBetweenSlices},set:function set(spacingBetweenSlices){this._spacingBetweenSlices=spacingBetweenSlices}},{key:"sliceThickness",get:function get(){return this._sliceThickness},set:function set(sliceThickness){this._sliceThickness=sliceThickness}},{key:"imagePosition",get:function get(){return this._imagePosition},set:function set(imagePosition){this._imagePosition=imagePosition}},{key:"imageOrientation",get:function get(){return this._imageOrientation},set:function set(imageOrientation){this._imageOrientation=imageOrientation}},{key:"windowWidth",get:function get(){return this._windowWidth},set:function set(windowWidth){this._windowWidth=windowWidth}},{key:"windowCenter",get:function get(){return this._windowCenter},set:function set(windowCenter){this._windowCenter=windowCenter}},{key:"rescaleSlope",get:function get(){return this._rescaleSlope},set:function set(rescaleSlope){this._rescaleSlope=rescaleSlope}},{key:"rescaleIntercept",get:function get(){return this._rescaleIntercept},set:function set(rescaleIntercept){this._rescaleIntercept=rescaleIntercept}},{key:"bitsAllocated",get:function get(){return this._bitsAllocated},set:function set(bitsAllocated){this._bitsAllocated=bitsAllocated}},{key:"dist",get:function get(){return this._dist},set:function set(dist){this._dist=dist}},{key:"pixelSpacing",get:function get(){return this._pixelSpacing},set:function set(pixelSpacing){this._pixelSpacing=pixelSpacing}},{key:"pixelAspectRatio",get:function get(){return this._pixelAspectRatio},set:function set(pixelAspectRatio){this._pixelAspectRatio=pixelAspectRatio}},{key:"minMax",get:function get(){return this._minMax},set:function set(minMax){this._minMax=minMax}},{key:"dimensionIndexValues",get:function get(){return this._dimensionIndexValues},set:function set(dimensionIndexValues){this._dimensionIndexValues=dimensionIndexValues}},{key:"instanceNumber",get:function get(){return this._instanceNumber},set:function set(instanceNumber){this._instanceNumber=instanceNumber}},{key:"pixelData",get:function get(){return this._pixelData},set:function set(pixelData){this._pixelData=pixelData}},{key:"sopInstanceUID",set:function set(sopInstanceUID){this._sopInstanceUID=sopInstanceUID},get:function get(){return this._sopInstanceUID}},{key:"pixelType",get:function get(){return this._pixelType},set:function set(pixelType){this._pixelType=pixelType}},{key:"url",get:function get(){return this._url},set:function set(url){this._url=url}},{key:"referencedSegmentNumber",get:function get(){return this._referencedSegmentNumber},set:function set(referencedSegmentNumber){this._referencedSegmentNumber=referencedSegmentNumber}}]);return ModelsFrame}(_models2.default);exports.default=ModelsFrame},{"../../src/models/models.base":113}],115:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var _models=require("./models.frame");var _models2=_interopRequireDefault(_models);var _models3=require("./models.stack");var _models4=_interopRequireDefault(_models3);var _models5=require("./models.series");var _models6=_interopRequireDefault(_models5);var _models7=require("./models.voxel");var _models8=_interopRequireDefault(_models7);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}exports.default={Frame:_models2.default,Stack:_models4.default,Series:_models6.default,Voxel:_models8.default}},{"./models.frame":114,"./models.series":116,"./models.stack":117,"./models.voxel":118}],116:[function(require,module,exports){"use strict";var _typeof=typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"?function(obj){return typeof obj}:function(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol?"symbol":typeof obj};Object.defineProperty(exports,"__esModule",{value:true});var _createClass=function(){function defineProperties(target,props){for(var i=0;i0){this._numberOfFrames=this._frame.length}else{window.console.log("_frame doesn't contain anything....");window.console.log(this._frame);return false}this._rows=this._frame[0].rows;this._columns=this._frame[0].columns;this._dimensionsIJK=new THREE.Vector3(this._columns,this._rows,this._numberOfFrames);this._halfDimensionsIJK=new THREE.Vector3(this._dimensionsIJK.x/2,this._dimensionsIJK.y/2,this._dimensionsIJK.z/2);this._spacingBetweenSlices=this._frame[0].spacingBetweenSlices;this._sliceThickness=this._frame[0].sliceThickness;this.computeCosines();this.orderFrames();this.computeSpacing();if(!this._frame[0].imagePosition){this._frame[0].imagePosition=[0,0,0]}if(!this._frame[0].imageOrientation){this._frame[0].imageOrientation=[1,0,0,0,1,0]}this._origin=this._vector3FromArray(this._frame[0].imagePosition,0);this.computeIJK2LPS();this.computeLPS2AABB();this._rescaleSlope=this._frame[0].rescaleSlope||1;this._rescaleIntercept=this._frame[0].rescaleIntercept||0;this.computeMinMaxIntensities();this._minMax[0]=ModelsStack.valueRescaleSlopeIntercept(this._minMax[0],this._rescaleSlope,this._rescaleIntercept);this._minMax[1]=ModelsStack.valueRescaleSlopeIntercept(this._minMax[1],this._rescaleSlope,this._rescaleIntercept);var width=this._frame[0].windowWidth||this._minMax[1]-this._minMax[0];this._windowWidth=this._rescaleSlope*width+this._rescaleIntercept;var center=this._frame[0].windowCenter||this._minMax[0]+width/2;this._windowCenter=this._rescaleSlope*center+this._rescaleIntercept;this._bitsAllocated=this._frame[0].bitsAllocated;this._prepared=true}},{key:"packEchos",value:function packEchos(){var echos=4;var packedEcho=[];for(var i=0;i1){if(this._spacingBetweenSlices){this._spacing.z=this._spacingBetweenSlices}else if(this._frame[0].pixelSpacing&&this._frame[0].pixelSpacing[2]){this._spacing.z=this._frame[0].pixelSpacing[2]}else{this._frame.map(this._computeDistanceArrayMap.bind(null,this._zCosine));this._frame.sort(this._sortDistanceArraySort);this._spacing.z=this._frame[1].dist-this._frame[0].dist}}if(this._spacing.z===0){this._spacing.z=1}}},{key:"xySpacing",value:function xySpacing(){if(this._frame&&this._frame[0]){var spacingXY=this._frame[0].spacingXY();this._spacing.x=spacingXY[0];this._spacing.y=spacingXY[1]}}},{key:"computeMinMaxIntensities",value:function computeMinMaxIntensities(){for(var i=0;inbVoxels){voxelIndexStop=nbVoxels}for(var ii=0;iinbVoxels){voxelIndexStop=nbVoxels}}this._packed=true}},{key:"_packTo8Bits",value:function _packTo8Bits(bits,pixelType,channels,frame,textureSize,startVoxel,stopVoxel){var packed={textureType:null,data:null};var packIndex=0;var frameIndex=0;var inFrameIndex=0;var frameDimension=frame[0].rows*frame[0].columns;var data=null;if(bits===8&&channels===1||bits===1){var _data=new Uint8Array(textureSize*textureSize*1);for(var i=startVoxel;i>>8&255;packIndex++;coordinate=Math.floor(packIndex/2);channelOffset=packIndex%2}packed.textureType=THREE.RGBAFormat;packed.data=_data2}else if(bits===32&&channels===1&&pixelType===0){var _data3=new Uint8Array(textureSize*textureSize*4);for(var _i2=startVoxel;_i2>>8&255;_data3[4*packIndex+2]=_raw>>>8&255;_data3[4*packIndex+3]=_raw>>>8&255;packIndex++}packed.textureType=THREE.RGBAFormat;packed.data=_data3}else if(bits===32&&channels===1&&pixelType===1){var _data4=new Uint8Array(textureSize*textureSize*4);for(var _i3=startVoxel;_i3parseInt(b.dimensionIndexValues[i],10)){return 1}if(parseInt(a.dimensionIndexValues[i],10)=0&&ijkCoordinate.z=0&&index.y>=0&&index.z>=0&&index.x0){segmentationCodeDesignator=element.items[0].dataSet.string("x00080102");segmentationCodeValue=element.items[0].dataSet.string("x00080100");segmentationCodeMeaning=element.items[0].dataSet.string("x00080104")}return{segmentationCodeDesignator:segmentationCodeDesignator,segmentationCodeValue:segmentationCodeValue,segmentationCodeMeaning:segmentationCodeMeaning}}},{key:"_recommendedDisplayCIELab",value:function _recommendedDisplayCIELab(segment){var rawColor=String(segment.dataSet.uint16("x0062000d"));var recommendedDisplayCIELab=String("000000"+rawColor).slice(-6);return recommendedDisplayCIELab}},{key:"sopInstanceUID",value:function sopInstanceUID(){var frameIndex=arguments.length>0&&arguments[0]!==undefined?arguments[0]:0;var sopInstanceUID=this._findStringEverywhere("x2005140f","x00080018",frameIndex);return sopInstanceUID}},{key:"transferSyntaxUID",value:function transferSyntaxUID(){return this._dataSet.string("x00020010")}},{key:"photometricInterpretation",value:function photometricInterpretation(){return this._dataSet.string("x00280004")}},{key:"planarConfiguration",value:function planarConfiguration(){var planarConfiguration=this._dataSet.uint16("x00280006");if(typeof planarConfiguration==="undefined"){planarConfiguration=null}return planarConfiguration}},{key:"samplesPerPixel",value:function samplesPerPixel(){return this._dataSet.uint16("x00280002")}},{key:"numberOfFrames",value:function numberOfFrames(){var numberOfFrames=this._dataSet.intString("x00280008");if(typeof numberOfFrames==="undefined"){numberOfFrames=null}return numberOfFrames}},{key:"numberOfChannels",value:function numberOfChannels(){var numberOfChannels=1;var photometricInterpretation=this.photometricInterpretation();if(!(photometricInterpretation!=="RGB"&&photometricInterpretation!=="PALETTE COLOR"&&photometricInterpretation!=="YBR_FULL"&&photometricInterpretation!=="YBR_FULL_422"&&photometricInterpretation!=="YBR_PARTIAL_422"&&photometricInterpretation!=="YBR_PARTIAL_420"&&photometricInterpretation!=="YBR_RCT")){numberOfChannels=3}return numberOfChannels}},{key:"invert",value:function invert(){var photometricInterpretation=this.photometricInterpretation();return photometricInterpretation==="MONOCHROME1"?true:false}},{key:"imageOrientation",value:function imageOrientation(){var frameIndex=arguments.length>0&&arguments[0]!==undefined?arguments[0]:0;var imageOrientation=this._findStringEverywhere("x00209116","x00200037",frameIndex);if(imageOrientation){imageOrientation=imageOrientation.split("\\").map(Number)}return imageOrientation}},{key:"referencedSegmentNumber",value:function referencedSegmentNumber(){var frameIndex=arguments.length>0&&arguments[0]!==undefined?arguments[0]:0;var referencedSegmentNumber=-1;var referencedSegmentNumberElement=this._findInGroupSequence("x52009230","x0062000a",frameIndex);if(referencedSegmentNumberElement!==null){referencedSegmentNumber=referencedSegmentNumberElement.uint16("x0062000b")}return referencedSegmentNumber}},{key:"pixelAspectRatio",value:function pixelAspectRatio(){var pixelAspectRatio=[this._dataSet.intString("x00280034",0),this._dataSet.intString("x00280034",1)];if(typeof pixelAspectRatio[0]==="undefined"){pixelAspectRatio=null}return pixelAspectRatio}},{key:"imagePosition",value:function imagePosition(){var frameIndex=arguments.length>0&&arguments[0]!==undefined?arguments[0]:0;var imagePosition=this._findStringEverywhere("x00209113","x00200032",frameIndex);if(imagePosition){imagePosition=imagePosition.split("\\").map(Number)}return imagePosition}},{key:"instanceNumber",value:function instanceNumber(){var frameIndex=arguments.length>0&&arguments[0]!==undefined?arguments[0]:0;var instanceNumber=null;var perFrameFunctionnalGroupSequence=this._dataSet.elements.x52009230;if(typeof perFrameFunctionnalGroupSequence!=="undefined"){if(perFrameFunctionnalGroupSequence.items[frameIndex].dataSet.elements.x2005140f){var planeOrientationSequence=perFrameFunctionnalGroupSequence.items[frameIndex].dataSet.elements.x2005140f.items[0].dataSet;instanceNumber=planeOrientationSequence.intString("x00200013")}else{instanceNumber=this._dataSet.intString("x00200013");if(typeof instanceNumber==="undefined"){instanceNumber=null}}}else{instanceNumber=this._dataSet.intString("x00200013");if(typeof instanceNumber==="undefined"){instanceNumber=null}}return instanceNumber}},{key:"pixelSpacing",value:function pixelSpacing(){var frameIndex=arguments.length>0&&arguments[0]!==undefined?arguments[0]:0;var pixelSpacing=this._findStringEverywhere("x00289110","x00280030",frameIndex);if(pixelSpacing){pixelSpacing=pixelSpacing.split("\\").map(Number)}return pixelSpacing}},{key:"rows",value:function rows(){var frameIndex=arguments.length>0&&arguments[0]!==undefined?arguments[0]:0;var rows=this._dataSet.uint16("x00280010");if(typeof rows==="undefined"){rows=null}return rows}},{key:"columns",value:function columns(){ var frameIndex=arguments.length>0&&arguments[0]!==undefined?arguments[0]:0;var columns=this._dataSet.uint16("x00280011");if(typeof columns==="undefined"){columns=null}return columns}},{key:"pixelType",value:function pixelType(){var frameIndex=arguments.length>0&&arguments[0]!==undefined?arguments[0]:0;return 0}},{key:"pixelRepresentation",value:function pixelRepresentation(){var frameIndex=arguments.length>0&&arguments[0]!==undefined?arguments[0]:0;var pixelRepresentation=this._dataSet.uint16("x00280103");return pixelRepresentation}},{key:"bitsAllocated",value:function bitsAllocated(){var frameIndex=arguments.length>0&&arguments[0]!==undefined?arguments[0]:0;var bitsAllocated=this._dataSet.uint16("x00280100");return bitsAllocated}},{key:"highBit",value:function highBit(){var frameIndex=arguments.length>0&&arguments[0]!==undefined?arguments[0]:0;var highBit=this._dataSet.uint16("x00280102");return highBit}},{key:"rescaleIntercept",value:function rescaleIntercept(){var frameIndex=arguments.length>0&&arguments[0]!==undefined?arguments[0]:0;return this._findFloatStringInFrameGroupSequence("x00289145","x00281052",frameIndex)}},{key:"rescaleSlope",value:function rescaleSlope(){var frameIndex=arguments.length>0&&arguments[0]!==undefined?arguments[0]:0;return this._findFloatStringInFrameGroupSequence("x00289145","x00281053",frameIndex)}},{key:"windowCenter",value:function windowCenter(){var frameIndex=arguments.length>0&&arguments[0]!==undefined?arguments[0]:0;return this._findFloatStringInFrameGroupSequence("x00289132","x00281050",frameIndex)}},{key:"windowWidth",value:function windowWidth(){var frameIndex=arguments.length>0&&arguments[0]!==undefined?arguments[0]:0;return this._findFloatStringInFrameGroupSequence("x00289132","x00281051",frameIndex)}},{key:"sliceThickness",value:function sliceThickness(){var frameIndex=arguments.length>0&&arguments[0]!==undefined?arguments[0]:0;return this._findFloatStringInFrameGroupSequence("x00289110","x00180050",frameIndex)}},{key:"dimensionIndexValues",value:function dimensionIndexValues(){var frameIndex=arguments.length>0&&arguments[0]!==undefined?arguments[0]:0;var dimensionIndexValues=[];var perFrameFunctionnalGroupSequence=this._dataSet.elements.x52009230;if(typeof perFrameFunctionnalGroupSequence!=="undefined"){var philipsPrivateSequence=perFrameFunctionnalGroupSequence.items[frameIndex].dataSet.elements.x00209111.items[0].dataSet;var element=philipsPrivateSequence.elements.x00209157;var nbValues=element.length/4;for(var i=0;i0&&arguments[0]!==undefined?arguments[0]:0;var inStackPositionNumber=null;var perFrameFunctionnalGroupSequence=this._dataSet.elements.x52009230;if(typeof perFrameFunctionnalGroupSequence!=="undefined"){var philipsPrivateSequence=perFrameFunctionnalGroupSequence.items[frameIndex].dataSet.elements.x00209111.items[0].dataSet;inStackPositionNumber=philipsPrivateSequence.uint32("x00209057")}else{inStackPositionNumber=null}console.log("instack position "+inStackPositionNumber);return inStackPositionNumber}},{key:"stackID",value:function stackID(){var frameIndex=arguments.length>0&&arguments[0]!==undefined?arguments[0]:0;var stackID=null;var perFrameFunctionnalGroupSequence=this._dataSet.elements.x52009230;if(typeof perFrameFunctionnalGroupSequence!=="undefined"){var philipsPrivateSequence=perFrameFunctionnalGroupSequence.items[frameIndex].dataSet.elements.x00209111.items[0].dataSet;stackID=philipsPrivateSequence.intString("x00209056")}else{stackID=null}return stackID}},{key:"extractPixelData",value:function extractPixelData(){var frameIndex=arguments.length>0&&arguments[0]!==undefined?arguments[0]:0;var decompressedData=this._decodePixelData(frameIndex);var numberOfChannels=this.numberOfChannels();if(numberOfChannels>1){return this._convertColorSpace(decompressedData)}else{return decompressedData}}},{key:"minMaxPixelData",value:function minMaxPixelData(){var pixelData=arguments.length>0&&arguments[0]!==undefined?arguments[0]:[];var minMax=[65535,-32768];var numPixels=pixelData.length;for(var index=0;index0&&arguments[0]!==undefined?arguments[0]:0;var transferSyntaxUID=this.transferSyntaxUID();if(transferSyntaxUID==="1.2.840.10008.1.2.4.90"||transferSyntaxUID==="1.2.840.10008.1.2.4.91"){return this._decodeJ2K(frameIndex)}else if(transferSyntaxUID==="1.2.840.10008.1.2.4.57"||transferSyntaxUID==="1.2.840.10008.1.2.4.70"){return this._decodeJPEGLossless(frameIndex)}else if(transferSyntaxUID==="1.2.840.10008.1.2.4.50"||transferSyntaxUID==="1.2.840.10008.1.2.4.51"){return this._decodeJPEGBaseline(frameIndex)}else if(transferSyntaxUID==="1.2.840.10008.1.2"||transferSyntaxUID==="1.2.840.10008.1.2.1"){return this._decodeUncompressed(frameIndex)}else if(transferSyntaxUID==="1.2.840.10008.1.2.2"){var frame=this._decodeUncompressed(frameIndex);return this._swapFrame(frame)}else{throw"no decoder for transfer syntax ${transferSyntaxUID}"}}},{key:"_decodeJ2K",value:function _decodeJ2K(){var frameIndex=arguments.length>0&&arguments[0]!==undefined?arguments[0]:0;var encodedPixelData=DicomParser.readEncapsulatedPixelData(this._dataSet,this._dataSet.elements.x7fe00010,frameIndex);var jpxImage=new Jpx;jpxImage.parse(encodedPixelData);var componentsCount=jpxImage.componentsCount;if(componentsCount!==1){throw"JPEG2000 decoder returned a componentCount of ${componentsCount}, when 1 is expected"}var tileCount=jpxImage.tiles.length;if(tileCount!==1){throw"JPEG2000 decoder returned a tileCount of ${tileCount}, when 1 is expected"}var tileComponents=jpxImage.tiles[0];var pixelData=tileComponents.items;return pixelData}},{key:"_decodeJPEGLossless",value:function _decodeJPEGLossless(){var frameIndex=arguments.length>0&&arguments[0]!==undefined?arguments[0]:0;var encodedPixelData=DicomParser.readEncapsulatedPixelData(this._dataSet,this._dataSet.elements.x7fe00010,frameIndex);var pixelRepresentation=this.pixelRepresentation(frameIndex);var bitsAllocated=this.bitsAllocated(frameIndex);var byteOutput=bitsAllocated<=8?1:2;var decoder=new Jpeg.lossless.Decoder;var decompressedData=decoder.decode(encodedPixelData.buffer,encodedPixelData.byteOffset,encodedPixelData.length,byteOutput);if(pixelRepresentation===0){if(byteOutput===2){return new Uint16Array(decompressedData.buffer)}else{return new Uint8Array(decompressedData.buffer)}}else{return new Int16Array(decompressedData.buffer)}}},{key:"_decodeJPEGBaseline",value:function _decodeJPEGBaseline(){var frameIndex=arguments.length>0&&arguments[0]!==undefined?arguments[0]:0;var encodedPixelData=DicomParser.readEncapsulatedPixelData(this._dataSet,this._dataSet.elements.x7fe00010,frameIndex);var rows=this.rows(frameIndex);var columns=this.columns(frameIndex);var bitsAllocated=this.bitsAllocated(frameIndex);var jpegBaseline=new JpegBaseline;jpegBaseline.parse(encodedPixelData);if(bitsAllocated===8){return jpegBaseline.getData(columns,rows)}else if(bitsAllocated===16){return jpegBaseline.getData16(columns,rows)}}},{key:"_decodeUncompressed",value:function _decodeUncompressed(){var frameIndex=arguments.length>0&&arguments[0]!==undefined?arguments[0]:0;var pixelRepresentation=this.pixelRepresentation(frameIndex);var bitsAllocated=this.bitsAllocated(frameIndex);var pixelDataElement=this._dataSet.elements.x7fe00010;var pixelDataOffset=pixelDataElement.dataOffset;var numberOfChannels=this.numberOfChannels();var numPixels=this.rows(frameIndex)*this.columns(frameIndex)*numberOfChannels;var frameOffset=0;var buffer=this._dataSet.byteArray.buffer;if(pixelRepresentation===0&&bitsAllocated===8){frameOffset=pixelDataOffset+frameIndex*numPixels;return new Uint8Array(buffer,frameOffset,numPixels)}else if(pixelRepresentation===0&&bitsAllocated===16){frameOffset=pixelDataOffset+frameIndex*numPixels*2;return new Uint16Array(buffer,frameOffset,numPixels)}else if(pixelRepresentation===1&&bitsAllocated===16){frameOffset=pixelDataOffset+frameIndex*numPixels*2;return new Int16Array(buffer,frameOffset,numPixels)}else if(pixelRepresentation===0&&bitsAllocated===32){frameOffset=pixelDataOffset+frameIndex*numPixels*4;return new Uint32Array(buffer,frameOffset,numPixels)}else if(pixelRepresentation===0&&bitsAllocated===1){var newBuffer=new ArrayBuffer(numPixels);var newArray=new Uint8Array(newBuffer);frameOffset=pixelDataOffset+frameIndex*numPixels;var index=0;var bitStart=frameIndex*numPixels;var bitEnd=frameIndex*numPixels+numPixels;var byteStart=Math.floor(bitStart/8);var bitStartOffset=bitStart-byteStart*8;var byteEnd=Math.ceil(bitEnd/8);var targetBuffer=new Uint8Array(buffer,pixelDataOffset);for(var i=byteStart;i<=byteEnd;i++){while(bitStartOffset<8){switch(bitStartOffset){case 0:newArray[index]=targetBuffer[i]&1;break;case 1:newArray[index]=targetBuffer[i]>>>1&1;break;case 2:newArray[index]=targetBuffer[i]>>>2&1;break;case 3:newArray[index]=targetBuffer[i]>>>3&1;break;case 4:newArray[index]=targetBuffer[i]>>>4&1;break;case 5:newArray[index]=targetBuffer[i]>>>5&1;break;case 6:newArray[index]=targetBuffer[i]>>>6&1;break;case 7:newArray[index]=targetBuffer[i]>>>7&1;break;default:break}bitStartOffset++;index++;if(index>=numPixels){return newArray}}bitStartOffset=0}}}},{key:"_convertColorSpace",value:function _convertColorSpace(uncompressedData){var rgbData=null;var photometricInterpretation=this.photometricInterpretation();var planarConfiguration=this.planarConfiguration();if(photometricInterpretation==="RGB"&&planarConfiguration===0){rgbData=uncompressedData}else if(photometricInterpretation==="RGB"&&planarConfiguration===1){if(uncompressedData instanceof Int8Array){rgbData=new Int8Array(uncompressedData.length)}else if(uncompressedData instanceof Uint8Array){rgbData=new Uint8Array(uncompressedData.length)}else if(uncompressedData instanceof Int16Array){rgbData=new Int16Array(uncompressedData.length)}else if(uncompressedData instanceof Uint16Array){rgbData=new Uint16Array(uncompressedData.length)}else{throw"unsuported typed array: ${uncompressedData}"}var numPixels=uncompressedData.length/3;var rgbaIndex=0;var rIndex=0;var gIndex=numPixels;var bIndex=numPixels*2;for(var i=0;i=5){numberOfChannels=this._dataSet.dims[5];this._ordered=false}else if(this._dataSet.datatypeCode===128){numberOfChannels=3}else if(this._dataSet.datatypeCode===2304){numberOfChannels=4}return numberOfChannels}},{key:"sopInstanceUID",value:function sopInstanceUID(){var frameIndex=arguments.length>0&&arguments[0]!==undefined?arguments[0]:0;return frameIndex}},{key:"rows",value:function rows(){var frameIndex=arguments.length>0&&arguments[0]!==undefined?arguments[0]:0;return this._dataSet.dims[2]}},{key:"columns",value:function columns(){var frameIndex=arguments.length>0&&arguments[0]!==undefined?arguments[0]:0;return this._dataSet.dims[1]}},{key:"pixelType",value:function pixelType(){var frameIndex=arguments.length>0&&arguments[0]!==undefined?arguments[0]:0;var pixelType=0;if(this._dataSet.datatypeCode===16||this._dataSet.datatypeCode===64||this._dataSet.datatypeCode===1536){pixelType=1}return pixelType}},{key:"bitsAllocated",value:function bitsAllocated(){var frameIndex=arguments.length>0&&arguments[0]!==undefined?arguments[0]:0;return this._dataSet.numBitsPerVoxel}},{key:"pixelSpacing",value:function pixelSpacing(){var frameIndex=arguments.length>0&&arguments[0]!==undefined?arguments[0]:0;return[this._dataSet.pixDims[1],this._dataSet.pixDims[2],this._dataSet.pixDims[3]]}},{key:"sliceThickness",value:function sliceThickness(){return null}},{key:"imageOrientation",value:function imageOrientation(){var frameIndex=arguments.length>0&&arguments[0]!==undefined?arguments[0]:0;if(this._dataSet.qform_code>0){var a=0,b=this._dataSet.quatern_b,c=this._dataSet.quatern_c,d=this._dataSet.quatern_d;a=1-(b*b+c*c+d*d);if(a<1e-7){a=1/Math.sqrt(b*b+c*c+d*d);b*=a;c*=a;d*=a;a=0}else{a=Math.sqrt(a)}return[a*a+b*b-c*c-d*d,2*(b*c-a*d),2*(b*d+a*c),2*(b*c+a*d),a*a+c*c-b*b-d*d,2*(c*d-a*b)]}else if(this._dataSet.sform_code>0){var sx=this._dataSet.srow_x,sy=this._dataSet.srow_y,sz=this._dataSet.srow_z}else if(this._dataSet.qform_code===0){}return[1,0,0,0,1,0]}},{key:"imagePosition",value:function imagePosition(){var frameIndex=arguments.length>0&&arguments[0]!==undefined?arguments[0]:0;return[-this._dataSet.qoffset_x,-this._dataSet.qoffset_y,this._dataSet.qoffset_z]}},{key:"dimensionIndexValues",value:function dimensionIndexValues(){var frameIndex=arguments.length>0&&arguments[0]!==undefined?arguments[0]:0;return null}},{key:"instanceNumber",value:function instanceNumber(){var frameIndex=arguments.length>0&&arguments[0]!==undefined?arguments[0]:0;return frameIndex}},{key:"windowCenter",value:function windowCenter(){var frameIndex=arguments.length>0&&arguments[0]!==undefined?arguments[0]:0;return null}},{key:"windowWidth",value:function windowWidth(){var frameIndex=arguments.length>0&&arguments[0]!==undefined?arguments[0]:0;return null}},{key:"rescaleSlope",value:function rescaleSlope(){var frameIndex=arguments.length>0&&arguments[0]!==undefined?arguments[0]:0;return this._dataSet.scl_slope}},{key:"rescaleIntercept",value:function rescaleIntercept(){var frameIndex=arguments.length>0&&arguments[0]!==undefined?arguments[0]:0;return this._dataSet.scl_intercept}},{key:"minMaxPixelData",value:function minMaxPixelData(){var pixelData=arguments.length>0&&arguments[0]!==undefined?arguments[0]:[];var minMax=[65535,-32768];var numPixels=pixelData.length;for(var index=0;index0&&arguments[0]!==undefined?arguments[0]:0;return this._decompressUncompressed(frameIndex)}},{key:"_decompressUncompressed",value:function _decompressUncompressed(){var frameIndex=arguments.length>0&&arguments[0]!==undefined?arguments[0]:0;var numberOfChannels=this.numberOfChannels();var numPixels=this.rows(frameIndex)*this.columns(frameIndex)*numberOfChannels;var frameOffset=frameIndex*numPixels;var buffer=this._niftiImage;if(!this._ordered&&this._orderedData===null){this._reorderData()}if(this._orderedData!==null){return this._orderedData.slice(frameOffset,frameOffset+numPixels)}else if(this._dataSet.datatypeCode===2){return new Uint8Array(buffer,frameOffset,numPixels)}else if(this._dataSet.datatypeCode===256){return new Int8Array(buffer,frameOffset,numPixels)}else if(this._dataSet.datatypeCode===512){frameOffset=frameOffset*2;return new Uint16Array(buffer,frameOffset,numPixels)}else if(this._dataSet.datatypeCode===4){frameOffset=frameOffset*2;return new Int16Array(buffer,frameOffset,numPixels)}else if(this._dataSet.datatypeCode===16){frameOffset=frameOffset*4;return new Float32Array(buffer,frameOffset,numPixels)}}},{key:"_reorderData",value:function _reorderData(){window.console.log("re-order");var numberOfChannels=this.numberOfChannels();var numPixels=this.rows()*this.columns()*numberOfChannels;var buffer=this._niftiImage;var totalNumPixels=numPixels*this.numberOfFrames();var tmp=null;this._orderedData=null;if(this._dataSet.datatypeCode===2){tmp=new Uint8Array(buffer,0,totalNumPixels);this._orderedData=new Uint8Array(tmp.length)}else if(this._dataSet.datatypeCode===256){tmp=new Int8Array(buffer,0,totalNumPixels);this._orderedData=new Int8Array(tmp.length)}else if(this._dataSet.datatypeCode===512){tmp=new Uint16Array(buffer,0,totalNumPixels);this._orderedData=new Uint16Array(tmp.length)}else if(this._dataSet.datatypeCode===4){tmp=new Int16Array(buffer,0,totalNumPixels);this._orderedData=new Int16Array(tmp.length)}else if(this._dataSet.datatypeCode===16){tmp=new Float32Array(buffer,0,totalNumPixels);this._orderedData=new Float32Array(tmp.length)}var numPixels2=tmp.length/3;var rgbaIndex=0;var rIndex=0;var gIndex=numPixels2;var bIndex=numPixels2*2;for(var i=0;i0&&arguments[0]!==undefined?arguments[0]:0;return frameIndex}},{key:"rows",value:function rows(){var frameIndex=arguments.length>0&&arguments[0]!==undefined?arguments[0]:0;return this._dataSet.sizes[1]}},{key:"columns",value:function columns(){var frameIndex=arguments.length>0&&arguments[0]!==undefined?arguments[0]:0;return this._dataSet.sizes[0]}},{key:"pixelType",value:function pixelType(){var frameIndex=arguments.length>0&&arguments[0]!==undefined?arguments[0]:0;var pixelType=0;if(this._dataSet.type==="float"){pixelType=1}return pixelType}},{key:"bitsAllocated",value:function bitsAllocated(){var frameIndex=arguments.length>0&&arguments[0]!==undefined?arguments[0]:0;var bitsAllocated=1;if(this._dataSet.type==="int8"||this._dataSet.type==="uint8"||this._dataSet.type==="char"){bitsAllocated=8}else if(this._dataSet.type==="int16"||this._dataSet.type==="uint16"||this._dataSet.type==="short"){bitsAllocated=16}else if(this._dataSet.type==="int32"||this._dataSet.type==="uint32"||this._dataSet.type==="float"){bitsAllocated=32}return bitsAllocated}},{key:"pixelSpacing",value:function pixelSpacing(){var frameIndex=arguments.length>0&&arguments[0]!==undefined?arguments[0]:0;var x=new THREE.Vector3(this._dataSet.spaceDirections[0][0],this._dataSet.spaceDirections[0][1],this._dataSet.spaceDirections[0][2]);var y=new THREE.Vector3(this._dataSet.spaceDirections[1][0],this._dataSet.spaceDirections[1][1],this._dataSet.spaceDirections[1][2]);var z=new THREE.Vector3(this._dataSet.spaceDirections[2][0],this._dataSet.spaceDirections[2][1],this._dataSet.spaceDirections[2][2]);return[x.length(),y.length(),z.length()]}},{key:"sliceThickness",value:function sliceThickness(){return null}},{key:"imageOrientation",value:function imageOrientation(){var frameIndex=arguments.length>0&&arguments[0]!==undefined?arguments[0]:0;var x=new THREE.Vector3(this._dataSet.spaceDirections[0][0],this._dataSet.spaceDirections[0][1],this._dataSet.spaceDirections[0][2]);x.normalize();var y=new THREE.Vector3(this._dataSet.spaceDirections[1][0],this._dataSet.spaceDirections[1][1],this._dataSet.spaceDirections[1][2]);y.normalize();return[x.x,x.y,x.z,y.x,y.y,y.z]}},{key:"imagePosition",value:function imagePosition(){var frameIndex=arguments.length>0&&arguments[0]!==undefined?arguments[0]:0;return[this._dataSet.spaceOrigin[0],this._dataSet.spaceOrigin[1],this._dataSet.spaceOrigin[2]]}},{key:"dimensionIndexValues",value:function dimensionIndexValues(){var frameIndex=arguments.length>0&&arguments[0]!==undefined?arguments[0]:0;return null}},{key:"instanceNumber",value:function instanceNumber(){var frameIndex=arguments.length>0&&arguments[0]!==undefined?arguments[0]:0;return frameIndex}},{key:"windowCenter",value:function windowCenter(){var frameIndex=arguments.length>0&&arguments[0]!==undefined?arguments[0]:0;return null}},{key:"windowWidth",value:function windowWidth(){var frameIndex=arguments.length>0&&arguments[0]!==undefined?arguments[0]:0;return null}},{key:"rescaleSlope",value:function rescaleSlope(){var frameIndex=arguments.length>0&&arguments[0]!==undefined?arguments[0]:0;return 1}},{key:"rescaleIntercept",value:function rescaleIntercept(){var frameIndex=arguments.length>0&&arguments[0]!==undefined?arguments[0]:0;return 0}},{key:"minMaxPixelData",value:function minMaxPixelData(){var pixelData=arguments.length>0&&arguments[0]!==undefined?arguments[0]:[];var minMax=[65535,-32768];var numPixels=pixelData.length;for(var index=0;index0&&arguments[0]!==undefined?arguments[0]:0;return this._decompressUncompressed(frameIndex)}},{key:"_decompressUncompressed",value:function _decompressUncompressed(){var frameIndex=arguments.length>0&&arguments[0]!==undefined?arguments[0]:0;var buffer=this._dataSet.buffer;var numberOfChannels=this.numberOfChannels();var numPixels=this.rows(frameIndex)*this.columns(frameIndex)*numberOfChannels;var frameOffset=frameIndex*numPixels;if(this._unpackedData===null&&this._dataSet.encoding==="gzip"){var unpackedData=pako.inflate(this._dataSet.buffer);this._unpackedData=unpackedData.buffer;buffer=this._unpackedData}else if(this._dataSet.encoding==="gzip"){buffer=this._unpackedData}if(this._dataSet.type==="int8"||this._dataSet.type==="char"){frameOffset=frameOffset;return new Int8Array(buffer,frameOffset,numPixels)}else if(this._dataSet.type==="uint8"){frameOffset=frameOffset;return new Uint8Array(buffer,frameOffset,numPixels)}else if(this._dataSet.type==="int16"||this._dataSet.type==="short"){frameOffset=frameOffset*2;return new Int16Array(buffer,frameOffset,numPixels)}else if(this._dataSet.type==="uint16"){frameOffset=frameOffset*2;return new Uint16Array(buffer,frameOffset,numPixels)}else if(this._dataSet.type==="int32"){frameOffset=frameOffset*4;return new Int32Array(buffer,frameOffset,numPixels)}else if(this._dataSet.type==="uint32"){frameOffset=frameOffset*4;return new Uint32Array(buffer,frameOffset,numPixels)}else if(this._dataSet.type==="float"){frameOffset=frameOffset*4;return new Float32Array(buffer,frameOffset,numPixels)}}}]);return ParsersNifti}(_parsers2.default);exports.default=ParsersNifti},{"./parsers.volume":123,"nrrd-js":50,pako:51}],123:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var _createClass=function(){function defineProperties(target,props){for(var i=0;i>8&255}},{key:"_swap32",value:function _swap32(val){return(val&255)<<24|(val&65280)<<8|val>>8&65280|val>>24&255}},{key:"invert",value:function invert(){return false}}]);return ParsersVolume}();exports.default=ParsersVolume},{}],124:[function(require,module,exports){"use strict";var _typeof=typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"?function(obj){return typeof obj}:function(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol?"symbol":typeof obj};Object.defineProperty(exports,"__esModule",{value:true});var _createClass=function(){function defineProperties(target,props){for(var i=0;i0&&arguments[0]!==undefined?arguments[0]:this._base;var rayOrigin=arguments.length>1&&arguments[1]!==undefined?arguments[1]:this._rayOrigin;var rayDirection=arguments.length>2&&arguments[2]!==undefined?arguments[2]:this._rayDirection;var aabbMin=arguments.length>3&&arguments[3]!==undefined?arguments[3]:this._aabbMin;var aabbMax=arguments.length>4&&arguments[4]!==undefined?arguments[4]:this._aabbMax;var tNear=arguments.length>5&&arguments[5]!==undefined?arguments[5]:this._tNear;var tFar=arguments.length>6&&arguments[6]!==undefined?arguments[6]:this._tFar;var intersect=arguments.length>7&&arguments[7]!==undefined?arguments[7]:this._intersect;this._base=baseFragment;return this.compute(rayOrigin,rayDirection,aabbMin,aabbMax,tNear,tFar,intersect)}},{key:"compute",value:function compute(rayOrigin,rayDirection,aabbMin,aabbMax,tNear,tFar,intersect){this.computeDefinition();this._base._functions[this._name]=this._definition;return this._name+"("+rayOrigin+", "+rayDirection+", "+aabbMin+", "+aabbMax+", "+tNear+", "+tFar+", "+intersect+");"}},{key:"computeDefinition",value:function computeDefinition(){this._definition="\nvoid "+this._name+"(vec3 rayOrigin, vec3 rayDirection, vec3 boxMin, vec3 boxMax, out float tNear, out float tFar, out bool intersect){\n // compute intersection of ray with all six bbox planes\n vec3 invRay = vec3(1.) / rayDirection;\n vec3 tBot = invRay * (boxMin - rayOrigin);\n vec3 tTop = invRay * (boxMax - rayOrigin);\n // re-order intersections to find smallest and largest on each axis\n vec3 tMin = min(tTop, tBot);\n vec3 tMax = max(tTop, tBot);\n // find the largest tMin and the smallest tMax\n float largest_tMin = max(max(tMin.x, tMin.y), max(tMin.x, tMin.z));\n float smallest_tMax = min(min(tMax.x, tMax.y), min(tMax.x, tMax.z));\n tNear = largest_tMin;\n tFar = smallest_tMax;\n intersect = smallest_tMax > largest_tMin;\n}\n\n "}}]);return IntersectBox}(_shaders2.default);exports.default=new IntersectBox},{"../shaders.base":130}],125:[function(require,module,exports){"use strict";var _typeof=typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"?function(obj){return typeof obj}:function(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol?"symbol":typeof obj};Object.defineProperty(exports,"__esModule",{value:true});var _createClass=function(){function defineProperties(target,props){for(var i=0;i0&&arguments[0]!==undefined?arguments[0]:this._base;var dataCoordinates=arguments.length>1&&arguments[1]!==undefined?arguments[1]:this._dataCoordinates;var dataValue=arguments.length>2&&arguments[2]!==undefined?arguments[2]:this._dataValue;var offset=arguments.length>3&&arguments[3]!==undefined?arguments[3]:this._offset;this._base=baseFragment;return this.compute(dataCoordinates,dataValue,offset)}},{key:"compute",value:function compute(dataCoordinates,dataValue,offset){this.computeDefinition();this._base._functions[this._name]=this._definition;return this._name+"("+dataCoordinates+", "+dataValue+", "+offset+");"}},{key:"computeDefinition",value:function computeDefinition(){this._definition="\nvoid "+this._name+"(in ivec3 dataCoordinates, out vec4 dataValue, out int offset){\n \n int index = dataCoordinates.x\n + dataCoordinates.y * uDataDimensions.x\n + dataCoordinates.z * uDataDimensions.y * uDataDimensions.x;\n int indexP = int(index/uPackedPerPixel);\n offset = index - 2*indexP;\n\n // Map data index to right sampler2D texture\n int voxelsPerTexture = uTextureSize*uTextureSize;\n int textureIndex = int(floor(float(indexP) / float(voxelsPerTexture)));\n // modulo seems incorrect sometimes...\n // int inTextureIndex = int(mod(float(index), float(textureSize*textureSize)));\n int inTextureIndex = indexP - voxelsPerTexture*textureIndex;\n\n // Get row and column in the texture\n int colIndex = int(mod(float(inTextureIndex), float(uTextureSize)));\n int rowIndex = int(floor(float(inTextureIndex)/float(uTextureSize)));\n\n // Map row and column to uv\n vec2 uv = vec2(0,0);\n uv.x = (0.5 + float(colIndex)) / float(uTextureSize);\n uv.y = 1. - (0.5 + float(rowIndex)) / float(uTextureSize);\n\n //\n if(textureIndex == 0){ dataValue = texture2D(uTextureContainer[0], uv); }\n else if(textureIndex == 1){dataValue = texture2D(uTextureContainer[1], uv);}\n else if(textureIndex == 2){ dataValue = texture2D(uTextureContainer[2], uv); }\n else if(textureIndex == 3){ dataValue = texture2D(uTextureContainer[3], uv); }\n else if(textureIndex == 4){ dataValue = texture2D(uTextureContainer[4], uv); }\n else if(textureIndex == 5){ dataValue = texture2D(uTextureContainer[5], uv); }\n else if(textureIndex == 6){ dataValue = texture2D(uTextureContainer[6], uv); }\n\n}\n "}}]);return Texture3d}(_shaders2.default);exports.default=new Texture3d},{"../shaders.base":130}],126:[function(require,module,exports){"use strict";var _typeof=typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"?function(obj){return typeof obj}:function(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol?"symbol":typeof obj};Object.defineProperty(exports,"__esModule",{value:true});var _createClass=function(){function defineProperties(target,props){for(var i=0;i0&&arguments[0]!==undefined?arguments[0]:this._base;var packedData=arguments.length>1&&arguments[1]!==undefined?arguments[1]:this._packedData;var offset=arguments.length>2&&arguments[2]!==undefined?arguments[2]:this._offset;var unpackedData=arguments.length>3&&arguments[3]!==undefined?arguments[3]:this._unpackedData;this._base=baseFragment;return this.compute(packedData,offset,unpackedData)}},{key:"compute",value:function compute(packedData,offset,unpackedData){this.computeDefinition();this._base._functions[this._name]=this._definition;return this._name+"("+packedData+", "+offset+", "+unpackedData+");"}},{key:"computeDefinition",value:function computeDefinition(){var content="";if(this._base._uniforms.uNumberOfChannels.value===1){switch(this._base._uniforms.uBitsAllocated.value){case 1:case 8:content=this.upack8();break;case 16:content=this.upack16();break;case 32:content=this.upack32();break;default:content=this.upackDefault();break}}else{content=this.upackIdentity()}this._definition="\nvoid "+this._name+"(in vec4 packedData, in int offset, out vec4 unpackedData){\n\n"+content+"\n\n} \n "}},{key:"upack8",value:function upack8(){this._base._functions["uInt8"]=this.uInt8();return"\nuInt8(\n packedData.r,\n unpackedData.x);\n "}},{key:"upack16",value:function upack16(){this._base._functions["uInt16"]=this.uInt16();return"\nuInt16(\n packedData.r * float( 1 - offset) + packedData.b * float(offset),\n packedData.g * float( 1 - offset) + packedData.a * float(offset),\n unpackedData.x);\n "}},{key:"upack32",value:function upack32(){if(this._base._uniforms.uPixelType.value===0){this._base._functions["uInt32"]=this.uInt32();return"\nuInt32(\n packedData.r,\n packedData.g,\n packedData.b,\n packedData.a,\n unpackedData.x);\n "}else{this._base._functions["uFloat32"]=this.uFloat32();return"\nuFloat32(\n packedData.r,\n packedData.g,\n packedData.b,\n packedData.a,\n unpackedData.x);\n "}}},{key:"upackIdentity",value:function upackIdentity(){return"\n\nunpackedData = packedData;\n\n "}},{key:"uInt8",value:function uInt8(){return"\nvoid uInt8(in float r, out float value){\n value = r * 256.;\n}\n "}},{key:"uInt16",value:function uInt16(){return"\nvoid uInt16(in float r, in float a, out float value){\n value = r * 256. + a * 65536.;\n}\n "}},{key:"uInt32",value:function uInt32(){return"\nvoid uInt32(in float r, in float g, in float b, in float a, out float value){\n value = r * 256. + g * 65536. + b * 16777216. + a * 4294967296.;\n}\n "}},{key:"uFloat32",value:function uFloat32(){return"\nvoid uFloat32(in float r, in float g, in float b, in float a, out float value){\n\n // create arrays containing bits for rgba values\n // value between 0 and 255\n value = r * 255.;\n int bytemeR[8];\n bytemeR[0] = int(floor(value / 128.));\n value -= float(bytemeR[0] * 128);\n bytemeR[1] = int(floor(value / 64.));\n value -= float(bytemeR[1] * 64);\n bytemeR[2] = int(floor(value / 32.));\n value -= float(bytemeR[2] * 32);\n bytemeR[3] = int(floor(value / 16.));\n value -= float(bytemeR[3] * 16);\n bytemeR[4] = int(floor(value / 8.));\n value -= float(bytemeR[4] * 8);\n bytemeR[5] = int(floor(value / 4.));\n value -= float(bytemeR[5] * 4);\n bytemeR[6] = int(floor(value / 2.));\n value -= float(bytemeR[6] * 2);\n bytemeR[7] = int(floor(value));\n\n value = g * 255.;\n int bytemeG[8];\n bytemeG[0] = int(floor(value / 128.));\n value -= float(bytemeG[0] * 128);\n bytemeG[1] = int(floor(value / 64.));\n value -= float(bytemeG[1] * 64);\n bytemeG[2] = int(floor(value / 32.));\n value -= float(bytemeG[2] * 32);\n bytemeG[3] = int(floor(value / 16.));\n value -= float(bytemeG[3] * 16);\n bytemeG[4] = int(floor(value / 8.));\n value -= float(bytemeG[4] * 8);\n bytemeG[5] = int(floor(value / 4.));\n value -= float(bytemeG[5] * 4);\n bytemeG[6] = int(floor(value / 2.));\n value -= float(bytemeG[6] * 2);\n bytemeG[7] = int(floor(value));\n\n value = b * 255.;\n int bytemeB[8];\n bytemeB[0] = int(floor(value / 128.));\n value -= float(bytemeB[0] * 128);\n bytemeB[1] = int(floor(value / 64.));\n value -= float(bytemeB[1] * 64);\n bytemeB[2] = int(floor(value / 32.));\n value -= float(bytemeB[2] * 32);\n bytemeB[3] = int(floor(value / 16.));\n value -= float(bytemeB[3] * 16);\n bytemeB[4] = int(floor(value / 8.));\n value -= float(bytemeB[4] * 8);\n bytemeB[5] = int(floor(value / 4.));\n value -= float(bytemeB[5] * 4);\n bytemeB[6] = int(floor(value / 2.));\n value -= float(bytemeB[6] * 2);\n bytemeB[7] = int(floor(value));\n\n value = a * 255.;\n int bytemeA[8];\n bytemeA[0] = int(floor(value / 128.));\n value -= float(bytemeA[0] * 128);\n bytemeA[1] = int(floor(value / 64.));\n value -= float(bytemeA[1] * 64);\n bytemeA[2] = int(floor(value / 32.));\n value -= float(bytemeA[2] * 32);\n bytemeA[3] = int(floor(value / 16.));\n value -= float(bytemeA[3] * 16);\n bytemeA[4] = int(floor(value / 8.));\n value -= float(bytemeA[4] * 8);\n bytemeA[5] = int(floor(value / 4.));\n value -= float(bytemeA[5] * 4);\n bytemeA[6] = int(floor(value / 2.));\n value -= float(bytemeA[6] * 2);\n bytemeA[7] = int(floor(value));\n\n // compute float32 value from bit arrays\n\n // sign\n int issigned = 1 - 2 * bytemeR[0];\n // issigned = int(pow(-1., float(bytemeR[0])));\n\n // exponent\n int exponent = 0;\n\n exponent += bytemeR[1] * int(pow(2., 7.));\n exponent += bytemeR[2] * int(pow(2., 6.));\n exponent += bytemeR[3] * int(pow(2., 5.));\n exponent += bytemeR[4] * int(pow(2., 4.));\n exponent += bytemeR[5] * int(pow(2., 3.));\n exponent += bytemeR[6] * int(pow(2., 2.));\n exponent += bytemeR[7] * int(pow(2., 1.));\n\n exponent += bytemeG[0];\n\n\n // fraction\n float fraction = 0.;\n\n fraction = float(bytemeG[1]) * pow(2., -1.);\n fraction += float(bytemeG[2]) * pow(2., -2.);\n fraction += float(bytemeG[3]) * pow(2., -3.);\n fraction += float(bytemeG[4]) * pow(2., -4.);\n fraction += float(bytemeG[5]) * pow(2., -5.);\n fraction += float(bytemeG[6]) * pow(2., -6.);\n fraction += float(bytemeG[7]) * pow(2., -7.);\n\n fraction += float(bytemeB[0]) * pow(2., -8.);\n fraction += float(bytemeB[1]) * pow(2., -9.);\n fraction += float(bytemeB[2]) * pow(2., -10.);\n fraction += float(bytemeB[3]) * pow(2., -11.);\n fraction += float(bytemeB[4]) * pow(2., -12.);\n fraction += float(bytemeB[5]) * pow(2., -13.);\n fraction += float(bytemeB[6]) * pow(2., -14.);\n fraction += float(bytemeB[7]) * pow(2., -15.);\n\n fraction += float(bytemeA[0]) * pow(2., -16.);\n fraction += float(bytemeA[1]) * pow(2., -17.);\n fraction += float(bytemeA[2]) * pow(2., -18.);\n fraction += float(bytemeA[3]) * pow(2., -19.);\n fraction += float(bytemeA[4]) * pow(2., -20.);\n fraction += float(bytemeA[5]) * pow(2., -21.);\n fraction += float(bytemeA[6]) * pow(2., -22.);\n fraction += float(bytemeA[7]) * pow(2., -23.);\n\n value = float(issigned) * pow( 2., float(exponent - 127)) * (1. + fraction);\n}\n "}}]);return Unpack}(_shaders2.default);exports.default=new Unpack},{"../shaders.base":130}],127:[function(require,module,exports){"use strict";var _typeof=typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"?function(obj){return typeof obj}:function(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol?"symbol":typeof obj};Object.defineProperty(exports,"__esModule",{value:true});var _createClass=function(){function defineProperties(target,props){for(var i=0;i0&&arguments[0]!==undefined?arguments[0]:this._base;var currentVoxel=arguments.length>1&&arguments[1]!==undefined?arguments[1]:this._currentVoxel;var dataValue=arguments.length>2&&arguments[2]!==undefined?arguments[2]:this._dataValue;this._base=baseFragment;return this.compute(currentVoxel,dataValue)}},{key:"compute",value:function compute(currentVoxel,dataValue){this.computeDefinition();this._base._functions[this._name]=this._definition;return this._name+"("+currentVoxel+", "+dataValue+");"}},{key:"computeDefinition",value:function computeDefinition(){this._definition="\nvoid "+this._name+"(in vec3 currentVoxel, out vec4 dataValue){\n // lower bound\n vec3 rcurrentVoxel = vec3(floor(currentVoxel.x + 0.5 ), floor(currentVoxel.y + 0.5 ), floor(currentVoxel.z + 0.5 ));\n ivec3 voxel = ivec3(int(rcurrentVoxel.x), int(rcurrentVoxel.y), int(rcurrentVoxel.z));\n\n vec4 tmp = vec4(0., 0., 0., 0.);\n int offset = 0;\n\n "+_shadersHelpers4.default.api(this._base,"voxel","tmp","offset")+"\n "+_shadersHelpers2.default.api(this._base,"tmp","offset","dataValue")+"\n}\n "}}]);return InterpolationIdentity}(_shaders2.default);exports.default=new InterpolationIdentity},{"../helpers/shaders.helpers.texture3d":125,"../helpers/shaders.helpers.unpack":126,"../shaders.base":130}],128:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var _shadersInterpolation=require("./shaders.interpolation.identity");var _shadersInterpolation2=_interopRequireDefault(_shadersInterpolation);var _shadersInterpolation3=require("./shaders.interpolation.trilinear");var _shadersInterpolation4=_interopRequireDefault(_shadersInterpolation3);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function shadersInterpolation(baseFragment,currentVoxel,dataValue,gradient){switch(baseFragment._uniforms.uInterpolation.value){case 0:return _shadersInterpolation2.default.api(baseFragment,currentVoxel,dataValue);case 1:return _shadersInterpolation4.default.api(baseFragment,currentVoxel,dataValue,gradient);default:return _shadersInterpolation2.default.api(baseFragment,currentVoxel,dataValue)}}exports.default=shadersInterpolation},{"./shaders.interpolation.identity":127,"./shaders.interpolation.trilinear":129}],129:[function(require,module,exports){"use strict";var _typeof=typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"?function(obj){return typeof obj}:function(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol?"symbol":typeof obj};Object.defineProperty(exports,"__esModule",{value:true});var _createClass=function(){function defineProperties(target,props){for(var i=0;i0&&arguments[0]!==undefined?arguments[0]:this._base;var currentVoxel=arguments.length>1&&arguments[1]!==undefined?arguments[1]:this._currentVoxel;var dataValue=arguments.length>2&&arguments[2]!==undefined?arguments[2]:this._dataValue;var gradient=arguments.length>3&&arguments[3]!==undefined?arguments[3]:this._gradient;this._base=baseFragment;return this.compute(currentVoxel,dataValue,gradient)}},{key:"compute",value:function compute(currentVoxel,dataValue,gradient){this.computeDefinition();this._base._functions[this._name]=this._definition;return this._name+"("+currentVoxel+", "+dataValue+", "+gradient+");"}},{key:"computeDefinition",value:function computeDefinition(){this._definition="\nvoid "+this._name+"(in vec3 currentVoxel, out vec4 dataValue, out vec3 gradient){\n\n // https://en.wikipedia.org/wiki/Trilinear_interpolation\n vec3 lower_bound = vec3(floor(currentVoxel.x), floor(currentVoxel.y), floor(currentVoxel.z));\n vec3 higher_bound = lower_bound + vec3(1);\n\n float xd = ( currentVoxel.x - lower_bound.x ) / ( higher_bound.x - lower_bound.x );\n float yd = ( currentVoxel.y - lower_bound.y ) / ( higher_bound.y - lower_bound.y );\n float zd = ( currentVoxel.z - lower_bound.z ) / ( higher_bound.z - lower_bound.z );\n\n //\n // c00\n //\n\n //\n\n vec4 v000 = vec4(0.0, 0.0, 0.0, 0.0);\n vec3 c000 = vec3(lower_bound.x, lower_bound.y, lower_bound.z);\n "+_shadersInterpolation2.default.api(this._base,"c000","v000")+"\n vec3 g000 = v000.r * vec3(-1., -1., -1.);\n\n //\n\n vec4 v100 = vec4(0.0, 0.0, 0.0, 0.0);\n vec3 c100 = vec3(higher_bound.x, lower_bound.y, lower_bound.z);\n "+_shadersInterpolation2.default.api(this._base,"c100","v100")+"\n vec3 g100 = v100.r * vec3(1., -1., -1.);\n\n vec4 c00 = v000 * ( 1.0 - xd ) + v100 * xd;\n\n //\n // c01\n //\n vec4 v001 = vec4(0.0, 0.0, 0.0, 0.0);\n vec3 c001 = vec3(lower_bound.x, lower_bound.y, higher_bound.z);\n "+_shadersInterpolation2.default.api(this._base,"c001","v001")+"\n vec3 g001 = v001.r * vec3(-1., -1., 1.);\n\n vec4 v101 = vec4(0.0, 0.0, 0.0, 0.0);\n vec3 c101 = vec3(higher_bound.x, lower_bound.y, higher_bound.z);\n "+_shadersInterpolation2.default.api(this._base,"c101","v101")+"\n vec3 g101 = v101.r * vec3(1., -1., 1.);\n\n vec4 c01 = v001 * ( 1.0 - xd ) + v101 * xd;\n\n //\n // c10\n //\n vec4 v010 = vec4(0.0, 0.0, 0.0, 0.0);\n vec3 c010 = vec3(lower_bound.x, higher_bound.y, lower_bound.z);\n "+_shadersInterpolation2.default.api(this._base,"c010","v010")+"\n vec3 g010 = v010.r * vec3(-1., 1., -1.);\n\n vec4 v110 = vec4(0.0, 0.0, 0.0, 0.0);\n vec3 c110 = vec3(higher_bound.x, higher_bound.y, lower_bound.z);\n "+_shadersInterpolation2.default.api(this._base,"c110","v110")+"\n vec3 g110 = v110.r * vec3(1., 1., -1.);\n\n vec4 c10 = v010 * ( 1.0 - xd ) + v110 * xd;\n\n //\n // c11\n //\n vec4 v011 = vec4(0.0, 0.0, 0.0, 0.0);\n vec3 c011 = vec3(lower_bound.x, higher_bound.y, higher_bound.z);\n "+_shadersInterpolation2.default.api(this._base,"c011","v011")+"\n vec3 g011 = v011.r * vec3(-1., 1., 1.);\n\n vec4 v111 = vec4(0.0, 0.0, 0.0, 0.0);\n vec3 c111 = vec3(higher_bound.x, higher_bound.y, higher_bound.z);\n "+_shadersInterpolation2.default.api(this._base,"c111","v111")+"\n vec3 g111 = v111.r * vec3(1., 1., 1.);\n\n vec4 c11 = v011 * ( 1.0 - xd ) + v111 * xd;\n\n // c0 and c1\n vec4 c0 = c00 * ( 1.0 - yd) + c10 * yd;\n vec4 c1 = c01 * ( 1.0 - yd) + c11 * yd;\n\n // c\n vec4 c = c0 * ( 1.0 - zd) + c1 * zd;\n dataValue = c;\n\n // compute gradient\n gradient = g000 + g100 + g010 + g110 + g011 + g111 + g110 + g011;\n // gradientMagnitude = length(gradient);\n // // https://en.wikipedia.org/wiki/Normal_(geometry)#Transforming_normals\n // vec3 localNormal = (-1. / gradientMagnitude) * gradient;\n // normal = normalize(normalPixelToPatient"+this.id+" * localNormal);\n //normal = gradient;\n\n}\n "}}]);return InterpolationTrilinear}(_shaders2.default);exports.default=new InterpolationTrilinear},{"../shaders.base":130,"./shaders.interpolation.identity":127}],130:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var _createClass=function(){function defineProperties(target,props){for(var i=0;i