diff --git a/classes/Tasks/CLIReporter.php b/classes/Tasks/CLIReporter.php new file mode 100755 index 00000000..f571d390 --- /dev/null +++ b/classes/Tasks/CLIReporter.php @@ -0,0 +1,60 @@ +headerFields = $headerFields; + $this->format = $format; + } + + /** + * @inheritDoc + */ + public function open() { + } + + /** + * @inheritDoc + */ + public function add(array $data) { + $item = []; + for($i = 0; $i < count($data); $i++) { + if ($i >= count($this->headerFields)) { + break; + } + + $item[$this->headerFields[$i]] = $data[$i]; + } + + $this->data[] = $item; + } + + /** + * @inheritDoc + */ + public function close() { + \WP_CLI\Utils\format_items($this->format, $this->data, $this->headerFields); + } + + /** + * @inheritDoc + */ + public function headerFields(): array { + return $this->headerFields; + } +} \ No newline at end of file diff --git a/classes/Tasks/ITaskReporter.php b/classes/Tasks/ITaskReporter.php new file mode 100755 index 00000000..9230fcd8 --- /dev/null +++ b/classes/Tasks/ITaskReporter.php @@ -0,0 +1,39 @@ +reporters = $reporters; + } + } + + public function addReporter(ITaskReporter $reporter) { + $this->reporters[] = $reporter; + } + + /** + * @inheritDoc + */ + public function open() { + foreach($this->reporters as $reporter) { + $reporter->open(); + } + } + + /** + * @inheritDoc + */ + public function add(array $data) { + foreach($this->reporters as $reporter) { + $reporter->add($data); + } + } + + /** + * @inheritDoc + */ + public function close() { + foreach($this->reporters as $reporter) { + $reporter->close(); + } + } + + /** + * @inheritDoc + */ + public function headerFields(): array { + return (count($this->reporters) > 0) ? $this->reporters[0]->headerFields() : []; + } +} \ No newline at end of file diff --git a/classes/Tasks/TaskDatabase.php b/classes/Tasks/TaskDatabase.php index 5b2b5ce9..1587fc54 100755 --- a/classes/Tasks/TaskDatabase.php +++ b/classes/Tasks/TaskDatabase.php @@ -177,6 +177,19 @@ protected static function installTokenTable() { //endregion + //region Nuke + + public static function nukeData() { + global $wpdb; + + $wpdb->query("delete from {$wpdb->base_prefix}mcloud_task"); + $wpdb->query("delete from {$wpdb->base_prefix}mcloud_task_data"); + $wpdb->query("delete from {$wpdb->base_prefix}mcloud_task_schedule"); + $wpdb->query("delete from {$wpdb->base_prefix}mcloud_task_token"); + } + + //endregion + //region Tokens public static function setToken($token, $tokenVal) { diff --git a/classes/Tasks/TaskManager.php b/classes/Tasks/TaskManager.php index b767288f..7a80f799 100755 --- a/classes/Tasks/TaskManager.php +++ b/classes/Tasks/TaskManager.php @@ -110,6 +110,7 @@ private function setupHooks() { add_action('wp_ajax_mcloud_start_task', [$this, 'actionStartTask']); add_action('wp_ajax_mcloud_cancel_task', [$this, 'actionCancelTask']); add_action('wp_ajax_mcloud_cancel_all_tasks', [$this, 'actionCancelAllTasks']); + add_action('wp_ajax_mcloud_nuke_all_tasks', [$this, 'actionNukeAllTasks']); add_action('wp_ajax_mcloud_task_status', [$this, 'actionTaskStatus']); add_action('wp_ajax_mcloud_all_task_statuses', [$this, 'actionAllTaskStatuses']); @@ -340,6 +341,19 @@ public function actionCancelAllTasks() { wp_send_json(['status' => 'ok', 'message', 'Tasks cancelled.']); } + /** + * Cancels all running tasks + */ + public function actionNukeAllTasks() { + Logger::info("Nuking All Tasks ... ", [], __METHOD__, __LINE__); + check_ajax_referer('mcloud_nuke_all_tasks', 'nonce'); + + // SQL TO DELETE IT ALL EVERYTHING + TaskDatabase::nukeData(); + + wp_send_json(['status' => 'ok', 'message', 'Tasks cancelled.']); + } + public function actionClearTaskHistory() { Logger::info("Clearing Task History ... ", [], __METHOD__, __LINE__); diff --git a/classes/Tasks/TaskReporter.php b/classes/Tasks/TaskReporter.php index ddacf405..361a7d1c 100755 --- a/classes/Tasks/TaskReporter.php +++ b/classes/Tasks/TaskReporter.php @@ -18,20 +18,20 @@ use MediaCloud\Vendor\Monolog\Handler\StreamHandler; use MediaCloud\Vendor\Monolog\Logger as MonologLogger; -class TaskReporter { +class TaskReporter implements ITaskReporter { /** @var null|Task */ private $task = null; - private $headerFields = []; private $reportCSV = null; private $taskFileName = null; private $alwaysGenerate = false; - private $loggerAdded = false; + + protected $headerFields = []; /** * TaskReporter constructor. * - * @param Task|string $taskorArray + * @param Task|string $taskOrFileName * @param array $headerFields */ public function __construct($taskOrFileName, array $headerFields, bool $alwaysGenerate = false) { @@ -46,6 +46,42 @@ public function __construct($taskOrFileName, array $headerFields, bool $alwaysGe $this->alwaysGenerate = $alwaysGenerate; } + public static function reporterDirectory(?string $file = null) { + $reportDir = trailingslashit(WP_CONTENT_DIR).'mcloud-reports'; + if (is_multisite() && !is_network_admin()) { + $reportDir .= '/'.get_current_blog_id(); + } + + if (!file_exists($reportDir)) { + @mkdir($reportDir, 0755, true); + } + + if (!file_exists($reportDir)) { + return null; + } + + if (!empty($file)) { + return trailingslashit($reportDir).$file; + } + + return $reportDir; + } + + public static function reporterUrl(?string $file = null) { + if (is_multisite() && !is_network_admin()) { + $url = content_url('/mcloud-reports/'.get_current_blog_id()); + $url = site_url(parse_url($url, PHP_URL_PATH)); + } else { + $url = content_url('/mcloud-reports'); + } + + if (!empty($file)) { + return trailingslashit($url).$file; + } + + return $url; + } + public function open() { if (!$this->alwaysGenerate && empty(TaskSettings::instance()->generateReports)) { return false; @@ -59,12 +95,9 @@ public function open() { return false; } - $reportDir = trailingslashit(WP_CONTENT_DIR).'mcloud-reports'; - if (!file_exists($reportDir)) { - @mkdir($reportDir, 0755, true); - } + $reportDir = static::reporterDirectory(); - if (file_exists($reportDir)) { + if (!empty($reportDir)) { if (!empty($this->taskFileName)) { if (strpos($this->taskFileName, '/') !== 0) { $this->taskFileName = trailingslashit($reportDir).$this->taskFileName; @@ -129,4 +162,8 @@ public function close() { } } } + + public function headerFields(): array { + return $this->headerFields; + } } \ No newline at end of file diff --git a/classes/Tools/DynamicImages/DynamicImagesTool.php b/classes/Tools/DynamicImages/DynamicImagesTool.php index c88a14e5..13e5920c 100755 --- a/classes/Tools/DynamicImages/DynamicImagesTool.php +++ b/classes/Tools/DynamicImages/DynamicImagesTool.php @@ -25,6 +25,8 @@ use function MediaCloud\Plugin\Utilities\parse_req; abstract class DynamicImagesTool extends Tool { + protected $forcedEnabled = false; + /** @var DynamicImagesToolSettings */ protected $settings = null; @@ -42,6 +44,10 @@ public function __construct($toolName, $toolInfo, $toolManager) { parent::__construct($toolName, $toolInfo, $toolManager); add_filter('media-cloud/dynamic-images/enabled', function($enabled){ + if ($this->forcedEnabled) { + return $this->forcedEnabled; + } + if (!$enabled) { return $this->enabled(); } @@ -115,10 +121,9 @@ public function setup() { $this->hookupUI(); - add_filter('wp_get_attachment_url', [$this, 'getAttachmentURL'], 10000, 2); - add_filter('wp_prepare_attachment_for_js', array($this, 'prepareAttachmentForJS'), 1000, 3); + $this->setupHooks(); - add_filter('image_downsize', [$this, 'imageDownsize'], 1000, 3); + add_filter('wp_prepare_attachment_for_js', array($this, 'prepareAttachmentForJS'), 1000, 3); add_filter('image_get_intermediate_size', [$this, 'imageGetIntermediateSize'], 0, 3); @@ -230,12 +235,32 @@ public function setup() { }, 100000, 3); } + protected function setupHooks() { + add_filter('wp_get_attachment_url', [$this, 'getAttachmentURL'], 10000, 2); + add_filter('image_downsize', [$this, 'imageDownsize'], 1000, 3); + } + + protected function tearDownHooks() { + remove_filter('wp_get_attachment_url', [$this, 'getAttachmentURL'], 10000); + remove_filter('image_downsize', [$this, 'imageDownsize'], 1000); + } + public function registerSettings() { parent::registerSettings(); register_setting('ilab-imgix-preset', 'ilab-imgix-presets'); register_setting('ilab-imgix-preset', 'ilab-imgix-size-presets'); } + + public function forceEnable($enabled) { + $this->forcedEnabled = $enabled; + if ($this->forcedEnabled) { + $this->setupHooks(); + } else { + $this->tearDownHooks(); + } + } + //endregion //region URL Generation diff --git a/classes/Tools/Imgix/ImgixTool.php b/classes/Tools/Imgix/ImgixTool.php index cf1947bd..11831ffe 100755 --- a/classes/Tools/Imgix/ImgixTool.php +++ b/classes/Tools/Imgix/ImgixTool.php @@ -38,6 +38,7 @@ * Imgix tool. */ class ImgixTool extends DynamicImagesTool implements ConfiguresWizard { + //region Constructor public function __construct($toolName, $toolInfo, $toolManager) { $this->settings = ImgixToolSettings::instance(); @@ -45,11 +46,11 @@ public function __construct($toolName, $toolInfo, $toolManager) { parent::__construct($toolName, $toolInfo, $toolManager); add_filter('media-cloud/imgix/enabled', function($enabled){ - return $this->enabled(); + return $this->forcedEnabled || $this->enabled(); }); add_filter('media-cloud/imgix/alternative-formats/enabled', function($enabled){ - return ($this->enabled() && $this->settings->enabledAlternativeFormats); + return ($this->forcedEnabled || $this->enabled() && $this->settings->enabledAlternativeFormats); }); } //endregion @@ -197,21 +198,23 @@ private function buildImgixParams($params, $mimetype = '') { $params['q'] = $this->settings->imageQuality; } - foreach($this->paramPropsByType['media-chooser'] as $key => $info) { - if(isset($params[$key]) && !empty($params[$key])) { - $media_id = $params[$key]; - unset($params[$key]); - $markMeta = wp_get_attachment_metadata($media_id); - if (isset($markMeta['s3'])) { - $params[$info['imgix-param']] = '/'.$markMeta['s3']['key']; - } else { - $params[$info['imgix-param']] = '/'.$markMeta['file']; - } - } else { - unset($params[$key]); - if(isset($info['dependents'])) { - foreach($info['dependents'] as $depKey) { - unset($params[$depKey]); + if (isset($this->paramPropsByType['media-chooser'])) { + foreach($this->paramPropsByType['media-chooser'] as $key => $info) { + if(isset($params[$key]) && !empty($params[$key])) { + $media_id = $params[$key]; + unset($params[$key]); + $markMeta = wp_get_attachment_metadata($media_id); + if (isset($markMeta['s3'])) { + $params[$info['imgix-param']] = '/'.$markMeta['s3']['key']; + } else { + $params[$info['imgix-param']] = '/'.$markMeta['file']; + } + } else { + unset($params[$key]); + if(isset($info['dependents'])) { + foreach($info['dependents'] as $depKey) { + unset($params[$depKey]); + } } } } @@ -260,10 +263,11 @@ public function buildSizedImage($id, $size) { return []; } - $imgix = new UrlBuilder($this->settings->imgixDomains[0], $this->settings->useHTTPS); - - if($this->settings->signingKey) { - $imgix->setSignKey($this->settings->signingKey); + $domain = apply_filters('media-cloud/dynamic-images/override-domain', !empty($this->settings->imgixDomains) ? $this->settings->imgixDomains[0] : null); + $imgix = new UrlBuilder($domain, $this->settings->useHTTPS); + $key = apply_filters('media-cloud/dynamic-images/override-key', $this->settings->signingKey); + if(!empty($key)) { + $imgix->setSignKey($key); } if (isset($size['crop'])) { @@ -294,19 +298,28 @@ public function buildSizedImage($id, $size) { ]; } - $params = [ + $mimetype = get_post_mime_type($id); + + if(isset($meta['imgix-params']) && !$this->skipSizeParams) { + $params = $meta['imgix-params']; + } else { + $params = []; + } + + $params = array_merge($params, [ 'fit' => ($is_crop) ? 'crop' : 'fit', 'w' => $size[0], 'h' => $size[1], 'fm' => 'jpg' - ]; + ]); + $params = $this->buildImgixParams($params, $mimetype); $params = apply_filters('media-cloud/dynamic-images/filter-parameters', $params, $size, $id, $meta); $imageFile = (isset($meta['s3'])) ? $meta['s3']['key'] : $meta['file']; $result = [ - $imgix->createURL(str_replace('%2F', '/', urlencode($imageFile)), $params), + $imgix->createURL(str_replace(['%2F', '%2540', '%40'], ['/', '@', '@'], urlencode($imageFile)), $params), $size[0], $size[1] ]; @@ -404,10 +417,11 @@ public function buildImage($id, $size, $params = null, $skipParams = false, $mer } } - $imgix = new UrlBuilder($this->settings->imgixDomains[0], $this->settings->useHTTPS); - - if($this->settings->signingKey) { - $imgix->setSignKey($this->settings->signingKey); + $domain = apply_filters('media-cloud/dynamic-images/override-domain', !empty($this->settings->imgixDomains) ? $this->settings->imgixDomains[0] : null); + $imgix = new UrlBuilder($domain, $this->settings->useHTTPS); + $key = apply_filters('media-cloud/dynamic-images/override-key', $this->settings->signingKey); + if(!empty($key)) { + $imgix->setSignKey($key); } if($size == 'full' && !$newSize) { @@ -443,7 +457,7 @@ public function buildImage($id, $size, $params = null, $skipParams = false, $mer $result = [ - $imgix->createURL(str_replace('%2F', '/', urlencode($imageFile)), ($skipParams) ? [] : $params), + $imgix->createURL(str_replace(['%2F', '%2540', '%40'], ['/', '@', '@'], urlencode($imageFile)), ($skipParams) ? [] : $params), $meta['width'], $meta['height'], false @@ -671,7 +685,7 @@ public function buildImage($id, $size, $params = null, $skipParams = false, $mer } $result = [ - $imgix->createURL(str_replace('%2F', '/', urlencode($imageFile)), $params), + $imgix->createURL(str_replace(['%2F', '%2540', '%40'], ['/', '@', '@'], $imageFile), $params), $params['w'], $params['h'], true @@ -681,13 +695,14 @@ public function buildImage($id, $size, $params = null, $skipParams = false, $mer } public function urlForStorageMedia($key, $params = []) { - $imgix = new UrlBuilder($this->settings->imgixDomains[0], $this->settings->useHTTPS); - - if($this->settings->signingKey) { - $imgix->setSignKey($this->settings->signingKey); + $domain = apply_filters('media-cloud/dynamic-images/override-domain', !empty($this->settings->imgixDomains) ? $this->settings->imgixDomains[0] : null); + $imgix = new UrlBuilder($domain, $this->settings->useHTTPS); + $key = apply_filters('media-cloud/dynamic-images/override-key', $this->settings->signingKey); + if(!empty($key)) { + $imgix->setSignKey($key); } - return $imgix->createURL(str_replace('%2F', '/', urlencode($key)), $params); + return $imgix->createURL(str_replace(['%2F', '%2540', '%40'], ['/', '@', '@'], urlencode($key)), $params); } public function fixCleanedUrls($good_protocol_url, $original_url, $context) { @@ -993,11 +1008,12 @@ public function mediaSendToEditor($html, $id, $attachment) { //region Testing public function urlForKey($key) { - $imgix = new UrlBuilder($this->settings->imgixDomains[0], $this->settings->useHTTPS); - - if($this->settings->signingKey) { - $imgix->setSignKey($this->settings->signingKey); - } + $domain = apply_filters('media-cloud/dynamic-images/override-domain', !empty($this->settings->imgixDomains) ? $this->settings->imgixDomains[0] : null); + $imgix = new UrlBuilder($domain, $this->settings->useHTTPS); + $key = apply_filters('media-cloud/dynamic-images/override-key', $this->settings->signingKey); + if(!empty($key)) { + $imgix->setSignKey($key); + } return $imgix->createURL($key, []); } @@ -1036,7 +1052,7 @@ public static function configureWizard($builder = null) { ->select('Complete', 'imgix setup is now complete!') ->group('wizard.imgix.success', 'select-buttons') ->option('other-features', 'Explore Other Features', null, null, null, null, 'admin:admin.php?page=media-cloud') - ->option('advanced-imgix-settings', 'Advanced Settings', null, null, null, null, 'admin:admin.php?page=media-cloud-settings-imgix') + ->option('advanced-imgix-settings', 'Finish & Exit Wizard', null, null, null, null, 'admin:admin.php?page=media-cloud-settings-imgix') ->endGroup() ->endStep(); diff --git a/classes/Tools/Imgix/ImgixToolSettings.php b/classes/Tools/Imgix/ImgixToolSettings.php index 90d6cec0..59365ed0 100755 --- a/classes/Tools/Imgix/ImgixToolSettings.php +++ b/classes/Tools/Imgix/ImgixToolSettings.php @@ -61,15 +61,17 @@ public function __get($name) { if ($this->_imgixDomains === null) { $this->_imgixDomains = []; $domains = Environment::Option('mcloud-imgix-domains', null, ''); - $domain_lines = explode("\n", $domains); + if (!empty($domains)) { + $domain_lines = explode("\n", $domains); - if(count($domain_lines) <= 1) { - $domain_lines = explode(',', $domains); - } + if(count($domain_lines) <= 1) { + $domain_lines = explode(',', $domains); + } - foreach($domain_lines as $d) { - if(!empty($d)) { - $this->_imgixDomains[] = trim($d); + foreach($domain_lines as $d) { + if(!empty($d)) { + $this->_imgixDomains[] = trim($d); + } } } } diff --git a/classes/Tools/Reports/ReportsTool.php b/classes/Tools/Reports/ReportsTool.php new file mode 100755 index 00000000..a9c31d97 --- /dev/null +++ b/classes/Tools/Reports/ReportsTool.php @@ -0,0 +1,156 @@ +enabled()) { +// ToolsManager::instance()->addMultisiteTool($this); +// +// if (is_multisite() && !empty($this->settings->multisiteHide)) { +// return; +// } + + ToolsManager::instance()->insertToolSeparator(); + $this->options_page = 'media-tools-report-viewer'; + add_submenu_page($top_menu_slug, 'Media Cloud Report Viewer', 'Report Viewer', 'manage_options', 'media-tools-report-viewer', [ + $this, + 'renderViewer' + ]); + + + } + } + + public function enabled() { + return true; + } + + public function setup() { + if ($this->enabled()) { + if (is_admin()) { + add_action('admin_enqueue_scripts', function(){ + wp_enqueue_script('mcloud-reports-js', ILAB_PUB_JS_URL.'/mcloud-reports.js', null, null, true); + wp_enqueue_style('mcloud-reports-css', ILAB_PUB_CSS_URL . '/mcloud-reports.css' ); + }); + } + } + } + + private function getReports() { + $reportDir = TaskReporter::reporterDirectory(); + if (!file_exists($reportDir)) { + return [ + '' => "No Reports" + ]; + } + + + $files = list_files($reportDir); + if (count($files) === 0) { + return [ + '' => "No Reports" + ]; + } + + $tz = get_option('timezone_string'); + if (empty($tz)) { + $tz = 'UTC'; + } + + $unsorted = []; + foreach($files as $file) { + $info = pathinfo($file); + if (empty($info) || (strtolower($info['extension']) !== 'csv')) { + continue; + } + + $name = $info['filename']; + $nameParts = explode('-', $name); + array_pop($nameParts); + $name = ucwords(implode(' ', $nameParts)); + $reportURL = TaskReporter::reporterUrl($info['basename']); + + $time = filectime($file); + $carbon = Carbon::createFromTimestamp($time, $tz); + + $name .= " — ".$carbon->toDateTimeString(); + + $unsorted[$time] = [ + $reportURL, + $name + ]; + } + + if (empty($unsorted)) { + return [ + '' => "No Reports" + ]; + } + + krsort($unsorted, SORT_NUMERIC); + + $results = [ + '' => "Select Report to View" + ]; + + foreach($unsorted as $key => $value) { + $results[$value[0]] = $value[1]; + } + + if (count($results) > 51) { + return array_slice($results, 0, 51, true); + } + + return $results; + } + + public function renderViewer() { + $allReports = $this->getReports(); + + Tracker::trackView('Report Viewer', '/reports'); + + echo View::render_view('reports/report-viewer', [ + 'title' => 'Report Viewer', + 'allReports' => $allReports, + ]); + + } +} diff --git a/classes/Tools/Storage/CLI/StorageCommands.php b/classes/Tools/Storage/CLI/StorageCommands.php index 4612c497..f89d27cb 100755 --- a/classes/Tools/Storage/CLI/StorageCommands.php +++ b/classes/Tools/Storage/CLI/StorageCommands.php @@ -17,7 +17,9 @@ namespace MediaCloud\Plugin\Tools\Storage\CLI; use MediaCloud\Plugin\CLI\Command ; +use MediaCloud\Plugin\Tasks\TaskManager ; use MediaCloud\Plugin\Tasks\TaskReporter ; +use MediaCloud\Plugin\Tools\Integrations\PlugIns\WebStories\Tasks\UpdateWebStoriesTask ; use MediaCloud\Plugin\Tools\Storage\StorageToolSettings ; use MediaCloud\Plugin\Tools\Browser\Tasks\ImportFromStorageTask ; use MediaCloud\Plugin\Tools\Integrations\PlugIns\Elementor\Tasks\UpdateElementorTask ; @@ -27,9 +29,12 @@ use MediaCloud\Plugin\Tools\Storage\Tasks\MigrateTask ; use MediaCloud\Plugin\Tools\Storage\Tasks\RegenerateThumbnailTask ; use MediaCloud\Plugin\Tools\Storage\Tasks\UnlinkTask ; +use MediaCloud\Plugin\Tools\Storage\Tasks\VerifyLibraryTask ; use MediaCloud\Plugin\Tools\ToolsManager ; use MediaCloud\Plugin\Utilities\Logging\Logger ; +use MediaCloud\Plugin\Utilities\Search\Searcher ; use MediaCloud\Vendor\GuzzleHttp\Client ; +use Mpdf\Shaper\Sea ; use function MediaCloud\Plugin\Utilities\arrayPath ; if ( !defined( 'ABSPATH' ) ) { @@ -101,6 +106,9 @@ class StorageCommands extends Command * [--delete-migrated] * : Deletes migrated media from your local WordPress server. Note: You must have Delete Uploads enabled in Cloud Storage for this setting to have any effect. If you have Delete Uploads disabled, turning this on will have zero effect. * + * [--allow-optimizers] + * : If you are using the Image Optimization feature, or using a third party image optimization plugin, this will allow them to run, if needed, during migration. Generally speaking, you do not want to turn this on as an error with an optimization can derail the entire migration. You should optimize your media before running the migration and keep this option turned off. + * * @when after_wp_load * * @param $args @@ -108,7 +116,7 @@ class StorageCommands extends Command * * @throws \Exception */ - public function migrateToCloud( $args, $assoc_args ) + public function migrate( $args, $assoc_args ) { /** @var \Freemius $media_cloud_licensing */ global $media_cloud_licensing ; @@ -146,7 +154,7 @@ public function migrateToCloud( $args, $assoc_args ) * * @throws \Exception */ - public function importFromCloud( $args, $assoc_args ) + public function import( $args, $assoc_args ) { /** @var \Freemius $media_cloud_licensing */ global $media_cloud_licensing ; @@ -267,39 +275,6 @@ public function unlink( $args, $assoc_args ) $this->runTask( $task, $options ); } - /** - * Migrate NextGen Gallery images to cloud storage. - * - * @when after_wp_load - * - * @param $args - * @param $assoc_args - * - * @throws \Exception - */ - public function migrateNGG( $args, $assoc_args ) - { - global $media_cloud_licensing ; - self::Error( "Only available in the Premium version. To upgrade: https://mediacloud.press/pricing/" ); - } - - /** - * Updates Elementor's data with the correct URLs. - * - * - * @when after_wp_load - * - * @param $args - * @param $assoc_args - * - * @throws \Exception - */ - public function updateElementor( $args, $assoc_args ) - { - global $media_cloud_licensing ; - self::Error( "Only available in the Premium version. To upgrade: https://mediacloud.press/pricing/" ); - } - /** * Migrate other plugin settings * @@ -311,7 +286,7 @@ public function updateElementor( $args, $assoc_args ) * * @throws \Exception */ - public function migrateFromOther( $args, $assoc_args ) + public function migrateOtherPlugin( $args, $assoc_args ) { /** @var MigrateFromOtherTask $task */ $task = new MigrateFromOtherTask(); @@ -639,8 +614,8 @@ public function fixKeys( $args, $assoc_args ) * * ## OPTIONS * - * - * : The filename for the CSV report to generate + * [--local] + * : Processes all files, including those not on cloud storage. * * [--limit=] * : The maximum number of items to process, default is infinity. @@ -653,7 +628,7 @@ public function fixKeys( $args, $assoc_args ) * * ## EXAMPLES * - * wp mediacloud verify verify.csv + * wp mediacloud verify * * @when after_wp_load * @@ -664,77 +639,35 @@ public function fixKeys( $args, $assoc_args ) */ public function verify( $args, $assoc_args ) { - if ( count( $args ) == 0 ) { - self::Error( "Missing required argument. Run the command: wp mediacloud verify " ); - } - $allSizes = ilab_get_image_sizes(); - $sizeKeys = array_keys( $allSizes ); - $sizeKeys = array_sort( $sizeKeys ); - /** @var StorageTool $storageTool */ - $storageTool = ToolsManager::instance()->tools['storage']; - $csvFileName = $args[0]; - if ( strpos( $csvFileName, '/' ) !== 0 ) { - $csvFileName = trailingslashit( getcwd() ) . $csvFileName; - } - if ( file_exists( $csvFileName ) ) { - unlink( $csvFileName ); - } - $headers = array_merge( array_merge( [ - 'Post ID', - 'Mime Type', - 'S3 Metadata Status', - 'Attachment URL', - 'Original Source Image URL' - ], $sizeKeys ), [ 'Notes' ] ); - $reporter = new TaskReporter( $csvFileName, $headers, true ); - $queryArgs = [ - 'post_type' => 'attachment', - 'post_status' => 'inherit', - 'fields' => 'ids', - 'orderby' => 'date', - 'order' => 'desc', - 'meta_query' => [ - 'relation' => 'OR', - [ - 'key' => '_wp_attachment_metadata', - 'value' => '"s3"', - 'compare' => 'LIKE', - 'type' => 'CHAR', - ], - [ - 'key' => 'ilab_s3_info', - 'compare' => 'EXISTS', - ], - ], - ]; - - if ( isset( $assoc_args['limit'] ) ) { - $queryArgs['posts_per_page'] = $assoc_args['limit']; + $options = $assoc_args; + if ( isset( $options['limit'] ) ) { - if ( isset( $assoc_args['page'] ) ) { - $queryArgs['offset'] = max( 0, ($assoc_args['page'] - 1) * $assoc_args['limit'] ); - } else { - if ( isset( $assoc_args['offset'] ) ) { - $queryArgs['offset'] = $assoc_args['offset']; - } + if ( isset( $options['page'] ) ) { + $options['offset'] = max( 0, ($assoc_args['page'] - 1) * $assoc_args['limit'] ); + unset( $options['page'] ); } - } else { - $queryArgs['posts_per_page'] = -1; } - $query = new \WP_Query( $queryArgs ); - $postIds = $query->posts; - add_filter( 'media-cloud/dynamic-images/skip-url-generation', '__return_true' ); - foreach ( $postIds as $postId ) { - self::Info( "Processing {$postId} ... " ); - $storageTool->verifyPost( $postId, $reporter, function ( $message, $newLine = false ) { - self::Info( $message, $newLine ); - } ); - self::Info( "Done.", true ); + if ( isset( $options['order-by'] ) ) { + $orderBy = $options['order-by']; + $dir = arrayPath( $options, 'order', 'asc' ); + unset( $options['order-by'] ); + unset( $options['order'] ); + $options['sort-order'] = $orderBy . '-' . $dir; } - remove_filter( 'media-cloud/dynamic-images/skip-url-generation', '__return_true' ); - $reporter->close(); + + + if ( isset( $options['local'] ) && !empty($options['local']) ) { + unset( $options['local'] ); + $options['include-local'] = true; + } + + $task = new VerifyLibraryTask(); + VerifyLibraryTask::$callback = function ( $message, $newLine = false ) { + self::Info( $message, $newLine ); + }; + $this->runTask( $task, $options ); } /** @@ -847,9 +780,70 @@ public function syncLocal( $args, $assoc_args ) $reporter->close(); } + /** + * Replaces URLs in content with the cloud storage URL. This will only replace local URLs. + * + * ## OPTIONS + * + * [--dry-run] + * : Simulate the search and replace + * + * [--local] + * : Revert to local URLs regardless of current cloud storage settings + * + * [--imgix] + * : Generate imgix URLs, use this if you are trying to switch back from imgix. To use this switch, you should have an imgix domain and/or signing key saved in imgix settings, otherwise use the --imgix-domain and --imgix-key arguments. + * + * [--imgix-domain=] + * : The imgix domain to use, if not using what is saved in the settings + * + * [--imgix-key=] + * : The imgix signing key to use, if not using what is saved in the settings + * + * [--cdn=] + * : If you are trying to rollback from a setup that used a CDN, specify the CDN here, including the https:// part. + * + * [--doc-cdn=] + * : If you are trying to rollback from a setup that used a doc CDN, specify the doc CDN here, including the https:// part. + * + * [--batch-size=] + * : The number of attachments to process in a batch + * + * [--sleep=] + * : The amount of time, in milliseconds, to sleep between replacements. Will slow down processing, but reduce database CPU usage. Default is 250, use 0 to disable. + * + * [--continue] + * : Internal use + * + * [--limit=] + * : Internal use + * + * [--page=] + * : Internal use + * + * [--token=] + * : Internal use + * + * ## EXAMPLES + * + * wp mediacloud syncLocal sync.csv + * + * @when after_wp_load + * + * @param $cmdArgs + * @param $assoc_args + * + */ + public function replace( $cmdArgs, $assoc_args ) + { + /** @var \Freemius $media_cloud_licensing */ + global $media_cloud_licensing ; + self::Error( "Only available in the Premium version. To upgrade: https://mediacloud.press/pricing/" ); + } + public static function Register() { - \WP_CLI::add_command( 'mediacloud', __CLASS__ ); + \WP_CLI::add_command( 'mediacloud:storage', __CLASS__ ); } } \ No newline at end of file diff --git a/classes/Tools/Storage/Driver/Backblaze/BackblazeStorage.php b/classes/Tools/Storage/Driver/Backblaze/BackblazeStorage.php index 93968fba..de0dac3f 100755 --- a/classes/Tools/Storage/Driver/Backblaze/BackblazeStorage.php +++ b/classes/Tools/Storage/Driver/Backblaze/BackblazeStorage.php @@ -297,7 +297,7 @@ public function deleteDirectory($key) { } $key = trailingslashit($key); - $files = $this->dir($key, null); + $files = $this->dir($key, null)['files']; /** @var StorageFile $file */ foreach($files as $file) { if ($file->type() == 'FILE') { @@ -339,7 +339,7 @@ public function deleteDirectory($key) { } } - public function dir($path = '', $delimiter = '/') { + public function dir($path = '', $delimiter = '/', $limit = -1, $next = null) { if(!$this->client) { throw new InvalidStorageSettingsException('Storage settings are invalid'); } @@ -361,10 +361,13 @@ public function dir($path = '', $delimiter = '/') { } } - return array_merge($dirs, $files); + return [ + 'next' => null, + 'files' => array_merge($dirs, $files) + ]; } - public function ls($path = '', $delimiter = '/') { + public function ls($path = '', $delimiter = '/', $limit = -1, $next = null) { if(!$this->client) { throw new InvalidStorageSettingsException('Storage settings are invalid'); } @@ -383,7 +386,10 @@ public function ls($path = '', $delimiter = '/') { } } - return $files; + return [ + 'next' => null, + 'files' => $files + ]; } public function info($key) { @@ -501,7 +507,7 @@ public static function configureWizard($builder = null) { $builder->select('Complete', 'Basic setup is now complete! Configure advanced settings or setup imgix.') ->group('wizard.cloud-storage.providers.backblaze.success', 'select-buttons') ->option('configure-imgix', 'Set Up imgix', null, null, 'imgix') - ->option('advanced-settings', 'Advanced Settings', null, null, null, null, 'admin:admin.php?page=media-cloud-settings&tab=storage') + ->option('advanced-settings', 'Finish & Exit Wizard', null, null, null, null, 'admin:admin.php?page=media-cloud-settings&tab=storage') ->endGroup() ->endStep(); diff --git a/classes/Tools/Storage/Driver/GoogleCloud/GoogleStorage.php b/classes/Tools/Storage/Driver/GoogleCloud/GoogleStorage.php index 64f81e9f..1889f7a1 100755 --- a/classes/Tools/Storage/Driver/GoogleCloud/GoogleStorage.php +++ b/classes/Tools/Storage/Driver/GoogleCloud/GoogleStorage.php @@ -487,7 +487,7 @@ public function deleteDirectory($key) { } $key = trailingslashit($key); - $files = $this->dir($key, null); + $files = $this->dir($key, null)['files']; /** @var StorageFile $file */ foreach($files as $file) { if ($file->type() == 'FILE') { @@ -529,7 +529,7 @@ public function deleteDirectory($key) { } } - public function dir($path = '', $delimiter = '/') { + public function dir($path = '', $delimiter = '/', $limit = -1, $next = null) { if(!$this->client) { throw new InvalidStorageSettingsException('Storage settings are invalid'); } @@ -559,12 +559,13 @@ public function dir($path = '', $delimiter = '/') { $dirs[] = new StorageFile('DIR', $prefix); } - $fileList = array_merge($dirs, $files); - - return $fileList; + return [ + 'next' => null, + 'files' => array_merge($dirs, $files) + ]; } - public function ls($path = '', $delimiter = '/') { + public function ls($path = '', $delimiter = '/', $limit = -1, $next = null) { if(!$this->client) { throw new InvalidStorageSettingsException('Storage settings are invalid'); } @@ -584,7 +585,10 @@ public function ls($path = '', $delimiter = '/') { $files[] = $file->name(); } - return $files; + return [ + 'next' => null, + 'files' => $files + ]; } //endregion @@ -683,7 +687,7 @@ public static function configureWizard($builder = null) { $builder->select('Complete', 'Basic setup is now complete! Configure advanced settings or setup imgix.') ->group('wizard.cloud-storage.providers.google.success', 'select-buttons') ->option('configure-imgix', 'Set Up imgix', null, null, 'imgix') - ->option('advanced-settings', 'Advanced Settings', null, null, null, null, 'admin:admin.php?page=media-cloud-settings&tab=storage') + ->option('advanced-settings', 'Finish & Exit Wizard', null, null, null, null, 'admin:admin.php?page=media-cloud-settings&tab=storage') ->endGroup() ->endStep(); diff --git a/classes/Tools/Storage/Driver/S3/BackblazeS3Storage.php b/classes/Tools/Storage/Driver/S3/BackblazeS3Storage.php index cca10d22..4094583a 100755 --- a/classes/Tools/Storage/Driver/S3/BackblazeS3Storage.php +++ b/classes/Tools/Storage/Driver/S3/BackblazeS3Storage.php @@ -201,7 +201,7 @@ public static function configureWizard($builder = null) { $builder->select('Complete', 'Basic setup is now complete! Configure advanced settings or setup imgix.') ->group('wizard.cloud-storage.providers.backblaze-s3.success', 'select-buttons') ->option('configure-imgix', 'Set Up imgix', null, null, 'imgix') - ->option('advanced-settings', 'Advanced Settings', null, null, null, null, 'admin:admin.php?page=media-cloud-settings&tab=storage') + ->option('advanced-settings', 'Finish & Exit Wizard', null, null, null, null, 'admin:admin.php?page=media-cloud-settings&tab=storage') ->endGroup() ->endStep(); diff --git a/classes/Tools/Storage/Driver/S3/DigitalOceanStorage.php b/classes/Tools/Storage/Driver/S3/DigitalOceanStorage.php index f054c381..e4e2afc3 100755 --- a/classes/Tools/Storage/Driver/S3/DigitalOceanStorage.php +++ b/classes/Tools/Storage/Driver/S3/DigitalOceanStorage.php @@ -119,7 +119,7 @@ public static function configureWizard($builder = null) { $builder->select('Complete', 'Basic setup is now complete! Configure advanced settings or setup imgix.') ->group('wizard.cloud-storage.providers.do.success', 'select-buttons') ->option('configure-imgix', 'Set Up imgix', null, null, 'imgix') - ->option('advanced-settings', 'Advanced Settings', null, null, null, null, 'admin:admin.php?page=media-cloud-settings&tab=storage') + ->option('advanced-settings', 'Finish & Exit Wizard', null, null, null, null, 'admin:admin.php?page=media-cloud-settings&tab=storage') ->endGroup() ->endStep(); diff --git a/classes/Tools/Storage/Driver/S3/DreamHostStorage.php b/classes/Tools/Storage/Driver/S3/DreamHostStorage.php index acd0153e..a7bd757b 100755 --- a/classes/Tools/Storage/Driver/S3/DreamHostStorage.php +++ b/classes/Tools/Storage/Driver/S3/DreamHostStorage.php @@ -108,7 +108,7 @@ public static function configureWizard($builder = null) { $builder->select('Complete', 'Basic setup is now complete! Configure advanced settings or setup imgix.') ->group('wizard.cloud-storage.providers.dreamhost.success', 'select-buttons') ->option('configure-imgix', 'Set Up imgix', null, null, 'imgix') - ->option('advanced-settings', 'Advanced Settings', null, null, null, null, 'admin:admin.php?page=media-cloud-settings&tab=storage') + ->option('advanced-settings', 'Finish & Exit Wizard', null, null, null, null, 'admin:admin.php?page=media-cloud-settings&tab=storage') ->endGroup() ->endStep(); diff --git a/classes/Tools/Storage/Driver/S3/MinioStorage.php b/classes/Tools/Storage/Driver/S3/MinioStorage.php index 7bfa5bdc..f2a2551a 100755 --- a/classes/Tools/Storage/Driver/S3/MinioStorage.php +++ b/classes/Tools/Storage/Driver/S3/MinioStorage.php @@ -153,7 +153,7 @@ public static function configureWizard($builder = null) { $builder->select('Complete', 'Basic setup is now complete! Configure advanced settings or setup imgix.') ->group('wizard.cloud-storage.providers.minio.success', 'select-buttons') ->option('configure-imgix', 'Set Up imgix', null, null, 'imgix') - ->option('advanced-settings', 'Advanced Settings', null, null, null, null, 'admin:admin.php?page=media-cloud-settings&tab=storage') + ->option('advanced-settings', 'Finish & Exit Wizard', null, null, null, null, 'admin:admin.php?page=media-cloud-settings&tab=storage') ->endGroup() ->endStep(); diff --git a/classes/Tools/Storage/Driver/S3/OtherS3Storage.php b/classes/Tools/Storage/Driver/S3/OtherS3Storage.php index e1421966..fd09a6f4 100755 --- a/classes/Tools/Storage/Driver/S3/OtherS3Storage.php +++ b/classes/Tools/Storage/Driver/S3/OtherS3Storage.php @@ -181,7 +181,7 @@ public static function configureWizard($builder = null) { $builder->select('Complete', 'Basic setup is now complete! Configure advanced settings or setup imgix.') ->group('wizard.cloud-storage.providers.other-s3.success', 'select-buttons') ->option('configure-imgix', 'Set Up imgix', null, null, 'imgix') - ->option('advanced-settings', 'Advanced Settings', null, null, null, null, 'admin:admin.php?page=media-cloud-settings&tab=storage') + ->option('advanced-settings', 'Finish & Exit Wizard', null, null, null, null, 'admin:admin.php?page=media-cloud-settings&tab=storage') ->endGroup() ->endStep(); diff --git a/classes/Tools/Storage/Driver/S3/S3Storage.php b/classes/Tools/Storage/Driver/S3/S3Storage.php index d01a20ef..dddf9069 100755 --- a/classes/Tools/Storage/Driver/S3/S3Storage.php +++ b/classes/Tools/Storage/Driver/S3/S3Storage.php @@ -708,11 +708,12 @@ public function info($key) { return $fileInfo; } - public function dir($path = '', $delimiter = '/') { + public function dir($path = '', $delimiter = '/', $limit = -1, $next = null) { if(!$this->client) { throw new InvalidStorageSettingsException('Storage settings are invalid'); } + $foundDirs = []; $contents = []; try { $args = [ @@ -724,33 +725,61 @@ public function dir($path = '', $delimiter = '/') { $args['Delimiter'] = $delimiter; } - $results = $this->client->getPaginator('ListObjects', $args); + if ($limit !== -1) { + $args['MaxKeys'] = $limit; + } + + if (!empty($next)) { + $args['ContinuationToken'] = $next; + } + + $results = $this->client->getPaginator('ListObjectsV2', $args); - foreach($results as $result) { - if (!empty($result['CommonPrefixes'])) { - foreach($result['CommonPrefixes'] as $prefix) { - $contents[] = new StorageFile('DIR', $prefix['Prefix']); + $result = $results->current(); + if (empty($result)) { + return [ + 'next' => null, + 'files' => [] + ]; + } + + if (!empty($result['CommonPrefixes'])) { + foreach($result['CommonPrefixes'] as $prefix) { + $decodedPrefix = urldecode($prefix['Prefix']); + if (in_array($decodedPrefix, $foundDirs)) { + continue; } - } - if (!empty($result['Contents'])) { - foreach($result['Contents'] as $object) { - if ($object['Key'] == $path) { - continue; - } + $foundDirs[] = $decodedPrefix; + $contents[] = new StorageFile('DIR', $decodedPrefix); + } + } - $contents[] = new StorageFile('FILE', $object['Key'], null, $object['LastModified'], intval($object['Size']), $this->presignedUrl($object['Key'])); + if (!empty($result['Contents'])) { + foreach($result['Contents'] as $object) { + if ($object['Key'] == $path) { + continue; } + + $contents[] = new StorageFile('FILE', $object['Key'], null, $object['LastModified'], intval($object['Size']), $this->presignedUrl($object['Key'])); } } - } catch(AwsException $ex) { + return [ + 'next' => isset($result['NextContinuationToken']) ? $result['NextContinuationToken'] : null, + 'files' => $contents + ]; + } catch(AwsException $ex) { + Logger::error("Error listing objects for $path: ".$ex->getMessage(), [], __METHOD__, __LINE__); } - return $contents; + return [ + 'next' => null, + 'files' => [] + ]; } - public function ls($path = '', $delimiter = '/') { + public function ls($path = '', $delimiter = '/', $limit = -1, $next = null) { if(!$this->client) { throw new InvalidStorageSettingsException('Storage settings are invalid'); } @@ -766,24 +795,44 @@ public function ls($path = '', $delimiter = '/') { $args['Delimiter'] = $delimiter; } - $results = $this->client->getPaginator('ListObjects', $args); + if ($limit !== -1) { + $args['MaxKeys'] = $limit; + } - foreach($results as $result) { - if (!empty($result['Contents'])) { - foreach($result['Contents'] as $object) { - if ($object['Key'] == $path) { - continue; - } + if (!empty($next)) { + $args['ContinuationToken'] = $next; + } - $contents[] = $object['Key']; - } + $results = $this->client->getPaginator('ListObjectsV2', $args); + + $result = $results->current(); + if (empty($result) || empty($result['Contents'])) { + return [ + 'next' => null, + 'files' => [] + ]; + } + + foreach($result['Contents'] as $object) { + if ($object['Key'] == $path) { + continue; } + + $contents[] = $object['Key']; } - } catch(AwsException $ex) { + return [ + 'next' => isset($result['NextContinuationToken']) ? $result['NextContinuationToken'] : null, + 'files' => $contents + ]; + } catch(AwsException $ex) { + Logger::error("Error listing objects for $path: ".$ex->getMessage(), [], __METHOD__, __LINE__); } - return $contents; + return [ + 'next' => null, + 'files' => [] + ]; } //endregion @@ -807,7 +856,9 @@ protected function presignedRequest($key, $expiration = 0) { } public function presignedUrl($key, $expiration = 0) { - if ((StorageToolSettings::driver() === 's3') && ($this->settings->validSignedCDNSettings())) { + $ignoreCDN = apply_filters('media-cloud/storage/ignore-cdn', false); + + if ((StorageToolSettings::driver() === 's3') && ($this->settings->validSignedCDNSettings()) && empty($ignoreCDN)) { if (empty($expiration)) { $expiration = $this->settings->presignedURLExpiration; } @@ -947,7 +998,7 @@ public static function configureWizard($builder = null) { $builder->select('Complete', 'Basic setup is now complete! Configure advanced settings or setup imgix.') ->group('wizard.cloud-storage.providers.s3.success', 'select-buttons') ->option('configure-imgix', 'Set Up imgix', null, null, 'imgix') - ->option('advanced-settings', 'Advanced Settings', null, null, null, null, 'admin:admin.php?page=media-cloud-settings&tab=storage') + ->option('advanced-settings', 'Finish & Exit Wizard', null, null, null, null, 'admin:admin.php?page=media-cloud-settings&tab=storage') ->endGroup() ->endStep(); diff --git a/classes/Tools/Storage/Driver/S3/WasabiStorage.php b/classes/Tools/Storage/Driver/S3/WasabiStorage.php index f26445f0..e4401ae1 100755 --- a/classes/Tools/Storage/Driver/S3/WasabiStorage.php +++ b/classes/Tools/Storage/Driver/S3/WasabiStorage.php @@ -205,7 +205,7 @@ public static function configureWizard($builder = null) { $builder->select('Complete', 'Basic setup is now complete! Configure advanced settings or setup imgix.') ->group('wizard.cloud-storage.providers.wasabi.success', 'select-buttons') ->option('configure-imgix', 'Set Up imgix', null, null, 'imgix') - ->option('advanced-settings', 'Advanced Settings', null, null, null, null, 'admin:admin.php?page=media-cloud-settings&tab=storage') + ->option('advanced-settings', 'Finish & Exit Wizard', null, null, null, null, 'admin:admin.php?page=media-cloud-settings&tab=storage') ->endGroup() ->endStep(); diff --git a/classes/Tools/Storage/StorageContentHooks.php b/classes/Tools/Storage/StorageContentHooks.php new file mode 100755 index 00000000..d7f18cf9 --- /dev/null +++ b/classes/Tools/Storage/StorageContentHooks.php @@ -0,0 +1,1145 @@ +tool = $tool; + $this->settings = StorageToolSettings::instance(); + $this->debugSettings = DebuggingToolSettings::instance(); + + if ($this->settings->filterContent) { + // gutenberg filters + add_filter('render_block', [$this, 'filterBlocks'], PHP_INT_MAX - 1, 2); + add_filter('the_content', [$this, 'fixGutenbergFigures'], PHP_INT_MAX - 2, 1); + add_filter('the_content', [$this, 'filterGutenbergContent'], PHP_INT_MAX - 1, 1); + + // content filters + add_filter('content_save_pre', [$this, 'filterContent'], PHP_INT_MAX - 1, 1); + add_filter('excerpt_save_pre', [$this, 'filterContent'], PHP_INT_MAX - 1, 1); + add_filter('the_excerpt', [$this, 'filterContent'], PHP_INT_MAX - 1, 1); + add_filter('rss_enclosure', [$this, 'filterContent'], PHP_INT_MAX - 1, 1); + add_filter('the_content', [$this, 'filterContent'], PHP_INT_MAX - 1, 1); + add_filter('the_editor_content', [$this, 'filterContent'], PHP_INT_MAX - 1, 2); + add_filter('wp_video_shortcode', [$this, 'filterVideoShortcode'], PHP_INT_MAX, 5); + add_filter('wp_audio_shortcode', [$this, 'filterAudioShortcode'], PHP_INT_MAX, 5); + } + + // srcset + add_filter('wp_calculate_image_srcset', [$this, 'calculateSrcSet'], 10000, 5); + + // misc + add_filter('image_size_names_choose', function($sizes) { + if ($this->allSizes == null) { + $this->allSizes = ilab_get_image_sizes(); + } + + foreach($this->allSizes as $sizeKey => $size) { + if (!isset($sizes[$sizeKey])) { + $sizes[$sizeKey] = ucwords(preg_replace("/[-_]/", " ", $sizeKey)); + } + } + + return $sizes; + }); + + global $wp_version; + $this->disableSrcSet = Environment::Option('mcloud-storage-disable-srcset', null, false); + $this->replaceSrcSet = empty($this->disableSrcSet) && version_compare($wp_version, '5.3', '>='); + if ($this->replaceSrcSet) { + $this->replaceSrcSet = Environment::Option('mcloud-storage-replace-srcset', null, true); + } + } + + //region Gutenberg Filtering + + private function processFileBlock($id, $block_content) { + if(preg_match_all('/]*)>/m', $block_content, $anchors, PREG_SET_ORDER)) { + foreach($anchors as $anchor) { + if(preg_match('/class\s*=\s*"([^"]*)\"/', $anchor[0], $class)) { + $newAnchor = str_replace($class[1], "{$class[1]} mcloud-attachment-{$id}", $anchor[0]); + } else { + $newAnchor = str_replace(">", " class=\"mcloud-attachment-{$id}\">", $anchor[0]); + } + + $block_content = str_replace($anchor[0], $newAnchor, $block_content); + } + } + + return $block_content; + } + + private function processAudioBlock($id, $block_content) { + if(preg_match_all('/]*)>/m', $block_content, $audioTags, PREG_SET_ORDER)) { + foreach($audioTags as $audioTag) { + if(preg_match('/class\s*=\s*"([^"]*)\"/', $audioTag[0], $class)) { + $newAudioTag = str_replace($class[1], "{$class[1]} mcloud-attachment-{$id}", $audioTag[0]); + } else { + $newAudioTag = str_replace(">", " class=\"mcloud-attachment-{$id}\">", $audioTag[0]); + } + + if (preg_match('/src\s*=\s*"(.*)\"/', $audioTag[0], $source)) { + $newUrl = wp_get_attachment_url($id); + $newAudioTag = str_replace($source[1], $newUrl, $newAudioTag); + } + + + $block_content = str_replace($audioTag[0], $newAudioTag, $block_content); + } + } + + return $block_content; + } + + private function processVideoBlock($id, $block_content) { + if(preg_match_all('/]*)>/m', $block_content, $videoTags, PREG_SET_ORDER)) { + foreach($videoTags as $videoTag) { + if(preg_match('/class\s*=\s*"([^"]*)\"/', $videoTag[0], $class)) { + $newVideoTag = str_replace($class[1], "{$class[1]} mcloud-attachment-{$id}", $videoTag[0]); + } else { + $newVideoTag = str_replace(">", " class=\"mcloud-attachment-{$id}\">", $videoTag[0]); + } + + if (preg_match('/src\s*=\s*"(.*)\"/', $videoTag[0], $source)) { + $newUrl = wp_get_attachment_url($id); + $newVideoTag = str_replace($source[1], $newUrl, $newVideoTag); + } + + + $block_content = str_replace($videoTag[0], $newVideoTag, $block_content); + } + } + + return $block_content; + } + + private function processCoverBlock($id, $block_content) { + if(preg_match_all('/class\s*=\s*"([^"]*)/m', $block_content, $classes, PREG_SET_ORDER)) { + foreach($classes as $class) { + if (strpos($class[1], 'inner_container') !== false) { + continue; + } + + if (strpos($class[1], 'wp-block-cover') === false) { + continue; + } + + $block_content = str_replace($class[1], "{$class[1]} mcloud-attachment-{$id}", $block_content); + } + } + + return $block_content; + } + + private function processGallery($linkType, $block_content) { + if (preg_match_all('/]+)>/m', $block_content, $anchors)) { + foreach($anchors[0] as $anchor) { + if (strpos('class=', $anchor) === false) { + $newAnchor = str_replace('processFileBlock($id, $block_content); + } else if ($block['blockName'] === 'core/audio') { + $block_content = $this->processAudioBlock($id, $block_content); + } else if ($block['blockName'] === 'core/video') { + $block_content = $this->processVideoBlock($id, $block_content); + } else if ($block['blockName'] === 'core/cover') { + $block_content = $this->processCoverBlock($id, $block_content); + } + } else { + if ($block['blockName'] === 'core/gallery') { + $linkTo = arrayPath($block, 'attrs/linkTo'); + if (!empty($linkTo)) { + $block_content = $this->processGallery($linkTo, $block_content); + } + } + } + } + + return $block_content; + } + + /** + * Fixes Gutenberg's image block, why put the size on the f*cking
and not the ? + * + * @param $content + * + * @return mixed + */ + public function fixGutenbergFigures($content) { + if (!apply_filters('media-cloud/storage/fix-gutenberg-image-blocks', true)) { + return $content; + } + + if (preg_match_all('/())/m', $content, $figures)) { + Logger::info("Found ".count($figures[0])." gutenberg figures."); + + foreach($figures[0] as $figureMatch) { + if (preg_match('/]+)>/m', $figureMatch, $imageTagMatch)) { + if (preg_match('/\s+src=[\'"]([^\'"]+)[\'"]+/', $imageTagMatch[0], $srcs)) { + $newUrl = wp_get_attachment_image_src($imageId, $size); + if (!empty($newUrl)) { + $newImage = str_replace($srcs[0], " src=\"{$newUrl[0]}\"", $imageTagMatch[0]); + $newFigure = str_replace($imageTagMatch[0], $newImage, $figureMatch); + $newFigure = str_replace("wp-image-{$imageId}", "wp-image-{$imageId}", $newFigure); + $content = str_replace($figureMatch, $newFigure, $content); + + Logger::info("Replaced URL for gutenberg figure using post id $imageId and size $size", [], __METHOD__, __LINE__); + $this->addToReport($imageId, 'Gutenberg Figure', $srcs[0], $newUrl[0]); + } else { + Logger::info("Replacement URL for gutenberg figure using post id $imageId and size $size was null", [], __METHOD__, __LINE__); + $this->addToReport($imageId, 'Gutenberg Figure', $srcs[0], null, 'Attachment image src is null'); + } + } else { + Logger::info("Image tag missing src attribute: {$imageTagMatch[0]}", [], __METHOD__, __LINE__); + } + } else { + Logger::info("Figure missing img tag: $figureMatch", [], __METHOD__, __LINE__); + } + } else { + Logger::info("Figure missing wp-image class: $figureMatch", [], __METHOD__, __LINE__); + } + } else { + Logger::info("Figure missing wp-block-image or size class: $figureMatch", [], __METHOD__, __LINE__); + } + } + } + + return $content; + } + + /** + * Filter the content for the blocks we've already processed + * @param $content + * + * @return mixed + */ + public function filterGutenbergContent($content) { + if (!apply_filters('media-cloud/storage/can-filter-content', true)) { + return $content; + } + + //Filter Anchors + if (preg_match_all( '/]+>/m', $content, $anchors) ) { + foreach($anchors[0] as $anchor) { + if (preg_match('/mcloud-attachment-([0-9]+)/', $anchor, $attachmentId)) { + $id = $attachmentId[1]; + if (preg_match('/href\s*=\s*"([^"]+)"/', $anchor, $hrefs)) { + $newUrl = wp_get_attachment_url($id); + if ($newUrl !== $hrefs[1]) { + $content = str_replace($hrefs[1], $newUrl, $content); + $this->addToReport($id, 'Gutenberg Image Anchor', $hrefs[1], $newUrl); + } else { + $this->addToReport($id, 'Gutenberg Image Anchor', $hrefs[1], $newUrl, 'Anchor URL is the same.'); + } + } + } + } + } + + //Filter Audio or Video Tags + if (preg_match_all( '/<(?:audio|video)\s+[^>]+>/m', $content, $audioTags) ) { + foreach($audioTags[0] as $audioTag) { + if (preg_match('/mcloud-attachment-([0-9]+)/', $audioTag, $attachmentId)) { + $id = $attachmentId[1]; + if (preg_match('/src\s*=\s*"([^"]+)"/', $audioTag, $srcs)) { + $newUrl = wp_get_attachment_url($id); + if ($newUrl !== $srcs[1]) { + $content = str_replace($srcs[1], $newUrl, $content); + $this->addToReport($id, 'Gutenberg Audio|Video', $srcs[1], $newUrl); + } else { + $this->addToReport($id, 'Gutenberg Audio|Video', $srcs[1], $newUrl, 'URL is the same.'); + } + } + } + } + } + + // Filter Cover Images + if (preg_match_all('/]+)wp-block-cover(?:[^>]+)>/m', $content, $coverImages)) { + foreach($coverImages[0] as $coverImage) { + if (strpos($coverImage, 'background-image') === false) { + continue; + } + + if (preg_match('/mcloud-attachment-([0-9]+)/', $coverImage, $attachmentId)) { + $id = $attachmentId[1]; + if (preg_match('/background-image:url\(([^)]+)\)/', $coverImage, $backgroundUrl)) { + $newUrl = wp_get_attachment_url($id); + if ($backgroundUrl[1] === $newUrl) { + $this->addToReport($id, 'Gutenberg Cover Image', $backgroundUrl[1], $newUrl, 'URL is the same.'); + + continue; + } + + $newCoverImage = str_replace($backgroundUrl[1], $newUrl, $coverImage); + $content = str_replace($coverImage, $newCoverImage, $content); + + $this->addToReport($id, 'Gutenberg Cover Image', $backgroundUrl[1], $newUrl); + } + } + } + } + + //Fix Galleries + $galleryAnchors = []; + $galleryImages = []; + preg_match_all('/]*)blocks-gallery-item(?:[^>]+)>\s*]*)>\s*(]+>)\s*<\/figure>\s*<\/li>/m', $content, $galleryElements); + if ((count($galleryElements) === 2) && !empty($galleryElements[1])) { + $galleryImages = $galleryElements[1]; + } else { + preg_match_all('/]*)blocks-gallery-item(?:[^>]+)>\s*]*)>\s*(]+>)\s*(]+>)\s*<\/a>\s*<\/figure>\s*<\/li>/m', $content, $galleryElements, PREG_SET_ORDER); + if (!empty($galleryElements)) { + foreach($galleryElements as $galleryElement) { + $galleryAnchors[] = $galleryElement[1]; + $galleryImages[] = $galleryElement[2]; + } + } + } + + if (!empty($galleryImages) || !empty($galleryAnchors)) { + $attachmentIds = []; + + foreach($galleryImages as $galleryImage) { + if (preg_match('/data-id\s*=\s*[\'"]+([0-9]+)/', $galleryImage, $attachmentId)) { + $id = $attachmentId[1]; + $attachmentIds[] = $id; + + if (preg_match('/data-full-url\s*=\s*["\']([^\'"]+)/m', $galleryImage, $fullUrl)) { + $newUrl = wp_get_attachment_image_src($id, 'full'); + if (!empty($newUrl) && ($fullUrl[1] !== $newUrl[0])) { + $newGalleryImage = str_replace($fullUrl[0], "data-full-url=\"{$newUrl[0]}\"", $galleryImage); + + $newUrl = null; + + if (preg_match('/\s+src\s*=\s*["\']([^\'"]+)/m', $newGalleryImage, $srcs)) { + if (preg_match('/wpsize\s*=\s*([^\s&]+)/m', $srcs[0], $sizeMatches)) { + $size = $sizeMatches[1]; + $newUrl = wp_get_attachment_image_src($id, $size); + } else if (preg_match('/([0-9]+)x([0-9]+)\.(?:jpeg|jpg|png|webp|gif)/m', $srcs[0], $sizeMatches)) { + $width = intval($sizeMatches[1]); + $height = intval($sizeMatches[2]); + + if (!has_image_size("_gutenberg_{$width}_{$height}_cropped")) { + add_image_size("_gutenberg_{$width}_{$height}_cropped", $width, $height, true); + } + + if (!has_image_size("_gutenberg_{$width}_{$height}_fit")) { + add_image_size("_gutenberg_{$width}_{$height}_fit", $width, $height, false); + } + + $sizer = ilab_find_nearest_size($id, $width, $height); + if (empty($sizer)) { + $sized = image_get_intermediate_size($id, [$width, $height]); + if (!empty($sized)) { + $newUrl = [$sized['url']]; + } + } else { + $newUrl = wp_get_attachment_image_src($id, $sizer); + } + } + + if (empty($newUrl)) { + $newUrl = wp_get_attachment_image_src($id, 'large'); + } + + if (!empty($newUrl) && (str_replace("&", "&", $srcs[1]) !== $newUrl[0])) { + $newGalleryImage = str_replace($srcs[0], " src=\"{$newUrl[0]}\"", $newGalleryImage); + $newGalleryImage = str_replace('class="', "class=\"mcloud-attachment-{$id} ", $newGalleryImage); + $content = str_replace($galleryImage, $newGalleryImage, $content); + + $this->addToReport($id, 'Gutenberg Gallery Image', $srcs[1], $newUrl[0]); + } else if (!empty($newUrl)) { + $this->addToReport($id, 'Gutenberg Gallery Image', $srcs[1], $newUrl[0], "Gallery image URL is the same."); + } else { + $this->addToReport($id, 'Gutenberg Gallery Image', $srcs[1], null, "New URL is empty."); + } + } + } + } + } + } + + $anchorIndex = 0; + foreach($galleryAnchors as $galleryAnchor) { + if (strpos($galleryAnchor, 'attachment-link') !== false) { + $anchorIndex++; + continue; + } + + if (strpos($galleryAnchor, 'media-link') !== false) { + if (preg_match('/\s+href\s*=\s*["\']([^\'"]+)/m', $galleryAnchor, $srcs)) { + if ($anchorIndex < count($attachmentIds)) { + $id = $attachmentIds[$anchorIndex]; + + $newUrl = wp_get_attachment_image_src($id, 'full'); + if (!empty($newUrl) && ($srcs[1] !== $newUrl[0])) { + $newGalleryAnchor = str_replace($srcs[0], " href=\"{$newUrl[0]}\"", $galleryAnchor); + $content = str_replace($galleryAnchor, $newGalleryAnchor, $content); + } + } + } + } + + $anchorIndex++; + } + } + + + return $content; + } + + //endregion + + //region Reporter + + /** + * @return TaskReporter|null + */ + private function getReporter(): ?TaskReporter { + if (empty($this->debugSettings->debugContentFiltering)) { + return null; + } + + $reportId = sanitize_title($_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']); + if (!isset($this->reporters[$reportId])) { + $reporter = new TaskReporter($reportId, [ + 'Post ID', 'Type', 'Found URL', 'Mapped URL', 'Notes' + ], true); + $reporter->open(); + + $this->reporters[$reportId] = $reporter; + } else { + $reporter = $this->reporters[$reportId]; + } + + return $reporter; + } + + private function addToReport($postId = null, $type = null, $oldUrl = null, $newUrl = null, $notes = null) { + if (empty($this->debugSettings->debugContentFiltering)) { + return; + } + + $reporter = $this->getReporter(); + if (!empty($reporter)) { + $reporter->add([$postId, $type, $oldUrl, $newUrl, $notes]); + } + } + + //endregion + + //region Content Filtering + + /** + * Filter the content to replace CDN + * + * @param $content + * @param string $context + * + * @return mixed + * @throws StorageException + */ + public function filterContent($content, $context = 'post') { + $startTime = microtime(true); + + if (!apply_filters('media-cloud/storage/can-filter-content', true)) { + return $content; + } + + $originalContent = $content; + + if ($context !== 'post') { + $content = str_replace('<', '<', $content); + $content = str_replace('>', '>', $content); + } + +// if (defined('MEDIACLOUD_DEV_MODE')) { +// $content = preg_replace('/wp-image-[0-9]+/', '', $content); +// } + + if (!preg_match_all( '/]+>/', $content, $matches ) ) { + Logger::info("No image tags found", [], __METHOD__, __LINE__); + return $originalContent; + } else { + Logger::info("Found ".count($matches[0])." image tags.", [], __METHOD__, __LINE__); + } + + $uploadDir = wp_get_upload_dir(); + + $replacements = []; + $resizedReplacements = []; + $replacedIds = []; + + $srcRegex = "#src=['\"]+([^'\"]+)['\"]+#m"; + foreach($matches[0] as $image) { + $imageFound = false; + + if (!preg_match($srcRegex, $image, $srcMatches) || (strpos($image, 'mcloud-attachment-') !== false)) { + Logger::info("Image tag has no src attribute or is missing mcloud-attachment class: ".$image, [], __METHOD__, __LINE__); + continue; + } + + $src = $srcMatches[1]; + + // parse img tags with classes because these usually indicate the wordpress size + if (preg_match('/class\s*=\s*(?:[\"\']{1})([^\"\']+)(?:[\"\']{1})/m', $image, $matches)) { + $classes = explode(' ', $matches[1]); + + $size = null; + $id = null; + + foreach($classes as $class) { + if (strpos($class, 'wp-image-') === 0) { + $parts = explode('-', $class); + $id = array_pop($parts); + } else if (strpos($class, 'size-') === 0) { + $size = str_replace('size-', '', $class); + } + } + + if (!empty($id) && empty($size)) { + Logger::info("Found ID '$id' but no size for image tag: ".$image, [], __METHOD__, __LINE__); + + if (preg_match('/sizes=[\'"]+\(max-(width|height)\:\s*([0-9]+)px/m', $image, $sizeMatches)) { + $which = $sizeMatches[1]; + $px = $sizeMatches[2]; + + $meta = wp_get_attachment_metadata($id); + if (!empty($meta['sizes'])) { + foreach($meta['sizes'] as $sizeKey => $sizeData) { + if ($sizeData[$which] == $px) { + $size = $sizeKey; + break; + } + } + } + } + + if (empty($size)) { + if (preg_match('/wpsize=([aA-zZ0-9-_]*)/m', $src, $wpSizeMatches)) { + $size = $wpSizeMatches[1]; + } else { + if (preg_match('/(([0-9]+)x([0-9]+)\.(?:jpg|jpeg|gif|png))/', $src, $dimensionMatches)) { + $width = $dimensionMatches[2]; + $height = $dimensionMatches[3]; + $size = ilab_find_nearest_size($id, $width, $height); + + if (empty($size)) { + $size = 'full'; + Logger::info("Could not find size for image tag, using full: ".$image, [], __METHOD__, __LINE__); + } + } else { + $size = 'full'; + Logger::info("Could not find size for image tag, using full: ".$image, [], __METHOD__, __LINE__); + } + } + } + } else if (!empty($id) && !empty($size)) { + Logger::info("Found post id {$id} and size {$size} for image tag: ".$image, [], __METHOD__, __LINE__); + } + + if (!empty($id) && is_numeric($id)) { + $imageFound = true; + $replacedIds[$id] = true; + $replacements["$id,$size"] = [ + 'image' => $image, + 'src' => $src, + 'size' => $size + ]; + } + } else { + Logger::info("Image tag has no class attribute: ".$image, [], __METHOD__, __LINE__); + } + + if (!$imageFound && !empty($this->settings->replaceAllImageUrls)) { + $escapedBase = str_replace('/', '\/', $uploadDir['baseurl']); + $escapedBase = str_replace('.', '\.', $escapedBase); + $imageRegex = "#(data-src|src)\s*=\s*[\'\"]+({$escapedBase}[^\'\"]*(jpg|png|gif))[\'\"]+#"; + if (preg_match($imageRegex, $image, $matches)) { + $matchedUrl = $matches[2]; + + $textSize = null; + $cleanedUrl = null; + $size = 'full'; + + if (preg_match('/(-[0-9x]+)\.(?:jpg|gif|png)/m', $matchedUrl, $sizeMatches)) { + $cleanedUrl = str_replace($sizeMatches[1], '', $matchedUrl); + $id = attachment_url_to_postid($cleanedUrl); + $textSize = trim($sizeMatches[1], '-'); + $size = explode('x', $textSize); + } else { + $id = attachment_url_to_postid($matchedUrl); + } + + + if (!empty($id)) { + Logger::info("Found post id {$id} for image tag using brute force attachment_url_to_postid(): ".$image, [], __METHOD__, __LINE__); + + $replacedIds[$id] = true; + if (!empty($textSize)) { + $resizedReplacements[$id.'-'.$textSize] = [ + 'id' => $id, + 'image' => $image, + 'src' => $matchedUrl, + 'size' => $size + ]; + } else { + $replacements["$id,$size"] = [ + 'image' => $image, + 'src' => $matchedUrl, + 'size' => $size + ]; + } + } else { + Logger::info("Unable to map URL to post ID using attachment_url_to_postid(): ".$image, [], __METHOD__, __LINE__); + $this->addToReport(null, 'Image', $matchedUrl, null, 'Unable to map URL to post ID.'); + } + } else { + Logger::info("Unable to map URL to post ID, no regex match $imageRegex: ".$image, [], __METHOD__, __LINE__); + } + } else if (!$imageFound) { + Logger::info("Unable to map URL to post ID: ".$image, [], __METHOD__, __LINE__); + $this->addToReport(null, 'Image', $src, null, 'Unable to map URL to post ID.'); + } + } + + foreach($replacements as $idSize => $data) { + $idSizeParts = explode(',', $idSize); + $content = $this->replaceImageInContent($idSizeParts[0], $data, $content); + } + + foreach($resizedReplacements as $id => $data) { + $content = $this->replaceImageInContent($data['id'], $data, $content); + } + + if ($this->settings->replaceAnchorHrefs) { + if (count($replacedIds) > 0) { + $replacementHrefs = []; + + add_filter('media-cloud/storage/override-url', '__return_false'); + add_filter('media-cloud/dynamic-images/skip-url-generation', '__return_true'); + foreach($replacedIds as $id => $cool) { + $src = wp_get_attachment_image_src($id, 'full'); + + if(empty($src)) { + continue; + } + + $replacementHrefs[$id] = ['original' => $src[0]]; + } + remove_filter('media-cloud/dynamic-images/skip-url-generation', '__return_true'); + remove_filter('media-cloud/storage/override-url', '__return_false'); + + foreach($replacedIds as $id => $cool) { + $src = wp_get_attachment_image_src($id, 'full'); + + if(empty($src) || !isset($replacementHrefs[$id])) { + continue; + } + + $replacementHrefs[$id]['replacement'] = $src[0]; + } + + foreach($replacementHrefs as $id => $replacement) { + $og = str_replace('/', '\/', $replacement['original']); + $og = str_replace('.','\.', $og); + $re = '/href\s*=\s*(?:\'|")\s*'.$og.'\s*(?:\'|")/m'; + $content = preg_replace($re, "href=\"{$replacement['replacement']}\"", $content); + } + } + } + + if ($context !== 'post') { + $content = str_replace('<', '<', $content); + $content = str_replace('>', '>', $content); + } + + Logger::info("Took ".(sprintf('%.4f',microtime(true) - $startTime))." seconds.", [], __METHOD__, __LINE__); + + return $content; + } + + + /** + * @param $url + * @param string $type + * + * @return int|null + */ + private function getShortCodeSource($url, $type='Video'): ?int { + $uploadDir = wp_get_upload_dir(); + $baseFile = ltrim(str_replace($uploadDir['baseurl'], '', $url), '/'); + + if (empty($baseFile)) { + $this->addToReport(null, $type, $url, null, 'Base file is empty.'); + + return null; + } + + global $wpdb; + $query = $wpdb->prepare("select post_id from {$wpdb->postmeta} where meta_key='_wp_attached_file' and meta_value = %s", $baseFile); + $postId = $wpdb->get_var($query); + if (empty($postId)) { + $this->addToReport(null, $type, $url, null, 'Could not map URL to post ID.'); + + return null; + } + + return $postId; + } + + /** + * @param string $output Video shortcode HTML output. + * @param array $atts Array of video shortcode attributes. + * @param string $video Video file. + * @param int $post_id Post ID. + * @param string $library Media library used for the video shortcode. + * + * @return string + * @throws StorageException + */ + public function filterVideoShortcode(string $output, array $atts, string $video, int $post_id, string $library): string { + if (isset($atts['src'])) { + $default_types = wp_get_video_extensions(); + $postId = null; + $found = false; + foreach($default_types as $type) { + if (!empty($atts[$type])) { + $url = $atts[$type]; + if (strpos($url, '?') !== false) { + $url = preg_replace('/(\?.*)/', '', $url); + } + + $postId = $this->getShortCodeSource($url); + $found = !empty($postId); + + break; + } + } + + if (!$found) { + $postId = $this->getShortCodeSource($atts['src']); + } + + if (empty($postId)) { + $this->addToReport(null, 'Video', $atts['src'], null, "Unable to map URL to post ID"); + + return $output; + } + + $post = get_post($postId); + + $meta = wp_get_attachment_metadata($post->ID); + $url = $this->tool->getAttachmentURL(null, $post->ID); + + if (!empty($url)) { + $mime = arrayPath($meta, 'mime_type', $post->post_mime_type); + + $insert = ""; + $insert .= "{$post->post_title}"; + if(preg_match('/]*)>((?s).*)<\/video>/m', $output, $matches)) { + $output = str_replace($matches[1], $insert, $output); + $this->addToReport($postId, 'Video', $atts['src'], $url); + } else { + $this->addToReport($postId, 'Video', $atts['src'], null, "Unable to find src in content html"); + } + } else { + $this->addToReport($postId, 'Video', $atts['src'], null, "Attachment URL is null."); + } + } + + return $output; + } + + /** + * @param string $output Audio shortcode HTML output. + * @param array $atts Array of audio shortcode attributes. + * @param string $audio Audio file. + * @param int $post_id Post ID. + * @param string $library Media library used for the audio shortcode. + * + * @return string + * @throws StorageException + */ + public function filterAudioShortcode(string $output, array $atts, string $audio, int $post_id, string $library): string { + if (isset($atts['src'])) { + $default_types = wp_get_audio_extensions(); + $postId = null; + $found = false; + foreach($default_types as $type) { + if (!empty($atts[$type])) { + $url = $atts[$type]; + if (strpos($url, '?') !== false) { + $url = preg_replace('/(\?.*)/', '', $url); + } + + $postId = $this->getShortCodeSource($url, 'Audio'); + $found = !empty($postId); + + break; + } + } + + if (!$found) { + $postId = $this->getShortCodeSource($atts['src'], 'Audio'); + } + + if (empty($postId)) { + $this->addToReport(null, 'Audio', $atts['src'], null, "Unable to map URL to post ID"); + + return $output; + } + + $post = get_post($postId); + + $meta = wp_get_attachment_metadata($post->ID); + $url = $this->tool->getAttachmentURL(null, $post->ID); + + if (!empty($url)) { + $mime = arrayPath($meta, 'mime_type', $post->post_mime_type); + + $insert = ""; + $insert .= "{$post->post_title}"; + if(preg_match('/]*)>((?s).*)<\/audio>/m', $output, $matches)) { + $output = str_replace($matches[1], $insert, $output); + $this->addToReport($postId, 'Audio', $atts['src'], $url); + } else { + $this->addToReport($postId, 'Audio', $atts['src'], null, "Unable to find URL in content HTML"); + } + } else { + $this->addToReport($postId, 'Audio', $atts['src'], null, "Attachment URL is empty."); + } + } + + return $output; + } + + private function generateSrcSet($id, $sizeName): string { + if ($this->allSizes === null) { + $this->allSizes = ilab_get_image_sizes(); + } + + if (!is_string($sizeName)) { + return ''; + } + + if (($sizeName !== 'full') && !isset($this->allSizes[$sizeName])) { + return ''; + } + + $meta = wp_get_attachment_metadata($id); + $w = empty($meta['width']) ? (int)0 : (int)$meta['width']; + $h = empty($meta['height']) ? (int)0 : (int)$meta['height']; + if (!isset($meta['sizes']) || empty($w) || empty($h)) { + return ''; + } + + if ($sizeName === 'full') { + $size = [ + 'width' => $w, + 'height' => $h, + 'crop' => false + ]; + } else { + $size = $this->allSizes[$sizeName]; + } + + $cropped = !empty($size['crop']); + + $sw = empty($size['width']) ? (int)0 : (int)$size['width']; + $sh = empty($size['height']) ? (int)0 : (int)$size['height']; + if ($cropped && (empty($sw) || empty($sh))) { + return ''; + } + + if ($cropped) { + $filteredSizes = array_filter($this->allSizes, function($v, $k) use ($meta, $sw, $sh) { + if (empty($v['crop'])) { + return false; + } + + $nsw = empty($v['width']) ? (int)0 : (int)$v['width']; + $nsh = empty($v['height']) ? (int)0 : (int)$v['height']; + + if (empty($nsw) || empty($nsh)) { + return false; + } + + $nratio = floor(($nsw / $nsh) * 10); + $sratio = floor(($sw / $sh) * 10); + + return ((($k === 'full') || isset($meta['sizes'][$k])) && ($nratio === $sratio) && ($nsw <= $sw)); + }, ARRAY_FILTER_USE_BOTH); + } else { + $currentSize = sizeToFitSize($w, $h, $sw, $sh); + $filteredSizes = array_filter($this->allSizes, function($v, $k) use ($meta, $currentSize, $w, $h, $sw, $sh) { + $nsw = empty($v['width']) ? (int)0 : (int)$v['width']; + $nsh = empty($v['height']) ? (int)0 : (int)$v['height']; + + if ($nsw === 0) { + $nsw = 100000; + } + + if ($nsh === 0) { + $nsh = 100000; + } + + $newSize = sizeToFitSize($w, $h, $nsw, $nsh); + + return ((($k === 'full') || isset($meta['sizes'][$k])) && empty($v['crop']) && ($newSize[0] <= $currentSize[0]) && ($newSize[1] <= $currentSize[1])); + }, ARRAY_FILTER_USE_BOTH); + } + + $sortedFilteredSizes = $filteredSizes; + uksort($sortedFilteredSizes, function($a, $b) use ($meta) { + $aw = (int)$meta['sizes'][$a]['width']; + $bw = (int)$meta['sizes'][$b]['width']; + + if ($aw === $bw) { + return 0; + } + + return ($aw < $bw) ? -1 : 1; + }); + + if ($sizeName === 'full') { + $sortedFilteredSizes['full'] = $size; + } + + if (count($sortedFilteredSizes) <= 1) { + return ''; + } + + $sources = []; + + foreach($sortedFilteredSizes as $name => $sizeInfo) { + $csize = ($name === 'full') ? $size : $meta['sizes'][$name]; + + $sw = (int)$csize['width']; + + if ($name != $sizeName) { + $sizeKey = "(max-width: {$sw}px) {$sw}px"; + } else { + $sizeKey = "100vw"; + } + + $src = wp_get_attachment_image_src($id, $name); + if (!empty($src)) { + $sources[$sizeKey] = $src[0]." {$sw}w"; + } + } + + + if (!empty($sources)) { + $sizes = "(max-width: {$sw}px) 100vw, {$sw}px"; //implode(', ', array_keys($sources)); + $srcset = implode(', ', array_values($sources)); + + return "srcset='$srcset' sizes='$sizes'"; + } + + return ''; + } + + /** + * @param $id + * @param $data + * @param $content + * + * @return string|string[] + * @throws \MediaCloud\Plugin\Tools\Storage\StorageException + */ + private function replaceImageInContent($id, $data, $content) { + $id = apply_filters('wpml_object_id', $id, 'attachment', true); + if (empty($data['size'])) { + $meta = wp_get_attachment_metadata($id); + $url = $this->tool->getAttachmentURLFromMeta($meta); + $srcSet = ''; + } else { + $url = image_downsize($id, $data['size']); + $srcSet = empty($data['image']) ? '' : $this->generateSrcSet($id, $data['size']); + } + + if ($url === false) { + $siteId = apply_filters('global_media.site_id', false); + if ($siteId != false) { + switch_to_blog($siteId); + $url = image_downsize($id, $data['size']); + restore_current_blog(); + } + } + + if (is_array($url)) { + $url = $url[0]; + } + + $url = preg_replace('/&lang=[aA-zZ0-9]+/m', '', $url); + + if (empty($url) || (($url == $data['src']) && (empty($srcSet)))) { + $this->addToReport($id, 'Image', $data['src'], null, 'Unable to map URL'); + + return $content; + } + + if (!empty($data['image']) && $this->replaceSrcSet) { + $image = $data['image']; + $image = preg_replace('/(sizes\s*=\s*[\'"]{1}(?:[^\'"]*)[\'"]{1})/m', '', $image); + $image = preg_replace('/(srcset\s*=\s*[\'"]{1}(?:[^\'"]*)[\'"]{1})/m', '', $image); + + if (!empty($srcSet)) { + $image = str_replace('addToReport($id, 'Image', $data['src'], $url); + + return str_replace($data['src'], $url, $content); + } + + //endregion + + //region Srcset + /** + * Filters an image’s ‘srcset’ sources. (https://core.trac.wordpress.org/browser/tags/4.8/src/wp-includes/media.php#L1203) + * + * @param array $sources + * @param array $size_array + * @param string $image_src + * @param array $image_meta + * @param int $attachment_id + * + * @return array + */ + public function calculateSrcSet($sources, $size_array, $image_src, $image_meta, $attachment_id) { + if (!apply_filters('media-cloud/storage/can-calculate-srcset', true)) { + return $sources; + } + + global $wp_current_filter; + if (in_array('the_content', $wp_current_filter)) { + if ($this->disableSrcSet || $this->replaceSrcSet) { + return []; + } + } + + if ($this->disableSrcSet) { + return []; + } + + $attachment_id = apply_filters('wpml_object_id', $attachment_id, 'attachment', true); + + if ($this->allSizes == null) { + $this->allSizes = ilab_get_image_sizes(); + } + + $allSizesNames = array_keys($this->allSizes); + + foreach($image_meta['sizes'] as $sizeName => $sizeData) { + $width = $sizeData['width']; + if (isset($sources[$width])) { + if (in_array($sizeName, $allSizesNames)) { + $src = wp_get_attachment_image_src($attachment_id, $sizeName); + + if(is_array($src)) { + // fix for wpml + $url = preg_replace('/&lang=[aA-zZ0-9]+/m', '', $src[0]); + $sources[$width]['url'] = $url; + } else { + unset($sources[$width]); + } + } else { + unset($sources[$width]); + } + } + } + + if(isset($image_meta['width'])) { + $width = $image_meta['width']; + if(isset($sources[$width])) { + $src = wp_get_attachment_image_src($attachment_id, 'full'); + + if(is_array($src)) { + // fix for wpml + $url = preg_replace('/&lang=[aA-zZ0-9]+/m', '', $src[0]); + $sources[$width]['url'] = $url; + } else { + unset($sources[$width]); + } + } + } + + return $sources; + } + //endregion +} \ No newline at end of file diff --git a/classes/Tools/Storage/StorageFile.php b/classes/Tools/Storage/StorageFile.php index da892561..8c545122 100755 --- a/classes/Tools/Storage/StorageFile.php +++ b/classes/Tools/Storage/StorageFile.php @@ -19,7 +19,7 @@ use MediaCloud\Vendor\Carbon\Carbon; -class StorageFile { +class StorageFile implements \JsonSerializable { /** @var string The type of file (DIR or FILE) */ protected $type; @@ -154,4 +154,15 @@ public function sizeString() { public function url() { return $this->url; } + + public function jsonSerialize() { + return [ + 'type' => strtolower($this->type), + 'key' => urldecode($this->key), + 'name' => urldecode($this->name), + 'date' => $this->dateString(), + 'size' => $this->sizeString(), + 'url' => $this->url, + ]; + } } \ No newline at end of file diff --git a/classes/Tools/Storage/StorageInterface.php b/classes/Tools/Storage/StorageInterface.php index 8e8be124..cacc2831 100755 --- a/classes/Tools/Storage/StorageInterface.php +++ b/classes/Tools/Storage/StorageInterface.php @@ -272,20 +272,24 @@ public function enqueueUploaderScripts(); /** * @param string $path * @param string $delimiter + * @param int $limit + * @param string $next * * @return StorageFile[] */ - public function dir($path = '', $delimiter = '/'); + public function dir($path = '', $delimiter = '/', $limit = -1, $next = null); /** * Similar to dir() but returns an array of keys as strings. * * @param string $path * @param string $delimiter + * @param int $limit + * @param string $next * - * @return string[] + * @return array */ - public function ls($path = '', $delimiter = '/'); + public function ls($path = '', $delimiter = '/', $limit = -1, $next = null); /** * Determines if the storage provider supports browsing diff --git a/classes/Tools/Storage/StoragePostMap.php b/classes/Tools/Storage/StoragePostMap.php index 131bb579..ef723378 100755 --- a/classes/Tools/Storage/StoragePostMap.php +++ b/classes/Tools/Storage/StoragePostMap.php @@ -13,6 +13,8 @@ namespace MediaCloud\Plugin\Tools\Storage; +use MediaCloud\Plugin\Utilities\Logging\Logger; + /** * Interface for creating the required tables */ @@ -38,17 +40,13 @@ protected static function verifyInstalled() { } $currentVersion = get_site_option(self::DB_KEY); - if (!empty($currentVersion) && version_compare(self::DB_VERSION, $currentVersion, '==')) { - global $wpdb; - - $tableName = $wpdb->base_prefix.'mcloud_post_map'; - $exists = ($wpdb->get_var("SHOW TABLES LIKE '$tableName'") == $tableName); - if ($exists) { - static::$installed = true; - return true; - } + if (!empty($currentVersion) && version_compare(self::DB_VERSION, $currentVersion, '<=')) { + static::$installed = true; + return true; } + Logger::warning("Storage map version mismatch $currentVersion => ".self::DB_VERSION." = ".version_compare(self::DB_VERSION, $currentVersion, '<=')); + return static::installMapTable(); } @@ -56,6 +54,11 @@ protected static function installMapTable() { global $wpdb; $tableName = $wpdb->base_prefix.'mcloud_post_map'; + + $suppress = $wpdb->suppress_errors(true); + $wpdb->query("drop table {$tableName}"); + $wpdb->suppress_errors($suppress); + $charset = $wpdb->get_charset_collate(); $sql = "CREATE TABLE {$tableName} ( diff --git a/classes/Tools/Storage/StorageTool.php b/classes/Tools/Storage/StorageTool.php index e3ecf88b..dff66848 100755 --- a/classes/Tools/Storage/StorageTool.php +++ b/classes/Tools/Storage/StorageTool.php @@ -13,15 +13,6 @@ namespace MediaCloud\Plugin\Tools\Storage; use MediaCloud\Plugin\Tasks\TaskReporter ; -use MediaCloud\Plugin\Tools\Debugging\DebuggingTool ; -use MediaCloud\Plugin\Tools\Debugging\DebuggingToolSettings ; -use MediaCloud\Plugin\Tools\Storage\FileInfo ; -use MediaCloud\Plugin\Tools\Storage\StorageConstants ; -use MediaCloud\Plugin\Tools\Storage\StorageException ; -use MediaCloud\Plugin\Tools\Storage\StorageInterface ; -use MediaCloud\Plugin\Tools\Storage\StoragePostMap ; -use MediaCloud\Plugin\Tools\Storage\StorageToolMigrations ; -use MediaCloud\Plugin\Tools\Storage\StorageToolSettings ; use MediaCloud\Plugin\Tasks\TaskManager ; use MediaCloud\Plugin\Tasks\TaskRunner ; use MediaCloud\Plugin\Tasks\TaskSchedule ; @@ -62,6 +53,8 @@ class StorageTool extends Tool { //region Properties/Class Variables + /** @var null|array */ + protected $allSizes = null ; /** @var StorageToolSettings */ private $settings = null ; /** @var array */ @@ -86,24 +79,17 @@ class StorageTool extends Tool private $deleteCache = array() ; /** @var callable */ private $dieHandler = null ; - /** @var null|array */ - protected $allSizes = null ; - private $disableSrcSet = false ; - private $replaceSrcSet = false ; /** @var array Already processed post IDs */ private $processed = array() ; private $generated = array() ; private $updateCallCount = 0 ; - /** @var DebuggingToolSettings */ - private $debugSettings = null ; - /** @var TaskReporter[] */ - private $reporters = array() ; + /** @var StorageContentHooks|null */ + private $contentHooks = null ; //endregion //region Constructor public function __construct( $toolName, $toolInfo, $toolManager ) { $this->settings = StorageToolSettings::instance(); - $this->debugSettings = DebuggingToolSettings::instance(); if ( !empty($toolInfo['storageDrivers']) ) { foreach ( $toolInfo['storageDrivers'] as $key => $data ) { if ( empty($data['name']) || empty($data['class']) || empty($data['config']) ) { @@ -294,6 +280,7 @@ public function setup() } } + $this->contentHooks = new StorageContentHooks( $this ); TaskManager::registerTask( CleanUploadsTask::class ); TaskManager::registerTask( DeleteUploadsTask::class ); TaskManager::registerTask( VerifyLibraryTask::class ); @@ -358,12 +345,6 @@ function ( $file, $type, $fullsize ) { $this->displayOptimizerAdminNotice(); } global $wp_version ; - $this->disableSrcSet = Environment::Option( 'mcloud-storage-disable-srcset', null, false ); - $this->replaceSrcSet = empty($this->disableSrcSet) && version_compare( $wp_version, '5.3', '>=' ); - if ( $this->replaceSrcSet ) { - $this->replaceSrcSet = Environment::Option( 'mcloud-storage-replace-srcset', null, true ); - } - global $wp_version ; // NOTE: We handle this differently for 5.3 than versions prior. Also, in the previous update // we only did this if certain post requirements were met: // (isset($_REQUEST['action']) && ($_REQUEST['action'] === 'upload-attachment') @@ -460,36 +441,6 @@ function ( $file, $type, $fullsize ) { ); add_action( 'add_attachment', [ $this, 'addAttachment' ], 1000 ); add_action( 'edit_attachment', [ $this, 'editAttachment' ] ); - add_filter( - 'the_content', - [ $this, 'fixGutenbergFigures' ], - PHP_INT_MAX - 2, - 1 - ); - add_filter( - 'the_content', - [ $this, 'filterGutenbergContent' ], - PHP_INT_MAX - 1, - 1 - ); - add_filter( - 'the_content', - [ $this, 'filterContent' ], - PHP_INT_MAX - 1, - 1 - ); - add_filter( - 'the_editor_content', - [ $this, 'filterContent' ], - PHP_INT_MAX - 1, - 2 - ); - add_filter( - 'render_block', - [ $this, 'filterBlocks' ], - PHP_INT_MAX - 1, - 2 - ); add_filter( 'media-cloud/storage/process-file-name', function ( $filename ) { @@ -511,12 +462,6 @@ function ( $filename ) { return $editors; }, PHP_INT_MAX ); } - add_filter( - 'wp_calculate_image_srcset', - [ $this, 'calculateSrcSet' ], - 10000, - 5 - ); add_filter( 'wp_prepare_attachment_for_js', [ $this, 'prepareAttachmentForJS' ], @@ -541,29 +486,6 @@ function ( $filename ) { 1000, 2 ); - add_filter( 'image_size_names_choose', function ( $sizes ) { - if ( $this->allSizes == null ) { - $this->allSizes = ilab_get_image_sizes(); - } - foreach ( $this->allSizes as $sizeKey => $size ) { - if ( !isset( $sizes[$sizeKey] ) ) { - $sizes[$sizeKey] = ucwords( preg_replace( "/[-_]/", " ", $sizeKey ) ); - } - } - return $sizes; - } ); - add_filter( - 'wp_video_shortcode', - [ $this, 'filterVideoShortcode' ], - PHP_INT_MAX, - 5 - ); - add_filter( - 'wp_audio_shortcode', - [ $this, 'filterAudioShortcode' ], - PHP_INT_MAX, - 5 - ); if ( ToolsManager::instance()->toolEnabled( 'debugging' ) ) { add_filter( @@ -1424,6 +1346,9 @@ public function imageDownsize( $fail, $id, $size ) if ( apply_filters( 'media-cloud/imgix/enabled', false ) ) { return $fail; } + if ( empty(apply_filters( 'media-cloud/storage/override-url', true )) ) { + return $fail; + } return $this->forcedImageDownsize( $fail, $id, $size ); } @@ -1437,6 +1362,9 @@ public function imageDownsize( $fail, $id, $size ) */ public function forcedImageDownsize( $fail, $id, $size ) { + if ( empty(apply_filters( 'media-cloud/storage/override-url', true )) ) { + return $fail; + } if ( empty($size) || empty($id) || is_array( $size ) ) { return $fail; } @@ -1681,90 +1609,6 @@ private function updateAttachmentS3Props( $id, $meta ) return $meta; } - /** - * Filters an image’s ‘srcset’ sources. (https://core.trac.wordpress.org/browser/tags/4.8/src/wp-includes/media.php#L1203) - * - * @param array $sources - * @param array $size_array - * @param string $image_src - * @param array $image_meta - * @param int $attachment_id - * - * @return array - */ - public function calculateSrcSet( - $sources, - $size_array, - $image_src, - $image_meta, - $attachment_id - ) - { - if ( !apply_filters( 'media-cloud/storage/can-calculate-srcset', true ) ) { - return $sources; - } - global $wp_current_filter ; - if ( in_array( 'the_content', $wp_current_filter ) ) { - if ( $this->disableSrcSet || $this->replaceSrcSet ) { - return []; - } - } - if ( $this->disableSrcSet ) { - return []; - } - $attachment_id = apply_filters( - 'wpml_object_id', - $attachment_id, - 'attachment', - true - ); - if ( $this->allSizes == null ) { - $this->allSizes = ilab_get_image_sizes(); - } - $allSizesNames = array_keys( $this->allSizes ); - foreach ( $image_meta['sizes'] as $sizeName => $sizeData ) { - $width = $sizeData['width']; - if ( isset( $sources[$width] ) ) { - - if ( in_array( $sizeName, $allSizesNames ) ) { - $src = wp_get_attachment_image_src( $attachment_id, $sizeName ); - - if ( is_array( $src ) ) { - // fix for wpml - $url = preg_replace( '/&lang=[aA-zZ0-9]+/m', '', $src[0] ); - $sources[$width]['url'] = $url; - } else { - unset( $sources[$width] ); - } - - } else { - unset( $sources[$width] ); - } - - } - } - - if ( isset( $image_meta['width'] ) ) { - $width = $image_meta['width']; - - if ( isset( $sources[$width] ) ) { - $src = wp_get_attachment_image_src( $attachment_id, 'full' ); - - if ( is_array( $src ) ) { - // fix for wpml - $url = preg_replace( '/&lang=[aA-zZ0-9]+/m', '', $src[0] ); - $sources[$width]['url'] = $url; - } else { - unset( $sources[$width] ); - } - - } - - } - - return $sources; - } - /** * Filters the attachment data prepared for JavaScript. (https://core.trac.wordpress.org/browser/tags/4.8/src/wp-includes/media.php#L3279) * @@ -1867,6 +1711,9 @@ public function getAttachmentURL( $url, $post_id ) if ( empty($this->client) ) { return $url; } + if ( empty(apply_filters( 'media-cloud/storage/override-url', true )) ) { + return $url; + } $meta = wp_get_attachment_metadata( $post_id ); $new_url = null; if ( $meta ) { @@ -1925,9 +1772,12 @@ public function getAttachmentURLFromMeta( $meta ) if ( empty($this->client) ) { return null; } + $cdn = apply_filters( 'media-cloud/storage/override-cdn', StorageToolSettings::cdn() ); + $docCdn = apply_filters( 'media-cloud/storage/override-doc-cdn', StorageToolSettings::docCdn() ); $type = typeFromMeta( $meta ); $privacy = arrayPath( $meta, 's3/privacy', 'private' ); $doSign = $this->client->usesSignedURLs( $type ) || $privacy !== 'public-read' && is_admin(); + $ignoreCDN = apply_filters( 'media-cloud/storage/ignore-cdn', false ); if ( $doSign ) { @@ -1942,9 +1792,9 @@ public function getAttachmentURLFromMeta( $meta ) return $url; } else { - if ( !empty(StorageToolSettings::cdn()) ) { - $cdnScheme = parse_url( StorageToolSettings::cdn(), PHP_URL_SCHEME ); - $cdnHost = parse_url( StorageToolSettings::cdn(), PHP_URL_HOST ); + if ( !empty($cdn) && empty($ignoreCDN) ) { + $cdnScheme = parse_url( $cdn, PHP_URL_SCHEME ); + $cdnHost = parse_url( $cdn, PHP_URL_HOST ); $urlScheme = parse_url( $url, PHP_URL_SCHEME ); $urlHost = parse_url( $url, PHP_URL_HOST ); return str_replace( "{$urlScheme}://{$urlHost}", "{$cdnScheme}://{$cdnHost}", $url ); @@ -1956,13 +1806,13 @@ public function getAttachmentURLFromMeta( $meta ) } else { - if ( StorageToolSettings::cdn() ) { - return StorageToolSettings::cdn() . '/' . $meta['s3']['key']; + if ( !empty($cdn) && empty($ignoreCDN) ) { + return $cdn . '/' . $meta['s3']['key']; } else { if ( isset( $meta['s3']['url'] ) ) { - if ( isset( $meta['file'] ) && StorageToolSettings::docCdn() ) { + if ( isset( $meta['file'] ) && !empty($docCdn) && empty($ignoreCDN) ) { $ext = strtolower( pathinfo( $meta['file'], PATHINFO_EXTENSION ) ); $image_exts = array( 'jpg', @@ -1972,7 +1822,7 @@ public function getAttachmentURLFromMeta( $meta ) 'png' ); if ( !in_array( $ext, $image_exts ) ) { - return trim( StorageToolSettings::docCdn(), '/' ) . '/' . $meta['s3']['key']; + return trim( $docCdn, '/' ) . '/' . $meta['s3']['key']; } } @@ -1988,1144 +1838,23 @@ public function getAttachmentURLFromMeta( $meta ) } try { - return $this->client->url( $meta['s3']['key'] ); - } catch ( \Exception $ex ) { - Logger::error( - "Error trying to generate url for {$meta['s3']['key']}. Message:" . $ex->getMessage(), - [], - __METHOD__, - __LINE__ - ); - return null; - } - } - - } - - /** - * @return TaskReporter|null - */ - private function getReporter() - { - if ( empty($this->debugSettings->debugContentFiltering) ) { - return null; - } - $reportId = sanitize_title( $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] ); - - if ( !isset( $this->reporters[$reportId] ) ) { - $reporter = new TaskReporter( $reportId, [ - 'Post ID', - 'Type', - 'Found URL', - 'Mapped URL', - 'Notes' - ], true ); - $reporter->open(); - $this->reporters[$reportId] = $reporter; - } else { - $reporter = $this->reporters[$reportId]; - } - - return $reporter; - } - - private function addToReport( - $postId = null, - $type = null, - $oldUrl = null, - $newUrl = null, - $notes = null - ) - { - if ( empty($this->debugSettings->debugContentFiltering) ) { - return; - } - $reporter = $this->getReporter(); - if ( !empty($reporter) ) { - $reporter->add( [ - $postId, - $type, - $oldUrl, - $newUrl, - $notes - ] ); - } - } - - /** - * Fixes Gutenberg's image block, why put the size on the f*cking
and not the ? - * - * @param $content - * - * @return mixed - */ - public function fixGutenbergFigures( $content ) - { - if ( !apply_filters( 'media-cloud/storage/fix-gutenberg-image-blocks', true ) ) { - return $content; - } - if ( preg_match_all( '/())/m', $content, $figures ) ) { - foreach ( $figures[0] as $figureMatch ) { - - if ( preg_match( '/]+)>/m', $figureMatch, $imageTagMatch ) ) { - - if ( preg_match( '/\\s+src=[\'"]([^\'"]+)[\'"]+/', $imageTagMatch[0], $srcs ) ) { - $newUrl = wp_get_attachment_image_src( $imageId, $size ); - - if ( !empty($newUrl) ) { - $newImage = str_replace( $srcs[0], " src=\"{$newUrl[0]}\"", $imageTagMatch[0] ); - $newFigure = str_replace( $imageTagMatch[0], $newImage, $figureMatch ); - $newFigure = str_replace( "wp-image-{$imageId}", "wp-image-{$imageId}", $newFigure ); - $content = str_replace( $figureMatch, $newFigure, $content ); - $this->addToReport( - $imageId, - 'Gutenberg Figure', - $srcs[0], - $newUrl[0] - ); - } else { - $this->addToReport( - $imageId, - 'Gutenberg Figure', - $srcs[0], - null, - 'Attachment image src is null' - ); - } - - } - - } - } - - } - - } - } - return $content; - } - - /** - * Filter the content for the blocks we've already processed - * @param $content - * - * @return mixed - * @throws StorageException - */ - public function filterGutenbergContent( $content ) - { - if ( !apply_filters( 'media-cloud/storage/can-filter-content', true ) ) { - return $content; - } - $replacements = []; - //Filter Anchors - if ( preg_match_all( '/]+>/m', $content, $anchors ) ) { - foreach ( $anchors[0] as $anchor ) { - - if ( preg_match( '/mcloud-attachment-([0-9]+)/', $anchor, $attachmentId ) ) { - $id = $attachmentId[1]; - - if ( preg_match( '/href\\s*=\\s*"([^"]+)"/', $anchor, $hrefs ) ) { - $newUrl = wp_get_attachment_url( $id ); - - if ( $newUrl !== $hrefs[1] ) { - $content = str_replace( $hrefs[1], $newUrl, $content ); - $this->addToReport( - $id, - 'Gutenberg Image Anchor', - $hrefs[1], - $newUrl - ); - } else { - $this->addToReport( - $id, - 'Gutenberg Image Anchor', - $hrefs[1], - $newUrl, - 'Anchor URL is the same.' - ); - } - - } - - } - - } - } - //Filter Audio or Video Tags - if ( preg_match_all( '/<(?:audio|video)\\s+[^>]+>/m', $content, $audioTags ) ) { - foreach ( $audioTags[0] as $audioTag ) { - - if ( preg_match( '/mcloud-attachment-([0-9]+)/', $audioTag, $attachmentId ) ) { - $id = $attachmentId[1]; - - if ( preg_match( '/src\\s*=\\s*"([^"]+)"/', $audioTag, $srcs ) ) { - $newUrl = wp_get_attachment_url( $id ); - - if ( $newUrl !== $srcs[1] ) { - $content = str_replace( $srcs[1], $newUrl, $content ); - $this->addToReport( - $id, - 'Gutenberg Audio|Video', - $srcs[1], - $newUrl - ); - } else { - $this->addToReport( - $id, - 'Gutenberg Audio|Video', - $srcs[1], - $newUrl, - 'URL is the same.' - ); - } - - } - - } - - } - } - // Filter Cover Images - if ( preg_match_all( '/]+)wp-block-cover(?:[^>]+)>/m', $content, $coverImages ) ) { - foreach ( $coverImages[0] as $coverImage ) { - if ( strpos( $coverImage, 'background-image' ) === false ) { - continue; - } - - if ( preg_match( '/mcloud-attachment-([0-9]+)/', $coverImage, $attachmentId ) ) { - $id = $attachmentId[1]; - - if ( preg_match( '/background-image:url\\(([^)]+)\\)/', $coverImage, $backgroundUrl ) ) { - $newUrl = wp_get_attachment_url( $id ); - - if ( $backgroundUrl[1] === $newUrl ) { - $this->addToReport( - $id, - 'Gutenberg Cover Image', - $backgroundUrl[1], - $newUrl, - 'URL is the same.' - ); - continue; - } - - $newCoverImage = str_replace( $backgroundUrl[1], $newUrl, $coverImage ); - $content = str_replace( $coverImage, $newCoverImage, $content ); - $this->addToReport( - $id, - 'Gutenberg Cover Image', - $backgroundUrl[1], - $newUrl - ); - } - - } - - } - } - //Fix Galleries - $galleryAnchors = []; - $galleryImages = []; - preg_match_all( '/]*)blocks-gallery-item(?:[^>]+)>\\s*]*)>\\s*(]+>)\\s*<\\/figure>\\s*<\\/li>/m', $content, $galleryElements ); - - if ( count( $galleryElements ) === 2 && !empty($galleryElements[1]) ) { - $galleryImages = $galleryElements[1]; - } else { - preg_match_all( - '/]*)blocks-gallery-item(?:[^>]+)>\\s*]*)>\\s*(]+>)\\s*(]+>)\\s*<\\/a>\\s*<\\/figure>\\s*<\\/li>/m', - $content, - $galleryElements, - PREG_SET_ORDER, - 0 - ); - if ( !empty($galleryElements) ) { - foreach ( $galleryElements as $galleryElement ) { - $galleryAnchors[] = $galleryElement[1]; - $galleryImages[] = $galleryElement[2]; - } - } - } - - - if ( !empty($galleryImages) || !empty($galleryAnchors) ) { - $attachmentIds = []; - foreach ( $galleryImages as $galleryImage ) { - - if ( preg_match( '/data-id\\s*=\\s*[\'"]+([0-9]+)/', $galleryImage, $attachmentId ) ) { - $id = $attachmentId[1]; - $attachmentIds[] = $id; - - if ( preg_match( '/data-full-url\\s*=\\s*["\']([^\'"]+)/m', $galleryImage, $fullUrl ) ) { - $newUrl = wp_get_attachment_image_src( $id, 'full' ); - - if ( !empty($newUrl) && $fullUrl[1] !== $newUrl[0] ) { - $newGalleryImage = str_replace( $fullUrl[0], "data-full-url=\"{$newUrl[0]}\"", $galleryImage ); - - if ( preg_match( '/\\s+src\\s*=\\s*["\']([^\'"]+)/m', $newGalleryImage, $srcs ) ) { - $newUrl = wp_get_attachment_image_src( $id, 'large' ); - - if ( !empty($newUrl) && $srcs[1] !== $newUrl[0] ) { - $newGalleryImage = str_replace( $srcs[0], " src=\"{$newUrl[0]}\"", $newGalleryImage ); - $newGalleryImage = str_replace( 'class="', "class=\"mcloud-attachment-{$id} ", $newGalleryImage ); - $content = str_replace( $galleryImage, $newGalleryImage, $content ); - $this->addToReport( - $id, - 'Gutenberg Gallery Image', - $srcs[1], - $newUrl[0] - ); - } else { - - if ( !empty($newUrl) ) { - $this->addToReport( - $id, - 'Gutenberg Gallery Image', - $srcs[1], - $newUrl[0], - "Gallery image URL is the same." - ); - } else { - $this->addToReport( - $id, - 'Gutenberg Gallery Image', - $srcs[1], - null, - "New URL is empty." - ); - } - - } - - } - - } - - } - - } - - } - $anchorIndex = 0; - foreach ( $galleryAnchors as $galleryAnchor ) { - - if ( strpos( $galleryAnchor, 'attachment-link' ) !== false ) { - $anchorIndex++; - continue; - } - - if ( strpos( $galleryAnchor, 'media-link' ) !== false ) { - if ( preg_match( '/\\s+href\\s*=\\s*["\']([^\'"]+)/m', $galleryAnchor, $srcs ) ) { - - if ( $anchorIndex < count( $attachmentIds ) ) { - $id = $attachmentIds[$anchorIndex]; - $newUrl = wp_get_attachment_image_src( $id, 'full' ); - - if ( !empty($newUrl) && $srcs[1] !== $newUrl[0] ) { - $newGalleryAnchor = str_replace( $srcs[0], " href=\"{$newUrl[0]}\"", $galleryAnchor ); - $content = str_replace( $galleryAnchor, $newGalleryAnchor, $content ); - } - - } - - } - } - $anchorIndex++; - } - } - - return $content; - } - - /** - * Filter the content to replace CDN - * @param $content - * - * @return mixed - * @throws StorageException - */ - public function filterContent( $content, $context = 'post' ) - { - if ( !apply_filters( 'media-cloud/storage/can-filter-content', true ) ) { - return $content; - } - $originalContent = $content; - - if ( $context !== 'post' ) { - $content = str_replace( '<', '<', $content ); - $content = str_replace( '>', '>', $content ); - } - - // if (defined('MEDIACLOUD_DEV_MODE')) { - // $content = preg_replace('/wp-image-[0-9]+/', '', $content); - // } - if ( !preg_match_all( '/]+>/', $content, $matches ) ) { - return $originalContent; - } - $uploadDir = wp_get_upload_dir(); - $replacements = []; - $resizedReplacements = []; - foreach ( $matches[0] as $image ) { - $imageFound = false; - if ( !preg_match( "#src=['\"]+([^'\"]+)['\"]+#", $image, $srcMatches ) || strpos( $image, 'mcloud-attachment-' ) !== false ) { - continue; - } - $src = $srcMatches[1]; - // parse img tags with classes because these usually indicate the wordpress size - - if ( preg_match( '/class\\s*=\\s*(?:[\\"\']{1})([^\\"\']+)(?:[\\"\']{1})/m', $image, $matches ) ) { - $classes = explode( ' ', $matches[1] ); - $size = null; - $id = null; - foreach ( $classes as $class ) { - - if ( strpos( $class, 'wp-image-' ) === 0 ) { - $parts = explode( '-', $class ); - $id = array_pop( $parts ); - } else { - if ( strpos( $class, 'size-' ) === 0 ) { - $size = str_replace( 'size-', '', $class ); - } - } - - } - - if ( !empty($id) && empty($size) ) { - - if ( preg_match( '/sizes=[\'"]+\\(max-(width|height)\\:\\s*([0-9]+)px/m', $image, $sizeMatches ) ) { - $which = $sizeMatches[1]; - $px = $sizeMatches[2]; - $meta = wp_get_attachment_metadata( $id ); - if ( !empty($meta['sizes']) ) { - foreach ( $meta['sizes'] as $sizeKey => $sizeData ) { - - if ( $sizeData[$which] == $px ) { - $size = $sizeKey; - break; - } - - } - } - } - - if ( empty($size) ) { - - if ( preg_match( '/wpsize=([aA-zZ0-9-_]*)/m', $src, $wpSizeMatches ) ) { - $size = $wpSizeMatches[1]; - } else { - - if ( preg_match( '/(([0-9]+)x([0-9]+)\\.(?:jpg|jpeg|gif|png))/', $src, $dimensionMatches ) ) { - $size = 'full'; - $width = $dimensionMatches[2]; - $height = $dimensionMatches[3]; - $size = ilab_find_nearest_size( $id, $width, $height ); - if ( empty($size) ) { - $size = 'full'; - } - } else { - $size = 'full'; - } - - } - - } - } - - - if ( !empty($id) && is_numeric( $id ) ) { - $imageFound = true; - $replacements[$id] = [ - 'image' => $image, - 'src' => $src, - 'size' => $size, - ]; - } - - } - - - if ( !$imageFound && !empty($this->settings->replaceAllImageUrls) ) { - $escapedBase = str_replace( '/', '\\/', $uploadDir['baseurl'] ); - $escapedBase = str_replace( '.', '\\.', $escapedBase ); - $imageRegex = "#(data-src|src)\\s*=\\s*[\\'\"]+({$escapedBase}[^\\'\"]*(jpg|png|gif))[\\'\"]+#"; - - if ( preg_match( $imageRegex, $image, $matches ) ) { - $matchedUrl = $matches[2]; - $textSize = null; - $cleanedUrl = null; - $size = 'full'; - - if ( preg_match( '/(-[0-9x]+)\\.(?:jpg|gif|png)/m', $matchedUrl, $sizeMatches ) ) { - $cleanedUrl = str_replace( $sizeMatches[1], '', $matchedUrl ); - $id = attachment_url_to_postid( $cleanedUrl ); - $textSize = trim( $sizeMatches[1], '-' ); - $size = explode( 'x', $textSize ); - } else { - $id = attachment_url_to_postid( $matchedUrl ); - } - - - if ( !empty($id) ) { - - if ( !empty($textSize) ) { - $resizedReplacements[$id . '-' . $textSize] = [ - 'id' => $id, - 'image' => $image, - 'src' => $matchedUrl, - 'size' => $size, - ]; - } else { - $replacements[$id] = [ - 'image' => $image, - 'src' => $matchedUrl, - 'size' => $size, - ]; - } - - } else { - $this->addToReport( - null, - 'Image', - $matchedUrl, - null, - 'Unable to map URL to post ID.' - ); - } - - } - - } else { - if ( !$imageFound ) { - $this->addToReport( - null, - 'Image', - $src, - null, - 'Unable to map URL to post ID.' - ); - } - } - - } - foreach ( $replacements as $id => $data ) { - $content = $this->replaceImageInContent( $id, $data, $content ); - } - foreach ( $resizedReplacements as $id => $data ) { - $content = $this->replaceImageInContent( $data['id'], $data, $content ); - } - - if ( $context !== 'post' ) { - $content = str_replace( '<', '<', $content ); - $content = str_replace( '>', '>', $content ); - } - - return $content; - } - - /** - * @param $url - * - * @return int|null - */ - private function getShortCodeSource( $url, $type = 'Video' ) - { - $uploadDir = wp_get_upload_dir(); - $baseFile = ltrim( str_replace( $uploadDir['baseurl'], '', $url ), '/' ); - // $baseFile = ltrim(parse_url($url, PHP_URL_PATH), '/'); - - if ( empty($baseFile) ) { - $this->addToReport( - null, - $type, - $url, - null, - 'Base file is empty.' - ); - return null; - } - - global $wpdb ; - $query = $wpdb->prepare( "select post_id from {$wpdb->postmeta} where meta_key='_wp_attached_file' and meta_value = %s", $baseFile ); - $postId = $wpdb->get_var( $query ); - - if ( empty($postId) ) { - $this->addToReport( - null, - $type, - $url, - null, - 'Could not map URL to post ID.' - ); - return null; - } - - return $postId; - } - - /** - * @param string $output Video shortcode HTML output. - * @param array $atts Array of video shortcode attributes. - * @param string $video Video file. - * @param int $post_id Post ID. - * @param string $library Media library used for the video shortcode. - * @return string - * @throws StorageException - */ - public function filterVideoShortcode( - $output, - $atts, - $video, - $post_id, - $library - ) - { - - if ( isset( $atts['src'] ) ) { - $default_types = wp_get_video_extensions(); - $postId = null; - $found = false; - foreach ( $default_types as $type ) { - - if ( !empty($atts[$type]) ) { - $url = $atts[$type]; - if ( strpos( $url, '?' ) !== false ) { - $url = preg_replace( '/(\\?.*)/', '', $url ); - } - $postId = $this->getShortCodeSource( $url ); - $found = !empty($postId); - break; - } - - } - if ( !$found ) { - $postId = $this->getShortCodeSource( $atts['src'] ); - } - - if ( empty($postId) ) { - $this->addToReport( - null, - 'Video', - $atts['src'], - null, - "Unable to map URL to post ID" - ); - return $output; - } - - $post = get_post( $postId ); - $meta = wp_get_attachment_metadata( $post->ID ); - $url = $this->getAttachmentURL( null, $post->ID ); - - if ( !empty($url) ) { - $mime = arrayPath( $meta, 'mime_type', $post->post_mime_type ); - $insert = ""; - $insert .= "{$post->post_title}"; - - if ( preg_match( '/]*)>((?s).*)<\\/video>/m', $output, $matches ) ) { - $output = str_replace( $matches[1], $insert, $output ); - $this->addToReport( - $postId, - 'Video', - $atts['src'], - $url - ); - } else { - $this->addToReport( - $postId, - 'Video', - $atts['src'], - null, - "Unable to find src in content html" - ); - } - - } else { - $this->addToReport( - $postId, - 'Video', - $atts['src'], - null, - "Attachment URL is null." - ); - } - - } - - return $output; - } - - /** - * @param string $output Audio shortcode HTML output. - * @param array $atts Array of audio shortcode attributes. - * @param string $audio Audio file. - * @param int $post_id Post ID. - * @param string $library Media library used for the audio shortcode. - * @return string - * @throws StorageException - */ - public function filterAudioShortcode( - $output, - $atts, - $audio, - $post_id, - $library - ) - { - - if ( isset( $atts['src'] ) ) { - $default_types = wp_get_audio_extensions(); - $postId = null; - foreach ( $default_types as $type ) { - - if ( !empty($atts[$type]) ) { - $url = $atts[$type]; - if ( strpos( $url, '?' ) !== false ) { - $url = preg_replace( '/(\\?.*)/', '', $url ); - } - $postId = $this->getShortCodeSource( $url, 'Audio' ); - $found = !empty($postId); - break; - } - - } - if ( !$found ) { - $postId = $this->getShortCodeSource( $atts['src'], 'Audio' ); - } - - if ( empty($postId) ) { - $this->addToReport( - null, - 'Audio', - $atts['src'], - null, - "Unable to map URL to post ID" - ); - return $output; - } - - $post = get_post( $postId ); - $meta = wp_get_attachment_metadata( $post->ID ); - $url = $this->getAttachmentURL( null, $post->ID ); - - if ( !empty($url) ) { - $mime = arrayPath( $meta, 'mime_type', $post->post_mime_type ); - $insert = ""; - $insert .= "{$post->post_title}"; - - if ( preg_match( '/]*)>((?s).*)<\\/audio>/m', $output, $matches ) ) { - $output = str_replace( $matches[1], $insert, $output ); - $this->addToReport( - $postId, - 'Audio', - $atts['src'], - $url - ); - } else { - $this->addToReport( - $postId, - 'Audio', - $atts['src'], - null, - "Unable to find URL in content HTML" - ); - } - - } else { - $this->addToReport( - $postId, - 'Audio', - $atts['src'], - null, - "Attachment URL is empty." - ); - } - - } - - return $output; - } - - private function generateSrcSet( $id, $sizeName ) - { - if ( $this->allSizes === null ) { - $this->allSizes = ilab_get_image_sizes(); - } - if ( !is_string( $sizeName ) ) { - return ''; - } - if ( $sizeName !== 'full' && !isset( $this->allSizes[$sizeName] ) ) { - return ''; - } - $meta = wp_get_attachment_metadata( $id ); - $w = ( empty($meta['width']) ? (int) 0 : (int) $meta['width'] ); - $h = ( empty($meta['height']) ? (int) 0 : (int) $meta['height'] ); - if ( !isset( $meta['sizes'] ) || empty($w) || empty($h) ) { - return ''; - } - - if ( $sizeName === 'full' ) { - $size = [ - 'width' => $w, - 'height' => $h, - 'crop' => false, - ]; - } else { - $size = $this->allSizes[$sizeName]; - } - - $cropped = !empty($size['crop']); - $sw = ( empty($size['width']) ? (int) 0 : (int) $size['width'] ); - $sh = ( empty($size['height']) ? (int) 0 : (int) $size['height'] ); - if ( $cropped && (empty($sw) || empty($sh)) ) { - return ''; - } - - if ( $cropped ) { - $filteredSizes = array_filter( $this->allSizes, function ( $v, $k ) use( $meta, $sw, $sh ) { - if ( empty($v['crop']) ) { - return false; - } - $nsw = ( empty($v['width']) ? (int) 0 : (int) $v['width'] ); - $nsh = ( empty($v['height']) ? (int) 0 : (int) $v['height'] ); - if ( empty($nsw) || empty($nsh) ) { - return false; - } - $nratio = floor( $nsw / $nsh * 10 ); - $sratio = floor( $sw / $sh * 10 ); - return ($k === 'full' || isset( $meta['sizes'][$k] )) && $nratio === $sratio && $nsw <= $sw; - }, ARRAY_FILTER_USE_BOTH ); - } else { - $currentSize = sizeToFitSize( - $w, - $h, - $sw, - $sh - ); - $filteredSizes = array_filter( $this->allSizes, function ( $v, $k ) use( - $meta, - $currentSize, - $w, - $h, - $sw, - $sh - ) { - $nsw = ( empty($v['width']) ? (int) 0 : (int) $v['width'] ); - $nsh = ( empty($v['height']) ? (int) 0 : (int) $v['height'] ); - if ( $nsw === 0 ) { - $nsw = 100000; - } - if ( $nsh === 0 ) { - $nsh = 100000; - } - $newSize = sizeToFitSize( - $w, - $h, - $nsw, - $nsh - ); - return ($k === 'full' || isset( $meta['sizes'][$k] )) && empty($v['crop']) && $newSize[0] <= $currentSize[0] && $newSize[1] <= $currentSize[1]; - }, ARRAY_FILTER_USE_BOTH ); - } - - $sortedFilteredSizes = $filteredSizes; - uksort( $sortedFilteredSizes, function ( $a, $b ) use( $meta ) { - $aw = (int) $meta['sizes'][$a]['width']; - $bw = (int) $meta['sizes'][$b]['width']; - if ( $aw === $bw ) { - return 0; - } - return ( $aw < $bw ? -1 : 1 ); - } ); - if ( $sizeName === 'full' ) { - $sortedFilteredSizes['full'] = $size; - } - if ( count( $sortedFilteredSizes ) <= 1 ) { - return ''; - } - $sources = []; - foreach ( $sortedFilteredSizes as $name => $sizeInfo ) { - $csize = ( $name === 'full' ? $size : $meta['sizes'][$name] ); - $sw = (int) $csize['width']; - - if ( $name != $sizeName ) { - $sizeKey = "(max-width: {$sw}px) {$sw}px"; - } else { - $sizeKey = "100vw"; - } - - $src = wp_get_attachment_image_src( $id, $name ); - if ( !empty($src) ) { - $sources[$sizeKey] = $src[0] . " {$sw}w"; - } - } - - if ( !empty($sources) ) { - $sizes = "(max-width: {$sw}px) 100vw, {$sw}px"; - //implode(', ', array_keys($sources)); - $srcset = implode( ', ', array_values( $sources ) ); - $generated = "srcset='{$srcset}' sizes='{$sizes}'"; - return $generated; - } - - return ''; - } - - /** - * @param $id - * @param $data - * @param $content - * - * @return string|string[] - * @throws \MediaCloud\Plugin\Tools\Storage\StorageException - */ - private function replaceImageInContent( $id, $data, $content ) - { - $id = apply_filters( - 'wpml_object_id', - $id, - 'attachment', - true - ); - - if ( empty($data['size']) ) { - $meta = wp_get_attachment_metadata( $id ); - $url = $this->getAttachmentURLFromMeta( $meta ); - $srcSet = ''; - } else { - $url = image_downsize( $id, $data['size'] ); - $srcSet = ( empty($data['image']) ? '' : $this->generateSrcSet( $id, $data['size'] ) ); - } - - - if ( $url === false ) { - $siteId = apply_filters( 'global_media.site_id', false ); - - if ( $siteId != false ) { - switch_to_blog( $siteId ); - $url = image_downsize( $id, $data['size'] ); - restore_current_blog(); - } - - } - - if ( is_array( $url ) ) { - $url = $url[0]; - } - $url = preg_replace( '/&lang=[aA-zZ0-9]+/m', '', $url ); - - if ( empty($url) || $url == $data['src'] && empty($srcSet) ) { - $this->addToReport( - $id, - 'Image', - $data['src'], - null, - 'Unable to map URL' - ); - return $content; - } - - - if ( !empty($data['image']) && $this->replaceSrcSet ) { - $image = $data['image']; - $image = preg_replace( '/(sizes\\s*=\\s*[\'"]{1}(?:[^\'"]*)[\'"]{1})/m', '', $image ); - $image = preg_replace( '/(srcset\\s*=\\s*[\'"]{1}(?:[^\'"]*)[\'"]{1})/m', '', $image ); - if ( !empty($srcSet) ) { - $image = str_replace( 'addToReport( - $id, - 'Image', - $data['src'], - $url - ); - return str_replace( $data['src'], $url, $content ); - } - - public function attachmentIdFromURL( $postId, $url ) - { - return StoragePostMap::attachmentIdFromURL( $postId, $url, $this->client()->bucket() ); - } - - //endregion - //region Block Processing - private function processFileBlock( $id, $block_content ) - { - if ( preg_match_all( - '/]*)>/m', - $block_content, - $anchors, - PREG_SET_ORDER, - 0 - ) ) { - foreach ( $anchors as $anchor ) { - - if ( preg_match( '/class\\s*=\\s*"([^"]*)\\"/', $anchor[0], $class ) ) { - $newAnchor = str_replace( $class[1], "{$class[1]} mcloud-attachment-{$id}", $anchor[0] ); - } else { - $newAnchor = str_replace( ">", " class=\"mcloud-attachment-{$id}\">", $anchor[0] ); - } - - $block_content = str_replace( $anchor[0], $newAnchor, $block_content ); - } - } - return $block_content; - } - - private function processAudioBlock( $id, $block_content ) - { - if ( preg_match_all( - '/]*)>/m', - $block_content, - $audioTags, - PREG_SET_ORDER, - 0 - ) ) { - foreach ( $audioTags as $audioTag ) { - - if ( preg_match( '/class\\s*=\\s*"([^"]*)\\"/', $audioTag[0], $class ) ) { - $newAudioTag = str_replace( $class[1], "{$class[1]} mcloud-attachment-{$id}", $audioTag[0] ); - } else { - $newAudioTag = str_replace( ">", " class=\"mcloud-attachment-{$id}\">", $audioTag[0] ); - } - - - if ( preg_match( '/src\\s*=\\s*"(.*)\\"/', $audioTag[0], $source ) ) { - $newUrl = wp_get_attachment_url( $id ); - $newAudioTag = str_replace( $source[1], $newUrl, $newAudioTag ); - } - - $block_content = str_replace( $audioTag[0], $newAudioTag, $block_content ); - } - } - return $block_content; - } - - private function processVideoBlock( $id, $block_content ) - { - if ( preg_match_all( - '/]*)>/m', - $block_content, - $videoTags, - PREG_SET_ORDER, - 0 - ) ) { - foreach ( $videoTags as $videoTag ) { - - if ( preg_match( '/class\\s*=\\s*"([^"]*)\\"/', $videoTag[0], $class ) ) { - $newVideoTag = str_replace( $class[1], "{$class[1]} mcloud-attachment-{$id}", $videoTag[0] ); - } else { - $newVideoTag = str_replace( ">", " class=\"mcloud-attachment-{$id}\">", $videoTag[0] ); - } - - - if ( preg_match( '/src\\s*=\\s*"(.*)\\"/', $videoTag[0], $source ) ) { - $newUrl = wp_get_attachment_url( $id ); - $newVideoTag = str_replace( $source[1], $newUrl, $newVideoTag ); - } - - $block_content = str_replace( $videoTag[0], $newVideoTag, $block_content ); - } - } - return $block_content; - } - - private function processCoverBlock( $id, $block_content ) - { - if ( preg_match_all( - '/class\\s*=\\s*"([^"]*)/m', - $block_content, - $classes, - PREG_SET_ORDER, - 0 - ) ) { - foreach ( $classes as $class ) { - if ( strpos( $class[1], 'inner_container' ) !== false ) { - continue; - } - if ( strpos( $class[1], 'wp-block-cover' ) === false ) { - continue; - } - $block_content = str_replace( $class[1], "{$class[1]} mcloud-attachment-{$id}", $block_content ); - } - } - return $block_content; - } - - private function processGallery( $linkType, $block_content ) - { - if ( preg_match_all( '/]+)>/m', $block_content, $anchors ) ) { - foreach ( $anchors[0] as $anchor ) { - - if ( strpos( 'class=', $anchor ) === false ) { - $newAnchor = str_replace( 'processFileBlock( $id, $block_content ); - } else { - - if ( $block['blockName'] === 'core/audio' ) { - $block_content = $this->processAudioBlock( $id, $block_content ); - } else { - - if ( $block['blockName'] === 'core/video' ) { - $block_content = $this->processVideoBlock( $id, $block_content ); - } else { - if ( $block['blockName'] === 'core/cover' ) { - $block_content = $this->processCoverBlock( $id, $block_content ); - } - } - - } - - } - - } else { - - if ( $block['blockName'] === 'core/gallery' ) { - $linkTo = arrayPath( $block, 'attrs/linkTo' ); - if ( !empty($linkTo) ) { - $block_content = $this->processGallery( $linkTo, $block_content ); - } - } - + return $this->client->url( $meta['s3']['key'] ); + } catch ( \Exception $ex ) { + Logger::error( + "Error trying to generate url for {$meta['s3']['key']}. Message:" . $ex->getMessage(), + [], + __METHOD__, + __LINE__ + ); + return null; } - } - - return $block_content; + + } + + public function attachmentIdFromURL( $postId, $url ) + { + return StoragePostMap::attachmentIdFromURL( $postId, $url, $this->client()->bucket() ); } //endregion @@ -5034,9 +3763,15 @@ public function importAttachmentFromStorage( $fileInfo, $thumbs = array(), $scal //endregion //region File List - public function getFileList( $directoryKeys = array( '' ), $skipThumbnails = false ) + public function getFileList( + $directoryKeys = array( '' ), + $skipThumbnails = false, + $limit = -1, + $next = null + ) { $tempFileList = []; + $nextToken = null; foreach ( $directoryKeys as $key ) { if ( empty($key) || strpos( strrev( $key ), '/' ) === 0 ) { @@ -5045,7 +3780,14 @@ public function getFileList( $directoryKeys = array( '' ), $skipThumbnails = fal continue; } } - $tempFileList = $this->client()->ls( $key, null ); + $res = $this->client()->ls( + $key, + '/', + $limit, + $next + ); + $nextToken = $res['next']; + $tempFileList = $res['files']; } else { $tempFileList[] = $key; } @@ -5061,14 +3803,15 @@ public function getFileList( $directoryKeys = array( '' ), $skipThumbnails = fal if ( preg_match( '/([0-9]+x[0-9]+)\\.(?:.*)$/', $file, $matches ) ) { $sourceFile = str_replace( '-' . $matches[1], '', $file ); - if ( isset( $fileList[$sourceFile] ) ) { - $fileList[$sourceFile][] = $file; + if ( isset( $fileList[strtolower( $sourceFile )] ) ) { + $fileList[strtolower( $sourceFile )][] = $file; } else { - if ( isset( $unmatchedFileList[$sourceFile] ) ) { - $unmatchedFileList[$sourceFile]['thumbs'][] = $file; + if ( isset( $unmatchedFileList[strtolower( $sourceFile )] ) ) { + $unmatchedFileList[strtolower( $sourceFile )]['thumbs'][] = $file; } else { - $unmatchedFileList[$sourceFile] = [ + $unmatchedFileList[strtolower( $sourceFile )] = [ + 'key' => $sourceFile, 'thumbs' => [ $file ], ]; } @@ -5080,14 +3823,15 @@ public function getFileList( $directoryKeys = array( '' ), $skipThumbnails = fal if ( preg_match( '/.*-scaled\\.[aA-zZ]+/', $file, $scaledMatch ) ) { $sourceFile = str_replace( '-scaled', '', $file ); - if ( isset( $fileList[$sourceFile] ) ) { - $fileList[$sourceFile]['scaled'] = $file; + if ( isset( $fileList[strtolower( $sourceFile )] ) ) { + $fileList[strtolower( $sourceFile )]['scaled'] = $file; } else { - if ( isset( $unmatchedFileList[$sourceFile] ) ) { - $unmatchedFileList[$sourceFile]['scaled'] = $file; + if ( isset( $unmatchedFileList[strtolower( $sourceFile )] ) ) { + $unmatchedFileList[strtolower( $sourceFile )]['scaled'] = $file; } else { - $unmatchedFileList[$sourceFile] = [ + $unmatchedFileList[strtolower( $sourceFile )] = [ + 'key' => $sourceFile, 'scaled' => $file, ]; } @@ -5095,7 +3839,7 @@ public function getFileList( $directoryKeys = array( '' ), $skipThumbnails = fal } } else { - $fileList[$file] = [ + $fileList[strtolower( $file )] = [ 'key' => $file, 'missingOriginal' => false, 'thumbs' => [], @@ -5108,7 +3852,7 @@ public function getFileList( $directoryKeys = array( '' ), $skipThumbnails = fal } } else { foreach ( $tempFileList as $file ) { - $fileList[$file] = [ + $fileList[strtolower( $file )] = [ 'key' => $file, 'missingOriginal' => false, 'thumbs' => [], @@ -5120,7 +3864,7 @@ public function getFileList( $directoryKeys = array( '' ), $skipThumbnails = fal if ( !isset( $fileList[$key] ) && isset( $thumbs['scaled'] ) ) { $fileList[$key] = [ 'key' => $thumbs['scaled'], - 'originalKey' => $key, + 'originalKey' => $thumbs['key'], 'missingOriginal' => true, 'thumbs' => [], ]; @@ -5136,7 +3880,10 @@ public function getFileList( $directoryKeys = array( '' ), $skipThumbnails = fal } } - return array_values( $fileList ); + return [ + 'next' => $nextToken, + 'files' => array_values( $fileList ), + ]; } //endregion @@ -5944,12 +4691,39 @@ public function migratePostFromOtherPlugin( $postId ) //endregion //region Verification + private function verifyLocal( $uploadDir, $url ) + { + $attachmentFile = trailingslashit( $uploadDir['basedir'] ) . ltrim( str_replace( $uploadDir['baseurl'], '', $url ), '/' ); + + if ( file_exists( $attachmentFile ) ) { + return $url; + } else { + return 'Missing'; + } + + } + + private function getLocalUrl( $callback ) + { + add_filter( 'media-cloud/storage/override-url', '__return_false', PHP_INT_MAX ); + add_filter( 'media-cloud/dynamic-images/skip-url-generation', '__return_true', PHP_INT_MAX ); + $callback(); + remove_filter( 'media-cloud/storage/override-url', '__return_false', PHP_INT_MAX ); + remove_filter( 'media-cloud/dynamic-images/skip-url-generation', '__return_true', PHP_INT_MAX ); + } + /** * @param int $postId + * @param boolean $includeLocal * @param TaskReporter $reporter * @param \Closure $infoCallback */ - public function verifyPost( $postId, $reporter, $infoCallback ) + public function verifyPost( + $postId, + $includeLocal, + $reporter, + $infoCallback + ) { $client = new Client(); $allSizes = ilab_get_image_sizes(); @@ -5957,6 +4731,9 @@ public function verifyPost( $postId, $reporter, $infoCallback ) $sizeKeys = array_sort( $sizeKeys ); $sizesData = []; foreach ( $sizeKeys as $key ) { + if ( $includeLocal ) { + $sizesData[$key . ' Local'] = null; + } $sizesData[$key] = null; } $reportLine = [ $postId ]; @@ -5967,106 +4744,82 @@ public function verifyPost( $postId, $reporter, $infoCallback ) if ( empty($meta) || empty($meta['s3']) ) { $metaFromAttachment = false; - $meta = get_post_meta( $postId, 'ilab_s3_info', true ); + $otherMeta = get_post_meta( $postId, 'ilab_s3_info', true ); + if ( !empty($otherMeta) ) { + $meta = $otherMeta; + } } - if ( empty($meta) || empty($meta['s3']) ) { - $reportLine[] = 'Missing'; + if ( empty($meta) ) { + $reportLine[] = 'Missing metadata'; $reporter->add( $reportLine ); - $infoCallback( "Missing S3 metadata.", true ); - return; + $infoCallback( "Missing metadata.", true ); + } + + $processS3 = true; + + if ( empty($meta['s3']) ) { + $reportLine[] = 'Missing S3 metadata'; + $processS3 = false; + + if ( !$includeLocal ) { + $reporter->add( $reportLine ); + $infoCallback( "Missing S3 metadata.", true ); + return; + } + } $provider = arrayPath( $meta, 's3/provider', null ); if ( !empty($provider) && $provider != StorageToolSettings::driver() ) { + $processS3 = false; $reportLine[] = 'Wrong provider'; - $reporter->add( $reportLine ); - $infoCallback( "S3 provider mismatch, is '{$provider}' expecting '" . StorageToolSettings::driver() . "'.", true ); - return; - } - - $providerWorked = 0; + + if ( !$includeLocal ) { + $reporter->add( $reportLine ); + $infoCallback( "S3 provider mismatch, is '{$provider}' expecting '" . StorageToolSettings::driver() . "'.", true ); + return; + } - if ( empty($provider) ) { - $reportLine[] = 'S3 info exists, but provider is missing, trying with current provider'; - } else { - $reportLine[] = 'S3 Info Exists'; } - $infoCallback( "Checking attachment url ... " ); - $attachmentUrl = wp_get_attachment_url( $postId ); - try { - $res = $client->get( $attachmentUrl, [ - 'headers' => [ - 'Range' => 'bytes=0-0', - ], - ] ); - $code = $res->getStatusCode(); - } catch ( RequestException $ex ) { - $code = 400; - if ( $ex->hasResponse() ) { - $code = $ex->getResponse()->getStatusCode(); + $providerWorked = 0; + if ( $processS3 ) { + + if ( empty($provider) ) { + $reportLine[] = 'S3 info exists, but provider is missing, trying with current provider'; + } else { + $reportLine[] = 'S3 Info Exists'; } - } - if ( in_array( $code, [ 200, 206 ] ) ) { - $providerWorked++; - $reportLine[] = $attachmentUrl; - } else { - $reportLine[] = "Missing, code: {$code}"; } + $uploadDir = wp_get_upload_dir(); - $originalUrl = null; - - if ( strpos( $mimeType, 'image' ) === 0 ) { + if ( !$processS3 ) { + add_filter( 'media-cloud/storage/override-url', '__return_false', PHP_INT_MAX ); + add_filter( 'media-cloud/dynamic-images/skip-url-generation', '__return_true', PHP_INT_MAX ); + $infoCallback( "Checking attachment url ... " ); + $attachmentUrl = wp_get_attachment_url( $postId ); + $reportLine[] = $this->verifyLocal( $uploadDir, $attachmentUrl ); + $reportLine[] = ''; + $originalImage = wp_get_original_image_url( $postId ); - if ( !empty(arrayPath( $meta, 'original_image' )) ) { - $originalKey = arrayPath( $meta, 'original_image_s3/key' ); + if ( !empty($originalImage) ) { + $originalFile = wp_get_original_image_path( $postId ); - if ( !empty($originalKey) ) { - try { - $privacy = arrayPath( $meta, 'original_image_s3/privacy', 'private' ); - $infoCallback( "Checking original url ... " ); - $doSign = $this->client->usesSignedURLs( $mimeType ) || $privacy !== 'public-read'; - $originalUrl = ( $doSign ? $this->client->presignedUrl( $originalKey, $this->client->signedURLExpirationForType( $mimeType ) ) : $this->client->url( $originalKey, $mimeType ) ); - - if ( $originalUrl == $attachmentUrl ) { - $reportLine[] = ''; - } else { - try { - $res = $client->get( $originalUrl, [ - 'headers' => [ - 'Range' => 'bytes=0-0', - ], - ] ); - $code = $res->getStatusCode(); - } catch ( RequestException $ex ) { - $code = 400; - if ( $ex->hasResponse() ) { - $code = $ex->getResponse()->getStatusCode(); - } - } - - if ( in_array( $code, [ 200, 206 ] ) ) { - $providerWorked++; - $reportLine[] = $originalUrl; - } else { - $reportLine[] = "Missing, code: {$code}"; - } - - } - - } catch ( \Exception $ex ) { - $reportLine[] = "Client error: " . $ex->getMessage(); - } + if ( file_exists( $originalFile ) ) { + $reportLine[] = $originalImage; + $reportLine[] = ''; } else { - $reportLine[] = "Missing original image S3 key."; + $reportLine[] = 'Missing'; + $reportLine[] = ''; } } else { $reportLine[] = ''; + $reportLine[] = ''; } $sizes = arrayPath( $meta, 'sizes' ); @@ -6074,68 +4827,205 @@ public function verifyPost( $postId, $reporter, $infoCallback ) if ( !empty($sizes) ) { $infoCallback( "Checking sizes ... " ); foreach ( $sizes as $sizeKey => $sizeInfo ) { - - if ( empty(arrayPath( $sizeInfo, 's3' )) ) { - $sizesData[$sizeKey] = 'Missing S3 metadata'; + $url = wp_get_attachment_image_url( $postId, $sizeKey ); + if ( empty($url) ) { continue; } - - $sizeS3Key = arrayPath( $sizeInfo, 's3/key' ); - - if ( empty($sizeS3Key) ) { - $sizesData[$sizeKey] = 'Missing S3 key'; - continue; + $result = $this->verifyLocal( $uploadDir, $url ); + $sizesData[$sizeKey . ' Local'] = $result; + } + $reportLine = array_merge( $reportLine, array_values( $sizesData ) ); + } + + remove_filter( 'media-cloud/storage/override-url', '__return_false', PHP_INT_MAX ); + remove_filter( 'media-cloud/dynamic-images/skip-url-generation', '__return_true', PHP_INT_MAX ); + } else { + $infoCallback( "Checking attachment url ... " ); + if ( $includeLocal ) { + $this->getLocalUrl( function () use( $postId, $uploadDir, &$reportLine ) { + $attachmentUrl = wp_get_attachment_url( $postId ); + $reportLine[] = $this->verifyLocal( $uploadDir, $attachmentUrl ); + } ); + } + $attachmentUrl = wp_get_attachment_url( $postId ); + try { + $res = $client->get( $attachmentUrl, [ + 'headers' => [ + 'Range' => 'bytes=0-0', + ], + ] ); + $code = $res->getStatusCode(); + } catch ( RequestException $ex ) { + $code = 400; + if ( $ex->hasResponse() ) { + $code = $ex->getResponse()->getStatusCode(); + } + } + + if ( in_array( $code, [ 200, 206 ] ) ) { + $providerWorked++; + $reportLine[] = $attachmentUrl; + } else { + $reportLine[] = "Missing, code: {$code}"; + } + + $originalUrl = null; + + if ( strpos( $mimeType, 'image' ) === 0 ) { + + if ( !empty(arrayPath( $meta, 'original_image' )) ) { + if ( $includeLocal ) { + $this->getLocalUrl( function () use( $postId, &$reportLine ) { + $originalImage = wp_get_original_image_url( $postId ); + + if ( !empty($originalImage) ) { + $originalFile = wp_get_original_image_path( $postId ); + + if ( file_exists( $originalFile ) ) { + $reportLine[] = $originalImage; + } else { + $reportLine[] = 'Missing'; + } + + } else { + $reportLine[] = ''; + } + + } ); } + $originalKey = arrayPath( $meta, 'original_image_s3/key' ); - $privacy = arrayPath( $sizeInfo, 's3/privacy', 'private' ); - try { - $doSign = $this->client->usesSignedURLs( $mimeType ) || $privacy !== 'public-read'; - $url = ( $doSign ? $this->client->presignedUrl( $sizeS3Key, $this->client->signedURLExpirationForType( $mimeType ) ) : $this->client->url( $sizeS3Key, $mimeType ) ); - - if ( !empty($url) && ($url == $attachmentUrl || $url == $originalUrl) ) { - $reportLine[] = ''; - } else { - try { - $res = $client->get( $url, [ - 'headers' => [ - 'Range' => 'bytes=0-0', - ], - ] ); - $code = $res->getStatusCode(); - } catch ( RequestException $ex ) { - $code = 400; - if ( $ex->hasResponse() ) { - $code = $ex->getResponse()->getStatusCode(); + if ( !empty($originalKey) ) { + try { + $privacy = arrayPath( $meta, 'original_image_s3/privacy', 'private' ); + $infoCallback( "Checking original url ... " ); + $doSign = $this->client->usesSignedURLs( $mimeType ) || $privacy !== 'public-read'; + $originalUrl = ( $doSign ? $this->client->presignedUrl( $originalKey, $this->client->signedURLExpirationForType( $mimeType ) ) : $this->client->url( $originalKey, $mimeType ) ); + + if ( $originalUrl == $attachmentUrl ) { + $reportLine[] = ''; + } else { + try { + $res = $client->get( $originalUrl, [ + 'headers' => [ + 'Range' => 'bytes=0-0', + ], + ] ); + $code = $res->getStatusCode(); + } catch ( RequestException $ex ) { + $code = 400; + if ( $ex->hasResponse() ) { + $code = $ex->getResponse()->getStatusCode(); + } + } + + if ( in_array( $code, [ 200, 206 ] ) ) { + $providerWorked++; + $reportLine[] = $originalUrl; + } else { + $reportLine[] = "Missing, code: {$code}"; } + } + + } catch ( \Exception $ex ) { + $reportLine[] = "Client error: " . $ex->getMessage(); + } + } else { + $reportLine[] = "Missing original image S3 key."; + } + + } else { + if ( $includeLocal ) { + $reportLine[] = ''; + } + $reportLine[] = ''; + } + + $sizes = arrayPath( $meta, 'sizes' ); + + if ( !empty($sizes) ) { + $infoCallback( "Checking sizes ... " ); + foreach ( $sizes as $sizeKey => $sizeInfo ) { + if ( $includeLocal ) { + $this->getLocalUrl( function () use( + $postId, + $uploadDir, + $sizeKey, + &$sizesData + ) { + $url = wp_get_attachment_image_url( $postId, $sizeKey ); + if ( empty($url) ) { + return; + } + $result = $this->verifyLocal( $uploadDir, $url ); + $sizesData[$sizeKey . ' Local'] = $result; + } ); + } + + if ( empty(arrayPath( $sizeInfo, 's3' )) ) { + $sizesData[$sizeKey] = 'Missing S3 metadata'; + continue; + } + + $sizeS3Key = arrayPath( $sizeInfo, 's3/key' ); + + if ( empty($sizeS3Key) ) { + $sizesData[$sizeKey] = 'Missing S3 key'; + continue; + } + + $privacy = arrayPath( $sizeInfo, 's3/privacy', 'private' ); + try { + $doSign = $this->client->usesSignedURLs( $mimeType ) || $privacy !== 'public-read'; + $url = ( $doSign ? $this->client->presignedUrl( $sizeS3Key, $this->client->signedURLExpirationForType( $mimeType ) ) : $this->client->url( $sizeS3Key, $mimeType ) ); - if ( in_array( $code, [ 200, 206 ] ) ) { - $providerWorked++; - $sizesData[$sizeKey] = $url; + if ( !empty($url) && ($url == $attachmentUrl || $url == $originalUrl) ) { + $reportLine[] = ''; } else { - $sizesData[$sizeKey] = "Missing, code: {$code}"; + try { + $res = $client->get( $url, [ + 'headers' => [ + 'Range' => 'bytes=0-0', + ], + ] ); + $code = $res->getStatusCode(); + } catch ( RequestException $ex ) { + $code = 400; + if ( $ex->hasResponse() ) { + $code = $ex->getResponse()->getStatusCode(); + } + } + + if ( in_array( $code, [ 200, 206 ] ) ) { + $providerWorked++; + $sizesData[$sizeKey] = $url; + } else { + $sizesData[$sizeKey] = "Missing, code: {$code}"; + } + } + } catch ( \Exception $ex ) { + $sizesData[$sizeKey] = "Client error: " . $ex->getMessage(); } - - } catch ( \Exception $ex ) { - $sizesData[$sizeKey] = "Client error: " . $ex->getMessage(); } + $reportLine = array_merge( $reportLine, array_values( $sizesData ) ); } - $reportLine = array_merge( $reportLine, array_values( $sizesData ) ); + } - - } - - - if ( empty($provider) && $providerWorked >= 1 ) { - $reportLine[] = 'Fixed missing provider.'; - $meta['s3']['provider'] = StorageToolSettings::driver(); - if ( $metaFromAttachment ) { - update_post_meta( $postId, '_wp_attachment_metadata', $meta ); - } else { - update_post_meta( $postId, 'ilab_s3_info', $meta ); + + if ( empty($provider) && $providerWorked >= 1 ) { + $reportLine[] = 'Fixed missing provider.'; + $meta['s3']['provider'] = StorageToolSettings::driver(); + + if ( $metaFromAttachment ) { + update_post_meta( $postId, '_wp_attachment_metadata', $meta ); + } else { + update_post_meta( $postId, 'ilab_s3_info', $meta ); + } + } } diff --git a/classes/Tools/Storage/StorageToolSettings.php b/classes/Tools/Storage/StorageToolSettings.php index 554aa18e..00b234c1 100755 --- a/classes/Tools/Storage/StorageToolSettings.php +++ b/classes/Tools/Storage/StorageToolSettings.php @@ -60,6 +60,9 @@ * @property bool $skipOtherImport * @property bool $keepSubsitePath * @property bool $replaceAllImageUrls + * @property bool $replaceAnchorHrefs + * @property bool $filterContent + * */ class StorageToolSettings extends ToolSettings { //region Static Class Variables @@ -97,6 +100,8 @@ class StorageToolSettings extends ToolSettings { "skipOtherImport" => ["mcloud-storage-skip-import-other-plugin", null, false], "keepSubsitePath" => ["mcloud-storage-keep-subsite-path", null, false], "replaceAllImageUrls" => ["mcloud-storage-replace-all-image-urls", null, true], + "replaceAnchorHrefs" => ["mcloud-storage-replace-hrefs", null, true], + "filterContent" => ["mcloud-storage-filter-content", null, true], ]; diff --git a/classes/Tools/Storage/Tasks/UnlinkTask.php b/classes/Tools/Storage/Tasks/UnlinkTask.php index 53a870db..a6ba0896 100755 --- a/classes/Tools/Storage/Tasks/UnlinkTask.php +++ b/classes/Tools/Storage/Tasks/UnlinkTask.php @@ -184,33 +184,48 @@ public function performTask($item) { $meta = get_post_meta($post_id, '_wp_attachment_metadata', true); } + $changed = false; + $url = wp_get_attachment_url($post_id); + if (empty($meta)) { $this->reporter()->add([ $post_id, - wp_get_attachment_url($post_id), + $url, null, 'Missing metadata' ]); + + Logger::info("Finished processing $post_id", [], __METHOD__, __LINE__); + + return true; } - Logger::info("Meta keys:".implode(', ', array_keys($meta))); - if (isset($meta['s3'])) { - $url = wp_get_attachment_url($post_id); + if (isset($meta['s3'])) { + $changed = true; unset($meta['s3']); - if(isset($meta['sizes'])) { - $sizes = $meta['sizes']; - foreach($sizes as $size => $sizeData) { - if(isset($sizeData['s3'])) { - unset($sizeData['s3']); - } - - $sizes[$size] = $sizeData; + } + + if(isset($meta['sizes'])) { + $sizes = $meta['sizes']; + foreach($sizes as $size => $sizeData) { + if(isset($sizeData['s3'])) { + $changed = true; + unset($sizeData['s3']); } - $meta['sizes'] = $sizes; + $sizes[$size] = $sizeData; } + $meta['sizes'] = $sizes; + } + + if (isset($meta['original_image_s3'])) { + $changed = true; + unset($meta['original_image_s3']); + } + + if ($changed) { if ($isS3Info) { delete_post_meta($post_id, 'ilab_s3_info'); } else { @@ -228,7 +243,7 @@ public function performTask($item) { } else { $this->reporter()->add([ $post_id, - wp_get_attachment_url($post_id), + $url, null, 'Missing cloud storage metadata' ]); diff --git a/classes/Tools/Storage/Tasks/VerifyLibraryTask.php b/classes/Tools/Storage/Tasks/VerifyLibraryTask.php index 116e09de..634b8778 100755 --- a/classes/Tools/Storage/Tasks/VerifyLibraryTask.php +++ b/classes/Tools/Storage/Tasks/VerifyLibraryTask.php @@ -51,7 +51,7 @@ public static function menuTitle() { } public static function showInMenu() { - return false; + return true; } /** @@ -102,27 +102,38 @@ public static function instructionView() { */ public static function taskOptions() { return [ + 'include-local' => [ + "title" => "Include Local Files", + "description" => "Processes all files, including those not on cloud storage.", + "type" => "checkbox", + "default" => false + ], ]; } + /** @var null|\Closure */ + public static $callback = null; + //endregion //region Data protected function filterPostArgs($args) { - $args['meta_query'] = [ - 'relation' => 'OR', - [ - 'key' => '_wp_attachment_metadata', - 'value' => '"s3"', - 'compare' => 'LIKE', - 'type' => 'CHAR', - ], - [ - 'key' => 'ilab_s3_info', - 'compare' => 'EXISTS', - ], - ]; + if (empty($this->options['include-local'])) { + $args['meta_query'] = [ + 'relation' => 'OR', + [ + 'key' => '_wp_attachment_metadata', + 'value' => '"s3"', + 'compare' => 'LIKE', + 'type' => 'CHAR', + ], + [ + 'key' => 'ilab_s3_info', + 'compare' => 'EXISTS', + ], + ]; + } return $args; } @@ -133,13 +144,35 @@ public function reporter() { $sizeKeys = array_keys($allSizes); $sizeKeys = array_sort($sizeKeys); - $this->reportHeaders = array_merge(array_merge([ + $fields = [ 'Post ID', 'Mime Type', 'S3 Metadata Status', 'Attachment URL', 'Original Source Image URL', - ], $sizeKeys), ['Notes']); + ]; + + if (!empty($this->options['include-local'])) { + $fields = [ + 'Post ID', + 'Mime Type', + 'S3 Metadata Status', + 'Attachment URL Local', + 'Attachment URL', + 'Original Source Image URL Local', + 'Original Source Image URL', + ]; + + $newSizeKeys = []; + foreach($sizeKeys as $sizeKey) { + $newSizeKeys[] = $sizeKey . " Local"; + $newSizeKeys[] = $sizeKey; + } + + $sizeKeys = $newSizeKeys; + } + + $this->reportHeaders = array_merge(array_merge($fields, $sizeKeys), ['Notes']); } return parent::reporter(); @@ -178,7 +211,8 @@ public function performTask($item) { $this->updateCurrentPost($post_id); - ToolsManager::instance()->tools['storage']->verifyPost($post_id, $this->reporter(), function($message, $newLine = false) {}); + $callback = !empty(static::$callback) ? static::$callback : function($message, $newLine = false) {}; + ToolsManager::instance()->tools['storage']->verifyPost($post_id, !empty($this->options['include-local']), $this->reporter(), $callback); Logger::info("Finished verifying $post_id", [], __METHOD__, __LINE__); diff --git a/classes/Tools/Tasks/TasksTool.php b/classes/Tools/Tasks/TasksTool.php index 545c5da4..9e14ff7b 100755 --- a/classes/Tools/Tasks/TasksTool.php +++ b/classes/Tools/Tasks/TasksTool.php @@ -40,8 +40,13 @@ public function __construct( $toolName, $toolInfo, $toolManager ) { public function setup() { parent::setup(); + add_action('init', function() { + $role = get_role('administrator'); + $role->add_cap('mcloud_heartbeat', true); + }); + if (is_admin()) { - if ($this->settings->heartbeatEnabled) { + if ($this->settings->heartbeatEnabled && current_user_can('mcloud_heartbeat')) { add_action('admin_enqueue_scripts', function() { $script = View::render_view('base.heartbeat', [ 'heartbeatFrequency' => (int)$this->settings->heartbeatFrequency * 1000]); wp_register_script('task-manager-heartbeat', '', ['jquery']); diff --git a/classes/Tools/ToolsManager.php b/classes/Tools/ToolsManager.php index f6e8b170..51c2df5b 100755 --- a/classes/Tools/ToolsManager.php +++ b/classes/Tools/ToolsManager.php @@ -68,6 +68,32 @@ public function __construct() { // MigrationsManager::instance()->migrate(); $this->tools = []; + if ( class_exists( '\\hyperdb' ) || class_exists( '\\LudicrousDB' ) ) { + add_filter( + 'pre_update_option', + function ( $value, $option, $old_value ) { + + if ( empty($value) && strpos( $option, 'mcloud' ) === 0 ) { + $type = strtolower( gettype( $value ) ); + + if ( in_array( $type, [ 'boolean', 'null' ] ) ) { + Logger::info( + "pre_update_option: Empty {$option} => " . $type, + [], + __METHOD__, + __LINE__ + ); + return (string) '0'; + } + + } + + return $value; + }, + 10, + 3 + ); + } $hasRun = get_option( 'mcloud-has-run', false ); if ( empty($hasRun) ) { @@ -305,6 +331,7 @@ public static function Boot() ToolsManager::registerTool( "troubleshooting", include ILAB_CONFIG_DIR . '/troubleshooting.config.php' ); ToolsManager::registerTool( "batch-processing", include ILAB_CONFIG_DIR . '/batch-processing.config.php' ); ToolsManager::registerTool( "tasks", include ILAB_CONFIG_DIR . '/tasks.config.php' ); + ToolsManager::registerTool( "reports", include ILAB_CONFIG_DIR . '/reports.config.php' ); if ( LicensingManager::CanTrack() ) { ToolsManager::registerTool( "opt-in", include ILAB_CONFIG_DIR . '/opt-in.config.php' ); } diff --git a/classes/Utilities/Helpers.php b/classes/Utilities/Helpers.php index 2be9c2d7..e6da85db 100755 --- a/classes/Utilities/Helpers.php +++ b/classes/Utilities/Helpers.php @@ -40,7 +40,7 @@ function json_response($data) { status_header( 200 ); header( 'Content-type: application/json; charset=UTF-8' ); - echo json_encode($data,JSON_PRETTY_PRINT); + echo json_encode($data,JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE); die; } @@ -315,5 +315,22 @@ function typeFromMeta($meta) { return null; } + + /** + * Determine if a given string ends with a given substring. + * + * @param string $haystack + * @param string|string[] $needles + * @return bool + */ + function strEndsWith($haystack, $needles) { + foreach ((array) $needles as $needle) { + if ($needle !== '' && substr($haystack, -strlen($needle)) === (string) $needle) { + return true; + } + } + + return false; + } } diff --git a/classes/Utilities/Logging/Logger.php b/classes/Utilities/Logging/Logger.php index cdced85f..c474d4d9 100755 --- a/classes/Utilities/Logging/Logger.php +++ b/classes/Utilities/Logging/Logger.php @@ -86,12 +86,20 @@ public function __construct() { $this->logger->pushHandler(new DatabaseLoggerHandler($realLevel)); } + $this->logger->pushHandler(new QueryMonitorLoggerHandler($realLevel)); } - set_error_handler(function($errno, $errstr, $errfile, $errline, $errContext) { - $this->logSystemError($errno, $errstr, $errfile, $errline); - return false; - }); + if (version_compare(phpversion(), '8', '>=')) { + set_error_handler(function($errno, $errstr, $errfile, $errline) { + $this->logSystemError($errno, $errstr, $errfile, $errline); + return false; + }); + } else { + set_error_handler(function($errno, $errstr, $errfile, $errline, $errContext) { + $this->logSystemError($errno, $errstr, $errfile, $errline); + return false; + }); + } register_shutdown_function(function(){ $lastError = error_get_last(); diff --git a/classes/Utilities/Logging/QueryMonitorLoggerHandler.php b/classes/Utilities/Logging/QueryMonitorLoggerHandler.php new file mode 100755 index 00000000..07d4d043 --- /dev/null +++ b/classes/Utilities/Logging/QueryMonitorLoggerHandler.php @@ -0,0 +1,19 @@ +recurse_objects = $recurse_objects; + $this->regex = $regex; + $this->regex_flags = $regex_flags; + $this->regex_delimiter = $regex_delimiter; + $this->regex_limit = $regex_limit; + $this->logging = $logging; + $this->clear_log_data(); + + // Get the XDebug nesting level. Will be zero (no limit) if no value is set + $this->max_recursion = intval(ini_get('xdebug.max_nesting_level')); + } + + /** + * Take a serialised array and unserialise it replacing elements as needed and + * unserialising any subordinate arrays and performing the replace on those too. + * Ignores any serialized objects unless $recurse_objects is set to true. + * + * @param string $from + * @param string $to + * @param array|string $data The data to operate on. + * @param bool $serialised Does the value of $data need to be unserialized? + * + * @return array The original array with all elements replaced as needed. + */ + public function run(string $from, string $to, $data, $serialised = false) { + return $this->run_recursively($from, $to, $data, $serialised); + } + + /** + * @param string $from + * @param string $to + * @param $data + * @param $serialised + * @param int $recursion_level Current recursion depth within the original data. + * @param array $visited_data Data that has been seen in previous recursion iterations. + * + * @return mixed|string|string[]|null + */ + private function run_recursively(string $from, string $to, $data, $serialised, $recursion_level = 0, $visited_data = array()) { + // some unseriliased data cannot be re-serialised eg. SimpleXMLElements + try { + + if($this->recurse_objects) { + + // If we've reached the maximum recursion level, short circuit + if(0 !== $this->max_recursion && $recursion_level >= $this->max_recursion) { + return $data; + } + + if(is_array($data) || is_object($data)) { + // If we've seen this exact object or array before, short circuit + if(in_array($data, $visited_data, true)) { + return $data; // Avoid infinite loops when there's a cycle + } + // Add this data to the list of + $visited_data[] = $data; + } + } + + $unserialized = @unserialize($data); + if(is_string($data) && false !== $unserialized) { + $data = $this->run_recursively($from, $to, $unserialized, true, $recursion_level + 1); + } elseif(is_array($data)) { + $keys = array_keys($data); + foreach($keys as $key) { + $data[$key] = $this->run_recursively($from, $to, $data[$key], false, $recursion_level + 1, $visited_data); + } + } elseif($this->recurse_objects && (is_object($data) || $data instanceof \__PHP_Incomplete_Class)) { + if($data instanceof \__PHP_Incomplete_Class) { + $array = new ArrayObject($data); + Logger::warning(sprintf('Skipping an uninitialized class "%s", replacements might not be complete.', $array['__PHP_Incomplete_Class_Name']), [], __METHOD__, __LINE__); + } else { + foreach($data as $key => $value) { + $data->$key = $this->run_recursively($from, $to, $value, false, $recursion_level + 1, $visited_data); + } + } + } elseif(is_string($data)) { + if($this->logging) { + $old_data = $data; + } + if($this->regex) { + $search_regex = $this->regex_delimiter; + $search_regex .= $from; + $search_regex .= $this->regex_delimiter; + $search_regex .= $this->regex_flags; + + $result = preg_replace($search_regex, $to, $data, $this->regex_limit); + if(null === $result || PREG_NO_ERROR !== preg_last_error()) { + \WP_CLI::warning(sprintf('The provided regular expression threw a PCRE error - %s', $this->preg_error_message($result))); + } + $data = $result; + } else { + $data = str_replace($from, $to, $data); + } + + if($this->logging && $old_data !== $data) { + $this->log_data[] = $old_data; + } + } + + if($serialised) { + return serialize($data); + } + } catch(Exception $error) { // phpcs:ignore Generic.CodeAnalysis.EmptyStatement.DetectedCatch -- Deliberally empty. + Logger::error($error->getMessage(), [], __METHOD__, __LINE__); + } + + return $data; + } + + /** + * Gets existing data saved for this run when logging. + * @return array Array of data strings, prior to replacements. + */ + public function get_log_data() { + return $this->log_data; + } + + /** + * Clears data stored for logging. + */ + public function clear_log_data() { + $this->log_data = array(); + } + + /** + * Get the PCRE error constant name from an error value. + * + * @param integer $error Error code. + * + * @return string Error constant name. + */ + private function preg_error_message($error) { + static $error_names = null; + + if(null === $error_names) { + $definitions = get_defined_constants(true); + $pcre_constants = array_key_exists('pcre', $definitions) ? $definitions['pcre'] : array(); + $error_names = array_flip($pcre_constants); + } + + return isset($error_names[$error]) ? $error_names[$error] : ''; + } +} + diff --git a/classes/Utilities/Search/Searcher.php b/classes/Utilities/Search/Searcher.php new file mode 100755 index 00000000..b6de17c8 --- /dev/null +++ b/classes/Utilities/Search/Searcher.php @@ -0,0 +1,469 @@ +dryRun = $dryRun; + + $this->resetToLocal = $resetToLocal; + $this->forceImgix = $forceImgix; + $this->imgixKey = $imgixKey; + $this->imgixDomain = $imgixDomain; + $this->tables = static::getTables(); + $this->forcedCDN = $forcedCDN; + $this->forcedDocCDN = $forcedDocCDN; + + if (empty($this->forceImgix)) { + $this->forceImgix = !empty($imgixDomain); + } + + if ($this->forceImgix) { + $this->imgixTool = ToolsManager::instance()->tools['imgix']; + } + + $this->replacer = new Replacer(false, null, null, null, null, null); + } + + //region Static Helpers + + private static function isTextCol( $type ) { + foreach ( array( 'text', 'varchar' ) as $token ) { + if ( false !== strpos( $type, $token ) ) { + return true; + } + } + + return false; + } + + private static function escLike( $old ) { + global $wpdb; + + // Remove notices in 4.0 and support backwards compatibility + if ( method_exists( $wpdb, 'esc_like' ) ) { + // 4.0 + $old = $wpdb->esc_like( $old ); + } else { + // phpcs:ignore WordPress.WP.DeprecatedFunctions.like_escapeFound -- BC-layer for WP 3.9 or less. + $old = like_escape( esc_sql( $old ) ); // Note: this double escaping is actually necessary, even though `escLike()` will be used in a `prepare()`. + } + + return $old; + } + + /** + * Escapes (backticks) MySQL identifiers (aka schema object names) - i.e. column names, table names, and database/index/alias/view etc names. + * See https://dev.mysql.com/doc/refman/5.5/en/identifiers.html + * + * @param string|array $idents A single identifier or an array of identifiers. + * @return string|array An escaped string if given a string, or an array of escaped strings if given an array of strings. + */ + private static function escSqlIdent( $idents ) { + $backtick = function ( $v ) { + // Escape any backticks in the identifier by doubling. + return '`' . str_replace( '`', '``', $v ) . '`'; + }; + if ( is_string( $idents ) ) { + return $backtick( $idents ); + } + return array_map( $backtick, $idents ); + } + + /** + * Puts MySQL string values in single quotes, to avoid them being interpreted as column names. + * + * @param string|array $values A single value or an array of values. + * @return string|array A quoted string if given a string, or an array of quoted strings if given an array of strings. + */ + private static function escSqlValue( $values ) { + $quote = function ( $v ) { + // Don't quote integer values to avoid MySQL's implicit type conversion. + if ( preg_match( '/^[+-]?[0-9]{1,20}$/', $v ) ) { // MySQL BIGINT UNSIGNED max 18446744073709551615 (20 digits). + return esc_sql( $v ); + } + + // Put any string values between single quotes. + return "'" . esc_sql( $v ) . "'"; + }; + + if ( is_array( $values ) ) { + return array_map( $quote, $values ); + } + + return $quote( $values ); + } + + private static function getTables() { + global $wpdb; + + $scope = 'all'; + $wp_tables = array_values($wpdb->tables('all')); + + if ( ! global_terms_enabled() ) { + // Only include sitecategories when it's actually enabled. + $wp_tables = array_values(array_diff($wp_tables, [$wpdb->sitecategories])); + } + + // Note: BC change 1.5.0, tables are sorted (via TABLES view). + // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared -- uses escSqlIdent() and $wpdb->_escape(). + $query = sprintf( "SHOW TABLES WHERE %s IN ('%s')", self::escSqlIdent( 'Tables_in_' . DB_NAME ), implode( "', '", $wpdb->_escape( $wp_tables ) ) ); + $tables = $wpdb->get_col( $query ); + + return $tables; + } + + private static function getColumns($table) { + global $wpdb; + + $table_sql = self::escSqlIdent( $table ); + $primary_keys = array(); + $text_columns = array(); + $all_columns = array(); + $suppress_errors = $wpdb->suppress_errors(); + + // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- escaped through self::escSqlIdent + $results = $wpdb->get_results( "DESCRIBE $table_sql" ); + + if ( ! empty( $results ) ) { + foreach ( $results as $col ) { + if ( 'PRI' === $col->Key ) { + $primary_keys[] = $col->Field; + } + if ( self::isTextCol( $col->Type ) ) { + $text_columns[] = $col->Field; + } + $all_columns[] = $col->Field; + } + } + $wpdb->suppress_errors( $suppress_errors ); + return array( $primary_keys, $text_columns, $all_columns ); + } + + //endregion + + private function performReplace($col, $primary_keys, $table, $old, $new) { + global $wpdb; + + $count = 0; + $table_sql = self::escSqlIdent( $table ); + $col_sql = self::escSqlIdent( $col ); + $where = " WHERE $col_sql" . $wpdb->prepare( ' LIKE BINARY %s', '%' . self::escLike( $old ) . '%' ); + if ($table === $wpdb->postmeta) { + $where .= " AND `meta_key` <> '_wp_attachment_metadata' AND `meta_key` <> 'ilab_s3_info'"; + } + $primary_keys_sql = implode( ',', self::escSqlIdent( $primary_keys ) ); + + // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- escaped through self::escSqlIdent + $rows = $wpdb->get_results( "SELECT {$primary_keys_sql} FROM {$table_sql} {$where}" ); + + foreach ( $rows as $keys ) { + $where_sql = ''; + foreach ( (array) $keys as $k => $v ) { + if ( strlen( $where_sql ) ) { + $where_sql .= ' AND '; + } + $where_sql .= self::escSqlIdent( $k ) . ' = ' . self::escSqlValue( $v ); + } + + // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- escaped through self::escSqlIdent + $col_value = $wpdb->get_var( "SELECT {$col_sql} FROM {$table_sql} WHERE {$where_sql}" ); + + if ( '' === $col_value ) { + continue; + } + + $value = $this->replacer->run($old, $new, $col_value); + + if ( $value === $col_value ) { + continue; + } + + if ( $this->dryRun ) { + $count++; + } else { + $where = array(); + foreach ( (array) $keys as $k => $v ) { + $where[ $k ] = $v; + } + + $count += $wpdb->update( $table, array( $col => $value ), $where ); + } + } + + return $count; + } + + private function getAttachmentUrl(\Closure $callback) { + if ($this->resetToLocal) { + add_filter('media-cloud/dynamic-images/skip-url-generation', '__return_true', PHP_INT_MAX); + add_filter('media-cloud/storage/override-url', '__return_false', PHP_INT_MAX); + add_filter('media-cloud/storage/ignore-cdn', '__return_true', PHP_INT_MAX); + } + + $result = $callback(); + + if ($this->resetToLocal) { + remove_filter('media-cloud/storage/ignore-cdn', '__return_true', PHP_INT_MAX); + remove_filter('media-cloud/storage/override-url', '__return_false', PHP_INT_MAX); + remove_filter('media-cloud/dynamic-images/skip-url-generation', '__return_true', PHP_INT_MAX); + } + + return $result; + } + + private function getUntreatedUrl(array &$urlMap, $attachmentUrl, \Closure $callback) { + $results = []; + + $uploadDir = wp_get_upload_dir(); + + // local => current + { + add_filter('media-cloud/dynamic-images/skip-url-generation', '__return_true', PHP_INT_MAX); + add_filter('media-cloud/storage/override-url', '__return_false', PHP_INT_MAX); + add_filter('media-cloud/storage/ignore-cdn', '__return_true', PHP_INT_MAX); + + $result = $callback(); + if (strpos($result, $uploadDir['baseurl']) !== 0) { + $urlParts = parse_url($result); + $result = str_replace("{$urlParts['scheme']}://{$urlParts['host']}", $uploadDir['baseurl'], $result); + } + + if (!empty($result) && ($result != $attachmentUrl)) { + $urlMap[$result] = $attachmentUrl; + + $results[] = $result; + } + + remove_filter('media-cloud/storage/ignore-cdn', '__return_true', PHP_INT_MAX); + remove_filter('media-cloud/storage/override-url', '__return_false', PHP_INT_MAX); + remove_filter('media-cloud/dynamic-images/skip-url-generation', '__return_true', PHP_INT_MAX); + } + + // imgix => current + if ($this->forceImgix) { + add_filter('media-cloud/storage/ignore-cdn', '__return_true', PHP_INT_MAX); + + if ($this->imgixDomain) { + add_filter('media-cloud/dynamic-images/override-domain', function($domain) { + return $this->imgixDomain; + }); + } + + if ($this->imgixKey) { + add_filter('media-cloud/dynamic-images/override-key', function($key) { + return $this->imgixKey; + }); + } + + $this->imgixTool->forceEnable(true); + + $result = $callback(); + + if (!empty($result) && ($result != $attachmentUrl) && !in_array($result, $results)) { + $urlMap[$result] = $attachmentUrl; + + $results[] = $result; + } + + $this->imgixTool->forceEnable(false); + remove_filter('media-cloud/storage/ignore-cdn', '__return_true', PHP_INT_MAX); + + remove_all_filters('media-cloud/dynamic-images/override-domain'); + remove_all_filters('media-cloud/dynamic-images/override-key'); + } + + // old.cdn => current + if (!empty($this->forcedCDN)) { + add_filter('media-cloud/dynamic-images/skip-url-generation', '__return_true', PHP_INT_MAX); + + add_filter('media-cloud/storage/override-cdn', function($cdn) { + return $this->forcedCDN; + }); + + add_filter('media-cloud/storage/override-doc-cdn', function($cdn) { + return $this->forcedDocCDN; + }); + + $result = $callback(); + + if (!empty($result) && ($result != $attachmentUrl) && !in_array($result, $results)) { + $urlMap[$result] = $attachmentUrl; + + $results[] = $result; + } + + remove_all_filters('media-cloud/storage/override-cdn'); + remove_filter('media-cloud/dynamic-images/skip-url-generation', '__return_true', PHP_INT_MAX); + } + + // old.doc.cdn => current + if (!empty($this->forcedDocCDN) && ($this->forcedCDN !== $this->forcedDocCDN)) { + add_filter('media-cloud/dynamic-images/skip-url-generation', '__return_true', PHP_INT_MAX); + + add_filter('media-cloud/storage/override-doc-cdn', function($cdn) { + return $this->forcedDocCDN; + }); + + $result = $callback(); + + if (!empty($result) && ($result != $attachmentUrl) && !in_array($result, $results)) { + $urlMap[$result] = $attachmentUrl; + + $results[] = $result; + } + + remove_all_filters('media-cloud/storage/override-doc-cdn'); + remove_filter('media-cloud/dynamic-images/skip-url-generation', '__return_true', PHP_INT_MAX); + } + + // storage => current + { + add_filter('media-cloud/dynamic-images/skip-url-generation', '__return_true', PHP_INT_MAX); + add_filter('media-cloud/storage/ignore-cdn', '__return_true', PHP_INT_MAX); + + $result = $callback(); + if (!empty($result) && ($result != $attachmentUrl) && !in_array($result, $results)) { + $urlMap[$result] = $attachmentUrl; + + $results[] = $result; + } + + remove_filter('media-cloud/dynamic-images/skip-url-generation', '__return_true', PHP_INT_MAX); + remove_filter('media-cloud/storage/ignore-cdn', '__return_true', PHP_INT_MAX); + } + + + // cdn => current + { + add_filter('media-cloud/dynamic-images/skip-url-generation', '__return_true', PHP_INT_MAX); + + $result = $callback(); + if (!empty($result) && ($result != $attachmentUrl) && !in_array($result, $results)) { + $urlMap[$result] = $attachmentUrl; + } + + remove_filter('media-cloud/dynamic-images/skip-url-generation', '__return_true', PHP_INT_MAX); + } + + if ($this->resetToLocal) { + $result = $callback(); + if (!empty($result) && ($result != $attachmentUrl) && !in_array($result, $results)) { + $urlMap[$result] = $attachmentUrl; + } + } + } + + public function searchAndReplace(string $old, string $new) { + $total = 0; + $skipColumns = [ + 'guid', 'user_pass' + ]; + + foreach ($this->tables as $table) { + if (!isset($this->columns[$table])) { + $this->columns[$table] = static::getColumns( $table ); + } + + list( $primary_keys, $columns, $all_columns ) = $this->columns[$table]; + + // since we'll be updating one row at a time, + // we need a primary key to identify the row + if (empty($primary_keys)) { + continue; + } + + foreach($columns as $col) { + if (in_array( $col, $skipColumns, true)) { + continue; + } + + $count = $this->performReplace( $col, $primary_keys, $table, $old, $new ); + + $total += $count; + } + } + + return $total; + } + + + public function replacePostId($postId, array $sizes, TaskReporter $reporter, \Closure $prepCallback) { + $mime = get_post_mime_type($postId); + $urlMap = []; + + if (strpos($mime, 'image/') === 0) { + foreach($sizes as $sizeKey => $sizeData) { + $attachmentUrl = $this->getAttachmentUrl(function() use ($postId, $sizeKey) { + return wp_get_attachment_image_url($postId, $sizeKey); + }); + + if (!empty($attachmentUrl)) { + $this->getUntreatedUrl($urlMap, $attachmentUrl, function() use ($postId, $sizeKey) { + return wp_get_attachment_image_url($postId, $sizeKey); + }); + } + } + + $originalImage = $this->getAttachmentUrl(function() use ($postId) { + return wp_get_original_image_url($postId); + }); + + if (!empty($originalImage)) { + $this->getUntreatedUrl($urlMap, $originalImage, function() use ($postId) { + return wp_get_original_image_url($postId); + }); + } + } else { + $attachmentUrl = $this->getAttachmentUrl(function() use ($postId) { + return wp_get_attachment_url($postId); + }); + + if (!empty($attachmentUrl)) { + $this->getUntreatedUrl($urlMap, $attachmentUrl, function() use ($postId) { + return wp_get_attachment_url($postId); + }); + } + } + + $prepCallback(); + + $totalChanges = 0; + foreach($urlMap as $old => $new) { + $result = $this->searchAndReplace($old, $new); + + $totalChanges += intval($result); + + $reporter->add([ + $postId, + $old, + $new, + intval($result) + ]); + } + + return $totalChanges; + } + +} \ No newline at end of file diff --git a/config/batch-processing.config.php b/config/batch-processing.config.php index 93c6676e..d49a0312 100755 --- a/config/batch-processing.config.php +++ b/config/batch-processing.config.php @@ -53,7 +53,7 @@ ], "mcloud-tasks-generate-reports" => [ "title" => "Generate Reports", - "description" => "When this is enabled, certain tasks will generate CSV reports that will tell you more details about what happened when the task was running. You can find these reports in the ".WP_CONTENT_DIR."/mcloud-reports/ directory on your server.", + "description" => "When this is enabled, certain tasks will generate CSV reports that will tell you more details about what happened when the task was running. You can find these reports in the ".\MediaCloud\Plugin\Tasks\TaskReporter::reporterDirectory()." directory on your server.", "type" => "checkbox", "default" => true ], diff --git a/config/debugging.config.php b/config/debugging.config.php index 91c9b323..ba46fc10 100755 --- a/config/debugging.config.php +++ b/config/debugging.config.php @@ -40,7 +40,7 @@ ], "mcloud-debug-content-filtering" => [ "title" => "Debug Content Filtering", - "description" => "If you are seeing issues with URLs not being updated correctly, enable this to troubleshoot. When enabled, it will log content filtering as well as generate a report in ".trailingslashit(WP_CONTENT_DIR)."mcloud-reports. DO NOT LEAVE THIS RUNNING. Only use to troubleshoot specific pages and then make sure to turn it off.", + "description" => "If you are seeing issues with URLs not being updated correctly, enable this to troubleshoot. When enabled, it will log content filtering as well as generate a report in ".\MediaCloud\Plugin\Tasks\TaskReporter::reporterDirectory().". DO NOT LEAVE THIS RUNNING. Only use to troubleshoot specific pages and then make sure to turn it off.", "type" => "checkbox", "default" => false, ], diff --git a/config/reports.config.php b/config/reports.config.php new file mode 100755 index 00000000..f217f605 --- /dev/null +++ b/config/reports.config.php @@ -0,0 +1,23 @@ + "reports", + "name" => "Report Viewer", + "description" => "Tool for viewing reports generated by Media Cloud.", + "class" => "MediaCloud\\Plugin\\Tools\\Reports\\ReportsTool", + "exclude" => true, + "dependencies" => [], + "env" => "ILAB_MEDIA_REPORT_VIEWER_ENABLED", // this is always enabled btw +]; \ No newline at end of file diff --git a/config/storage.config.php b/config/storage.config.php index 81021a58..1bc54a7e 100755 --- a/config/storage.config.php +++ b/config/storage.config.php @@ -314,9 +314,15 @@ ] ], "ilab-media-cloud-performance-settings" => [ - "title" => "Performance Settings", + "title" => "URL Replacement", "description" => "", "options" => [ + "mcloud-storage-filter-content" => [ + "title" => "Replace URLs", + "description" => "When this is enabled, Media Cloud will replace URLs in content on the fly. You should not turn this off in most circumstances. However, if you've been using Media Cloud since day zero of your WordPress site, you may be able to turn this setting off.", + "type" => "checkbox", + "default" => true + ], "mcloud-storage-replace-all-image-urls" => [ "title" => "Replace ALL Image URLs", "description" => "When this is enabled, Media Cloud will attempt to replace all of the URLs for images that it finds in a post's content. In some rare cases, this can result in a lot of database queries as the image tag Media Cloud is trying to replace the URL for is missing a CSS class that helps it figure out which attachment the image tag represents. When that CSS class exists, typically wp-image-{NUMBER}, Media Cloud can quickly lookup the metadata it needs to create the cloud storage URL. When it's missing, Media Cloud will then have to do some database queries to try to figure things out. If you have a wp_posts table that is very large, this can be slow going. If you disable this, the image URLs for these images missing the required wp-image-{NUMBER} class will not be replaced and it will be up to you to do this process manually.. Note that this setting is only really relevant for older sites, or sites using horribly built themes. If you do have to disable this, you can add this snippet to your theme's functions.php and it should help you significantly. Also, if you do turn this option off, please let us know so we can determine what kind of themes require it to be disabled. Again, to reiterate, it's a very rare set of circumstances that would lead you to disable this option. So don't do it unless you are absolutely certain it will help.", @@ -329,6 +335,12 @@ "type" => "checkbox", "default" => true ], + "mcloud-storage-replace-hrefs" => [ + "title" => "Replace Anchor Tag URLs", + "description" => "When this is enabled, Media Cloud will replace any anchor tag's href if it points to an image attachment.", + "type" => "checkbox", + "default" => true + ], ] ], "ilab-media-cloud-display-settings" => [ diff --git a/config/storage/do.config.php b/config/storage/do.config.php index 80360e7b..b622ea25 100755 --- a/config/storage/do.config.php +++ b/config/storage/do.config.php @@ -95,7 +95,7 @@ "description" => "This will set the privacy for the original image upload.", "display-order" => 43, "type" => "select", - "default" => 'authenticated-read', + "default" => 'private', "options" => [ "public-read" => "Public", "authenticated-read" => "Authenticated Read", diff --git a/config/storage/dreamhost.config.php b/config/storage/dreamhost.config.php index f2275016..c3cd68fa 100755 --- a/config/storage/dreamhost.config.php +++ b/config/storage/dreamhost.config.php @@ -95,7 +95,7 @@ "description" => "This will set the privacy for the original image upload.", "display-order" => 43, "type" => "select", - "default" => 'authenticated-read', + "default" => 'private', "options" => [ "public-read" => "Public", "authenticated-read" => "Authenticated Read", diff --git a/config/storage/google.config.php b/config/storage/google.config.php index 98d9f73a..d044f134 100755 --- a/config/storage/google.config.php +++ b/config/storage/google.config.php @@ -86,7 +86,7 @@ "description" => "This will set the privacy for the original image upload.", "display-order" => 43, "type" => "select", - "default" => 'authenticated-read', + "default" => 'private', "options" => [ "public-read" => "Public", "authenticated-read" => "Authenticated Read", diff --git a/config/storage/minio.config.php b/config/storage/minio.config.php index 254f267c..f884c5a7 100755 --- a/config/storage/minio.config.php +++ b/config/storage/minio.config.php @@ -122,7 +122,7 @@ "description" => "This will set the privacy for the original image upload.", "display-order" => 43, "type" => "select", - "default" => 'authenticated-read', + "default" => 'private', "options" => [ "public-read" => "Public", "authenticated-read" => "Authenticated Read", diff --git a/config/storage/other-s3.config.php b/config/storage/other-s3.config.php index 84a016c4..2ba87793 100755 --- a/config/storage/other-s3.config.php +++ b/config/storage/other-s3.config.php @@ -131,7 +131,7 @@ "description" => "This will set the privacy for the original image upload.", "display-order" => 43, "type" => "select", - "default" => 'authenticated-read', + "default" => 'private', "options" => [ "public-read" => "Public", "authenticated-read" => "Authenticated Read", diff --git a/config/storage/s3.config.php b/config/storage/s3.config.php index 4c607573..f1be98cb 100755 --- a/config/storage/s3.config.php +++ b/config/storage/s3.config.php @@ -133,7 +133,7 @@ "description" => "This will set the privacy for the original image upload.", "display-order" => 43, "type" => "select", - "default" => 'authenticated-read', + "default" => 'private', "options" => [ "public-read" => "Public", "authenticated-read" => "Authenticated Read", diff --git a/config/storage/wasabi.config.php b/config/storage/wasabi.config.php index 27849d28..60c2f16a 100755 --- a/config/storage/wasabi.config.php +++ b/config/storage/wasabi.config.php @@ -94,7 +94,7 @@ "description" => "This will set the privacy for the original image upload.", "display-order" => 43, "type" => "select", - "default" => 'authenticated-read', + "default" => 'private', "options" => [ "public-read" => "Public", "authenticated-read" => "Authenticated Read", diff --git a/external/Freemius/includes/class-fs-logger.php b/external/Freemius/includes/class-fs-logger.php index 90e918fe..612d37ed 100755 --- a/external/Freemius/includes/class-fs-logger.php +++ b/external/Freemius/includes/class-fs-logger.php @@ -142,7 +142,7 @@ function get_file() { return $this->_file_start; } - private function _log( &$message, $type = 'log', $wrapper ) { + private function _log( &$message, $type = 'log', $wrapper = false ) { if ( ! $this->is_on() ) { return; } diff --git a/ilab-media-tools.php b/ilab-media-tools.php index e6db71f9..d0311079 100755 --- a/ilab-media-tools.php +++ b/ilab-media-tools.php @@ -5,7 +5,7 @@ Plugin URI: https://github.com/interfacelab/ilab-media-tools Description: Automatically upload media to Amazon S3 and integrate with Imgix, a real-time image processing CDN. Boosts site performance and simplifies workflows. Author: interfacelab -Version: 4.1.14 +Version: 4.2.0 Author URI: http://interfacelab.io */ // Copyright (c) 2016 Interfacelab LLC. All rights reserved. @@ -94,7 +94,7 @@ } // Version Defines -define( 'MEDIA_CLOUD_VERSION', '4.1.14' ); +define( 'MEDIA_CLOUD_VERSION', '4.2.0' ); define( 'MEDIA_CLOUD_INFO_VERSION', '4.0.2' ); define( 'MCLOUD_IS_BETA', false ); // Directory defines diff --git a/lib/mcloud-guzzlehttp/promises/src/RejectedPromise.php b/lib/mcloud-guzzlehttp/promises/src/RejectedPromise.php index b839af7b..549f6e7c 100755 --- a/lib/mcloud-guzzlehttp/promises/src/RejectedPromise.php +++ b/lib/mcloud-guzzlehttp/promises/src/RejectedPromise.php @@ -2,6 +2,9 @@ namespace MediaCloud\Vendor\GuzzleHttp\Promise; + +use MediaCloud\Plugin\Utilities\Logging\Logger; + /** * A promise that has been rejected. * @@ -14,7 +17,16 @@ class RejectedPromise implements PromiseInterface public function __construct($reason) { - if (method_exists($reason, 'then')) { + if (is_array($reason) && (\MediaCloud\Plugin\Utilities\isKeyedArray($reason))) { + foreach($reason as $key => $value) { + if (is_object($value)) { + if (method_exists($value, 'then')) { + throw new \InvalidArgumentException( + 'You cannot create a RejectedPromise with a promise.'); + } + } + } + } else if (method_exists($reason, 'then')) { throw new \InvalidArgumentException( 'You cannot create a RejectedPromise with a promise.'); } diff --git a/public/css/ilab-media-cloud.css b/public/css/ilab-media-cloud.css index a20c411d..6acf1801 100755 --- a/public/css/ilab-media-cloud.css +++ b/public/css/ilab-media-cloud.css @@ -6,6 +6,6 @@ * Released under the MIT license * * Date: 2018-04-01T06:26:32.417Z - */.cropper-container{direction:ltr;font-size:0;line-height:0;position:relative;touch-action:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.cropper-container img{display:block;height:100%;image-orientation:0deg;max-height:none!important;max-width:none!important;min-height:0!important;min-width:0!important;width:100%}.cropper-canvas,.cropper-crop-box,.cropper-drag-box,.cropper-modal,.cropper-wrap-box{bottom:0;left:0;position:absolute;right:0;top:0}.cropper-canvas,.cropper-wrap-box{overflow:hidden}.cropper-drag-box{background-color:#fff;opacity:0}.cropper-modal{background-color:#000;opacity:.5}.cropper-view-box{display:block;height:100%;outline-color:rgba(51,153,255,.75);outline:1px solid #39f;overflow:hidden;width:100%}.cropper-dashed{border:0 dashed #eee;display:block;opacity:.5;position:absolute}.cropper-dashed.dashed-h{border-bottom-width:1px;border-top-width:1px;height:33.33333%;left:0;top:33.33333%;width:100%}.cropper-dashed.dashed-v{border-left-width:1px;border-right-width:1px;height:100%;left:33.33333%;top:0;width:33.33333%}.cropper-center{display:block;height:0;left:50%;opacity:.75;position:absolute;top:50%;width:0}.cropper-center:after,.cropper-center:before{background-color:#eee;content:" ";display:block;position:absolute}.cropper-center:before{height:1px;left:-3px;top:0;width:7px}.cropper-center:after{height:7px;left:0;top:-3px;width:1px}.cropper-face,.cropper-line,.cropper-point{display:block;height:100%;opacity:.1;position:absolute;width:100%}.cropper-face{background-color:#fff;left:0;top:0}.cropper-line{background-color:#39f}.cropper-line.line-e{cursor:ew-resize;right:-3px;top:0;width:5px}.cropper-line.line-n{cursor:ns-resize;height:5px;left:0;top:-3px}.cropper-line.line-w{cursor:ew-resize;left:-3px;top:0;width:5px}.cropper-line.line-s{bottom:-3px;cursor:ns-resize;height:5px;left:0}.cropper-point{background-color:#39f;height:5px;opacity:.75;width:5px}.cropper-point.point-e{cursor:ew-resize;margin-top:-3px;right:-3px;top:50%}.cropper-point.point-n{cursor:ns-resize;left:50%;margin-left:-3px;top:-3px}.cropper-point.point-w{cursor:ew-resize;left:-3px;margin-top:-3px;top:50%}.cropper-point.point-s{bottom:-3px;cursor:s-resize;left:50%;margin-left:-3px}.cropper-point.point-ne{cursor:nesw-resize;right:-3px;top:-3px}.cropper-point.point-nw{cursor:nwse-resize;left:-3px;top:-3px}.cropper-point.point-sw{bottom:-3px;cursor:nesw-resize;left:-3px}.cropper-point.point-se{bottom:-3px;cursor:nwse-resize;height:20px;opacity:1;right:-3px;width:20px}@media (min-width:768px){.cropper-point.point-se{height:15px;width:15px}}@media (min-width:992px){.cropper-point.point-se{height:10px;width:10px}}@media (min-width:1200px){.cropper-point.point-se{height:5px;opacity:.75;width:5px}}.cropper-point.point-se:before{background-color:#39f;bottom:-50%;content:" ";display:block;height:200%;opacity:0;position:absolute;right:-50%;width:200%}.cropper-invisible{opacity:0}.cropper-bg{background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAQMAAAAlPW0iAAAAA3NCSVQICAjb4U/gAAAABlBMVEXMzMz////TjRV2AAAACXBIWXMAAArrAAAK6wGCiw1aAAAAHHRFWHRTb2Z0d2FyZQBBZG9iZSBGaXJld29ya3MgQ1M26LyyjAAAABFJREFUCJlj+M/AgBVhF/0PAH6/D/HkDxOGAAAAAElFTkSuQmCC")}.cropper-hide{display:block;height:0;position:absolute;width:0}.cropper-hidden{display:none!important}.cropper-move{cursor:move}.cropper-crop{cursor:crosshair}.cropper-disabled .cropper-drag-box,.cropper-disabled .cropper-face,.cropper-disabled .cropper-line,.cropper-disabled .cropper-point{cursor:not-allowed}.ilab-admin-separator-container{display:flex;height:12px;align-items:center;margin:0 -10px 0 0}.ilab-admin-separator-container .ilab-admin-separator-title{font-size:.68em;text-transform:uppercase;font-weight:700;margin-right:10px;color:hsla(0,0%,100%,.25)}.ilab-admin-separator-container .ilab-admin-separator{display:block;flex:1;padding:0;height:1px;line-height:1px;background:hsla(0,0%,100%,.125)}.media-cloud-info-link{display:flex;align-items:center}.media-cloud-info-link img.mcloud-lock{margin-left:5px}#wpadminbar #wp-admin-bar-media-cloud-admin-bar>.ab-item>.ab-icon:before{content:"\F176";top:3px}.ilabm-backdrop{position:fixed;display:block;background-color:rgba(0,0,0,.66)}.ilabm-backdrop,.ilabm-container{left:0;top:0;right:0;bottom:0;z-index:160000!important}.ilabm-container{background-color:#fcfcfc;position:absolute;border-radius:0;display:flex;flex-direction:column}.ilabm-titlebar{border-bottom:1px solid #ddd;min-height:50px;max-height:50px;box-shadow:0 0 4px rgba(0,0,0,.15);display:flex;align-items:center}.ilabm-titlebar h1{flex:1;padding:0 16px;font-size:22px;line-height:50px;margin:0 50px 0 0;display:flex;align-items:center;justify-content:space-between}.ilabm-titlebar .modal-actions{display:flex}.ilabm-titlebar .modal-actions a{margin-left:8px;display:flex;align-items:center}.ilabm-titlebar .modal-actions a svg{height:12px;width:auto;margin-right:4px}.ilabm-titlebar .modal-actions a svg>path,.ilabm-titlebar .modal-actions a svg>rect{fill:#000}.ilabm-titlebar .modal-actions div.spacer{width:8px;min-width:8px}.ilabm-titlebar>a{display:block;max-width:50px;min-width:50px;border-left:1px solid #ddd}.ilabm-window-area{flex:2 100%;display:flex;flex-direction:row}.ilabm-window-area-content{background-color:#fff;flex:2 100%;display:flex;flex-direction:column}.ilabm-editor-container{flex:2 100%;position:relative}.ilabm-editor-area{position:absolute;left:0;top:0;right:0;bottom:0;background-image:url(../img/ilab-imgix-edit-bg.png);display:block;margin:10px}.ilabm-sidebar{min-width:380px;max-width:380px;background-color:#f3f3f3;display:flex;flex-direction:column;border-left:3px solid #ddd}.ilabm-sidebar-content{position:relative;display:flex;flex:2 100%}.ilabm-sidebar-tabs{background:#ddd;display:flex;min-height:36px;max-height:36px}.ilabm-sidebar-tabs .ilabm-sidebar-tab{min-width:40px;white-space:nowrap;text-align:center;margin-top:3px;background-color:#ccc;line-height:30px;padding:0 15px;margin-right:3px;font-size:11px;text-transform:uppercase;color:#888;font-weight:700;cursor:pointer!important}.ilabm-sidebar-tabs .active-tab{background-color:#f3f3f3;color:#777}.ilabm-sidebar-actions{display:flex;justify-content:flex-end;background-color:#fff;border-top:1px solid #eee;padding:11px}.ilabm-sidebar-actions a{display:block;margin-left:10px!important}a.button-reset{background:#a00!important;border-color:#700!important;color:#fff!important;box-shadow:inset 0 1px 0 #d00,0 1px 0 rgba(0,0,0,.15)!important;text-shadow:none!important}.ilabm-editor-tabs{background:#ddd;overflow:hidden;min-height:36px}.ilabm-editor-tabs,.ilabm-editor-tabs .ilabm-tabs-select-ui{display:flex;flex-direction:row}.ilabm-editor-tabs .ilabm-tabs-select-ui .ilabm-tabs-select-label{margin-top:3px;line-height:32px;padding:0 5px 0 15px;margin-right:3px;font-size:11px;text-transform:uppercase;color:#888;font-weight:700;cursor:pointer!important}.ilabm-editor-tabs .ilabm-tabs-select-ui .ilabm-tabs-select{margin-top:4px;line-height:32px;font-size:11px}.ilabm-editor-tabs .ilabm-tabs-ui{display:flex;flex-direction:row}.ilabm-editor-tabs .ilabm-tabs-ui .ilabm-editor-tab{white-space:nowrap;min-width:50px;text-align:center;min-height:32px;max-height:33px;margin-top:3px;background-color:#ccc;line-height:31px;padding:0 15px;margin-right:3px;font-size:11px;text-transform:uppercase;color:#888;font-weight:700;cursor:pointer!important}.ilabm-editor-tabs .ilabm-tabs-ui .active-tab{background:#fff;margin-top:2px;border-right:1px solid #ddd;border-left:1px solid #ddd;border-top:1px solid #ddd}.ilabm-status-container{display:flex;flex:1;justify-content:flex-start}.ilabm-status-container .is-hidden{display:none}.ilabm-status-container .spinner{margin:0 8px 0 0}.ilabm-status-label{font-size:13px}.ilabm-preview-wait-modal{position:absolute;box-shadow:0 0 10px 1px rgba(0,0,0,.75);text-align:center;padding:20px 40px;border-radius:10px;background-color:hsla(0,0%,100%,.66);left:50%;top:50%;margin-left:-60px;margin-top:-32px}.ilabm-preview-wait-modal h3{text-transform:uppercase;font-size:13px}.ilabm-preview-wait-modal span.spinner{float:none!important}.ilabm-bottom-bar{font-size:12px!important;padding:0 10px 10px;display:flex!important;justify-content:flex-end;align-items:center;min-height:20px}.ilabm-bottom-bar .ilabm-bottom-bar-seperator{position:relative;width:1px;height:20px;background-color:#ccc;margin:0 10px 0 20px!important}.ilabm-bottom-bar a,.ilabm-bottom-bar select{margin-left:10px!important}.ilabm-bottom-bar select{font-size:13px!important;min-width:140px}.ilabm-bottom-bar label{font-size:13px!important}.is-hidden{display:none}.ilabm-modal-close{top:0;right:0;cursor:pointer;color:#777;background-color:transparent;height:50px;width:50px;position:absolute;text-align:center;border:0;border-left:1px solid #ddd;transition:color .1s ease-in-out,background .1s ease-in-out;text-decoration:none;z-index:1000;box-sizing:content-box;transition-property:border,background,color;transition-duration:.05s;transition-timing-function:ease-in-out}.ilabm-modal-icon{background-repeat:no-repeat;display:block;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)}.ilabm-modal-icon:before{content:"\F335";font:normal 22px/1 dashicons;vertical-align:middle;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;color:#666}.setup-body{display:flex;flex-direction:column;align-items:center;justify-content:center;padding-top:40px}.setup-body .service-selection-grid{display:grid;grid-template-columns:repeat(3,1fr);grid-gap:15px;grid-auto-rows:158px}.setup-body .service-selection-grid a{border-radius:5px;background-color:#fff;display:flex;flex-direction:column;justify-content:flex-end;align-items:center;border:1px solid #eaeaea;width:128px;height:128px;text-align:center;text-decoration:none;padding:15px;background-position:50% calc(50% - 15px);background-repeat:no-repeat;transition:transform .5s ease-out}.setup-body .service-selection-grid a:hover{transform:scale(1.1)}.setup-body .service-selection-grid a[data-service=s3]{grid-column:1;grid-row:1;background-image:url(../img/icon-service-s3.svg)}.setup-body .service-selection-grid a[data-service=google]{grid-column:2;grid-row:1;background-image:url(../img/icon-service-google.svg)}.setup-body .service-selection-grid a[data-service=minio]{grid-column:3;grid-row:1;background-image:url(../img/icon-service-minio.svg)}.setup-body .service-selection-grid a[data-service=backblaze]{grid-column:1;grid-row:2;background-image:url(../img/icon-service-backblaze.svg)}.setup-body .service-selection-grid a[data-service=do]{grid-column:2;grid-row:2;background-image:url(../img/icon-service-do.svg)}.setup-body .service-selection-grid a[data-service=other-s3]{grid-column:3;grid-row:2;background-image:url(../img/icon-service-other-s3.svg)}#ilab-video-upload-target{position:relative;padding:30px;border:4px dashed #e0e0e0;background-color:#fafafa;margin:20px 0;display:flex;flex-wrap:wrap;min-height:128px;cursor:pointer;transition:border .5s ease-out}#ilab-video-upload-target.drag-inside{border:4px solid #70a9dd;background-color:#bcd3e2}.ilab-upload-item{position:relative;min-width:128px;min-height:128px;max-width:128px;max-height:128px;width:128px;height:128px;background-color:#eaeaea;margin:10px;border-radius:0;border:1px solid #ddd;overflow:hidden;transition:opacity .5s ease-out,left .3s ease-out,top .3s ease-out,width .3s ease-out,height .3s ease-out,transform .3s ease-out;background-repeat:no-repeat;background-position:50%}.ilab-upload-item.upload-error{background-color:#eabab3;border:1px solid #bb6a6b}.ilab-upload-item.ilab-upload-selected{box-shadow:0 0 0 2px #fff,0 0 0 5px #0073aa}.ilab-upload-cell-image{background-image:url(../img/ilab-icon-image.svg);background-size:60px}.ilab-upload-cell-video{background-image:url(../img/ilab-icon-video.svg);background-size:60px}.ilab-upload-cell-doc{background-image:url(../img/ilab-icon-document.svg);background-size:45px}.no-mouse{cursor:default!important}.ilab-upload-item-background{position:absolute;left:-5px;top:-5px;right:-5px;bottom:-5px;background-repeat:no-repeat;background-size:cover;background-position:50%;transition:opacity .5s}.ilab-upload-status-container{position:absolute;left:0;top:0;right:0;bottom:0;display:flex;flex-direction:column;justify-content:center;align-items:center}.ilab-upload-status{color:#fff;font-weight:700;font-size:1em;text-shadow:0 0 3px #000}.ilab-upload-progress{width:80%;max-width:80%;height:9px;overflow:hidden;position:relative;margin-top:10px;border-radius:9px;background-color:hsla(0,0%,100%,.66)}.ilab-upload-progress-track{background-color:#0085ba;position:absolute;left:0;top:0;bottom:0;transition:width .125s ease-out}.ilab-upload-directions{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);font-size:2em;opacity:.5}.ilab-loader-container{display:flex;justify-content:center;align-items:center;position:absolute;left:0;top:0;right:0;bottom:0;transition:opacity .5s}.ilab-loader,.ilab-loader:after{border-radius:50%;width:24px;height:24px}.ilab-loader{font-size:5px;text-indent:-9999em;border:1.1em solid hsla(0,0%,100%,.2);border-left-color:#fff;-webkit-animation:load8 1.1s linear infinite;animation:load8 1.1s linear infinite}.ilab-loader.ilab-loader-dark{border:1.1em solid rgba(0,0,0,.2);border-left-color:#000}.ilab-upload-footer{padding-right:10px;position:absolute;left:0;right:0;border-top:1px solid #ddd;bottom:0;height:52px;background-color:#fff;display:flex;justify-content:flex-end;align-items:center;background-color:#fcfcfc;visibility:hidden}#ilab-attachment-info{position:absolute;right:-300px;top:0;bottom:54px;width:267px;transition:right .33s ease-out}.ilab-upload-insert-mode{position:relative;background-color:#fff}.ilab-upload-insert-mode div.wrap{position:absolute;left:0;top:0;right:0;bottom:52px;margin:0;padding:0 20px;overflow:auto;transition:right .33s ease-out}.ilab-upload-insert-mode div.wrap h2:first-of-type{display:none}.ilab-upload-insert-mode .ilab-upload-footer{visibility:visible}.ilab-item-selected div.wrap{right:300px}.ilab-item-selected #ilab-attachment-info{right:0}.media-cloud-upload-logo{width:240px;height:auto;margin-bottom:40px;opacity:.66;margin-top:-40px}.has-upload-message .upload-ui .media-cloud-upload-logo{display:none}.attachments-browser .upload-ui .media-cloud-upload-logo{margin-top:0}.minicolors{position:relative}.minicolors-sprite{background-image:url(../img/jquery.minicolors.png)}.minicolors-swatch{position:absolute;vertical-align:middle;background-position:-80px 0;border:1px solid #ccc;cursor:text;padding:0;margin:0;display:inline-block}.minicolors-swatch-color{position:absolute;top:0;left:0;right:0;bottom:0}.minicolors input[type=hidden]+.minicolors-swatch{width:28px;position:static;cursor:pointer}.minicolors input[type=hidden][disabled]+.minicolors-swatch{cursor:default}.minicolors-panel{position:absolute;width:173px;background:#fff;border:1px solid #ccc;box-shadow:0 0 20px rgba(0,0,0,.2);z-index:99999;box-sizing:content-box;display:none}.minicolors-panel.minicolors-visible{display:block}.minicolors-position-top .minicolors-panel{top:-154px}.minicolors-position-right .minicolors-panel{right:0}.minicolors-position-bottom .minicolors-panel{top:auto}.minicolors-position-left .minicolors-panel{left:0}.minicolors-with-opacity .minicolors-panel{width:194px}.minicolors .minicolors-grid{position:relative;top:1px;left:1px;width:150px;height:150px;margin-bottom:2px;background-position:-120px 0;cursor:crosshair}[dir=rtl] .minicolors .minicolors-grid{right:1px}.minicolors .minicolors-grid-inner{position:absolute;top:0;left:0;width:150px;height:150px}.minicolors-slider-saturation .minicolors-grid{background-position:-420px 0}.minicolors-slider-saturation .minicolors-grid-inner{background-position:-270px 0;background-image:inherit}.minicolors-slider-brightness .minicolors-grid{background-position:-570px 0}.minicolors-slider-brightness .minicolors-grid-inner{background-color:#000}.minicolors-slider-wheel .minicolors-grid{background-position:-720px 0}.minicolors-opacity-slider,.minicolors-slider{position:absolute;top:1px;left:152px;width:20px;height:150px;background-color:#fff;background-position:0 0;cursor:row-resize}[dir=rtl] .minicolors-opacity-slider,[dir=rtl] .minicolors-slider{right:152px}.minicolors-slider-saturation .minicolors-slider{background-position:-60px 0}.minicolors-slider-brightness .minicolors-slider,.minicolors-slider-wheel .minicolors-slider{background-position:-20px 0}.minicolors-opacity-slider{left:173px;background-position:-40px 0;display:none}[dir=rtl] .minicolors-opacity-slider{right:173px}.minicolors-with-opacity .minicolors-opacity-slider{display:block}.minicolors-grid .minicolors-picker{position:absolute;top:70px;left:70px;width:12px;height:12px;border:1px solid #000;border-radius:10px;margin-top:-6px;margin-left:-6px;background:none}.minicolors-grid .minicolors-picker>div{position:absolute;top:0;left:0;width:8px;height:8px;border-radius:8px;border:2px solid #fff;box-sizing:content-box}.minicolors-picker{position:absolute;top:0;left:0;width:18px;height:2px;background:#fff;border:1px solid #000;margin-top:-2px;box-sizing:content-box}.minicolors-swatches,.minicolors-swatches li{margin:5px 0 3px 5px;padding:0;list-style:none;overflow:hidden}[dir=rtl] .minicolors-swatches,[dir=rtl] .minicolors-swatches li{margin:5px 5px 3px 0}.minicolors-swatches .minicolors-swatch{position:relative;float:left;cursor:pointer;margin:0 4px 0 0}[dir=rtl] .minicolors-swatches .minicolors-swatch{float:right;margin:0 0 0 4px}.minicolors-with-opacity .minicolors-swatches .minicolors-swatch{margin-right:7px}[dir=rtl] .minicolors-with-opacity .minicolors-swatches .minicolors-swatch{margin-right:0;margin-left:7px}.minicolors-swatch.selected{border-color:#000}.minicolors-inline{display:inline-block}.minicolors-inline .minicolors-input{display:none!important}.minicolors-inline .minicolors-panel{position:relative;top:auto;left:auto;box-shadow:none;z-index:auto;display:inline-block}[dir=rtl] .minicolors-inline .minicolors-panel{right:auto}.minicolors-theme-default .minicolors-swatch{top:5px;left:5px;width:18px;height:18px}[dir=rtl] .minicolors-theme-default .minicolors-swatch{right:5px}.minicolors-theme-default .minicolors-swatches .minicolors-swatch{margin-bottom:2px;top:0;left:0;width:18px;height:18px}[dir=rtl] .minicolors-theme-default .minicolors-swatches .minicolors-swatch{right:0}.minicolors-theme-default.minicolors-position-right .minicolors-swatch{left:auto;right:5px}[dir=rtl] .minicolors-theme-default.minicolors-position-left .minicolors-swatch{right:auto;left:5px}.minicolors-theme-default.minicolors{display:inline-block}.minicolors-theme-default .minicolors-input{height:20px;width:auto;display:inline-block;padding-left:26px}[dir=rtl] .minicolors-theme-default .minicolors-input{text-align:right;unicode-bidi:-moz-plaintext;unicode-bidi:plaintext;padding-left:1px;padding-right:26px}.minicolors-theme-default.minicolors-position-right .minicolors-input{padding-right:26px;padding-left:inherit}[dir=rtl] .minicolors-theme-default.minicolors-position-left .minicolors-input{padding-right:inherit;padding-left:26px}.minicolors-theme-bootstrap .minicolors-swatch{z-index:2;top:3px;left:3px;width:28px;height:28px;border-radius:3px}[dir=rtl] .minicolors-theme-bootstrap .minicolors-swatch{right:3px}.minicolors-theme-bootstrap .minicolors-swatches .minicolors-swatch{margin-bottom:2px;top:0;left:0;width:20px;height:20px}[dir=rtl] .minicolors-theme-bootstrap .minicolors-swatches .minicolors-swatch{right:0}.minicolors-theme-bootstrap .minicolors-swatch-color{border-radius:inherit}.minicolors-theme-bootstrap.minicolors-position-right>.minicolors-swatch{left:auto;right:3px}[dir=rtl] .minicolors-theme-bootstrap.minicolors-position-left>.minicolors-swatch{right:auto;left:3px}.minicolors-theme-bootstrap .minicolors-input{float:none;padding-left:44px}[dir=rtl] .minicolors-theme-bootstrap .minicolors-input{text-align:right;unicode-bidi:-moz-plaintext;unicode-bidi:plaintext;padding-left:12px;padding-right:44px}.minicolors-theme-bootstrap.minicolors-position-right .minicolors-input{padding-right:44px;padding-left:12px}[dir=rtl] .minicolors-theme-bootstrap.minicolors-position-left .minicolors-input{padding-right:12px;padding-left:44px}.minicolors-theme-bootstrap .minicolors-input.input-lg+.minicolors-swatch{top:4px;left:4px;width:37px;height:37px;border-radius:5px}[dir=rtl] .minicolors-theme-bootstrap .minicolors-input.input-lg+.minicolors-swatch{right:4px}.minicolors-theme-bootstrap .minicolors-input.input-sm+.minicolors-swatch{width:24px;height:24px}.minicolors-theme-bootstrap .minicolors-input.input-xs+.minicolors-swatch{width:18px;height:18px}.input-group .minicolors-theme-bootstrap:not(:first-child) .minicolors-input{border-top-left-radius:0;border-bottom-left-radius:0}[dir=rtl] .input-group .minicolors-theme-bootstrap .minicolors-input{border-radius:4px}[dir=rtl] .input-group .minicolors-theme-bootstrap:not(:first-child) .minicolors-input{border-top-right-radius:0;border-bottom-right-radius:0}[dir=rtl] .input-group .minicolors-theme-bootstrap:not(:last-child) .minicolors-input{border-top-left-radius:0;border-bottom-left-radius:0}[dir=rtl] .input-group-addon,[dir=rtl] .input-group-btn>.btn,[dir=rtl] .input-group-btn>.btn-group>.btn,[dir=rtl] .input-group-btn>.dropdown-toggle,[dir=rtl] .input-group .form-control{border:1px solid #ccc;border-radius:4px}[dir=rtl] .input-group-addon:first-child,[dir=rtl] .input-group-btn:first-child>.btn,[dir=rtl] .input-group-btn:first-child>.btn-group>.btn,[dir=rtl] .input-group-btn:first-child>.dropdown-toggle,[dir=rtl] .input-group-btn:last-child>.btn-group:not(:last-child)>.btn,[dir=rtl] .input-group-btn:last-child>.btn:not(:last-child):not(.dropdown-toggle),[dir=rtl] .input-group .form-control:first-child{border-top-left-radius:0;border-bottom-left-radius:0;border-left:0}[dir=rtl] .input-group-addon:last-child,[dir=rtl] .input-group-btn:first-child>.btn-group:not(:first-child)>.btn,[dir=rtl] .input-group-btn:first-child>.btn:not(:first-child),[dir=rtl] .input-group-btn:last-child>.btn,[dir=rtl] .input-group-btn:last-child>.btn-group>.btn,[dir=rtl] .input-group-btn:last-child>.dropdown-toggle,[dir=rtl] .input-group .form-control:last-child{border-top-right-radius:0;border-bottom-right-radius:0}.minicolors-theme-semanticui .minicolors-swatch{top:0;left:0;padding:18px}[dir=rtl] .minicolors-theme-semanticui .minicolors-swatch{right:0}.minicolors-theme-semanticui input{text-indent:30px}.imgix-preview-image{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);max-width:100%;max-height:100%;display:block;pointer-events:none}.imgix-parameters-container{position:absolute;left:0;top:0;bottom:0;right:0;overflow-x:hidden;overflow-y:auto;display:flex;flex-direction:column;padding:15px 10px}.imgix-parameters-container.is-hidden{display:none}.imgix-parameters-container .imgix-parameter-group select{font-size:12px}.imgix-parameters-container .imgix-parameter-group h4{margin:0;font-size:10px;text-transform:uppercase;color:#999;background-color:#ddd;padding:5px 15px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.imgix-parameters-container .imgix-parameter-group>div{padding:15px}.imgix-parameter{position:relative;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;padding-bottom:15px;margin-bottom:15px}.imgix-parameter .imgix-param-imagick-warning{position:absolute;left:-10px;top:-5px;right:-10px;bottom:0;padding:0 5px;display:flex;align-items:center;justify-content:center;background:hsla(0,0%,100%,.8)}.imgix-parameter .imgix-param-imagick-warning>div{text-align:center}.imgix-parameter:last-of-type{margin-bottom:0;padding-bottom:0}.imgix-param-title{display:flex;align-items:baseline;margin-bottom:0}.imgix-param-title-colortype{align-items:center!important;margin-bottom:8px}.imgix-param-title-colortype h3{margin:0!important}.imgix-param-title-left{flex:1 50%}.imgix-param-title-right{flex:1 50%;padding-left:40px;text-align:right;position:relative}.imgix-param-title-right h3{text-align:right}.imgix-param-blend-mode h3,.imgix-param-title h3{margin-top:0;font-size:11px;text-transform:uppercase;color:#666}.imgix-media-param-title .imgix-param-title-left{flex:2 80%}.imgix-media-param-title .imgix-param-title-right{flex:1 20%}.imgix-media-param-title .imgix-param-title-right a{text-align:center!important}.minicolors-theme-default.minicolors{width:auto;display:block;padding:0!important;margin:0;min-height:29px}.ilab-color-input{position:relative;top:0;right:0;height:30px!important;margin:0!important;padding-left:8px!important;padding-right:30px!important}.imgix-param-blend-mode{margin-top:15px;display:flex;align-items:baseline}.imgix-param-blend-mode h3{flex:1 50%}.imgix-param-blend-mode select{flex:2 100%}.imgix-parameter input[type=range]{display:block;width:100%;-webkit-appearance:none;margin:0 0 10px;background:none;padding:0!important}.imgix-parameter input[type=range]:focus{outline:none}.imgix-parameter input[type=range]:focus::-webkit-slider-runnable-track{background:#fff}.imgix-parameter input[type=range]::-webkit-slider-runnable-track{width:100%;height:5px;cursor:pointer;animate:.2s;box-shadow:inset 1px 1px 2px 0 rgba(0,0,0,.25);background:#d4cfd4;border-radius:4px;border:0 solid #000101}.imgix-parameter input[type=range]::-webkit-slider-thumb{border:1px solid rgba(0,0,0,.25);box-shadow:inset 0 2px 2px 0 hsla(0,0%,100%,.5);height:17px;width:17px;border-radius:9px;background:#dcdcdc;cursor:pointer;-webkit-appearance:none;margin-top:-6px}.imgix-parameter input[type=range]::-moz-range-track{width:100%;height:5px;cursor:pointer;animate:.2s;box-shadow:inset 1px 1px 2px 0 rgba(0,0,0,.25);background:#d4cfd4;border-radius:4px;border:0 solid #000101}.imgix-parameter input[type=range]::-moz-range-thumb{border:1px solid rgba(0,0,0,.25);box-shadow:inset 0 2px 2px 0 hsla(0,0%,100%,.5);height:17px;width:17px;border-radius:9px;background:#dcdcdc;cursor:pointer;-webkit-appearance:none;margin-top:-6px}.imgix-parameter .imgix-param-reset{display:flex;width:100%;justify-content:flex-end}.imgix-parameter .imgix-param-reset a{font-size:11px;font-style:italic;text-decoration:none}.imgix-parameter .imgix-param-reset a,.imgix-parameter a:focus{outline:none!important;border:0!important}.imgix-media-preview{position:relative;margin:0!important;padding:0 0 100%!important;background-image:url(../img/ilab-imgix-edit-bg.png);width:100%}.imgix-media-preview img{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);max-width:100%;max-height:100%;display:block}.imgix-media-preview-inner{position:absolute;left:0;right:0;bottom:0;top:0;display:flex;align-items:center;justify-content:center}.imgix-alignment-container{display:flex;flex:row;flex-wrap:wrap;justify-content:space-around;align-items:baseline;padding:0 35px}.imgix-alignment-button{background-color:#ddd;display:block;width:60px;height:60px;margin:5px;text-decoration:none;border-radius:4px;border:1px solid #888;box-shadow:inset 0 1px 0 #fff,0 1px 0 rgba(0,0,0,.15)!important}.selected-alignment{background-color:#bbb;box-shadow:inset 1px 1px 1px rgba(0,0,0,.25),0 1px 0 rgba(0,0,0,.15)!important}.ilabm-pillbox{flex-wrap:wrap;border-bottom:0!important}.ilabm-pillbox,.ilabm-pillbox .ilabm-pill{align-items:center;display:flex;justify-content:center}.ilabm-pillbox .ilabm-pill{white-space:nowrap;line-height:1;height:14px;min-height:32px;width:140px;min-width:140px;max-width:140px;font-size:10px;background-color:#eaeaea;text-transform:uppercase;font-weight:700;color:#444;text-decoration:none;border-radius:8px;margin:3px}.ilabm-pillbox .ilabm-pill span{display:block;margin-right:8px}.ilabm-pillbox .ilabm-pill span.icon{width:18px;height:18px;min-width:18px;min-height:18px;max-width:18px;max-height:18px;background-repeat:no-repeat;background-position:50%;background-size:contain;margin-left:8px}.ilabm-pillbox .pill-selected{background-color:#ccc;box-shadow:inset 1px 1px 1px rgba(0,0,0,.25);color:#fff}.ilabm-pillbox-no-icon .ilabm-pill{width:100px;min-width:100px;max-width:100px}.ilabm-pillbox-no-icon .ilabm-pill span{margin-right:0}.ilabm-pillbox-no-icon .ilabm-pill span.icon{display:none}.imgix-pill-enhance>span.icon{background-image:url(../img/ilab-imgix-magic-wand-black.svg)}.imgix-pill-enhance.pill-selected>span.icon{background-image:url(../img/ilab-imgix-magic-wand-white.svg)}.imgix-pill-redeye>span.icon{background-image:url(../img/ilab-imgix-red-eye-black.svg)}.imgix-pill-redeye.pill-selected>span.icon{background-image:url(../img/ilab-imgix-red-eye-white.svg)}.imgix-pill-usefaces>span.icon{background-image:url(../img/ilab-imgix-faces-black.svg)}.imgix-pill-usefaces.pill-selected>span.icon{background-image:url(../img/ilab-imgix-faces-white.svg)}.imgix-pill-focalpoint>span.icon{background-image:url(../img/ilab-imgix-focalpoint-black.svg)}.imgix-pill-focalpoint.pill-selected>span.icon{background-image:url(../img/ilab-imgix-focalpoint-white.svg)}.imgix-pill-entropy>span.icon{background-image:url(../img/ilab-imgix-chaos-black.svg)}.imgix-pill-entropy.pill-selected>span.icon{background-image:url(../img/ilab-imgix-chaos-white.svg)}.imgix-pill-edges>span.icon{background-image:url(../img/ilab-imgix-edges-black.svg)}.imgix-pill-edges.pill-selected>span.icon{background-image:url(../img/ilab-imgix-edges-white.svg)}.imgix-pill-h>span.icon{background-image:url(../img/ilab-flip-horizontal-black.svg)}.imgix-pill-h.pill-selected>span.icon{background-image:url(../img/ilab-flip-horizontal-white.svg)}.imgix-pill-v>span.icon{background-image:url(../img/ilab-flip-vertical-black.svg)}.imgix-pill-v.pill-selected>span.icon{background-image:url(../img/ilab-flip-vertical-white.svg)}.imgix-pill-clip>span.icon{background-image:url(../img/ilab-imgix-clip-black.svg)}.imgix-pill-clip.pill-selected>span.icon{background-image:url(../img/ilab-imgix-clip-white.svg)}.imgix-pill-crop>span.icon{background-image:url(../img/ilab-imgix-crop-black.svg)}.imgix-pill-crop.pill-selected>span.icon{background-image:url(../img/ilab-imgix-crop-white.svg)}.imgix-pill-max>span.icon{background-image:url(../img/ilab-imgix-max-black.svg)}.imgix-pill-max.pill-selected>span.icon{background-image:url(../img/ilab-imgix-max-white.svg)}.imgix-pill-scale>span.icon{background-image:url(../img/ilab-imgix-scale-black.svg)}.imgix-pill-scale.pill-selected>span.icon{background-image:url(../img/ilab-imgix-scale-white.svg)}.imgix-preset-make-default-container{align-items:center;display:flex;min-height:30px;margin-left:10px}.imgix-preset-container{align-items:center;display:flex}.imgix-preset-container.is-hidden,.imgix-preset-make-default-container.is-hidden{display:none}.imgix-param-label{font-style:italic;text-transform:none!important}.imgix-label-editor{position:absolute;right:-4px;top:0;width:40px;font-size:11px;padding:1px;text-align:right}.ilabm-focal-point-icon{position:absolute;background-image:url(../img/ilab-imgix-focalpoint-icon.svg);width:24px;height:24px;background-size:contain;pointer-events:none}.ilab-face-outline{position:absolute;border:3px solid #fff;-webkit-filter:drop-shadow(0 2px 3px #000);filter:drop-shadow(0 2px 3px black);opacity:.33;z-index:999;cursor:pointer}.ilab-face-outline span{display:block;position:absolute;background-color:#fff;color:#000;font-size:9px;width:12px;height:12px;text-align:center;font-weight:700;line-height:1}.ilab-face-outline.active{opacity:1;z-index:1000}.ilab-all-faces-outline{position:absolute;border:3px solid #fff;-webkit-filter:drop-shadow(0 2px 3px #000);filter:drop-shadow(0 2px 3px black)}input[type=range].imgix-param{-webkit-appearance:none;-moz-appearance:none;appearance:none}input[type=range].imgix-param:focus{outline:none}input[type=range].imgix-param:focus::-webkit-slider-runnable-track{background:#bababa}input[type=range].imgix-param::-webkit-slider-runnable-track{width:100%;height:17px;cursor:pointer;animate:.2s;background:#cfcfcf;border-radius:17px;box-shadow:none}input[type=range].imgix-param::-moz-range-track{width:100%;height:17px;cursor:pointer;animate:.2s;background:#cfcfcf;border-radius:17px;box-shadow:none}input[type=range].imgix-param::-webkit-slider-thumb{-webkit-appearance:none;cursor:pointer;width:18px;height:17px;border-radius:17px;margin-top:0}input[type=range].imgix-param::-moz-range-thumb{-webkit-appearance:none;cursor:pointer;width:18px;height:17px;border-radius:17px;margin-top:0}.ilab-crop-preview{overflow:hidden;max-width:100%;max-height:100%}.ilab-crop-now-wrapper{margin-top:12px}.ilabc-cropper{max-width:100%;max-height:100%}.ilabm-sidebar-content-cropper{flex-direction:column!important;padding:10px;overflow:scroll}.ilabm-sidebar-content-cropper h3{margin-top:0;font-size:11px;text-transform:uppercase;color:#888;font-weight:700}.cropper-dashed.dashed-h{top:38.4615385%;height:23.076923%}.cropper-dashed.dashed-v{left:38.4615385%;width:23.076923%}.ilabc-current-crop-container{position:relative;margin-bottom:15px}.ilabc-crop-preview-container,.ilabc-current-crop-container{background-image:url(../img/ilab-imgix-edit-bg.png);display:flex;align-items:center;justify-content:center;flex:1}.ilab-current-crop-img{position:absolute;-o-object-fit:contain;object-fit:contain;padding:0!important;margin:0!important;height:100%;width:100%}#ilab-crop-aspect-checkbox-container{display:flex;align-items:center}#ilab-crop-aspect-checkbox-container input{margin:0 8px 0 0;padding:0}#ilab-s3-info-meta .inside{padding:0 5px 10px}.info-panel-tabs{margin:-7px -5px 0;padding:6px 10px 0;background-color:rgba(0,0,0,.125)}.info-panel-tabs ul{display:flex;margin:0;padding:0;height:100%}.info-panel-tabs ul li{padding:5px 10px;font-size:11px;text-transform:uppercase;margin:0 10px 0 0;display:block;background-color:rgba(0,0,0,.0625);cursor:pointer;font-weight:700}.info-panel-tabs ul li.info-panel-missing-sizes{color:#9e0000}.info-panel-tabs ul li.active{background-color:#fff}.info-panel-contents{padding:15px 10px 0}.info-panel-contents .info-line{display:flex;flex-direction:column;margin-bottom:15px}.info-panel-contents .info-line h3,.info-panel-contents .info-line label{font-size:11px;text-transform:uppercase;margin:0;font-weight:700}.info-panel-contents .info-line label{margin-bottom:4px}.info-panel-contents .info-line select{font-size:12px!important}.info-panel-contents .info-line a{white-space:nowrap;text-overflow:ellipsis;overflow:hidden}.info-panel-contents .info-line-form{border-top:1px solid #ddd;padding-top:8px}.info-panel-contents .info-line-form h3{margin-top:8px;margin-bottom:12px}.info-panel-contents .info-line-form .info-line-form-row{margin-bottom:8px}.info-panel-contents .info-line-form .info-line-form-buttons{margin-top:8px}.info-panel-contents .info-notice{padding:10px 5px 20px}.info-panel-contents .info-size-selector{margin-bottom:15px}.info-panel-contents .info-line-note{color:grey;font-style:italic;margin-top:4px;margin-bottom:8px}.info-panel-contents .button-row{margin-bottom:15px;border-top:1px solid #eaeaea;padding-top:15px;display:flex;justify-content:flex-end;align-items:center}.info-panel-contents .button-row #ilab-info-regenerate-status{display:flex;padding:0;justify-content:center;align-items:center;width:100%;font-size:12px}.info-panel-contents .button-row #ilab-info-regenerate-status .spinner{float:none;display:block;margin:0 8px 0 0;width:16px;height:16px;background-size:16px 16px}.info-panel-contents .links-row{display:flex;align-items:center;justify-content:center;background-color:rgba(0,0,0,.05);border:1px solid rgba(0,0,0,.1);border-radius:8px;padding:10px 0;margin-bottom:15px}.info-panel-contents .links-row a{color:#000;display:flex;align-items:center;margin-right:20px;text-decoration:none;text-transform:uppercase;font-weight:700;font-size:11px}.info-panel-contents .links-row a:last-of-type{margin-right:0}.info-panel-contents .links-row a .dashicons{margin-right:3px;width:16px;height:16px;font-size:16px}#ilab-media-grid-info-popup{position:absolute;z-index:170000;opacity:1;transition:opacity .33s;-webkit-filter:drop-shadow(0 0 5px rgba(50,50,50,.5));filter:drop-shadow(0 0 5px rgba(50,50,50,.5));display:flex;align-items:center}#ilab-media-grid-info-popup.hidden{opacity:0;pointer-events:none}#ilab-media-grid-info-popup h2{text-transform:uppercase;font-size:9px;padding:4px 10px;margin:0;color:rgba(0,0,0,.33)}#ilab-media-grid-info-popup .ilab-media-grid-info-popup-content{min-height:604px;background-color:#fff;width:275px;max-width:275px;padding-bottom:1px;display:flex;flex-direction:column;position:relative}#ilab-media-grid-info-popup .ilab-media-grid-info-popup-content .info-panel-tabs{margin:0}#ilab-media-grid-info-popup .ilab-media-grid-info-popup-content .info-panel-contents>div{display:flex;flex-direction:column}#ilab-media-grid-info-popup .ilab-media-grid-info-popup-content .info-panel-contents>div>div{flex:1}#ilab-media-grid-info-popup .ilab-media-grid-info-popup-content .info-panel-contents .info-file-info-size{flex-grow:1;display:flex;flex-direction:column}#ilab-media-grid-info-popup .ilab-media-grid-info-popup-content .button-row{position:absolute;bottom:0;right:0;left:0}#ilab-media-grid-info-popup .ilab-media-grid-info-popup-content .ilab-loader-container{display:flex;justify-content:center;align-items:center;position:absolute;left:0;top:0;right:0;bottom:0;transition:opacity .5s}#ilab-media-grid-info-popup .ilab-media-grid-info-popup-content .ilab-loader,#ilab-media-grid-info-popup .ilab-media-grid-info-popup-content .ilab-loader:after{border-radius:50%;width:24px;height:24px}#ilab-media-grid-info-popup .ilab-media-grid-info-popup-content .ilab-loader{font-size:5px;text-indent:-9999em;border:1.1em solid hsla(0,0%,100%,.2);border-left-color:#fff;-webkit-animation:load8 1.1s linear infinite;animation:load8 1.1s linear infinite}#ilab-media-grid-info-popup .ilab-media-grid-info-popup-content .ilab-loader.ilab-loader-dark{border:1.1em solid rgba(0,0,0,.2);border-left-color:#000}@-webkit-keyframes load8{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}@keyframes load8{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}#ilab-media-grid-info-popup .ilab-media-popup-arrow-left{width:45px;display:flex;justify-content:flex-end}#ilab-media-grid-info-popup .ilab-media-popup-arrow-left>div{width:0;height:0;border-color:transparent #fff transparent transparent;border-style:solid;border-width:9px 15.6px 9px 0}#ilab-media-grid-info-popup .ilab-media-popup-arrow-right{width:45px;display:flex;justify-content:flex-start}#ilab-media-grid-info-popup .ilab-media-popup-arrow-right>div{width:0;height:0;border-color:transparent transparent transparent #fff;border-style:solid;border-width:9px 0 9px 15.6px;margin-right:30px}#ilab-media-grid-info-popup.popup-left .ilab-media-popup-arrow-right,#ilab-media-grid-info-popup.popup-right .ilab-media-popup-arrow-left{display:none}li.attachment{transition:opacity .3s ease-out,transform .3s ease-out,box-shadow .3s ease-out}li.attachment .ilab-loader-container{z-index:100}li.attachment.info-focused{transform:scale(1.1)}li.attachment.info-focused>div:first-of-type{box-shadow:0 0 5px 0 rgba(50,50,50,.5)}li.attachment.info-unfocused{opacity:.33}#ilab-media-grid-info-popup.ilab-popup-document h2{background-color:rgba(0,0,0,.125);color:#000}#ilab-media-grid-info-popup.ilab-popup-document .info-panel-contents{padding:10px 10px 0}#ilab-media-grid-info-popup.ilab-popup-document .ilab-media-grid-info-popup-content{min-height:484px}table.ilab-image-sizes{border-collapse:collapse;width:100%}table.ilab-image-sizes td,table.ilab-image-sizes th{padding:10px}table.ilab-image-sizes td.center{text-align:center}table.ilab-image-sizes thead th{border:2px solid #f1f1f1;background-color:#dadada}table.ilab-image-sizes tr{border-bottom:1px solid #dadada}.ilab-add-image-size-backdrop{display:flex;align-items:center;justify-content:center}.ilab-add-image-size-container{left:auto;right:auto;bottom:auto;top:auto}.ilab-new-image-size-form{padding:20px;display:flex;flex-direction:column}.ilab-new-image-size-form div.row{display:flex;align-items:center;margin-bottom:15px}.ilab-new-image-size-form div.row>label{width:90px;text-align:right;margin-right:15px;font-weight:700}.ilab-new-image-size-form div.button-row{padding:10px;text-align:right}.ilab-delete-size-button{font-size:0;display:inline-block;width:18px;height:18px;background-image:url(../img/ilab-ui-icon-trash.svg);background-size:contain;background-position:50%;background-repeat:no-repeat;background-size:12px;margin-right:10px}.ilab-delete-size-button.disabled{opacity:.33;pointer-events:none}.ilab-delete-size-button:hover{background-image:url(../img/ilab-ui-icon-trash-hover.svg)}.ilab-size-settings-button{font-size:0;display:inline-block;width:18px;height:18px;background-image:url(../img/ilab-ui-icon-settings.svg);background-size:contain;background-position:50%;background-repeat:no-repeat;background-size:14px}.ilab-size-settings-button.disabled{opacity:.33;pointer-events:none}.ilab-size-settings-button:hover{background-image:url(../img/ilab-ui-icon-settings-hover.svg)}.ilab-browser-select-table-container table,.ilab-storage-browser table{border-collapse:collapse;width:100%;font-size:1.1em}.ilab-browser-select-table-container table td,.ilab-browser-select-table-container table th,.ilab-storage-browser table td,.ilab-storage-browser table th{padding:12px}.ilab-browser-select-table-container table thead tr th,.ilab-storage-browser table thead tr th{text-align:left;border:2px solid #f1f1f1;background-color:#dadada}.ilab-browser-select-table-container table thead tr th.checkbox,.ilab-storage-browser table thead tr th.checkbox{max-width:30px;width:30px;text-align:center}.ilab-browser-select-table-container table tbody tr,.ilab-storage-browser table tbody tr{transition:background-color .125s linear;cursor:pointer}.ilab-browser-select-table-container table tbody tr:hover,.ilab-storage-browser table tbody tr:hover{background-color:#fff}.ilab-browser-select-table-container table tbody tr input[type=checkbox],.ilab-storage-browser table tbody tr input[type=checkbox]{z-index:1000}.ilab-browser-select-table-container table tbody tr td,.ilab-storage-browser table tbody tr td{text-decoration:none}.ilab-browser-select-table-container table tbody tr td.checkbox,.ilab-storage-browser table tbody tr td.checkbox{max-width:30px;width:30px;text-align:center}.ilab-browser-select-table-container table tbody tr td.entry,.ilab-storage-browser table tbody tr td.entry{display:flex;align-items:center}.ilab-browser-select-table-container table tbody tr td.actions,.ilab-storage-browser table tbody tr td.actions{text-align:center;width:130px;max-width:130px}.ilab-browser-select-table-container table tbody tr td.actions .button-delete,.ilab-storage-browser table tbody tr td.actions .button-delete{margin-right:0;margin-left:10px;color:#fff;border-color:#920002;background:#ca0002;box-shadow:0 1px 0 #cc0005}.ilab-browser-select-table-container table tbody tr td.actions .button-delete svg,.ilab-storage-browser table tbody tr td.actions .button-delete svg{height:14px}.ilab-browser-select-table-container table tbody tr td.actions .button-delete.disabled,.ilab-storage-browser table tbody tr td.actions .button-delete.disabled{color:#ff6468!important;border-color:#920002!important;background:#c6282a!important;box-shadow:0 1px 0 #cc0005!important;text-shadow:0 1px 0 #cc0005!important}.ilab-browser-select-table-container table tbody tr td.actions .button-delete.disabled svg>path,.ilab-browser-select-table-container table tbody tr td.actions .button-delete.disabled svg>rect,.ilab-storage-browser table tbody tr td.actions .button-delete.disabled svg>path,.ilab-storage-browser table tbody tr td.actions .button-delete.disabled svg>rect{fill:#ff6468}.ilab-browser-select-table-container table tbody tr td img.loader,.ilab-storage-browser table tbody tr td img.loader{display:none;margin-right:10px;width:16px;height:16px}.ilab-browser-select-table-container table tbody tr td span,.ilab-storage-browser table tbody tr td span{display:block;width:16px;height:16px;background-size:contain;background-repeat:no-repeat;margin-right:10px}.ilab-browser-select-table-container table tbody tr td span.icon-dir,.ilab-storage-browser table tbody tr td span.icon-dir{background-image:url(../img/ilab-ui-icon-folder.svg)}.ilab-browser-select-table-container table tbody tr td span.icon-file,.ilab-storage-browser table tbody tr td span.icon-file{background-image:url(../img/ilab-ui-icon-file.svg)}.ilab-browser-select-table-container table tbody tr td span.icon-up,.ilab-storage-browser table tbody tr td span.icon-up{background-image:url(../img/ilab-ui-icon-up-dir.svg)}.ilab-browser-select-table-container table tr,.ilab-storage-browser table tr{border-bottom:1px solid #dadada}.mcsb-buttons .button{margin-right:5px;display:flex;align-items:center}.mcsb-buttons .button svg{height:16px;width:auto;margin-right:8px}.mcsb-buttons .button svg>path,.mcsb-buttons .button svg>rect{fill:#fff}.mcsb-buttons .button-primary.disabled svg>path,.mcsb-buttons .button-primary.disabled svg>rect{fill:#66c6e4}.mcsb-buttons .button-create-folder svg{height:12px}.mcsb-buttons .button-import{margin-left:10px}.mcsb-buttons .button-import svg{height:14px}.mcsb-buttons .button-delete{margin-right:0;margin-left:10px;color:#fff;border-color:#920002;background:#ca0002;box-shadow:0 1px 0 #cc0005}.mcsb-buttons .button-delete svg{height:14px}.mcsb-buttons .button-delete.disabled{color:#ff6468!important;border-color:#920002!important;background:#c6282a!important;box-shadow:0 1px 0 #cc0005!important;text-shadow:0 1px 0 #cc0005!important}.mcsb-buttons .button-delete.disabled svg>path,.mcsb-buttons .button-delete.disabled svg>rect{fill:#ff6468}.mcsb-buttons .button-cancel{color:#fff;border-color:#920002;background:#ca0002;text-shadow:0 1px 0 #cc0005!important;box-shadow:0 1px 0 #cc0005}.mcsb-buttons .button-cancel:hover{border-color:#9f0002;background:#d80002;text-shadow:0 1px 0 #d60005!important;box-shadow:0 1px 0 #d60005}.mcsb-actions{margin-bottom:18px;font-size:1.1em}.mcsb-actions,.mcsb-actions div.mcsb-action-buttons{display:flex;align-items:center}.ilab-storage-browser-header{flex:1;padding:14px 9px;box-shadow:inset 0 0 3px 0 rgba(0,0,0,.125);border:1px solid #ddd;border-radius:8px;margin-right:18px}.ilab-storage-browser-header ul{margin:0;padding:0;display:flex}.ilab-storage-browser-header ul li{padding:0;position:relative;display:block;margin:0 30px 0 0}.ilab-storage-browser-header ul li a{text-decoration:none}.ilab-storage-browser-header ul li:first-of-type{padding-left:35px}.ilab-storage-browser-header ul li:first-of-type:before{background-image:url(../img/ilab-ui-icon-folder.svg);width:16px;height:16px;left:0}.ilab-storage-browser-header ul li:after,.ilab-storage-browser-header ul li:first-of-type:before{content:" ";position:absolute;background-size:contain;background-position:50%;background-repeat:no-repeat;top:50%;margin-left:10px;transform:translateY(-50%)}.ilab-storage-browser-header ul li:after{background-image:url(../img/ilab-ui-path-divider.svg);width:9px;height:9px}.ilab-storage-browser-header ul li:last-of-type:after{display:none}#mcsb-progress-modal{z-index:10000;position:fixed;left:0;top:0;right:0;bottom:0;background:rgba(0,0,0,.66);display:flex;align-items:center;justify-content:center;transition:opacity .15s linear;opacity:1;pointer-events:none}#mcsb-progress-modal.hidden{opacity:0}#mcsb-progress-modal .mcsb-progress-container{min-width:40vw;background-color:#fff;padding:30px}#mcsb-progress-modal .mcsb-progress-container .mcsb-progress-label{font-weight:700;font-size:1.1em;margin-bottom:20px}#mcsb-progress-modal .mcsb-progress-container .mcsb-progress-bar{position:relative;background-color:#eaeaea;height:24px;border-radius:12px;overflow:hidden}#mcsb-progress-modal .mcsb-progress-container .mcsb-progress-bar #mcsb-progress{position:absolute;left:0;top:0;bottom:0;background-color:#4f90c4}#mcsb-import-options-modal{z-index:10000;position:fixed;left:0;top:0;right:0;bottom:0;background:rgba(0,0,0,.66);display:flex;align-items:center;justify-content:center;transition:opacity .15s linear;opacity:1;pointer-events:none}#mcsb-import-options-modal.hidden{opacity:0}#mcsb-import-options-modal.hidden .mcsb-import-options-container{pointer-events:none}#mcsb-import-options-modal .mcsb-import-options-container{min-width:40vw;max-width:800px;background-color:#fff;padding:30px;pointer-events:all;display:flex;flex-direction:column}#mcsb-import-options-modal .mcsb-import-options-container h3{display:block;padding:0;margin:0 0 25px;position:relative;font-weight:700;font-size:1.125em}#mcsb-import-options-modal .mcsb-import-options-container div.mcsb-import-options{margin-bottom:50px}#mcsb-import-options-modal .mcsb-import-options-container div.mcsb-import-options ul{display:grid;grid-template-columns:repeat(1,1fr);grid-row-gap:20px;grid-column-gap:10px}#mcsb-import-options-modal .mcsb-import-options-container div.mcsb-import-options ul li{display:flex;align-items:flex-start}#mcsb-import-options-modal .mcsb-import-options-container div.mcsb-import-options ul li h4{margin:0;padding:0;font-size:1em}#mcsb-import-options-modal .mcsb-import-options-container div.mcsb-import-options ul li .mcsb-option{padding-top:2px}#mcsb-import-options-modal .mcsb-import-options-container div.mcsb-import-options ul li .mcsb-option-description{margin-left:15px}#mcsb-import-options-modal .mcsb-import-options-container div.mcsb-import-buttons{display:flex;justify-content:flex-end}#mcsb-import-options-modal .mcsb-import-options-container div.mcsb-import-buttons .button{margin:0 0 0 20px}#ilab-upload-target{position:fixed;left:0;right:0;bottom:0;top:0;display:flex;justify-content:center;align-items:center;font-size:2em;font-weight:700;color:#fff;background-color:rgba(28,90,129,.75);z-index:100000;transition:opacity .125s linear;opacity:0;pointer-events:none}#wpbody.drag-inside #ilab-upload-target{opacity:1}#mcsb-upload-modal{position:fixed;left:0;right:0;bottom:0;top:0;display:flex;justify-content:center;align-items:center;background:rgba(0,0,0,.66);z-index:100000;transition:opacity .125s linear;opacity:1}#mcsb-upload-modal.hidden{opacity:0;pointer-events:none}#mcsb-upload-modal #mcsb-upload-container{min-width:630px;min-height:385px;background-color:#fff;display:flex;flex-direction:column}#mcsb-upload-modal #mcsb-upload-container div.mcsb-upload-header{padding:20px;position:relative;font-weight:700}#mcsb-upload-modal #mcsb-upload-container div.mcsb-upload-items{position:relative;flex:1;background-color:#eaeaea}#mcsb-upload-modal #mcsb-upload-container div.mcsb-upload-items #mcsb-upload-items-container{padding:15px;position:absolute;left:0;top:0;right:0;bottom:0;overflow:auto;display:flex;flex-wrap:wrap}.ilab-browser-select{position:absolute;left:0;top:0;width:100%;height:100%;display:flex;flex-direction:column}.ilab-browser-select .ilab-browser-select-header{height:48px;min-height:48px;padding-left:12px;padding-right:64px;display:flex;align-items:center}.ilab-browser-select .ilab-browser-select-header input{flex:1;padding:7px 11px;border-radius:4px}.ilab-browser-select .ilab-browser-select-header input:disabled{color:#000}.ilab-browser-select .ilab-browser-select-table-container{flex:1;overflow-y:auto;background-color:#efefef}.ilab-browser-select .ilab-browser-select-footer{height:48px;min-height:48px;display:flex;align-items:center;justify-content:flex-end;padding-right:12px}.ilab-browser-select .ilab-browser-select-footer .button{margin-left:12px}.mcsb-modal-contents{border-radius:8px}.mcsb-modal-contents h3{background-image:url(../img/icon-cloud.svg);background-position:0;background-repeat:no-repeat;background-size:44px 44px;padding:12px 0 12px 60px!important}#task-manager div.available-tasks{padding:15px 20px 10px;display:flex;flex-direction:column;border-radius:8px;margin-bottom:25px;margin-top:30px;background-color:#e4e4e4}#task-manager div.available-tasks h2{margin:0 0 15px;padding:0;text-transform:uppercase;font-size:11px;color:#777}#task-manager div.available-tasks div.buttons{display:flex;flex-wrap:wrap}#task-manager div.available-tasks div.buttons .button{margin:0 10px 10px 0}#task-manager div.task-list{padding:18px 20px;border-radius:8px;background-color:#e4e4e4;margin-bottom:25px}#task-manager div.task-list h2{margin:0 0 15px;padding:0;text-transform:uppercase;font-size:11px;color:#777;display:flex;align-items:center;justify-content:space-between}#task-manager div.task-list table.task-table{width:100%;font-size:.9em}#task-manager div.task-list table.task-table td,#task-manager div.task-list table.task-table th{text-align:left;white-space:nowrap;padding:10px 20px;background-color:#efefef}#task-manager div.task-list table.task-table td.progress,#task-manager div.task-list table.task-table td.schedule,#task-manager div.task-list table.task-table th.progress,#task-manager div.task-list table.task-table th.schedule{width:100%}#task-manager div.task-list table.task-table th{background-color:#3a5674;color:#fff}#task-manager div.task-list table.task-table th:first-of-type{border-top-left-radius:4px}#task-manager div.task-list table.task-table th:last-of-type{border-top-right-radius:4px}#task-manager div.task-list table.task-table td.status{text-transform:capitalize}#task-manager div.task-list table.task-table td.status.status-complete{font-weight:700;color:green}#task-manager div.task-list table.task-table td.status.status-error{font-weight:700;color:#a70000}#task-manager div.task-list table.task-table td.progress{position:relative}#task-manager div.task-list table.task-table td.progress div.progress-bar{position:absolute;left:10px;top:10px;bottom:10px;right:10px;background-color:#ccc;display:flex;align-items:center;justify-content:center;overflow:hidden;border-radius:4px}#task-manager div.task-list table.task-table td.progress div.progress-bar .bar{position:absolute;left:0;top:0;bottom:0;width:75%;background-color:#50ade2}#task-manager div.task-list table.task-table td.progress div.progress-bar .amount{z-index:2;color:#fff;font-weight:700}#task-manager div.task-list table.task-table tbody tr:last-of-type td:first-of-type{border-bottom-left-radius:4px}#task-manager div.task-list table.task-table tbody tr:last-of-type td:last-of-type{border-bottom-right-radius:4px}.task-options-modal{position:fixed;left:0;top:0;right:0;bottom:0;background:rgba(0,0,0,.75);z-index:100000;display:flex;align-items:center;justify-content:center;transition:opacity .25s linear}.task-options-modal.invisible{opacity:0}.task-options-modal.invisible .task-modal{transform:scale(.95)}.task-options-modal .task-modal{background-color:#fff;padding:30px;border-radius:8px;transition:transform .25s ease-in-out}.task-options-modal .task-modal h2{padding:0;font-size:1.2em;margin:0 0 40px}.task-options-modal .task-modal form ul{padding:0;display:flex;flex-direction:column;margin:20px 0 0}.task-options-modal .task-modal form ul li{display:flex;margin-bottom:30px}.task-options-modal .task-modal form ul li:last-of-type{margin-bottom:0}.task-options-modal .task-modal form ul li>div:first-of-type{padding:10px 10px 20px 0;width:160px;min-width:160px;line-height:1.3;font-weight:600}.task-options-modal .task-modal form ul li>div:last-of-type{flex:1}.task-options-modal .task-modal form ul li div.description{margin-top:8px}.task-options-modal .task-modal form ul li div.option-ui{display:flex;align-items:center;width:100%}.task-options-modal .task-modal form ul li div.option-ui.option-ui-browser input[type=text]{flex:1;margin-right:10px;padding:7px 11px;border-radius:4px}.task-options-modal .task-modal form ul li div.option-ui.option-ui-browser input[type=text]:disabled{color:#000}.task-options-modal .task-modal form ul li div.option-ui.option-ui-media-select{display:flex;flex:1}.task-options-modal .task-modal form ul li div.option-ui.option-ui-media-select .media-select-label{flex:1;box-sizing:border-box;margin-right:10px;padding:7px 11px;border-radius:4px;background-color:hsla(0,0%,100%,.498039);border:1px solid hsla(0,0%,87.1%,.74902)}.task-options-modal .task-modal form ul li div.option-ui.option-ui-media-select .button{margin-right:5px}.task-options-modal .task-modal div.buttons{margin-top:40px;display:flex;justify-content:flex-end}.task-options-modal .task-modal div.buttons .button{margin-left:15px}#task-batch div.buttons{display:flex;justify-content:flex-end;margin-top:40px}#task-batch div.buttons .button-whoa{background:#a42929!important;border-color:#e62a2a #a42929 #a42929!important;box-shadow:0 1px 0 #a42929!important;color:#fff!important;text-decoration:none!important;text-shadow:0 -1px 1px #a42929,1px 0 1px #a42929,0 1px 1px #a42929,-1px 0 1px #a42929!important}#task-batch div.task-info .info-warning{border:1px solid orange;padding:24px;background:rgba(255,165,0,.125);margin-top:20px;border-radius:8px}#task-batch div.task-info .info-warning h4{padding:0;font-size:14px;margin:0 0 8px}#task-batch div.task-info .wp-cli-callout{padding:24px;background:#ddd;margin-top:20px;border-radius:8px}#task-batch div.task-info .wp-cli-callout h3{margin:0;padding:0;font-size:14px}#task-batch div.task-info .wp-cli-callout code{background-color:#bbb;padding:10px 15px;margin-top:5px;display:inline-block}#task-batch div.task-info .task-options{padding:24px;background:#e7e7e7;margin-top:20px;border-radius:8px}#task-batch div.task-info .task-options h3{margin:0;padding:0;font-size:14px}#task-batch div.task-info .task-options ul{padding:0;display:flex;flex-direction:column;margin:20px 0 0}#task-batch div.task-info .task-options ul li{display:flex;margin-bottom:30px}#task-batch div.task-info .task-options ul li:last-of-type{margin-bottom:0}#task-batch div.task-info .task-options ul li>div:first-of-type{padding:10px 10px 20px 0;width:160px;min-width:160px;line-height:1.3;font-weight:600}#task-batch div.task-info .task-options ul li div.description{margin-top:8px}#task-batch div.task-info .task-options ul li div.option-ui{display:flex;align-items:center}#task-batch div.task-info .task-options ul li div.option-ui.option-ui-browser{display:flex;width:50vw}#task-batch div.task-info .task-options ul li div.option-ui.option-ui-browser input[type=text]{flex:1;margin-right:10px;padding:7px 11px;border-radius:4px}#task-batch div.task-info .task-options ul li div.option-ui.option-ui-browser input[type=text]:disabled{color:#000}#task-batch div.task-info .task-options ul li div.option-ui.option-ui-media-select{display:flex;width:50vw}#task-batch div.task-info .task-options ul li div.option-ui.option-ui-media-select .media-select-label{flex:1;box-sizing:border-box;margin-right:10px;padding:7px 11px;border-radius:4px;background-color:hsla(0,0%,100%,.498039)}#task-batch div.task-info .task-options ul li div.option-ui.option-ui-media-select .button{margin-right:5px}#task-batch div.task-progress{padding:24px;background:#ddd;border-radius:8px}#task-batch div.task-progress .progress-container{position:relative;width:100%;height:14px;background:#aaa;border-radius:16px;overflow:hidden;background-image:url(../img/candy-stripe.svg)}#task-batch div.task-progress .progress-container .progress-bar{background-color:#4f90c4;height:100%;width:10px}#task-batch div.task-progress .progress-thumbnails{position:relative;width:100%;height:150px;margin-bottom:15px}#task-batch div.task-progress .progress-thumbnails .progress-thumbnails-container{position:absolute;left:0;top:0;right:0;bottom:0;overflow:hidden;-webkit-mask-image:linear-gradient(90deg,#ddd 0,hsla(0,0%,86.7%,0) 90%);mask-image:linear-gradient(90deg,#ddd 0,hsla(0,0%,86.7%,0) 90%)}#task-batch div.task-progress .progress-thumbnails .progress-thumbnails-container img{width:150px;height:150px;max-width:150px;max-height:150px;border-radius:4px;margin-right:10px}#task-batch div.task-progress .progress-thumbnails .progress-thumbnails-container .item-title{color:#fff;position:absolute;right:10px;bottom:7px;text-align:right;left:10px;text-overflow:ellipsis;white-space:nowrap;overflow:hidden;text-shadow:1px 1px 2px rgba(0,0,0,.75);font-weight:700}#task-batch div.task-progress .progress-thumbnails .progress-thumbnails-container .progress-thumb{position:absolute;left:0;top:0;width:150px;min-width:150px;max-width:150px;height:150px;min-height:150px;max-height:150px;background-size:cover;background-position:50%;background-repeat:no-repeat;margin-right:10px;border-radius:4px;background-color:#888;transition:opacity .25s linear,transform .25s linear}#task-batch div.task-progress .progress-thumbnails .progress-thumbnails-container .progress-thumb.invisible{opacity:0;transform:scale(.7)}#task-batch div.task-progress .progress-thumbnails .progress-thumbnails-container .progress-icon{position:absolute;left:0;top:0;position:relative;width:150px;min-width:150px;max-width:150px;height:150px;min-height:150px;max-height:150px;display:flex;align-items:center;justify-content:center;transition:opacity .25s linear,transform .25s linear}#task-batch div.task-progress .progress-thumbnails .progress-thumbnails-container .progress-icon.invisible{opacity:0;transform:scale(.8)}#task-batch div.task-progress .progress-thumbnails .progress-thumbnails-fade{background:linear-gradient(90deg,#ddd 0,hsla(0,0%,86.7%,0) 90%);position:absolute;left:150px;top:0;right:0;bottom:0}@supports ((-webkit-mask-image:linear-gradient(to left,rgba(221,221,221,0) 0%,#dddddd 95%,#dddddd 100%)) or (mask-image:linear-gradient(to left,rgba(221,221,221,0) 0%,#dddddd 95%,#dddddd 100%))){#task-batch div.task-progress .progress-thumbnails .progress-thumbnails-fade{display:none}}#task-batch div.task-progress .progress-thumbnails .progress-thumbnails-cloud{position:absolute;right:20px;top:50%;transform:translateY(-50%)}#task-batch div.task-progress .progress-stats{margin-top:20px;display:flex;align-items:center;justify-content:center}@media (max-width:960px){#task-batch div.task-progress .progress-stats{flex-direction:column;align-items:flex-start;justify-content:flex-start}}#task-batch div.task-progress .progress-stats div.group-break{display:flex;margin-right:1.2195121951vw}#task-batch div.task-progress .progress-stats div.group-break:last-of-type{margin-right:0}#task-batch div.task-progress .progress-stats div.group-break:first-of-type{flex:1}@media (max-width:960px){#task-batch div.task-progress .progress-stats div.group-break{width:100%;margin-bottom:1.2195121951vw}}#task-batch div.task-progress .progress-stats div.group{display:flex;align-items:center;padding:1.0975609756vw 0;background-color:#e6e6e6;border-radius:8px;margin-right:1.2195121951vw}#task-batch div.task-progress .progress-stats div.group *{white-space:nowrap}@media (max-width:960px){#task-batch div.task-progress .progress-stats div.group.mobile-flexed{flex:1}}#task-batch div.task-progress .progress-stats div.group.flexed{flex:1}#task-batch div.task-progress .progress-stats div.group:last-of-type{margin-right:0}#task-batch div.task-progress .progress-stats div.group div.callout{position:relative;margin-right:.6097560976vw;padding:0 1.4634146341vw}#task-batch div.task-progress .progress-stats div.group div.callout:after{display:block;position:absolute;content:"";height:50%;width:1px;right:0;top:25%;background-color:rgba(0,0,0,.25)}#task-batch div.task-progress .progress-stats div.group div.callout:last-of-type:after{display:none}#task-batch div.task-progress .progress-stats div.group div.callout p.value{line-height:1;padding:0;font-size:1.5853658537vw;font-weight:300;margin:0 0 .487804878vw}#task-batch div.task-progress .progress-stats div.group div.callout p.value.status{text-transform:capitalize}@media (max-width:960px){#task-batch div.task-progress .progress-stats div.group div.callout p.value{font-size:2.9268292683vw}}#task-batch div.task-progress .progress-stats div.group div.callout h4{line-height:1;margin:0;padding:0;font-size:.6097560976vw;text-transform:uppercase}@media (max-width:960px){#task-batch div.task-progress .progress-stats div.group div.callout h4{font-size:.8536585366vw}} + */.cropper-container{direction:ltr;font-size:0;line-height:0;position:relative;touch-action:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.cropper-container img{display:block;height:100%;image-orientation:0deg;max-height:none!important;max-width:none!important;min-height:0!important;min-width:0!important;width:100%}.cropper-canvas,.cropper-crop-box,.cropper-drag-box,.cropper-modal,.cropper-wrap-box{bottom:0;left:0;position:absolute;right:0;top:0}.cropper-canvas,.cropper-wrap-box{overflow:hidden}.cropper-drag-box{background-color:#fff;opacity:0}.cropper-modal{background-color:#000;opacity:.5}.cropper-view-box{display:block;height:100%;outline-color:rgba(51,153,255,.75);outline:1px solid #39f;overflow:hidden;width:100%}.cropper-dashed{border:0 dashed #eee;display:block;opacity:.5;position:absolute}.cropper-dashed.dashed-h{border-bottom-width:1px;border-top-width:1px;height:33.33333%;left:0;top:33.33333%;width:100%}.cropper-dashed.dashed-v{border-left-width:1px;border-right-width:1px;height:100%;left:33.33333%;top:0;width:33.33333%}.cropper-center{display:block;height:0;left:50%;opacity:.75;position:absolute;top:50%;width:0}.cropper-center:after,.cropper-center:before{background-color:#eee;content:" ";display:block;position:absolute}.cropper-center:before{height:1px;left:-3px;top:0;width:7px}.cropper-center:after{height:7px;left:0;top:-3px;width:1px}.cropper-face,.cropper-line,.cropper-point{display:block;height:100%;opacity:.1;position:absolute;width:100%}.cropper-face{background-color:#fff;left:0;top:0}.cropper-line{background-color:#39f}.cropper-line.line-e{cursor:ew-resize;right:-3px;top:0;width:5px}.cropper-line.line-n{cursor:ns-resize;height:5px;left:0;top:-3px}.cropper-line.line-w{cursor:ew-resize;left:-3px;top:0;width:5px}.cropper-line.line-s{bottom:-3px;cursor:ns-resize;height:5px;left:0}.cropper-point{background-color:#39f;height:5px;opacity:.75;width:5px}.cropper-point.point-e{cursor:ew-resize;margin-top:-3px;right:-3px;top:50%}.cropper-point.point-n{cursor:ns-resize;left:50%;margin-left:-3px;top:-3px}.cropper-point.point-w{cursor:ew-resize;left:-3px;margin-top:-3px;top:50%}.cropper-point.point-s{bottom:-3px;cursor:s-resize;left:50%;margin-left:-3px}.cropper-point.point-ne{cursor:nesw-resize;right:-3px;top:-3px}.cropper-point.point-nw{cursor:nwse-resize;left:-3px;top:-3px}.cropper-point.point-sw{bottom:-3px;cursor:nesw-resize;left:-3px}.cropper-point.point-se{bottom:-3px;cursor:nwse-resize;height:20px;opacity:1;right:-3px;width:20px}@media (min-width:768px){.cropper-point.point-se{height:15px;width:15px}}@media (min-width:992px){.cropper-point.point-se{height:10px;width:10px}}@media (min-width:1200px){.cropper-point.point-se{height:5px;opacity:.75;width:5px}}.cropper-point.point-se:before{background-color:#39f;bottom:-50%;content:" ";display:block;height:200%;opacity:0;position:absolute;right:-50%;width:200%}.cropper-invisible{opacity:0}.cropper-bg{background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAQMAAAAlPW0iAAAAA3NCSVQICAjb4U/gAAAABlBMVEXMzMz////TjRV2AAAACXBIWXMAAArrAAAK6wGCiw1aAAAAHHRFWHRTb2Z0d2FyZQBBZG9iZSBGaXJld29ya3MgQ1M26LyyjAAAABFJREFUCJlj+M/AgBVhF/0PAH6/D/HkDxOGAAAAAElFTkSuQmCC")}.cropper-hide{display:block;height:0;position:absolute;width:0}.cropper-hidden{display:none!important}.cropper-move{cursor:move}.cropper-crop{cursor:crosshair}.cropper-disabled .cropper-drag-box,.cropper-disabled .cropper-face,.cropper-disabled .cropper-line,.cropper-disabled .cropper-point{cursor:not-allowed}.ilab-admin-separator-container{display:flex;height:12px;align-items:center;margin:0 -10px 0 0}.ilab-admin-separator-container .ilab-admin-separator-title{font-size:.68em;text-transform:uppercase;font-weight:700;margin-right:10px;color:hsla(0,0%,100%,.25)}.ilab-admin-separator-container .ilab-admin-separator{display:block;flex:1;padding:0;height:1px;line-height:1px;background:hsla(0,0%,100%,.125)}.media-cloud-info-link{display:flex;align-items:center}.media-cloud-info-link img.mcloud-lock{margin-left:5px}#wpadminbar #wp-admin-bar-media-cloud-admin-bar>.ab-item>.ab-icon:before{content:"\F176";top:3px}.ilabm-backdrop{position:fixed;display:block;background-color:rgba(0,0,0,.66)}.ilabm-backdrop,.ilabm-container{left:0;top:0;right:0;bottom:0;z-index:160000!important}.ilabm-container{background-color:#fcfcfc;position:absolute;border-radius:0;display:flex;flex-direction:column}.ilabm-titlebar{border-bottom:1px solid #ddd;min-height:50px;max-height:50px;box-shadow:0 0 4px rgba(0,0,0,.15);display:flex;align-items:center}.ilabm-titlebar h1{flex:1;padding:0 16px;font-size:22px;line-height:50px;margin:0 50px 0 0;display:flex;align-items:center;justify-content:space-between}.ilabm-titlebar .modal-actions{display:flex}.ilabm-titlebar .modal-actions a{margin-left:8px;display:flex;align-items:center}.ilabm-titlebar .modal-actions a svg{height:12px;width:auto;margin-right:4px}.ilabm-titlebar .modal-actions a svg>path,.ilabm-titlebar .modal-actions a svg>rect{fill:#000}.ilabm-titlebar .modal-actions div.spacer{width:8px;min-width:8px}.ilabm-titlebar>a{display:block;max-width:50px;min-width:50px;border-left:1px solid #ddd}.ilabm-window-area{flex:2 100%;display:flex;flex-direction:row}.ilabm-window-area-content{background-color:#fff;flex:2 100%;display:flex;flex-direction:column}.ilabm-editor-container{flex:2 100%;position:relative}.ilabm-editor-area{position:absolute;left:0;top:0;right:0;bottom:0;background-image:url(../img/ilab-imgix-edit-bg.png);display:block;margin:10px}.ilabm-sidebar{min-width:380px;max-width:380px;background-color:#f3f3f3;display:flex;flex-direction:column;border-left:3px solid #ddd}.ilabm-sidebar-content{position:relative;display:flex;flex:2 100%}.ilabm-sidebar-tabs{background:#ddd;display:flex;min-height:36px;max-height:36px}.ilabm-sidebar-tabs .ilabm-sidebar-tab{min-width:40px;white-space:nowrap;text-align:center;margin-top:3px;background-color:#ccc;line-height:30px;padding:0 15px;margin-right:3px;font-size:11px;text-transform:uppercase;color:#888;font-weight:700;cursor:pointer!important}.ilabm-sidebar-tabs .active-tab{background-color:#f3f3f3;color:#777}.ilabm-sidebar-actions{display:flex;justify-content:flex-end;background-color:#fff;border-top:1px solid #eee;padding:11px}.ilabm-sidebar-actions a{display:block;margin-left:10px!important}a.button-reset{background:#a00!important;border-color:#700!important;color:#fff!important;box-shadow:inset 0 1px 0 #d00,0 1px 0 rgba(0,0,0,.15)!important;text-shadow:none!important}.ilabm-editor-tabs{background:#ddd;overflow:hidden;min-height:36px}.ilabm-editor-tabs,.ilabm-editor-tabs .ilabm-tabs-select-ui{display:flex;flex-direction:row}.ilabm-editor-tabs .ilabm-tabs-select-ui .ilabm-tabs-select-label{margin-top:3px;line-height:32px;padding:0 5px 0 15px;margin-right:3px;font-size:11px;text-transform:uppercase;color:#888;font-weight:700;cursor:pointer!important}.ilabm-editor-tabs .ilabm-tabs-select-ui .ilabm-tabs-select{margin-top:4px;line-height:32px;font-size:11px}.ilabm-editor-tabs .ilabm-tabs-ui{display:flex;flex-direction:row}.ilabm-editor-tabs .ilabm-tabs-ui .ilabm-editor-tab{white-space:nowrap;min-width:50px;text-align:center;min-height:32px;max-height:33px;margin-top:3px;background-color:#ccc;line-height:31px;padding:0 15px;margin-right:3px;font-size:11px;text-transform:uppercase;color:#888;font-weight:700;cursor:pointer!important}.ilabm-editor-tabs .ilabm-tabs-ui .active-tab{background:#fff;margin-top:2px;border-right:1px solid #ddd;border-left:1px solid #ddd;border-top:1px solid #ddd}.ilabm-status-container{display:flex;flex:1;justify-content:flex-start}.ilabm-status-container .is-hidden{display:none}.ilabm-status-container .spinner{margin:0 8px 0 0}.ilabm-status-label{font-size:13px}.ilabm-preview-wait-modal{position:absolute;box-shadow:0 0 10px 1px rgba(0,0,0,.75);text-align:center;padding:20px 40px;border-radius:10px;background-color:hsla(0,0%,100%,.66);left:50%;top:50%;margin-left:-60px;margin-top:-32px}.ilabm-preview-wait-modal h3{text-transform:uppercase;font-size:13px}.ilabm-preview-wait-modal span.spinner{float:none!important}.ilabm-bottom-bar{font-size:12px!important;padding:0 10px 10px;display:flex!important;justify-content:flex-end;align-items:center;min-height:20px}.ilabm-bottom-bar .ilabm-bottom-bar-seperator{position:relative;width:1px;height:20px;background-color:#ccc;margin:0 10px 0 20px!important}.ilabm-bottom-bar a,.ilabm-bottom-bar select{margin-left:10px!important}.ilabm-bottom-bar select{font-size:13px!important;min-width:140px}.ilabm-bottom-bar label{font-size:13px!important}.is-hidden{display:none}.ilabm-modal-close{top:0;right:0;cursor:pointer;color:#777;background-color:transparent;height:50px;width:50px;position:absolute;text-align:center;border:0;border-left:1px solid #ddd;transition:color .1s ease-in-out,background .1s ease-in-out;text-decoration:none;z-index:1000;box-sizing:content-box;transition-property:border,background,color;transition-duration:.05s;transition-timing-function:ease-in-out}.ilabm-modal-icon{background-repeat:no-repeat;display:block;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)}.ilabm-modal-icon:before{content:"\F335";font:normal 22px/1 dashicons;vertical-align:middle;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;color:#666}.setup-body{display:flex;flex-direction:column;align-items:center;justify-content:center;padding-top:40px}.setup-body .service-selection-grid{display:grid;grid-template-columns:repeat(3,1fr);grid-gap:15px;grid-auto-rows:158px}.setup-body .service-selection-grid a{border-radius:5px;background-color:#fff;display:flex;flex-direction:column;justify-content:flex-end;align-items:center;border:1px solid #eaeaea;width:128px;height:128px;text-align:center;text-decoration:none;padding:15px;background-position:50% calc(50% - 15px);background-repeat:no-repeat;transition:transform .5s ease-out}.setup-body .service-selection-grid a:hover{transform:scale(1.1)}.setup-body .service-selection-grid a[data-service=s3]{grid-column:1;grid-row:1;background-image:url(../img/icon-service-s3.svg)}.setup-body .service-selection-grid a[data-service=google]{grid-column:2;grid-row:1;background-image:url(../img/icon-service-google.svg)}.setup-body .service-selection-grid a[data-service=minio]{grid-column:3;grid-row:1;background-image:url(../img/icon-service-minio.svg)}.setup-body .service-selection-grid a[data-service=backblaze]{grid-column:1;grid-row:2;background-image:url(../img/icon-service-backblaze.svg)}.setup-body .service-selection-grid a[data-service=do]{grid-column:2;grid-row:2;background-image:url(../img/icon-service-do.svg)}.setup-body .service-selection-grid a[data-service=other-s3]{grid-column:3;grid-row:2;background-image:url(../img/icon-service-other-s3.svg)}#ilab-video-upload-target{position:relative;padding:30px;border:4px dashed #e0e0e0;background-color:#fafafa;margin:20px 0;display:flex;flex-wrap:wrap;min-height:128px;cursor:pointer;transition:border .5s ease-out}#ilab-video-upload-target.drag-inside{border:4px solid #70a9dd;background-color:#bcd3e2}.ilab-upload-item{position:relative;min-width:128px;min-height:128px;max-width:128px;max-height:128px;width:128px;height:128px;background-color:#eaeaea;margin:10px;border-radius:0;border:1px solid #ddd;overflow:hidden;transition:opacity .5s ease-out,left .3s ease-out,top .3s ease-out,width .3s ease-out,height .3s ease-out,transform .3s ease-out;background-repeat:no-repeat;background-position:50%}.ilab-upload-item.upload-error{background-color:#eabab3;border:1px solid #bb6a6b}.ilab-upload-item.ilab-upload-selected{box-shadow:0 0 0 2px #fff,0 0 0 5px #0073aa}.ilab-upload-cell-image{background-image:url(../img/ilab-icon-image.svg);background-size:60px}.ilab-upload-cell-video{background-image:url(../img/ilab-icon-video.svg);background-size:60px}.ilab-upload-cell-doc{background-image:url(../img/ilab-icon-document.svg);background-size:45px}.no-mouse{cursor:default!important}.ilab-upload-item-background{position:absolute;left:-5px;top:-5px;right:-5px;bottom:-5px;background-repeat:no-repeat;background-size:cover;background-position:50%;transition:opacity .5s}.ilab-upload-status-container{position:absolute;left:0;top:0;right:0;bottom:0;display:flex;flex-direction:column;justify-content:center;align-items:center}.ilab-upload-status{color:#fff;font-weight:700;font-size:1em;text-shadow:0 0 3px #000}.ilab-upload-progress{width:80%;max-width:80%;height:9px;overflow:hidden;position:relative;margin-top:10px;border-radius:9px;background-color:hsla(0,0%,100%,.66)}.ilab-upload-progress-track{background-color:#0085ba;position:absolute;left:0;top:0;bottom:0;transition:width .125s ease-out}.ilab-upload-directions{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);font-size:2em;opacity:.5}.ilab-loader-container{display:flex;justify-content:center;align-items:center;position:absolute;left:0;top:0;right:0;bottom:0;transition:opacity .5s}.ilab-loader,.ilab-loader:after{border-radius:50%;width:24px;height:24px}.ilab-loader{font-size:5px;text-indent:-9999em;border:1.1em solid hsla(0,0%,100%,.2);border-left-color:#fff;-webkit-animation:load8 1.1s linear infinite;animation:load8 1.1s linear infinite}.ilab-loader.ilab-loader-dark{border:1.1em solid rgba(0,0,0,.2);border-left-color:#000}.ilab-upload-footer{padding-right:10px;position:absolute;left:0;right:0;border-top:1px solid #ddd;bottom:0;height:52px;background-color:#fff;display:flex;justify-content:flex-end;align-items:center;background-color:#fcfcfc;visibility:hidden}#ilab-attachment-info{position:absolute;right:-300px;top:0;bottom:54px;width:267px;transition:right .33s ease-out}.ilab-upload-insert-mode{position:relative;background-color:#fff}.ilab-upload-insert-mode div.wrap{position:absolute;left:0;top:0;right:0;bottom:52px;margin:0;padding:0 20px;overflow:auto;transition:right .33s ease-out}.ilab-upload-insert-mode div.wrap h2:first-of-type{display:none}.ilab-upload-insert-mode .ilab-upload-footer{visibility:visible}.ilab-item-selected div.wrap{right:300px}.ilab-item-selected #ilab-attachment-info{right:0}.media-cloud-upload-logo{width:240px;height:auto;margin-bottom:40px;opacity:.66;margin-top:-40px}.has-upload-message .upload-ui .media-cloud-upload-logo{display:none}.attachments-browser .upload-ui .media-cloud-upload-logo{margin-top:0}.minicolors{position:relative}.minicolors-sprite{background-image:url(../img/jquery.minicolors.png)}.minicolors-swatch{position:absolute;vertical-align:middle;background-position:-80px 0;border:1px solid #ccc;cursor:text;padding:0;margin:0;display:inline-block}.minicolors-swatch-color{position:absolute;top:0;left:0;right:0;bottom:0}.minicolors input[type=hidden]+.minicolors-swatch{width:28px;position:static;cursor:pointer}.minicolors input[type=hidden][disabled]+.minicolors-swatch{cursor:default}.minicolors-panel{position:absolute;width:173px;background:#fff;border:1px solid #ccc;box-shadow:0 0 20px rgba(0,0,0,.2);z-index:99999;box-sizing:content-box;display:none}.minicolors-panel.minicolors-visible{display:block}.minicolors-position-top .minicolors-panel{top:-154px}.minicolors-position-right .minicolors-panel{right:0}.minicolors-position-bottom .minicolors-panel{top:auto}.minicolors-position-left .minicolors-panel{left:0}.minicolors-with-opacity .minicolors-panel{width:194px}.minicolors .minicolors-grid{position:relative;top:1px;left:1px;width:150px;height:150px;margin-bottom:2px;background-position:-120px 0;cursor:crosshair}[dir=rtl] .minicolors .minicolors-grid{right:1px}.minicolors .minicolors-grid-inner{position:absolute;top:0;left:0;width:150px;height:150px}.minicolors-slider-saturation .minicolors-grid{background-position:-420px 0}.minicolors-slider-saturation .minicolors-grid-inner{background-position:-270px 0;background-image:inherit}.minicolors-slider-brightness .minicolors-grid{background-position:-570px 0}.minicolors-slider-brightness .minicolors-grid-inner{background-color:#000}.minicolors-slider-wheel .minicolors-grid{background-position:-720px 0}.minicolors-opacity-slider,.minicolors-slider{position:absolute;top:1px;left:152px;width:20px;height:150px;background-color:#fff;background-position:0 0;cursor:row-resize}[dir=rtl] .minicolors-opacity-slider,[dir=rtl] .minicolors-slider{right:152px}.minicolors-slider-saturation .minicolors-slider{background-position:-60px 0}.minicolors-slider-brightness .minicolors-slider,.minicolors-slider-wheel .minicolors-slider{background-position:-20px 0}.minicolors-opacity-slider{left:173px;background-position:-40px 0;display:none}[dir=rtl] .minicolors-opacity-slider{right:173px}.minicolors-with-opacity .minicolors-opacity-slider{display:block}.minicolors-grid .minicolors-picker{position:absolute;top:70px;left:70px;width:12px;height:12px;border:1px solid #000;border-radius:10px;margin-top:-6px;margin-left:-6px;background:none}.minicolors-grid .minicolors-picker>div{position:absolute;top:0;left:0;width:8px;height:8px;border-radius:8px;border:2px solid #fff;box-sizing:content-box}.minicolors-picker{position:absolute;top:0;left:0;width:18px;height:2px;background:#fff;border:1px solid #000;margin-top:-2px;box-sizing:content-box}.minicolors-swatches,.minicolors-swatches li{margin:5px 0 3px 5px;padding:0;list-style:none;overflow:hidden}[dir=rtl] .minicolors-swatches,[dir=rtl] .minicolors-swatches li{margin:5px 5px 3px 0}.minicolors-swatches .minicolors-swatch{position:relative;float:left;cursor:pointer;margin:0 4px 0 0}[dir=rtl] .minicolors-swatches .minicolors-swatch{float:right;margin:0 0 0 4px}.minicolors-with-opacity .minicolors-swatches .minicolors-swatch{margin-right:7px}[dir=rtl] .minicolors-with-opacity .minicolors-swatches .minicolors-swatch{margin-right:0;margin-left:7px}.minicolors-swatch.selected{border-color:#000}.minicolors-inline{display:inline-block}.minicolors-inline .minicolors-input{display:none!important}.minicolors-inline .minicolors-panel{position:relative;top:auto;left:auto;box-shadow:none;z-index:auto;display:inline-block}[dir=rtl] .minicolors-inline .minicolors-panel{right:auto}.minicolors-theme-default .minicolors-swatch{top:5px;left:5px;width:18px;height:18px}[dir=rtl] .minicolors-theme-default .minicolors-swatch{right:5px}.minicolors-theme-default .minicolors-swatches .minicolors-swatch{margin-bottom:2px;top:0;left:0;width:18px;height:18px}[dir=rtl] .minicolors-theme-default .minicolors-swatches .minicolors-swatch{right:0}.minicolors-theme-default.minicolors-position-right .minicolors-swatch{left:auto;right:5px}[dir=rtl] .minicolors-theme-default.minicolors-position-left .minicolors-swatch{right:auto;left:5px}.minicolors-theme-default.minicolors{display:inline-block}.minicolors-theme-default .minicolors-input{height:20px;width:auto;display:inline-block;padding-left:26px}[dir=rtl] .minicolors-theme-default .minicolors-input{text-align:right;unicode-bidi:-moz-plaintext;unicode-bidi:plaintext;padding-left:1px;padding-right:26px}.minicolors-theme-default.minicolors-position-right .minicolors-input{padding-right:26px;padding-left:inherit}[dir=rtl] .minicolors-theme-default.minicolors-position-left .minicolors-input{padding-right:inherit;padding-left:26px}.minicolors-theme-bootstrap .minicolors-swatch{z-index:2;top:3px;left:3px;width:28px;height:28px;border-radius:3px}[dir=rtl] .minicolors-theme-bootstrap .minicolors-swatch{right:3px}.minicolors-theme-bootstrap .minicolors-swatches .minicolors-swatch{margin-bottom:2px;top:0;left:0;width:20px;height:20px}[dir=rtl] .minicolors-theme-bootstrap .minicolors-swatches .minicolors-swatch{right:0}.minicolors-theme-bootstrap .minicolors-swatch-color{border-radius:inherit}.minicolors-theme-bootstrap.minicolors-position-right>.minicolors-swatch{left:auto;right:3px}[dir=rtl] .minicolors-theme-bootstrap.minicolors-position-left>.minicolors-swatch{right:auto;left:3px}.minicolors-theme-bootstrap .minicolors-input{float:none;padding-left:44px}[dir=rtl] .minicolors-theme-bootstrap .minicolors-input{text-align:right;unicode-bidi:-moz-plaintext;unicode-bidi:plaintext;padding-left:12px;padding-right:44px}.minicolors-theme-bootstrap.minicolors-position-right .minicolors-input{padding-right:44px;padding-left:12px}[dir=rtl] .minicolors-theme-bootstrap.minicolors-position-left .minicolors-input{padding-right:12px;padding-left:44px}.minicolors-theme-bootstrap .minicolors-input.input-lg+.minicolors-swatch{top:4px;left:4px;width:37px;height:37px;border-radius:5px}[dir=rtl] .minicolors-theme-bootstrap .minicolors-input.input-lg+.minicolors-swatch{right:4px}.minicolors-theme-bootstrap .minicolors-input.input-sm+.minicolors-swatch{width:24px;height:24px}.minicolors-theme-bootstrap .minicolors-input.input-xs+.minicolors-swatch{width:18px;height:18px}.input-group .minicolors-theme-bootstrap:not(:first-child) .minicolors-input{border-top-left-radius:0;border-bottom-left-radius:0}[dir=rtl] .input-group .minicolors-theme-bootstrap .minicolors-input{border-radius:4px}[dir=rtl] .input-group .minicolors-theme-bootstrap:not(:first-child) .minicolors-input{border-top-right-radius:0;border-bottom-right-radius:0}[dir=rtl] .input-group .minicolors-theme-bootstrap:not(:last-child) .minicolors-input{border-top-left-radius:0;border-bottom-left-radius:0}[dir=rtl] .input-group-addon,[dir=rtl] .input-group-btn>.btn,[dir=rtl] .input-group-btn>.btn-group>.btn,[dir=rtl] .input-group-btn>.dropdown-toggle,[dir=rtl] .input-group .form-control{border:1px solid #ccc;border-radius:4px}[dir=rtl] .input-group-addon:first-child,[dir=rtl] .input-group-btn:first-child>.btn,[dir=rtl] .input-group-btn:first-child>.btn-group>.btn,[dir=rtl] .input-group-btn:first-child>.dropdown-toggle,[dir=rtl] .input-group-btn:last-child>.btn-group:not(:last-child)>.btn,[dir=rtl] .input-group-btn:last-child>.btn:not(:last-child):not(.dropdown-toggle),[dir=rtl] .input-group .form-control:first-child{border-top-left-radius:0;border-bottom-left-radius:0;border-left:0}[dir=rtl] .input-group-addon:last-child,[dir=rtl] .input-group-btn:first-child>.btn-group:not(:first-child)>.btn,[dir=rtl] .input-group-btn:first-child>.btn:not(:first-child),[dir=rtl] .input-group-btn:last-child>.btn,[dir=rtl] .input-group-btn:last-child>.btn-group>.btn,[dir=rtl] .input-group-btn:last-child>.dropdown-toggle,[dir=rtl] .input-group .form-control:last-child{border-top-right-radius:0;border-bottom-right-radius:0}.minicolors-theme-semanticui .minicolors-swatch{top:0;left:0;padding:18px}[dir=rtl] .minicolors-theme-semanticui .minicolors-swatch{right:0}.minicolors-theme-semanticui input{text-indent:30px}.imgix-preview-image{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);max-width:100%;max-height:100%;display:block;pointer-events:none}.imgix-parameters-container{position:absolute;left:0;top:0;bottom:0;right:0;overflow-x:hidden;overflow-y:auto;display:flex;flex-direction:column;padding:15px 10px}.imgix-parameters-container.is-hidden{display:none}.imgix-parameters-container .imgix-parameter-group select{font-size:12px}.imgix-parameters-container .imgix-parameter-group h4{margin:0;font-size:10px;text-transform:uppercase;color:#999;background-color:#ddd;padding:5px 15px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.imgix-parameters-container .imgix-parameter-group>div{padding:15px}.imgix-parameter{position:relative;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;padding-bottom:15px;margin-bottom:15px}.imgix-parameter .imgix-param-imagick-warning{position:absolute;left:-10px;top:-5px;right:-10px;bottom:0;padding:0 5px;display:flex;align-items:center;justify-content:center;background:hsla(0,0%,100%,.8)}.imgix-parameter .imgix-param-imagick-warning>div{text-align:center}.imgix-parameter:last-of-type{margin-bottom:0;padding-bottom:0}.imgix-param-title{display:flex;align-items:baseline;margin-bottom:0}.imgix-param-title-colortype{align-items:center!important;margin-bottom:8px}.imgix-param-title-colortype h3{margin:0!important}.imgix-param-title-left{flex:1 50%}.imgix-param-title-right{flex:1 50%;padding-left:40px;text-align:right;position:relative}.imgix-param-title-right h3{text-align:right}.imgix-param-blend-mode h3,.imgix-param-title h3{margin-top:0;font-size:11px;text-transform:uppercase;color:#666}.imgix-media-param-title .imgix-param-title-left{flex:2 80%}.imgix-media-param-title .imgix-param-title-right{flex:1 20%}.imgix-media-param-title .imgix-param-title-right a{text-align:center!important}.minicolors-theme-default.minicolors{width:auto;display:block;padding:0!important;margin:0;min-height:29px}.ilab-color-input{position:relative;top:0;right:0;height:30px!important;margin:0!important;padding-left:8px!important;padding-right:30px!important}.imgix-param-blend-mode{margin-top:15px;display:flex;align-items:baseline}.imgix-param-blend-mode h3{flex:1 50%}.imgix-param-blend-mode select{flex:2 100%}.imgix-parameter input[type=range]{display:block;width:100%;-webkit-appearance:none;margin:0 0 10px;background:none;padding:0!important}.imgix-parameter input[type=range]:focus{outline:none}.imgix-parameter input[type=range]:focus::-webkit-slider-runnable-track{background:#fff}.imgix-parameter input[type=range]::-webkit-slider-runnable-track{width:100%;height:5px;cursor:pointer;animate:.2s;box-shadow:inset 1px 1px 2px 0 rgba(0,0,0,.25);background:#d4cfd4;border-radius:4px;border:0 solid #000101}.imgix-parameter input[type=range]::-webkit-slider-thumb{border:1px solid rgba(0,0,0,.25);box-shadow:inset 0 2px 2px 0 hsla(0,0%,100%,.5);height:17px;width:17px;border-radius:9px;background:#dcdcdc;cursor:pointer;-webkit-appearance:none;margin-top:-6px}.imgix-parameter input[type=range]::-moz-range-track{width:100%;height:5px;cursor:pointer;animate:.2s;box-shadow:inset 1px 1px 2px 0 rgba(0,0,0,.25);background:#d4cfd4;border-radius:4px;border:0 solid #000101}.imgix-parameter input[type=range]::-moz-range-thumb{border:1px solid rgba(0,0,0,.25);box-shadow:inset 0 2px 2px 0 hsla(0,0%,100%,.5);height:17px;width:17px;border-radius:9px;background:#dcdcdc;cursor:pointer;-webkit-appearance:none;margin-top:-6px}.imgix-parameter .imgix-param-reset{display:flex;width:100%;justify-content:flex-end}.imgix-parameter .imgix-param-reset a{font-size:11px;font-style:italic;text-decoration:none}.imgix-parameter .imgix-param-reset a,.imgix-parameter a:focus{outline:none!important;border:0!important}.imgix-media-preview{position:relative;margin:0!important;padding:0 0 100%!important;background-image:url(../img/ilab-imgix-edit-bg.png);width:100%}.imgix-media-preview img{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);max-width:100%;max-height:100%;display:block}.imgix-media-preview-inner{position:absolute;left:0;right:0;bottom:0;top:0;display:flex;align-items:center;justify-content:center}.imgix-alignment-container{display:flex;flex:row;flex-wrap:wrap;justify-content:space-around;align-items:baseline;padding:0 35px}.imgix-alignment-button{background-color:#ddd;display:block;width:60px;height:60px;margin:5px;text-decoration:none;border-radius:4px;border:1px solid #888;box-shadow:inset 0 1px 0 #fff,0 1px 0 rgba(0,0,0,.15)!important}.selected-alignment{background-color:#bbb;box-shadow:inset 1px 1px 1px rgba(0,0,0,.25),0 1px 0 rgba(0,0,0,.15)!important}.ilabm-pillbox{flex-wrap:wrap;border-bottom:0!important}.ilabm-pillbox,.ilabm-pillbox .ilabm-pill{align-items:center;display:flex;justify-content:center}.ilabm-pillbox .ilabm-pill{white-space:nowrap;line-height:1;height:14px;min-height:32px;width:140px;min-width:140px;max-width:140px;font-size:10px;background-color:#eaeaea;text-transform:uppercase;font-weight:700;color:#444;text-decoration:none;border-radius:8px;margin:3px}.ilabm-pillbox .ilabm-pill span{display:block;margin-right:8px}.ilabm-pillbox .ilabm-pill span.icon{width:18px;height:18px;min-width:18px;min-height:18px;max-width:18px;max-height:18px;background-repeat:no-repeat;background-position:50%;background-size:contain;margin-left:8px}.ilabm-pillbox .pill-selected{background-color:#ccc;box-shadow:inset 1px 1px 1px rgba(0,0,0,.25);color:#fff}.ilabm-pillbox-no-icon .ilabm-pill{width:100px;min-width:100px;max-width:100px}.ilabm-pillbox-no-icon .ilabm-pill span{margin-right:0}.ilabm-pillbox-no-icon .ilabm-pill span.icon{display:none}.imgix-pill-enhance>span.icon{background-image:url(../img/ilab-imgix-magic-wand-black.svg)}.imgix-pill-enhance.pill-selected>span.icon{background-image:url(../img/ilab-imgix-magic-wand-white.svg)}.imgix-pill-redeye>span.icon{background-image:url(../img/ilab-imgix-red-eye-black.svg)}.imgix-pill-redeye.pill-selected>span.icon{background-image:url(../img/ilab-imgix-red-eye-white.svg)}.imgix-pill-usefaces>span.icon{background-image:url(../img/ilab-imgix-faces-black.svg)}.imgix-pill-usefaces.pill-selected>span.icon{background-image:url(../img/ilab-imgix-faces-white.svg)}.imgix-pill-focalpoint>span.icon{background-image:url(../img/ilab-imgix-focalpoint-black.svg)}.imgix-pill-focalpoint.pill-selected>span.icon{background-image:url(../img/ilab-imgix-focalpoint-white.svg)}.imgix-pill-entropy>span.icon{background-image:url(../img/ilab-imgix-chaos-black.svg)}.imgix-pill-entropy.pill-selected>span.icon{background-image:url(../img/ilab-imgix-chaos-white.svg)}.imgix-pill-edges>span.icon{background-image:url(../img/ilab-imgix-edges-black.svg)}.imgix-pill-edges.pill-selected>span.icon{background-image:url(../img/ilab-imgix-edges-white.svg)}.imgix-pill-h>span.icon{background-image:url(../img/ilab-flip-horizontal-black.svg)}.imgix-pill-h.pill-selected>span.icon{background-image:url(../img/ilab-flip-horizontal-white.svg)}.imgix-pill-v>span.icon{background-image:url(../img/ilab-flip-vertical-black.svg)}.imgix-pill-v.pill-selected>span.icon{background-image:url(../img/ilab-flip-vertical-white.svg)}.imgix-pill-clip>span.icon{background-image:url(../img/ilab-imgix-clip-black.svg)}.imgix-pill-clip.pill-selected>span.icon{background-image:url(../img/ilab-imgix-clip-white.svg)}.imgix-pill-crop>span.icon{background-image:url(../img/ilab-imgix-crop-black.svg)}.imgix-pill-crop.pill-selected>span.icon{background-image:url(../img/ilab-imgix-crop-white.svg)}.imgix-pill-max>span.icon{background-image:url(../img/ilab-imgix-max-black.svg)}.imgix-pill-max.pill-selected>span.icon{background-image:url(../img/ilab-imgix-max-white.svg)}.imgix-pill-scale>span.icon{background-image:url(../img/ilab-imgix-scale-black.svg)}.imgix-pill-scale.pill-selected>span.icon{background-image:url(../img/ilab-imgix-scale-white.svg)}.imgix-preset-make-default-container{align-items:center;display:flex;min-height:30px;margin-left:10px}.imgix-preset-container{align-items:center;display:flex}.imgix-preset-container.is-hidden,.imgix-preset-make-default-container.is-hidden{display:none}.imgix-param-label{font-style:italic;text-transform:none!important}.imgix-label-editor{position:absolute;right:-4px;top:0;width:40px;font-size:11px;padding:1px;text-align:right}.ilabm-focal-point-icon{position:absolute;background-image:url(../img/ilab-imgix-focalpoint-icon.svg);width:24px;height:24px;background-size:contain;pointer-events:none}.ilab-face-outline{position:absolute;border:3px solid #fff;-webkit-filter:drop-shadow(0 2px 3px #000);filter:drop-shadow(0 2px 3px black);opacity:.33;z-index:999;cursor:pointer}.ilab-face-outline span{display:block;position:absolute;background-color:#fff;color:#000;font-size:9px;width:12px;height:12px;text-align:center;font-weight:700;line-height:1}.ilab-face-outline.active{opacity:1;z-index:1000}.ilab-all-faces-outline{position:absolute;border:3px solid #fff;-webkit-filter:drop-shadow(0 2px 3px #000);filter:drop-shadow(0 2px 3px black)}input[type=range].imgix-param{-webkit-appearance:none;-moz-appearance:none;appearance:none}input[type=range].imgix-param:focus{outline:none}input[type=range].imgix-param:focus::-webkit-slider-runnable-track{background:#bababa}input[type=range].imgix-param::-webkit-slider-runnable-track{width:100%;height:17px;cursor:pointer;animate:.2s;background:#cfcfcf;border-radius:17px;box-shadow:none}input[type=range].imgix-param::-moz-range-track{width:100%;height:17px;cursor:pointer;animate:.2s;background:#cfcfcf;border-radius:17px;box-shadow:none}input[type=range].imgix-param::-webkit-slider-thumb{-webkit-appearance:none;cursor:pointer;width:18px;height:17px;border-radius:17px;margin-top:0}input[type=range].imgix-param::-moz-range-thumb{-webkit-appearance:none;cursor:pointer;width:18px;height:17px;border-radius:17px;margin-top:0}.ilab-crop-preview{overflow:hidden;max-width:100%;max-height:100%}.ilab-crop-now-wrapper{margin-top:12px}.ilabc-cropper{max-width:100%;max-height:100%}.ilabm-sidebar-content-cropper{flex-direction:column!important;padding:10px;overflow:scroll}.ilabm-sidebar-content-cropper h3{margin-top:0;font-size:11px;text-transform:uppercase;color:#888;font-weight:700}.cropper-dashed.dashed-h{top:38.4615385%;height:23.076923%}.cropper-dashed.dashed-v{left:38.4615385%;width:23.076923%}.ilabc-current-crop-container{position:relative;margin-bottom:15px}.ilabc-crop-preview-container,.ilabc-current-crop-container{background-image:url(../img/ilab-imgix-edit-bg.png);display:flex;align-items:center;justify-content:center;flex:1}.ilab-current-crop-img{position:absolute;-o-object-fit:contain;object-fit:contain;padding:0!important;margin:0!important;height:100%;width:100%}#ilab-crop-aspect-checkbox-container{display:flex;align-items:center}#ilab-crop-aspect-checkbox-container input{margin:0 8px 0 0;padding:0}#ilab-s3-info-meta .inside{padding:0 5px 10px}.info-panel-tabs{margin:-7px -5px 0;padding:6px 10px 0;background-color:rgba(0,0,0,.125)}.info-panel-tabs ul{display:flex;margin:0;padding:0;height:100%}.info-panel-tabs ul li{padding:5px 10px;font-size:11px;text-transform:uppercase;margin:0 10px 0 0;display:block;background-color:rgba(0,0,0,.0625);cursor:pointer;font-weight:700}.info-panel-tabs ul li.info-panel-missing-sizes{color:#9e0000}.info-panel-tabs ul li.active{background-color:#fff}.info-panel-contents{padding:15px 10px 0}.info-panel-contents .info-line{display:flex;flex-direction:column;margin-bottom:15px}.info-panel-contents .info-line h3,.info-panel-contents .info-line label{font-size:11px;text-transform:uppercase;margin:0;font-weight:700}.info-panel-contents .info-line label{margin-bottom:4px}.info-panel-contents .info-line select{font-size:12px!important}.info-panel-contents .info-line a{white-space:nowrap;text-overflow:ellipsis;overflow:hidden}.info-panel-contents .info-line-form{border-top:1px solid #ddd;padding-top:8px}.info-panel-contents .info-line-form h3{margin-top:8px;margin-bottom:12px}.info-panel-contents .info-line-form .info-line-form-row{margin-bottom:8px}.info-panel-contents .info-line-form .info-line-form-buttons{margin-top:8px}.info-panel-contents .info-notice{padding:10px 5px 20px}.info-panel-contents .info-size-selector{margin-bottom:15px}.info-panel-contents .info-line-note{color:grey;font-style:italic;margin-top:4px;margin-bottom:8px}.info-panel-contents .button-row{margin-bottom:15px;border-top:1px solid #eaeaea;padding-top:15px;display:flex;justify-content:flex-end;align-items:center}.info-panel-contents .button-row #ilab-info-regenerate-status{display:flex;padding:0;justify-content:center;align-items:center;width:100%;font-size:12px}.info-panel-contents .button-row #ilab-info-regenerate-status .spinner{float:none;display:block;margin:0 8px 0 0;width:16px;height:16px;background-size:16px 16px}.info-panel-contents .links-row{display:flex;align-items:center;justify-content:center;background-color:rgba(0,0,0,.05);border:1px solid rgba(0,0,0,.1);border-radius:8px;padding:10px 0;margin-bottom:15px}.info-panel-contents .links-row a{color:#000;display:flex;align-items:center;margin-right:20px;text-decoration:none;text-transform:uppercase;font-weight:700;font-size:11px}.info-panel-contents .links-row a:last-of-type{margin-right:0}.info-panel-contents .links-row a .dashicons{margin-right:3px;width:16px;height:16px;font-size:16px}#ilab-media-grid-info-popup{position:absolute;z-index:170000;opacity:1;transition:opacity .33s;-webkit-filter:drop-shadow(0 0 5px rgba(50,50,50,.5));filter:drop-shadow(0 0 5px rgba(50,50,50,.5));display:flex;align-items:center}#ilab-media-grid-info-popup.hidden{opacity:0;pointer-events:none}#ilab-media-grid-info-popup h2{text-transform:uppercase;font-size:9px;padding:4px 10px;margin:0;color:rgba(0,0,0,.33)}#ilab-media-grid-info-popup .ilab-media-grid-info-popup-content{min-height:604px;background-color:#fff;width:275px;max-width:275px;padding-bottom:1px;display:flex;flex-direction:column;position:relative}#ilab-media-grid-info-popup .ilab-media-grid-info-popup-content .info-panel-tabs{margin:0}#ilab-media-grid-info-popup .ilab-media-grid-info-popup-content .info-panel-contents>div{display:flex;flex-direction:column}#ilab-media-grid-info-popup .ilab-media-grid-info-popup-content .info-panel-contents>div>div{flex:1}#ilab-media-grid-info-popup .ilab-media-grid-info-popup-content .info-panel-contents .info-file-info-size{flex-grow:1;display:flex;flex-direction:column}#ilab-media-grid-info-popup .ilab-media-grid-info-popup-content .button-row{position:absolute;bottom:0;right:0;left:0}#ilab-media-grid-info-popup .ilab-media-grid-info-popup-content .ilab-loader-container{display:flex;justify-content:center;align-items:center;position:absolute;left:0;top:0;right:0;bottom:0;transition:opacity .5s}#ilab-media-grid-info-popup .ilab-media-grid-info-popup-content .ilab-loader,#ilab-media-grid-info-popup .ilab-media-grid-info-popup-content .ilab-loader:after{border-radius:50%;width:24px;height:24px}#ilab-media-grid-info-popup .ilab-media-grid-info-popup-content .ilab-loader{font-size:5px;text-indent:-9999em;border:1.1em solid hsla(0,0%,100%,.2);border-left-color:#fff;-webkit-animation:load8 1.1s linear infinite;animation:load8 1.1s linear infinite}#ilab-media-grid-info-popup .ilab-media-grid-info-popup-content .ilab-loader.ilab-loader-dark{border:1.1em solid rgba(0,0,0,.2);border-left-color:#000}@-webkit-keyframes load8{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}@keyframes load8{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}#ilab-media-grid-info-popup .ilab-media-popup-arrow-left{width:45px;display:flex;justify-content:flex-end}#ilab-media-grid-info-popup .ilab-media-popup-arrow-left>div{width:0;height:0;border-color:transparent #fff transparent transparent;border-style:solid;border-width:9px 15.6px 9px 0}#ilab-media-grid-info-popup .ilab-media-popup-arrow-right{width:45px;display:flex;justify-content:flex-start}#ilab-media-grid-info-popup .ilab-media-popup-arrow-right>div{width:0;height:0;border-color:transparent transparent transparent #fff;border-style:solid;border-width:9px 0 9px 15.6px;margin-right:30px}#ilab-media-grid-info-popup.popup-left .ilab-media-popup-arrow-right,#ilab-media-grid-info-popup.popup-right .ilab-media-popup-arrow-left{display:none}li.attachment{transition:opacity .3s ease-out,transform .3s ease-out,box-shadow .3s ease-out}li.attachment .ilab-loader-container{z-index:100}li.attachment.info-focused{transform:scale(1.1)}li.attachment.info-focused>div:first-of-type{box-shadow:0 0 5px 0 rgba(50,50,50,.5)}li.attachment.info-unfocused{opacity:.33}#ilab-media-grid-info-popup.ilab-popup-document h2{background-color:rgba(0,0,0,.125);color:#000}#ilab-media-grid-info-popup.ilab-popup-document .info-panel-contents{padding:10px 10px 0}#ilab-media-grid-info-popup.ilab-popup-document .ilab-media-grid-info-popup-content{min-height:484px}table.ilab-image-sizes{border-collapse:collapse;width:100%}table.ilab-image-sizes td,table.ilab-image-sizes th{padding:10px}table.ilab-image-sizes td.center{text-align:center}table.ilab-image-sizes thead th{border:2px solid #f1f1f1;background-color:#dadada}table.ilab-image-sizes tr{border-bottom:1px solid #dadada}.ilab-add-image-size-backdrop{display:flex;align-items:center;justify-content:center}.ilab-add-image-size-container{left:auto;right:auto;bottom:auto;top:auto}.ilab-new-image-size-form{padding:20px;display:flex;flex-direction:column}.ilab-new-image-size-form div.row{display:flex;align-items:center;margin-bottom:15px}.ilab-new-image-size-form div.row>label{width:90px;text-align:right;margin-right:15px;font-weight:700}.ilab-new-image-size-form div.button-row{padding:10px;text-align:right}.ilab-delete-size-button{font-size:0;display:inline-block;width:18px;height:18px;background-image:url(../img/ilab-ui-icon-trash.svg);background-size:contain;background-position:50%;background-repeat:no-repeat;background-size:12px;margin-right:10px}.ilab-delete-size-button.disabled{opacity:.33;pointer-events:none}.ilab-delete-size-button:hover{background-image:url(../img/ilab-ui-icon-trash-hover.svg)}.ilab-size-settings-button{font-size:0;display:inline-block;width:18px;height:18px;background-image:url(../img/ilab-ui-icon-settings.svg);background-size:contain;background-position:50%;background-repeat:no-repeat;background-size:14px}.ilab-size-settings-button.disabled{opacity:.33;pointer-events:none}.ilab-size-settings-button:hover{background-image:url(../img/ilab-ui-icon-settings-hover.svg)}.ilab-browser-select-table-container table,.ilab-storage-browser table{border-collapse:collapse;width:100%;font-size:1.1em}.ilab-browser-select-table-container table td,.ilab-browser-select-table-container table th,.ilab-storage-browser table td,.ilab-storage-browser table th{padding:12px}.ilab-browser-select-table-container table thead tr th,.ilab-storage-browser table thead tr th{text-align:left;border:2px solid #f1f1f1;background-color:#dadada}.ilab-browser-select-table-container table thead tr th.checkbox,.ilab-storage-browser table thead tr th.checkbox{max-width:30px;width:30px;text-align:center}.ilab-browser-select-table-container table thead tr th.checkbox input[type=checkbox],.ilab-storage-browser table thead tr th.checkbox input[type=checkbox]{margin:0 auto}.ilab-browser-select-table-container table tbody tr,.ilab-storage-browser table tbody tr{transition:background-color .125s linear;cursor:pointer}.ilab-browser-select-table-container table tbody tr:hover,.ilab-storage-browser table tbody tr:hover{background-color:#fff}.ilab-browser-select-table-container table tbody tr input[type=checkbox],.ilab-storage-browser table tbody tr input[type=checkbox]{z-index:1000;margin:0 auto}.ilab-browser-select-table-container table tbody tr td,.ilab-storage-browser table tbody tr td{text-decoration:none}.ilab-browser-select-table-container table tbody tr td.checkbox,.ilab-storage-browser table tbody tr td.checkbox{max-width:30px;width:30px;text-align:center}.ilab-browser-select-table-container table tbody tr td.entry,.ilab-storage-browser table tbody tr td.entry{display:flex;align-items:center}.ilab-browser-select-table-container table tbody tr td.actions,.ilab-storage-browser table tbody tr td.actions{text-align:center;width:130px;max-width:130px}.ilab-browser-select-table-container table tbody tr td.actions .button-delete,.ilab-storage-browser table tbody tr td.actions .button-delete{margin-right:0;margin-left:10px;color:#fff;border-color:#920002;background:#ca0002;box-shadow:0 1px 0 #cc0005}.ilab-browser-select-table-container table tbody tr td.actions .button-delete svg,.ilab-storage-browser table tbody tr td.actions .button-delete svg{height:14px}.ilab-browser-select-table-container table tbody tr td.actions .button-delete.disabled,.ilab-storage-browser table tbody tr td.actions .button-delete.disabled{color:#ff6468!important;border-color:#920002!important;background:#c6282a!important;box-shadow:0 1px 0 #cc0005!important;text-shadow:0 1px 0 #cc0005!important}.ilab-browser-select-table-container table tbody tr td.actions .button-delete.disabled svg>path,.ilab-browser-select-table-container table tbody tr td.actions .button-delete.disabled svg>rect,.ilab-storage-browser table tbody tr td.actions .button-delete.disabled svg>path,.ilab-storage-browser table tbody tr td.actions .button-delete.disabled svg>rect{fill:#ff6468}.ilab-browser-select-table-container table tbody tr td img.loader,.ilab-storage-browser table tbody tr td img.loader{display:none;margin-right:10px;width:16px;height:16px}.ilab-browser-select-table-container table tbody tr td span,.ilab-storage-browser table tbody tr td span{display:block;width:16px;height:16px;background-size:contain;background-repeat:no-repeat;margin-right:10px}.ilab-browser-select-table-container table tbody tr td span.icon-dir,.ilab-storage-browser table tbody tr td span.icon-dir{background-image:url(../img/ilab-ui-icon-folder.svg)}.ilab-browser-select-table-container table tbody tr td span.icon-file,.ilab-storage-browser table tbody tr td span.icon-file{background-image:url(../img/ilab-ui-icon-file.svg)}.ilab-browser-select-table-container table tbody tr td span.icon-up,.ilab-storage-browser table tbody tr td span.icon-up{background-image:url(../img/ilab-ui-icon-up-dir.svg)}.ilab-browser-select-table-container table tr,.ilab-storage-browser table tr{border-bottom:1px solid #dadada}.mcsb-buttons .button{margin-right:5px;display:flex;align-items:center}.mcsb-buttons .button svg{height:16px;width:auto;margin-right:8px}.mcsb-buttons .button svg>path,.mcsb-buttons .button svg>rect{fill:#fff}.mcsb-buttons .button-primary.disabled svg>path,.mcsb-buttons .button-primary.disabled svg>rect{fill:#66c6e4}.mcsb-buttons .button-create-folder svg{height:12px}.mcsb-buttons .button-import{margin-left:10px}.mcsb-buttons .button-import svg{height:14px}.mcsb-buttons .button-delete{margin-right:0;margin-left:10px;color:#fff;border-color:#920002;background:#ca0002;box-shadow:0 1px 0 #cc0005}.mcsb-buttons .button-delete svg{height:14px}.mcsb-buttons .button-delete.disabled{color:#ff6468!important;border-color:#920002!important;background:#c6282a!important;box-shadow:0 1px 0 #cc0005!important;text-shadow:0 1px 0 #cc0005!important}.mcsb-buttons .button-delete.disabled svg>path,.mcsb-buttons .button-delete.disabled svg>rect{fill:#ff6468}.mcsb-buttons .button-cancel{color:#fff;border-color:#920002;background:#ca0002;text-shadow:0 1px 0 #cc0005!important;box-shadow:0 1px 0 #cc0005}.mcsb-buttons .button-cancel:hover{border-color:#9f0002;background:#d80002;text-shadow:0 1px 0 #d60005!important;box-shadow:0 1px 0 #d60005}.mscb-loading{display:flex;align-items:center;justify-content:center;padding:20px;font-size:1.2em;font-weight:700}.mscb-loading img{margin-right:5px}.mcsb-container img.loading{width:18px;height:18px;display:none}.mcsb-container.loading-files th img.loading{display:block;margin:0 auto}.mcsb-container.loading-files th input[type=checkbox]{display:none}.mcsb-container.loading-files td input[type=checkbox]{opacity:.33;pointer-events:none}.mcsb-actions{margin-bottom:18px;font-size:1.1em}.mcsb-actions,.mcsb-actions div.mcsb-action-buttons{display:flex;align-items:center}.ilab-storage-browser-header{flex:1;padding:14px 9px;box-shadow:inset 0 0 3px 0 rgba(0,0,0,.125);border:1px solid #ddd;border-radius:8px;margin-right:18px}.ilab-storage-browser-header ul{margin:0;padding:0;display:flex}.ilab-storage-browser-header ul li{padding:0;position:relative;display:block;margin:0 30px 0 0}.ilab-storage-browser-header ul li a{text-decoration:none}.ilab-storage-browser-header ul li:first-of-type{padding-left:35px}.ilab-storage-browser-header ul li:first-of-type:before{background-image:url(../img/ilab-ui-icon-folder.svg);width:16px;height:16px;left:0}.ilab-storage-browser-header ul li:after,.ilab-storage-browser-header ul li:first-of-type:before{content:" ";position:absolute;background-size:contain;background-position:50%;background-repeat:no-repeat;top:50%;margin-left:10px;transform:translateY(-50%)}.ilab-storage-browser-header ul li:after{background-image:url(../img/ilab-ui-path-divider.svg);width:9px;height:9px}.ilab-storage-browser-header ul li:last-of-type:after{display:none}#mcsb-progress-modal{z-index:10000;position:fixed;left:0;top:0;right:0;bottom:0;background:rgba(0,0,0,.66);display:flex;align-items:center;justify-content:center;transition:opacity .15s linear;opacity:1}#mcsb-progress-modal.hidden{opacity:0;pointer-events:none}#mcsb-progress-modal .mcsb-progress-container{min-width:40vw;background-color:#fff;padding:30px}#mcsb-progress-modal .mcsb-progress-container .mcsb-progress-label{font-weight:700;font-size:1.1em;margin-bottom:20px}#mcsb-progress-modal .mcsb-progress-container .mcsb-progress-bar{position:relative;background-color:#eaeaea;height:24px;border-radius:12px;overflow:hidden}#mcsb-progress-modal .mcsb-progress-container .mcsb-progress-bar #mcsb-progress{position:absolute;left:0;top:0;bottom:0;background-color:#4f90c4}#mcsb-progress-modal .mcsb-progress-container .mcsb-progress-actions{margin-top:28px;display:flex;justify-content:flex-end}#mcsb-progress-modal .mcsb-progress-container .mcsb-progress-actions .button-delete{margin-right:0;margin-left:10px;color:#fff;border-color:#920002;background:#ca0002;box-shadow:0 1px 0 #cc0005}#mcsb-progress-modal .mcsb-progress-container .mcsb-progress-actions .button-delete svg{height:14px}#mcsb-progress-modal .mcsb-progress-container .mcsb-progress-actions .button-delete.disabled{color:#ff6468!important;border-color:#920002!important;background:#c6282a!important;box-shadow:0 1px 0 #cc0005!important;text-shadow:0 1px 0 #cc0005!important}#mcsb-progress-modal .mcsb-progress-container .mcsb-progress-actions .button-delete.disabled svg>path,#mcsb-progress-modal .mcsb-progress-container .mcsb-progress-actions .button-delete.disabled svg>rect{fill:#ff6468}#mcsb-import-options-modal{z-index:10000;position:fixed;left:0;top:0;right:0;bottom:0;background:rgba(0,0,0,.66);display:flex;align-items:center;justify-content:center;transition:opacity .15s linear;opacity:1;pointer-events:none}#mcsb-import-options-modal.hidden{opacity:0}#mcsb-import-options-modal.hidden .mcsb-import-options-container{pointer-events:none}#mcsb-import-options-modal .mcsb-import-options-container{min-width:40vw;max-width:800px;background-color:#fff;padding:30px;pointer-events:all;display:flex;flex-direction:column}#mcsb-import-options-modal .mcsb-import-options-container h3{display:block;padding:0;margin:0 0 25px;position:relative;font-weight:700;font-size:1.125em}#mcsb-import-options-modal .mcsb-import-options-container div.mcsb-import-options{margin-bottom:50px}#mcsb-import-options-modal .mcsb-import-options-container div.mcsb-import-options ul{display:grid;grid-template-columns:repeat(1,1fr);grid-row-gap:20px;grid-column-gap:10px}#mcsb-import-options-modal .mcsb-import-options-container div.mcsb-import-options ul li{display:flex;align-items:flex-start}#mcsb-import-options-modal .mcsb-import-options-container div.mcsb-import-options ul li h4{margin:0;padding:0;font-size:1em}#mcsb-import-options-modal .mcsb-import-options-container div.mcsb-import-options ul li .mcsb-option{padding-top:2px}#mcsb-import-options-modal .mcsb-import-options-container div.mcsb-import-options ul li .mcsb-option-description{margin-left:15px}#mcsb-import-options-modal .mcsb-import-options-container div.mcsb-import-buttons{display:flex;justify-content:flex-end}#mcsb-import-options-modal .mcsb-import-options-container div.mcsb-import-buttons .button{margin:0 0 0 20px}#ilab-upload-target{position:fixed;left:0;right:0;bottom:0;top:0;display:flex;justify-content:center;align-items:center;font-size:2em;font-weight:700;color:#fff;background-color:rgba(28,90,129,.75);z-index:100000;transition:opacity .125s linear;opacity:0;pointer-events:none}#wpbody.drag-inside #ilab-upload-target{opacity:1}#mcsb-upload-modal{position:fixed;left:0;right:0;bottom:0;top:0;display:flex;justify-content:center;align-items:center;background:rgba(0,0,0,.66);z-index:100000;transition:opacity .125s linear;opacity:1}#mcsb-upload-modal.hidden{opacity:0;pointer-events:none}#mcsb-upload-modal #mcsb-upload-container{min-width:630px;min-height:385px;background-color:#fff;display:flex;flex-direction:column}#mcsb-upload-modal #mcsb-upload-container div.mcsb-upload-header{padding:20px;position:relative;font-weight:700}#mcsb-upload-modal #mcsb-upload-container div.mcsb-upload-items{position:relative;flex:1;background-color:#eaeaea}#mcsb-upload-modal #mcsb-upload-container div.mcsb-upload-items #mcsb-upload-items-container{padding:15px;position:absolute;left:0;top:0;right:0;bottom:0;overflow:auto;display:flex;flex-wrap:wrap}.ilab-browser-select{position:absolute;left:0;top:0;width:100%;height:100%;display:flex;flex-direction:column}.ilab-browser-select .ilab-browser-select-header{height:48px;min-height:48px;padding-left:12px;padding-right:64px;display:flex;align-items:center}.ilab-browser-select .ilab-browser-select-header input{flex:1;padding:7px 11px;border-radius:4px}.ilab-browser-select .ilab-browser-select-header input:disabled{color:#000}.ilab-browser-select .ilab-browser-select-table-container{flex:1;overflow-y:auto;background-color:#efefef}.ilab-browser-select .ilab-browser-select-footer{height:48px;min-height:48px;display:flex;align-items:center;justify-content:flex-end;padding-right:12px}.ilab-browser-select .ilab-browser-select-footer .button{margin-left:12px}.mcsb-modal-contents{border-radius:8px}.mcsb-modal-contents h3{background-image:url(../img/icon-cloud.svg);background-position:0;background-repeat:no-repeat;background-size:44px 44px;padding:12px 0 12px 60px!important}#task-manager div.available-tasks{padding:15px 20px 10px;display:flex;flex-direction:column;border-radius:8px;margin-bottom:25px;margin-top:30px;background-color:#e4e4e4}#task-manager div.available-tasks h2{margin:0 0 15px;padding:0;text-transform:uppercase;font-size:11px;color:#777}#task-manager div.available-tasks div.buttons{display:flex;flex-wrap:wrap}#task-manager div.available-tasks div.buttons .button{margin:0 10px 10px 0}#task-manager div.available-tasks div.actions{padding-top:20px;padding-bottom:10px;display:flex;justify-content:flex-end}#task-manager div.task-list{padding:18px 20px;border-radius:8px;background-color:#e4e4e4;margin-bottom:25px}#task-manager div.task-list h2{margin:0 0 15px;padding:0;text-transform:uppercase;font-size:11px;color:#777;display:flex;align-items:center;justify-content:space-between}#task-manager div.task-list table.task-table{width:100%;font-size:.9em}#task-manager div.task-list table.task-table td,#task-manager div.task-list table.task-table th{text-align:left;white-space:nowrap;padding:10px 20px;background-color:#efefef}#task-manager div.task-list table.task-table td.progress,#task-manager div.task-list table.task-table td.schedule,#task-manager div.task-list table.task-table th.progress,#task-manager div.task-list table.task-table th.schedule{width:100%}#task-manager div.task-list table.task-table th{background-color:#3a5674;color:#fff}#task-manager div.task-list table.task-table th:first-of-type{border-top-left-radius:4px}#task-manager div.task-list table.task-table th:last-of-type{border-top-right-radius:4px}#task-manager div.task-list table.task-table td.status{text-transform:capitalize}#task-manager div.task-list table.task-table td.status.status-complete{font-weight:700;color:green}#task-manager div.task-list table.task-table td.status.status-error{font-weight:700;color:#a70000}#task-manager div.task-list table.task-table td.progress{position:relative}#task-manager div.task-list table.task-table td.progress div.progress-bar{position:absolute;left:10px;top:10px;bottom:10px;right:10px;background-color:#ccc;display:flex;align-items:center;justify-content:center;overflow:hidden;border-radius:4px}#task-manager div.task-list table.task-table td.progress div.progress-bar .bar{position:absolute;left:0;top:0;bottom:0;width:75%;background-color:#50ade2}#task-manager div.task-list table.task-table td.progress div.progress-bar .amount{z-index:2;color:#fff;font-weight:700}#task-manager div.task-list table.task-table tbody tr:last-of-type td:first-of-type{border-bottom-left-radius:4px}#task-manager div.task-list table.task-table tbody tr:last-of-type td:last-of-type{border-bottom-right-radius:4px}.task-options-modal{position:fixed;left:0;top:0;right:0;bottom:0;background:rgba(0,0,0,.75);z-index:100000;display:flex;align-items:center;justify-content:center;transition:opacity .25s linear}.task-options-modal.invisible{opacity:0}.task-options-modal.invisible .task-modal{transform:scale(.95)}.task-options-modal .task-modal{background-color:#fff;padding:30px;border-radius:8px;transition:transform .25s ease-in-out}.task-options-modal .task-modal h2{padding:0;font-size:1.2em;margin:0 0 40px}.task-options-modal .task-modal form ul{padding:0;display:flex;flex-direction:column;margin:20px 0 0}.task-options-modal .task-modal form ul li{display:flex;margin-bottom:30px}.task-options-modal .task-modal form ul li:last-of-type{margin-bottom:0}.task-options-modal .task-modal form ul li>div:first-of-type{padding:10px 10px 20px 0;width:160px;min-width:160px;line-height:1.3;font-weight:600}.task-options-modal .task-modal form ul li>div:last-of-type{flex:1}.task-options-modal .task-modal form ul li div.description{margin-top:8px}.task-options-modal .task-modal form ul li div.option-ui{display:flex;align-items:center;width:100%}.task-options-modal .task-modal form ul li div.option-ui.option-ui-browser input[type=text]{flex:1;margin-right:10px;padding:7px 11px;border-radius:4px}.task-options-modal .task-modal form ul li div.option-ui.option-ui-browser input[type=text]:disabled{color:#000}.task-options-modal .task-modal form ul li div.option-ui.option-ui-media-select{display:flex;flex:1}.task-options-modal .task-modal form ul li div.option-ui.option-ui-media-select .media-select-label{flex:1;box-sizing:border-box;margin-right:10px;padding:7px 11px;border-radius:4px;background-color:hsla(0,0%,100%,.498039);border:1px solid hsla(0,0%,87.1%,.74902)}.task-options-modal .task-modal form ul li div.option-ui.option-ui-media-select .button{margin-right:5px}.task-options-modal .task-modal div.buttons{margin-top:40px;display:flex;justify-content:flex-end}.task-options-modal .task-modal div.buttons .button{margin-left:15px}#task-batch div.buttons{display:flex;justify-content:flex-end;margin-top:40px}#task-batch div.buttons .button-whoa{background:#a42929!important;border-color:#e62a2a #a42929 #a42929!important;box-shadow:0 1px 0 #a42929!important;color:#fff!important;text-decoration:none!important;text-shadow:0 -1px 1px #a42929,1px 0 1px #a42929,0 1px 1px #a42929,-1px 0 1px #a42929!important}#task-batch div.task-info .info-warning{border:1px solid orange;padding:24px;background:rgba(255,165,0,.125);margin-top:20px;border-radius:8px}#task-batch div.task-info .info-warning h4{padding:0;font-size:14px;margin:0 0 8px}#task-batch div.task-info .wp-cli-callout{padding:24px;background:#ddd;margin-top:20px;border-radius:8px}#task-batch div.task-info .wp-cli-callout h3{margin:0;padding:0;font-size:14px}#task-batch div.task-info .wp-cli-callout code{background-color:#bbb;padding:10px 15px;margin-top:5px;display:inline-block}#task-batch div.task-info .task-options{padding:24px;background:#e7e7e7;margin-top:20px;border-radius:8px}#task-batch div.task-info .task-options h3{margin:0;padding:0;font-size:14px}#task-batch div.task-info .task-options ul{padding:0;display:flex;flex-direction:column;margin:20px 0 0}#task-batch div.task-info .task-options ul li{display:flex;margin-bottom:30px}#task-batch div.task-info .task-options ul li:last-of-type{margin-bottom:0}#task-batch div.task-info .task-options ul li>div:first-of-type{padding:10px 10px 20px 0;width:160px;min-width:160px;line-height:1.3;font-weight:600}#task-batch div.task-info .task-options ul li div.description{margin-top:8px}#task-batch div.task-info .task-options ul li div.option-ui{display:flex;align-items:center}#task-batch div.task-info .task-options ul li div.option-ui.option-ui-browser{display:flex;width:50vw}#task-batch div.task-info .task-options ul li div.option-ui.option-ui-browser input[type=text]{flex:1;margin-right:10px;padding:7px 11px;border-radius:4px}#task-batch div.task-info .task-options ul li div.option-ui.option-ui-browser input[type=text]:disabled{color:#000}#task-batch div.task-info .task-options ul li div.option-ui.option-ui-media-select{display:flex;width:50vw}#task-batch div.task-info .task-options ul li div.option-ui.option-ui-media-select .media-select-label{flex:1;box-sizing:border-box;margin-right:10px;padding:7px 11px;border-radius:4px;background-color:hsla(0,0%,100%,.498039)}#task-batch div.task-info .task-options ul li div.option-ui.option-ui-media-select .button{margin-right:5px}#task-batch div.task-progress{padding:24px;background:#ddd;border-radius:8px}#task-batch div.task-progress .progress-container{position:relative;width:100%;height:14px;background:#aaa;border-radius:16px;overflow:hidden;background-image:url(../img/candy-stripe.svg)}#task-batch div.task-progress .progress-container .progress-bar{background-color:#4f90c4;height:100%;width:10px}#task-batch div.task-progress .progress-thumbnails{position:relative;width:100%;height:150px;margin-bottom:15px}#task-batch div.task-progress .progress-thumbnails .progress-thumbnails-container{position:absolute;left:0;top:0;right:0;bottom:0;overflow:hidden;-webkit-mask-image:linear-gradient(90deg,#ddd 0,hsla(0,0%,86.7%,0) 90%);mask-image:linear-gradient(90deg,#ddd 0,hsla(0,0%,86.7%,0) 90%)}#task-batch div.task-progress .progress-thumbnails .progress-thumbnails-container img{width:150px;height:150px;max-width:150px;max-height:150px;border-radius:4px;margin-right:10px}#task-batch div.task-progress .progress-thumbnails .progress-thumbnails-container .item-title{color:#fff;position:absolute;right:10px;bottom:7px;text-align:right;left:10px;text-overflow:ellipsis;white-space:nowrap;overflow:hidden;text-shadow:1px 1px 2px rgba(0,0,0,.75);font-weight:700}#task-batch div.task-progress .progress-thumbnails .progress-thumbnails-container .progress-thumb{position:absolute;left:0;top:0;width:150px;min-width:150px;max-width:150px;height:150px;min-height:150px;max-height:150px;background-size:cover;background-position:50%;background-repeat:no-repeat;margin-right:10px;border-radius:4px;background-color:#888;transition:opacity .25s linear,transform .25s linear}#task-batch div.task-progress .progress-thumbnails .progress-thumbnails-container .progress-thumb.invisible{opacity:0;transform:scale(.7)}#task-batch div.task-progress .progress-thumbnails .progress-thumbnails-container .progress-icon{position:absolute;left:0;top:0;position:relative;width:150px;min-width:150px;max-width:150px;height:150px;min-height:150px;max-height:150px;display:flex;align-items:center;justify-content:center;transition:opacity .25s linear,transform .25s linear}#task-batch div.task-progress .progress-thumbnails .progress-thumbnails-container .progress-icon.invisible{opacity:0;transform:scale(.8)}#task-batch div.task-progress .progress-thumbnails .progress-thumbnails-fade{background:linear-gradient(90deg,#ddd 0,hsla(0,0%,86.7%,0) 90%);position:absolute;left:150px;top:0;right:0;bottom:0}@supports ((-webkit-mask-image:linear-gradient(to left,rgba(221,221,221,0) 0%,#dddddd 95%,#dddddd 100%)) or (mask-image:linear-gradient(to left,rgba(221,221,221,0) 0%,#dddddd 95%,#dddddd 100%))){#task-batch div.task-progress .progress-thumbnails .progress-thumbnails-fade{display:none}}#task-batch div.task-progress .progress-thumbnails .progress-thumbnails-cloud{position:absolute;right:20px;top:50%;transform:translateY(-50%)}#task-batch div.task-progress .progress-stats{margin-top:20px;display:flex;align-items:center;justify-content:center}@media (max-width:960px){#task-batch div.task-progress .progress-stats{flex-direction:column;align-items:flex-start;justify-content:flex-start}}#task-batch div.task-progress .progress-stats div.group-break{display:flex;margin-right:1.2195121951vw}#task-batch div.task-progress .progress-stats div.group-break:last-of-type{margin-right:0}#task-batch div.task-progress .progress-stats div.group-break:first-of-type{flex:1}@media (max-width:960px){#task-batch div.task-progress .progress-stats div.group-break{width:100%;margin-bottom:1.2195121951vw}}#task-batch div.task-progress .progress-stats div.group{display:flex;align-items:center;padding:1.0975609756vw 0;background-color:#e6e6e6;border-radius:8px;margin-right:1.2195121951vw}#task-batch div.task-progress .progress-stats div.group *{white-space:nowrap}@media (max-width:960px){#task-batch div.task-progress .progress-stats div.group.mobile-flexed{flex:1}}#task-batch div.task-progress .progress-stats div.group.flexed{flex:1}#task-batch div.task-progress .progress-stats div.group:last-of-type{margin-right:0}#task-batch div.task-progress .progress-stats div.group div.callout{position:relative;margin-right:.6097560976vw;padding:0 1.4634146341vw}#task-batch div.task-progress .progress-stats div.group div.callout:after{display:block;position:absolute;content:"";height:50%;width:1px;right:0;top:25%;background-color:rgba(0,0,0,.25)}#task-batch div.task-progress .progress-stats div.group div.callout:last-of-type:after{display:none}#task-batch div.task-progress .progress-stats div.group div.callout p.value{line-height:1;padding:0;font-size:1.5853658537vw;font-weight:300;margin:0 0 .487804878vw}#task-batch div.task-progress .progress-stats div.group div.callout p.value.status{text-transform:capitalize}@media (max-width:960px){#task-batch div.task-progress .progress-stats div.group div.callout p.value{font-size:2.9268292683vw}}#task-batch div.task-progress .progress-stats div.group div.callout h4{line-height:1;margin:0;padding:0;font-size:.6097560976vw;text-transform:uppercase}@media (max-width:960px){#task-batch div.task-progress .progress-stats div.group div.callout h4{font-size:.8536585366vw}} /*! mediabox v1.1.3 | (c) 2018 Pedro Rogerio | https://github.com/pinceladasdaweb/mediabox */.stop-scroll{height:100%;overflow:hidden}.mediabox-wrap{position:fixed;width:100%;height:100%;background-color:rgba(0,0,0,.8);top:0;left:0;opacity:0;z-index:999;-webkit-animation-duration:.5s;animation-duration:.5s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-name:mediabox;animation-name:mediabox}@-webkit-keyframes mediabox{0%{opacity:0}to{opacity:1}}@keyframes mediabox{0%{opacity:0}to{opacity:1}}.mediabox-content{max-width:853px;display:block;margin:0 auto;height:100%;position:relative}.mediabox-content iframe{max-width:100%!important;width:100%!important;display:block!important;height:480px!important;border:none!important;position:absolute;top:0;bottom:0;margin:auto 0}.mediabox-hide{-webkit-animation-duration:.5s;animation-duration:.5s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-name:mediaboxhide;animation-name:mediaboxhide}@-webkit-keyframes mediaboxhide{0%{opacity:1}to{opacity:0}}@keyframes mediaboxhide{0%{opacity:1}to{opacity:0}}.mediabox-close{position:absolute;top:0;cursor:pointer;bottom:528px;right:0;margin:auto 0;width:24px;height:24px;background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAIGNIUk0AAHolAACAgwAA+f8AAIDpAAB1MAAA6mAAADqYAAAXb5JfxUYAAAMvSURBVHja7Js9aBRBFMd/d1lPY6FiJVjY+Fkoxl7wA1Q0prQRS6tgoZV2MWIRRVHUUq3U+JnESrS2sBXBzipREWMlATXwt8gFznC5nd15M7Nn8uC45nZnfr/dY96+N1uTxFKOOks8lgUU/H2t4tJqIQUcAiaBGeBymcECRgO4B/wBPgJ9zkdKcvkclfRL/8ZtSTXH40N+GpLGF8zth6Q9Lse7DHCsDXxVJLSDLyQhb4B+Sb/VOVJJ6ATfKqGvrIDjDvCpJLjAz8d0JwmLDTBQAD62hIakiYJzm5a021VAfwn4WBLKwLdK2JUnIJP0XX4RSoIP/Hy8W3jeepv1dL3nmjwI3DLOExrAU2DA8zwb8xKhGeCuwYQtJTSAZwbwAHdcEqFM0mPZhO/foSHppdFcrraby2IDV0FCcPi8PCClhCjwLplgCgkrDeGv5I3pcjViSogK7yogloTo8EUEhJaQBL6oAGsJ9yVtkrRD0qsU8JKolagKZ8AD4ETFymFXgPOAQpXE5mMWOAk86XZ4n6pwlSSUhvcti1dBghe8RV8gpYQRX3irxkgKCSPABV94y85QTAlm8NatsRgSTOGBUnmAS57w3KiA0Ro3gHOW8KEEAOwE3hvfXWubFauu6A6vCND07OmW9viq5vpsGT3AtRAN2XoA+BfAwQBiTweoNpMZw48BRwKuAoPN7zNVWwZjwAfpO9S7DN5cQmYAPw4cTvAsYPJ3qHcpvNmdUO9ieBMJZQT0AhMVgfeWUC8BP87cjjHfuA6sATY0c4c0EgpUUHslvTaq3l5aUL1N1oarAnxSCVWBTyYhJvyw41XJJI3GkpAH/yYyfHQJi01gdUL4qBKqCh9NQrtBx4wGvGi0XS6T9MhoTkN5AtZVDN5awlTePsGfwDfPjGwYGDKu3s4Cp4BRz/N8cskED0iaqciVt7wTvkra5roKlJEQGt5HwhdJ24vmAUUkDEV+VyCT9NBxbp/bXXnXTNBFQmz4IhI6wrs+C+zvICEVvIuEKUlbrZ4G97WRkBq+k4RJSVusd4ntlfSheVudrQh8q4SbmntH6K2kzSF3if1Xsfzq7LKAJR5/BwCdAQBJn4egPgAAAABJRU5ErkJggg==") no-repeat;background-size:24px 24px}.mediabox-close:hover{opacity:.5}@media (max-width:768px){.mediabox-content{max-width:90%}}@media (max-width:600px){.mediabox-content iframe{height:320px!important}.mediabox-close{bottom:362px}}@media (max-width:480px){.mediabox-content iframe{height:220px!important}.mediabox-close{bottom:262px}}.mediabox-wrap{z-index:1000000}.mediabox-content{max-width:75vw}.mediabox-content iframe{height:42.1875vw!important}.mediabox-close{bottom:46vw}.ic-Super-toggle__label{box-sizing:border-box;margin:0;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.ic-Form-group.ic-Form-group--horizontal .ic-Super-toggle__label{display:inline-flex;align-items:center}.ic-Super-toggle__input{opacity:0;position:absolute}.ic-Super-toggle__input:checked~label .ic-Super-toggle-switch:after{transform:translate3d(100%,0,0)}.ic-Super-toggle__input:checked~label .ic-Super-toggle__disabled-msg:before{content:attr(data-checked)}.ic-Super-toggle__input[disabled]{opacity:0!important}.ic-Super-toggle__input[disabled]~label .ic-Super-toggle-switch{opacity:.33}.ic-Super-toggle-switch{transition:background .1s,border-color .1s;position:relative;line-height:1;display:flex;align-items:center;background-clip:padding-box}.ic-Super-toggle-switch:after{transition:all .1s ease-in-out;content:"";position:absolute;top:0;left:0;transform:translateZ(0);border-radius:100%;box-shadow:0 3px 6px rgba(0,0,0,.3);background-image:url(https://cl.ly/320m31452k2X/handle.svg);background-position:50% 50%;background-repeat:no-repeat;background-size:20px}.ic-Super-toggle__disabled-msg{display:none}.ic-Super-toggle__disabled-msg:before{content:attr(data-unchecked);font-style:italic;opacity:.8}[class^=ic-Super-toggle-option-]{transition:all .2s ease-out;flex:0 0 50%;text-align:center;position:relative;z-index:1;text-transform:uppercase;font-weight:700;line-height:1;speak:none;box-sizing:border-box}.ic-Super-toggle__screenreader{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute}.ic-Super-toggle--on-off{display:inline-block;vertical-align:middle}.ic-Super-toggle--on-off .ic-Super-toggle__input:focus~label .ic-Super-toggle-switch:after{box-shadow:inset 0 0 0 1px #fff,inset 0 0 0 3px #5b6c79,0 3px 6px rgba(0,0,0,.3)}.ic-Super-toggle--on-off .ic-Super-toggle__input:checked~label .ic-Super-toggle-switch{background:#4cace3;border-color:#4cace3}.ic-Super-toggle--on-off .ic-Super-toggle__input:checked~label .ic-Super-toggle-option-LEFT{color:#fff}.ic-Super-toggle--on-off .ic-Super-toggle__input:checked~label .ic-Super-toggle-option-LEFT .ic-Super-toggle__svg>*{fill:#fff}.ic-Super-toggle--on-off .ic-Super-toggle__input:checked~label .ic-Super-toggle-option-RIGHT{color:#fff}.ic-Super-toggle--on-off .ic-Super-toggle__input:checked~label .ic-Super-toggle-option-RIGHT .ic-Super-toggle__svg>*{fill:#fff}.ic-Super-toggle--on-off .ic-Super-toggle__input:checked:focus~label .ic-Super-toggle-switch:after{box-shadow:inset 0 0 0 1px #fff,inset 0 0 0 3px #4cace3,0 3px 6px rgba(0,0,0,.3)}.ic-Super-toggle--on-off .ic-Super-toggle-switch{width:50px;height:25px;background:#5b6c79;border:2px solid #5b6c79;border-radius:14.5px}.ic-Form-group.ic-Form-group--horizontal .ic-Super-toggle--on-off .ic-Super-toggle-switch{flex:0 0 50px}.ic-Super-toggle--on-off .ic-Super-toggle-switch:after{background-color:#fff;width:25px;height:25px}.ic-Super-toggle--on-off .ic-Super-toggle-option-LEFT{color:#fff}.ic-Super-toggle--on-off .ic-Super-toggle-option-LEFT .ic-Super-toggle__svg>*{fill:#fff}.ic-Super-toggle--on-off .ic-Super-toggle-option-RIGHT{color:#fff}.ic-Super-toggle--on-off .ic-Super-toggle-option-RIGHT .ic-Super-toggle__svg>*{fill:#fff}.ic-Super-toggle--on-off .ic-Super-toggle__svg{max-width:12.5px;max-height:12.5px}.ic-Super-toggle--on-off [class^=ic-Super-toggle-option-]{transition-delay:.1s}.ic-Super-toggle--on-off .ic-Super-toggle-option-LEFT{transform:scale(.1);opacity:0}.ic-Super-toggle--on-off .ic-Super-toggle-option-RIGHT,.ic-Super-toggle--on-off .ic-Super-toggle__input:checked~label .ic-Super-toggle-option-LEFT{transform:scale(1);opacity:1}.ic-Super-toggle--on-off .ic-Super-toggle__input:checked~label .ic-Super-toggle-option-RIGHT{transform:scale(.1);opacity:0}.toggle-warning{display:inline-block;vertical-align:middle}.toggle-warning .ic-Super-toggle__input:focus~label .ic-Super-toggle-switch:after{box-shadow:inset 0 0 0 1px #fff,inset 0 0 0 3px #5b6c79,0 3px 6px rgba(0,0,0,.3)}.toggle-warning .ic-Super-toggle__input:checked~label .ic-Super-toggle-switch{background:#ffaa10;border-color:#ffaa10}.toggle-warning .ic-Super-toggle__input:checked~label .ic-Super-toggle-option-LEFT{color:#fff}.toggle-warning .ic-Super-toggle__input:checked~label .ic-Super-toggle-option-LEFT .ic-Super-toggle__svg>*{fill:#fff}.toggle-warning .ic-Super-toggle__input:checked~label .ic-Super-toggle-option-RIGHT{color:#fff}.toggle-warning .ic-Super-toggle__input:checked~label .ic-Super-toggle-option-RIGHT .ic-Super-toggle__svg>*{fill:#fff}.toggle-warning .ic-Super-toggle__input:checked:focus~label .ic-Super-toggle-switch:after{box-shadow:inset 0 0 0 1px #fff,inset 0 0 0 3px #ffaa10,0 3px 6px rgba(0,0,0,.3)}.toggle-warning .ic-Super-toggle-switch{width:50px;height:25px;background:#5b6c79;border:2px solid #5b6c79;border-radius:14.5px}.ic-Form-group.ic-Form-group--horizontal .toggle-warning .ic-Super-toggle-switch{flex:0 0 50px}.toggle-warning .ic-Super-toggle-switch:after{background-color:#fff;width:25px;height:25px}.toggle-warning .ic-Super-toggle-option-LEFT{color:#fff}.toggle-warning .ic-Super-toggle-option-LEFT .ic-Super-toggle__svg>*{fill:#fff}.toggle-warning .ic-Super-toggle-option-RIGHT{color:#fff}.toggle-warning .ic-Super-toggle-option-RIGHT .ic-Super-toggle__svg>*{fill:#fff}.toggle-warning .ic-Super-toggle__svg{max-width:12.5px;max-height:12.5px}.ic-Super-toggle--ui-switch{display:inline-block;vertical-align:middle}.ic-Super-toggle--ui-switch .ic-Super-toggle__input:focus~label .ic-Super-toggle-switch:after{box-shadow:inset 0 0 0 1px #fff,inset 0 0 0 3px #5b6c79,0 3px 6px rgba(0,0,0,.3)}.ic-Super-toggle--ui-switch .ic-Super-toggle__input:checked~label .ic-Super-toggle-switch{background:#5b6c79;border-color:#5b6c79}.ic-Super-toggle--ui-switch .ic-Super-toggle__input:checked~label .ic-Super-toggle-option-LEFT{color:#888}.ic-Super-toggle--ui-switch .ic-Super-toggle__input:checked~label .ic-Super-toggle-option-LEFT .ic-Super-toggle__svg>*{fill:#888}.ic-Super-toggle--ui-switch .ic-Super-toggle__input:checked~label .ic-Super-toggle-option-RIGHT{color:#08c}.ic-Super-toggle--ui-switch .ic-Super-toggle__input:checked~label .ic-Super-toggle-option-RIGHT .ic-Super-toggle__svg>*{fill:#08c}.ic-Super-toggle--ui-switch .ic-Super-toggle__input:checked:focus~label .ic-Super-toggle-switch:after{box-shadow:inset 0 0 0 1px #fff,inset 0 0 0 3px #5b6c79,0 3px 6px rgba(0,0,0,.3)}.ic-Super-toggle--ui-switch .ic-Super-toggle-switch{width:50px;height:25px;background:#5b6c79;border:2px solid #5b6c79;border-radius:14.5px}.ic-Form-group.ic-Form-group--horizontal .ic-Super-toggle--ui-switch .ic-Super-toggle-switch{flex:0 0 50px}.ic-Super-toggle--ui-switch .ic-Super-toggle-switch:after{background-color:#fff;width:25px;height:25px}.ic-Super-toggle--ui-switch .ic-Super-toggle-option-LEFT{color:#08c}.ic-Super-toggle--ui-switch .ic-Super-toggle-option-LEFT .ic-Super-toggle__svg>*{fill:#08c}.ic-Super-toggle--ui-switch .ic-Super-toggle-option-RIGHT{color:#888}.ic-Super-toggle--ui-switch .ic-Super-toggle-option-RIGHT .ic-Super-toggle__svg>*{fill:#888}.ic-Super-toggle--ui-switch .ic-Super-toggle__svg{max-width:12.5px;max-height:12.5px}.ic-Super-toggle--ui-switch .ic-Super-toggle__label{display:inline-flex;align-items:center}.ic-Super-toggle--ui-switch .ic-Super-toggle-switch{display:block}.ic-Super-toggle--ui-switch [class^=ic-Super-toggle-option-]{flex:none;min-width:24px}.ic-Super-toggle--ui-switch .ic-Super-toggle-option-LEFT{text-align:left;transform:scale(1.1)}.ic-Super-toggle--ui-switch .ic-Super-toggle-option-RIGHT{text-align:right;transform:scale(.9)}.ic-Super-toggle--ui-switch .ic-Super-toggle__input:checked~label .ic-Super-toggle-option-LEFT{transform:scale(.9)}.ic-Super-toggle--ui-switch .ic-Super-toggle__input:checked~label .ic-Super-toggle-option-RIGHT{transform:scale(1.1)}.settings-container{font-family:system-ui,-apple-system,BlinkMacSystemFont,Avenir Next,Avenir,Segoe UI,Lucida Grande,Helvetica Neue,Helvetica,Fira Sans,Roboto,Noto,Droid Sans,Cantarell,Oxygen,Ubuntu,Franklin Gothic Medium,Century Gothic,Liberation Sans,sans-serif;margin:0 0 64px -20px}.settings-container header{position:relative;background-image:url(../img/settings-bg-large.svg);background-position:0;background-repeat:no-repeat;background-size:cover;min-height:80px;width:100%;display:flex;align-items:center}.settings-container header>img{margin:0 20px;width:88px;max-width:88px}.settings-container header h1{margin-left:5px;font-family:system-ui,-apple-system,BlinkMacSystemFont,Avenir Next,Avenir,Segoe UI,Lucida Grande,Helvetica Neue,Helvetica,Fira Sans,Roboto,Noto,Droid Sans,Cantarell,Oxygen,Ubuntu,Franklin Gothic Medium,Century Gothic,Liberation Sans,sans-serif;text-transform:uppercase;font-weight:400;font-size:1.5em;color:#777}.settings-container header .header-actions{position:absolute!important;right:40px;top:50%;transform:translateY(-50%)!important;display:flex}.settings-container header .header-actions a{margin-left:8px;display:flex;align-items:center}.settings-container header .header-actions a svg{height:16px;width:auto;margin-right:8px}.settings-container header .header-actions a svg>path,.settings-container header .header-actions a svg>rect{fill:#fff}.settings-container header .header-actions div.spacer{width:8px;min-width:8px}.settings-container header.all-settings{display:flex;flex-direction:column;align-items:flex-start}.settings-container header.all-settings div.contents{height:104px;display:flex;justify-content:space-between;align-items:center;width:100%}.settings-container header.all-settings div.contents img.logo{margin:0 0 0 23px;width:108px;max-width:108px}.settings-container header.all-settings div.contents div.settings-select-container{background-color:hsla(0,0%,100%,.6);padding:10px 14px;border-radius:8px;z-index:1000;margin-right:23px;display:none}@media (max-width:992px){.settings-container header.all-settings div.contents div.settings-select-container{display:unset}}.settings-container header.all-settings div.contents div.settings-select-container nav.dropdown{display:flex;align-items:center;z-index:1000}.settings-container header.all-settings div.contents div.settings-select-container nav.dropdown>div:first-of-type{font-family:system-ui,-apple-system,BlinkMacSystemFont,Avenir Next,Avenir,Segoe UI,Lucida Grande,Helvetica Neue,Helvetica,Fira Sans,Roboto,Noto,Droid Sans,Cantarell,Oxygen,Ubuntu,Franklin Gothic Medium,Century Gothic,Liberation Sans,sans-serif;margin-right:10px;color:#777;text-decoration:none;text-transform:uppercase;font-weight:700;font-size:1em}.settings-container header.all-settings div.contents div.settings-select-container nav.dropdown div.dropdown{position:relative;width:200px;height:36px;z-index:1000;cursor:pointer}.settings-container header.all-settings div.contents div.settings-select-container nav.dropdown div.dropdown div.current{font-family:system-ui,-apple-system,BlinkMacSystemFont,Avenir Next,Avenir,Segoe UI,Lucida Grande,Helvetica Neue,Helvetica,Fira Sans,Roboto,Noto,Droid Sans,Cantarell,Oxygen,Ubuntu,Franklin Gothic Medium,Century Gothic,Liberation Sans,sans-serif;display:flex;align-items:center;position:absolute;left:0;top:0;right:0;bottom:0;background-color:#eee;border:1px solid #ddd;padding-left:10px;color:#777;text-decoration:none;text-transform:uppercase;font-weight:700;font-size:13px;cursor:pointer;background-image:url(../img/icon-dropdown-arrow.svg);background-repeat:no-repeat;background-position:right 12px center;transition:background-color .15s linear}.settings-container header.all-settings div.contents div.settings-select-container nav.dropdown div.dropdown div.current:hover{background-color:#fff}.settings-container header.all-settings div.contents div.settings-select-container nav.dropdown div.dropdown div.items{z-index:1001;position:absolute;top:0;left:0;right:0;transition:opacity .15s linear,transform .15s linear;opacity:0;pointer-events:none}.settings-container header.all-settings div.contents div.settings-select-container nav.dropdown div.dropdown div.items.visible{pointer-events:auto;opacity:1}.settings-container header.all-settings div.contents div.settings-select-container nav.dropdown div.dropdown div.items ul{margin:0;padding:0;box-shadow:0 0 8px 1px rgba(0,0,0,.125)}.settings-container header.all-settings div.contents div.settings-select-container nav.dropdown div.dropdown div.items ul li{position:relative;margin:0;padding:0;border:1px solid #ddd;border-top:0;align-items:center}.settings-container header.all-settings div.contents div.settings-select-container nav.dropdown div.dropdown div.items ul li:first-of-type{border:1px solid #ddd}.settings-container header.all-settings div.contents div.settings-select-container nav.dropdown div.dropdown div.items ul li a.tool{position:relative;display:flex;align-items:center;height:36px;background-color:#eee;padding-left:10px;color:#777;text-decoration:none;text-transform:uppercase;font-weight:700;font-size:13px;transition:background-color .15s linear}.settings-container header.all-settings div.contents div.settings-select-container nav.dropdown div.dropdown div.items ul li a.tool:hover{background:#fff}.settings-container header.all-settings div.contents div.settings-select-container nav.dropdown div.dropdown div.items ul li a.tool-pin{display:block;position:absolute;top:0;width:36px;height:36px;right:0;background-image:url(../img/icon-pin-deselected.svg);background-repeat:no-repeat;background-position:50%}.settings-container header.all-settings div.contents div.settings-select-container nav.dropdown div.dropdown div.items ul li a.tool-pin.pinned{background-image:url(../img/icon-pin-selected.svg)}.settings-container header.all-settings div.contents div.settings-select-container nav.dropdown div.dropdown div.items ul li.active a.tool{background:#fff}.settings-container header.all-settings div.contents div.settings-select-container nav.dropdown.active div.dropdown div.current{background-color:#ddd}.settings-container header.all-settings div.mcloud-settings-tabs{position:relative;width:100%;padding-left:23px;border-bottom:1px solid #d1d1d1;width:calc(100% - 24px);margin-top:8px}@media (max-width:992px){.settings-container header.all-settings div.mcloud-settings-tabs{display:none}}.settings-container header.all-settings div.mcloud-settings-tabs .navwrap{position:relative;overflow:hidden;transform:translateY(1px);width:100%;height:36px}.settings-container header.all-settings div.mcloud-settings-tabs .navwrap ul{position:absolute;left:0;top:0;bottom:0;width:30000px;display:flex;align-items:center;padding:0;margin:0}.settings-container header.all-settings div.mcloud-settings-tabs .navwrap ul li{height:100%;display:flex;margin:0 3px 0 0;padding:0 11px 0 14px;background-color:#ddd;align-items:center;border:1px solid #d1d1d1;border-bottom:none;border-top-left-radius:4px;border-top-right-radius:4px}.settings-container header.all-settings div.mcloud-settings-tabs .navwrap ul li a.tool{display:flex;align-items:center;color:#777;text-decoration:none;text-transform:uppercase;font-weight:700;font-size:11px;white-space:nowrap}.settings-container header.all-settings div.mcloud-settings-tabs .navwrap ul li a.tool-pin{display:block;width:20px;height:36px;margin-left:8px;background-image:url(../img/icon-pin-deselected.svg);background-repeat:no-repeat;background-position:50%;background-size:14px}.settings-container header.all-settings div.mcloud-settings-tabs .navwrap ul li a.tool-pin.pinned{background-image:url(../img/icon-pin-selected.svg)}.settings-container header.all-settings div.mcloud-settings-tabs .navwrap ul li.active{background-color:#f1f1f1}.settings-container header.all-settings div.mcloud-settings-tabs .navwrap ul li.active a{color:#000}.settings-container header.all-settings div.mcloud-settings-tabs a.tabs-nav{position:absolute;display:flex;align-items:center;justify-content:center;width:96px;top:-1px;bottom:0}.settings-container header.all-settings div.mcloud-settings-tabs a.tabs-nav span{font-size:0;line-height:0;display:block;width:20px;height:20px;background-repeat:no-repeat;background-position:50%;background-size:contain}.settings-container header.all-settings div.mcloud-settings-tabs a.tabs-nav.hidden{opacity:0;pointer-events:none}.settings-container header.all-settings div.mcloud-settings-tabs a.tabs-prev{left:0;justify-content:flex-start;background:linear-gradient(90deg,#f1f1f1 50%,hsla(0,0%,94.5%,0))}.settings-container header.all-settings div.mcloud-settings-tabs a.tabs-prev span{margin-left:10px;background-image:url(../img/ilab-icons-prev.svg)}.settings-container header.all-settings div.mcloud-settings-tabs a.tabs-next{right:0;justify-content:flex-end;background:linear-gradient(270deg,#f1f1f1 50%,hsla(0,0%,94.5%,0))}.settings-container header.all-settings div.mcloud-settings-tabs a.tabs-next span{margin-right:10px;background-image:url(../img/ilab-icons-next.svg)}.settings-container header.all-settings div.mcloud-settings-tabs.animated .navwrap ul{transition:transform .25s linear}.settings-container header.all-settings div.mcloud-settings-tabs.animated a.tabs-nav{transition:opacity .25s linear}.settings-container .settings-body{margin:20px}.settings-container .settings-body .settings-description{font-size:1.1em;text-align:center;background-color:#fafafa;padding:25px;border-radius:8px;margin-bottom:20px}.settings-container .settings-body.show-upgrade{display:flex}.settings-container .settings-body.show-upgrade>.settings-interior{flex:1;margin-right:20px}@media (max-width:64em){.settings-container .settings-body.show-upgrade>.settings-interior{order:1;margin-right:0}}@media (max-width:64em){.settings-container .settings-body.show-upgrade{flex-direction:column}}.settings-container .settings-body .upgrade-feature{background-color:#fafafa;border-radius:8px;padding:15px 20px}.settings-container .settings-body .upgrade-feature h2{padding:0;margin:0 0 30px;color:#46a4dd}.settings-container .settings-body .upgrade-feature ul{margin-left:20px;list-style:unset}.settings-container .settings-body .upgrade-feature ul li{list-style-type:square}.settings-container .settings-body .upgrade-feature div.button-container{text-align:right;padding:20px 0}.settings-container .settings-body .upgrade-feature div.button-container a{padding:10px;background-color:#46a4dd;border-radius:6px;color:#fff;text-decoration:none;font-weight:700;font-size:1.1em}.settings-container .settings-body .upgrade-promo{min-width:200px;max-width:320px;position:relative}.settings-container .settings-body .upgrade-promo .upgrade-interior{position:relative;background-color:#fafafa;border-radius:8px;padding:15px 20px}.settings-container .settings-body .upgrade-promo .upgrade-interior h2{padding:0;margin:0 0 30px;color:#46a4dd}.settings-container .settings-body .upgrade-promo .upgrade-interior ul{margin-left:20px}.settings-container .settings-body .upgrade-promo .upgrade-interior ul li{list-style-type:square}@media (max-width:64em){.settings-container .settings-body .upgrade-promo .upgrade-interior ul{display:flex;flex-wrap:wrap;width:100%}@supports (display:grid){.settings-container .settings-body .upgrade-promo .upgrade-interior ul{display:grid;grid-template-columns:1fr 1fr 1fr}}.settings-container .settings-body .upgrade-promo .upgrade-interior ul li{margin-right:30px}}@media (max-width:48.9275em){@supports (display:grid){.settings-container .settings-body .upgrade-promo .upgrade-interior ul{grid-template-columns:1fr 1fr}}}.settings-container .settings-body .upgrade-promo .upgrade-interior div.button-container{text-align:right;padding:20px 0}.settings-container .settings-body .upgrade-promo .upgrade-interior div.button-container a{padding:10px;background-color:#46a4dd;border-radius:6px;color:#fff;text-decoration:none;font-weight:700;font-size:1.1em}.settings-container .settings-body .upgrade-promo .upgrade-interior a.upgrade-close{display:none;position:absolute;top:15px;right:20px}@media (max-width:64em){.settings-container .settings-body .upgrade-promo .upgrade-interior a.upgrade-close{display:block}}@media (max-width:64em){.settings-container .settings-body .upgrade-promo{order:0;margin-bottom:20px;max-width:100%}}@media (max-width:64em){.settings-container .settings-body .upgrade-promo.hide-on-mobile{display:none}}.button-warning{background:#dd9000!important;border-color:#dd9000 #b97800 #b97800!important;box-shadow:0 1px 0 #b97800!important;color:#fff!important;text-decoration:none!important;text-shadow:0 -1px 1px #b97800,1px 0 1px #b97800,0 1px 1px #b97800,-1px 0 1px #b97800!important}.media-cloud-tool-description{padding:24px;background:#ddd;border-radius:8px;margin-bottom:20px}.media-cloud-tool-description h2{font-family:system-ui,-apple-system,BlinkMacSystemFont,Avenir Next,Avenir,Segoe UI,Lucida Grande,Helvetica Neue,Helvetica,Fira Sans,Roboto,Noto,Droid Sans,Cantarell,Oxygen,Ubuntu,Franklin Gothic Medium,Century Gothic,Liberation Sans,sans-serif;text-transform:uppercase;margin:0 0 5px;padding:0}.media-cloud-tool-description p{margin-top:0;font-size:1.2em}.ilab-notification-container .notice{margin-left:0;margin-right:0;margin-bottom:10px}.ilab-notification-container .notice:last-of-type{margin-bottom:20px}.ilab-settings-section{background-color:#fafafa;padding:25px;border-radius:8px;margin-bottom:20px;overflow:hidden;border:1px solid #eaeaea}.ilab-settings-section h2{padding:10px 25px;background-color:#fff;margin:-25px -25px 0;border-bottom:1px solid #eaeaea;font-family:system-ui,-apple-system,BlinkMacSystemFont,Avenir Next,Avenir,Segoe UI,Lucida Grande,Helvetica Neue,Helvetica,Fira Sans,Roboto,Noto,Droid Sans,Cantarell,Oxygen,Ubuntu,Franklin Gothic Medium,Century Gothic,Liberation Sans,sans-serif;font-weight:700;font-size:13px;color:#50ade2!important;text-transform:uppercase;display:flex;align-items:center}.ilab-settings-section h2 a.help-beacon{margin:0 0 0 10px;padding:0;display:block;width:16px;height:16px;color:transparent;overflow:hidden;background-image:url(../img/mcloud-icon-help.svg);background-position:50%;background-size:contain;background-repeat:no-repeat}.ilab-settings-section .section-description{margin-top:20px;margin-bottom:15px;font-style:italic}.ilab-settings-section .checkbox-w-description{display:flex;align-items:center}.ilab-settings-section .checkbox-w-description label{margin-right:20px}.ilab-settings-section .checkbox-w-description>div>p{margin:0}.ilab-settings-toggle{padding:0 25px 5px}.ilab-settings-toggle table.form-table tr{display:flex;flex-direction:row;align-items:center}@media (max-width:48.9275em){.ilab-settings-toggle table.form-table tr{flex-direction:column;align-items:flex-start}}.ilab-settings-toggle table.form-table tr th{min-width:200px;max-width:200px}@media (max-width:48.9275em){.ilab-settings-toggle table.form-table tr{margin-bottom:20px}.ilab-settings-toggle table.form-table tr th{margin-bottom:10px}}.ilab-settings-features{padding:10px 25px 15px}.ilab-settings-features table.form-table tr{display:flex;flex-direction:row;align-items:center}.ilab-settings-features table.form-table tr td.toggle{display:flex;align-items:center;max-width:240px;min-width:240px}.ilab-settings-features table.form-table tr td.toggle div.title{display:flex;flex-direction:column;margin-left:30px;white-space:nowrap;font-weight:700;font-size:1.05em}.ilab-settings-features table.form-table tr td.toggle div.title div.tool-links{display:flex}.ilab-settings-features table.form-table tr td.toggle div.title div.tool-links a{margin-right:10px;margin-top:5px;font-size:.85em;font-weight:400}.ilab-settings-features table.form-table tr td.toggle div.title div.tool-links a:last-of-type{margin-right:0}.ilab-settings-features table.form-table tr td.description p{font-size:1.05em}@media (max-width:48.9275em){.ilab-settings-features table.form-table tr{flex-direction:column;align-items:flex-start;margin-bottom:30px}.ilab-settings-features table.form-table td.toggle div.title{font-size:1.2em!important}}.ilab-settings-button{margin-top:40px;display:flex;justify-content:center}.ilab-settings-button p{padding:0;margin:0}.ilab-settings-batch-tools{display:flex}.ilab-settings-batch-tools a.button{margin-right:10px}.ilab-settings-batch-tools.has-submit{padding-right:10px;margin-right:20px;border-right:1px solid #ccc}span.tool-indicator{background:#ccc;border:1px solid #979797;display:block;width:9px;height:9px;border-radius:9px;margin-right:6px}span.tool-indicator.tool-active{background:#6dd51b}span.tool-indicator.tool-env-active{background:#fdac00}div.ilab-section-doc-links{margin-top:10px}div.ilab-section-doc-links div.doc-links-setting{background-color:rgba(0,0,0,.04);width:100%;border-radius:6px;display:flex;align-items:center;justify-content:center;padding:12px 0}div.ilab-section-doc-links div.doc-links-setting a{margin:0 5px!important}.troubleshooter-info li{margin:0;padding:8px 0 8px 28px;list-style:none;background-repeat:no-repeat;background-position:left top 6px;background-size:20px}.troubleshooter-info li.info-warning{background-image:url(../img/icon-warning.svg)}.troubleshooter-info li.info-success{background-image:url(../img/icon-success.svg)}.troubleshooter-info li.info-error{background-image:url(../img/icon-error.svg)}.troubleshooter-wait{display:flex;align-items:center}.troubleshooter-wait.hidden{display:none}.troubleshooter-wait>img{margin-right:7px;height:18px}.upload-path-preview{margin:10px 0;padding:10px;font-style:italic;background-color:#fff;border:1px dashed #ddd;display:flex;line-height:1;align-items:center}.upload-path-preview span:first-of-type{text-transform:uppercase;color:#ccc;font-size:11px;font-style:normal;margin-right:10px}.settings-image-preview-container{display:flex;flex-direction:column;margin-bottom:10px}.settings-image-preview-container .settings-image-preview{display:block;border:1px solid #ddd;width:256px;min-width:256px;height:256px;min-height:256px;margin-bottom:10px;background-color:#eee;background-size:contain;background-position:50%;background-repeat:no-repeat}.subsite-setting-group{margin-bottom:20px}.subsite-setting-group:last-of-type{margin-bottom:0}.subsite-upload-path{display:flex;align-items:center}.subsite-upload-path label{min-width:100px}.presigned-url-container>div{display:flex;align-items:flex-start;margin-bottom:20px}.presigned-url-container>div:nth-of-type(2n){margin-bottom:40px}.presigned-url-container>div:last-of-type{margin-bottom:0}.presigned-url-container>div div.presigned-label{line-height:1.3;font-weight:600;margin-right:10px;margin-top:6px;min-width:175px}.privacy-container>div{display:flex;align-items:flex-start;margin-bottom:20px}.privacy-container>div:last-of-type{margin-bottom:0}.privacy-container>div div.privacy-label{line-height:1.3;font-weight:600;margin-right:10px;margin-top:6px;min-width:135px}#beacon-container iframe{z-index:200000!important}.hljs{display:block;overflow-x:auto;padding:.5em;color:#abb2bf;background:#282c34}.hljs-comment,.hljs-quote{color:#5c6370;font-style:italic}.hljs-doctag,.hljs-formula,.hljs-keyword{color:#c678dd}.hljs-deletion,.hljs-name,.hljs-section,.hljs-selector-tag,.hljs-subst{color:#e06c75}.hljs-literal{color:#56b6c2}.hljs-addition,.hljs-attribute,.hljs-meta-string,.hljs-regexp,.hljs-string{color:#98c379}.hljs-built_in,.hljs-class .hljs-title{color:#e6c07b}.hljs-attr,.hljs-number,.hljs-selector-attr,.hljs-selector-class,.hljs-selector-pseudo,.hljs-template-variable,.hljs-type,.hljs-variable{color:#d19a66}.hljs-bullet,.hljs-link,.hljs-meta,.hljs-selector-id,.hljs-symbol,.hljs-title{color:#61aeee}.hljs-emphasis{font-style:italic}.hljs-strong{font-weight:700}.hljs-link{text-decoration:underline}.ilab-popup{position:fixed;left:0;top:0;width:100%;height:100%;background-color:rgba(0,0,0,.85);pointer-events:all;z-index:100002;display:flex;align-items:center;justify-content:center;transition:opacity .25s linear;opacity:1}.ilab-popup .ilab-popup-body{position:relative}.ilab-popup .ilab-popup-body .ilab-popup-contents{width:80vw;height:80vh;min-width:80vw;min-height:80vh;max-width:80vw;max-height:80vh;background-color:#fff}.ilab-popup .ilab-popup-body .ilab-popup-close{position:absolute;right:38px;top:12px;font-size:0}.ilab-popup .ilab-popup-body .ilab-popup-close:after,.ilab-popup .ilab-popup-body .ilab-popup-close:before{position:absolute;left:13px;content:" ";height:25px;width:2px;background-color:#000}.ilab-popup .ilab-popup-body .ilab-popup-close:before{transform:rotate(45deg)}.ilab-popup .ilab-popup-body .ilab-popup-close:after{transform:rotate(-45deg)}.ilab-popup.hidden{pointer-events:none;opacity:0}.mcloud-inline-help-container{position:fixed;left:0;top:0;right:0;bottom:0;z-index:100002;transition:opacity .25s linear}.mcloud-inline-help-container .mcloud-inline-help{background-color:#fff;position:absolute;width:375px;height:425px;box-shadow:0 0 10px 1px rgba(0,0,0,.25);border-radius:8px;transform-origin:left center;transition:transform .25s ease-out}.mcloud-inline-help-container .mcloud-inline-help .mcloud-inline-help-arrow{right:100%;top:50%;content:" ";height:0;width:0;position:absolute;pointer-events:none;border:10px solid hsla(0,0%,100%,0);border-right-color:#fff;margin-top:-10px}.mcloud-inline-help-container .mcloud-inline-help .mcloud-inline-help-body{box-sizing:border-box;position:absolute;left:15px;top:15px;right:7.5px;bottom:15px;padding-right:15px;overflow:auto}.mcloud-inline-help-container.mcloud-invisible{opacity:0;pointer-events:none}.mcloud-inline-help-container.mcloud-invisible .mcloud-inline-help{transform:scale(.8)}.mcloud-sidebar-help-container{position:fixed;left:0;top:0;right:0;bottom:0;z-index:1000001}.mcloud-sidebar-help-container .mcloud-sidebar-help{position:absolute;right:0;top:0;bottom:0;width:450px;transition:transform .25s linear;background-color:#fff;box-shadow:0 0 10px 1px rgba(0,0,0,.25)}.mcloud-sidebar-help-container .mcloud-sidebar-help .mcloud-sidebar-help-body{box-sizing:border-box;position:absolute;left:15px;top:0;right:7.5px;bottom:0;padding-top:15px;padding-right:22.5px;overflow:auto}.mcloud-sidebar-help-container .mcloud-sidebar-help .mcloud-sidebar-help-body figure{margin-left:0;margin-right:0;padding-left:0;padding-right:0}.mcloud-sidebar-help-container .mcloud-sidebar-help .mcloud-sidebar-help-body>img,.mcloud-sidebar-help-container .mcloud-sidebar-help .mcloud-sidebar-help-body figure img{width:100%;height:auto}.mcloud-sidebar-help-container .mcloud-sidebar-help .mcloud-sidebar-help-body div.code-block{overflow-x:auto}.mcloud-sidebar-help-container .mcloud-sidebar-help .mcloud-sidebar-close{display:block;position:absolute;right:10px;top:10px;font-size:0;line-height:0;width:14px;height:14px}.mcloud-sidebar-help-container .mcloud-sidebar-help .mcloud-sidebar-close:before{position:absolute;content:"";width:14px;height:2px;background-color:#aaa;transform:translateX(-50%) rotate(-45deg);left:50%;top:50%}.mcloud-sidebar-help-container .mcloud-sidebar-help .mcloud-sidebar-close:after{position:absolute;content:"";width:14px;height:2px;background-color:#aaa;transform:translateX(-50%) rotate(45deg);left:50%;top:50%}.mcloud-sidebar-help-container.mcloud-invisible{pointer-events:none}.mcloud-sidebar-help-container.mcloud-invisible .mcloud-sidebar-help{transform:translateX(100%)}body.modal-open #beacon-container{display:none!important}.BeaconContainer{right:10px!important;bottom:88px!important}.BeaconFabButtonFrame{right:10px!important;bottom:10px!important}.section-jumps{display:flex;align-items:center;justify-content:center;margin-top:30px;margin-bottom:35px}.section-jumps span.label{color:#777;text-decoration:none;text-transform:uppercase;font-weight:700;font-size:10px;margin-right:20px;margin-top:2px}.section-jumps a,.section-jumps span.label{display:block;line-height:1}.section-jumps span.sep{margin-left:10px;margin-right:10px;color:#777;font-weight:700;font-size:11px}.section-submit{display:flex;justify-content:center;border:1px solid #eaeaea;background-color:rgba(0,0,0,.04);width:100%;border-radius:6px;align-items:center;padding:12px 0;margin-top:20px}.section-submit p{margin:0;padding:0}.misc-pub-toggle-section{display:flex;align-items:center}.misc-pub-toggle-section div.label{margin-left:10px}.mux-simulcast-targets-table td{vertical-align:middle}.mux-simulcast-targets-table .column-enabled{width:80px}.mux-simulcast-targets-table .column-target{width:200px}.wizard-container{position:fixed;left:0;top:0;width:100%;height:100%;background-color:#000;z-index:100000;display:flex;align-items:center;justify-content:center;overflow:hidden;transition:opacity .333s linear}.wizard-container *{font-family:SF Pro Text,SFProText,system-ui,-apple-system,BlinkMacSystemFont,Avenir Next,Avenir,Segoe UI,Lucida Grande,Helvetica Neue,Helvetica,Fira Sans,Roboto,Noto,Droid Sans,Cantarell,Oxygen,Ubuntu,Franklin Gothic Medium,Century Gothic,Liberation Sans,sans-serif}.wizard-container a{text-decoration:none}.wizard-container a:focus{outline:none;box-shadow:none}.wizard-container .wizard-modal{position:relative;width:87.8048780488vw;height:51.2195121951vw;transition:transform .333s linear,opacity .333s linear}@media (min-width:102.5em){.wizard-container .wizard-modal{width:1440px}}@media (max-width:48.9275em){.wizard-container .wizard-modal{width:94.5083014049vw}}@media (min-width:102.5em){.wizard-container .wizard-modal{height:840px}}@media (max-width:48.9275em){.wizard-container .wizard-modal{height:81.7369093231vw}}.wizard-container .wizard-modal div.steps-background{position:absolute;left:calc(100% - 320px);top:-100vh;width:100vw;height:300vh;background-color:rgba(58,86,116,.5);transition:transform .25s linear,opacity .25s linear}@media (max-width:48.9275em){.wizard-container .wizard-modal div.steps-background{left:calc(100% - 26.81992vw)}}@media (min-width:48.9375em) and (max-width:102.49em){.wizard-container .wizard-modal div.steps-background{left:calc(100% - 19.5122vw)}}.wizard-container .wizard-modal a.close-modal{position:absolute;left:.6097560976vw;top:.6097560976vw;width:1.7073170732vw;height:1.7073170732vw;background-image:url(../img/wizard-close-modal.svg);background-position:50%;background-repeat:no-repeat;background-size:contain;font-size:0;line-height:0}@media (min-width:102.5em){.wizard-container .wizard-modal a.close-modal{left:10px}}@media (max-width:48.9275em){.wizard-container .wizard-modal a.close-modal{left:1.2771392082vw}}@media (min-width:102.5em){.wizard-container .wizard-modal a.close-modal{top:10px}}@media (max-width:48.9275em){.wizard-container .wizard-modal a.close-modal{top:1.2771392082vw}}@media (min-width:102.5em){.wizard-container .wizard-modal a.close-modal{width:28px}}@media (max-width:48.9275em){.wizard-container .wizard-modal a.close-modal{width:3.5759897829vw}}@media (min-width:102.5em){.wizard-container .wizard-modal a.close-modal{height:28px}}@media (max-width:48.9275em){.wizard-container .wizard-modal a.close-modal{height:3.5759897829vw}}.wizard-content{position:absolute;left:0;top:0;right:0;bottom:0;font-size:.9756097561vw;border-radius:.7317073171vw;overflow:hidden;background-color:#fff;display:flex;flex-direction:column}@media (min-width:102.5em){.wizard-content{font-size:16px}}@media (max-width:48.9275em){.wizard-content{font-size:1.7879948914vw}}@media (min-width:102.5em){.wizard-content{border-radius:12px}}@media (max-width:48.9275em){.wizard-content{border-radius:1.5325670498vw}}.wizard-content div.sections{flex:1;position:relative;overflow:hidden}.wizard-content div.sections div.wizard-section{position:absolute;left:0;right:0;top:0;bottom:0;transform:translateX(87.8048780488vw);transition:transform .25s linear,opacity .25s linear,filter .25s linear,-webkit-filter .25s linear;overflow-x:hidden;opacity:0}.wizard-content div.sections div.wizard-section.current{opacity:1;transform:translateX(0)}.wizard-content div.sections div.wizard-section.past{transform:translateX(-87.8048780488vw)}@media (min-width:102.5em){.wizard-content div.sections div.wizard-section{transform:translateX(1440px)}.wizard-content div.sections div.wizard-section.past{transform:translateX(-1440px)}}.wizard-content div.sections div.wizard-section div.wizard-step{position:absolute;left:0;right:0;top:0;bottom:0;transform:translateX(100%);transition:transform .25s linear,opacity .25s linear;opacity:0}.wizard-content div.sections div.wizard-section div.wizard-step.current{opacity:1;transform:translateX(0)}.wizard-content div.sections div.wizard-section div.wizard-step.past{transform:translateX(-100%)}.wizard-content div.sections div.wizard-section[data-display-steps=true]{max-width:68.29268vw}@media (max-width:48.9275em){.wizard-content div.sections div.wizard-section[data-display-steps=true]{max-width:67.68838vw}}@media (min-width:102.5em){.wizard-content div.sections div.wizard-section[data-display-steps=true]{max-width:1120px}}.wizard-content div.sections div.wizard-section.section-tutorial[data-display-steps=true]{max-width:66.46341vw}@media (max-width:48.9275em){.wizard-content div.sections div.wizard-section.section-tutorial[data-display-steps=true]{max-width:61.30268vw}}@media (min-width:102.5em){.wizard-content div.sections div.wizard-section.section-tutorial[data-display-steps=true]{max-width:1090px}}.wizard-content div.steps{position:absolute;right:0;top:0;bottom:0;width:19.512195122vw;background-color:#3a5674;padding-top:2.9268292683vw;background-image:url(../img/wizard-steps-bg.svg);background-repeat:no-repeat;background-position:bottom;background-size:19.512195122vw;transition:transform .25s linear,opacity .25s linear}@media (min-width:102.5em){.wizard-content div.steps{width:320px}}@media (max-width:48.9275em){.wizard-content div.steps{width:26.8199233716vw}}@media (min-width:102.5em){.wizard-content div.steps{padding-top:48px}}@media (max-width:48.9275em){.wizard-content div.steps{padding-top:4.0868454662vw}}@media (min-width:102.5em){.wizard-content div.steps{background-size:320px}}@media (max-width:48.9275em){.wizard-content div.steps{background-size:26.8199233716vw}}.wizard-content div.steps ul{padding:0;margin:0}.wizard-content div.steps ul li{display:flex;align-items:flex-start;margin:0 0 2.9268292683vw;padding:0 1.4634146341vw 0 0;perspective:1000px}@media (min-width:102.5em){.wizard-content div.steps ul li{margin-bottom:48px}}@media (max-width:48.9275em){.wizard-content div.steps ul li{margin-bottom:3.0651340996vw}}@media (min-width:102.5em){.wizard-content div.steps ul li{padding-right:24px}}@media (max-width:48.9275em){.wizard-content div.steps ul li{padding-right:1.5325670498vw}}.wizard-content div.steps ul li input[type=checkbox]{display:none}.wizard-content div.steps ul li div.step-number{position:relative;width:3.9024390244vw;min-width:3.9024390244vw;max-width:3.9024390244vw;height:3.9024390244vw;min-height:3.9024390244vw;max-height:3.9024390244vw;margin-top:-.487804878vw;display:flex;align-items:center;justify-content:center;transform:translateX(-50%);transform-style:preserve-3d;transition:transform .5s linear}@media (min-width:102.5em){.wizard-content div.steps ul li div.step-number{width:64px}}@media (max-width:48.9275em){.wizard-content div.steps ul li div.step-number{width:8.1736909323vw}}@media (min-width:102.5em){.wizard-content div.steps ul li div.step-number{min-width:64px}}@media (max-width:48.9275em){.wizard-content div.steps ul li div.step-number{min-width:8.1736909323vw}}@media (min-width:102.5em){.wizard-content div.steps ul li div.step-number{max-width:64px}}@media (max-width:48.9275em){.wizard-content div.steps ul li div.step-number{max-width:8.1736909323vw}}@media (min-width:102.5em){.wizard-content div.steps ul li div.step-number{height:64px}}@media (max-width:48.9275em){.wizard-content div.steps ul li div.step-number{height:8.1736909323vw}}@media (min-width:102.5em){.wizard-content div.steps ul li div.step-number{min-height:64px}}@media (max-width:48.9275em){.wizard-content div.steps ul li div.step-number{min-height:8.1736909323vw}}@media (min-width:102.5em){.wizard-content div.steps ul li div.step-number{max-height:64px}}@media (max-width:48.9275em){.wizard-content div.steps ul li div.step-number{max-height:8.1736909323vw}}@media (min-width:102.5em){.wizard-content div.steps ul li div.step-number{margin-top:-8px}}@media (max-width:48.9275em){.wizard-content div.steps ul li div.step-number{margin-top:-1.0217113665vw}}.wizard-content div.steps ul li div.step-number span{position:absolute;left:.487804878vw;top:.487804878vw;width:2.9268292683vw;min-width:2.9268292683vw;max-width:2.9268292683vw;height:2.9268292683vw;min-height:2.9268292683vw;max-height:2.9268292683vw;border-radius:2.9268292683vw;border:.0609756098vw solid #e6e6e6;background-color:#fff;color:#50ade2;display:flex;align-items:center;justify-content:center;transition:border-width .25s linear,border-color .25s linear,transform .25s linear;-webkit-backface-visibility:hidden;backface-visibility:hidden}@media (min-width:102.5em){.wizard-content div.steps ul li div.step-number span{left:8px}}@media (max-width:48.9275em){.wizard-content div.steps ul li div.step-number span{left:1.0217113665vw}}@media (min-width:102.5em){.wizard-content div.steps ul li div.step-number span{top:8px}}@media (max-width:48.9275em){.wizard-content div.steps ul li div.step-number span{top:1.0217113665vw}}@media (min-width:102.5em){.wizard-content div.steps ul li div.step-number span{width:48px}}@media (max-width:48.9275em){.wizard-content div.steps ul li div.step-number span{width:6.1302681992vw}}@media (min-width:102.5em){.wizard-content div.steps ul li div.step-number span{min-width:48px}}@media (max-width:48.9275em){.wizard-content div.steps ul li div.step-number span{min-width:6.1302681992vw}}@media (min-width:102.5em){.wizard-content div.steps ul li div.step-number span{max-width:48px}}@media (max-width:48.9275em){.wizard-content div.steps ul li div.step-number span{max-width:6.1302681992vw}}@media (min-width:102.5em){.wizard-content div.steps ul li div.step-number span{height:48px}}@media (max-width:48.9275em){.wizard-content div.steps ul li div.step-number span{height:6.1302681992vw}}@media (min-width:102.5em){.wizard-content div.steps ul li div.step-number span{min-height:48px}}@media (max-width:48.9275em){.wizard-content div.steps ul li div.step-number span{min-height:6.1302681992vw}}@media (min-width:102.5em){.wizard-content div.steps ul li div.step-number span{max-height:48px}}@media (max-width:48.9275em){.wizard-content div.steps ul li div.step-number span{max-height:6.1302681992vw}}@media (min-width:102.5em){.wizard-content div.steps ul li div.step-number span{border-radius:48px}}@media (max-width:48.9275em){.wizard-content div.steps ul li div.step-number span{border-radius:6.1302681992vw}}.wizard-content div.steps ul li div.step-number span.back{transform:rotateY(180deg)}.wizard-content div.steps ul li div.step-number span.back img{width:.9756097561vw;min-width:.9756097561vw;max-width:.9756097561vw;height:auto}@media (min-width:102.5em){.wizard-content div.steps ul li div.step-number span.back img{width:16px}}@media (max-width:48.9275em){.wizard-content div.steps ul li div.step-number span.back img{width:2.0434227331vw}}@media (min-width:102.5em){.wizard-content div.steps ul li div.step-number span.back img{min-width:16px}}@media (max-width:48.9275em){.wizard-content div.steps ul li div.step-number span.back img{min-width:2.0434227331vw}}@media (min-width:102.5em){.wizard-content div.steps ul li div.step-number span.back img{max-width:16px}}@media (max-width:48.9275em){.wizard-content div.steps ul li div.step-number span.back img{max-width:2.0434227331vw}}.wizard-content div.steps ul li.current div.step-number span{background:linear-gradient(135.29deg,#62c5f1 7.95%,#50ade2 101.07%);color:#fff;border:.487804878vw solid #fff;transform:translate(-12.5%,-12.5%)}.wizard-content div.steps ul li.current div.step-number span.back{transform:translate(-12.5%,-12.5%) rotateY(180deg)}@media (min-width:102.5em){.wizard-content div.steps ul li.current div.step-number span{border:8px solid #fff}}.wizard-content div.steps ul li.current div.description h3{color:#fff}.wizard-content div.steps ul li.complete div.step-number{transform:translateX(-50%) rotateY(180deg)}.wizard-content div.steps ul li.complete div.step-number span{background:linear-gradient(135.29deg,#62c5f1 7.95%,#50ade2 101.07%);color:#fff;border:0 solid hsla(0,0%,100%,0)}.wizard-content div.steps ul li div.description{margin-left:-.487804878vw}@media (min-width:102.5em){.wizard-content div.steps ul li div.description{margin-left:-8px}}@media (max-width:48.9275em){.wizard-content div.steps ul li div.description{margin-left:-2.5542784163vw}}.wizard-content div.steps ul li div.description h3{padding:0;color:hsla(0,0%,100%,.5);font-weight:700;font-size:1em;line-height:1.5em;margin:.7317073171vw 0 .487804878vw;transition:margin-top .25s linear}@media (min-width:102.5em){.wizard-content div.steps ul li div.description h3{margin-top:12px}}@media (max-width:48.9275em){.wizard-content div.steps ul li div.description h3{margin-top:1.5325670498vw}}@media (min-width:102.5em){.wizard-content div.steps ul li div.description h3{margin-bottom:8px}}@media (max-width:48.9275em){.wizard-content div.steps ul li div.description h3{margin-bottom:1.0217113665vw}}.wizard-content div.steps ul li div.description div.description-container{max-height:0;overflow:hidden;transition:max-height .25s linear}.wizard-content div.steps ul li div.description div.description-container p{opacity:0;margin:0;padding:0;font-size:.875em;color:hsla(0,0%,100%,.7);line-height:1.5em;transition:opacity .25s linear}.wizard-content div.steps ul li input[type=checkbox]:checked+div.description h3{margin-top:0}.wizard-content div.steps ul li input[type=checkbox]:checked+div.description div.description-container{max-height:8.5365853659vw}@media (min-width:102.5em){.wizard-content div.steps ul li input[type=checkbox]:checked+div.description div.description-container{max-height:140px}}@media (max-width:48.9275em){.wizard-content div.steps ul li input[type=checkbox]:checked+div.description div.description-container{max-height:17.8799489144vw}}.wizard-content div.steps ul li input[type=checkbox]:checked+div.description div.description-container p{opacity:1}.wizard-content footer{display:flex;height:5.8536585366vw;margin-right:19.512195122vw;padding:0 7.3170731707vw;align-items:center;justify-content:space-between;border-top:1px solid #e6e6e6;transition:margin-right .25s linear}@media (min-width:102.5em){.wizard-content footer{height:96px}}@media (max-width:48.9275em){.wizard-content footer{height:12.2605363985vw}}@media (min-width:102.5em){.wizard-content footer{margin-right:320px}}@media (max-width:48.9275em){.wizard-content footer{margin-right:26.8199233716vw}}@media (min-width:102.5em){.wizard-content footer{padding-bottom:0}}@media (max-width:48.9275em){.wizard-content footer{padding-bottom:0}}@media (min-width:102.5em){.wizard-content footer{padding-top:0}}@media (max-width:48.9275em){.wizard-content footer{padding-top:0}}@media (min-width:102.5em){.wizard-content footer{padding-left:120px}}@media (max-width:48.9275em){.wizard-content footer{padding-left:7.662835249vw}}@media (min-width:102.5em){.wizard-content footer{padding-right:120px}}@media (max-width:48.9275em){.wizard-content footer{padding-right:7.662835249vw}}.wizard-content footer img.logo{width:3.9024390244vw;height:auto}@media (min-width:102.5em){.wizard-content footer img.logo{width:64px}}@media (max-width:48.9275em){.wizard-content footer img.logo{width:8.1736909323vw}}.wizard-content footer a{font-style:normal;font-weight:500;font-size:1em;display:flex;align-items:center;justify-content:center;letter-spacing:.0457317073vw;text-transform:uppercase;text-decoration:none;color:#50abe0;transition:opacity .25s linear,background .25s linear}@media (min-width:102.5em){.wizard-content footer a{letter-spacing:.75px}}@media (max-width:48.9275em){.wizard-content footer a{letter-spacing:.0957854406vw}}.wizard-content footer a.disabled{color:#b3b3b3;pointer-events:none}.wizard-content footer a.invisible{opacity:0;pointer-events:none}.wizard-content footer nav{display:flex}.wizard-content footer nav a{margin-left:.6097560976vw;padding:.9146341463vw 2.1341463415vw}@media (min-width:102.5em){.wizard-content footer nav a{margin-left:10px}}@media (max-width:48.9275em){.wizard-content footer nav a{margin-left:1.2771392082vw}}@media (min-width:102.5em){.wizard-content footer nav a{padding-bottom:15px}}@media (max-width:48.9275em){.wizard-content footer nav a{padding-bottom:1.1494252874vw}}@media (min-width:102.5em){.wizard-content footer nav a{padding-top:15px}}@media (max-width:48.9275em){.wizard-content footer nav a{padding-top:1.1494252874vw}}@media (min-width:102.5em){.wizard-content footer nav a{padding-left:35px}}@media (max-width:48.9275em){.wizard-content footer nav a{padding-left:3.0651340996vw}}@media (min-width:102.5em){.wizard-content footer nav a{padding-right:35px}}@media (max-width:48.9275em){.wizard-content footer nav a{padding-right:3.0651340996vw}}.wizard-content footer nav a.hidden{display:none}.wizard-content footer nav a.next,.wizard-content footer nav a.return{color:#fff;border-radius:6.0975609756vw;background:linear-gradient(180deg,#62c5f1,#50ade2)}@media (min-width:102.5em){.wizard-content footer nav a.next,.wizard-content footer nav a.return{border-radius:100px}}@media (max-width:48.9275em){.wizard-content footer nav a.next,.wizard-content footer nav a.return{border-radius:6.3856960409vw}}.wizard-content footer nav a.next.disabled,.wizard-content footer nav a.return.disabled{background:linear-gradient(180deg,#f0f0f0,#e0e0e0)}.wizard-step{padding:0 7.3170731707vw;display:flex;flex-direction:column;justify-content:center;flex:1}@media (min-width:102.5em){.wizard-step{padding-bottom:0}}@media (max-width:48.9275em){.wizard-step{padding-bottom:0}}@media (min-width:102.5em){.wizard-step{padding-top:0}}@media (max-width:48.9275em){.wizard-step{padding-top:0}}@media (min-width:102.5em){.wizard-step{padding-left:120px}}@media (max-width:48.9275em){.wizard-step{padding-left:7.662835249vw}}@media (min-width:102.5em){.wizard-step{padding-right:120px}}@media (max-width:48.9275em){.wizard-step{padding-right:7.662835249vw}}.wizard-step .intro{margin-bottom:3.6585365854vw}.wizard-step .intro h1{line-height:1.2;margin-bottom:2.4390243902vw}@media (min-width:102.5em){.wizard-step .intro h1{margin-bottom:40px}}@media (max-width:48.9275em){.wizard-step .intro h1{margin-bottom:2.5542784163vw}}@media (min-width:102.5em){.wizard-step .intro{margin-bottom:60px}}@media (max-width:48.9275em){.wizard-step .intro{margin-bottom:3.8314176245vw}}.wizard-step .intro p{padding:0;margin:0 0 1.0975609756vw;font-size:1.125em;text-align:left}@media (min-width:102.5em){.wizard-step .intro p{margin-bottom:18px}}@media (max-width:48.9275em){.wizard-step .intro p{margin-bottom:1.1494252874vw}}.wizard-step .intro p:last-of-type{margin-bottom:0}div.wizard-section.section-tutorial[data-display-steps=true] .wizard-step-tutorial{padding:0 5.487804878vw 0 7.3170731707vw}@media (min-width:102.5em){div.wizard-section.section-tutorial[data-display-steps=true] .wizard-step-tutorial{padding-left:120px}}@media (max-width:48.9275em){div.wizard-section.section-tutorial[data-display-steps=true] .wizard-step-tutorial{padding-left:7.662835249vw}}@media (min-width:102.5em){div.wizard-section.section-tutorial[data-display-steps=true] .wizard-step-tutorial{padding-top:0}}@media (max-width:48.9275em){div.wizard-section.section-tutorial[data-display-steps=true] .wizard-step-tutorial{padding-top:0}}@media (min-width:102.5em){div.wizard-section.section-tutorial[data-display-steps=true] .wizard-step-tutorial{padding-right:90px}}@media (max-width:48.9275em){div.wizard-section.section-tutorial[data-display-steps=true] .wizard-step-tutorial{padding-right:0}}@media (min-width:102.5em){div.wizard-section.section-tutorial[data-display-steps=true] .wizard-step-tutorial{padding-bottom:0}}@media (max-width:48.9275em){div.wizard-section.section-tutorial[data-display-steps=true] .wizard-step-tutorial{padding-bottom:0}}.wizard-step-select div.step-contents{margin-bottom:2.4390243902vw}@media (min-width:102.5em){.wizard-step-select div.step-contents{margin-bottom:40px}}@media (max-width:48.9275em){.wizard-step-select div.step-contents{margin-bottom:2.5542784163vw}}.wizard-step-select div.step-contents:last-of-type{margin-bottom:0}.wizard-step-select .intro{text-align:center}.wizard-step-select ul{display:flex;flex-wrap:wrap;padding:0;margin:0;justify-content:center;align-items:center}.wizard-step-select ul li{position:relative;display:block;padding:0;margin:1.8292682927vw 2.4390243902vw}@media (min-width:102.5em){.wizard-step-select ul li{margin-top:30px}}@media (max-width:48.9275em){.wizard-step-select ul li{margin-top:1.9157088123vw}}@media (min-width:102.5em){.wizard-step-select ul li{margin-bottom:30px}}@media (max-width:48.9275em){.wizard-step-select ul li{margin-bottom:1.9157088123vw}}@media (min-width:102.5em){.wizard-step-select ul li{margin-left:40px}}@media (max-width:48.9275em){.wizard-step-select ul li{margin-left:5.1085568327vw}}@media (min-width:102.5em){.wizard-step-select ul li{margin-right:40px}}@media (max-width:48.9275em){.wizard-step-select ul li{margin-right:5.1085568327vw}}.wizard-step-select ul li div.description{position:absolute;left:50%;transform:translate(-50%,24px) scale(.7);bottom:calc(100% + 30px);padding:1.4634146341vw;background-color:#3a5674;color:#fff;width:17.6829268293vw;display:flex;flex-direction:column;align-items:center;justify-content:center;border-radius:10px;box-shadow:0 0 10px 1px rgba(0,0,0,.25);opacity:0;pointer-events:none;transition:transform .125s linear,opacity .125s linear}@media (min-width:102.5em){.wizard-step-select ul li div.description{padding:24px}}@media (max-width:48.9275em){.wizard-step-select ul li div.description{padding:1.5325670498vw}}@media (min-width:102.5em){.wizard-step-select ul li div.description{width:290px}}@media (max-width:48.9275em){.wizard-step-select ul li div.description{width:32.5670498084vw}}.wizard-step-select ul li div.description div.arrow-down{position:absolute;bottom:-13px;width:0;height:0;left:calc(50% - 14px);border-left:14px solid transparent;border-right:14px solid transparent;border-top:14px solid #3a5674}.wizard-step-select ul li:hover div.description{opacity:1;transform:translate(-50%) scale(1)}ul.options.select-icons li:hover a img{transform:scale(1.2)}ul.options.select-icons li a{font-size:0}ul.options.select-icons li a img{transition:transform .2s linear;height:2.9268292683vw;width:auto}@media (min-width:102.5em){ul.options.select-icons li a img{height:48px}}@media (max-width:48.9275em){ul.options.select-icons li a img{height:3.0651340996vw}}ul.options.select-icons li a.select-s3 img{height:3.6585365854vw}@media (min-width:102.5em){ul.options.select-icons li a.select-s3 img{height:60px}}@media (max-width:48.9275em){ul.options.select-icons li a.select-s3 img{height:3.8314176245vw}}ul.options.select-buttons li{margin:1.8292682927vw .9146341463vw}@media (min-width:102.5em){ul.options.select-buttons li{margin-top:30px}}@media (max-width:48.9275em){ul.options.select-buttons li{margin-top:1.9157088123vw}}@media (min-width:102.5em){ul.options.select-buttons li{margin-bottom:30px}}@media (max-width:48.9275em){ul.options.select-buttons li{margin-bottom:1.9157088123vw}}@media (min-width:102.5em){ul.options.select-buttons li{margin-left:15px}}@media (max-width:48.9275em){ul.options.select-buttons li{margin-left:1.0217113665vw}}@media (min-width:102.5em){ul.options.select-buttons li{margin-right:15px}}@media (max-width:48.9275em){ul.options.select-buttons li{margin-right:1.0217113665vw}}ul.options.select-buttons li a{font-style:normal;font-weight:500;font-size:1em;display:flex;align-items:center;justify-content:center;letter-spacing:.0457317073vw;text-transform:uppercase;text-decoration:none;color:#fff;border-radius:6.0975609756vw;padding:.9146341463vw 2.1341463415vw;background:linear-gradient(180deg,#62c5f1,#50ade2)}@media (min-width:102.5em){ul.options.select-buttons li a{letter-spacing:.75px;padding:15px 35px}}ul.options.select-flat-buttons li{margin:1.8292682927vw .9146341463vw}@media (min-width:102.5em){ul.options.select-flat-buttons li{margin-top:30px}}@media (max-width:48.9275em){ul.options.select-flat-buttons li{margin-top:1.9157088123vw}}@media (min-width:102.5em){ul.options.select-flat-buttons li{margin-bottom:30px}}@media (max-width:48.9275em){ul.options.select-flat-buttons li{margin-bottom:1.9157088123vw}}@media (min-width:102.5em){ul.options.select-flat-buttons li{margin-left:15px}}@media (max-width:48.9275em){ul.options.select-flat-buttons li{margin-left:1.0217113665vw}}@media (min-width:102.5em){ul.options.select-flat-buttons li{margin-right:15px}}@media (max-width:48.9275em){ul.options.select-flat-buttons li{margin-right:1.0217113665vw}}ul.options.select-flat-buttons li a{font-style:normal;font-weight:500;font-size:1.5em;letter-spacing:.0457317073vw;text-transform:uppercase;text-decoration:none;border-bottom:1px dotted #50ade2;color:#50ade2}@media (min-width:102.5em){ul.options.select-flat-buttons li a{letter-spacing:.75px}}.wizard-step-video{padding:0}.wizard-step-video .step-contents .video,.wizard-step-video .step-contents .video iframe{position:absolute;top:0;left:0;width:100%;height:100%}@-webkit-keyframes logo-rotate{0%{transform:rotateY(0deg)}to{transform:rotateY(-1turn)}}@keyframes logo-rotate{0%{transform:rotateY(0deg)}to{transform:rotateY(-1turn)}}@-webkit-keyframes logo-rotate-x{0%{transform:rotateX(0deg)}to{transform:rotateX(-1turn)}}@keyframes logo-rotate-x{0%{transform:rotateX(0deg)}to{transform:rotateX(-1turn)}}@-webkit-keyframes logo-rotate-z{0%{transform:rotate(-1turn)}to{transform:rotate(0deg)}}@keyframes logo-rotate-z{0%{transform:rotate(-1turn)}to{transform:rotate(0deg)}}.wizard-step-form div.intro{margin-bottom:1.8292682927vw}@media (min-width:102.5em){.wizard-step-form div.intro{margin-bottom:30px}}@media (max-width:48.9275em){.wizard-step-form div.intro{margin-bottom:1.9157088123vw}}.wizard-step-form form{display:flex;flex-direction:column}.wizard-step-form form div.form-field{display:flex;flex-direction:column;border:1px solid #f3f3f3;background-color:#f3f3f3;padding:1.2195121951vw;border-radius:.9756097561vw;margin-bottom:1.2195121951vw}@media (min-width:102.5em){.wizard-step-form form div.form-field{padding:20px}}@media (max-width:48.9275em){.wizard-step-form form div.form-field{padding:1.2771392082vw}}@media (min-width:102.5em){.wizard-step-form form div.form-field{border-radius:16px}}@media (max-width:48.9275em){.wizard-step-form form div.form-field{border-radius:1.0217113665vw}}@media (min-width:102.5em){.wizard-step-form form div.form-field{margin-bottom:20px}}@media (max-width:48.9275em){.wizard-step-form form div.form-field{margin-bottom:1.2771392082vw}}.wizard-step-form form div.form-field:last-of-type{margin-bottom:0}.wizard-step-form form div.form-field:focus-within{border:1px solid #50ade2}.wizard-step-form form div.form-field label{font-weight:500;font-size:.75em;line-height:1em;text-transform:uppercase;color:#3a5674;margin-bottom:.487804878vw}@media (min-width:102.5em){.wizard-step-form form div.form-field label{margin-bottom:8px}}@media (max-width:48.9275em){.wizard-step-form form div.form-field label{margin-bottom:.5108556833vw}}.wizard-step-form form div.form-field input[type=password],.wizard-step-form form div.form-field input[type=text]{box-shadow:none;padding:0;border:0;background:none;font-size:1.125em}.wizard-step-form form div.form-field input[type=password]::-moz-placeholder,.wizard-step-form form div.form-field input[type=text]::-moz-placeholder{color:rgba(0,0,0,.125)}.wizard-step-form form div.form-field input[type=password]:-ms-input-placeholder,.wizard-step-form form div.form-field input[type=text]:-ms-input-placeholder{color:rgba(0,0,0,.125)}.wizard-step-form form div.form-field input[type=password]::-ms-input-placeholder,.wizard-step-form form div.form-field input[type=text]::-ms-input-placeholder{color:rgba(0,0,0,.125)}.wizard-step-form form div.form-field input[type=password]::placeholder,.wizard-step-form form div.form-field input[type=text]::placeholder{color:rgba(0,0,0,.125)}.wizard-step-form form div.form-field select{-webkit-appearance:none;-moz-appearance:none;appearance:none;border:0;padding:0;background:transparent;outline:0;font-size:1.125em}.wizard-step-form form div.form-field select:focus{outline:0}.wizard-step-form form div.form-field.field-checkbox{background:none;flex-direction:row;align-items:flex-start;padding:1.2195121951vw 0;border:1px solid #fff}@media (min-width:102.5em){.wizard-step-form form div.form-field.field-checkbox{padding-bottom:20px}}@media (max-width:48.9275em){.wizard-step-form form div.form-field.field-checkbox{padding-bottom:1.2771392082vw}}@media (min-width:102.5em){.wizard-step-form form div.form-field.field-checkbox{padding-top:20px}}@media (max-width:48.9275em){.wizard-step-form form div.form-field.field-checkbox{padding-top:1.2771392082vw}}@media (min-width:102.5em){.wizard-step-form form div.form-field.field-checkbox{padding-left:0}}@media (max-width:48.9275em){.wizard-step-form form div.form-field.field-checkbox{padding-left:0}}@media (min-width:102.5em){.wizard-step-form form div.form-field.field-checkbox{padding-right:0}}@media (max-width:48.9275em){.wizard-step-form form div.form-field.field-checkbox{padding-right:0}}.wizard-step-form form div.form-field.field-checkbox div.checkbox{margin-right:1.2195121951vw}@media (min-width:102.5em){.wizard-step-form form div.form-field.field-checkbox div.checkbox{margin-right:20px}}@media (max-width:48.9275em){.wizard-step-form form div.form-field.field-checkbox div.checkbox{margin-right:1.2771392082vw}}.wizard-step-form form div.form-field.field-checkbox div.title{padding-top:.3048780488vw;margin-right:1.2195121951vw;white-space:nowrap;font-size:1em;font-weight:500}@media (min-width:102.5em){.wizard-step-form form div.form-field.field-checkbox div.title{padding-top:5px}}@media (max-width:48.9275em){.wizard-step-form form div.form-field.field-checkbox div.title{padding-top:.6385696041vw}}@media (min-width:102.5em){.wizard-step-form form div.form-field.field-checkbox div.title{margin-right:20px}}@media (max-width:48.9275em){.wizard-step-form form div.form-field.field-checkbox div.title{margin-right:1.2771392082vw}}.wizard-step-form form div.form-field.field-checkbox div.description{padding-top:.3048780488vw;font-size:1em;font-weight:300}@media (min-width:102.5em){.wizard-step-form form div.form-field.field-checkbox div.description{padding-top:5px}}@media (max-width:48.9275em){.wizard-step-form form div.form-field.field-checkbox div.description{padding-top:.6385696041vw;display:none}}.wizard-step-form .progress{position:absolute;left:0;right:0;bottom:0;top:0;display:flex;flex-direction:column;align-items:center;justify-content:center;opacity:0;pointer-events:none;transition:opacity .25s linear;perspective:100em}.wizard-step-form .progress h3{color:#50abe0;margin-bottom:3.0487804878vw;font-size:1.625em}@media (min-width:102.5em){.wizard-step-form .progress h3{margin-bottom:50px}}.wizard-step-form .progress div.logo-spinner{-webkit-animation:logo-rotate 2s;animation:logo-rotate 2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-iteration-count:infinite;animation-iteration-count:infinite;-webkit-animation-timing-function:linear;animation-timing-function:linear}.wizard-step-form .progress div.logo-spinner img{width:7.3170731707vw;height:auto}@media (min-width:102.5em){.wizard-step-form .progress div.logo-spinner img{width:120px}}.wizard-step-form.processing .progress{opacity:1}.wizard-step-form.processing div.step-contents{-webkit-filter:blur(5px);filter:blur(5px)}.wizard-step-test{justify-content:flex-start}.wizard-step-test div.step-contents{margin-top:3.0487804878vw}@media (min-width:102.5em){.wizard-step-test div.step-contents{margin-top:50px}}@media (max-width:48.9275em){.wizard-step-test div.step-contents{margin-top:6.3856960409vw}}.wizard-step-test div.step-contents div.intro{margin-bottom:1.8292682927vw}@media (min-width:102.5em){.wizard-step-test div.step-contents div.intro{margin-bottom:30px}}@media (max-width:48.9275em){.wizard-step-test div.step-contents div.intro{margin-bottom:1.9157088123vw}}.wizard-step-test div.step-contents div.start-buttons{display:flex;justify-content:center;margin-bottom:1.8292682927vw}@media (max-width:48.9275em){.wizard-step-test div.step-contents div.start-buttons{margin-bottom:1.9157088123vw}}.wizard-step-test div.step-contents div.start-buttons a{font-style:normal;font-weight:500;font-size:1em;display:flex;align-items:center;justify-content:center;letter-spacing:.0457317073vw;text-transform:uppercase;text-decoration:none;color:#fff;border-radius:6.0975609756vw;padding:.9146341463vw 2.1341463415vw;background:linear-gradient(180deg,#62c5f1,#50ade2)}@media (min-width:102.5em){.wizard-step-test div.step-contents div.start-buttons a{letter-spacing:.75px;padding:15px 35px}}@media (min-width:102.5em){.wizard-step-test div.step-contents div.start-buttons{margin-bottom:30px}}.wizard-step-test div.step-contents ul.tests>li{border:1px solid #f3f3f3;background-color:#f3f3f3;border-radius:.9756097561vw;padding:1.2195121951vw;margin-bottom:20xp;display:flex;transition:opacity .25s linear}@media (min-width:102.5em){.wizard-step-test div.step-contents ul.tests>li{border-radius:16px}}@media (max-width:48.9275em){.wizard-step-test div.step-contents ul.tests>li{border-radius:1.0217113665vw}}@media (min-width:102.5em){.wizard-step-test div.step-contents ul.tests>li{padding:20px}}@media (max-width:48.9275em){.wizard-step-test div.step-contents ul.tests>li{padding:1.2771392082vw}}@media (min-width:102.5em){.wizard-step-test div.step-contents ul.tests>li{margin-bottom:20xp}}@media (max-width:48.9275em){.wizard-step-test div.step-contents ul.tests>li{margin-bottom:1.2771392082vw}}.wizard-step-test div.step-contents ul.tests>li.hidden{opacity:0}.wizard-step-test div.step-contents ul.tests>li div.icon{width:1.4634146341vw;min-width:1.4634146341vw;max-width:1.4634146341vw;height:1.4634146341vw;min-height:1.4634146341vw;max-height:1.4634146341vw;display:flex;justify-content:center;align-items:center;margin-right:.6097560976vw}@media (min-width:102.5em){.wizard-step-test div.step-contents ul.tests>li div.icon{width:24px}}@media (max-width:48.9275em){.wizard-step-test div.step-contents ul.tests>li div.icon{width:3.0651340996vw}}@media (min-width:102.5em){.wizard-step-test div.step-contents ul.tests>li div.icon{min-width:24px}}@media (max-width:48.9275em){.wizard-step-test div.step-contents ul.tests>li div.icon{min-width:3.0651340996vw}}@media (min-width:102.5em){.wizard-step-test div.step-contents ul.tests>li div.icon{max-width:24px}}@media (max-width:48.9275em){.wizard-step-test div.step-contents ul.tests>li div.icon{max-width:3.0651340996vw}}@media (min-width:102.5em){.wizard-step-test div.step-contents ul.tests>li div.icon{height:24px}}@media (max-width:48.9275em){.wizard-step-test div.step-contents ul.tests>li div.icon{height:3.0651340996vw}}@media (min-width:102.5em){.wizard-step-test div.step-contents ul.tests>li div.icon{min-height:24px}}@media (max-width:48.9275em){.wizard-step-test div.step-contents ul.tests>li div.icon{min-height:3.0651340996vw}}@media (min-width:102.5em){.wizard-step-test div.step-contents ul.tests>li div.icon{max-height:24px}}@media (max-width:48.9275em){.wizard-step-test div.step-contents ul.tests>li div.icon{max-height:3.0651340996vw}}@media (min-width:102.5em){.wizard-step-test div.step-contents ul.tests>li div.icon{margin-right:10px}}@media (max-width:48.9275em){.wizard-step-test div.step-contents ul.tests>li div.icon{margin-right:1.2771392082vw}}.wizard-step-test div.step-contents ul.tests>li div.icon img{display:none;width:100%;height:auto}.wizard-step-test div.step-contents ul.tests>li.waiting div.icon{perspective:100em}.wizard-step-test div.step-contents ul.tests>li.waiting div.icon img.waiting{display:block;-webkit-animation:logo-rotate-z 1s;animation:logo-rotate-z 1s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-iteration-count:infinite;animation-iteration-count:infinite;-webkit-animation-timing-function:linear;animation-timing-function:linear}.wizard-step-test div.step-contents ul.tests>li.error>div.icon>img.error,.wizard-step-test div.step-contents ul.tests>li.success>div.icon>img.success,.wizard-step-test div.step-contents ul.tests>li.warning>div.icon>img.warning{display:block}.wizard-step-test div.step-contents ul.tests>li div.description h3{margin:.243902439vw 0;padding:0;font-size:1.125em}@media (min-width:102.5em){.wizard-step-test div.step-contents ul.tests>li div.description h3{margin-top:4px}}@media (max-width:48.9275em){.wizard-step-test div.step-contents ul.tests>li div.description h3{margin-top:0}}@media (min-width:102.5em){.wizard-step-test div.step-contents ul.tests>li div.description h3{margin-bottom:4px}}@media (max-width:48.9275em){.wizard-step-test div.step-contents ul.tests>li div.description h3{margin-bottom:0}}@media (min-width:102.5em){.wizard-step-test div.step-contents ul.tests>li div.description h3{margin-left:0}}@media (max-width:48.9275em){.wizard-step-test div.step-contents ul.tests>li div.description h3{margin-left:0}}@media (min-width:102.5em){.wizard-step-test div.step-contents ul.tests>li div.description h3{margin-right:0}}@media (max-width:48.9275em){.wizard-step-test div.step-contents ul.tests>li div.description h3{margin-right:0}}.wizard-step-test div.step-contents ul.tests>li div.description p{margin:0 0 4px;padding:0;font-size:1em}.wizard-step-test div.step-contents ul.tests>li div.description ul.errors{margin-left:1.2195121951vw;list-style:disc}@media (min-width:102.5em){.wizard-step-test div.step-contents ul.tests>li div.description ul.errors{margin-left:20px}}@media (max-width:48.9275em){.wizard-step-test div.step-contents ul.tests>li div.description ul.errors{margin-left:1.2771392082vw}}.wizard-step-test div.step-contents ul.tests>li div.description ul.errors li{display:list-item;font-size:1em}.wizard-step-tutorial{justify-content:flex-start}.wizard-step-tutorial div.tutorial{padding-top:2.4390243902vw;margin-bottom:60px}@media (min-width:102.5em){.wizard-step-tutorial div.tutorial{padding-top:40px}}@media (max-width:48.9275em){.wizard-step-tutorial div.tutorial{padding-top:5.1085568327vw}}.wizard-step-tutorial div.tutorial h2,.wizard-step-tutorial div.tutorial h3{margin-top:2.4390243902vw}@media (min-width:102.5em){.wizard-step-tutorial div.tutorial h2,.wizard-step-tutorial div.tutorial h3{margin-top:40px}}@media (max-width:48.9275em){.wizard-step-tutorial div.tutorial h2,.wizard-step-tutorial div.tutorial h3{margin-top:2.5542784163vw}}.wizard-step-tutorial div.tutorial p{padding:0;margin:0 0 .6097560976vw;font-size:1.125em}@media (min-width:102.5em){.wizard-step-tutorial div.tutorial p{margin-bottom:10px}}@media (max-width:48.9275em){.wizard-step-tutorial div.tutorial p{margin-bottom:1.2771392082vw}}.wizard-step-tutorial div.tutorial p:last-of-type{margin-bottom:0}.wizard-step-tutorial div.tutorial figure{padding:0;margin:2.4390243902vw 0}@media (min-width:102.5em){.wizard-step-tutorial div.tutorial figure{margin-top:40px}}@media (max-width:48.9275em){.wizard-step-tutorial div.tutorial figure{margin-top:2.5542784163vw}}@media (min-width:102.5em){.wizard-step-tutorial div.tutorial figure{margin-bottom:40px}}@media (max-width:48.9275em){.wizard-step-tutorial div.tutorial figure{margin-bottom:2.5542784163vw}}.wizard-step-tutorial div.tutorial figure img{width:100%;height:auto}.wizard-step-tutorial div.tutorial ul{margin-left:20px;margin-bottom:30px;list-style:disc}.wizard-step-tutorial div.tutorial ul li{display:list-item}.wizard-modal.no-steps div.steps-background{opacity:0}.wizard-modal.no-steps div.wizard-content div.steps{transform:translateX(calc(100% + 1.95122vw));opacity:0}@media (min-width:102.5em){.wizard-modal.no-steps div.wizard-content div.steps{transform:translateX(calc(100% + 32px))}}.wizard-modal.no-steps div.wizard-content footer{margin-right:0}.wizard-modal.no-animations *{transition:none!important}.wizard-invisible .wizard-modal{transform:scale(.8);opacity:0}.optimize-stats-container{display:flex;flex-direction:column}.optimize-stats-container .optimize-stats{display:flex;align-items:flex-start;justify-content:center}.optimize-stats-container .optimize-stats .optimize-stats-cell{display:flex;flex-direction:column;align-items:center;margin-right:60px}.optimize-stats-container .optimize-stats .optimize-stats-cell:last-of-type{margin-right:0}.optimize-stats-container .optimize-stats .optimize-stats-cell .graph{position:relative}.optimize-stats-container .optimize-stats .optimize-stats-cell .graph div.label{position:absolute;left:0;right:0;top:0;bottom:0;display:flex;align-items:center;justify-content:center;line-height:1;text-align:center}.optimize-stats-container .optimize-overall-stats{margin-top:20px;border-top:1px solid #ddd;padding-top:15px;text-align:center}#s3-importer-progress{padding:24px;background:#ddd;border-radius:8px}#s3-importer-progress .button-whoa{background:#a42929!important;border-color:#e62a2a #a42929 #a42929!important;box-shadow:0 1px 0 #a42929!important;color:#fff!important;text-decoration:none!important;text-shadow:0 -1px 1px #a42929,1px 0 1px #a42929,0 1px 1px #a42929,-1px 0 1px #a42929!important}#s3-importer-progress>button{margin-top:20px}.s3-importer-progress-container{position:relative;width:100%;height:32px;background:#aaa;border-radius:16px;overflow:hidden;background-image:url(../img/candy-stripe.svg)}#s3-importer-progress-bar{background-color:#4f90c4;height:100%}.tool-disabled{padding:10px 15px;border:1px solid #df8403}.force-cancel-help{margin-top:20px}.wp-cli-callout{padding:24px;background:#ddd;margin-top:20px;border-radius:8px}.wp-cli-callout>h3{margin:0;padding:0;font-size:14px}.wp-cli-callout>code{background-color:#bbb;padding:10px 15px;margin-top:5px;display:inline-block}#s3-importer-options{padding:24px;background:#e7e7e7;margin-top:20px;border-radius:8px}#s3-importer-options h3{margin:0;padding:0;font-size:14px}#s3-importer-options ul{padding:0;display:flex;flex-direction:column;margin:20px 0 0}#s3-importer-options ul li{display:flex;margin-bottom:30px}#s3-importer-options ul li:last-of-type{margin-bottom:0}#s3-importer-options ul li>div:first-of-type{padding:10px 10px 20px 0;width:160px;min-width:160px;line-height:1.3;font-weight:600}#s3-importer-options ul li div.description{margin-top:8px}#s3-importer-options ul li div.option-ui{display:flex;align-items:center}#s3-importer-options ul li div.option-ui.option-ui-browser input[type=text]{width:40vw;margin-right:10px;padding:7px 11px;border-radius:4px}#s3-importer-options ul li div.option-ui.option-ui-browser input[type=text]:disabled{color:#000}#s3-timing-stats{display:none}#s3-importer-status-text{position:absolute;left:16px;top:0;bottom:0;right:16px;display:flex;align-items:center;color:#fff;font-weight:700}#s3-importer-thumbnails{position:relative;width:100%;height:150px;margin-bottom:15px}#s3-importer-thumbnails-container{position:absolute;left:0;top:0;right:0;bottom:0;overflow:hidden;-webkit-mask-image:linear-gradient(90deg,#ddd 0,hsla(0,0%,86.7%,0) 90%);mask-image:linear-gradient(90deg,#ddd 0,hsla(0,0%,86.7%,0) 90%)}#s3-importer-thumbnails-container img{width:150px;height:150px;max-width:150px;max-height:150px;border-radius:4px}#s3-importer-thumbnails-container>img{margin-right:10px}#s3-importer-thumbnails-fade{background:linear-gradient(90deg,#ddd 0,hsla(0,0%,86.7%,0) 90%);position:absolute;left:150px;top:0;right:0;bottom:0}@supports ((-webkit-mask-image:linear-gradient(to left,rgba(221,221,221,0) 0%,#dddddd 95%,#dddddd 100%)) or (mask-image:linear-gradient(to left,rgba(221,221,221,0) 0%,#dddddd 95%,#dddddd 100%))){#s3-importer-thumbnails-fade{display:none}}#s3-importer-thumbnails-cloud{position:absolute;right:20px;top:50%;transform:translateY(-50%)}.s3-importer-thumb{position:absolute;left:0;top:0;width:150px;min-width:150px;max-width:150px;height:150px;min-height:150px;max-height:150px;background-size:cover;background-position:50%;background-repeat:no-repeat;margin-right:10px;border-radius:4px;background-color:#888;transition:opacity .25s linear,transform .25s linear}.s3-importer-thumb.ilab-hidden{opacity:0;transform:scale(.7)}.s3-importer-image-icon{position:absolute;left:0;top:0;position:relative;width:150px;min-width:150px;max-width:150px;height:150px;min-height:150px;max-height:150px;display:flex;align-items:center;justify-content:center;transition:opacity .25s linear,transform .25s linear}.s3-importer-image-icon.ilab-hidden{opacity:0;transform:scale(.8)}.s3-importer-info-warning{border:1px solid orange;padding:24px;background:rgba(255,165,0,.125);margin-top:20px;border-radius:8px}.s3-importer-info-warning h4{padding:0;font-size:14px;margin:0 0 8px} \ No newline at end of file diff --git a/public/css/mcloud-reports.css b/public/css/mcloud-reports.css new file mode 100755 index 00000000..1661f18c --- /dev/null +++ b/public/css/mcloud-reports.css @@ -0,0 +1,55 @@ +@charset "UTF-8"; +/*! + * Copyright (c) HANDSONCODE sp. z o. o. + * + * HANDSONTABLE is a software distributed by HANDSONCODE sp. z o. o., + * a Polish corporation, based in Gdynia, Poland, at 96/98 Aleja Zwycięstwa, + * registered with the National Court Register under number 538651, + * EU tax ID number: PL5862294002, share capital: PLN 62,800.00. + * + * This software is protected by applicable copyright laws, including + * international treaties, and dual-licensed – depending on whether + * your use is intended for or may result in commercial advantage + * or monetary compensation (commercial purposes), or not. + * + * If your use involves only such purposes as research, private study, + * evaluation and the like, you agree to be bound by the terms included + * in the "handsontable-non-commercial-license.pdf" file, available + * in the main directory of this software repository. + * + * By installing, copying, or otherwise using this software for + * commercial purposes, you agree to be bound by the terms included + * in the "handsontable-general-terms.pdf" file, available in the main + * directory of this software repository. + * + * HANDSONCODE PROVIDES THIS SOFTWARE ON AN "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND. IN NO EVENT + * AND UNDER NO LEGAL THEORY, SHALL HANDSONCODE BE LIABLE + * TO YOU FOR DAMAGES, INCLUDING ANY DIRECT, INDIRECT, SPECIAL, + * INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER ARISING + * FROM USE OR INABILITY TO USE THIS SOFTWARE. + * + * Version: 8.2.0 + * Release date: 12/11/2020 (built at 09/11/2020 11:35:30) + */.handsontable .table td,.handsontable .table th{border-top:none}.handsontable tr{background:#fff}.handsontable td{background-color:inherit}.handsontable .table caption+thead tr:first-child td,.handsontable .table caption+thead tr:first-child th,.handsontable .table colgroup+thead tr:first-child td,.handsontable .table colgroup+thead tr:first-child th,.handsontable .table thead:first-child tr:first-child td,.handsontable .table thead:first-child tr:first-child th{border-top:1px solid #ccc}.handsontable .table-bordered{border:0;border-collapse:separate}.handsontable .table-bordered td,.handsontable .table-bordered th{border-left:none}.handsontable .table-bordered td:first-child,.handsontable .table-bordered th:first-child{border-left:1px solid #ccc}.handsontable .table>tbody>tr>td,.handsontable .table>tbody>tr>th,.handsontable .table>tfoot>tr>td,.handsontable .table>tfoot>tr>th,.handsontable .table>thead>tr>td,.handsontable .table>thead>tr>th{line-height:21px;padding:0 4px}.col-lg-1.handsontable,.col-lg-2.handsontable,.col-lg-3.handsontable,.col-lg-4.handsontable,.col-lg-5.handsontable,.col-lg-6.handsontable,.col-lg-7.handsontable,.col-lg-8.handsontable,.col-lg-9.handsontable,.col-lg-10.handsontable,.col-lg-11.handsontable,.col-lg-12.handsontable,.col-md-1.handsontable,.col-md-2.handsontable,.col-md-3.handsontable,.col-md-4.handsontable,.col-md-5.handsontable,.col-md-6.handsontable,.col-md-7.handsontable,.col-md-8.handsontable,.col-md-9.handsontable .col-sm-1.handsontable,.col-md-10.handsontable,.col-md-11.handsontable,.col-md-12.handsontable,.col-sm-2.handsontable,.col-sm-3.handsontable,.col-sm-4.handsontable,.col-sm-5.handsontable,.col-sm-6.handsontable,.col-sm-7.handsontable,.col-sm-8.handsontable,.col-sm-9.handsontable .col-xs-1.handsontable,.col-sm-10.handsontable,.col-sm-11.handsontable,.col-sm-12.handsontable,.col-xs-2.handsontable,.col-xs-3.handsontable,.col-xs-4.handsontable,.col-xs-5.handsontable,.col-xs-6.handsontable,.col-xs-7.handsontable,.col-xs-8.handsontable,.col-xs-9.handsontable,.col-xs-10.handsontable,.col-xs-11.handsontable,.col-xs-12.handsontable{padding-left:0;padding-right:0}.handsontable .table-striped>tbody>tr:nth-of-type(2n){background-color:#fff}.handsontable{position:relative}.handsontable .hide{display:none}.handsontable .relative{position:relative}.handsontable .wtHider{width:0}.handsontable .wtSpreader{position:relative;width:0;height:auto}.handsontable div,.handsontable input,.handsontable table,.handsontable tbody,.handsontable td,.handsontable textarea,.handsontable th,.handsontable thead{box-sizing:content-box;-webkit-box-sizing:content-box;-moz-box-sizing:content-box}.handsontable input,.handsontable textarea{min-height:0}.handsontable table.htCore{border-collapse:separate;border-spacing:0;margin:0;border-width:0;table-layout:fixed;width:0;outline-width:0;cursor:default;max-width:none;max-height:none}.handsontable col,.handsontable col.rowHeader{width:50px}.handsontable td,.handsontable th{border-top-width:0;border-left-width:0;height:22px;empty-cells:show;line-height:21px;padding:0 4px;background-color:#fff;vertical-align:top;overflow:hidden;outline-width:0;white-space:pre-line}.handsontable td,.handsontable th,.handsontable th:last-child{border-right:1px solid #ccc;border-bottom:1px solid #ccc}.handsontable.htRowHeaders thead tr th:nth-child(2),.handsontable td:first-of-type,.handsontable th:first-child,.handsontable th:nth-child(2){border-left:1px solid #ccc}.handsontable tr:first-child td,.handsontable tr:first-child th{border-top:1px solid #ccc}.ht_master:not(.innerBorderLeft):not(.emptyColumns)~.handsontable:not(.ht_clone_top) thead tr th:first-child,.ht_master:not(.innerBorderLeft):not(.emptyColumns)~.handsontable tbody tr th{border-right-width:0}.ht_master:not(.innerBorderTop):not(.innerBorderBottom) thead tr.lastChild th,.ht_master:not(.innerBorderTop):not(.innerBorderBottom) thead tr:last-child th,.ht_master:not(.innerBorderTop):not(.innerBorderBottom)~.handsontable thead tr.lastChild th,.ht_master:not(.innerBorderTop):not(.innerBorderBottom)~.handsontable thead tr:last-child th{border-bottom-width:0}.handsontable th{background-color:#f0f0f0;color:#222;text-align:center;font-weight:400;white-space:nowrap}.handsontable thead th{padding:0}.handsontable th.active{background-color:#ccc}.handsontable thead th .relative{padding:2px 4px}.handsontable span.colHeader{display:inline-block;line-height:1.1}.handsontable .wtBorder{position:absolute;font-size:0}.handsontable .wtBorder.hidden{display:none!important}.handsontable .wtBorder.current{z-index:10}.handsontable .wtBorder.area{z-index:8}.handsontable .wtBorder.fill{z-index:6}.handsontable .wtBorder.corner{font-size:0;cursor:crosshair}.ht_clone_master{z-index:100}.ht_clone_right{z-index:110}.ht_clone_left{z-index:120}.ht_clone_bottom{z-index:130}.ht_clone_bottom_right_corner{z-index:140}.ht_clone_bottom_left_corner{z-index:150}.ht_clone_top{z-index:160}.ht_clone_top_right_corner{z-index:170}.ht_clone_top_left_corner{z-index:180}.handsontable tbody tr th:nth-last-child(2),.ht_clone_top_left_corner thead tr th:nth-last-child(2){border-right:1px solid #ccc}.handsontable col.hidden{width:0!important}.handsontable tr.hidden,.handsontable tr.hidden td,.handsontable tr.hidden th{display:none}.ht_clone_bottom,.ht_clone_left,.ht_clone_top,.ht_master{overflow:hidden}.ht_master .wtHolder{overflow:auto}.handsontable .ht_clone_left thead,.handsontable .ht_master thead,.handsontable .ht_master tr th{visibility:hidden}.ht_clone_bottom .wtHolder,.ht_clone_left .wtHolder,.ht_clone_top .wtHolder{overflow:hidden}.handsontable.htAutoSize{visibility:hidden;left:-99000px;position:absolute;top:-99000px}.handsontable td.htInvalid{background-color:#ff4c42!important}.handsontable td.htNoWrap{white-space:nowrap}#hot-display-license-info{font-size:10px;color:#323232;padding:5px 0 3px;font-family:Helvetica,Arial,sans-serif;text-align:left}#hot-display-license-info a{font-size:10px}.handsontable .manualColumnResizer{position:absolute;top:0;cursor:col-resize;z-index:210;width:5px;height:25px}.handsontable .manualRowResizer{position:absolute;left:0;cursor:row-resize;z-index:210;height:5px;width:50px}.handsontable .manualColumnResizer.active,.handsontable .manualColumnResizer:hover,.handsontable .manualRowResizer.active,.handsontable .manualRowResizer:hover{background-color:#34a9db}.handsontable .manualColumnResizerGuide{position:absolute;right:0;top:0;background-color:#34a9db;display:none;width:0;border-right:1px dashed #777;margin-left:5px}.handsontable .manualRowResizerGuide{position:absolute;left:0;bottom:0;background-color:#34a9db;display:none;height:0;border-bottom:1px dashed #777;margin-top:5px}.handsontable .manualColumnResizerGuide.active,.handsontable .manualRowResizerGuide.active{display:block;z-index:209}.handsontable .columnSorting{position:relative}.handsontable .columnSorting.sortAction:hover{text-decoration:underline;cursor:pointer}.handsontable span.colHeader.columnSorting:before{top:50%;margin-top:-6px;padding-left:8px;position:absolute;right:-9px;content:"";height:10px;width:5px;background-size:contain;background-repeat:no-repeat;background-position-x:right}.handsontable span.colHeader.columnSorting.ascending:before{background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAoCAMAAADJ7yrpAAAAKlBMVEUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAKE86IAAAADXRSTlMABBEmRGprlJW72e77tTkTKwAAAFNJREFUeAHtzjkSgCAUBNHPgsoy97+ulGXRqJE5L+xkxoYt2UdsLb5bqFINz+aLuuLn5rIu2RkO3fZpWENimNgiw6iBYRTPMLJjGFxQZ1hxxb/xBI1qC8k39CdKAAAAAElFTkSuQmCC")}.handsontable span.colHeader.columnSorting.descending:before{background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAoCAMAAADJ7yrpAAAAKlBMVEUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAKE86IAAAADXRSTlMABBEmRGprlJW72e77tTkTKwAAAFJJREFUeAHtzjkSgCAQRNFmQYUZ7n9dKUvru0TmvPAn3br0QfgdZ5xx6x+rQn23GqTYnq1FDcnuzZIO2WmedVqIRVxgGKEyjNgYRjKGkZ1hFIZ3I70LyM0VtU8AAAAASUVORK5CYII=")}.htGhostTable .htCore span.colHeader.columnSorting:not(.indicatorDisabled):after{content:"*";display:inline-block;position:relative;padding-right:20px}.handsontable td.area,.handsontable td.area-1,.handsontable td.area-2,.handsontable td.area-3,.handsontable td.area-4,.handsontable td.area-5,.handsontable td.area-6,.handsontable td.area-7{position:relative}.handsontable td.area-1:before,.handsontable td.area-2:before,.handsontable td.area-3:before,.handsontable td.area-4:before,.handsontable td.area-5:before,.handsontable td.area-6:before,.handsontable td.area-7:before,.handsontable td.area:before{content:"";position:absolute;top:0;left:0;right:0;bottom:0;bottom:-100%\9;background:#005eff}@media (-ms-high-contrast:none),screen and (-ms-high-contrast:active){.handsontable td.area-1:before,.handsontable td.area-2:before,.handsontable td.area-3:before,.handsontable td.area-4:before,.handsontable td.area-5:before,.handsontable td.area-6:before,.handsontable td.area-7:before,.handsontable td.area:before{bottom:-100%}}.handsontable td.area:before{opacity:.1}.handsontable td.area-1:before{opacity:.2}.handsontable td.area-2:before{opacity:.27}.handsontable td.area-3:before{opacity:.35}.handsontable td.area-4:before{opacity:.41}.handsontable td.area-5:before{opacity:.47}.handsontable td.area-6:before{opacity:.54}.handsontable td.area-7:before{opacity:.58}.handsontable tbody th.ht__highlight,.handsontable thead th.ht__highlight{background-color:#dcdcdc}.handsontable tbody th.ht__active_highlight,.handsontable thead th.ht__active_highlight{background-color:#8eb0e7;color:#000}.handsontableInput{border:none;outline-width:0;margin:0;padding:1px 5px 0;font-family:inherit;line-height:21px;font-size:inherit;box-shadow:inset 0 0 0 2px #5292f7;resize:none;display:block;color:#000;border-radius:0;background-color:#fff}.handsontableInput:focus{outline:none}.handsontableInputHolder{position:absolute;top:0;left:0}.htSelectEditor{-webkit-appearance:menulist-button!important;position:absolute;width:auto}.htSelectEditor:focus{outline:none}.handsontable .htDimmed{color:#777}.handsontable .htSubmenu{position:relative}.handsontable .htSubmenu :after{content:"\25B6";color:#777;position:absolute;right:5px;font-size:9px}.handsontable .htLeft{text-align:left}.handsontable .htCenter{text-align:center}.handsontable .htRight{text-align:right}.handsontable .htJustify{text-align:justify}.handsontable .htTop{vertical-align:top}.handsontable .htMiddle{vertical-align:middle}.handsontable .htBottom{vertical-align:bottom}.handsontable .htPlaceholder{color:#999}.handsontable .htAutocompleteArrow{float:right;font-size:10px;color:#eee;cursor:default;width:16px;text-align:center}.handsontable td .htAutocompleteArrow:hover{color:#777}.handsontable td.area .htAutocompleteArrow{color:#d3d3d3}.handsontable .htCheckboxRendererInput{display:inline-block}.handsontable .htCheckboxRendererInput.noValue{opacity:.5}.handsontable .htCheckboxRendererLabel{font-size:inherit;vertical-align:middle;cursor:pointer;display:inline-block;width:100%}.handsontable.listbox{margin:0}.handsontable.listbox .ht_master table{border:1px solid #ccc;border-collapse:separate;background:#fff}.handsontable.listbox td,.handsontable.listbox th,.handsontable.listbox tr:first-child td,.handsontable.listbox tr:first-child th,.handsontable.listbox tr:last-child th{border-color:transparent}.handsontable.listbox td,.handsontable.listbox th{white-space:nowrap;text-overflow:ellipsis}.handsontable.listbox td.htDimmed{cursor:default;color:inherit;font-style:inherit}.handsontable.listbox .wtBorder{visibility:hidden}.handsontable.listbox tr:hover td,.handsontable.listbox tr td.current{background:#eee}.ht_editor_hidden{z-index:-1}.ht_editor_visible{z-index:200}.handsontable td.htSearchResult{background:#fcedd9;color:#583707}.collapsibleIndicator{position:absolute;top:50%;transform:translateY(-50%);right:5px;border:1px solid #a6a6a6;line-height:10px;color:#222;border-radius:10px;font-size:10px;width:10px;height:10px;cursor:pointer;box-shadow:0 0 0 6px #eee;background:#eee}.handsontable.mobile,.handsontable.mobile .wtHolder{-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;-webkit-tap-highlight-color:rgba(0,0,0,0);-webkit-overflow-scrolling:touch}.htMobileEditorContainer{display:none;position:absolute;top:0;width:70%;height:54pt;background:#f8f8f8;border-radius:20px;border:1px solid #ebebeb;z-index:999;box-sizing:border-box;-webkit-box-sizing:border-box;-webkit-text-size-adjust:none}.topLeftSelectionHandle-HitArea:not(.ht_master .topLeftSelectionHandle-HitArea),.topLeftSelectionHandle:not(.ht_master .topLeftSelectionHandle){z-index:9999}.bottomRightSelectionHandle,.bottomRightSelectionHandle-HitArea,.topLeftSelectionHandle,.topLeftSelectionHandle-HitArea{left:-10000px;top:-10000px}.htMobileEditorContainer.active{display:block}.htMobileEditorContainer .inputs{position:absolute;right:210pt;bottom:10pt;top:10pt;left:14px;height:34pt}.htMobileEditorContainer .inputs textarea{font-size:13pt;border:1px solid #a1a1a1;-webkit-appearance:none;box-shadow:none;position:absolute;left:14px;right:14px;top:0;bottom:0;padding:7pt}.htMobileEditorContainer .cellPointer{position:absolute;top:-13pt;height:0;width:0;left:30px;border-left:13pt solid transparent;border-right:13pt solid transparent;border-bottom:13pt solid #ebebeb}.htMobileEditorContainer .cellPointer.hidden{display:none}.htMobileEditorContainer .cellPointer:before{content:"";display:block;position:absolute;top:2px;height:0;width:0;left:-13pt;border-left:13pt solid transparent;border-right:13pt solid transparent;border-bottom:13pt solid #f8f8f8}.htMobileEditorContainer .moveHandle{position:absolute;top:10pt;left:5px;width:30px;bottom:0;cursor:move;z-index:9999}.htMobileEditorContainer .moveHandle:after{content:"..\A..\A..\A..";white-space:pre;line-height:10px;font-size:20pt;display:inline-block;margin-top:-8px;color:#ebebeb}.htMobileEditorContainer .positionControls{width:205pt;position:absolute;right:5pt;top:0;bottom:0}.htMobileEditorContainer .positionControls>div{width:50pt;height:100%;float:left}.htMobileEditorContainer .positionControls>div:after{content:" ";display:block;width:15pt;height:15pt;text-align:center;line-height:50pt}.htMobileEditorContainer .downButton:after,.htMobileEditorContainer .leftButton:after,.htMobileEditorContainer .rightButton:after,.htMobileEditorContainer .upButton:after{transform-origin:5pt 5pt;-webkit-transform-origin:5pt 5pt;margin:21pt 0 0 21pt}.htMobileEditorContainer .leftButton:after{border-top:2px solid #288ffe;border-left:2px solid #288ffe;-webkit-transform:rotate(-45deg)}.htMobileEditorContainer .leftButton:active:after{border-color:#cfcfcf}.htMobileEditorContainer .rightButton:after{border-top:2px solid #288ffe;border-left:2px solid #288ffe;-webkit-transform:rotate(135deg)}.htMobileEditorContainer .rightButton:active:after{border-color:#cfcfcf}.htMobileEditorContainer .upButton:after{border-top:2px solid #288ffe;border-left:2px solid #288ffe;-webkit-transform:rotate(45deg)}.htMobileEditorContainer .upButton:active:after{border-color:#cfcfcf}.htMobileEditorContainer .downButton:after{border-top:2px solid #288ffe;border-left:2px solid #288ffe;-webkit-transform:rotate(225deg)}.htMobileEditorContainer .downButton:active:after{border-color:#cfcfcf}.handsontable.hide-tween{-webkit-animation:opacity-hide .3s;animation:opacity-hide .3s;animation-fill-mode:forwards;-webkit-animation-fill-mode:forwards}.handsontable.show-tween{-webkit-animation:opacity-show .3s;animation:opacity-show .3s;animation-fill-mode:forwards;-webkit-animation-fill-mode:forwards} + +/*! + * Pikaday + * Copyright © 2014 David Bushell | BSD & MIT license | https://dbushell.com/ + */.pika-single{z-index:9999;display:block;position:relative;color:#333;background:#fff;border:1px solid;border-color:#ccc #ccc #bbb;font-family:Helvetica Neue,Helvetica,Arial,sans-serif}.pika-single:after,.pika-single:before{content:" ";display:table}.pika-single:after{clear:both}.pika-single{*zoom:1}.pika-single.is-hidden{display:none}.pika-single.is-bound{position:absolute;box-shadow:0 5px 15px -5px rgba(0,0,0,.5)}.pika-lendar{float:left;width:240px;margin:8px}.pika-title{position:relative;text-align:center}.pika-label{display:inline-block;*display:inline;position:relative;z-index:9999;overflow:hidden;margin:0;padding:5px 3px;font-size:14px;line-height:20px;font-weight:700;background-color:#fff}.pika-title select{cursor:pointer;position:absolute;z-index:9998;margin:0;left:0;top:5px;filter:alpha(opacity=0);opacity:0}.pika-next,.pika-prev{display:block;cursor:pointer;position:relative;outline:none;border:0;padding:0;width:20px;height:30px;text-indent:20px;white-space:nowrap;overflow:hidden;background-color:transparent;background-position:50%;background-repeat:no-repeat;background-size:75% 75%;opacity:.5;*position:absolute;*top:0}.pika-next:hover,.pika-prev:hover{opacity:1}.is-rtl .pika-next,.pika-prev{float:left;background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAeCAYAAAAsEj5rAAAAUklEQVR42u3VMQoAIBADQf8Pgj+OD9hG2CtONJB2ymQkKe0HbwAP0xucDiQWARITIDEBEnMgMQ8S8+AqBIl6kKgHiXqQqAeJepBo/z38J/U0uAHlaBkBl9I4GwAAAABJRU5ErkJggg==");*left:0}.is-rtl .pika-prev,.pika-next{float:right;background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAeCAYAAAAsEj5rAAAAU0lEQVR42u3VOwoAMAgE0dwfAnNjU26bYkBCFGwfiL9VVWoO+BJ4Gf3gtsEKKoFBNTCoCAYVwaAiGNQGMUHMkjGbgjk2mIONuXo0nC8XnCf1JXgArVIZAQh5TKYAAAAASUVORK5CYII=");*right:0}.pika-next.is-disabled,.pika-prev.is-disabled{cursor:default;opacity:.2}.pika-select{display:inline-block;*display:inline}.pika-table{width:100%;border-collapse:collapse;border-spacing:0;border:0}.pika-table td,.pika-table th{width:14.285714285714286%;padding:0}.pika-table th{color:#999;font-size:12px;line-height:25px;font-weight:700;text-align:center}.pika-button{cursor:pointer;display:block;box-sizing:border-box;-moz-box-sizing:border-box;outline:none;border:0;margin:0;width:100%;padding:5px;color:#666;font-size:12px;line-height:15px;text-align:right;background:#f5f5f5}.pika-week{font-size:11px;color:#999}.is-today .pika-button{color:#3af;font-weight:700}.has-event .pika-button,.is-selected .pika-button{color:#fff;font-weight:700;background:#3af;box-shadow:inset 0 1px 3px #178fe5;border-radius:3px}.has-event .pika-button{background:#005da9;box-shadow:inset 0 1px 3px #0076c9}.is-disabled .pika-button,.is-inrange .pika-button{background:#d5e9f7}.is-startrange .pika-button{color:#fff;background:#6cb31d;box-shadow:none;border-radius:3px}.is-endrange .pika-button{color:#fff;background:#3af;box-shadow:none;border-radius:3px}.is-disabled .pika-button{pointer-events:none;cursor:default;color:#999;opacity:.3}.is-outside-current-month .pika-button{color:#999;opacity:.3}.is-selection-disabled{pointer-events:none;cursor:default}.pika-button:hover,.pika-row.pick-whole-week:hover .pika-button{color:#fff;background:#ff8000;box-shadow:none;border-radius:3px}.pika-table abbr{border-bottom:none;cursor:help}.htCommentCell{position:relative}.htCommentCell:after{content:"";position:absolute;top:0;right:0;border-left:6px solid transparent;border-top:6px solid #000}.htComments{display:none;z-index:1059;position:absolute}.htCommentTextArea{box-shadow:0 1px 3px rgba(0,0,0,.117647),0 1px 2px rgba(0,0,0,.239216);box-sizing:border-box;border:none;border-left:3px solid #ccc;background-color:#fff;width:215px;height:90px;font-size:12px;padding:5px;outline:0!important;-webkit-appearance:none}.htCommentTextArea:focus{box-shadow:0 1px 3px rgba(0,0,0,.117647),0 1px 2px rgba(0,0,0,.239216),inset 0 0 0 1px #5292f7;border-left:3px solid #5292f7} + +/*! + * Handsontable ContextMenu + */.htContextMenu:not(.htGhostTable){display:none;position:absolute;z-index:1060}.htContextMenu .ht_clone_corner,.htContextMenu .ht_clone_left,.htContextMenu .ht_clone_top{display:none}.htContextMenu .ht_master table.htCore{border-color:#ccc;border-style:solid;border-width:1px 2px 2px 1px}.htContextMenu .wtBorder{visibility:hidden}.htContextMenu table tbody tr td{background:#fff;border-width:0;padding:4px 6px 0;cursor:pointer;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.htContextMenu table tbody tr td:first-child{border:0}.htContextMenu table tbody tr td.htDimmed{font-style:normal;color:#323232}.htContextMenu table tbody tr td.current,.htContextMenu table tbody tr td.zeroclipboard-is-hover{background:#f3f3f3}.htContextMenu table tbody tr td.htSeparator{border-top:1px solid #e6e6e6;height:0;padding:0;cursor:default}.htContextMenu table tbody tr td.htDisabled{color:#999;cursor:default}.htContextMenu table tbody tr td.htDisabled:hover{background:#fff;color:#999;cursor:default}.htContextMenu table tbody tr.htHidden{display:none}.htContextMenu table tbody tr td .htItemWrapper{margin-left:10px;margin-right:6px}.htContextMenu table tbody tr td div span.selected{margin-top:-2px;position:absolute;left:4px}.htContextMenu .ht_master .wtHolder{overflow:hidden}textarea.HandsontableCopyPaste{position:fixed!important;top:0!important;right:100%!important;overflow:hidden;opacity:0;outline:0 none!important}.htRowHeaders .ht_master.innerBorderLeft~.ht_clone_left td:first-of-type,.htRowHeaders .ht_master.innerBorderLeft~.ht_clone_top_left_corner th:nth-child(2){border-left:0}.handsontable.ht__manualColumnMove.after-selection--columns thead th.ht__highlight{cursor:move;cursor:-webkit-grab;cursor:grab}.handsontable.ht__manualColumnMove.on-moving--columns,.handsontable.ht__manualColumnMove.on-moving--columns thead th.ht__highlight{cursor:move;cursor:-webkit-grabbing;cursor:grabbing}.handsontable.ht__manualColumnMove.on-moving--columns .manualColumnResizer{display:none}.handsontable .ht__manualColumnMove--backlight,.handsontable .ht__manualColumnMove--guideline{position:absolute;height:100%;display:none}.handsontable .ht__manualColumnMove--guideline{background:#757575;width:2px;top:0;margin-left:-1px;z-index:205}.handsontable .ht__manualColumnMove--backlight{background:#343434;background:rgba(52,52,52,.25);display:none;z-index:205;pointer-events:none}.handsontable.on-moving--columns .ht__manualColumnMove--backlight,.handsontable.on-moving--columns.show-ui .ht__manualColumnMove--guideline{display:block}.handsontable .wtHider{position:relative}.handsontable.ht__manualRowMove.after-selection--rows tbody th.ht__highlight{cursor:move;cursor:-webkit-grab;cursor:grab}.handsontable.ht__manualRowMove.on-moving--rows,.handsontable.ht__manualRowMove.on-moving--rows tbody th.ht__highlight{cursor:move;cursor:-webkit-grabbing;cursor:grabbing}.handsontable.ht__manualRowMove.on-moving--rows .manualRowResizer{display:none}.handsontable .ht__manualRowMove--backlight,.handsontable .ht__manualRowMove--guideline{position:absolute;width:100%;display:none}.handsontable .ht__manualRowMove--guideline{background:#757575;height:2px;left:0;margin-top:-1px;z-index:205}.handsontable .ht__manualRowMove--backlight{background:#343434;background:rgba(52,52,52,.25);display:none;z-index:205;pointer-events:none}.handsontable.on-moving--rows .ht__manualRowMove--backlight,.handsontable.on-moving--rows.show-ui .ht__manualRowMove--guideline{display:block}.handsontable tbody td[rowspan][class*=area][class*=highlight]:not([class*=fullySelectedMergedCell]):before{opacity:0}.handsontable tbody td[rowspan][class*=area][class*=highlight][class*=fullySelectedMergedCell-0]:before,.handsontable tbody td[rowspan][class*=area][class*=highlight][class*=fullySelectedMergedCell-multiple]:before{opacity:.1}.handsontable tbody td[rowspan][class*=area][class*=highlight][class*=fullySelectedMergedCell-1]:before{opacity:.2}.handsontable tbody td[rowspan][class*=area][class*=highlight][class*=fullySelectedMergedCell-2]:before{opacity:.27}.handsontable tbody td[rowspan][class*=area][class*=highlight][class*=fullySelectedMergedCell-3]:before{opacity:.35}.handsontable tbody td[rowspan][class*=area][class*=highlight][class*=fullySelectedMergedCell-4]:before{opacity:.41}.handsontable tbody td[rowspan][class*=area][class*=highlight][class*=fullySelectedMergedCell-5]:before{opacity:.47}.handsontable tbody td[rowspan][class*=area][class*=highlight][class*=fullySelectedMergedCell-6]:before{opacity:.54}.handsontable tbody td[rowspan][class*=area][class*=highlight][class*=fullySelectedMergedCell-7]:before{opacity:.58}.handsontable span.colHeader.columnSorting:after{top:50%;margin-top:-2px;position:absolute;right:-15px;padding-left:5px;font-size:8px;height:8px;line-height:1.1;text-decoration:underline;text-decoration:none}.handsontable span.colHeader.columnSorting[class*=" sort-"]:after,.handsontable span.colHeader.columnSorting[class^=sort-]:after{content:"+"}.handsontable span.colHeader.columnSorting.sort-1:after{content:"1"}.handsontable span.colHeader.columnSorting.sort-2:after{content:"2"}.handsontable span.colHeader.columnSorting.sort-3:after{content:"3"}.handsontable span.colHeader.columnSorting.sort-4:after{content:"4"}.handsontable span.colHeader.columnSorting.sort-5:after{content:"5"}.handsontable span.colHeader.columnSorting.sort-6:after{content:"6"}.handsontable span.colHeader.columnSorting.sort-7:after{content:"7"}.htGhostTable th div button.changeType+span.colHeader.columnSorting:not(.indicatorDisabled){padding-right:5px} + +/*! + * Handsontable DropdownMenu + */.handsontable .changeType{background:#eee;border-radius:2px;border:1px solid #bbb;color:#bbb;font-size:9px;line-height:9px;padding:2px;margin:3px 1px 0 5px;float:right}.handsontable .changeType:before{content:"\25BC "}.handsontable .changeType:hover{border:1px solid #777;color:#777;cursor:pointer}.htDropdownMenu:not(.htGhostTable){display:none;position:absolute;z-index:1060}.htDropdownMenu .ht_clone_corner,.htDropdownMenu .ht_clone_left,.htDropdownMenu .ht_clone_top{display:none}.htDropdownMenu table.htCore{border-color:#bbb;border-style:solid;border-width:1px 2px 2px 1px}.htDropdownMenu .wtBorder{visibility:hidden}.htDropdownMenu table tbody tr td{background:#fff;border-width:0;padding:4px 6px 0;cursor:pointer;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.htDropdownMenu table tbody tr td:first-child{border:0}.htDropdownMenu table tbody tr td.htDimmed{font-style:normal;color:#323232}.htDropdownMenu table tbody tr td.current,.htDropdownMenu table tbody tr td.zeroclipboard-is-hover{background:#e9e9e9}.htDropdownMenu table tbody tr td.htSeparator{border-top:1px solid #e6e6e6;height:0;padding:0;cursor:default}.htDropdownMenu table tbody tr td.htDisabled{color:#999}.htDropdownMenu table tbody tr td.htDisabled:hover{background:#fff;color:#999;cursor:default}.htDropdownMenu:not(.htGhostTable) table tbody tr.htHidden{display:none}.htDropdownMenu table tbody tr td .htItemWrapper{margin-left:10px;margin-right:10px}.htDropdownMenu table tbody tr td div span.selected{margin-top:-2px;position:absolute;left:4px}.htDropdownMenu .ht_master .wtHolder{overflow:hidden} + +/*! + * Handsontable Filters + */.htFiltersConditionsMenu:not(.htGhostTable){display:none;position:absolute;z-index:1070}.htFiltersConditionsMenu .ht_clone_corner,.htFiltersConditionsMenu .ht_clone_left,.htFiltersConditionsMenu .ht_clone_top{display:none}.htFiltersConditionsMenu table.htCore{border-color:#bbb;border-style:solid;border-width:1px 2px 2px 1px}.htFiltersConditionsMenu .wtBorder{visibility:hidden}.htFiltersConditionsMenu table tbody tr td{background:#fff;border-width:0;padding:4px 6px 0;cursor:pointer;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.htFiltersConditionsMenu table tbody tr td:first-child{border:0}.htFiltersConditionsMenu table tbody tr td.htDimmed{font-style:normal;color:#323232}.htFiltersConditionsMenu table tbody tr td.current,.htFiltersConditionsMenu table tbody tr td.zeroclipboard-is-hover{background:#e9e9e9}.htFiltersConditionsMenu table tbody tr td.htSeparator{border-top:1px solid #e6e6e6;height:0;padding:0}.htFiltersConditionsMenu table tbody tr td.htDisabled{color:#999}.htFiltersConditionsMenu table tbody tr td.htDisabled:hover{background:#fff;color:#999;cursor:default}.htFiltersConditionsMenu table tbody tr td .htItemWrapper{margin-left:10px;margin-right:10px}.htFiltersConditionsMenu table tbody tr td div span.selected{margin-top:-2px;position:absolute;left:4px}.htFiltersConditionsMenu .ht_master .wtHolder{overflow:hidden}.handsontable .htMenuFiltering{border-bottom:1px dotted #ccc;height:135px;overflow:hidden}.handsontable .ht_master table td.htCustomMenuRenderer{background-color:#fff;cursor:auto}.handsontable .htFiltersMenuLabel{font-size:.75em}.handsontable .htFiltersMenuActionBar{text-align:center;padding-top:10px;padding-bottom:3px}.handsontable .htFiltersMenuCondition.border{border-bottom:1px dotted #ccc!important}.handsontable .htFiltersMenuCondition .htUIInput{padding:0 0 5px}.handsontable .htFiltersMenuValue{border-bottom:1px dotted #ccc!important}.handsontable .htFiltersMenuValue .htUIMultipleSelectSearch{padding:0}.handsontable .htFiltersMenuCondition .htUIInput input,.handsontable .htFiltersMenuValue .htUIMultipleSelectSearch input{font-family:inherit;font-size:.75em;padding:4px;box-sizing:border-box;width:100%}.htUIMultipleSelect .ht_master .wtHolder{overflow-y:scroll}.handsontable .htFiltersActive .changeType{border:1px solid #509272;color:#18804e;background-color:#d2e0d9}.handsontable .htUISelectAll{margin-right:10px}.handsontable .htUIClearAll,.handsontable .htUISelectAll{display:inline-block}.handsontable .htUIClearAll a,.handsontable .htUISelectAll a{color:#3283d8;font-size:.75em}.handsontable .htUISelectionControls{text-align:right}.handsontable .htCheckboxRendererInput{margin:0 5px 0 0;vertical-align:middle;height:1em}.handsontable .htUIInput{padding:3px 0 7px;position:relative;text-align:center}.handsontable .htUIInput input{border-radius:2px;border:1px solid #d2d1d1}.handsontable .htUIInput input:focus{outline:0}.handsontable .htUIInputIcon{position:absolute}.handsontable .htUIInput.htUIButton{cursor:pointer;display:inline-block}.handsontable .htUIInput.htUIButton input{background-color:#eee;color:#000;cursor:pointer;font-family:inherit;font-size:.7em;font-weight:700;height:19px;min-width:64px}.handsontable .htUIInput.htUIButton input:hover{border-color:#b9b9b9}.handsontable .htUIInput.htUIButtonOK{margin-right:10px}.handsontable .htUIInput.htUIButtonOK input{background-color:#0f9d58;border-color:#18804e;color:#fff}.handsontable .htUIInput.htUIButtonOK input:hover{border-color:#1a6f46}.handsontable .htUISelect{cursor:pointer;margin-bottom:7px;position:relative}.handsontable .htUISelectCaption{background-color:#e8e8e8;border-radius:2px;border:1px solid #d2d1d1;font-family:inherit;font-size:.7em;font-weight:700;padding:3px 20px 3px 10px;text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.handsontable .htUISelectCaption:hover{background-color:#e8e8e8;border:1px solid #b9b9b9}.handsontable .htUISelectDropdown:after{content:"\25B2";font-size:7px;position:absolute;right:10px;top:0}.handsontable .htUISelectDropdown:before{content:"\25BC";font-size:7px;position:absolute;right:10px;top:8px}.handsontable .htUIMultipleSelect .handsontable .htCore{border:none}.handsontable .htUIMultipleSelect .handsontable .htCore td:hover{background-color:#f5f5f5}.handsontable .htUIMultipleSelectSearch input{border-radius:2px;border:1px solid #d2d1d1;padding:3px}.handsontable .htUIRadio{display:inline-block;margin-right:5px;height:100%}.handsontable .htUIRadio:last-child{margin-right:0}.handsontable .htUIRadio>input[type=radio]{margin-right:.5ex}.handsontable .htUIRadio label{vertical-align:middle}.handsontable .htFiltersMenuOperators{padding-bottom:5px}.handsontable thead th.hiddenHeader:not(:first-of-type){display:none}.handsontable th.ht_nestingLevels{text-align:left;padding-left:7px}.handsontable th div.ht_nestingLevels{display:inline-block;position:absolute;left:11px}.handsontable.innerBorderLeft th div.ht_nestingLevels,.handsontable.innerBorderLeft~.handsontable th div.ht_nestingLevels{right:10px}.handsontable th span.ht_nestingLevel{display:inline-block}.handsontable th span.ht_nestingLevel_empty{display:inline-block;width:10px;height:1px;float:left}.handsontable th span.ht_nestingLevel:after{content:"\2510";font-size:9px;display:inline-block;position:relative;bottom:3px}.handsontable th div.ht_nestingButton{display:inline-block;position:absolute;right:-2px;cursor:pointer}.handsontable th div.ht_nestingButton.ht_nestingExpand:after{content:"+"}.handsontable th div.ht_nestingButton.ht_nestingCollapse:after{content:"-"}.handsontable.innerBorderLeft th div.ht_nestingButton,.handsontable.innerBorderLeft~.handsontable th div.ht_nestingButton{right:0}.handsontable th.beforeHiddenColumn{position:relative}.handsontable th.afterHiddenColumn:before,.handsontable th.beforeHiddenColumn:after{color:#bbb;position:absolute;top:50%;font-size:5pt;transform:translateY(-50%)}.handsontable th.afterHiddenColumn{position:relative}.handsontable th.beforeHiddenColumn:after{right:1px;content:"\25C0"}.handsontable th.afterHiddenColumn:before{left:1px;content:"\25B6"} + +/*! + * Handsontable HiddenRows + */.handsontable th.afterHiddenRow:after,.handsontable th.beforeHiddenRow:before{color:#bbb;font-size:6pt;line-height:6pt;position:absolute;left:2px}.handsontable th.afterHiddenRow,.handsontable th.beforeHiddenRow{position:relative}.handsontable th.beforeHiddenRow:before{content:"\25B2";bottom:2px}.handsontable th.afterHiddenRow:after{content:"\25BC";top:2px}.handsontable.ht__selection--rows tbody th.afterHiddenRow.ht__highlight:after,.handsontable.ht__selection--rows tbody th.beforeHiddenRow.ht__highlight:before{color:#eee}.handsontable td.afterHiddenRow.firstVisibleRow,.handsontable th.afterHiddenRow.firstVisibleRow{border-top:1px solid #ccc}div.mcloud-report-viewer{display:flex;flex-direction:column}div.mcloud-report-viewer div.mcloud-report-selector{display:flex;align-items:center}div.mcloud-report-viewer div.mcloud-report-selector label{margin-right:10px}div.mcloud-report-viewer div.mcloud-report-selector select{margin-right:15px}div.mcloud-report-viewer div.mcloud-report-grid-container{margin-top:20px;position:relative;display:flex}div.mcloud-report-viewer div.mcloud-report-grid-container div.mcloud-report-grid{min-width:100%!important;max-width:100%!important;width:100%!important;height:calc(100vh - 220px);max-height:calc(100vh - 220px);border:1px solid #ccc;overflow:hidden}div.mcloud-report-viewer div.mcloud-report-grid-container div.mcloud-report-grid div.jexcel_content{max-height:unset!important;width:100%!important;min-width:100%!important}div.mcloud-report-viewer div.mcloud-report-grid-container div.mcloud-report-grid div.jexcel_content table.jexcel{width:100%!important;min-width:100%!important;max-width:100%!important}div.mcloud-report-viewer div.mcloud-report-grid-container div.mcloud-report-grid div.jexcel_content table.jexcel tbody tr td{white-space:nowrap!important;overflow:hidden;text-overflow:ellipsis}div.mcloud-report-viewer div.mcloud-report-grid-container div.mcloud-report-grid div.jexcel_content table.jexcel thead tr:first-of-type td{border-bottom:1px solid #ccc}div.mcloud-report-viewer div.mcloud-report-grid-container div.mcloud-report-grid div.jexcel_content table.jexcel thead tr:last-of-type td{position:unset!important}div.mcloud-report-viewer #hot-display-license-info{display:none} \ No newline at end of file diff --git a/public/js/ilab-dismiss-notice.js b/public/js/ilab-dismiss-notice.js index a42877d6..17396889 100755 --- a/public/js/ilab-dismiss-notice.js +++ b/public/js/ilab-dismiss-notice.js @@ -1 +1 @@ -!function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="/",n(n.s=296)}({296:function(e,t,n){e.exports=n(297)},297:function(e,t){var n;(n=jQuery)((function(){n("div[data-dismissible] button.notice-dismiss").click((function(e){e.preventDefault();var t,r=n(this);t={action:"ilab_dismiss_admin_notice",option_name:r.parent().attr("data-dismissible"),dismissible_length:r.parent().attr("data-dismissible-length"),nonce:ilab_dismissible_notice.nonce},n.post(ajaxurl,t)}))}))}}); \ No newline at end of file +!function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="/",n(n.s=636)}({636:function(e,t,n){e.exports=n(637)},637:function(e,t){var n;(n=jQuery)((function(){n("div[data-dismissible] button.notice-dismiss").click((function(e){e.preventDefault();var t,r=n(this);t={action:"ilab_dismiss_admin_notice",option_name:r.parent().attr("data-dismissible"),dismissible_length:r.parent().attr("data-dismissible-length"),nonce:ilab_dismissible_notice.nonce},n.post(ajaxurl,t)}))}))}}); \ No newline at end of file diff --git a/public/js/ilab-face-detect.js b/public/js/ilab-face-detect.js index 552c79bc..c44bf6af 100755 --- a/public/js/ilab-face-detect.js +++ b/public/js/ilab-face-detect.js @@ -1 +1 @@ -!function(t){var e={};function r(n){if(e[n])return e[n].exports;var i=e[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)r.d(n,i,function(e){return t[e]}.bind(null,i));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="/",r(r.s=318)}({14:function(t,e,r){var n=function(t){"use strict";var e=Object.prototype,r=e.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},i=n.iterator||"@@iterator",o=n.asyncIterator||"@@asyncIterator",a=n.toStringTag||"@@toStringTag";function h(t,e,r,n){var i=e&&e.prototype instanceof c?e:c,o=Object.create(i.prototype),a=new b(n||[]);return o._invoke=function(t,e,r){var n="suspendedStart";return function(i,o){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===i)throw o;return M()}for(r.method=i,r.arg=o;;){var a=r.delegate;if(a){var h=v(a,r);if(h){if(h===d)continue;return h}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var c=u(t,e,r);if("normal"===c.type){if(n=r.done?"completed":"suspendedYield",c.arg===d)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n="completed",r.method="throw",r.arg=c.arg)}}}(t,r,a),o}function u(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=h;var d={};function c(){}function l(){}function f(){}var s={};s[i]=function(){return this};var y=Object.getPrototypeOf,p=y&&y(y(L([])));p&&p!==e&&r.call(p,i)&&(s=p);var m=f.prototype=c.prototype=Object.create(s);function g(t){["next","throw","return"].forEach((function(e){t[e]=function(t){return this._invoke(e,t)}}))}function x(t,e){var n;this._invoke=function(i,o){function a(){return new e((function(n,a){!function n(i,o,a,h){var d=u(t[i],t,o);if("throw"!==d.type){var c=d.arg,l=c.value;return l&&"object"==typeof l&&r.call(l,"__await")?e.resolve(l.__await).then((function(t){n("next",t,a,h)}),(function(t){n("throw",t,a,h)})):e.resolve(l).then((function(t){c.value=t,a(c)}),(function(t){return n("throw",t,a,h)}))}h(d.arg)}(i,o,n,a)}))}return n=n?n.then(a,a):a()}}function v(t,e){var r=t.iterator[e.method];if(void 0===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,v(t,e),"throw"===e.method))return d;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return d}var n=u(r,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,d;var i=n.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,d):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,d)}function w(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function E(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function b(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(w,this),this.reset(!0)}function L(t){if(t){var e=t[i];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,o=function e(){for(;++n=0;--i){var o=this.tryEntries[i],a=o.completion;if("root"===o.tryLoc)return n("end");if(o.tryLoc<=this.prev){var h=r.call(o,"catchLoc"),u=r.call(o,"finallyLoc");if(h&&u){if(this.prev=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),E(r),d}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var i=n.arg;E(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:L(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),d}},t}(t.exports);try{regeneratorRuntime=n}catch(t){Function("r","regeneratorRuntime = r")(n)}},318:function(t,e,r){t.exports=r(319)},319:function(t,e,r){"use strict";r.r(e);var n=r(4),i=r.n(n);function o(t,e,r,n,i,o,a){try{var h=t[o](a),u=h.value}catch(t){return void r(t)}h.done?e(u):Promise.resolve(u).then(n,i)}function a(t){return function(){var e=this,r=arguments;return new Promise((function(n,i){var a=t.apply(e,r);function h(t){o(a,n,i,h,u,"next",t)}function u(t){o(a,n,i,h,u,"throw",t)}h(void 0)}))}}window.ILABFaceDetector=function(t,e){if("undefined"==typeof faceapi)return null;var r=function(t,e){var r=Number.MAX_SAFE_INTEGER,n=Number.MAX_SAFE_INTEGER,i=0,o=0;return t.forEach((function(t){r=Math.min(r,t.x),i=Math.max(i,t.x),n=Math.min(n,t.y),o=Math.max(o,t.y)})),{x1:r/e.width,x2:i/e.width,y1:n/e.height,y2:o/e.height,midX:(r+(i-r)/2)/e.width,midY:(n+(o-n)/2)/e.height,width:(i-r)/e.width,height:(o-n)/e.height}},n=function(t,e,r){var n=[];return t.forEach((function(t){var i=Math.sin(e),o=Math.cos(e);n.push({x:o*(t.x-r.x)-i*(t.y-r.y)+r.x,y:i*(t.x-r.x)+o*(t.y-r.y)+r.y})})),n},o=function(t,e){return{x:t.x/e.width,y:t.y/e.height}},h=function(t,e,i){var a=n(t,-e.angle,e.center),h=r(a,{width:1,height:1}),u=[{x:h.x1,y:h.y1},{x:h.x2,y:h.y2},{x:h.x1,y:h.y2},{x:h.x2,y:h.y1},{x:h.midX,y:h.y1},{x:h.x2,y:h.midY},{x:h.midX,y:h.y2},{x:h.x1,y:h.midY},{x:h.midX,y:h.midY}];return{x1:(u=n(u,e.angle,e.center))[0].x/i.width,x2:u[1].x/i.width,y1:u[0].y/i.height,y2:u[1].y/i.height,midX:u[2].x/i.width,midY:u[2].y/i.height,width:h.width/i.width,height:h.height/i.height,topLeft:o(u[0],i),bottomRight:o(u[1],i),bottomLeft:o(u[2],i),topRight:o(u[3],i),topMiddle:o(u[4],i),middleRight:o(u[5],i),bottomMiddle:o(u[6],i),middleLeft:o(u[7],i)}},u=function(t){var e=r(t.getLeftEye(),{width:1,height:1}),n=r(t.getRightEye(),{width:1,height:1}),i=Math.max(n.midX,e.midX),o=Math.min(n.midX,e.midX),a=Math.max(n.midY,e.midY),h=o-i,u=Math.min(n.midY,e.midY)-a;return{angle:Math.atan2(n.midY-e.midY,n.midX-e.midX),center:{x:i+h/2,y:a+u/2}}},d=function(){var t=a(i.a.mark((function t(){return i.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",new Promise((function(t){setTimeout((function(){t()}),250)})));case 1:case"end":return t.stop()}}),t)})));return function(){return t.apply(this,arguments)}}(),c=function(){var t=a(i.a.mark((function t(o){var a;return i.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(window.loadedFaceData){t.next=6;break}return console.log("waiting for loaded."),t.next=4,d();case 4:t.next=0;break;case 6:return a=[],t.next=9,faceapi.detectAllFaces(o).withFaceLandmarks();case 9:t.sent.forEach((function(t){var e=t.detection.imageDims,i={Left:t.detection.box.x/e.width,Top:t.detection.box.y/e.height,Width:t.detection.box.width/e.width,Height:t.detection.box.height/e.height},o=[],d=u(t.landmarks);d.center={x:i.Left+i.Width/2,y:i.Top+i.Height/2};var c=h(t.landmarks.getMouth(),d,t.detection.imageDims);0!=c.width&&0!=c.height&&(o.push({Type:"mouthLeft",X:c.middleLeft.x,Y:c.middleLeft.y}),o.push({Type:"mouthRight",X:c.middleRight.x,Y:c.middleRight.y}),o.push({Type:"mouthUp",X:c.topMiddle.x,Y:c.topMiddle.y}),o.push({Type:"mouthDown",X:c.bottomMiddle.x,Y:c.bottomMiddle.y}));var l=h(t.landmarks.getLeftEye(),d,t.detection.imageDims);0!=l.width&&0!=l.height&&(o.push({Type:"eyeLeft",X:l.midX,Y:l.midY}),o.push({Type:"leftEyeLeft",X:l.middleLeft.x,Y:l.middleLeft.y}),o.push({Type:"leftEyeRight",X:l.middleRight.x,Y:l.middleRight.y}),o.push({Type:"leftEyeUp",X:l.topMiddle.x,Y:l.topMiddle.y}),o.push({Type:"leftEyeDown",X:l.bottomMiddle.x,Y:l.bottomMiddle.y}));var f=h(t.landmarks.getLeftEyeBrow(),d,t.detection.imageDims);0!=f.width&&0!=f.height&&(o.push({Type:"leftEyeBrowLeft",X:f.bottomLeft.x,Y:f.bottomLeft.y}),o.push({Type:"leftEyeBrowRight",X:f.bottomRight.x,Y:f.bottomRight.y}),o.push({Type:"leftEyeBrowUp",X:f.topMiddle.x,Y:f.topMiddle.y}));var s=h(t.landmarks.getRightEye(),d,t.detection.imageDims);0!=s.width&&0!=s.height&&(o.push({Type:"eyeRight",X:s.midX,Y:s.midY}),o.push({Type:"rightEyeLeft",X:s.middleLeft.x,Y:s.middleLeft.y}),o.push({Type:"rightEyeRight",X:s.middleRight.x,Y:s.middleRight.y}),o.push({Type:"rightEyeUp",X:s.topMiddle.x,Y:s.topMiddle.y}),o.push({Type:"rightEyeDown",X:s.bottomMiddle.x,Y:s.bottomMiddle.y}));var y=h(t.landmarks.getRightEyeBrow(),d,t.detection.imageDims);0!=y.width&&0!=y.height&&(o.push({Type:"rightEyeBrowLeft",X:y.bottomLeft.x,Y:y.bottomLeft.y}),o.push({Type:"rightEyeBrowRight",X:y.bottomRight.x,Y:y.bottomRight.y}),o.push({Type:"rightEyeBrowUp",X:y.topMiddle.x,Y:y.topMiddle.y}));var p=h(t.landmarks.getNose(),d,t.detection.imageDims);0!=p.width&&0!=p.height&&(o.push({Type:"nose",X:p.midX,Y:p.midY}),o.push({Type:"noseLeft",X:p.bottomLeft.x,Y:p.bottomLeft.y}),o.push({Type:"noseRight",X:p.bottomRight.x,Y:p.bottomRight.y}),o.push({Type:"noseUp",X:p.topMiddle.x,Y:p.topMiddle.y}),o.push({Type:"noseDown",X:p.bottomMiddle.x,Y:p.bottomMiddle.y}));var m=t.landmarks.getJawOutline();if(m.length>0){var g=n(m,-d.angle,d.center),x=r(g,{width:1,height:1}),v={x:Number.MAX_SAFE_INTEGER,y:Number.MAX_SAFE_INTEGER},w={x:0,y:Number.MAX_SAFE_INTEGER},E={x:Number.MAX_SAFE_INTEGER,y:Number.MAX_SAFE_INTEGER},b={x:0,y:Number.MAX_SAFE_INTEGER},L={x:x.midX,y:x.y2};g.forEach((function(t){t.y=0;--i){var o=this.tryEntries[i],a=o.completion;if("root"===o.tryLoc)return n("end");if(o.tryLoc<=this.prev){var h=r.call(o,"catchLoc"),u=r.call(o,"finallyLoc");if(h&&u){if(this.prev=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),E(r),d}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var i=n.arg;E(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:L(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),d}},t}(t.exports);try{regeneratorRuntime=n}catch(t){Function("r","regeneratorRuntime = r")(n)}},65:function(t,e,r){t.exports=r(113)},656:function(t,e,r){t.exports=r(657)},657:function(t,e,r){"use strict";r.r(e);var n=r(65),i=r.n(n);function o(t,e,r,n,i,o,a){try{var h=t[o](a),u=h.value}catch(t){return void r(t)}h.done?e(u):Promise.resolve(u).then(n,i)}function a(t){return function(){var e=this,r=arguments;return new Promise((function(n,i){var a=t.apply(e,r);function h(t){o(a,n,i,h,u,"next",t)}function u(t){o(a,n,i,h,u,"throw",t)}h(void 0)}))}}window.ILABFaceDetector=function(t,e){if("undefined"==typeof faceapi)return null;var r=function(t,e){var r=Number.MAX_SAFE_INTEGER,n=Number.MAX_SAFE_INTEGER,i=0,o=0;return t.forEach((function(t){r=Math.min(r,t.x),i=Math.max(i,t.x),n=Math.min(n,t.y),o=Math.max(o,t.y)})),{x1:r/e.width,x2:i/e.width,y1:n/e.height,y2:o/e.height,midX:(r+(i-r)/2)/e.width,midY:(n+(o-n)/2)/e.height,width:(i-r)/e.width,height:(o-n)/e.height}},n=function(t,e,r){var n=[];return t.forEach((function(t){var i=Math.sin(e),o=Math.cos(e);n.push({x:o*(t.x-r.x)-i*(t.y-r.y)+r.x,y:i*(t.x-r.x)+o*(t.y-r.y)+r.y})})),n},o=function(t,e){return{x:t.x/e.width,y:t.y/e.height}},h=function(t,e,i){var a=n(t,-e.angle,e.center),h=r(a,{width:1,height:1}),u=[{x:h.x1,y:h.y1},{x:h.x2,y:h.y2},{x:h.x1,y:h.y2},{x:h.x2,y:h.y1},{x:h.midX,y:h.y1},{x:h.x2,y:h.midY},{x:h.midX,y:h.y2},{x:h.x1,y:h.midY},{x:h.midX,y:h.midY}];return{x1:(u=n(u,e.angle,e.center))[0].x/i.width,x2:u[1].x/i.width,y1:u[0].y/i.height,y2:u[1].y/i.height,midX:u[2].x/i.width,midY:u[2].y/i.height,width:h.width/i.width,height:h.height/i.height,topLeft:o(u[0],i),bottomRight:o(u[1],i),bottomLeft:o(u[2],i),topRight:o(u[3],i),topMiddle:o(u[4],i),middleRight:o(u[5],i),bottomMiddle:o(u[6],i),middleLeft:o(u[7],i)}},u=function(t){var e=r(t.getLeftEye(),{width:1,height:1}),n=r(t.getRightEye(),{width:1,height:1}),i=Math.max(n.midX,e.midX),o=Math.min(n.midX,e.midX),a=Math.max(n.midY,e.midY),h=o-i,u=Math.min(n.midY,e.midY)-a;return{angle:Math.atan2(n.midY-e.midY,n.midX-e.midX),center:{x:i+h/2,y:a+u/2}}},d=function(){var t=a(i.a.mark((function t(){return i.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",new Promise((function(t){setTimeout((function(){t()}),250)})));case 1:case"end":return t.stop()}}),t)})));return function(){return t.apply(this,arguments)}}(),c=function(){var t=a(i.a.mark((function t(o){var a;return i.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(window.loadedFaceData){t.next=6;break}return console.log("waiting for loaded."),t.next=4,d();case 4:t.next=0;break;case 6:return a=[],t.next=9,faceapi.detectAllFaces(o).withFaceLandmarks();case 9:t.sent.forEach((function(t){var e=t.detection.imageDims,i={Left:t.detection.box.x/e.width,Top:t.detection.box.y/e.height,Width:t.detection.box.width/e.width,Height:t.detection.box.height/e.height},o=[],d=u(t.landmarks);d.center={x:i.Left+i.Width/2,y:i.Top+i.Height/2};var c=h(t.landmarks.getMouth(),d,t.detection.imageDims);0!=c.width&&0!=c.height&&(o.push({Type:"mouthLeft",X:c.middleLeft.x,Y:c.middleLeft.y}),o.push({Type:"mouthRight",X:c.middleRight.x,Y:c.middleRight.y}),o.push({Type:"mouthUp",X:c.topMiddle.x,Y:c.topMiddle.y}),o.push({Type:"mouthDown",X:c.bottomMiddle.x,Y:c.bottomMiddle.y}));var l=h(t.landmarks.getLeftEye(),d,t.detection.imageDims);0!=l.width&&0!=l.height&&(o.push({Type:"eyeLeft",X:l.midX,Y:l.midY}),o.push({Type:"leftEyeLeft",X:l.middleLeft.x,Y:l.middleLeft.y}),o.push({Type:"leftEyeRight",X:l.middleRight.x,Y:l.middleRight.y}),o.push({Type:"leftEyeUp",X:l.topMiddle.x,Y:l.topMiddle.y}),o.push({Type:"leftEyeDown",X:l.bottomMiddle.x,Y:l.bottomMiddle.y}));var f=h(t.landmarks.getLeftEyeBrow(),d,t.detection.imageDims);0!=f.width&&0!=f.height&&(o.push({Type:"leftEyeBrowLeft",X:f.bottomLeft.x,Y:f.bottomLeft.y}),o.push({Type:"leftEyeBrowRight",X:f.bottomRight.x,Y:f.bottomRight.y}),o.push({Type:"leftEyeBrowUp",X:f.topMiddle.x,Y:f.topMiddle.y}));var s=h(t.landmarks.getRightEye(),d,t.detection.imageDims);0!=s.width&&0!=s.height&&(o.push({Type:"eyeRight",X:s.midX,Y:s.midY}),o.push({Type:"rightEyeLeft",X:s.middleLeft.x,Y:s.middleLeft.y}),o.push({Type:"rightEyeRight",X:s.middleRight.x,Y:s.middleRight.y}),o.push({Type:"rightEyeUp",X:s.topMiddle.x,Y:s.topMiddle.y}),o.push({Type:"rightEyeDown",X:s.bottomMiddle.x,Y:s.bottomMiddle.y}));var y=h(t.landmarks.getRightEyeBrow(),d,t.detection.imageDims);0!=y.width&&0!=y.height&&(o.push({Type:"rightEyeBrowLeft",X:y.bottomLeft.x,Y:y.bottomLeft.y}),o.push({Type:"rightEyeBrowRight",X:y.bottomRight.x,Y:y.bottomRight.y}),o.push({Type:"rightEyeBrowUp",X:y.topMiddle.x,Y:y.topMiddle.y}));var p=h(t.landmarks.getNose(),d,t.detection.imageDims);0!=p.width&&0!=p.height&&(o.push({Type:"nose",X:p.midX,Y:p.midY}),o.push({Type:"noseLeft",X:p.bottomLeft.x,Y:p.bottomLeft.y}),o.push({Type:"noseRight",X:p.bottomRight.x,Y:p.bottomRight.y}),o.push({Type:"noseUp",X:p.topMiddle.x,Y:p.topMiddle.y}),o.push({Type:"noseDown",X:p.bottomMiddle.x,Y:p.bottomMiddle.y}));var m=t.landmarks.getJawOutline();if(m.length>0){var g=n(m,-d.angle,d.center),x=r(g,{width:1,height:1}),v={x:Number.MAX_SAFE_INTEGER,y:Number.MAX_SAFE_INTEGER},w={x:0,y:Number.MAX_SAFE_INTEGER},E={x:Number.MAX_SAFE_INTEGER,y:Number.MAX_SAFE_INTEGER},b={x:0,y:Number.MAX_SAFE_INTEGER},L={x:x.midX,y:x.y2};g.forEach((function(t){t.y=0;--n){var i=this.tryEntries[n],a=i.completion;if("root"===i.tryLoc)return o("end");if(i.tryLoc<=this.prev){var l=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(l&&u){if(this.prev=0;--o){var n=this.tryEntries[o];if(n.tryLoc<=this.prev&&r.call(n,"finallyLoc")&&this.prev=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),x(r),c}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var o=r.completion;if("throw"===o.type){var n=o.arg;x(r)}return n}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:L(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),c}},t}(t.exports);try{regeneratorRuntime=o}catch(t){Function("r","regeneratorRuntime = r")(o)}},290:function(t,e,r){t.exports=r(291)},291:function(t,e,r){"use strict";r.r(e);var o=r(4),n=r.n(o);function i(t,e,r,o,n,i,a){try{var l=t[i](a),u=l.value}catch(t){return void r(t)}l.done?e(u):Promise.resolve(u).then(o,n)}function a(t){return function(){var e=this,r=arguments;return new Promise((function(o,n){var a=t.apply(e,r);function l(t){i(a,o,n,l,u,"next",t)}function u(t){i(a,o,n,l,u,"throw",t)}l(void 0)}))}}window.ILABUploadToGoogleStorage=function(t,e,r,o){var i={action:"ilab_upload_prepare",filename:t.name,type:r};o.hasOwnProperty("uploadDirectory")&&(i.directory=o.uploadDirectory),console.log("Getting upload URL ..."),console.time("Getting upload URL"),jQuery.post(ajaxurl,i,(function(i){if("ready"===i.status){console.timeEnd("Getting upload URL"),o.set({state:"uploading"});var l=-1,u=Object.keys(i.sizes),c=[],s=i.key.split("."),h=s.length>2?s.slice(0,s.length-1).join("."):s[0],d=s.length>1?"."+s[s.length-1]:"";d=d.toLowerCase();var p=null,f=null,g=function(e,r){console.log("Initial storage POST ..."),console.time("Initial upload to storage"),jQuery.ajax({url:e,method:"POST",headers:{"x-goog-resumable":"start","Content-Type":t.type},success:function(e,n,i){console.timeEnd("Initial upload to storage");var a=i.getResponseHeader("location");console.log("Actual storage upload ..."),console.time("Upload to storage"),jQuery.ajax({url:a,method:"PUT",processData:!1,crossDomain:!0,data:r,contentType:t.type,xhr:function(){var e=jQuery.ajaxSettings.xhr();return e.upload.onprogress=function(e){if(-1===t.type.indexOf("image/")||1===u.length){var r=e.loaded/e.total*100;o.set({progress:r})}else{var n=100/u.length,i=n*l+e.loaded/e.total*n;o.set({progress:i})}}.bind(this),e},success:function(t){console.timeEnd("Upload to storage"),y()},error:function(t){console.timeEnd("Upload to storage"),o.uploadError()}})},error:function(t){window.hasOwnProperty("mediaCloudDirectUploadError")&&!1!==window.mediaCloudDirectUploadError||(window.mediaCloudDirectUploadError=!0,alert("There was an error uploading this item. The most likely cause is that you don't have CORS configured correctly on your bucket.")),console.timeEnd("Initial upload to storage"),o.uploadError()}})},m=function(t,e){console.log("Upload new key ...");var n={action:"ilab_upload_prepare_next",key:t,type:r};o.hasOwnProperty("uploadDirectory")&&(n.directory=o.uploadDirectory),console.log("Getting new upload URL ..."),console.time("Getting upload URL"),jQuery.post(ajaxurl,n,(function(t){console.timeEnd("Getting upload URL"),t.hasOwnProperty("url")?g(t.url,e):o.uploadError()}))},y=function r(){if(console.log("Upload next size ..."),++l>=u.length||-1===t.type.indexOf("image/")||1===u.length)o.uploadFinished(i.key,e,c);else{var s=u[l];if("full"!==s)if(mediaCloudDirectUploadSettings.generateThumbnails){var y=function(e){var n=i.sizes[s],a=e.bitmap.width,l=e.bitmap.height;if(n.width>a&&n.height>l)r();else{if(console.log("Resizing JPEG file ..."),console.time("Resize JPEG image"),n.crop)e.cover(n.width,n.height,Jimp.HORIZONTAL_ALIGN_CENTER|Jimp.VERTICAL_ALIGN_MIDDLE,Jimp.RESIZE_BEZIER);else{var u=o.sizeToFitSize(a,l,n.width,n.height);e.resize(u[0],u[1],Jimp.RESIZE_BEZIER)}var p=h+"-"+e.bitmap.width+"x"+e.bitmap.height+d;"image/jpeg"!==t.type&&"image/jpg"!==t.type||e.quality(mediaCloudDirectUploadSettings.imageQuality),console.timeEnd("Resize JPEG image"),console.time("Get JPEG buffer"),e.getBuffer(t.type,(function(r,n){if(console.timeEnd("Get JPEG buffer"),null!=r)o.uploadError();else{var i={size:s,key:p,mime:t.type,width:e.bitmap.width,height:e.bitmap.height};c.push(i);var a=new File([n],p,{type:t.type});m(p,a)}}))}},v=function(t){var e=i.sizes[s],n=t.width,a=t.height;if(e.width>n&&e.height>a)r();else if(e.crop){var l=o.sizeToFillSize(n,a,e.width,e.height),u=h+"-"+e.width+"x"+e.height+d,p=document.createElement("canvas");p.width=l[0],p.height=l[1];var f=p.getContext("2d",{alpha:!0});f.imageSmoothingEnabled=!0,f.imageSmoothingQuality="high",f.drawImage(t,0,0,l[0],l[1]);var g=document.createElement("canvas"),y=g.getContext("2d",{alpha:!0});g.width=e.width,g.height=e.height,y.drawImage(p,Math.floor(e.width/2-l[0]/2),Math.floor(e.height/2-l[1]/2)),g.toBlob((function(t){var r={size:s,key:u,mime:"image/png",width:e.width,height:e.height};c.push(r),m(u,t)}),"image/png")}else{var v=o.sizeToFitSize(n,a,e.width,e.height),w=h+"-"+v[0]+"x"+v[1]+d,E=document.createElement("canvas");E.width=v[0],E.height=v[1];var x=E.getContext("2d",{alpha:!0});x.imageSmoothingEnabled=!0,x.imageSmoothingQuality="high",x.drawImage(t,0,0,v[0],v[1]),E.toBlob((function(t){var r={size:s,key:w,mime:"image/png",width:e.width,height:e.height};c.push(r),m(w,t)}),"image/png")}};if("image/png"===t.type)if(null==f){var w=new FileReader;w.onload=function(){(f=new Image).onload=function(){v(f)},f.src=w.result},w.readAsDataURL(t)}else v(f);else if(null==p){console.log("Reading JPEG file ...");var E=new FileReader;console.time("Read JPEG file"),E.onload=a(n.a.mark((function t(){var e;return n.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Jimp.read(E.result);case 2:p=t.sent,console.timeEnd("Read JPEG file"),(p.bitmap.width>2560||p.bitmap.height>2560)&&(console.log("Resizing huge image ..."),console.time("Resizing huge image"),e=o.sizeToFitSize(p.bitmap.width,p.bitmap.height,2560,2560),p.resize(e[0],e[1],Jimp.RESIZE_BEZIER),console.timeEnd("Resizing huge image")),y(p.clone());case 6:case"end":return t.stop()}}),t)}))),E.readAsArrayBuffer(t)}else y(p.clone())}else r();else g(i.url,t)}};-1===t.type.indexOf("image/")||1===u.length?g(i.url,t):y()}else o.uploadError()}))},"undefined"!=typeof DirectUploadItem&&(DirectUploadItem.prototype.uploadToStorage=ILABUploadToGoogleStorage),ilabMediaUploadItem.prototype.uploadToStorage=ILABUploadToGoogleStorage},4:function(t,e,r){t.exports=r(14)}}); \ No newline at end of file +!function(t){var e={};function r(o){if(e[o])return e[o].exports;var n=e[o]={i:o,l:!1,exports:{}};return t[o].call(n.exports,n,n.exports,r),n.l=!0,n.exports}r.m=t,r.c=e,r.d=function(t,e,o){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:o})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var o=Object.create(null);if(r.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var n in t)r.d(o,n,function(e){return t[e]}.bind(null,n));return o},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="/",r(r.s=630)}({113:function(t,e,r){var o=function(t){"use strict";var e=Object.prototype,r=e.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},n=o.iterator||"@@iterator",i=o.asyncIterator||"@@asyncIterator",a=o.toStringTag||"@@toStringTag";function l(t,e,r,o){var n=e&&e.prototype instanceof s?e:s,i=Object.create(n.prototype),a=new b(o||[]);return i._invoke=function(t,e,r){var o="suspendedStart";return function(n,i){if("executing"===o)throw new Error("Generator is already running");if("completed"===o){if("throw"===n)throw i;return S()}for(r.method=n,r.arg=i;;){var a=r.delegate;if(a){var l=w(a,r);if(l){if(l===c)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===o)throw o="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o="executing";var s=u(t,e,r);if("normal"===s.type){if(o=r.done?"completed":"suspendedYield",s.arg===c)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(o="completed",r.method="throw",r.arg=s.arg)}}}(t,r,a),i}function u(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=l;var c={};function s(){}function h(){}function d(){}var p={};p[n]=function(){return this};var f=Object.getPrototypeOf,g=f&&f(f(L([])));g&&g!==e&&r.call(g,n)&&(p=g);var m=d.prototype=s.prototype=Object.create(p);function y(t){["next","throw","return"].forEach((function(e){t[e]=function(t){return this._invoke(e,t)}}))}function v(t,e){var o;this._invoke=function(n,i){function a(){return new e((function(o,a){!function o(n,i,a,l){var c=u(t[n],t,i);if("throw"!==c.type){var s=c.arg,h=s.value;return h&&"object"==typeof h&&r.call(h,"__await")?e.resolve(h.__await).then((function(t){o("next",t,a,l)}),(function(t){o("throw",t,a,l)})):e.resolve(h).then((function(t){s.value=t,a(s)}),(function(t){return o("throw",t,a,l)}))}l(c.arg)}(n,i,o,a)}))}return o=o?o.then(a,a):a()}}function w(t,e){var r=t.iterator[e.method];if(void 0===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,w(t,e),"throw"===e.method))return c;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return c}var o=u(r,t.iterator,e.arg);if("throw"===o.type)return e.method="throw",e.arg=o.arg,e.delegate=null,c;var n=o.arg;return n?n.done?(e[t.resultName]=n.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,c):n:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,c)}function E(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function x(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function b(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(E,this),this.reset(!0)}function L(t){if(t){var e=t[n];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,i=function e(){for(;++o=0;--n){var i=this.tryEntries[n],a=i.completion;if("root"===i.tryLoc)return o("end");if(i.tryLoc<=this.prev){var l=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(l&&u){if(this.prev=0;--o){var n=this.tryEntries[o];if(n.tryLoc<=this.prev&&r.call(n,"finallyLoc")&&this.prev=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),x(r),c}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var o=r.completion;if("throw"===o.type){var n=o.arg;x(r)}return n}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:L(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),c}},t}(t.exports);try{regeneratorRuntime=o}catch(t){Function("r","regeneratorRuntime = r")(o)}},630:function(t,e,r){t.exports=r(631)},631:function(t,e,r){"use strict";r.r(e);var o=r(65),n=r.n(o);function i(t,e,r,o,n,i,a){try{var l=t[i](a),u=l.value}catch(t){return void r(t)}l.done?e(u):Promise.resolve(u).then(o,n)}function a(t){return function(){var e=this,r=arguments;return new Promise((function(o,n){var a=t.apply(e,r);function l(t){i(a,o,n,l,u,"next",t)}function u(t){i(a,o,n,l,u,"throw",t)}l(void 0)}))}}window.ILABUploadToGoogleStorage=function(t,e,r,o){var i={action:"ilab_upload_prepare",filename:t.name,type:r};o.hasOwnProperty("uploadDirectory")&&(i.directory=o.uploadDirectory),console.log("Getting upload URL ..."),console.time("Getting upload URL"),jQuery.post(ajaxurl,i,(function(i){if("ready"===i.status){console.timeEnd("Getting upload URL"),o.set({state:"uploading"});var l=-1,u=Object.keys(i.sizes),c=[],s=i.key.split("."),h=s.length>2?s.slice(0,s.length-1).join("."):s[0],d=s.length>1?"."+s[s.length-1]:"";d=d.toLowerCase();var p=null,f=null,g=function(e,r){console.log("Initial storage POST ..."),console.time("Initial upload to storage"),jQuery.ajax({url:e,method:"POST",headers:{"x-goog-resumable":"start","Content-Type":t.type},success:function(e,n,i){console.timeEnd("Initial upload to storage");var a=i.getResponseHeader("location");console.log("Actual storage upload ..."),console.time("Upload to storage"),jQuery.ajax({url:a,method:"PUT",processData:!1,crossDomain:!0,data:r,contentType:t.type,xhr:function(){var e=jQuery.ajaxSettings.xhr();return e.upload.onprogress=function(e){if(-1===t.type.indexOf("image/")||1===u.length){var r=e.loaded/e.total*100;o.set({progress:r})}else{var n=100/u.length,i=n*l+e.loaded/e.total*n;o.set({progress:i})}}.bind(this),e},success:function(t){console.timeEnd("Upload to storage"),y()},error:function(t){console.timeEnd("Upload to storage"),o.uploadError()}})},error:function(t){window.hasOwnProperty("mediaCloudDirectUploadError")&&!1!==window.mediaCloudDirectUploadError||(window.mediaCloudDirectUploadError=!0,alert("There was an error uploading this item. The most likely cause is that you don't have CORS configured correctly on your bucket.")),console.timeEnd("Initial upload to storage"),o.uploadError()}})},m=function(t,e){console.log("Upload new key ...");var n={action:"ilab_upload_prepare_next",key:t,type:r};o.hasOwnProperty("uploadDirectory")&&(n.directory=o.uploadDirectory),console.log("Getting new upload URL ..."),console.time("Getting upload URL"),jQuery.post(ajaxurl,n,(function(t){console.timeEnd("Getting upload URL"),t.hasOwnProperty("url")?g(t.url,e):o.uploadError()}))},y=function r(){if(console.log("Upload next size ..."),++l>=u.length||-1===t.type.indexOf("image/")||1===u.length)o.uploadFinished(i.key,e,c);else{var s=u[l];if("full"!==s)if(mediaCloudDirectUploadSettings.generateThumbnails){var y=function(e){var n=i.sizes[s],a=e.bitmap.width,l=e.bitmap.height;if(n.width>a&&n.height>l)r();else{if(console.log("Resizing JPEG file ..."),console.time("Resize JPEG image"),n.crop)e.cover(n.width,n.height,Jimp.HORIZONTAL_ALIGN_CENTER|Jimp.VERTICAL_ALIGN_MIDDLE,Jimp.RESIZE_BEZIER);else{var u=o.sizeToFitSize(a,l,n.width,n.height);e.resize(u[0],u[1],Jimp.RESIZE_BEZIER)}var p=h+"-"+e.bitmap.width+"x"+e.bitmap.height+d;"image/jpeg"!==t.type&&"image/jpg"!==t.type||e.quality(mediaCloudDirectUploadSettings.imageQuality),console.timeEnd("Resize JPEG image"),console.time("Get JPEG buffer"),e.getBuffer(t.type,(function(r,n){if(console.timeEnd("Get JPEG buffer"),null!=r)o.uploadError();else{var i={size:s,key:p,mime:t.type,width:e.bitmap.width,height:e.bitmap.height};c.push(i);var a=new File([n],p,{type:t.type});m(p,a)}}))}},v=function(t){var e=i.sizes[s],n=t.width,a=t.height;if(e.width>n&&e.height>a)r();else if(e.crop){var l=o.sizeToFillSize(n,a,e.width,e.height),u=h+"-"+e.width+"x"+e.height+d,p=document.createElement("canvas");p.width=l[0],p.height=l[1];var f=p.getContext("2d",{alpha:!0});f.imageSmoothingEnabled=!0,f.imageSmoothingQuality="high",f.drawImage(t,0,0,l[0],l[1]);var g=document.createElement("canvas"),y=g.getContext("2d",{alpha:!0});g.width=e.width,g.height=e.height,y.drawImage(p,Math.floor(e.width/2-l[0]/2),Math.floor(e.height/2-l[1]/2)),g.toBlob((function(t){var r={size:s,key:u,mime:"image/png",width:e.width,height:e.height};c.push(r),m(u,t)}),"image/png")}else{var v=o.sizeToFitSize(n,a,e.width,e.height),w=h+"-"+v[0]+"x"+v[1]+d,E=document.createElement("canvas");E.width=v[0],E.height=v[1];var x=E.getContext("2d",{alpha:!0});x.imageSmoothingEnabled=!0,x.imageSmoothingQuality="high",x.drawImage(t,0,0,v[0],v[1]),E.toBlob((function(t){var r={size:s,key:w,mime:"image/png",width:e.width,height:e.height};c.push(r),m(w,t)}),"image/png")}};if("image/png"===t.type)if(null==f){var w=new FileReader;w.onload=function(){(f=new Image).onload=function(){v(f)},f.src=w.result},w.readAsDataURL(t)}else v(f);else if(null==p){console.log("Reading JPEG file ...");var E=new FileReader;console.time("Read JPEG file"),E.onload=a(n.a.mark((function t(){var e;return n.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Jimp.read(E.result);case 2:p=t.sent,console.timeEnd("Read JPEG file"),(p.bitmap.width>2560||p.bitmap.height>2560)&&(console.log("Resizing huge image ..."),console.time("Resizing huge image"),e=o.sizeToFitSize(p.bitmap.width,p.bitmap.height,2560,2560),p.resize(e[0],e[1],Jimp.RESIZE_BEZIER),console.timeEnd("Resizing huge image")),y(p.clone());case 6:case"end":return t.stop()}}),t)}))),E.readAsArrayBuffer(t)}else y(p.clone())}else r();else g(i.url,t)}};-1===t.type.indexOf("image/")||1===u.length?g(i.url,t):y()}else o.uploadError()}))},"undefined"!=typeof DirectUploadItem&&(DirectUploadItem.prototype.uploadToStorage=ILABUploadToGoogleStorage),ilabMediaUploadItem.prototype.uploadToStorage=ILABUploadToGoogleStorage},65:function(t,e,r){t.exports=r(113)}}); \ No newline at end of file diff --git a/public/js/ilab-media-direct-upload-other-s3.js b/public/js/ilab-media-direct-upload-other-s3.js index 0e64e919..eb9bd0bb 100755 --- a/public/js/ilab-media-direct-upload-other-s3.js +++ b/public/js/ilab-media-direct-upload-other-s3.js @@ -1 +1 @@ -!function(t){var e={};function r(n){if(e[n])return e[n].exports;var o=e[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)r.d(n,o,function(e){return t[e]}.bind(null,o));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="/",r(r.s=292)}({14:function(t,e,r){var n=function(t){"use strict";var e=Object.prototype,r=e.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},o=n.iterator||"@@iterator",i=n.asyncIterator||"@@asyncIterator",a=n.toStringTag||"@@toStringTag";function u(t,e,r,n){var o=e&&e.prototype instanceof h?e:h,i=Object.create(o.prototype),a=new x(n||[]);return i._invoke=function(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return S()}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var u=w(a,r);if(u){if(u===c)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var h=l(t,e,r);if("normal"===h.type){if(n=r.done?"completed":"suspendedYield",h.arg===c)continue;return{value:h.arg,done:r.done}}"throw"===h.type&&(n="completed",r.method="throw",r.arg=h.arg)}}}(t,r,a),i}function l(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=u;var c={};function h(){}function s(){}function f(){}var d={};d[o]=function(){return this};var p=Object.getPrototypeOf,g=p&&p(p(L([])));g&&g!==e&&r.call(g,o)&&(d=g);var y=f.prototype=h.prototype=Object.create(d);function m(t){["next","throw","return"].forEach((function(e){t[e]=function(t){return this._invoke(e,t)}}))}function v(t,e){var n;this._invoke=function(o,i){function a(){return new e((function(n,a){!function n(o,i,a,u){var c=l(t[o],t,i);if("throw"!==c.type){var h=c.arg,s=h.value;return s&&"object"==typeof s&&r.call(s,"__await")?e.resolve(s.__await).then((function(t){n("next",t,a,u)}),(function(t){n("throw",t,a,u)})):e.resolve(s).then((function(t){h.value=t,a(h)}),(function(t){return n("throw",t,a,u)}))}u(c.arg)}(o,i,n,a)}))}return n=n?n.then(a,a):a()}}function w(t,e){var r=t.iterator[e.method];if(void 0===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,w(t,e),"throw"===e.method))return c;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return c}var n=l(r,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,c;var o=n.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,c):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,c)}function E(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function b(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function x(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(E,this),this.reset(!0)}function L(t){if(t){var e=t[o];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,i=function e(){for(;++n=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var u=r.call(i,"catchLoc"),l=r.call(i,"finallyLoc");if(u&&l){if(this.prev=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),b(r),c}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;b(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:L(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),c}},t}(t.exports);try{regeneratorRuntime=n}catch(t){Function("r","regeneratorRuntime = r")(n)}},292:function(t,e,r){t.exports=r(293)},293:function(t,e,r){"use strict";r.r(e);var n=r(4),o=r.n(n);function i(t,e,r,n,o,i,a){try{var u=t[i](a),l=u.value}catch(t){return void r(t)}u.done?e(l):Promise.resolve(l).then(n,o)}function a(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var a=t.apply(e,r);function u(t){i(a,n,o,u,l,"next",t)}function l(t){i(a,n,o,u,l,"throw",t)}u(void 0)}))}}window.ILABUploadToOtherS3Storage=function(t,e,r,n){var i={action:"ilab_upload_prepare",filename:t.name,type:r};n.hasOwnProperty("uploadDirectory")&&(i.directory=n.uploadDirectory),console.time("Getting upload URL"),jQuery.post(ajaxurl,i,function(i){if("ready"===i.status){console.timeEnd("Getting upload URL"),n.set({state:"uploading"});var u=-1,l=Object.keys(i.sizes),c=[],h=i.key.split("."),s=h.length>2?h.slice(0,h.length-1).join("."):h[0],f=h.length>1?"."+h[h.length-1]:"";f=f.toLowerCase();var d=null,p=null,g=function(t,e){console.time("Upload to storage");var r=new XMLHttpRequest;r.open("PUT",t,!0),r.upload.onprogress=function(t){var e=100/l.length,r=e*u+t.loaded/t.total*e;n.set({progress:r})},r.onload=function(){console.timeEnd("Upload to storage"),m()},r.onerror=function(){window.hasOwnProperty("mediaCloudDirectUploadError")&&!1!==window.mediaCloudDirectUploadError||(window.mediaCloudDirectUploadError=!0,alert("There was an error uploading this item. The most likely cause is that you don't have CORS configured correctly on your bucket.")),console.timeEnd("Upload to storage"),n.uploadError()},r.send(e)},y=function(t,e){var o={action:"ilab_upload_prepare_next",key:t,type:r};n.hasOwnProperty("uploadDirectory")&&(o.directory=n.uploadDirectory),console.time("Getting upload URL"),jQuery.post(ajaxurl,o,(function(t){console.timeEnd("Getting upload URL"),t.hasOwnProperty("url")?g(t.url,e):n.uploadError()}))},m=function r(){if(++u>=l.length||-1===t.type.indexOf("image/")||1===l.length)n.uploadFinished(i.key,e,c);else{var h=l[u];if("full"!==h)if(mediaCloudDirectUploadSettings.generateThumbnails){var m=function(e){console.time("Resize JPEG image");var o=i.sizes[h],a=e.bitmap.width,u=e.bitmap.height;if(o.width>a&&o.height>u)r();else{if(o.crop)e.cover(o.width,o.height,Jimp.HORIZONTAL_ALIGN_CENTER|Jimp.VERTICAL_ALIGN_MIDDLE,Jimp.RESIZE_BEZIER);else{var l=n.sizeToFitSize(a,u,o.width,o.height);e.resize(l[0],l[1],Jimp.RESIZE_BEZIER)}var d=s+"-"+e.bitmap.width+"x"+e.bitmap.height+f;"image/jpeg"!==t.type&&"image/jpg"!==t.type||e.quality(mediaCloudDirectUploadSettings.imageQuality),console.timeEnd("Resize JPEG image"),console.time("Get JPEG buffer"),e.getBuffer(t.type,(function(r,o){if(console.timeEnd("Get JPEG buffer"),null!=r)n.uploadError();else{var i={size:h,key:d,mime:t.type,width:e.bitmap.width,height:e.bitmap.height};c.push(i);var a=new File([o],d,{type:t.type});y(d,a)}}))}},v=function(t){var e=i.sizes[h],o=t.width,a=t.height;if(e.width>o&&e.height>a)r();else if(e.crop){var u=n.sizeToFillSize(o,a,e.width,e.height),l=s+"-"+e.width+"x"+e.height+f,d=document.createElement("canvas");d.width=u[0],d.height=u[1];var p=d.getContext("2d",{alpha:!0});p.imageSmoothingEnabled=!0,p.imageSmoothingQuality="high",p.drawImage(t,0,0,u[0],u[1]);var g=document.createElement("canvas"),m=g.getContext("2d",{alpha:!0});g.width=e.width,g.height=e.height,m.drawImage(d,Math.floor(e.width/2-u[0]/2),Math.floor(e.height/2-u[1]/2)),g.toBlob((function(t){var r={size:h,key:l,mime:"image/png",width:e.width,height:e.height};c.push(r),y(l,t)}),"image/png")}else{var v=n.sizeToFitSize(o,a,e.width,e.height),w=s+"-"+v[0]+"x"+v[1]+f,E=document.createElement("canvas");E.width=v[0],E.height=v[1];var b=E.getContext("2d",{alpha:!0});b.imageSmoothingEnabled=!0,b.imageSmoothingQuality="high",b.drawImage(t,0,0,v[0],v[1]),E.toBlob((function(t){var r={size:h,key:w,mime:"image/png",width:e.width,height:e.height};c.push(r),y(w,t)}),"image/png")}};if("image/png"===t.type)if(null==p){var w=new FileReader;w.onload=function(){(p=new Image).onload=function(){v(p)},p.src=w.result},w.readAsDataURL(t)}else v(p);else if(null==d){var E=new FileReader;E.onload=a(o.a.mark((function t(){return o.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Jimp.read(E.result);case 2:d=t.sent,m(d.clone());case 4:case"end":return t.stop()}}),t)}))),E.readAsArrayBuffer(t)}else m(d.clone())}else r();else g(i.url,t)}};-1===t.type.indexOf("image/")||1===l.length?g(i.url,t):m()}else n.uploadError()}.bind(this))},"undefined"!=typeof DirectUploadItem&&(DirectUploadItem.prototype.uploadToStorage=ILABUploadToOtherS3Storage),ilabMediaUploadItem.prototype.uploadToStorage=ILABUploadToOtherS3Storage},4:function(t,e,r){t.exports=r(14)}}); \ No newline at end of file +!function(t){var e={};function r(n){if(e[n])return e[n].exports;var o=e[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)r.d(n,o,function(e){return t[e]}.bind(null,o));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="/",r(r.s=632)}({113:function(t,e,r){var n=function(t){"use strict";var e=Object.prototype,r=e.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},o=n.iterator||"@@iterator",i=n.asyncIterator||"@@asyncIterator",a=n.toStringTag||"@@toStringTag";function u(t,e,r,n){var o=e&&e.prototype instanceof h?e:h,i=Object.create(o.prototype),a=new x(n||[]);return i._invoke=function(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return S()}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var u=w(a,r);if(u){if(u===c)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var h=l(t,e,r);if("normal"===h.type){if(n=r.done?"completed":"suspendedYield",h.arg===c)continue;return{value:h.arg,done:r.done}}"throw"===h.type&&(n="completed",r.method="throw",r.arg=h.arg)}}}(t,r,a),i}function l(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=u;var c={};function h(){}function s(){}function f(){}var d={};d[o]=function(){return this};var p=Object.getPrototypeOf,g=p&&p(p(L([])));g&&g!==e&&r.call(g,o)&&(d=g);var y=f.prototype=h.prototype=Object.create(d);function m(t){["next","throw","return"].forEach((function(e){t[e]=function(t){return this._invoke(e,t)}}))}function v(t,e){var n;this._invoke=function(o,i){function a(){return new e((function(n,a){!function n(o,i,a,u){var c=l(t[o],t,i);if("throw"!==c.type){var h=c.arg,s=h.value;return s&&"object"==typeof s&&r.call(s,"__await")?e.resolve(s.__await).then((function(t){n("next",t,a,u)}),(function(t){n("throw",t,a,u)})):e.resolve(s).then((function(t){h.value=t,a(h)}),(function(t){return n("throw",t,a,u)}))}u(c.arg)}(o,i,n,a)}))}return n=n?n.then(a,a):a()}}function w(t,e){var r=t.iterator[e.method];if(void 0===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,w(t,e),"throw"===e.method))return c;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return c}var n=l(r,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,c;var o=n.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,c):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,c)}function E(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function b(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function x(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(E,this),this.reset(!0)}function L(t){if(t){var e=t[o];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,i=function e(){for(;++n=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var u=r.call(i,"catchLoc"),l=r.call(i,"finallyLoc");if(u&&l){if(this.prev=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),b(r),c}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;b(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:L(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),c}},t}(t.exports);try{regeneratorRuntime=n}catch(t){Function("r","regeneratorRuntime = r")(n)}},632:function(t,e,r){t.exports=r(633)},633:function(t,e,r){"use strict";r.r(e);var n=r(65),o=r.n(n);function i(t,e,r,n,o,i,a){try{var u=t[i](a),l=u.value}catch(t){return void r(t)}u.done?e(l):Promise.resolve(l).then(n,o)}function a(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var a=t.apply(e,r);function u(t){i(a,n,o,u,l,"next",t)}function l(t){i(a,n,o,u,l,"throw",t)}u(void 0)}))}}window.ILABUploadToOtherS3Storage=function(t,e,r,n){var i={action:"ilab_upload_prepare",filename:t.name,type:r};n.hasOwnProperty("uploadDirectory")&&(i.directory=n.uploadDirectory),console.time("Getting upload URL"),jQuery.post(ajaxurl,i,function(i){if("ready"===i.status){console.timeEnd("Getting upload URL"),n.set({state:"uploading"});var u=-1,l=Object.keys(i.sizes),c=[],h=i.key.split("."),s=h.length>2?h.slice(0,h.length-1).join("."):h[0],f=h.length>1?"."+h[h.length-1]:"";f=f.toLowerCase();var d=null,p=null,g=function(t,e){console.time("Upload to storage");var r=new XMLHttpRequest;r.open("PUT",t,!0),r.upload.onprogress=function(t){var e=100/l.length,r=e*u+t.loaded/t.total*e;n.set({progress:r})},r.onload=function(){console.timeEnd("Upload to storage"),m()},r.onerror=function(){window.hasOwnProperty("mediaCloudDirectUploadError")&&!1!==window.mediaCloudDirectUploadError||(window.mediaCloudDirectUploadError=!0,alert("There was an error uploading this item. The most likely cause is that you don't have CORS configured correctly on your bucket.")),console.timeEnd("Upload to storage"),n.uploadError()},r.send(e)},y=function(t,e){var o={action:"ilab_upload_prepare_next",key:t,type:r};n.hasOwnProperty("uploadDirectory")&&(o.directory=n.uploadDirectory),console.time("Getting upload URL"),jQuery.post(ajaxurl,o,(function(t){console.timeEnd("Getting upload URL"),t.hasOwnProperty("url")?g(t.url,e):n.uploadError()}))},m=function r(){if(++u>=l.length||-1===t.type.indexOf("image/")||1===l.length)n.uploadFinished(i.key,e,c);else{var h=l[u];if("full"!==h)if(mediaCloudDirectUploadSettings.generateThumbnails){var m=function(e){console.time("Resize JPEG image");var o=i.sizes[h],a=e.bitmap.width,u=e.bitmap.height;if(o.width>a&&o.height>u)r();else{if(o.crop)e.cover(o.width,o.height,Jimp.HORIZONTAL_ALIGN_CENTER|Jimp.VERTICAL_ALIGN_MIDDLE,Jimp.RESIZE_BEZIER);else{var l=n.sizeToFitSize(a,u,o.width,o.height);e.resize(l[0],l[1],Jimp.RESIZE_BEZIER)}var d=s+"-"+e.bitmap.width+"x"+e.bitmap.height+f;"image/jpeg"!==t.type&&"image/jpg"!==t.type||e.quality(mediaCloudDirectUploadSettings.imageQuality),console.timeEnd("Resize JPEG image"),console.time("Get JPEG buffer"),e.getBuffer(t.type,(function(r,o){if(console.timeEnd("Get JPEG buffer"),null!=r)n.uploadError();else{var i={size:h,key:d,mime:t.type,width:e.bitmap.width,height:e.bitmap.height};c.push(i);var a=new File([o],d,{type:t.type});y(d,a)}}))}},v=function(t){var e=i.sizes[h],o=t.width,a=t.height;if(e.width>o&&e.height>a)r();else if(e.crop){var u=n.sizeToFillSize(o,a,e.width,e.height),l=s+"-"+e.width+"x"+e.height+f,d=document.createElement("canvas");d.width=u[0],d.height=u[1];var p=d.getContext("2d",{alpha:!0});p.imageSmoothingEnabled=!0,p.imageSmoothingQuality="high",p.drawImage(t,0,0,u[0],u[1]);var g=document.createElement("canvas"),m=g.getContext("2d",{alpha:!0});g.width=e.width,g.height=e.height,m.drawImage(d,Math.floor(e.width/2-u[0]/2),Math.floor(e.height/2-u[1]/2)),g.toBlob((function(t){var r={size:h,key:l,mime:"image/png",width:e.width,height:e.height};c.push(r),y(l,t)}),"image/png")}else{var v=n.sizeToFitSize(o,a,e.width,e.height),w=s+"-"+v[0]+"x"+v[1]+f,E=document.createElement("canvas");E.width=v[0],E.height=v[1];var b=E.getContext("2d",{alpha:!0});b.imageSmoothingEnabled=!0,b.imageSmoothingQuality="high",b.drawImage(t,0,0,v[0],v[1]),E.toBlob((function(t){var r={size:h,key:w,mime:"image/png",width:e.width,height:e.height};c.push(r),y(w,t)}),"image/png")}};if("image/png"===t.type)if(null==p){var w=new FileReader;w.onload=function(){(p=new Image).onload=function(){v(p)},p.src=w.result},w.readAsDataURL(t)}else v(p);else if(null==d){var E=new FileReader;E.onload=a(o.a.mark((function t(){return o.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Jimp.read(E.result);case 2:d=t.sent,m(d.clone());case 4:case"end":return t.stop()}}),t)}))),E.readAsArrayBuffer(t)}else m(d.clone())}else r();else g(i.url,t)}};-1===t.type.indexOf("image/")||1===l.length?g(i.url,t):m()}else n.uploadError()}.bind(this))},"undefined"!=typeof DirectUploadItem&&(DirectUploadItem.prototype.uploadToStorage=ILABUploadToOtherS3Storage),ilabMediaUploadItem.prototype.uploadToStorage=ILABUploadToOtherS3Storage},65:function(t,e,r){t.exports=r(113)}}); \ No newline at end of file diff --git a/public/js/ilab-media-direct-upload-s3.js b/public/js/ilab-media-direct-upload-s3.js index 0a5b3200..f4269b45 100755 --- a/public/js/ilab-media-direct-upload-s3.js +++ b/public/js/ilab-media-direct-upload-s3.js @@ -1 +1 @@ -!function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="/",r(r.s=288)}({14:function(e,t,r){var n=function(e){"use strict";var t=Object.prototype,r=t.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},o=n.iterator||"@@iterator",i=n.asyncIterator||"@@asyncIterator",a=n.toStringTag||"@@toStringTag";function l(e,t,r,n){var o=t&&t.prototype instanceof h?t:h,i=Object.create(o.prototype),a=new b(n||[]);return i._invoke=function(e,t,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return S()}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var l=w(a,r);if(l){if(l===u)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var h=c(e,t,r);if("normal"===h.type){if(n=r.done?"completed":"suspendedYield",h.arg===u)continue;return{value:h.arg,done:r.done}}"throw"===h.type&&(n="completed",r.method="throw",r.arg=h.arg)}}}(e,r,a),i}function c(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=l;var u={};function h(){}function s(){}function p(){}var d={};d[o]=function(){return this};var f=Object.getPrototypeOf,g=f&&f(f(L([])));g&&g!==t&&r.call(g,o)&&(d=g);var m=p.prototype=h.prototype=Object.create(d);function y(e){["next","throw","return"].forEach((function(t){e[t]=function(e){return this._invoke(t,e)}}))}function v(e,t){var n;this._invoke=function(o,i){function a(){return new t((function(n,a){!function n(o,i,a,l){var u=c(e[o],e,i);if("throw"!==u.type){var h=u.arg,s=h.value;return s&&"object"==typeof s&&r.call(s,"__await")?t.resolve(s.__await).then((function(e){n("next",e,a,l)}),(function(e){n("throw",e,a,l)})):t.resolve(s).then((function(e){h.value=e,a(h)}),(function(e){return n("throw",e,a,l)}))}l(u.arg)}(o,i,n,a)}))}return n=n?n.then(a,a):a()}}function w(e,t){var r=e.iterator[t.method];if(void 0===r){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,w(e,t),"throw"===t.method))return u;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return u}var n=c(r,e.iterator,t.arg);if("throw"===n.type)return t.method="throw",t.arg=n.arg,t.delegate=null,u;var o=n.arg;return o?o.done?(t[e.resultName]=o.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,u):o:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,u)}function E(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function x(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function b(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(E,this),this.reset(!0)}function L(e){if(e){var t=e[o];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,i=function t(){for(;++n=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var l=r.call(i,"catchLoc"),c=r.call(i,"finallyLoc");if(l&&c){if(this.prev=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),x(r),u}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;x(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:L(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),u}},e}(e.exports);try{regeneratorRuntime=n}catch(e){Function("r","regeneratorRuntime = r")(n)}},288:function(e,t,r){e.exports=r(289)},289:function(e,t,r){"use strict";r.r(t);var n=r(4),o=r.n(n);function i(e,t,r,n,o,i,a){try{var l=e[i](a),c=l.value}catch(e){return void r(e)}l.done?t(c):Promise.resolve(c).then(n,o)}function a(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var a=e.apply(t,r);function l(e){i(a,n,o,l,c,"next",e)}function c(e){i(a,n,o,l,c,"throw",e)}l(void 0)}))}}window.ILABUploadToS3Storage=function(e,t,r,n){var i={action:"ilab_upload_prepare",filename:e.name,type:r};n.hasOwnProperty("uploadDirectory")&&(i.directory=n.uploadDirectory),console.log("Getting upload URL ..."),console.time("Getting upload URL"),jQuery.post(ajaxurl,i,(function(i){if("ready"==i.status){console.timeEnd("Getting upload URL"),n.set({state:"uploading"});var l=-1,c=Object.keys(i.sizes),u=[],h=i.key.split("."),s=h.length>2?h.slice(0,h.length-1).join("."):h[0],p=h.length>1?"."+h[h.length-1]:"";p=p.toLowerCase();var d=function(t,o){console.log("Upload "+t);var a=new FormData;_.each(Object.keys(i.formData),(function(e){"key"!==e&&a.append(e,i.formData[e])})),null!=i.cacheControl&&i.cacheControl.length>0&&a.append("Cache-Control",i.cacheControl),null!=i.expires&&a.append("Expires",i.expires),a.append("Content-Type",r),a.append("acl",i.acl),a.append("key",t),a.append("file",o),console.time("Upload "+t),jQuery.ajax({url:i.url,method:"POST",contentType:!1,processData:!1,data:a,xhr:function(){var t=jQuery.ajaxSettings.xhr();return t.upload.onprogress=function(t){if(-1===e.type.indexOf("image/")||1===c.length){var r=t.loaded/t.total*100;n.set({progress:r})}else{var o=100/c.length,i=o*l+t.loaded/t.total*o;n.set({progress:i})}}.bind(this),t},success:function(){console.timeEnd("Upload "+t),m()},error:function(e){console.timeEnd("Upload "+t),window.hasOwnProperty("mediaCloudDirectUploadError")&&!1!==window.mediaCloudDirectUploadError||(window.mediaCloudDirectUploadError=!0,alert("There was an error uploading this item. The most likely cause is that you don't have CORS configured correctly on your bucket.")),n.uploadError()}})},f=null,g=null,m=function r(){if(console.log("Upload next size ..."),++l>=c.length||-1===e.type.indexOf("image/")||1===c.length)return console.log("finish upload"),void n.uploadFinished(i.key,t,u);var h=c[l];if("full"!==h)if(mediaCloudDirectUploadSettings.generateThumbnails){var m=function(t){var o=i.sizes[h],a=t.bitmap.width,l=t.bitmap.height;if(o.width>a&&o.height>l)r();else{if(console.log("Resizing JPEG file ..."),console.time("Resize JPEG image"),o.crop)t.cover(o.width,o.height,Jimp.HORIZONTAL_ALIGN_CENTER|Jimp.VERTICAL_ALIGN_MIDDLE,Jimp.RESIZE_BEZIER);else{var c=n.sizeToFitSize(a,l,o.width,o.height);t.resize(c[0],c[1],Jimp.RESIZE_BEZIER)}var f=s+"-"+t.bitmap.width+"x"+t.bitmap.height+p;"image/jpeg"!==e.type&&"image/jpg"!==e.type||t.quality(mediaCloudDirectUploadSettings.imageQuality),console.timeEnd("Resize JPEG image"),console.time("Get JPEG buffer"),t.getBuffer(e.type,(function(r,o){if(console.timeEnd("Get JPEG buffer"),null!=r)n.uploadError();else{var i={size:h,key:f,mime:e.type,width:t.bitmap.width,height:t.bitmap.height};u.push(i);var a=new File([o],f,{type:e.type});d(f,a)}}))}},y=function(e){var t=i.sizes[h],o=e.width,a=e.height;if(t.width>o&&t.height>a)r();else if(t.crop){var l=n.sizeToFillSize(o,a,t.width,t.height),c=s+"-"+t.width+"x"+t.height+p,f=document.createElement("canvas");f.width=l[0],f.height=l[1];var g=f.getContext("2d",{alpha:!0});g.imageSmoothingEnabled=!0,g.imageSmoothingQuality="high",g.drawImage(e,0,0,l[0],l[1]);var m=document.createElement("canvas"),y=m.getContext("2d",{alpha:!0});m.width=t.width,m.height=t.height,y.drawImage(f,Math.floor(t.width/2-l[0]/2),Math.floor(t.height/2-l[1]/2)),m.toBlob((function(e){var r={size:h,key:c,mime:"image/png",width:t.width,height:t.height};u.push(r),d(c,e)}),"image/png")}else{var v=n.sizeToFitSize(o,a,t.width,t.height),w=s+"-"+v[0]+"x"+v[1]+p,E=document.createElement("canvas");E.width=v[0],E.height=v[1];var x=E.getContext("2d",{alpha:!0});x.imageSmoothingEnabled=!0,x.imageSmoothingQuality="high",x.drawImage(e,0,0,v[0],v[1]),E.toBlob((function(e){var r={size:h,key:w,mime:"image/png",width:t.width,height:t.height};u.push(r),d(w,e)}),"image/png")}};if("image/png"===e.type)if(null==g){var v=new FileReader;v.onload=function(){(g=new Image).onload=function(){y(g)},g.src=v.result},v.readAsDataURL(e)}else y(g);else if(null==f){console.log("Reading JPEG file ...");var w=new FileReader;console.time("Read JPEG file"),w.onload=a(o.a.mark((function e(){var t;return o.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Jimp.read(w.result);case 2:f=e.sent,console.timeEnd("Read JPEG file"),(f.bitmap.width>2560||f.bitmap.height>2560)&&(console.log("Resizing huge image ..."),console.time("Resizing huge image"),t=n.sizeToFitSize(f.bitmap.width,f.bitmap.height,2560,2560),f.resize(t[0],t[1],Jimp.RESIZE_BEZIER),console.timeEnd("Resizing huge image")),m(f.clone());case 6:case"end":return e.stop()}}),e)}))),w.readAsArrayBuffer(e)}else m(f.clone())}else r();else d(i.key,e)};-1===e.type.indexOf("image/")||1===c.length?d(i.key,e):m()}else n.uploadError()}))},"undefined"!=typeof DirectUploadItem&&(DirectUploadItem.prototype.uploadToStorage=ILABUploadToS3Storage),ilabMediaUploadItem.prototype.uploadToStorage=ILABUploadToS3Storage},4:function(e,t,r){e.exports=r(14)}}); \ No newline at end of file +!function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="/",r(r.s=628)}({113:function(e,t,r){var n=function(e){"use strict";var t=Object.prototype,r=t.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},o=n.iterator||"@@iterator",i=n.asyncIterator||"@@asyncIterator",a=n.toStringTag||"@@toStringTag";function l(e,t,r,n){var o=t&&t.prototype instanceof h?t:h,i=Object.create(o.prototype),a=new b(n||[]);return i._invoke=function(e,t,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return S()}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var l=w(a,r);if(l){if(l===u)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var h=c(e,t,r);if("normal"===h.type){if(n=r.done?"completed":"suspendedYield",h.arg===u)continue;return{value:h.arg,done:r.done}}"throw"===h.type&&(n="completed",r.method="throw",r.arg=h.arg)}}}(e,r,a),i}function c(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=l;var u={};function h(){}function s(){}function p(){}var d={};d[o]=function(){return this};var f=Object.getPrototypeOf,g=f&&f(f(L([])));g&&g!==t&&r.call(g,o)&&(d=g);var m=p.prototype=h.prototype=Object.create(d);function y(e){["next","throw","return"].forEach((function(t){e[t]=function(e){return this._invoke(t,e)}}))}function v(e,t){var n;this._invoke=function(o,i){function a(){return new t((function(n,a){!function n(o,i,a,l){var u=c(e[o],e,i);if("throw"!==u.type){var h=u.arg,s=h.value;return s&&"object"==typeof s&&r.call(s,"__await")?t.resolve(s.__await).then((function(e){n("next",e,a,l)}),(function(e){n("throw",e,a,l)})):t.resolve(s).then((function(e){h.value=e,a(h)}),(function(e){return n("throw",e,a,l)}))}l(u.arg)}(o,i,n,a)}))}return n=n?n.then(a,a):a()}}function w(e,t){var r=e.iterator[t.method];if(void 0===r){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,w(e,t),"throw"===t.method))return u;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return u}var n=c(r,e.iterator,t.arg);if("throw"===n.type)return t.method="throw",t.arg=n.arg,t.delegate=null,u;var o=n.arg;return o?o.done?(t[e.resultName]=o.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,u):o:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,u)}function E(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function x(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function b(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(E,this),this.reset(!0)}function L(e){if(e){var t=e[o];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,i=function t(){for(;++n=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var l=r.call(i,"catchLoc"),c=r.call(i,"finallyLoc");if(l&&c){if(this.prev=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),x(r),u}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;x(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:L(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),u}},e}(e.exports);try{regeneratorRuntime=n}catch(e){Function("r","regeneratorRuntime = r")(n)}},628:function(e,t,r){e.exports=r(629)},629:function(e,t,r){"use strict";r.r(t);var n=r(65),o=r.n(n);function i(e,t,r,n,o,i,a){try{var l=e[i](a),c=l.value}catch(e){return void r(e)}l.done?t(c):Promise.resolve(c).then(n,o)}function a(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var a=e.apply(t,r);function l(e){i(a,n,o,l,c,"next",e)}function c(e){i(a,n,o,l,c,"throw",e)}l(void 0)}))}}window.ILABUploadToS3Storage=function(e,t,r,n){var i={action:"ilab_upload_prepare",filename:e.name,type:r};n.hasOwnProperty("uploadDirectory")&&(i.directory=n.uploadDirectory),console.log("Getting upload URL ..."),console.time("Getting upload URL"),jQuery.post(ajaxurl,i,(function(i){if("ready"==i.status){console.timeEnd("Getting upload URL"),n.set({state:"uploading"});var l=-1,c=Object.keys(i.sizes),u=[],h=i.key.split("."),s=h.length>2?h.slice(0,h.length-1).join("."):h[0],p=h.length>1?"."+h[h.length-1]:"";p=p.toLowerCase();var d=function(t,o){console.log("Upload "+t);var a=new FormData;_.each(Object.keys(i.formData),(function(e){"key"!==e&&a.append(e,i.formData[e])})),null!=i.cacheControl&&i.cacheControl.length>0&&a.append("Cache-Control",i.cacheControl),null!=i.expires&&a.append("Expires",i.expires),a.append("Content-Type",r),a.append("acl",i.acl),a.append("key",t),a.append("file",o),console.time("Upload "+t),jQuery.ajax({url:i.url,method:"POST",contentType:!1,processData:!1,data:a,xhr:function(){var t=jQuery.ajaxSettings.xhr();return t.upload.onprogress=function(t){if(-1===e.type.indexOf("image/")||1===c.length){var r=t.loaded/t.total*100;n.set({progress:r})}else{var o=100/c.length,i=o*l+t.loaded/t.total*o;n.set({progress:i})}}.bind(this),t},success:function(){console.timeEnd("Upload "+t),m()},error:function(e){console.timeEnd("Upload "+t),window.hasOwnProperty("mediaCloudDirectUploadError")&&!1!==window.mediaCloudDirectUploadError||(window.mediaCloudDirectUploadError=!0,alert("There was an error uploading this item. The most likely cause is that you don't have CORS configured correctly on your bucket.")),n.uploadError()}})},f=null,g=null,m=function r(){if(console.log("Upload next size ..."),++l>=c.length||-1===e.type.indexOf("image/")||1===c.length)return console.log("finish upload"),void n.uploadFinished(i.key,t,u);var h=c[l];if("full"!==h)if(mediaCloudDirectUploadSettings.generateThumbnails){var m=function(t){var o=i.sizes[h],a=t.bitmap.width,l=t.bitmap.height;if(o.width>a&&o.height>l)r();else{if(console.log("Resizing JPEG file ..."),console.time("Resize JPEG image"),o.crop)t.cover(o.width,o.height,Jimp.HORIZONTAL_ALIGN_CENTER|Jimp.VERTICAL_ALIGN_MIDDLE,Jimp.RESIZE_BEZIER);else{var c=n.sizeToFitSize(a,l,o.width,o.height);t.resize(c[0],c[1],Jimp.RESIZE_BEZIER)}var f=s+"-"+t.bitmap.width+"x"+t.bitmap.height+p;"image/jpeg"!==e.type&&"image/jpg"!==e.type||t.quality(mediaCloudDirectUploadSettings.imageQuality),console.timeEnd("Resize JPEG image"),console.time("Get JPEG buffer"),t.getBuffer(e.type,(function(r,o){if(console.timeEnd("Get JPEG buffer"),null!=r)n.uploadError();else{var i={size:h,key:f,mime:e.type,width:t.bitmap.width,height:t.bitmap.height};u.push(i);var a=new File([o],f,{type:e.type});d(f,a)}}))}},y=function(e){var t=i.sizes[h],o=e.width,a=e.height;if(t.width>o&&t.height>a)r();else if(t.crop){var l=n.sizeToFillSize(o,a,t.width,t.height),c=s+"-"+t.width+"x"+t.height+p,f=document.createElement("canvas");f.width=l[0],f.height=l[1];var g=f.getContext("2d",{alpha:!0});g.imageSmoothingEnabled=!0,g.imageSmoothingQuality="high",g.drawImage(e,0,0,l[0],l[1]);var m=document.createElement("canvas"),y=m.getContext("2d",{alpha:!0});m.width=t.width,m.height=t.height,y.drawImage(f,Math.floor(t.width/2-l[0]/2),Math.floor(t.height/2-l[1]/2)),m.toBlob((function(e){var r={size:h,key:c,mime:"image/png",width:t.width,height:t.height};u.push(r),d(c,e)}),"image/png")}else{var v=n.sizeToFitSize(o,a,t.width,t.height),w=s+"-"+v[0]+"x"+v[1]+p,E=document.createElement("canvas");E.width=v[0],E.height=v[1];var x=E.getContext("2d",{alpha:!0});x.imageSmoothingEnabled=!0,x.imageSmoothingQuality="high",x.drawImage(e,0,0,v[0],v[1]),E.toBlob((function(e){var r={size:h,key:w,mime:"image/png",width:t.width,height:t.height};u.push(r),d(w,e)}),"image/png")}};if("image/png"===e.type)if(null==g){var v=new FileReader;v.onload=function(){(g=new Image).onload=function(){y(g)},g.src=v.result},v.readAsDataURL(e)}else y(g);else if(null==f){console.log("Reading JPEG file ...");var w=new FileReader;console.time("Read JPEG file"),w.onload=a(o.a.mark((function e(){var t;return o.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Jimp.read(w.result);case 2:f=e.sent,console.timeEnd("Read JPEG file"),(f.bitmap.width>2560||f.bitmap.height>2560)&&(console.log("Resizing huge image ..."),console.time("Resizing huge image"),t=n.sizeToFitSize(f.bitmap.width,f.bitmap.height,2560,2560),f.resize(t[0],t[1],Jimp.RESIZE_BEZIER),console.timeEnd("Resizing huge image")),m(f.clone());case 6:case"end":return e.stop()}}),e)}))),w.readAsArrayBuffer(e)}else m(f.clone())}else r();else d(i.key,e)};-1===e.type.indexOf("image/")||1===c.length?d(i.key,e):m()}else n.uploadError()}))},"undefined"!=typeof DirectUploadItem&&(DirectUploadItem.prototype.uploadToStorage=ILABUploadToS3Storage),ilabMediaUploadItem.prototype.uploadToStorage=ILABUploadToS3Storage},65:function(e,t,r){e.exports=r(113)}}); \ No newline at end of file diff --git a/public/js/ilab-media-direct-upload.js b/public/js/ilab-media-direct-upload.js index 43a57b05..032f8a62 100755 --- a/public/js/ilab-media-direct-upload.js +++ b/public/js/ilab-media-direct-upload.js @@ -1,17 +1,17 @@ -!function(e){var t={};function r(i){if(t[i])return t[i].exports;var n=t[i]={i:i,l:!1,exports:{}};return e[i].call(n.exports,n,n.exports,r),n.l=!0,n.exports}r.m=e,r.c=t,r.d=function(e,t,i){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(r.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)r.d(i,n,function(t){return e[t]}.bind(null,n));return i},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="/",r(r.s=199)}([,function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=r(6),n=r(38);t.UINT8={len:1,get:(e,t)=>e.readUInt8(t),put(e,t,r){return i.equal(typeof t,"number"),i.equal(typeof r,"number"),i.ok(r>=0&&r<=255),i.ok(t>=0),i.ok(this.len<=e.length),e.writeUInt8(r,t)}},t.UINT16_LE={len:2,get:(e,t)=>e.readUInt16LE(t),put(e,t,r){return i.equal(typeof t,"number"),i.equal(typeof r,"number"),i.ok(r>=0&&r<=65535),i.ok(t>=0),i.ok(this.len<=e.length),e.writeUInt16LE(r,t)}},t.UINT16_BE={len:2,get:(e,t)=>e.readUInt16BE(t),put(e,t,r){return i.equal(typeof t,"number"),i.equal(typeof r,"number"),i.ok(r>=0&&r<=65535),i.ok(t>=0),i.ok(this.len<=e.length),e.writeUInt16BE(r,t)}},t.UINT24_LE={len:3,get:(e,t)=>e.readUIntLE(t,3),put(e,t,r){return i.equal(typeof t,"number"),i.equal(typeof r,"number"),i.ok(r>=0&&r<=16777215),i.ok(t>=0),i.ok(this.len<=e.length),e.writeUIntLE(r,t,3)}},t.UINT24_BE={len:3,get:(e,t)=>e.readUIntBE(t,3),put(e,t,r){return i.equal(typeof t,"number"),i.equal(typeof r,"number"),i.ok(r>=0&&r<=16777215),i.ok(t>=0),i.ok(this.len<=e.length),e.writeUIntBE(r,t,3)}},t.UINT32_LE={len:4,get:(e,t)=>e.readUInt32LE(t),put(e,t,r){return i.equal(typeof t,"number"),i.equal(typeof r,"number"),i.ok(r>=0&&r<=4294967295),i.ok(t>=0),i.ok(this.len<=e.length),e.writeUInt32LE(r,t)}},t.UINT32_BE={len:4,get:(e,t)=>e.readUInt32BE(t),put(e,t,r){return i.equal(typeof t,"number"),i.equal(typeof r,"number"),i.ok(r>=0&&r<=4294967295),i.ok(t>=0),i.ok(this.len<=e.length),e.writeUInt32BE(r,t)}},t.INT8={len:1,get:(e,t)=>e.readInt8(t),put(e,t,r){return i.equal(typeof t,"number"),i.equal(typeof r,"number"),i.ok(r>=-128&&r<=127),i.ok(t>=0),i.ok(this.len<=e.length),e.writeInt8(r,t)}},t.INT16_BE={len:2,get:(e,t)=>e.readInt16BE(t),put(e,t,r){return i.equal(typeof t,"number"),i.equal(typeof r,"number"),i.ok(r>=-32768&&r<=32767),i.ok(t>=0),i.ok(this.len<=e.length),e.writeInt16BE(r,t)}},t.INT16_LE={len:2,get:(e,t)=>e.readInt16LE(t),put(e,t,r){return i.equal(typeof t,"number"),i.equal(typeof r,"number"),i.ok(r>=-32768&&r<=32767),i.ok(t>=0),i.ok(this.len<=e.length),e.writeInt16LE(r,t)}},t.INT24_LE={len:3,get:(e,t)=>e.readIntLE(t,3),put(e,t,r){return i.equal(typeof t,"number"),i.equal(typeof r,"number"),i.ok(r>=-8388608&&r<=8388607),i.ok(t>=0),i.ok(this.len<=e.length),e.writeIntLE(r,t,3)}},t.INT24_BE={len:3,get:(e,t)=>e.readIntBE(t,3),put(e,t,r){return i.equal(typeof t,"number"),i.equal(typeof r,"number"),i.ok(r>=-8388608&&r<=8388607),i.ok(t>=0),i.ok(this.len<=e.length),e.writeIntBE(r,t,3)}},t.INT32_BE={len:4,get:(e,t)=>e.readInt32BE(t),put(e,t,r){return i.equal(typeof t,"number"),i.equal(typeof r,"number"),i.ok(r>=-2147483648&&r<=2147483647),i.ok(t>=0),i.ok(this.len<=e.length),e.writeInt32BE(r,t)}},t.INT32_LE={len:4,get:(e,t)=>e.readInt32LE(t),put(e,t,r){return i.equal(typeof t,"number"),i.equal(typeof r,"number"),i.ok(r>=-2147483648&&r<=2147483647),i.ok(t>=0),i.ok(this.len<=e.length),e.writeInt32LE(r,t)}},t.UINT64_LE={len:8,get(e,t){return function(e,t,r){r>>>=0;let i=e[t>>>=0],n=1,a=0;for(;++a>>=0;let n=1,a=0;e[r>>>=0]=255&t;for(;++a>>=0;let i=e[t>>>=0],n=1,a=0;for(;++a=n&&(i-=Math.pow(2,8*r));return i}(e,t,this.len)},put(e,t,r){return s(e,r,t,this.len)}},t.UINT64_BE={len:8,get(e,t){return o(e,t,this.len)},put(e,t,r){return u(e,r,t,this.len)}},t.INT64_BE={len:8,get(e,t){return l(e,t,this.len)},put(e,t,r){return h(e,r,t,this.len)}},t.Float16_BE={len:2,get(e,t){return n.read(e,t,!1,10,this.len)},put(e,t,r){return n.write(e,r,t,!1,10,this.len)}},t.Float16_LE={len:2,get(e,t){return n.read(e,t,!0,10,this.len)},put(e,t,r){return n.write(e,r,t,!0,10,this.len)}},t.Float32_BE={len:4,get:(e,t)=>e.readFloatBE(t),put:(e,t,r)=>e.writeFloatBE(r,t)},t.Float32_LE={len:4,get:(e,t)=>e.readFloatLE(t),put:(e,t,r)=>e.writeFloatLE(r,t)},t.Float64_BE={len:8,get:(e,t)=>e.readDoubleBE(t),put:(e,t,r)=>e.writeDoubleBE(r,t)},t.Float64_LE={len:8,get:(e,t)=>e.readDoubleLE(t),put:(e,t,r)=>e.writeDoubleLE(r,t)},t.Float80_BE={len:10,get(e,t){return n.read(e,t,!1,63,this.len)},put(e,t,r){return n.write(e,r,t,!1,63,this.len)}},t.Float80_LE={len:10,get(e,t){return n.read(e,t,!0,63,this.len)},put(e,t,r){return n.write(e,r,t,!0,63,this.len)}};t.IgnoreType=class{constructor(e){this.len=e}get(e,t){}};t.BufferType=class{constructor(e){this.len=e}get(e,t){return e.slice(t,t+this.len)}};t.StringType=class{constructor(e,t){this.len=e,this.encoding=t}get(e,t){return e.toString(this.encoding,t,t+this.len)}};class a{constructor(e){this.len=e}static decode(e,t,r){let i="";for(let n=t;n>10),56320+(1023&e)))}static singleByteDecoder(e){if(a.inRange(e,0,127))return e;const t=a.windows1252[e-128];if(null===t)throw Error("invaliding encoding");return t}get(e,t=0){return a.decode(e,t,t+this.len)}}function s(e,t,r,i){t=+t;let n=0,a=1,s=0;for(e[r>>>=0]=255&t;++n>0)-s&255;return r+i}function o(e,t,r){r>>>=0;let i=e[(t>>>=0)+--r],n=1;for(;r>0&&(n*=256);)i+=e[t+--r]*n;return i}function u(e,t,r,i){t=+t;let n=(i>>>=0)-1,a=1;for(e[(r>>>=0)+n]=255&t;--n>=0&&(a*=256);)e[r+n]=t/a&255;return r+i}function l(e,t,r){let i=r>>>=0,n=1,a=e[(t>>>=0)+--i];for(;i>0&&(n*=256);)a+=e[t+--i]*n;return n*=128,a>=n&&(a-=Math.pow(2,8*r)),a}function h(e,t,r,i){t=+t;let n=i-1,a=1,s=0;for(e[(r>>>=0)+n]=255&t;--n>=0&&(a*=256);)t<0&&0===s&&0!==e[r+n+1]&&(s=1),e[r+n]=(t/a>>0)-s&255;return r+i}t.AnsiStringType=a,a.windows1252=[8364,129,8218,402,8222,8230,8224,8225,710,8240,352,8249,338,141,381,143,144,8216,8217,8220,8221,8226,8211,8212,732,8482,353,8250,339,157,382,376,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255],t.writeIntLE=s,t.readUIntBE=o,t.writeUIntBE=u,t.readIntBE=l,t.writeIntBE=h},function(e,t,r){"use strict";(function(e){ +!function(e){var t={};function r(i){if(t[i])return t[i].exports;var n=t[i]={i:i,l:!1,exports:{}};return e[i].call(n.exports,n,n.exports,r),n.l=!0,n.exports}r.m=e,r.c=t,r.d=function(e,t,i){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(r.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)r.d(i,n,function(t){return e[t]}.bind(null,n));return i},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="/",r(r.s=539)}(Array(37).concat([function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=r(70),n=r(342);t.UINT8={len:1,get:(e,t)=>e.readUInt8(t),put(e,t,r){return i.equal(typeof t,"number"),i.equal(typeof r,"number"),i.ok(r>=0&&r<=255),i.ok(t>=0),i.ok(this.len<=e.length),e.writeUInt8(r,t)}},t.UINT16_LE={len:2,get:(e,t)=>e.readUInt16LE(t),put(e,t,r){return i.equal(typeof t,"number"),i.equal(typeof r,"number"),i.ok(r>=0&&r<=65535),i.ok(t>=0),i.ok(this.len<=e.length),e.writeUInt16LE(r,t)}},t.UINT16_BE={len:2,get:(e,t)=>e.readUInt16BE(t),put(e,t,r){return i.equal(typeof t,"number"),i.equal(typeof r,"number"),i.ok(r>=0&&r<=65535),i.ok(t>=0),i.ok(this.len<=e.length),e.writeUInt16BE(r,t)}},t.UINT24_LE={len:3,get:(e,t)=>e.readUIntLE(t,3),put(e,t,r){return i.equal(typeof t,"number"),i.equal(typeof r,"number"),i.ok(r>=0&&r<=16777215),i.ok(t>=0),i.ok(this.len<=e.length),e.writeUIntLE(r,t,3)}},t.UINT24_BE={len:3,get:(e,t)=>e.readUIntBE(t,3),put(e,t,r){return i.equal(typeof t,"number"),i.equal(typeof r,"number"),i.ok(r>=0&&r<=16777215),i.ok(t>=0),i.ok(this.len<=e.length),e.writeUIntBE(r,t,3)}},t.UINT32_LE={len:4,get:(e,t)=>e.readUInt32LE(t),put(e,t,r){return i.equal(typeof t,"number"),i.equal(typeof r,"number"),i.ok(r>=0&&r<=4294967295),i.ok(t>=0),i.ok(this.len<=e.length),e.writeUInt32LE(r,t)}},t.UINT32_BE={len:4,get:(e,t)=>e.readUInt32BE(t),put(e,t,r){return i.equal(typeof t,"number"),i.equal(typeof r,"number"),i.ok(r>=0&&r<=4294967295),i.ok(t>=0),i.ok(this.len<=e.length),e.writeUInt32BE(r,t)}},t.INT8={len:1,get:(e,t)=>e.readInt8(t),put(e,t,r){return i.equal(typeof t,"number"),i.equal(typeof r,"number"),i.ok(r>=-128&&r<=127),i.ok(t>=0),i.ok(this.len<=e.length),e.writeInt8(r,t)}},t.INT16_BE={len:2,get:(e,t)=>e.readInt16BE(t),put(e,t,r){return i.equal(typeof t,"number"),i.equal(typeof r,"number"),i.ok(r>=-32768&&r<=32767),i.ok(t>=0),i.ok(this.len<=e.length),e.writeInt16BE(r,t)}},t.INT16_LE={len:2,get:(e,t)=>e.readInt16LE(t),put(e,t,r){return i.equal(typeof t,"number"),i.equal(typeof r,"number"),i.ok(r>=-32768&&r<=32767),i.ok(t>=0),i.ok(this.len<=e.length),e.writeInt16LE(r,t)}},t.INT24_LE={len:3,get:(e,t)=>e.readIntLE(t,3),put(e,t,r){return i.equal(typeof t,"number"),i.equal(typeof r,"number"),i.ok(r>=-8388608&&r<=8388607),i.ok(t>=0),i.ok(this.len<=e.length),e.writeIntLE(r,t,3)}},t.INT24_BE={len:3,get:(e,t)=>e.readIntBE(t,3),put(e,t,r){return i.equal(typeof t,"number"),i.equal(typeof r,"number"),i.ok(r>=-8388608&&r<=8388607),i.ok(t>=0),i.ok(this.len<=e.length),e.writeIntBE(r,t,3)}},t.INT32_BE={len:4,get:(e,t)=>e.readInt32BE(t),put(e,t,r){return i.equal(typeof t,"number"),i.equal(typeof r,"number"),i.ok(r>=-2147483648&&r<=2147483647),i.ok(t>=0),i.ok(this.len<=e.length),e.writeInt32BE(r,t)}},t.INT32_LE={len:4,get:(e,t)=>e.readInt32LE(t),put(e,t,r){return i.equal(typeof t,"number"),i.equal(typeof r,"number"),i.ok(r>=-2147483648&&r<=2147483647),i.ok(t>=0),i.ok(this.len<=e.length),e.writeInt32LE(r,t)}},t.UINT64_LE={len:8,get(e,t){return function(e,t,r){r>>>=0;let i=e[t>>>=0],n=1,a=0;for(;++a>>=0;let n=1,a=0;e[r>>>=0]=255&t;for(;++a>>=0;let i=e[t>>>=0],n=1,a=0;for(;++a=n&&(i-=Math.pow(2,8*r));return i}(e,t,this.len)},put(e,t,r){return s(e,r,t,this.len)}},t.UINT64_BE={len:8,get(e,t){return o(e,t,this.len)},put(e,t,r){return u(e,r,t,this.len)}},t.INT64_BE={len:8,get(e,t){return l(e,t,this.len)},put(e,t,r){return h(e,r,t,this.len)}},t.Float16_BE={len:2,get(e,t){return n.read(e,t,!1,10,this.len)},put(e,t,r){return n.write(e,r,t,!1,10,this.len)}},t.Float16_LE={len:2,get(e,t){return n.read(e,t,!0,10,this.len)},put(e,t,r){return n.write(e,r,t,!0,10,this.len)}},t.Float32_BE={len:4,get:(e,t)=>e.readFloatBE(t),put:(e,t,r)=>e.writeFloatBE(r,t)},t.Float32_LE={len:4,get:(e,t)=>e.readFloatLE(t),put:(e,t,r)=>e.writeFloatLE(r,t)},t.Float64_BE={len:8,get:(e,t)=>e.readDoubleBE(t),put:(e,t,r)=>e.writeDoubleBE(r,t)},t.Float64_LE={len:8,get:(e,t)=>e.readDoubleLE(t),put:(e,t,r)=>e.writeDoubleLE(r,t)},t.Float80_BE={len:10,get(e,t){return n.read(e,t,!1,63,this.len)},put(e,t,r){return n.write(e,r,t,!1,63,this.len)}},t.Float80_LE={len:10,get(e,t){return n.read(e,t,!0,63,this.len)},put(e,t,r){return n.write(e,r,t,!0,63,this.len)}};t.IgnoreType=class{constructor(e){this.len=e}get(e,t){}};t.BufferType=class{constructor(e){this.len=e}get(e,t){return e.slice(t,t+this.len)}};t.StringType=class{constructor(e,t){this.len=e,this.encoding=t}get(e,t){return e.toString(this.encoding,t,t+this.len)}};class a{constructor(e){this.len=e}static decode(e,t,r){let i="";for(let n=t;n>10),56320+(1023&e)))}static singleByteDecoder(e){if(a.inRange(e,0,127))return e;const t=a.windows1252[e-128];if(null===t)throw Error("invaliding encoding");return t}get(e,t=0){return a.decode(e,t,t+this.len)}}function s(e,t,r,i){t=+t;let n=0,a=1,s=0;for(e[r>>>=0]=255&t;++n>0)-s&255;return r+i}function o(e,t,r){r>>>=0;let i=e[(t>>>=0)+--r],n=1;for(;r>0&&(n*=256);)i+=e[t+--r]*n;return i}function u(e,t,r,i){t=+t;let n=(i>>>=0)-1,a=1;for(e[(r>>>=0)+n]=255&t;--n>=0&&(a*=256);)e[r+n]=t/a&255;return r+i}function l(e,t,r){let i=r>>>=0,n=1,a=e[(t>>>=0)+--i];for(;i>0&&(n*=256);)a+=e[t+--i]*n;return n*=128,a>=n&&(a-=Math.pow(2,8*r)),a}function h(e,t,r,i){t=+t;let n=i-1,a=1,s=0;for(e[(r>>>=0)+n]=255&t;--n>=0&&(a*=256);)t<0&&0===s&&0!==e[r+n+1]&&(s=1),e[r+n]=(t/a>>0)-s&255;return r+i}t.AnsiStringType=a,a.windows1252=[8364,129,8218,402,8222,8230,8224,8225,710,8240,352,8249,338,141,381,143,144,8216,8217,8220,8221,8226,8211,8212,732,8482,353,8250,339,157,382,376,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255],t.writeIntLE=s,t.readUIntBE=o,t.writeUIntBE=u,t.readIntBE=l,t.writeIntBE=h},,,,,,,,,,,,,,function(e,t,r){"use strict";(function(e){ /*! * The buffer module from node.js, for the browser. * * @author Feross Aboukhadijeh * @license MIT */ -var i=r(201),n=r(38),a=r(39);function s(){return u.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function o(e,t){if(s()=s())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s().toString(16)+" bytes");return 0|e}function p(e,t){if(u.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var r=e.length;if(0===r)return 0;for(var i=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return U(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return j(e).length;default:if(i)return U(e).length;t=(""+t).toLowerCase(),i=!0}}function m(e,t,r){var i=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return A(this,t,r);case"utf8":case"utf-8":return x(this,t,r);case"ascii":return I(this,t,r);case"latin1":case"binary":return C(this,t,r);case"base64":return S(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return M(this,t,r);default:if(i)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),i=!0}}function g(e,t,r){var i=e[t];e[t]=e[r],e[r]=i}function b(e,t,r,i,n){if(0===e.length)return-1;if("string"==typeof r?(i=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=n?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(n)return-1;r=e.length-1}else if(r<0){if(!n)return-1;r=0}if("string"==typeof t&&(t=u.from(t,i)),u.isBuffer(t))return 0===t.length?-1:y(e,t,r,i,n);if("number"==typeof t)return t&=255,u.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?n?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):y(e,[t],r,i,n);throw new TypeError("val must be string, number or Buffer")}function y(e,t,r,i,n){var a,s=1,o=e.length,u=t.length;if(void 0!==i&&("ucs2"===(i=String(i).toLowerCase())||"ucs-2"===i||"utf16le"===i||"utf-16le"===i)){if(e.length<2||t.length<2)return-1;s=2,o/=2,u/=2,r/=2}function l(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(n){var h=-1;for(a=r;ao&&(r=o-u),a=r;a>=0;a--){for(var c=!0,f=0;fn&&(i=n):i=n;var a=t.length;if(a%2!=0)throw new TypeError("Invalid hex string");i>a/2&&(i=a/2);for(var s=0;s>8,n=r%256,a.push(n),a.push(i);return a}(t,e.length-r),e,r,i)}function S(e,t,r){return 0===t&&r===e.length?i.fromByteArray(e):i.fromByteArray(e.slice(t,r))}function x(e,t,r){r=Math.min(e.length,r);for(var i=[],n=t;n239?4:l>223?3:l>191?2:1;if(n+c<=r)switch(c){case 1:l<128&&(h=l);break;case 2:128==(192&(a=e[n+1]))&&(u=(31&l)<<6|63&a)>127&&(h=u);break;case 3:a=e[n+1],s=e[n+2],128==(192&a)&&128==(192&s)&&(u=(15&l)<<12|(63&a)<<6|63&s)>2047&&(u<55296||u>57343)&&(h=u);break;case 4:a=e[n+1],s=e[n+2],o=e[n+3],128==(192&a)&&128==(192&s)&&128==(192&o)&&(u=(15&l)<<18|(63&a)<<12|(63&s)<<6|63&o)>65535&&u<1114112&&(h=u)}null===h?(h=65533,c=1):h>65535&&(h-=65536,i.push(h>>>10&1023|55296),h=56320|1023&h),i.push(h),n+=c}return function(e){var t=e.length;if(t<=4096)return String.fromCharCode.apply(String,e);var r="",i=0;for(;i0&&(e=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(e+=" ... ")),""},u.prototype.compare=function(e,t,r,i,n){if(!u.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===i&&(i=0),void 0===n&&(n=this.length),t<0||r>e.length||i<0||n>this.length)throw new RangeError("out of range index");if(i>=n&&t>=r)return 0;if(i>=n)return-1;if(t>=r)return 1;if(this===e)return 0;for(var a=(n>>>=0)-(i>>>=0),s=(r>>>=0)-(t>>>=0),o=Math.min(a,s),l=this.slice(i,n),h=e.slice(t,r),c=0;cn)&&(r=n),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var a=!1;;)switch(i){case"hex":return _(this,e,t,r);case"utf8":case"utf-8":return v(this,e,t,r);case"ascii":return w(this,e,t,r);case"latin1":case"binary":return E(this,e,t,r);case"base64":return k(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return T(this,e,t,r);default:if(a)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),a=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function I(e,t,r){var i="";r=Math.min(e.length,r);for(var n=t;ni)&&(r=i);for(var n="",a=t;ar)throw new RangeError("Trying to access beyond buffer length")}function R(e,t,r,i,n,a){if(!u.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>n||te.length)throw new RangeError("Index out of range")}function B(e,t,r,i){t<0&&(t=65535+t+1);for(var n=0,a=Math.min(e.length-r,2);n>>8*(i?n:1-n)}function O(e,t,r,i){t<0&&(t=4294967295+t+1);for(var n=0,a=Math.min(e.length-r,4);n>>8*(i?n:3-n)&255}function D(e,t,r,i,n,a){if(r+i>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function L(e,t,r,i,a){return a||D(e,0,r,4),n.write(e,t,r,i,23,4),r+4}function F(e,t,r,i,a){return a||D(e,0,r,8),n.write(e,t,r,i,52,8),r+8}u.prototype.slice=function(e,t){var r,i=this.length;if((e=~~e)<0?(e+=i)<0&&(e=0):e>i&&(e=i),(t=void 0===t?i:~~t)<0?(t+=i)<0&&(t=0):t>i&&(t=i),t0&&(n*=256);)i+=this[e+--t]*n;return i},u.prototype.readUInt8=function(e,t){return t||P(e,1,this.length),this[e]},u.prototype.readUInt16LE=function(e,t){return t||P(e,2,this.length),this[e]|this[e+1]<<8},u.prototype.readUInt16BE=function(e,t){return t||P(e,2,this.length),this[e]<<8|this[e+1]},u.prototype.readUInt32LE=function(e,t){return t||P(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},u.prototype.readUInt32BE=function(e,t){return t||P(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},u.prototype.readIntLE=function(e,t,r){e|=0,t|=0,r||P(e,t,this.length);for(var i=this[e],n=1,a=0;++a=(n*=128)&&(i-=Math.pow(2,8*t)),i},u.prototype.readIntBE=function(e,t,r){e|=0,t|=0,r||P(e,t,this.length);for(var i=t,n=1,a=this[e+--i];i>0&&(n*=256);)a+=this[e+--i]*n;return a>=(n*=128)&&(a-=Math.pow(2,8*t)),a},u.prototype.readInt8=function(e,t){return t||P(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},u.prototype.readInt16LE=function(e,t){t||P(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt16BE=function(e,t){t||P(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt32LE=function(e,t){return t||P(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},u.prototype.readInt32BE=function(e,t){return t||P(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},u.prototype.readFloatLE=function(e,t){return t||P(e,4,this.length),n.read(this,e,!0,23,4)},u.prototype.readFloatBE=function(e,t){return t||P(e,4,this.length),n.read(this,e,!1,23,4)},u.prototype.readDoubleLE=function(e,t){return t||P(e,8,this.length),n.read(this,e,!0,52,8)},u.prototype.readDoubleBE=function(e,t){return t||P(e,8,this.length),n.read(this,e,!1,52,8)},u.prototype.writeUIntLE=function(e,t,r,i){(e=+e,t|=0,r|=0,i)||R(this,e,t,r,Math.pow(2,8*r)-1,0);var n=1,a=0;for(this[t]=255&e;++a=0&&(a*=256);)this[t+n]=e/a&255;return t+r},u.prototype.writeUInt8=function(e,t,r){return e=+e,t|=0,r||R(this,e,t,1,255,0),u.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},u.prototype.writeUInt16LE=function(e,t,r){return e=+e,t|=0,r||R(this,e,t,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):B(this,e,t,!0),t+2},u.prototype.writeUInt16BE=function(e,t,r){return e=+e,t|=0,r||R(this,e,t,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):B(this,e,t,!1),t+2},u.prototype.writeUInt32LE=function(e,t,r){return e=+e,t|=0,r||R(this,e,t,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):O(this,e,t,!0),t+4},u.prototype.writeUInt32BE=function(e,t,r){return e=+e,t|=0,r||R(this,e,t,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):O(this,e,t,!1),t+4},u.prototype.writeIntLE=function(e,t,r,i){if(e=+e,t|=0,!i){var n=Math.pow(2,8*r-1);R(this,e,t,r,n-1,-n)}var a=0,s=1,o=0;for(this[t]=255&e;++a>0)-o&255;return t+r},u.prototype.writeIntBE=function(e,t,r,i){if(e=+e,t|=0,!i){var n=Math.pow(2,8*r-1);R(this,e,t,r,n-1,-n)}var a=r-1,s=1,o=0;for(this[t+a]=255&e;--a>=0&&(s*=256);)e<0&&0===o&&0!==this[t+a+1]&&(o=1),this[t+a]=(e/s>>0)-o&255;return t+r},u.prototype.writeInt8=function(e,t,r){return e=+e,t|=0,r||R(this,e,t,1,127,-128),u.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},u.prototype.writeInt16LE=function(e,t,r){return e=+e,t|=0,r||R(this,e,t,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):B(this,e,t,!0),t+2},u.prototype.writeInt16BE=function(e,t,r){return e=+e,t|=0,r||R(this,e,t,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):B(this,e,t,!1),t+2},u.prototype.writeInt32LE=function(e,t,r){return e=+e,t|=0,r||R(this,e,t,4,2147483647,-2147483648),u.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):O(this,e,t,!0),t+4},u.prototype.writeInt32BE=function(e,t,r){return e=+e,t|=0,r||R(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):O(this,e,t,!1),t+4},u.prototype.writeFloatLE=function(e,t,r){return L(this,e,t,!0,r)},u.prototype.writeFloatBE=function(e,t,r){return L(this,e,t,!1,r)},u.prototype.writeDoubleLE=function(e,t,r){return F(this,e,t,!0,r)},u.prototype.writeDoubleBE=function(e,t,r){return F(this,e,t,!1,r)},u.prototype.copy=function(e,t,r,i){if(r||(r=0),i||0===i||(i=this.length),t>=e.length&&(t=e.length),t||(t=0),i>0&&i=this.length)throw new RangeError("sourceStart out of bounds");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),e.length-t=0;--n)e[n+t]=this[n+r];else if(a<1e3||!u.TYPED_ARRAY_SUPPORT)for(n=0;n>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(a=t;a55295&&r<57344){if(!n){if(r>56319){(t-=3)>-1&&a.push(239,191,189);continue}if(s+1===i){(t-=3)>-1&&a.push(239,191,189);continue}n=r;continue}if(r<56320){(t-=3)>-1&&a.push(239,191,189),n=r;continue}r=65536+(n-55296<<10|r-56320)}else n&&(t-=3)>-1&&a.push(239,191,189);if(n=null,r<128){if((t-=1)<0)break;a.push(r)}else if(r<2048){if((t-=2)<0)break;a.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;a.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;a.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return a}function j(e){return i.toByteArray(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(z,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function G(e,t,r,i){for(var n=0;n=t.length||n>=e.length);++n)t[n+r]=e[n];return n}}).call(this,r(10))},function(e,t,r){(function(i){t.log=function(...e){return"object"==typeof console&&console.log&&console.log(...e)},t.formatArgs=function(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const r="color: "+this.color;t.splice(1,0,r,"color: inherit");let i=0,n=0;t[0].replace(/%[a-zA-Z%]/g,e=>{"%%"!==e&&(i++,"%c"===e&&(n=i))}),t.splice(n,0,r)},t.save=function(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch(e){}},t.load=function(){let e;try{e=t.storage.getItem("debug")}catch(e){}!e&&void 0!==i&&"env"in i&&(e=i.env.DEBUG);return e},t.useColors=function(){if("undefined"!=typeof window&&window.process&&("renderer"===window.process.type||window.process.__nwjs))return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},t.storage=function(){try{return localStorage}catch(e){}}(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],e.exports=r(221)(t);const{formatters:n}=e.exports;n.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}).call(this,r(16))},,function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=r(6),n=r(227);class a{static findZero(e,t,r,i){let n=t;if("utf16"===i){for(;0!==e[n]||0!==e[n+1];){if(n>=r)return r;n+=2}return n}for(;0!==e[n];){if(n>=r)return r;n++}return n}static trimRightNull(e){const t=e.indexOf("\0");return-1===t?e:e.substr(0,t)}static swapBytes(e){const t=e.length;i.ok(0==(1&t),"Buffer length must be even");for(let r=0;r>n;const o=8-n,u=i-o;return u<0?s>>=8-n-i:u>0&&(s<<=u,s|=a.getBitAllignedNumber(e,t,r+o,u)),s}static isBitSet(e,t,r){return 1===a.getBitAllignedNumber(e,t,r,1)}static a2hex(e){const t=[];for(let r=0,i=e.length;r0!=(e[t]&1<e.trim().toLowerCase());if(t.length>=1){const e=parseFloat(t[0]);return 2===t.length&&"db"===t[1]?{dB:e,ratio:o(e)}:{dB:s(e),ratio:e}}}},function(e,t,r){"use strict";(function(t){var i=r(208); +var i=r(541),n=r(342),a=r(343);function s(){return u.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function o(e,t){if(s()=s())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s().toString(16)+" bytes");return 0|e}function p(e,t){if(u.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var r=e.length;if(0===r)return 0;for(var i=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return U(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return j(e).length;default:if(i)return U(e).length;t=(""+t).toLowerCase(),i=!0}}function m(e,t,r){var i=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return A(this,t,r);case"utf8":case"utf-8":return x(this,t,r);case"ascii":return I(this,t,r);case"latin1":case"binary":return C(this,t,r);case"base64":return S(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return M(this,t,r);default:if(i)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),i=!0}}function g(e,t,r){var i=e[t];e[t]=e[r],e[r]=i}function b(e,t,r,i,n){if(0===e.length)return-1;if("string"==typeof r?(i=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=n?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(n)return-1;r=e.length-1}else if(r<0){if(!n)return-1;r=0}if("string"==typeof t&&(t=u.from(t,i)),u.isBuffer(t))return 0===t.length?-1:y(e,t,r,i,n);if("number"==typeof t)return t&=255,u.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?n?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):y(e,[t],r,i,n);throw new TypeError("val must be string, number or Buffer")}function y(e,t,r,i,n){var a,s=1,o=e.length,u=t.length;if(void 0!==i&&("ucs2"===(i=String(i).toLowerCase())||"ucs-2"===i||"utf16le"===i||"utf-16le"===i)){if(e.length<2||t.length<2)return-1;s=2,o/=2,u/=2,r/=2}function l(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(n){var h=-1;for(a=r;ao&&(r=o-u),a=r;a>=0;a--){for(var c=!0,f=0;fn&&(i=n):i=n;var a=t.length;if(a%2!=0)throw new TypeError("Invalid hex string");i>a/2&&(i=a/2);for(var s=0;s>8,n=r%256,a.push(n),a.push(i);return a}(t,e.length-r),e,r,i)}function S(e,t,r){return 0===t&&r===e.length?i.fromByteArray(e):i.fromByteArray(e.slice(t,r))}function x(e,t,r){r=Math.min(e.length,r);for(var i=[],n=t;n239?4:l>223?3:l>191?2:1;if(n+c<=r)switch(c){case 1:l<128&&(h=l);break;case 2:128==(192&(a=e[n+1]))&&(u=(31&l)<<6|63&a)>127&&(h=u);break;case 3:a=e[n+1],s=e[n+2],128==(192&a)&&128==(192&s)&&(u=(15&l)<<12|(63&a)<<6|63&s)>2047&&(u<55296||u>57343)&&(h=u);break;case 4:a=e[n+1],s=e[n+2],o=e[n+3],128==(192&a)&&128==(192&s)&&128==(192&o)&&(u=(15&l)<<18|(63&a)<<12|(63&s)<<6|63&o)>65535&&u<1114112&&(h=u)}null===h?(h=65533,c=1):h>65535&&(h-=65536,i.push(h>>>10&1023|55296),h=56320|1023&h),i.push(h),n+=c}return function(e){var t=e.length;if(t<=4096)return String.fromCharCode.apply(String,e);var r="",i=0;for(;i0&&(e=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(e+=" ... ")),""},u.prototype.compare=function(e,t,r,i,n){if(!u.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===i&&(i=0),void 0===n&&(n=this.length),t<0||r>e.length||i<0||n>this.length)throw new RangeError("out of range index");if(i>=n&&t>=r)return 0;if(i>=n)return-1;if(t>=r)return 1;if(this===e)return 0;for(var a=(n>>>=0)-(i>>>=0),s=(r>>>=0)-(t>>>=0),o=Math.min(a,s),l=this.slice(i,n),h=e.slice(t,r),c=0;cn)&&(r=n),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var a=!1;;)switch(i){case"hex":return _(this,e,t,r);case"utf8":case"utf-8":return v(this,e,t,r);case"ascii":return w(this,e,t,r);case"latin1":case"binary":return E(this,e,t,r);case"base64":return k(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return T(this,e,t,r);default:if(a)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),a=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function I(e,t,r){var i="";r=Math.min(e.length,r);for(var n=t;ni)&&(r=i);for(var n="",a=t;ar)throw new RangeError("Trying to access beyond buffer length")}function R(e,t,r,i,n,a){if(!u.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>n||te.length)throw new RangeError("Index out of range")}function B(e,t,r,i){t<0&&(t=65535+t+1);for(var n=0,a=Math.min(e.length-r,2);n>>8*(i?n:1-n)}function O(e,t,r,i){t<0&&(t=4294967295+t+1);for(var n=0,a=Math.min(e.length-r,4);n>>8*(i?n:3-n)&255}function D(e,t,r,i,n,a){if(r+i>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function L(e,t,r,i,a){return a||D(e,0,r,4),n.write(e,t,r,i,23,4),r+4}function F(e,t,r,i,a){return a||D(e,0,r,8),n.write(e,t,r,i,52,8),r+8}u.prototype.slice=function(e,t){var r,i=this.length;if((e=~~e)<0?(e+=i)<0&&(e=0):e>i&&(e=i),(t=void 0===t?i:~~t)<0?(t+=i)<0&&(t=0):t>i&&(t=i),t0&&(n*=256);)i+=this[e+--t]*n;return i},u.prototype.readUInt8=function(e,t){return t||P(e,1,this.length),this[e]},u.prototype.readUInt16LE=function(e,t){return t||P(e,2,this.length),this[e]|this[e+1]<<8},u.prototype.readUInt16BE=function(e,t){return t||P(e,2,this.length),this[e]<<8|this[e+1]},u.prototype.readUInt32LE=function(e,t){return t||P(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},u.prototype.readUInt32BE=function(e,t){return t||P(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},u.prototype.readIntLE=function(e,t,r){e|=0,t|=0,r||P(e,t,this.length);for(var i=this[e],n=1,a=0;++a=(n*=128)&&(i-=Math.pow(2,8*t)),i},u.prototype.readIntBE=function(e,t,r){e|=0,t|=0,r||P(e,t,this.length);for(var i=t,n=1,a=this[e+--i];i>0&&(n*=256);)a+=this[e+--i]*n;return a>=(n*=128)&&(a-=Math.pow(2,8*t)),a},u.prototype.readInt8=function(e,t){return t||P(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},u.prototype.readInt16LE=function(e,t){t||P(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt16BE=function(e,t){t||P(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt32LE=function(e,t){return t||P(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},u.prototype.readInt32BE=function(e,t){return t||P(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},u.prototype.readFloatLE=function(e,t){return t||P(e,4,this.length),n.read(this,e,!0,23,4)},u.prototype.readFloatBE=function(e,t){return t||P(e,4,this.length),n.read(this,e,!1,23,4)},u.prototype.readDoubleLE=function(e,t){return t||P(e,8,this.length),n.read(this,e,!0,52,8)},u.prototype.readDoubleBE=function(e,t){return t||P(e,8,this.length),n.read(this,e,!1,52,8)},u.prototype.writeUIntLE=function(e,t,r,i){(e=+e,t|=0,r|=0,i)||R(this,e,t,r,Math.pow(2,8*r)-1,0);var n=1,a=0;for(this[t]=255&e;++a=0&&(a*=256);)this[t+n]=e/a&255;return t+r},u.prototype.writeUInt8=function(e,t,r){return e=+e,t|=0,r||R(this,e,t,1,255,0),u.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},u.prototype.writeUInt16LE=function(e,t,r){return e=+e,t|=0,r||R(this,e,t,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):B(this,e,t,!0),t+2},u.prototype.writeUInt16BE=function(e,t,r){return e=+e,t|=0,r||R(this,e,t,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):B(this,e,t,!1),t+2},u.prototype.writeUInt32LE=function(e,t,r){return e=+e,t|=0,r||R(this,e,t,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):O(this,e,t,!0),t+4},u.prototype.writeUInt32BE=function(e,t,r){return e=+e,t|=0,r||R(this,e,t,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):O(this,e,t,!1),t+4},u.prototype.writeIntLE=function(e,t,r,i){if(e=+e,t|=0,!i){var n=Math.pow(2,8*r-1);R(this,e,t,r,n-1,-n)}var a=0,s=1,o=0;for(this[t]=255&e;++a>0)-o&255;return t+r},u.prototype.writeIntBE=function(e,t,r,i){if(e=+e,t|=0,!i){var n=Math.pow(2,8*r-1);R(this,e,t,r,n-1,-n)}var a=r-1,s=1,o=0;for(this[t+a]=255&e;--a>=0&&(s*=256);)e<0&&0===o&&0!==this[t+a+1]&&(o=1),this[t+a]=(e/s>>0)-o&255;return t+r},u.prototype.writeInt8=function(e,t,r){return e=+e,t|=0,r||R(this,e,t,1,127,-128),u.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},u.prototype.writeInt16LE=function(e,t,r){return e=+e,t|=0,r||R(this,e,t,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):B(this,e,t,!0),t+2},u.prototype.writeInt16BE=function(e,t,r){return e=+e,t|=0,r||R(this,e,t,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):B(this,e,t,!1),t+2},u.prototype.writeInt32LE=function(e,t,r){return e=+e,t|=0,r||R(this,e,t,4,2147483647,-2147483648),u.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):O(this,e,t,!0),t+4},u.prototype.writeInt32BE=function(e,t,r){return e=+e,t|=0,r||R(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):O(this,e,t,!1),t+4},u.prototype.writeFloatLE=function(e,t,r){return L(this,e,t,!0,r)},u.prototype.writeFloatBE=function(e,t,r){return L(this,e,t,!1,r)},u.prototype.writeDoubleLE=function(e,t,r){return F(this,e,t,!0,r)},u.prototype.writeDoubleBE=function(e,t,r){return F(this,e,t,!1,r)},u.prototype.copy=function(e,t,r,i){if(r||(r=0),i||0===i||(i=this.length),t>=e.length&&(t=e.length),t||(t=0),i>0&&i=this.length)throw new RangeError("sourceStart out of bounds");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),e.length-t=0;--n)e[n+t]=this[n+r];else if(a<1e3||!u.TYPED_ARRAY_SUPPORT)for(n=0;n>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(a=t;a55295&&r<57344){if(!n){if(r>56319){(t-=3)>-1&&a.push(239,191,189);continue}if(s+1===i){(t-=3)>-1&&a.push(239,191,189);continue}n=r;continue}if(r<56320){(t-=3)>-1&&a.push(239,191,189),n=r;continue}r=65536+(n-55296<<10|r-56320)}else n&&(t-=3)>-1&&a.push(239,191,189);if(n=null,r<128){if((t-=1)<0)break;a.push(r)}else if(r<2048){if((t-=2)<0)break;a.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;a.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;a.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return a}function j(e){return i.toByteArray(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(z,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function G(e,t,r,i){for(var n=0;n=t.length||n>=e.length);++n)t[n+r]=e[n];return n}}).call(this,r(88))},function(e,t,r){(function(i){t.log=function(...e){return"object"==typeof console&&console.log&&console.log(...e)},t.formatArgs=function(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const r="color: "+this.color;t.splice(1,0,r,"color: inherit");let i=0,n=0;t[0].replace(/%[a-zA-Z%]/g,e=>{"%%"!==e&&(i++,"%c"===e&&(n=i))}),t.splice(n,0,r)},t.save=function(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch(e){}},t.load=function(){let e;try{e=t.storage.getItem("debug")}catch(e){}!e&&void 0!==i&&"env"in i&&(e=i.env.DEBUG);return e},t.useColors=function(){if("undefined"!=typeof window&&window.process&&("renderer"===window.process.type||window.process.__nwjs))return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},t.storage=function(){try{return localStorage}catch(e){}}(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],e.exports=r(561)(t);const{formatters:n}=e.exports;n.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}).call(this,r(101))},,,,,,,,,,,,,,function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=r(70),n=r(567);class a{static findZero(e,t,r,i){let n=t;if("utf16"===i){for(;0!==e[n]||0!==e[n+1];){if(n>=r)return r;n+=2}return n}for(;0!==e[n];){if(n>=r)return r;n++}return n}static trimRightNull(e){const t=e.indexOf("\0");return-1===t?e:e.substr(0,t)}static swapBytes(e){const t=e.length;i.ok(0==(1&t),"Buffer length must be even");for(let r=0;r>n;const o=8-n,u=i-o;return u<0?s>>=8-n-i:u>0&&(s<<=u,s|=a.getBitAllignedNumber(e,t,r+o,u)),s}static isBitSet(e,t,r){return 1===a.getBitAllignedNumber(e,t,r,1)}static a2hex(e){const t=[];for(let r=0,i=e.length;r0!=(e[t]&1<e.trim().toLowerCase());if(t.length>=1){const e=parseFloat(t[0]);return 2===t.length&&"db"===t[1]?{dB:e,ratio:o(e)}:{dB:s(e),ratio:e}}}},,,,function(e,t,r){"use strict";(function(t){var i=r(548); /*! * The buffer module from node.js, for the browser. * * @author Feross Aboukhadijeh * @license MIT - */function n(e,t){if(e===t)return 0;for(var r=e.length,i=t.length,n=0,a=Math.min(r,i);n=0;l--)if(h[l]!==c[l])return!1;for(l=h.length-1;l>=0;l--)if(o=h[l],!_(e[o],t[o],r,i))return!1;return!0}(e,t,r,i))}return r?e===t:e==t}function v(e){return"[object Arguments]"==Object.prototype.toString.call(e)}function w(e,t){if(!e||!t)return!1;if("[object RegExp]"==Object.prototype.toString.call(t))return t.test(e);try{if(e instanceof t)return!0}catch(e){}return!Error.isPrototypeOf(t)&&!0===t.call({},e)}function E(e,t,r,i){var n;if("function"!=typeof t)throw new TypeError('"block" argument must be a function');"string"==typeof r&&(i=r,r=null),n=function(e){var t;try{e()}catch(e){t=e}return t}(t),i=(r&&r.name?" ("+r.name+").":".")+(i?" "+i:"."),e&&!n&&b(n,r,"Missing expected exception"+i);var a="string"==typeof i,o=!e&&n&&!r;if((!e&&s.isError(n)&&a&&w(n,r)||o)&&b(n,r,"Got unwanted exception"+i),e&&n&&r&&!w(n,r)||!e&&n)throw n}f.AssertionError=function(e){this.name="AssertionError",this.actual=e.actual,this.expected=e.expected,this.operator=e.operator,e.message?(this.message=e.message,this.generatedMessage=!1):(this.message=function(e){return m(g(e.actual),128)+" "+e.operator+" "+m(g(e.expected),128)}(this),this.generatedMessage=!0);var t=e.stackStartFunction||b;if(Error.captureStackTrace)Error.captureStackTrace(this,t);else{var r=new Error;if(r.stack){var i=r.stack,n=p(t),a=i.indexOf("\n"+n);if(a>=0){var s=i.indexOf("\n",a+1);i=i.substring(s+1)}this.stack=i}}},s.inherits(f.AssertionError,Error),f.fail=b,f.ok=y,f.equal=function(e,t,r){e!=t&&b(e,t,r,"==",f.equal)},f.notEqual=function(e,t,r){e==t&&b(e,t,r,"!=",f.notEqual)},f.deepEqual=function(e,t,r){_(e,t,!1)||b(e,t,r,"deepEqual",f.deepEqual)},f.deepStrictEqual=function(e,t,r){_(e,t,!0)||b(e,t,r,"deepStrictEqual",f.deepStrictEqual)},f.notDeepEqual=function(e,t,r){_(e,t,!1)&&b(e,t,r,"notDeepEqual",f.notDeepEqual)},f.notDeepStrictEqual=function e(t,r,i){_(t,r,!0)&&b(t,r,i,"notDeepStrictEqual",e)},f.strictEqual=function(e,t,r){e!==t&&b(e,t,r,"===",f.strictEqual)},f.notStrictEqual=function(e,t,r){e===t&&b(e,t,r,"!==",f.notStrictEqual)},f.throws=function(e,t,r){E(!0,e,t,r)},f.doesNotThrow=function(e,t,r){E(!1,e,t,r)},f.ifError=function(e){if(e)throw e},f.strict=i((function e(t,r){t||b(t,!0,r,"==",e)}),f,{equal:f.strictEqual,deepEqual:f.deepStrictEqual,notEqual:f.notStrictEqual,notDeepEqual:f.notDeepStrictEqual}),f.strict.strict=f.strict;var k=Object.keys||function(e){var t=[];for(var r in e)o.call(e,r)&&t.push(r);return t}}).call(this,r(10))},function(e,t,r){"use strict";(function(e){Object.defineProperty(t,"__esModule",{value:!0});const i=r(5),n=/^[\w-©][\w-\x000-3]/;t.FourCcToken={len:4,get:(e,r)=>{const a=e.toString("binary",r,r+t.FourCcToken.len);if(!a.match(n))throw new Error("FourCC contains invalid characters: "+i.default.a2hex(a));return a},put:(t,r,i)=>{const n=e.from(i,"binary");if(4!==n.length)throw new Error("Invalid length");return n.copy(t,r)}}}).call(this,r(2).Buffer)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.BasicParser=class{init(e,t,r){return this.metadata=e,this.tokenizer=t,this.options=r,this}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=r(6),n=r(24);class a{constructor(e,t){this.tagTypes=e,this.tagMap=t}static parseGenre(e){const t=e.trim().split(/\((.*?)\)/g).filter(e=>""!==e),r=[];for(let e of t)/^\d+$/.test(e)&&!isNaN(parseInt(e,10))&&(e=n.Genres[e]),r.push(e);return r.filter(e=>void 0!==e).join("/")}static fixPictureMimeType(e){switch(i.ok(e,"pictureType should be defined"),e=e.toLocaleLowerCase()){case"image/jpg":return"image/jpeg"}return e}static toIntOrNull(e){const t=parseInt(e,10);return isNaN(t)?null:t}static normalizeTrack(e){const t=e.toString().split("/");return{no:parseInt(t[0],10)||null,of:parseInt(t[1],10)||null}}mapGenericTag(e,t){e={id:e.id,value:e.value},this.postMap(e,t);const r=this.getCommonName(e.id);return r?{id:r,value:e.value}:null}getCommonName(e){return this.tagMap[e]}postMap(e,t){}}t.CommonTagMapper=a,a.maxRatingScore=1},function(e,t){var r;r=function(){return this}();try{r=r||new Function("return this")()}catch(e){"object"==typeof window&&(r=window)}e.exports=r},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=r(206),n=r(215);var a=r(23);t.EndOfStreamError=a.EndOfStreamError,t.fromStream=function(e,t){return new i.ReadStreamTokenizer(e,t)},t.fromBuffer=function(e){return new n.BufferTokenizer(e)}},,function(e,t,r){"use strict";var i=r(25),n=Object.keys||function(e){var t=[];for(var r in e)t.push(r);return t};e.exports=c;var a=Object.create(r(21));a.inherits=r(18);var s=r(44),o=r(34);a.inherits(c,s);for(var u=n(o.prototype),l=0;l1)for(var r=1;r1?e.blocksPerFrame*(e.totalFrames-1):0;return t+=e.finalFrameBlocks,t/e.sampleRate}static async findApeFooterOffset(t,r){const i=e.alloc(l.TagFooter.len);await t.randomRead(i,0,l.TagFooter.len,r-l.TagFooter.len);const n=l.TagFooter.get(i,0);if("APETAGEX"===n.ID)return c("APE footer header at offset="+r),{footer:n,offset:r-n.size}}static parseTagFooter(e,t,r){const i=l.TagFooter.get(t,t.length-l.TagFooter.len);s.strictEqual(i.ID,"APETAGEX","APEv2 Footer preamble"),a.fromBuffer(t);const n=new f;return n.init(e,a.fromBuffer(t),r),n.parseTags(i)}async tryParseApeHeader(){if(this.tokenizer.fileSize&&this.tokenizer.fileSize-this.tokenizer.position0?this.parseDescriptorExpansion(t):this.parseHeader());return await this.tokenizer.ignore(r.forwardBytes),this.tryParseApeHeader()}async parseTags(t){const r=e.alloc(256);let i=t.size-l.TagFooter.len;c(`Parse APE tags at offset=${this.tokenizer.position}, size=${i}`);for(let a=0;a0?this.parseExtendedHeaderData(t,e.size):this.parseId3Data(this.id3Header.size-e.size)}async parseExtendedHeaderData(t,r){const i=e.alloc(t);return await this.tokenizer.readBuffer(i,0,t),this.parseId3Data(this.id3Header.size-r)}async parseId3Data(t){const r=e.alloc(t);await this.tokenizer.readBuffer(r,0,t);for(const e of this.parseMetadata(r))if("TXXX"===e.id)for(const t of e.value.text)this.addTag(o.makeDescriptionTagName(e.id,e.value.description),t);else if("COM"===e.id)for(const t of e.value)this.addTag(o.makeDescriptionTagName(e.id,t.description),t.text);else if(Array.isArray(e.value))for(const t of e.value)this.addTag(e.id,t);else this.addTag(e.id,e.value)}addTag(e,t){this.metadata.addTag(this.headerType,e,t)}parseMetadata(e){let t=0;const r=[];for(;t!==e.length;){const i=o.getFrameHeaderLength(this.id3Header.version.major);if(t+i>e.length){this.metadata.addWarning("Illegal ID3v2 tag length");break}const n=e.slice(t,t+=i),a=o.readFrameHeader(n,this.id3Header.version.major);if(""===a.id||"\0\0\0\0"===a.id||-1==="ABCDEFGHIJKLMNOPQRSTUVWXYZ".indexOf(a.id[0]))break;const s=e.slice(t,t+=a.length),u=o.readFrameData(s,a,this.id3Header.version.major,!this.options.skipCovers);r.push({id:a.id,value:u})}return r}}t.ID3v2Parser=o}).call(this,r(2).Buffer)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=r(1),n=r(5);!function(e){e[e.Other=0]="Other",e[e["32x32 pixels 'file icon' (PNG only)"]=1]="32x32 pixels 'file icon' (PNG only)",e[e["Other file icon"]=2]="Other file icon",e[e["Cover (front)"]=3]="Cover (front)",e[e["Cover (back)"]=4]="Cover (back)",e[e["Leaflet page"]=5]="Leaflet page",e[e["Media (e.g. label side of CD)"]=6]="Media (e.g. label side of CD)",e[e["Lead artist/lead performer/soloist"]=7]="Lead artist/lead performer/soloist",e[e["Artist/performer"]=8]="Artist/performer",e[e.Conductor=9]="Conductor",e[e["Band/Orchestra"]=10]="Band/Orchestra",e[e.Composer=11]="Composer",e[e["Lyricist/text writer"]=12]="Lyricist/text writer",e[e["Recording Location"]=13]="Recording Location",e[e["During recording"]=14]="During recording",e[e["During performance"]=15]="During performance",e[e["Movie/video screen capture"]=16]="Movie/video screen capture",e[e["A bright coloured fish"]=17]="A bright coloured fish",e[e.Illustration=18]="Illustration",e[e["Band/artist logotype"]=19]="Band/artist logotype",e[e["Publisher/Studio logotype"]=20]="Publisher/Studio logotype"}(t.AttachedPictureType||(t.AttachedPictureType={})),t.UINT32SYNCSAFE={get:(e,t)=>127&e[t+3]|e[t+2]<<7|e[t+1]<<14|e[t]<<21,len:4},t.ID3v2Header={len:10,get:(e,r)=>({fileIdentifier:new i.StringType(3,"ascii").get(e,r),version:{major:i.INT8.get(e,r+3),revision:i.INT8.get(e,r+4)},flags:{raw:i.INT8.get(e,r+4),unsynchronisation:n.default.strtokBITSET.get(e,r+5,7),isExtendedHeader:n.default.strtokBITSET.get(e,r+5,6),expIndicator:n.default.strtokBITSET.get(e,r+5,5),footer:n.default.strtokBITSET.get(e,r+5,4)},size:t.UINT32SYNCSAFE.get(e,r+6)})},t.ExtendedHeader={len:10,get:(e,t)=>({size:i.UINT32_BE.get(e,t),extendedFlags:i.UINT16_BE.get(e,t+4),sizeOfPadding:i.UINT32_BE.get(e,t+6),crcDataPresent:n.default.strtokBITSET.get(e,t+4,31)})},t.TextEncodingToken={len:1,get:(e,t)=>{switch(e.readUInt8(t)){case 0:return{encoding:"iso-8859-1"};case 1:return{encoding:"utf16",bom:!0};case 2:return{encoding:"utf16",bom:!1};case 3:default:return{encoding:"utf8",bom:!1}}}}},function(e,t,r){(function(e){function r(e){return Object.prototype.toString.call(e)}t.isArray=function(e){return Array.isArray?Array.isArray(e):"[object Array]"===r(e)},t.isBoolean=function(e){return"boolean"==typeof e},t.isNull=function(e){return null===e},t.isNullOrUndefined=function(e){return null==e},t.isNumber=function(e){return"number"==typeof e},t.isString=function(e){return"string"==typeof e},t.isSymbol=function(e){return"symbol"==typeof e},t.isUndefined=function(e){return void 0===e},t.isRegExp=function(e){return"[object RegExp]"===r(e)},t.isObject=function(e){return"object"==typeof e&&null!==e},t.isDate=function(e){return"[object Date]"===r(e)},t.isError=function(e){return"[object Error]"===r(e)||e instanceof Error},t.isFunction=function(e){return"function"==typeof e},t.isPrimitive=function(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e},t.isBuffer=e.isBuffer}).call(this,r(2).Buffer)},,function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=r(6),n=r(41);var a=r(41);t.EndOfStreamError=a.EndOfStreamError;class s{constructor(){this.promise=new Promise((e,t)=>{this.reject=t,this.resolve=e})}}t.StreamReader=class{constructor(e){if(this.s=e,this.endOfStream=!1,this.peekQueue=[],!e.read||!e.once)throw new Error("Expected an instance of stream.Readable");this.s.once("end",()=>this.reject(new n.EndOfStreamError)),this.s.once("error",e=>this.reject(e)),this.s.once("close",()=>this.reject(new Error("Stream closed")))}async peek(e,t,r){const i=await this.read(e,t,r);return this.peekQueue.push(e.slice(t,t+i)),i}async read(e,t,r){if(0===r)return 0;if(0===this.peekQueue.length&&this.endOfStream)throw new n.EndOfStreamError;let i=r,a=0;for(;this.peekQueue.length>0&&i>0;){const r=this.peekQueue.pop(),n=Math.min(r.length,i);r.copy(e,t+a,0,n),a+=n,i-=n,n0&&!this.endOfStream;){const r=Math.min(i,1048576),n=await this._read(e,t+a,r);if(a+=n,n{this.tryRead()}),this.request.deferred.promise.then(e=>(this.request=null,e),e=>{throw this.request=null,e}))}tryRead(){const e=this.s.read(this.request.length);e?(e.copy(this.request.buffer,this.request.offset),this.request.deferred.resolve(e.length)):this.s.once("readable",()=>{this.tryRead()})}reject(e){this.endOfStream=!0,this.request&&(this.request.deferred.reject(e),this.request=null)}}},function(e,t,r){"use strict";(function(e){Object.defineProperty(t,"__esModule",{value:!0});const i=r(3),n=r(5),a=r(1),s=r(8),o=r(17),u=i("music-metadata:parser:ID3v1");t.Genres=["Blues","Classic Rock","Country","Dance","Disco","Funk","Grunge","Hip-Hop","Jazz","Metal","New Age","Oldies","Other","Pop","R&B","Rap","Reggae","Rock","Techno","Industrial","Alternative","Ska","Death Metal","Pranks","Soundtrack","Euro-Techno","Ambient","Trip-Hop","Vocal","Jazz+Funk","Fusion","Trance","Classical","Instrumental","Acid","House","Game","Sound Clip","Gospel","Noise","Alt. Rock","Bass","Soul","Punk","Space","Meditative","Instrumental Pop","Instrumental Rock","Ethnic","Gothic","Darkwave","Techno-Industrial","Electronic","Pop-Folk","Eurodance","Dream","Southern Rock","Comedy","Cult","Gangsta Rap","Top 40","Christian Rap","Pop/Funk","Jungle","Native American","Cabaret","New Wave","Psychedelic","Rave","Showtunes","Trailer","Lo-Fi","Tribal","Acid Punk","Acid Jazz","Polka","Retro","Musical","Rock & Roll","Hard Rock","Folk","Folk/Rock","National Folk","Swing","Fast-Fusion","Bebob","Latin","Revival","Celtic","Bluegrass","Avantgarde","Gothic Rock","Progressive Rock","Psychedelic Rock","Symphonic Rock","Slow Rock","Big Band","Chorus","Easy Listening","Acoustic","Humour","Speech","Chanson","Opera","Chamber Music","Sonata","Symphony","Booty Bass","Primus","Porn Groove","Satire","Slow Jam","Club","Tango","Samba","Folklore","Ballad","Power Ballad","Rhythmic Soul","Freestyle","Duet","Punk Rock","Drum Solo","A Cappella","Euro-House","Dance Hall","Goa","Drum & Bass","Club-House","Hardcore","Terror","Indie","BritPop","Negerpunk","Polsk Punk","Beat","Christian Gangsta Rap","Heavy Metal","Black Metal","Crossover","Contemporary Christian","Christian Rock","Merengue","Salsa","Thrash Metal","Anime","JPop","Synthpop","Abstract","Art Rock","Baroque","Bhangra","Big Beat","Breakbeat","Chillout","Downtempo","Dub","EBM","Eclectic","Electro","Electroclash","Emo","Experimental","Garage","Global","IDM","Illbient","Industro-Goth","Jam Band","Krautrock","Leftfield","Lounge","Math Rock","New Romantic","Nu-Breakz","Post-Punk","Post-Rock","Psytrance","Shoegaze","Space Rock","Trop Rock","World Music","Neoclassical","Audiobook","Audio Theatre","Neue Deutsche Welle","Podcast","Indie Rock","G-Funk","Dubstep","Garage Rock","Psybient"];const l={len:128,get:(e,t)=>{const r=new h(3).get(e,t);return"TAG"===r?{header:r,title:new h(30).get(e,t+3),artist:new h(30).get(e,t+33),album:new h(30).get(e,t+63),year:new h(4).get(e,t+93),comment:new h(28).get(e,t+97),zeroByte:a.UINT8.get(e,t+127),track:a.UINT8.get(e,t+126),genre:a.UINT8.get(e,t+127)}:null}};class h extends a.StringType{constructor(e){super(e,"binary")}get(e,t){let r=super.get(e,t);return r=n.default.trimRightNull(r),r=r.trim(),r.length>0?r:void 0}}class c extends s.BasicParser{static getGenre(e){if(ee)return void u("Already consumed the last 128 bytes");const t=await this.tokenizer.readToken(l,e);if(t){u("ID3v1 header found at: pos=%s",this.tokenizer.fileSize-l.len);for(const e of["title","artist","album","comment","track","year"])t[e]&&""!==t[e]&&this.addTag(e,t[e]);const e=c.getGenre(t.genre);e&&this.addTag("genre",e)}else u("ID3v1 header not found at: pos=%s",this.tokenizer.fileSize-l.len)}addTag(e,t){this.metadata.addTag("ID3v1",e,t)}}t.ID3v1Parser=c,t.hasID3v1Header=async function(t){if(t.fileSize>=128){const r=e.alloc(3);return await t.randomRead(r,0,r.length,t.fileSize-128),"TAG"===r.toString("binary")}return!1}}).call(this,r(2).Buffer)},function(e,t,r){"use strict";(function(t){void 0===t||!t.version||0===t.version.indexOf("v0.")||0===t.version.indexOf("v1.")&&0!==t.version.indexOf("v1.8.")?e.exports={nextTick:function(e,r,i,n){if("function"!=typeof e)throw new TypeError('"callback" argument must be a function');var a,s,o=arguments.length;switch(o){case 0:case 1:return t.nextTick(e);case 2:return t.nextTick((function(){e.call(null,r)}));case 3:return t.nextTick((function(){e.call(null,r,i)}));case 4:return t.nextTick((function(){e.call(null,r,i,n)}));default:for(a=new Array(o-1),s=0;s0){const t=e.concat(this.pageSegments);this.parseFullPage(t)}this.pageSegments=t.headerType.lastPage?[]:[r]}}t.headerType.lastPage&&this.calculateDuration(t)}flush(){this.parseFullPage(e.concat(this.pageSegments))}parseUserComment(e,t){const r=new a.VorbisDecoder(e,t).parseUserComment();return this.addTag(r.key,r.value),r.len}addTag(e,t){if("METADATA_BLOCK_PICTURE"===e&&"string"==typeof t){if(this.options.skipCovers)return void o("Ignore picture");t=s.VorbisPictureToken.fromBase64(t),o(`Push picture: id=${e}, format=${t.format}`)}else o(`Push tag: id=${e}, value=${t}`);this.metadata.addTag("vorbis",e,t)}parseFirstPage(e,t){this.metadata.setFormat("codec","Vorbis I"),o("Parse first page");const r=s.CommonHeader.get(t,0);if("vorbis"!==r.vorbis)throw new Error("Metadata does not look like Vorbis");if(1!==r.packetType)throw new Error("First Ogg page should be type 1: the identification header");{const e=s.IdentificationHeader.get(t,s.CommonHeader.len);this.metadata.setFormat("sampleRate",e.sampleRate),this.metadata.setFormat("bitrate",e.bitrateNominal),this.metadata.setFormat("numberOfChannels",e.channelMode),o("sample-rate=%s[hz], bitrate=%s[b/s], channel-mode=%s",e.sampleRate,e.bitrateNominal,e.channelMode)}}parseFullPage(e){const t=s.CommonHeader.get(e,0);switch(o("Parse full page: type=%s, byteLength=%s",t.packetType,e.byteLength),t.packetType){case 3:return this.parseUserCommentList(e,s.CommonHeader.len)}}calculateDuration(e){this.metadata.format.sampleRate&&e.absoluteGranulePosition>=0&&(this.metadata.setFormat("numberOfSamples",e.absoluteGranulePosition),this.metadata.setFormat("duration",this.metadata.format.numberOfSamples/this.metadata.format.sampleRate))}parseUserCommentList(e,t){const r=i.UINT32_LE.get(e,t);t+=4,t+=r;let n=i.UINT32_LE.get(e,t);for(t+=4;n-- >0;)t+=this.parseUserComment(e,t)}}}).call(this,r(2).Buffer)},,function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=r(9);class n extends i.CommonTagMapper{constructor(e,t){const r={};for(const e of Object.keys(t))r[e.toUpperCase()]=t[e];super(e,r)}getCommonName(e){return this.tagMap[e.toUpperCase()]}}t.CaseInsensitiveTagMap=n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=r(43);class n extends i.Readable{constructor(e){super(),this.buf=e}_read(){this.push(this.buf),this.push(null)}}t.ID3Stream=n},function(e,t,r){"use strict";var i,n="object"==typeof Reflect?Reflect:null,a=n&&"function"==typeof n.apply?n.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)};i=n&&"function"==typeof n.ownKeys?n.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var s=Number.isNaN||function(e){return e!=e};function o(){o.init.call(this)}e.exports=o,o.EventEmitter=o,o.prototype._events=void 0,o.prototype._eventsCount=0,o.prototype._maxListeners=void 0;var u=10;function l(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function h(e){return void 0===e._maxListeners?o.defaultMaxListeners:e._maxListeners}function c(e,t,r,i){var n,a,s,o;if(l(r),void 0===(a=e._events)?(a=e._events=Object.create(null),e._eventsCount=0):(void 0!==a.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),a=e._events),s=a[t]),void 0===s)s=a[t]=r,++e._eventsCount;else if("function"==typeof s?s=a[t]=i?[r,s]:[s,r]:i?s.unshift(r):s.push(r),(n=h(e))>0&&s.length>n&&!s.warned){s.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=e,u.type=t,u.count=s.length,o=u,console&&console.warn&&console.warn(o)}return e}function f(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function d(e,t,r){var i={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},n=f.bind(i);return n.listener=r,i.wrapFn=n,n}function p(e,t,r){var i=e._events;if(void 0===i)return[];var n=i[t];return void 0===n?[]:"function"==typeof n?r?[n.listener||n]:[n]:r?function(e){for(var t=new Array(e.length),r=0;r0&&(s=t[0]),s instanceof Error)throw s;var o=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw o.context=s,o}var u=n[e];if(void 0===u)return!1;if("function"==typeof u)a(u,this,t);else{var l=u.length,h=g(u,l);for(r=0;r=0;a--)if(r[a]===t||r[a].listener===t){s=r[a].listener,n=a;break}if(n<0)return this;0===n?r.shift():function(e,t){for(;t+1=0;i--)this.removeListener(e,t[i]);return this},o.prototype.listeners=function(e){return p(this,e,!0)},o.prototype.rawListeners=function(e){return p(this,e,!1)},o.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):m.call(e,t)},o.prototype.listenerCount=m,o.prototype.eventNames=function(){return this._eventsCount>0?i(this._events):[]}},function(e,t,r){(t=e.exports=r(44)).Stream=t,t.Readable=t,t.Writable=r(34),t.Duplex=r(13),t.Transform=r(48),t.PassThrough=r(246)},function(e,t,r){var i=r(2),n=i.Buffer;function a(e,t){for(var r in e)t[r]=e[r]}function s(e,t,r){return n(e,t,r)}n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow?e.exports=i:(a(i,t),t.Buffer=s),a(n,s),s.from=function(e,t,r){if("number"==typeof e)throw new TypeError("Argument must not be a number");return n(e,t,r)},s.alloc=function(e,t,r){if("number"!=typeof e)throw new TypeError("Argument must be a number");var i=n(e);return void 0!==t?"string"==typeof r?i.fill(t,r):i.fill(t):i.fill(0),i},s.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return n(e)},s.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return i.SlowBuffer(e)}},function(e,t,r){"use strict";(function(t){var i=r(25);function n(e){var t=this;this.next=null,this.entry=null,this.finish=function(){!function(e,t,r){var i=e.entry;e.entry=null;for(;i;){var n=i.callback;t.pendingcb--,n(r),i=i.next}t.corkedRequestsFree?t.corkedRequestsFree.next=e:t.corkedRequestsFree=e}(t,e)}}e.exports=g;var a,s=i.nextTick;g.WritableState=m;var o=Object.create(r(21));o.inherits=r(18);var u={deprecate:r(244)},l=r(45),h=r(33).Buffer,c=t.Uint8Array||function(){};var f,d=r(46);function p(){}function m(e,t){a=a||r(13),e=e||{};var o=t instanceof a;this.objectMode=!!e.objectMode,o&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var u=e.highWaterMark,l=e.writableHighWaterMark,h=this.objectMode?16:16384;this.highWaterMark=u||0===u?u:o&&(l||0===l)?l:h,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var c=!1===e.decodeStrings;this.decodeStrings=!c,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){!function(e,t){var r=e._writableState,n=r.sync,a=r.writecb;if(function(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}(r),t)!function(e,t,r,n,a){--t.pendingcb,r?(i.nextTick(a,n),i.nextTick(E,e,t),e._writableState.errorEmitted=!0,e.emit("error",n)):(a(n),e._writableState.errorEmitted=!0,e.emit("error",n),E(e,t))}(e,r,n,t,a);else{var o=v(r);o||r.corked||r.bufferProcessing||!r.bufferedRequest||_(e,r),n?s(y,e,r,o,a):y(e,r,o,a)}}(t,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new n(this)}function g(e){if(a=a||r(13),!(f.call(g,this)||this instanceof a))return new g(e);this._writableState=new m(e,this),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),l.call(this)}function b(e,t,r,i,n,a,s){t.writelen=i,t.writecb=s,t.writing=!0,t.sync=!0,r?e._writev(n,t.onwrite):e._write(n,a,t.onwrite),t.sync=!1}function y(e,t,r,i){r||function(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}(e,t),t.pendingcb--,i(),E(e,t)}function _(e,t){t.bufferProcessing=!0;var r=t.bufferedRequest;if(e._writev&&r&&r.next){var i=t.bufferedRequestCount,a=new Array(i),s=t.corkedRequestsFree;s.entry=r;for(var o=0,u=!0;r;)a[o]=r,r.isBuf||(u=!1),r=r.next,o+=1;a.allBuffers=u,b(e,t,!0,t.length,a,"",s.finish),t.pendingcb++,t.lastBufferedRequest=null,s.next?(t.corkedRequestsFree=s.next,s.next=null):t.corkedRequestsFree=new n(t),t.bufferedRequestCount=0}else{for(;r;){var l=r.chunk,h=r.encoding,c=r.callback;if(b(e,t,!1,t.objectMode?1:l.length,l,h,c),r=r.next,t.bufferedRequestCount--,t.writing)break}null===r&&(t.lastBufferedRequest=null)}t.bufferedRequest=r,t.bufferProcessing=!1}function v(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function w(e,t){e._final((function(r){t.pendingcb--,r&&e.emit("error",r),t.prefinished=!0,e.emit("prefinish"),E(e,t)}))}function E(e,t){var r=v(t);return r&&(!function(e,t){t.prefinished||t.finalCalled||("function"==typeof e._final?(t.pendingcb++,t.finalCalled=!0,i.nextTick(w,e,t)):(t.prefinished=!0,e.emit("prefinish")))}(e,t),0===t.pendingcb&&(t.finished=!0,e.emit("finish"))),r}o.inherits(g,l),m.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(m.prototype,"buffer",{get:u.deprecate((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(e){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(f=Function.prototype[Symbol.hasInstance],Object.defineProperty(g,Symbol.hasInstance,{value:function(e){return!!f.call(this,e)||this===g&&(e&&e._writableState instanceof m)}})):f=function(e){return e instanceof this},g.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},g.prototype.write=function(e,t,r){var n,a=this._writableState,s=!1,o=!a.objectMode&&(n=e,h.isBuffer(n)||n instanceof c);return o&&!h.isBuffer(e)&&(e=function(e){return h.from(e)}(e)),"function"==typeof t&&(r=t,t=null),o?t="buffer":t||(t=a.defaultEncoding),"function"!=typeof r&&(r=p),a.ended?function(e,t){var r=new Error("write after end");e.emit("error",r),i.nextTick(t,r)}(this,r):(o||function(e,t,r,n){var a=!0,s=!1;return null===r?s=new TypeError("May not write null values to stream"):"string"==typeof r||void 0===r||t.objectMode||(s=new TypeError("Invalid non-string/buffer chunk")),s&&(e.emit("error",s),i.nextTick(n,s),a=!1),a}(this,a,e,r))&&(a.pendingcb++,s=function(e,t,r,i,n,a){if(!r){var s=function(e,t,r){e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=h.from(t,r));return t}(t,i,n);i!==s&&(r=!0,n="buffer",i=s)}var o=t.objectMode?1:i.length;t.length+=o;var u=t.length-1))throw new TypeError("Unknown encoding: "+e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(g.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),g.prototype._write=function(e,t,r){r(new Error("_write() is not implemented"))},g.prototype._writev=null,g.prototype.end=function(e,t,r){var n=this._writableState;"function"==typeof e?(r=e,e=null,t=null):"function"==typeof t&&(r=t,t=null),null!=e&&this.write(e,t),n.corked&&(n.corked=1,this.uncork()),n.ending||n.finished||function(e,t,r){t.ending=!0,E(e,t),r&&(t.finished?i.nextTick(r):e.once("finish",r));t.ended=!0,e.writable=!1}(this,n,r)},Object.defineProperty(g.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),g.prototype.destroy=d.destroy,g.prototype._undestroy=d.undestroy,g.prototype._destroy=function(e,t){this.end(),t(e)}}).call(this,r(10))},,,,function(e,t){t.read=function(e,t,r,i,n){var a,s,o=8*n-i-1,u=(1<>1,h=-7,c=r?n-1:0,f=r?-1:1,d=e[t+c];for(c+=f,a=d&(1<<-h)-1,d>>=-h,h+=o;h>0;a=256*a+e[t+c],c+=f,h-=8);for(s=a&(1<<-h)-1,a>>=-h,h+=i;h>0;s=256*s+e[t+c],c+=f,h-=8);if(0===a)a=1-l;else{if(a===u)return s?NaN:1/0*(d?-1:1);s+=Math.pow(2,i),a-=l}return(d?-1:1)*s*Math.pow(2,a-i)},t.write=function(e,t,r,i,n,a){var s,o,u,l=8*a-n-1,h=(1<>1,f=23===n?Math.pow(2,-24)-Math.pow(2,-77):0,d=i?0:a-1,p=i?1:-1,m=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(o=isNaN(t)?1:0,s=h):(s=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-s))<1&&(s--,u*=2),(t+=s+c>=1?f/u:f*Math.pow(2,1-c))*u>=2&&(s++,u/=2),s+c>=h?(o=0,s=h):s+c>=1?(o=(t*u-1)*Math.pow(2,n),s+=c):(o=t*Math.pow(2,c-1)*Math.pow(2,n),s=0));n>=8;e[r+d]=255&o,d+=p,o/=256,n-=8);for(s=s<0;e[r+d]=255&s,d+=p,s/=256,l-=8);e[r+d-p]|=128*m}},function(e,t){var r={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==r.call(e)}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=r(11),n=r(216),a=r(283),s=r(17),o=r(24),u=r(284);function l(e,t,r){return!e.fileSize&&r&&r.fileSize&&(e.fileSize=r.fileSize),n.ParserFactory.parseOnContentType(e,t,r)}async function h(e,t={}){let r=e.fileSize;if(await o.hasID3v1Header(e)){r-=128;r-=await u.getLyricsHeaderLength(e)}t.apeHeader=await s.APEv2Parser.findApeFooterOffset(e,r)}t.parseStream=function(e,t,r={}){return l(i.fromStream(e),t,r)},t.parseBuffer=async function(e,t,r={}){const n=new a.RandomBufferReader(e);return await h(n,r),l(i.fromBuffer(e),t,r)},t.parseFromTokenizer=l,t.orderTags=function(e){const t={};for(const r of e)(t[r.id]=t[r.id]||[]).push(r.value);return t},t.ratingToStars=function(e){return void 0===e?0:1+Math.round(4*e)},t.scanAppendingHeaders=h},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.defaultMessages="End-Of-Stream";class i extends Error{constructor(){super(t.defaultMessages)}}t.EndOfStreamError=i},function(module,exports,__webpack_require__){"use strict";(function(Buffer){const{multiByteIndexOf:multiByteIndexOf,stringToBytes:stringToBytes,readUInt64LE:readUInt64LE,tarHeaderChecksumMatches:tarHeaderChecksumMatches,uint8ArrayUtf8ByteString:uint8ArrayUtf8ByteString}=__webpack_require__(217),supported=__webpack_require__(218),xpiZipFilename=stringToBytes("META-INF/mozilla.rsa"),oxmlContentTypes=stringToBytes("[Content_Types].xml"),oxmlRels=stringToBytes("_rels/.rels"),fileType=e=>{if(!(e instanceof Uint8Array||e instanceof ArrayBuffer||Buffer.isBuffer(e)))throw new TypeError(`Expected the \`input\` argument to be of type \`Uint8Array\` or \`Buffer\` or \`ArrayBuffer\`, got \`${typeof e}\``);const t=e instanceof Uint8Array?e:new Uint8Array(e);if(!(t&&t.length>1))return;const r=(e,r)=>{r={offset:0,...r};for(let i=0;ir(stringToBytes(e),t);if(r([255,216,255]))return{ext:"jpg",mime:"image/jpeg"};if(r([137,80,78,71,13,10,26,10])){const e=33,r=t.findIndex((r,i)=>i>=e&&73===t[i]&&68===t[i+1]&&65===t[i+2]&&84===t[i+3]),i=t.subarray(e,r);return i.findIndex((e,t)=>97===i[t]&&99===i[t+1]&&84===i[t+2]&&76===i[t+3])>=0?{ext:"apng",mime:"image/apng"}:{ext:"png",mime:"image/png"}}if(r([71,73,70]))return{ext:"gif",mime:"image/gif"};if(r([87,69,66,80],{offset:8}))return{ext:"webp",mime:"image/webp"};if(r([70,76,73,70]))return{ext:"flif",mime:"image/flif"};if((r([73,73,42,0])||r([77,77,0,42]))&&r([67,82],{offset:8}))return{ext:"cr2",mime:"image/x-canon-cr2"};if(r([73,73,82,79,8,0,0,0,24]))return{ext:"orf",mime:"image/x-olympus-orf"};if(r([73,73,42,0])&&(r([16,251,134,1],{offset:4})||r([8,0,0,0],{offset:4}))&&r([0,254,0,4,0,1,0,0,0,1,0,0,0,3,1],{offset:9}))return{ext:"arw",mime:"image/x-sony-arw"};if(r([73,73,42,0,8,0,0,0])&&(r([45,0,254,0],{offset:8})||r([39,0,254,0],{offset:8})))return{ext:"dng",mime:"image/x-adobe-dng"};if(r([73,73,42,0])&&r([28,0,254,0],{offset:8}))return{ext:"nef",mime:"image/x-nikon-nef"};if(r([73,73,85,0,24,0,0,0,136,231,116,216]))return{ext:"rw2",mime:"image/x-panasonic-rw2"};if(i("FUJIFILMCCD-RAW"))return{ext:"raf",mime:"image/x-fujifilm-raf"};if(r([73,73,42,0])||r([77,77,0,42]))return{ext:"tif",mime:"image/tiff"};if(r([66,77]))return{ext:"bmp",mime:"image/bmp"};if(r([73,73,188]))return{ext:"jxr",mime:"image/vnd.ms-photo"};if(r([56,66,80,83]))return{ext:"psd",mime:"image/vnd.adobe.photoshop"};const n=[80,75,3,4];if(r(n)){if(r([109,105,109,101,116,121,112,101,97,112,112,108,105,99,97,116,105,111,110,47,101,112,117,98,43,122,105,112],{offset:30}))return{ext:"epub",mime:"application/epub+zip"};if(r(xpiZipFilename,{offset:30}))return{ext:"xpi",mime:"application/x-xpinstall"};if(i("mimetypeapplication/vnd.oasis.opendocument.text",{offset:30}))return{ext:"odt",mime:"application/vnd.oasis.opendocument.text"};if(i("mimetypeapplication/vnd.oasis.opendocument.spreadsheet",{offset:30}))return{ext:"ods",mime:"application/vnd.oasis.opendocument.spreadsheet"};if(i("mimetypeapplication/vnd.oasis.opendocument.presentation",{offset:30}))return{ext:"odp",mime:"application/vnd.oasis.opendocument.presentation"};let e,a=0,s=!1;do{const o=a+30;if(s||(s=r(oxmlContentTypes,{offset:o})||r(oxmlRels,{offset:o})),e||(i("word/",{offset:o})?e={ext:"docx",mime:"application/vnd.openxmlformats-officedocument.wordprocessingml.document"}:i("ppt/",{offset:o})?e={ext:"pptx",mime:"application/vnd.openxmlformats-officedocument.presentationml.presentation"}:i("xl/",{offset:o})&&(e={ext:"xlsx",mime:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"})),s&&e)return e;a=multiByteIndexOf(t,n,o)}while(a>=0);if(e)return e}if(r([80,75])&&(3===t[2]||5===t[2]||7===t[2])&&(4===t[3]||6===t[3]||8===t[3]))return{ext:"zip",mime:"application/zip"};if(r([48,48,48,48,48,48],{offset:148,mask:[248,248,248,248,248,248]})&&tarHeaderChecksumMatches(t))return{ext:"tar",mime:"application/x-tar"};if(r([82,97,114,33,26,7])&&(0===t[6]||1===t[6]))return{ext:"rar",mime:"application/x-rar-compressed"};if(r([31,139,8]))return{ext:"gz",mime:"application/gzip"};if(r([66,90,104]))return{ext:"bz2",mime:"application/x-bzip2"};if(r([55,122,188,175,39,28]))return{ext:"7z",mime:"application/x-7z-compressed"};if(r([120,1]))return{ext:"dmg",mime:"application/x-apple-diskimage"};if(r([102,114,101,101],{offset:4})||r([109,100,97,116],{offset:4})||r([109,111,111,118],{offset:4})||r([119,105,100,101],{offset:4}))return{ext:"mov",mime:"video/quicktime"};if(i("ftyp",{offset:4})&&0!=(96&t[8])){const e=uint8ArrayUtf8ByteString(t,8,12).replace("\0"," ").trim();switch(e){case"mif1":return{ext:"heic",mime:"image/heif"};case"msf1":return{ext:"heic",mime:"image/heif-sequence"};case"heic":case"heix":return{ext:"heic",mime:"image/heic"};case"hevc":case"hevx":return{ext:"heic",mime:"image/heic-sequence"};case"qt":return{ext:"mov",mime:"video/quicktime"};case"M4V":case"M4VH":case"M4VP":return{ext:"m4v",mime:"video/x-m4v"};case"M4P":return{ext:"m4p",mime:"video/mp4"};case"M4B":return{ext:"m4b",mime:"audio/mp4"};case"M4A":return{ext:"m4a",mime:"audio/x-m4a"};case"F4V":return{ext:"f4v",mime:"video/mp4"};case"F4P":return{ext:"f4p",mime:"video/mp4"};case"F4A":return{ext:"f4a",mime:"audio/mp4"};case"F4B":return{ext:"f4b",mime:"audio/mp4"};default:return e.startsWith("3g")?e.startsWith("3g2")?{ext:"3g2",mime:"video/3gpp2"}:{ext:"3gp",mime:"video/3gpp"}:{ext:"mp4",mime:"video/mp4"}}}if(r([77,84,104,100]))return{ext:"mid",mime:"audio/midi"};if(r([26,69,223,163])){const e=t.subarray(4,4100),r=e.findIndex((e,t,r)=>66===r[t]&&130===r[t+1]);if(-1!==r){const t=r+3,i=r=>[...r].every((r,i)=>e[t+i]===r.charCodeAt(0));if(i("matroska"))return{ext:"mkv",mime:"video/x-matroska"};if(i("webm"))return{ext:"webm",mime:"video/webm"}}}if(r([82,73,70,70])){if(r([65,86,73],{offset:8}))return{ext:"avi",mime:"video/vnd.avi"};if(r([87,65,86,69],{offset:8}))return{ext:"wav",mime:"audio/vnd.wave"};if(r([81,76,67,77],{offset:8}))return{ext:"qcp",mime:"audio/qcelp"}}if(r([48,38,178,117,142,102,207,17,166,217])){let e=30;do{const i=readUInt64LE(t,e+16);if(r([145,7,220,183,183,169,207,17,142,230,0,192,12,32,83,101],{offset:e})){if(r([64,158,105,248,77,91,207,17,168,253,0,128,95,92,68,43],{offset:e+24}))return{ext:"wma",mime:"audio/x-ms-wma"};if(r([192,239,25,188,77,91,207,17,168,253,0,128,95,92,68,43],{offset:e+24}))return{ext:"wmv",mime:"video/x-ms-asf"};break}e+=i}while(e+24<=t.length);return{ext:"asf",mime:"application/vnd.ms-asf"}}if(r([0,0,1,186])||r([0,0,1,179]))return{ext:"mpg",mime:"video/mpeg"};for(let e=0;e<2&&enew Promise((resolve,reject)=>{const stream=eval("require")("stream");readableStream.on("error",reject),readableStream.once("readable",()=>{const e=new stream.PassThrough,t=readableStream.read(module.exports.minimumBytes)||readableStream.read();try{e.fileType=fileType(t)}catch(e){reject(e)}readableStream.unshift(t),stream.pipeline?resolve(stream.pipeline(readableStream,e,()=>{})):resolve(readableStream.pipe(e))})}),Object.defineProperty(fileType,"extensions",{get:()=>new Set(supported.extensions)}),Object.defineProperty(fileType,"mimeTypes",{get:()=>new Set(supported.mimeTypes)})}).call(this,__webpack_require__(2).Buffer)},function(e,t,r){e.exports=n;var i=r(31).EventEmitter;function n(){i.call(this)}r(18)(n,i),n.Readable=r(32),n.Writable=r(247),n.Duplex=r(248),n.Transform=r(249),n.PassThrough=r(250),n.Stream=n,n.prototype.pipe=function(e,t){var r=this;function n(t){e.writable&&!1===e.write(t)&&r.pause&&r.pause()}function a(){r.readable&&r.resume&&r.resume()}r.on("data",n),e.on("drain",a),e._isStdio||t&&!1===t.end||(r.on("end",o),r.on("close",u));var s=!1;function o(){s||(s=!0,e.end())}function u(){s||(s=!0,"function"==typeof e.destroy&&e.destroy())}function l(e){if(h(),0===i.listenerCount(this,"error"))throw e}function h(){r.removeListener("data",n),e.removeListener("drain",a),r.removeListener("end",o),r.removeListener("close",u),r.removeListener("error",l),e.removeListener("error",l),r.removeListener("end",h),r.removeListener("close",h),e.removeListener("close",h)}return r.on("error",l),e.on("error",l),r.on("end",h),r.on("close",h),e.on("close",h),e.emit("pipe",r),e}},function(e,t,r){"use strict";(function(t,i){var n=r(25);e.exports=_;var a,s=r(39);_.ReadableState=y;r(31).EventEmitter;var o=function(e,t){return e.listeners(t).length},u=r(45),l=r(33).Buffer,h=t.Uint8Array||function(){};var c=Object.create(r(21));c.inherits=r(18);var f=r(241),d=void 0;d=f&&f.debuglog?f.debuglog("stream"):function(){};var p,m=r(242),g=r(46);c.inherits(_,u);var b=["error","close","destroy","pause","resume"];function y(e,t){e=e||{};var i=t instanceof(a=a||r(13));this.objectMode=!!e.objectMode,i&&(this.objectMode=this.objectMode||!!e.readableObjectMode);var n=e.highWaterMark,s=e.readableHighWaterMark,o=this.objectMode?16:16384;this.highWaterMark=n||0===n?n:i&&(s||0===s)?s:o,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new m,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(p||(p=r(47).StringDecoder),this.decoder=new p(e.encoding),this.encoding=e.encoding)}function _(e){if(a=a||r(13),!(this instanceof _))return new _(e);this._readableState=new y(e,this),this.readable=!0,e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy)),u.call(this)}function v(e,t,r,i,n){var a,s=e._readableState;null===t?(s.reading=!1,function(e,t){if(t.ended)return;if(t.decoder){var r=t.decoder.end();r&&r.length&&(t.buffer.push(r),t.length+=t.objectMode?1:r.length)}t.ended=!0,k(e)}(e,s)):(n||(a=function(e,t){var r;i=t,l.isBuffer(i)||i instanceof h||"string"==typeof t||void 0===t||e.objectMode||(r=new TypeError("Invalid non-string/buffer chunk"));var i;return r}(s,t)),a?e.emit("error",a):s.objectMode||t&&t.length>0?("string"==typeof t||s.objectMode||Object.getPrototypeOf(t)===l.prototype||(t=function(e){return l.from(e)}(t)),i?s.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):w(e,s,t,!0):s.ended?e.emit("error",new Error("stream.push() after EOF")):(s.reading=!1,s.decoder&&!r?(t=s.decoder.write(t),s.objectMode||0!==t.length?w(e,s,t,!1):S(e,s)):w(e,s,t,!1))):i||(s.reading=!1));return function(e){return!e.ended&&(e.needReadable||e.lengtht.highWaterMark&&(t.highWaterMark=function(e){return e>=8388608?e=8388608:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function k(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(d("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?n.nextTick(T,e):T(e))}function T(e){d("emit readable"),e.emit("readable"),A(e)}function S(e,t){t.readingMore||(t.readingMore=!0,n.nextTick(x,e,t))}function x(e,t){for(var r=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=t.length?(r=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):r=function(e,t,r){var i;ea.length?a.length:e;if(s===a.length?n+=a:n+=a.slice(0,e),0===(e-=s)){s===a.length?(++i,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=a.slice(s));break}++i}return t.length-=i,n}(e,t):function(e,t){var r=l.allocUnsafe(e),i=t.head,n=1;i.data.copy(r),e-=i.data.length;for(;i=i.next;){var a=i.data,s=e>a.length?a.length:e;if(a.copy(r,r.length-e,0,s),0===(e-=s)){s===a.length?(++n,i.next?t.head=i.next:t.head=t.tail=null):(t.head=i,i.data=a.slice(s));break}++n}return t.length-=n,r}(e,t);return i}(e,t.buffer,t.decoder),r);var r}function P(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,n.nextTick(R,t,e))}function R(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function B(e,t){for(var r=0,i=e.length;r=t.highWaterMark||t.ended))return d("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?P(this):k(this),null;if(0===(e=E(e,t))&&t.ended)return 0===t.length&&P(this),null;var i,n=t.needReadable;return d("need readable",n),(0===t.length||t.length-e0?M(e,t):null)?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),r!==e&&t.ended&&P(this)),null!==i&&this.emit("data",i),i},_.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))},_.prototype.pipe=function(e,t){var r=this,a=this._readableState;switch(a.pipesCount){case 0:a.pipes=e;break;case 1:a.pipes=[a.pipes,e];break;default:a.pipes.push(e)}a.pipesCount+=1,d("pipe count=%d opts=%j",a.pipesCount,t);var u=(!t||!1!==t.end)&&e!==i.stdout&&e!==i.stderr?h:_;function l(t,i){d("onunpipe"),t===r&&i&&!1===i.hasUnpiped&&(i.hasUnpiped=!0,d("cleanup"),e.removeListener("close",b),e.removeListener("finish",y),e.removeListener("drain",c),e.removeListener("error",g),e.removeListener("unpipe",l),r.removeListener("end",h),r.removeListener("end",_),r.removeListener("data",m),f=!0,!a.awaitDrain||e._writableState&&!e._writableState.needDrain||c())}function h(){d("onend"),e.end()}a.endEmitted?n.nextTick(u):r.once("end",u),e.on("unpipe",l);var c=function(e){return function(){var t=e._readableState;d("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&o(e,"data")&&(t.flowing=!0,A(e))}}(r);e.on("drain",c);var f=!1;var p=!1;function m(t){d("ondata"),p=!1,!1!==e.write(t)||p||((1===a.pipesCount&&a.pipes===e||a.pipesCount>1&&-1!==B(a.pipes,e))&&!f&&(d("false write response, pause",r._readableState.awaitDrain),r._readableState.awaitDrain++,p=!0),r.pause())}function g(t){d("onerror",t),_(),e.removeListener("error",g),0===o(e,"error")&&e.emit("error",t)}function b(){e.removeListener("finish",y),_()}function y(){d("onfinish"),e.removeListener("close",b),_()}function _(){d("unpipe"),r.unpipe(e)}return r.on("data",m),function(e,t,r){if("function"==typeof e.prependListener)return e.prependListener(t,r);e._events&&e._events[t]?s(e._events[t])?e._events[t].unshift(r):e._events[t]=[r,e._events[t]]:e.on(t,r)}(e,"error",g),e.once("close",b),e.once("finish",y),e.emit("pipe",r),a.flowing||(d("pipe resume"),r.resume()),e},_.prototype.unpipe=function(e){var t=this._readableState,r={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes||(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,r)),this;if(!e){var i=t.pipes,n=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var a=0;a>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function o(e){var t=this.lastTotal-this.lastNeed,r=function(e,t,r){if(128!=(192&t[0]))return e.lastNeed=0,"�";if(e.lastNeed>1&&t.length>1){if(128!=(192&t[1]))return e.lastNeed=1,"�";if(e.lastNeed>2&&t.length>2&&128!=(192&t[2]))return e.lastNeed=2,"�"}}(this,e);return void 0!==r?r:this.lastNeed<=e.length?(e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(e.copy(this.lastChar,t,0,e.length),void(this.lastNeed-=e.length))}function u(e,t){if((e.length-t)%2==0){var r=e.toString("utf16le",t);if(r){var i=r.charCodeAt(r.length-1);if(i>=55296&&i<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function l(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,r)}return t}function h(e,t){var r=(e.length-t)%3;return 0===r?e.toString("base64",t):(this.lastNeed=3-r,this.lastTotal=3,1===r?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-r))}function c(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function f(e){return e.toString(this.encoding)}function d(e){return e&&e.length?this.write(e):""}t.StringDecoder=a,a.prototype.write=function(e){if(0===e.length)return"";var t,r;if(this.lastNeed){if(void 0===(t=this.fillLast(e)))return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r=0)return n>0&&(e.lastNeed=n-1),n;if(--i=0)return n>0&&(e.lastNeed=n-2),n;if(--i=0)return n>0&&(2===n?n=0:e.lastNeed=n-3),n;return 0}(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=r;var i=e.length-(r-this.lastNeed);return e.copy(this.lastChar,0,i),e.toString("utf8",t,i)},a.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length}},function(e,t,r){"use strict";e.exports=s;var i=r(13),n=Object.create(r(21));function a(e,t){var r=this._transformState;r.transforming=!1;var i=r.writecb;if(!i)return this.emit("error",new Error("write callback called multiple times"));r.writechunk=null,r.writecb=null,null!=t&&this.push(t),i(e);var n=this._readableState;n.reading=!1,(n.needReadable||n.length({packetType:e.readUInt8(t),vorbis:new i.StringType(6,"ascii").get(e,t+1)})},t.IdentificationHeader={len:23,get:(e,t)=>({version:e.readUInt32LE(t+0),channelMode:e.readUInt8(t+4),sampleRate:e.readUInt32LE(t+5),bitrateMax:e.readUInt32LE(t+9),bitrateNominal:e.readUInt32LE(t+13),bitrateMin:e.readUInt32LE(t+17)})}}).call(this,r(2).Buffer)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=r(1);t.VorbisDecoder=class{constructor(e,t){this.data=e,this.offset=t}readInt32(){const e=i.UINT32_LE.get(this.data,this.offset);return this.offset+=4,e}readStringUtf8(){const e=this.readInt32(),t=this.data.toString("utf8",this.offset,this.offset+e);return this.offset+=e,t}parseUserComment(){const e=this.offset,t=this.readStringUtf8(),r=t.indexOf("=");return{key:t.slice(0,r).toUpperCase(),value:t.slice(r+1),len:this.offset-e}}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=r(1),n=r(7),a=r(6),s=r(3)("music-metadata:parser:MP4:atom");t.Header={len:8,get:(e,t)=>{const r=i.UINT32_BE.get(e,t);if(r<0)throw new Error("Invalid atom header length");return{length:r,name:n.FourCcToken.get(e,t+4)}},put:(e,t,r)=>(i.UINT32_BE.put(e,t,r.length),n.FourCcToken.put(e,t+4,r.name))},t.ExtendedSize=i.UINT64_BE,t.ftyp={len:4,get:(e,t)=>({type:new i.StringType(4,"ascii").get(e,t)})},t.tkhd={len:4,get:(e,t)=>({type:new i.StringType(4,"ascii").get(e,t)})},t.mhdr={len:8,get:(e,t)=>({version:i.UINT8.get(e,t+0),flags:i.UINT24_BE.get(e,t+1),nextItemID:i.UINT32_BE.get(e,t+4)})};class o{constructor(e,t,r){if(this.len=e,et&&s(`Warning: atom ${r} expected to be ${t}, but was actually ${e} bytes long.`)}}t.FixedLengthAtom=o;t.MdhdAtom=class extends o{constructor(e){super(e,24,"mdhd"),this.len=e}get(e,t){return{version:i.UINT8.get(e,t+0),flags:i.UINT24_BE.get(e,t+1),creationTime:i.UINT32_BE.get(e,t+4),modificationTime:i.UINT32_BE.get(e,t+8),timeScale:i.UINT32_BE.get(e,t+12),duration:i.UINT32_BE.get(e,t+16),language:i.UINT16_BE.get(e,t+20),quality:i.UINT16_BE.get(e,t+22)}}};t.MvhdAtom=class extends o{constructor(e){super(e,100,"mvhd"),this.len=e}get(e,t){return{version:i.UINT8.get(e,t),flags:i.UINT24_BE.get(e,t+1),creationTime:i.UINT32_BE.get(e,t+4),modificationTime:i.UINT32_BE.get(e,t+8),timeScale:i.UINT32_BE.get(e,t+12),duration:i.UINT32_BE.get(e,t+16),preferredRate:i.UINT32_BE.get(e,t+20),preferredVolume:i.UINT16_BE.get(e,t+24),previewTime:i.UINT32_BE.get(e,t+72),previewDuration:i.UINT32_BE.get(e,t+76),posterTime:i.UINT32_BE.get(e,t+80),selectionTime:i.UINT32_BE.get(e,t+84),selectionDuration:i.UINT32_BE.get(e,t+88),currentTime:i.UINT32_BE.get(e,t+92),nextTrackID:i.UINT32_BE.get(e,t+96)}}};t.DataAtom=class{constructor(e){this.len=e}get(e,t){return{type:{set:i.UINT8.get(e,t+0),type:i.UINT24_BE.get(e,t+1)},locale:i.UINT24_BE.get(e,t+4),value:new i.BufferType(this.len-8).get(e,t+8)}}};t.NameAtom=class{constructor(e){this.len=e}get(e,t){return{version:i.UINT8.get(e,t),flags:i.UINT24_BE.get(e,t+1),name:new i.StringType(this.len-4,"utf-8").get(e,t+4)}}};t.TrackHeaderAtom=class{constructor(e){this.len=e}get(e,t){return{version:i.UINT8.get(e,t),flags:i.UINT24_BE.get(e,t+1),creationTime:i.UINT32_BE.get(e,t+4),modificationTime:i.UINT32_BE.get(e,t+8),trackId:i.UINT32_BE.get(e,t+12),duration:i.UINT32_BE.get(e,t+20),layer:i.UINT16_BE.get(e,t+24),alternateGroup:i.UINT16_BE.get(e,t+26),volume:i.UINT16_BE.get(e,t+28)}}};const u=8,l=(e,t)=>({version:i.UINT8.get(e,t),flags:i.UINT24_BE.get(e,t+1),numberOfEntries:i.UINT32_BE.get(e,t+4)});class h{constructor(e){this.len=e}get(e,t){return{dataFormat:n.FourCcToken.get(e,t),dataReferenceIndex:i.UINT16_BE.get(e,t+10),description:new i.BufferType(this.len-12).get(e,t+12)}}}t.StsdAtom=class{constructor(e){this.len=e}get(e,t){const r=l(e,t);t+=u;const n=[];for(let a=0;a({version:i.INT16_BE.get(e,t),revision:i.INT16_BE.get(e,t+2),vendor:i.INT32_BE.get(e,t+4)})},t.SoundSampleDescriptionV0={len:12,get:(e,t)=>({numAudioChannels:i.INT16_BE.get(e,t+0),sampleSize:i.INT16_BE.get(e,t+2),compressionId:i.INT16_BE.get(e,t+4),packetSize:i.INT16_BE.get(e,t+6),sampleRate:i.UINT16_BE.get(e,t+8)+i.UINT16_BE.get(e,t+10)/1e4})};class c{constructor(e,t){this.len=e,this.token=t}get(e,t){const r=i.INT32_BE.get(e,t+4);return{version:i.INT8.get(e,t+0),flags:i.INT24_BE.get(e,t+1),numberOfEntries:r,entries:f(e,this.token,t+8,this.len-8,r)}}}t.TimeToSampleToken={len:8,get:(e,t)=>({count:i.INT32_BE.get(e,t+0),duration:i.INT32_BE.get(e,t+4)})};t.SttsAtom=class extends c{constructor(e){super(e,t.TimeToSampleToken),this.len=e}},t.SampleToChunkToken={len:12,get:(e,t)=>({firstChunk:i.INT32_BE.get(e,t),samplesPerChunk:i.INT32_BE.get(e,t+4),sampleDescriptionId:i.INT32_BE.get(e,t+8)})};t.StscAtom=class extends c{constructor(e){super(e,t.SampleToChunkToken),this.len=e}};t.StszAtom=class{constructor(e){this.len=e}get(e,t){const r=i.INT32_BE.get(e,t+8);return{version:i.INT8.get(e,t),flags:i.INT24_BE.get(e,t+1),sampleSize:i.INT32_BE.get(e,t+4),numberOfEntries:r,entries:f(e,i.INT32_BE,t+12,this.len-12,r)}}};t.StcoAtom=class extends c{constructor(e){super(e,i.INT32_BE),this.len=e}};function f(e,t,r,i,n){if(s(`remainingLen=${i}, numberOfEntries=${n} * token-len=${t.len}`),0===i)return[];a.equal(i,n*t.len,"mismatch number-of-entries with remaining atom-length");const o=[];for(let i=0;i{const i=new FileReader;i.onloadend=e=>{let r=e.target.result;r instanceof ArrayBuffer&&(r=s(new Uint8Array(e.target.result))),t(r)},i.onerror=e=>{r(new Error(e.type))},i.onabort=e=>{r(new Error(e.type))},i.readAsArrayBuffer(e)})}(e).then(r=>n.parseBuffer(r,e.type,t))},t.fetchFromUrl=async function(e,t){const r=await fetch(e),i=r.headers.get("Content-Type"),n=[];if(r.headers.forEach(e=>{n.push(e)}),r.ok){if(r.body){const e=await this.parseReadableStream(r.body,i,t);return o("Closing HTTP-readable-stream..."),r.body.locked||await r.body.cancel(),o("HTTP-readable-stream closed."),e}return this.parseBlob(await r.blob(),t)}throw new Error(`HTTP error status=${r.status}: ${r.statusText}`)}},function(e,t,r){var i;(function(){var r=function(e){return e instanceof r?e:this instanceof r?void(this.EXIFwrapped=e):new r(e)};e.exports&&(t=e.exports=r),t.EXIF=r;var a=r.Tags={36864:"ExifVersion",40960:"FlashpixVersion",40961:"ColorSpace",40962:"PixelXDimension",40963:"PixelYDimension",37121:"ComponentsConfiguration",37122:"CompressedBitsPerPixel",37500:"MakerNote",37510:"UserComment",40964:"RelatedSoundFile",36867:"DateTimeOriginal",36868:"DateTimeDigitized",37520:"SubsecTime",37521:"SubsecTimeOriginal",37522:"SubsecTimeDigitized",33434:"ExposureTime",33437:"FNumber",34850:"ExposureProgram",34852:"SpectralSensitivity",34855:"ISOSpeedRatings",34856:"OECF",37377:"ShutterSpeedValue",37378:"ApertureValue",37379:"BrightnessValue",37380:"ExposureBias",37381:"MaxApertureValue",37382:"SubjectDistance",37383:"MeteringMode",37384:"LightSource",37385:"Flash",37396:"SubjectArea",37386:"FocalLength",41483:"FlashEnergy",41484:"SpatialFrequencyResponse",41486:"FocalPlaneXResolution",41487:"FocalPlaneYResolution",41488:"FocalPlaneResolutionUnit",41492:"SubjectLocation",41493:"ExposureIndex",41495:"SensingMethod",41728:"FileSource",41729:"SceneType",41730:"CFAPattern",41985:"CustomRendered",41986:"ExposureMode",41987:"WhiteBalance",41988:"DigitalZoomRation",41989:"FocalLengthIn35mmFilm",41990:"SceneCaptureType",41991:"GainControl",41992:"Contrast",41993:"Saturation",41994:"Sharpness",41995:"DeviceSettingDescription",41996:"SubjectDistanceRange",40965:"InteroperabilityIFDPointer",42016:"ImageUniqueID"},s=r.TiffTags={256:"ImageWidth",257:"ImageHeight",34665:"ExifIFDPointer",34853:"GPSInfoIFDPointer",40965:"InteroperabilityIFDPointer",258:"BitsPerSample",259:"Compression",262:"PhotometricInterpretation",274:"Orientation",277:"SamplesPerPixel",284:"PlanarConfiguration",530:"YCbCrSubSampling",531:"YCbCrPositioning",282:"XResolution",283:"YResolution",296:"ResolutionUnit",273:"StripOffsets",278:"RowsPerStrip",279:"StripByteCounts",513:"JPEGInterchangeFormat",514:"JPEGInterchangeFormatLength",301:"TransferFunction",318:"WhitePoint",319:"PrimaryChromaticities",529:"YCbCrCoefficients",532:"ReferenceBlackWhite",306:"DateTime",270:"ImageDescription",271:"Make",272:"Model",305:"Software",315:"Artist",33432:"Copyright"},o=r.GPSTags={0:"GPSVersionID",1:"GPSLatitudeRef",2:"GPSLatitude",3:"GPSLongitudeRef",4:"GPSLongitude",5:"GPSAltitudeRef",6:"GPSAltitude",7:"GPSTimeStamp",8:"GPSSatellites",9:"GPSStatus",10:"GPSMeasureMode",11:"GPSDOP",12:"GPSSpeedRef",13:"GPSSpeed",14:"GPSTrackRef",15:"GPSTrack",16:"GPSImgDirectionRef",17:"GPSImgDirection",18:"GPSMapDatum",19:"GPSDestLatitudeRef",20:"GPSDestLatitude",21:"GPSDestLongitudeRef",22:"GPSDestLongitude",23:"GPSDestBearingRef",24:"GPSDestBearing",25:"GPSDestDistanceRef",26:"GPSDestDistance",27:"GPSProcessingMethod",28:"GPSAreaInformation",29:"GPSDateStamp",30:"GPSDifferential"},u=r.IFD1Tags={256:"ImageWidth",257:"ImageHeight",258:"BitsPerSample",259:"Compression",262:"PhotometricInterpretation",273:"StripOffsets",274:"Orientation",277:"SamplesPerPixel",278:"RowsPerStrip",279:"StripByteCounts",282:"XResolution",283:"YResolution",284:"PlanarConfiguration",296:"ResolutionUnit",513:"JpegIFOffset",514:"JpegIFByteCount",529:"YCbCrCoefficients",530:"YCbCrSubSampling",531:"YCbCrPositioning",532:"ReferenceBlackWhite"},l=r.StringValues={ExposureProgram:{0:"Not defined",1:"Manual",2:"Normal program",3:"Aperture priority",4:"Shutter priority",5:"Creative program",6:"Action program",7:"Portrait mode",8:"Landscape mode"},MeteringMode:{0:"Unknown",1:"Average",2:"CenterWeightedAverage",3:"Spot",4:"MultiSpot",5:"Pattern",6:"Partial",255:"Other"},LightSource:{0:"Unknown",1:"Daylight",2:"Fluorescent",3:"Tungsten (incandescent light)",4:"Flash",9:"Fine weather",10:"Cloudy weather",11:"Shade",12:"Daylight fluorescent (D 5700 - 7100K)",13:"Day white fluorescent (N 4600 - 5400K)",14:"Cool white fluorescent (W 3900 - 4500K)",15:"White fluorescent (WW 3200 - 3700K)",17:"Standard light A",18:"Standard light B",19:"Standard light C",20:"D55",21:"D65",22:"D75",23:"D50",24:"ISO studio tungsten",255:"Other"},Flash:{0:"Flash did not fire",1:"Flash fired",5:"Strobe return light not detected",7:"Strobe return light detected",9:"Flash fired, compulsory flash mode",13:"Flash fired, compulsory flash mode, return light not detected",15:"Flash fired, compulsory flash mode, return light detected",16:"Flash did not fire, compulsory flash mode",24:"Flash did not fire, auto mode",25:"Flash fired, auto mode",29:"Flash fired, auto mode, return light not detected",31:"Flash fired, auto mode, return light detected",32:"No flash function",65:"Flash fired, red-eye reduction mode",69:"Flash fired, red-eye reduction mode, return light not detected",71:"Flash fired, red-eye reduction mode, return light detected",73:"Flash fired, compulsory flash mode, red-eye reduction mode",77:"Flash fired, compulsory flash mode, red-eye reduction mode, return light not detected",79:"Flash fired, compulsory flash mode, red-eye reduction mode, return light detected",89:"Flash fired, auto mode, red-eye reduction mode",93:"Flash fired, auto mode, return light not detected, red-eye reduction mode",95:"Flash fired, auto mode, return light detected, red-eye reduction mode"},SensingMethod:{1:"Not defined",2:"One-chip color area sensor",3:"Two-chip color area sensor",4:"Three-chip color area sensor",5:"Color sequential area sensor",7:"Trilinear sensor",8:"Color sequential linear sensor"},SceneCaptureType:{0:"Standard",1:"Landscape",2:"Portrait",3:"Night scene"},SceneType:{1:"Directly photographed"},CustomRendered:{0:"Normal process",1:"Custom process"},WhiteBalance:{0:"Auto white balance",1:"Manual white balance"},GainControl:{0:"None",1:"Low gain up",2:"High gain up",3:"Low gain down",4:"High gain down"},Contrast:{0:"Normal",1:"Soft",2:"Hard"},Saturation:{0:"Normal",1:"Low saturation",2:"High saturation"},Sharpness:{0:"Normal",1:"Soft",2:"Hard"},SubjectDistanceRange:{0:"Unknown",1:"Macro",2:"Close view",3:"Distant view"},FileSource:{3:"DSC"},Components:{0:"",1:"Y",2:"Cb",3:"Cr",4:"R",5:"G",6:"B"}};function h(e){return!!e.exifdata}function c(e,t){function i(i){var n=f(i);e.exifdata=n||{};var a=function(e){var t=new DataView(e);0;if(255!=t.getUint8(0)||216!=t.getUint8(1))return!1;var r=2,i=e.byteLength,n=function(e,t){return 56===e.getUint8(t)&&66===e.getUint8(t+1)&&73===e.getUint8(t+2)&&77===e.getUint8(t+3)&&4===e.getUint8(t+4)&&4===e.getUint8(t+5)};for(;r")+8,l=(o=o.substring(o.indexOf("4?d:t+8,s=[],u=0;u4?d:t+8,f-1);case 3:if(1==f)return e.getUint16(t+8,!n);for(a=f>2?d:t+8,s=[],u=0;ue.byteLength)return{};var a=m(e,t,t+n,u,i);if(a.Compression)switch(a.Compression){case 6:if(a.JpegIFOffset&&a.JpegIFByteCount){var s=t+a.JpegIFOffset,o=a.JpegIFByteCount;a.blob=new Blob([new Uint8Array(e.buffer,s,o)],{type:"image/jpeg"})}break;case 1:console.log("Thumbnail image format is TIFF, which is not implemented.");break;default:console.log("Unknown thumbnail image format '%s'",a.Compression)}else 2==a.PhotometricInterpretation&&console.log("Thumbnail image format is RGB, which is not implemented.");return a}(e,f,d,r),i}function _(e){var t={};if(1==e.nodeType){if(e.attributes.length>0){t["@attributes"]={};for(var r=0;r0)for(var r=0;r{if(!t.isBuffer(e))return{};let n={},a=e.indexOf(i);for(;-1!==a;){a=e.indexOf(i,a+i.byteLength);let t=a+i.byteLength,s=t+1,o=s+2,u=e.readUInt8(t),l=e.readUInt16BE(s);if(!r.has(u))continue;if(l>e.length-(o+l))throw new Error("Invalid IPTC directory");let h=r.get(u),c=e.slice(o,o+l).toString();null==n[h]?n[h]=c:Array.isArray(n[h])?n[h].push(c):n[h]=[n[h],c]}return n}}).call(this,r(2).Buffer)},,,,,,,,,function(e,t,r){e.exports=r(200)},function(e,t,r){"use strict";r.r(t),function(e){var t=r(188),i=r(189),n=r.n(i),a=r(190),s=r.n(a);r(202);window.mediaCloudReaderCache={readers:[],getFreeReader:function(){return this.readers.length>0?(console.log("Got cached reader."),this.readers.splice(0,1)[0]):new FileReader},cacheReader:function(e){this.readers.push(e)}},window.DirectUploadItem=Backbone.Model.extend({initialize:function(e){this.on("change:progress",this.updateProgress,this)},sizeToFitSize:function(e,t,r,i){if(e<=0||t<=0)return[r,i];if(r<=0&&i<=0)return[0,0];if(r<=0){if(t<=i)return[e,t];var n=i/t;return[Math.round(e*n),i]}if(i<=0){if(e<=r)return[e,t];var a=r/e;return[r,Math.round(t*a)]}var s=r/e,o=i/t;return s0&&(a.faces=t),console.log(a),jQuery.post(ajaxurl,a,function(e){_.each(["file","loaded","size","percent"],(function(e){n.unset(e)})),"success"==e.status?(n.set(_.extend(e.attachment,{uploading:!1})),wp.media.model.Attachment.get(e.attachment.id,n),this.set({state:"done"})):this.set({state:"error"}),wp.Uploader.queue.remove(n),wp.Uploader.queue.all((function(e){return!e.get("uploading")}))&&wp.Uploader.queue.reset()}.bind(this))},uploadFinished:function(r,i,a){var o=this.get("attachment").get("file"),u={filesize:o.size},l=this.get("mimeType");if(0===l.indexOf("audio/")){var h=l.split("/")[1];u.fileformat=h,t.parseBlob(o,{duration:!0}).then(function(e){this.assignAudioMetadata(e,u),this.doUploadFinished(r,i,u,a)}.bind(this)).catch(function(e){this.doUploadFinished(r,i,u,a)}.bind(this))}else if(0==l.indexOf("image/")){var c=mediaCloudReaderCache.getFreeReader();c.onload=function(t){var o={};try{o=s()(e.from(c.result))}catch(e){console.log("IPTC Error",e)}var l=n.a.readFromBinaryFile(c.result);this.assignImageMetadata(o,l,u),mediaCloudReaderCache.cacheReader(c),this.doUploadFinished(r,i,u,a)}.bind(this),c.onerror=function(e){mediaCloudReaderCache.cacheReader(c),this.doUploadFinished(r,i,u,a)}.bind(this),c.readAsArrayBuffer(o)}else this.doUploadFinished(r,i,u,a)},mapID3Meta:function(e,t,r,i){r.hasOwnProperty(e)&&(i[t]=r[e])},mapIndexedID3Meta:function(e,t,r,i){r.hasOwnProperty(e)&&r[e].length>0&&(i[t]=r[e][0])},assignAudioMetadata:function(e,t){if(this.mapID3Meta("album","album",e.common,t),this.mapID3Meta("artist","artist",e.common,t),this.mapIndexedID3Meta("genre","genre",e.common,t),this.mapID3Meta("title","title",e.common,t),e.common.hasOwnProperty("track")&&null!=e.common.track.no&&(t.track_number=e.common.track.no),this.mapID3Meta("year","year",e.common,t),this.mapIndexedID3Meta("composer","composer",e.common,t),this.mapIndexedID3Meta("lyricist","lyricist",e.common,t),this.mapIndexedID3Meta("writer","writer",e.common,t),this.mapIndexedID3Meta("conductor","conductor",e.common,t),this.mapIndexedID3Meta("remixer","remixer",e.common,t),this.mapIndexedID3Meta("arranger","arranger",e.common,t),this.mapIndexedID3Meta("engineer","engineer",e.common,t),this.mapIndexedID3Meta("producer","producer",e.common,t),this.mapIndexedID3Meta("djmixer","dj_mixer",e.common,t),this.mapIndexedID3Meta("mixer","mixer",e.common,t),this.mapIndexedID3Meta("technician","technician",e.common,t),this.mapIndexedID3Meta("label","label",e.common,t),this.mapIndexedID3Meta("subtitle","subtitle",e.common,t),this.mapIndexedID3Meta("compilation","compilation",e.common,t),this.mapID3Meta("bpm","bpm",e.common,t),this.mapID3Meta("mood","mood",e.common,t),this.mapID3Meta("media","media",e.common,t),this.mapID3Meta("tvShow","tv_show",e.common,t),this.mapID3Meta("tvSeason","tv_season",e.common,t),this.mapID3Meta("tvEpisode","tv_episode",e.common,t),this.mapID3Meta("tvNetwork","tv_network",e.common,t),this.mapID3Meta("podcast","podcast",e.common,t),this.mapID3Meta("podcasturl","podcast_url",e.common,t),this.mapID3Meta("releasestatus","release_status",e.common,t),this.mapID3Meta("releasetype","release_type",e.common,t),this.mapID3Meta("releasecountry","release_country",e.common,t),this.mapID3Meta("language","language",e.common,t),this.mapID3Meta("copyright","copyright",e.common,t),this.mapID3Meta("license","license",e.common,t),this.mapID3Meta("encodedby","encoded_by",e.common,t),this.mapID3Meta("encodersettings","encoder_options",e.common,t),this.mapID3Meta("gapless","gapless",e.common,t),this.mapID3Meta("barcode","barcode",e.common,t),this.mapID3Meta("asin","asin",e.common,t),this.mapID3Meta("website","website",e.common,t),this.mapID3Meta("averageLevel","average_level",e.common,t),this.mapID3Meta("peakLevel","peak_level",e.common,t),this.mapID3Meta("bitrate","bitrate",e.format,t),this.mapID3Meta("codec","dataformat",e.format,t),this.mapID3Meta("codecProfile","bitrate_mode",e.format,t),this.mapID3Meta("lossless","lossless",e.format,t),this.mapID3Meta("numberOfChannels","channels",e.format,t),this.mapID3Meta("duration","length",e.format,t),this.mapID3Meta("sampleRate","sample_rate",e.format,t),e.common.hasOwnProperty("picture")&&e.common.picture.length>0){var r=e.common.picture[0];t.thumbnail={mimeType:r.format,data:r.data.toString("base64")},t.image=[{mime:r.format}]}},mapImageMeta:function(e,t,r,i,n){if(t.hasOwnProperty(r)){var a=t[r];if("string"==e){if(!(o="string"==typeof a||a instanceof String))return;if(/[\x00-\x1F]/.test(a))return;i[n]=a.trim()}else if("strings"==e){if(o="string"==typeof a||a instanceof String){a=a.split(",");for(var s=0;s0&&(i[n]=a)}else if("date"==e){var o;if(!(o="string"==typeof a||a instanceof String))return;var u=a.split(" ");if(2!=u.length)return;var l=u[0].split(":");if(3!=l.length)return;var h=l[0],c=l[1],f=l[2],d=new Date("".concat(c,"/").concat(f,"/").concat(h," ").concat(u[1]));i[n]=(d.getTime()/1e3).toFixed(0)}else if("frac"==e){if(o)return;if(!("number"==typeof a||a instanceof Number))return;i[n]=a.numerator/a.denominator}else if("number"==e){if(o)return;if(!("number"==typeof a||a instanceof Number))return;i[n]=a}}},assignImageMetadata:function(e,t,r){var i={};this.mapImageMeta("string",e,"headline",i,"title"),this.mapImageMeta("string",e,"caption",i,"caption"),this.mapImageMeta("string",e,"credit",i,"credit"),this.mapImageMeta("string",e,"copyright",i,"copyright"),this.mapImageMeta("strings",e,"keywords",i,"keywords"),0!=t&&(this.mapImageMeta("string",t,"ImageDescription",i,"title"),i.hasOwnProperty("caption")||this.mapImageMeta("bytes",t,"UserComment",i,"caption"),i.hasOwnProperty("copyright")||this.mapImageMeta("bytes",t,"Copyright",i,"copyright"),this.mapImageMeta("string",t,"Artist",i,"credit"),i.hasOwnProperty("credit")||this.mapImageMeta("string",t,"Author",i,"credit"),this.mapImageMeta("string",t,"Copyright",i,"copyright"),this.mapImageMeta("string",t,"Model",i,"camera"),this.mapImageMeta("string",t,"ISOSpeedRatings",i,"iso"),this.mapImageMeta("number",t,"ISOSpeedRatings",i,"iso"),this.mapImageMeta("date",t,"DateTimeDigitized",i,"created_timestamp"),this.mapImageMeta("frac",t,"FocalLength",i,"focal_length"),this.mapImageMeta("frac",t,"FNumber",i,"aperture"),this.mapImageMeta("frac",t,"ExposureTime",i,"shutter_speed"),this.mapImageMeta("number",t,"Orientation",i,"orientation")),r.image_meta=i}}),window.DirectUploader=Backbone.Model.extend({initialize:function(e){this.totalFilesDropped=0,this.totalFilesUploaded=0,this.files=[],this.toBulkProcess=[],this.uploadingFiles=[],this.watchToken=0,this.settings=mediaCloudDirectUploadSettings},queueNext:function(){if(clearTimeout(this.watchToken),this.uploadingFiles.length0){for(var e=this.settings.maxUploads-this.uploadingFiles.length,t=0;t0){var r=this.files.shift();this.uploadingFiles.push(r),r.startUpload()}}else if(0==this.uploadingFiles.length&&this.toBulkProcess.length>0&&this.totalFilesDropped==this.totalFilesUploaded){var i={action:"ilab_upload_process_batch",batch:this.toBulkProcess};this.toBulkProcess=[],this.totalFilesDropped=0,this.totalFilesUploaded=0,jQuery.post(ajaxurl,i,(function(e){}))}this.watchToken=setTimeout(this.queueNext.bind(this),500)},addFile:function(e){if(""==e.type)return!1;var t=e.type;"application/x-photoshop"==t&&(t="image/psd");var r=-1!=this.settings.allowedMimes.indexOf(t);console.log("Is Direct Upload?",r);var i=t.split("/"),n=i[0],a=i[1];a="jpg"==a?"jpeg":a,this.totalFilesDropped++;var s={file:e,uploading:!0,date:new Date,filename:e.name,isDirectUpload:r,menuOrder:0,uploadedTo:wp.media.model.settings.post.id,loaded:0,size:e.size,percent:0,type:n,subType:a},o=wp.media.model.Attachment.create(s);wp.Uploader.queue.add(o),window.mediaCloudDirectUploadError=!1;var u=new DirectUploadItem({attachment:o,file:e,mimeType:t,isDirectUpload:r,progress:0,driver:this.settings.driver,faces:null,state:"waiting"});u.on("change:state",function(e,t){if("done"==t||"error"==t){this.totalFilesUploaded++,"done"==t&&this.toBulkProcess.push(o.id);var r=this.files.indexOf(u);r>-1&&this.files.splice(r),(r=this.uploadingFiles.indexOf(u))>-1&&this.uploadingFiles.splice(r),this.queueNext()}}.bind(this)),"undefined"!=typeof ILABFaceDetector?ILABFaceDetector(e,function(e){u.set("faces",e),this.files.push(u)}.bind(this)):this.files.push(u)}}),wp.media.view.UploaderWindow.prototype.__ready=wp.media.view.UploaderWindow.prototype.ready,wp.media.view.UploaderWindow.prototype.ready=function(){this.__ready(),this.directUploader=new DirectUploader({}),this.uploader.uploader.unbind("FilesAdded"),this.uploader.uploader.bind("FilesAdded",function(e,t){_.each(t,function(e){this.directUploader.addFile(e.getNative())}.bind(this)),this.directUploader.queueNext()}.bind(this))},wp.media.view.UploaderInline=wp.media.view.UploaderInline.extend({template:wp.template("media-cloud-direct-upload")})}.call(this,r(2).Buffer)},function(e,t,r){"use strict";t.byteLength=function(e){var t=l(e),r=t[0],i=t[1];return 3*(r+i)/4-i},t.toByteArray=function(e){var t,r,i=l(e),s=i[0],o=i[1],u=new a(function(e,t,r){return 3*(t+r)/4-r}(0,s,o)),h=0,c=o>0?s-4:s;for(r=0;r>16&255,u[h++]=t>>8&255,u[h++]=255&t;2===o&&(t=n[e.charCodeAt(r)]<<2|n[e.charCodeAt(r+1)]>>4,u[h++]=255&t);1===o&&(t=n[e.charCodeAt(r)]<<10|n[e.charCodeAt(r+1)]<<4|n[e.charCodeAt(r+2)]>>2,u[h++]=t>>8&255,u[h++]=255&t);return u},t.fromByteArray=function(e){for(var t,r=e.length,n=r%3,a=[],s=0,o=r-n;so?o:s+16383));1===n?(t=e[r-1],a.push(i[t>>2]+i[t<<4&63]+"==")):2===n&&(t=(e[r-2]<<8)+e[r-1],a.push(i[t>>10]+i[t>>4&63]+i[t<<2&63]+"="));return a.join("")};for(var i=[],n=[],a="undefined"!=typeof Uint8Array?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",o=0,u=s.length;o0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");return-1===r&&(r=t),[r,r===t?0:4-r%4]}function h(e,t,r){for(var n,a,s=[],o=t;o>18&63]+i[a>>12&63]+i[a>>6&63]+i[63&a]);return s.join("")}n["-".charCodeAt(0)]=62,n["_".charCodeAt(0)]=63},function(e,t,r){(function(t){if((void 0===r||!r)&&"undefined"!=typeof self)var r=self;e.exports=function e(t,r,i){function n(s,o){if(!r[s]){if(!t[s]){if(a)return a(s,!0);var u=new Error("Cannot find module '"+s+"'");throw u.code="MODULE_NOT_FOUND",u}var l=r[s]={exports:{}};t[s][0].call(l.exports,(function(e){return n(t[s][1][e]||e)}),l,l.exports,e,t,r,i)}return r[s].exports}for(var a=!1,s=0;s=s?(n[i++]=parseInt(r/s,10),r%=s):i>0&&(n[i++]=0);o=i,u=this.dstAlphabet.slice(r,r+1).concat(u)}while(0!==i);return u},i.prototype.isValid=function(e){for(var t=0;t=0;l--)if(h[l]!==c[l])return!1;for(l=h.length-1;l>=0;l--)if(o=h[l],!_(e[o],t[o],r,i))return!1;return!0}(e,t,r,i))}return r?e===t:e==t}function v(e){return"[object Arguments]"==Object.prototype.toString.call(e)}function w(e,t){if(!e||!t)return!1;if("[object RegExp]"==Object.prototype.toString.call(t))return t.test(e);try{if(e instanceof t)return!0}catch(e){}return!Error.isPrototypeOf(t)&&!0===t.call({},e)}function E(e,t,r,i){var n;if("function"!=typeof t)throw new TypeError('"block" argument must be a function');"string"==typeof r&&(i=r,r=null),n=function(e){var t;try{e()}catch(e){t=e}return t}(t),i=(r&&r.name?" ("+r.name+").":".")+(i?" "+i:"."),e&&!n&&b(n,r,"Missing expected exception"+i);var a="string"==typeof i,o=!e&&n&&!r;if((!e&&s.isError(n)&&a&&w(n,r)||o)&&b(n,r,"Got unwanted exception"+i),e&&n&&r&&!w(n,r)||!e&&n)throw n}f.AssertionError=function(e){this.name="AssertionError",this.actual=e.actual,this.expected=e.expected,this.operator=e.operator,e.message?(this.message=e.message,this.generatedMessage=!1):(this.message=function(e){return m(g(e.actual),128)+" "+e.operator+" "+m(g(e.expected),128)}(this),this.generatedMessage=!0);var t=e.stackStartFunction||b;if(Error.captureStackTrace)Error.captureStackTrace(this,t);else{var r=new Error;if(r.stack){var i=r.stack,n=p(t),a=i.indexOf("\n"+n);if(a>=0){var s=i.indexOf("\n",a+1);i=i.substring(s+1)}this.stack=i}}},s.inherits(f.AssertionError,Error),f.fail=b,f.ok=y,f.equal=function(e,t,r){e!=t&&b(e,t,r,"==",f.equal)},f.notEqual=function(e,t,r){e==t&&b(e,t,r,"!=",f.notEqual)},f.deepEqual=function(e,t,r){_(e,t,!1)||b(e,t,r,"deepEqual",f.deepEqual)},f.deepStrictEqual=function(e,t,r){_(e,t,!0)||b(e,t,r,"deepStrictEqual",f.deepStrictEqual)},f.notDeepEqual=function(e,t,r){_(e,t,!1)&&b(e,t,r,"notDeepEqual",f.notDeepEqual)},f.notDeepStrictEqual=function e(t,r,i){_(t,r,!0)&&b(t,r,i,"notDeepStrictEqual",e)},f.strictEqual=function(e,t,r){e!==t&&b(e,t,r,"===",f.strictEqual)},f.notStrictEqual=function(e,t,r){e===t&&b(e,t,r,"!==",f.notStrictEqual)},f.throws=function(e,t,r){E(!0,e,t,r)},f.doesNotThrow=function(e,t,r){E(!1,e,t,r)},f.ifError=function(e){if(e)throw e},f.strict=i((function e(t,r){t||b(t,!0,r,"==",e)}),f,{equal:f.strictEqual,deepEqual:f.deepStrictEqual,notEqual:f.notStrictEqual,notDeepEqual:f.notDeepStrictEqual}),f.strict.strict=f.strict;var k=Object.keys||function(e){var t=[];for(var r in e)o.call(e,r)&&t.push(r);return t}}).call(this,r(88))},,,,,function(e,t,r){"use strict";(function(e){Object.defineProperty(t,"__esModule",{value:!0});const i=r(66),n=/^[\w-©][\w-\x000-3]/;t.FourCcToken={len:4,get:(e,r)=>{const a=e.toString("binary",r,r+t.FourCcToken.len);if(!a.match(n))throw new Error("FourCC contains invalid characters: "+i.default.a2hex(a));return a},put:(t,r,i)=>{const n=e.from(i,"binary");if(4!==n.length)throw new Error("Invalid length");return n.copy(t,r)}}}).call(this,r(51).Buffer)},,,,,,,function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.BasicParser=class{init(e,t,r){return this.metadata=e,this.tokenizer=t,this.options=r,this}}},,,,,,function(e,t){var r;r=function(){return this}();try{r=r||new Function("return this")()}catch(e){"object"==typeof window&&(r=window)}e.exports=r},,,,,,,,function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=r(70),n=r(281);class a{constructor(e,t){this.tagTypes=e,this.tagMap=t}static parseGenre(e){const t=e.trim().split(/\((.*?)\)/g).filter(e=>""!==e),r=[];for(let e of t)/^\d+$/.test(e)&&!isNaN(parseInt(e,10))&&(e=n.Genres[e]),r.push(e);return r.filter(e=>void 0!==e).join("/")}static fixPictureMimeType(e){switch(i.ok(e,"pictureType should be defined"),e=e.toLocaleLowerCase()){case"image/jpg":return"image/jpeg"}return e}static toIntOrNull(e){const t=parseInt(e,10);return isNaN(t)?null:t}static normalizeTrack(e){const t=e.toString().split("/");return{no:parseInt(t[0],10)||null,of:parseInt(t[1],10)||null}}mapGenericTag(e,t){e={id:e.id,value:e.value},this.postMap(e,t);const r=this.getCommonName(e.id);return r?{id:r,value:e.value}:null}getCommonName(e){return this.tagMap[e]}postMap(e,t){}}t.CommonTagMapper=a,a.maxRatingScore=1},,,,,function(e,t){var r,i,n=e.exports={};function a(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function o(e){if(r===setTimeout)return setTimeout(e,0);if((r===a||!r)&&setTimeout)return r=setTimeout,setTimeout(e,0);try{return r(e,0)}catch(t){try{return r.call(null,e,0)}catch(t){return r.call(this,e,0)}}}!function(){try{r="function"==typeof setTimeout?setTimeout:a}catch(e){r=a}try{i="function"==typeof clearTimeout?clearTimeout:s}catch(e){i=s}}();var u,l=[],h=!1,c=-1;function f(){h&&u&&(h=!1,u.length?l=u.concat(l):c=-1,l.length&&d())}function d(){if(!h){var e=o(f);h=!0;for(var t=l.length;t;){for(u=l,l=[];++c1)for(var r=1;r1?e.blocksPerFrame*(e.totalFrames-1):0;return t+=e.finalFrameBlocks,t/e.sampleRate}static async findApeFooterOffset(t,r){const i=e.alloc(l.TagFooter.len);await t.randomRead(i,0,l.TagFooter.len,r-l.TagFooter.len);const n=l.TagFooter.get(i,0);if("APETAGEX"===n.ID)return c("APE footer header at offset="+r),{footer:n,offset:r-n.size}}static parseTagFooter(e,t,r){const i=l.TagFooter.get(t,t.length-l.TagFooter.len);s.strictEqual(i.ID,"APETAGEX","APEv2 Footer preamble"),a.fromBuffer(t);const n=new f;return n.init(e,a.fromBuffer(t),r),n.parseTags(i)}async tryParseApeHeader(){if(this.tokenizer.fileSize&&this.tokenizer.fileSize-this.tokenizer.position0?this.parseDescriptorExpansion(t):this.parseHeader());return await this.tokenizer.ignore(r.forwardBytes),this.tryParseApeHeader()}async parseTags(t){const r=e.alloc(256);let i=t.size-l.TagFooter.len;c(`Parse APE tags at offset=${this.tokenizer.position}, size=${i}`);for(let a=0;a0?this.parseExtendedHeaderData(t,e.size):this.parseId3Data(this.id3Header.size-e.size)}async parseExtendedHeaderData(t,r){const i=e.alloc(t);return await this.tokenizer.readBuffer(i,0,t),this.parseId3Data(this.id3Header.size-r)}async parseId3Data(t){const r=e.alloc(t);await this.tokenizer.readBuffer(r,0,t);for(const e of this.parseMetadata(r))if("TXXX"===e.id)for(const t of e.value.text)this.addTag(o.makeDescriptionTagName(e.id,e.value.description),t);else if("COM"===e.id)for(const t of e.value)this.addTag(o.makeDescriptionTagName(e.id,t.description),t.text);else if(Array.isArray(e.value))for(const t of e.value)this.addTag(e.id,t);else this.addTag(e.id,e.value)}addTag(e,t){this.metadata.addTag(this.headerType,e,t)}parseMetadata(e){let t=0;const r=[];for(;t!==e.length;){const i=o.getFrameHeaderLength(this.id3Header.version.major);if(t+i>e.length){this.metadata.addWarning("Illegal ID3v2 tag length");break}const n=e.slice(t,t+=i),a=o.readFrameHeader(n,this.id3Header.version.major);if(""===a.id||"\0\0\0\0"===a.id||-1==="ABCDEFGHIJKLMNOPQRSTUVWXYZ".indexOf(a.id[0]))break;const s=e.slice(t,t+=a.length),u=o.readFrameData(s,a,this.id3Header.version.major,!this.options.skipCovers);r.push({id:a.id,value:u})}return r}}t.ID3v2Parser=o}).call(this,r(51).Buffer)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=r(37),n=r(66);!function(e){e[e.Other=0]="Other",e[e["32x32 pixels 'file icon' (PNG only)"]=1]="32x32 pixels 'file icon' (PNG only)",e[e["Other file icon"]=2]="Other file icon",e[e["Cover (front)"]=3]="Cover (front)",e[e["Cover (back)"]=4]="Cover (back)",e[e["Leaflet page"]=5]="Leaflet page",e[e["Media (e.g. label side of CD)"]=6]="Media (e.g. label side of CD)",e[e["Lead artist/lead performer/soloist"]=7]="Lead artist/lead performer/soloist",e[e["Artist/performer"]=8]="Artist/performer",e[e.Conductor=9]="Conductor",e[e["Band/Orchestra"]=10]="Band/Orchestra",e[e.Composer=11]="Composer",e[e["Lyricist/text writer"]=12]="Lyricist/text writer",e[e["Recording Location"]=13]="Recording Location",e[e["During recording"]=14]="During recording",e[e["During performance"]=15]="During performance",e[e["Movie/video screen capture"]=16]="Movie/video screen capture",e[e["A bright coloured fish"]=17]="A bright coloured fish",e[e.Illustration=18]="Illustration",e[e["Band/artist logotype"]=19]="Band/artist logotype",e[e["Publisher/Studio logotype"]=20]="Publisher/Studio logotype"}(t.AttachedPictureType||(t.AttachedPictureType={})),t.UINT32SYNCSAFE={get:(e,t)=>127&e[t+3]|e[t+2]<<7|e[t+1]<<14|e[t]<<21,len:4},t.ID3v2Header={len:10,get:(e,r)=>({fileIdentifier:new i.StringType(3,"ascii").get(e,r),version:{major:i.INT8.get(e,r+3),revision:i.INT8.get(e,r+4)},flags:{raw:i.INT8.get(e,r+4),unsynchronisation:n.default.strtokBITSET.get(e,r+5,7),isExtendedHeader:n.default.strtokBITSET.get(e,r+5,6),expIndicator:n.default.strtokBITSET.get(e,r+5,5),footer:n.default.strtokBITSET.get(e,r+5,4)},size:t.UINT32SYNCSAFE.get(e,r+6)})},t.ExtendedHeader={len:10,get:(e,t)=>({size:i.UINT32_BE.get(e,t),extendedFlags:i.UINT16_BE.get(e,t+4),sizeOfPadding:i.UINT32_BE.get(e,t+6),crcDataPresent:n.default.strtokBITSET.get(e,t+4,31)})},t.TextEncodingToken={len:1,get:(e,t)=>{switch(e.readUInt8(t)){case 0:return{encoding:"iso-8859-1"};case 1:return{encoding:"utf16",bom:!0};case 2:return{encoding:"utf16",bom:!1};case 3:default:return{encoding:"utf8",bom:!1}}}}},function(e,t,r){(function(e){function r(e){return Object.prototype.toString.call(e)}t.isArray=function(e){return Array.isArray?Array.isArray(e):"[object Array]"===r(e)},t.isBoolean=function(e){return"boolean"==typeof e},t.isNull=function(e){return null===e},t.isNullOrUndefined=function(e){return null==e},t.isNumber=function(e){return"number"==typeof e},t.isString=function(e){return"string"==typeof e},t.isSymbol=function(e){return"symbol"==typeof e},t.isUndefined=function(e){return void 0===e},t.isRegExp=function(e){return"[object RegExp]"===r(e)},t.isObject=function(e){return"object"==typeof e&&null!==e},t.isDate=function(e){return"[object Date]"===r(e)},t.isError=function(e){return"[object Error]"===r(e)||e instanceof Error},t.isFunction=function(e){return"function"==typeof e},t.isPrimitive=function(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e},t.isBuffer=e.isBuffer}).call(this,r(51).Buffer)},,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=r(70),n=r(345);var a=r(345);t.EndOfStreamError=a.EndOfStreamError;class s{constructor(){this.promise=new Promise((e,t)=>{this.reject=t,this.resolve=e})}}t.StreamReader=class{constructor(e){if(this.s=e,this.endOfStream=!1,this.peekQueue=[],!e.read||!e.once)throw new Error("Expected an instance of stream.Readable");this.s.once("end",()=>this.reject(new n.EndOfStreamError)),this.s.once("error",e=>this.reject(e)),this.s.once("close",()=>this.reject(new Error("Stream closed")))}async peek(e,t,r){const i=await this.read(e,t,r);return this.peekQueue.push(e.slice(t,t+i)),i}async read(e,t,r){if(0===r)return 0;if(0===this.peekQueue.length&&this.endOfStream)throw new n.EndOfStreamError;let i=r,a=0;for(;this.peekQueue.length>0&&i>0;){const r=this.peekQueue.pop(),n=Math.min(r.length,i);r.copy(e,t+a,0,n),a+=n,i-=n,n0&&!this.endOfStream;){const r=Math.min(i,1048576),n=await this._read(e,t+a,r);if(a+=n,n{this.tryRead()}),this.request.deferred.promise.then(e=>(this.request=null,e),e=>{throw this.request=null,e}))}tryRead(){const e=this.s.read(this.request.length);e?(e.copy(this.request.buffer,this.request.offset),this.request.deferred.resolve(e.length)):this.s.once("readable",()=>{this.tryRead()})}reject(e){this.endOfStream=!0,this.request&&(this.request.deferred.reject(e),this.request=null)}}},function(e,t,r){"use strict";(function(e){Object.defineProperty(t,"__esModule",{value:!0});const i=r(52),n=r(66),a=r(37),s=r(82),o=r(116),u=i("music-metadata:parser:ID3v1");t.Genres=["Blues","Classic Rock","Country","Dance","Disco","Funk","Grunge","Hip-Hop","Jazz","Metal","New Age","Oldies","Other","Pop","R&B","Rap","Reggae","Rock","Techno","Industrial","Alternative","Ska","Death Metal","Pranks","Soundtrack","Euro-Techno","Ambient","Trip-Hop","Vocal","Jazz+Funk","Fusion","Trance","Classical","Instrumental","Acid","House","Game","Sound Clip","Gospel","Noise","Alt. Rock","Bass","Soul","Punk","Space","Meditative","Instrumental Pop","Instrumental Rock","Ethnic","Gothic","Darkwave","Techno-Industrial","Electronic","Pop-Folk","Eurodance","Dream","Southern Rock","Comedy","Cult","Gangsta Rap","Top 40","Christian Rap","Pop/Funk","Jungle","Native American","Cabaret","New Wave","Psychedelic","Rave","Showtunes","Trailer","Lo-Fi","Tribal","Acid Punk","Acid Jazz","Polka","Retro","Musical","Rock & Roll","Hard Rock","Folk","Folk/Rock","National Folk","Swing","Fast-Fusion","Bebob","Latin","Revival","Celtic","Bluegrass","Avantgarde","Gothic Rock","Progressive Rock","Psychedelic Rock","Symphonic Rock","Slow Rock","Big Band","Chorus","Easy Listening","Acoustic","Humour","Speech","Chanson","Opera","Chamber Music","Sonata","Symphony","Booty Bass","Primus","Porn Groove","Satire","Slow Jam","Club","Tango","Samba","Folklore","Ballad","Power Ballad","Rhythmic Soul","Freestyle","Duet","Punk Rock","Drum Solo","A Cappella","Euro-House","Dance Hall","Goa","Drum & Bass","Club-House","Hardcore","Terror","Indie","BritPop","Negerpunk","Polsk Punk","Beat","Christian Gangsta Rap","Heavy Metal","Black Metal","Crossover","Contemporary Christian","Christian Rock","Merengue","Salsa","Thrash Metal","Anime","JPop","Synthpop","Abstract","Art Rock","Baroque","Bhangra","Big Beat","Breakbeat","Chillout","Downtempo","Dub","EBM","Eclectic","Electro","Electroclash","Emo","Experimental","Garage","Global","IDM","Illbient","Industro-Goth","Jam Band","Krautrock","Leftfield","Lounge","Math Rock","New Romantic","Nu-Breakz","Post-Punk","Post-Rock","Psytrance","Shoegaze","Space Rock","Trop Rock","World Music","Neoclassical","Audiobook","Audio Theatre","Neue Deutsche Welle","Podcast","Indie Rock","G-Funk","Dubstep","Garage Rock","Psybient"];const l={len:128,get:(e,t)=>{const r=new h(3).get(e,t);return"TAG"===r?{header:r,title:new h(30).get(e,t+3),artist:new h(30).get(e,t+33),album:new h(30).get(e,t+63),year:new h(4).get(e,t+93),comment:new h(28).get(e,t+97),zeroByte:a.UINT8.get(e,t+127),track:a.UINT8.get(e,t+126),genre:a.UINT8.get(e,t+127)}:null}};class h extends a.StringType{constructor(e){super(e,"binary")}get(e,t){let r=super.get(e,t);return r=n.default.trimRightNull(r),r=r.trim(),r.length>0?r:void 0}}class c extends s.BasicParser{static getGenre(e){if(ee)return void u("Already consumed the last 128 bytes");const t=await this.tokenizer.readToken(l,e);if(t){u("ID3v1 header found at: pos=%s",this.tokenizer.fileSize-l.len);for(const e of["title","artist","album","comment","track","year"])t[e]&&""!==t[e]&&this.addTag(e,t[e]);const e=c.getGenre(t.genre);e&&this.addTag("genre",e)}else u("ID3v1 header not found at: pos=%s",this.tokenizer.fileSize-l.len)}addTag(e,t){this.metadata.addTag("ID3v1",e,t)}}t.ID3v1Parser=c,t.hasID3v1Header=async function(t){if(t.fileSize>=128){const r=e.alloc(3);return await t.randomRead(r,0,r.length,t.fileSize-128),"TAG"===r.toString("binary")}return!1}}).call(this,r(51).Buffer)},function(e,t,r){"use strict";(function(t){void 0===t||!t.version||0===t.version.indexOf("v0.")||0===t.version.indexOf("v1.")&&0!==t.version.indexOf("v1.8.")?e.exports={nextTick:function(e,r,i,n){if("function"!=typeof e)throw new TypeError('"callback" argument must be a function');var a,s,o=arguments.length;switch(o){case 0:case 1:return t.nextTick(e);case 2:return t.nextTick((function(){e.call(null,r)}));case 3:return t.nextTick((function(){e.call(null,r,i)}));case 4:return t.nextTick((function(){e.call(null,r,i,n)}));default:for(a=new Array(o-1),s=0;s0){const t=e.concat(this.pageSegments);this.parseFullPage(t)}this.pageSegments=t.headerType.lastPage?[]:[r]}}t.headerType.lastPage&&this.calculateDuration(t)}flush(){this.parseFullPage(e.concat(this.pageSegments))}parseUserComment(e,t){const r=new a.VorbisDecoder(e,t).parseUserComment();return this.addTag(r.key,r.value),r.len}addTag(e,t){if("METADATA_BLOCK_PICTURE"===e&&"string"==typeof t){if(this.options.skipCovers)return void o("Ignore picture");t=s.VorbisPictureToken.fromBase64(t),o(`Push picture: id=${e}, format=${t.format}`)}else o(`Push tag: id=${e}, value=${t}`);this.metadata.addTag("vorbis",e,t)}parseFirstPage(e,t){this.metadata.setFormat("codec","Vorbis I"),o("Parse first page");const r=s.CommonHeader.get(t,0);if("vorbis"!==r.vorbis)throw new Error("Metadata does not look like Vorbis");if(1!==r.packetType)throw new Error("First Ogg page should be type 1: the identification header");{const e=s.IdentificationHeader.get(t,s.CommonHeader.len);this.metadata.setFormat("sampleRate",e.sampleRate),this.metadata.setFormat("bitrate",e.bitrateNominal),this.metadata.setFormat("numberOfChannels",e.channelMode),o("sample-rate=%s[hz], bitrate=%s[b/s], channel-mode=%s",e.sampleRate,e.bitrateNominal,e.channelMode)}}parseFullPage(e){const t=s.CommonHeader.get(e,0);switch(o("Parse full page: type=%s, byteLength=%s",t.packetType,e.byteLength),t.packetType){case 3:return this.parseUserCommentList(e,s.CommonHeader.len)}}calculateDuration(e){this.metadata.format.sampleRate&&e.absoluteGranulePosition>=0&&(this.metadata.setFormat("numberOfSamples",e.absoluteGranulePosition),this.metadata.setFormat("duration",this.metadata.format.numberOfSamples/this.metadata.format.sampleRate))}parseUserCommentList(e,t){const r=i.UINT32_LE.get(e,t);t+=4,t+=r;let n=i.UINT32_LE.get(e,t);for(t+=4;n-- >0;)t+=this.parseUserComment(e,t)}}}).call(this,r(51).Buffer)},,,,,,,,,,,,,,,,,,,,function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=r(96);class n extends i.CommonTagMapper{constructor(e,t){const r={};for(const e of Object.keys(t))r[e.toUpperCase()]=t[e];super(e,r)}getCommonName(e){return this.tagMap[e.toUpperCase()]}}t.CaseInsensitiveTagMap=n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=r(347);class n extends i.Readable{constructor(e){super(),this.buf=e}_read(){this.push(this.buf),this.push(null)}}t.ID3Stream=n},function(e,t,r){"use strict";var i,n="object"==typeof Reflect?Reflect:null,a=n&&"function"==typeof n.apply?n.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)};i=n&&"function"==typeof n.ownKeys?n.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var s=Number.isNaN||function(e){return e!=e};function o(){o.init.call(this)}e.exports=o,o.EventEmitter=o,o.prototype._events=void 0,o.prototype._eventsCount=0,o.prototype._maxListeners=void 0;var u=10;function l(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function h(e){return void 0===e._maxListeners?o.defaultMaxListeners:e._maxListeners}function c(e,t,r,i){var n,a,s,o;if(l(r),void 0===(a=e._events)?(a=e._events=Object.create(null),e._eventsCount=0):(void 0!==a.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),a=e._events),s=a[t]),void 0===s)s=a[t]=r,++e._eventsCount;else if("function"==typeof s?s=a[t]=i?[r,s]:[s,r]:i?s.unshift(r):s.push(r),(n=h(e))>0&&s.length>n&&!s.warned){s.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=e,u.type=t,u.count=s.length,o=u,console&&console.warn&&console.warn(o)}return e}function f(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function d(e,t,r){var i={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},n=f.bind(i);return n.listener=r,i.wrapFn=n,n}function p(e,t,r){var i=e._events;if(void 0===i)return[];var n=i[t];return void 0===n?[]:"function"==typeof n?r?[n.listener||n]:[n]:r?function(e){for(var t=new Array(e.length),r=0;r0&&(s=t[0]),s instanceof Error)throw s;var o=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw o.context=s,o}var u=n[e];if(void 0===u)return!1;if("function"==typeof u)a(u,this,t);else{var l=u.length,h=g(u,l);for(r=0;r=0;a--)if(r[a]===t||r[a].listener===t){s=r[a].listener,n=a;break}if(n<0)return this;0===n?r.shift():function(e,t){for(;t+1=0;i--)this.removeListener(e,t[i]);return this},o.prototype.listeners=function(e){return p(this,e,!0)},o.prototype.rawListeners=function(e){return p(this,e,!1)},o.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):m.call(e,t)},o.prototype.listenerCount=m,o.prototype.eventNames=function(){return this._eventsCount>0?i(this._events):[]}},function(e,t,r){(t=e.exports=r(348)).Stream=t,t.Readable=t,t.Writable=r(309),t.Duplex=r(112),t.Transform=r(352),t.PassThrough=r(586)},function(e,t,r){var i=r(51),n=i.Buffer;function a(e,t){for(var r in e)t[r]=e[r]}function s(e,t,r){return n(e,t,r)}n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow?e.exports=i:(a(i,t),t.Buffer=s),a(n,s),s.from=function(e,t,r){if("number"==typeof e)throw new TypeError("Argument must not be a number");return n(e,t,r)},s.alloc=function(e,t,r){if("number"!=typeof e)throw new TypeError("Argument must be a number");var i=n(e);return void 0!==t?"string"==typeof r?i.fill(t,r):i.fill(t):i.fill(0),i},s.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return n(e)},s.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return i.SlowBuffer(e)}},function(e,t,r){"use strict";(function(t){var i=r(282);function n(e){var t=this;this.next=null,this.entry=null,this.finish=function(){!function(e,t,r){var i=e.entry;e.entry=null;for(;i;){var n=i.callback;t.pendingcb--,n(r),i=i.next}t.corkedRequestsFree?t.corkedRequestsFree.next=e:t.corkedRequestsFree=e}(t,e)}}e.exports=g;var a,s=i.nextTick;g.WritableState=m;var o=Object.create(r(127));o.inherits=r(117);var u={deprecate:r(584)},l=r(349),h=r(308).Buffer,c=t.Uint8Array||function(){};var f,d=r(350);function p(){}function m(e,t){a=a||r(112),e=e||{};var o=t instanceof a;this.objectMode=!!e.objectMode,o&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var u=e.highWaterMark,l=e.writableHighWaterMark,h=this.objectMode?16:16384;this.highWaterMark=u||0===u?u:o&&(l||0===l)?l:h,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var c=!1===e.decodeStrings;this.decodeStrings=!c,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){!function(e,t){var r=e._writableState,n=r.sync,a=r.writecb;if(function(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}(r),t)!function(e,t,r,n,a){--t.pendingcb,r?(i.nextTick(a,n),i.nextTick(E,e,t),e._writableState.errorEmitted=!0,e.emit("error",n)):(a(n),e._writableState.errorEmitted=!0,e.emit("error",n),E(e,t))}(e,r,n,t,a);else{var o=v(r);o||r.corked||r.bufferProcessing||!r.bufferedRequest||_(e,r),n?s(y,e,r,o,a):y(e,r,o,a)}}(t,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new n(this)}function g(e){if(a=a||r(112),!(f.call(g,this)||this instanceof a))return new g(e);this._writableState=new m(e,this),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),l.call(this)}function b(e,t,r,i,n,a,s){t.writelen=i,t.writecb=s,t.writing=!0,t.sync=!0,r?e._writev(n,t.onwrite):e._write(n,a,t.onwrite),t.sync=!1}function y(e,t,r,i){r||function(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}(e,t),t.pendingcb--,i(),E(e,t)}function _(e,t){t.bufferProcessing=!0;var r=t.bufferedRequest;if(e._writev&&r&&r.next){var i=t.bufferedRequestCount,a=new Array(i),s=t.corkedRequestsFree;s.entry=r;for(var o=0,u=!0;r;)a[o]=r,r.isBuf||(u=!1),r=r.next,o+=1;a.allBuffers=u,b(e,t,!0,t.length,a,"",s.finish),t.pendingcb++,t.lastBufferedRequest=null,s.next?(t.corkedRequestsFree=s.next,s.next=null):t.corkedRequestsFree=new n(t),t.bufferedRequestCount=0}else{for(;r;){var l=r.chunk,h=r.encoding,c=r.callback;if(b(e,t,!1,t.objectMode?1:l.length,l,h,c),r=r.next,t.bufferedRequestCount--,t.writing)break}null===r&&(t.lastBufferedRequest=null)}t.bufferedRequest=r,t.bufferProcessing=!1}function v(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function w(e,t){e._final((function(r){t.pendingcb--,r&&e.emit("error",r),t.prefinished=!0,e.emit("prefinish"),E(e,t)}))}function E(e,t){var r=v(t);return r&&(!function(e,t){t.prefinished||t.finalCalled||("function"==typeof e._final?(t.pendingcb++,t.finalCalled=!0,i.nextTick(w,e,t)):(t.prefinished=!0,e.emit("prefinish")))}(e,t),0===t.pendingcb&&(t.finished=!0,e.emit("finish"))),r}o.inherits(g,l),m.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(m.prototype,"buffer",{get:u.deprecate((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(e){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(f=Function.prototype[Symbol.hasInstance],Object.defineProperty(g,Symbol.hasInstance,{value:function(e){return!!f.call(this,e)||this===g&&(e&&e._writableState instanceof m)}})):f=function(e){return e instanceof this},g.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},g.prototype.write=function(e,t,r){var n,a=this._writableState,s=!1,o=!a.objectMode&&(n=e,h.isBuffer(n)||n instanceof c);return o&&!h.isBuffer(e)&&(e=function(e){return h.from(e)}(e)),"function"==typeof t&&(r=t,t=null),o?t="buffer":t||(t=a.defaultEncoding),"function"!=typeof r&&(r=p),a.ended?function(e,t){var r=new Error("write after end");e.emit("error",r),i.nextTick(t,r)}(this,r):(o||function(e,t,r,n){var a=!0,s=!1;return null===r?s=new TypeError("May not write null values to stream"):"string"==typeof r||void 0===r||t.objectMode||(s=new TypeError("Invalid non-string/buffer chunk")),s&&(e.emit("error",s),i.nextTick(n,s),a=!1),a}(this,a,e,r))&&(a.pendingcb++,s=function(e,t,r,i,n,a){if(!r){var s=function(e,t,r){e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=h.from(t,r));return t}(t,i,n);i!==s&&(r=!0,n="buffer",i=s)}var o=t.objectMode?1:i.length;t.length+=o;var u=t.length-1))throw new TypeError("Unknown encoding: "+e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(g.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),g.prototype._write=function(e,t,r){r(new Error("_write() is not implemented"))},g.prototype._writev=null,g.prototype.end=function(e,t,r){var n=this._writableState;"function"==typeof e?(r=e,e=null,t=null):"function"==typeof t&&(r=t,t=null),null!=e&&this.write(e,t),n.corked&&(n.corked=1,this.uncork()),n.ending||n.finished||function(e,t,r){t.ending=!0,E(e,t),r&&(t.finished?i.nextTick(r):e.once("finish",r));t.ended=!0,e.writable=!1}(this,n,r)},Object.defineProperty(g.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),g.prototype.destroy=d.destroy,g.prototype._undestroy=d.undestroy,g.prototype._destroy=function(e,t){this.end(),t(e)}}).call(this,r(88))},,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,function(e,t){t.read=function(e,t,r,i,n){var a,s,o=8*n-i-1,u=(1<>1,h=-7,c=r?n-1:0,f=r?-1:1,d=e[t+c];for(c+=f,a=d&(1<<-h)-1,d>>=-h,h+=o;h>0;a=256*a+e[t+c],c+=f,h-=8);for(s=a&(1<<-h)-1,a>>=-h,h+=i;h>0;s=256*s+e[t+c],c+=f,h-=8);if(0===a)a=1-l;else{if(a===u)return s?NaN:1/0*(d?-1:1);s+=Math.pow(2,i),a-=l}return(d?-1:1)*s*Math.pow(2,a-i)},t.write=function(e,t,r,i,n,a){var s,o,u,l=8*a-n-1,h=(1<>1,f=23===n?Math.pow(2,-24)-Math.pow(2,-77):0,d=i?0:a-1,p=i?1:-1,m=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(o=isNaN(t)?1:0,s=h):(s=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-s))<1&&(s--,u*=2),(t+=s+c>=1?f/u:f*Math.pow(2,1-c))*u>=2&&(s++,u/=2),s+c>=h?(o=0,s=h):s+c>=1?(o=(t*u-1)*Math.pow(2,n),s+=c):(o=t*Math.pow(2,c-1)*Math.pow(2,n),s=0));n>=8;e[r+d]=255&o,d+=p,o/=256,n-=8);for(s=s<0;e[r+d]=255&s,d+=p,s/=256,l-=8);e[r+d-p]|=128*m}},function(e,t){var r={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==r.call(e)}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=r(102),n=r(556),a=r(623),s=r(116),o=r(281),u=r(624);function l(e,t,r){return!e.fileSize&&r&&r.fileSize&&(e.fileSize=r.fileSize),n.ParserFactory.parseOnContentType(e,t,r)}async function h(e,t={}){let r=e.fileSize;if(await o.hasID3v1Header(e)){r-=128;r-=await u.getLyricsHeaderLength(e)}t.apeHeader=await s.APEv2Parser.findApeFooterOffset(e,r)}t.parseStream=function(e,t,r={}){return l(i.fromStream(e),t,r)},t.parseBuffer=async function(e,t,r={}){const n=new a.RandomBufferReader(e);return await h(n,r),l(i.fromBuffer(e),t,r)},t.parseFromTokenizer=l,t.orderTags=function(e){const t={};for(const r of e)(t[r.id]=t[r.id]||[]).push(r.value);return t},t.ratingToStars=function(e){return void 0===e?0:1+Math.round(4*e)},t.scanAppendingHeaders=h},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.defaultMessages="End-Of-Stream";class i extends Error{constructor(){super(t.defaultMessages)}}t.EndOfStreamError=i},function(module,exports,__webpack_require__){"use strict";(function(Buffer){const{multiByteIndexOf:multiByteIndexOf,stringToBytes:stringToBytes,readUInt64LE:readUInt64LE,tarHeaderChecksumMatches:tarHeaderChecksumMatches,uint8ArrayUtf8ByteString:uint8ArrayUtf8ByteString}=__webpack_require__(557),supported=__webpack_require__(558),xpiZipFilename=stringToBytes("META-INF/mozilla.rsa"),oxmlContentTypes=stringToBytes("[Content_Types].xml"),oxmlRels=stringToBytes("_rels/.rels"),fileType=e=>{if(!(e instanceof Uint8Array||e instanceof ArrayBuffer||Buffer.isBuffer(e)))throw new TypeError(`Expected the \`input\` argument to be of type \`Uint8Array\` or \`Buffer\` or \`ArrayBuffer\`, got \`${typeof e}\``);const t=e instanceof Uint8Array?e:new Uint8Array(e);if(!(t&&t.length>1))return;const r=(e,r)=>{r={offset:0,...r};for(let i=0;ir(stringToBytes(e),t);if(r([255,216,255]))return{ext:"jpg",mime:"image/jpeg"};if(r([137,80,78,71,13,10,26,10])){const e=33,r=t.findIndex((r,i)=>i>=e&&73===t[i]&&68===t[i+1]&&65===t[i+2]&&84===t[i+3]),i=t.subarray(e,r);return i.findIndex((e,t)=>97===i[t]&&99===i[t+1]&&84===i[t+2]&&76===i[t+3])>=0?{ext:"apng",mime:"image/apng"}:{ext:"png",mime:"image/png"}}if(r([71,73,70]))return{ext:"gif",mime:"image/gif"};if(r([87,69,66,80],{offset:8}))return{ext:"webp",mime:"image/webp"};if(r([70,76,73,70]))return{ext:"flif",mime:"image/flif"};if((r([73,73,42,0])||r([77,77,0,42]))&&r([67,82],{offset:8}))return{ext:"cr2",mime:"image/x-canon-cr2"};if(r([73,73,82,79,8,0,0,0,24]))return{ext:"orf",mime:"image/x-olympus-orf"};if(r([73,73,42,0])&&(r([16,251,134,1],{offset:4})||r([8,0,0,0],{offset:4}))&&r([0,254,0,4,0,1,0,0,0,1,0,0,0,3,1],{offset:9}))return{ext:"arw",mime:"image/x-sony-arw"};if(r([73,73,42,0,8,0,0,0])&&(r([45,0,254,0],{offset:8})||r([39,0,254,0],{offset:8})))return{ext:"dng",mime:"image/x-adobe-dng"};if(r([73,73,42,0])&&r([28,0,254,0],{offset:8}))return{ext:"nef",mime:"image/x-nikon-nef"};if(r([73,73,85,0,24,0,0,0,136,231,116,216]))return{ext:"rw2",mime:"image/x-panasonic-rw2"};if(i("FUJIFILMCCD-RAW"))return{ext:"raf",mime:"image/x-fujifilm-raf"};if(r([73,73,42,0])||r([77,77,0,42]))return{ext:"tif",mime:"image/tiff"};if(r([66,77]))return{ext:"bmp",mime:"image/bmp"};if(r([73,73,188]))return{ext:"jxr",mime:"image/vnd.ms-photo"};if(r([56,66,80,83]))return{ext:"psd",mime:"image/vnd.adobe.photoshop"};const n=[80,75,3,4];if(r(n)){if(r([109,105,109,101,116,121,112,101,97,112,112,108,105,99,97,116,105,111,110,47,101,112,117,98,43,122,105,112],{offset:30}))return{ext:"epub",mime:"application/epub+zip"};if(r(xpiZipFilename,{offset:30}))return{ext:"xpi",mime:"application/x-xpinstall"};if(i("mimetypeapplication/vnd.oasis.opendocument.text",{offset:30}))return{ext:"odt",mime:"application/vnd.oasis.opendocument.text"};if(i("mimetypeapplication/vnd.oasis.opendocument.spreadsheet",{offset:30}))return{ext:"ods",mime:"application/vnd.oasis.opendocument.spreadsheet"};if(i("mimetypeapplication/vnd.oasis.opendocument.presentation",{offset:30}))return{ext:"odp",mime:"application/vnd.oasis.opendocument.presentation"};let e,a=0,s=!1;do{const o=a+30;if(s||(s=r(oxmlContentTypes,{offset:o})||r(oxmlRels,{offset:o})),e||(i("word/",{offset:o})?e={ext:"docx",mime:"application/vnd.openxmlformats-officedocument.wordprocessingml.document"}:i("ppt/",{offset:o})?e={ext:"pptx",mime:"application/vnd.openxmlformats-officedocument.presentationml.presentation"}:i("xl/",{offset:o})&&(e={ext:"xlsx",mime:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"})),s&&e)return e;a=multiByteIndexOf(t,n,o)}while(a>=0);if(e)return e}if(r([80,75])&&(3===t[2]||5===t[2]||7===t[2])&&(4===t[3]||6===t[3]||8===t[3]))return{ext:"zip",mime:"application/zip"};if(r([48,48,48,48,48,48],{offset:148,mask:[248,248,248,248,248,248]})&&tarHeaderChecksumMatches(t))return{ext:"tar",mime:"application/x-tar"};if(r([82,97,114,33,26,7])&&(0===t[6]||1===t[6]))return{ext:"rar",mime:"application/x-rar-compressed"};if(r([31,139,8]))return{ext:"gz",mime:"application/gzip"};if(r([66,90,104]))return{ext:"bz2",mime:"application/x-bzip2"};if(r([55,122,188,175,39,28]))return{ext:"7z",mime:"application/x-7z-compressed"};if(r([120,1]))return{ext:"dmg",mime:"application/x-apple-diskimage"};if(r([102,114,101,101],{offset:4})||r([109,100,97,116],{offset:4})||r([109,111,111,118],{offset:4})||r([119,105,100,101],{offset:4}))return{ext:"mov",mime:"video/quicktime"};if(i("ftyp",{offset:4})&&0!=(96&t[8])){const e=uint8ArrayUtf8ByteString(t,8,12).replace("\0"," ").trim();switch(e){case"mif1":return{ext:"heic",mime:"image/heif"};case"msf1":return{ext:"heic",mime:"image/heif-sequence"};case"heic":case"heix":return{ext:"heic",mime:"image/heic"};case"hevc":case"hevx":return{ext:"heic",mime:"image/heic-sequence"};case"qt":return{ext:"mov",mime:"video/quicktime"};case"M4V":case"M4VH":case"M4VP":return{ext:"m4v",mime:"video/x-m4v"};case"M4P":return{ext:"m4p",mime:"video/mp4"};case"M4B":return{ext:"m4b",mime:"audio/mp4"};case"M4A":return{ext:"m4a",mime:"audio/x-m4a"};case"F4V":return{ext:"f4v",mime:"video/mp4"};case"F4P":return{ext:"f4p",mime:"video/mp4"};case"F4A":return{ext:"f4a",mime:"audio/mp4"};case"F4B":return{ext:"f4b",mime:"audio/mp4"};default:return e.startsWith("3g")?e.startsWith("3g2")?{ext:"3g2",mime:"video/3gpp2"}:{ext:"3gp",mime:"video/3gpp"}:{ext:"mp4",mime:"video/mp4"}}}if(r([77,84,104,100]))return{ext:"mid",mime:"audio/midi"};if(r([26,69,223,163])){const e=t.subarray(4,4100),r=e.findIndex((e,t,r)=>66===r[t]&&130===r[t+1]);if(-1!==r){const t=r+3,i=r=>[...r].every((r,i)=>e[t+i]===r.charCodeAt(0));if(i("matroska"))return{ext:"mkv",mime:"video/x-matroska"};if(i("webm"))return{ext:"webm",mime:"video/webm"}}}if(r([82,73,70,70])){if(r([65,86,73],{offset:8}))return{ext:"avi",mime:"video/vnd.avi"};if(r([87,65,86,69],{offset:8}))return{ext:"wav",mime:"audio/vnd.wave"};if(r([81,76,67,77],{offset:8}))return{ext:"qcp",mime:"audio/qcelp"}}if(r([48,38,178,117,142,102,207,17,166,217])){let e=30;do{const i=readUInt64LE(t,e+16);if(r([145,7,220,183,183,169,207,17,142,230,0,192,12,32,83,101],{offset:e})){if(r([64,158,105,248,77,91,207,17,168,253,0,128,95,92,68,43],{offset:e+24}))return{ext:"wma",mime:"audio/x-ms-wma"};if(r([192,239,25,188,77,91,207,17,168,253,0,128,95,92,68,43],{offset:e+24}))return{ext:"wmv",mime:"video/x-ms-asf"};break}e+=i}while(e+24<=t.length);return{ext:"asf",mime:"application/vnd.ms-asf"}}if(r([0,0,1,186])||r([0,0,1,179]))return{ext:"mpg",mime:"video/mpeg"};for(let e=0;e<2&&enew Promise((resolve,reject)=>{const stream=eval("require")("stream");readableStream.on("error",reject),readableStream.once("readable",()=>{const e=new stream.PassThrough,t=readableStream.read(module.exports.minimumBytes)||readableStream.read();try{e.fileType=fileType(t)}catch(e){reject(e)}readableStream.unshift(t),stream.pipeline?resolve(stream.pipeline(readableStream,e,()=>{})):resolve(readableStream.pipe(e))})}),Object.defineProperty(fileType,"extensions",{get:()=>new Set(supported.extensions)}),Object.defineProperty(fileType,"mimeTypes",{get:()=>new Set(supported.mimeTypes)})}).call(this,__webpack_require__(51).Buffer)},function(e,t,r){e.exports=n;var i=r(306).EventEmitter;function n(){i.call(this)}r(117)(n,i),n.Readable=r(307),n.Writable=r(587),n.Duplex=r(588),n.Transform=r(589),n.PassThrough=r(590),n.Stream=n,n.prototype.pipe=function(e,t){var r=this;function n(t){e.writable&&!1===e.write(t)&&r.pause&&r.pause()}function a(){r.readable&&r.resume&&r.resume()}r.on("data",n),e.on("drain",a),e._isStdio||t&&!1===t.end||(r.on("end",o),r.on("close",u));var s=!1;function o(){s||(s=!0,e.end())}function u(){s||(s=!0,"function"==typeof e.destroy&&e.destroy())}function l(e){if(h(),0===i.listenerCount(this,"error"))throw e}function h(){r.removeListener("data",n),e.removeListener("drain",a),r.removeListener("end",o),r.removeListener("close",u),r.removeListener("error",l),e.removeListener("error",l),r.removeListener("end",h),r.removeListener("close",h),e.removeListener("close",h)}return r.on("error",l),e.on("error",l),r.on("end",h),r.on("close",h),e.on("close",h),e.emit("pipe",r),e}},function(e,t,r){"use strict";(function(t,i){var n=r(282);e.exports=_;var a,s=r(343);_.ReadableState=y;r(306).EventEmitter;var o=function(e,t){return e.listeners(t).length},u=r(349),l=r(308).Buffer,h=t.Uint8Array||function(){};var c=Object.create(r(127));c.inherits=r(117);var f=r(581),d=void 0;d=f&&f.debuglog?f.debuglog("stream"):function(){};var p,m=r(582),g=r(350);c.inherits(_,u);var b=["error","close","destroy","pause","resume"];function y(e,t){e=e||{};var i=t instanceof(a=a||r(112));this.objectMode=!!e.objectMode,i&&(this.objectMode=this.objectMode||!!e.readableObjectMode);var n=e.highWaterMark,s=e.readableHighWaterMark,o=this.objectMode?16:16384;this.highWaterMark=n||0===n?n:i&&(s||0===s)?s:o,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new m,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(p||(p=r(351).StringDecoder),this.decoder=new p(e.encoding),this.encoding=e.encoding)}function _(e){if(a=a||r(112),!(this instanceof _))return new _(e);this._readableState=new y(e,this),this.readable=!0,e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy)),u.call(this)}function v(e,t,r,i,n){var a,s=e._readableState;null===t?(s.reading=!1,function(e,t){if(t.ended)return;if(t.decoder){var r=t.decoder.end();r&&r.length&&(t.buffer.push(r),t.length+=t.objectMode?1:r.length)}t.ended=!0,k(e)}(e,s)):(n||(a=function(e,t){var r;i=t,l.isBuffer(i)||i instanceof h||"string"==typeof t||void 0===t||e.objectMode||(r=new TypeError("Invalid non-string/buffer chunk"));var i;return r}(s,t)),a?e.emit("error",a):s.objectMode||t&&t.length>0?("string"==typeof t||s.objectMode||Object.getPrototypeOf(t)===l.prototype||(t=function(e){return l.from(e)}(t)),i?s.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):w(e,s,t,!0):s.ended?e.emit("error",new Error("stream.push() after EOF")):(s.reading=!1,s.decoder&&!r?(t=s.decoder.write(t),s.objectMode||0!==t.length?w(e,s,t,!1):S(e,s)):w(e,s,t,!1))):i||(s.reading=!1));return function(e){return!e.ended&&(e.needReadable||e.lengtht.highWaterMark&&(t.highWaterMark=function(e){return e>=8388608?e=8388608:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function k(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(d("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?n.nextTick(T,e):T(e))}function T(e){d("emit readable"),e.emit("readable"),A(e)}function S(e,t){t.readingMore||(t.readingMore=!0,n.nextTick(x,e,t))}function x(e,t){for(var r=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=t.length?(r=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):r=function(e,t,r){var i;ea.length?a.length:e;if(s===a.length?n+=a:n+=a.slice(0,e),0===(e-=s)){s===a.length?(++i,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=a.slice(s));break}++i}return t.length-=i,n}(e,t):function(e,t){var r=l.allocUnsafe(e),i=t.head,n=1;i.data.copy(r),e-=i.data.length;for(;i=i.next;){var a=i.data,s=e>a.length?a.length:e;if(a.copy(r,r.length-e,0,s),0===(e-=s)){s===a.length?(++n,i.next?t.head=i.next:t.head=t.tail=null):(t.head=i,i.data=a.slice(s));break}++n}return t.length-=n,r}(e,t);return i}(e,t.buffer,t.decoder),r);var r}function P(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,n.nextTick(R,t,e))}function R(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function B(e,t){for(var r=0,i=e.length;r=t.highWaterMark||t.ended))return d("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?P(this):k(this),null;if(0===(e=E(e,t))&&t.ended)return 0===t.length&&P(this),null;var i,n=t.needReadable;return d("need readable",n),(0===t.length||t.length-e0?M(e,t):null)?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),r!==e&&t.ended&&P(this)),null!==i&&this.emit("data",i),i},_.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))},_.prototype.pipe=function(e,t){var r=this,a=this._readableState;switch(a.pipesCount){case 0:a.pipes=e;break;case 1:a.pipes=[a.pipes,e];break;default:a.pipes.push(e)}a.pipesCount+=1,d("pipe count=%d opts=%j",a.pipesCount,t);var u=(!t||!1!==t.end)&&e!==i.stdout&&e!==i.stderr?h:_;function l(t,i){d("onunpipe"),t===r&&i&&!1===i.hasUnpiped&&(i.hasUnpiped=!0,d("cleanup"),e.removeListener("close",b),e.removeListener("finish",y),e.removeListener("drain",c),e.removeListener("error",g),e.removeListener("unpipe",l),r.removeListener("end",h),r.removeListener("end",_),r.removeListener("data",m),f=!0,!a.awaitDrain||e._writableState&&!e._writableState.needDrain||c())}function h(){d("onend"),e.end()}a.endEmitted?n.nextTick(u):r.once("end",u),e.on("unpipe",l);var c=function(e){return function(){var t=e._readableState;d("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&o(e,"data")&&(t.flowing=!0,A(e))}}(r);e.on("drain",c);var f=!1;var p=!1;function m(t){d("ondata"),p=!1,!1!==e.write(t)||p||((1===a.pipesCount&&a.pipes===e||a.pipesCount>1&&-1!==B(a.pipes,e))&&!f&&(d("false write response, pause",r._readableState.awaitDrain),r._readableState.awaitDrain++,p=!0),r.pause())}function g(t){d("onerror",t),_(),e.removeListener("error",g),0===o(e,"error")&&e.emit("error",t)}function b(){e.removeListener("finish",y),_()}function y(){d("onfinish"),e.removeListener("close",b),_()}function _(){d("unpipe"),r.unpipe(e)}return r.on("data",m),function(e,t,r){if("function"==typeof e.prependListener)return e.prependListener(t,r);e._events&&e._events[t]?s(e._events[t])?e._events[t].unshift(r):e._events[t]=[r,e._events[t]]:e.on(t,r)}(e,"error",g),e.once("close",b),e.once("finish",y),e.emit("pipe",r),a.flowing||(d("pipe resume"),r.resume()),e},_.prototype.unpipe=function(e){var t=this._readableState,r={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes||(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,r)),this;if(!e){var i=t.pipes,n=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var a=0;a>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function o(e){var t=this.lastTotal-this.lastNeed,r=function(e,t,r){if(128!=(192&t[0]))return e.lastNeed=0,"�";if(e.lastNeed>1&&t.length>1){if(128!=(192&t[1]))return e.lastNeed=1,"�";if(e.lastNeed>2&&t.length>2&&128!=(192&t[2]))return e.lastNeed=2,"�"}}(this,e);return void 0!==r?r:this.lastNeed<=e.length?(e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(e.copy(this.lastChar,t,0,e.length),void(this.lastNeed-=e.length))}function u(e,t){if((e.length-t)%2==0){var r=e.toString("utf16le",t);if(r){var i=r.charCodeAt(r.length-1);if(i>=55296&&i<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function l(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,r)}return t}function h(e,t){var r=(e.length-t)%3;return 0===r?e.toString("base64",t):(this.lastNeed=3-r,this.lastTotal=3,1===r?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-r))}function c(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function f(e){return e.toString(this.encoding)}function d(e){return e&&e.length?this.write(e):""}t.StringDecoder=a,a.prototype.write=function(e){if(0===e.length)return"";var t,r;if(this.lastNeed){if(void 0===(t=this.fillLast(e)))return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r=0)return n>0&&(e.lastNeed=n-1),n;if(--i=0)return n>0&&(e.lastNeed=n-2),n;if(--i=0)return n>0&&(2===n?n=0:e.lastNeed=n-3),n;return 0}(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=r;var i=e.length-(r-this.lastNeed);return e.copy(this.lastChar,0,i),e.toString("utf8",t,i)},a.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length}},function(e,t,r){"use strict";e.exports=s;var i=r(112),n=Object.create(r(127));function a(e,t){var r=this._transformState;r.transforming=!1;var i=r.writecb;if(!i)return this.emit("error",new Error("write callback called multiple times"));r.writechunk=null,r.writecb=null,null!=t&&this.push(t),i(e);var n=this._readableState;n.reading=!1,(n.needReadable||n.length({packetType:e.readUInt8(t),vorbis:new i.StringType(6,"ascii").get(e,t+1)})},t.IdentificationHeader={len:23,get:(e,t)=>({version:e.readUInt32LE(t+0),channelMode:e.readUInt8(t+4),sampleRate:e.readUInt32LE(t+5),bitrateMax:e.readUInt32LE(t+9),bitrateNominal:e.readUInt32LE(t+13),bitrateMin:e.readUInt32LE(t+17)})}}).call(this,r(51).Buffer)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=r(37);t.VorbisDecoder=class{constructor(e,t){this.data=e,this.offset=t}readInt32(){const e=i.UINT32_LE.get(this.data,this.offset);return this.offset+=4,e}readStringUtf8(){const e=this.readInt32(),t=this.data.toString("utf8",this.offset,this.offset+e);return this.offset+=e,t}parseUserComment(){const e=this.offset,t=this.readStringUtf8(),r=t.indexOf("=");return{key:t.slice(0,r).toUpperCase(),value:t.slice(r+1),len:this.offset-e}}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=r(37),n=r(75),a=r(70),s=r(52)("music-metadata:parser:MP4:atom");t.Header={len:8,get:(e,t)=>{const r=i.UINT32_BE.get(e,t);if(r<0)throw new Error("Invalid atom header length");return{length:r,name:n.FourCcToken.get(e,t+4)}},put:(e,t,r)=>(i.UINT32_BE.put(e,t,r.length),n.FourCcToken.put(e,t+4,r.name))},t.ExtendedSize=i.UINT64_BE,t.ftyp={len:4,get:(e,t)=>({type:new i.StringType(4,"ascii").get(e,t)})},t.tkhd={len:4,get:(e,t)=>({type:new i.StringType(4,"ascii").get(e,t)})},t.mhdr={len:8,get:(e,t)=>({version:i.UINT8.get(e,t+0),flags:i.UINT24_BE.get(e,t+1),nextItemID:i.UINT32_BE.get(e,t+4)})};class o{constructor(e,t,r){if(this.len=e,et&&s(`Warning: atom ${r} expected to be ${t}, but was actually ${e} bytes long.`)}}t.FixedLengthAtom=o;t.MdhdAtom=class extends o{constructor(e){super(e,24,"mdhd"),this.len=e}get(e,t){return{version:i.UINT8.get(e,t+0),flags:i.UINT24_BE.get(e,t+1),creationTime:i.UINT32_BE.get(e,t+4),modificationTime:i.UINT32_BE.get(e,t+8),timeScale:i.UINT32_BE.get(e,t+12),duration:i.UINT32_BE.get(e,t+16),language:i.UINT16_BE.get(e,t+20),quality:i.UINT16_BE.get(e,t+22)}}};t.MvhdAtom=class extends o{constructor(e){super(e,100,"mvhd"),this.len=e}get(e,t){return{version:i.UINT8.get(e,t),flags:i.UINT24_BE.get(e,t+1),creationTime:i.UINT32_BE.get(e,t+4),modificationTime:i.UINT32_BE.get(e,t+8),timeScale:i.UINT32_BE.get(e,t+12),duration:i.UINT32_BE.get(e,t+16),preferredRate:i.UINT32_BE.get(e,t+20),preferredVolume:i.UINT16_BE.get(e,t+24),previewTime:i.UINT32_BE.get(e,t+72),previewDuration:i.UINT32_BE.get(e,t+76),posterTime:i.UINT32_BE.get(e,t+80),selectionTime:i.UINT32_BE.get(e,t+84),selectionDuration:i.UINT32_BE.get(e,t+88),currentTime:i.UINT32_BE.get(e,t+92),nextTrackID:i.UINT32_BE.get(e,t+96)}}};t.DataAtom=class{constructor(e){this.len=e}get(e,t){return{type:{set:i.UINT8.get(e,t+0),type:i.UINT24_BE.get(e,t+1)},locale:i.UINT24_BE.get(e,t+4),value:new i.BufferType(this.len-8).get(e,t+8)}}};t.NameAtom=class{constructor(e){this.len=e}get(e,t){return{version:i.UINT8.get(e,t),flags:i.UINT24_BE.get(e,t+1),name:new i.StringType(this.len-4,"utf-8").get(e,t+4)}}};t.TrackHeaderAtom=class{constructor(e){this.len=e}get(e,t){return{version:i.UINT8.get(e,t),flags:i.UINT24_BE.get(e,t+1),creationTime:i.UINT32_BE.get(e,t+4),modificationTime:i.UINT32_BE.get(e,t+8),trackId:i.UINT32_BE.get(e,t+12),duration:i.UINT32_BE.get(e,t+20),layer:i.UINT16_BE.get(e,t+24),alternateGroup:i.UINT16_BE.get(e,t+26),volume:i.UINT16_BE.get(e,t+28)}}};const u=8,l=(e,t)=>({version:i.UINT8.get(e,t),flags:i.UINT24_BE.get(e,t+1),numberOfEntries:i.UINT32_BE.get(e,t+4)});class h{constructor(e){this.len=e}get(e,t){return{dataFormat:n.FourCcToken.get(e,t),dataReferenceIndex:i.UINT16_BE.get(e,t+10),description:new i.BufferType(this.len-12).get(e,t+12)}}}t.StsdAtom=class{constructor(e){this.len=e}get(e,t){const r=l(e,t);t+=u;const n=[];for(let a=0;a({version:i.INT16_BE.get(e,t),revision:i.INT16_BE.get(e,t+2),vendor:i.INT32_BE.get(e,t+4)})},t.SoundSampleDescriptionV0={len:12,get:(e,t)=>({numAudioChannels:i.INT16_BE.get(e,t+0),sampleSize:i.INT16_BE.get(e,t+2),compressionId:i.INT16_BE.get(e,t+4),packetSize:i.INT16_BE.get(e,t+6),sampleRate:i.UINT16_BE.get(e,t+8)+i.UINT16_BE.get(e,t+10)/1e4})};class c{constructor(e,t){this.len=e,this.token=t}get(e,t){const r=i.INT32_BE.get(e,t+4);return{version:i.INT8.get(e,t+0),flags:i.INT24_BE.get(e,t+1),numberOfEntries:r,entries:f(e,this.token,t+8,this.len-8,r)}}}t.TimeToSampleToken={len:8,get:(e,t)=>({count:i.INT32_BE.get(e,t+0),duration:i.INT32_BE.get(e,t+4)})};t.SttsAtom=class extends c{constructor(e){super(e,t.TimeToSampleToken),this.len=e}},t.SampleToChunkToken={len:12,get:(e,t)=>({firstChunk:i.INT32_BE.get(e,t),samplesPerChunk:i.INT32_BE.get(e,t+4),sampleDescriptionId:i.INT32_BE.get(e,t+8)})};t.StscAtom=class extends c{constructor(e){super(e,t.SampleToChunkToken),this.len=e}};t.StszAtom=class{constructor(e){this.len=e}get(e,t){const r=i.INT32_BE.get(e,t+8);return{version:i.INT8.get(e,t),flags:i.INT24_BE.get(e,t+1),sampleSize:i.INT32_BE.get(e,t+4),numberOfEntries:r,entries:f(e,i.INT32_BE,t+12,this.len-12,r)}}};t.StcoAtom=class extends c{constructor(e){super(e,i.INT32_BE),this.len=e}};function f(e,t,r,i,n){if(s(`remainingLen=${i}, numberOfEntries=${n} * token-len=${t.len}`),0===i)return[];a.equal(i,n*t.len,"mismatch number-of-entries with remaining atom-length");const o=[];for(let i=0;i{const i=new FileReader;i.onloadend=e=>{let r=e.target.result;r instanceof ArrayBuffer&&(r=s(new Uint8Array(e.target.result))),t(r)},i.onerror=e=>{r(new Error(e.type))},i.onabort=e=>{r(new Error(e.type))},i.readAsArrayBuffer(e)})}(e).then(r=>n.parseBuffer(r,e.type,t))},t.fetchFromUrl=async function(e,t){const r=await fetch(e),i=r.headers.get("Content-Type"),n=[];if(r.headers.forEach(e=>{n.push(e)}),r.ok){if(r.body){const e=await this.parseReadableStream(r.body,i,t);return o("Closing HTTP-readable-stream..."),r.body.locked||await r.body.cancel(),o("HTTP-readable-stream closed."),e}return this.parseBlob(await r.blob(),t)}throw new Error(`HTTP error status=${r.status}: ${r.statusText}`)}},function(e,t,r){var i;(function(){var r=function(e){return e instanceof r?e:this instanceof r?void(this.EXIFwrapped=e):new r(e)};e.exports&&(t=e.exports=r),t.EXIF=r;var a=r.Tags={36864:"ExifVersion",40960:"FlashpixVersion",40961:"ColorSpace",40962:"PixelXDimension",40963:"PixelYDimension",37121:"ComponentsConfiguration",37122:"CompressedBitsPerPixel",37500:"MakerNote",37510:"UserComment",40964:"RelatedSoundFile",36867:"DateTimeOriginal",36868:"DateTimeDigitized",37520:"SubsecTime",37521:"SubsecTimeOriginal",37522:"SubsecTimeDigitized",33434:"ExposureTime",33437:"FNumber",34850:"ExposureProgram",34852:"SpectralSensitivity",34855:"ISOSpeedRatings",34856:"OECF",37377:"ShutterSpeedValue",37378:"ApertureValue",37379:"BrightnessValue",37380:"ExposureBias",37381:"MaxApertureValue",37382:"SubjectDistance",37383:"MeteringMode",37384:"LightSource",37385:"Flash",37396:"SubjectArea",37386:"FocalLength",41483:"FlashEnergy",41484:"SpatialFrequencyResponse",41486:"FocalPlaneXResolution",41487:"FocalPlaneYResolution",41488:"FocalPlaneResolutionUnit",41492:"SubjectLocation",41493:"ExposureIndex",41495:"SensingMethod",41728:"FileSource",41729:"SceneType",41730:"CFAPattern",41985:"CustomRendered",41986:"ExposureMode",41987:"WhiteBalance",41988:"DigitalZoomRation",41989:"FocalLengthIn35mmFilm",41990:"SceneCaptureType",41991:"GainControl",41992:"Contrast",41993:"Saturation",41994:"Sharpness",41995:"DeviceSettingDescription",41996:"SubjectDistanceRange",40965:"InteroperabilityIFDPointer",42016:"ImageUniqueID"},s=r.TiffTags={256:"ImageWidth",257:"ImageHeight",34665:"ExifIFDPointer",34853:"GPSInfoIFDPointer",40965:"InteroperabilityIFDPointer",258:"BitsPerSample",259:"Compression",262:"PhotometricInterpretation",274:"Orientation",277:"SamplesPerPixel",284:"PlanarConfiguration",530:"YCbCrSubSampling",531:"YCbCrPositioning",282:"XResolution",283:"YResolution",296:"ResolutionUnit",273:"StripOffsets",278:"RowsPerStrip",279:"StripByteCounts",513:"JPEGInterchangeFormat",514:"JPEGInterchangeFormatLength",301:"TransferFunction",318:"WhitePoint",319:"PrimaryChromaticities",529:"YCbCrCoefficients",532:"ReferenceBlackWhite",306:"DateTime",270:"ImageDescription",271:"Make",272:"Model",305:"Software",315:"Artist",33432:"Copyright"},o=r.GPSTags={0:"GPSVersionID",1:"GPSLatitudeRef",2:"GPSLatitude",3:"GPSLongitudeRef",4:"GPSLongitude",5:"GPSAltitudeRef",6:"GPSAltitude",7:"GPSTimeStamp",8:"GPSSatellites",9:"GPSStatus",10:"GPSMeasureMode",11:"GPSDOP",12:"GPSSpeedRef",13:"GPSSpeed",14:"GPSTrackRef",15:"GPSTrack",16:"GPSImgDirectionRef",17:"GPSImgDirection",18:"GPSMapDatum",19:"GPSDestLatitudeRef",20:"GPSDestLatitude",21:"GPSDestLongitudeRef",22:"GPSDestLongitude",23:"GPSDestBearingRef",24:"GPSDestBearing",25:"GPSDestDistanceRef",26:"GPSDestDistance",27:"GPSProcessingMethod",28:"GPSAreaInformation",29:"GPSDateStamp",30:"GPSDifferential"},u=r.IFD1Tags={256:"ImageWidth",257:"ImageHeight",258:"BitsPerSample",259:"Compression",262:"PhotometricInterpretation",273:"StripOffsets",274:"Orientation",277:"SamplesPerPixel",278:"RowsPerStrip",279:"StripByteCounts",282:"XResolution",283:"YResolution",284:"PlanarConfiguration",296:"ResolutionUnit",513:"JpegIFOffset",514:"JpegIFByteCount",529:"YCbCrCoefficients",530:"YCbCrSubSampling",531:"YCbCrPositioning",532:"ReferenceBlackWhite"},l=r.StringValues={ExposureProgram:{0:"Not defined",1:"Manual",2:"Normal program",3:"Aperture priority",4:"Shutter priority",5:"Creative program",6:"Action program",7:"Portrait mode",8:"Landscape mode"},MeteringMode:{0:"Unknown",1:"Average",2:"CenterWeightedAverage",3:"Spot",4:"MultiSpot",5:"Pattern",6:"Partial",255:"Other"},LightSource:{0:"Unknown",1:"Daylight",2:"Fluorescent",3:"Tungsten (incandescent light)",4:"Flash",9:"Fine weather",10:"Cloudy weather",11:"Shade",12:"Daylight fluorescent (D 5700 - 7100K)",13:"Day white fluorescent (N 4600 - 5400K)",14:"Cool white fluorescent (W 3900 - 4500K)",15:"White fluorescent (WW 3200 - 3700K)",17:"Standard light A",18:"Standard light B",19:"Standard light C",20:"D55",21:"D65",22:"D75",23:"D50",24:"ISO studio tungsten",255:"Other"},Flash:{0:"Flash did not fire",1:"Flash fired",5:"Strobe return light not detected",7:"Strobe return light detected",9:"Flash fired, compulsory flash mode",13:"Flash fired, compulsory flash mode, return light not detected",15:"Flash fired, compulsory flash mode, return light detected",16:"Flash did not fire, compulsory flash mode",24:"Flash did not fire, auto mode",25:"Flash fired, auto mode",29:"Flash fired, auto mode, return light not detected",31:"Flash fired, auto mode, return light detected",32:"No flash function",65:"Flash fired, red-eye reduction mode",69:"Flash fired, red-eye reduction mode, return light not detected",71:"Flash fired, red-eye reduction mode, return light detected",73:"Flash fired, compulsory flash mode, red-eye reduction mode",77:"Flash fired, compulsory flash mode, red-eye reduction mode, return light not detected",79:"Flash fired, compulsory flash mode, red-eye reduction mode, return light detected",89:"Flash fired, auto mode, red-eye reduction mode",93:"Flash fired, auto mode, return light not detected, red-eye reduction mode",95:"Flash fired, auto mode, return light detected, red-eye reduction mode"},SensingMethod:{1:"Not defined",2:"One-chip color area sensor",3:"Two-chip color area sensor",4:"Three-chip color area sensor",5:"Color sequential area sensor",7:"Trilinear sensor",8:"Color sequential linear sensor"},SceneCaptureType:{0:"Standard",1:"Landscape",2:"Portrait",3:"Night scene"},SceneType:{1:"Directly photographed"},CustomRendered:{0:"Normal process",1:"Custom process"},WhiteBalance:{0:"Auto white balance",1:"Manual white balance"},GainControl:{0:"None",1:"Low gain up",2:"High gain up",3:"Low gain down",4:"High gain down"},Contrast:{0:"Normal",1:"Soft",2:"Hard"},Saturation:{0:"Normal",1:"Low saturation",2:"High saturation"},Sharpness:{0:"Normal",1:"Soft",2:"Hard"},SubjectDistanceRange:{0:"Unknown",1:"Macro",2:"Close view",3:"Distant view"},FileSource:{3:"DSC"},Components:{0:"",1:"Y",2:"Cb",3:"Cr",4:"R",5:"G",6:"B"}};function h(e){return!!e.exifdata}function c(e,t){function i(i){var n=f(i);e.exifdata=n||{};var a=function(e){var t=new DataView(e);0;if(255!=t.getUint8(0)||216!=t.getUint8(1))return!1;var r=2,i=e.byteLength,n=function(e,t){return 56===e.getUint8(t)&&66===e.getUint8(t+1)&&73===e.getUint8(t+2)&&77===e.getUint8(t+3)&&4===e.getUint8(t+4)&&4===e.getUint8(t+5)};for(;r")+8,l=(o=o.substring(o.indexOf("4?d:t+8,s=[],u=0;u4?d:t+8,f-1);case 3:if(1==f)return e.getUint16(t+8,!n);for(a=f>2?d:t+8,s=[],u=0;ue.byteLength)return{};var a=m(e,t,t+n,u,i);if(a.Compression)switch(a.Compression){case 6:if(a.JpegIFOffset&&a.JpegIFByteCount){var s=t+a.JpegIFOffset,o=a.JpegIFByteCount;a.blob=new Blob([new Uint8Array(e.buffer,s,o)],{type:"image/jpeg"})}break;case 1:console.log("Thumbnail image format is TIFF, which is not implemented.");break;default:console.log("Unknown thumbnail image format '%s'",a.Compression)}else 2==a.PhotometricInterpretation&&console.log("Thumbnail image format is RGB, which is not implemented.");return a}(e,f,d,r),i}function _(e){var t={};if(1==e.nodeType){if(e.attributes.length>0){t["@attributes"]={};for(var r=0;r0)for(var r=0;r{if(!t.isBuffer(e))return{};let n={},a=e.indexOf(i);for(;-1!==a;){a=e.indexOf(i,a+i.byteLength);let t=a+i.byteLength,s=t+1,o=s+2,u=e.readUInt8(t),l=e.readUInt16BE(s);if(!r.has(u))continue;if(l>e.length-(o+l))throw new Error("Invalid IPTC directory");let h=r.get(u),c=e.slice(o,o+l).toString();null==n[h]?n[h]=c:Array.isArray(n[h])?n[h].push(c):n[h]=[n[h],c]}return n}}).call(this,r(51).Buffer)},,,,,,,,,,,,,,function(e,t,r){e.exports=r(540)},function(e,t,r){"use strict";r.r(t),function(e){var t=r(523),i=r(524),n=r.n(i),a=r(525),s=r.n(a);r(542);window.mediaCloudReaderCache={readers:[],getFreeReader:function(){return this.readers.length>0?(console.log("Got cached reader."),this.readers.splice(0,1)[0]):new FileReader},cacheReader:function(e){this.readers.push(e)}},window.DirectUploadItem=Backbone.Model.extend({initialize:function(e){this.on("change:progress",this.updateProgress,this)},sizeToFitSize:function(e,t,r,i){if(e<=0||t<=0)return[r,i];if(r<=0&&i<=0)return[0,0];if(r<=0){if(t<=i)return[e,t];var n=i/t;return[Math.round(e*n),i]}if(i<=0){if(e<=r)return[e,t];var a=r/e;return[r,Math.round(t*a)]}var s=r/e,o=i/t;return s0&&(a.faces=t),console.log(a),jQuery.post(ajaxurl,a,function(e){_.each(["file","loaded","size","percent"],(function(e){n.unset(e)})),"success"==e.status?(n.set(_.extend(e.attachment,{uploading:!1})),wp.media.model.Attachment.get(e.attachment.id,n),this.set({state:"done"})):this.set({state:"error"}),wp.Uploader.queue.remove(n),wp.Uploader.queue.all((function(e){return!e.get("uploading")}))&&wp.Uploader.queue.reset()}.bind(this))},uploadFinished:function(r,i,a){var o=this.get("attachment").get("file"),u={filesize:o.size},l=this.get("mimeType");if(0===l.indexOf("audio/")){var h=l.split("/")[1];u.fileformat=h,t.parseBlob(o,{duration:!0}).then(function(e){this.assignAudioMetadata(e,u),this.doUploadFinished(r,i,u,a)}.bind(this)).catch(function(e){this.doUploadFinished(r,i,u,a)}.bind(this))}else if(0==l.indexOf("image/")){var c=mediaCloudReaderCache.getFreeReader();c.onload=function(t){var o={};try{o=s()(e.from(c.result))}catch(e){console.log("IPTC Error",e)}var l=n.a.readFromBinaryFile(c.result);this.assignImageMetadata(o,l,u),mediaCloudReaderCache.cacheReader(c),this.doUploadFinished(r,i,u,a)}.bind(this),c.onerror=function(e){mediaCloudReaderCache.cacheReader(c),this.doUploadFinished(r,i,u,a)}.bind(this),c.readAsArrayBuffer(o)}else this.doUploadFinished(r,i,u,a)},mapID3Meta:function(e,t,r,i){r.hasOwnProperty(e)&&(i[t]=r[e])},mapIndexedID3Meta:function(e,t,r,i){r.hasOwnProperty(e)&&r[e].length>0&&(i[t]=r[e][0])},assignAudioMetadata:function(e,t){if(this.mapID3Meta("album","album",e.common,t),this.mapID3Meta("artist","artist",e.common,t),this.mapIndexedID3Meta("genre","genre",e.common,t),this.mapID3Meta("title","title",e.common,t),e.common.hasOwnProperty("track")&&null!=e.common.track.no&&(t.track_number=e.common.track.no),this.mapID3Meta("year","year",e.common,t),this.mapIndexedID3Meta("composer","composer",e.common,t),this.mapIndexedID3Meta("lyricist","lyricist",e.common,t),this.mapIndexedID3Meta("writer","writer",e.common,t),this.mapIndexedID3Meta("conductor","conductor",e.common,t),this.mapIndexedID3Meta("remixer","remixer",e.common,t),this.mapIndexedID3Meta("arranger","arranger",e.common,t),this.mapIndexedID3Meta("engineer","engineer",e.common,t),this.mapIndexedID3Meta("producer","producer",e.common,t),this.mapIndexedID3Meta("djmixer","dj_mixer",e.common,t),this.mapIndexedID3Meta("mixer","mixer",e.common,t),this.mapIndexedID3Meta("technician","technician",e.common,t),this.mapIndexedID3Meta("label","label",e.common,t),this.mapIndexedID3Meta("subtitle","subtitle",e.common,t),this.mapIndexedID3Meta("compilation","compilation",e.common,t),this.mapID3Meta("bpm","bpm",e.common,t),this.mapID3Meta("mood","mood",e.common,t),this.mapID3Meta("media","media",e.common,t),this.mapID3Meta("tvShow","tv_show",e.common,t),this.mapID3Meta("tvSeason","tv_season",e.common,t),this.mapID3Meta("tvEpisode","tv_episode",e.common,t),this.mapID3Meta("tvNetwork","tv_network",e.common,t),this.mapID3Meta("podcast","podcast",e.common,t),this.mapID3Meta("podcasturl","podcast_url",e.common,t),this.mapID3Meta("releasestatus","release_status",e.common,t),this.mapID3Meta("releasetype","release_type",e.common,t),this.mapID3Meta("releasecountry","release_country",e.common,t),this.mapID3Meta("language","language",e.common,t),this.mapID3Meta("copyright","copyright",e.common,t),this.mapID3Meta("license","license",e.common,t),this.mapID3Meta("encodedby","encoded_by",e.common,t),this.mapID3Meta("encodersettings","encoder_options",e.common,t),this.mapID3Meta("gapless","gapless",e.common,t),this.mapID3Meta("barcode","barcode",e.common,t),this.mapID3Meta("asin","asin",e.common,t),this.mapID3Meta("website","website",e.common,t),this.mapID3Meta("averageLevel","average_level",e.common,t),this.mapID3Meta("peakLevel","peak_level",e.common,t),this.mapID3Meta("bitrate","bitrate",e.format,t),this.mapID3Meta("codec","dataformat",e.format,t),this.mapID3Meta("codecProfile","bitrate_mode",e.format,t),this.mapID3Meta("lossless","lossless",e.format,t),this.mapID3Meta("numberOfChannels","channels",e.format,t),this.mapID3Meta("duration","length",e.format,t),this.mapID3Meta("sampleRate","sample_rate",e.format,t),e.common.hasOwnProperty("picture")&&e.common.picture.length>0){var r=e.common.picture[0];t.thumbnail={mimeType:r.format,data:r.data.toString("base64")},t.image=[{mime:r.format}]}},mapImageMeta:function(e,t,r,i,n){if(t.hasOwnProperty(r)){var a=t[r];if("string"==e){if(!(o="string"==typeof a||a instanceof String))return;if(/[\x00-\x1F]/.test(a))return;i[n]=a.trim()}else if("strings"==e){if(o="string"==typeof a||a instanceof String){a=a.split(",");for(var s=0;s0&&(i[n]=a)}else if("date"==e){var o;if(!(o="string"==typeof a||a instanceof String))return;var u=a.split(" ");if(2!=u.length)return;var l=u[0].split(":");if(3!=l.length)return;var h=l[0],c=l[1],f=l[2],d=new Date("".concat(c,"/").concat(f,"/").concat(h," ").concat(u[1]));i[n]=(d.getTime()/1e3).toFixed(0)}else if("frac"==e){if(o)return;if(!("number"==typeof a||a instanceof Number))return;i[n]=a.numerator/a.denominator}else if("number"==e){if(o)return;if(!("number"==typeof a||a instanceof Number))return;i[n]=a}}},assignImageMetadata:function(e,t,r){var i={};this.mapImageMeta("string",e,"headline",i,"title"),this.mapImageMeta("string",e,"caption",i,"caption"),this.mapImageMeta("string",e,"credit",i,"credit"),this.mapImageMeta("string",e,"copyright",i,"copyright"),this.mapImageMeta("strings",e,"keywords",i,"keywords"),0!=t&&(this.mapImageMeta("string",t,"ImageDescription",i,"title"),i.hasOwnProperty("caption")||this.mapImageMeta("bytes",t,"UserComment",i,"caption"),i.hasOwnProperty("copyright")||this.mapImageMeta("bytes",t,"Copyright",i,"copyright"),this.mapImageMeta("string",t,"Artist",i,"credit"),i.hasOwnProperty("credit")||this.mapImageMeta("string",t,"Author",i,"credit"),this.mapImageMeta("string",t,"Copyright",i,"copyright"),this.mapImageMeta("string",t,"Model",i,"camera"),this.mapImageMeta("string",t,"ISOSpeedRatings",i,"iso"),this.mapImageMeta("number",t,"ISOSpeedRatings",i,"iso"),this.mapImageMeta("date",t,"DateTimeDigitized",i,"created_timestamp"),this.mapImageMeta("frac",t,"FocalLength",i,"focal_length"),this.mapImageMeta("frac",t,"FNumber",i,"aperture"),this.mapImageMeta("frac",t,"ExposureTime",i,"shutter_speed"),this.mapImageMeta("number",t,"Orientation",i,"orientation")),r.image_meta=i}}),window.DirectUploader=Backbone.Model.extend({initialize:function(e){this.totalFilesDropped=0,this.totalFilesUploaded=0,this.files=[],this.toBulkProcess=[],this.uploadingFiles=[],this.watchToken=0,this.settings=mediaCloudDirectUploadSettings},queueNext:function(){if(clearTimeout(this.watchToken),this.uploadingFiles.length0){for(var e=this.settings.maxUploads-this.uploadingFiles.length,t=0;t0){var r=this.files.shift();this.uploadingFiles.push(r),r.startUpload()}}else if(0==this.uploadingFiles.length&&this.toBulkProcess.length>0&&this.totalFilesDropped==this.totalFilesUploaded){var i={action:"ilab_upload_process_batch",batch:this.toBulkProcess};this.toBulkProcess=[],this.totalFilesDropped=0,this.totalFilesUploaded=0,jQuery.post(ajaxurl,i,(function(e){}))}this.watchToken=setTimeout(this.queueNext.bind(this),500)},addFile:function(e){if(""==e.type)return!1;var t=e.type;"application/x-photoshop"==t&&(t="image/psd");var r=-1!=this.settings.allowedMimes.indexOf(t);console.log("Is Direct Upload?",r);var i=t.split("/"),n=i[0],a=i[1];a="jpg"==a?"jpeg":a,this.totalFilesDropped++;var s={file:e,uploading:!0,date:new Date,filename:e.name,isDirectUpload:r,menuOrder:0,uploadedTo:wp.media.model.settings.post.id,loaded:0,size:e.size,percent:0,type:n,subType:a},o=wp.media.model.Attachment.create(s);wp.Uploader.queue.add(o),window.mediaCloudDirectUploadError=!1;var u=new DirectUploadItem({attachment:o,file:e,mimeType:t,isDirectUpload:r,progress:0,driver:this.settings.driver,faces:null,state:"waiting"});u.on("change:state",function(e,t){if("done"==t||"error"==t){this.totalFilesUploaded++,"done"==t&&this.toBulkProcess.push(o.id);var r=this.files.indexOf(u);r>-1&&this.files.splice(r),(r=this.uploadingFiles.indexOf(u))>-1&&this.uploadingFiles.splice(r),this.queueNext()}}.bind(this)),"undefined"!=typeof ILABFaceDetector?ILABFaceDetector(e,function(e){u.set("faces",e),this.files.push(u)}.bind(this)):this.files.push(u)}}),wp.media.view.UploaderWindow.prototype.__ready=wp.media.view.UploaderWindow.prototype.ready,wp.media.view.UploaderWindow.prototype.ready=function(){this.__ready(),this.directUploader=new DirectUploader({}),this.uploader.uploader.unbind("FilesAdded"),this.uploader.uploader.bind("FilesAdded",function(e,t){_.each(t,function(e){this.directUploader.addFile(e.getNative())}.bind(this)),this.directUploader.queueNext()}.bind(this))},wp.media.view.UploaderInline=wp.media.view.UploaderInline.extend({template:wp.template("media-cloud-direct-upload")})}.call(this,r(51).Buffer)},function(e,t,r){"use strict";t.byteLength=function(e){var t=l(e),r=t[0],i=t[1];return 3*(r+i)/4-i},t.toByteArray=function(e){var t,r,i=l(e),s=i[0],o=i[1],u=new a(function(e,t,r){return 3*(t+r)/4-r}(0,s,o)),h=0,c=o>0?s-4:s;for(r=0;r>16&255,u[h++]=t>>8&255,u[h++]=255&t;2===o&&(t=n[e.charCodeAt(r)]<<2|n[e.charCodeAt(r+1)]>>4,u[h++]=255&t);1===o&&(t=n[e.charCodeAt(r)]<<10|n[e.charCodeAt(r+1)]<<4|n[e.charCodeAt(r+2)]>>2,u[h++]=t>>8&255,u[h++]=255&t);return u},t.fromByteArray=function(e){for(var t,r=e.length,n=r%3,a=[],s=0,o=r-n;so?o:s+16383));1===n?(t=e[r-1],a.push(i[t>>2]+i[t<<4&63]+"==")):2===n&&(t=(e[r-2]<<8)+e[r-1],a.push(i[t>>10]+i[t>>4&63]+i[t<<2&63]+"="));return a.join("")};for(var i=[],n=[],a="undefined"!=typeof Uint8Array?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",o=0,u=s.length;o0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");return-1===r&&(r=t),[r,r===t?0:4-r%4]}function h(e,t,r){for(var n,a,s=[],o=t;o>18&63]+i[a>>12&63]+i[a>>6&63]+i[63&a]);return s.join("")}n["-".charCodeAt(0)]=62,n["_".charCodeAt(0)]=63},function(e,t,r){(function(t){if((void 0===r||!r)&&"undefined"!=typeof self)var r=self;e.exports=function e(t,r,i){function n(s,o){if(!r[s]){if(!t[s]){if(a)return a(s,!0);var u=new Error("Cannot find module '"+s+"'");throw u.code="MODULE_NOT_FOUND",u}var l=r[s]={exports:{}};t[s][0].call(l.exports,(function(e){return n(t[s][1][e]||e)}),l,l.exports,e,t,r,i)}return r[s].exports}for(var a=!1,s=0;s=s?(n[i++]=parseInt(r/s,10),r%=s):i>0&&(n[i++]=0);o=i,u=this.dstAlphabet.slice(r,r+1).concat(u)}while(0!==i);return u},i.prototype.isValid=function(e){for(var t=0;t0?t.windowBits=-t.windowBits:t.gzip&&t.windowBits>0&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new o,this.strm.avail_out=0;var r=i.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(0!==r)throw new Error(s[r]);if(t.header&&i.deflateSetHeader(this.strm,t.header),t.dictionary){var h;if(h="string"==typeof t.dictionary?a.string2buf(t.dictionary):"[object ArrayBuffer]"===u.call(t.dictionary)?new Uint8Array(t.dictionary):t.dictionary,0!==(r=i.deflateSetDictionary(this.strm,h)))throw new Error(s[r]);this._dict_set=!0}}function h(e,t){var r=new l(t);if(r.push(e,!0),r.err)throw r.msg||s[r.err];return r.result}l.prototype.push=function(e,t){var r,s,o=this.strm,l=this.options.chunkSize;if(this.ended)return!1;s=t===~~t?t:!0===t?4:0,"string"==typeof e?o.input=a.string2buf(e):"[object ArrayBuffer]"===u.call(e)?o.input=new Uint8Array(e):o.input=e,o.next_in=0,o.avail_in=o.input.length;do{if(0===o.avail_out&&(o.output=new n.Buf8(l),o.next_out=0,o.avail_out=l),1!==(r=i.deflate(o,s))&&0!==r)return this.onEnd(r),this.ended=!0,!1;0!==o.avail_out&&(0!==o.avail_in||4!==s&&2!==s)||("string"===this.options.to?this.onData(a.buf2binstring(n.shrinkBuf(o.output,o.next_out))):this.onData(n.shrinkBuf(o.output,o.next_out)))}while((o.avail_in>0||0===o.avail_out)&&1!==r);return 4===s?(r=i.deflateEnd(this.strm),this.onEnd(r),this.ended=!0,0===r):2!==s||(this.onEnd(0),o.avail_out=0,!0)},l.prototype.onData=function(e){this.chunks.push(e)},l.prototype.onEnd=function(e){0===e&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=n.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},r.Deflate=l,r.deflate=h,r.deflateRaw=function(e,t){return(t=t||{}).raw=!0,h(e,t)},r.gzip=function(e,t){return(t=t||{}).gzip=!0,h(e,t)}},{"./utils/common":89,"./utils/strings":90,"./zlib/deflate":94,"./zlib/messages":99,"./zlib/zstream":101}],88:[function(e,t,r){"use strict";var i=e("./zlib/inflate"),n=e("./utils/common"),a=e("./utils/strings"),s=e("./zlib/constants"),o=e("./zlib/messages"),u=e("./zlib/zstream"),l=e("./zlib/gzheader"),h=Object.prototype.toString;function c(e){if(!(this instanceof c))return new c(e);this.options=n.assign({chunkSize:16384,windowBits:0,to:""},e||{});var t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,0===t.windowBits&&(t.windowBits=-15)),!(t.windowBits>=0&&t.windowBits<16)||e&&e.windowBits||(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&0==(15&t.windowBits)&&(t.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new u,this.strm.avail_out=0;var r=i.inflateInit2(this.strm,t.windowBits);if(r!==s.Z_OK)throw new Error(o[r]);this.header=new l,i.inflateGetHeader(this.strm,this.header)}function f(e,t){var r=new c(t);if(r.push(e,!0),r.err)throw r.msg||o[r.err];return r.result}c.prototype.push=function(e,t){var r,o,u,l,c,f,d=this.strm,p=this.options.chunkSize,m=this.options.dictionary,g=!1;if(this.ended)return!1;o=t===~~t?t:!0===t?s.Z_FINISH:s.Z_NO_FLUSH,"string"==typeof e?d.input=a.binstring2buf(e):"[object ArrayBuffer]"===h.call(e)?d.input=new Uint8Array(e):d.input=e,d.next_in=0,d.avail_in=d.input.length;do{if(0===d.avail_out&&(d.output=new n.Buf8(p),d.next_out=0,d.avail_out=p),(r=i.inflate(d,s.Z_NO_FLUSH))===s.Z_NEED_DICT&&m&&(f="string"==typeof m?a.string2buf(m):"[object ArrayBuffer]"===h.call(m)?new Uint8Array(m):m,r=i.inflateSetDictionary(this.strm,f)),r===s.Z_BUF_ERROR&&!0===g&&(r=s.Z_OK,g=!1),r!==s.Z_STREAM_END&&r!==s.Z_OK)return this.onEnd(r),this.ended=!0,!1;d.next_out&&(0!==d.avail_out&&r!==s.Z_STREAM_END&&(0!==d.avail_in||o!==s.Z_FINISH&&o!==s.Z_SYNC_FLUSH)||("string"===this.options.to?(u=a.utf8border(d.output,d.next_out),l=d.next_out-u,c=a.buf2string(d.output,u),d.next_out=l,d.avail_out=p-l,l&&n.arraySet(d.output,d.output,u,l,0),this.onData(c)):this.onData(n.shrinkBuf(d.output,d.next_out)))),0===d.avail_in&&0===d.avail_out&&(g=!0)}while((d.avail_in>0||0===d.avail_out)&&r!==s.Z_STREAM_END);return r===s.Z_STREAM_END&&(o=s.Z_FINISH),o===s.Z_FINISH?(r=i.inflateEnd(this.strm),this.onEnd(r),this.ended=!0,r===s.Z_OK):o!==s.Z_SYNC_FLUSH||(this.onEnd(s.Z_OK),d.avail_out=0,!0)},c.prototype.onData=function(e){this.chunks.push(e)},c.prototype.onEnd=function(e){e===s.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=n.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},r.Inflate=c,r.inflate=f,r.inflateRaw=function(e,t){return(t=t||{}).raw=!0,f(e,t)},r.ungzip=f},{"./utils/common":89,"./utils/strings":90,"./zlib/constants":92,"./zlib/gzheader":95,"./zlib/inflate":97,"./zlib/messages":99,"./zlib/zstream":101}],89:[function(e,t,r){arguments[4][36][0].apply(r,arguments)},{dup:36}],90:[function(e,t,r){"use strict";var i=e("./common"),n=!0,a=!0;try{String.fromCharCode.apply(null,[0])}catch(e){n=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(e){a=!1}for(var s=new i.Buf8(256),o=0;o<256;o++)s[o]=o>=252?6:o>=248?5:o>=240?4:o>=224?3:o>=192?2:1;function u(e,t){if(t<65537&&(e.subarray&&a||!e.subarray&&n))return String.fromCharCode.apply(null,i.shrinkBuf(e,t));for(var r="",s=0;s>>6,t[s++]=128|63&r):r<65536?(t[s++]=224|r>>>12,t[s++]=128|r>>>6&63,t[s++]=128|63&r):(t[s++]=240|r>>>18,t[s++]=128|r>>>12&63,t[s++]=128|r>>>6&63,t[s++]=128|63&r);return t},r.buf2binstring=function(e){return u(e,e.length)},r.binstring2buf=function(e){for(var t=new i.Buf8(e.length),r=0,n=t.length;r4)l[i++]=65533,r+=a-1;else{for(n&=2===a?31:3===a?15:7;a>1&&r1?l[i++]=65533:n<65536?l[i++]=n:(n-=65536,l[i++]=55296|n>>10&1023,l[i++]=56320|1023&n)}return u(l,i)},r.utf8border=function(e,t){var r;for((t=t||e.length)>e.length&&(t=e.length),r=t-1;r>=0&&128==(192&e[r]);)r--;return r<0||0===r?t:r+s[e[r]]>t?r:t}},{"./common":89}],91:[function(e,t,r){arguments[4][37][0].apply(r,arguments)},{dup:37}],92:[function(e,t,r){arguments[4][38][0].apply(r,arguments)},{dup:38}],93:[function(e,t,r){arguments[4][39][0].apply(r,arguments)},{dup:39}],94:[function(e,t,r){"use strict";var i,n=e("../utils/common"),a=e("./trees"),s=e("./adler32"),o=e("./crc32"),u=e("./messages");function l(e,t){return e.msg=u[t],t}function h(e){return(e<<1)-(e>4?9:0)}function c(e){for(var t=e.length;--t>=0;)e[t]=0}function f(e){var t=e.state,r=t.pending;r>e.avail_out&&(r=e.avail_out),0!==r&&(n.arraySet(e.output,t.pending_buf,t.pending_out,r,e.next_out),e.next_out+=r,t.pending_out+=r,e.total_out+=r,e.avail_out-=r,t.pending-=r,0===t.pending&&(t.pending_out=0))}function d(e,t){a._tr_flush_block(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,f(e.strm)}function p(e,t){e.pending_buf[e.pending++]=t}function m(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function g(e,t){var r,i,n=e.max_chain_length,a=e.strstart,s=e.prev_length,o=e.nice_match,u=e.strstart>e.w_size-262?e.strstart-(e.w_size-262):0,l=e.window,h=e.w_mask,c=e.prev,f=e.strstart+258,d=l[a+s-1],p=l[a+s];e.prev_length>=e.good_match&&(n>>=2),o>e.lookahead&&(o=e.lookahead);do{if(l[(r=t)+s]===p&&l[r+s-1]===d&&l[r]===l[a]&&l[++r]===l[a+1]){a+=2,r++;do{}while(l[++a]===l[++r]&&l[++a]===l[++r]&&l[++a]===l[++r]&&l[++a]===l[++r]&&l[++a]===l[++r]&&l[++a]===l[++r]&&l[++a]===l[++r]&&l[++a]===l[++r]&&as){if(e.match_start=t,s=i,i>=o)break;d=l[a+s-1],p=l[a+s]}}}while((t=c[t&h])>u&&0!=--n);return s<=e.lookahead?s:e.lookahead}function b(e){var t,r,i,a,u,l,h,c,f,d,p=e.w_size;do{if(a=e.window_size-e.lookahead-e.strstart,e.strstart>=p+(p-262)){n.arraySet(e.window,e.window,p,p,0),e.match_start-=p,e.strstart-=p,e.block_start-=p,t=r=e.hash_size;do{i=e.head[--t],e.head[t]=i>=p?i-p:0}while(--r);t=r=p;do{i=e.prev[--t],e.prev[t]=i>=p?i-p:0}while(--r);a+=p}if(0===e.strm.avail_in)break;if(l=e.strm,h=e.window,c=e.strstart+e.lookahead,f=a,d=void 0,(d=l.avail_in)>f&&(d=f),r=0===d?0:(l.avail_in-=d,n.arraySet(h,l.input,l.next_in,d,c),1===l.state.wrap?l.adler=s(l.adler,h,d,c):2===l.state.wrap&&(l.adler=o(l.adler,h,d,c)),l.next_in+=d,l.total_in+=d,d),e.lookahead+=r,e.lookahead+e.insert>=3)for(u=e.strstart-e.insert,e.ins_h=e.window[u],e.ins_h=(e.ins_h<=3&&(e.ins_h=(e.ins_h<=3)if(i=a._tr_tally(e,e.strstart-e.match_start,e.match_length-3),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=3){e.match_length--;do{e.strstart++,e.ins_h=(e.ins_h<=3&&(e.ins_h=(e.ins_h<4096)&&(e.match_length=2)),e.prev_length>=3&&e.match_length<=e.prev_length){n=e.strstart+e.lookahead-3,i=a._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-3),e.lookahead-=e.prev_length-1,e.prev_length-=2;do{++e.strstart<=n&&(e.ins_h=(e.ins_h<15&&(o=2,i-=16),a<1||a>9||8!==r||i<8||i>15||t<0||t>9||s<0||s>4)return l(e,-2);8===i&&(i=9);var u=new w;return e.state=u,u.strm=e,u.wrap=o,u.gzhead=null,u.w_bits=i,u.w_size=1<e.pending_buf_size-5&&(r=e.pending_buf_size-5);;){if(e.lookahead<=1){if(b(e),0===e.lookahead&&0===t)return 1;if(0===e.lookahead)break}e.strstart+=e.lookahead,e.lookahead=0;var i=e.block_start+r;if((0===e.strstart||e.strstart>=i)&&(e.lookahead=e.strstart-i,e.strstart=i,d(e,!1),0===e.strm.avail_out))return 1;if(e.strstart-e.block_start>=e.w_size-262&&(d(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(d(e,!0),0===e.strm.avail_out?3:4):(e.strstart>e.block_start&&(d(e,!1),e.strm.avail_out),1)})),new v(4,4,8,4,y),new v(4,5,16,8,y),new v(4,6,32,32,y),new v(4,4,16,16,_),new v(8,16,32,32,_),new v(8,16,128,128,_),new v(8,32,128,256,_),new v(32,128,258,1024,_),new v(32,258,258,4096,_)],r.deflateInit=function(e,t){return T(e,t,8,15,8,0)},r.deflateInit2=T,r.deflateReset=k,r.deflateResetKeep=E,r.deflateSetHeader=function(e,t){return e&&e.state?2!==e.state.wrap?-2:(e.state.gzhead=t,0):-2},r.deflate=function(e,t){var r,n,s,u;if(!e||!e.state||t>5||t<0)return e?l(e,-2):-2;if(n=e.state,!e.output||!e.input&&0!==e.avail_in||666===n.status&&4!==t)return l(e,0===e.avail_out?-5:-2);if(n.strm=e,r=n.last_flush,n.last_flush=t,42===n.status)if(2===n.wrap)e.adler=0,p(n,31),p(n,139),p(n,8),n.gzhead?(p(n,(n.gzhead.text?1:0)+(n.gzhead.hcrc?2:0)+(n.gzhead.extra?4:0)+(n.gzhead.name?8:0)+(n.gzhead.comment?16:0)),p(n,255&n.gzhead.time),p(n,n.gzhead.time>>8&255),p(n,n.gzhead.time>>16&255),p(n,n.gzhead.time>>24&255),p(n,9===n.level?2:n.strategy>=2||n.level<2?4:0),p(n,255&n.gzhead.os),n.gzhead.extra&&n.gzhead.extra.length&&(p(n,255&n.gzhead.extra.length),p(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=o(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=69):(p(n,0),p(n,0),p(n,0),p(n,0),p(n,0),p(n,9===n.level?2:n.strategy>=2||n.level<2?4:0),p(n,3),n.status=113);else{var g=8+(n.w_bits-8<<4)<<8;g|=(n.strategy>=2||n.level<2?0:n.level<6?1:6===n.level?2:3)<<6,0!==n.strstart&&(g|=32),g+=31-g%31,n.status=113,m(n,g),0!==n.strstart&&(m(n,e.adler>>>16),m(n,65535&e.adler)),e.adler=1}if(69===n.status)if(n.gzhead.extra){for(s=n.pending;n.gzindex<(65535&n.gzhead.extra.length)&&(n.pending!==n.pending_buf_size||(n.gzhead.hcrc&&n.pending>s&&(e.adler=o(e.adler,n.pending_buf,n.pending-s,s)),f(e),s=n.pending,n.pending!==n.pending_buf_size));)p(n,255&n.gzhead.extra[n.gzindex]),n.gzindex++;n.gzhead.hcrc&&n.pending>s&&(e.adler=o(e.adler,n.pending_buf,n.pending-s,s)),n.gzindex===n.gzhead.extra.length&&(n.gzindex=0,n.status=73)}else n.status=73;if(73===n.status)if(n.gzhead.name){s=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>s&&(e.adler=o(e.adler,n.pending_buf,n.pending-s,s)),f(e),s=n.pending,n.pending===n.pending_buf_size)){u=1;break}u=n.gzindexs&&(e.adler=o(e.adler,n.pending_buf,n.pending-s,s)),0===u&&(n.gzindex=0,n.status=91)}else n.status=91;if(91===n.status)if(n.gzhead.comment){s=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>s&&(e.adler=o(e.adler,n.pending_buf,n.pending-s,s)),f(e),s=n.pending,n.pending===n.pending_buf_size)){u=1;break}u=n.gzindexs&&(e.adler=o(e.adler,n.pending_buf,n.pending-s,s)),0===u&&(n.status=103)}else n.status=103;if(103===n.status&&(n.gzhead.hcrc?(n.pending+2>n.pending_buf_size&&f(e),n.pending+2<=n.pending_buf_size&&(p(n,255&e.adler),p(n,e.adler>>8&255),e.adler=0,n.status=113)):n.status=113),0!==n.pending){if(f(e),0===e.avail_out)return n.last_flush=-1,0}else if(0===e.avail_in&&h(t)<=h(r)&&4!==t)return l(e,-5);if(666===n.status&&0!==e.avail_in)return l(e,-5);if(0!==e.avail_in||0!==n.lookahead||0!==t&&666!==n.status){var y=2===n.strategy?function(e,t){for(var r;;){if(0===e.lookahead&&(b(e),0===e.lookahead)){if(0===t)return 1;break}if(e.match_length=0,r=a._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,r&&(d(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(d(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(d(e,!1),0===e.strm.avail_out)?1:2}(n,t):3===n.strategy?function(e,t){for(var r,i,n,s,o=e.window;;){if(e.lookahead<=258){if(b(e),e.lookahead<=258&&0===t)return 1;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=3&&e.strstart>0&&(i=o[n=e.strstart-1])===o[++n]&&i===o[++n]&&i===o[++n]){s=e.strstart+258;do{}while(i===o[++n]&&i===o[++n]&&i===o[++n]&&i===o[++n]&&i===o[++n]&&i===o[++n]&&i===o[++n]&&i===o[++n]&&ne.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=3?(r=a._tr_tally(e,1,e.match_length-3),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(r=a._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),r&&(d(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(d(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(d(e,!1),0===e.strm.avail_out)?1:2}(n,t):i[n.level].func(n,t);if(3!==y&&4!==y||(n.status=666),1===y||3===y)return 0===e.avail_out&&(n.last_flush=-1),0;if(2===y&&(1===t?a._tr_align(n):5!==t&&(a._tr_stored_block(n,0,0,!1),3===t&&(c(n.head),0===n.lookahead&&(n.strstart=0,n.block_start=0,n.insert=0))),f(e),0===e.avail_out))return n.last_flush=-1,0}return 4!==t?0:n.wrap<=0?1:(2===n.wrap?(p(n,255&e.adler),p(n,e.adler>>8&255),p(n,e.adler>>16&255),p(n,e.adler>>24&255),p(n,255&e.total_in),p(n,e.total_in>>8&255),p(n,e.total_in>>16&255),p(n,e.total_in>>24&255)):(m(n,e.adler>>>16),m(n,65535&e.adler)),f(e),n.wrap>0&&(n.wrap=-n.wrap),0!==n.pending?0:1)},r.deflateEnd=function(e){var t;return e&&e.state?42!==(t=e.state.status)&&69!==t&&73!==t&&91!==t&&103!==t&&113!==t&&666!==t?l(e,-2):(e.state=null,113===t?l(e,-3):0):-2},r.deflateSetDictionary=function(e,t){var r,i,a,o,u,l,h,f,d=t.length;if(!e||!e.state)return-2;if(2===(o=(r=e.state).wrap)||1===o&&42!==r.status||r.lookahead)return-2;for(1===o&&(e.adler=s(e.adler,t,d,0)),r.wrap=0,d>=r.w_size&&(0===o&&(c(r.head),r.strstart=0,r.block_start=0,r.insert=0),f=new n.Buf8(r.w_size),n.arraySet(f,t,d-r.w_size,r.w_size,0),t=f,d=r.w_size),u=e.avail_in,l=e.next_in,h=e.input,e.avail_in=d,e.next_in=0,e.input=t,b(r);r.lookahead>=3;){i=r.strstart,a=r.lookahead-2;do{r.ins_h=(r.ins_h<=0;)e[t]=0}var a=[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],s=[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],o=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],u=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],l=new Array(576);n(l);var h=new Array(60);n(h);var c=new Array(512);n(c);var f=new Array(256);n(f);var d=new Array(29);n(d);var p,m,g,b=new Array(30);function y(e,t,r,i,n){this.static_tree=e,this.extra_bits=t,this.extra_base=r,this.elems=i,this.max_length=n,this.has_stree=e&&e.length}function _(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}function v(e){return e<256?c[e]:c[256+(e>>>7)]}function w(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function E(e,t,r){e.bi_valid>16-r?(e.bi_buf|=t<>16-e.bi_valid,e.bi_valid+=r-16):(e.bi_buf|=t<>>=1,r<<=1}while(--t>0);return r>>>1}function S(e,t,r){var i,n,a=new Array(16),s=0;for(i=1;i<=15;i++)a[i]=s=s+r[i-1]<<1;for(n=0;n<=t;n++){var o=e[2*n+1];0!==o&&(e[2*n]=T(a[o]++,o))}}function x(e){var t;for(t=0;t<286;t++)e.dyn_ltree[2*t]=0;for(t=0;t<30;t++)e.dyn_dtree[2*t]=0;for(t=0;t<19;t++)e.bl_tree[2*t]=0;e.dyn_ltree[512]=1,e.opt_len=e.static_len=0,e.last_lit=e.matches=0}function I(e){e.bi_valid>8?w(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0}function C(e,t,r,i){var n=2*t,a=2*r;return e[n]>1;r>=1;r--)A(e,a,r);n=u;do{r=e.heap[1],e.heap[1]=e.heap[e.heap_len--],A(e,a,1),i=e.heap[1],e.heap[--e.heap_max]=r,e.heap[--e.heap_max]=i,a[2*n]=a[2*r]+a[2*i],e.depth[n]=(e.depth[r]>=e.depth[i]?e.depth[r]:e.depth[i])+1,a[2*r+1]=a[2*i+1]=n,e.heap[1]=n++,A(e,a,1)}while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],function(e,t){var r,i,n,a,s,o,u=t.dyn_tree,l=t.max_code,h=t.stat_desc.static_tree,c=t.stat_desc.has_stree,f=t.stat_desc.extra_bits,d=t.stat_desc.extra_base,p=t.stat_desc.max_length,m=0;for(a=0;a<=15;a++)e.bl_count[a]=0;for(u[2*e.heap[e.heap_max]+1]=0,r=e.heap_max+1;r<573;r++)(a=u[2*u[2*(i=e.heap[r])+1]+1]+1)>p&&(a=p,m++),u[2*i+1]=a,i>l||(e.bl_count[a]++,s=0,i>=d&&(s=f[i-d]),o=u[2*i],e.opt_len+=o*(a+s),c&&(e.static_len+=o*(h[2*i+1]+s)));if(0!==m){do{for(a=p-1;0===e.bl_count[a];)a--;e.bl_count[a]--,e.bl_count[a+1]+=2,e.bl_count[p]--,m-=2}while(m>0);for(a=p;0!==a;a--)for(i=e.bl_count[a];0!==i;)(n=e.heap[--r])>l||(u[2*n+1]!==a&&(e.opt_len+=(a-u[2*n+1])*u[2*n],u[2*n+1]=a),i--)}}(e,t),S(a,l,e.bl_count)}function R(e,t,r){var i,n,a=-1,s=t[1],o=0,u=7,l=4;for(0===s&&(u=138,l=3),t[2*(r+1)+1]=65535,i=0;i<=r;i++)n=s,s=t[2*(i+1)+1],++o>=7;i<30;i++)for(b[i]=n<<7,e=0;e<1<0?(2===e.strm.data_type&&(e.strm.data_type=function(e){var t,r=4093624447;for(t=0;t<=31;t++,r>>>=1)if(1&r&&0!==e.dyn_ltree[2*t])return 0;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return 1;for(t=32;t<256;t++)if(0!==e.dyn_ltree[2*t])return 1;return 0}(e)),P(e,e.l_desc),P(e,e.d_desc),s=function(e){var t;for(R(e,e.dyn_ltree,e.l_desc.max_code),R(e,e.dyn_dtree,e.d_desc.max_code),P(e,e.bl_desc),t=18;t>=3&&0===e.bl_tree[2*u[t]+1];t--);return e.opt_len+=3*(t+1)+5+5+4,t}(e),n=e.opt_len+3+7>>>3,(a=e.static_len+3+7>>>3)<=n&&(n=a)):n=a=r+5,r+4<=n&&-1!==t?D(e,t,r,i):4===e.strategy||a===n?(E(e,2+(i?1:0),3),M(e,l,h)):(E(e,4+(i?1:0),3),function(e,t,r,i){var n;for(E(e,t-257,5),E(e,r-1,5),E(e,i-4,4),n=0;n>>8&255,e.pending_buf[e.d_buf+2*e.last_lit+1]=255&t,e.pending_buf[e.l_buf+e.last_lit]=255&r,e.last_lit++,0===t?e.dyn_ltree[2*r]++:(e.matches++,t--,e.dyn_ltree[2*(f[r]+256+1)]++,e.dyn_dtree[2*v(t)]++),e.last_lit===e.lit_bufsize-1},r._tr_align=function(e){E(e,2,3),k(e,256,l),function(e){16===e.bi_valid?(w(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):e.bi_valid>=8&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)}(e)}},{"../utils/common":89}],101:[function(e,t,r){arguments[4][46][0].apply(r,arguments)},{dup:46}],102:[function(e,t,r){function i(e,t){if(!(e=e.replace(/\t+/g," ").trim()))return null;var r=e.indexOf(" ");if(-1===r)throw new Error("no named row at line "+t);var i=e.substring(0,r);e=(e=(e=(e=e.substring(r+1)).replace(/letter=[\'\"]\S+[\'\"]/gi,"")).split("=")).map((function(e){return e.trim().match(/(".*?"|[^"\s]+)+(?=\s*|\s*$)/g)}));for(var a=[],s=0;st.length-1)return 0;var i=t.readUInt8(r++),n=t.readInt32LE(r);switch(r+=4,i){case 1:e.info=function(e,t){var r={};r.size=e.readInt16LE(t);var i=e.readUInt8(t+2);return r.smooth=i>>7&1,r.unicode=i>>6&1,r.italic=i>>5&1,r.bold=i>>4&1,i>>3&1&&(r.fixedHeight=1),r.charset=e.readUInt8(t+3)||"",r.stretchH=e.readUInt16LE(t+4),r.aa=e.readUInt8(t+6),r.padding=[e.readInt8(t+7),e.readInt8(t+8),e.readInt8(t+9),e.readInt8(t+10)],r.spacing=[e.readInt8(t+11),e.readInt8(t+12)],r.outline=e.readUInt8(t+13),r.face=function(e,t){return a(e,t).toString("utf8")}(e,t+14),r}(t,r);break;case 2:e.common=function(e,t){var r={};return r.lineHeight=e.readUInt16LE(t),r.base=e.readUInt16LE(t+2),r.scaleW=e.readUInt16LE(t+4),r.scaleH=e.readUInt16LE(t+6),r.pages=e.readUInt16LE(t+8),e.readUInt8(t+10),r.packed=0,r.alphaChnl=e.readUInt8(t+11),r.redChnl=e.readUInt8(t+12),r.greenChnl=e.readUInt8(t+13),r.blueChnl=e.readUInt8(t+14),r}(t,r);break;case 3:e.pages=function(e,t,r){for(var i=[],n=a(e,t),s=n.length+1,o=r/s,u=0;u3)throw new Error("Only supports BMFont Binary v3 (BMFont App v1.10)");for(var r={kernings:[],chars:[]},a=0;a<5;a++)t+=n(r,e,t);return r}},{}],104:[function(e,t,r){var i=e("./parse-attribs"),n=e("xml-parse-from-string"),a={scaleh:"scaleH",scalew:"scaleW",stretchh:"stretchH",lineheight:"lineHeight",alphachnl:"alphaChnl",redchnl:"redChnl",greenchnl:"greenChnl",bluechnl:"blueChnl"};function s(e){return function(e){for(var t=[],r=0;r element");for(var o=a.getElementsByTagName("page"),u=0;u=0;i--){var n=e[i];"."===n?e.splice(i,1):".."===n?(e.splice(i,1),r++):r&&(e.splice(i,1),r--)}if(t)for(;r--;r)e.unshift("..");return e}function i(e,t){if(e.filter)return e.filter(t);for(var r=[],i=0;i=-1&&!n;a--){var s=a>=0?arguments[a]:e.cwd();if("string"!=typeof s)throw new TypeError("Arguments to path.resolve must be strings");s&&(r=s+"/"+r,n="/"===s.charAt(0))}return(n?"/":"")+(r=t(i(r.split("/"),(function(e){return!!e})),!n).join("/"))||"."},r.normalize=function(e){var a=r.isAbsolute(e),s="/"===n(e,-1);return(e=t(i(e.split("/"),(function(e){return!!e})),!a).join("/"))||a||(e="."),e&&s&&(e+="/"),(a?"/":"")+e},r.isAbsolute=function(e){return"/"===e.charAt(0)},r.join=function(){var e=Array.prototype.slice.call(arguments,0);return r.normalize(i(e,(function(e,t){if("string"!=typeof e)throw new TypeError("Arguments to path.join must be strings");return e})).join("/"))},r.relative=function(e,t){function i(e){for(var t=0;t=0&&""===e[r];r--);return t>r?[]:e.slice(t,r-t+1)}e=r.resolve(e).substr(1),t=r.resolve(t).substr(1);for(var n=i(e.split("/")),a=i(t.split("/")),s=Math.min(n.length,a.length),o=s,u=0;u=1;--a)if(47===(t=e.charCodeAt(a))){if(!n){i=a;break}}else n=!1;return-1===i?r?"/":".":r&&1===i?"/":e.slice(0,i)},r.basename=function(e,t){var r=function(e){"string"!=typeof e&&(e+="");var t,r=0,i=-1,n=!0;for(t=e.length-1;t>=0;--t)if(47===e.charCodeAt(t)){if(!n){r=t+1;break}}else-1===i&&(n=!1,i=t+1);return-1===i?"":e.slice(r,i)}(e);return t&&r.substr(-1*t.length)===t&&(r=r.substr(0,r.length-t.length)),r},r.extname=function(e){"string"!=typeof e&&(e+="");for(var t=-1,r=0,i=-1,n=!0,a=0,s=e.length-1;s>=0;--s){var o=e.charCodeAt(s);if(47!==o)-1===i&&(n=!1,i=s+1),46===o?-1===t?t=s:1!==a&&(a=1):-1!==t&&(a=-1);else if(!n){r=s+1;break}}return-1===t||-1===i||0===a||1===a&&t===i-1&&t===r+1?"":e.slice(t,i)};var n="b"==="ab".substr(-1)?function(e,t,r){return e.substr(t,r)}:function(e,t,r){return t<0&&(t=e.length+t),e.substr(t,r)}}).call(this,e("_process"))},{_process:133}],108:[function(e,t,r){(function(r){"use strict";var i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n=e("http"),a=e("https"),s=e("url"),o=e("querystring"),u=e("zlib"),l=e("util"),h=function(e,t){if("string"!=typeof e&&!e.hasOwnProperty("url"))throw new Error("Missing url option from options for request method.");var l="object"===(void 0===e?"undefined":i(e))?s.parse(e.url):s.parse(e),h={hostname:l.hostname,port:l.port||("http:"===l.protocol.toLowerCase()?80:443),path:l.path,method:"GET",headers:{},auth:l.auth||null,parse:"none",stream:!1};if("object"===(void 0===e?"undefined":i(e))&&(h=Object.assign(h,e)),h.port=Number(h.port),h.hasOwnProperty("timeout")&&delete h.timeout,!0===h.compressed&&(h.headers["accept-encoding"]="gzip, deflate"),e.hasOwnProperty("form")){if("object"!==i(e.form))throw new Error("phin 'form' option must be of type Object if present.");var c=o.stringify(e.form);h.headers["Content-Type"]="application/x-www-form-urlencoded",h.headers["Content-Length"]=r.byteLength(c),e.data=c}var f=void 0,d=function(e){var i=e;!0===h.compressed&&("gzip"===e.headers["content-encoding"]?i=e.pipe(u.createGunzip()):"deflate"===e.headers["content-encoding"]&&(i=e.pipe(u.createInflate()))),!0===h.stream?(e.stream=i,t(null,e)):(e.body=new r([]),i.on("data",(function(t){e.body=r.concat([e.body,t])})),i.on("end",(function(){if(t){if("json"===h.parse)try{e.body=JSON.parse(e.body.toString())}catch(r){return void t("Invalid JSON received.",e)}t(null,e)}})))};switch(l.protocol.toLowerCase()){case"http:":f=n.request(h,d);break;case"https:":f=a.request(h,d);break;default:return void(t&&t(new Error("Invalid / unknown URL protocol. Expected HTTP or HTTPS."),null))}if("number"==typeof e.timeout&&f.setTimeout(e.timeout,(function(){f.abort(),t(new Error("Timeout has been reached."),null),t=null})),f.on("error",(function(e){t&&t(e,null)})),e.hasOwnProperty("data")){var p=e.data;if(!(e.data instanceof r)&&"object"===i(e.data))if("application/x-www-form-urlencoded"===(h.headers["content-type"]||h.headers["Content-Type"]))p=o.stringify(e.data);else try{p=JSON.stringify(e.data)}catch(e){t(new Error("Couldn't stringify object. (Likely due to a circular reference.)"),null)}f.write(p)}f.end()};h.promisified=function(e,t){return new Promise((function(t,r){h(e,(function(e,i){e?r(e):t(i)}))}))},l.promisify&&(h[l.promisify.custom]=h.promisified),t.exports=h}).call(this,e("buffer").Buffer)},{buffer:48,http:156,https:72,querystring:137,url:180,util:186,zlib:35}],109:[function(e,t,r){"use strict";function i(e,t,r,a,s,o){for(var u,l,h,c,f=Math.max(t-1,0),d=Math.max(r-1,0),p=Math.min(t+1,a-1),m=Math.min(r+1,s-1),g=4*(r*a+t),b=0,y=0,_=0,v=0,w=0,E=f;E<=p;E++)for(var k=d;k<=m;k++)if(E!==t||k!==r){var T=n(e,e,g,4*(k*a+E),!0);if(0===T?b++:T<0?_++:T>0&&y++,b>2)return!1;o&&(Tw&&(w=T,h=E,c=k))}return!o||0!==_&&0!==y&&(!i(e,u,l,a,s)&&!i(o,u,l,a,s)||!i(e,h,c,a,s)&&!i(o,h,c,a,s))}function n(e,t,r,i,n){var l=e[r+3]/255,h=t[i+3]/255,c=u(e[r+0],l),f=u(e[r+1],l),d=u(e[r+2],l),p=u(t[i+0],h),m=u(t[i+1],h),g=u(t[i+2],h),b=a(c,f,d)-a(p,m,g);if(n)return b;var y=s(c,f,d)-s(p,m,g),_=o(c,f,d)-o(p,m,g);return.5053*b*b+.299*y*y+.1957*_*_}function a(e,t,r){return.29889531*e+.58662247*t+.11448223*r}function s(e,t,r){return.59597799*e-.2741761*t-.32180189*r}function o(e,t,r){return.21147017*e-.52261711*t+.31114694*r}function u(e,t){return 255+(e-255)*t}function l(e,t,r,i,n){e[t+0]=r,e[t+1]=i,e[t+2]=n,e[t+3]=255}t.exports=function(e,t,r,s,o,h){h||(h={});for(var c=void 0===h.threshold?.1:h.threshold,f=35215*c*c,d=0,p=0;pf)h.includeAA||!i(e,m,p,s,o,t)&&!i(t,m,p,s,o,e)?(r&&l(r,g,255,0,0),d++):r&&l(r,g,255,255,0);else if(r){var b=u((v=void 0,v=(y=e)[(_=g)+3]/255,a(u(y[_+0],v),u(y[_+1],v),u(y[_+2],v))),.1);l(r,g,b,b,b)}}var y,_,v;return d}},{}],110:[function(e,t,r){(function(t){"use strict";var i=e("./interlace"),n={1:{0:0,1:0,2:0,3:255},2:{0:0,1:0,2:0,3:1},3:{0:0,1:1,2:2,3:255},4:{0:0,1:1,2:2,3:3}};function a(e,t,r,i,a,s){for(var o=e.width,u=e.height,l=e.index,h=0;h>4,r.push(c,h);break;case 2:u=3&f,l=f>>2&3,h=f>>4&3,c=f>>6&3,r.push(c,h,l,u);break;case 1:n=1&f,a=f>>1&1,s=f>>2&1,o=f>>3&1,u=f>>4&1,l=f>>5&1,h=f>>6&1,c=f>>7&1,r.push(c,h,l,u,o,s,a,n)}}return{get:function(e){for(;r.length0&&(this._paused=!1,this.emit("drain"))}.bind(this))},s.prototype.write=function(e,t){return this.writable?(r=i.isBuffer(e)?e:new i(e,t||this._encoding),this._buffers.push(r),this._buffered+=r.length,this._process(),this._reads&&0===this._reads.length&&(this._paused=!0),this.writable&&!this._paused):(this.emit("error",new Error("Stream not writable")),!1);var r},s.prototype.end=function(e,t){e&&this.write(e,t),this.writable=!1,this._buffers&&(0===this._buffers.length?this._end():(this._buffers.push(null),this._process()))},s.prototype.destroySoon=s.prototype.end,s.prototype._end=function(){this._reads.length>0&&this.emit("error",new Error("There are some read requests waiting on finished stream")),this.destroy()},s.prototype.destroy=function(){this._buffers&&(this.writable=!1,this._reads=null,this._buffers=null,this.emit("close"))},s.prototype._processReadAllowingLess=function(e){this._reads.shift();var t=this._buffers[0];t.length>e.length?(this._buffered-=e.length,this._buffers[0]=t.slice(e.length),e.func.call(this,t.slice(0,e.length))):(this._buffered-=t.length,this._buffers.shift(),e.func.call(this,t))},s.prototype._processRead=function(e){this._reads.shift();for(var t=0,r=0,n=new i(e.length);t0&&this._buffers.splice(0,r),this._buffered-=e.length,e.func.call(this,n)},s.prototype._process=function(){try{for(;this._buffered>0&&this._reads&&this._reads.length>0;){var e=this._reads[0];if(e.allowLess)this._processReadAllowingLess(e);else{if(!(this._buffered>=e.length))break;this._processRead(e)}}this._buffers&&this._buffers.length>0&&null===this._buffers[0]&&this._end()}catch(e){this.emit("error",e)}}}).call(this,e("_process"),e("buffer").Buffer)},{_process:133,buffer:48,stream:155,util:186}],113:[function(e,t,r){"use strict";t.exports={PNG_SIGNATURE:[137,80,78,71,13,10,26,10],TYPE_IHDR:1229472850,TYPE_IEND:1229278788,TYPE_IDAT:1229209940,TYPE_PLTE:1347179589,TYPE_tRNS:1951551059,TYPE_gAMA:1732332865,COLORTYPE_GRAYSCALE:0,COLORTYPE_PALETTE:1,COLORTYPE_COLOR:2,COLORTYPE_ALPHA:4,COLORTYPE_PALETTE_COLOR:3,COLORTYPE_COLOR_ALPHA:6,COLORTYPE_TO_BPP_MAP:{0:1,2:3,3:1,4:2,6:4},GAMMA_DIVISION:1e5}},{}],114:[function(e,t,r){"use strict";var i=[];!function(){for(var e=0;e<256;e++){for(var t=e,r=0;r<8;r++)1&t?t=3988292384^t>>>1:t>>>=1;i[e]=t}}();var n=t.exports=function(){this._crc=-1};n.prototype.write=function(e){for(var t=0;t>>8;return!0},n.prototype.crc32=function(){return-1^this._crc},n.crc32=function(e){for(var t=-1,r=0;r>>8;return-1^t}},{}],115:[function(e,t,r){(function(r){"use strict";var i=e("./paeth-predictor"),n={0:function(e,t,r,i,n){for(var a=0;a=a?e[t+s-a]:0,u=e[t+s]-o;i[n+s]=u}},2:function(e,t,r,i,n){for(var a=0;a0?e[t+a-r]:0,o=e[t+a]-s;i[n+a]=o}},3:function(e,t,r,i,n,a){for(var s=0;s=a?e[t+s-a]:0,u=t>0?e[t+s-r]:0,l=e[t+s]-(o+u>>1);i[n+s]=l}},4:function(e,t,r,n,a,s){for(var o=0;o=s?e[t+o-s]:0,l=t>0?e[t+o-r]:0,h=t>0&&o>=s?e[t+o-(r+s)]:0,c=e[t+o]-i(u,l,h);n[a+o]=c}}},a={0:function(e,t,r){for(var i=0,n=t+r,a=t;a=i?e[t+a-i]:0,o=e[t+a]-s;n+=Math.abs(o)}return n},2:function(e,t,r){for(var i=0,n=t+r,a=t;a0?e[a-r]:0,o=e[a]-s;i+=Math.abs(o)}return i},3:function(e,t,r,i){for(var n=0,a=0;a=i?e[t+a-i]:0,o=t>0?e[t+a-r]:0,u=e[t+a]-(s+o>>1);n+=Math.abs(u)}return n},4:function(e,t,r,n){for(var a=0,s=0;s=n?e[t+s-n]:0,u=t>0?e[t+s-r]:0,l=t>0&&s>=n?e[t+s-(r+n)]:0,h=e[t+s]-i(o,u,l);a+=Math.abs(h)}return a}};t.exports=function(e,t,i,s,o){var u;if("filterType"in s&&-1!==s.filterType){if("number"!=typeof s.filterType)throw new Error("unrecognised filter types");u=[s.filterType]}else u=[0,1,2,3,4];16===s.bitDepth&&(o*=2);for(var l=t*o,h=0,c=0,f=new r((l+1)*i),d=u[0],p=0;p1)for(var m=1/0,g=0;gn?t[a-i]:0;t[a]=s+o}},s.prototype._unFilterType2=function(e,t,r){for(var i=this._lastLine,n=0;nn?t[s-i]:0,h=Math.floor((l+u)/2);t[s]=o+h}},s.prototype._unFilterType4=function(e,t,r){for(var i=this._xComparison,a=i-1,s=this._lastLine,o=0;oa?t[o-i]:0,c=o>a&&s?s[o-i]:0,f=n(h,l,c);t[o]=u+f}},s.prototype._reverseFilterLine=function(e){var t,i=e[0],n=this._images[this._imageIndex],a=n.byteWidth;if(0===i)t=e.slice(1,a+1);else switch(t=new r(a),i){case 1:this._unFilterType1(e,t,a);break;case 2:this._unFilterType2(e,t,a);break;case 3:this._unFilterType3(e,t,a);break;case 4:this._unFilterType4(e,t,a);break;default:throw new Error("Unrecognised filter type - "+i)}this.write(t),n.lineIndex++,n.lineIndex>=n.height?(this._lastLine=null,this._imageIndex++,n=this._images[this._imageIndex]):this._lastLine=t,n?this.read(n.byteWidth+1,this._reverseFilterLine.bind(this)):(this._lastLine=null,this.complete())}}).call(this,e("buffer").Buffer)},{"./interlace":120,"./paeth-predictor":124,buffer:48}],119:[function(e,t,r){(function(e){"use strict";t.exports=function(t,r){var i=r.depth,n=r.width,a=r.height,s=r.colorType,o=r.transColor,u=r.palette,l=t;return 3===s?function(e,t,r,i,n){for(var a=0,s=0;s0&&c>0&&r.push({width:h,height:c,index:u})}return r},r.getInterlaceIterator=function(e){return function(t,r,n){var a=t%i[n].x.length,s=(t-a)/i[n].x.length*8+i[n].x[a],o=r%i[n].y.length;return 4*s+((r-o)/i[n].y.length*8+i[n].y[o])*e*4}}},{}],121:[function(e,t,r){(function(r){"use strict";var i=e("util"),n=e("stream"),a=e("./constants"),s=e("./packer"),o=t.exports=function(e){n.call(this);var t=e||{};this._packer=new s(t),this._deflate=this._packer.createDeflate(),this.readable=!0};i.inherits(o,n),o.prototype.pack=function(e,t,i,n){this.emit("data",new r(a.PNG_SIGNATURE)),this.emit("data",this._packer.packIHDR(t,i)),n&&this.emit("data",this._packer.packGAMA(n));var s=this._packer.filterData(e,t,i);this._deflate.on("error",this.emit.bind(this,"error")),this._deflate.on("data",function(e){this.emit("data",this._packer.packIDAT(e))}.bind(this)),this._deflate.on("end",function(){this.emit("data",this._packer.packIEND()),this.emit("end")}.bind(this)),this._deflate.end(s)}}).call(this,e("buffer").Buffer)},{"./constants":113,"./packer":123,buffer:48,stream:155,util:186}],122:[function(e,t,r){(function(r){"use strict";var i=!0,n=e("zlib");n.deflateSync||(i=!1);var a=e("./constants"),s=e("./packer");t.exports=function(e,t){if(!i)throw new Error("To use the sync capability of this library in old node versions, please pin pngjs to v2.3.0");var o=new s(t||{}),u=[];u.push(new r(a.PNG_SIGNATURE)),u.push(o.packIHDR(e.width,e.height)),e.gamma&&u.push(o.packGAMA(e.gamma));var l=o.filterData(e.data,e.width,e.height),h=n.deflateSync(l,o.getDeflateOptions());if(l=null,!h||!h.length)throw new Error("bad png - invalid compressed data response");return u.push(o.packIDAT(h)),u.push(o.packIEND()),r.concat(u)}}).call(this,e("buffer").Buffer)},{"./constants":113,"./packer":123,buffer:48,zlib:35}],123:[function(e,t,r){(function(r){"use strict";var i=e("./constants"),n=e("./crc"),a=e("./bitpacker"),s=e("./filter-pack"),o=e("zlib"),u=t.exports=function(e){if(this._options=e,e.deflateChunkSize=e.deflateChunkSize||32768,e.deflateLevel=null!=e.deflateLevel?e.deflateLevel:9,e.deflateStrategy=null!=e.deflateStrategy?e.deflateStrategy:3,e.inputHasAlpha=null==e.inputHasAlpha||e.inputHasAlpha,e.deflateFactory=e.deflateFactory||o.createDeflate,e.bitDepth=e.bitDepth||8,e.colorType="number"==typeof e.colorType?e.colorType:i.COLORTYPE_COLOR_ALPHA,e.inputColorType="number"==typeof e.inputColorType?e.inputColorType:i.COLORTYPE_COLOR_ALPHA,-1===[i.COLORTYPE_GRAYSCALE,i.COLORTYPE_COLOR,i.COLORTYPE_COLOR_ALPHA,i.COLORTYPE_ALPHA].indexOf(e.colorType))throw new Error("option color type:"+e.colorType+" is not supported at present");if(-1===[i.COLORTYPE_GRAYSCALE,i.COLORTYPE_COLOR,i.COLORTYPE_COLOR_ALPHA,i.COLORTYPE_ALPHA].indexOf(e.inputColorType))throw new Error("option input color type:"+e.inputColorType+" is not supported at present");if(8!==e.bitDepth&&16!==e.bitDepth)throw new Error("option bit depth:"+e.bitDepth+" is not supported at present")};u.prototype.getDeflateOptions=function(){return{chunkSize:this._options.deflateChunkSize,level:this._options.deflateLevel,strategy:this._options.deflateStrategy}},u.prototype.createDeflate=function(){return this._options.deflateFactory(this.getDeflateOptions())},u.prototype.filterData=function(e,t,r){var n=a(e,t,r,this._options),o=i.COLORTYPE_TO_BPP_MAP[this._options.colorType];return s(n,t,r,this._options,o)},u.prototype._packChunk=function(e,t){var i=t?t.length:0,a=new r(i+12);return a.writeUInt32BE(i,0),a.writeUInt32BE(e,4),t&&t.copy(a,8),a.writeInt32BE(n.crc32(a.slice(4,a.length-4)),a.length-4),a},u.prototype.packGAMA=function(e){var t=new r(4);return t.writeUInt32BE(Math.floor(e*i.GAMMA_DIVISION),0),this._packChunk(i.TYPE_gAMA,t)},u.prototype.packIHDR=function(e,t){var n=new r(13);return n.writeUInt32BE(e,0),n.writeUInt32BE(t,4),n[8]=this._options.bitDepth,n[9]=this._options.colorType,n[10]=0,n[11]=0,n[12]=0,this._packChunk(i.TYPE_IHDR,n)},u.prototype.packIDAT=function(e){return this._packChunk(i.TYPE_IDAT,e)},u.prototype.packIEND=function(){return this._packChunk(i.TYPE_IEND,null)}}).call(this,e("buffer").Buffer)},{"./bitpacker":111,"./constants":113,"./crc":114,"./filter-pack":115,buffer:48,zlib:35}],124:[function(e,t,r){"use strict";t.exports=function(e,t,r){var i=e+t-r,n=Math.abs(i-e),a=Math.abs(i-t),s=Math.abs(i-r);return n<=a&&n<=s?e:a<=s?t:r}},{}],125:[function(e,t,r){"use strict";var i=e("util"),n=e("zlib"),a=e("./chunkstream"),s=e("./filter-parse-async"),o=e("./parser"),u=e("./bitmapper"),l=e("./format-normaliser"),h=t.exports=function(e){a.call(this),this._parser=new o(e,{read:this.read.bind(this),error:this._handleError.bind(this),metadata:this._handleMetaData.bind(this),gamma:this.emit.bind(this,"gamma"),palette:this._handlePalette.bind(this),transColor:this._handleTransColor.bind(this),finished:this._finished.bind(this),inflateData:this._inflateData.bind(this)}),this._options=e,this.writable=!0,this._parser.start()};i.inherits(h,a),h.prototype._handleError=function(e){this.emit("error",e),this.writable=!1,this.destroy(),this._inflate&&this._inflate.destroy&&this._inflate.destroy(),this._filter&&(this._filter.destroy(),this._filter.on("error",(function(){}))),this.errord=!0},h.prototype._inflateData=function(e){if(!this._inflate)if(this._bitmapInfo.interlace)this._inflate=n.createInflate(),this._inflate.on("error",this.emit.bind(this,"error")),this._filter.on("complete",this._complete.bind(this)),this._inflate.pipe(this._filter);else{var t=(1+(this._bitmapInfo.width*this._bitmapInfo.bpp*this._bitmapInfo.depth+7>>3))*this._bitmapInfo.height,r=Math.max(t,n.Z_MIN_CHUNK);this._inflate=n.createInflate({chunkSize:r});var i=t,a=this.emit.bind(this,"error");this._inflate.on("error",(function(e){i&&a(e)})),this._filter.on("complete",this._complete.bind(this));var s=this._filter.write.bind(this._filter);this._inflate.on("data",(function(e){i&&(e.length>i&&(e=e.slice(0,i)),i-=e.length,s(e))})),this._inflate.on("end",this._filter.end.bind(this._filter))}this._inflate.write(e)},h.prototype._handleMetaData=function(e){this.emit("metadata",e),this._bitmapInfo=Object.create(e),this._filter=new s(this._bitmapInfo)},h.prototype._handleTransColor=function(e){this._bitmapInfo.transColor=e},h.prototype._handlePalette=function(e){this._bitmapInfo.palette=e},h.prototype._finished=function(){this.errord||(this._inflate?this._inflate.end():this.emit("error","No Inflate block"),this.destroySoon())},h.prototype._complete=function(e){if(!this.errord){try{var t=u.dataToBitMap(e,this._bitmapInfo),r=l(t,this._bitmapInfo);t=null}catch(e){return void this._handleError(e)}this.emit("parsed",r)}}},{"./bitmapper":110,"./chunkstream":112,"./filter-parse-async":116,"./format-normaliser":119,"./parser":127,util:186,zlib:35}],126:[function(e,t,r){(function(r){"use strict";var i=!0,n=e("zlib"),a=e("./sync-inflate");n.deflateSync||(i=!1);var s=e("./sync-reader"),o=e("./filter-parse-sync"),u=e("./parser"),l=e("./bitmapper"),h=e("./format-normaliser");t.exports=function(e,t){if(!i)throw new Error("To use the sync capability of this library in old node versions, please pin pngjs to v2.3.0");var c,f,d,p=[],m=new s(e);if(new u(t,{read:m.read.bind(m),error:function(e){c=e},metadata:function(e){f=e},gamma:function(e){d=e},palette:function(e){f.palette=e},transColor:function(e){f.transColor=e},inflateData:function(e){p.push(e)}}).start(),m.process(),c)throw c;var g,b=r.concat(p);if(p.length=0,f.interlace)g=n.inflateSync(b);else{var y=(1+(f.width*f.bpp*f.depth+7>>3))*f.height;g=a(b,{chunkSize:y,maxLength:y})}if(b=null,!g||!g.length)throw new Error("bad png - invalid inflate data response");var _=o.process(g,f);b=null;var v=l.dataToBitMap(_,f);_=null;var w=h(v,f);return f.data=w,f.gamma=d||0,f}}).call(this,e("buffer").Buffer)},{"./bitmapper":110,"./filter-parse-sync":117,"./format-normaliser":119,"./parser":127,"./sync-inflate":130,"./sync-reader":131,buffer:48,zlib:35}],127:[function(e,t,r){(function(r){"use strict";var i=e("./constants"),n=e("./crc"),a=t.exports=function(e,t){this._options=e,e.checkCRC=!1!==e.checkCRC,this._hasIHDR=!1,this._hasIEND=!1,this._palette=[],this._colorType=0,this._chunks={},this._chunks[i.TYPE_IHDR]=this._handleIHDR.bind(this),this._chunks[i.TYPE_IEND]=this._handleIEND.bind(this),this._chunks[i.TYPE_IDAT]=this._handleIDAT.bind(this),this._chunks[i.TYPE_PLTE]=this._handlePLTE.bind(this),this._chunks[i.TYPE_tRNS]=this._handleTRNS.bind(this),this._chunks[i.TYPE_gAMA]=this._handleGAMA.bind(this),this.read=t.read,this.error=t.error,this.metadata=t.metadata,this.gamma=t.gamma,this.transColor=t.transColor,this.palette=t.palette,this.parsed=t.parsed,this.inflateData=t.inflateData,this.finished=t.finished};a.prototype.start=function(){this.read(i.PNG_SIGNATURE.length,this._parseSignature.bind(this))},a.prototype._parseSignature=function(e){for(var t=i.PNG_SIGNATURE,r=0;rthis._palette.length)return void this.error(new Error("More transparent colors than palette size"));for(var t=0;t0?this._handleIDAT(r):this._handleChunkEnd()},a.prototype._handleIEND=function(e){this.read(e,this._parseIEND.bind(this))},a.prototype._parseIEND=function(e){this._crc.write(e),this._hasIEND=!0,this._handleChunkEnd(),this.finished&&this.finished()}}).call(this,e("buffer").Buffer)},{"./constants":113,"./crc":114,buffer:48}],128:[function(e,t,r){"use strict";var i=e("./parser-sync"),n=e("./packer-sync");r.read=function(e,t){return i(e,t||{})},r.write=function(e,t){return n(e,t)}},{"./packer-sync":122,"./parser-sync":126}],129:[function(e,t,r){(function(t,i){"use strict";var n=e("util"),a=e("stream"),s=e("./parser-async"),o=e("./packer-async"),u=e("./png-sync"),l=r.PNG=function(e){a.call(this),e=e||{},this.width=0|e.width,this.height=0|e.height,this.data=this.width>0&&this.height>0?new i(4*this.width*this.height):null,e.fill&&this.data&&this.data.fill(0),this.gamma=0,this.readable=this.writable=!0,this._parser=new s(e),this._parser.on("error",this.emit.bind(this,"error")),this._parser.on("close",this._handleClose.bind(this)),this._parser.on("metadata",this._metadata.bind(this)),this._parser.on("gamma",this._gamma.bind(this)),this._parser.on("parsed",function(e){this.data=e,this.emit("parsed",e)}.bind(this)),this._packer=new o(e),this._packer.on("data",this.emit.bind(this,"data")),this._packer.on("end",this.emit.bind(this,"end")),this._parser.on("close",this._handleClose.bind(this)),this._packer.on("error",this.emit.bind(this,"error"))};n.inherits(l,a),l.sync=u,l.prototype.pack=function(){return this.data&&this.data.length?(t.nextTick(function(){this._packer.pack(this.data,this.width,this.height,this.gamma)}.bind(this)),this):(this.emit("error","No data provided"),this)},l.prototype.parse=function(e,t){var r,i;return t&&(r=function(e){this.removeListener("error",i),this.data=e,t(null,this)}.bind(this),i=function(e){this.removeListener("parsed",r),t(e,null)}.bind(this),this.once("parsed",r),this.once("error",i)),this.end(e),this},l.prototype.write=function(e){return this._parser.write(e),!0},l.prototype.end=function(e){this._parser.end(e)},l.prototype._metadata=function(e){this.width=e.width,this.height=e.height,this.emit("metadata",e)},l.prototype._gamma=function(e){this.gamma=e},l.prototype._handleClose=function(){this._parser.writable||this._packer.readable||this.emit("close")},l.bitblt=function(e,t,r,i,n,a,s,o){if(i|=0,n|=0,a|=0,s|=0,o|=0,(r|=0)>e.width||i>e.height||r+n>e.width||i+a>e.height)throw new Error("bitblt reading outside image");if(s>t.width||o>t.height||s+n>t.width||o+a>t.height)throw new Error("bitblt writing outside image");for(var u=0;u=0,"have should not go down"),r>0){var i=o._buffer.slice(o._offset,o._offset+r);if(o._offset+=r,i.length>f&&(i=i.slice(0,f)),p.push(i),m+=i.length,0==(f-=i.length))return!1}return(0===t||o._offset>=o._chunkSize)&&(c=o._chunkSize,o._offset=0,o._buffer=n.allocUnsafe(o._chunkSize)),0===t&&(d+=l-e,l=e,!0)}}this.on("error",(function(e){i=e})),a(this._handle,"zlib binding closed");do{var b=this._handle.writeSync(t,e,d,l,this._buffer,this._offset,c);b=b||this._writeState}while(!this._hadError&&g(b[0],b[1]));if(this._hadError)throw i;if(m>=u)throw h(this),new RangeError("Cannot create final Buffer. It would be larger than 0x"+u.toString(16)+" bytes");var y=n.concat(p,m);return h(this),y},o.inherits(l,s.Inflate),t.exports=r=c,r.Inflate=l,r.createInflate=function(e){return new l(e)},r.inflateSync=c}).call(this,e("_process"),e("buffer").Buffer)},{_process:133,assert:25,buffer:48,util:186,zlib:35}],131:[function(e,t,r){"use strict";var i=t.exports=function(e){this._buffer=e,this._reads=[]};i.prototype.read=function(e,t){this._reads.push({length:Math.abs(e),allowLess:e<0,func:t})},i.prototype.process=function(){for(;this._reads.length>0&&this._buffer.length;){var e=this._reads[0];if(!this._buffer.length||!(this._buffer.length>=e.length||e.allowLess))break;this._reads.shift();var t=this._buffer;this._buffer=t.slice(e.length),e.func.call(this,t.slice(0,e.length))}return this._reads.length>0?new Error("There are some read requests waitng on finished stream"):this._buffer.length>0?new Error("unrecognised content at end of stream"):void 0}},{}],132:[function(e,t,r){(function(e){"use strict";void 0===e||!e.version||0===e.version.indexOf("v0.")||0===e.version.indexOf("v1.")&&0!==e.version.indexOf("v1.8.")?t.exports={nextTick:function(t,r,i,n){if("function"!=typeof t)throw new TypeError('"callback" argument must be a function');var a,s,o=arguments.length;switch(o){case 0:case 1:return e.nextTick(t);case 2:return e.nextTick((function(){t.call(null,r)}));case 3:return e.nextTick((function(){t.call(null,r,i)}));case 4:return e.nextTick((function(){t.call(null,r,i,n)}));default:for(a=new Array(o-1),s=0;s1)for(var r=1;r= 0x80 (not a basic code point)","invalid-input":"Invalid input"},p=Math.floor,m=String.fromCharCode;function g(e){throw new RangeError(d[e])}function b(e,t){for(var r=e.length,i=[];r--;)i[r]=t(e[r]);return i}function y(e,t){var r=e.split("@"),i="";return r.length>1&&(i=r[0]+"@",e=r[1]),i+b((e=e.replace(f,".")).split("."),t).join(".")}function _(e){for(var t,r,i=[],n=0,a=e.length;n=55296&&t<=56319&&n65535&&(t+=m((e-=65536)>>>10&1023|55296),e=56320|1023&e),t+=m(e)})).join("")}function w(e,t){return e+22+75*(e<26)-((0!=t)<<5)}function E(e,t,r){var i=0;for(e=r?p(e/700):e>>1,e+=p(e/t);e>455;i+=36)e=p(e/35);return p(i+36*e/(e+38))}function k(e){var t,r,i,n,a,s,o,u,h,c,f,d=[],m=e.length,b=0,y=128,_=72;for((r=e.lastIndexOf("-"))<0&&(r=0),i=0;i=128&&g("not-basic"),d.push(e.charCodeAt(i));for(n=r>0?r+1:0;n=m&&g("invalid-input"),((u=(f=e.charCodeAt(n++))-48<10?f-22:f-65<26?f-65:f-97<26?f-97:36)>=36||u>p((l-b)/s))&&g("overflow"),b+=u*s,!(u<(h=o<=_?1:o>=_+26?26:o-_));o+=36)s>p(l/(c=36-h))&&g("overflow"),s*=c;_=E(b-a,t=d.length+1,0==a),p(b/t)>l-y&&g("overflow"),y+=p(b/t),b%=t,d.splice(b++,0,y)}return v(d)}function T(e){var t,r,i,n,a,s,o,u,h,c,f,d,b,y,v,k=[];for(d=(e=_(e)).length,t=128,r=0,a=72,s=0;s=t&&fp((l-r)/(b=i+1))&&g("overflow"),r+=(o-t)*b,t=o,s=0;sl&&g("overflow"),f==t){for(u=r,h=36;!(u<(c=h<=a?1:h>=a+26?26:h-a));h+=36)v=u-c,y=36-c,k.push(m(w(c+v%y,0))),u=p(v/y);k.push(m(w(u,0))),a=E(r,b,i==n),r=0,++i}++r,++t}return k.join("")}if(o={version:"1.4.1",ucs2:{decode:_,encode:v},decode:k,encode:T,toASCII:function(e){return y(e,(function(e){return c.test(e)?"xn--"+T(e):e}))},toUnicode:function(e){return y(e,(function(e){return h.test(e)?k(e.slice(4).toLowerCase()):e}))}},r&&a)if(i.exports==r)a.exports=o;else for(u in o)o.hasOwnProperty(u)&&(r[u]=o[u]);else t.punycode=o}(this)}).call(this,void 0!==t?t:"undefined"!=typeof self?self:void 0!==r?r:{})},{}],135:[function(e,t,r){"use strict";function i(e,t){return Object.prototype.hasOwnProperty.call(e,t)}t.exports=function(e,t,r,a){t=t||"&",r=r||"=";var s={};if("string"!=typeof e||0===e.length)return s;var o=/\+/g;e=e.split(t);var u=1e3;a&&"number"==typeof a.maxKeys&&(u=a.maxKeys);var l=e.length;u>0&&l>u&&(l=u);for(var h=0;h=0?(c=m.substr(0,g),f=m.substr(g+1)):(c=m,f=""),d=decodeURIComponent(c),p=decodeURIComponent(f),i(s,d)?n(s[d])?s[d].push(p):s[d]=[s[d],p]:s[d]=p}return s};var n=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)}},{}],136:[function(e,t,r){"use strict";var i=function(e){switch(typeof e){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}};t.exports=function(e,t,r,o){return t=t||"&",r=r||"=",null===e&&(e=void 0),"object"==typeof e?a(s(e),(function(s){var o=encodeURIComponent(i(s))+r;return n(e[s])?a(e[s],(function(e){return o+encodeURIComponent(i(e))})).join(t):o+encodeURIComponent(i(e[s]))})).join(t):o?encodeURIComponent(i(o))+r+encodeURIComponent(i(e)):""};var n=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)};function a(e,t){if(e.map)return e.map(t);for(var r=[],i=0;i0?("string"==typeof t||s.objectMode||Object.getPrototypeOf(t)===l.prototype||(t=function(e){return l.from(e)}(t)),i?s.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):w(e,s,t,!0):s.ended?e.emit("error",new Error("stream.push() after EOF")):(s.reading=!1,s.decoder&&!r?(t=s.decoder.write(t),s.objectMode||0!==t.length?w(e,s,t,!1):S(e,s)):w(e,s,t,!1))):i||(s.reading=!1)),function(e){return!e.ended&&(e.needReadable||e.lengtht.highWaterMark&&(t.highWaterMark=function(e){return e>=8388608?e=8388608:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function k(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(d("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?n.nextTick(T,e):T(e))}function T(e){d("emit readable"),e.emit("readable"),A(e)}function S(e,t){t.readingMore||(t.readingMore=!0,n.nextTick(x,e,t))}function x(e,t){for(var r=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=t.length?(r=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):r=function(e,t,r){var i;return ea.length?a.length:e;if(s===a.length?n+=a:n+=a.slice(0,e),0==(e-=s)){s===a.length?(++i,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=a.slice(s));break}++i}return t.length-=i,n}(e,t):function(e,t){var r=l.allocUnsafe(e),i=t.head,n=1;for(i.data.copy(r),e-=i.data.length;i=i.next;){var a=i.data,s=e>a.length?a.length:e;if(a.copy(r,r.length-e,0,s),0==(e-=s)){s===a.length?(++n,i.next?t.head=i.next:t.head=t.tail=null):(t.head=i,i.data=a.slice(s));break}++n}return t.length-=n,r}(e,t),i}(e,t.buffer,t.decoder),r);var r}function P(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,n.nextTick(R,t,e))}function R(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function B(e,t){for(var r=0,i=e.length;r=t.highWaterMark||t.ended))return d("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?P(this):k(this),null;if(0===(e=E(e,t))&&t.ended)return 0===t.length&&P(this),null;var i,n=t.needReadable;return d("need readable",n),(0===t.length||t.length-e0?M(e,t):null)?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),r!==e&&t.ended&&P(this)),null!==i&&this.emit("data",i),i},_.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))},_.prototype.pipe=function(e,r){var i=this,a=this._readableState;switch(a.pipesCount){case 0:a.pipes=e;break;case 1:a.pipes=[a.pipes,e];break;default:a.pipes.push(e)}a.pipesCount+=1,d("pipe count=%d opts=%j",a.pipesCount,r);var u=r&&!1===r.end||e===t.stdout||e===t.stderr?_:h;function l(t,r){d("onunpipe"),t===i&&r&&!1===r.hasUnpiped&&(r.hasUnpiped=!0,d("cleanup"),e.removeListener("close",b),e.removeListener("finish",y),e.removeListener("drain",c),e.removeListener("error",g),e.removeListener("unpipe",l),i.removeListener("end",h),i.removeListener("end",_),i.removeListener("data",m),f=!0,!a.awaitDrain||e._writableState&&!e._writableState.needDrain||c())}function h(){d("onend"),e.end()}a.endEmitted?n.nextTick(u):i.once("end",u),e.on("unpipe",l);var c=function(e){return function(){var t=e._readableState;d("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&o(e,"data")&&(t.flowing=!0,A(e))}}(i);e.on("drain",c);var f=!1,p=!1;function m(t){d("ondata"),p=!1,!1!==e.write(t)||p||((1===a.pipesCount&&a.pipes===e||a.pipesCount>1&&-1!==B(a.pipes,e))&&!f&&(d("false write response, pause",i._readableState.awaitDrain),i._readableState.awaitDrain++,p=!0),i.pause())}function g(t){d("onerror",t),_(),e.removeListener("error",g),0===o(e,"error")&&e.emit("error",t)}function b(){e.removeListener("finish",y),_()}function y(){d("onfinish"),e.removeListener("close",b),_()}function _(){d("unpipe"),i.unpipe(e)}return i.on("data",m),function(e,t,r){if("function"==typeof e.prependListener)return e.prependListener(t,r);e._events&&e._events[t]?s(e._events[t])?e._events[t].unshift(r):e._events[t]=[r,e._events[t]]:e.on(t,r)}(e,"error",g),e.once("close",b),e.once("finish",y),e.emit("pipe",i),a.flowing||(d("pipe resume"),i.resume()),e},_.prototype.unpipe=function(e){var t=this._readableState,r={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes||(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,r)),this;if(!e){var i=t.pipes,n=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var a=0;a-1?n:a.nextTick;y.WritableState=b;var l=e("core-util-is");l.inherits=e("inherits");var h,c={deprecate:e("util-deprecate")},f=e("./internal/streams/stream"),d=e("safe-buffer").Buffer,p=r.Uint8Array||function(){},m=e("./internal/streams/destroy");function g(){}function b(t,r){o=o||e("./_stream_duplex"),t=t||{};var i=r instanceof o;this.objectMode=!!t.objectMode,i&&(this.objectMode=this.objectMode||!!t.writableObjectMode);var n=t.highWaterMark,l=t.writableHighWaterMark,h=this.objectMode?16:16384;this.highWaterMark=n||0===n?n:i&&(l||0===l)?l:h,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var c=!1===t.decodeStrings;this.decodeStrings=!c,this.defaultEncoding=t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){!function(e,t){var r=e._writableState,i=r.sync,n=r.writecb;if(function(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}(r),t)!function(e,t,r,i,n){--t.pendingcb,r?(a.nextTick(n,i),a.nextTick(T,e,t),e._writableState.errorEmitted=!0,e.emit("error",i)):(n(i),e._writableState.errorEmitted=!0,e.emit("error",i),T(e,t))}(e,r,i,t,n);else{var s=E(r);s||r.corked||r.bufferProcessing||!r.bufferedRequest||w(e,r),i?u(v,e,r,s,n):v(e,r,s,n)}}(r,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new s(this)}function y(t){if(o=o||e("./_stream_duplex"),!(h.call(y,this)||this instanceof o))return new y(t);this._writableState=new b(t,this),this.writable=!0,t&&("function"==typeof t.write&&(this._write=t.write),"function"==typeof t.writev&&(this._writev=t.writev),"function"==typeof t.destroy&&(this._destroy=t.destroy),"function"==typeof t.final&&(this._final=t.final)),f.call(this)}function _(e,t,r,i,n,a,s){t.writelen=i,t.writecb=s,t.writing=!0,t.sync=!0,r?e._writev(n,t.onwrite):e._write(n,a,t.onwrite),t.sync=!1}function v(e,t,r,i){r||function(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}(e,t),t.pendingcb--,i(),T(e,t)}function w(e,t){t.bufferProcessing=!0;var r=t.bufferedRequest;if(e._writev&&r&&r.next){var i=t.bufferedRequestCount,n=new Array(i),a=t.corkedRequestsFree;a.entry=r;for(var o=0,u=!0;r;)n[o]=r,r.isBuf||(u=!1),r=r.next,o+=1;n.allBuffers=u,_(e,t,!0,t.length,n,"",a.finish),t.pendingcb++,t.lastBufferedRequest=null,a.next?(t.corkedRequestsFree=a.next,a.next=null):t.corkedRequestsFree=new s(t),t.bufferedRequestCount=0}else{for(;r;){var l=r.chunk,h=r.encoding,c=r.callback;if(_(e,t,!1,t.objectMode?1:l.length,l,h,c),r=r.next,t.bufferedRequestCount--,t.writing)break}null===r&&(t.lastBufferedRequest=null)}t.bufferedRequest=r,t.bufferProcessing=!1}function E(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function k(e,t){e._final((function(r){t.pendingcb--,r&&e.emit("error",r),t.prefinished=!0,e.emit("prefinish"),T(e,t)}))}function T(e,t){var r=E(t);return r&&(function(e,t){t.prefinished||t.finalCalled||("function"==typeof e._final?(t.pendingcb++,t.finalCalled=!0,a.nextTick(k,e,t)):(t.prefinished=!0,e.emit("prefinish")))}(e,t),0===t.pendingcb&&(t.finished=!0,e.emit("finish"))),r}l.inherits(y,f),b.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(b.prototype,"buffer",{get:c.deprecate((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(e){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(h=Function.prototype[Symbol.hasInstance],Object.defineProperty(y,Symbol.hasInstance,{value:function(e){return!!h.call(this,e)||this===y&&e&&e._writableState instanceof b}})):h=function(e){return e instanceof this},y.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},y.prototype.write=function(e,t,r){var i,n=this._writableState,s=!1,o=!n.objectMode&&(i=e,d.isBuffer(i)||i instanceof p);return o&&!d.isBuffer(e)&&(e=function(e){return d.from(e)}(e)),"function"==typeof t&&(r=t,t=null),o?t="buffer":t||(t=n.defaultEncoding),"function"!=typeof r&&(r=g),n.ended?function(e,t){var r=new Error("write after end");e.emit("error",r),a.nextTick(t,r)}(this,r):(o||function(e,t,r,i){var n=!0,s=!1;return null===r?s=new TypeError("May not write null values to stream"):"string"==typeof r||void 0===r||t.objectMode||(s=new TypeError("Invalid non-string/buffer chunk")),s&&(e.emit("error",s),a.nextTick(i,s),n=!1),n}(this,n,e,r))&&(n.pendingcb++,s=function(e,t,r,i,n,a){if(!r){var s=function(e,t,r){return e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=d.from(t,r)),t}(t,i,n);i!==s&&(r=!0,n="buffer",i=s)}var o=t.objectMode?1:i.length;t.length+=o;var u=t.length-1))throw new TypeError("Unknown encoding: "+e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(y.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),y.prototype._write=function(e,t,r){r(new Error("_write() is not implemented"))},y.prototype._writev=null,y.prototype.end=function(e,t,r){var i=this._writableState;"function"==typeof e?(r=e,e=null,t=null):"function"==typeof t&&(r=t,t=null),null!=e&&this.write(e,t),i.corked&&(i.corked=1,this.uncork()),i.ending||i.finished||function(e,t,r){t.ending=!0,T(e,t),r&&(t.finished?a.nextTick(r):e.once("finish",r)),t.ended=!0,e.writable=!1}(this,i,r)},Object.defineProperty(y.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),y.prototype.destroy=m.destroy,y.prototype._undestroy=m.undestroy,y.prototype._destroy=function(e,t){this.end(),t(e)}}).call(this,e("_process"),void 0!==t?t:"undefined"!=typeof self?self:void 0!==r?r:{},e("timers").setImmediate)},{"./_stream_duplex":139,"./internal/streams/destroy":145,"./internal/streams/stream":146,_process:133,"core-util-is":51,inherits:75,"process-nextick-args":132,"safe-buffer":147,timers:176,"util-deprecate":183}],144:[function(e,t,r){"use strict";var i=e("safe-buffer").Buffer,n=e("util");t.exports=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.head=null,this.tail=null,this.length=0}return e.prototype.push=function(e){var t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length},e.prototype.unshift=function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length},e.prototype.shift=function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}},e.prototype.clear=function(){this.head=this.tail=null,this.length=0},e.prototype.join=function(e){if(0===this.length)return"";for(var t=this.head,r=""+t.data;t=t.next;)r+=e+t.data;return r},e.prototype.concat=function(e){if(0===this.length)return i.alloc(0);if(1===this.length)return this.head.data;for(var t,r,n,a=i.allocUnsafe(e>>>0),s=this.head,o=0;s;)t=s.data,r=a,n=o,t.copy(r,n),o+=s.data.length,s=s.next;return a},e}(),n&&n.inspect&&n.inspect.custom&&(t.exports.prototype[n.inspect.custom]=function(){var e=n.inspect({length:this.length});return this.constructor.name+" "+e})},{"safe-buffer":147,util:33}],145:[function(e,t,r){"use strict";var i=e("process-nextick-args");function n(e,t){e.emit("error",t)}t.exports={destroy:function(e,t){var r=this,a=this._readableState&&this._readableState.destroyed,s=this._writableState&&this._writableState.destroyed;return a||s?(t?t(e):!e||this._writableState&&this._writableState.errorEmitted||i.nextTick(n,this,e),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,(function(e){!t&&e?(i.nextTick(n,r,e),r._writableState&&(r._writableState.errorEmitted=!0)):t&&t(e)})),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}}},{"process-nextick-args":132}],146:[function(e,t,r){t.exports=e("events").EventEmitter},{events:52}],147:[function(e,t,r){var i=e("buffer"),n=i.Buffer;function a(e,t){for(var r in e)t[r]=e[r]}function s(e,t,r){return n(e,t,r)}n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow?t.exports=i:(a(i,r),r.Buffer=s),a(n,s),s.from=function(e,t,r){if("number"==typeof e)throw new TypeError("Argument must not be a number");return n(e,t,r)},s.alloc=function(e,t,r){if("number"!=typeof e)throw new TypeError("Argument must be a number");var i=n(e);return void 0!==t?"string"==typeof r?i.fill(t,r):i.fill(t):i.fill(0),i},s.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return n(e)},s.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return i.SlowBuffer(e)}},{buffer:48}],148:[function(e,t,r){"use strict";var i=e("safe-buffer").Buffer,n=i.isEncoding||function(e){switch((e=""+e)&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function a(e){var t;switch(this.encoding=function(e){var t=function(e){if(!e)return"utf8";for(var t;;)switch(e){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}}(e);if("string"!=typeof t&&(i.isEncoding===n||!n(e)))throw new Error("Unknown encoding: "+e);return t||e}(e),this.encoding){case"utf16le":this.text=u,this.end=l,t=4;break;case"utf8":this.fillLast=o,t=4;break;case"base64":this.text=h,this.end=c,t=3;break;default:return this.write=f,void(this.end=d)}this.lastNeed=0,this.lastTotal=0,this.lastChar=i.allocUnsafe(t)}function s(e){return e<=127?0:e>>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function o(e){var t=this.lastTotal-this.lastNeed,r=function(e,t,r){if(128!=(192&t[0]))return e.lastNeed=0,"�";if(e.lastNeed>1&&t.length>1){if(128!=(192&t[1]))return e.lastNeed=1,"�";if(e.lastNeed>2&&t.length>2&&128!=(192&t[2]))return e.lastNeed=2,"�"}}(this,e);return void 0!==r?r:this.lastNeed<=e.length?(e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(e.copy(this.lastChar,t,0,e.length),void(this.lastNeed-=e.length))}function u(e,t){if((e.length-t)%2==0){var r=e.toString("utf16le",t);if(r){var i=r.charCodeAt(r.length-1);if(i>=55296&&i<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function l(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,r)}return t}function h(e,t){var r=(e.length-t)%3;return 0===r?e.toString("base64",t):(this.lastNeed=3-r,this.lastTotal=3,1===r?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-r))}function c(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function f(e){return e.toString(this.encoding)}function d(e){return e&&e.length?this.write(e):""}r.StringDecoder=a,a.prototype.write=function(e){if(0===e.length)return"";var t,r;if(this.lastNeed){if(void 0===(t=this.fillLast(e)))return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r=0?(n>0&&(e.lastNeed=n-1),n):--i=0?(n>0&&(e.lastNeed=n-2),n):--i=0?(n>0&&(2===n?n=0:e.lastNeed=n-3),n):0}(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=r;var i=e.length-(r-this.lastNeed);return e.copy(this.lastChar,0,i),e.toString("utf8",t,i)},a.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length}},{"safe-buffer":147}],149:[function(e,t,r){t.exports=e("./readable").PassThrough},{"./readable":150}],150:[function(e,t,r){(r=t.exports=e("./lib/_stream_readable.js")).Stream=r,r.Readable=r,r.Writable=e("./lib/_stream_writable.js"),r.Duplex=e("./lib/_stream_duplex.js"),r.Transform=e("./lib/_stream_transform.js"),r.PassThrough=e("./lib/_stream_passthrough.js")},{"./lib/_stream_duplex.js":139,"./lib/_stream_passthrough.js":140,"./lib/_stream_readable.js":141,"./lib/_stream_transform.js":142,"./lib/_stream_writable.js":143}],151:[function(e,t,r){t.exports=e("./readable").Transform},{"./readable":150}],152:[function(e,t,r){t.exports=e("./lib/_stream_writable.js")},{"./lib/_stream_writable.js":143}],153:[function(e,t,r){var i=function(e){"use strict";var t=Object.prototype,r=t.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},n=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",s=i.toStringTag||"@@toStringTag";function o(e,t,r,i){var n=t&&t.prototype instanceof h?t:h,a=Object.create(n.prototype),s=new E(i||[]);return a._invoke=function(e,t,r){var i="suspendedStart";return function(n,a){if("executing"===i)throw new Error("Generator is already running");if("completed"===i){if("throw"===n)throw a;return{value:void 0,done:!0}}for(r.method=n,r.arg=a;;){var s=r.delegate;if(s){var o=_(s,r);if(o){if(o===l)continue;return o}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===i)throw i="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i="executing";var h=u(e,t,r);if("normal"===h.type){if(i=r.done?"completed":"suspendedYield",h.arg===l)continue;return{value:h.arg,done:r.done}}"throw"===h.type&&(i="completed",r.method="throw",r.arg=h.arg)}}}(e,r,s),a}function u(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=o;var l={};function h(){}function c(){}function f(){}var d={};d[n]=function(){return this};var p=Object.getPrototypeOf,m=p&&p(p(k([])));m&&m!==t&&r.call(m,n)&&(d=m);var g=f.prototype=h.prototype=Object.create(d);function b(e){["next","throw","return"].forEach((function(t){e[t]=function(e){return this._invoke(t,e)}}))}function y(e){var t;this._invoke=function(i,n){function a(){return new Promise((function(t,a){!function t(i,n,a,s){var o=u(e[i],e,n);if("throw"!==o.type){var l=o.arg,h=l.value;return h&&"object"==typeof h&&r.call(h,"__await")?Promise.resolve(h.__await).then((function(e){t("next",e,a,s)}),(function(e){t("throw",e,a,s)})):Promise.resolve(h).then((function(e){l.value=e,a(l)}),(function(e){return t("throw",e,a,s)}))}s(o.arg)}(i,n,t,a)}))}return t=t?t.then(a,a):a()}}function _(e,t){var r=e.iterator[t.method];if(void 0===r){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,_(e,t),"throw"===t.method))return l;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return l}var i=u(r,e.iterator,t.arg);if("throw"===i.type)return t.method="throw",t.arg=i.arg,t.delegate=null,l;var n=i.arg;return n?n.done?(t[e.resultName]=n.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,l):n:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,l)}function v(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function w(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function E(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(v,this),this.reset(!0)}function k(e){if(e){var t=e[n];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var i=-1,a=function t(){for(;++i=0;--n){var a=this.tryEntries[n],s=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var o=r.call(a,"catchLoc"),u=r.call(a,"finallyLoc");if(o&&u){if(this.prev=0;--i){var n=this.tryEntries[i];if(n.tryLoc<=this.prev&&r.call(n,"finallyLoc")&&this.prev=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),w(r),l}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var i=r.completion;if("throw"===i.type){var n=i.arg;w(r)}return n}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:k(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),l}},e}("object"==typeof t?t.exports:{});try{regeneratorRuntime=i}catch(e){Function("r","regeneratorRuntime = r")(i)}},{}],154:[function(e,t,r){var i=e("buffer"),n=i.Buffer;function a(e,t){for(var r in e)t[r]=e[r]}function s(e,t,r){return n(e,t,r)}n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow?t.exports=i:(a(i,r),r.Buffer=s),s.prototype=Object.create(n.prototype),a(n,s),s.from=function(e,t,r){if("number"==typeof e)throw new TypeError("Argument must not be a number");return n(e,t,r)},s.alloc=function(e,t,r){if("number"!=typeof e)throw new TypeError("Argument must be a number");var i=n(e);return void 0!==t?"string"==typeof r?i.fill(t,r):i.fill(t):i.fill(0),i},s.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return n(e)},s.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return i.SlowBuffer(e)}},{buffer:48}],155:[function(e,t,r){t.exports=n;var i=e("events").EventEmitter;function n(){i.call(this)}e("inherits")(n,i),n.Readable=e("readable-stream/readable.js"),n.Writable=e("readable-stream/writable.js"),n.Duplex=e("readable-stream/duplex.js"),n.Transform=e("readable-stream/transform.js"),n.PassThrough=e("readable-stream/passthrough.js"),n.Stream=n,n.prototype.pipe=function(e,t){var r=this;function n(t){e.writable&&!1===e.write(t)&&r.pause&&r.pause()}function a(){r.readable&&r.resume&&r.resume()}r.on("data",n),e.on("drain",a),e._isStdio||t&&!1===t.end||(r.on("end",o),r.on("close",u));var s=!1;function o(){s||(s=!0,e.end())}function u(){s||(s=!0,"function"==typeof e.destroy&&e.destroy())}function l(e){if(h(),0===i.listenerCount(this,"error"))throw e}function h(){r.removeListener("data",n),e.removeListener("drain",a),r.removeListener("end",o),r.removeListener("close",u),r.removeListener("error",l),e.removeListener("error",l),r.removeListener("end",h),r.removeListener("close",h),e.removeListener("close",h)}return r.on("error",l),e.on("error",l),r.on("end",h),r.on("close",h),e.on("close",h),e.emit("pipe",r),e}},{events:52,inherits:75,"readable-stream/duplex.js":138,"readable-stream/passthrough.js":149,"readable-stream/readable.js":150,"readable-stream/transform.js":151,"readable-stream/writable.js":152}],156:[function(e,i,n){(function(t){var r=e("./lib/request"),i=e("./lib/response"),a=e("xtend"),s=e("builtin-status-codes"),o=e("url"),u=n;u.request=function(e,i){e="string"==typeof e?o.parse(e):a(e);var n=-1===t.location.protocol.search(/^https?:$/)?"http:":"",s=e.protocol||n,u=e.hostname||e.host,l=e.port,h=e.path||"/";u&&-1!==u.indexOf(":")&&(u="["+u+"]"),e.url=(u?s+"//"+u:"")+(l?":"+l:"")+h,e.method=(e.method||"GET").toUpperCase(),e.headers=e.headers||{};var c=new r(e);return i&&c.on("response",i),c},u.get=function(e,t){var r=u.request(e,t);return r.end(),r},u.ClientRequest=r,u.IncomingMessage=i.IncomingMessage,u.Agent=function(){},u.Agent.defaultMaxSockets=4,u.globalAgent=new u.Agent,u.STATUS_CODES=s,u.METHODS=["CHECKOUT","CONNECT","COPY","DELETE","GET","HEAD","LOCK","M-SEARCH","MERGE","MKACTIVITY","MKCOL","MOVE","NOTIFY","OPTIONS","PATCH","POST","PROPFIND","PROPPATCH","PURGE","PUT","REPORT","SEARCH","SUBSCRIBE","TRACE","UNLOCK","UNSUBSCRIBE"]}).call(this,void 0!==t?t:"undefined"!=typeof self?self:void 0!==r?r:{})},{"./lib/request":158,"./lib/response":159,"builtin-status-codes":50,url:180,xtend:189}],157:[function(e,i,n){(function(e){var t;function r(){if(void 0!==t)return t;if(e.XMLHttpRequest){t=new e.XMLHttpRequest;try{t.open("GET",e.XDomainRequest?"/":"https://example.com")}catch(e){t=null}}else t=null;return t}function i(e){var t=r();if(!t)return!1;try{return t.responseType=e,t.responseType===e}catch(e){}return!1}function a(e){return"function"==typeof e}n.fetch=a(e.fetch)&&a(e.ReadableStream),n.writableStream=a(e.WritableStream),n.abortController=a(e.AbortController),n.arraybuffer=n.fetch||i("arraybuffer"),n.msstream=!n.fetch&&i("ms-stream"),n.mozchunkedarraybuffer=!n.fetch&&i("moz-chunked-arraybuffer"),n.overrideMimeType=n.fetch||!!r()&&a(r().overrideMimeType),t=null}).call(this,void 0!==t?t:"undefined"!=typeof self?self:void 0!==r?r:{})},{}],158:[function(e,i,n){(function(t,r,n){var a=e("./capability"),s=e("inherits"),o=e("./response"),u=e("readable-stream"),l=o.IncomingMessage,h=o.readyStates,c=i.exports=function(e){var t,r=this;u.Writable.call(r),r._opts=e,r._body=[],r._headers={},e.auth&&r.setHeader("Authorization","Basic "+n.from(e.auth).toString("base64")),Object.keys(e.headers).forEach((function(t){r.setHeader(t,e.headers[t])}));var i=!0;if("disable-fetch"===e.mode||"requestTimeout"in e&&!a.abortController)i=!1,t=!0;else if("prefer-streaming"===e.mode)t=!1;else if("allow-wrong-content-type"===e.mode)t=!a.overrideMimeType;else{if(e.mode&&"default"!==e.mode&&"prefer-fast"!==e.mode)throw new Error("Invalid value for opts.mode");t=!0}r._mode=function(e,t){return a.fetch&&t?"fetch":a.mozchunkedarraybuffer?"moz-chunked-arraybuffer":a.msstream?"ms-stream":a.arraybuffer&&e?"arraybuffer":"text"}(t,i),r._fetchTimer=null,r.on("finish",(function(){r._onFinish()}))};s(c,u.Writable),c.prototype.setHeader=function(e,t){var r=e.toLowerCase();-1===f.indexOf(r)&&(this._headers[r]={name:e,value:t})},c.prototype.getHeader=function(e){var t=this._headers[e.toLowerCase()];return t?t.value:null},c.prototype.removeHeader=function(e){delete this._headers[e.toLowerCase()]},c.prototype._onFinish=function(){var e=this;if(!e._destroyed){var i=e._opts,n=e._headers,s=null;"GET"!==i.method&&"HEAD"!==i.method&&(s=new Blob(e._body,{type:(n["content-type"]||{}).value||""}));var o=[];if(Object.keys(n).forEach((function(e){var t=n[e].name,r=n[e].value;Array.isArray(r)?r.forEach((function(e){o.push([t,e])})):o.push([t,r])})),"fetch"===e._mode){var u=null;if(a.abortController){var l=new AbortController;u=l.signal,e._fetchAbortController=l,"requestTimeout"in i&&0!==i.requestTimeout&&(e._fetchTimer=r.setTimeout((function(){e.emit("requestTimeout"),e._fetchAbortController&&e._fetchAbortController.abort()}),i.requestTimeout))}r.fetch(e._opts.url,{method:e._opts.method,headers:o,body:s||void 0,mode:"cors",credentials:i.withCredentials?"include":"same-origin",signal:u}).then((function(t){e._fetchResponse=t,e._connect()}),(function(t){r.clearTimeout(e._fetchTimer),e._destroyed||e.emit("error",t)}))}else{var c=e._xhr=new r.XMLHttpRequest;try{c.open(e._opts.method,e._opts.url,!0)}catch(r){return void t.nextTick((function(){e.emit("error",r)}))}"responseType"in c&&(c.responseType=e._mode),"withCredentials"in c&&(c.withCredentials=!!i.withCredentials),"text"===e._mode&&"overrideMimeType"in c&&c.overrideMimeType("text/plain; charset=x-user-defined"),"requestTimeout"in i&&(c.timeout=i.requestTimeout,c.ontimeout=function(){e.emit("requestTimeout")}),o.forEach((function(e){c.setRequestHeader(e[0],e[1])})),e._response=null,c.onreadystatechange=function(){switch(c.readyState){case h.LOADING:case h.DONE:e._onXHRProgress()}},"moz-chunked-arraybuffer"===e._mode&&(c.onprogress=function(){e._onXHRProgress()}),c.onerror=function(){e._destroyed||e.emit("error",new Error("XHR error"))};try{c.send(s)}catch(r){return void t.nextTick((function(){e.emit("error",r)}))}}}},c.prototype._onXHRProgress=function(){(function(e){try{var t=e.status;return null!==t&&0!==t}catch(e){return!1}})(this._xhr)&&!this._destroyed&&(this._response||this._connect(),this._response._onXHRProgress())},c.prototype._connect=function(){var e=this;e._destroyed||(e._response=new l(e._xhr,e._fetchResponse,e._mode,e._fetchTimer),e._response.on("error",(function(t){e.emit("error",t)})),e.emit("response",e._response))},c.prototype._write=function(e,t,r){this._body.push(e),r()},c.prototype.abort=c.prototype.destroy=function(){this._destroyed=!0,r.clearTimeout(this._fetchTimer),this._response&&(this._response._destroyed=!0),this._xhr?this._xhr.abort():this._fetchAbortController&&this._fetchAbortController.abort()},c.prototype.end=function(e,t,r){"function"==typeof e&&(r=e,e=void 0),u.Writable.prototype.end.call(this,e,t,r)},c.prototype.flushHeaders=function(){},c.prototype.setTimeout=function(){},c.prototype.setNoDelay=function(){},c.prototype.setSocketKeepAlive=function(){};var f=["accept-charset","accept-encoding","access-control-request-headers","access-control-request-method","connection","content-length","cookie","cookie2","date","dnt","expect","host","keep-alive","origin","referer","te","trailer","transfer-encoding","upgrade","via"]}).call(this,e("_process"),void 0!==t?t:"undefined"!=typeof self?self:void 0!==r?r:{},e("buffer").Buffer)},{"./capability":157,"./response":159,_process:133,buffer:48,inherits:75,"readable-stream":174}],159:[function(e,i,n){(function(t,r,i){var a=e("./capability"),s=e("inherits"),o=e("readable-stream"),u=n.readyStates={UNSENT:0,OPENED:1,HEADERS_RECEIVED:2,LOADING:3,DONE:4},l=n.IncomingMessage=function(e,n,s,u){var l=this;if(o.Readable.call(l),l._mode=s,l.headers={},l.rawHeaders=[],l.trailers={},l.rawTrailers=[],l.on("end",(function(){t.nextTick((function(){l.emit("close")}))})),"fetch"===s){if(l._fetchResponse=n,l.url=n.url,l.statusCode=n.status,l.statusMessage=n.statusText,n.headers.forEach((function(e,t){l.headers[t.toLowerCase()]=e,l.rawHeaders.push(t,e)})),a.writableStream){var h=new WritableStream({write:function(e){return new Promise((function(t,r){l._destroyed?r():l.push(i.from(e))?t():l._resumeFetch=t}))},close:function(){r.clearTimeout(u),l._destroyed||l.push(null)},abort:function(e){l._destroyed||l.emit("error",e)}});try{return void n.body.pipeTo(h).catch((function(e){r.clearTimeout(u),l._destroyed||l.emit("error",e)}))}catch(e){}}var c=n.body.getReader();!function e(){c.read().then((function(t){if(!l._destroyed){if(t.done)return r.clearTimeout(u),void l.push(null);l.push(i.from(t.value)),e()}})).catch((function(e){r.clearTimeout(u),l._destroyed||l.emit("error",e)}))}()}else if(l._xhr=e,l._pos=0,l.url=e.responseURL,l.statusCode=e.status,l.statusMessage=e.statusText,e.getAllResponseHeaders().split(/\r?\n/).forEach((function(e){var t=e.match(/^([^:]+):\s*(.*)/);if(t){var r=t[1].toLowerCase();"set-cookie"===r?(void 0===l.headers[r]&&(l.headers[r]=[]),l.headers[r].push(t[2])):void 0!==l.headers[r]?l.headers[r]+=", "+t[2]:l.headers[r]=t[2],l.rawHeaders.push(t[1],t[2])}})),l._charset="x-user-defined",!a.overrideMimeType){var f=l.rawHeaders["mime-type"];if(f){var d=f.match(/;\s*charset=([^;])(;|$)/);d&&(l._charset=d[1].toLowerCase())}l._charset||(l._charset="utf-8")}};s(l,o.Readable),l.prototype._read=function(){var e=this._resumeFetch;e&&(this._resumeFetch=null,e())},l.prototype._onXHRProgress=function(){var e=this,t=e._xhr,n=null;switch(e._mode){case"text":if((n=t.responseText).length>e._pos){var a=n.substr(e._pos);if("x-user-defined"===e._charset){for(var s=i.alloc(a.length),o=0;oe._pos&&(e.push(i.from(new Uint8Array(l.result.slice(e._pos)))),e._pos=l.result.byteLength)},l.onload=function(){e.push(null)},l.readAsArrayBuffer(n)}e._xhr.readyState===u.DONE&&"ms-stream"!==e._mode&&e.push(null)}}).call(this,e("_process"),void 0!==t?t:"undefined"!=typeof self?self:void 0!==r?r:{},e("buffer").Buffer)},{"./capability":157,_process:133,buffer:48,inherits:75,"readable-stream":174}],160:[function(e,t,r){"use strict";var i={};function n(e,t,r){r||(r=Error);var n=function(e){var r,i;function n(r,i,n){return e.call(this,function(e,r,i){return"string"==typeof t?t:t(e,r,i)}(r,i,n))||this}return i=e,(r=n).prototype=Object.create(i.prototype),r.prototype.constructor=r,r.__proto__=i,n}(r);n.prototype.name=r.name,n.prototype.code=e,i[e]=n}function a(e,t){if(Array.isArray(e)){var r=e.length;return e=e.map((function(e){return String(e)})),r>2?"one of ".concat(t," ").concat(e.slice(0,r-1).join(", "),", or ")+e[r-1]:2===r?"one of ".concat(t," ").concat(e[0]," or ").concat(e[1]):"of ".concat(t," ").concat(e[0])}return"of ".concat(t," ").concat(String(e))}n("ERR_INVALID_OPT_VALUE",(function(e,t){return'The value "'+t+'" is invalid for option "'+e+'"'}),TypeError),n("ERR_INVALID_ARG_TYPE",(function(e,t,r){var i,n,s,o;if("string"==typeof t&&(n="not ",t.substr(!s||s<0?0:+s,n.length)===n)?(i="must not be",t=t.replace(/^not /,"")):i="must be",function(e,t,r){return(void 0===r||r>e.length)&&(r=e.length),e.substring(r-t.length,r)===t}(e," argument"))o="The ".concat(e," ").concat(i," ").concat(a(t,"type"));else{var u=function(e,t,r){return"number"!=typeof r&&(r=0),!(r+t.length>e.length)&&-1!==e.indexOf(t,r)}(e,".")?"property":"argument";o='The "'.concat(e,'" ').concat(u," ").concat(i," ").concat(a(t,"type"))}return o+=". Received type ".concat(typeof r)}),TypeError),n("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),n("ERR_METHOD_NOT_IMPLEMENTED",(function(e){return"The "+e+" method is not implemented"})),n("ERR_STREAM_PREMATURE_CLOSE","Premature close"),n("ERR_STREAM_DESTROYED",(function(e){return"Cannot call "+e+" after a stream was destroyed"})),n("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),n("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),n("ERR_STREAM_WRITE_AFTER_END","write after end"),n("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),n("ERR_UNKNOWN_ENCODING",(function(e){return"Unknown encoding: "+e}),TypeError),n("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),t.exports.codes=i},{}],161:[function(e,t,r){(function(e){"use strict";var r=new Set;t.exports.emitExperimentalWarning=e.emitWarning?function(t){if(!r.has(t)){var i=t+" is an experimental feature. This feature could change at any time";r.add(t),e.emitWarning(i,"ExperimentalWarning")}}:function(){}}).call(this,e("_process"))},{_process:133}],162:[function(e,t,r){(function(r){"use strict";var i=Object.keys||function(e){var t=[];for(var r in e)t.push(r);return t};t.exports=l;var n=e("./_stream_readable"),a=e("./_stream_writable");e("inherits")(l,n);for(var s=i(a.prototype),o=0;o0)if("string"==typeof t||o.objectMode||Object.getPrototypeOf(t)===u.prototype||(t=function(e){return u.from(e)}(t)),i)o.endEmitted?e.emit("error",new v):x(e,o,t,!0);else if(o.ended)e.emit("error",new y);else{if(o.destroyed)return!1;o.reading=!1,o.decoder&&!r?(t=o.decoder.write(t),o.objectMode||0!==t.length?x(e,o,t,!1):M(e,o)):x(e,o,t,!1)}else i||(o.reading=!1,M(e,o));return!o.ended&&(o.lengtht.highWaterMark&&(t.highWaterMark=function(e){return e>=8388608?e=8388608:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function C(e){var r=e._readableState;r.needReadable=!1,r.emittedReadable||(a("emitReadable",r.flowing),r.emittedReadable=!0,t.nextTick(A,e))}function A(e){var t=e._readableState;a("emitReadable_",t.destroyed,t.length,t.ended),t.destroyed||!t.length&&!t.ended||e.emit("readable"),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,D(e)}function M(e,r){r.readingMore||(r.readingMore=!0,t.nextTick(P,e,r))}function P(e,t){for(;!t.reading&&!t.ended&&(t.length0,t.resumeScheduled&&!t.paused?t.flowing=!0:e.listenerCount("data")>0&&e.resume()}function B(e){a("readable nexttick read 0"),e.read(0)}function O(e,t){a("resume",t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit("resume"),D(e),t.flowing&&!t.reading&&e.read(0)}function D(e){var t=e._readableState;for(a("flow",t.flowing);t.flowing&&null!==e.read(););}function L(e,t){return 0===t.length?null:(t.objectMode?r=t.buffer.shift():!e||e>=t.length?(r=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):r=t.buffer.consume(e,t.decoder),r);var r}function F(e){var r=e._readableState;a("endReadable",r.endEmitted),r.endEmitted||(r.ended=!0,t.nextTick(z,r,e))}function z(e,t){a("endReadableNT",e.endEmitted,e.length),e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function N(e,t){for(var r=0,i=e.length;r=t.highWaterMark:t.length>0)||t.ended))return a("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?F(this):C(this),null;if(0===(e=I(e,t))&&t.ended)return 0===t.length&&F(this),null;var i,n=t.needReadable;return a("need readable",n),(0===t.length||t.length-e0?L(e,t):null)?(t.needReadable=!0,e=0):(t.length-=e,t.awaitDrain=0),0===t.length&&(t.ended||(t.needReadable=!0),r!==e&&t.ended&&F(this)),null!==i&&this.emit("data",i),i},T.prototype._read=function(e){this.emit("error",new _("_read()"))},T.prototype.pipe=function(e,r){var i=this,n=this._readableState;switch(n.pipesCount){case 0:n.pipes=e;break;case 1:n.pipes=[n.pipes,e];break;default:n.pipes.push(e)}n.pipesCount+=1,a("pipe count=%d opts=%j",n.pipesCount,r);var o=r&&!1===r.end||e===t.stdout||e===t.stderr?g:l;function u(t,r){a("onunpipe"),t===i&&r&&!1===r.hasUnpiped&&(r.hasUnpiped=!0,a("cleanup"),e.removeListener("close",p),e.removeListener("finish",m),e.removeListener("drain",h),e.removeListener("error",d),e.removeListener("unpipe",u),i.removeListener("end",l),i.removeListener("end",g),i.removeListener("data",f),c=!0,!n.awaitDrain||e._writableState&&!e._writableState.needDrain||h())}function l(){a("onend"),e.end()}n.endEmitted?t.nextTick(o):i.once("end",o),e.on("unpipe",u);var h=function(e){return function(){var t=e._readableState;a("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&s(e,"data")&&(t.flowing=!0,D(e))}}(i);e.on("drain",h);var c=!1;function f(t){a("ondata");var r=e.write(t);a("dest.write",r),!1===r&&((1===n.pipesCount&&n.pipes===e||n.pipesCount>1&&-1!==N(n.pipes,e))&&!c&&(a("false write response, pause",n.awaitDrain),n.awaitDrain++),i.pause())}function d(t){a("onerror",t),g(),e.removeListener("error",d),0===s(e,"error")&&e.emit("error",t)}function p(){e.removeListener("finish",m),g()}function m(){a("onfinish"),e.removeListener("close",p),g()}function g(){a("unpipe"),i.unpipe(e)}return i.on("data",f),function(e,t,r){if("function"==typeof e.prependListener)return e.prependListener(t,r);e._events&&e._events[t]?Array.isArray(e._events[t])?e._events[t].unshift(r):e._events[t]=[r,e._events[t]]:e.on(t,r)}(e,"error",d),e.once("close",p),e.once("finish",m),e.emit("pipe",i),n.flowing||(a("pipe resume"),i.resume()),e},T.prototype.unpipe=function(e){var t=this._readableState,r={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes||(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,r)),this;if(!e){var i=t.pipes,n=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var a=0;a0,!1!==n.flowing&&this.resume()):"readable"===e&&(n.endEmitted||n.readableListening||(n.readableListening=n.needReadable=!0,n.flowing=!1,n.emittedReadable=!1,a("on readable",n.length,n.reading),n.length?C(this):n.reading||t.nextTick(B,this))),i},T.prototype.addListener=T.prototype.on,T.prototype.removeListener=function(e,r){var i=o.prototype.removeListener.call(this,e,r);return"readable"===e&&t.nextTick(R,this),i},T.prototype.removeAllListeners=function(e){var r=o.prototype.removeAllListeners.apply(this,arguments);return"readable"!==e&&void 0!==e||t.nextTick(R,this),r},T.prototype.resume=function(){var e=this._readableState;return e.flowing||(a("resume"),e.flowing=!e.readableListening,function(e,r){r.resumeScheduled||(r.resumeScheduled=!0,t.nextTick(O,e,r))}(this,e)),e.paused=!1,this},T.prototype.pause=function(){return a("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(a("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},T.prototype.wrap=function(e){var t=this,r=this._readableState,i=!1;for(var n in e.on("end",(function(){if(a("wrapped end"),r.decoder&&!r.ended){var e=r.decoder.end();e&&e.length&&t.push(e)}t.push(null)})),e.on("data",(function(n){a("wrapped data"),r.decoder&&(n=r.decoder.write(n)),r.objectMode&&null==n||(r.objectMode||n&&n.length)&&(t.push(n)||(i=!0,e.pause()))})),e)void 0===this[n]&&"function"==typeof e[n]&&(this[n]=function(t){return function(){return e[t].apply(e,arguments)}}(n));for(var s=0;s-1))throw new w(e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(T.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(T.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),T.prototype._write=function(e,t,r){r(new m("_write()"))},T.prototype._writev=null,T.prototype.end=function(e,r,i){var n=this._writableState;return"function"==typeof e?(i=e,e=null,r=null):"function"==typeof r&&(i=r,r=null),null!=e&&this.write(e,r),n.corked&&(n.corked=1,this.uncork()),n.ending||function(e,r,i){r.ending=!0,M(e,r),i&&(r.finished?t.nextTick(i):e.once("finish",i)),r.ended=!0,e.writable=!1}(this,n,i),this},Object.defineProperty(T.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(T.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),T.prototype.destroy=c.destroy,T.prototype._undestroy=c.undestroy,T.prototype._destroy=function(e,t){t(e)}}).call(this,e("_process"),void 0!==t?t:"undefined"!=typeof self?self:void 0!==r?r:{})},{"../errors":160,"./_stream_duplex":162,"./internal/streams/destroy":169,"./internal/streams/state":172,"./internal/streams/stream":173,_process:133,buffer:48,inherits:75,"util-deprecate":183}],167:[function(e,t,r){(function(r){"use strict";var i;function n(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var a=e("./end-of-stream"),s=Symbol("lastResolve"),o=Symbol("lastReject"),u=Symbol("error"),l=Symbol("ended"),h=Symbol("lastPromise"),c=Symbol("handlePromise"),f=Symbol("stream");function d(e,t){return{value:e,done:t}}function p(e){var t=e[s];if(null!==t){var r=e[f].read();null!==r&&(e[h]=null,e[s]=null,e[o]=null,t(d(r,!1)))}}function m(e){r.nextTick(p,e)}var g=Object.getPrototypeOf((function(){})),b=Object.setPrototypeOf((n(i={get stream(){return this[f]},next:function(){var e=this,t=this[u];if(null!==t)return Promise.reject(t);if(this[l])return Promise.resolve(d(void 0,!0));if(this[f].destroyed)return new Promise((function(t,i){r.nextTick((function(){e[u]?i(e[u]):t(d(void 0,!0))}))}));var i,n=this[h];if(n)i=new Promise(function(e,t){return function(r,i){e.then((function(){t[l]?r(d(void 0,!0)):t[c](r,i)}),i)}}(n,this));else{var a=this[f].read();if(null!==a)return Promise.resolve(d(a,!1));i=new Promise(this[c])}return this[h]=i,i}},Symbol.asyncIterator,(function(){return this})),n(i,"return",(function(){var e=this;return new Promise((function(t,r){e[f].destroy(null,(function(e){e?r(e):t(d(void 0,!0))}))}))})),i),g);t.exports=function(e){var t,r=Object.create(b,(n(t={},f,{value:e,writable:!0}),n(t,s,{value:null,writable:!0}),n(t,o,{value:null,writable:!0}),n(t,u,{value:null,writable:!0}),n(t,l,{value:e._readableState.endEmitted,writable:!0}),n(t,c,{value:function(e,t){var i=r[f].read();i?(r[h]=null,r[s]=null,r[o]=null,e(d(i,!1))):(r[s]=e,r[o]=t)},writable:!0}),t));return r[h]=null,a(e,(function(e){if(e&&"ERR_STREAM_PREMATURE_CLOSE"!==e.code){var t=r[o];return null!==t&&(r[h]=null,r[s]=null,r[o]=null,t(e)),void(r[u]=e)}var i=r[s];null!==i&&(r[h]=null,r[s]=null,r[o]=null,i(d(void 0,!0))),r[l]=!0})),e.on("readable",m.bind(null,r)),r}}).call(this,e("_process"))},{"./end-of-stream":170,_process:133}],168:[function(e,t,r){"use strict";function i(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var n=e("buffer").Buffer,a=e("util").inspect,s=a&&a.custom||"inspect";t.exports=function(){function e(){this.head=null,this.tail=null,this.length=0}var t=e.prototype;return t.push=function(e){var t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length},t.unshift=function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length},t.shift=function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}},t.clear=function(){this.head=this.tail=null,this.length=0},t.join=function(e){if(0===this.length)return"";for(var t=this.head,r=""+t.data;t=t.next;)r+=e+t.data;return r},t.concat=function(e){if(0===this.length)return n.alloc(0);for(var t,r,i,a=n.allocUnsafe(e>>>0),s=this.head,o=0;s;)t=s.data,r=a,i=o,n.prototype.copy.call(t,r,i),o+=s.data.length,s=s.next;return a},t.consume=function(e,t){var r;return en.length?n.length:e;if(a===n.length?i+=n:i+=n.slice(0,e),0==(e-=a)){a===n.length?(++r,t.next?this.head=t.next:this.head=this.tail=null):(this.head=t,t.data=n.slice(a));break}++r}return this.length-=r,i},t._getBuffer=function(e){var t=n.allocUnsafe(e),r=this.head,i=1;for(r.data.copy(t),e-=r.data.length;r=r.next;){var a=r.data,s=e>a.length?a.length:e;if(a.copy(t,t.length-e,0,s),0==(e-=s)){s===a.length?(++i,r.next?this.head=r.next:this.head=this.tail=null):(this.head=r,r.data=a.slice(s));break}++i}return this.length-=i,t},t[s]=function(e,t){return a(this,function(e){for(var t=1;t0,(function(e){i||(i=e),e&&s.forEach(l),a||(s.forEach(l),n(i))}))}));return t.reduce(h)}},{"../../../errors":160,"./end-of-stream":170}],172:[function(e,t,r){"use strict";var i=e("../../../errors").codes.ERR_INVALID_OPT_VALUE;t.exports={getHighWaterMark:function(e,t,r,n){var a=function(e,t,r){return null!=e.highWaterMark?e.highWaterMark:t?e[r]:null}(t,n,r);if(null!=a){if(!isFinite(a)||Math.floor(a)!==a||a<0)throw new i(n?r:"highWaterMark",a);return Math.floor(a)}return e.objectMode?16:16384}}},{"../../../errors":160}],173:[function(e,t,r){arguments[4][146][0].apply(r,arguments)},{dup:146,events:52}],174:[function(e,t,r){(r=t.exports=e("./lib/_stream_readable.js")).Stream=r,r.Readable=r,r.Writable=e("./lib/_stream_writable.js"),r.Duplex=e("./lib/_stream_duplex.js"),r.Transform=e("./lib/_stream_transform.js"),r.PassThrough=e("./lib/_stream_passthrough.js"),r.finished=e("./lib/internal/streams/end-of-stream.js"),r.pipeline=e("./lib/internal/streams/pipeline.js")},{"./lib/_stream_duplex.js":162,"./lib/_stream_passthrough.js":163,"./lib/_stream_readable.js":164,"./lib/_stream_transform.js":165,"./lib/_stream_writable.js":166,"./lib/internal/streams/end-of-stream.js":170,"./lib/internal/streams/pipeline.js":171}],175:[function(e,t,r){arguments[4][148][0].apply(r,arguments)},{dup:148,"safe-buffer":154}],176:[function(e,t,i){(function(t,n){var a=e("process/browser.js").nextTick,s=Function.prototype.apply,o=Array.prototype.slice,u={},l=0;function h(e,t){this._id=e,this._clearFn=t}i.setTimeout=function(){return new h(s.call(setTimeout,r,arguments),clearTimeout)},i.setInterval=function(){return new h(s.call(setInterval,r,arguments),clearInterval)},i.clearTimeout=i.clearInterval=function(e){e.close()},h.prototype.unref=h.prototype.ref=function(){},h.prototype.close=function(){this._clearFn.call(r,this._id)},i.enroll=function(e,t){clearTimeout(e._idleTimeoutId),e._idleTimeout=t},i.unenroll=function(e){clearTimeout(e._idleTimeoutId),e._idleTimeout=-1},i._unrefActive=i.active=function(e){clearTimeout(e._idleTimeoutId);var t=e._idleTimeout;t>=0&&(e._idleTimeoutId=setTimeout((function(){e._onTimeout&&e._onTimeout()}),t))},i.setImmediate="function"==typeof t?t:function(e){var t=l++,r=!(arguments.length<2)&&o.call(arguments,1);return u[t]=!0,a((function(){u[t]&&(r?e.apply(null,r):e.call(null),i.clearImmediate(t))})),t},i.clearImmediate="function"==typeof n?n:function(e){delete u[e]}}).call(this,e("timers").setImmediate,e("timers").clearImmediate)},{"process/browser.js":133,timers:176}],177:[function(e,t,r){(function(e){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};function i(e){throw new Error(e)}function n(e){var t=Object.keys(e);return Object.getOwnPropertySymbols?t.concat(Object.getOwnPropertySymbols(e)):t}r.clone=s,r.addLast=l,r.addFirst=h,r.removeLast=c,r.removeFirst=f,r.insert=d,r.removeAt=p,r.replaceAt=m,r.getIn=g,r.set=b,r.setIn=y,r.update=_,r.updateIn=v,r.merge=w,r.mergeDeep=E,r.mergeIn=k,r.omit=T,r.addDefaults=S;var a={}.hasOwnProperty;function s(e){if(Array.isArray(e))return e.slice();for(var t=n(e),r={},i=0;i3?c-3:0),d=3;d=e.length||t<0?e:e.slice(0,t).concat(e.slice(t+1))}function m(e,t,r){if(e[t]===r)return e;for(var i=e.length,n=Array(i),a=0;a6?s-6:0),l=6;l6?s-6:0),l=6;l7?l-7:0),c=7;c=0||(o[h]=e[h])}return o}function S(e,t,r,i,n,a){for(var s=arguments.length,u=Array(s>6?s-6:0),l=6;l1&&(r-=1),r<1/6?e+6*(t-e)*r:r<.5?t:r<2/3?e+(t-e)*(2/3-r)*6:e}if(e=P(e,360),t=P(t,100),r=P(r,100),0===t)i=n=a=r;else{var o=r<.5?r*(1+t):r+t-r*t,u=2*r-o;i=s(u,o,e+1/3),n=s(u,o,e),a=s(u,o,e-1/3)}return{r:255*i,g:255*n,b:255*a}}(t.h,s,h),c=!0,f="hsl"),t.hasOwnProperty("a")&&(a=t.a)),a=M(a),{ok:c,format:t.format||f,r:o(255,u(r.r,0)),g:o(255,u(r.g,0)),b:o(255,u(r.b,0)),a:a}}(t);this._originalInput=t,this._r=l.r,this._g=l.g,this._b=l.b,this._a=l.a,this._roundA=s(100*this._a)/100,this._format=r.format||l.format,this._gradientType=r.gradientType,this._r<1&&(this._r=s(this._r)),this._g<1&&(this._g=s(this._g)),this._b<1&&(this._b=s(this._b)),this._ok=l.ok,this._tc_id=a++}function c(e,t,r){e=P(e,255),t=P(t,255),r=P(r,255);var i,n,a=u(e,t,r),s=o(e,t,r),l=(a+s)/2;if(a==s)i=n=0;else{var h=a-s;switch(n=l>.5?h/(2-a-s):h/(a+s),a){case e:i=(t-r)/h+(t>1)+720)%360;--t;)i.h=(i.h+n)%360,a.push(h(i));return a}function I(e,t){t=t||6;for(var r=h(e).toHsv(),i=r.h,n=r.s,a=r.v,s=[],o=1/t;t--;)s.push(h({h:i,s:n,v:a})),a=(a+o)%1;return s}h.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var e=this.toRgb();return(299*e.r+587*e.g+114*e.b)/1e3},getLuminance:function(){var t,r,i,n=this.toRgb();return t=n.r/255,r=n.g/255,i=n.b/255,.2126*(t<=.03928?t/12.92:e.pow((t+.055)/1.055,2.4))+.7152*(r<=.03928?r/12.92:e.pow((r+.055)/1.055,2.4))+.0722*(i<=.03928?i/12.92:e.pow((i+.055)/1.055,2.4))},setAlpha:function(e){return this._a=M(e),this._roundA=s(100*this._a)/100,this},toHsv:function(){var e=f(this._r,this._g,this._b);return{h:360*e.h,s:e.s,v:e.v,a:this._a}},toHsvString:function(){var e=f(this._r,this._g,this._b),t=s(360*e.h),r=s(100*e.s),i=s(100*e.v);return 1==this._a?"hsv("+t+", "+r+"%, "+i+"%)":"hsva("+t+", "+r+"%, "+i+"%, "+this._roundA+")"},toHsl:function(){var e=c(this._r,this._g,this._b);return{h:360*e.h,s:e.s,l:e.l,a:this._a}},toHslString:function(){var e=c(this._r,this._g,this._b),t=s(360*e.h),r=s(100*e.s),i=s(100*e.l);return 1==this._a?"hsl("+t+", "+r+"%, "+i+"%)":"hsla("+t+", "+r+"%, "+i+"%, "+this._roundA+")"},toHex:function(e){return d(this._r,this._g,this._b,e)},toHexString:function(e){return"#"+this.toHex(e)},toHex8:function(e){return function(e,t,r,i,n){var a=[O(s(e).toString(16)),O(s(t).toString(16)),O(s(r).toString(16)),O(L(i))];return n&&a[0].charAt(0)==a[0].charAt(1)&&a[1].charAt(0)==a[1].charAt(1)&&a[2].charAt(0)==a[2].charAt(1)&&a[3].charAt(0)==a[3].charAt(1)?a[0].charAt(0)+a[1].charAt(0)+a[2].charAt(0)+a[3].charAt(0):a.join("")}(this._r,this._g,this._b,this._a,e)},toHex8String:function(e){return"#"+this.toHex8(e)},toRgb:function(){return{r:s(this._r),g:s(this._g),b:s(this._b),a:this._a}},toRgbString:function(){return 1==this._a?"rgb("+s(this._r)+", "+s(this._g)+", "+s(this._b)+")":"rgba("+s(this._r)+", "+s(this._g)+", "+s(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:s(100*P(this._r,255))+"%",g:s(100*P(this._g,255))+"%",b:s(100*P(this._b,255))+"%",a:this._a}},toPercentageRgbString:function(){return 1==this._a?"rgb("+s(100*P(this._r,255))+"%, "+s(100*P(this._g,255))+"%, "+s(100*P(this._b,255))+"%)":"rgba("+s(100*P(this._r,255))+"%, "+s(100*P(this._g,255))+"%, "+s(100*P(this._b,255))+"%, "+this._roundA+")"},toName:function(){return 0===this._a?"transparent":!(this._a<1)&&(A[d(this._r,this._g,this._b,!0)]||!1)},toFilter:function(e){var t="#"+p(this._r,this._g,this._b,this._a),r=t,i=this._gradientType?"GradientType = 1, ":"";if(e){var n=h(e);r="#"+p(n._r,n._g,n._b,n._a)}return"progid:DXImageTransform.Microsoft.gradient("+i+"startColorstr="+t+",endColorstr="+r+")"},toString:function(e){var t=!!e;e=e||this._format;var r=!1,i=this._a<1&&this._a>=0;return t||!i||"hex"!==e&&"hex6"!==e&&"hex3"!==e&&"hex4"!==e&&"hex8"!==e&&"name"!==e?("rgb"===e&&(r=this.toRgbString()),"prgb"===e&&(r=this.toPercentageRgbString()),"hex"!==e&&"hex6"!==e||(r=this.toHexString()),"hex3"===e&&(r=this.toHexString(!0)),"hex4"===e&&(r=this.toHex8String(!0)),"hex8"===e&&(r=this.toHex8String()),"name"===e&&(r=this.toName()),"hsl"===e&&(r=this.toHslString()),"hsv"===e&&(r=this.toHsvString()),r||this.toHexString()):"name"===e&&0===this._a?this.toName():this.toRgbString()},clone:function(){return h(this.toString())},_applyModification:function(e,t){var r=e.apply(null,[this].concat([].slice.call(t)));return this._r=r._r,this._g=r._g,this._b=r._b,this.setAlpha(r._a),this},lighten:function(){return this._applyModification(y,arguments)},brighten:function(){return this._applyModification(_,arguments)},darken:function(){return this._applyModification(v,arguments)},desaturate:function(){return this._applyModification(m,arguments)},saturate:function(){return this._applyModification(g,arguments)},greyscale:function(){return this._applyModification(b,arguments)},spin:function(){return this._applyModification(w,arguments)},_applyCombination:function(e,t){return e.apply(null,[this].concat([].slice.call(t)))},analogous:function(){return this._applyCombination(x,arguments)},complement:function(){return this._applyCombination(E,arguments)},monochromatic:function(){return this._applyCombination(I,arguments)},splitcomplement:function(){return this._applyCombination(S,arguments)},triad:function(){return this._applyCombination(k,arguments)},tetrad:function(){return this._applyCombination(T,arguments)}},h.fromRatio=function(e,t){if("object"==typeof e){var r={};for(var i in e)e.hasOwnProperty(i)&&(r[i]="a"===i?e[i]:D(e[i]));e=r}return h(e,t)},h.equals=function(e,t){return!(!e||!t)&&h(e).toRgbString()==h(t).toRgbString()},h.random=function(){return h.fromRatio({r:l(),g:l(),b:l()})},h.mix=function(e,t,r){r=0===r?0:r||50;var i=h(e).toRgb(),n=h(t).toRgb(),a=r/100;return h({r:(n.r-i.r)*a+i.r,g:(n.g-i.g)*a+i.g,b:(n.b-i.b)*a+i.b,a:(n.a-i.a)*a+i.a})},h.readability=function(t,r){var i=h(t),n=h(r);return(e.max(i.getLuminance(),n.getLuminance())+.05)/(e.min(i.getLuminance(),n.getLuminance())+.05)},h.isReadable=function(e,t,r){var i,n,a,s,o,u=h.readability(e,t);switch(n=!1,(a=r,s=((a=a||{level:"AA",size:"small"}).level||"AA").toUpperCase(),o=(a.size||"small").toLowerCase(),"AA"!==s&&"AAA"!==s&&(s="AA"),"small"!==o&&"large"!==o&&(o="small"),i={level:s,size:o}).level+i.size){case"AAsmall":case"AAAlarge":n=u>=4.5;break;case"AAlarge":n=u>=3;break;case"AAAsmall":n=u>=7}return n},h.mostReadable=function(e,t,r){var i,n,a,s,o=null,u=0;n=(r=r||{}).includeFallbackColors,a=r.level,s=r.size;for(var l=0;lu&&(u=i,o=h(t[l]));return h.isReadable(e,o,{level:a,size:s})||!n?o:(r.includeFallbackColors=!1,h.mostReadable(e,["#fff","#000"],r))};var C=h.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},A=h.hexNames=function(e){var t={};for(var r in e)e.hasOwnProperty(r)&&(t[e[r]]=r);return t}(C);function M(e){return e=parseFloat(e),(isNaN(e)||e<0||e>1)&&(e=1),e}function P(t,r){(function(e){return"string"==typeof e&&-1!=e.indexOf(".")&&1===parseFloat(e)})(t)&&(t="100%");var i=function(e){return"string"==typeof e&&-1!=e.indexOf("%")}(t);return t=o(r,u(0,parseFloat(t))),i&&(t=parseInt(t*r,10)/100),e.abs(t-r)<1e-6?1:t%r/parseFloat(r)}function R(e){return o(1,u(0,e))}function B(e){return parseInt(e,16)}function O(e){return 1==e.length?"0"+e:""+e}function D(e){return e<=1&&(e=100*e+"%"),e}function L(t){return e.round(255*parseFloat(t)).toString(16)}function F(e){return B(e)/255}var z,N,U,j=(N="[\\s|\\(]+("+(z="(?:[-\\+]?\\d*\\.\\d+%?)|(?:[-\\+]?\\d+%?)")+")[,|\\s]+("+z+")[,|\\s]+("+z+")\\s*\\)?",U="[\\s|\\(]+("+z+")[,|\\s]+("+z+")[,|\\s]+("+z+")[,|\\s]+("+z+")\\s*\\)?",{CSS_UNIT:new RegExp(z),rgb:new RegExp("rgb"+N),rgba:new RegExp("rgba"+U),hsl:new RegExp("hsl"+N),hsla:new RegExp("hsla"+U),hsv:new RegExp("hsv"+N),hsva:new RegExp("hsva"+U),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/});function G(e){return!!j.CSS_UNIT.exec(e)}void 0!==t&&t.exports?t.exports=h:r.tinycolor=h}(Math)},{}],179:[function(e,t,r){(r=t.exports=function(e){return e.replace(/^\s*|\s*$/g,"")}).left=function(e){return e.replace(/^\s*/,"")},r.right=function(e){return e.replace(/\s*$/,"")}},{}],180:[function(e,t,r){"use strict";var i=e("punycode"),n=e("./util");function a(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}r.parse=_,r.resolve=function(e,t){return _(e,!1,!0).resolve(t)},r.resolveObject=function(e,t){return e?_(e,!1,!0).resolveObject(t):t},r.format=function(e){return n.isString(e)&&(e=_(e)),e instanceof a?e.format():a.prototype.format.call(e)},r.Url=a;var s=/^([a-z0-9.+-]+:)/i,o=/:[0-9]*$/,u=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,l=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r","\n","\t"]),h=["'"].concat(l),c=["%","/","?",";","#"].concat(h),f=["/","?","#"],d=/^[+a-z0-9A-Z_-]{0,63}$/,p=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,m={javascript:!0,"javascript:":!0},g={javascript:!0,"javascript:":!0},b={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},y=e("querystring");function _(e,t,r){if(e&&n.isObject(e)&&e instanceof a)return e;var i=new a;return i.parse(e,t,r),i}a.prototype.parse=function(e,t,r){if(!n.isString(e))throw new TypeError("Parameter 'url' must be a string, not "+typeof e);var a=e.indexOf("?"),o=-1!==a&&a127?B+="x":B+=R[O];if(!B.match(d)){var L=M.slice(0,I),F=M.slice(I+1),z=R.match(p);z&&(L.push(z[1]),F.unshift(z[2])),F.length&&(_="/"+F.join(".")+_),this.hostname=L.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),A||(this.hostname=i.toASCII(this.hostname));var N=this.port?":"+this.port:"",U=this.hostname||"";this.host=U+N,this.href+=this.host,A&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==_[0]&&(_="/"+_))}if(!m[E])for(I=0,P=h.length;I0)&&r.host.split("@"))&&(r.auth=A.shift(),r.host=r.hostname=A.shift())),r.search=e.search,r.query=e.query,n.isNull(r.pathname)&&n.isNull(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.href=r.format(),r;if(!k.length)return r.pathname=null,r.search?r.path="/"+r.search:r.path=null,r.href=r.format(),r;for(var S=k.slice(-1)[0],x=(r.host||e.host||k.length>1)&&("."===S||".."===S)||""===S,I=0,C=k.length;C>=0;C--)"."===(S=k[C])?k.splice(C,1):".."===S?(k.splice(C,1),I++):I&&(k.splice(C,1),I--);if(!w&&!E)for(;I--;I)k.unshift("..");!w||""===k[0]||k[0]&&"/"===k[0].charAt(0)||k.unshift(""),x&&"/"!==k.join("/").substr(-1)&&k.push("");var A,M=""===k[0]||k[0]&&"/"===k[0].charAt(0);return T&&(r.hostname=r.host=M?"":k.length?k.shift():"",(A=!!(r.host&&r.host.indexOf("@")>0)&&r.host.split("@"))&&(r.auth=A.shift(),r.host=r.hostname=A.shift())),(w=w||r.host&&k.length)&&!M&&k.unshift(""),k.length?r.pathname=k.join("/"):(r.pathname=null,r.path=null),n.isNull(r.pathname)&&n.isNull(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.auth=e.auth||r.auth,r.slashes=r.slashes||e.slashes,r.href=r.format(),r},a.prototype.parseHost=function(){var e=this.host,t=o.exec(e);t&&(":"!==(t=t[0])&&(this.port=t.substr(1)),e=e.substr(0,e.length-t.length)),e&&(this.hostname=e)}},{"./util":181,punycode:134,querystring:137}],181:[function(e,t,r){"use strict";t.exports={isString:function(e){return"string"==typeof e},isObject:function(e){return"object"==typeof e&&null!==e},isNull:function(e){return null===e},isNullOrUndefined:function(e){return null==e}}},{}],182:[function(e,t,r){(function(r){!function(){var i={};function n(){void 0!==r&&"development"!=r.env.NODE_ENV||console.log.apply(console,arguments)}"object"==typeof t?t.exports=i:self.UTIF=i,function(e,t){var r,i,a;r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i=function(){function e(e){this.message="JPEG error: "+e}return e.prototype=Error(),e.prototype.name="JpegError",e.constructor=e}(),a=function(){function e(e,t){this.message=e,this.g=t}return e.prototype=Error(),e.prototype.name="DNLMarkerError",e.constructor=e}(),function(){function t(){this.M=null,this.B=-1}function n(e,t){for(var r,i,n=0,a=[],s=16;0>O&1;if(255===(B=e[t++])){var r=e[t++];if(r){if(220===r&&M){t+=2;var s=e[t++]<<8|e[t++];if(0>>7}function m(e){for(;;){if("number"==typeof(e=e[p()]))return e;if("object"!==(void 0===e?"undefined":r(e)))throw new i("invalid huffman sequence")}}function g(e){for(var t=0;0=1<r;){var i=m(e.o),n=15&i;if(i>>=4,0===n){if(15>i)break;r+=16}else r+=i,e.a[t+l[r]]=b(n),r++}}function _(e,t){var r=m(e.D);r=0===r?0:b(r)<>=4,0===n){if(15>i){D=g(i)+(1<e.a[r]?-1:1;switch(L){case 0:if(r=15&(a=m(e.o)),a>>=4,0===r)15>a?(D=g(a)+(1<=G)throw new i("marker was not found");if(!(65488<=G&&65495>=G))break;t+=2}return(G=u(e,t))&&G.f&&((0,_util.warn)("decodeScan - unexpected Scan data, current marker is: "+G.f),t=G.offset),t-R}function o(e,t){for(var r=t.c,n=t.l,a=new Int16Array(64),s=0;sf;f+=8){var d=c[u+f],p=c[u+f+1],m=c[u+f+2],g=c[u+f+3],b=c[u+f+4],y=c[u+f+5],_=c[u+f+6],v=c[u+f+7];if(d*=h[f],0==(p|m|g|b|y|_|v))d=5793*d+512>>10,l[f]=d,l[f+1]=d,l[f+2]=d,l[f+3]=d,l[f+4]=d,l[f+5]=d,l[f+6]=d,l[f+7]=d;else{p*=h[f+1],m*=h[f+2],g*=h[f+3],b*=h[f+4],y*=h[f+5];var w=5793*d+128>>8,E=5793*b+128>>8,k=m,T=_*=h[f+6];E=(w=w+E+1>>1)-E,d=3784*k+1567*T+128>>8,k=1567*k-3784*T+128>>8,y=(b=(b=2896*(p-(v*=h[f+7]))+128>>8)+(y<<=4)+1>>1)-y,g=(v=(v=2896*(p+v)+128>>8)+(g<<=4)+1>>1)-g,T=(w=w+(T=d)+1>>1)-T,k=(E=E+k+1>>1)-k,d=2276*b+3406*v+2048>>12,b=3406*b-2276*v+2048>>12,v=d,d=799*g+4017*y+2048>>12,g=4017*g-799*y+2048>>12,y=d,l[f]=w+v,l[f+7]=w-v,l[f+1]=E+y,l[f+6]=E-y,l[f+2]=k+g,l[f+5]=k-g,l[f+3]=T+b,l[f+4]=T-b}}for(h=0;8>h;++h)d=l[h],0==((p=l[h+8])|(m=l[h+16])|(g=l[h+24])|(b=l[h+32])|(y=l[h+40])|(_=l[h+48])|(v=l[h+56]))?(d=-2040>(d=5793*d+8192>>14)?0:2024<=d?255:d+2056>>4,c[u+h]=d,c[u+h+8]=d,c[u+h+16]=d,c[u+h+24]=d,c[u+h+32]=d,c[u+h+40]=d,c[u+h+48]=d,c[u+h+56]=d):(w=5793*d+2048>>12,E=5793*b+2048>>12,d=3784*(k=m)+1567*(T=_)+2048>>12,k=1567*k-3784*T+2048>>12,T=d,y=(b=(b=2896*(p-v)+2048>>12)+y+1>>1)-y,g=(v=(v=2896*(p+v)+2048>>12)+g+1>>1)-g,d=2276*b+3406*v+2048>>12,b=3406*b-2276*v+2048>>12,v=d,d=799*g+4017*y+2048>>12,g=4017*g-799*y+2048>>12,p=(E=(E=(w=4112+(w+E+1>>1))-E)+k+1>>1)+(y=d),_=E-y,y=(k=E-k)-g,d=16>(d=(w=w+T+1>>1)+v)?0:4080<=d?255:d>>4,p=16>p?0:4080<=p?255:p>>4,m=16>(m=k+g)?0:4080<=m?255:m>>4,g=16>(g=(T=w-T)+b)?0:4080<=g?255:g>>4,b=16>(b=T-b)?0:4080<=b?255:b>>4,y=16>y?0:4080<=y?255:y>>4,_=16>_?0:4080<=_?255:_>>4,v=16>(v=w-v)?0:4080<=v?255:v>>4,c[u+h]=d,c[u+h+8]=p,c[u+h+16]=m,c[u+h+24]=g,c[u+h+32]=b,c[u+h+40]=y,c[u+h+48]=_,c[u+h+56]=v)}return t.a}function u(e,t){var r=2=i)return null;var n=e[t]<<8|e[t+1];if(65472<=n&&65534>=n)return{f:null,F:n,offset:t};for(var a=e[r]<<8|e[r+1];!(65472<=a&&65534>=a);){if(++r>=i)return null;a=e[r]<<8|e[r+1]}return{f:n.toString(16),F:a,offset:r}}var l=new Uint8Array([0,1,8,16,9,2,3,10,17,24,32,25,18,11,4,5,12,19,26,33,40,48,41,34,27,20,13,6,7,14,21,28,35,42,49,56,57,50,43,36,29,22,15,23,30,37,44,51,58,59,52,45,38,31,39,46,53,60,61,54,47,55,62,63]);t.prototype={parse:function(e){function t(){var t=e[d]<<8|e[d+1];return d+=2,t}function r(){var r=t(),i=u(e,r=d+r-2,d);return i&&i.f&&((0,_util.warn)("readDataBlock - incorrect length, current marker is: "+i.f),r=i.offset),r=e.subarray(d,r),d+=r.length,r}function h(e){for(var t=Math.ceil(e.v/8/e.s),r=Math.ceil(e.g/8/e.u),i=0;i>4)for(_=0;64>_;_++)E[v=l[_]]=e[d++];else{if(1!=w>>4)throw new i("DQT - invalid table spec");for(_=0;64>_;_++)E[v=l[_]]=t()}c[15&w]=E}break;case 65472:case 65473:case 65474:if(k)throw new i("Only single frame JPEGs supported");t();var k={};for(k.X=65473===y,k.S=65474===y,k.precision=e[d++],y=t(),k.g=f||y,k.v=t(),k.b=[],k.C={},_=e[d++],y=E=w=0;y<_;y++){v=e[d];var T=e[d+1]>>4,S=15&e[d+1];w_;_++,d++)T+=E[_]=e[d];for(S=new Uint8Array(T),_=0;_>4?b:g)[15&w]=n(E,S)}break;case 65501:t();var x=t();break;case 65498:for(_=1==++m&&!f,t(),w=e[d++],v=[],y=0;y>4],I.o=g[15&E],v.push(I)}y=e[d++],w=e[d++],E=e[d++];try{var C=s(e,d,k,v,x,y,w,E>>4,15&E,_);d+=C}catch(t){if(t instanceof a)return(0,_util.warn)('Attempting to re-parse JPEG image using "scanLines" parameter found in DNL marker (0xFFDC) segment.'),this.parse(e,{N:t.g});throw t}break;case 65500:d+=4;break;case 65535:255!==e[d]&&d--;break;default:if(255===e[d-3]&&192<=e[d-2]&&254>=e[d-2])d-=3;else{if(!(_=u(e,d-2))||!_.f)throw new i("unknown marker "+y.toString(16));(0,_util.warn)("JpegImage.parse - unexpected data, current marker is: "+_.f),d=_.offset}}y=t()}for(this.width=k.v,this.height=k.g,this.A=p,this.b=[],y=0;y>8)+a[n+1];return u},w:function(){return this.A?!!this.A.W:3===this.i?0!==this.B:1===this.B},I:function(e){for(var t,r,i,n=0,a=e.length;n>>3)]),null==d&&(d=o.t325);var p=new Uint8Array(o.height*(c>>>3)),m=0;if(null!=o.t322){for(var g=o.t322[0],b=o.t323[0],y=Math.floor((o.width+g-1)/g),_=Math.floor((o.height+b-1)/b),v=new Uint8Array(0|Math.ceil(g*b*h/8)),w=0;w<_;w++)for(var E=0;E>>8;else{if(12!=p)throw new Error("unsupported bit depth "+p);for(c=0;c>>4,a[s++]=255&(m[c]<<4|m[c+1]>>>8),a[s++]=255&m[c+1]}}else{var b=new e.JpegDecoder;b.parse(l);var y=b.getData(b.width,b.height);for(c=0;c1),!f){if(255==t[r]&&216==t[r+1])return{jpegOffset:r};if(null!=d&&(255==t[r+p]&&216==t[r+p+1]?h=r+p:n("JPEGInterchangeFormat does not point to SOI"),null==m?n("JPEGInterchangeFormatLength field is missing"):(p>=c||p+g<=c)&&n("JPEGInterchangeFormatLength field value is invalid"),null!=h))return{jpegOffset:h}}if(null!=y&&(_=y[0],v=y[1]),null!=d&&null!=m)if(g>=2&&p+g<=c){for(a=255==t[r+p+g-2]&&216==t[r+p+g-1]?new Uint8Array(g-2):new Uint8Array(g),o=0;o offset to first strip or tile");if(null==a){var k=0,T=[];T[k++]=255,T[k++]=216;var S=e.t519;if(null==S)throw new Error("JPEGQTables tag is missing");for(o=0;o>>8,T[k++]=255&I,T[k++]=o|l<<4,u=0;u<16;u++)T[k++]=t[r+x[o]+u];for(u=0;u>>8&255,T[k++]=255&e.height,T[k++]=e.width>>>8&255,T[k++]=255&e.width,T[k++]=w,1==w)T[k++]=1,T[k++]=17,T[k++]=0;else for(o=0;o<3;o++)T[k++]=o+1,T[k++]=0!=o?17:(15&_)<<4|15&v,T[k++]=o;null!=E&&0!=E[0]&&(T[k++]=255,T[k++]=221,T[k++]=0,T[k++]=4,T[k++]=E[0]>>>8&255,T[k++]=255&E[0]),a=new Uint8Array(T)}var C=-1;for(o=0;o>>8&255,a[M++]=255&e.height,a[M++]=e.width>>>8&255,a[M++]=255&e.width,a[M++]=w,1==w)a[M++]=1,a[M++]=17,a[M++]=0;else for(o=0;o<3;o++)a[M++]=o+1,a[M++]=0!=o?17:(15&_)<<4|15&v,a[M++]=o}if(255==t[c]&&218==t[c+1]){var P=t[c+2]<<8|t[c+3];for((s=new Uint8Array(P+2))[0]=t[c],s[1]=t[c+1],s[2]=t[c+2],s[3]=t[c+3],o=0;o>>8&255,l[h.sofPosition+6]=255&t.height,l[h.sofPosition+7]=t.width>>>8&255,l[h.sofPosition+8]=255&t.width,255==r[i]&&r[i+1]==SOS||(l.set(h.sosMarker,bufoff),bufoff+=sosMarker.length),d=0;d=0&&u<128)for(var l=0;l=-127&&u<0){for(l=0;l<1-u;l++)s[n]=a[t],n++;t++}}},e.decode._decodeThunder=function(e,t,r,i,n){for(var a=[0,1,0,-1],s=[0,1,2,3,0,-3,-2,-1],o=t+r,u=2*n,l=0;t>>6,f=63&h;if(t++,3==c&&(l=15&f,i[u>>>1]|=l<<4*(1-u&1),u++),0==c)for(var d=0;d>>1]|=l<<4*(1-u&1),u++;if(2==c)for(d=0;d<2;d++)4!=(p=f>>>3*(1-d)&7)&&(l+=s[p],i[u>>>1]|=l<<4*(1-u&1),u++);if(1==c)for(d=0;d<3;d++){var p;2!=(p=f>>>2*(2-d)&3)&&(l+=a[p],i[u>>>1]|=l<<4*(1-u&1),u++)}}},e.decode._dmap={1:0,"011":1,"000011":2,"0000011":3,"010":-1,"000010":-2,"0000010":-3},e.decode._lens=function(){var e=function(e,t,r,i){for(var n=0;n>>3>>3]>>>7-(7&l)&1),2==o&&(T=t[l>>>3]>>>(7&l)&1),l++,c+=T,"H"==w){if(null!=u._lens[_][c]){var S=u._lens[_][c];c="",h+=S,S<64&&(u._addNtimes(f,h,_),m+=h,_=1-_,h=0,0==--E&&(w=""))}}else"0001"==c&&(c="",u._addNtimes(f,y-m,_),m=y),"001"==c&&(c="",w="H",E=2),null!=u._dmap[c]&&(g=b+u._dmap[c],u._addNtimes(f,g-m,_),m=g,c="",_=1-_);f.length==s&&""==w&&(u._writeBits(f,n,8*a+v*k),_=0,v++,m=0,d=u._makeDiff(f),f=[])}},e.decode._findDiff=function(e,t,r){for(var i=0;i=t&&e[i+1]==r)return e[i]},e.decode._makeDiff=function(e){var t=[];1==e[0]&&t.push(0,1);for(var r=1;r>>3>>3]>>>7-(7&l)&1),2==o&&(S=t[l>>>3]>>>(7&l)&1),l++,c+=S,k){if(null!=u._lens[_][c]){var x=u._lens[_][c];c="",h+=x,x<64&&(u._addNtimes(f,h,_),_=1-_,h=0)}}else"H"==w?null!=u._lens[_][c]&&(x=u._lens[_][c],c="",h+=x,x<64&&(u._addNtimes(f,h,_),m+=h,_=1-_,h=0,0==--E&&(w=""))):("0001"==c&&(c="",u._addNtimes(f,y-m,_),m=y),"001"==c&&(c="",w="H",E=2),null!=u._dmap[c]&&(g=b+u._dmap[c],u._addNtimes(f,g-m,_),m=g,c="",_=1-_));c.endsWith("000000000001")&&(v>=0&&u._writeBits(f,n,8*a+v*T),1==o&&(k=1==(t[l>>>3]>>>7-(7&l)&1)),2==o&&(k=1==(t[l>>>3]>>>(7&l)&1)),l++,null==u._decodeG3.allow2D&&(u._decodeG3.allow2D=k),u._decodeG3.allow2D||(k=!0,l--),c="",_=0,v++,m=0,d=u._makeDiff(f),f=[])}f.length==s&&u._writeBits(f,n,8*a+v*T)},e.decode._addNtimes=function(e,t,r){for(var i=0;i>>3]|=e[i]<<7-(r+i&7)},e.decode._decodeLZW=function(t,r,i,n){if(null==e.decode._lzwTab){for(var a=new Uint32Array(65535),s=new Uint16Array(65535),o=new Uint8Array(2e6),u=0;u<256;u++)o[u<<2]=u,a[u]=u<<2,s[u]=1;e.decode._lzwTab=[a,s,o]}for(var l=e.decode._copyData,h=e.decode._lzwTab[0],c=e.decode._lzwTab[1],f=(o=e.decode._lzwTab[2],258),d=1032,p=9,m=r<<3,g=0,b=0;g=(t[m>>>3]<<16|t[m+8>>>3]<<8|t[m+16>>>3])>>24-(7&m)-p&(1<>>3]<<16|t[m+8>>>3]<<8|t[m+16>>>3])>>24-(7&m)-p&(1<=f?(h[f]=d,o[h[f]]=y[0],c[f]=1,d=d+1+3&-4,f++):(h[f]=d,l(o,h[b],o,d,v=c[b]),o[d+v]=o[y],v++,c[f]=v,f++,d=d+v+3&-4),f+1==1<=f?(h[f]=d,c[f]=0,f++):(h[f]=d,l(o,h[b],o,d,v=c[b]),o[d+v]=o[d],v++,c[f]=v,f++,l(o,d,i,n,v),n+=v,d=d+v+3&-4),f+1==1<4&&(t.writeUint(r,i,s),p=s),2==h&&t.writeASCII(r,p,c),3==h)for(var m=0;m4&&(s+=d+=1&d),i+=4}return[i,s]},e.toRGBA8=function(e){var t=e.width,r=e.height,i=t*r,a=4*i,s=e.data,o=new Uint8Array(4*i),u=e.t262[0],l=e.t258?Math.min(32,e.t258[0]):1,h=e.isLE?1:0;if(0==u)for(var c=Math.ceil(l*t/8),f=0;f>3)]>>7-(7&m)&1;o[g]=o[g+1]=o[g+2]=255*(1-b),o[g+3]=255}if(4==l)for(m=0;m>1)]>>4-4*(1&m)&15,o[g]=o[g+1]=o[g+2]=17*(15-b),o[g+3]=255;if(8==l)for(m=0;m>3)]>>7-(7&m)&1,o[g]=o[g+1]=o[g+2]=255*b,o[g+3]=255;if(2==l)for(m=0;m>2)]>>6-2*(3&m)&3,o[g]=o[g+1]=o[g+2]=85*b,o[g+3]=255;if(8==l)for(m=0;m0)for(m=0;m>8,o[g+1]=_[256+v]>>8,o[g+2]=_[512+v]>>8,o[g+3]=255}}else if(5==u){var w,E=(w=e.t258?e.t258.length:4)>4?1:0;for(m=0;m>8&255,e[t+1]=255&r},writeUint:function(e,t,r){e[t]=r>>24&255,e[t+1]=r>>16&255,e[t+2]=r>>8&255,e[t+3]=r>>0&255},writeASCII:function(e,t,r){for(var i=0;i0&&(c=setTimeout((function(){if(!l){l=!0,h.abort("timeout");var e=new Error("XMLHttpRequest timeout");e.code="ETIMEDOUT",n(e)}}),e.timeout)),h.setRequestHeader)for(o in m)m.hasOwnProperty(o)&&h.setRequestHeader(o,m[o]);else if(e.headers&&!function(e){for(var t in e)if(e.hasOwnProperty(t))return!1;return!0}(e.headers))throw new Error("Headers cannot be set on an XDomainRequest object");return"responseType"in e&&(h.responseType=e.responseType),"beforeSend"in e&&"function"==typeof e.beforeSend&&e.beforeSend(h),h.send(p||null),h}t.exports=u,t.exports.default=u,u.XMLHttpRequest=i.XMLHttpRequest||function(){},u.XDomainRequest="withCredentials"in new u.XMLHttpRequest?u.XMLHttpRequest:i.XDomainRequest,function(e,t){for(var r=0;r2&&void 0!==arguments[2]?arguments[2]:1;e.a*=r;var i=t.a+e.a-t.a*e.a,n=(e.r*e.a+t.r*t.a*(1-e.a))/i,a=(e.g*e.a+t.g*t.a*(1-e.a))/i,s=(e.b*e.a+t.b*t.a*(1-e.a))/i;return{r:n,g:a,b:s,a:i}},r.dstOver=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;e.a*=r;var i=t.a+e.a-t.a*e.a,n=(t.r*t.a+e.r*e.a*(1-t.a))/i,a=(t.g*t.a+e.g*e.a*(1-t.a))/i,s=(t.b*t.a+e.b*e.a*(1-t.a))/i;return{r:n,g:a,b:s,a:i}},r.multiply=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;e.a*=r;var i=t.a+e.a-t.a*e.a,n=e.r*e.a,a=e.g*e.a,s=e.b*e.a,o=t.r*t.a,u=t.g*t.a,l=t.b*t.a,h=(n*o+n*(1-t.a)+o*(1-e.a))/i,c=(a*u+a*(1-t.a)+u*(1-e.a))/i,f=(s*l+s*(1-t.a)+l*(1-e.a))/i;return{r:h,g:c,b:f,a:i}},r.add=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;e.a*=r;var i=t.a+e.a-t.a*e.a,n=e.r*e.a,a=e.g*e.a,s=e.b*e.a,o=t.r*t.a,u=t.g*t.a,l=t.b*t.a,h=(n+o)/i,c=(a+u)/i,f=(s+l)/i;return{r:h,g:c,b:f,a:i}},r.screen=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;e.a*=r;var i=t.a+e.a-t.a*e.a,n=e.r*e.a,a=e.g*e.a,s=e.b*e.a,o=t.r*t.a,u=t.g*t.a,l=t.b*t.a,h=(n*t.a+o*e.a-n*o+n*(1-t.a)+o*(1-e.a))/i,c=(a*t.a+u*e.a-a*u+a*(1-t.a)+u*(1-e.a))/i,f=(s*t.a+l*e.a-s*l+s*(1-t.a)+l*(1-e.a))/i;return{r:h,g:c,b:f,a:i}},r.overlay=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;e.a*=r;var i=t.a+e.a-t.a*e.a,n=e.r*e.a,a=e.g*e.a,s=e.b*e.a,o=t.r*t.a,u=t.g*t.a,l=t.b*t.a,h=(2*o<=t.a?2*n*o+n*(1-t.a)+o*(1-e.a):n*(1+t.a)+o*(1+e.a)-2*o*n-t.a*e.a)/i,c=(2*u<=t.a?2*a*u+a*(1-t.a)+u*(1-e.a):a*(1+t.a)+u*(1+e.a)-2*u*a-t.a*e.a)/i,f=(2*l<=t.a?2*s*l+s*(1-t.a)+l*(1-e.a):s*(1+t.a)+l*(1+e.a)-2*l*s-t.a*e.a)/i;return{r:h,g:c,b:f,a:i}},r.darken=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;e.a*=r;var i=t.a+e.a-t.a*e.a,n=e.r*e.a,a=e.g*e.a,s=e.b*e.a,o=t.r*t.a,u=t.g*t.a,l=t.b*t.a,h=(Math.min(n*t.a,o*e.a)+n*(1-t.a)+o*(1-e.a))/i,c=(Math.min(a*t.a,u*e.a)+a*(1-t.a)+u*(1-e.a))/i,f=(Math.min(s*t.a,l*e.a)+s*(1-t.a)+l*(1-e.a))/i;return{r:h,g:c,b:f,a:i}},r.lighten=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;e.a*=r;var i=t.a+e.a-t.a*e.a,n=e.r*e.a,a=e.g*e.a,s=e.b*e.a,o=t.r*t.a,u=t.g*t.a,l=t.b*t.a,h=(Math.max(n*t.a,o*e.a)+n*(1-t.a)+o*(1-e.a))/i,c=(Math.max(a*t.a,u*e.a)+a*(1-t.a)+u*(1-e.a))/i,f=(Math.max(s*t.a,l*e.a)+s*(1-t.a)+l*(1-e.a))/i;return{r:h,g:c,b:f,a:i}},r.hardLight=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;e.a*=r;var i=t.a+e.a-t.a*e.a,n=e.r*e.a,a=e.g*e.a,s=e.b*e.a,o=t.r*t.a,u=t.g*t.a,l=t.b*t.a,h=(2*n<=e.a?2*n*o+n*(1-t.a)+o*(1-e.a):n*(1+t.a)+o*(1+e.a)-2*o*n-t.a*e.a)/i,c=(2*a<=e.a?2*a*u+a*(1-t.a)+u*(1-e.a):a*(1+t.a)+u*(1+e.a)-2*u*a-t.a*e.a)/i,f=(2*s<=e.a?2*s*l+s*(1-t.a)+l*(1-e.a):s*(1+t.a)+l*(1+e.a)-2*l*s-t.a*e.a)/i;return{r:h,g:c,b:f,a:i}},r.difference=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;e.a*=r;var i=t.a+e.a-t.a*e.a,n=e.r*e.a,a=e.g*e.a,s=e.b*e.a,o=t.r*t.a,u=t.g*t.a,l=t.b*t.a,h=(n+o-2*Math.min(n*t.a,o*e.a))/i,c=(a+u-2*Math.min(a*t.a,u*e.a))/i,f=(s+l-2*Math.min(s*t.a,l*e.a))/i;return{r:h,g:c,b:f,a:i}},r.exclusion=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;e.a*=r;var i=t.a+e.a-t.a*e.a,n=e.r*e.a,a=e.g*e.a,s=e.b*e.a,o=t.r*t.a,u=t.g*t.a,l=t.b*t.a,h=(n*t.a+o*e.a-2*n*o+n*(1-t.a)+o*(1-e.a))/i,c=(a*t.a+u*e.a-2*a*u+a*(1-t.a)+u*(1-e.a))/i,f=(s*t.a+l*e.a-2*s*l+s*(1-t.a)+l*(1-e.a))/i;return{r:h,g:c,b:f,a:i}}},{}],191:[function(e,t,r){"use strict";var i=e("@babel/runtime/helpers/interopRequireWildcard");Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(e,t,r){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=arguments.length>4?arguments[4]:void 0;if("function"==typeof i&&(o=i,i={}),!(e instanceof this.constructor))return n.throwError.call(this,"The source must be a Jimp image",o);if("number"!=typeof t||"number"!=typeof r)return n.throwError.call(this,"x and y must be numbers",o);var u=i,l=u.mode,h=u.opacitySource,c=u.opacityDest;l||(l=a.BLEND_SOURCE_OVER),("number"!=typeof h||h<0||h>1)&&(h=1),("number"!=typeof c||c<0||c>1)&&(c=1);var f=s[l];t=Math.round(t),r=Math.round(r);var d=this;return 1!==c&&d.opacity(c),e.scanQuiet(0,0,e.bitmap.width,e.bitmap.height,(function(e,i,n){var s=d.getPixelIndex(t+e,r+i,a.EDGE_CROP),o=f({r:this.bitmap.data[n+0]/255,g:this.bitmap.data[n+1]/255,b:this.bitmap.data[n+2]/255,a:this.bitmap.data[n+3]/255},{r:d.bitmap.data[s+0]/255,g:d.bitmap.data[s+1]/255,b:d.bitmap.data[s+2]/255,a:d.bitmap.data[s+3]/255},h);d.bitmap.data[s+0]=this.constructor.limit255(255*o.r),d.bitmap.data[s+1]=this.constructor.limit255(255*o.g),d.bitmap.data[s+2]=this.constructor.limit255(255*o.b),d.bitmap.data[s+3]=this.constructor.limit255(255*o.a)})),(0,n.isNodePattern)(o)&&o.call(this,null,this),this};var n=e("@jimp/utils"),a=i(e("../constants")),s=i(e("./composite-modes"));t.exports=r.default},{"../constants":192,"./composite-modes":190,"@babel/runtime/helpers/interopRequireWildcard":12,"@jimp/utils":235}],192:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.EDGE_CROP=r.EDGE_WRAP=r.EDGE_EXTEND=r.BLEND_EXCLUSION=r.BLEND_DIFFERENCE=r.BLEND_HARDLIGHT=r.BLEND_LIGHTEN=r.BLEND_DARKEN=r.BLEND_OVERLAY=r.BLEND_SCREEN=r.BLEND_ADD=r.BLEND_MULTIPLY=r.BLEND_DESTINATION_OVER=r.BLEND_SOURCE_OVER=r.VERTICAL_ALIGN_BOTTOM=r.VERTICAL_ALIGN_MIDDLE=r.VERTICAL_ALIGN_TOP=r.HORIZONTAL_ALIGN_RIGHT=r.HORIZONTAL_ALIGN_CENTER=r.HORIZONTAL_ALIGN_LEFT=r.AUTO=void 0,r.AUTO=-1,r.HORIZONTAL_ALIGN_LEFT=1,r.HORIZONTAL_ALIGN_CENTER=2,r.HORIZONTAL_ALIGN_RIGHT=4,r.VERTICAL_ALIGN_TOP=8,r.VERTICAL_ALIGN_MIDDLE=16,r.VERTICAL_ALIGN_BOTTOM=32,r.BLEND_SOURCE_OVER="srcOver",r.BLEND_DESTINATION_OVER="dstOver",r.BLEND_MULTIPLY="multiply",r.BLEND_ADD="add",r.BLEND_SCREEN="screen",r.BLEND_OVERLAY="overlay",r.BLEND_DARKEN="darken",r.BLEND_LIGHTEN="lighten",r.BLEND_HARDLIGHT="hardLight",r.BLEND_DIFFERENCE="difference",r.BLEND_EXCLUSION="exclusion",r.EDGE_EXTEND=1,r.EDGE_WRAP=2,r.EDGE_CROP=3},{}],193:[function(e,t,i){(function(t){"use strict";var n=e("@babel/runtime/helpers/interopRequireWildcard"),a=e("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(i,"__esModule",{value:!0}),i.addConstants=W,i.addJimpMethods=X,i.jimpEvMethod=Z,i.jimpEvChange=Y,Object.defineProperty(i,"addType",{enumerable:!0,get:function(){return C.addType}}),i.default=void 0;for(var s=a(e("@babel/runtime/helpers/construct")),o=a(e("@babel/runtime/helpers/slicedToArray")),u=a(e("@babel/runtime/helpers/classCallCheck")),l=a(e("@babel/runtime/helpers/createClass")),h=a(e("@babel/runtime/helpers/possibleConstructorReturn")),c=a(e("@babel/runtime/helpers/getPrototypeOf")),f=a(e("@babel/runtime/helpers/assertThisInitialized")),d=a(e("@babel/runtime/helpers/inherits")),p=a(e("@babel/runtime/helpers/defineProperty")),m=a(e("@babel/runtime/helpers/typeof")),g=a(e("fs")),b=a(e("path")),y=a(e("events")),_=e("@jimp/utils"),v=a(e("any-base")),w=a(e("mkdirp")),E=a(e("pixelmatch")),k=a(e("tinycolor2")),T=a(e("./modules/phash")),S=a(e("./request")),x=a(e("./composite")),I=a(e("./utils/promisify")),C=n(e("./utils/mime")),A=e("./utils/image-bitmap"),M=n(e("./constants")),P="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_",R=[NaN,NaN],B=2;B<65;B++){var O=(0,v.default)(v.default.BIN,P.slice(0,B))(new Array(65).join("1"));R.push(O.length)}function D(){}function L(e){return Object.prototype.toString.call(e).toLowerCase().indexOf("arraybuffer")>-1}function F(e){for(var r=t.alloc(e.byteLength),i=new Uint8Array(e),n=0;n (HTTP: "+n.statusCode+")";return new Error(s)}))}function N(e,t){g.default&&"function"==typeof g.default.readFile&&!e.match(/^(http|ftp)s?:\/\/./)?g.default.readFile(e,t):z({url:e},t)}function U(e){return e&&"object"===(0,m.default)(e)&&"number"==typeof e.width&&"number"==typeof e.height&&(t.isBuffer(e.data)||e.data instanceof Uint8Array||"function"==typeof Uint8ClampedArray&&e.data instanceof Uint8ClampedArray)&&(e.data.length===e.width*e.height*4||e.data.length===e.width*e.height*3)}function j(e){if(e.length%3!=0)throw new Error("Buffer length is incorrect");for(var r=t.allocUnsafe(e.length/3*4),i=0,n=0;n2&&void 0!==arguments[2]?arguments[2]:{};r=Object.assign(r,{methodName:e,eventName:t}),this.emit("any",r),e&&this.emit(e,r),this.emit(t,r)}},{key:"emitError",value:function(e,t){this.emitMulti(e,"error",t)}},{key:"getHeight",value:function(){return this.bitmap.height}},{key:"getWidth",value:function(){return this.bitmap.width}},{key:"inspect",value:function(){return""}},{key:"toString",value:function(){return"[object Jimp]"}},{key:"getMIME",value:function(){return this._originalMime||r.MIME_PNG}},{key:"getExtension",value:function(){var e=this.getMIME();return C.getExtension(e)}},{key:"write",value:function(e,t){var r=this;if(!g.default||!g.default.createWriteStream)throw new Error("Cant access the filesystem. You can use the getBase64 method.");if("string"!=typeof e)return _.throwError.call(this,"path must be a string",t);if(void 0===t&&(t=D),"function"!=typeof t)return _.throwError.call(this,"cb must be a function",t);var i=C.getType(e)||this.getMIME(),n=b.default.parse(e);return n.dir&&w.default.sync(n.dir),this.getBuffer(i,(function(i,n){if(i)return _.throwError.call(r,i,t);var a=g.default.createWriteStream(e);a.on("open",(function(){a.write(n),a.end()})).on("error",(function(e){return _.throwError.call(r,e,t)})),a.on("finish",(function(){t.call(r,null,r)}))})),this}},{key:"getBase64",value:function(e,t){return e===r.AUTO&&(e=this.getMIME()),"string"!=typeof e?_.throwError.call(this,"mime must be a string",t):"function"!=typeof t?_.throwError.call(this,"cb must be a function",t):(this.getBuffer(e,(function(r,i){if(r)return _.throwError.call(this,r,t);var n="data:"+e+";base64,"+i.toString("base64");t.call(this,null,n)})),this)}},{key:"hash",value:function(e,t){if("function"==typeof(e=e||64)&&(t=e,e=64),"number"!=typeof e)return _.throwError.call(this,"base must be a number",t);if(e<2||e>64)return _.throwError.call(this,"base must be a number between 2 and 64",t);var r=this.pHash();for(r=(0,v.default)(v.default.BIN,P.slice(0,e))(r);r.length=this.bitmap.width&&(a=this.bitmap.width-1),t<0&&(s=0),t>=this.bitmap.height&&(s=this.bitmap.height-1)),i===r.EDGE_WRAP&&(e<0&&(a=this.bitmap.width+e),e>=this.bitmap.width&&(a=e%this.bitmap.width),t<0&&(a=this.bitmap.height+t),t>=this.bitmap.height&&(s=t%this.bitmap.height));var o=this.bitmap.width*s+a<<2;return(a<0||a>=this.bitmap.width)&&(o=-1),(s<0||s>=this.bitmap.height)&&(o=-1),(0,_.isNodePattern)(n)&&n.call(this,null,o),o}},{key:"getPixelColor",value:function(e,t,r){if("number"!=typeof e||"number"!=typeof t)return _.throwError.call(this,"x and y must be numbers",r);e=Math.round(e),t=Math.round(t);var i=this.getPixelIndex(e,t),n=this.bitmap.data.readUInt32BE(i);return(0,_.isNodePattern)(r)&&r.call(this,null,n),n}},{key:"setPixelColor",value:function(e,t,r,i){if("number"!=typeof e||"number"!=typeof t||"number"!=typeof r)return _.throwError.call(this,"hex, x and y must be numbers",i);t=Math.round(t),r=Math.round(r);var n=this.getPixelIndex(t,r);return this.bitmap.data.writeUInt32BE(e,n),(0,_.isNodePattern)(i)&&i.call(this,null,this),this}},{key:"hasAlpha",value:function(){for(var e=0;e1&&void 0!==arguments[1]?arguments[1]:q;Object.entries(e).forEach((function(e){var r=(0,o.default)(e,2),i=r[0],n=r[1];t[i]=n}))}function X(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:q;Object.entries(e).forEach((function(e){var r=(0,o.default)(e,2),i=r[0],n=r[1];t.prototype[i]=n}))}function Z(e,t,r){var i="before-"+t,n=t.replace(/e$/,"")+"ed";q.prototype[e]=function(){for(var t,a=arguments.length,s=new Array(a),o=0;o255)return _.throwError.call(this,"r must be between 0 and 255",n);if((t<0||t>255)&&_.throwError.call(this,"g must be between 0 and 255",n),r<0||r>255)return _.throwError.call(this,"b must be between 0 and 255",n);if(i<0||i>255)return _.throwError.call(this,"a must be between 0 and 255",n);e=Math.round(e),r=Math.round(r),t=Math.round(t),i=Math.round(i);var a=e*Math.pow(256,3)+t*Math.pow(256,2)+r*Math.pow(256,1)+i*Math.pow(256,0);return(0,_.isNodePattern)(n)&&n.call(this,null,a),a},q.intToRGBA=function(e,t){if("number"!=typeof e)return _.throwError.call(this,"i must be a number",t);var r={};return r.r=Math.floor(e/Math.pow(256,3)),r.g=Math.floor((e-r.r*Math.pow(256,3))/Math.pow(256,2)),r.b=Math.floor((e-r.r*Math.pow(256,3)-r.g*Math.pow(256,2))/Math.pow(256,1)),r.a=Math.floor((e-r.r*Math.pow(256,3)-r.g*Math.pow(256,2)-r.b*Math.pow(256,1))/Math.pow(256,0)),(0,_.isNodePattern)(t)&&t.call(this,null,r),r},q.cssColorToHex=function(e){return"number"==typeof(e=e||0)?Number(e):parseInt((0,k.default)(e).toHex8(),16)},q.limit255=function(e){return e=Math.max(e,0),e=Math.min(e,255)},q.diff=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:.1;if(!(e instanceof q&&t instanceof q))return _.throwError.call(this,"img1 and img2 must be an Jimp images");var i=e.bitmap,n=t.bitmap;if(i.width===n.width&&i.height===n.height||(i.width*i.height>n.width*n.height?e=e.cloneQuiet().resize(n.width,n.height):t=t.cloneQuiet().resize(i.width,i.height)),"number"!=typeof r||r<0||r>1)return _.throwError.call(this,"threshold must be a number between 0 and 1");var a=new q(i.width,i.height,4294967295),s=(0,E.default)(i.data,n.data,a.bitmap.data,a.bitmap.width,a.bitmap.height,{threshold:r});return{percent:s/(a.bitmap.width*a.bitmap.height),image:a}},q.distance=function(e,t){var r=new T.default,i=r.getHash(e),n=r.getHash(t);return r.distance(i,n)},q.compareHashes=function(e,t){return(new T.default).distance(e,t)},q.colorDiff=function(e,t){var r=function(e){return Math.pow(e,2)},i=Math.max;return 0===e.a||e.a||(e.a=255),0===t.a||t.a||(t.a=255),(i(r(e.r-t.r),r(e.r-t.r-e.a+t.a))+i(r(e.g-t.g),r(e.g-t.g-e.a+t.a))+i(r(e.b-t.b),r(e.b-t.b-e.a+t.a)))/195075},Z("clone","clone",(function(e){var t=new q(this);return(0,_.isNodePattern)(e)&&e.call(t,null,t),t})),Y("background",(function(e,t){return"number"!=typeof e?_.throwError.call(this,"hex must be a hexadecimal rgba value",t):(this._background=e,(0,_.isNodePattern)(t)&&t.call(this,null,this),this)})),Y("scan",(function(e,t,r,i,n,a){if("number"!=typeof e||"number"!=typeof t)return _.throwError.call(this,"x and y must be numbers",a);if("number"!=typeof r||"number"!=typeof i)return _.throwError.call(this,"w and h must be numbers",a);if("function"!=typeof n)return _.throwError.call(this,"f must be a function",a);var s=(0,_.scan)(this,e,t,r,i,n);return(0,_.isNodePattern)(a)&&a.call(this,null,s),s})),void 0!==r&&"object"===(void 0===r?"undefined":(0,m.default)(r))&&(G=r),"undefined"!=typeof self&&"object"===("undefined"==typeof self?"undefined":(0,m.default)(self))&&(G=self),G.Jimp=q,G.Buffer=t;var V=q;i.default=V}).call(this,e("buffer").Buffer)},{"./composite":191,"./constants":192,"./modules/phash":194,"./request":195,"./utils/image-bitmap":196,"./utils/mime":197,"./utils/promisify":198,"@babel/runtime/helpers/assertThisInitialized":3,"@babel/runtime/helpers/classCallCheck":4,"@babel/runtime/helpers/construct":5,"@babel/runtime/helpers/createClass":6,"@babel/runtime/helpers/defineProperty":7,"@babel/runtime/helpers/getPrototypeOf":9,"@babel/runtime/helpers/inherits":10,"@babel/runtime/helpers/interopRequireDefault":11,"@babel/runtime/helpers/interopRequireWildcard":12,"@babel/runtime/helpers/possibleConstructorReturn":17,"@babel/runtime/helpers/slicedToArray":19,"@babel/runtime/helpers/typeof":21,"@jimp/utils":235,"any-base":23,buffer:48,events:52,fs:47,mkdirp:83,path:107,pixelmatch:109,tinycolor2:178}],194:[function(e,t,r){"use strict";function i(e,t){this.size=this.size||e,this.smallerSize=this.smallerSize||t,function(e){for(var t=1;tc?"1":"0";return f};var n=[];t.exports=i},{}],195:[function(e,t,r){(function(r,i){"use strict";var n=e("@babel/runtime/helpers/interopRequireDefault");n(e("@babel/runtime/helpers/defineProperty")),n(e("@babel/runtime/helpers/extends")),r.browser,t.exports=function(e,t){var r=new XMLHttpRequest;r.open("GET",e.url,!0),r.responseType="arraybuffer",r.addEventListener("load",(function(){if(r.status<400)try{var n=i.from(this.response);t(null,r,n)}catch(r){return t(new Error("Response is not a buffer for url "+e.url+". Error: "+r.message))}else t(new Error("HTTP Status "+r.status+" for url "+e.url))})),r.addEventListener("error",(function(e){t(e)})),r.send()}}).call(this,e("_process"),e("buffer").Buffer)},{"@babel/runtime/helpers/defineProperty":7,"@babel/runtime/helpers/extends":8,"@babel/runtime/helpers/interopRequireDefault":11,_process:133,buffer:48,phin:108}],196:[function(e,t,r){(function(t){"use strict";var i=e("@babel/runtime/helpers/interopRequireWildcard"),n=e("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(r,"__esModule",{value:!0}),r.parseBitmap=function(e,r,i){var n=function(e,t){var r=(0,s.default)(e);return r?r.mime:t?h.getType(t):null}(e,r);if("string"!=typeof n)return i(new Error("Could not find MIME for Buffer <"+r+">"));this._originalMime=n.toLowerCase();try{var l=this.getMIME();if(!this.constructor.decoders[l])return u.throwError.call(this,"Unsupported MIME type: "+l,i);this.bitmap=this.constructor.decoders[l](e)}catch(e){return i.call(this,e,this)}try{this._exif=o.default.create(e).parse(),function(e){if(!(f(e)<2)){var r=function(e){var t=e.getWidth(),r=e.getHeight();switch(f(e)){case 1:return null;case 2:return function(e,r){return[t-e-1,r]};case 3:return function(e,i){return[t-e-1,r-i-1]};case 4:return function(e,t){return[e,r-t-1]};case 5:return function(e,t){return[t,e]};case 6:return function(e,t){return[t,r-e-1]};case 7:return function(e,i){return[t-i-1,r-e-1]};case 8:return function(e,r){return[t-r-1,e]};default:return null}}(e),i=f(e)>4,n=i?e.bitmap.height:e.bitmap.width,s=i?e.bitmap.width:e.bitmap.height;!function(e,r,i,n){for(var s=e.bitmap.data,o=e.bitmap.width,u=t.alloc(s.length),l=0;l2?r-2:0),n=2;n1&&void 0!==arguments[1]?arguments[1]:u.default,r={hasAlpha:{},encoders:{},decoders:{},class:{},constants:{}};function i(e){Object.entries(e).forEach((function(e){var t=(0,o.default)(e,2),i=t[0],n=t[1];r[i]=h({},r[i],{},n)}))}function n(e){var t=e();Array.isArray(t.mime)?u.addType.apply(void 0,(0,a.default)(t.mime)):Object.entries(t.mime).forEach((function(e){return u.addType.apply(void 0,(0,a.default)(e))})),delete t.mime,i(t)}function s(e){var t=e(u.jimpEvChange)||{};t.class||t.constants?i(t):i({class:t})}return e.types&&(e.types.forEach(n),t.decoders=h({},t.decoders,{},r.decoders),t.encoders=h({},t.encoders,{},r.encoders),t.hasAlpha=h({},t.hasAlpha,{},r.hasAlpha)),e.plugins&&e.plugins.forEach(s),(0,u.addJimpMethods)(r.class,t),(0,u.addConstants)(r.constants,t),u.default};var a=n(e("@babel/runtime/helpers/toConsumableArray")),s=n(e("@babel/runtime/helpers/defineProperty")),o=n(e("@babel/runtime/helpers/slicedToArray")),u=i(e("@jimp/core"));function l(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,i)}return r}function h(e){for(var t=1;t=0&&u>=0&&h-o>0&&c-u>0){var l=f.getPixelIndex(o,u),d={r:this.bitmap.data[a],g:this.bitmap.data[a+1],b:this.bitmap.data[a+2],a:this.bitmap.data[a+3]},p={r:f.bitmap.data[l],g:f.bitmap.data[l+1],b:f.bitmap.data[l+2],a:f.bitmap.data[l+3]};f.bitmap.data[l]=(d.a*(d.r-p.r)-p.r+255>>8)+p.r,f.bitmap.data[l+1]=(d.a*(d.g-p.g)-p.g+255>>8)+p.g,f.bitmap.data[l+2]=(d.a*(d.b-p.b)-p.b+255>>8)+p.b,f.bitmap.data[l+3]=this.constructor.limit255(p.a+d.a)}})),(0,a.isNodePattern)(l)&&l.call(this,null,this),this}}},t.exports=r.default},{"@babel/runtime/helpers/interopRequireDefault":11,"@babel/runtime/helpers/typeof":21,"@jimp/utils":235}],202:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.shgTable=r.mulTable=void 0,r.mulTable=[1,57,41,21,203,34,97,73,227,91,149,62,105,45,39,137,241,107,3,173,39,71,65,238,219,101,187,87,81,151,141,133,249,117,221,209,197,187,177,169,5,153,73,139,133,127,243,233,223,107,103,99,191,23,177,171,165,159,77,149,9,139,135,131,253,245,119,231,224,109,211,103,25,195,189,23,45,175,171,83,81,79,155,151,147,9,141,137,67,131,129,251,123,30,235,115,113,221,217,53,13,51,50,49,193,189,185,91,179,175,43,169,83,163,5,79,155,19,75,147,145,143,35,69,17,67,33,65,255,251,247,243,239,59,29,229,113,111,219,27,213,105,207,51,201,199,49,193,191,47,93,183,181,179,11,87,43,85,167,165,163,161,159,157,155,77,19,75,37,73,145,143,141,35,138,137,135,67,33,131,129,255,63,250,247,61,121,239,237,117,29,229,227,225,111,55,109,216,213,211,209,207,205,203,201,199,197,195,193,48,190,47,93,185,183,181,179,178,176,175,173,171,85,21,167,165,41,163,161,5,79,157,78,154,153,19,75,149,74,147,73,144,143,71,141,140,139,137,17,135,134,133,66,131,65,129,1],r.shgTable=[0,9,10,10,14,12,14,14,16,15,16,15,16,15,15,17,18,17,12,18,16,17,17,19,19,18,19,18,18,19,19,19,20,19,20,20,20,20,20,20,15,20,19,20,20,20,21,21,21,20,20,20,21,18,21,21,21,21,20,21,17,21,21,21,22,22,21,22,22,21,22,21,19,22,22,19,20,22,22,21,21,21,22,22,22,18,22,22,21,22,22,23,22,20,23,22,22,23,23,21,19,21,21,21,23,23,23,22,23,23,21,23,22,23,18,22,23,20,22,23,23,23,21,22,20,22,21,22,24,24,24,24,24,22,21,24,23,23,24,21,24,23,24,22,24,24,22,24,24,22,23,24,24,24,20,23,22,23,24,24,24,24,24,24,24,23,21,23,22,23,24,24,24,22,24,24,24,23,22,24,24,25,23,25,25,23,24,25,25,24,22,25,25,25,24,23,24,25,25,25,25,25,25,25,25,25,25,25,25,23,25,23,24,25,25,25,25,25,25,25,25,25,24,22,25,25,23,25,25,20,24,25,24,25,25,22,24,25,24,25,24,25,25,24,25,25,25,25,22,25,25,25,24,25,24,25,18]},{}],203:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var i=e("@jimp/utils"),n=e("./blur-tables");r.default=function(){return{blur:function(e,t){if("number"!=typeof e)return i.throwError.call(this,"r must be a number",t);if(e<1)return i.throwError.call(this,"r must be greater than 0",t);for(var r,a,s,o,u,l,h,c,f,d,p,m,g,b,y=this.bitmap.width-1,_=this.bitmap.height-1,v=e+1,w=n.mulTable[e],E=n.shgTable[e],k=[],T=[],S=[],x=[],I=[],C=[],A=2;A-- >0;){for(m=0,g=0,l=0;ly?y:h)<<2),r+=this.bitmap.data[c++],a+=this.bitmap.data[c++],s+=this.bitmap.data[c++],o+=this.bitmap.data[c];for(u=0;u0?c<<2:0),f=g+I[u],d=g+C[u],r+=this.bitmap.data[f++]-this.bitmap.data[d++],a+=this.bitmap.data[f++]-this.bitmap.data[d++],s+=this.bitmap.data[f++]-this.bitmap.data[d++],o+=this.bitmap.data[f]-this.bitmap.data[d],m++;g+=this.bitmap.width<<2}for(u=0;u_?0:this.bitmap.width],a+=T[p],s+=S[p],o+=x[p];for(m=u<<2,l=0;l>>E,this.bitmap.data[m+3]=b,b>255&&(this.bitmap.data[m+3]=255),b>0?(b=255/b,this.bitmap.data[m]=(r*w>>>E)*b,this.bitmap.data[m+1]=(a*w>>>E)*b,this.bitmap.data[m+2]=(s*w>>>E)*b):(this.bitmap.data[m+2]=0,this.bitmap.data[m+1]=0,this.bitmap.data[m]=0),0===u&&(I[l]=((c=l+v)<_?c:_)*this.bitmap.width,C[l]=(c=l-e)>0?c*this.bitmap.width:0),f=u+I[l],d=u+C[l],r+=k[f]-k[d],a+=T[f]-T[d],s+=S[f]-S[d],o+=x[f]-x[d],m+=this.bitmap.width<<2}}return(0,i.isNodePattern)(t)&&t.call(this,null,this),this}}},t.exports=r.default},{"./blur-tables":202,"@jimp/utils":235}],204:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var i=e("@jimp/utils");r.default=function(){return{circle:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;"function"==typeof e&&(t=e,e={});var r=e.radius||(this.bitmap.width>this.bitmap.height?this.bitmap.height:this.bitmap.width)/2,n={x:"number"==typeof e.x?e.x:this.bitmap.width/2,y:"number"==typeof e.y?e.y:this.bitmap.height/2};return this.scanQuiet(0,0,this.bitmap.width,this.bitmap.height,(function(e,t,i){var a=Math.sqrt(Math.pow(e-n.x,2)+Math.pow(t-n.y,2));r-a<=0?this.bitmap.data[i+3]=0:r-a<1&&(this.bitmap.data[i+3]=255*(r-a))})),(0,i.isNodePattern)(t)&&t.call(this,null,this),this}}},t.exports=r.default},{"@jimp/utils":235}],205:[function(e,t,r){(function(i){"use strict";var n=e("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var a=n(e("@babel/runtime/helpers/toConsumableArray")),s=n(e("tinycolor2")),o=e("@jimp/utils");function u(e,t,r,i){for(var n=[0,0,0],a=(t.length-1)/2,s=0;s2&&void 0!==arguments[2]?arguments[2]:50;return{r:(t.r-e.r)*(r/100)+e.r,g:(t.g-e.g)*(r/100)+e.g,b:(t.b-e.b)*(r/100)+e.b}}function f(e,t){var r=this;return e&&Array.isArray(e)?(e=e.map((function(e){return"xor"!==e.apply&&"mix"!==e.apply||(e.params[0]=(0,s.default)(e.params[0]).toRgb()),e})),this.scanQuiet(0,0,this.bitmap.width,this.bitmap.height,(function(i,n,u){var l={r:r.bitmap.data[u],g:r.bitmap.data[u+1],b:r.bitmap.data[u+2]},h=function(e,t){return r.constructor.limit255(l[e]+t)};e.forEach((function(e){if("mix"===e.apply)l=c(l,e.params[0],e.params[1]);else if("tint"===e.apply)l=c(l,{r:255,g:255,b:255},e.params[0]);else if("shade"===e.apply)l=c(l,{r:0,g:0,b:0},e.params[0]);else if("xor"===e.apply)l={r:l.r^e.params[0].r,g:l.g^e.params[0].g,b:l.b^e.params[0].b};else if("red"===e.apply)l.r=h("r",e.params[0]);else if("green"===e.apply)l.g=h("g",e.params[0]);else if("blue"===e.apply)l.b=h("b",e.params[0]);else{var i;if("hue"===e.apply&&(e.apply="spin"),!(l=(0,s.default)(l))[e.apply])return o.throwError.call(r,"action "+e.apply+" not supported",t);l=(i=l)[e.apply].apply(i,(0,a.default)(e.params)).toRgb()}})),r.bitmap.data[u]=l.r,r.bitmap.data[u+1]=l.g,r.bitmap.data[u+2]=l.b})),(0,o.isNodePattern)(t)&&t.call(this,null,this),this):o.throwError.call(this,"actions must be an array",t)}r.default=function(){return{brightness:function(e,t){return"number"!=typeof e?o.throwError.call(this,"val must be numbers",t):e<-1||e>1?o.throwError.call(this,"val must be a number between -1 and +1",t):(this.scanQuiet(0,0,this.bitmap.width,this.bitmap.height,(function(t,r,i){e<0?(this.bitmap.data[i]=this.bitmap.data[i]*(1+e),this.bitmap.data[i+1]=this.bitmap.data[i+1]*(1+e),this.bitmap.data[i+2]=this.bitmap.data[i+2]*(1+e)):(this.bitmap.data[i]=this.bitmap.data[i]+(255-this.bitmap.data[i])*e,this.bitmap.data[i+1]=this.bitmap.data[i+1]+(255-this.bitmap.data[i+1])*e,this.bitmap.data[i+2]=this.bitmap.data[i+2]+(255-this.bitmap.data[i+2])*e)})),(0,o.isNodePattern)(t)&&t.call(this,null,this),this)},contrast:function(e,t){if("number"!=typeof e)return o.throwError.call(this,"val must be numbers",t);if(e<-1||e>1)return o.throwError.call(this,"val must be a number between -1 and +1",t);var r=(e+1)/(1-e);function i(e){return(e=Math.floor(r*(e-127)+127))<0?0:e>255?255:e}return this.scanQuiet(0,0,this.bitmap.width,this.bitmap.height,(function(e,t,r){this.bitmap.data[r]=i(this.bitmap.data[r]),this.bitmap.data[r+1]=i(this.bitmap.data[r+1]),this.bitmap.data[r+2]=i(this.bitmap.data[r+2])})),(0,o.isNodePattern)(t)&&t.call(this,null,this),this},posterize:function(e,t){return"number"!=typeof e?o.throwError.call(this,"n must be numbers",t):(e<2&&(e=2),this.scanQuiet(0,0,this.bitmap.width,this.bitmap.height,(function(t,r,i){this.bitmap.data[i]=Math.floor(this.bitmap.data[i]/255*(e-1))/(e-1)*255,this.bitmap.data[i+1]=Math.floor(this.bitmap.data[i+1]/255*(e-1))/(e-1)*255,this.bitmap.data[i+2]=Math.floor(this.bitmap.data[i+2]/255*(e-1))/(e-1)*255})),(0,o.isNodePattern)(t)&&t.call(this,null,this),this)},greyscale:h,grayscale:h,opacity:function(e,t){return"number"!=typeof e?o.throwError.call(this,"f must be a number",t):e<0||e>1?o.throwError.call(this,"f must be a number from 0 to 1",t):(this.scanQuiet(0,0,this.bitmap.width,this.bitmap.height,(function(t,r,i){var n=this.bitmap.data[i+3]*e;this.bitmap.data[i+3]=n})),(0,o.isNodePattern)(t)&&t.call(this,null,this),this)},sepia:function(e){return this.scanQuiet(0,0,this.bitmap.width,this.bitmap.height,(function(e,t,r){var i=this.bitmap.data[r],n=this.bitmap.data[r+1],a=this.bitmap.data[r+2];a=.272*(i=.393*i+.769*n+.189*a)+.534*(n=.349*i+.686*n+.168*a)+.131*a,this.bitmap.data[r]=i<255?i:255,this.bitmap.data[r+1]=n<255?n:255,this.bitmap.data[r+2]=a<255?a:255})),(0,o.isNodePattern)(e)&&e.call(this,null,this),this},fade:function(e,t){return"number"!=typeof e?o.throwError.call(this,"f must be a number",t):e<0||e>1?o.throwError.call(this,"f must be a number from 0 to 1",t):(this.opacity(1-e),(0,o.isNodePattern)(t)&&t.call(this,null,this),this)},convolution:function(e,t,r){"function"==typeof t&&void 0===r&&(r=t,t=null),t||(t=this.constructor.EDGE_EXTEND);var n,a,s,u,l,h,c,f,d,p,m=i.from(this.bitmap.data),g=e.length,b=e[0].length,y=Math.floor(g/2),_=Math.floor(b/2),v=-y,w=-_;return this.scanQuiet(0,0,this.bitmap.width,this.bitmap.height,(function(r,i,o){u=0,s=0,a=0;for(var g=v;g<=y;g++)for(var b=w;b<=_;b++)f=r+b,d=i+g,n=e[g+y][b+_],-1===(p=this.getPixelIndex(f,d,t))?(c=0,h=0,l=0):(l=this.bitmap.data[p+0],h=this.bitmap.data[p+1],c=this.bitmap.data[p+2]),a+=n*l,s+=n*h,u+=n*c;a<0&&(a=0),s<0&&(s=0),u<0&&(u=0),a>255&&(a=255),s>255&&(s=255),u>255&&(u=255),m[o+0]=a,m[o+1]=s,m[o+2]=u})),this.bitmap.data=m,(0,o.isNodePattern)(r)&&r.call(this,null,this),this},opaque:function(e){return this.scanQuiet(0,0,this.bitmap.width,this.bitmap.height,(function(e,t,r){this.bitmap.data[r+3]=255})),(0,o.isNodePattern)(e)&&e.call(this,null,this),this},pixelate:function(e,t,r,i,n,a){if("function"==typeof t)a=t,n=null,i=null,r=null,t=null;else{if("number"!=typeof e)return o.throwError.call(this,"size must be a number",a);if(l(t)&&"number"!=typeof t)return o.throwError.call(this,"x must be a number",a);if(l(r)&&"number"!=typeof r)return o.throwError.call(this,"y must be a number",a);if(l(i)&&"number"!=typeof i)return o.throwError.call(this,"w must be a number",a);if(l(n)&&"number"!=typeof n)return o.throwError.call(this,"h must be a number",a)}var s=[[1/16,2/16,1/16],[2/16,.25,2/16],[1/16,2/16,1/16]];t=t||0,r=r||0,i=l(i)?i:this.bitmap.width-t,n=l(n)?n:this.bitmap.height-r;var h=this.cloneQuiet();return this.scanQuiet(t,r,i,n,(function(t,r,i){t=e*Math.floor(t/e),r=e*Math.floor(r/e);var n=u(h,s,t,r);this.bitmap.data[i]=n[0],this.bitmap.data[i+1]=n[1],this.bitmap.data[i+2]=n[2]})),(0,o.isNodePattern)(a)&&a.call(this,null,this),this},convolute:function(e,t,r,i,n,a){if(!Array.isArray(e))return o.throwError.call(this,"the kernel must be an array",a);if("function"==typeof t)a=t,t=null,r=null,i=null,n=null;else{if(l(t)&&"number"!=typeof t)return o.throwError.call(this,"x must be a number",a);if(l(r)&&"number"!=typeof r)return o.throwError.call(this,"y must be a number",a);if(l(i)&&"number"!=typeof i)return o.throwError.call(this,"w must be a number",a);if(l(n)&&"number"!=typeof n)return o.throwError.call(this,"h must be a number",a)}var s=(e.length-1)/2;t=l(t)?t:s,r=l(r)?r:s,i=l(i)?i:this.bitmap.width-t,n=l(n)?n:this.bitmap.height-r;var h=this.cloneQuiet();return this.scanQuiet(t,r,i,n,(function(t,r,i){var n=u(h,e,t,r);this.bitmap.data[i]=this.constructor.limit255(n[0]),this.bitmap.data[i+1]=this.constructor.limit255(n[1]),this.bitmap.data[i+2]=this.constructor.limit255(n[2])})),(0,o.isNodePattern)(a)&&a.call(this,null,this),this},color:f,colour:f}},t.exports=r.default}).call(this,e("buffer").Buffer)},{"@babel/runtime/helpers/interopRequireDefault":11,"@babel/runtime/helpers/toConsumableArray":20,"@jimp/utils":235,buffer:48,tinycolor2:178}],206:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var i=e("@jimp/utils");r.default=function(){return{contain:function(e,t,r,n,a){if("number"!=typeof e||"number"!=typeof t)return i.throwError.call(this,"w and h must be numbers",a);"string"==typeof r&&("function"==typeof n&&void 0===a&&(a=n),n=r,r=null),"function"==typeof r&&(void 0===a&&(a=r),n=null,r=null),"function"==typeof n&&void 0===a&&(a=n,n=null);var s=7&(r=r||this.constructor.HORIZONTAL_ALIGN_CENTER|this.constructor.VERTICAL_ALIGN_MIDDLE),o=r>>3;if((0===s||s&s-1)&&(0===o||o&o-1))return i.throwError.call(this,"only use one flag per alignment direction",a);var u=s>>1,l=o>>1,h=e/t>this.bitmap.width/this.bitmap.height?t/this.bitmap.height:e/this.bitmap.width,c=this.cloneQuiet().scale(h,n);return this.resize(e,t,n),this.scanQuiet(0,0,this.bitmap.width,this.bitmap.height,(function(e,t,r){this.bitmap.data.writeUInt32BE(this._background,r)})),this.blit(c,(this.bitmap.width-c.bitmap.width)/2*u,(this.bitmap.height-c.bitmap.height)/2*l),(0,i.isNodePattern)(a)&&a.call(this,null,this),this}}},t.exports=r.default},{"@jimp/utils":235}],207:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var i=e("@jimp/utils");r.default=function(){return{cover:function(e,t,r,n,a){if("number"!=typeof e||"number"!=typeof t)return i.throwError.call(this,"w and h must be numbers",a);r&&"function"==typeof r&&void 0===a?(a=r,r=null,n=null):"function"==typeof n&&void 0===a&&(a=n,n=null);var s=7&(r=r||this.constructor.HORIZONTAL_ALIGN_CENTER|this.constructor.VERTICAL_ALIGN_MIDDLE),o=r>>3;if((0===s||s&s-1)&&(0===o||o&o-1))return i.throwError.call(this,"only use one flag per alignment direction",a);var u=s>>1,l=o>>1,h=e/t>this.bitmap.width/this.bitmap.height?e/this.bitmap.width:t/this.bitmap.height;return this.scale(h,n),this.crop((this.bitmap.width-e)/2*u,(this.bitmap.height-t)/2*l,e,t),(0,i.isNodePattern)(a)&&a.call(this,null,this),this}}},t.exports=r.default},{"@jimp/utils":235}],208:[function(e,t,r){(function(i){"use strict";var n=e("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(e){return e("crop",(function(e,t,r,n,a){if("number"!=typeof e||"number"!=typeof t)return s.throwError.call(this,"x and y must be numbers",a);if("number"!=typeof r||"number"!=typeof n)return s.throwError.call(this,"w and h must be numbers",a);if(e=Math.round(e),t=Math.round(t),r=Math.round(r),n=Math.round(n),0===e&&r===this.bitmap.width){var o=r*t+e<<2,u=o+n*r<<2;this.bitmap.data=this.bitmap.data.slice(o,u)}else{var l=i.allocUnsafe(r*n*4),h=0;this.scanQuiet(e,t,r,n,(function(e,t,r){var i=this.bitmap.data.readUInt32BE(r,!0);l.writeUInt32BE(i,h,!0),h+=4})),this.bitmap.data=l}return this.bitmap.width=r,this.bitmap.height=n,(0,s.isNodePattern)(a)&&a.call(this,null,this),this})),{class:{autocrop:function(){for(var e,t=this.bitmap.width,r=this.bitmap.height,i=1,n=0,o=2e-4,u=!0,l=!1,h=arguments.length,c=new Array(h),f=0;fo)break e}y++}g=this.getPixelColor(t,0);e:for(var x=0;xo)break e}_++}g=this.getPixelColor(0,r);e:for(var M=r-1;M>=y+i;M--){for(var P=t-_-1;P>=0;P--){var R=this.getPixelColor(P,M),B=this.constructor.intToRGBA(R);if(this.constructor.colorDiff(b,B)>o)break e}v++}g=this.getPixelColor(t,r);e:for(var O=t-1;O>=0+_+i;O--){for(var D=r-1;D>=0+y;D--){var L=this.getPixelColor(O,D),F=this.constructor.intToRGBA(L);if(this.constructor.colorDiff(b,F)>o)break e}w++}if(w-=n,_-=n,y-=n,v-=n,l){var z=Math.min(_,w),N=Math.min(y,v);w=z,_=z,y=N,v=N}var U=t-((w=w>=0?w:0)+(_=_>=0?_:0)),j=r-((v=v>=0?v:0)+(y=y>=0?y:0));return(u?0!==_&&0!==y&&0!==w&&0!==v:0!==_||0!==y||0!==w||0!==v)&&this.crop(_,y,U,j),(0,s.isNodePattern)(e)&&e.call(this,null,this),this}}}};var a=n(e("@babel/runtime/helpers/typeof")),s=e("@jimp/utils");t.exports=r.default}).call(this,e("buffer").Buffer)},{"@babel/runtime/helpers/interopRequireDefault":11,"@babel/runtime/helpers/typeof":21,"@jimp/utils":235,buffer:48}],209:[function(e,t,r){"use strict";var i=e("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var n=i(e("@babel/runtime/helpers/typeof")),a=e("@jimp/utils");r.default=function(){return{displace:function(e,t,r){if("object"!==(0,n.default)(e)||e.constructor!==this.constructor)return a.throwError.call(this,"The source must be a Jimp image",r);if("number"!=typeof t)return a.throwError.call(this,"factor must be a number",r);var i=this.cloneQuiet();return this.scanQuiet(0,0,this.bitmap.width,this.bitmap.height,(function(r,n,a){var s=e.bitmap.data[a]/256*t;s=Math.round(s);var o=this.getPixelIndex(r+s,n);this.bitmap.data[o]=i.bitmap.data[a],this.bitmap.data[o+1]=i.bitmap.data[a+1],this.bitmap.data[o+2]=i.bitmap.data[a+2]})),(0,a.isNodePattern)(r)&&r.call(this,null,this),this}}},t.exports=r.default},{"@babel/runtime/helpers/interopRequireDefault":11,"@babel/runtime/helpers/typeof":21,"@jimp/utils":235}],210:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var i=e("@jimp/utils");function n(e){var t=[1,9,3,11,13,5,15,7,4,12,2,10,16,8,14,6];return this.scanQuiet(0,0,this.bitmap.width,this.bitmap.height,(function(e,r,i){var n=t[((3&r)<<2)+e%4];this.bitmap.data[i]=Math.min(this.bitmap.data[i]+n,255),this.bitmap.data[i+1]=Math.min(this.bitmap.data[i+1]+n,255),this.bitmap.data[i+2]=Math.min(this.bitmap.data[i+2]+n,255)})),(0,i.isNodePattern)(e)&&e.call(this,null,this),this}r.default=function(){return{dither565:n,dither16:n}},t.exports=r.default},{"@jimp/utils":235}],211:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var i=e("@jimp/utils");r.default=function(){return{fisheye:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{r:2.5},r=arguments.length>1?arguments[1]:void 0;"function"==typeof t&&(r=t,t={r:2.5});var n=this.cloneQuiet(),a=n.bitmap,s=a.width,o=a.height;return n.scanQuiet(0,0,s,o,(function(r,i){var a=r/s,u=i/o,l=Math.sqrt(Math.pow(a-.5,2)+Math.pow(u-.5,2)),h=2*Math.pow(l,t.r),c=(a-.5)/l,f=(u-.5)/l,d=Math.round((h*c+.5)*s),p=Math.round((h*f+.5)*o),m=n.getPixelColor(d,p);e.setPixelColor(m,r,i)})),this.setPixelColor(n.getPixelColor(s/2,o/2),s/2,o/2),(0,i.isNodePattern)(r)&&r.call(this,null,this),this}}},t.exports=r.default},{"@jimp/utils":235}],212:[function(e,t,r){(function(i){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var n=e("@jimp/utils");function a(e,t,r){if("boolean"!=typeof e||"boolean"!=typeof t)return n.throwError.call(this,"horizontal and vertical must be Booleans",r);var a=i.alloc(this.bitmap.data.length);return this.scanQuiet(0,0,this.bitmap.width,this.bitmap.height,(function(r,i,n){var s=e?this.bitmap.width-1-r:r,o=t?this.bitmap.height-1-i:i,u=this.bitmap.width*o+s<<2,l=this.bitmap.data.readUInt32BE(n);a.writeUInt32BE(l,u)})),this.bitmap.data=i.from(a),(0,n.isNodePattern)(r)&&r.call(this,null,this),this}r.default=function(){return{flip:a,mirror:a}},t.exports=r.default}).call(this,e("buffer").Buffer)},{"@jimp/utils":235,buffer:48}],213:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var i=e("@jimp/utils");r.default=function(){return{gaussian:function(e,t){if("number"!=typeof e)return i.throwError.call(this,"r must be a number",t);if(e<1)return i.throwError.call(this,"r must be greater than 0",t);for(var r=Math.ceil(2.57*e),n=2*r+1,a=e*e*2,s=a*Math.PI,o=[],u=0;u1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3?arguments[3]:void 0;if(!(e instanceof this.constructor))return i.throwError.call(this,"The source must be a Jimp image",n);if("number"!=typeof t||"number"!=typeof r)return i.throwError.call(this,"x and y must be numbers",n);t=Math.round(t),r=Math.round(r);var a=this.bitmap.width,s=this.bitmap.height,o=this;return e.scanQuiet(0,0,e.bitmap.width,e.bitmap.height,(function(e,i,n){var u=t+e,l=r+i;if(u>=0&&l>=0&&u0})),255-e.slice().reverse().findIndex((function(e){return e>0}))]};r.default=function(){return{normalize:function(e){var t=n.call(this),r={r:s(t.r),g:s(t.g),b:s(t.b)};return this.scanQuiet(0,0,this.bitmap.width,this.bitmap.height,(function(e,t,i){var n=this.bitmap.data[i+0],s=this.bitmap.data[i+1],o=this.bitmap.data[i+2];this.bitmap.data[i+0]=a(n,r.r[0],r.r[1]),this.bitmap.data[i+1]=a(s,r.g[0],r.g[1]),this.bitmap.data[i+2]=a(o,r.b[0],r.b[1])})),(0,i.isNodePattern)(e)&&e.call(this,null,this),this}}},t.exports=r.default},{"@jimp/utils":235}],217:[function(e,t,r){(function(i){"use strict";var n=e("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var a=n(e("@babel/runtime/helpers/typeof")),s=n(e("@babel/runtime/helpers/toConsumableArray")),o=n(e("path")),u=n(e("load-bmfont")),l=e("@jimp/utils"),h=e("./measure-text");function c(e,t,r,i,n){if(n.width>0&&n.height>0){var a=t.pages[n.page];e.blit(a,r+n.xoffset,i+n.yoffset,n.x,n.y,n.width,n.height)}return e}function f(e,t,r,i,n){for(var a=0;ao&&(o=u),a.push(t)):(n.push(a),a=[t])})),n.push(a),{lines:n,longestLine:o}}(e,i,n),b=g.lines,y=g.longestLine;return b.forEach((function(i){var a=i.join(" "),s=function(e,t,r,i,n){return n===e.HORIZONTAL_ALIGN_LEFT?0:n===e.HORIZONTAL_ALIGN_CENTER?(i-(0,h.measureText)(t,r))/2:i-(0,h.measureText)(t,r)}(p.constructor,e,a,n,c);f.call(p,e,t+s,r,a,m),r+=e.common.lineHeight})),(0,l.isNodePattern)(u)&&u.call(this,null,this,{x:t+y,y:r}),this}}}},t.exports=r.default}).call(this,"/../../node_modules/@jimp/plugin-print/dist")},{"./measure-text":218,"@babel/runtime/helpers/interopRequireDefault":11,"@babel/runtime/helpers/toConsumableArray":20,"@babel/runtime/helpers/typeof":21,"@jimp/utils":235,"load-bmfont":219,path:107}],218:[function(e,t,r){"use strict";function i(e,t){for(var r=0,i=0;ir&&o>0?(s+=e.common.lineHeight,a=n[o]+" "):a=u}return s}},{}],219:[function(e,t,r){(function(r){var i=e("xhr"),n=function(){},a=e("parse-bmfont-ascii"),s=e("parse-bmfont-xml"),o=e("parse-bmfont-binary"),u=e("./lib/is-binary"),l=e("xtend"),h=self.XMLHttpRequest&&"withCredentials"in new XMLHttpRequest;t.exports=function(e,t){t="function"==typeof t?t:n,"string"==typeof e?e={uri:e}:e||(e={}),e.binary&&(e=function(e){if(h)return l(e,{responseType:"arraybuffer"});if(void 0===self.XMLHttpRequest)throw new Error("your browser does not support XHR loading");var t=new self.XMLHttpRequest;return t.overrideMimeType("text/plain; charset=x-user-defined"),l({xhr:t},e)}(e)),i(e,(function(i,l,h){if(i)return t(i);if(!/^2/.test(l.statusCode))return t(new Error("http status code: "+l.statusCode));if(!h)return t(new Error("no body result"));var c,f,d=!1;if(c=h,"[object ArrayBuffer]"===Object.prototype.toString.call(c)){var p=new Uint8Array(h);h=new r(p,"binary")}u(h)&&(d=!0,"string"==typeof h&&(h=new r(h,"binary"))),d||(r.isBuffer(h)&&(h=h.toString(e.encoding)),h=h.trim());try{var m=l.headers["content-type"];f=d?o(h):/json/.test(m)||"{"===h.charAt(0)?JSON.parse(h):/xml/.test(m)||"<"===h.charAt(0)?s(h):a(h)}catch(e){t(new Error("error parsing font "+e.message)),t=n}t(null,f)}))}}).call(this,e("buffer").Buffer)},{"./lib/is-binary":220,buffer:48,"parse-bmfont-ascii":102,"parse-bmfont-binary":103,"parse-bmfont-xml":104,xhr:187,xtend:189}],220:[function(e,t,r){(function(r){var i=e("buffer-equal"),n=new r([66,77,70,3]);t.exports=function(e){return"string"==typeof e?"BMF"===e.substring(0,3):e.length>4&&i(e.slice(0,4),n)}}).call(this,e("buffer").Buffer)},{buffer:48,"buffer-equal":49}],221:[function(e,t,r){(function(i){"use strict";var n=e("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var a=e("@jimp/utils"),s=n(e("./modules/resize")),o=n(e("./modules/resize2"));r.default=function(){return{constants:{RESIZE_NEAREST_NEIGHBOR:"nearestNeighbor",RESIZE_BILINEAR:"bilinearInterpolation",RESIZE_BICUBIC:"bicubicInterpolation",RESIZE_HERMITE:"hermiteInterpolation",RESIZE_BEZIER:"bezierInterpolation"},class:{resize:function(e,t,r,n){if("number"!=typeof e||"number"!=typeof t)return a.throwError.call(this,"w and h must be numbers",n);if("function"==typeof r&&void 0===n&&(n=r,r=null),e===this.constructor.AUTO&&t===this.constructor.AUTO)return a.throwError.call(this,"w and h cannot both be set to auto",n);if(e===this.constructor.AUTO&&(e=this.bitmap.width*(t/this.bitmap.height)),t===this.constructor.AUTO&&(t=this.bitmap.height*(e/this.bitmap.width)),e<0||t<0)return a.throwError.call(this,"w and h must be positive numbers",n);if(e=Math.round(e),t=Math.round(t),"function"==typeof o.default[r]){var u={data:i.alloc(e*t*4),width:e,height:t};o.default[r](this.bitmap,u),this.bitmap=u}else{var l=this,h=new s.default(this.bitmap.width,this.bitmap.height,e,t,!0,!0,(function(r){l.bitmap.data=i.from(r),l.bitmap.width=e,l.bitmap.height=t}));h.resize(this.bitmap.data)}return(0,a.isNodePattern)(n)&&n.call(this,null,this),this}}}},t.exports=r.default}).call(this,e("buffer").Buffer)},{"./modules/resize":222,"./modules/resize2":223,"@babel/runtime/helpers/interopRequireDefault":11,"@jimp/utils":235,buffer:48}],222:[function(e,t,r){"use strict";function i(e,t,r,i,n,a,s){this.widthOriginal=Math.abs(Math.floor(e)||0),this.heightOriginal=Math.abs(Math.floor(t)||0),this.targetWidth=Math.abs(Math.floor(r)||0),this.targetHeight=Math.abs(Math.floor(i)||0),this.colorChannels=n?4:3,this.interpolationPass=Boolean(a),this.resizeCallback="function"==typeof s?s:function(){},this.targetWidthMultipliedByChannels=this.targetWidth*this.colorChannels,this.originalWidthMultipliedByChannels=this.widthOriginal*this.colorChannels,this.originalHeightMultipliedByChannels=this.heightOriginal*this.colorChannels,this.widthPassResultSize=this.targetWidthMultipliedByChannels*this.heightOriginal,this.finalResultSize=this.targetWidthMultipliedByChannels*this.targetHeight,this.initialize()}i.prototype.initialize=function(){if(!(this.widthOriginal>0&&this.heightOriginal>0&&this.targetWidth>0&&this.targetHeight>0))throw new Error("Invalid settings specified for the resizer.");this.configurePasses()},i.prototype.configurePasses=function(){this.widthOriginal===this.targetWidth?this.resizeWidth=this.bypassResizer:(this.ratioWeightWidthPass=this.widthOriginal/this.targetWidth,this.ratioWeightWidthPass<1&&this.interpolationPass?(this.initializeFirstPassBuffers(!0),this.resizeWidth=4===this.colorChannels?this.resizeWidthInterpolatedRGBA:this.resizeWidthInterpolatedRGB):(this.initializeFirstPassBuffers(!1),this.resizeWidth=4===this.colorChannels?this.resizeWidthRGBA:this.resizeWidthRGB)),this.heightOriginal===this.targetHeight?this.resizeHeight=this.bypassResizer:(this.ratioWeightHeightPass=this.heightOriginal/this.targetHeight,this.ratioWeightHeightPass<1&&this.interpolationPass?(this.initializeSecondPassBuffers(!0),this.resizeHeight=this.resizeHeightInterpolated):(this.initializeSecondPassBuffers(!1),this.resizeHeight=4===this.colorChannels?this.resizeHeightRGBA:this.resizeHeightRGB))},i.prototype._resizeWidthInterpolatedRGBChannels=function(e,t){var r,i,n=t?4:3,a=this.ratioWeightWidthPass,s=this.widthBuffer,o=0,u=0,l=0,h=0,c=0;for(r=0;o<1/3;r+=n,o+=a)for(u=r,l=0;u=c)){d+=h;break}d=f+=r,h-=c}while(h>0&&f=u)){h+=o;break}h=l=d,o-=u}while(o>0&&l3&&(this.outputWidthWorkBenchOpaquePixelsCount=this.generateFloat64Buffer(this.heightOriginal)))},i.prototype.initializeSecondPassBuffers=function(e){this.heightBuffer=this.generateUint8Buffer(this.finalResultSize),e||(this.outputHeightWorkBench=this.generateFloatBuffer(this.targetWidthMultipliedByChannels),this.colorChannels>3&&(this.outputHeightWorkBenchOpaquePixelsCount=this.generateFloat64Buffer(this.targetWidth)))},i.prototype.generateFloatBuffer=function(e){try{return new Float32Array(e)}catch(e){return[]}},i.prototype.generateFloat64Buffer=function(e){try{return new Float64Array(e)}catch(e){return[]}},i.prototype.generateUint8Buffer=function(e){try{return new Uint8Array(e)}catch(e){return[]}},t.exports=i},{}],223:[function(e,t,r){(function(e){"use strict";t.exports={nearestNeighbor:function(e,t){for(var r=e.width,i=e.height,n=t.width,a=t.height,s=e.data,o=t.data,u=0;u0?a[T-4]:2*a[T]-a[T+4],x=a[T],I=a[T+4],C=_0?m[z-4*f]:2*m[z]-m[z+4*f],U=m[z],j=m[z+4*f],G=B1)for(var q=0;q=0&&_.x=0&&_.ythis.bitmap.width/this.bitmap.height?t/this.bitmap.height:e/this.bitmap.width;return this.scale(a,r),(0,i.isNodePattern)(n)&&n.call(this,null,this),this}}},t.exports=r.default},{"@jimp/utils":235}],226:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var i=e("@jimp/utils");r.default=function(){return{shadow:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0;"function"==typeof t&&(r=t,t={});var n=t,a=n.opacity,s=void 0===a?.7:a,o=n.size,u=void 0===o?1.1:o,l=n.x,h=void 0===l?-25:l,c=n.y,f=void 0===c?25:c,d=n.blur,p=void 0===d?5:d,m=this.clone(),g=this.clone();return g.scan(0,0,g.bitmap.width,g.bitmap.height,(function(t,r,i){g.bitmap.data[i]=0,g.bitmap.data[i+1]=0,g.bitmap.data[i+2]=0,g.bitmap.data[i+3]=g.constructor.limit255(g.bitmap.data[i+3]*s),e.bitmap.data[i]=0,e.bitmap.data[i+1]=0,e.bitmap.data[i+2]=0,e.bitmap.data[i+3]=0})),g.resize(g.bitmap.width*u,g.bitmap.height*u).blur(p),this.composite(g,h,f),this.composite(m,0,0),(0,i.isNodePattern)(r)&&r.call(this,null,this),this}}},t.exports=r.default},{"@jimp/utils":235}],227:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var i=e("@jimp/utils");r.default=function(){return{threshold:function(e,t){var r=this,n=e.max,a=e.replace,s=void 0===a?255:a,o=e.autoGreyscale,u=void 0===o||o;return"number"!=typeof n?i.throwError.call(this,"max must be a number",t):"number"!=typeof s?i.throwError.call(this,"replace must be a number",t):"boolean"!=typeof u?i.throwError.call(this,"autoGreyscale must be a boolean",t):(n=this.constructor.limit255(n),s=this.constructor.limit255(s),u&&this.greyscale(),this.scanQuiet(0,0,this.bitmap.width,this.bitmap.height,(function(e,t,i){var a=r.bitmap.data[i]100?s.throwError.call(this,"n must be a number 0 - 100",t):(this._quality=Math.round(e),(0,s.isNodePattern)(t)&&t.call(this,null,this),this)}}}},t.exports=r.default},{"@babel/runtime/helpers/defineProperty":7,"@babel/runtime/helpers/interopRequireDefault":11,"@jimp/utils":235,"jpeg-js":80}],232:[function(e,t,r){"use strict";var i=e("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var n=i(e("@babel/runtime/helpers/defineProperty")),a=e("pngjs"),s=e("@jimp/utils");r.default=function(){return{mime:(0,n.default)({},"image/png",["png"]),constants:{MIME_PNG:"image/png",PNG_FILTER_AUTO:-1,PNG_FILTER_NONE:0,PNG_FILTER_SUB:1,PNG_FILTER_UP:2,PNG_FILTER_AVERAGE:3,PNG_FILTER_PATH:4},hasAlpha:(0,n.default)({},"image/png",!0),decoders:(0,n.default)({},"image/png",a.PNG.sync.read),encoders:(0,n.default)({},"image/png",(function(e){var t=new a.PNG({width:e.bitmap.width,height:e.bitmap.height});return t.data=e.bitmap.data,a.PNG.sync.write(t,{width:e.bitmap.width,height:e.bitmap.height,deflateLevel:e._deflateLevel,deflateStrategy:e._deflateStrategy,filterType:e._filterType,colorType:"number"==typeof e._colorType?e._colorType:e._rgba?6:2,inputHasAlpha:e._rgba})})),class:{_deflateLevel:9,_deflateStrategy:3,_filterType:-1,_colorType:null,deflateLevel:function(e,t){return"number"!=typeof e?s.throwError.call(this,"l must be a number",t):e<0||e>9?s.throwError.call(this,"l must be a number 0 - 9",t):(this._deflateLevel=Math.round(e),(0,s.isNodePattern)(t)&&t.call(this,null,this),this)},deflateStrategy:function(e,t){return"number"!=typeof e?s.throwError.call(this,"s must be a number",t):e<0||e>3?s.throwError.call(this,"s must be a number 0 - 3",t):(this._deflateStrategy=Math.round(e),(0,s.isNodePattern)(t)&&t.call(this,null,this),this)},filterType:function(e,t){return"number"!=typeof e?s.throwError.call(this,"n must be a number",t):e<-1||e>4?s.throwError.call(this,"n must be -1 (auto) or a number 0 - 4",t):(this._filterType=Math.round(e),(0,s.isNodePattern)(t)&&t.call(this,null,this),this)},colorType:function(e,t){return"number"!=typeof e?s.throwError.call(this,"s must be a number",t):0!==e&&2!==e&&4!==e&&6!==e?s.throwError.call(this,"s must be a number 0, 2, 4, 6.",t):(this._colorType=Math.round(e),(0,s.isNodePattern)(t)&&t.call(this,null,this),this)}}}},t.exports=r.default},{"@babel/runtime/helpers/defineProperty":7,"@babel/runtime/helpers/interopRequireDefault":11,"@jimp/utils":235,pngjs:129}],233:[function(e,t,r){(function(i){"use strict";var n=e("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var a=n(e("@babel/runtime/helpers/defineProperty")),s=n(e("utif"));r.default=function(){return{mime:(0,a.default)({},"image/tiff",["tiff","tif"]),constants:{MIME_TIFF:"image/tiff"},decoders:(0,a.default)({},"image/tiff",(function(e){var t=s.default.decode(e),r=t[0];s.default.decodeImages(e,t);var n=s.default.toRGBA8(r);return{data:i.from(n),width:r.t256[0],height:r.t257[0]}})),encoders:(0,a.default)({},"image/tiff",(function(e){var t=s.default.encodeImage(e.bitmap.data,e.bitmap.width,e.bitmap.height);return i.from(t)}))}},t.exports=r.default}).call(this,e("buffer").Buffer)},{"@babel/runtime/helpers/defineProperty":7,"@babel/runtime/helpers/interopRequireDefault":11,buffer:48,utif:182}],234:[function(e,t,r){"use strict";var i=e("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var n=e("timm"),a=i(e("@jimp/jpeg")),s=i(e("@jimp/png")),o=i(e("@jimp/bmp")),u=i(e("@jimp/tiff")),l=i(e("@jimp/gif"));r.default=function(){return(0,n.mergeDeep)((0,a.default)(),(0,s.default)(),(0,o.default)(),(0,u.default)(),(0,l.default)())},t.exports=r.default},{"@babel/runtime/helpers/interopRequireDefault":11,"@jimp/bmp":229,"@jimp/gif":230,"@jimp/jpeg":231,"@jimp/png":232,"@jimp/tiff":233,timm:177}],235:[function(e,t,r){"use strict";var i=e("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(r,"__esModule",{value:!0}),r.isNodePattern=function(e){if(void 0===e)return!1;if("function"!=typeof e)throw new TypeError("Callback must be a function");return!0},r.throwError=function(e,t){if("string"==typeof e&&(e=new Error(e)),"function"==typeof t)return t.call(this,e);throw e},r.scan=function(e,t,r,i,n,a){t=Math.round(t),r=Math.round(r),i=Math.round(i),n=Math.round(n);for(var s=r;s{"%%"!==e&&(i++,"%c"===e&&(n=i))}),t.splice(n,0,r)},t.save=function(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch(e){}},t.load=function(){let e;try{e=t.storage.getItem("debug")}catch(e){}!e&&void 0!==i&&"env"in i&&(e=i.env.DEBUG);return e},t.useColors=function(){if("undefined"!=typeof window&&window.process&&("renderer"===window.process.type||window.process.__nwjs))return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},t.storage=function(){try{return localStorage}catch(e){}}(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],e.exports=r(204)(t);const{formatters:n}=e.exports;n.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}).call(this,r(16))},function(e,t,r){e.exports=function(e){function t(e){let t=0;for(let r=0;r{if("%%"===r)return r;o++;const a=i.formatters[n];if("function"==typeof a){const i=e[o];r=a.call(t,i),e.splice(o,1),o--}return r}),i.formatArgs.call(t,e);(t.log||i.log).apply(t,e)}return s.namespace=e,s.enabled=i.enabled(e),s.useColors=i.useColors(),s.color=t(e),s.destroy=n,s.extend=a,"function"==typeof i.init&&i.init(s),i.instances.push(s),s}function n(){const e=i.instances.indexOf(this);return-1!==e&&(i.instances.splice(e,1),!0)}function a(e,t){const r=i(this.namespace+(void 0===t?":":t)+e);return r.log=this.log,r}function s(e){return e.toString().substring(2,e.toString().length-2).replace(/\.\*\?$/,"*")}return i.debug=i,i.default=i,i.coerce=function(e){if(e instanceof Error)return e.stack||e.message;return e},i.disable=function(){const e=[...i.names.map(s),...i.skips.map(s).map(e=>"-"+e)].join(",");return i.enable(""),e},i.enable=function(e){let t;i.save(e),i.names=[],i.skips=[];const r=("string"==typeof e?e:"").split(/[\s,]+/),n=r.length;for(t=0;t{i[t]=e[t]}),i.instances=[],i.names=[],i.skips=[],i.formatters={},i.selectColor=t,i.enable(i.load()),i}},function(e,t){var r=1e3,i=6e4,n=60*i,a=24*n;function s(e,t,r,i){var n=t>=1.5*r;return Math.round(e/r)+" "+i+(n?"s":"")}e.exports=function(e,t){t=t||{};var o=typeof e;if("string"===o&&e.length>0)return function(e){if((e=String(e)).length>100)return;var t=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(!t)return;var s=parseFloat(t[1]);switch((t[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return 315576e5*s;case"weeks":case"week":case"w":return 6048e5*s;case"days":case"day":case"d":return s*a;case"hours":case"hour":case"hrs":case"hr":case"h":return s*n;case"minutes":case"minute":case"mins":case"min":case"m":return s*i;case"seconds":case"second":case"secs":case"sec":case"s":return s*r;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return s;default:return}}(e);if("number"===o&&isFinite(e))return t.long?function(e){var t=Math.abs(e);if(t>=a)return s(e,t,a,"day");if(t>=n)return s(e,t,n,"hour");if(t>=i)return s(e,t,i,"minute");if(t>=r)return s(e,t,r,"second");return e+" ms"}(e):function(e){var t=Math.abs(e);if(t>=a)return Math.round(e/a)+"d";if(t>=n)return Math.round(e/n)+"h";if(t>=i)return Math.round(e/i)+"m";if(t>=r)return Math.round(e/r)+"s";return e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},function(e,t,r){"use strict";(function(e){Object.defineProperty(t,"__esModule",{value:!0});const i=r(207),n=r(23),a=r(212)("strtok3:ReadStreamTokenizer");class s extends i.AbstractTokenizer{constructor(e,t){super(),this.streamReader=new n.StreamReader(e),this.fileSize=t}async readBuffer(e,t=0,r=e.length,i,a){if(0===r)return 0;if(i){const n=i-this.position;if(n>0)return await this.ignore(i-this.position),this.readBuffer(e,t,r);if(n<0)throw new Error("Cannot read from a negative offset in a stream")}const s=await this.streamReader.read(e,t,r);if(this.position+=s,!a&&s0){const a=e.alloc(i+n);return o=await this.peekBuffer(a,0,n+i,void 0,s),a.copy(t,r,n),o-n}if(n<0)throw new Error("Cannot peek from a negative offset in a stream")}if(o=await this.streamReader.peek(t,r,i),!s&&o0?t.windowBits=-t.windowBits:t.gzip&&t.windowBits>0&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new o,this.strm.avail_out=0;var r=i.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(0!==r)throw new Error(s[r]);if(t.header&&i.deflateSetHeader(this.strm,t.header),t.dictionary){var h;if(h="string"==typeof t.dictionary?a.string2buf(t.dictionary):"[object ArrayBuffer]"===u.call(t.dictionary)?new Uint8Array(t.dictionary):t.dictionary,0!==(r=i.deflateSetDictionary(this.strm,h)))throw new Error(s[r]);this._dict_set=!0}}function h(e,t){var r=new l(t);if(r.push(e,!0),r.err)throw r.msg||s[r.err];return r.result}l.prototype.push=function(e,t){var r,s,o=this.strm,l=this.options.chunkSize;if(this.ended)return!1;s=t===~~t?t:!0===t?4:0,"string"==typeof e?o.input=a.string2buf(e):"[object ArrayBuffer]"===u.call(e)?o.input=new Uint8Array(e):o.input=e,o.next_in=0,o.avail_in=o.input.length;do{if(0===o.avail_out&&(o.output=new n.Buf8(l),o.next_out=0,o.avail_out=l),1!==(r=i.deflate(o,s))&&0!==r)return this.onEnd(r),this.ended=!0,!1;0!==o.avail_out&&(0!==o.avail_in||4!==s&&2!==s)||("string"===this.options.to?this.onData(a.buf2binstring(n.shrinkBuf(o.output,o.next_out))):this.onData(n.shrinkBuf(o.output,o.next_out)))}while((o.avail_in>0||0===o.avail_out)&&1!==r);return 4===s?(r=i.deflateEnd(this.strm),this.onEnd(r),this.ended=!0,0===r):2!==s||(this.onEnd(0),o.avail_out=0,!0)},l.prototype.onData=function(e){this.chunks.push(e)},l.prototype.onEnd=function(e){0===e&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=n.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},r.Deflate=l,r.deflate=h,r.deflateRaw=function(e,t){return(t=t||{}).raw=!0,h(e,t)},r.gzip=function(e,t){return(t=t||{}).gzip=!0,h(e,t)}},{"./utils/common":89,"./utils/strings":90,"./zlib/deflate":94,"./zlib/messages":99,"./zlib/zstream":101}],88:[function(e,t,r){"use strict";var i=e("./zlib/inflate"),n=e("./utils/common"),a=e("./utils/strings"),s=e("./zlib/constants"),o=e("./zlib/messages"),u=e("./zlib/zstream"),l=e("./zlib/gzheader"),h=Object.prototype.toString;function c(e){if(!(this instanceof c))return new c(e);this.options=n.assign({chunkSize:16384,windowBits:0,to:""},e||{});var t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,0===t.windowBits&&(t.windowBits=-15)),!(t.windowBits>=0&&t.windowBits<16)||e&&e.windowBits||(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&0==(15&t.windowBits)&&(t.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new u,this.strm.avail_out=0;var r=i.inflateInit2(this.strm,t.windowBits);if(r!==s.Z_OK)throw new Error(o[r]);this.header=new l,i.inflateGetHeader(this.strm,this.header)}function f(e,t){var r=new c(t);if(r.push(e,!0),r.err)throw r.msg||o[r.err];return r.result}c.prototype.push=function(e,t){var r,o,u,l,c,f,d=this.strm,p=this.options.chunkSize,m=this.options.dictionary,g=!1;if(this.ended)return!1;o=t===~~t?t:!0===t?s.Z_FINISH:s.Z_NO_FLUSH,"string"==typeof e?d.input=a.binstring2buf(e):"[object ArrayBuffer]"===h.call(e)?d.input=new Uint8Array(e):d.input=e,d.next_in=0,d.avail_in=d.input.length;do{if(0===d.avail_out&&(d.output=new n.Buf8(p),d.next_out=0,d.avail_out=p),(r=i.inflate(d,s.Z_NO_FLUSH))===s.Z_NEED_DICT&&m&&(f="string"==typeof m?a.string2buf(m):"[object ArrayBuffer]"===h.call(m)?new Uint8Array(m):m,r=i.inflateSetDictionary(this.strm,f)),r===s.Z_BUF_ERROR&&!0===g&&(r=s.Z_OK,g=!1),r!==s.Z_STREAM_END&&r!==s.Z_OK)return this.onEnd(r),this.ended=!0,!1;d.next_out&&(0!==d.avail_out&&r!==s.Z_STREAM_END&&(0!==d.avail_in||o!==s.Z_FINISH&&o!==s.Z_SYNC_FLUSH)||("string"===this.options.to?(u=a.utf8border(d.output,d.next_out),l=d.next_out-u,c=a.buf2string(d.output,u),d.next_out=l,d.avail_out=p-l,l&&n.arraySet(d.output,d.output,u,l,0),this.onData(c)):this.onData(n.shrinkBuf(d.output,d.next_out)))),0===d.avail_in&&0===d.avail_out&&(g=!0)}while((d.avail_in>0||0===d.avail_out)&&r!==s.Z_STREAM_END);return r===s.Z_STREAM_END&&(o=s.Z_FINISH),o===s.Z_FINISH?(r=i.inflateEnd(this.strm),this.onEnd(r),this.ended=!0,r===s.Z_OK):o!==s.Z_SYNC_FLUSH||(this.onEnd(s.Z_OK),d.avail_out=0,!0)},c.prototype.onData=function(e){this.chunks.push(e)},c.prototype.onEnd=function(e){e===s.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=n.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},r.Inflate=c,r.inflate=f,r.inflateRaw=function(e,t){return(t=t||{}).raw=!0,f(e,t)},r.ungzip=f},{"./utils/common":89,"./utils/strings":90,"./zlib/constants":92,"./zlib/gzheader":95,"./zlib/inflate":97,"./zlib/messages":99,"./zlib/zstream":101}],89:[function(e,t,r){arguments[4][36][0].apply(r,arguments)},{dup:36}],90:[function(e,t,r){"use strict";var i=e("./common"),n=!0,a=!0;try{String.fromCharCode.apply(null,[0])}catch(e){n=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(e){a=!1}for(var s=new i.Buf8(256),o=0;o<256;o++)s[o]=o>=252?6:o>=248?5:o>=240?4:o>=224?3:o>=192?2:1;function u(e,t){if(t<65537&&(e.subarray&&a||!e.subarray&&n))return String.fromCharCode.apply(null,i.shrinkBuf(e,t));for(var r="",s=0;s>>6,t[s++]=128|63&r):r<65536?(t[s++]=224|r>>>12,t[s++]=128|r>>>6&63,t[s++]=128|63&r):(t[s++]=240|r>>>18,t[s++]=128|r>>>12&63,t[s++]=128|r>>>6&63,t[s++]=128|63&r);return t},r.buf2binstring=function(e){return u(e,e.length)},r.binstring2buf=function(e){for(var t=new i.Buf8(e.length),r=0,n=t.length;r4)l[i++]=65533,r+=a-1;else{for(n&=2===a?31:3===a?15:7;a>1&&r1?l[i++]=65533:n<65536?l[i++]=n:(n-=65536,l[i++]=55296|n>>10&1023,l[i++]=56320|1023&n)}return u(l,i)},r.utf8border=function(e,t){var r;for((t=t||e.length)>e.length&&(t=e.length),r=t-1;r>=0&&128==(192&e[r]);)r--;return r<0||0===r?t:r+s[e[r]]>t?r:t}},{"./common":89}],91:[function(e,t,r){arguments[4][37][0].apply(r,arguments)},{dup:37}],92:[function(e,t,r){arguments[4][38][0].apply(r,arguments)},{dup:38}],93:[function(e,t,r){arguments[4][39][0].apply(r,arguments)},{dup:39}],94:[function(e,t,r){"use strict";var i,n=e("../utils/common"),a=e("./trees"),s=e("./adler32"),o=e("./crc32"),u=e("./messages");function l(e,t){return e.msg=u[t],t}function h(e){return(e<<1)-(e>4?9:0)}function c(e){for(var t=e.length;--t>=0;)e[t]=0}function f(e){var t=e.state,r=t.pending;r>e.avail_out&&(r=e.avail_out),0!==r&&(n.arraySet(e.output,t.pending_buf,t.pending_out,r,e.next_out),e.next_out+=r,t.pending_out+=r,e.total_out+=r,e.avail_out-=r,t.pending-=r,0===t.pending&&(t.pending_out=0))}function d(e,t){a._tr_flush_block(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,f(e.strm)}function p(e,t){e.pending_buf[e.pending++]=t}function m(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function g(e,t){var r,i,n=e.max_chain_length,a=e.strstart,s=e.prev_length,o=e.nice_match,u=e.strstart>e.w_size-262?e.strstart-(e.w_size-262):0,l=e.window,h=e.w_mask,c=e.prev,f=e.strstart+258,d=l[a+s-1],p=l[a+s];e.prev_length>=e.good_match&&(n>>=2),o>e.lookahead&&(o=e.lookahead);do{if(l[(r=t)+s]===p&&l[r+s-1]===d&&l[r]===l[a]&&l[++r]===l[a+1]){a+=2,r++;do{}while(l[++a]===l[++r]&&l[++a]===l[++r]&&l[++a]===l[++r]&&l[++a]===l[++r]&&l[++a]===l[++r]&&l[++a]===l[++r]&&l[++a]===l[++r]&&l[++a]===l[++r]&&as){if(e.match_start=t,s=i,i>=o)break;d=l[a+s-1],p=l[a+s]}}}while((t=c[t&h])>u&&0!=--n);return s<=e.lookahead?s:e.lookahead}function b(e){var t,r,i,a,u,l,h,c,f,d,p=e.w_size;do{if(a=e.window_size-e.lookahead-e.strstart,e.strstart>=p+(p-262)){n.arraySet(e.window,e.window,p,p,0),e.match_start-=p,e.strstart-=p,e.block_start-=p,t=r=e.hash_size;do{i=e.head[--t],e.head[t]=i>=p?i-p:0}while(--r);t=r=p;do{i=e.prev[--t],e.prev[t]=i>=p?i-p:0}while(--r);a+=p}if(0===e.strm.avail_in)break;if(l=e.strm,h=e.window,c=e.strstart+e.lookahead,f=a,d=void 0,(d=l.avail_in)>f&&(d=f),r=0===d?0:(l.avail_in-=d,n.arraySet(h,l.input,l.next_in,d,c),1===l.state.wrap?l.adler=s(l.adler,h,d,c):2===l.state.wrap&&(l.adler=o(l.adler,h,d,c)),l.next_in+=d,l.total_in+=d,d),e.lookahead+=r,e.lookahead+e.insert>=3)for(u=e.strstart-e.insert,e.ins_h=e.window[u],e.ins_h=(e.ins_h<=3&&(e.ins_h=(e.ins_h<=3)if(i=a._tr_tally(e,e.strstart-e.match_start,e.match_length-3),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=3){e.match_length--;do{e.strstart++,e.ins_h=(e.ins_h<=3&&(e.ins_h=(e.ins_h<4096)&&(e.match_length=2)),e.prev_length>=3&&e.match_length<=e.prev_length){n=e.strstart+e.lookahead-3,i=a._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-3),e.lookahead-=e.prev_length-1,e.prev_length-=2;do{++e.strstart<=n&&(e.ins_h=(e.ins_h<15&&(o=2,i-=16),a<1||a>9||8!==r||i<8||i>15||t<0||t>9||s<0||s>4)return l(e,-2);8===i&&(i=9);var u=new w;return e.state=u,u.strm=e,u.wrap=o,u.gzhead=null,u.w_bits=i,u.w_size=1<e.pending_buf_size-5&&(r=e.pending_buf_size-5);;){if(e.lookahead<=1){if(b(e),0===e.lookahead&&0===t)return 1;if(0===e.lookahead)break}e.strstart+=e.lookahead,e.lookahead=0;var i=e.block_start+r;if((0===e.strstart||e.strstart>=i)&&(e.lookahead=e.strstart-i,e.strstart=i,d(e,!1),0===e.strm.avail_out))return 1;if(e.strstart-e.block_start>=e.w_size-262&&(d(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(d(e,!0),0===e.strm.avail_out?3:4):(e.strstart>e.block_start&&(d(e,!1),e.strm.avail_out),1)})),new v(4,4,8,4,y),new v(4,5,16,8,y),new v(4,6,32,32,y),new v(4,4,16,16,_),new v(8,16,32,32,_),new v(8,16,128,128,_),new v(8,32,128,256,_),new v(32,128,258,1024,_),new v(32,258,258,4096,_)],r.deflateInit=function(e,t){return T(e,t,8,15,8,0)},r.deflateInit2=T,r.deflateReset=k,r.deflateResetKeep=E,r.deflateSetHeader=function(e,t){return e&&e.state?2!==e.state.wrap?-2:(e.state.gzhead=t,0):-2},r.deflate=function(e,t){var r,n,s,u;if(!e||!e.state||t>5||t<0)return e?l(e,-2):-2;if(n=e.state,!e.output||!e.input&&0!==e.avail_in||666===n.status&&4!==t)return l(e,0===e.avail_out?-5:-2);if(n.strm=e,r=n.last_flush,n.last_flush=t,42===n.status)if(2===n.wrap)e.adler=0,p(n,31),p(n,139),p(n,8),n.gzhead?(p(n,(n.gzhead.text?1:0)+(n.gzhead.hcrc?2:0)+(n.gzhead.extra?4:0)+(n.gzhead.name?8:0)+(n.gzhead.comment?16:0)),p(n,255&n.gzhead.time),p(n,n.gzhead.time>>8&255),p(n,n.gzhead.time>>16&255),p(n,n.gzhead.time>>24&255),p(n,9===n.level?2:n.strategy>=2||n.level<2?4:0),p(n,255&n.gzhead.os),n.gzhead.extra&&n.gzhead.extra.length&&(p(n,255&n.gzhead.extra.length),p(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=o(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=69):(p(n,0),p(n,0),p(n,0),p(n,0),p(n,0),p(n,9===n.level?2:n.strategy>=2||n.level<2?4:0),p(n,3),n.status=113);else{var g=8+(n.w_bits-8<<4)<<8;g|=(n.strategy>=2||n.level<2?0:n.level<6?1:6===n.level?2:3)<<6,0!==n.strstart&&(g|=32),g+=31-g%31,n.status=113,m(n,g),0!==n.strstart&&(m(n,e.adler>>>16),m(n,65535&e.adler)),e.adler=1}if(69===n.status)if(n.gzhead.extra){for(s=n.pending;n.gzindex<(65535&n.gzhead.extra.length)&&(n.pending!==n.pending_buf_size||(n.gzhead.hcrc&&n.pending>s&&(e.adler=o(e.adler,n.pending_buf,n.pending-s,s)),f(e),s=n.pending,n.pending!==n.pending_buf_size));)p(n,255&n.gzhead.extra[n.gzindex]),n.gzindex++;n.gzhead.hcrc&&n.pending>s&&(e.adler=o(e.adler,n.pending_buf,n.pending-s,s)),n.gzindex===n.gzhead.extra.length&&(n.gzindex=0,n.status=73)}else n.status=73;if(73===n.status)if(n.gzhead.name){s=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>s&&(e.adler=o(e.adler,n.pending_buf,n.pending-s,s)),f(e),s=n.pending,n.pending===n.pending_buf_size)){u=1;break}u=n.gzindexs&&(e.adler=o(e.adler,n.pending_buf,n.pending-s,s)),0===u&&(n.gzindex=0,n.status=91)}else n.status=91;if(91===n.status)if(n.gzhead.comment){s=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>s&&(e.adler=o(e.adler,n.pending_buf,n.pending-s,s)),f(e),s=n.pending,n.pending===n.pending_buf_size)){u=1;break}u=n.gzindexs&&(e.adler=o(e.adler,n.pending_buf,n.pending-s,s)),0===u&&(n.status=103)}else n.status=103;if(103===n.status&&(n.gzhead.hcrc?(n.pending+2>n.pending_buf_size&&f(e),n.pending+2<=n.pending_buf_size&&(p(n,255&e.adler),p(n,e.adler>>8&255),e.adler=0,n.status=113)):n.status=113),0!==n.pending){if(f(e),0===e.avail_out)return n.last_flush=-1,0}else if(0===e.avail_in&&h(t)<=h(r)&&4!==t)return l(e,-5);if(666===n.status&&0!==e.avail_in)return l(e,-5);if(0!==e.avail_in||0!==n.lookahead||0!==t&&666!==n.status){var y=2===n.strategy?function(e,t){for(var r;;){if(0===e.lookahead&&(b(e),0===e.lookahead)){if(0===t)return 1;break}if(e.match_length=0,r=a._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,r&&(d(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(d(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(d(e,!1),0===e.strm.avail_out)?1:2}(n,t):3===n.strategy?function(e,t){for(var r,i,n,s,o=e.window;;){if(e.lookahead<=258){if(b(e),e.lookahead<=258&&0===t)return 1;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=3&&e.strstart>0&&(i=o[n=e.strstart-1])===o[++n]&&i===o[++n]&&i===o[++n]){s=e.strstart+258;do{}while(i===o[++n]&&i===o[++n]&&i===o[++n]&&i===o[++n]&&i===o[++n]&&i===o[++n]&&i===o[++n]&&i===o[++n]&&ne.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=3?(r=a._tr_tally(e,1,e.match_length-3),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(r=a._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),r&&(d(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(d(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(d(e,!1),0===e.strm.avail_out)?1:2}(n,t):i[n.level].func(n,t);if(3!==y&&4!==y||(n.status=666),1===y||3===y)return 0===e.avail_out&&(n.last_flush=-1),0;if(2===y&&(1===t?a._tr_align(n):5!==t&&(a._tr_stored_block(n,0,0,!1),3===t&&(c(n.head),0===n.lookahead&&(n.strstart=0,n.block_start=0,n.insert=0))),f(e),0===e.avail_out))return n.last_flush=-1,0}return 4!==t?0:n.wrap<=0?1:(2===n.wrap?(p(n,255&e.adler),p(n,e.adler>>8&255),p(n,e.adler>>16&255),p(n,e.adler>>24&255),p(n,255&e.total_in),p(n,e.total_in>>8&255),p(n,e.total_in>>16&255),p(n,e.total_in>>24&255)):(m(n,e.adler>>>16),m(n,65535&e.adler)),f(e),n.wrap>0&&(n.wrap=-n.wrap),0!==n.pending?0:1)},r.deflateEnd=function(e){var t;return e&&e.state?42!==(t=e.state.status)&&69!==t&&73!==t&&91!==t&&103!==t&&113!==t&&666!==t?l(e,-2):(e.state=null,113===t?l(e,-3):0):-2},r.deflateSetDictionary=function(e,t){var r,i,a,o,u,l,h,f,d=t.length;if(!e||!e.state)return-2;if(2===(o=(r=e.state).wrap)||1===o&&42!==r.status||r.lookahead)return-2;for(1===o&&(e.adler=s(e.adler,t,d,0)),r.wrap=0,d>=r.w_size&&(0===o&&(c(r.head),r.strstart=0,r.block_start=0,r.insert=0),f=new n.Buf8(r.w_size),n.arraySet(f,t,d-r.w_size,r.w_size,0),t=f,d=r.w_size),u=e.avail_in,l=e.next_in,h=e.input,e.avail_in=d,e.next_in=0,e.input=t,b(r);r.lookahead>=3;){i=r.strstart,a=r.lookahead-2;do{r.ins_h=(r.ins_h<=0;)e[t]=0}var a=[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],s=[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],o=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],u=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],l=new Array(576);n(l);var h=new Array(60);n(h);var c=new Array(512);n(c);var f=new Array(256);n(f);var d=new Array(29);n(d);var p,m,g,b=new Array(30);function y(e,t,r,i,n){this.static_tree=e,this.extra_bits=t,this.extra_base=r,this.elems=i,this.max_length=n,this.has_stree=e&&e.length}function _(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}function v(e){return e<256?c[e]:c[256+(e>>>7)]}function w(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function E(e,t,r){e.bi_valid>16-r?(e.bi_buf|=t<>16-e.bi_valid,e.bi_valid+=r-16):(e.bi_buf|=t<>>=1,r<<=1}while(--t>0);return r>>>1}function S(e,t,r){var i,n,a=new Array(16),s=0;for(i=1;i<=15;i++)a[i]=s=s+r[i-1]<<1;for(n=0;n<=t;n++){var o=e[2*n+1];0!==o&&(e[2*n]=T(a[o]++,o))}}function x(e){var t;for(t=0;t<286;t++)e.dyn_ltree[2*t]=0;for(t=0;t<30;t++)e.dyn_dtree[2*t]=0;for(t=0;t<19;t++)e.bl_tree[2*t]=0;e.dyn_ltree[512]=1,e.opt_len=e.static_len=0,e.last_lit=e.matches=0}function I(e){e.bi_valid>8?w(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0}function C(e,t,r,i){var n=2*t,a=2*r;return e[n]>1;r>=1;r--)A(e,a,r);n=u;do{r=e.heap[1],e.heap[1]=e.heap[e.heap_len--],A(e,a,1),i=e.heap[1],e.heap[--e.heap_max]=r,e.heap[--e.heap_max]=i,a[2*n]=a[2*r]+a[2*i],e.depth[n]=(e.depth[r]>=e.depth[i]?e.depth[r]:e.depth[i])+1,a[2*r+1]=a[2*i+1]=n,e.heap[1]=n++,A(e,a,1)}while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],function(e,t){var r,i,n,a,s,o,u=t.dyn_tree,l=t.max_code,h=t.stat_desc.static_tree,c=t.stat_desc.has_stree,f=t.stat_desc.extra_bits,d=t.stat_desc.extra_base,p=t.stat_desc.max_length,m=0;for(a=0;a<=15;a++)e.bl_count[a]=0;for(u[2*e.heap[e.heap_max]+1]=0,r=e.heap_max+1;r<573;r++)(a=u[2*u[2*(i=e.heap[r])+1]+1]+1)>p&&(a=p,m++),u[2*i+1]=a,i>l||(e.bl_count[a]++,s=0,i>=d&&(s=f[i-d]),o=u[2*i],e.opt_len+=o*(a+s),c&&(e.static_len+=o*(h[2*i+1]+s)));if(0!==m){do{for(a=p-1;0===e.bl_count[a];)a--;e.bl_count[a]--,e.bl_count[a+1]+=2,e.bl_count[p]--,m-=2}while(m>0);for(a=p;0!==a;a--)for(i=e.bl_count[a];0!==i;)(n=e.heap[--r])>l||(u[2*n+1]!==a&&(e.opt_len+=(a-u[2*n+1])*u[2*n],u[2*n+1]=a),i--)}}(e,t),S(a,l,e.bl_count)}function R(e,t,r){var i,n,a=-1,s=t[1],o=0,u=7,l=4;for(0===s&&(u=138,l=3),t[2*(r+1)+1]=65535,i=0;i<=r;i++)n=s,s=t[2*(i+1)+1],++o>=7;i<30;i++)for(b[i]=n<<7,e=0;e<1<0?(2===e.strm.data_type&&(e.strm.data_type=function(e){var t,r=4093624447;for(t=0;t<=31;t++,r>>>=1)if(1&r&&0!==e.dyn_ltree[2*t])return 0;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return 1;for(t=32;t<256;t++)if(0!==e.dyn_ltree[2*t])return 1;return 0}(e)),P(e,e.l_desc),P(e,e.d_desc),s=function(e){var t;for(R(e,e.dyn_ltree,e.l_desc.max_code),R(e,e.dyn_dtree,e.d_desc.max_code),P(e,e.bl_desc),t=18;t>=3&&0===e.bl_tree[2*u[t]+1];t--);return e.opt_len+=3*(t+1)+5+5+4,t}(e),n=e.opt_len+3+7>>>3,(a=e.static_len+3+7>>>3)<=n&&(n=a)):n=a=r+5,r+4<=n&&-1!==t?D(e,t,r,i):4===e.strategy||a===n?(E(e,2+(i?1:0),3),M(e,l,h)):(E(e,4+(i?1:0),3),function(e,t,r,i){var n;for(E(e,t-257,5),E(e,r-1,5),E(e,i-4,4),n=0;n>>8&255,e.pending_buf[e.d_buf+2*e.last_lit+1]=255&t,e.pending_buf[e.l_buf+e.last_lit]=255&r,e.last_lit++,0===t?e.dyn_ltree[2*r]++:(e.matches++,t--,e.dyn_ltree[2*(f[r]+256+1)]++,e.dyn_dtree[2*v(t)]++),e.last_lit===e.lit_bufsize-1},r._tr_align=function(e){E(e,2,3),k(e,256,l),function(e){16===e.bi_valid?(w(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):e.bi_valid>=8&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)}(e)}},{"../utils/common":89}],101:[function(e,t,r){arguments[4][46][0].apply(r,arguments)},{dup:46}],102:[function(e,t,r){function i(e,t){if(!(e=e.replace(/\t+/g," ").trim()))return null;var r=e.indexOf(" ");if(-1===r)throw new Error("no named row at line "+t);var i=e.substring(0,r);e=(e=(e=(e=e.substring(r+1)).replace(/letter=[\'\"]\S+[\'\"]/gi,"")).split("=")).map((function(e){return e.trim().match(/(".*?"|[^"\s]+)+(?=\s*|\s*$)/g)}));for(var a=[],s=0;st.length-1)return 0;var i=t.readUInt8(r++),n=t.readInt32LE(r);switch(r+=4,i){case 1:e.info=function(e,t){var r={};r.size=e.readInt16LE(t);var i=e.readUInt8(t+2);return r.smooth=i>>7&1,r.unicode=i>>6&1,r.italic=i>>5&1,r.bold=i>>4&1,i>>3&1&&(r.fixedHeight=1),r.charset=e.readUInt8(t+3)||"",r.stretchH=e.readUInt16LE(t+4),r.aa=e.readUInt8(t+6),r.padding=[e.readInt8(t+7),e.readInt8(t+8),e.readInt8(t+9),e.readInt8(t+10)],r.spacing=[e.readInt8(t+11),e.readInt8(t+12)],r.outline=e.readUInt8(t+13),r.face=function(e,t){return a(e,t).toString("utf8")}(e,t+14),r}(t,r);break;case 2:e.common=function(e,t){var r={};return r.lineHeight=e.readUInt16LE(t),r.base=e.readUInt16LE(t+2),r.scaleW=e.readUInt16LE(t+4),r.scaleH=e.readUInt16LE(t+6),r.pages=e.readUInt16LE(t+8),e.readUInt8(t+10),r.packed=0,r.alphaChnl=e.readUInt8(t+11),r.redChnl=e.readUInt8(t+12),r.greenChnl=e.readUInt8(t+13),r.blueChnl=e.readUInt8(t+14),r}(t,r);break;case 3:e.pages=function(e,t,r){for(var i=[],n=a(e,t),s=n.length+1,o=r/s,u=0;u3)throw new Error("Only supports BMFont Binary v3 (BMFont App v1.10)");for(var r={kernings:[],chars:[]},a=0;a<5;a++)t+=n(r,e,t);return r}},{}],104:[function(e,t,r){var i=e("./parse-attribs"),n=e("xml-parse-from-string"),a={scaleh:"scaleH",scalew:"scaleW",stretchh:"stretchH",lineheight:"lineHeight",alphachnl:"alphaChnl",redchnl:"redChnl",greenchnl:"greenChnl",bluechnl:"blueChnl"};function s(e){return function(e){for(var t=[],r=0;r element");for(var o=a.getElementsByTagName("page"),u=0;u=0;i--){var n=e[i];"."===n?e.splice(i,1):".."===n?(e.splice(i,1),r++):r&&(e.splice(i,1),r--)}if(t)for(;r--;r)e.unshift("..");return e}function i(e,t){if(e.filter)return e.filter(t);for(var r=[],i=0;i=-1&&!n;a--){var s=a>=0?arguments[a]:e.cwd();if("string"!=typeof s)throw new TypeError("Arguments to path.resolve must be strings");s&&(r=s+"/"+r,n="/"===s.charAt(0))}return(n?"/":"")+(r=t(i(r.split("/"),(function(e){return!!e})),!n).join("/"))||"."},r.normalize=function(e){var a=r.isAbsolute(e),s="/"===n(e,-1);return(e=t(i(e.split("/"),(function(e){return!!e})),!a).join("/"))||a||(e="."),e&&s&&(e+="/"),(a?"/":"")+e},r.isAbsolute=function(e){return"/"===e.charAt(0)},r.join=function(){var e=Array.prototype.slice.call(arguments,0);return r.normalize(i(e,(function(e,t){if("string"!=typeof e)throw new TypeError("Arguments to path.join must be strings");return e})).join("/"))},r.relative=function(e,t){function i(e){for(var t=0;t=0&&""===e[r];r--);return t>r?[]:e.slice(t,r-t+1)}e=r.resolve(e).substr(1),t=r.resolve(t).substr(1);for(var n=i(e.split("/")),a=i(t.split("/")),s=Math.min(n.length,a.length),o=s,u=0;u=1;--a)if(47===(t=e.charCodeAt(a))){if(!n){i=a;break}}else n=!1;return-1===i?r?"/":".":r&&1===i?"/":e.slice(0,i)},r.basename=function(e,t){var r=function(e){"string"!=typeof e&&(e+="");var t,r=0,i=-1,n=!0;for(t=e.length-1;t>=0;--t)if(47===e.charCodeAt(t)){if(!n){r=t+1;break}}else-1===i&&(n=!1,i=t+1);return-1===i?"":e.slice(r,i)}(e);return t&&r.substr(-1*t.length)===t&&(r=r.substr(0,r.length-t.length)),r},r.extname=function(e){"string"!=typeof e&&(e+="");for(var t=-1,r=0,i=-1,n=!0,a=0,s=e.length-1;s>=0;--s){var o=e.charCodeAt(s);if(47!==o)-1===i&&(n=!1,i=s+1),46===o?-1===t?t=s:1!==a&&(a=1):-1!==t&&(a=-1);else if(!n){r=s+1;break}}return-1===t||-1===i||0===a||1===a&&t===i-1&&t===r+1?"":e.slice(t,i)};var n="b"==="ab".substr(-1)?function(e,t,r){return e.substr(t,r)}:function(e,t,r){return t<0&&(t=e.length+t),e.substr(t,r)}}).call(this,e("_process"))},{_process:133}],108:[function(e,t,r){(function(r){"use strict";var i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n=e("http"),a=e("https"),s=e("url"),o=e("querystring"),u=e("zlib"),l=e("util"),h=function(e,t){if("string"!=typeof e&&!e.hasOwnProperty("url"))throw new Error("Missing url option from options for request method.");var l="object"===(void 0===e?"undefined":i(e))?s.parse(e.url):s.parse(e),h={hostname:l.hostname,port:l.port||("http:"===l.protocol.toLowerCase()?80:443),path:l.path,method:"GET",headers:{},auth:l.auth||null,parse:"none",stream:!1};if("object"===(void 0===e?"undefined":i(e))&&(h=Object.assign(h,e)),h.port=Number(h.port),h.hasOwnProperty("timeout")&&delete h.timeout,!0===h.compressed&&(h.headers["accept-encoding"]="gzip, deflate"),e.hasOwnProperty("form")){if("object"!==i(e.form))throw new Error("phin 'form' option must be of type Object if present.");var c=o.stringify(e.form);h.headers["Content-Type"]="application/x-www-form-urlencoded",h.headers["Content-Length"]=r.byteLength(c),e.data=c}var f=void 0,d=function(e){var i=e;!0===h.compressed&&("gzip"===e.headers["content-encoding"]?i=e.pipe(u.createGunzip()):"deflate"===e.headers["content-encoding"]&&(i=e.pipe(u.createInflate()))),!0===h.stream?(e.stream=i,t(null,e)):(e.body=new r([]),i.on("data",(function(t){e.body=r.concat([e.body,t])})),i.on("end",(function(){if(t){if("json"===h.parse)try{e.body=JSON.parse(e.body.toString())}catch(r){return void t("Invalid JSON received.",e)}t(null,e)}})))};switch(l.protocol.toLowerCase()){case"http:":f=n.request(h,d);break;case"https:":f=a.request(h,d);break;default:return void(t&&t(new Error("Invalid / unknown URL protocol. Expected HTTP or HTTPS."),null))}if("number"==typeof e.timeout&&f.setTimeout(e.timeout,(function(){f.abort(),t(new Error("Timeout has been reached."),null),t=null})),f.on("error",(function(e){t&&t(e,null)})),e.hasOwnProperty("data")){var p=e.data;if(!(e.data instanceof r)&&"object"===i(e.data))if("application/x-www-form-urlencoded"===(h.headers["content-type"]||h.headers["Content-Type"]))p=o.stringify(e.data);else try{p=JSON.stringify(e.data)}catch(e){t(new Error("Couldn't stringify object. (Likely due to a circular reference.)"),null)}f.write(p)}f.end()};h.promisified=function(e,t){return new Promise((function(t,r){h(e,(function(e,i){e?r(e):t(i)}))}))},l.promisify&&(h[l.promisify.custom]=h.promisified),t.exports=h}).call(this,e("buffer").Buffer)},{buffer:48,http:156,https:72,querystring:137,url:180,util:186,zlib:35}],109:[function(e,t,r){"use strict";function i(e,t,r,a,s,o){for(var u,l,h,c,f=Math.max(t-1,0),d=Math.max(r-1,0),p=Math.min(t+1,a-1),m=Math.min(r+1,s-1),g=4*(r*a+t),b=0,y=0,_=0,v=0,w=0,E=f;E<=p;E++)for(var k=d;k<=m;k++)if(E!==t||k!==r){var T=n(e,e,g,4*(k*a+E),!0);if(0===T?b++:T<0?_++:T>0&&y++,b>2)return!1;o&&(Tw&&(w=T,h=E,c=k))}return!o||0!==_&&0!==y&&(!i(e,u,l,a,s)&&!i(o,u,l,a,s)||!i(e,h,c,a,s)&&!i(o,h,c,a,s))}function n(e,t,r,i,n){var l=e[r+3]/255,h=t[i+3]/255,c=u(e[r+0],l),f=u(e[r+1],l),d=u(e[r+2],l),p=u(t[i+0],h),m=u(t[i+1],h),g=u(t[i+2],h),b=a(c,f,d)-a(p,m,g);if(n)return b;var y=s(c,f,d)-s(p,m,g),_=o(c,f,d)-o(p,m,g);return.5053*b*b+.299*y*y+.1957*_*_}function a(e,t,r){return.29889531*e+.58662247*t+.11448223*r}function s(e,t,r){return.59597799*e-.2741761*t-.32180189*r}function o(e,t,r){return.21147017*e-.52261711*t+.31114694*r}function u(e,t){return 255+(e-255)*t}function l(e,t,r,i,n){e[t+0]=r,e[t+1]=i,e[t+2]=n,e[t+3]=255}t.exports=function(e,t,r,s,o,h){h||(h={});for(var c=void 0===h.threshold?.1:h.threshold,f=35215*c*c,d=0,p=0;pf)h.includeAA||!i(e,m,p,s,o,t)&&!i(t,m,p,s,o,e)?(r&&l(r,g,255,0,0),d++):r&&l(r,g,255,255,0);else if(r){var b=u((v=void 0,v=(y=e)[(_=g)+3]/255,a(u(y[_+0],v),u(y[_+1],v),u(y[_+2],v))),.1);l(r,g,b,b,b)}}var y,_,v;return d}},{}],110:[function(e,t,r){(function(t){"use strict";var i=e("./interlace"),n={1:{0:0,1:0,2:0,3:255},2:{0:0,1:0,2:0,3:1},3:{0:0,1:1,2:2,3:255},4:{0:0,1:1,2:2,3:3}};function a(e,t,r,i,a,s){for(var o=e.width,u=e.height,l=e.index,h=0;h>4,r.push(c,h);break;case 2:u=3&f,l=f>>2&3,h=f>>4&3,c=f>>6&3,r.push(c,h,l,u);break;case 1:n=1&f,a=f>>1&1,s=f>>2&1,o=f>>3&1,u=f>>4&1,l=f>>5&1,h=f>>6&1,c=f>>7&1,r.push(c,h,l,u,o,s,a,n)}}return{get:function(e){for(;r.length0&&(this._paused=!1,this.emit("drain"))}.bind(this))},s.prototype.write=function(e,t){return this.writable?(r=i.isBuffer(e)?e:new i(e,t||this._encoding),this._buffers.push(r),this._buffered+=r.length,this._process(),this._reads&&0===this._reads.length&&(this._paused=!0),this.writable&&!this._paused):(this.emit("error",new Error("Stream not writable")),!1);var r},s.prototype.end=function(e,t){e&&this.write(e,t),this.writable=!1,this._buffers&&(0===this._buffers.length?this._end():(this._buffers.push(null),this._process()))},s.prototype.destroySoon=s.prototype.end,s.prototype._end=function(){this._reads.length>0&&this.emit("error",new Error("There are some read requests waiting on finished stream")),this.destroy()},s.prototype.destroy=function(){this._buffers&&(this.writable=!1,this._reads=null,this._buffers=null,this.emit("close"))},s.prototype._processReadAllowingLess=function(e){this._reads.shift();var t=this._buffers[0];t.length>e.length?(this._buffered-=e.length,this._buffers[0]=t.slice(e.length),e.func.call(this,t.slice(0,e.length))):(this._buffered-=t.length,this._buffers.shift(),e.func.call(this,t))},s.prototype._processRead=function(e){this._reads.shift();for(var t=0,r=0,n=new i(e.length);t0&&this._buffers.splice(0,r),this._buffered-=e.length,e.func.call(this,n)},s.prototype._process=function(){try{for(;this._buffered>0&&this._reads&&this._reads.length>0;){var e=this._reads[0];if(e.allowLess)this._processReadAllowingLess(e);else{if(!(this._buffered>=e.length))break;this._processRead(e)}}this._buffers&&this._buffers.length>0&&null===this._buffers[0]&&this._end()}catch(e){this.emit("error",e)}}}).call(this,e("_process"),e("buffer").Buffer)},{_process:133,buffer:48,stream:155,util:186}],113:[function(e,t,r){"use strict";t.exports={PNG_SIGNATURE:[137,80,78,71,13,10,26,10],TYPE_IHDR:1229472850,TYPE_IEND:1229278788,TYPE_IDAT:1229209940,TYPE_PLTE:1347179589,TYPE_tRNS:1951551059,TYPE_gAMA:1732332865,COLORTYPE_GRAYSCALE:0,COLORTYPE_PALETTE:1,COLORTYPE_COLOR:2,COLORTYPE_ALPHA:4,COLORTYPE_PALETTE_COLOR:3,COLORTYPE_COLOR_ALPHA:6,COLORTYPE_TO_BPP_MAP:{0:1,2:3,3:1,4:2,6:4},GAMMA_DIVISION:1e5}},{}],114:[function(e,t,r){"use strict";var i=[];!function(){for(var e=0;e<256;e++){for(var t=e,r=0;r<8;r++)1&t?t=3988292384^t>>>1:t>>>=1;i[e]=t}}();var n=t.exports=function(){this._crc=-1};n.prototype.write=function(e){for(var t=0;t>>8;return!0},n.prototype.crc32=function(){return-1^this._crc},n.crc32=function(e){for(var t=-1,r=0;r>>8;return-1^t}},{}],115:[function(e,t,r){(function(r){"use strict";var i=e("./paeth-predictor"),n={0:function(e,t,r,i,n){for(var a=0;a=a?e[t+s-a]:0,u=e[t+s]-o;i[n+s]=u}},2:function(e,t,r,i,n){for(var a=0;a0?e[t+a-r]:0,o=e[t+a]-s;i[n+a]=o}},3:function(e,t,r,i,n,a){for(var s=0;s=a?e[t+s-a]:0,u=t>0?e[t+s-r]:0,l=e[t+s]-(o+u>>1);i[n+s]=l}},4:function(e,t,r,n,a,s){for(var o=0;o=s?e[t+o-s]:0,l=t>0?e[t+o-r]:0,h=t>0&&o>=s?e[t+o-(r+s)]:0,c=e[t+o]-i(u,l,h);n[a+o]=c}}},a={0:function(e,t,r){for(var i=0,n=t+r,a=t;a=i?e[t+a-i]:0,o=e[t+a]-s;n+=Math.abs(o)}return n},2:function(e,t,r){for(var i=0,n=t+r,a=t;a0?e[a-r]:0,o=e[a]-s;i+=Math.abs(o)}return i},3:function(e,t,r,i){for(var n=0,a=0;a=i?e[t+a-i]:0,o=t>0?e[t+a-r]:0,u=e[t+a]-(s+o>>1);n+=Math.abs(u)}return n},4:function(e,t,r,n){for(var a=0,s=0;s=n?e[t+s-n]:0,u=t>0?e[t+s-r]:0,l=t>0&&s>=n?e[t+s-(r+n)]:0,h=e[t+s]-i(o,u,l);a+=Math.abs(h)}return a}};t.exports=function(e,t,i,s,o){var u;if("filterType"in s&&-1!==s.filterType){if("number"!=typeof s.filterType)throw new Error("unrecognised filter types");u=[s.filterType]}else u=[0,1,2,3,4];16===s.bitDepth&&(o*=2);for(var l=t*o,h=0,c=0,f=new r((l+1)*i),d=u[0],p=0;p1)for(var m=1/0,g=0;gn?t[a-i]:0;t[a]=s+o}},s.prototype._unFilterType2=function(e,t,r){for(var i=this._lastLine,n=0;nn?t[s-i]:0,h=Math.floor((l+u)/2);t[s]=o+h}},s.prototype._unFilterType4=function(e,t,r){for(var i=this._xComparison,a=i-1,s=this._lastLine,o=0;oa?t[o-i]:0,c=o>a&&s?s[o-i]:0,f=n(h,l,c);t[o]=u+f}},s.prototype._reverseFilterLine=function(e){var t,i=e[0],n=this._images[this._imageIndex],a=n.byteWidth;if(0===i)t=e.slice(1,a+1);else switch(t=new r(a),i){case 1:this._unFilterType1(e,t,a);break;case 2:this._unFilterType2(e,t,a);break;case 3:this._unFilterType3(e,t,a);break;case 4:this._unFilterType4(e,t,a);break;default:throw new Error("Unrecognised filter type - "+i)}this.write(t),n.lineIndex++,n.lineIndex>=n.height?(this._lastLine=null,this._imageIndex++,n=this._images[this._imageIndex]):this._lastLine=t,n?this.read(n.byteWidth+1,this._reverseFilterLine.bind(this)):(this._lastLine=null,this.complete())}}).call(this,e("buffer").Buffer)},{"./interlace":120,"./paeth-predictor":124,buffer:48}],119:[function(e,t,r){(function(e){"use strict";t.exports=function(t,r){var i=r.depth,n=r.width,a=r.height,s=r.colorType,o=r.transColor,u=r.palette,l=t;return 3===s?function(e,t,r,i,n){for(var a=0,s=0;s0&&c>0&&r.push({width:h,height:c,index:u})}return r},r.getInterlaceIterator=function(e){return function(t,r,n){var a=t%i[n].x.length,s=(t-a)/i[n].x.length*8+i[n].x[a],o=r%i[n].y.length;return 4*s+((r-o)/i[n].y.length*8+i[n].y[o])*e*4}}},{}],121:[function(e,t,r){(function(r){"use strict";var i=e("util"),n=e("stream"),a=e("./constants"),s=e("./packer"),o=t.exports=function(e){n.call(this);var t=e||{};this._packer=new s(t),this._deflate=this._packer.createDeflate(),this.readable=!0};i.inherits(o,n),o.prototype.pack=function(e,t,i,n){this.emit("data",new r(a.PNG_SIGNATURE)),this.emit("data",this._packer.packIHDR(t,i)),n&&this.emit("data",this._packer.packGAMA(n));var s=this._packer.filterData(e,t,i);this._deflate.on("error",this.emit.bind(this,"error")),this._deflate.on("data",function(e){this.emit("data",this._packer.packIDAT(e))}.bind(this)),this._deflate.on("end",function(){this.emit("data",this._packer.packIEND()),this.emit("end")}.bind(this)),this._deflate.end(s)}}).call(this,e("buffer").Buffer)},{"./constants":113,"./packer":123,buffer:48,stream:155,util:186}],122:[function(e,t,r){(function(r){"use strict";var i=!0,n=e("zlib");n.deflateSync||(i=!1);var a=e("./constants"),s=e("./packer");t.exports=function(e,t){if(!i)throw new Error("To use the sync capability of this library in old node versions, please pin pngjs to v2.3.0");var o=new s(t||{}),u=[];u.push(new r(a.PNG_SIGNATURE)),u.push(o.packIHDR(e.width,e.height)),e.gamma&&u.push(o.packGAMA(e.gamma));var l=o.filterData(e.data,e.width,e.height),h=n.deflateSync(l,o.getDeflateOptions());if(l=null,!h||!h.length)throw new Error("bad png - invalid compressed data response");return u.push(o.packIDAT(h)),u.push(o.packIEND()),r.concat(u)}}).call(this,e("buffer").Buffer)},{"./constants":113,"./packer":123,buffer:48,zlib:35}],123:[function(e,t,r){(function(r){"use strict";var i=e("./constants"),n=e("./crc"),a=e("./bitpacker"),s=e("./filter-pack"),o=e("zlib"),u=t.exports=function(e){if(this._options=e,e.deflateChunkSize=e.deflateChunkSize||32768,e.deflateLevel=null!=e.deflateLevel?e.deflateLevel:9,e.deflateStrategy=null!=e.deflateStrategy?e.deflateStrategy:3,e.inputHasAlpha=null==e.inputHasAlpha||e.inputHasAlpha,e.deflateFactory=e.deflateFactory||o.createDeflate,e.bitDepth=e.bitDepth||8,e.colorType="number"==typeof e.colorType?e.colorType:i.COLORTYPE_COLOR_ALPHA,e.inputColorType="number"==typeof e.inputColorType?e.inputColorType:i.COLORTYPE_COLOR_ALPHA,-1===[i.COLORTYPE_GRAYSCALE,i.COLORTYPE_COLOR,i.COLORTYPE_COLOR_ALPHA,i.COLORTYPE_ALPHA].indexOf(e.colorType))throw new Error("option color type:"+e.colorType+" is not supported at present");if(-1===[i.COLORTYPE_GRAYSCALE,i.COLORTYPE_COLOR,i.COLORTYPE_COLOR_ALPHA,i.COLORTYPE_ALPHA].indexOf(e.inputColorType))throw new Error("option input color type:"+e.inputColorType+" is not supported at present");if(8!==e.bitDepth&&16!==e.bitDepth)throw new Error("option bit depth:"+e.bitDepth+" is not supported at present")};u.prototype.getDeflateOptions=function(){return{chunkSize:this._options.deflateChunkSize,level:this._options.deflateLevel,strategy:this._options.deflateStrategy}},u.prototype.createDeflate=function(){return this._options.deflateFactory(this.getDeflateOptions())},u.prototype.filterData=function(e,t,r){var n=a(e,t,r,this._options),o=i.COLORTYPE_TO_BPP_MAP[this._options.colorType];return s(n,t,r,this._options,o)},u.prototype._packChunk=function(e,t){var i=t?t.length:0,a=new r(i+12);return a.writeUInt32BE(i,0),a.writeUInt32BE(e,4),t&&t.copy(a,8),a.writeInt32BE(n.crc32(a.slice(4,a.length-4)),a.length-4),a},u.prototype.packGAMA=function(e){var t=new r(4);return t.writeUInt32BE(Math.floor(e*i.GAMMA_DIVISION),0),this._packChunk(i.TYPE_gAMA,t)},u.prototype.packIHDR=function(e,t){var n=new r(13);return n.writeUInt32BE(e,0),n.writeUInt32BE(t,4),n[8]=this._options.bitDepth,n[9]=this._options.colorType,n[10]=0,n[11]=0,n[12]=0,this._packChunk(i.TYPE_IHDR,n)},u.prototype.packIDAT=function(e){return this._packChunk(i.TYPE_IDAT,e)},u.prototype.packIEND=function(){return this._packChunk(i.TYPE_IEND,null)}}).call(this,e("buffer").Buffer)},{"./bitpacker":111,"./constants":113,"./crc":114,"./filter-pack":115,buffer:48,zlib:35}],124:[function(e,t,r){"use strict";t.exports=function(e,t,r){var i=e+t-r,n=Math.abs(i-e),a=Math.abs(i-t),s=Math.abs(i-r);return n<=a&&n<=s?e:a<=s?t:r}},{}],125:[function(e,t,r){"use strict";var i=e("util"),n=e("zlib"),a=e("./chunkstream"),s=e("./filter-parse-async"),o=e("./parser"),u=e("./bitmapper"),l=e("./format-normaliser"),h=t.exports=function(e){a.call(this),this._parser=new o(e,{read:this.read.bind(this),error:this._handleError.bind(this),metadata:this._handleMetaData.bind(this),gamma:this.emit.bind(this,"gamma"),palette:this._handlePalette.bind(this),transColor:this._handleTransColor.bind(this),finished:this._finished.bind(this),inflateData:this._inflateData.bind(this)}),this._options=e,this.writable=!0,this._parser.start()};i.inherits(h,a),h.prototype._handleError=function(e){this.emit("error",e),this.writable=!1,this.destroy(),this._inflate&&this._inflate.destroy&&this._inflate.destroy(),this._filter&&(this._filter.destroy(),this._filter.on("error",(function(){}))),this.errord=!0},h.prototype._inflateData=function(e){if(!this._inflate)if(this._bitmapInfo.interlace)this._inflate=n.createInflate(),this._inflate.on("error",this.emit.bind(this,"error")),this._filter.on("complete",this._complete.bind(this)),this._inflate.pipe(this._filter);else{var t=(1+(this._bitmapInfo.width*this._bitmapInfo.bpp*this._bitmapInfo.depth+7>>3))*this._bitmapInfo.height,r=Math.max(t,n.Z_MIN_CHUNK);this._inflate=n.createInflate({chunkSize:r});var i=t,a=this.emit.bind(this,"error");this._inflate.on("error",(function(e){i&&a(e)})),this._filter.on("complete",this._complete.bind(this));var s=this._filter.write.bind(this._filter);this._inflate.on("data",(function(e){i&&(e.length>i&&(e=e.slice(0,i)),i-=e.length,s(e))})),this._inflate.on("end",this._filter.end.bind(this._filter))}this._inflate.write(e)},h.prototype._handleMetaData=function(e){this.emit("metadata",e),this._bitmapInfo=Object.create(e),this._filter=new s(this._bitmapInfo)},h.prototype._handleTransColor=function(e){this._bitmapInfo.transColor=e},h.prototype._handlePalette=function(e){this._bitmapInfo.palette=e},h.prototype._finished=function(){this.errord||(this._inflate?this._inflate.end():this.emit("error","No Inflate block"),this.destroySoon())},h.prototype._complete=function(e){if(!this.errord){try{var t=u.dataToBitMap(e,this._bitmapInfo),r=l(t,this._bitmapInfo);t=null}catch(e){return void this._handleError(e)}this.emit("parsed",r)}}},{"./bitmapper":110,"./chunkstream":112,"./filter-parse-async":116,"./format-normaliser":119,"./parser":127,util:186,zlib:35}],126:[function(e,t,r){(function(r){"use strict";var i=!0,n=e("zlib"),a=e("./sync-inflate");n.deflateSync||(i=!1);var s=e("./sync-reader"),o=e("./filter-parse-sync"),u=e("./parser"),l=e("./bitmapper"),h=e("./format-normaliser");t.exports=function(e,t){if(!i)throw new Error("To use the sync capability of this library in old node versions, please pin pngjs to v2.3.0");var c,f,d,p=[],m=new s(e);if(new u(t,{read:m.read.bind(m),error:function(e){c=e},metadata:function(e){f=e},gamma:function(e){d=e},palette:function(e){f.palette=e},transColor:function(e){f.transColor=e},inflateData:function(e){p.push(e)}}).start(),m.process(),c)throw c;var g,b=r.concat(p);if(p.length=0,f.interlace)g=n.inflateSync(b);else{var y=(1+(f.width*f.bpp*f.depth+7>>3))*f.height;g=a(b,{chunkSize:y,maxLength:y})}if(b=null,!g||!g.length)throw new Error("bad png - invalid inflate data response");var _=o.process(g,f);b=null;var v=l.dataToBitMap(_,f);_=null;var w=h(v,f);return f.data=w,f.gamma=d||0,f}}).call(this,e("buffer").Buffer)},{"./bitmapper":110,"./filter-parse-sync":117,"./format-normaliser":119,"./parser":127,"./sync-inflate":130,"./sync-reader":131,buffer:48,zlib:35}],127:[function(e,t,r){(function(r){"use strict";var i=e("./constants"),n=e("./crc"),a=t.exports=function(e,t){this._options=e,e.checkCRC=!1!==e.checkCRC,this._hasIHDR=!1,this._hasIEND=!1,this._palette=[],this._colorType=0,this._chunks={},this._chunks[i.TYPE_IHDR]=this._handleIHDR.bind(this),this._chunks[i.TYPE_IEND]=this._handleIEND.bind(this),this._chunks[i.TYPE_IDAT]=this._handleIDAT.bind(this),this._chunks[i.TYPE_PLTE]=this._handlePLTE.bind(this),this._chunks[i.TYPE_tRNS]=this._handleTRNS.bind(this),this._chunks[i.TYPE_gAMA]=this._handleGAMA.bind(this),this.read=t.read,this.error=t.error,this.metadata=t.metadata,this.gamma=t.gamma,this.transColor=t.transColor,this.palette=t.palette,this.parsed=t.parsed,this.inflateData=t.inflateData,this.finished=t.finished};a.prototype.start=function(){this.read(i.PNG_SIGNATURE.length,this._parseSignature.bind(this))},a.prototype._parseSignature=function(e){for(var t=i.PNG_SIGNATURE,r=0;rthis._palette.length)return void this.error(new Error("More transparent colors than palette size"));for(var t=0;t0?this._handleIDAT(r):this._handleChunkEnd()},a.prototype._handleIEND=function(e){this.read(e,this._parseIEND.bind(this))},a.prototype._parseIEND=function(e){this._crc.write(e),this._hasIEND=!0,this._handleChunkEnd(),this.finished&&this.finished()}}).call(this,e("buffer").Buffer)},{"./constants":113,"./crc":114,buffer:48}],128:[function(e,t,r){"use strict";var i=e("./parser-sync"),n=e("./packer-sync");r.read=function(e,t){return i(e,t||{})},r.write=function(e,t){return n(e,t)}},{"./packer-sync":122,"./parser-sync":126}],129:[function(e,t,r){(function(t,i){"use strict";var n=e("util"),a=e("stream"),s=e("./parser-async"),o=e("./packer-async"),u=e("./png-sync"),l=r.PNG=function(e){a.call(this),e=e||{},this.width=0|e.width,this.height=0|e.height,this.data=this.width>0&&this.height>0?new i(4*this.width*this.height):null,e.fill&&this.data&&this.data.fill(0),this.gamma=0,this.readable=this.writable=!0,this._parser=new s(e),this._parser.on("error",this.emit.bind(this,"error")),this._parser.on("close",this._handleClose.bind(this)),this._parser.on("metadata",this._metadata.bind(this)),this._parser.on("gamma",this._gamma.bind(this)),this._parser.on("parsed",function(e){this.data=e,this.emit("parsed",e)}.bind(this)),this._packer=new o(e),this._packer.on("data",this.emit.bind(this,"data")),this._packer.on("end",this.emit.bind(this,"end")),this._parser.on("close",this._handleClose.bind(this)),this._packer.on("error",this.emit.bind(this,"error"))};n.inherits(l,a),l.sync=u,l.prototype.pack=function(){return this.data&&this.data.length?(t.nextTick(function(){this._packer.pack(this.data,this.width,this.height,this.gamma)}.bind(this)),this):(this.emit("error","No data provided"),this)},l.prototype.parse=function(e,t){var r,i;return t&&(r=function(e){this.removeListener("error",i),this.data=e,t(null,this)}.bind(this),i=function(e){this.removeListener("parsed",r),t(e,null)}.bind(this),this.once("parsed",r),this.once("error",i)),this.end(e),this},l.prototype.write=function(e){return this._parser.write(e),!0},l.prototype.end=function(e){this._parser.end(e)},l.prototype._metadata=function(e){this.width=e.width,this.height=e.height,this.emit("metadata",e)},l.prototype._gamma=function(e){this.gamma=e},l.prototype._handleClose=function(){this._parser.writable||this._packer.readable||this.emit("close")},l.bitblt=function(e,t,r,i,n,a,s,o){if(i|=0,n|=0,a|=0,s|=0,o|=0,(r|=0)>e.width||i>e.height||r+n>e.width||i+a>e.height)throw new Error("bitblt reading outside image");if(s>t.width||o>t.height||s+n>t.width||o+a>t.height)throw new Error("bitblt writing outside image");for(var u=0;u=0,"have should not go down"),r>0){var i=o._buffer.slice(o._offset,o._offset+r);if(o._offset+=r,i.length>f&&(i=i.slice(0,f)),p.push(i),m+=i.length,0==(f-=i.length))return!1}return(0===t||o._offset>=o._chunkSize)&&(c=o._chunkSize,o._offset=0,o._buffer=n.allocUnsafe(o._chunkSize)),0===t&&(d+=l-e,l=e,!0)}}this.on("error",(function(e){i=e})),a(this._handle,"zlib binding closed");do{var b=this._handle.writeSync(t,e,d,l,this._buffer,this._offset,c);b=b||this._writeState}while(!this._hadError&&g(b[0],b[1]));if(this._hadError)throw i;if(m>=u)throw h(this),new RangeError("Cannot create final Buffer. It would be larger than 0x"+u.toString(16)+" bytes");var y=n.concat(p,m);return h(this),y},o.inherits(l,s.Inflate),t.exports=r=c,r.Inflate=l,r.createInflate=function(e){return new l(e)},r.inflateSync=c}).call(this,e("_process"),e("buffer").Buffer)},{_process:133,assert:25,buffer:48,util:186,zlib:35}],131:[function(e,t,r){"use strict";var i=t.exports=function(e){this._buffer=e,this._reads=[]};i.prototype.read=function(e,t){this._reads.push({length:Math.abs(e),allowLess:e<0,func:t})},i.prototype.process=function(){for(;this._reads.length>0&&this._buffer.length;){var e=this._reads[0];if(!this._buffer.length||!(this._buffer.length>=e.length||e.allowLess))break;this._reads.shift();var t=this._buffer;this._buffer=t.slice(e.length),e.func.call(this,t.slice(0,e.length))}return this._reads.length>0?new Error("There are some read requests waitng on finished stream"):this._buffer.length>0?new Error("unrecognised content at end of stream"):void 0}},{}],132:[function(e,t,r){(function(e){"use strict";void 0===e||!e.version||0===e.version.indexOf("v0.")||0===e.version.indexOf("v1.")&&0!==e.version.indexOf("v1.8.")?t.exports={nextTick:function(t,r,i,n){if("function"!=typeof t)throw new TypeError('"callback" argument must be a function');var a,s,o=arguments.length;switch(o){case 0:case 1:return e.nextTick(t);case 2:return e.nextTick((function(){t.call(null,r)}));case 3:return e.nextTick((function(){t.call(null,r,i)}));case 4:return e.nextTick((function(){t.call(null,r,i,n)}));default:for(a=new Array(o-1),s=0;s1)for(var r=1;r= 0x80 (not a basic code point)","invalid-input":"Invalid input"},p=Math.floor,m=String.fromCharCode;function g(e){throw new RangeError(d[e])}function b(e,t){for(var r=e.length,i=[];r--;)i[r]=t(e[r]);return i}function y(e,t){var r=e.split("@"),i="";return r.length>1&&(i=r[0]+"@",e=r[1]),i+b((e=e.replace(f,".")).split("."),t).join(".")}function _(e){for(var t,r,i=[],n=0,a=e.length;n=55296&&t<=56319&&n65535&&(t+=m((e-=65536)>>>10&1023|55296),e=56320|1023&e),t+=m(e)})).join("")}function w(e,t){return e+22+75*(e<26)-((0!=t)<<5)}function E(e,t,r){var i=0;for(e=r?p(e/700):e>>1,e+=p(e/t);e>455;i+=36)e=p(e/35);return p(i+36*e/(e+38))}function k(e){var t,r,i,n,a,s,o,u,h,c,f,d=[],m=e.length,b=0,y=128,_=72;for((r=e.lastIndexOf("-"))<0&&(r=0),i=0;i=128&&g("not-basic"),d.push(e.charCodeAt(i));for(n=r>0?r+1:0;n=m&&g("invalid-input"),((u=(f=e.charCodeAt(n++))-48<10?f-22:f-65<26?f-65:f-97<26?f-97:36)>=36||u>p((l-b)/s))&&g("overflow"),b+=u*s,!(u<(h=o<=_?1:o>=_+26?26:o-_));o+=36)s>p(l/(c=36-h))&&g("overflow"),s*=c;_=E(b-a,t=d.length+1,0==a),p(b/t)>l-y&&g("overflow"),y+=p(b/t),b%=t,d.splice(b++,0,y)}return v(d)}function T(e){var t,r,i,n,a,s,o,u,h,c,f,d,b,y,v,k=[];for(d=(e=_(e)).length,t=128,r=0,a=72,s=0;s=t&&fp((l-r)/(b=i+1))&&g("overflow"),r+=(o-t)*b,t=o,s=0;sl&&g("overflow"),f==t){for(u=r,h=36;!(u<(c=h<=a?1:h>=a+26?26:h-a));h+=36)v=u-c,y=36-c,k.push(m(w(c+v%y,0))),u=p(v/y);k.push(m(w(u,0))),a=E(r,b,i==n),r=0,++i}++r,++t}return k.join("")}if(o={version:"1.4.1",ucs2:{decode:_,encode:v},decode:k,encode:T,toASCII:function(e){return y(e,(function(e){return c.test(e)?"xn--"+T(e):e}))},toUnicode:function(e){return y(e,(function(e){return h.test(e)?k(e.slice(4).toLowerCase()):e}))}},r&&a)if(i.exports==r)a.exports=o;else for(u in o)o.hasOwnProperty(u)&&(r[u]=o[u]);else t.punycode=o}(this)}).call(this,void 0!==t?t:"undefined"!=typeof self?self:void 0!==r?r:{})},{}],135:[function(e,t,r){"use strict";function i(e,t){return Object.prototype.hasOwnProperty.call(e,t)}t.exports=function(e,t,r,a){t=t||"&",r=r||"=";var s={};if("string"!=typeof e||0===e.length)return s;var o=/\+/g;e=e.split(t);var u=1e3;a&&"number"==typeof a.maxKeys&&(u=a.maxKeys);var l=e.length;u>0&&l>u&&(l=u);for(var h=0;h=0?(c=m.substr(0,g),f=m.substr(g+1)):(c=m,f=""),d=decodeURIComponent(c),p=decodeURIComponent(f),i(s,d)?n(s[d])?s[d].push(p):s[d]=[s[d],p]:s[d]=p}return s};var n=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)}},{}],136:[function(e,t,r){"use strict";var i=function(e){switch(typeof e){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}};t.exports=function(e,t,r,o){return t=t||"&",r=r||"=",null===e&&(e=void 0),"object"==typeof e?a(s(e),(function(s){var o=encodeURIComponent(i(s))+r;return n(e[s])?a(e[s],(function(e){return o+encodeURIComponent(i(e))})).join(t):o+encodeURIComponent(i(e[s]))})).join(t):o?encodeURIComponent(i(o))+r+encodeURIComponent(i(e)):""};var n=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)};function a(e,t){if(e.map)return e.map(t);for(var r=[],i=0;i0?("string"==typeof t||s.objectMode||Object.getPrototypeOf(t)===l.prototype||(t=function(e){return l.from(e)}(t)),i?s.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):w(e,s,t,!0):s.ended?e.emit("error",new Error("stream.push() after EOF")):(s.reading=!1,s.decoder&&!r?(t=s.decoder.write(t),s.objectMode||0!==t.length?w(e,s,t,!1):S(e,s)):w(e,s,t,!1))):i||(s.reading=!1)),function(e){return!e.ended&&(e.needReadable||e.lengtht.highWaterMark&&(t.highWaterMark=function(e){return e>=8388608?e=8388608:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function k(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(d("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?n.nextTick(T,e):T(e))}function T(e){d("emit readable"),e.emit("readable"),A(e)}function S(e,t){t.readingMore||(t.readingMore=!0,n.nextTick(x,e,t))}function x(e,t){for(var r=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=t.length?(r=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):r=function(e,t,r){var i;return ea.length?a.length:e;if(s===a.length?n+=a:n+=a.slice(0,e),0==(e-=s)){s===a.length?(++i,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=a.slice(s));break}++i}return t.length-=i,n}(e,t):function(e,t){var r=l.allocUnsafe(e),i=t.head,n=1;for(i.data.copy(r),e-=i.data.length;i=i.next;){var a=i.data,s=e>a.length?a.length:e;if(a.copy(r,r.length-e,0,s),0==(e-=s)){s===a.length?(++n,i.next?t.head=i.next:t.head=t.tail=null):(t.head=i,i.data=a.slice(s));break}++n}return t.length-=n,r}(e,t),i}(e,t.buffer,t.decoder),r);var r}function P(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,n.nextTick(R,t,e))}function R(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function B(e,t){for(var r=0,i=e.length;r=t.highWaterMark||t.ended))return d("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?P(this):k(this),null;if(0===(e=E(e,t))&&t.ended)return 0===t.length&&P(this),null;var i,n=t.needReadable;return d("need readable",n),(0===t.length||t.length-e0?M(e,t):null)?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),r!==e&&t.ended&&P(this)),null!==i&&this.emit("data",i),i},_.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))},_.prototype.pipe=function(e,r){var i=this,a=this._readableState;switch(a.pipesCount){case 0:a.pipes=e;break;case 1:a.pipes=[a.pipes,e];break;default:a.pipes.push(e)}a.pipesCount+=1,d("pipe count=%d opts=%j",a.pipesCount,r);var u=r&&!1===r.end||e===t.stdout||e===t.stderr?_:h;function l(t,r){d("onunpipe"),t===i&&r&&!1===r.hasUnpiped&&(r.hasUnpiped=!0,d("cleanup"),e.removeListener("close",b),e.removeListener("finish",y),e.removeListener("drain",c),e.removeListener("error",g),e.removeListener("unpipe",l),i.removeListener("end",h),i.removeListener("end",_),i.removeListener("data",m),f=!0,!a.awaitDrain||e._writableState&&!e._writableState.needDrain||c())}function h(){d("onend"),e.end()}a.endEmitted?n.nextTick(u):i.once("end",u),e.on("unpipe",l);var c=function(e){return function(){var t=e._readableState;d("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&o(e,"data")&&(t.flowing=!0,A(e))}}(i);e.on("drain",c);var f=!1,p=!1;function m(t){d("ondata"),p=!1,!1!==e.write(t)||p||((1===a.pipesCount&&a.pipes===e||a.pipesCount>1&&-1!==B(a.pipes,e))&&!f&&(d("false write response, pause",i._readableState.awaitDrain),i._readableState.awaitDrain++,p=!0),i.pause())}function g(t){d("onerror",t),_(),e.removeListener("error",g),0===o(e,"error")&&e.emit("error",t)}function b(){e.removeListener("finish",y),_()}function y(){d("onfinish"),e.removeListener("close",b),_()}function _(){d("unpipe"),i.unpipe(e)}return i.on("data",m),function(e,t,r){if("function"==typeof e.prependListener)return e.prependListener(t,r);e._events&&e._events[t]?s(e._events[t])?e._events[t].unshift(r):e._events[t]=[r,e._events[t]]:e.on(t,r)}(e,"error",g),e.once("close",b),e.once("finish",y),e.emit("pipe",i),a.flowing||(d("pipe resume"),i.resume()),e},_.prototype.unpipe=function(e){var t=this._readableState,r={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes||(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,r)),this;if(!e){var i=t.pipes,n=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var a=0;a-1?n:a.nextTick;y.WritableState=b;var l=e("core-util-is");l.inherits=e("inherits");var h,c={deprecate:e("util-deprecate")},f=e("./internal/streams/stream"),d=e("safe-buffer").Buffer,p=r.Uint8Array||function(){},m=e("./internal/streams/destroy");function g(){}function b(t,r){o=o||e("./_stream_duplex"),t=t||{};var i=r instanceof o;this.objectMode=!!t.objectMode,i&&(this.objectMode=this.objectMode||!!t.writableObjectMode);var n=t.highWaterMark,l=t.writableHighWaterMark,h=this.objectMode?16:16384;this.highWaterMark=n||0===n?n:i&&(l||0===l)?l:h,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var c=!1===t.decodeStrings;this.decodeStrings=!c,this.defaultEncoding=t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){!function(e,t){var r=e._writableState,i=r.sync,n=r.writecb;if(function(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}(r),t)!function(e,t,r,i,n){--t.pendingcb,r?(a.nextTick(n,i),a.nextTick(T,e,t),e._writableState.errorEmitted=!0,e.emit("error",i)):(n(i),e._writableState.errorEmitted=!0,e.emit("error",i),T(e,t))}(e,r,i,t,n);else{var s=E(r);s||r.corked||r.bufferProcessing||!r.bufferedRequest||w(e,r),i?u(v,e,r,s,n):v(e,r,s,n)}}(r,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new s(this)}function y(t){if(o=o||e("./_stream_duplex"),!(h.call(y,this)||this instanceof o))return new y(t);this._writableState=new b(t,this),this.writable=!0,t&&("function"==typeof t.write&&(this._write=t.write),"function"==typeof t.writev&&(this._writev=t.writev),"function"==typeof t.destroy&&(this._destroy=t.destroy),"function"==typeof t.final&&(this._final=t.final)),f.call(this)}function _(e,t,r,i,n,a,s){t.writelen=i,t.writecb=s,t.writing=!0,t.sync=!0,r?e._writev(n,t.onwrite):e._write(n,a,t.onwrite),t.sync=!1}function v(e,t,r,i){r||function(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}(e,t),t.pendingcb--,i(),T(e,t)}function w(e,t){t.bufferProcessing=!0;var r=t.bufferedRequest;if(e._writev&&r&&r.next){var i=t.bufferedRequestCount,n=new Array(i),a=t.corkedRequestsFree;a.entry=r;for(var o=0,u=!0;r;)n[o]=r,r.isBuf||(u=!1),r=r.next,o+=1;n.allBuffers=u,_(e,t,!0,t.length,n,"",a.finish),t.pendingcb++,t.lastBufferedRequest=null,a.next?(t.corkedRequestsFree=a.next,a.next=null):t.corkedRequestsFree=new s(t),t.bufferedRequestCount=0}else{for(;r;){var l=r.chunk,h=r.encoding,c=r.callback;if(_(e,t,!1,t.objectMode?1:l.length,l,h,c),r=r.next,t.bufferedRequestCount--,t.writing)break}null===r&&(t.lastBufferedRequest=null)}t.bufferedRequest=r,t.bufferProcessing=!1}function E(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function k(e,t){e._final((function(r){t.pendingcb--,r&&e.emit("error",r),t.prefinished=!0,e.emit("prefinish"),T(e,t)}))}function T(e,t){var r=E(t);return r&&(function(e,t){t.prefinished||t.finalCalled||("function"==typeof e._final?(t.pendingcb++,t.finalCalled=!0,a.nextTick(k,e,t)):(t.prefinished=!0,e.emit("prefinish")))}(e,t),0===t.pendingcb&&(t.finished=!0,e.emit("finish"))),r}l.inherits(y,f),b.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(b.prototype,"buffer",{get:c.deprecate((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(e){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(h=Function.prototype[Symbol.hasInstance],Object.defineProperty(y,Symbol.hasInstance,{value:function(e){return!!h.call(this,e)||this===y&&e&&e._writableState instanceof b}})):h=function(e){return e instanceof this},y.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},y.prototype.write=function(e,t,r){var i,n=this._writableState,s=!1,o=!n.objectMode&&(i=e,d.isBuffer(i)||i instanceof p);return o&&!d.isBuffer(e)&&(e=function(e){return d.from(e)}(e)),"function"==typeof t&&(r=t,t=null),o?t="buffer":t||(t=n.defaultEncoding),"function"!=typeof r&&(r=g),n.ended?function(e,t){var r=new Error("write after end");e.emit("error",r),a.nextTick(t,r)}(this,r):(o||function(e,t,r,i){var n=!0,s=!1;return null===r?s=new TypeError("May not write null values to stream"):"string"==typeof r||void 0===r||t.objectMode||(s=new TypeError("Invalid non-string/buffer chunk")),s&&(e.emit("error",s),a.nextTick(i,s),n=!1),n}(this,n,e,r))&&(n.pendingcb++,s=function(e,t,r,i,n,a){if(!r){var s=function(e,t,r){return e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=d.from(t,r)),t}(t,i,n);i!==s&&(r=!0,n="buffer",i=s)}var o=t.objectMode?1:i.length;t.length+=o;var u=t.length-1))throw new TypeError("Unknown encoding: "+e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(y.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),y.prototype._write=function(e,t,r){r(new Error("_write() is not implemented"))},y.prototype._writev=null,y.prototype.end=function(e,t,r){var i=this._writableState;"function"==typeof e?(r=e,e=null,t=null):"function"==typeof t&&(r=t,t=null),null!=e&&this.write(e,t),i.corked&&(i.corked=1,this.uncork()),i.ending||i.finished||function(e,t,r){t.ending=!0,T(e,t),r&&(t.finished?a.nextTick(r):e.once("finish",r)),t.ended=!0,e.writable=!1}(this,i,r)},Object.defineProperty(y.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),y.prototype.destroy=m.destroy,y.prototype._undestroy=m.undestroy,y.prototype._destroy=function(e,t){this.end(),t(e)}}).call(this,e("_process"),void 0!==t?t:"undefined"!=typeof self?self:void 0!==r?r:{},e("timers").setImmediate)},{"./_stream_duplex":139,"./internal/streams/destroy":145,"./internal/streams/stream":146,_process:133,"core-util-is":51,inherits:75,"process-nextick-args":132,"safe-buffer":147,timers:176,"util-deprecate":183}],144:[function(e,t,r){"use strict";var i=e("safe-buffer").Buffer,n=e("util");t.exports=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.head=null,this.tail=null,this.length=0}return e.prototype.push=function(e){var t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length},e.prototype.unshift=function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length},e.prototype.shift=function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}},e.prototype.clear=function(){this.head=this.tail=null,this.length=0},e.prototype.join=function(e){if(0===this.length)return"";for(var t=this.head,r=""+t.data;t=t.next;)r+=e+t.data;return r},e.prototype.concat=function(e){if(0===this.length)return i.alloc(0);if(1===this.length)return this.head.data;for(var t,r,n,a=i.allocUnsafe(e>>>0),s=this.head,o=0;s;)t=s.data,r=a,n=o,t.copy(r,n),o+=s.data.length,s=s.next;return a},e}(),n&&n.inspect&&n.inspect.custom&&(t.exports.prototype[n.inspect.custom]=function(){var e=n.inspect({length:this.length});return this.constructor.name+" "+e})},{"safe-buffer":147,util:33}],145:[function(e,t,r){"use strict";var i=e("process-nextick-args");function n(e,t){e.emit("error",t)}t.exports={destroy:function(e,t){var r=this,a=this._readableState&&this._readableState.destroyed,s=this._writableState&&this._writableState.destroyed;return a||s?(t?t(e):!e||this._writableState&&this._writableState.errorEmitted||i.nextTick(n,this,e),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,(function(e){!t&&e?(i.nextTick(n,r,e),r._writableState&&(r._writableState.errorEmitted=!0)):t&&t(e)})),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}}},{"process-nextick-args":132}],146:[function(e,t,r){t.exports=e("events").EventEmitter},{events:52}],147:[function(e,t,r){var i=e("buffer"),n=i.Buffer;function a(e,t){for(var r in e)t[r]=e[r]}function s(e,t,r){return n(e,t,r)}n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow?t.exports=i:(a(i,r),r.Buffer=s),a(n,s),s.from=function(e,t,r){if("number"==typeof e)throw new TypeError("Argument must not be a number");return n(e,t,r)},s.alloc=function(e,t,r){if("number"!=typeof e)throw new TypeError("Argument must be a number");var i=n(e);return void 0!==t?"string"==typeof r?i.fill(t,r):i.fill(t):i.fill(0),i},s.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return n(e)},s.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return i.SlowBuffer(e)}},{buffer:48}],148:[function(e,t,r){"use strict";var i=e("safe-buffer").Buffer,n=i.isEncoding||function(e){switch((e=""+e)&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function a(e){var t;switch(this.encoding=function(e){var t=function(e){if(!e)return"utf8";for(var t;;)switch(e){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}}(e);if("string"!=typeof t&&(i.isEncoding===n||!n(e)))throw new Error("Unknown encoding: "+e);return t||e}(e),this.encoding){case"utf16le":this.text=u,this.end=l,t=4;break;case"utf8":this.fillLast=o,t=4;break;case"base64":this.text=h,this.end=c,t=3;break;default:return this.write=f,void(this.end=d)}this.lastNeed=0,this.lastTotal=0,this.lastChar=i.allocUnsafe(t)}function s(e){return e<=127?0:e>>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function o(e){var t=this.lastTotal-this.lastNeed,r=function(e,t,r){if(128!=(192&t[0]))return e.lastNeed=0,"�";if(e.lastNeed>1&&t.length>1){if(128!=(192&t[1]))return e.lastNeed=1,"�";if(e.lastNeed>2&&t.length>2&&128!=(192&t[2]))return e.lastNeed=2,"�"}}(this,e);return void 0!==r?r:this.lastNeed<=e.length?(e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(e.copy(this.lastChar,t,0,e.length),void(this.lastNeed-=e.length))}function u(e,t){if((e.length-t)%2==0){var r=e.toString("utf16le",t);if(r){var i=r.charCodeAt(r.length-1);if(i>=55296&&i<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function l(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,r)}return t}function h(e,t){var r=(e.length-t)%3;return 0===r?e.toString("base64",t):(this.lastNeed=3-r,this.lastTotal=3,1===r?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-r))}function c(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function f(e){return e.toString(this.encoding)}function d(e){return e&&e.length?this.write(e):""}r.StringDecoder=a,a.prototype.write=function(e){if(0===e.length)return"";var t,r;if(this.lastNeed){if(void 0===(t=this.fillLast(e)))return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r=0?(n>0&&(e.lastNeed=n-1),n):--i=0?(n>0&&(e.lastNeed=n-2),n):--i=0?(n>0&&(2===n?n=0:e.lastNeed=n-3),n):0}(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=r;var i=e.length-(r-this.lastNeed);return e.copy(this.lastChar,0,i),e.toString("utf8",t,i)},a.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length}},{"safe-buffer":147}],149:[function(e,t,r){t.exports=e("./readable").PassThrough},{"./readable":150}],150:[function(e,t,r){(r=t.exports=e("./lib/_stream_readable.js")).Stream=r,r.Readable=r,r.Writable=e("./lib/_stream_writable.js"),r.Duplex=e("./lib/_stream_duplex.js"),r.Transform=e("./lib/_stream_transform.js"),r.PassThrough=e("./lib/_stream_passthrough.js")},{"./lib/_stream_duplex.js":139,"./lib/_stream_passthrough.js":140,"./lib/_stream_readable.js":141,"./lib/_stream_transform.js":142,"./lib/_stream_writable.js":143}],151:[function(e,t,r){t.exports=e("./readable").Transform},{"./readable":150}],152:[function(e,t,r){t.exports=e("./lib/_stream_writable.js")},{"./lib/_stream_writable.js":143}],153:[function(e,t,r){var i=function(e){"use strict";var t=Object.prototype,r=t.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},n=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",s=i.toStringTag||"@@toStringTag";function o(e,t,r,i){var n=t&&t.prototype instanceof h?t:h,a=Object.create(n.prototype),s=new E(i||[]);return a._invoke=function(e,t,r){var i="suspendedStart";return function(n,a){if("executing"===i)throw new Error("Generator is already running");if("completed"===i){if("throw"===n)throw a;return{value:void 0,done:!0}}for(r.method=n,r.arg=a;;){var s=r.delegate;if(s){var o=_(s,r);if(o){if(o===l)continue;return o}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===i)throw i="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i="executing";var h=u(e,t,r);if("normal"===h.type){if(i=r.done?"completed":"suspendedYield",h.arg===l)continue;return{value:h.arg,done:r.done}}"throw"===h.type&&(i="completed",r.method="throw",r.arg=h.arg)}}}(e,r,s),a}function u(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=o;var l={};function h(){}function c(){}function f(){}var d={};d[n]=function(){return this};var p=Object.getPrototypeOf,m=p&&p(p(k([])));m&&m!==t&&r.call(m,n)&&(d=m);var g=f.prototype=h.prototype=Object.create(d);function b(e){["next","throw","return"].forEach((function(t){e[t]=function(e){return this._invoke(t,e)}}))}function y(e){var t;this._invoke=function(i,n){function a(){return new Promise((function(t,a){!function t(i,n,a,s){var o=u(e[i],e,n);if("throw"!==o.type){var l=o.arg,h=l.value;return h&&"object"==typeof h&&r.call(h,"__await")?Promise.resolve(h.__await).then((function(e){t("next",e,a,s)}),(function(e){t("throw",e,a,s)})):Promise.resolve(h).then((function(e){l.value=e,a(l)}),(function(e){return t("throw",e,a,s)}))}s(o.arg)}(i,n,t,a)}))}return t=t?t.then(a,a):a()}}function _(e,t){var r=e.iterator[t.method];if(void 0===r){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,_(e,t),"throw"===t.method))return l;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return l}var i=u(r,e.iterator,t.arg);if("throw"===i.type)return t.method="throw",t.arg=i.arg,t.delegate=null,l;var n=i.arg;return n?n.done?(t[e.resultName]=n.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,l):n:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,l)}function v(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function w(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function E(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(v,this),this.reset(!0)}function k(e){if(e){var t=e[n];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var i=-1,a=function t(){for(;++i=0;--n){var a=this.tryEntries[n],s=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var o=r.call(a,"catchLoc"),u=r.call(a,"finallyLoc");if(o&&u){if(this.prev=0;--i){var n=this.tryEntries[i];if(n.tryLoc<=this.prev&&r.call(n,"finallyLoc")&&this.prev=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),w(r),l}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var i=r.completion;if("throw"===i.type){var n=i.arg;w(r)}return n}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:k(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),l}},e}("object"==typeof t?t.exports:{});try{regeneratorRuntime=i}catch(e){Function("r","regeneratorRuntime = r")(i)}},{}],154:[function(e,t,r){var i=e("buffer"),n=i.Buffer;function a(e,t){for(var r in e)t[r]=e[r]}function s(e,t,r){return n(e,t,r)}n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow?t.exports=i:(a(i,r),r.Buffer=s),s.prototype=Object.create(n.prototype),a(n,s),s.from=function(e,t,r){if("number"==typeof e)throw new TypeError("Argument must not be a number");return n(e,t,r)},s.alloc=function(e,t,r){if("number"!=typeof e)throw new TypeError("Argument must be a number");var i=n(e);return void 0!==t?"string"==typeof r?i.fill(t,r):i.fill(t):i.fill(0),i},s.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return n(e)},s.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return i.SlowBuffer(e)}},{buffer:48}],155:[function(e,t,r){t.exports=n;var i=e("events").EventEmitter;function n(){i.call(this)}e("inherits")(n,i),n.Readable=e("readable-stream/readable.js"),n.Writable=e("readable-stream/writable.js"),n.Duplex=e("readable-stream/duplex.js"),n.Transform=e("readable-stream/transform.js"),n.PassThrough=e("readable-stream/passthrough.js"),n.Stream=n,n.prototype.pipe=function(e,t){var r=this;function n(t){e.writable&&!1===e.write(t)&&r.pause&&r.pause()}function a(){r.readable&&r.resume&&r.resume()}r.on("data",n),e.on("drain",a),e._isStdio||t&&!1===t.end||(r.on("end",o),r.on("close",u));var s=!1;function o(){s||(s=!0,e.end())}function u(){s||(s=!0,"function"==typeof e.destroy&&e.destroy())}function l(e){if(h(),0===i.listenerCount(this,"error"))throw e}function h(){r.removeListener("data",n),e.removeListener("drain",a),r.removeListener("end",o),r.removeListener("close",u),r.removeListener("error",l),e.removeListener("error",l),r.removeListener("end",h),r.removeListener("close",h),e.removeListener("close",h)}return r.on("error",l),e.on("error",l),r.on("end",h),r.on("close",h),e.on("close",h),e.emit("pipe",r),e}},{events:52,inherits:75,"readable-stream/duplex.js":138,"readable-stream/passthrough.js":149,"readable-stream/readable.js":150,"readable-stream/transform.js":151,"readable-stream/writable.js":152}],156:[function(e,i,n){(function(t){var r=e("./lib/request"),i=e("./lib/response"),a=e("xtend"),s=e("builtin-status-codes"),o=e("url"),u=n;u.request=function(e,i){e="string"==typeof e?o.parse(e):a(e);var n=-1===t.location.protocol.search(/^https?:$/)?"http:":"",s=e.protocol||n,u=e.hostname||e.host,l=e.port,h=e.path||"/";u&&-1!==u.indexOf(":")&&(u="["+u+"]"),e.url=(u?s+"//"+u:"")+(l?":"+l:"")+h,e.method=(e.method||"GET").toUpperCase(),e.headers=e.headers||{};var c=new r(e);return i&&c.on("response",i),c},u.get=function(e,t){var r=u.request(e,t);return r.end(),r},u.ClientRequest=r,u.IncomingMessage=i.IncomingMessage,u.Agent=function(){},u.Agent.defaultMaxSockets=4,u.globalAgent=new u.Agent,u.STATUS_CODES=s,u.METHODS=["CHECKOUT","CONNECT","COPY","DELETE","GET","HEAD","LOCK","M-SEARCH","MERGE","MKACTIVITY","MKCOL","MOVE","NOTIFY","OPTIONS","PATCH","POST","PROPFIND","PROPPATCH","PURGE","PUT","REPORT","SEARCH","SUBSCRIBE","TRACE","UNLOCK","UNSUBSCRIBE"]}).call(this,void 0!==t?t:"undefined"!=typeof self?self:void 0!==r?r:{})},{"./lib/request":158,"./lib/response":159,"builtin-status-codes":50,url:180,xtend:189}],157:[function(e,i,n){(function(e){var t;function r(){if(void 0!==t)return t;if(e.XMLHttpRequest){t=new e.XMLHttpRequest;try{t.open("GET",e.XDomainRequest?"/":"https://example.com")}catch(e){t=null}}else t=null;return t}function i(e){var t=r();if(!t)return!1;try{return t.responseType=e,t.responseType===e}catch(e){}return!1}function a(e){return"function"==typeof e}n.fetch=a(e.fetch)&&a(e.ReadableStream),n.writableStream=a(e.WritableStream),n.abortController=a(e.AbortController),n.arraybuffer=n.fetch||i("arraybuffer"),n.msstream=!n.fetch&&i("ms-stream"),n.mozchunkedarraybuffer=!n.fetch&&i("moz-chunked-arraybuffer"),n.overrideMimeType=n.fetch||!!r()&&a(r().overrideMimeType),t=null}).call(this,void 0!==t?t:"undefined"!=typeof self?self:void 0!==r?r:{})},{}],158:[function(e,i,n){(function(t,r,n){var a=e("./capability"),s=e("inherits"),o=e("./response"),u=e("readable-stream"),l=o.IncomingMessage,h=o.readyStates,c=i.exports=function(e){var t,r=this;u.Writable.call(r),r._opts=e,r._body=[],r._headers={},e.auth&&r.setHeader("Authorization","Basic "+n.from(e.auth).toString("base64")),Object.keys(e.headers).forEach((function(t){r.setHeader(t,e.headers[t])}));var i=!0;if("disable-fetch"===e.mode||"requestTimeout"in e&&!a.abortController)i=!1,t=!0;else if("prefer-streaming"===e.mode)t=!1;else if("allow-wrong-content-type"===e.mode)t=!a.overrideMimeType;else{if(e.mode&&"default"!==e.mode&&"prefer-fast"!==e.mode)throw new Error("Invalid value for opts.mode");t=!0}r._mode=function(e,t){return a.fetch&&t?"fetch":a.mozchunkedarraybuffer?"moz-chunked-arraybuffer":a.msstream?"ms-stream":a.arraybuffer&&e?"arraybuffer":"text"}(t,i),r._fetchTimer=null,r.on("finish",(function(){r._onFinish()}))};s(c,u.Writable),c.prototype.setHeader=function(e,t){var r=e.toLowerCase();-1===f.indexOf(r)&&(this._headers[r]={name:e,value:t})},c.prototype.getHeader=function(e){var t=this._headers[e.toLowerCase()];return t?t.value:null},c.prototype.removeHeader=function(e){delete this._headers[e.toLowerCase()]},c.prototype._onFinish=function(){var e=this;if(!e._destroyed){var i=e._opts,n=e._headers,s=null;"GET"!==i.method&&"HEAD"!==i.method&&(s=new Blob(e._body,{type:(n["content-type"]||{}).value||""}));var o=[];if(Object.keys(n).forEach((function(e){var t=n[e].name,r=n[e].value;Array.isArray(r)?r.forEach((function(e){o.push([t,e])})):o.push([t,r])})),"fetch"===e._mode){var u=null;if(a.abortController){var l=new AbortController;u=l.signal,e._fetchAbortController=l,"requestTimeout"in i&&0!==i.requestTimeout&&(e._fetchTimer=r.setTimeout((function(){e.emit("requestTimeout"),e._fetchAbortController&&e._fetchAbortController.abort()}),i.requestTimeout))}r.fetch(e._opts.url,{method:e._opts.method,headers:o,body:s||void 0,mode:"cors",credentials:i.withCredentials?"include":"same-origin",signal:u}).then((function(t){e._fetchResponse=t,e._connect()}),(function(t){r.clearTimeout(e._fetchTimer),e._destroyed||e.emit("error",t)}))}else{var c=e._xhr=new r.XMLHttpRequest;try{c.open(e._opts.method,e._opts.url,!0)}catch(r){return void t.nextTick((function(){e.emit("error",r)}))}"responseType"in c&&(c.responseType=e._mode),"withCredentials"in c&&(c.withCredentials=!!i.withCredentials),"text"===e._mode&&"overrideMimeType"in c&&c.overrideMimeType("text/plain; charset=x-user-defined"),"requestTimeout"in i&&(c.timeout=i.requestTimeout,c.ontimeout=function(){e.emit("requestTimeout")}),o.forEach((function(e){c.setRequestHeader(e[0],e[1])})),e._response=null,c.onreadystatechange=function(){switch(c.readyState){case h.LOADING:case h.DONE:e._onXHRProgress()}},"moz-chunked-arraybuffer"===e._mode&&(c.onprogress=function(){e._onXHRProgress()}),c.onerror=function(){e._destroyed||e.emit("error",new Error("XHR error"))};try{c.send(s)}catch(r){return void t.nextTick((function(){e.emit("error",r)}))}}}},c.prototype._onXHRProgress=function(){(function(e){try{var t=e.status;return null!==t&&0!==t}catch(e){return!1}})(this._xhr)&&!this._destroyed&&(this._response||this._connect(),this._response._onXHRProgress())},c.prototype._connect=function(){var e=this;e._destroyed||(e._response=new l(e._xhr,e._fetchResponse,e._mode,e._fetchTimer),e._response.on("error",(function(t){e.emit("error",t)})),e.emit("response",e._response))},c.prototype._write=function(e,t,r){this._body.push(e),r()},c.prototype.abort=c.prototype.destroy=function(){this._destroyed=!0,r.clearTimeout(this._fetchTimer),this._response&&(this._response._destroyed=!0),this._xhr?this._xhr.abort():this._fetchAbortController&&this._fetchAbortController.abort()},c.prototype.end=function(e,t,r){"function"==typeof e&&(r=e,e=void 0),u.Writable.prototype.end.call(this,e,t,r)},c.prototype.flushHeaders=function(){},c.prototype.setTimeout=function(){},c.prototype.setNoDelay=function(){},c.prototype.setSocketKeepAlive=function(){};var f=["accept-charset","accept-encoding","access-control-request-headers","access-control-request-method","connection","content-length","cookie","cookie2","date","dnt","expect","host","keep-alive","origin","referer","te","trailer","transfer-encoding","upgrade","via"]}).call(this,e("_process"),void 0!==t?t:"undefined"!=typeof self?self:void 0!==r?r:{},e("buffer").Buffer)},{"./capability":157,"./response":159,_process:133,buffer:48,inherits:75,"readable-stream":174}],159:[function(e,i,n){(function(t,r,i){var a=e("./capability"),s=e("inherits"),o=e("readable-stream"),u=n.readyStates={UNSENT:0,OPENED:1,HEADERS_RECEIVED:2,LOADING:3,DONE:4},l=n.IncomingMessage=function(e,n,s,u){var l=this;if(o.Readable.call(l),l._mode=s,l.headers={},l.rawHeaders=[],l.trailers={},l.rawTrailers=[],l.on("end",(function(){t.nextTick((function(){l.emit("close")}))})),"fetch"===s){if(l._fetchResponse=n,l.url=n.url,l.statusCode=n.status,l.statusMessage=n.statusText,n.headers.forEach((function(e,t){l.headers[t.toLowerCase()]=e,l.rawHeaders.push(t,e)})),a.writableStream){var h=new WritableStream({write:function(e){return new Promise((function(t,r){l._destroyed?r():l.push(i.from(e))?t():l._resumeFetch=t}))},close:function(){r.clearTimeout(u),l._destroyed||l.push(null)},abort:function(e){l._destroyed||l.emit("error",e)}});try{return void n.body.pipeTo(h).catch((function(e){r.clearTimeout(u),l._destroyed||l.emit("error",e)}))}catch(e){}}var c=n.body.getReader();!function e(){c.read().then((function(t){if(!l._destroyed){if(t.done)return r.clearTimeout(u),void l.push(null);l.push(i.from(t.value)),e()}})).catch((function(e){r.clearTimeout(u),l._destroyed||l.emit("error",e)}))}()}else if(l._xhr=e,l._pos=0,l.url=e.responseURL,l.statusCode=e.status,l.statusMessage=e.statusText,e.getAllResponseHeaders().split(/\r?\n/).forEach((function(e){var t=e.match(/^([^:]+):\s*(.*)/);if(t){var r=t[1].toLowerCase();"set-cookie"===r?(void 0===l.headers[r]&&(l.headers[r]=[]),l.headers[r].push(t[2])):void 0!==l.headers[r]?l.headers[r]+=", "+t[2]:l.headers[r]=t[2],l.rawHeaders.push(t[1],t[2])}})),l._charset="x-user-defined",!a.overrideMimeType){var f=l.rawHeaders["mime-type"];if(f){var d=f.match(/;\s*charset=([^;])(;|$)/);d&&(l._charset=d[1].toLowerCase())}l._charset||(l._charset="utf-8")}};s(l,o.Readable),l.prototype._read=function(){var e=this._resumeFetch;e&&(this._resumeFetch=null,e())},l.prototype._onXHRProgress=function(){var e=this,t=e._xhr,n=null;switch(e._mode){case"text":if((n=t.responseText).length>e._pos){var a=n.substr(e._pos);if("x-user-defined"===e._charset){for(var s=i.alloc(a.length),o=0;oe._pos&&(e.push(i.from(new Uint8Array(l.result.slice(e._pos)))),e._pos=l.result.byteLength)},l.onload=function(){e.push(null)},l.readAsArrayBuffer(n)}e._xhr.readyState===u.DONE&&"ms-stream"!==e._mode&&e.push(null)}}).call(this,e("_process"),void 0!==t?t:"undefined"!=typeof self?self:void 0!==r?r:{},e("buffer").Buffer)},{"./capability":157,_process:133,buffer:48,inherits:75,"readable-stream":174}],160:[function(e,t,r){"use strict";var i={};function n(e,t,r){r||(r=Error);var n=function(e){var r,i;function n(r,i,n){return e.call(this,function(e,r,i){return"string"==typeof t?t:t(e,r,i)}(r,i,n))||this}return i=e,(r=n).prototype=Object.create(i.prototype),r.prototype.constructor=r,r.__proto__=i,n}(r);n.prototype.name=r.name,n.prototype.code=e,i[e]=n}function a(e,t){if(Array.isArray(e)){var r=e.length;return e=e.map((function(e){return String(e)})),r>2?"one of ".concat(t," ").concat(e.slice(0,r-1).join(", "),", or ")+e[r-1]:2===r?"one of ".concat(t," ").concat(e[0]," or ").concat(e[1]):"of ".concat(t," ").concat(e[0])}return"of ".concat(t," ").concat(String(e))}n("ERR_INVALID_OPT_VALUE",(function(e,t){return'The value "'+t+'" is invalid for option "'+e+'"'}),TypeError),n("ERR_INVALID_ARG_TYPE",(function(e,t,r){var i,n,s,o;if("string"==typeof t&&(n="not ",t.substr(!s||s<0?0:+s,n.length)===n)?(i="must not be",t=t.replace(/^not /,"")):i="must be",function(e,t,r){return(void 0===r||r>e.length)&&(r=e.length),e.substring(r-t.length,r)===t}(e," argument"))o="The ".concat(e," ").concat(i," ").concat(a(t,"type"));else{var u=function(e,t,r){return"number"!=typeof r&&(r=0),!(r+t.length>e.length)&&-1!==e.indexOf(t,r)}(e,".")?"property":"argument";o='The "'.concat(e,'" ').concat(u," ").concat(i," ").concat(a(t,"type"))}return o+=". Received type ".concat(typeof r)}),TypeError),n("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),n("ERR_METHOD_NOT_IMPLEMENTED",(function(e){return"The "+e+" method is not implemented"})),n("ERR_STREAM_PREMATURE_CLOSE","Premature close"),n("ERR_STREAM_DESTROYED",(function(e){return"Cannot call "+e+" after a stream was destroyed"})),n("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),n("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),n("ERR_STREAM_WRITE_AFTER_END","write after end"),n("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),n("ERR_UNKNOWN_ENCODING",(function(e){return"Unknown encoding: "+e}),TypeError),n("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),t.exports.codes=i},{}],161:[function(e,t,r){(function(e){"use strict";var r=new Set;t.exports.emitExperimentalWarning=e.emitWarning?function(t){if(!r.has(t)){var i=t+" is an experimental feature. This feature could change at any time";r.add(t),e.emitWarning(i,"ExperimentalWarning")}}:function(){}}).call(this,e("_process"))},{_process:133}],162:[function(e,t,r){(function(r){"use strict";var i=Object.keys||function(e){var t=[];for(var r in e)t.push(r);return t};t.exports=l;var n=e("./_stream_readable"),a=e("./_stream_writable");e("inherits")(l,n);for(var s=i(a.prototype),o=0;o0)if("string"==typeof t||o.objectMode||Object.getPrototypeOf(t)===u.prototype||(t=function(e){return u.from(e)}(t)),i)o.endEmitted?e.emit("error",new v):x(e,o,t,!0);else if(o.ended)e.emit("error",new y);else{if(o.destroyed)return!1;o.reading=!1,o.decoder&&!r?(t=o.decoder.write(t),o.objectMode||0!==t.length?x(e,o,t,!1):M(e,o)):x(e,o,t,!1)}else i||(o.reading=!1,M(e,o));return!o.ended&&(o.lengtht.highWaterMark&&(t.highWaterMark=function(e){return e>=8388608?e=8388608:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function C(e){var r=e._readableState;r.needReadable=!1,r.emittedReadable||(a("emitReadable",r.flowing),r.emittedReadable=!0,t.nextTick(A,e))}function A(e){var t=e._readableState;a("emitReadable_",t.destroyed,t.length,t.ended),t.destroyed||!t.length&&!t.ended||e.emit("readable"),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,D(e)}function M(e,r){r.readingMore||(r.readingMore=!0,t.nextTick(P,e,r))}function P(e,t){for(;!t.reading&&!t.ended&&(t.length0,t.resumeScheduled&&!t.paused?t.flowing=!0:e.listenerCount("data")>0&&e.resume()}function B(e){a("readable nexttick read 0"),e.read(0)}function O(e,t){a("resume",t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit("resume"),D(e),t.flowing&&!t.reading&&e.read(0)}function D(e){var t=e._readableState;for(a("flow",t.flowing);t.flowing&&null!==e.read(););}function L(e,t){return 0===t.length?null:(t.objectMode?r=t.buffer.shift():!e||e>=t.length?(r=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):r=t.buffer.consume(e,t.decoder),r);var r}function F(e){var r=e._readableState;a("endReadable",r.endEmitted),r.endEmitted||(r.ended=!0,t.nextTick(z,r,e))}function z(e,t){a("endReadableNT",e.endEmitted,e.length),e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function N(e,t){for(var r=0,i=e.length;r=t.highWaterMark:t.length>0)||t.ended))return a("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?F(this):C(this),null;if(0===(e=I(e,t))&&t.ended)return 0===t.length&&F(this),null;var i,n=t.needReadable;return a("need readable",n),(0===t.length||t.length-e0?L(e,t):null)?(t.needReadable=!0,e=0):(t.length-=e,t.awaitDrain=0),0===t.length&&(t.ended||(t.needReadable=!0),r!==e&&t.ended&&F(this)),null!==i&&this.emit("data",i),i},T.prototype._read=function(e){this.emit("error",new _("_read()"))},T.prototype.pipe=function(e,r){var i=this,n=this._readableState;switch(n.pipesCount){case 0:n.pipes=e;break;case 1:n.pipes=[n.pipes,e];break;default:n.pipes.push(e)}n.pipesCount+=1,a("pipe count=%d opts=%j",n.pipesCount,r);var o=r&&!1===r.end||e===t.stdout||e===t.stderr?g:l;function u(t,r){a("onunpipe"),t===i&&r&&!1===r.hasUnpiped&&(r.hasUnpiped=!0,a("cleanup"),e.removeListener("close",p),e.removeListener("finish",m),e.removeListener("drain",h),e.removeListener("error",d),e.removeListener("unpipe",u),i.removeListener("end",l),i.removeListener("end",g),i.removeListener("data",f),c=!0,!n.awaitDrain||e._writableState&&!e._writableState.needDrain||h())}function l(){a("onend"),e.end()}n.endEmitted?t.nextTick(o):i.once("end",o),e.on("unpipe",u);var h=function(e){return function(){var t=e._readableState;a("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&s(e,"data")&&(t.flowing=!0,D(e))}}(i);e.on("drain",h);var c=!1;function f(t){a("ondata");var r=e.write(t);a("dest.write",r),!1===r&&((1===n.pipesCount&&n.pipes===e||n.pipesCount>1&&-1!==N(n.pipes,e))&&!c&&(a("false write response, pause",n.awaitDrain),n.awaitDrain++),i.pause())}function d(t){a("onerror",t),g(),e.removeListener("error",d),0===s(e,"error")&&e.emit("error",t)}function p(){e.removeListener("finish",m),g()}function m(){a("onfinish"),e.removeListener("close",p),g()}function g(){a("unpipe"),i.unpipe(e)}return i.on("data",f),function(e,t,r){if("function"==typeof e.prependListener)return e.prependListener(t,r);e._events&&e._events[t]?Array.isArray(e._events[t])?e._events[t].unshift(r):e._events[t]=[r,e._events[t]]:e.on(t,r)}(e,"error",d),e.once("close",p),e.once("finish",m),e.emit("pipe",i),n.flowing||(a("pipe resume"),i.resume()),e},T.prototype.unpipe=function(e){var t=this._readableState,r={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes||(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,r)),this;if(!e){var i=t.pipes,n=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var a=0;a0,!1!==n.flowing&&this.resume()):"readable"===e&&(n.endEmitted||n.readableListening||(n.readableListening=n.needReadable=!0,n.flowing=!1,n.emittedReadable=!1,a("on readable",n.length,n.reading),n.length?C(this):n.reading||t.nextTick(B,this))),i},T.prototype.addListener=T.prototype.on,T.prototype.removeListener=function(e,r){var i=o.prototype.removeListener.call(this,e,r);return"readable"===e&&t.nextTick(R,this),i},T.prototype.removeAllListeners=function(e){var r=o.prototype.removeAllListeners.apply(this,arguments);return"readable"!==e&&void 0!==e||t.nextTick(R,this),r},T.prototype.resume=function(){var e=this._readableState;return e.flowing||(a("resume"),e.flowing=!e.readableListening,function(e,r){r.resumeScheduled||(r.resumeScheduled=!0,t.nextTick(O,e,r))}(this,e)),e.paused=!1,this},T.prototype.pause=function(){return a("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(a("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},T.prototype.wrap=function(e){var t=this,r=this._readableState,i=!1;for(var n in e.on("end",(function(){if(a("wrapped end"),r.decoder&&!r.ended){var e=r.decoder.end();e&&e.length&&t.push(e)}t.push(null)})),e.on("data",(function(n){a("wrapped data"),r.decoder&&(n=r.decoder.write(n)),r.objectMode&&null==n||(r.objectMode||n&&n.length)&&(t.push(n)||(i=!0,e.pause()))})),e)void 0===this[n]&&"function"==typeof e[n]&&(this[n]=function(t){return function(){return e[t].apply(e,arguments)}}(n));for(var s=0;s-1))throw new w(e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(T.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(T.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),T.prototype._write=function(e,t,r){r(new m("_write()"))},T.prototype._writev=null,T.prototype.end=function(e,r,i){var n=this._writableState;return"function"==typeof e?(i=e,e=null,r=null):"function"==typeof r&&(i=r,r=null),null!=e&&this.write(e,r),n.corked&&(n.corked=1,this.uncork()),n.ending||function(e,r,i){r.ending=!0,M(e,r),i&&(r.finished?t.nextTick(i):e.once("finish",i)),r.ended=!0,e.writable=!1}(this,n,i),this},Object.defineProperty(T.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(T.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),T.prototype.destroy=c.destroy,T.prototype._undestroy=c.undestroy,T.prototype._destroy=function(e,t){t(e)}}).call(this,e("_process"),void 0!==t?t:"undefined"!=typeof self?self:void 0!==r?r:{})},{"../errors":160,"./_stream_duplex":162,"./internal/streams/destroy":169,"./internal/streams/state":172,"./internal/streams/stream":173,_process:133,buffer:48,inherits:75,"util-deprecate":183}],167:[function(e,t,r){(function(r){"use strict";var i;function n(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var a=e("./end-of-stream"),s=Symbol("lastResolve"),o=Symbol("lastReject"),u=Symbol("error"),l=Symbol("ended"),h=Symbol("lastPromise"),c=Symbol("handlePromise"),f=Symbol("stream");function d(e,t){return{value:e,done:t}}function p(e){var t=e[s];if(null!==t){var r=e[f].read();null!==r&&(e[h]=null,e[s]=null,e[o]=null,t(d(r,!1)))}}function m(e){r.nextTick(p,e)}var g=Object.getPrototypeOf((function(){})),b=Object.setPrototypeOf((n(i={get stream(){return this[f]},next:function(){var e=this,t=this[u];if(null!==t)return Promise.reject(t);if(this[l])return Promise.resolve(d(void 0,!0));if(this[f].destroyed)return new Promise((function(t,i){r.nextTick((function(){e[u]?i(e[u]):t(d(void 0,!0))}))}));var i,n=this[h];if(n)i=new Promise(function(e,t){return function(r,i){e.then((function(){t[l]?r(d(void 0,!0)):t[c](r,i)}),i)}}(n,this));else{var a=this[f].read();if(null!==a)return Promise.resolve(d(a,!1));i=new Promise(this[c])}return this[h]=i,i}},Symbol.asyncIterator,(function(){return this})),n(i,"return",(function(){var e=this;return new Promise((function(t,r){e[f].destroy(null,(function(e){e?r(e):t(d(void 0,!0))}))}))})),i),g);t.exports=function(e){var t,r=Object.create(b,(n(t={},f,{value:e,writable:!0}),n(t,s,{value:null,writable:!0}),n(t,o,{value:null,writable:!0}),n(t,u,{value:null,writable:!0}),n(t,l,{value:e._readableState.endEmitted,writable:!0}),n(t,c,{value:function(e,t){var i=r[f].read();i?(r[h]=null,r[s]=null,r[o]=null,e(d(i,!1))):(r[s]=e,r[o]=t)},writable:!0}),t));return r[h]=null,a(e,(function(e){if(e&&"ERR_STREAM_PREMATURE_CLOSE"!==e.code){var t=r[o];return null!==t&&(r[h]=null,r[s]=null,r[o]=null,t(e)),void(r[u]=e)}var i=r[s];null!==i&&(r[h]=null,r[s]=null,r[o]=null,i(d(void 0,!0))),r[l]=!0})),e.on("readable",m.bind(null,r)),r}}).call(this,e("_process"))},{"./end-of-stream":170,_process:133}],168:[function(e,t,r){"use strict";function i(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var n=e("buffer").Buffer,a=e("util").inspect,s=a&&a.custom||"inspect";t.exports=function(){function e(){this.head=null,this.tail=null,this.length=0}var t=e.prototype;return t.push=function(e){var t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length},t.unshift=function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length},t.shift=function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}},t.clear=function(){this.head=this.tail=null,this.length=0},t.join=function(e){if(0===this.length)return"";for(var t=this.head,r=""+t.data;t=t.next;)r+=e+t.data;return r},t.concat=function(e){if(0===this.length)return n.alloc(0);for(var t,r,i,a=n.allocUnsafe(e>>>0),s=this.head,o=0;s;)t=s.data,r=a,i=o,n.prototype.copy.call(t,r,i),o+=s.data.length,s=s.next;return a},t.consume=function(e,t){var r;return en.length?n.length:e;if(a===n.length?i+=n:i+=n.slice(0,e),0==(e-=a)){a===n.length?(++r,t.next?this.head=t.next:this.head=this.tail=null):(this.head=t,t.data=n.slice(a));break}++r}return this.length-=r,i},t._getBuffer=function(e){var t=n.allocUnsafe(e),r=this.head,i=1;for(r.data.copy(t),e-=r.data.length;r=r.next;){var a=r.data,s=e>a.length?a.length:e;if(a.copy(t,t.length-e,0,s),0==(e-=s)){s===a.length?(++i,r.next?this.head=r.next:this.head=this.tail=null):(this.head=r,r.data=a.slice(s));break}++i}return this.length-=i,t},t[s]=function(e,t){return a(this,function(e){for(var t=1;t0,(function(e){i||(i=e),e&&s.forEach(l),a||(s.forEach(l),n(i))}))}));return t.reduce(h)}},{"../../../errors":160,"./end-of-stream":170}],172:[function(e,t,r){"use strict";var i=e("../../../errors").codes.ERR_INVALID_OPT_VALUE;t.exports={getHighWaterMark:function(e,t,r,n){var a=function(e,t,r){return null!=e.highWaterMark?e.highWaterMark:t?e[r]:null}(t,n,r);if(null!=a){if(!isFinite(a)||Math.floor(a)!==a||a<0)throw new i(n?r:"highWaterMark",a);return Math.floor(a)}return e.objectMode?16:16384}}},{"../../../errors":160}],173:[function(e,t,r){arguments[4][146][0].apply(r,arguments)},{dup:146,events:52}],174:[function(e,t,r){(r=t.exports=e("./lib/_stream_readable.js")).Stream=r,r.Readable=r,r.Writable=e("./lib/_stream_writable.js"),r.Duplex=e("./lib/_stream_duplex.js"),r.Transform=e("./lib/_stream_transform.js"),r.PassThrough=e("./lib/_stream_passthrough.js"),r.finished=e("./lib/internal/streams/end-of-stream.js"),r.pipeline=e("./lib/internal/streams/pipeline.js")},{"./lib/_stream_duplex.js":162,"./lib/_stream_passthrough.js":163,"./lib/_stream_readable.js":164,"./lib/_stream_transform.js":165,"./lib/_stream_writable.js":166,"./lib/internal/streams/end-of-stream.js":170,"./lib/internal/streams/pipeline.js":171}],175:[function(e,t,r){arguments[4][148][0].apply(r,arguments)},{dup:148,"safe-buffer":154}],176:[function(e,t,i){(function(t,n){var a=e("process/browser.js").nextTick,s=Function.prototype.apply,o=Array.prototype.slice,u={},l=0;function h(e,t){this._id=e,this._clearFn=t}i.setTimeout=function(){return new h(s.call(setTimeout,r,arguments),clearTimeout)},i.setInterval=function(){return new h(s.call(setInterval,r,arguments),clearInterval)},i.clearTimeout=i.clearInterval=function(e){e.close()},h.prototype.unref=h.prototype.ref=function(){},h.prototype.close=function(){this._clearFn.call(r,this._id)},i.enroll=function(e,t){clearTimeout(e._idleTimeoutId),e._idleTimeout=t},i.unenroll=function(e){clearTimeout(e._idleTimeoutId),e._idleTimeout=-1},i._unrefActive=i.active=function(e){clearTimeout(e._idleTimeoutId);var t=e._idleTimeout;t>=0&&(e._idleTimeoutId=setTimeout((function(){e._onTimeout&&e._onTimeout()}),t))},i.setImmediate="function"==typeof t?t:function(e){var t=l++,r=!(arguments.length<2)&&o.call(arguments,1);return u[t]=!0,a((function(){u[t]&&(r?e.apply(null,r):e.call(null),i.clearImmediate(t))})),t},i.clearImmediate="function"==typeof n?n:function(e){delete u[e]}}).call(this,e("timers").setImmediate,e("timers").clearImmediate)},{"process/browser.js":133,timers:176}],177:[function(e,t,r){(function(e){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};function i(e){throw new Error(e)}function n(e){var t=Object.keys(e);return Object.getOwnPropertySymbols?t.concat(Object.getOwnPropertySymbols(e)):t}r.clone=s,r.addLast=l,r.addFirst=h,r.removeLast=c,r.removeFirst=f,r.insert=d,r.removeAt=p,r.replaceAt=m,r.getIn=g,r.set=b,r.setIn=y,r.update=_,r.updateIn=v,r.merge=w,r.mergeDeep=E,r.mergeIn=k,r.omit=T,r.addDefaults=S;var a={}.hasOwnProperty;function s(e){if(Array.isArray(e))return e.slice();for(var t=n(e),r={},i=0;i3?c-3:0),d=3;d=e.length||t<0?e:e.slice(0,t).concat(e.slice(t+1))}function m(e,t,r){if(e[t]===r)return e;for(var i=e.length,n=Array(i),a=0;a6?s-6:0),l=6;l6?s-6:0),l=6;l7?l-7:0),c=7;c=0||(o[h]=e[h])}return o}function S(e,t,r,i,n,a){for(var s=arguments.length,u=Array(s>6?s-6:0),l=6;l1&&(r-=1),r<1/6?e+6*(t-e)*r:r<.5?t:r<2/3?e+(t-e)*(2/3-r)*6:e}if(e=P(e,360),t=P(t,100),r=P(r,100),0===t)i=n=a=r;else{var o=r<.5?r*(1+t):r+t-r*t,u=2*r-o;i=s(u,o,e+1/3),n=s(u,o,e),a=s(u,o,e-1/3)}return{r:255*i,g:255*n,b:255*a}}(t.h,s,h),c=!0,f="hsl"),t.hasOwnProperty("a")&&(a=t.a)),a=M(a),{ok:c,format:t.format||f,r:o(255,u(r.r,0)),g:o(255,u(r.g,0)),b:o(255,u(r.b,0)),a:a}}(t);this._originalInput=t,this._r=l.r,this._g=l.g,this._b=l.b,this._a=l.a,this._roundA=s(100*this._a)/100,this._format=r.format||l.format,this._gradientType=r.gradientType,this._r<1&&(this._r=s(this._r)),this._g<1&&(this._g=s(this._g)),this._b<1&&(this._b=s(this._b)),this._ok=l.ok,this._tc_id=a++}function c(e,t,r){e=P(e,255),t=P(t,255),r=P(r,255);var i,n,a=u(e,t,r),s=o(e,t,r),l=(a+s)/2;if(a==s)i=n=0;else{var h=a-s;switch(n=l>.5?h/(2-a-s):h/(a+s),a){case e:i=(t-r)/h+(t>1)+720)%360;--t;)i.h=(i.h+n)%360,a.push(h(i));return a}function I(e,t){t=t||6;for(var r=h(e).toHsv(),i=r.h,n=r.s,a=r.v,s=[],o=1/t;t--;)s.push(h({h:i,s:n,v:a})),a=(a+o)%1;return s}h.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var e=this.toRgb();return(299*e.r+587*e.g+114*e.b)/1e3},getLuminance:function(){var t,r,i,n=this.toRgb();return t=n.r/255,r=n.g/255,i=n.b/255,.2126*(t<=.03928?t/12.92:e.pow((t+.055)/1.055,2.4))+.7152*(r<=.03928?r/12.92:e.pow((r+.055)/1.055,2.4))+.0722*(i<=.03928?i/12.92:e.pow((i+.055)/1.055,2.4))},setAlpha:function(e){return this._a=M(e),this._roundA=s(100*this._a)/100,this},toHsv:function(){var e=f(this._r,this._g,this._b);return{h:360*e.h,s:e.s,v:e.v,a:this._a}},toHsvString:function(){var e=f(this._r,this._g,this._b),t=s(360*e.h),r=s(100*e.s),i=s(100*e.v);return 1==this._a?"hsv("+t+", "+r+"%, "+i+"%)":"hsva("+t+", "+r+"%, "+i+"%, "+this._roundA+")"},toHsl:function(){var e=c(this._r,this._g,this._b);return{h:360*e.h,s:e.s,l:e.l,a:this._a}},toHslString:function(){var e=c(this._r,this._g,this._b),t=s(360*e.h),r=s(100*e.s),i=s(100*e.l);return 1==this._a?"hsl("+t+", "+r+"%, "+i+"%)":"hsla("+t+", "+r+"%, "+i+"%, "+this._roundA+")"},toHex:function(e){return d(this._r,this._g,this._b,e)},toHexString:function(e){return"#"+this.toHex(e)},toHex8:function(e){return function(e,t,r,i,n){var a=[O(s(e).toString(16)),O(s(t).toString(16)),O(s(r).toString(16)),O(L(i))];return n&&a[0].charAt(0)==a[0].charAt(1)&&a[1].charAt(0)==a[1].charAt(1)&&a[2].charAt(0)==a[2].charAt(1)&&a[3].charAt(0)==a[3].charAt(1)?a[0].charAt(0)+a[1].charAt(0)+a[2].charAt(0)+a[3].charAt(0):a.join("")}(this._r,this._g,this._b,this._a,e)},toHex8String:function(e){return"#"+this.toHex8(e)},toRgb:function(){return{r:s(this._r),g:s(this._g),b:s(this._b),a:this._a}},toRgbString:function(){return 1==this._a?"rgb("+s(this._r)+", "+s(this._g)+", "+s(this._b)+")":"rgba("+s(this._r)+", "+s(this._g)+", "+s(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:s(100*P(this._r,255))+"%",g:s(100*P(this._g,255))+"%",b:s(100*P(this._b,255))+"%",a:this._a}},toPercentageRgbString:function(){return 1==this._a?"rgb("+s(100*P(this._r,255))+"%, "+s(100*P(this._g,255))+"%, "+s(100*P(this._b,255))+"%)":"rgba("+s(100*P(this._r,255))+"%, "+s(100*P(this._g,255))+"%, "+s(100*P(this._b,255))+"%, "+this._roundA+")"},toName:function(){return 0===this._a?"transparent":!(this._a<1)&&(A[d(this._r,this._g,this._b,!0)]||!1)},toFilter:function(e){var t="#"+p(this._r,this._g,this._b,this._a),r=t,i=this._gradientType?"GradientType = 1, ":"";if(e){var n=h(e);r="#"+p(n._r,n._g,n._b,n._a)}return"progid:DXImageTransform.Microsoft.gradient("+i+"startColorstr="+t+",endColorstr="+r+")"},toString:function(e){var t=!!e;e=e||this._format;var r=!1,i=this._a<1&&this._a>=0;return t||!i||"hex"!==e&&"hex6"!==e&&"hex3"!==e&&"hex4"!==e&&"hex8"!==e&&"name"!==e?("rgb"===e&&(r=this.toRgbString()),"prgb"===e&&(r=this.toPercentageRgbString()),"hex"!==e&&"hex6"!==e||(r=this.toHexString()),"hex3"===e&&(r=this.toHexString(!0)),"hex4"===e&&(r=this.toHex8String(!0)),"hex8"===e&&(r=this.toHex8String()),"name"===e&&(r=this.toName()),"hsl"===e&&(r=this.toHslString()),"hsv"===e&&(r=this.toHsvString()),r||this.toHexString()):"name"===e&&0===this._a?this.toName():this.toRgbString()},clone:function(){return h(this.toString())},_applyModification:function(e,t){var r=e.apply(null,[this].concat([].slice.call(t)));return this._r=r._r,this._g=r._g,this._b=r._b,this.setAlpha(r._a),this},lighten:function(){return this._applyModification(y,arguments)},brighten:function(){return this._applyModification(_,arguments)},darken:function(){return this._applyModification(v,arguments)},desaturate:function(){return this._applyModification(m,arguments)},saturate:function(){return this._applyModification(g,arguments)},greyscale:function(){return this._applyModification(b,arguments)},spin:function(){return this._applyModification(w,arguments)},_applyCombination:function(e,t){return e.apply(null,[this].concat([].slice.call(t)))},analogous:function(){return this._applyCombination(x,arguments)},complement:function(){return this._applyCombination(E,arguments)},monochromatic:function(){return this._applyCombination(I,arguments)},splitcomplement:function(){return this._applyCombination(S,arguments)},triad:function(){return this._applyCombination(k,arguments)},tetrad:function(){return this._applyCombination(T,arguments)}},h.fromRatio=function(e,t){if("object"==typeof e){var r={};for(var i in e)e.hasOwnProperty(i)&&(r[i]="a"===i?e[i]:D(e[i]));e=r}return h(e,t)},h.equals=function(e,t){return!(!e||!t)&&h(e).toRgbString()==h(t).toRgbString()},h.random=function(){return h.fromRatio({r:l(),g:l(),b:l()})},h.mix=function(e,t,r){r=0===r?0:r||50;var i=h(e).toRgb(),n=h(t).toRgb(),a=r/100;return h({r:(n.r-i.r)*a+i.r,g:(n.g-i.g)*a+i.g,b:(n.b-i.b)*a+i.b,a:(n.a-i.a)*a+i.a})},h.readability=function(t,r){var i=h(t),n=h(r);return(e.max(i.getLuminance(),n.getLuminance())+.05)/(e.min(i.getLuminance(),n.getLuminance())+.05)},h.isReadable=function(e,t,r){var i,n,a,s,o,u=h.readability(e,t);switch(n=!1,(a=r,s=((a=a||{level:"AA",size:"small"}).level||"AA").toUpperCase(),o=(a.size||"small").toLowerCase(),"AA"!==s&&"AAA"!==s&&(s="AA"),"small"!==o&&"large"!==o&&(o="small"),i={level:s,size:o}).level+i.size){case"AAsmall":case"AAAlarge":n=u>=4.5;break;case"AAlarge":n=u>=3;break;case"AAAsmall":n=u>=7}return n},h.mostReadable=function(e,t,r){var i,n,a,s,o=null,u=0;n=(r=r||{}).includeFallbackColors,a=r.level,s=r.size;for(var l=0;lu&&(u=i,o=h(t[l]));return h.isReadable(e,o,{level:a,size:s})||!n?o:(r.includeFallbackColors=!1,h.mostReadable(e,["#fff","#000"],r))};var C=h.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},A=h.hexNames=function(e){var t={};for(var r in e)e.hasOwnProperty(r)&&(t[e[r]]=r);return t}(C);function M(e){return e=parseFloat(e),(isNaN(e)||e<0||e>1)&&(e=1),e}function P(t,r){(function(e){return"string"==typeof e&&-1!=e.indexOf(".")&&1===parseFloat(e)})(t)&&(t="100%");var i=function(e){return"string"==typeof e&&-1!=e.indexOf("%")}(t);return t=o(r,u(0,parseFloat(t))),i&&(t=parseInt(t*r,10)/100),e.abs(t-r)<1e-6?1:t%r/parseFloat(r)}function R(e){return o(1,u(0,e))}function B(e){return parseInt(e,16)}function O(e){return 1==e.length?"0"+e:""+e}function D(e){return e<=1&&(e=100*e+"%"),e}function L(t){return e.round(255*parseFloat(t)).toString(16)}function F(e){return B(e)/255}var z,N,U,j=(N="[\\s|\\(]+("+(z="(?:[-\\+]?\\d*\\.\\d+%?)|(?:[-\\+]?\\d+%?)")+")[,|\\s]+("+z+")[,|\\s]+("+z+")\\s*\\)?",U="[\\s|\\(]+("+z+")[,|\\s]+("+z+")[,|\\s]+("+z+")[,|\\s]+("+z+")\\s*\\)?",{CSS_UNIT:new RegExp(z),rgb:new RegExp("rgb"+N),rgba:new RegExp("rgba"+U),hsl:new RegExp("hsl"+N),hsla:new RegExp("hsla"+U),hsv:new RegExp("hsv"+N),hsva:new RegExp("hsva"+U),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/});function G(e){return!!j.CSS_UNIT.exec(e)}void 0!==t&&t.exports?t.exports=h:r.tinycolor=h}(Math)},{}],179:[function(e,t,r){(r=t.exports=function(e){return e.replace(/^\s*|\s*$/g,"")}).left=function(e){return e.replace(/^\s*/,"")},r.right=function(e){return e.replace(/\s*$/,"")}},{}],180:[function(e,t,r){"use strict";var i=e("punycode"),n=e("./util");function a(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}r.parse=_,r.resolve=function(e,t){return _(e,!1,!0).resolve(t)},r.resolveObject=function(e,t){return e?_(e,!1,!0).resolveObject(t):t},r.format=function(e){return n.isString(e)&&(e=_(e)),e instanceof a?e.format():a.prototype.format.call(e)},r.Url=a;var s=/^([a-z0-9.+-]+:)/i,o=/:[0-9]*$/,u=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,l=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r","\n","\t"]),h=["'"].concat(l),c=["%","/","?",";","#"].concat(h),f=["/","?","#"],d=/^[+a-z0-9A-Z_-]{0,63}$/,p=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,m={javascript:!0,"javascript:":!0},g={javascript:!0,"javascript:":!0},b={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},y=e("querystring");function _(e,t,r){if(e&&n.isObject(e)&&e instanceof a)return e;var i=new a;return i.parse(e,t,r),i}a.prototype.parse=function(e,t,r){if(!n.isString(e))throw new TypeError("Parameter 'url' must be a string, not "+typeof e);var a=e.indexOf("?"),o=-1!==a&&a127?B+="x":B+=R[O];if(!B.match(d)){var L=M.slice(0,I),F=M.slice(I+1),z=R.match(p);z&&(L.push(z[1]),F.unshift(z[2])),F.length&&(_="/"+F.join(".")+_),this.hostname=L.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),A||(this.hostname=i.toASCII(this.hostname));var N=this.port?":"+this.port:"",U=this.hostname||"";this.host=U+N,this.href+=this.host,A&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==_[0]&&(_="/"+_))}if(!m[E])for(I=0,P=h.length;I0)&&r.host.split("@"))&&(r.auth=A.shift(),r.host=r.hostname=A.shift())),r.search=e.search,r.query=e.query,n.isNull(r.pathname)&&n.isNull(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.href=r.format(),r;if(!k.length)return r.pathname=null,r.search?r.path="/"+r.search:r.path=null,r.href=r.format(),r;for(var S=k.slice(-1)[0],x=(r.host||e.host||k.length>1)&&("."===S||".."===S)||""===S,I=0,C=k.length;C>=0;C--)"."===(S=k[C])?k.splice(C,1):".."===S?(k.splice(C,1),I++):I&&(k.splice(C,1),I--);if(!w&&!E)for(;I--;I)k.unshift("..");!w||""===k[0]||k[0]&&"/"===k[0].charAt(0)||k.unshift(""),x&&"/"!==k.join("/").substr(-1)&&k.push("");var A,M=""===k[0]||k[0]&&"/"===k[0].charAt(0);return T&&(r.hostname=r.host=M?"":k.length?k.shift():"",(A=!!(r.host&&r.host.indexOf("@")>0)&&r.host.split("@"))&&(r.auth=A.shift(),r.host=r.hostname=A.shift())),(w=w||r.host&&k.length)&&!M&&k.unshift(""),k.length?r.pathname=k.join("/"):(r.pathname=null,r.path=null),n.isNull(r.pathname)&&n.isNull(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.auth=e.auth||r.auth,r.slashes=r.slashes||e.slashes,r.href=r.format(),r},a.prototype.parseHost=function(){var e=this.host,t=o.exec(e);t&&(":"!==(t=t[0])&&(this.port=t.substr(1)),e=e.substr(0,e.length-t.length)),e&&(this.hostname=e)}},{"./util":181,punycode:134,querystring:137}],181:[function(e,t,r){"use strict";t.exports={isString:function(e){return"string"==typeof e},isObject:function(e){return"object"==typeof e&&null!==e},isNull:function(e){return null===e},isNullOrUndefined:function(e){return null==e}}},{}],182:[function(e,t,r){(function(r){!function(){var i={};function n(){void 0!==r&&"development"!=r.env.NODE_ENV||console.log.apply(console,arguments)}"object"==typeof t?t.exports=i:self.UTIF=i,function(e,t){var r,i,a;r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i=function(){function e(e){this.message="JPEG error: "+e}return e.prototype=Error(),e.prototype.name="JpegError",e.constructor=e}(),a=function(){function e(e,t){this.message=e,this.g=t}return e.prototype=Error(),e.prototype.name="DNLMarkerError",e.constructor=e}(),function(){function t(){this.M=null,this.B=-1}function n(e,t){for(var r,i,n=0,a=[],s=16;0>O&1;if(255===(B=e[t++])){var r=e[t++];if(r){if(220===r&&M){t+=2;var s=e[t++]<<8|e[t++];if(0>>7}function m(e){for(;;){if("number"==typeof(e=e[p()]))return e;if("object"!==(void 0===e?"undefined":r(e)))throw new i("invalid huffman sequence")}}function g(e){for(var t=0;0=1<r;){var i=m(e.o),n=15&i;if(i>>=4,0===n){if(15>i)break;r+=16}else r+=i,e.a[t+l[r]]=b(n),r++}}function _(e,t){var r=m(e.D);r=0===r?0:b(r)<>=4,0===n){if(15>i){D=g(i)+(1<e.a[r]?-1:1;switch(L){case 0:if(r=15&(a=m(e.o)),a>>=4,0===r)15>a?(D=g(a)+(1<=G)throw new i("marker was not found");if(!(65488<=G&&65495>=G))break;t+=2}return(G=u(e,t))&&G.f&&((0,_util.warn)("decodeScan - unexpected Scan data, current marker is: "+G.f),t=G.offset),t-R}function o(e,t){for(var r=t.c,n=t.l,a=new Int16Array(64),s=0;sf;f+=8){var d=c[u+f],p=c[u+f+1],m=c[u+f+2],g=c[u+f+3],b=c[u+f+4],y=c[u+f+5],_=c[u+f+6],v=c[u+f+7];if(d*=h[f],0==(p|m|g|b|y|_|v))d=5793*d+512>>10,l[f]=d,l[f+1]=d,l[f+2]=d,l[f+3]=d,l[f+4]=d,l[f+5]=d,l[f+6]=d,l[f+7]=d;else{p*=h[f+1],m*=h[f+2],g*=h[f+3],b*=h[f+4],y*=h[f+5];var w=5793*d+128>>8,E=5793*b+128>>8,k=m,T=_*=h[f+6];E=(w=w+E+1>>1)-E,d=3784*k+1567*T+128>>8,k=1567*k-3784*T+128>>8,y=(b=(b=2896*(p-(v*=h[f+7]))+128>>8)+(y<<=4)+1>>1)-y,g=(v=(v=2896*(p+v)+128>>8)+(g<<=4)+1>>1)-g,T=(w=w+(T=d)+1>>1)-T,k=(E=E+k+1>>1)-k,d=2276*b+3406*v+2048>>12,b=3406*b-2276*v+2048>>12,v=d,d=799*g+4017*y+2048>>12,g=4017*g-799*y+2048>>12,y=d,l[f]=w+v,l[f+7]=w-v,l[f+1]=E+y,l[f+6]=E-y,l[f+2]=k+g,l[f+5]=k-g,l[f+3]=T+b,l[f+4]=T-b}}for(h=0;8>h;++h)d=l[h],0==((p=l[h+8])|(m=l[h+16])|(g=l[h+24])|(b=l[h+32])|(y=l[h+40])|(_=l[h+48])|(v=l[h+56]))?(d=-2040>(d=5793*d+8192>>14)?0:2024<=d?255:d+2056>>4,c[u+h]=d,c[u+h+8]=d,c[u+h+16]=d,c[u+h+24]=d,c[u+h+32]=d,c[u+h+40]=d,c[u+h+48]=d,c[u+h+56]=d):(w=5793*d+2048>>12,E=5793*b+2048>>12,d=3784*(k=m)+1567*(T=_)+2048>>12,k=1567*k-3784*T+2048>>12,T=d,y=(b=(b=2896*(p-v)+2048>>12)+y+1>>1)-y,g=(v=(v=2896*(p+v)+2048>>12)+g+1>>1)-g,d=2276*b+3406*v+2048>>12,b=3406*b-2276*v+2048>>12,v=d,d=799*g+4017*y+2048>>12,g=4017*g-799*y+2048>>12,p=(E=(E=(w=4112+(w+E+1>>1))-E)+k+1>>1)+(y=d),_=E-y,y=(k=E-k)-g,d=16>(d=(w=w+T+1>>1)+v)?0:4080<=d?255:d>>4,p=16>p?0:4080<=p?255:p>>4,m=16>(m=k+g)?0:4080<=m?255:m>>4,g=16>(g=(T=w-T)+b)?0:4080<=g?255:g>>4,b=16>(b=T-b)?0:4080<=b?255:b>>4,y=16>y?0:4080<=y?255:y>>4,_=16>_?0:4080<=_?255:_>>4,v=16>(v=w-v)?0:4080<=v?255:v>>4,c[u+h]=d,c[u+h+8]=p,c[u+h+16]=m,c[u+h+24]=g,c[u+h+32]=b,c[u+h+40]=y,c[u+h+48]=_,c[u+h+56]=v)}return t.a}function u(e,t){var r=2=i)return null;var n=e[t]<<8|e[t+1];if(65472<=n&&65534>=n)return{f:null,F:n,offset:t};for(var a=e[r]<<8|e[r+1];!(65472<=a&&65534>=a);){if(++r>=i)return null;a=e[r]<<8|e[r+1]}return{f:n.toString(16),F:a,offset:r}}var l=new Uint8Array([0,1,8,16,9,2,3,10,17,24,32,25,18,11,4,5,12,19,26,33,40,48,41,34,27,20,13,6,7,14,21,28,35,42,49,56,57,50,43,36,29,22,15,23,30,37,44,51,58,59,52,45,38,31,39,46,53,60,61,54,47,55,62,63]);t.prototype={parse:function(e){function t(){var t=e[d]<<8|e[d+1];return d+=2,t}function r(){var r=t(),i=u(e,r=d+r-2,d);return i&&i.f&&((0,_util.warn)("readDataBlock - incorrect length, current marker is: "+i.f),r=i.offset),r=e.subarray(d,r),d+=r.length,r}function h(e){for(var t=Math.ceil(e.v/8/e.s),r=Math.ceil(e.g/8/e.u),i=0;i>4)for(_=0;64>_;_++)E[v=l[_]]=e[d++];else{if(1!=w>>4)throw new i("DQT - invalid table spec");for(_=0;64>_;_++)E[v=l[_]]=t()}c[15&w]=E}break;case 65472:case 65473:case 65474:if(k)throw new i("Only single frame JPEGs supported");t();var k={};for(k.X=65473===y,k.S=65474===y,k.precision=e[d++],y=t(),k.g=f||y,k.v=t(),k.b=[],k.C={},_=e[d++],y=E=w=0;y<_;y++){v=e[d];var T=e[d+1]>>4,S=15&e[d+1];w_;_++,d++)T+=E[_]=e[d];for(S=new Uint8Array(T),_=0;_>4?b:g)[15&w]=n(E,S)}break;case 65501:t();var x=t();break;case 65498:for(_=1==++m&&!f,t(),w=e[d++],v=[],y=0;y>4],I.o=g[15&E],v.push(I)}y=e[d++],w=e[d++],E=e[d++];try{var C=s(e,d,k,v,x,y,w,E>>4,15&E,_);d+=C}catch(t){if(t instanceof a)return(0,_util.warn)('Attempting to re-parse JPEG image using "scanLines" parameter found in DNL marker (0xFFDC) segment.'),this.parse(e,{N:t.g});throw t}break;case 65500:d+=4;break;case 65535:255!==e[d]&&d--;break;default:if(255===e[d-3]&&192<=e[d-2]&&254>=e[d-2])d-=3;else{if(!(_=u(e,d-2))||!_.f)throw new i("unknown marker "+y.toString(16));(0,_util.warn)("JpegImage.parse - unexpected data, current marker is: "+_.f),d=_.offset}}y=t()}for(this.width=k.v,this.height=k.g,this.A=p,this.b=[],y=0;y>8)+a[n+1];return u},w:function(){return this.A?!!this.A.W:3===this.i?0!==this.B:1===this.B},I:function(e){for(var t,r,i,n=0,a=e.length;n>>3)]),null==d&&(d=o.t325);var p=new Uint8Array(o.height*(c>>>3)),m=0;if(null!=o.t322){for(var g=o.t322[0],b=o.t323[0],y=Math.floor((o.width+g-1)/g),_=Math.floor((o.height+b-1)/b),v=new Uint8Array(0|Math.ceil(g*b*h/8)),w=0;w<_;w++)for(var E=0;E>>8;else{if(12!=p)throw new Error("unsupported bit depth "+p);for(c=0;c>>4,a[s++]=255&(m[c]<<4|m[c+1]>>>8),a[s++]=255&m[c+1]}}else{var b=new e.JpegDecoder;b.parse(l);var y=b.getData(b.width,b.height);for(c=0;c1),!f){if(255==t[r]&&216==t[r+1])return{jpegOffset:r};if(null!=d&&(255==t[r+p]&&216==t[r+p+1]?h=r+p:n("JPEGInterchangeFormat does not point to SOI"),null==m?n("JPEGInterchangeFormatLength field is missing"):(p>=c||p+g<=c)&&n("JPEGInterchangeFormatLength field value is invalid"),null!=h))return{jpegOffset:h}}if(null!=y&&(_=y[0],v=y[1]),null!=d&&null!=m)if(g>=2&&p+g<=c){for(a=255==t[r+p+g-2]&&216==t[r+p+g-1]?new Uint8Array(g-2):new Uint8Array(g),o=0;o offset to first strip or tile");if(null==a){var k=0,T=[];T[k++]=255,T[k++]=216;var S=e.t519;if(null==S)throw new Error("JPEGQTables tag is missing");for(o=0;o>>8,T[k++]=255&I,T[k++]=o|l<<4,u=0;u<16;u++)T[k++]=t[r+x[o]+u];for(u=0;u>>8&255,T[k++]=255&e.height,T[k++]=e.width>>>8&255,T[k++]=255&e.width,T[k++]=w,1==w)T[k++]=1,T[k++]=17,T[k++]=0;else for(o=0;o<3;o++)T[k++]=o+1,T[k++]=0!=o?17:(15&_)<<4|15&v,T[k++]=o;null!=E&&0!=E[0]&&(T[k++]=255,T[k++]=221,T[k++]=0,T[k++]=4,T[k++]=E[0]>>>8&255,T[k++]=255&E[0]),a=new Uint8Array(T)}var C=-1;for(o=0;o>>8&255,a[M++]=255&e.height,a[M++]=e.width>>>8&255,a[M++]=255&e.width,a[M++]=w,1==w)a[M++]=1,a[M++]=17,a[M++]=0;else for(o=0;o<3;o++)a[M++]=o+1,a[M++]=0!=o?17:(15&_)<<4|15&v,a[M++]=o}if(255==t[c]&&218==t[c+1]){var P=t[c+2]<<8|t[c+3];for((s=new Uint8Array(P+2))[0]=t[c],s[1]=t[c+1],s[2]=t[c+2],s[3]=t[c+3],o=0;o>>8&255,l[h.sofPosition+6]=255&t.height,l[h.sofPosition+7]=t.width>>>8&255,l[h.sofPosition+8]=255&t.width,255==r[i]&&r[i+1]==SOS||(l.set(h.sosMarker,bufoff),bufoff+=sosMarker.length),d=0;d=0&&u<128)for(var l=0;l=-127&&u<0){for(l=0;l<1-u;l++)s[n]=a[t],n++;t++}}},e.decode._decodeThunder=function(e,t,r,i,n){for(var a=[0,1,0,-1],s=[0,1,2,3,0,-3,-2,-1],o=t+r,u=2*n,l=0;t>>6,f=63&h;if(t++,3==c&&(l=15&f,i[u>>>1]|=l<<4*(1-u&1),u++),0==c)for(var d=0;d>>1]|=l<<4*(1-u&1),u++;if(2==c)for(d=0;d<2;d++)4!=(p=f>>>3*(1-d)&7)&&(l+=s[p],i[u>>>1]|=l<<4*(1-u&1),u++);if(1==c)for(d=0;d<3;d++){var p;2!=(p=f>>>2*(2-d)&3)&&(l+=a[p],i[u>>>1]|=l<<4*(1-u&1),u++)}}},e.decode._dmap={1:0,"011":1,"000011":2,"0000011":3,"010":-1,"000010":-2,"0000010":-3},e.decode._lens=function(){var e=function(e,t,r,i){for(var n=0;n>>3>>3]>>>7-(7&l)&1),2==o&&(T=t[l>>>3]>>>(7&l)&1),l++,c+=T,"H"==w){if(null!=u._lens[_][c]){var S=u._lens[_][c];c="",h+=S,S<64&&(u._addNtimes(f,h,_),m+=h,_=1-_,h=0,0==--E&&(w=""))}}else"0001"==c&&(c="",u._addNtimes(f,y-m,_),m=y),"001"==c&&(c="",w="H",E=2),null!=u._dmap[c]&&(g=b+u._dmap[c],u._addNtimes(f,g-m,_),m=g,c="",_=1-_);f.length==s&&""==w&&(u._writeBits(f,n,8*a+v*k),_=0,v++,m=0,d=u._makeDiff(f),f=[])}},e.decode._findDiff=function(e,t,r){for(var i=0;i=t&&e[i+1]==r)return e[i]},e.decode._makeDiff=function(e){var t=[];1==e[0]&&t.push(0,1);for(var r=1;r>>3>>3]>>>7-(7&l)&1),2==o&&(S=t[l>>>3]>>>(7&l)&1),l++,c+=S,k){if(null!=u._lens[_][c]){var x=u._lens[_][c];c="",h+=x,x<64&&(u._addNtimes(f,h,_),_=1-_,h=0)}}else"H"==w?null!=u._lens[_][c]&&(x=u._lens[_][c],c="",h+=x,x<64&&(u._addNtimes(f,h,_),m+=h,_=1-_,h=0,0==--E&&(w=""))):("0001"==c&&(c="",u._addNtimes(f,y-m,_),m=y),"001"==c&&(c="",w="H",E=2),null!=u._dmap[c]&&(g=b+u._dmap[c],u._addNtimes(f,g-m,_),m=g,c="",_=1-_));c.endsWith("000000000001")&&(v>=0&&u._writeBits(f,n,8*a+v*T),1==o&&(k=1==(t[l>>>3]>>>7-(7&l)&1)),2==o&&(k=1==(t[l>>>3]>>>(7&l)&1)),l++,null==u._decodeG3.allow2D&&(u._decodeG3.allow2D=k),u._decodeG3.allow2D||(k=!0,l--),c="",_=0,v++,m=0,d=u._makeDiff(f),f=[])}f.length==s&&u._writeBits(f,n,8*a+v*T)},e.decode._addNtimes=function(e,t,r){for(var i=0;i>>3]|=e[i]<<7-(r+i&7)},e.decode._decodeLZW=function(t,r,i,n){if(null==e.decode._lzwTab){for(var a=new Uint32Array(65535),s=new Uint16Array(65535),o=new Uint8Array(2e6),u=0;u<256;u++)o[u<<2]=u,a[u]=u<<2,s[u]=1;e.decode._lzwTab=[a,s,o]}for(var l=e.decode._copyData,h=e.decode._lzwTab[0],c=e.decode._lzwTab[1],f=(o=e.decode._lzwTab[2],258),d=1032,p=9,m=r<<3,g=0,b=0;g=(t[m>>>3]<<16|t[m+8>>>3]<<8|t[m+16>>>3])>>24-(7&m)-p&(1<>>3]<<16|t[m+8>>>3]<<8|t[m+16>>>3])>>24-(7&m)-p&(1<=f?(h[f]=d,o[h[f]]=y[0],c[f]=1,d=d+1+3&-4,f++):(h[f]=d,l(o,h[b],o,d,v=c[b]),o[d+v]=o[y],v++,c[f]=v,f++,d=d+v+3&-4),f+1==1<=f?(h[f]=d,c[f]=0,f++):(h[f]=d,l(o,h[b],o,d,v=c[b]),o[d+v]=o[d],v++,c[f]=v,f++,l(o,d,i,n,v),n+=v,d=d+v+3&-4),f+1==1<4&&(t.writeUint(r,i,s),p=s),2==h&&t.writeASCII(r,p,c),3==h)for(var m=0;m4&&(s+=d+=1&d),i+=4}return[i,s]},e.toRGBA8=function(e){var t=e.width,r=e.height,i=t*r,a=4*i,s=e.data,o=new Uint8Array(4*i),u=e.t262[0],l=e.t258?Math.min(32,e.t258[0]):1,h=e.isLE?1:0;if(0==u)for(var c=Math.ceil(l*t/8),f=0;f>3)]>>7-(7&m)&1;o[g]=o[g+1]=o[g+2]=255*(1-b),o[g+3]=255}if(4==l)for(m=0;m>1)]>>4-4*(1&m)&15,o[g]=o[g+1]=o[g+2]=17*(15-b),o[g+3]=255;if(8==l)for(m=0;m>3)]>>7-(7&m)&1,o[g]=o[g+1]=o[g+2]=255*b,o[g+3]=255;if(2==l)for(m=0;m>2)]>>6-2*(3&m)&3,o[g]=o[g+1]=o[g+2]=85*b,o[g+3]=255;if(8==l)for(m=0;m0)for(m=0;m>8,o[g+1]=_[256+v]>>8,o[g+2]=_[512+v]>>8,o[g+3]=255}}else if(5==u){var w,E=(w=e.t258?e.t258.length:4)>4?1:0;for(m=0;m>8&255,e[t+1]=255&r},writeUint:function(e,t,r){e[t]=r>>24&255,e[t+1]=r>>16&255,e[t+2]=r>>8&255,e[t+3]=r>>0&255},writeASCII:function(e,t,r){for(var i=0;i0&&(c=setTimeout((function(){if(!l){l=!0,h.abort("timeout");var e=new Error("XMLHttpRequest timeout");e.code="ETIMEDOUT",n(e)}}),e.timeout)),h.setRequestHeader)for(o in m)m.hasOwnProperty(o)&&h.setRequestHeader(o,m[o]);else if(e.headers&&!function(e){for(var t in e)if(e.hasOwnProperty(t))return!1;return!0}(e.headers))throw new Error("Headers cannot be set on an XDomainRequest object");return"responseType"in e&&(h.responseType=e.responseType),"beforeSend"in e&&"function"==typeof e.beforeSend&&e.beforeSend(h),h.send(p||null),h}t.exports=u,t.exports.default=u,u.XMLHttpRequest=i.XMLHttpRequest||function(){},u.XDomainRequest="withCredentials"in new u.XMLHttpRequest?u.XMLHttpRequest:i.XDomainRequest,function(e,t){for(var r=0;r2&&void 0!==arguments[2]?arguments[2]:1;e.a*=r;var i=t.a+e.a-t.a*e.a,n=(e.r*e.a+t.r*t.a*(1-e.a))/i,a=(e.g*e.a+t.g*t.a*(1-e.a))/i,s=(e.b*e.a+t.b*t.a*(1-e.a))/i;return{r:n,g:a,b:s,a:i}},r.dstOver=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;e.a*=r;var i=t.a+e.a-t.a*e.a,n=(t.r*t.a+e.r*e.a*(1-t.a))/i,a=(t.g*t.a+e.g*e.a*(1-t.a))/i,s=(t.b*t.a+e.b*e.a*(1-t.a))/i;return{r:n,g:a,b:s,a:i}},r.multiply=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;e.a*=r;var i=t.a+e.a-t.a*e.a,n=e.r*e.a,a=e.g*e.a,s=e.b*e.a,o=t.r*t.a,u=t.g*t.a,l=t.b*t.a,h=(n*o+n*(1-t.a)+o*(1-e.a))/i,c=(a*u+a*(1-t.a)+u*(1-e.a))/i,f=(s*l+s*(1-t.a)+l*(1-e.a))/i;return{r:h,g:c,b:f,a:i}},r.add=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;e.a*=r;var i=t.a+e.a-t.a*e.a,n=e.r*e.a,a=e.g*e.a,s=e.b*e.a,o=t.r*t.a,u=t.g*t.a,l=t.b*t.a,h=(n+o)/i,c=(a+u)/i,f=(s+l)/i;return{r:h,g:c,b:f,a:i}},r.screen=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;e.a*=r;var i=t.a+e.a-t.a*e.a,n=e.r*e.a,a=e.g*e.a,s=e.b*e.a,o=t.r*t.a,u=t.g*t.a,l=t.b*t.a,h=(n*t.a+o*e.a-n*o+n*(1-t.a)+o*(1-e.a))/i,c=(a*t.a+u*e.a-a*u+a*(1-t.a)+u*(1-e.a))/i,f=(s*t.a+l*e.a-s*l+s*(1-t.a)+l*(1-e.a))/i;return{r:h,g:c,b:f,a:i}},r.overlay=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;e.a*=r;var i=t.a+e.a-t.a*e.a,n=e.r*e.a,a=e.g*e.a,s=e.b*e.a,o=t.r*t.a,u=t.g*t.a,l=t.b*t.a,h=(2*o<=t.a?2*n*o+n*(1-t.a)+o*(1-e.a):n*(1+t.a)+o*(1+e.a)-2*o*n-t.a*e.a)/i,c=(2*u<=t.a?2*a*u+a*(1-t.a)+u*(1-e.a):a*(1+t.a)+u*(1+e.a)-2*u*a-t.a*e.a)/i,f=(2*l<=t.a?2*s*l+s*(1-t.a)+l*(1-e.a):s*(1+t.a)+l*(1+e.a)-2*l*s-t.a*e.a)/i;return{r:h,g:c,b:f,a:i}},r.darken=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;e.a*=r;var i=t.a+e.a-t.a*e.a,n=e.r*e.a,a=e.g*e.a,s=e.b*e.a,o=t.r*t.a,u=t.g*t.a,l=t.b*t.a,h=(Math.min(n*t.a,o*e.a)+n*(1-t.a)+o*(1-e.a))/i,c=(Math.min(a*t.a,u*e.a)+a*(1-t.a)+u*(1-e.a))/i,f=(Math.min(s*t.a,l*e.a)+s*(1-t.a)+l*(1-e.a))/i;return{r:h,g:c,b:f,a:i}},r.lighten=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;e.a*=r;var i=t.a+e.a-t.a*e.a,n=e.r*e.a,a=e.g*e.a,s=e.b*e.a,o=t.r*t.a,u=t.g*t.a,l=t.b*t.a,h=(Math.max(n*t.a,o*e.a)+n*(1-t.a)+o*(1-e.a))/i,c=(Math.max(a*t.a,u*e.a)+a*(1-t.a)+u*(1-e.a))/i,f=(Math.max(s*t.a,l*e.a)+s*(1-t.a)+l*(1-e.a))/i;return{r:h,g:c,b:f,a:i}},r.hardLight=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;e.a*=r;var i=t.a+e.a-t.a*e.a,n=e.r*e.a,a=e.g*e.a,s=e.b*e.a,o=t.r*t.a,u=t.g*t.a,l=t.b*t.a,h=(2*n<=e.a?2*n*o+n*(1-t.a)+o*(1-e.a):n*(1+t.a)+o*(1+e.a)-2*o*n-t.a*e.a)/i,c=(2*a<=e.a?2*a*u+a*(1-t.a)+u*(1-e.a):a*(1+t.a)+u*(1+e.a)-2*u*a-t.a*e.a)/i,f=(2*s<=e.a?2*s*l+s*(1-t.a)+l*(1-e.a):s*(1+t.a)+l*(1+e.a)-2*l*s-t.a*e.a)/i;return{r:h,g:c,b:f,a:i}},r.difference=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;e.a*=r;var i=t.a+e.a-t.a*e.a,n=e.r*e.a,a=e.g*e.a,s=e.b*e.a,o=t.r*t.a,u=t.g*t.a,l=t.b*t.a,h=(n+o-2*Math.min(n*t.a,o*e.a))/i,c=(a+u-2*Math.min(a*t.a,u*e.a))/i,f=(s+l-2*Math.min(s*t.a,l*e.a))/i;return{r:h,g:c,b:f,a:i}},r.exclusion=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;e.a*=r;var i=t.a+e.a-t.a*e.a,n=e.r*e.a,a=e.g*e.a,s=e.b*e.a,o=t.r*t.a,u=t.g*t.a,l=t.b*t.a,h=(n*t.a+o*e.a-2*n*o+n*(1-t.a)+o*(1-e.a))/i,c=(a*t.a+u*e.a-2*a*u+a*(1-t.a)+u*(1-e.a))/i,f=(s*t.a+l*e.a-2*s*l+s*(1-t.a)+l*(1-e.a))/i;return{r:h,g:c,b:f,a:i}}},{}],191:[function(e,t,r){"use strict";var i=e("@babel/runtime/helpers/interopRequireWildcard");Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(e,t,r){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=arguments.length>4?arguments[4]:void 0;if("function"==typeof i&&(o=i,i={}),!(e instanceof this.constructor))return n.throwError.call(this,"The source must be a Jimp image",o);if("number"!=typeof t||"number"!=typeof r)return n.throwError.call(this,"x and y must be numbers",o);var u=i,l=u.mode,h=u.opacitySource,c=u.opacityDest;l||(l=a.BLEND_SOURCE_OVER),("number"!=typeof h||h<0||h>1)&&(h=1),("number"!=typeof c||c<0||c>1)&&(c=1);var f=s[l];t=Math.round(t),r=Math.round(r);var d=this;return 1!==c&&d.opacity(c),e.scanQuiet(0,0,e.bitmap.width,e.bitmap.height,(function(e,i,n){var s=d.getPixelIndex(t+e,r+i,a.EDGE_CROP),o=f({r:this.bitmap.data[n+0]/255,g:this.bitmap.data[n+1]/255,b:this.bitmap.data[n+2]/255,a:this.bitmap.data[n+3]/255},{r:d.bitmap.data[s+0]/255,g:d.bitmap.data[s+1]/255,b:d.bitmap.data[s+2]/255,a:d.bitmap.data[s+3]/255},h);d.bitmap.data[s+0]=this.constructor.limit255(255*o.r),d.bitmap.data[s+1]=this.constructor.limit255(255*o.g),d.bitmap.data[s+2]=this.constructor.limit255(255*o.b),d.bitmap.data[s+3]=this.constructor.limit255(255*o.a)})),(0,n.isNodePattern)(o)&&o.call(this,null,this),this};var n=e("@jimp/utils"),a=i(e("../constants")),s=i(e("./composite-modes"));t.exports=r.default},{"../constants":192,"./composite-modes":190,"@babel/runtime/helpers/interopRequireWildcard":12,"@jimp/utils":235}],192:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.EDGE_CROP=r.EDGE_WRAP=r.EDGE_EXTEND=r.BLEND_EXCLUSION=r.BLEND_DIFFERENCE=r.BLEND_HARDLIGHT=r.BLEND_LIGHTEN=r.BLEND_DARKEN=r.BLEND_OVERLAY=r.BLEND_SCREEN=r.BLEND_ADD=r.BLEND_MULTIPLY=r.BLEND_DESTINATION_OVER=r.BLEND_SOURCE_OVER=r.VERTICAL_ALIGN_BOTTOM=r.VERTICAL_ALIGN_MIDDLE=r.VERTICAL_ALIGN_TOP=r.HORIZONTAL_ALIGN_RIGHT=r.HORIZONTAL_ALIGN_CENTER=r.HORIZONTAL_ALIGN_LEFT=r.AUTO=void 0,r.AUTO=-1,r.HORIZONTAL_ALIGN_LEFT=1,r.HORIZONTAL_ALIGN_CENTER=2,r.HORIZONTAL_ALIGN_RIGHT=4,r.VERTICAL_ALIGN_TOP=8,r.VERTICAL_ALIGN_MIDDLE=16,r.VERTICAL_ALIGN_BOTTOM=32,r.BLEND_SOURCE_OVER="srcOver",r.BLEND_DESTINATION_OVER="dstOver",r.BLEND_MULTIPLY="multiply",r.BLEND_ADD="add",r.BLEND_SCREEN="screen",r.BLEND_OVERLAY="overlay",r.BLEND_DARKEN="darken",r.BLEND_LIGHTEN="lighten",r.BLEND_HARDLIGHT="hardLight",r.BLEND_DIFFERENCE="difference",r.BLEND_EXCLUSION="exclusion",r.EDGE_EXTEND=1,r.EDGE_WRAP=2,r.EDGE_CROP=3},{}],193:[function(e,t,i){(function(t){"use strict";var n=e("@babel/runtime/helpers/interopRequireWildcard"),a=e("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(i,"__esModule",{value:!0}),i.addConstants=W,i.addJimpMethods=X,i.jimpEvMethod=Z,i.jimpEvChange=Y,Object.defineProperty(i,"addType",{enumerable:!0,get:function(){return C.addType}}),i.default=void 0;for(var s=a(e("@babel/runtime/helpers/construct")),o=a(e("@babel/runtime/helpers/slicedToArray")),u=a(e("@babel/runtime/helpers/classCallCheck")),l=a(e("@babel/runtime/helpers/createClass")),h=a(e("@babel/runtime/helpers/possibleConstructorReturn")),c=a(e("@babel/runtime/helpers/getPrototypeOf")),f=a(e("@babel/runtime/helpers/assertThisInitialized")),d=a(e("@babel/runtime/helpers/inherits")),p=a(e("@babel/runtime/helpers/defineProperty")),m=a(e("@babel/runtime/helpers/typeof")),g=a(e("fs")),b=a(e("path")),y=a(e("events")),_=e("@jimp/utils"),v=a(e("any-base")),w=a(e("mkdirp")),E=a(e("pixelmatch")),k=a(e("tinycolor2")),T=a(e("./modules/phash")),S=a(e("./request")),x=a(e("./composite")),I=a(e("./utils/promisify")),C=n(e("./utils/mime")),A=e("./utils/image-bitmap"),M=n(e("./constants")),P="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_",R=[NaN,NaN],B=2;B<65;B++){var O=(0,v.default)(v.default.BIN,P.slice(0,B))(new Array(65).join("1"));R.push(O.length)}function D(){}function L(e){return Object.prototype.toString.call(e).toLowerCase().indexOf("arraybuffer")>-1}function F(e){for(var r=t.alloc(e.byteLength),i=new Uint8Array(e),n=0;n (HTTP: "+n.statusCode+")";return new Error(s)}))}function N(e,t){g.default&&"function"==typeof g.default.readFile&&!e.match(/^(http|ftp)s?:\/\/./)?g.default.readFile(e,t):z({url:e},t)}function U(e){return e&&"object"===(0,m.default)(e)&&"number"==typeof e.width&&"number"==typeof e.height&&(t.isBuffer(e.data)||e.data instanceof Uint8Array||"function"==typeof Uint8ClampedArray&&e.data instanceof Uint8ClampedArray)&&(e.data.length===e.width*e.height*4||e.data.length===e.width*e.height*3)}function j(e){if(e.length%3!=0)throw new Error("Buffer length is incorrect");for(var r=t.allocUnsafe(e.length/3*4),i=0,n=0;n2&&void 0!==arguments[2]?arguments[2]:{};r=Object.assign(r,{methodName:e,eventName:t}),this.emit("any",r),e&&this.emit(e,r),this.emit(t,r)}},{key:"emitError",value:function(e,t){this.emitMulti(e,"error",t)}},{key:"getHeight",value:function(){return this.bitmap.height}},{key:"getWidth",value:function(){return this.bitmap.width}},{key:"inspect",value:function(){return""}},{key:"toString",value:function(){return"[object Jimp]"}},{key:"getMIME",value:function(){return this._originalMime||r.MIME_PNG}},{key:"getExtension",value:function(){var e=this.getMIME();return C.getExtension(e)}},{key:"write",value:function(e,t){var r=this;if(!g.default||!g.default.createWriteStream)throw new Error("Cant access the filesystem. You can use the getBase64 method.");if("string"!=typeof e)return _.throwError.call(this,"path must be a string",t);if(void 0===t&&(t=D),"function"!=typeof t)return _.throwError.call(this,"cb must be a function",t);var i=C.getType(e)||this.getMIME(),n=b.default.parse(e);return n.dir&&w.default.sync(n.dir),this.getBuffer(i,(function(i,n){if(i)return _.throwError.call(r,i,t);var a=g.default.createWriteStream(e);a.on("open",(function(){a.write(n),a.end()})).on("error",(function(e){return _.throwError.call(r,e,t)})),a.on("finish",(function(){t.call(r,null,r)}))})),this}},{key:"getBase64",value:function(e,t){return e===r.AUTO&&(e=this.getMIME()),"string"!=typeof e?_.throwError.call(this,"mime must be a string",t):"function"!=typeof t?_.throwError.call(this,"cb must be a function",t):(this.getBuffer(e,(function(r,i){if(r)return _.throwError.call(this,r,t);var n="data:"+e+";base64,"+i.toString("base64");t.call(this,null,n)})),this)}},{key:"hash",value:function(e,t){if("function"==typeof(e=e||64)&&(t=e,e=64),"number"!=typeof e)return _.throwError.call(this,"base must be a number",t);if(e<2||e>64)return _.throwError.call(this,"base must be a number between 2 and 64",t);var r=this.pHash();for(r=(0,v.default)(v.default.BIN,P.slice(0,e))(r);r.length=this.bitmap.width&&(a=this.bitmap.width-1),t<0&&(s=0),t>=this.bitmap.height&&(s=this.bitmap.height-1)),i===r.EDGE_WRAP&&(e<0&&(a=this.bitmap.width+e),e>=this.bitmap.width&&(a=e%this.bitmap.width),t<0&&(a=this.bitmap.height+t),t>=this.bitmap.height&&(s=t%this.bitmap.height));var o=this.bitmap.width*s+a<<2;return(a<0||a>=this.bitmap.width)&&(o=-1),(s<0||s>=this.bitmap.height)&&(o=-1),(0,_.isNodePattern)(n)&&n.call(this,null,o),o}},{key:"getPixelColor",value:function(e,t,r){if("number"!=typeof e||"number"!=typeof t)return _.throwError.call(this,"x and y must be numbers",r);e=Math.round(e),t=Math.round(t);var i=this.getPixelIndex(e,t),n=this.bitmap.data.readUInt32BE(i);return(0,_.isNodePattern)(r)&&r.call(this,null,n),n}},{key:"setPixelColor",value:function(e,t,r,i){if("number"!=typeof e||"number"!=typeof t||"number"!=typeof r)return _.throwError.call(this,"hex, x and y must be numbers",i);t=Math.round(t),r=Math.round(r);var n=this.getPixelIndex(t,r);return this.bitmap.data.writeUInt32BE(e,n),(0,_.isNodePattern)(i)&&i.call(this,null,this),this}},{key:"hasAlpha",value:function(){for(var e=0;e1&&void 0!==arguments[1]?arguments[1]:q;Object.entries(e).forEach((function(e){var r=(0,o.default)(e,2),i=r[0],n=r[1];t[i]=n}))}function X(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:q;Object.entries(e).forEach((function(e){var r=(0,o.default)(e,2),i=r[0],n=r[1];t.prototype[i]=n}))}function Z(e,t,r){var i="before-"+t,n=t.replace(/e$/,"")+"ed";q.prototype[e]=function(){for(var t,a=arguments.length,s=new Array(a),o=0;o255)return _.throwError.call(this,"r must be between 0 and 255",n);if((t<0||t>255)&&_.throwError.call(this,"g must be between 0 and 255",n),r<0||r>255)return _.throwError.call(this,"b must be between 0 and 255",n);if(i<0||i>255)return _.throwError.call(this,"a must be between 0 and 255",n);e=Math.round(e),r=Math.round(r),t=Math.round(t),i=Math.round(i);var a=e*Math.pow(256,3)+t*Math.pow(256,2)+r*Math.pow(256,1)+i*Math.pow(256,0);return(0,_.isNodePattern)(n)&&n.call(this,null,a),a},q.intToRGBA=function(e,t){if("number"!=typeof e)return _.throwError.call(this,"i must be a number",t);var r={};return r.r=Math.floor(e/Math.pow(256,3)),r.g=Math.floor((e-r.r*Math.pow(256,3))/Math.pow(256,2)),r.b=Math.floor((e-r.r*Math.pow(256,3)-r.g*Math.pow(256,2))/Math.pow(256,1)),r.a=Math.floor((e-r.r*Math.pow(256,3)-r.g*Math.pow(256,2)-r.b*Math.pow(256,1))/Math.pow(256,0)),(0,_.isNodePattern)(t)&&t.call(this,null,r),r},q.cssColorToHex=function(e){return"number"==typeof(e=e||0)?Number(e):parseInt((0,k.default)(e).toHex8(),16)},q.limit255=function(e){return e=Math.max(e,0),e=Math.min(e,255)},q.diff=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:.1;if(!(e instanceof q&&t instanceof q))return _.throwError.call(this,"img1 and img2 must be an Jimp images");var i=e.bitmap,n=t.bitmap;if(i.width===n.width&&i.height===n.height||(i.width*i.height>n.width*n.height?e=e.cloneQuiet().resize(n.width,n.height):t=t.cloneQuiet().resize(i.width,i.height)),"number"!=typeof r||r<0||r>1)return _.throwError.call(this,"threshold must be a number between 0 and 1");var a=new q(i.width,i.height,4294967295),s=(0,E.default)(i.data,n.data,a.bitmap.data,a.bitmap.width,a.bitmap.height,{threshold:r});return{percent:s/(a.bitmap.width*a.bitmap.height),image:a}},q.distance=function(e,t){var r=new T.default,i=r.getHash(e),n=r.getHash(t);return r.distance(i,n)},q.compareHashes=function(e,t){return(new T.default).distance(e,t)},q.colorDiff=function(e,t){var r=function(e){return Math.pow(e,2)},i=Math.max;return 0===e.a||e.a||(e.a=255),0===t.a||t.a||(t.a=255),(i(r(e.r-t.r),r(e.r-t.r-e.a+t.a))+i(r(e.g-t.g),r(e.g-t.g-e.a+t.a))+i(r(e.b-t.b),r(e.b-t.b-e.a+t.a)))/195075},Z("clone","clone",(function(e){var t=new q(this);return(0,_.isNodePattern)(e)&&e.call(t,null,t),t})),Y("background",(function(e,t){return"number"!=typeof e?_.throwError.call(this,"hex must be a hexadecimal rgba value",t):(this._background=e,(0,_.isNodePattern)(t)&&t.call(this,null,this),this)})),Y("scan",(function(e,t,r,i,n,a){if("number"!=typeof e||"number"!=typeof t)return _.throwError.call(this,"x and y must be numbers",a);if("number"!=typeof r||"number"!=typeof i)return _.throwError.call(this,"w and h must be numbers",a);if("function"!=typeof n)return _.throwError.call(this,"f must be a function",a);var s=(0,_.scan)(this,e,t,r,i,n);return(0,_.isNodePattern)(a)&&a.call(this,null,s),s})),void 0!==r&&"object"===(void 0===r?"undefined":(0,m.default)(r))&&(G=r),"undefined"!=typeof self&&"object"===("undefined"==typeof self?"undefined":(0,m.default)(self))&&(G=self),G.Jimp=q,G.Buffer=t;var V=q;i.default=V}).call(this,e("buffer").Buffer)},{"./composite":191,"./constants":192,"./modules/phash":194,"./request":195,"./utils/image-bitmap":196,"./utils/mime":197,"./utils/promisify":198,"@babel/runtime/helpers/assertThisInitialized":3,"@babel/runtime/helpers/classCallCheck":4,"@babel/runtime/helpers/construct":5,"@babel/runtime/helpers/createClass":6,"@babel/runtime/helpers/defineProperty":7,"@babel/runtime/helpers/getPrototypeOf":9,"@babel/runtime/helpers/inherits":10,"@babel/runtime/helpers/interopRequireDefault":11,"@babel/runtime/helpers/interopRequireWildcard":12,"@babel/runtime/helpers/possibleConstructorReturn":17,"@babel/runtime/helpers/slicedToArray":19,"@babel/runtime/helpers/typeof":21,"@jimp/utils":235,"any-base":23,buffer:48,events:52,fs:47,mkdirp:83,path:107,pixelmatch:109,tinycolor2:178}],194:[function(e,t,r){"use strict";function i(e,t){this.size=this.size||e,this.smallerSize=this.smallerSize||t,function(e){for(var t=1;tc?"1":"0";return f};var n=[];t.exports=i},{}],195:[function(e,t,r){(function(r,i){"use strict";var n=e("@babel/runtime/helpers/interopRequireDefault");n(e("@babel/runtime/helpers/defineProperty")),n(e("@babel/runtime/helpers/extends")),r.browser,t.exports=function(e,t){var r=new XMLHttpRequest;r.open("GET",e.url,!0),r.responseType="arraybuffer",r.addEventListener("load",(function(){if(r.status<400)try{var n=i.from(this.response);t(null,r,n)}catch(r){return t(new Error("Response is not a buffer for url "+e.url+". Error: "+r.message))}else t(new Error("HTTP Status "+r.status+" for url "+e.url))})),r.addEventListener("error",(function(e){t(e)})),r.send()}}).call(this,e("_process"),e("buffer").Buffer)},{"@babel/runtime/helpers/defineProperty":7,"@babel/runtime/helpers/extends":8,"@babel/runtime/helpers/interopRequireDefault":11,_process:133,buffer:48,phin:108}],196:[function(e,t,r){(function(t){"use strict";var i=e("@babel/runtime/helpers/interopRequireWildcard"),n=e("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(r,"__esModule",{value:!0}),r.parseBitmap=function(e,r,i){var n=function(e,t){var r=(0,s.default)(e);return r?r.mime:t?h.getType(t):null}(e,r);if("string"!=typeof n)return i(new Error("Could not find MIME for Buffer <"+r+">"));this._originalMime=n.toLowerCase();try{var l=this.getMIME();if(!this.constructor.decoders[l])return u.throwError.call(this,"Unsupported MIME type: "+l,i);this.bitmap=this.constructor.decoders[l](e)}catch(e){return i.call(this,e,this)}try{this._exif=o.default.create(e).parse(),function(e){if(!(f(e)<2)){var r=function(e){var t=e.getWidth(),r=e.getHeight();switch(f(e)){case 1:return null;case 2:return function(e,r){return[t-e-1,r]};case 3:return function(e,i){return[t-e-1,r-i-1]};case 4:return function(e,t){return[e,r-t-1]};case 5:return function(e,t){return[t,e]};case 6:return function(e,t){return[t,r-e-1]};case 7:return function(e,i){return[t-i-1,r-e-1]};case 8:return function(e,r){return[t-r-1,e]};default:return null}}(e),i=f(e)>4,n=i?e.bitmap.height:e.bitmap.width,s=i?e.bitmap.width:e.bitmap.height;!function(e,r,i,n){for(var s=e.bitmap.data,o=e.bitmap.width,u=t.alloc(s.length),l=0;l2?r-2:0),n=2;n1&&void 0!==arguments[1]?arguments[1]:u.default,r={hasAlpha:{},encoders:{},decoders:{},class:{},constants:{}};function i(e){Object.entries(e).forEach((function(e){var t=(0,o.default)(e,2),i=t[0],n=t[1];r[i]=h({},r[i],{},n)}))}function n(e){var t=e();Array.isArray(t.mime)?u.addType.apply(void 0,(0,a.default)(t.mime)):Object.entries(t.mime).forEach((function(e){return u.addType.apply(void 0,(0,a.default)(e))})),delete t.mime,i(t)}function s(e){var t=e(u.jimpEvChange)||{};t.class||t.constants?i(t):i({class:t})}return e.types&&(e.types.forEach(n),t.decoders=h({},t.decoders,{},r.decoders),t.encoders=h({},t.encoders,{},r.encoders),t.hasAlpha=h({},t.hasAlpha,{},r.hasAlpha)),e.plugins&&e.plugins.forEach(s),(0,u.addJimpMethods)(r.class,t),(0,u.addConstants)(r.constants,t),u.default};var a=n(e("@babel/runtime/helpers/toConsumableArray")),s=n(e("@babel/runtime/helpers/defineProperty")),o=n(e("@babel/runtime/helpers/slicedToArray")),u=i(e("@jimp/core"));function l(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,i)}return r}function h(e){for(var t=1;t=0&&u>=0&&h-o>0&&c-u>0){var l=f.getPixelIndex(o,u),d={r:this.bitmap.data[a],g:this.bitmap.data[a+1],b:this.bitmap.data[a+2],a:this.bitmap.data[a+3]},p={r:f.bitmap.data[l],g:f.bitmap.data[l+1],b:f.bitmap.data[l+2],a:f.bitmap.data[l+3]};f.bitmap.data[l]=(d.a*(d.r-p.r)-p.r+255>>8)+p.r,f.bitmap.data[l+1]=(d.a*(d.g-p.g)-p.g+255>>8)+p.g,f.bitmap.data[l+2]=(d.a*(d.b-p.b)-p.b+255>>8)+p.b,f.bitmap.data[l+3]=this.constructor.limit255(p.a+d.a)}})),(0,a.isNodePattern)(l)&&l.call(this,null,this),this}}},t.exports=r.default},{"@babel/runtime/helpers/interopRequireDefault":11,"@babel/runtime/helpers/typeof":21,"@jimp/utils":235}],202:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.shgTable=r.mulTable=void 0,r.mulTable=[1,57,41,21,203,34,97,73,227,91,149,62,105,45,39,137,241,107,3,173,39,71,65,238,219,101,187,87,81,151,141,133,249,117,221,209,197,187,177,169,5,153,73,139,133,127,243,233,223,107,103,99,191,23,177,171,165,159,77,149,9,139,135,131,253,245,119,231,224,109,211,103,25,195,189,23,45,175,171,83,81,79,155,151,147,9,141,137,67,131,129,251,123,30,235,115,113,221,217,53,13,51,50,49,193,189,185,91,179,175,43,169,83,163,5,79,155,19,75,147,145,143,35,69,17,67,33,65,255,251,247,243,239,59,29,229,113,111,219,27,213,105,207,51,201,199,49,193,191,47,93,183,181,179,11,87,43,85,167,165,163,161,159,157,155,77,19,75,37,73,145,143,141,35,138,137,135,67,33,131,129,255,63,250,247,61,121,239,237,117,29,229,227,225,111,55,109,216,213,211,209,207,205,203,201,199,197,195,193,48,190,47,93,185,183,181,179,178,176,175,173,171,85,21,167,165,41,163,161,5,79,157,78,154,153,19,75,149,74,147,73,144,143,71,141,140,139,137,17,135,134,133,66,131,65,129,1],r.shgTable=[0,9,10,10,14,12,14,14,16,15,16,15,16,15,15,17,18,17,12,18,16,17,17,19,19,18,19,18,18,19,19,19,20,19,20,20,20,20,20,20,15,20,19,20,20,20,21,21,21,20,20,20,21,18,21,21,21,21,20,21,17,21,21,21,22,22,21,22,22,21,22,21,19,22,22,19,20,22,22,21,21,21,22,22,22,18,22,22,21,22,22,23,22,20,23,22,22,23,23,21,19,21,21,21,23,23,23,22,23,23,21,23,22,23,18,22,23,20,22,23,23,23,21,22,20,22,21,22,24,24,24,24,24,22,21,24,23,23,24,21,24,23,24,22,24,24,22,24,24,22,23,24,24,24,20,23,22,23,24,24,24,24,24,24,24,23,21,23,22,23,24,24,24,22,24,24,24,23,22,24,24,25,23,25,25,23,24,25,25,24,22,25,25,25,24,23,24,25,25,25,25,25,25,25,25,25,25,25,25,23,25,23,24,25,25,25,25,25,25,25,25,25,24,22,25,25,23,25,25,20,24,25,24,25,25,22,24,25,24,25,24,25,25,24,25,25,25,25,22,25,25,25,24,25,24,25,18]},{}],203:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var i=e("@jimp/utils"),n=e("./blur-tables");r.default=function(){return{blur:function(e,t){if("number"!=typeof e)return i.throwError.call(this,"r must be a number",t);if(e<1)return i.throwError.call(this,"r must be greater than 0",t);for(var r,a,s,o,u,l,h,c,f,d,p,m,g,b,y=this.bitmap.width-1,_=this.bitmap.height-1,v=e+1,w=n.mulTable[e],E=n.shgTable[e],k=[],T=[],S=[],x=[],I=[],C=[],A=2;A-- >0;){for(m=0,g=0,l=0;ly?y:h)<<2),r+=this.bitmap.data[c++],a+=this.bitmap.data[c++],s+=this.bitmap.data[c++],o+=this.bitmap.data[c];for(u=0;u0?c<<2:0),f=g+I[u],d=g+C[u],r+=this.bitmap.data[f++]-this.bitmap.data[d++],a+=this.bitmap.data[f++]-this.bitmap.data[d++],s+=this.bitmap.data[f++]-this.bitmap.data[d++],o+=this.bitmap.data[f]-this.bitmap.data[d],m++;g+=this.bitmap.width<<2}for(u=0;u_?0:this.bitmap.width],a+=T[p],s+=S[p],o+=x[p];for(m=u<<2,l=0;l>>E,this.bitmap.data[m+3]=b,b>255&&(this.bitmap.data[m+3]=255),b>0?(b=255/b,this.bitmap.data[m]=(r*w>>>E)*b,this.bitmap.data[m+1]=(a*w>>>E)*b,this.bitmap.data[m+2]=(s*w>>>E)*b):(this.bitmap.data[m+2]=0,this.bitmap.data[m+1]=0,this.bitmap.data[m]=0),0===u&&(I[l]=((c=l+v)<_?c:_)*this.bitmap.width,C[l]=(c=l-e)>0?c*this.bitmap.width:0),f=u+I[l],d=u+C[l],r+=k[f]-k[d],a+=T[f]-T[d],s+=S[f]-S[d],o+=x[f]-x[d],m+=this.bitmap.width<<2}}return(0,i.isNodePattern)(t)&&t.call(this,null,this),this}}},t.exports=r.default},{"./blur-tables":202,"@jimp/utils":235}],204:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var i=e("@jimp/utils");r.default=function(){return{circle:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;"function"==typeof e&&(t=e,e={});var r=e.radius||(this.bitmap.width>this.bitmap.height?this.bitmap.height:this.bitmap.width)/2,n={x:"number"==typeof e.x?e.x:this.bitmap.width/2,y:"number"==typeof e.y?e.y:this.bitmap.height/2};return this.scanQuiet(0,0,this.bitmap.width,this.bitmap.height,(function(e,t,i){var a=Math.sqrt(Math.pow(e-n.x,2)+Math.pow(t-n.y,2));r-a<=0?this.bitmap.data[i+3]=0:r-a<1&&(this.bitmap.data[i+3]=255*(r-a))})),(0,i.isNodePattern)(t)&&t.call(this,null,this),this}}},t.exports=r.default},{"@jimp/utils":235}],205:[function(e,t,r){(function(i){"use strict";var n=e("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var a=n(e("@babel/runtime/helpers/toConsumableArray")),s=n(e("tinycolor2")),o=e("@jimp/utils");function u(e,t,r,i){for(var n=[0,0,0],a=(t.length-1)/2,s=0;s2&&void 0!==arguments[2]?arguments[2]:50;return{r:(t.r-e.r)*(r/100)+e.r,g:(t.g-e.g)*(r/100)+e.g,b:(t.b-e.b)*(r/100)+e.b}}function f(e,t){var r=this;return e&&Array.isArray(e)?(e=e.map((function(e){return"xor"!==e.apply&&"mix"!==e.apply||(e.params[0]=(0,s.default)(e.params[0]).toRgb()),e})),this.scanQuiet(0,0,this.bitmap.width,this.bitmap.height,(function(i,n,u){var l={r:r.bitmap.data[u],g:r.bitmap.data[u+1],b:r.bitmap.data[u+2]},h=function(e,t){return r.constructor.limit255(l[e]+t)};e.forEach((function(e){if("mix"===e.apply)l=c(l,e.params[0],e.params[1]);else if("tint"===e.apply)l=c(l,{r:255,g:255,b:255},e.params[0]);else if("shade"===e.apply)l=c(l,{r:0,g:0,b:0},e.params[0]);else if("xor"===e.apply)l={r:l.r^e.params[0].r,g:l.g^e.params[0].g,b:l.b^e.params[0].b};else if("red"===e.apply)l.r=h("r",e.params[0]);else if("green"===e.apply)l.g=h("g",e.params[0]);else if("blue"===e.apply)l.b=h("b",e.params[0]);else{var i;if("hue"===e.apply&&(e.apply="spin"),!(l=(0,s.default)(l))[e.apply])return o.throwError.call(r,"action "+e.apply+" not supported",t);l=(i=l)[e.apply].apply(i,(0,a.default)(e.params)).toRgb()}})),r.bitmap.data[u]=l.r,r.bitmap.data[u+1]=l.g,r.bitmap.data[u+2]=l.b})),(0,o.isNodePattern)(t)&&t.call(this,null,this),this):o.throwError.call(this,"actions must be an array",t)}r.default=function(){return{brightness:function(e,t){return"number"!=typeof e?o.throwError.call(this,"val must be numbers",t):e<-1||e>1?o.throwError.call(this,"val must be a number between -1 and +1",t):(this.scanQuiet(0,0,this.bitmap.width,this.bitmap.height,(function(t,r,i){e<0?(this.bitmap.data[i]=this.bitmap.data[i]*(1+e),this.bitmap.data[i+1]=this.bitmap.data[i+1]*(1+e),this.bitmap.data[i+2]=this.bitmap.data[i+2]*(1+e)):(this.bitmap.data[i]=this.bitmap.data[i]+(255-this.bitmap.data[i])*e,this.bitmap.data[i+1]=this.bitmap.data[i+1]+(255-this.bitmap.data[i+1])*e,this.bitmap.data[i+2]=this.bitmap.data[i+2]+(255-this.bitmap.data[i+2])*e)})),(0,o.isNodePattern)(t)&&t.call(this,null,this),this)},contrast:function(e,t){if("number"!=typeof e)return o.throwError.call(this,"val must be numbers",t);if(e<-1||e>1)return o.throwError.call(this,"val must be a number between -1 and +1",t);var r=(e+1)/(1-e);function i(e){return(e=Math.floor(r*(e-127)+127))<0?0:e>255?255:e}return this.scanQuiet(0,0,this.bitmap.width,this.bitmap.height,(function(e,t,r){this.bitmap.data[r]=i(this.bitmap.data[r]),this.bitmap.data[r+1]=i(this.bitmap.data[r+1]),this.bitmap.data[r+2]=i(this.bitmap.data[r+2])})),(0,o.isNodePattern)(t)&&t.call(this,null,this),this},posterize:function(e,t){return"number"!=typeof e?o.throwError.call(this,"n must be numbers",t):(e<2&&(e=2),this.scanQuiet(0,0,this.bitmap.width,this.bitmap.height,(function(t,r,i){this.bitmap.data[i]=Math.floor(this.bitmap.data[i]/255*(e-1))/(e-1)*255,this.bitmap.data[i+1]=Math.floor(this.bitmap.data[i+1]/255*(e-1))/(e-1)*255,this.bitmap.data[i+2]=Math.floor(this.bitmap.data[i+2]/255*(e-1))/(e-1)*255})),(0,o.isNodePattern)(t)&&t.call(this,null,this),this)},greyscale:h,grayscale:h,opacity:function(e,t){return"number"!=typeof e?o.throwError.call(this,"f must be a number",t):e<0||e>1?o.throwError.call(this,"f must be a number from 0 to 1",t):(this.scanQuiet(0,0,this.bitmap.width,this.bitmap.height,(function(t,r,i){var n=this.bitmap.data[i+3]*e;this.bitmap.data[i+3]=n})),(0,o.isNodePattern)(t)&&t.call(this,null,this),this)},sepia:function(e){return this.scanQuiet(0,0,this.bitmap.width,this.bitmap.height,(function(e,t,r){var i=this.bitmap.data[r],n=this.bitmap.data[r+1],a=this.bitmap.data[r+2];a=.272*(i=.393*i+.769*n+.189*a)+.534*(n=.349*i+.686*n+.168*a)+.131*a,this.bitmap.data[r]=i<255?i:255,this.bitmap.data[r+1]=n<255?n:255,this.bitmap.data[r+2]=a<255?a:255})),(0,o.isNodePattern)(e)&&e.call(this,null,this),this},fade:function(e,t){return"number"!=typeof e?o.throwError.call(this,"f must be a number",t):e<0||e>1?o.throwError.call(this,"f must be a number from 0 to 1",t):(this.opacity(1-e),(0,o.isNodePattern)(t)&&t.call(this,null,this),this)},convolution:function(e,t,r){"function"==typeof t&&void 0===r&&(r=t,t=null),t||(t=this.constructor.EDGE_EXTEND);var n,a,s,u,l,h,c,f,d,p,m=i.from(this.bitmap.data),g=e.length,b=e[0].length,y=Math.floor(g/2),_=Math.floor(b/2),v=-y,w=-_;return this.scanQuiet(0,0,this.bitmap.width,this.bitmap.height,(function(r,i,o){u=0,s=0,a=0;for(var g=v;g<=y;g++)for(var b=w;b<=_;b++)f=r+b,d=i+g,n=e[g+y][b+_],-1===(p=this.getPixelIndex(f,d,t))?(c=0,h=0,l=0):(l=this.bitmap.data[p+0],h=this.bitmap.data[p+1],c=this.bitmap.data[p+2]),a+=n*l,s+=n*h,u+=n*c;a<0&&(a=0),s<0&&(s=0),u<0&&(u=0),a>255&&(a=255),s>255&&(s=255),u>255&&(u=255),m[o+0]=a,m[o+1]=s,m[o+2]=u})),this.bitmap.data=m,(0,o.isNodePattern)(r)&&r.call(this,null,this),this},opaque:function(e){return this.scanQuiet(0,0,this.bitmap.width,this.bitmap.height,(function(e,t,r){this.bitmap.data[r+3]=255})),(0,o.isNodePattern)(e)&&e.call(this,null,this),this},pixelate:function(e,t,r,i,n,a){if("function"==typeof t)a=t,n=null,i=null,r=null,t=null;else{if("number"!=typeof e)return o.throwError.call(this,"size must be a number",a);if(l(t)&&"number"!=typeof t)return o.throwError.call(this,"x must be a number",a);if(l(r)&&"number"!=typeof r)return o.throwError.call(this,"y must be a number",a);if(l(i)&&"number"!=typeof i)return o.throwError.call(this,"w must be a number",a);if(l(n)&&"number"!=typeof n)return o.throwError.call(this,"h must be a number",a)}var s=[[1/16,2/16,1/16],[2/16,.25,2/16],[1/16,2/16,1/16]];t=t||0,r=r||0,i=l(i)?i:this.bitmap.width-t,n=l(n)?n:this.bitmap.height-r;var h=this.cloneQuiet();return this.scanQuiet(t,r,i,n,(function(t,r,i){t=e*Math.floor(t/e),r=e*Math.floor(r/e);var n=u(h,s,t,r);this.bitmap.data[i]=n[0],this.bitmap.data[i+1]=n[1],this.bitmap.data[i+2]=n[2]})),(0,o.isNodePattern)(a)&&a.call(this,null,this),this},convolute:function(e,t,r,i,n,a){if(!Array.isArray(e))return o.throwError.call(this,"the kernel must be an array",a);if("function"==typeof t)a=t,t=null,r=null,i=null,n=null;else{if(l(t)&&"number"!=typeof t)return o.throwError.call(this,"x must be a number",a);if(l(r)&&"number"!=typeof r)return o.throwError.call(this,"y must be a number",a);if(l(i)&&"number"!=typeof i)return o.throwError.call(this,"w must be a number",a);if(l(n)&&"number"!=typeof n)return o.throwError.call(this,"h must be a number",a)}var s=(e.length-1)/2;t=l(t)?t:s,r=l(r)?r:s,i=l(i)?i:this.bitmap.width-t,n=l(n)?n:this.bitmap.height-r;var h=this.cloneQuiet();return this.scanQuiet(t,r,i,n,(function(t,r,i){var n=u(h,e,t,r);this.bitmap.data[i]=this.constructor.limit255(n[0]),this.bitmap.data[i+1]=this.constructor.limit255(n[1]),this.bitmap.data[i+2]=this.constructor.limit255(n[2])})),(0,o.isNodePattern)(a)&&a.call(this,null,this),this},color:f,colour:f}},t.exports=r.default}).call(this,e("buffer").Buffer)},{"@babel/runtime/helpers/interopRequireDefault":11,"@babel/runtime/helpers/toConsumableArray":20,"@jimp/utils":235,buffer:48,tinycolor2:178}],206:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var i=e("@jimp/utils");r.default=function(){return{contain:function(e,t,r,n,a){if("number"!=typeof e||"number"!=typeof t)return i.throwError.call(this,"w and h must be numbers",a);"string"==typeof r&&("function"==typeof n&&void 0===a&&(a=n),n=r,r=null),"function"==typeof r&&(void 0===a&&(a=r),n=null,r=null),"function"==typeof n&&void 0===a&&(a=n,n=null);var s=7&(r=r||this.constructor.HORIZONTAL_ALIGN_CENTER|this.constructor.VERTICAL_ALIGN_MIDDLE),o=r>>3;if((0===s||s&s-1)&&(0===o||o&o-1))return i.throwError.call(this,"only use one flag per alignment direction",a);var u=s>>1,l=o>>1,h=e/t>this.bitmap.width/this.bitmap.height?t/this.bitmap.height:e/this.bitmap.width,c=this.cloneQuiet().scale(h,n);return this.resize(e,t,n),this.scanQuiet(0,0,this.bitmap.width,this.bitmap.height,(function(e,t,r){this.bitmap.data.writeUInt32BE(this._background,r)})),this.blit(c,(this.bitmap.width-c.bitmap.width)/2*u,(this.bitmap.height-c.bitmap.height)/2*l),(0,i.isNodePattern)(a)&&a.call(this,null,this),this}}},t.exports=r.default},{"@jimp/utils":235}],207:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var i=e("@jimp/utils");r.default=function(){return{cover:function(e,t,r,n,a){if("number"!=typeof e||"number"!=typeof t)return i.throwError.call(this,"w and h must be numbers",a);r&&"function"==typeof r&&void 0===a?(a=r,r=null,n=null):"function"==typeof n&&void 0===a&&(a=n,n=null);var s=7&(r=r||this.constructor.HORIZONTAL_ALIGN_CENTER|this.constructor.VERTICAL_ALIGN_MIDDLE),o=r>>3;if((0===s||s&s-1)&&(0===o||o&o-1))return i.throwError.call(this,"only use one flag per alignment direction",a);var u=s>>1,l=o>>1,h=e/t>this.bitmap.width/this.bitmap.height?e/this.bitmap.width:t/this.bitmap.height;return this.scale(h,n),this.crop((this.bitmap.width-e)/2*u,(this.bitmap.height-t)/2*l,e,t),(0,i.isNodePattern)(a)&&a.call(this,null,this),this}}},t.exports=r.default},{"@jimp/utils":235}],208:[function(e,t,r){(function(i){"use strict";var n=e("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(e){return e("crop",(function(e,t,r,n,a){if("number"!=typeof e||"number"!=typeof t)return s.throwError.call(this,"x and y must be numbers",a);if("number"!=typeof r||"number"!=typeof n)return s.throwError.call(this,"w and h must be numbers",a);if(e=Math.round(e),t=Math.round(t),r=Math.round(r),n=Math.round(n),0===e&&r===this.bitmap.width){var o=r*t+e<<2,u=o+n*r<<2;this.bitmap.data=this.bitmap.data.slice(o,u)}else{var l=i.allocUnsafe(r*n*4),h=0;this.scanQuiet(e,t,r,n,(function(e,t,r){var i=this.bitmap.data.readUInt32BE(r,!0);l.writeUInt32BE(i,h,!0),h+=4})),this.bitmap.data=l}return this.bitmap.width=r,this.bitmap.height=n,(0,s.isNodePattern)(a)&&a.call(this,null,this),this})),{class:{autocrop:function(){for(var e,t=this.bitmap.width,r=this.bitmap.height,i=1,n=0,o=2e-4,u=!0,l=!1,h=arguments.length,c=new Array(h),f=0;fo)break e}y++}g=this.getPixelColor(t,0);e:for(var x=0;xo)break e}_++}g=this.getPixelColor(0,r);e:for(var M=r-1;M>=y+i;M--){for(var P=t-_-1;P>=0;P--){var R=this.getPixelColor(P,M),B=this.constructor.intToRGBA(R);if(this.constructor.colorDiff(b,B)>o)break e}v++}g=this.getPixelColor(t,r);e:for(var O=t-1;O>=0+_+i;O--){for(var D=r-1;D>=0+y;D--){var L=this.getPixelColor(O,D),F=this.constructor.intToRGBA(L);if(this.constructor.colorDiff(b,F)>o)break e}w++}if(w-=n,_-=n,y-=n,v-=n,l){var z=Math.min(_,w),N=Math.min(y,v);w=z,_=z,y=N,v=N}var U=t-((w=w>=0?w:0)+(_=_>=0?_:0)),j=r-((v=v>=0?v:0)+(y=y>=0?y:0));return(u?0!==_&&0!==y&&0!==w&&0!==v:0!==_||0!==y||0!==w||0!==v)&&this.crop(_,y,U,j),(0,s.isNodePattern)(e)&&e.call(this,null,this),this}}}};var a=n(e("@babel/runtime/helpers/typeof")),s=e("@jimp/utils");t.exports=r.default}).call(this,e("buffer").Buffer)},{"@babel/runtime/helpers/interopRequireDefault":11,"@babel/runtime/helpers/typeof":21,"@jimp/utils":235,buffer:48}],209:[function(e,t,r){"use strict";var i=e("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var n=i(e("@babel/runtime/helpers/typeof")),a=e("@jimp/utils");r.default=function(){return{displace:function(e,t,r){if("object"!==(0,n.default)(e)||e.constructor!==this.constructor)return a.throwError.call(this,"The source must be a Jimp image",r);if("number"!=typeof t)return a.throwError.call(this,"factor must be a number",r);var i=this.cloneQuiet();return this.scanQuiet(0,0,this.bitmap.width,this.bitmap.height,(function(r,n,a){var s=e.bitmap.data[a]/256*t;s=Math.round(s);var o=this.getPixelIndex(r+s,n);this.bitmap.data[o]=i.bitmap.data[a],this.bitmap.data[o+1]=i.bitmap.data[a+1],this.bitmap.data[o+2]=i.bitmap.data[a+2]})),(0,a.isNodePattern)(r)&&r.call(this,null,this),this}}},t.exports=r.default},{"@babel/runtime/helpers/interopRequireDefault":11,"@babel/runtime/helpers/typeof":21,"@jimp/utils":235}],210:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var i=e("@jimp/utils");function n(e){var t=[1,9,3,11,13,5,15,7,4,12,2,10,16,8,14,6];return this.scanQuiet(0,0,this.bitmap.width,this.bitmap.height,(function(e,r,i){var n=t[((3&r)<<2)+e%4];this.bitmap.data[i]=Math.min(this.bitmap.data[i]+n,255),this.bitmap.data[i+1]=Math.min(this.bitmap.data[i+1]+n,255),this.bitmap.data[i+2]=Math.min(this.bitmap.data[i+2]+n,255)})),(0,i.isNodePattern)(e)&&e.call(this,null,this),this}r.default=function(){return{dither565:n,dither16:n}},t.exports=r.default},{"@jimp/utils":235}],211:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var i=e("@jimp/utils");r.default=function(){return{fisheye:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{r:2.5},r=arguments.length>1?arguments[1]:void 0;"function"==typeof t&&(r=t,t={r:2.5});var n=this.cloneQuiet(),a=n.bitmap,s=a.width,o=a.height;return n.scanQuiet(0,0,s,o,(function(r,i){var a=r/s,u=i/o,l=Math.sqrt(Math.pow(a-.5,2)+Math.pow(u-.5,2)),h=2*Math.pow(l,t.r),c=(a-.5)/l,f=(u-.5)/l,d=Math.round((h*c+.5)*s),p=Math.round((h*f+.5)*o),m=n.getPixelColor(d,p);e.setPixelColor(m,r,i)})),this.setPixelColor(n.getPixelColor(s/2,o/2),s/2,o/2),(0,i.isNodePattern)(r)&&r.call(this,null,this),this}}},t.exports=r.default},{"@jimp/utils":235}],212:[function(e,t,r){(function(i){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var n=e("@jimp/utils");function a(e,t,r){if("boolean"!=typeof e||"boolean"!=typeof t)return n.throwError.call(this,"horizontal and vertical must be Booleans",r);var a=i.alloc(this.bitmap.data.length);return this.scanQuiet(0,0,this.bitmap.width,this.bitmap.height,(function(r,i,n){var s=e?this.bitmap.width-1-r:r,o=t?this.bitmap.height-1-i:i,u=this.bitmap.width*o+s<<2,l=this.bitmap.data.readUInt32BE(n);a.writeUInt32BE(l,u)})),this.bitmap.data=i.from(a),(0,n.isNodePattern)(r)&&r.call(this,null,this),this}r.default=function(){return{flip:a,mirror:a}},t.exports=r.default}).call(this,e("buffer").Buffer)},{"@jimp/utils":235,buffer:48}],213:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var i=e("@jimp/utils");r.default=function(){return{gaussian:function(e,t){if("number"!=typeof e)return i.throwError.call(this,"r must be a number",t);if(e<1)return i.throwError.call(this,"r must be greater than 0",t);for(var r=Math.ceil(2.57*e),n=2*r+1,a=e*e*2,s=a*Math.PI,o=[],u=0;u1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3?arguments[3]:void 0;if(!(e instanceof this.constructor))return i.throwError.call(this,"The source must be a Jimp image",n);if("number"!=typeof t||"number"!=typeof r)return i.throwError.call(this,"x and y must be numbers",n);t=Math.round(t),r=Math.round(r);var a=this.bitmap.width,s=this.bitmap.height,o=this;return e.scanQuiet(0,0,e.bitmap.width,e.bitmap.height,(function(e,i,n){var u=t+e,l=r+i;if(u>=0&&l>=0&&u0})),255-e.slice().reverse().findIndex((function(e){return e>0}))]};r.default=function(){return{normalize:function(e){var t=n.call(this),r={r:s(t.r),g:s(t.g),b:s(t.b)};return this.scanQuiet(0,0,this.bitmap.width,this.bitmap.height,(function(e,t,i){var n=this.bitmap.data[i+0],s=this.bitmap.data[i+1],o=this.bitmap.data[i+2];this.bitmap.data[i+0]=a(n,r.r[0],r.r[1]),this.bitmap.data[i+1]=a(s,r.g[0],r.g[1]),this.bitmap.data[i+2]=a(o,r.b[0],r.b[1])})),(0,i.isNodePattern)(e)&&e.call(this,null,this),this}}},t.exports=r.default},{"@jimp/utils":235}],217:[function(e,t,r){(function(i){"use strict";var n=e("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var a=n(e("@babel/runtime/helpers/typeof")),s=n(e("@babel/runtime/helpers/toConsumableArray")),o=n(e("path")),u=n(e("load-bmfont")),l=e("@jimp/utils"),h=e("./measure-text");function c(e,t,r,i,n){if(n.width>0&&n.height>0){var a=t.pages[n.page];e.blit(a,r+n.xoffset,i+n.yoffset,n.x,n.y,n.width,n.height)}return e}function f(e,t,r,i,n){for(var a=0;ao&&(o=u),a.push(t)):(n.push(a),a=[t])})),n.push(a),{lines:n,longestLine:o}}(e,i,n),b=g.lines,y=g.longestLine;return b.forEach((function(i){var a=i.join(" "),s=function(e,t,r,i,n){return n===e.HORIZONTAL_ALIGN_LEFT?0:n===e.HORIZONTAL_ALIGN_CENTER?(i-(0,h.measureText)(t,r))/2:i-(0,h.measureText)(t,r)}(p.constructor,e,a,n,c);f.call(p,e,t+s,r,a,m),r+=e.common.lineHeight})),(0,l.isNodePattern)(u)&&u.call(this,null,this,{x:t+y,y:r}),this}}}},t.exports=r.default}).call(this,"/../../node_modules/@jimp/plugin-print/dist")},{"./measure-text":218,"@babel/runtime/helpers/interopRequireDefault":11,"@babel/runtime/helpers/toConsumableArray":20,"@babel/runtime/helpers/typeof":21,"@jimp/utils":235,"load-bmfont":219,path:107}],218:[function(e,t,r){"use strict";function i(e,t){for(var r=0,i=0;ir&&o>0?(s+=e.common.lineHeight,a=n[o]+" "):a=u}return s}},{}],219:[function(e,t,r){(function(r){var i=e("xhr"),n=function(){},a=e("parse-bmfont-ascii"),s=e("parse-bmfont-xml"),o=e("parse-bmfont-binary"),u=e("./lib/is-binary"),l=e("xtend"),h=self.XMLHttpRequest&&"withCredentials"in new XMLHttpRequest;t.exports=function(e,t){t="function"==typeof t?t:n,"string"==typeof e?e={uri:e}:e||(e={}),e.binary&&(e=function(e){if(h)return l(e,{responseType:"arraybuffer"});if(void 0===self.XMLHttpRequest)throw new Error("your browser does not support XHR loading");var t=new self.XMLHttpRequest;return t.overrideMimeType("text/plain; charset=x-user-defined"),l({xhr:t},e)}(e)),i(e,(function(i,l,h){if(i)return t(i);if(!/^2/.test(l.statusCode))return t(new Error("http status code: "+l.statusCode));if(!h)return t(new Error("no body result"));var c,f,d=!1;if(c=h,"[object ArrayBuffer]"===Object.prototype.toString.call(c)){var p=new Uint8Array(h);h=new r(p,"binary")}u(h)&&(d=!0,"string"==typeof h&&(h=new r(h,"binary"))),d||(r.isBuffer(h)&&(h=h.toString(e.encoding)),h=h.trim());try{var m=l.headers["content-type"];f=d?o(h):/json/.test(m)||"{"===h.charAt(0)?JSON.parse(h):/xml/.test(m)||"<"===h.charAt(0)?s(h):a(h)}catch(e){t(new Error("error parsing font "+e.message)),t=n}t(null,f)}))}}).call(this,e("buffer").Buffer)},{"./lib/is-binary":220,buffer:48,"parse-bmfont-ascii":102,"parse-bmfont-binary":103,"parse-bmfont-xml":104,xhr:187,xtend:189}],220:[function(e,t,r){(function(r){var i=e("buffer-equal"),n=new r([66,77,70,3]);t.exports=function(e){return"string"==typeof e?"BMF"===e.substring(0,3):e.length>4&&i(e.slice(0,4),n)}}).call(this,e("buffer").Buffer)},{buffer:48,"buffer-equal":49}],221:[function(e,t,r){(function(i){"use strict";var n=e("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var a=e("@jimp/utils"),s=n(e("./modules/resize")),o=n(e("./modules/resize2"));r.default=function(){return{constants:{RESIZE_NEAREST_NEIGHBOR:"nearestNeighbor",RESIZE_BILINEAR:"bilinearInterpolation",RESIZE_BICUBIC:"bicubicInterpolation",RESIZE_HERMITE:"hermiteInterpolation",RESIZE_BEZIER:"bezierInterpolation"},class:{resize:function(e,t,r,n){if("number"!=typeof e||"number"!=typeof t)return a.throwError.call(this,"w and h must be numbers",n);if("function"==typeof r&&void 0===n&&(n=r,r=null),e===this.constructor.AUTO&&t===this.constructor.AUTO)return a.throwError.call(this,"w and h cannot both be set to auto",n);if(e===this.constructor.AUTO&&(e=this.bitmap.width*(t/this.bitmap.height)),t===this.constructor.AUTO&&(t=this.bitmap.height*(e/this.bitmap.width)),e<0||t<0)return a.throwError.call(this,"w and h must be positive numbers",n);if(e=Math.round(e),t=Math.round(t),"function"==typeof o.default[r]){var u={data:i.alloc(e*t*4),width:e,height:t};o.default[r](this.bitmap,u),this.bitmap=u}else{var l=this,h=new s.default(this.bitmap.width,this.bitmap.height,e,t,!0,!0,(function(r){l.bitmap.data=i.from(r),l.bitmap.width=e,l.bitmap.height=t}));h.resize(this.bitmap.data)}return(0,a.isNodePattern)(n)&&n.call(this,null,this),this}}}},t.exports=r.default}).call(this,e("buffer").Buffer)},{"./modules/resize":222,"./modules/resize2":223,"@babel/runtime/helpers/interopRequireDefault":11,"@jimp/utils":235,buffer:48}],222:[function(e,t,r){"use strict";function i(e,t,r,i,n,a,s){this.widthOriginal=Math.abs(Math.floor(e)||0),this.heightOriginal=Math.abs(Math.floor(t)||0),this.targetWidth=Math.abs(Math.floor(r)||0),this.targetHeight=Math.abs(Math.floor(i)||0),this.colorChannels=n?4:3,this.interpolationPass=Boolean(a),this.resizeCallback="function"==typeof s?s:function(){},this.targetWidthMultipliedByChannels=this.targetWidth*this.colorChannels,this.originalWidthMultipliedByChannels=this.widthOriginal*this.colorChannels,this.originalHeightMultipliedByChannels=this.heightOriginal*this.colorChannels,this.widthPassResultSize=this.targetWidthMultipliedByChannels*this.heightOriginal,this.finalResultSize=this.targetWidthMultipliedByChannels*this.targetHeight,this.initialize()}i.prototype.initialize=function(){if(!(this.widthOriginal>0&&this.heightOriginal>0&&this.targetWidth>0&&this.targetHeight>0))throw new Error("Invalid settings specified for the resizer.");this.configurePasses()},i.prototype.configurePasses=function(){this.widthOriginal===this.targetWidth?this.resizeWidth=this.bypassResizer:(this.ratioWeightWidthPass=this.widthOriginal/this.targetWidth,this.ratioWeightWidthPass<1&&this.interpolationPass?(this.initializeFirstPassBuffers(!0),this.resizeWidth=4===this.colorChannels?this.resizeWidthInterpolatedRGBA:this.resizeWidthInterpolatedRGB):(this.initializeFirstPassBuffers(!1),this.resizeWidth=4===this.colorChannels?this.resizeWidthRGBA:this.resizeWidthRGB)),this.heightOriginal===this.targetHeight?this.resizeHeight=this.bypassResizer:(this.ratioWeightHeightPass=this.heightOriginal/this.targetHeight,this.ratioWeightHeightPass<1&&this.interpolationPass?(this.initializeSecondPassBuffers(!0),this.resizeHeight=this.resizeHeightInterpolated):(this.initializeSecondPassBuffers(!1),this.resizeHeight=4===this.colorChannels?this.resizeHeightRGBA:this.resizeHeightRGB))},i.prototype._resizeWidthInterpolatedRGBChannels=function(e,t){var r,i,n=t?4:3,a=this.ratioWeightWidthPass,s=this.widthBuffer,o=0,u=0,l=0,h=0,c=0;for(r=0;o<1/3;r+=n,o+=a)for(u=r,l=0;u=c)){d+=h;break}d=f+=r,h-=c}while(h>0&&f=u)){h+=o;break}h=l=d,o-=u}while(o>0&&l3&&(this.outputWidthWorkBenchOpaquePixelsCount=this.generateFloat64Buffer(this.heightOriginal)))},i.prototype.initializeSecondPassBuffers=function(e){this.heightBuffer=this.generateUint8Buffer(this.finalResultSize),e||(this.outputHeightWorkBench=this.generateFloatBuffer(this.targetWidthMultipliedByChannels),this.colorChannels>3&&(this.outputHeightWorkBenchOpaquePixelsCount=this.generateFloat64Buffer(this.targetWidth)))},i.prototype.generateFloatBuffer=function(e){try{return new Float32Array(e)}catch(e){return[]}},i.prototype.generateFloat64Buffer=function(e){try{return new Float64Array(e)}catch(e){return[]}},i.prototype.generateUint8Buffer=function(e){try{return new Uint8Array(e)}catch(e){return[]}},t.exports=i},{}],223:[function(e,t,r){(function(e){"use strict";t.exports={nearestNeighbor:function(e,t){for(var r=e.width,i=e.height,n=t.width,a=t.height,s=e.data,o=t.data,u=0;u0?a[T-4]:2*a[T]-a[T+4],x=a[T],I=a[T+4],C=_0?m[z-4*f]:2*m[z]-m[z+4*f],U=m[z],j=m[z+4*f],G=B1)for(var q=0;q=0&&_.x=0&&_.ythis.bitmap.width/this.bitmap.height?t/this.bitmap.height:e/this.bitmap.width;return this.scale(a,r),(0,i.isNodePattern)(n)&&n.call(this,null,this),this}}},t.exports=r.default},{"@jimp/utils":235}],226:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var i=e("@jimp/utils");r.default=function(){return{shadow:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0;"function"==typeof t&&(r=t,t={});var n=t,a=n.opacity,s=void 0===a?.7:a,o=n.size,u=void 0===o?1.1:o,l=n.x,h=void 0===l?-25:l,c=n.y,f=void 0===c?25:c,d=n.blur,p=void 0===d?5:d,m=this.clone(),g=this.clone();return g.scan(0,0,g.bitmap.width,g.bitmap.height,(function(t,r,i){g.bitmap.data[i]=0,g.bitmap.data[i+1]=0,g.bitmap.data[i+2]=0,g.bitmap.data[i+3]=g.constructor.limit255(g.bitmap.data[i+3]*s),e.bitmap.data[i]=0,e.bitmap.data[i+1]=0,e.bitmap.data[i+2]=0,e.bitmap.data[i+3]=0})),g.resize(g.bitmap.width*u,g.bitmap.height*u).blur(p),this.composite(g,h,f),this.composite(m,0,0),(0,i.isNodePattern)(r)&&r.call(this,null,this),this}}},t.exports=r.default},{"@jimp/utils":235}],227:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var i=e("@jimp/utils");r.default=function(){return{threshold:function(e,t){var r=this,n=e.max,a=e.replace,s=void 0===a?255:a,o=e.autoGreyscale,u=void 0===o||o;return"number"!=typeof n?i.throwError.call(this,"max must be a number",t):"number"!=typeof s?i.throwError.call(this,"replace must be a number",t):"boolean"!=typeof u?i.throwError.call(this,"autoGreyscale must be a boolean",t):(n=this.constructor.limit255(n),s=this.constructor.limit255(s),u&&this.greyscale(),this.scanQuiet(0,0,this.bitmap.width,this.bitmap.height,(function(e,t,i){var a=r.bitmap.data[i]100?s.throwError.call(this,"n must be a number 0 - 100",t):(this._quality=Math.round(e),(0,s.isNodePattern)(t)&&t.call(this,null,this),this)}}}},t.exports=r.default},{"@babel/runtime/helpers/defineProperty":7,"@babel/runtime/helpers/interopRequireDefault":11,"@jimp/utils":235,"jpeg-js":80}],232:[function(e,t,r){"use strict";var i=e("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var n=i(e("@babel/runtime/helpers/defineProperty")),a=e("pngjs"),s=e("@jimp/utils");r.default=function(){return{mime:(0,n.default)({},"image/png",["png"]),constants:{MIME_PNG:"image/png",PNG_FILTER_AUTO:-1,PNG_FILTER_NONE:0,PNG_FILTER_SUB:1,PNG_FILTER_UP:2,PNG_FILTER_AVERAGE:3,PNG_FILTER_PATH:4},hasAlpha:(0,n.default)({},"image/png",!0),decoders:(0,n.default)({},"image/png",a.PNG.sync.read),encoders:(0,n.default)({},"image/png",(function(e){var t=new a.PNG({width:e.bitmap.width,height:e.bitmap.height});return t.data=e.bitmap.data,a.PNG.sync.write(t,{width:e.bitmap.width,height:e.bitmap.height,deflateLevel:e._deflateLevel,deflateStrategy:e._deflateStrategy,filterType:e._filterType,colorType:"number"==typeof e._colorType?e._colorType:e._rgba?6:2,inputHasAlpha:e._rgba})})),class:{_deflateLevel:9,_deflateStrategy:3,_filterType:-1,_colorType:null,deflateLevel:function(e,t){return"number"!=typeof e?s.throwError.call(this,"l must be a number",t):e<0||e>9?s.throwError.call(this,"l must be a number 0 - 9",t):(this._deflateLevel=Math.round(e),(0,s.isNodePattern)(t)&&t.call(this,null,this),this)},deflateStrategy:function(e,t){return"number"!=typeof e?s.throwError.call(this,"s must be a number",t):e<0||e>3?s.throwError.call(this,"s must be a number 0 - 3",t):(this._deflateStrategy=Math.round(e),(0,s.isNodePattern)(t)&&t.call(this,null,this),this)},filterType:function(e,t){return"number"!=typeof e?s.throwError.call(this,"n must be a number",t):e<-1||e>4?s.throwError.call(this,"n must be -1 (auto) or a number 0 - 4",t):(this._filterType=Math.round(e),(0,s.isNodePattern)(t)&&t.call(this,null,this),this)},colorType:function(e,t){return"number"!=typeof e?s.throwError.call(this,"s must be a number",t):0!==e&&2!==e&&4!==e&&6!==e?s.throwError.call(this,"s must be a number 0, 2, 4, 6.",t):(this._colorType=Math.round(e),(0,s.isNodePattern)(t)&&t.call(this,null,this),this)}}}},t.exports=r.default},{"@babel/runtime/helpers/defineProperty":7,"@babel/runtime/helpers/interopRequireDefault":11,"@jimp/utils":235,pngjs:129}],233:[function(e,t,r){(function(i){"use strict";var n=e("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var a=n(e("@babel/runtime/helpers/defineProperty")),s=n(e("utif"));r.default=function(){return{mime:(0,a.default)({},"image/tiff",["tiff","tif"]),constants:{MIME_TIFF:"image/tiff"},decoders:(0,a.default)({},"image/tiff",(function(e){var t=s.default.decode(e),r=t[0];s.default.decodeImages(e,t);var n=s.default.toRGBA8(r);return{data:i.from(n),width:r.t256[0],height:r.t257[0]}})),encoders:(0,a.default)({},"image/tiff",(function(e){var t=s.default.encodeImage(e.bitmap.data,e.bitmap.width,e.bitmap.height);return i.from(t)}))}},t.exports=r.default}).call(this,e("buffer").Buffer)},{"@babel/runtime/helpers/defineProperty":7,"@babel/runtime/helpers/interopRequireDefault":11,buffer:48,utif:182}],234:[function(e,t,r){"use strict";var i=e("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var n=e("timm"),a=i(e("@jimp/jpeg")),s=i(e("@jimp/png")),o=i(e("@jimp/bmp")),u=i(e("@jimp/tiff")),l=i(e("@jimp/gif"));r.default=function(){return(0,n.mergeDeep)((0,a.default)(),(0,s.default)(),(0,o.default)(),(0,u.default)(),(0,l.default)())},t.exports=r.default},{"@babel/runtime/helpers/interopRequireDefault":11,"@jimp/bmp":229,"@jimp/gif":230,"@jimp/jpeg":231,"@jimp/png":232,"@jimp/tiff":233,timm:177}],235:[function(e,t,r){"use strict";var i=e("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(r,"__esModule",{value:!0}),r.isNodePattern=function(e){if(void 0===e)return!1;if("function"!=typeof e)throw new TypeError("Callback must be a function");return!0},r.throwError=function(e,t){if("string"==typeof e&&(e=new Error(e)),"function"==typeof t)return t.call(this,e);throw e},r.scan=function(e,t,r,i,n,a){t=Math.round(t),r=Math.round(r),i=Math.round(i),n=Math.round(n);for(var s=r;s{"%%"!==e&&(i++,"%c"===e&&(n=i))}),t.splice(n,0,r)},t.save=function(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch(e){}},t.load=function(){let e;try{e=t.storage.getItem("debug")}catch(e){}!e&&void 0!==i&&"env"in i&&(e=i.env.DEBUG);return e},t.useColors=function(){if("undefined"!=typeof window&&window.process&&("renderer"===window.process.type||window.process.__nwjs))return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},t.storage=function(){try{return localStorage}catch(e){}}(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],e.exports=r(544)(t);const{formatters:n}=e.exports;n.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}).call(this,r(101))},function(e,t,r){e.exports=function(e){function t(e){let t=0;for(let r=0;r{if("%%"===r)return r;o++;const a=i.formatters[n];if("function"==typeof a){const i=e[o];r=a.call(t,i),e.splice(o,1),o--}return r}),i.formatArgs.call(t,e);(t.log||i.log).apply(t,e)}return s.namespace=e,s.enabled=i.enabled(e),s.useColors=i.useColors(),s.color=t(e),s.destroy=n,s.extend=a,"function"==typeof i.init&&i.init(s),i.instances.push(s),s}function n(){const e=i.instances.indexOf(this);return-1!==e&&(i.instances.splice(e,1),!0)}function a(e,t){const r=i(this.namespace+(void 0===t?":":t)+e);return r.log=this.log,r}function s(e){return e.toString().substring(2,e.toString().length-2).replace(/\.\*\?$/,"*")}return i.debug=i,i.default=i,i.coerce=function(e){if(e instanceof Error)return e.stack||e.message;return e},i.disable=function(){const e=[...i.names.map(s),...i.skips.map(s).map(e=>"-"+e)].join(",");return i.enable(""),e},i.enable=function(e){let t;i.save(e),i.names=[],i.skips=[];const r=("string"==typeof e?e:"").split(/[\s,]+/),n=r.length;for(t=0;t{i[t]=e[t]}),i.instances=[],i.names=[],i.skips=[],i.formatters={},i.selectColor=t,i.enable(i.load()),i}},function(e,t){var r=1e3,i=6e4,n=60*i,a=24*n;function s(e,t,r,i){var n=t>=1.5*r;return Math.round(e/r)+" "+i+(n?"s":"")}e.exports=function(e,t){t=t||{};var o=typeof e;if("string"===o&&e.length>0)return function(e){if((e=String(e)).length>100)return;var t=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(!t)return;var s=parseFloat(t[1]);switch((t[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return 315576e5*s;case"weeks":case"week":case"w":return 6048e5*s;case"days":case"day":case"d":return s*a;case"hours":case"hour":case"hrs":case"hr":case"h":return s*n;case"minutes":case"minute":case"mins":case"min":case"m":return s*i;case"seconds":case"second":case"secs":case"sec":case"s":return s*r;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return s;default:return}}(e);if("number"===o&&isFinite(e))return t.long?function(e){var t=Math.abs(e);if(t>=a)return s(e,t,a,"day");if(t>=n)return s(e,t,n,"hour");if(t>=i)return s(e,t,i,"minute");if(t>=r)return s(e,t,r,"second");return e+" ms"}(e):function(e){var t=Math.abs(e);if(t>=a)return Math.round(e/a)+"d";if(t>=n)return Math.round(e/n)+"h";if(t>=i)return Math.round(e/i)+"m";if(t>=r)return Math.round(e/r)+"s";return e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},function(e,t,r){"use strict";(function(e){Object.defineProperty(t,"__esModule",{value:!0});const i=r(547),n=r(280),a=r(552)("strtok3:ReadStreamTokenizer");class s extends i.AbstractTokenizer{constructor(e,t){super(),this.streamReader=new n.StreamReader(e),this.fileSize=t}async readBuffer(e,t=0,r=e.length,i,a){if(0===r)return 0;if(i){const n=i-this.position;if(n>0)return await this.ignore(i-this.position),this.readBuffer(e,t,r);if(n<0)throw new Error("Cannot read from a negative offset in a stream")}const s=await this.streamReader.read(e,t,r);if(this.position+=s,!a&&s0){const a=e.alloc(i+n);return o=await this.peekBuffer(a,0,n+i,void 0,s),a.copy(t,r,n),o-n}if(n<0)throw new Error("Cannot peek from a negative offset in a stream")}if(o=await this.streamReader.peek(t,r,i),!s&&o=a)return e;switch(e){case"%s":return String(i[r++]);case"%d":return Number(i[r++]);case"%j":try{return JSON.stringify(i[r++])}catch(e){return"[Circular]"}default:return e}})),u=i[r];r=3&&(i.depth=arguments[2]),arguments.length>=4&&(i.colors=arguments[3]),p(r)?i.showHidden=r:r&&t._extend(i,r),y(i.showHidden)&&(i.showHidden=!1),y(i.depth)&&(i.depth=2),y(i.colors)&&(i.colors=!1),y(i.customInspect)&&(i.customInspect=!0),i.colors&&(i.stylize=u),h(i,e,i.depth)}function u(e,t){var r=o.styles[t];return r?"["+o.colors[r][0]+"m"+e+"["+o.colors[r][1]+"m":e}function l(e,t){return e}function h(e,r,i){if(e.customInspect&&r&&k(r.inspect)&&r.inspect!==t.inspect&&(!r.constructor||r.constructor.prototype!==r)){var n=r.inspect(i,e);return b(n)||(n=h(e,n,i)),n}var a=function(e,t){if(y(t))return e.stylize("undefined","undefined");if(b(t)){var r="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(r,"string")}if(g(t))return e.stylize(""+t,"number");if(p(t))return e.stylize(""+t,"boolean");if(m(t))return e.stylize("null","null")}(e,r);if(a)return a;var s=Object.keys(r),o=function(e){var t={};return e.forEach((function(e,r){t[e]=!0})),t}(s);if(e.showHidden&&(s=Object.getOwnPropertyNames(r)),E(r)&&(s.indexOf("message")>=0||s.indexOf("description")>=0))return c(r);if(0===s.length){if(k(r)){var u=r.name?": "+r.name:"";return e.stylize("[Function"+u+"]","special")}if(_(r))return e.stylize(RegExp.prototype.toString.call(r),"regexp");if(w(r))return e.stylize(Date.prototype.toString.call(r),"date");if(E(r))return c(r)}var l,v="",T=!1,S=["{","}"];(d(r)&&(T=!0,S=["[","]"]),k(r))&&(v=" [Function"+(r.name?": "+r.name:"")+"]");return _(r)&&(v=" "+RegExp.prototype.toString.call(r)),w(r)&&(v=" "+Date.prototype.toUTCString.call(r)),E(r)&&(v=" "+c(r)),0!==s.length||T&&0!=r.length?i<0?_(r)?e.stylize(RegExp.prototype.toString.call(r),"regexp"):e.stylize("[Object]","special"):(e.seen.push(r),l=T?function(e,t,r,i,n){for(var a=[],s=0,o=t.length;s=0&&0,e+t.replace(/\u001b\[\d\d?m/g,"").length+1}),0)>60)return r[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+r[1];return r[0]+t+" "+e.join(", ")+" "+r[1]}(l,v,S)):S[0]+v+S[1]}function c(e){return"["+Error.prototype.toString.call(e)+"]"}function f(e,t,r,i,n,a){var s,o,u;if((u=Object.getOwnPropertyDescriptor(t,n)||{value:t[n]}).get?o=u.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):u.set&&(o=e.stylize("[Setter]","special")),C(i,n)||(s="["+n+"]"),o||(e.seen.indexOf(u.value)<0?(o=m(r)?h(e,u.value,null):h(e,u.value,r-1)).indexOf("\n")>-1&&(o=a?o.split("\n").map((function(e){return" "+e})).join("\n").substr(2):"\n"+o.split("\n").map((function(e){return" "+e})).join("\n")):o=e.stylize("[Circular]","special")),y(s)){if(a&&n.match(/^\d+$/))return o;(s=JSON.stringify(""+n)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(s=s.substr(1,s.length-2),s=e.stylize(s,"name")):(s=s.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),s=e.stylize(s,"string"))}return s+": "+o}function d(e){return Array.isArray(e)}function p(e){return"boolean"==typeof e}function m(e){return null===e}function g(e){return"number"==typeof e}function b(e){return"string"==typeof e}function y(e){return void 0===e}function _(e){return v(e)&&"[object RegExp]"===T(e)}function v(e){return"object"==typeof e&&null!==e}function w(e){return v(e)&&"[object Date]"===T(e)}function E(e){return v(e)&&("[object Error]"===T(e)||e instanceof Error)}function k(e){return"function"==typeof e}function T(e){return Object.prototype.toString.call(e)}function S(e){return e<10?"0"+e.toString(10):e.toString(10)}t.debuglog=function(r){if(y(a)&&(a=e.env.NODE_DEBUG||""),r=r.toUpperCase(),!s[r])if(new RegExp("\\b"+r+"\\b","i").test(a)){var i=e.pid;s[r]=function(){var e=t.format.apply(t,arguments);console.error("%s %d: %s",r,i,e)}}else s[r]=function(){};return s[r]},t.inspect=o,o.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]},o.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},t.isArray=d,t.isBoolean=p,t.isNull=m,t.isNullOrUndefined=function(e){return null==e},t.isNumber=g,t.isString=b,t.isSymbol=function(e){return"symbol"==typeof e},t.isUndefined=y,t.isRegExp=_,t.isObject=v,t.isDate=w,t.isError=E,t.isFunction=k,t.isPrimitive=function(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e},t.isBuffer=r(210);var x=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function I(){var e=new Date,t=[S(e.getHours()),S(e.getMinutes()),S(e.getSeconds())].join(":");return[e.getDate(),x[e.getMonth()],t].join(" ")}function C(e,t){return Object.prototype.hasOwnProperty.call(e,t)}t.log=function(){console.log("%s - %s",I(),t.format.apply(t,arguments))},t.inherits=r(211),t._extend=function(e,t){if(!t||!v(t))return e;for(var r=Object.keys(t),i=r.length;i--;)e[r[i]]=t[r[i]];return e};var A="undefined"!=typeof Symbol?Symbol("util.promisify.custom"):void 0;function M(e,t){if(!e){var r=new Error("Promise was rejected with a falsy value");r.reason=e,e=r}return t(e)}t.promisify=function(e){if("function"!=typeof e)throw new TypeError('The "original" argument must be of type Function');if(A&&e[A]){var t;if("function"!=typeof(t=e[A]))throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(t,A,{value:t,enumerable:!1,writable:!1,configurable:!0}),t}function t(){for(var t,r,i=new Promise((function(e,i){t=e,r=i})),n=[],a=0;a{"%%"!==e&&(i++,"%c"===e&&(n=i))}),t.splice(n,0,r)},t.save=function(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch(e){}},t.load=function(){let e;try{e=t.storage.getItem("debug")}catch(e){}!e&&void 0!==i&&"env"in i&&(e=i.env.DEBUG);return e},t.useColors=function(){if("undefined"!=typeof window&&window.process&&("renderer"===window.process.type||window.process.__nwjs))return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},t.storage=function(){try{return localStorage}catch(e){}}(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],e.exports=r(213)(t);const{formatters:n}=e.exports;n.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}).call(this,r(16))},function(e,t,r){e.exports=function(e){function t(e){let t=0;for(let r=0;r{if("%%"===r)return r;o++;const a=i.formatters[n];if("function"==typeof a){const i=e[o];r=a.call(t,i),e.splice(o,1),o--}return r}),i.formatArgs.call(t,e);(t.log||i.log).apply(t,e)}return s.namespace=e,s.enabled=i.enabled(e),s.useColors=i.useColors(),s.color=t(e),s.destroy=n,s.extend=a,"function"==typeof i.init&&i.init(s),i.instances.push(s),s}function n(){const e=i.instances.indexOf(this);return-1!==e&&(i.instances.splice(e,1),!0)}function a(e,t){const r=i(this.namespace+(void 0===t?":":t)+e);return r.log=this.log,r}function s(e){return e.toString().substring(2,e.toString().length-2).replace(/\.\*\?$/,"*")}return i.debug=i,i.default=i,i.coerce=function(e){if(e instanceof Error)return e.stack||e.message;return e},i.disable=function(){const e=[...i.names.map(s),...i.skips.map(s).map(e=>"-"+e)].join(",");return i.enable(""),e},i.enable=function(e){let t;i.save(e),i.names=[],i.skips=[];const r=("string"==typeof e?e:"").split(/[\s,]+/),n=r.length;for(t=0;t{i[t]=e[t]}),i.instances=[],i.names=[],i.skips=[],i.formatters={},i.selectColor=t,i.enable(i.load()),i}},function(e,t){var r=1e3,i=6e4,n=60*i,a=24*n;function s(e,t,r,i){var n=t>=1.5*r;return Math.round(e/r)+" "+i+(n?"s":"")}e.exports=function(e,t){t=t||{};var o=typeof e;if("string"===o&&e.length>0)return function(e){if((e=String(e)).length>100)return;var t=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(!t)return;var s=parseFloat(t[1]);switch((t[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return 315576e5*s;case"weeks":case"week":case"w":return 6048e5*s;case"days":case"day":case"d":return s*a;case"hours":case"hour":case"hrs":case"hr":case"h":return s*n;case"minutes":case"minute":case"mins":case"min":case"m":return s*i;case"seconds":case"second":case"secs":case"sec":case"s":return s*r;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return s;default:return}}(e);if("number"===o&&isFinite(e))return t.long?function(e){var t=Math.abs(e);if(t>=a)return s(e,t,a,"day");if(t>=n)return s(e,t,n,"hour");if(t>=i)return s(e,t,i,"minute");if(t>=r)return s(e,t,r,"second");return e+" ms"}(e):function(e){var t=Math.abs(e);if(t>=a)return Math.round(e/a)+"d";if(t>=n)return Math.round(e/n)+"h";if(t>=i)return Math.round(e/i)+"m";if(t>=r)return Math.round(e/r)+"s";return e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=r(23);t.BufferTokenizer=class{constructor(e){this.buffer=e,this.position=0,this.fileSize=e.length}async readBuffer(e,t,r,i){return this.position=i||this.position,this.peekBuffer(e,t,r,this.position).then(e=>(this.position+=e,e))}async peekBuffer(e,t,r,n,a=!1){n=n||this.position,r||(r=e.length);const s=Math.min(this.buffer.length-n,r);if(!a&&s[...e].map(e=>e.charCodeAt(0));const r=(e,t,r)=>String.fromCharCode(...e.slice(t,r));t.readUInt64LE=(e,t=0)=>{let r=e[t],i=1,n=0;for(;++n<8;)i*=256,r+=e[t+n]*i;return r},t.tarHeaderChecksumMatches=e=>{if(e.length<512)return!1;let t=256,i=0;for(let r=0;r<148;r++){const n=e[r];t+=n,i+=128&n}for(let r=156;r<512;r++){const n=e[r];t+=n,i+=128&n}const n=parseInt(r(e,148,154),8);return n===t||n===t-(i<<1)},t.multiByteIndexOf=(t,r,i=0)=>{if(e&&e.isBuffer(t))return t.indexOf(e.from(r),i);const n=(e,t,r)=>{for(let i=1;i=0;){if(n(t,r,a))return a;a=t.indexOf(r[0],a+1)}return-1},t.uint8ArrayUtf8ByteString=r}).call(this,r(2).Buffer)},function(e,t,r){"use strict";e.exports={extensions:["jpg","png","apng","gif","webp","flif","cr2","orf","arw","dng","nef","rw2","raf","tif","bmp","jxr","psd","zip","tar","rar","gz","bz2","7z","dmg","mp4","mid","mkv","webm","mov","avi","mpg","mp2","mp3","m4a","oga","ogg","ogv","opus","flac","wav","spx","amr","pdf","epub","exe","swf","rtf","wasm","woff","woff2","eot","ttf","otf","ico","flv","ps","xz","sqlite","nes","crx","xpi","cab","deb","ar","rpm","Z","lz","msi","mxf","mts","blend","bpg","docx","pptx","xlsx","3gp","3g2","jp2","jpm","jpx","mj2","aif","qcp","odt","ods","odp","xml","mobi","heic","cur","ktx","ape","wv","wmv","wma","dcm","ics","glb","pcap","dsf","lnk","alias","voc","ac3","m4v","m4p","m4b","f4v","f4p","f4b","f4a","mie","asf","ogm","ogx","mpc","arrow","shp"],mimeTypes:["image/jpeg","image/png","image/gif","image/webp","image/flif","image/x-canon-cr2","image/tiff","image/bmp","image/vnd.ms-photo","image/vnd.adobe.photoshop","application/epub+zip","application/x-xpinstall","application/vnd.oasis.opendocument.text","application/vnd.oasis.opendocument.spreadsheet","application/vnd.oasis.opendocument.presentation","application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.openxmlformats-officedocument.presentationml.presentation","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/zip","application/x-tar","application/x-rar-compressed","application/gzip","application/x-bzip2","application/x-7z-compressed","application/x-apple-diskimage","application/x-apache-arrow","video/mp4","audio/midi","video/x-matroska","video/webm","video/quicktime","video/vnd.avi","audio/vnd.wave","audio/qcelp","audio/x-ms-wma","video/x-ms-asf","application/vnd.ms-asf","video/mpeg","video/3gpp","audio/mpeg","audio/mp4","audio/opus","video/ogg","audio/ogg","application/ogg","audio/x-flac","audio/ape","audio/wavpack","audio/amr","application/pdf","application/x-msdownload","application/x-shockwave-flash","application/rtf","application/wasm","font/woff","font/woff2","application/vnd.ms-fontobject","font/ttf","font/otf","image/x-icon","video/x-flv","application/postscript","application/x-xz","application/x-sqlite3","application/x-nintendo-nes-rom","application/x-google-chrome-extension","application/vnd.ms-cab-compressed","application/x-deb","application/x-unix-archive","application/x-rpm","application/x-compress","application/x-lzip","application/x-msi","application/x-mie","application/mxf","video/mp2t","application/x-blender","image/bpg","image/jp2","image/jpx","image/jpm","image/mj2","audio/aiff","application/xml","application/x-mobipocket-ebook","image/heif","image/heif-sequence","image/heic","image/heic-sequence","image/ktx","application/dicom","audio/x-musepack","text/calendar","model/gltf-binary","application/vnd.tcpdump.pcap","audio/x-dsf","application/x.ms.shortcut","application/x.apple.alias","audio/x-voc","audio/vnd.dolby.dd-raw","audio/x-m4a","image/apng","image/x-olympus-orf","image/x-sony-arw","image/x-adobe-dng","image/x-nikon-nef","image/x-panasonic-rw2","image/x-fujifilm-raf","video/x-m4v","video/3gpp2","application/x-esri-shape"]}},function(e,t,r){"use strict"; +*/var i=Object.getOwnPropertySymbols,n=Object.prototype.hasOwnProperty,a=Object.prototype.propertyIsEnumerable;function s(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}e.exports=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},r=0;r<10;r++)t["_"+String.fromCharCode(r)]=r;if("0123456789"!==Object.getOwnPropertyNames(t).map((function(e){return t[e]})).join(""))return!1;var i={};return"abcdefghijklmnopqrst".split("").forEach((function(e){i[e]=e})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},i)).join("")}catch(e){return!1}}()?Object.assign:function(e,t){for(var r,o,u=s(e),l=1;l=a)return e;switch(e){case"%s":return String(i[r++]);case"%d":return Number(i[r++]);case"%j":try{return JSON.stringify(i[r++])}catch(e){return"[Circular]"}default:return e}})),u=i[r];r=3&&(i.depth=arguments[2]),arguments.length>=4&&(i.colors=arguments[3]),p(r)?i.showHidden=r:r&&t._extend(i,r),y(i.showHidden)&&(i.showHidden=!1),y(i.depth)&&(i.depth=2),y(i.colors)&&(i.colors=!1),y(i.customInspect)&&(i.customInspect=!0),i.colors&&(i.stylize=u),h(i,e,i.depth)}function u(e,t){var r=o.styles[t];return r?"["+o.colors[r][0]+"m"+e+"["+o.colors[r][1]+"m":e}function l(e,t){return e}function h(e,r,i){if(e.customInspect&&r&&k(r.inspect)&&r.inspect!==t.inspect&&(!r.constructor||r.constructor.prototype!==r)){var n=r.inspect(i,e);return b(n)||(n=h(e,n,i)),n}var a=function(e,t){if(y(t))return e.stylize("undefined","undefined");if(b(t)){var r="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(r,"string")}if(g(t))return e.stylize(""+t,"number");if(p(t))return e.stylize(""+t,"boolean");if(m(t))return e.stylize("null","null")}(e,r);if(a)return a;var s=Object.keys(r),o=function(e){var t={};return e.forEach((function(e,r){t[e]=!0})),t}(s);if(e.showHidden&&(s=Object.getOwnPropertyNames(r)),E(r)&&(s.indexOf("message")>=0||s.indexOf("description")>=0))return c(r);if(0===s.length){if(k(r)){var u=r.name?": "+r.name:"";return e.stylize("[Function"+u+"]","special")}if(_(r))return e.stylize(RegExp.prototype.toString.call(r),"regexp");if(w(r))return e.stylize(Date.prototype.toString.call(r),"date");if(E(r))return c(r)}var l,v="",T=!1,S=["{","}"];(d(r)&&(T=!0,S=["[","]"]),k(r))&&(v=" [Function"+(r.name?": "+r.name:"")+"]");return _(r)&&(v=" "+RegExp.prototype.toString.call(r)),w(r)&&(v=" "+Date.prototype.toUTCString.call(r)),E(r)&&(v=" "+c(r)),0!==s.length||T&&0!=r.length?i<0?_(r)?e.stylize(RegExp.prototype.toString.call(r),"regexp"):e.stylize("[Object]","special"):(e.seen.push(r),l=T?function(e,t,r,i,n){for(var a=[],s=0,o=t.length;s=0&&0,e+t.replace(/\u001b\[\d\d?m/g,"").length+1}),0)>60)return r[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+r[1];return r[0]+t+" "+e.join(", ")+" "+r[1]}(l,v,S)):S[0]+v+S[1]}function c(e){return"["+Error.prototype.toString.call(e)+"]"}function f(e,t,r,i,n,a){var s,o,u;if((u=Object.getOwnPropertyDescriptor(t,n)||{value:t[n]}).get?o=u.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):u.set&&(o=e.stylize("[Setter]","special")),C(i,n)||(s="["+n+"]"),o||(e.seen.indexOf(u.value)<0?(o=m(r)?h(e,u.value,null):h(e,u.value,r-1)).indexOf("\n")>-1&&(o=a?o.split("\n").map((function(e){return" "+e})).join("\n").substr(2):"\n"+o.split("\n").map((function(e){return" "+e})).join("\n")):o=e.stylize("[Circular]","special")),y(s)){if(a&&n.match(/^\d+$/))return o;(s=JSON.stringify(""+n)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(s=s.substr(1,s.length-2),s=e.stylize(s,"name")):(s=s.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),s=e.stylize(s,"string"))}return s+": "+o}function d(e){return Array.isArray(e)}function p(e){return"boolean"==typeof e}function m(e){return null===e}function g(e){return"number"==typeof e}function b(e){return"string"==typeof e}function y(e){return void 0===e}function _(e){return v(e)&&"[object RegExp]"===T(e)}function v(e){return"object"==typeof e&&null!==e}function w(e){return v(e)&&"[object Date]"===T(e)}function E(e){return v(e)&&("[object Error]"===T(e)||e instanceof Error)}function k(e){return"function"==typeof e}function T(e){return Object.prototype.toString.call(e)}function S(e){return e<10?"0"+e.toString(10):e.toString(10)}t.debuglog=function(r){if(y(a)&&(a=e.env.NODE_DEBUG||""),r=r.toUpperCase(),!s[r])if(new RegExp("\\b"+r+"\\b","i").test(a)){var i=e.pid;s[r]=function(){var e=t.format.apply(t,arguments);console.error("%s %d: %s",r,i,e)}}else s[r]=function(){};return s[r]},t.inspect=o,o.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]},o.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},t.isArray=d,t.isBoolean=p,t.isNull=m,t.isNullOrUndefined=function(e){return null==e},t.isNumber=g,t.isString=b,t.isSymbol=function(e){return"symbol"==typeof e},t.isUndefined=y,t.isRegExp=_,t.isObject=v,t.isDate=w,t.isError=E,t.isFunction=k,t.isPrimitive=function(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e},t.isBuffer=r(550);var x=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function I(){var e=new Date,t=[S(e.getHours()),S(e.getMinutes()),S(e.getSeconds())].join(":");return[e.getDate(),x[e.getMonth()],t].join(" ")}function C(e,t){return Object.prototype.hasOwnProperty.call(e,t)}t.log=function(){console.log("%s - %s",I(),t.format.apply(t,arguments))},t.inherits=r(551),t._extend=function(e,t){if(!t||!v(t))return e;for(var r=Object.keys(t),i=r.length;i--;)e[r[i]]=t[r[i]];return e};var A="undefined"!=typeof Symbol?Symbol("util.promisify.custom"):void 0;function M(e,t){if(!e){var r=new Error("Promise was rejected with a falsy value");r.reason=e,e=r}return t(e)}t.promisify=function(e){if("function"!=typeof e)throw new TypeError('The "original" argument must be of type Function');if(A&&e[A]){var t;if("function"!=typeof(t=e[A]))throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(t,A,{value:t,enumerable:!1,writable:!1,configurable:!0}),t}function t(){for(var t,r,i=new Promise((function(e,i){t=e,r=i})),n=[],a=0;a{"%%"!==e&&(i++,"%c"===e&&(n=i))}),t.splice(n,0,r)},t.save=function(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch(e){}},t.load=function(){let e;try{e=t.storage.getItem("debug")}catch(e){}!e&&void 0!==i&&"env"in i&&(e=i.env.DEBUG);return e},t.useColors=function(){if("undefined"!=typeof window&&window.process&&("renderer"===window.process.type||window.process.__nwjs))return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},t.storage=function(){try{return localStorage}catch(e){}}(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],e.exports=r(553)(t);const{formatters:n}=e.exports;n.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}).call(this,r(101))},function(e,t,r){e.exports=function(e){function t(e){let t=0;for(let r=0;r{if("%%"===r)return r;o++;const a=i.formatters[n];if("function"==typeof a){const i=e[o];r=a.call(t,i),e.splice(o,1),o--}return r}),i.formatArgs.call(t,e);(t.log||i.log).apply(t,e)}return s.namespace=e,s.enabled=i.enabled(e),s.useColors=i.useColors(),s.color=t(e),s.destroy=n,s.extend=a,"function"==typeof i.init&&i.init(s),i.instances.push(s),s}function n(){const e=i.instances.indexOf(this);return-1!==e&&(i.instances.splice(e,1),!0)}function a(e,t){const r=i(this.namespace+(void 0===t?":":t)+e);return r.log=this.log,r}function s(e){return e.toString().substring(2,e.toString().length-2).replace(/\.\*\?$/,"*")}return i.debug=i,i.default=i,i.coerce=function(e){if(e instanceof Error)return e.stack||e.message;return e},i.disable=function(){const e=[...i.names.map(s),...i.skips.map(s).map(e=>"-"+e)].join(",");return i.enable(""),e},i.enable=function(e){let t;i.save(e),i.names=[],i.skips=[];const r=("string"==typeof e?e:"").split(/[\s,]+/),n=r.length;for(t=0;t{i[t]=e[t]}),i.instances=[],i.names=[],i.skips=[],i.formatters={},i.selectColor=t,i.enable(i.load()),i}},function(e,t){var r=1e3,i=6e4,n=60*i,a=24*n;function s(e,t,r,i){var n=t>=1.5*r;return Math.round(e/r)+" "+i+(n?"s":"")}e.exports=function(e,t){t=t||{};var o=typeof e;if("string"===o&&e.length>0)return function(e){if((e=String(e)).length>100)return;var t=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(!t)return;var s=parseFloat(t[1]);switch((t[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return 315576e5*s;case"weeks":case"week":case"w":return 6048e5*s;case"days":case"day":case"d":return s*a;case"hours":case"hour":case"hrs":case"hr":case"h":return s*n;case"minutes":case"minute":case"mins":case"min":case"m":return s*i;case"seconds":case"second":case"secs":case"sec":case"s":return s*r;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return s;default:return}}(e);if("number"===o&&isFinite(e))return t.long?function(e){var t=Math.abs(e);if(t>=a)return s(e,t,a,"day");if(t>=n)return s(e,t,n,"hour");if(t>=i)return s(e,t,i,"minute");if(t>=r)return s(e,t,r,"second");return e+" ms"}(e):function(e){var t=Math.abs(e);if(t>=a)return Math.round(e/a)+"d";if(t>=n)return Math.round(e/n)+"h";if(t>=i)return Math.round(e/i)+"m";if(t>=r)return Math.round(e/r)+"s";return e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=r(280);t.BufferTokenizer=class{constructor(e){this.buffer=e,this.position=0,this.fileSize=e.length}async readBuffer(e,t,r,i){return this.position=i||this.position,this.peekBuffer(e,t,r,this.position).then(e=>(this.position+=e,e))}async peekBuffer(e,t,r,n,a=!1){n=n||this.position,r||(r=e.length);const s=Math.min(this.buffer.length-n,r);if(!a&&s[...e].map(e=>e.charCodeAt(0));const r=(e,t,r)=>String.fromCharCode(...e.slice(t,r));t.readUInt64LE=(e,t=0)=>{let r=e[t],i=1,n=0;for(;++n<8;)i*=256,r+=e[t+n]*i;return r},t.tarHeaderChecksumMatches=e=>{if(e.length<512)return!1;let t=256,i=0;for(let r=0;r<148;r++){const n=e[r];t+=n,i+=128&n}for(let r=156;r<512;r++){const n=e[r];t+=n,i+=128&n}const n=parseInt(r(e,148,154),8);return n===t||n===t-(i<<1)},t.multiByteIndexOf=(t,r,i=0)=>{if(e&&e.isBuffer(t))return t.indexOf(e.from(r),i);const n=(e,t,r)=>{for(let i=1;i=0;){if(n(t,r,a))return a;a=t.indexOf(r[0],a+1)}return-1},t.uint8ArrayUtf8ByteString=r}).call(this,r(51).Buffer)},function(e,t,r){"use strict";e.exports={extensions:["jpg","png","apng","gif","webp","flif","cr2","orf","arw","dng","nef","rw2","raf","tif","bmp","jxr","psd","zip","tar","rar","gz","bz2","7z","dmg","mp4","mid","mkv","webm","mov","avi","mpg","mp2","mp3","m4a","oga","ogg","ogv","opus","flac","wav","spx","amr","pdf","epub","exe","swf","rtf","wasm","woff","woff2","eot","ttf","otf","ico","flv","ps","xz","sqlite","nes","crx","xpi","cab","deb","ar","rpm","Z","lz","msi","mxf","mts","blend","bpg","docx","pptx","xlsx","3gp","3g2","jp2","jpm","jpx","mj2","aif","qcp","odt","ods","odp","xml","mobi","heic","cur","ktx","ape","wv","wmv","wma","dcm","ics","glb","pcap","dsf","lnk","alias","voc","ac3","m4v","m4p","m4b","f4v","f4p","f4b","f4a","mie","asf","ogm","ogx","mpc","arrow","shp"],mimeTypes:["image/jpeg","image/png","image/gif","image/webp","image/flif","image/x-canon-cr2","image/tiff","image/bmp","image/vnd.ms-photo","image/vnd.adobe.photoshop","application/epub+zip","application/x-xpinstall","application/vnd.oasis.opendocument.text","application/vnd.oasis.opendocument.spreadsheet","application/vnd.oasis.opendocument.presentation","application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.openxmlformats-officedocument.presentationml.presentation","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/zip","application/x-tar","application/x-rar-compressed","application/gzip","application/x-bzip2","application/x-7z-compressed","application/x-apple-diskimage","application/x-apache-arrow","video/mp4","audio/midi","video/x-matroska","video/webm","video/quicktime","video/vnd.avi","audio/vnd.wave","audio/qcelp","audio/x-ms-wma","video/x-ms-asf","application/vnd.ms-asf","video/mpeg","video/3gpp","audio/mpeg","audio/mp4","audio/opus","video/ogg","audio/ogg","application/ogg","audio/x-flac","audio/ape","audio/wavpack","audio/amr","application/pdf","application/x-msdownload","application/x-shockwave-flash","application/rtf","application/wasm","font/woff","font/woff2","application/vnd.ms-fontobject","font/ttf","font/otf","image/x-icon","video/x-flv","application/postscript","application/x-xz","application/x-sqlite3","application/x-nintendo-nes-rom","application/x-google-chrome-extension","application/vnd.ms-cab-compressed","application/x-deb","application/x-unix-archive","application/x-rpm","application/x-compress","application/x-lzip","application/x-msi","application/x-mie","application/mxf","video/mp2t","application/x-blender","image/bpg","image/jp2","image/jpx","image/jpm","image/mj2","audio/aiff","application/xml","application/x-mobipocket-ebook","image/heif","image/heif-sequence","image/heic","image/heic-sequence","image/ktx","application/dicom","audio/x-musepack","text/calendar","model/gltf-binary","application/vnd.tcpdump.pcap","audio/x-dsf","application/x.ms.shortcut","application/x.apple.alias","audio/x-voc","audio/vnd.dolby.dd-raw","audio/x-m4a","image/apng","image/x-olympus-orf","image/x-sony-arw","image/x-adobe-dng","image/x-nikon-nef","image/x-panasonic-rw2","image/x-fujifilm-raf","video/x-m4v","video/3gpp2","application/x-esri-shape"]}},function(e,t,r){"use strict"; /*! * content-type * Copyright(c) 2015 Douglas Christopher Wilson @@ -257,6 +257,6 @@ object-assign * media-typer * Copyright(c) 2014-2017 Douglas Christopher Wilson * MIT Licensed - */var i=/^[A-Za-z0-9][A-Za-z0-9!#$&^_.-]{0,126}$/,n=/^[A-Za-z0-9][A-Za-z0-9!#$&^_-]{0,126}$/,a=/^ *([A-Za-z0-9][A-Za-z0-9!#$&^_-]{0,126})\/([A-Za-z0-9][A-Za-z0-9!#$&^_.+-]{0,126}) *$/;function s(e,t,r){this.type=e,this.subtype=t,this.suffix=r}t.format=function(e){if(!e||"object"!=typeof e)throw new TypeError("argument obj is required");var t=e.subtype,r=e.suffix,a=e.type;if(!a||!n.test(a))throw new TypeError("invalid type");if(!t||!i.test(t))throw new TypeError("invalid subtype");var s=a+"/"+t;if(r){if(!n.test(r))throw new TypeError("invalid suffix");s+="+"+r}return s},t.parse=function(e){if(!e)throw new TypeError("argument string is required");if("string"!=typeof e)throw new TypeError("argument string is required to be a string");var t=a.exec(e.toLowerCase());if(!t)throw new TypeError("invalid media type");var r,i=t[1],n=t[2],o=n.lastIndexOf("+");-1!==o&&(r=n.substr(o+1),n=n.substr(0,o));return new s(i,n,r)},t.test=function(e){if(!e)throw new TypeError("argument string is required");if("string"!=typeof e)throw new TypeError("argument string is required to be a string");return a.test(e.toLowerCase())}},function(e,t,r){e.exports=function(e){function t(e){let t=0;for(let r=0;r{if("%%"===r)return r;o++;const a=i.formatters[n];if("function"==typeof a){const i=e[o];r=a.call(t,i),e.splice(o,1),o--}return r}),i.formatArgs.call(t,e);(t.log||i.log).apply(t,e)}return s.namespace=e,s.enabled=i.enabled(e),s.useColors=i.useColors(),s.color=t(e),s.destroy=n,s.extend=a,"function"==typeof i.init&&i.init(s),i.instances.push(s),s}function n(){const e=i.instances.indexOf(this);return-1!==e&&(i.instances.splice(e,1),!0)}function a(e,t){const r=i(this.namespace+(void 0===t?":":t)+e);return r.log=this.log,r}function s(e){return e.toString().substring(2,e.toString().length-2).replace(/\.\*\?$/,"*")}return i.debug=i,i.default=i,i.coerce=function(e){if(e instanceof Error)return e.stack||e.message;return e},i.disable=function(){const e=[...i.names.map(s),...i.skips.map(s).map(e=>"-"+e)].join(",");return i.enable(""),e},i.enable=function(e){let t;i.save(e),i.names=[],i.skips=[];const r=("string"==typeof e?e:"").split(/[\s,]+/),n=r.length;for(t=0;t{i[t]=e[t]}),i.instances=[],i.names=[],i.skips=[],i.formatters={},i.selectColor=t,i.enable(i.load()),i}},function(e,t){var r=1e3,i=6e4,n=60*i,a=24*n;function s(e,t,r,i){var n=t>=1.5*r;return Math.round(e/r)+" "+i+(n?"s":"")}e.exports=function(e,t){t=t||{};var o=typeof e;if("string"===o&&e.length>0)return function(e){if((e=String(e)).length>100)return;var t=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(!t)return;var s=parseFloat(t[1]);switch((t[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return 315576e5*s;case"weeks":case"week":case"w":return 6048e5*s;case"days":case"day":case"d":return s*a;case"hours":case"hour":case"hrs":case"hr":case"h":return s*n;case"minutes":case"minute":case"mins":case"min":case"m":return s*i;case"seconds":case"second":case"secs":case"sec":case"s":return s*r;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return s;default:return}}(e);if("number"===o&&isFinite(e))return t.long?function(e){var t=Math.abs(e);if(t>=a)return s(e,t,a,"day");if(t>=n)return s(e,t,n,"hour");if(t>=i)return s(e,t,i,"minute");if(t>=r)return s(e,t,r,"second");return e+" ms"}(e):function(e){var t=Math.abs(e);if(t>=a)return Math.round(e/a)+"d";if(t>=n)return Math.round(e/n)+"h";if(t>=i)return Math.round(e/i)+"m";if(t>=r)return Math.round(e/r)+"s";return e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=r(3),n=r(224),a=r(225),s=r(9),o=r(5),u=i("music-metadata:collector"),l=["matroska","APEv2","vorbis","ID3v2.4","ID3v2.3","ID3v2.2","exif","asf","iTunes","ID3v1"];function h(e){return e.length>2?e.slice(0,e.length-1).join(", ")+" & "+e[e.length-1]:e.join(" & ")}t.MetadataCollector=class{constructor(e){this.opts=e,this.format={tagTypes:[]},this.native={},this.common={track:{no:null,of:null},disk:{no:null,of:null}},this.quality={warnings:[]},this.commonOrigin={},this.originPriority={},this.tagMapper=new a.CombinedTagMapper;let t=1;for(const e of l)this.originPriority[e]=t++;this.originPriority.artificial=500,this.originPriority.id3v1=600}hasAny(){return Object.keys(this.native).length>0}setFormat(e,t){u(`format: ${e} = ${t}`),this.format[e]=t,this.opts.observer&&this.opts.observer({metadata:this,tag:{type:"format",id:e,value:t}})}addTag(e,t,r){u(`tag ${e}.${t} = ${r}`),this.native[e]||(this.format.tagTypes.push(e),this.native[e]=[]),this.native[e].push({id:t,value:r}),this.toCommon(e,t,r)}addWarning(e){this.quality.warnings.push({message:e})}postMap(e,t){switch(t.id){case"artist":if(this.commonOrigin.artist===this.originPriority[e])return this.postMap("artificial",{id:"artists",value:t.value});this.common.artists||this.setGenericTag("artificial",{id:"artists",value:t.value});break;case"artists":if(!(this.common.artist&&this.commonOrigin.artist!==this.originPriority.artificial||this.common.artists&&-1!==this.common.artists.indexOf(t.value))){const e={id:"artist",value:h((this.common.artists||[]).concat([t.value]))};this.setGenericTag("artificial",e)}break;case"genre":t.value=s.CommonTagMapper.parseGenre(t.value);break;case"picture":t.value.format=s.CommonTagMapper.fixPictureMimeType(t.value.format);break;case"totaltracks":return void(this.common.track.of=s.CommonTagMapper.toIntOrNull(t.value));case"totaldiscs":return void(this.common.disk.of=s.CommonTagMapper.toIntOrNull(t.value));case"track":case"disk":const r=this.common[t.id].of;return this.common[t.id]=s.CommonTagMapper.normalizeTrack(t.value),void(this.common[t.id].of=null!=r?r:this.common[t.id].of);case"year":case"originalyear":t.value=parseInt(t.value,10);break;case"date":const i=parseInt(t.value.substr(0,4),10);isNaN(i)||(this.common.year=i);break;case"discogs_label_id":case"discogs_release_id":case"discogs_master_release_id":case"discogs_artist_id":case"discogs_votes":t.value="string"==typeof t.value?parseInt(t.value,10):t.value;break;case"replaygain_track_gain":case"replaygain_track_peak":case"replaygain_album_gain":case"replaygain_album_peak":t.value=o.toRatio(t.value);break;case"replaygain_track_minmax":t.value=t.value.split(",").map(e=>parseInt(e,10));break;case"replaygain_undo":const n=t.value.split(",").map(e=>parseInt(e,10));t.value={leftChannel:n[0],rightChannel:n[1]};break;case"gapless":t.value="1"===t.value;break;case"isrc":if(this.common[t.id]&&-1!==this.common[t.id].indexOf(t.value))return}this.setGenericTag(e,t)}toCommonMetadata(){return{format:this.format,native:this.native,quality:this.quality,common:this.common}}toCommon(e,t,r){const i={id:t,value:r},n=this.tagMapper.mapTag(e,i,this);n&&this.postMap(e,n)}setGenericTag(e,t){u(`common.${t.id} = ${t.value}`);const r=this.commonOrigin[t.id]||1e3,i=this.originPriority[e];if(n.isSingleton(t.id)){if(!(i<=r))return u(`Ignore native tag (singleton): ${e}.${t.id} = ${t.value}`);this.common[t.id]=t.value,this.commonOrigin[t.id]=i}else if(i===r)n.isUnique(t.id)&&-1!==this.common[t.id].indexOf(t.value)?u(`Ignore duplicate value: ${e}.${t.id} = ${t.value}`):this.common[t.id].push(t.value);else{if(!(i{this.registerTagMapper(e)})}mapTag(e,t,r){if(this.tagMappers[e])return this.tagMappers[e].mapGenericTag(t,r);throw new Error("No generic tag mapper defined for tag-format: "+e)}registerTagMapper(e){for(const t of e.tagTypes)this.tagMappers[t]=e}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=r(9),n={title:"title",artist:"artist",album:"album",year:"year",comment:"comment",track:"track",genre:"genre"};class a extends i.CommonTagMapper{constructor(){super(["ID3v1"],n)}}t.ID3v1TagMapper=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});class i{static decode(e){let t="";for(const r in e)e.hasOwnProperty(r)&&(t+=i.codePointToString(i.singleByteDecoder(e[r])));return t}static inRange(e,t,r){return t<=e&&e<=r}static codePointToString(e){return e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode(55296+(e>>10),56320+(1023&e)))}static singleByteDecoder(e){if(i.inRange(e,0,127))return e;const t=i.windows1252[e-128];if(null===t)throw Error("invaliding encoding");return t}}t.Windows1292Decoder=i,i.windows1252=[8364,129,8218,402,8222,8230,8224,8225,710,8240,352,8249,338,141,381,143,144,8216,8217,8220,8221,8226,8211,8212,732,8482,353,8250,339,157,382,376,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255]},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=r(1),n=r(7);function a(e){return{containsHeader:s(e,31),containsFooter:s(e,30),isHeader:s(e,31),readOnly:s(e,0),dataType:(6&e)>>1}}function s(e,t){return 0!=(e&1<({ID:n.FourCcToken.get(e,t),version:i.UINT32_LE.get(e,t+4)/1e3,descriptorBytes:i.UINT32_LE.get(e,t+8),headerBytes:i.UINT32_LE.get(e,t+12),seekTableBytes:i.UINT32_LE.get(e,t+16),headerDataBytes:i.UINT32_LE.get(e,t+20),apeFrameDataBytes:i.UINT32_LE.get(e,t+24),apeFrameDataBytesHigh:i.UINT32_LE.get(e,t+28),terminatingDataBytes:i.UINT32_LE.get(e,t+32),fileMD5:new i.BufferType(16).get(e,t+36)})},t.Header={len:24,get:(e,t)=>({compressionLevel:i.UINT16_LE.get(e,t),formatFlags:i.UINT16_LE.get(e,t+2),blocksPerFrame:i.UINT32_LE.get(e,t+4),finalFrameBlocks:i.UINT32_LE.get(e,t+8),totalFrames:i.UINT32_LE.get(e,t+12),bitsPerSample:i.UINT16_LE.get(e,t+16),channel:i.UINT16_LE.get(e,t+18),sampleRate:i.UINT32_LE.get(e,t+20)})},t.TagFooter={len:32,get:(e,t)=>({ID:new i.StringType(8,"ascii").get(e,t),version:i.UINT32_LE.get(e,t+8),size:i.UINT32_LE.get(e,t+12),fields:i.UINT32_LE.get(e,t+16),flags:a(i.UINT32_LE.get(e,t+20))})},t.TagItemHeader={len:8,get:(e,t)=>({size:i.UINT32_LE.get(e,t),flags:a(i.UINT32_LE.get(e,t+4))})},t.TagField=e=>new i.BufferType(e.size-t.TagFooter.len),t.parseTagFlags=a,t.isBitSet=s},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=r(9),n=r(5),a=r(29),s={TIT2:"title",TPE1:"artist","TXXX:Artists":"artists",TPE2:"albumartist",TALB:"album",TDRV:"date",TORY:"originalyear",TPOS:"disk",TCON:"genre",APIC:"picture",TCOM:"composer","USLT:description":"lyrics",TSOA:"albumsort",TSOT:"titlesort",TOAL:"originalalbum",TSOP:"artistsort",TSO2:"albumartistsort",TSOC:"composersort",TEXT:"lyricist","TXXX:Writer":"writer",TPE3:"conductor",TPE4:"remixer","IPLS:arranger":"arranger","IPLS:engineer":"engineer","IPLS:producer":"producer","IPLS:DJ-mix":"djmixer","IPLS:mix":"mixer",TPUB:"label",TIT1:"grouping",TIT3:"subtitle",TRCK:"track",TCMP:"compilation",POPM:"rating",TBPM:"bpm",TMED:"media","TXXX:CATALOGNUMBER":"catalognumber","TXXX:MusicBrainz Album Status":"releasestatus","TXXX:MusicBrainz Album Type":"releasetype","TXXX:MusicBrainz Album Release Country":"releasecountry","TXXX:RELEASECOUNTRY":"releasecountry","TXXX:SCRIPT":"script",TLAN:"language",TCOP:"copyright",WCOP:"license",TENC:"encodedby",TSSE:"encodersettings","TXXX:BARCODE":"barcode",TSRC:"isrc","TXXX:ASIN":"asin","TXXX:originalyear":"originalyear","UFID:http://musicbrainz.org":"musicbrainz_recordingid","TXXX:MusicBrainz Release Track Id":"musicbrainz_trackid","TXXX:MusicBrainz Album Id":"musicbrainz_albumid","TXXX:MusicBrainz Artist Id":"musicbrainz_artistid","TXXX:MusicBrainz Album Artist Id":"musicbrainz_albumartistid","TXXX:MusicBrainz Release Group Id":"musicbrainz_releasegroupid","TXXX:MusicBrainz Work Id":"musicbrainz_workid","TXXX:MusicBrainz TRM Id":"musicbrainz_trmid","TXXX:MusicBrainz Disc Id":"musicbrainz_discid","TXXX:ACOUSTID_ID":"acoustid_id","TXXX:Acoustid Id":"acoustid_id","TXXX:Acoustid Fingerprint":"acoustid_fingerprint","TXXX:MusicIP PUID":"musicip_puid","TXXX:MusicMagic Fingerprint":"musicip_fingerprint",WOAR:"website",TDRC:"date",TYER:"year",TDOR:"originaldate","TIPL:arranger":"arranger","TIPL:engineer":"engineer","TIPL:producer":"producer","TIPL:DJ-mix":"djmixer","TIPL:mix":"mixer",TMOO:"mood",SYLT:"lyrics",TSST:"discsubtitle",TKEY:"key",COMM:"comment",TOPE:"originalartist","PRIV:AverageLevel":"averageLevel","PRIV:PeakLevel":"peakLevel","TXXX:DISCOGS_ARTIST_ID":"discogs_artist_id","TXXX:DISCOGS_ARTISTS":"artists","TXXX:DISCOGS_ARTIST_NAME":"artists","TXXX:DISCOGS_ALBUM_ARTISTS":"albumartist","TXXX:DISCOGS_CATALOG":"catalognumber","TXXX:DISCOGS_COUNTRY":"releasecountry","TXXX:DISCOGS_DATE":"originaldate","TXXX:DISCOGS_LABEL":"label","TXXX:DISCOGS_LABEL_ID":"discogs_label_id","TXXX:DISCOGS_MASTER_RELEASE_ID":"discogs_master_release_id","TXXX:DISCOGS_RATING":"discogs_rating","TXXX:DISCOGS_RELEASED":"date","TXXX:DISCOGS_RELEASE_ID":"discogs_release_id","TXXX:DISCOGS_VOTES":"discogs_votes","TXXX:CATALOGID":"catalognumber","TXXX:STYLE":"genre","TXXX:REPLAYGAIN_TRACK_PEAK":"replaygain_track_peak","TXXX:REPLAYGAIN_TRACK_GAIN":"replaygain_track_gain","TXXX:REPLAYGAIN_ALBUM_PEAK":"replaygain_album_peak","TXXX:REPLAYGAIN_ALBUM_GAIN":"replaygain_album_gain","TXXX:MP3GAIN_MINMAX":"replaygain_track_minmax","TXXX:MP3GAIN_ALBUM_MINMAX":"replaygain_album_minmax","TXXX:MP3GAIN_UNDO":"replaygain_undo"};class o extends a.CaseInsensitiveTagMap{static toRating(e){return{source:e.email,rating:e.rating>0?(e.rating-1)/254*i.CommonTagMapper.maxRatingScore:void 0}}constructor(){super(["ID3v2.3","ID3v2.4"],s)}postMap(e,t){switch(e.id){case"UFID":"http://musicbrainz.org"===e.value.owner_identifier&&(e.id+=":"+e.value.owner_identifier,e.value=n.default.decodeString(e.value.identifier,"iso-8859-1"));break;case"PRIV":switch(e.value.owner_identifier){case"AverageLevel":case"PeakValue":e.id+=":"+e.value.owner_identifier,e.value=4===e.value.data.length?e.value.data.readUInt32LE(0):null,null===e.value&&t.addWarning("Failed to parse PRIV:PeakValue");break;default:t.addWarning("Unknown PRIV owner-identifier: "+e.value.owner_identifier)}break;case"COMM":e.value=e.value?e.value.text:null;break;case"POPM":e.value=o.toRating(e.value)}}}t.ID3v24TagMapper=o},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=r(9),n={Title:"title",Author:"artist","WM/AlbumArtist":"albumartist","WM/AlbumTitle":"album","WM/Year":"date","WM/OriginalReleaseTime":"originaldate","WM/OriginalReleaseYear":"originalyear",Description:"comment","WM/TrackNumber":"track","WM/PartOfSet":"disk","WM/Genre":"genre","WM/Composer":"composer","WM/Lyrics":"lyrics","WM/AlbumSortOrder":"albumsort","WM/TitleSortOrder":"titlesort","WM/ArtistSortOrder":"artistsort","WM/AlbumArtistSortOrder":"albumartistsort","WM/ComposerSortOrder":"composersort","WM/Writer":"lyricist","WM/Conductor":"conductor","WM/ModifiedBy":"remixer","WM/Engineer":"engineer","WM/Producer":"producer","WM/DJMixer":"djmixer","WM/Mixer":"mixer","WM/Publisher":"label","WM/ContentGroupDescription":"grouping","WM/SubTitle":"subtitle","WM/SetSubTitle":"discsubtitle","WM/IsCompilation":"compilation","WM/SharedUserRating":"rating","WM/BeatsPerMinute":"bpm","WM/Mood":"mood","WM/Media":"media","WM/CatalogNo":"catalognumber","MusicBrainz/Album Status":"releasestatus","MusicBrainz/Album Type":"releasetype","MusicBrainz/Album Release Country":"releasecountry","WM/Script":"script","WM/Language":"language",Copyright:"copyright",LICENSE:"license","WM/EncodedBy":"encodedby","WM/EncodingSettings":"encodersettings","WM/Barcode":"barcode","WM/ISRC":"isrc","MusicBrainz/Track Id":"musicbrainz_recordingid","MusicBrainz/Release Track Id":"musicbrainz_trackid","MusicBrainz/Album Id":"musicbrainz_albumid","MusicBrainz/Artist Id":"musicbrainz_artistid","MusicBrainz/Album Artist Id":"musicbrainz_albumartistid","MusicBrainz/Release Group Id":"musicbrainz_releasegroupid","MusicBrainz/Work Id":"musicbrainz_workid","MusicBrainz/TRM Id":"musicbrainz_trmid","MusicBrainz/Disc Id":"musicbrainz_discid","Acoustid/Id":"acoustid_id","Acoustid/Fingerprint":"acoustid_fingerprint","MusicIP/PUID":"musicip_puid","WM/ARTISTS":"artists","WM/InitialKey":"key",ASIN:"asin","WM/Work":"work","WM/AuthorURL":"website","WM/Picture":"picture"};class a extends i.CommonTagMapper{static toRating(e){return{rating:parseFloat(e+1)/5}}constructor(){super(["asf"],n)}postMap(e){switch(e.id){case"WM/SharedUserRating":const t=e.id.split(":");e.value=a.toRating(e.value),e.id=t[0]}}}t.AsfTagMapper=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=r(9);t.id3v22TagMap={TT2:"title",TP1:"artist",TP2:"albumartist",TAL:"album",TYE:"year",COM:"comment",TRK:"track",TPA:"disk",TCO:"genre",PIC:"picture",TCM:"composer",TOR:"originaldate",TOT:"work",TXT:"lyricist",TP3:"conductor",TPB:"label",TT1:"grouping",TT3:"subtitle",TLA:"language",TCR:"copyright",WCP:"license",TEN:"encodedby",TSS:"encodersettings",WAR:"website","COM:iTunPGAP":"gapless"};class n extends i.CommonTagMapper{constructor(){super(["ID3v2.2"],t.id3v22TagMap)}}t.ID3v22TagMapper=n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=r(29),n={Title:"title",Artist:"artist",Artists:"artists","Album Artist":"albumartist",Album:"album",Year:"date",Originalyear:"originalyear",Originaldate:"originaldate",Comment:"comment",Track:"track",Disc:"disk",DISCNUMBER:"disk",Genre:"genre","Cover Art (Front)":"picture","Cover Art (Back)":"picture",Composer:"composer",Lyrics:"lyrics",ALBUMSORT:"albumsort",TITLESORT:"titlesort",WORK:"work",ARTISTSORT:"artistsort",ALBUMARTISTSORT:"albumartistsort",COMPOSERSORT:"composersort",Lyricist:"lyricist",Writer:"writer",Conductor:"conductor",MixArtist:"remixer",Arranger:"arranger",Engineer:"engineer",Producer:"producer",DJMixer:"djmixer",Mixer:"mixer",Label:"label",Grouping:"grouping",Subtitle:"subtitle",DiscSubtitle:"discsubtitle",Compilation:"compilation",BPM:"bpm",Mood:"mood",Media:"media",CatalogNumber:"catalognumber",MUSICBRAINZ_ALBUMSTATUS:"releasestatus",MUSICBRAINZ_ALBUMTYPE:"releasetype",RELEASECOUNTRY:"releasecountry",Script:"script",Language:"language",Copyright:"copyright",LICENSE:"license",EncodedBy:"encodedby",EncoderSettings:"encodersettings",Barcode:"barcode",ISRC:"isrc",ASIN:"asin",musicbrainz_trackid:"musicbrainz_recordingid",musicbrainz_releasetrackid:"musicbrainz_trackid",MUSICBRAINZ_ALBUMID:"musicbrainz_albumid",MUSICBRAINZ_ARTISTID:"musicbrainz_artistid",MUSICBRAINZ_ALBUMARTISTID:"musicbrainz_albumartistid",MUSICBRAINZ_RELEASEGROUPID:"musicbrainz_releasegroupid",MUSICBRAINZ_WORKID:"musicbrainz_workid",MUSICBRAINZ_TRMID:"musicbrainz_trmid",MUSICBRAINZ_DISCID:"musicbrainz_discid",Acoustid_Id:"acoustid_id",ACOUSTID_FINGERPRINT:"acoustid_fingerprint",MUSICIP_PUID:"musicip_puid",Weblink:"website",REPLAYGAIN_TRACK_GAIN:"replaygain_track_gain",REPLAYGAIN_TRACK_PEAK:"replaygain_track_peak",MP3GAIN_MINMAX:"replaygain_track_minmax",MP3GAIN_UNDO:"replaygain_undo"};class a extends i.CaseInsensitiveTagMap{constructor(){super(["APEv2"],n)}}t.APEv2TagMapper=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=r(9),n={"©nam":"title","©ART":"artist",aART:"albumartist","----:com.apple.iTunes:Band":"albumartist","©alb":"album","©day":"date","©cmt":"comment",trkn:"track",disk:"disk","©gen":"genre",covr:"picture","©wrt":"composer","©lyr":"lyrics",soal:"albumsort",sonm:"titlesort",soar:"artistsort",soaa:"albumartistsort",soco:"composersort","----:com.apple.iTunes:LYRICIST":"lyricist","----:com.apple.iTunes:CONDUCTOR":"conductor","----:com.apple.iTunes:REMIXER":"remixer","----:com.apple.iTunes:ENGINEER":"engineer","----:com.apple.iTunes:PRODUCER":"producer","----:com.apple.iTunes:DJMIXER":"djmixer","----:com.apple.iTunes:MIXER":"mixer","----:com.apple.iTunes:LABEL":"label","©grp":"grouping","----:com.apple.iTunes:SUBTITLE":"subtitle","----:com.apple.iTunes:DISCSUBTITLE":"discsubtitle",cpil:"compilation",tmpo:"bpm","----:com.apple.iTunes:MOOD":"mood","----:com.apple.iTunes:MEDIA":"media","----:com.apple.iTunes:CATALOGNUMBER":"catalognumber",tvsh:"tvShow",tvsn:"tvSeason",tves:"tvEpisode",sosn:"tvShowSort",tven:"tvEpisodeId",tvnn:"tvNetwork",pcst:"podcast",purl:"podcasturl","----:com.apple.iTunes:MusicBrainz Album Status":"releasestatus","----:com.apple.iTunes:MusicBrainz Album Type":"releasetype","----:com.apple.iTunes:MusicBrainz Album Release Country":"releasecountry","----:com.apple.iTunes:SCRIPT":"script","----:com.apple.iTunes:LANGUAGE":"language",cprt:"copyright","----:com.apple.iTunes:LICENSE":"license","©too":"encodedby",pgap:"gapless","----:com.apple.iTunes:BARCODE":"barcode","----:com.apple.iTunes:ISRC":"isrc","----:com.apple.iTunes:ASIN":"asin","----:com.apple.iTunes:NOTES":"comment","----:com.apple.iTunes:MusicBrainz Track Id":"musicbrainz_recordingid","----:com.apple.iTunes:MusicBrainz Release Track Id":"musicbrainz_trackid","----:com.apple.iTunes:MusicBrainz Album Id":"musicbrainz_albumid","----:com.apple.iTunes:MusicBrainz Artist Id":"musicbrainz_artistid","----:com.apple.iTunes:MusicBrainz Album Artist Id":"musicbrainz_albumartistid","----:com.apple.iTunes:MusicBrainz Release Group Id":"musicbrainz_releasegroupid","----:com.apple.iTunes:MusicBrainz Work Id":"musicbrainz_workid","----:com.apple.iTunes:MusicBrainz TRM Id":"musicbrainz_trmid","----:com.apple.iTunes:MusicBrainz Disc Id":"musicbrainz_discid","----:com.apple.iTunes:Acoustid Id":"acoustid_id","----:com.apple.iTunes:Acoustid Fingerprint":"acoustid_fingerprint","----:com.apple.iTunes:MusicIP PUID":"musicip_puid","----:com.apple.iTunes:fingerprint":"musicip_fingerprint","----:com.apple.iTunes:replaygain_track_gain":"replaygain_track_gain","----:com.apple.iTunes:replaygain_track_peak":"replaygain_track_peak","----:com.apple.iTunes:replaygain_album_gain":"replaygain_album_gain","----:com.apple.iTunes:replaygain_album_peak":"replaygain_album_peak","----:com.apple.iTunes:replaygain_track_minmax":"replaygain_track_minmax","----:com.apple.iTunes:replaygain_album_minmax":"replaygain_album_minmax","----:com.apple.iTunes:replaygain_undo":"replaygain_undo",gnre:"genre","----:com.apple.iTunes:ALBUMARTISTSORT":"albumartistsort","----:com.apple.iTunes:ARTISTS":"artists","----:com.apple.iTunes:ORIGINALDATE":"originaldate","----:com.apple.iTunes:ORIGINALYEAR":"originalyear",desc:"description",ldes:"description"};t.tagType="iTunes";class a extends i.CommonTagMapper{constructor(){super([t.tagType],n)}}t.MP4TagMapper=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=r(9),n={TITLE:"title",ARTIST:"artist",ARTISTS:"artists",ALBUMARTIST:"albumartist",ALBUM:"album",DATE:"date",ORIGINALDATE:"originaldate",ORIGINALYEAR:"originalyear",COMMENT:"comment",TRACKNUMBER:"track",DISCNUMBER:"disk",GENRE:"genre",METADATA_BLOCK_PICTURE:"picture",COMPOSER:"composer",LYRICS:"lyrics",ALBUMSORT:"albumsort",TITLESORT:"titlesort",WORK:"work",ARTISTSORT:"artistsort",ALBUMARTISTSORT:"albumartistsort",COMPOSERSORT:"composersort",LYRICIST:"lyricist",WRITER:"writer",CONDUCTOR:"conductor",REMIXER:"remixer",ARRANGER:"arranger",ENGINEER:"engineer",PRODUCER:"producer",DJMIXER:"djmixer",MIXER:"mixer",LABEL:"label",GROUPING:"grouping",SUBTITLE:"subtitle",DISCSUBTITLE:"discsubtitle",TRACKTOTAL:"totaltracks",DISCTOTAL:"totaldiscs",COMPILATION:"compilation",RATING:"rating",BPM:"bpm",MOOD:"mood",MEDIA:"media",CATALOGNUMBER:"catalognumber",RELEASESTATUS:"releasestatus",RELEASETYPE:"releasetype",RELEASECOUNTRY:"releasecountry",SCRIPT:"script",LANGUAGE:"language",COPYRIGHT:"copyright",LICENSE:"license",ENCODEDBY:"encodedby",ENCODERSETTINGS:"encodersettings",BARCODE:"barcode",ISRC:"isrc",ASIN:"asin",MUSICBRAINZ_TRACKID:"musicbrainz_recordingid",MUSICBRAINZ_RELEASETRACKID:"musicbrainz_trackid",MUSICBRAINZ_ALBUMID:"musicbrainz_albumid",MUSICBRAINZ_ARTISTID:"musicbrainz_artistid",MUSICBRAINZ_ALBUMARTISTID:"musicbrainz_albumartistid",MUSICBRAINZ_RELEASEGROUPID:"musicbrainz_releasegroupid",MUSICBRAINZ_WORKID:"musicbrainz_workid",MUSICBRAINZ_TRMID:"musicbrainz_trmid",MUSICBRAINZ_DISCID:"musicbrainz_discid",ACOUSTID_ID:"acoustid_id",ACOUSTID_ID_FINGERPRINT:"acoustid_fingerprint",MUSICIP_PUID:"musicip_puid",WEBSITE:"website",NOTES:"notes",TOTALTRACKS:"totaltracks",TOTALDISCS:"totaldiscs",DISCOGS_ARTIST_ID:"discogs_artist_id",DISCOGS_ARTISTS:"artists",DISCOGS_ARTIST_NAME:"artists",DISCOGS_ALBUM_ARTISTS:"albumartist",DISCOGS_CATALOG:"catalognumber",DISCOGS_COUNTRY:"releasecountry",DISCOGS_DATE:"originaldate",DISCOGS_LABEL:"label",DISCOGS_LABEL_ID:"discogs_label_id",DISCOGS_MASTER_RELEASE_ID:"discogs_master_release_id",DISCOGS_RATING:"discogs_rating",DISCOGS_RELEASED:"date",DISCOGS_RELEASE_ID:"discogs_release_id",DISCOGS_VOTES:"discogs_votes",CATALOGID:"catalognumber",STYLE:"genre",REPLAYGAIN_TRACK_GAIN:"replaygain_track_gain",REPLAYGAIN_TRACK_PEAK:"replaygain_track_peak",REPLAYGAIN_ALBUM_GAIN:"replaygain_album_gain",REPLAYGAIN_ALBUM_PEAK:"replaygain_album_peak",REPLAYGAIN_MINMAX:"replaygain_track_minmax",REPLAYGAIN_ALBUM_MINMAX:"replaygain_album_minmax",REPLAYGAIN_UNDO:"replaygain_undo"};class a extends i.CommonTagMapper{static toRating(e,t){return{source:e?e.toLowerCase():e,rating:parseFloat(t)*i.CommonTagMapper.maxRatingScore}}constructor(){super(["vorbis"],n)}postMap(e){if(0===e.id.indexOf("RATING:")){const t=e.id.split(":");e.value=a.toRating(t[1],e.value),e.id=t[0]}}}t.VorbisTagMapper=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=r(9);t.riffInfoTagMap={IART:"artist",ICRD:"date",INAM:"title",TITL:"title",IPRD:"album",ITRK:"track",COMM:"comment",ICMT:"comment",ICNT:"releasecountry",GNRE:"genre",IWRI:"writer",RATE:"rating",YEAR:"year",ISFT:"encodedby",CODE:"encodedby",TURL:"website",IGNR:"genre",IENG:"engineer",ITCH:"technician",IMED:"media",IRPD:"album"};class n extends i.CommonTagMapper{constructor(){super(["exif"],t.riffInfoTagMap)}}t.RiffInfoTagMapper=n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=r(29),n={"album:ARITST":"albumartist","album:ARITSTSORT":"albumartistsort","album:TITLE":"album","album:DATE_RECORDED":"originaldate","track:ARTIST":"artist","track:ARTISTSORT":"artistsort","track:TITLE":"title","track:PART_NUMBER":"track","track:MUSICBRAINZ_TRACKID":"musicbrainz_recordingid","track:MUSICBRAINZ_ALBUMID":"musicbrainz_albumid","track:MUSICBRAINZ_ARTISTID":"musicbrainz_artistid","track:PUBLISHER":"label"};class a extends i.CaseInsensitiveTagMap{constructor(){super(["matroska"],n)}}t.MatroskaTagMapper=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=r(1),n=r(3),a=r(11),s=r(19),o=r(7),u=r(8),l=r(239),h=r(240),c=r(30),f=n("music-metadata:parser:aiff");class d extends u.BasicParser{async parse(){if("FORM"!==(await this.tokenizer.readToken(h.Header)).chunkID)throw new Error("Invalid Chunk-ID, expected 'FORM'");const e=await this.tokenizer.readToken(o.FourCcToken);switch(e){case"AIFF":this.metadata.setFormat("container",e),this.isCompressed=!1;break;case"AIFC":this.metadata.setFormat("container","AIFF-C"),this.isCompressed=!0;break;default:throw Error("Unsupported AIFF type: "+e)}this.metadata.setFormat("lossless",!this.isCompressed);try{for(;;){const e=await this.tokenizer.readToken(h.Header);f("Chunk id="+e.chunkID);const t=2*Math.round(e.chunkSize/2),r=await this.readData(e);await this.tokenizer.ignore(t-r)}}catch(e){if(!(e instanceof a.EndOfStreamError))throw e;f("End-of-stream")}}async readData(e){switch(e.chunkID){case"COMM":const t=await this.tokenizer.readToken(new l.Common(e,this.isCompressed));return this.metadata.setFormat("bitsPerSample",t.sampleSize),this.metadata.setFormat("sampleRate",t.sampleRate),this.metadata.setFormat("numberOfChannels",t.numChannels),this.metadata.setFormat("numberOfSamples",t.numSampleFrames),this.metadata.setFormat("duration",t.numSampleFrames/t.sampleRate),this.metadata.setFormat("codec",t.compressionName),e.chunkSize;case"ID3 ":const r=await this.tokenizer.readToken(new i.BufferType(e.chunkSize)),n=new c.ID3Stream(r),o=a.fromStream(n);return await(new s.ID3v2Parser).parse(this.metadata,o,this.options),e.chunkSize;case"SSND":return this.metadata.format.duration&&this.metadata.setFormat("bitrate",8*e.chunkSize/this.metadata.format.duration),0;default:return 0}}}t.AIFFParser=d},function(e,t,r){"use strict";(function(e){Object.defineProperty(t,"__esModule",{value:!0});const i=r(3),n=r(1),a=r(5),s=r(20),o=i("music-metadata:id3v2:frame-parser");class u{static readData(t,r,i,l){if(0===t.length)return;const{encoding:h,bom:c}=s.TextEncodingToken.get(t,0),f=t.length;let d=0,p=[];const m=u.getNullTerminatorLength(h);let g;const b={};switch(o(`Parsing tag type=${r}, encoding=${h}, bom=${c}`),"TXXX"!==r&&"T"===r[0]?"T*":r){case"T*":case"IPLS":const c=a.default.decodeString(t.slice(1),h).replace(/\x00+$/,"");switch(r){case"TMCL":case"TIPL":case"IPLS":p=u.splitValue(4,c),p=u.functionList(p);break;case"TRK":case"TRCK":case"TPOS":p=c;break;case"TCOM":case"TEXT":case"TOLY":case"TOPE":case"TPE1":case"TSRC":p=u.splitValue(i,c);break;default:p=i>=4?u.splitValue(i,c):[c]}break;case"TXXX":p=u.readIdentifierAndData(t,d+1,f,h),p={description:p.id,text:u.splitValue(i,a.default.decodeString(p.data,h).replace(/\x00+$/,""))};break;case"PIC":case"APIC":if(l){const r={};switch(d+=1,i){case 2:r.format=a.default.decodeString(t.slice(d,d+3),h),d+=3;break;case 3:case 4:g=a.default.findZero(t,d,f,"iso-8859-1"),r.format=a.default.decodeString(t.slice(d,g),"iso-8859-1"),d=g+1;break;default:throw new Error("Warning: unexpected major versionIndex: "+i)}r.format=u.fixPictureMimeType(r.format),r.type=s.AttachedPictureType[t[d]],d+=1,g=a.default.findZero(t,d,f,h),r.description=a.default.decodeString(t.slice(d,g),h),d=g+m,r.data=e.from(t.slice(d,f)),p=r}break;case"CNT":case"PCNT":p=n.UINT32_BE.get(t,0);break;case"SYLT":for(d+=7,p=[];d=5?t.readUInt32BE(d+1):void 0};break;case"GEOB":{g=a.default.findZero(t,d+1,f,h);const e=a.default.decodeString(t.slice(d+1,g),"iso-8859-1");d=g+1,g=a.default.findZero(t,d,f-d,h);const r=a.default.decodeString(t.slice(d+1,g),"iso-8859-1");d=g+1,g=a.default.findZero(t,d,f-d,h);p={type:e,filename:r,description:a.default.decodeString(t.slice(d+1,g),"iso-8859-1"),data:t.slice(d+1,f)};break}case"WCOM":case"WCOP":case"WOAF":case"WOAR":case"WOAS":case"WORS":case"WPAY":case"WPUB":p=a.default.decodeString(t.slice(d,g),h);break;case"WXXX":{g=a.default.findZero(t,d+1,f,h);const e=a.default.decodeString(t.slice(d+1,g),"iso-8859-1");d=g+1,p={description:e,url:a.default.decodeString(t.slice(d,f-d),h)};break}case"MCDI":p=t.slice(0,f);break;default:o("Warning: unsupported id3v2-tag-type: "+r)}return p}static fixPictureMimeType(e){switch(e=e.toLocaleLowerCase()){case"jpg":return"image/jpeg";case"png":return"image/png"}return e}static functionList(e){const t={};for(let r=0;r+1=4?/\x00/g:/\//g);return u.trimArray(r)}static trimArray(e){for(let t=0;t=r,"COMMON CHUNK size should always be at least "+r),this.len=e.chunkSize}get(e,t){const r=e.readUInt16BE(t+8)-16398,n=e.readUInt16BE(t+8+2),s={numChannels:e.readUInt16BE(t),numSampleFrames:e.readUInt32BE(t+2),sampleSize:e.readUInt16BE(t+6),sampleRate:r<0?n>>Math.abs(r):n<22){const r=e.readInt8(t+22);if(23+r+(r+1)%2!==this.len)throw new Error("Illegal pstring length");s.compressionName=new i.StringType(r,"binary").get(e,t+23)}}else s.compressionName="PCM";return s}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=r(7);t.Header={len:8,get:(e,t)=>({chunkID:i.FourCcToken.get(e,t),chunkSize:e.readUInt32BE(t+4)})}},function(e,t){},function(e,t,r){"use strict";var i=r(33).Buffer,n=r(243);e.exports=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.head=null,this.tail=null,this.length=0}return e.prototype.push=function(e){var t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length},e.prototype.unshift=function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length},e.prototype.shift=function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}},e.prototype.clear=function(){this.head=this.tail=null,this.length=0},e.prototype.join=function(e){if(0===this.length)return"";for(var t=this.head,r=""+t.data;t=t.next;)r+=e+t.data;return r},e.prototype.concat=function(e){if(0===this.length)return i.alloc(0);if(1===this.length)return this.head.data;for(var t,r,n,a=i.allocUnsafe(e>>>0),s=this.head,o=0;s;)t=s.data,r=a,n=o,t.copy(r,n),o+=s.data.length,s=s.next;return a},e}(),n&&n.inspect&&n.inspect.custom&&(e.exports.prototype[n.inspect.custom]=function(){var e=n.inspect({length:this.length});return this.constructor.name+" "+e})},function(e,t){},function(e,t,r){(function(t){function r(e){try{if(!t.localStorage)return!1}catch(e){return!1}var r=t.localStorage[e];return null!=r&&"true"===String(r).toLowerCase()}e.exports=function(e,t){if(r("noDeprecation"))return e;var i=!1;return function(){if(!i){if(r("throwDeprecation"))throw new Error(t);r("traceDeprecation")?console.trace(t):console.warn(t),i=!0}return e.apply(this,arguments)}}}).call(this,r(10))},function(e,t,r){ + */var i=/^[A-Za-z0-9][A-Za-z0-9!#$&^_.-]{0,126}$/,n=/^[A-Za-z0-9][A-Za-z0-9!#$&^_-]{0,126}$/,a=/^ *([A-Za-z0-9][A-Za-z0-9!#$&^_-]{0,126})\/([A-Za-z0-9][A-Za-z0-9!#$&^_.+-]{0,126}) *$/;function s(e,t,r){this.type=e,this.subtype=t,this.suffix=r}t.format=function(e){if(!e||"object"!=typeof e)throw new TypeError("argument obj is required");var t=e.subtype,r=e.suffix,a=e.type;if(!a||!n.test(a))throw new TypeError("invalid type");if(!t||!i.test(t))throw new TypeError("invalid subtype");var s=a+"/"+t;if(r){if(!n.test(r))throw new TypeError("invalid suffix");s+="+"+r}return s},t.parse=function(e){if(!e)throw new TypeError("argument string is required");if("string"!=typeof e)throw new TypeError("argument string is required to be a string");var t=a.exec(e.toLowerCase());if(!t)throw new TypeError("invalid media type");var r,i=t[1],n=t[2],o=n.lastIndexOf("+");-1!==o&&(r=n.substr(o+1),n=n.substr(0,o));return new s(i,n,r)},t.test=function(e){if(!e)throw new TypeError("argument string is required");if("string"!=typeof e)throw new TypeError("argument string is required to be a string");return a.test(e.toLowerCase())}},function(e,t,r){e.exports=function(e){function t(e){let t=0;for(let r=0;r{if("%%"===r)return r;o++;const a=i.formatters[n];if("function"==typeof a){const i=e[o];r=a.call(t,i),e.splice(o,1),o--}return r}),i.formatArgs.call(t,e);(t.log||i.log).apply(t,e)}return s.namespace=e,s.enabled=i.enabled(e),s.useColors=i.useColors(),s.color=t(e),s.destroy=n,s.extend=a,"function"==typeof i.init&&i.init(s),i.instances.push(s),s}function n(){const e=i.instances.indexOf(this);return-1!==e&&(i.instances.splice(e,1),!0)}function a(e,t){const r=i(this.namespace+(void 0===t?":":t)+e);return r.log=this.log,r}function s(e){return e.toString().substring(2,e.toString().length-2).replace(/\.\*\?$/,"*")}return i.debug=i,i.default=i,i.coerce=function(e){if(e instanceof Error)return e.stack||e.message;return e},i.disable=function(){const e=[...i.names.map(s),...i.skips.map(s).map(e=>"-"+e)].join(",");return i.enable(""),e},i.enable=function(e){let t;i.save(e),i.names=[],i.skips=[];const r=("string"==typeof e?e:"").split(/[\s,]+/),n=r.length;for(t=0;t{i[t]=e[t]}),i.instances=[],i.names=[],i.skips=[],i.formatters={},i.selectColor=t,i.enable(i.load()),i}},function(e,t){var r=1e3,i=6e4,n=60*i,a=24*n;function s(e,t,r,i){var n=t>=1.5*r;return Math.round(e/r)+" "+i+(n?"s":"")}e.exports=function(e,t){t=t||{};var o=typeof e;if("string"===o&&e.length>0)return function(e){if((e=String(e)).length>100)return;var t=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(!t)return;var s=parseFloat(t[1]);switch((t[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return 315576e5*s;case"weeks":case"week":case"w":return 6048e5*s;case"days":case"day":case"d":return s*a;case"hours":case"hour":case"hrs":case"hr":case"h":return s*n;case"minutes":case"minute":case"mins":case"min":case"m":return s*i;case"seconds":case"second":case"secs":case"sec":case"s":return s*r;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return s;default:return}}(e);if("number"===o&&isFinite(e))return t.long?function(e){var t=Math.abs(e);if(t>=a)return s(e,t,a,"day");if(t>=n)return s(e,t,n,"hour");if(t>=i)return s(e,t,i,"minute");if(t>=r)return s(e,t,r,"second");return e+" ms"}(e):function(e){var t=Math.abs(e);if(t>=a)return Math.round(e/a)+"d";if(t>=n)return Math.round(e/n)+"h";if(t>=i)return Math.round(e/i)+"m";if(t>=r)return Math.round(e/r)+"s";return e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=r(52),n=r(564),a=r(565),s=r(96),o=r(66),u=i("music-metadata:collector"),l=["matroska","APEv2","vorbis","ID3v2.4","ID3v2.3","ID3v2.2","exif","asf","iTunes","ID3v1"];function h(e){return e.length>2?e.slice(0,e.length-1).join(", ")+" & "+e[e.length-1]:e.join(" & ")}t.MetadataCollector=class{constructor(e){this.opts=e,this.format={tagTypes:[]},this.native={},this.common={track:{no:null,of:null},disk:{no:null,of:null}},this.quality={warnings:[]},this.commonOrigin={},this.originPriority={},this.tagMapper=new a.CombinedTagMapper;let t=1;for(const e of l)this.originPriority[e]=t++;this.originPriority.artificial=500,this.originPriority.id3v1=600}hasAny(){return Object.keys(this.native).length>0}setFormat(e,t){u(`format: ${e} = ${t}`),this.format[e]=t,this.opts.observer&&this.opts.observer({metadata:this,tag:{type:"format",id:e,value:t}})}addTag(e,t,r){u(`tag ${e}.${t} = ${r}`),this.native[e]||(this.format.tagTypes.push(e),this.native[e]=[]),this.native[e].push({id:t,value:r}),this.toCommon(e,t,r)}addWarning(e){this.quality.warnings.push({message:e})}postMap(e,t){switch(t.id){case"artist":if(this.commonOrigin.artist===this.originPriority[e])return this.postMap("artificial",{id:"artists",value:t.value});this.common.artists||this.setGenericTag("artificial",{id:"artists",value:t.value});break;case"artists":if(!(this.common.artist&&this.commonOrigin.artist!==this.originPriority.artificial||this.common.artists&&-1!==this.common.artists.indexOf(t.value))){const e={id:"artist",value:h((this.common.artists||[]).concat([t.value]))};this.setGenericTag("artificial",e)}break;case"genre":t.value=s.CommonTagMapper.parseGenre(t.value);break;case"picture":t.value.format=s.CommonTagMapper.fixPictureMimeType(t.value.format);break;case"totaltracks":return void(this.common.track.of=s.CommonTagMapper.toIntOrNull(t.value));case"totaldiscs":return void(this.common.disk.of=s.CommonTagMapper.toIntOrNull(t.value));case"track":case"disk":const r=this.common[t.id].of;return this.common[t.id]=s.CommonTagMapper.normalizeTrack(t.value),void(this.common[t.id].of=null!=r?r:this.common[t.id].of);case"year":case"originalyear":t.value=parseInt(t.value,10);break;case"date":const i=parseInt(t.value.substr(0,4),10);isNaN(i)||(this.common.year=i);break;case"discogs_label_id":case"discogs_release_id":case"discogs_master_release_id":case"discogs_artist_id":case"discogs_votes":t.value="string"==typeof t.value?parseInt(t.value,10):t.value;break;case"replaygain_track_gain":case"replaygain_track_peak":case"replaygain_album_gain":case"replaygain_album_peak":t.value=o.toRatio(t.value);break;case"replaygain_track_minmax":t.value=t.value.split(",").map(e=>parseInt(e,10));break;case"replaygain_undo":const n=t.value.split(",").map(e=>parseInt(e,10));t.value={leftChannel:n[0],rightChannel:n[1]};break;case"gapless":t.value="1"===t.value;break;case"isrc":if(this.common[t.id]&&-1!==this.common[t.id].indexOf(t.value))return}this.setGenericTag(e,t)}toCommonMetadata(){return{format:this.format,native:this.native,quality:this.quality,common:this.common}}toCommon(e,t,r){const i={id:t,value:r},n=this.tagMapper.mapTag(e,i,this);n&&this.postMap(e,n)}setGenericTag(e,t){u(`common.${t.id} = ${t.value}`);const r=this.commonOrigin[t.id]||1e3,i=this.originPriority[e];if(n.isSingleton(t.id)){if(!(i<=r))return u(`Ignore native tag (singleton): ${e}.${t.id} = ${t.value}`);this.common[t.id]=t.value,this.commonOrigin[t.id]=i}else if(i===r)n.isUnique(t.id)&&-1!==this.common[t.id].indexOf(t.value)?u(`Ignore duplicate value: ${e}.${t.id} = ${t.value}`):this.common[t.id].push(t.value);else{if(!(i{this.registerTagMapper(e)})}mapTag(e,t,r){if(this.tagMappers[e])return this.tagMappers[e].mapGenericTag(t,r);throw new Error("No generic tag mapper defined for tag-format: "+e)}registerTagMapper(e){for(const t of e.tagTypes)this.tagMappers[t]=e}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=r(96),n={title:"title",artist:"artist",album:"album",year:"year",comment:"comment",track:"track",genre:"genre"};class a extends i.CommonTagMapper{constructor(){super(["ID3v1"],n)}}t.ID3v1TagMapper=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});class i{static decode(e){let t="";for(const r in e)e.hasOwnProperty(r)&&(t+=i.codePointToString(i.singleByteDecoder(e[r])));return t}static inRange(e,t,r){return t<=e&&e<=r}static codePointToString(e){return e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode(55296+(e>>10),56320+(1023&e)))}static singleByteDecoder(e){if(i.inRange(e,0,127))return e;const t=i.windows1252[e-128];if(null===t)throw Error("invaliding encoding");return t}}t.Windows1292Decoder=i,i.windows1252=[8364,129,8218,402,8222,8230,8224,8225,710,8240,352,8249,338,141,381,143,144,8216,8217,8220,8221,8226,8211,8212,732,8482,353,8250,339,157,382,376,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255]},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=r(37),n=r(75);function a(e){return{containsHeader:s(e,31),containsFooter:s(e,30),isHeader:s(e,31),readOnly:s(e,0),dataType:(6&e)>>1}}function s(e,t){return 0!=(e&1<({ID:n.FourCcToken.get(e,t),version:i.UINT32_LE.get(e,t+4)/1e3,descriptorBytes:i.UINT32_LE.get(e,t+8),headerBytes:i.UINT32_LE.get(e,t+12),seekTableBytes:i.UINT32_LE.get(e,t+16),headerDataBytes:i.UINT32_LE.get(e,t+20),apeFrameDataBytes:i.UINT32_LE.get(e,t+24),apeFrameDataBytesHigh:i.UINT32_LE.get(e,t+28),terminatingDataBytes:i.UINT32_LE.get(e,t+32),fileMD5:new i.BufferType(16).get(e,t+36)})},t.Header={len:24,get:(e,t)=>({compressionLevel:i.UINT16_LE.get(e,t),formatFlags:i.UINT16_LE.get(e,t+2),blocksPerFrame:i.UINT32_LE.get(e,t+4),finalFrameBlocks:i.UINT32_LE.get(e,t+8),totalFrames:i.UINT32_LE.get(e,t+12),bitsPerSample:i.UINT16_LE.get(e,t+16),channel:i.UINT16_LE.get(e,t+18),sampleRate:i.UINT32_LE.get(e,t+20)})},t.TagFooter={len:32,get:(e,t)=>({ID:new i.StringType(8,"ascii").get(e,t),version:i.UINT32_LE.get(e,t+8),size:i.UINT32_LE.get(e,t+12),fields:i.UINT32_LE.get(e,t+16),flags:a(i.UINT32_LE.get(e,t+20))})},t.TagItemHeader={len:8,get:(e,t)=>({size:i.UINT32_LE.get(e,t),flags:a(i.UINT32_LE.get(e,t+4))})},t.TagField=e=>new i.BufferType(e.size-t.TagFooter.len),t.parseTagFlags=a,t.isBitSet=s},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=r(96),n=r(66),a=r(304),s={TIT2:"title",TPE1:"artist","TXXX:Artists":"artists",TPE2:"albumartist",TALB:"album",TDRV:"date",TORY:"originalyear",TPOS:"disk",TCON:"genre",APIC:"picture",TCOM:"composer","USLT:description":"lyrics",TSOA:"albumsort",TSOT:"titlesort",TOAL:"originalalbum",TSOP:"artistsort",TSO2:"albumartistsort",TSOC:"composersort",TEXT:"lyricist","TXXX:Writer":"writer",TPE3:"conductor",TPE4:"remixer","IPLS:arranger":"arranger","IPLS:engineer":"engineer","IPLS:producer":"producer","IPLS:DJ-mix":"djmixer","IPLS:mix":"mixer",TPUB:"label",TIT1:"grouping",TIT3:"subtitle",TRCK:"track",TCMP:"compilation",POPM:"rating",TBPM:"bpm",TMED:"media","TXXX:CATALOGNUMBER":"catalognumber","TXXX:MusicBrainz Album Status":"releasestatus","TXXX:MusicBrainz Album Type":"releasetype","TXXX:MusicBrainz Album Release Country":"releasecountry","TXXX:RELEASECOUNTRY":"releasecountry","TXXX:SCRIPT":"script",TLAN:"language",TCOP:"copyright",WCOP:"license",TENC:"encodedby",TSSE:"encodersettings","TXXX:BARCODE":"barcode",TSRC:"isrc","TXXX:ASIN":"asin","TXXX:originalyear":"originalyear","UFID:http://musicbrainz.org":"musicbrainz_recordingid","TXXX:MusicBrainz Release Track Id":"musicbrainz_trackid","TXXX:MusicBrainz Album Id":"musicbrainz_albumid","TXXX:MusicBrainz Artist Id":"musicbrainz_artistid","TXXX:MusicBrainz Album Artist Id":"musicbrainz_albumartistid","TXXX:MusicBrainz Release Group Id":"musicbrainz_releasegroupid","TXXX:MusicBrainz Work Id":"musicbrainz_workid","TXXX:MusicBrainz TRM Id":"musicbrainz_trmid","TXXX:MusicBrainz Disc Id":"musicbrainz_discid","TXXX:ACOUSTID_ID":"acoustid_id","TXXX:Acoustid Id":"acoustid_id","TXXX:Acoustid Fingerprint":"acoustid_fingerprint","TXXX:MusicIP PUID":"musicip_puid","TXXX:MusicMagic Fingerprint":"musicip_fingerprint",WOAR:"website",TDRC:"date",TYER:"year",TDOR:"originaldate","TIPL:arranger":"arranger","TIPL:engineer":"engineer","TIPL:producer":"producer","TIPL:DJ-mix":"djmixer","TIPL:mix":"mixer",TMOO:"mood",SYLT:"lyrics",TSST:"discsubtitle",TKEY:"key",COMM:"comment",TOPE:"originalartist","PRIV:AverageLevel":"averageLevel","PRIV:PeakLevel":"peakLevel","TXXX:DISCOGS_ARTIST_ID":"discogs_artist_id","TXXX:DISCOGS_ARTISTS":"artists","TXXX:DISCOGS_ARTIST_NAME":"artists","TXXX:DISCOGS_ALBUM_ARTISTS":"albumartist","TXXX:DISCOGS_CATALOG":"catalognumber","TXXX:DISCOGS_COUNTRY":"releasecountry","TXXX:DISCOGS_DATE":"originaldate","TXXX:DISCOGS_LABEL":"label","TXXX:DISCOGS_LABEL_ID":"discogs_label_id","TXXX:DISCOGS_MASTER_RELEASE_ID":"discogs_master_release_id","TXXX:DISCOGS_RATING":"discogs_rating","TXXX:DISCOGS_RELEASED":"date","TXXX:DISCOGS_RELEASE_ID":"discogs_release_id","TXXX:DISCOGS_VOTES":"discogs_votes","TXXX:CATALOGID":"catalognumber","TXXX:STYLE":"genre","TXXX:REPLAYGAIN_TRACK_PEAK":"replaygain_track_peak","TXXX:REPLAYGAIN_TRACK_GAIN":"replaygain_track_gain","TXXX:REPLAYGAIN_ALBUM_PEAK":"replaygain_album_peak","TXXX:REPLAYGAIN_ALBUM_GAIN":"replaygain_album_gain","TXXX:MP3GAIN_MINMAX":"replaygain_track_minmax","TXXX:MP3GAIN_ALBUM_MINMAX":"replaygain_album_minmax","TXXX:MP3GAIN_UNDO":"replaygain_undo"};class o extends a.CaseInsensitiveTagMap{static toRating(e){return{source:e.email,rating:e.rating>0?(e.rating-1)/254*i.CommonTagMapper.maxRatingScore:void 0}}constructor(){super(["ID3v2.3","ID3v2.4"],s)}postMap(e,t){switch(e.id){case"UFID":"http://musicbrainz.org"===e.value.owner_identifier&&(e.id+=":"+e.value.owner_identifier,e.value=n.default.decodeString(e.value.identifier,"iso-8859-1"));break;case"PRIV":switch(e.value.owner_identifier){case"AverageLevel":case"PeakValue":e.id+=":"+e.value.owner_identifier,e.value=4===e.value.data.length?e.value.data.readUInt32LE(0):null,null===e.value&&t.addWarning("Failed to parse PRIV:PeakValue");break;default:t.addWarning("Unknown PRIV owner-identifier: "+e.value.owner_identifier)}break;case"COMM":e.value=e.value?e.value.text:null;break;case"POPM":e.value=o.toRating(e.value)}}}t.ID3v24TagMapper=o},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=r(96),n={Title:"title",Author:"artist","WM/AlbumArtist":"albumartist","WM/AlbumTitle":"album","WM/Year":"date","WM/OriginalReleaseTime":"originaldate","WM/OriginalReleaseYear":"originalyear",Description:"comment","WM/TrackNumber":"track","WM/PartOfSet":"disk","WM/Genre":"genre","WM/Composer":"composer","WM/Lyrics":"lyrics","WM/AlbumSortOrder":"albumsort","WM/TitleSortOrder":"titlesort","WM/ArtistSortOrder":"artistsort","WM/AlbumArtistSortOrder":"albumartistsort","WM/ComposerSortOrder":"composersort","WM/Writer":"lyricist","WM/Conductor":"conductor","WM/ModifiedBy":"remixer","WM/Engineer":"engineer","WM/Producer":"producer","WM/DJMixer":"djmixer","WM/Mixer":"mixer","WM/Publisher":"label","WM/ContentGroupDescription":"grouping","WM/SubTitle":"subtitle","WM/SetSubTitle":"discsubtitle","WM/IsCompilation":"compilation","WM/SharedUserRating":"rating","WM/BeatsPerMinute":"bpm","WM/Mood":"mood","WM/Media":"media","WM/CatalogNo":"catalognumber","MusicBrainz/Album Status":"releasestatus","MusicBrainz/Album Type":"releasetype","MusicBrainz/Album Release Country":"releasecountry","WM/Script":"script","WM/Language":"language",Copyright:"copyright",LICENSE:"license","WM/EncodedBy":"encodedby","WM/EncodingSettings":"encodersettings","WM/Barcode":"barcode","WM/ISRC":"isrc","MusicBrainz/Track Id":"musicbrainz_recordingid","MusicBrainz/Release Track Id":"musicbrainz_trackid","MusicBrainz/Album Id":"musicbrainz_albumid","MusicBrainz/Artist Id":"musicbrainz_artistid","MusicBrainz/Album Artist Id":"musicbrainz_albumartistid","MusicBrainz/Release Group Id":"musicbrainz_releasegroupid","MusicBrainz/Work Id":"musicbrainz_workid","MusicBrainz/TRM Id":"musicbrainz_trmid","MusicBrainz/Disc Id":"musicbrainz_discid","Acoustid/Id":"acoustid_id","Acoustid/Fingerprint":"acoustid_fingerprint","MusicIP/PUID":"musicip_puid","WM/ARTISTS":"artists","WM/InitialKey":"key",ASIN:"asin","WM/Work":"work","WM/AuthorURL":"website","WM/Picture":"picture"};class a extends i.CommonTagMapper{static toRating(e){return{rating:parseFloat(e+1)/5}}constructor(){super(["asf"],n)}postMap(e){switch(e.id){case"WM/SharedUserRating":const t=e.id.split(":");e.value=a.toRating(e.value),e.id=t[0]}}}t.AsfTagMapper=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=r(96);t.id3v22TagMap={TT2:"title",TP1:"artist",TP2:"albumartist",TAL:"album",TYE:"year",COM:"comment",TRK:"track",TPA:"disk",TCO:"genre",PIC:"picture",TCM:"composer",TOR:"originaldate",TOT:"work",TXT:"lyricist",TP3:"conductor",TPB:"label",TT1:"grouping",TT3:"subtitle",TLA:"language",TCR:"copyright",WCP:"license",TEN:"encodedby",TSS:"encodersettings",WAR:"website","COM:iTunPGAP":"gapless"};class n extends i.CommonTagMapper{constructor(){super(["ID3v2.2"],t.id3v22TagMap)}}t.ID3v22TagMapper=n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=r(304),n={Title:"title",Artist:"artist",Artists:"artists","Album Artist":"albumartist",Album:"album",Year:"date",Originalyear:"originalyear",Originaldate:"originaldate",Comment:"comment",Track:"track",Disc:"disk",DISCNUMBER:"disk",Genre:"genre","Cover Art (Front)":"picture","Cover Art (Back)":"picture",Composer:"composer",Lyrics:"lyrics",ALBUMSORT:"albumsort",TITLESORT:"titlesort",WORK:"work",ARTISTSORT:"artistsort",ALBUMARTISTSORT:"albumartistsort",COMPOSERSORT:"composersort",Lyricist:"lyricist",Writer:"writer",Conductor:"conductor",MixArtist:"remixer",Arranger:"arranger",Engineer:"engineer",Producer:"producer",DJMixer:"djmixer",Mixer:"mixer",Label:"label",Grouping:"grouping",Subtitle:"subtitle",DiscSubtitle:"discsubtitle",Compilation:"compilation",BPM:"bpm",Mood:"mood",Media:"media",CatalogNumber:"catalognumber",MUSICBRAINZ_ALBUMSTATUS:"releasestatus",MUSICBRAINZ_ALBUMTYPE:"releasetype",RELEASECOUNTRY:"releasecountry",Script:"script",Language:"language",Copyright:"copyright",LICENSE:"license",EncodedBy:"encodedby",EncoderSettings:"encodersettings",Barcode:"barcode",ISRC:"isrc",ASIN:"asin",musicbrainz_trackid:"musicbrainz_recordingid",musicbrainz_releasetrackid:"musicbrainz_trackid",MUSICBRAINZ_ALBUMID:"musicbrainz_albumid",MUSICBRAINZ_ARTISTID:"musicbrainz_artistid",MUSICBRAINZ_ALBUMARTISTID:"musicbrainz_albumartistid",MUSICBRAINZ_RELEASEGROUPID:"musicbrainz_releasegroupid",MUSICBRAINZ_WORKID:"musicbrainz_workid",MUSICBRAINZ_TRMID:"musicbrainz_trmid",MUSICBRAINZ_DISCID:"musicbrainz_discid",Acoustid_Id:"acoustid_id",ACOUSTID_FINGERPRINT:"acoustid_fingerprint",MUSICIP_PUID:"musicip_puid",Weblink:"website",REPLAYGAIN_TRACK_GAIN:"replaygain_track_gain",REPLAYGAIN_TRACK_PEAK:"replaygain_track_peak",MP3GAIN_MINMAX:"replaygain_track_minmax",MP3GAIN_UNDO:"replaygain_undo"};class a extends i.CaseInsensitiveTagMap{constructor(){super(["APEv2"],n)}}t.APEv2TagMapper=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=r(96),n={"©nam":"title","©ART":"artist",aART:"albumartist","----:com.apple.iTunes:Band":"albumartist","©alb":"album","©day":"date","©cmt":"comment",trkn:"track",disk:"disk","©gen":"genre",covr:"picture","©wrt":"composer","©lyr":"lyrics",soal:"albumsort",sonm:"titlesort",soar:"artistsort",soaa:"albumartistsort",soco:"composersort","----:com.apple.iTunes:LYRICIST":"lyricist","----:com.apple.iTunes:CONDUCTOR":"conductor","----:com.apple.iTunes:REMIXER":"remixer","----:com.apple.iTunes:ENGINEER":"engineer","----:com.apple.iTunes:PRODUCER":"producer","----:com.apple.iTunes:DJMIXER":"djmixer","----:com.apple.iTunes:MIXER":"mixer","----:com.apple.iTunes:LABEL":"label","©grp":"grouping","----:com.apple.iTunes:SUBTITLE":"subtitle","----:com.apple.iTunes:DISCSUBTITLE":"discsubtitle",cpil:"compilation",tmpo:"bpm","----:com.apple.iTunes:MOOD":"mood","----:com.apple.iTunes:MEDIA":"media","----:com.apple.iTunes:CATALOGNUMBER":"catalognumber",tvsh:"tvShow",tvsn:"tvSeason",tves:"tvEpisode",sosn:"tvShowSort",tven:"tvEpisodeId",tvnn:"tvNetwork",pcst:"podcast",purl:"podcasturl","----:com.apple.iTunes:MusicBrainz Album Status":"releasestatus","----:com.apple.iTunes:MusicBrainz Album Type":"releasetype","----:com.apple.iTunes:MusicBrainz Album Release Country":"releasecountry","----:com.apple.iTunes:SCRIPT":"script","----:com.apple.iTunes:LANGUAGE":"language",cprt:"copyright","----:com.apple.iTunes:LICENSE":"license","©too":"encodedby",pgap:"gapless","----:com.apple.iTunes:BARCODE":"barcode","----:com.apple.iTunes:ISRC":"isrc","----:com.apple.iTunes:ASIN":"asin","----:com.apple.iTunes:NOTES":"comment","----:com.apple.iTunes:MusicBrainz Track Id":"musicbrainz_recordingid","----:com.apple.iTunes:MusicBrainz Release Track Id":"musicbrainz_trackid","----:com.apple.iTunes:MusicBrainz Album Id":"musicbrainz_albumid","----:com.apple.iTunes:MusicBrainz Artist Id":"musicbrainz_artistid","----:com.apple.iTunes:MusicBrainz Album Artist Id":"musicbrainz_albumartistid","----:com.apple.iTunes:MusicBrainz Release Group Id":"musicbrainz_releasegroupid","----:com.apple.iTunes:MusicBrainz Work Id":"musicbrainz_workid","----:com.apple.iTunes:MusicBrainz TRM Id":"musicbrainz_trmid","----:com.apple.iTunes:MusicBrainz Disc Id":"musicbrainz_discid","----:com.apple.iTunes:Acoustid Id":"acoustid_id","----:com.apple.iTunes:Acoustid Fingerprint":"acoustid_fingerprint","----:com.apple.iTunes:MusicIP PUID":"musicip_puid","----:com.apple.iTunes:fingerprint":"musicip_fingerprint","----:com.apple.iTunes:replaygain_track_gain":"replaygain_track_gain","----:com.apple.iTunes:replaygain_track_peak":"replaygain_track_peak","----:com.apple.iTunes:replaygain_album_gain":"replaygain_album_gain","----:com.apple.iTunes:replaygain_album_peak":"replaygain_album_peak","----:com.apple.iTunes:replaygain_track_minmax":"replaygain_track_minmax","----:com.apple.iTunes:replaygain_album_minmax":"replaygain_album_minmax","----:com.apple.iTunes:replaygain_undo":"replaygain_undo",gnre:"genre","----:com.apple.iTunes:ALBUMARTISTSORT":"albumartistsort","----:com.apple.iTunes:ARTISTS":"artists","----:com.apple.iTunes:ORIGINALDATE":"originaldate","----:com.apple.iTunes:ORIGINALYEAR":"originalyear",desc:"description",ldes:"description"};t.tagType="iTunes";class a extends i.CommonTagMapper{constructor(){super([t.tagType],n)}}t.MP4TagMapper=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=r(96),n={TITLE:"title",ARTIST:"artist",ARTISTS:"artists",ALBUMARTIST:"albumartist",ALBUM:"album",DATE:"date",ORIGINALDATE:"originaldate",ORIGINALYEAR:"originalyear",COMMENT:"comment",TRACKNUMBER:"track",DISCNUMBER:"disk",GENRE:"genre",METADATA_BLOCK_PICTURE:"picture",COMPOSER:"composer",LYRICS:"lyrics",ALBUMSORT:"albumsort",TITLESORT:"titlesort",WORK:"work",ARTISTSORT:"artistsort",ALBUMARTISTSORT:"albumartistsort",COMPOSERSORT:"composersort",LYRICIST:"lyricist",WRITER:"writer",CONDUCTOR:"conductor",REMIXER:"remixer",ARRANGER:"arranger",ENGINEER:"engineer",PRODUCER:"producer",DJMIXER:"djmixer",MIXER:"mixer",LABEL:"label",GROUPING:"grouping",SUBTITLE:"subtitle",DISCSUBTITLE:"discsubtitle",TRACKTOTAL:"totaltracks",DISCTOTAL:"totaldiscs",COMPILATION:"compilation",RATING:"rating",BPM:"bpm",MOOD:"mood",MEDIA:"media",CATALOGNUMBER:"catalognumber",RELEASESTATUS:"releasestatus",RELEASETYPE:"releasetype",RELEASECOUNTRY:"releasecountry",SCRIPT:"script",LANGUAGE:"language",COPYRIGHT:"copyright",LICENSE:"license",ENCODEDBY:"encodedby",ENCODERSETTINGS:"encodersettings",BARCODE:"barcode",ISRC:"isrc",ASIN:"asin",MUSICBRAINZ_TRACKID:"musicbrainz_recordingid",MUSICBRAINZ_RELEASETRACKID:"musicbrainz_trackid",MUSICBRAINZ_ALBUMID:"musicbrainz_albumid",MUSICBRAINZ_ARTISTID:"musicbrainz_artistid",MUSICBRAINZ_ALBUMARTISTID:"musicbrainz_albumartistid",MUSICBRAINZ_RELEASEGROUPID:"musicbrainz_releasegroupid",MUSICBRAINZ_WORKID:"musicbrainz_workid",MUSICBRAINZ_TRMID:"musicbrainz_trmid",MUSICBRAINZ_DISCID:"musicbrainz_discid",ACOUSTID_ID:"acoustid_id",ACOUSTID_ID_FINGERPRINT:"acoustid_fingerprint",MUSICIP_PUID:"musicip_puid",WEBSITE:"website",NOTES:"notes",TOTALTRACKS:"totaltracks",TOTALDISCS:"totaldiscs",DISCOGS_ARTIST_ID:"discogs_artist_id",DISCOGS_ARTISTS:"artists",DISCOGS_ARTIST_NAME:"artists",DISCOGS_ALBUM_ARTISTS:"albumartist",DISCOGS_CATALOG:"catalognumber",DISCOGS_COUNTRY:"releasecountry",DISCOGS_DATE:"originaldate",DISCOGS_LABEL:"label",DISCOGS_LABEL_ID:"discogs_label_id",DISCOGS_MASTER_RELEASE_ID:"discogs_master_release_id",DISCOGS_RATING:"discogs_rating",DISCOGS_RELEASED:"date",DISCOGS_RELEASE_ID:"discogs_release_id",DISCOGS_VOTES:"discogs_votes",CATALOGID:"catalognumber",STYLE:"genre",REPLAYGAIN_TRACK_GAIN:"replaygain_track_gain",REPLAYGAIN_TRACK_PEAK:"replaygain_track_peak",REPLAYGAIN_ALBUM_GAIN:"replaygain_album_gain",REPLAYGAIN_ALBUM_PEAK:"replaygain_album_peak",REPLAYGAIN_MINMAX:"replaygain_track_minmax",REPLAYGAIN_ALBUM_MINMAX:"replaygain_album_minmax",REPLAYGAIN_UNDO:"replaygain_undo"};class a extends i.CommonTagMapper{static toRating(e,t){return{source:e?e.toLowerCase():e,rating:parseFloat(t)*i.CommonTagMapper.maxRatingScore}}constructor(){super(["vorbis"],n)}postMap(e){if(0===e.id.indexOf("RATING:")){const t=e.id.split(":");e.value=a.toRating(t[1],e.value),e.id=t[0]}}}t.VorbisTagMapper=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=r(96);t.riffInfoTagMap={IART:"artist",ICRD:"date",INAM:"title",TITL:"title",IPRD:"album",ITRK:"track",COMM:"comment",ICMT:"comment",ICNT:"releasecountry",GNRE:"genre",IWRI:"writer",RATE:"rating",YEAR:"year",ISFT:"encodedby",CODE:"encodedby",TURL:"website",IGNR:"genre",IENG:"engineer",ITCH:"technician",IMED:"media",IRPD:"album"};class n extends i.CommonTagMapper{constructor(){super(["exif"],t.riffInfoTagMap)}}t.RiffInfoTagMapper=n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=r(304),n={"album:ARITST":"albumartist","album:ARITSTSORT":"albumartistsort","album:TITLE":"album","album:DATE_RECORDED":"originaldate","track:ARTIST":"artist","track:ARTISTSORT":"artistsort","track:TITLE":"title","track:PART_NUMBER":"track","track:MUSICBRAINZ_TRACKID":"musicbrainz_recordingid","track:MUSICBRAINZ_ALBUMID":"musicbrainz_albumid","track:MUSICBRAINZ_ARTISTID":"musicbrainz_artistid","track:PUBLISHER":"label"};class a extends i.CaseInsensitiveTagMap{constructor(){super(["matroska"],n)}}t.MatroskaTagMapper=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=r(37),n=r(52),a=r(102),s=r(125),o=r(75),u=r(82),l=r(579),h=r(580),c=r(305),f=n("music-metadata:parser:aiff");class d extends u.BasicParser{async parse(){if("FORM"!==(await this.tokenizer.readToken(h.Header)).chunkID)throw new Error("Invalid Chunk-ID, expected 'FORM'");const e=await this.tokenizer.readToken(o.FourCcToken);switch(e){case"AIFF":this.metadata.setFormat("container",e),this.isCompressed=!1;break;case"AIFC":this.metadata.setFormat("container","AIFF-C"),this.isCompressed=!0;break;default:throw Error("Unsupported AIFF type: "+e)}this.metadata.setFormat("lossless",!this.isCompressed);try{for(;;){const e=await this.tokenizer.readToken(h.Header);f("Chunk id="+e.chunkID);const t=2*Math.round(e.chunkSize/2),r=await this.readData(e);await this.tokenizer.ignore(t-r)}}catch(e){if(!(e instanceof a.EndOfStreamError))throw e;f("End-of-stream")}}async readData(e){switch(e.chunkID){case"COMM":const t=await this.tokenizer.readToken(new l.Common(e,this.isCompressed));return this.metadata.setFormat("bitsPerSample",t.sampleSize),this.metadata.setFormat("sampleRate",t.sampleRate),this.metadata.setFormat("numberOfChannels",t.numChannels),this.metadata.setFormat("numberOfSamples",t.numSampleFrames),this.metadata.setFormat("duration",t.numSampleFrames/t.sampleRate),this.metadata.setFormat("codec",t.compressionName),e.chunkSize;case"ID3 ":const r=await this.tokenizer.readToken(new i.BufferType(e.chunkSize)),n=new c.ID3Stream(r),o=a.fromStream(n);return await(new s.ID3v2Parser).parse(this.metadata,o,this.options),e.chunkSize;case"SSND":return this.metadata.format.duration&&this.metadata.setFormat("bitrate",8*e.chunkSize/this.metadata.format.duration),0;default:return 0}}}t.AIFFParser=d},function(e,t,r){"use strict";(function(e){Object.defineProperty(t,"__esModule",{value:!0});const i=r(52),n=r(37),a=r(66),s=r(126),o=i("music-metadata:id3v2:frame-parser");class u{static readData(t,r,i,l){if(0===t.length)return;const{encoding:h,bom:c}=s.TextEncodingToken.get(t,0),f=t.length;let d=0,p=[];const m=u.getNullTerminatorLength(h);let g;const b={};switch(o(`Parsing tag type=${r}, encoding=${h}, bom=${c}`),"TXXX"!==r&&"T"===r[0]?"T*":r){case"T*":case"IPLS":const c=a.default.decodeString(t.slice(1),h).replace(/\x00+$/,"");switch(r){case"TMCL":case"TIPL":case"IPLS":p=u.splitValue(4,c),p=u.functionList(p);break;case"TRK":case"TRCK":case"TPOS":p=c;break;case"TCOM":case"TEXT":case"TOLY":case"TOPE":case"TPE1":case"TSRC":p=u.splitValue(i,c);break;default:p=i>=4?u.splitValue(i,c):[c]}break;case"TXXX":p=u.readIdentifierAndData(t,d+1,f,h),p={description:p.id,text:u.splitValue(i,a.default.decodeString(p.data,h).replace(/\x00+$/,""))};break;case"PIC":case"APIC":if(l){const r={};switch(d+=1,i){case 2:r.format=a.default.decodeString(t.slice(d,d+3),h),d+=3;break;case 3:case 4:g=a.default.findZero(t,d,f,"iso-8859-1"),r.format=a.default.decodeString(t.slice(d,g),"iso-8859-1"),d=g+1;break;default:throw new Error("Warning: unexpected major versionIndex: "+i)}r.format=u.fixPictureMimeType(r.format),r.type=s.AttachedPictureType[t[d]],d+=1,g=a.default.findZero(t,d,f,h),r.description=a.default.decodeString(t.slice(d,g),h),d=g+m,r.data=e.from(t.slice(d,f)),p=r}break;case"CNT":case"PCNT":p=n.UINT32_BE.get(t,0);break;case"SYLT":for(d+=7,p=[];d=5?t.readUInt32BE(d+1):void 0};break;case"GEOB":{g=a.default.findZero(t,d+1,f,h);const e=a.default.decodeString(t.slice(d+1,g),"iso-8859-1");d=g+1,g=a.default.findZero(t,d,f-d,h);const r=a.default.decodeString(t.slice(d+1,g),"iso-8859-1");d=g+1,g=a.default.findZero(t,d,f-d,h);p={type:e,filename:r,description:a.default.decodeString(t.slice(d+1,g),"iso-8859-1"),data:t.slice(d+1,f)};break}case"WCOM":case"WCOP":case"WOAF":case"WOAR":case"WOAS":case"WORS":case"WPAY":case"WPUB":p=a.default.decodeString(t.slice(d,g),h);break;case"WXXX":{g=a.default.findZero(t,d+1,f,h);const e=a.default.decodeString(t.slice(d+1,g),"iso-8859-1");d=g+1,p={description:e,url:a.default.decodeString(t.slice(d,f-d),h)};break}case"MCDI":p=t.slice(0,f);break;default:o("Warning: unsupported id3v2-tag-type: "+r)}return p}static fixPictureMimeType(e){switch(e=e.toLocaleLowerCase()){case"jpg":return"image/jpeg";case"png":return"image/png"}return e}static functionList(e){const t={};for(let r=0;r+1=4?/\x00/g:/\//g);return u.trimArray(r)}static trimArray(e){for(let t=0;t=r,"COMMON CHUNK size should always be at least "+r),this.len=e.chunkSize}get(e,t){const r=e.readUInt16BE(t+8)-16398,n=e.readUInt16BE(t+8+2),s={numChannels:e.readUInt16BE(t),numSampleFrames:e.readUInt32BE(t+2),sampleSize:e.readUInt16BE(t+6),sampleRate:r<0?n>>Math.abs(r):n<22){const r=e.readInt8(t+22);if(23+r+(r+1)%2!==this.len)throw new Error("Illegal pstring length");s.compressionName=new i.StringType(r,"binary").get(e,t+23)}}else s.compressionName="PCM";return s}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=r(75);t.Header={len:8,get:(e,t)=>({chunkID:i.FourCcToken.get(e,t),chunkSize:e.readUInt32BE(t+4)})}},function(e,t){},function(e,t,r){"use strict";var i=r(308).Buffer,n=r(583);e.exports=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.head=null,this.tail=null,this.length=0}return e.prototype.push=function(e){var t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length},e.prototype.unshift=function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length},e.prototype.shift=function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}},e.prototype.clear=function(){this.head=this.tail=null,this.length=0},e.prototype.join=function(e){if(0===this.length)return"";for(var t=this.head,r=""+t.data;t=t.next;)r+=e+t.data;return r},e.prototype.concat=function(e){if(0===this.length)return i.alloc(0);if(1===this.length)return this.head.data;for(var t,r,n,a=i.allocUnsafe(e>>>0),s=this.head,o=0;s;)t=s.data,r=a,n=o,t.copy(r,n),o+=s.data.length,s=s.next;return a},e}(),n&&n.inspect&&n.inspect.custom&&(e.exports.prototype[n.inspect.custom]=function(){var e=n.inspect({length:this.length});return this.constructor.name+" "+e})},function(e,t){},function(e,t,r){(function(t){function r(e){try{if(!t.localStorage)return!1}catch(e){return!1}var r=t.localStorage[e];return null!=r&&"true"===String(r).toLowerCase()}e.exports=function(e,t){if(r("noDeprecation"))return e;var i=!1;return function(){if(!i){if(r("throwDeprecation"))throw new Error(t);r("traceDeprecation")?console.trace(t):console.warn(t),i=!0}return e.apply(this,arguments)}}}).call(this,r(88))},function(e,t,r){ /*! safe-buffer. MIT License. Feross Aboukhadijeh */ -var i=r(2),n=i.Buffer;function a(e,t){for(var r in e)t[r]=e[r]}function s(e,t,r){return n(e,t,r)}n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow?e.exports=i:(a(i,t),t.Buffer=s),s.prototype=Object.create(n.prototype),a(n,s),s.from=function(e,t,r){if("number"==typeof e)throw new TypeError("Argument must not be a number");return n(e,t,r)},s.alloc=function(e,t,r){if("number"!=typeof e)throw new TypeError("Argument must be a number");var i=n(e);return void 0!==t?"string"==typeof r?i.fill(t,r):i.fill(t):i.fill(0),i},s.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return n(e)},s.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return i.SlowBuffer(e)}},function(e,t,r){"use strict";e.exports=a;var i=r(48),n=Object.create(r(21));function a(e){if(!(this instanceof a))return new a(e);i.call(this,e)}n.inherits=r(18),n.inherits(a,i),a.prototype._transform=function(e,t,r){r(null,e)}},function(e,t,r){e.exports=r(34)},function(e,t,r){e.exports=r(13)},function(e,t,r){e.exports=r(32).Transform},function(e,t,r){e.exports=r(32).PassThrough},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=r(49),n=r(252),a=r(3),s=r(8),o=a("music-metadata:parser:ASF");class u extends s.BasicParser{async parse(){const e=await this.tokenizer.readToken(n.TopLevelHeaderObjectToken);if(!e.objectId.equals(i.default.HeaderObject))throw new Error("expected asf header; but was not found; got: "+e.objectId.str);try{await this.parseObjectHeader(e.numberOfHeaderObjects)}catch(e){o("Error while parsing ASF: %s",e)}}async parseObjectHeader(e){let t;do{const e=await this.tokenizer.readToken(n.HeaderObjectToken);switch(o("header GUID=%s",e.objectId.str),e.objectId.str){case n.FilePropertiesObject.guid.str:const r=await this.tokenizer.readToken(new n.FilePropertiesObject(e));this.metadata.setFormat("duration",r.playDuration/1e7),this.metadata.setFormat("bitrate",r.maximumBitrate);break;case n.StreamPropertiesObject.guid.str:const a=await this.tokenizer.readToken(new n.StreamPropertiesObject(e));this.metadata.setFormat("container","ASF/"+a.streamType);break;case n.HeaderExtensionObject.guid.str:const s=await this.tokenizer.readToken(new n.HeaderExtensionObject);await this.parseExtensionObject(s.extensionDataSize);break;case n.ContentDescriptionObjectState.guid.str:t=await this.tokenizer.readToken(new n.ContentDescriptionObjectState(e)),this.addTags(t);break;case n.ExtendedContentDescriptionObjectState.guid.str:t=await this.tokenizer.readToken(new n.ExtendedContentDescriptionObjectState(e)),this.addTags(t);break;case i.default.CodecListObject.str:case i.default.StreamBitratePropertiesObject.str:await this.tokenizer.ignore(e.objectSize-n.HeaderObjectToken.len);break;case i.default.PaddingObject.str:o("Padding: %s bytes",e.objectSize-n.HeaderObjectToken.len),await this.tokenizer.ignore(e.objectSize-n.HeaderObjectToken.len);break;default:this.metadata.addWarning("Ignore ASF-Object-GUID: "+e.objectId.str),o("Ignore ASF-Object-GUID: %s",e.objectId.str),await this.tokenizer.readToken(new n.IgnoreObjectState(e))}}while(--e)}addTags(e){e.forEach(e=>{this.metadata.addTag("asf",e.id,e.value)})}async parseExtensionObject(e){do{const t=await this.tokenizer.readToken(n.HeaderObjectToken);switch(t.objectId.str){case n.ExtendedStreamPropertiesObjectState.guid.str:await this.tokenizer.readToken(new n.ExtendedStreamPropertiesObjectState(t));break;case n.MetadataObjectState.guid.str:const e=await this.tokenizer.readToken(new n.MetadataObjectState(t));this.addTags(e);break;case n.MetadataLibraryObjectState.guid.str:const r=await this.tokenizer.readToken(new n.MetadataLibraryObjectState(t));this.addTags(r);break;case i.default.PaddingObject.str:await this.tokenizer.ignore(t.objectSize-n.HeaderObjectToken.len);break;case i.default.CompatibilityObject.str:this.tokenizer.ignore(t.objectSize-n.HeaderObjectToken.len);break;case i.default.ASF_Index_Placeholder_Object.str:await this.tokenizer.ignore(t.objectSize-n.HeaderObjectToken.len);break;default:this.metadata.addWarning("Ignore ASF-Object-GUID: "+t.objectId.str),await this.tokenizer.readToken(new n.IgnoreObjectState(t))}e-=t.objectSize}while(e>0)}}t.AsfParser=u},function(e,t,r){"use strict";(function(e){Object.defineProperty(t,"__esModule",{value:!0});const i=r(5),n=r(1),a=r(49),s=r(253),o=r(20);!function(e){e[e.UnicodeString=0]="UnicodeString",e[e.ByteArray=1]="ByteArray",e[e.Bool=2]="Bool",e[e.DWord=3]="DWord",e[e.QWord=4]="QWord",e[e.Word=5]="Word"}(t.DataType||(t.DataType={})),t.TopLevelHeaderObjectToken={len:30,get:(e,t)=>({objectId:a.default.fromBin(new n.BufferType(16).get(e,t)),objectSize:n.UINT64_LE.get(e,t+16),numberOfHeaderObjects:n.UINT32_LE.get(e,t+24)})},t.HeaderObjectToken={len:24,get:(e,t)=>({objectId:a.default.fromBin(new n.BufferType(16).get(e,t)),objectSize:n.UINT64_LE.get(e,t+16)})};class u{constructor(e){this.len=e.objectSize-t.HeaderObjectToken.len}postProcessTag(e,t,r,i){if("WM/Picture"===t)e.push({id:t,value:b.fromBuffer(i)});else{const n=s.AsfUtil.getParserForAttr(r);if(!n)throw new Error("unexpected value headerType: "+r);e.push({id:t,value:n(i)})}}}t.State=u;t.IgnoreObjectState=class extends u{constructor(e){super(e)}get(e,t){return null}};class l extends u{constructor(e){super(e)}get(e,t){return{fileId:a.default.fromBin(e,t),fileSize:n.UINT64_LE.get(e,t+16),creationDate:n.UINT64_LE.get(e,t+24),dataPacketsCount:n.UINT64_LE.get(e,t+32),playDuration:n.UINT64_LE.get(e,t+40),sendDuration:n.UINT64_LE.get(e,t+48),preroll:n.UINT64_LE.get(e,t+56),flags:{broadcast:i.default.strtokBITSET.get(e,t+64,24),seekable:i.default.strtokBITSET.get(e,t+64,25)},minimumDataPacketSize:n.UINT32_LE.get(e,t+68),maximumDataPacketSize:n.UINT32_LE.get(e,t+72),maximumBitrate:n.UINT32_LE.get(e,t+76)}}}t.FilePropertiesObject=l,l.guid=a.default.FilePropertiesObject;class h extends u{constructor(e){super(e)}get(e,t){return{streamType:a.default.decodeMediaType(a.default.fromBin(e,t)),errorCorrectionType:a.default.fromBin(e,t+8)}}}t.StreamPropertiesObject=h,h.guid=a.default.StreamPropertiesObject;class c{constructor(){this.len=22}get(e,t){return{reserved1:a.default.fromBin(e,t),reserved2:e.readUInt16LE(t+16),extensionDataSize:e.readUInt32LE(t+18)}}}t.HeaderExtensionObject=c,c.guid=a.default.HeaderExtensionObject;class f extends u{constructor(e){super(e)}get(e,t){const r=[];let i=t+10;for(let n=0;n0){const t=f.contentDescTags[n],o=i+a;r.push({id:t,value:s.AsfUtil.parseUnicodeAttr(e.slice(i,o))}),i=o}}return r}}t.ContentDescriptionObjectState=f,f.guid=a.default.ContentDescriptionObject,f.contentDescTags=["Title","Author","Copyright","Description","Rating"];class d extends u{constructor(e){super(e)}get(e,t){const r=[],i=e.readUInt16LE(t);let n=t+2;for(let t=0;t({lastBlock:i.default.strtokBITSET.get(e,t,7),type:i.default.getBitAllignedNumber(e,t,1,7),length:n.UINT24_BE.get(e,t+1)})},p.BlockStreamInfo={len:34,get:(e,t)=>({minimumBlockSize:n.UINT16_BE.get(e,t),maximumBlockSize:n.UINT16_BE.get(e,t+2)/1e3,minimumFrameSize:n.UINT24_BE.get(e,t+4),maximumFrameSize:n.UINT24_BE.get(e,t+7),sampleRate:n.UINT24_BE.get(e,t+10)>>4,channels:i.default.getBitAllignedNumber(e,t+12,4,3)+1,bitsPerSample:i.default.getBitAllignedNumber(e,t+12,7,5)+1,totalSamples:i.default.getBitAllignedNumber(e,t+13,4,36),fileMD5:new n.BufferType(16).get(e,t+18)})}},function(e,t,r){"use strict";(function(e){Object.defineProperty(t,"__esModule",{value:!0});const i=r(3),n=r(1),a=r(6),s=r(8),o=r(256),u=r(52),l=r(24),h=i("music-metadata:parser:MP4"),c={raw:{lossy:!1,format:"raw"},MAC3:{lossy:!0,format:"MACE 3:1"},MAC6:{lossy:!0,format:"MACE 6:1"},ima4:{lossy:!0,format:"IMA 4:1"},ulaw:{lossy:!0,format:"uLaw 2:1"},alaw:{lossy:!0,format:"uLaw 2:1"},Qclp:{lossy:!0,format:"QUALCOMM PureVoice"},".mp3":{lossy:!0,format:"MPEG-1 layer 3"},alac:{lossy:!1,format:"ALAC"},"ac-3":{lossy:!0,format:"AC-3"},mp4a:{lossy:!0,format:"MPEG-4/AAC"},mp4s:{lossy:!0,format:"MP4S"},c608:{lossy:!0,format:"CEA-608"},c708:{lossy:!0,format:"CEA-708"}};function f(e,t,r){return r.indexOf(e)===t}class d extends s.BasicParser{static read_BE_Signed_Integer(e){return n.readIntBE(e,0,e.length)}static read_BE_Unsigned_Integer(e){return n.readUIntBE(e,0,e.length)}async parse(){this.tracks=[];let e=this.tokenizer.fileSize;for(;!this.tokenizer.fileSize||e>0;){try{await this.tokenizer.peekToken(u.Header)}catch(e){const t=`Error at offset=${this.tokenizer.position}: ${e.message}`;h(t),this.addWarning(t);break}e-=(await o.Atom.readAtom(this.tokenizer,e=>this.handleAtom(e),null)).header.length}const t=[];this.tracks.forEach(e=>{const r=[];e.soundSampleDescription.forEach(e=>{const t=c[e.dataFormat];t&&r.push(t.format)}),r.length>=1&&t.push(r.join("/"))}),t.length>0&&this.metadata.setFormat("codec",t.filter(f).join("+"));const r=this.tracks.filter(e=>e.soundSampleDescription.length>=1&&e.soundSampleDescription[0].description&&e.soundSampleDescription[0].description.sampleRate>0);if(r.length>=1){const e=r[0],t=e.duration/e.timeScale;this.metadata.setFormat("duration",t);const i=e.soundSampleDescription[0];i.description&&(this.metadata.setFormat("sampleRate",i.description.sampleRate),this.metadata.setFormat("bitsPerSample",i.description.sampleSize),this.metadata.setFormat("numberOfChannels",i.description.numAudioChannels));const n=c[i.dataFormat];n&&this.metadata.setFormat("lossless",!n.lossy),this.calculateBitRate()}}async handleAtom(e){if(e.parent)switch(e.parent.header.name){case"ilst":case"":return this.parseMetadataItemData(e);case"stbl":switch(e.header.name){case"stsd":return this.parseAtom_stsd(e.getPayloadLength());case"stsc":return this.parseAtom_stsc(e.getPayloadLength());case"stts":return this.parseAtom_stts(e.getPayloadLength());case"stsz":return this.parseAtom_stsz(e.getPayloadLength());case"stco":return this.parseAtom_stco(e.getPayloadLength());default:h(`Ignore: stbl/${e.header.name} atom`)}}switch(e.header.name){case"ftyp":const t=await this.parseAtom_ftyp(e.getPayloadLength());h("ftyp: "+t.join("/"));const r=t.filter(f).join("/");return void this.metadata.setFormat("container",r);case"mdhd":return this.parseAtom_mdhd(e);case"mvhd":return this.parseAtom_mvhd(e);case"mdat":this.audioLengthInBytes=e.getPayloadLength(),this.calculateBitRate()}switch(e.header.name){case"ftyp":const t=await this.parseAtom_ftyp(e.getPayloadLength());h("ftyp: "+t.join("/"));const r=t.filter(f).join("/");return void this.metadata.setFormat("container",r);case"mdhd":return this.parseAtom_mdhd(e);case"mvhd":return this.parseAtom_mvhd(e);case"chap":return void(this.getTrackDescription().chapterList=await this.parseAtom_chap(e));case"tkhd":return void await this.parseAtom_tkhd(e.getPayloadLength());case"mdat":return this.audioLengthInBytes=e.getPayloadLength(),this.calculateBitRate(),this.parseAtom_mdat(e.getPayloadLength())}await this.tokenizer.ignore(e.getPayloadLength()),h(`Ignore atom data: path=${e.atomPath}, payload-len=${e.getPayloadLength()}`)}getTrackDescription(){return this.tracks[this.tracks.length-1]}calculateBitRate(){this.audioLengthInBytes&&this.metadata.format.duration&&this.metadata.setFormat("bitrate",8*this.audioLengthInBytes/this.metadata.format.duration)}addTag(e,t){this.metadata.addTag("iTunes",e,t)}addWarning(e){h("Warning: "+e),this.metadata.addWarning(e)}parseMetadataItemData(e){let t=e.header.name;return e.readAtoms(this.tokenizer,async e=>{switch(e.header.name){case"data":return this.parseValueAtom(t,e);case"name":const r=await this.tokenizer.readToken(new u.NameAtom(e.getPayloadLength()));t+=":"+r.name;break;case"mean":const i=await this.tokenizer.readToken(new u.NameAtom(e.getPayloadLength()));t+=":"+i.name;break;default:const a=await this.tokenizer.readToken(new n.BufferType(e.getPayloadLength()));this.addWarning("Unsupported meta-item: "+t+"["+e.header.name+"] => value="+a.toString("hex")+" ascii="+a.toString("ascii"))}},e.getPayloadLength())}async parseValueAtom(t,r){const i=await this.tokenizer.readToken(new u.DataAtom(r.header.length-u.Header.len));if(0!==i.type.set)throw new Error("Unsupported type-set != 0: "+i.type.set);switch(i.type.type){case 0:switch(t){case"trkn":case"disk":const e=n.UINT8.get(i.value,3),r=n.UINT8.get(i.value,5);this.addTag(t,e+"/"+r);break;case"gnre":const a=n.UINT8.get(i.value,1),s=l.Genres[a-1];this.addTag(t,s)}break;case 1:case 18:this.addTag(t,i.value.toString("utf-8"));break;case 13:if(this.options.skipCovers)break;this.addTag(t,{format:"image/jpeg",data:e.from(i.value)});break;case 14:if(this.options.skipCovers)break;this.addTag(t,{format:"image/png",data:e.from(i.value)});break;case 21:this.addTag(t,d.read_BE_Signed_Integer(i.value));break;case 22:this.addTag(t,d.read_BE_Unsigned_Integer(i.value));break;case 65:this.addTag(t,i.value.readInt8(0));break;case 66:this.addTag(t,i.value.readInt16BE(0));break;case 67:this.addTag(t,i.value.readInt32BE(0));break;default:this.addWarning(`atom key=${t}, has unknown well-known-type (data-type): ${i.type.type}`)}}async parseAtom_mvhd(e){await this.tokenizer.ignore(e.getPayloadLength())}async parseAtom_mdhd(e){const t=await this.tokenizer.readToken(new u.MdhdAtom(e.getPayloadLength())),r=this.getTrackDescription();r.creationTime=t.creationTime,r.modificationTime=t.modificationTime,r.timeScale=t.timeScale,r.duration=t.duration}async parseAtom_ftyp(e){const t=await this.tokenizer.readToken(u.ftyp);if((e-=u.ftyp.len)>0){const r=await this.parseAtom_ftyp(e),i=t.type.replace(/\W/g,"");return i.length>0&&r.push(i),r}return[]}async parseAtom_tkhd(e){const t=await this.tokenizer.readToken(new u.TrackHeaderAtom(e));this.tracks.push(t)}async parseAtom_stsd(e){const t=await this.tokenizer.readToken(new u.StsdAtom(e));this.getTrackDescription().soundSampleDescription=t.table.map(e=>this.parseSoundSampleDescription(e))}async parseAtom_stsc(e){const t=await this.tokenizer.readToken(new u.StscAtom(e));this.getTrackDescription().sampleToChunkTable=t.entries}async parseAtom_stts(e){const t=await this.tokenizer.readToken(new u.SttsAtom(e));this.getTrackDescription().timeToSampleTable=t.entries}parseSoundSampleDescription(e){const t={dataFormat:e.dataFormat,dataReferenceIndex:e.dataReferenceIndex};let r=0;const i=u.SoundSampleDescriptionVersion.get(e.description,r);return r+=u.SoundSampleDescriptionVersion.len,0===i.version||1===i.version?t.description=u.SoundSampleDescriptionV0.get(e.description,r):h(`Warning: sound-sample-description ${i} not implemented`),t}async parseAtom_chap(e){const t=[];let r=e.getPayloadLength();for(;r>=n.UINT32_BE.len;)t.push(await this.tokenizer.readNumber(n.UINT32_BE)),r-=n.UINT32_BE.len;return t}async parseAtom_stsz(e){const t=await this.tokenizer.readToken(new u.StszAtom(e)),r=this.getTrackDescription();r.sampleSize=t.sampleSize,r.sampleSizeTable=t.entries}async parseAtom_stco(e){const t=await this.tokenizer.readToken(new u.StcoAtom(e));this.getTrackDescription().chunkOffsetTable=t.entries}async parseAtom_mdat(e){if(this.options.includeChapters){const t=this.tracks.filter(e=>e.chapterList);if(1===t.length){const r=t[0].chapterList,i=this.tracks.filter(e=>-1!==r.indexOf(e.trackId));if(1===i.length)return this.parseChapterTrack(i[0],t[0],e)}}await this.tokenizer.ignore(e)}async parseChapterTrack(e,t,r){e.sampleSize||a.equal(e.chunkOffsetTable.length,e.sampleSizeTable.length,"chunk-offset-table & sample-size-table length");const i=[];for(let n=0;n0;++n){const s=e.chunkOffsetTable[n]-this.tokenizer.position,o=e.sampleSize>0?e.sampleSize:e.sampleSizeTable[n];r-=s+o,a.ok(r>=0,"Chapter chunk exceeding token length"),await this.tokenizer.ignore(s);const l=await this.tokenizer.readToken(new u.ChapterText(o));h(`Chapter ${n+1}: ${l}`);const c={title:l,sampleOffset:this.findSampleOffset(t,this.tokenizer.position)};h(`Chapter title=${c.title}, offset=${c.sampleOffset}/${this.tracks[0].duration}`),i.push(c)}this.metadata.setFormat("chapters",i),await this.tokenizer.ignore(r)}findSampleOffset(e,t){let r=0;e.timeToSampleTable.forEach(e=>{r+=e.count*e.duration}),h("Total duration="+r);let i=0;for(;i=t[r].firstChunk&&e0;){const i=await s.readAtom(e,t,this);this.children.push(i),r-=i.header.length}}async readData(e,t){switch(this.header.name){case"moov":case"udta":case"trak":case"mdia":case"minf":case"stbl":case"":case"ilst":case"tref":return this.readAtoms(e,t,this.getPayloadLength());case"meta":return await e.ignore(4),this.readAtoms(e,t,this.getPayloadLength()-4);case"mdhd":case"mvhd":case"tkhd":case"stsz":case"mdat":default:return t(this)}}}t.Atom=s},function(e,t,r){"use strict";(function(e){Object.defineProperty(t,"__esModule",{value:!0});const i=r(6),n=r(1),a=r(11),s=r(3),o=r(5),u=r(26),l=r(258),h=s("music-metadata:parser:mpeg"),c={AudioObjectTypes:["AAC Main","AAC LC","AAC SSR","AAC LTP"],SamplingFrequencies:[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350,void 0,void 0,-1]},f=[void 0,["front-center"],["front-left","front-right"],["front-center","front-left","front-right"],["front-center","front-left","front-right","back-center"],["front-center","front-left","front-right","back-left","back-right"],["front-center","front-left","front-right","back-left","back-right","LFE-channel"],["front-center","front-left","front-right","side-left","side-right","back-left","back-right","LFE-channel"]];class d{constructor(e,t){this.versionIndex=o.default.getBitAllignedNumber(e,t+1,3,2),this.layer=d.LayerDescription[o.default.getBitAllignedNumber(e,t+1,5,2)],this.versionIndex>1&&0===this.layer?this.parseAdtsHeader(e,t):this.parseMpegHeader(e,t),this.isProtectedByCRC=!o.default.isBitSet(e,t+1,7)}calcDuration(e){return e*this.calcSamplesPerFrame()/this.samplingRate}calcSamplesPerFrame(){return d.samplesInFrameTable[1===this.version?0:1][this.layer]}calculateSideInfoLength(){if(3!==this.layer)return 2;if(3===this.channelModeIndex){if(1===this.version)return 17;if(2===this.version||2.5===this.version)return 9}else{if(1===this.version)return 32;if(2===this.version||2.5===this.version)return 17}}calcSlotSize(){return[null,4,1,1][this.layer]}parseMpegHeader(e,t){this.container="MPEG",this.bitrateIndex=o.default.getBitAllignedNumber(e,t+2,0,4),this.sampRateFreqIndex=o.default.getBitAllignedNumber(e,t+2,4,2),this.padding=o.default.isBitSet(e,t+2,6),this.privateBit=o.default.isBitSet(e,t+2,7),this.channelModeIndex=o.default.getBitAllignedNumber(e,t+3,0,2),this.modeExtension=o.default.getBitAllignedNumber(e,t+3,2,2),this.isCopyrighted=o.default.isBitSet(e,t+3,4),this.isOriginalMedia=o.default.isBitSet(e,t+3,5),this.emphasis=o.default.getBitAllignedNumber(e,t+3,7,2),this.version=d.VersionID[this.versionIndex],this.channelMode=d.ChannelMode[this.channelModeIndex],this.codec=`MPEG ${this.version} Layer ${this.layer}`;const r=this.calcBitrate();if(!r)throw new Error("Cannot determine bit-rate");if(this.bitrate=1e3*r,this.samplingRate=this.calcSamplingRate(),null==this.samplingRate)throw new Error("Cannot determine sampling-rate")}parseAdtsHeader(e,t){h("layer=0 => ADTS"),this.version=2===this.versionIndex?4:2,this.container="ADTS/MPEG-"+this.version;const r=o.default.getBitAllignedNumber(e,t+2,0,2);this.codec="AAC",this.codecProfile=c.AudioObjectTypes[r],h("MPEG-4 audio-codec="+this.codec);const i=o.default.getBitAllignedNumber(e,t+2,2,4);this.samplingRate=c.SamplingFrequencies[i],h("sampling-rate="+this.samplingRate);const n=o.default.getBitAllignedNumber(e,t+2,7,3);this.mp4ChannelConfig=f[n],h("channel-config="+this.mp4ChannelConfig.join("+")),this.frameLength=o.default.getBitAllignedNumber(e,t+3,6,2)<<11}calcBitrate(){if(0===this.bitrateIndex||15===this.bitrateIndex)return;const e=`${Math.floor(this.version)}${this.layer}`;return d.bitrate_index[this.bitrateIndex][e]}calcSamplingRate(){return 3===this.sampRateFreqIndex?null:d.sampling_rate_freq_index[this.version][this.sampRateFreqIndex]}}d.SyncByte1=255,d.SyncByte2=224,d.VersionID=[2.5,null,2,1],d.LayerDescription=[0,3,2,1],d.ChannelMode=["stereo","joint_stereo","dual_channel","mono"],d.bitrate_index={1:{11:32,12:32,13:32,21:32,22:8,23:8},2:{11:64,12:48,13:40,21:48,22:16,23:16},3:{11:96,12:56,13:48,21:56,22:24,23:24},4:{11:128,12:64,13:56,21:64,22:32,23:32},5:{11:160,12:80,13:64,21:80,22:40,23:40},6:{11:192,12:96,13:80,21:96,22:48,23:48},7:{11:224,12:112,13:96,21:112,22:56,23:56},8:{11:256,12:128,13:112,21:128,22:64,23:64},9:{11:288,12:160,13:128,21:144,22:80,23:80},10:{11:320,12:192,13:160,21:160,22:96,23:96},11:{11:352,12:224,13:192,21:176,22:112,23:112},12:{11:384,12:256,13:224,21:192,22:128,23:128},13:{11:416,12:320,13:256,21:224,22:144,23:144},14:{11:448,12:384,13:320,21:256,22:160,23:160}},d.sampling_rate_freq_index={1:{0:44100,1:48e3,2:32e3},2:{0:22050,1:24e3,2:16e3},2.5:{0:11025,1:12e3,2:8e3}},d.samplesInFrameTable=[[0,384,1152,1152],[0,384,1152,576]];const p=4,m=(e,t)=>new d(e,t);class g extends u.AbstractID3Parser{constructor(){super(...arguments),this.frameCount=0,this.syncFrameCount=-1,this.countSkipFrameData=0,this.totalDataLength=0,this.bitrates=[],this.calculateEofDuration=!1,this.buf_frame_header=e.alloc(4),this.syncPeek={buf:e.alloc(1024),len:0}}async _parse(){this.metadata.setFormat("lossless",!1);try{let e=!1;for(;!e;)await this.sync(),e=await this.parseCommonMpegHeader()}catch(e){if(!(e instanceof a.EndOfStreamError))throw e;if(h("End-of-stream"),this.calculateEofDuration){const e=this.frameCount*this.samplesPerFrame;this.metadata.setFormat("numberOfSamples",e);const t=e/this.metadata.format.sampleRate;h(`Calculate duration at EOF: ${t} sec.`,t),this.metadata.setFormat("duration",t)}}}finalize(){const e=this.metadata.format,t=this.metadata.native.hasOwnProperty("ID3v1");if(e.duration&&this.tokenizer.fileSize){const r=this.tokenizer.fileSize-this.mpegOffset-(t?128:0);e.codecProfile&&"V"===e.codecProfile[0]&&this.metadata.setFormat("bitrate",8*r/e.duration)}else if(this.tokenizer.fileSize&&"CBR"===e.codecProfile){const r=this.tokenizer.fileSize-this.mpegOffset-(t?128:0),i=Math.round(r/this.frame_size)*this.samplesPerFrame;this.metadata.setFormat("numberOfSamples",i);const n=i/e.sampleRate;h("Calculate CBR duration based on file size: %s",n),this.metadata.setFormat("duration",n)}}async sync(){let e=!1;for(;;){let t=0;if(this.syncPeek.len=await this.tokenizer.peekBuffer(this.syncPeek.buf,0,1024,this.tokenizer.position,!0),this.syncPeek.len<=256)throw new a.EndOfStreamError;for(;;){if(e&&224==(224&this.syncPeek.buf[t]))return this.buf_frame_header[0]=d.SyncByte1,this.buf_frame_header[1]=this.syncPeek.buf[t],await this.tokenizer.ignore(t),h(`Sync at offset=${this.tokenizer.position-1}, frameCount=${this.frameCount}`),this.syncFrameCount===this.frameCount&&(h("Re-synced MPEG stream, frameCount="+this.frameCount),this.frameCount=0,this.frame_size=0),void(this.syncFrameCount=this.frameCount);if(e=!1,t=this.syncPeek.buf.indexOf(d.SyncByte1,t),-1===t){if(this.syncPeek.len=2&&0===e.layer?this.parseAdts(e):this.parseAudioFrameHeader(e)}async parseAudioFrameHeader(e){this.metadata.setFormat("numberOfChannels","mono"===e.channelMode?1:2),this.metadata.setFormat("bitrate",e.bitrate),this.frameCount<2e5&&h("offset=%s MP%s bitrate=%s sample-rate=%s",this.tokenizer.position-4,e.layer,e.bitrate,e.samplingRate);const t=e.calcSlotSize();if(null===t)throw new Error("invalid slot_size");const r=e.calcSamplesPerFrame();h("samples_per_frame="+r);const i=r/8*e.bitrate/e.samplingRate+(e.padding?t:0);if(this.frame_size=Math.floor(i),this.audioFrameHeader=e,this.bitrates.push(e.bitrate),1===this.frameCount)return this.offset=p,await this.skipSideInformation(),!1;if(3===this.frameCount){if(this.areAllSame(this.bitrates)){if(this.samplesPerFrame=r,this.metadata.setFormat("codecProfile","CBR"),this.tokenizer.fileSize)return!0}else if(this.metadata.format.duration)return!0;if(!this.options.duration)return!0}return this.options.duration&&4===this.frameCount&&(this.samplesPerFrame=r,this.calculateEofDuration=!0),this.offset=4,e.isProtectedByCRC?(await this.parseCrc(),!1):(await this.skipSideInformation(),!1)}async parseAdts(t){const r=e.alloc(3);await this.tokenizer.readBuffer(r),t.frameLength+=o.default.getBitAllignedNumber(r,0,0,11),this.tokenizer.ignore(t.frameLength-7),this.totalDataLength+=t.frameLength,this.samplesPerFrame=1024;const i=t.samplingRate/this.samplesPerFrame,n=8*(0===this.frameCount?0:this.totalDataLength/this.frameCount)*i+.5;if(this.metadata.setFormat("codecProfile",t.codecProfile),this.metadata.setFormat("bitrate",n),t.mp4ChannelConfig&&this.metadata.setFormat("numberOfChannels",t.mp4ChannelConfig.length),h(`frame-count=${this.frameCount}, size=${t.frameLength} bytes, bit-rate=${n}`),3===this.frameCount){if(!this.options.duration)return!0;this.calculateEofDuration=!0}return!1}async parseCrc(){return this.crc=await this.tokenizer.readNumber(n.INT16_BE),this.offset+=2,this.skipSideInformation()}async skipSideInformation(){const e=this.audioFrameHeader.calculateSideInfoLength();await this.tokenizer.readToken(new n.BufferType(e)),this.offset+=e,await this.readXtraInfoHeader()}async readXtraInfoHeader(){const e=await this.tokenizer.readToken(l.InfoTagHeaderTag);switch(this.offset+=l.InfoTagHeaderTag.len,e){case"Info":return this.metadata.setFormat("codecProfile","CBR"),this.readXingInfoHeader();case"Xing":const e=await this.readXingInfoHeader(),t="V"+(100-e.vbrScale)/10;return this.metadata.setFormat("codecProfile",t),null;case"Xtra":break;case"LAME":const r=await this.tokenizer.readToken(l.LameEncoderVersion);return this.offset+=l.LameEncoderVersion.len,this.metadata.setFormat("tool","LAME "+r),await this.skipFrameData(this.frame_size-this.offset),null}const t=this.frame_size-this.offset;return t<0?this.metadata.addWarning("Frame "+this.frameCount+"corrupt: negative frameDataLeft"):await this.skipFrameData(t),null}async readXingInfoHeader(){const e=await this.tokenizer.readToken(l.XingInfoTag);if(this.offset+=l.XingInfoTag.len,this.metadata.setFormat("tool",o.default.stripNulls(e.codec)),1==(1&e.headerFlags[3])){const t=this.audioFrameHeader.calcDuration(e.numFrames);return this.metadata.setFormat("duration",t),h("Get duration from Xing header: %s",this.metadata.format.duration),e}const t=this.frame_size-this.offset;return await this.skipFrameData(t),e}async skipFrameData(e){i.ok(e>=0,"frame-data-left cannot be negative"),await this.tokenizer.ignore(e),this.countSkipFrameData+=e}areAllSame(e){const t=e[0];return e.every(e=>e===t)}}t.MpegParser=g}).call(this,r(2).Buffer)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=r(1);t.InfoTagHeaderTag=new i.StringType(4,"ascii"),t.LameEncoderVersion=new i.StringType(6,"ascii"),t.XingInfoTag={len:136,get:(e,t)=>({headerFlags:new i.BufferType(4).get(e,t),numFrames:i.UINT32_BE.get(e,t+4),streamSize:i.UINT32_BE.get(e,t+8),vbrScale:i.UINT32_BE.get(e,t+112),codec:new i.StringType(9,"ascii").get(e,t+116),infoTagRevision:i.UINT8.get(e,t+125)>>4,vbrMethod:15&i.UINT8.get(e,t+125)})}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=r(3),n=r(1),a=r(260),s=r(262),o=r(26),u=i("music-metadata:parser:musepack");class l extends o.AbstractID3Parser{async _parse(){let e;switch(await this.tokenizer.peekToken(new n.StringType(3,"binary"))){case"MP+":u("Musepack stream-version 7"),e=new s.MpcSv7Parser;break;case"MPC":u("Musepack stream-version 8"),e=new a.MpcSv8Parser;break;default:throw new Error("Invalid Musepack signature prefix")}return e.init(this.metadata,this.tokenizer,this.options),e.parse()}}t.default=l},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=r(3),n=r(6),a=r(8),s=r(261),o=r(17),u=r(7),l=i("music-metadata:parser:musepack");class h extends a.BasicParser{constructor(){super(...arguments),this.audioLength=0}async parse(){const e=await this.tokenizer.readToken(u.FourCcToken);return n.equal(e,"MPCK","Magic number"),this.metadata.setFormat("container","Musepack, SV8"),this.parsePacket()}async parsePacket(){const e=new s.StreamReader(this.tokenizer);for(;;){const t=await e.readPacketHeader();switch(l(`packet-header key=${t.key}, payloadLength=${t.payloadLength}`),t.key){case"SH":const r=await e.readStreamHeader(t.payloadLength);this.metadata.setFormat("numberOfSamples",r.sampleCount),this.metadata.setFormat("sampleRate",r.sampleFrequency),this.metadata.setFormat("duration",r.sampleCount/r.sampleFrequency),this.metadata.setFormat("numberOfChannels",r.channelCount);break;case"AP":this.audioLength+=t.payloadLength,await this.tokenizer.ignore(t.payloadLength);break;case"RG":case"EI":case"SO":case"ST":case"CT":await this.tokenizer.ignore(t.payloadLength);break;case"SE":return this.metadata.setFormat("bitrate",8*this.audioLength/this.metadata.format.duration),o.APEv2Parser.tryParseApeHeader(this.metadata,this.tokenizer,this.options);default:throw new Error("Unexpected header: "+t.key)}}}}t.MpcSv8Parser=h},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=r(1),n=r(5),a=r(3)("music-metadata:parser:musepack:sv8"),s=new i.StringType(2,"binary"),o={len:5,get:(e,t)=>({crc:i.UINT32_LE.get(e,t),streamVersion:i.UINT8.get(e,t+4)})},u={len:2,get:(e,t)=>({sampleFrequency:[44100,48e3,37800,32e3][n.default.getBitAllignedNumber(e,t,0,3)],maxUsedBands:n.default.getBitAllignedNumber(e,t,3,5),channelCount:n.default.getBitAllignedNumber(e,t+1,0,4)+1,msUsed:n.default.isBitSet(e,t+1,4),audioBlockFrames:n.default.getBitAllignedNumber(e,t+1,5,3)})};t.StreamReader=class{constructor(e){this.tokenizer=e}async readPacketHeader(){const e=await this.tokenizer.readToken(s),t=await this.readVariableSizeField();return{key:e,payloadLength:t.value-2-t.len}}async readStreamHeader(e){const t={};a("Reading SH at offset="+this.tokenizer.position);const r=await this.tokenizer.readToken(o);e-=o.len,Object.assign(t,r),a("SH.streamVersion = "+r.streamVersion);const i=await this.readVariableSizeField();e-=i.len,t.sampleCount=i.value;const n=await this.readVariableSizeField();e-=n.len,t.beginningOfSilence=n.value;const s=await this.tokenizer.readToken(u);return e-=u.len,Object.assign(t,s),await this.tokenizer.ignore(e),t}async readVariableSizeField(e=1,t=0){let r=await this.tokenizer.readNumber(i.UINT8);return 0==(128&r)?{len:e,value:t+r}:(r&=127,r+=t,this.readVariableSizeField(e+1,r<<7))}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=r(3),n=r(6),a=r(8),s=r(263),o=r(17),u=r(264),l=i("music-metadata:parser:musepack");class h extends a.BasicParser{constructor(){super(...arguments),this.audioLength=0}async parse(){const e=await this.tokenizer.readToken(s.Header);n.equal(e.signature,"MP+","Magic number"),l(`stream-version=${e.streamMajorVersion}.${e.streamMinorVersion}`),this.metadata.setFormat("container","Musepack, SV7"),this.metadata.setFormat("sampleRate",e.sampleFrequency);const t=1152*(e.frameCount-1)+e.lastFrameLength;this.metadata.setFormat("numberOfSamples",t),this.duration=t/e.sampleFrequency,this.metadata.setFormat("duration",this.duration),this.bitreader=new u.BitReader(this.tokenizer),this.metadata.setFormat("numberOfChannels",e.midSideStereo||e.intensityStereo?2:1);const r=await this.bitreader.read(8);return this.metadata.setFormat("codec",(r/100).toFixed(2)),await this.skipAudioData(e.frameCount),l("End of audio stream, switching to APEv2, offset="+this.tokenizer.position),o.APEv2Parser.tryParseApeHeader(this.metadata,this.tokenizer,this.options)}async skipAudioData(e){for(;e-- >0;){const e=await this.bitreader.read(20);this.audioLength+=20+e,await this.bitreader.ignore(e)}const t=await this.bitreader.read(11);this.audioLength+=t,this.metadata.setFormat("bitrate",this.audioLength/this.duration)}}t.MpcSv7Parser=h},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=r(1),n=r(5);t.Header={len:24,get:(e,t)=>{const r={signature:e.toString("binary",t,t+3),streamMinorVersion:n.default.getBitAllignedNumber(e,t+3,0,4),streamMajorVersion:n.default.getBitAllignedNumber(e,t+3,4,4),frameCount:i.UINT32_LE.get(e,t+4),maxLevel:i.UINT16_LE.get(e,t+8),sampleFrequency:[44100,48e3,37800,32e3][n.default.getBitAllignedNumber(e,t+10,0,2)],link:n.default.getBitAllignedNumber(e,t+10,2,2),profile:n.default.getBitAllignedNumber(e,t+10,4,4),maxBand:n.default.getBitAllignedNumber(e,t+11,0,6),intensityStereo:n.default.isBitSet(e,t+11,6),midSideStereo:n.default.isBitSet(e,t+11,7),titlePeak:i.UINT16_LE.get(e,t+12),titleGain:i.UINT16_LE.get(e,t+14),albumPeak:i.UINT16_LE.get(e,t+16),albumGain:i.UINT16_LE.get(e,t+18),lastFrameLength:i.UINT32_LE.get(e,t+20)>>>20&2047,trueGapless:n.default.isBitSet(e,t+23,0)};return r.lastFrameLength=r.trueGapless?i.UINT32_LE.get(e,20)>>>20&2047:0,r}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=r(1);t.BitReader=class{constructor(e){this.tokenizer=e,this.pos=0,this.dword=void 0}async read(e){for(;void 0===this.dword;)this.dword=await this.tokenizer.readToken(i.UINT32_LE);let t=this.dword;return this.pos+=e,this.pos<32?(t>>>=32-this.pos,t&(1<>>32-this.pos),t&(1<0){const t=32-this.pos;this.dword=void 0,e-=t,this.pos=0}const t=e%32,r=(e-t)/32;return await this.tokenizer.ignore(4*r),this.read(t)}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=r(1),n=r(3),a=r(6),s=r(5),o=r(7),u=r(27),l=r(266),h=r(268),c=r(8),f=r(270),d=r(11),p=n("music-metadata:parser:ogg");class m{constructor(e){this.len=e.page_segments}static sum(e,t,r){let i=0;for(let n=t;n0)return this.metadata.addWarning("Invalid FourCC ID, maybe last OGG-page is not marked with last-page flag"),this.pageConsumer.flush();throw e}}}t.OggParser=g,g.Header={len:27,get:(e,t)=>({capturePattern:o.FourCcToken.get(e,t),version:e.readUInt8(t+4),headerType:{continued:s.default.strtokBITSET.get(e,t+5,0),firstPage:s.default.strtokBITSET.get(e,t+5,1),lastPage:s.default.strtokBITSET.get(e,t+5,2)},absoluteGranulePosition:e.readIntLE(t+6,6),streamSerialNumber:i.UINT32_LE.get(e,t+14),pageSequenceNo:i.UINT32_LE.get(e,t+18),pageChecksum:i.UINT32_LE.get(e,t+22),page_segments:e.readUInt8(t+26)})}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=r(1),n=r(267),a=r(27);class s extends a.VorbisParser{constructor(e,t,r){super(e,t),this.tokenizer=r,this.lastPos=-1}parseFirstPage(e,t){if(this.metadata.setFormat("codec","Opus"),this.idHeader=new n.IdHeader(t.length).get(t,0),"OpusHead"!==this.idHeader.magicSignature)throw new Error("Illegal ogg/Opus magic-signature");this.metadata.setFormat("sampleRate",this.idHeader.inputSampleRate),this.metadata.setFormat("numberOfChannels",this.idHeader.channelCount)}parseFullPage(e){switch(new i.StringType(8,"ascii").get(e,0)){case"OpusTags":this.parseUserCommentList(e,8),this.lastPos=this.tokenizer.position}}calculateDuration(e){if(this.metadata.format.sampleRate&&e.absoluteGranulePosition>=0&&(this.metadata.setFormat("numberOfSamples",e.absoluteGranulePosition-this.idHeader.preSkip),this.metadata.setFormat("duration",this.metadata.format.numberOfSamples/this.idHeader.inputSampleRate),-1!==this.lastPos&&this.tokenizer.fileSize&&this.metadata.format.duration)){const e=this.tokenizer.fileSize-this.lastPos;this.metadata.setFormat("bitrate",8*e/this.metadata.format.duration)}}}t.OpusParser=s},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=r(1);t.IdHeader=class{constructor(e){if(this.len=e,e<19)throw new Error("ID-header-page 0 should be at least 19 bytes long")}get(e,t){return{magicSignature:new i.StringType(8,"ascii").get(e,t+0),version:e.readUInt8(t+8),channelCount:e.readUInt8(t+9),preSkip:e.readInt16LE(t+10),inputSampleRate:e.readInt32LE(t+12),outputGain:e.readInt16LE(t+16),channelMapping:e.readUInt8(t+18)}}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=r(3),n=r(269),a=r(27),s=i("music-metadata:parser:ogg:speex");class o extends a.VorbisParser{constructor(e,t,r){super(e,t),this.tokenizer=r}parseFirstPage(e,t){s("First Ogg/Speex page");const r=n.Header.get(t,0);this.metadata.setFormat("codec","Speex "+r.version),this.metadata.setFormat("numberOfChannels",r.nb_channels),this.metadata.setFormat("sampleRate",r.rate),-1!==r.bitrate&&this.metadata.setFormat("bitrate",r.bitrate)}}t.SpeexParser=o},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=r(1),n=r(5);t.Header={len:80,get:(e,t)=>({speex:new i.StringType(8,"ascii").get(e,t+0),version:n.default.trimRightNull(new i.StringType(20,"ascii").get(e,t+8)),version_id:e.readInt32LE(t+28),header_size:e.readInt32LE(t+32),rate:e.readInt32LE(t+36),mode:e.readInt32LE(t+40),mode_bitstream_version:e.readInt32LE(t+44),nb_channels:e.readInt32LE(t+48),bitrate:e.readInt32LE(t+52),frame_size:e.readInt32LE(t+56),vbr:e.readInt32LE(t+60),frames_per_packet:e.readInt32LE(t+64),extra_headers:e.readInt32LE(t+68),reserved1:e.readInt32LE(t+72),reserved2:e.readInt32LE(t+76)})}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=r(3),n=r(271),a=i("music-metadata:parser:ogg:theora");t.TheoraParser=class{constructor(e,t,r){this.metadata=e,this.tokenizer=r}parsePage(e,t){e.headerType.firstPage&&this.parseFirstPage(e,t)}flush(){a("flush")}parseFirstPage(e,t){a("First Ogg/Theora page"),this.metadata.setFormat("codec","Theora");const r=n.IdentificationHeader.get(t,0);this.metadata.setFormat("bitrate",r.nombr)}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=r(1);t.IdentificationHeader={len:42,get:(e,t)=>({id:new i.StringType(7,"ascii").get(e,t),vmaj:e.readUInt8(t+7),vmin:e.readUInt8(t+8),vrev:e.readUInt8(t+9),vmbw:e.readUInt16BE(t+10),vmbh:e.readUInt16BE(t+17),nombr:i.UINT24_BE.get(e,t+37),nqual:e.readUInt8(t+40)})}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=r(11),n=r(1),a=r(3),s=r(273),o=r(274),u=r(19),l=r(5),h=r(7),c=r(8),f=r(30),d=a("music-metadata:parser:RIFF");class p extends c.BasicParser{async parse(){const e=await this.tokenizer.readToken(s.Header);if(d(`pos=${this.tokenizer.position}, parse: chunkID=${e.chunkID}`),"RIFF"===e.chunkID)return this.parseRiffChunk(e.chunkSize).catch(e=>{if(!(e instanceof i.EndOfStreamError))throw e})}async parseRiffChunk(e){const t=await this.tokenizer.readToken(h.FourCcToken);switch(this.metadata.setFormat("container",t),t){case"WAVE":return this.readWaveChunk(e-h.FourCcToken.len);default:throw new Error("Unsupported RIFF format: RIFF/"+t)}}async readWaveChunk(e){do{const t=await this.tokenizer.readToken(s.Header);switch(e-=s.Header.len+t.chunkSize,this.header=t,d(`pos=${this.tokenizer.position}, readChunk: chunkID=RIFF/WAVE/${t.chunkID}`),t.chunkID){case"LIST":await this.parseListTag(t);break;case"fact":this.metadata.setFormat("lossless",!1),this.fact=await this.tokenizer.readToken(new o.FactChunk(t));break;case"fmt ":const e=await this.tokenizer.readToken(new o.Format(t));let r=o.WaveFormat[e.wFormatTag];r||(d("WAVE/non-PCM format="+e.wFormatTag),r="non-PCM ("+e.wFormatTag+")"),this.metadata.setFormat("codec",r),this.metadata.setFormat("bitsPerSample",e.wBitsPerSample),this.metadata.setFormat("sampleRate",e.nSamplesPerSec),this.metadata.setFormat("numberOfChannels",e.nChannels),this.metadata.setFormat("bitrate",e.nBlockAlign*e.nSamplesPerSec*8),this.blockAlign=e.nBlockAlign;break;case"id3 ":case"ID3 ":const a=await this.tokenizer.readToken(new n.BufferType(t.chunkSize)),s=new f.ID3Stream(a),l=i.fromStream(s);await(new u.ID3v2Parser).parse(this.metadata,l,this.options);break;case"data":!1!==this.metadata.format.lossless&&this.metadata.setFormat("lossless",!0);const h=this.fact?this.fact.dwSampleLength:t.chunkSize/this.blockAlign;this.metadata.setFormat("numberOfSamples",h),this.metadata.setFormat("duration",h/this.metadata.format.sampleRate),this.metadata.setFormat("bitrate",this.metadata.format.numberOfChannels*this.blockAlign*this.metadata.format.sampleRate),await this.tokenizer.ignore(t.chunkSize);break;default:d(`Ignore chunk: RIFF/${t.chunkID} of ${t.chunkSize} bytes`),this.metadata.addWarning("Ignore chunk: RIFF/"+t.chunkID),await this.tokenizer.ignore(t.chunkSize)}this.header.chunkSize%2==1&&(d("Read odd padding byte"),await this.tokenizer.ignore(1))}while(e>0)}async parseListTag(e){const t=await this.tokenizer.readToken(h.FourCcToken);switch(d("pos=%s, parseListTag: chunkID=RIFF/WAVE/LIST/%s",this.tokenizer.position,t),t){case"INFO":return this.parseRiffInfoTags(e.chunkSize-4);case"adtl":default:return this.metadata.addWarning("Ignore chunk: RIFF/WAVE/LIST/"+t),d("Ignoring chunkID=RIFF/WAVE/LIST/"+t),this.tokenizer.ignore(e.chunkSize-4)}}async parseRiffInfoTags(e){for(;e>=8;){const t=await this.tokenizer.readToken(s.Header),r=new s.ListInfoTagValue(t),i=await this.tokenizer.readToken(r);this.addTag(t.chunkID,l.default.stripNulls(i)),e-=8+r.len}if(0!==e)throw Error("Illegal remaining size: "+e)}addTag(e,t){this.metadata.addTag("exif",e,t)}}t.WaveParser=p},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=r(1),n=r(7);t.Header={len:8,get:(e,t)=>({chunkID:n.FourCcToken.get(e,t),chunkSize:e.readUInt32LE(t+4)})};t.ListInfoTagValue=class{constructor(e){this.tagHeader=e,this.len=e.chunkSize,this.len+=1&this.len}get(e,t){return new i.StringType(this.tagHeader.chunkSize,"ascii").get(e,t)}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=r(6);!function(e){e[e.PCM=1]="PCM",e[e.ADPCM=2]="ADPCM",e[e.IEEE_FLOAT=3]="IEEE_FLOAT",e[e.MPEG_ADTS_AAC=5632]="MPEG_ADTS_AAC",e[e.MPEG_LOAS=5634]="MPEG_LOAS",e[e.RAW_AAC1=255]="RAW_AAC1",e[e.DOLBY_AC3_SPDIF=146]="DOLBY_AC3_SPDIF",e[e.DVM=8192]="DVM",e[e.RAW_SPORT=576]="RAW_SPORT",e[e.ESST_AC3=577]="ESST_AC3",e[e.DRM=9]="DRM",e[e.DTS2=8193]="DTS2",e[e.MPEG=80]="MPEG"}(t.WaveFormat||(t.WaveFormat={}));t.Format=class{constructor(e){i.ok(e.chunkSize>=16,"16 for PCM."),this.len=e.chunkSize}get(e,t){return{wFormatTag:e.readUInt16LE(t),nChannels:e.readUInt16LE(t+2),nSamplesPerSec:e.readUInt32LE(t+4),nAvgBytesPerSec:e.readUInt32LE(t+8),nBlockAlign:e.readUInt16LE(t+12),wBitsPerSample:e.readUInt16LE(t+14)}}};t.FactChunk=class{constructor(e){i.ok(e.chunkSize>=4,"minimum fact chunk size."),this.len=e.chunkSize}get(e,t){return{dwSampleLength:e.readUInt32LE(t)}}}},function(e,t,r){"use strict";(function(e){Object.defineProperty(t,"__esModule",{value:!0});const i=r(1),n=r(6),a=r(17),s=r(7),o=r(8),u=r(276),l=r(3)("music-metadata:parser:WavPack");class h extends o.BasicParser{async parse(){return this.audioDataSize=0,await this.parseWavPackBlocks(),a.APEv2Parser.tryParseApeHeader(this.metadata,this.tokenizer,this.options)}async parseWavPackBlocks(){do{if("wvpk"!==await this.tokenizer.peekToken(s.FourCcToken))break;const e=await this.tokenizer.readToken(u.WavPack.BlockHeaderToken);n.strictEqual(e.BlockID,"wvpk","WavPack Block-ID"),l(`WavPack header blockIndex=${e.blockIndex}, len=${u.WavPack.BlockHeaderToken.len}`),0!==e.blockIndex||this.metadata.format.container||(this.metadata.setFormat("container","WavPack"),this.metadata.setFormat("lossless",!e.flags.isHybrid),this.metadata.setFormat("bitsPerSample",e.flags.bitsPerSample),e.flags.isDSD||(this.metadata.setFormat("sampleRate",e.flags.samplingRate),this.metadata.setFormat("duration",e.totalSamples/e.flags.samplingRate)),this.metadata.setFormat("numberOfChannels",e.flags.isMono?1:2),this.metadata.setFormat("numberOfSamples",e.totalSamples),this.metadata.setFormat("codec",e.flags.isDSD?"DSD":"PCM"));const t=e.blockSize-(u.WavPack.BlockHeaderToken.len-8);0===e.blockIndex?await this.parseMetadataSubBlock(e,t):await this.tokenizer.ignore(t),e.blockSamples>0&&(this.audioDataSize+=e.blockSize)}while(!this.tokenizer.fileSize||this.tokenizer.fileSize-this.tokenizer.position>=u.WavPack.BlockHeaderToken.len);this.metadata.setFormat("bitrate",8*this.audioDataSize/this.metadata.format.duration)}async parseMetadataSubBlock(t,r){for(;r>u.WavPack.MetadataIdToken.len;){const a=await this.tokenizer.readToken(u.WavPack.MetadataIdToken),s=await this.tokenizer.readNumber(a.largeBlock?i.UINT24_LE:i.UINT8),o=e.alloc(2*s-(a.isOddSize?1:0));switch(await this.tokenizer.readBuffer(o,0,o.length),l(`Metadata Sub-Blocks functionId=0x${a.functionId.toString(16)}, id.largeBlock=${a.largeBlock},data-size=${o.length}`),a.functionId){case 0:break;case 14:l("ID_DSD_BLOCK");const e=1<>>t&4294967295>>>32-r}}t.WavPack=s,s.BlockHeaderToken={len:32,get:(e,t)=>{const r=i.UINT32_LE.get(e,t+24),o={BlockID:n.FourCcToken.get(e,t),blockSize:i.UINT32_LE.get(e,t+4),version:i.UINT16_LE.get(e,t+8),totalSamples:i.UINT32_LE.get(e,t+12),blockIndex:i.UINT32_LE.get(e,t+16),blockSamples:i.UINT32_LE.get(e,t+20),flags:{bitsPerSample:8*(1+s.getBitAllignedNumber(r,0,2)),isMono:s.isBitSet(r,2),isHybrid:s.isBitSet(r,3),isJointStereo:s.isBitSet(r,4),crossChannel:s.isBitSet(r,5),hybridNoiseShaping:s.isBitSet(r,6),floatingPoint:s.isBitSet(r,7),samplingRate:a[s.getBitAllignedNumber(r,23,4)],isDSD:s.isBitSet(r,31)},crc:new i.BufferType(4).get(e,t+28)};return o.flags.isDSD&&(o.totalSamples*=8),o}},s.MetadataIdToken={len:1,get:(e,t)=>({functionId:s.getBitAllignedNumber(e[t],0,6),isOptional:s.isBitSet(e[t],5),isOddSize:s.isBitSet(e[t],6),largeBlock:s.isBitSet(e[t],7)})}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=r(26),n=r(6),a=r(3),s=r(278),o=r(19),u=a("music-metadata:parser:DSF");class l extends i.AbstractID3Parser{async _parse(){const e=this.tokenizer.position,t=await this.tokenizer.readToken(s.ChunkHeader);n.strictEqual(t.id,"DSD ","Invalid chunk signature"),this.metadata.setFormat("container","DSF"),this.metadata.setFormat("lossless",!0);const r=await this.tokenizer.readToken(s.DsdChunk);if(0!==r.metadataPointer)return u("expect ID3v2 at offset="+r.metadataPointer),await this.parseChunks(r.fileSize-t.size),await this.tokenizer.ignore(r.metadataPointer-this.tokenizer.position-e),(new o.ID3v2Parser).parse(this.metadata,this.tokenizer,this.options);u("No ID3v2 tag present")}async parseChunks(e){for(;e>=s.ChunkHeader.len;){const t=await this.tokenizer.readToken(s.ChunkHeader);switch(u(`Parsing chunk name=${t.id} size=${t.size}`),t.id){case"fmt ":const e=await this.tokenizer.readToken(s.FormatChunk);this.metadata.setFormat("numberOfChannels",e.channelNum),this.metadata.setFormat("sampleRate",e.samplingFrequency),this.metadata.setFormat("bitsPerSample",e.bitsPerSample),this.metadata.setFormat("numberOfSamples",e.sampleCount),this.metadata.setFormat("duration",e.sampleCount/e.samplingFrequency);const r=e.bitsPerSample*e.samplingFrequency*e.channelNum;return void this.metadata.setFormat("bitrate",r);default:this.tokenizer.ignore(t.size-s.ChunkHeader.len)}e-=t.size}}}t.DsfParser=l},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=r(1),n=r(7);t.ChunkHeader={len:12,get:(e,t)=>({id:n.FourCcToken.get(e,t),size:i.UINT64_LE.get(e,t+4)})},t.DsdChunk={len:16,get:(e,t)=>({fileSize:i.INT64_LE.get(e,t),metadataPointer:i.INT64_LE.get(e,t+8)})},function(e){e[e.mono=1]="mono",e[e.stereo=2]="stereo",e[e.channels=3]="channels",e[e.quad=4]="quad",e[e["4 channels"]=5]="4 channels",e[e["5 channels"]=6]="5 channels",e[e["5.1 channels"]=7]="5.1 channels"}(t.ChannelType||(t.ChannelType={})),t.FormatChunk={len:40,get:(e,t)=>({formatVersion:i.INT32_LE.get(e,t),formatID:i.INT32_LE.get(e,t+4),channelType:i.INT32_LE.get(e,t+8),channelNum:i.INT32_LE.get(e,t+12),samplingFrequency:i.INT32_LE.get(e,t+16),bitsPerSample:i.INT32_LE.get(e,t+20),sampleCount:i.INT64_LE.get(e,t+24),blockSizePerChannel:i.INT32_LE.get(e,t+32)})}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=r(6),n=r(1),a=r(3),s=r(7),o=r(8),u=r(30),l=r(280),h=r(11),c=r(19),f=a("music-metadata:parser:aiff");class d extends o.BasicParser{async parse(){const e=await this.tokenizer.readToken(l.ChunkHeader);i.strictEqual(e.chunkID,"FRM8");const t=(await this.tokenizer.readToken(s.FourCcToken)).trim();switch(t){case"DSD":return this.metadata.setFormat("container","DSDIFF/"+t),this.metadata.setFormat("lossless",!0),this.readFmt8Chunks(e.chunkSize-s.FourCcToken.len);default:throw Error("Unsupported DSDIFF type: "+t)}}async readFmt8Chunks(e){for(;e>=l.ChunkHeader.len;){const t=await this.tokenizer.readToken(l.ChunkHeader);f("Chunk id="+t.chunkID),await this.readData(t),e-=l.ChunkHeader.len+t.chunkSize}}async readData(e){f(`Reading data of chunk[ID=${e.chunkID}, size=${e.chunkSize}]`);const t=this.tokenizer.position;switch(e.chunkID.trim()){case"FVER":const t=await this.tokenizer.readToken(n.UINT32_LE);f("DSDIFF version="+t);break;case"PROP":const r=await this.tokenizer.readToken(s.FourCcToken);i.strictEqual(r,"SND "),await this.handleSoundPropertyChunks(e.chunkSize-s.FourCcToken.len);break;case"ID3":const a=await this.tokenizer.readToken(new n.BufferType(e.chunkSize)),o=new u.ID3Stream(a),l=h.fromStream(o);await(new c.ID3v2Parser).parse(this.metadata,l,this.options);break;default:f(`Ignore chunk[ID=${e.chunkID}, size=${e.chunkSize}]`);break;case"DSD":this.metadata.setFormat("numberOfSamples",8*e.chunkSize/this.metadata.format.numberOfChannels),this.metadata.setFormat("duration",this.metadata.format.numberOfSamples/this.metadata.format.sampleRate)}const r=e.chunkSize-(this.tokenizer.position-t);r>0&&(f(`After Parsing chunk, remaining ${r} bytes`),await this.tokenizer.ignore(r))}async handleSoundPropertyChunks(e){for(f("Parsing sound-property-chunks, remainingSize="+e);e>0;){const t=await this.tokenizer.readToken(l.ChunkHeader);f(`Sound-property-chunk[ID=${t.chunkID}, size=${t.chunkSize}]`);const r=this.tokenizer.position;switch(t.chunkID.trim()){case"FS":const e=await this.tokenizer.readToken(n.UINT32_BE);this.metadata.setFormat("sampleRate",e);break;case"CHNL":const r=await this.tokenizer.readToken(n.UINT16_BE);this.metadata.setFormat("numberOfChannels",r),await this.handleChannelChunks(t.chunkSize-n.UINT16_BE.len);break;case"CMPR":const i=(await this.tokenizer.readToken(s.FourCcToken)).trim(),a=await this.tokenizer.readToken(n.UINT8),o=await this.tokenizer.readToken(new n.StringType(a,"ascii"));"DSD"===i&&(this.metadata.setFormat("lossless",!0),this.metadata.setFormat("bitsPerSample",1)),this.metadata.setFormat("codec",`${i} (${o})`);break;case"ABSS":const u=await this.tokenizer.readToken(n.UINT16_BE),l=await this.tokenizer.readToken(n.UINT8),h=await this.tokenizer.readToken(n.UINT8),c=await this.tokenizer.readToken(n.UINT32_BE);f(`ABSS ${u}:${l}:${h}.${c}`);break;case"LSCO":const d=await this.tokenizer.readToken(n.UINT16_BE);f("LSCO lsConfig="+d);break;case"COMT":default:f(`Unknown sound-property-chunk[ID=${t.chunkID}, size=${t.chunkSize}]`),await this.tokenizer.ignore(t.chunkSize)}const i=t.chunkSize-(this.tokenizer.position-r);i>0&&(f(`After Parsing sound-property-chunk ${t.chunkSize}, remaining ${i} bytes`),await this.tokenizer.ignore(i)),e-=l.ChunkHeader.len+t.chunkSize,f("Parsing sound-property-chunks, remainingSize="+e)}if(this.metadata.format.lossless&&this.metadata.format.sampleRate&&this.metadata.format.numberOfChannels&&this.metadata.format.bitsPerSample){const e=this.metadata.format.sampleRate*this.metadata.format.numberOfChannels*this.metadata.format.bitsPerSample;this.metadata.setFormat("bitrate",e)}}async handleChannelChunks(e){f("Parsing channel-chunks, remainingSize="+e);const t=[];for(;e>=s.FourCcToken.len;){const r=await this.tokenizer.readToken(s.FourCcToken);f(`Channel[ID=${r}]`),t.push(r),e-=s.FourCcToken.len}return f("Channels: "+t.join(", ")),t}}t.DsdiffParser=d},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=r(1),n=r(7);t.ChunkHeader={len:12,get:(e,t)=>({chunkID:n.FourCcToken.get(e,t),chunkSize:i.INT64_BE.get(e,t+4)})}},function(e,t,r){"use strict";(function(e){Object.defineProperty(t,"__esModule",{value:!0});const i=r(1),n=r(3),a=r(8),s=r(53),o=r(282),u=n("music-metadata:parser:matroska");class l extends a.BasicParser{constructor(){super(),this.padding=0,this.parserMap=new Map,this.parserMap.set(s.DataType.uint,e=>this.readUint(e)),this.parserMap.set(s.DataType.string,e=>this.readString(e)),this.parserMap.set(s.DataType.binary,e=>this.readBuffer(e)),this.parserMap.set(s.DataType.uid,async e=>1===await this.readUint(e)),this.parserMap.set(s.DataType.bool,e=>this.readFlag(e)),this.parserMap.set(s.DataType.float,e=>this.readFloat(e))}init(e,t,r){return super.init(e,t,r),this}async parse(){const e=await this.parseContainer(o.elements,this.tokenizer.fileSize,[]);if(this.metadata.setFormat("container","EBML/"+e.ebml.docType),e.segment){const t=e.segment.info;if(t){const e=t.timecodeScale?t.timecodeScale:1e6,r=t.duration*e/1e9;this.metadata.setFormat("duration",r)}const r=e.segment.tracks;if(r&&r.entries){const t=r.entries.filter(e=>e.trackType===s.TrackType.audio.valueOf()).reduce((e,t)=>e?!e.flagDefault&&t.flagDefault||t.trackNumber&&t.trackNumber{const t=e.target,r=t.targetTypeValue?s.TargetType[t.targetTypeValue]:t.targetType?t.targetType:s.TargetType.album;e.simpleTags.forEach(e=>{const t=e.string?e.string:e.binary;this.addTag(`${r}:${e.name}`,t)})})}}}async parseContainer(e,t,r){const i={};for(;this.tokenizer.position>=1;const a=e.alloc(n);return await this.tokenizer.readBuffer(a),a}async readElement(){const e=await this.readVintData(),t=await this.readVintData();t[0]^=128>>t.length-1;const r=Math.min(6,t.length);return{id:e.readUIntBE(0,e.length),len:t.readUIntBE(t.length-r,r)}}async readFloat(e){switch(e.len){case 0:return 0;case 4:return this.tokenizer.readNumber(i.Float32_BE);case 8:case 10:return this.tokenizer.readNumber(i.Float64_BE);default:throw new Error("Invalid IEEE-754 float length: "+e.len)}}async readFlag(e){return 1===await this.readUint(e)}async readUint(e){const t=await this.readBuffer(e),r=Math.min(6,e.len);return t.readUIntBE(e.len-r,r)}async readString(e){return this.tokenizer.readToken(new i.StringType(e.len,"utf-8"))}async readBuffer(t){const r=e.alloc(t.len);return await this.tokenizer.readBuffer(r),r}addTag(e,t){this.metadata.addTag("matroska",e,t)}}t.MatroskaParser=l}).call(this,r(2).Buffer)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=r(53);t.elements={440786851:{name:"ebml",container:{17030:{name:"ebmlVersion",value:i.DataType.uint},17143:{name:"ebmlReadVersion",value:i.DataType.uint},17138:{name:"ebmlMaxIDWidth",value:i.DataType.uint},17139:{name:"ebmlMaxSizeWidth",value:i.DataType.uint},17026:{name:"docType",value:i.DataType.string},17031:{name:"docTypeVersion",value:i.DataType.uint},17029:{name:"docTypeReadVersion",value:i.DataType.uint}}},408125543:{name:"segment",container:{290298740:{name:"seekHead",container:{19899:{name:"seek",container:{21419:{name:"seekId",value:i.DataType.binary},21420:{name:"seekPosition",value:i.DataType.uint}}}}},357149030:{name:"info",container:{29604:{name:"uid",value:i.DataType.uid},29572:{name:"filename",value:i.DataType.string},3979555:{name:"prevUID",value:i.DataType.uid},3965867:{name:"prevFilename",value:i.DataType.string},4110627:{name:"nextUID",value:i.DataType.uid},4096955:{name:"nextFilename",value:i.DataType.string},2807729:{name:"timecodeScale",value:i.DataType.uint},17545:{name:"duration",value:i.DataType.float},17505:{name:"dateUTC",value:i.DataType.uint},31657:{name:"title",value:i.DataType.string},19840:{name:"muxingApp",value:i.DataType.string},22337:{name:"writingApp",value:i.DataType.string}}},524531317:{name:"cluster",multiple:!0,container:{231:{name:"timecode",value:i.DataType.uid},163:{name:"unknown",value:i.DataType.binary},167:{name:"position",value:i.DataType.uid},171:{name:"prevSize",value:i.DataType.uid}}},374648427:{name:"tracks",container:{174:{name:"entries",multiple:!0,container:{215:{name:"trackNumber",value:i.DataType.uint},29637:{name:"uid",value:i.DataType.uid},131:{name:"trackType",value:i.DataType.uint},185:{name:"flagEnabled",value:i.DataType.bool},136:{name:"flagDefault",value:i.DataType.bool},21930:{name:"flagForced",value:i.DataType.bool},156:{name:"flagLacing",value:i.DataType.bool},28135:{name:"minCache",value:i.DataType.uint},28136:{name:"maxCache",value:i.DataType.uint},2352003:{name:"defaultDuration",value:i.DataType.uint},2306383:{name:"timecodeScale",value:i.DataType.float},21358:{name:"name",value:i.DataType.string},2274716:{name:"language",value:i.DataType.string},134:{name:"codecID",value:i.DataType.string},25506:{name:"codecPrivate",value:i.DataType.binary},2459272:{name:"codecName",value:i.DataType.string},3839639:{name:"codecSettings",value:i.DataType.string},3883072:{name:"codecInfoUrl",value:i.DataType.string},2536e3:{name:"codecDownloadUrl",value:i.DataType.string},170:{name:"codecDecodeAll",value:i.DataType.bool},28587:{name:"trackOverlay",value:i.DataType.uint},224:{name:"video",container:{154:{name:"flagInterlaced",value:i.DataType.bool},21432:{name:"stereoMode",value:i.DataType.uint},176:{name:"pixelWidth",value:i.DataType.uint},186:{name:"pixelHeight",value:i.DataType.uint},21680:{name:"displayWidth",value:i.DataType.uint},21690:{name:"displayHeight",value:i.DataType.uint},21683:{name:"aspectRatioType",value:i.DataType.uint},3061028:{name:"colourSpace",value:i.DataType.uint},3126563:{name:"gammaValue",value:i.DataType.float}}},225:{name:"audio",container:{181:{name:"samplingFrequency",value:i.DataType.float},30901:{name:"outputSamplingFrequency",value:i.DataType.float},159:{name:"channels",value:i.DataType.uint},148:{name:"channels",value:i.DataType.uint},32123:{name:"channelPositions",value:i.DataType.binary},25188:{name:"bitDepth",value:i.DataType.uint}}},28032:{name:"contentEncodings",container:{25152:{name:"contentEncoding",container:{20529:{name:"order",value:i.DataType.uint},20530:{name:"scope",value:i.DataType.bool},20531:{name:"type",value:i.DataType.uint},20532:{name:"contentEncoding",container:{16980:{name:"contentCompAlgo",value:i.DataType.uint},16981:{name:"contentCompSettings",value:i.DataType.binary}}},20533:{name:"contentEncoding",container:{18401:{name:"contentEncAlgo",value:i.DataType.uint},18402:{name:"contentEncKeyID",value:i.DataType.binary},18403:{name:"contentSignature ",value:i.DataType.binary},18404:{name:"ContentSigKeyID ",value:i.DataType.binary},18405:{name:"contentSigAlgo ",value:i.DataType.uint},18406:{name:"contentSigHashAlgo ",value:i.DataType.uint}}},25188:{name:"bitDepth",value:i.DataType.uint}}}}}}}}},475249515:{name:"cues",container:{187:{name:"cuePoint",container:{179:{name:"cueTime",value:i.DataType.uid},183:{name:"positions",container:{247:{name:"track",value:i.DataType.uint},241:{name:"clusterPosition",value:i.DataType.uint},21368:{name:"blockNumber",value:i.DataType.uint},234:{name:"codecState",value:i.DataType.uint},219:{name:"reference",container:{150:{name:"time",value:i.DataType.uint},151:{name:"cluster",value:i.DataType.uint},21343:{name:"number",value:i.DataType.uint},235:{name:"codecState",value:i.DataType.uint}}},240:{name:"relativePosition",value:i.DataType.uint}}}}}}},423732329:{name:"attachments",container:{24999:{name:"attachedFile",container:{18046:{name:"description",value:i.DataType.uid},18030:{name:"name",value:i.DataType.string},18016:{name:"mimeType",value:i.DataType.string},18012:{name:"data",value:i.DataType.binary},18094:{name:"uid",value:i.DataType.uid}}}}},272869232:{name:"chapters",container:{17849:{name:"editionEntry",container:{182:{name:"chapterAtom",container:{29636:{name:"uid",value:i.DataType.uid},145:{name:"timeStart",value:i.DataType.uint},146:{name:"timeEnd",value:i.DataType.uid},152:{name:"hidden",value:i.DataType.bool},17816:{name:"enabled",value:i.DataType.uid},143:{name:"track",container:{137:{name:"trackNumber",value:i.DataType.uid},128:{name:"display",container:{133:{name:"string",value:i.DataType.string},17276:{name:"language ",value:i.DataType.string},17278:{name:"country ",value:i.DataType.string}}}}}}}}}}},307544935:{name:"tags",container:{29555:{name:"tag",multiple:!0,container:{25536:{name:"target",container:{25541:{name:"tagTrackUID",value:i.DataType.uid},25540:{name:"tagChapterUID",value:i.DataType.uint},25542:{name:"tagAttachmentUID",value:i.DataType.uid},25546:{name:"targetType",value:i.DataType.string},26826:{name:"targetTypeValue",value:i.DataType.uint},25545:{name:"tagEditionUID",value:i.DataType.uid}}},26568:{name:"simpleTags",multiple:!0,container:{17827:{name:"name",value:i.DataType.string},17543:{name:"string",value:i.DataType.string},17541:{name:"binary",value:i.DataType.binary},17530:{name:"language",value:i.DataType.string},17531:{name:"languageIETF",value:i.DataType.string},17540:{name:"default",value:i.DataType.bool}}}}}}}}}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.RandomBufferReader=class{constructor(e){this.buf=e,this.fileSize=e.length}async randomRead(e,t,r,i){return this.buf.copy(e,t,i,i+r)}}},function(e,t,r){"use strict";(function(e){Object.defineProperty(t,"__esModule",{value:!0}),t.endTag2="LYRICS200",t.getLyricsHeaderLength=async function(r){if(r.fileSize>=143){const i=e.alloc(15);await r.randomRead(i,0,i.length,r.fileSize-143);const n=i.toString("binary");if(n.substr(6)===t.endTag2)return parseInt(n.substr(0,6),10)+15}return 0}}).call(this,r(2).Buffer)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=r(43);class n extends i.Readable{constructor(e){super(),this.bytesRead=0,this.released=!1,this.reader=e.getReader()}async _read(){if(this.released)return void this.push(null);this.pendingRead=this.reader.read();const e=await this.pendingRead;delete this.pendingRead,e.done||this.released?this.push(null):(this.bytesRead+=e.value.length,this.push(e.value))}async waitForReadToComplete(){this.pendingRead&&await this.pendingRead}async close(){await this.syncAndRelease()}async syncAndRelease(){this.released=!0,await this.waitForReadToComplete(),await this.reader.releaseLock()}}t.ReadableWebToNodeStream=n},function(e,t,r){(function(t){var i=r(287).strict;e.exports=function(e){if(i(e)){var r=t.from(e.buffer);return e.byteLength!==e.buffer.byteLength&&(r=r.slice(e.byteOffset,e.byteOffset+e.byteLength)),r}return t.from(e)}}).call(this,r(2).Buffer)},function(e,t){e.exports=n,n.strict=a,n.loose=s;var r=Object.prototype.toString,i={"[object Int8Array]":!0,"[object Int16Array]":!0,"[object Int32Array]":!0,"[object Uint8Array]":!0,"[object Uint8ClampedArray]":!0,"[object Uint16Array]":!0,"[object Uint32Array]":!0,"[object Float32Array]":!0,"[object Float64Array]":!0};function n(e){return a(e)||s(e)}function a(e){return e instanceof Int8Array||e instanceof Int16Array||e instanceof Int32Array||e instanceof Uint8Array||e instanceof Uint8ClampedArray||e instanceof Uint16Array||e instanceof Uint32Array||e instanceof Float32Array||e instanceof Float64Array}function s(e){return i[r.call(e)]}}]); \ No newline at end of file +var i=r(51),n=i.Buffer;function a(e,t){for(var r in e)t[r]=e[r]}function s(e,t,r){return n(e,t,r)}n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow?e.exports=i:(a(i,t),t.Buffer=s),s.prototype=Object.create(n.prototype),a(n,s),s.from=function(e,t,r){if("number"==typeof e)throw new TypeError("Argument must not be a number");return n(e,t,r)},s.alloc=function(e,t,r){if("number"!=typeof e)throw new TypeError("Argument must be a number");var i=n(e);return void 0!==t?"string"==typeof r?i.fill(t,r):i.fill(t):i.fill(0),i},s.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return n(e)},s.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return i.SlowBuffer(e)}},function(e,t,r){"use strict";e.exports=a;var i=r(352),n=Object.create(r(127));function a(e){if(!(this instanceof a))return new a(e);i.call(this,e)}n.inherits=r(117),n.inherits(a,i),a.prototype._transform=function(e,t,r){r(null,e)}},function(e,t,r){e.exports=r(309)},function(e,t,r){e.exports=r(112)},function(e,t,r){e.exports=r(307).Transform},function(e,t,r){e.exports=r(307).PassThrough},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=r(353),n=r(592),a=r(52),s=r(82),o=a("music-metadata:parser:ASF");class u extends s.BasicParser{async parse(){const e=await this.tokenizer.readToken(n.TopLevelHeaderObjectToken);if(!e.objectId.equals(i.default.HeaderObject))throw new Error("expected asf header; but was not found; got: "+e.objectId.str);try{await this.parseObjectHeader(e.numberOfHeaderObjects)}catch(e){o("Error while parsing ASF: %s",e)}}async parseObjectHeader(e){let t;do{const e=await this.tokenizer.readToken(n.HeaderObjectToken);switch(o("header GUID=%s",e.objectId.str),e.objectId.str){case n.FilePropertiesObject.guid.str:const r=await this.tokenizer.readToken(new n.FilePropertiesObject(e));this.metadata.setFormat("duration",r.playDuration/1e7),this.metadata.setFormat("bitrate",r.maximumBitrate);break;case n.StreamPropertiesObject.guid.str:const a=await this.tokenizer.readToken(new n.StreamPropertiesObject(e));this.metadata.setFormat("container","ASF/"+a.streamType);break;case n.HeaderExtensionObject.guid.str:const s=await this.tokenizer.readToken(new n.HeaderExtensionObject);await this.parseExtensionObject(s.extensionDataSize);break;case n.ContentDescriptionObjectState.guid.str:t=await this.tokenizer.readToken(new n.ContentDescriptionObjectState(e)),this.addTags(t);break;case n.ExtendedContentDescriptionObjectState.guid.str:t=await this.tokenizer.readToken(new n.ExtendedContentDescriptionObjectState(e)),this.addTags(t);break;case i.default.CodecListObject.str:case i.default.StreamBitratePropertiesObject.str:await this.tokenizer.ignore(e.objectSize-n.HeaderObjectToken.len);break;case i.default.PaddingObject.str:o("Padding: %s bytes",e.objectSize-n.HeaderObjectToken.len),await this.tokenizer.ignore(e.objectSize-n.HeaderObjectToken.len);break;default:this.metadata.addWarning("Ignore ASF-Object-GUID: "+e.objectId.str),o("Ignore ASF-Object-GUID: %s",e.objectId.str),await this.tokenizer.readToken(new n.IgnoreObjectState(e))}}while(--e)}addTags(e){e.forEach(e=>{this.metadata.addTag("asf",e.id,e.value)})}async parseExtensionObject(e){do{const t=await this.tokenizer.readToken(n.HeaderObjectToken);switch(t.objectId.str){case n.ExtendedStreamPropertiesObjectState.guid.str:await this.tokenizer.readToken(new n.ExtendedStreamPropertiesObjectState(t));break;case n.MetadataObjectState.guid.str:const e=await this.tokenizer.readToken(new n.MetadataObjectState(t));this.addTags(e);break;case n.MetadataLibraryObjectState.guid.str:const r=await this.tokenizer.readToken(new n.MetadataLibraryObjectState(t));this.addTags(r);break;case i.default.PaddingObject.str:await this.tokenizer.ignore(t.objectSize-n.HeaderObjectToken.len);break;case i.default.CompatibilityObject.str:this.tokenizer.ignore(t.objectSize-n.HeaderObjectToken.len);break;case i.default.ASF_Index_Placeholder_Object.str:await this.tokenizer.ignore(t.objectSize-n.HeaderObjectToken.len);break;default:this.metadata.addWarning("Ignore ASF-Object-GUID: "+t.objectId.str),await this.tokenizer.readToken(new n.IgnoreObjectState(t))}e-=t.objectSize}while(e>0)}}t.AsfParser=u},function(e,t,r){"use strict";(function(e){Object.defineProperty(t,"__esModule",{value:!0});const i=r(66),n=r(37),a=r(353),s=r(593),o=r(126);!function(e){e[e.UnicodeString=0]="UnicodeString",e[e.ByteArray=1]="ByteArray",e[e.Bool=2]="Bool",e[e.DWord=3]="DWord",e[e.QWord=4]="QWord",e[e.Word=5]="Word"}(t.DataType||(t.DataType={})),t.TopLevelHeaderObjectToken={len:30,get:(e,t)=>({objectId:a.default.fromBin(new n.BufferType(16).get(e,t)),objectSize:n.UINT64_LE.get(e,t+16),numberOfHeaderObjects:n.UINT32_LE.get(e,t+24)})},t.HeaderObjectToken={len:24,get:(e,t)=>({objectId:a.default.fromBin(new n.BufferType(16).get(e,t)),objectSize:n.UINT64_LE.get(e,t+16)})};class u{constructor(e){this.len=e.objectSize-t.HeaderObjectToken.len}postProcessTag(e,t,r,i){if("WM/Picture"===t)e.push({id:t,value:b.fromBuffer(i)});else{const n=s.AsfUtil.getParserForAttr(r);if(!n)throw new Error("unexpected value headerType: "+r);e.push({id:t,value:n(i)})}}}t.State=u;t.IgnoreObjectState=class extends u{constructor(e){super(e)}get(e,t){return null}};class l extends u{constructor(e){super(e)}get(e,t){return{fileId:a.default.fromBin(e,t),fileSize:n.UINT64_LE.get(e,t+16),creationDate:n.UINT64_LE.get(e,t+24),dataPacketsCount:n.UINT64_LE.get(e,t+32),playDuration:n.UINT64_LE.get(e,t+40),sendDuration:n.UINT64_LE.get(e,t+48),preroll:n.UINT64_LE.get(e,t+56),flags:{broadcast:i.default.strtokBITSET.get(e,t+64,24),seekable:i.default.strtokBITSET.get(e,t+64,25)},minimumDataPacketSize:n.UINT32_LE.get(e,t+68),maximumDataPacketSize:n.UINT32_LE.get(e,t+72),maximumBitrate:n.UINT32_LE.get(e,t+76)}}}t.FilePropertiesObject=l,l.guid=a.default.FilePropertiesObject;class h extends u{constructor(e){super(e)}get(e,t){return{streamType:a.default.decodeMediaType(a.default.fromBin(e,t)),errorCorrectionType:a.default.fromBin(e,t+8)}}}t.StreamPropertiesObject=h,h.guid=a.default.StreamPropertiesObject;class c{constructor(){this.len=22}get(e,t){return{reserved1:a.default.fromBin(e,t),reserved2:e.readUInt16LE(t+16),extensionDataSize:e.readUInt32LE(t+18)}}}t.HeaderExtensionObject=c,c.guid=a.default.HeaderExtensionObject;class f extends u{constructor(e){super(e)}get(e,t){const r=[];let i=t+10;for(let n=0;n0){const t=f.contentDescTags[n],o=i+a;r.push({id:t,value:s.AsfUtil.parseUnicodeAttr(e.slice(i,o))}),i=o}}return r}}t.ContentDescriptionObjectState=f,f.guid=a.default.ContentDescriptionObject,f.contentDescTags=["Title","Author","Copyright","Description","Rating"];class d extends u{constructor(e){super(e)}get(e,t){const r=[],i=e.readUInt16LE(t);let n=t+2;for(let t=0;t({lastBlock:i.default.strtokBITSET.get(e,t,7),type:i.default.getBitAllignedNumber(e,t,1,7),length:n.UINT24_BE.get(e,t+1)})},p.BlockStreamInfo={len:34,get:(e,t)=>({minimumBlockSize:n.UINT16_BE.get(e,t),maximumBlockSize:n.UINT16_BE.get(e,t+2)/1e3,minimumFrameSize:n.UINT24_BE.get(e,t+4),maximumFrameSize:n.UINT24_BE.get(e,t+7),sampleRate:n.UINT24_BE.get(e,t+10)>>4,channels:i.default.getBitAllignedNumber(e,t+12,4,3)+1,bitsPerSample:i.default.getBitAllignedNumber(e,t+12,7,5)+1,totalSamples:i.default.getBitAllignedNumber(e,t+13,4,36),fileMD5:new n.BufferType(16).get(e,t+18)})}},function(e,t,r){"use strict";(function(e){Object.defineProperty(t,"__esModule",{value:!0});const i=r(52),n=r(37),a=r(70),s=r(82),o=r(596),u=r(356),l=r(281),h=i("music-metadata:parser:MP4"),c={raw:{lossy:!1,format:"raw"},MAC3:{lossy:!0,format:"MACE 3:1"},MAC6:{lossy:!0,format:"MACE 6:1"},ima4:{lossy:!0,format:"IMA 4:1"},ulaw:{lossy:!0,format:"uLaw 2:1"},alaw:{lossy:!0,format:"uLaw 2:1"},Qclp:{lossy:!0,format:"QUALCOMM PureVoice"},".mp3":{lossy:!0,format:"MPEG-1 layer 3"},alac:{lossy:!1,format:"ALAC"},"ac-3":{lossy:!0,format:"AC-3"},mp4a:{lossy:!0,format:"MPEG-4/AAC"},mp4s:{lossy:!0,format:"MP4S"},c608:{lossy:!0,format:"CEA-608"},c708:{lossy:!0,format:"CEA-708"}};function f(e,t,r){return r.indexOf(e)===t}class d extends s.BasicParser{static read_BE_Signed_Integer(e){return n.readIntBE(e,0,e.length)}static read_BE_Unsigned_Integer(e){return n.readUIntBE(e,0,e.length)}async parse(){this.tracks=[];let e=this.tokenizer.fileSize;for(;!this.tokenizer.fileSize||e>0;){try{await this.tokenizer.peekToken(u.Header)}catch(e){const t=`Error at offset=${this.tokenizer.position}: ${e.message}`;h(t),this.addWarning(t);break}e-=(await o.Atom.readAtom(this.tokenizer,e=>this.handleAtom(e),null)).header.length}const t=[];this.tracks.forEach(e=>{const r=[];e.soundSampleDescription.forEach(e=>{const t=c[e.dataFormat];t&&r.push(t.format)}),r.length>=1&&t.push(r.join("/"))}),t.length>0&&this.metadata.setFormat("codec",t.filter(f).join("+"));const r=this.tracks.filter(e=>e.soundSampleDescription.length>=1&&e.soundSampleDescription[0].description&&e.soundSampleDescription[0].description.sampleRate>0);if(r.length>=1){const e=r[0],t=e.duration/e.timeScale;this.metadata.setFormat("duration",t);const i=e.soundSampleDescription[0];i.description&&(this.metadata.setFormat("sampleRate",i.description.sampleRate),this.metadata.setFormat("bitsPerSample",i.description.sampleSize),this.metadata.setFormat("numberOfChannels",i.description.numAudioChannels));const n=c[i.dataFormat];n&&this.metadata.setFormat("lossless",!n.lossy),this.calculateBitRate()}}async handleAtom(e){if(e.parent)switch(e.parent.header.name){case"ilst":case"":return this.parseMetadataItemData(e);case"stbl":switch(e.header.name){case"stsd":return this.parseAtom_stsd(e.getPayloadLength());case"stsc":return this.parseAtom_stsc(e.getPayloadLength());case"stts":return this.parseAtom_stts(e.getPayloadLength());case"stsz":return this.parseAtom_stsz(e.getPayloadLength());case"stco":return this.parseAtom_stco(e.getPayloadLength());default:h(`Ignore: stbl/${e.header.name} atom`)}}switch(e.header.name){case"ftyp":const t=await this.parseAtom_ftyp(e.getPayloadLength());h("ftyp: "+t.join("/"));const r=t.filter(f).join("/");return void this.metadata.setFormat("container",r);case"mdhd":return this.parseAtom_mdhd(e);case"mvhd":return this.parseAtom_mvhd(e);case"mdat":this.audioLengthInBytes=e.getPayloadLength(),this.calculateBitRate()}switch(e.header.name){case"ftyp":const t=await this.parseAtom_ftyp(e.getPayloadLength());h("ftyp: "+t.join("/"));const r=t.filter(f).join("/");return void this.metadata.setFormat("container",r);case"mdhd":return this.parseAtom_mdhd(e);case"mvhd":return this.parseAtom_mvhd(e);case"chap":return void(this.getTrackDescription().chapterList=await this.parseAtom_chap(e));case"tkhd":return void await this.parseAtom_tkhd(e.getPayloadLength());case"mdat":return this.audioLengthInBytes=e.getPayloadLength(),this.calculateBitRate(),this.parseAtom_mdat(e.getPayloadLength())}await this.tokenizer.ignore(e.getPayloadLength()),h(`Ignore atom data: path=${e.atomPath}, payload-len=${e.getPayloadLength()}`)}getTrackDescription(){return this.tracks[this.tracks.length-1]}calculateBitRate(){this.audioLengthInBytes&&this.metadata.format.duration&&this.metadata.setFormat("bitrate",8*this.audioLengthInBytes/this.metadata.format.duration)}addTag(e,t){this.metadata.addTag("iTunes",e,t)}addWarning(e){h("Warning: "+e),this.metadata.addWarning(e)}parseMetadataItemData(e){let t=e.header.name;return e.readAtoms(this.tokenizer,async e=>{switch(e.header.name){case"data":return this.parseValueAtom(t,e);case"name":const r=await this.tokenizer.readToken(new u.NameAtom(e.getPayloadLength()));t+=":"+r.name;break;case"mean":const i=await this.tokenizer.readToken(new u.NameAtom(e.getPayloadLength()));t+=":"+i.name;break;default:const a=await this.tokenizer.readToken(new n.BufferType(e.getPayloadLength()));this.addWarning("Unsupported meta-item: "+t+"["+e.header.name+"] => value="+a.toString("hex")+" ascii="+a.toString("ascii"))}},e.getPayloadLength())}async parseValueAtom(t,r){const i=await this.tokenizer.readToken(new u.DataAtom(r.header.length-u.Header.len));if(0!==i.type.set)throw new Error("Unsupported type-set != 0: "+i.type.set);switch(i.type.type){case 0:switch(t){case"trkn":case"disk":const e=n.UINT8.get(i.value,3),r=n.UINT8.get(i.value,5);this.addTag(t,e+"/"+r);break;case"gnre":const a=n.UINT8.get(i.value,1),s=l.Genres[a-1];this.addTag(t,s)}break;case 1:case 18:this.addTag(t,i.value.toString("utf-8"));break;case 13:if(this.options.skipCovers)break;this.addTag(t,{format:"image/jpeg",data:e.from(i.value)});break;case 14:if(this.options.skipCovers)break;this.addTag(t,{format:"image/png",data:e.from(i.value)});break;case 21:this.addTag(t,d.read_BE_Signed_Integer(i.value));break;case 22:this.addTag(t,d.read_BE_Unsigned_Integer(i.value));break;case 65:this.addTag(t,i.value.readInt8(0));break;case 66:this.addTag(t,i.value.readInt16BE(0));break;case 67:this.addTag(t,i.value.readInt32BE(0));break;default:this.addWarning(`atom key=${t}, has unknown well-known-type (data-type): ${i.type.type}`)}}async parseAtom_mvhd(e){await this.tokenizer.ignore(e.getPayloadLength())}async parseAtom_mdhd(e){const t=await this.tokenizer.readToken(new u.MdhdAtom(e.getPayloadLength())),r=this.getTrackDescription();r.creationTime=t.creationTime,r.modificationTime=t.modificationTime,r.timeScale=t.timeScale,r.duration=t.duration}async parseAtom_ftyp(e){const t=await this.tokenizer.readToken(u.ftyp);if((e-=u.ftyp.len)>0){const r=await this.parseAtom_ftyp(e),i=t.type.replace(/\W/g,"");return i.length>0&&r.push(i),r}return[]}async parseAtom_tkhd(e){const t=await this.tokenizer.readToken(new u.TrackHeaderAtom(e));this.tracks.push(t)}async parseAtom_stsd(e){const t=await this.tokenizer.readToken(new u.StsdAtom(e));this.getTrackDescription().soundSampleDescription=t.table.map(e=>this.parseSoundSampleDescription(e))}async parseAtom_stsc(e){const t=await this.tokenizer.readToken(new u.StscAtom(e));this.getTrackDescription().sampleToChunkTable=t.entries}async parseAtom_stts(e){const t=await this.tokenizer.readToken(new u.SttsAtom(e));this.getTrackDescription().timeToSampleTable=t.entries}parseSoundSampleDescription(e){const t={dataFormat:e.dataFormat,dataReferenceIndex:e.dataReferenceIndex};let r=0;const i=u.SoundSampleDescriptionVersion.get(e.description,r);return r+=u.SoundSampleDescriptionVersion.len,0===i.version||1===i.version?t.description=u.SoundSampleDescriptionV0.get(e.description,r):h(`Warning: sound-sample-description ${i} not implemented`),t}async parseAtom_chap(e){const t=[];let r=e.getPayloadLength();for(;r>=n.UINT32_BE.len;)t.push(await this.tokenizer.readNumber(n.UINT32_BE)),r-=n.UINT32_BE.len;return t}async parseAtom_stsz(e){const t=await this.tokenizer.readToken(new u.StszAtom(e)),r=this.getTrackDescription();r.sampleSize=t.sampleSize,r.sampleSizeTable=t.entries}async parseAtom_stco(e){const t=await this.tokenizer.readToken(new u.StcoAtom(e));this.getTrackDescription().chunkOffsetTable=t.entries}async parseAtom_mdat(e){if(this.options.includeChapters){const t=this.tracks.filter(e=>e.chapterList);if(1===t.length){const r=t[0].chapterList,i=this.tracks.filter(e=>-1!==r.indexOf(e.trackId));if(1===i.length)return this.parseChapterTrack(i[0],t[0],e)}}await this.tokenizer.ignore(e)}async parseChapterTrack(e,t,r){e.sampleSize||a.equal(e.chunkOffsetTable.length,e.sampleSizeTable.length,"chunk-offset-table & sample-size-table length");const i=[];for(let n=0;n0;++n){const s=e.chunkOffsetTable[n]-this.tokenizer.position,o=e.sampleSize>0?e.sampleSize:e.sampleSizeTable[n];r-=s+o,a.ok(r>=0,"Chapter chunk exceeding token length"),await this.tokenizer.ignore(s);const l=await this.tokenizer.readToken(new u.ChapterText(o));h(`Chapter ${n+1}: ${l}`);const c={title:l,sampleOffset:this.findSampleOffset(t,this.tokenizer.position)};h(`Chapter title=${c.title}, offset=${c.sampleOffset}/${this.tracks[0].duration}`),i.push(c)}this.metadata.setFormat("chapters",i),await this.tokenizer.ignore(r)}findSampleOffset(e,t){let r=0;e.timeToSampleTable.forEach(e=>{r+=e.count*e.duration}),h("Total duration="+r);let i=0;for(;i=t[r].firstChunk&&e0;){const i=await s.readAtom(e,t,this);this.children.push(i),r-=i.header.length}}async readData(e,t){switch(this.header.name){case"moov":case"udta":case"trak":case"mdia":case"minf":case"stbl":case"":case"ilst":case"tref":return this.readAtoms(e,t,this.getPayloadLength());case"meta":return await e.ignore(4),this.readAtoms(e,t,this.getPayloadLength()-4);case"mdhd":case"mvhd":case"tkhd":case"stsz":case"mdat":default:return t(this)}}}t.Atom=s},function(e,t,r){"use strict";(function(e){Object.defineProperty(t,"__esModule",{value:!0});const i=r(70),n=r(37),a=r(102),s=r(52),o=r(66),u=r(283),l=r(598),h=s("music-metadata:parser:mpeg"),c={AudioObjectTypes:["AAC Main","AAC LC","AAC SSR","AAC LTP"],SamplingFrequencies:[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350,void 0,void 0,-1]},f=[void 0,["front-center"],["front-left","front-right"],["front-center","front-left","front-right"],["front-center","front-left","front-right","back-center"],["front-center","front-left","front-right","back-left","back-right"],["front-center","front-left","front-right","back-left","back-right","LFE-channel"],["front-center","front-left","front-right","side-left","side-right","back-left","back-right","LFE-channel"]];class d{constructor(e,t){this.versionIndex=o.default.getBitAllignedNumber(e,t+1,3,2),this.layer=d.LayerDescription[o.default.getBitAllignedNumber(e,t+1,5,2)],this.versionIndex>1&&0===this.layer?this.parseAdtsHeader(e,t):this.parseMpegHeader(e,t),this.isProtectedByCRC=!o.default.isBitSet(e,t+1,7)}calcDuration(e){return e*this.calcSamplesPerFrame()/this.samplingRate}calcSamplesPerFrame(){return d.samplesInFrameTable[1===this.version?0:1][this.layer]}calculateSideInfoLength(){if(3!==this.layer)return 2;if(3===this.channelModeIndex){if(1===this.version)return 17;if(2===this.version||2.5===this.version)return 9}else{if(1===this.version)return 32;if(2===this.version||2.5===this.version)return 17}}calcSlotSize(){return[null,4,1,1][this.layer]}parseMpegHeader(e,t){this.container="MPEG",this.bitrateIndex=o.default.getBitAllignedNumber(e,t+2,0,4),this.sampRateFreqIndex=o.default.getBitAllignedNumber(e,t+2,4,2),this.padding=o.default.isBitSet(e,t+2,6),this.privateBit=o.default.isBitSet(e,t+2,7),this.channelModeIndex=o.default.getBitAllignedNumber(e,t+3,0,2),this.modeExtension=o.default.getBitAllignedNumber(e,t+3,2,2),this.isCopyrighted=o.default.isBitSet(e,t+3,4),this.isOriginalMedia=o.default.isBitSet(e,t+3,5),this.emphasis=o.default.getBitAllignedNumber(e,t+3,7,2),this.version=d.VersionID[this.versionIndex],this.channelMode=d.ChannelMode[this.channelModeIndex],this.codec=`MPEG ${this.version} Layer ${this.layer}`;const r=this.calcBitrate();if(!r)throw new Error("Cannot determine bit-rate");if(this.bitrate=1e3*r,this.samplingRate=this.calcSamplingRate(),null==this.samplingRate)throw new Error("Cannot determine sampling-rate")}parseAdtsHeader(e,t){h("layer=0 => ADTS"),this.version=2===this.versionIndex?4:2,this.container="ADTS/MPEG-"+this.version;const r=o.default.getBitAllignedNumber(e,t+2,0,2);this.codec="AAC",this.codecProfile=c.AudioObjectTypes[r],h("MPEG-4 audio-codec="+this.codec);const i=o.default.getBitAllignedNumber(e,t+2,2,4);this.samplingRate=c.SamplingFrequencies[i],h("sampling-rate="+this.samplingRate);const n=o.default.getBitAllignedNumber(e,t+2,7,3);this.mp4ChannelConfig=f[n],h("channel-config="+this.mp4ChannelConfig.join("+")),this.frameLength=o.default.getBitAllignedNumber(e,t+3,6,2)<<11}calcBitrate(){if(0===this.bitrateIndex||15===this.bitrateIndex)return;const e=`${Math.floor(this.version)}${this.layer}`;return d.bitrate_index[this.bitrateIndex][e]}calcSamplingRate(){return 3===this.sampRateFreqIndex?null:d.sampling_rate_freq_index[this.version][this.sampRateFreqIndex]}}d.SyncByte1=255,d.SyncByte2=224,d.VersionID=[2.5,null,2,1],d.LayerDescription=[0,3,2,1],d.ChannelMode=["stereo","joint_stereo","dual_channel","mono"],d.bitrate_index={1:{11:32,12:32,13:32,21:32,22:8,23:8},2:{11:64,12:48,13:40,21:48,22:16,23:16},3:{11:96,12:56,13:48,21:56,22:24,23:24},4:{11:128,12:64,13:56,21:64,22:32,23:32},5:{11:160,12:80,13:64,21:80,22:40,23:40},6:{11:192,12:96,13:80,21:96,22:48,23:48},7:{11:224,12:112,13:96,21:112,22:56,23:56},8:{11:256,12:128,13:112,21:128,22:64,23:64},9:{11:288,12:160,13:128,21:144,22:80,23:80},10:{11:320,12:192,13:160,21:160,22:96,23:96},11:{11:352,12:224,13:192,21:176,22:112,23:112},12:{11:384,12:256,13:224,21:192,22:128,23:128},13:{11:416,12:320,13:256,21:224,22:144,23:144},14:{11:448,12:384,13:320,21:256,22:160,23:160}},d.sampling_rate_freq_index={1:{0:44100,1:48e3,2:32e3},2:{0:22050,1:24e3,2:16e3},2.5:{0:11025,1:12e3,2:8e3}},d.samplesInFrameTable=[[0,384,1152,1152],[0,384,1152,576]];const p=4,m=(e,t)=>new d(e,t);class g extends u.AbstractID3Parser{constructor(){super(...arguments),this.frameCount=0,this.syncFrameCount=-1,this.countSkipFrameData=0,this.totalDataLength=0,this.bitrates=[],this.calculateEofDuration=!1,this.buf_frame_header=e.alloc(4),this.syncPeek={buf:e.alloc(1024),len:0}}async _parse(){this.metadata.setFormat("lossless",!1);try{let e=!1;for(;!e;)await this.sync(),e=await this.parseCommonMpegHeader()}catch(e){if(!(e instanceof a.EndOfStreamError))throw e;if(h("End-of-stream"),this.calculateEofDuration){const e=this.frameCount*this.samplesPerFrame;this.metadata.setFormat("numberOfSamples",e);const t=e/this.metadata.format.sampleRate;h(`Calculate duration at EOF: ${t} sec.`,t),this.metadata.setFormat("duration",t)}}}finalize(){const e=this.metadata.format,t=this.metadata.native.hasOwnProperty("ID3v1");if(e.duration&&this.tokenizer.fileSize){const r=this.tokenizer.fileSize-this.mpegOffset-(t?128:0);e.codecProfile&&"V"===e.codecProfile[0]&&this.metadata.setFormat("bitrate",8*r/e.duration)}else if(this.tokenizer.fileSize&&"CBR"===e.codecProfile){const r=this.tokenizer.fileSize-this.mpegOffset-(t?128:0),i=Math.round(r/this.frame_size)*this.samplesPerFrame;this.metadata.setFormat("numberOfSamples",i);const n=i/e.sampleRate;h("Calculate CBR duration based on file size: %s",n),this.metadata.setFormat("duration",n)}}async sync(){let e=!1;for(;;){let t=0;if(this.syncPeek.len=await this.tokenizer.peekBuffer(this.syncPeek.buf,0,1024,this.tokenizer.position,!0),this.syncPeek.len<=256)throw new a.EndOfStreamError;for(;;){if(e&&224==(224&this.syncPeek.buf[t]))return this.buf_frame_header[0]=d.SyncByte1,this.buf_frame_header[1]=this.syncPeek.buf[t],await this.tokenizer.ignore(t),h(`Sync at offset=${this.tokenizer.position-1}, frameCount=${this.frameCount}`),this.syncFrameCount===this.frameCount&&(h("Re-synced MPEG stream, frameCount="+this.frameCount),this.frameCount=0,this.frame_size=0),void(this.syncFrameCount=this.frameCount);if(e=!1,t=this.syncPeek.buf.indexOf(d.SyncByte1,t),-1===t){if(this.syncPeek.len=2&&0===e.layer?this.parseAdts(e):this.parseAudioFrameHeader(e)}async parseAudioFrameHeader(e){this.metadata.setFormat("numberOfChannels","mono"===e.channelMode?1:2),this.metadata.setFormat("bitrate",e.bitrate),this.frameCount<2e5&&h("offset=%s MP%s bitrate=%s sample-rate=%s",this.tokenizer.position-4,e.layer,e.bitrate,e.samplingRate);const t=e.calcSlotSize();if(null===t)throw new Error("invalid slot_size");const r=e.calcSamplesPerFrame();h("samples_per_frame="+r);const i=r/8*e.bitrate/e.samplingRate+(e.padding?t:0);if(this.frame_size=Math.floor(i),this.audioFrameHeader=e,this.bitrates.push(e.bitrate),1===this.frameCount)return this.offset=p,await this.skipSideInformation(),!1;if(3===this.frameCount){if(this.areAllSame(this.bitrates)){if(this.samplesPerFrame=r,this.metadata.setFormat("codecProfile","CBR"),this.tokenizer.fileSize)return!0}else if(this.metadata.format.duration)return!0;if(!this.options.duration)return!0}return this.options.duration&&4===this.frameCount&&(this.samplesPerFrame=r,this.calculateEofDuration=!0),this.offset=4,e.isProtectedByCRC?(await this.parseCrc(),!1):(await this.skipSideInformation(),!1)}async parseAdts(t){const r=e.alloc(3);await this.tokenizer.readBuffer(r),t.frameLength+=o.default.getBitAllignedNumber(r,0,0,11),this.tokenizer.ignore(t.frameLength-7),this.totalDataLength+=t.frameLength,this.samplesPerFrame=1024;const i=t.samplingRate/this.samplesPerFrame,n=8*(0===this.frameCount?0:this.totalDataLength/this.frameCount)*i+.5;if(this.metadata.setFormat("codecProfile",t.codecProfile),this.metadata.setFormat("bitrate",n),t.mp4ChannelConfig&&this.metadata.setFormat("numberOfChannels",t.mp4ChannelConfig.length),h(`frame-count=${this.frameCount}, size=${t.frameLength} bytes, bit-rate=${n}`),3===this.frameCount){if(!this.options.duration)return!0;this.calculateEofDuration=!0}return!1}async parseCrc(){return this.crc=await this.tokenizer.readNumber(n.INT16_BE),this.offset+=2,this.skipSideInformation()}async skipSideInformation(){const e=this.audioFrameHeader.calculateSideInfoLength();await this.tokenizer.readToken(new n.BufferType(e)),this.offset+=e,await this.readXtraInfoHeader()}async readXtraInfoHeader(){const e=await this.tokenizer.readToken(l.InfoTagHeaderTag);switch(this.offset+=l.InfoTagHeaderTag.len,e){case"Info":return this.metadata.setFormat("codecProfile","CBR"),this.readXingInfoHeader();case"Xing":const e=await this.readXingInfoHeader(),t="V"+(100-e.vbrScale)/10;return this.metadata.setFormat("codecProfile",t),null;case"Xtra":break;case"LAME":const r=await this.tokenizer.readToken(l.LameEncoderVersion);return this.offset+=l.LameEncoderVersion.len,this.metadata.setFormat("tool","LAME "+r),await this.skipFrameData(this.frame_size-this.offset),null}const t=this.frame_size-this.offset;return t<0?this.metadata.addWarning("Frame "+this.frameCount+"corrupt: negative frameDataLeft"):await this.skipFrameData(t),null}async readXingInfoHeader(){const e=await this.tokenizer.readToken(l.XingInfoTag);if(this.offset+=l.XingInfoTag.len,this.metadata.setFormat("tool",o.default.stripNulls(e.codec)),1==(1&e.headerFlags[3])){const t=this.audioFrameHeader.calcDuration(e.numFrames);return this.metadata.setFormat("duration",t),h("Get duration from Xing header: %s",this.metadata.format.duration),e}const t=this.frame_size-this.offset;return await this.skipFrameData(t),e}async skipFrameData(e){i.ok(e>=0,"frame-data-left cannot be negative"),await this.tokenizer.ignore(e),this.countSkipFrameData+=e}areAllSame(e){const t=e[0];return e.every(e=>e===t)}}t.MpegParser=g}).call(this,r(51).Buffer)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=r(37);t.InfoTagHeaderTag=new i.StringType(4,"ascii"),t.LameEncoderVersion=new i.StringType(6,"ascii"),t.XingInfoTag={len:136,get:(e,t)=>({headerFlags:new i.BufferType(4).get(e,t),numFrames:i.UINT32_BE.get(e,t+4),streamSize:i.UINT32_BE.get(e,t+8),vbrScale:i.UINT32_BE.get(e,t+112),codec:new i.StringType(9,"ascii").get(e,t+116),infoTagRevision:i.UINT8.get(e,t+125)>>4,vbrMethod:15&i.UINT8.get(e,t+125)})}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=r(52),n=r(37),a=r(600),s=r(602),o=r(283),u=i("music-metadata:parser:musepack");class l extends o.AbstractID3Parser{async _parse(){let e;switch(await this.tokenizer.peekToken(new n.StringType(3,"binary"))){case"MP+":u("Musepack stream-version 7"),e=new s.MpcSv7Parser;break;case"MPC":u("Musepack stream-version 8"),e=new a.MpcSv8Parser;break;default:throw new Error("Invalid Musepack signature prefix")}return e.init(this.metadata,this.tokenizer,this.options),e.parse()}}t.default=l},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=r(52),n=r(70),a=r(82),s=r(601),o=r(116),u=r(75),l=i("music-metadata:parser:musepack");class h extends a.BasicParser{constructor(){super(...arguments),this.audioLength=0}async parse(){const e=await this.tokenizer.readToken(u.FourCcToken);return n.equal(e,"MPCK","Magic number"),this.metadata.setFormat("container","Musepack, SV8"),this.parsePacket()}async parsePacket(){const e=new s.StreamReader(this.tokenizer);for(;;){const t=await e.readPacketHeader();switch(l(`packet-header key=${t.key}, payloadLength=${t.payloadLength}`),t.key){case"SH":const r=await e.readStreamHeader(t.payloadLength);this.metadata.setFormat("numberOfSamples",r.sampleCount),this.metadata.setFormat("sampleRate",r.sampleFrequency),this.metadata.setFormat("duration",r.sampleCount/r.sampleFrequency),this.metadata.setFormat("numberOfChannels",r.channelCount);break;case"AP":this.audioLength+=t.payloadLength,await this.tokenizer.ignore(t.payloadLength);break;case"RG":case"EI":case"SO":case"ST":case"CT":await this.tokenizer.ignore(t.payloadLength);break;case"SE":return this.metadata.setFormat("bitrate",8*this.audioLength/this.metadata.format.duration),o.APEv2Parser.tryParseApeHeader(this.metadata,this.tokenizer,this.options);default:throw new Error("Unexpected header: "+t.key)}}}}t.MpcSv8Parser=h},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=r(37),n=r(66),a=r(52)("music-metadata:parser:musepack:sv8"),s=new i.StringType(2,"binary"),o={len:5,get:(e,t)=>({crc:i.UINT32_LE.get(e,t),streamVersion:i.UINT8.get(e,t+4)})},u={len:2,get:(e,t)=>({sampleFrequency:[44100,48e3,37800,32e3][n.default.getBitAllignedNumber(e,t,0,3)],maxUsedBands:n.default.getBitAllignedNumber(e,t,3,5),channelCount:n.default.getBitAllignedNumber(e,t+1,0,4)+1,msUsed:n.default.isBitSet(e,t+1,4),audioBlockFrames:n.default.getBitAllignedNumber(e,t+1,5,3)})};t.StreamReader=class{constructor(e){this.tokenizer=e}async readPacketHeader(){const e=await this.tokenizer.readToken(s),t=await this.readVariableSizeField();return{key:e,payloadLength:t.value-2-t.len}}async readStreamHeader(e){const t={};a("Reading SH at offset="+this.tokenizer.position);const r=await this.tokenizer.readToken(o);e-=o.len,Object.assign(t,r),a("SH.streamVersion = "+r.streamVersion);const i=await this.readVariableSizeField();e-=i.len,t.sampleCount=i.value;const n=await this.readVariableSizeField();e-=n.len,t.beginningOfSilence=n.value;const s=await this.tokenizer.readToken(u);return e-=u.len,Object.assign(t,s),await this.tokenizer.ignore(e),t}async readVariableSizeField(e=1,t=0){let r=await this.tokenizer.readNumber(i.UINT8);return 0==(128&r)?{len:e,value:t+r}:(r&=127,r+=t,this.readVariableSizeField(e+1,r<<7))}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=r(52),n=r(70),a=r(82),s=r(603),o=r(116),u=r(604),l=i("music-metadata:parser:musepack");class h extends a.BasicParser{constructor(){super(...arguments),this.audioLength=0}async parse(){const e=await this.tokenizer.readToken(s.Header);n.equal(e.signature,"MP+","Magic number"),l(`stream-version=${e.streamMajorVersion}.${e.streamMinorVersion}`),this.metadata.setFormat("container","Musepack, SV7"),this.metadata.setFormat("sampleRate",e.sampleFrequency);const t=1152*(e.frameCount-1)+e.lastFrameLength;this.metadata.setFormat("numberOfSamples",t),this.duration=t/e.sampleFrequency,this.metadata.setFormat("duration",this.duration),this.bitreader=new u.BitReader(this.tokenizer),this.metadata.setFormat("numberOfChannels",e.midSideStereo||e.intensityStereo?2:1);const r=await this.bitreader.read(8);return this.metadata.setFormat("codec",(r/100).toFixed(2)),await this.skipAudioData(e.frameCount),l("End of audio stream, switching to APEv2, offset="+this.tokenizer.position),o.APEv2Parser.tryParseApeHeader(this.metadata,this.tokenizer,this.options)}async skipAudioData(e){for(;e-- >0;){const e=await this.bitreader.read(20);this.audioLength+=20+e,await this.bitreader.ignore(e)}const t=await this.bitreader.read(11);this.audioLength+=t,this.metadata.setFormat("bitrate",this.audioLength/this.duration)}}t.MpcSv7Parser=h},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=r(37),n=r(66);t.Header={len:24,get:(e,t)=>{const r={signature:e.toString("binary",t,t+3),streamMinorVersion:n.default.getBitAllignedNumber(e,t+3,0,4),streamMajorVersion:n.default.getBitAllignedNumber(e,t+3,4,4),frameCount:i.UINT32_LE.get(e,t+4),maxLevel:i.UINT16_LE.get(e,t+8),sampleFrequency:[44100,48e3,37800,32e3][n.default.getBitAllignedNumber(e,t+10,0,2)],link:n.default.getBitAllignedNumber(e,t+10,2,2),profile:n.default.getBitAllignedNumber(e,t+10,4,4),maxBand:n.default.getBitAllignedNumber(e,t+11,0,6),intensityStereo:n.default.isBitSet(e,t+11,6),midSideStereo:n.default.isBitSet(e,t+11,7),titlePeak:i.UINT16_LE.get(e,t+12),titleGain:i.UINT16_LE.get(e,t+14),albumPeak:i.UINT16_LE.get(e,t+16),albumGain:i.UINT16_LE.get(e,t+18),lastFrameLength:i.UINT32_LE.get(e,t+20)>>>20&2047,trueGapless:n.default.isBitSet(e,t+23,0)};return r.lastFrameLength=r.trueGapless?i.UINT32_LE.get(e,20)>>>20&2047:0,r}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=r(37);t.BitReader=class{constructor(e){this.tokenizer=e,this.pos=0,this.dword=void 0}async read(e){for(;void 0===this.dword;)this.dword=await this.tokenizer.readToken(i.UINT32_LE);let t=this.dword;return this.pos+=e,this.pos<32?(t>>>=32-this.pos,t&(1<>>32-this.pos),t&(1<0){const t=32-this.pos;this.dword=void 0,e-=t,this.pos=0}const t=e%32,r=(e-t)/32;return await this.tokenizer.ignore(4*r),this.read(t)}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=r(37),n=r(52),a=r(70),s=r(66),o=r(75),u=r(284),l=r(606),h=r(608),c=r(82),f=r(610),d=r(102),p=n("music-metadata:parser:ogg");class m{constructor(e){this.len=e.page_segments}static sum(e,t,r){let i=0;for(let n=t;n0)return this.metadata.addWarning("Invalid FourCC ID, maybe last OGG-page is not marked with last-page flag"),this.pageConsumer.flush();throw e}}}t.OggParser=g,g.Header={len:27,get:(e,t)=>({capturePattern:o.FourCcToken.get(e,t),version:e.readUInt8(t+4),headerType:{continued:s.default.strtokBITSET.get(e,t+5,0),firstPage:s.default.strtokBITSET.get(e,t+5,1),lastPage:s.default.strtokBITSET.get(e,t+5,2)},absoluteGranulePosition:e.readIntLE(t+6,6),streamSerialNumber:i.UINT32_LE.get(e,t+14),pageSequenceNo:i.UINT32_LE.get(e,t+18),pageChecksum:i.UINT32_LE.get(e,t+22),page_segments:e.readUInt8(t+26)})}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=r(37),n=r(607),a=r(284);class s extends a.VorbisParser{constructor(e,t,r){super(e,t),this.tokenizer=r,this.lastPos=-1}parseFirstPage(e,t){if(this.metadata.setFormat("codec","Opus"),this.idHeader=new n.IdHeader(t.length).get(t,0),"OpusHead"!==this.idHeader.magicSignature)throw new Error("Illegal ogg/Opus magic-signature");this.metadata.setFormat("sampleRate",this.idHeader.inputSampleRate),this.metadata.setFormat("numberOfChannels",this.idHeader.channelCount)}parseFullPage(e){switch(new i.StringType(8,"ascii").get(e,0)){case"OpusTags":this.parseUserCommentList(e,8),this.lastPos=this.tokenizer.position}}calculateDuration(e){if(this.metadata.format.sampleRate&&e.absoluteGranulePosition>=0&&(this.metadata.setFormat("numberOfSamples",e.absoluteGranulePosition-this.idHeader.preSkip),this.metadata.setFormat("duration",this.metadata.format.numberOfSamples/this.idHeader.inputSampleRate),-1!==this.lastPos&&this.tokenizer.fileSize&&this.metadata.format.duration)){const e=this.tokenizer.fileSize-this.lastPos;this.metadata.setFormat("bitrate",8*e/this.metadata.format.duration)}}}t.OpusParser=s},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=r(37);t.IdHeader=class{constructor(e){if(this.len=e,e<19)throw new Error("ID-header-page 0 should be at least 19 bytes long")}get(e,t){return{magicSignature:new i.StringType(8,"ascii").get(e,t+0),version:e.readUInt8(t+8),channelCount:e.readUInt8(t+9),preSkip:e.readInt16LE(t+10),inputSampleRate:e.readInt32LE(t+12),outputGain:e.readInt16LE(t+16),channelMapping:e.readUInt8(t+18)}}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=r(52),n=r(609),a=r(284),s=i("music-metadata:parser:ogg:speex");class o extends a.VorbisParser{constructor(e,t,r){super(e,t),this.tokenizer=r}parseFirstPage(e,t){s("First Ogg/Speex page");const r=n.Header.get(t,0);this.metadata.setFormat("codec","Speex "+r.version),this.metadata.setFormat("numberOfChannels",r.nb_channels),this.metadata.setFormat("sampleRate",r.rate),-1!==r.bitrate&&this.metadata.setFormat("bitrate",r.bitrate)}}t.SpeexParser=o},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=r(37),n=r(66);t.Header={len:80,get:(e,t)=>({speex:new i.StringType(8,"ascii").get(e,t+0),version:n.default.trimRightNull(new i.StringType(20,"ascii").get(e,t+8)),version_id:e.readInt32LE(t+28),header_size:e.readInt32LE(t+32),rate:e.readInt32LE(t+36),mode:e.readInt32LE(t+40),mode_bitstream_version:e.readInt32LE(t+44),nb_channels:e.readInt32LE(t+48),bitrate:e.readInt32LE(t+52),frame_size:e.readInt32LE(t+56),vbr:e.readInt32LE(t+60),frames_per_packet:e.readInt32LE(t+64),extra_headers:e.readInt32LE(t+68),reserved1:e.readInt32LE(t+72),reserved2:e.readInt32LE(t+76)})}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=r(52),n=r(611),a=i("music-metadata:parser:ogg:theora");t.TheoraParser=class{constructor(e,t,r){this.metadata=e,this.tokenizer=r}parsePage(e,t){e.headerType.firstPage&&this.parseFirstPage(e,t)}flush(){a("flush")}parseFirstPage(e,t){a("First Ogg/Theora page"),this.metadata.setFormat("codec","Theora");const r=n.IdentificationHeader.get(t,0);this.metadata.setFormat("bitrate",r.nombr)}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=r(37);t.IdentificationHeader={len:42,get:(e,t)=>({id:new i.StringType(7,"ascii").get(e,t),vmaj:e.readUInt8(t+7),vmin:e.readUInt8(t+8),vrev:e.readUInt8(t+9),vmbw:e.readUInt16BE(t+10),vmbh:e.readUInt16BE(t+17),nombr:i.UINT24_BE.get(e,t+37),nqual:e.readUInt8(t+40)})}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=r(102),n=r(37),a=r(52),s=r(613),o=r(614),u=r(125),l=r(66),h=r(75),c=r(82),f=r(305),d=a("music-metadata:parser:RIFF");class p extends c.BasicParser{async parse(){const e=await this.tokenizer.readToken(s.Header);if(d(`pos=${this.tokenizer.position}, parse: chunkID=${e.chunkID}`),"RIFF"===e.chunkID)return this.parseRiffChunk(e.chunkSize).catch(e=>{if(!(e instanceof i.EndOfStreamError))throw e})}async parseRiffChunk(e){const t=await this.tokenizer.readToken(h.FourCcToken);switch(this.metadata.setFormat("container",t),t){case"WAVE":return this.readWaveChunk(e-h.FourCcToken.len);default:throw new Error("Unsupported RIFF format: RIFF/"+t)}}async readWaveChunk(e){do{const t=await this.tokenizer.readToken(s.Header);switch(e-=s.Header.len+t.chunkSize,this.header=t,d(`pos=${this.tokenizer.position}, readChunk: chunkID=RIFF/WAVE/${t.chunkID}`),t.chunkID){case"LIST":await this.parseListTag(t);break;case"fact":this.metadata.setFormat("lossless",!1),this.fact=await this.tokenizer.readToken(new o.FactChunk(t));break;case"fmt ":const e=await this.tokenizer.readToken(new o.Format(t));let r=o.WaveFormat[e.wFormatTag];r||(d("WAVE/non-PCM format="+e.wFormatTag),r="non-PCM ("+e.wFormatTag+")"),this.metadata.setFormat("codec",r),this.metadata.setFormat("bitsPerSample",e.wBitsPerSample),this.metadata.setFormat("sampleRate",e.nSamplesPerSec),this.metadata.setFormat("numberOfChannels",e.nChannels),this.metadata.setFormat("bitrate",e.nBlockAlign*e.nSamplesPerSec*8),this.blockAlign=e.nBlockAlign;break;case"id3 ":case"ID3 ":const a=await this.tokenizer.readToken(new n.BufferType(t.chunkSize)),s=new f.ID3Stream(a),l=i.fromStream(s);await(new u.ID3v2Parser).parse(this.metadata,l,this.options);break;case"data":!1!==this.metadata.format.lossless&&this.metadata.setFormat("lossless",!0);const h=this.fact?this.fact.dwSampleLength:t.chunkSize/this.blockAlign;this.metadata.setFormat("numberOfSamples",h),this.metadata.setFormat("duration",h/this.metadata.format.sampleRate),this.metadata.setFormat("bitrate",this.metadata.format.numberOfChannels*this.blockAlign*this.metadata.format.sampleRate),await this.tokenizer.ignore(t.chunkSize);break;default:d(`Ignore chunk: RIFF/${t.chunkID} of ${t.chunkSize} bytes`),this.metadata.addWarning("Ignore chunk: RIFF/"+t.chunkID),await this.tokenizer.ignore(t.chunkSize)}this.header.chunkSize%2==1&&(d("Read odd padding byte"),await this.tokenizer.ignore(1))}while(e>0)}async parseListTag(e){const t=await this.tokenizer.readToken(h.FourCcToken);switch(d("pos=%s, parseListTag: chunkID=RIFF/WAVE/LIST/%s",this.tokenizer.position,t),t){case"INFO":return this.parseRiffInfoTags(e.chunkSize-4);case"adtl":default:return this.metadata.addWarning("Ignore chunk: RIFF/WAVE/LIST/"+t),d("Ignoring chunkID=RIFF/WAVE/LIST/"+t),this.tokenizer.ignore(e.chunkSize-4)}}async parseRiffInfoTags(e){for(;e>=8;){const t=await this.tokenizer.readToken(s.Header),r=new s.ListInfoTagValue(t),i=await this.tokenizer.readToken(r);this.addTag(t.chunkID,l.default.stripNulls(i)),e-=8+r.len}if(0!==e)throw Error("Illegal remaining size: "+e)}addTag(e,t){this.metadata.addTag("exif",e,t)}}t.WaveParser=p},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=r(37),n=r(75);t.Header={len:8,get:(e,t)=>({chunkID:n.FourCcToken.get(e,t),chunkSize:e.readUInt32LE(t+4)})};t.ListInfoTagValue=class{constructor(e){this.tagHeader=e,this.len=e.chunkSize,this.len+=1&this.len}get(e,t){return new i.StringType(this.tagHeader.chunkSize,"ascii").get(e,t)}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=r(70);!function(e){e[e.PCM=1]="PCM",e[e.ADPCM=2]="ADPCM",e[e.IEEE_FLOAT=3]="IEEE_FLOAT",e[e.MPEG_ADTS_AAC=5632]="MPEG_ADTS_AAC",e[e.MPEG_LOAS=5634]="MPEG_LOAS",e[e.RAW_AAC1=255]="RAW_AAC1",e[e.DOLBY_AC3_SPDIF=146]="DOLBY_AC3_SPDIF",e[e.DVM=8192]="DVM",e[e.RAW_SPORT=576]="RAW_SPORT",e[e.ESST_AC3=577]="ESST_AC3",e[e.DRM=9]="DRM",e[e.DTS2=8193]="DTS2",e[e.MPEG=80]="MPEG"}(t.WaveFormat||(t.WaveFormat={}));t.Format=class{constructor(e){i.ok(e.chunkSize>=16,"16 for PCM."),this.len=e.chunkSize}get(e,t){return{wFormatTag:e.readUInt16LE(t),nChannels:e.readUInt16LE(t+2),nSamplesPerSec:e.readUInt32LE(t+4),nAvgBytesPerSec:e.readUInt32LE(t+8),nBlockAlign:e.readUInt16LE(t+12),wBitsPerSample:e.readUInt16LE(t+14)}}};t.FactChunk=class{constructor(e){i.ok(e.chunkSize>=4,"minimum fact chunk size."),this.len=e.chunkSize}get(e,t){return{dwSampleLength:e.readUInt32LE(t)}}}},function(e,t,r){"use strict";(function(e){Object.defineProperty(t,"__esModule",{value:!0});const i=r(37),n=r(70),a=r(116),s=r(75),o=r(82),u=r(616),l=r(52)("music-metadata:parser:WavPack");class h extends o.BasicParser{async parse(){return this.audioDataSize=0,await this.parseWavPackBlocks(),a.APEv2Parser.tryParseApeHeader(this.metadata,this.tokenizer,this.options)}async parseWavPackBlocks(){do{if("wvpk"!==await this.tokenizer.peekToken(s.FourCcToken))break;const e=await this.tokenizer.readToken(u.WavPack.BlockHeaderToken);n.strictEqual(e.BlockID,"wvpk","WavPack Block-ID"),l(`WavPack header blockIndex=${e.blockIndex}, len=${u.WavPack.BlockHeaderToken.len}`),0!==e.blockIndex||this.metadata.format.container||(this.metadata.setFormat("container","WavPack"),this.metadata.setFormat("lossless",!e.flags.isHybrid),this.metadata.setFormat("bitsPerSample",e.flags.bitsPerSample),e.flags.isDSD||(this.metadata.setFormat("sampleRate",e.flags.samplingRate),this.metadata.setFormat("duration",e.totalSamples/e.flags.samplingRate)),this.metadata.setFormat("numberOfChannels",e.flags.isMono?1:2),this.metadata.setFormat("numberOfSamples",e.totalSamples),this.metadata.setFormat("codec",e.flags.isDSD?"DSD":"PCM"));const t=e.blockSize-(u.WavPack.BlockHeaderToken.len-8);0===e.blockIndex?await this.parseMetadataSubBlock(e,t):await this.tokenizer.ignore(t),e.blockSamples>0&&(this.audioDataSize+=e.blockSize)}while(!this.tokenizer.fileSize||this.tokenizer.fileSize-this.tokenizer.position>=u.WavPack.BlockHeaderToken.len);this.metadata.setFormat("bitrate",8*this.audioDataSize/this.metadata.format.duration)}async parseMetadataSubBlock(t,r){for(;r>u.WavPack.MetadataIdToken.len;){const a=await this.tokenizer.readToken(u.WavPack.MetadataIdToken),s=await this.tokenizer.readNumber(a.largeBlock?i.UINT24_LE:i.UINT8),o=e.alloc(2*s-(a.isOddSize?1:0));switch(await this.tokenizer.readBuffer(o,0,o.length),l(`Metadata Sub-Blocks functionId=0x${a.functionId.toString(16)}, id.largeBlock=${a.largeBlock},data-size=${o.length}`),a.functionId){case 0:break;case 14:l("ID_DSD_BLOCK");const e=1<>>t&4294967295>>>32-r}}t.WavPack=s,s.BlockHeaderToken={len:32,get:(e,t)=>{const r=i.UINT32_LE.get(e,t+24),o={BlockID:n.FourCcToken.get(e,t),blockSize:i.UINT32_LE.get(e,t+4),version:i.UINT16_LE.get(e,t+8),totalSamples:i.UINT32_LE.get(e,t+12),blockIndex:i.UINT32_LE.get(e,t+16),blockSamples:i.UINT32_LE.get(e,t+20),flags:{bitsPerSample:8*(1+s.getBitAllignedNumber(r,0,2)),isMono:s.isBitSet(r,2),isHybrid:s.isBitSet(r,3),isJointStereo:s.isBitSet(r,4),crossChannel:s.isBitSet(r,5),hybridNoiseShaping:s.isBitSet(r,6),floatingPoint:s.isBitSet(r,7),samplingRate:a[s.getBitAllignedNumber(r,23,4)],isDSD:s.isBitSet(r,31)},crc:new i.BufferType(4).get(e,t+28)};return o.flags.isDSD&&(o.totalSamples*=8),o}},s.MetadataIdToken={len:1,get:(e,t)=>({functionId:s.getBitAllignedNumber(e[t],0,6),isOptional:s.isBitSet(e[t],5),isOddSize:s.isBitSet(e[t],6),largeBlock:s.isBitSet(e[t],7)})}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=r(283),n=r(70),a=r(52),s=r(618),o=r(125),u=a("music-metadata:parser:DSF");class l extends i.AbstractID3Parser{async _parse(){const e=this.tokenizer.position,t=await this.tokenizer.readToken(s.ChunkHeader);n.strictEqual(t.id,"DSD ","Invalid chunk signature"),this.metadata.setFormat("container","DSF"),this.metadata.setFormat("lossless",!0);const r=await this.tokenizer.readToken(s.DsdChunk);if(0!==r.metadataPointer)return u("expect ID3v2 at offset="+r.metadataPointer),await this.parseChunks(r.fileSize-t.size),await this.tokenizer.ignore(r.metadataPointer-this.tokenizer.position-e),(new o.ID3v2Parser).parse(this.metadata,this.tokenizer,this.options);u("No ID3v2 tag present")}async parseChunks(e){for(;e>=s.ChunkHeader.len;){const t=await this.tokenizer.readToken(s.ChunkHeader);switch(u(`Parsing chunk name=${t.id} size=${t.size}`),t.id){case"fmt ":const e=await this.tokenizer.readToken(s.FormatChunk);this.metadata.setFormat("numberOfChannels",e.channelNum),this.metadata.setFormat("sampleRate",e.samplingFrequency),this.metadata.setFormat("bitsPerSample",e.bitsPerSample),this.metadata.setFormat("numberOfSamples",e.sampleCount),this.metadata.setFormat("duration",e.sampleCount/e.samplingFrequency);const r=e.bitsPerSample*e.samplingFrequency*e.channelNum;return void this.metadata.setFormat("bitrate",r);default:this.tokenizer.ignore(t.size-s.ChunkHeader.len)}e-=t.size}}}t.DsfParser=l},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=r(37),n=r(75);t.ChunkHeader={len:12,get:(e,t)=>({id:n.FourCcToken.get(e,t),size:i.UINT64_LE.get(e,t+4)})},t.DsdChunk={len:16,get:(e,t)=>({fileSize:i.INT64_LE.get(e,t),metadataPointer:i.INT64_LE.get(e,t+8)})},function(e){e[e.mono=1]="mono",e[e.stereo=2]="stereo",e[e.channels=3]="channels",e[e.quad=4]="quad",e[e["4 channels"]=5]="4 channels",e[e["5 channels"]=6]="5 channels",e[e["5.1 channels"]=7]="5.1 channels"}(t.ChannelType||(t.ChannelType={})),t.FormatChunk={len:40,get:(e,t)=>({formatVersion:i.INT32_LE.get(e,t),formatID:i.INT32_LE.get(e,t+4),channelType:i.INT32_LE.get(e,t+8),channelNum:i.INT32_LE.get(e,t+12),samplingFrequency:i.INT32_LE.get(e,t+16),bitsPerSample:i.INT32_LE.get(e,t+20),sampleCount:i.INT64_LE.get(e,t+24),blockSizePerChannel:i.INT32_LE.get(e,t+32)})}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=r(70),n=r(37),a=r(52),s=r(75),o=r(82),u=r(305),l=r(620),h=r(102),c=r(125),f=a("music-metadata:parser:aiff");class d extends o.BasicParser{async parse(){const e=await this.tokenizer.readToken(l.ChunkHeader);i.strictEqual(e.chunkID,"FRM8");const t=(await this.tokenizer.readToken(s.FourCcToken)).trim();switch(t){case"DSD":return this.metadata.setFormat("container","DSDIFF/"+t),this.metadata.setFormat("lossless",!0),this.readFmt8Chunks(e.chunkSize-s.FourCcToken.len);default:throw Error("Unsupported DSDIFF type: "+t)}}async readFmt8Chunks(e){for(;e>=l.ChunkHeader.len;){const t=await this.tokenizer.readToken(l.ChunkHeader);f("Chunk id="+t.chunkID),await this.readData(t),e-=l.ChunkHeader.len+t.chunkSize}}async readData(e){f(`Reading data of chunk[ID=${e.chunkID}, size=${e.chunkSize}]`);const t=this.tokenizer.position;switch(e.chunkID.trim()){case"FVER":const t=await this.tokenizer.readToken(n.UINT32_LE);f("DSDIFF version="+t);break;case"PROP":const r=await this.tokenizer.readToken(s.FourCcToken);i.strictEqual(r,"SND "),await this.handleSoundPropertyChunks(e.chunkSize-s.FourCcToken.len);break;case"ID3":const a=await this.tokenizer.readToken(new n.BufferType(e.chunkSize)),o=new u.ID3Stream(a),l=h.fromStream(o);await(new c.ID3v2Parser).parse(this.metadata,l,this.options);break;default:f(`Ignore chunk[ID=${e.chunkID}, size=${e.chunkSize}]`);break;case"DSD":this.metadata.setFormat("numberOfSamples",8*e.chunkSize/this.metadata.format.numberOfChannels),this.metadata.setFormat("duration",this.metadata.format.numberOfSamples/this.metadata.format.sampleRate)}const r=e.chunkSize-(this.tokenizer.position-t);r>0&&(f(`After Parsing chunk, remaining ${r} bytes`),await this.tokenizer.ignore(r))}async handleSoundPropertyChunks(e){for(f("Parsing sound-property-chunks, remainingSize="+e);e>0;){const t=await this.tokenizer.readToken(l.ChunkHeader);f(`Sound-property-chunk[ID=${t.chunkID}, size=${t.chunkSize}]`);const r=this.tokenizer.position;switch(t.chunkID.trim()){case"FS":const e=await this.tokenizer.readToken(n.UINT32_BE);this.metadata.setFormat("sampleRate",e);break;case"CHNL":const r=await this.tokenizer.readToken(n.UINT16_BE);this.metadata.setFormat("numberOfChannels",r),await this.handleChannelChunks(t.chunkSize-n.UINT16_BE.len);break;case"CMPR":const i=(await this.tokenizer.readToken(s.FourCcToken)).trim(),a=await this.tokenizer.readToken(n.UINT8),o=await this.tokenizer.readToken(new n.StringType(a,"ascii"));"DSD"===i&&(this.metadata.setFormat("lossless",!0),this.metadata.setFormat("bitsPerSample",1)),this.metadata.setFormat("codec",`${i} (${o})`);break;case"ABSS":const u=await this.tokenizer.readToken(n.UINT16_BE),l=await this.tokenizer.readToken(n.UINT8),h=await this.tokenizer.readToken(n.UINT8),c=await this.tokenizer.readToken(n.UINT32_BE);f(`ABSS ${u}:${l}:${h}.${c}`);break;case"LSCO":const d=await this.tokenizer.readToken(n.UINT16_BE);f("LSCO lsConfig="+d);break;case"COMT":default:f(`Unknown sound-property-chunk[ID=${t.chunkID}, size=${t.chunkSize}]`),await this.tokenizer.ignore(t.chunkSize)}const i=t.chunkSize-(this.tokenizer.position-r);i>0&&(f(`After Parsing sound-property-chunk ${t.chunkSize}, remaining ${i} bytes`),await this.tokenizer.ignore(i)),e-=l.ChunkHeader.len+t.chunkSize,f("Parsing sound-property-chunks, remainingSize="+e)}if(this.metadata.format.lossless&&this.metadata.format.sampleRate&&this.metadata.format.numberOfChannels&&this.metadata.format.bitsPerSample){const e=this.metadata.format.sampleRate*this.metadata.format.numberOfChannels*this.metadata.format.bitsPerSample;this.metadata.setFormat("bitrate",e)}}async handleChannelChunks(e){f("Parsing channel-chunks, remainingSize="+e);const t=[];for(;e>=s.FourCcToken.len;){const r=await this.tokenizer.readToken(s.FourCcToken);f(`Channel[ID=${r}]`),t.push(r),e-=s.FourCcToken.len}return f("Channels: "+t.join(", ")),t}}t.DsdiffParser=d},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=r(37),n=r(75);t.ChunkHeader={len:12,get:(e,t)=>({chunkID:n.FourCcToken.get(e,t),chunkSize:i.INT64_BE.get(e,t+4)})}},function(e,t,r){"use strict";(function(e){Object.defineProperty(t,"__esModule",{value:!0});const i=r(37),n=r(52),a=r(82),s=r(357),o=r(622),u=n("music-metadata:parser:matroska");class l extends a.BasicParser{constructor(){super(),this.padding=0,this.parserMap=new Map,this.parserMap.set(s.DataType.uint,e=>this.readUint(e)),this.parserMap.set(s.DataType.string,e=>this.readString(e)),this.parserMap.set(s.DataType.binary,e=>this.readBuffer(e)),this.parserMap.set(s.DataType.uid,async e=>1===await this.readUint(e)),this.parserMap.set(s.DataType.bool,e=>this.readFlag(e)),this.parserMap.set(s.DataType.float,e=>this.readFloat(e))}init(e,t,r){return super.init(e,t,r),this}async parse(){const e=await this.parseContainer(o.elements,this.tokenizer.fileSize,[]);if(this.metadata.setFormat("container","EBML/"+e.ebml.docType),e.segment){const t=e.segment.info;if(t){const e=t.timecodeScale?t.timecodeScale:1e6,r=t.duration*e/1e9;this.metadata.setFormat("duration",r)}const r=e.segment.tracks;if(r&&r.entries){const t=r.entries.filter(e=>e.trackType===s.TrackType.audio.valueOf()).reduce((e,t)=>e?!e.flagDefault&&t.flagDefault||t.trackNumber&&t.trackNumber{const t=e.target,r=t.targetTypeValue?s.TargetType[t.targetTypeValue]:t.targetType?t.targetType:s.TargetType.album;e.simpleTags.forEach(e=>{const t=e.string?e.string:e.binary;this.addTag(`${r}:${e.name}`,t)})})}}}async parseContainer(e,t,r){const i={};for(;this.tokenizer.position>=1;const a=e.alloc(n);return await this.tokenizer.readBuffer(a),a}async readElement(){const e=await this.readVintData(),t=await this.readVintData();t[0]^=128>>t.length-1;const r=Math.min(6,t.length);return{id:e.readUIntBE(0,e.length),len:t.readUIntBE(t.length-r,r)}}async readFloat(e){switch(e.len){case 0:return 0;case 4:return this.tokenizer.readNumber(i.Float32_BE);case 8:case 10:return this.tokenizer.readNumber(i.Float64_BE);default:throw new Error("Invalid IEEE-754 float length: "+e.len)}}async readFlag(e){return 1===await this.readUint(e)}async readUint(e){const t=await this.readBuffer(e),r=Math.min(6,e.len);return t.readUIntBE(e.len-r,r)}async readString(e){return this.tokenizer.readToken(new i.StringType(e.len,"utf-8"))}async readBuffer(t){const r=e.alloc(t.len);return await this.tokenizer.readBuffer(r),r}addTag(e,t){this.metadata.addTag("matroska",e,t)}}t.MatroskaParser=l}).call(this,r(51).Buffer)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=r(357);t.elements={440786851:{name:"ebml",container:{17030:{name:"ebmlVersion",value:i.DataType.uint},17143:{name:"ebmlReadVersion",value:i.DataType.uint},17138:{name:"ebmlMaxIDWidth",value:i.DataType.uint},17139:{name:"ebmlMaxSizeWidth",value:i.DataType.uint},17026:{name:"docType",value:i.DataType.string},17031:{name:"docTypeVersion",value:i.DataType.uint},17029:{name:"docTypeReadVersion",value:i.DataType.uint}}},408125543:{name:"segment",container:{290298740:{name:"seekHead",container:{19899:{name:"seek",container:{21419:{name:"seekId",value:i.DataType.binary},21420:{name:"seekPosition",value:i.DataType.uint}}}}},357149030:{name:"info",container:{29604:{name:"uid",value:i.DataType.uid},29572:{name:"filename",value:i.DataType.string},3979555:{name:"prevUID",value:i.DataType.uid},3965867:{name:"prevFilename",value:i.DataType.string},4110627:{name:"nextUID",value:i.DataType.uid},4096955:{name:"nextFilename",value:i.DataType.string},2807729:{name:"timecodeScale",value:i.DataType.uint},17545:{name:"duration",value:i.DataType.float},17505:{name:"dateUTC",value:i.DataType.uint},31657:{name:"title",value:i.DataType.string},19840:{name:"muxingApp",value:i.DataType.string},22337:{name:"writingApp",value:i.DataType.string}}},524531317:{name:"cluster",multiple:!0,container:{231:{name:"timecode",value:i.DataType.uid},163:{name:"unknown",value:i.DataType.binary},167:{name:"position",value:i.DataType.uid},171:{name:"prevSize",value:i.DataType.uid}}},374648427:{name:"tracks",container:{174:{name:"entries",multiple:!0,container:{215:{name:"trackNumber",value:i.DataType.uint},29637:{name:"uid",value:i.DataType.uid},131:{name:"trackType",value:i.DataType.uint},185:{name:"flagEnabled",value:i.DataType.bool},136:{name:"flagDefault",value:i.DataType.bool},21930:{name:"flagForced",value:i.DataType.bool},156:{name:"flagLacing",value:i.DataType.bool},28135:{name:"minCache",value:i.DataType.uint},28136:{name:"maxCache",value:i.DataType.uint},2352003:{name:"defaultDuration",value:i.DataType.uint},2306383:{name:"timecodeScale",value:i.DataType.float},21358:{name:"name",value:i.DataType.string},2274716:{name:"language",value:i.DataType.string},134:{name:"codecID",value:i.DataType.string},25506:{name:"codecPrivate",value:i.DataType.binary},2459272:{name:"codecName",value:i.DataType.string},3839639:{name:"codecSettings",value:i.DataType.string},3883072:{name:"codecInfoUrl",value:i.DataType.string},2536e3:{name:"codecDownloadUrl",value:i.DataType.string},170:{name:"codecDecodeAll",value:i.DataType.bool},28587:{name:"trackOverlay",value:i.DataType.uint},224:{name:"video",container:{154:{name:"flagInterlaced",value:i.DataType.bool},21432:{name:"stereoMode",value:i.DataType.uint},176:{name:"pixelWidth",value:i.DataType.uint},186:{name:"pixelHeight",value:i.DataType.uint},21680:{name:"displayWidth",value:i.DataType.uint},21690:{name:"displayHeight",value:i.DataType.uint},21683:{name:"aspectRatioType",value:i.DataType.uint},3061028:{name:"colourSpace",value:i.DataType.uint},3126563:{name:"gammaValue",value:i.DataType.float}}},225:{name:"audio",container:{181:{name:"samplingFrequency",value:i.DataType.float},30901:{name:"outputSamplingFrequency",value:i.DataType.float},159:{name:"channels",value:i.DataType.uint},148:{name:"channels",value:i.DataType.uint},32123:{name:"channelPositions",value:i.DataType.binary},25188:{name:"bitDepth",value:i.DataType.uint}}},28032:{name:"contentEncodings",container:{25152:{name:"contentEncoding",container:{20529:{name:"order",value:i.DataType.uint},20530:{name:"scope",value:i.DataType.bool},20531:{name:"type",value:i.DataType.uint},20532:{name:"contentEncoding",container:{16980:{name:"contentCompAlgo",value:i.DataType.uint},16981:{name:"contentCompSettings",value:i.DataType.binary}}},20533:{name:"contentEncoding",container:{18401:{name:"contentEncAlgo",value:i.DataType.uint},18402:{name:"contentEncKeyID",value:i.DataType.binary},18403:{name:"contentSignature ",value:i.DataType.binary},18404:{name:"ContentSigKeyID ",value:i.DataType.binary},18405:{name:"contentSigAlgo ",value:i.DataType.uint},18406:{name:"contentSigHashAlgo ",value:i.DataType.uint}}},25188:{name:"bitDepth",value:i.DataType.uint}}}}}}}}},475249515:{name:"cues",container:{187:{name:"cuePoint",container:{179:{name:"cueTime",value:i.DataType.uid},183:{name:"positions",container:{247:{name:"track",value:i.DataType.uint},241:{name:"clusterPosition",value:i.DataType.uint},21368:{name:"blockNumber",value:i.DataType.uint},234:{name:"codecState",value:i.DataType.uint},219:{name:"reference",container:{150:{name:"time",value:i.DataType.uint},151:{name:"cluster",value:i.DataType.uint},21343:{name:"number",value:i.DataType.uint},235:{name:"codecState",value:i.DataType.uint}}},240:{name:"relativePosition",value:i.DataType.uint}}}}}}},423732329:{name:"attachments",container:{24999:{name:"attachedFile",container:{18046:{name:"description",value:i.DataType.uid},18030:{name:"name",value:i.DataType.string},18016:{name:"mimeType",value:i.DataType.string},18012:{name:"data",value:i.DataType.binary},18094:{name:"uid",value:i.DataType.uid}}}}},272869232:{name:"chapters",container:{17849:{name:"editionEntry",container:{182:{name:"chapterAtom",container:{29636:{name:"uid",value:i.DataType.uid},145:{name:"timeStart",value:i.DataType.uint},146:{name:"timeEnd",value:i.DataType.uid},152:{name:"hidden",value:i.DataType.bool},17816:{name:"enabled",value:i.DataType.uid},143:{name:"track",container:{137:{name:"trackNumber",value:i.DataType.uid},128:{name:"display",container:{133:{name:"string",value:i.DataType.string},17276:{name:"language ",value:i.DataType.string},17278:{name:"country ",value:i.DataType.string}}}}}}}}}}},307544935:{name:"tags",container:{29555:{name:"tag",multiple:!0,container:{25536:{name:"target",container:{25541:{name:"tagTrackUID",value:i.DataType.uid},25540:{name:"tagChapterUID",value:i.DataType.uint},25542:{name:"tagAttachmentUID",value:i.DataType.uid},25546:{name:"targetType",value:i.DataType.string},26826:{name:"targetTypeValue",value:i.DataType.uint},25545:{name:"tagEditionUID",value:i.DataType.uid}}},26568:{name:"simpleTags",multiple:!0,container:{17827:{name:"name",value:i.DataType.string},17543:{name:"string",value:i.DataType.string},17541:{name:"binary",value:i.DataType.binary},17530:{name:"language",value:i.DataType.string},17531:{name:"languageIETF",value:i.DataType.string},17540:{name:"default",value:i.DataType.bool}}}}}}}}}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.RandomBufferReader=class{constructor(e){this.buf=e,this.fileSize=e.length}async randomRead(e,t,r,i){return this.buf.copy(e,t,i,i+r)}}},function(e,t,r){"use strict";(function(e){Object.defineProperty(t,"__esModule",{value:!0}),t.endTag2="LYRICS200",t.getLyricsHeaderLength=async function(r){if(r.fileSize>=143){const i=e.alloc(15);await r.randomRead(i,0,i.length,r.fileSize-143);const n=i.toString("binary");if(n.substr(6)===t.endTag2)return parseInt(n.substr(0,6),10)+15}return 0}}).call(this,r(51).Buffer)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=r(347);class n extends i.Readable{constructor(e){super(),this.bytesRead=0,this.released=!1,this.reader=e.getReader()}async _read(){if(this.released)return void this.push(null);this.pendingRead=this.reader.read();const e=await this.pendingRead;delete this.pendingRead,e.done||this.released?this.push(null):(this.bytesRead+=e.value.length,this.push(e.value))}async waitForReadToComplete(){this.pendingRead&&await this.pendingRead}async close(){await this.syncAndRelease()}async syncAndRelease(){this.released=!0,await this.waitForReadToComplete(),await this.reader.releaseLock()}}t.ReadableWebToNodeStream=n},function(e,t,r){(function(t){var i=r(627).strict;e.exports=function(e){if(i(e)){var r=t.from(e.buffer);return e.byteLength!==e.buffer.byteLength&&(r=r.slice(e.byteOffset,e.byteOffset+e.byteLength)),r}return t.from(e)}}).call(this,r(51).Buffer)},function(e,t){e.exports=n,n.strict=a,n.loose=s;var r=Object.prototype.toString,i={"[object Int8Array]":!0,"[object Int16Array]":!0,"[object Int32Array]":!0,"[object Uint8Array]":!0,"[object Uint8ClampedArray]":!0,"[object Uint16Array]":!0,"[object Uint32Array]":!0,"[object Float32Array]":!0,"[object Float64Array]":!0};function n(e){return a(e)||s(e)}function a(e){return e instanceof Int8Array||e instanceof Int16Array||e instanceof Int32Array||e instanceof Uint8Array||e instanceof Uint8ClampedArray||e instanceof Uint16Array||e instanceof Uint32Array||e instanceof Float32Array||e instanceof Float64Array}function s(e){return i[r.call(e)]}}])); \ No newline at end of file diff --git a/public/js/ilab-media-grid.js b/public/js/ilab-media-grid.js index 9dc94391..048855cc 100755 --- a/public/js/ilab-media-grid.js +++ b/public/js/ilab-media-grid.js @@ -1 +1 @@ -!function(e){var t={};function n(i){if(t[i])return t[i].exports;var o=t[i]={i:i,l:!1,exports:{}};return e[i].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,i){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(i,o,function(t){return e[t]}.bind(null,o));return i},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="/",n(n.s=191)}({191:function(e,t,n){n(192),n(548),n(554),n(556),e.exports=n(560)},192:function(e,t){function n(e,t,n){return t>=e.left&&t<=e.right&&n>=e.top&&n<=e.bottom}!function(e){var t=function(){e(".info-panel-tabs").each((function(){var t=e(this),n=null,i=null;t.find("li").each((function(){var t=e(this),o=e("#"+t.data("tab-target"));t.hasClass("active")&&(n=t,i=o),t.on("click",(function(e){n!=t&&(n.removeClass("active"),i.css({display:"none"}),t.addClass("active"),o.css({display:""}),n=t,i=o)}))}))}));var t=null;e(".info-file-info-size").each((function(){t||(t=e(this))})),e("#ilab-other-sizes").on("change",(function(n){var i=e("#info-size-"+e(this).val());i!=t&&(t.css({display:"none"}),i.css({display:""}),t=i)})),e(".ilab-info-regenerate-thumbnails").on("click",(function(t){var n=e(this);return n.data("imgix-enabled")&&!confirm("You are currently using Imgix, which makes this function rather unnecessary. Are you sure you want to continue?")||(e(document).trigger("ilab-regeneration-started"),t.preventDefault(),n.css({display:"none"}),e("#ilab-info-regenerate-status").css({display:""}),e.post(ajaxurl,{action:"ilab_regenerate_thumbnails_manual",post_id:n.data("post-id")},(function(t){n.css({display:""}),e("#ilab-info-regenerate-status").css({display:"none"}),"success"!=t.status&&alert("There was a problem trying to regenerate the thumbnails. Please try again."),e(document).trigger("ilab-regeneration-ended")}))),!1}))};t();var i=!0,o=!0,a=e('
'),s=e(''),r=e('
'),l=e('
'),u=e('
'),d=null,c=!1,f=0,p=function(){if(i){var n=e(this),o=n.data("post-id");n.data("mime-type").startsWith("image")?s.removeClass("ilab-popup-document"):s.addClass("ilab-popup-document"),c=!1,e("li.attachment").each((function(){var t=e(this);t.data("id")==o?(t.removeClass("info-unfocused"),t.addClass("info-focused")):(t.removeClass("info-focused"),t.addClass("info-unfocused"))})),r.text(""),r.append(a);var f=this.getBoundingClientRect(),p=document.body.scrollTop+(f.top+f.height/2-s.height()/2);p-=28;var m=Math.max(document.documentElement.clientHeight,window.innerHeight||0),h=Math.max(document.documentElement.clientWidth,window.innerWidth||0),g=document.body.scrollTop+m-40,v=0;p+s.height()>g?(v=p+s.height()-g,p=g-s.height()):p=e.left&&t<=e.right&&n>=e.top&&n<=e.bottom}!function(e){var t=function(){e(".info-panel-tabs").each((function(){var t=e(this),n=null,i=null;t.find("li").each((function(){var t=e(this),o=e("#"+t.data("tab-target"));t.hasClass("active")&&(n=t,i=o),t.on("click",(function(e){n!=t&&(n.removeClass("active"),i.css({display:"none"}),t.addClass("active"),o.css({display:""}),n=t,i=o)}))}))}));var t=null;e(".info-file-info-size").each((function(){t||(t=e(this))})),e("#ilab-other-sizes").on("change",(function(n){var i=e("#info-size-"+e(this).val());i!=t&&(t.css({display:"none"}),i.css({display:""}),t=i)})),e(".ilab-info-regenerate-thumbnails").on("click",(function(t){var n=e(this);return n.data("imgix-enabled")&&!confirm("You are currently using Imgix, which makes this function rather unnecessary. Are you sure you want to continue?")||(e(document).trigger("ilab-regeneration-started"),t.preventDefault(),n.css({display:"none"}),e("#ilab-info-regenerate-status").css({display:""}),e.post(ajaxurl,{action:"ilab_regenerate_thumbnails_manual",post_id:n.data("post-id")},(function(t){n.css({display:""}),e("#ilab-info-regenerate-status").css({display:"none"}),"success"!=t.status&&alert("There was a problem trying to regenerate the thumbnails. Please try again."),e(document).trigger("ilab-regeneration-ended")}))),!1}))};t();var i=!0,o=!0,a=e('
'),s=e(''),r=e('
'),l=e('
'),u=e('
'),d=null,c=!1,f=0,p=function(){if(i){var n=e(this),o=n.data("post-id");n.data("mime-type").startsWith("image")?s.removeClass("ilab-popup-document"):s.addClass("ilab-popup-document"),c=!1,e("li.attachment").each((function(){var t=e(this);t.data("id")==o?(t.removeClass("info-unfocused"),t.addClass("info-focused")):(t.removeClass("info-focused"),t.addClass("info-unfocused"))})),r.text(""),r.append(a);var f=this.getBoundingClientRect(),p=document.body.scrollTop+(f.top+f.height/2-s.height()/2);p-=28;var m=Math.max(document.documentElement.clientHeight,window.innerHeight||0),h=Math.max(document.documentElement.clientWidth,window.innerWidth||0),g=document.body.scrollTop+m-40,v=0;p+s.height()>g?(v=p+s.height()-g,p=g-s.height()):p>4&15]+e[15&t]}}}},302:function(t,e,i){t.exports=i(303)},303:function(t,e,i){"use strict";i(304),i(306),jQuery(document).ready((function(t){t("ul#adminmenu a[href$='https://talk.mediacloud.press']").attr("target","_blank"),t("ul#adminmenu a[href$='https://help.mediacloud.press']").attr("target","_blank"),t(".ilab_ajax_admin_item").each((function(){var e=t(this).find("input[name=nonce]").val(),i=t(this).find("input[name=action]").val();t(this).on("click",(function(a){a.preventDefault();var n={action:i,nonce:e};return t.post(ajaxurl,n,(function(t){t.hasOwnProperty("message")?alert(t.message):document.location.reload()})),!1}))}))}))},304:function(t,e,i){"use strict";i(305),window.ILabCrop=function(t,e){this.settings=e,this.modalContainer=t("#ilabm-container-"+e.modal_id),this.cropper=this.modalContainer.find(".ilabc-cropper"),this.cropperData={},this.modal_id=e.modal_id,this.aspectCheckboxContainer=t("#ilab-crop-aspect-checkbox-container"),this.aspectCheckboxContainer.css({visibility:"hidden"});var i=this;t("#ilab-crop-aspect-checkbox").on("change",(function(t){i.settings.isCrop||(this.checked?i.cropper.cropper("setAspectRatio",i.settings.aspect_ratio):i.cropper.cropper("setAspectRatio",Number.NaN))})),this.modalContainer.find(".ilabm-editor-tabs").ilabTabs({currentValue:this.settings.size,tabSelected:function(t){ILabModal.loadURL(t.data("url"),!0,function(t){this.bindUI(t)}.bind(this))}.bind(this)}),this.modalContainer.find(".ilabc-button-crop").on("click",function(t){return t.preventDefault(),this.crop(),!1}.bind(this)),this.modalContainer.find(".ilabc-button-reset-crop").on("click",function(t){return t.preventDefault(),this.resetCrop(),!1}.bind(this)),this.updatePreviewWidth=function(){var t=this.modalContainer.find(".ilab-crop-preview-title").width();this.modalContainer.find(".ilab-crop-preview").css({height:t/this.settings.aspect_ratio+"px",width:t+"px"})}.bind(this),this.bindUI=function(e){if(this.settings=e,e.isCrop?this.aspectCheckboxContainer.css({visibility:"hidden"}):this.aspectCheckboxContainer.css({visibility:"visible"}),this.cropper.cropper("destroy"),this.cropper.off("built.cropper"),e.hasOwnProperty("cropped_src")&&null!==e.cropped_src&&this.modalContainer.find(".ilab-current-crop-img").attr("src",e.cropped_src),e.hasOwnProperty("size_title")&&null!==e.size_title&&this.modalContainer.find(".ilabc-crop-size-title").text("Current "+e.size_title+" ("+e.min_width+" x "+e.min_height+")"),void 0!==e.aspect_ratio){if(this.updatePreviewWidth(),void 0!==e.prev_crop_x&&null!==e.prev_crop_x)this.cropperData={x:e.prev_crop_x,y:e.prev_crop_y,width:e.prev_crop_width,height:e.prev_crop_height};else if(2==e.crop_axis.length){var i=0,a=0;"center"==e.crop_axis[0]?i=e.image_width/2-e.real_crop_width/2:"right"==e.crop_axis[0]&&(i=e.image_width-e.real_crop_width),"center"==e.crop_axis[1]?a=e.image_height/2-e.real_crop_height/2:"right"==e.crop_axis[1]&&(a=e.image_height-e.real_crop_height),this.cropperData={x:i,y:a,width:e.real_crop_width,height:e.real_crop_height}}var n=e.aspect_ratio;e.isCrop||t("#ilab-crop-aspect-checkbox")[0].checked||(n=Number.NaN),this.cropper.on("built.cropper",function(){this.updatePreviewWidth()}.bind(this)).on("crop.cropper",(function(t){})).cropper({viewMode:1,dragMode:"none",aspectRatio:n,minWidth:e.min_width,minHeight:e.min_height,modal:!0,movable:!1,cropBoxMovable:!0,zoomable:!1,zoomOnWheel:!1,zoomOnTouch:!1,autoCropArea:1,data:this.cropperData,checkImageOrigin:!1,checkCrossOrigin:!1,responsive:!0,restore:!0,preview:"#ilabm-container-"+this.modal_id+" .ilab-crop-preview"})}}.bind(this),this.crop=function(){this.displayStatus("Saving crop ...");var t=this.cropper.cropper("getData");t.action="ilab_perform_crop",t.post=this.settings.image_id,t.size=this.settings.size,jQuery.post(ajaxurl,t,function(t){var e=this.modalContainer.find(".ilab-current-crop-img");"ok"==t.status?e.attr("src")==t.src?this.hideStatus():(e.one("load",function(){this.hideStatus()}.bind(this)),e.attr("src",t.src),wp.media.model.Attachments.all._byId[this.settings.image_id].get("sizes")[this.settings.size].url=t.src):this.hideStatus()}.bind(this))}.bind(this),this.resetCrop=function(){this.displayStatus("Resetting crop ..."),this.cropper.cropper("reset");var t=this.cropper.cropper("getData");t.action="ilab_reset_crop",t.post=this.settings.image_id,t.size=this.settings.size,jQuery.post(ajaxurl,t,function(t){var e=this.modalContainer.find(".ilab-current-crop-img");"ok"==t.status?e.attr("src")==t.src?this.hideStatus():(e.one("load",function(){this.hideStatus()}.bind(this)),e.attr("src",t.src),wp.media.model.Attachments.all._byId[this.settings.image_id].get("sizes")[this.settings.size].url=t.src):this.hideStatus()}.bind(this))}.bind(this),this.displayStatus=function(t){this.modalContainer.find(".ilabm-status-label").text(t),this.modalContainer.find(".ilabm-status-container").removeClass("is-hidden")}.bind(this),this.hideStatus=function(){this.modalContainer.find(".ilabm-status-container").addClass("is-hidden")}.bind(this),this.bindUI(e)}},305:function(t,e,i){var a,n,o,s;function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)} +!function(t){var e={};function i(a){if(e[a])return e[a].exports;var n=e[a]={i:a,l:!1,exports:{}};return t[a].call(n.exports,n,n.exports,i),n.l=!0,n.exports}i.m=t,i.c=e,i.d=function(t,e,a){i.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:a})},i.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.t=function(t,e){if(1&e&&(t=i(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var a=Object.create(null);if(i.r(a),Object.defineProperty(a,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var n in t)i.d(a,n,function(e){return t[e]}.bind(null,n));return a},i.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(e,"a",e),e},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.p="/",i(i.s=640)}({114:function(t,e,i){"use strict";window.ImgixComponents={utilities:{byteToHex:function(t){var e=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F"];return e[t>>4&15]+e[15&t]}}}},310:function(t,e){t.exports=jQuery},640:function(t,e,i){t.exports=i(641)},641:function(t,e,i){"use strict";i(642),i(644),jQuery(document).ready((function(t){t("ul#adminmenu a[href$='https://talk.mediacloud.press']").attr("target","_blank"),t("ul#adminmenu a[href$='https://help.mediacloud.press']").attr("target","_blank"),t(".ilab_ajax_admin_item").each((function(){var e=t(this).find("input[name=nonce]").val(),i=t(this).find("input[name=action]").val();t(this).on("click",(function(a){a.preventDefault();var n={action:i,nonce:e};return t.post(ajaxurl,n,(function(t){t.hasOwnProperty("message")?alert(t.message):document.location.reload()})),!1}))}))}))},642:function(t,e,i){"use strict";i(643),window.ILabCrop=function(t,e){this.settings=e,this.modalContainer=t("#ilabm-container-"+e.modal_id),this.cropper=this.modalContainer.find(".ilabc-cropper"),this.cropperData={},this.modal_id=e.modal_id,this.aspectCheckboxContainer=t("#ilab-crop-aspect-checkbox-container"),this.aspectCheckboxContainer.css({visibility:"hidden"});var i=this;t("#ilab-crop-aspect-checkbox").on("change",(function(t){i.settings.isCrop||(this.checked?i.cropper.cropper("setAspectRatio",i.settings.aspect_ratio):i.cropper.cropper("setAspectRatio",Number.NaN))})),this.modalContainer.find(".ilabm-editor-tabs").ilabTabs({currentValue:this.settings.size,tabSelected:function(t){ILabModal.loadURL(t.data("url"),!0,function(t){this.bindUI(t)}.bind(this))}.bind(this)}),this.modalContainer.find(".ilabc-button-crop").on("click",function(t){return t.preventDefault(),this.crop(),!1}.bind(this)),this.modalContainer.find(".ilabc-button-reset-crop").on("click",function(t){return t.preventDefault(),this.resetCrop(),!1}.bind(this)),this.updatePreviewWidth=function(){var t=this.modalContainer.find(".ilab-crop-preview-title").width();this.modalContainer.find(".ilab-crop-preview").css({height:t/this.settings.aspect_ratio+"px",width:t+"px"})}.bind(this),this.bindUI=function(e){if(this.settings=e,e.isCrop?this.aspectCheckboxContainer.css({visibility:"hidden"}):this.aspectCheckboxContainer.css({visibility:"visible"}),this.cropper.cropper("destroy"),this.cropper.off("built.cropper"),e.hasOwnProperty("cropped_src")&&null!==e.cropped_src&&this.modalContainer.find(".ilab-current-crop-img").attr("src",e.cropped_src),e.hasOwnProperty("size_title")&&null!==e.size_title&&this.modalContainer.find(".ilabc-crop-size-title").text("Current "+e.size_title+" ("+e.min_width+" x "+e.min_height+")"),void 0!==e.aspect_ratio){if(this.updatePreviewWidth(),void 0!==e.prev_crop_x&&null!==e.prev_crop_x)this.cropperData={x:e.prev_crop_x,y:e.prev_crop_y,width:e.prev_crop_width,height:e.prev_crop_height};else if(2==e.crop_axis.length){var i=0,a=0;"center"==e.crop_axis[0]?i=e.image_width/2-e.real_crop_width/2:"right"==e.crop_axis[0]&&(i=e.image_width-e.real_crop_width),"center"==e.crop_axis[1]?a=e.image_height/2-e.real_crop_height/2:"right"==e.crop_axis[1]&&(a=e.image_height-e.real_crop_height),this.cropperData={x:i,y:a,width:e.real_crop_width,height:e.real_crop_height}}var n=e.aspect_ratio;e.isCrop||t("#ilab-crop-aspect-checkbox")[0].checked||(n=Number.NaN),this.cropper.on("built.cropper",function(){this.updatePreviewWidth()}.bind(this)).on("crop.cropper",(function(t){})).cropper({viewMode:1,dragMode:"none",aspectRatio:n,minWidth:e.min_width,minHeight:e.min_height,modal:!0,movable:!1,cropBoxMovable:!0,zoomable:!1,zoomOnWheel:!1,zoomOnTouch:!1,autoCropArea:1,data:this.cropperData,checkImageOrigin:!1,checkCrossOrigin:!1,responsive:!0,restore:!0,preview:"#ilabm-container-"+this.modal_id+" .ilab-crop-preview"})}}.bind(this),this.crop=function(){this.displayStatus("Saving crop ...");var t=this.cropper.cropper("getData");t.action="ilab_perform_crop",t.post=this.settings.image_id,t.size=this.settings.size,jQuery.post(ajaxurl,t,function(t){var e=this.modalContainer.find(".ilab-current-crop-img");"ok"==t.status?e.attr("src")==t.src?this.hideStatus():(e.one("load",function(){this.hideStatus()}.bind(this)),e.attr("src",t.src),wp.media.model.Attachments.all._byId[this.settings.image_id].get("sizes")[this.settings.size].url=t.src):this.hideStatus()}.bind(this))}.bind(this),this.resetCrop=function(){this.displayStatus("Resetting crop ..."),this.cropper.cropper("reset");var t=this.cropper.cropper("getData");t.action="ilab_reset_crop",t.post=this.settings.image_id,t.size=this.settings.size,jQuery.post(ajaxurl,t,function(t){var e=this.modalContainer.find(".ilab-current-crop-img");"ok"==t.status?e.attr("src")==t.src?this.hideStatus():(e.one("load",function(){this.hideStatus()}.bind(this)),e.attr("src",t.src),wp.media.model.Attachments.all._byId[this.settings.image_id].get("sizes")[this.settings.size].url=t.src):this.hideStatus()}.bind(this))}.bind(this),this.displayStatus=function(t){this.modalContainer.find(".ilabm-status-label").text(t),this.modalContainer.find(".ilabm-status-container").removeClass("is-hidden")}.bind(this),this.hideStatus=function(){this.modalContainer.find(".ilabm-status-container").addClass("is-hidden")}.bind(this),this.bindUI(e)}},643:function(t,e,i){var a,n,o,s;function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)} /*! * Cropper v4.0.0 * https://github.com/fengyuanchen/cropper @@ -7,4 +7,4 @@ * Released under the MIT license * * Date: 2018-04-01T06:27:27.267Z - */s=function(t){"use strict";t=t&&t.hasOwnProperty("default")?t.default:t;var e="undefined"!=typeof window,i=e?window:{},a="cropper-hidden",n=i.PointerEvent?"pointerdown":"touchstart mousedown",o=i.PointerEvent?"pointermove":"touchmove mousemove",s=i.PointerEvent?"pointerup pointercancel":"touchend touchcancel mouseup",h=/^(?:e|w|s|n|se|sw|ne|nw|all|crop|move|zoom)$/,c=/^data:/,l=/^data:image\/jpeg;base64,/,d=/^(?:img|canvas)$/i,p={viewMode:0,dragMode:"crop",aspectRatio:NaN,data:null,preview:"",responsive:!0,restore:!0,checkCrossOrigin:!0,checkOrientation:!0,modal:!0,guides:!0,center:!0,highlight:!0,background:!0,autoCrop:!0,autoCropArea:.8,movable:!0,rotatable:!0,scalable:!0,zoomable:!0,zoomOnTouch:!0,zoomOnWheel:!0,wheelZoomRatio:.1,cropBoxMovable:!0,cropBoxResizable:!0,toggleDragModeOnDblclick:!0,minCanvasWidth:0,minCanvasHeight:0,minCropBoxWidth:0,minCropBoxHeight:0,minContainerWidth:200,minContainerHeight:100,ready:null,cropstart:null,cropmove:null,cropend:null,crop:null,zoom:null},u="function"==typeof Symbol&&"symbol"===r(Symbol.iterator)?function(t){return r(t)}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":r(t)},m=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},g=function(){function t(t,e){for(var i=0;i1?e-1:0),a=1;a0&&i.forEach((function(e){x(e)&&Object.keys(e).forEach((function(i){t[i]=e[i]}))})),t},I=/\.\d*(?:0|9){12}\d*$/i;function S(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e11;return I.test(t)?Math.round(t*e)/e:t}var B=/^(?:width|height|left|top|marginLeft|marginTop)$/;function P(t,e){var i=t.style;k(e,(function(t,e){B.test(e)&&b(t)&&(t+="px"),i[e]=t}))}function O(t,e){if(e)if(b(t.length))k(t,(function(t){O(t,e)}));else if(t.classList)t.classList.add(e);else{var i=t.className.trim();i?i.indexOf(e)<0&&(t.className=i+" "+e):t.className=e}}function _(t,e){e&&(b(t.length)?k(t,(function(t){_(t,e)})):t.classList?t.classList.remove(e):t.className.indexOf(e)>=0&&(t.className=t.className.replace(e,"")))}function T(t,e,i){e&&(b(t.length)?k(t,(function(t){T(t,e,i)})):i?O(t,e):_(t,e))}var E=/([a-z\d])([A-Z])/g;function z(t){return t.replace(E,"$1-$2").toLowerCase()}function L(t,e){return x(t[e])?t[e]:t.dataset?t.dataset[e]:t.getAttribute("data-"+z(e))}function W(t,e,i){x(i)?t[e]=i:t.dataset?t.dataset[e]=i:t.setAttribute("data-"+z(e),i)}function A(t,e){if(x(t[e]))try{delete t[e]}catch(i){t[e]=void 0}else if(t.dataset)try{delete t.dataset[e]}catch(i){t.dataset[e]=void 0}else t.removeAttribute("data-"+z(e))}var N=/\s\s*/,j=function(){var t=!1;if(e){var a=!1,n=function(){},o=Object.defineProperty({},"once",{get:function(){return t=!0,a},set:function(t){a=t}});i.addEventListener("test",n,o),i.removeEventListener("test",n,o)}return t}();function H(t,e,i){var a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},n=i;e.trim().split(N).forEach((function(e){if(!j){var o=t.listeners;o&&o[e]&&o[e][i]&&(n=o[e][i],delete o[e][i],0===Object.keys(o[e]).length&&delete o[e],0===Object.keys(o).length&&delete t.listeners)}t.removeEventListener(e,n,a)}))}function R(t,e,i){var a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},n=i;e.trim().split(N).forEach((function(e){if(a.once&&!j){var o=t.listeners,s=void 0===o?{}:o;n=function(){for(var o=arguments.length,r=Array(o),h=0;h1&&void 0!==arguments[1]?arguments[1]:"contain",o=function(t){return K(t)&&t>0};if(o(a)&&o(i)){var s=i*e;"contain"===n&&s>a||"cover"===n&&s=8&&(o=h+l)}}}if(o){var d=e.getUint16(o,a),p=void 0,u=void 0;for(u=0;ut.width?3===i?r=t.height*s:h=t.width/s:3===i?h=t.width/s:r=t.height*s;var c={aspectRatio:s,naturalWidth:n,naturalHeight:o,width:r,height:h};c.left=(t.width-r)/2,c.top=(t.height-h)/2,c.oldLeft=c.left,c.oldTop=c.top,this.canvasData=c,this.limited=1===i||2===i,this.limitCanvas(!0,!0),this.initialImageData=D({},e),this.initialCanvasData=D({},c)},limitCanvas:function(t,e){var i=this.options,a=this.containerData,n=this.canvasData,o=this.cropBoxData,s=i.viewMode,r=n.aspectRatio,h=this.cropped&&o;if(t){var c=Number(i.minCanvasWidth)||0,l=Number(i.minCanvasHeight)||0;s>1?(c=Math.max(c,a.width),l=Math.max(l,a.height),3===s&&(l*r>c?c=l*r:l=c/r)):s>0&&(c?c=Math.max(c,h?o.width:0):l?l=Math.max(l,h?o.height:0):h&&(c=o.width,(l=o.height)*r>c?c=l*r:l=c/r));var d=Z({aspectRatio:r,width:c,height:l});c=d.width,l=d.height,n.minWidth=c,n.minHeight=l,n.maxWidth=1/0,n.maxHeight=1/0}if(e)if(s){var p=a.width-n.width,u=a.height-n.height;n.minLeft=Math.min(0,p),n.minTop=Math.min(0,u),n.maxLeft=Math.max(0,p),n.maxTop=Math.max(0,u),h&&this.limited&&(n.minLeft=Math.min(o.left,o.left+(o.width-n.width)),n.minTop=Math.min(o.top,o.top+(o.height-n.height)),n.maxLeft=o.left,n.maxTop=o.top,2===s&&(n.width>=a.width&&(n.minLeft=Math.min(0,p),n.maxLeft=Math.max(0,p)),n.height>=a.height&&(n.minTop=Math.min(0,u),n.maxTop=Math.max(0,u))))}else n.minLeft=-n.width,n.minTop=-n.height,n.maxLeft=a.width,n.maxTop=a.height},renderCanvas:function(t,e){var i=this.canvasData,a=this.imageData;if(e){var n=function(t){var e=t.width,i=t.height,a=t.degree;if(90==(a=Math.abs(a)%180))return{width:i,height:e};var n=a%90*Math.PI/180,o=Math.sin(n),s=Math.cos(n),r=e*s+i*o,h=e*o+i*s;return a>90?{width:h,height:r}:{width:r,height:h}}({width:a.naturalWidth*Math.abs(a.scaleX||1),height:a.naturalHeight*Math.abs(a.scaleY||1),degree:a.rotate||0}),o=n.width,s=n.height,r=i.width*(o/i.naturalWidth),h=i.height*(s/i.naturalHeight);i.left-=(r-i.width)/2,i.top-=(h-i.height)/2,i.width=r,i.height=h,i.aspectRatio=o/s,i.naturalWidth=o,i.naturalHeight=s,this.limitCanvas(!0,!1)}(i.width>i.maxWidth||i.widthi.maxHeight||i.heighte.width?n.height=n.width/i:n.width=n.height*i),this.cropBoxData=n,this.limitCropBox(!0,!0),n.width=Math.min(Math.max(n.width,n.minWidth),n.maxWidth),n.height=Math.min(Math.max(n.height,n.minHeight),n.maxHeight),n.width=Math.max(n.minWidth,n.width*a),n.height=Math.max(n.minHeight,n.height*a),n.left=e.left+(e.width-n.width)/2,n.top=e.top+(e.height-n.height)/2,n.oldLeft=n.left,n.oldTop=n.top,this.initialCropBoxData=D({},n)},limitCropBox:function(t,e){var i=this.options,a=this.containerData,n=this.canvasData,o=this.cropBoxData,s=this.limited,r=i.aspectRatio;if(t){var h=Number(i.minCropBoxWidth)||0,c=Number(i.minCropBoxHeight)||0,l=Math.min(a.width,s?n.width:a.width),d=Math.min(a.height,s?n.height:a.height);h=Math.min(h,a.width),c=Math.min(c,a.height),r&&(h&&c?c*r>h?c=h/r:h=c*r:h?c=h/r:c&&(h=c*r),d*r>l?d=l/r:l=d*r),o.minWidth=Math.min(h,l),o.minHeight=Math.min(c,d),o.maxWidth=l,o.maxHeight=d}e&&(s?(o.minLeft=Math.max(0,n.left),o.minTop=Math.max(0,n.top),o.maxLeft=Math.min(a.width,n.left+n.width)-o.width,o.maxTop=Math.min(a.height,n.top+n.height)-o.height):(o.minLeft=0,o.minTop=0,o.maxLeft=a.width-o.width,o.maxTop=a.height-o.height))},renderCropBox:function(){var t=this.options,e=this.containerData,i=this.cropBoxData;(i.width>i.maxWidth||i.widthi.maxHeight||i.height=e.width&&i.height>=e.height?"move":"all"),P(this.cropBox,D({width:i.width,height:i.height},Q({translateX:i.left,translateY:i.top}))),this.cropped&&this.limited&&this.limitCanvas(!0,!0),this.disabled||this.output()},output:function(){this.preview(),X(this.element,"crop",this.getData())}},at={initPreview:function(){var t=this.crossOrigin,e=this.options.preview,i=t?this.crossOriginUrl:this.url,a=document.createElement("img");if(t&&(a.crossOrigin=t),a.src=i,this.viewBox.appendChild(a),this.viewBoxImage=a,e){var n=e;"string"==typeof e?n=this.element.ownerDocument.querySelectorAll(e):e.querySelector&&(n=[e]),this.previews=n,k(n,(function(e){var a=document.createElement("img");W(e,"preview",{width:e.offsetWidth,height:e.offsetHeight,html:e.innerHTML}),t&&(a.crossOrigin=t),a.src=i,a.style.cssText='display:block;width:100%;height:auto;min-width:0!important;min-height:0!important;max-width:none!important;max-height:none!important;image-orientation:0deg!important;"',e.innerHTML="",e.appendChild(a)}))}},resetPreview:function(){k(this.previews,(function(t){var e=L(t,"preview");P(t,{width:e.width,height:e.height}),t.innerHTML=e.html,A(t,"preview")}))},preview:function(){var t=this.imageData,e=this.canvasData,i=this.cropBoxData,a=i.width,n=i.height,o=t.width,s=t.height,r=i.left-e.left-t.left,h=i.top-e.top-t.top;this.cropped&&!this.disabled&&(P(this.viewBoxImage,D({width:o,height:s},Q(D({translateX:-r,translateY:-h},t)))),k(this.previews,(function(e){var i=L(e,"preview"),c=i.width,l=i.height,d=c,p=l,u=1;a&&(p=n*(u=c/a)),n&&p>l&&(d=a*(u=l/n),p=l),P(e,{width:d,height:p}),P(e.getElementsByTagName("img")[0],D({width:o*u,height:s*u},Q(D({translateX:-r*u,translateY:-h*u},t))))})))}},nt={bind:function(){var t=this.element,e=this.options,i=this.cropper;M(e.cropstart)&&R(t,"cropstart",e.cropstart),M(e.cropmove)&&R(t,"cropmove",e.cropmove),M(e.cropend)&&R(t,"cropend",e.cropend),M(e.crop)&&R(t,"crop",e.crop),M(e.zoom)&&R(t,"zoom",e.zoom),R(i,n,this.onCropStart=this.cropStart.bind(this)),e.zoomable&&e.zoomOnWheel&&R(i,"wheel mousewheel DOMMouseScroll",this.onWheel=this.wheel.bind(this)),e.toggleDragModeOnDblclick&&R(i,"dblclick",this.onDblclick=this.dblclick.bind(this)),R(t.ownerDocument,o,this.onCropMove=this.cropMove.bind(this)),R(t.ownerDocument,s,this.onCropEnd=this.cropEnd.bind(this)),e.responsive&&R(window,"resize",this.onResize=this.resize.bind(this))},unbind:function(){var t=this.element,e=this.options,i=this.cropper;M(e.cropstart)&&H(t,"cropstart",e.cropstart),M(e.cropmove)&&H(t,"cropmove",e.cropmove),M(e.cropend)&&H(t,"cropend",e.cropend),M(e.crop)&&H(t,"crop",e.crop),M(e.zoom)&&H(t,"zoom",e.zoom),H(i,n,this.onCropStart),e.zoomable&&e.zoomOnWheel&&H(i,"wheel mousewheel DOMMouseScroll",this.onWheel),e.toggleDragModeOnDblclick&&H(i,"dblclick",this.onDblclick),H(t.ownerDocument,o,this.onCropMove),H(t.ownerDocument,s,this.onCropEnd),e.responsive&&H(window,"resize",this.onResize)}},ot={resize:function(){var t=this.options,e=this.container,i=this.containerData,a=Number(t.minContainerWidth)||200,n=Number(t.minContainerHeight)||100;if(!(this.disabled||i.width<=a||i.height<=n)){var o=e.offsetWidth/i.width;if(1!==o||e.offsetHeight!==i.height){var s=void 0,r=void 0;t.restore&&(s=this.getCanvasData(),r=this.getCropBoxData()),this.render(),t.restore&&(this.setCanvasData(k(s,(function(t,e){s[e]=t*o}))),this.setCropBoxData(k(r,(function(t,e){r[e]=t*o}))))}}},dblclick:function(){var t,e;this.disabled||"none"===this.options.dragMode||this.setDragMode((t=this.dragBox,e="cropper-crop",(t.classList?t.classList.contains(e):t.className.indexOf(e)>-1)?"move":"crop"))},wheel:function(t){var e=this,i=Number(this.options.wheelZoomRatio)||.1,a=1;this.disabled||(t.preventDefault(),this.wheeling||(this.wheeling=!0,setTimeout((function(){e.wheeling=!1}),50),t.deltaY?a=t.deltaY>0?1:-1:t.wheelDelta?a=-t.wheelDelta/120:t.detail&&(a=t.detail>0?1:-1),this.zoom(-a*i,t)))},cropStart:function(t){if(!this.disabled){var e=this.options,i=this.pointers,a=void 0;t.changedTouches?k(t.changedTouches,(function(t){i[t.identifier]=$(t)})):i[t.pointerId||0]=$(t),a=Object.keys(i).length>1&&e.zoomable&&e.zoomOnTouch?"zoom":L(t.target,"action"),h.test(a)&&!1!==X(this.element,"cropstart",{originalEvent:t,action:a})&&(t.preventDefault(),this.action=a,this.cropping=!1,"crop"===a&&(this.cropping=!0,O(this.dragBox,"cropper-modal")))}},cropMove:function(t){var e=this.action;if(!this.disabled&&e){var i=this.pointers;t.preventDefault(),!1!==X(this.element,"cropmove",{originalEvent:t,action:e})&&(t.changedTouches?k(t.changedTouches,(function(t){D(i[t.identifier],$(t,!0))})):D(i[t.pointerId||0],$(t,!0)),this.change(t))}},cropEnd:function(t){if(!this.disabled){var e=this.action,i=this.pointers;t.changedTouches?k(t.changedTouches,(function(t){delete i[t.identifier]})):delete i[t.pointerId||0],e&&(t.preventDefault(),Object.keys(i).length||(this.action=""),this.cropping&&(this.cropping=!1,T(this.dragBox,"cropper-modal",this.cropped&&this.options.modal)),X(this.element,"cropend",{originalEvent:t,action:e}))}}},st={change:function(t){var e=this.options,i=this.canvasData,n=this.containerData,o=this.cropBoxData,s=this.pointers,r=this.action,h=e.aspectRatio,c=o.left,l=o.top,d=o.width,p=o.height,u=c+d,m=l+p,g=0,f=0,v=n.width,b=n.height,w=!0,x=void 0;!h&&t.shiftKey&&(h=d&&p?d/p:1),this.limited&&(g=o.minLeft,f=o.minTop,v=g+Math.min(n.width,i.width,i.left+i.width),b=f+Math.min(n.height,i.height,i.top+i.height));var y=s[Object.keys(s)[0]],C={x:y.endX-y.startX,y:y.endY-y.startY},M=function(t){switch(t){case"e":u+C.x>v&&(C.x=v-u);break;case"w":c+C.xb&&(C.y=b-m)}};switch(r){case"all":c+=C.x,l+=C.y;break;case"e":if(C.x>=0&&(u>=v||h&&(l<=f||m>=b))){w=!1;break}M("e"),d+=C.x,h&&(p=d/h,l-=C.x/h/2),d<0&&(r="w",d=0);break;case"n":if(C.y<=0&&(l<=f||h&&(c<=g||u>=v))){w=!1;break}M("n"),p-=C.y,l+=C.y,h&&(d=p*h,c+=C.y*h/2),p<0&&(r="s",p=0);break;case"w":if(C.x<=0&&(c<=g||h&&(l<=f||m>=b))){w=!1;break}M("w"),d-=C.x,c+=C.x,h&&(p=d/h,l+=C.x/h/2),d<0&&(r="e",d=0);break;case"s":if(C.y>=0&&(m>=b||h&&(c<=g||u>=v))){w=!1;break}M("s"),p+=C.y,h&&(d=p*h,c-=C.y*h/2),p<0&&(r="n",p=0);break;case"ne":if(h){if(C.y<=0&&(l<=f||u>=v)){w=!1;break}M("n"),p-=C.y,l+=C.y,d=p*h}else M("n"),M("e"),C.x>=0?uf&&(p-=C.y,l+=C.y):(p-=C.y,l+=C.y);d<0&&p<0?(r="sw",p=0,d=0):d<0?(r="nw",d=0):p<0&&(r="se",p=0);break;case"nw":if(h){if(C.y<=0&&(l<=f||c<=g)){w=!1;break}M("n"),p-=C.y,l+=C.y,d=p*h,c+=C.y*h}else M("n"),M("w"),C.x<=0?c>g?(d-=C.x,c+=C.x):C.y<=0&&l<=f&&(w=!1):(d-=C.x,c+=C.x),C.y<=0?l>f&&(p-=C.y,l+=C.y):(p-=C.y,l+=C.y);d<0&&p<0?(r="se",p=0,d=0):d<0?(r="ne",d=0):p<0&&(r="sw",p=0);break;case"sw":if(h){if(C.x<=0&&(c<=g||m>=b)){w=!1;break}M("w"),d-=C.x,c+=C.x,p=d/h}else M("s"),M("w"),C.x<=0?c>g?(d-=C.x,c+=C.x):C.y>=0&&m>=b&&(w=!1):(d-=C.x,c+=C.x),C.y>=0?m=0&&(u>=v||m>=b)){w=!1;break}M("e"),p=(d+=C.x)/h}else M("s"),M("e"),C.x>=0?u=0&&m>=b&&(w=!1):d+=C.x,C.y>=0?m0?r=C.y>0?"se":"ne":C.x<0&&(c-=d,r=C.y>0?"sw":"nw"),C.y<0&&(l-=p),this.cropped||(_(this.cropBox,a),this.cropped=!0,this.limited&&this.limitCropBox(!0,!0))}w&&(o.width=d,o.height=p,o.left=c,o.top=l,this.action=r,this.renderCropBox()),k(s,(function(t){t.startX=t.endX,t.startY=t.endY}))}},rt={crop:function(){return!this.ready||this.cropped||this.disabled||(this.cropped=!0,this.limitCropBox(!0,!0),this.options.modal&&O(this.dragBox,"cropper-modal"),_(this.cropBox,a),this.setCropBoxData(this.initialCropBoxData)),this},reset:function(){return this.ready&&!this.disabled&&(this.imageData=D({},this.initialImageData),this.canvasData=D({},this.initialCanvasData),this.cropBoxData=D({},this.initialCropBoxData),this.renderCanvas(),this.cropped&&this.renderCropBox()),this},clear:function(){return this.cropped&&!this.disabled&&(D(this.cropBoxData,{left:0,top:0,width:0,height:0}),this.cropped=!1,this.renderCropBox(),this.limitCanvas(!0,!0),this.renderCanvas(),_(this.dragBox,"cropper-modal"),O(this.cropBox,a)),this},replace:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return!this.disabled&&t&&(this.isImg&&(this.element.src=t),e?(this.url=t,this.image.src=t,this.ready&&(this.viewBoxImage.src=t,k(this.previews,(function(e){e.getElementsByTagName("img")[0].src=t})))):(this.isImg&&(this.replaced=!0),this.options.data=null,this.uncreate(),this.load(t))),this},enable:function(){return this.ready&&this.disabled&&(this.disabled=!1,_(this.cropper,"cropper-disabled")),this},disable:function(){return this.ready&&!this.disabled&&(this.disabled=!0,O(this.cropper,"cropper-disabled")),this},destroy:function(){var t=this.element;return L(t,"cropper")?(this.isImg&&this.replaced&&(t.src=this.originalUrl),this.uncreate(),A(t,"cropper"),this):this},move:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t,i=this.canvasData,a=i.left,n=i.top;return this.moveTo(w(t)?t:a+Number(t),w(e)?e:n+Number(e))},moveTo:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t,i=this.canvasData,a=!1;return t=Number(t),e=Number(e),this.ready&&!this.disabled&&this.options.movable&&(b(t)&&(i.left=t,a=!0),b(e)&&(i.top=e,a=!0),a&&this.renderCanvas(!0)),this},zoom:function(t,e){var i=this.canvasData;return t=(t=Number(t))<0?1/(1-t):1+t,this.zoomTo(i.width*t/i.naturalWidth,null,e)},zoomTo:function(t,e,i){var a=this.options,n=this.canvasData,o=n.width,s=n.height,r=n.naturalWidth,h=n.naturalHeight;if((t=Number(t))>=0&&this.ready&&!this.disabled&&a.zoomable){var c=r*t,l=h*t;if(!1===X(this.element,"zoom",{originalEvent:i,oldRatio:o/r,ratio:c/r}))return this;if(i){var d=this.pointers,p=Y(this.cropper),u=d&&Object.keys(d).length?function(t){var e=0,i=0,a=0;return k(t,(function(t){var n=t.startX,o=t.startY;e+=n,i+=o,a+=1})),{pageX:e/=a,pageY:i/=a}}(d):{pageX:i.pageX,pageY:i.pageY};n.left-=(c-o)*((u.pageX-p.left-n.left)/o),n.top-=(l-s)*((u.pageY-p.top-n.top)/s)}else C(e)&&b(e.x)&&b(e.y)?(n.left-=(c-o)*((e.x-n.left)/o),n.top-=(l-s)*((e.y-n.top)/s)):(n.left-=(c-o)/2,n.top-=(l-s)/2);n.width=c,n.height=l,this.renderCanvas(!0)}return this},rotate:function(t){return this.rotateTo((this.imageData.rotate||0)+Number(t))},rotateTo:function(t){return b(t=Number(t))&&this.ready&&!this.disabled&&this.options.rotatable&&(this.imageData.rotate=t%360,this.renderCanvas(!0,!0)),this},scaleX:function(t){var e=this.imageData.scaleY;return this.scale(t,b(e)?e:1)},scaleY:function(t){var e=this.imageData.scaleX;return this.scale(b(e)?e:1,t)},scale:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t,i=this.imageData,a=!1;return t=Number(t),e=Number(e),this.ready&&!this.disabled&&this.options.scalable&&(b(t)&&(i.scaleX=t,a=!0),b(e)&&(i.scaleY=e,a=!0),a&&this.renderCanvas(!0,!0)),this},getData:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],e=this.options,i=this.imageData,a=this.canvasData,n=this.cropBoxData,o=void 0;if(this.ready&&this.cropped){o={x:n.left-a.left,y:n.top-a.top,width:n.width,height:n.height};var s=i.width/i.naturalWidth;k(o,(function(e,i){e/=s,o[i]=t?Math.round(e):e}))}else o={x:0,y:0,width:0,height:0};return e.rotatable&&(o.rotate=i.rotate||0),e.scalable&&(o.scaleX=i.scaleX||1,o.scaleY=i.scaleY||1),o},setData:function(t){var e=this.options,i=this.imageData,a=this.canvasData,n={};if(this.ready&&!this.disabled&&C(t)){var o=!1;e.rotatable&&b(t.rotate)&&t.rotate!==i.rotate&&(i.rotate=t.rotate,o=!0),e.scalable&&(b(t.scaleX)&&t.scaleX!==i.scaleX&&(i.scaleX=t.scaleX,o=!0),b(t.scaleY)&&t.scaleY!==i.scaleY&&(i.scaleY=t.scaleY,o=!0)),o&&this.renderCanvas(!0,!0);var s=i.width/i.naturalWidth;b(t.x)&&(n.left=t.x*s+a.left),b(t.y)&&(n.top=t.y*s+a.top),b(t.width)&&(n.width=t.width*s),b(t.height)&&(n.height=t.height*s),this.setCropBoxData(n)}return this},getContainerData:function(){return this.ready?D({},this.containerData):{}},getImageData:function(){return this.sized?D({},this.imageData):{}},getCanvasData:function(){var t=this.canvasData,e={};return this.ready&&k(["left","top","width","height","naturalWidth","naturalHeight"],(function(i){e[i]=t[i]})),e},setCanvasData:function(t){var e=this.canvasData,i=e.aspectRatio;return this.ready&&!this.disabled&&C(t)&&(b(t.left)&&(e.left=t.left),b(t.top)&&(e.top=t.top),b(t.width)?(e.width=t.width,e.height=t.width/i):b(t.height)&&(e.height=t.height,e.width=t.height*i),this.renderCanvas(!0)),this},getCropBoxData:function(){var t=this.cropBoxData,e=void 0;return this.ready&&this.cropped&&(e={left:t.left,top:t.top,width:t.width,height:t.height}),e||{}},setCropBoxData:function(t){var e=this.cropBoxData,i=this.options.aspectRatio,a=void 0,n=void 0;return this.ready&&this.cropped&&!this.disabled&&C(t)&&(b(t.left)&&(e.left=t.left),b(t.top)&&(e.top=t.top),b(t.width)&&t.width!==e.width&&(a=!0,e.width=t.width),b(t.height)&&t.height!==e.height&&(n=!0,e.height=t.height),i&&(a?e.height=e.width/i:n&&(e.width=e.height*i)),this.renderCropBox()),this},getCroppedCanvas:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!this.ready||!window.HTMLCanvasElement)return null;var e=this.canvasData,i=J(this.image,this.imageData,e,t);if(!this.cropped)return i;var a=this.getData(),n=a.x,o=a.y,s=a.width,r=a.height,h=i.width/Math.floor(e.naturalWidth);1!==h&&(n*=h,o*=h,s*=h,r*=h);var c=s/r,l=Z({aspectRatio:c,width:t.maxWidth||1/0,height:t.maxHeight||1/0}),d=Z({aspectRatio:c,width:t.minWidth||0,height:t.minHeight||0},"cover"),p=Z({aspectRatio:c,width:t.width||(1!==h?i.width:s),height:t.height||(1!==h?i.height:r)}),u=p.width,m=p.height;u=Math.min(l.width,Math.max(d.width,u)),m=Math.min(l.height,Math.max(d.height,m));var g=document.createElement("canvas"),v=g.getContext("2d");g.width=S(u),g.height=S(m),v.fillStyle=t.fillColor||"transparent",v.fillRect(0,0,u,m);var b=t.imageSmoothingEnabled,w=void 0===b||b,x=t.imageSmoothingQuality;v.imageSmoothingEnabled=w,x&&(v.imageSmoothingQuality=x);var y=i.width,C=i.height,M=n,k=o,D=void 0,I=void 0,B=void 0,P=void 0,O=void 0,_=void 0;M<=-s||M>y?(M=0,D=0,B=0,O=0):M<=0?(B=-M,M=0,O=D=Math.min(y,s+M)):M<=y&&(B=0,O=D=Math.min(s,y-M)),D<=0||k<=-r||k>C?(k=0,I=0,P=0,_=0):k<=0?(P=-k,k=0,_=I=Math.min(C,r+k)):k<=C&&(P=0,_=I=Math.min(r,C-k));var T=[M,k,D,I];if(O>0&&_>0){var E=u/s;T.push(B*E,P*E,O*E,_*E)}return v.drawImage.apply(v,[i].concat(f(T.map((function(t){return Math.floor(S(t))}))))),g},setAspectRatio:function(t){var e=this.options;return this.disabled||w(t)||(e.aspectRatio=Math.max(0,t)||NaN,this.ready&&(this.initCropBox(),this.cropped&&this.renderCropBox())),this},setDragMode:function(t){var e=this.options,i=this.dragBox,a=this.face;if(this.ready&&!this.disabled){var n="crop"===t,o=e.movable&&"move"===t;t=n||o?t:"none",e.dragMode=t,W(i,"action",t),T(i,"cropper-crop",n),T(i,"cropper-move",o),e.cropBoxMovable||(W(a,"action",t),T(a,"cropper-crop",n),T(a,"cropper-move",o))}return this}},ht=i.Cropper,ct=function(){function t(e){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(m(this,t),!e||!d.test(e.tagName))throw new Error("The first argument is required and must be an or element.");this.element=e,this.options=D({},p,C(i)&&i),this.cropped=!1,this.disabled=!1,this.pointers={},this.ready=!1,this.reloading=!1,this.replaced=!1,this.sized=!1,this.sizing=!1,this.init()}return g(t,[{key:"init",value:function(){var t=this.element,e=t.tagName.toLowerCase(),i=void 0;if(!L(t,"cropper")){if(W(t,"cropper",this),"img"===e){if(this.isImg=!0,i=t.getAttribute("src")||"",this.originalUrl=i,!i)return;i=t.src}else"canvas"===e&&window.HTMLCanvasElement&&(i=t.toDataURL());this.load(i)}}},{key:"load",value:function(t){var e=this;if(t){this.url=t,this.imageData={};var i=this.element,a=this.options;if(a.checkOrientation&&window.ArrayBuffer)if(c.test(t))l.test(t)?this.read((n=t.replace(tt,""),o=atob(n),s=new ArrayBuffer(o.length),k(r=new Uint8Array(s),(function(t,e){r[e]=o.charCodeAt(e)})),s)):this.clone();else{var n,o,s,r,h=new XMLHttpRequest;this.reloading=!0,this.xhr=h;var d=function(){e.reloading=!1,e.xhr=null};h.ontimeout=d,h.onabort=d,h.onerror=function(){d(),e.clone()},h.onload=function(){d(),e.read(h.response)},a.checkCrossOrigin&&V(t)&&i.crossOrigin&&(t=q(t)),h.open("get",t),h.responseType="arraybuffer",h.withCredentials="use-credentials"===i.crossOrigin,h.send()}else this.clone()}}},{key:"read",value:function(t){var e=this.options,i=this.imageData,a=et(t),n=0,o=1,s=1;if(a>1){this.url=function(t,e){var i=new Uint8Array(t),a="";return k(i,(function(t){a+=G(t)})),"data:"+e+";base64,"+btoa(a)}(t,"image/jpeg");var r=function(t){var e=0,i=1,a=1;switch(t){case 2:i=-1;break;case 3:e=-180;break;case 4:a=-1;break;case 5:e=90,a=-1;break;case 6:e=90;break;case 7:e=90,i=-1;break;case 8:e=-90}return{rotate:e,scaleX:i,scaleY:a}}(a);n=r.rotate,o=r.scaleX,s=r.scaleY}e.rotatable&&(i.rotate=n),e.scalable&&(i.scaleX=o,i.scaleY=s),this.clone()}},{key:"clone",value:function(){var t=this.element,e=this.url,i=void 0,a=void 0;this.options.checkCrossOrigin&&V(e)&&((i=t.crossOrigin)?a=e:(i="anonymous",a=q(e))),this.crossOrigin=i,this.crossOriginUrl=a;var n=document.createElement("img");i&&(n.crossOrigin=i),n.src=a||e;var o=this.start.bind(this),s=this.stop.bind(this);this.image=n,this.onStart=o,this.onStop=s,this.isImg?t.complete?this.timeout=setTimeout(o,0):R(t,"load",o,{once:!0}):(n.onload=o,n.onerror=s,O(n,"cropper-hide"),t.parentNode.insertBefore(n,t.nextSibling))}},{key:"start",value:function(t){var e=this,a=this.isImg?this.element:this.image;t&&(a.onload=null,a.onerror=null),this.sizing=!0;var n=i.navigator&&/(Macintosh|iPhone|iPod|iPad).*AppleWebKit/i.test(i.navigator.userAgent),o=function(t,i){D(e.imageData,{naturalWidth:t,naturalHeight:i,aspectRatio:t/i}),e.sizing=!1,e.sized=!0,e.build()};if(!a.naturalWidth||n){var s=document.createElement("img"),r=document.body||document.documentElement;this.sizingImage=s,s.onload=function(){o(s.width,s.height),n||r.removeChild(s)},s.src=a.src,n||(s.style.cssText="left:0;max-height:none!important;max-width:none!important;min-height:0!important;min-width:0!important;opacity:0;position:absolute;top:0;z-index:-1;",r.appendChild(s))}else o(a.naturalWidth,a.naturalHeight)}},{key:"stop",value:function(){var t=this.image;t.onload=null,t.onerror=null,t.parentNode.removeChild(t),this.image=null}},{key:"build",value:function(){if(this.sized&&!this.ready){var t=this.element,e=this.options,i=this.image,n=t.parentNode,o=document.createElement("div");o.innerHTML='
';var s=o.querySelector(".cropper-container"),r=s.querySelector(".cropper-canvas"),h=s.querySelector(".cropper-drag-box"),c=s.querySelector(".cropper-crop-box"),l=c.querySelector(".cropper-face");this.container=n,this.cropper=s,this.canvas=r,this.dragBox=h,this.cropBox=c,this.viewBox=s.querySelector(".cropper-view-box"),this.face=l,r.appendChild(i),O(t,a),n.insertBefore(s,t.nextSibling),this.isImg||_(i,"cropper-hide"),this.initPreview(),this.bind(),e.aspectRatio=Math.max(0,e.aspectRatio)||NaN,e.viewMode=Math.max(0,Math.min(3,Math.round(e.viewMode)))||0,O(c,a),e.guides||O(c.getElementsByClassName("cropper-dashed"),a),e.center||O(c.getElementsByClassName("cropper-center"),a),e.background&&O(s,"cropper-bg"),e.highlight||O(l,"cropper-invisible"),e.cropBoxMovable&&(O(l,"cropper-move"),W(l,"action","all")),e.cropBoxResizable||(O(c.getElementsByClassName("cropper-line"),a),O(c.getElementsByClassName("cropper-point"),a)),this.render(),this.ready=!0,this.setDragMode(e.dragMode),e.autoCrop&&this.crop(),this.setData(e.data),M(e.ready)&&R(t,"ready",e.ready,{once:!0}),X(t,"ready")}}},{key:"unbuild",value:function(){this.ready&&(this.ready=!1,this.unbind(),this.resetPreview(),this.cropper.parentNode.removeChild(this.cropper),_(this.element,a))}},{key:"uncreate",value:function(){var t=this.element;this.ready?(this.unbuild(),this.ready=!1,this.cropped=!1):this.sizing?(this.sizingImage.onload=null,this.sizing=!1,this.sized=!1):this.reloading?this.xhr.abort():this.isImg?t.complete?clearTimeout(this.timeout):H(t,"load",this.onStart):this.image&&this.stop()}}],[{key:"noConflict",value:function(){return window.Cropper=ht,t}},{key:"setDefaults",value:function(t){D(p,C(t)&&t)}}]),t}();if(D(ct.prototype,it,at,nt,ot,st,rt),t.fn){var lt=t.fn.cropper;t.fn.cropper=function(e){for(var i=arguments.length,a=Array(i>1?i-1:0),n=1;n