diff --git a/app/Helpers/DocumentIdentifier.php b/app/Helpers/DocumentIdentifier.php new file mode 100644 index 0000000..6d6c6e1 --- /dev/null +++ b/app/Helpers/DocumentIdentifier.php @@ -0,0 +1,134 @@ + 'Ingeniería', + 'ARC' => 'Arquitectura', + 'CIV' => 'Civil', + 'MEC' => 'Mecánica', + 'ELC' => 'Eléctrica', + 'INS' => 'Instrumentación', + 'PIP' => 'Piping', + 'STR' => 'Estructural' + ]; + + private $tiposDocumentoValidos = [ + 'DRW' => 'Dibujo', + 'ESP' => 'Especificación', + 'LST' => 'Lista de materiales', + 'PRO' => 'Procedimiento', + 'INF' => 'Informe', + 'MAN' => 'Manual', + 'CAL' => 'Cálculo', + 'REP' => 'Reporte' + ]; + + public function analizarDocumento($codigoCompleto) { + // Validar formato básico + if (strpos($codigoCompleto, ' - ') === false) { + return $this->crearResultadoError("Formato inválido: falta separador ' - '"); + } + + list($codigo, $nombre) = explode(' - ', $codigoCompleto, 2); + $segmentos = explode('-', $codigo); + + // Validar número de segmentos + if (count($segmentos) != 5) { + return $this->crearResultadoError("Número incorrecto de segmentos"); + } + + // Extraer y validar cada parte + $codigoProyecto = $segmentos[0]; + $codigoMaker = $segmentos[1]; + $disciplina = $segmentos[2]; + $tipoDocumento = $segmentos[3]; + $revisionCompleta = $segmentos[4]; + + // Validar formato de revisión + if (strpos($revisionCompleta, 'REV.') !== 0) { + return $this->crearResultadoError("Formato de revisión inválido"); + } + + $numeroRevision = substr($revisionCompleta, 4); // Remover "REV." + + // Validar número de revisión + if (!ctype_digit($numeroRevision) || strlen($numeroRevision) != 2) { + return $this->crearResultadoError("Número de revisión inválido"); + } + + // Validar disciplinas y tipos + $disciplinaValida = $this->validarDisciplina($disciplina); + $tipoValido = $this->validarTipoDocumento($tipoDocumento); + + return [ + 'codigo_completo' => $codigoCompleto, + 'codigo_proyecto' => $codigoProyecto, + 'codigo_maker' => $codigoMaker, + 'disciplina' => $disciplina, + 'disciplina_desc' => $disciplinaValida, + 'tipo_documento' => $tipoDocumento, + 'tipo_documento_desc' => $tipoValido, + 'revision' => $numeroRevision, + 'nombre_documento' => $nombre, + 'estructura_valida' => true, + 'errores' => [] + ]; + } + + private function validarDisciplina($codigo) { + return isset($this->disciplinasValidas[$codigo]) + ? $this->disciplinasValidas[$codigo] + : "Desconocida"; + } + + private function validarTipoDocumento($codigo) { + return isset($this->tiposDocumentoValidos[$codigo]) + ? $this->tiposDocumentoValidos[$codigo] + : "Desconocido"; + } + + private function crearResultadoError($mensaje) { + return [ + 'estructura_valida' => false, + 'errores' => [$mensaje] + ]; + } + + // Método para generar un nuevo código + public function generarCodigo($proyecto, $maker, $disciplina, $tipo, $revision, $nombre = '') { + $revisionFormateada = str_pad($revision, 2, '0', STR_PAD_LEFT); + $codigo = "{$proyecto}-{$maker}-{$disciplina}-{$tipo}-REV.{$revisionFormateada}"; + + if (!empty($nombre)) { + $codigo .= " - {$nombre}"; + } + + return $codigo; + } +} + +// EJEMPLOS DE USO +/* +$analizador = new DocumentIdentifier(); + +// Analizar un código existente +$codigo1 = "MP00002-SOGOS-ENG-DRW-REV.01 - Plano principal"; +$resultado1 = $analizador->analizarDocumento($codigo1); + +echo "Análisis del documento:\n"; +print_r($resultado1); + +// Generar un nuevo código +$nuevoCodigo = $analizador->generarCodigo( + 'MP00002', + 'SOGOS', + 'CIV', + 'ESP', + '03', + 'Especificación técnica de cimientos' +); + +echo "\nNuevo código generado: " . $nuevoCodigo . "\n";*/ + +?> \ No newline at end of file diff --git a/app/Helpers/FileHelper.php b/app/Helpers/FileHelper.php index df40db8..1d536e9 100644 --- a/app/Helpers/FileHelper.php +++ b/app/Helpers/FileHelper.php @@ -20,4 +20,50 @@ class FileHelper default => 'document' }; } + + public static function getFileIconClass($filename) + { + $fileType = self::getFileType($filename); + + $classes = [ + 'pdf' => 'text-red-500', + 'word' => 'text-blue-500', + 'excel' => 'text-green-500', + 'image' => 'text-yellow-500', + 'archive' => 'text-purple-500', + 'text' => 'text-gray-500', + 'powerpoint' => 'text-orange-500', + 'document' => 'text-gray-400' + ]; + + return $classes[$fileType] ?? 'text-gray-400'; + } + + public static function getFileIconSvg($filename) + { + $fileType = self::getFileType($filename); + $colorClass = self::getFileIconClass($filename); + + $icons = [ + 'pdf' => '', + 'word' => '', + 'excel' => '', + 'image' => '', + 'archive' => '' + ]; + + return $icons[$fileType] ?? ''; + } } \ No newline at end of file diff --git a/app/Http/Controllers/DocumentController.php b/app/Http/Controllers/DocumentController.php index 07b2dc8..ea2ade8 100644 --- a/app/Http/Controllers/DocumentController.php +++ b/app/Http/Controllers/DocumentController.php @@ -68,6 +68,8 @@ class DocumentController extends Controller $document->url = Storage::url($document->file_path); + $document->load('user'); + return view('documents.show', [ 'document' => $document, 'versions' => $document->versions()->latest()->get(), @@ -108,7 +110,7 @@ class DocumentController extends Controller foreach ($request->file('files') as $file) { $document = $project->documents()->create([ 'name' => $file->getClientOriginalName(), - 'status' => 'pending' + 'status' => 0 ]); $this->createVersion($document, $file); @@ -125,4 +127,331 @@ class DocumentController extends Controller $document->update(['current_version_id' => $version->id]); } + + + /** + * Actualizar PDF con anotaciones, firmas y sellos + */ + public function updatePdf(Request $request, Document $document) + { + $this->authorize('update', $document); + + $request->validate([ + 'pdf_data' => 'required|string', // PDF modificado en base64 + 'annotations' => 'sometimes|array', + 'signatures' => 'sometimes|array', + 'stamps' => 'sometimes|array', + ]); + + try { + // Procesar el PDF modificado + $modifiedPdf = $this->processPdfData($request->pdf_data); + + // Reemplazar el archivo original (sin crear nueva versión si no quieres) + $this->replaceOriginalPdf($document, $modifiedPdf); + + // Opcional: también crear una nueva versión para historial + $newVersion = $this->createNewVersion($document, $modifiedPdf, $request->all()); + + return response()->json([ + 'success' => true, + 'message' => 'PDF actualizado correctamente', + 'version_id' => $newVersion->id ?? null, + ]); + + } catch (\Exception $e) { + \Log::error('Error updating PDF: ' . $e->getMessage()); + + return response()->json([ + 'success' => false, + 'message' => 'Error al actualizar el PDF: ' . $e->getMessage() + ], 500); + } + } + + /** + * Procesar datos del PDF en base64 + */ + private function processPdfData($pdfData) + { + // Eliminar el prefijo data:application/pdf;base64, si existe + $pdfData = preg_replace('/^data:application\/pdf;base64,/', '', $pdfData); + + // Decodificar base64 + $pdfContent = base64_decode($pdfData); + + if (!$pdfContent) { + throw new \Exception('Datos PDF inválidos'); + } + + return $pdfContent; + } + + /** + * Procesar PDF con anotaciones (método alternativo) + */ + private function processPdfWithAnnotations($document, $data) + { + // Aquí integrarías una librería PHP para PDF como spatie/pdf-to-image o setasign/fpdi + // Por ahora, devolvemos el contenido del archivo original + // En producción, implementarías la lógica de modificación + + if ($document->currentVersion) { + $filePath = $document->currentVersion->file_path; + } else { + $filePath = $document->getFirstMedia('documents')->getPath(); + } + + if (!Storage::exists($filePath)) { + throw new \Exception('Archivo PDF no encontrado'); + } + + return Storage::get($filePath); + } + + /** + * Reemplazar el PDF original + */ + private function replaceOriginalPdf($document, $pdfContent) + { + // Obtener la ruta del archivo original + $filePath = $document->file_path; + + // Si el documento usa media library + if ($document->getFirstMedia('documents')) { + $media = $document->getFirstMedia('documents'); + $media->update([ + 'file_name' => $document->name . '.pdf', + 'size' => strlen($pdfContent), + ]); + + // Reemplazar el archivo + Storage::put($media->getPath(), $pdfContent); + } else { + // Si usas file_path directo + Storage::put($filePath, $pdfContent); + + // Actualizar metadata del documento + $document->update([ + 'file_size' => strlen($pdfContent), + 'updated_at' => now(), + ]); + } + } + + /** + * Crear nueva versión del documento + */ + private function createNewVersion($document, $pdfContent, $data = []) + { + $versionNumber = $document->versions()->count() + 1; + $fileName = "documents/{$document->id}/v{$versionNumber}.pdf"; + + // Guardar el nuevo PDF + Storage::put($fileName, $pdfContent); + + // Crear registro de versión + $version = $document->versions()->create([ + 'version_number' => $versionNumber, + 'file_path' => $fileName, + 'file_size' => strlen($pdfContent), + 'hash' => hash('sha256', $pdfContent), + 'created_by' => auth()->id(), + 'metadata' => [ + 'annotations_count' => count($data['annotations'] ?? []), + 'signatures_count' => count($data['signatures'] ?? []), + 'stamps_count' => count($data['stamps'] ?? []), + 'edited_at' => now()->toISOString(), + 'edited_by' => auth()->user()->name + ] + ]); + + return $version; + } + + /** + * Guardar metadatos de anotaciones + */ + private function saveAnnotationsMetadata($version, $data) + { + // Guardar anotaciones en la base de datos si es necesario + if (!empty($data['annotations'])) { + foreach ($data['annotations'] as $annotation) { + $version->annotations()->create([ + 'type' => $annotation['type'] ?? 'text', + 'content' => $annotation['content'] ?? '', + 'position' => $annotation['position'] ?? [], + 'page' => $annotation['page'] ?? 1, + 'created_by' => auth()->id() + ]); + } + } + } + + /** + * Subir firma + */ + public function uploadSignature(Request $request) + { + $request->validate([ + 'signature' => 'required|image|max:2048|mimes:png,jpg,jpeg' + ]); + + try { + $user = auth()->user(); + $path = $request->file('signature')->store("signatures/{$user->id}", 'public'); + + // Opcional: Guardar en base de datos + $user->signatures()->create([ + 'file_path' => $path, + 'file_name' => $request->file('signature')->getClientOriginalName() + ]); + + return response()->json([ + 'success' => true, + 'path' => Storage::url($path), + 'filename' => basename($path) + ]); + + } catch (\Exception $e) { + \Log::error('Error uploading signature: ' . $e->getMessage()); + + return response()->json([ + 'success' => false, + 'message' => 'Error al subir la firma' + ], 500); + } + } + + /** + * Subir sello + */ + public function uploadStamp(Request $request) + { + $request->validate([ + 'stamp' => 'required|image|max:2048|mimes:png,jpg,jpeg' + ]); + + try { + $user = auth()->user(); + $path = $request->file('stamp')->store("stamps/{$user->id}", 'public'); + + // Opcional: Guardar en base de datos + $user->stamps()->create([ + 'file_path' => $path, + 'file_name' => $request->file('stamp')->getClientOriginalName(), + 'type' => $request->type ?? 'custom' + ]); + + return response()->json([ + 'success' => true, + 'path' => Storage::url($path), + 'filename' => basename($path) + ]); + + } catch (\Exception $e) { + \Log::error('Error uploading stamp: ' . $e->getMessage()); + + return response()->json([ + 'success' => false, + 'message' => 'Error al subir el sello' + ], 500); + } + } + + /** + * Obtener firmas del usuario + */ + public function getSignatures() + { + $user = auth()->user(); + $signatures = $user->signatures()->get()->map(function($signature) { + return [ + 'id' => $signature->id, + 'url' => Storage::url($signature->file_path), + 'name' => $signature->file_name + ]; + }); + + return response()->json([ + 'success' => true, + 'signatures' => $signatures + ]); + } + + /** + * Obtener sellos del usuario + */ + public function getStamps() + { + $user = auth()->user(); + $stamps = $user->stamps()->get()->map(function($stamp) { + return [ + 'id' => $stamp->id, + 'url' => Storage::url($stamp->file_path), + 'name' => $stamp->file_name, + 'type' => $stamp->type + ]; + }); + + return response()->json([ + 'success' => true, + 'stamps' => $stamps + ]); + } + + /** + * Descargar documento + */ + public function download(Document $document, $versionId = null) + { + $this->authorize('view', $document); + + $version = $versionId ? + $document->versions()->findOrFail($versionId) : + $document->currentVersion; + + if (!$version || !Storage::exists($version->file_path)) { + abort(404); + } + + return Storage::download($version->file_path, $document->name . '.pdf'); + } + + /** + * Obtener el PDF actual para edición + */ + public function getPdfForEditing(Document $document) + { + $this->authorize('view', $document); + + try { + if ($document->getFirstMedia('documents')) { + $filePath = $document->getFirstMedia('documents')->getPath(); + } else { + $filePath = $document->file_path; + } + + if (!Storage::exists($filePath)) { + abort(404); + } + + $pdfContent = Storage::get($filePath); + $base64Pdf = base64_encode($pdfContent); + + return response()->json([ + 'success' => true, + 'pdf_data' => $base64Pdf, + 'document_name' => $document->name + ]); + + } catch (\Exception $e) { + \Log::error('Error getting PDF for editing: ' . $e->getMessage()); + + return response()->json([ + 'success' => false, + 'message' => 'Error al cargar el PDF' + ], 500); + } + } } diff --git a/app/Http/Controllers/ProjectController.php b/app/Http/Controllers/ProjectController.php index 97d1716..b291c68 100644 --- a/app/Http/Controllers/ProjectController.php +++ b/app/Http/Controllers/ProjectController.php @@ -3,6 +3,7 @@ namespace App\Http\Controllers; use App\Models\Category; +use App\Models\Folder; use App\Models\Project; use App\Models\User; use Illuminate\Foundation\Auth\Access\AuthorizesRequests; @@ -11,7 +12,7 @@ use Illuminate\Support\Facades\Storage; class ProjectController extends Controller { - use AuthorizesRequests; // ← Añadir este trait + use AuthorizesRequests; /** * Display a listing of the resource. @@ -43,7 +44,7 @@ class ProjectController extends Controller 'project' => $project, 'categories' => Category::orderBy('name')->get(), 'users' => User::where('id', '!=', auth()->id())->get(), - 'companies' => \App\Models\Company::all(), // Pass companies to the view + 'companies' => \App\Models\Company::all(), // Pass companies to the view, ]); } @@ -93,6 +94,12 @@ class ProjectController extends Controller if($request->has('categories')) { $project->categories()->sync($request->categories); } + + Folder::create([ + 'name' => 'Project', + 'project_id' => $project->id, + 'parent_id' => null, + ]); return redirect()->route('projects.show', $project)->with('success', 'Proyecto creado exitosamente'); @@ -172,6 +179,9 @@ class ProjectController extends Controller // } + /** + * Display the specified resource. + */ public function __invoke(Project $project) { return view('projects.show', [ diff --git a/app/Livewire/CodeEdit.php b/app/Livewire/CodeEdit.php new file mode 100644 index 0000000..93d2fa4 --- /dev/null +++ b/app/Livewire/CodeEdit.php @@ -0,0 +1,235 @@ + 'required|string|min:2|max:50', + 'codeInput' => 'required|string', + 'labelInput' => 'required|string', + 'maxLength' => 'required|integer|min:2|max:12', + ]; + + public function mount($componentId, $initialName = '') + { + $this->componentId = $componentId; + $this->name = $initialName; + $this->maxLength = 3; + + // Disparar evento inicial para establecer el nombre + $this->dispatch('nameUpdated', + componentId: $this->componentId, + data: [ + 'name' => $this->name + ] + ); + } + + public function updateName() + { + $this->validate([ + 'name' => 'required|string|min:2|max:50', + ]); + + $this->dispatch('nameUpdated', + componentId: $this->componentId, + data: [ + 'name' => $this->name + ] + ); + } + + public function updateMaxLength() + { + $this->validate([ + 'maxLength' => 'integer|min:2|max:12', + ]); + + if (strlen($this->codeInput) > $this->maxLength) { + $this->codeInput = substr($this->codeInput, 0, $this->maxLength); + } + } + + public function addField() + { + $this->validate([ + 'codeInput' => "required|string|size:{$this->maxLength}", + 'labelInput' => 'required|string|min:1', + ], [ + 'codeInput.size' => "El código debe tener exactamente {$this->maxLength} caracteres", + ]); + + $this->documentTypes[] = [ + 'code' => $this->codeInput, + 'label' => $this->labelInput, + 'max_length' => $this->maxLength, + ]; + + $this->sortList(); + $this->reset(['codeInput', 'labelInput']); + + $this->dispatch('componentUpdated', + componentId: $this->componentId, // Cambiado aquí + data: [ + 'documentTypes' => $this->documentTypes, + 'maxLength' => $this->maxLength + ] + ); + } + + public function addCode() + { + $this->validate([ + 'codeInput' => "required|string|size:{$this->maxLength}", + ], [ + 'codeInput.size' => "El código debe tener exactamente {$this->maxLength} caracteres", + ]); + + $this->dispatch('focus-label-input'); + } + + public function addLabel() + { + $this->validate([ + 'labelInput' => 'required|string|min:1', + ]); + + if (!empty($this->codeInput) && !empty($this->labelInput)) { + $this->addField(); + } + } + + public function removeField($index) + { + if (isset($this->documentTypes[$index])) { + unset($this->documentTypes[$index]); + $this->documentTypes = array_values($this->documentTypes); + + $this->dispatch('componentUpdated', + componentId: $this->componentId, // Cambiado aquí + data: [ + 'documentTypes' => $this->documentTypes, + 'maxLength' => $this->maxLength + ] + ); + } + } + + public function updatedMaxLength($value) + { + $this->validate([ + 'maxLength' => 'integer|min:2|max:12', + ]); + + if (strlen($this->codeInput) > $value) { + $this->codeInput = substr($this->codeInput, 0, $value); + } + } + + public function updatedCodeInput($value) + { + if (strlen($value) > $this->maxLength) { + $this->codeInput = substr($value, 0, $this->maxLength); + } + + $this->codeInput = strtoupper($value); + } + + public function sortByCode() + { + if ($this->sortBy === 'code') { + $this->sortDirection = $this->sortDirection === 'asc' ? 'desc' : 'asc'; + } else { + $this->sortBy = 'code'; + $this->sortDirection = 'asc'; + } + $this->sortList(); + } + + public function sortByLabel() + { + if ($this->sortBy === 'label') { + $this->sortDirection = $this->sortDirection === 'asc' ? 'desc' : 'asc'; + } else { + $this->sortBy = 'label'; + $this->sortDirection = 'asc'; + } + $this->sortList(); + } + + private function sortList() + { + $direction = $this->sortDirection === 'asc' ? SORT_ASC : SORT_DESC; + + if ($this->sortBy === 'code') { + array_multisort( + array_column($this->documentTypes, 'code'), + $direction, + SORT_STRING, + $this->documentTypes + ); + } else { + array_multisort( + array_column($this->documentTypes, 'label'), + $direction, + SORT_STRING, + $this->documentTypes + ); + } + } + + public function getSortedDocumentTypesProperty() + { + $sorted = $this->documentTypes; + $direction = $this->sortDirection === 'asc' ? SORT_ASC : SORT_DESC; + + if ($this->sortBy === 'code') { + array_multisort( + array_column($sorted, 'code'), + $direction, + SORT_STRING, + $sorted + ); + } else { + array_multisort( + array_column($sorted, 'label'), + $direction, + SORT_STRING, + $sorted + ); + } + + return $sorted; + } + + public function getTotalDocumentTypesProperty() + { + return count($this->documentTypes); + } + + public function getSortIcon($column) + { + if ($this->sortBy !== $column) { + return 'sort'; + } + + return $this->sortDirection === 'asc' ? 'sort-up' : 'sort-down'; + } + + public function render() + { + return view('livewire.code-edit'); + } +} diff --git a/app/Livewire/ProjectDocumentList.php b/app/Livewire/ProjectDocumentList.php new file mode 100644 index 0000000..5c476e2 --- /dev/null +++ b/app/Livewire/ProjectDocumentList.php @@ -0,0 +1,273 @@ +setPrimaryKey('id') + ->setAdditionalSelects(['documents.id as id']) + + /*->setConfigurableAreas([ + 'toolbar-left-start' => ['includes.areas.toolbar-left-start', ['param1' => 'Default', 'param2' => ['param2' => 2]]], + ])*/ + ->setPaginationEnabled() + ->setPaginationMethod('simple') + ->setPaginationVisibilityEnabled() + + + //->setReorderEnabled() + ->setHideReorderColumnUnlessReorderingEnabled() + ->setSecondaryHeaderTrAttributes(function ($rows) { + return ['class' => 'bg-gray-100']; + }) + ->setSecondaryHeaderTdAttributes(function (Column $column, $rows) { + if ($column->isField('id')) { + return ['class' => 'text-red-100']; + } + return ['default' => true]; + }) + ->setFooterTrAttributes(function ($rows) { + return ['class' => 'bg-gray-100']; + }) + ->setFooterTdAttributes(function (Column $column, $rows) { + if ($column->isField('name')) { + return ['class' => 'text-green-500']; + } + return ['default' => true]; + }) + ->setHideBulkActionsWhenEmptyEnabled() + ->setUseHeaderAsFooterEnabled() + + ->setPaginationEnabled() + ->setPaginationVisibilityEnabled() + //->setToolsDisabled() + //->setToolBarDisabled() + + // Configuración de paginación + ->setPerPage(25) // Número de elementos por página + ->setPerPageAccepted([10, 25, 50, 100]) // Opciones de elementos por página + ->setPaginationEnabled() // Asegurar que la paginación esté habilitada + ->setPaginationVisibilityStatus(true); // Hacer visible el paginador + ; + } + + public function mount($projectId = null, $folderId = null) + { + $this->projectId = $projectId; + $this->folderId = $folderId; + } + + public function columns(): array + { + return [ + Column::make("Código", "code") + ->sortable() + ->searchable() + ->secondaryHeaderFilter('code') // Filtro para esta columna + ->format( + fn($value, $row, Column $column) => + ''.$value.'' + )->html(), + + Column::make("Nombre", "name") + ->sortable() + ->searchable() + ->secondaryHeaderFilter('name') // Filtro para esta columna + ->format( + fn($value, $row, Column $column) => + '
h;c-=p)l=u.getPointOnEllipticalArc(n[0],n[1],n[2],n[3],c,0),o+=u.getLineLength(i.x,i.y,l.x,l.y),i=l;else for(c=d+p;c =0;n--){for(var c=t.words[n],u=l-1;u>=0;u--){var d=c>>u&1;i!==r[0]&&(i=this.sqr(i)),0!==d||0!==a?(a<<=1,a|=d,(4===++s||0===n&&0===u)&&(i=this.mul(i,r[a]),s=0,a=0)):s=0}l=26}return i},S.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},S.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},o.mont=function(e){return new C(e)},n(C,S),C.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},C.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},C.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var r=e.imul(t),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=r.isub(n).iushrn(this.shift),i=o;return o.cmp(this.m)>=0?i=o.isub(this.m):o.cmpn(0)<0&&(i=o.iadd(this.m)),i._forceRed(this)},C.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new o(0)._forceRed(this);var r=e.mul(t),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),a=i;return i.cmp(this.m)>=0?a=i.isub(this.m):i.cmpn(0)<0&&(a=i.iadd(this.m)),a._forceRed(this)},C.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(void 0===t||t)},{buffer:188}],185:[function(e,t,r){"use strict";r.byteLength=function(e){var t=l(e),r=t[0],n=t[1];return 3*(r+n)/4-n},r.toByteArray=function(e){var t,r,n=l(e),a=n[0],s=n[1],c=new i(function(e,t,r){return 3*(t+r)/4-r}(0,a,s)),u=0,d=s>0?a-4:a;for(r=0;r1?c[n++]=65533:o<65536?c[n++]=o:(o-=65536,c[n++]=55296|o>>10&1023,c[n++]=56320|1023&o)}return l(c,n)},t.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+a[e[r]]>t?r:t}},1998:(e,t,r)=>{"use strict";var n=r(9805),o=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],i=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],a=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],s=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];e.exports=function(e,t,r,l,c,u,d,f){var h,p,m,g,v,b,y,w,x,S=f.bits,C=0,k=0,E=0,O=0,A=0,T=0,j=0,P=0,M=0,R=0,_=null,I=0,N=new n.Buf16(16),F=new n.Buf16(16),D=null,B=0;for(C=0;C<=15;C++)N[C]=0;for(k=0;k1||c>1){const e=a.row+(s-1),r=a.col+(c-1);return{...t.dataValidation,sqref:`${t.address}:${i.encodeAddress(e,r)}`}}return{...t.dataValidation,sqref:t.address}}return null})).filter(Boolean)}(t);r.length&&(e.openNode("dataValidations",{count:r.length}),r.forEach((t=>{e.openNode("dataValidation"),"any"!==t.type&&(e.addAttribute("type",t.type),t.operator&&"list"!==t.type&&"between"!==t.operator&&e.addAttribute("operator",t.operator),t.allowBlank&&e.addAttribute("allowBlank","1")),t.showInputMessage&&e.addAttribute("showInputMessage","1"),t.promptTitle&&e.addAttribute("promptTitle",t.promptTitle),t.prompt&&e.addAttribute("prompt",t.prompt),t.showErrorMessage&&e.addAttribute("showErrorMessage","1"),t.errorStyle&&e.addAttribute("errorStyle",t.errorStyle),t.errorTitle&&e.addAttribute("errorTitle",t.errorTitle),t.error&&e.addAttribute("error",t.error),e.addAttribute("sqref",t.sqref),(t.formulae||[]).forEach(((r,n)=>{e.openNode("formula"+(n+1)),"date"===t.type?e.writeText(o.dateToExcel(new Date(r))):e.writeText(r),e.closeNode()})),e.closeNode()})),e.closeNode())}parseOpen(e){switch(e.name){case"dataValidations":return this.model={},!0;case"dataValidation":{this._address=e.attributes.sqref;const t={type:e.attributes.type||"any",formulae:[]};switch(e.attributes.type&&c(t,e.attributes,"allowBlank"),c(t,e.attributes,"showInputMessage"),c(t,e.attributes,"showErrorMessage"),t.type){case"any":case"list":case"custom":break;default:l(t,e.attributes,"operator","between")}return l(t,e.attributes,"promptTitle"),l(t,e.attributes,"prompt"),l(t,e.attributes,"errorStyle"),l(t,e.attributes,"errorTitle"),l(t,e.attributes,"error"),this._dataValidation=t,!0}case"formula1":case"formula2":return this._formula=[],!0;default:return!1}}parseText(e){this._formula&&this._formula.push(e)}parseClose(e){switch(e){case"dataValidations":return!1;case"dataValidation":return this._dataValidation.formulae&&this._dataValidation.formulae.length||(delete this._dataValidation.formulae,delete this._dataValidation.operator),(this._address.split(/\s+/g)||[]).forEach((e=>{e.includes(":")?new s(e).forEachAddress((e=>{this.model[e]=this._dataValidation})):this.model[e]=this._dataValidation})),!0;case"formula1":case"formula2":{let e=this._formula.join("");switch(this._dataValidation.type){case"whole":case"textLength":e=parseInt(e,10);break;case"decimal":e=parseFloat(e);break;case"date":e=o.excelToDate(parseFloat(e))}return this._dataValidation.formulae.push(e),this._formula=void 0,!0}default:return!0}}}},{"../../../doc/range":10,"../../../utils/col-cache":19,"../../../utils/under-dash":26,"../../../utils/utils":27,"../base-xform":32}],94:[function(e,t,r){"use strict";const n=e("../base-xform");t.exports=class extends n{get tag(){return"dimension"}render(e,t){t&&e.leafNode("dimension",{ref:t})}parseOpen(e){return"dimension"===e.name&&(this.model=e.attributes.ref,!0)}parseText(){}parseClose(){return!1}}},{"../base-xform":32}],95:[function(e,t,r){"use strict";const n=e("../base-xform");t.exports=class extends n{get tag(){return"drawing"}render(e,t){t&&e.leafNode(this.tag,{"r:id":t.rId})}parseOpen(e){return e.name===this.tag&&(this.model={rId:e.attributes["r:id"]},!0)}parseText(){}parseClose(){return!1}}},{"../base-xform":32}],96:[function(e,t,r){"use strict";const n=e("../composite-xform"),o=e("./cf-ext/conditional-formattings-ext-xform");class i extends n{constructor(){super(),this.map={"x14:conditionalFormattings":this.conditionalFormattings=new o}}get tag(){return"ext"}hasContent(e){return this.conditionalFormattings.hasContent(e.conditionalFormattings)}prepare(e,t){this.conditionalFormattings.prepare(e.conditionalFormattings,t)}render(e,t){e.openNode("ext",{uri:"{78C0D931-6437-407d-A8EE-F0AAD7539E65}","xmlns:x14":"http://schemas.microsoft.com/office/spreadsheetml/2009/9/main"}),this.conditionalFormattings.render(e,t.conditionalFormattings),e.closeNode()}createNewModel(){return{}}onParserClose(e,t){this.model[e]=t.model}}t.exports=class extends n{constructor(){super(),this.map={ext:this.ext=new i}}get tag(){return"extLst"}prepare(e,t){this.ext.prepare(e,t)}hasContent(e){return this.ext.hasContent(e)}render(e,t){this.hasContent(t)&&(e.openNode("extLst"),this.ext.render(e,t),e.closeNode())}createNewModel(){return{}}onParserClose(e,t){Object.assign(this.model,t.model)}}},{"../composite-xform":48,"./cf-ext/conditional-formattings-ext-xform":78}],97:[function(e,t,r){"use strict";const n=e("../base-xform");t.exports=class extends n{get tag(){return"headerFooter"}render(e,t){if(t){e.addRollback();let r=!1;e.openNode("headerFooter"),t.differentFirst&&(e.addAttribute("differentFirst","1"),r=!0),t.differentOddEven&&(e.addAttribute("differentOddEven","1"),r=!0),t.oddHeader&&"string"==typeof t.oddHeader&&(e.leafNode("oddHeader",null,t.oddHeader),r=!0),t.oddFooter&&"string"==typeof t.oddFooter&&(e.leafNode("oddFooter",null,t.oddFooter),r=!0),t.evenHeader&&"string"==typeof t.evenHeader&&(e.leafNode("evenHeader",null,t.evenHeader),r=!0),t.evenFooter&&"string"==typeof t.evenFooter&&(e.leafNode("evenFooter",null,t.evenFooter),r=!0),t.firstHeader&&"string"==typeof t.firstHeader&&(e.leafNode("firstHeader",null,t.firstHeader),r=!0),t.firstFooter&&"string"==typeof t.firstFooter&&(e.leafNode("firstFooter",null,t.firstFooter),r=!0),r?(e.closeNode(),e.commit()):e.rollback()}}parseOpen(e){switch(e.name){case"headerFooter":return this.model={},e.attributes.differentFirst&&(this.model.differentFirst=1===parseInt(e.attributes.differentFirst,0)),e.attributes.differentOddEven&&(this.model.differentOddEven=1===parseInt(e.attributes.differentOddEven,0)),!0;case"oddHeader":return this.currentNode="oddHeader",!0;case"oddFooter":return this.currentNode="oddFooter",!0;case"evenHeader":return this.currentNode="evenHeader",!0;case"evenFooter":return this.currentNode="evenFooter",!0;case"firstHeader":return this.currentNode="firstHeader",!0;case"firstFooter":return this.currentNode="firstFooter",!0;default:return!1}}parseText(e){switch(this.currentNode){case"oddHeader":this.model.oddHeader=e;break;case"oddFooter":this.model.oddFooter=e;break;case"evenHeader":this.model.evenHeader=e;break;case"evenFooter":this.model.evenFooter=e;break;case"firstHeader":this.model.firstHeader=e;break;case"firstFooter":this.model.firstFooter=e}}parseClose(){switch(this.currentNode){case"oddHeader":case"oddFooter":case"evenHeader":case"evenFooter":case"firstHeader":case"firstFooter":return this.currentNode=void 0,!0;default:return!1}}}},{"../base-xform":32}],98:[function(e,t,r){"use strict";const n=e("../base-xform");t.exports=class extends n{get tag(){return"hyperlink"}render(e,t){this.isInternalLink(t)?e.leafNode("hyperlink",{ref:t.address,"r:id":t.rId,tooltip:t.tooltip,location:t.target}):e.leafNode("hyperlink",{ref:t.address,"r:id":t.rId,tooltip:t.tooltip})}parseOpen(e){return"hyperlink"===e.name&&(this.model={address:e.attributes.ref,rId:e.attributes["r:id"],tooltip:e.attributes.tooltip},e.attributes.location&&(this.model.target=e.attributes.location),!0)}parseText(){}parseClose(){return!1}isInternalLink(e){return e.target&&/^[^!]+![a-zA-Z]+[\d]+$/.test(e.target)}}},{"../base-xform":32}],99:[function(e,t,r){"use strict";const n=e("../base-xform");t.exports=class extends n{get tag(){return"mergeCell"}render(e,t){e.leafNode("mergeCell",{ref:t})}parseOpen(e){return"mergeCell"===e.name&&(this.model=e.attributes.ref,!0)}parseText(){}parseClose(){return!1}}},{"../base-xform":32}],100:[function(e,t,r){"use strict";const n=e("../../../utils/under-dash"),o=e("../../../doc/range"),i=e("../../../utils/col-cache"),a=e("../../../doc/enums");t.exports=class{constructor(){this.merges={}}add(e){if(this.merges[e.master])this.merges[e.master].expandToAddress(e.address);else{const t=`${e.master}:${e.address}`;this.merges[e.master]=new o(t)}}get mergeCells(){return n.map(this.merges,(e=>e.range))}reconcile(e,t){n.each(e,(e=>{const r=i.decode(e);for(let e=r.top;e<=r.bottom;e++){const n=t[e-1];for(let t=r.left;t<=r.right;t++){const o=n.cells[t-1];o?o.type===a.ValueType.Merge&&(o.master=r.tl):n.cells[t]={type:a.ValueType.Null,address:i.encodeAddress(e,t)}}}}))}getMasterAddress(e){const t=this.hash[e];return t&&t.tl}}},{"../../../doc/enums":7,"../../../doc/range":10,"../../../utils/col-cache":19,"../../../utils/under-dash":26}],101:[function(e,t,r){"use strict";const n=e("../base-xform"),o=e=>void 0!==e;t.exports=class extends n{get tag(){return"outlinePr"}render(e,t){return!(!t||!o(t.summaryBelow)&&!o(t.summaryRight)||(e.leafNode(this.tag,{summaryBelow:o(t.summaryBelow)?Number(t.summaryBelow):void 0,summaryRight:o(t.summaryRight)?Number(t.summaryRight):void 0}),0))}parseOpen(e){return e.name===this.tag&&(this.model={summaryBelow:o(e.attributes.summaryBelow)?Boolean(Number(e.attributes.summaryBelow)):void 0,summaryRight:o(e.attributes.summaryRight)?Boolean(Number(e.attributes.summaryRight)):void 0},!0)}parseText(){}parseClose(){return!1}}},{"../base-xform":32}],102:[function(e,t,r){"use strict";const n=e("../base-xform");t.exports=class extends n{get tag(){return"brk"}render(e,t){e.leafNode("brk",t)}parseOpen(e){return"brk"===e.name&&(this.model=e.attributes.ref,!0)}parseText(){}parseClose(){return!1}}},{"../base-xform":32}],103:[function(e,t,r){"use strict";const n=e("../../../utils/under-dash"),o=e("../base-xform");t.exports=class extends o{get tag(){return"pageMargins"}render(e,t){if(t){const r={left:t.left,right:t.right,top:t.top,bottom:t.bottom,header:t.header,footer:t.footer};n.some(r,(e=>void 0!==e))&&e.leafNode(this.tag,r)}}parseOpen(e){return e.name===this.tag&&(this.model={left:parseFloat(e.attributes.left||.7),right:parseFloat(e.attributes.right||.7),top:parseFloat(e.attributes.top||.75),bottom:parseFloat(e.attributes.bottom||.75),header:parseFloat(e.attributes.header||.3),footer:parseFloat(e.attributes.footer||.3)},!0)}parseText(){}parseClose(){return!1}}},{"../../../utils/under-dash":26,"../base-xform":32}],104:[function(e,t,r){"use strict";const n=e("../base-xform");t.exports=class extends n{get tag(){return"pageSetUpPr"}render(e,t){return!(!t||!t.fitToPage||(e.leafNode(this.tag,{fitToPage:t.fitToPage?"1":void 0}),0))}parseOpen(e){return e.name===this.tag&&(this.model={fitToPage:"1"===e.attributes.fitToPage},!0)}parseText(){}parseClose(){return!1}}},{"../base-xform":32}],105:[function(e,t,r){"use strict";const n=e("../../../utils/under-dash"),o=e("../base-xform");function i(e){return e?"1":void 0}function a(e){if("overThenDown"===e)return e}function s(e){switch(e){case"atEnd":case"asDisplyed":return e;default:return}}function l(e){switch(e){case"dash":case"blank":case"NA":return e;default:return}}t.exports=class extends o{get tag(){return"pageSetup"}render(e,t){if(t){const r={paperSize:t.paperSize,orientation:t.orientation,horizontalDpi:t.horizontalDpi,verticalDpi:t.verticalDpi,pageOrder:a(t.pageOrder),blackAndWhite:i(t.blackAndWhite),draft:i(t.draft),cellComments:s(t.cellComments),errors:l(t.errors),scale:t.scale,fitToWidth:t.fitToWidth,fitToHeight:t.fitToHeight,firstPageNumber:t.firstPageNumber,useFirstPageNumber:i(t.firstPageNumber),usePrinterDefaults:i(t.usePrinterDefaults),copies:t.copies};n.some(r,(e=>void 0!==e))&&e.leafNode(this.tag,r)}}parseOpen(e){return e.name===this.tag&&(this.model={paperSize:(t=e.attributes.paperSize,void 0!==t?parseInt(t,10):void 0),orientation:e.attributes.orientation||"portrait",horizontalDpi:parseInt(e.attributes.horizontalDpi||"4294967295",10),verticalDpi:parseInt(e.attributes.verticalDpi||"4294967295",10),pageOrder:e.attributes.pageOrder||"downThenOver",blackAndWhite:"1"===e.attributes.blackAndWhite,draft:"1"===e.attributes.draft,cellComments:e.attributes.cellComments||"None",errors:e.attributes.errors||"displayed",scale:parseInt(e.attributes.scale||"100",10),fitToWidth:parseInt(e.attributes.fitToWidth||"1",10),fitToHeight:parseInt(e.attributes.fitToHeight||"1",10),firstPageNumber:parseInt(e.attributes.firstPageNumber||"1",10),useFirstPageNumber:"1"===e.attributes.useFirstPageNumber,usePrinterDefaults:"1"===e.attributes.usePrinterDefaults,copies:parseInt(e.attributes.copies||"1",10)},!0);var t}parseText(){}parseClose(){return!1}}},{"../../../utils/under-dash":26,"../base-xform":32}],106:[function(e,t,r){"use strict";const n=e("../base-xform");t.exports=class extends n{get tag(){return"picture"}render(e,t){t&&e.leafNode(this.tag,{"r:id":t.rId})}parseOpen(e){return e.name===this.tag&&(this.model={rId:e.attributes["r:id"]},!0)}parseText(){}parseClose(){return!1}}},{"../base-xform":32}],107:[function(e,t,r){"use strict";const n=e("../../../utils/under-dash"),o=e("../base-xform");function i(e){return e?"1":void 0}t.exports=class extends o{get tag(){return"printOptions"}render(e,t){if(t){const r={headings:i(t.showRowColHeaders),gridLines:i(t.showGridLines),horizontalCentered:i(t.horizontalCentered),verticalCentered:i(t.verticalCentered)};n.some(r,(e=>void 0!==e))&&e.leafNode(this.tag,r)}}parseOpen(e){return e.name===this.tag&&(this.model={showRowColHeaders:"1"===e.attributes.headings,showGridLines:"1"===e.attributes.gridLines,horizontalCentered:"1"===e.attributes.horizontalCentered,verticalCentered:"1"===e.attributes.verticalCentered},!0)}parseText(){}parseClose(){return!1}}},{"../../../utils/under-dash":26,"../base-xform":32}],108:[function(e,t,r){"use strict";const n=e("./page-breaks-xform"),o=e("../list-xform");t.exports=class extends o{constructor(){super({tag:"rowBreaks",count:!0,childXform:new n})}render(e,t){if(t&&t.length){e.openNode(this.tag,this.$),this.count&&(e.addAttribute(this.$count,t.length),e.addAttribute("manualBreakCount",t.length));const{childXform:r}=this;t.forEach((t=>{r.render(e,t)})),e.closeNode()}else this.empty&&e.leafNode(this.tag)}}},{"../list-xform":71,"./page-breaks-xform":102}],109:[function(e,t,r){"use strict";const n=e("../base-xform"),o=e("../../../utils/utils"),i=e("./cell-xform");t.exports=class extends n{constructor(e){super(),this.maxItems=e&&e.maxItems,this.map={c:new i}}get tag(){return"row"}prepare(e,t){const r=t.styles.addStyleModel(e.style);r&&(e.styleId=r);const n=this.map.c;e.cells.forEach((e=>{n.prepare(e,t)}))}render(e,t,r){e.openNode("row"),e.addAttribute("r",t.number),t.height&&(e.addAttribute("ht",t.height),e.addAttribute("customHeight","1")),t.hidden&&e.addAttribute("hidden","1"),t.min>0&&t.max>0&&t.min<=t.max&&e.addAttribute("spans",`${t.min}:${t.max}`),t.styleId&&(e.addAttribute("s",t.styleId),e.addAttribute("customFormat","1")),e.addAttribute("x14ac:dyDescent","0.25"),t.outlineLevel&&e.addAttribute("outlineLevel",t.outlineLevel),t.collapsed&&e.addAttribute("collapsed","1");const n=this.map.c;t.cells.forEach((t=>{n.render(e,t,r)})),e.closeNode()}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;if("row"===e.name){this.numRowsSeen+=1;const t=e.attributes.spans?e.attributes.spans.split(":").map((e=>parseInt(e,10))):[void 0,void 0],r=this.model={number:parseInt(e.attributes.r,10),min:t[0],max:t[1],cells:[]};return e.attributes.s&&(r.styleId=parseInt(e.attributes.s,10)),o.parseBoolean(e.attributes.hidden)&&(r.hidden=!0),o.parseBoolean(e.attributes.bestFit)&&(r.bestFit=!0),e.attributes.ht&&(r.height=parseFloat(e.attributes.ht)),e.attributes.outlineLevel&&(r.outlineLevel=parseInt(e.attributes.outlineLevel,10)),o.parseBoolean(e.attributes.collapsed)&&(r.collapsed=!0),!0}return this.parser=this.map[e.name],!!this.parser&&(this.parser.parseOpen(e),!0)}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){if(this.parser){if(!this.parser.parseClose(e)){if(this.model.cells.push(this.parser.model),this.maxItems&&this.model.cells.length>this.maxItems)throw new Error(`Max column count (${this.maxItems}) exceeded`);this.parser=void 0}return!0}return!1}reconcile(e,t){e.style=e.styleId?t.styles.getStyleModel(e.styleId):{},void 0!==e.styleId&&(e.styleId=void 0);const r=this.map.c;e.cells.forEach((e=>{r.reconcile(e,t)}))}}},{"../../../utils/utils":27,"../base-xform":32,"./cell-xform":73}],110:[function(e,t,r){"use strict";const n=e("../../../utils/under-dash"),o=e("../base-xform");t.exports=class extends o{get tag(){return"sheetFormatPr"}render(e,t){if(t){const r={defaultRowHeight:t.defaultRowHeight,outlineLevelRow:t.outlineLevelRow,outlineLevelCol:t.outlineLevelCol,"x14ac:dyDescent":t.dyDescent};t.defaultColWidth&&(r.defaultColWidth=t.defaultColWidth),t.defaultRowHeight&&15===t.defaultRowHeight||(r.customHeight="1"),n.some(r,(e=>void 0!==e))&&e.leafNode("sheetFormatPr",r)}}parseOpen(e){return"sheetFormatPr"===e.name&&(this.model={defaultRowHeight:parseFloat(e.attributes.defaultRowHeight||"0"),dyDescent:parseFloat(e.attributes["x14ac:dyDescent"]||"0"),outlineLevelRow:parseInt(e.attributes.outlineLevelRow||"0",10),outlineLevelCol:parseInt(e.attributes.outlineLevelCol||"0",10)},e.attributes.defaultColWidth&&(this.model.defaultColWidth=parseFloat(e.attributes.defaultColWidth)),!0)}parseText(){}parseClose(){return!1}}},{"../../../utils/under-dash":26,"../base-xform":32}],111:[function(e,t,r){"use strict";const n=e("../base-xform"),o=e("../style/color-xform"),i=e("./page-setup-properties-xform"),a=e("./outline-properties-xform");t.exports=class extends n{constructor(){super(),this.map={tabColor:new o("tabColor"),pageSetUpPr:new i,outlinePr:new a}}get tag(){return"sheetPr"}render(e,t){if(t){e.addRollback(),e.openNode("sheetPr");let r=!1;r=this.map.tabColor.render(e,t.tabColor)||r,r=this.map.pageSetUpPr.render(e,t.pageSetup)||r,r=this.map.outlinePr.render(e,t.outlineProperties)||r,r?(e.closeNode(),e.commit()):e.rollback()}}parseOpen(e){return this.parser?(this.parser.parseOpen(e),!0):e.name===this.tag?(this.reset(),!0):!!this.map[e.name]&&(this.parser=this.map[e.name],this.parser.parseOpen(e),!0)}parseText(e){return!!this.parser&&(this.parser.parseText(e),!0)}parseClose(e){return this.parser?(this.parser.parseClose(e)||(this.parser=void 0),!0):(this.map.tabColor.model||this.map.pageSetUpPr.model||this.map.outlinePr.model?(this.model={},this.map.tabColor.model&&(this.model.tabColor=this.map.tabColor.model),this.map.pageSetUpPr.model&&(this.model.pageSetup=this.map.pageSetUpPr.model),this.map.outlinePr.model&&(this.model.outlineProperties=this.map.outlinePr.model)):this.model=null,!1)}}},{"../base-xform":32,"../style/color-xform":128,"./outline-properties-xform":101,"./page-setup-properties-xform":104}],112:[function(e,t,r){"use strict";const n=e("../../../utils/under-dash"),o=e("../base-xform");function i(e,t){return e?t:void 0}function a(e,t){return e===t||void 0}t.exports=class extends o{get tag(){return"sheetProtection"}render(e,t){if(t){const r={sheet:i(t.sheet,"1"),selectLockedCells:!1===t.selectLockedCells?"1":void 0,selectUnlockedCells:!1===t.selectUnlockedCells?"1":void 0,formatCells:i(t.formatCells,"0"),formatColumns:i(t.formatColumns,"0"),formatRows:i(t.formatRows,"0"),insertColumns:i(t.insertColumns,"0"),insertRows:i(t.insertRows,"0"),insertHyperlinks:i(t.insertHyperlinks,"0"),deleteColumns:i(t.deleteColumns,"0"),deleteRows:i(t.deleteRows,"0"),sort:i(t.sort,"0"),autoFilter:i(t.autoFilter,"0"),pivotTables:i(t.pivotTables,"0")};t.sheet&&(r.algorithmName=t.algorithmName,r.hashValue=t.hashValue,r.saltValue=t.saltValue,r.spinCount=t.spinCount,r.objects=i(!1===t.objects,"1"),r.scenarios=i(!1===t.scenarios,"1")),n.some(r,(e=>void 0!==e))&&e.leafNode(this.tag,r)}}parseOpen(e){return e.name===this.tag&&(this.model={sheet:a(e.attributes.sheet,"1"),objects:"1"!==e.attributes.objects&&void 0,scenarios:"1"!==e.attributes.scenarios&&void 0,selectLockedCells:"1"!==e.attributes.selectLockedCells&&void 0,selectUnlockedCells:"1"!==e.attributes.selectUnlockedCells&&void 0,formatCells:a(e.attributes.formatCells,"0"),formatColumns:a(e.attributes.formatColumns,"0"),formatRows:a(e.attributes.formatRows,"0"),insertColumns:a(e.attributes.insertColumns,"0"),insertRows:a(e.attributes.insertRows,"0"),insertHyperlinks:a(e.attributes.insertHyperlinks,"0"),deleteColumns:a(e.attributes.deleteColumns,"0"),deleteRows:a(e.attributes.deleteRows,"0"),sort:a(e.attributes.sort,"0"),autoFilter:a(e.attributes.autoFilter,"0"),pivotTables:a(e.attributes.pivotTables,"0")},e.attributes.algorithmName&&(this.model.algorithmName=e.attributes.algorithmName,this.model.hashValue=e.attributes.hashValue,this.model.saltValue=e.attributes.saltValue,this.model.spinCount=parseInt(e.attributes.spinCount,10)),!0)}parseText(){}parseClose(){return!1}}},{"../../../utils/under-dash":26,"../base-xform":32}],113:[function(e,t,r){"use strict";const n=e("../../../utils/col-cache"),o=e("../base-xform"),i={frozen:"frozen",frozenSplit:"frozen",split:"split"};t.exports=class extends o{get tag(){return"sheetView"}prepare(e){switch(e.state){case"frozen":case"split":break;default:e.state="normal"}}render(e,t){e.openNode("sheetView",{workbookViewId:t.workbookViewId||0});const r=function(t,r,n){n&&e.addAttribute(t,r)};let o,i,a,s;switch(r("rightToLeft","1",!0===t.rightToLeft),r("tabSelected","1",t.tabSelected),r("showRuler","0",!1===t.showRuler),r("showRowColHeaders","0",!1===t.showRowColHeaders),r("showGridLines","0",!1===t.showGridLines),r("zoomScale",t.zoomScale,t.zoomScale),r("zoomScaleNormal",t.zoomScaleNormal,t.zoomScaleNormal),r("view",t.style,t.style),t.state){case"frozen":i=t.xSplit||0,a=t.ySplit||0,o=t.topLeftCell||n.getAddress(a+1,i+1).address,s=(t.xSplit&&t.ySplit?"bottomRight":t.xSplit&&"topRight")||"bottomLeft",e.leafNode("pane",{xSplit:t.xSplit||void 0,ySplit:t.ySplit||void 0,topLeftCell:o,activePane:s,state:"frozen"}),e.leafNode("selection",{pane:s,activeCell:t.activeCell,sqref:t.activeCell});break;case"split":"topLeft"===t.activePane&&(t.activePane=void 0),e.leafNode("pane",{xSplit:t.xSplit||void 0,ySplit:t.ySplit||void 0,topLeftCell:t.topLeftCell,activePane:t.activePane}),e.leafNode("selection",{pane:t.activePane,activeCell:t.activeCell,sqref:t.activeCell});break;case"normal":t.activeCell&&e.leafNode("selection",{activeCell:t.activeCell,sqref:t.activeCell})}e.closeNode()}parseOpen(e){switch(e.name){case"sheetView":return this.sheetView={workbookViewId:parseInt(e.attributes.workbookViewId,10),rightToLeft:"1"===e.attributes.rightToLeft,tabSelected:"1"===e.attributes.tabSelected,showRuler:!("0"===e.attributes.showRuler),showRowColHeaders:!("0"===e.attributes.showRowColHeaders),showGridLines:!("0"===e.attributes.showGridLines),zoomScale:parseInt(e.attributes.zoomScale||"100",10),zoomScaleNormal:parseInt(e.attributes.zoomScaleNormal||"100",10),style:e.attributes.view},this.pane=void 0,this.selections={},!0;case"pane":return this.pane={xSplit:parseInt(e.attributes.xSplit||"0",10),ySplit:parseInt(e.attributes.ySplit||"0",10),topLeftCell:e.attributes.topLeftCell,activePane:e.attributes.activePane||"topLeft",state:e.attributes.state},!0;case"selection":{const t=e.attributes.pane||"topLeft";return this.selections[t]={pane:t,activeCell:e.attributes.activeCell},!0}default:return!1}}parseText(){}parseClose(e){let t,r;return"sheetView"!==e||(this.sheetView&&this.pane?(t=this.model={workbookViewId:this.sheetView.workbookViewId,rightToLeft:this.sheetView.rightToLeft,state:i[this.pane.state]||"split",xSplit:this.pane.xSplit,ySplit:this.pane.ySplit,topLeftCell:this.pane.topLeftCell,showRuler:this.sheetView.showRuler,showRowColHeaders:this.sheetView.showRowColHeaders,showGridLines:this.sheetView.showGridLines,zoomScale:this.sheetView.zoomScale,zoomScaleNormal:this.sheetView.zoomScaleNormal},"split"===this.model.state&&(t.activePane=this.pane.activePane),r=this.selections[this.pane.activePane],r&&r.activeCell&&(t.activeCell=r.activeCell),this.sheetView.style&&(t.style=this.sheetView.style)):(t=this.model={workbookViewId:this.sheetView.workbookViewId,rightToLeft:this.sheetView.rightToLeft,state:"normal",showRuler:this.sheetView.showRuler,showRowColHeaders:this.sheetView.showRowColHeaders,showGridLines:this.sheetView.showGridLines,zoomScale:this.sheetView.zoomScale,zoomScaleNormal:this.sheetView.zoomScaleNormal},r=this.selections.topLeft,r&&r.activeCell&&(t.activeCell=r.activeCell),this.sheetView.style&&(t.style=this.sheetView.style)),!1)}reconcile(){}}},{"../../../utils/col-cache":19,"../base-xform":32}],114:[function(e,t,r){"use strict";const n=e("../base-xform");t.exports=class extends n{get tag(){return"tablePart"}render(e,t){t&&e.leafNode(this.tag,{"r:id":t.rId})}parseOpen(e){return e.name===this.tag&&(this.model={rId:e.attributes["r:id"]},!0)}parseText(){}parseClose(){return!1}}},{"../base-xform":32}],115:[function(e,t,r){"use strict";const n=e("../../../utils/under-dash"),o=e("../../../utils/col-cache"),i=e("../../../utils/xml-stream"),a=e("../../rel-type"),s=e("./merges"),l=e("../base-xform"),c=e("../list-xform"),u=e("./row-xform"),d=e("./col-xform"),f=e("./dimension-xform"),h=e("./hyperlink-xform"),p=e("./merge-cell-xform"),m=e("./data-validations-xform"),g=e("./sheet-properties-xform"),v=e("./sheet-format-properties-xform"),b=e("./sheet-view-xform"),y=e("./sheet-protection-xform"),w=e("./page-margins-xform"),x=e("./page-setup-xform"),S=e("./print-options-xform"),C=e("./auto-filter-xform"),k=e("./picture-xform"),E=e("./drawing-xform"),O=e("./table-part-xform"),A=e("./row-breaks-xform"),T=e("./header-footer-xform"),j=e("./cf/conditional-formattings-xform"),P=e("./ext-lst-xform");class M extends l{constructor(e){super();const{maxRows:t,maxCols:r,ignoreNodes:n}=e||{};this.ignoreNodes=n||[],this.map={sheetPr:new g,dimension:new f,sheetViews:new c({tag:"sheetViews",count:!1,childXform:new b}),sheetFormatPr:new v,cols:new c({tag:"cols",count:!1,childXform:new d}),sheetData:new c({tag:"sheetData",count:!1,empty:!0,childXform:new u({maxItems:r}),maxItems:t}),autoFilter:new C,mergeCells:new c({tag:"mergeCells",count:!0,childXform:new p}),rowBreaks:new A,hyperlinks:new c({tag:"hyperlinks",count:!1,childXform:new h}),pageMargins:new w,dataValidations:new m,pageSetup:new x,headerFooter:new T,printOptions:new S,picture:new k,drawing:new E,sheetProtection:new y,tableParts:new c({tag:"tableParts",count:!0,childXform:new O}),conditionalFormatting:new j,extLst:new P}}prepare(e,t){t.merges=new s,e.hyperlinks=t.hyperlinks=[],e.comments=t.comments=[],t.formulae={},t.siFormulae=0,this.map.cols.prepare(e.cols,t),this.map.sheetData.prepare(e.rows,t),this.map.conditionalFormatting.prepare(e.conditionalFormattings,t),e.mergeCells=t.merges.mergeCells;const r=e.rels=[];function n(e){return"rId"+(e.length+1)}if(e.hyperlinks.forEach((e=>{const t=n(r);e.rId=t,r.push({Id:t,Type:a.Hyperlink,Target:e.target,TargetMode:"External"})})),e.comments.length>0){const i={Id:n(r),Type:a.Comments,Target:`../comments${e.id}.xml`};r.push(i);const s={Id:n(r),Type:a.VmlDrawing,Target:`../drawings/vmlDrawing${e.id}.vml`};r.push(s),e.comments.forEach((e=>{e.refAddress=o.decodeAddress(e.ref)})),t.commentRefs.push({commentName:"comments"+e.id,vmlDrawing:"vmlDrawing"+e.id})}const i=[];let l;e.media.forEach((o=>{if("background"===o.type){const i=n(r);l=t.media[o.imageId],r.push({Id:i,Type:a.Image,Target:`../media/${l.name}.${l.extension}`}),e.background={rId:i},e.image=t.media[o.imageId]}else if("image"===o.type){let{drawing:s}=e;l=t.media[o.imageId],s||(s=e.drawing={rId:n(r),name:"drawing"+ ++t.drawingsCount,anchors:[],rels:[]},t.drawings.push(s),r.push({Id:s.rId,Type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/drawing",Target:`../drawings/${s.name}.xml`}));let c=this.preImageId===o.imageId?i[o.imageId]:i[s.rels.length];c||(c=n(s.rels),i[s.rels.length]=c,s.rels.push({Id:c,Type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",Target:`../media/${l.name}.${l.extension}`}));const u={picture:{rId:c},range:o.range};if(o.hyperlinks&&o.hyperlinks.hyperlink){const e=n(s.rels);i[s.rels.length]=e,u.picture.hyperlinks={tooltip:o.hyperlinks.tooltip,rId:e},s.rels.push({Id:e,Type:a.Hyperlink,Target:o.hyperlinks.hyperlink,TargetMode:"External"})}this.preImageId=o.imageId,s.anchors.push(u)}})),e.tables.forEach((e=>{const o=n(r);e.rId=o,r.push({Id:o,Type:a.Table,Target:"../tables/"+e.target}),e.columns.forEach((e=>{const{style:r}=e;r&&(e.dxfId=t.styles.addDxfStyle(r))}))})),this.map.extLst.prepare(e,t)}render(e,t){e.openXml(i.StdDocAttributes),e.openNode("worksheet",M.WORKSHEET_ATTRIBUTES);const r=t.properties?{defaultRowHeight:t.properties.defaultRowHeight,dyDescent:t.properties.dyDescent,outlineLevelCol:t.properties.outlineLevelCol,outlineLevelRow:t.properties.outlineLevelRow}:void 0;t.properties&&t.properties.defaultColWidth&&(r.defaultColWidth=t.properties.defaultColWidth);const n={outlineProperties:t.properties&&t.properties.outlineProperties,tabColor:t.properties&&t.properties.tabColor,pageSetup:t.pageSetup&&t.pageSetup.fitToPage?{fitToPage:t.pageSetup.fitToPage}:void 0},o=t.pageSetup&&t.pageSetup.margins,s={showRowColHeaders:t.pageSetup&&t.pageSetup.showRowColHeaders,showGridLines:t.pageSetup&&t.pageSetup.showGridLines,horizontalCentered:t.pageSetup&&t.pageSetup.horizontalCentered,verticalCentered:t.pageSetup&&t.pageSetup.verticalCentered},l=t.sheetProtection;this.map.sheetPr.render(e,n),this.map.dimension.render(e,t.dimensions),this.map.sheetViews.render(e,t.views),this.map.sheetFormatPr.render(e,r),this.map.cols.render(e,t.cols),this.map.sheetData.render(e,t.rows),this.map.sheetProtection.render(e,l),this.map.autoFilter.render(e,t.autoFilter),this.map.mergeCells.render(e,t.mergeCells),this.map.conditionalFormatting.render(e,t.conditionalFormattings),this.map.dataValidations.render(e,t.dataValidations),this.map.hyperlinks.render(e,t.hyperlinks),this.map.printOptions.render(e,s),this.map.pageMargins.render(e,o),this.map.pageSetup.render(e,t.pageSetup),this.map.headerFooter.render(e,t.headerFooter),this.map.rowBreaks.render(e,t.rowBreaks),this.map.drawing.render(e,t.drawing),this.map.picture.render(e,t.background),this.map.tableParts.render(e,t.tables),this.map.extLst.render(e,t),t.rels&&t.rels.forEach((t=>{t.Type===a.VmlDrawing&&e.leafNode("legacyDrawing",{"r:id":t.Id})})),e.closeNode()}parseOpen(e){return this.parser?(this.parser.parseOpen(e),!0):"worksheet"===e.name?(n.each(this.map,(e=>{e.reset()})),!0):(this.map[e.name]&&!this.ignoreNodes.includes(e.name)&&(this.parser=this.map[e.name],this.parser.parseOpen(e)),!0)}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){if(this.parser)return this.parser.parseClose(e)||(this.parser=void 0),!0;if("worksheet"===e){const e=this.map.sheetFormatPr.model||{};this.map.sheetPr.model&&this.map.sheetPr.model.tabColor&&(e.tabColor=this.map.sheetPr.model.tabColor),this.map.sheetPr.model&&this.map.sheetPr.model.outlineProperties&&(e.outlineProperties=this.map.sheetPr.model.outlineProperties);const t={fitToPage:this.map.sheetPr.model&&this.map.sheetPr.model.pageSetup&&this.map.sheetPr.model.pageSetup.fitToPage||!1,margins:this.map.pageMargins.model},r=Object.assign(t,this.map.pageSetup.model,this.map.printOptions.model),n=((e,t)=>{if(!t||!t.length)return e;if(!e||!e.length)return t;const r={},n={};return e.forEach((e=>{r[e.ref]=e,e.rules.forEach((e=>{const{x14Id:t}=e;t&&(n[t]=e)}))})),t.forEach((t=>{t.rules.forEach((o=>{const i=n[o.x14Id];i?((e,t)=>{Object.keys(t).forEach((r=>{const n=e[r],o=t[r];void 0===n&&void 0!==o&&(e[r]=o)}))})(i,o):r[t.ref]?r[t.ref].rules.push(o):e.push({ref:t.ref,rules:[o]})}))})),e})(this.map.conditionalFormatting.model,this.map.extLst.model&&this.map.extLst.model["x14:conditionalFormattings"]);return this.model={dimensions:this.map.dimension.model,cols:this.map.cols.model,rows:this.map.sheetData.model,mergeCells:this.map.mergeCells.model,hyperlinks:this.map.hyperlinks.model,dataValidations:this.map.dataValidations.model,properties:e,views:this.map.sheetViews.model,pageSetup:r,headerFooter:this.map.headerFooter.model,background:this.map.picture.model,drawing:this.map.drawing.model,tables:this.map.tableParts.model,conditionalFormattings:n},this.map.autoFilter.model&&(this.model.autoFilter=this.map.autoFilter.model),this.map.sheetProtection.model&&(this.model.sheetProtection=this.map.sheetProtection.model),!1}return!0}reconcile(e,t){const r=(e.relationships||[]).reduce(((r,n)=>{if(r[n.Id]=n,n.Type===a.Comments&&(e.comments=t.comments[n.Target].comments),n.Type===a.VmlDrawing&&e.comments&&e.comments.length){const r=t.vmlDrawings[n.Target].comments;e.comments.forEach(((e,t)=>{e.note=Object.assign({},e.note,r[t])}))}return r}),{});if(t.commentsMap=(e.comments||[]).reduce(((e,t)=>(t.ref&&(e[t.ref]=t),e)),{}),t.hyperlinkMap=(e.hyperlinks||[]).reduce(((e,t)=>(t.rId&&(e[t.address]=r[t.rId].Target),e)),{}),t.formulae={},e.rows=e.rows&&e.rows.filter(Boolean)||[],e.rows.forEach((e=>{e.cells=e.cells&&e.cells.filter(Boolean)||[]})),this.map.cols.reconcile(e.cols,t),this.map.sheetData.reconcile(e.rows,t),this.map.conditionalFormatting.reconcile(e.conditionalFormattings,t),e.media=[],e.drawing){const n=r[e.drawing.rId].Target.match(/\/drawings\/([a-zA-Z0-9]+)[.][a-zA-Z]{3,4}$/);if(n){const r=n[1];t.drawings[r].anchors.forEach((t=>{if(t.medium){const r={type:"image",imageId:t.medium.index,range:t.range,hyperlinks:t.picture.hyperlinks};e.media.push(r)}}))}}const n=e.background&&r[e.background.rId];if(n){const r=n.Target.split("/media/")[1],o=t.mediaIndex&&t.mediaIndex[r];void 0!==o&&e.media.push({type:"background",imageId:o})}e.tables=(e.tables||[]).map((e=>{const n=r[e.rId];return t.tables[n.Target]})),delete e.relationships,delete e.hyperlinks,delete e.comments}}M.WORKSHEET_ATTRIBUTES={xmlns:"http://schemas.openxmlformats.org/spreadsheetml/2006/main","xmlns:r":"http://schemas.openxmlformats.org/officeDocument/2006/relationships","xmlns:mc":"http://schemas.openxmlformats.org/markup-compatibility/2006","mc:Ignorable":"x14ac","xmlns:x14ac":"http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac"},t.exports=M},{"../../../utils/col-cache":19,"../../../utils/under-dash":26,"../../../utils/xml-stream":28,"../../rel-type":31,"../base-xform":32,"../list-xform":71,"./auto-filter-xform":72,"./cf/conditional-formattings-xform":87,"./col-xform":92,"./data-validations-xform":93,"./dimension-xform":94,"./drawing-xform":95,"./ext-lst-xform":96,"./header-footer-xform":97,"./hyperlink-xform":98,"./merge-cell-xform":99,"./merges":100,"./page-margins-xform":103,"./page-setup-xform":105,"./picture-xform":106,"./print-options-xform":107,"./row-breaks-xform":108,"./row-xform":109,"./sheet-format-properties-xform":110,"./sheet-properties-xform":111,"./sheet-protection-xform":112,"./sheet-view-xform":113,"./table-part-xform":114}],116:[function(e,t,r){"use strict";const n=e("../base-xform");t.exports=class extends n{constructor(e){super(),this.tag=e.tag,this.attr=e.attr}render(e,t){t&&(e.openNode(this.tag),e.closeNode())}parseOpen(e){e.name===this.tag&&(this.model=!0)}parseText(){}parseClose(){return!1}}},{"../base-xform":32}],117:[function(e,t,r){"use strict";const n=e("../base-xform");t.exports=class extends n{constructor(e){super(),this.tag=e.tag,this.attr=e.attr,this.attrs=e.attrs,this._format=e.format||function(e){try{return Number.isNaN(e.getTime())?"":e.toISOString()}catch(e){return""}},this._parse=e.parse||function(e){return new Date(e)}}render(e,t){t&&(e.openNode(this.tag),this.attrs&&e.addAttributes(this.attrs),this.attr?e.addAttribute(this.attr,this._format(t)):e.writeText(this._format(t)),e.closeNode())}parseOpen(e){e.name===this.tag&&(this.attr?this.model=this._parse(e.attributes[this.attr]):this.text=[])}parseText(e){this.attr||this.text.push(e)}parseClose(){return this.attr||(this.model=this._parse(this.text.join(""))),!1}}},{"../base-xform":32}],118:[function(e,t,r){"use strict";const n=e("../base-xform");t.exports=class extends n{constructor(e){super(),this.tag=e.tag,this.attr=e.attr,this.attrs=e.attrs,this.zero=e.zero}render(e,t){(t||this.zero)&&(e.openNode(this.tag),this.attrs&&e.addAttributes(this.attrs),this.attr?e.addAttribute(this.attr,t):e.writeText(t),e.closeNode())}parseOpen(e){return e.name===this.tag&&(this.attr?this.model=parseInt(e.attributes[this.attr],10):this.text=[],!0)}parseText(e){this.attr||this.text.push(e)}parseClose(){return this.attr||(this.model=parseInt(this.text.join("")||0,10)),!1}}},{"../base-xform":32}],119:[function(e,t,r){"use strict";const n=e("../base-xform");t.exports=class extends n{constructor(e){super(),this.tag=e.tag,this.attr=e.attr,this.attrs=e.attrs}render(e,t){void 0!==t&&(e.openNode(this.tag),this.attrs&&e.addAttributes(this.attrs),this.attr?e.addAttribute(this.attr,t):e.writeText(t),e.closeNode())}parseOpen(e){e.name===this.tag&&(this.attr?this.model=e.attributes[this.attr]:this.text=[])}parseText(e){this.attr||this.text.push(e)}parseClose(){return this.attr||(this.model=this.text.join("")),!1}}},{"../base-xform":32}],120:[function(e,t,r){"use strict";const n=e("./base-xform"),o=e("../../utils/xml-stream");t.exports=class extends n{constructor(e){super(),this._model=e}render(e){if(!this._xml){const e=new o;!function e(t,r){t.openNode(r.tag,r.$),r.c&&r.c.forEach((r=>{e(t,r)})),r.t&&t.writeText(r.t),t.closeNode()}(e,this._model),this._xml=e.xml}e.writeXml(this._xml)}parseOpen(){return!0}parseText(){}parseClose(e){return e!==this._model.tag}}},{"../../utils/xml-stream":28,"./base-xform":32}],121:[function(e,t,r){"use strict";const n=e("./text-xform"),o=e("./rich-text-xform"),i=e("../base-xform");t.exports=class extends i{constructor(){super(),this.map={r:new o,t:new n}}get tag(){return"rPh"}render(e,t){if(e.openNode(this.tag,{sb:t.sb||0,eb:t.eb||0}),t&&t.hasOwnProperty("richText")&&t.richText){const{r}=this.map;t.richText.forEach((t=>{r.render(e,t)}))}else t&&this.map.t.render(e,t.text);e.closeNode()}parseOpen(e){const{name:t}=e;return this.parser?(this.parser.parseOpen(e),!0):t===this.tag?(this.model={sb:parseInt(e.attributes.sb,10),eb:parseInt(e.attributes.eb,10)},!0):(this.parser=this.map[t],!!this.parser&&(this.parser.parseOpen(e),!0))}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){if(this.parser){if(!this.parser.parseClose(e)){switch(e){case"r":{let e=this.model.richText;e||(e=this.model.richText=[]),e.push(this.parser.model);break}case"t":this.model.text=this.parser.model}this.parser=void 0}return!0}return e!==this.tag}}},{"../base-xform":32,"./rich-text-xform":122,"./text-xform":125}],122:[function(e,t,r){"use strict";const n=e("./text-xform"),o=e("../style/font-xform"),i=e("../base-xform");class a extends i{constructor(e){super(),this.model=e}get tag(){return"r"}get textXform(){return this._textXform||(this._textXform=new n)}get fontXform(){return this._fontXform||(this._fontXform=new o(a.FONT_OPTIONS))}render(e,t){t=t||this.model,e.openNode("r"),t.font&&this.fontXform.render(e,t.font),this.textXform.render(e,t.text),e.closeNode()}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;switch(e.name){case"r":return this.model={},!0;case"t":return this.parser=this.textXform,this.parser.parseOpen(e),!0;case"rPr":return this.parser=this.fontXform,this.parser.parseOpen(e),!0;default:return!1}}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){switch(e){case"r":return!1;case"t":return this.model.text=this.parser.model,this.parser=void 0,!0;case"rPr":return this.model.font=this.parser.model,this.parser=void 0,!0;default:return this.parser&&this.parser.parseClose(e),!0}}}a.FONT_OPTIONS={tagName:"rPr",fontNameTag:"rFont"},t.exports=a},{"../base-xform":32,"../style/font-xform":131,"./text-xform":125}],123:[function(e,t,r){"use strict";const n=e("./text-xform"),o=e("./rich-text-xform"),i=e("./phonetic-text-xform"),a=e("../base-xform");t.exports=class extends a{constructor(e){super(),this.model=e,this.map={r:new o,t:new n,rPh:new i}}get tag(){return"si"}render(e,t){e.openNode(this.tag),t&&t.hasOwnProperty("richText")&&t.richText?t.richText.length?t.richText.forEach((t=>{this.map.r.render(e,t)})):this.map.t.render(e,""):null!=t&&this.map.t.render(e,t),e.closeNode()}parseOpen(e){const{name:t}=e;return this.parser?(this.parser.parseOpen(e),!0):t===this.tag?(this.model={},!0):(this.parser=this.map[t],!!this.parser&&(this.parser.parseOpen(e),!0))}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){if(this.parser){if(!this.parser.parseClose(e)){switch(e){case"r":{let e=this.model.richText;e||(e=this.model.richText=[]),e.push(this.parser.model);break}case"t":this.model=this.parser.model}this.parser=void 0}return!0}return e!==this.tag}}},{"../base-xform":32,"./phonetic-text-xform":121,"./rich-text-xform":122,"./text-xform":125}],124:[function(e,t,r){"use strict";const n=e("../../../utils/xml-stream"),o=e("../base-xform"),i=e("./shared-string-xform");t.exports=class extends o{constructor(e){super(),this.model=e||{values:[],count:0},this.hash=Object.create(null),this.rich=Object.create(null)}get sharedStringXform(){return this._sharedStringXform||(this._sharedStringXform=new i)}get values(){return this.model.values}get uniqueCount(){return this.model.values.length}get count(){return this.model.count}getString(e){return this.model.values[e]}add(e){return e.richText?this.addRichText(e):this.addText(e)}addText(e){let t=this.hash[e];return void 0===t&&(t=this.hash[e]=this.model.values.length,this.model.values.push(e)),this.model.count++,t}addRichText(e){const t=this.sharedStringXform.toXml(e);let r=this.rich[t];return void 0===r&&(r=this.rich[t]=this.model.values.length,this.model.values.push(e)),this.model.count++,r}render(e,t){t=t||this._values,e.openXml(n.StdDocAttributes),e.openNode("sst",{xmlns:"http://schemas.openxmlformats.org/spreadsheetml/2006/main",count:t.count,uniqueCount:t.values.length});const r=this.sharedStringXform;t.values.forEach((t=>{r.render(e,t)})),e.closeNode()}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;switch(e.name){case"sst":return!0;case"si":return this.parser=this.sharedStringXform,this.parser.parseOpen(e),!0;default:throw new Error("Unexpected xml node in parseOpen: "+JSON.stringify(e))}}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){if(this.parser)return this.parser.parseClose(e)||(this.model.values.push(this.parser.model),this.model.count++,this.parser=void 0),!0;if("sst"===e)return!1;throw new Error("Unexpected xml node in parseClose: "+e)}}},{"../../../utils/xml-stream":28,"../base-xform":32,"./shared-string-xform":123}],125:[function(e,t,r){"use strict";const n=e("../base-xform");t.exports=class extends n{get tag(){return"t"}render(e,t){e.openNode("t"),/^\s|\n|\s$/.test(t)&&e.addAttribute("xml:space","preserve"),e.writeText(t),e.closeNode()}get model(){return this._text.join("").replace(/_x([0-9A-F]{4})_/g,((e,t)=>String.fromCharCode(parseInt(t,16))))}parseOpen(e){return"t"===e.name&&(this._text=[],!0)}parseText(e){this._text.push(e)}parseClose(){return!1}}},{"../base-xform":32}],126:[function(e,t,r){"use strict";const n=e("../../../doc/enums"),o=e("../../../utils/utils"),i=e("../base-xform"),a={horizontalValues:["left","center","right","fill","centerContinuous","distributed","justify"].reduce(((e,t)=>(e[t]=!0,e)),{}),horizontal(e){return this.horizontalValues[e]?e:void 0},verticalValues:["top","middle","bottom","distributed","justify"].reduce(((e,t)=>(e[t]=!0,e)),{}),vertical(e){return"middle"===e?"center":this.verticalValues[e]?e:void 0},wrapText:e=>!!e||void 0,shrinkToFit:e=>!!e||void 0,textRotation:e=>"vertical"===e||(e=o.validInt(e))>=-90&&e<=90?e:void 0,indent:e=>(e=o.validInt(e),Math.max(0,e)),readingOrder(e){switch(e){case"ltr":return n.ReadingOrder.LeftToRight;case"rtl":return n.ReadingOrder.RightToLeft;default:return}}},s={toXml(e){if(e=a.textRotation(e)){if("vertical"===e)return 255;const t=Math.round(e);if(t>=0&&t<=90)return t;if(t<0&&t>=-90)return 90-t}},toModel(e){const t=o.validInt(e);if(void 0!==t){if(255===t)return"vertical";if(t>=0&&t<=90)return t;if(t>90&&t<=180)return 90-t}}};t.exports=class extends i{get tag(){return"alignment"}render(e,t){e.addRollback(),e.openNode("alignment");let r=!1;function n(t,n){n&&(e.addAttribute(t,n),r=!0)}n("horizontal",a.horizontal(t.horizontal)),n("vertical",a.vertical(t.vertical)),n("wrapText",!!a.wrapText(t.wrapText)&&"1"),n("shrinkToFit",!!a.shrinkToFit(t.shrinkToFit)&&"1"),n("indent",a.indent(t.indent)),n("textRotation",s.toXml(t.textRotation)),n("readingOrder",a.readingOrder(t.readingOrder)),e.closeNode(),r?e.commit():e.rollback()}parseOpen(e){const t={};let r=!1;function n(e,n,o){e&&(t[n]=o,r=!0)}n(e.attributes.horizontal,"horizontal",e.attributes.horizontal),n(e.attributes.vertical,"vertical","center"===e.attributes.vertical?"middle":e.attributes.vertical),n(e.attributes.wrapText,"wrapText",o.parseBoolean(e.attributes.wrapText)),n(e.attributes.shrinkToFit,"shrinkToFit",o.parseBoolean(e.attributes.shrinkToFit)),n(e.attributes.indent,"indent",parseInt(e.attributes.indent,10)),n(e.attributes.textRotation,"textRotation",s.toModel(e.attributes.textRotation)),n(e.attributes.readingOrder,"readingOrder","2"===e.attributes.readingOrder?"rtl":"ltr"),this.model=r?t:null}parseText(){}parseClose(){return!1}}},{"../../../doc/enums":7,"../../../utils/utils":27,"../base-xform":32}],127:[function(e,t,r){"use strict";const n=e("../base-xform"),o=e("../../../utils/utils"),i=e("./color-xform");class a extends n{constructor(e){super(),this.name=e,this.map={color:new i}}get tag(){return this.name}render(e,t,r){const n=t&&t.color||r||this.defaultColor;e.openNode(this.name),t&&t.style&&(e.addAttribute("style",t.style),n&&this.map.color.render(e,n)),e.closeNode()}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;switch(e.name){case this.name:{const{style:t}=e.attributes;return this.model=t?{style:t}:void 0,!0}case"color":return this.parser=this.map.color,this.parser.parseOpen(e),!0;default:return!1}}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){return this.parser?(this.parser.parseClose(e)||(this.parser=void 0),!0):(e===this.name&&this.map.color.model&&(this.model||(this.model={}),this.model.color=this.map.color.model),!1)}validStyle(e){return a.validStyleValues[e]}}a.validStyleValues=["thin","dashed","dotted","dashDot","hair","dashDotDot","slantDashDot","mediumDashed","mediumDashDotDot","mediumDashDot","medium","double","thick"].reduce(((e,t)=>(e[t]=!0,e)),{}),t.exports=class extends n{constructor(){super(),this.map={top:new a("top"),left:new a("left"),bottom:new a("bottom"),right:new a("right"),diagonal:new a("diagonal")}}render(e,t){const{color:r}=t;function n(n,o){n&&!n.color&&t.color&&(n={...n,color:t.color}),o.render(e,n,r)}e.openNode("border"),t.diagonal&&t.diagonal.style&&(t.diagonal.up&&e.addAttribute("diagonalUp","1"),t.diagonal.down&&e.addAttribute("diagonalDown","1")),n(t.left,this.map.left),n(t.right,this.map.right),n(t.top,this.map.top),n(t.bottom,this.map.bottom),n(t.diagonal,this.map.diagonal),e.closeNode()}parseOpen(e){return this.parser?(this.parser.parseOpen(e),!0):"border"===e.name?(this.reset(),this.diagonalUp=o.parseBoolean(e.attributes.diagonalUp),this.diagonalDown=o.parseBoolean(e.attributes.diagonalDown),!0):(this.parser=this.map[e.name],!!this.parser&&(this.parser.parseOpen(e),!0))}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){if(this.parser)return this.parser.parseClose(e)||(this.parser=void 0),!0;if("border"===e){const e=this.model={},t=function(t,r,n){r&&(n&&Object.assign(r,n),e[t]=r)};t("left",this.map.left.model),t("right",this.map.right.model),t("top",this.map.top.model),t("bottom",this.map.bottom.model),t("diagonal",this.map.diagonal.model,{up:this.diagonalUp,down:this.diagonalDown})}return!1}}},{"../../../utils/utils":27,"../base-xform":32,"./color-xform":128}],128:[function(e,t,r){"use strict";const n=e("../base-xform");t.exports=class extends n{constructor(e){super(),this.name=e||"color"}get tag(){return this.name}render(e,t){return!!t&&(e.openNode(this.name),t.argb?e.addAttribute("rgb",t.argb):void 0!==t.theme?(e.addAttribute("theme",t.theme),void 0!==t.tint&&e.addAttribute("tint",t.tint)):void 0!==t.indexed?e.addAttribute("indexed",t.indexed):e.addAttribute("auto","1"),e.closeNode(),!0)}parseOpen(e){return e.name===this.name&&(e.attributes.rgb?this.model={argb:e.attributes.rgb}:e.attributes.theme?(this.model={theme:parseInt(e.attributes.theme,10)},e.attributes.tint&&(this.model.tint=parseFloat(e.attributes.tint))):e.attributes.indexed?this.model={indexed:parseInt(e.attributes.indexed,10)}:this.model=void 0,!0)}parseText(){}parseClose(){return!1}}},{"../base-xform":32}],129:[function(e,t,r){"use strict";const n=e("../base-xform"),o=e("./alignment-xform"),i=e("./border-xform"),a=e("./fill-xform"),s=e("./font-xform"),l=e("./numfmt-xform"),c=e("./protection-xform");t.exports=class extends n{constructor(){super(),this.map={alignment:new o,border:new i,fill:new a,font:new s,numFmt:new l,protection:new c}}get tag(){return"dxf"}render(e,t){if(e.openNode(this.tag),t.font&&this.map.font.render(e,t.font),t.numFmt&&t.numFmtId){const r={id:t.numFmtId,formatCode:t.numFmt};this.map.numFmt.render(e,r)}t.fill&&this.map.fill.render(e,t.fill),t.alignment&&this.map.alignment.render(e,t.alignment),t.border&&this.map.border.render(e,t.border),t.protection&&this.map.protection.render(e,t.protection),e.closeNode()}parseOpen(e){return this.parser?(this.parser.parseOpen(e),!0):e.name===this.tag?(this.reset(),!0):(this.parser=this.map[e.name],this.parser&&this.parser.parseOpen(e),!0)}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){return this.parser?(this.parser.parseClose(e)||(this.parser=void 0),!0):e!==this.tag||(this.model={alignment:this.map.alignment.model,border:this.map.border.model,fill:this.map.fill.model,font:this.map.font.model,numFmt:this.map.numFmt.model,protection:this.map.protection.model},!1)}}},{"../base-xform":32,"./alignment-xform":126,"./border-xform":127,"./fill-xform":130,"./font-xform":131,"./numfmt-xform":132,"./protection-xform":133}],130:[function(e,t,r){"use strict";const n=e("../base-xform"),o=e("./color-xform");class i extends n{constructor(){super(),this.map={color:new o}}get tag(){return"stop"}render(e,t){e.openNode("stop"),e.addAttribute("position",t.position),this.map.color.render(e,t.color),e.closeNode()}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;switch(e.name){case"stop":return this.model={position:parseFloat(e.attributes.position)},!0;case"color":return this.parser=this.map.color,this.parser.parseOpen(e),!0;default:return!1}}parseText(){}parseClose(e){return!!this.parser&&(this.parser.parseClose(e)||(this.model.color=this.parser.model,this.parser=void 0),!0)}}class a extends n{constructor(){super(),this.map={fgColor:new o("fgColor"),bgColor:new o("bgColor")}}get name(){return"pattern"}get tag(){return"patternFill"}render(e,t){e.openNode("patternFill"),e.addAttribute("patternType",t.pattern),t.fgColor&&this.map.fgColor.render(e,t.fgColor),t.bgColor&&this.map.bgColor.render(e,t.bgColor),e.closeNode()}parseOpen(e){return this.parser?(this.parser.parseOpen(e),!0):"patternFill"===e.name?(this.model={type:"pattern",pattern:e.attributes.patternType},!0):(this.parser=this.map[e.name],!!this.parser&&(this.parser.parseOpen(e),!0))}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){return!!this.parser&&(this.parser.parseClose(e)||(this.parser.model&&(this.model[e]=this.parser.model),this.parser=void 0),!0)}}class s extends n{constructor(){super(),this.map={stop:new i}}get name(){return"gradient"}get tag(){return"gradientFill"}render(e,t){switch(e.openNode("gradientFill"),t.gradient){case"angle":e.addAttribute("degree",t.degree);break;case"path":e.addAttribute("type","path"),t.center.left&&(e.addAttribute("left",t.center.left),void 0===t.center.right&&e.addAttribute("right",t.center.left)),t.center.right&&e.addAttribute("right",t.center.right),t.center.top&&(e.addAttribute("top",t.center.top),void 0===t.center.bottom&&e.addAttribute("bottom",t.center.top)),t.center.bottom&&e.addAttribute("bottom",t.center.bottom)}const r=this.map.stop;t.stops.forEach((t=>{r.render(e,t)})),e.closeNode()}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;switch(e.name){case"gradientFill":{const t=this.model={stops:[]};return e.attributes.degree?(t.gradient="angle",t.degree=parseInt(e.attributes.degree,10)):"path"===e.attributes.type&&(t.gradient="path",t.center={left:e.attributes.left?parseFloat(e.attributes.left):0,top:e.attributes.top?parseFloat(e.attributes.top):0},e.attributes.right!==e.attributes.left&&(t.center.right=e.attributes.right?parseFloat(e.attributes.right):0),e.attributes.bottom!==e.attributes.top&&(t.center.bottom=e.attributes.bottom?parseFloat(e.attributes.bottom):0)),!0}case"stop":return this.parser=this.map.stop,this.parser.parseOpen(e),!0;default:return!1}}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){return!!this.parser&&(this.parser.parseClose(e)||(this.model.stops.push(this.parser.model),this.parser=void 0),!0)}}class l extends n{constructor(){super(),this.map={patternFill:new a,gradientFill:new s}}get tag(){return"fill"}render(e,t){switch(e.addRollback(),e.openNode("fill"),t.type){case"pattern":this.map.patternFill.render(e,t);break;case"gradient":this.map.gradientFill.render(e,t);break;default:return void e.rollback()}e.closeNode(),e.commit()}parseOpen(e){return this.parser?(this.parser.parseOpen(e),!0):"fill"===e.name?(this.model={},!0):(this.parser=this.map[e.name],!!this.parser&&(this.parser.parseOpen(e),!0))}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){return!!this.parser&&(this.parser.parseClose(e)||(this.model=this.parser.model,this.model.type=this.parser.name,this.parser=void 0),!0)}validStyle(e){return l.validPatternValues[e]}}l.validPatternValues=["none","solid","darkVertical","darkGray","mediumGray","lightGray","gray125","gray0625","darkHorizontal","darkVertical","darkDown","darkUp","darkGrid","darkTrellis","lightHorizontal","lightVertical","lightDown","lightUp","lightGrid","lightTrellis","lightGrid"].reduce(((e,t)=>(e[t]=!0,e)),{}),l.StopXform=i,l.PatternFillXform=a,l.GradientFillXform=s,t.exports=l},{"../base-xform":32,"./color-xform":128}],131:[function(e,t,r){"use strict";const n=e("./color-xform"),o=e("../simple/boolean-xform"),i=e("../simple/integer-xform"),a=e("../simple/string-xform"),s=e("./underline-xform"),l=e("../../../utils/under-dash"),c=e("../base-xform");class u extends c{constructor(e){super(),this.options=e||u.OPTIONS,this.map={b:{prop:"bold",xform:new o({tag:"b",attr:"val"})},i:{prop:"italic",xform:new o({tag:"i",attr:"val"})},u:{prop:"underline",xform:new s},charset:{prop:"charset",xform:new i({tag:"charset",attr:"val"})},color:{prop:"color",xform:new n},condense:{prop:"condense",xform:new o({tag:"condense",attr:"val"})},extend:{prop:"extend",xform:new o({tag:"extend",attr:"val"})},family:{prop:"family",xform:new i({tag:"family",attr:"val"})},outline:{prop:"outline",xform:new o({tag:"outline",attr:"val"})},vertAlign:{prop:"vertAlign",xform:new a({tag:"vertAlign",attr:"val"})},scheme:{prop:"scheme",xform:new a({tag:"scheme",attr:"val"})},shadow:{prop:"shadow",xform:new o({tag:"shadow",attr:"val"})},strike:{prop:"strike",xform:new o({tag:"strike",attr:"val"})},sz:{prop:"size",xform:new i({tag:"sz",attr:"val"})}},this.map[this.options.fontNameTag]={prop:"name",xform:new a({tag:this.options.fontNameTag,attr:"val"})}}get tag(){return this.options.tagName}render(e,t){const{map:r}=this;e.openNode(this.options.tagName),l.each(this.map,((n,o)=>{r[o].xform.render(e,t[n.prop])})),e.closeNode()}parseOpen(e){return this.parser?(this.parser.parseOpen(e),!0):this.map[e.name]?(this.parser=this.map[e.name].xform,this.parser.parseOpen(e)):e.name===this.options.tagName&&(this.model={},!0)}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){if(this.parser&&!this.parser.parseClose(e)){const t=this.map[e];return this.parser.model&&(this.model[t.prop]=this.parser.model),this.parser=void 0,!0}return e!==this.options.tagName}}u.OPTIONS={tagName:"font",fontNameTag:"name"},t.exports=u},{"../../../utils/under-dash":26,"../base-xform":32,"../simple/boolean-xform":116,"../simple/integer-xform":118,"../simple/string-xform":119,"./color-xform":128,"./underline-xform":136}],132:[function(e,t,r){"use strict";const n=e("../../../utils/under-dash"),o=e("../../defaultnumformats"),i=e("../base-xform"),a=function(){const e={};return n.each(o,((t,r)=>{t.f&&(e[t.f]=parseInt(r,10))})),e}();class s extends i{constructor(e,t){super(),this.id=e,this.formatCode=t}get tag(){return"numFmt"}render(e,t){e.leafNode("numFmt",{numFmtId:t.id,formatCode:t.formatCode})}parseOpen(e){return"numFmt"===e.name&&(this.model={id:parseInt(e.attributes.numFmtId,10),formatCode:e.attributes.formatCode.replace(/[\\](.)/g,"$1")},!0)}parseText(){}parseClose(){return!1}}s.getDefaultFmtId=function(e){return a[e]},s.getDefaultFmtCode=function(e){return o[e]&&o[e].f},t.exports=s},{"../../../utils/under-dash":26,"../../defaultnumformats":30,"../base-xform":32}],133:[function(e,t,r){"use strict";const n=e("../base-xform"),o=(e,t)=>void 0===e?t:e;t.exports=class extends n{get tag(){return"protection"}render(e,t){e.addRollback(),e.openNode("protection");let r=!1;function n(t,n){void 0!==n&&(e.addAttribute(t,n),r=!0)}n("locked",o(t.locked,!0)?void 0:"0"),n("hidden",o(t.hidden,!1)?"1":void 0),e.closeNode(),r?e.commit():e.rollback()}parseOpen(e){const t={locked:!("0"===e.attributes.locked),hidden:"1"===e.attributes.hidden},r=!t.locked||t.hidden;this.model=r?t:null}parseText(){}parseClose(){return!1}}},{"../base-xform":32}],134:[function(e,t,r){"use strict";const n=e("../base-xform"),o=e("./alignment-xform"),i=e("./protection-xform");t.exports=class extends n{constructor(e){super(),this.xfId=!(!e||!e.xfId),this.map={alignment:new o,protection:new i}}get tag(){return"xf"}render(e,t){e.openNode("xf",{numFmtId:t.numFmtId||0,fontId:t.fontId||0,fillId:t.fillId||0,borderId:t.borderId||0}),this.xfId&&e.addAttribute("xfId",t.xfId||0),t.numFmtId&&e.addAttribute("applyNumberFormat","1"),t.fontId&&e.addAttribute("applyFont","1"),t.fillId&&e.addAttribute("applyFill","1"),t.borderId&&e.addAttribute("applyBorder","1"),t.alignment&&e.addAttribute("applyAlignment","1"),t.protection&&e.addAttribute("applyProtection","1"),t.alignment&&this.map.alignment.render(e,t.alignment),t.protection&&this.map.protection.render(e,t.protection),e.closeNode()}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;switch(e.name){case"xf":return this.model={numFmtId:parseInt(e.attributes.numFmtId,10),fontId:parseInt(e.attributes.fontId,10),fillId:parseInt(e.attributes.fillId,10),borderId:parseInt(e.attributes.borderId,10)},this.xfId&&(this.model.xfId=parseInt(e.attributes.xfId,10)),!0;case"alignment":return this.parser=this.map.alignment,this.parser.parseOpen(e),!0;case"protection":return this.parser=this.map.protection,this.parser.parseOpen(e),!0;default:return!1}}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){return this.parser?(this.parser.parseClose(e)||(this.map.protection===this.parser?this.model.protection=this.parser.model:this.model.alignment=this.parser.model,this.parser=void 0),!0):"xf"!==e}}},{"../base-xform":32,"./alignment-xform":126,"./protection-xform":133}],135:[function(e,t,r){"use strict";const n=e("../../../doc/enums"),o=e("../../../utils/xml-stream"),i=e("../base-xform"),a=e("../static-xform"),s=e("../list-xform"),l=e("./font-xform"),c=e("./fill-xform"),u=e("./border-xform"),d=e("./numfmt-xform"),f=e("./style-xform"),h=e("./dxf-xform");class p extends i{constructor(e){super(),this.map={numFmts:new s({tag:"numFmts",count:!0,childXform:new d}),fonts:new s({tag:"fonts",count:!0,childXform:new l,$:{"x14ac:knownFonts":1}}),fills:new s({tag:"fills",count:!0,childXform:new c}),borders:new s({tag:"borders",count:!0,childXform:new u}),cellStyleXfs:new s({tag:"cellStyleXfs",count:!0,childXform:new f}),cellXfs:new s({tag:"cellXfs",count:!0,childXform:new f({xfId:!0})}),dxfs:new s({tag:"dxfs",always:!0,count:!0,childXform:new h}),numFmt:new d,font:new l,fill:new c,border:new u,style:new f({xfId:!0}),cellStyles:p.STATIC_XFORMS.cellStyles,tableStyles:p.STATIC_XFORMS.tableStyles,extLst:p.STATIC_XFORMS.extLst},e&&this.init()}initIndex(){this.index={style:{},numFmt:{},numFmtNextId:164,font:{},border:{},fill:{}}}init(){this.model={styles:[],numFmts:[],fonts:[],borders:[],fills:[],dxfs:[]},this.initIndex(),this._addBorder({}),this._addStyle({numFmtId:0,fontId:0,fillId:0,borderId:0,xfId:0}),this._addFill({type:"pattern",pattern:"none"}),this._addFill({type:"pattern",pattern:"gray125"}),this.weakMap=new WeakMap}render(e,t){t=t||this.model,e.openXml(o.StdDocAttributes),e.openNode("styleSheet",p.STYLESHEET_ATTRIBUTES),this.index?(t.numFmts&&t.numFmts.length&&(e.openNode("numFmts",{count:t.numFmts.length}),t.numFmts.forEach((t=>{e.writeXml(t)})),e.closeNode()),t.fonts.length||this._addFont({size:11,color:{theme:1},name:"Calibri",family:2,scheme:"minor"}),e.openNode("fonts",{count:t.fonts.length,"x14ac:knownFonts":1}),t.fonts.forEach((t=>{e.writeXml(t)})),e.closeNode(),e.openNode("fills",{count:t.fills.length}),t.fills.forEach((t=>{e.writeXml(t)})),e.closeNode(),e.openNode("borders",{count:t.borders.length}),t.borders.forEach((t=>{e.writeXml(t)})),e.closeNode(),this.map.cellStyleXfs.render(e,[{numFmtId:0,fontId:0,fillId:0,borderId:0,xfId:0}]),e.openNode("cellXfs",{count:t.styles.length}),t.styles.forEach((t=>{e.writeXml(t)})),e.closeNode()):(this.map.numFmts.render(e,t.numFmts),this.map.fonts.render(e,t.fonts),this.map.fills.render(e,t.fills),this.map.borders.render(e,t.borders),this.map.cellStyleXfs.render(e,[{numFmtId:0,fontId:0,fillId:0,borderId:0,xfId:0}]),this.map.cellXfs.render(e,t.styles)),p.STATIC_XFORMS.cellStyles.render(e),this.map.dxfs.render(e,t.dxfs),p.STATIC_XFORMS.tableStyles.render(e),p.STATIC_XFORMS.extLst.render(e),e.closeNode()}parseOpen(e){return this.parser?(this.parser.parseOpen(e),!0):"styleSheet"===e.name?(this.initIndex(),!0):(this.parser=this.map[e.name],this.parser&&this.parser.parseOpen(e),!0)}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){if(this.parser)return this.parser.parseClose(e)||(this.parser=void 0),!0;if("styleSheet"===e){this.model={};const e=(e,t)=>{t.model&&t.model.length&&(this.model[e]=t.model)};if(e("numFmts",this.map.numFmts),e("fonts",this.map.fonts),e("fills",this.map.fills),e("borders",this.map.borders),e("styles",this.map.cellXfs),e("dxfs",this.map.dxfs),this.index={model:[],numFmt:[]},this.model.numFmts){const e=this.index.numFmt;this.model.numFmts.forEach((t=>{e[t.id]=t.formatCode}))}return!1}return!0}addStyleModel(e,t){if(!e)return 0;if(this.model.fonts.length||this._addFont({size:11,color:{theme:1},name:"Calibri",family:2,scheme:"minor"}),this.weakMap&&this.weakMap.has(e))return this.weakMap.get(e);const r={};if(t=t||n.ValueType.Number,e.numFmt)r.numFmtId=this._addNumFmtStr(e.numFmt);else switch(t){case n.ValueType.Number:r.numFmtId=this._addNumFmtStr("General");break;case n.ValueType.Date:r.numFmtId=this._addNumFmtStr("mm-dd-yy")}e.font&&(r.fontId=this._addFont(e.font)),e.border&&(r.borderId=this._addBorder(e.border)),e.fill&&(r.fillId=this._addFill(e.fill)),e.alignment&&(r.alignment=e.alignment),e.protection&&(r.protection=e.protection);const o=this._addStyle(r);return this.weakMap&&this.weakMap.set(e,o),o}getStyleModel(e){const t=this.model.styles[e];if(!t)return null;let r=this.index.model[e];if(r)return r;if(r=this.index.model[e]={},t.numFmtId){const e=this.index.numFmt[t.numFmtId]||d.getDefaultFmtCode(t.numFmtId);e&&(r.numFmt=e)}function n(e,t,n){if(n||0===n){const o=t[n];o&&(r[e]=o)}}return n("font",this.model.fonts,t.fontId),n("border",this.model.borders,t.borderId),n("fill",this.model.fills,t.fillId),t.alignment&&(r.alignment=t.alignment),t.protection&&(r.protection=t.protection),r}addDxfStyle(e){return e.numFmt&&(e.numFmtId=this._addNumFmtStr(e.numFmt)),this.model.dxfs.push(e),this.model.dxfs.length-1}getDxfStyle(e){return this.model.dxfs[e]}_addStyle(e){const t=this.map.style.toXml(e);let r=this.index.style[t];return void 0===r&&(r=this.index.style[t]=this.model.styles.length,this.model.styles.push(t)),r}_addNumFmtStr(e){let t=d.getDefaultFmtId(e);if(void 0!==t)return t;if(t=this.index.numFmt[e],void 0!==t)return t;t=this.index.numFmt[e]=164+this.model.numFmts.length;const r=this.map.numFmt.toXml({id:t,formatCode:e});return this.model.numFmts.push(r),t}_addFont(e){const t=this.map.font.toXml(e);let r=this.index.font[t];return void 0===r&&(r=this.index.font[t]=this.model.fonts.length,this.model.fonts.push(t)),r}_addBorder(e){const t=this.map.border.toXml(e);let r=this.index.border[t];return void 0===r&&(r=this.index.border[t]=this.model.borders.length,this.model.borders.push(t)),r}_addFill(e){const t=this.map.fill.toXml(e);let r=this.index.fill[t];return void 0===r&&(r=this.index.fill[t]=this.model.fills.length,this.model.fills.push(t)),r}}p.STYLESHEET_ATTRIBUTES={xmlns:"http://schemas.openxmlformats.org/spreadsheetml/2006/main","xmlns:mc":"http://schemas.openxmlformats.org/markup-compatibility/2006","mc:Ignorable":"x14ac x16r2","xmlns:x14ac":"http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac","xmlns:x16r2":"http://schemas.microsoft.com/office/spreadsheetml/2015/02/main"},p.STATIC_XFORMS={cellStyles:new a({tag:"cellStyles",$:{count:1},c:[{tag:"cellStyle",$:{name:"Normal",xfId:0,builtinId:0}}]}),dxfs:new a({tag:"dxfs",$:{count:0}}),tableStyles:new a({tag:"tableStyles",$:{count:0,defaultTableStyle:"TableStyleMedium2",defaultPivotStyle:"PivotStyleLight16"}}),extLst:new a({tag:"extLst",c:[{tag:"ext",$:{uri:"{EB79DEF2-80B8-43e5-95BD-54CBDDF9020C}","xmlns:x14":"http://schemas.microsoft.com/office/spreadsheetml/2009/9/main"},c:[{tag:"x14:slicerStyles",$:{defaultSlicerStyle:"SlicerStyleLight1"}}]},{tag:"ext",$:{uri:"{9260A510-F301-46a8-8635-F512D64BE5F5}","xmlns:x15":"http://schemas.microsoft.com/office/spreadsheetml/2010/11/main"},c:[{tag:"x15:timelineStyles",$:{defaultTimelineStyle:"TimeSlicerStyleLight1"}}]}]})},p.Mock=class extends p{constructor(){super(),this.model={styles:[{numFmtId:0,fontId:0,fillId:0,borderId:0,xfId:0}],numFmts:[],fonts:[{size:11,color:{theme:1},name:"Calibri",family:2,scheme:"minor"}],borders:[{}],fills:[{type:"pattern",pattern:"none"},{type:"pattern",pattern:"gray125"}]}}parseStream(e){return e.autodrain(),Promise.resolve()}addStyleModel(e,t){return t===n.ValueType.Date?this.dateStyleId:0}get dateStyleId(){if(!this._dateStyleId){const e={numFmtId:d.getDefaultFmtId("mm-dd-yy")};this._dateStyleId=this.model.styles.length,this.model.styles.push(e)}return this._dateStyleId}getStyleModel(){return{}}},t.exports=p},{"../../../doc/enums":7,"../../../utils/xml-stream":28,"../base-xform":32,"../list-xform":71,"../static-xform":120,"./border-xform":127,"./dxf-xform":129,"./fill-xform":130,"./font-xform":131,"./numfmt-xform":132,"./style-xform":134}],136:[function(e,t,r){"use strict";const n=e("../base-xform");class o extends n{constructor(e){super(),this.model=e}get tag(){return"u"}render(e,t){if(!0===(t=t||this.model))e.leafNode("u");else{const r=o.Attributes[t];r&&e.leafNode("u",r)}}parseOpen(e){"u"===e.name&&(this.model=e.attributes.val||!0)}parseText(){}parseClose(){return!1}}o.Attributes={single:{},double:{val:"double"},singleAccounting:{val:"singleAccounting"},doubleAccounting:{val:"doubleAccounting"}},t.exports=o},{"../base-xform":32}],137:[function(e,t,r){"use strict";const n=e("../base-xform"),o=e("./filter-column-xform");t.exports=class extends n{constructor(){super(),this.map={filterColumn:new o}}get tag(){return"autoFilter"}prepare(e){e.columns.forEach(((e,t)=>{this.map.filterColumn.prepare(e,{index:t})}))}render(e,t){return e.openNode(this.tag,{ref:t.autoFilterRef}),t.columns.forEach((t=>{this.map.filterColumn.render(e,t)})),e.closeNode(),!0}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;if(e.name===this.tag)return this.model={autoFilterRef:e.attributes.ref,columns:[]},!0;if(this.parser=this.map[e.name],this.parser)return this.parseOpen(e),!0;throw new Error("Unexpected xml node in parseOpen: "+JSON.stringify(e))}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){if(this.parser)return this.parser.parseClose(e)||(this.model.columns.push(this.parser.model),this.parser=void 0),!0;if(e===this.tag)return!1;throw new Error("Unexpected xml node in parseClose: "+e)}}},{"../base-xform":32,"./filter-column-xform":139}],138:[function(e,t,r){"use strict";const n=e("../base-xform");t.exports=class extends n{get tag(){return"customFilter"}render(e,t){e.leafNode(this.tag,{val:t.val,operator:t.operator})}parseOpen(e){return e.name===this.tag&&(this.model={val:e.attributes.val,operator:e.attributes.operator},!0)}parseText(){}parseClose(){return!1}}},{"../base-xform":32}],139:[function(e,t,r){"use strict";const n=e("../base-xform"),o=e("../list-xform"),i=e("./custom-filter-xform"),a=e("./filter-xform");t.exports=class extends n{constructor(){super(),this.map={customFilters:new o({tag:"customFilters",count:!1,empty:!0,childXform:new i}),filters:new o({tag:"filters",count:!1,empty:!0,childXform:new a})}}get tag(){return"filterColumn"}prepare(e,t){e.colId=t.index.toString()}render(e,t){return t.customFilters?(e.openNode(this.tag,{colId:t.colId,hiddenButton:t.filterButton?"0":"1"}),this.map.customFilters.render(e,t.customFilters),e.closeNode(),!0):(e.leafNode(this.tag,{colId:t.colId,hiddenButton:t.filterButton?"0":"1"}),!0)}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;const{attributes:t}=e;if(e.name===this.tag)return this.model={filterButton:"0"===t.hiddenButton},!0;if(this.parser=this.map[e.name],this.parser)return this.parseOpen(e),!0;throw new Error("Unexpected xml node in parseOpen: "+JSON.stringify(e))}parseText(){}parseClose(e){return this.parser?(this.parser.parseClose(e)||(this.parser=void 0),!0):e!==this.tag||(this.model.customFilters=this.map.customFilters.model,!1)}}},{"../base-xform":32,"../list-xform":71,"./custom-filter-xform":138,"./filter-xform":140}],140:[function(e,t,r){"use strict";const n=e("../base-xform");t.exports=class extends n{get tag(){return"filter"}render(e,t){e.leafNode(this.tag,{val:t.val})}parseOpen(e){return e.name===this.tag&&(this.model={val:e.attributes.val},!0)}parseText(){}parseClose(){return!1}}},{"../base-xform":32}],141:[function(e,t,r){"use strict";const n=e("../base-xform");t.exports=class extends n{get tag(){return"tableColumn"}prepare(e,t){e.id=t.index+1}render(e,t){return e.leafNode(this.tag,{id:t.id.toString(),name:t.name,totalsRowLabel:t.totalsRowLabel,totalsRowFunction:t.totalsRowFunction,dxfId:t.dxfId}),!0}parseOpen(e){if(e.name===this.tag){const{attributes:t}=e;return this.model={name:t.name,totalsRowLabel:t.totalsRowLabel,totalsRowFunction:t.totalsRowFunction,dxfId:t.dxfId},!0}return!1}parseText(){}parseClose(){return!1}}},{"../base-xform":32}],142:[function(e,t,r){"use strict";const n=e("../base-xform");t.exports=class extends n{get tag(){return"tableStyleInfo"}render(e,t){return e.leafNode(this.tag,{name:t.theme?t.theme:void 0,showFirstColumn:t.showFirstColumn?"1":"0",showLastColumn:t.showLastColumn?"1":"0",showRowStripes:t.showRowStripes?"1":"0",showColumnStripes:t.showColumnStripes?"1":"0"}),!0}parseOpen(e){if(e.name===this.tag){const{attributes:t}=e;return this.model={theme:t.name?t.name:null,showFirstColumn:"1"===t.showFirstColumn,showLastColumn:"1"===t.showLastColumn,showRowStripes:"1"===t.showRowStripes,showColumnStripes:"1"===t.showColumnStripes},!0}return!1}parseText(){}parseClose(){return!1}}},{"../base-xform":32}],143:[function(e,t,r){"use strict";const n=e("../../../utils/xml-stream"),o=e("../base-xform"),i=e("../list-xform"),a=e("./auto-filter-xform"),s=e("./table-column-xform"),l=e("./table-style-info-xform");class c extends o{constructor(){super(),this.map={autoFilter:new a,tableColumns:new i({tag:"tableColumns",count:!0,empty:!0,childXform:new s}),tableStyleInfo:new l}}prepare(e,t){this.map.autoFilter.prepare(e),this.map.tableColumns.prepare(e.columns,t)}get tag(){return"table"}render(e,t){e.openXml(n.StdDocAttributes),e.openNode(this.tag,{...c.TABLE_ATTRIBUTES,id:t.id,name:t.name,displayName:t.displayName||t.name,ref:t.tableRef,totalsRowCount:t.totalsRow?"1":void 0,totalsRowShown:t.totalsRow?void 0:"1",headerRowCount:t.headerRow?"1":"0"}),this.map.autoFilter.render(e,t),this.map.tableColumns.render(e,t.columns),this.map.tableStyleInfo.render(e,t.style),e.closeNode()}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;const{name:t,attributes:r}=e;return t===this.tag?(this.reset(),this.model={name:r.name,displayName:r.displayName||r.name,tableRef:r.ref,totalsRow:"1"===r.totalsRowCount,headerRow:"1"===r.headerRowCount}):(this.parser=this.map[e.name],this.parser&&this.parser.parseOpen(e)),!0}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){return this.parser?(this.parser.parseClose(e)||(this.parser=void 0),!0):e!==this.tag||(this.model.columns=this.map.tableColumns.model,this.map.autoFilter.model&&(this.model.autoFilterRef=this.map.autoFilter.model.autoFilterRef,this.map.autoFilter.model.columns.forEach(((e,t)=>{this.model.columns[t].filterButton=e.filterButton}))),this.model.style=this.map.tableStyleInfo.model,!1)}reconcile(e,t){e.columns.forEach((e=>{void 0!==e.dxfId&&(e.style=t.styles.getDxfStyle(e.dxfId))}))}}c.TABLE_ATTRIBUTES={xmlns:"http://schemas.openxmlformats.org/spreadsheetml/2006/main","xmlns:mc":"http://schemas.openxmlformats.org/markup-compatibility/2006","mc:Ignorable":"xr xr3","xmlns:xr":"http://schemas.microsoft.com/office/spreadsheetml/2014/revision","xmlns:xr3":"http://schemas.microsoft.com/office/spreadsheetml/2016/revision3"},t.exports=c},{"../../../utils/xml-stream":28,"../base-xform":32,"../list-xform":71,"./auto-filter-xform":137,"./table-column-xform":141,"./table-style-info-xform":142}],144:[function(e,t,r){(function(r,n){(function(){"use strict";const o=e("fs"),i=e("jszip"),{PassThrough:a}=e("readable-stream"),s=e("../utils/zip-stream"),l=e("../utils/stream-buf"),c=e("../utils/utils"),u=e("../utils/xml-stream"),{bufferToString:d}=e("../utils/browser-buffer-decode"),f=e("./xform/style/styles-xform"),h=e("./xform/core/core-xform"),p=e("./xform/strings/shared-strings-xform"),m=e("./xform/core/relationships-xform"),g=e("./xform/core/content-types-xform"),v=e("./xform/core/app-xform"),b=e("./xform/book/workbook-xform"),y=e("./xform/sheet/worksheet-xform"),w=e("./xform/drawing/drawing-xform"),x=e("./xform/table/table-xform"),S=e("./xform/comment/comments-xform"),C=e("./xform/comment/vml-notes-xform"),k=e("./xml/theme1");class E{constructor(e){this.workbook=e}async readFile(e,t){if(!await c.fs.exists(e))throw new Error("File not found: "+e);const r=o.createReadStream(e);try{const e=await this.read(r,t);return r.close(),e}catch(e){throw r.close(),e}}parseRels(e){return(new m).parseStream(e)}parseWorkbook(e){return(new b).parseStream(e)}parseSharedStrings(e){return(new p).parseStream(e)}reconcile(e,t){const r=new b,n=new y(t),o=new w,i=new x;r.reconcile(e);const a={media:e.media,mediaIndex:e.mediaIndex};Object.keys(e.drawings).forEach((t=>{const r=e.drawings[t],n=e.drawingRels[t];n&&(a.rels=n.reduce(((e,t)=>(e[t.Id]=t,e)),{}),(r.anchors||[]).forEach((e=>{const t=e.picture&&e.picture.hyperlinks;t&&a.rels[t.rId]&&(t.hyperlink=a.rels[t.rId].Target,delete t.rId)})),o.reconcile(r,a))}));const s={styles:e.styles};Object.values(e.tables).forEach((e=>{i.reconcile(e,s)}));const l={styles:e.styles,sharedStrings:e.sharedStrings,media:e.media,mediaIndex:e.mediaIndex,date1904:e.properties&&e.properties.date1904,drawings:e.drawings,comments:e.comments,tables:e.tables,vmlDrawings:e.vmlDrawings};e.worksheets.forEach((t=>{t.relationships=e.worksheetRels[t.sheetNo],n.reconcile(t,l)})),delete e.worksheetHash,delete e.worksheetRels,delete e.globalRels,delete e.sharedStrings,delete e.workbookRels,delete e.sheetDefs,delete e.styles,delete e.mediaIndex,delete e.drawings,delete e.drawingRels,delete e.vmlDrawings}async _processWorksheetEntry(e,t,r,n,o){const i=new y(n),a=await i.parseStream(e);a.sheetNo=r,t.worksheetHash[o]=a,t.worksheets.push(a)}async _processCommentEntry(e,t,r){const n=new S,o=await n.parseStream(e);t.comments[`../${r}.xml`]=o}async _processTableEntry(e,t,r){const n=new x,o=await n.parseStream(e);t.tables[`../tables/${r}.xml`]=o}async _processWorksheetRelsEntry(e,t,r){const n=new m,o=await n.parseStream(e);t.worksheetRels[r]=o}async _processMediaEntry(e,t,r){const n=r.lastIndexOf(".");if(n>=1){const o=r.substr(n+1),i=r.substr(0,n);await new Promise(((n,a)=>{const s=new l;s.on("finish",(()=>{t.mediaIndex[r]=t.media.length,t.mediaIndex[i]=t.media.length;const e={type:"image",name:i,extension:o,buffer:s.toBuffer()};t.media.push(e),n()})),e.on("error",(e=>{a(e)})),e.pipe(s)}))}}async _processDrawingEntry(e,t,r){const n=new w,o=await n.parseStream(e);t.drawings[r]=o}async _processDrawingRelsEntry(e,t,r){const n=new m,o=await n.parseStream(e);t.drawingRels[r]=o}async _processVmlDrawingEntry(e,t,r){const n=new C,o=await n.parseStream(e);t.vmlDrawings[`../drawings/${r}.vml`]=o}async _processThemeEntry(e,t,r){await new Promise(((n,o)=>{const i=new l;e.on("error",o),i.on("error",o),i.on("finish",(()=>{t.themes[r]=i.read().toString(),n()})),e.pipe(i)}))}createInputStream(){throw new Error("`XLSX#createInputStream` is deprecated. You should use `XLSX#read` instead. This method will be removed in version 5.0. Please follow upgrade instruction: https://github.com/exceljs/exceljs/blob/master/UPGRADE-4.0.md")}async read(e,t){!e[Symbol.asyncIterator]&&e.pipe&&(e=e.pipe(new a));const r=[];for await(const t of e)r.push(t);return this.load(n.concat(r),t)}async load(e,t){let o;o=t&&t.base64?n.from(e.toString(),"base64"):e;const s={worksheets:[],worksheetHash:{},worksheetRels:[],themes:{},media:[],mediaIndex:{},drawings:{},drawingRels:{},comments:{},tables:{},vmlDrawings:{}},l=await i.loadAsync(o);for(const e of Object.values(l.files))if(!e.dir){let n,o=e.name;if("/"===o[0]&&(o=o.substr(1)),o.match(/xl\/media\//)||o.match(/xl\/theme\/([a-zA-Z0-9]+)[.]xml/))n=new a,n.write(await e.async("nodebuffer"));else{let t;n=new a({writableObjectMode:!0,readableObjectMode:!0}),t=r.browser?d(await e.async("nodebuffer")):await e.async("string");const o=16384;for(let e=0;e>>26-s&67108863,(s+=24)>=26&&(s-=26,i++);else if("le"===n)for(o=0,i=0;o1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},o.prototype.inspect=function(){return(this.red?"s?s:a+16383));return 1===o?(t=e[r-1],i.push(n[t>>2]+n[t<<4&63]+"==")):2===o&&(t=(e[r-2]<<8)+e[r-1],i.push(n[t>>10]+n[t>>4&63]+n[t<<2&63]+"=")),i.join("")};for(var n=[],o=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0;s<64;++s)n[s]=a[s],o[a.charCodeAt(s)]=s;function l(e){var t=e.length;if(t%4>0)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 c(e,t,r){for(var o,i,a=[],s=t;s=49?c-49+10:c>=17?c-17+10:c,r(c>=0&&a>>26-s&67108863,(s+=24)>=26&&(s-=26,i++);else if("le"===n)for(o=0,i=0;o1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{o.prototype[Symbol.for("nodejs.util.inspect.custom")]=u}catch(e){o.prototype.inspect=u}else o.prototype.inspect=u;function u(){return(this.red?"