Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
Size: Mime:
\jXjRj{"files":{"index.html":{"size":358,"integrity":{"algorithm":"SHA256","hash":"3b1ef8c426f1acd1e7879768ef5c6ac47dc24341cad9aabc2c2e9103f7e8baaf","blockSize":4194304,"blocks":["3b1ef8c426f1acd1e7879768ef5c6ac47dc24341cad9aabc2c2e9103f7e8baaf"]},"offset":"0","executable":true},"package.json":{"size":746,"integrity":{"algorithm":"SHA256","hash":"4440038c9e4b22ccf5b85c2bf786dcd0b70e578ba558b19b51044c2b9b0b6d40","blockSize":4194304,"blocks":["4440038c9e4b22ccf5b85c2bf786dcd0b70e578ba558b19b51044c2b9b0b6d40"]},"offset":"358","executable":true},"settings.html":{"size":366,"integrity":{"algorithm":"SHA256","hash":"90996d02a4e63c729ae348d1945c49793f25fe7adad11fcb683f89e364f57679","blockSize":4194304,"blocks":["90996d02a4e63c729ae348d1945c49793f25fe7adad11fcb683f89e364f57679"]},"offset":"1104","executable":true},"renderer":{"files":{"base.css":{"size":15184,"integrity":{"algorithm":"SHA256","hash":"d9c9a3ea9a57ae728d38bf7735732d0a944c01e3e308cdee3d0e26f4b75b64ec","blockSize":4194304,"blocks":["d9c9a3ea9a57ae728d38bf7735732d0a944c01e3e308cdee3d0e26f4b75b64ec"]},"offset":"1470"},"bundle.css":{"size":728,"integrity":{"algorithm":"SHA256","hash":"6244e190536c064a5e7cac14bb820ce8bc48629e0af1e48a64ec1bbe2ef52247","blockSize":4194304,"blocks":["6244e190536c064a5e7cac14bb820ce8bc48629e0af1e48a64ec1bbe2ef52247"]},"offset":"16654"},"loadContent.js":{"size":24925,"integrity":{"algorithm":"SHA256","hash":"125f3a4bed3826fe1a7119ebb475a35a70997dfcdede4eba06f83b0d18a3a02a","blockSize":4194304,"blocks":["125f3a4bed3826fe1a7119ebb475a35a70997dfcdede4eba06f83b0d18a3a02a"]},"offset":"17382"},"loadMainContent.js":{"size":24925,"integrity":{"algorithm":"SHA256","hash":"2581bddde514325ef982e220806b4945910bc54f41ce069511556cb3e38ba6d6","blockSize":4194304,"blocks":["2581bddde514325ef982e220806b4945910bc54f41ce069511556cb3e38ba6d6"]},"offset":"42307"},"panel.js":{"size":63224,"integrity":{"algorithm":"SHA256","hash":"39345cfec048d1aa9c470d8011a668a6224ffbf12de089bcb5d2b199219f7607","blockSize":4194304,"blocks":["39345cfec048d1aa9c470d8011a668a6224ffbf12de089bcb5d2b199219f7607"]},"offset":"67232"},"settings.js":{"size":274699,"integrity":{"algorithm":"SHA256","hash":"80b5e84b7b41480d94969f9d8ba633bb4f49a9559db3d0c750f48fb589742128","blockSize":4194304,"blocks":["80b5e84b7b41480d94969f9d8ba633bb4f49a9559db3d0c750f48fb589742128"]},"offset":"130456"},"themePreviewPreload.js":{"size":17045,"integrity":{"algorithm":"SHA256","hash":"39ad0f58e1db5ebea555b7b96da212b625f400d62f86090b358bf3730017f3b8","blockSize":4194304,"blocks":["39ad0f58e1db5ebea555b7b96da212b625f400d62f86090b358bf3730017f3b8"]},"offset":"405155"}}},"main":{"files":{"main.js":{"size":82171,"integrity":{"algorithm":"SHA256","hash":"003d854fc2916db804ff52bccf856d828c61bda92eb677280fddeb94ca4afd5c","blockSize":4194304,"blocks":["003d854fc2916db804ff52bccf856d828c61bda92eb677280fddeb94ca4afd5c"]},"offset":"422200"}}},"node_modules":{"files":{"is-extglob":{"files":{"LICENSE":{"size":1087,"integrity":{"algorithm":"SHA256","hash":"73b5283588baa142c5baaef5f56d3e8fdea7a30b214e8c5737e87640f882453a","blockSize":4194304,"blocks":["73b5283588baa142c5baaef5f56d3e8fdea7a30b214e8c5737e87640f882453a"]},"offset":"843032"},"index.js":{"size":441,"integrity":{"algorithm":"SHA256","hash":"68be041dd0379d295d89550d1f6f2e8c29645bdd92d14b427fe2e140b3c8f2f8","blockSize":4194304,"blocks":["68be041dd0379d295d89550d1f6f2e8c29645bdd92d14b427fe2e140b3c8f2f8"]},"offset":"844119"},"package.json":{"size":843,"integrity":{"algorithm":"SHA256","hash":"e001b77bb9eb96803a8713aa02a309cb95bf2b8dd86e0e982057a94acb014a3e","blockSize":4194304,"blocks":["e001b77bb9eb96803a8713aa02a309cb95bf2b8dd86e0e982057a94acb014a3e"]},"offset":"844560"}}},"is-glob":{"files":{"LICENSE":{"size":1088,"integrity":{"algorithm":"SHA256","hash":"4cd903859549d4b20b571041f96dfae1136ed079c476126268f9d7cc1b611150","blockSize":4194304,"blocks":["4cd903859549d4b20b571041f96dfae1136ed079c476126268f9d7cc1b611150"]},"offset":"845403"},"index.js":{"size":3628,"integrity":{"algorithm":"SHA256","hash":"3d6b458efdfc6c26e196b907ca56f14ee015e7272d46e179e5b6fccfb7b99a39","blockSize":4194304,"blocks":["3d6b458efdfc6c26e196b907ca56f14ee015e7272d46e179e5b6fccfb7b99a39"]},"offset":"846491"},"package.json":{"size":1180,"integrity":{"algorithm":"SHA256","hash":"ca7b46d9618059a3cd127a6060741ea8fadc29ac2650962d660c3601059b5a59","blockSize":4194304,"blocks":["ca7b46d9618059a3cd127a6060741ea8fadc29ac2650962d660c3601059b5a59"]},"offset":"850119"}}},"normalize-path":{"files":{"LICENSE":{"size":1088,"integrity":{"algorithm":"SHA256","hash":"e70ff771504ba41f2be55de812a017ff46433d7a250c862e38fc419159e44500","blockSize":4194304,"blocks":["e70ff771504ba41f2be55de812a017ff46433d7a250c862e38fc419159e44500"]},"offset":"868003"},"index.js":{"size":1024,"integrity":{"algorithm":"SHA256","hash":"202cf63677ddcac13e71d66d2e98c8f07aad10789845ade028e5be755b7abf3a","blockSize":4194304,"blocks":["202cf63677ddcac13e71d66d2e98c8f07aad10789845ade028e5be755b7abf3a"]},"offset":"869091"},"package.json":{"size":1110,"integrity":{"algorithm":"SHA256","hash":"4f6e605aec738b97716dbfb1b2527d8908c1c4dc7f93f74af88eee74765bdde9","blockSize":4194304,"blocks":["4f6e605aec738b97716dbfb1b2527d8908c1c4dc7f93f74af88eee74765bdde9"]},"offset":"870115"}}},"picomatch":{"files":{"LICENSE":{"size":1091,"integrity":{"algorithm":"SHA256","hash":"d0cd141b0c322fded5dfad1d4645bb2fedfc05b7321fe1009469638190d59ef9","blockSize":4194304,"blocks":["d0cd141b0c322fded5dfad1d4645bb2fedfc05b7321fe1009469638190d59ef9"]},"offset":"871225"},"index.js":{"size":60,"integrity":{"algorithm":"SHA256","hash":"5695ff5dfcd5a338a40630bd506056f2950bcb08fe1cc068519cbbfe60add480","blockSize":4194304,"blocks":["5695ff5dfcd5a338a40630bd506056f2950bcb08fe1cc068519cbbfe60add480"]},"offset":"872316"},"package.json":{"size":1364,"integrity":{"algorithm":"SHA256","hash":"3e05e5921850e9f73dd44178fe2024eecdfed6454ba00b91dea4979e8fc0f470","blockSize":4194304,"blocks":["3e05e5921850e9f73dd44178fe2024eecdfed6454ba00b91dea4979e8fc0f470"]},"offset":"872376"},"lib":{"files":{"constants.js":{"size":4448,"integrity":{"algorithm":"SHA256","hash":"62e99d2d2b35b08df788f855f735c70eed58722f43059b50b97dfb950aafdfce","blockSize":4194304,"blocks":["62e99d2d2b35b08df788f855f735c70eed58722f43059b50b97dfb950aafdfce"]},"offset":"873740"},"parse.js":{"size":27763,"integrity":{"algorithm":"SHA256","hash":"def9662f49cd241d7f0f22c295aa5d7ac6541fc983a9394eb45d57b486de2f39","blockSize":4194304,"blocks":["def9662f49cd241d7f0f22c295aa5d7ac6541fc983a9394eb45d57b486de2f39"]},"offset":"878188"},"picomatch.js":{"size":9956,"integrity":{"algorithm":"SHA256","hash":"2cb169cbe17d356036c5f62a377318b85e30817877e59797842aec9d8b15f54b","blockSize":4194304,"blocks":["2cb169cbe17d356036c5f62a377318b85e30817877e59797842aec9d8b15f54b"]},"offset":"905951"},"scan.js":{"size":9189,"integrity":{"algorithm":"SHA256","hash":"227fcc994a477ea95c5a0435d32783566334c6bd0dcc4a103029735ad8c9c535","blockSize":4194304,"blocks":["227fcc994a477ea95c5a0435d32783566334c6bd0dcc4a103029735ad8c9c535"]},"offset":"915907"},"utils.js":{"size":1885,"integrity":{"algorithm":"SHA256","hash":"809fc29cf35ab0aa76b99cad29182f62c0ae598902481d10f9868eaef71981ee","blockSize":4194304,"blocks":["809fc29cf35ab0aa76b99cad29182f62c0ae598902481d10f9868eaef71981ee"]},"offset":"925096"}}}}},"adm-zip":{"files":{"LICENSE":{"size":1106,"integrity":{"algorithm":"SHA256","hash":"6bb5b2d4c07d793ca928daa63a8899c6914fafb5ac3aa04ec10cae07f3d57dca","blockSize":4194304,"blocks":["6bb5b2d4c07d793ca928daa63a8899c6914fafb5ac3aa04ec10cae07f3d57dca"]},"offset":"571616"},"adm-zip.js":{"size":38259,"integrity":{"algorithm":"SHA256","hash":"dc6a2239b69829b7d20aeefc9f5540aa69564d0cac476e442afeb030ae64ca07","blockSize":4194304,"blocks":["dc6a2239b69829b7d20aeefc9f5540aa69564d0cac476e442afeb030ae64ca07"]},"offset":"572722"},"package.json":{"size":822,"integrity":{"algorithm":"SHA256","hash":"7b7b520f4475c550662137f9c64a1b9fe7d8f5da9b39722d8a989173179152d9","blockSize":4194304,"blocks":["7b7b520f4475c550662137f9c64a1b9fe7d8f5da9b39722d8a989173179152d9"]},"offset":"610981"},"zipEntry.js":{"size":15614,"integrity":{"algorithm":"SHA256","hash":"35295fdfb2d8e5316db897f2e8ed61ed5eee8a68044774aba56b118a9a959daf","blockSize":4194304,"blocks":["35295fdfb2d8e5316db897f2e8ed61ed5eee8a68044774aba56b118a9a959daf"]},"offset":"611803"},"zipFile.js":{"size":15795,"integrity":{"algorithm":"SHA256","hash":"f95d3d6687e5ed959559943380e3bcf61f3e8849286d740afa45dedb28ffa16d","blockSize":4194304,"blocks":["f95d3d6687e5ed959559943380e3bcf61f3e8849286d740afa45dedb28ffa16d"]},"offset":"627417"},"util":{"files":{"constants.js":{"size":6374,"integrity":{"algorithm":"SHA256","hash":"208e943a2e5faad056047f3c7991cce3cde637d8e272a564f2546210ebdf2069","blockSize":4194304,"blocks":["208e943a2e5faad056047f3c7991cce3cde637d8e272a564f2546210ebdf2069"]},"offset":"643212"},"decoder.js":{"size":130,"integrity":{"algorithm":"SHA256","hash":"73a0ebb00c4dce2124f07acf0b34374cb03a4384cccd1cd6f58aee27c35953d9","blockSize":4194304,"blocks":["73a0ebb00c4dce2124f07acf0b34374cb03a4384cccd1cd6f58aee27c35953d9"]},"offset":"649586"},"errors.js":{"size":2868,"integrity":{"algorithm":"SHA256","hash":"d2d243647737c795c2db8aeba2e1f3841d5f76370b521d436cf465322dd4aab7","blockSize":4194304,"blocks":["d2d243647737c795c2db8aeba2e1f3841d5f76370b521d436cf465322dd4aab7"]},"offset":"649716"},"fattr.js":{"size":1892,"integrity":{"algorithm":"SHA256","hash":"31c93eb386a2bfbf19ad92a6bf20d510a8f1e7e90cc71d33dd888f89da12362d","blockSize":4194304,"blocks":["31c93eb386a2bfbf19ad92a6bf20d510a8f1e7e90cc71d33dd888f89da12362d"]},"offset":"652584"},"index.js":{"size":226,"integrity":{"algorithm":"SHA256","hash":"dc5b230ed853947ea55c0bf69f0e525fbeffefff09aa3da296d541bb8898314e","blockSize":4194304,"blocks":["dc5b230ed853947ea55c0bf69f0e525fbeffefff09aa3da296d541bb8898314e"]},"offset":"654476"},"utils.js":{"size":10416,"integrity":{"algorithm":"SHA256","hash":"a8983582ad5dfa163303d22acd0b0ab3312059a121fb1b377ad41f4a58ed955b","blockSize":4194304,"blocks":["a8983582ad5dfa163303d22acd0b0ab3312059a121fb1b377ad41f4a58ed955b"]},"offset":"654702"}}},"methods":{"files":{"deflater.js":{"size":1021,"integrity":{"algorithm":"SHA256","hash":"6dc41b2460594cfa5136b797653c166b2f7403820a40f2fca17cca35a5de1b5f","blockSize":4194304,"blocks":["6dc41b2460594cfa5136b797653c166b2f7403820a40f2fca17cca35a5de1b5f"]},"offset":"665118"},"index.js":{"size":128,"integrity":{"algorithm":"SHA256","hash":"d67714f1a04be942f90be77069af3ff4214aa8ee84b26edeff3a87eb0d8e2dc0","blockSize":4194304,"blocks":["d67714f1a04be942f90be77069af3ff4214aa8ee84b26edeff3a87eb0d8e2dc0"]},"offset":"666139"},"inflater.js":{"size":1162,"integrity":{"algorithm":"SHA256","hash":"c5e4531a11385050d77a5069487b0be8e85c8e44fe6b214d68def321e74528ce","blockSize":4194304,"blocks":["c5e4531a11385050d77a5069487b0be8e85c8e44fe6b214d68def321e74528ce"]},"offset":"666267"},"zipcrypto.js":{"size":5806,"integrity":{"algorithm":"SHA256","hash":"23365c7eda0ea098385dc7ec649517fc110ce2764d2e707c37bf6b528604e25a","blockSize":4194304,"blocks":["23365c7eda0ea098385dc7ec649517fc110ce2764d2e707c37bf6b528604e25a"]},"offset":"667429"}}},"headers":{"files":{"entryHeader.js":{"size":12066,"integrity":{"algorithm":"SHA256","hash":"b6fc4b17ceab96c07d6c14464b95204b1a130d32d845b348a18eefd5633763b1","blockSize":4194304,"blocks":["b6fc4b17ceab96c07d6c14464b95204b1a130d32d845b348a18eefd5633763b1"]},"offset":"673235"},"index.js":{"size":94,"integrity":{"algorithm":"SHA256","hash":"536e4b5bf009a3d9f6eccfbbc4157cb6de663d889e0826ea5f6e5fa17aaeb8bf","blockSize":4194304,"blocks":["536e4b5bf009a3d9f6eccfbbc4157cb6de663d889e0826ea5f6e5fa17aaeb8bf"]},"offset":"685301"},"mainHeader.js":{"size":4445,"integrity":{"algorithm":"SHA256","hash":"28dd1a0db451bc94d8f3234e57d8192ba17154118f841c398e0de35acea286ee","blockSize":4194304,"blocks":["28dd1a0db451bc94d8f3234e57d8192ba17154118f841c398e0de35acea286ee"]},"offset":"685395"}}}}},"anymatch":{"files":{"LICENSE":{"size":784,"integrity":{"algorithm":"SHA256","hash":"5a3b0007c4203f10fe11b3fe8747253eb994f135e10b73e1f88ada941af09c6e","blockSize":4194304,"blocks":["5a3b0007c4203f10fe11b3fe8747253eb994f135e10b73e1f88ada941af09c6e"]},"offset":"689840"},"index.js":{"size":3180,"integrity":{"algorithm":"SHA256","hash":"ea49adf003801ff863327107888ea67bc47dea85cfbc86f0673c6cc132b7c0a7","blockSize":4194304,"blocks":["ea49adf003801ff863327107888ea67bc47dea85cfbc86f0673c6cc132b7c0a7"]},"offset":"690624"},"package.json":{"size":657,"integrity":{"algorithm":"SHA256","hash":"4a5839fc470af8d0ab4228310137bf4c962999d31cff6821f11def0fcf610351","blockSize":4194304,"blocks":["4a5839fc470af8d0ab4228310137bf4c962999d31cff6821f11def0fcf610351"]},"offset":"693804"}}},"binary-extensions":{"files":{"binary-extensions.json":{"size":2193,"integrity":{"algorithm":"SHA256","hash":"bb0b0a0f9df06b5ab2f53703c7bc20c97496b8a35d7e60685a8d41f8532a7a7d","blockSize":4194304,"blocks":["bb0b0a0f9df06b5ab2f53703c7bc20c97496b8a35d7e60685a8d41f8532a7a7d"]},"offset":"694461"},"index.js":{"size":54,"integrity":{"algorithm":"SHA256","hash":"5b2859ec9677f14e6499b135b2e05a083fd2a1afce18175ac0658bc9d4c49774","blockSize":4194304,"blocks":["5b2859ec9677f14e6499b135b2e05a083fd2a1afce18175ac0658bc9d4c49774"]},"offset":"696654"},"license":{"size":1167,"integrity":{"algorithm":"SHA256","hash":"96f0820026bd6dadc4af99c6dba7111d2e0190c092c376a746c13863e151d072","blockSize":4194304,"blocks":["96f0820026bd6dadc4af99c6dba7111d2e0190c092c376a746c13863e151d072"]},"offset":"696708"},"package.json":{"size":626,"integrity":{"algorithm":"SHA256","hash":"b863d33f3786f055221d20b29491adf2106f2beedf0d9b28de40ce1961a4a8b0","blockSize":4194304,"blocks":["b863d33f3786f055221d20b29491adf2106f2beedf0d9b28de40ce1961a4a8b0"]},"offset":"697875"}}},"braces":{"files":{"LICENSE":{"size":1091,"integrity":{"algorithm":"SHA256","hash":"35bdd8a44339719441900fb50fbefc5e2dca1ca662cbaed7a687de842c8b70f2","blockSize":4194304,"blocks":["35bdd8a44339719441900fb50fbefc5e2dca1ca662cbaed7a687de842c8b70f2"]},"offset":"698501"},"index.js":{"size":4380,"integrity":{"algorithm":"SHA256","hash":"332ea07c7b006361aad12aa994ca75dc1db8e8382b884909e2f38f10b85c88a4","blockSize":4194304,"blocks":["332ea07c7b006361aad12aa994ca75dc1db8e8382b884909e2f38f10b85c88a4"]},"offset":"699592"},"package.json":{"size":902,"integrity":{"algorithm":"SHA256","hash":"95424b3985f3bfbd1175dd1cbf4c0b155001fd824b60cbc03ee4389c5d6ebc26","blockSize":4194304,"blocks":["95424b3985f3bfbd1175dd1cbf4c0b155001fd824b60cbc03ee4389c5d6ebc26"]},"offset":"703972"},"lib":{"files":{"compile.js":{"size":1501,"integrity":{"algorithm":"SHA256","hash":"dc98f22eee3d511785d92a00758d5f0d48efed5f5813bdecc2de430c529b5c9f","blockSize":4194304,"blocks":["dc98f22eee3d511785d92a00758d5f0d48efed5f5813bdecc2de430c529b5c9f"]},"offset":"704874"},"constants.js":{"size":1589,"integrity":{"algorithm":"SHA256","hash":"c18ac5adb57308f1ce42a28552da3a31f5d83709743ebd9a636336813a744d4b","blockSize":4194304,"blocks":["c18ac5adb57308f1ce42a28552da3a31f5d83709743ebd9a636336813a744d4b"]},"offset":"706375"},"expand.js":{"size":2797,"integrity":{"algorithm":"SHA256","hash":"41ccc196ebfa7b7781a634e721eb744e4e7bcb54cba427a7e3d6806a1b9e58f7","blockSize":4194304,"blocks":["41ccc196ebfa7b7781a634e721eb744e4e7bcb54cba427a7e3d6806a1b9e58f7"]},"offset":"707964"},"parse.js":{"size":6899,"integrity":{"algorithm":"SHA256","hash":"e572166565f15fa6ad9865ae49d678218e32aabfd1b3720f6d0d43d39800d310","blockSize":4194304,"blocks":["e572166565f15fa6ad9865ae49d678218e32aabfd1b3720f6d0d43d39800d310"]},"offset":"710761"},"stringify.js":{"size":708,"integrity":{"algorithm":"SHA256","hash":"379f22d77bfa1478341ccd49c5e4267464aabcbba03558bab332aac23fc6f23a","blockSize":4194304,"blocks":["379f22d77bfa1478341ccd49c5e4267464aabcbba03558bab332aac23fc6f23a"]},"offset":"717660"},"utils.js":{"size":2518,"integrity":{"algorithm":"SHA256","hash":"b5a7596aa67730412b3c029ef09e84e6b67b8e445cffd35d1d295549c89066c7","blockSize":4194304,"blocks":["b5a7596aa67730412b3c029ef09e84e6b67b8e445cffd35d1d295549c89066c7"]},"offset":"718368"}}}}},"chokidar":{"files":{"LICENSE":{"size":1129,"integrity":{"algorithm":"SHA256","hash":"db9ba183d4cbfbaf6c27db2effddbb84b46340c33ed32a066bc0b144a3ea1298","blockSize":4194304,"blocks":["db9ba183d4cbfbaf6c27db2effddbb84b46340c33ed32a066bc0b144a3ea1298"]},"offset":"720886"},"index.js":{"size":28379,"integrity":{"algorithm":"SHA256","hash":"18ce2effe87d6379aa1d3756e5694c57c72cf97804056d688499a2bffcec66fd","blockSize":4194304,"blocks":["18ce2effe87d6379aa1d3756e5694c57c72cf97804056d688499a2bffcec66fd"]},"offset":"722015"},"package.json":{"size":1118,"integrity":{"algorithm":"SHA256","hash":"38a26c41027fb2388d528d9248e4d305ad2db7e4b3f6fc62909cdd330b86b515","blockSize":4194304,"blocks":["38a26c41027fb2388d528d9248e4d305ad2db7e4b3f6fc62909cdd330b86b515"]},"offset":"750394"},"lib":{"files":{"constants.js":{"size":1878,"integrity":{"algorithm":"SHA256","hash":"bedb4f916d3da3804e20eef822ce0ad7f7879b890655d77db019e37eb5f388fb","blockSize":4194304,"blocks":["bedb4f916d3da3804e20eef822ce0ad7f7879b890655d77db019e37eb5f388fb"]},"offset":"751512"},"fsevents-handler.js":{"size":16368,"integrity":{"algorithm":"SHA256","hash":"c2e15baebf066bf8531cbf82a324631a40b218d073274429edb50b4bdbbb0265","blockSize":4194304,"blocks":["c2e15baebf066bf8531cbf82a324631a40b218d073274429edb50b4bdbbb0265"]},"offset":"753390"},"nodefs-handler.js":{"size":20067,"integrity":{"algorithm":"SHA256","hash":"60be035e7ea64858a0144230d5073b18a69f3b0eefba62a9b032c6d2f179d807","blockSize":4194304,"blocks":["60be035e7ea64858a0144230d5073b18a69f3b0eefba62a9b032c6d2f179d807"]},"offset":"769758"}}}}},"commander":{"files":{"LICENSE":{"size":1098,"integrity":{"algorithm":"SHA256","hash":"04512a63dce4d2d506ad612dc0bd7681ccf6e3655f7b6eaef7dfac8323d1ec0b","blockSize":4194304,"blocks":["04512a63dce4d2d506ad612dc0bd7681ccf6e3655f7b6eaef7dfac8323d1ec0b"]},"offset":"789825"},"index.js":{"size":27849,"integrity":{"algorithm":"SHA256","hash":"259465792c3db1ae81555cb0b654e224914ea59143d9674502d6754eb5266efd","blockSize":4194304,"blocks":["259465792c3db1ae81555cb0b654e224914ea59143d9674502d6754eb5266efd"]},"offset":"790923"},"package.json":{"size":633,"integrity":{"algorithm":"SHA256","hash":"ee728a7cf162e3a5a36ccd0718f2406fb54a75676273198646b620bca8729b30","blockSize":4194304,"blocks":["ee728a7cf162e3a5a36ccd0718f2406fb54a75676273198646b620bca8729b30"]},"offset":"818772"}}},"css-vars":{"files":{"LICENSE":{"size":1074,"integrity":{"algorithm":"SHA256","hash":"b35b035741d943663097c7bda6a998d4524a84877e76b9cbee067c103a0de9d2","blockSize":4194304,"blocks":["b35b035741d943663097c7bda6a998d4524a84877e76b9cbee067c103a0de9d2"]},"offset":"819405"},"css-vars.scss":{"size":3484,"integrity":{"algorithm":"SHA256","hash":"173b63c22ed4b9708fe65ade27be2e32af10f83c8348fc79212ab4f3a7d2f89e","blockSize":4194304,"blocks":["173b63c22ed4b9708fe65ade27be2e32af10f83c8348fc79212ab4f3a7d2f89e"]},"offset":"820479"},"package.json":{"size":482,"integrity":{"algorithm":"SHA256","hash":"131ab0246839065c56dd2314e0bd4767be3a3960872cbf9896334913e809580b","blockSize":4194304,"blocks":["131ab0246839065c56dd2314e0bd4767be3a3960872cbf9896334913e809580b"]},"offset":"823963"}}},"electron-build-env":{"files":{"LICENSE":{"size":1056,"integrity":{"algorithm":"SHA256","hash":"963f1ddaa5d4a42f648683eb738152febe4174421582103a8cf9ea0bd87fd502","blockSize":4194304,"blocks":["963f1ddaa5d4a42f648683eb738152febe4174421582103a8cf9ea0bd87fd502"]},"offset":"824445"},"cli.js":{"size":1055,"integrity":{"algorithm":"SHA256","hash":"21416b9d1536179570b315a04ebb9234ae30c7fe2badf41db85f1a4481257ea7","blockSize":4194304,"blocks":["21416b9d1536179570b315a04ebb9234ae30c7fe2badf41db85f1a4481257ea7"]},"offset":"825501","executable":true},"index.js":{"size":3177,"integrity":{"algorithm":"SHA256","hash":"568fa5306490f4787d05d4e37e2895c355db8da376f1ee59632ef8faad32d3ed","blockSize":4194304,"blocks":["568fa5306490f4787d05d4e37e2895c355db8da376f1ee59632ef8faad32d3ed"]},"offset":"826556"},"package.json":{"size":564,"integrity":{"algorithm":"SHA256","hash":"c8093c72e8f9433fc8d5096cb05d31bbb564c6e62f0eaf21fb9c6d58ff5140e9","blockSize":4194304,"blocks":["c8093c72e8f9433fc8d5096cb05d31bbb564c6e62f0eaf21fb9c6d58ff5140e9"]},"offset":"829733"}}},"fill-range":{"files":{"LICENSE":{"size":1091,"integrity":{"algorithm":"SHA256","hash":"35bdd8a44339719441900fb50fbefc5e2dca1ca662cbaed7a687de842c8b70f2","blockSize":4194304,"blocks":["35bdd8a44339719441900fb50fbefc5e2dca1ca662cbaed7a687de842c8b70f2"]},"offset":"830297"},"index.js":{"size":6406,"integrity":{"algorithm":"SHA256","hash":"ca6199f79a117e4d68be02c6bcd974e2f18f358e711a0aba497bffaf1ccadd4e","blockSize":4194304,"blocks":["ca6199f79a117e4d68be02c6bcd974e2f18f358e711a0aba497bffaf1ccadd4e"]},"offset":"831388"},"package.json":{"size":845,"integrity":{"algorithm":"SHA256","hash":"e098e21ff7e905a3ea687bc149cd87db6d485bfce5f5600f6e2d08a3ab15414a","blockSize":4194304,"blocks":["e098e21ff7e905a3ea687bc149cd87db6d485bfce5f5600f6e2d08a3ab15414a"]},"offset":"837794"}}},"glob-parent":{"files":{"LICENSE":{"size":753,"integrity":{"algorithm":"SHA256","hash":"2c46f1325bd3822a33c1e2c1e49c18d13127ac00f9c8b3b79196c7a126f73cd9","blockSize":4194304,"blocks":["2c46f1325bd3822a33c1e2c1e49c18d13127ac00f9c8b3b79196c7a126f73cd9"]},"offset":"838639"},"index.js":{"size":1120,"integrity":{"algorithm":"SHA256","hash":"8e482c70067850425183ae785f19614bb9c788cf22226db62243119e507384c4","blockSize":4194304,"blocks":["8e482c70067850425183ae785f19614bb9c788cf22226db62243119e507384c4"]},"offset":"839392"},"package.json":{"size":590,"integrity":{"algorithm":"SHA256","hash":"c6608d022ce6fd29a8f75ca20767c5d60965a43b682d97d3f653c6bd54b84b5c","blockSize":4194304,"blocks":["c6608d022ce6fd29a8f75ca20767c5d60965a43b682d97d3f653c6bd54b84b5c"]},"offset":"840512"}}},"is-binary-path":{"files":{"index.js":{"size":239,"integrity":{"algorithm":"SHA256","hash":"afac5b9e0f7ba381af21a403254299e075a714948d144c6f6b8dccee9c9188c0","blockSize":4194304,"blocks":["afac5b9e0f7ba381af21a403254299e075a714948d144c6f6b8dccee9c9188c0"]},"offset":"841102"},"license":{"size":1159,"integrity":{"algorithm":"SHA256","hash":"85fe65eefab89e2a683232b96e6f689279821a0bd3b351e9ab6a6ebd19dea567","blockSize":4194304,"blocks":["85fe65eefab89e2a683232b96e6f689279821a0bd3b351e9ab6a6ebd19dea567"]},"offset":"841341"},"package.json":{"size":532,"integrity":{"algorithm":"SHA256","hash":"009979ed7e189d3f43f0d5cd1b35ff835e760749a922cf87d9b7b2e42fccf369","blockSize":4194304,"blocks":["009979ed7e189d3f43f0d5cd1b35ff835e760749a922cf87d9b7b2e42fccf369"]},"offset":"842500"}}},"is-number":{"files":{"LICENSE":{"size":1091,"integrity":{"algorithm":"SHA256","hash":"35bdd8a44339719441900fb50fbefc5e2dca1ca662cbaed7a687de842c8b70f2","blockSize":4194304,"blocks":["35bdd8a44339719441900fb50fbefc5e2dca1ca662cbaed7a687de842c8b70f2"]},"offset":"851299"},"index.js":{"size":411,"integrity":{"algorithm":"SHA256","hash":"04255e482e181687823a95b207802ddd32e746c65dce4c95a5176fc192735960","blockSize":4194304,"blocks":["04255e482e181687823a95b207802ddd32e746c65dce4c95a5176fc192735960"]},"offset":"852390"},"package.json":{"size":921,"integrity":{"algorithm":"SHA256","hash":"1561fe7db24cfd2524607911c6048f43f2eeefdb54f5c261440b7fd28629a684","blockSize":4194304,"blocks":["1561fe7db24cfd2524607911c6048f43f2eeefdb54f5c261440b7fd28629a684"]},"offset":"852801"}}},"minimist":{"files":{".nycrc":{"size":229,"integrity":{"algorithm":"SHA256","hash":"eaacff31c45b07c9b5e804d4e0e8eb35e0c430faf9f79fdd98d43b26c42e93df","blockSize":4194304,"blocks":["eaacff31c45b07c9b5e804d4e0e8eb35e0c430faf9f79fdd98d43b26c42e93df"]},"offset":"853722"},"LICENSE":{"size":1073,"integrity":{"algorithm":"SHA256","hash":"435a6722c786b0a56fbe7387028f1d9d3f3a2d0fb615bb8fee118727c3f59b7b","blockSize":4194304,"blocks":["435a6722c786b0a56fbe7387028f1d9d3f3a2d0fb615bb8fee118727c3f59b7b"]},"offset":"853951"},"index.js":{"size":6196,"integrity":{"algorithm":"SHA256","hash":"9cf5e83d36697a92d8af11e000f513ac30a3464bbb024850f9ffdeb1edf59848","blockSize":4194304,"blocks":["9cf5e83d36697a92d8af11e000f513ac30a3464bbb024850f9ffdeb1edf59848"]},"offset":"855024"},"package.json":{"size":1247,"integrity":{"algorithm":"SHA256","hash":"3154549dd6d41d1e074108fbd587e0078c54ce85d9d51c167a43c78cb178f76c","blockSize":4194304,"blocks":["3154549dd6d41d1e074108fbd587e0078c54ce85d9d51c167a43c78cb178f76c"]},"offset":"861220"}}},"mkdirp":{"files":{"LICENSE":{"size":1141,"integrity":{"algorithm":"SHA256","hash":"05991c2e8f070b69ec5b656c2c12fd07cd0153dd157d39b050b82af59b319a01","blockSize":4194304,"blocks":["05991c2e8f070b69ec5b656c2c12fd07cd0153dd157d39b050b82af59b319a01"]},"offset":"862467"},"index.js":{"size":2825,"integrity":{"algorithm":"SHA256","hash":"df33312136061eee26701a34ca4f9be043b9675d359a115503dc2df909106432","blockSize":4194304,"blocks":["df33312136061eee26701a34ca4f9be043b9675d359a115503dc2df909106432"]},"offset":"863608"},"package.json":{"size":524,"integrity":{"algorithm":"SHA256","hash":"dcdb2fd365d28ffadcd5de98859b6a544e9cd455077f921346c78a83c5493596","blockSize":4194304,"blocks":["dcdb2fd365d28ffadcd5de98859b6a544e9cd455077f921346c78a83c5493596"]},"offset":"866433"},"bin":{"files":{"cmd.js":{"size":731,"integrity":{"algorithm":"SHA256","hash":"24b028bccb1773f02cf0d0fb3dca5468f1b5d22a06cbc5cbf351e1eb3accefb1","blockSize":4194304,"blocks":["24b028bccb1773f02cf0d0fb3dca5468f1b5d22a06cbc5cbf351e1eb3accefb1"]},"offset":"866957","executable":true},"usage.txt":{"size":315,"integrity":{"algorithm":"SHA256","hash":"5575eeea7b83971ed81729048e24b8f5a56b902ab2e1bd43ed031a502eb84759","blockSize":4194304,"blocks":["5575eeea7b83971ed81729048e24b8f5a56b902ab2e1bd43ed031a502eb84759"]},"offset":"867688"}}}}},"readdirp":{"files":{"LICENSE":{"size":1114,"integrity":{"algorithm":"SHA256","hash":"dffec71d93f273d2af7b54c6c7e7e70b3289c632ec0d7253210ec21ac336d5ac","blockSize":4194304,"blocks":["dffec71d93f273d2af7b54c6c7e7e70b3289c632ec0d7253210ec21ac336d5ac"]},"offset":"926981"},"index.js":{"size":8876,"integrity":{"algorithm":"SHA256","hash":"6938cee40af1b1d973977f377ce093a596e41dc23cf5f1a305a5305dc4d81a62","blockSize":4194304,"blocks":["6938cee40af1b1d973977f377ce093a596e41dc23cf5f1a305a5305dc4d81a62"]},"offset":"928095"},"package.json":{"size":765,"integrity":{"algorithm":"SHA256","hash":"4526bfe96e0dc48ee74d729b48b0acc66cd9f408e221479c607d9c1d78b7642d","blockSize":4194304,"blocks":["4526bfe96e0dc48ee74d729b48b0acc66cd9f408e221479c607d9c1d78b7642d"]},"offset":"936971"}}},"to-regex-range":{"files":{"LICENSE":{"size":1091,"integrity":{"algorithm":"SHA256","hash":"e7d1fee7347ffddccc5fd03327ffdb50f8c112be0d5016d62388a92c4ae6e7a9","blockSize":4194304,"blocks":["e7d1fee7347ffddccc5fd03327ffdb50f8c112be0d5016d62388a92c4ae6e7a9"]},"offset":"937736"},"index.js":{"size":6481,"integrity":{"algorithm":"SHA256","hash":"e32199271f92372a2deb70a3a57f7c0f7f558d04152a905eb97104867870c404","blockSize":4194304,"blocks":["e32199271f92372a2deb70a3a57f7c0f7f558d04152a905eb97104867870c404"]},"offset":"938827"},"package.json":{"size":1148,"integrity":{"algorithm":"SHA256","hash":"ae904af36111eabcde5ed16e34aff1ad6daadb98ad8555ac189f4634ba5efd7f","blockSize":4194304,"blocks":["ae904af36111eabcde5ed16e34aff1ad6daadb98ad8555ac189f4634ba5efd7f"]},"offset":"945308"}}}}}}}<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <link rel="stylesheet" href="./renderer/base.css">
    <title>Figma</title>
</head>
<body>
    <script src="renderer/panel.js" ></script> 
</body>
</html>{
  "0": "m",
  "1": "a",
  "2": "i",
  "3": "n",
  "4": "/",
  "5": "m",
  "6": "a",
  "7": "i",
  "8": "n",
  "9": ".",
  "10": "j",
  "11": "s",
  "name": "figma-linux",
  "version": "0.11.5",
  "description": "Figma is the first interface design tool based in the browser, making it easier for teams to create software. Join as in Telegram: https://t.me/figma_linux",
  "main": "main/main.js",
  "repository": "git@github.com:ChugunovRoman/figma-linux.git",
  "homepage": "https://github.com/ChugunovRoman/figma-linux",
  "author": "ChugunovRoman <Zebs-BMK@yandex.ru>",
  "license": "MIT",
  "dependencies": {
    "adm-zip": "^0.5.10",
    "chokidar": "^3.5.3",
    "css-vars": "^2.4.0",
    "electron-build-env": "^0.2"
  },
  "length": 12
}<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <link rel="stylesheet" href="./renderer/base.css">
    <title>Settings</title>
</head>
<body>
    <script src="./renderer/settings.js" ></script> 
</body>
</html>body{background-color:rgba(0, 0, 0, 0.5)}div.svelte-cgi3tm{display:flex;align-items:center;justify-content:center;width:100vw;height:100vh;overflow:hidden}
div.svelte-1f0aii0{width:90vw;height:80vh;overflow:hidden;background:var(--bg-panel)}settingsBody.svelte-1f0aii0{position:relative;display:block;scroll-behavior:smooth;height:calc(80vh - 46px)}
div.svelte-1ahepc0{position:absolute;width:-webkit-fill-available;background-color:var(--bg-panel);overflow:auto;padding:32px 32px 8px 32px;user-select:none}themeFake.svelte-1ahepc0{display:block}
div.svelte-18pxjy6{position:absolute;background-color:var(--bg-panel);width:-webkit-fill-available;padding:32px 32px 8px 32px;user-select:none}colorPaletteDiv.svelte-18pxjy6{display:block}iframeView.svelte-18pxjy6{position:absolute;display:grid;grid-template-columns:auto auto;gap:2vmin;padding:20px}toolBar.svelte-18pxjy6{display:flex;background-color:var(--bg-panel);border:1px solid var(--borders);padding:6px;border-radius:3px}
div.svelte-1bc96my{position:absolute;background-color:var(--bg-panel);width:-webkit-fill-available;padding:32px 32px 8px 32px;user-select:none;overflow-y:auto;overflow-x:hidden}
.themeview_item_tumbl.svelte-lgfnem.svelte-lgfnem{flex-direction:column;height:159px;border:1px solid var(--borders);border-radius:6px 6px 0 0}.themeview_item_tumbl.svelte-lgfnem.svelte-lgfnem:hover{cursor:pointer}.themeview_item_tumbl_top.svelte-lgfnem.svelte-lgfnem{height:8px;background-color:var(--bg-header);border-radius:6px 6px 0 0}.themeview_item_tumbl_toolpanel.svelte-lgfnem.svelte-lgfnem{display:grid;grid-template-columns:60px 1fr 60px;height:24px;align-items:center;background-color:var(--bg-toolbar)}.themeview_item_tumbl_toolpanel.svelte-lgfnem>div.svelte-lgfnem{display:flex;align-items:flex-end}.themeview_item_tumbl_toolpanel.svelte-lgfnem>div.svelte-lgfnem:nth-child(1){padding-left:6px}.themeview_item_tumbl_toolpanel.svelte-lgfnem>div.svelte-lgfnem:nth-child(2){justify-content:center}.themeview_item_tumbl_body.svelte-lgfnem.svelte-lgfnem{display:grid;grid-template-columns:60px 1fr 60px;height:127px}.themeview_item_tumbl_body_left.svelte-lgfnem.svelte-lgfnem{padding-left:8px;padding-top:10px;background-color:var(--bg-panel);border-right:1px solid var(--borders)}.themeview_item_tumbl_body_left_text1.svelte-lgfnem.svelte-lgfnem{width:40px;height:4px;background-color:var(--text)}.themeview_item_tumbl_body_left_text2.svelte-lgfnem.svelte-lgfnem{margin-top:6px;width:28px;height:4px;background-color:var(--text)}.themeview_item_tumbl_body_center.svelte-lgfnem.svelte-lgfnem{background-color:var(--borders)}.themeview_item_tumbl_body_right.svelte-lgfnem.svelte-lgfnem{border-left:1px solid var(--borders);background-color:var(--bg-panel)}
div.svelte-1va8owf{position:absolute;top:0px;left:0px;width:100%;height:100%;z-index:99999}
div.svelte-1yxt3hn{display:flex;user-select:none;margin-bottom:10px}
div.svelte-1yxt3hn{display:flex;user-select:none;margin-bottom:10px}
div.svelte-y4g53z{display:flex;align-items:center;justify-content:center;background-color:var(--normal-bg-color);color:var(--normal-fg-color);border:var(--normal-border);cursor:var(--normal-cursor);border-radius:var(--border-radius);width:var(--width);height:var(--height);padding:var(--padding);margin:var(--margin);transition:all 0.08s ease;user-select:none}div.svelte-y4g53z:hover{border:var(--hover-border);cursor:var(--hover-cursor);color:var(--hover-fg-color);background-color:var(--hover-bg-color)}div.svelte-y4g53z:active{border:var(--active-border);cursor:var(--active-cursor);color:var(--active-fg-color);background-color:var(--active-bg-color)}.button__active.svelte-y4g53z{border:var(--active-border);cursor:var(--active-cursor);color:var(--active-fg-color);background-color:var(--active-bg-color)}.button__active.svelte-y4g53z:hover{border:var(--active-border);cursor:var(--active-cursor);color:var(--active-fg-color);background-color:var(--active-bg-color)}.button__disabled.svelte-y4g53z{user-select:none;background-color:var(--disabled-bg-color)}.button__disabled.svelte-y4g53z:hover{user-select:none;background-color:var(--disabled-bg-color)}
div.svelte-pkmuda{display:flex;align-items:center;justify-content:center;background-color:var(--normal-bg-color);color:var(--normal-fg-color);border-radius:var(--border-radius);width:var(--width);height:var(--height);padding:var(--padding);opacity:var(--normal-opacity);transition:all 0.1s ease}div.svelte-pkmuda:hover{fill:var(--hover-fg-color);color:var(--hover-fg-color);opacity:var(--hover-opacity)}
.panel-right.svelte-1qne3l4{display:flex;align-items:stretch}
.panel-left.svelte-sj5cvx{display:flex;align-items:stretch}
div.svelte-q44ed0{display:flex}@keyframes svelte-q44ed0-spin{from{transform:rotate(0deg)}to{transform:rotate(360deg)}}.spin.svelte-q44ed0{animation-name:svelte-q44ed0-spin;animation-duration:1000ms;animation-iteration-count:infinite;animation-timing-function:linear}
div.svelte-12aaq2z{display:grid;grid-template-columns:var(--columns);grid-template-rows:var(--rows);grid-template-areas:var(--areas);grid-column-gap:var(--grid-column-gap);grid-row-gap:var(--grid-row-gap);width:var(--width);height:var(--height);padding:var(--padding)}
div.svelte-1cesgdx{display:flex;flex-direction:var(--direction);justify-content:var(--justifyContent);justify-items:var(--justifyItems);overflow:var(--overflow);border:var(--border);border-top:var(--tborder);border-right:var(--rborder);border-bottom:var(--bborder);border-left:var(--lborder);border-radius:var(--bradius);align-items:var(--alignItems);width:var(--width);height:var(--height);padding:var(--padding);margin:var(--margin);background-color:var(--bgColor)}
div.svelte-1eug09i.svelte-1eug09i{width:100%}label.svelte-1eug09i.svelte-1eug09i{display:flex;align-items:center;width:100%;user-select:none}span.svelte-1eug09i.svelte-1eug09i{position:relative;width:100%;border-bottom:1px solid var(--borders);padding-left:24px;color:var(--text)}blockContent.svelte-1eug09i.svelte-1eug09i{display:block}block.svelte-1eug09i.svelte-1eug09i{display:block;width:100%;overflow:hidden}input.svelte-1eug09i.svelte-1eug09i{display:none}input.svelte-1eug09i~span.svelte-1eug09i::before{content:"";position:absolute;top:6px;left:6px;width:0;height:0;border-top:5px solid var(--borders);border-right:5px solid transparent;border-left:5px solid transparent;transform:rotate(-90deg);transition:all 0.1s ease}input.svelte-1eug09i:checked~span.svelte-1eug09i::before{content:"";position:absolute;top:6px;left:6px;width:0;height:0;border-top:5px solid var(--borders);border-right:5px solid transparent;border-left:5px solid transparent;transform:rotate(0deg);transition:all 0.1s ease}
zoomArea.svelte-1st4xl7{position:relative;overflow:auto;border:1px solid var(--borders)}div.svelte-1st4xl7{position:relative;width:fit-content}zoomAreaToolBarWrap.svelte-1st4xl7{position:absolute;z-index:2000;top:0px;left:0px}zoomAreaToolBar.svelte-1st4xl7{display:flex;position:fixed;padding:6px;border-radius:3px}maskZoomArea.svelte-1st4xl7{display:block;position:absolute;width:100%;height:100%;top:0px;left:0px;right:100%;bottom:100%;background-color:rgba(255, 255, 255, 0)}
div.svelte-1959krd{display:flex;transform:rotate(var(--deg))}
div.svelte-r3namy{display:flex;align-items:center;background-color:var(--bg-color)}
div.svelte-kv7tn7{display:flex;align-items:center;background-color:var(--bg-color);padding-right:20px;padding-left:22px;border-bottom:1px solid var(--borders)}
input.svelte-z4r8n8{width:var(--inputWidth);height:var(--inputHeight);background-color:transparent;border:none;outline:none;margin:0;padding:0}input.svelte-z4r8n8::-webkit-color-swatch-wrapper{padding:0}input.svelte-z4r8n8::-webkit-color-swatch{border:0;border-radius:3px}input.svelte-z4r8n8:focus,input.svelte-z4r8n8:active{background-color:transparent}
input.svelte-lc7qyp{background-color:transparent;-webkit-appearance:none;appearance:none;height:var(--thumbSize);margin:0;padding:0;border:0;width:var(--inputWidth)}input.svelte-lc7qyp::-webkit-slider-runnable-track{background:var(--text);height:var(--trackSize);border-radius:calc(var(--trackSize) / 2)}input.svelte-lc7qyp::-webkit-slider-thumb{-webkit-appearance:none;appearance:none;border:1 solid var(--text);background:var(--text);width:var(--thumbSize);height:var(--thumbSize);border-radius:calc(var(--thumbSize));margin-top:calc(((var(--thumbSize) - var(--trackSize)) / 2) * -1)}input.svelte-lc7qyp:hover::-webkit-slider-thumb{cursor:pointer}input.svelte-lc7qyp:hover::-webkit-slider-runnable-track{cursor:pointer}
div.svelte-d03xai{display:flex;border:1px solid var(--borders);border-radius:3px;padding:8px;width:var(--inputWidth)}.input_error.svelte-d03xai{border:1px solid var(--bg-window-close)}input.svelte-d03xai{background-color:transparent;outline:none;color:var(--text);border:0;margin-left:6px;width:100%}input.svelte-d03xai:hover,input.svelte-d03xai:active,input.svelte-d03xai:focus{background-color:transparent;outline:none;border:0}
div.svelte-8xyll0.svelte-8xyll0.svelte-8xyll0.svelte-8xyll0{display:inline-flex;align-items:center;color:var(--text);position:relative;padding:6px 0}div.svelte-8xyll0>label.svelte-8xyll0.svelte-8xyll0.svelte-8xyll0{position:relative}div.svelte-8xyll0>label.svelte-8xyll0.svelte-8xyll0.svelte-8xyll0:hover{cursor:pointer}div.svelte-8xyll0>label.svelte-8xyll0>span.svelte-8xyll0.svelte-8xyll0{position:relative;padding-left:40px;user-select:none}div.svelte-8xyll0>label.svelte-8xyll0>span.svelte-8xyll0.svelte-8xyll0::before{content:"";position:absolute;top:3px;left:1px;width:var(--checkWidth);height:var(--checkSize);background-color:var(--white_1);border:var(--checkBorder) solid var(--borders);border-radius:var(--checkSize);transition:all 0.1s ease}div.svelte-8xyll0>label.svelte-8xyll0>span.svelte-8xyll0.svelte-8xyll0:hover::before{box-shadow:0 0 1px 0px var(--black_2)}div.svelte-8xyll0>label.svelte-8xyll0>span.svelte-8xyll0.svelte-8xyll0::after{content:"";position:absolute;top:3px;left:1px;width:var(--checkSize);height:var(--checkSize);background-color:var(--bg-header);border:var(--checkBorder) solid var(--borders);border-radius:var(--checkSize);transition:all 0.2s ease}div.svelte-8xyll0>label.svelte-8xyll0>input[type="checkbox"].svelte-8xyll0:checked~span.svelte-8xyll0::before{content:"";position:absolute;top:3px;left:0px;width:var(--checkWidth);height:var(--checkSize);background-color:var(--bg-header);border:var(--checkBorder) solid var(--borders);border-radius:var(--checkSize);transition:all 0.1s ease}div.svelte-8xyll0>label.svelte-8xyll0>input[type="checkbox"].svelte-8xyll0:checked~span.svelte-8xyll0::after{content:"";position:absolute;top:3px;left:calc(var(--checkWidth) - var(--checkSize));width:var(--checkSize);height:var(--checkSize);background-color:var(--white_1);border:1px solid var(--black_2);border-radius:var(--checkSize);transition:all 0.2s ease}div.svelte-8xyll0>label.svelte-8xyll0>input[type="checkbox"].svelte-8xyll0.svelte-8xyll0{display:none}
div.svelte-cj2evj{display:flex;flex-direction:column;border:var(--border);border-radius:var(--bradius);padding:var(--padding);width:var(--width);height:var(--height);overflow-x:auto;overflow-y:auto}
div.svelte-nzyp77{display:flex;flex-direction:var(--flex-direction);background-color:var(--normal-bg-color);color:var(--normal-fg-color);padding:var(--padding)}
span.svelte-6v1blh{display:flex;align-items:center;justify-content:center;background-color:var(--normal-bg-color);color:var(--normal-fg-color);border-radius:var(--border-radius);width:var(--width);height:var(--height);padding:var(--padding);transition:all 0.1s ease;user-select:none;opacity:0.6;font-size:var(--text-size-tab-view);white-space:nowrap}span.svelte-6v1blh:hover{opacity:1;color:var(--hover-fg-color);background-color:var(--hover-bg-color)}.active.svelte-6v1blh{opacity:1;color:var(--active-fg-color);background-color:var(--active-bg-color)}
span.svelte-96vfu{color:var(--color);width:var(--width);padding:var(--padding);overflow:var(--overflow);white-space:var(--whiteSpace);text-overflow:var(--textOverflow);font-size:var(--size)}
span.svelte-1tfzwok{color:var(--fg-header)}
span.svelte-1o6jylm{font-size:16px;font-weight:600;color:var(--text-active);padding:var(--padding)}
div.svelte-4a47fy{border:1px solid var(--borders);width:var(--width);height:var(--height)}
popupBody.svelte-195280u{display:block;position:fixed;z-index:9998;width:var(--width);height:var(--height);padding:var(--padding);margin:var(--margin);border:var(--border);border-radius:var(--bradius);background-color:var(--bgColor);box-shadow:0px 10px 16px rgb(0 0 0 / 35%), 0px 2px 5px rgb(0 0 0 / 35%),
      inset 0px 0.5px 0px rgb(0 0 0 / 8%), inset 0px 0px 0.5px rgb(0 0 0 / 35%),
      0px 2px 14px rgb(0 0 0 / 15%), 0px 0px 0px 0.5px rgb(0 0 0 / 20%)}corner.svelte-195280u{position:fixed;width:9px;height:9px;transform:rotate(45deg);z-index:9999;background-color:var(--bg-overlay);box-shadow:0px 10px 16px rgb(0 0 0 / 35%), 0px 2px 5px rgb(0 0 0 / 35%),
      inset 0px 0.5px 0px rgb(0 0 0 / 8%), inset 0px 0px 0.5px rgb(0 0 0 / 35%),
      0px 2px 14px rgb(0 0 0 / 15%), 0px 0px 0px 0.5px rgb(0 0 0 / 20%);border:var(--border);clip-path:polygon(0px 8px, 8px 0px, 0px 0px)}
*::placeholder{color:var(--text);opacity:0.6}*::-webkit-scrollbar{width:8px;height:8px;background:transparent}*::-webkit-scrollbar-corner{display:none}*::-webkit-scrollbar-thumb{background:var(--color-scrollbar, rgba(179, 179, 179, 0.5));border-radius:10px}
section.svelte-1orgh4r.svelte-1orgh4r:focus-visible{outline:none !important}section.svelte-1orgh4r.svelte-1orgh4r{display:flex;outline:none !important}.text.svelte-1orgh4r.svelte-1orgh4r:focus-visible{outline:none !important}.text.svelte-1orgh4r.svelte-1orgh4r{display:flex;min-width:60px;max-width:200px;align-items:center;user-select:none;padding:0 0 0 12px;color:var(--fg-tab);font-size:var(--text-size-tab);outline:none !important}span.svelte-1orgh4r.svelte-1orgh4r{display:inline;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.panel-tab.svelte-1orgh4r.svelte-1orgh4r:focus-visible{outline:none !important}.panel-tab.svelte-1orgh4r.svelte-1orgh4r{display:flex;align-items:stretch;margin:0 0 0 2px;border-radius:3px 3px 0 0px;background-color:var(--bg-tab);transition:all 0.08s ease;outline:none !important;-webkit-app-region:no-drag}.panel-tab.svelte-1orgh4r.svelte-1orgh4r:hover{background-color:var(--bg-tab-hover)}.panel-tab__active.svelte-1orgh4r.svelte-1orgh4r{background-color:var(--bg-tab-hover)}.panel-tab.svelte-1orgh4r:hover span.svelte-1orgh4r{color:var(--fg-tab-hover)}.panel-tab__active.svelte-1orgh4r span.svelte-1orgh4r{color:var(--fg-tab-hover)}
.panel-tabs.svelte-e6fdbd{display:flex;flex-grow:1;align-items:stretch;flex-flow:row;width:100%;scrollbar-width:none;overflow-x:scroll;outline:none !important;color:var(--fg-tab) !important;-webkit-app-region:drag}.panel-tabs.svelte-e6fdbd:focus-visible{outline:none !important}.panel-tabs.svelte-e6fdbd::-webkit-scrollbar{display:none}
#panel.svelte-fa2wn{display:flex;height:40px;background-color:var(--bg-header)}html,body{margin:0;padding:0;border:none;--text-size-tab:14px;--text-size-tab-view:14px;--text-size-popup:14px;font-family:"Inter", sans-serif;font-size:var(--fontSize);font-weight:400}export default undefined;
export default undefined;
export default undefined;
export default undefined;
export default undefined;
export default undefined;
export default undefined;
export default undefined;
export default undefined;
export default undefined;
export default undefined;
export default undefined;
export default undefined;
export default undefined;
export default undefined;
export default undefined;
export default undefined;
export default undefined;
export default undefined;
export default undefined;
export default undefined;
export default undefined;
export default undefined;
export default undefined;
export default undefined;
export default undefined;
export default undefined;
export default undefined;
"use strict";var e=require("electron"),t=require("url");function r(e){var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var o=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,o.get?o:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var o,a=r(e);!function(e){e[e.DEBUG=0]="DEBUG",e[e.INFO=1]="INFO",e[e.WARN=2]="WARN",e[e.ERROR=3]="ERROR"}(o||(o={})),o.INFO,process.env.HOME,process.env.HOME;const s=(t,...r)=>{e.ipcRenderer.send(t,...r)},l=(()=>{let t=0;const r=new Map;return e.ipcRenderer.on("handleCallback",((e,t,o)=>{const a=r.get(t);a?a(o):console.error("[desktop] unexpected callback",t)})),function(o,a,s){const l=t++;return r.set(l,s),e.ipcRenderer.send(`web-callback:${o}`,l,a),()=>{e.ipcRenderer.send("web-cancel-callback",l),r.delete(l)}}})();process.env.FIGMA_LOGLEVEL,t.parse("https://www.figma.com");process.env.HOME,process.env.HOME;const n=["color","backgroundColor","fill","stroke","borderBottomColor","borderRightColor","borderLeftColor","borderTopColor","boxShadow"],i={name:"Default Theme",author:"Figma",id:"0",palette:{text:"#333333","text-active":"#050505","text-disabled":"#b3b3b3",borders:"#e2e2e2","bg-panel":"#ffffff","bg-panel-hover":"#daebf7","bg-toolbar":"#2c2c2c","bg-toolbar-hover":"#000000","bg-toolbar-active":"#18a0fb","fg-toolbar":"#ffffff","fg-toolbar-hover":"#ffffff","fg-toolbar-active":"#ffffff","fg-toolbar-disabled":"#b3b3b3","fg-toolbar-filename":"#ffffff","fg-toolbar-foldername":"#aaaaaa","fg-toolbar-chevron":"#ffffff","fg-toolbar-unsavedicon":"#a1a1a1","fg-toolbar-login-button":"#ffffff","fg-toolbar-login-button-border":"#d3d3d3","fg-toolbar-login-button-active":"#808080","bg-overlay":"#222222","fg-overlay":"#ffffff","bg-overlay-outline":"#292828","bg-overlay-inner-outline":"#000000","bg-tab":"#222222","bg-tab-hover":"#2c2c2c","bg-tab-active":"#2c2c2c","fg-tab":"#ffffff","fg-tab-hover":"#ffffff","fg-tab-active":"#ffffff","bg-header":"#222222","fg-header":"#ffffff","bg-header-control":"#222222","bg-header-control-hover":"#2c2c2c","bg-header-control-active":"#2c2c2c","fg-header-control":"#ffffff","fg-header-control-hover":"#ffffff","fg-header-control-active":"#ffffff","fg-component":"#7b61ff","fg-component-disabled":"#4e428a","fg-component-disabled-row-active":"#bfbafc","bg-window-close":"#e81123","bg-beta-label":"#1bc47d"}},c=[".action--unfaded",".action--enabled",".action_option",".avatar--root--2kH_E",".basic_form--greenBtn",".dropdown--dropdown",".dropdown_menu",".draggable_modal--backgroundOverlay--CPf6e",".emoji-mart-anchor-selected",".flyout_view--flyout",".folder_view--folderTeamName",".folder_view--pathSeparator",".filename_view--title",".filename_view--pathSeparator",".filename_view--dropdownOption",".fullscreen_menu--searchInput",".header_modal--modalBackground",".header--header--",".header--settings",".header--dropdownCaret",".prototype--background",".multilevel_dropdown--",".library_item_tile--descriptionPopout",".pointing_dropdown",".scaling_menu--",".transition_preview_pane--",".top_bar--",".tooltip--",".toolbar_styles--activeButton",".toolbar_styles--enabledButton",".user_view--name",".text--_whiteText",".team_link--icon",".zoom_menu--zoomMenu",".help_widget--helpWidget",".help_widget--tooltip",".raw_components--iconButtonSelected",".visual_bell",".zoom_menu"];process.env.NODE_ENV;const p={"rgb(255, 255, 255)":"var(--bg-panel)","rgb(252, 252, 252)":"var(--bg-panel)","rgb(248, 248, 248)":"var(--bg-panel-hover)","rgb(240, 240, 240)":"var(--bg-panel-hover)","rgb(241, 249, 255)":"var(--bg-panel-hover)","rgb(237, 245, 250)":"var(--bg-panel-hover)","rgb(229, 229, 229)":"var(--borders)","rgb(229, 229, 229) 1px 0px 0px 0px":"var(--borders) 1px 0px 0px 0px","rgb(229, 229, 229) 0px 1px 0px 0px":"var(--borders) 0px 1px 0px 0px","rgb(229, 229, 229) 0px 0px 0px 1px":"var(--borders) 0px 0px 0px 1px","rgb(239, 239, 239)":"var(--borders)","rgb(217, 217, 217)":"var(--borders)","rgb(212, 212, 212)":"var(--borders)","rgb(218, 235, 247)":"var(--bg-panel-hover)","rgb(191, 186, 252)":"var(--fg-component-disabled-row-active)","rgb(180, 180, 250)":"var(--fg-component-disabled-row-active)","rgb(179, 179, 179)":"var(--text-disabled)","rgb(166, 172, 175)":"var(--text-disabled)","rgb(123, 97, 255)":"var(--fg-component)","rgb(68, 68, 68)":"var(--text)","rgb(51, 51, 51)":"var(--text)","rgb(44, 44, 44)":"var(--bg-toolbar)","rgb(5, 5, 5)":"var(--text-active)","rgb(0, 0, 0)":"var(--text-active)","rgba(0, 0, 0, 0.06)":"var(--borders)","rgba(0, 0, 0, 0.1)":"var(--borders)","rgba(0, 0, 0, 0.15)":"var(--text)","rgba(0, 0, 0, 0.2)":"var(--text)","rgba(0, 0, 0, 0.3)":"var(--text-disabled)","rgba(0, 0, 0, 0.4)":"var(--text)","rgba(0, 0, 0, 0.6)":"var(--text)","rgba(0, 0, 0, 0.5)":"var(--text)","rgba(0, 0, 0, 0.75)":"var(--text)","rgba(0, 0, 0, 0.8)":"var(--textActive)","rgba(0, 0, 0, 0.9)":"var(--text)","rgba(0, 0, 0, 0.95)":"var(--text)","rgba(44, 44, 44, 0.8)":"var(--bg-toolbar)","rgba(51, 51, 51, 0.3)":"var(--text-disabled)","rgba(123, 97, 255, 0.4)":"var(--fg-component-disabled)","rgba(255, 255, 255, 0)":"var(--bg-panel)","rgba(255, 255, 255, 0.2)":"var(--bg-panel)","rgba(255, 255, 255, 0.4)":"var(--bg-panel)","rgba(255, 255, 255, 0.05)":"var(--bg-panel)","rgba(255, 255, 255, 0.5)":"var(--bg-panel)","rgba(255, 255, 255, 0.8)":"var(--text)","rgba(255, 255, 255, 0.95)":"var(--bg-panel)","rgb(24, 160, 251)":"var(--bg-toolbar-active)","rgb(24, 160, 251) 0px 0px 0px 1px inset":"var(--bg-toolbar-active) 0px 0px 0px 1px inset","rgb(230, 230, 230) 0px 0px 0px 1px inset":"var(--text) 0px 0px 0px 1px inset","rgb(230, 230, 230)":"var(--borders)","rgb(230, 230, 230) 0px -1px":"var(--borders) 0px -1px","rgb(27, 196, 125)":"var(--bg-beta-label)"};const b=new class{currentTheme;targetElements=new Set;constructor(){this.currentTheme=structuredClone(i),a.ipcRenderer.invoke("themesIsDisabled").then((e=>{e||this.registerEvents()}))}registerEvents(){a.ipcRenderer.on("loadCurrentTheme",((e,t)=>{this.changePalette(t)}))}registerEventsForPreview(){a.ipcRenderer.on("getThemeCreatorPalette",((e,t)=>{this.applyPalette(t)}))}changePalette(e){this.currentTheme=e,this.setThemeVariables()}getCoreStylesheet(){const e=document.styleSheets;let t;return Object.keys(e).forEach((r=>{const o=e[r].href;o&&o.includes("figma_app")&&(t=e[r].cssRules)})),t}isRuleIgnored(e){let t=!1;return c.forEach((r=>{e.includes(r)&&(t=!0)})),t}setThemeVariables(){for(const e of this.targetElements)this.applyPalette(this.currentTheme.palette,e)}applyPalette(e,t=document.body){const r=Object.keys(e);for(const o of r){const r=e[o];t.style.setProperty(`--${o}`,r),"bg-header-control"===o&&(t.style.setProperty("--color-bg-toolbar-secondary",r),t.style.setProperty("--color-bg-toolbar-tertiary",r)),"bg-toolbar-active"===o&&(t.style.setProperty("--bg-primary-btn",r),t.style.setProperty("--color-bg-brand",r),t.style.setProperty("--color-border-toolbar-selected",r),t.style.setProperty("--color-bg-toolbar-selected",r),t.style.setProperty("--color-border-selected",r),t.style.setProperty("--color-bg-menu-selected",r),t.style.setProperty("--color-bg-menu-selected-hover",r),t.style.setProperty("--color-bg-menu-selected-pressed",r)),"fg-overlay"===o&&t.style.setProperty("--color-icon-menu",r),"bg-toolbar-hover"===o&&t.style.setProperty("--color-bg-toolbar-hover",r),"fg-tab-hover"===o&&t.style.setProperty("--color-text-toolbar-hover",r),"fg-overlay"===o&&(t.style.setProperty("--fg-overlay",r),t.style.setProperty("--fg-overlay-right",r)),"fg-toolbar"===o&&(t.style.setProperty("--color-icon-toolbar",r),t.style.setProperty("--color-text-toolbar-secondary",r)),"fg-toolbar-hover"===o&&t.style.setProperty("--color-icon-toolbar-hover",r),"fg-toolbar-active"===o&&(t.style.setProperty("--fg-overlay-active",r),t.style.setProperty("--color-text-menu-hover",r),t.style.setProperty("--color-icon-toolbar-onselected",r),t.style.setProperty("--color-text-onbrand",r),t.style.setProperty("--color-icon-toolbar-tertiary",r),t.style.setProperty("--color-icon-toolbar-hover",r)),"text-disabled"===o&&(t.style.setProperty("--fg-overlay-secondary",r),t.style.setProperty("--fg-toolbar-placeholder",r),t.style.setProperty("--color-icon-disabled",r)),"borders"===o&&(t.style.setProperty("--fg-overlay-sep",r),t.style.setProperty("--color-border-toolbar",r)),"text"===o&&(t.style.setProperty("--color-icon",r),t.style.setProperty("--color-icon-brand",r),t.style.setProperty("--color-icon-secondary",r),t.style.setProperty("--color-icon-tertiary",r)),"text-active"===o&&(t.style.setProperty("--color-icon-hover",r),t.style.setProperty("--color-text-secondary-hover",r),t.style.setProperty("--color-text-hover",r),t.style.setProperty("--color-icon-onselected",r)),"bg-panel-hover"===o&&(t.style.setProperty("--color-bg-pressed",r),t.style.setProperty("--color-bg-tertiary",r)),"fg-component"===o&&(t.style.setProperty("--color-icon-component",r),t.style.setProperty("--color-text-component",r)),"fg-component-disabled"===o&&(t.style.setProperty("--color-icon-component-secondary",r),t.style.setProperty("--color-text-component-secondary",r),t.style.setProperty("--color-icon-component-tertiary",r),t.style.setProperty("--color-text-component-tertiary",r)),"bg-beta-label"===o&&t.style.setProperty("--color-bg-info",r)}t.style.setProperty("background-color","var(--bg-panel)"),t.style.setProperty("--color-bg","var(--bg-panel)"),t.style.setProperty("--color-bg-toolbar","var(--bg-toolbar)"),t.style.setProperty("--color-bg-selected","var(--bg-panel)"),t.style.setProperty("--color-text","var(--text)"),t.style.setProperty("--color-text-secondary","var(--text)"),t.style.setProperty("--color-border","var(--borders)"),t.style.setProperty("--color-border-menu","var(--borders)"),t.style.setProperty("--color-conditionalborder","var(--borders)"),t.style.setProperty("--color-border-tooltip","var(--borders)"),t.style.setProperty("--color-text-disabled","var(--text-disabled)"),t.style.setProperty("--color-bg-selected-secondary","var(--bg-panel)"),t.style.setProperty("--color-bg-selected","var(--bg-panel-hover)"),t.style.setProperty("--color-text-toolbar","var(--text)"),t.style.setProperty("--color-bg-hover","var(--bg-panel-hover)"),t.style.setProperty("--color-bg-secondary","var(--bg-panel-hover)"),t.style.setProperty("--color-bg-tooltip","var(--bg-overlay)"),t.style.setProperty("--ui2-button-color-bg-disabled","var(--borders)")}init(){this.targetElements.add(document.body);const e=this.getCoreStylesheet();if(location.href.match("chrome://gpu")){const e=document.createElement("style");e.innerText="html { background-color: cadetblue; }",document.head.appendChild(e)}if(!e)return;const t=((e,t)=>{const r={"rgb(255, 255, 255)":e["bg-panel"],"rgb(252, 252, 252)":e["bg-panel"],"rgb(248, 248, 248)":e["bg-panel-hover"],"rgb(240, 240, 240)":e["bg-panel-hover"],"rgb(241, 249, 255)":e["bg-panel-hover"],"rgb(237, 245, 250)":e["bg-panel-hover"],"rgb(229, 229, 229)":e.borders,"rgb(229, 229, 229) 1px 0px 0px 0px":`${e.borders} 1px 0px 0px 0px`,"rgb(229, 229, 229) 0px 1px 0px 0px":`${e.borders} 0px 1px 0px 0px`,"rgb(229, 229, 229) 0px 0px 0px 1px":`${e.borders} 0px 0px 0px 1px`,"rgb(239, 239, 239)":e.borders,"rgb(217, 217, 217)":e.borders,"rgb(212, 212, 212)":e.borders,"rgb(218, 235, 247)":e["bg-toolbar-hover"],"rgb(191, 186, 252)":e["fg-component-disabled-row-active"],"rgb(180, 180, 250)":e["fg-component-disabled-row-active"],"rgb(179, 179, 179)":e["text-disabled"],"rgb(166, 172, 175)":e["text-disabled"],"rgb(123, 97, 255)":e["fg-component"],"rgb(68, 68, 68)":e.text,"rgb(51, 51, 51)":e.text,"rgb(44, 44, 44)":e["bg-toolbar"],"rgb(5, 5, 5)":e["text-active"],"rgb(0, 0, 0)":e["text-active"],"rgba(0, 0, 0, 0.06)":e.borders,"rgba(0, 0, 0, 0.1)":e.borders,"rgba(0, 0, 0, 0.15)":e.text,"rgba(0, 0, 0, 0.2)":e.text,"rgba(0, 0, 0, 0.3)":e["text-disabled"],"rgba(0, 0, 0, 0.4)":e.text,"rgba(0, 0, 0, 0.6)":e.text,"rgba(0, 0, 0, 0.5)":e.text,"rgba(0, 0, 0, 0.75)":e.text,"rgba(0, 0, 0, 0.8)":e["text-active"],"rgba(0, 0, 0, 0.9)":e.text,"rgba(0, 0, 0, 0.95)":e.text,"rgba(44, 44, 44, 0.8)":e["bg-toolbar"],"rgba(51, 51, 51, 0.3)":e["text-disabled"],"rgba(123, 97, 255, 0.4)":e["fg-component-disabled"],"rgba(255, 255, 255, 0)":e["bg-panel"],"rgba(255, 255, 255, 0.2)":e["bg-panel"],"rgba(255, 255, 255, 0.4)":e["bg-panel"],"rgba(255, 255, 255, 0.05)":e["bg-panel"],"rgba(255, 255, 255, 0.5)":e["bg-panel"],"rgba(255, 255, 255, 0.8)":e.text,"rgba(255, 255, 255, 0.95)":e["bg-panel"],"rgb(24, 160, 251)":e["bg-toolbar-active"],"rgb(24, 160, 251) 0px 0px 0px 1px inset":`${e["bg-toolbar-active"]} 0px 0px 0px 1px inset`,"rgb(230, 230, 230) 0px 0px 0px 1px inset":`${e["bg-toolbar-active"]} 0px 0px 0px 1px inset`,"rgb(230, 230, 230)":`${e.borders}`,"rgb(230, 230, 230) 0px -1px":`${e.borders}  0px -1px`,"rgb(27, 196, 125)":`${e["bg-beta-label"]}`};if(t){const e={},o=Object.keys(t);for(const a of o)e[t[a]]=r[a];return e}return r})(this.currentTheme.palette),r=["#react-page { background-color: var(--bg-panel); }",'span[class*="action_option--shortcut"] { color: var(--fg-overlay); }','div[class*="file_browser_page_view"] { background-color: var(--bg-panel) !important; }','input[class*="sidebar_search--searchInput"]::placeholder { color: var(--text-active); }'];this.setThemeVariables();for(const o of e)null!=o.selectorText&&!1===this.isRuleIgnored(o.selectorText)&&((null!=o.style&&""!=o.style.color||""!=o.style.backgroundColor||""!=o.style.fill||""!=o.style.stroke||""!=o.style.boxShadow||""!=o.style.borderBottomColor||""!=o.style.borderRightColor||""!=o.style.borderTopColor||""!=o.style.borderLeftColor)&&n.forEach((e=>{const r=o.style[e];""!=r&&Object.prototype.hasOwnProperty.call(t,r)&&(o.style[e]=`${p[r]}`)})),/option_button--toggled|segmented_control--segmentSelected/.test(o.selectorText)&&(o.style["background-color"]="var(--bg-panel-hover)"),/searchIcon/.test(o.selectorText)&&(o.style.fill="var(--fg-toolbar)"),/base_upgrade_section--content/.test(o.selectorText)&&(o.style["background-color"]="var(--borders)"),/tool_bar--toolBarRightSide|pages_panel--pageRowSelected/.test(o.selectorText)&&(o.style.fill="var(--text-active)",o.style["background-color"]="var(--bg-panel-hover)"),/community_hub_link--communityArrow|new_file_creation_topbar--plusIcon|timer_view--plusIcon|delightful_toolbar--verticalButton/.test(o.selectorText)&&(o.style.fill="var(--text-active)"),/new_file_creation_topbar--importIcon|close_button--closeX|new_file_creation_topbar--plusIcon|new_file_creation_topbar--importIcon|option_button--_optionButton|raw_components--_iconButton|object_row--layerIcon|segmented_control--icon/.test(o.selectorText)&&(o.style.color="var(--text-active)",o.style.fill="var(--text-active)"),/search--searchInput__OLD|type_panel--fontPickerTextStyle|public-DraftEditorPlaceholder-root|css_builder_color--colorTextSecondary/.test(o.selectorText)&&(o.style.color="var(--text)"),/optionDisabled|formatted_expanding_textarea--placeholder|expanding_textarea--expandingTextarea--*::placeholder/.test(o.selectorText)&&r.push(`${o.selectorText} { color: var(--text-disabled); }`),/filename_view--pageTitle/.test(o.selectorText)&&(o.style.color="var(--fg-header)"),/starter_kit_ui--option/.test(o.selectorText)&&(o.style.color="black"),/.navbar--workspaceSubtitle/.test(o.selectorText)&&r.push(`${o.selectorText} { color: var(--fg-header); }`),/upgrade_section--icon/.test(o.selectorText)&&r.push('span[class*="upgrade_section--icon"] > svg > path { fill: var(--text); }'),/user_view--devTokenNew|community_hub_banner--bannerIcon|full_width_page--closeMenu/.test(o.selectorText)&&r.push(`${o.selectorText} svg path { fill: var(--text) !important; }`),/basic_form--textInput/.test(o.selectorText)&&(o.style.backgroundColor="var(--bg-panel)"),/step_breadcrumb--stepTitle|account_switcher--dropdownButtonContent|time_display--timeDisplay|.ai_modal--input.+placeholder|colorTextTertiary|css_builder_backgroundColor--colorBgPressed/.test(o.selectorText)&&(o.style.color="var(--text-active)"),/toolbar_view--shareButton|basic_form--primaryBtn/.test(o.selectorText)&&(o.style.color="var(--fg-toolbar-active)"),/time_display--timeInput/.test(o.selectorText)&&r.push(`input${o.selectorText} { color: var(--text-disabled) }`),/.data-preferred-theme=.{3,20}\s?navbar--navbarContainer/.test(o.selectorText)&&(this.targetElements.add(o),this.applyPalette(this.currentTheme.palette,o)),/dlt_submenu--chevronButtonIcon|dlt_hoverable_icon--chevron|delightful_toolbar--connectorIcon/.test(o.selectorText)&&r.push(`${o.selectorText} > svg > path { fill: var(--text-active); }`),/file_browser_layout--fileBrowserPageViewContainer|browse_templates_modal/.test(o.selectorText)&&(r.push(`${o.selectorText}::-webkit-scrollbar { width: 8px; height: 8px; background: transparent; }`),r.push(`${o.selectorText}::-webkit-scrollbar-corner { display: none; }`),r.push(`${o.selectorText}::-webkit-scrollbar-thumb { background: var(--color-scrollbar, rgba(179, 179, 179, 0.5)); border-radius: 10px; }`)),r.push("button[class*=css_builder--colorBgPressed] { color: var(--fg-toolbar-active); }"),r.push("input { color: var(--text-active); }"));if(r.length){const e=document.createElement("style");e.innerText=r.join("\n"),document.head.appendChild(e)}}};let d;const g=new Map,f=e=>{const t=e.data;if(!t)return;if(null!=t.callbackID){const e=l(t.name,t.args,(e=>{d.postMessage({args:e,callbackID:t.callbackID})}));return void g.set(t.callbackID,e)}if(null!=t.cancelCallbackID)return g.get(t.cancelCallbackID)(),void g.delete(t.cancelCallbackID);if(!t.name||!(t.name in u))return void s("logWarn","[desktop] Unhandled message",t.name);let r;try{r=t.name&&u&&u[t.name](t.args)}catch(e){throw console.error("onWebMessage, err: ",t.name,e),e}finally{null!=t.promiseID&&(r instanceof Promise?r.then((e=>{d.postMessage({result:e.data,promiseID:t.promiseID})})).catch((e=>{const r=e&&e.name||"Promise error";d.postMessage({error:r,promiseID:t.promiseID})})):d.postMessage({error:"No result"+r,promiseID:t.promiseID}))}},v=e=>{const t=new MessageChannel,r=new Map,o=new Map;let a,s=0,l=0;window.__figmaContent=!1,/file\/.+/.test(location.href)&&(e.fileBrowser=!1),window.__figmaDesktop={version:e.version,appVersion:e.appVersion,fileBrowser:e.fileBrowser,postMessage:function(e,r,o){console.log("postMessage, name, args, transferList: ",e,r,o),t.port1.postMessage({name:e,args:r},o)},registerCallback:function(e,r,a){const s=l++;return console.log(`Register pending promise with id: "${s}", name: "${e}", args: `,r),o.set(s,a),t.port1.postMessage({name:e,args:r,callbackID:s}),()=>{t.port1.postMessage({cancelCallbackID:s})}},promiseMessage:function(e,o,a){return new Promise(((a,l)=>{const n=s++;r.set(n,{resolve:a,reject:l}),t.port1.postMessage({name:e,args:o,promiseID:n})}))},setMessageHandler:function(e){a=e}},t.port1.onmessage=e=>{const t=e.data;if(t)if(null!=t.promiseID){const e=r.get(t.promiseID);e&&(r.delete(t.promiseID),"result"in t?e.resolve(t.result):(console.error(`Pending Promise (id: "${t.promiseID}") reject via error: `,t.error),e.reject(t.error)))}else if(null!=t.callbackID){const e=o.get(t.callbackID);e?e(t.args):console.log("callback missing? ",t)}else null!=t.name&&a(t.name,t.args)},window.postMessage("init",location.origin,[t.port2])};function y(e){const t=location.href;"F11"===e.code&&((e=>/^(figma:\/\/|https?:\/\/w{0,3}?\.?figma\.com\/file\/)/.test(e))(t)||(e=>/^(figma:\/\/|https?:\/\/w{0,3}?\.?figma\.com\/jam)/.test(e))(t)||(e=>/figma\.com\/proto\/.+\/.+?node-id=.+/.test(e))(t))&&a.ipcRenderer.send("toggleCurrentWindowFullscreen")}const u={setTitle(e){s("setTitle",e.title)},setUser(e){s("setUser",e.id)},setUsingMicrophone(e){s("setUsingMicrophone",e.isUsingMicrophone)},setIsInVoiceCall(e){s("setIsInVoiceCall",e.isInVoiceCall)},addTabAnalyticsMetadata(e){console.log("Method addTabAnalyticsMetadata not implemented, args: ",e)},async requestMicrophonePermission(){let e=!1;try{await navigator.mediaDevices.getUserMedia({video:!1,audio:!0}),e=!0}catch(t){e=!1}return{data:e}},setMediaEnabled:async e=>!0,newFile(e){s("newFile",e.info)},openFile(e){s("openFile","/file/"+e.fileKey,e.title,void 0,e.target)},openCommunity(e){s("openCommunity",e)},openPrototype(e){s("openFile","/proto/"+e.fileKey,e.title,"?node-id="+e.pageId,e.target)},createFile:async e=>({data:await a.ipcRenderer.invoke("createFile",e)}),close(e){s("closeTab",e.suppressReopening)},setLoading(e){s("setLoading",e)},setSaved(e){s("updateSaveStatus",e.saved)},updateFullscreenMenuState(e){s("updateFullscreenMenuState",e.state)},showFileBrowser(){s("showFileBrowser")},setIsPreloaded(){s("setIsPreloaded")},setInitialOptions(e){s("setInitialOptions",e)},setFeatureFlags(e){s("setFeatureFlags",e)},startAppAuth(e){s("startAppAuth",e)},finishAppAuth(e){s("finishAppAuth",e)},openDevTools(e){s("openDevTools",e.mode)},setAuthedUsers(e){s("setAuthedUsers",e.userIDs)},setWorkspaceName(e){s("setWorkspaceName",e.name)},setFigjamEnabled(e){s("setFigjamEnabled",e.figjamEnabled)},getZoomFactor:()=>Promise.resolve({data:a.webFrame.getZoomFactor()}),writeNewExtensionDirectoryToDisk:async e=>({data:await a.ipcRenderer.invoke("writeNewExtensionDirectoryToDisk",e)}),getLocalManifestFileExtensionIdsToCachedMetadataMap:async()=>({data:await a.ipcRenderer.invoke("getLocalManifestFileExtensionIdsToCachedMetadataMap")}),createMultipleNewLocalFileExtensions:async e=>({data:await a.ipcRenderer.invoke("createMultipleNewLocalFileExtensions",e)}),getAllLocalManifestFileExtensionIds:async()=>({data:await a.ipcRenderer.invoke("getAllLocalFileExtensionIds")}),getLocalFileExtensionManifest:async e=>({data:await a.ipcRenderer.invoke("getLocalFileExtensionManifest",e)}),getLocalFileExtensionSource:async e=>({data:await a.ipcRenderer.invoke("getLocalFileExtensionSource",e)}),removeLocalFileExtension(e){a.ipcRenderer.send("removeLocalFileExtension",e)},openExtensionDirectory(e){a.ipcRenderer.send("openExtensionDirectory",e)},openExtensionManifest(e){a.ipcRenderer.send("openExtensionDirectory",e)},writeNewExtensionToDisk:async e=>({data:await a.ipcRenderer.invoke("writeNewExtensionToDisk",e)}),isDevToolsOpened:async()=>({data:await a.ipcRenderer.invoke("isDevToolsOpened")}),getFonts:async e=>({data:await a.ipcRenderer.invoke("getFonts")}),getModifiedFonts:async e=>({data:await a.ipcRenderer.invoke("getFonts")}),getFontsModifiedAt:async e=>({data:await a.ipcRenderer.invoke("getFonts")}),async getFontFile(e){const t=await a.ipcRenderer.invoke("getFontFile",e);return{data:t,transferList:[t]}},getClipboardData:e=>new Promise(((t,r)=>{if(a.clipboard.has("org.nspasteboard.ConcealedType"))return s("logError","Clipboard unavailable"),void r(new Error("Clipboard unavailable"));const o=["com.adobe.pdf","com.adobe.xd","com.bohemiancoding.sketch.v3"],l=e.getArray("formats");for(const e of l){let r=null;if("text/html"===e){const e=a.clipboard.readHTML().trim();e.includes("\x3c!--(figma)")&&e.includes("(/figma)--\x3e")&&(r=Buffer.from(e))}else if("image/svg+xml"===e){if(r=a.clipboard.readBuffer(e),r=r.byteLength>0?r:a.clipboard.readBuffer("Scalable Vector Graphics"),r=r.byteLength>0?r:a.clipboard.readBuffer("CorePasteboardFlavorType 0x53564720"),0===r.byteLength){const e=a.clipboard.readText().trim();e.startsWith("<svg")&&e.endsWith("</svg>")&&(r=Buffer.from(e))}}else"image/jpeg"===e||"image/png"===e?r=a.clipboard.readImage().toBitmap():-1!==o.indexOf(e)&&(r=a.clipboard.readBuffer(e));if(r&&r.byteLength>0){return void t({data:{data:r.buffer,format:e},transferList:[r.buffer]})}}s("logError","Formats not found. Formats: ",l),r(new Error("Formats not found"))})),setClipboardData(e){a.ipcRenderer.send("setClipboardData",e)},async writeFiles(e){await a.ipcRenderer.invoke("writeFiles",e)}};(e=>{window.addEventListener("message",(e=>{"init"===e.data&&e.ports&&e.ports.length&&(d=e.ports[0],d.onmessage=f)}),{once:!0});const t={version:111,appVersion:"999.0.0",fileBrowser:e};a.ipcRenderer.on("newFile",(()=>{d.postMessage({name:"newFile",args:{}})})),a.ipcRenderer.on("handleAction",((e,t,r)=>{d.postMessage({name:"handleAction",args:{action:t,source:r}})})),a.ipcRenderer.on("handleUrl",((e,t,r)=>{d.postMessage({name:"handleUrl",args:{path:t,params:r}})})),a.ipcRenderer.on("handleSetFullScreen",((e,t)=>{d.postMessage({name:"handleSetFullScreen",args:{fullscreen:t}})})),a.ipcRenderer.on("showFlashMessage",((e,t)=>{d.postMessage({name:"showFlashMessage",args:{flashErrorMessage:t}})})),a.ipcRenderer.on("handlePageCommand",((e,t)=>{d.postMessage({name:"handlePageCommand",args:{pageCommand:t,source:"os-menu"}})})),a.ipcRenderer.on("redeemAppAuth",((e,t)=>{d.postMessage({name:"redeemAppAuth",args:{gSecret:t}})})),a.ipcRenderer.on("handlePluginMenuAction",((e,t)=>{d.postMessage({name:"handlePluginMenuAction",args:{pluginMenuAction:t}})})),a.webFrame.executeJavaScript(`(${v.toString()})(${JSON.stringify(t)})`),document.addEventListener("keydown",y),document.addEventListener("DOMContentLoaded",(()=>{a.ipcRenderer.invoke("themesIsDisabled").then((e=>{e||setTimeout((()=>{b.init()}),10)}))}))})(!1);
"use strict";var e=require("electron"),t=require("url");function r(e){var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var o=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,o.get?o:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var o,a=r(e);!function(e){e[e.DEBUG=0]="DEBUG",e[e.INFO=1]="INFO",e[e.WARN=2]="WARN",e[e.ERROR=3]="ERROR"}(o||(o={})),o.INFO,process.env.HOME,process.env.HOME;const s=(t,...r)=>{e.ipcRenderer.send(t,...r)},l=(()=>{let t=0;const r=new Map;return e.ipcRenderer.on("handleCallback",((e,t,o)=>{const a=r.get(t);a?a(o):console.error("[desktop] unexpected callback",t)})),function(o,a,s){const l=t++;return r.set(l,s),e.ipcRenderer.send(`web-callback:${o}`,l,a),()=>{e.ipcRenderer.send("web-cancel-callback",l),r.delete(l)}}})();process.env.FIGMA_LOGLEVEL,t.parse("https://www.figma.com");process.env.HOME,process.env.HOME;const n=["color","backgroundColor","fill","stroke","borderBottomColor","borderRightColor","borderLeftColor","borderTopColor","boxShadow"],i={name:"Default Theme",author:"Figma",id:"0",palette:{text:"#333333","text-active":"#050505","text-disabled":"#b3b3b3",borders:"#e2e2e2","bg-panel":"#ffffff","bg-panel-hover":"#daebf7","bg-toolbar":"#2c2c2c","bg-toolbar-hover":"#000000","bg-toolbar-active":"#18a0fb","fg-toolbar":"#ffffff","fg-toolbar-hover":"#ffffff","fg-toolbar-active":"#ffffff","fg-toolbar-disabled":"#b3b3b3","fg-toolbar-filename":"#ffffff","fg-toolbar-foldername":"#aaaaaa","fg-toolbar-chevron":"#ffffff","fg-toolbar-unsavedicon":"#a1a1a1","fg-toolbar-login-button":"#ffffff","fg-toolbar-login-button-border":"#d3d3d3","fg-toolbar-login-button-active":"#808080","bg-overlay":"#222222","fg-overlay":"#ffffff","bg-overlay-outline":"#292828","bg-overlay-inner-outline":"#000000","bg-tab":"#222222","bg-tab-hover":"#2c2c2c","bg-tab-active":"#2c2c2c","fg-tab":"#ffffff","fg-tab-hover":"#ffffff","fg-tab-active":"#ffffff","bg-header":"#222222","fg-header":"#ffffff","bg-header-control":"#222222","bg-header-control-hover":"#2c2c2c","bg-header-control-active":"#2c2c2c","fg-header-control":"#ffffff","fg-header-control-hover":"#ffffff","fg-header-control-active":"#ffffff","fg-component":"#7b61ff","fg-component-disabled":"#4e428a","fg-component-disabled-row-active":"#bfbafc","bg-window-close":"#e81123","bg-beta-label":"#1bc47d"}},c=[".action--unfaded",".action--enabled",".action_option",".avatar--root--2kH_E",".basic_form--greenBtn",".dropdown--dropdown",".dropdown_menu",".draggable_modal--backgroundOverlay--CPf6e",".emoji-mart-anchor-selected",".flyout_view--flyout",".folder_view--folderTeamName",".folder_view--pathSeparator",".filename_view--title",".filename_view--pathSeparator",".filename_view--dropdownOption",".fullscreen_menu--searchInput",".header_modal--modalBackground",".header--header--",".header--settings",".header--dropdownCaret",".prototype--background",".multilevel_dropdown--",".library_item_tile--descriptionPopout",".pointing_dropdown",".scaling_menu--",".transition_preview_pane--",".top_bar--",".tooltip--",".toolbar_styles--activeButton",".toolbar_styles--enabledButton",".user_view--name",".text--_whiteText",".team_link--icon",".zoom_menu--zoomMenu",".help_widget--helpWidget",".help_widget--tooltip",".raw_components--iconButtonSelected",".visual_bell",".zoom_menu"];process.env.NODE_ENV;const p={"rgb(255, 255, 255)":"var(--bg-panel)","rgb(252, 252, 252)":"var(--bg-panel)","rgb(248, 248, 248)":"var(--bg-panel-hover)","rgb(240, 240, 240)":"var(--bg-panel-hover)","rgb(241, 249, 255)":"var(--bg-panel-hover)","rgb(237, 245, 250)":"var(--bg-panel-hover)","rgb(229, 229, 229)":"var(--borders)","rgb(229, 229, 229) 1px 0px 0px 0px":"var(--borders) 1px 0px 0px 0px","rgb(229, 229, 229) 0px 1px 0px 0px":"var(--borders) 0px 1px 0px 0px","rgb(229, 229, 229) 0px 0px 0px 1px":"var(--borders) 0px 0px 0px 1px","rgb(239, 239, 239)":"var(--borders)","rgb(217, 217, 217)":"var(--borders)","rgb(212, 212, 212)":"var(--borders)","rgb(218, 235, 247)":"var(--bg-panel-hover)","rgb(191, 186, 252)":"var(--fg-component-disabled-row-active)","rgb(180, 180, 250)":"var(--fg-component-disabled-row-active)","rgb(179, 179, 179)":"var(--text-disabled)","rgb(166, 172, 175)":"var(--text-disabled)","rgb(123, 97, 255)":"var(--fg-component)","rgb(68, 68, 68)":"var(--text)","rgb(51, 51, 51)":"var(--text)","rgb(44, 44, 44)":"var(--bg-toolbar)","rgb(5, 5, 5)":"var(--text-active)","rgb(0, 0, 0)":"var(--text-active)","rgba(0, 0, 0, 0.06)":"var(--borders)","rgba(0, 0, 0, 0.1)":"var(--borders)","rgba(0, 0, 0, 0.15)":"var(--text)","rgba(0, 0, 0, 0.2)":"var(--text)","rgba(0, 0, 0, 0.3)":"var(--text-disabled)","rgba(0, 0, 0, 0.4)":"var(--text)","rgba(0, 0, 0, 0.6)":"var(--text)","rgba(0, 0, 0, 0.5)":"var(--text)","rgba(0, 0, 0, 0.75)":"var(--text)","rgba(0, 0, 0, 0.8)":"var(--textActive)","rgba(0, 0, 0, 0.9)":"var(--text)","rgba(0, 0, 0, 0.95)":"var(--text)","rgba(44, 44, 44, 0.8)":"var(--bg-toolbar)","rgba(51, 51, 51, 0.3)":"var(--text-disabled)","rgba(123, 97, 255, 0.4)":"var(--fg-component-disabled)","rgba(255, 255, 255, 0)":"var(--bg-panel)","rgba(255, 255, 255, 0.2)":"var(--bg-panel)","rgba(255, 255, 255, 0.4)":"var(--bg-panel)","rgba(255, 255, 255, 0.05)":"var(--bg-panel)","rgba(255, 255, 255, 0.5)":"var(--bg-panel)","rgba(255, 255, 255, 0.8)":"var(--text)","rgba(255, 255, 255, 0.95)":"var(--bg-panel)","rgb(24, 160, 251)":"var(--bg-toolbar-active)","rgb(24, 160, 251) 0px 0px 0px 1px inset":"var(--bg-toolbar-active) 0px 0px 0px 1px inset","rgb(230, 230, 230) 0px 0px 0px 1px inset":"var(--text) 0px 0px 0px 1px inset","rgb(230, 230, 230)":"var(--borders)","rgb(230, 230, 230) 0px -1px":"var(--borders) 0px -1px","rgb(27, 196, 125)":"var(--bg-beta-label)"};const b=new class{currentTheme;targetElements=new Set;constructor(){this.currentTheme=structuredClone(i),a.ipcRenderer.invoke("themesIsDisabled").then((e=>{e||this.registerEvents()}))}registerEvents(){a.ipcRenderer.on("loadCurrentTheme",((e,t)=>{this.changePalette(t)}))}registerEventsForPreview(){a.ipcRenderer.on("getThemeCreatorPalette",((e,t)=>{this.applyPalette(t)}))}changePalette(e){this.currentTheme=e,this.setThemeVariables()}getCoreStylesheet(){const e=document.styleSheets;let t;return Object.keys(e).forEach((r=>{const o=e[r].href;o&&o.includes("figma_app")&&(t=e[r].cssRules)})),t}isRuleIgnored(e){let t=!1;return c.forEach((r=>{e.includes(r)&&(t=!0)})),t}setThemeVariables(){for(const e of this.targetElements)this.applyPalette(this.currentTheme.palette,e)}applyPalette(e,t=document.body){const r=Object.keys(e);for(const o of r){const r=e[o];t.style.setProperty(`--${o}`,r),"bg-header-control"===o&&(t.style.setProperty("--color-bg-toolbar-secondary",r),t.style.setProperty("--color-bg-toolbar-tertiary",r)),"bg-toolbar-active"===o&&(t.style.setProperty("--bg-primary-btn",r),t.style.setProperty("--color-bg-brand",r),t.style.setProperty("--color-border-toolbar-selected",r),t.style.setProperty("--color-bg-toolbar-selected",r),t.style.setProperty("--color-border-selected",r),t.style.setProperty("--color-bg-menu-selected",r),t.style.setProperty("--color-bg-menu-selected-hover",r),t.style.setProperty("--color-bg-menu-selected-pressed",r)),"fg-overlay"===o&&t.style.setProperty("--color-icon-menu",r),"bg-toolbar-hover"===o&&t.style.setProperty("--color-bg-toolbar-hover",r),"fg-tab-hover"===o&&t.style.setProperty("--color-text-toolbar-hover",r),"fg-overlay"===o&&(t.style.setProperty("--fg-overlay",r),t.style.setProperty("--fg-overlay-right",r)),"fg-toolbar"===o&&(t.style.setProperty("--color-icon-toolbar",r),t.style.setProperty("--color-text-toolbar-secondary",r)),"fg-toolbar-hover"===o&&t.style.setProperty("--color-icon-toolbar-hover",r),"fg-toolbar-active"===o&&(t.style.setProperty("--fg-overlay-active",r),t.style.setProperty("--color-text-menu-hover",r),t.style.setProperty("--color-icon-toolbar-onselected",r),t.style.setProperty("--color-text-onbrand",r),t.style.setProperty("--color-icon-toolbar-tertiary",r),t.style.setProperty("--color-icon-toolbar-hover",r)),"text-disabled"===o&&(t.style.setProperty("--fg-overlay-secondary",r),t.style.setProperty("--fg-toolbar-placeholder",r),t.style.setProperty("--color-icon-disabled",r)),"borders"===o&&(t.style.setProperty("--fg-overlay-sep",r),t.style.setProperty("--color-border-toolbar",r)),"text"===o&&(t.style.setProperty("--color-icon",r),t.style.setProperty("--color-icon-brand",r),t.style.setProperty("--color-icon-secondary",r),t.style.setProperty("--color-icon-tertiary",r)),"text-active"===o&&(t.style.setProperty("--color-icon-hover",r),t.style.setProperty("--color-text-secondary-hover",r),t.style.setProperty("--color-text-hover",r),t.style.setProperty("--color-icon-onselected",r)),"bg-panel-hover"===o&&(t.style.setProperty("--color-bg-pressed",r),t.style.setProperty("--color-bg-tertiary",r)),"fg-component"===o&&(t.style.setProperty("--color-icon-component",r),t.style.setProperty("--color-text-component",r)),"fg-component-disabled"===o&&(t.style.setProperty("--color-icon-component-secondary",r),t.style.setProperty("--color-text-component-secondary",r),t.style.setProperty("--color-icon-component-tertiary",r),t.style.setProperty("--color-text-component-tertiary",r)),"bg-beta-label"===o&&t.style.setProperty("--color-bg-info",r)}t.style.setProperty("background-color","var(--bg-panel)"),t.style.setProperty("--color-bg","var(--bg-panel)"),t.style.setProperty("--color-bg-toolbar","var(--bg-toolbar)"),t.style.setProperty("--color-bg-selected","var(--bg-panel)"),t.style.setProperty("--color-text","var(--text)"),t.style.setProperty("--color-text-secondary","var(--text)"),t.style.setProperty("--color-border","var(--borders)"),t.style.setProperty("--color-border-menu","var(--borders)"),t.style.setProperty("--color-conditionalborder","var(--borders)"),t.style.setProperty("--color-border-tooltip","var(--borders)"),t.style.setProperty("--color-text-disabled","var(--text-disabled)"),t.style.setProperty("--color-bg-selected-secondary","var(--bg-panel)"),t.style.setProperty("--color-bg-selected","var(--bg-panel-hover)"),t.style.setProperty("--color-text-toolbar","var(--text)"),t.style.setProperty("--color-bg-hover","var(--bg-panel-hover)"),t.style.setProperty("--color-bg-secondary","var(--bg-panel-hover)"),t.style.setProperty("--color-bg-tooltip","var(--bg-overlay)"),t.style.setProperty("--ui2-button-color-bg-disabled","var(--borders)")}init(){this.targetElements.add(document.body);const e=this.getCoreStylesheet();if(location.href.match("chrome://gpu")){const e=document.createElement("style");e.innerText="html { background-color: cadetblue; }",document.head.appendChild(e)}if(!e)return;const t=((e,t)=>{const r={"rgb(255, 255, 255)":e["bg-panel"],"rgb(252, 252, 252)":e["bg-panel"],"rgb(248, 248, 248)":e["bg-panel-hover"],"rgb(240, 240, 240)":e["bg-panel-hover"],"rgb(241, 249, 255)":e["bg-panel-hover"],"rgb(237, 245, 250)":e["bg-panel-hover"],"rgb(229, 229, 229)":e.borders,"rgb(229, 229, 229) 1px 0px 0px 0px":`${e.borders} 1px 0px 0px 0px`,"rgb(229, 229, 229) 0px 1px 0px 0px":`${e.borders} 0px 1px 0px 0px`,"rgb(229, 229, 229) 0px 0px 0px 1px":`${e.borders} 0px 0px 0px 1px`,"rgb(239, 239, 239)":e.borders,"rgb(217, 217, 217)":e.borders,"rgb(212, 212, 212)":e.borders,"rgb(218, 235, 247)":e["bg-toolbar-hover"],"rgb(191, 186, 252)":e["fg-component-disabled-row-active"],"rgb(180, 180, 250)":e["fg-component-disabled-row-active"],"rgb(179, 179, 179)":e["text-disabled"],"rgb(166, 172, 175)":e["text-disabled"],"rgb(123, 97, 255)":e["fg-component"],"rgb(68, 68, 68)":e.text,"rgb(51, 51, 51)":e.text,"rgb(44, 44, 44)":e["bg-toolbar"],"rgb(5, 5, 5)":e["text-active"],"rgb(0, 0, 0)":e["text-active"],"rgba(0, 0, 0, 0.06)":e.borders,"rgba(0, 0, 0, 0.1)":e.borders,"rgba(0, 0, 0, 0.15)":e.text,"rgba(0, 0, 0, 0.2)":e.text,"rgba(0, 0, 0, 0.3)":e["text-disabled"],"rgba(0, 0, 0, 0.4)":e.text,"rgba(0, 0, 0, 0.6)":e.text,"rgba(0, 0, 0, 0.5)":e.text,"rgba(0, 0, 0, 0.75)":e.text,"rgba(0, 0, 0, 0.8)":e["text-active"],"rgba(0, 0, 0, 0.9)":e.text,"rgba(0, 0, 0, 0.95)":e.text,"rgba(44, 44, 44, 0.8)":e["bg-toolbar"],"rgba(51, 51, 51, 0.3)":e["text-disabled"],"rgba(123, 97, 255, 0.4)":e["fg-component-disabled"],"rgba(255, 255, 255, 0)":e["bg-panel"],"rgba(255, 255, 255, 0.2)":e["bg-panel"],"rgba(255, 255, 255, 0.4)":e["bg-panel"],"rgba(255, 255, 255, 0.05)":e["bg-panel"],"rgba(255, 255, 255, 0.5)":e["bg-panel"],"rgba(255, 255, 255, 0.8)":e.text,"rgba(255, 255, 255, 0.95)":e["bg-panel"],"rgb(24, 160, 251)":e["bg-toolbar-active"],"rgb(24, 160, 251) 0px 0px 0px 1px inset":`${e["bg-toolbar-active"]} 0px 0px 0px 1px inset`,"rgb(230, 230, 230) 0px 0px 0px 1px inset":`${e["bg-toolbar-active"]} 0px 0px 0px 1px inset`,"rgb(230, 230, 230)":`${e.borders}`,"rgb(230, 230, 230) 0px -1px":`${e.borders}  0px -1px`,"rgb(27, 196, 125)":`${e["bg-beta-label"]}`};if(t){const e={},o=Object.keys(t);for(const a of o)e[t[a]]=r[a];return e}return r})(this.currentTheme.palette),r=["#react-page { background-color: var(--bg-panel); }",'span[class*="action_option--shortcut"] { color: var(--fg-overlay); }','div[class*="file_browser_page_view"] { background-color: var(--bg-panel) !important; }','input[class*="sidebar_search--searchInput"]::placeholder { color: var(--text-active); }'];this.setThemeVariables();for(const o of e)null!=o.selectorText&&!1===this.isRuleIgnored(o.selectorText)&&((null!=o.style&&""!=o.style.color||""!=o.style.backgroundColor||""!=o.style.fill||""!=o.style.stroke||""!=o.style.boxShadow||""!=o.style.borderBottomColor||""!=o.style.borderRightColor||""!=o.style.borderTopColor||""!=o.style.borderLeftColor)&&n.forEach((e=>{const r=o.style[e];""!=r&&Object.prototype.hasOwnProperty.call(t,r)&&(o.style[e]=`${p[r]}`)})),/option_button--toggled|segmented_control--segmentSelected/.test(o.selectorText)&&(o.style["background-color"]="var(--bg-panel-hover)"),/searchIcon/.test(o.selectorText)&&(o.style.fill="var(--fg-toolbar)"),/base_upgrade_section--content/.test(o.selectorText)&&(o.style["background-color"]="var(--borders)"),/tool_bar--toolBarRightSide|pages_panel--pageRowSelected/.test(o.selectorText)&&(o.style.fill="var(--text-active)",o.style["background-color"]="var(--bg-panel-hover)"),/community_hub_link--communityArrow|new_file_creation_topbar--plusIcon|timer_view--plusIcon|delightful_toolbar--verticalButton/.test(o.selectorText)&&(o.style.fill="var(--text-active)"),/new_file_creation_topbar--importIcon|close_button--closeX|new_file_creation_topbar--plusIcon|new_file_creation_topbar--importIcon|option_button--_optionButton|raw_components--_iconButton|object_row--layerIcon|segmented_control--icon/.test(o.selectorText)&&(o.style.color="var(--text-active)",o.style.fill="var(--text-active)"),/search--searchInput__OLD|type_panel--fontPickerTextStyle|public-DraftEditorPlaceholder-root|css_builder_color--colorTextSecondary/.test(o.selectorText)&&(o.style.color="var(--text)"),/optionDisabled|formatted_expanding_textarea--placeholder|expanding_textarea--expandingTextarea--*::placeholder/.test(o.selectorText)&&r.push(`${o.selectorText} { color: var(--text-disabled); }`),/filename_view--pageTitle/.test(o.selectorText)&&(o.style.color="var(--fg-header)"),/starter_kit_ui--option/.test(o.selectorText)&&(o.style.color="black"),/.navbar--workspaceSubtitle/.test(o.selectorText)&&r.push(`${o.selectorText} { color: var(--fg-header); }`),/upgrade_section--icon/.test(o.selectorText)&&r.push('span[class*="upgrade_section--icon"] > svg > path { fill: var(--text); }'),/user_view--devTokenNew|community_hub_banner--bannerIcon|full_width_page--closeMenu/.test(o.selectorText)&&r.push(`${o.selectorText} svg path { fill: var(--text) !important; }`),/basic_form--textInput/.test(o.selectorText)&&(o.style.backgroundColor="var(--bg-panel)"),/step_breadcrumb--stepTitle|account_switcher--dropdownButtonContent|time_display--timeDisplay|.ai_modal--input.+placeholder|colorTextTertiary|css_builder_backgroundColor--colorBgPressed/.test(o.selectorText)&&(o.style.color="var(--text-active)"),/toolbar_view--shareButton|basic_form--primaryBtn/.test(o.selectorText)&&(o.style.color="var(--fg-toolbar-active)"),/time_display--timeInput/.test(o.selectorText)&&r.push(`input${o.selectorText} { color: var(--text-disabled) }`),/.data-preferred-theme=.{3,20}\s?navbar--navbarContainer/.test(o.selectorText)&&(this.targetElements.add(o),this.applyPalette(this.currentTheme.palette,o)),/dlt_submenu--chevronButtonIcon|dlt_hoverable_icon--chevron|delightful_toolbar--connectorIcon/.test(o.selectorText)&&r.push(`${o.selectorText} > svg > path { fill: var(--text-active); }`),/file_browser_layout--fileBrowserPageViewContainer|browse_templates_modal/.test(o.selectorText)&&(r.push(`${o.selectorText}::-webkit-scrollbar { width: 8px; height: 8px; background: transparent; }`),r.push(`${o.selectorText}::-webkit-scrollbar-corner { display: none; }`),r.push(`${o.selectorText}::-webkit-scrollbar-thumb { background: var(--color-scrollbar, rgba(179, 179, 179, 0.5)); border-radius: 10px; }`)),r.push("button[class*=css_builder--colorBgPressed] { color: var(--fg-toolbar-active); }"),r.push("input { color: var(--text-active); }"));if(r.length){const e=document.createElement("style");e.innerText=r.join("\n"),document.head.appendChild(e)}}};let d;const g=new Map,f=e=>{const t=e.data;if(!t)return;if(null!=t.callbackID){const e=l(t.name,t.args,(e=>{d.postMessage({args:e,callbackID:t.callbackID})}));return void g.set(t.callbackID,e)}if(null!=t.cancelCallbackID)return g.get(t.cancelCallbackID)(),void g.delete(t.cancelCallbackID);if(!t.name||!(t.name in u))return void s("logWarn","[desktop] Unhandled message",t.name);let r;try{r=t.name&&u&&u[t.name](t.args)}catch(e){throw console.error("onWebMessage, err: ",t.name,e),e}finally{null!=t.promiseID&&(r instanceof Promise?r.then((e=>{d.postMessage({result:e.data,promiseID:t.promiseID})})).catch((e=>{const r=e&&e.name||"Promise error";d.postMessage({error:r,promiseID:t.promiseID})})):d.postMessage({error:"No result"+r,promiseID:t.promiseID}))}},v=e=>{const t=new MessageChannel,r=new Map,o=new Map;let a,s=0,l=0;window.__figmaContent=!1,/file\/.+/.test(location.href)&&(e.fileBrowser=!1),window.__figmaDesktop={version:e.version,appVersion:e.appVersion,fileBrowser:e.fileBrowser,postMessage:function(e,r,o){console.log("postMessage, name, args, transferList: ",e,r,o),t.port1.postMessage({name:e,args:r},o)},registerCallback:function(e,r,a){const s=l++;return console.log(`Register pending promise with id: "${s}", name: "${e}", args: `,r),o.set(s,a),t.port1.postMessage({name:e,args:r,callbackID:s}),()=>{t.port1.postMessage({cancelCallbackID:s})}},promiseMessage:function(e,o,a){return new Promise(((a,l)=>{const n=s++;r.set(n,{resolve:a,reject:l}),t.port1.postMessage({name:e,args:o,promiseID:n})}))},setMessageHandler:function(e){a=e}},t.port1.onmessage=e=>{const t=e.data;if(t)if(null!=t.promiseID){const e=r.get(t.promiseID);e&&(r.delete(t.promiseID),"result"in t?e.resolve(t.result):(console.error(`Pending Promise (id: "${t.promiseID}") reject via error: `,t.error),e.reject(t.error)))}else if(null!=t.callbackID){const e=o.get(t.callbackID);e?e(t.args):console.log("callback missing? ",t)}else null!=t.name&&a(t.name,t.args)},window.postMessage("init",location.origin,[t.port2])};function y(e){const t=location.href;"F11"===e.code&&((e=>/^(figma:\/\/|https?:\/\/w{0,3}?\.?figma\.com\/file\/)/.test(e))(t)||(e=>/^(figma:\/\/|https?:\/\/w{0,3}?\.?figma\.com\/jam)/.test(e))(t)||(e=>/figma\.com\/proto\/.+\/.+?node-id=.+/.test(e))(t))&&a.ipcRenderer.send("toggleCurrentWindowFullscreen")}const u={setTitle(e){s("setTitle",e.title)},setUser(e){s("setUser",e.id)},setUsingMicrophone(e){s("setUsingMicrophone",e.isUsingMicrophone)},setIsInVoiceCall(e){s("setIsInVoiceCall",e.isInVoiceCall)},addTabAnalyticsMetadata(e){console.log("Method addTabAnalyticsMetadata not implemented, args: ",e)},async requestMicrophonePermission(){let e=!1;try{await navigator.mediaDevices.getUserMedia({video:!1,audio:!0}),e=!0}catch(t){e=!1}return{data:e}},setMediaEnabled:async e=>!0,newFile(e){s("newFile",e.info)},openFile(e){s("openFile","/file/"+e.fileKey,e.title,void 0,e.target)},openCommunity(e){s("openCommunity",e)},openPrototype(e){s("openFile","/proto/"+e.fileKey,e.title,"?node-id="+e.pageId,e.target)},createFile:async e=>({data:await a.ipcRenderer.invoke("createFile",e)}),close(e){s("closeTab",e.suppressReopening)},setLoading(e){s("setLoading",e)},setSaved(e){s("updateSaveStatus",e.saved)},updateFullscreenMenuState(e){s("updateFullscreenMenuState",e.state)},showFileBrowser(){s("showFileBrowser")},setIsPreloaded(){s("setIsPreloaded")},setInitialOptions(e){s("setInitialOptions",e)},setFeatureFlags(e){s("setFeatureFlags",e)},startAppAuth(e){s("startAppAuth",e)},finishAppAuth(e){s("finishAppAuth",e)},openDevTools(e){s("openDevTools",e.mode)},setAuthedUsers(e){s("setAuthedUsers",e.userIDs)},setWorkspaceName(e){s("setWorkspaceName",e.name)},setFigjamEnabled(e){s("setFigjamEnabled",e.figjamEnabled)},getZoomFactor:()=>Promise.resolve({data:a.webFrame.getZoomFactor()}),writeNewExtensionDirectoryToDisk:async e=>({data:await a.ipcRenderer.invoke("writeNewExtensionDirectoryToDisk",e)}),getLocalManifestFileExtensionIdsToCachedMetadataMap:async()=>({data:await a.ipcRenderer.invoke("getLocalManifestFileExtensionIdsToCachedMetadataMap")}),createMultipleNewLocalFileExtensions:async e=>({data:await a.ipcRenderer.invoke("createMultipleNewLocalFileExtensions",e)}),getAllLocalManifestFileExtensionIds:async()=>({data:await a.ipcRenderer.invoke("getAllLocalFileExtensionIds")}),getLocalFileExtensionManifest:async e=>({data:await a.ipcRenderer.invoke("getLocalFileExtensionManifest",e)}),getLocalFileExtensionSource:async e=>({data:await a.ipcRenderer.invoke("getLocalFileExtensionSource",e)}),removeLocalFileExtension(e){a.ipcRenderer.send("removeLocalFileExtension",e)},openExtensionDirectory(e){a.ipcRenderer.send("openExtensionDirectory",e)},openExtensionManifest(e){a.ipcRenderer.send("openExtensionDirectory",e)},writeNewExtensionToDisk:async e=>({data:await a.ipcRenderer.invoke("writeNewExtensionToDisk",e)}),isDevToolsOpened:async()=>({data:await a.ipcRenderer.invoke("isDevToolsOpened")}),getFonts:async e=>({data:await a.ipcRenderer.invoke("getFonts")}),getModifiedFonts:async e=>({data:await a.ipcRenderer.invoke("getFonts")}),getFontsModifiedAt:async e=>({data:await a.ipcRenderer.invoke("getFonts")}),async getFontFile(e){const t=await a.ipcRenderer.invoke("getFontFile",e);return{data:t,transferList:[t]}},getClipboardData:e=>new Promise(((t,r)=>{if(a.clipboard.has("org.nspasteboard.ConcealedType"))return s("logError","Clipboard unavailable"),void r(new Error("Clipboard unavailable"));const o=["com.adobe.pdf","com.adobe.xd","com.bohemiancoding.sketch.v3"],l=e.getArray("formats");for(const e of l){let r=null;if("text/html"===e){const e=a.clipboard.readHTML().trim();e.includes("\x3c!--(figma)")&&e.includes("(/figma)--\x3e")&&(r=Buffer.from(e))}else if("image/svg+xml"===e){if(r=a.clipboard.readBuffer(e),r=r.byteLength>0?r:a.clipboard.readBuffer("Scalable Vector Graphics"),r=r.byteLength>0?r:a.clipboard.readBuffer("CorePasteboardFlavorType 0x53564720"),0===r.byteLength){const e=a.clipboard.readText().trim();e.startsWith("<svg")&&e.endsWith("</svg>")&&(r=Buffer.from(e))}}else"image/jpeg"===e||"image/png"===e?r=a.clipboard.readImage().toBitmap():-1!==o.indexOf(e)&&(r=a.clipboard.readBuffer(e));if(r&&r.byteLength>0){return void t({data:{data:r.buffer,format:e},transferList:[r.buffer]})}}s("logError","Formats not found. Formats: ",l),r(new Error("Formats not found"))})),setClipboardData(e){a.ipcRenderer.send("setClipboardData",e)},async writeFiles(e){await a.ipcRenderer.invoke("writeFiles",e)}};(e=>{window.addEventListener("message",(e=>{"init"===e.data&&e.ports&&e.ports.length&&(d=e.ports[0],d.onmessage=f)}),{once:!0});const t={version:111,appVersion:"999.0.0",fileBrowser:e};a.ipcRenderer.on("newFile",(()=>{d.postMessage({name:"newFile",args:{}})})),a.ipcRenderer.on("handleAction",((e,t,r)=>{d.postMessage({name:"handleAction",args:{action:t,source:r}})})),a.ipcRenderer.on("handleUrl",((e,t,r)=>{d.postMessage({name:"handleUrl",args:{path:t,params:r}})})),a.ipcRenderer.on("handleSetFullScreen",((e,t)=>{d.postMessage({name:"handleSetFullScreen",args:{fullscreen:t}})})),a.ipcRenderer.on("showFlashMessage",((e,t)=>{d.postMessage({name:"showFlashMessage",args:{flashErrorMessage:t}})})),a.ipcRenderer.on("handlePageCommand",((e,t)=>{d.postMessage({name:"handlePageCommand",args:{pageCommand:t,source:"os-menu"}})})),a.ipcRenderer.on("redeemAppAuth",((e,t)=>{d.postMessage({name:"redeemAppAuth",args:{gSecret:t}})})),a.ipcRenderer.on("handlePluginMenuAction",((e,t)=>{d.postMessage({name:"handlePluginMenuAction",args:{pluginMenuAction:t}})})),a.webFrame.executeJavaScript(`(${v.toString()})(${JSON.stringify(t)})`),document.addEventListener("keydown",y),document.addEventListener("DOMContentLoaded",(()=>{a.ipcRenderer.invoke("themesIsDisabled").then((e=>{e||setTimeout((()=>{b.init()}),10)}))}))})(!0);
"use strict";var e=require("url"),t=require("electron");function n(){}const o=e=>e;function r(e){return e()}function i(){return Object.create(null)}function s(e){e.forEach(r)}function l(e){return"function"==typeof e}function c(e,t){return e!=e?t==t:e!==t||e&&"object"==typeof e||"function"==typeof e}function a(e,t,o){e.$$.on_destroy.push(function(e,...t){if(null==e){for(const e of t)e(void 0);return n}const o=e.subscribe(...t);return o.unsubscribe?()=>o.unsubscribe():o}(t,o))}function d(e,t,n,o){if(e){const r=u(e,t,n,o);return e[0](r)}}function u(e,t,n,o){return e[1]&&o?function(e,t){for(const n in t)e[n]=t[n];return e}(n.ctx.slice(),e[1](o(t))):n.ctx}function f(e,t,n,o){if(e[2]&&o){const r=e[2](o(n));if(void 0===t.dirty)return r;if("object"==typeof r){const e=[],n=Math.max(t.dirty.length,r.length);for(let o=0;o<n;o+=1)e[o]=t.dirty[o]|r[o];return e}return t.dirty|r}return t.dirty}function g(e,t,n,o,r,i){if(r){const s=u(t,n,o,i);e.p(s,r)}}function p(e){if(e.ctx.length>32){const t=[],n=e.ctx.length/32;for(let e=0;e<n;e++)t[e]=-1;return t}return-1}function h(e){return null==e?"":e}const m="undefined"!=typeof window;let $=m?()=>window.performance.now():()=>Date.now(),v=m?e=>requestAnimationFrame(e):n;const b=new Set;function w(e){b.forEach((t=>{t.c(e)||(b.delete(t),t.f())})),0!==b.size&&v(w)}function y(e,t){e.appendChild(t)}function C(e){if(!e)return document;const t=e.getRootNode?e.getRootNode():e.ownerDocument;return t&&t.host?t:e.ownerDocument}function x(e){const t=D("style");return t.textContent="/* empty */",function(e,t){y(e.head||e,t),t.sheet}(C(e),t),t.sheet}function T(e,t,n){e.insertBefore(t,n||null)}function E(e){e.parentNode&&e.parentNode.removeChild(e)}function D(e){return document.createElement(e)}function A(e){return document.createElementNS("http://www.w3.org/2000/svg",e)}function B(e){return document.createTextNode(e)}function z(){return B(" ")}function k(e,t,n,o){return e.addEventListener(t,n,o),()=>e.removeEventListener(t,n,o)}function O(e,t,n){null==n?e.removeAttribute(t):e.getAttribute(t)!==n&&e.setAttribute(t,n)}const M=new Map;let L,F=0;function S(e,t,n,o,r,i,s,l=0){const c=16.666/o;let a="{\n";for(let e=0;e<=1;e+=c){const o=t+(n-t)*i(e);a+=100*e+`%{${s(o,1-o)}}\n`}const d=a+`100% {${s(n,1-n)}}\n}`,u=`__svelte_${function(e){let t=5381,n=e.length;for(;n--;)t=(t<<5)-t^e.charCodeAt(n);return t>>>0}(d)}_${l}`,f=C(e),{stylesheet:g,rules:p}=M.get(f)||function(e,t){const n={stylesheet:x(t),rules:{}};return M.set(e,n),n}(f,e);p[u]||(p[u]=!0,g.insertRule(`@keyframes ${u} ${d}`,g.cssRules.length));const h=e.style.animation||"";return e.style.animation=`${h?`${h}, `:""}${u} ${o}ms linear ${r}ms 1 both`,F+=1,u}function _(e,t){const n=(e.style.animation||"").split(", "),o=n.filter(t?e=>e.indexOf(t)<0:e=>-1===e.indexOf("__svelte")),r=n.length-o.length;r&&(e.style.animation=o.join(", "),F-=r,F||v((()=>{F||(M.forEach((e=>{const{ownerNode:t}=e.stylesheet;t&&E(t)})),M.clear())})))}function R(e,t,r,i){if(!t)return n;const s=e.getBoundingClientRect();if(t.left===s.left&&t.right===s.right&&t.top===s.top&&t.bottom===s.bottom)return n;const{delay:l=0,duration:c=300,easing:a=o,start:d=$()+l,end:u=d+c,tick:f=n,css:g}=r(e,{from:t,to:s},i);let p,h=!0,m=!1;function y(){g&&_(e,p),h=!1}return function(e){let t;0===b.size&&v(w),new Promise((n=>{b.add(t={c:e,f:n})}))}((e=>{if(!m&&e>=d&&(m=!0),m&&e>=u&&(f(1,0),y()),!h)return!1;if(m){const t=0+1*a((e-d)/c);f(t,1-t)}return!0})),g&&(p=S(e,0,1,c,l,a,g)),l||(m=!0),f(0,1),y}function I(e){const t=getComputedStyle(e);if("absolute"!==t.position&&"fixed"!==t.position){const{width:n,height:o}=t,r=e.getBoundingClientRect();e.style.position="absolute",e.style.width=n,e.style.height=o,function(e,t){const n=e.getBoundingClientRect();if(t.left!==n.left||t.top!==n.top){const o=getComputedStyle(e),r="none"===o.transform?"":o.transform;e.style.transform=`${r} translate(${t.left-n.left}px, ${t.top-n.top}px)`}}(e,r)}}function N(e){L=e}function P(){const e=function(){if(!L)throw new Error("Function called outside component initialization");return L}();return(t,n,{cancelable:o=!1}={})=>{const r=e.$$.callbacks[t];if(r){const i=function(e,t,{bubbles:n=!1,cancelable:o=!1}={}){return new CustomEvent(e,{detail:t,bubbles:n,cancelable:o})}(t,n,{cancelable:o});return r.slice().forEach((t=>{t.call(e,i)})),!i.defaultPrevented}return!0}}function j(e,t){const n=e.$$.callbacks[t.type];n&&n.slice().forEach((e=>e.call(this,t)))}const H=[],W=[];let q=[];const V=[],Y=Promise.resolve();let X=!1;function Z(e){q.push(e)}const U=new Set;let G=0;function J(){if(0!==G)return;const e=L;do{try{for(;G<H.length;){const e=H[G];G++,N(e),K(e.$$)}}catch(e){throw H.length=0,G=0,e}for(N(null),H.length=0,G=0;W.length;)W.pop()();for(let e=0;e<q.length;e+=1){const t=q[e];U.has(t)||(U.add(t),t())}q.length=0}while(H.length);for(;V.length;)V.pop()();X=!1,U.clear(),N(e)}function K(e){if(null!==e.fragment){e.update(),s(e.before_update);const t=e.dirty;e.dirty=[-1],e.fragment&&e.fragment.p(e.ctx,t),e.after_update.forEach(Z)}}const Q=new Set;let ee;function te(){ee={r:0,c:[],p:ee}}function ne(){ee.r||s(ee.c),ee=ee.p}function oe(e,t){e&&e.i&&(Q.delete(e),e.i(t))}function re(e,t,n,o){if(e&&e.o){if(Q.has(e))return;Q.add(e),ee.c.push((()=>{Q.delete(e),o&&(n&&e.d(1),o())})),e.o(t)}else o&&o()}function ie(e){return void 0!==e?.length?e:Array.from(e)}function se(e,t){e.f(),function(e,t){re(e,1,1,(()=>{t.delete(e.key)}))}(e,t)}function le(e){e&&e.c()}function ce(e,t,n){const{fragment:o,after_update:i}=e.$$;o&&o.m(t,n),Z((()=>{const t=e.$$.on_mount.map(r).filter(l);e.$$.on_destroy?e.$$.on_destroy.push(...t):s(t),e.$$.on_mount=[]})),i.forEach(Z)}function ae(e,t){const n=e.$$;null!==n.fragment&&(!function(e){const t=[],n=[];q.forEach((o=>-1===e.indexOf(o)?t.push(o):n.push(o))),n.forEach((e=>e())),q=t}(n.after_update),s(n.on_destroy),n.fragment&&n.fragment.d(t),n.on_destroy=n.fragment=null,n.ctx=[])}function de(e,t){-1===e.$$.dirty[0]&&(H.push(e),X||(X=!0,Y.then(J)),e.$$.dirty.fill(0)),e.$$.dirty[t/31|0]|=1<<t%31}function ue(e,t,o,r,l,c,a=null,d=[-1]){const u=L;N(e);const f=e.$$={fragment:null,ctx:[],props:c,update:n,not_equal:l,bound:i(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(t.context||(u?u.$$.context:[])),callbacks:i(),dirty:d,skip_bound:!1,root:t.target||u.$$.root};a&&a(f.root);let g=!1;if(f.ctx=o?o(e,t.props||{},((t,n,...o)=>{const r=o.length?o[0]:n;return f.ctx&&l(f.ctx[t],f.ctx[t]=r)&&(!f.skip_bound&&f.bound[t]&&f.bound[t](r),g&&de(e,t)),n})):[],f.update(),g=!0,s(f.before_update),f.fragment=!!r&&r(f.ctx),t.target){if(t.hydrate){const e=function(e){return Array.from(e.childNodes)}(t.target);f.fragment&&f.fragment.l(e),e.forEach(E)}else f.fragment&&f.fragment.c();t.intro&&oe(e.$$.fragment),ce(e,t.target,t.anchor),J()}N(u)}class fe{$$=void 0;$$set=void 0;$destroy(){ae(this,1),this.$destroy=n}$on(e,t){if(!l(t))return n;const o=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return o.push(t),()=>{const e=o.indexOf(t);-1!==e&&o.splice(e,1)}}$set(e){var t;this.$$set&&(t=e,0!==Object.keys(t).length)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}"undefined"!=typeof window&&(window.__svelte||(window.__svelte={v:new Set})).v.add("4");const ge=[];function pe(e,t=n){let o;const r=new Set;function i(t){if(c(e,t)&&(e=t,o)){const t=!ge.length;for(const t of r)t[1](),ge.push(t,e);if(t){for(let e=0;e<ge.length;e+=2)ge[e][0](ge[e+1]);ge.length=0}}}function s(t){i(t(e))}return{set:i,update:s,subscribe:function(l,c=n){const a=[l,c];return r.add(a),1===r.size&&(o=t(i,s)||n),l(e),()=>{r.delete(a),0===r.size&&o&&(o(),o=null)}}}}process.env.FIGMA_LOGLEVEL,e.parse("https://www.figma.com");process.env.HOME,process.env.HOME;const he="New file",me={name:"Default Theme",author:"Figma",id:"0",palette:{text:"#333333","text-active":"#050505","text-disabled":"#b3b3b3",borders:"#e2e2e2","bg-panel":"#ffffff","bg-panel-hover":"#daebf7","bg-toolbar":"#2c2c2c","bg-toolbar-hover":"#000000","bg-toolbar-active":"#18a0fb","fg-toolbar":"#ffffff","fg-toolbar-hover":"#ffffff","fg-toolbar-active":"#ffffff","fg-toolbar-disabled":"#b3b3b3","fg-toolbar-filename":"#ffffff","fg-toolbar-foldername":"#aaaaaa","fg-toolbar-chevron":"#ffffff","fg-toolbar-unsavedicon":"#a1a1a1","fg-toolbar-login-button":"#ffffff","fg-toolbar-login-button-border":"#d3d3d3","fg-toolbar-login-button-active":"#808080","bg-overlay":"#222222","fg-overlay":"#ffffff","bg-overlay-outline":"#292828","bg-overlay-inner-outline":"#000000","bg-tab":"#222222","bg-tab-hover":"#2c2c2c","bg-tab-active":"#2c2c2c","fg-tab":"#ffffff","fg-tab-hover":"#ffffff","fg-tab-active":"#ffffff","bg-header":"#222222","fg-header":"#ffffff","bg-header-control":"#222222","bg-header-control-hover":"#2c2c2c","bg-header-control-active":"#2c2c2c","fg-header-control":"#ffffff","fg-header-control-hover":"#ffffff","fg-header-control-active":"#ffffff","fg-component":"#7b61ff","fg-component-disabled":"#4e428a","fg-component-disabled-row-active":"#bfbafc","bg-window-close":"#e81123","bg-beta-label":"#1bc47d"}};!function(){const{subscribe:e,update:t}=pe({...structuredClone(me),id:"test-creator-theme"})}();const $e=function(){const{subscribe:e,set:t}=pe();return{subscribe:e,set:t,reset:()=>t(structuredClone(me))}}();const ve=function(){const{subscribe:e,set:t,update:n}=pe([]);let o=[];return e((e=>o=e)),{set:t,subscribe:e,addTab:e=>n((t=>[...t,{id:e.id,title:e.title??"Figma",url:e.url,moves:!1,order:e.order??t.length+1,focused:e.focused,isUsingMicrophone:!1,isInVoiceCall:!1,loading:!0}].sort(((e,t)=>e.order>t.order?1:-1)))),deleteTab:e=>n((t=>t.filter((t=>t.id!==e)))),clear:()=>n((e=>[])),updateTab:e=>n((t=>t.map((t=>t.id===e.id?{...t,...e}:t)).sort(((e,t)=>e.order>t.order?1:-1)))),getTab:e=>o.find((t=>t.id===e)),getTabByTitle:e=>o.find((t=>t.title===e))}}();const be=function(){const{subscribe:e,set:t}=pe("mainTab");return{subscribe:e,set:t}}();const we=function(){const{subscribe:e,update:t,set:n}=pe(!1);return{subscribe:e,set:n,toggle:()=>t((e=>!e))}}();const ye=function(){const{subscribe:e,update:t,set:n}=pe(1);return{subscribe:e,update:t,set:n}}();const Ce=function(){const{subscribe:e,update:t,set:n}=pe(!0);return{subscribe:e,set:n,toggle:()=>t((e=>!e))}}();const xe=function(){const{subscribe:e,update:t,set:n}=pe(!1);return{subscribe:e,set:n,toggle:()=>t((e=>!e))}}();function Te(e){let t,o,r;return{c(){t=A("svg"),o=A("g"),r=A("path"),O(r,"fill-rule","evenodd"),O(r,"clip-rule","evenodd"),O(r,"d","M7.116 8l-4.558 4.558l.884.884L8 8.884l4.558 4.558l.884-.884L8.884 8l4.558-4.558l-.884-.884L8 7.116L3.442 2.558l-.884.884L7.116 8z"),O(o,"fill",e[1]),O(t,"width",e[0]),O(t,"height",e[0]),O(t,"viewBox","0 0 16 16"),O(t,"fill","none"),O(t,"xmlns","http://www.w3.org/2000/svg")},m(e,n){T(e,t,n),y(t,o),y(o,r)},p(e,[n]){2&n&&O(o,"fill",e[1]),1&n&&O(t,"width",e[0]),1&n&&O(t,"height",e[0])},i:n,o:n,d(e){e&&E(t)}}}function Ee(e,t,n){let{size:o="16"}=t,{color:r="var(--fg-header)"}=t;return e.$$set=e=>{"size"in e&&n(0,o=e.size),"color"in e&&n(1,r=e.color)},[o,r]}class De extends fe{constructor(e){super(),ue(this,e,Ee,Te,c,{size:0,color:1})}}function Ae(e){let t,o;return{c(){t=A("svg"),o=A("path"),O(o,"fill",e[1]),O(o,"fill-rule","evenodd"),O(o,"clip-rule","evenodd"),O(o,"d","M1.0205 7.5C1.234 10.0874 3.0891 12.2092 5.5419 12.8216C4.887 11.6529 4.4403 9.7192 4.3816 7.5H1.0205ZM7 14C3.134 14 0 10.866 0 7C0 3.134 3.134 0 7 0C10.866 0 14 3.134 14 7C14 10.866 10.866 14 7 14ZM5.5419 1.1784C3.0891 1.7908 1.234 3.9126 1.0205 6.5H4.3816C4.4403 4.2808 4.887 2.3471 5.5419 1.1784ZM8.4581 1.1784C10.9109 1.7908 12.766 3.9126 12.9795 6.5H9.6184C9.5597 4.2808 9.113 2.3471 8.4581 1.1784ZM12.9795 7.5C12.766 10.0874 10.9109 12.2092 8.4581 12.8216C9.113 11.6529 9.5597 9.7192 9.6184 7.5H12.9795ZM7.9198 11.5986C8.3042 10.5735 8.5723 9.1378 8.618 7.5H5.382C5.4277 9.1378 5.6958 10.5735 6.0802 11.5986C6.2931 12.1664 6.5225 12.5564 6.7265 12.7865C6.8258 12.8985 6.9029 12.9543 6.95 12.98C6.9725 12.9923 6.9867 12.9969 6.993 12.9986C6.9963 12.9995 6.9989 12.9999 6.9989 12.9999L7 13L7.0011 12.9999C7.0011 12.9999 7.0037 12.9995 7.007 12.9986C7.0133 12.9969 7.0275 12.9923 7.05 12.98C7.0971 12.9543 7.1742 12.8985 7.2735 12.7865C7.4775 12.5564 7.7069 12.1664 7.9198 11.5986ZM6.0802 2.4014C5.6958 3.4265 5.4277 4.8622 5.382 6.5H8.618C8.5723 4.8622 8.3042 3.4265 7.9198 2.4014C7.7069 1.8336 7.4775 1.4436 7.2735 1.2135C7.1742 1.1015 7.0971 1.0457 7.05 1.02C7.0275 1.0077 7.0133 1.0031 7.007 1.0014C7.0037 1.0005 7.0011 1.0001 7.0011 1.0001L7 1L6.9989 1.0001C6.9989 1.0001 6.9963 1.0005 6.993 1.0014C6.9867 1.0031 6.9725 1.0077 6.95 1.02C6.9029 1.0457 6.8258 1.1015 6.7265 1.2135C6.5225 1.4436 6.2931 1.8336 6.0802 2.4014Z"),O(t,"width",e[0]),O(t,"height",e[0]),O(t,"viewBox","0 0 14 14"),O(t,"fill","none"),O(t,"xmlns","http://www.w3.org/2000/svg")},m(e,n){T(e,t,n),y(t,o)},p(e,[n]){2&n&&O(o,"fill",e[1]),1&n&&O(t,"width",e[0]),1&n&&O(t,"height",e[0])},i:n,o:n,d(e){e&&E(t)}}}function Be(e,t,n){let{size:o="18"}=t,{color:r="var(--fg-header)"}=t;return e.$$set=e=>{"size"in e&&n(0,o=e.size),"color"in e&&n(1,r=e.color)},[o,r]}class ze extends fe{constructor(e){super(),ue(this,e,Be,Ae,c,{size:0,color:1})}}function ke(e){let t,o;return{c(){t=A("svg"),o=A("path"),O(o,"d","M1 6.48529L6.65685 12.1421L12.3137 6.48529"),O(o,"stroke",e[1]),O(t,"width",e[0]),O(t,"height",e[0]),O(t,"viewBox","0 0 16 16"),O(t,"fill","none"),O(t,"xmlns","http://www.w3.org/2000/svg")},m(e,n){T(e,t,n),y(t,o)},p(e,[n]){2&n&&O(o,"stroke",e[1]),1&n&&O(t,"width",e[0]),1&n&&O(t,"height",e[0])},i:n,o:n,d(e){e&&E(t)}}}function Oe(e,t,n){let{size:o="16"}=t,{color:r="var(--fg-header)"}=t;return e.$$set=e=>{"size"in e&&n(0,o=e.size),"color"in e&&n(1,r=e.color)},[o,r]}class Me extends fe{constructor(e){super(),ue(this,e,Oe,ke,c,{size:0,color:1})}}function Le(e){let t,o;return{c(){t=A("svg"),o=A("path"),O(o,"d","M5.5 1.5h-2c-1.105 0-2 .895-2 2 0 1.105.895 2 2 2h2v-4zm-5 2c0 1.043.533 1.963 1.341 2.5C1.033 6.537.5 7.457.5 8.5c0 1.043.533 1.963 1.341 2.5C1.033 11.537.5 12.457.5 13.5c0 1.657 1.343 3 3 3 1.657 0 3-1.343 3-3V10.736c.53.475 1.232.764 2 .764 1.657 0 3-1.343 3-3 0-1.043-.533-1.963-1.341-2.5.808-.537 1.341-1.457 1.341-2.5 0-1.657-1.343-3-3-3h-5c-1.657 0-3 1.343-3 3zm1 5c0-1.105.895-2 2-2h2v4h-2c-1.105 0-2-.895-2-2zm0 5c0-1.105.895-2 2-2h2v2c0 1.105-.895 2-2 2-1.105 0-2-.895-2-2zm7-3c-1.105 0-2-.895-2-2 0-1.105.895-2 2-2 1.105 0 2 .895 2 2 0 1.105-.895 2-2 2zm0-5h-2v-4h2c1.105 0 2 .895 2 2 0 1.105-.895 2-2 2z"),O(o,"fill-rule","evenodd"),O(o,"fill-opacity","1"),O(o,"fill",e[1]),O(o,"stroke","none"),O(t,"class","svg"),O(t,"width",e[0]),O(t,"height",e[0]),O(t,"viewBox","0 0 12 17"),O(t,"xmlns","http://www.w3.org/2000/svg")},m(e,n){T(e,t,n),y(t,o)},p(e,[n]){2&n&&O(o,"fill",e[1]),1&n&&O(t,"width",e[0]),1&n&&O(t,"height",e[0])},i:n,o:n,d(e){e&&E(t)}}}function Fe(e,t,n){let{size:o="16"}=t,{color:r="var(--fg-header)"}=t;return e.$$set=e=>{"size"in e&&n(0,o=e.size),"color"in e&&n(1,r=e.color)},[o,r]}class Se extends fe{constructor(e){super(),ue(this,e,Fe,Le,c,{size:0,color:1})}}function _e(e){let t,o,r;return{c(){t=A("svg"),o=A("g"),r=A("path"),O(r,"d","M3 3v10h10V3H3zm9 9H4V4h8v8z"),O(o,"fill",e[1]),O(t,"viewBox","0 0 16 16"),O(t,"fill","none"),O(t,"height",e[0]),O(t,"width",e[0]),O(t,"xmlns","http://www.w3.org/2000/svg")},m(e,n){T(e,t,n),y(t,o),y(o,r)},p(e,[n]){2&n&&O(o,"fill",e[1]),1&n&&O(t,"height",e[0]),1&n&&O(t,"width",e[0])},i:n,o:n,d(e){e&&E(t)}}}function Re(e,t,n){let{size:o="16"}=t,{color:r="var(--fg-header)"}=t;return e.$$set=e=>{"size"in e&&n(0,o=e.size),"color"in e&&n(1,r=e.color)},[o,r]}class Ie extends fe{constructor(e){super(),ue(this,e,Re,_e,c,{size:0,color:1})}}function Ne(e){let t,o,r,i;return{c(){t=A("svg"),o=A("path"),r=A("g"),i=A("path"),O(o,"d","M3 12.277H13"),O(i,"d","M14 8v1H3V8h11z"),O(r,"fill",e[1]),O(t,"width",e[0]),O(t,"height",e[0]),O(t,"viewBox","0 0 16 16"),O(t,"fill","none"),O(t,"xmlns","http://www.w3.org/2000/svg")},m(e,n){T(e,t,n),y(t,o),y(t,r),y(r,i)},p(e,[n]){2&n&&O(r,"fill",e[1]),1&n&&O(t,"width",e[0]),1&n&&O(t,"height",e[0])},i:n,o:n,d(e){e&&E(t)}}}function Pe(e,t,n){let{size:o="16"}=t,{color:r="var(--fg-header)"}=t;return e.$$set=e=>{"size"in e&&n(0,o=e.size),"color"in e&&n(1,r=e.color)},[o,r]}class je extends fe{constructor(e){super(),ue(this,e,Pe,Ne,c,{size:0,color:1})}}function He(e){let t,o;return{c(){t=A("svg"),o=A("path"),O(o,"d","M2.5 6.5v1h4v4h1v-4h4v-1h-4v-4h-1v4h-4z"),O(o,"fill",e[1]),O(t,"class","svg"),O(t,"width",e[0]),O(t,"height",e[0]),O(t,"viewBox","0 0 14 14"),O(t,"xmlns","http://www.w3.org/2000/svg")},m(e,n){T(e,t,n),y(t,o)},p(e,[n]){2&n&&O(o,"fill",e[1]),1&n&&O(t,"width",e[0]),1&n&&O(t,"height",e[0])},i:n,o:n,d(e){e&&E(t)}}}function We(e,t,n){let{size:o="16"}=t,{color:r="var(--fg-header)"}=t;return e.$$set=e=>{"size"in e&&n(0,o=e.size),"color"in e&&n(1,r=e.color)},[o,r]}class qe extends fe{constructor(e){super(),ue(this,e,We,He,c,{size:0,color:1})}}function Ve(e){let t,o;return{c(){t=A("svg"),o=A("path"),O(o,"d","M1 7c0-3.314 2.686-6 6-6 1.679 0 3.196.689 4.286 1.8L12 2.102C10.73.805 8.959 0 7 0 3.134 0 0 3.134 0 7h1z"),O(o,"fill-rule","nonzero"),O(o,"fill-opacity","1"),O(o,"fill",e[1]),O(o,"stroke","none"),O(t,"width",e[0]),O(t,"height",e[0]),O(t,"viewBox","0 0 14 14"),O(t,"xmlns","http://www.w3.org/2000/svg")},m(e,n){T(e,t,n),y(t,o)},p(e,[n]){2&n&&O(o,"fill",e[1]),1&n&&O(t,"width",e[0]),1&n&&O(t,"height",e[0])},i:n,o:n,d(e){e&&E(t)}}}function Ye(e,t,n){let{size:o="16"}=t,{color:r="var(--fg-header)"}=t;return e.$$set=e=>{"size"in e&&n(0,o=e.size),"color"in e&&n(1,r=e.color)},[o,r]}class Xe extends fe{constructor(e){super(),ue(this,e,Ye,Ve,c,{size:0,color:1})}}function Ze(e){let t,n,o,r,i,s;const l=e[26].default,c=d(l,e,e[25],null);return{c(){t=D("div"),c&&c.c(),O(t,"class",n=h(`\n    ${e[21]?"button__active ":""}\n    ${e[22]?"button__disabled":""}\n  `)+" svelte-y4g53z"),O(t,"style",o=`\n    --padding: ${e[3]};\n    --margin: ${e[4]};\n    --width: ${e[0]};\n    --height: ${e[1]};\n    --border-radius: ${e[2]}px;\n\n    --normal-bg-alpha: ${e[8]};\n    --active-bg-alpha: ${e[9]};\n    --hover-bg-alpha: ${e[10]};\n\n    --normal-bg-color: ${e[11]};\n    --hover-bg-color: ${e[12]};\n    --active-bg-color: ${e[13]};\n    --disabled-bg-color: ${e[14]};\n\n    --normal-fg-color: ${e[5]};\n    --active-fg-color: ${e[6]};\n    --hover-fg-color: ${e[7]};\n\n    --normal-border: ${e[15]};\n    --active-border: ${e[16]};\n    --hover-border: ${e[17]};\n\n    --normal-cursor: ${e[18]};\n    --active-cursor: ${e[19]};\n    --hover-cursor: ${e[20]};\n  `)},m(n,o){T(n,t,o),c&&c.m(t,null),r=!0,i||(s=k(t,"mouseup",e[23],!0),i=!0)},p(e,[i]){c&&c.p&&(!r||33554432&i)&&g(c,l,e,e[25],r?f(l,e[25],i,null):p(e[25]),null),(!r||6291456&i&&n!==(n=h(`\n    ${e[21]?"button__active ":""}\n    ${e[22]?"button__disabled":""}\n  `)+" svelte-y4g53z"))&&O(t,"class",n),(!r||2097151&i&&o!==(o=`\n    --padding: ${e[3]};\n    --margin: ${e[4]};\n    --width: ${e[0]};\n    --height: ${e[1]};\n    --border-radius: ${e[2]}px;\n\n    --normal-bg-alpha: ${e[8]};\n    --active-bg-alpha: ${e[9]};\n    --hover-bg-alpha: ${e[10]};\n\n    --normal-bg-color: ${e[11]};\n    --hover-bg-color: ${e[12]};\n    --active-bg-color: ${e[13]};\n    --disabled-bg-color: ${e[14]};\n\n    --normal-fg-color: ${e[5]};\n    --active-fg-color: ${e[6]};\n    --hover-fg-color: ${e[7]};\n\n    --normal-border: ${e[15]};\n    --active-border: ${e[16]};\n    --hover-border: ${e[17]};\n\n    --normal-cursor: ${e[18]};\n    --active-cursor: ${e[19]};\n    --hover-cursor: ${e[20]};\n  `))&&O(t,"style",o)},i(e){r||(oe(c,e),r=!0)},o(e){re(c,e),r=!1},d(e){e&&E(t),c&&c.d(e),i=!1,s()}}}function Ue(e,t,n){let{$$slots:o={},$$scope:r}=t;const i=P();let{round:s=0}=t,{size:l}=t,{width:c="inherit"}=t,{height:a="inherit"}=t,{padding:d="inherit"}=t,{margin:u="inherit"}=t,{normalFgColor:f="var(--text)"}=t,{activeFgColor:g="var(--text-active)"}=t,{hoverFgColor:p="var(--text-active)"}=t,{normalBgAlpha:h="1"}=t,{activeBgAlpha:m="1"}=t,{hoverBgAlpha:$="1"}=t,{normalBgColor:v="transparent"}=t,{hoverBgColor:b="var(--bg-tab-hover)"}=t,{activeBgColor:w="var(--bg-tab-hover)"}=t,{disabledBgColor:y="var(--borders)"}=t,{normalBorder:C="none"}=t,{activeBorder:x="none"}=t,{hoverBorder:T="none"}=t,{normalCursor:E="default"}=t,{activeCursor:D="default"}=t,{hoverCursor:A="default"}=t,{isActive:B=!1}=t,{disabled:z=!1}=t;return l&&(c=`${l}px`,a=`${l}px`),e.$$set=e=>{"round"in e&&n(2,s=e.round),"size"in e&&n(24,l=e.size),"width"in e&&n(0,c=e.width),"height"in e&&n(1,a=e.height),"padding"in e&&n(3,d=e.padding),"margin"in e&&n(4,u=e.margin),"normalFgColor"in e&&n(5,f=e.normalFgColor),"activeFgColor"in e&&n(6,g=e.activeFgColor),"hoverFgColor"in e&&n(7,p=e.hoverFgColor),"normalBgAlpha"in e&&n(8,h=e.normalBgAlpha),"activeBgAlpha"in e&&n(9,m=e.activeBgAlpha),"hoverBgAlpha"in e&&n(10,$=e.hoverBgAlpha),"normalBgColor"in e&&n(11,v=e.normalBgColor),"hoverBgColor"in e&&n(12,b=e.hoverBgColor),"activeBgColor"in e&&n(13,w=e.activeBgColor),"disabledBgColor"in e&&n(14,y=e.disabledBgColor),"normalBorder"in e&&n(15,C=e.normalBorder),"activeBorder"in e&&n(16,x=e.activeBorder),"hoverBorder"in e&&n(17,T=e.hoverBorder),"normalCursor"in e&&n(18,E=e.normalCursor),"activeCursor"in e&&n(19,D=e.activeCursor),"hoverCursor"in e&&n(20,A=e.hoverCursor),"isActive"in e&&n(21,B=e.isActive),"disabled"in e&&n(22,z=e.disabled),"$$scope"in e&&n(25,r=e.$$scope)},[c,a,s,d,u,f,g,p,h,m,$,v,b,w,y,C,x,T,E,D,A,B,z,function(e){z||i("buttonClick",e)},l,r,o]}class Ge extends fe{constructor(e){super(),ue(this,e,Ue,Ze,c,{round:2,size:24,width:0,height:1,padding:3,margin:4,normalFgColor:5,activeFgColor:6,hoverFgColor:7,normalBgAlpha:8,activeBgAlpha:9,hoverBgAlpha:10,normalBgColor:11,hoverBgColor:12,activeBgColor:13,disabledBgColor:14,normalBorder:15,activeBorder:16,hoverBorder:17,normalCursor:18,activeCursor:19,hoverCursor:20,isActive:21,disabled:22})}}function Je(e){let t;const n=e[5].default,o=d(n,e,e[7],null);return{c(){o&&o.c()},m(e,n){o&&o.m(e,n),t=!0},p(e,r){o&&o.p&&(!t||128&r)&&g(o,n,e,e[7],t?f(n,e[7],r,null):p(e[7]),null)},i(e){t||(oe(o,e),t=!0)},o(e){re(o,e),t=!1},d(e){o&&o.d(e)}}}function Ke(e){let t,n;return t=new Ge({props:{padding:e[0],normalBgColor:e[1],activeBgColor:e[2],hoverBgColor:e[3],isActive:e[4],$$slots:{default:[Je]},$$scope:{ctx:e}}}),t.$on("buttonClick",e[6]),{c(){le(t.$$.fragment)},m(e,o){ce(t,e,o),n=!0},p(e,[n]){const o={};1&n&&(o.padding=e[0]),2&n&&(o.normalBgColor=e[1]),4&n&&(o.activeBgColor=e[2]),8&n&&(o.hoverBgColor=e[3]),16&n&&(o.isActive=e[4]),128&n&&(o.$$scope={dirty:n,ctx:e}),t.$set(o)},i(e){n||(oe(t.$$.fragment,e),n=!0)},o(e){re(t.$$.fragment,e),n=!1},d(e){ae(t,e)}}}function Qe(e,t,n){let{$$slots:o={},$$scope:r}=t,{padding:i="0px 18px"}=t,{normalBgColor:s="var(--bg-header-control)"}=t,{activeBgColor:l="var(--bg-header-control-hover)"}=t,{hoverBgColor:c="var(--bg-header-control-hover)"}=t,{isActive:a=!1}=t;return e.$$set=e=>{"padding"in e&&n(0,i=e.padding),"normalBgColor"in e&&n(1,s=e.normalBgColor),"activeBgColor"in e&&n(2,l=e.activeBgColor),"hoverBgColor"in e&&n(3,c=e.hoverBgColor),"isActive"in e&&n(4,a=e.isActive),"$$scope"in e&&n(7,r=e.$$scope)},[i,s,l,c,a,o,function(t){j.call(this,e,t)},r]}class et extends fe{constructor(e){super(),ue(this,e,Qe,Ke,c,{padding:0,normalBgColor:1,activeBgColor:2,hoverBgColor:3,isActive:4})}}function tt(e){let t,n,o,r,i;const l=e[15].default,c=d(l,e,e[14],null);return{c(){t=D("div"),c&&c.c(),O(t,"style",n=`\n    --padding: ${e[3]};\n    --width: ${e[0]};\n    --height: ${e[1]};\n    --border-radius: ${e[2]}px;\n    --normal-bg-color: ${e[6]};\n    --hover-bg-color: ${e[7]};\n\n    --normal-fg-color: ${e[4]};\n    --hover-fg-color: ${e[5]};\n\n    --normal-opacity: ${e[8]};\n    --hover-opacity: ${e[9]};\n  `),O(t,"class","svelte-pkmuda")},m(n,s){T(n,t,s),c&&c.m(t,null),o=!0,r||(i=[k(t,"mouseup",e[11],!0),k(t,"mouseenter",e[16]),k(t,"mouseleave",e[17])],r=!0)},p(e,[r]){c&&c.p&&(!o||16384&r)&&g(c,l,e,e[14],o?f(l,e[14],r,null):p(e[14]),null),(!o||1023&r&&n!==(n=`\n    --padding: ${e[3]};\n    --width: ${e[0]};\n    --height: ${e[1]};\n    --border-radius: ${e[2]}px;\n    --normal-bg-color: ${e[6]};\n    --hover-bg-color: ${e[7]};\n\n    --normal-fg-color: ${e[4]};\n    --hover-fg-color: ${e[5]};\n\n    --normal-opacity: ${e[8]};\n    --hover-opacity: ${e[9]};\n  `))&&O(t,"style",n)},i(e){o||(oe(c,e),o=!0)},o(e){re(c,e),o=!1},d(e){e&&E(t),c&&c.d(e),r=!1,s(i)}}}function nt(e,t,n){let{$$slots:o={},$$scope:r}=t;const i=P();let{round:s=0}=t,{size:l}=t,{width:c="auto"}=t,{height:a="auto"}=t,{padding:d="auto"}=t,{normalFgColor:u="var(--fg-header)"}=t,{hoverFgColor:f="var(--fg-tab-hover)"}=t,{normalBgColor:g="var(--bg-header)"}=t,{hoverBgColor:p="var(--bg-tab-hover)"}=t,{normalOpacity:h=.4}=t,{hoverOpacity:m=1}=t,{disabled:$=!1}=t;l&&(c=`${l}px`,a=`${l}px`);return e.$$set=e=>{"round"in e&&n(2,s=e.round),"size"in e&&n(12,l=e.size),"width"in e&&n(0,c=e.width),"height"in e&&n(1,a=e.height),"padding"in e&&n(3,d=e.padding),"normalFgColor"in e&&n(4,u=e.normalFgColor),"hoverFgColor"in e&&n(5,f=e.hoverFgColor),"normalBgColor"in e&&n(6,g=e.normalBgColor),"hoverBgColor"in e&&n(7,p=e.hoverBgColor),"normalOpacity"in e&&n(8,h=e.normalOpacity),"hoverOpacity"in e&&n(9,m=e.hoverOpacity),"disabled"in e&&n(13,$=e.disabled),"$$scope"in e&&n(14,r=e.$$scope)},[c,a,s,d,u,f,g,p,h,m,i,function(e){$||i("buttonClick")},l,$,r,o,e=>i("mouseenter",e),e=>i("mouseleave",e)]}class ot extends fe{constructor(e){super(),ue(this,e,nt,tt,c,{round:2,size:12,width:0,height:1,padding:3,normalFgColor:4,hoverFgColor:5,normalBgColor:6,hoverBgColor:7,normalOpacity:8,hoverOpacity:9,disabled:13})}}function rt(e){let t,o;return t=new Me({props:{size:"14"}}),{c(){le(t.$$.fragment)},m(e,n){ce(t,e,n),o=!0},p:n,i(e){o||(oe(t.$$.fragment,e),o=!0)},o(e){re(t.$$.fragment,e),o=!1},d(e){ae(t,e)}}}function it(e){let t,o;return t=new je({props:{size:"16"}}),{c(){le(t.$$.fragment)},m(e,n){ce(t,e,n),o=!0},p:n,i(e){o||(oe(t.$$.fragment,e),o=!0)},o(e){re(t.$$.fragment,e),o=!1},d(e){ae(t,e)}}}function st(e){let t,o;return t=new Ie({props:{size:"16"}}),{c(){le(t.$$.fragment)},m(e,n){ce(t,e,n),o=!0},p:n,i(e){o||(oe(t.$$.fragment,e),o=!0)},o(e){re(t.$$.fragment,e),o=!1},d(e){ae(t,e)}}}function lt(e){let t,o;return t=new De({props:{size:"16"}}),{c(){le(t.$$.fragment)},m(e,n){ce(t,e,n),o=!0},p:n,i(e){o||(oe(t.$$.fragment,e),o=!0)},o(e){re(t.$$.fragment,e),o=!1},d(e){ae(t,e)}}}function ct(e){let t,n,o,r,i,s,l,c,a;return n=new et({props:{isActive:e[0],$$slots:{default:[rt]},$$scope:{ctx:e}}}),n.$on("buttonClick",e[1]),r=new et({props:{$$slots:{default:[it]},$$scope:{ctx:e}}}),r.$on("buttonClick",e[3]),s=new et({props:{$$slots:{default:[st]},$$scope:{ctx:e}}}),s.$on("buttonClick",e[4]),c=new et({props:{hoverBgColor:"var(--bg-window-close)",$$slots:{default:[lt]},$$scope:{ctx:e}}}),c.$on("buttonClick",e[2]),{c(){t=D("div"),le(n.$$.fragment),o=z(),le(r.$$.fragment),i=z(),le(s.$$.fragment),l=z(),le(c.$$.fragment),O(t,"class","panel-right svelte-1qne3l4")},m(e,d){T(e,t,d),ce(n,t,null),y(t,o),ce(r,t,null),y(t,i),ce(s,t,null),y(t,l),ce(c,t,null),a=!0},p(e,[t]){const o={};1&t&&(o.isActive=e[0]),64&t&&(o.$$scope={dirty:t,ctx:e}),n.$set(o);const i={};64&t&&(i.$$scope={dirty:t,ctx:e}),r.$set(i);const l={};64&t&&(l.$$scope={dirty:t,ctx:e}),s.$set(l);const a={};64&t&&(a.$$scope={dirty:t,ctx:e}),c.$set(a)},i(e){a||(oe(n.$$.fragment,e),oe(r.$$.fragment,e),oe(s.$$.fragment,e),oe(c.$$.fragment,e),a=!0)},o(e){re(n.$$.fragment,e),re(r.$$.fragment,e),re(s.$$.fragment,e),re(c.$$.fragment,e),a=!1},d(e){e&&E(t),ae(n),ae(r),ae(s),ae(c)}}}function at(e,n,o){let r,i;a(e,ve,(e=>o(5,r=e))),a(e,we,(e=>o(0,i=e)));return[i,function(){i||(t.ipcRenderer.send("openMainMenu"),we.toggle())},function(){t.ipcRenderer.send("windowClose",r)},()=>t.ipcRenderer.send("windowMinimize"),()=>t.ipcRenderer.send("windowMaximize")]}class dt extends fe{constructor(e){super(),ue(this,e,at,ct,c,{})}}function ut(){const e=ve.getTabByTitle(he);e&&(ve.deleteTab(e.id),t.ipcRenderer.send("closeTab",e.id))}function ft(e){switch(e.detail.button){case 0:t.ipcRenderer.send("setFocusToMainTab"),be.set("mainTab"),Ce.set(!0),ut();break;case 2:t.ipcRenderer.send("openMainTabMenu")}}function gt(e){switch(e.detail.button){case 0:t.ipcRenderer.send("setFocusToCommunityTab"),be.set("communityTab"),Ce.set(!0),ut();break;case 1:xe.set(!1),t.ipcRenderer.send("closeCommunityTab");break;case 2:t.ipcRenderer.send("openCommunityTabMenu")}}function pt(){console.log("onClickNewProject"),t.ipcRenderer.send("newProject"),Ce.set(!1)}function ht(e){const n=ve.getTabByTitle(he);n&&n.id===e&&Ce.set(!0),ve.deleteTab(e),t.ipcRenderer.send("closeTab",e)}function mt(e){let t,o;return t=new Se({props:{size:"22"}}),{c(){le(t.$$.fragment)},m(e,n){ce(t,e,n),o=!0},p:n,i(e){o||(oe(t.$$.fragment,e),o=!0)},o(e){re(t.$$.fragment,e),o=!1},d(e){ae(t,e)}}}function $t(e){let t,n;return t=new et({props:{padding:"0px 10px",hoverBgColor:"var(--bg-tab-hover)",activeBgColor:"var(--bg-tab-hover)",isActive:"communityTab"===e[0],$$slots:{default:[vt]},$$scope:{ctx:e}}}),t.$on("buttonClick",gt),{c(){le(t.$$.fragment)},m(e,o){ce(t,e,o),n=!0},p(e,n){const o={};1&n&&(o.isActive="communityTab"===e[0]),8&n&&(o.$$scope={dirty:n,ctx:e}),t.$set(o)},i(e){n||(oe(t.$$.fragment,e),n=!0)},o(e){re(t.$$.fragment,e),n=!1},d(e){ae(t,e)}}}function vt(e){let t,o;return t=new ze({props:{size:"20"}}),{c(){le(t.$$.fragment)},m(e,n){ce(t,e,n),o=!0},p:n,i(e){o||(oe(t.$$.fragment,e),o=!0)},o(e){re(t.$$.fragment,e),o=!1},d(e){ae(t,e)}}}function bt(e){let t,n;return t=new ot({props:{padding:"0px 8px",$$slots:{default:[wt]},$$scope:{ctx:e}}}),t.$on("buttonClick",pt),{c(){le(t.$$.fragment)},m(e,o){ce(t,e,o),n=!0},i(e){n||(oe(t.$$.fragment,e),n=!0)},o(e){re(t.$$.fragment,e),n=!1},d(e){ae(t,e)}}}function wt(e){let t,o;return t=new qe({props:{size:"15"}}),{c(){le(t.$$.fragment)},m(e,n){ce(t,e,n),o=!0},p:n,i(e){o||(oe(t.$$.fragment,e),o=!0)},o(e){re(t.$$.fragment,e),o=!1},d(e){ae(t,e)}}}function yt(e){let t,n,o,r,i;n=new et({props:{padding:"0px 10px",hoverBgColor:"var(--bg-tab-hover)",activeBgColor:"var(--bg-tab-hover)",isActive:"mainTab"===e[0],$$slots:{default:[mt]},$$scope:{ctx:e}}}),n.$on("buttonClick",ft);let s=e[1]&&$t(e),l=e[2]&&bt(e);return{c(){t=D("div"),le(n.$$.fragment),o=z(),s&&s.c(),r=z(),l&&l.c(),O(t,"class","panel-left svelte-sj5cvx")},m(e,c){T(e,t,c),ce(n,t,null),y(t,o),s&&s.m(t,null),y(t,r),l&&l.m(t,null),i=!0},p(e,[o]){const i={};1&o&&(i.isActive="mainTab"===e[0]),8&o&&(i.$$scope={dirty:o,ctx:e}),n.$set(i),e[1]?s?(s.p(e,o),2&o&&oe(s,1)):(s=$t(e),s.c(),oe(s,1),s.m(t,r)):s&&(te(),re(s,1,1,(()=>{s=null})),ne()),e[2]?l?4&o&&oe(l,1):(l=bt(e),l.c(),oe(l,1),l.m(t,null)):l&&(te(),re(l,1,1,(()=>{l=null})),ne())},i(e){i||(oe(n.$$.fragment,e),oe(s),oe(l),i=!0)},o(e){re(n.$$.fragment,e),re(s),re(l),i=!1},d(e){e&&E(t),ae(n),s&&s.d(),l&&l.d()}}}function Ct(e,t,n){let o,r,i;return a(e,be,(e=>n(0,o=e))),a(e,xe,(e=>n(1,r=e))),a(e,Ce,(e=>n(2,i=e))),[o,r,i]}class xt extends fe{constructor(e){super(),ue(this,e,Ct,yt,c,{})}}function Tt(e){const t=e-1;return t*t*t+1}function Et(e,{from:t,to:n},o={}){const r=getComputedStyle(e),i="none"===r.transform?"":r.transform,[s,c]=r.transformOrigin.split(" ").map(parseFloat),a=t.left+t.width*s/n.width-(n.left+s),d=t.top+t.height*c/n.height-(n.top+c),{delay:u=0,duration:f=(e=>120*Math.sqrt(e)),easing:g=Tt}=o;return{delay:u,duration:l(f)?f(Math.sqrt(a*a+d*d)):f,easing:g,css:(e,o)=>{const r=o*a,s=o*d,l=e+o*t.width/n.width,c=e+o*t.height/n.height;return`transform: ${i} translate(${r}px, ${s}px) scale(${l}, ${c});`}}}function Dt(e,t,n){e.dispatchEvent(new CustomEvent("finalize",{detail:{items:t,info:n}}))}function At(e,t,n){e.dispatchEvent(new CustomEvent("consider",{detail:{items:t,info:n}}))}const Bt="draggedEntered",zt="draggedLeft",kt="draggedOverIndex",Ot="draggedLeftDocument",Mt="leftForAnother",Lt="outsideOfAny";function Ft(e,t,n){e.dispatchEvent(new CustomEvent(Bt,{detail:{indexObj:t,draggedEl:n}}))}function St(e,t,n){e.dispatchEvent(new CustomEvent(zt,{detail:{draggedEl:t,type:Mt,theOtherDz:n}}))}function _t(e,t,n){e.dispatchEvent(new CustomEvent(kt,{detail:{indexObj:t,draggedEl:n}}))}const Rt="dragStarted",It=Bt,Nt="dragEnteredAnother",Pt=kt,jt=zt,Ht="draggedLeftAll",Wt="droppedIntoZone",qt="droppedIntoAnother",Vt="droppedOutsideOfAny",Yt="dragStopped",Xt="pointer",Zt="keyboard",Ut="isDndShadowItem",Gt="data-is-dnd-shadow-item",Jt="id:dnd-shadow-placeholder-0000";let Kt="id",Qt=0;function en(){Qt++}function tn(){if(0===Qt)throw new Error("Bug! trying to decrement when there are no dropzones");Qt--}const nn="undefined"==typeof window;function on(e){let t;const n=e.getBoundingClientRect(),o=getComputedStyle(e),r=o.transform;if(r){let i,s,l,c;if(r.startsWith("matrix3d("))t=r.slice(9,-1).split(/, /),i=+t[0],s=+t[5],l=+t[12],c=+t[13];else{if(!r.startsWith("matrix("))return n;t=r.slice(7,-1).split(/, /),i=+t[0],s=+t[3],l=+t[4],c=+t[5]}const a=o.transformOrigin,d=n.x-l-(1-i)*parseFloat(a),u=n.y-c-(1-s)*parseFloat(a.slice(a.indexOf(" ")+1)),f=i?n.width/i:e.offsetWidth,g=s?n.height/s:e.offsetHeight;return{x:d,y:u,width:f,height:g,top:u,right:d+f,bottom:u+g,left:d}}return n}function rn(e){const t=on(e);return{top:t.top+window.scrollY,bottom:t.bottom+window.scrollY,left:t.left+window.scrollX,right:t.right+window.scrollX}}function sn(e){const t=e.getBoundingClientRect();return{top:t.top+window.scrollY,bottom:t.bottom+window.scrollY,left:t.left+window.scrollX,right:t.right+window.scrollX}}function ln(e){return{x:(e.left+e.right)/2,y:(e.top+e.bottom)/2}}function cn(e,t){return e.y<=t.bottom&&e.y>=t.top&&e.x>=t.left&&e.x<=t.right}function an(e){return ln(sn(e))}function dn(e,t){return cn(an(e),rn(t))}function un(e,t){const n=an(e),o=an(t);return r=n,i=o,Math.sqrt(Math.pow(r.x-i.x,2)+Math.pow(r.y-i.y,2));var r,i}let fn;function gn(){fn=new Map}function pn(e){fn.delete(e)}function hn(e,t){if(!dn(e,t))return null;const n=t.children;if(0===n.length)return{index:0,isProximityBased:!0};const o=function(e){const t=Array.from(e.children).findIndex((e=>e.getAttribute(Gt)));if(t>=0)return fn.has(e)||fn.set(e,new Map),fn.get(e).set(t,rn(e.children[t])),t}(t);for(let r=0;r<n.length;r++)if(dn(e,n[r])){const n=fn.has(t)&&fn.get(t).get(r);return n&&!cn(an(e),n)?{index:o,isProximityBased:!1}:{index:r,isProximityBased:!1}}let r,i=Number.MAX_VALUE;for(let t=0;t<n.length;t++){const o=un(e,n[t]);o<i&&(i=o,r=t)}return{index:r,isProximityBased:!0}}gn();function mn(){let e;function t(){e={directionObj:void 0,stepPx:0}}function n(t){const{directionObj:o,stepPx:r}=e;o&&(t.scrollBy(o.x*r,o.y*r),window.requestAnimationFrame((()=>n(t))))}function o(e){return 25-e}return t(),{scrollIfNeeded:function(r,i){if(!i)return!1;const s=function(e,t){const n=sn(t);return cn(e,n)?{top:e.y-n.top,bottom:n.bottom-e.y,left:e.x-n.left,right:Math.min(n.right,document.documentElement.clientWidth)-e.x}:null}(r,i);if(null===s)return t(),!1;const l=!!e.directionObj;let[c,a]=[!1,!1];return i.scrollHeight>i.clientHeight&&(s.bottom<25?(c=!0,e.directionObj={x:0,y:1},e.stepPx=o(s.bottom)):s.top<25&&(c=!0,e.directionObj={x:0,y:-1},e.stepPx=o(s.top)),!l&&c)||i.scrollWidth>i.clientWidth&&(s.right<25?(a=!0,e.directionObj={x:1,y:0},e.stepPx=o(s.right)):s.left<25&&(a=!0,e.directionObj={x:-1,y:0},e.stepPx=o(s.left)),!l&&a)?(n(i),!0):(t(),!1)},resetScrolling:t}}function $n(e){return JSON.stringify(e,null,2)}function vn(e){if(!e)throw new Error("cannot get depth of a falsy node");return bn(e,0)}function bn(e,t=0){return e.parentElement?bn(e.parentElement,t+1):t-1}const{scrollIfNeeded:wn,resetScrolling:yn}=mn();let Cn;function xn(e,t,n=200){let o,r,i,s=!1;const l=Array.from(t).sort(((e,t)=>vn(t)-vn(e)));!function t(){const c=an(e),a=wn(c,o);if(!a&&i&&Math.abs(i.x-c.x)<10&&Math.abs(i.y-c.y)<10)return void(Cn=window.setTimeout(t,n));if(function(e){const t=sn(e);return t.right<0||t.left>document.documentElement.scrollWidth||t.bottom<0||t.top>document.documentElement.scrollHeight}(e))return void function(e){window.dispatchEvent(new CustomEvent(Ot,{detail:{draggedEl:e}}))}(e);i=c;let d=!1;for(const t of l){a&&pn(o);const n=hn(e,t);if(null===n)continue;const{index:i}=n;d=!0,t!==o?(o&&St(o,e,t),Ft(t,n,e),o=t):i!==r&&(_t(t,n,e),r=i);break}!d&&s&&o?(!function(e,t){e.dispatchEvent(new CustomEvent(zt,{detail:{draggedEl:t,type:Lt}}))}(o,e),o=void 0,r=void 0,s=!1):s=!0,Cn=window.setTimeout(t,n)}()}let Tn;function En(e){const t=e.touches?e.touches[0]:e;Tn={x:t.clientX,y:t.clientY}}const{scrollIfNeeded:Dn,resetScrolling:An}=mn();let Bn;function zn(){if(Tn){Dn(Tn,document.documentElement)&&gn()}Bn=window.setTimeout(zn,300)}function kn(e){return`${e} 0.2s ease`}function On(e,t){e.style.cursor=t}function Mn(e,t,n,o){Ln(t,e);const r=t.getBoundingClientRect(),i=e.getBoundingClientRect(),s=r.width-i.width,l=r.height-i.height;if(s||l){const t={left:(n-i.left)/i.width,top:(o-i.top)/i.height};e.style.height=`${r.height}px`,e.style.width=`${r.width}px`,e.style.left=parseFloat(e.style.left)-t.left*s+"px",e.style.top=parseFloat(e.style.top)-t.top*l+"px"}}function Ln(e,t){const n=window.getComputedStyle(e);Array.from(n).filter((e=>e.startsWith("background")||e.startsWith("padding")||e.startsWith("font")||e.startsWith("text")||e.startsWith("align")||e.startsWith("justify")||e.startsWith("display")||e.startsWith("flex")||e.startsWith("border")||"opacity"===e||"color"===e||"list-style-type"===e)).forEach((e=>t.style.setProperty(e,n.getPropertyValue(e),n.getPropertyPriority(e))))}function Fn(e,t,n){e.draggable=!1,e.ondragstart=()=>!1,t?(e.style.userSelect="",e.style.WebkitUserSelect="",e.style.cursor=""):(e.style.userSelect="none",e.style.WebkitUserSelect="none",e.style.cursor=n)}function Sn(e){e.style.display="none",e.style.position="fixed",e.style.zIndex="-5"}function _n(e,t=(()=>{}),n=(()=>[])){e.forEach((e=>{const o=t(e);Object.keys(o).forEach((t=>{e.style[t]=o[t]})),n(e).forEach((t=>e.classList.add(t)))}))}function Rn(e,t=(()=>{}),n=(()=>[])){e.forEach((e=>{const o=t(e);Object.keys(o).forEach((t=>{e.style[t]=""})),n(e).forEach((t=>e.classList.contains(t)&&e.classList.remove(t)))}))}const In="grab",Nn="grabbing",Pn="grab",jn="grab",Hn={outline:"rgba(255, 255, 102, 0.7) solid 2px"};let Wn,qn,Vn,Yn,Xn,Zn,Un,Gn,Jn,Kn,Qn,eo=!1,to=!1,no=!1,oo=[];const ro=new Map,io=new Map,so=new WeakMap;function lo(e,t){ro.get(t).delete(e),tn(),0===ro.get(t).size&&ro.delete(t)}function co(){window.addEventListener("mousemove",En),window.addEventListener("touchmove",En),zn();const e=ro.get(Yn);for(const t of e)t.addEventListener(Bt,fo),t.addEventListener(zt,go),t.addEventListener(kt,po);window.addEventListener(Ot,mo);const t=Math.max(100,...Array.from(e.keys()).map((e=>io.get(e).dropAnimationDurationMs)));xn(qn,e,1.07*t)}function ao(){window.removeEventListener("mousemove",En),window.removeEventListener("touchmove",En),Tn=void 0,window.clearTimeout(Bn),An();const e=ro.get(Yn);for(const t of e)t.removeEventListener(Bt,fo),t.removeEventListener(zt,go),t.removeEventListener(kt,po);window.removeEventListener(Ot,mo),clearTimeout(Cn),yn(),gn()}function uo(e){return e.findIndex((e=>!!e[Ut]&&e[Kt]!==Jt))}function fo(e){let{items:t,dropFromOthersDisabled:n}=io.get(e.currentTarget);if(n&&e.currentTarget!==Xn)return;if(no=!1,t=t.filter((e=>e[Kt]!==Un[Kt])),Xn!==e.currentTarget){const e=io.get(Xn).items.filter((e=>!e[Ut]));At(Xn,e,{trigger:Nt,id:Vn[Kt],source:Xt})}else{const e=function(e){return e.findIndex((e=>e[Kt]===Jt))}(t);-1!==e&&t.splice(e,1)}const{index:o,isProximityBased:r}=e.detail.indexObj,i=r&&o===e.currentTarget.children.length-1?o+1:o;Gn=e.currentTarget,t.splice(i,0,Un),At(e.currentTarget,t,{trigger:It,id:Vn[Kt],source:Xt})}function go(e){if(!eo)return;const{items:t,dropFromOthersDisabled:n}=io.get(e.currentTarget);if(n&&e.currentTarget!==Xn&&e.currentTarget!==Gn)return;const o=uo(t),r=t.splice(o,1)[0];Gn=void 0;const{type:i,theOtherDz:s}=e.detail;if(i===Lt||i===Mt&&s!==Xn&&io.get(s).dropFromOthersDisabled){no=!0,Gn=Xn;const e=io.get(Xn).items;e.splice(Zn,0,r),At(Xn,e,{trigger:Ht,id:Vn[Kt],source:Xt})}At(e.currentTarget,t,{trigger:jt,id:Vn[Kt],source:Xt})}function po(e){const{items:t,dropFromOthersDisabled:n}=io.get(e.currentTarget);if(n&&e.currentTarget!==Xn)return;no=!1;const{index:o}=e.detail.indexObj,r=uo(t);t.splice(r,1),t.splice(o,0,Un),At(e.currentTarget,t,{trigger:Pt,id:Vn[Kt],source:Xt})}function ho(e){e.preventDefault();const t=e.touches?e.touches[0]:e,{constrainAxisX:n,constrainAxisY:o}=io.get(e.currentTarget)||io.get(Xn);Kn={x:n?Jn.x:t.clientX,y:o?Jn.y:t.clientY},qn.style.transform=`translate3d(${Kn.x-Jn.x}px, ${Kn.y-Jn.y}px, 0)`}function mo(){to=!0,window.removeEventListener("mousemove",ho),window.removeEventListener("touchmove",ho),window.removeEventListener("mouseup",mo),window.removeEventListener("touchend",mo),ao(),Gn||(Gn=Xn);let{items:e,type:t,cursorDrop:n}=io.get(Gn);On(qn,n),Rn(ro.get(t),(e=>io.get(e).dropTargetStyle),(e=>io.get(e).dropTargetClasses));let o=uo(e);-1===o&&(o=Zn),e=e.map((e=>e[Ut]?Vn:e)),function(e,t){const n=on(Gn.children[e]),o={x:n.left-parseFloat(qn.style.left),y:n.top-parseFloat(qn.style.top)},{dropAnimationDurationMs:r}=io.get(Gn),i=`transform ${r}ms ease`;qn.style.transition=qn.style.transition?qn.style.transition+","+i:i,qn.style.transform=`translate3d(${o.x}px, ${o.y}px, 0)`,window.setTimeout(t,r)}(o,(function(){var t;Qn(),Dt(Gn,e,{trigger:no?Vt:Wt,id:Vn[Kt],source:Xt}),Gn!==Xn&&Dt(Xn,io.get(Xn).items,{trigger:qt,id:Vn[Kt],source:Xt}),(t=Gn.children[o]).style.visibility="",t.removeAttribute(Gt),function(){qn.remove(),Wn.remove(),oo.length&&(oo.forEach((({dz:e,destroy:t})=>{t(),e.remove()})),oo=[]);qn=void 0,Wn=void 0,Vn=void 0,Yn=void 0,Xn=void 0,Zn=void 0,Un=void 0,Gn=void 0,Jn=void 0,Kn=void 0,eo=!1,to=!1,Qn=void 0,no=!1}()}))}function $o(e,t){let n,o=!1;const r={items:void 0,type:void 0,cursorStartDrag:In,cursorDragging:Nn,cursorDrop:Pn,cursorHover:jn,flipDurationMs:0,constrainAxisX:!1,constrainAxisY:!1,dragDisabled:!1,morphDisabled:!1,dropFromOthersDisabled:!1,dropTargetStyle:Hn,dropTargetClasses:[],transformDraggedElement:()=>{},centreDraggedOnCursor:!1};let i=new Map;function s(){window.addEventListener("mousemove",a,{passive:!1}),window.addEventListener("touchmove",a,{passive:!1,capture:!1}),window.addEventListener("mouseup",c,{passive:!1}),window.addEventListener("touchend",c,{passive:!1})}function l(){window.removeEventListener("mousemove",a),window.removeEventListener("touchmove",a),window.removeEventListener("mouseup",c),window.removeEventListener("touchend",c)}function c(){l(),Wn=void 0,Jn=void 0,Kn=void 0}function a(e){e.preventDefault();const t=e.touches?e.touches[0]:e;Kn={x:t.clientX,y:t.clientY},(Math.abs(Kn.x-Jn.x)>=3||Math.abs(Kn.y-Jn.y)>=3)&&(l(),function(){eo=!0;const e=i.get(Wn);Zn=e,Xn=Wn.parentElement;const t=Xn.getRootNode(),n=t.body||t,{items:o,type:s,centreDraggedOnCursor:l}=r;Vn={...o[e]},Yn=s,Un={...Vn,[Ut]:!0};const c={...Un,[Kt]:Jt};function a(){qn.parentElement?window.requestAnimationFrame(a):(n.appendChild(qn),qn.focus(),co(),Sn(Wn),n.appendChild(Wn))}qn=function(e,t,n){const o=e.getBoundingClientRect(),r=function(e){const t=e.cloneNode(!0),n=[],o="SELECT"===e.tagName,r=o?[e]:[...e.querySelectorAll("select")];for(const e of r)n.push(e.value);if(r.length<=0)return t;const i=o?[t]:[...t.querySelectorAll("select")];for(let e=0;e<i.length;e++){const t=i[e],o=n[e],r=t.querySelector(`option[value="${o}"`);r&&r.setAttribute("selected",!0)}return t}(e);Ln(e,r),r.id="dnd-action-dragged-el",r.style.position="fixed";let i=o.top,s=o.left;if(r.style.top=`${i}px`,r.style.left=`${s}px`,t){const e=ln(o);i-=e.y-t.y,s-=e.x-t.x,window.setTimeout((()=>{r.style.top=`${i}px`,r.style.left=`${s}px`}),0)}return r.style.margin="0",r.style.boxSizing="border-box",r.style.height=`${o.height}px`,r.style.width=`${o.width}px`,r.style.transition=`${kn("top")}, ${kn("left")}, ${kn("background-color")}, ${kn("opacity")}, ${kn("color")} `,window.setTimeout((()=>r.style.transition+=`, ${kn("width")}, ${kn("height")}`),0),r.style.zIndex="9999",r.style.cursor=n,r}(Wn,l&&Kn,r.cursorDragging),window.requestAnimationFrame(a),_n(Array.from(ro.get(r.type)).filter((e=>e===Xn||!io.get(e).dropFromOthersDisabled)),(e=>io.get(e).dropTargetStyle),(e=>io.get(e).dropTargetClasses)),o.splice(e,1,c),Qn=function(e){const t=e.style.minHeight;e.style.minHeight=window.getComputedStyle(e).getPropertyValue("height");const n=e.style.minWidth;return e.style.minWidth=window.getComputedStyle(e).getPropertyValue("width"),function(){e.style.minHeight=t,e.style.minWidth=n}}(Xn),At(Xn,o,{trigger:Rt,id:Vn[Kt],source:Xt}),window.addEventListener("mousemove",ho,{passive:!1}),window.addEventListener("touchmove",ho,{passive:!1,capture:!1}),window.addEventListener("mouseup",mo,{passive:!1}),window.addEventListener("touchend",mo,{passive:!1})}())}function d(t){if(t.target!==t.currentTarget&&(void 0!==t.target.value||t.target.isContentEditable))return;if(t.button)return;if(eo)return;t.stopPropagation();const o=t.touches?t.touches[0]:t;Jn={x:o.clientX,y:o.clientY},Kn={...Jn},Wn=t.currentTarget;const{cursorStartDrag:r}=io.get(Wn)||io.get(e);n=setTimeout((()=>{On(Wn,r)}),100),s()}function u(t){n&&clearTimeout(n),Wn=t.currentTarget;const{cursorHover:o}=io.get(Wn)||io.get(e);On(Wn,o),s()}function f({items:t,flipDurationMs:n=0,type:s="--any--",cursorStartDrag:l=In,cursorDragging:c=Nn,cursorDrop:a=Pn,cursorHover:f=jn,constrainAxisX:g=!1,constrainAxisY:p=!1,dragDisabled:h=!1,morphDisabled:m=!1,dropFromOthersDisabled:$=!1,dropTargetStyle:v=Hn,dropTargetClasses:b=[],transformDraggedElement:w=(()=>{}),centreDraggedOnCursor:y=!1}){var C,x;function T(e,t){return io.get(e)?io.get(e)[t]:r[t]}r.dropAnimationDurationMs=n,r.type&&s!==r.type&&lo(e,r.type),r.type=s,r.cursorStartDrag=l,r.cursorDragging=c,r.cursorDrop=a,r.cursorHover=f,C=e,x=s,ro.has(x)||ro.set(x,new Set),ro.get(x).has(C)||(ro.get(x).add(C),en()),r.items=[...t],r.constrainAxisX=g,r.constrainAxisY=p,r.dragDisabled=h,r.morphDisabled=m,r.transformDraggedElement=w,r.centreDraggedOnCursor=y,!o||!eo||to||function(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(!{}.hasOwnProperty.call(t,n)||t[n]!==e[n])return!1;return!0}(v,r.dropTargetStyle)&&function(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}(b,r.dropTargetClasses)||(Rn([e],(()=>r.dropTargetStyle),(()=>b)),_n([e],(()=>v),(()=>b))),r.dropTargetStyle=v,r.dropTargetClasses=[...b],o&&eo&&r.dropFromOthersDisabled!==$&&($?Rn([e],(e=>T(e,"dropTargetStyle")),(e=>T(e,"dropTargetClasses"))):_n([e],(e=>T(e,"dropTargetStyle")),(e=>T(e,"dropTargetClasses")))),r.dropFromOthersDisabled=$,io.set(e,r);const E=uo(r.items);for(let t=0;t<e.children.length;t++){const n=e.children[t],{cursorHover:s}=io.get(n)||io.get(e);Fn(n,h,s),t!==E?(n.removeEventListener("mousedown",so.get(n)),n.removeEventListener("touchstart",so.get(n)),h||(n.addEventListener("mousedown",d),n.addEventListener("mouseup",u),n.addEventListener("touchstart",d),so.set(n,d),so.set(n,u)),i.set(n,t),o||(o=!0)):(r.transformDraggedElement(qn,Vn,t),m||Mn(qn,n,Kn.x,Kn.y),(D=n).style.visibility="hidden",D.setAttribute(Gt,"true"))}var D}return f(t),{update:e=>{f(e)},destroy:()=>{function t(){lo(e,io.get(e).type),io.delete(e)}var n,o;eo?(n=e,o=t,oo.push({dz:n,destroy:o}),window.requestAnimationFrame((()=>{Sn(n),document.body.appendChild(n)}))):t()}}}const vo={DND_ZONE_ACTIVE:"dnd-zone-active",DND_ZONE_DRAG_DISABLED:"dnd-zone-drag-disabled"},bo={[vo.DND_ZONE_ACTIVE]:"Tab to one the items and press space-bar or enter to start dragging it",[vo.DND_ZONE_DRAG_DISABLED]:"This is a disabled drag and drop list"};let wo;function yo(){wo||(wo=document.createElement("div"),wo.id="dnd-action-aria-alert",wo.style.position="fixed",wo.style.bottom="0",wo.style.left="0",wo.style.zIndex="-5",wo.style.opacity="0",wo.style.height="0",wo.style.width="0",wo.setAttribute("role","alert"),document.body.prepend(wo),Object.entries(bo).forEach((([e,t])=>document.body.prepend(function(e,t){const n=document.createElement("div");return n.id=e,n.innerHTML=`<p>${t}</p>`,n.style.display="none",n.style.position="fixed",n.style.zIndex="-5",n}(e,t)))))}function Co(e){if(nn)return;wo||yo(),wo.innerHTML="";const t=document.createTextNode(e);wo.appendChild(t),wo.style.display="none",wo.style.display="inline"}const xo={outline:"rgba(255, 255, 102, 0.7) solid 2px"};let To,Eo,Do,Ao,Bo=!1,zo="",ko="";const Oo=new WeakSet,Mo=new WeakMap,Lo=new WeakMap,Fo=new Map,So=new Map,_o=new Map;let Ro;function Io(e,t){0===_o.size&&(Ro=nn?null:("complete"===document.readyState?yo():window.addEventListener("DOMContentLoaded",yo),{...vo}),window.addEventListener("keydown",Po),window.addEventListener("click",jo)),_o.has(t)||_o.set(t,new Set),_o.get(t).has(e)||(_o.get(t).add(e),en())}function No(e,t){Eo===e&&qo(),_o.get(t).delete(e),tn(),0===_o.get(t).size&&_o.delete(t),0===_o.size&&(window.removeEventListener("keydown",Po),window.removeEventListener("click",jo),Ro=void 0,!nn&&wo&&(Object.keys(bo).forEach((e=>document.getElementById(e)?.remove())),wo.remove(),wo=void 0))}function Po(e){if(Bo&&"Escape"===e.key)qo()}function jo(){Bo&&(Oo.has(document.activeElement)||qo())}function Ho(e){if(!Bo)return;const t=e.currentTarget;if(t===Eo)return;zo=t.getAttribute("aria-label")||"";const{items:n}=So.get(Eo),o=n.find((e=>e[Kt]===Ao)),r=n.indexOf(o),i=n.splice(r,1)[0],{items:s,autoAriaDisabled:l}=So.get(t);t.getBoundingClientRect().top<Eo.getBoundingClientRect().top||t.getBoundingClientRect().left<Eo.getBoundingClientRect().left?(s.push(i),l||Co(`Moved item ${ko} to the end of the list ${zo}`)):(s.unshift(i),l||Co(`Moved item ${ko} to the beginning of the list ${zo}`));Dt(Eo,n,{trigger:qt,id:Ao,source:Zt}),Dt(t,s,{trigger:Wt,id:Ao,source:Zt}),Eo=t}function Wo(){Fo.forEach((({update:e},t)=>e(So.get(t))))}function qo(e=!0){So.get(Eo).autoAriaDisabled||Co(`Stopped dragging item ${ko}`),Oo.has(document.activeElement)&&document.activeElement.blur(),e&&At(Eo,So.get(Eo).items,{trigger:Yt,id:Ao,source:Zt}),Rn(_o.get(To),(e=>So.get(e).dropTargetStyle),(e=>So.get(e).dropTargetClasses)),Do=null,Ao=null,ko="",To=null,Eo=null,zo="",Bo=!1,Wo()}function Vo(e,t){const n={items:void 0,type:void 0,dragDisabled:!1,zoneTabIndex:0,dropFromOthersDisabled:!1,dropTargetStyle:xo,dropTargetClasses:[],autoAriaDisabled:!1};function o(e,t,n){e.length<=1||e.splice(n,1,e.splice(t,1,e[n])[0])}function r(t){switch(t.key){case"Enter":case" ":if((void 0!==t.target.disabled||t.target.href||t.target.isContentEditable)&&!Oo.has(t.target))return;t.preventDefault(),t.stopPropagation(),Bo?qo():i(t);break;case"ArrowDown":case"ArrowRight":{if(!Bo)return;t.preventDefault(),t.stopPropagation();const{items:r}=So.get(e),i=Array.from(e.children),s=i.indexOf(t.currentTarget);s<i.length-1&&(n.autoAriaDisabled||Co(`Moved item ${ko} to position ${s+2} in the list ${zo}`),o(r,s,s+1),Dt(e,r,{trigger:Wt,id:Ao,source:Zt}));break}case"ArrowUp":case"ArrowLeft":{if(!Bo)return;t.preventDefault(),t.stopPropagation();const{items:r}=So.get(e),i=Array.from(e.children).indexOf(t.currentTarget);i>0&&(n.autoAriaDisabled||Co(`Moved item ${ko} to position ${i} in the list ${zo}`),o(r,i,i-1),Dt(e,r,{trigger:Wt,id:Ao,source:Zt}));break}}}function i(t){!function(t){const{items:n}=So.get(e),o=Array.from(e.children),r=o.indexOf(t);Do=t,Do.tabIndex=0,Ao=n[r][Kt],ko=o[r].getAttribute("aria-label")||""}(t.currentTarget),Eo=e,To=n.type,Bo=!0;const o=Array.from(_o.get(n.type)).filter((e=>e===Eo||!So.get(e).dropFromOthersDisabled));if(_n(o,(e=>So.get(e).dropTargetStyle),(e=>So.get(e).dropTargetClasses)),!n.autoAriaDisabled){let e=`Started dragging item ${ko}. Use the arrow keys to move it within its list ${zo}`;o.length>1&&(e+=", or tab to another list in order to move the item into it"),Co(e)}At(e,So.get(e).items,{trigger:Rt,id:Ao,source:Zt}),Wo()}function s(e){Bo&&e.currentTarget!==Do&&(e.stopPropagation(),qo(!1),i(e))}function l({items:t=[],type:o="--any--",dragDisabled:i=!1,zoneTabIndex:l=0,dropFromOthersDisabled:c=!1,dropTargetStyle:a=xo,dropTargetClasses:d=[],autoAriaDisabled:u=!1}){n.items=[...t],n.dragDisabled=i,n.dropFromOthersDisabled=c,n.zoneTabIndex=l,n.dropTargetStyle=a,n.dropTargetClasses=d,n.autoAriaDisabled=u,n.type&&o!==n.type&&No(e,n.type),n.type=o,Io(e,o),u||(e.setAttribute("aria-disabled",i),e.setAttribute("role","list"),e.setAttribute("aria-describedby",i?Ro.DND_ZONE_DRAG_DISABLED:Ro.DND_ZONE_ACTIVE)),So.set(e,n),e.tabIndex=Bo?e===Eo||Do.contains(e)||n.dropFromOthersDisabled||Eo&&n.type!==So.get(Eo).type?-1:0:n.zoneTabIndex,e.addEventListener("focus",Ho);for(let t=0;t<e.children.length;t++){const o=e.children[t];Oo.add(o),o.tabIndex=Bo?-1:0,u||o.setAttribute("role","listitem"),o.removeEventListener("keydown",Mo.get(o)),o.removeEventListener("click",Lo.get(o)),i||(o.addEventListener("keydown",r),Mo.set(o,r),o.addEventListener("click",s),Lo.set(o,s)),Bo&&n.items[t][Kt]===Ao&&(Do=o,Do.tabIndex=0,o.focus())}}l(t);const c={update:e=>{l(e)},destroy:()=>{No(e,n.type),So.delete(e),Fo.delete(e)}};return Fo.set(e,c),c}function Yo(e,t){Xo(t);const n=$o(e,t),o=Vo(e,t);return{update:e=>{Xo(e),n.update(e),o.update(e)},destroy:()=>{n.destroy(),o.destroy()}}}function Xo(e){const{items:t,flipDurationMs:n,type:o,cursorStartDrag:r,cursorDragging:i,cursorDrop:s,cursorHover:l,constrainAxisX:c,constrainAxisY:a,dragDisabled:d,morphDisabled:u,dropFromOthersDisabled:f,zoneTabIndex:g,dropTargetStyle:p,dropTargetClasses:h,transformDraggedElement:m,autoAriaDisabled:$,centreDraggedOnCursor:v,...b}=e;if(Object.keys(b).length>0&&console.warn("dndzone will ignore unknown options",b),!t)throw new Error("no 'items' key provided to dndzone");const w=t.find((e=>!{}.hasOwnProperty.call(e,Kt)));if(w)throw new Error(`missing '${Kt}' property for item ${$n(w)}`);if(h&&!Array.isArray(h))throw new Error(`dropTargetClasses should be an array but instead it is a ${typeof h}, ${$n(h)}`);if(g&&(y=g,isNaN(y)||(0|(C=parseFloat(y)))!==C))throw new Error(`zoneTabIndex should be a number but instead it is a ${typeof g}, ${$n(g)}`);var y,C}function Zo(e){let t,n,o;const r=e[2].default,i=d(r,e,e[1],null);return{c(){t=D("div"),i&&i.c(),O(t,"class",n=h(e[0]?"spin":"")+" svelte-q44ed0")},m(e,n){T(e,t,n),i&&i.m(t,null),o=!0},p(e,[s]){i&&i.p&&(!o||2&s)&&g(i,r,e,e[1],o?f(r,e[1],s,null):p(e[1]),null),(!o||1&s&&n!==(n=h(e[0]?"spin":"")+" svelte-q44ed0"))&&O(t,"class",n)},i(e){o||(oe(i,e),o=!0)},o(e){re(i,e),o=!1},d(e){e&&E(t),i&&i.d(e)}}}function Uo(e,t,n){let{$$slots:o={},$$scope:r}=t,{spin:i=!1}=t;return e.$$set=e=>{"spin"in e&&n(0,i=e.spin),"$$scope"in e&&n(1,r=e.$$scope)},[i,r,o]}class Go extends fe{constructor(e){super(),ue(this,e,Uo,Zo,c,{spin:0})}}function Jo(e,t,n){const o=e.slice();return o[13]=t[n],o}function Ko(e){let t,n;return t=new De({props:{size:"14"}}),{c(){le(t.$$.fragment)},m(e,o){ce(t,e,o),n=!0},i(e){n||(oe(t.$$.fragment,e),n=!0)},o(e){re(t.$$.fragment,e),n=!1},d(e){ae(t,e)}}}function Qo(e){let t,n;return t=new Go({props:{spin:!0,$$slots:{default:[er]},$$scope:{ctx:e}}}),{c(){le(t.$$.fragment)},m(e,o){ce(t,e,o),n=!0},i(e){n||(oe(t.$$.fragment,e),n=!0)},o(e){re(t.$$.fragment,e),n=!1},d(e){ae(t,e)}}}function er(e){let t,o;return t=new Xe({props:{size:"14"}}),{c(){le(t.$$.fragment)},m(e,n){ce(t,e,n),o=!0},p:n,i(e){o||(oe(t.$$.fragment,e),o=!0)},o(e){re(t.$$.fragment,e),o=!1},d(e){ae(t,e)}}}function tr(e){let t,n,o,r;const i=[Qo,Ko],s=[];function l(e,t){return e[13].loading&&e[6][e[13].id]&&"chrome://gpu"!==e[13].title&&e[13].title!==he?0:1}return t=l(e),n=s[t]=i[t](e),{c(){n.c(),o=B("")},m(e,n){s[t].m(e,n),T(e,o,n),r=!0},p(e,r){let c=t;t=l(e),t!==c&&(te(),re(s[c],1,1,(()=>{s[c]=null})),ne(),n=s[t],n||(n=s[t]=i[t](e),n.c()),oe(n,1),n.m(o.parentNode,o))},i(e){r||(oe(n),r=!0)},o(e){re(n),r=!1},d(e){e&&E(o),s[t].d(e)}}}function nr(e,t){let o,r,i,s,l,c,a,d,u,f,g,p,h=t[13].title+"",m=n;function $(...e){return t[9](t[13],...e)}return c=new ot({props:{padding:"0 7px",normalBgColor:dr,hoverBgColor:ur,$$slots:{default:[tr]},$$scope:{ctx:t}}}),c.$on("buttonClick",(function(...e){return t[10](t[13],...e)})),c.$on("mouseenter",(function(...e){return t[11](t[13],...e)})),c.$on("mouseleave",(function(...e){return t[12](t[13],...e)})),{key:e,first:null,c(){o=D("div"),r=D("div"),i=D("span"),s=B(h),l=z(),le(c.$$.fragment),a=z(),O(i,"class","svelte-1orgh4r"),O(r,"class","text svelte-1orgh4r"),O(o,"class",d="panel-tab "+(t[0]===t[13].id?"panel-tab__active":"")+" svelte-1orgh4r"),this.first=o},m(e,t){T(e,o,t),y(o,r),y(r,i),y(i,s),y(o,l),ce(c,o,null),y(o,a),f=!0,g||(p=k(r,"mouseup",$),g=!0)},p(e,n){t=e,(!f||2&n)&&h!==(h=t[13].title+"")&&function(e,t){t=""+t,e.data!==t&&(e.data=t)}(s,h);const r={};65602&n&&(r.$$scope={dirty:n,ctx:t}),c.$set(r),(!f||3&n&&d!==(d="panel-tab "+(t[0]===t[13].id?"panel-tab__active":"")+" svelte-1orgh4r"))&&O(o,"class",d)},r(){u=o.getBoundingClientRect()},f(){I(o),m()},a(){m(),m=R(o,u,Et,{duration:rr})},i(e){f||(oe(c.$$.fragment,e),f=!0)},o(e){re(c.$$.fragment,e),f=!1},d(e){e&&E(o),ae(c),g=!1,p()}}}function or(e){let t,o,r,i,c,a=[],d=new Map,u=ie(e[1]);const f=e=>e[13].id;for(let t=0;t<u.length;t+=1){let n=Jo(e,u,t),o=f(n);d.set(o,a[t]=nr(o,n))}return{c(){t=D("section");for(let e=0;e<a.length;e+=1)a[e].c();O(t,"class","svelte-1orgh4r")},m(s,d){T(s,t,d);for(let e=0;e<a.length;e+=1)a[e]&&a[e].m(t,null);var u;r=!0,i||(c=[(u=o=Yo.call(null,t,{items:e[1],flipDurationMs:rr,constrainAxisY:ir,cursorStartDrag:sr,cursorDragging:lr,cursorDrop:cr,cursorHover:ar}),u&&l(u.destroy)?u.destroy:n),k(t,"consider",(function(){l(e[4])&&e[4].apply(this,arguments)})),k(t,"finalize",(function(){l(e[5])&&e[5].apply(this,arguments)}))],i=!0)},p(n,[r]){if(e=n,463&r){u=ie(e[1]),te();for(let e=0;e<a.length;e+=1)a[e].r();a=function(e,t,n,o,r,i,l,c,a,d,u,f){let g=e.length,p=i.length,h=g;const m={};for(;h--;)m[e[h].key]=h;const $=[],v=new Map,b=new Map,w=[];for(h=p;h--;){const e=f(r,i,h),s=n(e);let c=l.get(s);c?o&&w.push((()=>c.p(e,t))):(c=d(s,e),c.c()),v.set(s,$[h]=c),s in m&&b.set(s,Math.abs(h-m[s]))}const y=new Set,C=new Set;function x(e){oe(e,1),e.m(c,u),l.set(e.key,e),u=e.first,p--}for(;g&&p;){const t=$[p-1],n=e[g-1],o=t.key,r=n.key;t===n?(u=t.first,g--,p--):v.has(r)?!l.has(o)||y.has(o)?x(t):C.has(r)?g--:b.get(o)>b.get(r)?(C.add(o),x(t)):(y.add(r),g--):(a(n,l),g--)}for(;g--;){const t=e[g];v.has(t.key)||a(t,l)}for(;p;)x($[p-1]);return s(w),$}(a,r,f,1,e,u,d,t,se,nr,null,Jo);for(let e=0;e<a.length;e+=1)a[e].a();ne()}o&&l(o.update)&&2&r&&o.update.call(null,{items:e[1],flipDurationMs:rr,constrainAxisY:ir,cursorStartDrag:sr,cursorDragging:lr,cursorDrop:cr,cursorHover:ar})},i(e){if(!r){for(let e=0;e<u.length;e+=1)oe(a[e]);r=!0}},o(e){for(let e=0;e<a.length;e+=1)re(a[e]);r=!1},d(e){e&&E(t);for(let e=0;e<a.length;e+=1)a[e].d();i=!1,s(c)}}}const rr=150,ir=!0,sr="default",lr="default",cr="default",ar="default",dr="transparent",ur="transparent";function fr(e,t,n){let{currentTabId:o}=t,{items:r=[]}=t;const i={};let{onClickTitle:s=((e,t)=>{})}=t,{onClickClose:l=((e,t)=>{})}=t,{onDndConsider:c=(e=>{})}=t,{onDndFinalize:a=(e=>{})}=t;function d(e,t){n(6,i[t]=!1,i)}function u(e,t){n(6,i[t]=!0,i)}return e.$$set=e=>{"currentTabId"in e&&n(0,o=e.currentTabId),"items"in e&&n(1,r=e.items),"onClickTitle"in e&&n(2,s=e.onClickTitle),"onClickClose"in e&&n(3,l=e.onClickClose),"onDndConsider"in e&&n(4,c=e.onDndConsider),"onDndFinalize"in e&&n(5,a=e.onDndFinalize)},e.$$.update=()=>{if(2&e.$$.dirty)for(const e of r)n(6,i[e.id]=!0,i)},[o,r,s,l,c,a,i,d,u,(e,t)=>s(t,e.id),(e,t)=>l(t,e.id),(e,t)=>d(0,e.id),(e,t)=>u(0,e.id)]}class gr extends fe{constructor(e){super(),ue(this,e,fr,or,c,{currentTabId:0,items:1,onClickTitle:2,onClickClose:3,onDndConsider:4,onDndFinalize:5})}}function pr(e){let t,n,o,r,i,l;function c(t){e[9](t)}let a={currentTabId:e[0],onClickTitle:e[5],onClickClose:e[6],onDndConsider:e[7],onDndFinalize:e[8]};return void 0!==e[2]&&(a.items=e[2]),n=new gr({props:a}),W.push((()=>function(e,t,n){const o=e.$$.props[t];void 0!==o&&(e.$$.bound[o]=n,n(e.$$.ctx[o]))}(n,"items",c))),{c(){t=D("div"),le(n.$$.fragment),O(t,"class","panel-tabs svelte-e6fdbd")},m(o,s){T(o,t,s),ce(n,t,null),e[10](t),r=!0,i||(l=[k(t,"mousewheel",e[3]),k(t,"dblclick",e[4])],i=!0)},p(e,[t]){const r={};var i;1&t&&(r.currentTabId=e[0]),!o&&4&t&&(o=!0,r.items=e[2],i=()=>o=!1,V.push(i)),n.$set(r)},i(e){r||(oe(n.$$.fragment,e),r=!0)},o(e){re(n.$$.fragment,e),r=!1},d(o){o&&E(t),ae(n),e[10](null),i=!1,s(l)}}}function hr(e,n,o){let r,i,s;return a(e,ve,(e=>o(2,r=e))),be.subscribe((e=>{o(0,i="number"==typeof e?e:void 0)})),[i,s,r,function(e){e.deltaY>0?o(1,s.scrollLeft+=50,s):o(1,s.scrollLeft-=50,s)},function(e){t.ipcRenderer.send("windowMaximize"),e.preventDefault(),e.stopImmediatePropagation(),e.stopPropagation()},function(e,n){switch(e.button){case 0:!function(e){if(ve.getTab(e).title!==he){be.set(e),t.ipcRenderer.send("setTabFocus",e);const n=ve.getTabByTitle(he);n&&(ve.deleteTab(n.id),t.ipcRenderer.send("closeTab",n.id),Ce.set(!0))}}(n);break;case 1:ht(n);break;case 2:t.ipcRenderer.send("openTabMenu",n)}},function(e,t){ht(t)},function(e){ve.set(e.detail.items)},function(e){const t=e.detail.items;ve.set(t.map(((e,t)=>({...e,order:e.title===he?0:t+1}))).sort(((e,t)=>e.order>t.order?1:-1)))},function(e){r=e,ve.set(r)},function(e){W[e?"unshift":"push"]((()=>{s=e,o(1,s)}))}]}class mr extends fe{constructor(e){super(),ue(this,e,hr,pr,c,{})}}function $r(e){let t,n,o,r,i,s,l,c;return n=new xt({}),r=new mr({}),s=new dt({}),{c(){t=D("div"),le(n.$$.fragment),o=z(),le(r.$$.fragment),i=z(),le(s.$$.fragment),O(t,"id","panel"),O(t,"style",l=`zoom: ${e[1]}; ${e[0].join("; ")}`),O(t,"class","svelte-fa2wn")},m(e,l){T(e,t,l),ce(n,t,null),y(t,o),ce(r,t,null),y(t,i),ce(s,t,null),c=!0},p(e,[n]){(!c||3&n&&l!==(l=`zoom: ${e[1]}; ${e[0].join("; ")}`))&&O(t,"style",l)},i(e){c||(oe(n.$$.fragment,e),oe(r.$$.fragment,e),oe(s.$$.fragment,e),c=!0)},o(e){re(n.$$.fragment,e),re(r.$$.fragment,e),re(s.$$.fragment,e),c=!1},d(e){e&&E(t),ae(n),ae(r),ae(s)}}}function vr(e,n,o){let r;a(e,ye,(e=>o(1,r=e))),t.ipcRenderer.on("loadCurrentTheme",((e,t)=>{$e.set(t)})),t.ipcRenderer.send("frontReady"),t.ipcRenderer.on("closeAllTabs",(()=>{ve.set([])})),t.ipcRenderer.on("didTabAdd",((e,n)=>{ve.addTab({id:n.id,url:n.url,title:n.title??"Recent Files",focused:n.focused,order:n.title===he?0:void 0}),n.focused&&be.set(n.id),n.title===he&&(be.set(n.id),t.ipcRenderer.send("setTabFocus",n.id))})),t.ipcRenderer.on("setTitle",((e,t)=>{"New Tab"!==t.title&&ve.updateTab({id:t.id,title:t.title})})),t.ipcRenderer.on("tabWasClosed",((e,t)=>{ve.deleteTab(t)})),t.ipcRenderer.on("focusTab",((e,t)=>{be.set(t)})),t.ipcRenderer.on("newFileBtnVisible",((e,t)=>{Ce.set(t)})),t.ipcRenderer.on("setUsingMicrophone",((e,t)=>{ve.updateTab({id:t.id,isUsingMicrophone:t.isUsingMicrophone})})),t.ipcRenderer.on("setIsInVoiceCall",((e,t)=>{ve.updateTab({id:t.id,isInVoiceCall:t.isInVoiceCall})})),t.ipcRenderer.on("isMainMenuOpen",((e,t)=>{we.set(t)})),t.ipcRenderer.on("setPanelScale",((e,t)=>{ye.set(t)})),t.ipcRenderer.on("loadSettings",((e,t)=>{ye.set(t.ui.scalePanel)})),t.ipcRenderer.on("openCommunity",(e=>{xe.set(!0),be.set("communityTab")})),t.ipcRenderer.on("communityTabWasClose",(e=>{xe.set(!1),be.set("mainTab")})),t.ipcRenderer.on("setLoading",((e,t,n)=>{ve.updateTab({id:t,loading:n})}));let i=[];return $e.subscribe((e=>{e&&o(0,i=(e=>{const t=[];for(const n of Object.keys(e.palette)){const o=e.palette[n];t.push(`--${n}: ${o}`)}return t})(e))})),[i,r]}new class extends fe{constructor(e){super(),ue(this,e,vr,$r,c,{})}}({target:document.body});
"use strict";var e=require("electron"),t=require("url"),n=require("crypto"),o=require("path");function r(){}const i=e=>e;function l(e,t){for(const n in t)e[n]=t[n];return e}function s(e){return e()}function a(){return Object.create(null)}function c(e){e.forEach(s)}function $(e){return"function"==typeof e}function d(e,t){return e!=e?t==t:e!==t||e&&"object"==typeof e||"function"==typeof e}let f;function u(e,t){return e===t||(f||(f=document.createElement("a")),f.href=t,e===f.href)}function p(e,...t){if(null==e){for(const e of t)e(void 0);return r}const n=e.subscribe(...t);return n.unsubscribe?()=>n.unsubscribe():n}function g(e){let t;return p(e,(e=>t=e))(),t}function C(e,t,n){e.$$.on_destroy.push(p(t,n))}function m(e,t,n,o){if(e){const r=h(e,t,n,o);return e[0](r)}}function h(e,t,n,o){return e[1]&&o?l(n.ctx.slice(),e[1](o(t))):n.ctx}function v(e,t,n,o){if(e[2]&&o){const r=e[2](o(n));if(void 0===t.dirty)return r;if("object"==typeof r){const e=[],n=Math.max(t.dirty.length,r.length);for(let o=0;o<n;o+=1)e[o]=t.dirty[o]|r[o];return e}return t.dirty|r}return t.dirty}function x(e,t,n,o,r,i){if(r){const l=h(t,n,o,i);e.p(l,r)}}function w(e){if(e.ctx.length>32){const t=[],n=e.ctx.length/32;for(let e=0;e<n;e++)t[e]=-1;return t}return-1}function b(e){return null==e?"":e}function H(e,t,n){return e.set(n),t}function V(e){return e&&$(e.destroy)?e.destroy:r}const L="undefined"!=typeof window;let y=L?()=>window.performance.now():()=>Date.now(),M=L?e=>requestAnimationFrame(e):r;const Z=new Set;function k(e){Z.forEach((t=>{t.c(e)||(Z.delete(t),t.f())})),0!==Z.size&&M(k)}function B(e,t){e.appendChild(t)}function _(e,t,n){e.insertBefore(t,n||null)}function z(e){e.parentNode&&e.parentNode.removeChild(e)}function I(e){return document.createElement(e)}function T(e){return document.createElementNS("http://www.w3.org/2000/svg",e)}function O(e){return document.createTextNode(e)}function S(){return O(" ")}function A(){return O("")}function F(e,t,n,o){return e.addEventListener(t,n,o),()=>e.removeEventListener(t,n,o)}function E(e,t,n){null==n?e.removeAttribute(t):e.getAttribute(t)!==n&&e.setAttribute(t,n)}function P(e,t){t=""+t,e.data!==t&&(e.data=t)}function R(e,t){e.value=null==t?"":t}function D(e,t){return new e(t)}let j;function N(e){j=e}function U(){if(!j)throw new Error("Function called outside component initialization");return j}function q(){const e=U();return(t,n,{cancelable:o=!1}={})=>{const r=e.$$.callbacks[t];if(r){const i=function(e,t,{bubbles:n=!1,cancelable:o=!1}={}){return new CustomEvent(e,{detail:t,bubbles:n,cancelable:o})}(t,n,{cancelable:o});return r.slice().forEach((t=>{t.call(e,i)})),!i.defaultPrevented}return!0}}function G(e,t){const n=e.$$.callbacks[t.type];n&&n.slice().forEach((e=>e.call(this,t)))}const W=[],X=[];let Y=[];const J=[],K=Promise.resolve();let Q=!1;function ee(e){Y.push(e)}function te(e){J.push(e)}const ne=new Set;let oe=0;function re(){if(0!==oe)return;const e=j;do{try{for(;oe<W.length;){const e=W[oe];oe++,N(e),ie(e.$$)}}catch(e){throw W.length=0,oe=0,e}for(N(null),W.length=0,oe=0;X.length;)X.pop()();for(let e=0;e<Y.length;e+=1){const t=Y[e];ne.has(t)||(ne.add(t),t())}Y.length=0}while(W.length);for(;J.length;)J.pop()();Q=!1,ne.clear(),N(e)}function ie(e){if(null!==e.fragment){e.update(),c(e.before_update);const t=e.dirty;e.dirty=[-1],e.fragment&&e.fragment.p(e.ctx,t),e.after_update.forEach(ee)}}const le=new Set;let se;function ae(){se={r:0,c:[],p:se}}function ce(){se.r||c(se.c),se=se.p}function $e(e,t){e&&e.i&&(le.delete(e),e.i(t))}function de(e,t,n,o){if(e&&e.o){if(le.has(e))return;le.add(e),se.c.push((()=>{le.delete(e),o&&(n&&e.d(1),o())})),e.o(t)}else o&&o()}function fe(e){return void 0!==e?.length?e:Array.from(e)}function ue(e,t){e.d(1),t.delete(e.key)}function pe(e,t){de(e,1,1,(()=>{t.delete(e.key)}))}function ge(e,t,n,o,r,i,l,s,a,$,d,f){let u=e.length,p=i.length,g=u;const C={};for(;g--;)C[e[g].key]=g;const m=[],h=new Map,v=new Map,x=[];for(g=p;g--;){const e=f(r,i,g),s=n(e);let a=l.get(s);a?o&&x.push((()=>a.p(e,t))):(a=$(s,e),a.c()),h.set(s,m[g]=a),s in C&&v.set(s,Math.abs(g-C[s]))}const w=new Set,b=new Set;function H(e){$e(e,1),e.m(s,d),l.set(e.key,e),d=e.first,p--}for(;u&&p;){const t=m[p-1],n=e[u-1],o=t.key,r=n.key;t===n?(d=t.first,u--,p--):h.has(r)?!l.has(o)||w.has(o)?H(t):b.has(r)?u--:v.get(o)>v.get(r)?(b.add(o),H(t)):(w.add(r),u--):(a(n,l),u--)}for(;u--;){const t=e[u];h.has(t.key)||a(t,l)}for(;p;)H(m[p-1]);return c(x),m}function Ce(e,t){const n={},o={},r={$$scope:1};let i=e.length;for(;i--;){const l=e[i],s=t[i];if(s){for(const e in l)e in s||(o[e]=1);for(const e in s)r[e]||(n[e]=s[e],r[e]=1);e[i]=s}else for(const e in l)r[e]=1}for(const e in o)e in n||(n[e]=void 0);return n}function me(e){return"object"==typeof e&&null!==e?e:{}}function he(e,t,n){const o=e.$$.props[t];void 0!==o&&(e.$$.bound[o]=n,n(e.$$.ctx[o]))}function ve(e){e&&e.c()}function xe(e,t,n){const{fragment:o,after_update:r}=e.$$;o&&o.m(t,n),ee((()=>{const t=e.$$.on_mount.map(s).filter($);e.$$.on_destroy?e.$$.on_destroy.push(...t):c(t),e.$$.on_mount=[]})),r.forEach(ee)}function we(e,t){const n=e.$$;null!==n.fragment&&(!function(e){const t=[],n=[];Y.forEach((o=>-1===e.indexOf(o)?t.push(o):n.push(o))),n.forEach((e=>e())),Y=t}(n.after_update),c(n.on_destroy),n.fragment&&n.fragment.d(t),n.on_destroy=n.fragment=null,n.ctx=[])}function be(e,t){-1===e.$$.dirty[0]&&(W.push(e),Q||(Q=!0,K.then(re)),e.$$.dirty.fill(0)),e.$$.dirty[t/31|0]|=1<<t%31}function He(e,t,n,o,i,l,s=null,$=[-1]){const d=j;N(e);const f=e.$$={fragment:null,ctx:[],props:l,update:r,not_equal:i,bound:a(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(t.context||(d?d.$$.context:[])),callbacks:a(),dirty:$,skip_bound:!1,root:t.target||d.$$.root};s&&s(f.root);let u=!1;if(f.ctx=n?n(e,t.props||{},((t,n,...o)=>{const r=o.length?o[0]:n;return f.ctx&&i(f.ctx[t],f.ctx[t]=r)&&(!f.skip_bound&&f.bound[t]&&f.bound[t](r),u&&be(e,t)),n})):[],f.update(),u=!0,c(f.before_update),f.fragment=!!o&&o(f.ctx),t.target){if(t.hydrate){const e=function(e){return Array.from(e.childNodes)}(t.target);f.fragment&&f.fragment.l(e),e.forEach(z)}else f.fragment&&f.fragment.c();t.intro&&$e(e.$$.fragment),xe(e,t.target,t.anchor),re()}N(d)}class Ve{$$=void 0;$$set=void 0;$destroy(){we(this,1),this.$destroy=r}$on(e,t){if(!$(t))return r;const n=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return n.push(t),()=>{const e=n.indexOf(t);-1!==e&&n.splice(e,1)}}$set(e){var t;this.$$set&&(t=e,0!==Object.keys(t).length)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}"undefined"!=typeof window&&(window.__svelte||(window.__svelte={v:new Set})).v.add("4");const Le=[];function ye(e,t=r){let n;const o=new Set;function i(t){if(d(e,t)&&(e=t,n)){const t=!Le.length;for(const t of o)t[1](),Le.push(t,e);if(t){for(let e=0;e<Le.length;e+=2)Le[e][0](Le[e+1]);Le.length=0}}}function l(t){i(t(e))}return{set:i,update:l,subscribe:function(s,a=r){const c=[s,a];return o.add(c),1===o.size&&(n=t(i,l)||r),s(e),()=>{o.delete(c),0===o.size&&n&&(n(),n=null)}}}}process.env.FIGMA_LOGLEVEL,t.parse("https://www.figma.com");process.env.HOME,process.env.HOME;const Me={text:"Text","text-active":"Active text","text-disabled":"Disabled text",borders:"Borders and divider lines","bg-panel":"Panels bg color","bg-panel-hover":"Panel selected item bg color","bg-toolbar":"Toolbar bg color","bg-toolbar-hover":"Toolbar item hover bg color","bg-toolbar-active":"Toolbar active item bg color","fg-toolbar":"Toolbar icons color","fg-toolbar-hover":"Toolbar hover icons color","fg-toolbar-active":"Toolbar active icon color","fg-toolbar-disabled":"Toolbar disabled icons color","fg-toolbar-filename":"Toolbar file name color","fg-toolbar-foldername":"Toolbar dir name color","fg-toolbar-chevron":"Toolbar chevron color","fg-toolbar-unsavedicon":"Toolbar unsaved icon color","fg-toolbar-login-button":"Toolbar login button color","fg-toolbar-login-button-border":"Toolbar login button border color","fg-toolbar-login-button-active":"Toolbar active login button color","bg-overlay":"Dropdown menu bg color","fg-overlay":"Dropdown menu text color","bg-overlay-outline":"Dropdown menu outline color","bg-overlay-inner-outline":"Dropdown menu inner outline color","bg-tab":"Tab bg color","bg-tab-hover":"Tab hover bg color","bg-tab-active":"Tab active bg color","fg-tab":"Tab text color","fg-tab-hover":"Tab hover text color","fg-tab-active":"Tab active text color","bg-header":"Header bg color","fg-header":"Header text color","bg-header-control":"Header control buttons bg color","bg-header-control-hover":"Header hover control buttons bg color","bg-header-control-active":"Header active control buttons bg color","fg-header-control":"Header control buttons text color","fg-header-control-hover":"Header hover control buttons text color","fg-header-control-active":"Header active control buttons text color","fg-component":"Component color","fg-component-disabled":"Component disabled color","fg-component-disabled-row-active":"Component disabled row active color","bg-window-close":"Window close bg color","bg-beta-label":"Beta button bg color"},Ze={name:"Default Theme",author:"Figma",id:"0",palette:{text:"#333333","text-active":"#050505","text-disabled":"#b3b3b3",borders:"#e2e2e2","bg-panel":"#ffffff","bg-panel-hover":"#daebf7","bg-toolbar":"#2c2c2c","bg-toolbar-hover":"#000000","bg-toolbar-active":"#18a0fb","fg-toolbar":"#ffffff","fg-toolbar-hover":"#ffffff","fg-toolbar-active":"#ffffff","fg-toolbar-disabled":"#b3b3b3","fg-toolbar-filename":"#ffffff","fg-toolbar-foldername":"#aaaaaa","fg-toolbar-chevron":"#ffffff","fg-toolbar-unsavedicon":"#a1a1a1","fg-toolbar-login-button":"#ffffff","fg-toolbar-login-button-border":"#d3d3d3","fg-toolbar-login-button-active":"#808080","bg-overlay":"#222222","fg-overlay":"#ffffff","bg-overlay-outline":"#292828","bg-overlay-inner-outline":"#000000","bg-tab":"#222222","bg-tab-hover":"#2c2c2c","bg-tab-active":"#2c2c2c","fg-tab":"#ffffff","fg-tab-hover":"#ffffff","fg-tab-active":"#ffffff","bg-header":"#222222","fg-header":"#ffffff","bg-header-control":"#222222","bg-header-control-hover":"#2c2c2c","bg-header-control-active":"#2c2c2c","fg-header-control":"#ffffff","fg-header-control-hover":"#ffffff","fg-header-control-active":"#ffffff","fg-component":"#7b61ff","fg-component-disabled":"#4e428a","fg-component-disabled-row-active":"#bfbafc","bg-window-close":"#e81123","bg-beta-label":"#1bc47d"}};!function(){const{subscribe:e,update:t}=ye({...structuredClone(Ze),id:"test-creator-theme"})}();const ke=function(){const{subscribe:e,set:t}=ye();return{subscribe:e,set:t,reset:()=>t(structuredClone(Ze))}}(),Be=e=>{const t=[];for(const n of Object.keys(e.palette)){const o=e.palette[n];t.push(`--${n}: ${o}`)}return t};const _e=/^#[a-fA-F0-9]{3,6}$/,ze=/(\d{1,3}),\s?(\d{1,3}),\s?(\d{1,3})/,Ie=e=>_e.test(e),Te=e=>Ie(e)||(e=>ze.test(e))(e);var Oe;!function(e){e[e.DEBUG=0]="DEBUG",e[e.INFO=1]="INFO",e[e.WARN=2]="WARN",e[e.ERROR=3]="ERROR"}(Oe||(Oe={}));const Se={clientId:"",userId:"",authedUserIDs:[],app:{logLevel:Oe.INFO,lastTimeClearLogFile:0,enableColorSpaceSrgb:!1,visibleNewProjectBtn:!0,useZenity:!1,disableThemes:!1,panelHeight:40,saveLastOpenedTabs:!0,exportDir:`${process.env.HOME}/Pictures/Figma`,commandSwitches:[{switch:"enable-gpu-rasterization"},{switch:"enable-experimental-canvas-features"},{switch:"use-vulkan"}],fontDirs:["/usr/share/fonts","/usr/local/share/fonts","/run/host/fonts","/run/host/user-fonts",`${process.env.HOME}/.local/share/fonts`],recentlyClosedTabs:[],windowsState:{},lastOpenedTabs:{},featureFlags:{},savedExtensions:[],themeDropdownOpen:!0,creatorsThemesDropdownOpen:!1,useOldPreviewer:!1,dontShowTutorialCreator:!1},theme:{currentTheme:"0"},ui:{scalePanel:1,scaleFigmaUI:1}};(()=>{let t=0;const n=new Map;e.ipcRenderer.on("handleCallback",((e,t,o)=>{const r=n.get(t);r?r(o):console.error("[desktop] unexpected callback",t)}))})();const Ae=function(){const{subscribe:e,update:t,set:n}=ye();return{set:e=>n({...e,app:{...e.app,themeDropdownOpen:e.app.themeDropdownOpen??!0,creatorsThemesDropdownOpen:e.app.creatorsThemesDropdownOpen??!1,useOldPreviewer:e.app.useOldPreviewer??!1,dontShowTutorialCreator:e.app.dontShowTutorialCreator??!1}}),subscribe:e,trim:()=>t((e=>(e.app.commandSwitches=e.app.commandSwitches.filter((e=>""!==e.switch)),e))),reset:()=>t((e=>Se))}}();const Fe=function(){const{subscribe:e,update:t}=ye([structuredClone(Ze)]);return{subscribe:e,update:t,set:e=>t((t=>[structuredClone(Ze),...e]))}}(),Ee=ye(""),Pe=ye("");const Re=function(){const{subscribe:e,set:t,update:n}=ye();return{subscribe:e,update:n,set:t}}();const De=function(){const{subscribe:e,set:t,update:n}=ye(!0);return{subscribe:e,update:n,set:t}}();const je=function(){const{subscribe:e,set:t,update:n}=ye({state:"new",loadedTemplateId:"",previewMaskVisible:!0,zoom:1,theme:structuredClone(Ze)});return{subscribe:e,update:n,set:t,reset:()=>t({state:"new",loadedTemplateId:"",previewMaskVisible:!0,zoom:1,theme:structuredClone(Ze)}),setTheme:e=>n((t=>({...t,theme:e}))),setColor:(e,t)=>n((n=>({...n,theme:{...n.theme,palette:{...n.theme.palette,[e]:t}}}))),setPaletteTheme:e=>n((t=>({...t,loadedTemplateId:e.id,state:"new",theme:{...t.theme,palette:e.palette}}))),setEditTheme:e=>n((t=>({...t,state:"edit",theme:e}))),togglePreviewVisible:()=>n((e=>({...e,previewMaskVisible:!e.previewMaskVisible})))}}();const Ne=function(){const{subscribe:e,set:t,update:n}=ye([]);return{subscribe:e,update:n,set:t,exists:e=>!!g(Ne).find((t=>t.name===e))}}();function Ue(e){let t,n,o,r,i,l;const s=e[26].default,a=m(s,e,e[25],null);return{c(){t=I("div"),a&&a.c(),E(t,"class",n=b(`\n    ${e[21]?"button__active ":""}\n    ${e[22]?"button__disabled":""}\n  `)+" svelte-y4g53z"),E(t,"style",o=`\n    --padding: ${e[3]};\n    --margin: ${e[4]};\n    --width: ${e[0]};\n    --height: ${e[1]};\n    --border-radius: ${e[2]}px;\n\n    --normal-bg-alpha: ${e[8]};\n    --active-bg-alpha: ${e[9]};\n    --hover-bg-alpha: ${e[10]};\n\n    --normal-bg-color: ${e[11]};\n    --hover-bg-color: ${e[12]};\n    --active-bg-color: ${e[13]};\n    --disabled-bg-color: ${e[14]};\n\n    --normal-fg-color: ${e[5]};\n    --active-fg-color: ${e[6]};\n    --hover-fg-color: ${e[7]};\n\n    --normal-border: ${e[15]};\n    --active-border: ${e[16]};\n    --hover-border: ${e[17]};\n\n    --normal-cursor: ${e[18]};\n    --active-cursor: ${e[19]};\n    --hover-cursor: ${e[20]};\n  `)},m(n,o){_(n,t,o),a&&a.m(t,null),r=!0,i||(l=F(t,"mouseup",e[23],!0),i=!0)},p(e,[i]){a&&a.p&&(!r||33554432&i)&&x(a,s,e,e[25],r?v(s,e[25],i,null):w(e[25]),null),(!r||6291456&i&&n!==(n=b(`\n    ${e[21]?"button__active ":""}\n    ${e[22]?"button__disabled":""}\n  `)+" svelte-y4g53z"))&&E(t,"class",n),(!r||2097151&i&&o!==(o=`\n    --padding: ${e[3]};\n    --margin: ${e[4]};\n    --width: ${e[0]};\n    --height: ${e[1]};\n    --border-radius: ${e[2]}px;\n\n    --normal-bg-alpha: ${e[8]};\n    --active-bg-alpha: ${e[9]};\n    --hover-bg-alpha: ${e[10]};\n\n    --normal-bg-color: ${e[11]};\n    --hover-bg-color: ${e[12]};\n    --active-bg-color: ${e[13]};\n    --disabled-bg-color: ${e[14]};\n\n    --normal-fg-color: ${e[5]};\n    --active-fg-color: ${e[6]};\n    --hover-fg-color: ${e[7]};\n\n    --normal-border: ${e[15]};\n    --active-border: ${e[16]};\n    --hover-border: ${e[17]};\n\n    --normal-cursor: ${e[18]};\n    --active-cursor: ${e[19]};\n    --hover-cursor: ${e[20]};\n  `))&&E(t,"style",o)},i(e){r||($e(a,e),r=!0)},o(e){de(a,e),r=!1},d(e){e&&z(t),a&&a.d(e),i=!1,l()}}}function qe(e,t,n){let{$$slots:o={},$$scope:r}=t;const i=q();let{round:l=0}=t,{size:s}=t,{width:a="inherit"}=t,{height:c="inherit"}=t,{padding:$="inherit"}=t,{margin:d="inherit"}=t,{normalFgColor:f="var(--text)"}=t,{activeFgColor:u="var(--text-active)"}=t,{hoverFgColor:p="var(--text-active)"}=t,{normalBgAlpha:g="1"}=t,{activeBgAlpha:C="1"}=t,{hoverBgAlpha:m="1"}=t,{normalBgColor:h="transparent"}=t,{hoverBgColor:v="var(--bg-tab-hover)"}=t,{activeBgColor:x="var(--bg-tab-hover)"}=t,{disabledBgColor:w="var(--borders)"}=t,{normalBorder:b="none"}=t,{activeBorder:H="none"}=t,{hoverBorder:V="none"}=t,{normalCursor:L="default"}=t,{activeCursor:y="default"}=t,{hoverCursor:M="default"}=t,{isActive:Z=!1}=t,{disabled:k=!1}=t;return s&&(a=`${s}px`,c=`${s}px`),e.$$set=e=>{"round"in e&&n(2,l=e.round),"size"in e&&n(24,s=e.size),"width"in e&&n(0,a=e.width),"height"in e&&n(1,c=e.height),"padding"in e&&n(3,$=e.padding),"margin"in e&&n(4,d=e.margin),"normalFgColor"in e&&n(5,f=e.normalFgColor),"activeFgColor"in e&&n(6,u=e.activeFgColor),"hoverFgColor"in e&&n(7,p=e.hoverFgColor),"normalBgAlpha"in e&&n(8,g=e.normalBgAlpha),"activeBgAlpha"in e&&n(9,C=e.activeBgAlpha),"hoverBgAlpha"in e&&n(10,m=e.hoverBgAlpha),"normalBgColor"in e&&n(11,h=e.normalBgColor),"hoverBgColor"in e&&n(12,v=e.hoverBgColor),"activeBgColor"in e&&n(13,x=e.activeBgColor),"disabledBgColor"in e&&n(14,w=e.disabledBgColor),"normalBorder"in e&&n(15,b=e.normalBorder),"activeBorder"in e&&n(16,H=e.activeBorder),"hoverBorder"in e&&n(17,V=e.hoverBorder),"normalCursor"in e&&n(18,L=e.normalCursor),"activeCursor"in e&&n(19,y=e.activeCursor),"hoverCursor"in e&&n(20,M=e.hoverCursor),"isActive"in e&&n(21,Z=e.isActive),"disabled"in e&&n(22,k=e.disabled),"$$scope"in e&&n(25,r=e.$$scope)},[a,c,l,$,d,f,u,p,g,C,m,h,v,x,w,b,H,V,L,y,M,Z,k,function(e){k||i("buttonClick",e)},s,r,o]}class Ge extends Ve{constructor(e){super(),He(this,e,qe,Ue,d,{round:2,size:24,width:0,height:1,padding:3,margin:4,normalFgColor:5,activeFgColor:6,hoverFgColor:7,normalBgAlpha:8,activeBgAlpha:9,hoverBgAlpha:10,normalBgColor:11,hoverBgColor:12,activeBgColor:13,disabledBgColor:14,normalBorder:15,activeBorder:16,hoverBorder:17,normalCursor:18,activeCursor:19,hoverCursor:20,isActive:21,disabled:22})}}function We(e){let t,n,o,r,i;const l=e[15].default,s=m(l,e,e[14],null);return{c(){t=I("div"),s&&s.c(),E(t,"style",n=`\n    --padding: ${e[3]};\n    --width: ${e[0]};\n    --height: ${e[1]};\n    --border-radius: ${e[2]}px;\n    --normal-bg-color: ${e[6]};\n    --hover-bg-color: ${e[7]};\n\n    --normal-fg-color: ${e[4]};\n    --hover-fg-color: ${e[5]};\n\n    --normal-opacity: ${e[8]};\n    --hover-opacity: ${e[9]};\n  `),E(t,"class","svelte-pkmuda")},m(n,l){_(n,t,l),s&&s.m(t,null),o=!0,r||(i=[F(t,"mouseup",e[11],!0),F(t,"mouseenter",e[16]),F(t,"mouseleave",e[17])],r=!0)},p(e,[r]){s&&s.p&&(!o||16384&r)&&x(s,l,e,e[14],o?v(l,e[14],r,null):w(e[14]),null),(!o||1023&r&&n!==(n=`\n    --padding: ${e[3]};\n    --width: ${e[0]};\n    --height: ${e[1]};\n    --border-radius: ${e[2]}px;\n    --normal-bg-color: ${e[6]};\n    --hover-bg-color: ${e[7]};\n\n    --normal-fg-color: ${e[4]};\n    --hover-fg-color: ${e[5]};\n\n    --normal-opacity: ${e[8]};\n    --hover-opacity: ${e[9]};\n  `))&&E(t,"style",n)},i(e){o||($e(s,e),o=!0)},o(e){de(s,e),o=!1},d(e){e&&z(t),s&&s.d(e),r=!1,c(i)}}}function Xe(e,t,n){let{$$slots:o={},$$scope:r}=t;const i=q();let{round:l=0}=t,{size:s}=t,{width:a="auto"}=t,{height:c="auto"}=t,{padding:$="auto"}=t,{normalFgColor:d="var(--fg-header)"}=t,{hoverFgColor:f="var(--fg-tab-hover)"}=t,{normalBgColor:u="var(--bg-header)"}=t,{hoverBgColor:p="var(--bg-tab-hover)"}=t,{normalOpacity:g=.4}=t,{hoverOpacity:C=1}=t,{disabled:m=!1}=t;s&&(a=`${s}px`,c=`${s}px`);return e.$$set=e=>{"round"in e&&n(2,l=e.round),"size"in e&&n(12,s=e.size),"width"in e&&n(0,a=e.width),"height"in e&&n(1,c=e.height),"padding"in e&&n(3,$=e.padding),"normalFgColor"in e&&n(4,d=e.normalFgColor),"hoverFgColor"in e&&n(5,f=e.hoverFgColor),"normalBgColor"in e&&n(6,u=e.normalBgColor),"hoverBgColor"in e&&n(7,p=e.hoverBgColor),"normalOpacity"in e&&n(8,g=e.normalOpacity),"hoverOpacity"in e&&n(9,C=e.hoverOpacity),"disabled"in e&&n(13,m=e.disabled),"$$scope"in e&&n(14,r=e.$$scope)},[a,c,l,$,d,f,u,p,g,C,i,function(e){m||i("buttonClick")},s,m,r,o,e=>i("mouseenter",e),e=>i("mouseleave",e)]}class Ye extends Ve{constructor(e){super(),He(this,e,Xe,We,d,{round:2,size:12,width:0,height:1,padding:3,normalFgColor:4,hoverFgColor:5,normalBgColor:6,hoverBgColor:7,normalOpacity:8,hoverOpacity:9,disabled:13})}}function Je(e){let t;const n=e[15].default,o=m(n,e,e[17],null);return{c(){o&&o.c()},m(e,n){o&&o.m(e,n),t=!0},p(e,r){o&&o.p&&(!t||131072&r)&&x(o,n,e,e[17],t?v(n,e[17],r,null):w(e[17]),null)},i(e){t||($e(o,e),t=!0)},o(e){de(o,e),t=!1},d(e){o&&o.d(e)}}}function Ke(e){let t,n;return t=new Ge({props:{width:e[0],height:e[1],margin:e[2],padding:e[3],normalFgColor:e[4],normalBgColor:e[5],activeBgColor:e[6],hoverBgColor:e[7],isActive:e[8],normalBorder:e[9],activeBorder:e[10],hoverBorder:e[11],normalCursor:e[12],activeCursor:e[13],hoverCursor:e[14],round:3,$$slots:{default:[Je]},$$scope:{ctx:e}}}),t.$on("buttonClick",e[16]),{c(){ve(t.$$.fragment)},m(e,o){xe(t,e,o),n=!0},p(e,[n]){const o={};1&n&&(o.width=e[0]),2&n&&(o.height=e[1]),4&n&&(o.margin=e[2]),8&n&&(o.padding=e[3]),16&n&&(o.normalFgColor=e[4]),32&n&&(o.normalBgColor=e[5]),64&n&&(o.activeBgColor=e[6]),128&n&&(o.hoverBgColor=e[7]),256&n&&(o.isActive=e[8]),512&n&&(o.normalBorder=e[9]),1024&n&&(o.activeBorder=e[10]),2048&n&&(o.hoverBorder=e[11]),4096&n&&(o.normalCursor=e[12]),8192&n&&(o.activeCursor=e[13]),16384&n&&(o.hoverCursor=e[14]),131072&n&&(o.$$scope={dirty:n,ctx:e}),t.$set(o)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){de(t.$$.fragment,e),n=!1},d(e){we(t,e)}}}function Qe(e,t,n){let{$$slots:o={},$$scope:r}=t,{width:i="inherit"}=t,{height:l="36px"}=t,{margin:s="inherit"}=t,{padding:a="0 7px"}=t,{normalFgColor:c="var(--fg-toolbar-active)"}=t,{normalBgColor:$="var(--bg-toolbar-active)"}=t,{activeBgColor:d="var(--bg-toolbar-active"}=t,{hoverBgColor:f="var(--bg-toolbar-active)"}=t,{isActive:u=!1}=t,{normalBorder:p="none"}=t,{activeBorder:g="none"}=t,{hoverBorder:C="none"}=t,{normalCursor:m="pointer"}=t,{activeCursor:h="pointer"}=t,{hoverCursor:v="pointer"}=t;return e.$$set=e=>{"width"in e&&n(0,i=e.width),"height"in e&&n(1,l=e.height),"margin"in e&&n(2,s=e.margin),"padding"in e&&n(3,a=e.padding),"normalFgColor"in e&&n(4,c=e.normalFgColor),"normalBgColor"in e&&n(5,$=e.normalBgColor),"activeBgColor"in e&&n(6,d=e.activeBgColor),"hoverBgColor"in e&&n(7,f=e.hoverBgColor),"isActive"in e&&n(8,u=e.isActive),"normalBorder"in e&&n(9,p=e.normalBorder),"activeBorder"in e&&n(10,g=e.activeBorder),"hoverBorder"in e&&n(11,C=e.hoverBorder),"normalCursor"in e&&n(12,m=e.normalCursor),"activeCursor"in e&&n(13,h=e.activeCursor),"hoverCursor"in e&&n(14,v=e.hoverCursor),"$$scope"in e&&n(17,r=e.$$scope)},[i,l,s,a,c,$,d,f,u,p,g,C,m,h,v,o,function(t){G.call(this,e,t)},r]}class et extends Ve{constructor(e){super(),He(this,e,Qe,Ke,d,{width:0,height:1,margin:2,padding:3,normalFgColor:4,normalBgColor:5,activeBgColor:6,hoverBgColor:7,isActive:8,normalBorder:9,activeBorder:10,hoverBorder:11,normalCursor:12,activeCursor:13,hoverCursor:14})}}function tt(e){let t;const n=e[15].default,o=m(n,e,e[17],null);return{c(){o&&o.c()},m(e,n){o&&o.m(e,n),t=!0},p(e,r){o&&o.p&&(!t||131072&r)&&x(o,n,e,e[17],t?v(n,e[17],r,null):w(e[17]),null)},i(e){t||($e(o,e),t=!0)},o(e){de(o,e),t=!1},d(e){o&&o.d(e)}}}function nt(e){let t,n;return t=new Ge({props:{padding:e[0],width:e[1],height:e[2],normalFgColor:e[3],hoverFgColor:e[4],normalBgColor:e[5],activeBgColor:e[6],hoverBgColor:e[7],isActive:e[8],normalBorder:e[9],activeBorder:e[10],hoverBorder:e[11],normalCursor:e[12],activeCursor:e[13],hoverCursor:e[14],round:3,$$slots:{default:[tt]},$$scope:{ctx:e}}}),t.$on("buttonClick",e[16]),{c(){ve(t.$$.fragment)},m(e,o){xe(t,e,o),n=!0},p(e,[n]){const o={};1&n&&(o.padding=e[0]),2&n&&(o.width=e[1]),4&n&&(o.height=e[2]),8&n&&(o.normalFgColor=e[3]),16&n&&(o.hoverFgColor=e[4]),32&n&&(o.normalBgColor=e[5]),64&n&&(o.activeBgColor=e[6]),128&n&&(o.hoverBgColor=e[7]),256&n&&(o.isActive=e[8]),512&n&&(o.normalBorder=e[9]),1024&n&&(o.activeBorder=e[10]),2048&n&&(o.hoverBorder=e[11]),4096&n&&(o.normalCursor=e[12]),8192&n&&(o.activeCursor=e[13]),16384&n&&(o.hoverCursor=e[14]),131072&n&&(o.$$scope={dirty:n,ctx:e}),t.$set(o)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){de(t.$$.fragment,e),n=!1},d(e){we(t,e)}}}function ot(e,t,n){let{$$slots:o={},$$scope:r}=t,{padding:i="0 7px"}=t,{width:l="auto"}=t,{height:s="36px"}=t,{normalFgColor:a="var(--text)"}=t,{hoverFgColor:c="var(--text-active)"}=t,{normalBgColor:$="transparent"}=t,{activeBgColor:d="transparent"}=t,{hoverBgColor:f="transparent"}=t,{isActive:u=!1}=t,{normalBorder:p="1px solid var(--text)"}=t,{activeBorder:g="1px solid var(--text-active)"}=t,{hoverBorder:C="1px solid var(--text-active)"}=t,{normalCursor:m="pointer"}=t,{activeCursor:h="pointer"}=t,{hoverCursor:v="pointer"}=t;return e.$$set=e=>{"padding"in e&&n(0,i=e.padding),"width"in e&&n(1,l=e.width),"height"in e&&n(2,s=e.height),"normalFgColor"in e&&n(3,a=e.normalFgColor),"hoverFgColor"in e&&n(4,c=e.hoverFgColor),"normalBgColor"in e&&n(5,$=e.normalBgColor),"activeBgColor"in e&&n(6,d=e.activeBgColor),"hoverBgColor"in e&&n(7,f=e.hoverBgColor),"isActive"in e&&n(8,u=e.isActive),"normalBorder"in e&&n(9,p=e.normalBorder),"activeBorder"in e&&n(10,g=e.activeBorder),"hoverBorder"in e&&n(11,C=e.hoverBorder),"normalCursor"in e&&n(12,m=e.normalCursor),"activeCursor"in e&&n(13,h=e.activeCursor),"hoverCursor"in e&&n(14,v=e.hoverCursor),"$$scope"in e&&n(17,r=e.$$scope)},[i,l,s,a,c,$,d,f,u,p,g,C,m,h,v,o,function(t){G.call(this,e,t)},r]}class rt extends Ve{constructor(e){super(),He(this,e,ot,nt,d,{padding:0,width:1,height:2,normalFgColor:3,hoverFgColor:4,normalBgColor:5,activeBgColor:6,hoverBgColor:7,isActive:8,normalBorder:9,activeBorder:10,hoverBorder:11,normalCursor:12,activeCursor:13,hoverCursor:14})}}function it(e){let t,n,o;const r=e[2].default,i=m(r,e,e[1],null);return{c(){t=I("div"),i&&i.c(),E(t,"class",n=b(e[0]?"spin":"")+" svelte-q44ed0")},m(e,n){_(e,t,n),i&&i.m(t,null),o=!0},p(e,[l]){i&&i.p&&(!o||2&l)&&x(i,r,e,e[1],o?v(r,e[1],l,null):w(e[1]),null),(!o||1&l&&n!==(n=b(e[0]?"spin":"")+" svelte-q44ed0"))&&E(t,"class",n)},i(e){o||($e(i,e),o=!0)},o(e){de(i,e),o=!1},d(e){e&&z(t),i&&i.d(e)}}}function lt(e,t,n){let{$$slots:o={},$$scope:r}=t,{spin:i=!1}=t;return e.$$set=e=>{"spin"in e&&n(0,i=e.spin),"$$scope"in e&&n(1,r=e.$$scope)},[i,r,o]}class st extends Ve{constructor(e){super(),He(this,e,lt,it,d,{spin:0})}}function at(e){let t,n,o;const r=e[10].default,i=m(r,e,e[9],null);return{c(){t=I("div"),i&&i.c(),E(t,"style",n=`\n    --width: ${e[2]};\n    --height: ${e[3]};\n    --padding: ${e[4]};\n    --columns: ${e[5]};\n    --rows: ${e[6]};\n    --areas: ${e[7]};\n    --grid-column-gap: ${e[0]};\n    --grid-row-gap: ${e[1]};\n  `),E(t,"class","svelte-12aaq2z")},m(e,n){_(e,t,n),i&&i.m(t,null),o=!0},p(e,[l]){i&&i.p&&(!o||512&l)&&x(i,r,e,e[9],o?v(r,e[9],l,null):w(e[9]),null),(!o||255&l&&n!==(n=`\n    --width: ${e[2]};\n    --height: ${e[3]};\n    --padding: ${e[4]};\n    --columns: ${e[5]};\n    --rows: ${e[6]};\n    --areas: ${e[7]};\n    --grid-column-gap: ${e[0]};\n    --grid-row-gap: ${e[1]};\n  `))&&E(t,"style",n)},i(e){o||($e(i,e),o=!0)},o(e){de(i,e),o=!1},d(e){e&&z(t),i&&i.d(e)}}}function ct(e,t,n){let{$$slots:o={},$$scope:r}=t,{gap:i=""}=t,{width:l="auto"}=t,{height:s="auto"}=t,{padding:a="inherit"}=t,{columns:c="auto"}=t,{rows:$="auto"}=t,{columnGap:d="auto"}=t,{rowGap:f="auto"}=t,{areas:u="auto"}=t;return i&&(f=i,d=i),e.$$set=e=>{"gap"in e&&n(8,i=e.gap),"width"in e&&n(2,l=e.width),"height"in e&&n(3,s=e.height),"padding"in e&&n(4,a=e.padding),"columns"in e&&n(5,c=e.columns),"rows"in e&&n(6,$=e.rows),"columnGap"in e&&n(0,d=e.columnGap),"rowGap"in e&&n(1,f=e.rowGap),"areas"in e&&n(7,u=e.areas),"$$scope"in e&&n(9,r=e.$$scope)},[d,f,l,s,a,c,$,u,i,r,o]}class $t extends Ve{constructor(e){super(),He(this,e,ct,at,d,{gap:8,width:2,height:3,padding:4,columns:5,rows:6,columnGap:0,rowGap:1,areas:7})}}function dt(e){let t,n,o;const r=e[17].default,i=m(r,e,e[16],null);return{c(){t=I("div"),i&&i.c(),E(t,"style",n=`\n    --width: ${e[0]};\n    --height: ${e[1]};\n    --direction: ${e[4]};\n    --justifyItems: ${e[7]};\n    --justifyContent: ${e[5]};\n    --alignItems: ${e[8]};\n    --overflow: ${e[6]};\n    --border: ${e[9]};\n    --tborder: ${e[10]};\n    --rborder: ${e[11]};\n    --bborder: ${e[12]};\n    --lborder: ${e[13]};\n    --bradius: ${e[14]};\n    --padding: ${e[2]};\n    --margin: ${e[3]};\n    --bgColor: ${e[15]};\n  `),E(t,"class","svelte-1cesgdx")},m(e,n){_(e,t,n),i&&i.m(t,null),o=!0},p(e,[l]){i&&i.p&&(!o||65536&l)&&x(i,r,e,e[16],o?v(r,e[16],l,null):w(e[16]),null),(!o||65535&l&&n!==(n=`\n    --width: ${e[0]};\n    --height: ${e[1]};\n    --direction: ${e[4]};\n    --justifyItems: ${e[7]};\n    --justifyContent: ${e[5]};\n    --alignItems: ${e[8]};\n    --overflow: ${e[6]};\n    --border: ${e[9]};\n    --tborder: ${e[10]};\n    --rborder: ${e[11]};\n    --bborder: ${e[12]};\n    --lborder: ${e[13]};\n    --bradius: ${e[14]};\n    --padding: ${e[2]};\n    --margin: ${e[3]};\n    --bgColor: ${e[15]};\n  `))&&E(t,"style",n)},i(e){o||($e(i,e),o=!0)},o(e){de(i,e),o=!1},d(e){e&&z(t),i&&i.d(e)}}}function ft(e,t,n){let{$$slots:o={},$$scope:r}=t,{width:i="auto"}=t,{height:l="auto"}=t,{padding:s="0"}=t,{margin:a="0"}=t,{der:c="row"}=t,{justifyContent:$="auto"}=t,{overflow:d="auto"}=t,{justifyItems:f="auto"}=t,{alignItems:u="auto"}=t,{border:p="none"}=t,{tborder:g="none"}=t,{rborder:C="none"}=t,{bborder:m="none"}=t,{lborder:h="none"}=t,{bradius:v="none"}=t,{bgColor:x="transparent"}=t;return e.$$set=e=>{"width"in e&&n(0,i=e.width),"height"in e&&n(1,l=e.height),"padding"in e&&n(2,s=e.padding),"margin"in e&&n(3,a=e.margin),"der"in e&&n(4,c=e.der),"justifyContent"in e&&n(5,$=e.justifyContent),"overflow"in e&&n(6,d=e.overflow),"justifyItems"in e&&n(7,f=e.justifyItems),"alignItems"in e&&n(8,u=e.alignItems),"border"in e&&n(9,p=e.border),"tborder"in e&&n(10,g=e.tborder),"rborder"in e&&n(11,C=e.rborder),"bborder"in e&&n(12,m=e.bborder),"lborder"in e&&n(13,h=e.lborder),"bradius"in e&&n(14,v=e.bradius),"bgColor"in e&&n(15,x=e.bgColor),"$$scope"in e&&n(16,r=e.$$scope)},[i,l,s,a,c,$,d,f,u,p,g,C,m,h,v,x,r,o]}class ut extends Ve{constructor(e){super(),He(this,e,ft,dt,d,{width:0,height:1,padding:2,margin:3,der:4,justifyContent:5,overflow:6,justifyItems:7,alignItems:8,border:9,tborder:10,rborder:11,bborder:12,lborder:13,bradius:14,bgColor:15})}}function pt(e){let t,n,o;const r=e[3].default,i=m(r,e,e[2],null);return{c(){t=I("div"),i&&i.c(),E(t,"style",n=`\n    flex: ${e[1]};\n    flex-grow: ${e[0]};\n  `)},m(e,n){_(e,t,n),i&&i.m(t,null),o=!0},p(e,[l]){i&&i.p&&(!o||4&l)&&x(i,r,e,e[2],o?v(r,e[2],l,null):w(e[2]),null),(!o||3&l&&n!==(n=`\n    flex: ${e[1]};\n    flex-grow: ${e[0]};\n  `))&&E(t,"style",n)},i(e){o||($e(i,e),o=!0)},o(e){de(i,e),o=!1},d(e){e&&z(t),i&&i.d(e)}}}function gt(e,t,n){let{$$slots:o={},$$scope:r}=t,{grow:i=0}=t,{flex:l=0}=t;return e.$$set=e=>{"grow"in e&&n(0,i=e.grow),"flex"in e&&n(1,l=e.flex),"$$scope"in e&&n(2,r=e.$$scope)},[i,l,r,o]}class Ct extends Ve{constructor(e){super(),He(this,e,gt,pt,d,{grow:0,flex:1})}}function mt(e){return"[object Date]"===Object.prototype.toString.call(e)}function ht(e){const t=e-1;return t*t*t+1}function vt(e,t){if(e===t||e!=e)return()=>e;const n=typeof e;if(n!==typeof t||Array.isArray(e)!==Array.isArray(t))throw new Error("Cannot interpolate values of different type");if(Array.isArray(e)){const n=t.map(((t,n)=>vt(e[n],t)));return e=>n.map((t=>t(e)))}if("object"===n){if(!e||!t)throw new Error("Object cannot be null");if(mt(e)&&mt(t)){e=e.getTime();const n=(t=t.getTime())-e;return t=>new Date(e+t*n)}const n=Object.keys(t),o={};return n.forEach((n=>{o[n]=vt(e[n],t[n])})),e=>{const t={};return n.forEach((n=>{t[n]=o[n](e)})),t}}if("number"===n){const n=t-e;return t=>e+t*n}throw new Error(`Cannot interpolate ${n} values`)}function xt(e,t={}){const n=ye(e);let o,r=e;function s(s,a){if(null==e)return n.set(e=s),Promise.resolve();r=s;let c=o,$=!1,{delay:d=0,duration:f=400,easing:u=i,interpolate:p=vt}=l(l({},t),a);if(0===f)return c&&(c.abort(),c=null),n.set(e=r),Promise.resolve();const g=y()+d;let C;return o=function(e){let t;return 0===Z.size&&M(k),{promise:new Promise((n=>{Z.add(t={c:e,f:n})})),abort(){Z.delete(t)}}}((t=>{if(t<g)return!0;$||(C=p(e,s),"function"==typeof f&&(f=f(e,s)),$=!0),c&&(c.abort(),c=null);const o=t-g;return o>f?(n.set(e=s),!1):(n.set(e=C(u(o/f))),!0)})),o.promise}return{set:s,update:(t,n)=>s(t(r,e),n),subscribe:n.subscribe}}function wt(e){let t,n,o,r,i,l,s,a,$,d,f,u,p;const g=e[9].default,C=m(g,e,e[8],null);return{c(){t=I("div"),n=I("label"),o=I("input"),r=S(),i=I("span"),l=O(e[1]),s=S(),a=I("block"),$=I("blockContent"),C&&C.c(),E(o,"type","checkbox"),E(o,"class","svelte-1eug09i"),E(i,"class","svelte-1eug09i"),E(n,"class","svelte-1eug09i"),E($,"class","svelte-1eug09i"),E(a,"style",d=`\n      height: ${e[3]}px;\n    `),E(a,"class","svelte-1eug09i"),E(t,"class","svelte-1eug09i")},m(c,d){_(c,t,d),B(t,n),B(n,o),o.checked=e[0],B(n,r),B(n,i),B(i,l),B(t,s),B(t,a),B(a,$),C&&C.m($,null),e[11]($),f=!0,u||(p=[F(o,"change",e[10]),F(o,"change",e[5]),F(o,"focusin",e[5])],u=!0)},p(e,[t]){1&t&&(o.checked=e[0]),(!f||2&t)&&P(l,e[1]),C&&C.p&&(!f||256&t)&&x(C,g,e,e[8],f?v(g,e[8],t,null):w(e[8]),null),(!f||8&t&&d!==(d=`\n      height: ${e[3]}px;\n    `))&&E(a,"style",d)},i(e){f||($e(C,e),f=!0)},o(e){de(C,e),f=!1},d(n){n&&z(t),C&&C.d(n),e[11](null),u=!1,c(p)}}}function bt(e,t,n){let o,r,{$$slots:i={},$$scope:l}=t,{title:s}=t,{isEmpty:a=!1}=t,{open:c=!1}=t,{duration:$=400}=t,d=0;const f=xt(0,{duration:$,easing:ht});function u(){if(!r)return;const e=r.getBoundingClientRect();d=a?0:e.height,c&&f.set(d)}return C(e,f,(e=>n(3,o=e))),window.addEventListener("resize",u),e.$$set=e=>{"title"in e&&n(1,s=e.title),"isEmpty"in e&&n(6,a=e.isEmpty),"open"in e&&n(0,c=e.open),"duration"in e&&n(7,$=e.duration),"$$scope"in e&&n(8,l=e.$$scope)},[c,s,r,o,f,function(e){const t=e.target;u(),t.checked?f.set(d):f.set(0)},a,$,l,i,function(){c=this.checked,n(0,c)},function(e){X[e?"unshift":"push"]((()=>{r=e,n(2,r)}))}]}class Ht extends Ve{constructor(e){super(),He(this,e,bt,wt,d,{title:1,isEmpty:6,open:0,duration:7})}}const Vt=e=>({}),Lt=e=>({}),yt=e=>({}),Mt=e=>({});function Zt(e){let t,n,o,r,i,l,s,a,$,d,f,u,p,g;const C=e[16].default,h=m(C,e,e[15],null),b=e[16].toolBar,H=m(b,e,e[15],Mt),V=e[16].layout_1,L=m(V,e,e[15],Lt);return{c(){t=I("zoomArea"),n=I("div"),h&&h.c(),o=S(),r=I("maskZoomArea"),s=S(),a=I("zoomAreaToolBarWrap"),$=I("zoomAreaToolBar"),H&&H.c(),d=S(),L&&L.c(),E(r,"style",i=`\n        z-index: ${e[1]?100:-1};\n        width: ${e[4].width}px;\n        height: ${e[4].height}px;\n      `),E(r,"class","svelte-1st4xl7"),E(n,"style",l=`\n      zoom: ${e[0]};\n    `),E(n,"class","svelte-1st4xl7"),E($,"class","svelte-1st4xl7"),E(a,"class","svelte-1st4xl7"),E(t,"style",f=`\n    width: ${e[2]};\n    height: ${e[3]};\n  `),E(t,"class","svelte-1st4xl7")},m(i,l){_(i,t,l),B(t,n),h&&h.m(n,null),B(n,o),B(n,r),e[17](r),e[18](n),B(t,s),B(t,a),B(a,$),H&&H.m($,null),B(t,d),L&&L.m(t,null),e[19](t),u=!0,p||(g=[F(t,"mousedown",e[10]),F(t,"mouseup",e[8]),F(t,"mousemove",e[11]),F(t,"mouseleave",e[9]),F(t,"mousewheel",e[12])],p=!0)},p(e,[o]){h&&h.p&&(!u||32768&o)&&x(h,C,e,e[15],u?v(C,e[15],o,null):w(e[15]),null),(!u||18&o&&i!==(i=`\n        z-index: ${e[1]?100:-1};\n        width: ${e[4].width}px;\n        height: ${e[4].height}px;\n      `))&&E(r,"style",i),(!u||1&o&&l!==(l=`\n      zoom: ${e[0]};\n    `))&&E(n,"style",l),H&&H.p&&(!u||32768&o)&&x(H,b,e,e[15],u?v(b,e[15],o,yt):w(e[15]),Mt),L&&L.p&&(!u||32768&o)&&x(L,V,e,e[15],u?v(V,e[15],o,Vt):w(e[15]),Lt),(!u||12&o&&f!==(f=`\n    width: ${e[2]};\n    height: ${e[3]};\n  `))&&E(t,"style",f)},i(e){u||($e(h,e),$e(H,e),$e(L,e),u=!0)},o(e){de(h,e),de(H,e),de(L,e),u=!1},d(n){n&&z(t),h&&h.d(n),e[17](null),e[18](null),H&&H.d(n),L&&L.d(n),e[19](null),p=!1,c(g)}}}function kt(e,t,n){let o,r,i,{$$slots:l={},$$scope:s}=t,{zoom:a}=t,{minZoom:c}=t,{maxZoom:$}=t,{width:d="auto"}=t,{height:f="auto"}=t,{isMaskActive:u=!0}=t,{maskBounds:p={width:0,height:0}}=t,g={top:0,left:0,x:0,y:0},C=!1;function m(e){return!(!o||!r||!r.isEqualNode(e.target)&&!o.isEqualNode(e.target))}function h(e){"AltLeft"===e.code&&n(1,u=!u)}var v;return v=()=>{document.removeEventListener("keydown",h)},U().$$.on_destroy.push(v),e.$$set=e=>{"zoom"in e&&n(0,a=e.zoom),"minZoom"in e&&n(13,c=e.minZoom),"maxZoom"in e&&n(14,$=e.maxZoom),"width"in e&&n(2,d=e.width),"height"in e&&n(3,f=e.height),"isMaskActive"in e&&n(1,u=e.isMaskActive),"maskBounds"in e&&n(4,p=e.maskBounds),"$$scope"in e&&n(15,s=e.$$scope)},[a,u,d,f,p,o,r,i,function(e){if(m(e))return n(7,i.style.cursor="grab",i),void(C=!1);n(7,i.style.cursor="default",i)},function(e){n(7,i.style.cursor="default",i),C=!1},function(e){if(m(e))return C=!0,n(7,i.style.cursor="grabbing",i),void(g={left:i.scrollLeft,top:i.scrollTop,x:e.clientX,y:e.clientY});n(7,i.style.cursor="default",i)},function(e){if(m(e)){if(!C)return void n(7,i.style.cursor="grab",i);const t=e.clientX-g.x,o=e.clientY-g.y;return n(7,i.scrollTop=g.top-o,i),void n(7,i.scrollLeft=g.left-t,i)}n(7,i.style.cursor="default",i)},function(e){e.preventDefault(),n(0,a+=e.deltaY>0?a<=c?0:-.05:a>=$?0:.05)},c,$,s,l,function(e){X[e?"unshift":"push"]((()=>{r=e,n(6,r)}))},function(e){X[e?"unshift":"push"]((()=>{o=e,n(5,o)}))},function(e){X[e?"unshift":"push"]((()=>{i=e,n(7,i)}))}]}class Bt extends Ve{constructor(e){super(),He(this,e,kt,Zt,d,{zoom:0,minZoom:13,maxZoom:14,width:2,height:3,isMaskActive:1,maskBounds:4})}}function _t(e){let t,n,o;const r=e[2].default,i=m(r,e,e[1],null);return{c(){t=I("div"),i&&i.c(),E(t,"style",n=`\n    --deg: ${e[0]}deg;\n  `),E(t,"class","svelte-1959krd")},m(e,n){_(e,t,n),i&&i.m(t,null),o=!0},p(e,[l]){i&&i.p&&(!o||2&l)&&x(i,r,e,e[1],o?v(r,e[1],l,null):w(e[1]),null),(!o||1&l&&n!==(n=`\n    --deg: ${e[0]}deg;\n  `))&&E(t,"style",n)},i(e){o||($e(i,e),o=!0)},o(e){de(i,e),o=!1},d(e){e&&z(t),i&&i.d(e)}}}function zt(e,t,n){let{$$slots:o={},$$scope:r}=t,{deg:i=0}=t;return e.$$set=e=>{"deg"in e&&n(0,i=e.deg),"$$scope"in e&&n(1,r=e.$$scope)},[i,r,o]}class It extends Ve{constructor(e){super(),He(this,e,zt,_t,d,{deg:0})}}function Tt(e){let t,n,o;const r=e[2].default,i=m(r,e,e[1],null);return{c(){t=I("div"),i&&i.c(),E(t,"style",n=`\n    --bg-color: ${e[0]};\n  `),E(t,"class","svelte-kv7tn7")},m(e,n){_(e,t,n),i&&i.m(t,null),o=!0},p(e,[l]){i&&i.p&&(!o||2&l)&&x(i,r,e,e[1],o?v(r,e[1],l,null):w(e[1]),null),(!o||1&l&&n!==(n=`\n    --bg-color: ${e[0]};\n  `))&&E(t,"style",n)},i(e){o||($e(i,e),o=!0)},o(e){de(i,e),o=!1},d(e){e&&z(t),i&&i.d(e)}}}function Ot(e,t,n){let{$$slots:o={},$$scope:r}=t,{bgColor:i="var(--bg-header)"}=t;return e.$$set=e=>{"bgColor"in e&&n(0,i=e.bgColor),"$$scope"in e&&n(1,r=e.$$scope)},[i,r,o]}class St extends Ve{constructor(e){super(),He(this,e,Ot,Tt,d,{bgColor:0})}}function At(e){let t,n;return{c(){t=T("svg"),n=T("path"),E(n,"d","M14.7348 12.1818H3.28027V13H14.7348V12.1818ZM14.7348 8.09091H3.28027V8.90909H14.7348V8.09091ZM14.7348 4H3.28027V4.81818H14.7348V4Z"),E(n,"fill",e[1]),E(t,"width",e[0]),E(t,"height",e[0]),E(t,"viewBox","0 0 18 18"),E(t,"fill","none"),E(t,"xmlns","http://www.w3.org/2000/svg")},m(e,o){_(e,t,o),B(t,n)},p(e,[o]){2&o&&E(n,"fill",e[1]),1&o&&E(t,"width",e[0]),1&o&&E(t,"height",e[0])},i:r,o:r,d(e){e&&z(t)}}}function Ft(e,t,n){let{size:o="16"}=t,{color:r="var(--fg-header)"}=t;return e.$$set=e=>{"size"in e&&n(0,o=e.size),"color"in e&&n(1,r=e.color)},[o,r]}class Et extends Ve{constructor(e){super(),He(this,e,Ft,At,d,{size:0,color:1})}}function Pt(e){let t,n,o;return{c(){t=T("svg"),n=T("g"),o=T("path"),E(o,"fill-rule","evenodd"),E(o,"clip-rule","evenodd"),E(o,"d","M7.116 8l-4.558 4.558l.884.884L8 8.884l4.558 4.558l.884-.884L8.884 8l4.558-4.558l-.884-.884L8 7.116L3.442 2.558l-.884.884L7.116 8z"),E(n,"fill",e[1]),E(t,"width",e[0]),E(t,"height",e[0]),E(t,"viewBox","0 0 16 16"),E(t,"fill","none"),E(t,"xmlns","http://www.w3.org/2000/svg")},m(e,r){_(e,t,r),B(t,n),B(n,o)},p(e,[o]){2&o&&E(n,"fill",e[1]),1&o&&E(t,"width",e[0]),1&o&&E(t,"height",e[0])},i:r,o:r,d(e){e&&z(t)}}}function Rt(e,t,n){let{size:o="16"}=t,{color:r="var(--fg-header)"}=t;return e.$$set=e=>{"size"in e&&n(0,o=e.size),"color"in e&&n(1,r=e.color)},[o,r]}class Dt extends Ve{constructor(e){super(),He(this,e,Rt,Pt,d,{size:0,color:1})}}function jt(e){let t,n;return{c(){t=T("svg"),n=T("path"),E(n,"d","M11.75 3.5H15.5V5H14V14.75C14 14.9489 13.921 15.1397 13.7803 15.2803C13.6397 15.421 13.4489 15.5 13.25 15.5H2.75C2.55109 15.5 2.36032 15.421 2.21967 15.2803C2.07902 15.1397 2 14.9489 2 14.75V5H0.5V3.5H4.25V1.25C4.25 1.05109 4.32902 0.860322 4.46967 0.71967C4.61032 0.579018 4.80109 0.5 5 0.5H11C11.1989 0.5 11.3897 0.579018 11.5303 0.71967C11.671 0.860322 11.75 1.05109 11.75 1.25V3.5ZM12.5 5H3.5V14H12.5V5ZM5.75 2V3.5H10.25V2H5.75Z"),E(n,"fill",e[1]),E(t,"width",e[0]),E(t,"height",e[0]),E(t,"viewBox","0 0 16 16"),E(t,"fill","none"),E(t,"xmlns","http://www.w3.org/2000/svg")},m(e,o){_(e,t,o),B(t,n)},p(e,[o]){2&o&&E(n,"fill",e[1]),1&o&&E(t,"width",e[0]),1&o&&E(t,"height",e[0])},i:r,o:r,d(e){e&&z(t)}}}function Nt(e,t,n){let{size:o="16"}=t,{color:r="var(--fg-header)"}=t;return e.$$set=e=>{"size"in e&&n(0,o=e.size),"color"in e&&n(1,r=e.color)},[o,r]}class Ut extends Ve{constructor(e){super(),He(this,e,Nt,jt,d,{size:0,color:1})}}function qt(e){let t,n;return{c(){t=T("svg"),n=T("path"),E(n,"d","M6 5.293l4.789-4.79.707.708-4.79 4.79 4.79 4.789-.707.707-4.79-4.79-4.789 4.79-.707-.707L5.293 6 .502 1.211 1.21.504 6 5.294z"),E(n,"fill-rule","nonzero"),E(n,"fill-opacity","1"),E(n,"fill",e[1]),E(n,"stroke","none"),E(t,"class","svg"),E(t,"width",e[0]),E(t,"height",e[0]),E(t,"viewBox","0 0 12 12"),E(t,"xmlns","http://www.w3.org/2000/svg")},m(e,o){_(e,t,o),B(t,n)},p(e,[o]){2&o&&E(n,"fill",e[1]),1&o&&E(t,"width",e[0]),1&o&&E(t,"height",e[0])},i:r,o:r,d(e){e&&z(t)}}}function Gt(e,t,n){let{size:o="12"}=t,{color:r="var(--fg-header)"}=t;return e.$$set=e=>{"size"in e&&n(0,o=e.size),"color"in e&&n(1,r=e.color)},[o,r]}class Wt extends Ve{constructor(e){super(),He(this,e,Gt,qt,d,{size:0,color:1})}}function Xt(e){let t,n,o,i,l;return{c(){t=T("svg"),n=T("rect"),o=T("rect"),i=T("rect"),l=T("rect"),E(n,"x","3.30672"),E(n,"y","9"),E(n,"width","2.85709"),E(n,"height","2.85709"),E(n,"rx","0.5"),E(n,"transform","rotate(-45 3.30672 9)"),E(n,"stroke",e[1]),E(o,"x","6.94343"),E(o,"y","5.36353"),E(o,"width","2.85709"),E(o,"height","2.85709"),E(o,"rx","0.5"),E(o,"transform","rotate(-45 6.94343 5.36353)"),E(o,"stroke",e[1]),E(i,"x","10.5792"),E(i,"y","9"),E(i,"width","2.85709"),E(i,"height","2.85709"),E(i,"rx","0.5"),E(i,"transform","rotate(-45 10.5792 9)"),E(i,"stroke",e[1]),E(l,"x","6.94343"),E(l,"y","12.6365"),E(l,"width","2.85709"),E(l,"height","2.85709"),E(l,"rx","0.5"),E(l,"transform","rotate(-45 6.94343 12.6365)"),E(l,"stroke",e[1]),E(t,"width",e[0]),E(t,"height",e[0]),E(t,"viewBox","0 0 18 18"),E(t,"fill","none"),E(t,"xmlns","http://www.w3.org/2000/svg")},m(e,r){_(e,t,r),B(t,n),B(t,o),B(t,i),B(t,l)},p(e,[r]){2&r&&E(n,"stroke",e[1]),2&r&&E(o,"stroke",e[1]),2&r&&E(i,"stroke",e[1]),2&r&&E(l,"stroke",e[1]),1&r&&E(t,"width",e[0]),1&r&&E(t,"height",e[0])},i:r,o:r,d(e){e&&z(t)}}}function Yt(e,t,n){let{size:o="18"}=t,{color:r="var(--fg-header)"}=t;return e.$$set=e=>{"size"in e&&n(0,o=e.size),"color"in e&&n(1,r=e.color)},[o,r]}class Jt extends Ve{constructor(e){super(),He(this,e,Yt,Xt,d,{size:0,color:1})}}function Kt(e){let t,n;return{c(){t=T("svg"),n=T("path"),E(n,"d","M12.75 4.5H16.5V6H15V15.75C15 15.9489 14.921 16.1397 14.7803 16.2803C14.6397 16.421 14.4489 16.5 14.25 16.5H3.75C3.55109 16.5 3.36032 16.421 3.21967 16.2803C3.07902 16.1397 3 15.9489 3 15.75V6H1.5V4.5H5.25V2.25C5.25 2.05109 5.32902 1.86032 5.46967 1.71967C5.61032 1.57902 5.80109 1.5 6 1.5H12C12.1989 1.5 12.3897 1.57902 12.5303 1.71967C12.671 1.86032 12.75 2.05109 12.75 2.25V4.5ZM13.5 6H4.5V15H13.5V6ZM6.75 3V4.5H11.25V3H6.75Z"),E(n,"fill",e[1]),E(t,"width",e[0]),E(t,"height",e[0]),E(t,"viewBox","0 0 18 18"),E(t,"fill","none"),E(t,"xmlns","http://www.w3.org/2000/svg")},m(e,o){_(e,t,o),B(t,n)},p(e,[o]){2&o&&E(n,"fill",e[1]),1&o&&E(t,"width",e[0]),1&o&&E(t,"height",e[0])},i:r,o:r,d(e){e&&z(t)}}}function Qt(e,t,n){let{size:o="18"}=t,{color:r="var(--fg-header)"}=t;return e.$$set=e=>{"size"in e&&n(0,o=e.size),"color"in e&&n(1,r=e.color)},[o,r]}class en extends Ve{constructor(e){super(),He(this,e,Qt,Kt,d,{size:0,color:1})}}function tn(e){let t,n;return{c(){t=T("svg"),n=T("path"),E(n,"d","M11.4 11.3333H0.6C0.440957 11.333 0.288508 11.2705 0.176047 11.1594C0.0635866 11.0484 0.000281992 10.8978 0 10.7407V1.25925C0.000281992 1.10217 0.0635866 0.951603 0.176047 0.84053C0.288508 0.729458 0.440957 0.666935 0.6 0.666656H5.26773C5.51573 0.666656 5.728 0.8152 5.8192 1.02748L5.8208 1.03117L6.33333 2.2469H11.4C11.559 2.24718 11.7115 2.30971 11.824 2.42078C11.9364 2.53185 11.9997 2.68242 12 2.8395V10.7407C11.9997 10.8978 11.9364 11.0484 11.824 11.1594C11.7115 11.2705 11.559 11.333 11.4 11.3333ZM0.8 10.5432H11.2V3.03703H5.8L5.13333 1.45678H0.8V10.5432Z"),E(n,"fill",e[1]),E(t,"width",e[0]),E(t,"height",e[0]),E(t,"viewBox","0 0 12 12"),E(t,"fill","none"),E(t,"xmlns","http://www.w3.org/2000/svg")},m(e,o){_(e,t,o),B(t,n)},p(e,[o]){2&o&&E(n,"fill",e[1]),1&o&&E(t,"width",e[0]),1&o&&E(t,"height",e[0])},i:r,o:r,d(e){e&&z(t)}}}function nn(e,t,n){let{size:o="16"}=t,{color:r="var(--fg-header)"}=t;return e.$$set=e=>{"size"in e&&n(0,o=e.size),"color"in e&&n(1,r=e.color)},[o,r]}class on extends Ve{constructor(e){super(),He(this,e,nn,tn,d,{size:0,color:1})}}function rn(e){let t,n;return{c(){t=T("svg"),n=T("path"),E(n,"fill-rule","evenodd"),E(n,"clip-rule","evenodd"),E(n,"d","M4.73777 10.0915C4.46976 9.81259 4.44286 9.34238 4.67672 9.02853C4.90178 8.7267 5.29293 8.67344 5.57698 8.90539L6.27391 9.47525L6.7913 9.8985V5.29091C6.7913 4.97476 7.02309 4.71818 7.30869 4.71818C7.59481 4.71818 7.82608 4.97476 7.82608 5.29091V8.15455H8.34347V4.14545C8.34347 3.82931 8.57527 3.57273 8.86087 3.57273C9.14698 3.57273 9.37826 3.82931 9.37826 4.14545V8.15455H9.89565V4.71818C9.89565 4.40204 10.1274 4.14545 10.413 4.14545C10.6992 4.14545 10.9304 4.40204 10.9304 4.71818V8.15455H11.4478V6.43636C11.4478 6.12022 11.6796 5.86364 11.9652 5.86364C12.2513 5.86364 12.4826 6.12022 12.4826 6.43636V11.0182C12.4826 12.6001 11.3247 13.8818 9.89565 13.8818H9.37826C8.57475 13.8818 7.85713 13.4763 7.38216 12.8395C7.36353 12.8234 7.34491 12.8051 7.32732 12.7868L4.73777 10.0915ZM7.0143 13.2455L6.9729 13.2043L4.38336 10.509C3.91667 10.0234 3.86959 9.21065 4.27781 8.66427C4.67724 8.1282 5.3783 8.03084 5.88431 8.44435L6.27391 8.76335V5.29091C6.27391 4.65862 6.73749 4.14545 7.30869 4.14545C7.49754 4.14545 7.67397 4.20101 7.82608 4.29895V4.14545C7.82608 3.51316 8.28967 3 8.86087 3C9.31255 3 9.69645 3.32015 9.8377 3.76631C10.0022 3.64375 10.1999 3.57273 10.413 3.57273C10.9848 3.57273 11.4478 4.08589 11.4478 4.71818V5.4444C11.5999 5.34704 11.7769 5.29091 11.9652 5.29091C12.5369 5.29091 13 5.80407 13 6.43636V11.0182C13 12.9162 11.6103 14.4545 9.89565 14.4545H9.37826C8.43143 14.4545 7.58291 13.9843 7.01378 13.2455H7.0143Z"),E(n,"fill",e[1]),E(t,"width",e[0]),E(t,"height",e[0]),E(t,"viewBox","0 0 18 18"),E(t,"fill","none"),E(t,"xmlns","http://www.w3.org/2000/svg")},m(e,o){_(e,t,o),B(t,n)},p(e,[o]){2&o&&E(n,"fill",e[1]),1&o&&E(t,"width",e[0]),1&o&&E(t,"height",e[0])},i:r,o:r,d(e){e&&z(t)}}}function ln(e,t,n){let{size:o="18"}=t,{color:r="var(--fg-header)"}=t;return e.$$set=e=>{"size"in e&&n(0,o=e.size),"color"in e&&n(1,r=e.color)},[o,r]}class sn extends Ve{constructor(e){super(),He(this,e,ln,rn,d,{size:0,color:1})}}function an(e){let t,n,o,i;return{c(){t=T("svg"),n=T("path"),o=T("path"),i=T("path"),E(n,"d","M7 4C7 3.44772 7.44772 3 8 3C8.55228 3 9 3.44772 9 4C9 4.55228 8.55228 5 8 5C7.44772 5 7 4.55228 7 4Z"),E(n,"fill",e[1]),E(o,"d","M7 8C7 7.44772 7.44772 7 8 7C8.55228 7 9 7.44772 9 8C9 8.55228 8.55228 9 8 9C7.44772 9 7 8.55228 7 8Z"),E(o,"fill",e[1]),E(i,"d","M7 12C7 11.4477 7.44772 11 8 11C8.55228 11 9 11.4477 9 12C9 12.5523 8.55228 13 8 13C7.44772 13 7 12.5523 7 12Z"),E(i,"fill",e[1]),E(t,"width",e[0]),E(t,"height",e[0]),E(t,"viewBox","0 0 16 16"),E(t,"fill","none"),E(t,"xmlns","http://www.w3.org/2000/svg")},m(e,r){_(e,t,r),B(t,n),B(t,o),B(t,i)},p(e,[r]){2&r&&E(n,"fill",e[1]),2&r&&E(o,"fill",e[1]),2&r&&E(i,"fill",e[1]),1&r&&E(t,"width",e[0]),1&r&&E(t,"height",e[0])},i:r,o:r,d(e){e&&z(t)}}}function cn(e,t,n){let{size:o="16"}=t,{color:r="var(--fg-header)"}=t;return e.$$set=e=>{"size"in e&&n(0,o=e.size),"color"in e&&n(1,r=e.color)},[o,r]}class $n extends Ve{constructor(e){super(),He(this,e,cn,an,d,{size:0,color:1})}}function dn(e){let t,n,o,i,l,s;return{c(){t=T("svg"),n=T("g"),o=T("path"),i=T("defs"),l=T("clipPath"),s=T("rect"),E(o,"d","M0 12.6671V16H3.33287L13.1626 6.17025L9.82975 2.83738L0 12.6671ZM15.74 3.59283C16.0867 3.24622 16.0867 2.68629 15.74 2.33968L13.6603 0.259964C13.3137 -0.0866546 12.7538 -0.0866546 12.4072 0.259964L10.7807 1.8864L14.1136 5.21927L15.74 3.59283Z"),E(o,"fill",e[1]),E(n,"clip-path","url(#clip0_3109_3056)"),E(s,"width",e[0]),E(s,"height",e[0]),E(s,"fill",e[1]),E(l,"id","clip0_3109_3056"),E(t,"width",e[0]),E(t,"height",e[0]),E(t,"viewBox","0 0 16 16"),E(t,"fill","none"),E(t,"xmlns","http://www.w3.org/2000/svg")},m(e,r){_(e,t,r),B(t,n),B(n,o),B(t,i),B(i,l),B(l,s)},p(e,[n]){2&n&&E(o,"fill",e[1]),1&n&&E(s,"width",e[0]),1&n&&E(s,"height",e[0]),2&n&&E(s,"fill",e[1]),1&n&&E(t,"width",e[0]),1&n&&E(t,"height",e[0])},i:r,o:r,d(e){e&&z(t)}}}function fn(e,t,n){let{size:o="16"}=t,{color:r="var(--fg-header)"}=t;return e.$$set=e=>{"size"in e&&n(0,o=e.size),"color"in e&&n(1,r=e.color)},[o,r]}class un extends Ve{constructor(e){super(),He(this,e,fn,dn,d,{size:0,color:1})}}function pn(e){let t,n;return{c(){t=T("svg"),n=T("path"),E(n,"d","M2.5 6.5v1h4v4h1v-4h4v-1h-4v-4h-1v4h-4z"),E(n,"fill",e[1]),E(t,"class","svg"),E(t,"width",e[0]),E(t,"height",e[0]),E(t,"viewBox","0 0 14 14"),E(t,"xmlns","http://www.w3.org/2000/svg")},m(e,o){_(e,t,o),B(t,n)},p(e,[o]){2&o&&E(n,"fill",e[1]),1&o&&E(t,"width",e[0]),1&o&&E(t,"height",e[0])},i:r,o:r,d(e){e&&z(t)}}}function gn(e,t,n){let{size:o="16"}=t,{color:r="var(--fg-header)"}=t;return e.$$set=e=>{"size"in e&&n(0,o=e.size),"color"in e&&n(1,r=e.color)},[o,r]}class Cn extends Ve{constructor(e){super(),He(this,e,gn,pn,d,{size:0,color:1})}}function mn(e){let t,n;return{c(){t=T("svg"),n=T("path"),E(n,"fill-rule","evenodd"),E(n,"clip-rule","evenodd"),E(n,"d","M6.48568 3.13509L7.16998 1.38358L6.23854 1.01968L5.07348 4.00173L4.90666 4.42871L5.31758 4.63188L8.54963 6.22996L8.99286 5.33355L6.6227 4.16164C7.29264 3.85958 8.02865 3.72525 8.76651 3.77361C9.65459 3.83182 10.5055 4.15207 11.2115 4.69385C11.9176 5.23564 12.4472 5.97463 12.7332 6.81738C13.0193 7.66014 13.0491 8.56879 12.8187 9.42845C12.5884 10.2881 12.1083 11.0602 11.4392 11.647C10.77 12.2338 9.94192 12.609 9.05955 12.7251C8.17719 12.8413 7.28019 12.6932 6.48199 12.2996C5.6844 11.9063 5.02126 11.2854 4.57628 10.5155L4.57524 10.5137L4.57509 10.5138L3.70922 11.0137L3.70907 11.0138C3.87757 11.3057 4.07172 11.58 4.28846 11.834C4.7713 12.3998 5.36626 12.8645 6.03962 13.1966C7.01524 13.6777 8.11161 13.8587 9.1901 13.7168C10.2686 13.5748 11.2808 13.1162 12.0986 12.3989C12.9165 11.6817 13.5033 10.738 13.7848 9.68731C14.0663 8.63658 14.03 7.52596 13.6803 6.49589C13.3307 5.46582 12.6834 4.56257 11.8204 3.90036C10.9574 3.23815 9.91739 2.84673 8.83193 2.77558C8.08275 2.72648 7.33513 2.83147 6.63407 3.08006C6.58437 3.09768 6.5349 3.11603 6.48568 3.13509Z"),E(n,"fill",e[1]),E(t,"width",e[0]),E(t,"height",e[0]),E(t,"viewBox","0 0 16 16"),E(t,"fill","none"),E(t,"xmlns","http://www.w3.org/2000/svg")},m(e,o){_(e,t,o),B(t,n)},p(e,[o]){2&o&&E(n,"fill",e[1]),1&o&&E(t,"width",e[0]),1&o&&E(t,"height",e[0])},i:r,o:r,d(e){e&&z(t)}}}function hn(e,t,n){let{size:o="16"}=t,{color:r="var(--fg-header)"}=t;return e.$$set=e=>{"size"in e&&n(0,o=e.size),"color"in e&&n(1,r=e.color)},[o,r]}class vn extends Ve{constructor(e){super(),He(this,e,hn,mn,d,{size:0,color:1})}}function xn(e){let t,n,o,i,l,s,a,c;return{c(){t=T("svg"),n=T("g"),o=T("path"),i=T("path"),l=T("path"),s=T("defs"),a=T("clipPath"),c=T("rect"),E(o,"d","M13.6963 13.9939C13.8642 13.9939 14 13.8581 14 13.6902V4.80625C14 4.71736 13.9605 4.63341 13.8938 4.57662L10.963 2.07045C10.958 2.06551 10.9531 2.06304 10.9481 2.06057C10.9407 2.05563 10.9358 2.05069 10.9284 2.04576C10.9185 2.04082 10.9111 2.03588 10.9012 2.03094C10.8938 2.02847 10.8864 2.02353 10.879 2.02107C10.8691 2.01613 10.8568 2.01366 10.8469 2.01119C10.8395 2.00872 10.8321 2.00625 10.8247 2.00625C10.8049 2.00378 10.7877 2.00131 10.7679 2.00131H2.3037C2.1358 2.00131 2 2.13711 2 2.30502V13.6951C2 13.863 2.1358 13.9988 2.3037 13.9988H13.6963V13.9939ZM11.4938 13.389H4.50617V8.84329C4.50617 8.75193 4.58025 8.68032 4.66914 8.68032H11.3309C11.4222 8.68032 11.4938 8.7544 11.4938 8.84329V13.389ZM2.60741 2.60378H5.39259H5.99753C7.07197 2.60378 6.72894 2.60378 7.08203 2.60378H9.45703C10.4727 2.60378 10.5 2.5 10.7679 2.73134L11.0667 2.95687L13.3926 4.94699V13.389H12.0988V8.84329C12.0988 8.4186 11.7531 8.07539 11.3309 8.07539H4.66914C4.24444 8.07539 3.90123 8.42107 3.90123 8.84329V13.3914H2.60741V2.60378Z"),E(o,"fill",e[1]),E(i,"d","M9.51848 9.97162H6.48144C6.31354 9.97162 6.17773 10.1074 6.17773 10.2753C6.17773 10.4432 6.31354 10.579 6.48144 10.579H9.51848C9.68638 10.579 9.82218 10.4432 9.82218 10.2753C9.82218 10.1074 9.68638 9.97162 9.51848 9.97162Z"),E(i,"fill",e[1]),E(l,"d","M9.51848 11.5741H6.48144C6.31354 11.5741 6.17773 11.7099 6.17773 11.8778C6.17773 12.0457 6.31354 12.1815 6.48144 12.1815H9.51848C9.68638 12.1815 9.82218 12.0457 9.82218 11.8778C9.82218 11.7099 9.68638 11.5741 9.51848 11.5741Z"),E(l,"fill",e[1]),E(n,"clip-path","url(#clip0_3120_2511)"),E(c,"width","12"),E(c,"height","12"),E(c,"fill",e[1]),E(c,"transform","translate(2 2)"),E(a,"id","clip0_3120_2511"),E(t,"width",e[0]),E(t,"height",e[0]),E(t,"viewBox","0 0 16 16"),E(t,"fill","none"),E(t,"xmlns","http://www.w3.org/2000/svg")},m(e,r){_(e,t,r),B(t,n),B(n,o),B(n,i),B(n,l),B(t,s),B(s,a),B(a,c)},p(e,[n]){2&n&&E(o,"fill",e[1]),2&n&&E(i,"fill",e[1]),2&n&&E(l,"fill",e[1]),2&n&&E(c,"fill",e[1]),1&n&&E(t,"width",e[0]),1&n&&E(t,"height",e[0])},i:r,o:r,d(e){e&&z(t)}}}function wn(e,t,n){let{size:o="16"}=t,{color:r="var(--fg-header)"}=t;return e.$$set=e=>{"size"in e&&n(0,o=e.size),"color"in e&&n(1,r=e.color)},[o,r]}class bn extends Ve{constructor(e){super(),He(this,e,wn,xn,d,{size:0,color:1})}}function Hn(e){let t,n;return{c(){t=T("svg"),n=T("path"),E(n,"fill-rule","evenodd"),E(n,"clip-rule","evenodd"),E(n,"d","M14.6094 5.68765L13.4347 7.15603C13.4266 7.10387 13.4177 7.05185 13.4081 7C13.2566 6.18064 12.92 5.40189 12.4187 4.72539C11.7167 3.77797 10.7287 3.08128 9.60051 2.73808C8.47235 2.39489 7.26376 2.42337 6.15302 2.81933C5.35991 3.10206 4.64667 3.56145 4.06455 4.15764C3.83142 4.3964 3.61931 4.6571 3.43153 4.93718L3.43167 4.93728L4.26213 5.49406L4.26227 5.49416C4.79953 4.69282 5.5801 4.08538 6.48886 3.76143C7.39761 3.43748 8.38642 3.41418 9.30942 3.69496C10.2324 3.97574 11.0408 4.54574 11.6152 5.32088C12.0999 5.97502 12.3964 6.74603 12.4771 7.55063L10.2772 6.08398L9.72246 6.91603L12.7225 8.91603L13.1039 9.1703L13.3902 8.81235L15.3902 6.31235L14.6094 5.68765ZM2.60937 7.18765L0.609375 9.68765L1.39024 10.3123L2.56494 8.84397C2.57304 8.89614 2.58189 8.94815 2.59148 9C2.74298 9.81936 3.07957 10.5981 3.58088 11.2746C4.28296 12.222 5.27095 12.9187 6.39911 13.2619C7.52727 13.6051 8.73586 13.5766 9.8466 13.1807C10.6397 12.8979 11.3529 12.4386 11.9351 11.8424C12.1677 11.6041 12.3794 11.344 12.5669 11.0646L12.5681 11.0628L12.5679 11.0627L11.7375 10.5059L11.7373 10.5058L11.7363 10.5074C11.1991 11.308 10.4189 11.9148 9.51076 12.2386C8.60201 12.5625 7.6132 12.5858 6.6902 12.305C5.76719 12.0243 4.95887 11.4543 4.38446 10.6791C3.89971 10.025 3.60322 9.25397 3.52247 8.44937L5.72246 9.91603L6.27716 9.08398L3.27716 7.08398L2.89574 6.8297L2.60937 7.18765Z"),E(n,"fill",e[1]),E(t,"width",e[0]),E(t,"height",e[0]),E(t,"viewBox","0 0 16 16"),E(t,"fill","none"),E(t,"xmlns","http://www.w3.org/2000/svg")},m(e,o){_(e,t,o),B(t,n)},p(e,[o]){2&o&&E(n,"fill",e[1]),1&o&&E(t,"width",e[0]),1&o&&E(t,"height",e[0])},i:r,o:r,d(e){e&&z(t)}}}function Vn(e,t,n){let{size:o="16"}=t,{color:r="var(--fg-header)"}=t;return e.$$set=e=>{"size"in e&&n(0,o=e.size),"color"in e&&n(1,r=e.color)},[o,r]}class Ln extends Ve{constructor(e){super(),He(this,e,Vn,Hn,d,{size:0,color:1})}}function yn(e){let t,n;return{c(){t=T("svg"),n=T("path"),E(n,"d","M1 17V1h7v1H2v14h14v-6h1v7H1zm8.5-4.793l-.354-.353-2.5-2.5.708-.708L9 10.293V8c0-3.776 3.224-7 7-7h1v1h-1c-3.224 0-6 2.776-6 6v2.293l1.646-1.647.708.708-2.5 2.5-.354.353z"),E(n,"fill-rule","nonzero"),E(n,"fill-opacity","1"),E(n,"fill",e[1]),E(n,"stroke","none"),E(t,"class","svg"),E(t,"width",e[0]),E(t,"height",e[0]),E(t,"viewBox","0 0 18 18"),E(t,"xmlns","http://www.w3.org/2000/svg")},m(e,o){_(e,t,o),B(t,n)},p(e,[o]){2&o&&E(n,"fill",e[1]),1&o&&E(t,"width",e[0]),1&o&&E(t,"height",e[0])},i:r,o:r,d(e){e&&z(t)}}}function Mn(e,t,n){let{size:o="16"}=t,{color:r="var(--fg-header)"}=t;return e.$$set=e=>{"size"in e&&n(0,o=e.size),"color"in e&&n(1,r=e.color)},[o,r]}class Zn extends Ve{constructor(e){super(),He(this,e,Mn,yn,d,{size:0,color:1})}}function kn(e){let t,n;return{c(){t=T("svg"),n=T("path"),E(n,"fill-rule","evenodd"),E(n,"clip-rule","evenodd"),E(n,"d","M8 16C12.4183 16 16 12.4183 16 8C16 3.58172 12.4183 0 8 0C3.58172 0 0 3.58172 0 8C0 12.4183 3.58172 16 8 16ZM8 15C11.866 15 15 11.866 15 8C15 4.13401 11.866 1 8 1C4.13401 1 1 4.13401 1 8C1 11.866 4.13401 15 8 15Z"),E(n,"fill",e[1]),E(t,"width",e[0]),E(t,"height",e[0]),E(t,"viewBox","0 0 16 16"),E(t,"fill","none"),E(t,"xmlns","http://www.w3.org/2000/svg")},m(e,o){_(e,t,o),B(t,n)},p(e,[o]){2&o&&E(n,"fill",e[1]),1&o&&E(t,"width",e[0]),1&o&&E(t,"height",e[0])},i:r,o:r,d(e){e&&z(t)}}}function Bn(e,t,n){let{size:o="16"}=t,{color:r="var(--fg-header)"}=t;return e.$$set=e=>{"size"in e&&n(0,o=e.size),"color"in e&&n(1,r=e.color)},[o,r]}class _n extends Ve{constructor(e){super(),He(this,e,Bn,kn,d,{size:0,color:1})}}function zn(e){let t,n;return{c(){t=T("svg"),n=T("path"),E(n,"fill-rule","evenodd"),E(n,"clip-rule","evenodd"),E(n,"d","M16 8C16 12.4183 12.4183 16 8 16C3.58172 16 0 12.4183 0 8C0 3.58172 3.58172 0 8 0C12.4183 0 16 3.58172 16 8ZM15 8C15 11.866 11.866 15 8 15C4.13401 15 1 11.866 1 8C1 4.13401 4.13401 1 8 1C11.866 1 15 4.13401 15 8ZM8 13C10.7614 13 13 10.7614 13 8C13 5.23858 10.7614 3 8 3C5.23858 3 3 5.23858 3 8C3 10.7614 5.23858 13 8 13Z"),E(n,"fill",e[1]),E(t,"width",e[0]),E(t,"height",e[0]),E(t,"viewBox","0 0 16 16"),E(t,"fill","none"),E(t,"xmlns","http://www.w3.org/2000/svg")},m(e,o){_(e,t,o),B(t,n)},p(e,[o]){2&o&&E(n,"fill",e[1]),1&o&&E(t,"width",e[0]),1&o&&E(t,"height",e[0])},i:r,o:r,d(e){e&&z(t)}}}function In(e,t,n){let{size:o="16"}=t,{color:r="var(--fg-header)"}=t;return e.$$set=e=>{"size"in e&&n(0,o=e.size),"color"in e&&n(1,r=e.color)},[o,r]}class Tn extends Ve{constructor(e){super(),He(this,e,In,zn,d,{size:0,color:1})}}function On(e){let t,n,o,i;return{c(){t=I("input"),E(t,"type","color"),E(t,"style",n=`\n    --inputWidth: ${e[1]};\n    --inputHeight: ${e[2]};\n  `),E(t,"class","svelte-z4r8n8")},m(n,r){_(n,t,r),R(t,e[0]),o||(i=[F(t,"input",e[7]),F(t,"change",e[6]),F(t,"mousedown",e[3])],o=!0)},p(e,[o]){6&o&&n!==(n=`\n    --inputWidth: ${e[1]};\n    --inputHeight: ${e[2]};\n  `)&&E(t,"style",n),1&o&&R(t,e[0])},i:r,o:r,d(e){e&&z(t),o=!1,c(i)}}}function Sn(e,t,n){const o=q();let{size:r}=t,{value:i}=t,{key:l=""}=t,{width:s="auto"}=t,{height:a="auto"}=t;return r&&(s=`${r}px`,a=`${r}px`),e.$$set=e=>{"size"in e&&n(4,r=e.size),"value"in e&&n(0,i=e.value),"key"in e&&n(5,l=e.key),"width"in e&&n(1,s=e.width),"height"in e&&n(2,a=e.height)},[i,s,a,function(e){o("mouseClick",{input:e.target,button:e.button,value:i,key:l})},r,l,function(t){G.call(this,e,t)},function(){i=this.value,n(0,i)}]}class An extends Ve{constructor(e){super(),He(this,e,Sn,On,d,{size:4,value:0,key:5,width:1,height:2})}}function Fn(e){let t,n,o,i;return{c(){t=I("input"),E(t,"style",n=`\n    --inputWidth: ${e[5]};\n    --thumbSize: ${e[6]};\n    --trackSize: ${e[7]};\n  `),E(t,"type","range"),t.readOnly=e[1],E(t,"min",e[3]),E(t,"max",e[2]),E(t,"step",e[4]),E(t,"class","svelte-lc7qyp")},m(n,r){_(n,t,r),R(t,e[0]),o||(i=[F(t,"change",e[9]),F(t,"input",e[9]),F(t,"change",e[8])],o=!0)},p(e,[o]){224&o&&n!==(n=`\n    --inputWidth: ${e[5]};\n    --thumbSize: ${e[6]};\n    --trackSize: ${e[7]};\n  `)&&E(t,"style",n),2&o&&(t.readOnly=e[1]),8&o&&E(t,"min",e[3]),4&o&&E(t,"max",e[2]),16&o&&E(t,"step",e[4]),1&o&&R(t,e[0])},i:r,o:r,d(e){e&&z(t),o=!1,c(i)}}}function En(e,t,n){let{value:o}=t,{readonly:r=!1}=t,{max:i=0}=t,{min:l=100}=t,{step:s=1}=t,{width:a="auto"}=t,{thumbSize:c="16px"}=t,{trackSize:$="2px"}=t;return e.$$set=e=>{"value"in e&&n(0,o=e.value),"readonly"in e&&n(1,r=e.readonly),"max"in e&&n(2,i=e.max),"min"in e&&n(3,l=e.min),"step"in e&&n(4,s=e.step),"width"in e&&n(5,a=e.width),"thumbSize"in e&&n(6,c=e.thumbSize),"trackSize"in e&&n(7,$=e.trackSize)},[o,r,i,l,s,a,c,$,function(t){G.call(this,e,t)},function(){o=function(e){return""===e?null:+e}(this.value),n(0,o)}]}class Pn extends Ve{constructor(e){super(),He(this,e,En,Fn,d,{value:0,readonly:1,max:2,min:3,step:4,width:5,thumbSize:6,trackSize:7})}}function Rn(e){let t,n,o,r,i,l,s,a;const $=e[7].default,d=m($,e,e[6],null);return{c(){t=I("div"),d&&d.c(),n=S(),o=I("input"),E(o,"style",r=`\n      --inputWidth: ${e[2]};\n    `),E(o,"type","text"),E(o,"placeholder",e[3]),E(o,"class","svelte-d03xai"),E(t,"class",i=b(""+(e[1]?"":"input_error"))+" svelte-d03xai")},m(r,i){_(r,t,i),d&&d.m(t,null),B(t,n),B(t,o),R(o,e[0]),l=!0,s||(a=[F(o,"input",e[8]),F(o,"change",e[4]),F(o,"focusout",e[4])],s=!0)},p(e,[n]){d&&d.p&&(!l||64&n)&&x(d,$,e,e[6],l?v($,e[6],n,null):w(e[6]),null),(!l||4&n&&r!==(r=`\n      --inputWidth: ${e[2]};\n    `))&&E(o,"style",r),(!l||8&n)&&E(o,"placeholder",e[3]),1&n&&o.value!==e[0]&&R(o,e[0]),(!l||2&n&&i!==(i=b(""+(e[1]?"":"input_error"))+" svelte-d03xai"))&&E(t,"class",i)},i(e){l||($e(d,e),l=!0)},o(e){de(d,e),l=!1},d(e){e&&z(t),d&&d.d(e),s=!1,c(a)}}}function Dn(e,t,n){let{$$slots:o={},$$scope:r}=t,{value:i}=t,{width:l="auto"}=t,{placeholder:s=""}=t,{isValidValue:a=!0}=t,{validator:c=(e=>!0)}=t;return e.$$set=e=>{"value"in e&&n(0,i=e.value),"width"in e&&n(2,l=e.width),"placeholder"in e&&n(3,s=e.placeholder),"isValidValue"in e&&n(1,a=e.isValidValue),"validator"in e&&n(5,c=e.validator),"$$scope"in e&&n(6,r=e.$$scope)},[i,a,l,s,function(){n(1,a=c(i))},c,r,o,function(){i=this.value,n(0,i)}]}let jn=class extends Ve{constructor(e){super(),He(this,e,Dn,Rn,d,{value:0,width:2,placeholder:3,isValidValue:1,validator:5})}};function Nn(e){let t,n,o,i,l,s,a,$,d;return{c(){t=I("div"),n=I("label"),o=I("input"),i=S(),l=I("span"),s=O(e[1]),E(o,"type","checkbox"),E(o,"class","svelte-8xyll0"),E(l,"class","svelte-8xyll0"),E(n,"class","svelte-8xyll0"),E(t,"style",a=`\n    --checkSize: ${e[2]};\n    --checkWidth: ${e[3]};\n    --checkBorder: ${e[4]};\n  `),E(t,"class","svelte-8xyll0")},m(r,a){_(r,t,a),B(t,n),B(n,o),o.checked=e[0],B(n,i),B(n,l),B(l,s),$||(d=[F(o,"change",e[5]),F(o,"change",e[6])],$=!0)},p(e,[n]){1&n&&(o.checked=e[0]),2&n&&P(s,e[1]),28&n&&a!==(a=`\n    --checkSize: ${e[2]};\n    --checkWidth: ${e[3]};\n    --checkBorder: ${e[4]};\n  `)&&E(t,"style",a)},i:r,o:r,d(e){e&&z(t),$=!1,c(d)}}}function Un(e,t,n){let{text:o}=t,{checked:r}=t,{checkSize:i="14px"}=t,{checkWidth:l="30px"}=t,{checkBorder:s="1px"}=t;return e.$$set=e=>{"text"in e&&n(1,o=e.text),"checked"in e&&n(0,r=e.checked),"checkSize"in e&&n(2,i=e.checkSize),"checkWidth"in e&&n(3,l=e.checkWidth),"checkBorder"in e&&n(4,s=e.checkBorder)},[r,o,i,l,s,function(t){G.call(this,e,t)},function(){r=this.checked,n(0,r)}]}class qn extends Ve{constructor(e){super(),He(this,e,Un,Nn,d,{text:1,checked:0,checkSize:2,checkWidth:3,checkBorder:4})}}function Gn(e,t,n){const o=e.slice();return o[11]=t[n],o[12]=t,o[13]=n,o}function Wn(e,t){let n,o,r,i,s;function a(){return t[8](t[11])}function c(){return t[9](t[11])}const $=[{text:t[11].text},t[11].itemArgs,{onItemRemoveClick:a},{onItemClick:c}];function d(e){t[10](e,t[11])}var f=t[11].item;function u(e,t){let n={};for(let e=0;e<$.length;e+=1)n=l(n,$[e]);return void 0!==t&&193&t&&(n=l(n,Ce($,[1&t&&{text:e[11].text},1&t&&me(e[11].itemArgs),129&t&&{onItemRemoveClick:a},65&t&&{onItemClick:c}]))),void 0!==e[11].disabled&&(n.disabled=e[11].disabled),{props:n}}return f&&(o=D(f,u(t)),X.push((()=>he(o,"disabled",d)))),{key:e,first:null,c(){n=A(),o&&ve(o.$$.fragment),i=A(),this.first=n},m(e,t){_(e,n,t),o&&xe(o,e,t),_(e,i,t),s=!0},p(e,n){if(t=e,1&n&&f!==(f=t[11].item)){if(o){ae();const e=o;de(e.$$.fragment,1,0,(()=>{we(e,1)})),ce()}f?(o=D(f,u(t,n)),X.push((()=>he(o,"disabled",d))),ve(o.$$.fragment),$e(o.$$.fragment,1),xe(o,i.parentNode,i)):o=null}else if(f){const e=193&n?Ce($,[1&n&&{text:t[11].text},1&n&&me(t[11].itemArgs),129&n&&{onItemRemoveClick:a},65&n&&{onItemClick:c}]):{};!r&&1&n&&(r=!0,e.disabled=t[11].disabled,te((()=>r=!1))),o.$set(e)}},i(e){s||(o&&$e(o.$$.fragment,e),s=!0)},o(e){o&&de(o.$$.fragment,e),s=!1},d(e){e&&(z(n),z(i)),o&&we(o,e)}}}function Xn(e){let t,n,o,r=[],i=new Map,l=fe(e[0]);const s=e=>e[11].id;for(let t=0;t<l.length;t+=1){let n=Gn(e,l,t),o=s(n);i.set(o,r[t]=Wn(o,n))}return{c(){t=I("div");for(let e=0;e<r.length;e+=1)r[e].c();E(t,"style",n=`\n  --width: ${e[1]};\n  --height: ${e[2]};\n  --border: ${e[3]};\n  --padding: ${e[4]};\n  --bradius: ${e[5]};\n`),E(t,"class","svelte-cj2evj")},m(e,n){_(e,t,n);for(let e=0;e<r.length;e+=1)r[e]&&r[e].m(t,null);o=!0},p(e,[a]){193&a&&(l=fe(e[0]),ae(),r=ge(r,a,s,1,e,l,i,t,pe,Wn,null,Gn),ce()),(!o||62&a&&n!==(n=`\n  --width: ${e[1]};\n  --height: ${e[2]};\n  --border: ${e[3]};\n  --padding: ${e[4]};\n  --bradius: ${e[5]};\n`))&&E(t,"style",n)},i(e){if(!o){for(let e=0;e<l.length;e+=1)$e(r[e]);o=!0}},o(e){for(let e=0;e<r.length;e+=1)de(r[e]);o=!1},d(e){e&&z(t);for(let e=0;e<r.length;e+=1)r[e].d()}}}function Yn(e,t,n){let{items:o=[]}=t,{width:r="auto"}=t,{height:i="auto"}=t,{border:l="1px solid var(--borders)"}=t,{padding:s="8px 8px 8px 16px"}=t,{bradius:a="3px"}=t,{onItemClick:c=(e=>{})}=t,{onItemRemoveClick:$=(e=>{})}=t;return e.$$set=e=>{"items"in e&&n(0,o=e.items),"width"in e&&n(1,r=e.width),"height"in e&&n(2,i=e.height),"border"in e&&n(3,l=e.border),"padding"in e&&n(4,s=e.padding),"bradius"in e&&n(5,a=e.bradius),"onItemClick"in e&&n(6,c=e.onItemClick),"onItemRemoveClick"in e&&n(7,$=e.onItemRemoveClick)},[o,r,i,l,s,a,c,$,e=>{$(e)},e=>{c(e)},function(t,r){e.$$.not_equal(r.disabled,t)&&(r.disabled=t,n(0,o))}]}class Jn extends Ve{constructor(e){super(),He(this,e,Yn,Xn,d,{items:0,width:1,height:2,border:3,padding:4,bradius:5,onItemClick:6,onItemRemoveClick:7})}}const Kn=function(){const{subscribe:e,update:t,set:n}=ye({});let o=0;return{update:t,subscribe:e,createId:()=>o++,set:(e,n)=>t((t=>(t[e]=n,t)))}}();function Qn(e,t,n){const o=e.slice();return o[13]=t[n],o}function eo(e,t){let n,o,r,i;const s=[{isActive:t[13].id===t[7][t[8]]},{text:t[13].text},t[13].itemArgs];function a(){return t[12](t[13])}var c=t[13].item;function $(e,t){let n={};for(let e=0;e<s.length;e+=1)n=l(n,s[e]);return void 0!==t&&386&t&&(n=l(n,Ce(s,[{isActive:e[13].id===e[7][e[8]]},2&t&&{text:e[13].text},2&t&&me(e[13].itemArgs)]))),{props:n}}return c&&(o=D(c,$(t)),o.$on("mouseup",a)),{key:e,first:null,c(){n=A(),o&&ve(o.$$.fragment),r=A(),this.first=n},m(e,t){_(e,n,t),o&&xe(o,e,t),_(e,r,t),i=!0},p(e,n){if(t=e,2&n&&c!==(c=t[13].item)){if(o){ae();const e=o;de(e.$$.fragment,1,0,(()=>{we(e,1)})),ce()}c?(o=D(c,$(t,n)),o.$on("mouseup",a),ve(o.$$.fragment),$e(o.$$.fragment,1),xe(o,r.parentNode,r)):o=null}else if(c){const e=386&n?Ce(s,[{isActive:t[13].id===t[7][t[8]]},2&n&&{text:t[13].text},2&n&&me(t[13].itemArgs)]):{};o.$set(e)}},i(e){i||(o&&$e(o.$$.fragment,e),i=!0)},o(e){o&&de(o.$$.fragment,e),i=!1},d(e){e&&(z(n),z(r)),o&&we(o,e)}}}function to(e){let t,n,o,r,i,l=[],s=new Map,a=fe(e[1]);const $=e=>e[13].id;for(let t=0;t<a.length;t+=1){let n=Qn(e,a,t),o=$(n);s.set(o,l[t]=eo(o,n))}return{c(){t=I("div");for(let e=0;e<l.length;e+=1)l[e].c();E(t,"style",n=`\n    --padding: ${e[2]};\n    --flex-direction: ${e[3]};\n    --normal-bg-color: ${e[5]};\n    --normal-fg-color: ${e[4]};\n  `),E(t,"class","svelte-nzyp77")},m(n,s){_(n,t,s);for(let e=0;e<l.length;e+=1)l[e]&&l[e].m(t,null);o=!0,r||(i=[F(t,"mousedown",e[10],!0),F(t,"mouseup",e[11],!0)],r=!0)},p(e,[r]){451&r&&(a=fe(e[1]),ae(),l=ge(l,r,$,1,e,a,s,t,pe,eo,null,Qn),ce()),(!o||60&r&&n!==(n=`\n    --padding: ${e[2]};\n    --flex-direction: ${e[3]};\n    --normal-bg-color: ${e[5]};\n    --normal-fg-color: ${e[4]};\n  `))&&E(t,"style",n)},i(e){if(!o){for(let e=0;e<a.length;e+=1)$e(l[e]);o=!0}},o(e){for(let e=0;e<l.length;e+=1)de(l[e]);o=!1},d(e){e&&z(t);for(let e=0;e<l.length;e+=1)l[e].d();r=!1,c(i)}}}function no(e,t,n){let o;C(e,Kn,(e=>n(7,o=e)));let{items:r=[]}=t,{currentId:i=""}=t,{initItemId:l}=t,{padding:s="inherit"}=t,{flexDirection:a="row"}=t,{normalFgColor:c="var(--fg-header)"}=t,{normalBgColor:$="inherit"}=t,{onItemClick:d=(e=>{})}=t;const f=r.map((e=>e.id)).join(".");l&&(Kn.set(f,l),i=l);return e.$$set=e=>{"items"in e&&n(1,r=e.items),"currentId"in e&&n(0,i=e.currentId),"initItemId"in e&&n(9,l=e.initItemId),"padding"in e&&n(2,s=e.padding),"flexDirection"in e&&n(3,a=e.flexDirection),"normalFgColor"in e&&n(4,c=e.normalFgColor),"normalBgColor"in e&&n(5,$=e.normalBgColor),"onItemClick"in e&&n(6,d=e.onItemClick)},e.$$.update=()=>{1&e.$$.dirty&&Kn.set(f,i)},[i,r,s,a,c,$,d,o,f,l,function(t){G.call(this,e,t)},function(t){G.call(this,e,t)},e=>{n(0,i=e.id),Kn.set(f,e.id),d(e)}]}class oo extends Ve{constructor(e){super(),He(this,e,no,to,d,{items:1,currentId:0,initItemId:9,padding:2,flexDirection:3,normalFgColor:4,normalBgColor:5,onItemClick:6})}}function ro(e){let t,n,o,i,l,s;return{c(){t=I("span"),n=O(e[0]),E(t,"class",o=b(e[11]?"active":"")+" svelte-6v1blh"),E(t,"style",i=`\n    --width: ${e[2]};\n    --height: ${e[3]};\n    --padding: ${e[4]};\n    --border-radius: ${e[1]};\n    --normal-fg-color: ${e[5]};\n    --normal-bg-color: ${e[6]};\n    --hover-fg-color: ${e[9]};\n    --hover-bg-color: ${e[10]};\n    --active-fg-color: ${e[7]};\n    --active-bg-color: ${e[8]};\n  `)},m(o,r){_(o,t,r),B(t,n),l||(s=[F(t,"mousedown",e[12],!0),F(t,"mouseup",e[13],!0)],l=!0)},p(e,[r]){1&r&&P(n,e[0]),2048&r&&o!==(o=b(e[11]?"active":"")+" svelte-6v1blh")&&E(t,"class",o),2046&r&&i!==(i=`\n    --width: ${e[2]};\n    --height: ${e[3]};\n    --padding: ${e[4]};\n    --border-radius: ${e[1]};\n    --normal-fg-color: ${e[5]};\n    --normal-bg-color: ${e[6]};\n    --hover-fg-color: ${e[9]};\n    --hover-bg-color: ${e[10]};\n    --active-fg-color: ${e[7]};\n    --active-bg-color: ${e[8]};\n  `)&&E(t,"style",i)},i:r,o:r,d(e){e&&z(t),l=!1,c(s)}}}function io(e,t,n){let{text:o}=t,{round:r=0}=t,{width:i="inherit"}=t,{height:l="inherit"}=t,{padding:s="inherit"}=t,{normalFgColor:a="var(--text)"}=t,{normalBgColor:c="transparent"}=t,{activeFgColor:$="var(--text-active)"}=t,{activeBgColor:d="transparent"}=t,{hoverFgColor:f="var(--text-active)"}=t,{hoverBgColor:u="transparent"}=t,{isActive:p=!1}=t;return e.$$set=e=>{"text"in e&&n(0,o=e.text),"round"in e&&n(1,r=e.round),"width"in e&&n(2,i=e.width),"height"in e&&n(3,l=e.height),"padding"in e&&n(4,s=e.padding),"normalFgColor"in e&&n(5,a=e.normalFgColor),"normalBgColor"in e&&n(6,c=e.normalBgColor),"activeFgColor"in e&&n(7,$=e.activeFgColor),"activeBgColor"in e&&n(8,d=e.activeBgColor),"hoverFgColor"in e&&n(9,f=e.hoverFgColor),"hoverBgColor"in e&&n(10,u=e.hoverBgColor),"isActive"in e&&n(11,p=e.isActive)},[o,r,i,l,s,a,c,$,d,f,u,p,function(t){G.call(this,e,t)},function(t){G.call(this,e,t)}]}class lo extends Ve{constructor(e){super(),He(this,e,io,ro,d,{text:0,round:1,width:2,height:3,padding:4,normalFgColor:5,normalBgColor:6,activeFgColor:7,activeBgColor:8,hoverFgColor:9,hoverBgColor:10,isActive:11})}}function so(e){let t,n,o;const r=e[10].default,i=m(r,e,e[9],null);return{c(){t=I("span"),i&&i.c(),E(t,"style",n=`\n    --size: ${e[6]};\n    --width: ${e[1]};\n    --color: ${e[0]};\n    --padding: ${e[2]};\n    --overflow: ${e[4]};\n    --whiteSpace: ${e[3]};\n    --textOverflow: ${e[5]};\n  `),E(t,"class","svelte-96vfu")},m(e,n){_(e,t,n),i&&i.m(t,null),o=!0},p(e,[l]){i&&i.p&&(!o||512&l)&&x(i,r,e,e[9],o?v(r,e[9],l,null):w(e[9]),null),(!o||127&l&&n!==(n=`\n    --size: ${e[6]};\n    --width: ${e[1]};\n    --color: ${e[0]};\n    --padding: ${e[2]};\n    --overflow: ${e[4]};\n    --whiteSpace: ${e[3]};\n    --textOverflow: ${e[5]};\n  `))&&E(t,"style",n)},i(e){o||($e(i,e),o=!0)},o(e){de(i,e),o=!1},d(e){e&&z(t),i&&i.d(e)}}}function ao(e,t,n){let{$$slots:o={},$$scope:r}=t,{width:i="auto"}=t,{padding:l="auto"}=t,{whiteSpace:s="nowrap"}=t,{overflow:a="auto"}=t,{textOverflow:c="auto"}=t,{size:$="auto"}=t,{color:d="var(--text)"}=t,{disabledColor:f="var(--text-disabled)"}=t,{disabled:u=!1}=t;return"boolean"==typeof u&&u&&(d=f),e.$$set=e=>{"width"in e&&n(1,i=e.width),"padding"in e&&n(2,l=e.padding),"whiteSpace"in e&&n(3,s=e.whiteSpace),"overflow"in e&&n(4,a=e.overflow),"textOverflow"in e&&n(5,c=e.textOverflow),"size"in e&&n(6,$=e.size),"color"in e&&n(0,d=e.color),"disabledColor"in e&&n(7,f=e.disabledColor),"disabled"in e&&n(8,u=e.disabled),"$$scope"in e&&n(9,r=e.$$scope)},[d,i,l,s,a,c,$,f,u,r,o]}class co extends Ve{constructor(e){super(),He(this,e,ao,so,d,{width:1,padding:2,whiteSpace:3,overflow:4,textOverflow:5,size:6,color:0,disabledColor:7,disabled:8})}}function $o(e){let t,n,o;const r=e[2].default,i=m(r,e,e[1],null);return{c(){t=I("span"),i&&i.c(),E(t,"style",n=`\n    --padding: ${e[0]}\n  `),E(t,"class","svelte-1o6jylm")},m(e,n){_(e,t,n),i&&i.m(t,null),o=!0},p(e,[l]){i&&i.p&&(!o||2&l)&&x(i,r,e,e[1],o?v(r,e[1],l,null):w(e[1]),null),(!o||1&l&&n!==(n=`\n    --padding: ${e[0]}\n  `))&&E(t,"style",n)},i(e){o||($e(i,e),o=!0)},o(e){de(i,e),o=!1},d(e){e&&z(t),i&&i.d(e)}}}function fo(e,t,n){let{$$slots:o={},$$scope:r}=t,{padding:i="0 0 20px 0"}=t;return e.$$set=e=>{"padding"in e&&n(0,i=e.padding),"$$scope"in e&&n(1,r=e.$$scope)},[i,r,o]}class uo extends Ve{constructor(e){super(),He(this,e,fo,$o,d,{padding:0})}}function po(e){let t,n,o;const r=e[4].default,i=m(r,e,e[3],null);return{c(){t=I("div"),i&&i.c(),E(t,"style",n=`\n    --width: ${e[0]};\n    --height: ${e[1]};\n  `),E(t,"class","svelte-4a47fy")},m(e,n){_(e,t,n),i&&i.m(t,null),o=!0},p(e,[l]){i&&i.p&&(!o||8&l)&&x(i,r,e,e[3],o?v(r,e[3],l,null):w(e[3]),null),(!o||3&l&&n!==(n=`\n    --width: ${e[0]};\n    --height: ${e[1]};\n  `))&&E(t,"style",n)},i(e){o||($e(i,e),o=!0)},o(e){de(i,e),o=!1},d(e){e&&z(t),i&&i.d(e)}}}function go(e,t,n){let{$$slots:o={},$$scope:r}=t,{width:i}=t,{height:l}=t,{type:s="H"}=t;switch(s){case"H":i=i||"100%";break;case"V":l=l||"100%"}return e.$$set=e=>{"width"in e&&n(0,i=e.width),"height"in e&&n(1,l=e.height),"type"in e&&n(2,s=e.type),"$$scope"in e&&n(3,r=e.$$scope)},[i,l,s,r,o]}class Co extends Ve{constructor(e){super(),He(this,e,go,po,d,{width:0,height:1,type:2})}}const mo=e=>({}),ho=e=>({}),vo=e=>({}),xo=e=>({});function wo(e){let t,n,o,r,i,l,s,a,$,d;const f=e[17].popupButton,u=m(f,e,e[16],xo),p=e[17].popupBody,g=m(p,e,e[16],ho);return{c(){t=I("corner"),o=S(),r=I("div"),u&&u.c(),i=S(),l=I("popupBody"),g&&g.c(),E(t,"style",n=`\n    opacity: ${e[0]?1:0};\n    user-select: ${e[0]?"all":"none"};\n    z-index: ${e[0]?"9999":"-9999"};\n    left: ${e[3]-4}px;\n    top: ${e[2]}px;\n  `),E(t,"class","svelte-195280u"),E(l,"style",s=`\n    opacity: ${e[0]?1:0};\n    user-select: ${e[0]?"all":"none"};\n    z-index: ${e[0]?"9998":"-9999"};\n    left: ${e[1]}px;\n    top: ${e[2]+3}px;\n    --width: ${e[4]};\n    --height: ${e[5]};\n    --padding: ${e[6]};\n    --margin: ${e[7]};\n    --border: ${e[8]};\n    --bradius: ${e[9]};\n    --bgColor: ${e[10]};\n  `),E(l,"class","svelte-195280u")},m(n,s){_(n,t,s),e[18](t),_(n,o,s),_(n,r,s),u&&u.m(r,null),e[19](r),_(n,i,s),_(n,l,s),g&&g.m(l,null),e[20](l),a=!0,$||(d=[V(e[14].call(null,r)),V(e[15].call(null,l))],$=!0)},p(e,[o]){(!a||13&o&&n!==(n=`\n    opacity: ${e[0]?1:0};\n    user-select: ${e[0]?"all":"none"};\n    z-index: ${e[0]?"9999":"-9999"};\n    left: ${e[3]-4}px;\n    top: ${e[2]}px;\n  `))&&E(t,"style",n),u&&u.p&&(!a||65536&o)&&x(u,f,e,e[16],a?v(f,e[16],o,vo):w(e[16]),xo),g&&g.p&&(!a||65536&o)&&x(g,p,e,e[16],a?v(p,e[16],o,mo):w(e[16]),ho),(!a||2039&o&&s!==(s=`\n    opacity: ${e[0]?1:0};\n    user-select: ${e[0]?"all":"none"};\n    z-index: ${e[0]?"9998":"-9999"};\n    left: ${e[1]}px;\n    top: ${e[2]+3}px;\n    --width: ${e[4]};\n    --height: ${e[5]};\n    --padding: ${e[6]};\n    --margin: ${e[7]};\n    --border: ${e[8]};\n    --bradius: ${e[9]};\n    --bgColor: ${e[10]};\n  `))&&E(l,"style",s)},i(e){a||($e(u,e),$e(g,e),a=!0)},o(e){de(u,e),de(g,e),a=!1},d(n){n&&(z(t),z(o),z(r),z(i),z(l)),e[18](null),u&&u.d(n),e[19](null),g&&g.d(n),e[20](null),$=!1,c(d)}}}function bo(e,t,n){let o,r,i,{$$slots:l={},$$scope:s}=t,{width:a="auto"}=t,{height:c="auto"}=t,{padding:$="8px 0"}=t,{margin:d="0"}=t,{border:f="0"}=t,{bradius:u="2px"}=t,{bgColor:p="var(--bg-overlay)"}=t,{isOpen:g=!1}=t,{x:C=0}=t,{y:m=0}=t,{cornerX:h=0}=t;return e.$$set=e=>{"width"in e&&n(4,a=e.width),"height"in e&&n(5,c=e.height),"padding"in e&&n(6,$=e.padding),"margin"in e&&n(7,d=e.margin),"border"in e&&n(8,f=e.border),"bradius"in e&&n(9,u=e.bradius),"bgColor"in e&&n(10,p=e.bgColor),"isOpen"in e&&n(0,g=e.isOpen),"x"in e&&n(1,C=e.x),"y"in e&&n(2,m=e.y),"cornerX"in e&&n(3,h=e.cornerX),"$$scope"in e&&n(16,s=e.$$scope)},[g,C,m,h,a,c,$,d,f,u,p,o,r,i,function(e){const t=t=>{if(e&&e.contains(t.target)){const t=e.getBoundingClientRect(),o=i.getBoundingClientRect();n(0,g=!g),n(1,C=t.x-o.width/2),n(2,m=t.y+t.height),n(3,h=t.x+t.width/2)}};return document.addEventListener("click",t,!0),{destroy(){document.removeEventListener("click",t,!0)}}},function(e){const t=t=>{!e||e.contains(t.target)||r.contains(t.target)||t.defaultPrevented||n(0,g=!1)};return document.addEventListener("click",t,!0),{destroy(){document.removeEventListener("click",t,!0)}}},s,l,function(e){X[e?"unshift":"push"]((()=>{o=e,n(11,o)}))},function(e){X[e?"unshift":"push"]((()=>{r=e,n(12,r)}))},function(e){X[e?"unshift":"push"]((()=>{i=e,n(13,i)}))}]}class Ho extends Ve{constructor(e){super(),He(this,e,bo,wo,d,{width:4,height:5,padding:6,margin:7,border:8,bradius:9,bgColor:10,isOpen:0,x:1,y:2,cornerX:3})}}function Vo(e){let t,n;return t=new Dt({props:{color:"var(--text)",size:"16"}}),{c(){ve(t.$$.fragment)},m(e,o){xe(t,e,o),n=!0},p:r,i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){de(t.$$.fragment,e),n=!1},d(e){we(t,e)}}}function Lo(e){let t;return{c(){t=O(e[0])},m(e,n){_(e,t,n)},p(e,n){1&n&&P(t,e[0])},d(e){e&&z(t)}}}function yo(e){let t,n,o,r,i,l,s;return n=new Ye({props:{normalBgColor:"tarsparent",$$slots:{default:[Vo]},$$scope:{ctx:e}}}),n.$on("buttonClick",(function(){$(e[2])&&e[2].apply(this,arguments)})),r=new ut({props:{width:"10px"}}),l=new co({props:{$$slots:{default:[Lo]},$$scope:{ctx:e}}}),l.$on("mouseup",(function(){$(e[1])&&e[1].apply(this,arguments)})),{c(){t=I("div"),ve(n.$$.fragment),o=S(),ve(r.$$.fragment),i=S(),ve(l.$$.fragment),E(t,"class","svelte-1yxt3hn")},m(e,a){_(e,t,a),xe(n,t,null),B(t,o),xe(r,t,null),B(t,i),xe(l,t,null),s=!0},p(t,[o]){e=t;const r={};8&o&&(r.$$scope={dirty:o,ctx:e}),n.$set(r);const i={};9&o&&(i.$$scope={dirty:o,ctx:e}),l.$set(i)},i(e){s||($e(n.$$.fragment,e),$e(r.$$.fragment,e),$e(l.$$.fragment,e),s=!0)},o(e){de(n.$$.fragment,e),de(r.$$.fragment,e),de(l.$$.fragment,e),s=!1},d(e){e&&z(t),we(n),we(r),we(l)}}}function Mo(e,t,n){let{text:o}=t,{onItemClick:r=(()=>{})}=t,{onItemRemoveClick:i=(()=>{})}=t;return e.$$set=e=>{"text"in e&&n(0,o=e.text),"onItemClick"in e&&n(1,r=e.onItemClick),"onItemRemoveClick"in e&&n(2,i=e.onItemRemoveClick)},[o,r,i]}class Zo extends Ve{constructor(e){super(),He(this,e,Mo,yo,d,{text:0,onItemClick:1,onItemRemoveClick:2})}}function ko(e){let t,n,o;function r(t){e[2](t)}let i={};return void 0!==e[0].switch&&(i.value=e[0].switch),t=new jn({props:i}),X.push((()=>he(t,"value",r))),{c(){ve(t.$$.fragment)},m(e,n){xe(t,e,n),o=!0},p(e,o){const r={};!n&&1&o&&(n=!0,r.value=e[0].switch,te((()=>n=!1))),t.$set(r)},i(e){o||($e(t.$$.fragment,e),o=!0)},o(e){de(t.$$.fragment,e),o=!1},d(e){we(t,e)}}}function Bo(e){let t,n,o;function r(t){e[3](t)}let i={};return void 0!==e[0].value&&(i.value=e[0].value),t=new jn({props:i}),X.push((()=>he(t,"value",r))),{c(){ve(t.$$.fragment)},m(e,n){xe(t,e,n),o=!0},p(e,o){const r={};!n&&1&o&&(n=!0,r.value=e[0].value,te((()=>n=!1))),t.$set(r)},i(e){o||($e(t.$$.fragment,e),o=!0)},o(e){de(t.$$.fragment,e),o=!1},d(e){we(t,e)}}}function _o(e){let t,n;return t=new Ut({props:{color:"var(--text)",size:"16"}}),{c(){ve(t.$$.fragment)},m(e,o){xe(t,e,o),n=!0},p:r,i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){de(t.$$.fragment,e),n=!1},d(e){we(t,e)}}}function zo(e){let t,n,o,r,i,l,s,a,c,d,f,u,p;return n=new Ct({props:{grow:1,$$slots:{default:[ko]},$$scope:{ctx:e}}}),r=new ut({props:{width:"20px"}}),l=new Ct({props:{grow:1,$$slots:{default:[Bo]},$$scope:{ctx:e}}}),a=new ut({props:{width:"20px"}}),d=new Ye({props:{normalBgColor:"tarsparent",$$slots:{default:[_o]},$$scope:{ctx:e}}}),d.$on("buttonClick",(function(){$(e[1])&&e[1].apply(this,arguments)})),u=new ut({props:{width:"20px"}}),{c(){t=I("div"),ve(n.$$.fragment),o=S(),ve(r.$$.fragment),i=S(),ve(l.$$.fragment),s=S(),ve(a.$$.fragment),c=S(),ve(d.$$.fragment),f=S(),ve(u.$$.fragment),E(t,"class","svelte-1yxt3hn")},m(e,$){_(e,t,$),xe(n,t,null),B(t,o),xe(r,t,null),B(t,i),xe(l,t,null),B(t,s),xe(a,t,null),B(t,c),xe(d,t,null),B(t,f),xe(u,t,null),p=!0},p(t,[o]){e=t;const r={};17&o&&(r.$$scope={dirty:o,ctx:e}),n.$set(r);const i={};17&o&&(i.$$scope={dirty:o,ctx:e}),l.$set(i);const s={};16&o&&(s.$$scope={dirty:o,ctx:e}),d.$set(s)},i(e){p||($e(n.$$.fragment,e),$e(r.$$.fragment,e),$e(l.$$.fragment,e),$e(a.$$.fragment,e),$e(d.$$.fragment,e),$e(u.$$.fragment,e),p=!0)},o(e){de(n.$$.fragment,e),de(r.$$.fragment,e),de(l.$$.fragment,e),de(a.$$.fragment,e),de(d.$$.fragment,e),de(u.$$.fragment,e),p=!1},d(e){e&&z(t),we(n),we(r),we(l),we(a),we(d),we(u)}}}function Io(e,t,n){let{item:o}=t,{onItemRemoveClick:r=(()=>{})}=t;return e.$$set=e=>{"item"in e&&n(0,o=e.item),"onItemRemoveClick"in e&&n(1,r=e.onItemRemoveClick)},[o,r,function(t){e.$$.not_equal(o.switch,t)&&(o.switch=t,n(0,o))},function(t){e.$$.not_equal(o.value,t)&&(o.value=t,n(0,o))}]}class To extends Ve{constructor(e){super(),He(this,e,Io,zo,d,{item:0,onItemRemoveClick:1})}}function Oo(e){let t;return{c(){t=O("Scale UI")},m(e,n){_(e,t,n)},d(e){e&&z(t)}}}function So(e){let t,n,o=Math.floor(100*e[1].ui.scaleFigmaUI)+"";return{c(){t=O(o),n=O("%")},m(e,o){_(e,t,o),_(e,n,o)},p(e,n){2&n&&o!==(o=Math.floor(100*e[1].ui.scaleFigmaUI)+"")&&P(t,o)},d(e){e&&(z(t),z(n))}}}function Ao(e){let t,n;return t=new co({props:{padding:"8px 0 0 0",$$slots:{default:[So]},$$scope:{ctx:e}}}),{c(){ve(t.$$.fragment)},m(e,o){xe(t,e,o),n=!0},p(e,n){const o={};4194306&n&&(o.$$scope={dirty:n,ctx:e}),t.$set(o)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){de(t.$$.fragment,e),n=!1},d(e){we(t,e)}}}function Fo(e){let t,n,o,r,i,l,s;function a(t){e[13](t)}t=new uo({props:{$$slots:{default:[Oo]},$$scope:{ctx:e}}});let c={min:.5,max:1.5,step:.05};return void 0!==e[1].ui.scaleFigmaUI&&(c.value=e[1].ui.scaleFigmaUI),o=new Pn({props:c}),X.push((()=>he(o,"value",a))),l=new ut({props:{der:"column",alignItems:"center",justifyContent:"center",$$slots:{default:[Ao]},$$scope:{ctx:e}}}),{c(){ve(t.$$.fragment),n=S(),ve(o.$$.fragment),i=S(),ve(l.$$.fragment)},m(e,r){xe(t,e,r),_(e,n,r),xe(o,e,r),_(e,i,r),xe(l,e,r),s=!0},p(e,n){const i={};4194304&n&&(i.$$scope={dirty:n,ctx:e}),t.$set(i);const s={};!r&&2&n&&(r=!0,s.value=e[1].ui.scaleFigmaUI,te((()=>r=!1))),o.$set(s);const a={};4194306&n&&(a.$$scope={dirty:n,ctx:e}),l.$set(a)},i(e){s||($e(t.$$.fragment,e),$e(o.$$.fragment,e),$e(l.$$.fragment,e),s=!0)},o(e){de(t.$$.fragment,e),de(o.$$.fragment,e),de(l.$$.fragment,e),s=!1},d(e){e&&(z(n),z(i)),we(t,e),we(o,e),we(l,e)}}}function Eo(e){let t;return{c(){t=O("Scale Tabs")},m(e,n){_(e,t,n)},d(e){e&&z(t)}}}function Po(e){let t,n,o=Math.floor(100*e[1].ui.scalePanel)+"";return{c(){t=O(o),n=O("%")},m(e,o){_(e,t,o),_(e,n,o)},p(e,n){2&n&&o!==(o=Math.floor(100*e[1].ui.scalePanel)+"")&&P(t,o)},d(e){e&&(z(t),z(n))}}}function Ro(e){let t,n;return t=new co({props:{padding:"8px 0 0 0",$$slots:{default:[Po]},$$scope:{ctx:e}}}),{c(){ve(t.$$.fragment)},m(e,o){xe(t,e,o),n=!0},p(e,n){const o={};4194306&n&&(o.$$scope={dirty:n,ctx:e}),t.$set(o)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){de(t.$$.fragment,e),n=!1},d(e){we(t,e)}}}function Do(e){let t,n,o,r,i,l,s;function a(t){e[14](t)}t=new uo({props:{$$slots:{default:[Eo]},$$scope:{ctx:e}}});let c={min:.5,max:1.5,step:.05};return void 0!==e[1].ui.scalePanel&&(c.value=e[1].ui.scalePanel),o=new Pn({props:c}),X.push((()=>he(o,"value",a))),l=new ut({props:{der:"column",alignItems:"center",justifyContent:"center",$$slots:{default:[Ro]},$$scope:{ctx:e}}}),{c(){ve(t.$$.fragment),n=S(),ve(o.$$.fragment),i=S(),ve(l.$$.fragment)},m(e,r){xe(t,e,r),_(e,n,r),xe(o,e,r),_(e,i,r),xe(l,e,r),s=!0},p(e,n){const i={};4194304&n&&(i.$$scope={dirty:n,ctx:e}),t.$set(i);const s={};!r&&2&n&&(r=!0,s.value=e[1].ui.scalePanel,te((()=>r=!1))),o.$set(s);const a={};4194306&n&&(a.$$scope={dirty:n,ctx:e}),l.$set(a)},i(e){s||($e(t.$$.fragment,e),$e(o.$$.fragment,e),$e(l.$$.fragment,e),s=!0)},o(e){de(t.$$.fragment,e),de(o.$$.fragment,e),de(l.$$.fragment,e),s=!1},d(e){e&&(z(n),z(i)),we(t,e),we(o,e),we(l,e)}}}function jo(e){let t,n,o,r,i,l;return t=new ut({props:{der:"column",width:"-webkit-fill-available",$$slots:{default:[Fo]},$$scope:{ctx:e}}}),o=new ut({props:{width:"120px"}}),i=new ut({props:{der:"column",width:"-webkit-fill-available",$$slots:{default:[Do]},$$scope:{ctx:e}}}),{c(){ve(t.$$.fragment),n=S(),ve(o.$$.fragment),r=S(),ve(i.$$.fragment)},m(e,s){xe(t,e,s),_(e,n,s),xe(o,e,s),_(e,r,s),xe(i,e,s),l=!0},p(e,n){const o={};4194306&n&&(o.$$scope={dirty:n,ctx:e}),t.$set(o);const r={};4194306&n&&(r.$$scope={dirty:n,ctx:e}),i.$set(r)},i(e){l||($e(t.$$.fragment,e),$e(o.$$.fragment,e),$e(i.$$.fragment,e),l=!0)},o(e){de(t.$$.fragment,e),de(o.$$.fragment,e),de(i.$$.fragment,e),l=!1},d(e){e&&(z(n),z(r)),we(t,e),we(o,e),we(i,e)}}}function No(e){let t;return{c(){t=O("Main settings")},m(e,n){_(e,t,n)},d(e){e&&z(t)}}}function Uo(e){let t,n,o,r,i,l,s,a,c,$,d,f,u,p,g,C,m,h,v,x;function w(t){e[15](t)}t=new uo({props:{$$slots:{default:[No]},$$scope:{ctx:e}}});let b={text:"Save the last opened tabs"};function H(t){e[16](t)}void 0!==e[1].app.saveLastOpenedTabs&&(b.checked=e[1].app.saveLastOpenedTabs),o=new qn({props:b}),X.push((()=>he(o,"checked",w)));let V={text:"Enable color space sRGB"};function L(t){e[17](t)}void 0!==e[1].app.enableColorSpaceSrgb&&(V.checked=e[1].app.enableColorSpaceSrgb),l=new qn({props:V}),X.push((()=>he(l,"checked",H)));let y={text:"Show new project button"};function M(t){e[18](t)}void 0!==e[1].app.visibleNewProjectBtn&&(y.checked=e[1].app.visibleNewProjectBtn),c=new qn({props:y}),X.push((()=>he(c,"checked",L)));let Z={text:"Use Zenity for Dialogs"};function k(t){e[19](t)}void 0!==e[1].app.useZenity&&(Z.checked=e[1].app.useZenity),f=new qn({props:Z}),X.push((()=>he(f,"checked",M)));let B={text:"Use old Previewer in ThemeCreator"};function I(t){e[20](t)}void 0!==e[1].app.useOldPreviewer&&(B.checked=e[1].app.useOldPreviewer),g=new qn({props:B}),X.push((()=>he(g,"checked",k)));let T={text:"Disable themes"};return void 0!==e[1].app.disableThemes&&(T.checked=e[1].app.disableThemes),h=new qn({props:T}),X.push((()=>he(h,"checked",I))),{c(){ve(t.$$.fragment),n=S(),ve(o.$$.fragment),i=S(),ve(l.$$.fragment),a=S(),ve(c.$$.fragment),d=S(),ve(f.$$.fragment),p=S(),ve(g.$$.fragment),m=S(),ve(h.$$.fragment)},m(e,r){xe(t,e,r),_(e,n,r),xe(o,e,r),_(e,i,r),xe(l,e,r),_(e,a,r),xe(c,e,r),_(e,d,r),xe(f,e,r),_(e,p,r),xe(g,e,r),_(e,m,r),xe(h,e,r),x=!0},p(e,n){const i={};4194304&n&&(i.$$scope={dirty:n,ctx:e}),t.$set(i);const a={};!r&&2&n&&(r=!0,a.checked=e[1].app.saveLastOpenedTabs,te((()=>r=!1))),o.$set(a);const d={};!s&&2&n&&(s=!0,d.checked=e[1].app.enableColorSpaceSrgb,te((()=>s=!1))),l.$set(d);const p={};!$&&2&n&&($=!0,p.checked=e[1].app.visibleNewProjectBtn,te((()=>$=!1))),c.$set(p);const m={};!u&&2&n&&(u=!0,m.checked=e[1].app.useZenity,te((()=>u=!1))),f.$set(m);const x={};!C&&2&n&&(C=!0,x.checked=e[1].app.useOldPreviewer,te((()=>C=!1))),g.$set(x);const w={};!v&&2&n&&(v=!0,w.checked=e[1].app.disableThemes,te((()=>v=!1))),h.$set(w)},i(e){x||($e(t.$$.fragment,e),$e(o.$$.fragment,e),$e(l.$$.fragment,e),$e(c.$$.fragment,e),$e(f.$$.fragment,e),$e(g.$$.fragment,e),$e(h.$$.fragment,e),x=!0)},o(e){de(t.$$.fragment,e),de(o.$$.fragment,e),de(l.$$.fragment,e),de(c.$$.fragment,e),de(f.$$.fragment,e),de(g.$$.fragment,e),de(h.$$.fragment,e),x=!1},d(e){e&&(z(n),z(i),z(a),z(d),z(p),z(m)),we(t,e),we(o,e),we(l,e),we(c,e),we(f,e),we(g,e),we(h,e)}}}function qo(e){let t;return{c(){t=O("Export files to")},m(e,n){_(e,t,n)},d(e){e&&z(t)}}}function Go(e){let t,n;return t=new on({props:{color:"var(--text)",size:"18"}}),{c(){ve(t.$$.fragment)},m(e,o){xe(t,e,o),n=!0},p:r,i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){de(t.$$.fragment,e),n=!1},d(e){we(t,e)}}}function Wo(e){let t,n;return t=new Ye({props:{normalBgColor:"tarsparent",$$slots:{default:[Go]},$$scope:{ctx:e}}}),t.$on("buttonClick",e[5]),{c(){ve(t.$$.fragment)},m(e,o){xe(t,e,o),n=!0},p(e,n){const o={};4194304&n&&(o.$$scope={dirty:n,ctx:e}),t.$set(o)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){de(t.$$.fragment,e),n=!1},d(e){we(t,e)}}}function Xo(e){let t,n,o;function r(t){e[21](t)}let i={$$slots:{default:[Wo]},$$scope:{ctx:e}};return void 0!==e[1].app.exportDir&&(i.value=e[1].app.exportDir),t=new jn({props:i}),X.push((()=>he(t,"value",r))),{c(){ve(t.$$.fragment)},m(e,n){xe(t,e,n),o=!0},p(e,o){const r={};4194304&o&&(r.$$scope={dirty:o,ctx:e}),!n&&2&o&&(n=!0,r.value=e[1].app.exportDir,te((()=>n=!1))),t.$set(r)},i(e){o||($e(t.$$.fragment,e),o=!0)},o(e){de(t.$$.fragment,e),o=!1},d(e){we(t,e)}}}function Yo(e){let t;return{c(){t=O("Change")},m(e,n){_(e,t,n)},d(e){e&&z(t)}}}function Jo(e){let t,n,o,r,i,l;return t=new Ct({props:{grow:1,$$slots:{default:[Xo]},$$scope:{ctx:e}}}),o=new ut({props:{width:"20px"}}),i=new rt({props:{$$slots:{default:[Yo]},$$scope:{ctx:e}}}),i.$on("buttonClick",e[5]),{c(){ve(t.$$.fragment),n=S(),ve(o.$$.fragment),r=S(),ve(i.$$.fragment)},m(e,s){xe(t,e,s),_(e,n,s),xe(o,e,s),_(e,r,s),xe(i,e,s),l=!0},p(e,n){const o={};4194306&n&&(o.$$scope={dirty:n,ctx:e}),t.$set(o);const r={};4194304&n&&(r.$$scope={dirty:n,ctx:e}),i.$set(r)},i(e){l||($e(t.$$.fragment,e),$e(o.$$.fragment,e),$e(i.$$.fragment,e),l=!0)},o(e){de(t.$$.fragment,e),de(o.$$.fragment,e),de(i.$$.fragment,e),l=!1},d(e){e&&(z(n),z(r)),we(t,e),we(o,e),we(i,e)}}}function Ko(e){let t,n,o,r;return t=new uo({props:{$$slots:{default:[qo]},$$scope:{ctx:e}}}),o=new ut({props:{$$slots:{default:[Jo]},$$scope:{ctx:e}}}),{c(){ve(t.$$.fragment),n=S(),ve(o.$$.fragment)},m(e,i){xe(t,e,i),_(e,n,i),xe(o,e,i),r=!0},p(e,n){const r={};4194304&n&&(r.$$scope={dirty:n,ctx:e}),t.$set(r);const i={};4194306&n&&(i.$$scope={dirty:n,ctx:e}),o.$set(i)},i(e){r||($e(t.$$.fragment,e),$e(o.$$.fragment,e),r=!0)},o(e){de(t.$$.fragment,e),de(o.$$.fragment,e),r=!1},d(e){e&&z(n),we(t,e),we(o,e)}}}function Qo(e){let t,n,o,r,i,l;return t=new ut({props:{der:"column",width:"-webkit-fill-available",$$slots:{default:[Uo]},$$scope:{ctx:e}}}),o=new ut({props:{width:"120px"}}),i=new ut({props:{der:"column",width:"-webkit-fill-available",$$slots:{default:[Ko]},$$scope:{ctx:e}}}),{c(){ve(t.$$.fragment),n=S(),ve(o.$$.fragment),r=S(),ve(i.$$.fragment)},m(e,s){xe(t,e,s),_(e,n,s),xe(o,e,s),_(e,r,s),xe(i,e,s),l=!0},p(e,n){const o={};4194306&n&&(o.$$scope={dirty:n,ctx:e}),t.$set(o);const r={};4194306&n&&(r.$$scope={dirty:n,ctx:e}),i.$set(r)},i(e){l||($e(t.$$.fragment,e),$e(o.$$.fragment,e),$e(i.$$.fragment,e),l=!0)},o(e){de(t.$$.fragment,e),de(o.$$.fragment,e),de(i.$$.fragment,e),l=!1},d(e){e&&(z(n),z(r)),we(t,e),we(o,e),we(i,e)}}}function er(e){let t;return{c(){t=O("Font directories")},m(e,n){_(e,t,n)},d(e){e&&z(t)}}}function tr(e){let t;return{c(){t=O("Clear list")},m(e,n){_(e,t,n)},d(e){e&&z(t)}}}function nr(e){let t;return{c(){t=O("Add directory")},m(e,n){_(e,t,n)},d(e){e&&z(t)}}}function or(e){let t,n,o,r,i,l,s,a;return t=new Ct({props:{grow:1}}),o=new rt({props:{$$slots:{default:[tr]},$$scope:{ctx:e}}}),o.$on("buttonClick",e[10]),i=new ut({props:{width:"10px"}}),s=new rt({props:{$$slots:{default:[nr]},$$scope:{ctx:e}}}),s.$on("buttonClick",e[8]),{c(){ve(t.$$.fragment),n=S(),ve(o.$$.fragment),r=S(),ve(i.$$.fragment),l=S(),ve(s.$$.fragment)},m(e,c){xe(t,e,c),_(e,n,c),xe(o,e,c),_(e,r,c),xe(i,e,c),_(e,l,c),xe(s,e,c),a=!0},p(e,t){const n={};4194304&t&&(n.$$scope={dirty:t,ctx:e}),o.$set(n);const r={};4194304&t&&(r.$$scope={dirty:t,ctx:e}),s.$set(r)},i(e){a||($e(t.$$.fragment,e),$e(o.$$.fragment,e),$e(i.$$.fragment,e),$e(s.$$.fragment,e),a=!0)},o(e){de(t.$$.fragment,e),de(o.$$.fragment,e),de(i.$$.fragment,e),de(s.$$.fragment,e),a=!1},d(e){e&&(z(n),z(r),z(l)),we(t,e),we(o,e),we(i,e),we(s,e)}}}function rr(e){let t,n,o,r,i,l,s,a;return t=new uo({props:{$$slots:{default:[er]},$$scope:{ctx:e}}}),o=new Jn({props:{items:e[2],onItemRemoveClick:e[6],height:"160px"}}),i=new ut({props:{height:"10px"}}),s=new ut({props:{$$slots:{default:[or]},$$scope:{ctx:e}}}),{c(){ve(t.$$.fragment),n=S(),ve(o.$$.fragment),r=S(),ve(i.$$.fragment),l=S(),ve(s.$$.fragment)},m(e,c){xe(t,e,c),_(e,n,c),xe(o,e,c),_(e,r,c),xe(i,e,c),_(e,l,c),xe(s,e,c),a=!0},p(e,n){const r={};4194304&n&&(r.$$scope={dirty:n,ctx:e}),t.$set(r);const i={};4&n&&(i.items=e[2]),o.$set(i);const l={};4194304&n&&(l.$$scope={dirty:n,ctx:e}),s.$set(l)},i(e){a||($e(t.$$.fragment,e),$e(o.$$.fragment,e),$e(i.$$.fragment,e),$e(s.$$.fragment,e),a=!0)},o(e){de(t.$$.fragment,e),de(o.$$.fragment,e),de(i.$$.fragment,e),de(s.$$.fragment,e),a=!1},d(e){e&&(z(n),z(r),z(l)),we(t,e),we(o,e),we(i,e),we(s,e)}}}function ir(e){let t;return{c(){t=O("Chromium command line switches")},m(e,n){_(e,t,n)},d(e){e&&z(t)}}}function lr(e){let t;return{c(){t=O("Clear list")},m(e,n){_(e,t,n)},d(e){e&&z(t)}}}function sr(e){let t;return{c(){t=O("Add Switch")},m(e,n){_(e,t,n)},d(e){e&&z(t)}}}function ar(e){let t,n,o,r,i,l,s,a;return t=new Ct({props:{grow:1}}),o=new rt({props:{$$slots:{default:[lr]},$$scope:{ctx:e}}}),o.$on("buttonClick",e[11]),i=new ut({props:{width:"10px"}}),s=new rt({props:{$$slots:{default:[sr]},$$scope:{ctx:e}}}),s.$on("buttonClick",e[9]),{c(){ve(t.$$.fragment),n=S(),ve(o.$$.fragment),r=S(),ve(i.$$.fragment),l=S(),ve(s.$$.fragment)},m(e,c){xe(t,e,c),_(e,n,c),xe(o,e,c),_(e,r,c),xe(i,e,c),_(e,l,c),xe(s,e,c),a=!0},p(e,t){const n={};4194304&t&&(n.$$scope={dirty:t,ctx:e}),o.$set(n);const r={};4194304&t&&(r.$$scope={dirty:t,ctx:e}),s.$set(r)},i(e){a||($e(t.$$.fragment,e),$e(o.$$.fragment,e),$e(i.$$.fragment,e),$e(s.$$.fragment,e),a=!0)},o(e){de(t.$$.fragment,e),de(o.$$.fragment,e),de(i.$$.fragment,e),de(s.$$.fragment,e),a=!1},d(e){e&&(z(n),z(r),z(l)),we(t,e),we(o,e),we(i,e),we(s,e)}}}function cr(e){let t,n,o,r,i,l,s,a;return t=new uo({props:{$$slots:{default:[ir]},$$scope:{ctx:e}}}),o=new Jn({props:{items:e[3],onItemRemoveClick:e[7],height:"160px"}}),i=new ut({props:{height:"10px"}}),s=new ut({props:{$$slots:{default:[ar]},$$scope:{ctx:e}}}),{c(){ve(t.$$.fragment),n=S(),ve(o.$$.fragment),r=S(),ve(i.$$.fragment),l=S(),ve(s.$$.fragment)},m(e,c){xe(t,e,c),_(e,n,c),xe(o,e,c),_(e,r,c),xe(i,e,c),_(e,l,c),xe(s,e,c),a=!0},p(e,n){const r={};4194304&n&&(r.$$scope={dirty:n,ctx:e}),t.$set(r);const i={};8&n&&(i.items=e[3]),o.$set(i);const l={};4194304&n&&(l.$$scope={dirty:n,ctx:e}),s.$set(l)},i(e){a||($e(t.$$.fragment,e),$e(o.$$.fragment,e),$e(i.$$.fragment,e),$e(s.$$.fragment,e),a=!0)},o(e){de(t.$$.fragment,e),de(o.$$.fragment,e),de(i.$$.fragment,e),de(s.$$.fragment,e),a=!1},d(e){e&&(z(n),z(r),z(l)),we(t,e),we(o,e),we(i,e),we(s,e)}}}function $r(e){let t,n,o,r,i,l;return t=new ut({props:{der:"column",width:"-webkit-fill-available",$$slots:{default:[rr]},$$scope:{ctx:e}}}),o=new ut({props:{width:"120px"}}),i=new ut({props:{der:"column",width:"-webkit-fill-available",$$slots:{default:[cr]},$$scope:{ctx:e}}}),{c(){ve(t.$$.fragment),n=S(),ve(o.$$.fragment),r=S(),ve(i.$$.fragment)},m(e,s){xe(t,e,s),_(e,n,s),xe(o,e,s),_(e,r,s),xe(i,e,s),l=!0},p(e,n){const o={};4194308&n&&(o.$$scope={dirty:n,ctx:e}),t.$set(o);const r={};4194312&n&&(r.$$scope={dirty:n,ctx:e}),i.$set(r)},i(e){l||($e(t.$$.fragment,e),$e(o.$$.fragment,e),$e(i.$$.fragment,e),l=!0)},o(e){de(t.$$.fragment,e),de(o.$$.fragment,e),de(i.$$.fragment,e),l=!1},d(e){e&&(z(n),z(r)),we(t,e),we(o,e),we(i,e)}}}function dr(e){let t,n,o,r,i,l,s,a,c,$,d,f,u,p,g,C,m,h,v,x;return n=new ut({props:{$$slots:{default:[jo]},$$scope:{ctx:e}}}),r=new ut({props:{height:"50px"}}),l=new Co({}),a=new ut({props:{height:"40px"}}),$=new ut({props:{$$slots:{default:[Qo]},$$scope:{ctx:e}}}),f=new ut({props:{height:"50px"}}),p=new Co({}),C=new ut({props:{height:"40px"}}),h=new ut({props:{$$slots:{default:[$r]},$$scope:{ctx:e}}}),{c(){t=I("div"),ve(n.$$.fragment),o=S(),ve(r.$$.fragment),i=S(),ve(l.$$.fragment),s=S(),ve(a.$$.fragment),c=S(),ve($.$$.fragment),d=S(),ve(f.$$.fragment),u=S(),ve(p.$$.fragment),g=S(),ve(C.$$.fragment),m=S(),ve(h.$$.fragment),E(t,"style",v=`z-index: ${e[0]}; height: ${e[4]}px;`),E(t,"class","svelte-1bc96my")},m(e,v){_(e,t,v),xe(n,t,null),B(t,o),xe(r,t,null),B(t,i),xe(l,t,null),B(t,s),xe(a,t,null),B(t,c),xe($,t,null),B(t,d),xe(f,t,null),B(t,u),xe(p,t,null),B(t,g),xe(C,t,null),B(t,m),xe(h,t,null),x=!0},p(e,[o]){const r={};4194306&o&&(r.$$scope={dirty:o,ctx:e}),n.$set(r);const i={};4194306&o&&(i.$$scope={dirty:o,ctx:e}),$.$set(i);const l={};4194316&o&&(l.$$scope={dirty:o,ctx:e}),h.$set(l),(!x||17&o&&v!==(v=`z-index: ${e[0]}; height: ${e[4]}px;`))&&E(t,"style",v)},i(e){x||($e(n.$$.fragment,e),$e(r.$$.fragment,e),$e(l.$$.fragment,e),$e(a.$$.fragment,e),$e($.$$.fragment,e),$e(f.$$.fragment,e),$e(p.$$.fragment,e),$e(C.$$.fragment,e),$e(h.$$.fragment,e),x=!0)},o(e){de(n.$$.fragment,e),de(r.$$.fragment,e),de(l.$$.fragment,e),de(a.$$.fragment,e),de($.$$.fragment,e),de(f.$$.fragment,e),de(p.$$.fragment,e),de(C.$$.fragment,e),de(h.$$.fragment,e),x=!1},d(e){e&&z(t),we(n),we(r),we(l),we(a),we($),we(f),we(p),we(C),we(h)}}}function fr(t,o,r){let i,l;C(t,Ae,(e=>r(1,i=e))),C(t,Re,(e=>r(12,l=e)));let s,{zIndex:a}=o,c=[],$=[];return t.$$set=e=>{"zIndex"in e&&r(0,a=e.zIndex)},t.$$.update=()=>{2&t.$$.dirty&&(e.ipcRenderer.invoke("updatePanelScale",i.ui.scalePanel),H(Ae,i.app.panelHeight=Math.floor(40*i.ui.scalePanel),i)),2&t.$$.dirty&&r(2,c=i.app.fontDirs.map((e=>({id:e,text:e,item:Zo})))),2&t.$$.dirty&&r(3,$=i.app.commandSwitches.map((e=>({id:n.randomUUID(),text:e.switch,itemArgs:{item:e},item:To})))),4096&t.$$.dirty&&l&&r(4,s=l.height-94),2&t.$$.dirty&&e.ipcRenderer.invoke("updateFigmaUiScale",i.ui.scaleFigmaUI)},[a,i,c,$,s,async function(t){const n=await e.ipcRenderer.invoke("selectExportDirectory");n&&H(Ae,i.app.exportDir=n,i)},function(e){H(Ae,i.app.fontDirs=c.filter((t=>t.id!==e.id)).map((e=>e.id)),i)},function(e){H(Ae,i.app.commandSwitches=$.reduce(((t,n)=>{if(n.id!==e.id){const e=n.itemArgs.item;t.push({switch:e.switch,value:e.value})}return t}),[]),i)},async function(t){const n=await e.ipcRenderer.invoke("selectExportDirectory");n&&(i.app.fontDirs.push(n),Ae.set(i))},async function(e){i.app.commandSwitches.push({switch:""}),Ae.set(i)},function(e){H(Ae,i.app.fontDirs=[],i)},function(e){H(Ae,i.app.commandSwitches=[],i)},l,function(e){t.$$.not_equal(i.ui.scaleFigmaUI,e)&&(i.ui.scaleFigmaUI=e,Ae.set(i))},function(e){t.$$.not_equal(i.ui.scalePanel,e)&&(i.ui.scalePanel=e,Ae.set(i))},function(e){t.$$.not_equal(i.app.saveLastOpenedTabs,e)&&(i.app.saveLastOpenedTabs=e,Ae.set(i))},function(e){t.$$.not_equal(i.app.enableColorSpaceSrgb,e)&&(i.app.enableColorSpaceSrgb=e,Ae.set(i))},function(e){t.$$.not_equal(i.app.visibleNewProjectBtn,e)&&(i.app.visibleNewProjectBtn=e,Ae.set(i))},function(e){t.$$.not_equal(i.app.useZenity,e)&&(i.app.useZenity=e,Ae.set(i))},function(e){t.$$.not_equal(i.app.useOldPreviewer,e)&&(i.app.useOldPreviewer=e,Ae.set(i))},function(e){t.$$.not_equal(i.app.disableThemes,e)&&(i.app.disableThemes=e,Ae.set(i))},function(e){t.$$.not_equal(i.app.exportDir,e)&&(i.app.exportDir=e,Ae.set(i))}]}class ur extends Ve{constructor(e){super(),He(this,e,fr,dr,d,{zIndex:0})}}function pr(e){let t,n=e[2].name+"";return{c(){t=O(n)},m(e,n){_(e,t,n)},p(e,o){4&o&&n!==(n=e[2].name+"")&&P(t,n)},d(e){e&&z(t)}}}function gr(e){let t,n=e[2].author+"";return{c(){t=O(n)},m(e,n){_(e,t,n)},p(e,o){4&o&&n!==(n=e[2].author+"")&&P(t,n)},d(e){e&&z(t)}}}function Cr(e){let t,n,o,r;return t=new uo({props:{padding:"0",$$slots:{default:[pr]},$$scope:{ctx:e}}}),o=new co({props:{whiteSpace:"wrap",$$slots:{default:[gr]},$$scope:{ctx:e}}}),{c(){ve(t.$$.fragment),n=S(),ve(o.$$.fragment)},m(e,i){xe(t,e,i),_(e,n,i),xe(o,e,i),r=!0},p(e,n){const r={};2052&n&&(r.$$scope={dirty:n,ctx:e}),t.$set(r);const i={};2052&n&&(i.$$scope={dirty:n,ctx:e}),o.$set(i)},i(e){r||($e(t.$$.fragment,e),$e(o.$$.fragment,e),r=!0)},o(e){de(t.$$.fragment,e),de(o.$$.fragment,e),r=!1},d(e){e&&z(n),we(t,e),we(o,e)}}}function mr(e){let t,n;return t=new ut({props:{der:"column",$$slots:{default:[Cr]},$$scope:{ctx:e}}}),{c(){ve(t.$$.fragment)},m(e,o){xe(t,e,o),n=!0},p(e,n){const o={};2052&n&&(o.$$scope={dirty:n,ctx:e}),t.$set(o)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){de(t.$$.fragment,e),n=!1},d(e){we(t,e)}}}function hr(e){let t,n;return t=new Ye({props:{normalBgColor:"tarsparent",$$slots:{default:[vr]},$$scope:{ctx:e}}}),t.$on("buttonClick",e[7]),{c(){ve(t.$$.fragment)},m(e,o){xe(t,e,o),n=!0},p(e,n){const o={};2048&n&&(o.$$scope={dirty:n,ctx:e}),t.$set(o)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){de(t.$$.fragment,e),n=!1},d(e){we(t,e)}}}function vr(e){let t,n;return t=new un({props:{color:"var(--text)",size:"16"}}),{c(){ve(t.$$.fragment)},m(e,o){xe(t,e,o),n=!0},p:r,i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){de(t.$$.fragment,e),n=!1},d(e){we(t,e)}}}function xr(e){let t,n;return t=new Zn({props:{color:"var(--text)",size:"16"}}),{c(){ve(t.$$.fragment)},m(e,o){xe(t,e,o),n=!0},p:r,i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){de(t.$$.fragment,e),n=!1},d(e){we(t,e)}}}function wr(e){let t,n;return t=new It({props:{deg:-90,$$slots:{default:[xr]},$$scope:{ctx:e}}}),{c(){ve(t.$$.fragment)},m(e,o){xe(t,e,o),n=!0},p(e,n){const o={};2048&n&&(o.$$scope={dirty:n,ctx:e}),t.$set(o)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){de(t.$$.fragment,e),n=!1},d(e){we(t,e)}}}function br(e){let t,n,o;var r=e[3];return r&&(t=D(r,{props:{color:"var(--text)"}})),{c(){t&&ve(t.$$.fragment),n=A()},m(e,r){t&&xe(t,e,r),_(e,n,r),o=!0},p(e,o){if(8&o&&r!==(r=e[3])){if(t){ae();const e=t;de(e.$$.fragment,1,0,(()=>{we(e,1)})),ce()}r?(t=D(r,{props:{color:"var(--text)"}}),ve(t.$$.fragment),$e(t.$$.fragment,1),xe(t,n.parentNode,n)):t=null}},i(e){o||(t&&$e(t.$$.fragment,e),o=!0)},o(e){t&&de(t.$$.fragment,e),o=!1},d(e){e&&z(n),t&&we(t,e)}}}function Hr(e){let t,n,o,r;return t=new ut({props:{width:"20px"}}),o=new Ye({props:{normalBgColor:"tarsparent",$$slots:{default:[Vr]},$$scope:{ctx:e}}}),o.$on("buttonClick",e[10]),{c(){ve(t.$$.fragment),n=S(),ve(o.$$.fragment)},m(e,i){xe(t,e,i),_(e,n,i),xe(o,e,i),r=!0},p(e,t){const n={};2048&t&&(n.$$scope={dirty:t,ctx:e}),o.$set(n)},i(e){r||($e(t.$$.fragment,e),$e(o.$$.fragment,e),r=!0)},o(e){de(t.$$.fragment,e),de(o.$$.fragment,e),r=!1},d(e){e&&z(n),we(t,e),we(o,e)}}}function Vr(e){let t,n;return t=new en({props:{color:"var(--text)",size:"18"}}),{c(){ve(t.$$.fragment)},m(e,o){xe(t,e,o),n=!0},p:r,i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){de(t.$$.fragment,e),n=!1},d(e){we(t,e)}}}function Lr(e){let t,n,o,r,i,l,s,a,c,$,d,f=e[0]&&hr(e);n=new ut({props:{width:"10px"}}),r=new Ye({props:{normalBgColor:"tarsparent",$$slots:{default:[wr]},$$scope:{ctx:e}}}),r.$on("buttonClick",e[8]),l=new ut({props:{width:"10px"}}),a=new Ye({props:{normalBgColor:"tarsparent",$$slots:{default:[br]},$$scope:{ctx:e}}}),a.$on("buttonClick",e[9]);let u=e[1]&&Hr(e);return{c(){f&&f.c(),t=S(),ve(n.$$.fragment),o=S(),ve(r.$$.fragment),i=S(),ve(l.$$.fragment),s=S(),ve(a.$$.fragment),c=S(),u&&u.c(),$=A()},m(e,p){f&&f.m(e,p),_(e,t,p),xe(n,e,p),_(e,o,p),xe(r,e,p),_(e,i,p),xe(l,e,p),_(e,s,p),xe(a,e,p),_(e,c,p),u&&u.m(e,p),_(e,$,p),d=!0},p(e,n){e[0]?f?(f.p(e,n),1&n&&$e(f,1)):(f=hr(e),f.c(),$e(f,1),f.m(t.parentNode,t)):f&&(ae(),de(f,1,1,(()=>{f=null})),ce());const o={};2048&n&&(o.$$scope={dirty:n,ctx:e}),r.$set(o);const i={};2056&n&&(i.$$scope={dirty:n,ctx:e}),a.$set(i),e[1]?u?(u.p(e,n),2&n&&$e(u,1)):(u=Hr(e),u.c(),$e(u,1),u.m($.parentNode,$)):u&&(ae(),de(u,1,1,(()=>{u=null})),ce())},i(e){d||($e(f),$e(n.$$.fragment,e),$e(r.$$.fragment,e),$e(l.$$.fragment,e),$e(a.$$.fragment,e),$e(u),d=!0)},o(e){de(f),de(n.$$.fragment,e),de(r.$$.fragment,e),de(l.$$.fragment,e),de(a.$$.fragment,e),de(u),d=!1},d(e){e&&(z(t),z(o),z(i),z(s),z(c),z($)),f&&f.d(e),we(n,e),we(r,e),we(l,e),we(a,e),u&&u.d(e)}}}function yr(e){let t,n;return t=new ut({props:{alignItems:"center",justifyContent:"end",height:"100%",$$slots:{default:[Lr]},$$scope:{ctx:e}}}),{c(){ve(t.$$.fragment)},m(e,o){xe(t,e,o),n=!0},p(e,n){const o={};2063&n&&(o.$$scope={dirty:n,ctx:e}),t.$set(o)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){de(t.$$.fragment,e),n=!1},d(e){we(t,e)}}}function Mr(e){let t,n,o,r;return t=new Ct({props:{grow:2,$$slots:{default:[mr]},$$scope:{ctx:e}}}),o=new Ct({props:{grow:1,$$slots:{default:[yr]},$$scope:{ctx:e}}}),{c(){ve(t.$$.fragment),n=S(),ve(o.$$.fragment)},m(e,i){xe(t,e,i),_(e,n,i),xe(o,e,i),r=!0},p(e,n){const r={};2052&n&&(r.$$scope={dirty:n,ctx:e}),t.$set(r);const i={};2063&n&&(i.$$scope={dirty:n,ctx:e}),o.$set(i)},i(e){r||($e(t.$$.fragment,e),$e(o.$$.fragment,e),r=!0)},o(e){de(t.$$.fragment,e),de(o.$$.fragment,e),r=!1},d(e){e&&z(n),we(t,e),we(o,e)}}}function Zr(e){let t,n,o,r,i,l,s,a,c,$,d,f,u,p,g,C,m,h,v,x,w,b,H;return s=new Et({props:{color:"var(--text)"}}),c=new sn({props:{color:"var(--text)"}}),f=new Jt({props:{color:"var(--textComponent)"}}),g=new et({props:{width:"30px",height:"16px",padding:"0"}}),x=new ut({props:{padding:"14px",lborder:"1px solid var(--borders)",rborder:"1px solid var(--borders)",bborder:"1px solid var(--borders)",bradius:"0 0 6px 6px",$$slots:{default:[Mr]},$$scope:{ctx:e}}}),{c(){t=I("div"),n=I("div"),o=I("div"),r=S(),i=I("div"),l=I("div"),ve(s.$$.fragment),a=S(),ve(c.$$.fragment),$=S(),d=I("div"),ve(f.$$.fragment),u=S(),p=I("div"),ve(g.$$.fragment),C=S(),m=I("div"),m.innerHTML='<div class="themeview_item_tumbl_body_left svelte-lgfnem"><div class="themeview_item_tumbl_body_left_text1 svelte-lgfnem"></div> <div class="themeview_item_tumbl_body_left_text2 svelte-lgfnem"></div></div> <div class="themeview_item_tumbl_body_center svelte-lgfnem"></div> <div class="themeview_item_tumbl_body_right svelte-lgfnem"></div>',v=S(),ve(x.$$.fragment),E(o,"class","themeview_item_tumbl_top svelte-lgfnem"),E(l,"class","svelte-lgfnem"),E(d,"class","svelte-lgfnem"),E(p,"class","svelte-lgfnem"),E(i,"class","themeview_item_tumbl_toolpanel svelte-lgfnem"),E(m,"class","themeview_item_tumbl_body svelte-lgfnem"),E(n,"class","themeview_item_tumbl svelte-lgfnem"),E(n,"style",h=Be(e[2]).join(";"))},m(h,V){_(h,t,V),B(t,n),B(n,o),B(n,r),B(n,i),B(i,l),xe(s,l,null),B(l,a),xe(c,l,null),B(i,$),B(i,d),xe(f,d,null),B(i,u),B(i,p),xe(g,p,null),B(n,C),B(n,m),B(t,v),xe(x,t,null),w=!0,b||(H=F(n,"mouseup",e[6]),b=!0)},p(e,[t]){(!w||4&t&&h!==(h=Be(e[2]).join(";")))&&E(n,"style",h);const o={};2063&t&&(o.$$scope={dirty:t,ctx:e}),x.$set(o)},i(e){w||($e(s.$$.fragment,e),$e(c.$$.fragment,e),$e(f.$$.fragment,e),$e(g.$$.fragment,e),$e(x.$$.fragment,e),w=!0)},o(e){de(s.$$.fragment,e),de(c.$$.fragment,e),de(f.$$.fragment,e),de(g.$$.fragment,e),de(x.$$.fragment,e),w=!1},d(e){e&&z(t),we(s),we(c),we(f),we(g),we(x),b=!1,H()}}}function kr(e,t,n){let o,{canEdit:r=!1}=t,{canDelete:i=!1}=t,{currentThemeId:l}=t,{theme:s}=t;const a=q();return e.$$set=e=>{"canEdit"in e&&n(0,r=e.canEdit),"canDelete"in e&&n(1,i=e.canDelete),"currentThemeId"in e&&n(5,l=e.currentThemeId),"theme"in e&&n(2,s=e.theme)},e.$$.update=()=>{36&e.$$.dirty&&n(3,o=l===s.id?Tn:_n)},[r,i,s,o,a,l,()=>a("applyTheme",{themeId:s.id}),()=>a("editTheme",{themeId:s.id}),()=>a("useColorPalette",{themeId:s.id}),()=>a("applyTheme",{themeId:s.id}),()=>a("deleteTheme",{themeId:s.id})]}class Br extends Ve{constructor(e){super(),He(this,e,kr,Zr,d,{canEdit:0,canDelete:1,currentThemeId:5,theme:2})}}function _r(e,t,n){const o=e.slice();return o[20]=t[n],o[22]=n,o}function zr(e,t,n){const o=e.slice();return o[23]=t[n],o}function Ir(e,t,n){const o=e.slice();return o[20]=t[n],o[22]=n,o}function Tr(e,t,n){const o=e.slice();return o[23]=t[n],o}function Or(e){let t,n,o,r=[],i=new Map,l=fe(e[1]);const s=e=>e[23].id;for(let t=0;t<l.length;t+=1){let n=Tr(e,l,t),o=s(n);i.set(o,r[t]=Sr(o,n))}let a=e[1].length<6&&Ar(e);return{c(){for(let e=0;e<r.length;e+=1)r[e].c();t=S(),a&&a.c(),n=A()},m(e,i){for(let t=0;t<r.length;t+=1)r[t]&&r[t].m(e,i);_(e,t,i),a&&a.m(e,i),_(e,n,i),o=!0},p(e,o){1986&o&&(l=fe(e[1]),ae(),r=ge(r,o,s,1,e,l,i,t.parentNode,pe,Sr,t,Tr),ce()),e[1].length<6?a?a.p(e,o):(a=Ar(e),a.c(),a.m(n.parentNode,n)):a&&(a.d(1),a=null)},i(e){if(!o){for(let e=0;e<l.length;e+=1)$e(r[e]);o=!0}},o(e){for(let e=0;e<r.length;e+=1)de(r[e]);o=!1},d(e){e&&(z(t),z(n));for(let t=0;t<r.length;t+=1)r[t].d(e);a&&a.d(e)}}}function Sr(e,t){let n,o,r,i;function l(e){t[12](e)}let s={theme:t[23],canDelete:!0,canEdit:!0};return void 0!==t[6].theme.currentTheme&&(s.currentThemeId=t[6].theme.currentTheme),o=new Br({props:s}),X.push((()=>he(o,"currentThemeId",l))),o.$on("deleteTheme",t[8]),o.$on("editTheme",t[9]),o.$on("useColorPalette",t[10]),o.$on("applyTheme",t[7]),{key:e,first:null,c(){n=A(),ve(o.$$.fragment),this.first=n},m(e,t){_(e,n,t),xe(o,e,t),i=!0},p(e,n){t=e;const i={};2&n&&(i.theme=t[23]),!r&&64&n&&(r=!0,i.currentThemeId=t[6].theme.currentTheme,te((()=>r=!1))),o.$set(i)},i(e){i||($e(o.$$.fragment,e),i=!0)},o(e){de(o.$$.fragment,e),i=!1},d(e){e&&z(n),we(o,e)}}}function Ar(e){let t,n=[],o=new Map,r=fe(Array(6-e[1].length));const i=e=>e[22];for(let t=0;t<r.length;t+=1){let l=Ir(e,r,t),s=i(l);o.set(s,n[t]=Fr(s))}return{c(){for(let e=0;e<n.length;e+=1)n[e].c();t=A()},m(e,o){for(let t=0;t<n.length;t+=1)n[t]&&n[t].m(e,o);_(e,t,o)},p(e,l){2&l&&(r=fe(Array(6-e[1].length)),n=ge(n,l,i,1,e,r,o,t.parentNode,ue,Fr,t,Ir))},d(e){e&&z(t);for(let t=0;t<n.length;t+=1)n[t].d(e)}}}function Fr(e,t){let n;return{key:e,first:null,c(){n=I("themeFake"),E(n,"class","svelte-1ahepc0"),this.first=n},m(e,t){_(e,n,t)},p(e,t){},d(e){e&&z(n)}}}function Er(e){let t,n,o=e[1].length>0&&Or(e);return{c(){o&&o.c(),t=A()},m(e,r){o&&o.m(e,r),_(e,t,r),n=!0},p(e,n){e[1].length>0?o?(o.p(e,n),2&n&&$e(o,1)):(o=Or(e),o.c(),$e(o,1),o.m(t.parentNode,t)):o&&(ae(),de(o,1,1,(()=>{o=null})),ce())},i(e){n||($e(o),n=!0)},o(e){de(o),n=!1},d(e){e&&z(t),o&&o.d(e)}}}function Pr(e){let t,n;return t=new $t({props:{columns:"repeat(auto-fit, minmax(300px, 1fr))",gap:"2vmin",padding:"12px 0 0 0",$$slots:{default:[Er]},$$scope:{ctx:e}}}),{c(){ve(t.$$.fragment)},m(e,o){xe(t,e,o),n=!0},p(e,n){const o={};536870978&n&&(o.$$scope={dirty:n,ctx:e}),t.$set(o)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){de(t.$$.fragment,e),n=!1},d(e){we(t,e)}}}function Rr(e){let t,n,o,r=[],i=new Map,l=fe(e[2]);const s=e=>e[23].id;for(let t=0;t<l.length;t+=1){let n=zr(e,l,t),o=s(n);i.set(o,r[t]=Dr(o,n))}let a=e[2].length<6&&jr(e);return{c(){for(let e=0;e<r.length;e+=1)r[e].c();t=S(),a&&a.c(),n=A()},m(e,i){for(let t=0;t<r.length;t+=1)r[t]&&r[t].m(e,i);_(e,t,i),a&&a.m(e,i),_(e,n,i),o=!0},p(e,o){1220&o&&(l=fe(e[2]),ae(),r=ge(r,o,s,1,e,l,i,t.parentNode,pe,Dr,t,zr),ce()),e[2].length<6?a?a.p(e,o):(a=jr(e),a.c(),a.m(n.parentNode,n)):a&&(a.d(1),a=null)},i(e){if(!o){for(let e=0;e<l.length;e+=1)$e(r[e]);o=!0}},o(e){for(let e=0;e<r.length;e+=1)de(r[e]);o=!1},d(e){e&&(z(t),z(n));for(let t=0;t<r.length;t+=1)r[t].d(e);a&&a.d(e)}}}function Dr(e,t){let n,o,r,i;function l(e){t[15](e)}let s={theme:t[23]};return void 0!==t[6].theme.currentTheme&&(s.currentThemeId=t[6].theme.currentTheme),o=new Br({props:s}),X.push((()=>he(o,"currentThemeId",l))),o.$on("useColorPalette",t[10]),o.$on("applyTheme",t[7]),{key:e,first:null,c(){n=A(),ve(o.$$.fragment),this.first=n},m(e,t){_(e,n,t),xe(o,e,t),i=!0},p(e,n){t=e;const i={};4&n&&(i.theme=t[23]),!r&&64&n&&(r=!0,i.currentThemeId=t[6].theme.currentTheme,te((()=>r=!1))),o.$set(i)},i(e){i||($e(o.$$.fragment,e),i=!0)},o(e){de(o.$$.fragment,e),i=!1},d(e){e&&z(n),we(o,e)}}}function jr(e){let t,n=[],o=new Map,r=fe(Array(6-e[2].length));const i=e=>e[22];for(let t=0;t<r.length;t+=1){let l=_r(e,r,t),s=i(l);o.set(s,n[t]=Nr(s))}return{c(){for(let e=0;e<n.length;e+=1)n[e].c();t=A()},m(e,o){for(let t=0;t<n.length;t+=1)n[t]&&n[t].m(e,o);_(e,t,o)},p(e,l){4&l&&(r=fe(Array(6-e[2].length)),n=ge(n,l,i,1,e,r,o,t.parentNode,ue,Nr,t,_r))},d(e){e&&z(t);for(let t=0;t<n.length;t+=1)n[t].d(e)}}}function Nr(e,t){let n;return{key:e,first:null,c(){n=I("themeFake"),E(n,"class","svelte-1ahepc0"),this.first=n},m(e,t){_(e,n,t)},p(e,t){},d(e){e&&z(n)}}}function Ur(e){let t,n,o=e[2].length>0&&Rr(e);return{c(){o&&o.c(),t=A()},m(e,r){o&&o.m(e,r),_(e,t,r),n=!0},p(e,n){e[2].length>0?o?(o.p(e,n),4&n&&$e(o,1)):(o=Rr(e),o.c(),$e(o,1),o.m(t.parentNode,t)):o&&(ae(),de(o,1,1,(()=>{o=null})),ce())},i(e){n||($e(o),n=!0)},o(e){de(o),n=!1},d(e){e&&z(t),o&&o.d(e)}}}function qr(e){let t,n;return t=new $t({props:{columns:"repeat(auto-fit, minmax(300px, 1fr))",gap:"2vmin",padding:"12px 0 0 0",$$slots:{default:[Ur]},$$scope:{ctx:e}}}),{c(){ve(t.$$.fragment)},m(e,o){xe(t,e,o),n=!0},p(e,n){const o={};536870980&n&&(o.$$scope={dirty:n,ctx:e}),t.$set(o)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){de(t.$$.fragment,e),n=!1},d(e){we(t,e)}}}function Gr(e){let t,n,o,r,i,l,s,a,c,$,d,f;function u(t){e[13](t)}function p(t){e[14](t)}let g={title:"ThemeCreator's themes",$$slots:{default:[Pr]},$$scope:{ctx:e}};function C(t){e[16](t)}function m(t){e[17](t)}void 0!==e[5]&&(g.isEmpty=e[5]),void 0!==e[6].app.creatorsThemesDropdownOpen&&(g.open=e[6].app.creatorsThemesDropdownOpen),n=new Ht({props:g}),X.push((()=>he(n,"isEmpty",u))),X.push((()=>he(n,"open",p))),l=new ut({props:{height:"20px"}});let h={title:"Repository themes",$$slots:{default:[qr]},$$scope:{ctx:e}};return void 0!==e[4]&&(h.isEmpty=e[4]),void 0!==e[6].app.themeDropdownOpen&&(h.open=e[6].app.themeDropdownOpen),a=new Ht({props:h}),X.push((()=>he(a,"isEmpty",C))),X.push((()=>he(a,"open",m))),{c(){t=I("div"),ve(n.$$.fragment),i=S(),ve(l.$$.fragment),s=S(),ve(a.$$.fragment),E(t,"style",d=`z-index: ${e[0]}; height: ${e[3]}px;`),E(t,"class","svelte-1ahepc0")},m(e,o){_(e,t,o),xe(n,t,null),B(t,i),xe(l,t,null),B(t,s),xe(a,t,null),f=!0},p(e,[i]){const l={};536870978&i&&(l.$$scope={dirty:i,ctx:e}),!o&&32&i&&(o=!0,l.isEmpty=e[5],te((()=>o=!1))),!r&&64&i&&(r=!0,l.open=e[6].app.creatorsThemesDropdownOpen,te((()=>r=!1))),n.$set(l);const s={};536870980&i&&(s.$$scope={dirty:i,ctx:e}),!c&&16&i&&(c=!0,s.isEmpty=e[4],te((()=>c=!1))),!$&&64&i&&($=!0,s.open=e[6].app.themeDropdownOpen,te((()=>$=!1))),a.$set(s),(!f||9&i&&d!==(d=`z-index: ${e[0]}; height: ${e[3]}px;`))&&E(t,"style",d)},i(e){f||($e(n.$$.fragment,e),$e(l.$$.fragment,e),$e(a.$$.fragment,e),f=!0)},o(e){de(n.$$.fragment,e),de(l.$$.fragment,e),de(a.$$.fragment,e),f=!1},d(e){e&&z(t),we(n),we(l),we(a)}}}function Wr(t,n,o){let r,i,l,s,a,c,$;C(t,Re,(e=>o(11,l=e))),C(t,Ne,(e=>o(1,s=e))),C(t,Fe,(e=>o(2,a=e))),C(t,ke,(e=>o(18,c=e))),C(t,Ae,(e=>o(6,$=e)));let{zIndex:d}=n;const f=q();function u(t){const n=t.detail.themeId,o=structuredClone([...a,...s].find((e=>e.id===n)));e.ipcRenderer.send("changeTheme",o),H(Ae,$.theme.currentTheme=n,$)}let p;return t.$$set=e=>{"zIndex"in e&&o(0,d=e.zIndex)},t.$$.update=()=>{2&t.$$.dirty&&o(5,r=0===s.length),4&t.$$.dirty&&o(4,i=0===a.length),2048&t.$$.dirty&&l&&o(3,p=l.height-94)},[d,s,a,p,i,r,$,u,function(t){const n=t.detail.themeId;e.ipcRenderer.send("themeCreatorRemoveTheme",n),n===c.id&&u(new CustomEvent("applyTheme",{detail:{themeId:Ze.id}}))},function(e){const t=e.detail.themeId,n=structuredClone(s.find((e=>e.id===t)));je.setEditTheme(n),f("setSettingsTabViewIndex",{index:2})},function(e){const t=e.detail.themeId,n=structuredClone([...a,...s].find((e=>e.id===t)));je.setPaletteTheme(n),f("setSettingsTabViewIndex",{index:2})},l,function(e){t.$$.not_equal($.theme.currentTheme,e)&&($.theme.currentTheme=e,Ae.set($))},function(e){r=e,o(5,r),o(1,s)},function(e){t.$$.not_equal($.app.creatorsThemesDropdownOpen,e)&&($.app.creatorsThemesDropdownOpen=e,Ae.set($))},function(e){t.$$.not_equal($.theme.currentTheme,e)&&($.theme.currentTheme=e,Ae.set($))},function(e){i=e,o(4,i),o(2,a)},function(e){t.$$.not_equal($.app.themeDropdownOpen,e)&&($.app.themeDropdownOpen=e,Ae.set($))}]}class Xr extends Ve{constructor(e){super(),He(this,e,Wr,Gr,d,{zIndex:0})}}function Yr(e){let t,n;return t=new Ln({props:{color:"var(--text)"}}),{c(){ve(t.$$.fragment)},m(e,o){xe(t,e,o),n=!0},p:r,i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){de(t.$$.fragment,e),n=!1},d(e){we(t,e)}}}function Jr(e){let t,n;return t=new st({props:{spin:!e[0],$$slots:{default:[Yr]},$$scope:{ctx:e}}}),{c(){ve(t.$$.fragment)},m(e,o){xe(t,e,o),n=!0},p(e,n){const o={};1&n&&(o.spin=!e[0]),4&n&&(o.$$scope={dirty:n,ctx:e}),t.$set(o)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){de(t.$$.fragment,e),n=!1},d(e){we(t,e)}}}function Kr(e){let t,n,o,r;return t=new Ge({props:{size:32,round:3,margin:"0 4px 0 0",hoverBgColor:"var(--borders)",$$slots:{default:[Jr]},$$scope:{ctx:e}}}),t.$on("buttonClick",e[1]),o=new ut({props:{width:"10px"}}),{c(){ve(t.$$.fragment),n=S(),ve(o.$$.fragment)},m(e,i){xe(t,e,i),_(e,n,i),xe(o,e,i),r=!0},p(e,n){const o={};5&n&&(o.$$scope={dirty:n,ctx:e}),t.$set(o)},i(e){r||($e(t.$$.fragment,e),$e(o.$$.fragment,e),r=!0)},o(e){de(t.$$.fragment,e),de(o.$$.fragment,e),r=!1},d(e){e&&z(n),we(t,e),we(o,e)}}}function Qr(e){let t,n;return t=new ut({props:{$$slots:{default:[Kr]},$$scope:{ctx:e}}}),{c(){ve(t.$$.fragment)},m(e,o){xe(t,e,o),n=!0},p(e,[n]){const o={};5&n&&(o.$$scope={dirty:n,ctx:e}),t.$set(o)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){de(t.$$.fragment,e),n=!1},d(e){we(t,e)}}}function ei(t,n,o){let r;return C(t,De,(e=>o(0,r=e))),[r,function(t){e.ipcRenderer.send("syncThemes"),De.set(!1)}]}let ti=class extends Ve{constructor(e){super(),He(this,e,ei,Qr,d,{})}};function ni(e){if("Default Theme"===e)return Ee.set("Change the theme name"),!1;if(""===e)return Ee.set("Enter the name of new theme"),!1;return Ne.exists(e)?(Ee.set("Theme already exists. Please, choose other name"),!1):(Ee.set(""),!0)}function oi(e){return"Figma"===e?(Pe.set("Change the theme author name"),!1):""===e?(Pe.set("Enter the author name of new theme"),!1):(Pe.set(""),!0)}function ri(e){let t,n,o,i,l,s,a,c,$,d,f,u,p,g,C,m,h,v,x,w,b,H,V,L,y,M,Z,k,I,O,S,A,F,P,R,D,j,N,U,q,G,W,X,Y,J,K,Q,ee,te,ne,oe,re,ie,le,se,ae,ce,$e,de,fe,ue,pe,ge,Ce,me,he,ve,xe,we,be,He,Ve,Le,ye,Me,Ze,ke,Be,_e,ze,Ie,Te,Oe,Se,Ae,Fe,Ee,Pe,Re,De,je,Ne,Ue,qe,Ge,We,Xe,Ye,Je,Ke,Qe,et,tt,nt,ot,rt,it,lt,st,at,ct,$t,dt,ft,ut,pt,gt,Ct,mt,ht,vt,xt,wt,bt,Ht,Vt,Lt,yt,Mt,Zt,kt,Bt,_t,zt,It,Tt,Ot,St,At,Ft,Et,Pt,Rt,Dt,jt,Nt,Ut,qt,Gt,Wt,Xt,Yt,Jt,Kt,Qt,en,tn,nn,on,rn,ln,sn,an,cn,$n,dn,fn,un,pn,gn,Cn,mn,hn,vn,xn,wn,bn,Hn,Vn,Ln,yn,Mn,Zn,kn,Bn,_n,zn,In,Tn,On,Sn,An,Fn,En,Pn,Rn,Dn,jn,Nn,Un,qn,Gn,Wn,Xn,Yn,Jn,Kn,Qn,eo,to,no,oo,ro,io,lo,so,ao,co,$o,fo,uo,po,go,Co,mo,ho,vo,xo,wo,bo,Ho,Vo,Lo,yo,Mo,Zo,ko,Bo,_o,zo,Io,To,Oo,So,Ao,Fo,Eo,Po,Ro,Do;return{c(){t=T("svg"),n=T("g"),o=T("rect"),i=T("rect"),l=T("rect"),s=T("rect"),a=T("rect"),c=T("path"),$=T("rect"),d=T("rect"),f=T("path"),u=T("g"),p=T("rect"),g=T("g"),C=T("rect"),m=T("g"),h=T("path"),v=T("g"),x=T("path"),w=T("g"),b=T("path"),H=T("g"),V=T("path"),L=T("g"),y=T("path"),M=T("g"),Z=T("rect"),k=T("path"),I=T("g"),O=T("path"),S=T("g"),A=T("rect"),F=T("g"),P=T("path"),R=T("g"),D=T("rect"),j=T("g"),N=T("circle"),U=T("g"),q=T("rect"),G=T("g"),W=T("path"),X=T("g"),Y=T("path"),J=T("g"),K=T("g"),Q=T("path"),ee=T("g"),te=T("path"),ne=T("g"),oe=T("rect"),re=T("rect"),ie=T("path"),le=T("g"),se=T("rect"),ae=T("path"),ce=T("g"),$e=T("path"),de=T("g"),fe=T("rect"),ue=T("path"),pe=T("path"),ge=T("g"),Ce=T("path"),me=T("g"),he=T("path"),ve=T("rect"),xe=T("rect"),we=T("rect"),be=T("rect"),He=T("rect"),Ve=T("rect"),Le=T("rect"),ye=T("rect"),Me=T("g"),Ze=T("rect"),ke=T("g"),Be=T("rect"),_e=T("g"),ze=T("rect"),Ie=T("g"),Te=T("path"),Oe=T("rect"),Se=T("rect"),Ae=T("rect"),Fe=T("rect"),Ee=T("rect"),Pe=T("rect"),Re=T("rect"),De=T("rect"),je=T("g"),Ne=T("g"),Ue=T("path"),qe=T("path"),Ge=T("rect"),We=T("rect"),Xe=T("rect"),Ye=T("rect"),Je=T("rect"),Ke=T("rect"),Qe=T("rect"),et=T("rect"),tt=T("g"),nt=T("g"),ot=T("path"),rt=T("path"),it=T("g"),lt=T("g"),st=T("path"),at=T("path"),ct=T("g"),$t=T("g"),dt=T("path"),ft=T("path"),ut=T("path"),pt=T("path"),gt=T("path"),Ct=T("g"),mt=T("g"),ht=T("path"),vt=T("path"),xt=T("g"),wt=T("path"),bt=T("g"),Ht=T("path"),Vt=T("g"),Lt=T("path"),yt=T("line"),Mt=T("line"),Zt=T("line"),kt=T("line"),Bt=T("line"),_t=T("line"),zt=T("line"),It=T("g"),Tt=T("g"),Ot=T("g"),St=T("rect"),At=T("rect"),Ft=T("rect"),Et=T("g"),Pt=T("path"),Rt=T("g"),Dt=T("path"),jt=T("path"),Nt=T("g"),Ut=T("path"),qt=T("path"),Gt=T("g"),Wt=T("path"),Xt=T("path"),Yt=T("g"),Jt=T("path"),Kt=T("g"),Qt=T("path"),en=T("g"),tn=T("path"),nn=T("g"),on=T("path"),rn=T("path"),ln=T("g"),sn=T("rect"),an=T("path"),cn=T("g"),$n=T("path"),dn=T("g"),fn=T("path"),un=T("path"),pn=T("g"),gn=T("path"),Cn=T("g"),mn=T("path"),hn=T("path"),vn=T("g"),xn=T("path"),wn=T("g"),bn=T("path"),Hn=T("path"),Vn=T("g"),Ln=T("path"),yn=T("g"),Mn=T("path"),Zn=T("path"),kn=T("g"),Bn=T("path"),_n=T("g"),zn=T("path"),In=T("g"),Tn=T("line"),On=T("g"),Sn=T("line"),An=T("g"),Fn=T("path"),En=T("rect"),Pn=T("g"),Rn=T("path"),Dn=T("defs"),jn=T("filter"),Nn=T("feFlood"),Un=T("feColorMatrix"),qn=T("feOffset"),Gn=T("feGaussianBlur"),Wn=T("feColorMatrix"),Xn=T("feBlend"),Yn=T("feBlend"),Jn=T("filter"),Kn=T("feFlood"),Qn=T("feColorMatrix"),eo=T("feOffset"),to=T("feGaussianBlur"),no=T("feColorMatrix"),oo=T("feBlend"),ro=T("feBlend"),io=T("filter"),lo=T("feFlood"),so=T("feColorMatrix"),ao=T("feOffset"),co=T("feGaussianBlur"),$o=T("feColorMatrix"),fo=T("feBlend"),uo=T("feBlend"),po=T("filter"),go=T("feFlood"),Co=T("feColorMatrix"),mo=T("feOffset"),ho=T("feGaussianBlur"),vo=T("feColorMatrix"),xo=T("feBlend"),wo=T("feBlend"),bo=T("filter"),Ho=T("feFlood"),Vo=T("feColorMatrix"),Lo=T("feOffset"),yo=T("feGaussianBlur"),Mo=T("feColorMatrix"),Zo=T("feBlend"),ko=T("feBlend"),Bo=T("filter"),_o=T("feFlood"),zo=T("feColorMatrix"),Io=T("feOffset"),To=T("feGaussianBlur"),Oo=T("feColorMatrix"),So=T("feBlend"),Ao=T("feColorMatrix"),Fo=T("feOffset"),Eo=T("feGaussianBlur"),Po=T("feColorMatrix"),Ro=T("feBlend"),Do=T("feBlend"),E(o,"width","1080"),E(o,"height","608"),E(o,"transform","translate(1)"),E(o,"fill","#F5F5F5"),E(i,"id","bg-panel"),E(i,"width","216"),E(i,"height","528"),E(i,"transform","matrix(-1 0 0 1 1081 80)"),E(i,"fill","var(--bg-panel)"),E(l,"id","text"),E(l,"x","877"),E(l,"y","92"),E(l,"width","56"),E(l,"height","12"),E(l,"rx","2"),E(l,"fill","var(--text)"),E(s,"id","text_2"),E(s,"x","877"),E(s,"y","116"),E(s,"width","192"),E(s,"height","12"),E(s,"rx","2"),E(s,"fill","var(--text)"),E(a,"id","text_3"),E(a,"x","877"),E(a,"y","153"),E(a,"width","192"),E(a,"height","72"),E(a,"rx","2"),E(a,"fill","var(--text)"),E(c,"id","text_4"),E(c,"d","M877 239C877 237.895 877.895 237 879 237H1067C1068.1 237 1069 237.895 1069 239V309H877V239Z"),E(c,"fill","var(--text)"),E($,"id","text_5"),E($,"x","945"),E($,"y","92"),E($,"width","56"),E($,"height","12"),E($,"rx","2"),E($,"fill","var(--text)"),E(d,"id","text_6"),E(d,"x","1013"),E(d,"y","92"),E(d,"width","56"),E(d,"height","12"),E(d,"rx","2"),E(d,"fill","var(--text)"),E(f,"id","bg-panel_2"),E(f,"d","M1 80H217V608H1V80Z"),E(f,"fill","var(--bg-panel)"),E(p,"width","1080"),E(p,"height","40"),E(p,"transform","translate(1 40)"),E(p,"fill","var(--bg-toolbar)"),E(C,"width","304"),E(C,"height","40"),E(C,"transform","translate(1 40)"),E(C,"fill","var(--bg-toolbar)"),E(h,"id","fg-toolbar"),E(h,"fill-rule","evenodd"),E(h,"clip-rule","evenodd"),E(h,"d","M278.927 63.5266L278.69 63.0341C278.248 62.1174 278 61.0891 278 60C278 56.134 281.134 53 285 53C288.866 53 292 56.134 292 60C292 63.866 288.866 67 285 67C283.895 67 282.853 66.7448 281.926 66.2911L281.658 66.1599L281.362 66.1969L276.944 66.7492L278.64 63.9923L278.927 63.5266ZM275.672 66.9082L275 68L276.272 67.841L281.487 67.1892C282.547 67.7085 283.74 68 285 68C289.418 68 293 64.4183 293 60C293 55.5817 289.418 52 285 52C280.582 52 277 55.5817 277 60C277 61.2426 277.283 62.419 277.789 63.4682L275.672 66.9082Z"),E(h,"fill","var(--fg-toolbar)"),E(m,"id","tool-comments"),E(x,"id","fg-toolbar_2"),E(x,"fill-rule","evenodd"),E(x,"clip-rule","evenodd"),E(x,"d","M238 52H238.5H244.5H250.5H251V52.5V56H250V53H245V67H248V68H244.5H241V67H244V53H239V56H238V52.5V52Z"),E(x,"fill","var(--fg-toolbar)"),E(v,"id","tool-text"),E(b,"id","fg-toolbar_3"),E(b,"fill-rule","evenodd"),E(b,"clip-rule","evenodd"),E(b,"d","M206.122 55.6407L206.11 55.6374L199.444 53.7366L204.353 58.6462C204.549 58.5525 204.768 58.5 205 58.5C205.828 58.5 206.5 59.1716 206.5 60C206.5 60.8284 205.828 61.5 205 61.5C204.172 61.5 203.5 60.8284 203.5 60C203.5 59.7684 203.552 59.5491 203.646 59.3533L198.743 54.4496L200.575 60.8403L200.585 60.8768L200.593 60.914C201.015 62.9612 202.829 64.5 205 64.5C205.495 64.5 205.968 64.4206 206.411 64.2746L206.996 64.0817L207.431 64.5172L209.278 66.364L211.4 64.2426L209.535 62.3777L209.104 61.9472L209.289 61.3672C209.426 60.9373 209.5 60.4783 209.5 60C209.5 57.9074 208.071 56.1461 206.134 55.6437L206.122 55.6407ZM212.107 63.5355L212.814 64.2426L212.107 64.9497L209.985 67.0711L209.278 67.7782L208.571 67.0711L206.724 65.2243C206.182 65.4032 205.602 65.5 205 65.5C202.345 65.5 200.129 63.6184 199.613 61.1159L197.325 53.1324L197 52L198.133 52.323L206.385 54.6758C208.752 55.2896 210.5 57.4407 210.5 60C210.5 60.5825 210.409 61.1438 210.242 61.6706L212.107 63.5355Z"),E(b,"fill","var(--fg-toolbar)"),E(w,"id","tool-pen"),E(V,"id","fg-toolbar_4"),E(V,"fill-rule","evenodd"),E(V,"clip-rule","evenodd"),E(V,"d","M151 53H165V67H151V53ZM150 52H151H165H166V53V67V68H165H151H150V67V53V52ZM177.475 59.4749L177.828 59.1213L177.121 58.4142L176.768 58.7678L175 60.5355L173.232 58.7678L172.879 58.4142L172.172 59.1213L172.525 59.4749L174.646 61.5962L175 61.9497L175.354 61.5962L177.475 59.4749Z"),E(V,"fill","var(--fg-toolbar)"),E(H,"id","tool-rectangle"),E(y,"id","Union"),E(y,"fill-rule","evenodd"),E(y,"clip-rule","evenodd"),E(y,"d","M105 65L105 68H106L106 65H114V68H115V65H118V64H115L115 56H118V55H115V52H114V55H106L106 52H105L105 55H102V56H105L105 64H102V65H105ZM114 56L114 64H106L106 56H114ZM129.475 59.4749L129.828 59.1213L129.121 58.4142L128.768 58.7678L127 60.5355L125.232 58.7678L124.879 58.4142L124.172 59.1213L124.525 59.4749L126.646 61.5962L127 61.9497L127.354 61.5962L129.475 59.4749Z"),E(y,"fill","var(--fg-toolbar)"),E(L,"id","tool-frame"),E(Z,"width","48"),E(Z,"height","40"),E(Z,"transform","translate(41 40)"),E(Z,"fill","var(--bg-toolbar-active)"),E(k,"id","fg-toolbar-active"),E(k,"fill-rule","evenodd"),E(k,"clip-rule","evenodd"),E(k,"d","M56.6457 53.0721L55.666 52.4799L55.8974 53.6011L58.5801 66.6011L58.8231 67.7786L59.4867 66.776L62.5251 62.1855L67.7444 60.769L68.8719 60.463L67.8721 59.8586L56.6457 53.0721ZM59.3165 65.2214L57.1081 54.5202L66.3549 60.1099L62.0813 61.2698L61.8994 61.3192L61.7953 61.4764L59.3165 65.2214ZM79.4752 59.4749L79.8288 59.1213L79.1217 58.4142L78.7681 58.7678L77.0004 60.5355L75.2326 58.7678L74.879 58.4142L74.1719 59.1213L74.5255 59.4749L76.6468 61.5962L77.0004 61.9497L77.3539 61.5962L79.4752 59.4749Z"),E(k,"fill","var(--fg-toolbar-active)"),E(M,"id","bg-toolbar-active"),E(O,"id","fg-toolbar_5"),E(O,"fill-rule","evenodd"),E(O,"clip-rule","evenodd"),E(O,"d","M28 54.5H14V55.5H28V54.5ZM14 59.5H28V60.5H14V59.5ZM14 64.5H28V65.5H14V64.5Z"),E(O,"fill","var(--fg-toolbar)"),E(I,"id","tool-menu"),E(g,"id","Tools"),E(A,"width","40"),E(A,"height","40"),E(A,"transform","translate(976 40)"),E(A,"fill","var(--bg-toolbar)"),E(P,"id","fg-toolbar_7"),E(P,"fill-rule","evenodd"),E(P,"clip-rule","evenodd"),E(P,"d","M993 54.0979L993.765 54.576L1001.76 59.576L1002.44 60L1001.76 60.424L993.765 65.424L993 65.9021V65V55V54.0979ZM994 55.9021V64.0979L1000.56 60L994 55.9021Z"),E(P,"fill","var(--fg-toolbar)"),E(F,"id","fg-toolbar_6"),E(S,"id","Play"),E(D,"width","40"),E(D,"height","40"),E(D,"transform","translate(864 40)"),E(D,"fill","var(--bg-toolbar)"),E(N,"id","Ellipse 2"),E(N,"cx","884"),E(N,"cy","60"),E(N,"r","12"),E(N,"fill","#050505"),E(j,"id","avatar (photo)"),E(R,"id","Avatar"),E(q,"width","176"),E(q,"height","40"),E(q,"transform","translate(365 40)"),E(q,"fill","var(--bg-toolbar)"),E(W,"id","fg-toolbar_8"),E(W,"fill-rule","evenodd"),E(W,"clip-rule","evenodd"),E(W,"d","M375.793 59.5L376.147 59.1464L384.147 51.1464L384.5 50.7928L384.854 51.1464L392.854 59.1464L393.207 59.5L392.5 60.2071L392.147 59.8535L384.5 52.2071L377.207 59.5L384.5 66.7928L388.147 63.1464L388.5 62.7928L389.207 63.5L388.854 63.8535L384.854 67.8535L384.5 68.2071L384.147 67.8535L376.147 59.8535L375.793 59.5ZM383.707 59H386C389.314 59 392 61.6863 392 65C392 66.6569 391.328 68.1569 390.243 69.2426L389.536 68.5355C390.44 67.6307 391 66.3807 391 65C391 62.2386 388.761 60 386 60H383.707L385.354 61.6464L384.646 62.3536L382.146 59.8536L381.793 59.5L382.146 59.1464L384.646 56.6464L385.354 57.3536L383.707 59Z"),E(W,"fill","var(--fg-toolbar)"),E(G,"id","component-reset"),E(Y,"id","fg-toolbar_9"),E(Y,"fill-rule","evenodd"),E(Y,"clip-rule","evenodd"),E(Y,"d","M423.27 56.1446L422.562 55.4375L423.27 54.7304L425.793 52.2071L426.5 51.5L427.207 52.2071L429.73 54.7304L430.438 55.4375L429.73 56.1446L427.207 58.6679L426.5 59.375L425.793 58.6679L423.27 56.1446ZM426.5 57.9608L429.023 55.4375L426.5 52.9142L423.977 55.4375L426.5 57.9608ZM423.27 66.2696L422.562 65.5625L423.27 64.8554L425.793 62.3321L426.5 61.625L427.207 62.3321L429.73 64.8554L430.438 65.5625L429.73 66.2696L427.207 68.7929L426.5 69.5L425.793 68.7929L423.27 66.2696ZM426.5 68.0858L429.023 65.5625L426.5 63.0392L423.977 65.5625L426.5 68.0858ZM417.5 60.5L418.207 61.2071L420.73 63.7304L421.438 64.4375L422.145 63.7304L424.668 61.2071L425.375 60.5L424.668 59.7929L422.145 57.2696L421.438 56.5625L420.73 57.2696L418.207 59.7929L417.5 60.5ZM423.961 60.5L421.438 63.0233L418.914 60.5L421.438 57.9767L423.961 60.5ZM428.332 61.2071L427.625 60.5L428.332 59.7929L430.855 57.2696L431.562 56.5625L432.27 57.2696L434.793 59.7929L435.5 60.5L434.793 61.2071L432.27 63.7304L431.562 64.4375L430.855 63.7304L428.332 61.2071ZM431.562 63.0233L434.086 60.5L431.562 57.9767L429.039 60.5L431.562 63.0233ZM445.475 59.4749L445.828 59.1213L445.121 58.4142L444.768 58.7678L443 60.5355L441.232 58.7678L440.879 58.4142L440.172 59.1213L440.525 59.4749L442.646 61.5962L443 61.9497L443.354 61.5962L445.475 59.4749Z"),E(Y,"fill","var(--fg-toolbar)"),E(X,"id","component-create"),E(Q,"id","fg-toolbar_10"),E(Q,"fill-rule","evenodd"),E(Q,"clip-rule","evenodd"),E(Q,"d","M480 60C480 63.866 476.866 67 473 67C472.214 67 471.458 66.8705 470.753 66.6316C472.723 65.1743 474 62.8343 474 60.1959C474 57.3971 472.563 54.934 470.386 53.5044C471.194 53.1791 472.076 53 473 53C476.866 53 480 56.134 480 60ZM469.701 67.2902C470.707 67.7461 471.824 68 473 68C477.418 68 481 64.4183 481 60C481 55.5817 477.418 52 473 52C468.582 52 465 55.5817 465 60C465 60 465 60.0001 465 60.0001C465 63.2421 466.928 66.0337 469.701 67.2903C469.701 67.2903 469.701 67.2903 469.701 67.2902Z"),E(Q,"fill","var(--fg-toolbar)"),E(K,"id","mask-selection"),E(J,"id","tool-mask"),E(te,"id","fg-toolbar_11"),E(te,"fill-rule","evenodd"),E(te,"clip-rule","evenodd"),E(te,"d","M506 52H517V57H522V68H511V63H506V52ZM533.475 59.4749L533.828 59.1213L533.121 58.4142L532.768 58.7678L531 60.5355L529.232 58.7678L528.879 58.4142L528.172 59.1213L528.525 59.4749L530.646 61.5962L531 61.9497L531.354 61.5962L533.475 59.4749Z"),E(te,"fill","var(--fg-toolbar)"),E(ee,"id","tool-boolean-union"),E(U,"id","Actions"),E(oe,"width","64"),E(oe,"height","40"),E(oe,"transform","translate(912 40)"),E(oe,"fill","var(--bg-toolbar)"),E(re,"id","bg-primary-btn_2"),E(re,"x","917"),E(re,"y","45"),E(re,"width","54"),E(re,"height","30"),E(re,"rx","6"),E(re,"fill","var(--bg-toolbar-active)"),E(ie,"id","fg-toolbar-active_2"),E(ie,"d","M933.756 58.1016H934.92C934.885 56.8203 933.752 55.8906 932.127 55.8906C930.522 55.8906 929.291 56.8086 929.291 58.1875C929.291 59.3008 930.088 59.9531 931.373 60.3008L932.319 60.5586C933.174 60.7852 933.834 61.0664 933.834 61.7773C933.834 62.5586 933.088 63.0742 932.061 63.0742C931.131 63.0742 930.358 62.6602 930.288 61.7891H929.077C929.155 63.2383 930.276 64.1328 932.069 64.1328C933.948 64.1328 935.03 63.1445 935.03 61.7891C935.03 60.3477 933.745 59.7891 932.729 59.5391L931.948 59.3359C931.323 59.1758 930.491 58.8828 930.495 58.1172C930.495 57.4375 931.116 56.9336 932.1 56.9336C933.018 56.9336 933.67 57.3633 933.756 58.1016ZM937.656 60.4375C937.656 59.4805 938.262 58.9336 939.094 58.9336C939.898 58.9336 940.379 59.4453 940.379 60.3242V64H941.547V60.1836C941.547 58.6875 940.727 57.9219 939.492 57.9219C938.559 57.9219 937.996 58.3281 937.715 58.9766H937.641V56H936.488V64H937.656V60.4375ZM944.962 64.1328C945.954 64.1328 946.512 63.6289 946.735 63.1797H946.782V64H947.923V60.0156C947.923 58.2695 946.548 57.9219 945.594 57.9219C944.508 57.9219 943.508 58.3594 943.118 59.4531L944.216 59.7031C944.387 59.2773 944.825 58.8672 945.61 58.8672C946.364 58.8672 946.751 59.2617 946.751 59.9414V59.9687C946.751 60.3945 946.313 60.3867 945.235 60.5117C944.098 60.6445 942.934 60.9414 942.934 62.3047C942.934 63.4844 943.821 64.1328 944.962 64.1328ZM945.216 63.1953C944.555 63.1953 944.079 62.8984 944.079 62.3203C944.079 61.6953 944.633 61.4727 945.309 61.3828C945.688 61.332 946.587 61.2305 946.755 61.0625V61.8359C946.755 62.5469 946.188 63.1953 945.216 63.1953ZM949.588 64H950.756V60.3359C950.756 59.5508 951.362 58.9844 952.19 58.9844C952.432 58.9844 952.705 59.0273 952.799 59.0547V57.9375C952.682 57.9219 952.451 57.9102 952.303 57.9102C951.6 57.9102 950.998 58.3086 950.78 58.9531H950.717V58H949.588V64ZM956.291 64.1211C957.6 64.1211 958.525 63.4766 958.791 62.5L957.686 62.3008C957.475 62.8672 956.967 63.1562 956.303 63.1562C955.303 63.1562 954.631 62.5078 954.6 61.3516H958.865V60.9375C958.865 58.7695 957.568 57.9219 956.209 57.9219C954.537 57.9219 953.436 59.1953 953.436 61.0391C953.436 62.9023 954.521 64.1211 956.291 64.1211ZM954.603 60.4766C954.65 59.625 955.268 58.8867 956.217 58.8867C957.123 58.8867 957.717 59.5586 957.721 60.4766H954.603Z"),E(ie,"fill","var(--fg-toolbar-active)"),E(ne,"id","Share button"),E(se,"width","64"),E(se,"height","40"),E(se,"transform","translate(1017 40)"),E(se,"fill","var(--bg-toolbar-active)"),E(ae,"id","fg-toolbar_12"),E(ae,"d","M1033.4 56H1032.43L1030.43 57.3281V58.3125L1032.38 57.0156H1032.43V64H1033.4V56ZM1038.42 64.1094C1040.19 64.1094 1041.2 62.6133 1041.2 60C1041.2 57.4063 1040.17 55.8906 1038.42 55.8906C1036.67 55.8906 1035.64 57.4063 1035.64 60C1035.64 62.6133 1036.65 64.1094 1038.42 64.1094ZM1038.42 63.25C1037.26 63.25 1036.58 62.082 1036.58 60C1036.58 57.9219 1037.26 56.7344 1038.42 56.7344C1039.58 56.7344 1040.26 57.9219 1040.26 60C1040.26 62.082 1039.58 63.25 1038.42 63.25ZM1045.4 64.1094C1047.17 64.1094 1048.19 62.6133 1048.19 60C1048.19 57.4063 1047.16 55.8906 1045.4 55.8906C1043.65 55.8906 1042.62 57.4063 1042.62 60C1042.62 62.6133 1043.64 64.1094 1045.4 64.1094ZM1045.4 63.25C1044.24 63.25 1043.56 62.082 1043.56 60C1043.56 57.9219 1044.25 56.7344 1045.4 56.7344C1046.56 56.7344 1047.25 57.9219 1047.25 60C1047.25 62.082 1046.57 63.25 1045.4 63.25ZM1053.86 62.5C1053.86 63.375 1054.41 64.1094 1055.42 64.1094C1056.42 64.1094 1056.97 63.375 1056.97 62.5V62.0781C1056.97 61.2031 1056.44 60.4687 1055.42 60.4687C1054.42 60.4687 1053.86 61.2031 1053.86 62.0781V62.5ZM1049.87 57.9219C1049.87 58.7969 1050.42 59.5312 1051.44 59.5312C1052.44 59.5312 1052.98 58.7969 1052.98 57.9219V57.5C1052.98 56.625 1052.45 55.8906 1051.44 55.8906C1050.44 55.8906 1049.87 56.625 1049.87 57.5V57.9219ZM1050.17 64H1051.06L1056.56 56H1055.67L1050.17 64ZM1054.66 62.0781C1054.66 61.5938 1054.87 61.1406 1055.42 61.1406C1055.98 61.1406 1056.17 61.5938 1056.17 62.0781V62.5C1056.17 62.9844 1055.97 63.4375 1055.42 63.4375C1054.86 63.4375 1054.66 62.9844 1054.66 62.5V62.0781ZM1050.67 57.5C1050.67 57.0156 1050.89 56.5625 1051.44 56.5625C1052 56.5625 1052.19 57.0156 1052.19 57.5V57.9219C1052.19 58.4062 1051.98 58.8594 1051.44 58.8594C1050.87 58.8594 1050.67 58.4062 1050.67 57.9219V57.5Z"),E(ae,"fill","var(--fg-toolbar-active)"),E($e,"id","fg-toolbar_14"),E($e,"fill-rule","evenodd"),E($e,"clip-rule","evenodd"),E($e,"d","M1067.65 62.3536L1064.65 59.3536L1065.35 58.6465L1068 61.2929L1070.65 58.6465L1071.35 59.3536L1068.35 62.3536L1068 62.7071L1067.65 62.3536Z"),E($e,"fill","var(--fg-toolbar-active)"),E(ce,"id","fg-toolbar_13"),E(le,"id","bg-primary-btn_3"),E(fe,"width","208"),E(fe,"height","40"),E(fe,"transform","translate(577 40)"),E(fe,"fill","var(--bg-toolbar)"),E(ue,"id","fg-toolbar-foldername"),E(ue,"d","M590.233 65H591.466V61.2812H593.693C596.065 61.2812 597.134 59.8395 597.134 58.0398C597.134 56.2401 596.065 54.8182 593.673 54.8182H590.233V65ZM591.466 60.1875V55.9119H593.634C595.289 55.9119 595.92 56.8168 595.92 58.0398C595.92 59.2628 595.289 60.1875 593.653 60.1875H591.466ZM598.947 65H600.12V60.1676C600.12 59.1335 600.935 58.3778 602.049 58.3778C602.362 58.3778 602.685 58.4375 602.765 58.4574V57.2642C602.631 57.2543 602.322 57.2443 602.148 57.2443C601.234 57.2443 600.438 57.7614 600.16 58.517H600.08V57.3636H598.947V65ZM607.011 65.1591C609.08 65.1591 610.472 63.5881 610.472 61.2216C610.472 58.8352 609.08 57.2642 607.011 57.2642C604.943 57.2642 603.551 58.8352 603.551 61.2216C603.551 63.5881 604.943 65.1591 607.011 65.1591ZM607.011 64.1051C605.44 64.1051 604.724 62.7528 604.724 61.2216C604.724 59.6903 605.44 58.3182 607.011 58.3182C608.582 58.3182 609.298 59.6903 609.298 61.2216C609.298 62.7528 608.582 64.1051 607.011 64.1051ZM612.249 57.3636V65.5568C612.249 66.3324 611.93 66.7699 611.215 66.7699H610.996V67.8636H611.234C612.706 67.8636 613.422 66.9688 613.422 65.5568V57.3636H612.249ZM612.825 56.0909C613.283 56.0909 613.661 55.733 613.661 55.2955C613.661 54.858 613.283 54.5 612.825 54.5C612.368 54.5 611.99 54.858 611.99 55.2955C611.99 55.733 612.368 56.0909 612.825 56.0909ZM618.759 65.1591C620.31 65.1591 621.443 64.3835 621.801 63.2301L620.668 62.9119C620.369 63.7074 619.678 64.1051 618.759 64.1051C617.382 64.1051 616.432 63.2152 616.377 61.5795H621.921V61.0824C621.921 58.2386 620.23 57.2642 618.639 57.2642C616.571 57.2642 615.199 58.8949 615.199 61.2415C615.199 63.5881 616.551 65.1591 618.759 65.1591ZM616.377 60.5653C616.457 59.3771 617.297 58.3182 618.639 58.3182C619.912 58.3182 620.727 59.2727 620.727 60.5653H616.377ZM626.794 65.1591C628.484 65.1591 629.598 64.125 629.796 62.7727H628.623C628.404 63.608 627.708 64.1051 626.794 64.1051C625.402 64.1051 624.507 62.9517 624.507 61.1818C624.507 59.4517 625.421 58.3182 626.794 58.3182C627.828 58.3182 628.444 58.9545 628.623 59.6506H629.796C629.598 58.2188 628.385 57.2642 626.774 57.2642C624.706 57.2642 623.333 58.8949 623.333 61.2216C623.333 63.5085 624.646 65.1591 626.794 65.1591ZM634.819 57.3636H633.188V55.5341H632.015V57.3636H630.861V58.358H632.015V63.1307C632.015 64.4631 633.089 65.0994 634.083 65.0994C634.52 65.0994 634.799 65.0199 634.958 64.9602L634.719 63.9062C634.62 63.9261 634.461 63.9659 634.202 63.9659C633.685 63.9659 633.188 63.8068 633.188 62.8125V58.358H634.819V57.3636ZM641.666 60.4062C641.666 59.0739 642.492 58.3182 643.615 58.3182C644.704 58.3182 645.365 59.0291 645.365 60.2273V65H646.539V60.1477C646.539 58.1989 645.5 57.2642 643.953 57.2642C642.8 57.2642 642.084 57.7812 641.726 58.5568H641.627V57.3636H640.493V65H641.666V60.4062ZM650.916 65.179C652.248 65.179 652.944 64.4631 653.183 63.9659H653.242V65H654.416V59.9688C654.416 57.5426 652.566 57.2642 651.592 57.2642C650.438 57.2642 649.126 57.6619 648.529 59.054L649.643 59.4517C649.902 58.8949 650.513 58.2983 651.632 58.2983C652.71 58.2983 653.242 58.87 653.242 59.8494V59.8892C653.242 60.456 652.666 60.4062 651.274 60.5852C649.857 60.7692 648.311 61.0824 648.311 62.8324C648.311 64.3239 649.464 65.179 650.916 65.179ZM651.095 64.125C650.16 64.125 649.484 63.7074 649.484 62.892C649.484 61.9972 650.299 61.7188 651.214 61.5994C651.711 61.5398 653.044 61.4006 653.242 61.1619V62.2358C653.242 63.1903 652.487 64.125 651.095 64.125ZM656.543 65H657.717V60.2273C657.717 59.1087 658.532 58.3182 659.447 58.3182C660.337 58.3182 660.958 58.8999 660.958 59.7699V65H662.151V60.0284C662.151 59.044 662.768 58.3182 663.842 58.3182C664.677 58.3182 665.393 58.7607 665.393 59.8892V65H666.566V59.8892C666.566 58.0945 665.601 57.2642 664.239 57.2642C663.146 57.2642 662.345 57.7663 661.952 58.5568H661.873C661.495 57.7415 660.829 57.2642 659.824 57.2642C658.83 57.2642 658.094 57.7415 657.776 58.5568H657.677V57.3636H656.543V65ZM671.899 65.1591C673.45 65.1591 674.584 64.3835 674.942 63.2301L673.808 62.9119C673.51 63.7074 672.819 64.1051 671.899 64.1051C670.522 64.1051 669.572 63.2152 669.518 61.5795H675.061V61.0824C675.061 58.2386 673.371 57.2642 671.78 57.2642C669.711 57.2642 668.339 58.8949 668.339 61.2415C668.339 63.5881 669.692 65.1591 671.899 65.1591ZM669.518 60.5653C669.597 59.3771 670.437 58.3182 671.78 58.3182C673.052 58.3182 673.868 59.2727 673.868 60.5653H669.518Z"),E(ue,"fill","var(--fg-toolbar-foldername)"),E(pe,"id","fg-toolbar-filename"),E(pe,"d","M693.233 65H694.466V60.446H698.881V59.3523H694.466V55.9119H699.338V54.8182H693.233V65ZM701.277 65H702.45V57.3636H701.277V65ZM701.873 56.0909C702.331 56.0909 702.708 55.733 702.708 55.2955C702.708 54.858 702.331 54.5 701.873 54.5C701.416 54.5 701.038 54.858 701.038 55.2955C701.038 55.733 701.416 56.0909 701.873 56.0909ZM705.758 54.8182H704.585V65H705.758V54.8182ZM711.095 65.1591C712.646 65.1591 713.78 64.3835 714.138 63.2301L713.004 62.9119C712.706 63.7074 712.015 64.1051 711.095 64.1051C709.718 64.1051 708.768 63.2152 708.714 61.5795H714.257V61.0824C714.257 58.2386 712.566 57.2642 710.976 57.2642C708.907 57.2642 707.535 58.8949 707.535 61.2415C707.535 63.5881 708.888 65.1591 711.095 65.1591ZM708.714 60.5653C708.793 59.3771 709.633 58.3182 710.976 58.3182C712.248 58.3182 713.064 59.2727 713.064 60.5653H708.714ZM721.124 60.4062C721.124 59.0739 721.95 58.3182 723.073 58.3182C724.162 58.3182 724.823 59.0291 724.823 60.2273V65H725.997V60.1477C725.997 58.1989 724.958 57.2642 723.411 57.2642C722.258 57.2642 721.542 57.7812 721.184 58.5568H721.085V57.3636H719.951V65H721.124V60.4062ZM730.374 65.179C731.706 65.179 732.402 64.4631 732.641 63.9659H732.7V65H733.874V59.9688C733.874 57.5426 732.024 57.2642 731.05 57.2642C729.896 57.2642 728.584 57.6619 727.987 59.054L729.101 59.4517C729.36 58.8949 729.971 58.2983 731.09 58.2983C732.168 58.2983 732.7 58.87 732.7 59.8494V59.8892C732.7 60.456 732.124 60.4062 730.732 60.5852C729.315 60.7692 727.769 61.0824 727.769 62.8324C727.769 64.3239 728.922 65.179 730.374 65.179ZM730.553 64.125C729.618 64.125 728.942 63.7074 728.942 62.892C728.942 61.9972 729.757 61.7188 730.672 61.5994C731.169 61.5398 732.502 61.4006 732.7 61.1619V62.2358C732.7 63.1903 731.945 64.125 730.553 64.125ZM736.001 65H737.175V60.2273C737.175 59.1087 737.99 58.3182 738.905 58.3182C739.795 58.3182 740.416 58.8999 740.416 59.7699V65H741.609V60.0284C741.609 59.044 742.226 58.3182 743.3 58.3182C744.135 58.3182 744.851 58.7607 744.851 59.8892V65H746.024V59.8892C746.024 58.0945 745.059 57.2642 743.697 57.2642C742.604 57.2642 741.803 57.7663 741.41 58.5568H741.331C740.953 57.7415 740.287 57.2642 739.283 57.2642C738.288 57.2642 737.552 57.7415 737.234 58.5568H737.135V57.3636H736.001V65ZM751.357 65.1591C752.908 65.1591 754.042 64.3835 754.4 63.2301L753.266 62.9119C752.968 63.7074 752.277 64.1051 751.357 64.1051C749.98 64.1051 749.03 63.2152 748.976 61.5795H754.519V61.0824C754.519 58.2386 752.829 57.2642 751.238 57.2642C749.169 57.2642 747.797 58.8949 747.797 61.2415C747.797 63.5881 749.15 65.1591 751.357 65.1591ZM748.976 60.5653C749.055 59.3771 749.895 58.3182 751.238 58.3182C752.51 58.3182 753.326 59.2727 753.326 60.5653H748.976Z"),E(pe,"fill","var(--fg-toolbar-filename)"),E(Ce,"id","fg-toolbar-chevron_2"),E(Ce,"fill-rule","evenodd"),E(Ce,"clip-rule","evenodd"),E(Ce,"d","M767.829 60.1213L767.475 60.4748L765.354 62.5962L765 62.9497L764.647 62.5962L762.525 60.4748L762.172 60.1213L762.879 59.4142L763.233 59.7677L765 61.5355L766.768 59.7677L767.122 59.4142L767.829 60.1213Z"),E(Ce,"fill","var(--fg-toolbar-chevron)"),E(ge,"id","fg-toolbar-chevron"),E(he,"id","Union_2"),E(he,"fill-rule","evenodd"),E(he,"clip-rule","evenodd"),E(he,"d","M680.031 67.8245L686.031 51.8245L686.968 52.1756L680.968 68.1756L680.031 67.8245Z"),E(he,"fill","var(--fg-toolbar-foldername)"),E(me,"id","fg-toolbar-foldername_2"),E(de,"id","File title"),E(u,"id","bg-header"),E(ve,"id","Rectangle 147"),E(ve,"x","1"),E(ve,"width","1080"),E(ve,"height","40"),E(ve,"fill","var(--bg-header)"),E(xe,"id","bg-tab-active"),E(xe,"x","1"),E(xe,"width","128"),E(xe,"height","40"),E(xe,"fill","var(--bg-tab-active)"),E(we,"id","bg-tab"),E(we,"x","129"),E(we,"width","128"),E(we,"height","40"),E(we,"fill","var(--bg-tab)"),E(be,"id","bg-tab-hover"),E(be,"x","257"),E(be,"width","128"),E(be,"height","40"),E(be,"fill","var(--bg-tab-hover)"),E(He,"id","bg-window-close"),E(He,"x","1041"),E(He,"width","40"),E(He,"height","40"),E(He,"fill","var(--bg-window-close)"),E(Ve,"id","bg-header-control-hover"),E(Ve,"x","1001"),E(Ve,"width","40"),E(Ve,"height","40"),E(Ve,"fill","var(--bg-header-control-hover)"),E(Le,"id","bg-header-control"),E(Le,"x","961"),E(Le,"width","40"),E(Le,"height","40"),E(Le,"fill","var(bg-header-control)"),E(ye,"id","bg-header-control_2"),E(ye,"x","921"),E(ye,"width","40"),E(ye,"height","40"),E(ye,"fill","var(bg-header-control)"),E(Ze,"id","fg-header-control"),E(Ze,"x","1055"),E(Ze,"y","14"),E(Ze,"width","12"),E(Ze,"height","12"),E(Ze,"rx","6"),E(Ze,"fill","var(--fg-header-control-hover)"),E(Me,"id","close"),E(Be,"id","fg-header-control_2"),E(Be,"x","1015"),E(Be,"y","14"),E(Be,"width","12"),E(Be,"height","12"),E(Be,"rx","6"),E(Be,"fill","var(--fg-header-control-hover)"),E(ke,"id","close_2"),E(ze,"id","fg-header-control_3"),E(ze,"x","975"),E(ze,"y","14"),E(ze,"width","12"),E(ze,"height","12"),E(ze,"rx","6"),E(ze,"fill","var(--fg-header-control)"),E(_e,"id","close_3"),E(Te,"id","fg-header-control_5"),E(Te,"d","M937 18L941 22L945 18"),E(Te,"stroke","var(--fg-header-control)"),E(Ie,"id","fg-header-control_4"),E(Oe,"id","bg-toolbar-active"),E(Oe,"x","1.5"),E(Oe,"y","143.5"),E(Oe,"width","215"),E(Oe,"height","27"),E(Oe,"stroke","var(--bg-toolbar-active)"),E(Se,"id","bg-panel-hover"),E(Se,"x","1"),E(Se,"y","116"),E(Se,"width","216"),E(Se,"height","28"),E(Se,"fill","var(--bg-panel-hover)"),E(Ae,"id","text_7"),E(Ae,"x","13"),E(Ae,"y","125"),E(Ae,"width","148"),E(Ae,"height","8"),E(Ae,"rx","2"),E(Ae,"fill","var(--text)"),E(Fe,"id","text_8"),E(Fe,"x","13"),E(Fe,"y","92"),E(Fe,"width","44"),E(Fe,"height","12"),E(Fe,"rx","2"),E(Fe,"fill","var(--text)"),E(Ee,"id","text_9"),E(Ee,"x","65"),E(Ee,"y","92"),E(Ee,"width","44"),E(Ee,"height","12"),E(Ee,"rx","2"),E(Ee,"fill","var(--text)"),E(Pe,"id","text_10"),E(Pe,"x","193"),E(Pe,"y","92"),E(Pe,"width","12"),E(Pe,"height","12"),E(Pe,"rx","2"),E(Pe,"fill","var(--text)"),E(Re,"id","text_11"),E(Re,"x","13"),E(Re,"y","153"),E(Re,"width","112"),E(Re,"height","8"),E(Re,"rx","2"),E(Re,"fill","var(--text)"),E(De,"id","text_12"),E(De,"x","13"),E(De,"y","181"),E(De,"width","112"),E(De,"height","8"),E(De,"rx","2"),E(De,"fill","var(--text)"),E(Ue,"d","M168 158.59V174.605L171.225 171.474L173.479 176.815L177.084 175.28L174.984 170.209H179.591L168 158.59Z"),E(Ue,"fill","white"),E(Ne,"id","background"),E(Ne,"filter","url(#filter0_d)"),E(qe,"id","foreground"),E(qe,"d","M169 172.185V160.997L177.165 169.18H173.471L175.751 174.599L173.907 175.373L171.537 169.736L169 172.185Z"),E(qe,"fill","black"),E(je,"id","System / Arrow"),E(Ge,"id","bg-toolbar-active_2"),E(Ge,"x","1.5"),E(Ge,"y","252.5"),E(Ge,"width","215"),E(Ge,"height","27"),E(Ge,"stroke","var(--bg-toolbar-active)"),E(We,"id","bg-panel-hover_2"),E(We,"x","1"),E(We,"y","224"),E(We,"width","216"),E(We,"height","28"),E(We,"fill","var(--bg-panel-hover)"),E(Xe,"id","fg-component"),E(Xe,"x","29"),E(Xe,"y","234"),E(Xe,"width","148"),E(Xe,"height","8"),E(Xe,"rx","2"),E(Xe,"fill","var(--fg-component)"),E(Ye,"id","fg-component-disabled"),E(Ye,"x","13"),E(Ye,"y","234"),E(Ye,"width","8"),E(Ye,"height","8"),E(Ye,"rx","2"),E(Ye,"fill","var(--fg-component-disabled)"),E(Je,"id","fg-component-disabled_2"),E(Je,"x","13"),E(Je,"y","262"),E(Je,"width","8"),E(Je,"height","8"),E(Je,"rx","2"),E(Je,"fill","var(--fg-component-disabled)"),E(Ke,"id","fg-component-disabled_3"),E(Ke,"x","13"),E(Ke,"y","290"),E(Ke,"width","8"),E(Ke,"height","8"),E(Ke,"rx","2"),E(Ke,"fill","var(--fg-component-disabled)"),E(Qe,"id","fg-component_2"),E(Qe,"x","29"),E(Qe,"y","262"),E(Qe,"width","112"),E(Qe,"height","8"),E(Qe,"rx","2"),E(Qe,"fill","var(--fg-component)"),E(et,"id","fg-component_3"),E(et,"x","29"),E(et,"y","290"),E(et,"width","112"),E(et,"height","8"),E(et,"rx","2"),E(et,"fill","var(--fg-component)"),E(ot,"d","M165 262.59V278.605L168.225 275.474L170.479 280.815L174.084 279.28L171.984 274.209H176.591L165 262.59Z"),E(ot,"fill","white"),E(nt,"id","background_2"),E(nt,"filter","url(#filter1_d)"),E(rt,"id","foreground_2"),E(rt,"d","M166 276.185V264.997L174.165 273.18H170.471L172.751 278.599L170.907 279.373L168.537 273.736L166 276.185Z"),E(rt,"fill","black"),E(tt,"id","System / Arrow_2"),E(st,"d","M1062 19.5902V35.6052L1065.22 32.4738L1067.48 37.8145L1071.08 36.2795L1068.98 31.2092H1073.59L1062 19.5902Z"),E(st,"fill","white"),E(lt,"id","background_3"),E(lt,"filter","url(#filter2_d)"),E(at,"id","foreground_3"),E(at,"d","M1063 33.1854V21.9974L1071.16 30.1804H1067.47L1069.75 35.5989L1067.91 36.3729L1065.54 30.7361L1063 33.1854Z"),E(at,"fill","black"),E(it,"id","System / Arrow_3"),E(dt,"d","M1022 19.5902V35.6052L1025.22 32.4738L1027.48 37.8145L1031.08 36.2795L1028.98 31.2092H1033.59L1022 19.5902Z"),E(dt,"fill","white"),E($t,"id","background_4"),E($t,"filter","url(#filter3_d)"),E(ft,"id","foreground_4"),E(ft,"d","M1023 33.1854V21.9974L1031.16 30.1804H1027.47L1029.75 35.5989L1027.91 36.3729L1025.54 30.7361L1023 33.1854Z"),E(ft,"fill","black"),E(ct,"id","System / Arrow_4"),E(ut,"id","fg-tab"),E(ut,"d","M14.0568 24H15.1136V20.8125H17.0227C19.0554 20.8125 19.9716 19.5767 19.9716 18.0341C19.9716 16.4915 19.0554 15.2727 17.0057 15.2727H14.0568V24ZM15.1136 19.875V16.2102H16.9716C18.3906 16.2102 18.9318 16.9858 18.9318 18.0341C18.9318 19.0824 18.3906 19.875 16.9886 19.875H15.1136ZM21.5376 24H22.5433V19.858C22.5433 18.9716 23.2422 18.3239 24.1967 18.3239C24.4652 18.3239 24.7422 18.375 24.8104 18.392V17.3693C24.6953 17.3608 24.4311 17.3523 24.282 17.3523C23.4979 17.3523 22.8161 17.7955 22.5774 18.4432H22.5092V17.4545H21.5376V24ZM28.4624 24.1364C30.2351 24.1364 31.4283 22.7898 31.4283 20.7614C31.4283 18.7159 30.2351 17.3693 28.4624 17.3693C26.6896 17.3693 25.4964 18.7159 25.4964 20.7614C25.4964 22.7898 26.6896 24.1364 28.4624 24.1364ZM28.4624 23.233C27.1158 23.233 26.5021 22.0739 26.5021 20.7614C26.5021 19.4489 27.1158 18.2727 28.4624 18.2727C29.8089 18.2727 30.4226 19.4489 30.4226 20.7614C30.4226 22.0739 29.8089 23.233 28.4624 23.233ZM32.9634 17.4545V24.4773C32.9634 25.142 32.6907 25.517 32.0771 25.517H31.8896V26.4545H32.0941C33.3555 26.4545 33.9691 25.6875 33.9691 24.4773V17.4545H32.9634ZM33.4577 16.3636C33.8498 16.3636 34.1737 16.0568 34.1737 15.6818C34.1737 15.3068 33.8498 15 33.4577 15C33.0657 15 32.7418 15.3068 32.7418 15.6818C32.7418 16.0568 33.0657 16.3636 33.4577 16.3636ZM38.5554 24.1364C39.8849 24.1364 40.8565 23.4716 41.1634 22.483L40.1918 22.2102C39.9361 22.892 39.3438 23.233 38.5554 23.233C37.375 23.233 36.5611 22.4702 36.5142 21.0682H41.2656V20.642C41.2656 18.2045 39.8168 17.3693 38.4531 17.3693C36.6804 17.3693 35.5043 18.767 35.5043 20.7784C35.5043 22.7898 36.6634 24.1364 38.5554 24.1364ZM36.5142 20.1989C36.5824 19.1804 37.3026 18.2727 38.4531 18.2727C39.544 18.2727 40.2429 19.0909 40.2429 20.1989H36.5142ZM45.4545 24.1364C46.9034 24.1364 47.858 23.25 48.0284 22.0909H47.0227C46.8352 22.8068 46.2386 23.233 45.4545 23.233C44.2614 23.233 43.4943 22.2443 43.4943 20.7273C43.4943 19.2443 44.2784 18.2727 45.4545 18.2727C46.3409 18.2727 46.8693 18.8182 47.0227 19.4148H48.0284C47.858 18.1875 46.8182 17.3693 45.4375 17.3693C43.6648 17.3693 42.4886 18.767 42.4886 20.7614C42.4886 22.7216 43.6136 24.1364 45.4545 24.1364ZM52.3452 17.4545H50.9474V15.8864H49.9418V17.4545H48.9531V18.3068H49.9418V22.3977C49.9418 23.5398 50.8622 24.0852 51.7145 24.0852C52.0895 24.0852 52.3281 24.017 52.4645 23.9659L52.2599 23.0625C52.1747 23.0795 52.0384 23.1136 51.8168 23.1136C51.3736 23.1136 50.9474 22.9773 50.9474 22.125V18.3068H52.3452V17.4545ZM58.2386 20.0625C58.2386 18.9205 58.946 18.2727 59.9091 18.2727C60.8423 18.2727 61.4091 18.8821 61.4091 19.9091V24H62.4148V19.8409C62.4148 18.1705 61.5241 17.3693 60.1989 17.3693C59.2102 17.3693 58.5966 17.8125 58.2898 18.4773H58.2045V17.4545H57.233V24H58.2386V20.0625ZM66.1786 24.1534C67.3207 24.1534 67.9173 23.5398 68.1218 23.1136H68.1729V24H69.1786V19.6875C69.1786 17.608 67.5934 17.3693 66.7582 17.3693C65.7695 17.3693 64.6445 17.7102 64.1332 18.9034L65.0877 19.2443C65.3093 18.767 65.8335 18.2557 66.7923 18.2557C67.717 18.2557 68.1729 18.7457 68.1729 19.5852V19.6193C68.1729 20.1051 67.6786 20.0625 66.4854 20.2159C65.271 20.3736 63.9457 20.642 63.9457 22.142C63.9457 23.4205 64.9343 24.1534 66.1786 24.1534ZM66.332 23.25C65.5309 23.25 64.9513 22.892 64.9513 22.1932C64.9513 21.4261 65.6502 21.1875 66.4343 21.0852C66.8604 21.0341 68.0025 20.9148 68.1729 20.7102V21.6307C68.1729 22.4489 67.5252 23.25 66.332 23.25ZM71.0142 24H72.0199V19.9091C72.0199 18.9503 72.7188 18.2727 73.5028 18.2727C74.2656 18.2727 74.7983 18.7713 74.7983 19.517V24H75.821V19.7386C75.821 18.8949 76.3494 18.2727 77.2699 18.2727C77.9858 18.2727 78.5994 18.652 78.5994 19.6193V24H79.6051V19.6193C79.6051 18.081 78.7784 17.3693 77.6108 17.3693C76.6733 17.3693 75.9872 17.7997 75.6506 18.4773H75.5824C75.2585 17.7784 74.6875 17.3693 73.8267 17.3693C72.9744 17.3693 72.3438 17.7784 72.071 18.4773H71.9858V17.4545H71.0142V24ZM84.1882 24.1364C85.5178 24.1364 86.4893 23.4716 86.7962 22.483L85.8246 22.2102C85.5689 22.892 84.9766 23.233 84.1882 23.233C83.0078 23.233 82.1939 22.4702 82.147 21.0682H86.8984V20.642C86.8984 18.2045 85.4496 17.3693 84.0859 17.3693C82.3132 17.3693 81.1371 18.767 81.1371 20.7784C81.1371 22.7898 82.2962 24.1364 84.1882 24.1364ZM82.147 20.1989C82.2152 19.1804 82.9354 18.2727 84.0859 18.2727C85.1768 18.2727 85.8757 19.0909 85.8757 20.1989H82.147ZM94.8544 15.2727H93.7976L91.6158 16.7216V17.7955L93.7464 16.3807H93.7976V24H94.8544V15.2727Z"),E(ut,"fill","var(--fg-tab)"),E(pt,"id","fg-tab"),E(pt,"d","M142.057 24H143.114V20.8125H145.023C147.055 20.8125 147.972 19.5767 147.972 18.0341C147.972 16.4915 147.055 15.2727 145.006 15.2727H142.057V24ZM143.114 19.875V16.2102H144.972C146.391 16.2102 146.932 16.9858 146.932 18.0341C146.932 19.0824 146.391 19.875 144.989 19.875H143.114ZM149.538 24H150.543V19.858C150.543 18.9716 151.242 18.3239 152.197 18.3239C152.465 18.3239 152.742 18.375 152.81 18.392V17.3693C152.695 17.3608 152.431 17.3523 152.282 17.3523C151.498 17.3523 150.816 17.7955 150.577 18.4432H150.509V17.4545H149.538V24ZM156.462 24.1364C158.235 24.1364 159.428 22.7898 159.428 20.7614C159.428 18.7159 158.235 17.3693 156.462 17.3693C154.69 17.3693 153.496 18.7159 153.496 20.7614C153.496 22.7898 154.69 24.1364 156.462 24.1364ZM156.462 23.233C155.116 23.233 154.502 22.0739 154.502 20.7614C154.502 19.4489 155.116 18.2727 156.462 18.2727C157.809 18.2727 158.423 19.4489 158.423 20.7614C158.423 22.0739 157.809 23.233 156.462 23.233ZM160.963 17.4545V24.4773C160.963 25.142 160.691 25.517 160.077 25.517H159.89V26.4545H160.094C161.355 26.4545 161.969 25.6875 161.969 24.4773V17.4545H160.963ZM161.458 16.3636C161.85 16.3636 162.174 16.0568 162.174 15.6818C162.174 15.3068 161.85 15 161.458 15C161.066 15 160.742 15.3068 160.742 15.6818C160.742 16.0568 161.066 16.3636 161.458 16.3636ZM166.555 24.1364C167.885 24.1364 168.857 23.4716 169.163 22.483L168.192 22.2102C167.936 22.892 167.344 23.233 166.555 23.233C165.375 23.233 164.561 22.4702 164.514 21.0682H169.266V20.642C169.266 18.2045 167.817 17.3693 166.453 17.3693C164.68 17.3693 163.504 18.767 163.504 20.7784C163.504 22.7898 164.663 24.1364 166.555 24.1364ZM164.514 20.1989C164.582 19.1804 165.303 18.2727 166.453 18.2727C167.544 18.2727 168.243 19.0909 168.243 20.1989H164.514ZM173.455 24.1364C174.903 24.1364 175.858 23.25 176.028 22.0909H175.023C174.835 22.8068 174.239 23.233 173.455 23.233C172.261 23.233 171.494 22.2443 171.494 20.7273C171.494 19.2443 172.278 18.2727 173.455 18.2727C174.341 18.2727 174.869 18.8182 175.023 19.4148H176.028C175.858 18.1875 174.818 17.3693 173.438 17.3693C171.665 17.3693 170.489 18.767 170.489 20.7614C170.489 22.7216 171.614 24.1364 173.455 24.1364ZM180.345 17.4545H178.947V15.8864H177.942V17.4545H176.953V18.3068H177.942V22.3977C177.942 23.5398 178.862 24.0852 179.714 24.0852C180.089 24.0852 180.328 24.017 180.464 23.9659L180.26 23.0625C180.175 23.0795 180.038 23.1136 179.817 23.1136C179.374 23.1136 178.947 22.9773 178.947 22.125V18.3068H180.345V17.4545ZM186.239 20.0625C186.239 18.9205 186.946 18.2727 187.909 18.2727C188.842 18.2727 189.409 18.8821 189.409 19.9091V24H190.415V19.8409C190.415 18.1705 189.524 17.3693 188.199 17.3693C187.21 17.3693 186.597 17.8125 186.29 18.4773H186.205V17.4545H185.233V24H186.239V20.0625ZM194.179 24.1534C195.321 24.1534 195.917 23.5398 196.122 23.1136H196.173V24H197.179V19.6875C197.179 17.608 195.593 17.3693 194.758 17.3693C193.77 17.3693 192.645 17.7102 192.133 18.9034L193.088 19.2443C193.309 18.767 193.833 18.2557 194.792 18.2557C195.717 18.2557 196.173 18.7457 196.173 19.5852V19.6193C196.173 20.1051 195.679 20.0625 194.485 20.2159C193.271 20.3736 191.946 20.642 191.946 22.142C191.946 23.4205 192.934 24.1534 194.179 24.1534ZM194.332 23.25C193.531 23.25 192.951 22.892 192.951 22.1932C192.951 21.4261 193.65 21.1875 194.434 21.0852C194.86 21.0341 196.002 20.9148 196.173 20.7102V21.6307C196.173 22.4489 195.525 23.25 194.332 23.25ZM199.014 24H200.02V19.9091C200.02 18.9503 200.719 18.2727 201.503 18.2727C202.266 18.2727 202.798 18.7713 202.798 19.517V24H203.821V19.7386C203.821 18.8949 204.349 18.2727 205.27 18.2727C205.986 18.2727 206.599 18.652 206.599 19.6193V24H207.605V19.6193C207.605 18.081 206.778 17.3693 205.611 17.3693C204.673 17.3693 203.987 17.7997 203.651 18.4773H203.582C203.259 17.7784 202.688 17.3693 201.827 17.3693C200.974 17.3693 200.344 17.7784 200.071 18.4773H199.986V17.4545H199.014V24ZM212.188 24.1364C213.518 24.1364 214.489 23.4716 214.796 22.483L213.825 22.2102C213.569 22.892 212.977 23.233 212.188 23.233C211.008 23.233 210.194 22.4702 210.147 21.0682H214.898V20.642C214.898 18.2045 213.45 17.3693 212.086 17.3693C210.313 17.3693 209.137 18.767 209.137 20.7784C209.137 22.7898 210.296 24.1364 212.188 24.1364ZM210.147 20.1989C210.215 19.1804 210.935 18.2727 212.086 18.2727C213.177 18.2727 213.876 19.0909 213.876 20.1989H210.147ZM219.786 24H225.292V23.0625H221.235V22.9943L223.195 20.8977C224.695 19.2912 225.138 18.5412 225.138 17.5739C225.138 16.2273 224.048 15.1534 222.513 15.1534C220.984 15.1534 219.82 16.1932 219.82 17.7273H220.826C220.826 16.7344 221.469 16.0739 222.479 16.0739C223.425 16.0739 224.15 16.6534 224.15 17.5739C224.15 18.3793 223.677 18.9759 222.667 20.0795L219.786 23.233V24Z"),E(pt,"fill","var(--fg-tab)"),E(gt,"id","fg-tab-hover"),E(gt,"d","M270.057 24H271.114V20.8125H273.023C275.055 20.8125 275.972 19.5767 275.972 18.0341C275.972 16.4915 275.055 15.2727 273.006 15.2727H270.057V24ZM271.114 19.875V16.2102H272.972C274.391 16.2102 274.932 16.9858 274.932 18.0341C274.932 19.0824 274.391 19.875 272.989 19.875H271.114ZM277.538 24H278.543V19.858C278.543 18.9716 279.242 18.3239 280.197 18.3239C280.465 18.3239 280.742 18.375 280.81 18.392V17.3693C280.695 17.3608 280.431 17.3523 280.282 17.3523C279.498 17.3523 278.816 17.7955 278.577 18.4432H278.509V17.4545H277.538V24ZM284.462 24.1364C286.235 24.1364 287.428 22.7898 287.428 20.7614C287.428 18.7159 286.235 17.3693 284.462 17.3693C282.69 17.3693 281.496 18.7159 281.496 20.7614C281.496 22.7898 282.69 24.1364 284.462 24.1364ZM284.462 23.233C283.116 23.233 282.502 22.0739 282.502 20.7614C282.502 19.4489 283.116 18.2727 284.462 18.2727C285.809 18.2727 286.423 19.4489 286.423 20.7614C286.423 22.0739 285.809 23.233 284.462 23.233ZM288.963 17.4545V24.4773C288.963 25.142 288.691 25.517 288.077 25.517H287.89V26.4545H288.094C289.355 26.4545 289.969 25.6875 289.969 24.4773V17.4545H288.963ZM289.458 16.3636C289.85 16.3636 290.174 16.0568 290.174 15.6818C290.174 15.3068 289.85 15 289.458 15C289.066 15 288.742 15.3068 288.742 15.6818C288.742 16.0568 289.066 16.3636 289.458 16.3636ZM294.555 24.1364C295.885 24.1364 296.857 23.4716 297.163 22.483L296.192 22.2102C295.936 22.892 295.344 23.233 294.555 23.233C293.375 23.233 292.561 22.4702 292.514 21.0682H297.266V20.642C297.266 18.2045 295.817 17.3693 294.453 17.3693C292.68 17.3693 291.504 18.767 291.504 20.7784C291.504 22.7898 292.663 24.1364 294.555 24.1364ZM292.514 20.1989C292.582 19.1804 293.303 18.2727 294.453 18.2727C295.544 18.2727 296.243 19.0909 296.243 20.1989H292.514ZM301.455 24.1364C302.903 24.1364 303.858 23.25 304.028 22.0909H303.023C302.835 22.8068 302.239 23.233 301.455 23.233C300.261 23.233 299.494 22.2443 299.494 20.7273C299.494 19.2443 300.278 18.2727 301.455 18.2727C302.341 18.2727 302.869 18.8182 303.023 19.4148H304.028C303.858 18.1875 302.818 17.3693 301.438 17.3693C299.665 17.3693 298.489 18.767 298.489 20.7614C298.489 22.7216 299.614 24.1364 301.455 24.1364ZM308.345 17.4545H306.947V15.8864H305.942V17.4545H304.953V18.3068H305.942V22.3977C305.942 23.5398 306.862 24.0852 307.714 24.0852C308.089 24.0852 308.328 24.017 308.464 23.9659L308.26 23.0625C308.175 23.0795 308.038 23.1136 307.817 23.1136C307.374 23.1136 306.947 22.9773 306.947 22.125V18.3068H308.345V17.4545ZM314.239 20.0625C314.239 18.9205 314.946 18.2727 315.909 18.2727C316.842 18.2727 317.409 18.8821 317.409 19.9091V24H318.415V19.8409C318.415 18.1705 317.524 17.3693 316.199 17.3693C315.21 17.3693 314.597 17.8125 314.29 18.4773H314.205V17.4545H313.233V24H314.239V20.0625ZM322.179 24.1534C323.321 24.1534 323.917 23.5398 324.122 23.1136H324.173V24H325.179V19.6875C325.179 17.608 323.593 17.3693 322.758 17.3693C321.77 17.3693 320.645 17.7102 320.133 18.9034L321.088 19.2443C321.309 18.767 321.833 18.2557 322.792 18.2557C323.717 18.2557 324.173 18.7457 324.173 19.5852V19.6193C324.173 20.1051 323.679 20.0625 322.485 20.2159C321.271 20.3736 319.946 20.642 319.946 22.142C319.946 23.4205 320.934 24.1534 322.179 24.1534ZM322.332 23.25C321.531 23.25 320.951 22.892 320.951 22.1932C320.951 21.4261 321.65 21.1875 322.434 21.0852C322.86 21.0341 324.002 20.9148 324.173 20.7102V21.6307C324.173 22.4489 323.525 23.25 322.332 23.25ZM327.014 24H328.02V19.9091C328.02 18.9503 328.719 18.2727 329.503 18.2727C330.266 18.2727 330.798 18.7713 330.798 19.517V24H331.821V19.7386C331.821 18.8949 332.349 18.2727 333.27 18.2727C333.986 18.2727 334.599 18.652 334.599 19.6193V24H335.605V19.6193C335.605 18.081 334.778 17.3693 333.611 17.3693C332.673 17.3693 331.987 17.7997 331.651 18.4773H331.582C331.259 17.7784 330.688 17.3693 329.827 17.3693C328.974 17.3693 328.344 17.7784 328.071 18.4773H327.986V17.4545H327.014V24ZM340.188 24.1364C341.518 24.1364 342.489 23.4716 342.796 22.483L341.825 22.2102C341.569 22.892 340.977 23.233 340.188 23.233C339.008 23.233 338.194 22.4702 338.147 21.0682H342.898V20.642C342.898 18.2045 341.45 17.3693 340.086 17.3693C338.313 17.3693 337.137 18.767 337.137 20.7784C337.137 22.7898 338.296 24.1364 340.188 24.1364ZM338.147 20.1989C338.215 19.1804 338.935 18.2727 340.086 18.2727C341.177 18.2727 341.876 19.0909 341.876 20.1989H338.147ZM350.735 24.1193C352.427 24.1193 353.684 23.0582 353.684 21.6307C353.684 20.5227 353.028 19.7173 351.928 19.5341V19.4659C352.81 19.1974 353.36 18.473 353.36 17.4886C353.36 16.2528 352.384 15.1534 350.769 15.1534C349.261 15.1534 348.008 16.0824 347.957 17.4545H348.979C349.018 16.5852 349.844 16.0739 350.752 16.0739C351.715 16.0739 352.337 16.6577 352.337 17.5398C352.337 18.4602 351.617 19.0568 350.582 19.0568H349.883V19.9943H350.582C351.907 19.9943 352.644 20.6676 352.644 21.6307C352.644 22.5554 351.839 23.1818 350.718 23.1818C349.708 23.1818 348.907 22.6619 348.843 21.8182H347.769C347.833 23.1903 349.043 24.1193 350.735 24.1193Z"),E(gt,"fill","var(--fg-tab-hover)"),E(ht,"d","M311 23.5902V39.6052L314.225 36.4738L316.479 41.8145L320.084 40.2795L317.984 35.2092H322.591L311 23.5902Z"),E(ht,"fill","white"),E(mt,"id","background_5"),E(mt,"filter","url(#filter4_d)"),E(vt,"id","foreground_5"),E(vt,"d","M312 37.1854V25.9974L320.165 34.1804H316.471L318.751 39.5989L316.907 40.3729L314.537 34.7361L312 37.1854Z"),E(vt,"fill","black"),E(Ct,"id","System / Arrow_5"),E(wt,"id","fg-tab-active_3"),E(wt,"d","M116 17L110 23M110 17L116 23"),E(wt,"stroke","var(--fg-tab-active)"),E(xt,"id","fg-tab-active_2"),E(Ht,"id","fg-tab-active_5"),E(Ht,"d","M246 17L240 23M240 17L246 23"),E(Ht,"stroke","var(--fg-tab-active)"),E(bt,"id","fg-tab-active_4"),E(Lt,"id","fg-tab-hover_3"),E(Lt,"d","M374 17L368 23M368 17L374 23"),E(Lt,"stroke","var(--fg-tab-hover)"),E(Vt,"id","fg-tab-hover_2"),E(yt,"id","borders_2"),E(yt,"x1","216.75"),E(yt,"y1","608"),E(yt,"x2","216.75"),E(yt,"y2","80"),E(yt,"stroke","var(--borders)"),E(yt,"stroke-width","0.5"),E(Mt,"id","borders_3"),E(Mt,"x1","0.75"),E(Mt,"y1","608"),E(Mt,"x2","1.25"),E(Mt,"y2","19.9998"),E(Mt,"stroke","var(--borders)"),E(Mt,"stroke-width","0.5"),E(Zt,"id","borders_4"),E(Zt,"x1","864.75"),E(Zt,"y1","608"),E(Zt,"x2","864.75"),E(Zt,"y2","80"),E(Zt,"stroke","var(--borders)"),E(Zt,"stroke-width","0.5"),E(kt,"id","borders_5"),E(kt,"x1","1080.75"),E(kt,"y1","608"),E(kt,"x2","1080.75"),E(kt,"y2","80"),E(kt,"stroke","var(--borders)"),E(kt,"stroke-width","0.5"),E(Bt,"id","borders_6"),E(Bt,"x1","1081"),E(Bt,"y1","140.25"),E(Bt,"x2","865.001"),E(Bt,"y2","141.25"),E(Bt,"stroke","var(--borders)"),E(Bt,"stroke-width","0.5"),E(_t,"id","borders_7"),E(_t,"x1","1081"),E(_t,"y1","608.25"),E(_t,"x2","0.5"),E(_t,"y2","608.25"),E(_t,"stroke","var(--borders)"),E(_t,"stroke-width","0.5"),E(zt,"id","borders_8"),E(zt,"x1","217.001"),E(zt,"y1","211.25"),E(zt,"x2","1.00114"),E(zt,"y2","212.25"),E(zt,"stroke","var(--borders)"),E(zt,"stroke-width","0.5"),E(St,"x","865"),E(St,"y","84"),E(St,"width","216"),E(St,"height","394"),E(St,"rx","2"),E(St,"fill","var(--bg-overlay)"),E(At,"x","864.75"),E(At,"y","83.75"),E(At,"width","216.5"),E(At,"height","394.5"),E(At,"rx","2.25"),E(At,"stroke","var(--bg-overlay-inner-outline)"),E(At,"stroke-opacity","0.1"),E(At,"stroke-width","0.5"),E(Ot,"id","bg-overlay"),E(Ot,"filter","url(#filter5_dd)"),E(Ft,"id","bg-overlay-outline"),E(Ft,"x","865.25"),E(Ft,"y","84.25"),E(Ft,"width","215.5"),E(Ft,"height","393.5"),E(Ft,"rx","1.75"),E(Ft,"stroke","var(--bg-overlay-outline)"),E(Ft,"stroke-width","0.5"),E(Pt,"id","bg-overlay_2"),E(Pt,"d","M1062 85L1069 78L1076 85H1062Z"),E(Pt,"fill","var(--bg-overlay)"),E(Et,"id","Callout"),E(Tt,"id","Menu base"),E(Dt,"id","fg-overlay"),E(Dt,"d","M1060.57 156.403H1061.52V154.068H1063.86V153.114H1061.52V150.778H1060.57V153.114H1058.23V154.068H1060.57V156.403Z"),E(Dt,"fill","var(--fg-overlay)"),E(jt,"id","fg-overlay_2"),E(jt,"d","M897.767 157H903.784V156.062H899.028L903.733 149.04V148.273H897.716V149.21H902.472L897.767 156.233V157ZM908.14 157.136C909.912 157.136 911.105 155.79 911.105 153.761C911.105 151.716 909.912 150.369 908.14 150.369C906.367 150.369 905.174 151.716 905.174 153.761C905.174 155.79 906.367 157.136 908.14 157.136ZM908.14 156.233C906.793 156.233 906.179 155.074 906.179 153.761C906.179 152.449 906.793 151.273 908.14 151.273C909.486 151.273 910.1 152.449 910.1 153.761C910.1 155.074 909.486 156.233 908.14 156.233ZM915.36 157.136C917.132 157.136 918.326 155.79 918.326 153.761C918.326 151.716 917.132 150.369 915.36 150.369C913.587 150.369 912.394 151.716 912.394 153.761C912.394 155.79 913.587 157.136 915.36 157.136ZM915.36 156.233C914.013 156.233 913.399 155.074 913.399 153.761C913.399 152.449 914.013 151.273 915.36 151.273C916.706 151.273 917.32 152.449 917.32 153.761C917.32 155.074 916.706 156.233 915.36 156.233ZM919.921 157H920.926V152.909C920.926 151.95 921.625 151.273 922.409 151.273C923.172 151.273 923.705 151.771 923.705 152.517V157H924.728V152.739C924.728 151.895 925.256 151.273 926.176 151.273C926.892 151.273 927.506 151.652 927.506 152.619V157H928.512V152.619C928.512 151.081 927.685 150.369 926.517 150.369C925.58 150.369 924.894 150.8 924.557 151.477H924.489C924.165 150.778 923.594 150.369 922.733 150.369C921.881 150.369 921.25 150.778 920.978 151.477H920.892V150.455H919.921V157ZM933.845 157H934.851V150.455H933.845V157ZM934.357 149.364C934.749 149.364 935.073 149.057 935.073 148.682C935.073 148.307 934.749 148 934.357 148C933.965 148 933.641 148.307 933.641 148.682C933.641 149.057 933.965 149.364 934.357 149.364ZM937.759 153.062C937.759 151.92 938.466 151.273 939.429 151.273C940.362 151.273 940.929 151.882 940.929 152.909V157H941.935V152.841C941.935 151.17 941.044 150.369 939.719 150.369C938.73 150.369 938.117 150.812 937.81 151.477H937.725V150.455H936.753V157H937.759V153.062Z"),E(jt,"fill","var(--fg-overlay)"),E(Rt,"id","Menu item / On-off / Action (On)"),E(Ut,"id","fg-overlay_3"),E(Ut,"d","M1065 176.79H1059V177.727H1065V176.79Z"),E(Ut,"fill","var(--fg-overlay)"),E(qt,"id","fg-overlay_4"),E(qt,"d","M897.767 181H903.784V180.062H899.028L903.733 173.04V172.273H897.716V173.21H902.472L897.767 180.233V181ZM908.14 181.136C909.912 181.136 911.105 179.79 911.105 177.761C911.105 175.716 909.912 174.369 908.14 174.369C906.367 174.369 905.174 175.716 905.174 177.761C905.174 179.79 906.367 181.136 908.14 181.136ZM908.14 180.233C906.793 180.233 906.179 179.074 906.179 177.761C906.179 176.449 906.793 175.273 908.14 175.273C909.486 175.273 910.1 176.449 910.1 177.761C910.1 179.074 909.486 180.233 908.14 180.233ZM915.36 181.136C917.132 181.136 918.326 179.79 918.326 177.761C918.326 175.716 917.132 174.369 915.36 174.369C913.587 174.369 912.394 175.716 912.394 177.761C912.394 179.79 913.587 181.136 915.36 181.136ZM915.36 180.233C914.013 180.233 913.399 179.074 913.399 177.761C913.399 176.449 914.013 175.273 915.36 175.273C916.706 175.273 917.32 176.449 917.32 177.761C917.32 179.074 916.706 180.233 915.36 180.233ZM919.921 181H920.926V176.909C920.926 175.95 921.625 175.273 922.409 175.273C923.172 175.273 923.705 175.771 923.705 176.517V181H924.728V176.739C924.728 175.895 925.256 175.273 926.176 175.273C926.892 175.273 927.506 175.652 927.506 176.619V181H928.512V176.619C928.512 175.081 927.685 174.369 926.517 174.369C925.58 174.369 924.894 174.8 924.557 175.477H924.489C924.165 174.778 923.594 174.369 922.733 174.369C921.881 174.369 921.25 174.778 920.978 175.477H920.892V174.455H919.921V181ZM936.505 181.136C938.277 181.136 939.47 179.79 939.47 177.761C939.47 175.716 938.277 174.369 936.505 174.369C934.732 174.369 933.539 175.716 933.539 177.761C933.539 179.79 934.732 181.136 936.505 181.136ZM936.505 180.233C935.158 180.233 934.544 179.074 934.544 177.761C934.544 176.449 935.158 175.273 936.505 175.273C937.851 175.273 938.465 176.449 938.465 177.761C938.465 179.074 937.851 180.233 936.505 180.233ZM945.191 178.324C945.191 179.551 944.253 180.114 943.503 180.114C942.668 180.114 942.071 179.5 942.071 178.545V174.455H941.066V178.614C941.066 180.284 941.952 181.085 943.179 181.085C944.168 181.085 944.816 180.557 945.122 179.892H945.191V181H946.196V174.455H945.191V178.324ZM950.945 174.455H949.547V172.886H948.541V174.455H947.553V175.307H948.541V179.398C948.541 180.54 949.462 181.085 950.314 181.085C950.689 181.085 950.928 181.017 951.064 180.966L950.86 180.062C950.774 180.08 950.638 180.114 950.416 180.114C949.973 180.114 949.547 179.977 949.547 179.125V175.307H950.945V174.455Z"),E(qt,"fill","var(--fg-overlay)"),E(Nt,"id","Menu item / On-off / Action (On)_2"),E(Wt,"id","fg-overlay_5"),E(Wt,"d","M1047.8 200.588L1052.79 195.602L1057.78 200.588H1055.29V205H1050.3V200.588H1047.8ZM1052.79 196.627L1049.48 199.938H1051.02V204.279H1054.57V199.938H1056.1L1052.79 196.627ZM1063.4 196.273H1062.51C1062.46 196.362 1061.83 197.568 1060.48 197.568V198.455C1061.48 198.455 1062.2 198.045 1062.32 197.807H1062.39V205H1063.4V196.273Z"),E(Wt,"fill","var(--fg-overlay)"),E(Xt,"id","fg-overlay_6"),E(Xt,"d","M897.767 205H903.784V204.062H899.028L903.733 197.04V196.273H897.716V197.21H902.472L897.767 204.233V205ZM908.14 205.136C909.912 205.136 911.105 203.79 911.105 201.761C911.105 199.716 909.912 198.369 908.14 198.369C906.367 198.369 905.174 199.716 905.174 201.761C905.174 203.79 906.367 205.136 908.14 205.136ZM908.14 204.233C906.793 204.233 906.179 203.074 906.179 201.761C906.179 200.449 906.793 199.273 908.14 199.273C909.486 199.273 910.1 200.449 910.1 201.761C910.1 203.074 909.486 204.233 908.14 204.233ZM915.36 205.136C917.132 205.136 918.326 203.79 918.326 201.761C918.326 199.716 917.132 198.369 915.36 198.369C913.587 198.369 912.394 199.716 912.394 201.761C912.394 203.79 913.587 205.136 915.36 205.136ZM915.36 204.233C914.013 204.233 913.399 203.074 913.399 201.761C913.399 200.449 914.013 199.273 915.36 199.273C916.706 199.273 917.32 200.449 917.32 201.761C917.32 203.074 916.706 204.233 915.36 204.233ZM919.921 205H920.926V200.909C920.926 199.95 921.625 199.273 922.409 199.273C923.172 199.273 923.705 199.771 923.705 200.517V205H924.728V200.739C924.728 199.895 925.256 199.273 926.176 199.273C926.892 199.273 927.506 199.652 927.506 200.619V205H928.512V200.619C928.512 199.081 927.685 198.369 926.517 198.369C925.58 198.369 924.894 198.8 924.557 199.477H924.489C924.165 198.778 923.594 198.369 922.733 198.369C921.881 198.369 921.25 198.778 920.978 199.477H920.892V198.455H919.921V205ZM936.692 198.455H935.294V196.886H934.289V198.455H933.3V199.307H934.289V203.398C934.289 204.54 935.209 205.085 936.061 205.085C936.436 205.085 936.675 205.017 936.811 204.966L936.607 204.062C936.522 204.08 936.385 204.114 936.164 204.114C935.72 204.114 935.294 203.977 935.294 203.125V199.307H936.692V198.455ZM940.854 205.136C942.626 205.136 943.82 203.79 943.82 201.761C943.82 199.716 942.626 198.369 940.854 198.369C939.081 198.369 937.888 199.716 937.888 201.761C937.888 203.79 939.081 205.136 940.854 205.136ZM940.854 204.233C939.507 204.233 938.893 203.074 938.893 201.761C938.893 200.449 939.507 199.273 940.854 199.273C942.2 199.273 942.814 200.449 942.814 201.761C942.814 203.074 942.2 204.233 940.854 204.233ZM948.986 205H950.043V201.097H953.827V200.159H950.043V197.21H954.219V196.273H948.986V205ZM955.953 205H956.958V198.455H955.953V205ZM956.464 197.364C956.856 197.364 957.18 197.057 957.18 196.682C957.18 196.307 956.856 196 956.464 196C956.072 196 955.748 196.307 955.748 196.682C955.748 197.057 956.072 197.364 956.464 197.364ZM961.707 198.455H960.309V196.886H959.303V198.455H958.315V199.307H959.303V203.398C959.303 204.54 960.224 205.085 961.076 205.085C961.451 205.085 961.69 205.017 961.826 204.966L961.622 204.062C961.536 204.08 961.4 204.114 961.178 204.114C960.735 204.114 960.309 203.977 960.309 203.125V199.307H961.707V198.455Z"),E(Xt,"fill","var(--fg-overlay)"),E(Gt,"id","Menu item / On-off / Action (On)_3"),E(Jt,"id","fg-overlay_7"),E(Jt,"d","M897.767 229H903.784V228.062H899.028L903.733 221.04V220.273H897.716V221.21H902.472L897.767 228.233V229ZM908.14 229.136C909.912 229.136 911.105 227.79 911.105 225.761C911.105 223.716 909.912 222.369 908.14 222.369C906.367 222.369 905.174 223.716 905.174 225.761C905.174 227.79 906.367 229.136 908.14 229.136ZM908.14 228.233C906.793 228.233 906.179 227.074 906.179 225.761C906.179 224.449 906.793 223.273 908.14 223.273C909.486 223.273 910.1 224.449 910.1 225.761C910.1 227.074 909.486 228.233 908.14 228.233ZM915.36 229.136C917.132 229.136 918.326 227.79 918.326 225.761C918.326 223.716 917.132 222.369 915.36 222.369C913.587 222.369 912.394 223.716 912.394 225.761C912.394 227.79 913.587 229.136 915.36 229.136ZM915.36 228.233C914.013 228.233 913.399 227.074 913.399 225.761C913.399 224.449 914.013 223.273 915.36 223.273C916.706 223.273 917.32 224.449 917.32 225.761C917.32 227.074 916.706 228.233 915.36 228.233ZM919.921 229H920.926V224.909C920.926 223.95 921.625 223.273 922.409 223.273C923.172 223.273 923.705 223.771 923.705 224.517V229H924.728V224.739C924.728 223.895 925.256 223.273 926.176 223.273C926.892 223.273 927.506 223.652 927.506 224.619V229H928.512V224.619C928.512 223.081 927.685 222.369 926.517 222.369C925.58 222.369 924.894 222.8 924.557 223.477H924.489C924.165 222.778 923.594 222.369 922.733 222.369C921.881 222.369 921.25 222.778 920.978 223.477H920.892V222.455H919.921V229ZM936.692 222.455H935.294V220.886H934.289V222.455H933.3V223.307H934.289V227.398C934.289 228.54 935.209 229.085 936.061 229.085C936.436 229.085 936.675 229.017 936.811 228.966L936.607 228.062C936.522 228.08 936.385 228.114 936.164 228.114C935.72 228.114 935.294 227.977 935.294 227.125V223.307H936.692V222.455ZM940.854 229.136C942.626 229.136 943.82 227.79 943.82 225.761C943.82 223.716 942.626 222.369 940.854 222.369C939.081 222.369 937.888 223.716 937.888 225.761C937.888 227.79 939.081 229.136 940.854 229.136ZM940.854 228.233C939.507 228.233 938.893 227.074 938.893 225.761C938.893 224.449 939.507 223.273 940.854 223.273C942.2 223.273 942.814 224.449 942.814 225.761C942.814 227.074 942.2 228.233 940.854 228.233ZM951.56 229.119C953.222 229.119 954.441 227.892 954.441 226.222C954.441 224.53 953.264 223.29 951.662 223.29C951.074 223.29 950.503 223.499 950.145 223.784H950.094L950.401 221.21H954.049V220.273H949.514L948.986 224.568L949.975 224.688C950.337 224.428 950.955 224.24 951.492 224.244C952.604 224.253 953.418 225.097 953.418 226.239C953.418 227.359 952.634 228.182 951.56 228.182C950.665 228.182 949.953 227.607 949.872 226.818H948.85C948.914 228.148 950.06 229.119 951.56 229.119ZM959.04 229.119C960.966 229.119 962.074 227.487 962.074 224.636C962.074 221.807 960.949 220.153 959.04 220.153C957.131 220.153 956.006 221.807 956.006 224.636C956.006 227.487 957.114 229.119 959.04 229.119ZM959.04 228.182C957.77 228.182 957.029 226.908 957.029 224.636C957.029 222.369 957.779 221.074 959.04 221.074C960.301 221.074 961.051 222.369 961.051 224.636C961.051 226.908 960.31 228.182 959.04 228.182ZM968.202 227.364C968.202 228.318 968.799 229.119 969.907 229.119C970.998 229.119 971.594 228.318 971.594 227.364V226.903C971.594 225.949 971.015 225.148 969.907 225.148C968.816 225.148 968.202 225.949 968.202 226.903V227.364ZM963.856 222.369C963.856 223.324 964.452 224.125 965.56 224.125C966.651 224.125 967.248 223.324 967.248 222.369V221.909C967.248 220.955 966.668 220.153 965.56 220.153C964.469 220.153 963.856 220.955 963.856 221.909V222.369ZM964.18 229H965.151L971.151 220.273H970.18L964.18 229ZM969.072 226.903C969.072 226.375 969.31 225.881 969.907 225.881C970.52 225.881 970.725 226.375 970.725 226.903V227.364C970.725 227.892 970.503 228.386 969.907 228.386C969.293 228.386 969.072 227.892 969.072 227.364V226.903ZM964.725 221.909C964.725 221.381 964.964 220.886 965.56 220.886C966.174 220.886 966.378 221.381 966.378 221.909V222.369C966.378 222.898 966.157 223.392 965.56 223.392C964.947 223.392 964.725 222.898 964.725 222.369V221.909Z"),E(Jt,"fill","var(--fg-overlay)"),E(Qt,"id","ON");E(Qt,"fill-rule","evenodd"),E(Qt,"clip-rule","evenodd"),E(Qt,"d","M886.207 222.207L880.707 227.707L880 228.414L879.293 227.707L876.293 224.707L877.707 223.293L880 225.586L884.793 220.793L886.207 222.207Z"),E(Qt,"fill","var(--fg-overlay)"),E(Kt,"id","16 / menu-checkmark-on"),E(Yt,"id","Menu item / On-off / Action (On)_4"),E(tn,"id","fg-overlay_8"),E(tn,"d","M897.767 277H903.784V276.062H899.028L903.733 269.04V268.273H897.716V269.21H902.472L897.767 276.233V277ZM908.14 277.136C909.912 277.136 911.105 275.79 911.105 273.761C911.105 271.716 909.912 270.369 908.14 270.369C906.367 270.369 905.174 271.716 905.174 273.761C905.174 275.79 906.367 277.136 908.14 277.136ZM908.14 276.233C906.793 276.233 906.179 275.074 906.179 273.761C906.179 272.449 906.793 271.273 908.14 271.273C909.486 271.273 910.1 272.449 910.1 273.761C910.1 275.074 909.486 276.233 908.14 276.233ZM915.36 277.136C917.132 277.136 918.326 275.79 918.326 273.761C918.326 271.716 917.132 270.369 915.36 270.369C913.587 270.369 912.394 271.716 912.394 273.761C912.394 275.79 913.587 277.136 915.36 277.136ZM915.36 276.233C914.013 276.233 913.399 275.074 913.399 273.761C913.399 272.449 914.013 271.273 915.36 271.273C916.706 271.273 917.32 272.449 917.32 273.761C917.32 275.074 916.706 276.233 915.36 276.233ZM919.921 277H920.926V272.909C920.926 271.95 921.625 271.273 922.409 271.273C923.172 271.273 923.705 271.771 923.705 272.517V277H924.728V272.739C924.728 271.895 925.256 271.273 926.176 271.273C926.892 271.273 927.506 271.652 927.506 272.619V277H928.512V272.619C928.512 271.081 927.685 270.369 926.517 270.369C925.58 270.369 924.894 270.8 924.557 271.477H924.489C924.165 270.778 923.594 270.369 922.733 270.369C921.881 270.369 921.25 270.778 920.978 271.477H920.892V270.455H919.921V277ZM936.692 270.455H935.294V268.886H934.289V270.455H933.3V271.307H934.289V275.398C934.289 276.54 935.209 277.085 936.061 277.085C936.436 277.085 936.675 277.017 936.811 276.966L936.607 276.062C936.522 276.08 936.385 276.114 936.164 276.114C935.72 276.114 935.294 275.977 935.294 275.125V271.307H936.692V270.455ZM940.854 277.136C942.626 277.136 943.82 275.79 943.82 273.761C943.82 271.716 942.626 270.369 940.854 270.369C939.081 270.369 937.888 271.716 937.888 273.761C937.888 275.79 939.081 277.136 940.854 277.136ZM940.854 276.233C939.507 276.233 938.893 275.074 938.893 273.761C938.893 272.449 939.507 271.273 940.854 271.273C942.2 271.273 942.814 272.449 942.814 273.761C942.814 275.074 942.2 276.233 940.854 276.233ZM948.833 277H954.338V276.062H950.281V275.994L952.242 273.898C953.742 272.291 954.185 271.541 954.185 270.574C954.185 269.227 953.094 268.153 951.56 268.153C950.03 268.153 948.867 269.193 948.867 270.727H949.872C949.872 269.734 950.516 269.074 951.526 269.074C952.472 269.074 953.196 269.653 953.196 270.574C953.196 271.379 952.723 271.976 951.713 273.08L948.833 276.233V277ZM959.005 277.119C960.931 277.119 962.039 275.487 962.039 272.636C962.039 269.807 960.914 268.153 959.005 268.153C957.096 268.153 955.971 269.807 955.971 272.636C955.971 275.487 957.079 277.119 959.005 277.119ZM959.005 276.182C957.735 276.182 956.993 274.908 956.993 272.636C956.993 270.369 957.743 269.074 959.005 269.074C960.266 269.074 961.016 270.369 961.016 272.636C961.016 274.908 960.275 276.182 959.005 276.182ZM966.565 277.119C968.491 277.119 969.599 275.487 969.599 272.636C969.599 269.807 968.474 268.153 966.565 268.153C964.656 268.153 963.531 269.807 963.531 272.636C963.531 275.487 964.639 277.119 966.565 277.119ZM966.565 276.182C965.295 276.182 964.553 274.908 964.553 272.636C964.553 270.369 965.303 269.074 966.565 269.074C967.826 269.074 968.576 270.369 968.576 272.636C968.576 274.908 967.835 276.182 966.565 276.182ZM975.727 275.364C975.727 276.318 976.324 277.119 977.432 277.119C978.523 277.119 979.119 276.318 979.119 275.364V274.903C979.119 273.949 978.54 273.148 977.432 273.148C976.341 273.148 975.727 273.949 975.727 274.903V275.364ZM971.381 270.369C971.381 271.324 971.977 272.125 973.085 272.125C974.176 272.125 974.773 271.324 974.773 270.369V269.909C974.773 268.955 974.193 268.153 973.085 268.153C971.994 268.153 971.381 268.955 971.381 269.909V270.369ZM971.704 277H972.676L978.676 268.273H977.704L971.704 277ZM976.596 274.903C976.596 274.375 976.835 273.881 977.432 273.881C978.045 273.881 978.25 274.375 978.25 274.903V275.364C978.25 275.892 978.028 276.386 977.432 276.386C976.818 276.386 976.596 275.892 976.596 275.364V274.903ZM972.25 269.909C972.25 269.381 972.488 268.886 973.085 268.886C973.699 268.886 973.903 269.381 973.903 269.909V270.369C973.903 270.898 973.682 271.392 973.085 271.392C972.471 271.392 972.25 270.898 972.25 270.369V269.909Z"),E(tn,"fill","var(--fg-overlay)"),E(en,"id","Menu item / On-off / Action (On)_5"),E(on,"id","fg-overlay_9"),E(on,"d","M1045.64 248.588L1050.62 243.602L1055.61 248.588H1053.12V253H1048.13V248.588H1045.64ZM1050.62 244.627L1047.31 247.938H1048.85V252.279H1052.4V247.938H1053.93L1050.62 244.627ZM1063.15 247.504C1063.2 247.885 1063.22 248.307 1063.22 248.775C1063.22 251.219 1062.56 252.496 1061.3 252.496C1060.45 252.496 1059.87 251.922 1059.59 250.814L1063.15 247.504ZM1059.44 250.029C1059.39 249.654 1059.37 249.232 1059.37 248.775C1059.37 246.332 1060.03 245.055 1061.3 245.055C1062.15 245.055 1062.73 245.635 1063.01 246.76L1059.44 250.029ZM1061.3 244.352C1059.53 244.352 1058.57 245.916 1058.57 248.775C1058.57 251.635 1059.53 253.199 1061.3 253.199C1063.06 253.199 1064.03 251.635 1064.03 248.775C1064.03 245.916 1063.06 244.352 1061.3 244.352Z"),E(on,"fill","var(--fg-overlay)"),E(rn,"id","fg-overlay_10"),E(rn,"d","M897.767 253H903.784V252.062H899.028L903.733 245.04V244.273H897.716V245.21H902.472L897.767 252.233V253ZM908.14 253.136C909.912 253.136 911.105 251.79 911.105 249.761C911.105 247.716 909.912 246.369 908.14 246.369C906.367 246.369 905.174 247.716 905.174 249.761C905.174 251.79 906.367 253.136 908.14 253.136ZM908.14 252.233C906.793 252.233 906.179 251.074 906.179 249.761C906.179 248.449 906.793 247.273 908.14 247.273C909.486 247.273 910.1 248.449 910.1 249.761C910.1 251.074 909.486 252.233 908.14 252.233ZM915.36 253.136C917.132 253.136 918.326 251.79 918.326 249.761C918.326 247.716 917.132 246.369 915.36 246.369C913.587 246.369 912.394 247.716 912.394 249.761C912.394 251.79 913.587 253.136 915.36 253.136ZM915.36 252.233C914.013 252.233 913.399 251.074 913.399 249.761C913.399 248.449 914.013 247.273 915.36 247.273C916.706 247.273 917.32 248.449 917.32 249.761C917.32 251.074 916.706 252.233 915.36 252.233ZM919.921 253H920.926V248.909C920.926 247.95 921.625 247.273 922.409 247.273C923.172 247.273 923.705 247.771 923.705 248.517V253H924.728V248.739C924.728 247.895 925.256 247.273 926.176 247.273C926.892 247.273 927.506 247.652 927.506 248.619V253H928.512V248.619C928.512 247.081 927.685 246.369 926.517 246.369C925.58 246.369 924.894 246.8 924.557 247.477H924.489C924.165 246.778 923.594 246.369 922.733 246.369C921.881 246.369 921.25 246.778 920.978 247.477H920.892V246.455H919.921V253ZM936.692 246.455H935.294V244.886H934.289V246.455H933.3V247.307H934.289V251.398C934.289 252.54 935.209 253.085 936.061 253.085C936.436 253.085 936.675 253.017 936.811 252.966L936.607 252.062C936.522 252.08 936.385 252.114 936.164 252.114C935.72 252.114 935.294 251.977 935.294 251.125V247.307H936.692V246.455ZM940.854 253.136C942.626 253.136 943.82 251.79 943.82 249.761C943.82 247.716 942.626 246.369 940.854 246.369C939.081 246.369 937.888 247.716 937.888 249.761C937.888 251.79 939.081 253.136 940.854 253.136ZM940.854 252.233C939.507 252.233 938.893 251.074 938.893 249.761C938.893 248.449 939.507 247.273 940.854 247.273C942.2 247.273 942.814 248.449 942.814 249.761C942.814 251.074 942.2 252.233 940.854 252.233ZM951.901 244.273H950.844L948.662 245.722V246.795L950.793 245.381H950.844V253H951.901V244.273ZM957.317 253.119C959.243 253.119 960.351 251.487 960.351 248.636C960.351 245.807 959.226 244.153 957.317 244.153C955.408 244.153 954.283 245.807 954.283 248.636C954.283 251.487 955.391 253.119 957.317 253.119ZM957.317 252.182C956.047 252.182 955.306 250.908 955.306 248.636C955.306 246.369 956.056 245.074 957.317 245.074C958.579 245.074 959.329 246.369 959.329 248.636C959.329 250.908 958.587 252.182 957.317 252.182ZM964.877 253.119C966.803 253.119 967.911 251.487 967.911 248.636C967.911 245.807 966.786 244.153 964.877 244.153C962.968 244.153 961.843 245.807 961.843 248.636C961.843 251.487 962.951 253.119 964.877 253.119ZM964.877 252.182C963.607 252.182 962.866 250.908 962.866 248.636C962.866 246.369 963.616 245.074 964.877 245.074C966.139 245.074 966.889 246.369 966.889 248.636C966.889 250.908 966.147 252.182 964.877 252.182ZM974.04 251.364C974.04 252.318 974.636 253.119 975.744 253.119C976.835 253.119 977.432 252.318 977.432 251.364V250.903C977.432 249.949 976.852 249.148 975.744 249.148C974.653 249.148 974.04 249.949 974.04 250.903V251.364ZM969.693 246.369C969.693 247.324 970.29 248.125 971.398 248.125C972.488 248.125 973.085 247.324 973.085 246.369V245.909C973.085 244.955 972.506 244.153 971.398 244.153C970.307 244.153 969.693 244.955 969.693 245.909V246.369ZM970.017 253H970.988L976.988 244.273H976.017L970.017 253ZM974.909 250.903C974.909 250.375 975.148 249.881 975.744 249.881C976.358 249.881 976.562 250.375 976.562 250.903V251.364C976.562 251.892 976.341 252.386 975.744 252.386C975.131 252.386 974.909 251.892 974.909 251.364V250.903ZM970.562 245.909C970.562 245.381 970.801 244.886 971.398 244.886C972.011 244.886 972.216 245.381 972.216 245.909V246.369C972.216 246.898 971.994 247.392 971.398 247.392C970.784 247.392 970.562 246.898 970.562 246.369V245.909Z"),E(rn,"fill","var(--fg-overlay)"),E(nn,"id","Menu item / On-off / Action (On)_6"),E(sn,"width","216"),E(sn,"height","24"),E(sn,"transform","translate(865 302)"),E(sn,"fill","var(--bg-toolbar-active)"),E(an,"id","fg-overlay-active"),E(an,"d","M898.057 318H899.114V314.812H901.023C903.055 314.812 903.972 313.577 903.972 312.034C903.972 310.491 903.055 309.273 901.006 309.273H898.057V318ZM899.114 313.875V310.21H900.972C902.391 310.21 902.932 310.986 902.932 312.034C902.932 313.082 902.391 313.875 900.989 313.875H899.114ZM905.598 318H906.603V311.455H905.598V318ZM906.109 310.364C906.501 310.364 906.825 310.057 906.825 309.682C906.825 309.307 906.501 309 906.109 309C905.717 309 905.393 309.307 905.393 309.682C905.393 310.057 905.717 310.364 906.109 310.364ZM909.255 311.455H908.096L910.176 314.727L908.096 318H909.255L910.823 315.46L912.392 318H913.551L911.437 314.727L913.551 311.455H912.392L910.823 314.131L909.255 311.455ZM917.521 318.136C918.85 318.136 919.822 317.472 920.129 316.483L919.157 316.21C918.901 316.892 918.309 317.233 917.521 317.233C916.34 317.233 915.526 316.47 915.479 315.068H920.231V314.642C920.231 312.205 918.782 311.369 917.418 311.369C915.646 311.369 914.469 312.767 914.469 314.778C914.469 316.79 915.629 318.136 917.521 318.136ZM915.479 314.199C915.548 313.18 916.268 312.273 917.418 312.273C918.509 312.273 919.208 313.091 919.208 314.199H915.479ZM922.826 309.273H921.821V318H922.826V309.273ZM928.3 318H929.356V314.812H931.266C933.298 314.812 934.214 313.577 934.214 312.034C934.214 310.491 933.298 309.273 931.248 309.273H928.3V318ZM929.356 313.875V310.21H931.214C932.633 310.21 933.175 310.986 933.175 312.034C933.175 313.082 932.633 313.875 931.231 313.875H929.356ZM935.84 318H936.846V313.858C936.846 312.972 937.545 312.324 938.5 312.324C938.768 312.324 939.045 312.375 939.113 312.392V311.369C938.998 311.361 938.734 311.352 938.585 311.352C937.801 311.352 937.119 311.795 936.88 312.443H936.812V311.455H935.84V318ZM942.91 318.136C944.24 318.136 945.212 317.472 945.518 316.483L944.547 316.21C944.291 316.892 943.699 317.233 942.91 317.233C941.73 317.233 940.916 316.47 940.869 315.068H945.621V314.642C945.621 312.205 944.172 311.369 942.808 311.369C941.035 311.369 939.859 312.767 939.859 314.778C939.859 316.79 941.018 318.136 942.91 318.136ZM940.869 314.199C940.937 313.18 941.658 312.273 942.808 312.273C943.899 312.273 944.598 313.091 944.598 314.199H940.869ZM952.364 311.455H951.273L949.466 316.67H949.398L947.591 311.455H946.5L948.92 318H949.943L952.364 311.455ZM953.751 318H954.757V311.455H953.751V318ZM954.262 310.364C954.654 310.364 954.978 310.057 954.978 309.682C954.978 309.307 954.654 309 954.262 309C953.87 309 953.546 309.307 953.546 309.682C953.546 310.057 953.87 310.364 954.262 310.364ZM959.403 318.136C960.732 318.136 961.704 317.472 962.011 316.483L961.039 316.21C960.784 316.892 960.191 317.233 959.403 317.233C958.222 317.233 957.409 316.47 957.362 315.068H962.113V314.642C962.113 312.205 960.664 311.369 959.301 311.369C957.528 311.369 956.352 312.767 956.352 314.778C956.352 316.79 957.511 318.136 959.403 318.136ZM957.362 314.199C957.43 313.18 958.15 312.273 959.301 312.273C960.392 312.273 961.09 313.091 961.09 314.199H957.362ZM965.186 318H966.175L967.606 312.972H967.709L969.14 318H970.129L972.123 311.455H971.067L969.652 316.449H969.584L968.203 311.455H967.129L965.731 316.466H965.663L964.248 311.455H963.192L965.186 318Z"),E(an,"fill","var(--fg-toolbar-active)"),E($n,"id","fg-overlay-active_3"),E($n,"d","M1064 314L1058 310V318L1064 314Z"),E($n,"fill","var(--fg-toolbar-active)"),E(cn,"id","fg-overlay-active_2"),E(ln,"id","bg-toolbar-active_3"),E(fn,"id","fg-overlay_11"),E(fn,"d","M1054.78 338.531H1056.52V336.797H1054.78V338.531ZM1054.78 339.398V340.395C1054.78 340.895 1054.6 341.324 1054.24 341.684C1053.88 342.039 1053.44 342.217 1052.94 342.217C1052.43 342.217 1052 342.037 1051.64 341.678C1051.28 341.318 1051.1 340.883 1051.1 340.371C1051.1 339.871 1051.28 339.439 1051.64 339.076C1052 338.713 1052.42 338.531 1052.92 338.531H1053.92V336.797H1052.92C1052.42 336.797 1052 336.615 1051.64 336.252C1051.28 335.889 1051.1 335.455 1051.1 334.951C1051.1 334.443 1051.28 334.01 1051.64 333.65C1052 333.291 1052.43 333.111 1052.94 333.111C1053.44 333.111 1053.88 333.291 1054.24 333.65C1054.6 334.006 1054.78 334.434 1054.78 334.934V335.93H1056.52V334.934C1056.52 334.434 1056.7 334.006 1057.06 333.65C1057.42 333.291 1057.85 333.111 1058.36 333.111C1058.87 333.111 1059.31 333.291 1059.66 333.65C1060.02 334.01 1060.2 334.443 1060.2 334.951C1060.2 335.455 1060.02 335.889 1059.66 336.252C1059.31 336.615 1058.88 336.797 1058.38 336.797H1057.38V338.531H1058.38C1058.88 338.531 1059.31 338.713 1059.66 339.076C1060.02 339.439 1060.2 339.871 1060.2 340.371C1060.2 340.883 1060.02 341.318 1059.66 341.678C1059.31 342.037 1058.87 342.217 1058.36 342.217C1057.85 342.217 1057.42 342.039 1057.06 341.684C1056.7 341.324 1056.52 340.895 1056.52 340.395V339.398H1054.78ZM1053.92 335.93V334.951C1053.92 334.682 1053.82 334.453 1053.63 334.266C1053.44 334.074 1053.21 333.979 1052.94 333.979C1052.67 333.979 1052.44 334.074 1052.25 334.266C1052.06 334.453 1051.96 334.682 1051.96 334.951C1051.96 335.221 1052.06 335.451 1052.25 335.643C1052.44 335.834 1052.67 335.93 1052.94 335.93H1053.92ZM1053.92 339.398H1052.94C1052.67 339.398 1052.44 339.494 1052.25 339.686C1052.06 339.877 1051.96 340.105 1051.96 340.371C1051.96 340.641 1052.06 340.871 1052.25 341.062C1052.44 341.254 1052.67 341.35 1052.94 341.35C1053.21 341.35 1053.44 341.254 1053.63 341.062C1053.82 340.871 1053.92 340.643 1053.92 340.377V339.398ZM1057.38 335.93H1058.36C1058.63 335.93 1058.86 335.834 1059.05 335.643C1059.24 335.451 1059.33 335.221 1059.33 334.951C1059.33 334.682 1059.24 334.453 1059.05 334.266C1058.86 334.074 1058.63 333.979 1058.36 333.979C1058.09 333.979 1057.86 334.074 1057.67 334.266C1057.48 334.453 1057.38 334.682 1057.38 334.951V335.93ZM1057.38 339.398V340.377C1057.38 340.643 1057.48 340.871 1057.67 341.062C1057.86 341.254 1058.09 341.35 1058.36 341.35C1058.63 341.35 1058.86 341.254 1059.05 341.062C1059.24 340.871 1059.33 340.641 1059.33 340.371C1059.33 340.105 1059.24 339.877 1059.05 339.686C1058.86 339.494 1058.63 339.398 1058.36 339.398H1057.38ZM1064.42 333.273H1063.46V334.057C1063.46 334.688 1063.15 335.233 1062.8 335.744L1063.34 336.188C1064.02 335.642 1064.42 334.739 1064.42 334.04V333.273Z"),E(fn,"fill","var(--fg-overlay)"),E(un,"id","fg-overlay_12"),E(un,"d","M898.057 342H899.114V338.812H901.023C903.055 338.812 903.972 337.577 903.972 336.034C903.972 334.491 903.055 333.273 901.006 333.273H898.057V342ZM899.114 337.875V334.21H900.972C902.391 334.21 902.932 334.986 902.932 336.034C902.932 337.082 902.391 337.875 900.989 337.875H899.114ZM905.598 342H906.603V335.455H905.598V342ZM906.109 334.364C906.501 334.364 906.825 334.057 906.825 333.682C906.825 333.307 906.501 333 906.109 333C905.717 333 905.393 333.307 905.393 333.682C905.393 334.057 905.717 334.364 906.109 334.364ZM909.255 335.455H908.096L910.176 338.727L908.096 342H909.255L910.823 339.46L912.392 342H913.551L911.437 338.727L913.551 335.455H912.392L910.823 338.131L909.255 335.455ZM917.521 342.136C918.85 342.136 919.822 341.472 920.129 340.483L919.157 340.21C918.901 340.892 918.309 341.233 917.521 341.233C916.34 341.233 915.526 340.47 915.479 339.068H920.231V338.642C920.231 336.205 918.782 335.369 917.418 335.369C915.646 335.369 914.469 336.767 914.469 338.778C914.469 340.79 915.629 342.136 917.521 342.136ZM915.479 338.199C915.548 337.18 916.268 336.273 917.418 336.273C918.509 336.273 919.208 337.091 919.208 338.199H915.479ZM922.826 333.273H921.821V342H922.826V333.273ZM934.266 336H935.356C935.033 334.312 933.618 333.153 931.777 333.153C929.54 333.153 927.959 334.875 927.959 337.636C927.959 340.398 929.527 342.119 931.845 342.119C933.925 342.119 935.408 340.734 935.408 338.574V337.636H932.084V338.574H934.385C934.355 340.142 933.324 341.131 931.845 341.131C930.226 341.131 928.981 339.903 928.981 337.636C928.981 335.369 930.226 334.142 931.777 334.142C933.038 334.142 933.895 334.854 934.266 336ZM937.141 342H938.147V337.858C938.147 336.972 938.846 336.324 939.8 336.324C940.069 336.324 940.346 336.375 940.414 336.392V335.369C940.299 335.361 940.035 335.352 939.886 335.352C939.101 335.352 938.42 335.795 938.181 336.443H938.113V335.455H937.141V342ZM941.666 342H942.672V335.455H941.666V342ZM942.177 334.364C942.569 334.364 942.893 334.057 942.893 333.682C942.893 333.307 942.569 333 942.177 333C941.785 333 941.462 333.307 941.462 333.682C941.462 334.057 941.785 334.364 942.177 334.364ZM947.045 342.136C948.307 342.136 948.733 341.352 948.954 340.994H949.074V342H950.045V333.273H949.04V336.494H948.954C948.733 336.153 948.341 335.369 947.062 335.369C945.409 335.369 944.267 336.682 944.267 338.744C944.267 340.824 945.409 342.136 947.045 342.136ZM947.182 341.233C945.92 341.233 945.273 340.125 945.273 338.727C945.273 337.347 945.903 336.273 947.182 336.273C948.409 336.273 949.057 337.261 949.057 338.727C949.057 340.21 948.392 341.233 947.182 341.233Z"),E(un,"fill","var(--fg-overlay)"),E(gn,"id","ON_2"),E(gn,"fill-rule","evenodd"),E(gn,"clip-rule","evenodd"),E(gn,"d","M886.207 335.207L880.707 340.707L880 341.414L879.293 340.707L876.293 337.707L877.707 336.293L880 338.586L884.793 333.793L886.207 335.207Z"),E(gn,"fill","var(--fg-overlay)"),E(pn,"id","16 / menu-checkmark-on_2"),E(dn,"id","Menu item / On-off / Action (On)_7"),E(mn,"id","fg-overlay_13"),E(mn,"d","M1037.7 361.588L1042.69 356.602L1047.68 361.588H1045.19V366H1040.2V361.588H1037.7ZM1042.69 357.627L1039.38 360.938H1040.92V365.279H1044.46V360.938H1046L1042.69 357.627ZM1054.78 362.531H1056.52V360.797H1054.78V362.531ZM1054.78 363.398V364.395C1054.78 364.895 1054.6 365.324 1054.24 365.684C1053.88 366.039 1053.44 366.217 1052.94 366.217C1052.43 366.217 1052 366.037 1051.64 365.678C1051.28 365.318 1051.1 364.883 1051.1 364.371C1051.1 363.871 1051.28 363.439 1051.64 363.076C1052 362.713 1052.42 362.531 1052.92 362.531H1053.92V360.797H1052.92C1052.42 360.797 1052 360.615 1051.64 360.252C1051.28 359.889 1051.1 359.455 1051.1 358.951C1051.1 358.443 1051.28 358.01 1051.64 357.65C1052 357.291 1052.43 357.111 1052.94 357.111C1053.44 357.111 1053.88 357.291 1054.24 357.65C1054.6 358.006 1054.78 358.434 1054.78 358.934V359.93H1056.52V358.934C1056.52 358.434 1056.7 358.006 1057.06 357.65C1057.42 357.291 1057.85 357.111 1058.36 357.111C1058.87 357.111 1059.31 357.291 1059.66 357.65C1060.02 358.01 1060.2 358.443 1060.2 358.951C1060.2 359.455 1060.02 359.889 1059.66 360.252C1059.31 360.615 1058.88 360.797 1058.38 360.797H1057.38V362.531H1058.38C1058.88 362.531 1059.31 362.713 1059.66 363.076C1060.02 363.439 1060.2 363.871 1060.2 364.371C1060.2 364.883 1060.02 365.318 1059.66 365.678C1059.31 366.037 1058.87 366.217 1058.36 366.217C1057.85 366.217 1057.42 366.039 1057.06 365.684C1056.7 365.324 1056.52 364.895 1056.52 364.395V363.398H1054.78ZM1053.92 359.93V358.951C1053.92 358.682 1053.82 358.453 1053.63 358.266C1053.44 358.074 1053.21 357.979 1052.94 357.979C1052.67 357.979 1052.44 358.074 1052.25 358.266C1052.06 358.453 1051.96 358.682 1051.96 358.951C1051.96 359.221 1052.06 359.451 1052.25 359.643C1052.44 359.834 1052.67 359.93 1052.94 359.93H1053.92ZM1053.92 363.398H1052.94C1052.67 363.398 1052.44 363.494 1052.25 363.686C1052.06 363.877 1051.96 364.105 1051.96 364.371C1051.96 364.641 1052.06 364.871 1052.25 365.062C1052.44 365.254 1052.67 365.35 1052.94 365.35C1053.21 365.35 1053.44 365.254 1053.63 365.062C1053.82 364.871 1053.92 364.643 1053.92 364.377V363.398ZM1057.38 359.93H1058.36C1058.63 359.93 1058.86 359.834 1059.05 359.643C1059.24 359.451 1059.33 359.221 1059.33 358.951C1059.33 358.682 1059.24 358.453 1059.05 358.266C1058.86 358.074 1058.63 357.979 1058.36 357.979C1058.09 357.979 1057.86 358.074 1057.67 358.266C1057.48 358.453 1057.38 358.682 1057.38 358.951V359.93ZM1057.38 363.398V364.377C1057.38 364.643 1057.48 364.871 1057.67 365.062C1057.86 365.254 1058.09 365.35 1058.36 365.35C1058.63 365.35 1058.86 365.254 1059.05 365.062C1059.24 364.871 1059.33 364.641 1059.33 364.371C1059.33 364.105 1059.24 363.877 1059.05 363.686C1058.86 363.494 1058.63 363.398 1058.36 363.398H1057.38ZM1064.42 357.273H1063.46V358.057C1063.46 358.688 1063.15 359.233 1062.8 359.744L1063.34 360.188C1064.02 359.642 1064.42 358.739 1064.42 358.04V357.273Z"),E(mn,"fill","var(--fg-overlay)"),E(hn,"id","fg-overlay_14"),E(hn,"d","M902.83 359.455H903.852C903.805 358.138 902.591 357.153 900.903 357.153C899.233 357.153 897.92 358.125 897.92 359.591C897.92 360.767 898.773 361.466 900.136 361.858L901.21 362.165C902.131 362.42 902.949 362.744 902.949 363.614C902.949 364.568 902.028 365.199 900.818 365.199C899.778 365.199 898.858 364.739 898.773 363.75H897.682C897.784 365.182 898.943 366.153 900.818 366.153C902.83 366.153 903.972 365.045 903.972 363.631C903.972 361.994 902.42 361.466 901.517 361.227L900.631 360.989C899.983 360.818 898.943 360.477 898.943 359.54C898.943 358.705 899.71 358.091 900.869 358.091C901.926 358.091 902.727 358.594 902.83 359.455ZM906.638 362.062C906.638 360.92 907.346 360.273 908.309 360.273C909.242 360.273 909.809 360.882 909.809 361.909V366H910.815V361.841C910.815 360.17 909.924 359.369 908.599 359.369C907.61 359.369 906.996 359.812 906.69 360.477H906.604V359.455H905.633V366H906.638V362.062ZM914.638 366.153C915.781 366.153 916.377 365.54 916.582 365.114H916.633V366H917.638V361.688C917.638 359.608 916.053 359.369 915.218 359.369C914.229 359.369 913.104 359.71 912.593 360.903L913.548 361.244C913.769 360.767 914.293 360.256 915.252 360.256C916.177 360.256 916.633 360.746 916.633 361.585V361.619C916.633 362.105 916.138 362.062 914.945 362.216C913.731 362.374 912.406 362.642 912.406 364.142C912.406 365.42 913.394 366.153 914.638 366.153ZM914.792 365.25C913.991 365.25 913.411 364.892 913.411 364.193C913.411 363.426 914.11 363.188 914.894 363.085C915.32 363.034 916.462 362.915 916.633 362.71V363.631C916.633 364.449 915.985 365.25 914.792 365.25ZM919.534 368.455H920.54V364.994H920.625C920.847 365.352 921.273 366.136 922.534 366.136C924.17 366.136 925.312 364.824 925.312 362.744C925.312 360.682 924.17 359.369 922.517 359.369C921.239 359.369 920.847 360.153 920.625 360.494H920.506V359.455H919.534V368.455ZM920.523 362.727C920.523 361.261 921.17 360.273 922.398 360.273C923.676 360.273 924.307 361.347 924.307 362.727C924.307 364.125 923.659 365.233 922.398 365.233C921.187 365.233 920.523 364.21 920.523 362.727ZM933.188 359.455H931.79V357.886H930.785V359.455H929.796V360.307H930.785V364.398C930.785 365.54 931.705 366.085 932.557 366.085C932.932 366.085 933.171 366.017 933.307 365.966L933.103 365.062C933.018 365.08 932.881 365.114 932.66 365.114C932.217 365.114 931.79 364.977 931.79 364.125V360.307H933.188V359.455ZM937.35 366.136C939.122 366.136 940.316 364.79 940.316 362.761C940.316 360.716 939.122 359.369 937.35 359.369C935.577 359.369 934.384 360.716 934.384 362.761C934.384 364.79 935.577 366.136 937.35 366.136ZM937.35 365.233C936.003 365.233 935.389 364.074 935.389 362.761C935.389 361.449 936.003 360.273 937.35 360.273C938.696 360.273 939.31 361.449 939.31 362.761C939.31 364.074 938.696 365.233 937.35 365.233ZM945.482 366H946.539V362.812H948.448C950.481 362.812 951.397 361.577 951.397 360.034C951.397 358.491 950.481 357.273 948.431 357.273H945.482V366ZM946.539 361.875V358.21H948.397C949.816 358.21 950.357 358.986 950.357 360.034C950.357 361.082 949.816 361.875 948.414 361.875H946.539ZM953.023 366H954.029V359.455H953.023V366ZM953.534 358.364C953.926 358.364 954.25 358.057 954.25 357.682C954.25 357.307 953.926 357 953.534 357C953.142 357 952.818 357.307 952.818 357.682C952.818 358.057 953.142 358.364 953.534 358.364ZM956.681 359.455H955.522L957.601 362.727L955.522 366H956.681L958.249 363.46L959.817 366H960.976L958.862 362.727L960.976 359.455H959.817L958.249 362.131L956.681 359.455ZM964.946 366.136C966.275 366.136 967.247 365.472 967.554 364.483L966.582 364.21C966.327 364.892 965.734 365.233 964.946 365.233C963.765 365.233 962.952 364.47 962.905 363.068H967.656V362.642C967.656 360.205 966.207 359.369 964.844 359.369C963.071 359.369 961.895 360.767 961.895 362.778C961.895 364.79 963.054 366.136 964.946 366.136ZM962.905 362.199C962.973 361.18 963.693 360.273 964.844 360.273C965.935 360.273 966.633 361.091 966.633 362.199H962.905ZM970.252 357.273H969.246V366H970.252V357.273ZM981.691 360H982.782C982.458 358.312 981.043 357.153 979.202 357.153C976.965 357.153 975.384 358.875 975.384 361.636C975.384 364.398 976.952 366.119 979.27 366.119C981.35 366.119 982.833 364.734 982.833 362.574V361.636H979.509V362.574H981.81C981.78 364.142 980.749 365.131 979.27 365.131C977.651 365.131 976.407 363.903 976.407 361.636C976.407 359.369 977.651 358.142 979.202 358.142C980.464 358.142 981.32 358.854 981.691 360ZM984.567 366H985.572V361.858C985.572 360.972 986.271 360.324 987.226 360.324C987.494 360.324 987.771 360.375 987.839 360.392V359.369C987.724 359.361 987.46 359.352 987.311 359.352C986.527 359.352 985.845 359.795 985.606 360.443H985.538V359.455H984.567V366ZM989.091 366H990.097V359.455H989.091V366ZM989.603 358.364C989.995 358.364 990.319 358.057 990.319 357.682C990.319 357.307 989.995 357 989.603 357C989.211 357 988.887 357.307 988.887 357.682C988.887 358.057 989.211 358.364 989.603 358.364ZM994.471 366.136C995.732 366.136 996.158 365.352 996.38 364.994H996.499V366H997.471V357.273H996.465V360.494H996.38C996.158 360.153 995.766 359.369 994.488 359.369C992.834 359.369 991.692 360.682 991.692 362.744C991.692 364.824 992.834 366.136 994.471 366.136ZM994.607 365.233C993.346 365.233 992.698 364.125 992.698 362.727C992.698 361.347 993.329 360.273 994.607 360.273C995.834 360.273 996.482 361.261 996.482 362.727C996.482 364.21 995.817 365.233 994.607 365.233Z"),E(hn,"fill","var(--fg-overlay)"),E(xn,"id","ON_3"),E(xn,"fill-rule","evenodd"),E(xn,"clip-rule","evenodd"),E(xn,"d","M886.207 359.207L880.707 364.707L880 365.414L879.293 364.707L876.293 361.707L877.707 360.293L880 362.586L884.793 357.793L886.207 359.207Z"),E(xn,"fill","var(--fg-overlay)"),E(vn,"id","16 / menu-checkmark-on_3"),E(Cn,"id","Menu item / On-off / Action (On)_8"),E(bn,"id","fg-overlay_15"),E(bn,"d","M1046.88 384.797L1050.35 381.328L1053.83 384.797L1053.21 385.412L1050.35 382.553L1047.5 385.412L1046.88 384.797ZM1063.1 384H1064.2C1063.87 382.312 1062.46 381.153 1060.62 381.153C1058.38 381.153 1056.8 382.875 1056.8 385.636C1056.8 388.398 1058.37 390.119 1060.68 390.119C1062.76 390.119 1064.25 388.734 1064.25 386.574V385.636H1060.92V386.574H1063.22C1063.19 388.142 1062.16 389.131 1060.68 389.131C1059.06 389.131 1057.82 387.903 1057.82 385.636C1057.82 383.369 1059.06 382.142 1060.62 382.142C1061.88 382.142 1062.73 382.854 1063.1 384Z"),E(bn,"fill","var(--fg-overlay)"),E(Hn,"id","fg-overlay_16"),E(Hn,"d","M898.057 390H903.17V389.062H899.114V381.273H898.057V390ZM906.657 390.153C907.799 390.153 908.395 389.54 908.6 389.114H908.651V390H909.657V385.688C909.657 383.608 908.071 383.369 907.236 383.369C906.247 383.369 905.122 383.71 904.611 384.903L905.566 385.244C905.787 384.767 906.311 384.256 907.27 384.256C908.195 384.256 908.651 384.746 908.651 385.585V385.619C908.651 386.105 908.157 386.062 906.963 386.216C905.749 386.374 904.424 386.642 904.424 388.142C904.424 389.42 905.412 390.153 906.657 390.153ZM906.81 389.25C906.009 389.25 905.429 388.892 905.429 388.193C905.429 387.426 906.128 387.188 906.912 387.085C907.338 387.034 908.48 386.915 908.651 386.71V387.631C908.651 388.449 908.003 389.25 906.81 389.25ZM911.966 392.455C912.873 392.455 913.512 391.973 913.892 390.955L916.679 383.472L915.579 383.455L913.772 388.67H913.704L911.897 383.455H910.806L913.227 390.034L913.039 390.545C912.673 391.543 912.221 391.636 911.488 391.449L911.233 392.335C911.335 392.386 911.625 392.455 911.966 392.455ZM920.494 390.136C922.267 390.136 923.46 388.79 923.46 386.761C923.46 384.716 922.267 383.369 920.494 383.369C918.721 383.369 917.528 384.716 917.528 386.761C917.528 388.79 918.721 390.136 920.494 390.136ZM920.494 389.233C919.147 389.233 918.534 388.074 918.534 386.761C918.534 385.449 919.147 384.273 920.494 384.273C921.841 384.273 922.454 385.449 922.454 386.761C922.454 388.074 921.841 389.233 920.494 389.233ZM929.18 387.324C929.18 388.551 928.242 389.114 927.492 389.114C926.657 389.114 926.061 388.5 926.061 387.545V383.455H925.055V387.614C925.055 389.284 925.941 390.085 927.169 390.085C928.157 390.085 928.805 389.557 929.112 388.892H929.18V390H930.186V383.455H929.18V387.324ZM934.934 383.455H933.537V381.886H932.531V383.455H931.542V384.307H932.531V388.398C932.531 389.54 933.451 390.085 934.304 390.085C934.679 390.085 934.917 390.017 935.054 389.966L934.849 389.062C934.764 389.08 934.627 389.114 934.406 389.114C933.963 389.114 933.537 388.977 933.537 388.125V384.307H934.934V383.455ZM946.044 384H947.135C946.811 382.312 945.397 381.153 943.556 381.153C941.318 381.153 939.737 382.875 939.737 385.636C939.737 388.398 941.306 390.119 943.624 390.119C945.703 390.119 947.186 388.734 947.186 386.574V385.636H943.862V386.574H946.164C946.134 388.142 945.103 389.131 943.624 389.131C942.005 389.131 940.76 387.903 940.76 385.636C940.76 383.369 942.005 382.142 943.556 382.142C944.817 382.142 945.674 382.854 946.044 384ZM948.92 390H949.926V385.858C949.926 384.972 950.625 384.324 951.579 384.324C951.848 384.324 952.125 384.375 952.193 384.392V383.369C952.078 383.361 951.813 383.352 951.664 383.352C950.88 383.352 950.198 383.795 949.96 384.443H949.892V383.455H948.92V390ZM953.445 390H954.451V383.455H953.445V390ZM953.956 382.364C954.348 382.364 954.672 382.057 954.672 381.682C954.672 381.307 954.348 381 953.956 381C953.564 381 953.24 381.307 953.24 381.682C953.24 382.057 953.564 382.364 953.956 382.364ZM958.824 390.136C960.085 390.136 960.512 389.352 960.733 388.994H960.852V390H961.824V381.273H960.818V384.494H960.733C960.512 384.153 960.12 383.369 958.841 383.369C957.188 383.369 956.046 384.682 956.046 386.744C956.046 388.824 957.188 390.136 958.824 390.136ZM958.96 389.233C957.699 389.233 957.051 388.125 957.051 386.727C957.051 385.347 957.682 384.273 958.96 384.273C960.188 384.273 960.835 385.261 960.835 386.727C960.835 388.21 960.171 389.233 958.96 389.233ZM968.502 384.92C968.187 383.991 967.479 383.369 966.184 383.369C964.803 383.369 963.78 384.153 963.78 385.261C963.78 386.165 964.317 386.77 965.519 387.051L966.61 387.307C967.27 387.46 967.582 387.776 967.582 388.227C967.582 388.79 966.985 389.25 966.047 389.25C965.225 389.25 964.709 388.896 964.53 388.193L963.576 388.432C963.81 389.544 964.726 390.136 966.064 390.136C967.586 390.136 968.621 389.305 968.621 388.176C968.621 387.264 968.05 386.689 966.883 386.403L965.911 386.165C965.136 385.973 964.786 385.713 964.786 385.21C964.786 384.648 965.383 384.239 966.184 384.239C967.062 384.239 967.424 384.724 967.599 385.176L968.502 384.92Z"),E(Hn,"fill","var(--fg-overlay)"),E(wn,"id","Menu item / On-off / Action (On)_9"),E(Ln,"id","fg-overlay_17"),E(Ln,"d","M898.057 405.273V414H899.045V407.369H899.131L901.858 414H902.812L905.54 407.369H905.625V414H906.614V405.273H905.352L902.386 412.517H902.284L899.318 405.273H898.057ZM912.781 411.324C912.781 412.551 911.844 413.114 911.094 413.114C910.259 413.114 909.662 412.5 909.662 411.545V407.455H908.656V411.614C908.656 413.284 909.543 414.085 910.77 414.085C911.759 414.085 912.406 413.557 912.713 412.892H912.781V414H913.787V407.455H912.781V411.324ZM916.695 405.273H915.689V414H916.695V405.273ZM921.443 407.455H920.045V405.886H919.04V407.455H918.051V408.307H919.04V412.398C919.04 413.54 919.96 414.085 920.812 414.085C921.187 414.085 921.426 414.017 921.562 413.966L921.358 413.062C921.273 413.08 921.136 413.114 920.915 413.114C920.472 413.114 920.045 412.977 920.045 412.125V408.307H921.443V407.455ZM923.016 414H924.022V407.455H923.016V414ZM923.527 406.364C923.919 406.364 924.243 406.057 924.243 405.682C924.243 405.307 923.919 405 923.527 405C923.135 405 922.811 405.307 922.811 405.682C922.811 406.057 923.135 406.364 923.527 406.364ZM925.924 416.455H926.929V412.994H927.014C927.236 413.352 927.662 414.136 928.924 414.136C930.56 414.136 931.702 412.824 931.702 410.744C931.702 408.682 930.56 407.369 928.907 407.369C927.628 407.369 927.236 408.153 927.014 408.494H926.895V407.455H925.924V416.455ZM926.912 410.727C926.912 409.261 927.56 408.273 928.787 408.273C930.066 408.273 930.696 409.347 930.696 410.727C930.696 412.125 930.049 413.233 928.787 413.233C927.577 413.233 926.912 412.21 926.912 410.727ZM934.302 405.273H933.296V414H934.302V405.273ZM938.13 414.153C939.272 414.153 939.869 413.54 940.073 413.114H940.124V414H941.13V409.688C941.13 407.608 939.545 407.369 938.709 407.369C937.721 407.369 936.596 407.71 936.084 408.903L937.039 409.244C937.261 408.767 937.785 408.256 938.744 408.256C939.668 408.256 940.124 408.746 940.124 409.585V409.619C940.124 410.105 939.63 410.062 938.437 410.216C937.222 410.374 935.897 410.642 935.897 412.142C935.897 413.42 936.886 414.153 938.13 414.153ZM938.283 413.25C937.482 413.25 936.903 412.892 936.903 412.193C936.903 411.426 937.601 411.188 938.386 411.085C938.812 411.034 939.954 410.915 940.124 410.71V411.631C940.124 412.449 939.476 413.25 938.283 413.25ZM943.439 416.455C944.346 416.455 944.986 415.973 945.365 414.955L948.152 407.472L947.052 407.455L945.246 412.67H945.177L943.371 407.455H942.28L944.7 414.034L944.513 414.545C944.146 415.543 943.694 415.636 942.962 415.449L942.706 416.335C942.808 416.386 943.098 416.455 943.439 416.455ZM952.052 414.136C953.382 414.136 954.354 413.472 954.66 412.483L953.689 412.21C953.433 412.892 952.841 413.233 952.052 413.233C950.872 413.233 950.058 412.47 950.011 411.068H954.763V410.642C954.763 408.205 953.314 407.369 951.95 407.369C950.177 407.369 949.001 408.767 949.001 410.778C949.001 412.79 950.16 414.136 952.052 414.136ZM950.011 410.199C950.079 409.18 950.8 408.273 951.95 408.273C953.041 408.273 953.74 409.091 953.74 410.199H950.011ZM956.352 414H957.358V409.858C957.358 408.972 958.057 408.324 959.012 408.324C959.28 408.324 959.557 408.375 959.625 408.392V407.369C959.51 407.361 959.246 407.352 959.097 407.352C958.313 407.352 957.631 407.795 957.392 408.443H957.324V407.455H956.352V414ZM971.471 408C971.148 406.21 969.716 405.153 967.96 405.153C965.727 405.153 964.108 406.875 964.108 409.636C964.108 412.398 965.727 414.119 967.96 414.119C969.716 414.119 971.148 413.062 971.471 411.273H970.415C970.159 412.483 969.119 413.131 967.96 413.131C966.375 413.131 965.131 411.903 965.131 409.636C965.131 407.369 966.375 406.142 967.96 406.142C969.119 406.142 970.159 406.79 970.415 408H971.471ZM977.228 411.324C977.228 412.551 976.29 413.114 975.54 413.114C974.705 413.114 974.108 412.5 974.108 411.545V407.455H973.103V411.614C973.103 413.284 973.989 414.085 975.216 414.085C976.205 414.085 976.853 413.557 977.16 412.892H977.228V414H978.233V407.455H977.228V411.324ZM980.135 414H981.141V409.858C981.141 408.972 981.84 408.324 982.795 408.324C983.063 408.324 983.34 408.375 983.408 408.392V407.369C983.293 407.361 983.029 407.352 982.88 407.352C982.096 407.352 981.414 407.795 981.175 408.443H981.107V407.455H980.135V414ZM989.297 408.92C988.981 407.991 988.274 407.369 986.978 407.369C985.598 407.369 984.575 408.153 984.575 409.261C984.575 410.165 985.112 410.77 986.314 411.051L987.405 411.307C988.065 411.46 988.376 411.776 988.376 412.227C988.376 412.79 987.78 413.25 986.842 413.25C986.02 413.25 985.504 412.896 985.325 412.193L984.371 412.432C984.605 413.544 985.521 414.136 986.859 414.136C988.38 414.136 989.416 413.305 989.416 412.176C989.416 411.264 988.845 410.689 987.677 410.403L986.706 410.165C985.93 409.973 985.581 409.713 985.581 409.21C985.581 408.648 986.177 408.239 986.978 408.239C987.856 408.239 988.219 408.724 988.393 409.176L989.297 408.92ZM993.649 414.136C995.422 414.136 996.615 412.79 996.615 410.761C996.615 408.716 995.422 407.369 993.649 407.369C991.876 407.369 990.683 408.716 990.683 410.761C990.683 412.79 991.876 414.136 993.649 414.136ZM993.649 413.233C992.302 413.233 991.689 412.074 991.689 410.761C991.689 409.449 992.302 408.273 993.649 408.273C994.996 408.273 995.609 409.449 995.609 410.761C995.609 412.074 994.996 413.233 993.649 413.233ZM998.21 414H999.216V409.858C999.216 408.972 999.915 408.324 1000.87 408.324C1001.14 408.324 1001.41 408.375 1001.48 408.392V407.369C1001.37 407.361 1001.1 407.352 1000.95 407.352C1000.17 407.352 999.488 407.795 999.25 408.443H999.182V407.455H998.21V414ZM1007.37 408.92C1007.06 407.991 1006.35 407.369 1005.05 407.369C1003.67 407.369 1002.65 408.153 1002.65 409.261C1002.65 410.165 1003.19 410.77 1004.39 411.051L1005.48 411.307C1006.14 411.46 1006.45 411.776 1006.45 412.227C1006.45 412.79 1005.85 413.25 1004.92 413.25C1004.09 413.25 1003.58 412.896 1003.4 412.193L1002.45 412.432C1002.68 413.544 1003.6 414.136 1004.93 414.136C1006.46 414.136 1007.49 413.305 1007.49 412.176C1007.49 411.264 1006.92 410.689 1005.75 410.403L1004.78 410.165C1004 409.973 1003.66 409.713 1003.66 409.21C1003.66 408.648 1004.25 408.239 1005.05 408.239C1005.93 408.239 1006.29 408.724 1006.47 409.176L1007.37 408.92Z"),E(Ln,"fill","var(--fg-overlay)"),E(Vn,"id","Menu item / On-off / Action (On)_10"),E(Mn,"id","fg-overlay_18"),E(Mn,"d","M1045.38 433.588L1050.36 428.602L1055.36 433.588H1052.86V438H1047.87V433.588H1045.38ZM1050.36 429.627L1047.05 432.938H1048.59V437.279H1052.14V432.938H1053.67L1050.36 429.627ZM1058.38 438H1059.44V434.591H1061.35C1061.42 434.591 1061.5 434.591 1061.57 434.587L1063.41 438H1064.64L1062.66 434.395C1063.78 434.016 1064.3 433.108 1064.3 431.949C1064.3 430.406 1063.38 429.273 1061.33 429.273H1058.38V438ZM1059.44 433.636V430.21H1061.3C1062.71 430.21 1063.26 430.901 1063.26 431.949C1063.26 432.997 1062.71 433.636 1061.31 433.636H1059.44Z"),E(Mn,"fill","var(--fg-overlay)"),E(Zn,"id","fg-overlay_19"),E(Zn,"d","M898.057 438H899.114V434.591H901.023C901.099 434.591 901.172 434.591 901.244 434.587L903.085 438H904.312L902.339 434.395C903.452 434.016 903.972 433.108 903.972 431.949C903.972 430.406 903.051 429.273 901.006 429.273H898.057V438ZM899.114 433.636V430.21H900.972C902.386 430.21 902.932 430.901 902.932 431.949C902.932 432.997 902.386 433.636 900.989 433.636H899.114ZM909.781 435.324C909.781 436.551 908.844 437.114 908.094 437.114C907.259 437.114 906.662 436.5 906.662 435.545V431.455H905.656V435.614C905.656 437.284 906.543 438.085 907.77 438.085C908.759 438.085 909.406 437.557 909.713 436.892H909.781V438H910.787V431.455H909.781V435.324ZM913.695 429.273H912.689V438H913.695V429.273ZM918.341 438.136C919.67 438.136 920.642 437.472 920.949 436.483L919.977 436.21C919.722 436.892 919.129 437.233 918.341 437.233C917.16 437.233 916.347 436.47 916.3 435.068H921.051V434.642C921.051 432.205 919.602 431.369 918.239 431.369C916.466 431.369 915.29 432.767 915.29 434.778C915.29 436.79 916.449 438.136 918.341 438.136ZM916.3 434.199C916.368 433.18 917.088 432.273 918.239 432.273C919.33 432.273 920.028 433.091 920.028 434.199H916.3ZM922.641 438H923.647V433.858C923.647 432.972 924.345 432.324 925.3 432.324C925.568 432.324 925.845 432.375 925.914 432.392V431.369C925.799 431.361 925.534 431.352 925.385 431.352C924.601 431.352 923.919 431.795 923.681 432.443H923.613V431.455H922.641V438ZM931.802 432.92C931.487 431.991 930.779 431.369 929.484 431.369C928.103 431.369 927.081 432.153 927.081 433.261C927.081 434.165 927.617 434.77 928.819 435.051L929.91 435.307C930.571 435.46 930.882 435.776 930.882 436.227C930.882 436.79 930.285 437.25 929.348 437.25C928.525 437.25 928.01 436.896 927.831 436.193L926.876 436.432C927.11 437.544 928.027 438.136 929.365 438.136C930.886 438.136 931.921 437.305 931.921 436.176C931.921 435.264 931.35 434.689 930.183 434.403L929.211 434.165C928.436 433.973 928.086 433.713 928.086 433.21C928.086 432.648 928.683 432.239 929.484 432.239C930.362 432.239 930.724 432.724 930.899 433.176L931.802 432.92Z"),E(Zn,"fill","var(--fg-overlay)"),E(yn,"id","Menu item / On-off / Action (On)_11"),E(Bn,"id","fg-overlay_20"),E(Bn,"d","M902.83 455.455H903.852C903.805 454.138 902.591 453.153 900.903 453.153C899.233 453.153 897.92 454.125 897.92 455.591C897.92 456.767 898.773 457.466 900.136 457.858L901.21 458.165C902.131 458.42 902.949 458.744 902.949 459.614C902.949 460.568 902.028 461.199 900.818 461.199C899.778 461.199 898.858 460.739 898.773 459.75H897.682C897.784 461.182 898.943 462.153 900.818 462.153C902.83 462.153 903.972 461.045 903.972 459.631C903.972 457.994 902.42 457.466 901.517 457.227L900.631 456.989C899.983 456.818 898.943 456.477 898.943 455.54C898.943 454.705 899.71 454.091 900.869 454.091C901.926 454.091 902.727 454.594 902.83 455.455ZM906.638 453.273H905.633V462H906.638V453.273ZM908.54 462H909.546V455.455H908.54V462ZM909.052 454.364C909.444 454.364 909.768 454.057 909.768 453.682C909.768 453.307 909.444 453 909.052 453C908.66 453 908.336 453.307 908.336 453.682C908.336 454.057 908.66 454.364 909.052 454.364ZM914.107 462.136C915.556 462.136 916.511 461.25 916.681 460.091H915.675C915.488 460.807 914.891 461.233 914.107 461.233C912.914 461.233 912.147 460.244 912.147 458.727C912.147 457.244 912.931 456.273 914.107 456.273C914.994 456.273 915.522 456.818 915.675 457.415H916.681C916.511 456.188 915.471 455.369 914.09 455.369C912.317 455.369 911.141 456.767 911.141 458.761C911.141 460.722 912.266 462.136 914.107 462.136ZM920.956 462.136C922.285 462.136 923.257 461.472 923.564 460.483L922.592 460.21C922.336 460.892 921.744 461.233 920.956 461.233C919.775 461.233 918.961 460.47 918.914 459.068H923.666V458.642C923.666 456.205 922.217 455.369 920.853 455.369C919.081 455.369 917.904 456.767 917.904 458.778C917.904 460.79 919.064 462.136 920.956 462.136ZM918.914 458.199C918.983 457.18 919.703 456.273 920.853 456.273C921.944 456.273 922.643 457.091 922.643 458.199H918.914ZM929.892 456.92C929.577 455.991 928.869 455.369 927.574 455.369C926.193 455.369 925.17 456.153 925.17 457.261C925.17 458.165 925.707 458.77 926.909 459.051L928 459.307C928.66 459.46 928.972 459.776 928.972 460.227C928.972 460.79 928.375 461.25 927.437 461.25C926.615 461.25 926.099 460.896 925.92 460.193L924.966 460.432C925.2 461.544 926.116 462.136 927.454 462.136C928.976 462.136 930.011 461.305 930.011 460.176C930.011 459.264 929.44 458.689 928.273 458.403L927.301 458.165C926.525 457.973 926.176 457.713 926.176 457.21C926.176 456.648 926.773 456.239 927.574 456.239C928.452 456.239 928.814 456.724 928.989 457.176L929.892 456.92Z"),E(Bn,"fill","var(--fg-overlay)"),E(zn,"id","ON_4"),E(zn,"fill-rule","evenodd"),E(zn,"clip-rule","evenodd"),E(zn,"d","M886.207 455.207L880.707 460.707L880 461.414L879.293 460.707L876.293 457.707L877.707 456.293L880 458.586L884.793 453.793L886.207 455.207Z"),E(zn,"fill","var(--fg-overlay)"),E(_n,"id","16 / menu-checkmark-on_4"),E(kn,"id","Menu item / On-off / Action (On)_12"),E(Tn,"id","borders_9"),E(Tn,"x1","865"),E(Tn,"y1","132.5"),E(Tn,"x2","1081"),E(Tn,"y2","132.5"),E(Tn,"stroke","var(--borders)"),E(In,"id","Menu item / Separator"),E(Sn,"id","borders_10"),E(Sn,"x1","865"),E(Sn,"y1","293.5"),E(Sn,"x2","1081"),E(Sn,"y2","293.5"),E(Sn,"stroke","var(--borders)"),E(On,"id","Menu item / Separator_2"),E(Fn,"id","bg-primary-btn_4"),E(Fn,"d","M889 96C889 94.8954 889.895 94 891 94H1055C1056.1 94 1057 94.8954 1057 96V120C1057 121.105 1056.1 122 1055 122H891C889.895 122 889 121.105 889 120V96Z"),E(Fn,"stroke","var(--bg-toolbar-active)"),E(Fn,"stroke-width","2"),E(En,"id","fg-overlay_21"),E(En,"x","897"),E(En,"y","100"),E(En,"width","30"),E(En,"height","16"),E(En,"fill","#70B4F0"),E(En,"fill-opacity","0.54"),E(Rn,"id","value"),E(Rn,"d","M900.641 104H899.672L897.672 105.328V106.312L899.625 105.016H899.672V112H900.641V104ZM905.496 112.109C907.02 112.109 908.137 110.984 908.137 109.453C908.137 107.902 907.059 106.766 905.59 106.766C905.051 106.766 904.528 106.957 904.2 107.219H904.153L904.434 104.859H907.778V104H903.621L903.137 107.937L904.043 108.047C904.375 107.809 904.942 107.637 905.434 107.641C906.453 107.648 907.2 108.422 907.2 109.469C907.2 110.496 906.481 111.25 905.496 111.25C904.676 111.25 904.024 110.723 903.95 110H903.012C903.071 111.219 904.121 112.109 905.496 112.109ZM912.353 112.109C914.119 112.109 915.134 110.613 915.134 108C915.134 105.406 914.103 103.891 912.353 103.891C910.603 103.891 909.572 105.406 909.572 108C909.572 110.613 910.588 112.109 912.353 112.109ZM912.353 111.25C911.189 111.25 910.509 110.082 910.509 108C910.509 105.922 911.197 104.734 912.353 104.734C913.509 104.734 914.197 105.922 914.197 108C914.197 110.082 913.517 111.25 912.353 111.25ZM920.752 110.5C920.752 111.375 921.299 112.109 922.314 112.109C923.314 112.109 923.861 111.375 923.861 110.5V110.078C923.861 109.203 923.33 108.469 922.314 108.469C921.314 108.469 920.752 109.203 920.752 110.078V110.5ZM916.768 105.922C916.768 106.797 917.314 107.531 918.33 107.531C919.33 107.531 919.877 106.797 919.877 105.922V105.5C919.877 104.625 919.346 103.891 918.33 103.891C917.33 103.891 916.768 104.625 916.768 105.5V105.922ZM917.064 112H917.955L923.455 104H922.564L917.064 112ZM921.549 110.078C921.549 109.594 921.768 109.141 922.314 109.141C922.877 109.141 923.064 109.594 923.064 110.078V110.5C923.064 110.984 922.861 111.437 922.314 111.437C921.752 111.437 921.549 110.984 921.549 110.5V110.078ZM917.564 105.5C917.564 105.016 917.783 104.562 918.33 104.562C918.893 104.562 919.08 105.016 919.08 105.5V105.922C919.08 106.406 918.877 106.859 918.33 106.859C917.768 106.859 917.564 106.406 917.564 105.922V105.5Z"),E(Rn,"fill","var(--fg-overlay)"),E(Pn,"id","Value / Simple"),E(An,"id","Value HOVER"),E(It,"id","Viewport menu"),E(n,"id","borders"),E(Nn,"flood-opacity","0"),E(Nn,"result","BackgroundImageFix"),E(Un,"in","SourceAlpha"),E(Un,"type","matrix"),E(Un,"values","0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0"),E(qn,"dy","1"),E(Gn,"stdDeviation","1.5"),E(Wn,"type","matrix"),E(Wn,"values","0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.35 0"),E(Xn,"mode","normal"),E(Xn,"in2","BackgroundImageFix"),E(Xn,"result","effect1_dropShadow"),E(Yn,"mode","normal"),E(Yn,"in","SourceGraphic"),E(Yn,"in2","effect1_dropShadow"),E(Yn,"result","shape"),E(jn,"id","filter0_d"),E(jn,"x","165"),E(jn,"y","156.59"),E(jn,"width","17.591"),E(jn,"height","24.2243"),E(jn,"filterUnits","userSpaceOnUse"),E(jn,"color-interpolation-filters","sRGB"),E(Kn,"flood-opacity","0"),E(Kn,"result","BackgroundImageFix"),E(Qn,"in","SourceAlpha"),E(Qn,"type","matrix"),E(Qn,"values","0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0"),E(eo,"dy","1"),E(to,"stdDeviation","1.5"),E(no,"type","matrix"),E(no,"values","0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.35 0"),E(oo,"mode","normal"),E(oo,"in2","BackgroundImageFix"),E(oo,"result","effect1_dropShadow"),E(ro,"mode","normal"),E(ro,"in","SourceGraphic"),E(ro,"in2","effect1_dropShadow"),E(ro,"result","shape"),E(Jn,"id","filter1_d"),E(Jn,"x","162"),E(Jn,"y","260.59"),E(Jn,"width","17.591"),E(Jn,"height","24.2243"),E(Jn,"filterUnits","userSpaceOnUse"),E(Jn,"color-interpolation-filters","sRGB"),E(lo,"flood-opacity","0"),E(lo,"result","BackgroundImageFix"),E(so,"in","SourceAlpha"),E(so,"type","matrix"),E(so,"values","0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0"),E(ao,"dy","1"),E(co,"stdDeviation","1.5"),E($o,"type","matrix"),E($o,"values","0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.35 0"),E(fo,"mode","normal"),E(fo,"in2","BackgroundImageFix"),E(fo,"result","effect1_dropShadow"),E(uo,"mode","normal"),E(uo,"in","SourceGraphic"),E(uo,"in2","effect1_dropShadow"),E(uo,"result","shape"),E(io,"id","filter2_d"),E(io,"x","1059"),E(io,"y","17.5902"),E(io,"width","17.591"),E(io,"height","24.2243"),E(io,"filterUnits","userSpaceOnUse"),E(io,"color-interpolation-filters","sRGB"),E(go,"flood-opacity","0"),E(go,"result","BackgroundImageFix"),E(Co,"in","SourceAlpha"),E(Co,"type","matrix"),E(Co,"values","0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0"),E(mo,"dy","1"),E(ho,"stdDeviation","1.5"),E(vo,"type","matrix"),E(vo,"values","0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.35 0"),E(xo,"mode","normal"),E(xo,"in2","BackgroundImageFix"),E(xo,"result","effect1_dropShadow"),E(wo,"mode","normal"),E(wo,"in","SourceGraphic"),E(wo,"in2","effect1_dropShadow"),E(wo,"result","shape"),E(po,"id","filter3_d"),E(po,"x","1019"),E(po,"y","17.5902"),E(po,"width","17.591"),E(po,"height","24.2243"),E(po,"filterUnits","userSpaceOnUse"),E(po,"color-interpolation-filters","sRGB"),E(Ho,"flood-opacity","0"),E(Ho,"result","BackgroundImageFix"),E(Vo,"in","SourceAlpha"),E(Vo,"type","matrix"),E(Vo,"values","0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0"),E(Lo,"dy","1"),E(yo,"stdDeviation","1.5"),E(Mo,"type","matrix"),E(Mo,"values","0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.35 0"),E(Zo,"mode","normal"),E(Zo,"in2","BackgroundImageFix"),E(Zo,"result","effect1_dropShadow"),E(ko,"mode","normal"),E(ko,"in","SourceGraphic"),E(ko,"in2","effect1_dropShadow"),E(ko,"result","shape"),E(bo,"id","filter4_d"),E(bo,"x","308"),E(bo,"y","21.5902"),E(bo,"width","17.591"),E(bo,"height","24.2243"),E(bo,"filterUnits","userSpaceOnUse"),E(bo,"color-interpolation-filters","sRGB"),E(_o,"flood-opacity","0"),E(_o,"result","BackgroundImageFix"),E(zo,"in","SourceAlpha"),E(zo,"type","matrix"),E(zo,"values","0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0"),E(Io,"dy","5"),E(To,"stdDeviation","8.5"),E(Oo,"type","matrix"),E(Oo,"values","0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.2 0"),E(So,"mode","normal"),E(So,"in2","BackgroundImageFix"),E(So,"result","effect1_dropShadow"),E(Ao,"in","SourceAlpha"),E(Ao,"type","matrix"),E(Ao,"values","0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0"),E(Fo,"dy","2"),E(Eo,"stdDeviation","3.5"),E(Po,"type","matrix"),E(Po,"values","0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.15 0"),E(Ro,"mode","normal"),E(Ro,"in2","effect1_dropShadow"),E(Ro,"result","effect2_dropShadow"),E(Do,"mode","normal"),E(Do,"in","SourceGraphic"),E(Do,"in2","effect2_dropShadow"),E(Do,"result","shape"),E(Bo,"id","filter5_dd"),E(Bo,"x","847.5"),E(Bo,"y","71.5"),E(Bo,"width","251"),E(Bo,"height","429"),E(Bo,"filterUnits","userSpaceOnUse"),E(Bo,"color-interpolation-filters","sRGB"),E(t,"width","1099"),E(t,"height","609"),E(t,"viewBox","0 0 1099 609"),E(t,"fill","none"),E(t,"xmlns","http://www.w3.org/2000/svg")},m(e,r){_(e,t,r),B(t,n),B(n,o),B(n,i),B(n,l),B(n,s),B(n,a),B(n,c),B(n,$),B(n,d),B(n,f),B(n,u),B(u,p),B(u,g),B(g,C),B(g,m),B(m,h),B(g,v),B(v,x),B(g,w),B(w,b),B(g,H),B(H,V),B(g,L),B(L,y),B(g,M),B(M,Z),B(M,k),B(g,I),B(I,O),B(u,S),B(S,A),B(S,F),B(F,P),B(u,R),B(R,D),B(R,j),B(j,N),B(u,U),B(U,q),B(U,G),B(G,W),B(U,X),B(X,Y),B(U,J),B(J,K),B(K,Q),B(U,ee),B(ee,te),B(u,ne),B(ne,oe),B(ne,re),B(ne,ie),B(u,le),B(le,se),B(le,ae),B(le,ce),B(ce,$e),B(u,de),B(de,fe),B(de,ue),B(de,pe),B(de,ge),B(ge,Ce),B(de,me),B(me,he),B(n,ve),B(n,xe),B(n,we),B(n,be),B(n,He),B(n,Ve),B(n,Le),B(n,ye),B(n,Me),B(Me,Ze),B(n,ke),B(ke,Be),B(n,_e),B(_e,ze),B(n,Ie),B(Ie,Te),B(n,Oe),B(n,Se),B(n,Ae),B(n,Fe),B(n,Ee),B(n,Pe),B(n,Re),B(n,De),B(n,je),B(je,Ne),B(Ne,Ue),B(je,qe),B(n,Ge),B(n,We),B(n,Xe),B(n,Ye),B(n,Je),B(n,Ke),B(n,Qe),B(n,et),B(n,tt),B(tt,nt),B(nt,ot),B(tt,rt),B(n,it),B(it,lt),B(lt,st),B(it,at),B(n,ct),B(ct,$t),B($t,dt),B(ct,ft),B(n,ut),B(n,pt),B(n,gt),B(n,Ct),B(Ct,mt),B(mt,ht),B(Ct,vt),B(n,xt),B(xt,wt),B(n,bt),B(bt,Ht),B(n,Vt),B(Vt,Lt),B(n,yt),B(n,Mt),B(n,Zt),B(n,kt),B(n,Bt),B(n,_t),B(n,zt),B(n,It),B(It,Tt),B(Tt,Ot),B(Ot,St),B(Ot,At),B(Tt,Ft),B(Tt,Et),B(Et,Pt),B(It,Rt),B(Rt,Dt),B(Rt,jt),B(It,Nt),B(Nt,Ut),B(Nt,qt),B(It,Gt),B(Gt,Wt),B(Gt,Xt),B(It,Yt),B(Yt,Jt),B(Yt,Kt),B(Kt,Qt),B(It,en),B(en,tn),B(It,nn),B(nn,on),B(nn,rn),B(It,ln),B(ln,sn),B(ln,an),B(ln,cn),B(cn,$n),B(It,dn),B(dn,fn),B(dn,un),B(dn,pn),B(pn,gn),B(It,Cn),B(Cn,mn),B(Cn,hn),B(Cn,vn),B(vn,xn),B(It,wn),B(wn,bn),B(wn,Hn),B(It,Vn),B(Vn,Ln),B(It,yn),B(yn,Mn),B(yn,Zn),B(It,kn),B(kn,Bn),B(kn,_n),B(_n,zn),B(It,In),B(In,Tn),B(It,On),B(On,Sn),B(It,An),B(An,Fn),B(An,En),B(An,Pn),B(Pn,Rn),B(t,Dn),B(Dn,jn),B(jn,Nn),B(jn,Un),B(jn,qn),B(jn,Gn),B(jn,Wn),B(jn,Xn),B(jn,Yn),B(Dn,Jn),B(Jn,Kn),B(Jn,Qn),B(Jn,eo),B(Jn,to),B(Jn,no),B(Jn,oo),B(Jn,ro),B(Dn,io),B(io,lo),B(io,so),B(io,ao),B(io,co),B(io,$o),B(io,fo),B(io,uo),B(Dn,po),B(po,go),B(po,Co),B(po,mo),B(po,ho),B(po,vo),B(po,xo),B(po,wo),B(Dn,bo),B(bo,Ho),B(bo,Vo),B(bo,Lo),B(bo,yo),B(bo,Mo),B(bo,Zo),B(bo,ko),B(Dn,Bo),B(Bo,_o),B(Bo,zo),B(Bo,Io),B(Bo,To),B(Bo,Oo),B(Bo,So),B(Bo,Ao),B(Bo,Fo),B(Bo,Eo),B(Bo,Po),B(Bo,Ro),B(Bo,Do)},p:r,i:r,o:r,d(e){e&&z(t)}}}class ii extends Ve{constructor(e){super(),He(this,e,null,ri,d,{})}}function li(e){let t,n,o,r,i;function l(t){e[6](t)}let s={};return void 0!==e[4]&&(s.color=e[4]),t=new e[2]({props:s}),X.push((()=>he(t,"color",l))),r=new ut({props:{width:"8px"}}),{c(){ve(t.$$.fragment),o=S(),ve(r.$$.fragment)},m(e,n){xe(t,e,n),_(e,o,n),xe(r,e,n),i=!0},p(e,o){const r={};!n&&16&o&&(n=!0,r.color=e[4],te((()=>n=!1))),t.$set(r)},i(e){i||($e(t.$$.fragment,e),$e(r.$$.fragment,e),i=!0)},o(e){de(t.$$.fragment,e),de(r.$$.fragment,e),i=!1},d(e){e&&z(o),we(t,e),we(r,e)}}}function si(e){let t;return{c(){t=O(e[1])},m(e,n){_(e,t,n)},p(e,n){2&n&&P(t,e[1])},d(e){e&&z(t)}}}function ai(e){let t,n,o,r,i,l,s,a,c;t=new ut({props:{width:"14px"}});let $=e[2]&&li(e);function d(t){e[7](t)}function f(t){e[8](t)}let u={size:"var(--text-size-popup)",$$slots:{default:[si]},$$scope:{ctx:e}};return void 0!==e[4]&&(u.color=e[4]),void 0!==e[0]&&(u.disabled=e[0]),r=new co({props:u}),X.push((()=>he(r,"color",d))),X.push((()=>he(r,"disabled",f))),a=new ut({props:{width:"20px"}}),{c(){ve(t.$$.fragment),n=S(),$&&$.c(),o=S(),ve(r.$$.fragment),s=S(),ve(a.$$.fragment)},m(e,i){xe(t,e,i),_(e,n,i),$&&$.m(e,i),_(e,o,i),xe(r,e,i),_(e,s,i),xe(a,e,i),c=!0},p(e,t){e[2]?$?($.p(e,t),4&t&&$e($,1)):($=li(e),$.c(),$e($,1),$.m(o.parentNode,o)):$&&(ae(),de($,1,1,(()=>{$=null})),ce());const n={};1026&t&&(n.$$scope={dirty:t,ctx:e}),!i&&16&t&&(i=!0,n.color=e[4],te((()=>i=!1))),!l&&1&t&&(l=!0,n.disabled=e[0],te((()=>l=!1))),r.$set(n)},i(e){c||($e(t.$$.fragment,e),$e($),$e(r.$$.fragment,e),$e(a.$$.fragment,e),c=!0)},o(e){de(t.$$.fragment,e),de($),de(r.$$.fragment,e),de(a.$$.fragment,e),c=!1},d(e){e&&(z(n),z(o),z(s)),we(t,e),$&&$.d(e),we(r,e),we(a,e)}}}function ci(e){let t,n;return t=new ut({props:{alignItems:"center",padding:"6px 0",width:"100%",$$slots:{default:[ai]},$$scope:{ctx:e}}}),{c(){ve(t.$$.fragment)},m(e,o){xe(t,e,o),n=!0},p(e,n){const o={};1047&n&&(o.$$scope={dirty:n,ctx:e}),t.$set(o)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){de(t.$$.fragment,e),n=!1},d(e){we(t,e)}}}function $i(e){let t,n,o;function r(t){e[9](t)}let i={disabledBgColor:"transparent",$$slots:{default:[ci]},$$scope:{ctx:e}};return void 0!==e[0]&&(i.disabled=e[0]),t=new Ge({props:i}),X.push((()=>he(t,"disabled",r))),t.$on("buttonClick",(function(){$(e[3])&&e[3].apply(this,arguments)})),{c(){ve(t.$$.fragment)},m(e,n){xe(t,e,n),o=!0},p(o,[r]){e=o;const i={};1047&r&&(i.$$scope={dirty:r,ctx:e}),!n&&1&r&&(n=!0,i.disabled=e[0],te((()=>n=!1))),t.$set(i)},i(e){o||($e(t.$$.fragment,e),o=!0)},o(e){de(t.$$.fragment,e),o=!1},d(e){we(t,e)}}}function di(e,t,n){let{text:o}=t,{disabled:r}=t,{Icon:i}=t,{onItemClick:l=(()=>{})}=t,{onItemRemoveClick:s=(()=>{})}=t,a="var(--fg-overlay)";return e.$$set=e=>{"text"in e&&n(1,o=e.text),"disabled"in e&&n(0,r=e.disabled),"Icon"in e&&n(2,i=e.Icon),"onItemClick"in e&&n(3,l=e.onItemClick),"onItemRemoveClick"in e&&n(5,s=e.onItemRemoveClick)},e.$$.update=()=>{1&e.$$.dirty&&(n(4,a="var(--fg-overlay)"),"boolean"==typeof r&&r&&n(4,a="var(--text-disabled)"))},[r,o,i,l,a,s,function(e){a=e,n(4,a),n(0,r)},function(e){a=e,n(4,a),n(0,r)},function(e){r=e,n(0,r)},function(e){r=e,n(0,r)}]}class fi extends Ve{constructor(e){super(),He(this,e,di,$i,d,{text:1,disabled:0,Icon:2,onItemClick:3,onItemRemoveClick:5})}}function ui(e){let t;return{c(){t=I("div"),E(t,"slot","popupButton")},m(e,n){_(e,t,n)},p:r,d(e){e&&z(t)}}}function pi(e){let t,n,o;function r(t){e[8](t)}let i={slot:"popupBody",border:"0",padding:"0",bradius:"0",onItemClick:e[5]};return void 0!==e[4]&&(i.items=e[4]),t=new Jn({props:i}),X.push((()=>he(t,"items",r))),{c(){ve(t.$$.fragment)},m(e,n){xe(t,e,n),o=!0},p(e,o){const r={};!n&&16&o&&(n=!0,r.items=e[4],te((()=>n=!1))),t.$set(r)},i(e){o||($e(t.$$.fragment,e),o=!0)},o(e){de(t.$$.fragment,e),o=!1},d(e){we(t,e)}}}function gi(e){let t,n,o,r,i,l;function s(t){e[9](t)}function a(t){e[10](t)}function c(t){e[11](t)}function $(t){e[12](t)}let d={bradius:"3px",$$slots:{popupBody:[pi],popupButton:[ui]},$$scope:{ctx:e}};return void 0!==e[0]&&(d.isOpen=e[0]),void 0!==e[1]&&(d.cornerX=e[1]),void 0!==e[2]&&(d.x=e[2]),void 0!==e[3]&&(d.y=e[3]),t=new Ho({props:d}),X.push((()=>he(t,"isOpen",s))),X.push((()=>he(t,"cornerX",a))),X.push((()=>he(t,"x",c))),X.push((()=>he(t,"y",$))),{c(){ve(t.$$.fragment)},m(e,n){xe(t,e,n),l=!0},p(e,[l]){const s={};65552&l&&(s.$$scope={dirty:l,ctx:e}),!n&&1&l&&(n=!0,s.isOpen=e[0],te((()=>n=!1))),!o&&2&l&&(o=!0,s.cornerX=e[1],te((()=>o=!1))),!r&&4&l&&(r=!0,s.x=e[2],te((()=>r=!1))),!i&&8&l&&(i=!0,s.y=e[3],te((()=>i=!1))),t.$set(s)},i(e){l||($e(t.$$.fragment,e),l=!0)},o(e){de(t.$$.fragment,e),l=!1},d(e){we(t,e)}}}function Ci(t,n,o){let{key:r=""}=n,{color:i=""}=n,{isOpen:l=!1}=n,{cornerX:s=0}=n,{x:a=0}=n,{y:c=0}=n,$=[{id:"paste",text:"Paste color",handler:function(){const t=e.clipboard.readText();if(!Te(t))return;je.setColor(r,t)},item:fi},{id:"copyHex",text:"Copy as HEX",handler:function(){e.clipboard.writeText(i)},item:fi},{id:"copyRgb",text:"Copy as RGB",handler:function(){e.clipboard.writeText((e=>{if(!Ie(e))return e;let t,n,o;return 4==e.length?(t=Number("0x"+e[1]+e[1]),n=Number("0x"+e[2]+e[2]),o=Number("0x"+e[3]+e[3])):7==e.length&&(t=Number("0x"+e[1]+e[2]),n=Number("0x"+e[3]+e[4]),o=Number("0x"+e[5]+e[6])),`rgb(${t}, ${n}, ${o})`})(i))},item:fi}];return t.$$set=e=>{"key"in e&&o(6,r=e.key),"color"in e&&o(7,i=e.color),"isOpen"in e&&o(0,l=e.isOpen),"cornerX"in e&&o(1,s=e.cornerX),"x"in e&&o(2,a=e.x),"y"in e&&o(3,c=e.y)},[l,s,a,c,$,function(e){e.handler(),e.disabled||o(0,l=!1)},r,i,function(e){$=e,o(4,$)},function(e){l=e,o(0,l)},function(e){s=e,o(1,s)},function(e){a=e,o(2,a)},function(e){c=e,o(3,c)}]}class mi extends Ve{constructor(e){super(),He(this,e,Ci,gi,d,{key:6,color:7,isOpen:0,cornerX:1,x:2,y:3})}}function hi(e,t,n){const o=e.slice();return o[6]=t[n],o[16]=t,o[17]=n,o}function vi(e){let t,n=Me[e[6]]+"";return{c(){t=O(n)},m(e,n){_(e,t,n)},p:r,d(e){e&&z(t)}}}function xi(e){let t,n,o,r,i,l,s;function a(t){e[9](t,e[6])}let c={size:24,key:e[6]};return void 0!==e[0].palette[e[6]]&&(c.value=e[0].palette[e[6]]),t=new An({props:c}),X.push((()=>he(t,"value",a))),t.$on("mouseClick",e[8]),r=new ut({props:{width:"10px"}}),l=new co({props:{$$slots:{default:[vi]},$$scope:{ctx:e}}}),{c(){ve(t.$$.fragment),o=S(),ve(r.$$.fragment),i=S(),ve(l.$$.fragment)},m(e,n){xe(t,e,n),_(e,o,n),xe(r,e,n),_(e,i,n),xe(l,e,n),s=!0},p(o,r){e=o;const i={};!n&&129&r&&(n=!0,i.value=e[0].palette[e[6]],te((()=>n=!1))),t.$set(i);const s={};262144&r&&(s.$$scope={dirty:r,ctx:e}),l.$set(s)},i(e){s||($e(t.$$.fragment,e),$e(r.$$.fragment,e),$e(l.$$.fragment,e),s=!0)},o(e){de(t.$$.fragment,e),de(r.$$.fragment,e),de(l.$$.fragment,e),s=!1},d(e){e&&(z(o),z(i)),we(t,e),we(r,e),we(l,e)}}}function wi(e,t){let n,o,r,i,l;return o=new ut({props:{$$slots:{default:[xi]},$$scope:{ctx:t}}}),i=new ut({props:{height:"6px"}}),{key:e,first:null,c(){n=A(),ve(o.$$.fragment),r=S(),ve(i.$$.fragment),this.first=n},m(e,t){_(e,n,t),xe(o,e,t),_(e,r,t),xe(i,e,t),l=!0},p(e,n){t=e;const r={};262145&n&&(r.$$scope={dirty:n,ctx:t}),o.$set(r)},i(e){l||($e(o.$$.fragment,e),$e(i.$$.fragment,e),l=!0)},o(e){de(o.$$.fragment,e),de(i.$$.fragment,e),l=!1},d(e){e&&(z(n),z(r)),we(o,e),we(i,e)}}}function bi(e){let t,n,o,r,i,l,s,a,c,$,d=[],f=new Map,u=fe(e[7]);const p=e=>e[6];for(let t=0;t<u.length;t+=1){let n=hi(e,u,t),o=p(n);f.set(o,d[t]=wi(o,n))}function g(t){e[10](t)}function C(t){e[11](t)}function m(t){e[12](t)}function h(t){e[13](t)}function v(t){e[14](t)}function x(t){e[15](t)}let w={};return void 0!==e[1]&&(w.color=e[1]),void 0!==e[6]&&(w.key=e[6]),void 0!==e[2]&&(w.isOpen=e[2]),void 0!==e[3]&&(w.cornerX=e[3]),void 0!==e[4]&&(w.x=e[4]),void 0!==e[5]&&(w.y=e[5]),o=new mi({props:w}),X.push((()=>he(o,"color",g))),X.push((()=>he(o,"key",C))),X.push((()=>he(o,"isOpen",m))),X.push((()=>he(o,"cornerX",h))),X.push((()=>he(o,"x",v))),X.push((()=>he(o,"y",x))),{c(){t=I("div");for(let e=0;e<d.length;e+=1)d[e].c();n=S(),ve(o.$$.fragment)},m(e,r){_(e,t,r);for(let e=0;e<d.length;e+=1)d[e]&&d[e].m(t,null);B(t,n),xe(o,t,null),$=!0},p(e,[$]){385&$&&(u=fe(e[7]),ae(),d=ge(d,$,p,1,e,u,f,t,pe,wi,n,hi),ce());const g={};!r&&2&$&&(r=!0,g.color=e[1],te((()=>r=!1))),!i&&64&$&&(i=!0,g.key=e[6],te((()=>i=!1))),!l&&4&$&&(l=!0,g.isOpen=e[2],te((()=>l=!1))),!s&&8&$&&(s=!0,g.cornerX=e[3],te((()=>s=!1))),!a&&16&$&&(a=!0,g.x=e[4],te((()=>a=!1))),!c&&32&$&&(c=!0,g.y=e[5],te((()=>c=!1))),o.$set(g)},i(e){if(!$){for(let e=0;e<u.length;e+=1)$e(d[e]);$e(o.$$.fragment,e),$=!0}},o(e){for(let e=0;e<d.length;e+=1)de(d[e]);de(o.$$.fragment,e),$=!1},d(e){e&&z(t);for(let e=0;e<d.length;e+=1)d[e].d();we(o)}}}function Hi(e,t,n){let{creatorTheme:o}=t,r="",i="",l=!1,s=0,a=0,c=0;const $=Object.keys(o.palette);return e.$$set=e=>{"creatorTheme"in e&&n(0,o=e.creatorTheme)},[o,i,l,s,a,c,r,$,function(e){if(2===e.detail.button){const t=e.detail.input.getBoundingClientRect();n(1,i=e.detail.value),n(6,r=e.detail.key),n(2,l=!0),n(3,s=t.x+t.width/2),n(4,a=t.x-68),n(5,c=t.y+t.height+2)}},function(t,r){e.$$.not_equal(o.palette[r],t)&&(o.palette[r]=t,n(0,o))},function(e){i=e,n(1,i)},function(e){r=e,n(6,r)},function(e){l=e,n(2,l)},function(e){s=e,n(3,s)},function(e){a=e,n(4,a)},function(e){c=e,n(5,c)}]}class Vi extends Ve{constructor(e){super(),He(this,e,Hi,bi,d,{creatorTheme:0})}}function Li(e){let t,n;return{c(){t=T("svg"),n=T("path"),E(n,"d","M321 403C164.779 260.756 52.3246 108.806 13.1149 15.4754M13.1149 15.4754C12.7038 14.1055 12.302 12.7443 11.9094 11.3918C5.04797 -0.275571 5.37766 1.0864 7.09454 10.1764M13.1149 15.4754C11.2008 13.7815 9.20347 12.0176 7.09454 10.1764M13.1149 15.4754C30.6553 30.9987 41.2013 40.6492 66.5116 50.0989M7.09454 10.1764C7.44339 12.0233 7.84945 14.1892 8.26413 16.6296C10.4411 29.4415 10.4225 108.449 8.13556 57.4936C7.86631 51.4944 1.7277 5.53545 3.23906 6.83497C4.56694 7.9767 5.85017 9.09006 7.09454 10.1764Z"),E(n,"stroke","white"),E(n,"stroke-width","5"),E(n,"stroke-linecap","round"),E(t,"width","200px"),E(t,"height","210"),E(t,"viewBox","0 0 324 406"),E(t,"fill","none"),E(t,"xmlns","http://www.w3.org/2000/svg")},m(e,o){_(e,t,o),B(t,n)},p:r,d(e){e&&z(t)}}}function yi(e){let t;return{c(){t=O("Hey! This is the new color palette theme preview.")},m(e,n){_(e,t,n)},d(e){e&&z(t)}}}function Mi(e){let t;return{c(){t=O("Edit colors and see changes instantly in the previewer. Use the mask at the top to zoom\n          and scroll. When the mask is active, you can't interact with Figma UI. To toggle the mask,\n          click the button or press Left Alt key.")},m(e,n){_(e,t,n)},d(e){e&&z(t)}}}function Zi(e){let t,n,o,r,i,l;return t=new co({props:{color:"white",size:"20px",whiteSpace:"wrap",width:"450px",$$slots:{default:[yi]},$$scope:{ctx:e}}}),o=new ut({props:{height:"10px"}}),i=new co({props:{whiteSpace:"wrap",width:"450px",$$slots:{default:[Mi]},$$scope:{ctx:e}}}),{c(){ve(t.$$.fragment),n=S(),ve(o.$$.fragment),r=S(),ve(i.$$.fragment)},m(e,s){xe(t,e,s),_(e,n,s),xe(o,e,s),_(e,r,s),xe(i,e,s),l=!0},p(e,n){const o={};8&n&&(o.$$scope={dirty:n,ctx:e}),t.$set(o);const r={};8&n&&(r.$$scope={dirty:n,ctx:e}),i.$set(r)},i(e){l||($e(t.$$.fragment,e),$e(o.$$.fragment,e),$e(i.$$.fragment,e),l=!0)},o(e){de(t.$$.fragment,e),de(o.$$.fragment,e),de(i.$$.fragment,e),l=!1},d(e){e&&(z(n),z(r)),we(t,e),we(o,e),we(i,e)}}}function ki(e){let t;return{c(){t=O("Use")},m(e,n){_(e,t,n)},d(e){e&&z(t)}}}function Bi(e){let t,n;return t=new co({props:{$$slots:{default:[ki]},$$scope:{ctx:e}}}),{c(){ve(t.$$.fragment)},m(e,o){xe(t,e,o),n=!0},p(e,n){const o={};8&n&&(o.$$scope={dirty:n,ctx:e}),t.$set(o)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){de(t.$$.fragment,e),n=!1},d(e){we(t,e)}}}function _i(e){let t;return{c(){t=O("Left Alt")},m(e,n){_(e,t,n)},d(e){e&&z(t)}}}function zi(e){let t;return{c(){t=O("for toggle mask.")},m(e,n){_(e,t,n)},d(e){e&&z(t)}}}function Ii(e){let t,n;return t=new co({props:{$$slots:{default:[zi]},$$scope:{ctx:e}}}),{c(){ve(t.$$.fragment)},m(e,o){xe(t,e,o),n=!0},p(e,n){const o={};8&n&&(o.$$scope={dirty:n,ctx:e}),t.$set(o)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){de(t.$$.fragment,e),n=!1},d(e){we(t,e)}}}function Ti(e){let t,n,o,r,i,l;return t=new ut({props:{padding:"0 14px 0 0",$$slots:{default:[Bi]},$$scope:{ctx:e}}}),o=new rt({props:{$$slots:{default:[_i]},$$scope:{ctx:e}}}),i=new ut({props:{padding:"0 0 0 14px",$$slots:{default:[Ii]},$$scope:{ctx:e}}}),{c(){ve(t.$$.fragment),n=S(),ve(o.$$.fragment),r=S(),ve(i.$$.fragment)},m(e,s){xe(t,e,s),_(e,n,s),xe(o,e,s),_(e,r,s),xe(i,e,s),l=!0},p(e,n){const r={};8&n&&(r.$$scope={dirty:n,ctx:e}),t.$set(r);const l={};8&n&&(l.$$scope={dirty:n,ctx:e}),o.$set(l);const s={};8&n&&(s.$$scope={dirty:n,ctx:e}),i.$set(s)},i(e){l||($e(t.$$.fragment,e),$e(o.$$.fragment,e),$e(i.$$.fragment,e),l=!0)},o(e){de(t.$$.fragment,e),de(o.$$.fragment,e),de(i.$$.fragment,e),l=!1},d(e){e&&(z(n),z(r)),we(t,e),we(o,e),we(i,e)}}}function Oi(e){let t;return{c(){t=O("Use")},m(e,n){_(e,t,n)},d(e){e&&z(t)}}}function Si(e){let t,n;return t=new co({props:{$$slots:{default:[Oi]},$$scope:{ctx:e}}}),{c(){ve(t.$$.fragment)},m(e,o){xe(t,e,o),n=!0},p(e,n){const o={};8&n&&(o.$$scope={dirty:n,ctx:e}),t.$set(o)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){de(t.$$.fragment,e),n=!1},d(e){we(t,e)}}}function Ai(e){let t;return{c(){t=O("Mouse Wheel")},m(e,n){_(e,t,n)},d(e){e&&z(t)}}}function Fi(e){let t;return{c(){t=O("for change zoom.")},m(e,n){_(e,t,n)},d(e){e&&z(t)}}}function Ei(e){let t,n;return t=new co({props:{$$slots:{default:[Fi]},$$scope:{ctx:e}}}),{c(){ve(t.$$.fragment)},m(e,o){xe(t,e,o),n=!0},p(e,n){const o={};8&n&&(o.$$scope={dirty:n,ctx:e}),t.$set(o)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){de(t.$$.fragment,e),n=!1},d(e){we(t,e)}}}function Pi(e){let t,n,o,r,i,l;return t=new ut({props:{padding:"0 14px 0 0",$$slots:{default:[Si]},$$scope:{ctx:e}}}),o=new rt({props:{$$slots:{default:[Ai]},$$scope:{ctx:e}}}),i=new ut({props:{padding:"0 0 0 14px",$$slots:{default:[Ei]},$$scope:{ctx:e}}}),{c(){ve(t.$$.fragment),n=S(),ve(o.$$.fragment),r=S(),ve(i.$$.fragment)},m(e,s){xe(t,e,s),_(e,n,s),xe(o,e,s),_(e,r,s),xe(i,e,s),l=!0},p(e,n){const r={};8&n&&(r.$$scope={dirty:n,ctx:e}),t.$set(r);const l={};8&n&&(l.$$scope={dirty:n,ctx:e}),o.$set(l);const s={};8&n&&(s.$$scope={dirty:n,ctx:e}),i.$set(s)},i(e){l||($e(t.$$.fragment,e),$e(o.$$.fragment,e),$e(i.$$.fragment,e),l=!0)},o(e){de(t.$$.fragment,e),de(o.$$.fragment,e),de(i.$$.fragment,e),l=!1},d(e){e&&(z(n),z(r)),we(t,e),we(o,e),we(i,e)}}}function Ri(e){let t;return{c(){t=O("Use")},m(e,n){_(e,t,n)},d(e){e&&z(t)}}}function Di(e){let t,n;return t=new co({props:{$$slots:{default:[Ri]},$$scope:{ctx:e}}}),{c(){ve(t.$$.fragment)},m(e,o){xe(t,e,o),n=!0},p(e,n){const o={};8&n&&(o.$$scope={dirty:n,ctx:e}),t.$set(o)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){de(t.$$.fragment,e),n=!1},d(e){we(t,e)}}}function ji(e){let t;return{c(){t=O("Left Mouse Button")},m(e,n){_(e,t,n)},d(e){e&&z(t)}}}function Ni(e){let t;return{c(){t=O("for dragging the previewer area.")},m(e,n){_(e,t,n)},d(e){e&&z(t)}}}function Ui(e){let t,n;return t=new co({props:{$$slots:{default:[Ni]},$$scope:{ctx:e}}}),{c(){ve(t.$$.fragment)},m(e,o){xe(t,e,o),n=!0},p(e,n){const o={};8&n&&(o.$$scope={dirty:n,ctx:e}),t.$set(o)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){de(t.$$.fragment,e),n=!1},d(e){we(t,e)}}}function qi(e){let t,n,o,r,i,l;return t=new ut({props:{padding:"0 14px 0 0",$$slots:{default:[Di]},$$scope:{ctx:e}}}),o=new rt({props:{$$slots:{default:[ji]},$$scope:{ctx:e}}}),i=new ut({props:{padding:"0 0 0 14px",$$slots:{default:[Ui]},$$scope:{ctx:e}}}),{c(){ve(t.$$.fragment),n=S(),ve(o.$$.fragment),r=S(),ve(i.$$.fragment)},m(e,s){xe(t,e,s),_(e,n,s),xe(o,e,s),_(e,r,s),xe(i,e,s),l=!0},p(e,n){const r={};8&n&&(r.$$scope={dirty:n,ctx:e}),t.$set(r);const l={};8&n&&(l.$$scope={dirty:n,ctx:e}),o.$set(l);const s={};8&n&&(s.$$scope={dirty:n,ctx:e}),i.$set(s)},i(e){l||($e(t.$$.fragment,e),$e(o.$$.fragment,e),$e(i.$$.fragment,e),l=!0)},o(e){de(t.$$.fragment,e),de(o.$$.fragment,e),de(i.$$.fragment,e),l=!1},d(e){e&&(z(n),z(r)),we(t,e),we(o,e),we(i,e)}}}function Gi(e){let t,n,o;function r(t){e[2](t)}let i={text:"Don't show this tutorial again"};return void 0!==e[0].app.dontShowTutorialCreator&&(i.checked=e[0].app.dontShowTutorialCreator),t=new qn({props:i}),X.push((()=>he(t,"checked",r))),{c(){ve(t.$$.fragment)},m(e,n){xe(t,e,n),o=!0},p(e,o){const r={};!n&&1&o&&(n=!0,r.checked=e[0].app.dontShowTutorialCreator,te((()=>n=!1))),t.$set(r)},i(e){o||($e(t.$$.fragment,e),o=!0)},o(e){de(t.$$.fragment,e),o=!1},d(e){we(t,e)}}}function Wi(e){let t,n,o,r,i,l,s,a,c,$;return t=new ut({props:{der:"column",padding:"0 0 30px 0",$$slots:{default:[Zi]},$$scope:{ctx:e}}}),o=new ut({props:{alignItems:"center",$$slots:{default:[Ti]},$$scope:{ctx:e}}}),i=new ut({props:{alignItems:"center",padding:"14px 0 0 0",$$slots:{default:[Pi]},$$scope:{ctx:e}}}),s=new ut({props:{alignItems:"center",padding:"14px 0 0 0",$$slots:{default:[qi]},$$scope:{ctx:e}}}),c=new ut({props:{alignItems:"center",padding:"14px 0 0 0",$$slots:{default:[Gi]},$$scope:{ctx:e}}}),{c(){ve(t.$$.fragment),n=S(),ve(o.$$.fragment),r=S(),ve(i.$$.fragment),l=S(),ve(s.$$.fragment),a=S(),ve(c.$$.fragment)},m(e,d){xe(t,e,d),_(e,n,d),xe(o,e,d),_(e,r,d),xe(i,e,d),_(e,l,d),xe(s,e,d),_(e,a,d),xe(c,e,d),$=!0},p(e,n){const r={};8&n&&(r.$$scope={dirty:n,ctx:e}),t.$set(r);const l={};8&n&&(l.$$scope={dirty:n,ctx:e}),o.$set(l);const a={};8&n&&(a.$$scope={dirty:n,ctx:e}),i.$set(a);const $={};8&n&&($.$$scope={dirty:n,ctx:e}),s.$set($);const d={};9&n&&(d.$$scope={dirty:n,ctx:e}),c.$set(d)},i(e){$||($e(t.$$.fragment,e),$e(o.$$.fragment,e),$e(i.$$.fragment,e),$e(s.$$.fragment,e),$e(c.$$.fragment,e),$=!0)},o(e){de(t.$$.fragment,e),de(o.$$.fragment,e),de(i.$$.fragment,e),de(s.$$.fragment,e),de(c.$$.fragment,e),$=!1},d(e){e&&(z(n),z(r),z(l),z(a)),we(t,e),we(o,e),we(i,e),we(s,e),we(c,e)}}}function Xi(e){let t,n,o,r;return t=new ut({props:{width:"200px",padding:"2px 0 0 0px",$$slots:{default:[Li]},$$scope:{ctx:e}}}),o=new ut({props:{der:"column",padding:"40px 0 0 0",$$slots:{default:[Wi]},$$scope:{ctx:e}}}),{c(){ve(t.$$.fragment),n=S(),ve(o.$$.fragment)},m(e,i){xe(t,e,i),_(e,n,i),xe(o,e,i),r=!0},p(e,n){const r={};8&n&&(r.$$scope={dirty:n,ctx:e}),t.$set(r);const i={};9&n&&(i.$$scope={dirty:n,ctx:e}),o.$set(i)},i(e){r||($e(t.$$.fragment,e),$e(o.$$.fragment,e),r=!0)},o(e){de(t.$$.fragment,e),de(o.$$.fragment,e),r=!1},d(e){e&&z(n),we(t,e),we(o,e)}}}function Yi(e){let t,n,o,r,i,l;return n=new ut({props:{margin:"0 0 0 40px",height:"40px",width:"100%",bgColor:"rgba(0, 0, 0, 0.8)"}}),r=new ut({props:{height:"100%",width:"100%",bgColor:"rgba(0, 0, 0, 0.8)",$$slots:{default:[Xi]},$$scope:{ctx:e}}}),{c(){t=I("div"),ve(n.$$.fragment),o=S(),ve(r.$$.fragment),E(t,"style",i=`display: ${e[1]};`),E(t,"class","svelte-1va8owf")},m(e,i){_(e,t,i),xe(n,t,null),B(t,o),xe(r,t,null),l=!0},p(e,[n]){const o={};9&n&&(o.$$scope={dirty:n,ctx:e}),r.$set(o),(!l||2&n&&i!==(i=`display: ${e[1]};`))&&E(t,"style",i)},i(e){l||($e(n.$$.fragment,e),$e(r.$$.fragment,e),l=!0)},o(e){de(n.$$.fragment,e),de(r.$$.fragment,e),l=!1},d(e){e&&z(t),we(n),we(r)}}}function Ji(e,t,n){let o;C(e,Ae,(e=>n(0,o=e)));let r="block";return e.$$.update=()=>{1&e.$$.dirty&&n(1,r=o.app.dontShowTutorialCreator?"none":"block")},[o,r,function(t){e.$$.not_equal(o.app.dontShowTutorialCreator,t)&&(o.app.dontShowTutorialCreator=t,Ae.set(o))}]}class Ki extends Ve{constructor(e){super(),He(this,e,Ji,Yi,d,{})}}function Qi(e){let t;return{c(){t=O("Enter name of new theme")},m(e,n){_(e,t,n)},d(e){e&&z(t)}}}function el(e){let t;return{c(){t=O(e[2])},m(e,n){_(e,t,n)},p(e,n){4&n&&P(t,e[2])},d(e){e&&z(t)}}}function tl(e){let t,n;return t=new co({props:{size:"12px",color:"var(--bg-window-close)",$$slots:{default:[el]},$$scope:{ctx:e}}}),{c(){ve(t.$$.fragment)},m(e,o){xe(t,e,o),n=!0},p(e,n){const o={};134217732&n&&(o.$$scope={dirty:n,ctx:e}),t.$set(o)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){de(t.$$.fragment,e),n=!1},d(e){we(t,e)}}}function nl(e){let t,n,o,r,i,l,s,a;function c(t){e[13](t)}function $(t){e[14](t)}t=new uo({props:{$$slots:{default:[Qi]},$$scope:{ctx:e}}});let d={validator:ni,placeholder:"Theme name"};return void 0!==e[10].theme.name&&(d.value=e[10].theme.name),void 0!==e[9]&&(d.isValidValue=e[9]),o=new jn({props:d}),X.push((()=>he(o,"value",c))),X.push((()=>he(o,"isValidValue",$))),s=new ut({props:{height:"20px",$$slots:{default:[tl]},$$scope:{ctx:e}}}),{c(){ve(t.$$.fragment),n=S(),ve(o.$$.fragment),l=S(),ve(s.$$.fragment)},m(e,r){xe(t,e,r),_(e,n,r),xe(o,e,r),_(e,l,r),xe(s,e,r),a=!0},p(e,n){const l={};134217728&n&&(l.$$scope={dirty:n,ctx:e}),t.$set(l);const a={};!r&&1024&n&&(r=!0,a.value=e[10].theme.name,te((()=>r=!1))),!i&&512&n&&(i=!0,a.isValidValue=e[9],te((()=>i=!1))),o.$set(a);const c={};134217732&n&&(c.$$scope={dirty:n,ctx:e}),s.$set(c)},i(e){a||($e(t.$$.fragment,e),$e(o.$$.fragment,e),$e(s.$$.fragment,e),a=!0)},o(e){de(t.$$.fragment,e),de(o.$$.fragment,e),de(s.$$.fragment,e),a=!1},d(e){e&&(z(n),z(l)),we(t,e),we(o,e),we(s,e)}}}function ol(e){let t;return{c(){t=O("Enter your name as author")},m(e,n){_(e,t,n)},d(e){e&&z(t)}}}function rl(e){let t;return{c(){t=O(e[1])},m(e,n){_(e,t,n)},p(e,n){2&n&&P(t,e[1])},d(e){e&&z(t)}}}function il(e){let t,n;return t=new co({props:{size:"12px",color:"var(--bg-window-close)",$$slots:{default:[rl]},$$scope:{ctx:e}}}),{c(){ve(t.$$.fragment)},m(e,o){xe(t,e,o),n=!0},p(e,n){const o={};134217730&n&&(o.$$scope={dirty:n,ctx:e}),t.$set(o)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){de(t.$$.fragment,e),n=!1},d(e){we(t,e)}}}function ll(e){let t,n,o,r,i,l,s,a;function c(t){e[15](t)}function $(t){e[16](t)}t=new uo({props:{$$slots:{default:[ol]},$$scope:{ctx:e}}});let d={validator:oi,placeholder:"Author name"};return void 0!==e[10].theme.author&&(d.value=e[10].theme.author),void 0!==e[8]&&(d.isValidValue=e[8]),o=new jn({props:d}),X.push((()=>he(o,"value",c))),X.push((()=>he(o,"isValidValue",$))),s=new ut({props:{height:"20px",$$slots:{default:[il]},$$scope:{ctx:e}}}),{c(){ve(t.$$.fragment),n=S(),ve(o.$$.fragment),l=S(),ve(s.$$.fragment)},m(e,r){xe(t,e,r),_(e,n,r),xe(o,e,r),_(e,l,r),xe(s,e,r),a=!0},p(e,n){const l={};134217728&n&&(l.$$scope={dirty:n,ctx:e}),t.$set(l);const a={};!r&&1024&n&&(r=!0,a.value=e[10].theme.author,te((()=>r=!1))),!i&&256&n&&(i=!0,a.isValidValue=e[8],te((()=>i=!1))),o.$set(a);const c={};134217730&n&&(c.$$scope={dirty:n,ctx:e}),s.$set(c)},i(e){a||($e(t.$$.fragment,e),$e(o.$$.fragment,e),$e(s.$$.fragment,e),a=!0)},o(e){de(t.$$.fragment,e),de(o.$$.fragment,e),de(s.$$.fragment,e),a=!1},d(e){e&&(z(n),z(l)),we(t,e),we(o,e),we(s,e)}}}function sl(e){let t,n,o,r,i,l;return t=new ut({props:{der:"column",width:"-webkit-fill-available",$$slots:{default:[nl]},$$scope:{ctx:e}}}),o=new ut({props:{width:"120px"}}),i=new ut({props:{der:"column",width:"-webkit-fill-available",$$slots:{default:[ll]},$$scope:{ctx:e}}}),{c(){ve(t.$$.fragment),n=S(),ve(o.$$.fragment),r=S(),ve(i.$$.fragment)},m(e,s){xe(t,e,s),_(e,n,s),xe(o,e,s),_(e,r,s),xe(i,e,s),l=!0},p(e,n){const o={};134219268&n&&(o.$$scope={dirty:n,ctx:e}),t.$set(o);const r={};134219010&n&&(r.$$scope={dirty:n,ctx:e}),i.$set(r)},i(e){l||($e(t.$$.fragment,e),$e(o.$$.fragment,e),$e(i.$$.fragment,e),l=!0)},o(e){de(t.$$.fragment,e),de(o.$$.fragment,e),de(i.$$.fragment,e),l=!1},d(e){e&&(z(n),z(r)),we(t,e),we(o,e),we(i,e)}}}function al(e){let t,n,r,i,l,s,a,c,$,d,f,p,g,C,m,h,v,x;return n=new ii({}),{c(){t=I("iframeView"),ve(n.$$.fragment),i=S(),l=I("iframeView"),s=I("webview"),c=S(),$=I("webview"),f=S(),p=I("webview"),C=S(),m=I("webview"),E(t,"style",r=`\n              ${Be(e[10].theme).join(";")};\n              z-index: ${e[11].app.useOldPreviewer?2:0};\n              display: ${e[11].app.useOldPreviewer?"block":"none"};\n              user-select: ${e[11].app.useOldPreviewer?"all":"none"};\n            `),E(t,"class","svelte-18pxjy6"),E(s,"preload",`file://${o.resolve(process.cwd(),"dist/renderer","themePreviewPreload.js")}`),E(s,"style","\n                  user-select: none;\n                  width: 1099px;\n                  height: 609px;\n                "),E(s,"title","Figma recent files"),u(s.src,a="https://www.figma.com/files/recent")||E(s,"src","https://www.figma.com/files/recent"),E($,"preload",`file://${o.resolve(process.cwd(),"dist/renderer","themePreviewPreload.js")}`),E($,"style","\n                  user-select: none;\n                  width: 1099px;\n                  height: 609px;\n                "),E($,"title","Figma recent files"),u($.src,d="https://www.figma.com/files/recent")||E($,"src","https://www.figma.com/files/recent"),E(p,"preload",`file://${o.resolve(process.cwd(),"dist/renderer","themePreviewPreload.js")}`),E(p,"style","\n                  user-select: none;\n                  width: 1099px;\n                  height: 609px;\n                "),E(p,"title","Figma recent files"),u(p.src,g="https://www.figma.com/files/recent")||E(p,"src","https://www.figma.com/files/recent"),E(m,"preload",`file://${o.resolve(process.cwd(),"dist/renderer","themePreviewPreload.js")}`),E(m,"style","\n                  user-select: none;\n                  width: 1099px;\n                  height: 609px;\n                "),E(m,"title","Figma recent files"),u(m.src,h="https://www.figma.com/files/recent")||E(m,"src","https://www.figma.com/files/recent"),E(l,"style",v=`\n              z-index: ${e[11].app.useOldPreviewer?0:2};\n              display: ${e[11].app.useOldPreviewer?"none":"grid"};\n              user-select: ${e[11].app.useOldPreviewer?"none":"all"};\n            `),E(l,"class","svelte-18pxjy6")},m(o,r){_(o,t,r),xe(n,t,null),_(o,i,r),_(o,l,r),B(l,s),e[17](s),B(l,c),B(l,$),e[18]($),B(l,f),B(l,p),e[19](p),B(l,C),B(l,m),e[20](m),e[21](l),x=!0},p(e,n){(!x||3072&n&&r!==(r=`\n              ${Be(e[10].theme).join(";")};\n              z-index: ${e[11].app.useOldPreviewer?2:0};\n              display: ${e[11].app.useOldPreviewer?"block":"none"};\n              user-select: ${e[11].app.useOldPreviewer?"all":"none"};\n            `))&&E(t,"style",r),(!x||2048&n&&v!==(v=`\n              z-index: ${e[11].app.useOldPreviewer?0:2};\n              display: ${e[11].app.useOldPreviewer?"none":"grid"};\n              user-select: ${e[11].app.useOldPreviewer?"none":"all"};\n            `))&&E(l,"style",v)},i(e){x||($e(n.$$.fragment,e),x=!0)},o(e){de(n.$$.fragment,e),x=!1},d(o){o&&(z(t),z(i),z(l)),we(n),e[17](null),e[18](null),e[19](null),e[20](null),e[21](null)}}}function cl(e){let t,n;return t=new _n({props:{color:"var(--text)",size:"14"}}),{c(){ve(t.$$.fragment)},m(e,o){xe(t,e,o),n=!0},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){de(t.$$.fragment,e),n=!1},d(e){we(t,e)}}}function $l(e){let t,n;return t=new Tn({props:{color:"var(--text)",size:"14"}}),{c(){ve(t.$$.fragment)},m(e,o){xe(t,e,o),n=!0},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){de(t.$$.fragment,e),n=!1},d(e){we(t,e)}}}function dl(e){let t,n,o,r;const i=[$l,cl],l=[];function s(e,t){return e[10].previewMaskVisible?0:1}return t=s(e),n=l[t]=i[t](e),{c(){n.c(),o=A()},m(e,n){l[t].m(e,n),_(e,o,n),r=!0},p(e,r){let a=t;t=s(e),t!==a&&(ae(),de(l[a],1,1,(()=>{l[a]=null})),ce(),n=l[t],n||(n=l[t]=i[t](e),n.c()),$e(n,1),n.m(o.parentNode,o))},i(e){r||($e(n),r=!0)},o(e){de(n),r=!1},d(e){e&&z(o),l[t].d(e)}}}function fl(e){let t,n,o;return n=new Ye({props:{normalBgColor:"tarsparent",$$slots:{default:[dl]},$$scope:{ctx:e}}}),n.$on("buttonClick",je.togglePreviewVisible),{c(){t=I("toolBar"),ve(n.$$.fragment),E(t,"slot","toolBar"),E(t,"class","svelte-18pxjy6")},m(e,r){_(e,t,r),xe(n,t,null),o=!0},p(e,t){const o={};134218752&t&&(o.$$scope={dirty:t,ctx:e}),n.$set(o)},i(e){o||($e(n.$$.fragment,e),o=!0)},o(e){de(n.$$.fragment,e),o=!1},d(e){e&&z(t),we(n)}}}function ul(e){let t,n;return t=new Ki({props:{slot:"layout_1"}}),{c(){ve(t.$$.fragment)},m(e,o){xe(t,e,o),n=!0},p:r,i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){de(t.$$.fragment,e),n=!1},d(e){we(t,e)}}}function pl(e){let t,n,o=Math.floor(100*e[10].zoom)+"";return{c(){t=O(o),n=O("%")},m(e,o){_(e,t,o),_(e,n,o)},p(e,n){1024&n&&o!==(o=Math.floor(100*e[10].zoom)+"")&&P(t,o)},d(e){e&&(z(t),z(n))}}}function gl(e){let t,n;return t=new co({props:{padding:"8px 0 0 0",$$slots:{default:[pl]},$$scope:{ctx:e}}}),{c(){ve(t.$$.fragment)},m(e,o){xe(t,e,o),n=!0},p(e,n){const o={};134218752&n&&(o.$$scope={dirty:n,ctx:e}),t.$set(o)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){de(t.$$.fragment,e),n=!1},d(e){we(t,e)}}}function Cl(e){let t,n,o,r,i,l,s,a,c,$,d,f;function u(t){e[22](t)}function p(t){e[23](t)}function g(t){e[24](t)}let C={minZoom:.2,maxZoom:1.5,height:`${e[3]}px`,$$slots:{layout_1:[ul],toolBar:[fl],default:[al]},$$scope:{ctx:e}};function m(t){e[25](t)}void 0!==e[6]&&(C.maskBounds=e[6]),void 0!==e[10].zoom&&(C.zoom=e[10].zoom),void 0!==e[10].previewMaskVisible&&(C.isMaskActive=e[10].previewMaskVisible),t=new Bt({props:C}),X.push((()=>he(t,"maskBounds",u))),X.push((()=>he(t,"zoom",p))),X.push((()=>he(t,"isMaskActive",g))),l=new ut({props:{height:"10px"}});let h={min:.2,max:1.5,step:.05};return void 0!==e[10].zoom&&(h.value=e[10].zoom),a=new Pn({props:h}),X.push((()=>he(a,"value",m))),d=new ut({props:{der:"column",alignItems:"center",justifyContent:"center",$$slots:{default:[gl]},$$scope:{ctx:e}}}),{c(){ve(t.$$.fragment),i=S(),ve(l.$$.fragment),s=S(),ve(a.$$.fragment),$=S(),ve(d.$$.fragment)},m(e,n){xe(t,e,n),_(e,i,n),xe(l,e,n),_(e,s,n),xe(a,e,n),_(e,$,n),xe(d,e,n),f=!0},p(e,i){const l={};8&i&&(l.height=`${e[3]}px`),134220960&i&&(l.$$scope={dirty:i,ctx:e}),!n&&64&i&&(n=!0,l.maskBounds=e[6],te((()=>n=!1))),!o&&1024&i&&(o=!0,l.zoom=e[10].zoom,te((()=>o=!1))),!r&&1024&i&&(r=!0,l.isMaskActive=e[10].previewMaskVisible,te((()=>r=!1))),t.$set(l);const s={};!c&&1024&i&&(c=!0,s.value=e[10].zoom,te((()=>c=!1))),a.$set(s);const $={};134218752&i&&($.$$scope={dirty:i,ctx:e}),d.$set($)},i(e){f||($e(t.$$.fragment,e),$e(l.$$.fragment,e),$e(a.$$.fragment,e),$e(d.$$.fragment,e),f=!0)},o(e){de(t.$$.fragment,e),de(l.$$.fragment,e),de(a.$$.fragment,e),de(d.$$.fragment,e),f=!1},d(e){e&&(z(i),z(s),z($)),we(t,e),we(l,e),we(a,e),we(d,e)}}}function ml(e){let t,n,o,r;return t=new ut({props:{$$slots:{default:[sl]},$$scope:{ctx:e}}}),o=new ut({props:{der:"column",$$slots:{default:[Cl]},$$scope:{ctx:e}}}),{c(){ve(t.$$.fragment),n=S(),ve(o.$$.fragment)},m(e,i){xe(t,e,i),_(e,n,i),xe(o,e,i),r=!0},p(e,n){const r={};134219526&n&&(r.$$scope={dirty:n,ctx:e}),t.$set(r);const i={};134221032&n&&(i.$$scope={dirty:n,ctx:e}),o.$set(i)},i(e){r||($e(t.$$.fragment,e),$e(o.$$.fragment,e),r=!0)},o(e){de(t.$$.fragment,e),de(o.$$.fragment,e),r=!1},d(e){e&&z(n),we(t,e),we(o,e)}}}function hl(e){let t;return{c(){t=O("Color Palette")},m(e,n){_(e,t,n)},d(e){e&&z(t)}}}function vl(e){let t,n,o,r,i,l,s;function a(t){e[26](t)}t=new uo({props:{$$slots:{default:[hl]},$$scope:{ctx:e}}});let c={};return void 0!==e[10].theme&&(c.creatorTheme=e[10].theme),r=new Vi({props:c}),X.push((()=>he(r,"creatorTheme",a))),{c(){ve(t.$$.fragment),n=S(),o=I("colorPaletteDiv"),ve(r.$$.fragment),E(o,"style",l=`height: ${e[3]+90}px; overflow: auto;`),E(o,"class","svelte-18pxjy6")},m(e,i){xe(t,e,i),_(e,n,i),_(e,o,i),xe(r,o,null),s=!0},p(e,n){const a={};134217728&n&&(a.$$scope={dirty:n,ctx:e}),t.$set(a);const c={};!i&&1024&n&&(i=!0,c.creatorTheme=e[10].theme,te((()=>i=!1))),r.$set(c),(!s||8&n&&l!==(l=`height: ${e[3]+90}px; overflow: auto;`))&&E(o,"style",l)},i(e){s||($e(t.$$.fragment,e),$e(r.$$.fragment,e),s=!0)},o(e){de(t.$$.fragment,e),de(r.$$.fragment,e),s=!1},d(e){e&&(z(n),z(o)),we(t,e),we(r)}}}function xl(e){let t,n,o,r,i,l;return t=new ut({props:{der:"column",$$slots:{default:[ml]},$$scope:{ctx:e}}}),o=new ut({}),i=new ut({props:{der:"column",justifyItems:"stretch",width:"-webkit-fill-available",$$slots:{default:[vl]},$$scope:{ctx:e}}}),{c(){ve(t.$$.fragment),n=S(),ve(o.$$.fragment),r=S(),ve(i.$$.fragment)},m(e,s){xe(t,e,s),_(e,n,s),xe(o,e,s),_(e,r,s),xe(i,e,s),l=!0},p(e,n){const o={};134221806&n&&(o.$$scope={dirty:n,ctx:e}),t.$set(o);const r={};134218760&n&&(r.$$scope={dirty:n,ctx:e}),i.$set(r)},i(e){l||($e(t.$$.fragment,e),$e(o.$$.fragment,e),$e(i.$$.fragment,e),l=!0)},o(e){de(t.$$.fragment,e),de(o.$$.fragment,e),de(i.$$.fragment,e),l=!1},d(e){e&&(z(n),z(r)),we(t,e),we(o,e),we(i,e)}}}function wl(e){let t,n,o,r;return n=new $t({props:{columns:"1fr 2vmin 35vmin",$$slots:{default:[xl]},$$scope:{ctx:e}}}),{c(){t=I("div"),ve(n.$$.fragment),E(t,"style",o=`z-index: ${e[0]}; height: ${e[4]}px;`),E(t,"class","svelte-18pxjy6")},m(e,o){_(e,t,o),xe(n,t,null),r=!0},p(e,[i]){const l={};134221806&i&&(l.$$scope={dirty:i,ctx:e}),n.$set(l),(!r||17&i&&o!==(o=`z-index: ${e[0]}; height: ${e[4]}px;`))&&E(t,"style",o)},i(e){r||($e(n.$$.fragment,e),r=!0)},o(e){de(n.$$.fragment,e),r=!1},d(e){e&&z(t),we(n)}}}function bl(e,t,n){let o,r,i,l,s,a,c;C(e,Pe,(e=>n(1,i=e))),C(e,Ee,(e=>n(2,l=e))),C(e,je,(e=>n(10,s=e))),C(e,Re,(e=>n(12,a=e))),C(e,Ae,(e=>n(11,c=e)));let $,d,f,{zIndex:u}=t,p={width:0,height:0},g=[];return e.$$set=e=>{"zIndex"in e&&n(0,u=e.zIndex)},e.$$.update=()=>{4096&e.$$.dirty&&a&&n(3,$=a.height-238),4096&e.$$.dirty&&a&&n(4,d=a.height-94),4&e.$$.dirty&&n(9,o=""===l),2&e.$$.dirty&&n(8,r=""===i)},[u,i,l,$,d,f,p,g,r,o,s,c,a,function(t){e.$$.not_equal(s.theme.name,t)&&(s.theme.name=t,je.set(s))},function(e){o=e,n(9,o),n(2,l)},function(t){e.$$.not_equal(s.theme.author,t)&&(s.theme.author=t,je.set(s))},function(e){r=e,n(8,r),n(1,i)},function(e){X[e?"unshift":"push"]((()=>{g[0]=e,n(7,g)}))},function(e){X[e?"unshift":"push"]((()=>{g[1]=e,n(7,g)}))},function(e){X[e?"unshift":"push"]((()=>{g[2]=e,n(7,g)}))},function(e){X[e?"unshift":"push"]((()=>{g[3]=e,n(7,g)}))},function(e){X[e?"unshift":"push"]((()=>{f=e,n(5,f)}))},function(e){p=e,n(6,p)},function(t){e.$$.not_equal(s.zoom,t)&&(s.zoom=t,je.set(s))},function(t){e.$$.not_equal(s.previewMaskVisible,t)&&(s.previewMaskVisible=t,je.set(s))},function(t){e.$$.not_equal(s.zoom,t)&&(s.zoom=t,je.set(s))},function(t){e.$$.not_equal(s.theme,t)&&(s.theme=t,je.set(s))}]}class Hl extends Ve{constructor(e){super(),He(this,e,bl,wl,d,{zIndex:0})}}const Vl=e=>({}),Ll=e=>({slot:"popupButton"});function yl(e){let t;const n=e[4].default,o=m(n,e,e[7],Ll);return{c(){o&&o.c()},m(e,n){o&&o.m(e,n),t=!0},p(e,r){o&&o.p&&(!t||128&r)&&x(o,n,e,e[7],t?v(n,e[7],r,Vl):w(e[7]),Ll)},i(e){t||($e(o,e),t=!0)},o(e){de(o,e),t=!1},d(e){o&&o.d(e)}}}function Ml(e){let t,n,o;function r(t){e[5](t)}let i={slot:"popupBody",border:"0",padding:"0",bradius:"0",onItemClick:e[2]};return void 0!==e[0]&&(i.items=e[0]),t=new Jn({props:i}),X.push((()=>he(t,"items",r))),{c(){ve(t.$$.fragment)},m(e,n){xe(t,e,n),o=!0},p(e,o){const r={};!n&&1&o&&(n=!0,r.items=e[0],te((()=>n=!1))),t.$set(r)},i(e){o||($e(t.$$.fragment,e),o=!0)},o(e){de(t.$$.fragment,e),o=!1},d(e){we(t,e)}}}function Zl(e){let t,n,o;function r(t){e[6](t)}let i={bradius:"3px",$$slots:{popupBody:[Ml],popupButton:[yl]},$$scope:{ctx:e}};return void 0!==e[1]&&(i.isOpen=e[1]),t=new Ho({props:i}),X.push((()=>he(t,"isOpen",r))),{c(){ve(t.$$.fragment)},m(e,n){xe(t,e,n),o=!0},p(e,[o]){const r={};129&o&&(r.$$scope={dirty:o,ctx:e}),!n&&2&o&&(n=!0,r.isOpen=e[1],te((()=>n=!1))),t.$set(r)},i(e){o||($e(t.$$.fragment,e),o=!0)},o(e){de(t.$$.fragment,e),o=!1},d(e){we(t,e)}}}function kl(t,n,o){let r,i,l;C(t,je,(e=>o(3,r=e))),C(t,Ne,(e=>o(8,i=e))),C(t,Fe,(e=>o(9,l=e)));let{$$slots:s={},$$scope:a}=n,c=!1,$=[{id:"reset",text:"Reset",itemArgs:{Icon:vn},handler:function(){je.reset()},item:fi},{id:"resetTmp",text:"Reset Template",itemArgs:{Icon:vn},handler:function(){const e=r.loadedTemplateId,t=structuredClone([...l,...i].find((t=>t.id===e)));je.setPaletteTheme(t)},item:fi},{id:"save",text:"Save",disabled:!0,itemArgs:{Icon:bn},handler:d,item:fi},{id:"add_to_themes",text:"Add to themes",itemArgs:{Icon:Cn},handler:d,item:fi},{id:"export",text:"Export",itemArgs:{Icon:Zn},handler:function(){if(!ni(r.theme.name))return;if(!oi(r.theme.author))return;e.ipcRenderer.send("themeCreatorExportTheme",r.theme)},item:fi}];function d(){ni(r.theme.name)&&oi(r.theme.author)&&(e.ipcRenderer.send("themeCreatorAddTheme",r.theme),je.reset())}return t.$$set=e=>{"$$scope"in e&&o(7,a=e.$$scope)},t.$$.update=()=>{9&t.$$.dirty&&(o(0,$=$.map((e=>("save"===e.id&&(e.disabled="edit"!==r.state),e)))),o(0,$=$.map((e=>("resetTmp"===e.id&&(e.disabled=""===r.loadedTemplateId),e)))))},[$,c,function(e){e.handler(),e.disabled||o(1,c=!1)},r,s,function(e){$=e,o(0,$),o(3,r)},function(e){c=e,o(1,c)},a]}class Bl extends Ve{constructor(e){super(),He(this,e,kl,Zl,d,{})}}function _l(e){let t,n;return t=new $n({props:{color:"var(--text)"}}),{c(){ve(t.$$.fragment)},m(e,o){xe(t,e,o),n=!0},p:r,i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){de(t.$$.fragment,e),n=!1},d(e){we(t,e)}}}function zl(e){let t,n;return t=new Ge({props:{size:32,round:3,hoverBgColor:"var(--borders)",$$slots:{default:[_l]},$$scope:{ctx:e}}}),{c(){ve(t.$$.fragment)},m(e,o){xe(t,e,o),n=!0},p(e,n){const o={};1&n&&(o.$$scope={dirty:n,ctx:e}),t.$set(o)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){de(t.$$.fragment,e),n=!1},d(e){we(t,e)}}}function Il(e){let t,n,o,r;return t=new Bl({props:{$$slots:{default:[zl]},$$scope:{ctx:e}}}),o=new ut({props:{width:"10px"}}),{c(){ve(t.$$.fragment),n=S(),ve(o.$$.fragment)},m(e,i){xe(t,e,i),_(e,n,i),xe(o,e,i),r=!0},p(e,n){const o={};1&n&&(o.$$scope={dirty:n,ctx:e}),t.$set(o)},i(e){r||($e(t.$$.fragment,e),$e(o.$$.fragment,e),r=!0)},o(e){de(t.$$.fragment,e),de(o.$$.fragment,e),r=!1},d(e){e&&z(n),we(t,e),we(o,e)}}}function Tl(e){let t,n;return t=new ut({props:{$$slots:{default:[Il]},$$scope:{ctx:e}}}),{c(){ve(t.$$.fragment)},m(e,o){xe(t,e,o),n=!0},p(e,[n]){const o={};1&n&&(o.$$scope={dirty:n,ctx:e}),t.$set(o)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){de(t.$$.fragment,e),n=!1},d(e){we(t,e)}}}class Ol extends Ve{constructor(e){super(),He(this,e,null,Tl,d,{})}}function Sl(e,t,n){const o=e.slice();return o[11]=t[n],o}function Al(e){let t,n,o;function r(t){e[7](t)}let i={items:e[4],initItemId:"general",onItemClick:e[5]};return void 0!==e[1]&&(i.currentId=e[1]),t=new oo({props:i}),X.push((()=>he(t,"currentId",r))),{c(){ve(t.$$.fragment)},m(e,n){xe(t,e,n),o=!0},p(e,o){const r={};!n&&2&o&&(n=!0,r.currentId=e[1],te((()=>n=!1))),t.$set(r)},i(e){o||($e(t.$$.fragment,e),o=!0)},o(e){de(t.$$.fragment,e),o=!1},d(e){we(t,e)}}}function Fl(e){let t,n;return t=new Wt({props:{color:"var(--text)"}}),{c(){ve(t.$$.fragment)},m(e,o){xe(t,e,o),n=!0},p:r,i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){de(t.$$.fragment,e),n=!1},d(e){we(t,e)}}}function El(e){let t,n,o,r,i,l;t=new Ct({props:{grow:1,$$slots:{default:[Al]},$$scope:{ctx:e}}});var s=e[0].headerComponent;return s&&(o=D(s,{})),i=new Ge({props:{size:32,round:3,hoverBgColor:"var(--borders)",$$slots:{default:[Fl]},$$scope:{ctx:e}}}),i.$on("buttonClick",e[8]),{c(){ve(t.$$.fragment),n=S(),o&&ve(o.$$.fragment),r=S(),ve(i.$$.fragment)},m(e,s){xe(t,e,s),_(e,n,s),o&&xe(o,e,s),_(e,r,s),xe(i,e,s),l=!0},p(e,n){const l={};if(16386&n&&(l.$$scope={dirty:n,ctx:e}),t.$set(l),1&n&&s!==(s=e[0].headerComponent)){if(o){ae();const e=o;de(e.$$.fragment,1,0,(()=>{we(e,1)})),ce()}s?(o=D(s,{}),ve(o.$$.fragment),$e(o.$$.fragment,1),xe(o,r.parentNode,r)):o=null}const a={};16384&n&&(a.$$scope={dirty:n,ctx:e}),i.$set(a)},i(e){l||($e(t.$$.fragment,e),o&&$e(o.$$.fragment,e),$e(i.$$.fragment,e),l=!0)},o(e){de(t.$$.fragment,e),o&&de(o.$$.fragment,e),de(i.$$.fragment,e),l=!1},d(e){e&&(z(n),z(r)),we(t,e),o&&we(o,e),we(i,e)}}}function Pl(e,t){let n,o,r,i;var l=t[11].bodyComponent;function s(e,t){return{props:{zIndex:e[11].id===e[0].id?2:0}}}return l&&(o=D(l,s(t)),o.$on("setSettingsTabViewIndex",t[6])),{key:e,first:null,c(){n=A(),o&&ve(o.$$.fragment),r=A(),this.first=n},m(e,t){_(e,n,t),o&&xe(o,e,t),_(e,r,t),i=!0},p(e,n){if(l!==(l=(t=e)[11].bodyComponent)){if(o){ae();const e=o;de(e.$$.fragment,1,0,(()=>{we(e,1)})),ce()}l?(o=D(l,s(t)),o.$on("setSettingsTabViewIndex",t[6]),ve(o.$$.fragment),$e(o.$$.fragment,1),xe(o,r.parentNode,r)):o=null}else if(l){const e={};1&n&&(e.zIndex=t[11].id===t[0].id?2:0),o.$set(e)}},i(e){i||(o&&$e(o.$$.fragment,e),i=!0)},o(e){o&&de(o.$$.fragment,e),i=!1},d(e){e&&(z(n),z(r)),o&&we(o,e)}}}function Rl(e){let t,n,o,r,i,l=[],s=new Map;n=new St({props:{bgColor:"var(--bg-panel)",$$slots:{default:[El]},$$scope:{ctx:e}}});let a=fe(e[4]);const c=e=>e[11].id;for(let t=0;t<a.length;t+=1){let n=Sl(e,a,t),o=c(n);s.set(o,l[t]=Pl(o,n))}return{c(){t=I("div"),ve(n.$$.fragment),o=S(),r=I("settingsBody");for(let e=0;e<l.length;e+=1)l[e].c();E(r,"class","svelte-1f0aii0"),E(t,"class","svelte-1f0aii0")},m(s,a){_(s,t,a),xe(n,t,null),B(t,o),B(t,r);for(let e=0;e<l.length;e+=1)l[e]&&l[e].m(r,null);e[9](t),i=!0},p(e,[t]){const o={};16387&t&&(o.$$scope={dirty:t,ctx:e}),n.$set(o),81&t&&(a=fe(e[4]),ae(),l=ge(l,t,c,1,e,a,s,r,pe,Pl,null,Sl),ce())},i(e){if(!i){$e(n.$$.fragment,e);for(let e=0;e<a.length;e+=1)$e(l[e]);i=!0}},o(e){de(n.$$.fragment,e);for(let e=0;e<l.length;e+=1)de(l[e]);i=!1},d(o){o&&z(t),we(n);for(let e=0;e<l.length;e+=1)l[e].d();e[9](null)}}}function Dl(e,t,n){const o=q(),r=[{id:"general",text:"General",itemArgs:{padding:"14px 10px"},item:lo,bodyComponent:ur},{id:"themes",text:"Themes",itemArgs:{padding:"14px 10px"},item:lo,bodyComponent:Xr,headerComponent:ti},{id:"themeCreator",text:"Theme Creator",itemArgs:{padding:"14px 10px"},item:lo,bodyComponent:Hl,headerComponent:Ol}];let i,l=r[0],s=l.id;window.addEventListener("resize",(function(){i&&Re.set(i.getBoundingClientRect())}));return[l,s,i,o,r,function(e){n(0,l=e)},function(e){n(0,l=r[e.detail.index]),n(1,s=l.id)},function(e){s=e,n(1,s)},()=>o("closeSettings"),function(e){X[e?"unshift":"push"]((()=>{i=e,n(2,i)}))}]}class jl extends Ve{constructor(e){super(),He(this,e,Dl,Rl,d,{})}}function Nl(e){let t,n,o,r,i,l;return n=new jl({}),n.$on("closeSettings",e[1]),{c(){t=I("div"),ve(n.$$.fragment),E(t,"id","settings"),E(t,"style",o=e[0].join("; ")),E(t,"class","svelte-cgi3tm")},m(o,s){var a;_(o,t,s),xe(n,t,null),r=!0,i||(l=F(t,"mousedown",(a=e[1],function(e){e.target===this&&a.call(this,e)})),i=!0)},p(e,[n]){(!r||1&n&&o!==(o=e[0].join("; ")))&&E(t,"style",o)},i(e){r||($e(n.$$.fragment,e),r=!0)},o(e){de(n.$$.fragment,e),r=!1},d(e){e&&z(t),we(n),i=!1,l()}}}function Ul(t,n,o){let r;C(t,Ae,(e=>o(2,r=e))),e.ipcRenderer.on("loadCurrentTheme",((e,t)=>{ke.set(t)})),e.ipcRenderer.on("themesLoaded",((e,t)=>{Fe.set(t),De.set(!0)})),e.ipcRenderer.on("loadCreatorThemes",((e,t)=>{Ne.set(t)})),e.ipcRenderer.on("toggleThemeCreatorPreviewMask",(e=>{je.togglePreviewVisible()})),Ae.set(e.ipcRenderer.sendSync("getSettings")),e.ipcRenderer.send("frontReady");let i=[];return ke.subscribe((e=>{e&&o(0,i=Be(e))})),[i,function(t){Ae.trim(),e.ipcRenderer.send("closeSettingsView",r)}]}new class extends Ve{constructor(e){super(),He(this,e,Ul,Nl,d,{})}}({target:document.body});
"use strict";var e=require("electron"),t=require("url");function r(e){var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var o=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,o.get?o:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var o=r(e);process.env.FIGMA_LOGLEVEL,t.parse("https://www.figma.com");process.env.HOME,process.env.HOME;const a=["color","backgroundColor","fill","stroke","borderBottomColor","borderRightColor","borderLeftColor","borderTopColor","boxShadow"],l={name:"Default Theme",author:"Figma",id:"0",palette:{text:"#333333","text-active":"#050505","text-disabled":"#b3b3b3",borders:"#e2e2e2","bg-panel":"#ffffff","bg-panel-hover":"#daebf7","bg-toolbar":"#2c2c2c","bg-toolbar-hover":"#000000","bg-toolbar-active":"#18a0fb","fg-toolbar":"#ffffff","fg-toolbar-hover":"#ffffff","fg-toolbar-active":"#ffffff","fg-toolbar-disabled":"#b3b3b3","fg-toolbar-filename":"#ffffff","fg-toolbar-foldername":"#aaaaaa","fg-toolbar-chevron":"#ffffff","fg-toolbar-unsavedicon":"#a1a1a1","fg-toolbar-login-button":"#ffffff","fg-toolbar-login-button-border":"#d3d3d3","fg-toolbar-login-button-active":"#808080","bg-overlay":"#222222","fg-overlay":"#ffffff","bg-overlay-outline":"#292828","bg-overlay-inner-outline":"#000000","bg-tab":"#222222","bg-tab-hover":"#2c2c2c","bg-tab-active":"#2c2c2c","fg-tab":"#ffffff","fg-tab-hover":"#ffffff","fg-tab-active":"#ffffff","bg-header":"#222222","fg-header":"#ffffff","bg-header-control":"#222222","bg-header-control-hover":"#2c2c2c","bg-header-control-active":"#2c2c2c","fg-header-control":"#ffffff","fg-header-control-hover":"#ffffff","fg-header-control-active":"#ffffff","fg-component":"#7b61ff","fg-component-disabled":"#4e428a","fg-component-disabled-row-active":"#bfbafc","bg-window-close":"#e81123","bg-beta-label":"#1bc47d"}},s=[".action--unfaded",".action--enabled",".action_option",".avatar--root--2kH_E",".basic_form--greenBtn",".dropdown--dropdown",".dropdown_menu",".draggable_modal--backgroundOverlay--CPf6e",".emoji-mart-anchor-selected",".flyout_view--flyout",".folder_view--folderTeamName",".folder_view--pathSeparator",".filename_view--title",".filename_view--pathSeparator",".filename_view--dropdownOption",".fullscreen_menu--searchInput",".header_modal--modalBackground",".header--header--",".header--settings",".header--dropdownCaret",".prototype--background",".multilevel_dropdown--",".library_item_tile--descriptionPopout",".pointing_dropdown",".scaling_menu--",".transition_preview_pane--",".top_bar--",".tooltip--",".toolbar_styles--activeButton",".toolbar_styles--enabledButton",".user_view--name",".text--_whiteText",".team_link--icon",".zoom_menu--zoomMenu",".help_widget--helpWidget",".help_widget--tooltip",".raw_components--iconButtonSelected",".visual_bell",".zoom_menu"];process.env.NODE_ENV;const b={"rgb(255, 255, 255)":"var(--bg-panel)","rgb(252, 252, 252)":"var(--bg-panel)","rgb(248, 248, 248)":"var(--bg-panel-hover)","rgb(240, 240, 240)":"var(--bg-panel-hover)","rgb(241, 249, 255)":"var(--bg-panel-hover)","rgb(237, 245, 250)":"var(--bg-panel-hover)","rgb(229, 229, 229)":"var(--borders)","rgb(229, 229, 229) 1px 0px 0px 0px":"var(--borders) 1px 0px 0px 0px","rgb(229, 229, 229) 0px 1px 0px 0px":"var(--borders) 0px 1px 0px 0px","rgb(229, 229, 229) 0px 0px 0px 1px":"var(--borders) 0px 0px 0px 1px","rgb(239, 239, 239)":"var(--borders)","rgb(217, 217, 217)":"var(--borders)","rgb(212, 212, 212)":"var(--borders)","rgb(218, 235, 247)":"var(--bg-panel-hover)","rgb(191, 186, 252)":"var(--fg-component-disabled-row-active)","rgb(180, 180, 250)":"var(--fg-component-disabled-row-active)","rgb(179, 179, 179)":"var(--text-disabled)","rgb(166, 172, 175)":"var(--text-disabled)","rgb(123, 97, 255)":"var(--fg-component)","rgb(68, 68, 68)":"var(--text)","rgb(51, 51, 51)":"var(--text)","rgb(44, 44, 44)":"var(--bg-toolbar)","rgb(5, 5, 5)":"var(--text-active)","rgb(0, 0, 0)":"var(--text-active)","rgba(0, 0, 0, 0.06)":"var(--borders)","rgba(0, 0, 0, 0.1)":"var(--borders)","rgba(0, 0, 0, 0.15)":"var(--text)","rgba(0, 0, 0, 0.2)":"var(--text)","rgba(0, 0, 0, 0.3)":"var(--text-disabled)","rgba(0, 0, 0, 0.4)":"var(--text)","rgba(0, 0, 0, 0.6)":"var(--text)","rgba(0, 0, 0, 0.5)":"var(--text)","rgba(0, 0, 0, 0.75)":"var(--text)","rgba(0, 0, 0, 0.8)":"var(--textActive)","rgba(0, 0, 0, 0.9)":"var(--text)","rgba(0, 0, 0, 0.95)":"var(--text)","rgba(44, 44, 44, 0.8)":"var(--bg-toolbar)","rgba(51, 51, 51, 0.3)":"var(--text-disabled)","rgba(123, 97, 255, 0.4)":"var(--fg-component-disabled)","rgba(255, 255, 255, 0)":"var(--bg-panel)","rgba(255, 255, 255, 0.2)":"var(--bg-panel)","rgba(255, 255, 255, 0.4)":"var(--bg-panel)","rgba(255, 255, 255, 0.05)":"var(--bg-panel)","rgba(255, 255, 255, 0.5)":"var(--bg-panel)","rgba(255, 255, 255, 0.8)":"var(--text)","rgba(255, 255, 255, 0.95)":"var(--bg-panel)","rgb(24, 160, 251)":"var(--bg-toolbar-active)","rgb(24, 160, 251) 0px 0px 0px 1px inset":"var(--bg-toolbar-active) 0px 0px 0px 1px inset","rgb(230, 230, 230) 0px 0px 0px 1px inset":"var(--text) 0px 0px 0px 1px inset","rgb(230, 230, 230)":"var(--borders)","rgb(230, 230, 230) 0px -1px":"var(--borders) 0px -1px","rgb(27, 196, 125)":"var(--bg-beta-label)"};const n=new class{currentTheme;targetElements=new Set;constructor(){this.currentTheme=structuredClone(l),o.ipcRenderer.invoke("themesIsDisabled").then((e=>{e||this.registerEvents()}))}registerEvents(){o.ipcRenderer.on("loadCurrentTheme",((e,t)=>{this.changePalette(t)}))}registerEventsForPreview(){o.ipcRenderer.on("getThemeCreatorPalette",((e,t)=>{this.applyPalette(t)}))}changePalette(e){this.currentTheme=e,this.setThemeVariables()}getCoreStylesheet(){const e=document.styleSheets;let t;return Object.keys(e).forEach((r=>{const o=e[r].href;o&&o.includes("figma_app")&&(t=e[r].cssRules)})),t}isRuleIgnored(e){let t=!1;return s.forEach((r=>{e.includes(r)&&(t=!0)})),t}setThemeVariables(){for(const e of this.targetElements)this.applyPalette(this.currentTheme.palette,e)}applyPalette(e,t=document.body){const r=Object.keys(e);for(const o of r){const r=e[o];t.style.setProperty(`--${o}`,r),"bg-header-control"===o&&(t.style.setProperty("--color-bg-toolbar-secondary",r),t.style.setProperty("--color-bg-toolbar-tertiary",r)),"bg-toolbar-active"===o&&(t.style.setProperty("--bg-primary-btn",r),t.style.setProperty("--color-bg-brand",r),t.style.setProperty("--color-border-toolbar-selected",r),t.style.setProperty("--color-bg-toolbar-selected",r),t.style.setProperty("--color-border-selected",r),t.style.setProperty("--color-bg-menu-selected",r),t.style.setProperty("--color-bg-menu-selected-hover",r),t.style.setProperty("--color-bg-menu-selected-pressed",r)),"fg-overlay"===o&&t.style.setProperty("--color-icon-menu",r),"bg-toolbar-hover"===o&&t.style.setProperty("--color-bg-toolbar-hover",r),"fg-tab-hover"===o&&t.style.setProperty("--color-text-toolbar-hover",r),"fg-overlay"===o&&(t.style.setProperty("--fg-overlay",r),t.style.setProperty("--fg-overlay-right",r)),"fg-toolbar"===o&&(t.style.setProperty("--color-icon-toolbar",r),t.style.setProperty("--color-text-toolbar-secondary",r)),"fg-toolbar-hover"===o&&t.style.setProperty("--color-icon-toolbar-hover",r),"fg-toolbar-active"===o&&(t.style.setProperty("--fg-overlay-active",r),t.style.setProperty("--color-text-menu-hover",r),t.style.setProperty("--color-icon-toolbar-onselected",r),t.style.setProperty("--color-text-onbrand",r),t.style.setProperty("--color-icon-toolbar-tertiary",r),t.style.setProperty("--color-icon-toolbar-hover",r)),"text-disabled"===o&&(t.style.setProperty("--fg-overlay-secondary",r),t.style.setProperty("--fg-toolbar-placeholder",r),t.style.setProperty("--color-icon-disabled",r)),"borders"===o&&(t.style.setProperty("--fg-overlay-sep",r),t.style.setProperty("--color-border-toolbar",r)),"text"===o&&(t.style.setProperty("--color-icon",r),t.style.setProperty("--color-icon-brand",r),t.style.setProperty("--color-icon-secondary",r),t.style.setProperty("--color-icon-tertiary",r)),"text-active"===o&&(t.style.setProperty("--color-icon-hover",r),t.style.setProperty("--color-text-secondary-hover",r),t.style.setProperty("--color-text-hover",r),t.style.setProperty("--color-icon-onselected",r)),"bg-panel-hover"===o&&(t.style.setProperty("--color-bg-pressed",r),t.style.setProperty("--color-bg-tertiary",r)),"fg-component"===o&&(t.style.setProperty("--color-icon-component",r),t.style.setProperty("--color-text-component",r)),"fg-component-disabled"===o&&(t.style.setProperty("--color-icon-component-secondary",r),t.style.setProperty("--color-text-component-secondary",r),t.style.setProperty("--color-icon-component-tertiary",r),t.style.setProperty("--color-text-component-tertiary",r)),"bg-beta-label"===o&&t.style.setProperty("--color-bg-info",r)}t.style.setProperty("background-color","var(--bg-panel)"),t.style.setProperty("--color-bg","var(--bg-panel)"),t.style.setProperty("--color-bg-toolbar","var(--bg-toolbar)"),t.style.setProperty("--color-bg-selected","var(--bg-panel)"),t.style.setProperty("--color-text","var(--text)"),t.style.setProperty("--color-text-secondary","var(--text)"),t.style.setProperty("--color-border","var(--borders)"),t.style.setProperty("--color-border-menu","var(--borders)"),t.style.setProperty("--color-conditionalborder","var(--borders)"),t.style.setProperty("--color-border-tooltip","var(--borders)"),t.style.setProperty("--color-text-disabled","var(--text-disabled)"),t.style.setProperty("--color-bg-selected-secondary","var(--bg-panel)"),t.style.setProperty("--color-bg-selected","var(--bg-panel-hover)"),t.style.setProperty("--color-text-toolbar","var(--text)"),t.style.setProperty("--color-bg-hover","var(--bg-panel-hover)"),t.style.setProperty("--color-bg-secondary","var(--bg-panel-hover)"),t.style.setProperty("--color-bg-tooltip","var(--bg-overlay)"),t.style.setProperty("--ui2-button-color-bg-disabled","var(--borders)")}init(){this.targetElements.add(document.body);const e=this.getCoreStylesheet();if(location.href.match("chrome://gpu")){const e=document.createElement("style");e.innerText="html { background-color: cadetblue; }",document.head.appendChild(e)}if(!e)return;const t=((e,t)=>{const r={"rgb(255, 255, 255)":e["bg-panel"],"rgb(252, 252, 252)":e["bg-panel"],"rgb(248, 248, 248)":e["bg-panel-hover"],"rgb(240, 240, 240)":e["bg-panel-hover"],"rgb(241, 249, 255)":e["bg-panel-hover"],"rgb(237, 245, 250)":e["bg-panel-hover"],"rgb(229, 229, 229)":e.borders,"rgb(229, 229, 229) 1px 0px 0px 0px":`${e.borders} 1px 0px 0px 0px`,"rgb(229, 229, 229) 0px 1px 0px 0px":`${e.borders} 0px 1px 0px 0px`,"rgb(229, 229, 229) 0px 0px 0px 1px":`${e.borders} 0px 0px 0px 1px`,"rgb(239, 239, 239)":e.borders,"rgb(217, 217, 217)":e.borders,"rgb(212, 212, 212)":e.borders,"rgb(218, 235, 247)":e["bg-toolbar-hover"],"rgb(191, 186, 252)":e["fg-component-disabled-row-active"],"rgb(180, 180, 250)":e["fg-component-disabled-row-active"],"rgb(179, 179, 179)":e["text-disabled"],"rgb(166, 172, 175)":e["text-disabled"],"rgb(123, 97, 255)":e["fg-component"],"rgb(68, 68, 68)":e.text,"rgb(51, 51, 51)":e.text,"rgb(44, 44, 44)":e["bg-toolbar"],"rgb(5, 5, 5)":e["text-active"],"rgb(0, 0, 0)":e["text-active"],"rgba(0, 0, 0, 0.06)":e.borders,"rgba(0, 0, 0, 0.1)":e.borders,"rgba(0, 0, 0, 0.15)":e.text,"rgba(0, 0, 0, 0.2)":e.text,"rgba(0, 0, 0, 0.3)":e["text-disabled"],"rgba(0, 0, 0, 0.4)":e.text,"rgba(0, 0, 0, 0.6)":e.text,"rgba(0, 0, 0, 0.5)":e.text,"rgba(0, 0, 0, 0.75)":e.text,"rgba(0, 0, 0, 0.8)":e["text-active"],"rgba(0, 0, 0, 0.9)":e.text,"rgba(0, 0, 0, 0.95)":e.text,"rgba(44, 44, 44, 0.8)":e["bg-toolbar"],"rgba(51, 51, 51, 0.3)":e["text-disabled"],"rgba(123, 97, 255, 0.4)":e["fg-component-disabled"],"rgba(255, 255, 255, 0)":e["bg-panel"],"rgba(255, 255, 255, 0.2)":e["bg-panel"],"rgba(255, 255, 255, 0.4)":e["bg-panel"],"rgba(255, 255, 255, 0.05)":e["bg-panel"],"rgba(255, 255, 255, 0.5)":e["bg-panel"],"rgba(255, 255, 255, 0.8)":e.text,"rgba(255, 255, 255, 0.95)":e["bg-panel"],"rgb(24, 160, 251)":e["bg-toolbar-active"],"rgb(24, 160, 251) 0px 0px 0px 1px inset":`${e["bg-toolbar-active"]} 0px 0px 0px 1px inset`,"rgb(230, 230, 230) 0px 0px 0px 1px inset":`${e["bg-toolbar-active"]} 0px 0px 0px 1px inset`,"rgb(230, 230, 230)":`${e.borders}`,"rgb(230, 230, 230) 0px -1px":`${e.borders}  0px -1px`,"rgb(27, 196, 125)":`${e["bg-beta-label"]}`};if(t){const e={},o=Object.keys(t);for(const a of o)e[t[a]]=r[a];return e}return r})(this.currentTheme.palette),r=["#react-page { background-color: var(--bg-panel); }",'span[class*="action_option--shortcut"] { color: var(--fg-overlay); }','div[class*="file_browser_page_view"] { background-color: var(--bg-panel) !important; }','input[class*="sidebar_search--searchInput"]::placeholder { color: var(--text-active); }'];this.setThemeVariables();for(const o of e)null!=o.selectorText&&!1===this.isRuleIgnored(o.selectorText)&&((null!=o.style&&""!=o.style.color||""!=o.style.backgroundColor||""!=o.style.fill||""!=o.style.stroke||""!=o.style.boxShadow||""!=o.style.borderBottomColor||""!=o.style.borderRightColor||""!=o.style.borderTopColor||""!=o.style.borderLeftColor)&&a.forEach((e=>{const r=o.style[e];""!=r&&Object.prototype.hasOwnProperty.call(t,r)&&(o.style[e]=`${b[r]}`)})),/option_button--toggled|segmented_control--segmentSelected/.test(o.selectorText)&&(o.style["background-color"]="var(--bg-panel-hover)"),/searchIcon/.test(o.selectorText)&&(o.style.fill="var(--fg-toolbar)"),/base_upgrade_section--content/.test(o.selectorText)&&(o.style["background-color"]="var(--borders)"),/tool_bar--toolBarRightSide|pages_panel--pageRowSelected/.test(o.selectorText)&&(o.style.fill="var(--text-active)",o.style["background-color"]="var(--bg-panel-hover)"),/community_hub_link--communityArrow|new_file_creation_topbar--plusIcon|timer_view--plusIcon|delightful_toolbar--verticalButton/.test(o.selectorText)&&(o.style.fill="var(--text-active)"),/new_file_creation_topbar--importIcon|close_button--closeX|new_file_creation_topbar--plusIcon|new_file_creation_topbar--importIcon|option_button--_optionButton|raw_components--_iconButton|object_row--layerIcon|segmented_control--icon/.test(o.selectorText)&&(o.style.color="var(--text-active)",o.style.fill="var(--text-active)"),/search--searchInput__OLD|type_panel--fontPickerTextStyle|public-DraftEditorPlaceholder-root|css_builder_color--colorTextSecondary/.test(o.selectorText)&&(o.style.color="var(--text)"),/optionDisabled|formatted_expanding_textarea--placeholder|expanding_textarea--expandingTextarea--*::placeholder/.test(o.selectorText)&&r.push(`${o.selectorText} { color: var(--text-disabled); }`),/filename_view--pageTitle/.test(o.selectorText)&&(o.style.color="var(--fg-header)"),/starter_kit_ui--option/.test(o.selectorText)&&(o.style.color="black"),/.navbar--workspaceSubtitle/.test(o.selectorText)&&r.push(`${o.selectorText} { color: var(--fg-header); }`),/upgrade_section--icon/.test(o.selectorText)&&r.push('span[class*="upgrade_section--icon"] > svg > path { fill: var(--text); }'),/user_view--devTokenNew|community_hub_banner--bannerIcon|full_width_page--closeMenu/.test(o.selectorText)&&r.push(`${o.selectorText} svg path { fill: var(--text) !important; }`),/basic_form--textInput/.test(o.selectorText)&&(o.style.backgroundColor="var(--bg-panel)"),/step_breadcrumb--stepTitle|account_switcher--dropdownButtonContent|time_display--timeDisplay|.ai_modal--input.+placeholder|colorTextTertiary|css_builder_backgroundColor--colorBgPressed/.test(o.selectorText)&&(o.style.color="var(--text-active)"),/toolbar_view--shareButton|basic_form--primaryBtn/.test(o.selectorText)&&(o.style.color="var(--fg-toolbar-active)"),/time_display--timeInput/.test(o.selectorText)&&r.push(`input${o.selectorText} { color: var(--text-disabled) }`),/.data-preferred-theme=.{3,20}\s?navbar--navbarContainer/.test(o.selectorText)&&(this.targetElements.add(o),this.applyPalette(this.currentTheme.palette,o)),/dlt_submenu--chevronButtonIcon|dlt_hoverable_icon--chevron|delightful_toolbar--connectorIcon/.test(o.selectorText)&&r.push(`${o.selectorText} > svg > path { fill: var(--text-active); }`),/file_browser_layout--fileBrowserPageViewContainer|browse_templates_modal/.test(o.selectorText)&&(r.push(`${o.selectorText}::-webkit-scrollbar { width: 8px; height: 8px; background: transparent; }`),r.push(`${o.selectorText}::-webkit-scrollbar-corner { display: none; }`),r.push(`${o.selectorText}::-webkit-scrollbar-thumb { background: var(--color-scrollbar, rgba(179, 179, 179, 0.5)); border-radius: 10px; }`)),r.push("button[class*=css_builder--colorBgPressed] { color: var(--fg-toolbar-active); }"),r.push("input { color: var(--text-active); }"));if(r.length){const e=document.createElement("style");e.innerText=r.join("\n"),document.head.appendChild(e)}}};(async()=>{document.addEventListener("DOMContentLoaded",(()=>{e.ipcRenderer.invoke("themesIsDisabled").then((e=>{e||setTimeout((()=>{n.init(),n.registerEventsForPreview()}),10)}))})),e.ipcRenderer.on("changeZoomFactor",((e,t)=>{document.body.style.zoom=t})),document.addEventListener("keydown",(function(t){"AltLeft"===t.code&&e.ipcRenderer.send("toggleThemeCreatorPreviewMask")}))})();
"use strict";var e=require("electron"),t=require("url"),s=require("fs"),i=require("path"),n=require("crypto"),a=require("fs/promises"),o=require("node:child_process"),r=require("child_process"),l=require("chokidar"),d=require("util"),h=require("adm-zip");function c(e){var t=Object.create(null);return e&&Object.keys(e).forEach((function(s){if("default"!==s){var i=Object.getOwnPropertyDescriptor(e,s);Object.defineProperty(t,s,i.get?i:{enumerable:!0,get:function(){return e[s]}})}})),t.default=e,Object.freeze(t)}var u=c(t),w=c(s),p=c(i),b=c(r),g=c(l);const m={width:1200,height:900,frame:!1,resizable:!0,webPreferences:{sandbox:!1,zoomFactor:1,nodeIntegration:!0,nodeIntegrationInWorker:!1,webviewTag:!1,webSecurity:!1,webgl:!0,experimentalFeatures:!0,contextIsolation:!1}},f={x:-1,y:-1,width:1200,height:900,isMaximized:!1,lastActiveTabPath:"",hasOpenedCommunityTab:!1,userId:"",tabs:[]},T=process.env.FIGMA_LOGLEVEL,C="https://www.figma.com",y=`${C}/logout`,v=`${C}/login`,M=`${C}/files/recent`,F=`${C}/desktop_new_tab`;t.parse("https://www.figma.com");const I="/tmp/master.zip",S="figma",x="test-creator-theme",E="manifest.json",O="chrome://gpu";process.env.HOME,process.env.HOME;const B=[".gitignore"],U=[".css",".html",".js",".json",".jsx",".md",".ts",".tsx"],D="New file",P={HELP_PAGE:"https://help.figma.com",PLUGINS_DOCS:`${C}/plugin-docs/intro`,FIGMA_COMMUNITY_FORUM:"https://spectrum.chat/figma",FIGMA_LINUX_COMMUNITY_FORUM:"https://spectrum.chat/figma-linux",FIGMA_LINUX_TELEGRAM:"https://t.me/figma_linux",VIDEO_TUTORIALS:"https://www.youtube.com/figmadesign",RELEASE_NOTES:"https://github.com/Figma-Linux/figma-linux/releases/latest",LEGAL_SUMMARY:`${C}/summary-of-policy`,THEMES_REPO:"https://github.com/Figma-Linux/figma-linux-themes"},A=/^#[a-fA-F0-9]{6,6}$/,W=["text","textActive","textDisabled","borders","bgPanel","bgPanelHover","bgToolbar","bgToolbarHover","bgToolbarActive","fgToolbar","fgToolbarHover","fgToolbarActive","fgToolbarDisabled","fgToolbarFilename","fgToolbarFoldername","fgToolbarChevron","fgToolbarUnsavedicon","fgToolbarLoginButton","fgToolbarLoginButtonBorder","fgToolbarLoginButtonActive","bgOverlay","fgOverlay","bgOverlayOutline","bgOverlayInnerOutline","bgTab","bgTabHover","bgTabActive","fgTab","fgTabHover","fgTabActive","bgHeader","fgHeader","bgHeaderControl","bgHeaderControlHover","bgHeaderControlActive","fgHeaderControl","fgHeaderControlHover","fgHeaderControlActive","fgComponent","fgComponentDisabled","fgComponentDisabledRowActive","bgWindowClose","bgBetaLabel"],k={name:"Default Theme",author:"Figma",id:"0",palette:{text:"#333333","text-active":"#050505","text-disabled":"#b3b3b3",borders:"#e2e2e2","bg-panel":"#ffffff","bg-panel-hover":"#daebf7","bg-toolbar":"#2c2c2c","bg-toolbar-hover":"#000000","bg-toolbar-active":"#18a0fb","fg-toolbar":"#ffffff","fg-toolbar-hover":"#ffffff","fg-toolbar-active":"#ffffff","fg-toolbar-disabled":"#b3b3b3","fg-toolbar-filename":"#ffffff","fg-toolbar-foldername":"#aaaaaa","fg-toolbar-chevron":"#ffffff","fg-toolbar-unsavedicon":"#a1a1a1","fg-toolbar-login-button":"#ffffff","fg-toolbar-login-button-border":"#d3d3d3","fg-toolbar-login-button-active":"#808080","bg-overlay":"#222222","fg-overlay":"#ffffff","bg-overlay-outline":"#292828","bg-overlay-inner-outline":"#000000","bg-tab":"#222222","bg-tab-hover":"#2c2c2c","bg-tab-active":"#2c2c2c","fg-tab":"#ffffff","fg-tab-hover":"#ffffff","fg-tab-active":"#ffffff","bg-header":"#222222","fg-header":"#ffffff","bg-header-control":"#222222","bg-header-control-hover":"#2c2c2c","bg-header-control-active":"#2c2c2c","fg-header-control":"#ffffff","fg-header-control-hover":"#ffffff","fg-header-control-active":"#ffffff","fg-component":"#7b61ff","fg-component-disabled":"#4e428a","fg-component-disabled-row-active":"#bfbafc","bg-window-close":"#e81123","bg-beta-label":"#1bc47d"}};async function L(e){try{return await w.promises.access(e),!0}catch(e){return!1}}async function N(e){return w.promises.mkdir(e,{recursive:!0})}const $=`http://localhost:${process.env.DEV_PANEL_PORT??3330}`,R=`http://localhost:${process.env.DEV_SETTINGS_PORT??3331}`,V=`file://${i.resolve(__dirname,"../index.html")}`,_=`file://${i.resolve(__dirname,"../settings.html")}`,H=`${i.resolve(process.cwd(),"dist/renderer","loadMainContent.js")}`,j=`${i.resolve(__dirname,"..","renderer","loadMainContent.js")}`,z=`${i.resolve(process.cwd(),"dist/renderer","loadContent.js")}`,q=`${i.resolve(__dirname,"..","renderer","loadContent.js")}`,G=e=>{e&&!e.isDevToolsOpened()?e.openDevTools({mode:"detach"}):e.closeDevTools()},J={clientId:n.randomUUID(),userId:"",authedUserIDs:[],app:{logLevel:1,lastTimeClearLogFile:0,enableColorSpaceSrgb:!1,visibleNewProjectBtn:!0,useZenity:!1,disableThemes:!1,panelHeight:40,saveLastOpenedTabs:!0,exportDir:`${process.env.HOME}/Pictures/Figma`,commandSwitches:[{switch:"enable-gpu-rasterization"},{switch:"enable-experimental-canvas-features"},{switch:"use-vulkan"}],fontDirs:["/usr/share/fonts","/usr/local/share/fonts","/run/host/fonts","/run/host/user-fonts",`${process.env.HOME}/.local/share/fonts`],recentlyClosedTabs:[],windowsState:{},lastOpenedTabs:{},featureFlags:{},savedExtensions:[],themeDropdownOpen:!0,creatorsThemesDropdownOpen:!1,useOldPreviewer:!1,dontShowTutorialCreator:!1},theme:{currentTheme:"0"},ui:{scalePanel:1,scaleFigmaUI:1}},K=e=>/figma\.com\/proto\/.+\/.+?node-id=.+/.test(e),Z=e=>{try{return new URL(e)}catch(e){}},Y=e=>{if(!(e=>new RegExp(`^${S}://.+`).test(e))(e))return e;const t=new RegExp(`^${S}:/`);return e.replace(t,C)},X=e=>/\/app_auth\/redeem\?g_secret=.+/.test(e),Q=e=>/^(figma:\/\/|https?:\/\/w{0,3}?\.?figma\.com\/files\/recent)/.test(e),ee=e=>/^(figma:\/\/|https?:\/\/w{0,3}?\.?figma\.com\/file\/)/.test(e),te=e=>/^https:\/\/w{0,3}?.figma.com\/plugin-docs/.test(e),se=e=>/^https:\/\/w{0,3}?.figma.com\/board/.test(e),ie=e=>/^https:\/\/w{0,3}?.figma.com\/design/.test(e),ne="dev"===process.env.NODE_ENV;function ae(e){const t=Object.keys(e),s={};for(const i of t){const t=e[i];s[i.replace(/-([a-z])/g,(e=>e.replace("-","").toUpperCase()))]=t}return s}function oe(e){const t=Object.keys(e),s={};for(const i of t){const t=e[i];s[i.replace(/([A-Z])/gm,"-$1").toLowerCase()]=t}return s}const re=/^(.+\.(html|js|ts)|manifest.json)$/,le=/^(.+\.(js|ts))$/,de=/^(.+\.html)$/,{version:he}=require("./../package.json");const ce=new class{filePath;settings;constructor(){this.filePath=p.join(e.app.getPath("userData"),"settings.json"),this.load(),this.registerEvents()}load=()=>{const e=function(e){try{return w.accessSync(e),!0}catch(e){return!1}}(this.filePath);if(!e){const e={...J,...this.settings};return this.settings=e,void this.writeSync(e)}this.settings=this.readSync(),this.settings={...J,...this.settings,app:{...J.app,...this.settings.app}},this.writeSync(this.settings)};readSync=()=>{const e=w.readFileSync(this.filePath).toString();let t;try{t=JSON.parse(e)}catch(e){we.error("Parse settings.json file error: ",e),we.warn("Apply default settings instead file settings."),t=J}return t};writeSync=e=>{w.writeFileSync(this.filePath,JSON.stringify(e,null,2))};save(){this.writeSync(this.settings)}setFeatureFlags(e,t){this.settings.app.featureFlags={...this.settings.app.featureFlags,...t.featureFlags}}getSettings(e){e.returnValue=this.settings}registerEvents(){e.ipcMain.on("setFeatureFlags",this.setFeatureFlags.bind(this)),e.ipcMain.on("getSettings",this.getSettings.bind(this))}};class ue{levels=["DEBUG","INFO","WARN","ERROR"];logLevel=1;constructor(){this.logLevel=T?this.levels.indexOf(T):ce.settings.app.logLevel}getDateTime=()=>(new Date).toLocaleString();log=e=>{const t=this.getDateTime();console.log(`[${t}]:[WARN] - Implement the 'log' method in child class.`)};format=(e,...t)=>{if(e<this.logLevel)return;return`[${this.getDateTime()}]:[${this.levels[e]}] - `+t.map((e=>e instanceof Error?JSON.stringify({name:e.name,message:e.message,cause:e.cause,stack:e.stack}):e))};debug=(...e)=>{this.log(this.format(0,...e))};info=(...e)=>{this.log(this.format(1,...e))};warn=(...e)=>{this.log(this.format(2,...e))};error=(...e)=>{this.log(this.format(3,...e))}}const we=new class extends ue{sources;constructor(e){super(),this.sources=e,this.initLoggerEvent()}initLoggerEvent=()=>{e.ipcMain.on("logDebug",((e,...t)=>this.debug(`[From web content: ${e.sender.id}]`,...t))),e.ipcMain.on("logInfo",((e,...t)=>this.info(`[From web content: ${e.sender.id}]`,...t))),e.ipcMain.on("logWarn",((e,...t)=>this.warn(`[From web content: ${e.sender.id}]`,...t))),e.ipcMain.on("logError",((e,...t)=>this.error(`[From web content: ${e.sender.id}]`,...t)))};log=e=>{for(const t of this.sources)t.log(e)}}([new class extends ue{logFilePath;constructor(){super(),this.logFilePath=i.join(e.app.getPath("userData"),"logfile.log"),this.truncFile()}truncFile(){const e=(new Date).getTime();0===ce.settings.app.lastTimeClearLogFile&&(ce.settings.app.lastTimeClearLogFile=e,ce.save());ce.settings.app.lastTimeClearLogFile+864e5<=e&&(a.writeFile(this.logFilePath,"",{flag:"w"}).catch((e=>{this.error(`Cannot write log to file: ${this.logFilePath}, error: `,e)})),ce.settings.app.lastTimeClearLogFile=e,ce.save())}log=e=>{a.writeFile(this.logFilePath,`${e}\n`,{flag:"a"}).catch((e=>{this.error(`Cannot write log to file: ${this.logFilePath}, error: `,e)}))}},new class extends ue{constructor(){super()}log=e=>{console.log(e)}}]);class pe{buffer;offset;tableCount=0;tableMap=new Map;constructor(e,t=0){this.buffer=e,this.offset=t,this.readHead(),this.readTablesInfo()}readTablesInfo(){for(let e=0;e<this.tableCount;++e){const t=this.offset+12+16*e,s=this.buffer.subarray(t,t+4).toString();this.tableMap.set(s,{checksum:this.buffer.readUInt32BE(t+4),contents:this.buffer.readUInt32BE(t+8),length:this.buffer.readUInt32BE(t+24)})}}readHead(){const e=this.offset,t=this.buffer.readUInt16BE(e),s=this.buffer.readUInt16BE(e+2);if(1!=t||0!=s){const t=String.fromCharCode(this.buffer[e])+String.fromCharCode(this.buffer[e+1])+String.fromCharCode(this.buffer[e+2])+String.fromCharCode(this.buffer[e+3]);if(!["OTTO","true","ttcf"].includes(t))throw new Error("Is not a TrueType font")}this.tableCount=this.buffer.readUInt16BE(e+4)}getNameTable(){const e=this.tableMap.get("name").contents,t=this.buffer.readUInt16BE(e),s=this.buffer.readUInt16BE(e+2),i=this.buffer.readUInt16BE(e+4);if(0!=t&&1!=t)throw new Error('Invalid the "name" table');const n=i+e,a={};for(let t=0;t<s;t++){const s=e+6+12*t;this.buffer.readUInt16BE(s);const i=this.buffer.readUInt16BE(s+6),o=this.buffer.readUInt16BE(s+8),r=this.buffer.readUInt16BE(s+10),l=["copyright","fontFamily","fontSubFamily","fontIdentifier","fontName","fontVersion","postscriptName","trademark","manufacturer","designer","description","vendorURL","designerURL","license","licenseURL","reserved","preferredFamily","preferredSubFamily","compatibleFullName","sampleText","postScriptCIDfindfontName","WWSFamilyName","WWSSubFamilyName"],d=l[i]?l[i]:"";if(!a[d]){a[d]="";for(let e=0;e<o;e++){const t=this.buffer[n+r+e];0!==t&&(a[d]+=String.fromCharCode(t))}}}return a}getPostTable(){const e=this.tableMap.get("post").contents;return{format:this.fixed16dot16(this.buffer.readUInt32BE(e+0)),italicAngle:this.fixed16dot16(this.buffer.readUInt32BE(e+4)),underlinePosition:this.buffer.readInt16BE(e+12),underlineThickness:this.buffer.readInt16BE(e+14),isFixedPitch:this.buffer.readUInt32BE(e+16),minMemType42:this.buffer.readUInt32BE(e+7),maxMemType42:this.buffer.readUInt32BE(e+9),minMemType1:this.buffer.readUInt32BE(e+11),maxMemType1:this.buffer.readUInt32BE(e+13)}}getOS2Table(){const e=this.tableMap.get("OS/2")?.contents;return{version:e?this.buffer.readUInt16BE(e+0):0,weightClass:e?this.buffer.readUInt16BE(e+4):0}}getData(){const e=this.getNameTable(),t=this.getOS2Table();return{postscript:e.postscriptName,family:e.fontFamily,id:e.fontFamily,style:e.fontSubFamily??e.fontFamily,weight:t.weightClass,stretch:5,italic:"Italic"===e.fontSubFamily}}fixed16dot16(e){return 2147483648&e&&(e=-(1+~e)),e/65536}}class be{buffer;offset;fontCount=0;constructor(e,t=0){this.buffer=e,this.offset=t,this.readHead()}readHead(){if("ttcf"!==String.fromCharCode(this.buffer[0])+String.fromCharCode(this.buffer[1])+String.fromCharCode(this.buffer[2])+String.fromCharCode(this.buffer[3]))throw new Error("Is not a TrueType font collection");const e=this.offset,t=this.buffer.readUInt16BE(e+4),s=this.buffer.readUInt16BE(e+6);1!==t&&2!==t||0!==s||(this.fontCount=this.buffer.readUInt32BE(e+8))}getData(){const e=[];for(let t=0;t<this.fontCount;t++){const s=this.buffer.readUInt32BE(12+4*t),i=new pe(this.buffer,s);e.push(i.getData())}return e}}class ge{constructor(){}showMessageBox=async t=>{const s={type:t.type,title:t.title,message:t.message,detail:t.detail,defaultId:0};if("question"===t.type){const e=["Ok","Cancel"];t.textCancelButton&&(e[1]=t.textCancelButton),t.textOkButton&&(e[0]=t.textOkButton),s.buttons=e}else if(t.textOkButton){const e=["Ok"];e[0]=t.textOkButton,s.buttons=e}return(await e.dialog.showMessageBox(null,s)).response};showMessageBoxSync=t=>{const s={type:t.type,title:t.title,message:t.message,detail:t.detail,defaultId:0};if("question"===t.type){const e=["Ok","Cancel"];t.textCancelButton&&(e[1]=t.textCancelButton),t.textOkButton&&(e[0]=t.textOkButton),s.buttons=e}else if(t.textOkButton){const e=["Ok"];e[0]=t.textOkButton,s.buttons=e}return e.dialog.showMessageBoxSync(null,s)};showOpenDialog=async t=>{const s=await e.dialog.showOpenDialog(null,t);return s.canceled?null:s.filePaths};showOpenDialogSync=t=>e.dialog.showOpenDialogSync(null,t)||[];showSaveDialog=async t=>{const s=await e.dialog.showSaveDialog(null,t);return!s.canceled&&s.filePath?s.filePath:null};showSaveDialogSync=t=>e.dialog.showSaveDialogSync(null,t)}const me=new class{constructor(){}exec=async e=>{const t=d.promisify(r.exec),s=await t(e);if(""!==s.stderr)throw we.error(`Exec command: "${e}" fails with error: `,s.stderr),new Error(`Exec command: "${e}" fails with error: ${s.stderr}`);return s.stdout};execSync=e=>r.execSync(e).toString()};class fe{constructor(){}showMessageBox=async e=>{const t=[`zenity --${e.type} --ellipsize`];e.title&&t.push(`--title="${e.title}"`),e.detail&&t.push(`--text="${e.message}\n${e.detail}"`),e.textOkButton&&t.push(`--ok-label="${e.textOkButton}"`),"question"===e.type&&(e.textCancelButton&&t.push(`--cancel-label="${e.textCancelButton}"`),"Cancel"===e.defaultFocusedButton&&t.push("--default-cancel"));try{return await me.exec(t.join(" ")),0}catch(e){return 1}};showMessageBoxSync=e=>{const t=[`zenity --${e.type} --ellipsize`];e.title&&t.push(`--title="${e.title}"`),e.detail&&t.push(`--text="${e.message}\n${e.detail}"`),e.textOkButton&&t.push(`--ok-label="${e.textOkButton}"`),"question"===e.type&&(e.textCancelButton&&t.push(`--cancel-label="${e.textCancelButton}"`),"Cancel"===e.defaultFocusedButton&&t.push("--default-cancel"));try{return me.execSync(t.join(" ")),0}catch(e){return 1}};showOpenDialog=async e=>{const t=["zenity --file-selection"];if(e.defaultPath&&t.push(`--filename="${e.defaultPath}"`),Array.isArray(e.properties)&&e.properties.length>0)for(const s of e.properties)switch(s){case"openDirectory":t.push("--directory");break;case"multiSelections":t.push("--multiple")}let s;try{s=(await me.exec(t.join(" "))).replace(/\n/,"").split("|")}catch(e){return null}return s};showOpenDialogSync=e=>{const t=["zenity --file-selection"];if(e.defaultPath&&t.push(`--filename="${e.defaultPath}"`),Array.isArray(e.properties)&&e.properties.length>0)for(const s of e.properties)switch(s){case"openDirectory":t.push("--directory");break;case"multiSelections":t.push("--multiple")}let s;try{s=me.execSync(t.join(" ")).replace(/\n/,"").split("|")}catch(e){return null}return s};showSaveDialog=async e=>{const t=["zenity --file-selection --save --confirm-overwrite"];let s;e.defaultPath&&t.push(`--filename="${e.defaultPath}"`);try{s=await me.exec(t.join(" ")),s=s.replace(/\n/,"")}catch(e){return null}return s};showSaveDialogSync=e=>{const t=["zenity --file-selection --save --confirm-overwrite"];let s;e.defaultPath&&t.push(`--filename="${e.defaultPath}"`);try{s=me.execSync(t.join(" ")),s=s.replace(/\n/,"")}catch(e){return null}return s}}const Te=new class{provider;constructor(){let e="Native";ce.settings.app.useZenity&&(e="Zenity"),this.provider=this.makeProvider(e),this.initListeners()}initListeners=()=>{e.ipcMain.on("set-use-zenity",((e,t)=>{this.provider=t?this.makeProvider("Zenity"):this.makeProvider("Native")}))};makeProvider=e=>{switch(e){case"Native":default:return new ge;case"Zenity":return new fe}};showMessageBox=e=>this.provider.showMessageBox(e);showMessageBoxSync=e=>this.provider.showMessageBoxSync(e);showOpenDialog=e=>this.provider.showOpenDialog(e);showOpenDialogSync=e=>this.provider.showOpenDialogSync(e);showSaveDialog=e=>this.provider.showSaveDialog(e);showSaveDialogSync=e=>this.provider.showSaveDialogSync(e)};class Ce{enableColorSpaceSrgbWasChanged=!1;disableThemesChanged=!1;chromiumFlagsChanged=!1;view;constructor(){this.view=new e.BrowserView({webPreferences:{nodeIntegration:!0,contextIsolation:!1,experimentalFeatures:!1,webviewTag:!0}}),this.view.setAutoResize({width:!0,height:!0,horizontal:!0,vertical:!0}),this.view.webContents.loadURL(ne?R:_),this.registerEvents()}closeDevTools(){this.view.webContents.isDevToolsOpened()&&this.view.webContents.closeDevTools()}postClose(){let t=1;if(this.enableColorSpaceSrgbWasChanged&&(t=Te.showMessageBoxSync({type:"question",title:"Figma",message:"Restart to Change Color Space?",detail:"Figma needs to be restarted to change the color space.",textOkButton:"Restart",defaultFocusedButton:"Ok"})),this.chromiumFlagsChanged&&(t=Te.showMessageBoxSync({type:"question",title:"Figma",message:"Restart to apply Chromium flags?",detail:"Figma needs to be restarted to ppply Chromium flags.",textOkButton:"Restart",defaultFocusedButton:"Ok"})),this.disableThemesChanged){let e="Restart to disable themes?";ce.settings.app.disableThemes||(e="Restart to enable themes?"),t=Te.showMessageBoxSync({type:"question",title:"Figma",message:e,detail:"Figma needs to be restarted to change use of themes.",textOkButton:"Restart",defaultFocusedButton:"Ok"})}t||e.app.emit("relaunchApp")}updateProps(e){this.enableColorSpaceSrgbWasChanged=!1,this.disableThemesChanged=!1,this.chromiumFlagsChanged=!1,this.view.setBounds({height:e.height,width:e.width,y:0,x:0})}toggleThemeCreatorPreviewMask(){this.view.webContents.send("toggleThemeCreatorPreviewMask")}enableColorSpaceSrgbChange(e){e!==ce.settings.app.enableColorSpaceSrgb&&(this.enableColorSpaceSrgbWasChanged=!0)}chromiumFlagsChange(e){this.chromiumFlagsChanged=e}disableThemesChange(e){e!==ce.settings.app.disableThemes&&(this.disableThemesChanged=!0)}syncThemesStart(){}syncThemesEnd(e){this.view.webContents.send("themesLoaded",e)}loadCurrentTheme(e){this.view.webContents.send("loadCurrentTheme",e)}loadCreatorThemes(e){this.view.webContents.send("loadCreatorThemes",e)}changeTheme(e,t){this.loadCurrentTheme(t),ce.settings.theme.currentTheme=t.id}loadSettings(){this.view.webContents.send("loadSettings",ce.settings)}handleFrontReady(){this.loadSettings()}registerEvents(){e.ipcMain.on("changeTheme",this.changeTheme.bind(this)),e.ipcMain.on("frontReady",this.handleFrontReady.bind(this)),e.app.on("enableColorSpaceSrgbWasChanged",this.enableColorSpaceSrgbChange.bind(this)),e.app.on("chromiumFlagsChanged",this.chromiumFlagsChange.bind(this)),e.app.on("disableThemesChanged",this.disableThemesChange.bind(this)),e.app.on("syncThemesStart",this.syncThemesStart.bind(this)),e.app.on("syncThemesEnd",this.syncThemesEnd.bind(this)),e.app.on("loadCurrentTheme",this.loadCurrentTheme.bind(this)),e.app.on("loadCreatorThemes",this.loadCreatorThemes.bind(this))}}class ye{windowId;_userId;options={webPreferences:{nodeIntegration:!1,webgl:!0,contextIsolation:!1,zoomFactor:1,preload:ne?H:j}};id;view;constructor(e){this.windowId=e,this.initTab(),this.registerEvents()}setUserId(e){if(this._userId!==e){const t=`${M}/?fuid=${e}`;this.loadUrl(t)}this._userId=e}loadUrl(e){this.view.webContents.loadURL(e)}getUrl(){return this.view.webContents.getURL()}loadLoginPage(){this.view.webContents.loadURL(v)}redeemAppAuth(e){this.view.webContents.send("redeemAppAuth",e)}handleUrl(e){this.view.webContents.send("handleUrl",e)}setAutosize(e){this.view.setAutoResize({width:e,height:e,horizontal:e,vertical:e})}setBounds(e){this.view.setBounds(e)}initTab(){this._userId=ce.settings.userId;const t=`${M}/?fuid=${this._userId}`;this.view=new e.BrowserView(this.options),this.id=this.view.webContents.id,this.loadUrl(t),this.setAutosize(!0),ne&&G(this.view.webContents),e.app.emit("requestBoundsForTabView",this.windowId)}updateScale(e){this.view.webContents.setZoomFactor(e)}reloadCurrentTheme(){e.app.emit("reloadCurrentTheme")}loadTheme(e){this.view.webContents.send("loadCurrentTheme",e)}onMainTabWillNavigate(t,s){(ee(s)||K(s))&&(e.app.emit("openUrlInNewTab",s),t.preventDefault())}onDomReady(e){this.reloadCurrentTheme()}onMainWindowWillNavigate(s,i){if(s?.sender){const n=s.sender.getURL();if(X(i))return;if(i===n)return void s.preventDefault();const a=t.parse(n),o=t.parse(i);if("/login"===a.pathname)return void s.preventDefault();if("/logout"===o.pathname&&e.app.emit("signOut"),o.search&&o.search.match(/[\?\&]redirected=1/))return void s.preventDefault()}return te(i)?(e.shell.openExternal(i),void s.preventDefault()):se(i)||ie(i)?(e.app.emit("openUrlInNewTab",i),void s.preventDefault()):void 0}onNewWindow(t,s){const{url:i}=s;if(we.debug("newWindow, url: ",i),!/start_google_sso/.test(i)){if(!K(i)&&!ee(i))return se(i)||ie(i)?(t.destroy(),void e.app.emit("openUrlInNewTab",i)):void e.shell.openExternal(i);e.app.emit("openUrlInNewTab",i)}}windowOpenHandler(t){const{url:s}=t;return K(s)||ee(s)||se(s)||ie(s)?(e.app.emit("openUrlInNewTab",s),{action:"deny"}):{action:"allow"}}registerEvents(){this.view.webContents.setWindowOpenHandler(this.windowOpenHandler.bind(this)),this.view.webContents.on("will-navigate",this.onMainTabWillNavigate.bind(this)),this.view.webContents.on("will-navigate",this.onMainWindowWillNavigate.bind(this)),this.view.webContents.on("dom-ready",this.onDomReady.bind(this)),this.view.webContents.on("did-create-window",this.onNewWindow.bind(this))}}class ve{windowId;userId;id;view;constructor(e){this.windowId=e,this.userId=ce.settings.userId,this.initTab(),this.registerEvents()}loadUrl(e){this.view.webContents.loadURL(e)}getUrl(){return this.view.webContents.getURL()}setAutosize(e){this.view.setAutoResize({width:e,height:e,horizontal:e,vertical:e})}setBounds(e){this.view.setBounds(e)}initTab(){const t={webPreferences:{nodeIntegration:!1,webgl:!0,contextIsolation:!1,zoomFactor:1,preload:ne?z:q}};this.view=new e.BrowserView(t),this.id=this.view.webContents.id,this.setAutosize(!0),ne&&G(this.view.webContents),e.app.emit("requestBoundsForTabView",this.windowId)}updateScale(e){this.view.webContents.setZoomFactor(e)}reloadCurrentTheme(){e.app.emit("reloadCurrentTheme")}loadTheme(e){this.view.webContents.send("loadCurrentTheme",e)}onCommunityTabWillNavigate(t,s){(e=>/^(https?:\/\/w{0,3}?\.?figma\.com\/.*)/.test(e))(s)&&!Q(s)||(t.preventDefault(),Q(s)?e.app.emit("openFileBrowser"):e.shell.openExternal(s))}onDomReady(e){this.reloadCurrentTheme()}windowOpenHandler(t){const s=t.url;return K(s)||ee(s)||(e=>/^(figma:\/\/|https?:\/\/w{0,3}?\.?figma\.com\/jam)/.test(e))(s)?(e.app.emit("openUrlFromCommunity",s),{action:"deny"}):(e.shell.openExternal(s),{action:"deny"})}registerEvents(){this.view.webContents.setWindowOpenHandler(this.windowOpenHandler.bind(this)),this.view.webContents.on("will-navigate",this.onCommunityTabWillNavigate.bind(this)),this.view.webContents.on("dom-ready",this.onDomReady.bind(this))}}class Me{windowId;id;title;url;moves;fileKey;isUsingMicrophone;isInVoiceCall;view;constructor(e){this.windowId=e,this.initTab(),this.registerEvents()}loadUrl(e){this.url=e,this.view.webContents.loadURL(e)}getUrl(){return this.view.webContents.getURL()}setAutosize(e){this.view.setAutoResize({width:e,height:e,horizontal:e,vertical:e})}setBounds(e){this.view.setBounds(e)}initTab(){const t={webPreferences:{nodeIntegration:!1,webgl:!0,contextIsolation:!1,zoomFactor:1,preload:ne?z:q}};this.view=new e.BrowserView(t),this.id=this.view.webContents.id,this.setAutosize(!0),e.app.emit("requestBoundsForTabView",this.windowId)}updateScale(e){this.view.webContents.setZoomFactor(e)}reloadCurrentTheme(){e.app.emit("reloadCurrentTheme")}onDomReady(e){this.reloadCurrentTheme()}onMainWindowWillNavigate(s,i){const n=s.sender.getURL();if(X(i))return;if(i===n)return void s.preventDefault();if(te(i))return e.shell.openExternal(i),void s.preventDefault();const a=t.parse(n),o=t.parse(i);"/login"!==a.pathname?("/logout"===o.pathname&&e.app.emit("signOut"),o.search&&o.search.match(/[\?\&]redirected=1/)&&s.preventDefault()):s.preventDefault()}onNewWindow(t,s){const i=s.url;we.debug("newWindow, url: ",i),/start_google_sso/.test(i)||(K(i)||ee(i)?e.app.emit("openUrlInNewTab",i):e.shell.openExternal(i))}permissionHandler(e,t,s){if(["fullscreen","pointerLock","clipboard-read","clipboard-write","clipboard-sanitized-write"].includes(t))return s(!0);if("media"===t){if(this.isUsingMicrophone)return s(!0);if(0===Te.showMessageBoxSync({type:"question",title:"Figma",message:"Microphone access required for voice call.",detail:"Allow microphone access?",textOkButton:"Allow",textCancelButton:"Deny",defaultFocusedButton:"Ok"}))return this.isUsingMicrophone=!0,s(!0)}return s(!1)}windowOpenHandler(t){const{url:s}=t;return K(s)||ee(s)?e.app.emit("openUrlInNewTab",s):e.shell.openExternal(s),{action:"deny"}}registerEvents(){this.view.webContents.setWindowOpenHandler(this.windowOpenHandler.bind(this)),this.view.webContents.on("will-navigate",this.onMainWindowWillNavigate.bind(this)),this.view.webContents.on("dom-ready",this.onDomReady.bind(this)),this.view.webContents.on("did-create-window",this.onNewWindow.bind(this)),this.view.webContents.session.setPermissionRequestHandler(this.permissionHandler.bind(this))}}class Fe{windowId;mainTab;communityTab;hasOpenedNewFileTab=!1;hasOpenedCommunityTab=!1;lastFocusedTab;tabs=new Map;get mainTabWebContentId(){return this.mainTab.view.webContents.id}get communityTabWebContentId(){return this.communityTab?this.communityTab.view.webContents.id:void 0}constructor(e){this.windowId=e,this.mainTab=new ye(this.windowId),this.lastFocusedTab=this.mainTab.id,this.registerEvents()}setUserId(e){this.mainTab.setUserId(e)}addTab(e=M,t){const s=new Me(this.windowId);return s.title=t,s.loadUrl(e),this.tabs.set(s.id,s),t===D&&(this.hasOpenedNewFileTab=!0),s}addCommunityTab(){this.communityTab=new ve(this.windowId)}closeCommunityTab(){this.communityTab.view.webContents&&!this.communityTab.view.webContents.isDestroyed()&&this.communityTab.view.webContents.destroy(),this.communityTab=void 0}handleCallbackForTab(e,t,s){this.getById(e).view.webContents.send("handleCallback",t,s)}closeAll(){this.tabs.clear()}close(e){const t=this.tabs.get(e),s=[...this.tabs.entries()];let i;for(let t=0;t<s.length;t++){const n=s[t],a=s[t+1];if(!a)break;if(n[0]===e){i=a[0];break}i=n[0]}return t.view.webContents&&!t.view.webContents.isDestroyed()&&t.view.webContents.destroy(),t.title===D&&(this.hasOpenedNewFileTab=!1),this.tabs.delete(e),i||(i=this.hasOpenedCommunityTab?"communityTab":"mainTab"),i}reloadAll(){this.tabs.forEach((e=>e.view.webContents.isDestroyed()?"":e.view.webContents.reload()))}updateScaleAll(e){this.mainTab.updateScale(e),this.communityTab&&this.communityTab.updateScale(e),this.tabs.forEach((t=>t.updateScale(e)))}getTabByIndex(e){let t,s=0;return this.tabs.forEach((i=>{e===s&&(t=i),s++})),t}getTabIndex(e){let t=0;return this.tabs.forEach(((s,i)=>{e!==i&&t++})),t}reloadTab(e){this.getById(e).view.webContents.reload()}loadUrlInMainTab(e){this.mainTab.loadUrl(e)}loadUrlInCommunityTab(e){this.communityTab.loadUrl(e)}loadLoginPage(){this.mainTab.loadLoginPage()}redeemAppAuth(e){this.mainTab.redeemAppAuth(e)}handleUrl(e){this.mainTab.handleUrl(e)}getById(e){switch(e){case"mainTab":return this.mainTab;case"communityTab":return this.communityTab;default:if(this.tabs.has(e))return this.tabs.get(e);if(this.mainTab.id===e)return this.mainTab;if(this.communityTab.id===e)return this.communityTab}return this.mainTab}getByTitle(e){let t;return this.tabs.forEach((s=>{s.title===e&&(t=s)})),t}getByPath(e){let t;return this.tabs.forEach((s=>{const i=u.parse(s.url??s.getUrl()).pathname;new RegExp(i).test(e)&&(t=s)})),t}getAll=()=>this.tabs;focusTab(e){const t=this.getById(e);this.lastFocusedTab=t.id}setTitle(e,t){const s=this.getById(e);s instanceof Me&&(s.title=t)}setBounds(e,t){this.getById(e).setBounds(t)}focusMainTab(){this.lastFocusedTab=this.mainTab.id}focusCommunityTab(){this.lastFocusedTab=this.communityTab.id}setBoundsForAllTab(e){this.mainTab.setBounds(e),this.hasOpenedCommunityTab&&this.communityTab.setBounds(e);for(const[t,s]of this.tabs)s.setBounds(e)}sortTabs(e){const t=[...this.tabs.entries()];this.tabs.clear();for(const s of e){const e=t.find((([e,t])=>t.id===s.id));this.tabs.set(e[0],e[1])}}getTabUrl(e){return this.tabs.get(e).view.webContents.getURL()}isNewFileTab(e){for(const[t,s]of this.tabs)if(s.title&&s.title===D&&s.id===e)return!0;return!1}isMainTab(e){return[...this.tabs.keys()][0]===e}handlePluginMenuAction(e){this.getById(this.lastFocusedTab).view.webContents.send("handlePluginMenuAction",e)}getActiveTabPath(){const e=this.getById(this.lastFocusedTab).view.webContents.getURL();return u.parse(e).pathname}loadCurrentTheme(e){this.mainTab.loadTheme(e),this.communityTab&&this.communityTab.loadTheme(e),this.tabs.forEach((t=>t.view.webContents.send("loadCurrentTheme",e)))}changeTheme(e,t){this.loadCurrentTheme(t),ce.settings.theme.currentTheme=t.id}registerEvents(){e.ipcMain.on("changeTheme",this.changeTheme.bind(this)),e.app.on("loadCurrentTheme",this.loadCurrentTheme.bind(this))}}class Ie{window;tabManager;settingsView;state;_userId;constructor(t){this.window=new e.BrowserWindow(m),this.tabManager=new Fe(this.window.id),this.settingsView=new Ce,this.state=t,this.window.addBrowserView(this.tabManager.mainTab.view),this.window.setTopBrowserView(this.tabManager.mainTab.view),this.registerEvents(),this.window.loadURL(ne?$:V),ne&&G(this.window.webContents),this.applyState()}get id(){return this.window.id}get webContentId(){return this.window.webContents.id}get settingsViewId(){return this.settingsView.view.webContents.id}get mainTabInfo(){return{id:this.tabManager.mainTab.id,url:this.tabManager.mainTab.view.webContents.getURL()}}get communityTabInfo(){return{id:this.tabManager.communityTab?this.tabManager.communityTab.id:-1,url:this.tabManager.communityTab?this.tabManager.communityTab.view.webContents.getURL():""}}get tabs(){return this.tabManager.getAll()}get win(){return this.window}get allWebContentsIds(){const e=new Set([this.webContentId,this.settingsViewId,this.tabManager.mainTabWebContentId,...this.tabs.keys()]);return this.tabManager.communityTabWebContentId&&e.add(this.tabManager.communityTabWebContentId),[...e]}setUserId(e){this._userId=e,this.tabManager.setUserId(e)}sortTabs(e){this.tabManager.sortTabs(e)}getState(){const e=[];for(const[t,s]of this.tabs)e.push({title:s.title,url:s.url});return{...this.window.getBounds(),isMaximized:this.window.isMaximized(),lastActiveTabPath:this.tabManager.getActiveTabPath(),hasOpenedCommunityTab:this.tabManager.hasOpenedCommunityTab,windowId:this.id,userId:this._userId,tabs:e}}restoreTabs(e){const t=e??ce.settings.app.lastOpenedTabs[this.id];t&&setTimeout((()=>{t.forEach(((e,s)=>{setTimeout((()=>{this.addTab(e.url,e.title),s+1===t.length&&this.setTabFocusByPath(this.state.lastActiveTabPath)}),300*s)}))}),100)}calcBoundsForTabView(){const e=ce.settings.app.panelHeight;return{x:0,y:e,width:this.window.getContentBounds().width,height:this.window.getContentBounds().height-e}}handleUrl(e){this.tabManager.handleUrl(e),this.setFocusToMainTab()}handlePluginManageAction(e){this.tabManager.mainTab.view.webContents.send("handlePluginMenuAction",{type:e}),this.setFocusToMainTab()}handlePluginMenuAction(e){this.tabManager.handlePluginMenuAction(e)}toggleDevTools(){G(this.window.webContents)}toggleSettingsDevTools(){G(this.settingsView.view.webContents)}toggleCurrentTabDevTools(){const e=this.tabManager.getById(this.tabManager.lastFocusedTab);G(e.view.webContents)}openUrlFromCommunity(e){const t=this.addTab(e);this.setTabFocus(t.id)}openUrl(e){if(X(e)){const t=Y(e);this.tabManager.loadUrlInMainTab(t)}else(e=>/figma\.com\/community\/.+/.test(e))(e)?(this.handleUrl(t.parse(e).path),this.setFocusToMainTab()):/figma:\/\//.test(e)?this.addTab(e.replace(/figma:\//,C)):/https?:\/\//.test(e)&&this.addTab(e)}focus(){this.window.focus()}showHandler(e){const t=ce.settings.ui.scalePanel;this.updatePanelScale(e,t)}toggleThemeCreatorPreviewMask(){this.settingsView.toggleThemeCreatorPreviewMask()}updatePanelScale(e,t){const s=+t.toFixed(2);ce.settings.app.panelHeight=Math.floor(40*s),ce.settings.ui.scalePanel=s,this.window.webContents.send("setPanelScale",s,ce.settings.app.panelHeight),this.updateTabsBounds()}updateFigmaUiScale(e,t){this.tabManager.updateScaleAll(t)}getBounds(){return this.window.getBounds()}updateTabsBounds(){const e=this.calcBoundsForTabView();this.tabManager.setBoundsForAllTab(e)}closeAllTab(e){const t=this.tabManager.getAll();for(const[e,s]of t)this.window.removeBrowserView(s.view);this.tabManager.closeAll(),this.window.webContents.send("closeAllTab")}loadLoginPageAllWindows(){this.tabManager.loadLoginPage()}redeemAppAuth(e){this.tabManager.redeemAppAuth(e)}newProject(){this.tabManager.hasOpenedNewFileTab||(this.addTab(`${F}?fuid=${this._userId}`,D),this.window.webContents.send("newFileBtnVisible",!1))}createFile(e){const t=this.tabManager.getByTitle(D),s=this.addTab(e.url);return s.loadUrl(e.url),this.closeTab(t.id),this.tabWasClosed(t.id),this.window.webContents.send("newFileBtnVisible",!0),this.setTabFocus(s.id),!0}openMainMenuCloseHandler(){setTimeout((()=>{this.window.webContents.send("isMainMenuOpen",!1)}),150)}hasWebContentId(e){return this.tabManager.getAll().has(e)}getTabInfo(e){const t=this.tabManager.getById(e),s=t.getUrl();return{id:e,title:t instanceof Me?t.title:"",url:s}}addTab(e,t){const s=Z(e);s.searchParams.set("fuid",this._userId);const i=this.tabManager.addTab(s.toString(),t);return this.window.webContents.send("didTabAdd",{id:i.id,url:e,title:t}),i}openSettingsView(){const e=this.window.getBounds();this.settingsView.updateProps(e),this.window.addBrowserView(this.settingsView.view),ne&&G(this.settingsView.view.webContents),setTimeout((()=>{this.settingsView.updateProps(e)}),100)}closeSettingsView(){this.settingsView.view&&(this.settingsView.closeDevTools(),this.window.removeBrowserView(this.settingsView.view),this.settingsView.postClose())}toggleFullScreen(){this.window.isFullScreen()?this.window.setFullScreen(!1):this.window.setFullScreen(!0)}onEnterFullScreen(){const e=this.tabManager.getById(this.tabManager.lastFocusedTab);e&&e.view.webContents.send("handleSetFullScreen",!0)}onLeaveFullScreen(){const e=this.tabManager.getById(this.tabManager.lastFocusedTab);e&&e.view.webContents.send("handleSetFullScreen",!1)}applyState(){const{x:e,y:t,height:s,width:i,userId:n,tabs:a,isMaximized:o}=this.state;n&&this.setUserId(n),ce.settings.app.saveLastOpenedTabs&&a&&a.length>0&&this.window.webContents.once("did-finish-load",(()=>this.restoreTabs(a))),this.win.setBounds({x:e,y:t,width:i,height:s}),o&&this.win.maximize()}loadCurrentTheme(e){this.window.webContents.send("loadCurrentTheme",e)}setLoading(e,t){const s=e.sender.id;this.tabManager.getById(s)&&this.window.webContents.send("setLoading",s,t.loading)}windowMinimize(e){this.window.minimize()}windowMaimize(e){this.window&&!this.window.isDestroyed()&&(this.window.isMaximized()?(this.window.restore(),e.reply("windowDidRestored")):(this.window.maximize(),e.reply("windowDidMaximized")))}webContentDidFinishLoad(){this.state.hasOpenedCommunityTab&&this.openCommunity({path:"/@figma_linux",userId:this._userId}),this.setFocusToMainTab()}setMenu(e){this.window.setMenu(e)}closeNewFileTab(){const e=this.tabManager.getByTitle(D);e&&(this.closeTab(e.id),this.tabWasClosed(e.id),this.window.webContents.send("newFileBtnVisible",!0))}setIsInVoiceCall(e,t){this.window.webContents.send("setIsInVoiceCall",{id:e,isInVoiceCall:t})}setUsingMicrophone(e,t){this.window.webContents.send("setUsingMicrophone",{id:e,isUsingMicrophone:t})}reload(){this.window.reload()}reloadTab(e){this.tabManager.reloadTab(e)}closeTab(e){const t=this.tabManager.getById(e),s=this.tabManager.isNewFileTab(e);this.window.removeBrowserView(t.view);const i=this.tabManager.close(e);if(this.tabManager.lastFocusedTab===e)if(s)this.tabManager.hasOpenedCommunityTab?this.setFocusToCommunityTab():this.setFocusToMainTab();else switch(this.tabManager.focusTab(i),this.window.webContents.send("focusTab",i),i){case"mainTab":this.setFocusToMainTab();break;case"communityTab":this.setFocusToCommunityTab();break;default:this.setTabFocus(i)}this.tabManager.hasOpenedNewFileTab||this.window.webContents.send("newFileBtnVisible",!0)}getLatestFocusedTabId(){return this.tabManager.lastFocusedTab}tabWasClosed(e){this.window.webContents.send("tabWasClosed",e)}setFocusToMainTab(){const t=this.tabManager.mainTab;try{this.window.setTopBrowserView(t.view)}catch(e){this.window.addBrowserView(t.view),this.window.setTopBrowserView(t.view)}this.tabManager.focusMainTab(),this.closeNewFileTab(),this.window.webContents.send("focusTab","mainTab"),e.app.emit("needUpdateMenu",this.id,null,{"close-tab":!1})}setFocusToCommunityTab(){const t=this.calcBoundsForTabView(),s=this.tabManager.communityTab;try{this.window.setTopBrowserView(s.view)}catch(e){this.window.addBrowserView(s.view),this.window.setTopBrowserView(s.view)}this.tabManager.focusCommunityTab(),this.closeNewFileTab(),this.tabManager.communityTab.setBounds(t),this.window.webContents.send("focusTab","communityTab"),e.app.emit("needUpdateMenu",this.id,null,{"close-tab":!0})}setTabFocusByPath(e){const t=this.tabManager.getByPath(e);t?this.setTabFocus(t.id):(/recents/.test(e)&&(this.setFocusToMainTab(),this.tabManager.loadUrlInMainTab(`${C}${e}`)),/community/.test(e)&&(this.setFocusToCommunityTab(),this.tabManager.loadUrlInCommunityTab(`${C}${e}`)))}loadUrlMainTab(e){this.tabManager.mainTab.loadUrl(e)}setTabFocus(t){const s=this.calcBoundsForTabView(),i=this.tabManager.getById(t);try{this.window.setTopBrowserView(i.view)}catch(e){this.window.addBrowserView(i.view),this.window.setTopBrowserView(i.view)}this.tabManager.focusTab(t),this.tabManager.setBounds(t,s),this.window.webContents.send("focusTab",t),e.app.emit("needUpdateMenu",this.id,t,{"close-tab":!0})}setTabTitle(e,t){const s=this.tabManager.getById(e.sender.id);!s||s instanceof Me&&s.title===D||(this.tabManager.setTitle(s.id,t),this.window.webContents.send("setTitle",{id:s.view.webContents.id,title:t}))}openFile(e,...t){let s=`${C}${t[0]}`;t[2]&&(s=`${s}${t[2]}`),this.addTab(s)}closeCommunityTab(){this.window.removeBrowserView(this.tabManager.communityTab.view),this.tabManager.closeCommunityTab(),this.setFocusToMainTab(),this.tabManager.hasOpenedCommunityTab=!1,this.window.webContents.send("communityTabWasClose")}openCommunity(e){const t=this.tabManager.hasOpenedCommunityTab,s=this.calcBoundsForTabView(),i=`${C}${e.path}?fuid=${e.userId}`;t||(this.tabManager.addCommunityTab(),this.tabManager.communityTab.userId=e.userId,this.tabManager.communityTab.loadUrl(i),this.window.addBrowserView(this.tabManager.communityTab.view)),this.window.setTopBrowserView(this.tabManager.communityTab.view),this.tabManager.communityTab.setBounds(s),this.window.webContents.send("openCommunity"),this.tabManager.hasOpenedCommunityTab=!0,this.setFocusToCommunityTab()}updateVisibleNewProjectBtn(e,t){this.window.webContents.send("updateVisibleNewProjectBtn",t)}handleCallbackForTab(e,t,s){this.tabManager.handleCallbackForTab(e,t,s)}changeTheme(e,t){this.loadCurrentTheme(t),ce.settings.theme.currentTheme=t.id}handleFrontReady(){this.window.webContents.send("loadSettings",ce.settings),this.showHandler(null)}close(){this.window.close()}registerEvents(){e.app.on("loadCurrentTheme",this.loadCurrentTheme.bind(this)),this.window.on("show",this.showHandler.bind(this)),this.window.on("resize",this.updateTabsBounds.bind(this)),this.window.on("maximize",(()=>setTimeout(this.updateTabsBounds.bind(this),100))),this.window.on("unmaximize",(()=>setTimeout(this.updateTabsBounds.bind(this),100))),this.window.on("move",(()=>setTimeout(this.updateTabsBounds.bind(this),100))),this.window.on("focus",(()=>e.app.emit("windowFocus",this.window.id))),this.window.on("enter-full-screen",this.onEnterFullScreen.bind(this)),this.window.on("leave-full-screen",this.onLeaveFullScreen.bind(this)),this.window.webContents.on("did-finish-load",this.webContentDidFinishLoad.bind(this))}}class Se{menu;_menu=new Map;constructor(){}getMenu(t){const s=[this.item("New Window","newWindow","Ctrl+N"),this.item("New Tab","newFile","Ctrl+T"),this.item("Open File Browser","openFileBrowser","Ctrl+O"),this.item("Open File URL from Clipboard","openFileUrlClipboard","Ctrl+Shift+O"),{type:"separator"},this.item("Close Window","closeCurrentWindow","Ctrl+Shift+W"),this.item("Close Tab","closeCurrentTab","Ctrl+W",t?.actionCheckedState["close-tab"]),this.item("Reopen Closed Tab","reopenClosedTab","Ctrl+Shift+T"),this.item("Fullscreen","toggleWindowFullscreen","F11",!0,!1)];return t?.recentClosedTabsMenuData?.length>0&&s.push({type:"submenu",label:"Recently Closed Tabs",submenu:t.recentClosedTabsMenuData.map((t=>({type:"normal",label:t.title,click:(s,i)=>{e.app.emit("restoreClosedTab",i.id,t.title,t.url)}})))}),s.push({type:"separator"}),t?.pluginMenuData?.length>0?s.push({label:"Plugins",submenu:this.parseFigmaMenu(t.pluginMenuData)}):s.push(this.pluginsMenu()),s.push({type:"separator"}),s.push(this.item("Settings","openSettingsView")),s.push(this.helpMenu()),s.push({type:"separator"}),s.push(this.item("Quit","quitApp","Ctrl+Alt+Q")),this.menu=e.Menu.buildFromTemplate(s),this.menu}openMainMenuHandler(e,t,s){this.menu.popup({callback:s,window:t,x:e-330,y:ce.settings.app.panelHeight})}openMainTabMenuHandler(t,s,i){const n=[{id:"copyUrl",label:"Copy Url",click:()=>{e.clipboard.writeText(encodeURI(i))}},{id:"reload",label:"Reload",visible:!0,click:()=>{e.app.emit("reloadTab",s)}}];e.Menu.buildFromTemplate(n).popup({window:t})}openCommunityTabMenuHandler(t,s,i){const n=[{id:"copyUrl",label:"Copy Url",click:()=>{e.clipboard.writeText(encodeURI(i))}},{type:"separator"},{id:"openInBrowser",label:"Open in Browser",click:()=>{e.shell.openExternal(i)}},{type:"separator"},{id:"reload",label:"Reload",visible:!0,click:()=>{e.app.emit("reloadTab",s)}},{type:"separator"},{id:"close",label:"Close",visible:!0,click:()=>{e.app.emit("closeCommunityTab")}}];e.Menu.buildFromTemplate(n).popup({window:t})}openTabMenuHandler(t,s,i){const n=[{id:"copyUrl",label:"Copy Url",click:()=>{e.clipboard.writeText(encodeURI(i))}},{type:"separator"},{id:"openInBrowser",label:"Open in Browser",click:()=>{e.shell.openExternal(i)}},{type:"separator"},{id:"reload",label:"Reload",visible:!0,click:()=>{e.app.emit("reloadTab",s)}},{type:"separator"},{id:"close",label:"Close",visible:!0,click:(t,i)=>{e.app.emit("closeTab",i.id,s)}}];e.Menu.buildFromTemplate(n).popup({window:t})}getTabMenu(e){return this._menu.get(e)}setTabMenu(e,t){let s=this._menu.get(e)??{};s={...s,...t},this._menu.set(e,s)}item(t,s,i,n=!0,a=!0){const o={label:t,enabled:n,visible:a,id:s,click:(t,i)=>e.app.emit(s,i.id)};return i&&(o.accelerator=i),o}openExternal(t,s){return{label:t,click(){e.shell.openExternal(s)}}}parseFigmaMenuItemName(e){if("string"==typeof e)return e;switch(e.type){case"plugin-name":return e.plugin;case"string-key":return e.string;default:{const t=`Invalid name type item: ${JSON.stringify(e)}`;return we.warn(t),t}}}parseFigmaMenu(t){const s=[];for(const i of t){if("separator"===i.type){s.push({type:"separator"});continue}const t={type:"boolean"==typeof i.propertyValue?"checkbox":"normal",enabled:!i.disabled,checked:!!i.propertyValue,label:this.parseFigmaMenuItemName(i.name)};i.submenu?(t.type="submenu",t.submenu=this.parseFigmaMenu(i.submenu)):t.click=(t,s)=>{e.app.emit("handlePluginMenuAction",s.id,i.menuAction)},s.push(t)}return s}pluginsMenu(){return{label:"Plugins",submenu:[{label:"Manage plugins...",click(){e.app.emit("handlePluginManageAction")}}]}}widgetsMenu(){return{label:"Widgets",submenu:[{label:"Manage widgets...",click(){e.app.emit("handleWidgetManageAction")}}]}}helpMenu(){return{role:"help",submenu:[this.openExternal("Help Page",P.HELP_PAGE),this.openExternal("Plugins documentation",P.PLUGINS_DOCS),this.openExternal("Community Forum",P.FIGMA_COMMUNITY_FORUM),this.openExternal("Figma Linux Community Forum",P.FIGMA_LINUX_COMMUNITY_FORUM),this.openExternal("Figma Linux in Telegram",P.FIGMA_LINUX_TELEGRAM),this.openExternal("Figma Linux Themes",P.THEMES_REPO),this.openExternal("Video Tutorials",P.VIDEO_TUTORIALS),this.openExternal("Release Notes",P.RELEASE_NOTES),this.openExternal("Legal Summary",P.LEGAL_SUMMARY),{type:"separator"},this.item("Sign Out","signOut"),{type:"separator"},this.item("Toggle Developer Tools","toggleCurrentTabDevTools","Ctrl+Alt+I"),this.item("Toggle Window Developer Tools","toggleCurrentWindowDevTools","Shift+Ctrl+Alt+I"),this.item("Toggle Settings View Developer Tools","toggleSettingsDeveloperTools","Shift+Ctrl+Alt+S"),this.item("GPU","chromeGpu")]}}}process.on("uncaughtException",(e=>{we.error("uncaughtException: ",e)})),process.on("unhandledRejection",(e=>{we.error("unhandledRejection: ",e)})),new class{windowManager;extensionManager;session;fontManager;themeManager;constructor(t,s,i,n,a){this.windowManager=t,this.extensionManager=s,this.session=i,this.fontManager=n,this.themeManager=a;if(!e.app.requestSingleInstanceLock())return e.app.emit("focusLastWindow"),void e.app.quit();this.applySwitches(),e.app.isDefaultProtocolClient(S)||e.app.setAsDefaultProtocolClient(S),this.registerEvents()}ready=()=>{const{figmaUrl:t}=(()=>{const e=process.argv;let t="";-1!=e.indexOf("-v")&&(console.log("string"==typeof he?he:"0.1.0"),process.exit(0));const s=e.findIndex((e=>/^(figma:\/\/|https?:\/\/w{0,3}?\.?figma\.com)/.test(e)));if(-1!==s&&(t=e[s]),-1!=e.indexOf("-h")){const e="\nfigma-linux\n\nUnofficial desktop application for linux. This application based on the Electron.js.\n\nuse:\n    figma-linux [options] [APP_URL_TO_PROJECT]\n\n    OPTIONS:\n        -h      this reference.\n        -v      show version of application.\n        ";console.log(e),process.exit(0)}return{figmaUrl:t}})();this.windowManager.restoreState(),this.session.handleAppReady(),setTimeout((()=>{""!==t&&this.windowManager.openUrl(t)}),1500),e.protocol.handle(S,(t=>(we.info("protocol.handle, req.url: ",t.url),this.windowManager.tryHandleAppAuthRedeemUrl(t.url)?new Response:(this.windowManager.openUrl(t.url),e.net.fetch(t.url,{method:t.method})))))};secondInstance(e,t){let s="";we.debug("second-instance, argv: ",t);const i=t.findIndex((e=>ee(e))),n=t.find((e=>/figma:\/\/app_auth\/redeem\?g_secret=.*/.test(e)));we.debug("second-instance, hasAppAuthorization: ",n),this.windowManager.tryHandleAppAuthRedeemUrl(n)||(-1!==i&&(s=t[i]),""!==s&&(this.windowManager.focusLastWindow(),this.windowManager.openUrl(s)))}frontReady(t){this.session.hasFigmaSession||e.app.emit("closeAllTab"),this.themeManager.loadThemes(),this.themeManager.loadCreatorTheme()}applySwitches(){const t=ce.settings.app.commandSwitches;if(!t.length)return;for(const s of t)e.app.commandLine.appendSwitch(s.switch,s.value);ce.settings.app.enableColorSpaceSrgb?e.app.commandLine.appendSwitch("force-color-profile","srgb"):e.app.commandLine.appendSwitch("disable-color-correct-rendering")}setAuthedUsers(e,t){Array.isArray(ce.settings.authedUserIDs)||(ce.settings.authedUserIDs=t,ce.save()),ce.settings.authedUserIDs=[...new Set([...ce.settings.authedUserIDs,...t])]}setWorkspaceName(e,t){we.warn("The setWorkspaceName not implemented, workspaceName: ",t)}setFigjamEnabled(e,t){we.warn("The setFigjamEnabled not implemented, enabled: ",t)}setClipboardData(t,s){const i=s.format,n=Buffer.from(s.data);-1!==["image/jpeg","image/png"].indexOf(i)?e.clipboard.writeImage(e.nativeImage.createFromBuffer(n)):"image/svg+xml"===i?e.clipboard.writeText(n.toString()):"application/pdf"===i?e.clipboard.writeBuffer("Portable Document Format",n):e.clipboard.writeBuffer(i,n)}async getFonts(e){const t=ce.settings.app.fontDirs;return this.fontManager.getFonts(t)}async getFontFile(e,t){const s=await this.fontManager.getFontFile(t.path);return s&&s.byteLength>0?s:null}async logout(){var t;await(t={url:y,useSessionCookies:!0},new Promise(((s,i)=>{const n={url:t.url,data:""};e.net.request(t).on("response",(e=>{e.on("error",(e=>i(e))),e.on("data",(e=>n.data+=e.toString())),e.on("end",(()=>s(n)))})).on("error",(e=>i(e))).end()}))),ce.settings.authedUserIDs=[];try{await Promise.all([e.session.defaultSession.clearStorageData(),e.session.defaultSession.clearCache()])}catch(e){we.error(e)}this.windowManager.closeTabOnAllWindows(),this.windowManager.loadLoginPageAllWindows()}onWindowAllClosed(){e.app.quit()}relaunchApp(){e.app.relaunch(),e.app.quit()}quitApp(){this.windowManager.saveState(),ce.save(),e.app.quit()}registerEvents=()=>{e.ipcMain.on("frontReady",this.frontReady.bind(this)),e.ipcMain.on("setAuthedUsers",this.setAuthedUsers.bind(this)),e.ipcMain.on("setWorkspaceName",this.setWorkspaceName.bind(this)),e.ipcMain.on("setFigjamEnabled",this.setFigjamEnabled.bind(this)),e.ipcMain.on("setClipboardData",this.setClipboardData.bind(this)),e.ipcMain.handle("getFonts",this.getFonts.bind(this)),e.ipcMain.handle("getFontFile",this.getFontFile.bind(this)),e.app.on("ready",this.ready.bind(this)),e.app.on("second-instance",this.secondInstance.bind(this)),e.app.on("window-all-closed",this.onWindowAllClosed.bind(this)),e.app.on("relaunchApp",this.relaunchApp.bind(this)),e.app.on("signOut",this.logout.bind(this)),e.app.on("quitApp",this.quitApp.bind(this))}}(new class{menuManager;lastFocusedwindowId;windows=new Map;closedTabs=new Map;constructor(){this.menuManager=new Se,this.restoreData(),this.registerEvents()}get closedTabsForMenu(){const e=[...this.closedTabs.values()].reverse();return e.length>10&&(e.length=10),e}openUrl(e){this.windows.get(this.lastFocusedwindowId).openUrl(e)}newWindowFromMenu(e){this.newWindow()}newWindow(e=f){const t=this.menuManager.getMenu({recentClosedTabsMenuData:this.closedTabsForMenu,actionCheckedState:{"close-tab":!1}}),s=new Ie(e);if(-1===e.x||-1===e.y){s.win.center();const t=s.win.getBounds();e.x=t.x,e.y=t.y}this.lastFocusedwindowId=s.id,this.windows.set(s.id,s),s.focus(),s.setMenu(t)}restoreState(){if(!ce.settings.app.windowsState||0===Object.keys(ce.settings.app.windowsState).length)return void this.newWindow();const e=Object.values(ce.settings.app.windowsState);for(const t of e)this.newWindow(t)}openUrlInNewTab(e){this.windows.get(this.lastFocusedwindowId).openUrl(e)}openUrlFromCommunity(e){this.windows.get(this.lastFocusedwindowId).openUrlFromCommunity(e)}sendWindowBoundsToTabs(e){for(const[t,s]of this.windows)t===e&&s.updateTabsBounds()}closeTabOnAllWindows(){for(const[e,t]of this.windows)t.closeAllTab(null)}closeAllTab(){this.windows.get(this.lastFocusedwindowId).closeAllTab(null)}loadLoginPageAllWindows(){for(const[e,t]of this.windows)t.loadLoginPageAllWindows()}tryHandleAppAuthRedeemUrl=e=>{if(X(e)){const t=Z(Y(e)).searchParams.get("g_secret");if(t){for(const[e,s]of this.windows)s.redeemAppAuth(t),setTimeout((()=>{s.loadUrlMainTab(M)}),1e3);return!0}return!0}return!1};focusLastWindow(){this.windows.get(this.lastFocusedwindowId).focus()}saveState(){ce.settings.app.windowsState={};for(const[e,t]of this.windows){const{windowId:e,...s}=t.getState();ce.settings.app.windowsState[e]=s}}restoreData(){const e=ce.settings.app.recentlyClosedTabs;if(e?.length>0)for(const t of e.reverse())this.closedTabs.set(t.title,{title:t.title,url:t.url})}newFile(e){this.windows.get(this.lastFocusedwindowId).newProject()}reloadTabFromMenu(e){this.windows.get(this.lastFocusedwindowId).reloadTab(e)}closeTabFromMenu(e,t){const s=this.windows.get(e||this.lastFocusedwindowId);this.handleCloseTab(s,t)}closeCurrentTabFromMenu(e){const t=this.windows.get(e||this.lastFocusedwindowId),s=t.getLatestFocusedTabId();s&&this.handleCloseTab(t,s)}closeCurrentWindowFromMenu(e){this.windowClose(e)}toggleCurrentWindowFullscreen(e){this.getWindowByWebContentsId(e.sender.id||this.lastFocusedwindowId).toggleFullScreen()}toggleCurrentWindowFullscreenFromMenu(e){this.windows.get(e||this.lastFocusedwindowId).toggleFullScreen()}reopenClosedTabFromMenu(e){this.windows.get(e||this.lastFocusedwindowId).restoreTabs(this.closedTabsForMenu)}handleCloseTab(e,t){const s=e.getTabInfo(t);s.title!==D&&(this.closedTabs.delete(s.title),this.closedTabs.set(s.title,{title:s.title,url:s.url})),ce.settings.app.recentlyClosedTabs=this.closedTabsForMenu,e.closeTab(t),e.tabWasClosed(t)}chromeGpu(e){this.windows.get(e||this.lastFocusedwindowId).addTab(O,O)}openFileUrlClipboard(){const t=this.windows.get(this.lastFocusedwindowId),s=e.clipboard.readText();t.openUrl(s)}openFileBrowser(){this.windows.get(this.lastFocusedwindowId).setFocusToMainTab()}restoreClosedTab(e,t,s){this.windows.get(e||this.lastFocusedwindowId).addTab(s,t)}openDevTools(e,t){e.sender&&e.sender.openDevTools({mode:t})}setUser(e,t){this.getWindowByWebContentsId(e.sender.id).setUserId(t)}setInitialOptions(e,t){this.getWindowByWebContentsId(e.sender.id).setUserId(t.userId)}startAppAuth(t,s){if(i=s.grantPath,/\/app_auth\/.*\/grant/.test(i)){const t=`${C}${s.grantPath}?desktop_protocol=figma`;e.shell.openExternal(t)}var i}finishAppAuth(e,t){const s=`${C}${t.redirectURL}`,i=this.getWindowByWebContentsId(e.sender.id);this.handleUrl(s),this.reloadAllWindows(),this.tryHandleAppAuthRedeemUrl(t.redirectURL),setTimeout((()=>{i.loadUrlMainTab(s)}),100)}getWindowByWebContentsId(e){for(const[t,s]of this.windows)if(s.allWebContentsIds.includes(e))return s}reloadAllWindows(){for(const[e,t]of this.windows)t.reload()}windowFocus(e){this.lastFocusedwindowId=e}handlerWindowClose(e,t){this.sortTabs(this.lastFocusedwindowId,t),this.windowClose(this.lastFocusedwindowId)}sortTabs(e,t){this.windows.get(e).sortTabs(t)}windowClose(t){this.windows.get(t).close(),this.windows.delete(t),0===this.windows.size&&e.app.emit("quitApp")}setFocusToMainTab(e){this.windows.get(this.lastFocusedwindowId).setFocusToMainTab()}openTabMenuHandler(e,t){const s=this.windows.get(this.lastFocusedwindowId),i=s.getTabInfo(t);this.menuManager.openTabMenuHandler(s.win,t,i.url)}openMainTabMenuHandler(e){const t=this.windows.get(this.lastFocusedwindowId),s=t.mainTabInfo;this.menuManager.openMainTabMenuHandler(t.win,s.id,s.url)}openCommunityTabMenuHandler(e){const t=this.windows.get(this.lastFocusedwindowId),s=t.communityTabInfo;this.menuManager.openCommunityTabMenuHandler(t.win,s.id,s.url)}needUpdateMenu(e,t,s={}){const i=this.windows.get(e||this.lastFocusedwindowId);let n={recentClosedTabsMenuData:this.closedTabsForMenu,actionCheckedState:s};if(t){const e=this.menuManager.getTabMenu(t);n={...n,...e,actionCheckedState:{...n?.actionCheckedState??{},...e?.actionCheckedState??{},"close-tab":!0}}}const a=this.menuManager.getMenu(n);i.setMenu(a)}newProject(e){this.windows.get(this.lastFocusedwindowId).newProject()}async createFile(e,t){return this.windows.get(this.lastFocusedwindowId).createFile(t)}async isDevToolsOpened(e){return e.sender.isDevToolsOpened()}async themesIsDisabled(e){return ce.settings.app.disableThemes}async writeFiles(e,t){const s=t.files;if(!s.length)return;let i=null;const n=ce.settings.app.lastExportDir||ce.settings.app.exportDir;if(1!==s.length||s[0].name.includes(p.sep)){const e=await Te.showOpenDialog({title:"Choose directory for export files",properties:["openDirectory","createDirectory"],buttonLabel:"Save",defaultPath:n});if(!e||1!==e.length)return;i=e[0],ce.settings.app.lastExportDir=i}else{const e=s[0].name,t=await Te.showSaveDialog({title:"Choose directory for export file",defaultPath:`${n}/${p.basename(e)}`,showsTagField:!1});t&&(i=p.dirname(t),s[0].name=p.basename(t),""===p.extname(s[0].name)&&(s[0].name+=p.extname(e)),ce.settings.app.lastExportDir=p.parse(t).dir)}if(i)for(const e of s){const t=p.join(i,e.name);await N(p.dirname(t));try{await w.promises.writeFile(t,Buffer.from(e.buffer),{encoding:"binary"})}catch(t){await Te.showMessageBox({type:"error",title:"Export Failed",message:"Saving file failed",detail:`"${e.name}" could not be saved. Remaining files will not be saved.`})}}}closeTab(e,t){const s=this.windows.get(this.lastFocusedwindowId);this.handleCloseTab(s,t)}closeCommunityTab(e){this.windows.get(this.lastFocusedwindowId).closeCommunityTab()}setFocusToCommunityTab(e){this.windows.get(this.lastFocusedwindowId).setFocusToCommunityTab()}setTabFocus(e,t){this.windows.get(this.lastFocusedwindowId).setTabFocus(t)}async selectExportDirectory(e){const t=await Te.showOpenDialog({properties:["openDirectory"]});return t?t[0]:null}updatePanelScale(e,t){for(const[s,i]of this.windows)i.updatePanelScale(e,t)}updateFigmaUiScale(e,t){for(const[s,i]of this.windows)i.updateFigmaUiScale(e,t)}closeSettingsView(t,s){const i=this.windows.get(this.lastFocusedwindowId);ce.settings.app.enableColorSpaceSrgb!==s.app.enableColorSpaceSrgb&&e.app.emit("enableColorSpaceSrgbWasChanged",!0),ce.settings.app.disableThemes!==s.app.disableThemes&&e.app.emit("disableThemesChanged",!0),JSON.stringify(ce.settings.app.commandSwitches)!==JSON.stringify(s.app.commandSwitches)&&e.app.emit("chromiumFlagsChanged",!0),ce.settings=s,ce.save(),i.closeSettingsView()}handleUrl(e){this.windows.get(this.lastFocusedwindowId).handleUrl(e)}handlePluginManageAction(){this.windows.get(this.lastFocusedwindowId).handlePluginManageAction("manage")}handleWidgetManageAction(){this.windows.get(this.lastFocusedwindowId).handlePluginManageAction("manage-widgets")}handlePluginMenuAction(e,t){this.windows.get(e??this.lastFocusedwindowId).handlePluginMenuAction(t)}toggleSettingsDevTools(e,t){this.windows.get(e||this.lastFocusedwindowId).toggleSettingsDevTools()}toggleCurrentTabDevTools(e,t){this.windows.get(e||this.lastFocusedwindowId).toggleCurrentTabDevTools()}toggleCurrentWindowDevTools(e,t){this.windows.get(e||this.lastFocusedwindowId).toggleDevTools()}updateFullscreenMenuState(e,t){const s=e.sender.id,i=this.getWindowByWebContentsId(s);this.menuManager.setTabMenu(s,t),this.needUpdateMenu(i.id,s)}toggleThemeCreatorPreviewMask(e){this.windows.get(this.lastFocusedwindowId).toggleThemeCreatorPreviewMask()}setIsInVoiceCall(e,t){const s=this.windows.get(this.lastFocusedwindowId),i=e.sender.id;s.setIsInVoiceCall(i,t)}setUsingMicrophone(e,t){const s=this.windows.get(this.lastFocusedwindowId),i=e.sender.id;s.setUsingMicrophone(i,t)}setTabTitle(e,t){this.getWindowByWebContentsId(e.sender.id).setTabTitle(e,t)}openFile(e,...t){this.getWindowByWebContentsId(e.sender.id).openFile(e,...t)}openCommunity(e,t){this.getWindowByWebContentsId(e.sender.id).openCommunity(t)}updateVisibleNewProjectBtn(e,t){this.getWindowByWebContentsId(e.sender.id).updateVisibleNewProjectBtn(e,t)}changeTheme(e,t){for(const[s,i]of this.windows)i.changeTheme(e,t)}handleFrontReady(e){this.getWindowByWebContentsId(e.sender.id).handleFrontReady()}openMainMenuHandler(e){const t=this.getWindowByWebContentsId(e.sender.id),s=t.getBounds().width;this.menuManager.openMainMenuHandler(s,t.win,t.openMainMenuCloseHandler.bind(t))}openSettingsView(){this.windows.get(this.lastFocusedwindowId).openSettingsView()}handleCallbackForTab(e,t,s){this.getWindowByWebContentsId(e).handleCallbackForTab(e,t,s)}windowMinimize(e){this.getWindowByWebContentsId(e.sender.id).windowMinimize(e)}windowMaimize(e){this.getWindowByWebContentsId(e.sender.id).windowMaimize(e)}setLoading(e,t){this.getWindowByWebContentsId(e.sender.id).setLoading(e,t)}registerEvents(){e.ipcMain.handle("selectExportDirectory",this.selectExportDirectory),e.ipcMain.handle("updatePanelScale",this.updatePanelScale.bind(this)),e.ipcMain.handle("updateFigmaUiScale",this.updateFigmaUiScale.bind(this)),e.ipcMain.handle("createFile",this.createFile.bind(this)),e.ipcMain.handle("isDevToolsOpened",this.isDevToolsOpened.bind(this)),e.ipcMain.handle("themesIsDisabled",this.themesIsDisabled.bind(this)),e.ipcMain.handle("writeFiles",this.writeFiles.bind(this)),e.ipcMain.on("setInitialOptions",this.setInitialOptions.bind(this)),e.ipcMain.on("setUser",this.setUser.bind(this)),e.ipcMain.on("openDevTools",this.openDevTools.bind(this)),e.ipcMain.on("startAppAuth",this.startAppAuth.bind(this)),e.ipcMain.on("finishAppAuth",this.finishAppAuth.bind(this)),e.ipcMain.on("windowClose",this.handlerWindowClose.bind(this)),e.ipcMain.on("setFocusToMainTab",this.setFocusToMainTab.bind(this)),e.ipcMain.on("openTabMenu",this.openTabMenuHandler.bind(this)),e.ipcMain.on("openMainTabMenu",this.openMainTabMenuHandler.bind(this)),e.ipcMain.on("openCommunityTabMenu",this.openCommunityTabMenuHandler.bind(this)),e.ipcMain.on("newProject",this.newProject.bind(this)),e.ipcMain.on("closeTab",this.closeTab.bind(this)),e.ipcMain.on("closeCommunityTab",this.closeCommunityTab.bind(this)),e.ipcMain.on("setFocusToCommunityTab",this.setFocusToCommunityTab.bind(this)),e.ipcMain.on("setTabFocus",this.setTabFocus.bind(this)),e.ipcMain.on("closeSettingsView",this.closeSettingsView.bind(this)),e.ipcMain.on("toggleThemeCreatorPreviewMask",this.toggleThemeCreatorPreviewMask.bind(this)),e.ipcMain.on("setUsingMicrophone",this.setUsingMicrophone.bind(this)),e.ipcMain.on("setIsInVoiceCall",this.setIsInVoiceCall.bind(this)),e.ipcMain.on("closeAllTab",this.closeAllTab.bind(this)),e.ipcMain.on("setTitle",this.setTabTitle.bind(this)),e.ipcMain.on("openMainMenu",this.openMainMenuHandler.bind(this)),e.ipcMain.on("changeTheme",this.changeTheme.bind(this)),e.ipcMain.on("openFile",this.openFile.bind(this)),e.ipcMain.on("openCommunity",this.openCommunity.bind(this)),e.ipcMain.on("updateVisibleNewProjectBtn",this.updateVisibleNewProjectBtn.bind(this)),e.ipcMain.on("frontReady",this.handleFrontReady.bind(this)),e.ipcMain.on("updateFullscreenMenuState",this.updateFullscreenMenuState.bind(this)),e.ipcMain.on("windowMinimize",this.windowMinimize.bind(this)),e.ipcMain.on("windowMaximize",this.windowMaimize.bind(this)),e.ipcMain.on("setLoading",this.setLoading.bind(this)),e.ipcMain.on("toggleCurrentWindowFullscreen",this.toggleCurrentWindowFullscreen.bind(this)),e.app.on("newFile",this.newFile.bind(this)),e.app.on("newWindow",this.newWindowFromMenu.bind(this)),e.app.on("reloadTab",this.reloadTabFromMenu.bind(this)),e.app.on("closeTab",this.closeTabFromMenu.bind(this)),e.app.on("closeCurrentTab",this.closeCurrentTabFromMenu.bind(this)),e.app.on("reopenClosedTab",this.reopenClosedTabFromMenu.bind(this)),e.app.on("closeCurrentWindow",this.closeCurrentWindowFromMenu.bind(this)),e.app.on("toggleWindowFullscreen",this.toggleCurrentWindowFullscreenFromMenu.bind(this)),e.app.on("closeCommunityTab",this.closeCommunityTab.bind(this)),e.app.on("closeAllTab",this.closeAllTab.bind(this)),e.app.on("chromeGpu",this.chromeGpu.bind(this)),e.app.on("openFileUrlClipboard",this.openFileUrlClipboard.bind(this)),e.app.on("openFileBrowser",this.openFileBrowser.bind(this)),e.app.on("restoreClosedTab",this.restoreClosedTab.bind(this)),e.app.on("openSettingsView",this.openSettingsView.bind(this)),e.app.on("focusLastWindow",this.focusLastWindow.bind(this)),e.app.on("requestBoundsForTabView",this.sendWindowBoundsToTabs.bind(this)),e.app.on("openUrlInNewTab",this.openUrlInNewTab.bind(this)),e.app.on("openUrlFromCommunity",this.openUrlFromCommunity.bind(this)),e.app.on("windowFocus",this.windowFocus.bind(this)),e.app.on("windowClose",this.windowClose.bind(this)),e.app.on("handleUrl",this.handleUrl.bind(this)),e.app.on("handlePluginManageAction",this.handlePluginManageAction.bind(this)),e.app.on("handleWidgetManageAction",this.handleWidgetManageAction.bind(this)),e.app.on("handlePluginMenuAction",this.handlePluginMenuAction.bind(this)),e.app.on("toggleCurrentWindowDevTools",this.toggleCurrentWindowDevTools.bind(this)),e.app.on("toggleSettingsDeveloperTools",this.toggleSettingsDevTools.bind(this)),e.app.on("toggleCurrentTabDevTools",this.toggleCurrentTabDevTools.bind(this)),e.app.on("needUpdateMenu",this.needUpdateMenu.bind(this)),e.app.on("handleCallbackForTab",this.handleCallbackForTab.bind(this))}},new class{registeredCancelCallbackMap=new Map;extensionMap=new Map;manifestObservers=[];codeObservers=[];constructor(){this.reload(),this.registerEvents()}getPath(e){const t=this.extensionMap.get(e);if(!t)throw new Error("Unknown plugin");return t.path}removePath(e){const t=this.extensionMap.get(e);if(t)try{for(const e of t.observeFiles)e[1].close()}catch(e){console.error(e)}this.extensionMap.delete(e),this.save(),this.notifyManifestObservers({id:e,type:"removed"}),this.notifyCodeObservers({id:e,type:"removed"})}getLastKnownName(e){const t=this.extensionMap.get(e);if(t)return t.lastKnownName}getOrUpdateKnownNameFromManifest(e,t){const s=this.extensionMap.get(e);if(s){try{const e=JSON.parse(t);e&&e.name&&(s.lastKnownName=e.name,s.lastKnownPluginId=e.id)}catch(e){console.error(e)}return[s.lastKnownName,s.lastKnownPluginId]}}addCodeObserver(e,t){this.codeObservers.push(e),this.codeObservers.length<=2&&this.extensionMap.forEach(((e,s)=>{if(e.observeFiles.size>0)for(const n of e.observeFiles){if(n[0]===E)continue;if(!t.test(n[0]))continue;const a=i.resolve(e.path,n[0]),o=g.watch(a,void 0);o.on("all",(()=>this.codeWatcher(s))),o.on("error",(e=>we.error(`chokidar error for ${a}: ${e.name}: ${e.message}`))),e.observeFiles.set(n[0],o)}}))}removeCodeObserver(e){const t=this.codeObservers.indexOf(e);-1!==t&&(this.codeObservers.splice(t,1),this.codeObservers.length||this.extensionMap.forEach((e=>{for(const t of e.observeFiles)t[1]&&(t[1].close(),e.observeFiles.set(t[0],null))})))}addManifestObserver(e){this.manifestObservers.push(e),1===this.manifestObservers.length&&this.extensionMap.forEach(((e,t)=>{if(e.observeFiles.size>0&&e.observeFiles.has(E)){const s=i.resolve(e.path,E),n=g.watch(s,void 0);n.on("all",(()=>this.manifestWatcher(t))),n.on("error",(e=>we.error(`chokidar error for ${s}: ${e.name}: ${e.message}`))),e.observeFiles.set(E,n)}}))}removeManifestObserver(e){const t=this.manifestObservers.indexOf(e);-1!==t&&(this.manifestObservers.splice(t,1),this.manifestObservers.length||this.extensionMap.forEach((e=>{e.observeFiles.get(E).close(),e.observeFiles.set(E,null)})))}save(){ce.settings.app.savedExtensions=this.saveToJson(),ce.save()}reload(){const e=ce.settings.app.savedExtensions;this.loadFromJson(e)}saveToJson(){return[...this.extensionMap.entries()].map((([e,{observeFiles:t,...s}])=>({id:e,...s,files:[...t.keys()]})))}loadFromJson(e){if(Array.isArray(e)&&e.length>0)for(const t of e){const{id:e,files:s,...i}=t;this.extensionMap.set(e,{...i,observeFiles:new Map((s??[]).map((e=>[e,null])))})}}async loadExtensionManifest(e){const t=this.getPath(e);try{const s=await w.promises.readFile(i.resolve(t,E),{encoding:"utf8"}),[n,a]=this.getOrUpdateKnownNameFromManifest(e,s);return{path:t,lastKnownName:n,lastKnownPluginId:a,cachedContainsWidget:!1,observeFiles:new Map,manifest:s}}catch(s){return{path:t,lastKnownPluginId:"0",cachedContainsWidget:!1,lastKnownName:this.getLastKnownName(e),observeFiles:new Map,error:s+""}}}async getSource(e){const t=JSON.parse(await w.promises.readFile(i.resolve(e,E),{encoding:"utf8"})),s={stdout:"",stderr:"",path:""};if("string"==typeof t.build&&(s.path=process.env.PATH||"",await new Promise((i=>{b.exec(t.build,{cwd:e},((e,t,n)=>{s.stdout=t,s.stderr=n,e&&(s.buildErrCode=e.code),i()}))})),s.buildErrCode))return s;const n=async(s,n)=>{const a=n?t[s][n]:t[s],o=n?s+"."+n:s;if(!a)return;if("string"!=typeof a)throw new Error(`Manifest "${o}" property must be a string`);const r=i.resolve(e,a);if(i.relative(e,r).startsWith(".."))throw new Error(`Manifest "${o}" file must be located in same directory, or a subdirectory, as manifest`);return w.promises.readFile(r,{encoding:"utf8"})};if(s.source=await n("main"),s.source||(s.source=await n("script")),!s.source)throw new Error("Missing or empty script");return"string"==typeof t.ui?s.html=await n("ui"):s.html=await(async e=>{if(!t[e])return;if("object"!=typeof t[e])throw new Error(`Manifest "${e}" property must be an object`);const s={},i=[],a=Object.keys(t[e]);for(const t of a){const a=e=>{s[t]=e};i.push(n(e,t).then(a))}return await Promise.all(i),s})("ui"),s.html||(s.html=await n("html")),s}notifyManifestObservers(e){this.manifestObservers.forEach((t=>{try{t(e)}catch(e){we.error(e)}}))}notifyCodeObservers(e){this.codeObservers.forEach((t=>{try{t(e)}catch(e){we.error(e)}}))}async manifestWatcher(e){const t=await this.loadExtensionManifest(e);this.notifyManifestObservers({type:"changed",id:e,localLoadResult:t})}async codeWatcher(e){this.notifyCodeObservers({type:"changed",id:e,manifestFileId:e})}async observerAction(e,t,s){if(s.match(E)){const s=await this.loadExtensionManifest(t);this.notifyManifestObservers({type:e,id:t,localLoadResult:s})}else this.notifyCodeObservers({type:e,id:t,manifestFileId:t})}async fileAdded(e,t){this.observerAction("added",e,t)}async fileChanged(e,t){this.observerAction("changed",e,t)}notifyFileAdded(e){const t=this.extensionMap.get(e);for(const s of t.observeFiles){const n=i.resolve(t.path,s[0]);this.fileAdded(e,n)}}getManifestFromFiles(e){for(const t of e)if(t.name===E)return JSON.parse(t.content)}async addExtension(e,t){const s=this.generateFileId(),i=this.validateExtensionFiles(t),n=this.getManifestFromFiles(t);return await this.saveExtensionFiles(e,t),this.extensionMap.set(s,{path:e,observeFiles:new Map(i.map((e=>[e,null]))),lastKnownName:n.name,lastKnownPluginId:n.id,cachedContainsWidget:!1}),this.addWatcher(s),this.notifyFileAdded(s),this.save(),s}addWatcher(e){const t=this.extensionMap.get(e);for(const s of t.observeFiles){const n=i.resolve(t.path,s[0]),a=g.watch(n,void 0);s[0]===E?a.on("all",(()=>this.manifestWatcher(e))):a.on("all",(()=>this.codeWatcher(e))),t.observeFiles.set(s[0],a)}}pathExists(e){for(const[t,s]of this.extensionMap.entries())if(s.path===e)return{id:t,existed:!0}}generateFileId(){let e=1;for(;this.extensionMap.has(e);)e++;return e}validateFileName(e){if(!(B.includes(e.name)||U.includes(i.extname(e.name))&&/^[\w\/]+(?:.\w+)*\.\w+/.test(e.name)))throw new Error(`Filename "${e.name}" not allowed`)}validateManidestFile(e){if("string"!=typeof e.content)throw new Error("Manifest must be a string");const t=JSON.parse(e.content);if("object"!=typeof t||null===t)throw new Error("Manifest must be a JSON object");if(t.build)throw new Error(`Manifest 'build' value "${t.build}" not allowed`)}validateExtensionFiles(e){const t=new Set;let s=null;for(const i of e)this.validateFileName(i),i.name===E&&(this.validateManidestFile(i),s=i),re.test(i.name)&&t.add(i.name);if(!s)throw new Error("No manifest found");return[...t]}async saveExtensionFiles(e,t){if(await L(e))return void we.warn("Overwriting existing files or directories not supported");await N(e);let s="";const n=[],a=i.basename(e);for(const o of t){const t=i.join(e,o.name),r=w.promises.writeFile(t,o.content,{encoding:"utf8"}).catch((e=>{we.error(`Cannot save file: ${t} for extension: "${a}", error:\n`,e)}));n.push(r),o.name===E&&(s=JSON.parse(o.content).id)}return await Promise.all(n),s}openExtensionDirectory(t,s){const i=this.getPath(s.id);e.shell.showItemInFolder(i)}removeLocalFileExtension(e,t){this.removePath(t.id)}async createMultipleNewLocalFileExtensions(e,t){const s=[],n=[],a=await Te.showOpenDialog(t.options);if(!a)return{added:s,existed:n};const o=async(e,t,a)=>{if((await w.promises.stat(e)).isDirectory()&&t>0){const s=(await w.promises.readdir(e)).filter((e=>"."!==e[0]));await Promise.all(s.map((s=>o(i.resolve(e,s),t-1,!1))))}else if(i.basename(e)===E){const t=i.parse(e).dir,a=this.pathExists(t),o=await w.promises.readFile(e,{encoding:"utf8"});if(a)n.push(a.id);else{const e=JSON.parse(o),i=[{name:E,content:o},{name:e.main,content:""}];if("object"==typeof e.ui)for(const t of Object.values(e.ui))i.push({name:t,content:""});else"string"==typeof e.ui&&i.push({name:e.ui,content:""});s.push(await this.addExtension(t,i))}}else if(a)throw new Error(`Manifest must be named '${E}'`)};return await Promise.all(a.map((e=>o(e,t.depth,!0)))),{added:s,existed:n}}async writeNewExtensionDirectoryToDisk(e,t){const s=await Te.showSaveDialog({title:t.dir.name?"Choose plugin directory location":"Choose plugin name and directory location",defaultPath:ce.settings.app.lastSavedPluginDir?i.resolve(ce.settings.app.lastSavedPluginDir,t.dir.name):t.dir.name});if(!s)return null;const n=this.pathExists(s);if(n)return n;ce.settings.app.lastSavedPluginDir=i.parse(s).dir;return await this.addExtension(s,t.dir.files)}async getLocalManifestFileExtensionIdsToCachedMetadataMap(e){const t={};return this.extensionMap.forEach(((e,s)=>{t[s]={lastKnownPluginId:e.lastKnownPluginId,cachedContainsWidget:e.cachedContainsWidget}})),t}async getLocalFileExtensionManifest(e,t){return this.loadExtensionManifest(t.id)}async getLocalFileExtensionSource(e,t){return this.getSource(this.getPath(t.id))}async getAllLocalFileExtensionIds(e){return Array.from(this.extensionMap.keys())}registerManifestChangeObserver(t,s,i){const n=i=>{e.app.emit("handleCallbackForTab",t.sender.id,s,i)};this.addManifestObserver(n),this.registeredCancelCallbackMap.set(`${s}:${t.sender.id}`,(()=>{this.removeManifestObserver(n)}))}registerCodeChangeObserver(t,s,i){const n=i=>{e.app.emit("handleCallbackForTab",t.sender.id,s,i)};this.addCodeObserver(n,le),this.registeredCancelCallbackMap.set(`${s}:${t.sender.id}`,(()=>{this.removeCodeObserver(n)}))}registerUiChangeObserver(t,s,i){const n=i=>{e.app.emit("handleCallbackForTab",t.sender.id,s,i)};this.addCodeObserver(n,de),this.registeredCancelCallbackMap.set(`${s}:${t.sender.id}`,(()=>{this.removeCodeObserver(n)}))}webCancelCallback(e,t){const s=`${t}:${e.sender.id}`;this.registeredCancelCallbackMap.get(s)(),this.registeredCancelCallbackMap.delete(s)}registerEvents(){e.ipcMain.on("web-callback:registerManifestChangeObserver",this.registerManifestChangeObserver.bind(this)),e.ipcMain.on("web-callback:registerCodeChangeObserver",this.registerCodeChangeObserver.bind(this)),e.ipcMain.on("web-callback:registerUiChangeObserver",this.registerUiChangeObserver.bind(this)),e.ipcMain.on("web-cancel-callback",this.webCancelCallback.bind(this)),e.ipcMain.on("openExtensionDirectory",this.openExtensionDirectory.bind(this)),e.ipcMain.on("removeLocalFileExtension",this.removeLocalFileExtension.bind(this)),e.ipcMain.handle("writeNewExtensionDirectoryToDisk",this.writeNewExtensionDirectoryToDisk.bind(this)),e.ipcMain.handle("createMultipleNewLocalFileExtensions",this.createMultipleNewLocalFileExtensions.bind(this)),e.ipcMain.handle("getLocalManifestFileExtensionIdsToCachedMetadataMap",this.getLocalManifestFileExtensionIdsToCachedMetadataMap.bind(this)),e.ipcMain.handle("getLocalFileExtensionManifest",this.getLocalFileExtensionManifest.bind(this)),e.ipcMain.handle("getLocalFileExtensionSource",this.getLocalFileExtensionSource.bind(this)),e.ipcMain.handle("getAllLocalFileExtensionIds",this.getAllLocalFileExtensionIds.bind(this))}},new class{_hasFigmaSession;assessSessionTimer;constructor(){this._hasFigmaSession=null,this.assessSessionTimer=null}get hasFigmaSession(){return this._hasFigmaSession}handleAppReady=()=>{e.session.defaultSession.setPermissionRequestHandler(((e,t,s)=>{s(["fullscreen","pointerLock"].includes(t))}));const t=e.session.defaultSession.getUserAgent().replace(/Figma([^/]+)\/([^\s]+)/,"Figma$1/$2 Figma/$2");e.session.defaultSession.setUserAgent(t),e.session.defaultSession.cookies.get({url:C}).then((e=>{this._hasFigmaSession=!!e.find((e=>"figma.session"===e.name)),we.info("[wm] already signed in?",this._hasFigmaSession)})).catch((e=>we.warn("[wm] failed to get cookies during handleAppReady:",C,e)))}},new class{fontList={};getFonts=async e=>(await Promise.all([this.loadTTF(e),this.loadTTC(e)]),this.fontList);getFontFile=async e=>a.readFile(e);async loadTTF(e){let t=[];await Promise.all(e.map((e=>this.find(e,"*.?tf").then((e=>t=[...t,...e])))));for(const e of t)try{const t=new pe(await a.readFile(e));this.fontList[e]=[t.getData()]}catch(t){we.warn(`skip font: ${e}, error: `,t.message)}}async loadTTC(e){let t=[];await Promise.all(e.map((e=>this.find(e,"*.ttc").then((e=>t=[...t,...e])))));for(const e of t)try{const t=new be(await a.readFile(e));this.fontList[e]=t.getData()}catch(t){we.warn(`skip font: ${e}, error: `,t.message)}}find=async(e,t)=>new Promise((i=>{try{s.statSync(e)}catch(e){return void i([])}i(o.spawnSync("find",[e,"-type","f","-name",t]).stdout.toString().split("\n").filter((e=>!!e)))}))},new class{validator;creatorThemes=new Map;themes=new Map;creatorTheme;themesDirectory;creatorThemeDirectory;creatorThemeFileName;constructor(t){this.validator=t;const s=e.app.getPath("userData");this.themesDirectory=p.resolve(s,"Themes"),this.creatorThemeDirectory=p.resolve(s,"ThemeCreator"),this.creatorThemeFileName="theme.json",this.creatorTheme={...k,id:x},this.registerEvents()}async loadThemes(){await L(this.themesDirectory)||await N(this.themesDirectory),await this.syncThemesFromRepository(),await Promise.all([this.loadFromDirectory(this.themes),this.loadFromDirectory(this.creatorThemes,this.creatorThemeDirectory)]),e.app.emit("syncThemesEnd",[...this.themes.values()]),e.app.emit("loadCreatorThemes",[...this.creatorThemes.values()]);const t=ce.settings.theme.currentTheme,s=ce.settings.app.disableThemes;let i=this.themes.get(t)||this.creatorThemes.get(t);(t===k.id||s)&&(i=k),e.app.emit("loadCurrentTheme",i)}async loadFromDirectory(e,t=this.themesDirectory){const s=await w.promises.readdir(t);for(const i of s){const s=p.resolve(t,i),n=await this.readThemeFile(s);if(this.validator.isValidThemeFile(s,n)){const t=this.translatePaletteToKebabCase(n);t.id||(t.id=p.parse(i).name,await this.writeThemeFile(s,t)),e.set(t.id,t)}}}async loadCreatorTheme(){await N(this.creatorThemeDirectory);const t=p.resolve(this.creatorThemeDirectory,this.creatorThemeFileName);if(!await L(t))return;const s=await w.promises.readFile(t),i=JSON.parse(s.toString()),n=this.translatePaletteToCamelCase(i);this.validator.isValidThemePalette(n,t)&&(this.creatorTheme={...this.translatePaletteToKebabCase(n),id:x},e.app.emit("loadCreatorTheme",this.creatorTheme))}async saveCreatorTheme(e){await N(this.creatorThemeDirectory);const t=p.resolve(this.creatorThemeDirectory,this.creatorThemeFileName);return this.writeThemeFile(t,e)}async syncThemesFromRepository(){await async function(t,s){return new Promise(((i,n)=>{e.net.request(t).on("response",(e=>{const t=[];let a=0;e.on("error",n),e.on("data",(e=>{t.push(e),a+=e.length})),e.on("end",(async()=>{const e=Buffer.concat(t);await w.promises.writeFile(s,e).catch((e=>{n(e)})),i()}))})).end()}))}("https://github.com/Figma-Linux/figma-linux-themes/archive/master.zip",I);const t=new h(I);for(const e of t.getEntries())if(/\.json/.test(e.entryName)&&!e.isDirectory){const t=e.getData().toString("utf8"),s=p.parse(e.entryName).base,i=p.resolve(this.themesDirectory,s);try{const e=JSON.parse(t),s=p.parse(i).name,n={...this.translatePaletteToKebabCase(e),id:s};await this.writeThemeFile(i,n)}catch(e){we.error("Cannot parse JSON file: ",i,e)}}}async removeCreatorTheme(t,s){const i=`${s}.json`,n=p.resolve(this.creatorThemeDirectory,i);return this.creatorThemes.delete(s),e.app.emit("loadCreatorThemes",[...this.creatorThemes.values()]),w.promises.unlink(n)}async addCreatorTheme(t,s){const i=this.translatePaletteToCamelCase(s);if(!this.validator.isValidThemePalette(i))return;delete i.id;const n=s.name.replace(/\s/g,"_"),a=`${n}.json`,o=p.resolve(this.creatorThemeDirectory,a);return this.creatorThemes.set(n,{...s,id:n}),e.app.emit("loadCreatorThemes",[...this.creatorThemes.values()]),this.writeThemeFile(o,i)}async exportCreatorTheme(e,t){const s=this.translatePaletteToCamelCase(t);if(!this.validator.isValidThemePalette(s))return;delete s.id;const i=`${t.name.replace(/\s/g,"_")}.json`,n=ce.settings.app.exportDir,a=n?`${n}/${i}`:i,o=await Te.showSaveDialog({title:"Choose theme export directory location",defaultPath:a});return o?this.writeThemeFile(o,s):void 0}async readThemeFile(e){const t=(await w.promises.readFile(e)).toString();return JSON.parse(t)}async writeThemeFile(e,t){return w.promises.writeFile(e,JSON.stringify(this.translatePaletteToCamelCase(t)))}translatePaletteToCamelCase(e){return{id:e.id,name:e.name,author:e.author,palette:ae(e.palette)}}translatePaletteToKebabCase(e){return{id:e.id,name:e.name,author:e.author,palette:oe(e.palette)}}async syncThemes(t){we.debug("Sync themes start"),e.app.emit("syncThemesStart"),await this.syncThemesFromRepository(),await this.loadFromDirectory(this.themes),e.app.emit("syncThemesEnd",[...this.themes.values()]),we.debug("Sync themes end")}async handlerSaveCreatorTheme(e,t){this.saveCreatorTheme(t),this.creatorTheme=t}async reloadCurrentTheme(){let t=this.themes.get(ce.settings.theme.currentTheme)??k;ce.settings.app.disableThemes&&(t=k),e.app.emit("loadCurrentTheme",t)}registerEvents(){e.ipcMain.on("syncThemes",this.syncThemes.bind(this)),e.ipcMain.on("saveCreatorTheme",this.handlerSaveCreatorTheme.bind(this)),e.ipcMain.on("themeCreatorAddTheme",this.addCreatorTheme.bind(this)),e.ipcMain.on("themeCreatorRemoveTheme",this.removeCreatorTheme.bind(this)),e.ipcMain.on("themeCreatorExportTheme",this.exportCreatorTheme.bind(this)),e.app.on("reloadCurrentTheme",this.reloadCurrentTheme.bind(this))}}(new class{isValidThemeFile(e,t){return".json"!==p.extname(e)?(we.error(`The file "${e}" has not .json extension`),!1):t.author&&t.name&&t.palette?!!this.isValidThemePalette(t,e):(we.error(`The file "${e}" has not the author or name or palette fields`),!1)}isValidThemePalette(e,t){if(!e.palette)return!1;t||(t=e.name);const s=Object.keys(e.palette);if(43!==s.length)return we.error(`The file "${t}" has invalid count of palette colors`),!1;for(const i of s){const s=e.palette[i];if(!W.includes(i))return we.error(`Theme "${t}" has unavailable color field "${i}"`),!1;if(!this.checkThemeColorValue(s))return we.error(`Theme "${t}" has incorrect color value: "${s}" for "${i}" field`),!1}return!0}checkThemeColorValue(e){return A.test(e)}}));
The MIT License (MIT)

Copyright (c) 2014-2016, Jon Schlinkert

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
/*!
 * is-extglob <https://github.com/jonschlinkert/is-extglob>
 *
 * Copyright (c) 2014-2016, Jon Schlinkert.
 * Licensed under the MIT License.
 */

module.exports = function isExtglob(str) {
  if (typeof str !== 'string' || str === '') {
    return false;
  }

  var match;
  while ((match = /(\\).|([@?!+*]\(.*\))/g.exec(str))) {
    if (match[2]) return true;
    str = str.slice(match.index + match[0].length);
  }

  return false;
};
{
  "name": "is-extglob",
  "description": "Returns true if a string has an extglob.",
  "version": "2.1.1",
  "homepage": "https://github.com/jonschlinkert/is-extglob",
  "author": "Jon Schlinkert (https://github.com/jonschlinkert)",
  "repository": "jonschlinkert/is-extglob",
  "license": "MIT",
  "files": [
    "index.js"
  ],
  "main": "index.js",
  "engines": {
    "node": ">=0.10.0"
  },
  "devDependencies": {
    "gulp-format-md": "^0.1.10",
    "mocha": "^3.0.2"
  },
  "verb": {
    "toc": false,
    "layout": "default",
    "tasks": [
      "readme"
    ],
    "plugins": [
      "gulp-format-md"
    ],
    "related": {
      "list": [
        "has-glob",
        "is-glob",
        "micromatch"
      ]
    },
    "reflinks": [
      "verb",
      "verb-generate-readme"
    ],
    "lint": {
      "reflinks": true
    }
  }
}The MIT License (MIT)

Copyright (c) 2014-2017, Jon Schlinkert.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
/*!
 * is-glob <https://github.com/jonschlinkert/is-glob>
 *
 * Copyright (c) 2014-2017, Jon Schlinkert.
 * Released under the MIT License.
 */

var isExtglob = require('is-extglob');
var chars = { '{': '}', '(': ')', '[': ']'};
var strictCheck = function(str) {
  if (str[0] === '!') {
    return true;
  }
  var index = 0;
  var pipeIndex = -2;
  var closeSquareIndex = -2;
  var closeCurlyIndex = -2;
  var closeParenIndex = -2;
  var backSlashIndex = -2;
  while (index < str.length) {
    if (str[index] === '*') {
      return true;
    }

    if (str[index + 1] === '?' && /[\].+)]/.test(str[index])) {
      return true;
    }

    if (closeSquareIndex !== -1 && str[index] === '[' && str[index + 1] !== ']') {
      if (closeSquareIndex < index) {
        closeSquareIndex = str.indexOf(']', index);
      }
      if (closeSquareIndex > index) {
        if (backSlashIndex === -1 || backSlashIndex > closeSquareIndex) {
          return true;
        }
        backSlashIndex = str.indexOf('\\', index);
        if (backSlashIndex === -1 || backSlashIndex > closeSquareIndex) {
          return true;
        }
      }
    }

    if (closeCurlyIndex !== -1 && str[index] === '{' && str[index + 1] !== '}') {
      closeCurlyIndex = str.indexOf('}', index);
      if (closeCurlyIndex > index) {
        backSlashIndex = str.indexOf('\\', index);
        if (backSlashIndex === -1 || backSlashIndex > closeCurlyIndex) {
          return true;
        }
      }
    }

    if (closeParenIndex !== -1 && str[index] === '(' && str[index + 1] === '?' && /[:!=]/.test(str[index + 2]) && str[index + 3] !== ')') {
      closeParenIndex = str.indexOf(')', index);
      if (closeParenIndex > index) {
        backSlashIndex = str.indexOf('\\', index);
        if (backSlashIndex === -1 || backSlashIndex > closeParenIndex) {
          return true;
        }
      }
    }

    if (pipeIndex !== -1 && str[index] === '(' && str[index + 1] !== '|') {
      if (pipeIndex < index) {
        pipeIndex = str.indexOf('|', index);
      }
      if (pipeIndex !== -1 && str[pipeIndex + 1] !== ')') {
        closeParenIndex = str.indexOf(')', pipeIndex);
        if (closeParenIndex > pipeIndex) {
          backSlashIndex = str.indexOf('\\', pipeIndex);
          if (backSlashIndex === -1 || backSlashIndex > closeParenIndex) {
            return true;
          }
        }
      }
    }

    if (str[index] === '\\') {
      var open = str[index + 1];
      index += 2;
      var close = chars[open];

      if (close) {
        var n = str.indexOf(close, index);
        if (n !== -1) {
          index = n + 1;
        }
      }

      if (str[index] === '!') {
        return true;
      }
    } else {
      index++;
    }
  }
  return false;
};

var relaxedCheck = function(str) {
  if (str[0] === '!') {
    return true;
  }
  var index = 0;
  while (index < str.length) {
    if (/[*?{}()[\]]/.test(str[index])) {
      return true;
    }

    if (str[index] === '\\') {
      var open = str[index + 1];
      index += 2;
      var close = chars[open];

      if (close) {
        var n = str.indexOf(close, index);
        if (n !== -1) {
          index = n + 1;
        }
      }

      if (str[index] === '!') {
        return true;
      }
    } else {
      index++;
    }
  }
  return false;
};

module.exports = function isGlob(str, options) {
  if (typeof str !== 'string' || str === '') {
    return false;
  }

  if (isExtglob(str)) {
    return true;
  }

  var check = strictCheck;

  // optionally relax check
  if (options && options.strict === false) {
    check = relaxedCheck;
  }

  return check(str);
};
{
  "name": "is-glob",
  "description": "Returns `true` if the given string looks like a glob pattern or an extglob pattern. This makes it easy to create code that only uses external modules like node-glob when necessary, resulting in much faster code execution and initialization time, and a better user experience.",
  "version": "4.0.3",
  "homepage": "https://github.com/micromatch/is-glob",
  "author": "Jon Schlinkert (https://github.com/jonschlinkert)",
  "repository": "micromatch/is-glob",
  "license": "MIT",
  "files": [
    "index.js"
  ],
  "main": "index.js",
  "engines": {
    "node": ">=0.10.0"
  },
  "dependencies": {
    "is-extglob": "^2.1.1"
  },
  "devDependencies": {
    "gulp-format-md": "^0.1.10",
    "mocha": "^3.0.2"
  },
  "verb": {
    "layout": "default",
    "plugins": [
      "gulp-format-md"
    ],
    "related": {
      "list": [
        "assemble",
        "base",
        "update",
        "verb"
      ]
    },
    "reflinks": [
      "assemble",
      "bach",
      "base",
      "composer",
      "gulp",
      "has-glob",
      "is-valid-glob",
      "micromatch",
      "npm",
      "scaffold",
      "verb",
      "vinyl"
    ]
  }
}The MIT License (MIT)

Copyright (c) 2014-2018, Jon Schlinkert.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
/*!
 * normalize-path <https://github.com/jonschlinkert/normalize-path>
 *
 * Copyright (c) 2014-2018, Jon Schlinkert.
 * Released under the MIT License.
 */

module.exports = function(path, stripTrailing) {
  if (typeof path !== 'string') {
    throw new TypeError('expected path to be a string');
  }

  if (path === '\\' || path === '/') return '/';

  var len = path.length;
  if (len <= 1) return path;

  // ensure that win32 namespaces has two leading slashes, so that the path is
  // handled properly by the win32 version of path.parse() after being normalized
  // https://msdn.microsoft.com/library/windows/desktop/aa365247(v=vs.85).aspx#namespaces
  var prefix = '';
  if (len > 4 && path[3] === '\\') {
    var ch = path[2];
    if ((ch === '?' || ch === '.') && path.slice(0, 2) === '\\\\') {
      path = path.slice(2);
      prefix = '//';
    }
  }

  var segs = path.split(/[/\\]+/);
  if (stripTrailing !== false && segs[segs.length - 1] === '') {
    segs.pop();
  }
  return prefix + segs.join('/');
};
{
  "name": "normalize-path",
  "description": "Normalize slashes in a file path to be posix/unix-like forward slashes. Also condenses repeat slashes to a single slash and removes and trailing slashes, unless disabled.",
  "version": "3.0.0",
  "homepage": "https://github.com/jonschlinkert/normalize-path",
  "author": "Jon Schlinkert (https://github.com/jonschlinkert)",
  "repository": "jonschlinkert/normalize-path",
  "license": "MIT",
  "files": [
    "index.js"
  ],
  "main": "index.js",
  "engines": {
    "node": ">=0.10.0"
  },
  "devDependencies": {
    "gulp-format-md": "^1.0.0",
    "minimist": "^1.2.0",
    "mocha": "^3.5.3"
  },
  "verb": {
    "toc": false,
    "layout": "default",
    "tasks": [
      "readme"
    ],
    "plugins": [
      "gulp-format-md"
    ],
    "related": {
      "description": "Other useful path-related libraries:",
      "list": [
        "contains-path",
        "is-absolute",
        "is-relative",
        "parse-filepath",
        "path-ends-with",
        "path-ends-with",
        "unixify"
      ]
    },
    "lint": {
      "reflinks": true
    }
  }
}The MIT License (MIT)

Copyright (c) 2017-present, Jon Schlinkert.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
'use strict';

module.exports = require('./lib/picomatch');
{
  "name": "picomatch",
  "description": "Blazing fast and accurate glob matcher written in JavaScript, with no dependencies and full support for standard and extended Bash glob features, including braces, extglobs, POSIX brackets, and regular expressions.",
  "version": "2.3.1",
  "homepage": "https://github.com/micromatch/picomatch",
  "author": "Jon Schlinkert (https://github.com/jonschlinkert)",
  "funding": "https://github.com/sponsors/jonschlinkert",
  "repository": "micromatch/picomatch",
  "license": "MIT",
  "files": [
    "index.js",
    "lib"
  ],
  "main": "index.js",
  "engines": {
    "node": ">=8.6"
  },
  "devDependencies": {
    "eslint": "^6.8.0",
    "fill-range": "^7.0.1",
    "gulp-format-md": "^2.0.0",
    "mocha": "^6.2.2",
    "nyc": "^15.0.0",
    "time-require": "github:jonschlinkert/time-require"
  },
  "verb": {
    "toc": {
      "render": true,
      "method": "preWrite",
      "maxdepth": 3
    },
    "layout": "empty",
    "tasks": [
      "readme"
    ],
    "plugins": [
      "gulp-format-md"
    ],
    "lint": {
      "reflinks": true
    },
    "related": {
      "list": [
        "braces",
        "micromatch"
      ]
    },
    "reflinks": [
      "braces",
      "expand-brackets",
      "extglob",
      "fill-range",
      "micromatch",
      "minimatch",
      "nanomatch",
      "picomatch"
    ]
  }
}'use strict';

const path = require('path');
const WIN_SLASH = '\\\\/';
const WIN_NO_SLASH = `[^${WIN_SLASH}]`;

/**
 * Posix glob regex
 */

const DOT_LITERAL = '\\.';
const PLUS_LITERAL = '\\+';
const QMARK_LITERAL = '\\?';
const SLASH_LITERAL = '\\/';
const ONE_CHAR = '(?=.)';
const QMARK = '[^/]';
const END_ANCHOR = `(?:${SLASH_LITERAL}|$)`;
const START_ANCHOR = `(?:^|${SLASH_LITERAL})`;
const DOTS_SLASH = `${DOT_LITERAL}{1,2}${END_ANCHOR}`;
const NO_DOT = `(?!${DOT_LITERAL})`;
const NO_DOTS = `(?!${START_ANCHOR}${DOTS_SLASH})`;
const NO_DOT_SLASH = `(?!${DOT_LITERAL}{0,1}${END_ANCHOR})`;
const NO_DOTS_SLASH = `(?!${DOTS_SLASH})`;
const QMARK_NO_DOT = `[^.${SLASH_LITERAL}]`;
const STAR = `${QMARK}*?`;

const POSIX_CHARS = {
  DOT_LITERAL,
  PLUS_LITERAL,
  QMARK_LITERAL,
  SLASH_LITERAL,
  ONE_CHAR,
  QMARK,
  END_ANCHOR,
  DOTS_SLASH,
  NO_DOT,
  NO_DOTS,
  NO_DOT_SLASH,
  NO_DOTS_SLASH,
  QMARK_NO_DOT,
  STAR,
  START_ANCHOR
};

/**
 * Windows glob regex
 */

const WINDOWS_CHARS = {
  ...POSIX_CHARS,

  SLASH_LITERAL: `[${WIN_SLASH}]`,
  QMARK: WIN_NO_SLASH,
  STAR: `${WIN_NO_SLASH}*?`,
  DOTS_SLASH: `${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$)`,
  NO_DOT: `(?!${DOT_LITERAL})`,
  NO_DOTS: `(?!(?:^|[${WIN_SLASH}])${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
  NO_DOT_SLASH: `(?!${DOT_LITERAL}{0,1}(?:[${WIN_SLASH}]|$))`,
  NO_DOTS_SLASH: `(?!${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
  QMARK_NO_DOT: `[^.${WIN_SLASH}]`,
  START_ANCHOR: `(?:^|[${WIN_SLASH}])`,
  END_ANCHOR: `(?:[${WIN_SLASH}]|$)`
};

/**
 * POSIX Bracket Regex
 */

const POSIX_REGEX_SOURCE = {
  alnum: 'a-zA-Z0-9',
  alpha: 'a-zA-Z',
  ascii: '\\x00-\\x7F',
  blank: ' \\t',
  cntrl: '\\x00-\\x1F\\x7F',
  digit: '0-9',
  graph: '\\x21-\\x7E',
  lower: 'a-z',
  print: '\\x20-\\x7E ',
  punct: '\\-!"#$%&\'()\\*+,./:;<=>?@[\\]^_`{|}~',
  space: ' \\t\\r\\n\\v\\f',
  upper: 'A-Z',
  word: 'A-Za-z0-9_',
  xdigit: 'A-Fa-f0-9'
};

module.exports = {
  MAX_LENGTH: 1024 * 64,
  POSIX_REGEX_SOURCE,

  // regular expressions
  REGEX_BACKSLASH: /\\(?![*+?^${}(|)[\]])/g,
  REGEX_NON_SPECIAL_CHARS: /^[^@![\].,$*+?^{}()|\\/]+/,
  REGEX_SPECIAL_CHARS: /[-*+?.^${}(|)[\]]/,
  REGEX_SPECIAL_CHARS_BACKREF: /(\\?)((\W)(\3*))/g,
  REGEX_SPECIAL_CHARS_GLOBAL: /([-*+?.^${}(|)[\]])/g,
  REGEX_REMOVE_BACKSLASH: /(?:\[.*?[^\\]\]|\\(?=.))/g,

  // Replace globs with equivalent patterns to reduce parsing time.
  REPLACEMENTS: {
    '***': '*',
    '**/**': '**',
    '**/**/**': '**'
  },

  // Digits
  CHAR_0: 48, /* 0 */
  CHAR_9: 57, /* 9 */

  // Alphabet chars.
  CHAR_UPPERCASE_A: 65, /* A */
  CHAR_LOWERCASE_A: 97, /* a */
  CHAR_UPPERCASE_Z: 90, /* Z */
  CHAR_LOWERCASE_Z: 122, /* z */

  CHAR_LEFT_PARENTHESES: 40, /* ( */
  CHAR_RIGHT_PARENTHESES: 41, /* ) */

  CHAR_ASTERISK: 42, /* * */

  // Non-alphabetic chars.
  CHAR_AMPERSAND: 38, /* & */
  CHAR_AT: 64, /* @ */
  CHAR_BACKWARD_SLASH: 92, /* \ */
  CHAR_CARRIAGE_RETURN: 13, /* \r */
  CHAR_CIRCUMFLEX_ACCENT: 94, /* ^ */
  CHAR_COLON: 58, /* : */
  CHAR_COMMA: 44, /* , */
  CHAR_DOT: 46, /* . */
  CHAR_DOUBLE_QUOTE: 34, /* " */
  CHAR_EQUAL: 61, /* = */
  CHAR_EXCLAMATION_MARK: 33, /* ! */
  CHAR_FORM_FEED: 12, /* \f */
  CHAR_FORWARD_SLASH: 47, /* / */
  CHAR_GRAVE_ACCENT: 96, /* ` */
  CHAR_HASH: 35, /* # */
  CHAR_HYPHEN_MINUS: 45, /* - */
  CHAR_LEFT_ANGLE_BRACKET: 60, /* < */
  CHAR_LEFT_CURLY_BRACE: 123, /* { */
  CHAR_LEFT_SQUARE_BRACKET: 91, /* [ */
  CHAR_LINE_FEED: 10, /* \n */
  CHAR_NO_BREAK_SPACE: 160, /* \u00A0 */
  CHAR_PERCENT: 37, /* % */
  CHAR_PLUS: 43, /* + */
  CHAR_QUESTION_MARK: 63, /* ? */
  CHAR_RIGHT_ANGLE_BRACKET: 62, /* > */
  CHAR_RIGHT_CURLY_BRACE: 125, /* } */
  CHAR_RIGHT_SQUARE_BRACKET: 93, /* ] */
  CHAR_SEMICOLON: 59, /* ; */
  CHAR_SINGLE_QUOTE: 39, /* ' */
  CHAR_SPACE: 32, /*   */
  CHAR_TAB: 9, /* \t */
  CHAR_UNDERSCORE: 95, /* _ */
  CHAR_VERTICAL_LINE: 124, /* | */
  CHAR_ZERO_WIDTH_NOBREAK_SPACE: 65279, /* \uFEFF */

  SEP: path.sep,

  /**
   * Create EXTGLOB_CHARS
   */

  extglobChars(chars) {
    return {
      '!': { type: 'negate', open: '(?:(?!(?:', close: `))${chars.STAR})` },
      '?': { type: 'qmark', open: '(?:', close: ')?' },
      '+': { type: 'plus', open: '(?:', close: ')+' },
      '*': { type: 'star', open: '(?:', close: ')*' },
      '@': { type: 'at', open: '(?:', close: ')' }
    };
  },

  /**
   * Create GLOB_CHARS
   */

  globChars(win32) {
    return win32 === true ? WINDOWS_CHARS : POSIX_CHARS;
  }
};
'use strict';

const constants = require('./constants');
const utils = require('./utils');

/**
 * Constants
 */

const {
  MAX_LENGTH,
  POSIX_REGEX_SOURCE,
  REGEX_NON_SPECIAL_CHARS,
  REGEX_SPECIAL_CHARS_BACKREF,
  REPLACEMENTS
} = constants;

/**
 * Helpers
 */

const expandRange = (args, options) => {
  if (typeof options.expandRange === 'function') {
    return options.expandRange(...args, options);
  }

  args.sort();
  const value = `[${args.join('-')}]`;

  try {
    /* eslint-disable-next-line no-new */
    new RegExp(value);
  } catch (ex) {
    return args.map(v => utils.escapeRegex(v)).join('..');
  }

  return value;
};

/**
 * Create the message for a syntax error
 */

const syntaxError = (type, char) => {
  return `Missing ${type}: "${char}" - use "\\\\${char}" to match literal characters`;
};

/**
 * Parse the given input string.
 * @param {String} input
 * @param {Object} options
 * @return {Object}
 */

const parse = (input, options) => {
  if (typeof input !== 'string') {
    throw new TypeError('Expected a string');
  }

  input = REPLACEMENTS[input] || input;

  const opts = { ...options };
  const max = typeof opts.maxLength === 'number' ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;

  let len = input.length;
  if (len > max) {
    throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
  }

  const bos = { type: 'bos', value: '', output: opts.prepend || '' };
  const tokens = [bos];

  const capture = opts.capture ? '' : '?:';
  const win32 = utils.isWindows(options);

  // create constants based on platform, for windows or posix
  const PLATFORM_CHARS = constants.globChars(win32);
  const EXTGLOB_CHARS = constants.extglobChars(PLATFORM_CHARS);

  const {
    DOT_LITERAL,
    PLUS_LITERAL,
    SLASH_LITERAL,
    ONE_CHAR,
    DOTS_SLASH,
    NO_DOT,
    NO_DOT_SLASH,
    NO_DOTS_SLASH,
    QMARK,
    QMARK_NO_DOT,
    STAR,
    START_ANCHOR
  } = PLATFORM_CHARS;

  const globstar = opts => {
    return `(${capture}(?:(?!${START_ANCHOR}${opts.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`;
  };

  const nodot = opts.dot ? '' : NO_DOT;
  const qmarkNoDot = opts.dot ? QMARK : QMARK_NO_DOT;
  let star = opts.bash === true ? globstar(opts) : STAR;

  if (opts.capture) {
    star = `(${star})`;
  }

  // minimatch options support
  if (typeof opts.noext === 'boolean') {
    opts.noextglob = opts.noext;
  }

  const state = {
    input,
    index: -1,
    start: 0,
    dot: opts.dot === true,
    consumed: '',
    output: '',
    prefix: '',
    backtrack: false,
    negated: false,
    brackets: 0,
    braces: 0,
    parens: 0,
    quotes: 0,
    globstar: false,
    tokens
  };

  input = utils.removePrefix(input, state);
  len = input.length;

  const extglobs = [];
  const braces = [];
  const stack = [];
  let prev = bos;
  let value;

  /**
   * Tokenizing helpers
   */

  const eos = () => state.index === len - 1;
  const peek = state.peek = (n = 1) => input[state.index + n];
  const advance = state.advance = () => input[++state.index] || '';
  const remaining = () => input.slice(state.index + 1);
  const consume = (value = '', num = 0) => {
    state.consumed += value;
    state.index += num;
  };

  const append = token => {
    state.output += token.output != null ? token.output : token.value;
    consume(token.value);
  };

  const negate = () => {
    let count = 1;

    while (peek() === '!' && (peek(2) !== '(' || peek(3) === '?')) {
      advance();
      state.start++;
      count++;
    }

    if (count % 2 === 0) {
      return false;
    }

    state.negated = true;
    state.start++;
    return true;
  };

  const increment = type => {
    state[type]++;
    stack.push(type);
  };

  const decrement = type => {
    state[type]--;
    stack.pop();
  };

  /**
   * Push tokens onto the tokens array. This helper speeds up
   * tokenizing by 1) helping us avoid backtracking as much as possible,
   * and 2) helping us avoid creating extra tokens when consecutive
   * characters are plain text. This improves performance and simplifies
   * lookbehinds.
   */

  const push = tok => {
    if (prev.type === 'globstar') {
      const isBrace = state.braces > 0 && (tok.type === 'comma' || tok.type === 'brace');
      const isExtglob = tok.extglob === true || (extglobs.length && (tok.type === 'pipe' || tok.type === 'paren'));

      if (tok.type !== 'slash' && tok.type !== 'paren' && !isBrace && !isExtglob) {
        state.output = state.output.slice(0, -prev.output.length);
        prev.type = 'star';
        prev.value = '*';
        prev.output = star;
        state.output += prev.output;
      }
    }

    if (extglobs.length && tok.type !== 'paren') {
      extglobs[extglobs.length - 1].inner += tok.value;
    }

    if (tok.value || tok.output) append(tok);
    if (prev && prev.type === 'text' && tok.type === 'text') {
      prev.value += tok.value;
      prev.output = (prev.output || '') + tok.value;
      return;
    }

    tok.prev = prev;
    tokens.push(tok);
    prev = tok;
  };

  const extglobOpen = (type, value) => {
    const token = { ...EXTGLOB_CHARS[value], conditions: 1, inner: '' };

    token.prev = prev;
    token.parens = state.parens;
    token.output = state.output;
    const output = (opts.capture ? '(' : '') + token.open;

    increment('parens');
    push({ type, value, output: state.output ? '' : ONE_CHAR });
    push({ type: 'paren', extglob: true, value: advance(), output });
    extglobs.push(token);
  };

  const extglobClose = token => {
    let output = token.close + (opts.capture ? ')' : '');
    let rest;

    if (token.type === 'negate') {
      let extglobStar = star;

      if (token.inner && token.inner.length > 1 && token.inner.includes('/')) {
        extglobStar = globstar(opts);
      }

      if (extglobStar !== star || eos() || /^\)+$/.test(remaining())) {
        output = token.close = `)$))${extglobStar}`;
      }

      if (token.inner.includes('*') && (rest = remaining()) && /^\.[^\\/.]+$/.test(rest)) {
        // Any non-magical string (`.ts`) or even nested expression (`.{ts,tsx}`) can follow after the closing parenthesis.
        // In this case, we need to parse the string and use it in the output of the original pattern.
        // Suitable patterns: `/!(*.d).ts`, `/!(*.d).{ts,tsx}`, `**/!(*-dbg).@(js)`.
        //
        // Disabling the `fastpaths` option due to a problem with parsing strings as `.ts` in the pattern like `**/!(*.d).ts`.
        const expression = parse(rest, { ...options, fastpaths: false }).output;

        output = token.close = `)${expression})${extglobStar})`;
      }

      if (token.prev.type === 'bos') {
        state.negatedExtglob = true;
      }
    }

    push({ type: 'paren', extglob: true, value, output });
    decrement('parens');
  };

  /**
   * Fast paths
   */

  if (opts.fastpaths !== false && !/(^[*!]|[/()[\]{}"])/.test(input)) {
    let backslashes = false;

    let output = input.replace(REGEX_SPECIAL_CHARS_BACKREF, (m, esc, chars, first, rest, index) => {
      if (first === '\\') {
        backslashes = true;
        return m;
      }

      if (first === '?') {
        if (esc) {
          return esc + first + (rest ? QMARK.repeat(rest.length) : '');
        }
        if (index === 0) {
          return qmarkNoDot + (rest ? QMARK.repeat(rest.length) : '');
        }
        return QMARK.repeat(chars.length);
      }

      if (first === '.') {
        return DOT_LITERAL.repeat(chars.length);
      }

      if (first === '*') {
        if (esc) {
          return esc + first + (rest ? star : '');
        }
        return star;
      }
      return esc ? m : `\\${m}`;
    });

    if (backslashes === true) {
      if (opts.unescape === true) {
        output = output.replace(/\\/g, '');
      } else {
        output = output.replace(/\\+/g, m => {
          return m.length % 2 === 0 ? '\\\\' : (m ? '\\' : '');
        });
      }
    }

    if (output === input && opts.contains === true) {
      state.output = input;
      return state;
    }

    state.output = utils.wrapOutput(output, state, options);
    return state;
  }

  /**
   * Tokenize input until we reach end-of-string
   */

  while (!eos()) {
    value = advance();

    if (value === '\u0000') {
      continue;
    }

    /**
     * Escaped characters
     */

    if (value === '\\') {
      const next = peek();

      if (next === '/' && opts.bash !== true) {
        continue;
      }

      if (next === '.' || next === ';') {
        continue;
      }

      if (!next) {
        value += '\\';
        push({ type: 'text', value });
        continue;
      }

      // collapse slashes to reduce potential for exploits
      const match = /^\\+/.exec(remaining());
      let slashes = 0;

      if (match && match[0].length > 2) {
        slashes = match[0].length;
        state.index += slashes;
        if (slashes % 2 !== 0) {
          value += '\\';
        }
      }

      if (opts.unescape === true) {
        value = advance();
      } else {
        value += advance();
      }

      if (state.brackets === 0) {
        push({ type: 'text', value });
        continue;
      }
    }

    /**
     * If we're inside a regex character class, continue
     * until we reach the closing bracket.
     */

    if (state.brackets > 0 && (value !== ']' || prev.value === '[' || prev.value === '[^')) {
      if (opts.posix !== false && value === ':') {
        const inner = prev.value.slice(1);
        if (inner.includes('[')) {
          prev.posix = true;

          if (inner.includes(':')) {
            const idx = prev.value.lastIndexOf('[');
            const pre = prev.value.slice(0, idx);
            const rest = prev.value.slice(idx + 2);
            const posix = POSIX_REGEX_SOURCE[rest];
            if (posix) {
              prev.value = pre + posix;
              state.backtrack = true;
              advance();

              if (!bos.output && tokens.indexOf(prev) === 1) {
                bos.output = ONE_CHAR;
              }
              continue;
            }
          }
        }
      }

      if ((value === '[' && peek() !== ':') || (value === '-' && peek() === ']')) {
        value = `\\${value}`;
      }

      if (value === ']' && (prev.value === '[' || prev.value === '[^')) {
        value = `\\${value}`;
      }

      if (opts.posix === true && value === '!' && prev.value === '[') {
        value = '^';
      }

      prev.value += value;
      append({ value });
      continue;
    }

    /**
     * If we're inside a quoted string, continue
     * until we reach the closing double quote.
     */

    if (state.quotes === 1 && value !== '"') {
      value = utils.escapeRegex(value);
      prev.value += value;
      append({ value });
      continue;
    }

    /**
     * Double quotes
     */

    if (value === '"') {
      state.quotes = state.quotes === 1 ? 0 : 1;
      if (opts.keepQuotes === true) {
        push({ type: 'text', value });
      }
      continue;
    }

    /**
     * Parentheses
     */

    if (value === '(') {
      increment('parens');
      push({ type: 'paren', value });
      continue;
    }

    if (value === ')') {
      if (state.parens === 0 && opts.strictBrackets === true) {
        throw new SyntaxError(syntaxError('opening', '('));
      }

      const extglob = extglobs[extglobs.length - 1];
      if (extglob && state.parens === extglob.parens + 1) {
        extglobClose(extglobs.pop());
        continue;
      }

      push({ type: 'paren', value, output: state.parens ? ')' : '\\)' });
      decrement('parens');
      continue;
    }

    /**
     * Square brackets
     */

    if (value === '[') {
      if (opts.nobracket === true || !remaining().includes(']')) {
        if (opts.nobracket !== true && opts.strictBrackets === true) {
          throw new SyntaxError(syntaxError('closing', ']'));
        }

        value = `\\${value}`;
      } else {
        increment('brackets');
      }

      push({ type: 'bracket', value });
      continue;
    }

    if (value === ']') {
      if (opts.nobracket === true || (prev && prev.type === 'bracket' && prev.value.length === 1)) {
        push({ type: 'text', value, output: `\\${value}` });
        continue;
      }

      if (state.brackets === 0) {
        if (opts.strictBrackets === true) {
          throw new SyntaxError(syntaxError('opening', '['));
        }

        push({ type: 'text', value, output: `\\${value}` });
        continue;
      }

      decrement('brackets');

      const prevValue = prev.value.slice(1);
      if (prev.posix !== true && prevValue[0] === '^' && !prevValue.includes('/')) {
        value = `/${value}`;
      }

      prev.value += value;
      append({ value });

      // when literal brackets are explicitly disabled
      // assume we should match with a regex character class
      if (opts.literalBrackets === false || utils.hasRegexChars(prevValue)) {
        continue;
      }

      const escaped = utils.escapeRegex(prev.value);
      state.output = state.output.slice(0, -prev.value.length);

      // when literal brackets are explicitly enabled
      // assume we should escape the brackets to match literal characters
      if (opts.literalBrackets === true) {
        state.output += escaped;
        prev.value = escaped;
        continue;
      }

      // when the user specifies nothing, try to match both
      prev.value = `(${capture}${escaped}|${prev.value})`;
      state.output += prev.value;
      continue;
    }

    /**
     * Braces
     */

    if (value === '{' && opts.nobrace !== true) {
      increment('braces');

      const open = {
        type: 'brace',
        value,
        output: '(',
        outputIndex: state.output.length,
        tokensIndex: state.tokens.length
      };

      braces.push(open);
      push(open);
      continue;
    }

    if (value === '}') {
      const brace = braces[braces.length - 1];

      if (opts.nobrace === true || !brace) {
        push({ type: 'text', value, output: value });
        continue;
      }

      let output = ')';

      if (brace.dots === true) {
        const arr = tokens.slice();
        const range = [];

        for (let i = arr.length - 1; i >= 0; i--) {
          tokens.pop();
          if (arr[i].type === 'brace') {
            break;
          }
          if (arr[i].type !== 'dots') {
            range.unshift(arr[i].value);
          }
        }

        output = expandRange(range, opts);
        state.backtrack = true;
      }

      if (brace.comma !== true && brace.dots !== true) {
        const out = state.output.slice(0, brace.outputIndex);
        const toks = state.tokens.slice(brace.tokensIndex);
        brace.value = brace.output = '\\{';
        value = output = '\\}';
        state.output = out;
        for (const t of toks) {
          state.output += (t.output || t.value);
        }
      }

      push({ type: 'brace', value, output });
      decrement('braces');
      braces.pop();
      continue;
    }

    /**
     * Pipes
     */

    if (value === '|') {
      if (extglobs.length > 0) {
        extglobs[extglobs.length - 1].conditions++;
      }
      push({ type: 'text', value });
      continue;
    }

    /**
     * Commas
     */

    if (value === ',') {
      let output = value;

      const brace = braces[braces.length - 1];
      if (brace && stack[stack.length - 1] === 'braces') {
        brace.comma = true;
        output = '|';
      }

      push({ type: 'comma', value, output });
      continue;
    }

    /**
     * Slashes
     */

    if (value === '/') {
      // if the beginning of the glob is "./", advance the start
      // to the current index, and don't add the "./" characters
      // to the state. This greatly simplifies lookbehinds when
      // checking for BOS characters like "!" and "." (not "./")
      if (prev.type === 'dot' && state.index === state.start + 1) {
        state.start = state.index + 1;
        state.consumed = '';
        state.output = '';
        tokens.pop();
        prev = bos; // reset "prev" to the first token
        continue;
      }

      push({ type: 'slash', value, output: SLASH_LITERAL });
      continue;
    }

    /**
     * Dots
     */

    if (value === '.') {
      if (state.braces > 0 && prev.type === 'dot') {
        if (prev.value === '.') prev.output = DOT_LITERAL;
        const brace = braces[braces.length - 1];
        prev.type = 'dots';
        prev.output += value;
        prev.value += value;
        brace.dots = true;
        continue;
      }

      if ((state.braces + state.parens) === 0 && prev.type !== 'bos' && prev.type !== 'slash') {
        push({ type: 'text', value, output: DOT_LITERAL });
        continue;
      }

      push({ type: 'dot', value, output: DOT_LITERAL });
      continue;
    }

    /**
     * Question marks
     */

    if (value === '?') {
      const isGroup = prev && prev.value === '(';
      if (!isGroup && opts.noextglob !== true && peek() === '(' && peek(2) !== '?') {
        extglobOpen('qmark', value);
        continue;
      }

      if (prev && prev.type === 'paren') {
        const next = peek();
        let output = value;

        if (next === '<' && !utils.supportsLookbehinds()) {
          throw new Error('Node.js v10 or higher is required for regex lookbehinds');
        }

        if ((prev.value === '(' && !/[!=<:]/.test(next)) || (next === '<' && !/<([!=]|\w+>)/.test(remaining()))) {
          output = `\\${value}`;
        }

        push({ type: 'text', value, output });
        continue;
      }

      if (opts.dot !== true && (prev.type === 'slash' || prev.type === 'bos')) {
        push({ type: 'qmark', value, output: QMARK_NO_DOT });
        continue;
      }

      push({ type: 'qmark', value, output: QMARK });
      continue;
    }

    /**
     * Exclamation
     */

    if (value === '!') {
      if (opts.noextglob !== true && peek() === '(') {
        if (peek(2) !== '?' || !/[!=<:]/.test(peek(3))) {
          extglobOpen('negate', value);
          continue;
        }
      }

      if (opts.nonegate !== true && state.index === 0) {
        negate();
        continue;
      }
    }

    /**
     * Plus
     */

    if (value === '+') {
      if (opts.noextglob !== true && peek() === '(' && peek(2) !== '?') {
        extglobOpen('plus', value);
        continue;
      }

      if ((prev && prev.value === '(') || opts.regex === false) {
        push({ type: 'plus', value, output: PLUS_LITERAL });
        continue;
      }

      if ((prev && (prev.type === 'bracket' || prev.type === 'paren' || prev.type === 'brace')) || state.parens > 0) {
        push({ type: 'plus', value });
        continue;
      }

      push({ type: 'plus', value: PLUS_LITERAL });
      continue;
    }

    /**
     * Plain text
     */

    if (value === '@') {
      if (opts.noextglob !== true && peek() === '(' && peek(2) !== '?') {
        push({ type: 'at', extglob: true, value, output: '' });
        continue;
      }

      push({ type: 'text', value });
      continue;
    }

    /**
     * Plain text
     */

    if (value !== '*') {
      if (value === '$' || value === '^') {
        value = `\\${value}`;
      }

      const match = REGEX_NON_SPECIAL_CHARS.exec(remaining());
      if (match) {
        value += match[0];
        state.index += match[0].length;
      }

      push({ type: 'text', value });
      continue;
    }

    /**
     * Stars
     */

    if (prev && (prev.type === 'globstar' || prev.star === true)) {
      prev.type = 'star';
      prev.star = true;
      prev.value += value;
      prev.output = star;
      state.backtrack = true;
      state.globstar = true;
      consume(value);
      continue;
    }

    let rest = remaining();
    if (opts.noextglob !== true && /^\([^?]/.test(rest)) {
      extglobOpen('star', value);
      continue;
    }

    if (prev.type === 'star') {
      if (opts.noglobstar === true) {
        consume(value);
        continue;
      }

      const prior = prev.prev;
      const before = prior.prev;
      const isStart = prior.type === 'slash' || prior.type === 'bos';
      const afterStar = before && (before.type === 'star' || before.type === 'globstar');

      if (opts.bash === true && (!isStart || (rest[0] && rest[0] !== '/'))) {
        push({ type: 'star', value, output: '' });
        continue;
      }

      const isBrace = state.braces > 0 && (prior.type === 'comma' || prior.type === 'brace');
      const isExtglob = extglobs.length && (prior.type === 'pipe' || prior.type === 'paren');
      if (!isStart && prior.type !== 'paren' && !isBrace && !isExtglob) {
        push({ type: 'star', value, output: '' });
        continue;
      }

      // strip consecutive `/**/`
      while (rest.slice(0, 3) === '/**') {
        const after = input[state.index + 4];
        if (after && after !== '/') {
          break;
        }
        rest = rest.slice(3);
        consume('/**', 3);
      }

      if (prior.type === 'bos' && eos()) {
        prev.type = 'globstar';
        prev.value += value;
        prev.output = globstar(opts);
        state.output = prev.output;
        state.globstar = true;
        consume(value);
        continue;
      }

      if (prior.type === 'slash' && prior.prev.type !== 'bos' && !afterStar && eos()) {
        state.output = state.output.slice(0, -(prior.output + prev.output).length);
        prior.output = `(?:${prior.output}`;

        prev.type = 'globstar';
        prev.output = globstar(opts) + (opts.strictSlashes ? ')' : '|$)');
        prev.value += value;
        state.globstar = true;
        state.output += prior.output + prev.output;
        consume(value);
        continue;
      }

      if (prior.type === 'slash' && prior.prev.type !== 'bos' && rest[0] === '/') {
        const end = rest[1] !== void 0 ? '|$' : '';

        state.output = state.output.slice(0, -(prior.output + prev.output).length);
        prior.output = `(?:${prior.output}`;

        prev.type = 'globstar';
        prev.output = `${globstar(opts)}${SLASH_LITERAL}|${SLASH_LITERAL}${end})`;
        prev.value += value;

        state.output += prior.output + prev.output;
        state.globstar = true;

        consume(value + advance());

        push({ type: 'slash', value: '/', output: '' });
        continue;
      }

      if (prior.type === 'bos' && rest[0] === '/') {
        prev.type = 'globstar';
        prev.value += value;
        prev.output = `(?:^|${SLASH_LITERAL}|${globstar(opts)}${SLASH_LITERAL})`;
        state.output = prev.output;
        state.globstar = true;
        consume(value + advance());
        push({ type: 'slash', value: '/', output: '' });
        continue;
      }

      // remove single star from output
      state.output = state.output.slice(0, -prev.output.length);

      // reset previous token to globstar
      prev.type = 'globstar';
      prev.output = globstar(opts);
      prev.value += value;

      // reset output with globstar
      state.output += prev.output;
      state.globstar = true;
      consume(value);
      continue;
    }

    const token = { type: 'star', value, output: star };

    if (opts.bash === true) {
      token.output = '.*?';
      if (prev.type === 'bos' || prev.type === 'slash') {
        token.output = nodot + token.output;
      }
      push(token);
      continue;
    }

    if (prev && (prev.type === 'bracket' || prev.type === 'paren') && opts.regex === true) {
      token.output = value;
      push(token);
      continue;
    }

    if (state.index === state.start || prev.type === 'slash' || prev.type === 'dot') {
      if (prev.type === 'dot') {
        state.output += NO_DOT_SLASH;
        prev.output += NO_DOT_SLASH;

      } else if (opts.dot === true) {
        state.output += NO_DOTS_SLASH;
        prev.output += NO_DOTS_SLASH;

      } else {
        state.output += nodot;
        prev.output += nodot;
      }

      if (peek() !== '*') {
        state.output += ONE_CHAR;
        prev.output += ONE_CHAR;
      }
    }

    push(token);
  }

  while (state.brackets > 0) {
    if (opts.strictBrackets === true) throw new SyntaxError(syntaxError('closing', ']'));
    state.output = utils.escapeLast(state.output, '[');
    decrement('brackets');
  }

  while (state.parens > 0) {
    if (opts.strictBrackets === true) throw new SyntaxError(syntaxError('closing', ')'));
    state.output = utils.escapeLast(state.output, '(');
    decrement('parens');
  }

  while (state.braces > 0) {
    if (opts.strictBrackets === true) throw new SyntaxError(syntaxError('closing', '}'));
    state.output = utils.escapeLast(state.output, '{');
    decrement('braces');
  }

  if (opts.strictSlashes !== true && (prev.type === 'star' || prev.type === 'bracket')) {
    push({ type: 'maybe_slash', value: '', output: `${SLASH_LITERAL}?` });
  }

  // rebuild the output if we had to backtrack at any point
  if (state.backtrack === true) {
    state.output = '';

    for (const token of state.tokens) {
      state.output += token.output != null ? token.output : token.value;

      if (token.suffix) {
        state.output += token.suffix;
      }
    }
  }

  return state;
};

/**
 * Fast paths for creating regular expressions for common glob patterns.
 * This can significantly speed up processing and has very little downside
 * impact when none of the fast paths match.
 */

parse.fastpaths = (input, options) => {
  const opts = { ...options };
  const max = typeof opts.maxLength === 'number' ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
  const len = input.length;
  if (len > max) {
    throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
  }

  input = REPLACEMENTS[input] || input;
  const win32 = utils.isWindows(options);

  // create constants based on platform, for windows or posix
  const {
    DOT_LITERAL,
    SLASH_LITERAL,
    ONE_CHAR,
    DOTS_SLASH,
    NO_DOT,
    NO_DOTS,
    NO_DOTS_SLASH,
    STAR,
    START_ANCHOR
  } = constants.globChars(win32);

  const nodot = opts.dot ? NO_DOTS : NO_DOT;
  const slashDot = opts.dot ? NO_DOTS_SLASH : NO_DOT;
  const capture = opts.capture ? '' : '?:';
  const state = { negated: false, prefix: '' };
  let star = opts.bash === true ? '.*?' : STAR;

  if (opts.capture) {
    star = `(${star})`;
  }

  const globstar = opts => {
    if (opts.noglobstar === true) return star;
    return `(${capture}(?:(?!${START_ANCHOR}${opts.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`;
  };

  const create = str => {
    switch (str) {
      case '*':
        return `${nodot}${ONE_CHAR}${star}`;

      case '.*':
        return `${DOT_LITERAL}${ONE_CHAR}${star}`;

      case '*.*':
        return `${nodot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`;

      case '*/*':
        return `${nodot}${star}${SLASH_LITERAL}${ONE_CHAR}${slashDot}${star}`;

      case '**':
        return nodot + globstar(opts);

      case '**/*':
        return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${ONE_CHAR}${star}`;

      case '**/*.*':
        return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`;

      case '**/.*':
        return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${DOT_LITERAL}${ONE_CHAR}${star}`;

      default: {
        const match = /^(.*?)\.(\w+)$/.exec(str);
        if (!match) return;

        const source = create(match[1]);
        if (!source) return;

        return source + DOT_LITERAL + match[2];
      }
    }
  };

  const output = utils.removePrefix(input, state);
  let source = create(output);

  if (source && opts.strictSlashes !== true) {
    source += `${SLASH_LITERAL}?`;
  }

  return source;
};

module.exports = parse;
'use strict';

const path = require('path');
const scan = require('./scan');
const parse = require('./parse');
const utils = require('./utils');
const constants = require('./constants');
const isObject = val => val && typeof val === 'object' && !Array.isArray(val);

/**
 * Creates a matcher function from one or more glob patterns. The
 * returned function takes a string to match as its first argument,
 * and returns true if the string is a match. The returned matcher
 * function also takes a boolean as the second argument that, when true,
 * returns an object with additional information.
 *
 * ```js
 * const picomatch = require('picomatch');
 * // picomatch(glob[, options]);
 *
 * const isMatch = picomatch('*.!(*a)');
 * console.log(isMatch('a.a')); //=> false
 * console.log(isMatch('a.b')); //=> true
 * ```
 * @name picomatch
 * @param {String|Array} `globs` One or more glob patterns.
 * @param {Object=} `options`
 * @return {Function=} Returns a matcher function.
 * @api public
 */

const picomatch = (glob, options, returnState = false) => {
  if (Array.isArray(glob)) {
    const fns = glob.map(input => picomatch(input, options, returnState));
    const arrayMatcher = str => {
      for (const isMatch of fns) {
        const state = isMatch(str);
        if (state) return state;
      }
      return false;
    };
    return arrayMatcher;
  }

  const isState = isObject(glob) && glob.tokens && glob.input;

  if (glob === '' || (typeof glob !== 'string' && !isState)) {
    throw new TypeError('Expected pattern to be a non-empty string');
  }

  const opts = options || {};
  const posix = utils.isWindows(options);
  const regex = isState
    ? picomatch.compileRe(glob, options)
    : picomatch.makeRe(glob, options, false, true);

  const state = regex.state;
  delete regex.state;

  let isIgnored = () => false;
  if (opts.ignore) {
    const ignoreOpts = { ...options, ignore: null, onMatch: null, onResult: null };
    isIgnored = picomatch(opts.ignore, ignoreOpts, returnState);
  }

  const matcher = (input, returnObject = false) => {
    const { isMatch, match, output } = picomatch.test(input, regex, options, { glob, posix });
    const result = { glob, state, regex, posix, input, output, match, isMatch };

    if (typeof opts.onResult === 'function') {
      opts.onResult(result);
    }

    if (isMatch === false) {
      result.isMatch = false;
      return returnObject ? result : false;
    }

    if (isIgnored(input)) {
      if (typeof opts.onIgnore === 'function') {
        opts.onIgnore(result);
      }
      result.isMatch = false;
      return returnObject ? result : false;
    }

    if (typeof opts.onMatch === 'function') {
      opts.onMatch(result);
    }
    return returnObject ? result : true;
  };

  if (returnState) {
    matcher.state = state;
  }

  return matcher;
};

/**
 * Test `input` with the given `regex`. This is used by the main
 * `picomatch()` function to test the input string.
 *
 * ```js
 * const picomatch = require('picomatch');
 * // picomatch.test(input, regex[, options]);
 *
 * console.log(picomatch.test('foo/bar', /^(?:([^/]*?)\/([^/]*?))$/));
 * // { isMatch: true, match: [ 'foo/', 'foo', 'bar' ], output: 'foo/bar' }
 * ```
 * @param {String} `input` String to test.
 * @param {RegExp} `regex`
 * @return {Object} Returns an object with matching info.
 * @api public
 */

picomatch.test = (input, regex, options, { glob, posix } = {}) => {
  if (typeof input !== 'string') {
    throw new TypeError('Expected input to be a string');
  }

  if (input === '') {
    return { isMatch: false, output: '' };
  }

  const opts = options || {};
  const format = opts.format || (posix ? utils.toPosixSlashes : null);
  let match = input === glob;
  let output = (match && format) ? format(input) : input;

  if (match === false) {
    output = format ? format(input) : input;
    match = output === glob;
  }

  if (match === false || opts.capture === true) {
    if (opts.matchBase === true || opts.basename === true) {
      match = picomatch.matchBase(input, regex, options, posix);
    } else {
      match = regex.exec(output);
    }
  }

  return { isMatch: Boolean(match), match, output };
};

/**
 * Match the basename of a filepath.
 *
 * ```js
 * const picomatch = require('picomatch');
 * // picomatch.matchBase(input, glob[, options]);
 * console.log(picomatch.matchBase('foo/bar.js', '*.js'); // true
 * ```
 * @param {String} `input` String to test.
 * @param {RegExp|String} `glob` Glob pattern or regex created by [.makeRe](#makeRe).
 * @return {Boolean}
 * @api public
 */

picomatch.matchBase = (input, glob, options, posix = utils.isWindows(options)) => {
  const regex = glob instanceof RegExp ? glob : picomatch.makeRe(glob, options);
  return regex.test(path.basename(input));
};

/**
 * Returns true if **any** of the given glob `patterns` match the specified `string`.
 *
 * ```js
 * const picomatch = require('picomatch');
 * // picomatch.isMatch(string, patterns[, options]);
 *
 * console.log(picomatch.isMatch('a.a', ['b.*', '*.a'])); //=> true
 * console.log(picomatch.isMatch('a.a', 'b.*')); //=> false
 * ```
 * @param {String|Array} str The string to test.
 * @param {String|Array} patterns One or more glob patterns to use for matching.
 * @param {Object} [options] See available [options](#options).
 * @return {Boolean} Returns true if any patterns match `str`
 * @api public
 */

picomatch.isMatch = (str, patterns, options) => picomatch(patterns, options)(str);

/**
 * Parse a glob pattern to create the source string for a regular
 * expression.
 *
 * ```js
 * const picomatch = require('picomatch');
 * const result = picomatch.parse(pattern[, options]);
 * ```
 * @param {String} `pattern`
 * @param {Object} `options`
 * @return {Object} Returns an object with useful properties and output to be used as a regex source string.
 * @api public
 */

picomatch.parse = (pattern, options) => {
  if (Array.isArray(pattern)) return pattern.map(p => picomatch.parse(p, options));
  return parse(pattern, { ...options, fastpaths: false });
};

/**
 * Scan a glob pattern to separate the pattern into segments.
 *
 * ```js
 * const picomatch = require('picomatch');
 * // picomatch.scan(input[, options]);
 *
 * const result = picomatch.scan('!./foo/*.js');
 * console.log(result);
 * { prefix: '!./',
 *   input: '!./foo/*.js',
 *   start: 3,
 *   base: 'foo',
 *   glob: '*.js',
 *   isBrace: false,
 *   isBracket: false,
 *   isGlob: true,
 *   isExtglob: false,
 *   isGlobstar: false,
 *   negated: true }
 * ```
 * @param {String} `input` Glob pattern to scan.
 * @param {Object} `options`
 * @return {Object} Returns an object with
 * @api public
 */

picomatch.scan = (input, options) => scan(input, options);

/**
 * Compile a regular expression from the `state` object returned by the
 * [parse()](#parse) method.
 *
 * @param {Object} `state`
 * @param {Object} `options`
 * @param {Boolean} `returnOutput` Intended for implementors, this argument allows you to return the raw output from the parser.
 * @param {Boolean} `returnState` Adds the state to a `state` property on the returned regex. Useful for implementors and debugging.
 * @return {RegExp}
 * @api public
 */

picomatch.compileRe = (state, options, returnOutput = false, returnState = false) => {
  if (returnOutput === true) {
    return state.output;
  }

  const opts = options || {};
  const prepend = opts.contains ? '' : '^';
  const append = opts.contains ? '' : '$';

  let source = `${prepend}(?:${state.output})${append}`;
  if (state && state.negated === true) {
    source = `^(?!${source}).*$`;
  }

  const regex = picomatch.toRegex(source, options);
  if (returnState === true) {
    regex.state = state;
  }

  return regex;
};

/**
 * Create a regular expression from a parsed glob pattern.
 *
 * ```js
 * const picomatch = require('picomatch');
 * const state = picomatch.parse('*.js');
 * // picomatch.compileRe(state[, options]);
 *
 * console.log(picomatch.compileRe(state));
 * //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/
 * ```
 * @param {String} `state` The object returned from the `.parse` method.
 * @param {Object} `options`
 * @param {Boolean} `returnOutput` Implementors may use this argument to return the compiled output, instead of a regular expression. This is not exposed on the options to prevent end-users from mutating the result.
 * @param {Boolean} `returnState` Implementors may use this argument to return the state from the parsed glob with the returned regular expression.
 * @return {RegExp} Returns a regex created from the given pattern.
 * @api public
 */

picomatch.makeRe = (input, options = {}, returnOutput = false, returnState = false) => {
  if (!input || typeof input !== 'string') {
    throw new TypeError('Expected a non-empty string');
  }

  let parsed = { negated: false, fastpaths: true };

  if (options.fastpaths !== false && (input[0] === '.' || input[0] === '*')) {
    parsed.output = parse.fastpaths(input, options);
  }

  if (!parsed.output) {
    parsed = parse(input, options);
  }

  return picomatch.compileRe(parsed, options, returnOutput, returnState);
};

/**
 * Create a regular expression from the given regex source string.
 *
 * ```js
 * const picomatch = require('picomatch');
 * // picomatch.toRegex(source[, options]);
 *
 * const { output } = picomatch.parse('*.js');
 * console.log(picomatch.toRegex(output));
 * //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/
 * ```
 * @param {String} `source` Regular expression source string.
 * @param {Object} `options`
 * @return {RegExp}
 * @api public
 */

picomatch.toRegex = (source, options) => {
  try {
    const opts = options || {};
    return new RegExp(source, opts.flags || (opts.nocase ? 'i' : ''));
  } catch (err) {
    if (options && options.debug === true) throw err;
    return /$^/;
  }
};

/**
 * Picomatch constants.
 * @return {Object}
 */

picomatch.constants = constants;

/**
 * Expose "picomatch"
 */

module.exports = picomatch;
'use strict';

const utils = require('./utils');
const {
  CHAR_ASTERISK,             /* * */
  CHAR_AT,                   /* @ */
  CHAR_BACKWARD_SLASH,       /* \ */
  CHAR_COMMA,                /* , */
  CHAR_DOT,                  /* . */
  CHAR_EXCLAMATION_MARK,     /* ! */
  CHAR_FORWARD_SLASH,        /* / */
  CHAR_LEFT_CURLY_BRACE,     /* { */
  CHAR_LEFT_PARENTHESES,     /* ( */
  CHAR_LEFT_SQUARE_BRACKET,  /* [ */
  CHAR_PLUS,                 /* + */
  CHAR_QUESTION_MARK,        /* ? */
  CHAR_RIGHT_CURLY_BRACE,    /* } */
  CHAR_RIGHT_PARENTHESES,    /* ) */
  CHAR_RIGHT_SQUARE_BRACKET  /* ] */
} = require('./constants');

const isPathSeparator = code => {
  return code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH;
};

const depth = token => {
  if (token.isPrefix !== true) {
    token.depth = token.isGlobstar ? Infinity : 1;
  }
};

/**
 * Quickly scans a glob pattern and returns an object with a handful of
 * useful properties, like `isGlob`, `path` (the leading non-glob, if it exists),
 * `glob` (the actual pattern), `negated` (true if the path starts with `!` but not
 * with `!(`) and `negatedExtglob` (true if the path starts with `!(`).
 *
 * ```js
 * const pm = require('picomatch');
 * console.log(pm.scan('foo/bar/*.js'));
 * { isGlob: true, input: 'foo/bar/*.js', base: 'foo/bar', glob: '*.js' }
 * ```
 * @param {String} `str`
 * @param {Object} `options`
 * @return {Object} Returns an object with tokens and regex source string.
 * @api public
 */

const scan = (input, options) => {
  const opts = options || {};

  const length = input.length - 1;
  const scanToEnd = opts.parts === true || opts.scanToEnd === true;
  const slashes = [];
  const tokens = [];
  const parts = [];

  let str = input;
  let index = -1;
  let start = 0;
  let lastIndex = 0;
  let isBrace = false;
  let isBracket = false;
  let isGlob = false;
  let isExtglob = false;
  let isGlobstar = false;
  let braceEscaped = false;
  let backslashes = false;
  let negated = false;
  let negatedExtglob = false;
  let finished = false;
  let braces = 0;
  let prev;
  let code;
  let token = { value: '', depth: 0, isGlob: false };

  const eos = () => index >= length;
  const peek = () => str.charCodeAt(index + 1);
  const advance = () => {
    prev = code;
    return str.charCodeAt(++index);
  };

  while (index < length) {
    code = advance();
    let next;

    if (code === CHAR_BACKWARD_SLASH) {
      backslashes = token.backslashes = true;
      code = advance();

      if (code === CHAR_LEFT_CURLY_BRACE) {
        braceEscaped = true;
      }
      continue;
    }

    if (braceEscaped === true || code === CHAR_LEFT_CURLY_BRACE) {
      braces++;

      while (eos() !== true && (code = advance())) {
        if (code === CHAR_BACKWARD_SLASH) {
          backslashes = token.backslashes = true;
          advance();
          continue;
        }

        if (code === CHAR_LEFT_CURLY_BRACE) {
          braces++;
          continue;
        }

        if (braceEscaped !== true && code === CHAR_DOT && (code = advance()) === CHAR_DOT) {
          isBrace = token.isBrace = true;
          isGlob = token.isGlob = true;
          finished = true;

          if (scanToEnd === true) {
            continue;
          }

          break;
        }

        if (braceEscaped !== true && code === CHAR_COMMA) {
          isBrace = token.isBrace = true;
          isGlob = token.isGlob = true;
          finished = true;

          if (scanToEnd === true) {
            continue;
          }

          break;
        }

        if (code === CHAR_RIGHT_CURLY_BRACE) {
          braces--;

          if (braces === 0) {
            braceEscaped = false;
            isBrace = token.isBrace = true;
            finished = true;
            break;
          }
        }
      }

      if (scanToEnd === true) {
        continue;
      }

      break;
    }

    if (code === CHAR_FORWARD_SLASH) {
      slashes.push(index);
      tokens.push(token);
      token = { value: '', depth: 0, isGlob: false };

      if (finished === true) continue;
      if (prev === CHAR_DOT && index === (start + 1)) {
        start += 2;
        continue;
      }

      lastIndex = index + 1;
      continue;
    }

    if (opts.noext !== true) {
      const isExtglobChar = code === CHAR_PLUS
        || code === CHAR_AT
        || code === CHAR_ASTERISK
        || code === CHAR_QUESTION_MARK
        || code === CHAR_EXCLAMATION_MARK;

      if (isExtglobChar === true && peek() === CHAR_LEFT_PARENTHESES) {
        isGlob = token.isGlob = true;
        isExtglob = token.isExtglob = true;
        finished = true;
        if (code === CHAR_EXCLAMATION_MARK && index === start) {
          negatedExtglob = true;
        }

        if (scanToEnd === true) {
          while (eos() !== true && (code = advance())) {
            if (code === CHAR_BACKWARD_SLASH) {
              backslashes = token.backslashes = true;
              code = advance();
              continue;
            }

            if (code === CHAR_RIGHT_PARENTHESES) {
              isGlob = token.isGlob = true;
              finished = true;
              break;
            }
          }
          continue;
        }
        break;
      }
    }

    if (code === CHAR_ASTERISK) {
      if (prev === CHAR_ASTERISK) isGlobstar = token.isGlobstar = true;
      isGlob = token.isGlob = true;
      finished = true;

      if (scanToEnd === true) {
        continue;
      }
      break;
    }

    if (code === CHAR_QUESTION_MARK) {
      isGlob = token.isGlob = true;
      finished = true;

      if (scanToEnd === true) {
        continue;
      }
      break;
    }

    if (code === CHAR_LEFT_SQUARE_BRACKET) {
      while (eos() !== true && (next = advance())) {
        if (next === CHAR_BACKWARD_SLASH) {
          backslashes = token.backslashes = true;
          advance();
          continue;
        }

        if (next === CHAR_RIGHT_SQUARE_BRACKET) {
          isBracket = token.isBracket = true;
          isGlob = token.isGlob = true;
          finished = true;
          break;
        }
      }

      if (scanToEnd === true) {
        continue;
      }

      break;
    }

    if (opts.nonegate !== true && code === CHAR_EXCLAMATION_MARK && index === start) {
      negated = token.negated = true;
      start++;
      continue;
    }

    if (opts.noparen !== true && code === CHAR_LEFT_PARENTHESES) {
      isGlob = token.isGlob = true;

      if (scanToEnd === true) {
        while (eos() !== true && (code = advance())) {
          if (code === CHAR_LEFT_PARENTHESES) {
            backslashes = token.backslashes = true;
            code = advance();
            continue;
          }

          if (code === CHAR_RIGHT_PARENTHESES) {
            finished = true;
            break;
          }
        }
        continue;
      }
      break;
    }

    if (isGlob === true) {
      finished = true;

      if (scanToEnd === true) {
        continue;
      }

      break;
    }
  }

  if (opts.noext === true) {
    isExtglob = false;
    isGlob = false;
  }

  let base = str;
  let prefix = '';
  let glob = '';

  if (start > 0) {
    prefix = str.slice(0, start);
    str = str.slice(start);
    lastIndex -= start;
  }

  if (base && isGlob === true && lastIndex > 0) {
    base = str.slice(0, lastIndex);
    glob = str.slice(lastIndex);
  } else if (isGlob === true) {
    base = '';
    glob = str;
  } else {
    base = str;
  }

  if (base && base !== '' && base !== '/' && base !== str) {
    if (isPathSeparator(base.charCodeAt(base.length - 1))) {
      base = base.slice(0, -1);
    }
  }

  if (opts.unescape === true) {
    if (glob) glob = utils.removeBackslashes(glob);

    if (base && backslashes === true) {
      base = utils.removeBackslashes(base);
    }
  }

  const state = {
    prefix,
    input,
    start,
    base,
    glob,
    isBrace,
    isBracket,
    isGlob,
    isExtglob,
    isGlobstar,
    negated,
    negatedExtglob
  };

  if (opts.tokens === true) {
    state.maxDepth = 0;
    if (!isPathSeparator(code)) {
      tokens.push(token);
    }
    state.tokens = tokens;
  }

  if (opts.parts === true || opts.tokens === true) {
    let prevIndex;

    for (let idx = 0; idx < slashes.length; idx++) {
      const n = prevIndex ? prevIndex + 1 : start;
      const i = slashes[idx];
      const value = input.slice(n, i);
      if (opts.tokens) {
        if (idx === 0 && start !== 0) {
          tokens[idx].isPrefix = true;
          tokens[idx].value = prefix;
        } else {
          tokens[idx].value = value;
        }
        depth(tokens[idx]);
        state.maxDepth += tokens[idx].depth;
      }
      if (idx !== 0 || value !== '') {
        parts.push(value);
      }
      prevIndex = i;
    }

    if (prevIndex && prevIndex + 1 < input.length) {
      const value = input.slice(prevIndex + 1);
      parts.push(value);

      if (opts.tokens) {
        tokens[tokens.length - 1].value = value;
        depth(tokens[tokens.length - 1]);
        state.maxDepth += tokens[tokens.length - 1].depth;
      }
    }

    state.slashes = slashes;
    state.parts = parts;
  }

  return state;
};

module.exports = scan;
'use strict';

const path = require('path');
const win32 = process.platform === 'win32';
const {
  REGEX_BACKSLASH,
  REGEX_REMOVE_BACKSLASH,
  REGEX_SPECIAL_CHARS,
  REGEX_SPECIAL_CHARS_GLOBAL
} = require('./constants');

exports.isObject = val => val !== null && typeof val === 'object' && !Array.isArray(val);
exports.hasRegexChars = str => REGEX_SPECIAL_CHARS.test(str);
exports.isRegexChar = str => str.length === 1 && exports.hasRegexChars(str);
exports.escapeRegex = str => str.replace(REGEX_SPECIAL_CHARS_GLOBAL, '\\$1');
exports.toPosixSlashes = str => str.replace(REGEX_BACKSLASH, '/');

exports.removeBackslashes = str => {
  return str.replace(REGEX_REMOVE_BACKSLASH, match => {
    return match === '\\' ? '' : match;
  });
};

exports.supportsLookbehinds = () => {
  const segs = process.version.slice(1).split('.').map(Number);
  if (segs.length === 3 && segs[0] >= 9 || (segs[0] === 8 && segs[1] >= 10)) {
    return true;
  }
  return false;
};

exports.isWindows = options => {
  if (options && typeof options.windows === 'boolean') {
    return options.windows;
  }
  return win32 === true || path.sep === '\\';
};

exports.escapeLast = (input, char, lastIdx) => {
  const idx = input.lastIndexOf(char, lastIdx);
  if (idx === -1) return input;
  if (input[idx - 1] === '\\') return exports.escapeLast(input, char, idx - 1);
  return `${input.slice(0, idx)}\\${input.slice(idx)}`;
};

exports.removePrefix = (input, state = {}) => {
  let output = input;
  if (output.startsWith('./')) {
    output = output.slice(2);
    state.prefix = './';
  }
  return output;
};

exports.wrapOutput = (input, state = {}, options = {}) => {
  const prepend = options.contains ? '' : '^';
  const append = options.contains ? '' : '$';

  let output = `${prepend}(?:${input})${append}`;
  if (state.negated === true) {
    output = `(?:^(?!${output}).*$)`;
  }
  return output;
};
MIT License

Copyright (c) 2012 Another-D-Mention Software and other contributors

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
const Utils = require("./util");
const pth = require("path");
const ZipEntry = require("./zipEntry");
const ZipFile = require("./zipFile");

const get_Bool = (...val) => Utils.findLast(val, (c) => typeof c === "boolean");
const get_Str = (...val) => Utils.findLast(val, (c) => typeof c === "string");
const get_Fun = (...val) => Utils.findLast(val, (c) => typeof c === "function");

const defaultOptions = {
    // option "noSort" : if true it disables files sorting
    noSort: false,
    // read entries during load (initial loading may be slower)
    readEntries: false,
    // default method is none
    method: Utils.Constants.NONE,
    // file system
    fs: null
};

module.exports = function (/**String*/ input, /** object */ options) {
    let inBuffer = null;

    // create object based default options, allowing them to be overwritten
    const opts = Object.assign(Object.create(null), defaultOptions);

    // test input variable
    if (input && "object" === typeof input) {
        // if value is not buffer we accept it to be object with options
        if (!(input instanceof Uint8Array)) {
            Object.assign(opts, input);
            input = opts.input ? opts.input : undefined;
            if (opts.input) delete opts.input;
        }

        // if input is buffer
        if (Buffer.isBuffer(input)) {
            inBuffer = input;
            opts.method = Utils.Constants.BUFFER;
            input = undefined;
        }
    }

    // assign options
    Object.assign(opts, options);

    // instanciate utils filesystem
    const filetools = new Utils(opts);

    if (typeof opts.decoder !== "object" || typeof opts.decoder.encode !== "function" || typeof opts.decoder.decode !== "function") {
        opts.decoder = Utils.decoder;
    }

    // if input is file name we retrieve its content
    if (input && "string" === typeof input) {
        // load zip file
        if (filetools.fs.existsSync(input)) {
            opts.method = Utils.Constants.FILE;
            opts.filename = input;
            inBuffer = filetools.fs.readFileSync(input);
        } else {
            throw Utils.Errors.INVALID_FILENAME();
        }
    }

    // create variable
    const _zip = new ZipFile(inBuffer, opts);

    const { canonical, sanitize, zipnamefix } = Utils;

    function getEntry(/**Object*/ entry) {
        if (entry && _zip) {
            var item;
            // If entry was given as a file name
            if (typeof entry === "string") item = _zip.getEntry(pth.posix.normalize(entry));
            // if entry was given as a ZipEntry object
            if (typeof entry === "object" && typeof entry.entryName !== "undefined" && typeof entry.header !== "undefined") item = _zip.getEntry(entry.entryName);

            if (item) {
                return item;
            }
        }
        return null;
    }

    function fixPath(zipPath) {
        const { join, normalize, sep } = pth.posix;
        // convert windows file separators and normalize
        return join(".", normalize(sep + zipPath.split("\\").join(sep) + sep));
    }

    function filenameFilter(filterfn) {
        if (filterfn instanceof RegExp) {
            // if filter is RegExp wrap it
            return (function (rx) {
                return function (filename) {
                    return rx.test(filename);
                };
            })(filterfn);
        } else if ("function" !== typeof filterfn) {
            // if filter is not function we will replace it
            return () => true;
        }
        return filterfn;
    }

    // keep last character on folders
    const relativePath = (local, entry) => {
        let lastChar = entry.slice(-1);
        lastChar = lastChar === filetools.sep ? filetools.sep : "";
        return pth.relative(local, entry) + lastChar;
    };

    return {
        /**
         * Extracts the given entry from the archive and returns the content as a Buffer object
         * @param {ZipEntry|string} entry ZipEntry object or String with the full path of the entry
         * @param {Buffer|string} [pass] - password
         * @return Buffer or Null in case of error
         */
        readFile: function (entry, pass) {
            var item = getEntry(entry);
            return (item && item.getData(pass)) || null;
        },

        /**
         * Returns how many child elements has on entry (directories) on files it is always 0
         * @param {ZipEntry|string} entry ZipEntry object or String with the full path of the entry
         * @returns {integer}
         */
        childCount: function (entry) {
            const item = getEntry(entry);
            if (item) {
                return _zip.getChildCount(item);
            }
        },

        /**
         * Asynchronous readFile
         * @param {ZipEntry|string} entry ZipEntry object or String with the full path of the entry
         * @param {callback} callback
         *
         * @return Buffer or Null in case of error
         */
        readFileAsync: function (entry, callback) {
            var item = getEntry(entry);
            if (item) {
                item.getDataAsync(callback);
            } else {
                callback(null, "getEntry failed for:" + entry);
            }
        },

        /**
         * Extracts the given entry from the archive and returns the content as plain text in the given encoding
         * @param {ZipEntry|string} entry - ZipEntry object or String with the full path of the entry
         * @param {string} encoding - Optional. If no encoding is specified utf8 is used
         *
         * @return String
         */
        readAsText: function (entry, encoding) {
            var item = getEntry(entry);
            if (item) {
                var data = item.getData();
                if (data && data.length) {
                    return data.toString(encoding || "utf8");
                }
            }
            return "";
        },

        /**
         * Asynchronous readAsText
         * @param {ZipEntry|string} entry ZipEntry object or String with the full path of the entry
         * @param {callback} callback
         * @param {string} [encoding] - Optional. If no encoding is specified utf8 is used
         *
         * @return String
         */
        readAsTextAsync: function (entry, callback, encoding) {
            var item = getEntry(entry);
            if (item) {
                item.getDataAsync(function (data, err) {
                    if (err) {
                        callback(data, err);
                        return;
                    }

                    if (data && data.length) {
                        callback(data.toString(encoding || "utf8"));
                    } else {
                        callback("");
                    }
                });
            } else {
                callback("");
            }
        },

        /**
         * Remove the entry from the file or the entry and all it's nested directories and files if the given entry is a directory
         *
         * @param {ZipEntry|string} entry
         * @returns {void}
         */
        deleteFile: function (entry, withsubfolders = true) {
            // @TODO: test deleteFile
            var item = getEntry(entry);
            if (item) {
                _zip.deleteFile(item.entryName, withsubfolders);
            }
        },

        /**
         * Remove the entry from the file or directory without affecting any nested entries
         *
         * @param {ZipEntry|string} entry
         * @returns {void}
         */
        deleteEntry: function (entry) {
            // @TODO: test deleteEntry
            var item = getEntry(entry);
            if (item) {
                _zip.deleteEntry(item.entryName);
            }
        },

        /**
         * Adds a comment to the zip. The zip must be rewritten after adding the comment.
         *
         * @param {string} comment
         */
        addZipComment: function (comment) {
            // @TODO: test addZipComment
            _zip.comment = comment;
        },

        /**
         * Returns the zip comment
         *
         * @return String
         */
        getZipComment: function () {
            return _zip.comment || "";
        },

        /**
         * Adds a comment to a specified zipEntry. The zip must be rewritten after adding the comment
         * The comment cannot exceed 65535 characters in length
         *
         * @param {ZipEntry} entry
         * @param {string} comment
         */
        addZipEntryComment: function (entry, comment) {
            var item = getEntry(entry);
            if (item) {
                item.comment = comment;
            }
        },

        /**
         * Returns the comment of the specified entry
         *
         * @param {ZipEntry} entry
         * @return String
         */
        getZipEntryComment: function (entry) {
            var item = getEntry(entry);
            if (item) {
                return item.comment || "";
            }
            return "";
        },

        /**
         * Updates the content of an existing entry inside the archive. The zip must be rewritten after updating the content
         *
         * @param {ZipEntry} entry
         * @param {Buffer} content
         */
        updateFile: function (entry, content) {
            var item = getEntry(entry);
            if (item) {
                item.setData(content);
            }
        },

        /**
         * Adds a file from the disk to the archive
         *
         * @param {string} localPath File to add to zip
         * @param {string} [zipPath] Optional path inside the zip
         * @param {string} [zipName] Optional name for the file
         * @param {string} [comment] Optional file comment
         */
        addLocalFile: function (localPath, zipPath, zipName, comment) {
            if (filetools.fs.existsSync(localPath)) {
                // fix ZipPath
                zipPath = zipPath ? fixPath(zipPath) : "";

                // p - local file name
                const p = pth.win32.basename(pth.win32.normalize(localPath));

                // add file name into zippath
                zipPath += zipName ? zipName : p;

                // read file attributes
                const _attr = filetools.fs.statSync(localPath);

                // get file content
                const data = _attr.isFile() ? filetools.fs.readFileSync(localPath) : Buffer.alloc(0);

                // if folder
                if (_attr.isDirectory()) zipPath += filetools.sep;

                // add file into zip file
                this.addFile(zipPath, data, comment, _attr);
            } else {
                throw Utils.Errors.FILE_NOT_FOUND(localPath);
            }
        },

        /**
         * Callback for showing if everything was done.
         *
         * @callback doneCallback
         * @param {Error} err - Error object
         * @param {boolean} done - was request fully completed
         */

        /**
         * Adds a file from the disk to the archive
         *
         * @param {(object|string)} options - options object, if it is string it us used as localPath.
         * @param {string} options.localPath - Local path to the file.
         * @param {string} [options.comment] - Optional file comment.
         * @param {string} [options.zipPath] - Optional path inside the zip
         * @param {string} [options.zipName] - Optional name for the file
         * @param {doneCallback} callback - The callback that handles the response.
         */
        addLocalFileAsync: function (options, callback) {
            options = typeof options === "object" ? options : { localPath: options };
            const localPath = pth.resolve(options.localPath);
            const { comment } = options;
            let { zipPath, zipName } = options;
            const self = this;

            filetools.fs.stat(localPath, function (err, stats) {
                if (err) return callback(err, false);
                // fix ZipPath
                zipPath = zipPath ? fixPath(zipPath) : "";
                // p - local file name
                const p = pth.win32.basename(pth.win32.normalize(localPath));
                // add file name into zippath
                zipPath += zipName ? zipName : p;

                if (stats.isFile()) {
                    filetools.fs.readFile(localPath, function (err, data) {
                        if (err) return callback(err, false);
                        self.addFile(zipPath, data, comment, stats);
                        return setImmediate(callback, undefined, true);
                    });
                } else if (stats.isDirectory()) {
                    zipPath += filetools.sep;
                    self.addFile(zipPath, Buffer.alloc(0), comment, stats);
                    return setImmediate(callback, undefined, true);
                }
            });
        },

        /**
         * Adds a local directory and all its nested files and directories to the archive
         *
         * @param {string} localPath - local path to the folder
         * @param {string} [zipPath] - optional path inside zip
         * @param {(RegExp|function)} [filter] - optional RegExp or Function if files match will be included.
         */
        addLocalFolder: function (localPath, zipPath, filter) {
            // Prepare filter
            filter = filenameFilter(filter);

            // fix ZipPath
            zipPath = zipPath ? fixPath(zipPath) : "";

            // normalize the path first
            localPath = pth.normalize(localPath);

            if (filetools.fs.existsSync(localPath)) {
                const items = filetools.findFiles(localPath);
                const self = this;

                if (items.length) {
                    for (const filepath of items) {
                        const p = pth.join(zipPath, relativePath(localPath, filepath));
                        if (filter(p)) {
                            self.addLocalFile(filepath, pth.dirname(p));
                        }
                    }
                }
            } else {
                throw Utils.Errors.FILE_NOT_FOUND(localPath);
            }
        },

        /**
         * Asynchronous addLocalFolder
         * @param {string} localPath
         * @param {callback} callback
         * @param {string} [zipPath] optional path inside zip
         * @param {RegExp|function} [filter] optional RegExp or Function if files match will
         *               be included.
         */
        addLocalFolderAsync: function (localPath, callback, zipPath, filter) {
            // Prepare filter
            filter = filenameFilter(filter);

            // fix ZipPath
            zipPath = zipPath ? fixPath(zipPath) : "";

            // normalize the path first
            localPath = pth.normalize(localPath);

            var self = this;
            filetools.fs.open(localPath, "r", function (err) {
                if (err && err.code === "ENOENT") {
                    callback(undefined, Utils.Errors.FILE_NOT_FOUND(localPath));
                } else if (err) {
                    callback(undefined, err);
                } else {
                    var items = filetools.findFiles(localPath);
                    var i = -1;

                    var next = function () {
                        i += 1;
                        if (i < items.length) {
                            var filepath = items[i];
                            var p = relativePath(localPath, filepath).split("\\").join("/"); //windows fix
                            p = p
                                .normalize("NFD")
                                .replace(/[\u0300-\u036f]/g, "")
                                .replace(/[^\x20-\x7E]/g, ""); // accent fix
                            if (filter(p)) {
                                filetools.fs.stat(filepath, function (er0, stats) {
                                    if (er0) callback(undefined, er0);
                                    if (stats.isFile()) {
                                        filetools.fs.readFile(filepath, function (er1, data) {
                                            if (er1) {
                                                callback(undefined, er1);
                                            } else {
                                                self.addFile(zipPath + p, data, "", stats);
                                                next();
                                            }
                                        });
                                    } else {
                                        self.addFile(zipPath + p + "/", Buffer.alloc(0), "", stats);
                                        next();
                                    }
                                });
                            } else {
                                process.nextTick(() => {
                                    next();
                                });
                            }
                        } else {
                            callback(true, undefined);
                        }
                    };

                    next();
                }
            });
        },

        /**
         * Adds a local directory and all its nested files and directories to the archive
         *
         * @param {object | string} options - options object, if it is string it us used as localPath.
         * @param {string} options.localPath - Local path to the folder.
         * @param {string} [options.zipPath] - optional path inside zip.
         * @param {RegExp|function} [options.filter] - optional RegExp or Function if files match will be included.
         * @param {function|string} [options.namefix] - optional function to help fix filename
         * @param {doneCallback} callback - The callback that handles the response.
         *
         */
        addLocalFolderAsync2: function (options, callback) {
            const self = this;
            options = typeof options === "object" ? options : { localPath: options };
            localPath = pth.resolve(fixPath(options.localPath));
            let { zipPath, filter, namefix } = options;

            if (filter instanceof RegExp) {
                filter = (function (rx) {
                    return function (filename) {
                        return rx.test(filename);
                    };
                })(filter);
            } else if ("function" !== typeof filter) {
                filter = function () {
                    return true;
                };
            }

            // fix ZipPath
            zipPath = zipPath ? fixPath(zipPath) : "";

            // Check Namefix function
            if (namefix == "latin1") {
                namefix = (str) =>
                    str
                        .normalize("NFD")
                        .replace(/[\u0300-\u036f]/g, "")
                        .replace(/[^\x20-\x7E]/g, ""); // accent fix (latin1 characers only)
            }

            if (typeof namefix !== "function") namefix = (str) => str;

            // internal, create relative path + fix the name
            const relPathFix = (entry) => pth.join(zipPath, namefix(relativePath(localPath, entry)));
            const fileNameFix = (entry) => pth.win32.basename(pth.win32.normalize(namefix(entry)));

            filetools.fs.open(localPath, "r", function (err) {
                if (err && err.code === "ENOENT") {
                    callback(undefined, Utils.Errors.FILE_NOT_FOUND(localPath));
                } else if (err) {
                    callback(undefined, err);
                } else {
                    filetools.findFilesAsync(localPath, function (err, fileEntries) {
                        if (err) return callback(err);
                        fileEntries = fileEntries.filter((dir) => filter(relPathFix(dir)));
                        if (!fileEntries.length) callback(undefined, false);

                        setImmediate(
                            fileEntries.reverse().reduce(function (next, entry) {
                                return function (err, done) {
                                    if (err || done === false) return setImmediate(next, err, false);

                                    self.addLocalFileAsync(
                                        {
                                            localPath: entry,
                                            zipPath: pth.dirname(relPathFix(entry)),
                                            zipName: fileNameFix(entry)
                                        },
                                        next
                                    );
                                };
                            }, callback)
                        );
                    });
                }
            });
        },

        /**
         * Adds a local directory and all its nested files and directories to the archive
         *
         * @param {string} localPath - path where files will be extracted
         * @param {object} props - optional properties
         * @param {string} [props.zipPath] - optional path inside zip
         * @param {RegExp|function} [props.filter] - optional RegExp or Function if files match will be included.
         * @param {function|string} [props.namefix] - optional function to help fix filename
         */
        addLocalFolderPromise: function (localPath, props) {
            return new Promise((resolve, reject) => {
                this.addLocalFolderAsync2(Object.assign({ localPath }, props), (err, done) => {
                    if (err) reject(err);
                    if (done) resolve(this);
                });
            });
        },

        /**
         * Allows you to create a entry (file or directory) in the zip file.
         * If you want to create a directory the entryName must end in / and a null buffer should be provided.
         * Comment and attributes are optional
         *
         * @param {string} entryName
         * @param {Buffer | string} content - file content as buffer or utf8 coded string
         * @param {string} [comment] - file comment
         * @param {number | object} [attr] - number as unix file permissions, object as filesystem Stats object
         */
        addFile: function (entryName, content, comment, attr) {
            entryName = zipnamefix(entryName);
            let entry = getEntry(entryName);
            const update = entry != null;

            // prepare new entry
            if (!update) {
                entry = new ZipEntry(opts);
                entry.entryName = entryName;
            }
            entry.comment = comment || "";

            const isStat = "object" === typeof attr && attr instanceof filetools.fs.Stats;

            // last modification time from file stats
            if (isStat) {
                entry.header.time = attr.mtime;
            }

            // Set file attribute
            var fileattr = entry.isDirectory ? 0x10 : 0; // (MS-DOS directory flag)

            // extended attributes field for Unix
            // set file type either S_IFDIR / S_IFREG
            let unix = entry.isDirectory ? 0x4000 : 0x8000;

            if (isStat) {
                // File attributes from file stats
                unix |= 0xfff & attr.mode;
            } else if ("number" === typeof attr) {
                // attr from given attr values
                unix |= 0xfff & attr;
            } else {
                // Default values:
                unix |= entry.isDirectory ? 0o755 : 0o644; // permissions (drwxr-xr-x) or (-r-wr--r--)
            }

            fileattr = (fileattr | (unix << 16)) >>> 0; // add attributes

            entry.attr = fileattr;

            entry.setData(content);
            if (!update) _zip.setEntry(entry);

            return entry;
        },

        /**
         * Returns an array of ZipEntry objects representing the files and folders inside the archive
         *
         * @param {string} [password]
         * @returns Array
         */
        getEntries: function (password) {
            _zip.password = password;
            return _zip ? _zip.entries : [];
        },

        /**
         * Returns a ZipEntry object representing the file or folder specified by ``name``.
         *
         * @param {string} name
         * @return ZipEntry
         */
        getEntry: function (/**String*/ name) {
            return getEntry(name);
        },

        getEntryCount: function () {
            return _zip.getEntryCount();
        },

        forEach: function (callback) {
            return _zip.forEach(callback);
        },

        /**
         * Extracts the given entry to the given targetPath
         * If the entry is a directory inside the archive, the entire directory and it's subdirectories will be extracted
         *
         * @param {string|ZipEntry} entry - ZipEntry object or String with the full path of the entry
         * @param {string} targetPath - Target folder where to write the file
         * @param {boolean} [maintainEntryPath=true] - If maintainEntryPath is true and the entry is inside a folder, the entry folder will be created in targetPath as well. Default is TRUE
         * @param {boolean} [overwrite=false] - If the file already exists at the target path, the file will be overwriten if this is true.
         * @param {boolean} [keepOriginalPermission=false] - The file will be set as the permission from the entry if this is true.
         * @param {string} [outFileName] - String If set will override the filename of the extracted file (Only works if the entry is a file)
         *
         * @return Boolean
         */
        extractEntryTo: function (entry, targetPath, maintainEntryPath, overwrite, keepOriginalPermission, outFileName) {
            overwrite = get_Bool(false, overwrite);
            keepOriginalPermission = get_Bool(false, keepOriginalPermission);
            maintainEntryPath = get_Bool(true, maintainEntryPath);
            outFileName = get_Str(keepOriginalPermission, outFileName);

            var item = getEntry(entry);
            if (!item) {
                throw Utils.Errors.NO_ENTRY();
            }

            var entryName = canonical(item.entryName);

            var target = sanitize(targetPath, outFileName && !item.isDirectory ? outFileName : maintainEntryPath ? entryName : pth.basename(entryName));

            if (item.isDirectory) {
                var children = _zip.getEntryChildren(item);
                children.forEach(function (child) {
                    if (child.isDirectory) return;
                    var content = child.getData();
                    if (!content) {
                        throw Utils.Errors.CANT_EXTRACT_FILE();
                    }
                    var name = canonical(child.entryName);
                    var childName = sanitize(targetPath, maintainEntryPath ? name : pth.basename(name));
                    // The reverse operation for attr depend on method addFile()
                    const fileAttr = keepOriginalPermission ? child.header.fileAttr : undefined;
                    filetools.writeFileTo(childName, content, overwrite, fileAttr);
                });
                return true;
            }

            var content = item.getData(_zip.password);
            if (!content) throw Utils.Errors.CANT_EXTRACT_FILE();

            if (filetools.fs.existsSync(target) && !overwrite) {
                throw Utils.Errors.CANT_OVERRIDE();
            }
            // The reverse operation for attr depend on method addFile()
            const fileAttr = keepOriginalPermission ? entry.header.fileAttr : undefined;
            filetools.writeFileTo(target, content, overwrite, fileAttr);

            return true;
        },

        /**
         * Test the archive
         * @param {string} [pass]
         */
        test: function (pass) {
            if (!_zip) {
                return false;
            }

            for (var entry in _zip.entries) {
                try {
                    if (entry.isDirectory) {
                        continue;
                    }
                    var content = _zip.entries[entry].getData(pass);
                    if (!content) {
                        return false;
                    }
                } catch (err) {
                    return false;
                }
            }
            return true;
        },

        /**
         * Extracts the entire archive to the given location
         *
         * @param {string} targetPath Target location
         * @param {boolean} [overwrite=false] If the file already exists at the target path, the file will be overwriten if this is true.
         *                  Default is FALSE
         * @param {boolean} [keepOriginalPermission=false] The file will be set as the permission from the entry if this is true.
         *                  Default is FALSE
         * @param {string|Buffer} [pass] password
         */
        extractAllTo: function (targetPath, overwrite, keepOriginalPermission, pass) {
            keepOriginalPermission = get_Bool(false, keepOriginalPermission);
            pass = get_Str(keepOriginalPermission, pass);
            overwrite = get_Bool(false, overwrite);
            if (!_zip) throw Utils.Errors.NO_ZIP();

            _zip.entries.forEach(function (entry) {
                var entryName = sanitize(targetPath, canonical(entry.entryName));
                if (entry.isDirectory) {
                    filetools.makeDir(entryName);
                    return;
                }
                var content = entry.getData(pass);
                if (!content) {
                    throw Utils.Errors.CANT_EXTRACT_FILE();
                }
                // The reverse operation for attr depend on method addFile()
                const fileAttr = keepOriginalPermission ? entry.header.fileAttr : undefined;
                filetools.writeFileTo(entryName, content, overwrite, fileAttr);
                try {
                    filetools.fs.utimesSync(entryName, entry.header.time, entry.header.time);
                } catch (err) {
                    throw Utils.Errors.CANT_EXTRACT_FILE();
                }
            });
        },

        /**
         * Asynchronous extractAllTo
         *
         * @param {string} targetPath Target location
         * @param {boolean} [overwrite=false] If the file already exists at the target path, the file will be overwriten if this is true.
         *                  Default is FALSE
         * @param {boolean} [keepOriginalPermission=false] The file will be set as the permission from the entry if this is true.
         *                  Default is FALSE
         * @param {function} callback The callback will be executed when all entries are extracted successfully or any error is thrown.
         */
        extractAllToAsync: function (targetPath, overwrite, keepOriginalPermission, callback) {
            callback = get_Fun(overwrite, keepOriginalPermission, callback);
            keepOriginalPermission = get_Bool(false, keepOriginalPermission);
            overwrite = get_Bool(false, overwrite);
            if (!callback) {
                return new Promise((resolve, reject) => {
                    this.extractAllToAsync(targetPath, overwrite, keepOriginalPermission, function (err) {
                        if (err) {
                            reject(err);
                        } else {
                            resolve(this);
                        }
                    });
                });
            }
            if (!_zip) {
                callback(Utils.Errors.NO_ZIP());
                return;
            }

            targetPath = pth.resolve(targetPath);
            // convert entryName to
            const getPath = (entry) => sanitize(targetPath, pth.normalize(canonical(entry.entryName)));
            const getError = (msg, file) => new Error(msg + ': "' + file + '"');

            // separate directories from files
            const dirEntries = [];
            const fileEntries = [];
            _zip.entries.forEach((e) => {
                if (e.isDirectory) {
                    dirEntries.push(e);
                } else {
                    fileEntries.push(e);
                }
            });

            // Create directory entries first synchronously
            // this prevents race condition and assures folders are there before writing files
            for (const entry of dirEntries) {
                const dirPath = getPath(entry);
                // The reverse operation for attr depend on method addFile()
                const dirAttr = keepOriginalPermission ? entry.header.fileAttr : undefined;
                try {
                    filetools.makeDir(dirPath);
                    if (dirAttr) filetools.fs.chmodSync(dirPath, dirAttr);
                    // in unix timestamp will change if files are later added to folder, but still
                    filetools.fs.utimesSync(dirPath, entry.header.time, entry.header.time);
                } catch (er) {
                    callback(getError("Unable to create folder", dirPath));
                }
            }

            fileEntries.reverse().reduce(function (next, entry) {
                return function (err) {
                    if (err) {
                        next(err);
                    } else {
                        const entryName = pth.normalize(canonical(entry.entryName));
                        const filePath = sanitize(targetPath, entryName);
                        entry.getDataAsync(function (content, err_1) {
                            if (err_1) {
                                next(err_1);
                            } else if (!content) {
                                next(Utils.Errors.CANT_EXTRACT_FILE());
                            } else {
                                // The reverse operation for attr depend on method addFile()
                                const fileAttr = keepOriginalPermission ? entry.header.fileAttr : undefined;
                                filetools.writeFileToAsync(filePath, content, overwrite, fileAttr, function (succ) {
                                    if (!succ) {
                                        next(getError("Unable to write file", filePath));
                                    }
                                    filetools.fs.utimes(filePath, entry.header.time, entry.header.time, function (err_2) {
                                        if (err_2) {
                                            next(getError("Unable to set times", filePath));
                                        } else {
                                            next();
                                        }
                                    });
                                });
                            }
                        });
                    }
                };
            }, callback)();
        },

        /**
         * Writes the newly created zip file to disk at the specified location or if a zip was opened and no ``targetFileName`` is provided, it will overwrite the opened zip
         *
         * @param {string} targetFileName
         * @param {function} callback
         */
        writeZip: function (targetFileName, callback) {
            if (arguments.length === 1) {
                if (typeof targetFileName === "function") {
                    callback = targetFileName;
                    targetFileName = "";
                }
            }

            if (!targetFileName && opts.filename) {
                targetFileName = opts.filename;
            }
            if (!targetFileName) return;

            var zipData = _zip.compressToBuffer();
            if (zipData) {
                var ok = filetools.writeFileTo(targetFileName, zipData, true);
                if (typeof callback === "function") callback(!ok ? new Error("failed") : null, "");
            }
        },

        /**
         *
         * @param {string} targetFileName
         * @param {object} [props]
         * @param {boolean} [props.overwrite=true] If the file already exists at the target path, the file will be overwriten if this is true.
         * @param {boolean} [props.perm] The file will be set as the permission from the entry if this is true.

         * @returns {Promise<void>}
         */
        writeZipPromise: function (/**String*/ targetFileName, /* object */ props) {
            const { overwrite, perm } = Object.assign({ overwrite: true }, props);

            return new Promise((resolve, reject) => {
                // find file name
                if (!targetFileName && opts.filename) targetFileName = opts.filename;
                if (!targetFileName) reject("ADM-ZIP: ZIP File Name Missing");

                this.toBufferPromise().then((zipData) => {
                    const ret = (done) => (done ? resolve(done) : reject("ADM-ZIP: Wasn't able to write zip file"));
                    filetools.writeFileToAsync(targetFileName, zipData, overwrite, perm, ret);
                }, reject);
            });
        },

        /**
         * @returns {Promise<Buffer>} A promise to the Buffer.
         */
        toBufferPromise: function () {
            return new Promise((resolve, reject) => {
                _zip.toAsyncBuffer(resolve, reject);
            });
        },

        /**
         * Returns the content of the entire zip file as a Buffer object
         *
         * @prop {function} [onSuccess]
         * @prop {function} [onFail]
         * @prop {function} [onItemStart]
         * @prop {function} [onItemEnd]
         * @returns {Buffer}
         */
        toBuffer: function (onSuccess, onFail, onItemStart, onItemEnd) {
            if (typeof onSuccess === "function") {
                _zip.toAsyncBuffer(onSuccess, onFail, onItemStart, onItemEnd);
                return null;
            }
            return _zip.compressToBuffer();
        }
    };
};
{
  "name": "adm-zip",
  "version": "0.5.16",
  "description": "Javascript implementation of zip for nodejs with support for electron original-fs. Allows user to create or extract zip files both in memory or to/from disk",
  "homepage": "https://github.com/cthackers/adm-zip",
  "author": "Nasca Iacob <sy@another-d-mention.ro> (https://github.com/cthackers)",
  "license": "MIT",
  "files": [
    "adm-zip.js",
    "headers",
    "methods",
    "util",
    "zipEntry.js",
    "zipFile.js",
    "LICENSE"
  ],
  "main": "adm-zip.js",
  "repository": {
    "type": "git",
    "url": "https://github.com/cthackers/adm-zip.git"
  },
  "engines": {
    "node": ">=12.0"
  },
  "devDependencies": {
    "chai": "^4.3.4",
    "iconv-lite": "^0.6.3",
    "mocha": "^10.2.0",
    "prettier": "^3.3.2",
    "rimraf": "^3.0.2"
  }
}var Utils = require("./util"),
    Headers = require("./headers"),
    Constants = Utils.Constants,
    Methods = require("./methods");

module.exports = function (/** object */ options, /*Buffer*/ input) {
    var _centralHeader = new Headers.EntryHeader(),
        _entryName = Buffer.alloc(0),
        _comment = Buffer.alloc(0),
        _isDirectory = false,
        uncompressedData = null,
        _extra = Buffer.alloc(0),
        _extralocal = Buffer.alloc(0),
        _efs = true;

    // assign options
    const opts = options;

    const decoder = typeof opts.decoder === "object" ? opts.decoder : Utils.decoder;
    _efs = decoder.hasOwnProperty("efs") ? decoder.efs : false;

    function getCompressedDataFromZip() {
        //if (!input || !Buffer.isBuffer(input)) {
        if (!input || !(input instanceof Uint8Array)) {
            return Buffer.alloc(0);
        }
        _extralocal = _centralHeader.loadLocalHeaderFromBinary(input);
        return input.slice(_centralHeader.realDataOffset, _centralHeader.realDataOffset + _centralHeader.compressedSize);
    }

    function crc32OK(data) {
        // if bit 3 (0x08) of the general-purpose flags field is set, then the CRC-32 and file sizes are not known when the local header is written
        if (!_centralHeader.flags_desc) {
            if (Utils.crc32(data) !== _centralHeader.localHeader.crc) {
                return false;
            }
        } else {
            const descriptor = {};
            const dataEndOffset = _centralHeader.realDataOffset + _centralHeader.compressedSize;
            // no descriptor after compressed data, instead new local header
            if (input.readUInt32LE(dataEndOffset) == Constants.LOCSIG || input.readUInt32LE(dataEndOffset) == Constants.CENSIG) {
                throw Utils.Errors.DESCRIPTOR_NOT_EXIST();
            }

            // get decriptor data
            if (input.readUInt32LE(dataEndOffset) == Constants.EXTSIG) {
                // descriptor with signature
                descriptor.crc = input.readUInt32LE(dataEndOffset + Constants.EXTCRC);
                descriptor.compressedSize = input.readUInt32LE(dataEndOffset + Constants.EXTSIZ);
                descriptor.size = input.readUInt32LE(dataEndOffset + Constants.EXTLEN);
            } else if (input.readUInt16LE(dataEndOffset + 12) === 0x4b50) {
                // descriptor without signature (we check is new header starting where we expect)
                descriptor.crc = input.readUInt32LE(dataEndOffset + Constants.EXTCRC - 4);
                descriptor.compressedSize = input.readUInt32LE(dataEndOffset + Constants.EXTSIZ - 4);
                descriptor.size = input.readUInt32LE(dataEndOffset + Constants.EXTLEN - 4);
            } else {
                throw Utils.Errors.DESCRIPTOR_UNKNOWN();
            }

            // check data integrity
            if (descriptor.compressedSize !== _centralHeader.compressedSize || descriptor.size !== _centralHeader.size || descriptor.crc !== _centralHeader.crc) {
                throw Utils.Errors.DESCRIPTOR_FAULTY();
            }
            if (Utils.crc32(data) !== descriptor.crc) {
                return false;
            }

            // @TODO: zip64 bit descriptor fields
            // if bit 3 is set and any value in local header "zip64 Extended information" extra field are set 0 (place holder)
            // then 64-bit descriptor format is used instead of 32-bit
            // central header - "zip64 Extended information" extra field should store real values and not place holders
        }
        return true;
    }

    function decompress(/*Boolean*/ async, /*Function*/ callback, /*String, Buffer*/ pass) {
        if (typeof callback === "undefined" && typeof async === "string") {
            pass = async;
            async = void 0;
        }
        if (_isDirectory) {
            if (async && callback) {
                callback(Buffer.alloc(0), Utils.Errors.DIRECTORY_CONTENT_ERROR()); //si added error.
            }
            return Buffer.alloc(0);
        }

        var compressedData = getCompressedDataFromZip();

        if (compressedData.length === 0) {
            // File is empty, nothing to decompress.
            if (async && callback) callback(compressedData);
            return compressedData;
        }

        if (_centralHeader.encrypted) {
            if ("string" !== typeof pass && !Buffer.isBuffer(pass)) {
                throw Utils.Errors.INVALID_PASS_PARAM();
            }
            compressedData = Methods.ZipCrypto.decrypt(compressedData, _centralHeader, pass);
        }

        var data = Buffer.alloc(_centralHeader.size);

        switch (_centralHeader.method) {
            case Utils.Constants.STORED:
                compressedData.copy(data);
                if (!crc32OK(data)) {
                    if (async && callback) callback(data, Utils.Errors.BAD_CRC()); //si added error
                    throw Utils.Errors.BAD_CRC();
                } else {
                    //si added otherwise did not seem to return data.
                    if (async && callback) callback(data);
                    return data;
                }
            case Utils.Constants.DEFLATED:
                var inflater = new Methods.Inflater(compressedData, _centralHeader.size);
                if (!async) {
                    const result = inflater.inflate(data);
                    result.copy(data, 0);
                    if (!crc32OK(data)) {
                        throw Utils.Errors.BAD_CRC(`"${decoder.decode(_entryName)}"`);
                    }
                    return data;
                } else {
                    inflater.inflateAsync(function (result) {
                        result.copy(result, 0);
                        if (callback) {
                            if (!crc32OK(result)) {
                                callback(result, Utils.Errors.BAD_CRC()); //si added error
                            } else {
                                callback(result);
                            }
                        }
                    });
                }
                break;
            default:
                if (async && callback) callback(Buffer.alloc(0), Utils.Errors.UNKNOWN_METHOD());
                throw Utils.Errors.UNKNOWN_METHOD();
        }
    }

    function compress(/*Boolean*/ async, /*Function*/ callback) {
        if ((!uncompressedData || !uncompressedData.length) && Buffer.isBuffer(input)) {
            // no data set or the data wasn't changed to require recompression
            if (async && callback) callback(getCompressedDataFromZip());
            return getCompressedDataFromZip();
        }

        if (uncompressedData.length && !_isDirectory) {
            var compressedData;
            // Local file header
            switch (_centralHeader.method) {
                case Utils.Constants.STORED:
                    _centralHeader.compressedSize = _centralHeader.size;

                    compressedData = Buffer.alloc(uncompressedData.length);
                    uncompressedData.copy(compressedData);

                    if (async && callback) callback(compressedData);
                    return compressedData;
                default:
                case Utils.Constants.DEFLATED:
                    var deflater = new Methods.Deflater(uncompressedData);
                    if (!async) {
                        var deflated = deflater.deflate();
                        _centralHeader.compressedSize = deflated.length;
                        return deflated;
                    } else {
                        deflater.deflateAsync(function (data) {
                            compressedData = Buffer.alloc(data.length);
                            _centralHeader.compressedSize = data.length;
                            data.copy(compressedData);
                            callback && callback(compressedData);
                        });
                    }
                    deflater = null;
                    break;
            }
        } else if (async && callback) {
            callback(Buffer.alloc(0));
        } else {
            return Buffer.alloc(0);
        }
    }

    function readUInt64LE(buffer, offset) {
        return (buffer.readUInt32LE(offset + 4) << 4) + buffer.readUInt32LE(offset);
    }

    function parseExtra(data) {
        try {
            var offset = 0;
            var signature, size, part;
            while (offset + 4 < data.length) {
                signature = data.readUInt16LE(offset);
                offset += 2;
                size = data.readUInt16LE(offset);
                offset += 2;
                part = data.slice(offset, offset + size);
                offset += size;
                if (Constants.ID_ZIP64 === signature) {
                    parseZip64ExtendedInformation(part);
                }
            }
        } catch (error) {
            throw Utils.Errors.EXTRA_FIELD_PARSE_ERROR();
        }
    }

    //Override header field values with values from the ZIP64 extra field
    function parseZip64ExtendedInformation(data) {
        var size, compressedSize, offset, diskNumStart;

        if (data.length >= Constants.EF_ZIP64_SCOMP) {
            size = readUInt64LE(data, Constants.EF_ZIP64_SUNCOMP);
            if (_centralHeader.size === Constants.EF_ZIP64_OR_32) {
                _centralHeader.size = size;
            }
        }
        if (data.length >= Constants.EF_ZIP64_RHO) {
            compressedSize = readUInt64LE(data, Constants.EF_ZIP64_SCOMP);
            if (_centralHeader.compressedSize === Constants.EF_ZIP64_OR_32) {
                _centralHeader.compressedSize = compressedSize;
            }
        }
        if (data.length >= Constants.EF_ZIP64_DSN) {
            offset = readUInt64LE(data, Constants.EF_ZIP64_RHO);
            if (_centralHeader.offset === Constants.EF_ZIP64_OR_32) {
                _centralHeader.offset = offset;
            }
        }
        if (data.length >= Constants.EF_ZIP64_DSN + 4) {
            diskNumStart = data.readUInt32LE(Constants.EF_ZIP64_DSN);
            if (_centralHeader.diskNumStart === Constants.EF_ZIP64_OR_16) {
                _centralHeader.diskNumStart = diskNumStart;
            }
        }
    }

    return {
        get entryName() {
            return decoder.decode(_entryName);
        },
        get rawEntryName() {
            return _entryName;
        },
        set entryName(val) {
            _entryName = Utils.toBuffer(val, decoder.encode);
            var lastChar = _entryName[_entryName.length - 1];
            _isDirectory = lastChar === 47 || lastChar === 92;
            _centralHeader.fileNameLength = _entryName.length;
        },

        get efs() {
            if (typeof _efs === "function") {
                return _efs(this.entryName);
            } else {
                return _efs;
            }
        },

        get extra() {
            return _extra;
        },
        set extra(val) {
            _extra = val;
            _centralHeader.extraLength = val.length;
            parseExtra(val);
        },

        get comment() {
            return decoder.decode(_comment);
        },
        set comment(val) {
            _comment = Utils.toBuffer(val, decoder.encode);
            _centralHeader.commentLength = _comment.length;
            if (_comment.length > 0xffff) throw Utils.Errors.COMMENT_TOO_LONG();
        },

        get name() {
            var n = decoder.decode(_entryName);
            return _isDirectory
                ? n
                      .substr(n.length - 1)
                      .split("/")
                      .pop()
                : n.split("/").pop();
        },
        get isDirectory() {
            return _isDirectory;
        },

        getCompressedData: function () {
            return compress(false, null);
        },

        getCompressedDataAsync: function (/*Function*/ callback) {
            compress(true, callback);
        },

        setData: function (value) {
            uncompressedData = Utils.toBuffer(value, Utils.decoder.encode);
            if (!_isDirectory && uncompressedData.length) {
                _centralHeader.size = uncompressedData.length;
                _centralHeader.method = Utils.Constants.DEFLATED;
                _centralHeader.crc = Utils.crc32(value);
                _centralHeader.changed = true;
            } else {
                // folders and blank files should be stored
                _centralHeader.method = Utils.Constants.STORED;
            }
        },

        getData: function (pass) {
            if (_centralHeader.changed) {
                return uncompressedData;
            } else {
                return decompress(false, null, pass);
            }
        },

        getDataAsync: function (/*Function*/ callback, pass) {
            if (_centralHeader.changed) {
                callback(uncompressedData);
            } else {
                decompress(true, callback, pass);
            }
        },

        set attr(attr) {
            _centralHeader.attr = attr;
        },
        get attr() {
            return _centralHeader.attr;
        },

        set header(/*Buffer*/ data) {
            _centralHeader.loadFromBinary(data);
        },

        get header() {
            return _centralHeader;
        },

        packCentralHeader: function () {
            _centralHeader.flags_efs = this.efs;
            _centralHeader.extraLength = _extra.length;
            // 1. create header (buffer)
            var header = _centralHeader.centralHeaderToBinary();
            var addpos = Utils.Constants.CENHDR;
            // 2. add file name
            _entryName.copy(header, addpos);
            addpos += _entryName.length;
            // 3. add extra data
            _extra.copy(header, addpos);
            addpos += _centralHeader.extraLength;
            // 4. add file comment
            _comment.copy(header, addpos);
            return header;
        },

        packLocalHeader: function () {
            let addpos = 0;
            _centralHeader.flags_efs = this.efs;
            _centralHeader.extraLocalLength = _extralocal.length;
            // 1. construct local header Buffer
            const localHeaderBuf = _centralHeader.localHeaderToBinary();
            // 2. localHeader - crate header buffer
            const localHeader = Buffer.alloc(localHeaderBuf.length + _entryName.length + _centralHeader.extraLocalLength);
            // 2.1 add localheader
            localHeaderBuf.copy(localHeader, addpos);
            addpos += localHeaderBuf.length;
            // 2.2 add file name
            _entryName.copy(localHeader, addpos);
            addpos += _entryName.length;
            // 2.3 add extra field
            _extralocal.copy(localHeader, addpos);
            addpos += _extralocal.length;

            return localHeader;
        },

        toJSON: function () {
            const bytes = function (nr) {
                return "<" + ((nr && nr.length + " bytes buffer") || "null") + ">";
            };

            return {
                entryName: this.entryName,
                name: this.name,
                comment: this.comment,
                isDirectory: this.isDirectory,
                header: _centralHeader.toJSON(),
                compressedData: bytes(input),
                data: bytes(uncompressedData)
            };
        },

        toString: function () {
            return JSON.stringify(this.toJSON(), null, "\t");
        }
    };
};
const ZipEntry = require("./zipEntry");
const Headers = require("./headers");
const Utils = require("./util");

module.exports = function (/*Buffer|null*/ inBuffer, /** object */ options) {
    var entryList = [],
        entryTable = {},
        _comment = Buffer.alloc(0),
        mainHeader = new Headers.MainHeader(),
        loadedEntries = false;
    var password = null;
    const temporary = new Set();

    // assign options
    const opts = options;

    const { noSort, decoder } = opts;

    if (inBuffer) {
        // is a memory buffer
        readMainHeader(opts.readEntries);
    } else {
        // none. is a new file
        loadedEntries = true;
    }

    function makeTemporaryFolders() {
        const foldersList = new Set();

        // Make list of all folders in file
        for (const elem of Object.keys(entryTable)) {
            const elements = elem.split("/");
            elements.pop(); // filename
            if (!elements.length) continue; // no folders
            for (let i = 0; i < elements.length; i++) {
                const sub = elements.slice(0, i + 1).join("/") + "/";
                foldersList.add(sub);
            }
        }

        // create missing folders as temporary
        for (const elem of foldersList) {
            if (!(elem in entryTable)) {
                const tempfolder = new ZipEntry(opts);
                tempfolder.entryName = elem;
                tempfolder.attr = 0x10;
                tempfolder.temporary = true;
                entryList.push(tempfolder);
                entryTable[tempfolder.entryName] = tempfolder;
                temporary.add(tempfolder);
            }
        }
    }

    function readEntries() {
        loadedEntries = true;
        entryTable = {};
        if (mainHeader.diskEntries > (inBuffer.length - mainHeader.offset) / Utils.Constants.CENHDR) {
            throw Utils.Errors.DISK_ENTRY_TOO_LARGE();
        }
        entryList = new Array(mainHeader.diskEntries); // total number of entries
        var index = mainHeader.offset; // offset of first CEN header
        for (var i = 0; i < entryList.length; i++) {
            var tmp = index,
                entry = new ZipEntry(opts, inBuffer);
            entry.header = inBuffer.slice(tmp, (tmp += Utils.Constants.CENHDR));

            entry.entryName = inBuffer.slice(tmp, (tmp += entry.header.fileNameLength));

            if (entry.header.extraLength) {
                entry.extra = inBuffer.slice(tmp, (tmp += entry.header.extraLength));
            }

            if (entry.header.commentLength) entry.comment = inBuffer.slice(tmp, tmp + entry.header.commentLength);

            index += entry.header.centralHeaderSize;

            entryList[i] = entry;
            entryTable[entry.entryName] = entry;
        }
        temporary.clear();
        makeTemporaryFolders();
    }

    function readMainHeader(/*Boolean*/ readNow) {
        var i = inBuffer.length - Utils.Constants.ENDHDR, // END header size
            max = Math.max(0, i - 0xffff), // 0xFFFF is the max zip file comment length
            n = max,
            endStart = inBuffer.length,
            endOffset = -1, // Start offset of the END header
            commentEnd = 0;

        // option to search header form entire file
        const trailingSpace = typeof opts.trailingSpace === "boolean" ? opts.trailingSpace : false;
        if (trailingSpace) max = 0;

        for (i; i >= n; i--) {
            if (inBuffer[i] !== 0x50) continue; // quick check that the byte is 'P'
            if (inBuffer.readUInt32LE(i) === Utils.Constants.ENDSIG) {
                // "PK\005\006"
                endOffset = i;
                commentEnd = i;
                endStart = i + Utils.Constants.ENDHDR;
                // We already found a regular signature, let's look just a bit further to check if there's any zip64 signature
                n = i - Utils.Constants.END64HDR;
                continue;
            }

            if (inBuffer.readUInt32LE(i) === Utils.Constants.END64SIG) {
                // Found a zip64 signature, let's continue reading the whole zip64 record
                n = max;
                continue;
            }

            if (inBuffer.readUInt32LE(i) === Utils.Constants.ZIP64SIG) {
                // Found the zip64 record, let's determine it's size
                endOffset = i;
                endStart = i + Utils.readBigUInt64LE(inBuffer, i + Utils.Constants.ZIP64SIZE) + Utils.Constants.ZIP64LEAD;
                break;
            }
        }

        if (endOffset == -1) throw Utils.Errors.INVALID_FORMAT();

        mainHeader.loadFromBinary(inBuffer.slice(endOffset, endStart));
        if (mainHeader.commentLength) {
            _comment = inBuffer.slice(commentEnd + Utils.Constants.ENDHDR);
        }
        if (readNow) readEntries();
    }

    function sortEntries() {
        if (entryList.length > 1 && !noSort) {
            entryList.sort((a, b) => a.entryName.toLowerCase().localeCompare(b.entryName.toLowerCase()));
        }
    }

    return {
        /**
         * Returns an array of ZipEntry objects existent in the current opened archive
         * @return Array
         */
        get entries() {
            if (!loadedEntries) {
                readEntries();
            }
            return entryList.filter((e) => !temporary.has(e));
        },

        /**
         * Archive comment
         * @return {String}
         */
        get comment() {
            return decoder.decode(_comment);
        },
        set comment(val) {
            _comment = Utils.toBuffer(val, decoder.encode);
            mainHeader.commentLength = _comment.length;
        },

        getEntryCount: function () {
            if (!loadedEntries) {
                return mainHeader.diskEntries;
            }

            return entryList.length;
        },

        forEach: function (callback) {
            this.entries.forEach(callback);
        },

        /**
         * Returns a reference to the entry with the given name or null if entry is inexistent
         *
         * @param entryName
         * @return ZipEntry
         */
        getEntry: function (/*String*/ entryName) {
            if (!loadedEntries) {
                readEntries();
            }
            return entryTable[entryName] || null;
        },

        /**
         * Adds the given entry to the entry list
         *
         * @param entry
         */
        setEntry: function (/*ZipEntry*/ entry) {
            if (!loadedEntries) {
                readEntries();
            }
            entryList.push(entry);
            entryTable[entry.entryName] = entry;
            mainHeader.totalEntries = entryList.length;
        },

        /**
         * Removes the file with the given name from the entry list.
         *
         * If the entry is a directory, then all nested files and directories will be removed
         * @param entryName
         * @returns {void}
         */
        deleteFile: function (/*String*/ entryName, withsubfolders = true) {
            if (!loadedEntries) {
                readEntries();
            }
            const entry = entryTable[entryName];
            const list = this.getEntryChildren(entry, withsubfolders).map((child) => child.entryName);

            list.forEach(this.deleteEntry);
        },

        /**
         * Removes the entry with the given name from the entry list.
         *
         * @param {string} entryName
         * @returns {void}
         */
        deleteEntry: function (/*String*/ entryName) {
            if (!loadedEntries) {
                readEntries();
            }
            const entry = entryTable[entryName];
            const index = entryList.indexOf(entry);
            if (index >= 0) {
                entryList.splice(index, 1);
                delete entryTable[entryName];
                mainHeader.totalEntries = entryList.length;
            }
        },

        /**
         *  Iterates and returns all nested files and directories of the given entry
         *
         * @param entry
         * @return Array
         */
        getEntryChildren: function (/*ZipEntry*/ entry, subfolders = true) {
            if (!loadedEntries) {
                readEntries();
            }
            if (typeof entry === "object") {
                if (entry.isDirectory && subfolders) {
                    const list = [];
                    const name = entry.entryName;

                    for (const zipEntry of entryList) {
                        if (zipEntry.entryName.startsWith(name)) {
                            list.push(zipEntry);
                        }
                    }
                    return list;
                } else {
                    return [entry];
                }
            }
            return [];
        },

        /**
         *  How many child elements entry has
         *
         * @param {ZipEntry} entry
         * @return {integer}
         */
        getChildCount: function (entry) {
            if (entry && entry.isDirectory) {
                const list = this.getEntryChildren(entry);
                return list.includes(entry) ? list.length - 1 : list.length;
            }
            return 0;
        },

        /**
         * Returns the zip file
         *
         * @return Buffer
         */
        compressToBuffer: function () {
            if (!loadedEntries) {
                readEntries();
            }
            sortEntries();

            const dataBlock = [];
            const headerBlocks = [];
            let totalSize = 0;
            let dindex = 0;

            mainHeader.size = 0;
            mainHeader.offset = 0;
            let totalEntries = 0;

            for (const entry of this.entries) {
                // compress data and set local and entry header accordingly. Reason why is called first
                const compressedData = entry.getCompressedData();
                entry.header.offset = dindex;

                // 1. construct local header
                const localHeader = entry.packLocalHeader();

                // 2. offsets
                const dataLength = localHeader.length + compressedData.length;
                dindex += dataLength;

                // 3. store values in sequence
                dataBlock.push(localHeader);
                dataBlock.push(compressedData);

                // 4. construct central header
                const centralHeader = entry.packCentralHeader();
                headerBlocks.push(centralHeader);
                // 5. update main header
                mainHeader.size += centralHeader.length;
                totalSize += dataLength + centralHeader.length;
                totalEntries++;
            }

            totalSize += mainHeader.mainHeaderSize; // also includes zip file comment length
            // point to end of data and beginning of central directory first record
            mainHeader.offset = dindex;
            mainHeader.totalEntries = totalEntries;

            dindex = 0;
            const outBuffer = Buffer.alloc(totalSize);
            // write data blocks
            for (const content of dataBlock) {
                content.copy(outBuffer, dindex);
                dindex += content.length;
            }

            // write central directory entries
            for (const content of headerBlocks) {
                content.copy(outBuffer, dindex);
                dindex += content.length;
            }

            // write main header
            const mh = mainHeader.toBinary();
            if (_comment) {
                _comment.copy(mh, Utils.Constants.ENDHDR); // add zip file comment
            }
            mh.copy(outBuffer, dindex);

            // Since we update entry and main header offsets,
            // they are no longer valid and we have to reset content
            // (Issue 64)

            inBuffer = outBuffer;
            loadedEntries = false;

            return outBuffer;
        },

        toAsyncBuffer: function (/*Function*/ onSuccess, /*Function*/ onFail, /*Function*/ onItemStart, /*Function*/ onItemEnd) {
            try {
                if (!loadedEntries) {
                    readEntries();
                }
                sortEntries();

                const dataBlock = [];
                const centralHeaders = [];
                let totalSize = 0;
                let dindex = 0;
                let totalEntries = 0;

                mainHeader.size = 0;
                mainHeader.offset = 0;

                const compress2Buffer = function (entryLists) {
                    if (entryLists.length > 0) {
                        const entry = entryLists.shift();
                        const name = entry.entryName + entry.extra.toString();
                        if (onItemStart) onItemStart(name);
                        entry.getCompressedDataAsync(function (compressedData) {
                            if (onItemEnd) onItemEnd(name);
                            entry.header.offset = dindex;

                            // 1. construct local header
                            const localHeader = entry.packLocalHeader();

                            // 2. offsets
                            const dataLength = localHeader.length + compressedData.length;
                            dindex += dataLength;

                            // 3. store values in sequence
                            dataBlock.push(localHeader);
                            dataBlock.push(compressedData);

                            // central header
                            const centalHeader = entry.packCentralHeader();
                            centralHeaders.push(centalHeader);
                            mainHeader.size += centalHeader.length;
                            totalSize += dataLength + centalHeader.length;
                            totalEntries++;

                            compress2Buffer(entryLists);
                        });
                    } else {
                        totalSize += mainHeader.mainHeaderSize; // also includes zip file comment length
                        // point to end of data and beginning of central directory first record
                        mainHeader.offset = dindex;
                        mainHeader.totalEntries = totalEntries;

                        dindex = 0;
                        const outBuffer = Buffer.alloc(totalSize);
                        dataBlock.forEach(function (content) {
                            content.copy(outBuffer, dindex); // write data blocks
                            dindex += content.length;
                        });
                        centralHeaders.forEach(function (content) {
                            content.copy(outBuffer, dindex); // write central directory entries
                            dindex += content.length;
                        });

                        const mh = mainHeader.toBinary();
                        if (_comment) {
                            _comment.copy(mh, Utils.Constants.ENDHDR); // add zip file comment
                        }

                        mh.copy(outBuffer, dindex); // write main header

                        // Since we update entry and main header offsets, they are no
                        // longer valid and we have to reset content using our new buffer
                        // (Issue 64)

                        inBuffer = outBuffer;
                        loadedEntries = false;

                        onSuccess(outBuffer);
                    }
                };

                compress2Buffer(Array.from(this.entries));
            } catch (e) {
                onFail(e);
            }
        }
    };
};
module.exports = {
    /* The local file header */
    LOCHDR           : 30, // LOC header size
    LOCSIG           : 0x04034b50, // "PK\003\004"
    LOCVER           : 4,	// version needed to extract
    LOCFLG           : 6, // general purpose bit flag
    LOCHOW           : 8, // compression method
    LOCTIM           : 10, // modification time (2 bytes time, 2 bytes date)
    LOCCRC           : 14, // uncompressed file crc-32 value
    LOCSIZ           : 18, // compressed size
    LOCLEN           : 22, // uncompressed size
    LOCNAM           : 26, // filename length
    LOCEXT           : 28, // extra field length

    /* The Data descriptor */
    EXTSIG           : 0x08074b50, // "PK\007\008"
    EXTHDR           : 16, // EXT header size
    EXTCRC           : 4, // uncompressed file crc-32 value
    EXTSIZ           : 8, // compressed size
    EXTLEN           : 12, // uncompressed size

    /* The central directory file header */
    CENHDR           : 46, // CEN header size
    CENSIG           : 0x02014b50, // "PK\001\002"
    CENVEM           : 4, // version made by
    CENVER           : 6, // version needed to extract
    CENFLG           : 8, // encrypt, decrypt flags
    CENHOW           : 10, // compression method
    CENTIM           : 12, // modification time (2 bytes time, 2 bytes date)
    CENCRC           : 16, // uncompressed file crc-32 value
    CENSIZ           : 20, // compressed size
    CENLEN           : 24, // uncompressed size
    CENNAM           : 28, // filename length
    CENEXT           : 30, // extra field length
    CENCOM           : 32, // file comment length
    CENDSK           : 34, // volume number start
    CENATT           : 36, // internal file attributes
    CENATX           : 38, // external file attributes (host system dependent)
    CENOFF           : 42, // LOC header offset

    /* The entries in the end of central directory */
    ENDHDR           : 22, // END header size
    ENDSIG           : 0x06054b50, // "PK\005\006"
    ENDSUB           : 8, // number of entries on this disk
    ENDTOT           : 10, // total number of entries
    ENDSIZ           : 12, // central directory size in bytes
    ENDOFF           : 16, // offset of first CEN header
    ENDCOM           : 20, // zip file comment length

    END64HDR         : 20, // zip64 END header size
    END64SIG         : 0x07064b50, // zip64 Locator signature, "PK\006\007"
    END64START       : 4, // number of the disk with the start of the zip64
    END64OFF         : 8, // relative offset of the zip64 end of central directory
    END64NUMDISKS    : 16, // total number of disks

    ZIP64SIG         : 0x06064b50, // zip64 signature, "PK\006\006"
    ZIP64HDR         : 56, // zip64 record minimum size
    ZIP64LEAD        : 12, // leading bytes at the start of the record, not counted by the value stored in ZIP64SIZE
    ZIP64SIZE        : 4, // zip64 size of the central directory record
    ZIP64VEM         : 12, // zip64 version made by
    ZIP64VER         : 14, // zip64 version needed to extract
    ZIP64DSK         : 16, // zip64 number of this disk
    ZIP64DSKDIR      : 20, // number of the disk with the start of the record directory
    ZIP64SUB         : 24, // number of entries on this disk
    ZIP64TOT         : 32, // total number of entries
    ZIP64SIZB        : 40, // zip64 central directory size in bytes
    ZIP64OFF         : 48, // offset of start of central directory with respect to the starting disk number
    ZIP64EXTRA       : 56, // extensible data sector

    /* Compression methods */
    STORED           : 0, // no compression
    SHRUNK           : 1, // shrunk
    REDUCED1         : 2, // reduced with compression factor 1
    REDUCED2         : 3, // reduced with compression factor 2
    REDUCED3         : 4, // reduced with compression factor 3
    REDUCED4         : 5, // reduced with compression factor 4
    IMPLODED         : 6, // imploded
    // 7 reserved for Tokenizing compression algorithm
    DEFLATED         : 8, // deflated
    ENHANCED_DEFLATED: 9, // enhanced deflated
    PKWARE           : 10,// PKWare DCL imploded
    // 11 reserved by PKWARE
    BZIP2            : 12, //  compressed using BZIP2
    // 13 reserved by PKWARE
    LZMA             : 14, // LZMA
    // 15-17 reserved by PKWARE
    IBM_TERSE        : 18, // compressed using IBM TERSE
    IBM_LZ77         : 19, // IBM LZ77 z
    AES_ENCRYPT      : 99, // WinZIP AES encryption method

    /* General purpose bit flag */
    // values can obtained with expression 2**bitnr
    FLG_ENC          : 1,    // Bit 0: encrypted file
    FLG_COMP1        : 2,    // Bit 1, compression option
    FLG_COMP2        : 4,    // Bit 2, compression option
    FLG_DESC         : 8,    // Bit 3, data descriptor
    FLG_ENH          : 16,   // Bit 4, enhanced deflating
    FLG_PATCH        : 32,   // Bit 5, indicates that the file is compressed patched data.
    FLG_STR          : 64,   // Bit 6, strong encryption (patented)
                             // Bits 7-10: Currently unused.
    FLG_EFS          : 2048, // Bit 11: Language encoding flag (EFS)
                             // Bit 12: Reserved by PKWARE for enhanced compression.
                             // Bit 13: encrypted the Central Directory (patented).
                             // Bits 14-15: Reserved by PKWARE.
    FLG_MSK          : 4096, // mask header values

    /* Load type */
    FILE             : 2,
    BUFFER           : 1,
    NONE             : 0,

    /* 4.5 Extensible data fields */
    EF_ID            : 0,
    EF_SIZE          : 2,

    /* Header IDs */
    ID_ZIP64         : 0x0001,
    ID_AVINFO        : 0x0007,
    ID_PFS           : 0x0008,
    ID_OS2           : 0x0009,
    ID_NTFS          : 0x000a,
    ID_OPENVMS       : 0x000c,
    ID_UNIX          : 0x000d,
    ID_FORK          : 0x000e,
    ID_PATCH         : 0x000f,
    ID_X509_PKCS7    : 0x0014,
    ID_X509_CERTID_F : 0x0015,
    ID_X509_CERTID_C : 0x0016,
    ID_STRONGENC     : 0x0017,
    ID_RECORD_MGT    : 0x0018,
    ID_X509_PKCS7_RL : 0x0019,
    ID_IBM1          : 0x0065,
    ID_IBM2          : 0x0066,
    ID_POSZIP        : 0x4690,

    EF_ZIP64_OR_32   : 0xffffffff,
    EF_ZIP64_OR_16   : 0xffff,
    EF_ZIP64_SUNCOMP : 0,
    EF_ZIP64_SCOMP   : 8,
    EF_ZIP64_RHO     : 16,
    EF_ZIP64_DSN     : 24
};
module.exports = {
    efs: true,
    encode: (data) => Buffer.from(data, "utf8"),
    decode: (data) => data.toString("utf8")
};
const errors = {
    /* Header error messages */
    INVALID_LOC: "Invalid LOC header (bad signature)",
    INVALID_CEN: "Invalid CEN header (bad signature)",
    INVALID_END: "Invalid END header (bad signature)",

    /* Descriptor */
    DESCRIPTOR_NOT_EXIST: "No descriptor present",
    DESCRIPTOR_UNKNOWN: "Unknown descriptor format",
    DESCRIPTOR_FAULTY: "Descriptor data is malformed",

    /* ZipEntry error messages*/
    NO_DATA: "Nothing to decompress",
    BAD_CRC: "CRC32 checksum failed {0}",
    FILE_IN_THE_WAY: "There is a file in the way: {0}",
    UNKNOWN_METHOD: "Invalid/unsupported compression method",

    /* Inflater error messages */
    AVAIL_DATA: "inflate::Available inflate data did not terminate",
    INVALID_DISTANCE: "inflate::Invalid literal/length or distance code in fixed or dynamic block",
    TO_MANY_CODES: "inflate::Dynamic block code description: too many length or distance codes",
    INVALID_REPEAT_LEN: "inflate::Dynamic block code description: repeat more than specified lengths",
    INVALID_REPEAT_FIRST: "inflate::Dynamic block code description: repeat lengths with no first length",
    INCOMPLETE_CODES: "inflate::Dynamic block code description: code lengths codes incomplete",
    INVALID_DYN_DISTANCE: "inflate::Dynamic block code description: invalid distance code lengths",
    INVALID_CODES_LEN: "inflate::Dynamic block code description: invalid literal/length code lengths",
    INVALID_STORE_BLOCK: "inflate::Stored block length did not match one's complement",
    INVALID_BLOCK_TYPE: "inflate::Invalid block type (type == 3)",

    /* ADM-ZIP error messages */
    CANT_EXTRACT_FILE: "Could not extract the file",
    CANT_OVERRIDE: "Target file already exists",
    DISK_ENTRY_TOO_LARGE: "Number of disk entries is too large",
    NO_ZIP: "No zip file was loaded",
    NO_ENTRY: "Entry doesn't exist",
    DIRECTORY_CONTENT_ERROR: "A directory cannot have content",
    FILE_NOT_FOUND: 'File not found: "{0}"',
    NOT_IMPLEMENTED: "Not implemented",
    INVALID_FILENAME: "Invalid filename",
    INVALID_FORMAT: "Invalid or unsupported zip format. No END header found",
    INVALID_PASS_PARAM: "Incompatible password parameter",
    WRONG_PASSWORD: "Wrong Password",

    /* ADM-ZIP */
    COMMENT_TOO_LONG: "Comment is too long", // Comment can be max 65535 bytes long (NOTE: some non-US characters may take more space)
    EXTRA_FIELD_PARSE_ERROR: "Extra field parsing error"
};

// template
function E(message) {
    return function (...args) {
        if (args.length) { // Allow {0} .. {9} arguments in error message, based on argument number
            message = message.replace(/\{(\d)\}/g, (_, n) => args[n] || '');
        }

        return new Error('ADM-ZIP: ' + message);
    };
}

// Init errors with template
for (const msg of Object.keys(errors)) {
    exports[msg] = E(errors[msg]);
}
const pth = require("path");

module.exports = function (/*String*/ path, /*Utils object*/ { fs }) {
    var _path = path || "",
        _obj = newAttr(),
        _stat = null;

    function newAttr() {
        return {
            directory: false,
            readonly: false,
            hidden: false,
            executable: false,
            mtime: 0,
            atime: 0
        };
    }

    if (_path && fs.existsSync(_path)) {
        _stat = fs.statSync(_path);
        _obj.directory = _stat.isDirectory();
        _obj.mtime = _stat.mtime;
        _obj.atime = _stat.atime;
        _obj.executable = (0o111 & _stat.mode) !== 0; // file is executable who ever har right not just owner
        _obj.readonly = (0o200 & _stat.mode) === 0; // readonly if owner has no write right
        _obj.hidden = pth.basename(_path)[0] === ".";
    } else {
        console.warn("Invalid path: " + _path);
    }

    return {
        get directory() {
            return _obj.directory;
        },

        get readOnly() {
            return _obj.readonly;
        },

        get hidden() {
            return _obj.hidden;
        },

        get mtime() {
            return _obj.mtime;
        },

        get atime() {
            return _obj.atime;
        },

        get executable() {
            return _obj.executable;
        },

        decodeAttributes: function () {},

        encodeAttributes: function () {},

        toJSON: function () {
            return {
                path: _path,
                isDirectory: _obj.directory,
                isReadOnly: _obj.readonly,
                isHidden: _obj.hidden,
                isExecutable: _obj.executable,
                mTime: _obj.mtime,
                aTime: _obj.atime
            };
        },

        toString: function () {
            return JSON.stringify(this.toJSON(), null, "\t");
        }
    };
};
module.exports = require("./utils");
module.exports.Constants = require("./constants");
module.exports.Errors = require("./errors");
module.exports.FileAttr = require("./fattr");
module.exports.decoder = require("./decoder");
const fsystem = require("fs");
const pth = require("path");
const Constants = require("./constants");
const Errors = require("./errors");
const isWin = typeof process === "object" && "win32" === process.platform;

const is_Obj = (obj) => typeof obj === "object" && obj !== null;

// generate CRC32 lookup table
const crcTable = new Uint32Array(256).map((t, c) => {
    for (let k = 0; k < 8; k++) {
        if ((c & 1) !== 0) {
            c = 0xedb88320 ^ (c >>> 1);
        } else {
            c >>>= 1;
        }
    }
    return c >>> 0;
});

// UTILS functions

function Utils(opts) {
    this.sep = pth.sep;
    this.fs = fsystem;

    if (is_Obj(opts)) {
        // custom filesystem
        if (is_Obj(opts.fs) && typeof opts.fs.statSync === "function") {
            this.fs = opts.fs;
        }
    }
}

module.exports = Utils;

// INSTANTIABLE functions

Utils.prototype.makeDir = function (/*String*/ folder) {
    const self = this;

    // Sync - make directories tree
    function mkdirSync(/*String*/ fpath) {
        let resolvedPath = fpath.split(self.sep)[0];
        fpath.split(self.sep).forEach(function (name) {
            if (!name || name.substr(-1, 1) === ":") return;
            resolvedPath += self.sep + name;
            var stat;
            try {
                stat = self.fs.statSync(resolvedPath);
            } catch (e) {
                self.fs.mkdirSync(resolvedPath);
            }
            if (stat && stat.isFile()) throw Errors.FILE_IN_THE_WAY(`"${resolvedPath}"`);
        });
    }

    mkdirSync(folder);
};

Utils.prototype.writeFileTo = function (/*String*/ path, /*Buffer*/ content, /*Boolean*/ overwrite, /*Number*/ attr) {
    const self = this;
    if (self.fs.existsSync(path)) {
        if (!overwrite) return false; // cannot overwrite

        var stat = self.fs.statSync(path);
        if (stat.isDirectory()) {
            return false;
        }
    }
    var folder = pth.dirname(path);
    if (!self.fs.existsSync(folder)) {
        self.makeDir(folder);
    }

    var fd;
    try {
        fd = self.fs.openSync(path, "w", 0o666); // 0666
    } catch (e) {
        self.fs.chmodSync(path, 0o666);
        fd = self.fs.openSync(path, "w", 0o666);
    }
    if (fd) {
        try {
            self.fs.writeSync(fd, content, 0, content.length, 0);
        } finally {
            self.fs.closeSync(fd);
        }
    }
    self.fs.chmodSync(path, attr || 0o666);
    return true;
};

Utils.prototype.writeFileToAsync = function (/*String*/ path, /*Buffer*/ content, /*Boolean*/ overwrite, /*Number*/ attr, /*Function*/ callback) {
    if (typeof attr === "function") {
        callback = attr;
        attr = undefined;
    }

    const self = this;

    self.fs.exists(path, function (exist) {
        if (exist && !overwrite) return callback(false);

        self.fs.stat(path, function (err, stat) {
            if (exist && stat.isDirectory()) {
                return callback(false);
            }

            var folder = pth.dirname(path);
            self.fs.exists(folder, function (exists) {
                if (!exists) self.makeDir(folder);

                self.fs.open(path, "w", 0o666, function (err, fd) {
                    if (err) {
                        self.fs.chmod(path, 0o666, function () {
                            self.fs.open(path, "w", 0o666, function (err, fd) {
                                self.fs.write(fd, content, 0, content.length, 0, function () {
                                    self.fs.close(fd, function () {
                                        self.fs.chmod(path, attr || 0o666, function () {
                                            callback(true);
                                        });
                                    });
                                });
                            });
                        });
                    } else if (fd) {
                        self.fs.write(fd, content, 0, content.length, 0, function () {
                            self.fs.close(fd, function () {
                                self.fs.chmod(path, attr || 0o666, function () {
                                    callback(true);
                                });
                            });
                        });
                    } else {
                        self.fs.chmod(path, attr || 0o666, function () {
                            callback(true);
                        });
                    }
                });
            });
        });
    });
};

Utils.prototype.findFiles = function (/*String*/ path) {
    const self = this;

    function findSync(/*String*/ dir, /*RegExp*/ pattern, /*Boolean*/ recursive) {
        if (typeof pattern === "boolean") {
            recursive = pattern;
            pattern = undefined;
        }
        let files = [];
        self.fs.readdirSync(dir).forEach(function (file) {
            const path = pth.join(dir, file);
            const stat = self.fs.statSync(path);

            if (!pattern || pattern.test(path)) {
                files.push(pth.normalize(path) + (stat.isDirectory() ? self.sep : ""));
            }

            if (stat.isDirectory() && recursive) files = files.concat(findSync(path, pattern, recursive));
        });
        return files;
    }

    return findSync(path, undefined, true);
};

/**
 * Callback for showing if everything was done.
 *
 * @callback filelistCallback
 * @param {Error} err - Error object
 * @param {string[]} list - was request fully completed
 */

/**
 *
 * @param {string} dir
 * @param {filelistCallback} cb
 */
Utils.prototype.findFilesAsync = function (dir, cb) {
    const self = this;
    let results = [];
    self.fs.readdir(dir, function (err, list) {
        if (err) return cb(err);
        let list_length = list.length;
        if (!list_length) return cb(null, results);
        list.forEach(function (file) {
            file = pth.join(dir, file);
            self.fs.stat(file, function (err, stat) {
                if (err) return cb(err);
                if (stat) {
                    results.push(pth.normalize(file) + (stat.isDirectory() ? self.sep : ""));
                    if (stat.isDirectory()) {
                        self.findFilesAsync(file, function (err, res) {
                            if (err) return cb(err);
                            results = results.concat(res);
                            if (!--list_length) cb(null, results);
                        });
                    } else {
                        if (!--list_length) cb(null, results);
                    }
                }
            });
        });
    });
};

Utils.prototype.getAttributes = function () {};

Utils.prototype.setAttributes = function () {};

// STATIC functions

// crc32 single update (it is part of crc32)
Utils.crc32update = function (crc, byte) {
    return crcTable[(crc ^ byte) & 0xff] ^ (crc >>> 8);
};

Utils.crc32 = function (buf) {
    if (typeof buf === "string") {
        buf = Buffer.from(buf, "utf8");
    }

    let len = buf.length;
    let crc = ~0;
    for (let off = 0; off < len; ) crc = Utils.crc32update(crc, buf[off++]);
    // xor and cast as uint32 number
    return ~crc >>> 0;
};

Utils.methodToString = function (/*Number*/ method) {
    switch (method) {
        case Constants.STORED:
            return "STORED (" + method + ")";
        case Constants.DEFLATED:
            return "DEFLATED (" + method + ")";
        default:
            return "UNSUPPORTED (" + method + ")";
    }
};

/**
 * removes ".." style path elements
 * @param {string} path - fixable path
 * @returns string - fixed filepath
 */
Utils.canonical = function (/*string*/ path) {
    if (!path) return "";
    // trick normalize think path is absolute
    const safeSuffix = pth.posix.normalize("/" + path.split("\\").join("/"));
    return pth.join(".", safeSuffix);
};

/**
 * fix file names in achive
 * @param {string} path - fixable path
 * @returns string - fixed filepath
 */

Utils.zipnamefix = function (path) {
    if (!path) return "";
    // trick normalize think path is absolute
    const safeSuffix = pth.posix.normalize("/" + path.split("\\").join("/"));
    return pth.posix.join(".", safeSuffix);
};

/**
 *
 * @param {Array} arr
 * @param {function} callback
 * @returns
 */
Utils.findLast = function (arr, callback) {
    if (!Array.isArray(arr)) throw new TypeError("arr is not array");

    const len = arr.length >>> 0;
    for (let i = len - 1; i >= 0; i--) {
        if (callback(arr[i], i, arr)) {
            return arr[i];
        }
    }
    return void 0;
};

// make abolute paths taking prefix as root folder
Utils.sanitize = function (/*string*/ prefix, /*string*/ name) {
    prefix = pth.resolve(pth.normalize(prefix));
    var parts = name.split("/");
    for (var i = 0, l = parts.length; i < l; i++) {
        var path = pth.normalize(pth.join(prefix, parts.slice(i, l).join(pth.sep)));
        if (path.indexOf(prefix) === 0) {
            return path;
        }
    }
    return pth.normalize(pth.join(prefix, pth.basename(name)));
};

// converts buffer, Uint8Array, string types to buffer
Utils.toBuffer = function toBuffer(/*buffer, Uint8Array, string*/ input, /* function */ encoder) {
    if (Buffer.isBuffer(input)) {
        return input;
    } else if (input instanceof Uint8Array) {
        return Buffer.from(input);
    } else {
        // expect string all other values are invalid and return empty buffer
        return typeof input === "string" ? encoder(input) : Buffer.alloc(0);
    }
};

Utils.readBigUInt64LE = function (/*Buffer*/ buffer, /*int*/ index) {
    var slice = Buffer.from(buffer.slice(index, index + 8));
    slice.swap64();

    return parseInt(`0x${slice.toString("hex")}`);
};

Utils.fromDOS2Date = function (val) {
    return new Date(((val >> 25) & 0x7f) + 1980, Math.max(((val >> 21) & 0x0f) - 1, 0), Math.max((val >> 16) & 0x1f, 1), (val >> 11) & 0x1f, (val >> 5) & 0x3f, (val & 0x1f) << 1);
};

Utils.fromDate2DOS = function (val) {
    let date = 0;
    let time = 0;
    if (val.getFullYear() > 1979) {
        date = (((val.getFullYear() - 1980) & 0x7f) << 9) | ((val.getMonth() + 1) << 5) | val.getDate();
        time = (val.getHours() << 11) | (val.getMinutes() << 5) | (val.getSeconds() >> 1);
    }
    return (date << 16) | time;
};

Utils.isWin = isWin; // Do we have windows system
Utils.crcTable = crcTable;
module.exports = function (/*Buffer*/ inbuf) {
    var zlib = require("zlib");

    var opts = { chunkSize: (parseInt(inbuf.length / 1024) + 1) * 1024 };

    return {
        deflate: function () {
            return zlib.deflateRawSync(inbuf, opts);
        },

        deflateAsync: function (/*Function*/ callback) {
            var tmp = zlib.createDeflateRaw(opts),
                parts = [],
                total = 0;
            tmp.on("data", function (data) {
                parts.push(data);
                total += data.length;
            });
            tmp.on("end", function () {
                var buf = Buffer.alloc(total),
                    written = 0;
                buf.fill(0);
                for (var i = 0; i < parts.length; i++) {
                    var part = parts[i];
                    part.copy(buf, written);
                    written += part.length;
                }
                callback && callback(buf);
            });
            tmp.end(inbuf);
        }
    };
};
exports.Deflater = require("./deflater");
exports.Inflater = require("./inflater");
exports.ZipCrypto = require("./zipcrypto");
const version = +(process.versions ? process.versions.node : "").split(".")[0] || 0;

module.exports = function (/*Buffer*/ inbuf, /*number*/ expectedLength) {
    var zlib = require("zlib");
    const option = version >= 15 && expectedLength > 0 ? { maxOutputLength: expectedLength } : {};

    return {
        inflate: function () {
            return zlib.inflateRawSync(inbuf, option);
        },

        inflateAsync: function (/*Function*/ callback) {
            var tmp = zlib.createInflateRaw(option),
                parts = [],
                total = 0;
            tmp.on("data", function (data) {
                parts.push(data);
                total += data.length;
            });
            tmp.on("end", function () {
                var buf = Buffer.alloc(total),
                    written = 0;
                buf.fill(0);
                for (var i = 0; i < parts.length; i++) {
                    var part = parts[i];
                    part.copy(buf, written);
                    written += part.length;
                }
                callback && callback(buf);
            });
            tmp.end(inbuf);
        }
    };
};
"use strict";

// node crypt, we use it for generate salt
// eslint-disable-next-line node/no-unsupported-features/node-builtins
const { randomFillSync } = require("crypto");
const Errors = require("../util/errors");

// generate CRC32 lookup table
const crctable = new Uint32Array(256).map((t, crc) => {
    for (let j = 0; j < 8; j++) {
        if (0 !== (crc & 1)) {
            crc = (crc >>> 1) ^ 0xedb88320;
        } else {
            crc >>>= 1;
        }
    }
    return crc >>> 0;
});

// C-style uInt32 Multiply (discards higher bits, when JS multiply discards lower bits)
const uMul = (a, b) => Math.imul(a, b) >>> 0;

// crc32 byte single update (actually same function is part of utils.crc32 function :) )
const crc32update = (pCrc32, bval) => {
    return crctable[(pCrc32 ^ bval) & 0xff] ^ (pCrc32 >>> 8);
};

// function for generating salt for encrytion header
const genSalt = () => {
    if ("function" === typeof randomFillSync) {
        return randomFillSync(Buffer.alloc(12));
    } else {
        // fallback if function is not defined
        return genSalt.node();
    }
};

// salt generation with node random function (mainly as fallback)
genSalt.node = () => {
    const salt = Buffer.alloc(12);
    const len = salt.length;
    for (let i = 0; i < len; i++) salt[i] = (Math.random() * 256) & 0xff;
    return salt;
};

// general config
const config = {
    genSalt
};

// Class Initkeys handles same basic ops with keys
function Initkeys(pw) {
    const pass = Buffer.isBuffer(pw) ? pw : Buffer.from(pw);
    this.keys = new Uint32Array([0x12345678, 0x23456789, 0x34567890]);
    for (let i = 0; i < pass.length; i++) {
        this.updateKeys(pass[i]);
    }
}

Initkeys.prototype.updateKeys = function (byteValue) {
    const keys = this.keys;
    keys[0] = crc32update(keys[0], byteValue);
    keys[1] += keys[0] & 0xff;
    keys[1] = uMul(keys[1], 134775813) + 1;
    keys[2] = crc32update(keys[2], keys[1] >>> 24);
    return byteValue;
};

Initkeys.prototype.next = function () {
    const k = (this.keys[2] | 2) >>> 0; // key
    return (uMul(k, k ^ 1) >> 8) & 0xff; // decode
};

function make_decrypter(/*Buffer*/ pwd) {
    // 1. Stage initialize key
    const keys = new Initkeys(pwd);

    // return decrypter function
    return function (/*Buffer*/ data) {
        // result - we create new Buffer for results
        const result = Buffer.alloc(data.length);
        let pos = 0;
        // process input data
        for (let c of data) {
            //c ^= keys.next();
            //result[pos++] = c; // decode & Save Value
            result[pos++] = keys.updateKeys(c ^ keys.next()); // update keys with decoded byte
        }
        return result;
    };
}

function make_encrypter(/*Buffer*/ pwd) {
    // 1. Stage initialize key
    const keys = new Initkeys(pwd);

    // return encrypting function, result and pos is here so we dont have to merge buffers later
    return function (/*Buffer*/ data, /*Buffer*/ result, /* Number */ pos = 0) {
        // result - we create new Buffer for results
        if (!result) result = Buffer.alloc(data.length);
        // process input data
        for (let c of data) {
            const k = keys.next(); // save key byte
            result[pos++] = c ^ k; // save val
            keys.updateKeys(c); // update keys with decoded byte
        }
        return result;
    };
}

function decrypt(/*Buffer*/ data, /*Object*/ header, /*String, Buffer*/ pwd) {
    if (!data || !Buffer.isBuffer(data) || data.length < 12) {
        return Buffer.alloc(0);
    }

    // 1. We Initialize and generate decrypting function
    const decrypter = make_decrypter(pwd);

    // 2. decrypt salt what is always 12 bytes and is a part of file content
    const salt = decrypter(data.slice(0, 12));

    // if bit 3 (0x08) of the general-purpose flags field is set, check salt[11] with the high byte of the header time
    // 2 byte data block (as per Info-Zip spec), otherwise check with the high byte of the header entry
    const verifyByte = (header.flags & 0x8) === 0x8 ? header.timeHighByte : header.crc >>> 24;

    //3. does password meet expectations
    if (salt[11] !== verifyByte) {
        throw Errors.WRONG_PASSWORD();
    }

    // 4. decode content
    return decrypter(data.slice(12));
}

// lets add way to populate salt, NOT RECOMMENDED for production but maybe useful for testing general functionality
function _salter(data) {
    if (Buffer.isBuffer(data) && data.length >= 12) {
        // be aware - currently salting buffer data is modified
        config.genSalt = function () {
            return data.slice(0, 12);
        };
    } else if (data === "node") {
        // test salt generation with node random function
        config.genSalt = genSalt.node;
    } else {
        // if value is not acceptable config gets reset.
        config.genSalt = genSalt;
    }
}

function encrypt(/*Buffer*/ data, /*Object*/ header, /*String, Buffer*/ pwd, /*Boolean*/ oldlike = false) {
    // 1. test data if data is not Buffer we make buffer from it
    if (data == null) data = Buffer.alloc(0);
    // if data is not buffer be make buffer from it
    if (!Buffer.isBuffer(data)) data = Buffer.from(data.toString());

    // 2. We Initialize and generate encrypting function
    const encrypter = make_encrypter(pwd);

    // 3. generate salt (12-bytes of random data)
    const salt = config.genSalt();
    salt[11] = (header.crc >>> 24) & 0xff;

    // old implementations (before PKZip 2.04g) used two byte check
    if (oldlike) salt[10] = (header.crc >>> 16) & 0xff;

    // 4. create output
    const result = Buffer.alloc(data.length + 12);
    encrypter(salt, result);

    // finally encode content
    return encrypter(data, result, 12);
}

module.exports = { decrypt, encrypt, _salter };
var Utils = require("../util"),
    Constants = Utils.Constants;

/* The central directory file header */
module.exports = function () {
    var _verMade = 20, // v2.0
        _version = 10, // v1.0
        _flags = 0,
        _method = 0,
        _time = 0,
        _crc = 0,
        _compressedSize = 0,
        _size = 0,
        _fnameLen = 0,
        _extraLen = 0,
        _comLen = 0,
        _diskStart = 0,
        _inattr = 0,
        _attr = 0,
        _offset = 0;

    _verMade |= Utils.isWin ? 0x0a00 : 0x0300;

    // Set EFS flag since filename and comment fields are all by default encoded using UTF-8.
    // Without it file names may be corrupted for other apps when file names use unicode chars
    _flags |= Constants.FLG_EFS;

    const _localHeader = {
        extraLen: 0
    };

    // casting
    const uint32 = (val) => Math.max(0, val) >>> 0;
    const uint16 = (val) => Math.max(0, val) & 0xffff;
    const uint8 = (val) => Math.max(0, val) & 0xff;

    _time = Utils.fromDate2DOS(new Date());

    return {
        get made() {
            return _verMade;
        },
        set made(val) {
            _verMade = val;
        },

        get version() {
            return _version;
        },
        set version(val) {
            _version = val;
        },

        get flags() {
            return _flags;
        },
        set flags(val) {
            _flags = val;
        },

        get flags_efs() {
            return (_flags & Constants.FLG_EFS) > 0;
        },
        set flags_efs(val) {
            if (val) {
                _flags |= Constants.FLG_EFS;
            } else {
                _flags &= ~Constants.FLG_EFS;
            }
        },

        get flags_desc() {
            return (_flags & Constants.FLG_DESC) > 0;
        },
        set flags_desc(val) {
            if (val) {
                _flags |= Constants.FLG_DESC;
            } else {
                _flags &= ~Constants.FLG_DESC;
            }
        },

        get method() {
            return _method;
        },
        set method(val) {
            switch (val) {
                case Constants.STORED:
                    this.version = 10;
                case Constants.DEFLATED:
                default:
                    this.version = 20;
            }
            _method = val;
        },

        get time() {
            return Utils.fromDOS2Date(this.timeval);
        },
        set time(val) {
            this.timeval = Utils.fromDate2DOS(val);
        },

        get timeval() {
            return _time;
        },
        set timeval(val) {
            _time = uint32(val);
        },

        get timeHighByte() {
            return uint8(_time >>> 8);
        },
        get crc() {
            return _crc;
        },
        set crc(val) {
            _crc = uint32(val);
        },

        get compressedSize() {
            return _compressedSize;
        },
        set compressedSize(val) {
            _compressedSize = uint32(val);
        },

        get size() {
            return _size;
        },
        set size(val) {
            _size = uint32(val);
        },

        get fileNameLength() {
            return _fnameLen;
        },
        set fileNameLength(val) {
            _fnameLen = val;
        },

        get extraLength() {
            return _extraLen;
        },
        set extraLength(val) {
            _extraLen = val;
        },

        get extraLocalLength() {
            return _localHeader.extraLen;
        },
        set extraLocalLength(val) {
            _localHeader.extraLen = val;
        },

        get commentLength() {
            return _comLen;
        },
        set commentLength(val) {
            _comLen = val;
        },

        get diskNumStart() {
            return _diskStart;
        },
        set diskNumStart(val) {
            _diskStart = uint32(val);
        },

        get inAttr() {
            return _inattr;
        },
        set inAttr(val) {
            _inattr = uint32(val);
        },

        get attr() {
            return _attr;
        },
        set attr(val) {
            _attr = uint32(val);
        },

        // get Unix file permissions
        get fileAttr() {
            return (_attr || 0) >> 16 & 0xfff;
        },

        get offset() {
            return _offset;
        },
        set offset(val) {
            _offset = uint32(val);
        },

        get encrypted() {
            return (_flags & Constants.FLG_ENC) === Constants.FLG_ENC;
        },

        get centralHeaderSize() {
            return Constants.CENHDR + _fnameLen + _extraLen + _comLen;
        },

        get realDataOffset() {
            return _offset + Constants.LOCHDR + _localHeader.fnameLen + _localHeader.extraLen;
        },

        get localHeader() {
            return _localHeader;
        },

        loadLocalHeaderFromBinary: function (/*Buffer*/ input) {
            var data = input.slice(_offset, _offset + Constants.LOCHDR);
            // 30 bytes and should start with "PK\003\004"
            if (data.readUInt32LE(0) !== Constants.LOCSIG) {
                throw Utils.Errors.INVALID_LOC();
            }

            // version needed to extract
            _localHeader.version = data.readUInt16LE(Constants.LOCVER);
            // general purpose bit flag
            _localHeader.flags = data.readUInt16LE(Constants.LOCFLG);
            // compression method
            _localHeader.method = data.readUInt16LE(Constants.LOCHOW);
            // modification time (2 bytes time, 2 bytes date)
            _localHeader.time = data.readUInt32LE(Constants.LOCTIM);
            // uncompressed file crc-32 valu
            _localHeader.crc = data.readUInt32LE(Constants.LOCCRC);
            // compressed size
            _localHeader.compressedSize = data.readUInt32LE(Constants.LOCSIZ);
            // uncompressed size
            _localHeader.size = data.readUInt32LE(Constants.LOCLEN);
            // filename length
            _localHeader.fnameLen = data.readUInt16LE(Constants.LOCNAM);
            // extra field length
            _localHeader.extraLen = data.readUInt16LE(Constants.LOCEXT);

            // read extra data
            const extraStart = _offset + Constants.LOCHDR + _localHeader.fnameLen;
            const extraEnd = extraStart + _localHeader.extraLen;
            return input.slice(extraStart, extraEnd);
        },

        loadFromBinary: function (/*Buffer*/ data) {
            // data should be 46 bytes and start with "PK 01 02"
            if (data.length !== Constants.CENHDR || data.readUInt32LE(0) !== Constants.CENSIG) {
                throw Utils.Errors.INVALID_CEN();
            }
            // version made by
            _verMade = data.readUInt16LE(Constants.CENVEM);
            // version needed to extract
            _version = data.readUInt16LE(Constants.CENVER);
            // encrypt, decrypt flags
            _flags = data.readUInt16LE(Constants.CENFLG);
            // compression method
            _method = data.readUInt16LE(Constants.CENHOW);
            // modification time (2 bytes time, 2 bytes date)
            _time = data.readUInt32LE(Constants.CENTIM);
            // uncompressed file crc-32 value
            _crc = data.readUInt32LE(Constants.CENCRC);
            // compressed size
            _compressedSize = data.readUInt32LE(Constants.CENSIZ);
            // uncompressed size
            _size = data.readUInt32LE(Constants.CENLEN);
            // filename length
            _fnameLen = data.readUInt16LE(Constants.CENNAM);
            // extra field length
            _extraLen = data.readUInt16LE(Constants.CENEXT);
            // file comment length
            _comLen = data.readUInt16LE(Constants.CENCOM);
            // volume number start
            _diskStart = data.readUInt16LE(Constants.CENDSK);
            // internal file attributes
            _inattr = data.readUInt16LE(Constants.CENATT);
            // external file attributes
            _attr = data.readUInt32LE(Constants.CENATX);
            // LOC header offset
            _offset = data.readUInt32LE(Constants.CENOFF);
        },

        localHeaderToBinary: function () {
            // LOC header size (30 bytes)
            var data = Buffer.alloc(Constants.LOCHDR);
            // "PK\003\004"
            data.writeUInt32LE(Constants.LOCSIG, 0);
            // version needed to extract
            data.writeUInt16LE(_version, Constants.LOCVER);
            // general purpose bit flag
            data.writeUInt16LE(_flags, Constants.LOCFLG);
            // compression method
            data.writeUInt16LE(_method, Constants.LOCHOW);
            // modification time (2 bytes time, 2 bytes date)
            data.writeUInt32LE(_time, Constants.LOCTIM);
            // uncompressed file crc-32 value
            data.writeUInt32LE(_crc, Constants.LOCCRC);
            // compressed size
            data.writeUInt32LE(_compressedSize, Constants.LOCSIZ);
            // uncompressed size
            data.writeUInt32LE(_size, Constants.LOCLEN);
            // filename length
            data.writeUInt16LE(_fnameLen, Constants.LOCNAM);
            // extra field length
            data.writeUInt16LE(_localHeader.extraLen, Constants.LOCEXT);
            return data;
        },

        centralHeaderToBinary: function () {
            // CEN header size (46 bytes)
            var data = Buffer.alloc(Constants.CENHDR + _fnameLen + _extraLen + _comLen);
            // "PK\001\002"
            data.writeUInt32LE(Constants.CENSIG, 0);
            // version made by
            data.writeUInt16LE(_verMade, Constants.CENVEM);
            // version needed to extract
            data.writeUInt16LE(_version, Constants.CENVER);
            // encrypt, decrypt flags
            data.writeUInt16LE(_flags, Constants.CENFLG);
            // compression method
            data.writeUInt16LE(_method, Constants.CENHOW);
            // modification time (2 bytes time, 2 bytes date)
            data.writeUInt32LE(_time, Constants.CENTIM);
            // uncompressed file crc-32 value
            data.writeUInt32LE(_crc, Constants.CENCRC);
            // compressed size
            data.writeUInt32LE(_compressedSize, Constants.CENSIZ);
            // uncompressed size
            data.writeUInt32LE(_size, Constants.CENLEN);
            // filename length
            data.writeUInt16LE(_fnameLen, Constants.CENNAM);
            // extra field length
            data.writeUInt16LE(_extraLen, Constants.CENEXT);
            // file comment length
            data.writeUInt16LE(_comLen, Constants.CENCOM);
            // volume number start
            data.writeUInt16LE(_diskStart, Constants.CENDSK);
            // internal file attributes
            data.writeUInt16LE(_inattr, Constants.CENATT);
            // external file attributes
            data.writeUInt32LE(_attr, Constants.CENATX);
            // LOC header offset
            data.writeUInt32LE(_offset, Constants.CENOFF);
            return data;
        },

        toJSON: function () {
            const bytes = function (nr) {
                return nr + " bytes";
            };

            return {
                made: _verMade,
                version: _version,
                flags: _flags,
                method: Utils.methodToString(_method),
                time: this.time,
                crc: "0x" + _crc.toString(16).toUpperCase(),
                compressedSize: bytes(_compressedSize),
                size: bytes(_size),
                fileNameLength: bytes(_fnameLen),
                extraLength: bytes(_extraLen),
                commentLength: bytes(_comLen),
                diskNumStart: _diskStart,
                inAttr: _inattr,
                attr: _attr,
                offset: _offset,
                centralHeaderSize: bytes(Constants.CENHDR + _fnameLen + _extraLen + _comLen)
            };
        },

        toString: function () {
            return JSON.stringify(this.toJSON(), null, "\t");
        }
    };
};
exports.EntryHeader = require("./entryHeader");
exports.MainHeader = require("./mainHeader");
var Utils = require("../util"),
    Constants = Utils.Constants;

/* The entries in the end of central directory */
module.exports = function () {
    var _volumeEntries = 0,
        _totalEntries = 0,
        _size = 0,
        _offset = 0,
        _commentLength = 0;

    return {
        get diskEntries() {
            return _volumeEntries;
        },
        set diskEntries(/*Number*/ val) {
            _volumeEntries = _totalEntries = val;
        },

        get totalEntries() {
            return _totalEntries;
        },
        set totalEntries(/*Number*/ val) {
            _totalEntries = _volumeEntries = val;
        },

        get size() {
            return _size;
        },
        set size(/*Number*/ val) {
            _size = val;
        },

        get offset() {
            return _offset;
        },
        set offset(/*Number*/ val) {
            _offset = val;
        },

        get commentLength() {
            return _commentLength;
        },
        set commentLength(/*Number*/ val) {
            _commentLength = val;
        },

        get mainHeaderSize() {
            return Constants.ENDHDR + _commentLength;
        },

        loadFromBinary: function (/*Buffer*/ data) {
            // data should be 22 bytes and start with "PK 05 06"
            // or be 56+ bytes and start with "PK 06 06" for Zip64
            if (
                (data.length !== Constants.ENDHDR || data.readUInt32LE(0) !== Constants.ENDSIG) &&
                (data.length < Constants.ZIP64HDR || data.readUInt32LE(0) !== Constants.ZIP64SIG)
            ) {
                throw Utils.Errors.INVALID_END();
            }

            if (data.readUInt32LE(0) === Constants.ENDSIG) {
                // number of entries on this volume
                _volumeEntries = data.readUInt16LE(Constants.ENDSUB);
                // total number of entries
                _totalEntries = data.readUInt16LE(Constants.ENDTOT);
                // central directory size in bytes
                _size = data.readUInt32LE(Constants.ENDSIZ);
                // offset of first CEN header
                _offset = data.readUInt32LE(Constants.ENDOFF);
                // zip file comment length
                _commentLength = data.readUInt16LE(Constants.ENDCOM);
            } else {
                // number of entries on this volume
                _volumeEntries = Utils.readBigUInt64LE(data, Constants.ZIP64SUB);
                // total number of entries
                _totalEntries = Utils.readBigUInt64LE(data, Constants.ZIP64TOT);
                // central directory size in bytes
                _size = Utils.readBigUInt64LE(data, Constants.ZIP64SIZE);
                // offset of first CEN header
                _offset = Utils.readBigUInt64LE(data, Constants.ZIP64OFF);

                _commentLength = 0;
            }
        },

        toBinary: function () {
            var b = Buffer.alloc(Constants.ENDHDR + _commentLength);
            // "PK 05 06" signature
            b.writeUInt32LE(Constants.ENDSIG, 0);
            b.writeUInt32LE(0, 4);
            // number of entries on this volume
            b.writeUInt16LE(_volumeEntries, Constants.ENDSUB);
            // total number of entries
            b.writeUInt16LE(_totalEntries, Constants.ENDTOT);
            // central directory size in bytes
            b.writeUInt32LE(_size, Constants.ENDSIZ);
            // offset of first CEN header
            b.writeUInt32LE(_offset, Constants.ENDOFF);
            // zip file comment length
            b.writeUInt16LE(_commentLength, Constants.ENDCOM);
            // fill comment memory with spaces so no garbage is left there
            b.fill(" ", Constants.ENDHDR);

            return b;
        },

        toJSON: function () {
            // creates 0x0000 style output
            const offset = function (nr, len) {
                let offs = nr.toString(16).toUpperCase();
                while (offs.length < len) offs = "0" + offs;
                return "0x" + offs;
            };

            return {
                diskEntries: _volumeEntries,
                totalEntries: _totalEntries,
                size: _size + " bytes",
                offset: offset(_offset, 4),
                commentLength: _commentLength
            };
        },

        toString: function () {
            return JSON.stringify(this.toJSON(), null, "\t");
        }
    };
};
// Misspelled
The ISC License

Copyright (c) 2019 Elan Shanker, Paul Miller (https://paulmillr.com)

Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
'use strict';

Object.defineProperty(exports, "__esModule", { value: true });

const picomatch = require('picomatch');
const normalizePath = require('normalize-path');

/**
 * @typedef {(testString: string) => boolean} AnymatchFn
 * @typedef {string|RegExp|AnymatchFn} AnymatchPattern
 * @typedef {AnymatchPattern|AnymatchPattern[]} AnymatchMatcher
 */
const BANG = '!';
const DEFAULT_OPTIONS = {returnIndex: false};
const arrify = (item) => Array.isArray(item) ? item : [item];

/**
 * @param {AnymatchPattern} matcher
 * @param {object} options
 * @returns {AnymatchFn}
 */
const createPattern = (matcher, options) => {
  if (typeof matcher === 'function') {
    return matcher;
  }
  if (typeof matcher === 'string') {
    const glob = picomatch(matcher, options);
    return (string) => matcher === string || glob(string);
  }
  if (matcher instanceof RegExp) {
    return (string) => matcher.test(string);
  }
  return (string) => false;
};

/**
 * @param {Array<Function>} patterns
 * @param {Array<Function>} negPatterns
 * @param {String|Array} args
 * @param {Boolean} returnIndex
 * @returns {boolean|number}
 */
const matchPatterns = (patterns, negPatterns, args, returnIndex) => {
  const isList = Array.isArray(args);
  const _path = isList ? args[0] : args;
  if (!isList && typeof _path !== 'string') {
    throw new TypeError('anymatch: second argument must be a string: got ' +
      Object.prototype.toString.call(_path))
  }
  const path = normalizePath(_path, false);

  for (let index = 0; index < negPatterns.length; index++) {
    const nglob = negPatterns[index];
    if (nglob(path)) {
      return returnIndex ? -1 : false;
    }
  }

  const applied = isList && [path].concat(args.slice(1));
  for (let index = 0; index < patterns.length; index++) {
    const pattern = patterns[index];
    if (isList ? pattern(...applied) : pattern(path)) {
      return returnIndex ? index : true;
    }
  }

  return returnIndex ? -1 : false;
};

/**
 * @param {AnymatchMatcher} matchers
 * @param {Array|string} testString
 * @param {object} options
 * @returns {boolean|number|Function}
 */
const anymatch = (matchers, testString, options = DEFAULT_OPTIONS) => {
  if (matchers == null) {
    throw new TypeError('anymatch: specify first argument');
  }
  const opts = typeof options === 'boolean' ? {returnIndex: options} : options;
  const returnIndex = opts.returnIndex || false;

  // Early cache for matchers.
  const mtchers = arrify(matchers);
  const negatedGlobs = mtchers
    .filter(item => typeof item === 'string' && item.charAt(0) === BANG)
    .map(item => item.slice(1))
    .map(item => picomatch(item, opts));
  const patterns = mtchers
    .filter(item => typeof item !== 'string' || (typeof item === 'string' && item.charAt(0) !== BANG))
    .map(matcher => createPattern(matcher, opts));

  if (testString == null) {
    return (testString, ri = false) => {
      const returnIndex = typeof ri === 'boolean' ? ri : false;
      return matchPatterns(patterns, negatedGlobs, testString, returnIndex);
    }
  }

  return matchPatterns(patterns, negatedGlobs, testString, returnIndex);
};

anymatch.default = anymatch;
module.exports = anymatch;
{
  "name": "anymatch",
  "version": "3.1.3",
  "description": "Matches strings against configurable strings, globs, regular expressions, and/or functions",
  "files": [
    "index.js",
    "index.d.ts"
  ],
  "dependencies": {
    "normalize-path": "^3.0.0",
    "picomatch": "^2.0.4"
  },
  "author": {
    "name": "Elan Shanker",
    "url": "https://github.com/es128"
  },
  "license": "ISC",
  "homepage": "https://github.com/micromatch/anymatch",
  "repository": {
    "type": "git",
    "url": "https://github.com/micromatch/anymatch"
  },
  "devDependencies": {
    "mocha": "^6.1.3",
    "nyc": "^14.0.0"
  },
  "engines": {
    "node": ">= 8"
  }
}[
	"3dm",
	"3ds",
	"3g2",
	"3gp",
	"7z",
	"a",
	"aac",
	"adp",
	"afdesign",
	"afphoto",
	"afpub",
	"ai",
	"aif",
	"aiff",
	"alz",
	"ape",
	"apk",
	"appimage",
	"ar",
	"arj",
	"asf",
	"au",
	"avi",
	"bak",
	"baml",
	"bh",
	"bin",
	"bk",
	"bmp",
	"btif",
	"bz2",
	"bzip2",
	"cab",
	"caf",
	"cgm",
	"class",
	"cmx",
	"cpio",
	"cr2",
	"cur",
	"dat",
	"dcm",
	"deb",
	"dex",
	"djvu",
	"dll",
	"dmg",
	"dng",
	"doc",
	"docm",
	"docx",
	"dot",
	"dotm",
	"dra",
	"DS_Store",
	"dsk",
	"dts",
	"dtshd",
	"dvb",
	"dwg",
	"dxf",
	"ecelp4800",
	"ecelp7470",
	"ecelp9600",
	"egg",
	"eol",
	"eot",
	"epub",
	"exe",
	"f4v",
	"fbs",
	"fh",
	"fla",
	"flac",
	"flatpak",
	"fli",
	"flv",
	"fpx",
	"fst",
	"fvt",
	"g3",
	"gh",
	"gif",
	"graffle",
	"gz",
	"gzip",
	"h261",
	"h263",
	"h264",
	"icns",
	"ico",
	"ief",
	"img",
	"ipa",
	"iso",
	"jar",
	"jpeg",
	"jpg",
	"jpgv",
	"jpm",
	"jxr",
	"key",
	"ktx",
	"lha",
	"lib",
	"lvp",
	"lz",
	"lzh",
	"lzma",
	"lzo",
	"m3u",
	"m4a",
	"m4v",
	"mar",
	"mdi",
	"mht",
	"mid",
	"midi",
	"mj2",
	"mka",
	"mkv",
	"mmr",
	"mng",
	"mobi",
	"mov",
	"movie",
	"mp3",
	"mp4",
	"mp4a",
	"mpeg",
	"mpg",
	"mpga",
	"mxu",
	"nef",
	"npx",
	"numbers",
	"nupkg",
	"o",
	"odp",
	"ods",
	"odt",
	"oga",
	"ogg",
	"ogv",
	"otf",
	"ott",
	"pages",
	"pbm",
	"pcx",
	"pdb",
	"pdf",
	"pea",
	"pgm",
	"pic",
	"png",
	"pnm",
	"pot",
	"potm",
	"potx",
	"ppa",
	"ppam",
	"ppm",
	"pps",
	"ppsm",
	"ppsx",
	"ppt",
	"pptm",
	"pptx",
	"psd",
	"pya",
	"pyc",
	"pyo",
	"pyv",
	"qt",
	"rar",
	"ras",
	"raw",
	"resources",
	"rgb",
	"rip",
	"rlc",
	"rmf",
	"rmvb",
	"rpm",
	"rtf",
	"rz",
	"s3m",
	"s7z",
	"scpt",
	"sgi",
	"shar",
	"snap",
	"sil",
	"sketch",
	"slk",
	"smv",
	"snk",
	"so",
	"stl",
	"suo",
	"sub",
	"swf",
	"tar",
	"tbz",
	"tbz2",
	"tga",
	"tgz",
	"thmx",
	"tif",
	"tiff",
	"tlz",
	"ttc",
	"ttf",
	"txz",
	"udf",
	"uvh",
	"uvi",
	"uvm",
	"uvp",
	"uvs",
	"uvu",
	"viv",
	"vob",
	"war",
	"wav",
	"wax",
	"wbmp",
	"wdp",
	"weba",
	"webm",
	"webp",
	"whl",
	"wim",
	"wm",
	"wma",
	"wmv",
	"wmx",
	"woff",
	"woff2",
	"wrm",
	"wvx",
	"xbm",
	"xif",
	"xla",
	"xlam",
	"xls",
	"xlsb",
	"xlsm",
	"xlsx",
	"xlt",
	"xltm",
	"xltx",
	"xm",
	"xmind",
	"xpi",
	"xpm",
	"xwd",
	"xz",
	"z",
	"zip",
	"zipx"
]
module.exports = require('./binary-extensions.json');
MIT License

Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
Copyright (c) Paul Miller (https://paulmillr.com)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
{
  "name": "binary-extensions",
  "version": "2.3.0",
  "description": "List of binary file extensions",
  "license": "MIT",
  "repository": "sindresorhus/binary-extensions",
  "funding": "https://github.com/sponsors/sindresorhus",
  "author": {
    "name": "Sindre Sorhus",
    "email": "sindresorhus@gmail.com",
    "url": "https://sindresorhus.com"
  },
  "sideEffects": false,
  "engines": {
    "node": ">=8"
  },
  "files": [
    "index.js",
    "index.d.ts",
    "binary-extensions.json",
    "binary-extensions.json.d.ts"
  ],
  "devDependencies": {
    "ava": "^1.4.1",
    "tsd": "^0.7.2",
    "xo": "^0.24.0"
  }
}The MIT License (MIT)

Copyright (c) 2014-present, Jon Schlinkert.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
'use strict';

const stringify = require('./lib/stringify');
const compile = require('./lib/compile');
const expand = require('./lib/expand');
const parse = require('./lib/parse');

/**
 * Expand the given pattern or create a regex-compatible string.
 *
 * ```js
 * const braces = require('braces');
 * console.log(braces('{a,b,c}', { compile: true })); //=> ['(a|b|c)']
 * console.log(braces('{a,b,c}')); //=> ['a', 'b', 'c']
 * ```
 * @param {String} `str`
 * @param {Object} `options`
 * @return {String}
 * @api public
 */

const braces = (input, options = {}) => {
  let output = [];

  if (Array.isArray(input)) {
    for (const pattern of input) {
      const result = braces.create(pattern, options);
      if (Array.isArray(result)) {
        output.push(...result);
      } else {
        output.push(result);
      }
    }
  } else {
    output = [].concat(braces.create(input, options));
  }

  if (options && options.expand === true && options.nodupes === true) {
    output = [...new Set(output)];
  }
  return output;
};

/**
 * Parse the given `str` with the given `options`.
 *
 * ```js
 * // braces.parse(pattern, [, options]);
 * const ast = braces.parse('a/{b,c}/d');
 * console.log(ast);
 * ```
 * @param {String} pattern Brace pattern to parse
 * @param {Object} options
 * @return {Object} Returns an AST
 * @api public
 */

braces.parse = (input, options = {}) => parse(input, options);

/**
 * Creates a braces string from an AST, or an AST node.
 *
 * ```js
 * const braces = require('braces');
 * let ast = braces.parse('foo/{a,b}/bar');
 * console.log(stringify(ast.nodes[2])); //=> '{a,b}'
 * ```
 * @param {String} `input` Brace pattern or AST.
 * @param {Object} `options`
 * @return {Array} Returns an array of expanded values.
 * @api public
 */

braces.stringify = (input, options = {}) => {
  if (typeof input === 'string') {
    return stringify(braces.parse(input, options), options);
  }
  return stringify(input, options);
};

/**
 * Compiles a brace pattern into a regex-compatible, optimized string.
 * This method is called by the main [braces](#braces) function by default.
 *
 * ```js
 * const braces = require('braces');
 * console.log(braces.compile('a/{b,c}/d'));
 * //=> ['a/(b|c)/d']
 * ```
 * @param {String} `input` Brace pattern or AST.
 * @param {Object} `options`
 * @return {Array} Returns an array of expanded values.
 * @api public
 */

braces.compile = (input, options = {}) => {
  if (typeof input === 'string') {
    input = braces.parse(input, options);
  }
  return compile(input, options);
};

/**
 * Expands a brace pattern into an array. This method is called by the
 * main [braces](#braces) function when `options.expand` is true. Before
 * using this method it's recommended that you read the [performance notes](#performance))
 * and advantages of using [.compile](#compile) instead.
 *
 * ```js
 * const braces = require('braces');
 * console.log(braces.expand('a/{b,c}/d'));
 * //=> ['a/b/d', 'a/c/d'];
 * ```
 * @param {String} `pattern` Brace pattern
 * @param {Object} `options`
 * @return {Array} Returns an array of expanded values.
 * @api public
 */

braces.expand = (input, options = {}) => {
  if (typeof input === 'string') {
    input = braces.parse(input, options);
  }

  let result = expand(input, options);

  // filter out empty strings if specified
  if (options.noempty === true) {
    result = result.filter(Boolean);
  }

  // filter out duplicates if specified
  if (options.nodupes === true) {
    result = [...new Set(result)];
  }

  return result;
};

/**
 * Processes a brace pattern and returns either an expanded array
 * (if `options.expand` is true), a highly optimized regex-compatible string.
 * This method is called by the main [braces](#braces) function.
 *
 * ```js
 * const braces = require('braces');
 * console.log(braces.create('user-{200..300}/project-{a,b,c}-{1..10}'))
 * //=> 'user-(20[0-9]|2[1-9][0-9]|300)/project-(a|b|c)-([1-9]|10)'
 * ```
 * @param {String} `pattern` Brace pattern
 * @param {Object} `options`
 * @return {Array} Returns an array of expanded values.
 * @api public
 */

braces.create = (input, options = {}) => {
  if (input === '' || input.length < 3) {
    return [input];
  }

  return options.expand !== true
    ? braces.compile(input, options)
    : braces.expand(input, options);
};

/**
 * Expose "braces"
 */

module.exports = braces;
{
  "name": "braces",
  "description": "Bash-like brace expansion, implemented in JavaScript. Safer than other brace expansion libs, with complete support for the Bash 4.3 braces specification, without sacrificing speed.",
  "version": "3.0.3",
  "homepage": "https://github.com/micromatch/braces",
  "author": "Jon Schlinkert (https://github.com/jonschlinkert)",
  "repository": "micromatch/braces",
  "license": "MIT",
  "files": [
    "index.js",
    "lib"
  ],
  "main": "index.js",
  "engines": {
    "node": ">=8"
  },
  "dependencies": {
    "fill-range": "^7.1.1"
  },
  "devDependencies": {
    "ansi-colors": "^3.2.4",
    "bash-path": "^2.0.1",
    "gulp-format-md": "^2.0.0",
    "mocha": "^6.1.1"
  },
  "verb": {
    "toc": false,
    "layout": "default",
    "tasks": [
      "readme"
    ],
    "lint": {
      "reflinks": true
    },
    "plugins": [
      "gulp-format-md"
    ]
  }
}'use strict';

const fill = require('fill-range');
const utils = require('./utils');

const compile = (ast, options = {}) => {
  const walk = (node, parent = {}) => {
    const invalidBlock = utils.isInvalidBrace(parent);
    const invalidNode = node.invalid === true && options.escapeInvalid === true;
    const invalid = invalidBlock === true || invalidNode === true;
    const prefix = options.escapeInvalid === true ? '\\' : '';
    let output = '';

    if (node.isOpen === true) {
      return prefix + node.value;
    }

    if (node.isClose === true) {
      console.log('node.isClose', prefix, node.value);
      return prefix + node.value;
    }

    if (node.type === 'open') {
      return invalid ? prefix + node.value : '(';
    }

    if (node.type === 'close') {
      return invalid ? prefix + node.value : ')';
    }

    if (node.type === 'comma') {
      return node.prev.type === 'comma' ? '' : invalid ? node.value : '|';
    }

    if (node.value) {
      return node.value;
    }

    if (node.nodes && node.ranges > 0) {
      const args = utils.reduce(node.nodes);
      const range = fill(...args, { ...options, wrap: false, toRegex: true, strictZeros: true });

      if (range.length !== 0) {
        return args.length > 1 && range.length > 1 ? `(${range})` : range;
      }
    }

    if (node.nodes) {
      for (const child of node.nodes) {
        output += walk(child, node);
      }
    }

    return output;
  };

  return walk(ast);
};

module.exports = compile;
'use strict';

module.exports = {
  MAX_LENGTH: 10000,

  // Digits
  CHAR_0: '0', /* 0 */
  CHAR_9: '9', /* 9 */

  // Alphabet chars.
  CHAR_UPPERCASE_A: 'A', /* A */
  CHAR_LOWERCASE_A: 'a', /* a */
  CHAR_UPPERCASE_Z: 'Z', /* Z */
  CHAR_LOWERCASE_Z: 'z', /* z */

  CHAR_LEFT_PARENTHESES: '(', /* ( */
  CHAR_RIGHT_PARENTHESES: ')', /* ) */

  CHAR_ASTERISK: '*', /* * */

  // Non-alphabetic chars.
  CHAR_AMPERSAND: '&', /* & */
  CHAR_AT: '@', /* @ */
  CHAR_BACKSLASH: '\\', /* \ */
  CHAR_BACKTICK: '`', /* ` */
  CHAR_CARRIAGE_RETURN: '\r', /* \r */
  CHAR_CIRCUMFLEX_ACCENT: '^', /* ^ */
  CHAR_COLON: ':', /* : */
  CHAR_COMMA: ',', /* , */
  CHAR_DOLLAR: '$', /* . */
  CHAR_DOT: '.', /* . */
  CHAR_DOUBLE_QUOTE: '"', /* " */
  CHAR_EQUAL: '=', /* = */
  CHAR_EXCLAMATION_MARK: '!', /* ! */
  CHAR_FORM_FEED: '\f', /* \f */
  CHAR_FORWARD_SLASH: '/', /* / */
  CHAR_HASH: '#', /* # */
  CHAR_HYPHEN_MINUS: '-', /* - */
  CHAR_LEFT_ANGLE_BRACKET: '<', /* < */
  CHAR_LEFT_CURLY_BRACE: '{', /* { */
  CHAR_LEFT_SQUARE_BRACKET: '[', /* [ */
  CHAR_LINE_FEED: '\n', /* \n */
  CHAR_NO_BREAK_SPACE: '\u00A0', /* \u00A0 */
  CHAR_PERCENT: '%', /* % */
  CHAR_PLUS: '+', /* + */
  CHAR_QUESTION_MARK: '?', /* ? */
  CHAR_RIGHT_ANGLE_BRACKET: '>', /* > */
  CHAR_RIGHT_CURLY_BRACE: '}', /* } */
  CHAR_RIGHT_SQUARE_BRACKET: ']', /* ] */
  CHAR_SEMICOLON: ';', /* ; */
  CHAR_SINGLE_QUOTE: '\'', /* ' */
  CHAR_SPACE: ' ', /*   */
  CHAR_TAB: '\t', /* \t */
  CHAR_UNDERSCORE: '_', /* _ */
  CHAR_VERTICAL_LINE: '|', /* | */
  CHAR_ZERO_WIDTH_NOBREAK_SPACE: '\uFEFF' /* \uFEFF */
};
'use strict';

const fill = require('fill-range');
const stringify = require('./stringify');
const utils = require('./utils');

const append = (queue = '', stash = '', enclose = false) => {
  const result = [];

  queue = [].concat(queue);
  stash = [].concat(stash);

  if (!stash.length) return queue;
  if (!queue.length) {
    return enclose ? utils.flatten(stash).map(ele => `{${ele}}`) : stash;
  }

  for (const item of queue) {
    if (Array.isArray(item)) {
      for (const value of item) {
        result.push(append(value, stash, enclose));
      }
    } else {
      for (let ele of stash) {
        if (enclose === true && typeof ele === 'string') ele = `{${ele}}`;
        result.push(Array.isArray(ele) ? append(item, ele, enclose) : item + ele);
      }
    }
  }
  return utils.flatten(result);
};

const expand = (ast, options = {}) => {
  const rangeLimit = options.rangeLimit === undefined ? 1000 : options.rangeLimit;

  const walk = (node, parent = {}) => {
    node.queue = [];

    let p = parent;
    let q = parent.queue;

    while (p.type !== 'brace' && p.type !== 'root' && p.parent) {
      p = p.parent;
      q = p.queue;
    }

    if (node.invalid || node.dollar) {
      q.push(append(q.pop(), stringify(node, options)));
      return;
    }

    if (node.type === 'brace' && node.invalid !== true && node.nodes.length === 2) {
      q.push(append(q.pop(), ['{}']));
      return;
    }

    if (node.nodes && node.ranges > 0) {
      const args = utils.reduce(node.nodes);

      if (utils.exceedsLimit(...args, options.step, rangeLimit)) {
        throw new RangeError('expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.');
      }

      let range = fill(...args, options);
      if (range.length === 0) {
        range = stringify(node, options);
      }

      q.push(append(q.pop(), range));
      node.nodes = [];
      return;
    }

    const enclose = utils.encloseBrace(node);
    let queue = node.queue;
    let block = node;

    while (block.type !== 'brace' && block.type !== 'root' && block.parent) {
      block = block.parent;
      queue = block.queue;
    }

    for (let i = 0; i < node.nodes.length; i++) {
      const child = node.nodes[i];

      if (child.type === 'comma' && node.type === 'brace') {
        if (i === 1) queue.push('');
        queue.push('');
        continue;
      }

      if (child.type === 'close') {
        q.push(append(q.pop(), queue, enclose));
        continue;
      }

      if (child.value && child.type !== 'open') {
        queue.push(append(queue.pop(), child.value));
        continue;
      }

      if (child.nodes) {
        walk(child, node);
      }
    }

    return queue;
  };

  return utils.flatten(walk(ast));
};

module.exports = expand;
'use strict';

const stringify = require('./stringify');

/**
 * Constants
 */

const {
  MAX_LENGTH,
  CHAR_BACKSLASH, /* \ */
  CHAR_BACKTICK, /* ` */
  CHAR_COMMA, /* , */
  CHAR_DOT, /* . */
  CHAR_LEFT_PARENTHESES, /* ( */
  CHAR_RIGHT_PARENTHESES, /* ) */
  CHAR_LEFT_CURLY_BRACE, /* { */
  CHAR_RIGHT_CURLY_BRACE, /* } */
  CHAR_LEFT_SQUARE_BRACKET, /* [ */
  CHAR_RIGHT_SQUARE_BRACKET, /* ] */
  CHAR_DOUBLE_QUOTE, /* " */
  CHAR_SINGLE_QUOTE, /* ' */
  CHAR_NO_BREAK_SPACE,
  CHAR_ZERO_WIDTH_NOBREAK_SPACE
} = require('./constants');

/**
 * parse
 */

const parse = (input, options = {}) => {
  if (typeof input !== 'string') {
    throw new TypeError('Expected a string');
  }

  const opts = options || {};
  const max = typeof opts.maxLength === 'number' ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
  if (input.length > max) {
    throw new SyntaxError(`Input length (${input.length}), exceeds max characters (${max})`);
  }

  const ast = { type: 'root', input, nodes: [] };
  const stack = [ast];
  let block = ast;
  let prev = ast;
  let brackets = 0;
  const length = input.length;
  let index = 0;
  let depth = 0;
  let value;

  /**
   * Helpers
   */

  const advance = () => input[index++];
  const push = node => {
    if (node.type === 'text' && prev.type === 'dot') {
      prev.type = 'text';
    }

    if (prev && prev.type === 'text' && node.type === 'text') {
      prev.value += node.value;
      return;
    }

    block.nodes.push(node);
    node.parent = block;
    node.prev = prev;
    prev = node;
    return node;
  };

  push({ type: 'bos' });

  while (index < length) {
    block = stack[stack.length - 1];
    value = advance();

    /**
     * Invalid chars
     */

    if (value === CHAR_ZERO_WIDTH_NOBREAK_SPACE || value === CHAR_NO_BREAK_SPACE) {
      continue;
    }

    /**
     * Escaped chars
     */

    if (value === CHAR_BACKSLASH) {
      push({ type: 'text', value: (options.keepEscaping ? value : '') + advance() });
      continue;
    }

    /**
     * Right square bracket (literal): ']'
     */

    if (value === CHAR_RIGHT_SQUARE_BRACKET) {
      push({ type: 'text', value: '\\' + value });
      continue;
    }

    /**
     * Left square bracket: '['
     */

    if (value === CHAR_LEFT_SQUARE_BRACKET) {
      brackets++;

      let next;

      while (index < length && (next = advance())) {
        value += next;

        if (next === CHAR_LEFT_SQUARE_BRACKET) {
          brackets++;
          continue;
        }

        if (next === CHAR_BACKSLASH) {
          value += advance();
          continue;
        }

        if (next === CHAR_RIGHT_SQUARE_BRACKET) {
          brackets--;

          if (brackets === 0) {
            break;
          }
        }
      }

      push({ type: 'text', value });
      continue;
    }

    /**
     * Parentheses
     */

    if (value === CHAR_LEFT_PARENTHESES) {
      block = push({ type: 'paren', nodes: [] });
      stack.push(block);
      push({ type: 'text', value });
      continue;
    }

    if (value === CHAR_RIGHT_PARENTHESES) {
      if (block.type !== 'paren') {
        push({ type: 'text', value });
        continue;
      }
      block = stack.pop();
      push({ type: 'text', value });
      block = stack[stack.length - 1];
      continue;
    }

    /**
     * Quotes: '|"|`
     */

    if (value === CHAR_DOUBLE_QUOTE || value === CHAR_SINGLE_QUOTE || value === CHAR_BACKTICK) {
      const open = value;
      let next;

      if (options.keepQuotes !== true) {
        value = '';
      }

      while (index < length && (next = advance())) {
        if (next === CHAR_BACKSLASH) {
          value += next + advance();
          continue;
        }

        if (next === open) {
          if (options.keepQuotes === true) value += next;
          break;
        }

        value += next;
      }

      push({ type: 'text', value });
      continue;
    }

    /**
     * Left curly brace: '{'
     */

    if (value === CHAR_LEFT_CURLY_BRACE) {
      depth++;

      const dollar = prev.value && prev.value.slice(-1) === '$' || block.dollar === true;
      const brace = {
        type: 'brace',
        open: true,
        close: false,
        dollar,
        depth,
        commas: 0,
        ranges: 0,
        nodes: []
      };

      block = push(brace);
      stack.push(block);
      push({ type: 'open', value });
      continue;
    }

    /**
     * Right curly brace: '}'
     */

    if (value === CHAR_RIGHT_CURLY_BRACE) {
      if (block.type !== 'brace') {
        push({ type: 'text', value });
        continue;
      }

      const type = 'close';
      block = stack.pop();
      block.close = true;

      push({ type, value });
      depth--;

      block = stack[stack.length - 1];
      continue;
    }

    /**
     * Comma: ','
     */

    if (value === CHAR_COMMA && depth > 0) {
      if (block.ranges > 0) {
        block.ranges = 0;
        const open = block.nodes.shift();
        block.nodes = [open, { type: 'text', value: stringify(block) }];
      }

      push({ type: 'comma', value });
      block.commas++;
      continue;
    }

    /**
     * Dot: '.'
     */

    if (value === CHAR_DOT && depth > 0 && block.commas === 0) {
      const siblings = block.nodes;

      if (depth === 0 || siblings.length === 0) {
        push({ type: 'text', value });
        continue;
      }

      if (prev.type === 'dot') {
        block.range = [];
        prev.value += value;
        prev.type = 'range';

        if (block.nodes.length !== 3 && block.nodes.length !== 5) {
          block.invalid = true;
          block.ranges = 0;
          prev.type = 'text';
          continue;
        }

        block.ranges++;
        block.args = [];
        continue;
      }

      if (prev.type === 'range') {
        siblings.pop();

        const before = siblings[siblings.length - 1];
        before.value += prev.value + value;
        prev = before;
        block.ranges--;
        continue;
      }

      push({ type: 'dot', value });
      continue;
    }

    /**
     * Text
     */

    push({ type: 'text', value });
  }

  // Mark imbalanced braces and brackets as invalid
  do {
    block = stack.pop();

    if (block.type !== 'root') {
      block.nodes.forEach(node => {
        if (!node.nodes) {
          if (node.type === 'open') node.isOpen = true;
          if (node.type === 'close') node.isClose = true;
          if (!node.nodes) node.type = 'text';
          node.invalid = true;
        }
      });

      // get the location of the block on parent.nodes (block's siblings)
      const parent = stack[stack.length - 1];
      const index = parent.nodes.indexOf(block);
      // replace the (invalid) block with it's nodes
      parent.nodes.splice(index, 1, ...block.nodes);
    }
  } while (stack.length > 0);

  push({ type: 'eos' });
  return ast;
};

module.exports = parse;
'use strict';

const utils = require('./utils');

module.exports = (ast, options = {}) => {
  const stringify = (node, parent = {}) => {
    const invalidBlock = options.escapeInvalid && utils.isInvalidBrace(parent);
    const invalidNode = node.invalid === true && options.escapeInvalid === true;
    let output = '';

    if (node.value) {
      if ((invalidBlock || invalidNode) && utils.isOpenOrClose(node)) {
        return '\\' + node.value;
      }
      return node.value;
    }

    if (node.value) {
      return node.value;
    }

    if (node.nodes) {
      for (const child of node.nodes) {
        output += stringify(child);
      }
    }
    return output;
  };

  return stringify(ast);
};

'use strict';

exports.isInteger = num => {
  if (typeof num === 'number') {
    return Number.isInteger(num);
  }
  if (typeof num === 'string' && num.trim() !== '') {
    return Number.isInteger(Number(num));
  }
  return false;
};

/**
 * Find a node of the given type
 */

exports.find = (node, type) => node.nodes.find(node => node.type === type);

/**
 * Find a node of the given type
 */

exports.exceedsLimit = (min, max, step = 1, limit) => {
  if (limit === false) return false;
  if (!exports.isInteger(min) || !exports.isInteger(max)) return false;
  return ((Number(max) - Number(min)) / Number(step)) >= limit;
};

/**
 * Escape the given node with '\\' before node.value
 */

exports.escapeNode = (block, n = 0, type) => {
  const node = block.nodes[n];
  if (!node) return;

  if ((type && node.type === type) || node.type === 'open' || node.type === 'close') {
    if (node.escaped !== true) {
      node.value = '\\' + node.value;
      node.escaped = true;
    }
  }
};

/**
 * Returns true if the given brace node should be enclosed in literal braces
 */

exports.encloseBrace = node => {
  if (node.type !== 'brace') return false;
  if ((node.commas >> 0 + node.ranges >> 0) === 0) {
    node.invalid = true;
    return true;
  }
  return false;
};

/**
 * Returns true if a brace node is invalid.
 */

exports.isInvalidBrace = block => {
  if (block.type !== 'brace') return false;
  if (block.invalid === true || block.dollar) return true;
  if ((block.commas >> 0 + block.ranges >> 0) === 0) {
    block.invalid = true;
    return true;
  }
  if (block.open !== true || block.close !== true) {
    block.invalid = true;
    return true;
  }
  return false;
};

/**
 * Returns true if a node is an open or close node
 */

exports.isOpenOrClose = node => {
  if (node.type === 'open' || node.type === 'close') {
    return true;
  }
  return node.open === true || node.close === true;
};

/**
 * Reduce an array of text nodes.
 */

exports.reduce = nodes => nodes.reduce((acc, node) => {
  if (node.type === 'text') acc.push(node.value);
  if (node.type === 'range') node.type = 'text';
  return acc;
}, []);

/**
 * Flatten an array
 */

exports.flatten = (...args) => {
  const result = [];

  const flat = arr => {
    for (let i = 0; i < arr.length; i++) {
      const ele = arr[i];

      if (Array.isArray(ele)) {
        flat(ele);
        continue;
      }

      if (ele !== undefined) {
        result.push(ele);
      }
    }
    return result;
  };

  flat(args);
  return result;
};
The MIT License (MIT)

Copyright (c) 2012-2019 Paul Miller (https://paulmillr.com), Elan Shanker

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the “Software”), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
'use strict';

const { EventEmitter } = require('events');
const fs = require('fs');
const sysPath = require('path');
const { promisify } = require('util');
const readdirp = require('readdirp');
const anymatch = require('anymatch').default;
const globParent = require('glob-parent');
const isGlob = require('is-glob');
const braces = require('braces');
const normalizePath = require('normalize-path');

const NodeFsHandler = require('./lib/nodefs-handler');
const FsEventsHandler = require('./lib/fsevents-handler');
const {
  EV_ALL,
  EV_READY,
  EV_ADD,
  EV_CHANGE,
  EV_UNLINK,
  EV_ADD_DIR,
  EV_UNLINK_DIR,
  EV_RAW,
  EV_ERROR,

  STR_CLOSE,
  STR_END,

  BACK_SLASH_RE,
  DOUBLE_SLASH_RE,
  SLASH_OR_BACK_SLASH_RE,
  DOT_RE,
  REPLACER_RE,

  SLASH,
  SLASH_SLASH,
  BRACE_START,
  BANG,
  ONE_DOT,
  TWO_DOTS,
  GLOBSTAR,
  SLASH_GLOBSTAR,
  ANYMATCH_OPTS,
  STRING_TYPE,
  FUNCTION_TYPE,
  EMPTY_STR,
  EMPTY_FN,

  isWindows,
  isMacos,
  isIBMi
} = require('./lib/constants');

const stat = promisify(fs.stat);
const readdir = promisify(fs.readdir);

/**
 * @typedef {String} Path
 * @typedef {'all'|'add'|'addDir'|'change'|'unlink'|'unlinkDir'|'raw'|'error'|'ready'} EventName
 * @typedef {'readdir'|'watch'|'add'|'remove'|'change'} ThrottleType
 */

/**
 *
 * @typedef {Object} WatchHelpers
 * @property {Boolean} followSymlinks
 * @property {'stat'|'lstat'} statMethod
 * @property {Path} path
 * @property {Path} watchPath
 * @property {Function} entryPath
 * @property {Boolean} hasGlob
 * @property {Object} globFilter
 * @property {Function} filterPath
 * @property {Function} filterDir
 */

const arrify = (value = []) => Array.isArray(value) ? value : [value];
const flatten = (list, result = []) => {
  list.forEach(item => {
    if (Array.isArray(item)) {
      flatten(item, result);
    } else {
      result.push(item);
    }
  });
  return result;
};

const unifyPaths = (paths_) => {
  /**
   * @type {Array<String>}
   */
  const paths = flatten(arrify(paths_));
  if (!paths.every(p => typeof p === STRING_TYPE)) {
    throw new TypeError(`Non-string provided as watch path: ${paths}`);
  }
  return paths.map(normalizePathToUnix);
};

// If SLASH_SLASH occurs at the beginning of path, it is not replaced
//     because "//StoragePC/DrivePool/Movies" is a valid network path
const toUnix = (string) => {
  let str = string.replace(BACK_SLASH_RE, SLASH);
  let prepend = false;
  if (str.startsWith(SLASH_SLASH)) {
    prepend = true;
  }
  while (str.match(DOUBLE_SLASH_RE)) {
    str = str.replace(DOUBLE_SLASH_RE, SLASH);
  }
  if (prepend) {
    str = SLASH + str;
  }
  return str;
};

// Our version of upath.normalize
// TODO: this is not equal to path-normalize module - investigate why
const normalizePathToUnix = (path) => toUnix(sysPath.normalize(toUnix(path)));

const normalizeIgnored = (cwd = EMPTY_STR) => (path) => {
  if (typeof path !== STRING_TYPE) return path;
  return normalizePathToUnix(sysPath.isAbsolute(path) ? path : sysPath.join(cwd, path));
};

const getAbsolutePath = (path, cwd) => {
  if (sysPath.isAbsolute(path)) {
    return path;
  }
  if (path.startsWith(BANG)) {
    return BANG + sysPath.join(cwd, path.slice(1));
  }
  return sysPath.join(cwd, path);
};

const undef = (opts, key) => opts[key] === undefined;

/**
 * Directory entry.
 * @property {Path} path
 * @property {Set<Path>} items
 */
class DirEntry {
  /**
   * @param {Path} dir
   * @param {Function} removeWatcher
   */
  constructor(dir, removeWatcher) {
    this.path = dir;
    this._removeWatcher = removeWatcher;
    /** @type {Set<Path>} */
    this.items = new Set();
  }

  add(item) {
    const {items} = this;
    if (!items) return;
    if (item !== ONE_DOT && item !== TWO_DOTS) items.add(item);
  }

  async remove(item) {
    const {items} = this;
    if (!items) return;
    items.delete(item);
    if (items.size > 0) return;

    const dir = this.path;
    try {
      await readdir(dir);
    } catch (err) {
      if (this._removeWatcher) {
        this._removeWatcher(sysPath.dirname(dir), sysPath.basename(dir));
      }
    }
  }

  has(item) {
    const {items} = this;
    if (!items) return;
    return items.has(item);
  }

  /**
   * @returns {Array<String>}
   */
  getChildren() {
    const {items} = this;
    if (!items) return;
    return [...items.values()];
  }

  dispose() {
    this.items.clear();
    delete this.path;
    delete this._removeWatcher;
    delete this.items;
    Object.freeze(this);
  }
}

const STAT_METHOD_F = 'stat';
const STAT_METHOD_L = 'lstat';
class WatchHelper {
  constructor(path, watchPath, follow, fsw) {
    this.fsw = fsw;
    this.path = path = path.replace(REPLACER_RE, EMPTY_STR);
    this.watchPath = watchPath;
    this.fullWatchPath = sysPath.resolve(watchPath);
    this.hasGlob = watchPath !== path;
    /** @type {object|boolean} */
    if (path === EMPTY_STR) this.hasGlob = false;
    this.globSymlink = this.hasGlob && follow ? undefined : false;
    this.globFilter = this.hasGlob ? anymatch(path, undefined, ANYMATCH_OPTS) : false;
    this.dirParts = this.getDirParts(path);
    this.dirParts.forEach((parts) => {
      if (parts.length > 1) parts.pop();
    });
    this.followSymlinks = follow;
    this.statMethod = follow ? STAT_METHOD_F : STAT_METHOD_L;
  }

  checkGlobSymlink(entry) {
    // only need to resolve once
    // first entry should always have entry.parentDir === EMPTY_STR
    if (this.globSymlink === undefined) {
      this.globSymlink = entry.fullParentDir === this.fullWatchPath ?
        false : {realPath: entry.fullParentDir, linkPath: this.fullWatchPath};
    }

    if (this.globSymlink) {
      return entry.fullPath.replace(this.globSymlink.realPath, this.globSymlink.linkPath);
    }

    return entry.fullPath;
  }

  entryPath(entry) {
    return sysPath.join(this.watchPath,
      sysPath.relative(this.watchPath, this.checkGlobSymlink(entry))
    );
  }

  filterPath(entry) {
    const {stats} = entry;
    if (stats && stats.isSymbolicLink()) return this.filterDir(entry);
    const resolvedPath = this.entryPath(entry);
    const matchesGlob = this.hasGlob && typeof this.globFilter === FUNCTION_TYPE ?
      this.globFilter(resolvedPath) : true;
    return matchesGlob &&
      this.fsw._isntIgnored(resolvedPath, stats) &&
      this.fsw._hasReadPermissions(stats);
  }

  getDirParts(path) {
    if (!this.hasGlob) return [];
    const parts = [];
    const expandedPath = path.includes(BRACE_START) ? braces.expand(path) : [path];
    expandedPath.forEach((path) => {
      parts.push(sysPath.relative(this.watchPath, path).split(SLASH_OR_BACK_SLASH_RE));
    });
    return parts;
  }

  filterDir(entry) {
    if (this.hasGlob) {
      const entryParts = this.getDirParts(this.checkGlobSymlink(entry));
      let globstar = false;
      this.unmatchedGlob = !this.dirParts.some((parts) => {
        return parts.every((part, i) => {
          if (part === GLOBSTAR) globstar = true;
          return globstar || !entryParts[0][i] || anymatch(part, entryParts[0][i], ANYMATCH_OPTS);
        });
      });
    }
    return !this.unmatchedGlob && this.fsw._isntIgnored(this.entryPath(entry), entry.stats);
  }
}

/**
 * Watches files & directories for changes. Emitted events:
 * `add`, `addDir`, `change`, `unlink`, `unlinkDir`, `all`, `error`
 *
 *     new FSWatcher()
 *       .add(directories)
 *       .on('add', path => log('File', path, 'was added'))
 */
class FSWatcher extends EventEmitter {
// Not indenting methods for history sake; for now.
constructor(_opts) {
  super();

  const opts = {};
  if (_opts) Object.assign(opts, _opts); // for frozen objects

  /** @type {Map<String, DirEntry>} */
  this._watched = new Map();
  /** @type {Map<String, Array>} */
  this._closers = new Map();
  /** @type {Set<String>} */
  this._ignoredPaths = new Set();

  /** @type {Map<ThrottleType, Map>} */
  this._throttled = new Map();

  /** @type {Map<Path, String|Boolean>} */
  this._symlinkPaths = new Map();

  this._streams = new Set();
  this.closed = false;

  // Set up default options.
  if (undef(opts, 'persistent')) opts.persistent = true;
  if (undef(opts, 'ignoreInitial')) opts.ignoreInitial = false;
  if (undef(opts, 'ignorePermissionErrors')) opts.ignorePermissionErrors = false;
  if (undef(opts, 'interval')) opts.interval = 100;
  if (undef(opts, 'binaryInterval')) opts.binaryInterval = 300;
  if (undef(opts, 'disableGlobbing')) opts.disableGlobbing = false;
  opts.enableBinaryInterval = opts.binaryInterval !== opts.interval;

  // Enable fsevents on OS X when polling isn't explicitly enabled.
  if (undef(opts, 'useFsEvents')) opts.useFsEvents = !opts.usePolling;

  // If we can't use fsevents, ensure the options reflect it's disabled.
  const canUseFsEvents = FsEventsHandler.canUse();
  if (!canUseFsEvents) opts.useFsEvents = false;

  // Use polling on Mac if not using fsevents.
  // Other platforms use non-polling fs_watch.
  if (undef(opts, 'usePolling') && !opts.useFsEvents) {
    opts.usePolling = isMacos;
  }

  // Always default to polling on IBM i because fs.watch() is not available on IBM i.
  if(isIBMi) {
    opts.usePolling = true;
  }

  // Global override (useful for end-developers that need to force polling for all
  // instances of chokidar, regardless of usage/dependency depth)
  const envPoll = process.env.CHOKIDAR_USEPOLLING;
  if (envPoll !== undefined) {
    const envLower = envPoll.toLowerCase();

    if (envLower === 'false' || envLower === '0') {
      opts.usePolling = false;
    } else if (envLower === 'true' || envLower === '1') {
      opts.usePolling = true;
    } else {
      opts.usePolling = !!envLower;
    }
  }
  const envInterval = process.env.CHOKIDAR_INTERVAL;
  if (envInterval) {
    opts.interval = Number.parseInt(envInterval, 10);
  }

  // Editor atomic write normalization enabled by default with fs.watch
  if (undef(opts, 'atomic')) opts.atomic = !opts.usePolling && !opts.useFsEvents;
  if (opts.atomic) this._pendingUnlinks = new Map();

  if (undef(opts, 'followSymlinks')) opts.followSymlinks = true;

  if (undef(opts, 'awaitWriteFinish')) opts.awaitWriteFinish = false;
  if (opts.awaitWriteFinish === true) opts.awaitWriteFinish = {};
  const awf = opts.awaitWriteFinish;
  if (awf) {
    if (!awf.stabilityThreshold) awf.stabilityThreshold = 2000;
    if (!awf.pollInterval) awf.pollInterval = 100;
    this._pendingWrites = new Map();
  }
  if (opts.ignored) opts.ignored = arrify(opts.ignored);

  let readyCalls = 0;
  this._emitReady = () => {
    readyCalls++;
    if (readyCalls >= this._readyCount) {
      this._emitReady = EMPTY_FN;
      this._readyEmitted = true;
      // use process.nextTick to allow time for listener to be bound
      process.nextTick(() => this.emit(EV_READY));
    }
  };
  this._emitRaw = (...args) => this.emit(EV_RAW, ...args);
  this._readyEmitted = false;
  this.options = opts;

  // Initialize with proper watcher.
  if (opts.useFsEvents) {
    this._fsEventsHandler = new FsEventsHandler(this);
  } else {
    this._nodeFsHandler = new NodeFsHandler(this);
  }

  // You’re frozen when your heart’s not open.
  Object.freeze(opts);
}

// Public methods

/**
 * Adds paths to be watched on an existing FSWatcher instance
 * @param {Path|Array<Path>} paths_
 * @param {String=} _origAdd private; for handling non-existent paths to be watched
 * @param {Boolean=} _internal private; indicates a non-user add
 * @returns {FSWatcher} for chaining
 */
add(paths_, _origAdd, _internal) {
  const {cwd, disableGlobbing} = this.options;
  this.closed = false;
  let paths = unifyPaths(paths_);
  if (cwd) {
    paths = paths.map((path) => {
      const absPath = getAbsolutePath(path, cwd);

      // Check `path` instead of `absPath` because the cwd portion can't be a glob
      if (disableGlobbing || !isGlob(path)) {
        return absPath;
      }
      return normalizePath(absPath);
    });
  }

  // set aside negated glob strings
  paths = paths.filter((path) => {
    if (path.startsWith(BANG)) {
      this._ignoredPaths.add(path.slice(1));
      return false;
    }

    // if a path is being added that was previously ignored, stop ignoring it
    this._ignoredPaths.delete(path);
    this._ignoredPaths.delete(path + SLASH_GLOBSTAR);

    // reset the cached userIgnored anymatch fn
    // to make ignoredPaths changes effective
    this._userIgnored = undefined;

    return true;
  });

  if (this.options.useFsEvents && this._fsEventsHandler) {
    if (!this._readyCount) this._readyCount = paths.length;
    if (this.options.persistent) this._readyCount += paths.length;
    paths.forEach((path) => this._fsEventsHandler._addToFsEvents(path));
  } else {
    if (!this._readyCount) this._readyCount = 0;
    this._readyCount += paths.length;
    Promise.all(
      paths.map(async path => {
        const res = await this._nodeFsHandler._addToNodeFs(path, !_internal, 0, 0, _origAdd);
        if (res) this._emitReady();
        return res;
      })
    ).then(results => {
      if (this.closed) return;
      results.filter(item => item).forEach(item => {
        this.add(sysPath.dirname(item), sysPath.basename(_origAdd || item));
      });
    });
  }

  return this;
}

/**
 * Close watchers or start ignoring events from specified paths.
 * @param {Path|Array<Path>} paths_ - string or array of strings, file/directory paths and/or globs
 * @returns {FSWatcher} for chaining
*/
unwatch(paths_) {
  if (this.closed) return this;
  const paths = unifyPaths(paths_);
  const {cwd} = this.options;

  paths.forEach((path) => {
    // convert to absolute path unless relative path already matches
    if (!sysPath.isAbsolute(path) && !this._closers.has(path)) {
      if (cwd) path = sysPath.join(cwd, path);
      path = sysPath.resolve(path);
    }

    this._closePath(path);

    this._ignoredPaths.add(path);
    if (this._watched.has(path)) {
      this._ignoredPaths.add(path + SLASH_GLOBSTAR);
    }

    // reset the cached userIgnored anymatch fn
    // to make ignoredPaths changes effective
    this._userIgnored = undefined;
  });

  return this;
}

/**
 * Close watchers and remove all listeners from watched paths.
 * @returns {Promise<void>}.
*/
close() {
  if (this.closed) return this._closePromise;
  this.closed = true;

  // Memory management.
  this.removeAllListeners();
  const closers = [];
  this._closers.forEach(closerList => closerList.forEach(closer => {
    const promise = closer();
    if (promise instanceof Promise) closers.push(promise);
  }));
  this._streams.forEach(stream => stream.destroy());
  this._userIgnored = undefined;
  this._readyCount = 0;
  this._readyEmitted = false;
  this._watched.forEach(dirent => dirent.dispose());
  ['closers', 'watched', 'streams', 'symlinkPaths', 'throttled'].forEach(key => {
    this[`_${key}`].clear();
  });

  this._closePromise = closers.length ? Promise.all(closers).then(() => undefined) : Promise.resolve();
  return this._closePromise;
}

/**
 * Expose list of watched paths
 * @returns {Object} for chaining
*/
getWatched() {
  const watchList = {};
  this._watched.forEach((entry, dir) => {
    const key = this.options.cwd ? sysPath.relative(this.options.cwd, dir) : dir;
    watchList[key || ONE_DOT] = entry.getChildren().sort();
  });
  return watchList;
}

emitWithAll(event, args) {
  this.emit(...args);
  if (event !== EV_ERROR) this.emit(EV_ALL, ...args);
}

// Common helpers
// --------------

/**
 * Normalize and emit events.
 * Calling _emit DOES NOT MEAN emit() would be called!
 * @param {EventName} event Type of event
 * @param {Path} path File or directory path
 * @param {*=} val1 arguments to be passed with event
 * @param {*=} val2
 * @param {*=} val3
 * @returns the error if defined, otherwise the value of the FSWatcher instance's `closed` flag
 */
async _emit(event, path, val1, val2, val3) {
  if (this.closed) return;

  const opts = this.options;
  if (isWindows) path = sysPath.normalize(path);
  if (opts.cwd) path = sysPath.relative(opts.cwd, path);
  /** @type Array<any> */
  const args = [event, path];
  if (val3 !== undefined) args.push(val1, val2, val3);
  else if (val2 !== undefined) args.push(val1, val2);
  else if (val1 !== undefined) args.push(val1);

  const awf = opts.awaitWriteFinish;
  let pw;
  if (awf && (pw = this._pendingWrites.get(path))) {
    pw.lastChange = new Date();
    return this;
  }

  if (opts.atomic) {
    if (event === EV_UNLINK) {
      this._pendingUnlinks.set(path, args);
      setTimeout(() => {
        this._pendingUnlinks.forEach((entry, path) => {
          this.emit(...entry);
          this.emit(EV_ALL, ...entry);
          this._pendingUnlinks.delete(path);
        });
      }, typeof opts.atomic === 'number' ? opts.atomic : 100);
      return this;
    }
    if (event === EV_ADD && this._pendingUnlinks.has(path)) {
      event = args[0] = EV_CHANGE;
      this._pendingUnlinks.delete(path);
    }
  }

  if (awf && (event === EV_ADD || event === EV_CHANGE) && this._readyEmitted) {
    const awfEmit = (err, stats) => {
      if (err) {
        event = args[0] = EV_ERROR;
        args[1] = err;
        this.emitWithAll(event, args);
      } else if (stats) {
        // if stats doesn't exist the file must have been deleted
        if (args.length > 2) {
          args[2] = stats;
        } else {
          args.push(stats);
        }
        this.emitWithAll(event, args);
      }
    };

    this._awaitWriteFinish(path, awf.stabilityThreshold, event, awfEmit);
    return this;
  }

  if (event === EV_CHANGE) {
    const isThrottled = !this._throttle(EV_CHANGE, path, 50);
    if (isThrottled) return this;
  }

  if (opts.alwaysStat && val1 === undefined &&
    (event === EV_ADD || event === EV_ADD_DIR || event === EV_CHANGE)
  ) {
    const fullPath = opts.cwd ? sysPath.join(opts.cwd, path) : path;
    let stats;
    try {
      stats = await stat(fullPath);
    } catch (err) {}
    // Suppress event when fs_stat fails, to avoid sending undefined 'stat'
    if (!stats || this.closed) return;
    args.push(stats);
  }
  this.emitWithAll(event, args);

  return this;
}

/**
 * Common handler for errors
 * @param {Error} error
 * @returns {Error|Boolean} The error if defined, otherwise the value of the FSWatcher instance's `closed` flag
 */
_handleError(error) {
  const code = error && error.code;
  if (error && code !== 'ENOENT' && code !== 'ENOTDIR' &&
    (!this.options.ignorePermissionErrors || (code !== 'EPERM' && code !== 'EACCES'))
  ) {
    this.emit(EV_ERROR, error);
  }
  return error || this.closed;
}

/**
 * Helper utility for throttling
 * @param {ThrottleType} actionType type being throttled
 * @param {Path} path being acted upon
 * @param {Number} timeout duration of time to suppress duplicate actions
 * @returns {Object|false} tracking object or false if action should be suppressed
 */
_throttle(actionType, path, timeout) {
  if (!this._throttled.has(actionType)) {
    this._throttled.set(actionType, new Map());
  }

  /** @type {Map<Path, Object>} */
  const action = this._throttled.get(actionType);
  /** @type {Object} */
  const actionPath = action.get(path);

  if (actionPath) {
    actionPath.count++;
    return false;
  }

  let timeoutObject;
  const clear = () => {
    const item = action.get(path);
    const count = item ? item.count : 0;
    action.delete(path);
    clearTimeout(timeoutObject);
    if (item) clearTimeout(item.timeoutObject);
    return count;
  };
  timeoutObject = setTimeout(clear, timeout);
  const thr = {timeoutObject, clear, count: 0};
  action.set(path, thr);
  return thr;
}

_incrReadyCount() {
  return this._readyCount++;
}

/**
 * Awaits write operation to finish.
 * Polls a newly created file for size variations. When files size does not change for 'threshold' milliseconds calls callback.
 * @param {Path} path being acted upon
 * @param {Number} threshold Time in milliseconds a file size must be fixed before acknowledging write OP is finished
 * @param {EventName} event
 * @param {Function} awfEmit Callback to be called when ready for event to be emitted.
 */
_awaitWriteFinish(path, threshold, event, awfEmit) {
  let timeoutHandler;

  let fullPath = path;
  if (this.options.cwd && !sysPath.isAbsolute(path)) {
    fullPath = sysPath.join(this.options.cwd, path);
  }

  const now = new Date();

  const awaitWriteFinish = (prevStat) => {
    fs.stat(fullPath, (err, curStat) => {
      if (err || !this._pendingWrites.has(path)) {
        if (err && err.code !== 'ENOENT') awfEmit(err);
        return;
      }

      const now = Number(new Date());

      if (prevStat && curStat.size !== prevStat.size) {
        this._pendingWrites.get(path).lastChange = now;
      }
      const pw = this._pendingWrites.get(path);
      const df = now - pw.lastChange;

      if (df >= threshold) {
        this._pendingWrites.delete(path);
        awfEmit(undefined, curStat);
      } else {
        timeoutHandler = setTimeout(
          awaitWriteFinish,
          this.options.awaitWriteFinish.pollInterval,
          curStat
        );
      }
    });
  };

  if (!this._pendingWrites.has(path)) {
    this._pendingWrites.set(path, {
      lastChange: now,
      cancelWait: () => {
        this._pendingWrites.delete(path);
        clearTimeout(timeoutHandler);
        return event;
      }
    });
    timeoutHandler = setTimeout(
      awaitWriteFinish,
      this.options.awaitWriteFinish.pollInterval
    );
  }
}

_getGlobIgnored() {
  return [...this._ignoredPaths.values()];
}

/**
 * Determines whether user has asked to ignore this path.
 * @param {Path} path filepath or dir
 * @param {fs.Stats=} stats result of fs.stat
 * @returns {Boolean}
 */
_isIgnored(path, stats) {
  if (this.options.atomic && DOT_RE.test(path)) return true;
  if (!this._userIgnored) {
    const {cwd} = this.options;
    const ign = this.options.ignored;

    const ignored = ign && ign.map(normalizeIgnored(cwd));
    const paths = arrify(ignored)
      .filter((path) => typeof path === STRING_TYPE && !isGlob(path))
      .map((path) => path + SLASH_GLOBSTAR);
    const list = this._getGlobIgnored().map(normalizeIgnored(cwd)).concat(ignored, paths);
    this._userIgnored = anymatch(list, undefined, ANYMATCH_OPTS);
  }

  return this._userIgnored([path, stats]);
}

_isntIgnored(path, stat) {
  return !this._isIgnored(path, stat);
}

/**
 * Provides a set of common helpers and properties relating to symlink and glob handling.
 * @param {Path} path file, directory, or glob pattern being watched
 * @param {Number=} depth at any depth > 0, this isn't a glob
 * @returns {WatchHelper} object containing helpers for this path
 */
_getWatchHelpers(path, depth) {
  const watchPath = depth || this.options.disableGlobbing || !isGlob(path) ? path : globParent(path);
  const follow = this.options.followSymlinks;

  return new WatchHelper(path, watchPath, follow, this);
}

// Directory helpers
// -----------------

/**
 * Provides directory tracking objects
 * @param {String} directory path of the directory
 * @returns {DirEntry} the directory's tracking object
 */
_getWatchedDir(directory) {
  if (!this._boundRemove) this._boundRemove = this._remove.bind(this);
  const dir = sysPath.resolve(directory);
  if (!this._watched.has(dir)) this._watched.set(dir, new DirEntry(dir, this._boundRemove));
  return this._watched.get(dir);
}

// File helpers
// ------------

/**
 * Check for read permissions.
 * Based on this answer on SO: https://stackoverflow.com/a/11781404/1358405
 * @param {fs.Stats} stats - object, result of fs_stat
 * @returns {Boolean} indicates whether the file can be read
*/
_hasReadPermissions(stats) {
  if (this.options.ignorePermissionErrors) return true;

  // stats.mode may be bigint
  const md = stats && Number.parseInt(stats.mode, 10);
  const st = md & 0o777;
  const it = Number.parseInt(st.toString(8)[0], 10);
  return Boolean(4 & it);
}

/**
 * Handles emitting unlink events for
 * files and directories, and via recursion, for
 * files and directories within directories that are unlinked
 * @param {String} directory within which the following item is located
 * @param {String} item      base path of item/directory
 * @returns {void}
*/
_remove(directory, item, isDirectory) {
  // if what is being deleted is a directory, get that directory's paths
  // for recursive deleting and cleaning of watched object
  // if it is not a directory, nestedDirectoryChildren will be empty array
  const path = sysPath.join(directory, item);
  const fullPath = sysPath.resolve(path);
  isDirectory = isDirectory != null
    ? isDirectory
    : this._watched.has(path) || this._watched.has(fullPath);

  // prevent duplicate handling in case of arriving here nearly simultaneously
  // via multiple paths (such as _handleFile and _handleDir)
  if (!this._throttle('remove', path, 100)) return;

  // if the only watched file is removed, watch for its return
  if (!isDirectory && !this.options.useFsEvents && this._watched.size === 1) {
    this.add(directory, item, true);
  }

  // This will create a new entry in the watched object in either case
  // so we got to do the directory check beforehand
  const wp = this._getWatchedDir(path);
  const nestedDirectoryChildren = wp.getChildren();

  // Recursively remove children directories / files.
  nestedDirectoryChildren.forEach(nested => this._remove(path, nested));

  // Check if item was on the watched list and remove it
  const parent = this._getWatchedDir(directory);
  const wasTracked = parent.has(item);
  parent.remove(item);

  // Fixes issue #1042 -> Relative paths were detected and added as symlinks
  // (https://github.com/paulmillr/chokidar/blob/e1753ddbc9571bdc33b4a4af172d52cb6e611c10/lib/nodefs-handler.js#L612),
  // but never removed from the map in case the path was deleted.
  // This leads to an incorrect state if the path was recreated:
  // https://github.com/paulmillr/chokidar/blob/e1753ddbc9571bdc33b4a4af172d52cb6e611c10/lib/nodefs-handler.js#L553
  if (this._symlinkPaths.has(fullPath)) {
    this._symlinkPaths.delete(fullPath);
  }

  // If we wait for this file to be fully written, cancel the wait.
  let relPath = path;
  if (this.options.cwd) relPath = sysPath.relative(this.options.cwd, path);
  if (this.options.awaitWriteFinish && this._pendingWrites.has(relPath)) {
    const event = this._pendingWrites.get(relPath).cancelWait();
    if (event === EV_ADD) return;
  }

  // The Entry will either be a directory that just got removed
  // or a bogus entry to a file, in either case we have to remove it
  this._watched.delete(path);
  this._watched.delete(fullPath);
  const eventName = isDirectory ? EV_UNLINK_DIR : EV_UNLINK;
  if (wasTracked && !this._isIgnored(path)) this._emit(eventName, path);

  // Avoid conflicts if we later create another file with the same name
  if (!this.options.useFsEvents) {
    this._closePath(path);
  }
}

/**
 * Closes all watchers for a path
 * @param {Path} path
 */
_closePath(path) {
  this._closeFile(path)
  const dir = sysPath.dirname(path);
  this._getWatchedDir(dir).remove(sysPath.basename(path));
}

/**
 * Closes only file-specific watchers
 * @param {Path} path
 */
_closeFile(path) {
  const closers = this._closers.get(path);
  if (!closers) return;
  closers.forEach(closer => closer());
  this._closers.delete(path);
}

/**
 *
 * @param {Path} path
 * @param {Function} closer
 */
_addPathCloser(path, closer) {
  if (!closer) return;
  let list = this._closers.get(path);
  if (!list) {
    list = [];
    this._closers.set(path, list);
  }
  list.push(closer);
}

_readdirp(root, opts) {
  if (this.closed) return;
  const options = {type: EV_ALL, alwaysStat: true, lstat: true, ...opts};
  let stream = readdirp(root, options);
  this._streams.add(stream);
  stream.once(STR_CLOSE, () => {
    stream = undefined;
  });
  stream.once(STR_END, () => {
    if (stream) {
      this._streams.delete(stream);
      stream = undefined;
    }
  });
  return stream;
}

}

// Export FSWatcher class
exports.FSWatcher = FSWatcher;

/**
 * Instantiates watcher with paths to be tracked.
 * @param {String|Array<String>} paths file/directory paths and/or globs
 * @param {Object=} options chokidar opts
 * @returns an instance of FSWatcher for chaining.
 */
const watch = (paths, options) => {
  const watcher = new FSWatcher(options);
  watcher.add(paths);
  return watcher;
};

exports.watch = watch;
{
  "name": "chokidar",
  "description": "Minimal and efficient cross-platform file watching library",
  "version": "3.6.0",
  "homepage": "https://github.com/paulmillr/chokidar",
  "author": "Paul Miller (https://paulmillr.com)",
  "engines": {
    "node": ">= 8.10.0"
  },
  "main": "index.js",
  "types": "./types/index.d.ts",
  "dependencies": {
    "anymatch": "~3.1.2",
    "braces": "~3.0.2",
    "glob-parent": "~5.1.2",
    "is-binary-path": "~2.1.0",
    "is-glob": "~4.0.1",
    "normalize-path": "~3.0.0",
    "readdirp": "~3.6.0"
  },
  "optionalDependencies": {
    "fsevents": "~2.3.2"
  },
  "devDependencies": {
    "@types/node": "^14",
    "chai": "^4.3",
    "dtslint": "^3.3.0",
    "eslint": "^7.0.0",
    "mocha": "^7.0.0",
    "rimraf": "^3.0.0",
    "sinon": "^9.0.1",
    "sinon-chai": "^3.3.0",
    "typescript": "^4.4.3",
    "upath": "^1.2.0"
  },
  "files": [
    "index.js",
    "lib/*.js",
    "types/index.d.ts"
  ],
  "repository": {
    "type": "git",
    "url": "git+https://github.com/paulmillr/chokidar.git"
  },
  "license": "MIT",
  "funding": "https://paulmillr.com/funding/"
}'use strict';

const {sep} = require('path');
const {platform} = process;
const os = require('os');

exports.EV_ALL = 'all';
exports.EV_READY = 'ready';
exports.EV_ADD = 'add';
exports.EV_CHANGE = 'change';
exports.EV_ADD_DIR = 'addDir';
exports.EV_UNLINK = 'unlink';
exports.EV_UNLINK_DIR = 'unlinkDir';
exports.EV_RAW = 'raw';
exports.EV_ERROR = 'error';

exports.STR_DATA = 'data';
exports.STR_END = 'end';
exports.STR_CLOSE = 'close';

exports.FSEVENT_CREATED = 'created';
exports.FSEVENT_MODIFIED = 'modified';
exports.FSEVENT_DELETED = 'deleted';
exports.FSEVENT_MOVED = 'moved';
exports.FSEVENT_CLONED = 'cloned';
exports.FSEVENT_UNKNOWN = 'unknown';
exports.FSEVENT_FLAG_MUST_SCAN_SUBDIRS = 1;
exports.FSEVENT_TYPE_FILE = 'file';
exports.FSEVENT_TYPE_DIRECTORY = 'directory';
exports.FSEVENT_TYPE_SYMLINK = 'symlink';

exports.KEY_LISTENERS = 'listeners';
exports.KEY_ERR = 'errHandlers';
exports.KEY_RAW = 'rawEmitters';
exports.HANDLER_KEYS = [exports.KEY_LISTENERS, exports.KEY_ERR, exports.KEY_RAW];

exports.DOT_SLASH = `.${sep}`;

exports.BACK_SLASH_RE = /\\/g;
exports.DOUBLE_SLASH_RE = /\/\//;
exports.SLASH_OR_BACK_SLASH_RE = /[/\\]/;
exports.DOT_RE = /\..*\.(sw[px])$|~$|\.subl.*\.tmp/;
exports.REPLACER_RE = /^\.[/\\]/;

exports.SLASH = '/';
exports.SLASH_SLASH = '//';
exports.BRACE_START = '{';
exports.BANG = '!';
exports.ONE_DOT = '.';
exports.TWO_DOTS = '..';
exports.STAR = '*';
exports.GLOBSTAR = '**';
exports.ROOT_GLOBSTAR = '/**/*';
exports.SLASH_GLOBSTAR = '/**';
exports.DIR_SUFFIX = 'Dir';
exports.ANYMATCH_OPTS = {dot: true};
exports.STRING_TYPE = 'string';
exports.FUNCTION_TYPE = 'function';
exports.EMPTY_STR = '';
exports.EMPTY_FN = () => {};
exports.IDENTITY_FN = val => val;

exports.isWindows = platform === 'win32';
exports.isMacos = platform === 'darwin';
exports.isLinux = platform === 'linux';
exports.isIBMi = os.type() === 'OS400';
'use strict';

const fs = require('fs');
const sysPath = require('path');
const { promisify } = require('util');

let fsevents;
try {
  fsevents = require('fsevents');
} catch (error) {
  if (process.env.CHOKIDAR_PRINT_FSEVENTS_REQUIRE_ERROR) console.error(error);
}

if (fsevents) {
  // TODO: real check
  const mtch = process.version.match(/v(\d+)\.(\d+)/);
  if (mtch && mtch[1] && mtch[2]) {
    const maj = Number.parseInt(mtch[1], 10);
    const min = Number.parseInt(mtch[2], 10);
    if (maj === 8 && min < 16) {
      fsevents = undefined;
    }
  }
}

const {
  EV_ADD,
  EV_CHANGE,
  EV_ADD_DIR,
  EV_UNLINK,
  EV_ERROR,
  STR_DATA,
  STR_END,
  FSEVENT_CREATED,
  FSEVENT_MODIFIED,
  FSEVENT_DELETED,
  FSEVENT_MOVED,
  // FSEVENT_CLONED,
  FSEVENT_UNKNOWN,
  FSEVENT_FLAG_MUST_SCAN_SUBDIRS,
  FSEVENT_TYPE_FILE,
  FSEVENT_TYPE_DIRECTORY,
  FSEVENT_TYPE_SYMLINK,

  ROOT_GLOBSTAR,
  DIR_SUFFIX,
  DOT_SLASH,
  FUNCTION_TYPE,
  EMPTY_FN,
  IDENTITY_FN
} = require('./constants');

const Depth = (value) => isNaN(value) ? {} : {depth: value};

const stat = promisify(fs.stat);
const lstat = promisify(fs.lstat);
const realpath = promisify(fs.realpath);

const statMethods = { stat, lstat };

/**
 * @typedef {String} Path
 */

/**
 * @typedef {Object} FsEventsWatchContainer
 * @property {Set<Function>} listeners
 * @property {Function} rawEmitter
 * @property {{stop: Function}} watcher
 */

// fsevents instance helper functions
/**
 * Object to hold per-process fsevents instances (may be shared across chokidar FSWatcher instances)
 * @type {Map<Path,FsEventsWatchContainer>}
 */
const FSEventsWatchers = new Map();

// Threshold of duplicate path prefixes at which to start
// consolidating going forward
const consolidateThreshhold = 10;

const wrongEventFlags = new Set([
  69888, 70400, 71424, 72704, 73472, 131328, 131840, 262912
]);

/**
 * Instantiates the fsevents interface
 * @param {Path} path path to be watched
 * @param {Function} callback called when fsevents is bound and ready
 * @returns {{stop: Function}} new fsevents instance
 */
const createFSEventsInstance = (path, callback) => {
  const stop = fsevents.watch(path, callback);
  return {stop};
};

/**
 * Instantiates the fsevents interface or binds listeners to an existing one covering
 * the same file tree.
 * @param {Path} path           - to be watched
 * @param {Path} realPath       - real path for symlinks
 * @param {Function} listener   - called when fsevents emits events
 * @param {Function} rawEmitter - passes data to listeners of the 'raw' event
 * @returns {Function} closer
 */
function setFSEventsListener(path, realPath, listener, rawEmitter) {
  let watchPath = sysPath.extname(realPath) ? sysPath.dirname(realPath) : realPath;

  const parentPath = sysPath.dirname(watchPath);
  let cont = FSEventsWatchers.get(watchPath);

  // If we've accumulated a substantial number of paths that
  // could have been consolidated by watching one directory
  // above the current one, create a watcher on the parent
  // path instead, so that we do consolidate going forward.
  if (couldConsolidate(parentPath)) {
    watchPath = parentPath;
  }

  const resolvedPath = sysPath.resolve(path);
  const hasSymlink = resolvedPath !== realPath;

  const filteredListener = (fullPath, flags, info) => {
    if (hasSymlink) fullPath = fullPath.replace(realPath, resolvedPath);
    if (
      fullPath === resolvedPath ||
      !fullPath.indexOf(resolvedPath + sysPath.sep)
    ) listener(fullPath, flags, info);
  };

  // check if there is already a watcher on a parent path
  // modifies `watchPath` to the parent path when it finds a match
  let watchedParent = false;
  for (const watchedPath of FSEventsWatchers.keys()) {
    if (realPath.indexOf(sysPath.resolve(watchedPath) + sysPath.sep) === 0) {
      watchPath = watchedPath;
      cont = FSEventsWatchers.get(watchPath);
      watchedParent = true;
      break;
    }
  }

  if (cont || watchedParent) {
    cont.listeners.add(filteredListener);
  } else {
    cont = {
      listeners: new Set([filteredListener]),
      rawEmitter,
      watcher: createFSEventsInstance(watchPath, (fullPath, flags) => {
        if (!cont.listeners.size) return;
        if (flags & FSEVENT_FLAG_MUST_SCAN_SUBDIRS) return;
        const info = fsevents.getInfo(fullPath, flags);
        cont.listeners.forEach(list => {
          list(fullPath, flags, info);
        });

        cont.rawEmitter(info.event, fullPath, info);
      })
    };
    FSEventsWatchers.set(watchPath, cont);
  }

  // removes this instance's listeners and closes the underlying fsevents
  // instance if there are no more listeners left
  return () => {
    const lst = cont.listeners;

    lst.delete(filteredListener);
    if (!lst.size) {
      FSEventsWatchers.delete(watchPath);
      if (cont.watcher) return cont.watcher.stop().then(() => {
        cont.rawEmitter = cont.watcher = undefined;
        Object.freeze(cont);
      });
    }
  };
}

// Decide whether or not we should start a new higher-level
// parent watcher
const couldConsolidate = (path) => {
  let count = 0;
  for (const watchPath of FSEventsWatchers.keys()) {
    if (watchPath.indexOf(path) === 0) {
      count++;
      if (count >= consolidateThreshhold) {
        return true;
      }
    }
  }

  return false;
};

// returns boolean indicating whether fsevents can be used
const canUse = () => fsevents && FSEventsWatchers.size < 128;

// determines subdirectory traversal levels from root to path
const calcDepth = (path, root) => {
  let i = 0;
  while (!path.indexOf(root) && (path = sysPath.dirname(path)) !== root) i++;
  return i;
};

// returns boolean indicating whether the fsevents' event info has the same type
// as the one returned by fs.stat
const sameTypes = (info, stats) => (
  info.type === FSEVENT_TYPE_DIRECTORY && stats.isDirectory() ||
  info.type === FSEVENT_TYPE_SYMLINK && stats.isSymbolicLink() ||
  info.type === FSEVENT_TYPE_FILE && stats.isFile()
)

/**
 * @mixin
 */
class FsEventsHandler {

/**
 * @param {import('../index').FSWatcher} fsw
 */
constructor(fsw) {
  this.fsw = fsw;
}
checkIgnored(path, stats) {
  const ipaths = this.fsw._ignoredPaths;
  if (this.fsw._isIgnored(path, stats)) {
    ipaths.add(path);
    if (stats && stats.isDirectory()) {
      ipaths.add(path + ROOT_GLOBSTAR);
    }
    return true;
  }

  ipaths.delete(path);
  ipaths.delete(path + ROOT_GLOBSTAR);
}

addOrChange(path, fullPath, realPath, parent, watchedDir, item, info, opts) {
  const event = watchedDir.has(item) ? EV_CHANGE : EV_ADD;
  this.handleEvent(event, path, fullPath, realPath, parent, watchedDir, item, info, opts);
}

async checkExists(path, fullPath, realPath, parent, watchedDir, item, info, opts) {
  try {
    const stats = await stat(path)
    if (this.fsw.closed) return;
    if (sameTypes(info, stats)) {
      this.addOrChange(path, fullPath, realPath, parent, watchedDir, item, info, opts);
    } else {
      this.handleEvent(EV_UNLINK, path, fullPath, realPath, parent, watchedDir, item, info, opts);
    }
  } catch (error) {
    if (error.code === 'EACCES') {
      this.addOrChange(path, fullPath, realPath, parent, watchedDir, item, info, opts);
    } else {
      this.handleEvent(EV_UNLINK, path, fullPath, realPath, parent, watchedDir, item, info, opts);
    }
  }
}

handleEvent(event, path, fullPath, realPath, parent, watchedDir, item, info, opts) {
  if (this.fsw.closed || this.checkIgnored(path)) return;

  if (event === EV_UNLINK) {
    const isDirectory = info.type === FSEVENT_TYPE_DIRECTORY
    // suppress unlink events on never before seen files
    if (isDirectory || watchedDir.has(item)) {
      this.fsw._remove(parent, item, isDirectory);
    }
  } else {
    if (event === EV_ADD) {
      // track new directories
      if (info.type === FSEVENT_TYPE_DIRECTORY) this.fsw._getWatchedDir(path);

      if (info.type === FSEVENT_TYPE_SYMLINK && opts.followSymlinks) {
        // push symlinks back to the top of the stack to get handled
        const curDepth = opts.depth === undefined ?
          undefined : calcDepth(fullPath, realPath) + 1;
        return this._addToFsEvents(path, false, true, curDepth);
      }

      // track new paths
      // (other than symlinks being followed, which will be tracked soon)
      this.fsw._getWatchedDir(parent).add(item);
    }
    /**
     * @type {'add'|'addDir'|'unlink'|'unlinkDir'}
     */
    const eventName = info.type === FSEVENT_TYPE_DIRECTORY ? event + DIR_SUFFIX : event;
    this.fsw._emit(eventName, path);
    if (eventName === EV_ADD_DIR) this._addToFsEvents(path, false, true);
  }
}

/**
 * Handle symlinks encountered during directory scan
 * @param {String} watchPath  - file/dir path to be watched with fsevents
 * @param {String} realPath   - real path (in case of symlinks)
 * @param {Function} transform  - path transformer
 * @param {Function} globFilter - path filter in case a glob pattern was provided
 * @returns {Function} closer for the watcher instance
*/
_watchWithFsEvents(watchPath, realPath, transform, globFilter) {
  if (this.fsw.closed || this.fsw._isIgnored(watchPath)) return;
  const opts = this.fsw.options;
  const watchCallback = async (fullPath, flags, info) => {
    if (this.fsw.closed) return;
    if (
      opts.depth !== undefined &&
      calcDepth(fullPath, realPath) > opts.depth
    ) return;
    const path = transform(sysPath.join(
      watchPath, sysPath.relative(watchPath, fullPath)
    ));
    if (globFilter && !globFilter(path)) return;
    // ensure directories are tracked
    const parent = sysPath.dirname(path);
    const item = sysPath.basename(path);
    const watchedDir = this.fsw._getWatchedDir(
      info.type === FSEVENT_TYPE_DIRECTORY ? path : parent
    );

    // correct for wrong events emitted
    if (wrongEventFlags.has(flags) || info.event === FSEVENT_UNKNOWN) {
      if (typeof opts.ignored === FUNCTION_TYPE) {
        let stats;
        try {
          stats = await stat(path);
        } catch (error) {}
        if (this.fsw.closed) return;
        if (this.checkIgnored(path, stats)) return;
        if (sameTypes(info, stats)) {
          this.addOrChange(path, fullPath, realPath, parent, watchedDir, item, info, opts);
        } else {
          this.handleEvent(EV_UNLINK, path, fullPath, realPath, parent, watchedDir, item, info, opts);
        }
      } else {
        this.checkExists(path, fullPath, realPath, parent, watchedDir, item, info, opts);
      }
    } else {
      switch (info.event) {
      case FSEVENT_CREATED:
      case FSEVENT_MODIFIED:
        return this.addOrChange(path, fullPath, realPath, parent, watchedDir, item, info, opts);
      case FSEVENT_DELETED:
      case FSEVENT_MOVED:
        return this.checkExists(path, fullPath, realPath, parent, watchedDir, item, info, opts);
      }
    }
  };

  const closer = setFSEventsListener(
    watchPath,
    realPath,
    watchCallback,
    this.fsw._emitRaw
  );

  this.fsw._emitReady();
  return closer;
}

/**
 * Handle symlinks encountered during directory scan
 * @param {String} linkPath path to symlink
 * @param {String} fullPath absolute path to the symlink
 * @param {Function} transform pre-existing path transformer
 * @param {Number} curDepth level of subdirectories traversed to where symlink is
 * @returns {Promise<void>}
 */
async _handleFsEventsSymlink(linkPath, fullPath, transform, curDepth) {
  // don't follow the same symlink more than once
  if (this.fsw.closed || this.fsw._symlinkPaths.has(fullPath)) return;

  this.fsw._symlinkPaths.set(fullPath, true);
  this.fsw._incrReadyCount();

  try {
    const linkTarget = await realpath(linkPath);
    if (this.fsw.closed) return;
    if (this.fsw._isIgnored(linkTarget)) {
      return this.fsw._emitReady();
    }

    this.fsw._incrReadyCount();

    // add the linkTarget for watching with a wrapper for transform
    // that causes emitted paths to incorporate the link's path
    this._addToFsEvents(linkTarget || linkPath, (path) => {
      let aliasedPath = linkPath;
      if (linkTarget && linkTarget !== DOT_SLASH) {
        aliasedPath = path.replace(linkTarget, linkPath);
      } else if (path !== DOT_SLASH) {
        aliasedPath = sysPath.join(linkPath, path);
      }
      return transform(aliasedPath);
    }, false, curDepth);
  } catch(error) {
    if (this.fsw._handleError(error)) {
      return this.fsw._emitReady();
    }
  }
}

/**
 *
 * @param {Path} newPath
 * @param {fs.Stats} stats
 */
emitAdd(newPath, stats, processPath, opts, forceAdd) {
  const pp = processPath(newPath);
  const isDir = stats.isDirectory();
  const dirObj = this.fsw._getWatchedDir(sysPath.dirname(pp));
  const base = sysPath.basename(pp);

  // ensure empty dirs get tracked
  if (isDir) this.fsw._getWatchedDir(pp);
  if (dirObj.has(base)) return;
  dirObj.add(base);

  if (!opts.ignoreInitial || forceAdd === true) {
    this.fsw._emit(isDir ? EV_ADD_DIR : EV_ADD, pp, stats);
  }
}

initWatch(realPath, path, wh, processPath) {
  if (this.fsw.closed) return;
  const closer = this._watchWithFsEvents(
    wh.watchPath,
    sysPath.resolve(realPath || wh.watchPath),
    processPath,
    wh.globFilter
  );
  this.fsw._addPathCloser(path, closer);
}

/**
 * Handle added path with fsevents
 * @param {String} path file/dir path or glob pattern
 * @param {Function|Boolean=} transform converts working path to what the user expects
 * @param {Boolean=} forceAdd ensure add is emitted
 * @param {Number=} priorDepth Level of subdirectories already traversed.
 * @returns {Promise<void>}
 */
async _addToFsEvents(path, transform, forceAdd, priorDepth) {
  if (this.fsw.closed) {
    return;
  }
  const opts = this.fsw.options;
  const processPath = typeof transform === FUNCTION_TYPE ? transform : IDENTITY_FN;

  const wh = this.fsw._getWatchHelpers(path);

  // evaluate what is at the path we're being asked to watch
  try {
    const stats = await statMethods[wh.statMethod](wh.watchPath);
    if (this.fsw.closed) return;
    if (this.fsw._isIgnored(wh.watchPath, stats)) {
      throw null;
    }
    if (stats.isDirectory()) {
      // emit addDir unless this is a glob parent
      if (!wh.globFilter) this.emitAdd(processPath(path), stats, processPath, opts, forceAdd);

      // don't recurse further if it would exceed depth setting
      if (priorDepth && priorDepth > opts.depth) return;

      // scan the contents of the dir
      this.fsw._readdirp(wh.watchPath, {
        fileFilter: entry => wh.filterPath(entry),
        directoryFilter: entry => wh.filterDir(entry),
        ...Depth(opts.depth - (priorDepth || 0))
      }).on(STR_DATA, (entry) => {
        // need to check filterPath on dirs b/c filterDir is less restrictive
        if (this.fsw.closed) {
          return;
        }
        if (entry.stats.isDirectory() && !wh.filterPath(entry)) return;

        const joinedPath = sysPath.join(wh.watchPath, entry.path);
        const {fullPath} = entry;

        if (wh.followSymlinks && entry.stats.isSymbolicLink()) {
          // preserve the current depth here since it can't be derived from
          // real paths past the symlink
          const curDepth = opts.depth === undefined ?
            undefined : calcDepth(joinedPath, sysPath.resolve(wh.watchPath)) + 1;

          this._handleFsEventsSymlink(joinedPath, fullPath, processPath, curDepth);
        } else {
          this.emitAdd(joinedPath, entry.stats, processPath, opts, forceAdd);
        }
      }).on(EV_ERROR, EMPTY_FN).on(STR_END, () => {
        this.fsw._emitReady();
      });
    } else {
      this.emitAdd(wh.watchPath, stats, processPath, opts, forceAdd);
      this.fsw._emitReady();
    }
  } catch (error) {
    if (!error || this.fsw._handleError(error)) {
      // TODO: Strange thing: "should not choke on an ignored watch path" will be failed without 2 ready calls -__-
      this.fsw._emitReady();
      this.fsw._emitReady();
    }
  }

  if (opts.persistent && forceAdd !== true) {
    if (typeof transform === FUNCTION_TYPE) {
      // realpath has already been resolved
      this.initWatch(undefined, path, wh, processPath);
    } else {
      let realPath;
      try {
        realPath = await realpath(wh.watchPath);
      } catch (e) {}
      this.initWatch(realPath, path, wh, processPath);
    }
  }
}

}

module.exports = FsEventsHandler;
module.exports.canUse = canUse;
'use strict';

const fs = require('fs');
const sysPath = require('path');
const { promisify } = require('util');
const isBinaryPath = require('is-binary-path');
const {
  isWindows,
  isLinux,
  EMPTY_FN,
  EMPTY_STR,
  KEY_LISTENERS,
  KEY_ERR,
  KEY_RAW,
  HANDLER_KEYS,
  EV_CHANGE,
  EV_ADD,
  EV_ADD_DIR,
  EV_ERROR,
  STR_DATA,
  STR_END,
  BRACE_START,
  STAR
} = require('./constants');

const THROTTLE_MODE_WATCH = 'watch';

const open = promisify(fs.open);
const stat = promisify(fs.stat);
const lstat = promisify(fs.lstat);
const close = promisify(fs.close);
const fsrealpath = promisify(fs.realpath);

const statMethods = { lstat, stat };

// TODO: emit errors properly. Example: EMFILE on Macos.
const foreach = (val, fn) => {
  if (val instanceof Set) {
    val.forEach(fn);
  } else {
    fn(val);
  }
};

const addAndConvert = (main, prop, item) => {
  let container = main[prop];
  if (!(container instanceof Set)) {
    main[prop] = container = new Set([container]);
  }
  container.add(item);
};

const clearItem = cont => key => {
  const set = cont[key];
  if (set instanceof Set) {
    set.clear();
  } else {
    delete cont[key];
  }
};

const delFromSet = (main, prop, item) => {
  const container = main[prop];
  if (container instanceof Set) {
    container.delete(item);
  } else if (container === item) {
    delete main[prop];
  }
};

const isEmptySet = (val) => val instanceof Set ? val.size === 0 : !val;

/**
 * @typedef {String} Path
 */

// fs_watch helpers

// object to hold per-process fs_watch instances
// (may be shared across chokidar FSWatcher instances)

/**
 * @typedef {Object} FsWatchContainer
 * @property {Set} listeners
 * @property {Set} errHandlers
 * @property {Set} rawEmitters
 * @property {fs.FSWatcher=} watcher
 * @property {Boolean=} watcherUnusable
 */

/**
 * @type {Map<String,FsWatchContainer>}
 */
const FsWatchInstances = new Map();

/**
 * Instantiates the fs_watch interface
 * @param {String} path to be watched
 * @param {Object} options to be passed to fs_watch
 * @param {Function} listener main event handler
 * @param {Function} errHandler emits info about errors
 * @param {Function} emitRaw emits raw event data
 * @returns {fs.FSWatcher} new fsevents instance
 */
function createFsWatchInstance(path, options, listener, errHandler, emitRaw) {
  const handleEvent = (rawEvent, evPath) => {
    listener(path);
    emitRaw(rawEvent, evPath, {watchedPath: path});

    // emit based on events occurring for files from a directory's watcher in
    // case the file's watcher misses it (and rely on throttling to de-dupe)
    if (evPath && path !== evPath) {
      fsWatchBroadcast(
        sysPath.resolve(path, evPath), KEY_LISTENERS, sysPath.join(path, evPath)
      );
    }
  };
  try {
    return fs.watch(path, options, handleEvent);
  } catch (error) {
    errHandler(error);
  }
}

/**
 * Helper for passing fs_watch event data to a collection of listeners
 * @param {Path} fullPath absolute path bound to fs_watch instance
 * @param {String} type listener type
 * @param {*=} val1 arguments to be passed to listeners
 * @param {*=} val2
 * @param {*=} val3
 */
const fsWatchBroadcast = (fullPath, type, val1, val2, val3) => {
  const cont = FsWatchInstances.get(fullPath);
  if (!cont) return;
  foreach(cont[type], (listener) => {
    listener(val1, val2, val3);
  });
};

/**
 * Instantiates the fs_watch interface or binds listeners
 * to an existing one covering the same file system entry
 * @param {String} path
 * @param {String} fullPath absolute path
 * @param {Object} options to be passed to fs_watch
 * @param {Object} handlers container for event listener functions
 */
const setFsWatchListener = (path, fullPath, options, handlers) => {
  const {listener, errHandler, rawEmitter} = handlers;
  let cont = FsWatchInstances.get(fullPath);

  /** @type {fs.FSWatcher=} */
  let watcher;
  if (!options.persistent) {
    watcher = createFsWatchInstance(
      path, options, listener, errHandler, rawEmitter
    );
    return watcher.close.bind(watcher);
  }
  if (cont) {
    addAndConvert(cont, KEY_LISTENERS, listener);
    addAndConvert(cont, KEY_ERR, errHandler);
    addAndConvert(cont, KEY_RAW, rawEmitter);
  } else {
    watcher = createFsWatchInstance(
      path,
      options,
      fsWatchBroadcast.bind(null, fullPath, KEY_LISTENERS),
      errHandler, // no need to use broadcast here
      fsWatchBroadcast.bind(null, fullPath, KEY_RAW)
    );
    if (!watcher) return;
    watcher.on(EV_ERROR, async (error) => {
      const broadcastErr = fsWatchBroadcast.bind(null, fullPath, KEY_ERR);
      cont.watcherUnusable = true; // documented since Node 10.4.1
      // Workaround for https://github.com/joyent/node/issues/4337
      if (isWindows && error.code === 'EPERM') {
        try {
          const fd = await open(path, 'r');
          await close(fd);
          broadcastErr(error);
        } catch (err) {}
      } else {
        broadcastErr(error);
      }
    });
    cont = {
      listeners: listener,
      errHandlers: errHandler,
      rawEmitters: rawEmitter,
      watcher
    };
    FsWatchInstances.set(fullPath, cont);
  }
  // const index = cont.listeners.indexOf(listener);

  // removes this instance's listeners and closes the underlying fs_watch
  // instance if there are no more listeners left
  return () => {
    delFromSet(cont, KEY_LISTENERS, listener);
    delFromSet(cont, KEY_ERR, errHandler);
    delFromSet(cont, KEY_RAW, rawEmitter);
    if (isEmptySet(cont.listeners)) {
      // Check to protect against issue gh-730.
      // if (cont.watcherUnusable) {
      cont.watcher.close();
      // }
      FsWatchInstances.delete(fullPath);
      HANDLER_KEYS.forEach(clearItem(cont));
      cont.watcher = undefined;
      Object.freeze(cont);
    }
  };
};

// fs_watchFile helpers

// object to hold per-process fs_watchFile instances
// (may be shared across chokidar FSWatcher instances)
const FsWatchFileInstances = new Map();

/**
 * Instantiates the fs_watchFile interface or binds listeners
 * to an existing one covering the same file system entry
 * @param {String} path to be watched
 * @param {String} fullPath absolute path
 * @param {Object} options options to be passed to fs_watchFile
 * @param {Object} handlers container for event listener functions
 * @returns {Function} closer
 */
const setFsWatchFileListener = (path, fullPath, options, handlers) => {
  const {listener, rawEmitter} = handlers;
  let cont = FsWatchFileInstances.get(fullPath);

  /* eslint-disable no-unused-vars, prefer-destructuring */
  let listeners = new Set();
  let rawEmitters = new Set();

  const copts = cont && cont.options;
  if (copts && (copts.persistent < options.persistent || copts.interval > options.interval)) {
    // "Upgrade" the watcher to persistence or a quicker interval.
    // This creates some unlikely edge case issues if the user mixes
    // settings in a very weird way, but solving for those cases
    // doesn't seem worthwhile for the added complexity.
    listeners = cont.listeners;
    rawEmitters = cont.rawEmitters;
    fs.unwatchFile(fullPath);
    cont = undefined;
  }

  /* eslint-enable no-unused-vars, prefer-destructuring */

  if (cont) {
    addAndConvert(cont, KEY_LISTENERS, listener);
    addAndConvert(cont, KEY_RAW, rawEmitter);
  } else {
    // TODO
    // listeners.add(listener);
    // rawEmitters.add(rawEmitter);
    cont = {
      listeners: listener,
      rawEmitters: rawEmitter,
      options,
      watcher: fs.watchFile(fullPath, options, (curr, prev) => {
        foreach(cont.rawEmitters, (rawEmitter) => {
          rawEmitter(EV_CHANGE, fullPath, {curr, prev});
        });
        const currmtime = curr.mtimeMs;
        if (curr.size !== prev.size || currmtime > prev.mtimeMs || currmtime === 0) {
          foreach(cont.listeners, (listener) => listener(path, curr));
        }
      })
    };
    FsWatchFileInstances.set(fullPath, cont);
  }
  // const index = cont.listeners.indexOf(listener);

  // Removes this instance's listeners and closes the underlying fs_watchFile
  // instance if there are no more listeners left.
  return () => {
    delFromSet(cont, KEY_LISTENERS, listener);
    delFromSet(cont, KEY_RAW, rawEmitter);
    if (isEmptySet(cont.listeners)) {
      FsWatchFileInstances.delete(fullPath);
      fs.unwatchFile(fullPath);
      cont.options = cont.watcher = undefined;
      Object.freeze(cont);
    }
  };
};

/**
 * @mixin
 */
class NodeFsHandler {

/**
 * @param {import("../index").FSWatcher} fsW
 */
constructor(fsW) {
  this.fsw = fsW;
  this._boundHandleError = (error) => fsW._handleError(error);
}

/**
 * Watch file for changes with fs_watchFile or fs_watch.
 * @param {String} path to file or dir
 * @param {Function} listener on fs change
 * @returns {Function} closer for the watcher instance
 */
_watchWithNodeFs(path, listener) {
  const opts = this.fsw.options;
  const directory = sysPath.dirname(path);
  const basename = sysPath.basename(path);
  const parent = this.fsw._getWatchedDir(directory);
  parent.add(basename);
  const absolutePath = sysPath.resolve(path);
  const options = {persistent: opts.persistent};
  if (!listener) listener = EMPTY_FN;

  let closer;
  if (opts.usePolling) {
    options.interval = opts.enableBinaryInterval && isBinaryPath(basename) ?
      opts.binaryInterval : opts.interval;
    closer = setFsWatchFileListener(path, absolutePath, options, {
      listener,
      rawEmitter: this.fsw._emitRaw
    });
  } else {
    closer = setFsWatchListener(path, absolutePath, options, {
      listener,
      errHandler: this._boundHandleError,
      rawEmitter: this.fsw._emitRaw
    });
  }
  return closer;
}

/**
 * Watch a file and emit add event if warranted.
 * @param {Path} file Path
 * @param {fs.Stats} stats result of fs_stat
 * @param {Boolean} initialAdd was the file added at watch instantiation?
 * @returns {Function} closer for the watcher instance
 */
_handleFile(file, stats, initialAdd) {
  if (this.fsw.closed) {
    return;
  }
  const dirname = sysPath.dirname(file);
  const basename = sysPath.basename(file);
  const parent = this.fsw._getWatchedDir(dirname);
  // stats is always present
  let prevStats = stats;

  // if the file is already being watched, do nothing
  if (parent.has(basename)) return;

  const listener = async (path, newStats) => {
    if (!this.fsw._throttle(THROTTLE_MODE_WATCH, file, 5)) return;
    if (!newStats || newStats.mtimeMs === 0) {
      try {
        const newStats = await stat(file);
        if (this.fsw.closed) return;
        // Check that change event was not fired because of changed only accessTime.
        const at = newStats.atimeMs;
        const mt = newStats.mtimeMs;
        if (!at || at <= mt || mt !== prevStats.mtimeMs) {
          this.fsw._emit(EV_CHANGE, file, newStats);
        }
        if (isLinux && prevStats.ino !== newStats.ino) {
          this.fsw._closeFile(path)
          prevStats = newStats;
          this.fsw._addPathCloser(path, this._watchWithNodeFs(file, listener));
        } else {
          prevStats = newStats;
        }
      } catch (error) {
        // Fix issues where mtime is null but file is still present
        this.fsw._remove(dirname, basename);
      }
      // add is about to be emitted if file not already tracked in parent
    } else if (parent.has(basename)) {
      // Check that change event was not fired because of changed only accessTime.
      const at = newStats.atimeMs;
      const mt = newStats.mtimeMs;
      if (!at || at <= mt || mt !== prevStats.mtimeMs) {
        this.fsw._emit(EV_CHANGE, file, newStats);
      }
      prevStats = newStats;
    }
  }
  // kick off the watcher
  const closer = this._watchWithNodeFs(file, listener);

  // emit an add event if we're supposed to
  if (!(initialAdd && this.fsw.options.ignoreInitial) && this.fsw._isntIgnored(file)) {
    if (!this.fsw._throttle(EV_ADD, file, 0)) return;
    this.fsw._emit(EV_ADD, file, stats);
  }

  return closer;
}

/**
 * Handle symlinks encountered while reading a dir.
 * @param {Object} entry returned by readdirp
 * @param {String} directory path of dir being read
 * @param {String} path of this item
 * @param {String} item basename of this item
 * @returns {Promise<Boolean>} true if no more processing is needed for this entry.
 */
async _handleSymlink(entry, directory, path, item) {
  if (this.fsw.closed) {
    return;
  }
  const full = entry.fullPath;
  const dir = this.fsw._getWatchedDir(directory);

  if (!this.fsw.options.followSymlinks) {
    // watch symlink directly (don't follow) and detect changes
    this.fsw._incrReadyCount();

    let linkPath;
    try {
      linkPath = await fsrealpath(path);
    } catch (e) {
      this.fsw._emitReady();
      return true;
    }

    if (this.fsw.closed) return;
    if (dir.has(item)) {
      if (this.fsw._symlinkPaths.get(full) !== linkPath) {
        this.fsw._symlinkPaths.set(full, linkPath);
        this.fsw._emit(EV_CHANGE, path, entry.stats);
      }
    } else {
      dir.add(item);
      this.fsw._symlinkPaths.set(full, linkPath);
      this.fsw._emit(EV_ADD, path, entry.stats);
    }
    this.fsw._emitReady();
    return true;
  }

  // don't follow the same symlink more than once
  if (this.fsw._symlinkPaths.has(full)) {
    return true;
  }

  this.fsw._symlinkPaths.set(full, true);
}

_handleRead(directory, initialAdd, wh, target, dir, depth, throttler) {
  // Normalize the directory name on Windows
  directory = sysPath.join(directory, EMPTY_STR);

  if (!wh.hasGlob) {
    throttler = this.fsw._throttle('readdir', directory, 1000);
    if (!throttler) return;
  }

  const previous = this.fsw._getWatchedDir(wh.path);
  const current = new Set();

  let stream = this.fsw._readdirp(directory, {
    fileFilter: entry => wh.filterPath(entry),
    directoryFilter: entry => wh.filterDir(entry),
    depth: 0
  }).on(STR_DATA, async (entry) => {
    if (this.fsw.closed) {
      stream = undefined;
      return;
    }
    const item = entry.path;
    let path = sysPath.join(directory, item);
    current.add(item);

    if (entry.stats.isSymbolicLink() && await this._handleSymlink(entry, directory, path, item)) {
      return;
    }

    if (this.fsw.closed) {
      stream = undefined;
      return;
    }
    // Files that present in current directory snapshot
    // but absent in previous are added to watch list and
    // emit `add` event.
    if (item === target || !target && !previous.has(item)) {
      this.fsw._incrReadyCount();

      // ensure relativeness of path is preserved in case of watcher reuse
      path = sysPath.join(dir, sysPath.relative(dir, path));

      this._addToNodeFs(path, initialAdd, wh, depth + 1);
    }
  }).on(EV_ERROR, this._boundHandleError);

  return new Promise(resolve =>
    stream.once(STR_END, () => {
      if (this.fsw.closed) {
        stream = undefined;
        return;
      }
      const wasThrottled = throttler ? throttler.clear() : false;

      resolve();

      // Files that absent in current directory snapshot
      // but present in previous emit `remove` event
      // and are removed from @watched[directory].
      previous.getChildren().filter((item) => {
        return item !== directory &&
          !current.has(item) &&
          // in case of intersecting globs;
          // a path may have been filtered out of this readdir, but
          // shouldn't be removed because it matches a different glob
          (!wh.hasGlob || wh.filterPath({
            fullPath: sysPath.resolve(directory, item)
          }));
      }).forEach((item) => {
        this.fsw._remove(directory, item);
      });

      stream = undefined;

      // one more time for any missed in case changes came in extremely quickly
      if (wasThrottled) this._handleRead(directory, false, wh, target, dir, depth, throttler);
    })
  );
}

/**
 * Read directory to add / remove files from `@watched` list and re-read it on change.
 * @param {String} dir fs path
 * @param {fs.Stats} stats
 * @param {Boolean} initialAdd
 * @param {Number} depth relative to user-supplied path
 * @param {String} target child path targeted for watch
 * @param {Object} wh Common watch helpers for this path
 * @param {String} realpath
 * @returns {Promise<Function>} closer for the watcher instance.
 */
async _handleDir(dir, stats, initialAdd, depth, target, wh, realpath) {
  const parentDir = this.fsw._getWatchedDir(sysPath.dirname(dir));
  const tracked = parentDir.has(sysPath.basename(dir));
  if (!(initialAdd && this.fsw.options.ignoreInitial) && !target && !tracked) {
    if (!wh.hasGlob || wh.globFilter(dir)) this.fsw._emit(EV_ADD_DIR, dir, stats);
  }

  // ensure dir is tracked (harmless if redundant)
  parentDir.add(sysPath.basename(dir));
  this.fsw._getWatchedDir(dir);
  let throttler;
  let closer;

  const oDepth = this.fsw.options.depth;
  if ((oDepth == null || depth <= oDepth) && !this.fsw._symlinkPaths.has(realpath)) {
    if (!target) {
      await this._handleRead(dir, initialAdd, wh, target, dir, depth, throttler);
      if (this.fsw.closed) return;
    }

    closer = this._watchWithNodeFs(dir, (dirPath, stats) => {
      // if current directory is removed, do nothing
      if (stats && stats.mtimeMs === 0) return;

      this._handleRead(dirPath, false, wh, target, dir, depth, throttler);
    });
  }
  return closer;
}

/**
 * Handle added file, directory, or glob pattern.
 * Delegates call to _handleFile / _handleDir after checks.
 * @param {String} path to file or ir
 * @param {Boolean} initialAdd was the file added at watch instantiation?
 * @param {Object} priorWh depth relative to user-supplied path
 * @param {Number} depth Child path actually targeted for watch
 * @param {String=} target Child path actually targeted for watch
 * @returns {Promise}
 */
async _addToNodeFs(path, initialAdd, priorWh, depth, target) {
  const ready = this.fsw._emitReady;
  if (this.fsw._isIgnored(path) || this.fsw.closed) {
    ready();
    return false;
  }

  const wh = this.fsw._getWatchHelpers(path, depth);
  if (!wh.hasGlob && priorWh) {
    wh.hasGlob = priorWh.hasGlob;
    wh.globFilter = priorWh.globFilter;
    wh.filterPath = entry => priorWh.filterPath(entry);
    wh.filterDir = entry => priorWh.filterDir(entry);
  }

  // evaluate what is at the path we're being asked to watch
  try {
    const stats = await statMethods[wh.statMethod](wh.watchPath);
    if (this.fsw.closed) return;
    if (this.fsw._isIgnored(wh.watchPath, stats)) {
      ready();
      return false;
    }

    const follow = this.fsw.options.followSymlinks && !path.includes(STAR) && !path.includes(BRACE_START);
    let closer;
    if (stats.isDirectory()) {
      const absPath = sysPath.resolve(path);
      const targetPath = follow ? await fsrealpath(path) : path;
      if (this.fsw.closed) return;
      closer = await this._handleDir(wh.watchPath, stats, initialAdd, depth, target, wh, targetPath);
      if (this.fsw.closed) return;
      // preserve this symlink's target path
      if (absPath !== targetPath && targetPath !== undefined) {
        this.fsw._symlinkPaths.set(absPath, targetPath);
      }
    } else if (stats.isSymbolicLink()) {
      const targetPath = follow ? await fsrealpath(path) : path;
      if (this.fsw.closed) return;
      const parent = sysPath.dirname(wh.watchPath);
      this.fsw._getWatchedDir(parent).add(wh.watchPath);
      this.fsw._emit(EV_ADD, wh.watchPath, stats);
      closer = await this._handleDir(parent, stats, initialAdd, depth, path, wh, targetPath);
      if (this.fsw.closed) return;

      // preserve this symlink's target path
      if (targetPath !== undefined) {
        this.fsw._symlinkPaths.set(sysPath.resolve(path), targetPath);
      }
    } else {
      closer = this._handleFile(wh.watchPath, stats, initialAdd);
    }
    ready();

    this.fsw._addPathCloser(path, closer);
    return false;

  } catch (error) {
    if (this.fsw._handleError(error)) {
      ready();
      return path;
    }
  }
}

}

module.exports = NodeFsHandler;
(The MIT License)

Copyright (c) 2011 TJ Holowaychuk <tj@vision-media.ca>

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
'Software'), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
/**
 * Module dependencies.
 */

var EventEmitter = require('events').EventEmitter;
var spawn = require('child_process').spawn;
var path = require('path');
var dirname = path.dirname;
var basename = path.basename;
var fs = require('fs');

/**
 * Inherit `Command` from `EventEmitter.prototype`.
 */

require('util').inherits(Command, EventEmitter);

/**
 * Expose the root command.
 */

exports = module.exports = new Command();

/**
 * Expose `Command`.
 */

exports.Command = Command;

/**
 * Expose `Option`.
 */

exports.Option = Option;

/**
 * Initialize a new `Option` with the given `flags` and `description`.
 *
 * @param {String} flags
 * @param {String} description
 * @api public
 */

function Option(flags, description) {
  this.flags = flags;
  this.required = flags.indexOf('<') >= 0;
  this.optional = flags.indexOf('[') >= 0;
  this.bool = flags.indexOf('-no-') === -1;
  flags = flags.split(/[ ,|]+/);
  if (flags.length > 1 && !/^[[<]/.test(flags[1])) this.short = flags.shift();
  this.long = flags.shift();
  this.description = description || '';
}

/**
 * Return option name.
 *
 * @return {String}
 * @api private
 */

Option.prototype.name = function() {
  return this.long
    .replace('--', '')
    .replace('no-', '');
};

/**
 * Return option name, in a camelcase format that can be used
 * as a object attribute key.
 *
 * @return {String}
 * @api private
 */

Option.prototype.attributeName = function() {
  return camelcase(this.name());
};

/**
 * Check if `arg` matches the short or long flag.
 *
 * @param {String} arg
 * @return {Boolean}
 * @api private
 */

Option.prototype.is = function(arg) {
  return this.short === arg || this.long === arg;
};

/**
 * Initialize a new `Command`.
 *
 * @param {String} name
 * @api public
 */

function Command(name) {
  this.commands = [];
  this.options = [];
  this._execs = {};
  this._allowUnknownOption = false;
  this._args = [];
  this._name = name || '';
}

/**
 * Add command `name`.
 *
 * The `.action()` callback is invoked when the
 * command `name` is specified via __ARGV__,
 * and the remaining arguments are applied to the
 * function for access.
 *
 * When the `name` is "*" an un-matched command
 * will be passed as the first arg, followed by
 * the rest of __ARGV__ remaining.
 *
 * Examples:
 *
 *      program
 *        .version('0.0.1')
 *        .option('-C, --chdir <path>', 'change the working directory')
 *        .option('-c, --config <path>', 'set config path. defaults to ./deploy.conf')
 *        .option('-T, --no-tests', 'ignore test hook')
 *
 *      program
 *        .command('setup')
 *        .description('run remote setup commands')
 *        .action(function() {
 *          console.log('setup');
 *        });
 *
 *      program
 *        .command('exec <cmd>')
 *        .description('run the given remote command')
 *        .action(function(cmd) {
 *          console.log('exec "%s"', cmd);
 *        });
 *
 *      program
 *        .command('teardown <dir> [otherDirs...]')
 *        .description('run teardown commands')
 *        .action(function(dir, otherDirs) {
 *          console.log('dir "%s"', dir);
 *          if (otherDirs) {
 *            otherDirs.forEach(function (oDir) {
 *              console.log('dir "%s"', oDir);
 *            });
 *          }
 *        });
 *
 *      program
 *        .command('*')
 *        .description('deploy the given env')
 *        .action(function(env) {
 *          console.log('deploying "%s"', env);
 *        });
 *
 *      program.parse(process.argv);
  *
 * @param {String} name
 * @param {String} [desc] for git-style sub-commands
 * @return {Command} the new command
 * @api public
 */

Command.prototype.command = function(name, desc, opts) {
  if (typeof desc === 'object' && desc !== null) {
    opts = desc;
    desc = null;
  }
  opts = opts || {};
  var args = name.split(/ +/);
  var cmd = new Command(args.shift());

  if (desc) {
    cmd.description(desc);
    this.executables = true;
    this._execs[cmd._name] = true;
    if (opts.isDefault) this.defaultExecutable = cmd._name;
  }
  cmd._noHelp = !!opts.noHelp;
  this.commands.push(cmd);
  cmd.parseExpectedArgs(args);
  cmd.parent = this;

  if (desc) return this;
  return cmd;
};

/**
 * Define argument syntax for the top-level command.
 *
 * @api public
 */

Command.prototype.arguments = function(desc) {
  return this.parseExpectedArgs(desc.split(/ +/));
};

/**
 * Add an implicit `help [cmd]` subcommand
 * which invokes `--help` for the given command.
 *
 * @api private
 */

Command.prototype.addImplicitHelpCommand = function() {
  this.command('help [cmd]', 'display help for [cmd]');
};

/**
 * Parse expected `args`.
 *
 * For example `["[type]"]` becomes `[{ required: false, name: 'type' }]`.
 *
 * @param {Array} args
 * @return {Command} for chaining
 * @api public
 */

Command.prototype.parseExpectedArgs = function(args) {
  if (!args.length) return;
  var self = this;
  args.forEach(function(arg) {
    var argDetails = {
      required: false,
      name: '',
      variadic: false
    };

    switch (arg[0]) {
      case '<':
        argDetails.required = true;
        argDetails.name = arg.slice(1, -1);
        break;
      case '[':
        argDetails.name = arg.slice(1, -1);
        break;
    }

    if (argDetails.name.length > 3 && argDetails.name.slice(-3) === '...') {
      argDetails.variadic = true;
      argDetails.name = argDetails.name.slice(0, -3);
    }
    if (argDetails.name) {
      self._args.push(argDetails);
    }
  });
  return this;
};

/**
 * Register callback `fn` for the command.
 *
 * Examples:
 *
 *      program
 *        .command('help')
 *        .description('display verbose help')
 *        .action(function() {
 *           // output help here
 *        });
 *
 * @param {Function} fn
 * @return {Command} for chaining
 * @api public
 */

Command.prototype.action = function(fn) {
  var self = this;
  var listener = function(args, unknown) {
    // Parse any so-far unknown options
    args = args || [];
    unknown = unknown || [];

    var parsed = self.parseOptions(unknown);

    // Output help if necessary
    outputHelpIfNecessary(self, parsed.unknown);

    // If there are still any unknown options, then we simply
    // die, unless someone asked for help, in which case we give it
    // to them, and then we die.
    if (parsed.unknown.length > 0) {
      self.unknownOption(parsed.unknown[0]);
    }

    // Leftover arguments need to be pushed back. Fixes issue #56
    if (parsed.args.length) args = parsed.args.concat(args);

    self._args.forEach(function(arg, i) {
      if (arg.required && args[i] == null) {
        self.missingArgument(arg.name);
      } else if (arg.variadic) {
        if (i !== self._args.length - 1) {
          self.variadicArgNotLast(arg.name);
        }

        args[i] = args.splice(i);
      }
    });

    // Always append ourselves to the end of the arguments,
    // to make sure we match the number of arguments the user
    // expects
    if (self._args.length) {
      args[self._args.length] = self;
    } else {
      args.push(self);
    }

    fn.apply(self, args);
  };
  var parent = this.parent || this;
  var name = parent === this ? '*' : this._name;
  parent.on('command:' + name, listener);
  if (this._alias) parent.on('command:' + this._alias, listener);
  return this;
};

/**
 * Define option with `flags`, `description` and optional
 * coercion `fn`.
 *
 * The `flags` string should contain both the short and long flags,
 * separated by comma, a pipe or space. The following are all valid
 * all will output this way when `--help` is used.
 *
 *    "-p, --pepper"
 *    "-p|--pepper"
 *    "-p --pepper"
 *
 * Examples:
 *
 *     // simple boolean defaulting to false
 *     program.option('-p, --pepper', 'add pepper');
 *
 *     --pepper
 *     program.pepper
 *     // => Boolean
 *
 *     // simple boolean defaulting to true
 *     program.option('-C, --no-cheese', 'remove cheese');
 *
 *     program.cheese
 *     // => true
 *
 *     --no-cheese
 *     program.cheese
 *     // => false
 *
 *     // required argument
 *     program.option('-C, --chdir <path>', 'change the working directory');
 *
 *     --chdir /tmp
 *     program.chdir
 *     // => "/tmp"
 *
 *     // optional argument
 *     program.option('-c, --cheese [type]', 'add cheese [marble]');
 *
 * @param {String} flags
 * @param {String} description
 * @param {Function|*} [fn] or default
 * @param {*} [defaultValue]
 * @return {Command} for chaining
 * @api public
 */

Command.prototype.option = function(flags, description, fn, defaultValue) {
  var self = this,
    option = new Option(flags, description),
    oname = option.name(),
    name = option.attributeName();

  // default as 3rd arg
  if (typeof fn !== 'function') {
    if (fn instanceof RegExp) {
      var regex = fn;
      fn = function(val, def) {
        var m = regex.exec(val);
        return m ? m[0] : def;
      };
    } else {
      defaultValue = fn;
      fn = null;
    }
  }

  // preassign default value only for --no-*, [optional], or <required>
  if (!option.bool || option.optional || option.required) {
    // when --no-* we make sure default is true
    if (!option.bool) defaultValue = true;
    // preassign only if we have a default
    if (defaultValue !== undefined) {
      self[name] = defaultValue;
      option.defaultValue = defaultValue;
    }
  }

  // register the option
  this.options.push(option);

  // when it's passed assign the value
  // and conditionally invoke the callback
  this.on('option:' + oname, function(val) {
    // coercion
    if (val !== null && fn) {
      val = fn(val, self[name] === undefined ? defaultValue : self[name]);
    }

    // unassigned or bool
    if (typeof self[name] === 'boolean' || typeof self[name] === 'undefined') {
      // if no value, bool true, and we have a default, then use it!
      if (val == null) {
        self[name] = option.bool
          ? defaultValue || true
          : false;
      } else {
        self[name] = val;
      }
    } else if (val !== null) {
      // reassign
      self[name] = val;
    }
  });

  return this;
};

/**
 * Allow unknown options on the command line.
 *
 * @param {Boolean} arg if `true` or omitted, no error will be thrown
 * for unknown options.
 * @api public
 */
Command.prototype.allowUnknownOption = function(arg) {
  this._allowUnknownOption = arguments.length === 0 || arg;
  return this;
};

/**
 * Parse `argv`, settings options and invoking commands when defined.
 *
 * @param {Array} argv
 * @return {Command} for chaining
 * @api public
 */

Command.prototype.parse = function(argv) {
  // implicit help
  if (this.executables) this.addImplicitHelpCommand();

  // store raw args
  this.rawArgs = argv;

  // guess name
  this._name = this._name || basename(argv[1], '.js');

  // github-style sub-commands with no sub-command
  if (this.executables && argv.length < 3 && !this.defaultExecutable) {
    // this user needs help
    argv.push('--help');
  }

  // process argv
  var parsed = this.parseOptions(this.normalize(argv.slice(2)));
  var args = this.args = parsed.args;

  var result = this.parseArgs(this.args, parsed.unknown);

  // executable sub-commands
  var name = result.args[0];

  var aliasCommand = null;
  // check alias of sub commands
  if (name) {
    aliasCommand = this.commands.filter(function(command) {
      return command.alias() === name;
    })[0];
  }

  if (this._execs[name] === true) {
    return this.executeSubCommand(argv, args, parsed.unknown);
  } else if (aliasCommand) {
    // is alias of a subCommand
    args[0] = aliasCommand._name;
    return this.executeSubCommand(argv, args, parsed.unknown);
  } else if (this.defaultExecutable) {
    // use the default subcommand
    args.unshift(this.defaultExecutable);
    return this.executeSubCommand(argv, args, parsed.unknown);
  }

  return result;
};

/**
 * Execute a sub-command executable.
 *
 * @param {Array} argv
 * @param {Array} args
 * @param {Array} unknown
 * @api private
 */

Command.prototype.executeSubCommand = function(argv, args, unknown) {
  args = args.concat(unknown);

  if (!args.length) this.help();
  if (args[0] === 'help' && args.length === 1) this.help();

  // <cmd> --help
  if (args[0] === 'help') {
    args[0] = args[1];
    args[1] = '--help';
  }

  // executable
  var f = argv[1];
  // name of the subcommand, link `pm-install`
  var bin = basename(f, path.extname(f)) + '-' + args[0];

  // In case of globally installed, get the base dir where executable
  //  subcommand file should be located at
  var baseDir;

  var resolvedLink = fs.realpathSync(f);

  baseDir = dirname(resolvedLink);

  // prefer local `./<bin>` to bin in the $PATH
  var localBin = path.join(baseDir, bin);

  // whether bin file is a js script with explicit `.js` or `.ts` extension
  var isExplicitJS = false;
  if (exists(localBin + '.js')) {
    bin = localBin + '.js';
    isExplicitJS = true;
  } else if (exists(localBin + '.ts')) {
    bin = localBin + '.ts';
    isExplicitJS = true;
  } else if (exists(localBin)) {
    bin = localBin;
  }

  args = args.slice(1);

  var proc;
  if (process.platform !== 'win32') {
    if (isExplicitJS) {
      args.unshift(bin);
      // add executable arguments to spawn
      args = (process.execArgv || []).concat(args);

      proc = spawn(process.argv[0], args, { stdio: 'inherit', customFds: [0, 1, 2] });
    } else {
      proc = spawn(bin, args, { stdio: 'inherit', customFds: [0, 1, 2] });
    }
  } else {
    args.unshift(bin);
    proc = spawn(process.execPath, args, { stdio: 'inherit' });
  }

  var signals = ['SIGUSR1', 'SIGUSR2', 'SIGTERM', 'SIGINT', 'SIGHUP'];
  signals.forEach(function(signal) {
    process.on(signal, function() {
      if (proc.killed === false && proc.exitCode === null) {
        proc.kill(signal);
      }
    });
  });
  proc.on('close', process.exit.bind(process));
  proc.on('error', function(err) {
    if (err.code === 'ENOENT') {
      console.error('error: %s(1) does not exist, try --help', bin);
    } else if (err.code === 'EACCES') {
      console.error('error: %s(1) not executable. try chmod or run with root', bin);
    }
    process.exit(1);
  });

  // Store the reference to the child process
  this.runningCommand = proc;
};

/**
 * Normalize `args`, splitting joined short flags. For example
 * the arg "-abc" is equivalent to "-a -b -c".
 * This also normalizes equal sign and splits "--abc=def" into "--abc def".
 *
 * @param {Array} args
 * @return {Array}
 * @api private
 */

Command.prototype.normalize = function(args) {
  var ret = [],
    arg,
    lastOpt,
    index;

  for (var i = 0, len = args.length; i < len; ++i) {
    arg = args[i];
    if (i > 0) {
      lastOpt = this.optionFor(args[i - 1]);
    }

    if (arg === '--') {
      // Honor option terminator
      ret = ret.concat(args.slice(i));
      break;
    } else if (lastOpt && lastOpt.required) {
      ret.push(arg);
    } else if (arg.length > 1 && arg[0] === '-' && arg[1] !== '-') {
      arg.slice(1).split('').forEach(function(c) {
        ret.push('-' + c);
      });
    } else if (/^--/.test(arg) && ~(index = arg.indexOf('='))) {
      ret.push(arg.slice(0, index), arg.slice(index + 1));
    } else {
      ret.push(arg);
    }
  }

  return ret;
};

/**
 * Parse command `args`.
 *
 * When listener(s) are available those
 * callbacks are invoked, otherwise the "*"
 * event is emitted and those actions are invoked.
 *
 * @param {Array} args
 * @return {Command} for chaining
 * @api private
 */

Command.prototype.parseArgs = function(args, unknown) {
  var name;

  if (args.length) {
    name = args[0];
    if (this.listeners('command:' + name).length) {
      this.emit('command:' + args.shift(), args, unknown);
    } else {
      this.emit('command:*', args);
    }
  } else {
    outputHelpIfNecessary(this, unknown);

    // If there were no args and we have unknown options,
    // then they are extraneous and we need to error.
    if (unknown.length > 0) {
      this.unknownOption(unknown[0]);
    }
    if (this.commands.length === 0 &&
        this._args.filter(function(a) { return a.required; }).length === 0) {
      this.emit('command:*');
    }
  }

  return this;
};

/**
 * Return an option matching `arg` if any.
 *
 * @param {String} arg
 * @return {Option}
 * @api private
 */

Command.prototype.optionFor = function(arg) {
  for (var i = 0, len = this.options.length; i < len; ++i) {
    if (this.options[i].is(arg)) {
      return this.options[i];
    }
  }
};

/**
 * Parse options from `argv` returning `argv`
 * void of these options.
 *
 * @param {Array} argv
 * @return {Array}
 * @api public
 */

Command.prototype.parseOptions = function(argv) {
  var args = [],
    len = argv.length,
    literal,
    option,
    arg;

  var unknownOptions = [];

  // parse options
  for (var i = 0; i < len; ++i) {
    arg = argv[i];

    // literal args after --
    if (literal) {
      args.push(arg);
      continue;
    }

    if (arg === '--') {
      literal = true;
      continue;
    }

    // find matching Option
    option = this.optionFor(arg);

    // option is defined
    if (option) {
      // requires arg
      if (option.required) {
        arg = argv[++i];
        if (arg == null) return this.optionMissingArgument(option);
        this.emit('option:' + option.name(), arg);
      // optional arg
      } else if (option.optional) {
        arg = argv[i + 1];
        if (arg == null || (arg[0] === '-' && arg !== '-')) {
          arg = null;
        } else {
          ++i;
        }
        this.emit('option:' + option.name(), arg);
      // bool
      } else {
        this.emit('option:' + option.name());
      }
      continue;
    }

    // looks like an option
    if (arg.length > 1 && arg[0] === '-') {
      unknownOptions.push(arg);

      // If the next argument looks like it might be
      // an argument for this option, we pass it on.
      // If it isn't, then it'll simply be ignored
      if ((i + 1) < argv.length && argv[i + 1][0] !== '-') {
        unknownOptions.push(argv[++i]);
      }
      continue;
    }

    // arg
    args.push(arg);
  }

  return { args: args, unknown: unknownOptions };
};

/**
 * Return an object containing options as key-value pairs
 *
 * @return {Object}
 * @api public
 */
Command.prototype.opts = function() {
  var result = {},
    len = this.options.length;

  for (var i = 0; i < len; i++) {
    var key = this.options[i].attributeName();
    result[key] = key === this._versionOptionName ? this._version : this[key];
  }
  return result;
};

/**
 * Argument `name` is missing.
 *
 * @param {String} name
 * @api private
 */

Command.prototype.missingArgument = function(name) {
  console.error("error: missing required argument `%s'", name);
  process.exit(1);
};

/**
 * `Option` is missing an argument, but received `flag` or nothing.
 *
 * @param {String} option
 * @param {String} flag
 * @api private
 */

Command.prototype.optionMissingArgument = function(option, flag) {
  if (flag) {
    console.error("error: option `%s' argument missing, got `%s'", option.flags, flag);
  } else {
    console.error("error: option `%s' argument missing", option.flags);
  }
  process.exit(1);
};

/**
 * Unknown option `flag`.
 *
 * @param {String} flag
 * @api private
 */

Command.prototype.unknownOption = function(flag) {
  if (this._allowUnknownOption) return;
  console.error("error: unknown option `%s'", flag);
  process.exit(1);
};

/**
 * Variadic argument with `name` is not the last argument as required.
 *
 * @param {String} name
 * @api private
 */

Command.prototype.variadicArgNotLast = function(name) {
  console.error("error: variadic arguments must be last `%s'", name);
  process.exit(1);
};

/**
 * Set the program version to `str`.
 *
 * This method auto-registers the "-V, --version" flag
 * which will print the version number when passed.
 *
 * @param {String} str
 * @param {String} [flags]
 * @return {Command} for chaining
 * @api public
 */

Command.prototype.version = function(str, flags) {
  if (arguments.length === 0) return this._version;
  this._version = str;
  flags = flags || '-V, --version';
  var versionOption = new Option(flags, 'output the version number');
  this._versionOptionName = versionOption.long.substr(2) || 'version';
  this.options.push(versionOption);
  this.on('option:' + this._versionOptionName, function() {
    process.stdout.write(str + '\n');
    process.exit(0);
  });
  return this;
};

/**
 * Set the description to `str`.
 *
 * @param {String} str
 * @param {Object} argsDescription
 * @return {String|Command}
 * @api public
 */

Command.prototype.description = function(str, argsDescription) {
  if (arguments.length === 0) return this._description;
  this._description = str;
  this._argsDescription = argsDescription;
  return this;
};

/**
 * Set an alias for the command
 *
 * @param {String} alias
 * @return {String|Command}
 * @api public
 */

Command.prototype.alias = function(alias) {
  var command = this;
  if (this.commands.length !== 0) {
    command = this.commands[this.commands.length - 1];
  }

  if (arguments.length === 0) return command._alias;

  if (alias === command._name) throw new Error('Command alias can\'t be the same as its name');

  command._alias = alias;
  return this;
};

/**
 * Set / get the command usage `str`.
 *
 * @param {String} str
 * @return {String|Command}
 * @api public
 */

Command.prototype.usage = function(str) {
  var args = this._args.map(function(arg) {
    return humanReadableArgName(arg);
  });

  var usage = '[options]' +
    (this.commands.length ? ' [command]' : '') +
    (this._args.length ? ' ' + args.join(' ') : '');

  if (arguments.length === 0) return this._usage || usage;
  this._usage = str;

  return this;
};

/**
 * Get or set the name of the command
 *
 * @param {String} str
 * @return {String|Command}
 * @api public
 */

Command.prototype.name = function(str) {
  if (arguments.length === 0) return this._name;
  this._name = str;
  return this;
};

/**
 * Return prepared commands.
 *
 * @return {Array}
 * @api private
 */

Command.prototype.prepareCommands = function() {
  return this.commands.filter(function(cmd) {
    return !cmd._noHelp;
  }).map(function(cmd) {
    var args = cmd._args.map(function(arg) {
      return humanReadableArgName(arg);
    }).join(' ');

    return [
      cmd._name +
        (cmd._alias ? '|' + cmd._alias : '') +
        (cmd.options.length ? ' [options]' : '') +
        (args ? ' ' + args : ''),
      cmd._description
    ];
  });
};

/**
 * Return the largest command length.
 *
 * @return {Number}
 * @api private
 */

Command.prototype.largestCommandLength = function() {
  var commands = this.prepareCommands();
  return commands.reduce(function(max, command) {
    return Math.max(max, command[0].length);
  }, 0);
};

/**
 * Return the largest option length.
 *
 * @return {Number}
 * @api private
 */

Command.prototype.largestOptionLength = function() {
  var options = [].slice.call(this.options);
  options.push({
    flags: '-h, --help'
  });
  return options.reduce(function(max, option) {
    return Math.max(max, option.flags.length);
  }, 0);
};

/**
 * Return the largest arg length.
 *
 * @return {Number}
 * @api private
 */

Command.prototype.largestArgLength = function() {
  return this._args.reduce(function(max, arg) {
    return Math.max(max, arg.name.length);
  }, 0);
};

/**
 * Return the pad width.
 *
 * @return {Number}
 * @api private
 */

Command.prototype.padWidth = function() {
  var width = this.largestOptionLength();
  if (this._argsDescription && this._args.length) {
    if (this.largestArgLength() > width) {
      width = this.largestArgLength();
    }
  }

  if (this.commands && this.commands.length) {
    if (this.largestCommandLength() > width) {
      width = this.largestCommandLength();
    }
  }

  return width;
};

/**
 * Return help for options.
 *
 * @return {String}
 * @api private
 */

Command.prototype.optionHelp = function() {
  var width = this.padWidth();

  // Append the help information
  return this.options.map(function(option) {
    return pad(option.flags, width) + '  ' + option.description +
      ((option.bool && option.defaultValue !== undefined) ? ' (default: ' + JSON.stringify(option.defaultValue) + ')' : '');
  }).concat([pad('-h, --help', width) + '  ' + 'output usage information'])
    .join('\n');
};

/**
 * Return command help documentation.
 *
 * @return {String}
 * @api private
 */

Command.prototype.commandHelp = function() {
  if (!this.commands.length) return '';

  var commands = this.prepareCommands();
  var width = this.padWidth();

  return [
    'Commands:',
    commands.map(function(cmd) {
      var desc = cmd[1] ? '  ' + cmd[1] : '';
      return (desc ? pad(cmd[0], width) : cmd[0]) + desc;
    }).join('\n').replace(/^/gm, '  '),
    ''
  ].join('\n');
};

/**
 * Return program help documentation.
 *
 * @return {String}
 * @api private
 */

Command.prototype.helpInformation = function() {
  var desc = [];
  if (this._description) {
    desc = [
      this._description,
      ''
    ];

    var argsDescription = this._argsDescription;
    if (argsDescription && this._args.length) {
      var width = this.padWidth();
      desc.push('Arguments:');
      desc.push('');
      this._args.forEach(function(arg) {
        desc.push('  ' + pad(arg.name, width) + '  ' + argsDescription[arg.name]);
      });
      desc.push('');
    }
  }

  var cmdName = this._name;
  if (this._alias) {
    cmdName = cmdName + '|' + this._alias;
  }
  var usage = [
    'Usage: ' + cmdName + ' ' + this.usage(),
    ''
  ];

  var cmds = [];
  var commandHelp = this.commandHelp();
  if (commandHelp) cmds = [commandHelp];

  var options = [
    'Options:',
    '' + this.optionHelp().replace(/^/gm, '  '),
    ''
  ];

  return usage
    .concat(desc)
    .concat(options)
    .concat(cmds)
    .join('\n');
};

/**
 * Output help information for this command
 *
 * @api public
 */

Command.prototype.outputHelp = function(cb) {
  if (!cb) {
    cb = function(passthru) {
      return passthru;
    };
  }
  process.stdout.write(cb(this.helpInformation()));
  this.emit('--help');
};

/**
 * Output help information and exit.
 *
 * @api public
 */

Command.prototype.help = function(cb) {
  this.outputHelp(cb);
  process.exit();
};

/**
 * Camel-case the given `flag`
 *
 * @param {String} flag
 * @return {String}
 * @api private
 */

function camelcase(flag) {
  return flag.split('-').reduce(function(str, word) {
    return str + word[0].toUpperCase() + word.slice(1);
  });
}

/**
 * Pad `str` to `width`.
 *
 * @param {String} str
 * @param {Number} width
 * @return {String}
 * @api private
 */

function pad(str, width) {
  var len = Math.max(0, width - str.length);
  return str + Array(len + 1).join(' ');
}

/**
 * Output help information if necessary
 *
 * @param {Command} command to output help for
 * @param {Array} array of options to search for -h or --help
 * @api private
 */

function outputHelpIfNecessary(cmd, options) {
  options = options || [];
  for (var i = 0; i < options.length; i++) {
    if (options[i] === '--help' || options[i] === '-h') {
      cmd.outputHelp();
      process.exit(0);
    }
  }
}

/**
 * Takes an argument an returns its human readable equivalent for help usage.
 *
 * @param {Object} arg
 * @return {String}
 * @api private
 */

function humanReadableArgName(arg) {
  var nameOutput = arg.name + (arg.variadic === true ? '...' : '');

  return arg.required
    ? '<' + nameOutput + '>'
    : '[' + nameOutput + ']';
}

// for versions before node v0.8 when there weren't `fs.existsSync`
function exists(file) {
  try {
    if (fs.statSync(file).isFile()) {
      return true;
    }
  } catch (e) {
    return false;
  }
}
{
  "name": "commander",
  "version": "2.20.3",
  "description": "the complete solution for node.js command-line programs",
  "author": "TJ Holowaychuk <tj@vision-media.ca>",
  "license": "MIT",
  "repository": {
    "type": "git",
    "url": "https://github.com/tj/commander.js.git"
  },
  "main": "index",
  "files": [
    "index.js",
    "typings/index.d.ts"
  ],
  "dependencies": {},
  "devDependencies": {
    "@types/node": "^12.7.8",
    "eslint": "^6.4.0",
    "should": "^13.2.3",
    "sinon": "^7.5.0",
    "standard": "^14.3.1",
    "ts-node": "^8.4.1",
    "typescript": "^3.6.3"
  },
  "typings": "typings/index.d.ts"
}MIT License 

Copyright (c) 2016 Serg Hospodarets

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
//// VARIABLES ////

// global map to be filled via variables
$css-vars: ();

// the variable may be set to "true" anywhere in the code,
// so native CSS custom properties will be used instead of the Sass global map
$css-vars-use-native: false !default;

// enables the output of debug messages
$css-vars-debug-log: false !default;

//// FUNCTIONS ////

///
// Assigns a variable to the global map
///
@function _cssVarAssign($varName: null, $varValue: null) {
  // CHECK PARAMS
  @if ($varName==null) {
    @error "Variable name is expected, instead got: null";
  }
  @if ($varValue==null) {
    @error "Variable value is expected, instead got: null";
  }

  // assign to the global map
  @if ($css-vars-debug-log and map-get($css-vars, $varName)) {
    @debug "'#{$varName}' variable is reassigned";
  }

  @return map-merge($css-vars, ($varName: $varValue));
}

///
// Emulates var() CSS native function behavior
//
// $args[0] {String} "--" + variable name
// [$args[1]] Optional default value if variable is not assigned yet
//
// E.G.:
// color: var(--main-color);
// background: var(--main-bg, green);
///
@function var($args...) {
  // CHECK PARAMS
  @if (length($args)==0) {
    @error "Variable name is expected to be passed to the var() function";
  }
  @if (str-length(nth($args, 1)) < 2 or str-slice(nth($args, 1), 0, 2) != '--') {
    @error "Variable name is expected to start from '--'";
  }

  // PROCESS
  $varName: nth($args, 1);
  $varValue: map-get($css-vars, $varName);

  @if ($css-vars-debug-log or not $css-vars-use-native) { // Sass or debug
    @if ($varValue==null) { // variable is not provided so far
      @if (length($args)==2) { // the default value is passed
        @if ($css-vars-debug-log) {
          @debug "Provided default value is used for the variable: '#{$varName}'";
        }
        $varValue: nth($args, 2);
      } @else if ($css-vars-debug-log) {
        @debug "Variable '#{$varName}' is not assigned";
        @if (not $css-vars-use-native) {
          @debug "The 'var(#{$varName}...)' usage will be skipped in the output CSS";
        }
      }
    }
  }

  @if ($css-vars-use-native) { // CSS variables
    // Native CSS: don't process function in case of native
    @return unquote('var(' + $args + ')');
  } @else {
    // Sass: return value from the map
    @return $varValue;
  }
}

//// MIXIN ////

///
// CSS mixin to provide variables
// E.G.:
// @include css-vars((
//    --color: rebeccapurple,
//    --height: 68px,
//    --margin-top: calc(2vh + 20px)
// ));
///
@mixin css-vars($varMap: null) {
  // CHECK PARAMS
  @if ($varMap==null) {
    @error "Map of variables is expected, instead got: null";
  }
  @if (type_of($varMap)!=map) {
    @error "Map of variables is expected, instead got another type passed: #{type_of($varMap)}";
  }

  // PROCESS
  @if ($css-vars-debug-log or not $css-vars-use-native) { // Sass or debug
    // merge variables and values to the global map (provides no output)
    @each $varName, $varValue in $varMap {
      $css-vars: _cssVarAssign($varName, $varValue) !global; // store in global variable
    }
  }

  @if ($css-vars-use-native) { // CSS variables
    // Native CSS: assign CSS custom properties to the global scope
    @at-root :root {
      @each $varName, $varValue in $varMap {
        @if (type_of($varValue)==string) {
          #{$varName}: $varValue // to prevent quotes interpolation
        } @else {
          #{$varName}: #{$varValue}
        }
      }
    }
  }
}{
  "name": "css-vars",
  "version": "2.4.0",
  "main": "css-vars.scss",
  "description": "Use CSS Custom Properties with Sass",
  "author": {
    "name": "Serg Hospodarets",
    "email": "shospodarets@gmail.com",
    "url": "https://hospodarets.com/"
  },
  "license": "MIT",
  "devDependencies": {
    "gulp": "^4.0.2",
    "gulp-sass": "^5.1.0",
    "node-glob": "^1.2.0",
    "node-sass": "^7.0.1",
    "tape": "^5.5.2"
  },
  "repository": "https://github.com/malyw/css-vars"
}Copyright (c) 2017 David Herman

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
#!/usr/bin/env node

var build = require("./index.js");
var program = require('commander');

var options = process.argv.slice(0, 2);
var command;

if (process.argv.length > 2 && process.argv[2].startsWith("-")) {
  for (var i = 2; i < process.argv.length && process.argv[i] !== "--"; i++) {
    options.push(process.argv[i]);
  }
  command = process.argv.slice(i + 1);
} else {
  command = process.argv.slice(2);
}

program
  .version(require("./package.json").version)
  .usage("[options --] <command...>")
  .arguments("<command...>")
  .option("--electron <version>", "Electron version")
  .option("--arch <arch>",        "target architecture")
  .option("--disturl <url>",      "Electron headers URL")
  .option("--devdir <path>",      "Electron headers cache directory")
  .parse(options);

if (command.length === 0) {
  program.help();
}

build(command, {
  electron: program.electron,
  arch: program.arch,
  disturl: program.disturl,
  devdir: program.devdir
}, (err) => {
  if (err) {
    console.error(err.message);
    process.exit(1);
  }
});
var spawn    = require('child_process').spawn;
var path     = require('path');
var fs       = require('fs');
var mkdirp   = require('mkdirp');
var os       = require('os');

function error(msg, cmd, args, opts, stderr, prev) {
  var err = new Error(msg);

  err.cmd     = cmd;
  err.args    = args;
  err.opts    = opts;
  err.stderr  = stderr;

  if (prev) {
    err.prev = prev;
  }

  return err;
}

const possibleModuleNames = ['electron', 'electron-prebuilt', 'electron-prebuilt-compile'];

function presolve(id) {
  var parent = module.parent;
  for (; parent; parent = parent.parent) {
    try {
      return parent.require.resolve(id);
    } catch (ignored) { }
  }
  return null;
}

function locateElectronPrebuilt() {
  let electronPath;

  // Attempt to locate modules by path
  let foundModule = possibleModuleNames.some((moduleName) => {
    electronPath = path.join(__dirname, '..', '..', moduleName);
    return fs.existsSync(electronPath);
  });

  // Return a path if we found one
  if (foundModule) return electronPath;

  // Attempt to locate modules by require
  foundModule = possibleModuleNames.some((moduleName) => {
    try {
      electronPath = path.join(require.resolve(moduleName), '..');
    } catch (e) {
      return false;
    }
    return fs.existsSync(electronPath);
  });

  // Return a path if we found one
  if (foundModule) return electronPath;
  return null;
}

function getElectronVersion() {
  let electron = locateElectronPrebuilt();
  if (!electron) {
    return null;
  }
  return require(path.join(electron, 'package.json')).version;
}

module.exports = function build(command, opts, done) {
  if (typeof opts === 'undefined' || typeof opts === 'function') {
    done = opts;
  }
  opts = opts || {};
  done = done || function() {};

  var stderr = "";

  let electron = opts.electron || getElectronVersion();
  if (!electron) {
    throw new Error('could not determine electron version');
  }

  let arch = opts.arch || process.arch;

  let disturl = opts.disturl || "https://atom.io/download/electron";

  let devdir = opts.devdir || path.join(os.homedir(), ".electron-gyp");

  mkdirp(devdir, function(err) {
    if (err) {
      return done(err);
    }

    var spawnOpts = {
      stdio: 'inherit',
      env: Object.assign({}, process.env, {
        npm_config_target: electron,
        npm_config_arch: arch,
        npm_config_target_arch: arch,
        npm_config_disturl: disturl,
        npm_config_runtime: 'electron',
        npm_config_build_from_source: true,
        npm_config_devdir: devdir
      }),
      shell: true
    };

    var cmd = command.shift();
    var args = command;

    spawn(cmd, args, spawnOpts)
      .on('error', function(prev) {
        done(error("electron-build-env error: " + prev, cmd, args, spawnOpts, stderr, prev));
      })
      .on('close', function(code) {
        if (code !== 0 || stderr.indexOf('ERR') !== -1) { //https://github.com/npm/npm/issues/4752
          done(error('electron-build-env error', cmd, args, spawnOpts, stderr));
        } else {
          done(null);
        }
      })
      .on('data', function(data) {
        stderr += String(data);
      });
  });
};
{
  "name": "electron-build-env",
  "version": "0.2.0",
  "description": "runs a command with the environment set up for building native modules in an Electron app",
  "main": "index.js",
  "bin": {
    "electron-build-env": "./cli.js"
  },
  "repository": {
    "type": "git",
    "url": "git+https://github.com/dherman/electron-build-env.git"
  },
  "author": "Dave Herman <dherman@mozilla.com>",
  "license": "MIT",
  "homepage": "https://github.com/dherman/electron-build-env#readme",
  "dependencies": {
    "commander": "^2.9.0",
    "mkdirp": "^0.5.1"
  }
}The MIT License (MIT)

Copyright (c) 2014-present, Jon Schlinkert.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
/*!
 * fill-range <https://github.com/jonschlinkert/fill-range>
 *
 * Copyright (c) 2014-present, Jon Schlinkert.
 * Licensed under the MIT License.
 */

'use strict';

const util = require('util');
const toRegexRange = require('to-regex-range');

const isObject = val => val !== null && typeof val === 'object' && !Array.isArray(val);

const transform = toNumber => {
  return value => toNumber === true ? Number(value) : String(value);
};

const isValidValue = value => {
  return typeof value === 'number' || (typeof value === 'string' && value !== '');
};

const isNumber = num => Number.isInteger(+num);

const zeros = input => {
  let value = `${input}`;
  let index = -1;
  if (value[0] === '-') value = value.slice(1);
  if (value === '0') return false;
  while (value[++index] === '0');
  return index > 0;
};

const stringify = (start, end, options) => {
  if (typeof start === 'string' || typeof end === 'string') {
    return true;
  }
  return options.stringify === true;
};

const pad = (input, maxLength, toNumber) => {
  if (maxLength > 0) {
    let dash = input[0] === '-' ? '-' : '';
    if (dash) input = input.slice(1);
    input = (dash + input.padStart(dash ? maxLength - 1 : maxLength, '0'));
  }
  if (toNumber === false) {
    return String(input);
  }
  return input;
};

const toMaxLen = (input, maxLength) => {
  let negative = input[0] === '-' ? '-' : '';
  if (negative) {
    input = input.slice(1);
    maxLength--;
  }
  while (input.length < maxLength) input = '0' + input;
  return negative ? ('-' + input) : input;
};

const toSequence = (parts, options, maxLen) => {
  parts.negatives.sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
  parts.positives.sort((a, b) => a < b ? -1 : a > b ? 1 : 0);

  let prefix = options.capture ? '' : '?:';
  let positives = '';
  let negatives = '';
  let result;

  if (parts.positives.length) {
    positives = parts.positives.map(v => toMaxLen(String(v), maxLen)).join('|');
  }

  if (parts.negatives.length) {
    negatives = `-(${prefix}${parts.negatives.map(v => toMaxLen(String(v), maxLen)).join('|')})`;
  }

  if (positives && negatives) {
    result = `${positives}|${negatives}`;
  } else {
    result = positives || negatives;
  }

  if (options.wrap) {
    return `(${prefix}${result})`;
  }

  return result;
};

const toRange = (a, b, isNumbers, options) => {
  if (isNumbers) {
    return toRegexRange(a, b, { wrap: false, ...options });
  }

  let start = String.fromCharCode(a);
  if (a === b) return start;

  let stop = String.fromCharCode(b);
  return `[${start}-${stop}]`;
};

const toRegex = (start, end, options) => {
  if (Array.isArray(start)) {
    let wrap = options.wrap === true;
    let prefix = options.capture ? '' : '?:';
    return wrap ? `(${prefix}${start.join('|')})` : start.join('|');
  }
  return toRegexRange(start, end, options);
};

const rangeError = (...args) => {
  return new RangeError('Invalid range arguments: ' + util.inspect(...args));
};

const invalidRange = (start, end, options) => {
  if (options.strictRanges === true) throw rangeError([start, end]);
  return [];
};

const invalidStep = (step, options) => {
  if (options.strictRanges === true) {
    throw new TypeError(`Expected step "${step}" to be a number`);
  }
  return [];
};

const fillNumbers = (start, end, step = 1, options = {}) => {
  let a = Number(start);
  let b = Number(end);

  if (!Number.isInteger(a) || !Number.isInteger(b)) {
    if (options.strictRanges === true) throw rangeError([start, end]);
    return [];
  }

  // fix negative zero
  if (a === 0) a = 0;
  if (b === 0) b = 0;

  let descending = a > b;
  let startString = String(start);
  let endString = String(end);
  let stepString = String(step);
  step = Math.max(Math.abs(step), 1);

  let padded = zeros(startString) || zeros(endString) || zeros(stepString);
  let maxLen = padded ? Math.max(startString.length, endString.length, stepString.length) : 0;
  let toNumber = padded === false && stringify(start, end, options) === false;
  let format = options.transform || transform(toNumber);

  if (options.toRegex && step === 1) {
    return toRange(toMaxLen(start, maxLen), toMaxLen(end, maxLen), true, options);
  }

  let parts = { negatives: [], positives: [] };
  let push = num => parts[num < 0 ? 'negatives' : 'positives'].push(Math.abs(num));
  let range = [];
  let index = 0;

  while (descending ? a >= b : a <= b) {
    if (options.toRegex === true && step > 1) {
      push(a);
    } else {
      range.push(pad(format(a, index), maxLen, toNumber));
    }
    a = descending ? a - step : a + step;
    index++;
  }

  if (options.toRegex === true) {
    return step > 1
      ? toSequence(parts, options, maxLen)
      : toRegex(range, null, { wrap: false, ...options });
  }

  return range;
};

const fillLetters = (start, end, step = 1, options = {}) => {
  if ((!isNumber(start) && start.length > 1) || (!isNumber(end) && end.length > 1)) {
    return invalidRange(start, end, options);
  }

  let format = options.transform || (val => String.fromCharCode(val));
  let a = `${start}`.charCodeAt(0);
  let b = `${end}`.charCodeAt(0);

  let descending = a > b;
  let min = Math.min(a, b);
  let max = Math.max(a, b);

  if (options.toRegex && step === 1) {
    return toRange(min, max, false, options);
  }

  let range = [];
  let index = 0;

  while (descending ? a >= b : a <= b) {
    range.push(format(a, index));
    a = descending ? a - step : a + step;
    index++;
  }

  if (options.toRegex === true) {
    return toRegex(range, null, { wrap: false, options });
  }

  return range;
};

const fill = (start, end, step, options = {}) => {
  if (end == null && isValidValue(start)) {
    return [start];
  }

  if (!isValidValue(start) || !isValidValue(end)) {
    return invalidRange(start, end, options);
  }

  if (typeof step === 'function') {
    return fill(start, end, 1, { transform: step });
  }

  if (isObject(step)) {
    return fill(start, end, 0, step);
  }

  let opts = { ...options };
  if (opts.capture === true) opts.wrap = true;
  step = step || opts.step || 1;

  if (!isNumber(step)) {
    if (step != null && !isObject(step)) return invalidStep(step, opts);
    return fill(start, end, 1, step);
  }

  if (isNumber(start) && isNumber(end)) {
    return fillNumbers(start, end, step, opts);
  }

  return fillLetters(start, end, Math.max(Math.abs(step), 1), opts);
};

module.exports = fill;
{
  "name": "fill-range",
  "description": "Fill in a range of numbers or letters, optionally passing an increment or `step` to use, or create a regex-compatible range with `options.toRegex`",
  "version": "7.1.1",
  "homepage": "https://github.com/jonschlinkert/fill-range",
  "author": "Jon Schlinkert (https://github.com/jonschlinkert)",
  "repository": "jonschlinkert/fill-range",
  "license": "MIT",
  "files": [
    "index.js"
  ],
  "main": "index.js",
  "engines": {
    "node": ">=8"
  },
  "dependencies": {
    "to-regex-range": "^5.0.1"
  },
  "devDependencies": {
    "gulp-format-md": "^2.0.0",
    "mocha": "^6.1.1",
    "nyc": "^15.1.0"
  },
  "verb": {
    "toc": false,
    "layout": "default",
    "tasks": [
      "readme"
    ],
    "plugins": [
      "gulp-format-md"
    ],
    "lint": {
      "reflinks": true
    }
  }
}The ISC License

Copyright (c) 2015, 2019 Elan Shanker

Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
'use strict';

var isGlob = require('is-glob');
var pathPosixDirname = require('path').posix.dirname;
var isWin32 = require('os').platform() === 'win32';

var slash = '/';
var backslash = /\\/g;
var enclosure = /[\{\[].*[\}\]]$/;
var globby = /(^|[^\\])([\{\[]|\([^\)]+$)/;
var escaped = /\\([\!\*\?\|\[\]\(\)\{\}])/g;

/**
 * @param {string} str
 * @param {Object} opts
 * @param {boolean} [opts.flipBackslashes=true]
 * @returns {string}
 */
module.exports = function globParent(str, opts) {
  var options = Object.assign({ flipBackslashes: true }, opts);

  // flip windows path separators
  if (options.flipBackslashes && isWin32 && str.indexOf(slash) < 0) {
    str = str.replace(backslash, slash);
  }

  // special case for strings ending in enclosure containing path separator
  if (enclosure.test(str)) {
    str += slash;
  }

  // preserves full path in case of trailing path separator
  str += 'a';

  // remove path parts that are globby
  do {
    str = pathPosixDirname(str);
  } while (isGlob(str) || globby.test(str));

  // remove escape chars and return result
  return str.replace(escaped, '$1');
};
{
  "name": "glob-parent",
  "version": "5.1.2",
  "description": "Extract the non-magic parent path from a glob string.",
  "author": "Gulp Team <team@gulpjs.com> (https://gulpjs.com/)",
  "repository": "gulpjs/glob-parent",
  "license": "ISC",
  "engines": {
    "node": ">= 6"
  },
  "main": "index.js",
  "files": [
    "LICENSE",
    "index.js"
  ],
  "dependencies": {
    "is-glob": "^4.0.1"
  },
  "devDependencies": {
    "coveralls": "^3.0.11",
    "eslint": "^2.13.1",
    "eslint-config-gulp": "^3.0.1",
    "expect": "^1.20.2",
    "mocha": "^6.0.2",
    "nyc": "^13.3.0"
  }
}'use strict';
const path = require('path');
const binaryExtensions = require('binary-extensions');

const extensions = new Set(binaryExtensions);

module.exports = filePath => extensions.has(path.extname(filePath).slice(1).toLowerCase());
MIT License

Copyright (c) 2019 Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com), Paul Miller (https://paulmillr.com)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
{
  "name": "is-binary-path",
  "version": "2.1.0",
  "description": "Check if a file path is a binary file",
  "license": "MIT",
  "repository": "sindresorhus/is-binary-path",
  "author": {
    "name": "Sindre Sorhus",
    "email": "sindresorhus@gmail.com",
    "url": "sindresorhus.com"
  },
  "engines": {
    "node": ">=8"
  },
  "files": [
    "index.js",
    "index.d.ts"
  ],
  "dependencies": {
    "binary-extensions": "^2.0.0"
  },
  "devDependencies": {
    "ava": "^1.4.1",
    "tsd": "^0.7.2",
    "xo": "^0.24.0"
  }
}The MIT License (MIT)

Copyright (c) 2014-2016, Jon Schlinkert

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
/*!
 * is-extglob <https://github.com/jonschlinkert/is-extglob>
 *
 * Copyright (c) 2014-2016, Jon Schlinkert.
 * Licensed under the MIT License.
 */

module.exports = function isExtglob(str) {
  if (typeof str !== 'string' || str === '') {
    return false;
  }

  var match;
  while ((match = /(\\).|([@?!+*]\(.*\))/g.exec(str))) {
    if (match[2]) return true;
    str = str.slice(match.index + match[0].length);
  }

  return false;
};
{
  "name": "is-extglob",
  "description": "Returns true if a string has an extglob.",
  "version": "2.1.1",
  "homepage": "https://github.com/jonschlinkert/is-extglob",
  "author": "Jon Schlinkert (https://github.com/jonschlinkert)",
  "repository": "jonschlinkert/is-extglob",
  "license": "MIT",
  "files": [
    "index.js"
  ],
  "main": "index.js",
  "engines": {
    "node": ">=0.10.0"
  },
  "devDependencies": {
    "gulp-format-md": "^0.1.10",
    "mocha": "^3.0.2"
  },
  "verb": {
    "toc": false,
    "layout": "default",
    "tasks": [
      "readme"
    ],
    "plugins": [
      "gulp-format-md"
    ],
    "related": {
      "list": [
        "has-glob",
        "is-glob",
        "micromatch"
      ]
    },
    "reflinks": [
      "verb",
      "verb-generate-readme"
    ],
    "lint": {
      "reflinks": true
    }
  }
}The MIT License (MIT)

Copyright (c) 2014-2017, Jon Schlinkert.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
/*!
 * is-glob <https://github.com/jonschlinkert/is-glob>
 *
 * Copyright (c) 2014-2017, Jon Schlinkert.
 * Released under the MIT License.
 */

var isExtglob = require('is-extglob');
var chars = { '{': '}', '(': ')', '[': ']'};
var strictCheck = function(str) {
  if (str[0] === '!') {
    return true;
  }
  var index = 0;
  var pipeIndex = -2;
  var closeSquareIndex = -2;
  var closeCurlyIndex = -2;
  var closeParenIndex = -2;
  var backSlashIndex = -2;
  while (index < str.length) {
    if (str[index] === '*') {
      return true;
    }

    if (str[index + 1] === '?' && /[\].+)]/.test(str[index])) {
      return true;
    }

    if (closeSquareIndex !== -1 && str[index] === '[' && str[index + 1] !== ']') {
      if (closeSquareIndex < index) {
        closeSquareIndex = str.indexOf(']', index);
      }
      if (closeSquareIndex > index) {
        if (backSlashIndex === -1 || backSlashIndex > closeSquareIndex) {
          return true;
        }
        backSlashIndex = str.indexOf('\\', index);
        if (backSlashIndex === -1 || backSlashIndex > closeSquareIndex) {
          return true;
        }
      }
    }

    if (closeCurlyIndex !== -1 && str[index] === '{' && str[index + 1] !== '}') {
      closeCurlyIndex = str.indexOf('}', index);
      if (closeCurlyIndex > index) {
        backSlashIndex = str.indexOf('\\', index);
        if (backSlashIndex === -1 || backSlashIndex > closeCurlyIndex) {
          return true;
        }
      }
    }

    if (closeParenIndex !== -1 && str[index] === '(' && str[index + 1] === '?' && /[:!=]/.test(str[index + 2]) && str[index + 3] !== ')') {
      closeParenIndex = str.indexOf(')', index);
      if (closeParenIndex > index) {
        backSlashIndex = str.indexOf('\\', index);
        if (backSlashIndex === -1 || backSlashIndex > closeParenIndex) {
          return true;
        }
      }
    }

    if (pipeIndex !== -1 && str[index] === '(' && str[index + 1] !== '|') {
      if (pipeIndex < index) {
        pipeIndex = str.indexOf('|', index);
      }
      if (pipeIndex !== -1 && str[pipeIndex + 1] !== ')') {
        closeParenIndex = str.indexOf(')', pipeIndex);
        if (closeParenIndex > pipeIndex) {
          backSlashIndex = str.indexOf('\\', pipeIndex);
          if (backSlashIndex === -1 || backSlashIndex > closeParenIndex) {
            return true;
          }
        }
      }
    }

    if (str[index] === '\\') {
      var open = str[index + 1];
      index += 2;
      var close = chars[open];

      if (close) {
        var n = str.indexOf(close, index);
        if (n !== -1) {
          index = n + 1;
        }
      }

      if (str[index] === '!') {
        return true;
      }
    } else {
      index++;
    }
  }
  return false;
};

var relaxedCheck = function(str) {
  if (str[0] === '!') {
    return true;
  }
  var index = 0;
  while (index < str.length) {
    if (/[*?{}()[\]]/.test(str[index])) {
      return true;
    }

    if (str[index] === '\\') {
      var open = str[index + 1];
      index += 2;
      var close = chars[open];

      if (close) {
        var n = str.indexOf(close, index);
        if (n !== -1) {
          index = n + 1;
        }
      }

      if (str[index] === '!') {
        return true;
      }
    } else {
      index++;
    }
  }
  return false;
};

module.exports = function isGlob(str, options) {
  if (typeof str !== 'string' || str === '') {
    return false;
  }

  if (isExtglob(str)) {
    return true;
  }

  var check = strictCheck;

  // optionally relax check
  if (options && options.strict === false) {
    check = relaxedCheck;
  }

  return check(str);
};
{
  "name": "is-glob",
  "description": "Returns `true` if the given string looks like a glob pattern or an extglob pattern. This makes it easy to create code that only uses external modules like node-glob when necessary, resulting in much faster code execution and initialization time, and a better user experience.",
  "version": "4.0.3",
  "homepage": "https://github.com/micromatch/is-glob",
  "author": "Jon Schlinkert (https://github.com/jonschlinkert)",
  "repository": "micromatch/is-glob",
  "license": "MIT",
  "files": [
    "index.js"
  ],
  "main": "index.js",
  "engines": {
    "node": ">=0.10.0"
  },
  "dependencies": {
    "is-extglob": "^2.1.1"
  },
  "devDependencies": {
    "gulp-format-md": "^0.1.10",
    "mocha": "^3.0.2"
  },
  "verb": {
    "layout": "default",
    "plugins": [
      "gulp-format-md"
    ],
    "related": {
      "list": [
        "assemble",
        "base",
        "update",
        "verb"
      ]
    },
    "reflinks": [
      "assemble",
      "bach",
      "base",
      "composer",
      "gulp",
      "has-glob",
      "is-valid-glob",
      "micromatch",
      "npm",
      "scaffold",
      "verb",
      "vinyl"
    ]
  }
}The MIT License (MIT)

Copyright (c) 2014-present, Jon Schlinkert.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
/*!
 * is-number <https://github.com/jonschlinkert/is-number>
 *
 * Copyright (c) 2014-present, Jon Schlinkert.
 * Released under the MIT License.
 */

'use strict';

module.exports = function(num) {
  if (typeof num === 'number') {
    return num - num === 0;
  }
  if (typeof num === 'string' && num.trim() !== '') {
    return Number.isFinite ? Number.isFinite(+num) : isFinite(+num);
  }
  return false;
};
{
  "name": "is-number",
  "description": "Returns true if a number or string value is a finite number. Useful for regex matches, parsing, user input, etc.",
  "version": "7.0.0",
  "homepage": "https://github.com/jonschlinkert/is-number",
  "author": "Jon Schlinkert (https://github.com/jonschlinkert)",
  "repository": "jonschlinkert/is-number",
  "license": "MIT",
  "files": [
    "index.js"
  ],
  "main": "index.js",
  "engines": {
    "node": ">=0.12.0"
  },
  "devDependencies": {
    "ansi": "^0.3.1",
    "benchmark": "^2.1.4",
    "gulp-format-md": "^1.0.0",
    "mocha": "^3.5.3"
  },
  "verb": {
    "toc": false,
    "layout": "default",
    "tasks": [
      "readme"
    ],
    "related": {
      "list": [
        "is-plain-object",
        "is-primitive",
        "isobject",
        "kind-of"
      ]
    },
    "plugins": [
      "gulp-format-md"
    ],
    "lint": {
      "reflinks": true
    }
  }
}{
	"all": true,
	"check-coverage": false,
	"reporter": ["text-summary", "text", "html", "json"],
	"lines": 86,
	"statements": 85.93,
	"functions": 82.43,
	"branches": 76.06,
	"exclude": [
		"coverage",
		"example",
		"test"
	]
}
This software is released under the MIT license:

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
'use strict';

function hasKey(obj, keys) {
	var o = obj;
	keys.slice(0, -1).forEach(function (key) {
		o = o[key] || {};
	});

	var key = keys[keys.length - 1];
	return key in o;
}

function isNumber(x) {
	if (typeof x === 'number') { return true; }
	if ((/^0x[0-9a-f]+$/i).test(x)) { return true; }
	return (/^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/).test(x);
}

function isConstructorOrProto(obj, key) {
	return (key === 'constructor' && typeof obj[key] === 'function') || key === '__proto__';
}

module.exports = function (args, opts) {
	if (!opts) { opts = {}; }

	var flags = {
		bools: {},
		strings: {},
		unknownFn: null,
	};

	if (typeof opts.unknown === 'function') {
		flags.unknownFn = opts.unknown;
	}

	if (typeof opts.boolean === 'boolean' && opts.boolean) {
		flags.allBools = true;
	} else {
		[].concat(opts.boolean).filter(Boolean).forEach(function (key) {
			flags.bools[key] = true;
		});
	}

	var aliases = {};

	function aliasIsBoolean(key) {
		return aliases[key].some(function (x) {
			return flags.bools[x];
		});
	}

	Object.keys(opts.alias || {}).forEach(function (key) {
		aliases[key] = [].concat(opts.alias[key]);
		aliases[key].forEach(function (x) {
			aliases[x] = [key].concat(aliases[key].filter(function (y) {
				return x !== y;
			}));
		});
	});

	[].concat(opts.string).filter(Boolean).forEach(function (key) {
		flags.strings[key] = true;
		if (aliases[key]) {
			[].concat(aliases[key]).forEach(function (k) {
				flags.strings[k] = true;
			});
		}
	});

	var defaults = opts.default || {};

	var argv = { _: [] };

	function argDefined(key, arg) {
		return (flags.allBools && (/^--[^=]+$/).test(arg))
			|| flags.strings[key]
			|| flags.bools[key]
			|| aliases[key];
	}

	function setKey(obj, keys, value) {
		var o = obj;
		for (var i = 0; i < keys.length - 1; i++) {
			var key = keys[i];
			if (isConstructorOrProto(o, key)) { return; }
			if (o[key] === undefined) { o[key] = {}; }
			if (
				o[key] === Object.prototype
				|| o[key] === Number.prototype
				|| o[key] === String.prototype
			) {
				o[key] = {};
			}
			if (o[key] === Array.prototype) { o[key] = []; }
			o = o[key];
		}

		var lastKey = keys[keys.length - 1];
		if (isConstructorOrProto(o, lastKey)) { return; }
		if (
			o === Object.prototype
			|| o === Number.prototype
			|| o === String.prototype
		) {
			o = {};
		}
		if (o === Array.prototype) { o = []; }
		if (o[lastKey] === undefined || flags.bools[lastKey] || typeof o[lastKey] === 'boolean') {
			o[lastKey] = value;
		} else if (Array.isArray(o[lastKey])) {
			o[lastKey].push(value);
		} else {
			o[lastKey] = [o[lastKey], value];
		}
	}

	function setArg(key, val, arg) {
		if (arg && flags.unknownFn && !argDefined(key, arg)) {
			if (flags.unknownFn(arg) === false) { return; }
		}

		var value = !flags.strings[key] && isNumber(val)
			? Number(val)
			: val;
		setKey(argv, key.split('.'), value);

		(aliases[key] || []).forEach(function (x) {
			setKey(argv, x.split('.'), value);
		});
	}

	Object.keys(flags.bools).forEach(function (key) {
		setArg(key, defaults[key] === undefined ? false : defaults[key]);
	});

	var notFlags = [];

	if (args.indexOf('--') !== -1) {
		notFlags = args.slice(args.indexOf('--') + 1);
		args = args.slice(0, args.indexOf('--'));
	}

	for (var i = 0; i < args.length; i++) {
		var arg = args[i];
		var key;
		var next;

		if ((/^--.+=/).test(arg)) {
			// Using [\s\S] instead of . because js doesn't support the
			// 'dotall' regex modifier. See:
			// http://stackoverflow.com/a/1068308/13216
			var m = arg.match(/^--([^=]+)=([\s\S]*)$/);
			key = m[1];
			var value = m[2];
			if (flags.bools[key]) {
				value = value !== 'false';
			}
			setArg(key, value, arg);
		} else if ((/^--no-.+/).test(arg)) {
			key = arg.match(/^--no-(.+)/)[1];
			setArg(key, false, arg);
		} else if ((/^--.+/).test(arg)) {
			key = arg.match(/^--(.+)/)[1];
			next = args[i + 1];
			if (
				next !== undefined
				&& !(/^(-|--)[^-]/).test(next)
				&& !flags.bools[key]
				&& !flags.allBools
				&& (aliases[key] ? !aliasIsBoolean(key) : true)
			) {
				setArg(key, next, arg);
				i += 1;
			} else if ((/^(true|false)$/).test(next)) {
				setArg(key, next === 'true', arg);
				i += 1;
			} else {
				setArg(key, flags.strings[key] ? '' : true, arg);
			}
		} else if ((/^-[^-]+/).test(arg)) {
			var letters = arg.slice(1, -1).split('');

			var broken = false;
			for (var j = 0; j < letters.length; j++) {
				next = arg.slice(j + 2);

				if (next === '-') {
					setArg(letters[j], next, arg);
					continue;
				}

				if ((/[A-Za-z]/).test(letters[j]) && next[0] === '=') {
					setArg(letters[j], next.slice(1), arg);
					broken = true;
					break;
				}

				if (
					(/[A-Za-z]/).test(letters[j])
					&& (/-?\d+(\.\d*)?(e-?\d+)?$/).test(next)
				) {
					setArg(letters[j], next, arg);
					broken = true;
					break;
				}

				if (letters[j + 1] && letters[j + 1].match(/\W/)) {
					setArg(letters[j], arg.slice(j + 2), arg);
					broken = true;
					break;
				} else {
					setArg(letters[j], flags.strings[letters[j]] ? '' : true, arg);
				}
			}

			key = arg.slice(-1)[0];
			if (!broken && key !== '-') {
				if (
					args[i + 1]
					&& !(/^(-|--)[^-]/).test(args[i + 1])
					&& !flags.bools[key]
					&& (aliases[key] ? !aliasIsBoolean(key) : true)
				) {
					setArg(key, args[i + 1], arg);
					i += 1;
				} else if (args[i + 1] && (/^(true|false)$/).test(args[i + 1])) {
					setArg(key, args[i + 1] === 'true', arg);
					i += 1;
				} else {
					setArg(key, flags.strings[key] ? '' : true, arg);
				}
			}
		} else {
			if (!flags.unknownFn || flags.unknownFn(arg) !== false) {
				argv._.push(flags.strings._ || !isNumber(arg) ? arg : Number(arg));
			}
			if (opts.stopEarly) {
				argv._.push.apply(argv._, args.slice(i + 1));
				break;
			}
		}
	}

	Object.keys(defaults).forEach(function (k) {
		if (!hasKey(argv, k.split('.'))) {
			setKey(argv, k.split('.'), defaults[k]);

			(aliases[k] || []).forEach(function (x) {
				setKey(argv, x.split('.'), defaults[k]);
			});
		}
	});

	if (opts['--']) {
		argv['--'] = notFlags.slice();
	} else {
		notFlags.forEach(function (k) {
			argv._.push(k);
		});
	}

	return argv;
};
{
  "name": "minimist",
  "version": "1.2.8",
  "description": "parse argument options",
  "main": "index.js",
  "devDependencies": {
    "@ljharb/eslint-config": "^21.0.1",
    "aud": "^2.0.2",
    "auto-changelog": "^2.4.0",
    "eslint": "=8.8.0",
    "in-publish": "^2.0.1",
    "npmignore": "^0.3.0",
    "nyc": "^10.3.2",
    "safe-publish-latest": "^2.0.0",
    "tape": "^5.6.3"
  },
  "testling": {
    "files": "test/*.js",
    "browsers": [
      "ie/6..latest",
      "ff/5",
      "firefox/latest",
      "chrome/10",
      "chrome/latest",
      "safari/5.1",
      "safari/latest",
      "opera/12"
    ]
  },
  "repository": {
    "type": "git",
    "url": "git://github.com/minimistjs/minimist.git"
  },
  "homepage": "https://github.com/minimistjs/minimist",
  "author": {
    "name": "James Halliday",
    "email": "mail@substack.net",
    "url": "http://substack.net"
  },
  "funding": {
    "url": "https://github.com/sponsors/ljharb"
  },
  "license": "MIT",
  "auto-changelog": {
    "output": "CHANGELOG.md",
    "template": "keepachangelog",
    "unreleased": false,
    "commitLimit": false,
    "backfillLimit": false,
    "hideCredit": true
  },
  "publishConfig": {
    "ignore": [
      ".github/workflows"
    ]
  }
}Copyright 2010 James Halliday (mail@substack.net)

This project is free software released under the MIT/X11 license:

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
var path = require('path');
var fs = require('fs');
var _0777 = parseInt('0777', 8);

module.exports = mkdirP.mkdirp = mkdirP.mkdirP = mkdirP;

function mkdirP (p, opts, f, made) {
    if (typeof opts === 'function') {
        f = opts;
        opts = {};
    }
    else if (!opts || typeof opts !== 'object') {
        opts = { mode: opts };
    }
    
    var mode = opts.mode;
    var xfs = opts.fs || fs;
    
    if (mode === undefined) {
        mode = _0777
    }
    if (!made) made = null;
    
    var cb = f || /* istanbul ignore next */ function () {};
    p = path.resolve(p);
    
    xfs.mkdir(p, mode, function (er) {
        if (!er) {
            made = made || p;
            return cb(null, made);
        }
        switch (er.code) {
            case 'ENOENT':
                /* istanbul ignore if */
                if (path.dirname(p) === p) return cb(er);
                mkdirP(path.dirname(p), opts, function (er, made) {
                    /* istanbul ignore if */
                    if (er) cb(er, made);
                    else mkdirP(p, opts, cb, made);
                });
                break;

            // In the case of any other error, just see if there's a dir
            // there already.  If so, then hooray!  If not, then something
            // is borked.
            default:
                xfs.stat(p, function (er2, stat) {
                    // if the stat fails, then that's super weird.
                    // let the original error be the failure reason.
                    if (er2 || !stat.isDirectory()) cb(er, made)
                    else cb(null, made);
                });
                break;
        }
    });
}

mkdirP.sync = function sync (p, opts, made) {
    if (!opts || typeof opts !== 'object') {
        opts = { mode: opts };
    }
    
    var mode = opts.mode;
    var xfs = opts.fs || fs;
    
    if (mode === undefined) {
        mode = _0777
    }
    if (!made) made = null;

    p = path.resolve(p);

    try {
        xfs.mkdirSync(p, mode);
        made = made || p;
    }
    catch (err0) {
        switch (err0.code) {
            case 'ENOENT' :
                made = sync(path.dirname(p), opts, made);
                sync(p, opts, made);
                break;

            // In the case of any other error, just see if there's a dir
            // there already.  If so, then hooray!  If not, then something
            // is borked.
            default:
                var stat;
                try {
                    stat = xfs.statSync(p);
                }
                catch (err1) /* istanbul ignore next */ {
                    throw err0;
                }
                /* istanbul ignore if */
                if (!stat.isDirectory()) throw err0;
                break;
        }
    }

    return made;
};
{
  "name": "mkdirp",
  "description": "Recursively mkdir, like `mkdir -p`",
  "version": "0.5.6",
  "publishConfig": {
    "tag": "legacy"
  },
  "author": "James Halliday <mail@substack.net> (http://substack.net)",
  "main": "index.js",
  "repository": {
    "type": "git",
    "url": "https://github.com/substack/node-mkdirp.git"
  },
  "dependencies": {
    "minimist": "^1.2.6"
  },
  "devDependencies": {
    "tap": "^16.0.1"
  },
  "bin": "bin/cmd.js",
  "license": "MIT",
  "files": [
    "bin",
    "index.js"
  ]
}#!/usr/bin/env node

var mkdirp = require('../');
var minimist = require('minimist');
var fs = require('fs');

var argv = minimist(process.argv.slice(2), {
    alias: { m: 'mode', h: 'help' },
    string: [ 'mode' ]
});
if (argv.help) {
    fs.createReadStream(__dirname + '/usage.txt').pipe(process.stdout);
    return;
}

var paths = argv._.slice();
var mode = argv.mode ? parseInt(argv.mode, 8) : undefined;

(function next () {
    if (paths.length === 0) return;
    var p = paths.shift();
    
    if (mode === undefined) mkdirp(p, cb)
    else mkdirp(p, mode, cb)
    
    function cb (err) {
        if (err) {
            console.error(err.message);
            process.exit(1);
        }
        else next();
    }
})();
usage: mkdirp [DIR1,DIR2..] {OPTIONS}

  Create each supplied directory including any necessary parent directories that
  don't yet exist.
  
  If the directory already exists, do nothing.

OPTIONS are:

  -m, --mode   If a directory needs to be created, set the mode as an octal
               permission string.

The MIT License (MIT)

Copyright (c) 2014-2018, Jon Schlinkert.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
/*!
 * normalize-path <https://github.com/jonschlinkert/normalize-path>
 *
 * Copyright (c) 2014-2018, Jon Schlinkert.
 * Released under the MIT License.
 */

module.exports = function(path, stripTrailing) {
  if (typeof path !== 'string') {
    throw new TypeError('expected path to be a string');
  }

  if (path === '\\' || path === '/') return '/';

  var len = path.length;
  if (len <= 1) return path;

  // ensure that win32 namespaces has two leading slashes, so that the path is
  // handled properly by the win32 version of path.parse() after being normalized
  // https://msdn.microsoft.com/library/windows/desktop/aa365247(v=vs.85).aspx#namespaces
  var prefix = '';
  if (len > 4 && path[3] === '\\') {
    var ch = path[2];
    if ((ch === '?' || ch === '.') && path.slice(0, 2) === '\\\\') {
      path = path.slice(2);
      prefix = '//';
    }
  }

  var segs = path.split(/[/\\]+/);
  if (stripTrailing !== false && segs[segs.length - 1] === '') {
    segs.pop();
  }
  return prefix + segs.join('/');
};
{
  "name": "normalize-path",
  "description": "Normalize slashes in a file path to be posix/unix-like forward slashes. Also condenses repeat slashes to a single slash and removes and trailing slashes, unless disabled.",
  "version": "3.0.0",
  "homepage": "https://github.com/jonschlinkert/normalize-path",
  "author": "Jon Schlinkert (https://github.com/jonschlinkert)",
  "repository": "jonschlinkert/normalize-path",
  "license": "MIT",
  "files": [
    "index.js"
  ],
  "main": "index.js",
  "engines": {
    "node": ">=0.10.0"
  },
  "devDependencies": {
    "gulp-format-md": "^1.0.0",
    "minimist": "^1.2.0",
    "mocha": "^3.5.3"
  },
  "verb": {
    "toc": false,
    "layout": "default",
    "tasks": [
      "readme"
    ],
    "plugins": [
      "gulp-format-md"
    ],
    "related": {
      "description": "Other useful path-related libraries:",
      "list": [
        "contains-path",
        "is-absolute",
        "is-relative",
        "parse-filepath",
        "path-ends-with",
        "path-ends-with",
        "unixify"
      ]
    },
    "lint": {
      "reflinks": true
    }
  }
}The MIT License (MIT)

Copyright (c) 2017-present, Jon Schlinkert.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
'use strict';

module.exports = require('./lib/picomatch');
{
  "name": "picomatch",
  "description": "Blazing fast and accurate glob matcher written in JavaScript, with no dependencies and full support for standard and extended Bash glob features, including braces, extglobs, POSIX brackets, and regular expressions.",
  "version": "2.3.1",
  "homepage": "https://github.com/micromatch/picomatch",
  "author": "Jon Schlinkert (https://github.com/jonschlinkert)",
  "funding": "https://github.com/sponsors/jonschlinkert",
  "repository": "micromatch/picomatch",
  "license": "MIT",
  "files": [
    "index.js",
    "lib"
  ],
  "main": "index.js",
  "engines": {
    "node": ">=8.6"
  },
  "devDependencies": {
    "eslint": "^6.8.0",
    "fill-range": "^7.0.1",
    "gulp-format-md": "^2.0.0",
    "mocha": "^6.2.2",
    "nyc": "^15.0.0",
    "time-require": "github:jonschlinkert/time-require"
  },
  "verb": {
    "toc": {
      "render": true,
      "method": "preWrite",
      "maxdepth": 3
    },
    "layout": "empty",
    "tasks": [
      "readme"
    ],
    "plugins": [
      "gulp-format-md"
    ],
    "lint": {
      "reflinks": true
    },
    "related": {
      "list": [
        "braces",
        "micromatch"
      ]
    },
    "reflinks": [
      "braces",
      "expand-brackets",
      "extglob",
      "fill-range",
      "micromatch",
      "minimatch",
      "nanomatch",
      "picomatch"
    ]
  }
}'use strict';

const path = require('path');
const WIN_SLASH = '\\\\/';
const WIN_NO_SLASH = `[^${WIN_SLASH}]`;

/**
 * Posix glob regex
 */

const DOT_LITERAL = '\\.';
const PLUS_LITERAL = '\\+';
const QMARK_LITERAL = '\\?';
const SLASH_LITERAL = '\\/';
const ONE_CHAR = '(?=.)';
const QMARK = '[^/]';
const END_ANCHOR = `(?:${SLASH_LITERAL}|$)`;
const START_ANCHOR = `(?:^|${SLASH_LITERAL})`;
const DOTS_SLASH = `${DOT_LITERAL}{1,2}${END_ANCHOR}`;
const NO_DOT = `(?!${DOT_LITERAL})`;
const NO_DOTS = `(?!${START_ANCHOR}${DOTS_SLASH})`;
const NO_DOT_SLASH = `(?!${DOT_LITERAL}{0,1}${END_ANCHOR})`;
const NO_DOTS_SLASH = `(?!${DOTS_SLASH})`;
const QMARK_NO_DOT = `[^.${SLASH_LITERAL}]`;
const STAR = `${QMARK}*?`;

const POSIX_CHARS = {
  DOT_LITERAL,
  PLUS_LITERAL,
  QMARK_LITERAL,
  SLASH_LITERAL,
  ONE_CHAR,
  QMARK,
  END_ANCHOR,
  DOTS_SLASH,
  NO_DOT,
  NO_DOTS,
  NO_DOT_SLASH,
  NO_DOTS_SLASH,
  QMARK_NO_DOT,
  STAR,
  START_ANCHOR
};

/**
 * Windows glob regex
 */

const WINDOWS_CHARS = {
  ...POSIX_CHARS,

  SLASH_LITERAL: `[${WIN_SLASH}]`,
  QMARK: WIN_NO_SLASH,
  STAR: `${WIN_NO_SLASH}*?`,
  DOTS_SLASH: `${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$)`,
  NO_DOT: `(?!${DOT_LITERAL})`,
  NO_DOTS: `(?!(?:^|[${WIN_SLASH}])${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
  NO_DOT_SLASH: `(?!${DOT_LITERAL}{0,1}(?:[${WIN_SLASH}]|$))`,
  NO_DOTS_SLASH: `(?!${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
  QMARK_NO_DOT: `[^.${WIN_SLASH}]`,
  START_ANCHOR: `(?:^|[${WIN_SLASH}])`,
  END_ANCHOR: `(?:[${WIN_SLASH}]|$)`
};

/**
 * POSIX Bracket Regex
 */

const POSIX_REGEX_SOURCE = {
  alnum: 'a-zA-Z0-9',
  alpha: 'a-zA-Z',
  ascii: '\\x00-\\x7F',
  blank: ' \\t',
  cntrl: '\\x00-\\x1F\\x7F',
  digit: '0-9',
  graph: '\\x21-\\x7E',
  lower: 'a-z',
  print: '\\x20-\\x7E ',
  punct: '\\-!"#$%&\'()\\*+,./:;<=>?@[\\]^_`{|}~',
  space: ' \\t\\r\\n\\v\\f',
  upper: 'A-Z',
  word: 'A-Za-z0-9_',
  xdigit: 'A-Fa-f0-9'
};

module.exports = {
  MAX_LENGTH: 1024 * 64,
  POSIX_REGEX_SOURCE,

  // regular expressions
  REGEX_BACKSLASH: /\\(?![*+?^${}(|)[\]])/g,
  REGEX_NON_SPECIAL_CHARS: /^[^@![\].,$*+?^{}()|\\/]+/,
  REGEX_SPECIAL_CHARS: /[-*+?.^${}(|)[\]]/,
  REGEX_SPECIAL_CHARS_BACKREF: /(\\?)((\W)(\3*))/g,
  REGEX_SPECIAL_CHARS_GLOBAL: /([-*+?.^${}(|)[\]])/g,
  REGEX_REMOVE_BACKSLASH: /(?:\[.*?[^\\]\]|\\(?=.))/g,

  // Replace globs with equivalent patterns to reduce parsing time.
  REPLACEMENTS: {
    '***': '*',
    '**/**': '**',
    '**/**/**': '**'
  },

  // Digits
  CHAR_0: 48, /* 0 */
  CHAR_9: 57, /* 9 */

  // Alphabet chars.
  CHAR_UPPERCASE_A: 65, /* A */
  CHAR_LOWERCASE_A: 97, /* a */
  CHAR_UPPERCASE_Z: 90, /* Z */
  CHAR_LOWERCASE_Z: 122, /* z */

  CHAR_LEFT_PARENTHESES: 40, /* ( */
  CHAR_RIGHT_PARENTHESES: 41, /* ) */

  CHAR_ASTERISK: 42, /* * */

  // Non-alphabetic chars.
  CHAR_AMPERSAND: 38, /* & */
  CHAR_AT: 64, /* @ */
  CHAR_BACKWARD_SLASH: 92, /* \ */
  CHAR_CARRIAGE_RETURN: 13, /* \r */
  CHAR_CIRCUMFLEX_ACCENT: 94, /* ^ */
  CHAR_COLON: 58, /* : */
  CHAR_COMMA: 44, /* , */
  CHAR_DOT: 46, /* . */
  CHAR_DOUBLE_QUOTE: 34, /* " */
  CHAR_EQUAL: 61, /* = */
  CHAR_EXCLAMATION_MARK: 33, /* ! */
  CHAR_FORM_FEED: 12, /* \f */
  CHAR_FORWARD_SLASH: 47, /* / */
  CHAR_GRAVE_ACCENT: 96, /* ` */
  CHAR_HASH: 35, /* # */
  CHAR_HYPHEN_MINUS: 45, /* - */
  CHAR_LEFT_ANGLE_BRACKET: 60, /* < */
  CHAR_LEFT_CURLY_BRACE: 123, /* { */
  CHAR_LEFT_SQUARE_BRACKET: 91, /* [ */
  CHAR_LINE_FEED: 10, /* \n */
  CHAR_NO_BREAK_SPACE: 160, /* \u00A0 */
  CHAR_PERCENT: 37, /* % */
  CHAR_PLUS: 43, /* + */
  CHAR_QUESTION_MARK: 63, /* ? */
  CHAR_RIGHT_ANGLE_BRACKET: 62, /* > */
  CHAR_RIGHT_CURLY_BRACE: 125, /* } */
  CHAR_RIGHT_SQUARE_BRACKET: 93, /* ] */
  CHAR_SEMICOLON: 59, /* ; */
  CHAR_SINGLE_QUOTE: 39, /* ' */
  CHAR_SPACE: 32, /*   */
  CHAR_TAB: 9, /* \t */
  CHAR_UNDERSCORE: 95, /* _ */
  CHAR_VERTICAL_LINE: 124, /* | */
  CHAR_ZERO_WIDTH_NOBREAK_SPACE: 65279, /* \uFEFF */

  SEP: path.sep,

  /**
   * Create EXTGLOB_CHARS
   */

  extglobChars(chars) {
    return {
      '!': { type: 'negate', open: '(?:(?!(?:', close: `))${chars.STAR})` },
      '?': { type: 'qmark', open: '(?:', close: ')?' },
      '+': { type: 'plus', open: '(?:', close: ')+' },
      '*': { type: 'star', open: '(?:', close: ')*' },
      '@': { type: 'at', open: '(?:', close: ')' }
    };
  },

  /**
   * Create GLOB_CHARS
   */

  globChars(win32) {
    return win32 === true ? WINDOWS_CHARS : POSIX_CHARS;
  }
};
'use strict';

const constants = require('./constants');
const utils = require('./utils');

/**
 * Constants
 */

const {
  MAX_LENGTH,
  POSIX_REGEX_SOURCE,
  REGEX_NON_SPECIAL_CHARS,
  REGEX_SPECIAL_CHARS_BACKREF,
  REPLACEMENTS
} = constants;

/**
 * Helpers
 */

const expandRange = (args, options) => {
  if (typeof options.expandRange === 'function') {
    return options.expandRange(...args, options);
  }

  args.sort();
  const value = `[${args.join('-')}]`;

  try {
    /* eslint-disable-next-line no-new */
    new RegExp(value);
  } catch (ex) {
    return args.map(v => utils.escapeRegex(v)).join('..');
  }

  return value;
};

/**
 * Create the message for a syntax error
 */

const syntaxError = (type, char) => {
  return `Missing ${type}: "${char}" - use "\\\\${char}" to match literal characters`;
};

/**
 * Parse the given input string.
 * @param {String} input
 * @param {Object} options
 * @return {Object}
 */

const parse = (input, options) => {
  if (typeof input !== 'string') {
    throw new TypeError('Expected a string');
  }

  input = REPLACEMENTS[input] || input;

  const opts = { ...options };
  const max = typeof opts.maxLength === 'number' ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;

  let len = input.length;
  if (len > max) {
    throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
  }

  const bos = { type: 'bos', value: '', output: opts.prepend || '' };
  const tokens = [bos];

  const capture = opts.capture ? '' : '?:';
  const win32 = utils.isWindows(options);

  // create constants based on platform, for windows or posix
  const PLATFORM_CHARS = constants.globChars(win32);
  const EXTGLOB_CHARS = constants.extglobChars(PLATFORM_CHARS);

  const {
    DOT_LITERAL,
    PLUS_LITERAL,
    SLASH_LITERAL,
    ONE_CHAR,
    DOTS_SLASH,
    NO_DOT,
    NO_DOT_SLASH,
    NO_DOTS_SLASH,
    QMARK,
    QMARK_NO_DOT,
    STAR,
    START_ANCHOR
  } = PLATFORM_CHARS;

  const globstar = opts => {
    return `(${capture}(?:(?!${START_ANCHOR}${opts.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`;
  };

  const nodot = opts.dot ? '' : NO_DOT;
  const qmarkNoDot = opts.dot ? QMARK : QMARK_NO_DOT;
  let star = opts.bash === true ? globstar(opts) : STAR;

  if (opts.capture) {
    star = `(${star})`;
  }

  // minimatch options support
  if (typeof opts.noext === 'boolean') {
    opts.noextglob = opts.noext;
  }

  const state = {
    input,
    index: -1,
    start: 0,
    dot: opts.dot === true,
    consumed: '',
    output: '',
    prefix: '',
    backtrack: false,
    negated: false,
    brackets: 0,
    braces: 0,
    parens: 0,
    quotes: 0,
    globstar: false,
    tokens
  };

  input = utils.removePrefix(input, state);
  len = input.length;

  const extglobs = [];
  const braces = [];
  const stack = [];
  let prev = bos;
  let value;

  /**
   * Tokenizing helpers
   */

  const eos = () => state.index === len - 1;
  const peek = state.peek = (n = 1) => input[state.index + n];
  const advance = state.advance = () => input[++state.index] || '';
  const remaining = () => input.slice(state.index + 1);
  const consume = (value = '', num = 0) => {
    state.consumed += value;
    state.index += num;
  };

  const append = token => {
    state.output += token.output != null ? token.output : token.value;
    consume(token.value);
  };

  const negate = () => {
    let count = 1;

    while (peek() === '!' && (peek(2) !== '(' || peek(3) === '?')) {
      advance();
      state.start++;
      count++;
    }

    if (count % 2 === 0) {
      return false;
    }

    state.negated = true;
    state.start++;
    return true;
  };

  const increment = type => {
    state[type]++;
    stack.push(type);
  };

  const decrement = type => {
    state[type]--;
    stack.pop();
  };

  /**
   * Push tokens onto the tokens array. This helper speeds up
   * tokenizing by 1) helping us avoid backtracking as much as possible,
   * and 2) helping us avoid creating extra tokens when consecutive
   * characters are plain text. This improves performance and simplifies
   * lookbehinds.
   */

  const push = tok => {
    if (prev.type === 'globstar') {
      const isBrace = state.braces > 0 && (tok.type === 'comma' || tok.type === 'brace');
      const isExtglob = tok.extglob === true || (extglobs.length && (tok.type === 'pipe' || tok.type === 'paren'));

      if (tok.type !== 'slash' && tok.type !== 'paren' && !isBrace && !isExtglob) {
        state.output = state.output.slice(0, -prev.output.length);
        prev.type = 'star';
        prev.value = '*';
        prev.output = star;
        state.output += prev.output;
      }
    }

    if (extglobs.length && tok.type !== 'paren') {
      extglobs[extglobs.length - 1].inner += tok.value;
    }

    if (tok.value || tok.output) append(tok);
    if (prev && prev.type === 'text' && tok.type === 'text') {
      prev.value += tok.value;
      prev.output = (prev.output || '') + tok.value;
      return;
    }

    tok.prev = prev;
    tokens.push(tok);
    prev = tok;
  };

  const extglobOpen = (type, value) => {
    const token = { ...EXTGLOB_CHARS[value], conditions: 1, inner: '' };

    token.prev = prev;
    token.parens = state.parens;
    token.output = state.output;
    const output = (opts.capture ? '(' : '') + token.open;

    increment('parens');
    push({ type, value, output: state.output ? '' : ONE_CHAR });
    push({ type: 'paren', extglob: true, value: advance(), output });
    extglobs.push(token);
  };

  const extglobClose = token => {
    let output = token.close + (opts.capture ? ')' : '');
    let rest;

    if (token.type === 'negate') {
      let extglobStar = star;

      if (token.inner && token.inner.length > 1 && token.inner.includes('/')) {
        extglobStar = globstar(opts);
      }

      if (extglobStar !== star || eos() || /^\)+$/.test(remaining())) {
        output = token.close = `)$))${extglobStar}`;
      }

      if (token.inner.includes('*') && (rest = remaining()) && /^\.[^\\/.]+$/.test(rest)) {
        // Any non-magical string (`.ts`) or even nested expression (`.{ts,tsx}`) can follow after the closing parenthesis.
        // In this case, we need to parse the string and use it in the output of the original pattern.
        // Suitable patterns: `/!(*.d).ts`, `/!(*.d).{ts,tsx}`, `**/!(*-dbg).@(js)`.
        //
        // Disabling the `fastpaths` option due to a problem with parsing strings as `.ts` in the pattern like `**/!(*.d).ts`.
        const expression = parse(rest, { ...options, fastpaths: false }).output;

        output = token.close = `)${expression})${extglobStar})`;
      }

      if (token.prev.type === 'bos') {
        state.negatedExtglob = true;
      }
    }

    push({ type: 'paren', extglob: true, value, output });
    decrement('parens');
  };

  /**
   * Fast paths
   */

  if (opts.fastpaths !== false && !/(^[*!]|[/()[\]{}"])/.test(input)) {
    let backslashes = false;

    let output = input.replace(REGEX_SPECIAL_CHARS_BACKREF, (m, esc, chars, first, rest, index) => {
      if (first === '\\') {
        backslashes = true;
        return m;
      }

      if (first === '?') {
        if (esc) {
          return esc + first + (rest ? QMARK.repeat(rest.length) : '');
        }
        if (index === 0) {
          return qmarkNoDot + (rest ? QMARK.repeat(rest.length) : '');
        }
        return QMARK.repeat(chars.length);
      }

      if (first === '.') {
        return DOT_LITERAL.repeat(chars.length);
      }

      if (first === '*') {
        if (esc) {
          return esc + first + (rest ? star : '');
        }
        return star;
      }
      return esc ? m : `\\${m}`;
    });

    if (backslashes === true) {
      if (opts.unescape === true) {
        output = output.replace(/\\/g, '');
      } else {
        output = output.replace(/\\+/g, m => {
          return m.length % 2 === 0 ? '\\\\' : (m ? '\\' : '');
        });
      }
    }

    if (output === input && opts.contains === true) {
      state.output = input;
      return state;
    }

    state.output = utils.wrapOutput(output, state, options);
    return state;
  }

  /**
   * Tokenize input until we reach end-of-string
   */

  while (!eos()) {
    value = advance();

    if (value === '\u0000') {
      continue;
    }

    /**
     * Escaped characters
     */

    if (value === '\\') {
      const next = peek();

      if (next === '/' && opts.bash !== true) {
        continue;
      }

      if (next === '.' || next === ';') {
        continue;
      }

      if (!next) {
        value += '\\';
        push({ type: 'text', value });
        continue;
      }

      // collapse slashes to reduce potential for exploits
      const match = /^\\+/.exec(remaining());
      let slashes = 0;

      if (match && match[0].length > 2) {
        slashes = match[0].length;
        state.index += slashes;
        if (slashes % 2 !== 0) {
          value += '\\';
        }
      }

      if (opts.unescape === true) {
        value = advance();
      } else {
        value += advance();
      }

      if (state.brackets === 0) {
        push({ type: 'text', value });
        continue;
      }
    }

    /**
     * If we're inside a regex character class, continue
     * until we reach the closing bracket.
     */

    if (state.brackets > 0 && (value !== ']' || prev.value === '[' || prev.value === '[^')) {
      if (opts.posix !== false && value === ':') {
        const inner = prev.value.slice(1);
        if (inner.includes('[')) {
          prev.posix = true;

          if (inner.includes(':')) {
            const idx = prev.value.lastIndexOf('[');
            const pre = prev.value.slice(0, idx);
            const rest = prev.value.slice(idx + 2);
            const posix = POSIX_REGEX_SOURCE[rest];
            if (posix) {
              prev.value = pre + posix;
              state.backtrack = true;
              advance();

              if (!bos.output && tokens.indexOf(prev) === 1) {
                bos.output = ONE_CHAR;
              }
              continue;
            }
          }
        }
      }

      if ((value === '[' && peek() !== ':') || (value === '-' && peek() === ']')) {
        value = `\\${value}`;
      }

      if (value === ']' && (prev.value === '[' || prev.value === '[^')) {
        value = `\\${value}`;
      }

      if (opts.posix === true && value === '!' && prev.value === '[') {
        value = '^';
      }

      prev.value += value;
      append({ value });
      continue;
    }

    /**
     * If we're inside a quoted string, continue
     * until we reach the closing double quote.
     */

    if (state.quotes === 1 && value !== '"') {
      value = utils.escapeRegex(value);
      prev.value += value;
      append({ value });
      continue;
    }

    /**
     * Double quotes
     */

    if (value === '"') {
      state.quotes = state.quotes === 1 ? 0 : 1;
      if (opts.keepQuotes === true) {
        push({ type: 'text', value });
      }
      continue;
    }

    /**
     * Parentheses
     */

    if (value === '(') {
      increment('parens');
      push({ type: 'paren', value });
      continue;
    }

    if (value === ')') {
      if (state.parens === 0 && opts.strictBrackets === true) {
        throw new SyntaxError(syntaxError('opening', '('));
      }

      const extglob = extglobs[extglobs.length - 1];
      if (extglob && state.parens === extglob.parens + 1) {
        extglobClose(extglobs.pop());
        continue;
      }

      push({ type: 'paren', value, output: state.parens ? ')' : '\\)' });
      decrement('parens');
      continue;
    }

    /**
     * Square brackets
     */

    if (value === '[') {
      if (opts.nobracket === true || !remaining().includes(']')) {
        if (opts.nobracket !== true && opts.strictBrackets === true) {
          throw new SyntaxError(syntaxError('closing', ']'));
        }

        value = `\\${value}`;
      } else {
        increment('brackets');
      }

      push({ type: 'bracket', value });
      continue;
    }

    if (value === ']') {
      if (opts.nobracket === true || (prev && prev.type === 'bracket' && prev.value.length === 1)) {
        push({ type: 'text', value, output: `\\${value}` });
        continue;
      }

      if (state.brackets === 0) {
        if (opts.strictBrackets === true) {
          throw new SyntaxError(syntaxError('opening', '['));
        }

        push({ type: 'text', value, output: `\\${value}` });
        continue;
      }

      decrement('brackets');

      const prevValue = prev.value.slice(1);
      if (prev.posix !== true && prevValue[0] === '^' && !prevValue.includes('/')) {
        value = `/${value}`;
      }

      prev.value += value;
      append({ value });

      // when literal brackets are explicitly disabled
      // assume we should match with a regex character class
      if (opts.literalBrackets === false || utils.hasRegexChars(prevValue)) {
        continue;
      }

      const escaped = utils.escapeRegex(prev.value);
      state.output = state.output.slice(0, -prev.value.length);

      // when literal brackets are explicitly enabled
      // assume we should escape the brackets to match literal characters
      if (opts.literalBrackets === true) {
        state.output += escaped;
        prev.value = escaped;
        continue;
      }

      // when the user specifies nothing, try to match both
      prev.value = `(${capture}${escaped}|${prev.value})`;
      state.output += prev.value;
      continue;
    }

    /**
     * Braces
     */

    if (value === '{' && opts.nobrace !== true) {
      increment('braces');

      const open = {
        type: 'brace',
        value,
        output: '(',
        outputIndex: state.output.length,
        tokensIndex: state.tokens.length
      };

      braces.push(open);
      push(open);
      continue;
    }

    if (value === '}') {
      const brace = braces[braces.length - 1];

      if (opts.nobrace === true || !brace) {
        push({ type: 'text', value, output: value });
        continue;
      }

      let output = ')';

      if (brace.dots === true) {
        const arr = tokens.slice();
        const range = [];

        for (let i = arr.length - 1; i >= 0; i--) {
          tokens.pop();
          if (arr[i].type === 'brace') {
            break;
          }
          if (arr[i].type !== 'dots') {
            range.unshift(arr[i].value);
          }
        }

        output = expandRange(range, opts);
        state.backtrack = true;
      }

      if (brace.comma !== true && brace.dots !== true) {
        const out = state.output.slice(0, brace.outputIndex);
        const toks = state.tokens.slice(brace.tokensIndex);
        brace.value = brace.output = '\\{';
        value = output = '\\}';
        state.output = out;
        for (const t of toks) {
          state.output += (t.output || t.value);
        }
      }

      push({ type: 'brace', value, output });
      decrement('braces');
      braces.pop();
      continue;
    }

    /**
     * Pipes
     */

    if (value === '|') {
      if (extglobs.length > 0) {
        extglobs[extglobs.length - 1].conditions++;
      }
      push({ type: 'text', value });
      continue;
    }

    /**
     * Commas
     */

    if (value === ',') {
      let output = value;

      const brace = braces[braces.length - 1];
      if (brace && stack[stack.length - 1] === 'braces') {
        brace.comma = true;
        output = '|';
      }

      push({ type: 'comma', value, output });
      continue;
    }

    /**
     * Slashes
     */

    if (value === '/') {
      // if the beginning of the glob is "./", advance the start
      // to the current index, and don't add the "./" characters
      // to the state. This greatly simplifies lookbehinds when
      // checking for BOS characters like "!" and "." (not "./")
      if (prev.type === 'dot' && state.index === state.start + 1) {
        state.start = state.index + 1;
        state.consumed = '';
        state.output = '';
        tokens.pop();
        prev = bos; // reset "prev" to the first token
        continue;
      }

      push({ type: 'slash', value, output: SLASH_LITERAL });
      continue;
    }

    /**
     * Dots
     */

    if (value === '.') {
      if (state.braces > 0 && prev.type === 'dot') {
        if (prev.value === '.') prev.output = DOT_LITERAL;
        const brace = braces[braces.length - 1];
        prev.type = 'dots';
        prev.output += value;
        prev.value += value;
        brace.dots = true;
        continue;
      }

      if ((state.braces + state.parens) === 0 && prev.type !== 'bos' && prev.type !== 'slash') {
        push({ type: 'text', value, output: DOT_LITERAL });
        continue;
      }

      push({ type: 'dot', value, output: DOT_LITERAL });
      continue;
    }

    /**
     * Question marks
     */

    if (value === '?') {
      const isGroup = prev && prev.value === '(';
      if (!isGroup && opts.noextglob !== true && peek() === '(' && peek(2) !== '?') {
        extglobOpen('qmark', value);
        continue;
      }

      if (prev && prev.type === 'paren') {
        const next = peek();
        let output = value;

        if (next === '<' && !utils.supportsLookbehinds()) {
          throw new Error('Node.js v10 or higher is required for regex lookbehinds');
        }

        if ((prev.value === '(' && !/[!=<:]/.test(next)) || (next === '<' && !/<([!=]|\w+>)/.test(remaining()))) {
          output = `\\${value}`;
        }

        push({ type: 'text', value, output });
        continue;
      }

      if (opts.dot !== true && (prev.type === 'slash' || prev.type === 'bos')) {
        push({ type: 'qmark', value, output: QMARK_NO_DOT });
        continue;
      }

      push({ type: 'qmark', value, output: QMARK });
      continue;
    }

    /**
     * Exclamation
     */

    if (value === '!') {
      if (opts.noextglob !== true && peek() === '(') {
        if (peek(2) !== '?' || !/[!=<:]/.test(peek(3))) {
          extglobOpen('negate', value);
          continue;
        }
      }

      if (opts.nonegate !== true && state.index === 0) {
        negate();
        continue;
      }
    }

    /**
     * Plus
     */

    if (value === '+') {
      if (opts.noextglob !== true && peek() === '(' && peek(2) !== '?') {
        extglobOpen('plus', value);
        continue;
      }

      if ((prev && prev.value === '(') || opts.regex === false) {
        push({ type: 'plus', value, output: PLUS_LITERAL });
        continue;
      }

      if ((prev && (prev.type === 'bracket' || prev.type === 'paren' || prev.type === 'brace')) || state.parens > 0) {
        push({ type: 'plus', value });
        continue;
      }

      push({ type: 'plus', value: PLUS_LITERAL });
      continue;
    }

    /**
     * Plain text
     */

    if (value === '@') {
      if (opts.noextglob !== true && peek() === '(' && peek(2) !== '?') {
        push({ type: 'at', extglob: true, value, output: '' });
        continue;
      }

      push({ type: 'text', value });
      continue;
    }

    /**
     * Plain text
     */

    if (value !== '*') {
      if (value === '$' || value === '^') {
        value = `\\${value}`;
      }

      const match = REGEX_NON_SPECIAL_CHARS.exec(remaining());
      if (match) {
        value += match[0];
        state.index += match[0].length;
      }

      push({ type: 'text', value });
      continue;
    }

    /**
     * Stars
     */

    if (prev && (prev.type === 'globstar' || prev.star === true)) {
      prev.type = 'star';
      prev.star = true;
      prev.value += value;
      prev.output = star;
      state.backtrack = true;
      state.globstar = true;
      consume(value);
      continue;
    }

    let rest = remaining();
    if (opts.noextglob !== true && /^\([^?]/.test(rest)) {
      extglobOpen('star', value);
      continue;
    }

    if (prev.type === 'star') {
      if (opts.noglobstar === true) {
        consume(value);
        continue;
      }

      const prior = prev.prev;
      const before = prior.prev;
      const isStart = prior.type === 'slash' || prior.type === 'bos';
      const afterStar = before && (before.type === 'star' || before.type === 'globstar');

      if (opts.bash === true && (!isStart || (rest[0] && rest[0] !== '/'))) {
        push({ type: 'star', value, output: '' });
        continue;
      }

      const isBrace = state.braces > 0 && (prior.type === 'comma' || prior.type === 'brace');
      const isExtglob = extglobs.length && (prior.type === 'pipe' || prior.type === 'paren');
      if (!isStart && prior.type !== 'paren' && !isBrace && !isExtglob) {
        push({ type: 'star', value, output: '' });
        continue;
      }

      // strip consecutive `/**/`
      while (rest.slice(0, 3) === '/**') {
        const after = input[state.index + 4];
        if (after && after !== '/') {
          break;
        }
        rest = rest.slice(3);
        consume('/**', 3);
      }

      if (prior.type === 'bos' && eos()) {
        prev.type = 'globstar';
        prev.value += value;
        prev.output = globstar(opts);
        state.output = prev.output;
        state.globstar = true;
        consume(value);
        continue;
      }

      if (prior.type === 'slash' && prior.prev.type !== 'bos' && !afterStar && eos()) {
        state.output = state.output.slice(0, -(prior.output + prev.output).length);
        prior.output = `(?:${prior.output}`;

        prev.type = 'globstar';
        prev.output = globstar(opts) + (opts.strictSlashes ? ')' : '|$)');
        prev.value += value;
        state.globstar = true;
        state.output += prior.output + prev.output;
        consume(value);
        continue;
      }

      if (prior.type === 'slash' && prior.prev.type !== 'bos' && rest[0] === '/') {
        const end = rest[1] !== void 0 ? '|$' : '';

        state.output = state.output.slice(0, -(prior.output + prev.output).length);
        prior.output = `(?:${prior.output}`;

        prev.type = 'globstar';
        prev.output = `${globstar(opts)}${SLASH_LITERAL}|${SLASH_LITERAL}${end})`;
        prev.value += value;

        state.output += prior.output + prev.output;
        state.globstar = true;

        consume(value + advance());

        push({ type: 'slash', value: '/', output: '' });
        continue;
      }

      if (prior.type === 'bos' && rest[0] === '/') {
        prev.type = 'globstar';
        prev.value += value;
        prev.output = `(?:^|${SLASH_LITERAL}|${globstar(opts)}${SLASH_LITERAL})`;
        state.output = prev.output;
        state.globstar = true;
        consume(value + advance());
        push({ type: 'slash', value: '/', output: '' });
        continue;
      }

      // remove single star from output
      state.output = state.output.slice(0, -prev.output.length);

      // reset previous token to globstar
      prev.type = 'globstar';
      prev.output = globstar(opts);
      prev.value += value;

      // reset output with globstar
      state.output += prev.output;
      state.globstar = true;
      consume(value);
      continue;
    }

    const token = { type: 'star', value, output: star };

    if (opts.bash === true) {
      token.output = '.*?';
      if (prev.type === 'bos' || prev.type === 'slash') {
        token.output = nodot + token.output;
      }
      push(token);
      continue;
    }

    if (prev && (prev.type === 'bracket' || prev.type === 'paren') && opts.regex === true) {
      token.output = value;
      push(token);
      continue;
    }

    if (state.index === state.start || prev.type === 'slash' || prev.type === 'dot') {
      if (prev.type === 'dot') {
        state.output += NO_DOT_SLASH;
        prev.output += NO_DOT_SLASH;

      } else if (opts.dot === true) {
        state.output += NO_DOTS_SLASH;
        prev.output += NO_DOTS_SLASH;

      } else {
        state.output += nodot;
        prev.output += nodot;
      }

      if (peek() !== '*') {
        state.output += ONE_CHAR;
        prev.output += ONE_CHAR;
      }
    }

    push(token);
  }

  while (state.brackets > 0) {
    if (opts.strictBrackets === true) throw new SyntaxError(syntaxError('closing', ']'));
    state.output = utils.escapeLast(state.output, '[');
    decrement('brackets');
  }

  while (state.parens > 0) {
    if (opts.strictBrackets === true) throw new SyntaxError(syntaxError('closing', ')'));
    state.output = utils.escapeLast(state.output, '(');
    decrement('parens');
  }

  while (state.braces > 0) {
    if (opts.strictBrackets === true) throw new SyntaxError(syntaxError('closing', '}'));
    state.output = utils.escapeLast(state.output, '{');
    decrement('braces');
  }

  if (opts.strictSlashes !== true && (prev.type === 'star' || prev.type === 'bracket')) {
    push({ type: 'maybe_slash', value: '', output: `${SLASH_LITERAL}?` });
  }

  // rebuild the output if we had to backtrack at any point
  if (state.backtrack === true) {
    state.output = '';

    for (const token of state.tokens) {
      state.output += token.output != null ? token.output : token.value;

      if (token.suffix) {
        state.output += token.suffix;
      }
    }
  }

  return state;
};

/**
 * Fast paths for creating regular expressions for common glob patterns.
 * This can significantly speed up processing and has very little downside
 * impact when none of the fast paths match.
 */

parse.fastpaths = (input, options) => {
  const opts = { ...options };
  const max = typeof opts.maxLength === 'number' ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
  const len = input.length;
  if (len > max) {
    throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
  }

  input = REPLACEMENTS[input] || input;
  const win32 = utils.isWindows(options);

  // create constants based on platform, for windows or posix
  const {
    DOT_LITERAL,
    SLASH_LITERAL,
    ONE_CHAR,
    DOTS_SLASH,
    NO_DOT,
    NO_DOTS,
    NO_DOTS_SLASH,
    STAR,
    START_ANCHOR
  } = constants.globChars(win32);

  const nodot = opts.dot ? NO_DOTS : NO_DOT;
  const slashDot = opts.dot ? NO_DOTS_SLASH : NO_DOT;
  const capture = opts.capture ? '' : '?:';
  const state = { negated: false, prefix: '' };
  let star = opts.bash === true ? '.*?' : STAR;

  if (opts.capture) {
    star = `(${star})`;
  }

  const globstar = opts => {
    if (opts.noglobstar === true) return star;
    return `(${capture}(?:(?!${START_ANCHOR}${opts.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`;
  };

  const create = str => {
    switch (str) {
      case '*':
        return `${nodot}${ONE_CHAR}${star}`;

      case '.*':
        return `${DOT_LITERAL}${ONE_CHAR}${star}`;

      case '*.*':
        return `${nodot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`;

      case '*/*':
        return `${nodot}${star}${SLASH_LITERAL}${ONE_CHAR}${slashDot}${star}`;

      case '**':
        return nodot + globstar(opts);

      case '**/*':
        return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${ONE_CHAR}${star}`;

      case '**/*.*':
        return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`;

      case '**/.*':
        return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${DOT_LITERAL}${ONE_CHAR}${star}`;

      default: {
        const match = /^(.*?)\.(\w+)$/.exec(str);
        if (!match) return;

        const source = create(match[1]);
        if (!source) return;

        return source + DOT_LITERAL + match[2];
      }
    }
  };

  const output = utils.removePrefix(input, state);
  let source = create(output);

  if (source && opts.strictSlashes !== true) {
    source += `${SLASH_LITERAL}?`;
  }

  return source;
};

module.exports = parse;
'use strict';

const path = require('path');
const scan = require('./scan');
const parse = require('./parse');
const utils = require('./utils');
const constants = require('./constants');
const isObject = val => val && typeof val === 'object' && !Array.isArray(val);

/**
 * Creates a matcher function from one or more glob patterns. The
 * returned function takes a string to match as its first argument,
 * and returns true if the string is a match. The returned matcher
 * function also takes a boolean as the second argument that, when true,
 * returns an object with additional information.
 *
 * ```js
 * const picomatch = require('picomatch');
 * // picomatch(glob[, options]);
 *
 * const isMatch = picomatch('*.!(*a)');
 * console.log(isMatch('a.a')); //=> false
 * console.log(isMatch('a.b')); //=> true
 * ```
 * @name picomatch
 * @param {String|Array} `globs` One or more glob patterns.
 * @param {Object=} `options`
 * @return {Function=} Returns a matcher function.
 * @api public
 */

const picomatch = (glob, options, returnState = false) => {
  if (Array.isArray(glob)) {
    const fns = glob.map(input => picomatch(input, options, returnState));
    const arrayMatcher = str => {
      for (const isMatch of fns) {
        const state = isMatch(str);
        if (state) return state;
      }
      return false;
    };
    return arrayMatcher;
  }

  const isState = isObject(glob) && glob.tokens && glob.input;

  if (glob === '' || (typeof glob !== 'string' && !isState)) {
    throw new TypeError('Expected pattern to be a non-empty string');
  }

  const opts = options || {};
  const posix = utils.isWindows(options);
  const regex = isState
    ? picomatch.compileRe(glob, options)
    : picomatch.makeRe(glob, options, false, true);

  const state = regex.state;
  delete regex.state;

  let isIgnored = () => false;
  if (opts.ignore) {
    const ignoreOpts = { ...options, ignore: null, onMatch: null, onResult: null };
    isIgnored = picomatch(opts.ignore, ignoreOpts, returnState);
  }

  const matcher = (input, returnObject = false) => {
    const { isMatch, match, output } = picomatch.test(input, regex, options, { glob, posix });
    const result = { glob, state, regex, posix, input, output, match, isMatch };

    if (typeof opts.onResult === 'function') {
      opts.onResult(result);
    }

    if (isMatch === false) {
      result.isMatch = false;
      return returnObject ? result : false;
    }

    if (isIgnored(input)) {
      if (typeof opts.onIgnore === 'function') {
        opts.onIgnore(result);
      }
      result.isMatch = false;
      return returnObject ? result : false;
    }

    if (typeof opts.onMatch === 'function') {
      opts.onMatch(result);
    }
    return returnObject ? result : true;
  };

  if (returnState) {
    matcher.state = state;
  }

  return matcher;
};

/**
 * Test `input` with the given `regex`. This is used by the main
 * `picomatch()` function to test the input string.
 *
 * ```js
 * const picomatch = require('picomatch');
 * // picomatch.test(input, regex[, options]);
 *
 * console.log(picomatch.test('foo/bar', /^(?:([^/]*?)\/([^/]*?))$/));
 * // { isMatch: true, match: [ 'foo/', 'foo', 'bar' ], output: 'foo/bar' }
 * ```
 * @param {String} `input` String to test.
 * @param {RegExp} `regex`
 * @return {Object} Returns an object with matching info.
 * @api public
 */

picomatch.test = (input, regex, options, { glob, posix } = {}) => {
  if (typeof input !== 'string') {
    throw new TypeError('Expected input to be a string');
  }

  if (input === '') {
    return { isMatch: false, output: '' };
  }

  const opts = options || {};
  const format = opts.format || (posix ? utils.toPosixSlashes : null);
  let match = input === glob;
  let output = (match && format) ? format(input) : input;

  if (match === false) {
    output = format ? format(input) : input;
    match = output === glob;
  }

  if (match === false || opts.capture === true) {
    if (opts.matchBase === true || opts.basename === true) {
      match = picomatch.matchBase(input, regex, options, posix);
    } else {
      match = regex.exec(output);
    }
  }

  return { isMatch: Boolean(match), match, output };
};

/**
 * Match the basename of a filepath.
 *
 * ```js
 * const picomatch = require('picomatch');
 * // picomatch.matchBase(input, glob[, options]);
 * console.log(picomatch.matchBase('foo/bar.js', '*.js'); // true
 * ```
 * @param {String} `input` String to test.
 * @param {RegExp|String} `glob` Glob pattern or regex created by [.makeRe](#makeRe).
 * @return {Boolean}
 * @api public
 */

picomatch.matchBase = (input, glob, options, posix = utils.isWindows(options)) => {
  const regex = glob instanceof RegExp ? glob : picomatch.makeRe(glob, options);
  return regex.test(path.basename(input));
};

/**
 * Returns true if **any** of the given glob `patterns` match the specified `string`.
 *
 * ```js
 * const picomatch = require('picomatch');
 * // picomatch.isMatch(string, patterns[, options]);
 *
 * console.log(picomatch.isMatch('a.a', ['b.*', '*.a'])); //=> true
 * console.log(picomatch.isMatch('a.a', 'b.*')); //=> false
 * ```
 * @param {String|Array} str The string to test.
 * @param {String|Array} patterns One or more glob patterns to use for matching.
 * @param {Object} [options] See available [options](#options).
 * @return {Boolean} Returns true if any patterns match `str`
 * @api public
 */

picomatch.isMatch = (str, patterns, options) => picomatch(patterns, options)(str);

/**
 * Parse a glob pattern to create the source string for a regular
 * expression.
 *
 * ```js
 * const picomatch = require('picomatch');
 * const result = picomatch.parse(pattern[, options]);
 * ```
 * @param {String} `pattern`
 * @param {Object} `options`
 * @return {Object} Returns an object with useful properties and output to be used as a regex source string.
 * @api public
 */

picomatch.parse = (pattern, options) => {
  if (Array.isArray(pattern)) return pattern.map(p => picomatch.parse(p, options));
  return parse(pattern, { ...options, fastpaths: false });
};

/**
 * Scan a glob pattern to separate the pattern into segments.
 *
 * ```js
 * const picomatch = require('picomatch');
 * // picomatch.scan(input[, options]);
 *
 * const result = picomatch.scan('!./foo/*.js');
 * console.log(result);
 * { prefix: '!./',
 *   input: '!./foo/*.js',
 *   start: 3,
 *   base: 'foo',
 *   glob: '*.js',
 *   isBrace: false,
 *   isBracket: false,
 *   isGlob: true,
 *   isExtglob: false,
 *   isGlobstar: false,
 *   negated: true }
 * ```
 * @param {String} `input` Glob pattern to scan.
 * @param {Object} `options`
 * @return {Object} Returns an object with
 * @api public
 */

picomatch.scan = (input, options) => scan(input, options);

/**
 * Compile a regular expression from the `state` object returned by the
 * [parse()](#parse) method.
 *
 * @param {Object} `state`
 * @param {Object} `options`
 * @param {Boolean} `returnOutput` Intended for implementors, this argument allows you to return the raw output from the parser.
 * @param {Boolean} `returnState` Adds the state to a `state` property on the returned regex. Useful for implementors and debugging.
 * @return {RegExp}
 * @api public
 */

picomatch.compileRe = (state, options, returnOutput = false, returnState = false) => {
  if (returnOutput === true) {
    return state.output;
  }

  const opts = options || {};
  const prepend = opts.contains ? '' : '^';
  const append = opts.contains ? '' : '$';

  let source = `${prepend}(?:${state.output})${append}`;
  if (state && state.negated === true) {
    source = `^(?!${source}).*$`;
  }

  const regex = picomatch.toRegex(source, options);
  if (returnState === true) {
    regex.state = state;
  }

  return regex;
};

/**
 * Create a regular expression from a parsed glob pattern.
 *
 * ```js
 * const picomatch = require('picomatch');
 * const state = picomatch.parse('*.js');
 * // picomatch.compileRe(state[, options]);
 *
 * console.log(picomatch.compileRe(state));
 * //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/
 * ```
 * @param {String} `state` The object returned from the `.parse` method.
 * @param {Object} `options`
 * @param {Boolean} `returnOutput` Implementors may use this argument to return the compiled output, instead of a regular expression. This is not exposed on the options to prevent end-users from mutating the result.
 * @param {Boolean} `returnState` Implementors may use this argument to return the state from the parsed glob with the returned regular expression.
 * @return {RegExp} Returns a regex created from the given pattern.
 * @api public
 */

picomatch.makeRe = (input, options = {}, returnOutput = false, returnState = false) => {
  if (!input || typeof input !== 'string') {
    throw new TypeError('Expected a non-empty string');
  }

  let parsed = { negated: false, fastpaths: true };

  if (options.fastpaths !== false && (input[0] === '.' || input[0] === '*')) {
    parsed.output = parse.fastpaths(input, options);
  }

  if (!parsed.output) {
    parsed = parse(input, options);
  }

  return picomatch.compileRe(parsed, options, returnOutput, returnState);
};

/**
 * Create a regular expression from the given regex source string.
 *
 * ```js
 * const picomatch = require('picomatch');
 * // picomatch.toRegex(source[, options]);
 *
 * const { output } = picomatch.parse('*.js');
 * console.log(picomatch.toRegex(output));
 * //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/
 * ```
 * @param {String} `source` Regular expression source string.
 * @param {Object} `options`
 * @return {RegExp}
 * @api public
 */

picomatch.toRegex = (source, options) => {
  try {
    const opts = options || {};
    return new RegExp(source, opts.flags || (opts.nocase ? 'i' : ''));
  } catch (err) {
    if (options && options.debug === true) throw err;
    return /$^/;
  }
};

/**
 * Picomatch constants.
 * @return {Object}
 */

picomatch.constants = constants;

/**
 * Expose "picomatch"
 */

module.exports = picomatch;
'use strict';

const utils = require('./utils');
const {
  CHAR_ASTERISK,             /* * */
  CHAR_AT,                   /* @ */
  CHAR_BACKWARD_SLASH,       /* \ */
  CHAR_COMMA,                /* , */
  CHAR_DOT,                  /* . */
  CHAR_EXCLAMATION_MARK,     /* ! */
  CHAR_FORWARD_SLASH,        /* / */
  CHAR_LEFT_CURLY_BRACE,     /* { */
  CHAR_LEFT_PARENTHESES,     /* ( */
  CHAR_LEFT_SQUARE_BRACKET,  /* [ */
  CHAR_PLUS,                 /* + */
  CHAR_QUESTION_MARK,        /* ? */
  CHAR_RIGHT_CURLY_BRACE,    /* } */
  CHAR_RIGHT_PARENTHESES,    /* ) */
  CHAR_RIGHT_SQUARE_BRACKET  /* ] */
} = require('./constants');

const isPathSeparator = code => {
  return code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH;
};

const depth = token => {
  if (token.isPrefix !== true) {
    token.depth = token.isGlobstar ? Infinity : 1;
  }
};

/**
 * Quickly scans a glob pattern and returns an object with a handful of
 * useful properties, like `isGlob`, `path` (the leading non-glob, if it exists),
 * `glob` (the actual pattern), `negated` (true if the path starts with `!` but not
 * with `!(`) and `negatedExtglob` (true if the path starts with `!(`).
 *
 * ```js
 * const pm = require('picomatch');
 * console.log(pm.scan('foo/bar/*.js'));
 * { isGlob: true, input: 'foo/bar/*.js', base: 'foo/bar', glob: '*.js' }
 * ```
 * @param {String} `str`
 * @param {Object} `options`
 * @return {Object} Returns an object with tokens and regex source string.
 * @api public
 */

const scan = (input, options) => {
  const opts = options || {};

  const length = input.length - 1;
  const scanToEnd = opts.parts === true || opts.scanToEnd === true;
  const slashes = [];
  const tokens = [];
  const parts = [];

  let str = input;
  let index = -1;
  let start = 0;
  let lastIndex = 0;
  let isBrace = false;
  let isBracket = false;
  let isGlob = false;
  let isExtglob = false;
  let isGlobstar = false;
  let braceEscaped = false;
  let backslashes = false;
  let negated = false;
  let negatedExtglob = false;
  let finished = false;
  let braces = 0;
  let prev;
  let code;
  let token = { value: '', depth: 0, isGlob: false };

  const eos = () => index >= length;
  const peek = () => str.charCodeAt(index + 1);
  const advance = () => {
    prev = code;
    return str.charCodeAt(++index);
  };

  while (index < length) {
    code = advance();
    let next;

    if (code === CHAR_BACKWARD_SLASH) {
      backslashes = token.backslashes = true;
      code = advance();

      if (code === CHAR_LEFT_CURLY_BRACE) {
        braceEscaped = true;
      }
      continue;
    }

    if (braceEscaped === true || code === CHAR_LEFT_CURLY_BRACE) {
      braces++;

      while (eos() !== true && (code = advance())) {
        if (code === CHAR_BACKWARD_SLASH) {
          backslashes = token.backslashes = true;
          advance();
          continue;
        }

        if (code === CHAR_LEFT_CURLY_BRACE) {
          braces++;
          continue;
        }

        if (braceEscaped !== true && code === CHAR_DOT && (code = advance()) === CHAR_DOT) {
          isBrace = token.isBrace = true;
          isGlob = token.isGlob = true;
          finished = true;

          if (scanToEnd === true) {
            continue;
          }

          break;
        }

        if (braceEscaped !== true && code === CHAR_COMMA) {
          isBrace = token.isBrace = true;
          isGlob = token.isGlob = true;
          finished = true;

          if (scanToEnd === true) {
            continue;
          }

          break;
        }

        if (code === CHAR_RIGHT_CURLY_BRACE) {
          braces--;

          if (braces === 0) {
            braceEscaped = false;
            isBrace = token.isBrace = true;
            finished = true;
            break;
          }
        }
      }

      if (scanToEnd === true) {
        continue;
      }

      break;
    }

    if (code === CHAR_FORWARD_SLASH) {
      slashes.push(index);
      tokens.push(token);
      token = { value: '', depth: 0, isGlob: false };

      if (finished === true) continue;
      if (prev === CHAR_DOT && index === (start + 1)) {
        start += 2;
        continue;
      }

      lastIndex = index + 1;
      continue;
    }

    if (opts.noext !== true) {
      const isExtglobChar = code === CHAR_PLUS
        || code === CHAR_AT
        || code === CHAR_ASTERISK
        || code === CHAR_QUESTION_MARK
        || code === CHAR_EXCLAMATION_MARK;

      if (isExtglobChar === true && peek() === CHAR_LEFT_PARENTHESES) {
        isGlob = token.isGlob = true;
        isExtglob = token.isExtglob = true;
        finished = true;
        if (code === CHAR_EXCLAMATION_MARK && index === start) {
          negatedExtglob = true;
        }

        if (scanToEnd === true) {
          while (eos() !== true && (code = advance())) {
            if (code === CHAR_BACKWARD_SLASH) {
              backslashes = token.backslashes = true;
              code = advance();
              continue;
            }

            if (code === CHAR_RIGHT_PARENTHESES) {
              isGlob = token.isGlob = true;
              finished = true;
              break;
            }
          }
          continue;
        }
        break;
      }
    }

    if (code === CHAR_ASTERISK) {
      if (prev === CHAR_ASTERISK) isGlobstar = token.isGlobstar = true;
      isGlob = token.isGlob = true;
      finished = true;

      if (scanToEnd === true) {
        continue;
      }
      break;
    }

    if (code === CHAR_QUESTION_MARK) {
      isGlob = token.isGlob = true;
      finished = true;

      if (scanToEnd === true) {
        continue;
      }
      break;
    }

    if (code === CHAR_LEFT_SQUARE_BRACKET) {
      while (eos() !== true && (next = advance())) {
        if (next === CHAR_BACKWARD_SLASH) {
          backslashes = token.backslashes = true;
          advance();
          continue;
        }

        if (next === CHAR_RIGHT_SQUARE_BRACKET) {
          isBracket = token.isBracket = true;
          isGlob = token.isGlob = true;
          finished = true;
          break;
        }
      }

      if (scanToEnd === true) {
        continue;
      }

      break;
    }

    if (opts.nonegate !== true && code === CHAR_EXCLAMATION_MARK && index === start) {
      negated = token.negated = true;
      start++;
      continue;
    }

    if (opts.noparen !== true && code === CHAR_LEFT_PARENTHESES) {
      isGlob = token.isGlob = true;

      if (scanToEnd === true) {
        while (eos() !== true && (code = advance())) {
          if (code === CHAR_LEFT_PARENTHESES) {
            backslashes = token.backslashes = true;
            code = advance();
            continue;
          }

          if (code === CHAR_RIGHT_PARENTHESES) {
            finished = true;
            break;
          }
        }
        continue;
      }
      break;
    }

    if (isGlob === true) {
      finished = true;

      if (scanToEnd === true) {
        continue;
      }

      break;
    }
  }

  if (opts.noext === true) {
    isExtglob = false;
    isGlob = false;
  }

  let base = str;
  let prefix = '';
  let glob = '';

  if (start > 0) {
    prefix = str.slice(0, start);
    str = str.slice(start);
    lastIndex -= start;
  }

  if (base && isGlob === true && lastIndex > 0) {
    base = str.slice(0, lastIndex);
    glob = str.slice(lastIndex);
  } else if (isGlob === true) {
    base = '';
    glob = str;
  } else {
    base = str;
  }

  if (base && base !== '' && base !== '/' && base !== str) {
    if (isPathSeparator(base.charCodeAt(base.length - 1))) {
      base = base.slice(0, -1);
    }
  }

  if (opts.unescape === true) {
    if (glob) glob = utils.removeBackslashes(glob);

    if (base && backslashes === true) {
      base = utils.removeBackslashes(base);
    }
  }

  const state = {
    prefix,
    input,
    start,
    base,
    glob,
    isBrace,
    isBracket,
    isGlob,
    isExtglob,
    isGlobstar,
    negated,
    negatedExtglob
  };

  if (opts.tokens === true) {
    state.maxDepth = 0;
    if (!isPathSeparator(code)) {
      tokens.push(token);
    }
    state.tokens = tokens;
  }

  if (opts.parts === true || opts.tokens === true) {
    let prevIndex;

    for (let idx = 0; idx < slashes.length; idx++) {
      const n = prevIndex ? prevIndex + 1 : start;
      const i = slashes[idx];
      const value = input.slice(n, i);
      if (opts.tokens) {
        if (idx === 0 && start !== 0) {
          tokens[idx].isPrefix = true;
          tokens[idx].value = prefix;
        } else {
          tokens[idx].value = value;
        }
        depth(tokens[idx]);
        state.maxDepth += tokens[idx].depth;
      }
      if (idx !== 0 || value !== '') {
        parts.push(value);
      }
      prevIndex = i;
    }

    if (prevIndex && prevIndex + 1 < input.length) {
      const value = input.slice(prevIndex + 1);
      parts.push(value);

      if (opts.tokens) {
        tokens[tokens.length - 1].value = value;
        depth(tokens[tokens.length - 1]);
        state.maxDepth += tokens[tokens.length - 1].depth;
      }
    }

    state.slashes = slashes;
    state.parts = parts;
  }

  return state;
};

module.exports = scan;
'use strict';

const path = require('path');
const win32 = process.platform === 'win32';
const {
  REGEX_BACKSLASH,
  REGEX_REMOVE_BACKSLASH,
  REGEX_SPECIAL_CHARS,
  REGEX_SPECIAL_CHARS_GLOBAL
} = require('./constants');

exports.isObject = val => val !== null && typeof val === 'object' && !Array.isArray(val);
exports.hasRegexChars = str => REGEX_SPECIAL_CHARS.test(str);
exports.isRegexChar = str => str.length === 1 && exports.hasRegexChars(str);
exports.escapeRegex = str => str.replace(REGEX_SPECIAL_CHARS_GLOBAL, '\\$1');
exports.toPosixSlashes = str => str.replace(REGEX_BACKSLASH, '/');

exports.removeBackslashes = str => {
  return str.replace(REGEX_REMOVE_BACKSLASH, match => {
    return match === '\\' ? '' : match;
  });
};

exports.supportsLookbehinds = () => {
  const segs = process.version.slice(1).split('.').map(Number);
  if (segs.length === 3 && segs[0] >= 9 || (segs[0] === 8 && segs[1] >= 10)) {
    return true;
  }
  return false;
};

exports.isWindows = options => {
  if (options && typeof options.windows === 'boolean') {
    return options.windows;
  }
  return win32 === true || path.sep === '\\';
};

exports.escapeLast = (input, char, lastIdx) => {
  const idx = input.lastIndexOf(char, lastIdx);
  if (idx === -1) return input;
  if (input[idx - 1] === '\\') return exports.escapeLast(input, char, idx - 1);
  return `${input.slice(0, idx)}\\${input.slice(idx)}`;
};

exports.removePrefix = (input, state = {}) => {
  let output = input;
  if (output.startsWith('./')) {
    output = output.slice(2);
    state.prefix = './';
  }
  return output;
};

exports.wrapOutput = (input, state = {}, options = {}) => {
  const prepend = options.contains ? '' : '^';
  const append = options.contains ? '' : '$';

  let output = `${prepend}(?:${input})${append}`;
  if (state.negated === true) {
    output = `(?:^(?!${output}).*$)`;
  }
  return output;
};
MIT License

Copyright (c) 2012-2019 Thorsten Lorenz, Paul Miller (https://paulmillr.com)

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
'use strict';

const fs = require('fs');
const { Readable } = require('stream');
const sysPath = require('path');
const { promisify } = require('util');
const picomatch = require('picomatch');

const readdir = promisify(fs.readdir);
const stat = promisify(fs.stat);
const lstat = promisify(fs.lstat);
const realpath = promisify(fs.realpath);

/**
 * @typedef {Object} EntryInfo
 * @property {String} path
 * @property {String} fullPath
 * @property {fs.Stats=} stats
 * @property {fs.Dirent=} dirent
 * @property {String} basename
 */

const BANG = '!';
const RECURSIVE_ERROR_CODE = 'READDIRP_RECURSIVE_ERROR';
const NORMAL_FLOW_ERRORS = new Set(['ENOENT', 'EPERM', 'EACCES', 'ELOOP', RECURSIVE_ERROR_CODE]);
const FILE_TYPE = 'files';
const DIR_TYPE = 'directories';
const FILE_DIR_TYPE = 'files_directories';
const EVERYTHING_TYPE = 'all';
const ALL_TYPES = [FILE_TYPE, DIR_TYPE, FILE_DIR_TYPE, EVERYTHING_TYPE];

const isNormalFlowError = error => NORMAL_FLOW_ERRORS.has(error.code);
const [maj, min] = process.versions.node.split('.').slice(0, 2).map(n => Number.parseInt(n, 10));
const wantBigintFsStats = process.platform === 'win32' && (maj > 10 || (maj === 10 && min >= 5));

const normalizeFilter = filter => {
  if (filter === undefined) return;
  if (typeof filter === 'function') return filter;

  if (typeof filter === 'string') {
    const glob = picomatch(filter.trim());
    return entry => glob(entry.basename);
  }

  if (Array.isArray(filter)) {
    const positive = [];
    const negative = [];
    for (const item of filter) {
      const trimmed = item.trim();
      if (trimmed.charAt(0) === BANG) {
        negative.push(picomatch(trimmed.slice(1)));
      } else {
        positive.push(picomatch(trimmed));
      }
    }

    if (negative.length > 0) {
      if (positive.length > 0) {
        return entry =>
          positive.some(f => f(entry.basename)) && !negative.some(f => f(entry.basename));
      }
      return entry => !negative.some(f => f(entry.basename));
    }
    return entry => positive.some(f => f(entry.basename));
  }
};

class ReaddirpStream extends Readable {
  static get defaultOptions() {
    return {
      root: '.',
      /* eslint-disable no-unused-vars */
      fileFilter: (path) => true,
      directoryFilter: (path) => true,
      /* eslint-enable no-unused-vars */
      type: FILE_TYPE,
      lstat: false,
      depth: 2147483648,
      alwaysStat: false
    };
  }

  constructor(options = {}) {
    super({
      objectMode: true,
      autoDestroy: true,
      highWaterMark: options.highWaterMark || 4096
    });
    const opts = { ...ReaddirpStream.defaultOptions, ...options };
    const { root, type } = opts;

    this._fileFilter = normalizeFilter(opts.fileFilter);
    this._directoryFilter = normalizeFilter(opts.directoryFilter);

    const statMethod = opts.lstat ? lstat : stat;
    // Use bigint stats if it's windows and stat() supports options (node 10+).
    if (wantBigintFsStats) {
      this._stat = path => statMethod(path, { bigint: true });
    } else {
      this._stat = statMethod;
    }

    this._maxDepth = opts.depth;
    this._wantsDir = [DIR_TYPE, FILE_DIR_TYPE, EVERYTHING_TYPE].includes(type);
    this._wantsFile = [FILE_TYPE, FILE_DIR_TYPE, EVERYTHING_TYPE].includes(type);
    this._wantsEverything = type === EVERYTHING_TYPE;
    this._root = sysPath.resolve(root);
    this._isDirent = ('Dirent' in fs) && !opts.alwaysStat;
    this._statsProp = this._isDirent ? 'dirent' : 'stats';
    this._rdOptions = { encoding: 'utf8', withFileTypes: this._isDirent };

    // Launch stream with one parent, the root dir.
    this.parents = [this._exploreDir(root, 1)];
    this.reading = false;
    this.parent = undefined;
  }

  async _read(batch) {
    if (this.reading) return;
    this.reading = true;

    try {
      while (!this.destroyed && batch > 0) {
        const { path, depth, files = [] } = this.parent || {};

        if (files.length > 0) {
          const slice = files.splice(0, batch).map(dirent => this._formatEntry(dirent, path));
          for (const entry of await Promise.all(slice)) {
            if (this.destroyed) return;

            const entryType = await this._getEntryType(entry);
            if (entryType === 'directory' && this._directoryFilter(entry)) {
              if (depth <= this._maxDepth) {
                this.parents.push(this._exploreDir(entry.fullPath, depth + 1));
              }

              if (this._wantsDir) {
                this.push(entry);
                batch--;
              }
            } else if ((entryType === 'file' || this._includeAsFile(entry)) && this._fileFilter(entry)) {
              if (this._wantsFile) {
                this.push(entry);
                batch--;
              }
            }
          }
        } else {
          const parent = this.parents.pop();
          if (!parent) {
            this.push(null);
            break;
          }
          this.parent = await parent;
          if (this.destroyed) return;
        }
      }
    } catch (error) {
      this.destroy(error);
    } finally {
      this.reading = false;
    }
  }

  async _exploreDir(path, depth) {
    let files;
    try {
      files = await readdir(path, this._rdOptions);
    } catch (error) {
      this._onError(error);
    }
    return { files, depth, path };
  }

  async _formatEntry(dirent, path) {
    let entry;
    try {
      const basename = this._isDirent ? dirent.name : dirent;
      const fullPath = sysPath.resolve(sysPath.join(path, basename));
      entry = { path: sysPath.relative(this._root, fullPath), fullPath, basename };
      entry[this._statsProp] = this._isDirent ? dirent : await this._stat(fullPath);
    } catch (err) {
      this._onError(err);
    }
    return entry;
  }

  _onError(err) {
    if (isNormalFlowError(err) && !this.destroyed) {
      this.emit('warn', err);
    } else {
      this.destroy(err);
    }
  }

  async _getEntryType(entry) {
    // entry may be undefined, because a warning or an error were emitted
    // and the statsProp is undefined
    const stats = entry && entry[this._statsProp];
    if (!stats) {
      return;
    }
    if (stats.isFile()) {
      return 'file';
    }
    if (stats.isDirectory()) {
      return 'directory';
    }
    if (stats && stats.isSymbolicLink()) {
      const full = entry.fullPath;
      try {
        const entryRealPath = await realpath(full);
        const entryRealPathStats = await lstat(entryRealPath);
        if (entryRealPathStats.isFile()) {
          return 'file';
        }
        if (entryRealPathStats.isDirectory()) {
          const len = entryRealPath.length;
          if (full.startsWith(entryRealPath) && full.substr(len, 1) === sysPath.sep) {
            const recursiveError = new Error(
              `Circular symlink detected: "${full}" points to "${entryRealPath}"`
            );
            recursiveError.code = RECURSIVE_ERROR_CODE;
            return this._onError(recursiveError);
          }
          return 'directory';
        }
      } catch (error) {
        this._onError(error);
      }
    }
  }

  _includeAsFile(entry) {
    const stats = entry && entry[this._statsProp];

    return stats && this._wantsEverything && !stats.isDirectory();
  }
}

/**
 * @typedef {Object} ReaddirpArguments
 * @property {Function=} fileFilter
 * @property {Function=} directoryFilter
 * @property {String=} type
 * @property {Number=} depth
 * @property {String=} root
 * @property {Boolean=} lstat
 * @property {Boolean=} bigint
 */

/**
 * Main function which ends up calling readdirRec and reads all files and directories in given root recursively.
 * @param {String} root Root directory
 * @param {ReaddirpArguments=} options Options to specify root (start directory), filters and recursion depth
 */
const readdirp = (root, options = {}) => {
  let type = options.entryType || options.type;
  if (type === 'both') type = FILE_DIR_TYPE; // backwards-compatibility
  if (type) options.type = type;
  if (!root) {
    throw new Error('readdirp: root argument is required. Usage: readdirp(root, options)');
  } else if (typeof root !== 'string') {
    throw new TypeError('readdirp: root argument must be a string. Usage: readdirp(root, options)');
  } else if (type && !ALL_TYPES.includes(type)) {
    throw new Error(`readdirp: Invalid type passed. Use one of ${ALL_TYPES.join(', ')}`);
  }

  options.root = root;
  return new ReaddirpStream(options);
};

const readdirpPromise = (root, options = {}) => {
  return new Promise((resolve, reject) => {
    const files = [];
    readdirp(root, options)
      .on('data', entry => files.push(entry))
      .on('end', () => resolve(files))
      .on('error', error => reject(error));
  });
};

readdirp.promise = readdirpPromise;
readdirp.ReaddirpStream = ReaddirpStream;
readdirp.default = readdirp;

module.exports = readdirp;
{
  "name": "readdirp",
  "description": "Recursive version of fs.readdir with streaming API.",
  "version": "3.6.0",
  "homepage": "https://github.com/paulmillr/readdirp",
  "repository": {
    "type": "git",
    "url": "git://github.com/paulmillr/readdirp.git"
  },
  "license": "MIT",
  "author": "Thorsten Lorenz <thlorenz@gmx.de> (thlorenz.com)",
  "main": "index.js",
  "engines": {
    "node": ">=8.10.0"
  },
  "files": [
    "index.js",
    "index.d.ts"
  ],
  "dependencies": {
    "picomatch": "^2.2.1"
  },
  "devDependencies": {
    "@types/node": "^14",
    "chai": "^4.2",
    "chai-subset": "^1.6",
    "dtslint": "^3.3.0",
    "eslint": "^7.0.0",
    "mocha": "^7.1.1",
    "nyc": "^15.0.0",
    "rimraf": "^3.0.0",
    "typescript": "^4.0.3"
  }
}The MIT License (MIT)

Copyright (c) 2015-present, Jon Schlinkert.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
/*!
 * to-regex-range <https://github.com/micromatch/to-regex-range>
 *
 * Copyright (c) 2015-present, Jon Schlinkert.
 * Released under the MIT License.
 */

'use strict';

const isNumber = require('is-number');

const toRegexRange = (min, max, options) => {
  if (isNumber(min) === false) {
    throw new TypeError('toRegexRange: expected the first argument to be a number');
  }

  if (max === void 0 || min === max) {
    return String(min);
  }

  if (isNumber(max) === false) {
    throw new TypeError('toRegexRange: expected the second argument to be a number.');
  }

  let opts = { relaxZeros: true, ...options };
  if (typeof opts.strictZeros === 'boolean') {
    opts.relaxZeros = opts.strictZeros === false;
  }

  let relax = String(opts.relaxZeros);
  let shorthand = String(opts.shorthand);
  let capture = String(opts.capture);
  let wrap = String(opts.wrap);
  let cacheKey = min + ':' + max + '=' + relax + shorthand + capture + wrap;

  if (toRegexRange.cache.hasOwnProperty(cacheKey)) {
    return toRegexRange.cache[cacheKey].result;
  }

  let a = Math.min(min, max);
  let b = Math.max(min, max);

  if (Math.abs(a - b) === 1) {
    let result = min + '|' + max;
    if (opts.capture) {
      return `(${result})`;
    }
    if (opts.wrap === false) {
      return result;
    }
    return `(?:${result})`;
  }

  let isPadded = hasPadding(min) || hasPadding(max);
  let state = { min, max, a, b };
  let positives = [];
  let negatives = [];

  if (isPadded) {
    state.isPadded = isPadded;
    state.maxLen = String(state.max).length;
  }

  if (a < 0) {
    let newMin = b < 0 ? Math.abs(b) : 1;
    negatives = splitToPatterns(newMin, Math.abs(a), state, opts);
    a = state.a = 0;
  }

  if (b >= 0) {
    positives = splitToPatterns(a, b, state, opts);
  }

  state.negatives = negatives;
  state.positives = positives;
  state.result = collatePatterns(negatives, positives, opts);

  if (opts.capture === true) {
    state.result = `(${state.result})`;
  } else if (opts.wrap !== false && (positives.length + negatives.length) > 1) {
    state.result = `(?:${state.result})`;
  }

  toRegexRange.cache[cacheKey] = state;
  return state.result;
};

function collatePatterns(neg, pos, options) {
  let onlyNegative = filterPatterns(neg, pos, '-', false, options) || [];
  let onlyPositive = filterPatterns(pos, neg, '', false, options) || [];
  let intersected = filterPatterns(neg, pos, '-?', true, options) || [];
  let subpatterns = onlyNegative.concat(intersected).concat(onlyPositive);
  return subpatterns.join('|');
}

function splitToRanges(min, max) {
  let nines = 1;
  let zeros = 1;

  let stop = countNines(min, nines);
  let stops = new Set([max]);

  while (min <= stop && stop <= max) {
    stops.add(stop);
    nines += 1;
    stop = countNines(min, nines);
  }

  stop = countZeros(max + 1, zeros) - 1;

  while (min < stop && stop <= max) {
    stops.add(stop);
    zeros += 1;
    stop = countZeros(max + 1, zeros) - 1;
  }

  stops = [...stops];
  stops.sort(compare);
  return stops;
}

/**
 * Convert a range to a regex pattern
 * @param {Number} `start`
 * @param {Number} `stop`
 * @return {String}
 */

function rangeToPattern(start, stop, options) {
  if (start === stop) {
    return { pattern: start, count: [], digits: 0 };
  }

  let zipped = zip(start, stop);
  let digits = zipped.length;
  let pattern = '';
  let count = 0;

  for (let i = 0; i < digits; i++) {
    let [startDigit, stopDigit] = zipped[i];

    if (startDigit === stopDigit) {
      pattern += startDigit;

    } else if (startDigit !== '0' || stopDigit !== '9') {
      pattern += toCharacterClass(startDigit, stopDigit, options);

    } else {
      count++;
    }
  }

  if (count) {
    pattern += options.shorthand === true ? '\\d' : '[0-9]';
  }

  return { pattern, count: [count], digits };
}

function splitToPatterns(min, max, tok, options) {
  let ranges = splitToRanges(min, max);
  let tokens = [];
  let start = min;
  let prev;

  for (let i = 0; i < ranges.length; i++) {
    let max = ranges[i];
    let obj = rangeToPattern(String(start), String(max), options);
    let zeros = '';

    if (!tok.isPadded && prev && prev.pattern === obj.pattern) {
      if (prev.count.length > 1) {
        prev.count.pop();
      }

      prev.count.push(obj.count[0]);
      prev.string = prev.pattern + toQuantifier(prev.count);
      start = max + 1;
      continue;
    }

    if (tok.isPadded) {
      zeros = padZeros(max, tok, options);
    }

    obj.string = zeros + obj.pattern + toQuantifier(obj.count);
    tokens.push(obj);
    start = max + 1;
    prev = obj;
  }

  return tokens;
}

function filterPatterns(arr, comparison, prefix, intersection, options) {
  let result = [];

  for (let ele of arr) {
    let { string } = ele;

    // only push if _both_ are negative...
    if (!intersection && !contains(comparison, 'string', string)) {
      result.push(prefix + string);
    }

    // or _both_ are positive
    if (intersection && contains(comparison, 'string', string)) {
      result.push(prefix + string);
    }
  }
  return result;
}

/**
 * Zip strings
 */

function zip(a, b) {
  let arr = [];
  for (let i = 0; i < a.length; i++) arr.push([a[i], b[i]]);
  return arr;
}

function compare(a, b) {
  return a > b ? 1 : b > a ? -1 : 0;
}

function contains(arr, key, val) {
  return arr.some(ele => ele[key] === val);
}

function countNines(min, len) {
  return Number(String(min).slice(0, -len) + '9'.repeat(len));
}

function countZeros(integer, zeros) {
  return integer - (integer % Math.pow(10, zeros));
}

function toQuantifier(digits) {
  let [start = 0, stop = ''] = digits;
  if (stop || start > 1) {
    return `{${start + (stop ? ',' + stop : '')}}`;
  }
  return '';
}

function toCharacterClass(a, b, options) {
  return `[${a}${(b - a === 1) ? '' : '-'}${b}]`;
}

function hasPadding(str) {
  return /^-?(0+)\d/.test(str);
}

function padZeros(value, tok, options) {
  if (!tok.isPadded) {
    return value;
  }

  let diff = Math.abs(tok.maxLen - String(value).length);
  let relax = options.relaxZeros !== false;

  switch (diff) {
    case 0:
      return '';
    case 1:
      return relax ? '0?' : '0';
    case 2:
      return relax ? '0{0,2}' : '00';
    default: {
      return relax ? `0{0,${diff}}` : `0{${diff}}`;
    }
  }
}

/**
 * Cache
 */

toRegexRange.cache = {};
toRegexRange.clearCache = () => (toRegexRange.cache = {});

/**
 * Expose `toRegexRange`
 */

module.exports = toRegexRange;
{
  "name": "to-regex-range",
  "description": "Pass two numbers, get a regex-compatible source string for matching ranges. Validated against more than 2.78 million test assertions.",
  "version": "5.0.1",
  "homepage": "https://github.com/micromatch/to-regex-range",
  "author": "Jon Schlinkert (https://github.com/jonschlinkert)",
  "repository": "micromatch/to-regex-range",
  "license": "MIT",
  "files": [
    "index.js"
  ],
  "main": "index.js",
  "engines": {
    "node": ">=8.0"
  },
  "dependencies": {
    "is-number": "^7.0.0"
  },
  "devDependencies": {
    "fill-range": "^6.0.0",
    "gulp-format-md": "^2.0.0",
    "mocha": "^6.0.2",
    "text-table": "^0.2.0",
    "time-diff": "^0.3.1"
  },
  "verb": {
    "layout": "default",
    "toc": false,
    "tasks": [
      "readme"
    ],
    "plugins": [
      "gulp-format-md"
    ],
    "lint": {
      "reflinks": true
    },
    "helpers": {
      "examples": {
        "displayName": "examples"
      }
    },
    "related": {
      "list": [
        "expand-range",
        "fill-range",
        "micromatch",
        "repeat-element",
        "repeat-string"
      ]
    }
  }
}